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
e1f4be9e5cd9c0f2196045d9eae82e270c395ef3
[ "opening, count = (0, 0)\nfor ch in S:\n if ch == '(':\n opening += 1\n elif opening > 0:\n opening -= 1\n else:\n count += 1\nreturn count + opening", "dq = collections.deque()\nl = []\nstackEmpty = True\nfor ch in S:\n if ch == ')':\n if len(dq) == 0:\n l.appen...
<|body_start_0|> opening, count = (0, 0) for ch in S: if ch == '(': opening += 1 elif opening > 0: opening -= 1 else: count += 1 return count + opening <|end_body_0|> <|body_start_1|> dq = collections.de...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minAddToMakeValid(self, S): """:type S: str :rtype: int""" <|body_0|> def minAddToMakeValid2(self, S): """:type S: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> opening, count = (0, 0) for ch in S: ...
stack_v2_sparse_classes_36k_train_008700
1,042
no_license
[ { "docstring": ":type S: str :rtype: int", "name": "minAddToMakeValid", "signature": "def minAddToMakeValid(self, S)" }, { "docstring": ":type S: str :rtype: int", "name": "minAddToMakeValid2", "signature": "def minAddToMakeValid2(self, S)" } ]
2
stack_v2_sparse_classes_30k_train_013414
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minAddToMakeValid(self, S): :type S: str :rtype: int - def minAddToMakeValid2(self, S): :type S: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minAddToMakeValid(self, S): :type S: str :rtype: int - def minAddToMakeValid2(self, S): :type S: str :rtype: int <|skeleton|> class Solution: def minAddToMakeValid(self...
813235789ce422a3bab198317aafc46fbc61625e
<|skeleton|> class Solution: def minAddToMakeValid(self, S): """:type S: str :rtype: int""" <|body_0|> def minAddToMakeValid2(self, S): """:type S: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minAddToMakeValid(self, S): """:type S: str :rtype: int""" opening, count = (0, 0) for ch in S: if ch == '(': opening += 1 elif opening > 0: opening -= 1 else: count += 1 return co...
the_stack_v2_python_sparse
11. STRING MANIP/921_Minimum Add to Make Parentheses Valid/solution.py
kimmyoo/python_leetcode
train
1
2b3d9dee1a08c017f17e621e995a8ecd1e8aed43
[ "mol = Chem.MolFromSmiles(smiles)\nengine = ScaffoldGenerator(include_chirality=include_chirality)\nscaffold = engine.get_scaffold(mol)\nreturn scaffold", "np.testing.assert_almost_equal(frac_train + frac_valid + frac_test, 1.0)\nscaffolds = {}\nlog('About to generate scaffolds', self.verbose)\ndata_len = len(dat...
<|body_start_0|> mol = Chem.MolFromSmiles(smiles) engine = ScaffoldGenerator(include_chirality=include_chirality) scaffold = engine.get_scaffold(mol) return scaffold <|end_body_0|> <|body_start_1|> np.testing.assert_almost_equal(frac_train + frac_valid + frac_test, 1.0) ...
Class for doing data splits based on the scaffold of small molecules.
ScaffoldSplitter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScaffoldSplitter: """Class for doing data splits based on the scaffold of small molecules.""" def generate_scaffold(self, smiles, include_chirality=False): """Compute the Bemis-Murcko scaffold for a SMILES string.""" <|body_0|> def split(self, dataset, frac_train=0.5, fr...
stack_v2_sparse_classes_36k_train_008701
3,303
no_license
[ { "docstring": "Compute the Bemis-Murcko scaffold for a SMILES string.", "name": "generate_scaffold", "signature": "def generate_scaffold(self, smiles, include_chirality=False)" }, { "docstring": "Splits internal compounds into train/validation/test by scaffold.", "name": "split", "signa...
2
stack_v2_sparse_classes_30k_train_008356
Implement the Python class `ScaffoldSplitter` described below. Class description: Class for doing data splits based on the scaffold of small molecules. Method signatures and docstrings: - def generate_scaffold(self, smiles, include_chirality=False): Compute the Bemis-Murcko scaffold for a SMILES string. - def split(s...
Implement the Python class `ScaffoldSplitter` described below. Class description: Class for doing data splits based on the scaffold of small molecules. Method signatures and docstrings: - def generate_scaffold(self, smiles, include_chirality=False): Compute the Bemis-Murcko scaffold for a SMILES string. - def split(s...
57e40d04181059ca39890d22361606edfadcc930
<|skeleton|> class ScaffoldSplitter: """Class for doing data splits based on the scaffold of small molecules.""" def generate_scaffold(self, smiles, include_chirality=False): """Compute the Bemis-Murcko scaffold for a SMILES string.""" <|body_0|> def split(self, dataset, frac_train=0.5, fr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScaffoldSplitter: """Class for doing data splits based on the scaffold of small molecules.""" def generate_scaffold(self, smiles, include_chirality=False): """Compute the Bemis-Murcko scaffold for a SMILES string.""" mol = Chem.MolFromSmiles(smiles) engine = ScaffoldGenerator(incl...
the_stack_v2_python_sparse
utils/splitter/scaffoldsplitter.py
moguizhizi/Adaptive-Graph-Convolutional-Network
train
0
d8e10ba53d21360d27236c6a9c75ac9a0a26fdad
[ "self.data = data\nself.page_size = page_size\nself.is_start = False\nself.is_end = False\nself.page_count = len(data)\nself.next_page = 0\nself.previous_page = 0\nself.page_nmuber = self.page_count / page_size\nif self.page_nmuber == int(self.page_nmuber):\n self.page_nmuber = int(self.page_nmuber)\nelse:\n ...
<|body_start_0|> self.data = data self.page_size = page_size self.is_start = False self.is_end = False self.page_count = len(data) self.next_page = 0 self.previous_page = 0 self.page_nmuber = self.page_count / page_size if self.page_nmuber == int(s...
flask分页通过sqlalachemy查询进行分页 offset 偏移,开始查询的位置 limit 单页条数 分页器需要具备的功能 页码 分页数据 是否第一页 是否最后一页
Pager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pager: """flask分页通过sqlalachemy查询进行分页 offset 偏移,开始查询的位置 limit 单页条数 分页器需要具备的功能 页码 分页数据 是否第一页 是否最后一页""" def __init__(self, data, page_size): """:param data: 要分页的数据 :param page_size: 每页多少条""" <|body_0|> def page_data(self, page): """返回分页数据 :param page: 页码 page_size =...
stack_v2_sparse_classes_36k_train_008702
12,240
permissive
[ { "docstring": ":param data: 要分页的数据 :param page_size: 每页多少条", "name": "__init__", "signature": "def __init__(self, data, page_size)" }, { "docstring": "返回分页数据 :param page: 页码 page_size = 10 1 offect 0 limit(10) 2 offect 10 limit(10) page_size = 10 1 start 0 end 10 2 start 10 end 20 3 start 20 en...
2
stack_v2_sparse_classes_30k_train_004456
Implement the Python class `Pager` described below. Class description: flask分页通过sqlalachemy查询进行分页 offset 偏移,开始查询的位置 limit 单页条数 分页器需要具备的功能 页码 分页数据 是否第一页 是否最后一页 Method signatures and docstrings: - def __init__(self, data, page_size): :param data: 要分页的数据 :param page_size: 每页多少条 - def page_data(self, page): 返回分页数据 :param...
Implement the Python class `Pager` described below. Class description: flask分页通过sqlalachemy查询进行分页 offset 偏移,开始查询的位置 limit 单页条数 分页器需要具备的功能 页码 分页数据 是否第一页 是否最后一页 Method signatures and docstrings: - def __init__(self, data, page_size): :param data: 要分页的数据 :param page_size: 每页多少条 - def page_data(self, page): 返回分页数据 :param...
2fce76763eee9a177ace466c43169e80d5c5b73c
<|skeleton|> class Pager: """flask分页通过sqlalachemy查询进行分页 offset 偏移,开始查询的位置 limit 单页条数 分页器需要具备的功能 页码 分页数据 是否第一页 是否最后一页""" def __init__(self, data, page_size): """:param data: 要分页的数据 :param page_size: 每页多少条""" <|body_0|> def page_data(self, page): """返回分页数据 :param page: 页码 page_size =...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Pager: """flask分页通过sqlalachemy查询进行分页 offset 偏移,开始查询的位置 limit 单页条数 分页器需要具备的功能 页码 分页数据 是否第一页 是否最后一页""" def __init__(self, data, page_size): """:param data: 要分页的数据 :param page_size: 每页多少条""" self.data = data self.page_size = page_size self.is_start = False self.is_end...
the_stack_v2_python_sparse
Flasknew/app/main/views.py
bestwishfang/PersonWork
train
0
05c9918378c9f6e5a98a47c1c5f20ae76eeea900
[ "heights.append(0)\nstack = []\ni = 0\nans = 0\nwhile i < len(heights):\n if len(stack) < 1 or heights[i] > heights[stack[-1]]:\n stack.append(i)\n i += 1\n else:\n tmp = stack.pop()\n ans = max(ans, heights[tmp] * (i if len(stack) < 1 else i - stack[-1] - 1))\nreturn ans", "n = ...
<|body_start_0|> heights.append(0) stack = [] i = 0 ans = 0 while i < len(heights): if len(stack) < 1 or heights[i] > heights[stack[-1]]: stack.append(i) i += 1 else: tmp = stack.pop() ans = m...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestRectangleArea(self, heights): """:type heights: List[int] :rtype: int""" <|body_0|> def maximalRectangle(self, matrix): """:type matrix: List[List[str]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> heights.append(...
stack_v2_sparse_classes_36k_train_008703
1,372
no_license
[ { "docstring": ":type heights: List[int] :rtype: int", "name": "largestRectangleArea", "signature": "def largestRectangleArea(self, heights)" }, { "docstring": ":type matrix: List[List[str]] :rtype: int", "name": "maximalRectangle", "signature": "def maximalRectangle(self, matrix)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int - def maximalRectangle(self, matrix): :type matrix: List[List[str]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int - def maximalRectangle(self, matrix): :type matrix: List[List[str]] :rtype: int <|skeleton|> class ...
e890bd480de93418ce10867085b52137be2caa7a
<|skeleton|> class Solution: def largestRectangleArea(self, heights): """:type heights: List[int] :rtype: int""" <|body_0|> def maximalRectangle(self, matrix): """:type matrix: List[List[str]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def largestRectangleArea(self, heights): """:type heights: List[int] :rtype: int""" heights.append(0) stack = [] i = 0 ans = 0 while i < len(heights): if len(stack) < 1 or heights[i] > heights[stack[-1]]: stack.append(i) ...
the_stack_v2_python_sparse
python/85.py
LichAmnesia/LeetCode
train
0
ba931855d2dac4e79e0c64076540876b6b60f0c7
[ "super(NeutronSubnetARMTranslator, self).get_variables()\ncidr = self._heat_resource.properties['cidr']\nreturn {'subNetAddressPrefix_%s' % self._heat_resource_name: cidr}", "super(NeutronSubnetARMTranslator, self).get_resource_data()\nnet_name = self._context.heat_resource_stack[self._heat_resource.properties['n...
<|body_start_0|> super(NeutronSubnetARMTranslator, self).get_variables() cidr = self._heat_resource.properties['cidr'] return {'subNetAddressPrefix_%s' % self._heat_resource_name: cidr} <|end_body_0|> <|body_start_1|> super(NeutronSubnetARMTranslator, self).get_resource_data() n...
NeutronSubnetARMTranslator is the translator associated to a Neutron subnet. This translator leads to the defining of a new virtual network; as Neutron nets themselves have no real resulting translation without them.
NeutronSubnetARMTranslator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NeutronSubnetARMTranslator: """NeutronSubnetARMTranslator is the translator associated to a Neutron subnet. This translator leads to the defining of a new virtual network; as Neutron nets themselves have no real resulting translation without them.""" def get_variables(self): """get_v...
stack_v2_sparse_classes_36k_train_008704
4,905
permissive
[ { "docstring": "get_variables resurns the dict of ARM template variables associated with the Neutron subnet.", "name": "get_variables", "signature": "def get_variables(self)" }, { "docstring": "get_resource_data retuns the list of all characteristics representing the subnet which can be directly...
2
stack_v2_sparse_classes_30k_train_021677
Implement the Python class `NeutronSubnetARMTranslator` described below. Class description: NeutronSubnetARMTranslator is the translator associated to a Neutron subnet. This translator leads to the defining of a new virtual network; as Neutron nets themselves have no real resulting translation without them. Method si...
Implement the Python class `NeutronSubnetARMTranslator` described below. Class description: NeutronSubnetARMTranslator is the translator associated to a Neutron subnet. This translator leads to the defining of a new virtual network; as Neutron nets themselves have no real resulting translation without them. Method si...
83472c7a4af3496e28c1b7b4021e31c373f37784
<|skeleton|> class NeutronSubnetARMTranslator: """NeutronSubnetARMTranslator is the translator associated to a Neutron subnet. This translator leads to the defining of a new virtual network; as Neutron nets themselves have no real resulting translation without them.""" def get_variables(self): """get_v...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NeutronSubnetARMTranslator: """NeutronSubnetARMTranslator is the translator associated to a Neutron subnet. This translator leads to the defining of a new virtual network; as Neutron nets themselves have no real resulting translation without them.""" def get_variables(self): """get_variables resu...
the_stack_v2_python_sparse
heat2arm/translators/networking/neutron_net.py
travlaw/heat2arm
train
0
e54efb15c51dff9e2990d56eae3315ff7365116b
[ "byte_string = erd_decode_bytes(value)\ncook_mode_code = byte_string[0]\ntemperature = int.from_bytes(byte_string[1:3], 'big')\ncook_mode = ErdOvenCookMode(cook_mode_code)\nreturn OvenCookSetting(cook_mode=OVEN_COOK_MODE_MAP[cook_mode], temperature=temperature, raw_bytes=byte_string)", "cook_mode = value.cook_mod...
<|body_start_0|> byte_string = erd_decode_bytes(value) cook_mode_code = byte_string[0] temperature = int.from_bytes(byte_string[1:3], 'big') cook_mode = ErdOvenCookMode(cook_mode_code) return OvenCookSetting(cook_mode=OVEN_COOK_MODE_MAP[cook_mode], temperature=temperature, raw_by...
OvenCookModeConverter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OvenCookModeConverter: def erd_decode(self, value: str) -> OvenCookSetting: """Get the cook mode and temperature. TODO: Figure out what the other 10 bytes are for. I'm guessing they have to do with two-temp cooking, probes, delayed starts, timers, etc.""" <|body_0|> def erd_...
stack_v2_sparse_classes_36k_train_008705
1,279
permissive
[ { "docstring": "Get the cook mode and temperature. TODO: Figure out what the other 10 bytes are for. I'm guessing they have to do with two-temp cooking, probes, delayed starts, timers, etc.", "name": "erd_decode", "signature": "def erd_decode(self, value: str) -> OvenCookSetting" }, { "docstring...
2
stack_v2_sparse_classes_30k_train_019551
Implement the Python class `OvenCookModeConverter` described below. Class description: Implement the OvenCookModeConverter class. Method signatures and docstrings: - def erd_decode(self, value: str) -> OvenCookSetting: Get the cook mode and temperature. TODO: Figure out what the other 10 bytes are for. I'm guessing t...
Implement the Python class `OvenCookModeConverter` described below. Class description: Implement the OvenCookModeConverter class. Method signatures and docstrings: - def erd_decode(self, value: str) -> OvenCookSetting: Get the cook mode and temperature. TODO: Figure out what the other 10 bytes are for. I'm guessing t...
017aeca860f231f60bc70fc747067388ad577b18
<|skeleton|> class OvenCookModeConverter: def erd_decode(self, value: str) -> OvenCookSetting: """Get the cook mode and temperature. TODO: Figure out what the other 10 bytes are for. I'm guessing they have to do with two-temp cooking, probes, delayed starts, timers, etc.""" <|body_0|> def erd_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OvenCookModeConverter: def erd_decode(self, value: str) -> OvenCookSetting: """Get the cook mode and temperature. TODO: Figure out what the other 10 bytes are for. I'm guessing they have to do with two-temp cooking, probes, delayed starts, timers, etc.""" byte_string = erd_decode_bytes(value) ...
the_stack_v2_python_sparse
gehomesdk/erd/converters/oven/oven_cook_mode_converter.py
bendavis/gehome
train
0
b0885b3053ff65667b86eb1a0d192b8ef818f1f8
[ "import re\nfor int_pat in self.patterns:\n match = re.search(int_pat, text, flags=re.IGNORECASE)\n if match:\n return match[1]\nreturn False", "if self.recept(text, *args, **kwargs):\n return True\nelse:\n return False" ]
<|body_start_0|> import re for int_pat in self.patterns: match = re.search(int_pat, text, flags=re.IGNORECASE) if match: return match[1] return False <|end_body_0|> <|body_start_1|> if self.recept(text, *args, **kwargs): return True ...
Slot which validates answer by patterns in regexp
PatternedTextSlot
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PatternedTextSlot: """Slot which validates answer by patterns in regexp""" def recept(self, text, *args, **kwargs): """Method that actually recepts message and extracts Slot's Value from it Args: text: text to be analyzed (str) *args: **kwargs: Returns:""" <|body_0|> def...
stack_v2_sparse_classes_36k_train_008706
26,321
no_license
[ { "docstring": "Method that actually recepts message and extracts Slot's Value from it Args: text: text to be analyzed (str) *args: **kwargs: Returns:", "name": "recept", "signature": "def recept(self, text, *args, **kwargs)" }, { "docstring": "Method that checks if UserMessage can be recepted b...
2
null
Implement the Python class `PatternedTextSlot` described below. Class description: Slot which validates answer by patterns in regexp Method signatures and docstrings: - def recept(self, text, *args, **kwargs): Method that actually recepts message and extracts Slot's Value from it Args: text: text to be analyzed (str)...
Implement the Python class `PatternedTextSlot` described below. Class description: Slot which validates answer by patterns in regexp Method signatures and docstrings: - def recept(self, text, *args, **kwargs): Method that actually recepts message and extracts Slot's Value from it Args: text: text to be analyzed (str)...
7a0bc78ca03ee8ca1202e8ad2a6860444f0ce75d
<|skeleton|> class PatternedTextSlot: """Slot which validates answer by patterns in regexp""" def recept(self, text, *args, **kwargs): """Method that actually recepts message and extracts Slot's Value from it Args: text: text to be analyzed (str) *args: **kwargs: Returns:""" <|body_0|> def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PatternedTextSlot: """Slot which validates answer by patterns in regexp""" def recept(self, text, *args, **kwargs): """Method that actually recepts message and extracts Slot's Value from it Args: text: text to be analyzed (str) *args: **kwargs: Returns:""" import re for int_pat in...
the_stack_v2_python_sparse
ruler_bot/components/slots/slots.py
acriptis/dj_bot
train
3
55a8d31018ec74d8722fc0afe894a7a192e2d665
[ "audit = AuditResource.get_by_id(audit_uuid=audit_uuid, withContacts=False, withScans=False)\nif audit['submitted'] == True:\n abort(400, 'Already submitted')\nif audit['approved'] == True:\n abort(400, 'Already approved by administrator(s)')\nschema = AuditUpdateSchema(only=['submitted', 'rejected_reason'])\...
<|body_start_0|> audit = AuditResource.get_by_id(audit_uuid=audit_uuid, withContacts=False, withScans=False) if audit['submitted'] == True: abort(400, 'Already submitted') if audit['approved'] == True: abort(400, 'Already approved by administrator(s)') schema = Au...
AuditSubmission
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuditSubmission: def post(self, audit_uuid): """Submit the specified audit result""" <|body_0|> def delete(self, audit_uuid): """Withdraw the submission of the specified audit result""" <|body_1|> <|end_skeleton|> <|body_start_0|> audit = AuditResou...
stack_v2_sparse_classes_36k_train_008707
18,857
no_license
[ { "docstring": "Submit the specified audit result", "name": "post", "signature": "def post(self, audit_uuid)" }, { "docstring": "Withdraw the submission of the specified audit result", "name": "delete", "signature": "def delete(self, audit_uuid)" } ]
2
stack_v2_sparse_classes_30k_train_006016
Implement the Python class `AuditSubmission` described below. Class description: Implement the AuditSubmission class. Method signatures and docstrings: - def post(self, audit_uuid): Submit the specified audit result - def delete(self, audit_uuid): Withdraw the submission of the specified audit result
Implement the Python class `AuditSubmission` described below. Class description: Implement the AuditSubmission class. Method signatures and docstrings: - def post(self, audit_uuid): Submit the specified audit result - def delete(self, audit_uuid): Withdraw the submission of the specified audit result <|skeleton|> cl...
7b67aa682d73c8a8d7f0f19b2a90e69c40761c58
<|skeleton|> class AuditSubmission: def post(self, audit_uuid): """Submit the specified audit result""" <|body_0|> def delete(self, audit_uuid): """Withdraw the submission of the specified audit result""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuditSubmission: def post(self, audit_uuid): """Submit the specified audit result""" audit = AuditResource.get_by_id(audit_uuid=audit_uuid, withContacts=False, withScans=False) if audit['submitted'] == True: abort(400, 'Already submitted') if audit['approved'] == Tr...
the_stack_v2_python_sparse
rem/apis/audit.py
recruit-tech/casval
train
6
f8ae41e4bfa3a3e2ba7c7d28a46d8bb90429e5fb
[ "if selections:\n selection = selections[0]\n editors = self.window.application.get_extensions(EDITORS)\n exts = [ext for factory in editors for ext in factory().extensions]\n if isinstance(selection, File) and selection.ext in exts:\n self.enabled = True\n else:\n self.enabled = False\...
<|body_start_0|> if selections: selection = selections[0] editors = self.window.application.get_extensions(EDITORS) exts = [ext for factory in editors for ext in factory().extensions] if isinstance(selection, File) and selection.ext in exts: self.e...
Defines an action that open the current resource.
OpenAction
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OpenAction: """Defines an action that open the current resource.""" def _selection_changed_for_window(self, selections): """Makes the action visible if a File is selected.""" <|body_0|> def _enabled_default(self): """Trait initialiser.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_008708
5,755
permissive
[ { "docstring": "Makes the action visible if a File is selected.", "name": "_selection_changed_for_window", "signature": "def _selection_changed_for_window(self, selections)" }, { "docstring": "Trait initialiser.", "name": "_enabled_default", "signature": "def _enabled_default(self)" },...
4
null
Implement the Python class `OpenAction` described below. Class description: Defines an action that open the current resource. Method signatures and docstrings: - def _selection_changed_for_window(self, selections): Makes the action visible if a File is selected. - def _enabled_default(self): Trait initialiser. - def ...
Implement the Python class `OpenAction` described below. Class description: Defines an action that open the current resource. Method signatures and docstrings: - def _selection_changed_for_window(self, selections): Makes the action visible if a File is selected. - def _enabled_default(self): Trait initialiser. - def ...
e8fc0b2d6b9b08e60389fc4714a5cf51f628b57f
<|skeleton|> class OpenAction: """Defines an action that open the current resource.""" def _selection_changed_for_window(self, selections): """Makes the action visible if a File is selected.""" <|body_0|> def _enabled_default(self): """Trait initialiser.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OpenAction: """Defines an action that open the current resource.""" def _selection_changed_for_window(self, selections): """Makes the action visible if a File is selected.""" if selections: selection = selections[0] editors = self.window.application.get_extensions(...
the_stack_v2_python_sparse
puddle/resource/action/open_action.py
rwl/puddle
train
2
6971f209acaf0cbbb0f0e2790f8b0befdd9d4317
[ "if k == 0:\n return s\nif k == 1:\n return min((s[i:] + s[:i] for i in range(len(s))))\nelse:\n return ''.join(sorted(list(s)))", "if k > 2:\n return ''.join(sorted(s))\nret = s\nfor i in range(1, len(s)):\n ret = min(ret, s[i:] + s[:i])\nreturn ret" ]
<|body_start_0|> if k == 0: return s if k == 1: return min((s[i:] + s[:i] for i in range(len(s)))) else: return ''.join(sorted(list(s))) <|end_body_0|> <|body_start_1|> if k > 2: return ''.join(sorted(s)) ret = s for i in r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def orderlyQueue(self, s: str, k: int) -> str: """09/22/2021 21:15""" <|body_0|> def orderlyQueue(self, s: str, k: int) -> str: """11/13/2022 18:09""" <|body_1|> <|end_skeleton|> <|body_start_0|> if k == 0: return s if ...
stack_v2_sparse_classes_36k_train_008709
1,850
no_license
[ { "docstring": "09/22/2021 21:15", "name": "orderlyQueue", "signature": "def orderlyQueue(self, s: str, k: int) -> str" }, { "docstring": "11/13/2022 18:09", "name": "orderlyQueue", "signature": "def orderlyQueue(self, s: str, k: int) -> str" } ]
2
stack_v2_sparse_classes_30k_train_015011
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def orderlyQueue(self, s: str, k: int) -> str: 09/22/2021 21:15 - def orderlyQueue(self, s: str, k: int) -> str: 11/13/2022 18:09
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def orderlyQueue(self, s: str, k: int) -> str: 09/22/2021 21:15 - def orderlyQueue(self, s: str, k: int) -> str: 11/13/2022 18:09 <|skeleton|> class Solution: def orderlyQu...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def orderlyQueue(self, s: str, k: int) -> str: """09/22/2021 21:15""" <|body_0|> def orderlyQueue(self, s: str, k: int) -> str: """11/13/2022 18:09""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def orderlyQueue(self, s: str, k: int) -> str: """09/22/2021 21:15""" if k == 0: return s if k == 1: return min((s[i:] + s[:i] for i in range(len(s)))) else: return ''.join(sorted(list(s))) def orderlyQueue(self, s: str, k: int...
the_stack_v2_python_sparse
leetcode/solved/935_Orderly_Queue/solution.py
sungminoh/algorithms
train
0
592a010bf240f8442e6015118c0ab5076aad0380
[ "description = data_utils.rand_name('test_create_consumer')\nconsumer = self.oauth_consumers_client.create_consumer(description)['consumer']\nself.addCleanup(test_utils.call_and_ignore_notfound_exc, self.oauth_consumers_client.delete_consumer, consumer['id'])\nreturn consumer", "consumer = self._create_consumer()...
<|body_start_0|> description = data_utils.rand_name('test_create_consumer') consumer = self.oauth_consumers_client.create_consumer(description)['consumer'] self.addCleanup(test_utils.call_and_ignore_notfound_exc, self.oauth_consumers_client.delete_consumer, consumer['id']) return consume...
OAUTHConsumersV3Test
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OAUTHConsumersV3Test: def _create_consumer(self): """Creates a consumer with a random description.""" <|body_0|> def test_create_and_show_consumer(self): """Tests to make sure that a consumer with parameters is made""" <|body_1|> def test_delete_consumer...
stack_v2_sparse_classes_36k_train_008710
4,451
permissive
[ { "docstring": "Creates a consumer with a random description.", "name": "_create_consumer", "signature": "def _create_consumer(self)" }, { "docstring": "Tests to make sure that a consumer with parameters is made", "name": "test_create_and_show_consumer", "signature": "def test_create_and...
5
null
Implement the Python class `OAUTHConsumersV3Test` described below. Class description: Implement the OAUTHConsumersV3Test class. Method signatures and docstrings: - def _create_consumer(self): Creates a consumer with a random description. - def test_create_and_show_consumer(self): Tests to make sure that a consumer wi...
Implement the Python class `OAUTHConsumersV3Test` described below. Class description: Implement the OAUTHConsumersV3Test class. Method signatures and docstrings: - def _create_consumer(self): Creates a consumer with a random description. - def test_create_and_show_consumer(self): Tests to make sure that a consumer wi...
3932a799e620a20d7abf7b89e21b520683a1809b
<|skeleton|> class OAUTHConsumersV3Test: def _create_consumer(self): """Creates a consumer with a random description.""" <|body_0|> def test_create_and_show_consumer(self): """Tests to make sure that a consumer with parameters is made""" <|body_1|> def test_delete_consumer...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OAUTHConsumersV3Test: def _create_consumer(self): """Creates a consumer with a random description.""" description = data_utils.rand_name('test_create_consumer') consumer = self.oauth_consumers_client.create_consumer(description)['consumer'] self.addCleanup(test_utils.call_and_i...
the_stack_v2_python_sparse
tempest/api/identity/admin/v3/test_oauth_consumers.py
openstack/tempest
train
270
0b3bc52a223e3032880b4ddd37fb04225a1bd2a8
[ "ctx.save_for_backward(input)\nout = torch.zeros_like(input)\nout[input > 0] = 1.0\nreturn out", "input, = ctx.saved_tensors\ngrad_input = grad_output.clone()\ngrad = grad_input / (SuperSpike.scale * torch.abs(input) + 1.0) ** 2\nreturn grad" ]
<|body_start_0|> ctx.save_for_backward(input) out = torch.zeros_like(input) out[input > 0] = 1.0 return out <|end_body_0|> <|body_start_1|> input, = ctx.saved_tensors grad_input = grad_output.clone() grad = grad_input / (SuperSpike.scale * torch.abs(input) + 1.0)...
Here we implement our spiking nonlinearity which also implements the surrogate gradient. By subclassing torch.autograd.Function, we will be able to use all of PyTorch's autograd functionality. Here we use the normalized negative part of a fast sigmoid as this was done in Zenke & Ganguli (2018).
SuperSpike
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SuperSpike: """Here we implement our spiking nonlinearity which also implements the surrogate gradient. By subclassing torch.autograd.Function, we will be able to use all of PyTorch's autograd functionality. Here we use the normalized negative part of a fast sigmoid as this was done in Zenke & Ga...
stack_v2_sparse_classes_36k_train_008711
16,829
permissive
[ { "docstring": "In the forward pass we compute a step function of the input Tensor and return it. ctx is a context object that we use to stash information which we need to later backpropagate our error signals. To achieve this we use the ctx.save_for_backward method.", "name": "forward", "signature": "d...
2
stack_v2_sparse_classes_30k_train_013736
Implement the Python class `SuperSpike` described below. Class description: Here we implement our spiking nonlinearity which also implements the surrogate gradient. By subclassing torch.autograd.Function, we will be able to use all of PyTorch's autograd functionality. Here we use the normalized negative part of a fast...
Implement the Python class `SuperSpike` described below. Class description: Here we implement our spiking nonlinearity which also implements the surrogate gradient. By subclassing torch.autograd.Function, we will be able to use all of PyTorch's autograd functionality. Here we use the normalized negative part of a fast...
8bf028a5aa3f545239133a5f9f2937de9a5803d7
<|skeleton|> class SuperSpike: """Here we implement our spiking nonlinearity which also implements the surrogate gradient. By subclassing torch.autograd.Function, we will be able to use all of PyTorch's autograd functionality. Here we use the normalized negative part of a fast sigmoid as this was done in Zenke & Ga...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SuperSpike: """Here we implement our spiking nonlinearity which also implements the surrogate gradient. By subclassing torch.autograd.Function, we will be able to use all of PyTorch's autograd functionality. Here we use the normalized negative part of a fast sigmoid as this was done in Zenke & Ganguli (2018)....
the_stack_v2_python_sparse
Code/SQN.py
vhris/Deep-Spiking-Q-Networks
train
10
c110498e102aebfbc90fba86602a541e5d5ceb29
[ "self.p = p\nfrom sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing\nself.ring = PolynomialRing(FiniteField(p), 'x')\nif use_database:\n C = sage.databases.conway.ConwayPolynomials()\n self.nodes = {n: self.ring(C.polynomial(p, n)) for n in C.degrees(p)}\nelse:\n self.nodes = {}", "...
<|body_start_0|> self.p = p from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing self.ring = PolynomialRing(FiniteField(p), 'x') if use_database: C = sage.databases.conway.ConwayPolynomials() self.nodes = {n: self.ring(C.polynomial(p, n)) f...
A pseudo-Conway lattice over a given finite prime field. The Conway polynomial `f_n` of degree `n` over `\\Bold{F}_p` is defined by the following four conditions: - `f_n` is irreducible. - In the quotient field `\\Bold{F}_p[x]/(f_n)`, the element `x\\bmod f_n` generates the multiplicative group. - The minimal polynomia...
PseudoConwayLattice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PseudoConwayLattice: """A pseudo-Conway lattice over a given finite prime field. The Conway polynomial `f_n` of degree `n` over `\\Bold{F}_p` is defined by the following four conditions: - `f_n` is irreducible. - In the quotient field `\\Bold{F}_p[x]/(f_n)`, the element `x\\bmod f_n` generates th...
stack_v2_sparse_classes_36k_train_008712
18,867
no_license
[ { "docstring": "TESTS:: sage: from sage.rings.finite_rings.conway_polynomials import PseudoConwayLattice sage: PCL = PseudoConwayLattice(3) sage: PCL.polynomial(3) x^3 + 2*x + 1 sage: PCL = PseudoConwayLattice(5, use_database=False) sage: PCL.polynomial(12) x^12 + 4*x^11 + 2*x^10 + 4*x^9 + 2*x^8 + 2*x^7 + 4*x^6...
3
stack_v2_sparse_classes_30k_train_018781
Implement the Python class `PseudoConwayLattice` described below. Class description: A pseudo-Conway lattice over a given finite prime field. The Conway polynomial `f_n` of degree `n` over `\\Bold{F}_p` is defined by the following four conditions: - `f_n` is irreducible. - In the quotient field `\\Bold{F}_p[x]/(f_n)`,...
Implement the Python class `PseudoConwayLattice` described below. Class description: A pseudo-Conway lattice over a given finite prime field. The Conway polynomial `f_n` of degree `n` over `\\Bold{F}_p` is defined by the following four conditions: - `f_n` is irreducible. - In the quotient field `\\Bold{F}_p[x]/(f_n)`,...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class PseudoConwayLattice: """A pseudo-Conway lattice over a given finite prime field. The Conway polynomial `f_n` of degree `n` over `\\Bold{F}_p` is defined by the following four conditions: - `f_n` is irreducible. - In the quotient field `\\Bold{F}_p[x]/(f_n)`, the element `x\\bmod f_n` generates th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PseudoConwayLattice: """A pseudo-Conway lattice over a given finite prime field. The Conway polynomial `f_n` of degree `n` over `\\Bold{F}_p` is defined by the following four conditions: - `f_n` is irreducible. - In the quotient field `\\Bold{F}_p[x]/(f_n)`, the element `x\\bmod f_n` generates the multiplicat...
the_stack_v2_python_sparse
sage/src/sage/rings/finite_rings/conway_polynomials.py
bopopescu/geosci
train
0
cb208f5b06e0a3683ece12eab844fb7c92966d80
[ "if not head or not head.next:\n return head\nslow, fast = (head, head)\nwhile fast.next and fast.next.next:\n slow = slow.next\n fast = fast.next.next\nreturn slow", "if not head or not head.next:\n return head\ncount = 0\ntemp = head\nwhile temp:\n count += 1\n temp = temp.next\nfor i in range...
<|body_start_0|> if not head or not head.next: return head slow, fast = (head, head) while fast.next and fast.next.next: slow = slow.next fast = fast.next.next return slow <|end_body_0|> <|body_start_1|> if not head or not head.next: ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def middle_linked_list(self, head: ListNode) -> ListNode: """找出中间结点 Args: head: 头结点 Returns: 中间结点""" <|body_0|> def middle_linked_list2(self, head: ListNode) -> ListNode: """找出中间结点 Args: head: 头结点 Returns: 中间结点""" <|body_1|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_008713
2,791
permissive
[ { "docstring": "找出中间结点 Args: head: 头结点 Returns: 中间结点", "name": "middle_linked_list", "signature": "def middle_linked_list(self, head: ListNode) -> ListNode" }, { "docstring": "找出中间结点 Args: head: 头结点 Returns: 中间结点", "name": "middle_linked_list2", "signature": "def middle_linked_list2(self...
2
stack_v2_sparse_classes_30k_train_009568
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def middle_linked_list(self, head: ListNode) -> ListNode: 找出中间结点 Args: head: 头结点 Returns: 中间结点 - def middle_linked_list2(self, head: ListNode) -> ListNode: 找出中间结点 Args: head: 头结点...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def middle_linked_list(self, head: ListNode) -> ListNode: 找出中间结点 Args: head: 头结点 Returns: 中间结点 - def middle_linked_list2(self, head: ListNode) -> ListNode: 找出中间结点 Args: head: 头结点...
50f35eef6a0ad63173efed10df3c835b1dceaa3f
<|skeleton|> class Solution: def middle_linked_list(self, head: ListNode) -> ListNode: """找出中间结点 Args: head: 头结点 Returns: 中间结点""" <|body_0|> def middle_linked_list2(self, head: ListNode) -> ListNode: """找出中间结点 Args: head: 头结点 Returns: 中间结点""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def middle_linked_list(self, head: ListNode) -> ListNode: """找出中间结点 Args: head: 头结点 Returns: 中间结点""" if not head or not head.next: return head slow, fast = (head, head) while fast.next and fast.next.next: slow = slow.next fast = fas...
the_stack_v2_python_sparse
src/leetcodepython/list/middle_linked_list_876.py
zhangyu345293721/leetcode
train
101
001556dc0613a70bb7af7de995cf9a37e75ec170
[ "self.grid = ugrid\npts = self.grid.GetPoints()\nnumPoints = pts.GetNumberOfPoints()\ndata = vtk.vtkDoubleArray()\ndata.SetName(name)\ndata.SetNumberOfComponents(1)\ndata.SetNumberOfTuples(numPoints)\nfor i in range(numPoints):\n xyz = pts.GetPoint(i)\n f = nodalFunc(xyz)\n data.SetTuple(i, (f,))\nself.gri...
<|body_start_0|> self.grid = ugrid pts = self.grid.GetPoints() numPoints = pts.GetNumberOfPoints() data = vtk.vtkDoubleArray() data.SetName(name) data.SetNumberOfComponents(1) data.SetNumberOfTuples(numPoints) for i in range(numPoints): xyz = p...
NodalFunctionWriter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NodalFunctionWriter: def __init__(self, ugrid, nodalFunc, name='nodalFunction'): """Constructor @param ugrid vtkUnstructuredGrid instance @param nodalFunc""" <|body_0|> def save(self, filename): """Save data in file @param filename file name""" <|body_1|> <|...
stack_v2_sparse_classes_36k_train_008714
962
no_license
[ { "docstring": "Constructor @param ugrid vtkUnstructuredGrid instance @param nodalFunc", "name": "__init__", "signature": "def __init__(self, ugrid, nodalFunc, name='nodalFunction')" }, { "docstring": "Save data in file @param filename file name", "name": "save", "signature": "def save(s...
2
stack_v2_sparse_classes_30k_train_017377
Implement the Python class `NodalFunctionWriter` described below. Class description: Implement the NodalFunctionWriter class. Method signatures and docstrings: - def __init__(self, ugrid, nodalFunc, name='nodalFunction'): Constructor @param ugrid vtkUnstructuredGrid instance @param nodalFunc - def save(self, filename...
Implement the Python class `NodalFunctionWriter` described below. Class description: Implement the NodalFunctionWriter class. Method signatures and docstrings: - def __init__(self, ugrid, nodalFunc, name='nodalFunction'): Constructor @param ugrid vtkUnstructuredGrid instance @param nodalFunc - def save(self, filename...
383bfa5e8b450eda0cbc6bdebf092e81712034e4
<|skeleton|> class NodalFunctionWriter: def __init__(self, ugrid, nodalFunc, name='nodalFunction'): """Constructor @param ugrid vtkUnstructuredGrid instance @param nodalFunc""" <|body_0|> def save(self, filename): """Save data in file @param filename file name""" <|body_1|> <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NodalFunctionWriter: def __init__(self, ugrid, nodalFunc, name='nodalFunction'): """Constructor @param ugrid vtkUnstructuredGrid instance @param nodalFunc""" self.grid = ugrid pts = self.grid.GetPoints() numPoints = pts.GetNumberOfPoints() data = vtk.vtkDoubleArray() ...
the_stack_v2_python_sparse
py/igNodalFunctionWriter.py
pletzer/inugrid
train
0
f2dd0adc1e4e1d42062a7456aeee4218dc58244d
[ "if root is None:\n return root\nif root.val > key:\n root.left = self.deleteNode(root.left, key)\nelif root.val < key:\n root.right = self.deleteNode(root.right, key)\nelif root.left is None and root.right is None:\n root = None\nelif root.right is not None:\n root.val = self.successor(root.right)\n...
<|body_start_0|> if root is None: return root if root.val > key: root.left = self.deleteNode(root.left, key) elif root.val < key: root.right = self.deleteNode(root.right, key) elif root.left is None and root.right is None: root = None ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def deleteNode(self, root, key): """:type root: TreeNode :type key: int :rtype: TreeNode""" <|body_0|> def successor(self, root): """always left""" <|body_1|> def predecessor(self, root): """always right""" <|body_2|> <|end_ske...
stack_v2_sparse_classes_36k_train_008715
2,055
no_license
[ { "docstring": ":type root: TreeNode :type key: int :rtype: TreeNode", "name": "deleteNode", "signature": "def deleteNode(self, root, key)" }, { "docstring": "always left", "name": "successor", "signature": "def successor(self, root)" }, { "docstring": "always right", "name":...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteNode(self, root, key): :type root: TreeNode :type key: int :rtype: TreeNode - def successor(self, root): always left - def predecessor(self, root): always right
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteNode(self, root, key): :type root: TreeNode :type key: int :rtype: TreeNode - def successor(self, root): always left - def predecessor(self, root): always right <|skel...
e4d21223c85b622b5a905d1a056dfb2f300964b1
<|skeleton|> class Solution: def deleteNode(self, root, key): """:type root: TreeNode :type key: int :rtype: TreeNode""" <|body_0|> def successor(self, root): """always left""" <|body_1|> def predecessor(self, root): """always right""" <|body_2|> <|end_ske...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def deleteNode(self, root, key): """:type root: TreeNode :type key: int :rtype: TreeNode""" if root is None: return root if root.val > key: root.left = self.deleteNode(root.left, key) elif root.val < key: root.right = self.deleteNod...
the_stack_v2_python_sparse
Algorithms/tree/450.delete-node-in-a-bst/delete-node-in-a-bst.py
gosyang/leetcode
train
1
2ef601b6b82a6cd9749b697cd4c42d0d4ce7c62e
[ "self.t = t0\nself.y = y0\nself.t_bound = t_bound\nself.step_size = stepsize\nself._fun = fun\nself.direction = 1 * (self.t_bound >= t0) - 1 * (not self.t_bound < t0)", "if self.t >= self.t_bound and self.direction == 1 or (self.t <= self.t_bound and self.direction == -1):\n warnings.warn('Out of bounds set by...
<|body_start_0|> self.t = t0 self.y = y0 self.t_bound = t_bound self.step_size = stepsize self._fun = fun self.direction = 1 * (self.t_bound >= t0) - 1 * (not self.t_bound < t0) <|end_body_0|> <|body_start_1|> if self.t >= self.t_bound and self.direction == 1 or ...
Class for Defining Runge-Kutta 4th Order ODE solving method
RK4naive
[ "LicenseRef-scancode-proprietary-license", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RK4naive: """Class for Defining Runge-Kutta 4th Order ODE solving method""" def __init__(self, fun, t0, y0, t_bound, stepsize): """Initialization Parameters ---------- fun : function Should accept t, y as parameters, and return same type as y t0 : float Initial t y0 : ~numpy.array or...
stack_v2_sparse_classes_36k_train_008716
3,387
permissive
[ { "docstring": "Initialization Parameters ---------- fun : function Should accept t, y as parameters, and return same type as y t0 : float Initial t y0 : ~numpy.array or float Initial y t_bound : float Boundary time - the integration won't continue beyond it. It also determines the direction of the integration....
2
stack_v2_sparse_classes_30k_train_012033
Implement the Python class `RK4naive` described below. Class description: Class for Defining Runge-Kutta 4th Order ODE solving method Method signatures and docstrings: - def __init__(self, fun, t0, y0, t_bound, stepsize): Initialization Parameters ---------- fun : function Should accept t, y as parameters, and return...
Implement the Python class `RK4naive` described below. Class description: Class for Defining Runge-Kutta 4th Order ODE solving method Method signatures and docstrings: - def __init__(self, fun, t0, y0, t_bound, stepsize): Initialization Parameters ---------- fun : function Should accept t, y as parameters, and return...
1bd1b27e142b0a0ec2e26bf2611468dbf50d9cf8
<|skeleton|> class RK4naive: """Class for Defining Runge-Kutta 4th Order ODE solving method""" def __init__(self, fun, t0, y0, t_bound, stepsize): """Initialization Parameters ---------- fun : function Should accept t, y as parameters, and return same type as y t0 : float Initial t y0 : ~numpy.array or...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RK4naive: """Class for Defining Runge-Kutta 4th Order ODE solving method""" def __init__(self, fun, t0, y0, t_bound, stepsize): """Initialization Parameters ---------- fun : function Should accept t, y as parameters, and return same type as y t0 : float Initial t y0 : ~numpy.array or float Initia...
the_stack_v2_python_sparse
src/einsteinpy/integrators/runge_kutta.py
einsteinpy/einsteinpy
train
594
960cc124a1921cf3d712310bf0d4b13f51b795bc
[ "nums.sort()\ndic = collections.defaultdict(set)\nres = set()\nn = len(nums)\nfor i in range(n):\n for j in range(i + 1, n):\n sum = nums[i] + nums[j]\n for half in dic[target - sum]:\n res.add(tuple(list(half) + [nums[i], nums[j]]))\n for j in range(i):\n dic[nums[i] + nums[j]...
<|body_start_0|> nums.sort() dic = collections.defaultdict(set) res = set() n = len(nums) for i in range(n): for j in range(i + 1, n): sum = nums[i] + nums[j] for half in dic[target - sum]: res.add(tuple(list(half) +...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" <|body_0|> def fourSum_error(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k_train_008717
1,783
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[List[int]]", "name": "fourSum", "signature": "def fourSum(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: List[List[int]]", "name": "fourSum_error", "signature": "def fourSum_erro...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fourSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[List[int]] - def fourSum_error(self, nums, target): :type nums: List[int] :type target: int ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fourSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[List[int]] - def fourSum_error(self, nums, target): :type nums: List[int] :type target: int ...
a2cd0dc5e098080df87c4fb57d16877d21ca47a3
<|skeleton|> class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" <|body_0|> def fourSum_error(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" nums.sort() dic = collections.defaultdict(set) res = set() n = len(nums) for i in range(n): for j in range(i + 1, n): sum...
the_stack_v2_python_sparse
0018_4Sum/solution.py
benjaminhuanghuang/ben-leetcode
train
1
16ea02ac4ee8fda5c74b55f88832b245c62bf67b
[ "super(Transformer, self).__init__()\nself.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate)\nself.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_target, drop_rate)\nself.linear = tf.keras.layers.Dense(target_vocab)", "encoder_output = self.encoder(inputs, training, encoder_mas...
<|body_start_0|> super(Transformer, self).__init__() self.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate) self.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_target, drop_rate) self.linear = tf.keras.layers.Dense(target_vocab) <|end_body_0|> <|body_...
class that instantiates a Transformer
Transformer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transformer: """class that instantiates a Transformer""" def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): """constructor""" <|body_0|> def call(self, inputs, target, training, encoder_mask, look_ahead_mask, de...
stack_v2_sparse_classes_36k_train_008718
1,537
no_license
[ { "docstring": "constructor", "name": "__init__", "signature": "def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1)" }, { "docstring": "function that builds a Transformer", "name": "call", "signature": "def call(self, inputs, targ...
2
stack_v2_sparse_classes_30k_train_002178
Implement the Python class `Transformer` described below. Class description: class that instantiates a Transformer Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): constructor - def call(self, inputs, target, training, e...
Implement the Python class `Transformer` described below. Class description: class that instantiates a Transformer Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): constructor - def call(self, inputs, target, training, e...
7d3b348aec3b20da25b162b71f150c87c7c28d71
<|skeleton|> class Transformer: """class that instantiates a Transformer""" def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): """constructor""" <|body_0|> def call(self, inputs, target, training, encoder_mask, look_ahead_mask, de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Transformer: """class that instantiates a Transformer""" def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): """constructor""" super(Transformer, self).__init__() self.encoder = Encoder(N, dm, h, hidden, input_vocab, max_s...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/11-transformer.py
dacastanogo/holbertonschool-machine_learning
train
0
ff79daf1a4ef52b2731218f8f93fbd105208a5a0
[ "self.data_dir = data_dir\nself.dims = dims\nself.channels = channels", "keys_to_features = {'volume': tf.FixedLenFeature(self.dims + [1], tf.float32), 'label': tf.FixedLenFeature(self.dims + [self.channels], tf.float32)}\nparsed = tf.parse_single_example(value, keys_to_features)\nprint(parsed['volume'].shape)\np...
<|body_start_0|> self.data_dir = data_dir self.dims = dims self.channels = channels <|end_body_0|> <|body_start_1|> keys_to_features = {'volume': tf.FixedLenFeature(self.dims + [1], tf.float32), 'label': tf.FixedLenFeature(self.dims + [self.channels], tf.float32)} parsed = tf.pa...
Reader reads from a tfrecord file to produce an image.
Reader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Reader: """Reader reads from a tfrecord file to produce an image.""" def __init__(self, data_dir, dims, channels): """initialize the reader with a tfrecord dir and dims.""" <|body_0|> def dataset_parser(self, value): """parse the tfrecords.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_008719
2,755
no_license
[ { "docstring": "initialize the reader with a tfrecord dir and dims.", "name": "__init__", "signature": "def __init__(self, data_dir, dims, channels)" }, { "docstring": "parse the tfrecords.", "name": "dataset_parser", "signature": "def dataset_parser(self, value)" }, { "docstring...
4
stack_v2_sparse_classes_30k_train_005214
Implement the Python class `Reader` described below. Class description: Reader reads from a tfrecord file to produce an image. Method signatures and docstrings: - def __init__(self, data_dir, dims, channels): initialize the reader with a tfrecord dir and dims. - def dataset_parser(self, value): parse the tfrecords. -...
Implement the Python class `Reader` described below. Class description: Reader reads from a tfrecord file to produce an image. Method signatures and docstrings: - def __init__(self, data_dir, dims, channels): initialize the reader with a tfrecord dir and dims. - def dataset_parser(self, value): parse the tfrecords. -...
a7273c01d02528f5c547992fda482bbfb690fa6c
<|skeleton|> class Reader: """Reader reads from a tfrecord file to produce an image.""" def __init__(self, data_dir, dims, channels): """initialize the reader with a tfrecord dir and dims.""" <|body_0|> def dataset_parser(self, value): """parse the tfrecords.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Reader: """Reader reads from a tfrecord file to produce an image.""" def __init__(self, data_dir, dims, channels): """initialize the reader with a tfrecord dir and dims.""" self.data_dir = data_dir self.dims = dims self.channels = channels def dataset_parser(self, val...
the_stack_v2_python_sparse
records.py
drewlinsley/tpu_connectomics
train
0
b6e96817fcf960555a54c57f718a954f2aa1ee44
[ "self.pre_sum = w\nself.len = len(w)\nfor i in range(1, self.len):\n self.pre_sum[i] += self.pre_sum[i - 1]", "w_sum = self.pre_sum[-1]\nl = 0\nr = self.len - 1\nnum = random.randint(1, w_sum)\nwhile l < r:\n mid = l + (r - l) // 2\n if self.pre_sum[mid] < num:\n l = mid + 1\n elif self.pre_sum...
<|body_start_0|> self.pre_sum = w self.len = len(w) for i in range(1, self.len): self.pre_sum[i] += self.pre_sum[i - 1] <|end_body_0|> <|body_start_1|> w_sum = self.pre_sum[-1] l = 0 r = self.len - 1 num = random.randint(1, w_sum) while l < r:...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.pre_sum = w self.len = len(w) for i in range(1, self.len): self...
stack_v2_sparse_classes_36k_train_008720
1,325
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|...
238995bd23c8a6c40c6035890e94baa2473d4bbc
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, w): """:type w: List[int]""" self.pre_sum = w self.len = len(w) for i in range(1, self.len): self.pre_sum[i] += self.pre_sum[i - 1] def pickIndex(self): """:rtype: int""" w_sum = self.pre_sum[-1] l = 0 ...
the_stack_v2_python_sparse
problems/N528_Random_Pick_With_Weight.py
wan-catherine/Leetcode
train
5
5f91f428235bb57d6fb884366cacf1365c6a02ca
[ "self.dst_site_name = dst_site_name\nself.dst_site_uuid = dst_site_uuid\nself.dst_site_web_url = dst_site_web_url\nself.parent_source_sharepoint_domain_name = parent_source_sharepoint_domain_name\nself.restore_template = restore_template\nself.restore_to_original = restore_to_original\nself.site_owner_vec = site_ow...
<|body_start_0|> self.dst_site_name = dst_site_name self.dst_site_uuid = dst_site_uuid self.dst_site_web_url = dst_site_web_url self.parent_source_sharepoint_domain_name = parent_source_sharepoint_domain_name self.restore_template = restore_template self.restore_to_origin...
Implementation of the 'RestoreSiteParams' model. TODO: type description here. Attributes: dst_site_name (string): Entity name of target site in case of sharepoint restore. dst_site_uuid (string): Entity uuid of target site in case of sharepoint restore. dst_site_web_url (string): Entity web url of target site in case o...
RestoreSiteParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestoreSiteParams: """Implementation of the 'RestoreSiteParams' model. TODO: type description here. Attributes: dst_site_name (string): Entity name of target site in case of sharepoint restore. dst_site_uuid (string): Entity uuid of target site in case of sharepoint restore. dst_site_web_url (str...
stack_v2_sparse_classes_36k_train_008721
9,050
permissive
[ { "docstring": "Constructor for the RestoreSiteParams class", "name": "__init__", "signature": "def __init__(self, dst_site_name=None, dst_site_uuid=None, dst_site_web_url=None, parent_source_sharepoint_domain_name=None, restore_template=None, restore_to_original=None, site_owner_vec=None, site_result=N...
2
stack_v2_sparse_classes_30k_train_013926
Implement the Python class `RestoreSiteParams` described below. Class description: Implementation of the 'RestoreSiteParams' model. TODO: type description here. Attributes: dst_site_name (string): Entity name of target site in case of sharepoint restore. dst_site_uuid (string): Entity uuid of target site in case of sh...
Implement the Python class `RestoreSiteParams` described below. Class description: Implementation of the 'RestoreSiteParams' model. TODO: type description here. Attributes: dst_site_name (string): Entity name of target site in case of sharepoint restore. dst_site_uuid (string): Entity uuid of target site in case of sh...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RestoreSiteParams: """Implementation of the 'RestoreSiteParams' model. TODO: type description here. Attributes: dst_site_name (string): Entity name of target site in case of sharepoint restore. dst_site_uuid (string): Entity uuid of target site in case of sharepoint restore. dst_site_web_url (str...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RestoreSiteParams: """Implementation of the 'RestoreSiteParams' model. TODO: type description here. Attributes: dst_site_name (string): Entity name of target site in case of sharepoint restore. dst_site_uuid (string): Entity uuid of target site in case of sharepoint restore. dst_site_web_url (string): Entity ...
the_stack_v2_python_sparse
cohesity_management_sdk/models/restore_site_params.py
cohesity/management-sdk-python
train
24
9c7f8fd6d4c422e379bf79c3263c14975a9ceaa3
[ "self.name = pname\nself.max_items = pmax\nself.items = plist", "if len(self.items) == 0:\n print('The player has no items')\nelse:\n print(self.items)", "if self.max_items <= len(self.items):\n print('The player item list has been exceeded the maximum number of \\n items the player can carry')\nelse:\...
<|body_start_0|> self.name = pname self.max_items = pmax self.items = plist <|end_body_0|> <|body_start_1|> if len(self.items) == 0: print('The player has no items') else: print(self.items) <|end_body_1|> <|body_start_2|> if self.max_items <= len...
represents a player carrying a list of items attributes: name(str), max_items(int), items(list)
Player
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Player: """represents a player carrying a list of items attributes: name(str), max_items(int), items(list)""" def __init__(self, pname, pmax, plist): """initializes Player with name, max items carry avaliable, list of items Player , str, int, list -> None""" <|body_0|> d...
stack_v2_sparse_classes_36k_train_008722
1,787
no_license
[ { "docstring": "initializes Player with name, max items carry avaliable, list of items Player , str, int, list -> None", "name": "__init__", "signature": "def __init__(self, pname, pmax, plist)" }, { "docstring": "displays the players inventory items Player -> None", "name": "inventory", ...
4
stack_v2_sparse_classes_30k_train_018362
Implement the Python class `Player` described below. Class description: represents a player carrying a list of items attributes: name(str), max_items(int), items(list) Method signatures and docstrings: - def __init__(self, pname, pmax, plist): initializes Player with name, max items carry avaliable, list of items Pla...
Implement the Python class `Player` described below. Class description: represents a player carrying a list of items attributes: name(str), max_items(int), items(list) Method signatures and docstrings: - def __init__(self, pname, pmax, plist): initializes Player with name, max items carry avaliable, list of items Pla...
c9a7604147d9efee5bc2386cc9ae8d5240eaf450
<|skeleton|> class Player: """represents a player carrying a list of items attributes: name(str), max_items(int), items(list)""" def __init__(self, pname, pmax, plist): """initializes Player with name, max items carry avaliable, list of items Player , str, int, list -> None""" <|body_0|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Player: """represents a player carrying a list of items attributes: name(str), max_items(int), items(list)""" def __init__(self, pname, pmax, plist): """initializes Player with name, max items carry avaliable, list of items Player , str, int, list -> None""" self.name = pname self...
the_stack_v2_python_sparse
Intro-to-Programming/pa11/pa11-b.py
jaeyoung-jane-choi/2019_Indiana_University
train
1
642960814c0821d0d06322e9da12496af63bcd35
[ "self.tenant_id = tenant_id\nself.client_key = client_key\nself.secret_key = secret_key\nself.publisher_id = publisher_id\nself._headers = None", "if not self._headers:\n self._headers = self.login()\nreturn self._headers", "headers = {'Content-Type': 'application/x-www-form-urlencoded'}\nauth_url = 'https:/...
<|body_start_0|> self.tenant_id = tenant_id self.client_key = client_key self.secret_key = secret_key self.publisher_id = publisher_id self._headers = None <|end_body_0|> <|body_start_1|> if not self._headers: self._headers = self.login() return self....
ApiConnection
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiConnection: def __init__(self, tenant_id=None, client_key=None, secret_key=None, publisher_id=None, **kwargs): """Object that creates the authorization headers for- and sends API requests to the Microsoft Office APIs'. Taken from a Microsoft sample script that I cannot find the origin...
stack_v2_sparse_classes_36k_train_008723
3,347
permissive
[ { "docstring": "Object that creates the authorization headers for- and sends API requests to the Microsoft Office APIs'. Taken from a Microsoft sample script that I cannot find the original of to reference. :param tenant_id: tenant ID of of Office/Azure subscription :param client_key: key (ID) of the applicatio...
4
stack_v2_sparse_classes_30k_train_014357
Implement the Python class `ApiConnection` described below. Class description: Implement the ApiConnection class. Method signatures and docstrings: - def __init__(self, tenant_id=None, client_key=None, secret_key=None, publisher_id=None, **kwargs): Object that creates the authorization headers for- and sends API requ...
Implement the Python class `ApiConnection` described below. Class description: Implement the ApiConnection class. Method signatures and docstrings: - def __init__(self, tenant_id=None, client_key=None, secret_key=None, publisher_id=None, **kwargs): Object that creates the authorization headers for- and sends API requ...
958a5b44704ef47a979ac7110b54a092ff8ec120
<|skeleton|> class ApiConnection: def __init__(self, tenant_id=None, client_key=None, secret_key=None, publisher_id=None, **kwargs): """Object that creates the authorization headers for- and sends API requests to the Microsoft Office APIs'. Taken from a Microsoft sample script that I cannot find the origin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApiConnection: def __init__(self, tenant_id=None, client_key=None, secret_key=None, publisher_id=None, **kwargs): """Object that creates the authorization headers for- and sends API requests to the Microsoft Office APIs'. Taken from a Microsoft sample script that I cannot find the original of to refer...
the_stack_v2_python_sparse
Source/ApiConnection.py
ddbnl/office365-audit-log-collector
train
81
823a0af036affbb935f7b75a2dcbe76d2cf04691
[ "if isinstance(self._c, np.ndarray):\n return self._c\nelse:\n return self._c * np.ones((self.nz, self.nx), dtype=np.float64)", "vals = []\nif self.disperseFreqs:\n for i in range(len(self.freqs)):\n freq = self.freqs[i]\n fact = 1.0 + np.log(freq / self.freqBase) / (np.pi * self.Q)\n ...
<|body_start_0|> if isinstance(self._c, np.ndarray): return self._c else: return self._c * np.ones((self.nz, self.nx), dtype=np.float64) <|end_body_0|> <|body_start_1|> vals = [] if self.disperseFreqs: for i in range(len(self.freqs)): ...
Wrapper to carry out forward-modelling using the stored discretization over a series of frequencies. Preserves causality by modelling velocity dispersion in the presence of a non-infinite Q model.
ViscoMultiGridMultiFreq
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ViscoMultiGridMultiFreq: """Wrapper to carry out forward-modelling using the stored discretization over a series of frequencies. Preserves causality by modelling velocity dispersion in the presence of a non-infinite Q model.""" def c(self): """Complex wave velocity""" <|body_...
stack_v2_sparse_classes_36k_train_008724
16,781
permissive
[ { "docstring": "Complex wave velocity", "name": "c", "signature": "def c(self)" }, { "docstring": "Updates for frequency subProblems", "name": "spUpdates", "signature": "def spUpdates(self)" } ]
2
stack_v2_sparse_classes_30k_train_000012
Implement the Python class `ViscoMultiGridMultiFreq` described below. Class description: Wrapper to carry out forward-modelling using the stored discretization over a series of frequencies. Preserves causality by modelling velocity dispersion in the presence of a non-infinite Q model. Method signatures and docstrings...
Implement the Python class `ViscoMultiGridMultiFreq` described below. Class description: Wrapper to carry out forward-modelling using the stored discretization over a series of frequencies. Preserves causality by modelling velocity dispersion in the presence of a non-infinite Q model. Method signatures and docstrings...
e4228be3947021f2b983c919c51bb1f67df90eb0
<|skeleton|> class ViscoMultiGridMultiFreq: """Wrapper to carry out forward-modelling using the stored discretization over a series of frequencies. Preserves causality by modelling velocity dispersion in the presence of a non-infinite Q model.""" def c(self): """Complex wave velocity""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ViscoMultiGridMultiFreq: """Wrapper to carry out forward-modelling using the stored discretization over a series of frequencies. Preserves causality by modelling velocity dispersion in the presence of a non-infinite Q model.""" def c(self): """Complex wave velocity""" if isinstance(self._...
the_stack_v2_python_sparse
zephyr/backend/distributors.py
uwoseis/zephyr
train
18
aaa99592abccd1d8b637c008abd56385a3fa5bb8
[ "self.V = vertices\nself.graph = [[0 for column in range(vertices)] for row in range(vertices)]\nself.graph_dict = graph_dict", "print('(Edge) - Weight')\nweight = 0\nfor i in range(1, self.V):\n print('(' + str(self.graph_dict[p[i]]) + ',', str(self.graph_dict[i]) + ')', '-', self.graph[i][p[i]][1])\n weig...
<|body_start_0|> self.V = vertices self.graph = [[0 for column in range(vertices)] for row in range(vertices)] self.graph_dict = graph_dict <|end_body_0|> <|body_start_1|> print('(Edge) - Weight') weight = 0 for i in range(1, self.V): print('(' + str(self.gra...
Class to contain the algorithms for MST-Prim and graph data. Graph data should be stored a an adjacency list with the matching nodes containing the weight of the edge.
Graph
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Graph: """Class to contain the algorithms for MST-Prim and graph data. Graph data should be stored a an adjacency list with the matching nodes containing the weight of the edge.""" def __init__(self, vertices, graph_dict): """Initializes a new instance of the Graph class ---------- P...
stack_v2_sparse_classes_36k_train_008725
9,187
no_license
[ { "docstring": "Initializes a new instance of the Graph class ---------- Parameters graph_dict : {} The graph dictionary containing the node labels.", "name": "__init__", "signature": "def __init__(self, vertices, graph_dict)" }, { "docstring": "Prints out the MST tree and the total weight of th...
4
stack_v2_sparse_classes_30k_test_000199
Implement the Python class `Graph` described below. Class description: Class to contain the algorithms for MST-Prim and graph data. Graph data should be stored a an adjacency list with the matching nodes containing the weight of the edge. Method signatures and docstrings: - def __init__(self, vertices, graph_dict): I...
Implement the Python class `Graph` described below. Class description: Class to contain the algorithms for MST-Prim and graph data. Graph data should be stored a an adjacency list with the matching nodes containing the weight of the edge. Method signatures and docstrings: - def __init__(self, vertices, graph_dict): I...
a699bfe92d5c074d26dde540d86dc663ddddccea
<|skeleton|> class Graph: """Class to contain the algorithms for MST-Prim and graph data. Graph data should be stored a an adjacency list with the matching nodes containing the weight of the edge.""" def __init__(self, vertices, graph_dict): """Initializes a new instance of the Graph class ---------- P...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Graph: """Class to contain the algorithms for MST-Prim and graph data. Graph data should be stored a an adjacency list with the matching nodes containing the weight of the edge.""" def __init__(self, vertices, graph_dict): """Initializes a new instance of the Graph class ---------- Parameters gra...
the_stack_v2_python_sparse
Exam/Final/whitesidesMatthew_Zip/5/5a.py
mattwhitesides/CS5200
train
0
7b9d5bfbf68daa7fd521258e9be4a069bc64fc28
[ "node = Node(item)\nif self.is_empty():\n self.head = node\nelse:\n cur = self.head\n while cur.next != None:\n cur = cur.next\n cur.next = node", "node = Node(item)\nnode.next = self.head\nself.head = node", "if pos < 0:\n self.add(item)\nelif pos > self.lenth() - 1:\n self.append(item...
<|body_start_0|> node = Node(item) if self.is_empty(): self.head = node else: cur = self.head while cur.next != None: cur = cur.next cur.next = node <|end_body_0|> <|body_start_1|> node = Node(item) node.next = self...
单向链表
Singelink
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Singelink: """单向链表""" def append(self, item): """尾部添加元素""" <|body_0|> def add(self, item): """链表头部添加 要做的就是将新加的node的next指向原来的下一个node,而head指向新加的node""" <|body_1|> def insert(self, pos, item): """在链表的指定位置添加,这里以0为开始""" <|body_2|> def...
stack_v2_sparse_classes_36k_train_008726
2,554
permissive
[ { "docstring": "尾部添加元素", "name": "append", "signature": "def append(self, item)" }, { "docstring": "链表头部添加 要做的就是将新加的node的next指向原来的下一个node,而head指向新加的node", "name": "add", "signature": "def add(self, item)" }, { "docstring": "在链表的指定位置添加,这里以0为开始", "name": "insert", "signatur...
4
null
Implement the Python class `Singelink` described below. Class description: 单向链表 Method signatures and docstrings: - def append(self, item): 尾部添加元素 - def add(self, item): 链表头部添加 要做的就是将新加的node的next指向原来的下一个node,而head指向新加的node - def insert(self, pos, item): 在链表的指定位置添加,这里以0为开始 - def remove(self, item): 从链表中删除元素
Implement the Python class `Singelink` described below. Class description: 单向链表 Method signatures and docstrings: - def append(self, item): 尾部添加元素 - def add(self, item): 链表头部添加 要做的就是将新加的node的next指向原来的下一个node,而head指向新加的node - def insert(self, pos, item): 在链表的指定位置添加,这里以0为开始 - def remove(self, item): 从链表中删除元素 <|skeleto...
912dc05a3bd0ded9544166a68da23ca0a97b84da
<|skeleton|> class Singelink: """单向链表""" def append(self, item): """尾部添加元素""" <|body_0|> def add(self, item): """链表头部添加 要做的就是将新加的node的next指向原来的下一个node,而head指向新加的node""" <|body_1|> def insert(self, pos, item): """在链表的指定位置添加,这里以0为开始""" <|body_2|> def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Singelink: """单向链表""" def append(self, item): """尾部添加元素""" node = Node(item) if self.is_empty(): self.head = node else: cur = self.head while cur.next != None: cur = cur.next cur.next = node def add(self,...
the_stack_v2_python_sparse
jiaocheng/08-数据结构与算法/07-单向链表.py
kellanfan/python
train
3
26c7bdbdae1cf623979a4049f8329cc1a39c7c2a
[ "super(ProductAttention, self).__init__()\nself.decoder_att = nn.Linear(decoder_dim, encoder_dim)\nself.dk = encoder_dim\nself.softmax = nn.Softmax(dim=1)", "query = self.decoder_att(decoder_hidden).unsqueeze(1)\nscores = torch.matmul(query, encoder_out.transpose(-2, -1)) / math.sqrt(self.dk)\nscores = scores.squ...
<|body_start_0|> super(ProductAttention, self).__init__() self.decoder_att = nn.Linear(decoder_dim, encoder_dim) self.dk = encoder_dim self.softmax = nn.Softmax(dim=1) <|end_body_0|> <|body_start_1|> query = self.decoder_att(decoder_hidden).unsqueeze(1) scores = torch.ma...
Attention Network.
ProductAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductAttention: """Attention Network.""" def __init__(self, encoder_dim, decoder_dim): """:param encoder_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_dim: size of the attention network""" <|body_0|> def forward(self, en...
stack_v2_sparse_classes_36k_train_008727
4,708
no_license
[ { "docstring": ":param encoder_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_dim: size of the attention network", "name": "__init__", "signature": "def __init__(self, encoder_dim, decoder_dim)" }, { "docstring": "Forward propagation. :param encode...
2
stack_v2_sparse_classes_30k_train_004094
Implement the Python class `ProductAttention` described below. Class description: Attention Network. Method signatures and docstrings: - def __init__(self, encoder_dim, decoder_dim): :param encoder_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_dim: size of the attentio...
Implement the Python class `ProductAttention` described below. Class description: Attention Network. Method signatures and docstrings: - def __init__(self, encoder_dim, decoder_dim): :param encoder_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_dim: size of the attentio...
426d97b5d3688f6c52c51ef6e33872554d55751a
<|skeleton|> class ProductAttention: """Attention Network.""" def __init__(self, encoder_dim, decoder_dim): """:param encoder_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_dim: size of the attention network""" <|body_0|> def forward(self, en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProductAttention: """Attention Network.""" def __init__(self, encoder_dim, decoder_dim): """:param encoder_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_dim: size of the attention network""" super(ProductAttention, self).__init__() ...
the_stack_v2_python_sparse
src/models/continuous_encoder_decoder_models/encoder_decoder_variants/attention_product_image.py
RitaRamo/remote-sensing-images-caption
train
3
b00cae28d998f7f7f404078cceeea0fe50e5b5af
[ "where = [['ParentId', '=', parentSfId], 'and', ['Title', '=', title]]\nqueryList = self.query(NOTE_OBJ, where=where, sc='all')\nif queryList in BAD_INFO_LIST:\n note = None\n msg = 'findNote: NO Note found with parent %s and title %s' % (parentSfId, title)\n self.setLog(msg, 'debug')\nelse:\n if len(qu...
<|body_start_0|> where = [['ParentId', '=', parentSfId], 'and', ['Title', '=', title]] queryList = self.query(NOTE_OBJ, where=where, sc='all') if queryList in BAD_INFO_LIST: note = None msg = 'findNote: NO Note found with parent %s and title %s' % (parentSfId, title) ...
SFNoteTool
[ "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SFNoteTool: def findNote(self, parentSfId, title): """Try to find a note attached to the entity with parentSfId and having title. Return a note object if found, None if not.""" <|body_0|> def retrieveNote(self, noteId): """Given a noteID, return the note object for t...
stack_v2_sparse_classes_36k_train_008728
3,364
permissive
[ { "docstring": "Try to find a note attached to the entity with parentSfId and having title. Return a note object if found, None if not.", "name": "findNote", "signature": "def findNote(self, parentSfId, title)" }, { "docstring": "Given a noteID, return the note object for that note", "name":...
3
null
Implement the Python class `SFNoteTool` described below. Class description: Implement the SFNoteTool class. Method signatures and docstrings: - def findNote(self, parentSfId, title): Try to find a note attached to the entity with parentSfId and having title. Return a note object if found, None if not. - def retrieveN...
Implement the Python class `SFNoteTool` described below. Class description: Implement the SFNoteTool class. Method signatures and docstrings: - def findNote(self, parentSfId, title): Try to find a note attached to the entity with parentSfId and having title. Return a note object if found, None if not. - def retrieveN...
8aa2ff2340707eecae6514943e86f5afba9cd54a
<|skeleton|> class SFNoteTool: def findNote(self, parentSfId, title): """Try to find a note attached to the entity with parentSfId and having title. Return a note object if found, None if not.""" <|body_0|> def retrieveNote(self, noteId): """Given a noteID, return the note object for t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SFNoteTool: def findNote(self, parentSfId, title): """Try to find a note attached to the entity with parentSfId and having title. Return a note object if found, None if not.""" where = [['ParentId', '=', parentSfId], 'and', ['Title', '=', title]] queryList = self.query(NOTE_OBJ, where=...
the_stack_v2_python_sparse
python-trunk/sfapi2/sflib/sfNote.py
raychorn/svn_molten-magma
train
0
aeede243f60600e080ec9bee7e0cd54734f9cfb0
[ "if v is not None:\n if not v.get('eapType'):\n raise ValueError('eapType must be defined')\n try:\n wifi.eap_check_config(v)\n except wifi.ConfigureArgsError as e:\n raise ValueError(str(e))\nreturn v", "security_type = values.get('securityType')\npsk = values.get('psk')\neapconfig ...
<|body_start_0|> if v is not None: if not v.get('eapType'): raise ValueError('eapType must be defined') try: wifi.eap_check_config(v) except wifi.ConfigureArgsError as e: raise ValueError(str(e)) return v <|end_body_0|> ...
WifiConfiguration
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WifiConfiguration: def eap_config_validate(cls, v): """Custom validator for the eapConfig field""" <|body_0|> def validate_configuration(cls, values): """Validate the configuration""" <|body_1|> <|end_skeleton|> <|body_start_0|> if v is not None: ...
stack_v2_sparse_classes_36k_train_008729
13,352
permissive
[ { "docstring": "Custom validator for the eapConfig field", "name": "eap_config_validate", "signature": "def eap_config_validate(cls, v)" }, { "docstring": "Validate the configuration", "name": "validate_configuration", "signature": "def validate_configuration(cls, values)" } ]
2
null
Implement the Python class `WifiConfiguration` described below. Class description: Implement the WifiConfiguration class. Method signatures and docstrings: - def eap_config_validate(cls, v): Custom validator for the eapConfig field - def validate_configuration(cls, values): Validate the configuration
Implement the Python class `WifiConfiguration` described below. Class description: Implement the WifiConfiguration class. Method signatures and docstrings: - def eap_config_validate(cls, v): Custom validator for the eapConfig field - def validate_configuration(cls, values): Validate the configuration <|skeleton|> cl...
026b523c8c9e5d45910c490efb89194d72595be9
<|skeleton|> class WifiConfiguration: def eap_config_validate(cls, v): """Custom validator for the eapConfig field""" <|body_0|> def validate_configuration(cls, values): """Validate the configuration""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WifiConfiguration: def eap_config_validate(cls, v): """Custom validator for the eapConfig field""" if v is not None: if not v.get('eapType'): raise ValueError('eapType must be defined') try: wifi.eap_check_config(v) except wif...
the_stack_v2_python_sparse
robot-server/robot_server/service/legacy/models/networking.py
Opentrons/opentrons
train
326
b3251c49875ba86b2fead916634215a682a73710
[ "self.miningStatus = miningStatus\nself.lock = lock\nself.canStartMiningCondition = canStartMiningCondition\nThread.__init__(self)", "while True:\n with self.lock:\n self.removeTransactionsAlreadyMinedIfAny()\n while not self.miningStatus.canStartMining:\n self.canStartMiningCondition....
<|body_start_0|> self.miningStatus = miningStatus self.lock = lock self.canStartMiningCondition = canStartMiningCondition Thread.__init__(self) <|end_body_0|> <|body_start_1|> while True: with self.lock: self.removeTransactionsAlreadyMinedIfAny() ...
Class that handle mining algorithm. The main lifecycle is: Receiving mining requests and if there are any transaction in common (transactions already mined by me or others) it make symmetric difference between mined transactions and received transactions Wait start mining Calculate proof of lottery, verify it and send ...
MinerAlgorithm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MinerAlgorithm: """Class that handle mining algorithm. The main lifecycle is: Receiving mining requests and if there are any transaction in common (transactions already mined by me or others) it make symmetric difference between mined transactions and received transactions Wait start mining Calcu...
stack_v2_sparse_classes_36k_train_008730
8,020
no_license
[ { "docstring": "Constructor with parameters :param miningStatus: Shared current status of mining :param lock: Re entrant lock used to handle shared data :param canStartMiningCondition: Condition that told us to mining or sleep", "name": "__init__", "signature": "def __init__(self, miningStatus, lock, ca...
3
stack_v2_sparse_classes_30k_train_007394
Implement the Python class `MinerAlgorithm` described below. Class description: Class that handle mining algorithm. The main lifecycle is: Receiving mining requests and if there are any transaction in common (transactions already mined by me or others) it make symmetric difference between mined transactions and receiv...
Implement the Python class `MinerAlgorithm` described below. Class description: Class that handle mining algorithm. The main lifecycle is: Receiving mining requests and if there are any transaction in common (transactions already mined by me or others) it make symmetric difference between mined transactions and receiv...
f5df62e34265ce5185031ebc7c694b759c2a73a2
<|skeleton|> class MinerAlgorithm: """Class that handle mining algorithm. The main lifecycle is: Receiving mining requests and if there are any transaction in common (transactions already mined by me or others) it make symmetric difference between mined transactions and received transactions Wait start mining Calcu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MinerAlgorithm: """Class that handle mining algorithm. The main lifecycle is: Receiving mining requests and if there are any transaction in common (transactions already mined by me or others) it make symmetric difference between mined transactions and received transactions Wait start mining Calculate proof of...
the_stack_v2_python_sparse
blockchain/mining/MinerAlgorithm.py
packo97/Blockchain_Project
train
1
9ba46b93a94feb252896217120877ff6eb7a2bd1
[ "queryset = BookInfo.objects.all()\nbook_list = []\nfor book in queryset:\n book_list.append({'id': book.id, 'title': book.title, 'pub_date': book.pub_date, 'read': book.read, 'comment': book.comment, 'image': book.image.url if book.image else ''})\nreturn JsonResponse(book_list, safe=False)", "json_bytes = re...
<|body_start_0|> queryset = BookInfo.objects.all() book_list = [] for book in queryset: book_list.append({'id': book.id, 'title': book.title, 'pub_date': book.pub_date, 'read': book.read, 'comment': book.comment, 'image': book.image.url if book.image else ''}) return JsonResp...
查询所有图书、增加图书
BooksAPIVIew
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BooksAPIVIew: """查询所有图书、增加图书""" def get(self, request): """查询所有图书 路由:GET /books/""" <|body_0|> def post(self, request): """新增图书 路由:POST /books/""" <|body_1|> <|end_skeleton|> <|body_start_0|> queryset = BookInfo.objects.all() book_list =...
stack_v2_sparse_classes_36k_train_008731
5,895
no_license
[ { "docstring": "查询所有图书 路由:GET /books/", "name": "get", "signature": "def get(self, request)" }, { "docstring": "新增图书 路由:POST /books/", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_014390
Implement the Python class `BooksAPIVIew` described below. Class description: 查询所有图书、增加图书 Method signatures and docstrings: - def get(self, request): 查询所有图书 路由:GET /books/ - def post(self, request): 新增图书 路由:POST /books/
Implement the Python class `BooksAPIVIew` described below. Class description: 查询所有图书、增加图书 Method signatures and docstrings: - def get(self, request): 查询所有图书 路由:GET /books/ - def post(self, request): 新增图书 路由:POST /books/ <|skeleton|> class BooksAPIVIew: """查询所有图书、增加图书""" def get(self, request): """查询...
0f123a99856238af5f1aab0b555f6501e635fc52
<|skeleton|> class BooksAPIVIew: """查询所有图书、增加图书""" def get(self, request): """查询所有图书 路由:GET /books/""" <|body_0|> def post(self, request): """新增图书 路由:POST /books/""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BooksAPIVIew: """查询所有图书、增加图书""" def get(self, request): """查询所有图书 路由:GET /books/""" queryset = BookInfo.objects.all() book_list = [] for book in queryset: book_list.append({'id': book.id, 'title': book.title, 'pub_date': book.pub_date, 'read': book.read, 'comme...
the_stack_v2_python_sparse
DRF_Tutorial/app/views.py
YDongY/PythonCode
train
1
9c0565a7a799b4d983060bea22a4462692fd3731
[ "if key:\n if cls.objects.filter(key=key).exists():\n return cls.objects.filter(key=key).first()\nif cls.objects.filter(key=None).exists():\n return cls.objects.filter(key=None).first()\nreturn None", "if self.is_default_value:\n if self.key is None and self.__class__.objects.exclude(pk=self.pk).f...
<|body_start_0|> if key: if cls.objects.filter(key=key).exists(): return cls.objects.filter(key=key).first() if cls.objects.filter(key=None).exists(): return cls.objects.filter(key=None).first() return None <|end_body_0|> <|body_start_1|> if self....
Mixin for storing value with a unique default value for all and a unique default value for each item associated by key
StoreDataWithDefaultValueByKey
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StoreDataWithDefaultValueByKey: """Mixin for storing value with a unique default value for all and a unique default value for each item associated by key""" def default_value(cls, key=None): """Return default value which is: - default value for the key if exists - else generic defaul...
stack_v2_sparse_classes_36k_train_008732
2,174
no_license
[ { "docstring": "Return default value which is: - default value for the key if exists - else generic default value if exists - else None", "name": "default_value", "signature": "def default_value(cls, key=None)" }, { "docstring": "verify that: - an unique value exists without a key - an unique va...
2
stack_v2_sparse_classes_30k_train_010591
Implement the Python class `StoreDataWithDefaultValueByKey` described below. Class description: Mixin for storing value with a unique default value for all and a unique default value for each item associated by key Method signatures and docstrings: - def default_value(cls, key=None): Return default value which is: - ...
Implement the Python class `StoreDataWithDefaultValueByKey` described below. Class description: Mixin for storing value with a unique default value for all and a unique default value for each item associated by key Method signatures and docstrings: - def default_value(cls, key=None): Return default value which is: - ...
95d21cd6036a99c5f399b700a5426e9e2e17e878
<|skeleton|> class StoreDataWithDefaultValueByKey: """Mixin for storing value with a unique default value for all and a unique default value for each item associated by key""" def default_value(cls, key=None): """Return default value which is: - default value for the key if exists - else generic defaul...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StoreDataWithDefaultValueByKey: """Mixin for storing value with a unique default value for all and a unique default value for each item associated by key""" def default_value(cls, key=None): """Return default value which is: - default value for the key if exists - else generic default value if ex...
the_stack_v2_python_sparse
helpers/mixins/store_data_with_default_value_by_key.py
alexandrenorman/mixeur
train
0
fd1b89d8497e9e94f091b471a451d199d73f0715
[ "super(Game, self).__init__(screen, bg_color)\nself.status_font = pygame.font.SysFont('monospace', 20)\nself.status_font.set_bold(True)\nself.game_data = game_data", "self.screen.fill((0, 0, 0))\nself.game_data.clear()\nif result_id != -1:\n if result_id < 5:\n result = self.status_font.render('Player %...
<|body_start_0|> super(Game, self).__init__(screen, bg_color) self.status_font = pygame.font.SysFont('monospace', 20) self.status_font.set_bold(True) self.game_data = game_data <|end_body_0|> <|body_start_1|> self.screen.fill((0, 0, 0)) self.game_data.clear() if ...
Game screeen state
Game
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Game: """Game screeen state""" def __init__(self, screen, game_data, bg_color=(0, 0, 0)): """Generates initial screen :param screen: PyGame screen :param game_data: data of game session :param bg_color: background color :return:""" <|body_0|> def stop_game(self, result_i...
stack_v2_sparse_classes_36k_train_008733
5,538
no_license
[ { "docstring": "Generates initial screen :param screen: PyGame screen :param game_data: data of game session :param bg_color: background color :return:", "name": "__init__", "signature": "def __init__(self, screen, game_data, bg_color=(0, 0, 0))" }, { "docstring": "Stops state and returns to pre...
6
stack_v2_sparse_classes_30k_train_000146
Implement the Python class `Game` described below. Class description: Game screeen state Method signatures and docstrings: - def __init__(self, screen, game_data, bg_color=(0, 0, 0)): Generates initial screen :param screen: PyGame screen :param game_data: data of game session :param bg_color: background color :return...
Implement the Python class `Game` described below. Class description: Game screeen state Method signatures and docstrings: - def __init__(self, screen, game_data, bg_color=(0, 0, 0)): Generates initial screen :param screen: PyGame screen :param game_data: data of game session :param bg_color: background color :return...
51a2f2ecc09a05672a2c3deb00ab8c273d3b756b
<|skeleton|> class Game: """Game screeen state""" def __init__(self, screen, game_data, bg_color=(0, 0, 0)): """Generates initial screen :param screen: PyGame screen :param game_data: data of game session :param bg_color: background color :return:""" <|body_0|> def stop_game(self, result_i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Game: """Game screeen state""" def __init__(self, screen, game_data, bg_color=(0, 0, 0)): """Generates initial screen :param screen: PyGame screen :param game_data: data of game session :param bg_color: background color :return:""" super(Game, self).__init__(screen, bg_color) self...
the_stack_v2_python_sparse
application/game_state.py
asmodeii/tanki
train
0
1dbb773362acfd3160a1d8b170da3cefccf81b82
[ "self._renderer = renderer\nself._width = self._renderer.width\nself._height = self._renderer.height\nself._small = int(self._height / 20)\nself._extra_small = int(self._height / 30)\nself._lines = []", "if audio_info[0]:\n self._lines.append(['MUSIC ON', self._small, self._width / 2, self._height / 2 - self._...
<|body_start_0|> self._renderer = renderer self._width = self._renderer.width self._height = self._renderer.height self._small = int(self._height / 20) self._extra_small = int(self._height / 30) self._lines = [] <|end_body_0|> <|body_start_1|> if audio_info[0]: ...
A class to represent setup view of UI. Attributes: renderer: Renderer object.
SetupView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SetupView: """A class to represent setup view of UI. Attributes: renderer: Renderer object.""" def __init__(self, renderer): """Constructs all the necessary attributes for finish view. Args: renderer (Renderer): Renderer object which renders the display.""" <|body_0|> de...
stack_v2_sparse_classes_36k_train_008734
2,268
no_license
[ { "docstring": "Constructs all the necessary attributes for finish view. Args: renderer (Renderer): Renderer object which renders the display.", "name": "__init__", "signature": "def __init__(self, renderer)" }, { "docstring": "Prepares all information to show for the renderer object. Check musi...
2
stack_v2_sparse_classes_30k_train_011047
Implement the Python class `SetupView` described below. Class description: A class to represent setup view of UI. Attributes: renderer: Renderer object. Method signatures and docstrings: - def __init__(self, renderer): Constructs all the necessary attributes for finish view. Args: renderer (Renderer): Renderer object...
Implement the Python class `SetupView` described below. Class description: A class to represent setup view of UI. Attributes: renderer: Renderer object. Method signatures and docstrings: - def __init__(self, renderer): Constructs all the necessary attributes for finish view. Args: renderer (Renderer): Renderer object...
29cd15dddff620de068a479595a5cb9aba855343
<|skeleton|> class SetupView: """A class to represent setup view of UI. Attributes: renderer: Renderer object.""" def __init__(self, renderer): """Constructs all the necessary attributes for finish view. Args: renderer (Renderer): Renderer object which renders the display.""" <|body_0|> de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SetupView: """A class to represent setup view of UI. Attributes: renderer: Renderer object.""" def __init__(self, renderer): """Constructs all the necessary attributes for finish view. Args: renderer (Renderer): Renderer object which renders the display.""" self._renderer = renderer ...
the_stack_v2_python_sparse
src/ui/setup_view.py
TopiasHarjunpaa/ot-harjoitustyo
train
0
dc12a647ff51f627a7e8ab55c733c3935da11dc8
[ "grey_scale_image = cv.cvtColor(img, cv.COLOR_BGR2GRAY)\namount_of_x_samples = 18\ndots_amount = 12\nx_index = 0\nx_step = (grey_scale_image.shape[1] - 1) / amount_of_x_samples\ny_index = grey_scale_image.shape[0] - 1\ny_step = y_index / dots_amount\nall_lines = []\nwhile x_index < grey_scale_image.shape[1] - 1:\n ...
<|body_start_0|> grey_scale_image = cv.cvtColor(img, cv.COLOR_BGR2GRAY) amount_of_x_samples = 18 dots_amount = 12 x_index = 0 x_step = (grey_scale_image.shape[1] - 1) / amount_of_x_samples y_index = grey_scale_image.shape[0] - 1 y_step = y_index / dots_amount ...
Class which extracts the line coordinates from an image. Given an image, grey, and white pixels are recognized and clustered together into separate points at certain steps, indicating the line's position. The image is first greyscaled and appropriate indices and steps are determined.
Sampler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sampler: """Class which extracts the line coordinates from an image. Given an image, grey, and white pixels are recognized and clustered together into separate points at certain steps, indicating the line's position. The image is first greyscaled and appropriate indices and steps are determined."...
stack_v2_sparse_classes_36k_train_008735
5,195
permissive
[ { "docstring": "The function find_dots takes an input image, grayscales it, makes sub images of the grayscaled image and runs the functions image_sample, find_line, get_valid_elements and line_merger in this order on all the sub images. Args: img: The output from the neural network Returns: all_lines: A list co...
5
null
Implement the Python class `Sampler` described below. Class description: Class which extracts the line coordinates from an image. Given an image, grey, and white pixels are recognized and clustered together into separate points at certain steps, indicating the line's position. The image is first greyscaled and appropr...
Implement the Python class `Sampler` described below. Class description: Class which extracts the line coordinates from an image. Given an image, grey, and white pixels are recognized and clustered together into separate points at certain steps, indicating the line's position. The image is first greyscaled and appropr...
2dd5c5e90adf2c29e5c1e81e8639813edbf65903
<|skeleton|> class Sampler: """Class which extracts the line coordinates from an image. Given an image, grey, and white pixels are recognized and clustered together into separate points at certain steps, indicating the line's position. The image is first greyscaled and appropriate indices and steps are determined."...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Sampler: """Class which extracts the line coordinates from an image. Given an image, grey, and white pixels are recognized and clustered together into separate points at certain steps, indicating the line's position. The image is first greyscaled and appropriate indices and steps are determined.""" def f...
the_stack_v2_python_sparse
ImageProcessing/Sampler.py
florias/TNO-RU-Lane-detection-project
train
2
bd2813189edc886cbc7053321bed37d4dd1f88b0
[ "if not datastore_id:\n datastores = get_datastore(user=request.user)\n return Response({'datastores': DatastoreOverviewSerializer(datastores, many=True).data}, status=status.HTTP_200_OK)\nelse:\n datastore = get_datastore(datastore_id, request.user)\n if not datastore:\n raise PermissionDenied({...
<|body_start_0|> if not datastore_id: datastores = get_datastore(user=request.user) return Response({'datastores': DatastoreOverviewSerializer(datastores, many=True).data}, status=status.HTTP_200_OK) else: datastore = get_datastore(datastore_id, request.user) ...
DatastoreView
[ "BSD-3-Clause", "MIT", "Apache-2.0", "BSD-2-Clause", "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatastoreView: def get(self, request, datastore_id=None, *args, **kwargs): """Lists all datastores of the user or returns a specific datastore with content :param request: :type request: :param datastore_id: PK of the datastore :type datastore_id: uuid :param args: :type args: :param kwa...
stack_v2_sparse_classes_36k_train_008736
6,140
permissive
[ { "docstring": "Lists all datastores of the user or returns a specific datastore with content :param request: :type request: :param datastore_id: PK of the datastore :type datastore_id: uuid :param args: :type args: :param kwargs: :type kwargs: :return: :rtype:", "name": "get", "signature": "def get(sel...
4
null
Implement the Python class `DatastoreView` described below. Class description: Implement the DatastoreView class. Method signatures and docstrings: - def get(self, request, datastore_id=None, *args, **kwargs): Lists all datastores of the user or returns a specific datastore with content :param request: :type request:...
Implement the Python class `DatastoreView` described below. Class description: Implement the DatastoreView class. Method signatures and docstrings: - def get(self, request, datastore_id=None, *args, **kwargs): Lists all datastores of the user or returns a specific datastore with content :param request: :type request:...
8936aa8ccdee8b9617ef7d894cb9a9a9f6f473cf
<|skeleton|> class DatastoreView: def get(self, request, datastore_id=None, *args, **kwargs): """Lists all datastores of the user or returns a specific datastore with content :param request: :type request: :param datastore_id: PK of the datastore :type datastore_id: uuid :param args: :type args: :param kwa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatastoreView: def get(self, request, datastore_id=None, *args, **kwargs): """Lists all datastores of the user or returns a specific datastore with content :param request: :type request: :param datastore_id: PK of the datastore :type datastore_id: uuid :param args: :type args: :param kwargs: :type kwa...
the_stack_v2_python_sparse
psono/restapi/views/datastore.py
psono/psono-server
train
76
8541e79f37853bfab328138a5dba6cd679f4fc5f
[ "if self.parentNode is None:\n return None\nsiblings = self.parentNode.childNodes\nfor i in range(siblings.index(self), 0, -1):\n n = siblings[i - 1]\n if n.nodeType == Node.ELEMENT_NODE:\n return n\nreturn None", "if self.parentNode is None:\n return None\nsiblings = self.parentNode.childNodes...
<|body_start_0|> if self.parentNode is None: return None siblings = self.parentNode.childNodes for i in range(siblings.index(self), 0, -1): n = siblings[i - 1] if n.nodeType == Node.ELEMENT_NODE: return n return None <|end_body_0|> <|b...
Mixin class for ``CharacterData`` and ``DocumentType`` class.
NonDocumentTypeChildNode
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NonDocumentTypeChildNode: """Mixin class for ``CharacterData`` and ``DocumentType`` class.""" def previousElementSibling(self) -> Optional[AbstractNode]: """Previous Element Node. If this node has no previous element node, return None.""" <|body_0|> def nextElementSiblin...
stack_v2_sparse_classes_36k_train_008737
22,053
permissive
[ { "docstring": "Previous Element Node. If this node has no previous element node, return None.", "name": "previousElementSibling", "signature": "def previousElementSibling(self) -> Optional[AbstractNode]" }, { "docstring": "Next Element Node. If this node has no next element node, return None.",...
2
null
Implement the Python class `NonDocumentTypeChildNode` described below. Class description: Mixin class for ``CharacterData`` and ``DocumentType`` class. Method signatures and docstrings: - def previousElementSibling(self) -> Optional[AbstractNode]: Previous Element Node. If this node has no previous element node, retu...
Implement the Python class `NonDocumentTypeChildNode` described below. Class description: Mixin class for ``CharacterData`` and ``DocumentType`` class. Method signatures and docstrings: - def previousElementSibling(self) -> Optional[AbstractNode]: Previous Element Node. If this node has no previous element node, retu...
c7cd8b3428ca154af6fb1ecb6c7d2f0e17551802
<|skeleton|> class NonDocumentTypeChildNode: """Mixin class for ``CharacterData`` and ``DocumentType`` class.""" def previousElementSibling(self) -> Optional[AbstractNode]: """Previous Element Node. If this node has no previous element node, return None.""" <|body_0|> def nextElementSiblin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NonDocumentTypeChildNode: """Mixin class for ``CharacterData`` and ``DocumentType`` class.""" def previousElementSibling(self) -> Optional[AbstractNode]: """Previous Element Node. If this node has no previous element node, return None.""" if self.parentNode is None: return Non...
the_stack_v2_python_sparse
wdom/node.py
miyakogi/wdom
train
72
4b42b73fdb1a36f31b0f36dcd082f9c769b92a5c
[ "self.size = size\nself.current_size = 0\nself.values = collections.deque()", "if self.current_size < self.size:\n self.values.append(val)\n self.current_size += 1\n return 1.0 * sum(self.values) / len(self.values)\nelse:\n self.values.append(val)\n self.values.popleft()\n return 1.0 * sum(self....
<|body_start_0|> self.size = size self.current_size = 0 self.values = collections.deque() <|end_body_0|> <|body_start_1|> if self.current_size < self.size: self.values.append(val) self.current_size += 1 return 1.0 * sum(self.values) / len(self.values)...
MovingAverage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.size = size self.current...
stack_v2_sparse_classes_36k_train_008738
1,304
no_license
[ { "docstring": "Initialize your data structure here. :type size: int", "name": "__init__", "signature": "def __init__(self, size)" }, { "docstring": ":type val: int :rtype: float", "name": "next", "signature": "def next(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_018399
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float <|skeleton|> class MovingAverage: ...
6de551327f96ec4d4b63d0045281b65bbb4f5d0f
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" self.size = size self.current_size = 0 self.values = collections.deque() def next(self, val): """:type val: int :rtype: float""" if self.current_size < self....
the_stack_v2_python_sparse
MovingAverage.py
JingweiTu/leetcode
train
0
4f01e3c7f90ddc29cb003287dedb12568ab8d808
[ "if isolation_window is None:\n raise ValueError('An isolation window None!')\ntry:\n forest = self.forest_for_isolation_window[isolation_window]\nexcept KeyError:\n forest = self.forest_type(error_tolerance=self.error_tolerance)\n self.forest_for_isolation_window[isolation_window] = forest\nreturn fore...
<|body_start_0|> if isolation_window is None: raise ValueError('An isolation window None!') try: forest = self.forest_for_isolation_window[isolation_window] except KeyError: forest = self.forest_type(error_tolerance=self.error_tolerance) self.fores...
IsolationWindowDemultiplexerBase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IsolationWindowDemultiplexerBase: def forest_for(self, isolation_window: IsolationWindow) -> FeatureForestType: """Get the :class:`~.DeconvolutedLCMSFeatureForest` for a specific isolation window, or if one does not exist, create it. Parameters ---------- isolation_window : :class:`~.Iso...
stack_v2_sparse_classes_36k_train_008739
8,612
permissive
[ { "docstring": "Get the :class:`~.DeconvolutedLCMSFeatureForest` for a specific isolation window, or if one does not exist, create it. Parameters ---------- isolation_window : :class:`~.IsolationWindow` The isolation window to select with Returns ------- :class:`~.DeconvolutedLCMSFeatureForest`", "name": "f...
2
stack_v2_sparse_classes_30k_test_001161
Implement the Python class `IsolationWindowDemultiplexerBase` described below. Class description: Implement the IsolationWindowDemultiplexerBase class. Method signatures and docstrings: - def forest_for(self, isolation_window: IsolationWindow) -> FeatureForestType: Get the :class:`~.DeconvolutedLCMSFeatureForest` for...
Implement the Python class `IsolationWindowDemultiplexerBase` described below. Class description: Implement the IsolationWindowDemultiplexerBase class. Method signatures and docstrings: - def forest_for(self, isolation_window: IsolationWindow) -> FeatureForestType: Get the :class:`~.DeconvolutedLCMSFeatureForest` for...
0912a6bbf3eab4163f3b0f122a8a6ec9814d75b1
<|skeleton|> class IsolationWindowDemultiplexerBase: def forest_for(self, isolation_window: IsolationWindow) -> FeatureForestType: """Get the :class:`~.DeconvolutedLCMSFeatureForest` for a specific isolation window, or if one does not exist, create it. Parameters ---------- isolation_window : :class:`~.Iso...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IsolationWindowDemultiplexerBase: def forest_for(self, isolation_window: IsolationWindow) -> FeatureForestType: """Get the :class:`~.DeconvolutedLCMSFeatureForest` for a specific isolation window, or if one does not exist, create it. Parameters ---------- isolation_window : :class:`~.IsolationWindow` ...
the_stack_v2_python_sparse
src/ms_deisotope/feature_map/demultiplex.py
mobiusklein/ms_deisotope
train
24
8dfa77ac06f9c6d910e6f0fe7e6d280fb000864f
[ "elements = self.root.findall('./resolution')\npresets = []\nfor element in elements:\n presets.append(element.get('name'))\nreturn presets", "element = self.root.find(\"./resolution[@name='%s']/%s\" % (preset, setting))\nif element is not None:\n text = element.text\n if text is not None:\n retur...
<|body_start_0|> elements = self.root.findall('./resolution') presets = [] for element in elements: presets.append(element.get('name')) return presets <|end_body_0|> <|body_start_1|> element = self.root.find("./resolution[@name='%s']/%s" % (preset, setting)) ...
Manipulates XML database to store resolution presets. Inherits XMLData class.
ResPresets
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResPresets: """Manipulates XML database to store resolution presets. Inherits XMLData class.""" def getPresets(self): """Return a list of resolution presets.""" <|body_0|> def getValue(self, preset, setting): """Get the specified value.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_008740
1,399
permissive
[ { "docstring": "Return a list of resolution presets.", "name": "getPresets", "signature": "def getPresets(self)" }, { "docstring": "Get the specified value.", "name": "getValue", "signature": "def getValue(self, preset, setting)" }, { "docstring": "Return a resolution preset give...
3
null
Implement the Python class `ResPresets` described below. Class description: Manipulates XML database to store resolution presets. Inherits XMLData class. Method signatures and docstrings: - def getPresets(self): Return a list of resolution presets. - def getValue(self, preset, setting): Get the specified value. - def...
Implement the Python class `ResPresets` described below. Class description: Manipulates XML database to store resolution presets. Inherits XMLData class. Method signatures and docstrings: - def getPresets(self): Return a list of resolution presets. - def getValue(self, preset, setting): Get the specified value. - def...
a05abc916f0b6a9ee2c00e9f9b3dec12c09e6abe
<|skeleton|> class ResPresets: """Manipulates XML database to store resolution presets. Inherits XMLData class.""" def getPresets(self): """Return a list of resolution presets.""" <|body_0|> def getValue(self, preset, setting): """Get the specified value.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResPresets: """Manipulates XML database to store resolution presets. Inherits XMLData class.""" def getPresets(self): """Return a list of resolution presets.""" elements = self.root.findall('./resolution') presets = [] for element in elements: presets.append(el...
the_stack_v2_python_sparse
shared/resPresets.py
mjbonnington/icarus-gps
train
0
5cca1ac2fe7164c920ed2acad40200bc8ac45e37
[ "super(EncoderDecoder, self).__init__(conf, output_dim, name)\nself.encoder = encoder_factory.factory(conf)\nself.decoder = asr_decoder_factory.factory(conf, self.output_dim)", "std_input_noise = float(self.conf['std_input_noise'])\nif is_training and std_input_noise > 0:\n noisy_inputs = inputs + tf.random_no...
<|body_start_0|> super(EncoderDecoder, self).__init__(conf, output_dim, name) self.encoder = encoder_factory.factory(conf) self.decoder = asr_decoder_factory.factory(conf, self.output_dim) <|end_body_0|> <|body_start_1|> std_input_noise = float(self.conf['std_input_noise']) if i...
a general class for an encoder decoder system
EncoderDecoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderDecoder: """a general class for an encoder decoder system""" def __init__(self, conf, output_dim, name=None): """LAS constructor Args: conf: The classifier configuration output_dim: the classifier output dimension name: the classifier name""" <|body_0|> def _get_o...
stack_v2_sparse_classes_36k_train_008741
3,642
permissive
[ { "docstring": "LAS constructor Args: conf: The classifier configuration output_dim: the classifier output dimension name: the classifier name", "name": "__init__", "signature": "def __init__(self, conf, output_dim, name=None)" }, { "docstring": "Add the neural net variables and operations to th...
2
stack_v2_sparse_classes_30k_train_006681
Implement the Python class `EncoderDecoder` described below. Class description: a general class for an encoder decoder system Method signatures and docstrings: - def __init__(self, conf, output_dim, name=None): LAS constructor Args: conf: The classifier configuration output_dim: the classifier output dimension name: ...
Implement the Python class `EncoderDecoder` described below. Class description: a general class for an encoder decoder system Method signatures and docstrings: - def __init__(self, conf, output_dim, name=None): LAS constructor Args: conf: The classifier configuration output_dim: the classifier output dimension name: ...
09586e57bf4c6d29a6679e9bb3a488e09451f08e
<|skeleton|> class EncoderDecoder: """a general class for an encoder decoder system""" def __init__(self, conf, output_dim, name=None): """LAS constructor Args: conf: The classifier configuration output_dim: the classifier output dimension name: the classifier name""" <|body_0|> def _get_o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncoderDecoder: """a general class for an encoder decoder system""" def __init__(self, conf, output_dim, name=None): """LAS constructor Args: conf: The classifier configuration output_dim: the classifier output dimension name: the classifier name""" super(EncoderDecoder, self).__init__(co...
the_stack_v2_python_sparse
nabu/neuralnetworks/classifiers/asr/encoder_decoder.py
chenxinglili/nabu
train
0
03928cd54a36b58b6cf48f056501d67f7d187655
[ "for line in tokens_by_line:\n assign_ix = _find_assign_op(line)\n if assign_ix is not None and len(line) >= assign_ix + 2 and (line[assign_ix + 1].string == '%') and (line[assign_ix + 2].type == tokenize.NAME):\n return cls(line[assign_ix + 1].start)", "start_line, start_col = (self.start_line, self...
<|body_start_0|> for line in tokens_by_line: assign_ix = _find_assign_op(line) if assign_ix is not None and len(line) >= assign_ix + 2 and (line[assign_ix + 1].string == '%') and (line[assign_ix + 2].type == tokenize.NAME): return cls(line[assign_ix + 1].start) <|end_body...
Transformer for assignments from magics (a = %foo)
MagicAssign
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MagicAssign: """Transformer for assignments from magics (a = %foo)""" def find(cls, tokens_by_line): """Find the first magic assignment (a = %foo) in the cell.""" <|body_0|> def transform(self, lines: List[str]): """Transform a magic assignment found by the ``fin...
stack_v2_sparse_classes_36k_train_008742
29,393
permissive
[ { "docstring": "Find the first magic assignment (a = %foo) in the cell.", "name": "find", "signature": "def find(cls, tokens_by_line)" }, { "docstring": "Transform a magic assignment found by the ``find()`` classmethod.", "name": "transform", "signature": "def transform(self, lines: List...
2
stack_v2_sparse_classes_30k_train_020009
Implement the Python class `MagicAssign` described below. Class description: Transformer for assignments from magics (a = %foo) Method signatures and docstrings: - def find(cls, tokens_by_line): Find the first magic assignment (a = %foo) in the cell. - def transform(self, lines: List[str]): Transform a magic assignme...
Implement the Python class `MagicAssign` described below. Class description: Transformer for assignments from magics (a = %foo) Method signatures and docstrings: - def find(cls, tokens_by_line): Find the first magic assignment (a = %foo) in the cell. - def transform(self, lines: List[str]): Transform a magic assignme...
e5103f971233fd66b558585cce7a4f52a716cd56
<|skeleton|> class MagicAssign: """Transformer for assignments from magics (a = %foo)""" def find(cls, tokens_by_line): """Find the first magic assignment (a = %foo) in the cell.""" <|body_0|> def transform(self, lines: List[str]): """Transform a magic assignment found by the ``fin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MagicAssign: """Transformer for assignments from magics (a = %foo)""" def find(cls, tokens_by_line): """Find the first magic assignment (a = %foo) in the cell.""" for line in tokens_by_line: assign_ix = _find_assign_op(line) if assign_ix is not None and len(line) >...
the_stack_v2_python_sparse
IPython/core/inputtransformer2.py
ipython/ipython
train
13,673
dff3540d647350e1afdfacf321ff916dc2db23dc
[ "if n in [0, 1]:\n return 1\nreturn self.climbStairs(n - 1) + self.climbStairs(n - 2)", "mem = {0: 1, 1: 1}\nfor i in range(n + 1):\n if i not in mem:\n mem[i] = mem[i - 1] + mem[i - 2]\nreturn mem[n]" ]
<|body_start_0|> if n in [0, 1]: return 1 return self.climbStairs(n - 1) + self.climbStairs(n - 2) <|end_body_0|> <|body_start_1|> mem = {0: 1, 1: 1} for i in range(n + 1): if i not in mem: mem[i] = mem[i - 1] + mem[i - 2] return mem[n] <|...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def climbStairs(self, n): """:type n: int :rtype: int""" <|body_0|> def climbStairs1(self, n): """:type: n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n in [0, 1]: return 1 return self.climbStair...
stack_v2_sparse_classes_36k_train_008743
664
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "climbStairs", "signature": "def climbStairs(self, n)" }, { "docstring": ":type: n: int :rtype: int", "name": "climbStairs1", "signature": "def climbStairs1(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_017326
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs(self, n): :type n: int :rtype: int - def climbStairs1(self, n): :type: n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs(self, n): :type n: int :rtype: int - def climbStairs1(self, n): :type: n: int :rtype: int <|skeleton|> class Solution: def climbStairs(self, n): """...
857b8c7fccfe8216da59228c1cf3675444855673
<|skeleton|> class Solution: def climbStairs(self, n): """:type n: int :rtype: int""" <|body_0|> def climbStairs1(self, n): """:type: n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def climbStairs(self, n): """:type n: int :rtype: int""" if n in [0, 1]: return 1 return self.climbStairs(n - 1) + self.climbStairs(n - 2) def climbStairs1(self, n): """:type: n: int :rtype: int""" mem = {0: 1, 1: 1} for i in range(n +...
the_stack_v2_python_sparse
algorithm/Climbing-Stairs.py
atashi/LLL
train
0
031c1d960d11127c13f1f2bc7b4f5bf4f6917765
[ "super(Network, self).__init__()\nself.seed = torch.manual_seed(seed)\n'*** YOUR CODE HERE ***'\nfeature_size = 64\nself.feature_layer = nn.Sequential(nn.Linear(state_size, feature_size), nn.ReLU())\nvalue_size = 64\nself.value_layer = nn.Sequential(nn.Linear(feature_size, value_size), nn.ReLU(), nn.Linear(value_si...
<|body_start_0|> super(Network, self).__init__() self.seed = torch.manual_seed(seed) '*** YOUR CODE HERE ***' feature_size = 64 self.feature_layer = nn.Sequential(nn.Linear(state_size, feature_size), nn.ReLU()) value_size = 64 self.value_layer = nn.Sequential(nn.L...
Actor (Policy) Model.
Network
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Network: """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed): """Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action seed (int): Random seed""" <|body_0|> def...
stack_v2_sparse_classes_36k_train_008744
1,441
permissive
[ { "docstring": "Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action seed (int): Random seed", "name": "__init__", "signature": "def __init__(self, state_size, action_size, seed)" }, { "docstring": "Build a net...
2
stack_v2_sparse_classes_30k_train_019332
Implement the Python class `Network` described below. Class description: Actor (Policy) Model. Method signatures and docstrings: - def __init__(self, state_size, action_size, seed): Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each acti...
Implement the Python class `Network` described below. Class description: Actor (Policy) Model. Method signatures and docstrings: - def __init__(self, state_size, action_size, seed): Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each acti...
9b1653b7aedeb4dc0e4aab9351cc4a7f4ccb4f32
<|skeleton|> class Network: """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed): """Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action seed (int): Random seed""" <|body_0|> def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Network: """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed): """Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action seed (int): Random seed""" super(Network, self).__init__() ...
the_stack_v2_python_sparse
p1_navigation/dueling_network.py
weicheng113/deep-reinforcement-learning
train
0
9c4bb1ab64b3d3e0cbcc036288cbd4a5e986c27d
[ "try:\n response = Database.Table.get_item(Key={'DocumentID': document_id})\nexcept Exception as e:\n response = None\n Logger.info(f'Database GetDocument : document_id = {document_id} : exception = {e}')\nif response and response.get('Item') and (response['ResponseMetadata']['HTTPStatusCode'] == 200):\n ...
<|body_start_0|> try: response = Database.Table.get_item(Key={'DocumentID': document_id}) except Exception as e: response = None Logger.info(f'Database GetDocument : document_id = {document_id} : exception = {e}') if response and response.get('Item') and (resp...
Database Abstraction Layer
Database
[ "Apache-2.0", "MIT-0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Database: """Database Abstraction Layer""" def GetDocument(document_id: str) -> Document: """Fetch a specific document""" <|body_0|> def GetDocuments(stages: List[Stage], states: List[State]) -> List[Document]: """Fetch a specific document set""" <|body_1...
stack_v2_sparse_classes_36k_train_008745
3,107
permissive
[ { "docstring": "Fetch a specific document", "name": "GetDocument", "signature": "def GetDocument(document_id: str) -> Document" }, { "docstring": "Fetch a specific document set", "name": "GetDocuments", "signature": "def GetDocuments(stages: List[Stage], states: List[State]) -> List[Docu...
4
stack_v2_sparse_classes_30k_train_004886
Implement the Python class `Database` described below. Class description: Database Abstraction Layer Method signatures and docstrings: - def GetDocument(document_id: str) -> Document: Fetch a specific document - def GetDocuments(stages: List[Stage], states: List[State]) -> List[Document]: Fetch a specific document se...
Implement the Python class `Database` described below. Class description: Database Abstraction Layer Method signatures and docstrings: - def GetDocument(document_id: str) -> Document: Fetch a specific document - def GetDocuments(stages: List[Stage], states: List[State]) -> List[Document]: Fetch a specific document se...
633e6291eea95a3933d34cae53b68cf6570b9bbb
<|skeleton|> class Database: """Database Abstraction Layer""" def GetDocument(document_id: str) -> Document: """Fetch a specific document""" <|body_0|> def GetDocuments(stages: List[Stage], states: List[State]) -> List[Document]: """Fetch a specific document set""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Database: """Database Abstraction Layer""" def GetDocument(document_id: str) -> Document: """Fetch a specific document""" try: response = Database.Table.get_item(Key={'DocumentID': document_id}) except Exception as e: response = None Logger.info...
the_stack_v2_python_sparse
source/lambdas/shared/database.py
jhasatis/TabularDocumentDigitization
train
0
af534ffadd9ac19e25e2c33d81a21eb6ca4c758f
[ "self.state = state\nself.waiting_circuits = {}\nself.expected_streams = {}\nself.state.add_stream_listener(self)\nself.state.add_circuit_listener(self)", "circ_deferred = defer.Deferred()\nkey = (str(host), int(port))\nself.expected_streams[key] = circ_deferred\n\ndef add_to_waiting(circ):\n self.waiting_circ...
<|body_start_0|> self.state = state self.waiting_circuits = {} self.expected_streams = {} self.state.add_stream_listener(self) self.state.add_circuit_listener(self) <|end_body_0|> <|body_start_1|> circ_deferred = defer.Deferred() key = (str(host), int(port)) ...
An attacher that builds a chosen path for a client identified by its source port and ip address.
SOCKSClientStreamAttacher
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SOCKSClientStreamAttacher: """An attacher that builds a chosen path for a client identified by its source port and ip address.""" def __init__(self, state): """Instantiates a SOCKSClientStreamAttacher with a txtorcon.torstate.TorState instance.""" <|body_0|> def create_c...
stack_v2_sparse_classes_36k_train_008746
5,595
no_license
[ { "docstring": "Instantiates a SOCKSClientStreamAttacher with a txtorcon.torstate.TorState instance.", "name": "__init__", "signature": "def __init__(self, state)" }, { "docstring": "Specify the path for streams created on a specific client SOCKS connection. Returns a deferred that calls back wi...
5
stack_v2_sparse_classes_30k_train_015858
Implement the Python class `SOCKSClientStreamAttacher` described below. Class description: An attacher that builds a chosen path for a client identified by its source port and ip address. Method signatures and docstrings: - def __init__(self, state): Instantiates a SOCKSClientStreamAttacher with a txtorcon.torstate.T...
Implement the Python class `SOCKSClientStreamAttacher` described below. Class description: An attacher that builds a chosen path for a client identified by its source port and ip address. Method signatures and docstrings: - def __init__(self, state): Instantiates a SOCKSClientStreamAttacher with a txtorcon.torstate.T...
c3834e47c12315468d686a7b7fef62d35bd28cd3
<|skeleton|> class SOCKSClientStreamAttacher: """An attacher that builds a chosen path for a client identified by its source port and ip address.""" def __init__(self, state): """Instantiates a SOCKSClientStreamAttacher with a txtorcon.torstate.TorState instance.""" <|body_0|> def create_c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SOCKSClientStreamAttacher: """An attacher that builds a chosen path for a client identified by its source port and ip address.""" def __init__(self, state): """Instantiates a SOCKSClientStreamAttacher with a txtorcon.torstate.TorState instance.""" self.state = state self.waiting_c...
the_stack_v2_python_sparse
bwscanner/attacher.py
poorboy23/bwscanner
train
0
c696f7f5133fcfad1e7b93a9db114b6cd3b75b28
[ "post = PostFactory(is_active=True)\nReportFactory.create_batch(3, post=post)\nself.assertFalse(post.is_active)", "user = UserFactory()\npost = PostFactory()\nrequest = MagicMock()\nrequest.user = user\nrequest.method = 'POST'\nrequest.POST = {'reason': Report.HARASSMENT}\nview = ReportCreate()\nview.kwargs = {'p...
<|body_start_0|> post = PostFactory(is_active=True) ReportFactory.create_batch(3, post=post) self.assertFalse(post.is_active) <|end_body_0|> <|body_start_1|> user = UserFactory() post = PostFactory() request = MagicMock() request.user = user request.metho...
TestReports
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestReports: def test_post_disable(self, mock): """Reports from 3 different user block post""" <|body_0|> def test_report_only_once(self): """Report can be sent only once""" <|body_1|> <|end_skeleton|> <|body_start_0|> post = PostFactory(is_active=T...
stack_v2_sparse_classes_36k_train_008747
1,170
no_license
[ { "docstring": "Reports from 3 different user block post", "name": "test_post_disable", "signature": "def test_post_disable(self, mock)" }, { "docstring": "Report can be sent only once", "name": "test_report_only_once", "signature": "def test_report_only_once(self)" } ]
2
stack_v2_sparse_classes_30k_train_019102
Implement the Python class `TestReports` described below. Class description: Implement the TestReports class. Method signatures and docstrings: - def test_post_disable(self, mock): Reports from 3 different user block post - def test_report_only_once(self): Report can be sent only once
Implement the Python class `TestReports` described below. Class description: Implement the TestReports class. Method signatures and docstrings: - def test_post_disable(self, mock): Reports from 3 different user block post - def test_report_only_once(self): Report can be sent only once <|skeleton|> class TestReports:...
4089c3f084d7460f64517158eefb54b3b93a01e8
<|skeleton|> class TestReports: def test_post_disable(self, mock): """Reports from 3 different user block post""" <|body_0|> def test_report_only_once(self): """Report can be sent only once""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestReports: def test_post_disable(self, mock): """Reports from 3 different user block post""" post = PostFactory(is_active=True) ReportFactory.create_batch(3, post=post) self.assertFalse(post.is_active) def test_report_only_once(self): """Report can be sent only o...
the_stack_v2_python_sparse
apps/reports/tests.py
maxwell912/social-app
train
0
d1210513ae82ff7de006c7e70aba3632ee09b9fb
[ "delta_lon_lat = np.array(meters, dtype=np.float64)\nif len(delta_lon_lat.shape) == 1:\n if delta_lon_lat.shape[0] == 2:\n delta_lon_lat = delta_lon_lat.reshape(1, 2)\n else:\n delta_lon_lat = delta_lon_lat.reshape(1, 3)\nref_positions = np.asarray(ref_positions, dtype=np.float64)\nif len(ref_po...
<|body_start_0|> delta_lon_lat = np.array(meters, dtype=np.float64) if len(delta_lon_lat.shape) == 1: if delta_lon_lat.shape[0] == 2: delta_lon_lat = delta_lon_lat.reshape(1, 2) else: delta_lon_lat = delta_lon_lat.reshape(1, 3) ref_position...
class to define a "flat earth" projection: longitude is scaled to the cosine of the mid-latitude -- but that's it. not conforming to equal area, distance, bearing, or any other nifty map properties -- but easy to compute, and it looks OK.
FlatEarthProjection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlatEarthProjection: """class to define a "flat earth" projection: longitude is scaled to the cosine of the mid-latitude -- but that's it. not conforming to equal area, distance, bearing, or any other nifty map properties -- but easy to compute, and it looks OK.""" def meters_to_lonlat(meter...
stack_v2_sparse_classes_36k_train_008748
25,780
no_license
[ { "docstring": "Converts from delta meters to delta latitude-longitude, using the Flat-Earth projection. dlat = dy * 8.9992801e-06 dlon = dy * 8.9992801e-06 * cos(ref_lat) (based on previous GNOME value: and/or average radius of the earth of 6366706.989 m) :param meters: Distances in meters :type meters: NX3 nu...
4
null
Implement the Python class `FlatEarthProjection` described below. Class description: class to define a "flat earth" projection: longitude is scaled to the cosine of the mid-latitude -- but that's it. not conforming to equal area, distance, bearing, or any other nifty map properties -- but easy to compute, and it looks...
Implement the Python class `FlatEarthProjection` described below. Class description: class to define a "flat earth" projection: longitude is scaled to the cosine of the mid-latitude -- but that's it. not conforming to equal area, distance, bearing, or any other nifty map properties -- but easy to compute, and it looks...
2e24d53b8b1099022a08ad73377ed6d1c7838f0f
<|skeleton|> class FlatEarthProjection: """class to define a "flat earth" projection: longitude is scaled to the cosine of the mid-latitude -- but that's it. not conforming to equal area, distance, bearing, or any other nifty map properties -- but easy to compute, and it looks OK.""" def meters_to_lonlat(meter...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FlatEarthProjection: """class to define a "flat earth" projection: longitude is scaled to the cosine of the mid-latitude -- but that's it. not conforming to equal area, distance, bearing, or any other nifty map properties -- but easy to compute, and it looks OK.""" def meters_to_lonlat(meters, ref_positi...
the_stack_v2_python_sparse
py_gnome/gnome/utilities/projections.py
bhattvihang/PyGnome
train
1
8a7c3af27f3ac2ee6ce60d451e2abdfd2e6ba5ea
[ "if not isinstance(condition, PassPredicate):\n raise TypeError('Expected PassPredicate, got %s.' % type(condition))\nself.condition = condition\nself.on_true = Workflow(on_true)\nself.on_false = Workflow(on_false) if on_false is not None else None", "if self.condition(circuit, data):\n _logger.debug('True ...
<|body_start_0|> if not isinstance(condition, PassPredicate): raise TypeError('Expected PassPredicate, got %s.' % type(condition)) self.condition = condition self.on_true = Workflow(on_true) self.on_false = Workflow(on_false) if on_false is not None else None <|end_body_0|> ...
The IfThenElsePass class. This is a control pass that conditionally executes a workflow.
IfThenElsePass
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IfThenElsePass: """The IfThenElsePass class. This is a control pass that conditionally executes a workflow.""" def __init__(self, condition: PassPredicate, on_true: WorkflowLike, on_false: WorkflowLike | None=None) -> None: """Construct a IfThenElsePass. Args: condition (PassPredicat...
stack_v2_sparse_classes_36k_train_008749
1,960
permissive
[ { "docstring": "Construct a IfThenElsePass. Args: condition (PassPredicate): The condition checked. on_true (WorkflowLike): The pass or passes to execute if `condition` is true. on_false (WorkflowLike | None): If specified, the pass or passes to execute if `condition` is false. Defaults to None, which does is e...
2
stack_v2_sparse_classes_30k_test_001057
Implement the Python class `IfThenElsePass` described below. Class description: The IfThenElsePass class. This is a control pass that conditionally executes a workflow. Method signatures and docstrings: - def __init__(self, condition: PassPredicate, on_true: WorkflowLike, on_false: WorkflowLike | None=None) -> None: ...
Implement the Python class `IfThenElsePass` described below. Class description: The IfThenElsePass class. This is a control pass that conditionally executes a workflow. Method signatures and docstrings: - def __init__(self, condition: PassPredicate, on_true: WorkflowLike, on_false: WorkflowLike | None=None) -> None: ...
c89112d15072e8ffffb68cf1757b184e2aeb3dc8
<|skeleton|> class IfThenElsePass: """The IfThenElsePass class. This is a control pass that conditionally executes a workflow.""" def __init__(self, condition: PassPredicate, on_true: WorkflowLike, on_false: WorkflowLike | None=None) -> None: """Construct a IfThenElsePass. Args: condition (PassPredicat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IfThenElsePass: """The IfThenElsePass class. This is a control pass that conditionally executes a workflow.""" def __init__(self, condition: PassPredicate, on_true: WorkflowLike, on_false: WorkflowLike | None=None) -> None: """Construct a IfThenElsePass. Args: condition (PassPredicate): The condi...
the_stack_v2_python_sparse
bqskit/passes/control/ifthenelse.py
BQSKit/bqskit
train
54
3b39f3c879cbd63430ff7245031c96769f9e7fbd
[ "source = GithubSource()\nsource.path = 'some/bad/path'\nwith self.assertRaises(IncorrectDirectoryException):\n list(iterate_github_source('a/different/path', source, mock.MagicMock()))", "source = GithubSource()\nsource.path = '.'\nfacade = mock.MagicMock()\nmock_llsd.return_value = [('file', False), ('direct...
<|body_start_0|> source = GithubSource() source.path = 'some/bad/path' with self.assertRaises(IncorrectDirectoryException): list(iterate_github_source('a/different/path', source, mock.MagicMock())) <|end_body_0|> <|body_start_1|> source = GithubSource() source.path =...
Test the behaviour of the `iterate_github_source` function.
TestIterateGithubSource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestIterateGithubSource: """Test the behaviour of the `iterate_github_source` function.""" def test_iterate_github_source_incorrect_directory(self): """If `iterate_github_source` is called with a source that is not inside the directory passed in, an `IncorrectDirectoryException` shou...
stack_v2_sparse_classes_36k_train_008750
17,513
permissive
[ { "docstring": "If `iterate_github_source` is called with a source that is not inside the directory passed in, an `IncorrectDirectoryException` should be raised.", "name": "test_iterate_github_source_incorrect_directory", "signature": "def test_iterate_github_source_incorrect_directory(self)" }, { ...
3
null
Implement the Python class `TestIterateGithubSource` described below. Class description: Test the behaviour of the `iterate_github_source` function. Method signatures and docstrings: - def test_iterate_github_source_incorrect_directory(self): If `iterate_github_source` is called with a source that is not inside the d...
Implement the Python class `TestIterateGithubSource` described below. Class description: Test the behaviour of the `iterate_github_source` function. Method signatures and docstrings: - def test_iterate_github_source_incorrect_directory(self): If `iterate_github_source` is called with a source that is not inside the d...
47c6377ccbfe8576b35854053d726537e533e78c
<|skeleton|> class TestIterateGithubSource: """Test the behaviour of the `iterate_github_source` function.""" def test_iterate_github_source_incorrect_directory(self): """If `iterate_github_source` is called with a source that is not inside the directory passed in, an `IncorrectDirectoryException` shou...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestIterateGithubSource: """Test the behaviour of the `iterate_github_source` function.""" def test_iterate_github_source_incorrect_directory(self): """If `iterate_github_source` is called with a source that is not inside the directory passed in, an `IncorrectDirectoryException` should be raised....
the_stack_v2_python_sparse
director/projects/test_source_operations.py
gxf1986/hub
train
0
9fde606ade16252bad5d05584853b2c887c4def4
[ "data = {'model_id': self._id, 'queries_dataset_id': queries_dataset_id, 'queries_dataset_content_column': queries_dataset_content_column, 'top_k': top_k}\nif matching_id_description_column:\n data['queries_dataset_matching_id_description_column'] = matching_id_description_column\nendpoint = '/usecase-versions/{...
<|body_start_0|> data = {'model_id': self._id, 'queries_dataset_id': queries_dataset_id, 'queries_dataset_content_column': queries_dataset_content_column, 'top_k': top_k} if matching_id_description_column: data['queries_dataset_matching_id_description_column'] = matching_id_description_colum...
TextSimilarityModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextSimilarityModel: def _predict_bulk(self, queries_dataset_id: str, queries_dataset_content_column: str, top_k: int, matching_id_description_column: str=None): """(Util method) Private method used to handle bulk predict. .. note:: This function should not be used directly. Use predict_...
stack_v2_sparse_classes_36k_train_008751
22,476
permissive
[ { "docstring": "(Util method) Private method used to handle bulk predict. .. note:: This function should not be used directly. Use predict_from_* methods instead. Args: queries_dataset_id (str): Unique id of the quries dataset to predict with queries_dataset_content_column (str): Content queries column name que...
2
stack_v2_sparse_classes_30k_train_000096
Implement the Python class `TextSimilarityModel` described below. Class description: Implement the TextSimilarityModel class. Method signatures and docstrings: - def _predict_bulk(self, queries_dataset_id: str, queries_dataset_content_column: str, top_k: int, matching_id_description_column: str=None): (Util method) P...
Implement the Python class `TextSimilarityModel` described below. Class description: Implement the TextSimilarityModel class. Method signatures and docstrings: - def _predict_bulk(self, queries_dataset_id: str, queries_dataset_content_column: str, top_k: int, matching_id_description_column: str=None): (Util method) P...
0860c931e2b466ac4be910350890085111ae32ce
<|skeleton|> class TextSimilarityModel: def _predict_bulk(self, queries_dataset_id: str, queries_dataset_content_column: str, top_k: int, matching_id_description_column: str=None): """(Util method) Private method used to handle bulk predict. .. note:: This function should not be used directly. Use predict_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TextSimilarityModel: def _predict_bulk(self, queries_dataset_id: str, queries_dataset_content_column: str, top_k: int, matching_id_description_column: str=None): """(Util method) Private method used to handle bulk predict. .. note:: This function should not be used directly. Use predict_from_* methods...
the_stack_v2_python_sparse
previsionio/model.py
FrancoisA-prevision/prevision-python
train
0
b5a4ab25ea68c36b4bb8d8ccef5108c0c2d6949a
[ "try:\n if document_type == DocumentType.TERMS_OF_USE.value:\n token = g.jwt_oidc_token_info\n if token.get('accessType', None) == AccessType.ANONYMOUS.value:\n document_type = DocumentType.TERMS_OF_USE_DIRECTOR_SEARCH.value\n elif token.get('loginSource', None) == LoginSource.STA...
<|body_start_0|> try: if document_type == DocumentType.TERMS_OF_USE.value: token = g.jwt_oidc_token_info if token.get('accessType', None) == AccessType.ANONYMOUS.value: document_type = DocumentType.TERMS_OF_USE_DIRECTOR_SEARCH.value ...
Resource for managing Terms Of Use.
Documents
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Documents: """Resource for managing Terms Of Use.""" def get(document_type): """Return the latest terms of use.""" <|body_0|> def _replace_current_date(doc): """Replace any dynamic contents.""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: ...
stack_v2_sparse_classes_36k_train_008752
3,921
permissive
[ { "docstring": "Return the latest terms of use.", "name": "get", "signature": "def get(document_type)" }, { "docstring": "Replace any dynamic contents.", "name": "_replace_current_date", "signature": "def _replace_current_date(doc)" } ]
2
null
Implement the Python class `Documents` described below. Class description: Resource for managing Terms Of Use. Method signatures and docstrings: - def get(document_type): Return the latest terms of use. - def _replace_current_date(doc): Replace any dynamic contents.
Implement the Python class `Documents` described below. Class description: Resource for managing Terms Of Use. Method signatures and docstrings: - def get(document_type): Return the latest terms of use. - def _replace_current_date(doc): Replace any dynamic contents. <|skeleton|> class Documents: """Resource for ...
923cb8a3ee88dcbaf0fe800ca70022b3c13c1d01
<|skeleton|> class Documents: """Resource for managing Terms Of Use.""" def get(document_type): """Return the latest terms of use.""" <|body_0|> def _replace_current_date(doc): """Replace any dynamic contents.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Documents: """Resource for managing Terms Of Use.""" def get(document_type): """Return the latest terms of use.""" try: if document_type == DocumentType.TERMS_OF_USE.value: token = g.jwt_oidc_token_info if token.get('accessType', None) == Access...
the_stack_v2_python_sparse
auth-api/src/auth_api/resources/documents.py
bcgov/sbc-auth
train
13
f0c44e3007ba2317060e986275d026abcf4eba97
[ "if len(grid) == 0 or (len(grid) == 0 and len(grid[0]) == 0):\n return 0\nacross_length = len(grid[0])\nvertical_length = len(grid)\nisland_nums = 0\nfor i in range(vertical_length):\n for j in range(across_length):\n if grid[i][j] == '1':\n grid[i][j] = '0'\n island_nums += 1\n ...
<|body_start_0|> if len(grid) == 0 or (len(grid) == 0 and len(grid[0]) == 0): return 0 across_length = len(grid[0]) vertical_length = len(grid) island_nums = 0 for i in range(vertical_length): for j in range(across_length): if grid[i][j] ==...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numIslands(self, grid: [[int]]) -> int: """get islands from arrays :param grid: :type: [[str]] example: [ ["1", "1", "0", "0", "0"], ["1", "1", "0", "0", "0"], ["0", "0", "1", "0", "0"], ["0", "0", "0", "1", "1"] ] :return: :rtype: int""" <|body_0|> def __get_i...
stack_v2_sparse_classes_36k_train_008753
3,570
no_license
[ { "docstring": "get islands from arrays :param grid: :type: [[str]] example: [ [\"1\", \"1\", \"0\", \"0\", \"0\"], [\"1\", \"1\", \"0\", \"0\", \"0\"], [\"0\", \"0\", \"1\", \"0\", \"0\"], [\"0\", \"0\", \"0\", \"1\", \"1\"] ] :return: :rtype: int", "name": "numIslands", "signature": "def numIslands(se...
2
stack_v2_sparse_classes_30k_train_021190
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numIslands(self, grid: [[int]]) -> int: get islands from arrays :param grid: :type: [[str]] example: [ ["1", "1", "0", "0", "0"], ["1", "1", "0", "0", "0"], ["0", "0", "1", "...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numIslands(self, grid: [[int]]) -> int: get islands from arrays :param grid: :type: [[str]] example: [ ["1", "1", "0", "0", "0"], ["1", "1", "0", "0", "0"], ["0", "0", "1", "...
37710292b2cfc6060098363c8d5f8881a4c22b26
<|skeleton|> class Solution: def numIslands(self, grid: [[int]]) -> int: """get islands from arrays :param grid: :type: [[str]] example: [ ["1", "1", "0", "0", "0"], ["1", "1", "0", "0", "0"], ["0", "0", "1", "0", "0"], ["0", "0", "0", "1", "1"] ] :return: :rtype: int""" <|body_0|> def __get_i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numIslands(self, grid: [[int]]) -> int: """get islands from arrays :param grid: :type: [[str]] example: [ ["1", "1", "0", "0", "0"], ["1", "1", "0", "0", "0"], ["0", "0", "1", "0", "0"], ["0", "0", "0", "1", "1"] ] :return: :rtype: int""" if len(grid) == 0 or (len(grid) == 0 and ...
the_stack_v2_python_sparse
python/pyleetcode/queue_and_stack/numIslands.py
yudongnan23/algorithmRoad
train
0
f1120224241851c19baa225fddf63173832d53ab
[ "try:\n serializer = PatientHistorySerializers(PatientHistory.objects.all(), many=True)\n return JsonResponse({'message': 'listed all', 'data': serializer.data}, status=200)\nexcept Exception as e:\n info_message = 'Internal Server Error'\n logger.error(info_message, e)\n return JsonResponse({'error'...
<|body_start_0|> try: serializer = PatientHistorySerializers(PatientHistory.objects.all(), many=True) return JsonResponse({'message': 'listed all', 'data': serializer.data}, status=200) except Exception as e: info_message = 'Internal Server Error' logger.e...
PatientHistoryView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PatientHistoryView: def get(self, request): """Get all patients""" <|body_0|> def post(self, request): """Save patient data""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: serializer = PatientHistorySerializers(PatientHistory.object...
stack_v2_sparse_classes_36k_train_008754
12,219
no_license
[ { "docstring": "Get all patients", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Save patient data", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_014105
Implement the Python class `PatientHistoryView` described below. Class description: Implement the PatientHistoryView class. Method signatures and docstrings: - def get(self, request): Get all patients - def post(self, request): Save patient data
Implement the Python class `PatientHistoryView` described below. Class description: Implement the PatientHistoryView class. Method signatures and docstrings: - def get(self, request): Get all patients - def post(self, request): Save patient data <|skeleton|> class PatientHistoryView: def get(self, request): ...
b63849983a592fd6a1f654191020fd86aa0787ae
<|skeleton|> class PatientHistoryView: def get(self, request): """Get all patients""" <|body_0|> def post(self, request): """Save patient data""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PatientHistoryView: def get(self, request): """Get all patients""" try: serializer = PatientHistorySerializers(PatientHistory.objects.all(), many=True) return JsonResponse({'message': 'listed all', 'data': serializer.data}, status=200) except Exception as e: ...
the_stack_v2_python_sparse
patient/views.py
RupeshKurlekar/biocare
train
1
54d8caf37eba3d253c75a50580b7eccb518873fc
[ "super(MewloModelManager, self).__init__(mewlosite, debugmode)\nself.modelclass = modelclass\nif flag_set_objmanager:\n modelclass.set_objectmanager(self)", "outstr = ' ' * indent + \"MewloModelManager ({0}) which manages model class '{1}' reporting in.\\n\".format(self.__class__.__name__, self.modelclass.__na...
<|body_start_0|> super(MewloModelManager, self).__init__(mewlosite, debugmode) self.modelclass = modelclass if flag_set_objmanager: modelclass.set_objectmanager(self) <|end_body_0|> <|body_start_1|> outstr = ' ' * indent + "MewloModelManager ({0}) which manages model class '...
Manager class specialized to manage a database model class.
MewloModelManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MewloModelManager: """Manager class specialized to manage a database model class.""" def __init__(self, mewlosite, debugmode, modelclass, flag_set_objmanager): """construct and initialize the stored modelclass that we manage.""" <|body_0|> def dumps(self, indent=0): ...
stack_v2_sparse_classes_36k_train_008755
1,178
no_license
[ { "docstring": "construct and initialize the stored modelclass that we manage.", "name": "__init__", "signature": "def __init__(self, mewlosite, debugmode, modelclass, flag_set_objmanager)" }, { "docstring": "Return a string (with newlines and indents) that displays some debugging useful informa...
2
null
Implement the Python class `MewloModelManager` described below. Class description: Manager class specialized to manage a database model class. Method signatures and docstrings: - def __init__(self, mewlosite, debugmode, modelclass, flag_set_objmanager): construct and initialize the stored modelclass that we manage. -...
Implement the Python class `MewloModelManager` described below. Class description: Manager class specialized to manage a database model class. Method signatures and docstrings: - def __init__(self, mewlosite, debugmode, modelclass, flag_set_objmanager): construct and initialize the stored modelclass that we manage. -...
0c101169767935da1de22de7e6be1e5862592971
<|skeleton|> class MewloModelManager: """Manager class specialized to manage a database model class.""" def __init__(self, mewlosite, debugmode, modelclass, flag_set_objmanager): """construct and initialize the stored modelclass that we manage.""" <|body_0|> def dumps(self, indent=0): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MewloModelManager: """Manager class specialized to manage a database model class.""" def __init__(self, mewlosite, debugmode, modelclass, flag_set_objmanager): """construct and initialize the stored modelclass that we manage.""" super(MewloModelManager, self).__init__(mewlosite, debugmode...
the_stack_v2_python_sparse
mewlo/mpacks/core/manager/modelmanager.py
dcmouser/mewlo
train
0
9f17e3be7533862af50e6aaf856cfce6c275feab
[ "ret = [nums[0]]\nfor num in nums[1:]:\n if num > ret[-1]:\n ret.append(num)\n else:\n pos = bisect.bisect_left(ret, num)\n ret[pos] = num\nreturn len(ret)", "dp = [1] * len(nums)\nfor i in range(1, len(nums)):\n dp[i] = max((dp[x] + 1 if nums[x] < nums[i] else 1 for x in range(i)))\...
<|body_start_0|> ret = [nums[0]] for num in nums[1:]: if num > ret[-1]: ret.append(num) else: pos = bisect.bisect_left(ret, num) ret[pos] = num return len(ret) <|end_body_0|> <|body_start_1|> dp = [1] * len(nums) ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLIS(self, nums: List[int]) -> int: """CREATED AT: 2022/5/25 Runtime: 118 ms, faster than 80.84% Memory Usage: 14.2 MB, less than 48.57% 1 <= nums.length <= 2500 -10^4 <= nums[i] <= 10^4 :param nums: :return:""" <|body_0|> def lengthOfLIS3(self, nums: Li...
stack_v2_sparse_classes_36k_train_008756
2,918
permissive
[ { "docstring": "CREATED AT: 2022/5/25 Runtime: 118 ms, faster than 80.84% Memory Usage: 14.2 MB, less than 48.57% 1 <= nums.length <= 2500 -10^4 <= nums[i] <= 10^4 :param nums: :return:", "name": "lengthOfLIS", "signature": "def lengthOfLIS(self, nums: List[int]) -> int" }, { "docstring": "CREAT...
3
stack_v2_sparse_classes_30k_train_017705
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS(self, nums: List[int]) -> int: CREATED AT: 2022/5/25 Runtime: 118 ms, faster than 80.84% Memory Usage: 14.2 MB, less than 48.57% 1 <= nums.length <= 2500 -10^4 <=...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS(self, nums: List[int]) -> int: CREATED AT: 2022/5/25 Runtime: 118 ms, faster than 80.84% Memory Usage: 14.2 MB, less than 48.57% 1 <= nums.length <= 2500 -10^4 <=...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def lengthOfLIS(self, nums: List[int]) -> int: """CREATED AT: 2022/5/25 Runtime: 118 ms, faster than 80.84% Memory Usage: 14.2 MB, less than 48.57% 1 <= nums.length <= 2500 -10^4 <= nums[i] <= 10^4 :param nums: :return:""" <|body_0|> def lengthOfLIS3(self, nums: Li...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLIS(self, nums: List[int]) -> int: """CREATED AT: 2022/5/25 Runtime: 118 ms, faster than 80.84% Memory Usage: 14.2 MB, less than 48.57% 1 <= nums.length <= 2500 -10^4 <= nums[i] <= 10^4 :param nums: :return:""" ret = [nums[0]] for num in nums[1:]: if n...
the_stack_v2_python_sparse
src/300-LongestIncreasingSubsequence.py
Jiezhi/myleetcode
train
1
c194d7084b8230c7c9c73e2f2d8d4015261c2c79
[ "self.SetStartDate(2010, 1, 1)\nself.SetEndDate(2013, 12, 31)\nself.SetCash(100000)\nIntrinioConfig.SetUserAndPassword('intrinio-username', 'intrinio-password')\nIntrinioConfig.SetTimeIntervalBetweenCalls(timedelta(minutes=1))\nself.uso = self.AddEquity('USO', Resolution.Daily).Symbol\nself.Securities[self.uso].Set...
<|body_start_0|> self.SetStartDate(2010, 1, 1) self.SetEndDate(2013, 12, 31) self.SetCash(100000) IntrinioConfig.SetUserAndPassword('intrinio-username', 'intrinio-password') IntrinioConfig.SetTimeIntervalBetweenCalls(timedelta(minutes=1)) self.uso = self.AddEquity('USO', ...
BasicTemplateIntrinioEconomicData
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicTemplateIntrinioEconomicData: def Initialize(self): """Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.""" <|body_0|> def OnData(self, slice): """OnData event is the primary...
stack_v2_sparse_classes_36k_train_008757
2,830
permissive
[ { "docstring": "Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.", "name": "Initialize", "signature": "def Initialize(self)" }, { "docstring": "OnData event is the primary entry point for your algorithm. Eac...
2
stack_v2_sparse_classes_30k_train_018729
Implement the Python class `BasicTemplateIntrinioEconomicData` described below. Class description: Implement the BasicTemplateIntrinioEconomicData class. Method signatures and docstrings: - def Initialize(self): Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. A...
Implement the Python class `BasicTemplateIntrinioEconomicData` described below. Class description: Implement the BasicTemplateIntrinioEconomicData class. Method signatures and docstrings: - def Initialize(self): Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. A...
b33dd3bc140e14b883f39ecf848a793cf7292277
<|skeleton|> class BasicTemplateIntrinioEconomicData: def Initialize(self): """Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.""" <|body_0|> def OnData(self, slice): """OnData event is the primary...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BasicTemplateIntrinioEconomicData: def Initialize(self): """Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.""" self.SetStartDate(2010, 1, 1) self.SetEndDate(2013, 12, 31) self.SetCash(1000...
the_stack_v2_python_sparse
Algorithm.Python/BasicTemplateIntrinioEconomicData.py
Capnode/Algoloop
train
87
3c7a89fd6c25f688db1b3c9f92e9b02bd5fcad35
[ "self.ad_special_parameters = ad_special_parameters\nself.exchange_special_parameters = exchange_special_parameters\nself.oracle_special_parameters = oracle_special_parameters\nself.physical_special_parameters = physical_special_parameters\nself.skip_indexing = skip_indexing\nself.source_id = source_id\nself.sql_sp...
<|body_start_0|> self.ad_special_parameters = ad_special_parameters self.exchange_special_parameters = exchange_special_parameters self.oracle_special_parameters = oracle_special_parameters self.physical_special_parameters = physical_special_parameters self.skip_indexing = skip_i...
Implementation of the 'SourceSpecialParameter' model. Specifies additional special settings for a single Source in a Protection Job. This Source must be a leaf node in the Source tree. Attributes: ad_special_parameters (ApplicationSpecialParameters): Specifies additional special parameters that are applicable only to P...
SourceSpecialParameter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SourceSpecialParameter: """Implementation of the 'SourceSpecialParameter' model. Specifies additional special settings for a single Source in a Protection Job. This Source must be a leaf node in the Source tree. Attributes: ad_special_parameters (ApplicationSpecialParameters): Specifies additiona...
stack_v2_sparse_classes_36k_train_008758
7,702
permissive
[ { "docstring": "Constructor for the SourceSpecialParameter class", "name": "__init__", "signature": "def __init__(self, ad_special_parameters=None, exchange_special_parameters=None, oracle_special_parameters=None, physical_special_parameters=None, skip_indexing=None, source_id=None, sql_special_paramete...
2
null
Implement the Python class `SourceSpecialParameter` described below. Class description: Implementation of the 'SourceSpecialParameter' model. Specifies additional special settings for a single Source in a Protection Job. This Source must be a leaf node in the Source tree. Attributes: ad_special_parameters (Application...
Implement the Python class `SourceSpecialParameter` described below. Class description: Implementation of the 'SourceSpecialParameter' model. Specifies additional special settings for a single Source in a Protection Job. This Source must be a leaf node in the Source tree. Attributes: ad_special_parameters (Application...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class SourceSpecialParameter: """Implementation of the 'SourceSpecialParameter' model. Specifies additional special settings for a single Source in a Protection Job. This Source must be a leaf node in the Source tree. Attributes: ad_special_parameters (ApplicationSpecialParameters): Specifies additiona...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SourceSpecialParameter: """Implementation of the 'SourceSpecialParameter' model. Specifies additional special settings for a single Source in a Protection Job. This Source must be a leaf node in the Source tree. Attributes: ad_special_parameters (ApplicationSpecialParameters): Specifies additional special par...
the_stack_v2_python_sparse
cohesity_management_sdk/models/source_special_parameter.py
cohesity/management-sdk-python
train
24
ff067d31886eebc3b3257b088bcb5d86d1d3633a
[ "if not os.path.isfile(_preferencesFilePath):\n Preferences.save(Preferences())\nelse:\n Preferences.get()", "global _preferences\nif _preferences is None:\n with open(_preferencesFilePath, 'r') as jsonFile:\n json = jsonFile.read()\n persistentContainer = PersistentContainer[Preferences].f...
<|body_start_0|> if not os.path.isfile(_preferencesFilePath): Preferences.save(Preferences()) else: Preferences.get() <|end_body_0|> <|body_start_1|> global _preferences if _preferences is None: with open(_preferencesFilePath, 'r') as jsonFile: ...
A description of the persistent preferences that the user should be able to change in the program.
Preferences
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Preferences: """A description of the persistent preferences that the user should be able to change in the program.""" def initFile() -> None: """Creates the preferences file if it does not exist.""" <|body_0|> def get() -> 'Preferences': """Returns the persistent...
stack_v2_sparse_classes_36k_train_008759
2,394
no_license
[ { "docstring": "Creates the preferences file if it does not exist.", "name": "initFile", "signature": "def initFile() -> None" }, { "docstring": "Returns the persistent preferences object. It will be loaded from the disk if that has not already been done.", "name": "get", "signature": "d...
3
null
Implement the Python class `Preferences` described below. Class description: A description of the persistent preferences that the user should be able to change in the program. Method signatures and docstrings: - def initFile() -> None: Creates the preferences file if it does not exist. - def get() -> 'Preferences': R...
Implement the Python class `Preferences` described below. Class description: A description of the persistent preferences that the user should be able to change in the program. Method signatures and docstrings: - def initFile() -> None: Creates the preferences file if it does not exist. - def get() -> 'Preferences': R...
6ec5d6d9e63c34535ef4488acbea47ec2a7ec496
<|skeleton|> class Preferences: """A description of the persistent preferences that the user should be able to change in the program.""" def initFile() -> None: """Creates the preferences file if it does not exist.""" <|body_0|> def get() -> 'Preferences': """Returns the persistent...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Preferences: """A description of the persistent preferences that the user should be able to change in the program.""" def initFile() -> None: """Creates the preferences file if it does not exist.""" if not os.path.isfile(_preferencesFilePath): Preferences.save(Preferences()) ...
the_stack_v2_python_sparse
frcpredict/ui/preferences.py
TestaLab/Resolution_prediction_software
train
0
57079aded9db70048585b9f3b509c2f89e3e9e11
[ "send_url = self.get_peizhi_(name='shiming', yaml_ming='yilou_fangdong.yaml')\nsend_url = send_url['bindIdentity']\nlogging.info('url is %s' % send_url)\nsend_dict = {'realName': realName, 'idCard': idCard}\nresponse = self.request_post(base_url=send_url, dict_data=send_dict)\nreturn response", "send_url = self.g...
<|body_start_0|> send_url = self.get_peizhi_(name='shiming', yaml_ming='yilou_fangdong.yaml') send_url = send_url['bindIdentity'] logging.info('url is %s' % send_url) send_dict = {'realName': realName, 'idCard': idCard} response = self.request_post(base_url=send_url, dict_data=se...
ShiMing
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShiMing: def bindIdentity(self, realName, idCard): """提交实名认证 :return:""" <|body_0|> def getSupportBankList(self): """#86、获取支持银行列表 :return:""" <|body_1|> def getCardBin(self, bankCardNo): """#87、获取银行卡开户行 :return:""" <|body_2|> def rea...
stack_v2_sparse_classes_36k_train_008760
2,689
no_license
[ { "docstring": "提交实名认证 :return:", "name": "bindIdentity", "signature": "def bindIdentity(self, realName, idCard)" }, { "docstring": "#86、获取支持银行列表 :return:", "name": "getSupportBankList", "signature": "def getSupportBankList(self)" }, { "docstring": "#87、获取银行卡开户行 :return:", "n...
4
stack_v2_sparse_classes_30k_train_004412
Implement the Python class `ShiMing` described below. Class description: Implement the ShiMing class. Method signatures and docstrings: - def bindIdentity(self, realName, idCard): 提交实名认证 :return: - def getSupportBankList(self): #86、获取支持银行列表 :return: - def getCardBin(self, bankCardNo): #87、获取银行卡开户行 :return: - def real...
Implement the Python class `ShiMing` described below. Class description: Implement the ShiMing class. Method signatures and docstrings: - def bindIdentity(self, realName, idCard): 提交实名认证 :return: - def getSupportBankList(self): #86、获取支持银行列表 :return: - def getCardBin(self, bankCardNo): #87、获取银行卡开户行 :return: - def real...
e173d4e535ac22b72b67371b8a2524ee425cdcbf
<|skeleton|> class ShiMing: def bindIdentity(self, realName, idCard): """提交实名认证 :return:""" <|body_0|> def getSupportBankList(self): """#86、获取支持银行列表 :return:""" <|body_1|> def getCardBin(self, bankCardNo): """#87、获取银行卡开户行 :return:""" <|body_2|> def rea...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShiMing: def bindIdentity(self, realName, idCard): """提交实名认证 :return:""" send_url = self.get_peizhi_(name='shiming', yaml_ming='yilou_fangdong.yaml') send_url = send_url['bindIdentity'] logging.info('url is %s' % send_url) send_dict = {'realName': realName, 'idCard': id...
the_stack_v2_python_sparse
public/aYiLou_fangdong/yilou_fangdong_business/yilou_fangdong_shiMing.py
GSIL-Monitor/mrbao_python
train
0
e5ac35471abe7ab422469777481358136a79089f
[ "proxy_ip = IpRedis().random()\nlogger.info('获取了IP: {}'.format(proxy_ip))\nreturn proxy_ip", "result = IpRedis().delete(ip)\nif result:\n logger.info('删除ip: {}成功'.format(result))\n print('删除ip: {}成功'.format(ip))\nelse:\n print('删除ip: {}失败'.format(ip))" ]
<|body_start_0|> proxy_ip = IpRedis().random() logger.info('获取了IP: {}'.format(proxy_ip)) return proxy_ip <|end_body_0|> <|body_start_1|> result = IpRedis().delete(ip) if result: logger.info('删除ip: {}成功'.format(result)) print('删除ip: {}成功'.format(ip)) ...
IpsPool
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IpsPool: def get_ip_from_pool(cls): """从 IP 池获取 IP,没有 IP 则返回空 str :return:""" <|body_0|> def delete_ip(cls, ip): """从 IP 池删除失效 IP :param ip: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> proxy_ip = IpRedis().random() logger.info('...
stack_v2_sparse_classes_36k_train_008761
2,277
permissive
[ { "docstring": "从 IP 池获取 IP,没有 IP 则返回空 str :return:", "name": "get_ip_from_pool", "signature": "def get_ip_from_pool(cls)" }, { "docstring": "从 IP 池删除失效 IP :param ip: :return:", "name": "delete_ip", "signature": "def delete_ip(cls, ip)" } ]
2
null
Implement the Python class `IpsPool` described below. Class description: Implement the IpsPool class. Method signatures and docstrings: - def get_ip_from_pool(cls): 从 IP 池获取 IP,没有 IP 则返回空 str :return: - def delete_ip(cls, ip): 从 IP 池删除失效 IP :param ip: :return:
Implement the Python class `IpsPool` described below. Class description: Implement the IpsPool class. Method signatures and docstrings: - def get_ip_from_pool(cls): 从 IP 池获取 IP,没有 IP 则返回空 str :return: - def delete_ip(cls, ip): 从 IP 池删除失效 IP :param ip: :return: <|skeleton|> class IpsPool: def get_ip_from_pool(cl...
29ba13905c73081097df9ef646a5c8194eb024be
<|skeleton|> class IpsPool: def get_ip_from_pool(cls): """从 IP 池获取 IP,没有 IP 则返回空 str :return:""" <|body_0|> def delete_ip(cls, ip): """从 IP 池删除失效 IP :param ip: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IpsPool: def get_ip_from_pool(cls): """从 IP 池获取 IP,没有 IP 则返回空 str :return:""" proxy_ip = IpRedis().random() logger.info('获取了IP: {}'.format(proxy_ip)) return proxy_ip def delete_ip(cls, ip): """从 IP 池删除失效 IP :param ip: :return:""" result = IpRedis().delete(i...
the_stack_v2_python_sparse
pyspider/helper/ips_pool.py
UoToGK/crawler-pyspider
train
0
400d77524b00c0a9275ca1e13dde331d67c20c0d
[ "standard_hmm = HMM.DishonestCasino()\nmissing_hmm = DishonestCasino()\nobservations = [1, 2, 6, 6, 1, 2, 3, 4, 5, 6]\ndistances = [1] * (len(observations) - 1)\nstandard_distributions = standard_hmm.scaled_posterior_durbin(observations)\nmissing_distributions = missing_hmm.scaled_posterior_durbin(observations, dis...
<|body_start_0|> standard_hmm = HMM.DishonestCasino() missing_hmm = DishonestCasino() observations = [1, 2, 6, 6, 1, 2, 3, 4, 5, 6] distances = [1] * (len(observations) - 1) standard_distributions = standard_hmm.scaled_posterior_durbin(observations) missing_distributions ...
TestMissingHMM
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestMissingHMM: def test_scaled_posterior_durbin_compatibility(self): """Test the missing observation model when no observation is missing.""" <|body_0|> def test_scaled_posterior_durbin_general(self): """This test is not strict but just checks some inequalities.""" ...
stack_v2_sparse_classes_36k_train_008762
8,288
no_license
[ { "docstring": "Test the missing observation model when no observation is missing.", "name": "test_scaled_posterior_durbin_compatibility", "signature": "def test_scaled_posterior_durbin_compatibility(self)" }, { "docstring": "This test is not strict but just checks some inequalities.", "name...
2
stack_v2_sparse_classes_30k_train_018484
Implement the Python class `TestMissingHMM` described below. Class description: Implement the TestMissingHMM class. Method signatures and docstrings: - def test_scaled_posterior_durbin_compatibility(self): Test the missing observation model when no observation is missing. - def test_scaled_posterior_durbin_general(se...
Implement the Python class `TestMissingHMM` described below. Class description: Implement the TestMissingHMM class. Method signatures and docstrings: - def test_scaled_posterior_durbin_compatibility(self): Test the missing observation model when no observation is missing. - def test_scaled_posterior_durbin_general(se...
91c6f8331f18c914eb3dfc51bc166915998c5081
<|skeleton|> class TestMissingHMM: def test_scaled_posterior_durbin_compatibility(self): """Test the missing observation model when no observation is missing.""" <|body_0|> def test_scaled_posterior_durbin_general(self): """This test is not strict but just checks some inequalities.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestMissingHMM: def test_scaled_posterior_durbin_compatibility(self): """Test the missing observation model when no observation is missing.""" standard_hmm = HMM.DishonestCasino() missing_hmm = DishonestCasino() observations = [1, 2, 6, 6, 1, 2, 3, 4, 5, 6] distances = ...
the_stack_v2_python_sparse
MissingHMM.py
argriffing/xgcode
train
1
8a9c0b68b6eda7ede3d9894e7e0e1fe5fd5d836b
[ "primes = [2, 3, 5, 7, 13, 17, 19, 31]\nfor p in primes:\n euclid = (1 << p - 1) * ((1 << p) - 1)\n if euclid == num:\n break\nreturn euclid == num", "if num < 1:\n return False\ntotal = 0\nfor i in range(1, int(num ** 0.5) + 1):\n if num % i == 0:\n total += i\n if i * i != num:\...
<|body_start_0|> primes = [2, 3, 5, 7, 13, 17, 19, 31] for p in primes: euclid = (1 << p - 1) * ((1 << p) - 1) if euclid == num: break return euclid == num <|end_body_0|> <|body_start_1|> if num < 1: return False total = 0 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def checkPerfectNumber(self, num): """:type num: int :rtype: bool Using Euclid-Euler Theorem""" <|body_0|> def checkPerfectNumber2(self, num): """:type num: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> primes = [2, 3, 5...
stack_v2_sparse_classes_36k_train_008763
1,214
no_license
[ { "docstring": ":type num: int :rtype: bool Using Euclid-Euler Theorem", "name": "checkPerfectNumber", "signature": "def checkPerfectNumber(self, num)" }, { "docstring": ":type num: int :rtype: bool", "name": "checkPerfectNumber2", "signature": "def checkPerfectNumber2(self, num)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkPerfectNumber(self, num): :type num: int :rtype: bool Using Euclid-Euler Theorem - def checkPerfectNumber2(self, num): :type num: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkPerfectNumber(self, num): :type num: int :rtype: bool Using Euclid-Euler Theorem - def checkPerfectNumber2(self, num): :type num: int :rtype: bool <|skeleton|> class So...
b7e92f9a7c4d6652d4901b189f51063ce5520653
<|skeleton|> class Solution: def checkPerfectNumber(self, num): """:type num: int :rtype: bool Using Euclid-Euler Theorem""" <|body_0|> def checkPerfectNumber2(self, num): """:type num: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def checkPerfectNumber(self, num): """:type num: int :rtype: bool Using Euclid-Euler Theorem""" primes = [2, 3, 5, 7, 13, 17, 19, 31] for p in primes: euclid = (1 << p - 1) * ((1 << p) - 1) if euclid == num: break return euclid ...
the_stack_v2_python_sparse
leetcode/easy/perfect_number.py
abkunal/Data-Structures-and-Algorithms
train
2
941d6c1aaeadf5e8da8e2535cdf97cde77c0c2bb
[ "if not leave_id:\n return ({'error': 'mandatory parameter leave_id not supplied'}, 400)\nrequest_payload = request.json\nstatus = request_payload['status']\nprint('making request to leave handler to post attendance')\nleave_handler = LeaveHandler()\nleave_handler.post_leave_status_admin(leave_id, status)", "i...
<|body_start_0|> if not leave_id: return ({'error': 'mandatory parameter leave_id not supplied'}, 400) request_payload = request.json status = request_payload['status'] print('making request to leave handler to post attendance') leave_handler = LeaveHandler() ...
ManageLeavesAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManageLeavesAdmin: def post(self, leave_id): """updates the status of the leave given the leave id Param: leave_id: Leave id. Request: path: api/v0/employeeleavestatus/ body: { "status": "Approved" }, accept: application/json Response: return None, 201 content-type: application/json""" ...
stack_v2_sparse_classes_36k_train_008764
6,574
no_license
[ { "docstring": "updates the status of the leave given the leave id Param: leave_id: Leave id. Request: path: api/v0/employeeleavestatus/ body: { \"status\": \"Approved\" }, accept: application/json Response: return None, 201 content-type: application/json", "name": "post", "signature": "def post(self, l...
2
stack_v2_sparse_classes_30k_train_010542
Implement the Python class `ManageLeavesAdmin` described below. Class description: Implement the ManageLeavesAdmin class. Method signatures and docstrings: - def post(self, leave_id): updates the status of the leave given the leave id Param: leave_id: Leave id. Request: path: api/v0/employeeleavestatus/ body: { "stat...
Implement the Python class `ManageLeavesAdmin` described below. Class description: Implement the ManageLeavesAdmin class. Method signatures and docstrings: - def post(self, leave_id): updates the status of the leave given the leave id Param: leave_id: Leave id. Request: path: api/v0/employeeleavestatus/ body: { "stat...
cb990525bb9da7fef1e82735ea5ca6f5ad67825a
<|skeleton|> class ManageLeavesAdmin: def post(self, leave_id): """updates the status of the leave given the leave id Param: leave_id: Leave id. Request: path: api/v0/employeeleavestatus/ body: { "status": "Approved" }, accept: application/json Response: return None, 201 content-type: application/json""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ManageLeavesAdmin: def post(self, leave_id): """updates the status of the leave given the leave id Param: leave_id: Leave id. Request: path: api/v0/employeeleavestatus/ body: { "status": "Approved" }, accept: application/json Response: return None, 201 content-type: application/json""" if not ...
the_stack_v2_python_sparse
server/services/leave_management/leave_controller.py
goel-aman/Erp-Backend-Code
train
0
02e96b51e6c1bfd0b359bfd004c0ff81e9fefdde
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Chat()", "from .chat_message import ChatMessage\nfrom .chat_message_info import ChatMessageInfo\nfrom .chat_type import ChatType\nfrom .chat_viewpoint import ChatViewpoint\nfrom .conversation_member import ConversationMember\nfrom .ent...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return Chat() <|end_body_0|> <|body_start_1|> from .chat_message import ChatMessage from .chat_message_info import ChatMessageInfo from .chat_type import ChatType from .chat_vie...
Chat
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Chat: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Chat: """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: Chat""" ...
stack_v2_sparse_classes_36k_train_008765
8,255
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: Chat", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(parse_no...
3
null
Implement the Python class `Chat` described below. Class description: Implement the Chat class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Chat: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pars...
Implement the Python class `Chat` described below. Class description: Implement the Chat class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Chat: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pars...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Chat: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Chat: """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: Chat""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Chat: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Chat: """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: Chat""" if not parse_n...
the_stack_v2_python_sparse
msgraph/generated/models/chat.py
microsoftgraph/msgraph-sdk-python
train
135
64867d083bf89ee7e67b2eadce667609eaab2f1e
[ "super(StActiveButton, self).__init__(parent)\nself.algoEngine = algoEngine\nself.spreadName = spreadName\nself.active = False\nself.setStopped()\nself.clicked.connect(self.buttonClicked)", "if self.active:\n self.stop()\nelse:\n self.start()", "algoActive = self.algoEngine.stopAlgo(self.spreadName)\nif n...
<|body_start_0|> super(StActiveButton, self).__init__(parent) self.algoEngine = algoEngine self.spreadName = spreadName self.active = False self.setStopped() self.clicked.connect(self.buttonClicked) <|end_body_0|> <|body_start_1|> if self.active: self...
StActiveButton
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StActiveButton: def __init__(self, algoEngine, spreadName, parent=None): """Constructor""" <|body_0|> def buttonClicked(self): """改变运行模式""" <|body_1|> def stop(self): """停止""" <|body_2|> def start(self): """启动""" <|bo...
stack_v2_sparse_classes_36k_train_008766
22,428
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, algoEngine, spreadName, parent=None)" }, { "docstring": "改变运行模式", "name": "buttonClicked", "signature": "def buttonClicked(self)" }, { "docstring": "停止", "name": "stop", "signature": "def s...
6
stack_v2_sparse_classes_30k_train_000930
Implement the Python class `StActiveButton` described below. Class description: Implement the StActiveButton class. Method signatures and docstrings: - def __init__(self, algoEngine, spreadName, parent=None): Constructor - def buttonClicked(self): 改变运行模式 - def stop(self): 停止 - def start(self): 启动 - def setStarted(sel...
Implement the Python class `StActiveButton` described below. Class description: Implement the StActiveButton class. Method signatures and docstrings: - def __init__(self, algoEngine, spreadName, parent=None): Constructor - def buttonClicked(self): 改变运行模式 - def stop(self): 停止 - def start(self): 启动 - def setStarted(sel...
75f95a00e7eb569cb7cc530ea55d6646ba4595c1
<|skeleton|> class StActiveButton: def __init__(self, algoEngine, spreadName, parent=None): """Constructor""" <|body_0|> def buttonClicked(self): """改变运行模式""" <|body_1|> def stop(self): """停止""" <|body_2|> def start(self): """启动""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StActiveButton: def __init__(self, algoEngine, spreadName, parent=None): """Constructor""" super(StActiveButton, self).__init__(parent) self.algoEngine = algoEngine self.spreadName = spreadName self.active = False self.setStopped() self.clicked.connect(s...
the_stack_v2_python_sparse
vnpy/trader/app/spreadTrading/uiStWidget.py
KilimanjaroFreeman/vnpy
train
3
bd57c8c3a2954ec8ce319dc67205c2a7e27456fb
[ "from scenable.outsourcing.apitools.facebook import OIP_APP_ID, OIP_APP_SECRET, OIP_ACCESS_TOKEN\ntoken = get_basic_access_token(OIP_APP_ID, OIP_APP_SECRET)\nself.assertEquals(token, OIP_ACCESS_TOKEN)", "page = facebook_client.graph_api_objects_request('40796308305')\nself.assertEquals(page['name'], 'Coca-Cola')\...
<|body_start_0|> from scenable.outsourcing.apitools.facebook import OIP_APP_ID, OIP_APP_SECRET, OIP_ACCESS_TOKEN token = get_basic_access_token(OIP_APP_ID, OIP_APP_SECRET) self.assertEquals(token, OIP_ACCESS_TOKEN) <|end_body_0|> <|body_start_1|> page = facebook_client.graph_api_objects...
FacebookGraphTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FacebookGraphTest: def test_basic_access_token(self): """Tests basic access token retrieval""" <|body_0|> def test_graph_lookup(self): """Tests simple object lookup""" <|body_1|> def test_page_lookup(self): """Tests lookup of Facebook pages speci...
stack_v2_sparse_classes_36k_train_008767
18,595
no_license
[ { "docstring": "Tests basic access token retrieval", "name": "test_basic_access_token", "signature": "def test_basic_access_token(self)" }, { "docstring": "Tests simple object lookup", "name": "test_graph_lookup", "signature": "def test_graph_lookup(self)" }, { "docstring": "Test...
5
stack_v2_sparse_classes_30k_train_018916
Implement the Python class `FacebookGraphTest` described below. Class description: Implement the FacebookGraphTest class. Method signatures and docstrings: - def test_basic_access_token(self): Tests basic access token retrieval - def test_graph_lookup(self): Tests simple object lookup - def test_page_lookup(self): Te...
Implement the Python class `FacebookGraphTest` described below. Class description: Implement the FacebookGraphTest class. Method signatures and docstrings: - def test_basic_access_token(self): Tests basic access token retrieval - def test_graph_lookup(self): Tests simple object lookup - def test_page_lookup(self): Te...
3ed85e856a026001a1d91d09d31d944c64704824
<|skeleton|> class FacebookGraphTest: def test_basic_access_token(self): """Tests basic access token retrieval""" <|body_0|> def test_graph_lookup(self): """Tests simple object lookup""" <|body_1|> def test_page_lookup(self): """Tests lookup of Facebook pages speci...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FacebookGraphTest: def test_basic_access_token(self): """Tests basic access token retrieval""" from scenable.outsourcing.apitools.facebook import OIP_APP_ID, OIP_APP_SECRET, OIP_ACCESS_TOKEN token = get_basic_access_token(OIP_APP_ID, OIP_APP_SECRET) self.assertEquals(token, OIP...
the_stack_v2_python_sparse
scenable/outsourcing/apitools/tests.py
gregarious/betasite
train
0
47d40916c55d0e12da8e7b95d58142117823a9ef
[ "assert self.query.can_filter(), 'Cannot use \"limit\" or \"offset\" with delete.'\nself.update(deleted=timezone.now())\nself._result_cache = None", "assert self.query.can_filter(), 'Cannot use \"limit\" or \"offset\" with undelete.'\nobj: 'SoftDeletableModel'\nfor obj in self.all():\n obj.undelete()\nself._re...
<|body_start_0|> assert self.query.can_filter(), 'Cannot use "limit" or "offset" with delete.' self.update(deleted=timezone.now()) self._result_cache = None <|end_body_0|> <|body_start_1|> assert self.query.can_filter(), 'Cannot use "limit" or "offset" with undelete.' obj: 'Soft...
Default queryset for the SoftDeletableManager. Takes care of "lazily evaluating" safedelete QuerySets. QuerySets passed within the ``SoftDeletableQuerySet`` will have all of the models available. The deleted policy is evaluated at the very end of the chain when the QuerySet itself is evaluated.
SoftDeletableQuerySet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SoftDeletableQuerySet: """Default queryset for the SoftDeletableManager. Takes care of "lazily evaluating" safedelete QuerySets. QuerySets passed within the ``SoftDeletableQuerySet`` will have all of the models available. The deleted policy is evaluated at the very end of the chain when the Query...
stack_v2_sparse_classes_36k_train_008768
1,240
no_license
[ { "docstring": "Override bulk delete behavior.", "name": "delete", "signature": "def delete(self)" }, { "docstring": "Undelete soft-deleted instances.", "name": "undelete", "signature": "def undelete(self)" } ]
2
null
Implement the Python class `SoftDeletableQuerySet` described below. Class description: Default queryset for the SoftDeletableManager. Takes care of "lazily evaluating" safedelete QuerySets. QuerySets passed within the ``SoftDeletableQuerySet`` will have all of the models available. The deleted policy is evaluated at t...
Implement the Python class `SoftDeletableQuerySet` described below. Class description: Default queryset for the SoftDeletableManager. Takes care of "lazily evaluating" safedelete QuerySets. QuerySets passed within the ``SoftDeletableQuerySet`` will have all of the models available. The deleted policy is evaluated at t...
8bbdc8eec3622af22c17214051c34e36bea8e05a
<|skeleton|> class SoftDeletableQuerySet: """Default queryset for the SoftDeletableManager. Takes care of "lazily evaluating" safedelete QuerySets. QuerySets passed within the ``SoftDeletableQuerySet`` will have all of the models available. The deleted policy is evaluated at the very end of the chain when the Query...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SoftDeletableQuerySet: """Default queryset for the SoftDeletableManager. Takes care of "lazily evaluating" safedelete QuerySets. QuerySets passed within the ``SoftDeletableQuerySet`` will have all of the models available. The deleted policy is evaluated at the very end of the chain when the QuerySet itself is...
the_stack_v2_python_sparse
core/models/soft_deletable/queryset.py
abdulwahed-mansour/modularhistory
train
1
46474149d71f81d4a62389852ac87a43ffefb761
[ "super().__init__()\nself.discriminators = torch.nn.ModuleList()\nfor _ in range(scales):\n self.discriminators += [MelGANDiscriminator(in_channels=in_channels, out_channels=out_channels, kernel_sizes=kernel_sizes, channels=channels, max_downsample_channels=max_downsample_channels, bias=bias, downsample_scales=d...
<|body_start_0|> super().__init__() self.discriminators = torch.nn.ModuleList() for _ in range(scales): self.discriminators += [MelGANDiscriminator(in_channels=in_channels, out_channels=out_channels, kernel_sizes=kernel_sizes, channels=channels, max_downsample_channels=max_downsample...
MelGAN multi-scale discriminator module.
MelGANMultiScaleDiscriminator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MelGANMultiScaleDiscriminator: """MelGAN multi-scale discriminator module.""" def __init__(self, in_channels: int=1, out_channels: int=1, scales: int=3, downsample_pooling: str='AvgPool1d', downsample_pooling_params: Dict[str, Any]={'kernel_size': 4, 'stride': 2, 'padding': 1, 'count_include...
stack_v2_sparse_classes_36k_train_008769
16,694
permissive
[ { "docstring": "Initilize MelGANMultiScaleDiscriminator module. Args: in_channels (int): Number of input channels. out_channels (int): Number of output channels. scales (int): Number of multi-scales. downsample_pooling (str): Pooling module name for downsampling of the inputs. downsample_pooling_params (Dict[st...
5
null
Implement the Python class `MelGANMultiScaleDiscriminator` described below. Class description: MelGAN multi-scale discriminator module. Method signatures and docstrings: - def __init__(self, in_channels: int=1, out_channels: int=1, scales: int=3, downsample_pooling: str='AvgPool1d', downsample_pooling_params: Dict[st...
Implement the Python class `MelGANMultiScaleDiscriminator` described below. Class description: MelGAN multi-scale discriminator module. Method signatures and docstrings: - def __init__(self, in_channels: int=1, out_channels: int=1, scales: int=3, downsample_pooling: str='AvgPool1d', downsample_pooling_params: Dict[st...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class MelGANMultiScaleDiscriminator: """MelGAN multi-scale discriminator module.""" def __init__(self, in_channels: int=1, out_channels: int=1, scales: int=3, downsample_pooling: str='AvgPool1d', downsample_pooling_params: Dict[str, Any]={'kernel_size': 4, 'stride': 2, 'padding': 1, 'count_include...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MelGANMultiScaleDiscriminator: """MelGAN multi-scale discriminator module.""" def __init__(self, in_channels: int=1, out_channels: int=1, scales: int=3, downsample_pooling: str='AvgPool1d', downsample_pooling_params: Dict[str, Any]={'kernel_size': 4, 'stride': 2, 'padding': 1, 'count_include_pad': False}...
the_stack_v2_python_sparse
espnet2/gan_tts/melgan/melgan.py
espnet/espnet
train
7,242
54d5568e4f3f0f0d9d9292dd085a54cd3347496b
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn MailboxSettings()", "from .automatic_replies_setting import AutomaticRepliesSetting\nfrom .delegate_meeting_message_delivery_options import DelegateMeetingMessageDeliveryOptions\nfrom .locale_info import LocaleInfo\nfrom .user_purpose ...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return MailboxSettings() <|end_body_0|> <|body_start_1|> from .automatic_replies_setting import AutomaticRepliesSetting from .delegate_meeting_message_delivery_options import DelegateMeetingMes...
MailboxSettings
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MailboxSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MailboxSettings: """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 Ret...
stack_v2_sparse_classes_36k_train_008770
6,262
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: MailboxSettings", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_val...
3
null
Implement the Python class `MailboxSettings` described below. Class description: Implement the MailboxSettings class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MailboxSettings: Creates a new instance of the appropriate class based on discriminator...
Implement the Python class `MailboxSettings` described below. Class description: Implement the MailboxSettings class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MailboxSettings: Creates a new instance of the appropriate class based on discriminator...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class MailboxSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MailboxSettings: """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 Ret...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MailboxSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MailboxSettings: """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: MailboxS...
the_stack_v2_python_sparse
msgraph/generated/models/mailbox_settings.py
microsoftgraph/msgraph-sdk-python
train
135
2478282ff41aa45808b3bb3778cfaed196131c82
[ "buffer_layers.sort()\nx1, x2 = torch.chunk(x, 2, dim=-1)\nintermediate = []\nfor layer in layers:\n x1, x2 = layer(x1, x2)\n if layer.layer_id in buffer_layers:\n intermediate.extend([x1.detach(), x2.detach()])\nif len(buffer_layers) == 0:\n all_tensors = [x1.detach(), x2.detach()]\nelse:\n inte...
<|body_start_0|> buffer_layers.sort() x1, x2 = torch.chunk(x, 2, dim=-1) intermediate = [] for layer in layers: x1, x2 = layer(x1, x2) if layer.layer_id in buffer_layers: intermediate.extend([x1.detach(), x2.detach()]) if len(buffer_layers)...
Custom Backpropagation function to allow (A) flushing memory in forward and (B) activation recomputation reversibly in backward for gradient calculation. Inspired by https://github.com/RobinBruegger/RevTorch/blob/master/revtorch/revtorch.py
RevBackProp
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RevBackProp: """Custom Backpropagation function to allow (A) flushing memory in forward and (B) activation recomputation reversibly in backward for gradient calculation. Inspired by https://github.com/RobinBruegger/RevTorch/blob/master/revtorch/revtorch.py""" def forward(ctx, x, layers, buff...
stack_v2_sparse_classes_36k_train_008771
24,265
permissive
[ { "docstring": "Reversible Forward pass. Any intermediate activations from `buffer_layers` are cached in ctx for forward pass. This is not necessary for standard usecases. Each reversible layer implements its own forward pass logic.", "name": "forward", "signature": "def forward(ctx, x, layers, buffer_l...
2
null
Implement the Python class `RevBackProp` described below. Class description: Custom Backpropagation function to allow (A) flushing memory in forward and (B) activation recomputation reversibly in backward for gradient calculation. Inspired by https://github.com/RobinBruegger/RevTorch/blob/master/revtorch/revtorch.py ...
Implement the Python class `RevBackProp` described below. Class description: Custom Backpropagation function to allow (A) flushing memory in forward and (B) activation recomputation reversibly in backward for gradient calculation. Inspired by https://github.com/RobinBruegger/RevTorch/blob/master/revtorch/revtorch.py ...
d2ccc44a2c8e5d49bb26187aff42f2abc90aee28
<|skeleton|> class RevBackProp: """Custom Backpropagation function to allow (A) flushing memory in forward and (B) activation recomputation reversibly in backward for gradient calculation. Inspired by https://github.com/RobinBruegger/RevTorch/blob/master/revtorch/revtorch.py""" def forward(ctx, x, layers, buff...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RevBackProp: """Custom Backpropagation function to allow (A) flushing memory in forward and (B) activation recomputation reversibly in backward for gradient calculation. Inspired by https://github.com/RobinBruegger/RevTorch/blob/master/revtorch/revtorch.py""" def forward(ctx, x, layers, buffer_layers): ...
the_stack_v2_python_sparse
mmpretrain/models/backbones/revvit.py
open-mmlab/mmpretrain
train
652
0ed958b267af85532573f190a4e1eff18de4b143
[ "row = 12\nglobal cookies\ncookies = self.cookies\nurl = self.obj.get_value(row, self.obj.get_host()) + self.obj.get_value(row, self.obj.get_urlxpath())\nmethod = self.obj.get_value(row, self.obj.get_method())\ndata = eval(self.obj.get_value(row, self.obj.get_params()))\nobj = RunMain()\nreturnvalue = obj.run_main(...
<|body_start_0|> row = 12 global cookies cookies = self.cookies url = self.obj.get_value(row, self.obj.get_host()) + self.obj.get_value(row, self.obj.get_urlxpath()) method = self.obj.get_value(row, self.obj.get_method()) data = eval(self.obj.get_value(row, self.obj.get_p...
Testaddress
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Testaddress: def test_case1(self): """添加收获地址失败,手机号码错误""" <|body_0|> def test_case2(self): """添加收获地址失败,联系人输入框为空""" <|body_1|> def test_case3(self): """添加收获地址成功""" <|body_2|> def test_case4(self): """查询收货地址""" <|body_3|...
stack_v2_sparse_classes_36k_train_008772
6,275
no_license
[ { "docstring": "添加收获地址失败,手机号码错误", "name": "test_case1", "signature": "def test_case1(self)" }, { "docstring": "添加收获地址失败,联系人输入框为空", "name": "test_case2", "signature": "def test_case2(self)" }, { "docstring": "添加收获地址成功", "name": "test_case3", "signature": "def test_case3(se...
6
stack_v2_sparse_classes_30k_train_015164
Implement the Python class `Testaddress` described below. Class description: Implement the Testaddress class. Method signatures and docstrings: - def test_case1(self): 添加收获地址失败,手机号码错误 - def test_case2(self): 添加收获地址失败,联系人输入框为空 - def test_case3(self): 添加收获地址成功 - def test_case4(self): 查询收货地址 - def test_case5(self): 修改收货...
Implement the Python class `Testaddress` described below. Class description: Implement the Testaddress class. Method signatures and docstrings: - def test_case1(self): 添加收获地址失败,手机号码错误 - def test_case2(self): 添加收获地址失败,联系人输入框为空 - def test_case3(self): 添加收获地址成功 - def test_case4(self): 查询收货地址 - def test_case5(self): 修改收货...
f073c1539c4e77fbf093b2fe6b5de6a1c3727e47
<|skeleton|> class Testaddress: def test_case1(self): """添加收获地址失败,手机号码错误""" <|body_0|> def test_case2(self): """添加收获地址失败,联系人输入框为空""" <|body_1|> def test_case3(self): """添加收获地址成功""" <|body_2|> def test_case4(self): """查询收货地址""" <|body_3|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Testaddress: def test_case1(self): """添加收获地址失败,手机号码错误""" row = 12 global cookies cookies = self.cookies url = self.obj.get_value(row, self.obj.get_host()) + self.obj.get_value(row, self.obj.get_urlxpath()) method = self.obj.get_value(row, self.obj.get_method()) ...
the_stack_v2_python_sparse
Project/test_res/test_address.py
xiaotiankeyi/portTest
train
0
24dd6ce784a87b9b85863b4a6b95c022ceaa25cd
[ "self.resolve = resolve\nself.set_default_value_mode(DefaultValue.MemberMethod_Object, 'default')\nself.set_validate_mode(Validate.MemberMethod_ObjectOldNew, 'validate')", "kind = self.resolve()\nself.set_default_value_mode(DefaultValue.Static, kind)\nreturn kind", "kind = self.resolve()\nself.set_validate_mode...
<|body_start_0|> self.resolve = resolve self.set_default_value_mode(DefaultValue.MemberMethod_Object, 'default') self.set_validate_mode(Validate.MemberMethod_ObjectOldNew, 'validate') <|end_body_0|> <|body_start_1|> kind = self.resolve() self.set_default_value_mode(DefaultValue....
A Subclass which delays resolving the type definition. The first time the value is accessed or modified, the type will be resolved and the forward subclass will behave identically to a normal subclass.
ForwardSubclass
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ForwardSubclass: """A Subclass which delays resolving the type definition. The first time the value is accessed or modified, the type will be resolved and the forward subclass will behave identically to a normal subclass.""" def __init__(self, resolve): """Initialize a ForwardSubclas...
stack_v2_sparse_classes_36k_train_008773
3,114
permissive
[ { "docstring": "Initialize a ForwardSubclass member. resolve : callable A callable which takes no arguments and returns the type or tuple of types to use for validating the subclass values.", "name": "__init__", "signature": "def __init__(self, resolve)" }, { "docstring": "Called to retrieve the...
4
stack_v2_sparse_classes_30k_train_000542
Implement the Python class `ForwardSubclass` described below. Class description: A Subclass which delays resolving the type definition. The first time the value is accessed or modified, the type will be resolved and the forward subclass will behave identically to a normal subclass. Method signatures and docstrings: -...
Implement the Python class `ForwardSubclass` described below. Class description: A Subclass which delays resolving the type definition. The first time the value is accessed or modified, the type will be resolved and the forward subclass will behave identically to a normal subclass. Method signatures and docstrings: -...
761a52821d8c77b5718216256963682d11599c1e
<|skeleton|> class ForwardSubclass: """A Subclass which delays resolving the type definition. The first time the value is accessed or modified, the type will be resolved and the forward subclass will behave identically to a normal subclass.""" def __init__(self, resolve): """Initialize a ForwardSubclas...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ForwardSubclass: """A Subclass which delays resolving the type definition. The first time the value is accessed or modified, the type will be resolved and the forward subclass will behave identically to a normal subclass.""" def __init__(self, resolve): """Initialize a ForwardSubclass member. res...
the_stack_v2_python_sparse
atom/subclass.py
nucleic/atom
train
251
8491149bed629fec1046aea3520efb29dc71ec5d
[ "issue_id = mr.GetPositiveIntParam('issue_id')\nif not issue_id:\n return {'params': {}, 'notified': [], 'message': 'Cannot proceed without a valid issue ID.'}\ncommenter_id = mr.GetPositiveIntParam('commenter_id')\nomit_ids = [commenter_id]\nhostport = mr.GetParam('hostport')\ndelta_blocker_iids = mr.GetIntList...
<|body_start_0|> issue_id = mr.GetPositiveIntParam('issue_id') if not issue_id: return {'params': {}, 'notified': [], 'message': 'Cannot proceed without a valid issue ID.'} commenter_id = mr.GetPositiveIntParam('commenter_id') omit_ids = [commenter_id] hostport = mr.G...
JSON servlet that notifies appropriate users after a blocking change.
NotifyBlockingChangeTask
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotifyBlockingChangeTask: """JSON servlet that notifies appropriate users after a blocking change.""" def HandleRequest(self, mr): """Process the task to notify users after an issue blocking change. Args: mr: common information parsed from the HTTP request. Returns: Results dictionar...
stack_v2_sparse_classes_36k_train_008774
41,907
permissive
[ { "docstring": "Process the task to notify users after an issue blocking change. Args: mr: common information parsed from the HTTP request. Returns: Results dictionary in JSON format which is useful just for debugging. The main goal is the side-effect of sending emails.", "name": "HandleRequest", "signa...
2
stack_v2_sparse_classes_30k_train_000254
Implement the Python class `NotifyBlockingChangeTask` described below. Class description: JSON servlet that notifies appropriate users after a blocking change. Method signatures and docstrings: - def HandleRequest(self, mr): Process the task to notify users after an issue blocking change. Args: mr: common information...
Implement the Python class `NotifyBlockingChangeTask` described below. Class description: JSON servlet that notifies appropriate users after a blocking change. Method signatures and docstrings: - def HandleRequest(self, mr): Process the task to notify users after an issue blocking change. Args: mr: common information...
b5d4783f99461438ca9e6a477535617fadab6ba3
<|skeleton|> class NotifyBlockingChangeTask: """JSON servlet that notifies appropriate users after a blocking change.""" def HandleRequest(self, mr): """Process the task to notify users after an issue blocking change. Args: mr: common information parsed from the HTTP request. Returns: Results dictionar...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NotifyBlockingChangeTask: """JSON servlet that notifies appropriate users after a blocking change.""" def HandleRequest(self, mr): """Process the task to notify users after an issue blocking change. Args: mr: common information parsed from the HTTP request. Returns: Results dictionary in JSON for...
the_stack_v2_python_sparse
appengine/monorail/features/notify.py
xinghun61/infra
train
2
af2510a742a89fc4cb66dead9f3b0e6fff4e0522
[ "super().__init__(containers=play_screen.get_containers('ENEMY', 'ENTITY'), image=self.sprite_image, start=start, health=Health(400), damage=10)\nself.play_screen = play_screen\nHealthBar(containers=play_screen.everything, health=self.health, size=np.array((580, 30)), start=np.array((320, 45)), border_size=3, color...
<|body_start_0|> super().__init__(containers=play_screen.get_containers('ENEMY', 'ENTITY'), image=self.sprite_image, start=start, health=Health(400), damage=10) self.play_screen = play_screen HealthBar(containers=play_screen.everything, health=self.health, size=np.array((580, 30)), start=np.arra...
The big bad evil guy
Enemy
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Enemy: """The big bad evil guy""" def __init__(self, play_screen, start): """Creates the enemy""" <|body_0|> def new_attack_pattern(self): """Switches to a new attack pattern""" <|body_1|> def update(self): """Updates the enemy""" <|b...
stack_v2_sparse_classes_36k_train_008775
7,992
no_license
[ { "docstring": "Creates the enemy", "name": "__init__", "signature": "def __init__(self, play_screen, start)" }, { "docstring": "Switches to a new attack pattern", "name": "new_attack_pattern", "signature": "def new_attack_pattern(self)" }, { "docstring": "Updates the enemy", ...
3
stack_v2_sparse_classes_30k_train_016414
Implement the Python class `Enemy` described below. Class description: The big bad evil guy Method signatures and docstrings: - def __init__(self, play_screen, start): Creates the enemy - def new_attack_pattern(self): Switches to a new attack pattern - def update(self): Updates the enemy
Implement the Python class `Enemy` described below. Class description: The big bad evil guy Method signatures and docstrings: - def __init__(self, play_screen, start): Creates the enemy - def new_attack_pattern(self): Switches to a new attack pattern - def update(self): Updates the enemy <|skeleton|> class Enemy: ...
8604a243baeecdd393a54c18bf2ff9e003b4b8a0
<|skeleton|> class Enemy: """The big bad evil guy""" def __init__(self, play_screen, start): """Creates the enemy""" <|body_0|> def new_attack_pattern(self): """Switches to a new attack pattern""" <|body_1|> def update(self): """Updates the enemy""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Enemy: """The big bad evil guy""" def __init__(self, play_screen, start): """Creates the enemy""" super().__init__(containers=play_screen.get_containers('ENEMY', 'ENTITY'), image=self.sprite_image, start=start, health=Health(400), damage=10) self.play_screen = play_screen ...
the_stack_v2_python_sparse
src/sprite/enemy.py
ZXQYC/random-shooter-game
train
0
dc3d247bb1098d297aad529bf34ae5dfd0af6d33
[ "new_prop = 'user_prop'\nnew_prop_value = rand_name('new_prop_value')\nimage = self.images_behavior.create_image_via_task()\nresponse = self.images_client.update_image(image.id_, add={new_prop: new_prop_value})\nself.assertEqual(response.status_code, 200)\nupdated_image = response.entity\nself.assertIn(new_prop, up...
<|body_start_0|> new_prop = 'user_prop' new_prop_value = rand_name('new_prop_value') image = self.images_behavior.create_image_via_task() response = self.images_client.update_image(image.id_, add={new_prop: new_prop_value}) self.assertEqual(response.status_code, 200) upda...
TestUpdateImagePositive
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestUpdateImagePositive: def test_update_image_add_additional_property(self): """@summary: Update image add additional property 1) Create image 2) Update image adding a new property 3) Verify that the response code is 200 4) Verify that the new property is in the response 5) Verify that ...
stack_v2_sparse_classes_36k_train_008776
6,204
permissive
[ { "docstring": "@summary: Update image add additional property 1) Create image 2) Update image adding a new property 3) Verify that the response code is 200 4) Verify that the new property is in the response 5) Verify that the new property's value is correct", "name": "test_update_image_add_additional_prope...
4
stack_v2_sparse_classes_30k_train_006421
Implement the Python class `TestUpdateImagePositive` described below. Class description: Implement the TestUpdateImagePositive class. Method signatures and docstrings: - def test_update_image_add_additional_property(self): @summary: Update image add additional property 1) Create image 2) Update image adding a new pro...
Implement the Python class `TestUpdateImagePositive` described below. Class description: Implement the TestUpdateImagePositive class. Method signatures and docstrings: - def test_update_image_add_additional_property(self): @summary: Update image add additional property 1) Create image 2) Update image adding a new pro...
30f0e64672676c3f90b4a582fe90fac6621475b3
<|skeleton|> class TestUpdateImagePositive: def test_update_image_add_additional_property(self): """@summary: Update image add additional property 1) Create image 2) Update image adding a new property 3) Verify that the response code is 200 4) Verify that the new property is in the response 5) Verify that ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestUpdateImagePositive: def test_update_image_add_additional_property(self): """@summary: Update image add additional property 1) Create image 2) Update image adding a new property 3) Verify that the response code is 200 4) Verify that the new property is in the response 5) Verify that the new proper...
the_stack_v2_python_sparse
cloudroast/images/v2/functional/test_update_image_positive.py
RULCSoft/cloudroast
train
1
7e7b021142e008e091a4a0ee2db95f13466f2395
[ "self._plots = 0\nself._filename = filename\nself._x_label = x_label\nself._record_label = record_label\nself._order_by = order_by\nself._heat_map_value = heat_map_value\nself._heat_map_label = heat_map_label\nselector.select = self._update_counter(selector.select)", "@wraps(select)\ndef inner(population: dict[T,...
<|body_start_0|> self._plots = 0 self._filename = filename self._x_label = x_label self._record_label = record_label self._order_by = order_by self._heat_map_value = heat_map_value self._heat_map_label = heat_map_label selector.select = self._update_counte...
Plots which molecule records a :class:`.Selector` selects. Examples: *Plotting Which Molecule Records Got Selected* .. testcode:: plotting-which-molecule-records-got-selected import stk # Make a selector. roulette = stk.Roulette(num_batches=10) # Make a population. population = { stk.MoleculeRecord( topology_graph=stk....
SelectionPlotter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SelectionPlotter: """Plots which molecule records a :class:`.Selector` selects. Examples: *Plotting Which Molecule Records Got Selected* .. testcode:: plotting-which-molecule-records-got-selected import stk # Make a selector. roulette = stk.Roulette(num_batches=10) # Make a population. population...
stack_v2_sparse_classes_36k_train_008777
8,429
permissive
[ { "docstring": "Parameters: filename: The basename of the files. This means it should not include file extensions. selector: The :class:`.Selector` whose selection of molecule records is plotted. x_label: The label use for the x axis. record_label: A function which takes a :class:`.MoleculeRecord` and its fitne...
3
stack_v2_sparse_classes_30k_train_006654
Implement the Python class `SelectionPlotter` described below. Class description: Plots which molecule records a :class:`.Selector` selects. Examples: *Plotting Which Molecule Records Got Selected* .. testcode:: plotting-which-molecule-records-got-selected import stk # Make a selector. roulette = stk.Roulette(num_batc...
Implement the Python class `SelectionPlotter` described below. Class description: Plots which molecule records a :class:`.Selector` selects. Examples: *Plotting Which Molecule Records Got Selected* .. testcode:: plotting-which-molecule-records-got-selected import stk # Make a selector. roulette = stk.Roulette(num_batc...
9242c29dd4b9eb6927c202611d1326c19d73caea
<|skeleton|> class SelectionPlotter: """Plots which molecule records a :class:`.Selector` selects. Examples: *Plotting Which Molecule Records Got Selected* .. testcode:: plotting-which-molecule-records-got-selected import stk # Make a selector. roulette = stk.Roulette(num_batches=10) # Make a population. population...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SelectionPlotter: """Plots which molecule records a :class:`.Selector` selects. Examples: *Plotting Which Molecule Records Got Selected* .. testcode:: plotting-which-molecule-records-got-selected import stk # Make a selector. roulette = stk.Roulette(num_batches=10) # Make a population. population = { stk.Mole...
the_stack_v2_python_sparse
src/stk/_internal/ea/plotters/selection.py
andrewtarzia/stk
train
0
8cc4518f11ea7ac8b3e59d349cd828e7ce63603c
[ "partner = self.env['res.partner']\nres = super(AccountInvoice, self).onchange_partner_id(inv_type, partner_id, date_invoice, payment_term, partner_bank_id, company_id)\nif inv_type in 'out_invoice':\n acc_partner = partner._find_accounting_partner(partner.browse(partner_id))\n res['value']['wh_src_rate'] = a...
<|body_start_0|> partner = self.env['res.partner'] res = super(AccountInvoice, self).onchange_partner_id(inv_type, partner_id, date_invoice, payment_term, partner_bank_id, company_id) if inv_type in 'out_invoice': acc_partner = partner._find_accounting_partner(partner.browse(partner_...
AccountInvoice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountInvoice: def onchange_partner_id(self, inv_type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): """Change invoice information depending of the partner @param type: Invoice type @param partner_id: Partner id of the invoice @param date_...
stack_v2_sparse_classes_36k_train_008778
7,789
no_license
[ { "docstring": "Change invoice information depending of the partner @param type: Invoice type @param partner_id: Partner id of the invoice @param date_invoice: Date invoice @param payment_term: Payment terms @param partner_bank_id: Partner bank id of the invoice @param company_id: Company id", "name": "onch...
5
null
Implement the Python class `AccountInvoice` described below. Class description: Implement the AccountInvoice class. Method signatures and docstrings: - def onchange_partner_id(self, inv_type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): Change invoice information depen...
Implement the Python class `AccountInvoice` described below. Class description: Implement the AccountInvoice class. Method signatures and docstrings: - def onchange_partner_id(self, inv_type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): Change invoice information depen...
718327d01e5b4408add58682c5ad1901fa35b450
<|skeleton|> class AccountInvoice: def onchange_partner_id(self, inv_type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): """Change invoice information depending of the partner @param type: Invoice type @param partner_id: Partner id of the invoice @param date_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccountInvoice: def onchange_partner_id(self, inv_type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): """Change invoice information depending of the partner @param type: Invoice type @param partner_id: Partner id of the invoice @param date_invoice: Date ...
the_stack_v2_python_sparse
l10n_ve_withholding_src/model/invoice.py
Vauxoo/odoo-venezuela
train
15
953b784439b97b4ad06572397a978d7cee35867b
[ "people.sort(key=lambda x: (-x[0], x[1]))\noutput = []\nfor p in people:\n output.insert(p[1], p)\nreturn output", "output = [people[0]]\nfor p in people[1:]:\n index = 0\n count = p[1]\n while index < len(output):\n if p[1] == 0 and p[0] < output[index][0]:\n break\n if p[0] ...
<|body_start_0|> people.sort(key=lambda x: (-x[0], x[1])) output = [] for p in people: output.insert(p[1], p) return output <|end_body_0|> <|body_start_1|> output = [people[0]] for p in people[1:]: index = 0 count = p[1] wh...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reconstructQueue(self, people): """:type people: List[List[int]] :rtype: List[List[int]]""" <|body_0|> def reconstructQueue_failed(self, people): """:type people: List[List[int]] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_36k_train_008779
1,891
no_license
[ { "docstring": ":type people: List[List[int]] :rtype: List[List[int]]", "name": "reconstructQueue", "signature": "def reconstructQueue(self, people)" }, { "docstring": ":type people: List[List[int]] :rtype: List[List[int]]", "name": "reconstructQueue_failed", "signature": "def reconstruc...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reconstructQueue(self, people): :type people: List[List[int]] :rtype: List[List[int]] - def reconstructQueue_failed(self, people): :type people: List[List[int]] :rtype: List[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reconstructQueue(self, people): :type people: List[List[int]] :rtype: List[List[int]] - def reconstructQueue_failed(self, people): :type people: List[List[int]] :rtype: List[...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def reconstructQueue(self, people): """:type people: List[List[int]] :rtype: List[List[int]]""" <|body_0|> def reconstructQueue_failed(self, people): """:type people: List[List[int]] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reconstructQueue(self, people): """:type people: List[List[int]] :rtype: List[List[int]]""" people.sort(key=lambda x: (-x[0], x[1])) output = [] for p in people: output.insert(p[1], p) return output def reconstructQueue_failed(self, people...
the_stack_v2_python_sparse
src/lt_406.py
oxhead/CodingYourWay
train
0
6e6a50744aad518130f21d5630d0cb7c11dd745f
[ "data = super().to_internal_value(data)\ndata['user'] = self.context['request'].user\nreturn data", "attrs = super().validate(attrs)\ntry:\n required_args = attrs['required_arguments']\n assert required_args is not None\nexcept (KeyError, AssertionError):\n required_args = []\ntry:\n default_vals = at...
<|body_start_0|> data = super().to_internal_value(data) data['user'] = self.context['request'].user return data <|end_body_0|> <|body_start_1|> attrs = super().validate(attrs) try: required_args = attrs['required_arguments'] assert required_args is not No...
A serializer for a task type.
AbstractTaskTypeSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AbstractTaskTypeSerializer: """A serializer for a task type.""" def to_internal_value(self, data): """Inject the user into validation data. Need to inject it here before the UniqueTogether validator runs. See discussion here: https://stackoverflow.com/questions/27591574/order-of-seri...
stack_v2_sparse_classes_36k_train_008780
4,896
permissive
[ { "docstring": "Inject the user into validation data. Need to inject it here before the UniqueTogether validator runs. See discussion here: https://stackoverflow.com/questions/27591574/order-of-serializer-validation-in-django-rest-framework.", "name": "to_internal_value", "signature": "def to_internal_v...
2
stack_v2_sparse_classes_30k_train_001805
Implement the Python class `AbstractTaskTypeSerializer` described below. Class description: A serializer for a task type. Method signatures and docstrings: - def to_internal_value(self, data): Inject the user into validation data. Need to inject it here before the UniqueTogether validator runs. See discussion here: h...
Implement the Python class `AbstractTaskTypeSerializer` described below. Class description: A serializer for a task type. Method signatures and docstrings: - def to_internal_value(self, data): Inject the user into validation data. Need to inject it here before the UniqueTogether validator runs. See discussion here: h...
db498a1186fc74221f8214ad1819dd03bf4b08ac
<|skeleton|> class AbstractTaskTypeSerializer: """A serializer for a task type.""" def to_internal_value(self, data): """Inject the user into validation data. Need to inject it here before the UniqueTogether validator runs. See discussion here: https://stackoverflow.com/questions/27591574/order-of-seri...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AbstractTaskTypeSerializer: """A serializer for a task type.""" def to_internal_value(self, data): """Inject the user into validation data. Need to inject it here before the UniqueTogether validator runs. See discussion here: https://stackoverflow.com/questions/27591574/order-of-serializer-valida...
the_stack_v2_python_sparse
tasksapi/serializers/abstract_tasks.py
saltant-org/saltant
train
3
c1455c78dc7a1a22b2f2328125a649df0bf37ec8
[ "assert isinstance(orientations, list), 'orientations must be a list'\nself.imsize = IMAGE_SIZE\nself.orientations = orientations\nself.nblocks = nblocks\nself.padding = PIX_PAD\nself.createGabors()\nself.nfeatures = len(self.Gabors) * pow(self.nblocks, 2)", "self.total_size = self.imsize + 2 * self.padding\nself...
<|body_start_0|> assert isinstance(orientations, list), 'orientations must be a list' self.imsize = IMAGE_SIZE self.orientations = orientations self.nblocks = nblocks self.padding = PIX_PAD self.createGabors() self.nfeatures = len(self.Gabors) * pow(self.nblocks, ...
Gist
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Gist: def __init__(self, orientations, nblocks): """Creates an object type Gist Args: orientations: a list of number of orientations at each scale nblocks: number of blocks considered to for a grid and compute the gist Assertions: AssertionError if orientations is not a list""" <...
stack_v2_sparse_classes_36k_train_008781
4,223
no_license
[ { "docstring": "Creates an object type Gist Args: orientations: a list of number of orientations at each scale nblocks: number of blocks considered to for a grid and compute the gist Assertions: AssertionError if orientations is not a list", "name": "__init__", "signature": "def __init__(self, orientati...
3
null
Implement the Python class `Gist` described below. Class description: Implement the Gist class. Method signatures and docstrings: - def __init__(self, orientations, nblocks): Creates an object type Gist Args: orientations: a list of number of orientations at each scale nblocks: number of blocks considered to for a gr...
Implement the Python class `Gist` described below. Class description: Implement the Gist class. Method signatures and docstrings: - def __init__(self, orientations, nblocks): Creates an object type Gist Args: orientations: a list of number of orientations at each scale nblocks: number of blocks considered to for a gr...
2f9c33c4e1a26b3e9e699210ac974047936f49e1
<|skeleton|> class Gist: def __init__(self, orientations, nblocks): """Creates an object type Gist Args: orientations: a list of number of orientations at each scale nblocks: number of blocks considered to for a grid and compute the gist Assertions: AssertionError if orientations is not a list""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Gist: def __init__(self, orientations, nblocks): """Creates an object type Gist Args: orientations: a list of number of orientations at each scale nblocks: number of blocks considered to for a grid and compute the gist Assertions: AssertionError if orientations is not a list""" assert isinstan...
the_stack_v2_python_sparse
vision/utils/gist.py
winkash/image-classification
train
0
d71368117861e3ff97d5936e9e363f1e4234c5e8
[ "listr = Theme.objects.all()\nresponse = self.serializer(listr, many=True)\nreturn Response(response.data, status=status.HTTP_200_OK)", "response = self.serializer(data=request.data)\nif response.is_valid():\n response.save()\n return Response(response.data, status=status.HTTP_201_CREATED)\nreturn Response(...
<|body_start_0|> listr = Theme.objects.all() response = self.serializer(listr, many=True) return Response(response.data, status=status.HTTP_200_OK) <|end_body_0|> <|body_start_1|> response = self.serializer(data=request.data) if response.is_valid(): response.save() ...
...
VThemeList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VThemeList: """...""" def get(self, request, format=None): """...""" <|body_0|> def post(self, request, format=None): """...""" <|body_1|> <|end_skeleton|> <|body_start_0|> listr = Theme.objects.all() response = self.serializer(listr, ma...
stack_v2_sparse_classes_36k_train_008782
2,319
permissive
[ { "docstring": "...", "name": "get", "signature": "def get(self, request, format=None)" }, { "docstring": "...", "name": "post", "signature": "def post(self, request, format=None)" } ]
2
stack_v2_sparse_classes_30k_train_021436
Implement the Python class `VThemeList` described below. Class description: ... Method signatures and docstrings: - def get(self, request, format=None): ... - def post(self, request, format=None): ...
Implement the Python class `VThemeList` described below. Class description: ... Method signatures and docstrings: - def get(self, request, format=None): ... - def post(self, request, format=None): ... <|skeleton|> class VThemeList: """...""" def get(self, request, format=None): """...""" <|b...
660664ba2321499e92c3c5c23719756db2569e90
<|skeleton|> class VThemeList: """...""" def get(self, request, format=None): """...""" <|body_0|> def post(self, request, format=None): """...""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VThemeList: """...""" def get(self, request, format=None): """...""" listr = Theme.objects.all() response = self.serializer(listr, many=True) return Response(response.data, status=status.HTTP_200_OK) def post(self, request, format=None): """...""" resp...
the_stack_v2_python_sparse
apps/theme/views/vtheme.py
magocod/djrepo
train
1
d63e24a12e3ce0c526f90de101e66f3dbfba1a80
[ "res = []\n\ndef dfs(node):\n if not node:\n return\n res.append(str(node.val))\n res.append(str(len(node.children or [])))\n if node.children:\n for child in node.children:\n dfs(child)\ndfs(root)\nreturn '#'.join(res)", "if not data:\n return None\ndata = iter(data.split(...
<|body_start_0|> res = [] def dfs(node): if not node: return res.append(str(node.val)) res.append(str(len(node.children or []))) if node.children: for child in node.children: dfs(child) dfs(root)...
Codec1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec1: def serialize(self, root: 'Node') -> str: """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data: str) -> 'Node': """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|...
stack_v2_sparse_classes_36k_train_008783
4,054
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: Node :rtype: str", "name": "serialize", "signature": "def serialize(self, root: 'Node') -> str" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node", "name": "deserialize", "signature": "def des...
2
null
Implement the Python class `Codec1` described below. Class description: Implement the Codec1 class. Method signatures and docstrings: - def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data: str) -> 'Node': Decodes your encoded data to t...
Implement the Python class `Codec1` described below. Class description: Implement the Codec1 class. Method signatures and docstrings: - def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data: str) -> 'Node': Decodes your encoded data to t...
44765a7d89423b7ec2c159f70b1a6f6e446523c2
<|skeleton|> class Codec1: def serialize(self, root: 'Node') -> str: """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data: str) -> 'Node': """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec1: def serialize(self, root: 'Node') -> str: """Encodes a tree to a single string. :type root: Node :rtype: str""" res = [] def dfs(node): if not node: return res.append(str(node.val)) res.append(str(len(node.children or []))) ...
the_stack_v2_python_sparse
python/_0001_0500/0428_serialize-and-deserialize-n-ary-tree.py
Wang-Yann/LeetCodeMe
train
0
0a50c471dda1461ffec90695bffdab74c93cd428
[ "self._differ = difflib.Differ()\nself._left_class = left_class\nself._right_class = right_class", "left = []\nright = []\nleft_open = False\nright_open = False\nfor atom in self._differ.compare(s1, s2):\n if atom.startswith(' ') or atom.startswith('? '):\n if left_open:\n left.append('</spa...
<|body_start_0|> self._differ = difflib.Differ() self._left_class = left_class self._right_class = right_class <|end_body_0|> <|body_start_1|> left = [] right = [] left_open = False right_open = False for atom in self._differ.compare(s1, s2): ...
HTMLDiffer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HTMLDiffer: def __init__(self, left_class, right_class): """Args: left_class: the css class to use from strings unique to the left side right_class: the css class to use from strings unique to the right side""" <|body_0|> def Diff(self, s1, s2): """Returns html for t...
stack_v2_sparse_classes_36k_train_008784
2,181
no_license
[ { "docstring": "Args: left_class: the css class to use from strings unique to the left side right_class: the css class to use from strings unique to the right side", "name": "__init__", "signature": "def __init__(self, left_class, right_class)" }, { "docstring": "Returns html for the diff of s1 ...
2
stack_v2_sparse_classes_30k_train_000035
Implement the Python class `HTMLDiffer` described below. Class description: Implement the HTMLDiffer class. Method signatures and docstrings: - def __init__(self, left_class, right_class): Args: left_class: the css class to use from strings unique to the left side right_class: the css class to use from strings unique...
Implement the Python class `HTMLDiffer` described below. Class description: Implement the HTMLDiffer class. Method signatures and docstrings: - def __init__(self, left_class, right_class): Args: left_class: the css class to use from strings unique to the left side right_class: the css class to use from strings unique...
2ce85d05eaba735a8ed2c63a26852dcab8bfd643
<|skeleton|> class HTMLDiffer: def __init__(self, left_class, right_class): """Args: left_class: the css class to use from strings unique to the left side right_class: the css class to use from strings unique to the right side""" <|body_0|> def Diff(self, s1, s2): """Returns html for t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HTMLDiffer: def __init__(self, left_class, right_class): """Args: left_class: the css class to use from strings unique to the left side right_class: the css class to use from strings unique to the right side""" self._differ = difflib.Differ() self._left_class = left_class self....
the_stack_v2_python_sparse
html_differ.py
OpenLightingProject/rdm-app
train
15
6382e1be7ae5ed612e42b5b8e5af541a421454f3
[ "context = super().get_context_data(*args, **kwargs)\ncontext['listing'] = self.object\ncontext['listing_tags'] = context['listing'].tags.all()\nall_tags = models.shopify_models.ShopifyTag.objects.all()\ntag_groups = defaultdict(list)\nfor tag in all_tags:\n tag_groups[tag.name[0]].append(tag)\ncontext['tag_grou...
<|body_start_0|> context = super().get_context_data(*args, **kwargs) context['listing'] = self.object context['listing_tags'] = context['listing'].tags.all() all_tags = models.shopify_models.ShopifyTag.objects.all() tag_groups = defaultdict(list) for tag in all_tags: ...
View for setting Shopify tags.
UpdateShopifyTags
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateShopifyTags: """View for setting Shopify tags.""" def get_context_data(self, *args, **kwargs): """Return context for the template.""" <|body_0|> def get_success_url(self): """Return redirect URL.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_008785
11,297
no_license
[ { "docstring": "Return context for the template.", "name": "get_context_data", "signature": "def get_context_data(self, *args, **kwargs)" }, { "docstring": "Return redirect URL.", "name": "get_success_url", "signature": "def get_success_url(self)" } ]
2
null
Implement the Python class `UpdateShopifyTags` described below. Class description: View for setting Shopify tags. Method signatures and docstrings: - def get_context_data(self, *args, **kwargs): Return context for the template. - def get_success_url(self): Return redirect URL.
Implement the Python class `UpdateShopifyTags` described below. Class description: View for setting Shopify tags. Method signatures and docstrings: - def get_context_data(self, *args, **kwargs): Return context for the template. - def get_success_url(self): Return redirect URL. <|skeleton|> class UpdateShopifyTags: ...
ba51d4e304b1aeb296fa2fe16611c892fcdbd471
<|skeleton|> class UpdateShopifyTags: """View for setting Shopify tags.""" def get_context_data(self, *args, **kwargs): """Return context for the template.""" <|body_0|> def get_success_url(self): """Return redirect URL.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateShopifyTags: """View for setting Shopify tags.""" def get_context_data(self, *args, **kwargs): """Return context for the template.""" context = super().get_context_data(*args, **kwargs) context['listing'] = self.object context['listing_tags'] = context['listing'].tag...
the_stack_v2_python_sparse
channels/views.py
stcstores/stcadmin
train
0
a08d1209f461ef8e5d4072797befe8b199e6a847
[ "self.tweets = dict()\nself.recentTweets = dict()\nself.followedBy = dict()\nself.timeCnt = 0\nself.userSet = set()", "if userId not in self.userSet:\n self.userSet.add(userId)\nif userId not in self.recentTweets:\n self.recentTweets[userId] = []\nif userId not in self.followedBy:\n self.followedBy[userI...
<|body_start_0|> self.tweets = dict() self.recentTweets = dict() self.followedBy = dict() self.timeCnt = 0 self.userSet = set() <|end_body_0|> <|body_start_1|> if userId not in self.userSet: self.userSet.add(userId) if userId not in self.recentTweets:...
Twitter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId, tweetId): """Compose a new tweet. :type userId: int :type tweetId: int :rtype: void""" <|body_1|> def getNewsFeed(self, userId): """Ret...
stack_v2_sparse_classes_36k_train_008786
4,789
permissive
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Compose a new tweet. :type userId: int :type tweetId: int :rtype: void", "name": "postTweet", "signature": "def postTweet(self, userId, tweetId)" }, { "...
5
null
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId, tweetId): Compose a new tweet. :type userId: int :type tweetId: int :rtype: void - def getNew...
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId, tweetId): Compose a new tweet. :type userId: int :type tweetId: int :rtype: void - def getNew...
6c547c338eb05042cb68f57f737dce483964e2fd
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId, tweetId): """Compose a new tweet. :type userId: int :type tweetId: int :rtype: void""" <|body_1|> def getNewsFeed(self, userId): """Ret...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Twitter: def __init__(self): """Initialize your data structure here.""" self.tweets = dict() self.recentTweets = dict() self.followedBy = dict() self.timeCnt = 0 self.userSet = set() def postTweet(self, userId, tweetId): """Compose a new tweet. :typ...
the_stack_v2_python_sparse
Q355DesignTwitter.py
ChenliangLi205/LeetCode
train
0
f615cf74412040847de5f243e9d488fb6440a8b0
[ "self.new_inv_item = ['1', 'Knife Set', 10, 'n', 'n']\nself.new_furn_item = ['2', 'Couch', 25, 'y', 'Cloth', 'L']\nself.new_elec_item = ['3', 'Dryer', 100, 'n', 'y', 'Samsung', 12]", "m.FULL_INVENTORY = {}\nwith patch('builtins.input', side_effect=self.new_inv_item):\n with patch('inventory_management.market_p...
<|body_start_0|> self.new_inv_item = ['1', 'Knife Set', 10, 'n', 'n'] self.new_furn_item = ['2', 'Couch', 25, 'y', 'Cloth', 'L'] self.new_elec_item = ['3', 'Dryer', 100, 'n', 'y', 'Samsung', 12] <|end_body_0|> <|body_start_1|> m.FULL_INVENTORY = {} with patch('builtins.input', s...
Perform integration tests inventory_management package.
IntegrationTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IntegrationTests: """Perform integration tests inventory_management package.""" def setUp(self): """Peform setup of tests.""" <|body_0|> def test_integration(self): """Test all modules together.""" <|body_1|> <|end_skeleton|> <|body_start_0|> se...
stack_v2_sparse_classes_36k_train_008787
4,548
no_license
[ { "docstring": "Peform setup of tests.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test all modules together.", "name": "test_integration", "signature": "def test_integration(self)" } ]
2
stack_v2_sparse_classes_30k_test_000088
Implement the Python class `IntegrationTests` described below. Class description: Perform integration tests inventory_management package. Method signatures and docstrings: - def setUp(self): Peform setup of tests. - def test_integration(self): Test all modules together.
Implement the Python class `IntegrationTests` described below. Class description: Perform integration tests inventory_management package. Method signatures and docstrings: - def setUp(self): Peform setup of tests. - def test_integration(self): Test all modules together. <|skeleton|> class IntegrationTests: """Pe...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class IntegrationTests: """Perform integration tests inventory_management package.""" def setUp(self): """Peform setup of tests.""" <|body_0|> def test_integration(self): """Test all modules together.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IntegrationTests: """Perform integration tests inventory_management package.""" def setUp(self): """Peform setup of tests.""" self.new_inv_item = ['1', 'Knife Set', 10, 'n', 'n'] self.new_furn_item = ['2', 'Couch', 25, 'y', 'Cloth', 'L'] self.new_elec_item = ['3', 'Dryer',...
the_stack_v2_python_sparse
students/Reem_Alqaysi/Lesson_01/test_integration.py
JavaRod/SP_Python220B_2019
train
1
fc631a2b84532f18a4449a54e9b34a15b1f895b6
[ "row, col = (len(matrix), len(matrix[0]))\nmatrix.reverse()\nfor i in range(row):\n for j in range(i + 1, col):\n matrix[i][j], matrix[j][i] = (matrix[j][i], matrix[i][j])", "temp = list(zip(*matrix[::-1]))\nN = len(temp)\nfor i in range(N):\n for j in range(N):\n matrix[i][j] = temp[i][j]" ]
<|body_start_0|> row, col = (len(matrix), len(matrix[0])) matrix.reverse() for i in range(row): for j in range(i + 1, col): matrix[i][j], matrix[j][i] = (matrix[j][i], matrix[i][j]) <|end_body_0|> <|body_start_1|> temp = list(zip(*matrix[::-1])) N = l...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" <|body_0|> def rotate1(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_008788
1,471
no_license
[ { "docstring": "Do not return anything, modify matrix in-place instead.", "name": "rotate", "signature": "def rotate(self, matrix: List[List[int]]) -> None" }, { "docstring": "Do not return anything, modify matrix in-place instead.", "name": "rotate1", "signature": "def rotate1(self, mat...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix: List[List[int]]) -> None: Do not return anything, modify matrix in-place instead. - def rotate1(self, matrix: List[List[int]]) -> None: Do not return any...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix: List[List[int]]) -> None: Do not return anything, modify matrix in-place instead. - def rotate1(self, matrix: List[List[int]]) -> None: Do not return any...
b7c59c826bcd17cb1333571eb9f13f5c2b89b4ee
<|skeleton|> class Solution: def rotate(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" <|body_0|> def rotate1(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rotate(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" row, col = (len(matrix), len(matrix[0])) matrix.reverse() for i in range(row): for j in range(i + 1, col): matrix[i][j], matrix...
the_stack_v2_python_sparse
每日一题/旋转矩阵.py
Asunqingwen/LeetCode
train
0
515f8e88c6cf560788ce9552bf6387f21702d761
[ "if not nums:\n return []\nif len(nums) <= k:\n return [max(nums)]\ninit_nums = nums[:k]\nheapq._heapify_max(init_nums)\nresult = [init_nums[0]]\nfor i in range(k, len(nums)):\n result.append(init_nums[0])\nreturn result", "if not nums:\n return []\nif len(nums) <= k:\n return [max(nums)]\nwindow =...
<|body_start_0|> if not nums: return [] if len(nums) <= k: return [max(nums)] init_nums = nums[:k] heapq._heapify_max(init_nums) result = [init_nums[0]] for i in range(k, len(nums)): result.append(init_nums[0]) return result <|e...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: """最大堆写法 执行用时 :1572 ms, 在所有 Python3 提交中击败了5.17% 的用户 内存消耗 :20.1 MB, 在所有 Python3 提交中击败了5.39%的用户""" <|body_0|> def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: """双端队列写法, 来自覃超的算...
stack_v2_sparse_classes_36k_train_008789
2,614
no_license
[ { "docstring": "最大堆写法 执行用时 :1572 ms, 在所有 Python3 提交中击败了5.17% 的用户 内存消耗 :20.1 MB, 在所有 Python3 提交中击败了5.39%的用户", "name": "maxSlidingWindow", "signature": "def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]" }, { "docstring": "双端队列写法, 来自覃超的算法课 (看不懂代码, 先跑一遍) 执行用时 :216 ms, 在所有 Python3 提交中...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: 最大堆写法 执行用时 :1572 ms, 在所有 Python3 提交中击败了5.17% 的用户 内存消耗 :20.1 MB, 在所有 Python3 提交中击败了5.39%的用户 - def maxSlidingWindo...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: 最大堆写法 执行用时 :1572 ms, 在所有 Python3 提交中击败了5.17% 的用户 内存消耗 :20.1 MB, 在所有 Python3 提交中击败了5.39%的用户 - def maxSlidingWindo...
99a3abf1774933af73a8405f9b59e5e64906bca4
<|skeleton|> class Solution: def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: """最大堆写法 执行用时 :1572 ms, 在所有 Python3 提交中击败了5.17% 的用户 内存消耗 :20.1 MB, 在所有 Python3 提交中击败了5.39%的用户""" <|body_0|> def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: """双端队列写法, 来自覃超的算...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: """最大堆写法 执行用时 :1572 ms, 在所有 Python3 提交中击败了5.17% 的用户 内存消耗 :20.1 MB, 在所有 Python3 提交中击败了5.39%的用户""" if not nums: return [] if len(nums) <= k: return [max(nums)] init_nums = nums[:k]...
the_stack_v2_python_sparse
leetcode/239.sliding-window-maximum.py
iamkissg/leetcode
train
0
ca716f1deb6911b79e00e20169db93a476e9411a
[ "def tree_to_list(root):\n from collections import deque\n if root == None:\n return []\n ans = []\n q = deque([root])\n while len(q) != 0:\n node = q.popleft()\n ans.append(node.val if node else None)\n if node:\n q.append(node.left)\n q.append(node....
<|body_start_0|> def tree_to_list(root): from collections import deque if root == None: return [] ans = [] q = deque([root]) while len(q) != 0: node = q.popleft() ans.append(node.val if node else None) ...
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: stra :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_36k_train_008790
1,924
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: stra :rtype: TreeNode", "name": "deserialize", "signature": "def deseriali...
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: stra :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: stra :rtype...
48ba21799f63225c104f649c3871444a29ab978a
<|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: stra :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""" def tree_to_list(root): from collections import deque if root == None: return [] ans = [] q = deque([root]) wh...
the_stack_v2_python_sparse
archive/449SerializeandDeserializeBST.py
doraemon1293/Leetcode
train
0
88f02e8874b0e6ab78bd7316645f517884066e40
[ "username = self.request.user.email\nold_password = form.cleaned_data['old_password']\ncheckCredentialsResult = bsd_api.account_checkCredentials(username, old_password)\nassert_valid_account(checkCredentialsResult)", "username = self.request.user.email\nnew_password = form.cleaned_data['new_password1']\nsetPasswo...
<|body_start_0|> username = self.request.user.email old_password = form.cleaned_data['old_password'] checkCredentialsResult = bsd_api.account_checkCredentials(username, old_password) assert_valid_account(checkCredentialsResult) <|end_body_0|> <|body_start_1|> username = self.req...
PasswordChangeView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PasswordChangeView: def check_old_password(self, form): """Check if old password is valid in BSD""" <|body_0|> def set_new_password(self, form): """Set new password in BSD""" <|body_1|> def form_valid(self, form): """Check old password""" ...
stack_v2_sparse_classes_36k_train_008791
26,076
permissive
[ { "docstring": "Check if old password is valid in BSD", "name": "check_old_password", "signature": "def check_old_password(self, form)" }, { "docstring": "Set new password in BSD", "name": "set_new_password", "signature": "def set_new_password(self, form)" }, { "docstring": "Chec...
3
stack_v2_sparse_classes_30k_train_015990
Implement the Python class `PasswordChangeView` described below. Class description: Implement the PasswordChangeView class. Method signatures and docstrings: - def check_old_password(self, form): Check if old password is valid in BSD - def set_new_password(self, form): Set new password in BSD - def form_valid(self, f...
Implement the Python class `PasswordChangeView` described below. Class description: Implement the PasswordChangeView class. Method signatures and docstrings: - def check_old_password(self, form): Check if old password is valid in BSD - def set_new_password(self, form): Set new password in BSD - def form_valid(self, f...
c8024b805ff5ff0e16f54dce7bf05097fd2f08e0
<|skeleton|> class PasswordChangeView: def check_old_password(self, form): """Check if old password is valid in BSD""" <|body_0|> def set_new_password(self, form): """Set new password in BSD""" <|body_1|> def form_valid(self, form): """Check old password""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PasswordChangeView: def check_old_password(self, form): """Check if old password is valid in BSD""" username = self.request.user.email old_password = form.cleaned_data['old_password'] checkCredentialsResult = bsd_api.account_checkCredentials(username, old_password) asse...
the_stack_v2_python_sparse
organizing_hub/views/views.py
Our-Revolution/site
train
4
bd6053f0f6d05ae03b1c9c007ac9b811ca9b19a2
[ "inf = float('inf')\na = [-inf] + arr + [-inf]\nstack = []\nret = 0\nmod = 10 ** 9 + 7\nfor i in range(len(a)):\n while stack and a[stack[-1]] > a[i]:\n j = stack.pop()\n pre_j = stack[-1]\n ret += a[j] * (i - j) * (j - pre_j)\n stack.append(i)\nreturn ret % mod", "lt = [0]\na = [0] + a...
<|body_start_0|> inf = float('inf') a = [-inf] + arr + [-inf] stack = [] ret = 0 mod = 10 ** 9 + 7 for i in range(len(a)): while stack and a[stack[-1]] > a[i]: j = stack.pop() pre_j = stack[-1] ret += a[j] * (i -...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sumSubarrayMins(self, arr): """:type arr: List[int] :rtype: int formula is (i - j) * (j - k) * a[j]. simulate process: add -inf to both end of a -inf, 3, 1, 2, 5, 4, -inf index 0, 1, 2, 3, 4, 5, 6 stack = [0,2,3,5,6] # store index and value of its index are increasing index...
stack_v2_sparse_classes_36k_train_008792
4,605
no_license
[ { "docstring": ":type arr: List[int] :rtype: int formula is (i - j) * (j - k) * a[j]. simulate process: add -inf to both end of a -inf, 3, 1, 2, 5, 4, -inf index 0, 1, 2, 3, 4, 5, 6 stack = [0,2,3,5,6] # store index and value of its index are increasing index 0, val -inf stack: [0] ------- index 1, val 3 stack:...
2
stack_v2_sparse_classes_30k_train_008317
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sumSubarrayMins(self, arr): :type arr: List[int] :rtype: int formula is (i - j) * (j - k) * a[j]. simulate process: add -inf to both end of a -inf, 3, 1, 2, 5, 4, -inf index ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sumSubarrayMins(self, arr): :type arr: List[int] :rtype: int formula is (i - j) * (j - k) * a[j]. simulate process: add -inf to both end of a -inf, 3, 1, 2, 5, 4, -inf index ...
02726da394971ef02616a038dadc126c6ff260de
<|skeleton|> class Solution: def sumSubarrayMins(self, arr): """:type arr: List[int] :rtype: int formula is (i - j) * (j - k) * a[j]. simulate process: add -inf to both end of a -inf, 3, 1, 2, 5, 4, -inf index 0, 1, 2, 3, 4, 5, 6 stack = [0,2,3,5,6] # store index and value of its index are increasing index...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def sumSubarrayMins(self, arr): """:type arr: List[int] :rtype: int formula is (i - j) * (j - k) * a[j]. simulate process: add -inf to both end of a -inf, 3, 1, 2, 5, 4, -inf index 0, 1, 2, 3, 4, 5, 6 stack = [0,2,3,5,6] # store index and value of its index are increasing index 0, val -inf s...
the_stack_v2_python_sparse
subarray/N907_SumofSubarrayMinimums.py
zerghua/leetcode-python
train
2
2c4782d834471e14ae43f7b44749ec4e3854cab1
[ "result = {}\nfor record in self.browse(cr, uid, ids, context):\n codigo_device = ''\n if record.dispositivo_m2o_id != 0:\n codigo_device = str(record.dispositivo_m2o_id.codigo)\n codigo_store = ''\n if record.sucursal_m2o_id != 0:\n codigo_store = str(record.sucursal_m2o_id.codigo)\n n...
<|body_start_0|> result = {} for record in self.browse(cr, uid, ids, context): codigo_device = '' if record.dispositivo_m2o_id != 0: codigo_device = str(record.dispositivo_m2o_id.codigo) codigo_store = '' if record.sucursal_m2o_id != 0: ...
hardware
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class hardware: def _functGetKey(self, cr, uid, ids, name, arg, context={}): """Funcion que obtiene la clave * Para OpenERP [field.function] * Argumentos OpenERP: [cr, uid, ids, name, arg, context] :return dict""" <|body_0|> def onchange_model(self, cr, uid, ids, model): "...
stack_v2_sparse_classes_36k_train_008793
11,110
no_license
[ { "docstring": "Funcion que obtiene la clave * Para OpenERP [field.function] * Argumentos OpenERP: [cr, uid, ids, name, arg, context] :return dict", "name": "_functGetKey", "signature": "def _functGetKey(self, cr, uid, ids, name, arg, context={})" }, { "docstring": "Evento OnChange del campo \"m...
6
stack_v2_sparse_classes_30k_train_008459
Implement the Python class `hardware` described below. Class description: Implement the hardware class. Method signatures and docstrings: - def _functGetKey(self, cr, uid, ids, name, arg, context={}): Funcion que obtiene la clave * Para OpenERP [field.function] * Argumentos OpenERP: [cr, uid, ids, name, arg, context]...
Implement the Python class `hardware` described below. Class description: Implement the hardware class. Method signatures and docstrings: - def _functGetKey(self, cr, uid, ids, name, arg, context={}): Funcion que obtiene la clave * Para OpenERP [field.function] * Argumentos OpenERP: [cr, uid, ids, name, arg, context]...
4d3b5812ed49df8d11a827cf92ba3e102fd8f6e8
<|skeleton|> class hardware: def _functGetKey(self, cr, uid, ids, name, arg, context={}): """Funcion que obtiene la clave * Para OpenERP [field.function] * Argumentos OpenERP: [cr, uid, ids, name, arg, context] :return dict""" <|body_0|> def onchange_model(self, cr, uid, ids, model): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class hardware: def _functGetKey(self, cr, uid, ids, name, arg, context={}): """Funcion que obtiene la clave * Para OpenERP [field.function] * Argumentos OpenERP: [cr, uid, ids, name, arg, context] :return dict""" result = {} for record in self.browse(cr, uid, ids, context): codi...
the_stack_v2_python_sparse
python/alicia/hardware_inventory/secciones/hardware/hardware.py
aliciarom/ITALIS
train
0
a0de415e928a3c4f271ac4937288ce4d351668d6
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn OnenoteSection()", "from .notebook import Notebook\nfrom .onenote_entity_hierarchy_model import OnenoteEntityHierarchyModel\nfrom .onenote_page import OnenotePage\nfrom .section_group import SectionGroup\nfrom .section_links import Sec...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return OnenoteSection() <|end_body_0|> <|body_start_1|> from .notebook import Notebook from .onenote_entity_hierarchy_model import OnenoteEntityHierarchyModel from .onenote_page import ...
OnenoteSection
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OnenoteSection: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OnenoteSection: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Retur...
stack_v2_sparse_classes_36k_train_008794
4,298
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: OnenoteSection", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_valu...
3
stack_v2_sparse_classes_30k_train_002413
Implement the Python class `OnenoteSection` described below. Class description: Implement the OnenoteSection class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OnenoteSection: Creates a new instance of the appropriate class based on discriminator va...
Implement the Python class `OnenoteSection` described below. Class description: Implement the OnenoteSection class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OnenoteSection: Creates a new instance of the appropriate class based on discriminator va...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class OnenoteSection: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OnenoteSection: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Retur...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OnenoteSection: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OnenoteSection: """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: OnenoteSec...
the_stack_v2_python_sparse
msgraph/generated/models/onenote_section.py
microsoftgraph/msgraph-sdk-python
train
135
3fc2a68212dc0d3cd6e8f67e8ce48a396f3c6903
[ "Thread.__init__(self)\nself.router = router\nself.config = config\nself.daemon = True", "logging.info('%sRegister PublicKey ...', LoggerSetup.get_log_deep(1))\nif self.router.node_name == '' or self.router.public_key == '':\n logging.warning(\"%s[!] The PublicKey doesn't exist\", LoggerSetup.get_log_deep(2))\...
<|body_start_0|> Thread.__init__(self) self.router = router self.config = config self.daemon = True <|end_body_0|> <|body_start_1|> logging.info('%sRegister PublicKey ...', LoggerSetup.get_log_deep(1)) if self.router.node_name == '' or self.router.public_key == '': ...
Sends the Public-Key of the Router to a given Email-Address. This is only possible if the key has been read from the wizard-page.
RegisterPublicKey
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegisterPublicKey: """Sends the Public-Key of the Router to a given Email-Address. This is only possible if the key has been read from the wizard-page.""" def __init__(self, router: Router, config): """:param router: Router-object :param config: {node_name, mesh_vpn, limit_bandwidth,...
stack_v2_sparse_classes_36k_train_008795
2,678
no_license
[ { "docstring": ":param router: Router-object :param config: {node_name, mesh_vpn, limit_bandwidth, show_location, latitude, longitude, altitude, contact,...}", "name": "__init__", "signature": "def __init__(self, router: Router, config)" }, { "docstring": "The Public-Key is send with the Router_...
2
null
Implement the Python class `RegisterPublicKey` described below. Class description: Sends the Public-Key of the Router to a given Email-Address. This is only possible if the key has been read from the wizard-page. Method signatures and docstrings: - def __init__(self, router: Router, config): :param router: Router-obj...
Implement the Python class `RegisterPublicKey` described below. Class description: Sends the Public-Key of the Router to a given Email-Address. This is only possible if the key has been read from the wizard-page. Method signatures and docstrings: - def __init__(self, router: Router, config): :param router: Router-obj...
551fb53a6d4f865f076d9485e7290699d988731c
<|skeleton|> class RegisterPublicKey: """Sends the Public-Key of the Router to a given Email-Address. This is only possible if the key has been read from the wizard-page.""" def __init__(self, router: Router, config): """:param router: Router-object :param config: {node_name, mesh_vpn, limit_bandwidth,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegisterPublicKey: """Sends the Public-Key of the Router to a given Email-Address. This is only possible if the key has been read from the wizard-page.""" def __init__(self, router: Router, config): """:param router: Router-object :param config: {node_name, mesh_vpn, limit_bandwidth, show_locatio...
the_stack_v2_python_sparse
util/register_public_key.py
PumucklOnTheAir/TestFramework
train
9
7652bc8c9b4d40ab67a82c9f5a74fb24a749d89e
[ "temple.zhifu = mock.Mock(return_value={'result': 'success', 'reason': 'null'})\nstatues = temple.zhifu_statues()\nprint(statues)\nself.assertEqual(statues, '支付成功')", "temple.zhifu = mock.Mock(return_value={'result': 'fail', 'reason': '余额不足'})\nstatues = temple.zhifu_statues()\nself.assertEqual(statues, '支付失败')" ...
<|body_start_0|> temple.zhifu = mock.Mock(return_value={'result': 'success', 'reason': 'null'}) statues = temple.zhifu_statues() print(statues) self.assertEqual(statues, '支付成功') <|end_body_0|> <|body_start_1|> temple.zhifu = mock.Mock(return_value={'result': 'fail', 'reason': '余...
单元测试用例
Test_zhifu_statues
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_zhifu_statues: """单元测试用例""" def test_01(self): """测试支付成功场景""" <|body_0|> def test_02(self): """测试支付失败场景""" <|body_1|> <|end_skeleton|> <|body_start_0|> temple.zhifu = mock.Mock(return_value={'result': 'success', 'reason': 'null'}) s...
stack_v2_sparse_classes_36k_train_008796
4,862
no_license
[ { "docstring": "测试支付成功场景", "name": "test_01", "signature": "def test_01(self)" }, { "docstring": "测试支付失败场景", "name": "test_02", "signature": "def test_02(self)" } ]
2
stack_v2_sparse_classes_30k_train_019181
Implement the Python class `Test_zhifu_statues` described below. Class description: 单元测试用例 Method signatures and docstrings: - def test_01(self): 测试支付成功场景 - def test_02(self): 测试支付失败场景
Implement the Python class `Test_zhifu_statues` described below. Class description: 单元测试用例 Method signatures and docstrings: - def test_01(self): 测试支付成功场景 - def test_02(self): 测试支付失败场景 <|skeleton|> class Test_zhifu_statues: """单元测试用例""" def test_01(self): """测试支付成功场景""" <|body_0|> def t...
a58fdcc3eb0b52c94e50a110b4f1a053c6fa0ab2
<|skeleton|> class Test_zhifu_statues: """单元测试用例""" def test_01(self): """测试支付成功场景""" <|body_0|> def test_02(self): """测试支付失败场景""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_zhifu_statues: """单元测试用例""" def test_01(self): """测试支付成功场景""" temple.zhifu = mock.Mock(return_value={'result': 'success', 'reason': 'null'}) statues = temple.zhifu_statues() print(statues) self.assertEqual(statues, '支付成功') def test_02(self): """测试...
the_stack_v2_python_sparse
testcase/test_temple.py
yangyilin182/IotInterFace
train
0
c60575f7850c29aca253a93182fae2a80721fc5d
[ "m, n, s = (len(s1), len(s2), len(s3))\nif s != m + n:\n return False\ndp = [[False] * (n + 1) for _ in range(m + 1)]\ndp[0][0] = True\nfor i in range(1, n + 1):\n if s2[i - 1] == s3[i - 1]:\n dp[0][i] = dp[0][i - 1]\nfor i in range(1, m + 1):\n if s1[i - 1] == s3[i - 1]:\n dp[i][0] = dp[i - ...
<|body_start_0|> m, n, s = (len(s1), len(s2), len(s3)) if s != m + n: return False dp = [[False] * (n + 1) for _ in range(m + 1)] dp[0][0] = True for i in range(1, n + 1): if s2[i - 1] == s3[i - 1]: dp[0][i] = dp[0][i - 1] for i in ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isInterleave(self, s1: str, s2: str, s3: str) -> bool: """dp[i][j] 代表 前i个s1,与前j个s2,是否交错组成前i+j个s3 dp[0][0] = True dp[0][j] dp[j][0] dp[i][j] = dp[i-1_最短回文串.py][j] if s1[i-1_最短回文串.py] == s3[i+j-1_最短回文串.py] = dp[i][j-1_最短回文串.py] if s2[j-1_最短回文串.py] == s3[i+j-1_最短回文串.py] = dp[i...
stack_v2_sparse_classes_36k_train_008797
3,374
no_license
[ { "docstring": "dp[i][j] 代表 前i个s1,与前j个s2,是否交错组成前i+j个s3 dp[0][0] = True dp[0][j] dp[j][0] dp[i][j] = dp[i-1_最短回文串.py][j] if s1[i-1_最短回文串.py] == s3[i+j-1_最短回文串.py] = dp[i][j-1_最短回文串.py] if s2[j-1_最短回文串.py] == s3[i+j-1_最短回文串.py] = dp[i-1_最短回文串.py][j] or dp[i][j-1_最短回文串.py] if s2[j-1_最短回文串.py] == s1[i-1_最短回文串.py] =...
2
stack_v2_sparse_classes_30k_train_011785
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isInterleave(self, s1: str, s2: str, s3: str) -> bool: dp[i][j] 代表 前i个s1,与前j个s2,是否交错组成前i+j个s3 dp[0][0] = True dp[0][j] dp[j][0] dp[i][j] = dp[i-1_最短回文串.py][j] if s1[i-1_最短回文串...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isInterleave(self, s1: str, s2: str, s3: str) -> bool: dp[i][j] 代表 前i个s1,与前j个s2,是否交错组成前i+j个s3 dp[0][0] = True dp[0][j] dp[j][0] dp[i][j] = dp[i-1_最短回文串.py][j] if s1[i-1_最短回文串...
57f303aa6e76f7c5292fa60bffdfddcb4ff9ddfb
<|skeleton|> class Solution: def isInterleave(self, s1: str, s2: str, s3: str) -> bool: """dp[i][j] 代表 前i个s1,与前j个s2,是否交错组成前i+j个s3 dp[0][0] = True dp[0][j] dp[j][0] dp[i][j] = dp[i-1_最短回文串.py][j] if s1[i-1_最短回文串.py] == s3[i+j-1_最短回文串.py] = dp[i][j-1_最短回文串.py] if s2[j-1_最短回文串.py] == s3[i+j-1_最短回文串.py] = dp[i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isInterleave(self, s1: str, s2: str, s3: str) -> bool: """dp[i][j] 代表 前i个s1,与前j个s2,是否交错组成前i+j个s3 dp[0][0] = True dp[0][j] dp[j][0] dp[i][j] = dp[i-1_最短回文串.py][j] if s1[i-1_最短回文串.py] == s3[i+j-1_最短回文串.py] = dp[i][j-1_最短回文串.py] if s2[j-1_最短回文串.py] == s3[i+j-1_最短回文串.py] = dp[i-1_最短回文串.py][j...
the_stack_v2_python_sparse
4_LEETCODE/2_DP/字符串匹配问题/97_交错字符串.py
fzingithub/SwordRefers2Offer
train
1
bd242a93830cc0bca3ae42a15ab4dc35501f5228
[ "self.Wh = np.random.normal(size=(i + h, h))\nself.Wy = np.random.normal(size=(h, o))\nself.bh = np.zeros((1, h))\nself.by = np.zeros((1, o))", "h_x = np.concatenate((h_prev.T, x_t.T), axis=0)\nh_next = np.tanh(h_x.T @ self.Wh + self.bh)\ny_pred = h_next @ self.Wy + self.by\nz = y_pred\ny = np.exp(z) / np.sum(np....
<|body_start_0|> self.Wh = np.random.normal(size=(i + h, h)) self.Wy = np.random.normal(size=(h, o)) self.bh = np.zeros((1, h)) self.by = np.zeros((1, o)) <|end_body_0|> <|body_start_1|> h_x = np.concatenate((h_prev.T, x_t.T), axis=0) h_next = np.tanh(h_x.T @ self.Wh + s...
Vanilla model fro a RNN cell
RNNCell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RNNCell: """Vanilla model fro a RNN cell""" def __init__(self, i, h, o): """Initialize class constructor Args: i: dimensionality of the data h: dimensionality of the hidden state o: dimensionality of the outputs""" <|body_0|> def forward(self, h_prev, x_t): """fo...
stack_v2_sparse_classes_36k_train_008798
1,633
no_license
[ { "docstring": "Initialize class constructor Args: i: dimensionality of the data h: dimensionality of the hidden state o: dimensionality of the outputs", "name": "__init__", "signature": "def __init__(self, i, h, o)" }, { "docstring": "forward propagation vanilla RNN cell Args: h_prev: numpy.nda...
2
null
Implement the Python class `RNNCell` described below. Class description: Vanilla model fro a RNN cell Method signatures and docstrings: - def __init__(self, i, h, o): Initialize class constructor Args: i: dimensionality of the data h: dimensionality of the hidden state o: dimensionality of the outputs - def forward(s...
Implement the Python class `RNNCell` described below. Class description: Vanilla model fro a RNN cell Method signatures and docstrings: - def __init__(self, i, h, o): Initialize class constructor Args: i: dimensionality of the data h: dimensionality of the hidden state o: dimensionality of the outputs - def forward(s...
7f9a040f23eda32c5aa154c991c930a01b490f0f
<|skeleton|> class RNNCell: """Vanilla model fro a RNN cell""" def __init__(self, i, h, o): """Initialize class constructor Args: i: dimensionality of the data h: dimensionality of the hidden state o: dimensionality of the outputs""" <|body_0|> def forward(self, h_prev, x_t): """fo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RNNCell: """Vanilla model fro a RNN cell""" def __init__(self, i, h, o): """Initialize class constructor Args: i: dimensionality of the data h: dimensionality of the hidden state o: dimensionality of the outputs""" self.Wh = np.random.normal(size=(i + h, h)) self.Wy = np.random.no...
the_stack_v2_python_sparse
supervised_learning/0x0D-RNNs/0-rnn_cell.py
dbaroli/holbertonschool-machine_learning
train
0
71ac6e9debfe67d31456d98c384332719e0bc816
[ "if additional_help is not None:\n self._help = additional_help\nelse:\n self._help = ''", "width = 80\nlog_message = 'CLI: {}'.format(' '.join(sys.argv))\nlog.log2info(20043, log_message)\nparser = _Parser(description=self._help, formatter_class=argparse.RawTextHelpFormatter)\nsubparsers = parser.add_subpa...
<|body_start_0|> if additional_help is not None: self._help = additional_help else: self._help = '' <|end_body_0|> <|body_start_1|> width = 80 log_message = 'CLI: {}'.format(' '.join(sys.argv)) log.log2info(20043, log_message) parser = _Parser(des...
Class gathers all CLI information.
Parser
[ "GPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Parser: """Class gathers all CLI information.""" def __init__(self, additional_help=None): """Intialize the class.""" <|body_0|> def args(self): """Return all the CLI options. Args: None Returns: _args: Namespace() containing all of our CLI arguments as objects -...
stack_v2_sparse_classes_36k_train_008799
14,703
permissive
[ { "docstring": "Intialize the class.", "name": "__init__", "signature": "def __init__(self, additional_help=None)" }, { "docstring": "Return all the CLI options. Args: None Returns: _args: Namespace() containing all of our CLI arguments as objects - filename: Path to the configuration file", ...
2
stack_v2_sparse_classes_30k_train_008627
Implement the Python class `Parser` described below. Class description: Class gathers all CLI information. Method signatures and docstrings: - def __init__(self, additional_help=None): Intialize the class. - def args(self): Return all the CLI options. Args: None Returns: _args: Namespace() containing all of our CLI a...
Implement the Python class `Parser` described below. Class description: Class gathers all CLI information. Method signatures and docstrings: - def __init__(self, additional_help=None): Intialize the class. - def args(self): Return all the CLI options. Args: None Returns: _args: Namespace() containing all of our CLI a...
57bd3e82e49d51e3426b13ad53ed8326a735ce29
<|skeleton|> class Parser: """Class gathers all CLI information.""" def __init__(self, additional_help=None): """Intialize the class.""" <|body_0|> def args(self): """Return all the CLI options. Args: None Returns: _args: Namespace() containing all of our CLI arguments as objects -...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Parser: """Class gathers all CLI information.""" def __init__(self, additional_help=None): """Intialize the class.""" if additional_help is not None: self._help = additional_help else: self._help = '' def args(self): """Return all the CLI optio...
the_stack_v2_python_sparse
pattoo/cli/cli.py
palisadoes/pattoo
train
0