blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
02b5351fa7c9121cf8ca2b1262c13661041b6bf4
[ "if n == 0:\n return 1.0\nhalf = self.fastpow(x, n / 2)\nif n % 2 == 1:\n return half * half * x\nreturn half * half", "if n < 0:\n n = -n\n x = 1 / x\nreturn self.fastpow(x, n)" ]
<|body_start_0|> if n == 0: return 1.0 half = self.fastpow(x, n / 2) if n % 2 == 1: return half * half * x return half * half <|end_body_0|> <|body_start_1|> if n < 0: n = -n x = 1 / x return self.fastpow(x, n) <|end_body_1...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fastpow(self, x, n): """fast pow""" <|body_0|> def myPow(self, x, n): """:type x: float :type n: int :rtype: float""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n == 0: return 1.0 half = self.fastpow(x, n / 2) ...
stack_v2_sparse_classes_10k_train_004800
780
no_license
[ { "docstring": "fast pow", "name": "fastpow", "signature": "def fastpow(self, x, n)" }, { "docstring": ":type x: float :type n: int :rtype: float", "name": "myPow", "signature": "def myPow(self, x, n)" } ]
2
stack_v2_sparse_classes_30k_train_001062
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fastpow(self, x, n): fast pow - def myPow(self, x, n): :type x: float :type n: int :rtype: float
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fastpow(self, x, n): fast pow - def myPow(self, x, n): :type x: float :type n: int :rtype: float <|skeleton|> class Solution: def fastpow(self, x, n): """fast p...
1a18711fb1ea479fe6fbbe4bd6120950e00ba3ff
<|skeleton|> class Solution: def fastpow(self, x, n): """fast pow""" <|body_0|> def myPow(self, x, n): """:type x: float :type n: int :rtype: float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def fastpow(self, x, n): """fast pow""" if n == 0: return 1.0 half = self.fastpow(x, n / 2) if n % 2 == 1: return half * half * x return half * half def myPow(self, x, n): """:type x: float :type n: int :rtype: float""" ...
the_stack_v2_python_sparse
050.Pow_x_n.py
chaoswork/leetcode
train
0
21a44d601ba534026203509f13c85f04e5ea12ac
[ "super(TabularQAttackerBotAgent, self).__init__(game_config)\nif q_table_path is None:\n raise ValueError('Cannot create a TabularQAttackerBotAgent without specifying the path to the Q-table')\nself.q_table_path = q_table_path\nself.Q = np.load(q_table_path)", "actions = list(range(self.game_config.num_attack_...
<|body_start_0|> super(TabularQAttackerBotAgent, self).__init__(game_config) if q_table_path is None: raise ValueError('Cannot create a TabularQAttackerBotAgent without specifying the path to the Q-table') self.q_table_path = q_table_path self.Q = np.load(q_table_path) <|end_...
Class implementing an attack policy that acts greedily according to a given Q-table
TabularQAttackerBotAgent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TabularQAttackerBotAgent: """Class implementing an attack policy that acts greedily according to a given Q-table""" def __init__(self, game_config: GameConfig, q_table_path: str=None): """Constructor, initializes the policy :param game_config: the game configuration""" <|body...
stack_v2_sparse_classes_10k_train_004801
2,005
permissive
[ { "docstring": "Constructor, initializes the policy :param game_config: the game configuration", "name": "__init__", "signature": "def __init__(self, game_config: GameConfig, q_table_path: str=None)" }, { "docstring": "Samples an action from the policy. :param game_state: the game state :return:...
2
stack_v2_sparse_classes_30k_train_002898
Implement the Python class `TabularQAttackerBotAgent` described below. Class description: Class implementing an attack policy that acts greedily according to a given Q-table Method signatures and docstrings: - def __init__(self, game_config: GameConfig, q_table_path: str=None): Constructor, initializes the policy :pa...
Implement the Python class `TabularQAttackerBotAgent` described below. Class description: Class implementing an attack policy that acts greedily according to a given Q-table Method signatures and docstrings: - def __init__(self, game_config: GameConfig, q_table_path: str=None): Constructor, initializes the policy :pa...
d10830fef55308d383c98b41b34688a7fceae357
<|skeleton|> class TabularQAttackerBotAgent: """Class implementing an attack policy that acts greedily according to a given Q-table""" def __init__(self, game_config: GameConfig, q_table_path: str=None): """Constructor, initializes the policy :param game_config: the game configuration""" <|body...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TabularQAttackerBotAgent: """Class implementing an attack policy that acts greedily according to a given Q-table""" def __init__(self, game_config: GameConfig, q_table_path: str=None): """Constructor, initializes the policy :param game_config: the game configuration""" super(TabularQAttac...
the_stack_v2_python_sparse
gym_idsgame/agents/training_agents/q_learning/tabular_q_learning/tabular_q_attacker_bot_agent.py
Limmen/gym-idsgame
train
49
513ea499400c794ef129c0c55c0ae56be6f90b5c
[ "self.login.login(username, password)\nsleep(5)\nself.driver.assert_in(u'人员调度1111', u'人员调度')", "self.login.login(username, password)\nsleep(2)\nself.driver.assert_true(self.login.login_errorinfo_text(wrong_msg))", "self.login.input_login_username(username)\nsleep(1)\nself.login.input_login_password(password)\ns...
<|body_start_0|> self.login.login(username, password) sleep(5) self.driver.assert_in(u'人员调度1111', u'人员调度') <|end_body_0|> <|body_start_1|> self.login.login(username, password) sleep(2) self.driver.assert_true(self.login.login_errorinfo_text(wrong_msg)) <|end_body_1|> <|...
PoliceVP登录测试
WTestLogin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WTestLogin: """PoliceVP登录测试""" def test_login01(self, username, password): """正确登录,弹出首页""" <|body_0|> def test_login02(self, username, password, wrong_msg): """错误登录,有提示信息""" <|body_1|> def test_login03(self, username, password, button_attribute, butt...
stack_v2_sparse_classes_10k_train_004802
5,242
no_license
[ { "docstring": "正确登录,弹出首页", "name": "test_login01", "signature": "def test_login01(self, username, password)" }, { "docstring": "错误登录,有提示信息", "name": "test_login02", "signature": "def test_login02(self, username, password, wrong_msg)" }, { "docstring": "用户名或密码小于6位,登录按钮置灰", "n...
5
stack_v2_sparse_classes_30k_train_004711
Implement the Python class `WTestLogin` described below. Class description: PoliceVP登录测试 Method signatures and docstrings: - def test_login01(self, username, password): 正确登录,弹出首页 - def test_login02(self, username, password, wrong_msg): 错误登录,有提示信息 - def test_login03(self, username, password, button_attribute, button_a...
Implement the Python class `WTestLogin` described below. Class description: PoliceVP登录测试 Method signatures and docstrings: - def test_login01(self, username, password): 正确登录,弹出首页 - def test_login02(self, username, password, wrong_msg): 错误登录,有提示信息 - def test_login03(self, username, password, button_attribute, button_a...
d0b0f5d59f5d94e12ed138456a927047b7e55d96
<|skeleton|> class WTestLogin: """PoliceVP登录测试""" def test_login01(self, username, password): """正确登录,弹出首页""" <|body_0|> def test_login02(self, username, password, wrong_msg): """错误登录,有提示信息""" <|body_1|> def test_login03(self, username, password, button_attribute, butt...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WTestLogin: """PoliceVP登录测试""" def test_login01(self, username, password): """正确登录,弹出首页""" self.login.login(username, password) sleep(5) self.driver.assert_in(u'人员调度1111', u'人员调度') def test_login02(self, username, password, wrong_msg): """错误登录,有提示信息""" ...
the_stack_v2_python_sparse
project/web_project/login_test.py
zyt19910214/Studys
train
0
8a6e20db19a023b4c3e5697f6d101fafbecd1373
[ "instance_id = self.get_current_instance_id()\nvm = self.get_current_machine()\nfor lb in self.lbs:\n match = self.match_load_balancer_and_vm(lb, vm)\n if not match:\n self.record(lb.name, instance_id, RegistrationAction.REGISTER, [RegistrationActionReason.NOT_YET_REGISTERED])\n if not self.add_...
<|body_start_0|> instance_id = self.get_current_instance_id() vm = self.get_current_machine() for lb in self.lbs: match = self.match_load_balancer_and_vm(lb, vm) if not match: self.record(lb.name, instance_id, RegistrationAction.REGISTER, [RegistrationActi...
Registerer that adds and removes current machine from configured ELBs.
AzureLbSelfRegisterer
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AzureLbSelfRegisterer: """Registerer that adds and removes current machine from configured ELBs.""" def add(self): """Add the current instance to all configured LBs. Assumes that this code is running on an Azure instance.""" <|body_0|> def remove(self): """Remove...
stack_v2_sparse_classes_10k_train_004803
16,722
permissive
[ { "docstring": "Add the current instance to all configured LBs. Assumes that this code is running on an Azure instance.", "name": "add", "signature": "def add(self)" }, { "docstring": "Remove the current instance from all configured LBs. Assumes that this code is running on an Azure instance.", ...
2
stack_v2_sparse_classes_30k_train_006634
Implement the Python class `AzureLbSelfRegisterer` described below. Class description: Registerer that adds and removes current machine from configured ELBs. Method signatures and docstrings: - def add(self): Add the current instance to all configured LBs. Assumes that this code is running on an Azure instance. - def...
Implement the Python class `AzureLbSelfRegisterer` described below. Class description: Registerer that adds and removes current machine from configured ELBs. Method signatures and docstrings: - def add(self): Add the current instance to all configured LBs. Assumes that this code is running on an Azure instance. - def...
73a1e7086cc4dd171456f50724246a9261febaf8
<|skeleton|> class AzureLbSelfRegisterer: """Registerer that adds and removes current machine from configured ELBs.""" def add(self): """Add the current instance to all configured LBs. Assumes that this code is running on an Azure instance.""" <|body_0|> def remove(self): """Remove...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AzureLbSelfRegisterer: """Registerer that adds and removes current machine from configured ELBs.""" def add(self): """Add the current instance to all configured LBs. Assumes that this code is running on an Azure instance.""" instance_id = self.get_current_instance_id() vm = self.g...
the_stack_v2_python_sparse
tellapart/aurproxy/register/azurelb.py
aurora-scheduler/aurproxy
train
1
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_10k_train_004804
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_005832
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_10k
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
ca12abef2b82c34bef6c15b6bf77f568ac0aa3bf
[ "self.condition_tissue = ConditionTissue.query.filter(ConditionTissue.in_tree == 1).all()\nmerged_conditions = list(merge(*[json.loads(ct.data)['order'] for ct in self.condition_tissue]))\nself.conditions = list(reversed(list(OrderedDict.fromkeys(reversed(merged_conditions)))))\nself.species_to_condition = {ct.spec...
<|body_start_0|> self.condition_tissue = ConditionTissue.query.filter(ConditionTissue.in_tree == 1).all() merged_conditions = list(merge(*[json.loads(ct.data)['order'] for ct in self.condition_tissue])) self.conditions = list(reversed(list(OrderedDict.fromkeys(reversed(merged_conditions))))) ...
CrossSpeciesExpressionProfile
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CrossSpeciesExpressionProfile: def __init__(self): """Function that gets required data, checks for which species there is a comparative profile available and stores details to convert the profiles for that species.""" <|body_0|> def get_data(self, *sequence_ids): """...
stack_v2_sparse_classes_10k_train_004805
5,795
permissive
[ { "docstring": "Function that gets required data, checks for which species there is a comparative profile available and stores details to convert the profiles for that species.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Gets comparative profiles for a set of seque...
3
stack_v2_sparse_classes_30k_train_002592
Implement the Python class `CrossSpeciesExpressionProfile` described below. Class description: Implement the CrossSpeciesExpressionProfile class. Method signatures and docstrings: - def __init__(self): Function that gets required data, checks for which species there is a comparative profile available and stores detai...
Implement the Python class `CrossSpeciesExpressionProfile` described below. Class description: Implement the CrossSpeciesExpressionProfile class. Method signatures and docstrings: - def __init__(self): Function that gets required data, checks for which species there is a comparative profile available and stores detai...
25d0187030bcb85bb99125af4fd0c0c11aa012cb
<|skeleton|> class CrossSpeciesExpressionProfile: def __init__(self): """Function that gets required data, checks for which species there is a comparative profile available and stores details to convert the profiles for that species.""" <|body_0|> def get_data(self, *sequence_ids): """...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CrossSpeciesExpressionProfile: def __init__(self): """Function that gets required data, checks for which species there is a comparative profile available and stores details to convert the profiles for that species.""" self.condition_tissue = ConditionTissue.query.filter(ConditionTissue.in_tree...
the_stack_v2_python_sparse
conekt/models/expression/cross_species_profile.py
sepro/CoNekT
train
23
127b536d18395e0b543d55cd05265cf700cf6b83
[ "ENFORCER.enforce_call(action='identity:check_grant', build_target=functools.partial(_build_enforcement_target_attr, domain_id=domain_id, group_id=group_id, role_id=role_id))\nPROVIDERS.assignment_api.get_grant(domain_id=domain_id, group_id=group_id, role_id=role_id, inherited_to_projects=True)\nreturn (None, http_...
<|body_start_0|> ENFORCER.enforce_call(action='identity:check_grant', build_target=functools.partial(_build_enforcement_target_attr, domain_id=domain_id, group_id=group_id, role_id=role_id)) PROVIDERS.assignment_api.get_grant(domain_id=domain_id, group_id=group_id, role_id=role_id, inherited_to_projects...
OSInheritDomainGroupRolesResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OSInheritDomainGroupRolesResource: def get(self, domain_id, group_id, role_id): """Check for an inherited grant for a group on a domain. GET/HEAD /OS-INHERIT/domains/{domain_id}/groups/{group_id} /roles/{role_id}/inherited_to_projects""" <|body_0|> def put(self, domain_id, g...
stack_v2_sparse_classes_10k_train_004806
19,022
permissive
[ { "docstring": "Check for an inherited grant for a group on a domain. GET/HEAD /OS-INHERIT/domains/{domain_id}/groups/{group_id} /roles/{role_id}/inherited_to_projects", "name": "get", "signature": "def get(self, domain_id, group_id, role_id)" }, { "docstring": "Create an inherited grant for a g...
3
stack_v2_sparse_classes_30k_train_005331
Implement the Python class `OSInheritDomainGroupRolesResource` described below. Class description: Implement the OSInheritDomainGroupRolesResource class. Method signatures and docstrings: - def get(self, domain_id, group_id, role_id): Check for an inherited grant for a group on a domain. GET/HEAD /OS-INHERIT/domains/...
Implement the Python class `OSInheritDomainGroupRolesResource` described below. Class description: Implement the OSInheritDomainGroupRolesResource class. Method signatures and docstrings: - def get(self, domain_id, group_id, role_id): Check for an inherited grant for a group on a domain. GET/HEAD /OS-INHERIT/domains/...
03a0a8146a78682ede9eca12a5a7fdacde2035c8
<|skeleton|> class OSInheritDomainGroupRolesResource: def get(self, domain_id, group_id, role_id): """Check for an inherited grant for a group on a domain. GET/HEAD /OS-INHERIT/domains/{domain_id}/groups/{group_id} /roles/{role_id}/inherited_to_projects""" <|body_0|> def put(self, domain_id, g...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OSInheritDomainGroupRolesResource: def get(self, domain_id, group_id, role_id): """Check for an inherited grant for a group on a domain. GET/HEAD /OS-INHERIT/domains/{domain_id}/groups/{group_id} /roles/{role_id}/inherited_to_projects""" ENFORCER.enforce_call(action='identity:check_grant', bui...
the_stack_v2_python_sparse
keystone/api/os_inherit.py
sapcc/keystone
train
0
926d3a73aacb66b53a1851730cb63376c0a60563
[ "res = []\nself.dfs(candidates, target, 0, [], res)\nreturn res", "if target < 0:\n return\nif target == 0:\n res.append(path)\n return\nfor i in range(index, len(nums)):\n self.dfs(nums, target - nums[i], i, path + [nums[i]], res)" ]
<|body_start_0|> res = [] self.dfs(candidates, target, 0, [], res) return res <|end_body_0|> <|body_start_1|> if target < 0: return if target == 0: res.append(path) return for i in range(index, len(nums)): self.dfs(nums, ta...
Runtime: 96 ms, faster than 52.91% of Python3 online submissions for Combination Sum. Memory Usage: 13.1 MB, less than 5.14% of Python3 online submissions for Combination Sum.
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Runtime: 96 ms, faster than 52.91% of Python3 online submissions for Combination Sum. Memory Usage: 13.1 MB, less than 5.14% of Python3 online submissions for Combination Sum.""" def combinationSum(self, candidates, target): """Given a set of candidate numbers (candidate...
stack_v2_sparse_classes_10k_train_004807
2,337
no_license
[ { "docstring": "Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target. The same repeated number may be chosen from candidates unlimited number of times. Note: All numbers (including t...
2
null
Implement the Python class `Solution` described below. Class description: Runtime: 96 ms, faster than 52.91% of Python3 online submissions for Combination Sum. Memory Usage: 13.1 MB, less than 5.14% of Python3 online submissions for Combination Sum. Method signatures and docstrings: - def combinationSum(self, candida...
Implement the Python class `Solution` described below. Class description: Runtime: 96 ms, faster than 52.91% of Python3 online submissions for Combination Sum. Memory Usage: 13.1 MB, less than 5.14% of Python3 online submissions for Combination Sum. Method signatures and docstrings: - def combinationSum(self, candida...
01fe893ba2e37c9bda79e3081c556698f0b6d2f0
<|skeleton|> class Solution: """Runtime: 96 ms, faster than 52.91% of Python3 online submissions for Combination Sum. Memory Usage: 13.1 MB, less than 5.14% of Python3 online submissions for Combination Sum.""" def combinationSum(self, candidates, target): """Given a set of candidate numbers (candidate...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: """Runtime: 96 ms, faster than 52.91% of Python3 online submissions for Combination Sum. Memory Usage: 13.1 MB, less than 5.14% of Python3 online submissions for Combination Sum.""" def combinationSum(self, candidates, target): """Given a set of candidate numbers (candidates) (without d...
the_stack_v2_python_sparse
LeetCode/39_combination_sum.py
KKosukeee/CodingQuestions
train
1
e4d01b0e01d0c69f5a144e96a45c09824890e48d
[ "if not envelopes:\n return 0\nenvelopes = sorted(envelopes, key=lambda x: (x[0], -x[1]))\nenvelopes_height = [x[1] for x in envelopes]\nreturn self.LIS(envelopes_height)", "def binary_search(l, r, nums, target):\n while r - l > 1:\n m = l + (r - l) // 2\n if nums[m] >= target:\n r ...
<|body_start_0|> if not envelopes: return 0 envelopes = sorted(envelopes, key=lambda x: (x[0], -x[1])) envelopes_height = [x[1] for x in envelopes] return self.LIS(envelopes_height) <|end_body_0|> <|body_start_1|> def binary_search(l, r, nums, target): wh...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxEnvelopes(self, envelopes): """:type envelopes: List[List[int]] :rtype: int""" <|body_0|> def LIS(self, nums): """Longest increasing sequences""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not envelopes: return 0 ...
stack_v2_sparse_classes_10k_train_004808
2,063
no_license
[ { "docstring": ":type envelopes: List[List[int]] :rtype: int", "name": "maxEnvelopes", "signature": "def maxEnvelopes(self, envelopes)" }, { "docstring": "Longest increasing sequences", "name": "LIS", "signature": "def LIS(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_006068
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxEnvelopes(self, envelopes): :type envelopes: List[List[int]] :rtype: int - def LIS(self, nums): Longest increasing sequences
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxEnvelopes(self, envelopes): :type envelopes: List[List[int]] :rtype: int - def LIS(self, nums): Longest increasing sequences <|skeleton|> class Solution: def maxEnve...
4de7d3ea9aaa2e0cb2d934816036ced2357205ac
<|skeleton|> class Solution: def maxEnvelopes(self, envelopes): """:type envelopes: List[List[int]] :rtype: int""" <|body_0|> def LIS(self, nums): """Longest increasing sequences""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxEnvelopes(self, envelopes): """:type envelopes: List[List[int]] :rtype: int""" if not envelopes: return 0 envelopes = sorted(envelopes, key=lambda x: (x[0], -x[1])) envelopes_height = [x[1] for x in envelopes] return self.LIS(envelopes_heigh...
the_stack_v2_python_sparse
354_russian_doll_envelopes.py
nshung2010/leet_code
train
0
90f8cdfe86610dee7bfa2914e5a9744d2505d6cf
[ "from h2o.expr import ExprNode\nresult = ExprNode('tree.update.weights', self, frame, weights_column)._eval_driver('scalar')._cache._data\nif result != 'OK':\n warn(result)", "from h2o.expr import ExprNode\nresult = ExprNode('set.calibration.model', self, calibration_model)._eval_driver('scalar')._cache._data\...
<|body_start_0|> from h2o.expr import ExprNode result = ExprNode('tree.update.weights', self, frame, weights_column)._eval_driver('scalar')._cache._data if result != 'OK': warn(result) <|end_body_0|> <|body_start_1|> from h2o.expr import ExprNode result = ExprNode('s...
SupervisedTrees
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SupervisedTrees: def _update_tree_weights(self, frame, weights_column): """Re-calculates tree-node weights based on provided dataset. Modifying node weights will affect how contribution predictions (Shapley values) are calculated. This can be used to explain the model on a curated sub-po...
stack_v2_sparse_classes_10k_train_004809
2,355
permissive
[ { "docstring": "Re-calculates tree-node weights based on provided dataset. Modifying node weights will affect how contribution predictions (Shapley values) are calculated. This can be used to explain the model on a curated sub-population of the training dataset. :param frame: frame that will be used to re-popul...
2
null
Implement the Python class `SupervisedTrees` described below. Class description: Implement the SupervisedTrees class. Method signatures and docstrings: - def _update_tree_weights(self, frame, weights_column): Re-calculates tree-node weights based on provided dataset. Modifying node weights will affect how contributio...
Implement the Python class `SupervisedTrees` described below. Class description: Implement the SupervisedTrees class. Method signatures and docstrings: - def _update_tree_weights(self, frame, weights_column): Re-calculates tree-node weights based on provided dataset. Modifying node weights will affect how contributio...
d817ab90c8c47f6787604a0b9639b66234158228
<|skeleton|> class SupervisedTrees: def _update_tree_weights(self, frame, weights_column): """Re-calculates tree-node weights based on provided dataset. Modifying node weights will affect how contribution predictions (Shapley values) are calculated. This can be used to explain the model on a curated sub-po...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SupervisedTrees: def _update_tree_weights(self, frame, weights_column): """Re-calculates tree-node weights based on provided dataset. Modifying node weights will affect how contribution predictions (Shapley values) are calculated. This can be used to explain the model on a curated sub-population of th...
the_stack_v2_python_sparse
h2o-py/h2o/model/extensions/supervised_trees.py
h2oai/h2o-3
train
6,872
c63ea35c319f69c8a17c262c620a9577e8fb7188
[ "wx.Dialog.__init__(self, None, title='Login')\nself.logged_in = False\nuser_sizer = wx.BoxSizer(wx.HORIZONTAL)\nuser_lbl = wx.StaticText(self, label='Username:')\nuser_sizer.Add(user_lbl, 0, wx.ALL | wx.CENTER, 5)\nself.user = wx.TextCtrl(self)\nuser_sizer.Add(self.user, 0, wx.ALL, 5)\np_sizer = wx.BoxSizer(wx.HOR...
<|body_start_0|> wx.Dialog.__init__(self, None, title='Login') self.logged_in = False user_sizer = wx.BoxSizer(wx.HORIZONTAL) user_lbl = wx.StaticText(self, label='Username:') user_sizer.Add(user_lbl, 0, wx.ALL | wx.CENTER, 5) self.user = wx.TextCtrl(self) user_si...
Class to define login dialog
LoginDialog
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginDialog: """Class to define login dialog""" def __init__(self): """Constructor""" <|body_0|> def onLogin(self, event): """Check credentials and login""" <|body_1|> <|end_skeleton|> <|body_start_0|> wx.Dialog.__init__(self, None, title='Login...
stack_v2_sparse_classes_10k_train_004810
2,868
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Check credentials and login", "name": "onLogin", "signature": "def onLogin(self, event)" } ]
2
stack_v2_sparse_classes_30k_train_005358
Implement the Python class `LoginDialog` described below. Class description: Class to define login dialog Method signatures and docstrings: - def __init__(self): Constructor - def onLogin(self, event): Check credentials and login
Implement the Python class `LoginDialog` described below. Class description: Class to define login dialog Method signatures and docstrings: - def __init__(self): Constructor - def onLogin(self, event): Check credentials and login <|skeleton|> class LoginDialog: """Class to define login dialog""" def __init_...
b723ca7a0668bd758d629c5d19f5b1d17778088f
<|skeleton|> class LoginDialog: """Class to define login dialog""" def __init__(self): """Constructor""" <|body_0|> def onLogin(self, event): """Check credentials and login""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LoginDialog: """Class to define login dialog""" def __init__(self): """Constructor""" wx.Dialog.__init__(self, None, title='Login') self.logged_in = False user_sizer = wx.BoxSizer(wx.HORIZONTAL) user_lbl = wx.StaticText(self, label='Username:') user_sizer.A...
the_stack_v2_python_sparse
Programming Foundations with Python/src/cn/careerwinner/sap/loginPY.py
BlessedAndy/Programming-Foundations-with-Python
train
1
0bb08454bae8a940362ff26669f559e5697bb62d
[ "headers = super().request_headers(stream_state, **kwargs)\nheaders.update({'X-RestLi-Protocol-Version': '2.0.0'} if self.accounts else {})\nreturn headers", "params = super().request_params(stream_state, stream_slice, next_page_token)\nif self.accounts:\n params['search'] = f'(id:(values:List({self.accounts})...
<|body_start_0|> headers = super().request_headers(stream_state, **kwargs) headers.update({'X-RestLi-Protocol-Version': '2.0.0'} if self.accounts else {}) return headers <|end_body_0|> <|body_start_1|> params = super().request_params(stream_state, stream_slice, next_page_token) ...
Get Accounts data. More info about LinkedIn Ads / Accounts: https://learn.microsoft.com/en-us/linkedin/marketing/integrations/ads/account-structure/create-and-manage-accounts?tabs=http&view=li-lms-2023-05#search-for-accounts
Accounts
[ "MIT", "LicenseRef-scancode-free-unknown", "Elastic-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Accounts: """Get Accounts data. More info about LinkedIn Ads / Accounts: https://learn.microsoft.com/en-us/linkedin/marketing/integrations/ads/account-structure/create-and-manage-accounts?tabs=http&view=li-lms-2023-05#search-for-accounts""" def request_headers(self, stream_state: Mapping[str...
stack_v2_sparse_classes_10k_train_004811
22,426
permissive
[ { "docstring": "If account_ids are specified as user's input from configuration, we must use MODIFIED header: {'X-RestLi-Protocol-Version': '2.0.0'}", "name": "request_headers", "signature": "def request_headers(self, stream_state: Mapping[str, Any], **kwargs) -> Mapping[str, Any]" }, { "docstri...
2
null
Implement the Python class `Accounts` described below. Class description: Get Accounts data. More info about LinkedIn Ads / Accounts: https://learn.microsoft.com/en-us/linkedin/marketing/integrations/ads/account-structure/create-and-manage-accounts?tabs=http&view=li-lms-2023-05#search-for-accounts Method signatures a...
Implement the Python class `Accounts` described below. Class description: Get Accounts data. More info about LinkedIn Ads / Accounts: https://learn.microsoft.com/en-us/linkedin/marketing/integrations/ads/account-structure/create-and-manage-accounts?tabs=http&view=li-lms-2023-05#search-for-accounts Method signatures a...
258a8eb683634a9f9b7821c9a92d1b70c5389a10
<|skeleton|> class Accounts: """Get Accounts data. More info about LinkedIn Ads / Accounts: https://learn.microsoft.com/en-us/linkedin/marketing/integrations/ads/account-structure/create-and-manage-accounts?tabs=http&view=li-lms-2023-05#search-for-accounts""" def request_headers(self, stream_state: Mapping[str...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Accounts: """Get Accounts data. More info about LinkedIn Ads / Accounts: https://learn.microsoft.com/en-us/linkedin/marketing/integrations/ads/account-structure/create-and-manage-accounts?tabs=http&view=li-lms-2023-05#search-for-accounts""" def request_headers(self, stream_state: Mapping[str, Any], **kwa...
the_stack_v2_python_sparse
airbyte-integrations/connectors/source-linkedin-ads/source_linkedin_ads/streams.py
thomas-vl/airbyte
train
1
0505504dbb08a78ebc45dc0936873653dadc00db
[ "aspect = Aspect.query.get(aspect_id)\nif aspect is None:\n return abort(HTTPStatus.NOT_FOUND, message='Aspect is not found')\nif aspect.image_path is None:\n return abort(HTTPStatus.NOT_FOUND, 'Aspect image is not found')\nreturn file_storage.download(file_storage.FileCategory.AspectImage, aspect.image_path)...
<|body_start_0|> aspect = Aspect.query.get(aspect_id) if aspect is None: return abort(HTTPStatus.NOT_FOUND, message='Aspect is not found') if aspect.image_path is None: return abort(HTTPStatus.NOT_FOUND, 'Aspect image is not found') return file_storage.download(fi...
AspectImageResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AspectImageResource: def get(self, aspect_id): """Get aspect image""" <|body_0|> def put(self, aspect_id): """Replace aspect image * User can set the aspect image **if it does not exists**. This is done to set the image after creating the aspect * User with permissio...
stack_v2_sparse_classes_10k_train_004812
2,266
permissive
[ { "docstring": "Get aspect image", "name": "get", "signature": "def get(self, aspect_id)" }, { "docstring": "Replace aspect image * User can set the aspect image **if it does not exists**. This is done to set the image after creating the aspect * User with permission to **\"edit aspects\"** can ...
2
stack_v2_sparse_classes_30k_train_005011
Implement the Python class `AspectImageResource` described below. Class description: Implement the AspectImageResource class. Method signatures and docstrings: - def get(self, aspect_id): Get aspect image - def put(self, aspect_id): Replace aspect image * User can set the aspect image **if it does not exists**. This ...
Implement the Python class `AspectImageResource` described below. Class description: Implement the AspectImageResource class. Method signatures and docstrings: - def get(self, aspect_id): Get aspect image - def put(self, aspect_id): Replace aspect image * User can set the aspect image **if it does not exists**. This ...
dce87ffe395ae4bd08b47f28e07594e1889da819
<|skeleton|> class AspectImageResource: def get(self, aspect_id): """Get aspect image""" <|body_0|> def put(self, aspect_id): """Replace aspect image * User can set the aspect image **if it does not exists**. This is done to set the image after creating the aspect * User with permissio...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AspectImageResource: def get(self, aspect_id): """Get aspect image""" aspect = Aspect.query.get(aspect_id) if aspect is None: return abort(HTTPStatus.NOT_FOUND, message='Aspect is not found') if aspect.image_path is None: return abort(HTTPStatus.NOT_FOUN...
the_stack_v2_python_sparse
src/backend/app/api/public/aspects/aspect/aspect_image.py
aimanow/sft
train
0
a661bd2bb893b8243363024ff444a2e2514b8755
[ "validator = UserCreateSchema()\ntry:\n loaded_data = validator.load(data)\nexcept ValidationError as error:\n raise UserControllerException(error.messages)\nloaded_data['password'] = hashpw(loaded_data['password'].encode('utf8'), gensalt())\nloaded_data.pop('confirm_password')\nuser = User(public_id=str(uuid...
<|body_start_0|> validator = UserCreateSchema() try: loaded_data = validator.load(data) except ValidationError as error: raise UserControllerException(error.messages) loaded_data['password'] = hashpw(loaded_data['password'].encode('utf8'), gensalt()) loade...
Controller class for user related data manipulations.
UserController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserController: """Controller class for user related data manipulations.""" def create_user(self, data): """Creates a new user record in the database. Raises: - UserControllerError: if validation fails; if is unable to save the new record into the database due to an integrity error. ...
stack_v2_sparse_classes_10k_train_004813
3,200
no_license
[ { "docstring": "Creates a new user record in the database. Raises: - UserControllerError: if validation fails; if is unable to save the new record into the database due to an integrity error. Args: - data (dict): Map of user data to be validated and further processed as a User instance. Returns: - user (app.mod...
3
stack_v2_sparse_classes_30k_train_000476
Implement the Python class `UserController` described below. Class description: Controller class for user related data manipulations. Method signatures and docstrings: - def create_user(self, data): Creates a new user record in the database. Raises: - UserControllerError: if validation fails; if is unable to save the...
Implement the Python class `UserController` described below. Class description: Controller class for user related data manipulations. Method signatures and docstrings: - def create_user(self, data): Creates a new user record in the database. Raises: - UserControllerError: if validation fails; if is unable to save the...
fc16ecc301c38271767f5a581d917ec6196ff14a
<|skeleton|> class UserController: """Controller class for user related data manipulations.""" def create_user(self, data): """Creates a new user record in the database. Raises: - UserControllerError: if validation fails; if is unable to save the new record into the database due to an integrity error. ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserController: """Controller class for user related data manipulations.""" def create_user(self, data): """Creates a new user record in the database. Raises: - UserControllerError: if validation fails; if is unable to save the new record into the database due to an integrity error. Args: - data ...
the_stack_v2_python_sparse
app/controllers/user.py
rqroz/obd-dashboard
train
3
0a39d7e8fe212f64f06a1c50090714b50567b231
[ "if not root:\n return\nself.recoverTree(root.left)\nif self.lastVisited > root.val:\n if not self.firstMisplaced:\n self.firstMisplaced = root\n else:\n self.secondMisplaced = root\nself.lastVisited = root.val\nself.recoverTree(root.right)\nif self.firstMisplaced and self.secondMisplaced:\n ...
<|body_start_0|> if not root: return self.recoverTree(root.left) if self.lastVisited > root.val: if not self.firstMisplaced: self.firstMisplaced = root else: self.secondMisplaced = root self.lastVisited = root.val ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def recoverTree(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" <|body_0|> def recoverTree(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" ...
stack_v2_sparse_classes_10k_train_004814
2,119
no_license
[ { "docstring": ":type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.", "name": "recoverTree", "signature": "def recoverTree(self, root)" }, { "docstring": ":type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.", "name": "re...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def recoverTree(self, root): :type root: TreeNode :rtype: void Do not return anything, modify root in-place instead. - def recoverTree(self, root): :type root: TreeNode :rtype: v...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def recoverTree(self, root): :type root: TreeNode :rtype: void Do not return anything, modify root in-place instead. - def recoverTree(self, root): :type root: TreeNode :rtype: v...
d953abe2c9680f636563e76287d2f907e90ced63
<|skeleton|> class Solution: def recoverTree(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" <|body_0|> def recoverTree(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def recoverTree(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" if not root: return self.recoverTree(root.left) if self.lastVisited > root.val: if not self.firstMisplaced: ...
the_stack_v2_python_sparse
Python_leetcode/99_recover_binary_search_tree.py
xiangcao/Leetcode
train
0
73bb953dbd54108ddd2616a4f9d8bbe940097fe9
[ "super().__init__()\nself.length = length\nself.k0 = k0\nself.use_pi = use_pi\nself.use_input = use_input", "batch_shape = inputs.shape[:-1]\nnum_inputs = inputs.shape[-1]\ninputs = inputs.view(-1, 1, num_inputs)\nfactors = (2.0 ** torch.arange(self.k0, self.k0 + self.length).float().cuda()).view(1, -1, 1)\nif se...
<|body_start_0|> super().__init__() self.length = length self.k0 = k0 self.use_pi = use_pi self.use_input = use_input <|end_body_0|> <|body_start_1|> batch_shape = inputs.shape[:-1] num_inputs = inputs.shape[-1] inputs = inputs.view(-1, 1, num_inputs) ...
Fourier positional embedding. Emb(x) = [sin(2^k Pi x), cos(2^k Pi x), sin(2^(k+1) Pi x), cos(2^(k+1) Pi x), ..., sin(2^(k+L-1) Pi x), cos(2^(k+L-1) Pi x)], where x is the input tensor.
FourierEmbedding
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FourierEmbedding: """Fourier positional embedding. Emb(x) = [sin(2^k Pi x), cos(2^k Pi x), sin(2^(k+1) Pi x), cos(2^(k+1) Pi x), ..., sin(2^(k+L-1) Pi x), cos(2^(k+L-1) Pi x)], where x is the input tensor.""" def __init__(self, length: int, k0: float=0.0, use_pi: bool=True, use_input: bool=F...
stack_v2_sparse_classes_10k_train_004815
4,949
permissive
[ { "docstring": "Initialize a Fourier embedding function. Args: length (float): the length of the embedding. k0 (float): the starting exponential of the embedding. Default: 0. use_pi (bool): if True, use pi in the embedding. Default: True. use_input (bool): if True, return the input vector in the embedding. Defa...
2
stack_v2_sparse_classes_30k_train_001719
Implement the Python class `FourierEmbedding` described below. Class description: Fourier positional embedding. Emb(x) = [sin(2^k Pi x), cos(2^k Pi x), sin(2^(k+1) Pi x), cos(2^(k+1) Pi x), ..., sin(2^(k+L-1) Pi x), cos(2^(k+L-1) Pi x)], where x is the input tensor. Method signatures and docstrings: - def __init__(se...
Implement the Python class `FourierEmbedding` described below. Class description: Fourier positional embedding. Emb(x) = [sin(2^k Pi x), cos(2^k Pi x), sin(2^(k+1) Pi x), cos(2^(k+1) Pi x), ..., sin(2^(k+L-1) Pi x), cos(2^(k+L-1) Pi x)], where x is the input tensor. Method signatures and docstrings: - def __init__(se...
29c1c02134c20a14337458d18826e4a6f80e844e
<|skeleton|> class FourierEmbedding: """Fourier positional embedding. Emb(x) = [sin(2^k Pi x), cos(2^k Pi x), sin(2^(k+1) Pi x), cos(2^(k+1) Pi x), ..., sin(2^(k+L-1) Pi x), cos(2^(k+L-1) Pi x)], where x is the input tensor.""" def __init__(self, length: int, k0: float=0.0, use_pi: bool=True, use_input: bool=F...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FourierEmbedding: """Fourier positional embedding. Emb(x) = [sin(2^k Pi x), cos(2^k Pi x), sin(2^(k+1) Pi x), cos(2^(k+1) Pi x), ..., sin(2^(k+L-1) Pi x), cos(2^(k+L-1) Pi x)], where x is the input tensor.""" def __init__(self, length: int, k0: float=0.0, use_pi: bool=True, use_input: bool=False) -> None...
the_stack_v2_python_sparse
vision3d/layers/embedding.py
qinzheng93/vision3d
train
20
6804043f2870e68ae5d0d4618d68b40dc09eadd9
[ "for file, phase_sequence, output_signal in self.known_values:\n intcode_program = open(expanduser('~/code/aoc2019/07/%s' % file))\n mem = list(map(int, intcode_program.read().split(',')))\n result = intcode_computer.amplification_circuit(mem, phase_sequence)\n self.assertEqual(output_signal, result)", ...
<|body_start_0|> for file, phase_sequence, output_signal in self.known_values: intcode_program = open(expanduser('~/code/aoc2019/07/%s' % file)) mem = list(map(int, intcode_program.read().split(','))) result = intcode_computer.amplification_circuit(mem, phase_sequence) ...
KnownValues
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KnownValues: def test_amplification_circuit(self): """amplication_circuit should give known result with known input""" <|body_0|> def test_feedback_loop(self): """feedback_loop should give known result with known input""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_004816
1,426
no_license
[ { "docstring": "amplication_circuit should give known result with known input", "name": "test_amplification_circuit", "signature": "def test_amplification_circuit(self)" }, { "docstring": "feedback_loop should give known result with known input", "name": "test_feedback_loop", "signature"...
2
stack_v2_sparse_classes_30k_train_004297
Implement the Python class `KnownValues` described below. Class description: Implement the KnownValues class. Method signatures and docstrings: - def test_amplification_circuit(self): amplication_circuit should give known result with known input - def test_feedback_loop(self): feedback_loop should give known result w...
Implement the Python class `KnownValues` described below. Class description: Implement the KnownValues class. Method signatures and docstrings: - def test_amplification_circuit(self): amplication_circuit should give known result with known input - def test_feedback_loop(self): feedback_loop should give known result w...
98b6d2049e2331c2583d47d05061690b87ea0f2b
<|skeleton|> class KnownValues: def test_amplification_circuit(self): """amplication_circuit should give known result with known input""" <|body_0|> def test_feedback_loop(self): """feedback_loop should give known result with known input""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class KnownValues: def test_amplification_circuit(self): """amplication_circuit should give known result with known input""" for file, phase_sequence, output_signal in self.known_values: intcode_program = open(expanduser('~/code/aoc2019/07/%s' % file)) mem = list(map(int, int...
the_stack_v2_python_sparse
07/intcode_test.py
hinzed1127/aoc2019
train
0
a82b9c3b0ccd9a8e17c5328e965f7d2e2bc6ce47
[ "if len(s) < (1 << k) + k - 1:\n return False\ncur = int(s[:k], base=2)\ncodes = set([cur])\nbegin = 0\nend = k\nwhile len(codes) != 2 ** k and end < len(s):\n cur = (cur - 2 ** (k - 1) * int(s[begin]) << 1) + int(s[end])\n codes.add(cur)\n end += 1\n begin += 1\nreturn len(codes) == 2 ** k", "code...
<|body_start_0|> if len(s) < (1 << k) + k - 1: return False cur = int(s[:k], base=2) codes = set([cur]) begin = 0 end = k while len(codes) != 2 ** k and end < len(s): cur = (cur - 2 ** (k - 1) * int(s[begin]) << 1) + int(s[end]) codes.a...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasAllCodes(self, s, k): """:type s: str :type k: int :rtype: bool""" <|body_0|> def hasAllCodes1(self, s, k): """:type s: str :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(s) < (1 << k) + k - 1: ...
stack_v2_sparse_classes_10k_train_004817
1,032
no_license
[ { "docstring": ":type s: str :type k: int :rtype: bool", "name": "hasAllCodes", "signature": "def hasAllCodes(self, s, k)" }, { "docstring": ":type s: str :type k: int :rtype: bool", "name": "hasAllCodes1", "signature": "def hasAllCodes1(self, s, k)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasAllCodes(self, s, k): :type s: str :type k: int :rtype: bool - def hasAllCodes1(self, s, k): :type s: str :type k: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasAllCodes(self, s, k): :type s: str :type k: int :rtype: bool - def hasAllCodes1(self, s, k): :type s: str :type k: int :rtype: bool <|skeleton|> class Solution: def ...
9d394cd2862703cfb7a7b505b35deda7450a692e
<|skeleton|> class Solution: def hasAllCodes(self, s, k): """:type s: str :type k: int :rtype: bool""" <|body_0|> def hasAllCodes1(self, s, k): """:type s: str :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def hasAllCodes(self, s, k): """:type s: str :type k: int :rtype: bool""" if len(s) < (1 << k) + k - 1: return False cur = int(s[:k], base=2) codes = set([cur]) begin = 0 end = k while len(codes) != 2 ** k and end < len(s): ...
the_stack_v2_python_sparse
1461.检查一个字符串是否包含所有长度为-k-的二进制子串.py
Ezi4Zy/leetcode
train
0
09b97aed0991099d58d87bc3c2f01ce25eb3db39
[ "super(DuelingNetworkMLP3, self).__init__()\nself._device = device\nself.fc1 = nn.Linear(in_features=n_states, out_features=n_hiddens).to(self._device)\nself.fc2 = nn.Linear(in_features=n_hiddens, out_features=n_hiddens).to(self._device)\nself.fc3_adv = nn.Linear(in_features=n_hiddens, out_features=n_actions).to(se...
<|body_start_0|> super(DuelingNetworkMLP3, self).__init__() self._device = device self.fc1 = nn.Linear(in_features=n_states, out_features=n_hiddens).to(self._device) self.fc2 = nn.Linear(in_features=n_hiddens, out_features=n_hiddens).to(self._device) self.fc3_adv = nn.Linear(in_f...
Dueling Network のネットワーク構成 PyTorch の nn.Module を継承して実装 [public] fc1 : [nn.Linear] 入力層 fc2 : [nn.Linear] 隠れ層 fc3_adv : [nn.Linear] アドバンテージ関数のネットワーク fc3_vfunc : [nn.Linear] 状態価値関数のネットワーク
DuelingNetworkMLP3
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DuelingNetworkMLP3: """Dueling Network のネットワーク構成 PyTorch の nn.Module を継承して実装 [public] fc1 : [nn.Linear] 入力層 fc2 : [nn.Linear] 隠れ層 fc3_adv : [nn.Linear] アドバンテージ関数のネットワーク fc3_vfunc : [nn.Linear] 状態価値関数のネットワーク""" def __init__(self, device, n_states, n_hiddens, n_actions): """[Args] devi...
stack_v2_sparse_classes_10k_train_004818
2,523
no_license
[ { "docstring": "[Args] device : 使用デバイス n_states : 状態数 |S| / 入力ノード数に対応する。 n_actions : 状態数 |A| / 出力ノード数に対応する。", "name": "__init__", "signature": "def __init__(self, device, n_states, n_hiddens, n_actions)" }, { "docstring": "ネットワークの順方向での更新処理", "name": "forward", "signature": "def forward(s...
2
stack_v2_sparse_classes_30k_train_004317
Implement the Python class `DuelingNetworkMLP3` described below. Class description: Dueling Network のネットワーク構成 PyTorch の nn.Module を継承して実装 [public] fc1 : [nn.Linear] 入力層 fc2 : [nn.Linear] 隠れ層 fc3_adv : [nn.Linear] アドバンテージ関数のネットワーク fc3_vfunc : [nn.Linear] 状態価値関数のネットワーク Method signatures and docstrings: - def __init__(s...
Implement the Python class `DuelingNetworkMLP3` described below. Class description: Dueling Network のネットワーク構成 PyTorch の nn.Module を継承して実装 [public] fc1 : [nn.Linear] 入力層 fc2 : [nn.Linear] 隠れ層 fc3_adv : [nn.Linear] アドバンテージ関数のネットワーク fc3_vfunc : [nn.Linear] 状態価値関数のネットワーク Method signatures and docstrings: - def __init__(s...
b0bae63db6183cbaee15d6a96499e40c482a517d
<|skeleton|> class DuelingNetworkMLP3: """Dueling Network のネットワーク構成 PyTorch の nn.Module を継承して実装 [public] fc1 : [nn.Linear] 入力層 fc2 : [nn.Linear] 隠れ層 fc3_adv : [nn.Linear] アドバンテージ関数のネットワーク fc3_vfunc : [nn.Linear] 状態価値関数のネットワーク""" def __init__(self, device, n_states, n_hiddens, n_actions): """[Args] devi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DuelingNetworkMLP3: """Dueling Network のネットワーク構成 PyTorch の nn.Module を継承して実装 [public] fc1 : [nn.Linear] 入力層 fc2 : [nn.Linear] 隠れ層 fc3_adv : [nn.Linear] アドバンテージ関数のネットワーク fc3_vfunc : [nn.Linear] 状態価値関数のネットワーク""" def __init__(self, device, n_states, n_hiddens, n_actions): """[Args] device : 使用デバイス n...
the_stack_v2_python_sparse
CartPole_DuelingNetwork_PyTorch_OpenAIGym/DuelingNetworkMLP3.py
Yagami360/ReinforcementLearning_Exercises
train
14
cc49419d8ec219c24e76e28edf75c2aa94ab2ba2
[ "java_params = list(self._java_obj.params())\nfrom pyspark.ml.param import Param\nfor java_param in java_params:\n java_param_name = java_param.name()\n if not hasattr(self, java_param_name):\n param = Param(self, java_param_name, java_param.doc())\n setattr(param, 'created_from_java_param', Tru...
<|body_start_0|> java_params = list(self._java_obj.params()) from pyspark.ml.param import Param for java_param in java_params: java_param_name = java_param.name() if not hasattr(self, java_param_name): param = Param(self, java_param_name, java_param.doc())...
Mixin for overriding methods derived from JavaParams.
JavaParamsOverrides
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JavaParamsOverrides: """Mixin for overriding methods derived from JavaParams.""" def _create_params_from_java(self): """Create params that are defined in the Java obj but not here""" <|body_0|> def _transfer_params_from_java(self): """Transforms the embedded para...
stack_v2_sparse_classes_10k_train_004819
9,805
no_license
[ { "docstring": "Create params that are defined in the Java obj but not here", "name": "_create_params_from_java", "signature": "def _create_params_from_java(self)" }, { "docstring": "Transforms the embedded params from the companion Java object.", "name": "_transfer_params_from_java", "s...
3
stack_v2_sparse_classes_30k_train_002696
Implement the Python class `JavaParamsOverrides` described below. Class description: Mixin for overriding methods derived from JavaParams. Method signatures and docstrings: - def _create_params_from_java(self): Create params that are defined in the Java obj but not here - def _transfer_params_from_java(self): Transfo...
Implement the Python class `JavaParamsOverrides` described below. Class description: Mixin for overriding methods derived from JavaParams. Method signatures and docstrings: - def _create_params_from_java(self): Create params that are defined in the Java obj but not here - def _transfer_params_from_java(self): Transfo...
72d51e8e072fbeb5e2068d0a568fa4595282aa61
<|skeleton|> class JavaParamsOverrides: """Mixin for overriding methods derived from JavaParams.""" def _create_params_from_java(self): """Create params that are defined in the Java obj but not here""" <|body_0|> def _transfer_params_from_java(self): """Transforms the embedded para...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class JavaParamsOverrides: """Mixin for overriding methods derived from JavaParams.""" def _create_params_from_java(self): """Create params that are defined in the Java obj but not here""" java_params = list(self._java_obj.params()) from pyspark.ml.param import Param for java_pa...
the_stack_v2_python_sparse
docker/pyspark_lab/main/module/sparkxgb/xgboost.py
stansuo/BDSE12-Group3
train
6
dac48cb07221cd71d02e6381d08eea2b33a0ed82
[ "self.use_wget = use_wget\nself.quic_binary_dir = quic_binary_dir\nself.quic_server_address = quic_server_address\nself.quic_server_port = quic_server_port\nif not use_wget and (not os.path.isfile(quic_binary_dir + '/quic_client')):\n raise IOError('There is no quic_client in the given dir: %s.' % quic_binary_di...
<|body_start_0|> self.use_wget = use_wget self.quic_binary_dir = quic_binary_dir self.quic_server_address = quic_server_address self.quic_server_port = quic_server_port if not use_wget and (not os.path.isfile(quic_binary_dir + '/quic_client')): raise IOError('There is...
PageloadExperiment
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PageloadExperiment: def __init__(self, use_wget, quic_binary_dir, quic_server_address, quic_server_port): """Initialize PageloadExperiment. Args: use_wget: Whether to use wget. quic_binary_dir: Directory for quic_binary. quic_server_address: IP address of quic server. quic_server_port: P...
stack_v2_sparse_classes_10k_train_004820
6,722
permissive
[ { "docstring": "Initialize PageloadExperiment. Args: use_wget: Whether to use wget. quic_binary_dir: Directory for quic_binary. quic_server_address: IP address of quic server. quic_server_port: Port of the quic server.", "name": "__init__", "signature": "def __init__(self, use_wget, quic_binary_dir, qui...
4
null
Implement the Python class `PageloadExperiment` described below. Class description: Implement the PageloadExperiment class. Method signatures and docstrings: - def __init__(self, use_wget, quic_binary_dir, quic_server_address, quic_server_port): Initialize PageloadExperiment. Args: use_wget: Whether to use wget. quic...
Implement the Python class `PageloadExperiment` described below. Class description: Implement the PageloadExperiment class. Method signatures and docstrings: - def __init__(self, use_wget, quic_binary_dir, quic_server_address, quic_server_port): Initialize PageloadExperiment. Args: use_wget: Whether to use wget. quic...
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
<|skeleton|> class PageloadExperiment: def __init__(self, use_wget, quic_binary_dir, quic_server_address, quic_server_port): """Initialize PageloadExperiment. Args: use_wget: Whether to use wget. quic_binary_dir: Directory for quic_binary. quic_server_address: IP address of quic server. quic_server_port: P...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PageloadExperiment: def __init__(self, use_wget, quic_binary_dir, quic_server_address, quic_server_port): """Initialize PageloadExperiment. Args: use_wget: Whether to use wget. quic_binary_dir: Directory for quic_binary. quic_server_address: IP address of quic server. quic_server_port: Port of the qui...
the_stack_v2_python_sparse
net/tools/quic/benchmark/run_client.py
chromium/chromium
train
17,408
6ba37f844aafe25216c328a80324aa8a695997fb
[ "if not hasattr(self, 'allEvents'):\n self.allEvents = Event.objects.filter(Q(instance_of=PublicEvent) | Q(instance_of=Series)).annotate(**self.get_annotations()).exclude(Q(status=Event.RegStatus.hidden) | Q(status=Event.RegStatus.regHidden) | Q(status=Event.RegStatus.linkOnly)).order_by(*self.get_ordering()).di...
<|body_start_0|> if not hasattr(self, 'allEvents'): self.allEvents = Event.objects.filter(Q(instance_of=PublicEvent) | Q(instance_of=Series)).annotate(**self.get_annotations()).exclude(Q(status=Event.RegStatus.hidden) | Q(status=Event.RegStatus.regHidden) | Q(status=Event.RegStatus.linkOnly)).order_...
RegisterView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegisterView: def get_allEvents(self): """Exclude hidden and link-only events by default, as well as private events, etc. Additional restrictions are made on a per-plugin basis.""" <|body_0|> def get_context_data(self, **kwargs): """Add the event and series listing d...
stack_v2_sparse_classes_10k_train_004821
3,366
permissive
[ { "docstring": "Exclude hidden and link-only events by default, as well as private events, etc. Additional restrictions are made on a per-plugin basis.", "name": "get_allEvents", "signature": "def get_allEvents(self)" }, { "docstring": "Add the event and series listing data. If If \"today\" is s...
2
stack_v2_sparse_classes_30k_train_005532
Implement the Python class `RegisterView` described below. Class description: Implement the RegisterView class. Method signatures and docstrings: - def get_allEvents(self): Exclude hidden and link-only events by default, as well as private events, etc. Additional restrictions are made on a per-plugin basis. - def get...
Implement the Python class `RegisterView` described below. Class description: Implement the RegisterView class. Method signatures and docstrings: - def get_allEvents(self): Exclude hidden and link-only events by default, as well as private events, etc. Additional restrictions are made on a per-plugin basis. - def get...
19db3e83e76ea2002ee841989410d12d1e601023
<|skeleton|> class RegisterView: def get_allEvents(self): """Exclude hidden and link-only events by default, as well as private events, etc. Additional restrictions are made on a per-plugin basis.""" <|body_0|> def get_context_data(self, **kwargs): """Add the event and series listing d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RegisterView: def get_allEvents(self): """Exclude hidden and link-only events by default, as well as private events, etc. Additional restrictions are made on a per-plugin basis.""" if not hasattr(self, 'allEvents'): self.allEvents = Event.objects.filter(Q(instance_of=PublicEvent) |...
the_stack_v2_python_sparse
danceschool/register/views.py
django-danceschool/django-danceschool
train
40
1ded29b013b3c8fc349828d6d63c7b41d569efb8
[ "super(AutoAugmentation, self).__init__(n_level)\nself.policies = policies\nself.n_select = n_select", "chosen_policies = random.sample(self.policies, k=self.n_select)\nfor name, pr, level in chain.from_iterable(chosen_policies):\n if random.random() > pr:\n continue\n img = self._apply_augment(img, ...
<|body_start_0|> super(AutoAugmentation, self).__init__(n_level) self.policies = policies self.n_select = n_select <|end_body_0|> <|body_start_1|> chosen_policies = random.sample(self.policies, k=self.n_select) for name, pr, level in chain.from_iterable(chosen_policies): ...
Auto augmentation class. References: https://arxiv.org/pdf/1805.09501.pdf
AutoAugmentation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutoAugmentation: """Auto augmentation class. References: https://arxiv.org/pdf/1805.09501.pdf""" def __init__(self, policies: List[List[Tuple[str, float, int]]], n_select: int=1, n_level: int=10) -> None: """Initialize.""" <|body_0|> def __call__(self, img: Image) -> Im...
stack_v2_sparse_classes_10k_train_004822
5,467
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, policies: List[List[Tuple[str, float, int]]], n_select: int=1, n_level: int=10) -> None" }, { "docstring": "Run augmentations.", "name": "__call__", "signature": "def __call__(self, img: Image) -> Image" ...
2
stack_v2_sparse_classes_30k_train_006845
Implement the Python class `AutoAugmentation` described below. Class description: Auto augmentation class. References: https://arxiv.org/pdf/1805.09501.pdf Method signatures and docstrings: - def __init__(self, policies: List[List[Tuple[str, float, int]]], n_select: int=1, n_level: int=10) -> None: Initialize. - def ...
Implement the Python class `AutoAugmentation` described below. Class description: Auto augmentation class. References: https://arxiv.org/pdf/1805.09501.pdf Method signatures and docstrings: - def __init__(self, policies: List[List[Tuple[str, float, int]]], n_select: int=1, n_level: int=10) -> None: Initialize. - def ...
88bcff70e93dd68058a5cf0dfeac119a57abc6de
<|skeleton|> class AutoAugmentation: """Auto augmentation class. References: https://arxiv.org/pdf/1805.09501.pdf""" def __init__(self, policies: List[List[Tuple[str, float, int]]], n_select: int=1, n_level: int=10) -> None: """Initialize.""" <|body_0|> def __call__(self, img: Image) -> Im...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AutoAugmentation: """Auto augmentation class. References: https://arxiv.org/pdf/1805.09501.pdf""" def __init__(self, policies: List[List[Tuple[str, float, int]]], n_select: int=1, n_level: int=10) -> None: """Initialize.""" super(AutoAugmentation, self).__init__(n_level) self.poli...
the_stack_v2_python_sparse
src/augmentation/methods.py
scott-mao/DenseDepth_Pruning
train
1
55d16712ad6119f64aae84bbef6b200c4e493e01
[ "import re\nregex = '^(?P<id>\\\\w+)\\\\s+(?P<type>\\\\w+)\\\\s+(?P<cluster_id>\\\\w+)\\\\s+(?P<cluster_count>\\\\w+)$'\nmatched = re.match(regex, comment_str.strip())\nif not matched:\n return None\nreturn matched.groupdict()", "import re\nregex = '^(?P<length>\\\\w+)\\\\s+(?P<id>\\\\w+)\\\\s+(?P<type>\\\\w+)...
<|body_start_0|> import re regex = '^(?P<id>\\w+)\\s+(?P<type>\\w+)\\s+(?P<cluster_id>\\w+)\\s+(?P<cluster_count>\\w+)$' matched = re.match(regex, comment_str.strip()) if not matched: return None return matched.groupdict() <|end_body_0|> <|body_start_1|> impo...
"Comment string" parser. A "comment string" is commonly used in various of NGS file format (like "fasta", "dot-bracket" files, etc.) which helps convey some "basic info". This parser is to help retrieve this info.
CommentParser
[ "MIT", "BSD-3-Clause", "BSD-2-Clause", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommentParser: """"Comment string" parser. A "comment string" is commonly used in various of NGS file format (like "fasta", "dot-bracket" files, etc.) which helps convey some "basic info". This parser is to help retrieve this info.""" def parse_rsample_dot_bracket(cls, comment_str): ...
stack_v2_sparse_classes_10k_train_004823
3,306
permissive
[ { "docstring": "Parse the \"comment string\" for a \"RSample dot-bracket\" result file. An example for the \"RSample comment string\": >001 centroid 1 655 Elements: - '001' - RNA ID - 'centroid' - clustering result type, centroid | bpp - '1' - clustering # - '655' - clustering size Parameters ---------- comment...
3
stack_v2_sparse_classes_30k_train_007362
Implement the Python class `CommentParser` described below. Class description: "Comment string" parser. A "comment string" is commonly used in various of NGS file format (like "fasta", "dot-bracket" files, etc.) which helps convey some "basic info". This parser is to help retrieve this info. Method signatures and doc...
Implement the Python class `CommentParser` described below. Class description: "Comment string" parser. A "comment string" is commonly used in various of NGS file format (like "fasta", "dot-bracket" files, etc.) which helps convey some "basic info". This parser is to help retrieve this info. Method signatures and doc...
0cc238745a2679d763b356609d312c3f447a0be7
<|skeleton|> class CommentParser: """"Comment string" parser. A "comment string" is commonly used in various of NGS file format (like "fasta", "dot-bracket" files, etc.) which helps convey some "basic info". This parser is to help retrieve this info.""" def parse_rsample_dot_bracket(cls, comment_str): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CommentParser: """"Comment string" parser. A "comment string" is commonly used in various of NGS file format (like "fasta", "dot-bracket" files, etc.) which helps convey some "basic info". This parser is to help retrieve this info.""" def parse_rsample_dot_bracket(cls, comment_str): """Parse the ...
the_stack_v2_python_sparse
feature_generation/neo-rna/neoRNA/util/parser/comment_parser.py
kundajelab/PREUSS
train
2
20782ba2561d8a9b2953206822d776327080e62a
[ "def helper(node: TreeNode, lower=float('-inf'), upper=float('inf')) -> bool:\n if node is None:\n return True\n val = node.val\n if val <= lower or val >= upper:\n return False\n if not helper(node.left, lower, val):\n return False\n if not helper(node.right, val, upper):\n ...
<|body_start_0|> def helper(node: TreeNode, lower=float('-inf'), upper=float('inf')) -> bool: if node is None: return True val = node.val if val <= lower or val >= upper: return False if not helper(node.left, lower, val): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValidBST(self, root: TreeNode) -> bool: """递归法 :param root: :return:""" <|body_0|> def isValidBST2(self, root: TreeNode) -> bool: """中序遍历 使用栈来进行存储中序遍历节点,每次判断与前一节点大小 :param root: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_004824
1,618
no_license
[ { "docstring": "递归法 :param root: :return:", "name": "isValidBST", "signature": "def isValidBST(self, root: TreeNode) -> bool" }, { "docstring": "中序遍历 使用栈来进行存储中序遍历节点,每次判断与前一节点大小 :param root: :return:", "name": "isValidBST2", "signature": "def isValidBST2(self, root: TreeNode) -> bool" }...
2
stack_v2_sparse_classes_30k_train_002398
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST(self, root: TreeNode) -> bool: 递归法 :param root: :return: - def isValidBST2(self, root: TreeNode) -> bool: 中序遍历 使用栈来进行存储中序遍历节点,每次判断与前一节点大小 :param root: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST(self, root: TreeNode) -> bool: 递归法 :param root: :return: - def isValidBST2(self, root: TreeNode) -> bool: 中序遍历 使用栈来进行存储中序遍历节点,每次判断与前一节点大小 :param root: :return: <|...
150a216213ddb2012b603899717ad7a769c1b3c3
<|skeleton|> class Solution: def isValidBST(self, root: TreeNode) -> bool: """递归法 :param root: :return:""" <|body_0|> def isValidBST2(self, root: TreeNode) -> bool: """中序遍历 使用栈来进行存储中序遍历节点,每次判断与前一节点大小 :param root: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isValidBST(self, root: TreeNode) -> bool: """递归法 :param root: :return:""" def helper(node: TreeNode, lower=float('-inf'), upper=float('inf')) -> bool: if node is None: return True val = node.val if val <= lower or val >= upper: ...
the_stack_v2_python_sparse
code/26_验证二叉搜索树.py
fsc2016/LeetCode
train
0
80d8fcd049714a931c5e8daf5f6c1c6c26f1d7ca
[ "ruleTableName = 'Rule %s %s %s %s %s' % (indicatorTable, indicatorColumn, relativeIndex, comparison, multiplier)\nRule.__init__(self, ruleTableName)\nself._selectQuery = 'select Date, Code, %s from %s' % (indicatorColumn, indicatorTable)\nself._indicatorColumn = indicatorColumn\nself._relativeIndex = relativeIndex...
<|body_start_0|> ruleTableName = 'Rule %s %s %s %s %s' % (indicatorTable, indicatorColumn, relativeIndex, comparison, multiplier) Rule.__init__(self, ruleTableName) self._selectQuery = 'select Date, Code, %s from %s' % (indicatorColumn, indicatorTable) self._indicatorColumn = indicatorCo...
Relative Rule Class.
RelativeRule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelativeRule: """Relative Rule Class.""" def __init__(self, indicatorTable, indicatorColumn, relativeIndex, comparison, multiplier=1.0): """Class Constructor. :param indicatorTable: :param indicatorColumn: :param relativeIndex: Relative Index to compare the Indicator Column e.g. -1 m...
stack_v2_sparse_classes_10k_train_004825
2,834
no_license
[ { "docstring": "Class Constructor. :param indicatorTable: :param indicatorColumn: :param relativeIndex: Relative Index to compare the Indicator Column e.g. -1 means previous day and -5 means five days ago :param comparison: :param multiplier:", "name": "__init__", "signature": "def __init__(self, indica...
2
stack_v2_sparse_classes_30k_train_000531
Implement the Python class `RelativeRule` described below. Class description: Relative Rule Class. Method signatures and docstrings: - def __init__(self, indicatorTable, indicatorColumn, relativeIndex, comparison, multiplier=1.0): Class Constructor. :param indicatorTable: :param indicatorColumn: :param relativeIndex:...
Implement the Python class `RelativeRule` described below. Class description: Relative Rule Class. Method signatures and docstrings: - def __init__(self, indicatorTable, indicatorColumn, relativeIndex, comparison, multiplier=1.0): Class Constructor. :param indicatorTable: :param indicatorColumn: :param relativeIndex:...
08b07b50ead69decd381cf5f866f4d8ffb80fa54
<|skeleton|> class RelativeRule: """Relative Rule Class.""" def __init__(self, indicatorTable, indicatorColumn, relativeIndex, comparison, multiplier=1.0): """Class Constructor. :param indicatorTable: :param indicatorColumn: :param relativeIndex: Relative Index to compare the Indicator Column e.g. -1 m...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RelativeRule: """Relative Rule Class.""" def __init__(self, indicatorTable, indicatorColumn, relativeIndex, comparison, multiplier=1.0): """Class Constructor. :param indicatorTable: :param indicatorColumn: :param relativeIndex: Relative Index to compare the Indicator Column e.g. -1 means previous...
the_stack_v2_python_sparse
pyswing/objects/rules/relativeRule.py
garyjoy/pyswing
train
1
331f7416945d6b97a1324bb0ba1a0fd076c18677
[ "lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field\nlookup = self.kwargs.get(lookup_url_kwarg, None)\nif lookup is not None:\n return Clip.objects.filter(video__hash_key=lookup).select_related('owner', 'video')\nreturn Clip.objects.none()", "lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_f...
<|body_start_0|> lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field lookup = self.kwargs.get(lookup_url_kwarg, None) if lookup is not None: return Clip.objects.filter(video__hash_key=lookup).select_related('owner', 'video') return Clip.objects.none() <|end_body_0|>...
List all clips of a video and create new clips. ## Reading ### Permissions * Anyone can read this endpoint. ### Fields Reading this endpoint returns a list of [Clip objects](0/) ## Publishing ### Permissions * Only authenticated users can create using this endpoint. * Only associated users of a video can write to this ...
VideoClipList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VideoClipList: """List all clips of a video and create new clips. ## Reading ### Permissions * Anyone can read this endpoint. ### Fields Reading this endpoint returns a list of [Clip objects](0/) ## Publishing ### Permissions * Only authenticated users can create using this endpoint. * Only assoc...
stack_v2_sparse_classes_10k_train_004826
40,640
no_license
[ { "docstring": "This view should return a list of all clips for the video as determined by the lookup parameters of the view.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Create a new clip", "name": "perform_create", "signature": "def perform_create(...
2
stack_v2_sparse_classes_30k_train_006958
Implement the Python class `VideoClipList` described below. Class description: List all clips of a video and create new clips. ## Reading ### Permissions * Anyone can read this endpoint. ### Fields Reading this endpoint returns a list of [Clip objects](0/) ## Publishing ### Permissions * Only authenticated users can c...
Implement the Python class `VideoClipList` described below. Class description: List all clips of a video and create new clips. ## Reading ### Permissions * Anyone can read this endpoint. ### Fields Reading this endpoint returns a list of [Clip objects](0/) ## Publishing ### Permissions * Only authenticated users can c...
1f4b4cd74c9b4280437f73bdfef4491536194eeb
<|skeleton|> class VideoClipList: """List all clips of a video and create new clips. ## Reading ### Permissions * Anyone can read this endpoint. ### Fields Reading this endpoint returns a list of [Clip objects](0/) ## Publishing ### Permissions * Only authenticated users can create using this endpoint. * Only assoc...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class VideoClipList: """List all clips of a video and create new clips. ## Reading ### Permissions * Anyone can read this endpoint. ### Fields Reading this endpoint returns a list of [Clip objects](0/) ## Publishing ### Permissions * Only authenticated users can create using this endpoint. * Only associated users o...
the_stack_v2_python_sparse
gravvy/apps/video/views.py
nceruchalu/gravvy-server
train
1
e910ff849bd391adad910ddebabb5cad65964106
[ "super().__init__()\nif shared_dim is None:\n shared_dim = num_filts * 2 ** n_sample\nshared_block_enc = block_cls(shared_dim)\nshared_block_gen = block_cls(shared_dim)\nself.encoder_a = encoder_cls(shared_block_enc, img_shape[0], num_filts, n_sample)\nself.encoder_b = encoder_cls(shared_block_enc, img_shape[0],...
<|body_start_0|> super().__init__() if shared_dim is None: shared_dim = num_filts * 2 ** n_sample shared_block_enc = block_cls(shared_dim) shared_block_gen = block_cls(shared_dim) self.encoder_a = encoder_cls(shared_block_enc, img_shape[0], num_filts, n_sample) ...
Class implementing Unsupervised Image-to-Image Translation Networks References ---------- `Paper <https://arxiv.org/abs/1703.00848>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained network, it might be best, to split this network into its parts (i. e. separa...
UNIT
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UNIT: """Class implementing Unsupervised Image-to-Image Translation Networks References ---------- `Paper <https://arxiv.org/abs/1703.00848>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained network, it might be best, to split this netw...
stack_v2_sparse_classes_10k_train_004827
8,177
permissive
[ { "docstring": "Parameters ---------- img_shape : tuple the shape of the images to translate from and to (including channels, excluding batch dimension) num_filts : int number of filters to use n_sample : int number of sampling layers per network shared_dim : int size of the shared dimension between generators ...
2
stack_v2_sparse_classes_30k_train_003500
Implement the Python class `UNIT` described below. Class description: Class implementing Unsupervised Image-to-Image Translation Networks References ---------- `Paper <https://arxiv.org/abs/1703.00848>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained networ...
Implement the Python class `UNIT` described below. Class description: Class implementing Unsupervised Image-to-Image Translation Networks References ---------- `Paper <https://arxiv.org/abs/1703.00848>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained networ...
1078f5030b8aac2bf022daf5fa14d66f74c3c893
<|skeleton|> class UNIT: """Class implementing Unsupervised Image-to-Image Translation Networks References ---------- `Paper <https://arxiv.org/abs/1703.00848>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained network, it might be best, to split this netw...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UNIT: """Class implementing Unsupervised Image-to-Image Translation Networks References ---------- `Paper <https://arxiv.org/abs/1703.00848>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained network, it might be best, to split this network into its ...
the_stack_v2_python_sparse
dlutils/models/gans/unit/unit.py
justusschock/dl-utils
train
15
a24a4c20d40bdcb7673427c50a95fcd71e5db044
[ "super(FunctionComponent, self).__init__(opts)\nself.res_options = opts.get('resilient', {})\nself.options = opts.get('pagerduty', {})\nvalidate_fields(['api_token', 'from_email'], self.options)\nself.log = logging.getLogger(__name__)", "self.res_options = opts.get('resilient', {})\nself.options = opts.get('pager...
<|body_start_0|> super(FunctionComponent, self).__init__(opts) self.res_options = opts.get('resilient', {}) self.options = opts.get('pagerduty', {}) validate_fields(['api_token', 'from_email'], self.options) self.log = logging.getLogger(__name__) <|end_body_0|> <|body_start_1|> ...
Component that implements Resilient function 'pagerduty_transition_incident Transitioning an incident can be used to update specific fields (such as priority) or Change the status to acknowledged or resolved
FunctionComponent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FunctionComponent: """Component that implements Resilient function 'pagerduty_transition_incident Transitioning an incident can be used to update specific fields (such as priority) or Change the status to acknowledged or resolved""" def __init__(self, opts): """constructor provides a...
stack_v2_sparse_classes_10k_train_004828
2,316
permissive
[ { "docstring": "constructor provides access to the configuration options", "name": "__init__", "signature": "def __init__(self, opts)" }, { "docstring": "Configuration options have changed, save new values", "name": "_reload", "signature": "def _reload(self, event, opts)" }, { "d...
3
null
Implement the Python class `FunctionComponent` described below. Class description: Component that implements Resilient function 'pagerduty_transition_incident Transitioning an incident can be used to update specific fields (such as priority) or Change the status to acknowledged or resolved Method signatures and docst...
Implement the Python class `FunctionComponent` described below. Class description: Component that implements Resilient function 'pagerduty_transition_incident Transitioning an incident can be used to update specific fields (such as priority) or Change the status to acknowledged or resolved Method signatures and docst...
6878c78b94eeca407998a41ce8db2cc00f2b6758
<|skeleton|> class FunctionComponent: """Component that implements Resilient function 'pagerduty_transition_incident Transitioning an incident can be used to update specific fields (such as priority) or Change the status to acknowledged or resolved""" def __init__(self, opts): """constructor provides a...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FunctionComponent: """Component that implements Resilient function 'pagerduty_transition_incident Transitioning an incident can be used to update specific fields (such as priority) or Change the status to acknowledged or resolved""" def __init__(self, opts): """constructor provides access to the ...
the_stack_v2_python_sparse
fn_pagerduty/fn_pagerduty/components/funct_pagerduty_transition_incident.py
ibmresilient/resilient-community-apps
train
81
58d8c2271fb423f8309143ccf3d44b10f145e02b
[ "try:\n user = User.objects.get(pk=data)\nexcept User.DoesNotExist:\n raise serializers.ValidationError('Invalid Passanger')\ncircle = self.context['circle']\ntry:\n membership = MemberShip.objects.get(user=user, circle=circle, is_active=True)\nexcept MemberShip.DoesNotExist:\n raise serializers.Validat...
<|body_start_0|> try: user = User.objects.get(pk=data) except User.DoesNotExist: raise serializers.ValidationError('Invalid Passanger') circle = self.context['circle'] try: membership = MemberShip.objects.get(user=user, circle=circle, is_active=True) ...
Join Ride serializer
JoinRideSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JoinRideSerializer: """Join Ride serializer""" def validate_passanger(self, data): """Verify passenger exist and is a circle member""" <|body_0|> def validate(self, data): """verify ride allow new passangers""" <|body_1|> def update(self, instance, d...
stack_v2_sparse_classes_10k_train_004829
7,953
no_license
[ { "docstring": "Verify passenger exist and is a circle member", "name": "validate_passanger", "signature": "def validate_passanger(self, data)" }, { "docstring": "verify ride allow new passangers", "name": "validate", "signature": "def validate(self, data)" }, { "docstring": "Add...
3
stack_v2_sparse_classes_30k_train_003104
Implement the Python class `JoinRideSerializer` described below. Class description: Join Ride serializer Method signatures and docstrings: - def validate_passanger(self, data): Verify passenger exist and is a circle member - def validate(self, data): verify ride allow new passangers - def update(self, instance, data)...
Implement the Python class `JoinRideSerializer` described below. Class description: Join Ride serializer Method signatures and docstrings: - def validate_passanger(self, data): Verify passenger exist and is a circle member - def validate(self, data): verify ride allow new passangers - def update(self, instance, data)...
0cede53169041667bd40bbce3c4774af84ffc2fa
<|skeleton|> class JoinRideSerializer: """Join Ride serializer""" def validate_passanger(self, data): """Verify passenger exist and is a circle member""" <|body_0|> def validate(self, data): """verify ride allow new passangers""" <|body_1|> def update(self, instance, d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class JoinRideSerializer: """Join Ride serializer""" def validate_passanger(self, data): """Verify passenger exist and is a circle member""" try: user = User.objects.get(pk=data) except User.DoesNotExist: raise serializers.ValidationError('Invalid Passanger') ...
the_stack_v2_python_sparse
rides/serializers/rides.py
KrystellCR/DjangoRF
train
0
40d1051acaaef2780b9bd124ceeba371c471d523
[ "arr = [_ for _ in range(n)]\ncount = 0\nwhile True:\n for i in range(len(arr)):\n if arr[i] != -1:\n count = (count + 1) % m\n if count == 0:\n arr[i] = -1\n if arr.count(-1) == n - 1:\n for num in arr:\n if num...
<|body_start_0|> arr = [_ for _ in range(n)] count = 0 while True: for i in range(len(arr)): if arr[i] != -1: count = (count + 1) % m if count == 0: arr[i] = -1 if arr.count(-1) ==...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lastRemaining(self, n: int, m: int) -> int: """超出时间限制 :param n: :param m: :return:""" <|body_0|> def lastRemaining2(self, n: int, m: int) -> int: """超时 :param n: :param m: :return:""" <|body_1|> def lastRemaining3(self, n: int, m: int) -> i...
stack_v2_sparse_classes_10k_train_004830
3,080
no_license
[ { "docstring": "超出时间限制 :param n: :param m: :return:", "name": "lastRemaining", "signature": "def lastRemaining(self, n: int, m: int) -> int" }, { "docstring": "超时 :param n: :param m: :return:", "name": "lastRemaining2", "signature": "def lastRemaining2(self, n: int, m: int) -> int" }, ...
5
stack_v2_sparse_classes_30k_train_003019
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lastRemaining(self, n: int, m: int) -> int: 超出时间限制 :param n: :param m: :return: - def lastRemaining2(self, n: int, m: int) -> int: 超时 :param n: :param m: :return: - def lastR...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lastRemaining(self, n: int, m: int) -> int: 超出时间限制 :param n: :param m: :return: - def lastRemaining2(self, n: int, m: int) -> int: 超时 :param n: :param m: :return: - def lastR...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def lastRemaining(self, n: int, m: int) -> int: """超出时间限制 :param n: :param m: :return:""" <|body_0|> def lastRemaining2(self, n: int, m: int) -> int: """超时 :param n: :param m: :return:""" <|body_1|> def lastRemaining3(self, n: int, m: int) -> i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def lastRemaining(self, n: int, m: int) -> int: """超出时间限制 :param n: :param m: :return:""" arr = [_ for _ in range(n)] count = 0 while True: for i in range(len(arr)): if arr[i] != -1: count = (count + 1) % m ...
the_stack_v2_python_sparse
LeetCode/数学/1579. 圆圈中最后剩下的数字.py
yiming1012/MyLeetCode
train
2
5629ad020469bb4f0749842a5e0a615cc8c15d4c
[ "Frame.__init__(self, master)\nself.pack()\nself.createSongWidgets()", "top_frame = Frame(self)\nself.labelInput = Label(top_frame, text='Song Name \\n mp3 aiff m4p ')\nself.text_in = Entry(top_frame)\nself.labelResult = Label(top_frame, text='Result')\nself.labelInput.pack()\nself.text_in.pack()\nself.labelResul...
<|body_start_0|> Frame.__init__(self, master) self.pack() self.createSongWidgets() <|end_body_0|> <|body_start_1|> top_frame = Frame(self) self.labelInput = Label(top_frame, text='Song Name \n mp3 aiff m4p ') self.text_in = Entry(top_frame) self.labelResult = Lab...
Application main window class.
getSong_UI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class getSong_UI: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" <|body_0|> def createSongWidgets(self): """Add all the widgets to the main frame.""" <|body_1|> def handle(self): ...
stack_v2_sparse_classes_10k_train_004831
10,077
no_license
[ { "docstring": "Main frame initialization (mostly delegated)", "name": "__init__", "signature": "def __init__(self, master=None)" }, { "docstring": "Add all the widgets to the main frame.", "name": "createSongWidgets", "signature": "def createSongWidgets(self)" }, { "docstring": ...
3
stack_v2_sparse_classes_30k_train_002644
Implement the Python class `getSong_UI` described below. Class description: Application main window class. Method signatures and docstrings: - def __init__(self, master=None): Main frame initialization (mostly delegated) - def createSongWidgets(self): Add all the widgets to the main frame. - def handle(self): Handle ...
Implement the Python class `getSong_UI` described below. Class description: Application main window class. Method signatures and docstrings: - def __init__(self, master=None): Main frame initialization (mostly delegated) - def createSongWidgets(self): Add all the widgets to the main frame. - def handle(self): Handle ...
2dba11861f91e4bdc1ef28279132a6d8dd4ccf54
<|skeleton|> class getSong_UI: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" <|body_0|> def createSongWidgets(self): """Add all the widgets to the main frame.""" <|body_1|> def handle(self): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class getSong_UI: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" Frame.__init__(self, master) self.pack() self.createSongWidgets() def createSongWidgets(self): """Add all the widgets to the ma...
the_stack_v2_python_sparse
Mux_src/Fix_All_Music_Guis.py
rduvalwa5/Mux
train
0
2a1c52730009a26b5e2ad9951b855613d0a71494
[ "if self.request.is_ajax():\n return JsonResponse({'error': form.errors}, status=400)\nelse:\n return JsonResponse({'error': 'Invalid form and request'}, status=400)", "if self.request.is_ajax():\n notice = Notice.objects.get(pk=self.kwargs['pk'])\n form.instance.notice = notice\n form.instance.use...
<|body_start_0|> if self.request.is_ajax(): return JsonResponse({'error': form.errors}, status=400) else: return JsonResponse({'error': 'Invalid form and request'}, status=400) <|end_body_0|> <|body_start_1|> if self.request.is_ajax(): notice = Notice.objects...
Handles creating a comment Args: * Arg1: The LoginRequiredMixin * Arg2: Inherits the Generic FormView class.
CreateComment
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateComment: """Handles creating a comment Args: * Arg1: The LoginRequiredMixin * Arg2: Inherits the Generic FormView class.""" def form_invalid(self, form): """Handles comment form invalid nArgs: * Arg1: Self - the current instance of the class * Arg2: the comment form Returns: * ...
stack_v2_sparse_classes_10k_train_004832
16,067
no_license
[ { "docstring": "Handles comment form invalid nArgs: * Arg1: Self - the current instance of the class * Arg2: the comment form Returns: * Json response of the error", "name": "form_invalid", "signature": "def form_invalid(self, form)" }, { "docstring": "Handles comment form valid * Sets the comme...
2
stack_v2_sparse_classes_30k_train_002451
Implement the Python class `CreateComment` described below. Class description: Handles creating a comment Args: * Arg1: The LoginRequiredMixin * Arg2: Inherits the Generic FormView class. Method signatures and docstrings: - def form_invalid(self, form): Handles comment form invalid nArgs: * Arg1: Self - the current i...
Implement the Python class `CreateComment` described below. Class description: Handles creating a comment Args: * Arg1: The LoginRequiredMixin * Arg2: Inherits the Generic FormView class. Method signatures and docstrings: - def form_invalid(self, form): Handles comment form invalid nArgs: * Arg1: Self - the current i...
dc7ff47249809f377fbccbb40667b83011930b7b
<|skeleton|> class CreateComment: """Handles creating a comment Args: * Arg1: The LoginRequiredMixin * Arg2: Inherits the Generic FormView class.""" def form_invalid(self, form): """Handles comment form invalid nArgs: * Arg1: Self - the current instance of the class * Arg2: the comment form Returns: * ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CreateComment: """Handles creating a comment Args: * Arg1: The LoginRequiredMixin * Arg2: Inherits the Generic FormView class.""" def form_invalid(self, form): """Handles comment form invalid nArgs: * Arg1: Self - the current instance of the class * Arg2: the comment form Returns: * Json response...
the_stack_v2_python_sparse
notices/views.py
alychinque/eHand
train
0
8a16fbe82e5c72ada13cb843d973957b35fc6506
[ "super().__init__()\nmodel_file_name_full_path = os.path.join(resource_manager.getResourceRootDir(), model_file_name)\nif not os.path.exists(model_file_name_full_path):\n raise Exception(f'Missing model file: {model_file_name_full_path}')\nself.model = resource_manager.loadRankLibModel(model_file_name)\nself.fea...
<|body_start_0|> super().__init__() model_file_name_full_path = os.path.join(resource_manager.getResourceRootDir(), model_file_name) if not os.path.exists(model_file_name_full_path): raise Exception(f'Missing model file: {model_file_name_full_path}') self.model = resource_man...
An interface to classic (non-neural) rankers, which are implemented a the Java layer. Model and configuration files are relative to the collection directory (resource root directory).
ClassicRanker
[ "BSD-2-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassicRanker: """An interface to classic (non-neural) rankers, which are implemented a the Java layer. Model and configuration files are relative to the collection directory (resource root directory).""" def __init__(self, resource_manager, feat_extr_file_name, model_file_name): """...
stack_v2_sparse_classes_10k_train_004833
3,723
permissive
[ { "docstring": "Reranker constructor. :param resource_manager: a resource manager object :param feat_extr_file_name: feature extractor JSON configuration file. :param model_file_name: a (previously trained/created) model file name", "name": "__init__", "signature": "def __init__(self, resource_manager, ...
2
stack_v2_sparse_classes_30k_test_000060
Implement the Python class `ClassicRanker` described below. Class description: An interface to classic (non-neural) rankers, which are implemented a the Java layer. Model and configuration files are relative to the collection directory (resource root directory). Method signatures and docstrings: - def __init__(self, ...
Implement the Python class `ClassicRanker` described below. Class description: An interface to classic (non-neural) rankers, which are implemented a the Java layer. Model and configuration files are relative to the collection directory (resource root directory). Method signatures and docstrings: - def __init__(self, ...
0bd3e06735ff705731fb6cee62d3486276beccdf
<|skeleton|> class ClassicRanker: """An interface to classic (non-neural) rankers, which are implemented a the Java layer. Model and configuration files are relative to the collection directory (resource root directory).""" def __init__(self, resource_manager, feat_extr_file_name, model_file_name): """...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ClassicRanker: """An interface to classic (non-neural) rankers, which are implemented a the Java layer. Model and configuration files are relative to the collection directory (resource root directory).""" def __init__(self, resource_manager, feat_extr_file_name, model_file_name): """Reranker cons...
the_stack_v2_python_sparse
flexneuart/ranker/classic.py
oaqa/FlexNeuART
train
156
516fd9315e65bf427e2f9826f8d43297d388fb22
[ "self.config = Configuration.from_filepath()\nif name is None or name not in self.config.get_values_strategy():\n raise Exception(\"La Strategie {NOM} n'existe pas\".format(NOM=name))\nself.name = name", "if self.name.strip() == 'DEV':\n return StrategieDev()\nelse:\n raise ValueError('Strategie non-pris...
<|body_start_0|> self.config = Configuration.from_filepath() if name is None or name not in self.config.get_values_strategy(): raise Exception("La Strategie {NOM} n'existe pas".format(NOM=name)) self.name = name <|end_body_0|> <|body_start_1|> if self.name.strip() == 'DEV': ...
Classe permttant d'initialiser les Strategies
StgyFactory
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StgyFactory: """Classe permttant d'initialiser les Strategies""" def __init__(self, name=None): """Initialisation Objet""" <|body_0|> def make(self): """Créez et renvoyez une instance de la classe Strategy telle que configurée dans le fichier de configuration""" ...
stack_v2_sparse_classes_10k_train_004834
1,138
permissive
[ { "docstring": "Initialisation Objet", "name": "__init__", "signature": "def __init__(self, name=None)" }, { "docstring": "Créez et renvoyez une instance de la classe Strategy telle que configurée dans le fichier de configuration", "name": "make", "signature": "def make(self)" } ]
2
stack_v2_sparse_classes_30k_test_000213
Implement the Python class `StgyFactory` described below. Class description: Classe permttant d'initialiser les Strategies Method signatures and docstrings: - def __init__(self, name=None): Initialisation Objet - def make(self): Créez et renvoyez une instance de la classe Strategy telle que configurée dans le fichier...
Implement the Python class `StgyFactory` described below. Class description: Classe permttant d'initialiser les Strategies Method signatures and docstrings: - def __init__(self, name=None): Initialisation Objet - def make(self): Créez et renvoyez une instance de la classe Strategy telle que configurée dans le fichier...
fa0af604752d7a3905f988b9164eb24c0d2cc8d2
<|skeleton|> class StgyFactory: """Classe permttant d'initialiser les Strategies""" def __init__(self, name=None): """Initialisation Objet""" <|body_0|> def make(self): """Créez et renvoyez une instance de la classe Strategy telle que configurée dans le fichier de configuration""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StgyFactory: """Classe permttant d'initialiser les Strategies""" def __init__(self, name=None): """Initialisation Objet""" self.config = Configuration.from_filepath() if name is None or name not in self.config.get_values_strategy(): raise Exception("La Strategie {NOM} ...
the_stack_v2_python_sparse
src/lib/strategie/factory.py
Ileouleyuki/MyTradingBot
train
0
cd48a2132311d73612567d65ccd4118da7694dc5
[ "\"\"\"O(n)的时间复杂度\n 但是需要额外的存储空间\n 不好!\"\"\"\nx = str(x)\ni, j = (0, len(x) - 1)\nwhile i < j:\n if x[i] != x[j]:\n return False\n i += 1\n j -= 1\nreturn True", "\"\"\"log10(n)的时间复杂度\n 将数字进行反转,如果是回文肯定和原先数字一样,如果不一样不是回文,但是有溢出的风险。\n 所以可以只反转后裔一半数字\"\"\"\n'如果最后一位是0那么它是回文它必须是...
<|body_start_0|> """O(n)的时间复杂度 但是需要额外的存储空间 不好!""" x = str(x) i, j = (0, len(x) - 1) while i < j: if x[i] != x[j]: return False i += 1 j -= 1 return True <|end_body_0|> <|body_start_1|> ""...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_0|> def isPalindrome_2(self, x): """:param x: :return:""" <|body_1|> def isPalindrome_3(self, x): """beat 99.64%的人""" <|body_2|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_10k_train_004835
1,657
no_license
[ { "docstring": ":type x: int :rtype: bool", "name": "isPalindrome", "signature": "def isPalindrome(self, x)" }, { "docstring": ":param x: :return:", "name": "isPalindrome_2", "signature": "def isPalindrome_2(self, x)" }, { "docstring": "beat 99.64%的人", "name": "isPalindrome_3...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, x): :type x: int :rtype: bool - def isPalindrome_2(self, x): :param x: :return: - def isPalindrome_3(self, x): beat 99.64%的人
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, x): :type x: int :rtype: bool - def isPalindrome_2(self, x): :param x: :return: - def isPalindrome_3(self, x): beat 99.64%的人 <|skeleton|> class Solution: ...
09b7121628df824f432b8cdd25c55f045b013c0b
<|skeleton|> class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_0|> def isPalindrome_2(self, x): """:param x: :return:""" <|body_1|> def isPalindrome_3(self, x): """beat 99.64%的人""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" """O(n)的时间复杂度 但是需要额外的存储空间 不好!""" x = str(x) i, j = (0, len(x) - 1) while i < j: if x[i] != x[j]: return False i += 1 ...
the_stack_v2_python_sparse
tuter_start/9_int.py
cainingning/leetcode
train
1
d18d96414d5f2d71fa0be07189bbaff67fbeb970
[ "from .traces import ScriptEndpointTrace\nif self.is_new():\n raise SyncanoValidationError('Method allowed only on existing model.')\nproperties = self.get_endpoint_data()\nhttp_method = 'POST'\nendpoint = self._meta.resolve_endpoint('run', properties, http_method)\nconnection = self._get_connection(**payload)\n...
<|body_start_0|> from .traces import ScriptEndpointTrace if self.is_new(): raise SyncanoValidationError('Method allowed only on existing model.') properties = self.get_endpoint_data() http_method = 'POST' endpoint = self._meta.resolve_endpoint('run', properties, http_...
OO wrapper around script endpoints `link <http://docs.syncano.com/docs/codebox-sockets>`_. :ivar name: :class:`~syncano.models.fields.SlugField` :ivar script: :class:`~syncano.models.fields.IntegerField` :ivar links: :class:`~syncano.models.fields.HyperlinkedField` .. note:: **ScriptEndpoint** has special method called...
ScriptEndpoint
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScriptEndpoint: """OO wrapper around script endpoints `link <http://docs.syncano.com/docs/codebox-sockets>`_. :ivar name: :class:`~syncano.models.fields.SlugField` :ivar script: :class:`~syncano.models.fields.IntegerField` :ivar links: :class:`~syncano.models.fields.HyperlinkedField` .. note:: **...
stack_v2_sparse_classes_10k_train_004836
13,042
no_license
[ { "docstring": "Usage:: >>> se = ScriptEndpoint.please.get('instance-name', 'script-name') >>> se.run() >>> se.run(variable_one=1, variable_two=2)", "name": "run", "signature": "def run(self, cache_key=None, **payload)" }, { "docstring": "Usage:: >>> se = ScriptEndpoint.please.get('instance-name...
2
stack_v2_sparse_classes_30k_train_006351
Implement the Python class `ScriptEndpoint` described below. Class description: OO wrapper around script endpoints `link <http://docs.syncano.com/docs/codebox-sockets>`_. :ivar name: :class:`~syncano.models.fields.SlugField` :ivar script: :class:`~syncano.models.fields.IntegerField` :ivar links: :class:`~syncano.model...
Implement the Python class `ScriptEndpoint` described below. Class description: OO wrapper around script endpoints `link <http://docs.syncano.com/docs/codebox-sockets>`_. :ivar name: :class:`~syncano.models.fields.SlugField` :ivar script: :class:`~syncano.models.fields.IntegerField` :ivar links: :class:`~syncano.model...
3a1cff87a565a075ca6f54bfe55089bb152fdbf3
<|skeleton|> class ScriptEndpoint: """OO wrapper around script endpoints `link <http://docs.syncano.com/docs/codebox-sockets>`_. :ivar name: :class:`~syncano.models.fields.SlugField` :ivar script: :class:`~syncano.models.fields.IntegerField` :ivar links: :class:`~syncano.models.fields.HyperlinkedField` .. note:: **...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ScriptEndpoint: """OO wrapper around script endpoints `link <http://docs.syncano.com/docs/codebox-sockets>`_. :ivar name: :class:`~syncano.models.fields.SlugField` :ivar script: :class:`~syncano.models.fields.IntegerField` :ivar links: :class:`~syncano.models.fields.HyperlinkedField` .. note:: **ScriptEndpoin...
the_stack_v2_python_sparse
syncano/models/incentives.py
Syncano/syncano-python
train
4
a039e1dea7d55097ca9d14ebdcf513d2ce2e05a0
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
XArmShuidiServicer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XArmShuidiServicer: """Missing associated documentation comment in .proto file.""" def arm_move_jspace_path(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def arm_get_jnt_values(self, request, context): """Missi...
stack_v2_sparse_classes_10k_train_004837
8,487
permissive
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "arm_move_jspace_path", "signature": "def arm_move_jspace_path(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "arm_get_jnt_values", "signatur...
5
stack_v2_sparse_classes_30k_train_005579
Implement the Python class `XArmShuidiServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def arm_move_jspace_path(self, request, context): Missing associated documentation comment in .proto file. - def arm_get_jnt_values(self, req...
Implement the Python class `XArmShuidiServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def arm_move_jspace_path(self, request, context): Missing associated documentation comment in .proto file. - def arm_get_jnt_values(self, req...
405f15be1a3f7740f3eb7d234d96998f6d057a54
<|skeleton|> class XArmShuidiServicer: """Missing associated documentation comment in .proto file.""" def arm_move_jspace_path(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def arm_get_jnt_values(self, request, context): """Missi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class XArmShuidiServicer: """Missing associated documentation comment in .proto file.""" def arm_move_jspace_path(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not imple...
the_stack_v2_python_sparse
robot_con/xarm_shuidi/xarm_shuidi_pb2_grpc.py
Shogo-Hayakawa/wrs
train
0
d4635243363b6b9145af3219516f9465e86a387d
[ "if not nums:\n return 0\ngroup_idx = 0\ngroup = dict()\ngroup_min_max = dict()\nm = 1\nfor n in set(nums):\n if n + 1 not in group and n - 1 not in group:\n group[n] = group_idx\n group_min_max[group_idx] = (n, n)\n group_idx += 1\n else:\n group_min = group_max = n\n gs...
<|body_start_0|> if not nums: return 0 group_idx = 0 group = dict() group_min_max = dict() m = 1 for n in set(nums): if n + 1 not in group and n - 1 not in group: group[n] = group_idx group_min_max[group_idx] = (n, n...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestConsecutive(self, nums): """08/18/2018 18:52 Keep the group number of start and end point of each interval and each group's start and end Time complexity: O(n) Space complexity: O(n)""" <|body_0|> def longestConsecutive(self, nums: List[int]) -> int: ...
stack_v2_sparse_classes_10k_train_004838
4,211
no_license
[ { "docstring": "08/18/2018 18:52 Keep the group number of start and end point of each interval and each group's start and end Time complexity: O(n) Space complexity: O(n)", "name": "longestConsecutive", "signature": "def longestConsecutive(self, nums)" }, { "docstring": "06/20/2021 07:40 Union-f...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestConsecutive(self, nums): 08/18/2018 18:52 Keep the group number of start and end point of each interval and each group's start and end Time complexity: O(n) Space comp...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestConsecutive(self, nums): 08/18/2018 18:52 Keep the group number of start and end point of each interval and each group's start and end Time complexity: O(n) Space comp...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def longestConsecutive(self, nums): """08/18/2018 18:52 Keep the group number of start and end point of each interval and each group's start and end Time complexity: O(n) Space complexity: O(n)""" <|body_0|> def longestConsecutive(self, nums: List[int]) -> int: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def longestConsecutive(self, nums): """08/18/2018 18:52 Keep the group number of start and end point of each interval and each group's start and end Time complexity: O(n) Space complexity: O(n)""" if not nums: return 0 group_idx = 0 group = dict() ...
the_stack_v2_python_sparse
leetcode/solved/128_Longest_Consecutive_Sequence/solution.py
sungminoh/algorithms
train
0
0c0057735c8aed188032bf401b29a37aca7c081e
[ "self.key = settings.PERMISSION_KEY\nself.mode = AES.MODE_ECB\nself.prefix = settings.PERMISSION_PREFIX", "length = 32\nif len(text) > length:\n return ''\ntext = ''.join(random.sample(self.prefix, length - len(text))) + text\nencryptor = AES.new(self.key, self.mode)\ncurrent_time = time.time()\nself.save_to_a...
<|body_start_0|> self.key = settings.PERMISSION_KEY self.mode = AES.MODE_ECB self.prefix = settings.PERMISSION_PREFIX <|end_body_0|> <|body_start_1|> length = 32 if len(text) > length: return '' text = ''.join(random.sample(self.prefix, length - len(text))) +...
preceeding class for AuthList
KSMP_Permission
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KSMP_Permission: """preceeding class for AuthList""" def __init__(self): """initiate object properties""" <|body_0|> def set_permission(self, text): """params: text allways is username 16*n bytes return: encoded auth code""" <|body_1|> def get_permis...
stack_v2_sparse_classes_10k_train_004839
2,888
no_license
[ { "docstring": "initiate object properties", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "params: text allways is username 16*n bytes return: encoded auth code", "name": "set_permission", "signature": "def set_permission(self, text)" }, { "docstring": ...
6
stack_v2_sparse_classes_30k_train_005783
Implement the Python class `KSMP_Permission` described below. Class description: preceeding class for AuthList Method signatures and docstrings: - def __init__(self): initiate object properties - def set_permission(self, text): params: text allways is username 16*n bytes return: encoded auth code - def get_permission...
Implement the Python class `KSMP_Permission` described below. Class description: preceeding class for AuthList Method signatures and docstrings: - def __init__(self): initiate object properties - def set_permission(self, text): params: text allways is username 16*n bytes return: encoded auth code - def get_permission...
7f801a569a396a27371d0831752595877c224a6b
<|skeleton|> class KSMP_Permission: """preceeding class for AuthList""" def __init__(self): """initiate object properties""" <|body_0|> def set_permission(self, text): """params: text allways is username 16*n bytes return: encoded auth code""" <|body_1|> def get_permis...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class KSMP_Permission: """preceeding class for AuthList""" def __init__(self): """initiate object properties""" self.key = settings.PERMISSION_KEY self.mode = AES.MODE_ECB self.prefix = settings.PERMISSION_PREFIX def set_permission(self, text): """params: text allwa...
the_stack_v2_python_sparse
Python_projects/flask_projects/unicorn_project/session/permission.py
sdtimothy8/Coding
train
0
c0b5960f6068d0a276878bf89b02c6c37e0656ed
[ "stateanalyzer = DH.StateAnalyzer(mergeddata)\nVALID_STATES = stateanalyzer.get_state_list()\nself.assertEqual(len(VALID_STATES), 55)\nstateanalyzer.set_state_data('NY')\nself.assertEqual(stateanalyzer.filtered_data.can_off_sta.unique(), ['NY'])\nstateanalyzer.set_state_data('CA')\nself.assertEqual(stateanalyzer.fi...
<|body_start_0|> stateanalyzer = DH.StateAnalyzer(mergeddata) VALID_STATES = stateanalyzer.get_state_list() self.assertEqual(len(VALID_STATES), 55) stateanalyzer.set_state_data('NY') self.assertEqual(stateanalyzer.filtered_data.can_off_sta.unique(), ['NY']) stateanalyzer....
Unit Test for DataHandlers in DataHandler.py
DataHandlerTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataHandlerTest: """Unit Test for DataHandlers in DataHandler.py""" def test_StateAnalyzer(self): """This tests StateAnalyzer class""" <|body_0|> def test_YearAnalyzer(self): """This tests YearAnalyzer class""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_10k_train_004840
2,909
no_license
[ { "docstring": "This tests StateAnalyzer class", "name": "test_StateAnalyzer", "signature": "def test_StateAnalyzer(self)" }, { "docstring": "This tests YearAnalyzer class", "name": "test_YearAnalyzer", "signature": "def test_YearAnalyzer(self)" } ]
2
null
Implement the Python class `DataHandlerTest` described below. Class description: Unit Test for DataHandlers in DataHandler.py Method signatures and docstrings: - def test_StateAnalyzer(self): This tests StateAnalyzer class - def test_YearAnalyzer(self): This tests YearAnalyzer class
Implement the Python class `DataHandlerTest` described below. Class description: Unit Test for DataHandlers in DataHandler.py Method signatures and docstrings: - def test_StateAnalyzer(self): This tests StateAnalyzer class - def test_YearAnalyzer(self): This tests YearAnalyzer class <|skeleton|> class DataHandlerTes...
dc9185cbc5e65650d985ebecf877a157c8c19a13
<|skeleton|> class DataHandlerTest: """Unit Test for DataHandlers in DataHandler.py""" def test_StateAnalyzer(self): """This tests StateAnalyzer class""" <|body_0|> def test_YearAnalyzer(self): """This tests YearAnalyzer class""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DataHandlerTest: """Unit Test for DataHandlers in DataHandler.py""" def test_StateAnalyzer(self): """This tests StateAnalyzer class""" stateanalyzer = DH.StateAnalyzer(mergeddata) VALID_STATES = stateanalyzer.get_state_list() self.assertEqual(len(VALID_STATES), 55) ...
the_stack_v2_python_sparse
FINAL_PROJECT/PROJECT/test.py
ds-ga-1007/final_project
train
0
2c7ab504802770985868fb45a4c59d1f2a8b6c40
[ "qn = db.connection.ops.quote_name\nqs = _select_related_instances(Entry, 'section', [1], 'batch_select_entry', 'section_id')\ndb.reset_queries()\nlist(qs)\nsql = db.connection.queries[-1]['sql']\nself.failUnless(sql.startswith('SELECT (%s.%s) AS ' % (qn('batch_select_entry'), qn('section_id'))))", "section = Sec...
<|body_start_0|> qn = db.connection.ops.quote_name qs = _select_related_instances(Entry, 'section', [1], 'batch_select_entry', 'section_id') db.reset_queries() list(qs) sql = db.connection.queries[-1]['sql'] self.failUnless(sql.startswith('SELECT (%s.%s) AS ' % (qn('batch...
Ensure correct quoting of table and field names in queries
QuotingTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuotingTestCase: """Ensure correct quoting of table and field names in queries""" def test_uses_backend_specific_quoting(self): """Backend-specific quotes should be used Table and field names should be quoted with the quote_name function provided by the database backend. The test her...
stack_v2_sparse_classes_10k_train_004841
39,573
no_license
[ { "docstring": "Backend-specific quotes should be used Table and field names should be quoted with the quote_name function provided by the database backend. The test here is a bit trivial since a real-life test case with PostgreSQL schema tricks or other table/field name munging would be difficult.", "name"...
2
null
Implement the Python class `QuotingTestCase` described below. Class description: Ensure correct quoting of table and field names in queries Method signatures and docstrings: - def test_uses_backend_specific_quoting(self): Backend-specific quotes should be used Table and field names should be quoted with the quote_nam...
Implement the Python class `QuotingTestCase` described below. Class description: Ensure correct quoting of table and field names in queries Method signatures and docstrings: - def test_uses_backend_specific_quoting(self): Backend-specific quotes should be used Table and field names should be quoted with the quote_nam...
0ac6653219c2701c13c508c5c4fc9bc3437eea06
<|skeleton|> class QuotingTestCase: """Ensure correct quoting of table and field names in queries""" def test_uses_backend_specific_quoting(self): """Backend-specific quotes should be used Table and field names should be quoted with the quote_name function provided by the database backend. The test her...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QuotingTestCase: """Ensure correct quoting of table and field names in queries""" def test_uses_backend_specific_quoting(self): """Backend-specific quotes should be used Table and field names should be quoted with the quote_name function provided by the database backend. The test here is a bit tr...
the_stack_v2_python_sparse
repoData/lilspikey-django-batch-select/allPythonContent.py
aCoffeeYin/pyreco
train
0
9791e5658365f86124c8501423c9844651c25687
[ "noval_lis = response.xpath('//ul[@class=\"all-img-list cf\"]/li')\nfor noval_li in noval_lis:\n novalItem = QidianNovalItem()\n novalItem['coverImage'] = 'https:' + noval_li.xpath('.//div[@class=\"book-img-box\"]//img/@src').extract_first('')\n novalItem['coverImage'] = 'https:' + noval_li.css('div.book-i...
<|body_start_0|> noval_lis = response.xpath('//ul[@class="all-img-list cf"]/li') for noval_li in noval_lis: novalItem = QidianNovalItem() novalItem['coverImage'] = 'https:' + noval_li.xpath('.//div[@class="book-img-box"]//img/@src').extract_first('') novalItem['coverI...
QdSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QdSpider: def parse(self, response): """获取当前页书籍的列表,遍历 :param response: :return:""" <|body_0|> def parse_noval_detail(self, response): """获取书籍详情信息,提取章节信息 :param response: :return:""" <|body_1|> def parse_dynamic_chpater(self, response): """解析动态加载的...
stack_v2_sparse_classes_10k_train_004842
6,824
no_license
[ { "docstring": "获取当前页书籍的列表,遍历 :param response: :return:", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "获取书籍详情信息,提取章节信息 :param response: :return:", "name": "parse_noval_detail", "signature": "def parse_noval_detail(self, response)" }, { "docstring":...
4
stack_v2_sparse_classes_30k_train_001321
Implement the Python class `QdSpider` described below. Class description: Implement the QdSpider class. Method signatures and docstrings: - def parse(self, response): 获取当前页书籍的列表,遍历 :param response: :return: - def parse_noval_detail(self, response): 获取书籍详情信息,提取章节信息 :param response: :return: - def parse_dynamic_chpater...
Implement the Python class `QdSpider` described below. Class description: Implement the QdSpider class. Method signatures and docstrings: - def parse(self, response): 获取当前页书籍的列表,遍历 :param response: :return: - def parse_noval_detail(self, response): 获取书籍详情信息,提取章节信息 :param response: :return: - def parse_dynamic_chpater...
15e1322dcc36de4f1d1e467525761746cadb58fa
<|skeleton|> class QdSpider: def parse(self, response): """获取当前页书籍的列表,遍历 :param response: :return:""" <|body_0|> def parse_noval_detail(self, response): """获取书籍详情信息,提取章节信息 :param response: :return:""" <|body_1|> def parse_dynamic_chpater(self, response): """解析动态加载的...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QdSpider: def parse(self, response): """获取当前页书籍的列表,遍历 :param response: :return:""" noval_lis = response.xpath('//ul[@class="all-img-list cf"]/li') for noval_li in noval_lis: novalItem = QidianNovalItem() novalItem['coverImage'] = 'https:' + noval_li.xpath('.//di...
the_stack_v2_python_sparse
Code/爬虫/scrapy框架/qidian3/qidian/qidian/spiders/qd.py
wangxuyongkang/chengxuyuanhh
train
1
29e410f316a23309c2b6ec290b4b3c340e6b8022
[ "before_head = ListNode(0)\nbefore_head.next = head\nlength = 0\nnode = before_head\nwhile node:\n length += 1\n node = node.next\nlength = length - n\nnode = before_head\nfor _ in range(length - 1):\n node = node.next\nnode.next = node.next.next\nreturn before_head.next", "before_head = ListNode(0)\nbef...
<|body_start_0|> before_head = ListNode(0) before_head.next = head length = 0 node = before_head while node: length += 1 node = node.next length = length - n node = before_head for _ in range(length - 1): node = node.nex...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeNthFromEnd_twice(self, head: ListNode, n: int): """双遍历法, 第一次得出链表长度; 第二次删除结点。 时间复杂度O(L)L为链表长度,操作执行了 2L-n2L−n 步,时间复杂度为 O(L)O(L)。 空间复杂度:O(1)常量级额外空间。 :param head: :param n: :return:ListNode""" <|body_0|> def removeNthFromEnd_onece(self, head: ListNode, n: int...
stack_v2_sparse_classes_10k_train_004843
3,536
no_license
[ { "docstring": "双遍历法, 第一次得出链表长度; 第二次删除结点。 时间复杂度O(L)L为链表长度,操作执行了 2L-n2L−n 步,时间复杂度为 O(L)O(L)。 空间复杂度:O(1)常量级额外空间。 :param head: :param n: :return:ListNode", "name": "removeNthFromEnd_twice", "signature": "def removeNthFromEnd_twice(self, head: ListNode, n: int)" }, { "docstring": "单次遍历法, 快慢指针,后一个指针慢...
2
stack_v2_sparse_classes_30k_train_001460
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd_twice(self, head: ListNode, n: int): 双遍历法, 第一次得出链表长度; 第二次删除结点。 时间复杂度O(L)L为链表长度,操作执行了 2L-n2L−n 步,时间复杂度为 O(L)O(L)。 空间复杂度:O(1)常量级额外空间。 :param head: :param n: :r...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd_twice(self, head: ListNode, n: int): 双遍历法, 第一次得出链表长度; 第二次删除结点。 时间复杂度O(L)L为链表长度,操作执行了 2L-n2L−n 步,时间复杂度为 O(L)O(L)。 空间复杂度:O(1)常量级额外空间。 :param head: :param n: :r...
62ad010a992c031e8c0fe4d1a9b6f9364f96ed4c
<|skeleton|> class Solution: def removeNthFromEnd_twice(self, head: ListNode, n: int): """双遍历法, 第一次得出链表长度; 第二次删除结点。 时间复杂度O(L)L为链表长度,操作执行了 2L-n2L−n 步,时间复杂度为 O(L)O(L)。 空间复杂度:O(1)常量级额外空间。 :param head: :param n: :return:ListNode""" <|body_0|> def removeNthFromEnd_onece(self, head: ListNode, n: int...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def removeNthFromEnd_twice(self, head: ListNode, n: int): """双遍历法, 第一次得出链表长度; 第二次删除结点。 时间复杂度O(L)L为链表长度,操作执行了 2L-n2L−n 步,时间复杂度为 O(L)O(L)。 空间复杂度:O(1)常量级额外空间。 :param head: :param n: :return:ListNode""" before_head = ListNode(0) before_head.next = head length = 0 ...
the_stack_v2_python_sparse
leetcode/solved/019_.py
usnnu/python_foundation
train
0
fe92d06a52de1b051d244e5cb360594f948fe353
[ "url = self.ip + '/api/scm/auth/scm/scmPoD/detailList.do'\nparams = {'status': 'NotReceived', 'poCode': order_no}\nr = self.s.post(url=url, params=params)\nreturn r.json()", "url = self.ip + '/api/scm//auth/scm/scmPoD/receive.do'\nparams = {'status': 'Received', 'deliveryDay': get_future_date(7), 'ids': ids}\nr =...
<|body_start_0|> url = self.ip + '/api/scm/auth/scm/scmPoD/detailList.do' params = {'status': 'NotReceived', 'poCode': order_no} r = self.s.post(url=url, params=params) return r.json() <|end_body_0|> <|body_start_1|> url = self.ip + '/api/scm//auth/scm/scmPoD/receive.do' ...
B2BPurchaseOrder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class B2BPurchaseOrder: def purchase_order_search_by_no(self, order_no): """通过采购订单号查询采购订单明细 :param order_no: 采购订单号 :return:""" <|body_0|> def receive_purchase_order(self, ids): """供应商订单确认 :param ids: 明细id :return:""" <|body_1|> def return_purchase_order(self, ...
stack_v2_sparse_classes_10k_train_004844
2,159
no_license
[ { "docstring": "通过采购订单号查询采购订单明细 :param order_no: 采购订单号 :return:", "name": "purchase_order_search_by_no", "signature": "def purchase_order_search_by_no(self, order_no)" }, { "docstring": "供应商订单确认 :param ids: 明细id :return:", "name": "receive_purchase_order", "signature": "def receive_purch...
4
stack_v2_sparse_classes_30k_train_003415
Implement the Python class `B2BPurchaseOrder` described below. Class description: Implement the B2BPurchaseOrder class. Method signatures and docstrings: - def purchase_order_search_by_no(self, order_no): 通过采购订单号查询采购订单明细 :param order_no: 采购订单号 :return: - def receive_purchase_order(self, ids): 供应商订单确认 :param ids: 明细id...
Implement the Python class `B2BPurchaseOrder` described below. Class description: Implement the B2BPurchaseOrder class. Method signatures and docstrings: - def purchase_order_search_by_no(self, order_no): 通过采购订单号查询采购订单明细 :param order_no: 采购订单号 :return: - def receive_purchase_order(self, ids): 供应商订单确认 :param ids: 明细id...
26d2ae773a999fd8446e18f9c0719d46402b19aa
<|skeleton|> class B2BPurchaseOrder: def purchase_order_search_by_no(self, order_no): """通过采购订单号查询采购订单明细 :param order_no: 采购订单号 :return:""" <|body_0|> def receive_purchase_order(self, ids): """供应商订单确认 :param ids: 明细id :return:""" <|body_1|> def return_purchase_order(self, ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class B2BPurchaseOrder: def purchase_order_search_by_no(self, order_no): """通过采购订单号查询采购订单明细 :param order_no: 采购订单号 :return:""" url = self.ip + '/api/scm/auth/scm/scmPoD/detailList.do' params = {'status': 'NotReceived', 'poCode': order_no} r = self.s.post(url=url, params=params) ...
the_stack_v2_python_sparse
api/B2B_purchase_order_api.py
Leofighting/dimi_api_test
train
0
c34fb1d0a867859dfc425bf4de2cf0985197f464
[ "with open(calls_dir + self.complexity + '.py', 'r') as f:\n self.code_cfg = f.read()\nself.R_rates = Rrates(self.R_rates)\nassert self.N > 1, 'N should be >1'\nassert self.trim <= 0, 'trim should be negative or zero'\nself.init_date = strevaldate(self.init_date)\nassert os.path.exists(self.workdir), 'Workdir ' ...
<|body_start_0|> with open(calls_dir + self.complexity + '.py', 'r') as f: self.code_cfg = f.read() self.R_rates = Rrates(self.R_rates) assert self.N > 1, 'N should be >1' assert self.trim <= 0, 'trim should be negative or zero' self.init_date = strevaldate(self.init_...
Creates model call.
ModelCall
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelCall: """Creates model call.""" def __post_init__(self): """Model Call.""" <|body_0|> def gencode(self): """Create Model Call code.""" <|body_1|> def unusedVars(self): """Find defined, yet unused variables.""" <|body_2|> <|end_s...
stack_v2_sparse_classes_10k_train_004845
9,166
permissive
[ { "docstring": "Model Call.", "name": "__post_init__", "signature": "def __post_init__(self)" }, { "docstring": "Create Model Call code.", "name": "gencode", "signature": "def gencode(self)" }, { "docstring": "Find defined, yet unused variables.", "name": "unusedVars", "s...
3
stack_v2_sparse_classes_30k_train_000892
Implement the Python class `ModelCall` described below. Class description: Creates model call. Method signatures and docstrings: - def __post_init__(self): Model Call. - def gencode(self): Create Model Call code. - def unusedVars(self): Find defined, yet unused variables.
Implement the Python class `ModelCall` described below. Class description: Creates model call. Method signatures and docstrings: - def __post_init__(self): Model Call. - def gencode(self): Create Model Call code. - def unusedVars(self): Find defined, yet unused variables. <|skeleton|> class ModelCall: """Creates...
2d7e3621b472146a262745900ab143ba18ba0340
<|skeleton|> class ModelCall: """Creates model call.""" def __post_init__(self): """Model Call.""" <|body_0|> def gencode(self): """Create Model Call code.""" <|body_1|> def unusedVars(self): """Find defined, yet unused variables.""" <|body_2|> <|end_s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ModelCall: """Creates model call.""" def __post_init__(self): """Model Call.""" with open(calls_dir + self.complexity + '.py', 'r') as f: self.code_cfg = f.read() self.R_rates = Rrates(self.R_rates) assert self.N > 1, 'N should be >1' assert self.trim <...
the_stack_v2_python_sparse
victoriaepi/configparsing/modelcalls.py
victoriaepidemics/Victoria
train
5
ba895f997106d4fd656ba44b2994b363a664f2d5
[ "params = Response(job_id=job_id)\nlog.info('删除任务[params: %s]' % str(params))\nreturn params", "params = Response(job_id=job_id)\nlog.info('获取任务[params: %s]' % str(params))\nreturn params", "payload = get_payload()\nparams = Response(job_id=job_id, interface_id=int(payload.get('interface_id', 0)), job_name=payl...
<|body_start_0|> params = Response(job_id=job_id) log.info('删除任务[params: %s]' % str(params)) return params <|end_body_0|> <|body_start_1|> params = Response(job_id=job_id) log.info('获取任务[params: %s]' % str(params)) return params <|end_body_1|> <|body_start_2|> p...
JobDetail
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JobDetail: def delete(job_id): """删除任务""" <|body_0|> def get(job_id): """获取任务""" <|body_1|> def put(job_id): """修改任务""" <|body_2|> <|end_skeleton|> <|body_start_0|> params = Response(job_id=job_id) log.info('删除任务[params:...
stack_v2_sparse_classes_10k_train_004846
6,246
no_license
[ { "docstring": "删除任务", "name": "delete", "signature": "def delete(job_id)" }, { "docstring": "获取任务", "name": "get", "signature": "def get(job_id)" }, { "docstring": "修改任务", "name": "put", "signature": "def put(job_id)" } ]
3
stack_v2_sparse_classes_30k_train_000401
Implement the Python class `JobDetail` described below. Class description: Implement the JobDetail class. Method signatures and docstrings: - def delete(job_id): 删除任务 - def get(job_id): 获取任务 - def put(job_id): 修改任务
Implement the Python class `JobDetail` described below. Class description: Implement the JobDetail class. Method signatures and docstrings: - def delete(job_id): 删除任务 - def get(job_id): 获取任务 - def put(job_id): 修改任务 <|skeleton|> class JobDetail: def delete(job_id): """删除任务""" <|body_0|> def ...
0374684612a13af1e4d41dcd97ba8c80ecd89710
<|skeleton|> class JobDetail: def delete(job_id): """删除任务""" <|body_0|> def get(job_id): """获取任务""" <|body_1|> def put(job_id): """修改任务""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class JobDetail: def delete(job_id): """删除任务""" params = Response(job_id=job_id) log.info('删除任务[params: %s]' % str(params)) return params def get(job_id): """获取任务""" params = Response(job_id=job_id) log.info('获取任务[params: %s]' % str(params)) retur...
the_stack_v2_python_sparse
resources/job.py
ChanningWong/HCNDC-web
train
0
1cb7e12870b02736a70ac0bc4dc678eea4cf5a88
[ "self.stack = []\nself.max_size = 5\nself.top = 0", "if self.top == self.max_size:\n print('Stack Overflow\\n')\nelse:\n self.stack.append(item)\n self.top += 1", "if self.top == 0:\n print('Stack Underflow\\n')\nelse:\n self.stack.pop()\n self.top -= 1", "if self.top == 0:\n print('Stack...
<|body_start_0|> self.stack = [] self.max_size = 5 self.top = 0 <|end_body_0|> <|body_start_1|> if self.top == self.max_size: print('Stack Overflow\n') else: self.stack.append(item) self.top += 1 <|end_body_1|> <|body_start_2|> if sel...
The class Stack contains all the helper functions for stack implementation.
Stack
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Stack: """The class Stack contains all the helper functions for stack implementation.""" def __init__(self): """Arguments: self -- reference to the object.""" <|body_0|> def push(self, item): """The function will push the required item to the stack. Arguments: se...
stack_v2_sparse_classes_10k_train_004847
1,815
no_license
[ { "docstring": "Arguments: self -- reference to the object.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "The function will push the required item to the stack. Arguments: self -- reference to the object. item -- item to be pushed.", "name": "push", "signatur...
4
stack_v2_sparse_classes_30k_test_000352
Implement the Python class `Stack` described below. Class description: The class Stack contains all the helper functions for stack implementation. Method signatures and docstrings: - def __init__(self): Arguments: self -- reference to the object. - def push(self, item): The function will push the required item to the...
Implement the Python class `Stack` described below. Class description: The class Stack contains all the helper functions for stack implementation. Method signatures and docstrings: - def __init__(self): Arguments: self -- reference to the object. - def push(self, item): The function will push the required item to the...
6870426104aef417086788221dad29e887ddfe3f
<|skeleton|> class Stack: """The class Stack contains all the helper functions for stack implementation.""" def __init__(self): """Arguments: self -- reference to the object.""" <|body_0|> def push(self, item): """The function will push the required item to the stack. Arguments: se...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Stack: """The class Stack contains all the helper functions for stack implementation.""" def __init__(self): """Arguments: self -- reference to the object.""" self.stack = [] self.max_size = 5 self.top = 0 def push(self, item): """The function will push the re...
the_stack_v2_python_sparse
Data Structure/02. Stack/01. Stack Implementation/py_code.py
Slothfulwave612/Coding-Problems
train
5
8cb5ee0e7fa87bca8beeb005f6cc9b75065fc694
[ "mile_rule = self.env.ref('metro_park_base_data_10.repair_rule_l')\nfor record in self:\n if record.rule and record.rule.id == mile_rule.id:\n record.is_mile = True", "if len(self) == 0:\n return\nfor record in self:\n if not record.plan_id or not record.dev:\n continue\n pre_date_train_...
<|body_start_0|> mile_rule = self.env.ref('metro_park_base_data_10.repair_rule_l') for record in self: if record.rule and record.rule.id == mile_rule.id: record.is_mile = True <|end_body_0|> <|body_start_1|> if len(self) == 0: return for record in...
日计划设备检修信息,包含计划内容和日常维护及运行内容
RuleInfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RuleInfo: """日计划设备检修信息,包含计划内容和日常维护及运行内容""" def _compute_is_mile(self): """计算是否为公里数 :return:""" <|body_0|> def _compute_last_repair_info(self): """计算上次里程修信息 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> mile_rule = self.env.ref('metro_...
stack_v2_sparse_classes_10k_train_004848
1,559
no_license
[ { "docstring": "计算是否为公里数 :return:", "name": "_compute_is_mile", "signature": "def _compute_is_mile(self)" }, { "docstring": "计算上次里程修信息 :return:", "name": "_compute_last_repair_info", "signature": "def _compute_last_repair_info(self)" } ]
2
stack_v2_sparse_classes_30k_train_006616
Implement the Python class `RuleInfo` described below. Class description: 日计划设备检修信息,包含计划内容和日常维护及运行内容 Method signatures and docstrings: - def _compute_is_mile(self): 计算是否为公里数 :return: - def _compute_last_repair_info(self): 计算上次里程修信息 :return:
Implement the Python class `RuleInfo` described below. Class description: 日计划设备检修信息,包含计划内容和日常维护及运行内容 Method signatures and docstrings: - def _compute_is_mile(self): 计算是否为公里数 :return: - def _compute_last_repair_info(self): 计算上次里程修信息 :return: <|skeleton|> class RuleInfo: """日计划设备检修信息,包含计划内容和日常维护及运行内容""" def _...
13b428a5c4ade6278e3e5e996ef10d9fb0fea4b9
<|skeleton|> class RuleInfo: """日计划设备检修信息,包含计划内容和日常维护及运行内容""" def _compute_is_mile(self): """计算是否为公里数 :return:""" <|body_0|> def _compute_last_repair_info(self): """计算上次里程修信息 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RuleInfo: """日计划设备检修信息,包含计划内容和日常维护及运行内容""" def _compute_is_mile(self): """计算是否为公里数 :return:""" mile_rule = self.env.ref('metro_park_base_data_10.repair_rule_l') for record in self: if record.rule and record.rule.id == mile_rule.id: record.is_mile = True...
the_stack_v2_python_sparse
mdias_addons/metro_park_base_data_10/models/plan_date_rule_info.py
rezaghanimi/main_mdias
train
0
106608ec916d8fda7aa5c9b67190395162accb91
[ "data.config.fps = self.read_int(root, self.FPS, data.config.fps)\ndata.config.max_frame_time = self.read_float(root, self.MAX_FRAME_TIME, data.config.max_frame_time)\ndata.config.num_fps_avg = self.read_int(root, self.NUM_FPS_AVG, data.config.num_fps_avg)\ndata.config.render_decision_trees = self.read_boolean(root...
<|body_start_0|> data.config.fps = self.read_int(root, self.FPS, data.config.fps) data.config.max_frame_time = self.read_float(root, self.MAX_FRAME_TIME, data.config.max_frame_time) data.config.num_fps_avg = self.read_int(root, self.NUM_FPS_AVG, data.config.num_fps_avg) data.config.rende...
Yaml reader for config types. Constants: ACTION FPS KEY KEYS MAX_FRAME_TIME NUM_FPS_AVG RENDER_DECISION_TREES SCROLL_WIDTH_X SCROLL_WIDTH_Y STATE_ID VIEW_X VIEW_Y WINDOW_TITLE
YamlConfigReader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class YamlConfigReader: """Yaml reader for config types. Constants: ACTION FPS KEY KEYS MAX_FRAME_TIME NUM_FPS_AVG RENDER_DECISION_TREES SCROLL_WIDTH_X SCROLL_WIDTH_Y STATE_ID VIEW_X VIEW_Y WINDOW_TITLE""" def parse(self, root, data): """Parse the game structure. Writes the parsed informat...
stack_v2_sparse_classes_10k_train_004849
2,266
no_license
[ { "docstring": "Parse the game structure. Writes the parsed information into the data object.", "name": "parse", "signature": "def parse(self, root, data)" }, { "docstring": "Parse keys.", "name": "__keys", "signature": "def __keys(self, root, data)" } ]
2
stack_v2_sparse_classes_30k_train_007315
Implement the Python class `YamlConfigReader` described below. Class description: Yaml reader for config types. Constants: ACTION FPS KEY KEYS MAX_FRAME_TIME NUM_FPS_AVG RENDER_DECISION_TREES SCROLL_WIDTH_X SCROLL_WIDTH_Y STATE_ID VIEW_X VIEW_Y WINDOW_TITLE Method signatures and docstrings: - def parse(self, root, da...
Implement the Python class `YamlConfigReader` described below. Class description: Yaml reader for config types. Constants: ACTION FPS KEY KEYS MAX_FRAME_TIME NUM_FPS_AVG RENDER_DECISION_TREES SCROLL_WIDTH_X SCROLL_WIDTH_Y STATE_ID VIEW_X VIEW_Y WINDOW_TITLE Method signatures and docstrings: - def parse(self, root, da...
c38b43edb7ec54f18768564c42859195bc2477e4
<|skeleton|> class YamlConfigReader: """Yaml reader for config types. Constants: ACTION FPS KEY KEYS MAX_FRAME_TIME NUM_FPS_AVG RENDER_DECISION_TREES SCROLL_WIDTH_X SCROLL_WIDTH_Y STATE_ID VIEW_X VIEW_Y WINDOW_TITLE""" def parse(self, root, data): """Parse the game structure. Writes the parsed informat...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class YamlConfigReader: """Yaml reader for config types. Constants: ACTION FPS KEY KEYS MAX_FRAME_TIME NUM_FPS_AVG RENDER_DECISION_TREES SCROLL_WIDTH_X SCROLL_WIDTH_Y STATE_ID VIEW_X VIEW_Y WINDOW_TITLE""" def parse(self, root, data): """Parse the game structure. Writes the parsed information into the ...
the_stack_v2_python_sparse
python-prototype/config/configreader.py
tea2code/fantasy-rts
train
0
f0d7d0a5b878b74c30b96cfaddc37c69646c1895
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn WindowsAutopilotDeviceIdentity()", "from .enrollment_state import EnrollmentState\nfrom .entity import Entity\nfrom .enrollment_state import EnrollmentState\nfrom .entity import Entity\nfields: Dict[str, Callable[[Any], None]] = {'addr...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return WindowsAutopilotDeviceIdentity() <|end_body_0|> <|body_start_1|> from .enrollment_state import EnrollmentState from .entity import Entity from .enrollment_state import Enrollment...
The windowsAutopilotDeviceIdentity resource represents a Windows Autopilot Device.
WindowsAutopilotDeviceIdentity
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WindowsAutopilotDeviceIdentity: """The windowsAutopilotDeviceIdentity resource represents a Windows Autopilot Device.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsAutopilotDeviceIdentity: """Creates a new instance of the appropriate class bas...
stack_v2_sparse_classes_10k_train_004850
6,119
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: WindowsAutopilotDeviceIdentity", "name": "create_from_discriminator_value", "signature": "def create_from_di...
3
stack_v2_sparse_classes_30k_test_000088
Implement the Python class `WindowsAutopilotDeviceIdentity` described below. Class description: The windowsAutopilotDeviceIdentity resource represents a Windows Autopilot Device. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsAutopilotDeviceIden...
Implement the Python class `WindowsAutopilotDeviceIdentity` described below. Class description: The windowsAutopilotDeviceIdentity resource represents a Windows Autopilot Device. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsAutopilotDeviceIden...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class WindowsAutopilotDeviceIdentity: """The windowsAutopilotDeviceIdentity resource represents a Windows Autopilot Device.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsAutopilotDeviceIdentity: """Creates a new instance of the appropriate class bas...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WindowsAutopilotDeviceIdentity: """The windowsAutopilotDeviceIdentity resource represents a Windows Autopilot Device.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsAutopilotDeviceIdentity: """Creates a new instance of the appropriate class based on discrim...
the_stack_v2_python_sparse
msgraph/generated/models/windows_autopilot_device_identity.py
microsoftgraph/msgraph-sdk-python
train
135
fce59d35390e58115b540b80fb507735f53a267c
[ "valid, message = json_validate(nrange, {'type': 'object', 'properties': {'lower': {'$ref': '#/pScheduler/Numeric'}, 'upper': {'$ref': '#/pScheduler/Numeric'}}, 'additionalProperties': False, 'required': ['lower', 'upper']})\nif not valid:\n raise ValueError('Invalid numeric range: %s' % message)\nlower = nrange...
<|body_start_0|> valid, message = json_validate(nrange, {'type': 'object', 'properties': {'lower': {'$ref': '#/pScheduler/Numeric'}, 'upper': {'$ref': '#/pScheduler/Numeric'}}, 'additionalProperties': False, 'required': ['lower', 'upper']}) if not valid: raise ValueError('Invalid numeric ran...
Range of numbers
NumericRange
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumericRange: """Range of numbers""" def __init__(self, nrange): """Construct a range from a JSON NumericRange.""" <|body_0|> def __contains__(self, number): """See if the range contains the specified number, which can be any Numeric.""" <|body_1|> d...
stack_v2_sparse_classes_10k_train_004851
2,607
permissive
[ { "docstring": "Construct a range from a JSON NumericRange.", "name": "__init__", "signature": "def __init__(self, nrange)" }, { "docstring": "See if the range contains the specified number, which can be any Numeric.", "name": "__contains__", "signature": "def __contains__(self, number)"...
3
stack_v2_sparse_classes_30k_test_000153
Implement the Python class `NumericRange` described below. Class description: Range of numbers Method signatures and docstrings: - def __init__(self, nrange): Construct a range from a JSON NumericRange. - def __contains__(self, number): See if the range contains the specified number, which can be any Numeric. - def c...
Implement the Python class `NumericRange` described below. Class description: Range of numbers Method signatures and docstrings: - def __init__(self, nrange): Construct a range from a JSON NumericRange. - def __contains__(self, number): See if the range contains the specified number, which can be any Numeric. - def c...
f6d04c0455e5be4d490df16ec1acb377f9025d9f
<|skeleton|> class NumericRange: """Range of numbers""" def __init__(self, nrange): """Construct a range from a JSON NumericRange.""" <|body_0|> def __contains__(self, number): """See if the range contains the specified number, which can be any Numeric.""" <|body_1|> d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NumericRange: """Range of numbers""" def __init__(self, nrange): """Construct a range from a JSON NumericRange.""" valid, message = json_validate(nrange, {'type': 'object', 'properties': {'lower': {'$ref': '#/pScheduler/Numeric'}, 'upper': {'$ref': '#/pScheduler/Numeric'}}, 'additionalPro...
the_stack_v2_python_sparse
python-pscheduler/pscheduler/pscheduler/numericrange.py
perfsonar/pscheduler
train
53
8fb919f2a151a8a579f812aecd079f6dab826d28
[ "super(InversePunisher, self).__init__()\nself.history = []\nself.mem_length = 1\nself.grudged = False\nself.grudge_memory = 1", "if self.grudge_memory >= self.mem_length:\n self.grudge_memory = 0\n self.grudged = False\nif self.grudged:\n self.grudge_memory += 1\n return 'D'\nelif 'D' in opponent.his...
<|body_start_0|> super(InversePunisher, self).__init__() self.history = [] self.mem_length = 1 self.grudged = False self.grudge_memory = 1 <|end_body_0|> <|body_start_1|> if self.grudge_memory >= self.mem_length: self.grudge_memory = 0 self.grudge...
A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches, with 1<=mem_length<=20 proportional to the amount of time the opponent has played 'C'. The inverse of Punisher
InversePunisher
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InversePunisher: """A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches, with 1<=mem_length<=20 proportional to the amount of time the opponent has played 'C'. The inverse of Punisher""" def __init__(self): ...
stack_v2_sparse_classes_10k_train_004852
3,311
permissive
[ { "docstring": "Initialised the player", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Begins by playing C, then plays D for an amount of rounds proportional to the opponents historical '%' of playing 'C' if the opponent ever plays D", "name": "strategy", "sign...
3
stack_v2_sparse_classes_30k_test_000291
Implement the Python class `InversePunisher` described below. Class description: A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches, with 1<=mem_length<=20 proportional to the amount of time the opponent has played 'C'. The inverse of Pun...
Implement the Python class `InversePunisher` described below. Class description: A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches, with 1<=mem_length<=20 proportional to the amount of time the opponent has played 'C'. The inverse of Pun...
0ce3aa29eb239b9a9055cd7bebb627602851b65a
<|skeleton|> class InversePunisher: """A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches, with 1<=mem_length<=20 proportional to the amount of time the opponent has played 'C'. The inverse of Punisher""" def __init__(self): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InversePunisher: """A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches, with 1<=mem_length<=20 proportional to the amount of time the opponent has played 'C'. The inverse of Punisher""" def __init__(self): """Initial...
the_stack_v2_python_sparse
axelrod/strategies/punisher.py
jamesbroadhead/Axelrod
train
1
06fa5eb377475ec063b4c10df95fe89990487693
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn MobileThreatDefenseConnector()", "from .entity import Entity\nfrom .mobile_threat_partner_tenant_state import MobileThreatPartnerTenantState\nfrom .entity import Entity\nfrom .mobile_threat_partner_tenant_state import MobileThreatPartn...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return MobileThreatDefenseConnector() <|end_body_0|> <|body_start_1|> from .entity import Entity from .mobile_threat_partner_tenant_state import MobileThreatPartnerTenantState from .ent...
Entity which represents a connection to Mobile Threat Defense partner.
MobileThreatDefenseConnector
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MobileThreatDefenseConnector: """Entity which represents a connection to Mobile Threat Defense partner.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MobileThreatDefenseConnector: """Creates a new instance of the appropriate class based on discrimina...
stack_v2_sparse_classes_10k_train_004853
10,079
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: MobileThreatDefenseConnector", "name": "create_from_discriminator_value", "signature": "def create_from_disc...
3
null
Implement the Python class `MobileThreatDefenseConnector` described below. Class description: Entity which represents a connection to Mobile Threat Defense partner. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MobileThreatDefenseConnector: Creates a ...
Implement the Python class `MobileThreatDefenseConnector` described below. Class description: Entity which represents a connection to Mobile Threat Defense partner. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MobileThreatDefenseConnector: Creates a ...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class MobileThreatDefenseConnector: """Entity which represents a connection to Mobile Threat Defense partner.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MobileThreatDefenseConnector: """Creates a new instance of the appropriate class based on discrimina...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MobileThreatDefenseConnector: """Entity which represents a connection to Mobile Threat Defense partner.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MobileThreatDefenseConnector: """Creates a new instance of the appropriate class based on discriminator value Arg...
the_stack_v2_python_sparse
msgraph/generated/models/mobile_threat_defense_connector.py
microsoftgraph/msgraph-sdk-python
train
135
24eda61b4eb9bf82940f548487f7ff09425ca867
[ "if minfo is None:\n minfo = {}\nsuper(DumpJournalValueMessage, self).__init__(minfo)\nself.IsSystemMessage = False\nself.IsForward = True\nself.IsReliable = True\nself.TransactionType = minfo.get('TransactionType')\nself.Name = minfo.get('Name')", "result = super(DumpJournalValueMessage, self).dump()\nresult[...
<|body_start_0|> if minfo is None: minfo = {} super(DumpJournalValueMessage, self).__init__(minfo) self.IsSystemMessage = False self.IsForward = True self.IsReliable = True self.TransactionType = minfo.get('TransactionType') self.Name = minfo.get('Name...
Represents the message format for exchanging dump journal value messages. Attributes: DumpJournalValueMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this message is a system message. IsForward (bool): Whether or not this message is forwarded. IsReliable (bool): Whether ...
DumpJournalValueMessage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DumpJournalValueMessage: """Represents the message format for exchanging dump journal value messages. Attributes: DumpJournalValueMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this message is a system message. IsForward (bool): Whether or not thi...
stack_v2_sparse_classes_10k_train_004854
5,835
permissive
[ { "docstring": "Constructor for the DumpJournalValueMessage class. Args: minfo (dict): A dict containing initial values for the new DumpJournalValueMessage.", "name": "__init__", "signature": "def __init__(self, minfo=None)" }, { "docstring": "Returns a dict containing information about the Dump...
2
stack_v2_sparse_classes_30k_train_002859
Implement the Python class `DumpJournalValueMessage` described below. Class description: Represents the message format for exchanging dump journal value messages. Attributes: DumpJournalValueMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this message is a system messag...
Implement the Python class `DumpJournalValueMessage` described below. Class description: Represents the message format for exchanging dump journal value messages. Attributes: DumpJournalValueMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this message is a system messag...
8f4ca1aab54ef420a0db10c8ca822ec8686cd423
<|skeleton|> class DumpJournalValueMessage: """Represents the message format for exchanging dump journal value messages. Attributes: DumpJournalValueMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this message is a system message. IsForward (bool): Whether or not thi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DumpJournalValueMessage: """Represents the message format for exchanging dump journal value messages. Attributes: DumpJournalValueMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this message is a system message. IsForward (bool): Whether or not this message is ...
the_stack_v2_python_sparse
validator/journal/messages/journal_debug.py
aludvik/sawtooth-core
train
0
f293e995798043f7762271848af4a97fd2196df8
[ "suites = []\nfor s in cls.SUITES:\n s['tests'] = cls._get_tests(s)\n s['approxRunTime'] = cls._get_average_run_time(suite_model)\n suites.append(s)\nreturn suites", "suite_file_name = '{}.py'.format(str(suite['id']).replace('.', os.path.sep))\nwith open(suite_file_name) as f:\n file_contents = f.read...
<|body_start_0|> suites = [] for s in cls.SUITES: s['tests'] = cls._get_tests(s) s['approxRunTime'] = cls._get_average_run_time(suite_model) suites.append(s) return suites <|end_body_0|> <|body_start_1|> suite_file_name = '{}.py'.format(str(suite['id'...
Available test suites provider
SuiteProvider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SuiteProvider: """Available test suites provider""" def get_list(cls, suite_model) -> list: """Return list of available test suites""" <|body_0|> def _get_tests(cls, suite: dict): """Get suite available tests""" <|body_1|> def _get_average_run_time(c...
stack_v2_sparse_classes_10k_train_004855
2,492
no_license
[ { "docstring": "Return list of available test suites", "name": "get_list", "signature": "def get_list(cls, suite_model) -> list" }, { "docstring": "Get suite available tests", "name": "_get_tests", "signature": "def _get_tests(cls, suite: dict)" }, { "docstring": "Get suite avera...
3
stack_v2_sparse_classes_30k_train_000451
Implement the Python class `SuiteProvider` described below. Class description: Available test suites provider Method signatures and docstrings: - def get_list(cls, suite_model) -> list: Return list of available test suites - def _get_tests(cls, suite: dict): Get suite available tests - def _get_average_run_time(cls, ...
Implement the Python class `SuiteProvider` described below. Class description: Available test suites provider Method signatures and docstrings: - def get_list(cls, suite_model) -> list: Return list of available test suites - def _get_tests(cls, suite: dict): Get suite available tests - def _get_average_run_time(cls, ...
4b9c65cf06912fe92d94b3989e0220aae3a31db4
<|skeleton|> class SuiteProvider: """Available test suites provider""" def get_list(cls, suite_model) -> list: """Return list of available test suites""" <|body_0|> def _get_tests(cls, suite: dict): """Get suite available tests""" <|body_1|> def _get_average_run_time(c...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SuiteProvider: """Available test suites provider""" def get_list(cls, suite_model) -> list: """Return list of available test suites""" suites = [] for s in cls.SUITES: s['tests'] = cls._get_tests(s) s['approxRunTime'] = cls._get_average_run_time(suite_model...
the_stack_v2_python_sparse
project/applications/platform-tests/app/suite_provider.py
trustedanalytics/platform-tests
train
2
083b4d2ef37f45594e501aaebf5bab50273e4ce4
[ "if root is None:\n return u'{}'\nl = self.serialize(root.left)\nr = self.serialize(root.right)\nreturn u'{}{}:[{},{}]{}'.format('{', root.val, l, r, '}')", "if data == '{}':\n return None\nval, i, l = (None, 0, len(data))\nfor i in range(1, l):\n if data[i] == ':':\n val = int(data[1:i])\n ...
<|body_start_0|> if root is None: return u'{}' l = self.serialize(root.left) r = self.serialize(root.right) return u'{}{}:[{},{}]{}'.format('{', root.val, l, r, '}') <|end_body_0|> <|body_start_1|> if data == '{}': return None val, i, l = (None, 0...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_004856
4,963
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_val_000282
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
d2e8b2dca40fc955045eb62e576c776bad8ee5f1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if root is None: return u'{}' l = self.serialize(root.left) r = self.serialize(root.right) return u'{}{}:[{},{}]{}'.format('{', root.val, l, r, '}') ...
the_stack_v2_python_sparse
delete-node-in-a-bst/solution.py
childe/leetcode
train
2
24d3b0eb04dc5f105712333dfd3fab3a12da33ed
[ "try:\n qs = PagePermission.objects.subordinate_to_user(request.user)\n return qs.filter(can_view=False)\nexcept NoPermissionsException:\n return self.objects.get_empty_query_set()", "exclude = self.exclude or []\nif obj:\n if not obj.has_add_permission(request):\n exclude.append('can_add')\n ...
<|body_start_0|> try: qs = PagePermission.objects.subordinate_to_user(request.user) return qs.filter(can_view=False) except NoPermissionsException: return self.objects.get_empty_query_set() <|end_body_0|> <|body_start_1|> exclude = self.exclude or [] ...
PagePermissionInlineAdmin
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PagePermissionInlineAdmin: def queryset(self, request): """Queryset change, so user with global change permissions can see all permissions. Otherwise can user see only permissions for peoples which are under him (he can't see his permissions, because this will lead to violation, when he ...
stack_v2_sparse_classes_10k_train_004857
6,886
permissive
[ { "docstring": "Queryset change, so user with global change permissions can see all permissions. Otherwise can user see only permissions for peoples which are under him (he can't see his permissions, because this will lead to violation, when he can add more power to itself)", "name": "queryset", "signat...
2
null
Implement the Python class `PagePermissionInlineAdmin` described below. Class description: Implement the PagePermissionInlineAdmin class. Method signatures and docstrings: - def queryset(self, request): Queryset change, so user with global change permissions can see all permissions. Otherwise can user see only permis...
Implement the Python class `PagePermissionInlineAdmin` described below. Class description: Implement the PagePermissionInlineAdmin class. Method signatures and docstrings: - def queryset(self, request): Queryset change, so user with global change permissions can see all permissions. Otherwise can user see only permis...
abc3fbfb34f791f84e9a9d4dc522966421778ab2
<|skeleton|> class PagePermissionInlineAdmin: def queryset(self, request): """Queryset change, so user with global change permissions can see all permissions. Otherwise can user see only permissions for peoples which are under him (he can't see his permissions, because this will lead to violation, when he ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PagePermissionInlineAdmin: def queryset(self, request): """Queryset change, so user with global change permissions can see all permissions. Otherwise can user see only permissions for peoples which are under him (he can't see his permissions, because this will lead to violation, when he can add more p...
the_stack_v2_python_sparse
py/django_tools/django-cms/cms/admin/permissionadmin.py
marceltoben/evandrix.github.com
train
3
baae2d126980579124c690513037aae4b633096d
[ "res = []\ntotal = 0\nwhile head:\n total += 1\n res.append(head.val)\n head = head.next\nfor i in range(total // 2):\n if res[i] != res[-i - 1]:\n return False\nreturn True", "res = []\ntotal = 0\nwhile head:\n total += 1\n res.append(head.val)\n head = head.next\nreturn res == res[::...
<|body_start_0|> res = [] total = 0 while head: total += 1 res.append(head.val) head = head.next for i in range(total // 2): if res[i] != res[-i - 1]: return False return True <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, head: ListNode) -> bool: """先遍历链表,然后再进行判断 空间复杂度O(n) 时间复杂度O(n) :param head: 单链表 :return: bool True False""" <|body_0|> def isPalindromeMethod1(self, head: ListNode) -> bool: """先遍历链表,然后再进行判断 空间复杂度O(n) 时间复杂度O(n) :param head: 单链表 :return...
stack_v2_sparse_classes_10k_train_004858
1,748
no_license
[ { "docstring": "先遍历链表,然后再进行判断 空间复杂度O(n) 时间复杂度O(n) :param head: 单链表 :return: bool True False", "name": "isPalindrome", "signature": "def isPalindrome(self, head: ListNode) -> bool" }, { "docstring": "先遍历链表,然后再进行判断 空间复杂度O(n) 时间复杂度O(n) :param head: 单链表 :return: bool True False", "name": "isPali...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, head: ListNode) -> bool: 先遍历链表,然后再进行判断 空间复杂度O(n) 时间复杂度O(n) :param head: 单链表 :return: bool True False - def isPalindromeMethod1(self, head: ListNode) -> boo...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, head: ListNode) -> bool: 先遍历链表,然后再进行判断 空间复杂度O(n) 时间复杂度O(n) :param head: 单链表 :return: bool True False - def isPalindromeMethod1(self, head: ListNode) -> boo...
af13162360a28a0bcd71918fd8bff77c41ddcc2a
<|skeleton|> class Solution: def isPalindrome(self, head: ListNode) -> bool: """先遍历链表,然后再进行判断 空间复杂度O(n) 时间复杂度O(n) :param head: 单链表 :return: bool True False""" <|body_0|> def isPalindromeMethod1(self, head: ListNode) -> bool: """先遍历链表,然后再进行判断 空间复杂度O(n) 时间复杂度O(n) :param head: 单链表 :return...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isPalindrome(self, head: ListNode) -> bool: """先遍历链表,然后再进行判断 空间复杂度O(n) 时间复杂度O(n) :param head: 单链表 :return: bool True False""" res = [] total = 0 while head: total += 1 res.append(head.val) head = head.next for i in range...
the_stack_v2_python_sparse
算法分析和归类/链表/回文链表.py
Carmenliukang/leetcode
train
4
1dd8840793332f3881cebaa3f1442f2d61a55931
[ "self.TIDAL_CLIENT_VERSION = '1.9.1'\nself.TIDAL_API_BASE = 'https://api.tidalhifi.com/v1/'\nself.username = username\nself.token = token\nself.unique_id = str(uuid.uuid4()).replace('-', '')[16:]\nself.auth(password)\npassword = None", "postParams = {'username': self.username, 'password': password, 'token': self....
<|body_start_0|> self.TIDAL_CLIENT_VERSION = '1.9.1' self.TIDAL_API_BASE = 'https://api.tidalhifi.com/v1/' self.username = username self.token = token self.unique_id = str(uuid.uuid4()).replace('-', '')[16:] self.auth(password) password = None <|end_body_0|> <|bo...
Tidal session object which can be used to communicate with Tidal servers
TidalSession
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TidalSession: """Tidal session object which can be used to communicate with Tidal servers""" def __init__(self, username, password, token='4zx46pyr9o8qZNRw'): """Initiate a new session""" <|body_0|> def auth(self, password): """Attempts to authorize and create a ...
stack_v2_sparse_classes_10k_train_004859
8,327
permissive
[ { "docstring": "Initiate a new session", "name": "__init__", "signature": "def __init__(self, username, password, token='4zx46pyr9o8qZNRw')" }, { "docstring": "Attempts to authorize and create a new valid session", "name": "auth", "signature": "def auth(self, password)" }, { "doc...
4
stack_v2_sparse_classes_30k_train_001700
Implement the Python class `TidalSession` described below. Class description: Tidal session object which can be used to communicate with Tidal servers Method signatures and docstrings: - def __init__(self, username, password, token='4zx46pyr9o8qZNRw'): Initiate a new session - def auth(self, password): Attempts to au...
Implement the Python class `TidalSession` described below. Class description: Tidal session object which can be used to communicate with Tidal servers Method signatures and docstrings: - def __init__(self, username, password, token='4zx46pyr9o8qZNRw'): Initiate a new session - def auth(self, password): Attempts to au...
2a7e339b97f173efa319abc5e4ec8fc9172f1505
<|skeleton|> class TidalSession: """Tidal session object which can be used to communicate with Tidal servers""" def __init__(self, username, password, token='4zx46pyr9o8qZNRw'): """Initiate a new session""" <|body_0|> def auth(self, password): """Attempts to authorize and create a ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TidalSession: """Tidal session object which can be used to communicate with Tidal servers""" def __init__(self, username, password, token='4zx46pyr9o8qZNRw'): """Initiate a new session""" self.TIDAL_CLIENT_VERSION = '1.9.1' self.TIDAL_API_BASE = 'https://api.tidalhifi.com/v1/' ...
the_stack_v2_python_sparse
bin/redsea/tidal_api.py
SultanSGillani/dotfiles
train
7
797fb86cf9178532e27180ac3077fb00ec8b66ae
[ "self.root = root\nself.stack = []\nself.first = False", "if self.root is None:\n return False\nif self.first is False:\n return True\nnode = self.stack[-1]\nif node.right is not None:\n return True\nelse:\n i = len(self.stack) - 1\n while i > 0:\n if self.stack[i - 1].left == self.stack[i]:...
<|body_start_0|> self.root = root self.stack = [] self.first = False <|end_body_0|> <|body_start_1|> if self.root is None: return False if self.first is False: return True node = self.stack[-1] if node.right is not None: return...
BSTIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BSTIterator: def __init__(self, root): """:type root: TreeNode""" <|body_0|> def hasNext(self): """:rtype: bool""" <|body_1|> def next(self): """:rtype: int""" <|body_2|> <|end_skeleton|> <|body_start_0|> self.root = root ...
stack_v2_sparse_classes_10k_train_004860
1,929
no_license
[ { "docstring": ":type root: TreeNode", "name": "__init__", "signature": "def __init__(self, root)" }, { "docstring": ":rtype: bool", "name": "hasNext", "signature": "def hasNext(self)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" } ]
3
stack_v2_sparse_classes_30k_train_006074
Implement the Python class `BSTIterator` described below. Class description: Implement the BSTIterator class. Method signatures and docstrings: - def __init__(self, root): :type root: TreeNode - def hasNext(self): :rtype: bool - def next(self): :rtype: int
Implement the Python class `BSTIterator` described below. Class description: Implement the BSTIterator class. Method signatures and docstrings: - def __init__(self, root): :type root: TreeNode - def hasNext(self): :rtype: bool - def next(self): :rtype: int <|skeleton|> class BSTIterator: def __init__(self, root...
8075fbb40987d5e6af8d30941a19fa48a3320f56
<|skeleton|> class BSTIterator: def __init__(self, root): """:type root: TreeNode""" <|body_0|> def hasNext(self): """:rtype: bool""" <|body_1|> def next(self): """:rtype: int""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BSTIterator: def __init__(self, root): """:type root: TreeNode""" self.root = root self.stack = [] self.first = False def hasNext(self): """:rtype: bool""" if self.root is None: return False if self.first is False: return Tru...
the_stack_v2_python_sparse
p173/Solution.py
carwestsam/leetCode
train
4
7e3d1048b73e234020ae2b957f547c95734188d7
[ "self.dimension = dimension\nself.coneSize = maxConeSize\nself.nvertices = numVertices\nself.ncells = numCells\nself.cellType = None\nself.initialize()\nreturn", "from Mesh import cellTypes\ntry:\n if self.coneSize > 0:\n self.cellType = cellTypes[self.dimension, self.coneSize]\nexcept:\n raise Value...
<|body_start_0|> self.dimension = dimension self.coneSize = maxConeSize self.nvertices = numVertices self.ncells = numCells self.cellType = None self.initialize() return <|end_body_0|> <|body_start_1|> from Mesh import cellTypes try: i...
Fault object for holding mesh memory and performance information.
Fault
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Fault: """Fault object for holding mesh memory and performance information.""" def __init__(self, dimension=0, maxConeSize=0, numVertices=0, numCells=0): """Constructor.""" <|body_0|> def initialize(self): """Initialize application.""" <|body_1|> def...
stack_v2_sparse_classes_10k_train_004861
1,894
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, dimension=0, maxConeSize=0, numVertices=0, numCells=0)" }, { "docstring": "Initialize application.", "name": "initialize", "signature": "def initialize(self)" }, { "docstring": "Tabulate memory us...
3
stack_v2_sparse_classes_30k_train_006962
Implement the Python class `Fault` described below. Class description: Fault object for holding mesh memory and performance information. Method signatures and docstrings: - def __init__(self, dimension=0, maxConeSize=0, numVertices=0, numCells=0): Constructor. - def initialize(self): Initialize application. - def tab...
Implement the Python class `Fault` described below. Class description: Fault object for holding mesh memory and performance information. Method signatures and docstrings: - def __init__(self, dimension=0, maxConeSize=0, numVertices=0, numCells=0): Constructor. - def initialize(self): Initialize application. - def tab...
8d0170324d3fcdc5e6c4281759c680faa5dd8d38
<|skeleton|> class Fault: """Fault object for holding mesh memory and performance information.""" def __init__(self, dimension=0, maxConeSize=0, numVertices=0, numCells=0): """Constructor.""" <|body_0|> def initialize(self): """Initialize application.""" <|body_1|> def...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Fault: """Fault object for holding mesh memory and performance information.""" def __init__(self, dimension=0, maxConeSize=0, numVertices=0, numCells=0): """Constructor.""" self.dimension = dimension self.coneSize = maxConeSize self.nvertices = numVertices self.nce...
the_stack_v2_python_sparse
pylith/perf/Fault.py
rwalkerlewis/pylith
train
0
12d669248364c84b34be73e12e34a5be160a9069
[ "if isinstance(num, str):\n _n = int(num)\nelse:\n _n = num\nif _n < 0 or _n >= MAX_VALUE_LIMIT:\n raise ValueError('Out of range')\nnum_str = str(num)\ncapital_str = ''.join([LOWER_DIGITS[int(i)] for i in num_str])\ns_units = LOWER_UNITS[len(LOWER_UNITS) - len(num_str):]\no = ''.join((f'{u}{d}' for u, d i...
<|body_start_0|> if isinstance(num, str): _n = int(num) else: _n = num if _n < 0 or _n >= MAX_VALUE_LIMIT: raise ValueError('Out of range') num_str = str(num) capital_str = ''.join([LOWER_DIGITS[int(i)] for i in num_str]) s_units = LOWE...
ChineseNumbers
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChineseNumbers: def measure_number(num: Union[int, str], upper: bool=False) -> str: """将数字转化为计量大/小写的中文数字,数字0的中文形式为“零”。 >>> ChineseNumbers.measure_number(11) '十一' >>> ChineseNumbers.measure_number(204, True) '贰佰零肆'""" <|body_0|> def order_number(num: Union[int, str], upper: b...
stack_v2_sparse_classes_10k_train_004862
4,068
permissive
[ { "docstring": "将数字转化为计量大/小写的中文数字,数字0的中文形式为“零”。 >>> ChineseNumbers.measure_number(11) '十一' >>> ChineseNumbers.measure_number(204, True) '贰佰零肆'", "name": "measure_number", "signature": "def measure_number(num: Union[int, str], upper: bool=False) -> str" }, { "docstring": "将数字转化为编号大/小写的中文数字,数字0的中文...
3
stack_v2_sparse_classes_30k_train_007174
Implement the Python class `ChineseNumbers` described below. Class description: Implement the ChineseNumbers class. Method signatures and docstrings: - def measure_number(num: Union[int, str], upper: bool=False) -> str: 将数字转化为计量大/小写的中文数字,数字0的中文形式为“零”。 >>> ChineseNumbers.measure_number(11) '十一' >>> ChineseNumbers.meas...
Implement the Python class `ChineseNumbers` described below. Class description: Implement the ChineseNumbers class. Method signatures and docstrings: - def measure_number(num: Union[int, str], upper: bool=False) -> str: 将数字转化为计量大/小写的中文数字,数字0的中文形式为“零”。 >>> ChineseNumbers.measure_number(11) '十一' >>> ChineseNumbers.meas...
06407958a6ba3115d783ed6457c2e7355a3f237c
<|skeleton|> class ChineseNumbers: def measure_number(num: Union[int, str], upper: bool=False) -> str: """将数字转化为计量大/小写的中文数字,数字0的中文形式为“零”。 >>> ChineseNumbers.measure_number(11) '十一' >>> ChineseNumbers.measure_number(204, True) '贰佰零肆'""" <|body_0|> def order_number(num: Union[int, str], upper: b...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ChineseNumbers: def measure_number(num: Union[int, str], upper: bool=False) -> str: """将数字转化为计量大/小写的中文数字,数字0的中文形式为“零”。 >>> ChineseNumbers.measure_number(11) '十一' >>> ChineseNumbers.measure_number(204, True) '贰佰零肆'""" if isinstance(num, str): _n = int(num) else: ...
the_stack_v2_python_sparse
borax/numbers.py
kinegratii/borax
train
67
708ceff036b5b0424def759456b1f5d48f687c24
[ "if not nums:\n return None\ncurrent_sum = 0\nmax_sum = nums[0]\nelement_list = []\nfor num in nums:\n element_list.append(num)\n current_sum += num\n if current_sum >= max_sum:\n max_list = copy.copy(element_list)\n max_sum = current_sum\n if current_sum < 0:\n element_list = []...
<|body_start_0|> if not nums: return None current_sum = 0 max_sum = nums[0] element_list = [] for num in nums: element_list.append(num) current_sum += num if current_sum >= max_sum: max_list = copy.copy(element_list)...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray1(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxSubArray2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: return None ...
stack_v2_sparse_classes_10k_train_004863
1,087
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSubArray1", "signature": "def maxSubArray1(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSubArray2", "signature": "def maxSubArray2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_002004
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray1(self, nums): :type nums: List[int] :rtype: int - def maxSubArray2(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray1(self, nums): :type nums: List[int] :rtype: int - def maxSubArray2(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def maxSubArr...
8fb6c1d947046dabd58ff8482b2c0b41f39aa988
<|skeleton|> class Solution: def maxSubArray1(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxSubArray2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxSubArray1(self, nums): """:type nums: List[int] :rtype: int""" if not nums: return None current_sum = 0 max_sum = nums[0] element_list = [] for num in nums: element_list.append(num) current_sum += num ...
the_stack_v2_python_sparse
Python/LeetCode/53.py
czx94/Algorithms-Collection
train
2
ae85aaa67aac6a3b37f741463d2c69857f90aba7
[ "if root is None:\n return True\nreturn self.isValidBSTMinMax(root)[0]", "if root.left and root.right:\n left, left_min, left_max = self.isValidBSTMinMax(root.left)\n right, right_min, right_max = self.isValidBSTMinMax(root.right)\n return (left and right and (left_max < root.val) and (root.val < righ...
<|body_start_0|> if root is None: return True return self.isValidBSTMinMax(root)[0] <|end_body_0|> <|body_start_1|> if root.left and root.right: left, left_min, left_max = self.isValidBSTMinMax(root.left) right, right_min, right_max = self.isValidBSTMinMax(ro...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValidBST(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def isValidBSTMinMax(self, root): """Returns if the tree rooted at `root` is a valid BST, and the min and max value of the tree -- min value always <= max value""" <|body...
stack_v2_sparse_classes_10k_train_004864
4,457
no_license
[ { "docstring": ":type root: TreeNode :rtype: bool", "name": "isValidBST", "signature": "def isValidBST(self, root)" }, { "docstring": "Returns if the tree rooted at `root` is a valid BST, and the min and max value of the tree -- min value always <= max value", "name": "isValidBSTMinMax", ...
2
stack_v2_sparse_classes_30k_train_005290
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST(self, root): :type root: TreeNode :rtype: bool - def isValidBSTMinMax(self, root): Returns if the tree rooted at `root` is a valid BST, and the min and max value o...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST(self, root): :type root: TreeNode :rtype: bool - def isValidBSTMinMax(self, root): Returns if the tree rooted at `root` is a valid BST, and the min and max value o...
69a960dd8f39e9c8435a3678852071e1085fcb72
<|skeleton|> class Solution: def isValidBST(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def isValidBSTMinMax(self, root): """Returns if the tree rooted at `root` is a valid BST, and the min and max value of the tree -- min value always <= max value""" <|body...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isValidBST(self, root): """:type root: TreeNode :rtype: bool""" if root is None: return True return self.isValidBSTMinMax(root)[0] def isValidBSTMinMax(self, root): """Returns if the tree rooted at `root` is a valid BST, and the min and max value ...
the_stack_v2_python_sparse
python/tree/lc98.py
chao-ji/LeetCode
train
1
9fe18658a43d2b99dd84819b1e9aa2b603f41a22
[ "super(CollaQMultiHeadAttention, self).__init__()\nself.act = nn.ReLU()\nself.n_head = n_head\nself.d_k = d_k\nself.d_v = d_v\nself.w_qs = nn.Linear(d_model_q, n_head * d_k)\nself.w_ks = nn.Linear(d_model_v, n_head * d_k)\nself.w_vs = nn.Linear(d_model_v, n_head * d_v)\nself.fc1 = fc_block(n_head * d_v, n_head * d_...
<|body_start_0|> super(CollaQMultiHeadAttention, self).__init__() self.act = nn.ReLU() self.n_head = n_head self.d_k = d_k self.d_v = d_v self.w_qs = nn.Linear(d_model_q, n_head * d_k) self.w_ks = nn.Linear(d_model_v, n_head * d_k) self.w_vs = nn.Linear(d_...
Overview: The head of collaq attention module. Interface: __init__, forward
CollaQMultiHeadAttention
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CollaQMultiHeadAttention: """Overview: The head of collaq attention module. Interface: __init__, forward""" def __init__(self, n_head: int, d_model_q: int, d_model_v: int, d_k: int, d_v: int, d_out: int, dropout: float=0.0): """Overview: initialize the head of collaq attention module...
stack_v2_sparse_classes_10k_train_004865
27,383
permissive
[ { "docstring": "Overview: initialize the head of collaq attention module Arguments: - n_head (:obj:`int`): the num of head - d_model_q (:obj:`int`): the size of input q - d_model_v (:obj:`int`): the size of input v - d_k (:obj:`int`): the size of k, used by Scaled Dot Product Attention - d_v (:obj:`int`): the s...
2
stack_v2_sparse_classes_30k_train_000650
Implement the Python class `CollaQMultiHeadAttention` described below. Class description: Overview: The head of collaq attention module. Interface: __init__, forward Method signatures and docstrings: - def __init__(self, n_head: int, d_model_q: int, d_model_v: int, d_k: int, d_v: int, d_out: int, dropout: float=0.0):...
Implement the Python class `CollaQMultiHeadAttention` described below. Class description: Overview: The head of collaq attention module. Interface: __init__, forward Method signatures and docstrings: - def __init__(self, n_head: int, d_model_q: int, d_model_v: int, d_k: int, d_v: int, d_out: int, dropout: float=0.0):...
eb483fa6e46602d58c8e7d2ca1e566adca28e703
<|skeleton|> class CollaQMultiHeadAttention: """Overview: The head of collaq attention module. Interface: __init__, forward""" def __init__(self, n_head: int, d_model_q: int, d_model_v: int, d_k: int, d_v: int, d_out: int, dropout: float=0.0): """Overview: initialize the head of collaq attention module...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CollaQMultiHeadAttention: """Overview: The head of collaq attention module. Interface: __init__, forward""" def __init__(self, n_head: int, d_model_q: int, d_model_v: int, d_k: int, d_v: int, d_out: int, dropout: float=0.0): """Overview: initialize the head of collaq attention module Arguments: -...
the_stack_v2_python_sparse
ding/model/template/qmix.py
shengxuesun/DI-engine
train
1
c79058555e910b20922540dccdf961c0f2b8bae1
[ "sc.logger.info('小影圈发现页面初始状态检查开始')\nfun_name = 'test_planet_page'\nsc.logger.info('点击小影圈主按钮')\np_btn = 'com.quvideo.xiaoying:id/img_find'\nWebDriverWait(sc.driver, 10, 1).until(lambda el: el.find_element_by_id(p_btn)).click()\ntime.sleep(1)\nsc.logger.info('开始查找小影圈发现tab')\nel_tab_list = sc.driver.find_elements_by_i...
<|body_start_0|> sc.logger.info('小影圈发现页面初始状态检查开始') fun_name = 'test_planet_page' sc.logger.info('点击小影圈主按钮') p_btn = 'com.quvideo.xiaoying:id/img_find' WebDriverWait(sc.driver, 10, 1).until(lambda el: el.find_element_by_id(p_btn)).click() time.sleep(1) sc.logger.in...
小影圈发现页UI的测试类,分步截图.
TestPlanetExploreUI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPlanetExploreUI: """小影圈发现页UI的测试类,分步截图.""" def test_planet_page(self): """小影圈发现页面初始状态测试.""" <|body_0|> def test_refresh(self): """测试下拉刷新.""" <|body_1|> def test_swipe_vertical(self): """测试上下方向的滑动.""" <|body_2|> def test_origin...
stack_v2_sparse_classes_10k_train_004866
3,648
no_license
[ { "docstring": "小影圈发现页面初始状态测试.", "name": "test_planet_page", "signature": "def test_planet_page(self)" }, { "docstring": "测试下拉刷新.", "name": "test_refresh", "signature": "def test_refresh(self)" }, { "docstring": "测试上下方向的滑动.", "name": "test_swipe_vertical", "signature": "d...
4
stack_v2_sparse_classes_30k_train_007124
Implement the Python class `TestPlanetExploreUI` described below. Class description: 小影圈发现页UI的测试类,分步截图. Method signatures and docstrings: - def test_planet_page(self): 小影圈发现页面初始状态测试. - def test_refresh(self): 测试下拉刷新. - def test_swipe_vertical(self): 测试上下方向的滑动. - def test_origin_home(self): 发现页tab的功能.
Implement the Python class `TestPlanetExploreUI` described below. Class description: 小影圈发现页UI的测试类,分步截图. Method signatures and docstrings: - def test_planet_page(self): 小影圈发现页面初始状态测试. - def test_refresh(self): 测试下拉刷新. - def test_swipe_vertical(self): 测试上下方向的滑动. - def test_origin_home(self): 发现页tab的功能. <|skeleton|> cl...
0003b68fc8e26a96ee1661c1eb1f26f96810e909
<|skeleton|> class TestPlanetExploreUI: """小影圈发现页UI的测试类,分步截图.""" def test_planet_page(self): """小影圈发现页面初始状态测试.""" <|body_0|> def test_refresh(self): """测试下拉刷新.""" <|body_1|> def test_swipe_vertical(self): """测试上下方向的滑动.""" <|body_2|> def test_origin...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestPlanetExploreUI: """小影圈发现页UI的测试类,分步截图.""" def test_planet_page(self): """小影圈发现页面初始状态测试.""" sc.logger.info('小影圈发现页面初始状态检查开始') fun_name = 'test_planet_page' sc.logger.info('点击小影圈主按钮') p_btn = 'com.quvideo.xiaoying:id/img_find' WebDriverWait(sc.driver, 10,...
the_stack_v2_python_sparse
Android/VivaVideo/test_planet/test_explore.py
Lemonzhulixin/UItest
train
5
c0ddf5ca0ef1bc8e4b2a8c34e87b8fa2fba8a98b
[ "self.certificate = certificate\nself.exchange = exchange\nself.filer_id = filer_id\nself.password = password\nself.server_ip = server_ip\nself.username = username\nself.virtual_host = virtual_host", "if dictionary is None:\n return None\ncertificate = dictionary.get('certificate')\nexchange = dictionary.get('...
<|body_start_0|> self.certificate = certificate self.exchange = exchange self.filer_id = filer_id self.password = password self.server_ip = server_ip self.username = username self.virtual_host = virtual_host <|end_body_0|> <|body_start_1|> if dictionary i...
Implementation of the 'AMQPTargetConfig' model. TODO: type description here. Attributes: certificate (string): Specifies the certificate. exchange (string): Specifies the exchange. filer_id (long|int): Specifies the filer id. password (string): Specifies the password. server_ip (string): Specifies the server ip. userna...
AMQPTargetConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AMQPTargetConfig: """Implementation of the 'AMQPTargetConfig' model. TODO: type description here. Attributes: certificate (string): Specifies the certificate. exchange (string): Specifies the exchange. filer_id (long|int): Specifies the filer id. password (string): Specifies the password. server_...
stack_v2_sparse_classes_10k_train_004867
2,660
permissive
[ { "docstring": "Constructor for the AMQPTargetConfig class", "name": "__init__", "signature": "def __init__(self, certificate=None, exchange=None, filer_id=None, password=None, server_ip=None, username=None, virtual_host=None)" }, { "docstring": "Creates an instance of this model from a dictiona...
2
stack_v2_sparse_classes_30k_train_003359
Implement the Python class `AMQPTargetConfig` described below. Class description: Implementation of the 'AMQPTargetConfig' model. TODO: type description here. Attributes: certificate (string): Specifies the certificate. exchange (string): Specifies the exchange. filer_id (long|int): Specifies the filer id. password (s...
Implement the Python class `AMQPTargetConfig` described below. Class description: Implementation of the 'AMQPTargetConfig' model. TODO: type description here. Attributes: certificate (string): Specifies the certificate. exchange (string): Specifies the exchange. filer_id (long|int): Specifies the filer id. password (s...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class AMQPTargetConfig: """Implementation of the 'AMQPTargetConfig' model. TODO: type description here. Attributes: certificate (string): Specifies the certificate. exchange (string): Specifies the exchange. filer_id (long|int): Specifies the filer id. password (string): Specifies the password. server_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AMQPTargetConfig: """Implementation of the 'AMQPTargetConfig' model. TODO: type description here. Attributes: certificate (string): Specifies the certificate. exchange (string): Specifies the exchange. filer_id (long|int): Specifies the filer id. password (string): Specifies the password. server_ip (string): ...
the_stack_v2_python_sparse
cohesity_management_sdk/models/amqp_target_config.py
cohesity/management-sdk-python
train
24
9bae58aa8fd472afea8bd1af5ba5b89fa2afbdd9
[ "centre = nm.array(centre, dtype=nm.float64)\nnormal = nm.array(normal, dtype=nm.float64)\nnormal /= nla.norm(normal)\nname = 'circle [%s, %s, %s]' % (centre, normal, radius)\nProbe.__init__(self, name=name, share_geometry=share_geometry, centre=centre, normal=normal, radius=radius, n_point=n_point)", "out = Prob...
<|body_start_0|> centre = nm.array(centre, dtype=nm.float64) normal = nm.array(normal, dtype=nm.float64) normal /= nla.norm(normal) name = 'circle [%s, %s, %s]' % (centre, normal, radius) Probe.__init__(self, name=name, share_geometry=share_geometry, centre=centre, normal=normal,...
Probe variables along a circle. If n_point is positive, that number of evenly spaced points is used. If n_point is None or non-positive, an adaptive refinement based on element diameters is used and the number of points and their spacing are determined automatically. If it is negative, -n_point is used as an initial gu...
CircleProbe
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CircleProbe: """Probe variables along a circle. If n_point is positive, that number of evenly spaced points is used. If n_point is None or non-positive, an adaptive refinement based on element diameters is used and the number of points and their spacing are determined automatically. If it is nega...
stack_v2_sparse_classes_10k_train_004868
21,182
permissive
[ { "docstring": "Parameters ---------- centre : array_like The coordinates of the circle centre. normal : array_like The normal vector perpendicular to the circle plane. radius : float The radius of the circle.", "name": "__init__", "signature": "def __init__(self, centre, normal, radius, n_point, share_...
3
stack_v2_sparse_classes_30k_train_003717
Implement the Python class `CircleProbe` described below. Class description: Probe variables along a circle. If n_point is positive, that number of evenly spaced points is used. If n_point is None or non-positive, an adaptive refinement based on element diameters is used and the number of points and their spacing are ...
Implement the Python class `CircleProbe` described below. Class description: Probe variables along a circle. If n_point is positive, that number of evenly spaced points is used. If n_point is None or non-positive, an adaptive refinement based on element diameters is used and the number of points and their spacing are ...
0c2d1690e764b601b2687be1e4261b82207ca366
<|skeleton|> class CircleProbe: """Probe variables along a circle. If n_point is positive, that number of evenly spaced points is used. If n_point is None or non-positive, an adaptive refinement based on element diameters is used and the number of points and their spacing are determined automatically. If it is nega...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CircleProbe: """Probe variables along a circle. If n_point is positive, that number of evenly spaced points is used. If n_point is None or non-positive, an adaptive refinement based on element diameters is used and the number of points and their spacing are determined automatically. If it is negative, -n_poin...
the_stack_v2_python_sparse
sfepy/discrete/probes.py
sfepy/sfepy
train
651
501c3f7e1fa1aa0f2fc339dff951168b06f44ace
[ "super(AttentionWeights, self).__init__()\nself.w_enc = nn.Linear(size_enc_hidden, size_att_hidden, bias=False)\nself.w_query = nn.Linear(size_dec_hidden, size_att_hidden, bias=False)\nself.w_out = nn.Linear(size_att_hidden, 1, bias=False)", "query_part = self.w_query(query)\nenc_part = self.w_enc(encoder_sequenc...
<|body_start_0|> super(AttentionWeights, self).__init__() self.w_enc = nn.Linear(size_enc_hidden, size_att_hidden, bias=False) self.w_query = nn.Linear(size_dec_hidden, size_att_hidden, bias=False) self.w_out = nn.Linear(size_att_hidden, 1, bias=False) <|end_body_0|> <|body_start_1|> ...
AttentionWeights
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttentionWeights: def __init__(self, size_enc_hidden, size_dec_hidden, size_att_hidden): """Create attention weights layer. It's responsibility is to convert encoder sequence into vector of attention weights :param size_enc_hidden: size of hidden encoder state :param size_dec_hidden: siz...
stack_v2_sparse_classes_10k_train_004869
6,283
no_license
[ { "docstring": "Create attention weights layer. It's responsibility is to convert encoder sequence into vector of attention weights :param size_enc_hidden: size of hidden encoder state :param size_dec_hidden: size of hidden decoder state (aka query) :param size_att_hidden: size of attention hidden state (middle...
2
stack_v2_sparse_classes_30k_val_000339
Implement the Python class `AttentionWeights` described below. Class description: Implement the AttentionWeights class. Method signatures and docstrings: - def __init__(self, size_enc_hidden, size_dec_hidden, size_att_hidden): Create attention weights layer. It's responsibility is to convert encoder sequence into vec...
Implement the Python class `AttentionWeights` described below. Class description: Implement the AttentionWeights class. Method signatures and docstrings: - def __init__(self, size_enc_hidden, size_dec_hidden, size_att_hidden): Create attention weights layer. It's responsibility is to convert encoder sequence into vec...
cded13e89559ad0e0b41ad8aad150469ac962dee
<|skeleton|> class AttentionWeights: def __init__(self, size_enc_hidden, size_dec_hidden, size_att_hidden): """Create attention weights layer. It's responsibility is to convert encoder sequence into vector of attention weights :param size_enc_hidden: size of hidden encoder state :param size_dec_hidden: siz...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AttentionWeights: def __init__(self, size_enc_hidden, size_dec_hidden, size_att_hidden): """Create attention weights layer. It's responsibility is to convert encoder sequence into vector of attention weights :param size_enc_hidden: size of hidden encoder state :param size_dec_hidden: size of hidden de...
the_stack_v2_python_sparse
deep_bayes/sem_attention/task1_sorting.py
Shmuma/pytorch_tests
train
0
5b6a515377fa2237a04e1f8feb6e7769dcab8f3f
[ "data = req.data.keys()[0]\ndata = simplejson.loads(data)\ntitle = data.get('title')\ncategory = data.get('category')\nitems = data.get('items')\nis_active = data.get('is_active')\nactive_time = data.get('active_time')\nposter = GoodShelf()\nif title:\n poster.title = title\nif category:\n poster.category = c...
<|body_start_0|> data = req.data.keys()[0] data = simplejson.loads(data) title = data.get('title') category = data.get('category') items = data.get('items') is_active = data.get('is_active') active_time = data.get('active_time') poster = GoodShelf() ...
PosterViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PosterViewSet: def create(self, req, *args, **kwargs): """POST /rest/v2/poster""" <|body_0|> def update(self, req, *args, **kwargs): """PUT /rest/v2/poster/<id>""" <|body_1|> <|end_skeleton|> <|body_start_0|> data = req.data.keys()[0] data =...
stack_v2_sparse_classes_10k_train_004870
2,665
no_license
[ { "docstring": "POST /rest/v2/poster", "name": "create", "signature": "def create(self, req, *args, **kwargs)" }, { "docstring": "PUT /rest/v2/poster/<id>", "name": "update", "signature": "def update(self, req, *args, **kwargs)" } ]
2
null
Implement the Python class `PosterViewSet` described below. Class description: Implement the PosterViewSet class. Method signatures and docstrings: - def create(self, req, *args, **kwargs): POST /rest/v2/poster - def update(self, req, *args, **kwargs): PUT /rest/v2/poster/<id>
Implement the Python class `PosterViewSet` described below. Class description: Implement the PosterViewSet class. Method signatures and docstrings: - def create(self, req, *args, **kwargs): POST /rest/v2/poster - def update(self, req, *args, **kwargs): PUT /rest/v2/poster/<id> <|skeleton|> class PosterViewSet: ...
be58dc8f1f0630d3a04e551911f66d9091bedc45
<|skeleton|> class PosterViewSet: def create(self, req, *args, **kwargs): """POST /rest/v2/poster""" <|body_0|> def update(self, req, *args, **kwargs): """PUT /rest/v2/poster/<id>""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PosterViewSet: def create(self, req, *args, **kwargs): """POST /rest/v2/poster""" data = req.data.keys()[0] data = simplejson.loads(data) title = data.get('title') category = data.get('category') items = data.get('items') is_active = data.get('is_active'...
the_stack_v2_python_sparse
flashsale/restpro/v2/views/poster.py
nidepuzi/ndpuzsys
train
1
a04602d4b49965827af4506445df421977399b1c
[ "self.name = name\nself.dictionary = Dictionary()\nself.emotion = Emotion(self.dictionary)\nself.res_random = RandomResponder('Random', self.dictionary)\nself.res_what = RepeatResponder('Repeat', self.dictionary)\nself.res_pattern = PatternResponder('Pattern', self.dictionary)", "self.emotion.update(input)\nx = r...
<|body_start_0|> self.name = name self.dictionary = Dictionary() self.emotion = Emotion(self.dictionary) self.res_random = RandomResponder('Random', self.dictionary) self.res_what = RepeatResponder('Repeat', self.dictionary) self.res_pattern = PatternResponder('Pattern', ...
ピティナの本体クラス
Ptna
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ptna: """ピティナの本体クラス""" def __init__(self, name): """Ptnaオブジェクトの名前をnameに格納 応答オブジェクトをランダムに生成してresponderに格納 @param name Ptnaオブジェクトの名前""" <|body_0|> def dialogue(self, input): """応答オブジェクトのresponse()を呼び出して 応答文字列を取得する @param input ユーザーによって入力された文字列 戻り値 応答文字列""" ...
stack_v2_sparse_classes_10k_train_004871
3,517
no_license
[ { "docstring": "Ptnaオブジェクトの名前をnameに格納 応答オブジェクトをランダムに生成してresponderに格納 @param name Ptnaオブジェクトの名前", "name": "__init__", "signature": "def __init__(self, name)" }, { "docstring": "応答オブジェクトのresponse()を呼び出して 応答文字列を取得する @param input ユーザーによって入力された文字列 戻り値 応答文字列", "name": "dialogue", "signature": ...
2
null
Implement the Python class `Ptna` described below. Class description: ピティナの本体クラス Method signatures and docstrings: - def __init__(self, name): Ptnaオブジェクトの名前をnameに格納 応答オブジェクトをランダムに生成してresponderに格納 @param name Ptnaオブジェクトの名前 - def dialogue(self, input): 応答オブジェクトのresponse()を呼び出して 応答文字列を取得する @param input ユーザーによって入力された文字列 ...
Implement the Python class `Ptna` described below. Class description: ピティナの本体クラス Method signatures and docstrings: - def __init__(self, name): Ptnaオブジェクトの名前をnameに格納 応答オブジェクトをランダムに生成してresponderに格納 @param name Ptnaオブジェクトの名前 - def dialogue(self, input): 応答オブジェクトのresponse()を呼び出して 応答文字列を取得する @param input ユーザーによって入力された文字列 ...
26126c02cfa0dc4c0db726f2f2cabb162511a5b5
<|skeleton|> class Ptna: """ピティナの本体クラス""" def __init__(self, name): """Ptnaオブジェクトの名前をnameに格納 応答オブジェクトをランダムに生成してresponderに格納 @param name Ptnaオブジェクトの名前""" <|body_0|> def dialogue(self, input): """応答オブジェクトのresponse()を呼び出して 応答文字列を取得する @param input ユーザーによって入力された文字列 戻り値 応答文字列""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Ptna: """ピティナの本体クラス""" def __init__(self, name): """Ptnaオブジェクトの名前をnameに格納 応答オブジェクトをランダムに生成してresponderに格納 @param name Ptnaオブジェクトの名前""" self.name = name self.dictionary = Dictionary() self.emotion = Emotion(self.dictionary) self.res_random = RandomResponder('Random',...
the_stack_v2_python_sparse
normal/PythonAI/chap05/sec04/Ptna5_4_1___7/ptna.py
munezou/PycharmProject
train
2
a161139a64886902e8f007b34a46617d2614aaa5
[ "self.file_name = file_name\nself.header = None\nself.data = None\nself.model = None\nself._read_file()", "with open(self.file_name, 'rb') as f:\n new_test = struct.unpack('<l', f.read(8)[4:])[0]\nf.close()\nwith open(self.file_name, 'rb') as f:\n old_test = struct.unpack('<h', f.read(6)[4:])[0]\nf.close()\...
<|body_start_0|> self.file_name = file_name self.header = None self.data = None self.model = None self._read_file() <|end_body_0|> <|body_start_1|> with open(self.file_name, 'rb') as f: new_test = struct.unpack('<l', f.read(8)[4:])[0] f.close() ...
A class that holds the information from one file output by a D&P Instruments Model 103F MicroFT or Model 202 TurboFT. Attributes: file_name - The data file name. header - A DpHeader instance holding the header information. data - A DpData instance holding the radiometric information.
DpFile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DpFile: """A class that holds the information from one file output by a D&P Instruments Model 103F MicroFT or Model 202 TurboFT. Attributes: file_name - The data file name. header - A DpHeader instance holding the header information. data - A DpData instance holding the radiometric information.""...
stack_v2_sparse_classes_10k_train_004872
5,404
no_license
[ { "docstring": "DpFile instance constructor. Arguments: file_name - The filename for the data file.", "name": "__init__", "signature": "def __init__(self, file_name)" }, { "docstring": "Read the data file.", "name": "_read_file", "signature": "def _read_file(self)" }, { "docstrin...
4
stack_v2_sparse_classes_30k_train_001948
Implement the Python class `DpFile` described below. Class description: A class that holds the information from one file output by a D&P Instruments Model 103F MicroFT or Model 202 TurboFT. Attributes: file_name - The data file name. header - A DpHeader instance holding the header information. data - A DpData instance...
Implement the Python class `DpFile` described below. Class description: A class that holds the information from one file output by a D&P Instruments Model 103F MicroFT or Model 202 TurboFT. Attributes: file_name - The data file name. header - A DpHeader instance holding the header information. data - A DpData instance...
743167940f700374755ea273b90da66befae1ba4
<|skeleton|> class DpFile: """A class that holds the information from one file output by a D&P Instruments Model 103F MicroFT or Model 202 TurboFT. Attributes: file_name - The data file name. header - A DpHeader instance holding the header information. data - A DpData instance holding the radiometric information.""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DpFile: """A class that holds the information from one file output by a D&P Instruments Model 103F MicroFT or Model 202 TurboFT. Attributes: file_name - The data file name. header - A DpHeader instance holding the header information. data - A DpData instance holding the radiometric information.""" def __...
the_stack_v2_python_sparse
tes/models/dp_models/dp_file.py
max19951001/TES
train
0
c11ddca4ebe75dd6eb6bfc5478f6a4c904ab635c
[ "items = PublicOrganization.objects.all()\nfor item in items.all():\n item.delete()", "try:\n return PublicOrganization.objects.get(pk=int_or_none(pk))\nexcept PublicOrganization.DoesNotExist:\n return None" ]
<|body_start_0|> items = PublicOrganization.objects.all() for item in items.all(): item.delete() <|end_body_0|> <|body_start_1|> try: return PublicOrganization.objects.get(pk=int_or_none(pk)) except PublicOrganization.DoesNotExist: return None <|end_b...
PublicOrganizationManager
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PublicOrganizationManager: def delete_all(self): """Helper function which will delete all the HouseSections in DB.""" <|body_0|> def get_by_pk_or_none(self, pk): """Helper function which gets the HouseSection object by PK parameter or returns None result.""" ...
stack_v2_sparse_classes_10k_train_004873
13,440
permissive
[ { "docstring": "Helper function which will delete all the HouseSections in DB.", "name": "delete_all", "signature": "def delete_all(self)" }, { "docstring": "Helper function which gets the HouseSection object by PK parameter or returns None result.", "name": "get_by_pk_or_none", "signatu...
2
stack_v2_sparse_classes_30k_train_004042
Implement the Python class `PublicOrganizationManager` described below. Class description: Implement the PublicOrganizationManager class. Method signatures and docstrings: - def delete_all(self): Helper function which will delete all the HouseSections in DB. - def get_by_pk_or_none(self, pk): Helper function which ge...
Implement the Python class `PublicOrganizationManager` described below. Class description: Implement the PublicOrganizationManager class. Method signatures and docstrings: - def delete_all(self): Helper function which will delete all the HouseSections in DB. - def get_by_pk_or_none(self, pk): Helper function which ge...
053973b5ff0b997c52bfaca8daf8e07db64a877c
<|skeleton|> class PublicOrganizationManager: def delete_all(self): """Helper function which will delete all the HouseSections in DB.""" <|body_0|> def get_by_pk_or_none(self, pk): """Helper function which gets the HouseSection object by PK parameter or returns None result.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PublicOrganizationManager: def delete_all(self): """Helper function which will delete all the HouseSections in DB.""" items = PublicOrganization.objects.all() for item in items.all(): item.delete() def get_by_pk_or_none(self, pk): """Helper function which gets ...
the_stack_v2_python_sparse
foundation_public/models/organization.py
smegurus/smegurus-django
train
1
9ed8a01781911ca05be84579409c459c3bf93e1e
[ "super(Monitor, self).__init__()\nDEVICE_ID_LIST = GPUtil.getAvailable(order='memory', limit=1)\nif len(DEVICE_ID_LIST) < 1 or gpu_id is None:\n self.hasgpu = False\nelse:\n self.hasgpu = True\nself.gpu_id = gpu_id\nself.start_time = time.time()\nself.verbose = verbose\nself.stopped = False\nself.delay = dela...
<|body_start_0|> super(Monitor, self).__init__() DEVICE_ID_LIST = GPUtil.getAvailable(order='memory', limit=1) if len(DEVICE_ID_LIST) < 1 or gpu_id is None: self.hasgpu = False else: self.hasgpu = True self.gpu_id = gpu_id self.start_time = time.ti...
Monitor Class.
Monitor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Monitor: """Monitor Class.""" def __init__(self, log_dir, delay=1, gpu_id=0, verbose=False): """Initialize monitor, log_dir and gpu_id are needed.""" <|body_0|> def write_cpu_status(self): """Write CPU status.""" <|body_1|> def write_mem_status(self)...
stack_v2_sparse_classes_10k_train_004874
6,947
permissive
[ { "docstring": "Initialize monitor, log_dir and gpu_id are needed.", "name": "__init__", "signature": "def __init__(self, log_dir, delay=1, gpu_id=0, verbose=False)" }, { "docstring": "Write CPU status.", "name": "write_cpu_status", "signature": "def write_cpu_status(self)" }, { ...
6
stack_v2_sparse_classes_30k_train_000047
Implement the Python class `Monitor` described below. Class description: Monitor Class. Method signatures and docstrings: - def __init__(self, log_dir, delay=1, gpu_id=0, verbose=False): Initialize monitor, log_dir and gpu_id are needed. - def write_cpu_status(self): Write CPU status. - def write_mem_status(self): Wr...
Implement the Python class `Monitor` described below. Class description: Monitor Class. Method signatures and docstrings: - def __init__(self, log_dir, delay=1, gpu_id=0, verbose=False): Initialize monitor, log_dir and gpu_id are needed. - def write_cpu_status(self): Write CPU status. - def write_mem_status(self): Wr...
625189d5e1002a3edc27c3e3ce075fddf7ae1c92
<|skeleton|> class Monitor: """Monitor Class.""" def __init__(self, log_dir, delay=1, gpu_id=0, verbose=False): """Initialize monitor, log_dir and gpu_id are needed.""" <|body_0|> def write_cpu_status(self): """Write CPU status.""" <|body_1|> def write_mem_status(self)...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Monitor: """Monitor Class.""" def __init__(self, log_dir, delay=1, gpu_id=0, verbose=False): """Initialize monitor, log_dir and gpu_id are needed.""" super(Monitor, self).__init__() DEVICE_ID_LIST = GPUtil.getAvailable(order='memory', limit=1) if len(DEVICE_ID_LIST) < 1 or...
the_stack_v2_python_sparse
beta_rec/utils/monitor.py
beta-team/beta-recsys
train
156
b8deee1fb01644fdb36261082ac94d13bd47897c
[ "for ch in letters:\n if ch > target:\n return ch\nreturn letters[0]", "n = len(letters)\nif n == 0:\n return None\nlow = 0\nhigh = n - 1\nresult = 0\nwhile low <= high:\n mid = low + (high - low) // 2\n if letters[mid] > target:\n result = mid\n high = mid - 1\n else:\n ...
<|body_start_0|> for ch in letters: if ch > target: return ch return letters[0] <|end_body_0|> <|body_start_1|> n = len(letters) if n == 0: return None low = 0 high = n - 1 result = 0 while low <= high: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def nextGreatestLetter(self, letters, target): """:type letters: List[str] :type target: str :rtype: str""" <|body_0|> def nextGreatestLetter2(self, letters, target): """:type letters: List[str] :type target: str :rtype: str""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_10k_train_004875
1,215
no_license
[ { "docstring": ":type letters: List[str] :type target: str :rtype: str", "name": "nextGreatestLetter", "signature": "def nextGreatestLetter(self, letters, target)" }, { "docstring": ":type letters: List[str] :type target: str :rtype: str", "name": "nextGreatestLetter2", "signature": "def...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextGreatestLetter(self, letters, target): :type letters: List[str] :type target: str :rtype: str - def nextGreatestLetter2(self, letters, target): :type letters: List[str] :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextGreatestLetter(self, letters, target): :type letters: List[str] :type target: str :rtype: str - def nextGreatestLetter2(self, letters, target): :type letters: List[str] :...
813235789ce422a3bab198317aafc46fbc61625e
<|skeleton|> class Solution: def nextGreatestLetter(self, letters, target): """:type letters: List[str] :type target: str :rtype: str""" <|body_0|> def nextGreatestLetter2(self, letters, target): """:type letters: List[str] :type target: str :rtype: str""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def nextGreatestLetter(self, letters, target): """:type letters: List[str] :type target: str :rtype: str""" for ch in letters: if ch > target: return ch return letters[0] def nextGreatestLetter2(self, letters, target): """:type letters...
the_stack_v2_python_sparse
8. BINARY SEARCH/744_find_smallest_letter_greater_than _target/solution.py
kimmyoo/python_leetcode
train
1
b8478d11bf8717ef0a79b8a88249fdf45e629821
[ "self.name = name\nself.description = description\nself.config_scheme = config_scheme\nself.default_config = default_config\nself.default_cron = default_cron\nself.default_activated = default_activated\nself.args = args\nself.kwargs = kwargs", "from gengine.app.registries import get_task_registry\nget_task_regist...
<|body_start_0|> self.name = name self.description = description self.config_scheme = config_scheme self.default_config = default_config self.default_cron = default_cron self.default_activated = default_activated self.args = args self.kwargs = kwargs <|end...
EngineTask
[ "MIT", "ZPL-2.1", "Apache-2.0", "BSD-3-Clause-Modification", "LGPL-2.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EngineTask: def __init__(self, name, description, config_scheme, default_config, default_cron, default_activated, *args, **kwargs): """Constructor just here to accept parameters for decorator""" <|body_0|> def __call__(self, wrapped): """Attach the decorator with Ven...
stack_v2_sparse_classes_10k_train_004876
2,888
permissive
[ { "docstring": "Constructor just here to accept parameters for decorator", "name": "__init__", "signature": "def __init__(self, name, description, config_scheme, default_config, default_cron, default_activated, *args, **kwargs)" }, { "docstring": "Attach the decorator with Venusian", "name":...
2
stack_v2_sparse_classes_30k_train_004084
Implement the Python class `EngineTask` described below. Class description: Implement the EngineTask class. Method signatures and docstrings: - def __init__(self, name, description, config_scheme, default_config, default_cron, default_activated, *args, **kwargs): Constructor just here to accept parameters for decorat...
Implement the Python class `EngineTask` described below. Class description: Implement the EngineTask class. Method signatures and docstrings: - def __init__(self, name, description, config_scheme, default_config, default_cron, default_activated, *args, **kwargs): Constructor just here to accept parameters for decorat...
b82a900f2f4a43cea463853e36d6f8237c7f255e
<|skeleton|> class EngineTask: def __init__(self, name, description, config_scheme, default_config, default_cron, default_activated, *args, **kwargs): """Constructor just here to accept parameters for decorator""" <|body_0|> def __call__(self, wrapped): """Attach the decorator with Ven...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EngineTask: def __init__(self, name, description, config_scheme, default_config, default_cron, default_activated, *args, **kwargs): """Constructor just here to accept parameters for decorator""" self.name = name self.description = description self.config_scheme = config_scheme ...
the_stack_v2_python_sparse
gengine/app/tasksystem.py
ActiDoo/gamification-engine
train
413
2953ae5b0bbe5f945e449c9d8a7f13ed0af700b5
[ "ending = filename.split('.')[-1]\nif ending not in cls.labels:\n ending = cls.associated_types[ending]\ncls.labels[ending].save(filename, data, **kwargs)", "ending = filename.split('.')[-1]\nif ending not in cls.labels:\n ending = cls.associated_types[ending]\nreturn cls.labels[ending].load(filename, as_ty...
<|body_start_0|> ending = filename.split('.')[-1] if ending not in cls.labels: ending = cls.associated_types[ending] cls.labels[ending].save(filename, data, **kwargs) <|end_body_0|> <|body_start_1|> ending = filename.split('.')[-1] if ending not in cls.labels: ...
FileHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileHandler: def save(cls, filename, data, **kwargs): """Parameters: filename (str) data (ndarray, dict) kwargs: Options like header and format for specific child classes.""" <|body_0|> def load(cls, filename, as_type='dtype'): """Parameters: filename (str) as_type (...
stack_v2_sparse_classes_10k_train_004877
4,939
permissive
[ { "docstring": "Parameters: filename (str) data (ndarray, dict) kwargs: Options like header and format for specific child classes.", "name": "save", "signature": "def save(cls, filename, data, **kwargs)" }, { "docstring": "Parameters: filename (str) as_type (str): Identifier in which format the ...
2
stack_v2_sparse_classes_30k_train_004076
Implement the Python class `FileHandler` described below. Class description: Implement the FileHandler class. Method signatures and docstrings: - def save(cls, filename, data, **kwargs): Parameters: filename (str) data (ndarray, dict) kwargs: Options like header and format for specific child classes. - def load(cls, ...
Implement the Python class `FileHandler` described below. Class description: Implement the FileHandler class. Method signatures and docstrings: - def save(cls, filename, data, **kwargs): Parameters: filename (str) data (ndarray, dict) kwargs: Options like header and format for specific child classes. - def load(cls, ...
29f37740bacc9a77b94daf6fbae769c003ee9349
<|skeleton|> class FileHandler: def save(cls, filename, data, **kwargs): """Parameters: filename (str) data (ndarray, dict) kwargs: Options like header and format for specific child classes.""" <|body_0|> def load(cls, filename, as_type='dtype'): """Parameters: filename (str) as_type (...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FileHandler: def save(cls, filename, data, **kwargs): """Parameters: filename (str) data (ndarray, dict) kwargs: Options like header and format for specific child classes.""" ending = filename.split('.')[-1] if ending not in cls.labels: ending = cls.associated_types[ending]...
the_stack_v2_python_sparse
profit/util/file_handler.py
redmod-team/profit
train
19
86bb6d28cb5113a1ce461c504b61d7d931813846
[ "fx, fy, cx, cy = (params[..., 0], params[..., 1], params[..., 2], params[..., 3])\nu = points.x * fx + cx\nv = points.y * fy + cy\nreturn Vector2.from_coords(u, v)", "fx, fy, cx, cy = (params[..., 0], params[..., 1], params[..., 2], params[..., 3])\nx = (points.x - cx) / fx\ny = (points.y - cy) / fy\nreturn Vect...
<|body_start_0|> fx, fy, cx, cy = (params[..., 0], params[..., 1], params[..., 2], params[..., 3]) u = points.x * fx + cx v = points.y * fy + cy return Vector2.from_coords(u, v) <|end_body_0|> <|body_start_1|> fx, fy, cx, cy = (params[..., 0], params[..., 1], params[..., 2], par...
AffineTransform
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AffineTransform: def distort(self, params: Tensor, points: Vector2) -> Vector2: """Distort one or more Vector2 points using the affine transform. Args: params: Tensor representing the affine transform parameters. points: Vector2 representing the points to distort. Returns: Vector2 repres...
stack_v2_sparse_classes_10k_train_004878
2,163
permissive
[ { "docstring": "Distort one or more Vector2 points using the affine transform. Args: params: Tensor representing the affine transform parameters. points: Vector2 representing the points to distort. Returns: Vector2 representing the distorted points. Example: >>> params = Tensor([1., 2., 3., 4.]) >>> points = Ve...
2
null
Implement the Python class `AffineTransform` described below. Class description: Implement the AffineTransform class. Method signatures and docstrings: - def distort(self, params: Tensor, points: Vector2) -> Vector2: Distort one or more Vector2 points using the affine transform. Args: params: Tensor representing the ...
Implement the Python class `AffineTransform` described below. Class description: Implement the AffineTransform class. Method signatures and docstrings: - def distort(self, params: Tensor, points: Vector2) -> Vector2: Distort one or more Vector2 points using the affine transform. Args: params: Tensor representing the ...
1e0f8baa7318c05b17ea6dbb48605691bca8972f
<|skeleton|> class AffineTransform: def distort(self, params: Tensor, points: Vector2) -> Vector2: """Distort one or more Vector2 points using the affine transform. Args: params: Tensor representing the affine transform parameters. points: Vector2 representing the points to distort. Returns: Vector2 repres...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AffineTransform: def distort(self, params: Tensor, points: Vector2) -> Vector2: """Distort one or more Vector2 points using the affine transform. Args: params: Tensor representing the affine transform parameters. points: Vector2 representing the points to distort. Returns: Vector2 representing the dis...
the_stack_v2_python_sparse
kornia/sensors/camera/distortion_model.py
kornia/kornia
train
7,351
6a0a0783428edc8dca7a1a5f1b7346a6c8d1cfe9
[ "self.max_proportion = sum(w)\nself.Lists = []\nstart = 0.1\nfor x in w:\n start += x\n self.Lists.append(start)", "import bisect\nimport random\na = random.randint(1, self.max_proportion)\nb = bisect.bisect(self.Lists, a)\nreturn b" ]
<|body_start_0|> self.max_proportion = sum(w) self.Lists = [] start = 0.1 for x in w: start += x self.Lists.append(start) <|end_body_0|> <|body_start_1|> import bisect import random a = random.randint(1, self.max_proportion) b = bi...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int] 276 ms""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.max_proportion = sum(w) self.Lists = [] start = 0.1 for x in...
stack_v2_sparse_classes_10k_train_004879
1,901
no_license
[ { "docstring": ":type w: List[int] 276 ms", "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] 276 ms - 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] 276 ms - def pickIndex(self): :rtype: int <|skeleton|> class Solution: def __init__(self, w): """:type w: List[int] 276 ms...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int] 276 ms""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, w): """:type w: List[int] 276 ms""" self.max_proportion = sum(w) self.Lists = [] start = 0.1 for x in w: start += x self.Lists.append(start) def pickIndex(self): """:rtype: int""" import bisect ...
the_stack_v2_python_sparse
RandomPickWithWeight_MID_880.py
953250587/leetcode-python
train
2
0a7e8b5836dd5b0956f3104b80ac4105992964e1
[ "if 'AVALON_TASK' in session:\n return True\nreturn False", "with pype.modified_environ(**session):\n print(self.name)\n app = lib.get_application(self.name)\n executable = lib.which(app['executable'])\n arguments = []\n tools_env = acre.get_tools([self.name])\n env = acre.compute(tools_env)\...
<|body_start_0|> if 'AVALON_TASK' in session: return True return False <|end_body_0|> <|body_start_1|> with pype.modified_environ(**session): print(self.name) app = lib.get_application(self.name) executable = lib.which(app['executable']) ...
Aport
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Aport: def is_compatible(self, session): """Return whether the action is compatible with the session""" <|body_0|> def process(self, session, **kwargs): """Implement the behavior for when the action is triggered Args: session (dict): environment dictionary Returns: P...
stack_v2_sparse_classes_10k_train_004880
1,606
permissive
[ { "docstring": "Return whether the action is compatible with the session", "name": "is_compatible", "signature": "def is_compatible(self, session)" }, { "docstring": "Implement the behavior for when the action is triggered Args: session (dict): environment dictionary Returns: Popen instance of n...
2
null
Implement the Python class `Aport` described below. Class description: Implement the Aport class. Method signatures and docstrings: - def is_compatible(self, session): Return whether the action is compatible with the session - def process(self, session, **kwargs): Implement the behavior for when the action is trigger...
Implement the Python class `Aport` described below. Class description: Implement the Aport class. Method signatures and docstrings: - def is_compatible(self, session): Return whether the action is compatible with the session - def process(self, session, **kwargs): Implement the behavior for when the action is trigger...
47ef4b64f297186c6d929a8f56ecfb93dd0f44e8
<|skeleton|> class Aport: def is_compatible(self, session): """Return whether the action is compatible with the session""" <|body_0|> def process(self, session, **kwargs): """Implement the behavior for when the action is triggered Args: session (dict): environment dictionary Returns: P...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Aport: def is_compatible(self, session): """Return whether the action is compatible with the session""" if 'AVALON_TASK' in session: return True return False def process(self, session, **kwargs): """Implement the behavior for when the action is triggered Args: ...
the_stack_v2_python_sparse
pype/plugins/launcher/actions/Aport.py
jrsndl/pype
train
1
a4159e952c777d4e53143b6d7862a1d51dbf7ed6
[ "self.id = door_id\nself.rooms = []\nself.is_opened = False\nself.keys_to_open_this_door = {}\nself.is_visited = False", "for key in list_of_keys:\n if key in self.keys_to_open_this_door:\n self.is_opened = True" ]
<|body_start_0|> self.id = door_id self.rooms = [] self.is_opened = False self.keys_to_open_this_door = {} self.is_visited = False <|end_body_0|> <|body_start_1|> for key in list_of_keys: if key in self.keys_to_open_this_door: self.is_opened =...
Door
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Door: def __init__(self, door_id): """:param door_id: door id as its identity Regarding keys_to_open_this_door: The logic - when we insert key, we can immediately find out, if this key is suitable for that door. That gives instant experience if you can open the door or no""" <|bo...
stack_v2_sparse_classes_10k_train_004881
8,395
no_license
[ { "docstring": ":param door_id: door id as its identity Regarding keys_to_open_this_door: The logic - when we insert key, we can immediately find out, if this key is suitable for that door. That gives instant experience if you can open the door or no", "name": "__init__", "signature": "def __init__(self...
2
stack_v2_sparse_classes_30k_train_000028
Implement the Python class `Door` described below. Class description: Implement the Door class. Method signatures and docstrings: - def __init__(self, door_id): :param door_id: door id as its identity Regarding keys_to_open_this_door: The logic - when we insert key, we can immediately find out, if this key is suitabl...
Implement the Python class `Door` described below. Class description: Implement the Door class. Method signatures and docstrings: - def __init__(self, door_id): :param door_id: door id as its identity Regarding keys_to_open_this_door: The logic - when we insert key, we can immediately find out, if this key is suitabl...
636b1f6b0ab28c6eef8f8900e68393f7b1fb931a
<|skeleton|> class Door: def __init__(self, door_id): """:param door_id: door id as its identity Regarding keys_to_open_this_door: The logic - when we insert key, we can immediately find out, if this key is suitable for that door. That gives instant experience if you can open the door or no""" <|bo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Door: def __init__(self, door_id): """:param door_id: door id as its identity Regarding keys_to_open_this_door: The logic - when we insert key, we can immediately find out, if this key is suitable for that door. That gives instant experience if you can open the door or no""" self.id = door_id ...
the_stack_v2_python_sparse
Graph/Labyrinth And Treasure.py
kotsky/programming-exercises
train
0
7f04f211df37cc562e55ef98f915fd2539b3e614
[ "eps_n1 = U_k\nE = self.E\nsig_trial = self.E * (eps_n1 - eps_p_n)\nxi_trial = sig_trial - q_n\nf_trial = abs(xi_trial) - (self.sigma_y + self.K_bar * alpha_n)\nD_shape = sig_trial.shape[:-2] + (1, 1)\nD_k = np.zeros(D_shape, dtype='float_')\nsig_k = sig_trial\nD_k[...] = E\nI = np.where(f_trial > 1e-08)\nd_gamma =...
<|body_start_0|> eps_n1 = U_k E = self.E sig_trial = self.E * (eps_n1 - eps_p_n) xi_trial = sig_trial - q_n f_trial = abs(xi_trial) - (self.sigma_y + self.K_bar * alpha_n) D_shape = sig_trial.shape[:-2] + (1, 1) D_k = np.zeros(D_shape, dtype='float_') sig_...
Model with a state management distinguishing .
ModelWithState
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelWithState: """Model with a state management distinguishing .""" def get_corr_pred(self, U_k, t_n1, eps_p_n, q_n, alpha_n): """Return the value and the derivative of a function""" <|body_0|> def update_state(self, U_k, t_n1, eps_p_n, q_n, alpha_n): """In-plac...
stack_v2_sparse_classes_10k_train_004882
2,719
no_license
[ { "docstring": "Return the value and the derivative of a function", "name": "get_corr_pred", "signature": "def get_corr_pred(self, U_k, t_n1, eps_p_n, q_n, alpha_n)" }, { "docstring": "In-place update of state variables.", "name": "update_state", "signature": "def update_state(self, U_k,...
2
null
Implement the Python class `ModelWithState` described below. Class description: Model with a state management distinguishing . Method signatures and docstrings: - def get_corr_pred(self, U_k, t_n1, eps_p_n, q_n, alpha_n): Return the value and the derivative of a function - def update_state(self, U_k, t_n1, eps_p_n, q...
Implement the Python class `ModelWithState` described below. Class description: Model with a state management distinguishing . Method signatures and docstrings: - def get_corr_pred(self, U_k, t_n1, eps_p_n, q_n, alpha_n): Return the value and the derivative of a function - def update_state(self, U_k, t_n1, eps_p_n, q...
00de9f0eec52835d839a3c6c1407cac11a496339
<|skeleton|> class ModelWithState: """Model with a state management distinguishing .""" def get_corr_pred(self, U_k, t_n1, eps_p_n, q_n, alpha_n): """Return the value and the derivative of a function""" <|body_0|> def update_state(self, U_k, t_n1, eps_p_n, q_n, alpha_n): """In-plac...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ModelWithState: """Model with a state management distinguishing .""" def get_corr_pred(self, U_k, t_n1, eps_p_n, q_n, alpha_n): """Return the value and the derivative of a function""" eps_n1 = U_k E = self.E sig_trial = self.E * (eps_n1 - eps_p_n) xi_trial = sig_tr...
the_stack_v2_python_sparse
simulator/demo/demo04_model_with_state.py
simvisage/bmcs
train
1
b35564543de5a9afcb9b650a03bb42d0e97a2cd1
[ "self.env_type = env_type\nself.protected_count = protected_count\nself.protected_size_bytes = protected_size_bytes\nself.unprotected_count = unprotected_count\nself.unprotected_size_bytes = unprotected_size_bytes", "if dictionary is None:\n return None\nenv_type = dictionary.get('envType')\nprotected_count = ...
<|body_start_0|> self.env_type = env_type self.protected_count = protected_count self.protected_size_bytes = protected_size_bytes self.unprotected_count = unprotected_count self.unprotected_size_bytes = unprotected_size_bytes <|end_body_0|> <|body_start_1|> if dictionary...
Implementation of the 'ProtectedObjectsByEnv' model. Number of Protected Objects by Type. Attributes: env_type (string): Environment Type. protected_count (int): Number of Protected Objects. protected_size_bytes (long|int): Size of Protected Objects. unprotected_count (int): Number of Unprotected Objects. unprotected_s...
ProtectedObjectsByEnv
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProtectedObjectsByEnv: """Implementation of the 'ProtectedObjectsByEnv' model. Number of Protected Objects by Type. Attributes: env_type (string): Environment Type. protected_count (int): Number of Protected Objects. protected_size_bytes (long|int): Size of Protected Objects. unprotected_count (i...
stack_v2_sparse_classes_10k_train_004883
2,553
permissive
[ { "docstring": "Constructor for the ProtectedObjectsByEnv class", "name": "__init__", "signature": "def __init__(self, env_type=None, protected_count=None, protected_size_bytes=None, unprotected_count=None, unprotected_size_bytes=None)" }, { "docstring": "Creates an instance of this model from a...
2
stack_v2_sparse_classes_30k_train_005729
Implement the Python class `ProtectedObjectsByEnv` described below. Class description: Implementation of the 'ProtectedObjectsByEnv' model. Number of Protected Objects by Type. Attributes: env_type (string): Environment Type. protected_count (int): Number of Protected Objects. protected_size_bytes (long|int): Size of ...
Implement the Python class `ProtectedObjectsByEnv` described below. Class description: Implementation of the 'ProtectedObjectsByEnv' model. Number of Protected Objects by Type. Attributes: env_type (string): Environment Type. protected_count (int): Number of Protected Objects. protected_size_bytes (long|int): Size of ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ProtectedObjectsByEnv: """Implementation of the 'ProtectedObjectsByEnv' model. Number of Protected Objects by Type. Attributes: env_type (string): Environment Type. protected_count (int): Number of Protected Objects. protected_size_bytes (long|int): Size of Protected Objects. unprotected_count (i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProtectedObjectsByEnv: """Implementation of the 'ProtectedObjectsByEnv' model. Number of Protected Objects by Type. Attributes: env_type (string): Environment Type. protected_count (int): Number of Protected Objects. protected_size_bytes (long|int): Size of Protected Objects. unprotected_count (int): Number o...
the_stack_v2_python_sparse
cohesity_management_sdk/models/protected_objects_by_env.py
cohesity/management-sdk-python
train
24
bab346dbdb547045bd0cbe189f12d4a36ded41c6
[ "curr = 0\ntotal = 1\nfor page in books:\n if curr + page > min_pages:\n total += 1\n curr = 0\n curr += page\nreturn total", "if m > len(books) or not m:\n return -1\nlow = max(books)\nhigh = sum(books)\nwhile low < high:\n mid = (low + high) // 2\n result = self.count_students(books...
<|body_start_0|> curr = 0 total = 1 for page in books: if curr + page > min_pages: total += 1 curr = 0 curr += page return total <|end_body_0|> <|body_start_1|> if m > len(books) or not m: return -1 low ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def count_students(self, books, min_pages): """Returns number of students needed if you assign to each student min_pages. Time complexity: O(n). Space complexity: O(1), n is len(books).""" <|body_0|> def min_pages(self, books, m): """Returns minimum number ...
stack_v2_sparse_classes_10k_train_004884
2,089
no_license
[ { "docstring": "Returns number of students needed if you assign to each student min_pages. Time complexity: O(n). Space complexity: O(1), n is len(books).", "name": "count_students", "signature": "def count_students(self, books, min_pages)" }, { "docstring": "Returns minimum number of pages per ...
2
stack_v2_sparse_classes_30k_train_000963
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def count_students(self, books, min_pages): Returns number of students needed if you assign to each student min_pages. Time complexity: O(n). Space complexity: O(1), n is len(boo...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def count_students(self, books, min_pages): Returns number of students needed if you assign to each student min_pages. Time complexity: O(n). Space complexity: O(1), n is len(boo...
71b722ddfe8da04572e527b055cf8723d5c87bbf
<|skeleton|> class Solution: def count_students(self, books, min_pages): """Returns number of students needed if you assign to each student min_pages. Time complexity: O(n). Space complexity: O(1), n is len(books).""" <|body_0|> def min_pages(self, books, m): """Returns minimum number ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def count_students(self, books, min_pages): """Returns number of students needed if you assign to each student min_pages. Time complexity: O(n). Space complexity: O(1), n is len(books).""" curr = 0 total = 1 for page in books: if curr + page > min_pages: ...
the_stack_v2_python_sparse
Binary_Search/allocate_books.py
vladn90/Algorithms
train
0
da86ef7b92d36ebcfde763d4d96b1e11896e0960
[ "self.name = name\nself.bord = []\nfor i in range(0, 3):\n self.bord.append(Puzzle2Bord(definition[i:i + 2]))\nself.bord.append(Puzzle2Bord(definition[-1] + definition[0]))\nself.orientation = 0\nself.position = position\nself.numero = numero", "image = pygame.image.load(self.name)\nself.image = pygame.transfo...
<|body_start_0|> self.name = name self.bord = [] for i in range(0, 3): self.bord.append(Puzzle2Bord(definition[i:i + 2])) self.bord.append(Puzzle2Bord(definition[-1] + definition[0])) self.orientation = 0 self.position = position self.numero = numero <...
Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le puzzle, cette information va donc bouger au fu...
Puzzle2Piece
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Puzzle2Piece: """Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le puzzle...
stack_v2_sparse_classes_10k_train_004885
17,451
permissive
[ { "docstring": "On définit la pièce: :param name: nom de l'image représentant la pièce :param definition: chaîne de 4 caractères indiquant les quatre couleurs au quatre angles :param position: c'est la position initiale de la pièce, on suppose que l'orientation est nulle pour commencer :param numero: numéro de ...
4
null
Implement the Python class `Puzzle2Piece` described below. Class description: Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la pos...
Implement the Python class `Puzzle2Piece` described below. Class description: Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la pos...
2abbc7a20c7437f9ab91d1ec83a6aecdefceb028
<|skeleton|> class Puzzle2Piece: """Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le puzzle...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Puzzle2Piece: """Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le puzzle, cette infor...
the_stack_v2_python_sparse
src/ensae_teaching_cs/special/puzzle_2.py
Pandinosaurus/ensae_teaching_cs
train
1
4461b2eba907b9afb6292ad0ef79f692485cc5db
[ "super(TransformerEncoderModel, self).__init__()\nself.padding_idx = padding_idx\nself.token_embedding = nn.Embedding(vocab_size, emb_dim, padding_idx=padding_idx)\nmax_pos_len = 3000\nself.pos_embedding = nn.Embedding(max_pos_len, emb_dim, padding_idx=padding_idx)\nself.dropout = nn.Dropout(p=dropout_rate)\nself.t...
<|body_start_0|> super(TransformerEncoderModel, self).__init__() self.padding_idx = padding_idx self.token_embedding = nn.Embedding(vocab_size, emb_dim, padding_idx=padding_idx) max_pos_len = 3000 self.pos_embedding = nn.Embedding(max_pos_len, emb_dim, padding_idx=padding_idx) ...
TransformerEncoderModel
TransformerEncoderModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerEncoderModel: """TransformerEncoderModel""" def __init__(self, vocab_size, emb_dim=512, hidden_size=512, n_layers=8, n_heads=8, padding_idx=0, dropout_rate=0.1): """__init__""" <|body_0|> def forward(self, input, pos): """forward""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_004886
17,522
permissive
[ { "docstring": "__init__", "name": "__init__", "signature": "def __init__(self, vocab_size, emb_dim=512, hidden_size=512, n_layers=8, n_heads=8, padding_idx=0, dropout_rate=0.1)" }, { "docstring": "forward", "name": "forward", "signature": "def forward(self, input, pos)" }, { "do...
3
null
Implement the Python class `TransformerEncoderModel` described below. Class description: TransformerEncoderModel Method signatures and docstrings: - def __init__(self, vocab_size, emb_dim=512, hidden_size=512, n_layers=8, n_heads=8, padding_idx=0, dropout_rate=0.1): __init__ - def forward(self, input, pos): forward -...
Implement the Python class `TransformerEncoderModel` described below. Class description: TransformerEncoderModel Method signatures and docstrings: - def __init__(self, vocab_size, emb_dim=512, hidden_size=512, n_layers=8, n_heads=8, padding_idx=0, dropout_rate=0.1): __init__ - def forward(self, input, pos): forward -...
e6ab0261eb719c21806bbadfd94001ecfe27de45
<|skeleton|> class TransformerEncoderModel: """TransformerEncoderModel""" def __init__(self, vocab_size, emb_dim=512, hidden_size=512, n_layers=8, n_heads=8, padding_idx=0, dropout_rate=0.1): """__init__""" <|body_0|> def forward(self, input, pos): """forward""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TransformerEncoderModel: """TransformerEncoderModel""" def __init__(self, vocab_size, emb_dim=512, hidden_size=512, n_layers=8, n_heads=8, padding_idx=0, dropout_rate=0.1): """__init__""" super(TransformerEncoderModel, self).__init__() self.padding_idx = padding_idx self.t...
the_stack_v2_python_sparse
pahelix/model_zoo/protein_sequence_model.py
PaddlePaddle/PaddleHelix
train
771
d0f4c7aab929c491e556f50ba681db002d29e4fe
[ "self.collection = str(collection)\nself.sizekey = str(sizekey)\nself.subvars = subvars\nself.maxlen = int(maxlen)\nself.target_columns = OrderedDict()\nself.target_columns[self.sizekey] = np.zeros(1, dtype=np.float32)\nif self.maxlen > 1:\n tree.Branch(self.sizekey, self.target_columns[self.sizekey], '{0}/F'.fo...
<|body_start_0|> self.collection = str(collection) self.sizekey = str(sizekey) self.subvars = subvars self.maxlen = int(maxlen) self.target_columns = OrderedDict() self.target_columns[self.sizekey] = np.zeros(1, dtype=np.float32) if self.maxlen > 1: tr...
Flattens an input collection like jets_pt[njets], jets_phi[njets] to jets_pt_0...jets_pt_MAXLEN, jets_phi_0...jets_phi_MAXLEN Attributes: collection (str): Base name of the collection, e.g. "jets" maxlen (int): Maximum number of objects to get from the collection subvars (list of str): List of subbranches, e.g. ["pt", ...
Flatten
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Flatten: """Flattens an input collection like jets_pt[njets], jets_phi[njets] to jets_pt_0...jets_pt_MAXLEN, jets_phi_0...jets_phi_MAXLEN Attributes: collection (str): Base name of the collection, e.g. "jets" maxlen (int): Maximum number of objects to get from the collection subvars (list of str)...
stack_v2_sparse_classes_10k_train_004887
7,967
no_license
[ { "docstring": "Given an output tree and the collection data, creates the branch values and branches Args: tree (TYPE): Description collection (str): Base name of the collection, e.g. \"jets\" sizekey (str): The branch that indexes the number of objects, e.g. \"njets\" subvars (list of str): List of subbranches...
3
stack_v2_sparse_classes_30k_test_000156
Implement the Python class `Flatten` described below. Class description: Flattens an input collection like jets_pt[njets], jets_phi[njets] to jets_pt_0...jets_pt_MAXLEN, jets_phi_0...jets_phi_MAXLEN Attributes: collection (str): Base name of the collection, e.g. "jets" maxlen (int): Maximum number of objects to get fr...
Implement the Python class `Flatten` described below. Class description: Flattens an input collection like jets_pt[njets], jets_phi[njets] to jets_pt_0...jets_pt_MAXLEN, jets_phi_0...jets_phi_MAXLEN Attributes: collection (str): Base name of the collection, e.g. "jets" maxlen (int): Maximum number of objects to get fr...
7792c96048e250e0008861062d4f63069204efeb
<|skeleton|> class Flatten: """Flattens an input collection like jets_pt[njets], jets_phi[njets] to jets_pt_0...jets_pt_MAXLEN, jets_phi_0...jets_phi_MAXLEN Attributes: collection (str): Base name of the collection, e.g. "jets" maxlen (int): Maximum number of objects to get from the collection subvars (list of str)...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Flatten: """Flattens an input collection like jets_pt[njets], jets_phi[njets] to jets_pt_0...jets_pt_MAXLEN, jets_phi_0...jets_phi_MAXLEN Attributes: collection (str): Base name of the collection, e.g. "jets" maxlen (int): Maximum number of objects to get from the collection subvars (list of str): List of sub...
the_stack_v2_python_sparse
TTH/MEAnalysis/python/flattener.py
mmeinhard/CodeThesis
train
0
400fc4def6973c44da0081c5f00b0c9d87415784
[ "size = len(s)\nif size < 2:\n return s\nmax_len = 1\nres = s[0]\nfor i in range(size - 1):\n for j in range(i + 1, size):\n if j - i + 1 > max_len and self.__valid(s, i, j):\n max_len = j - i + 1\n res = s[i:j + 1]\nreturn res", "while left < right:\n if s[left] != s[right]:...
<|body_start_0|> size = len(s) if size < 2: return s max_len = 1 res = s[0] for i in range(size - 1): for j in range(i + 1, size): if j - i + 1 > max_len and self.__valid(s, i, j): max_len = j - i + 1 ...
Solution1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution1: def longestPalindrome(self, s): """" 根据回文子串的定义,枚举出所有【长度大于等于2】的子串,依次判断他们是否是回文,长度为1的子串不用判断就是最长回文子串。 在具体实现时,可以只针对【当前得到的最长回文子串长度】的子串进行【回文验证】 在记录最长回文子串的时候,可以只记录【当前子串的起始位置】和【子串长度】,不必做截取 时间复杂度是 O(n ^ 3) n为字符串长度,对应三层循环,分别是 枚举字符串的左边界,右边界、判断是否是回文子串 空间复杂度是O(1)""" <|body_0|> ...
stack_v2_sparse_classes_10k_train_004888
6,414
no_license
[ { "docstring": "\" 根据回文子串的定义,枚举出所有【长度大于等于2】的子串,依次判断他们是否是回文,长度为1的子串不用判断就是最长回文子串。 在具体实现时,可以只针对【当前得到的最长回文子串长度】的子串进行【回文验证】 在记录最长回文子串的时候,可以只记录【当前子串的起始位置】和【子串长度】,不必做截取 时间复杂度是 O(n ^ 3) n为字符串长度,对应三层循环,分别是 枚举字符串的左边界,右边界、判断是否是回文子串 空间复杂度是O(1)", "name": "longestPalindrome", "signature": "def longestPalindrome(self,...
2
null
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def longestPalindrome(self, s): " 根据回文子串的定义,枚举出所有【长度大于等于2】的子串,依次判断他们是否是回文,长度为1的子串不用判断就是最长回文子串。 在具体实现时,可以只针对【当前得到的最长回文子串长度】的子串进行【回文验证】 在记录最长回文子串的时候,可以只记录【当前子串的起始位置】和【子串长度】,不必做截取...
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def longestPalindrome(self, s): " 根据回文子串的定义,枚举出所有【长度大于等于2】的子串,依次判断他们是否是回文,长度为1的子串不用判断就是最长回文子串。 在具体实现时,可以只针对【当前得到的最长回文子串长度】的子串进行【回文验证】 在记录最长回文子串的时候,可以只记录【当前子串的起始位置】和【子串长度】,不必做截取...
746d77e9bfbcb3877fefae9a915004b3bfbcc612
<|skeleton|> class Solution1: def longestPalindrome(self, s): """" 根据回文子串的定义,枚举出所有【长度大于等于2】的子串,依次判断他们是否是回文,长度为1的子串不用判断就是最长回文子串。 在具体实现时,可以只针对【当前得到的最长回文子串长度】的子串进行【回文验证】 在记录最长回文子串的时候,可以只记录【当前子串的起始位置】和【子串长度】,不必做截取 时间复杂度是 O(n ^ 3) n为字符串长度,对应三层循环,分别是 枚举字符串的左边界,右边界、判断是否是回文子串 空间复杂度是O(1)""" <|body_0|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution1: def longestPalindrome(self, s): """" 根据回文子串的定义,枚举出所有【长度大于等于2】的子串,依次判断他们是否是回文,长度为1的子串不用判断就是最长回文子串。 在具体实现时,可以只针对【当前得到的最长回文子串长度】的子串进行【回文验证】 在记录最长回文子串的时候,可以只记录【当前子串的起始位置】和【子串长度】,不必做截取 时间复杂度是 O(n ^ 3) n为字符串长度,对应三层循环,分别是 枚举字符串的左边界,右边界、判断是否是回文子串 空间复杂度是O(1)""" size = len(s) if size ...
the_stack_v2_python_sparse
动态规划/LeetCode05.最长回文子串.py
leilalu/algorithm
train
0
19c9bcf19d67e868f2b5c68808f5f8201bfd4dc7
[ "try:\n return (int(key[0] // 16), int(key[1] // 16))\nexcept ValueError:\n return KeyError(\"Key %s isn't usable here!\" % repr(key))", "minx, innerx = divmod(key[0], 16)\nminz, innerz = divmod(key[1], 16)\nminx = int(minx)\nminz = int(minz)\nmaxx = minx + 1\nmaxz = minz + 1\nif innerx <= radius:\n minx...
<|body_start_0|> try: return (int(key[0] // 16), int(key[1] // 16)) except ValueError: return KeyError("Key %s isn't usable here!" % repr(key)) <|end_body_0|> <|body_start_1|> minx, innerx = divmod(key[0], 16) minz, innerz = divmod(key[1], 16) minx = int(...
Class for tracking blocks in the XZ-plane.
Block2DSpatialDict
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Block2DSpatialDict: """Class for tracking blocks in the XZ-plane.""" def key_for_bucket(self, key): """Partition keys into chunk-sized buckets.""" <|body_0|> def keys_near(self, key, radius): """Get all bucket keys "near" this key. This method may return a genera...
stack_v2_sparse_classes_10k_train_004889
5,213
permissive
[ { "docstring": "Partition keys into chunk-sized buckets.", "name": "key_for_bucket", "signature": "def key_for_bucket(self, key)" }, { "docstring": "Get all bucket keys \"near\" this key. This method may return a generator.", "name": "keys_near", "signature": "def keys_near(self, key, ra...
2
stack_v2_sparse_classes_30k_train_002523
Implement the Python class `Block2DSpatialDict` described below. Class description: Class for tracking blocks in the XZ-plane. Method signatures and docstrings: - def key_for_bucket(self, key): Partition keys into chunk-sized buckets. - def keys_near(self, key, radius): Get all bucket keys "near" this key. This metho...
Implement the Python class `Block2DSpatialDict` described below. Class description: Class for tracking blocks in the XZ-plane. Method signatures and docstrings: - def key_for_bucket(self, key): Partition keys into chunk-sized buckets. - def keys_near(self, key, radius): Get all bucket keys "near" this key. This metho...
7be5d792871a8447499911fa1502c6a7c1437dc3
<|skeleton|> class Block2DSpatialDict: """Class for tracking blocks in the XZ-plane.""" def key_for_bucket(self, key): """Partition keys into chunk-sized buckets.""" <|body_0|> def keys_near(self, key, radius): """Get all bucket keys "near" this key. This method may return a genera...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Block2DSpatialDict: """Class for tracking blocks in the XZ-plane.""" def key_for_bucket(self, key): """Partition keys into chunk-sized buckets.""" try: return (int(key[0] // 16), int(key[1] // 16)) except ValueError: return KeyError("Key %s isn't usable her...
the_stack_v2_python_sparse
bravo/utilities/spatial.py
CyberFlameGO/bravo
train
0
3743d81693706e1fe6b1c34ebaaea9dde08d6fa8
[ "if pat == None:\n pat = 'S\\\\d{2}E\\\\d{2}'\nfor old_name in os.listdir(path):\n mid = re.findall(pat, old_name)[0]\n end = old_name.split('.')[-1]\n new_name = head + '-' + mid + '.' + end\n os.rename(path + old_name, path + new_name)\nprint('NumPat: {};\\nPath: {};'.format(pat, path))", "with o...
<|body_start_0|> if pat == None: pat = 'S\\d{2}E\\d{2}' for old_name in os.listdir(path): mid = re.findall(pat, old_name)[0] end = old_name.split('.')[-1] new_name = head + '-' + mid + '.' + end os.rename(path + old_name, path + new_name) ...
整理文件名(字幕/视频);整理文件内容(字幕)
TvShow
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TvShow: """整理文件名(字幕/视频);整理文件内容(字幕)""" def renames(self, path, head, pat=None): """文件名批量命名""" <|body_0|> def to_tidy_txt(self, file): """去掉字幕文件的冗余信息""" <|body_1|> def to_audio_from_video(self, video_path='F:\\Miranda\\-S01E04.mp4', audio_ext='.mp3'): ...
stack_v2_sparse_classes_10k_train_004890
48,309
no_license
[ { "docstring": "文件名批量命名", "name": "renames", "signature": "def renames(self, path, head, pat=None)" }, { "docstring": "去掉字幕文件的冗余信息", "name": "to_tidy_txt", "signature": "def to_tidy_txt(self, file)" }, { "docstring": "将一个视频转化为音频", "name": "to_audio_from_video", "signature...
3
stack_v2_sparse_classes_30k_val_000286
Implement the Python class `TvShow` described below. Class description: 整理文件名(字幕/视频);整理文件内容(字幕) Method signatures and docstrings: - def renames(self, path, head, pat=None): 文件名批量命名 - def to_tidy_txt(self, file): 去掉字幕文件的冗余信息 - def to_audio_from_video(self, video_path='F:\\Miranda\\-S01E04.mp4', audio_ext='.mp3'): 将一个视...
Implement the Python class `TvShow` described below. Class description: 整理文件名(字幕/视频);整理文件内容(字幕) Method signatures and docstrings: - def renames(self, path, head, pat=None): 文件名批量命名 - def to_tidy_txt(self, file): 去掉字幕文件的冗余信息 - def to_audio_from_video(self, video_path='F:\\Miranda\\-S01E04.mp4', audio_ext='.mp3'): 将一个视...
b6f6897721adc616d31059f703a494bba0834b74
<|skeleton|> class TvShow: """整理文件名(字幕/视频);整理文件内容(字幕)""" def renames(self, path, head, pat=None): """文件名批量命名""" <|body_0|> def to_tidy_txt(self, file): """去掉字幕文件的冗余信息""" <|body_1|> def to_audio_from_video(self, video_path='F:\\Miranda\\-S01E04.mp4', audio_ext='.mp3'): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TvShow: """整理文件名(字幕/视频);整理文件内容(字幕)""" def renames(self, path, head, pat=None): """文件名批量命名""" if pat == None: pat = 'S\\d{2}E\\d{2}' for old_name in os.listdir(path): mid = re.findall(pat, old_name)[0] end = old_name.split('.')[-1] ne...
the_stack_v2_python_sparse
code-drop/english.2020_5_8.py
y2sinx/dyslexia
train
0
b3d91d707ce94a045011e46d5bd9b7fdce880855
[ "if root is None:\n return '[]'\nserialize_array = []\nmy_queue = deque([root])\nwhile len(my_queue) > 0:\n element = my_queue.pop()\n if element is None:\n serialize_array.append('null')\n else:\n serialize_array.append(element.val)\n my_queue.appendleft(element.left)\n my_q...
<|body_start_0|> if root is None: return '[]' serialize_array = [] my_queue = deque([root]) while len(my_queue) > 0: element = my_queue.pop() if element is None: serialize_array.append('null') else: serialize...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_004891
1,610
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
0b208516a6ae3e72bc7b79ef0ac83dcbfa100496
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if root is None: return '[]' serialize_array = [] my_queue = deque([root]) while len(my_queue) > 0: element = my_queue.pop() i...
the_stack_v2_python_sparse
leetcode/medium/serialize-and-deserialize-binary-tree.py
gsantam/competitive-programming
train
0
9e9c94285ee380e89555d8769be2c15e8553f601
[ "queryset = request.user.following.all()\npaginated = self.paginate_queryset(queryset)\nreturn self.get_paginated_response(UserProfileSerializer(paginated, many=True).data)", "username = get_key_or_400(request, 'username')\ntry:\n user = AppUser.objects.get(username=username)\n request.user.following.add(us...
<|body_start_0|> queryset = request.user.following.all() paginated = self.paginate_queryset(queryset) return self.get_paginated_response(UserProfileSerializer(paginated, many=True).data) <|end_body_0|> <|body_start_1|> username = get_key_or_400(request, 'username') try: ...
FollowingView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FollowingView: def get(self, request, format=None): """List of all users followed by the current user""" <|body_0|> def post(self, request, format=None): """Follow another user""" <|body_1|> <|end_skeleton|> <|body_start_0|> queryset = request.user....
stack_v2_sparse_classes_10k_train_004892
4,100
permissive
[ { "docstring": "List of all users followed by the current user", "name": "get", "signature": "def get(self, request, format=None)" }, { "docstring": "Follow another user", "name": "post", "signature": "def post(self, request, format=None)" } ]
2
stack_v2_sparse_classes_30k_train_004921
Implement the Python class `FollowingView` described below. Class description: Implement the FollowingView class. Method signatures and docstrings: - def get(self, request, format=None): List of all users followed by the current user - def post(self, request, format=None): Follow another user
Implement the Python class `FollowingView` described below. Class description: Implement the FollowingView class. Method signatures and docstrings: - def get(self, request, format=None): List of all users followed by the current user - def post(self, request, format=None): Follow another user <|skeleton|> class Foll...
e604cf2b9f9b3bfeed7468c668a71ae2ab48402b
<|skeleton|> class FollowingView: def get(self, request, format=None): """List of all users followed by the current user""" <|body_0|> def post(self, request, format=None): """Follow another user""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FollowingView: def get(self, request, format=None): """List of all users followed by the current user""" queryset = request.user.following.all() paginated = self.paginate_queryset(queryset) return self.get_paginated_response(UserProfileSerializer(paginated, many=True).data) ...
the_stack_v2_python_sparse
server/authentication/api/views.py
wcreis/Real-World-App-Django-Sapper
train
0
37780a6999508b4b636aecf97af4b766fdd3c22b
[ "self.global_args = config.get('global_args', {})\nself.scenario_data = config.get('scenario')\nself.data_dir = config.get('data_dir')\nif not self.scenario_data:\n raise ScenarioException('No blocks in scenario')\nif not self.data_dir:\n raise ScenarioException('Data directory must be set')", "self.blocks ...
<|body_start_0|> self.global_args = config.get('global_args', {}) self.scenario_data = config.get('scenario') self.data_dir = config.get('data_dir') if not self.scenario_data: raise ScenarioException('No blocks in scenario') if not self.data_dir: raise Sce...
This represents a scenario, i.e. a sequence of blocks to be run on the data
Scenario
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Scenario: """This represents a scenario, i.e. a sequence of blocks to be run on the data""" def __init__(self, config): """Initialize (parse YAML scenario from a file)""" <|body_0|> def load_blocks(self): """Load all blocks into memory, finding and creating class...
stack_v2_sparse_classes_10k_train_004893
3,189
permissive
[ { "docstring": "Initialize (parse YAML scenario from a file)", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Load all blocks into memory, finding and creating class objects.", "name": "load_blocks", "signature": "def load_blocks(self)" }, { "doc...
3
stack_v2_sparse_classes_30k_train_001184
Implement the Python class `Scenario` described below. Class description: This represents a scenario, i.e. a sequence of blocks to be run on the data Method signatures and docstrings: - def __init__(self, config): Initialize (parse YAML scenario from a file) - def load_blocks(self): Load all blocks into memory, findi...
Implement the Python class `Scenario` described below. Class description: This represents a scenario, i.e. a sequence of blocks to be run on the data Method signatures and docstrings: - def __init__(self, config): Initialize (parse YAML scenario from a file) - def load_blocks(self): Load all blocks into memory, findi...
73af644ec35c8a1cd0c37cd478c2afc1db717e0b
<|skeleton|> class Scenario: """This represents a scenario, i.e. a sequence of blocks to be run on the data""" def __init__(self, config): """Initialize (parse YAML scenario from a file)""" <|body_0|> def load_blocks(self): """Load all blocks into memory, finding and creating class...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Scenario: """This represents a scenario, i.e. a sequence of blocks to be run on the data""" def __init__(self, config): """Initialize (parse YAML scenario from a file)""" self.global_args = config.get('global_args', {}) self.scenario_data = config.get('scenario') self.data...
the_stack_v2_python_sparse
alex/components/nlg/tectotpl/core/run.py
oplatek/alex
train
0
660469b9df4a2cf10b891f8bde46f0bdcbb77077
[ "host_port = data_server.split(':')\nif len(host_port) == 1:\n self.data_server = 'localhost:' + data_server\nelif not len(host_port[0]):\n self.data_server = 'localhost' + data_server\nelse:\n self.data_server = data_server\nself.websocket = None\nself.back_seconds = back_seconds\nself.cleanup_interval = ...
<|body_start_0|> host_port = data_server.split(':') if len(host_port) == 1: self.data_server = 'localhost:' + data_server elif not len(host_port[0]): self.data_server = 'localhost' + data_server else: self.data_server = data_server self.websock...
CachedDataWriter
[ "MIT", "CC-BY-NC-4.0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CachedDataWriter: def __init__(self, data_server, start_server=False, back_seconds=480, cleanup_interval=6, update_interval=1, max_backup=60 * 60 * 24): """Feed passed records to a CachedDataServer via a websocket. Expects records in DASRecord or dict formats. ``` data_server [host:]port...
stack_v2_sparse_classes_10k_train_004894
6,222
permissive
[ { "docstring": "Feed passed records to a CachedDataServer via a websocket. Expects records in DASRecord or dict formats. ``` data_server [host:]port on which to look for data server back_seconds Number of seconds of back data to hold in cache cleanup_interval Remove old data every N seconds update_interval Serv...
3
stack_v2_sparse_classes_30k_train_001328
Implement the Python class `CachedDataWriter` described below. Class description: Implement the CachedDataWriter class. Method signatures and docstrings: - def __init__(self, data_server, start_server=False, back_seconds=480, cleanup_interval=6, update_interval=1, max_backup=60 * 60 * 24): Feed passed records to a Ca...
Implement the Python class `CachedDataWriter` described below. Class description: Implement the CachedDataWriter class. Method signatures and docstrings: - def __init__(self, data_server, start_server=False, back_seconds=480, cleanup_interval=6, update_interval=1, max_backup=60 * 60 * 24): Feed passed records to a Ca...
ba77d3958075abd21ff94a396e4a97879962ac0c
<|skeleton|> class CachedDataWriter: def __init__(self, data_server, start_server=False, back_seconds=480, cleanup_interval=6, update_interval=1, max_backup=60 * 60 * 24): """Feed passed records to a CachedDataServer via a websocket. Expects records in DASRecord or dict formats. ``` data_server [host:]port...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CachedDataWriter: def __init__(self, data_server, start_server=False, back_seconds=480, cleanup_interval=6, update_interval=1, max_backup=60 * 60 * 24): """Feed passed records to a CachedDataServer via a websocket. Expects records in DASRecord or dict formats. ``` data_server [host:]port on which to l...
the_stack_v2_python_sparse
logger/writers/cached_data_writer.py
timburbank/openrvdas
train
0
490e3adb0125f796f61a28ee8a10edf392ddcf9d
[ "SimpleHandler.setup_environ(self)\nself.environ['ws4py.socket'] = get_connection(self.environ['wsgi.input'])\nself.http_version = self.environ['SERVER_PROTOCOL'].rsplit('/')[-1]", "rest = iter(self.result)\nfirst = list(itertools.islice(rest, 1))\nself.result = itertools.chain(first, rest)\nws = None\nif self.en...
<|body_start_0|> SimpleHandler.setup_environ(self) self.environ['ws4py.socket'] = get_connection(self.environ['wsgi.input']) self.http_version = self.environ['SERVER_PROTOCOL'].rsplit('/')[-1] <|end_body_0|> <|body_start_1|> rest = iter(self.result) first = list(itertools.islice...
WebSocketWSGIHandler
[ "GPL-1.0-or-later", "GPL-2.0-or-later", "OFL-1.1", "MS-PL", "AFL-2.1", "GPL-2.0-only", "Python-2.0", "Apache-2.0", "BSD-2-Clause", "MIT", "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WebSocketWSGIHandler: def setup_environ(self): """Setup the environ dictionary and add the `'ws4py.socket'` key. Its associated value is the real socket underlying socket.""" <|body_0|> def finish_response(self): """Completes the response and performs the following t...
stack_v2_sparse_classes_10k_train_004895
5,353
permissive
[ { "docstring": "Setup the environ dictionary and add the `'ws4py.socket'` key. Its associated value is the real socket underlying socket.", "name": "setup_environ", "signature": "def setup_environ(self)" }, { "docstring": "Completes the response and performs the following tasks: - Remove the `'w...
2
null
Implement the Python class `WebSocketWSGIHandler` described below. Class description: Implement the WebSocketWSGIHandler class. Method signatures and docstrings: - def setup_environ(self): Setup the environ dictionary and add the `'ws4py.socket'` key. Its associated value is the real socket underlying socket. - def f...
Implement the Python class `WebSocketWSGIHandler` described below. Class description: Implement the WebSocketWSGIHandler class. Method signatures and docstrings: - def setup_environ(self): Setup the environ dictionary and add the `'ws4py.socket'` key. Its associated value is the real socket underlying socket. - def f...
23881f23577a65de396238998e8672d6c4c5a250
<|skeleton|> class WebSocketWSGIHandler: def setup_environ(self): """Setup the environ dictionary and add the `'ws4py.socket'` key. Its associated value is the real socket underlying socket.""" <|body_0|> def finish_response(self): """Completes the response and performs the following t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WebSocketWSGIHandler: def setup_environ(self): """Setup the environ dictionary and add the `'ws4py.socket'` key. Its associated value is the real socket underlying socket.""" SimpleHandler.setup_environ(self) self.environ['ws4py.socket'] = get_connection(self.environ['wsgi.input']) ...
the_stack_v2_python_sparse
ambari-common/src/main/python/ambari_ws4py/server/wsgirefserver.py
apache/ambari
train
2,078
8c4ab4508eb926c092c898d9562bea264f96e2ba
[ "self._points = [_format_LatLng(lat, lng, precision) for lat, lng in zip(lats, lngs)]\nedge_color = kwargs.get('edge_color')\nself._edge_color = _get_hex_color(edge_color) if edge_color is not None else None\nself._edge_alpha = kwargs.get('edge_alpha')\nself._edge_width = kwargs.get('edge_width')\nface_color = kwar...
<|body_start_0|> self._points = [_format_LatLng(lat, lng, precision) for lat, lng in zip(lats, lngs)] edge_color = kwargs.get('edge_color') self._edge_color = _get_hex_color(edge_color) if edge_color is not None else None self._edge_alpha = kwargs.get('edge_alpha') self._edge_wid...
_Polygon
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Polygon: def __init__(self, lats, lngs, precision, **kwargs): """Args: lats ([float]): Latitudes. lngs ([float]): Longitudes. precision (int): Number of digits after the decimal to round to for lat/lng values. Optional: Args: edge_color (str): Color of the polygon's edge. Can be hex ('#...
stack_v2_sparse_classes_10k_train_004896
2,418
permissive
[ { "docstring": "Args: lats ([float]): Latitudes. lngs ([float]): Longitudes. precision (int): Number of digits after the decimal to round to for lat/lng values. Optional: Args: edge_color (str): Color of the polygon's edge. Can be hex ('#00FFFF'), named ('cyan'), or matplotlib-like ('c'). edge_alpha (float): Op...
2
stack_v2_sparse_classes_30k_test_000143
Implement the Python class `_Polygon` described below. Class description: Implement the _Polygon class. Method signatures and docstrings: - def __init__(self, lats, lngs, precision, **kwargs): Args: lats ([float]): Latitudes. lngs ([float]): Longitudes. precision (int): Number of digits after the decimal to round to ...
Implement the Python class `_Polygon` described below. Class description: Implement the _Polygon class. Method signatures and docstrings: - def __init__(self, lats, lngs, precision, **kwargs): Args: lats ([float]): Latitudes. lngs ([float]): Longitudes. precision (int): Number of digits after the decimal to round to ...
8654a5a370b5ec309e1282c457eaf375c3dcb4bb
<|skeleton|> class _Polygon: def __init__(self, lats, lngs, precision, **kwargs): """Args: lats ([float]): Latitudes. lngs ([float]): Longitudes. precision (int): Number of digits after the decimal to round to for lat/lng values. Optional: Args: edge_color (str): Color of the polygon's edge. Can be hex ('#...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _Polygon: def __init__(self, lats, lngs, precision, **kwargs): """Args: lats ([float]): Latitudes. lngs ([float]): Longitudes. precision (int): Number of digits after the decimal to round to for lat/lng values. Optional: Args: edge_color (str): Color of the polygon's edge. Can be hex ('#00FFFF'), name...
the_stack_v2_python_sparse
gmplot/drawables/polygon.py
fishke22/gmplot
train
0
30a2561b4b21926031c177c254c8f00f4473e317
[ "sql = ' select s1.bus_station_name as up_station_name,s2.bus_station_name as off_station_name,b.full_name from info_guardian g join info_student s on g.student_id = s.id join info_people_basic_facts b on s.basic_id = b.id join student_line_seat ss on g.student_id = ss.student_id join info_bus_station s1 on ss...
<|body_start_0|> sql = ' select s1.bus_station_name as up_station_name,s2.bus_station_name as off_station_name,b.full_name from info_guardian g join info_student s on g.student_id = s.id join info_people_basic_facts b on s.basic_id = b.id join student_line_seat ss on g.student_id = ss.student_id join info_b...
InfoGuardian
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InfoGuardian: def query_pa_tooltips(self, login_user_id): """获取家长提示信息 :param login_user_id :return:""" <|body_0|> def query_pa_health_code(self, login_user_id, clock_date): """是否提示家长需要上传健康码 :param login_user_id :return:""" <|body_1|> def query_ba_health_...
stack_v2_sparse_classes_10k_train_004897
3,646
no_license
[ { "docstring": "获取家长提示信息 :param login_user_id :return:", "name": "query_pa_tooltips", "signature": "def query_pa_tooltips(self, login_user_id)" }, { "docstring": "是否提示家长需要上传健康码 :param login_user_id :return:", "name": "query_pa_health_code", "signature": "def query_pa_health_code(self, lo...
3
stack_v2_sparse_classes_30k_train_002745
Implement the Python class `InfoGuardian` described below. Class description: Implement the InfoGuardian class. Method signatures and docstrings: - def query_pa_tooltips(self, login_user_id): 获取家长提示信息 :param login_user_id :return: - def query_pa_health_code(self, login_user_id, clock_date): 是否提示家长需要上传健康码 :param login...
Implement the Python class `InfoGuardian` described below. Class description: Implement the InfoGuardian class. Method signatures and docstrings: - def query_pa_tooltips(self, login_user_id): 获取家长提示信息 :param login_user_id :return: - def query_pa_health_code(self, login_user_id, clock_date): 是否提示家长需要上传健康码 :param login...
a7cf5a0b6daa372ed860dc43d92c55fcde764eb9
<|skeleton|> class InfoGuardian: def query_pa_tooltips(self, login_user_id): """获取家长提示信息 :param login_user_id :return:""" <|body_0|> def query_pa_health_code(self, login_user_id, clock_date): """是否提示家长需要上传健康码 :param login_user_id :return:""" <|body_1|> def query_ba_health_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InfoGuardian: def query_pa_tooltips(self, login_user_id): """获取家长提示信息 :param login_user_id :return:""" sql = ' select s1.bus_station_name as up_station_name,s2.bus_station_name as off_station_name,b.full_name from info_guardian g join info_student s on g.student_id = s.id join info_people_ba...
the_stack_v2_python_sparse
python_project/smart_schoolBus_project/app/schoolbus_situation/models/info_guardian_model.py
malqch/aibus
train
0
dabb4b405eb88bdbb1304adde116f707797e5bc8
[ "super(LMF, self).__init__()\nself.audio_in = input_dims[0]\nself.video_in = input_dims[1]\nself.text_in = input_dims[2]\nself.audio_hidden = hidden_dims[0]\nself.video_hidden = hidden_dims[1]\nself.text_hidden = hidden_dims[2]\nself.text_out = text_out\nself.output_dim = output_dim\nself.rank = rank\nself.use_soft...
<|body_start_0|> super(LMF, self).__init__() self.audio_in = input_dims[0] self.video_in = input_dims[1] self.text_in = input_dims[2] self.audio_hidden = hidden_dims[0] self.video_hidden = hidden_dims[1] self.text_hidden = hidden_dims[2] self.text_out = te...
Low-rank Multimodal Fusion
LMF
[ "Apache-2.0", "BSD-2-Clause", "MIT", "BSD-3-Clause", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-unknown-license-reference", "GPL-1.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LMF: """Low-rank Multimodal Fusion""" def __init__(self, input_dims, hidden_dims, text_out, dropouts, output_dim, rank, use_softmax=False): """Args: input_dims - a length-3 tuple, contains (audio_dim, video_dim, text_dim) hidden_dims - another length-3 tuple, hidden dims of the sub-n...
stack_v2_sparse_classes_10k_train_004898
7,292
permissive
[ { "docstring": "Args: input_dims - a length-3 tuple, contains (audio_dim, video_dim, text_dim) hidden_dims - another length-3 tuple, hidden dims of the sub-networks text_out - int, specifying the resulting dimensions of the text subnetwork dropouts - a length-4 tuple, contains (audio_dropout, video_dropout, tex...
2
stack_v2_sparse_classes_30k_test_000004
Implement the Python class `LMF` described below. Class description: Low-rank Multimodal Fusion Method signatures and docstrings: - def __init__(self, input_dims, hidden_dims, text_out, dropouts, output_dim, rank, use_softmax=False): Args: input_dims - a length-3 tuple, contains (audio_dim, video_dim, text_dim) hidde...
Implement the Python class `LMF` described below. Class description: Low-rank Multimodal Fusion Method signatures and docstrings: - def __init__(self, input_dims, hidden_dims, text_out, dropouts, output_dim, rank, use_softmax=False): Args: input_dims - a length-3 tuple, contains (audio_dim, video_dim, text_dim) hidde...
92acc188d3a0f634de58463b6676e70df83ef808
<|skeleton|> class LMF: """Low-rank Multimodal Fusion""" def __init__(self, input_dims, hidden_dims, text_out, dropouts, output_dim, rank, use_softmax=False): """Args: input_dims - a length-3 tuple, contains (audio_dim, video_dim, text_dim) hidden_dims - another length-3 tuple, hidden dims of the sub-n...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LMF: """Low-rank Multimodal Fusion""" def __init__(self, input_dims, hidden_dims, text_out, dropouts, output_dim, rank, use_softmax=False): """Args: input_dims - a length-3 tuple, contains (audio_dim, video_dim, text_dim) hidden_dims - another length-3 tuple, hidden dims of the sub-networks text_...
the_stack_v2_python_sparse
PyTorch/contrib/others/Low-rank-Multimodal-Fusion_ID2983_for_Pytorch/model.py
Ascend/ModelZoo-PyTorch
train
23
b94392c9c6547415326d80ff0923cb8ba9251783
[ "encoded_str = ''\nfor s in strs:\n encoded_str += '%0*x' % (8, len(s)) + s\nreturn encoded_str", "i = 0\nstrs = []\nwhile i < len(s):\n l = int(s[i:i + 8], 16)\n strs.append(s[i + 8:i + 8 + l])\n i += 8 + l\nreturn strs" ]
<|body_start_0|> encoded_str = '' for s in strs: encoded_str += '%0*x' % (8, len(s)) + s return encoded_str <|end_body_0|> <|body_start_1|> i = 0 strs = [] while i < len(s): l = int(s[i:i + 8], 16) strs.append(s[i + 8:i + 8 + l]) ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" <|body_0|> def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k_train_004899
2,992
no_license
[ { "docstring": "Encodes a list of strings to a single string. :type strs: List[str] :rtype: str", "name": "encode", "signature": "def encode(self, strs)" }, { "docstring": "Decodes a single string to a list of strings. :type s: str :rtype: List[str]", "name": "decode", "signature": "def ...
2
stack_v2_sparse_classes_30k_train_006575
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str - def decode(self, s): Decodes a single string to a list of strings. :type s: st...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str - def decode(self, s): Decodes a single string to a list of strings. :type s: st...
05e8f5a4e39d448eb333c813093fc7c1df4fc05e
<|skeleton|> class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" <|body_0|> def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" encoded_str = '' for s in strs: encoded_str += '%0*x' % (8, len(s)) + s return encoded_str def decode(self, s): """Decodes a single stri...
the_stack_v2_python_sparse
leetcode_python/String/encode-and-decode-strings.py
DataEngDev/CS_basics
train
0