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
4064ed106fadaa742a34723a1c84a69e82620870
[ "global task_tree\n\ndef simulation():\n return None\nself.suspended_tree = task_tree\nself.world_state, self.objects2attached = BulletWorld.current_bullet_world.save_state()\nself.simulated_root = TaskTreeNode(code=Code(simulation))\ntask_tree = self.simulated_root\npybullet.addUserDebugText('Simulating...', [0...
<|body_start_0|> global task_tree def simulation(): return None self.suspended_tree = task_tree self.world_state, self.objects2attached = BulletWorld.current_bullet_world.save_state() self.simulated_root = TaskTreeNode(code=Code(simulation)) task_tree = self....
TaskTree for execution in a 'new' simulation.
SimulatedTaskTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimulatedTaskTree: """TaskTree for execution in a 'new' simulation.""" def __enter__(self): """At the beginning of a with statement the current task tree and bullet world will be suspended and remembered. Fresh structures are then available inside the with statement.""" <|bod...
stack_v2_sparse_classes_10k_train_002700
11,387
no_license
[ { "docstring": "At the beginning of a with statement the current task tree and bullet world will be suspended and remembered. Fresh structures are then available inside the with statement.", "name": "__enter__", "signature": "def __enter__(self)" }, { "docstring": "Restore the old state at the e...
2
stack_v2_sparse_classes_30k_train_006993
Implement the Python class `SimulatedTaskTree` described below. Class description: TaskTree for execution in a 'new' simulation. Method signatures and docstrings: - def __enter__(self): At the beginning of a with statement the current task tree and bullet world will be suspended and remembered. Fresh structures are t...
Implement the Python class `SimulatedTaskTree` described below. Class description: TaskTree for execution in a 'new' simulation. Method signatures and docstrings: - def __enter__(self): At the beginning of a with statement the current task tree and bullet world will be suspended and remembered. Fresh structures are t...
f9ef666d6d4685660c9517652f2c568ed2c9367c
<|skeleton|> class SimulatedTaskTree: """TaskTree for execution in a 'new' simulation.""" def __enter__(self): """At the beginning of a with statement the current task tree and bullet world will be suspended and remembered. Fresh structures are then available inside the with statement.""" <|bod...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SimulatedTaskTree: """TaskTree for execution in a 'new' simulation.""" def __enter__(self): """At the beginning of a with statement the current task tree and bullet world will be suspended and remembered. Fresh structures are then available inside the with statement.""" global task_tree ...
the_stack_v2_python_sparse
src/pycram/task.py
cram2/pycram
train
12
b6ddebe8dc5e5e78ff829ed644eb53446b0c43b4
[ "if not len(nums):\n return\nindex = len(nums) - 2\nwhile index >= 0 and nums[index] >= nums[index + 1]:\n index -= 1\nif index >= 0:\n i = index + 1\n while i < len(nums) and nums[i] > nums[index]:\n i += 1\n nums[i - 1], nums[index] = (nums[index], nums[i - 1])\nleft, right = (index + 1, len...
<|body_start_0|> if not len(nums): return index = len(nums) - 2 while index >= 0 and nums[index] >= nums[index + 1]: index -= 1 if index >= 0: i = index + 1 while i < len(nums) and nums[i] > nums[index]: i += 1 n...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def nextPermutation(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def permuteUnique(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k_train_002701
1,580
no_license
[ { "docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.", "name": "nextPermutation", "signature": "def nextPermutation(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "permuteUnique", "signature": "d...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextPermutation(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. - def permuteUnique(self, nums): :type nums: List[int] :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextPermutation(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. - def permuteUnique(self, nums): :type nums: List[int] :...
9b82e3bd1b404e3cff31469986577ceec3924f73
<|skeleton|> class Solution: def nextPermutation(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def permuteUnique(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def nextPermutation(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" if not len(nums): return index = len(nums) - 2 while index >= 0 and nums[index] >= nums[index + 1]: index -= 1 ...
the_stack_v2_python_sparse
Python/47PermutationsII.py
Qiumy/leetcode
train
0
ea0e3eafbbd443920d6add021877bd4d85b9d0bf
[ "self.exist = False\nif address is not None:\n self.exist = True\n if len(address) == 7:\n if address[0] == 1:\n self.universe, self.address_start, balance = ((address[4], address[5], cut_little_ledstrip), (address[1], address[2], 0))[idx_led < cut_little_ledstrip]\n self.address_...
<|body_start_0|> self.exist = False if address is not None: self.exist = True if len(address) == 7: if address[0] == 1: self.universe, self.address_start, balance = ((address[4], address[5], cut_little_ledstrip), (address[1], address[2], 0))[id...
Represent a led of the cube
Led
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Led: """Represent a led of the cube""" def __init__(self, address, idx_led): """Constructor of led :param address: tuple of led address :param idx_led: led index""" <|body_0|> def show(self, brightness): """Illuminate the led with brightness :param brightness: in...
stack_v2_sparse_classes_10k_train_002702
3,537
no_license
[ { "docstring": "Constructor of led :param address: tuple of led address :param idx_led: led index", "name": "__init__", "signature": "def __init__(self, address, idx_led)" }, { "docstring": "Illuminate the led with brightness :param brightness: int between 0 and 15 include :raise exception", ...
2
stack_v2_sparse_classes_30k_train_003014
Implement the Python class `Led` described below. Class description: Represent a led of the cube Method signatures and docstrings: - def __init__(self, address, idx_led): Constructor of led :param address: tuple of led address :param idx_led: led index - def show(self, brightness): Illuminate the led with brightness ...
Implement the Python class `Led` described below. Class description: Represent a led of the cube Method signatures and docstrings: - def __init__(self, address, idx_led): Constructor of led :param address: tuple of led address :param idx_led: led index - def show(self, brightness): Illuminate the led with brightness ...
de1408317d5071b7e0c6b2fea6f281660115d728
<|skeleton|> class Led: """Represent a led of the cube""" def __init__(self, address, idx_led): """Constructor of led :param address: tuple of led address :param idx_led: led index""" <|body_0|> def show(self, brightness): """Illuminate the led with brightness :param brightness: in...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Led: """Represent a led of the cube""" def __init__(self, address, idx_led): """Constructor of led :param address: tuple of led address :param idx_led: led index""" self.exist = False if address is not None: self.exist = True if len(address) == 7: ...
the_stack_v2_python_sparse
api/package/cube/led.py
HE-Arc/Extrusion---web-interface
train
4
91425a498569e7a7513dbf0e04d734cbc4aff1bb
[ "dict.__init__(data)\nself.data = data\nfor cate in data:\n for arg in cate:\n if not isinstance(data[cate][arg], types.ListType):\n continue\n if not (isinstance(data[cate][arg][1], IntVar) or isinstance(data[cate][arg][1], StringVar)):\n continue\n value = data[cate][...
<|body_start_0|> dict.__init__(data) self.data = data for cate in data: for arg in cate: if not isinstance(data[cate][arg], types.ListType): continue if not (isinstance(data[cate][arg][1], IntVar) or isinstance(data[cate][arg][1], S...
dataStream
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class dataStream: def __init__(self, data): """a datastream manager depend on python's dict""" <|body_0|> def synchro(self): """synchro the dataStream from Tkinter *Var to string/int""" <|body_1|> <|end_skeleton|> <|body_start_0|> dict.__init__(data) ...
stack_v2_sparse_classes_10k_train_002703
1,263
no_license
[ { "docstring": "a datastream manager depend on python's dict", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "synchro the dataStream from Tkinter *Var to string/int", "name": "synchro", "signature": "def synchro(self)" } ]
2
stack_v2_sparse_classes_30k_test_000141
Implement the Python class `dataStream` described below. Class description: Implement the dataStream class. Method signatures and docstrings: - def __init__(self, data): a datastream manager depend on python's dict - def synchro(self): synchro the dataStream from Tkinter *Var to string/int
Implement the Python class `dataStream` described below. Class description: Implement the dataStream class. Method signatures and docstrings: - def __init__(self, data): a datastream manager depend on python's dict - def synchro(self): synchro the dataStream from Tkinter *Var to string/int <|skeleton|> class dataStr...
8f2af73f6bfe0c6d4d1d0d9a8572b31e4f91e66c
<|skeleton|> class dataStream: def __init__(self, data): """a datastream manager depend on python's dict""" <|body_0|> def synchro(self): """synchro the dataStream from Tkinter *Var to string/int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class dataStream: def __init__(self, data): """a datastream manager depend on python's dict""" dict.__init__(data) self.data = data for cate in data: for arg in cate: if not isinstance(data[cate][arg], types.ListType): continue ...
the_stack_v2_python_sparse
dataStream.py
humanfans/ncep-displayer
train
0
8eac60ad69e7215271e1d35ee0d5a51f4a7283f9
[ "stack, ret = ([], 0)\nfor p in prices:\n while stack and stack[-1] > p:\n stack.pop()\n if stack == []:\n stack.append(p)\n else:\n ret = max(ret, p - stack[-1])\nreturn ret", "minPrice, maxProfit = (float('inf'), 0)\nfor i in xrange(len(prices)):\n minPrice = min(minPrice, price...
<|body_start_0|> stack, ret = ([], 0) for p in prices: while stack and stack[-1] > p: stack.pop() if stack == []: stack.append(p) else: ret = max(ret, p - stack[-1]) return ret <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> stack, ret = ([], 0) for p in pri...
stack_v2_sparse_classes_10k_train_002704
892
no_license
[ { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices)" }, { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices)" } ]
2
stack_v2_sparse_classes_30k_train_005528
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfit(self, prices): :type prices: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfit(self, prices): :type prices: List[int] :rtype: int <|skeleton|> class Solution: def maxProf...
1a0dbcabb0f454a4fdcc31af9b919f5d30664335
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" stack, ret = ([], 0) for p in prices: while stack and stack[-1] > p: stack.pop() if stack == []: stack.append(p) else: re...
the_stack_v2_python_sparse
121. Best Time to Buy and Sell Stock.py
haomingchan0811/Leetcode
train
0
4cf6b2cf2af79f78d078e16810cd2c856a6c769e
[ "def mid_recur(root):\n nonlocal recorder\n if root:\n if not mid_recur(root.left):\n return False\n if recorder is not None and root.val <= recorder:\n return False\n else:\n recorder = root.val\n if not mid_recur(root.right):\n return F...
<|body_start_0|> def mid_recur(root): nonlocal recorder if root: if not mid_recur(root.left): return False if recorder is not None and root.val <= recorder: return False else: reco...
BSTTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BSTTree: def isValidBST(root): """98.mid_验证二叉搜索树.py 判断是否合法二叉树(中序遍历,必须是递增序列!)""" <|body_0|> def isSameTree(p, q): """100.easy_相同的树.py 判断两个树是否完全一样""" <|body_1|> def searchBST(root, val): """700.easy_二叉搜索树中的搜索.py 在二叉树中搜索某个值 ,若不存在返回None""" <|...
stack_v2_sparse_classes_10k_train_002705
3,601
no_license
[ { "docstring": "98.mid_验证二叉搜索树.py 判断是否合法二叉树(中序遍历,必须是递增序列!)", "name": "isValidBST", "signature": "def isValidBST(root)" }, { "docstring": "100.easy_相同的树.py 判断两个树是否完全一样", "name": "isSameTree", "signature": "def isSameTree(p, q)" }, { "docstring": "700.easy_二叉搜索树中的搜索.py 在二叉树中搜索某个值 ,...
5
null
Implement the Python class `BSTTree` described below. Class description: Implement the BSTTree class. Method signatures and docstrings: - def isValidBST(root): 98.mid_验证二叉搜索树.py 判断是否合法二叉树(中序遍历,必须是递增序列!) - def isSameTree(p, q): 100.easy_相同的树.py 判断两个树是否完全一样 - def searchBST(root, val): 700.easy_二叉搜索树中的搜索.py 在二叉树中搜索某个值 ,...
Implement the Python class `BSTTree` described below. Class description: Implement the BSTTree class. Method signatures and docstrings: - def isValidBST(root): 98.mid_验证二叉搜索树.py 判断是否合法二叉树(中序遍历,必须是递增序列!) - def isSameTree(p, q): 100.easy_相同的树.py 判断两个树是否完全一样 - def searchBST(root, val): 700.easy_二叉搜索树中的搜索.py 在二叉树中搜索某个值 ,...
576de9b993f7763789d25a995702b40c9bc6fa57
<|skeleton|> class BSTTree: def isValidBST(root): """98.mid_验证二叉搜索树.py 判断是否合法二叉树(中序遍历,必须是递增序列!)""" <|body_0|> def isSameTree(p, q): """100.easy_相同的树.py 判断两个树是否完全一样""" <|body_1|> def searchBST(root, val): """700.easy_二叉搜索树中的搜索.py 在二叉树中搜索某个值 ,若不存在返回None""" <|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BSTTree: def isValidBST(root): """98.mid_验证二叉搜索树.py 判断是否合法二叉树(中序遍历,必须是递增序列!)""" def mid_recur(root): nonlocal recorder if root: if not mid_recur(root.left): return False if recorder is not None and root.val <= recorder...
the_stack_v2_python_sparse
0.leetcode/3.刷题/1.数据结构系列/2.树形结构/1.二叉查找树/bsttree.py
GMwang550146647/network
train
0
c2db422cc7a9bb4ec61ea1f37c28c02e9da345ff
[ "try:\n with datastore_services.get_ndb_context():\n question_summary = question_services.get_question_summary_from_model(question_summary_model)\n question_summary.version = question_version\n question_summary.validate()\nexcept Exception as e:\n logging.exception(e)\n return result.Err((ques...
<|body_start_0|> try: with datastore_services.get_ndb_context(): question_summary = question_services.get_question_summary_from_model(question_summary_model) question_summary.version = question_version question_summary.validate() except Exception as e:...
Job that audits PopulateQuestionSummaryVersionOneOffJob.
AuditPopulateQuestionSummaryVersionOneOffJob
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuditPopulateQuestionSummaryVersionOneOffJob: """Job that audits PopulateQuestionSummaryVersionOneOffJob.""" def _update_and_validate_summary_model(question_version: int, question_summary_model: question_models.QuestionSummaryModel) -> result.Result[Tuple[str, question_models.QuestionSummary...
stack_v2_sparse_classes_10k_train_002706
12,101
permissive
[ { "docstring": "Transform question summary model into question summary object, add a version field and return the populated summary model. Args: question_version: int. The version number in the corresponding question domain object. question_summary_model: QuestionSummaryModel. The question summary model to migr...
2
stack_v2_sparse_classes_30k_train_004538
Implement the Python class `AuditPopulateQuestionSummaryVersionOneOffJob` described below. Class description: Job that audits PopulateQuestionSummaryVersionOneOffJob. Method signatures and docstrings: - def _update_and_validate_summary_model(question_version: int, question_summary_model: question_models.QuestionSumma...
Implement the Python class `AuditPopulateQuestionSummaryVersionOneOffJob` described below. Class description: Job that audits PopulateQuestionSummaryVersionOneOffJob. Method signatures and docstrings: - def _update_and_validate_summary_model(question_version: int, question_summary_model: question_models.QuestionSumma...
d16fdf23d790eafd63812bd7239532256e30a21d
<|skeleton|> class AuditPopulateQuestionSummaryVersionOneOffJob: """Job that audits PopulateQuestionSummaryVersionOneOffJob.""" def _update_and_validate_summary_model(question_version: int, question_summary_model: question_models.QuestionSummaryModel) -> result.Result[Tuple[str, question_models.QuestionSummary...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AuditPopulateQuestionSummaryVersionOneOffJob: """Job that audits PopulateQuestionSummaryVersionOneOffJob.""" def _update_and_validate_summary_model(question_version: int, question_summary_model: question_models.QuestionSummaryModel) -> result.Result[Tuple[str, question_models.QuestionSummaryModel], Tuple...
the_stack_v2_python_sparse
core/jobs/batch_jobs/question_migration_jobs.py
oppia/oppia
train
6,172
87c34a5ceb0c54dde76385d13c44a47e4f08876a
[ "username = 'test@test.com'\npassword = 'toto'\nself.client.post(reverse(register), {'username': username, 'password': password})\nresponse = self.client.post(reverse(obtain_auth_token), {'username': username, 'password': password}, format='json')\nself.token = json.loads(response.content)['token']", "self.client...
<|body_start_0|> username = 'test@test.com' password = 'toto' self.client.post(reverse(register), {'username': username, 'password': password}) response = self.client.post(reverse(obtain_auth_token), {'username': username, 'password': password}, format='json') self.token = json.l...
Test access to API for users with API rights.
TestAPIAccess
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAPIAccess: """Test access to API for users with API rights.""" def setUp(self): """First register a user (automatically registered to free plan).""" <|body_0|> def test_api_access_ok(self): """Test API access by looking up for siemens.com.""" <|body_1...
stack_v2_sparse_classes_10k_train_002707
8,751
no_license
[ { "docstring": "First register a user (automatically registered to free plan).", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test API access by looking up for siemens.com.", "name": "test_api_access_ok", "signature": "def test_api_access_ok(self)" }, { "doc...
4
stack_v2_sparse_classes_30k_train_003402
Implement the Python class `TestAPIAccess` described below. Class description: Test access to API for users with API rights. Method signatures and docstrings: - def setUp(self): First register a user (automatically registered to free plan). - def test_api_access_ok(self): Test API access by looking up for siemens.com...
Implement the Python class `TestAPIAccess` described below. Class description: Test access to API for users with API rights. Method signatures and docstrings: - def setUp(self): First register a user (automatically registered to free plan). - def test_api_access_ok(self): Test API access by looking up for siemens.com...
9c0027b84d8dee6044ff28362e2b2b90c1759b90
<|skeleton|> class TestAPIAccess: """Test access to API for users with API rights.""" def setUp(self): """First register a user (automatically registered to free plan).""" <|body_0|> def test_api_access_ok(self): """Test API access by looking up for siemens.com.""" <|body_1...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestAPIAccess: """Test access to API for users with API rights.""" def setUp(self): """First register a user (automatically registered to free plan).""" username = 'test@test.com' password = 'toto' self.client.post(reverse(register), {'username': username, 'password': pass...
the_stack_v2_python_sparse
django_project/api_core/tests.py
juliensalinas/python-django-api-reactjs-frontend-slate-documentation-various-client-libs
train
3
85f30c89e58ba7e8b1be0a5d5b405614dd7e6806
[ "self.nb_sub_images = nb_sub_images\nself.window_size = window_size\nself.recovery = recovery\nself.image_horiz_size = image_horiz_size", "if idx < self.nb_sub_images - 1:\n pixel_step = self.window_size - self.recovery\n return (idx * pixel_step, idx * pixel_step + self.window_size)\nelif idx == self.nb_su...
<|body_start_0|> self.nb_sub_images = nb_sub_images self.window_size = window_size self.recovery = recovery self.image_horiz_size = image_horiz_size <|end_body_0|> <|body_start_1|> if idx < self.nb_sub_images - 1: pixel_step = self.window_size - self.recovery ...
Class that returns the limits of the slice of a lane.
LaneIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LaneIterator: """Class that returns the limits of the slice of a lane.""" def __init__(self, nb_sub_images, window_size, recovery, image_horiz_size): """Construct the lane iterator. Args: nb_sub_images (integer): the number of sub-images that has been sliced. window_size (integer): t...
stack_v2_sparse_classes_10k_train_002708
2,071
no_license
[ { "docstring": "Construct the lane iterator. Args: nb_sub_images (integer): the number of sub-images that has been sliced. window_size (integer): the width of the sub-image. recovery (integer): the number of pixels to be taken twice per sub-image. image_horiz_size (integer): the horizontal size of the original ...
2
stack_v2_sparse_classes_30k_train_003298
Implement the Python class `LaneIterator` described below. Class description: Class that returns the limits of the slice of a lane. Method signatures and docstrings: - def __init__(self, nb_sub_images, window_size, recovery, image_horiz_size): Construct the lane iterator. Args: nb_sub_images (integer): the number of ...
Implement the Python class `LaneIterator` described below. Class description: Class that returns the limits of the slice of a lane. Method signatures and docstrings: - def __init__(self, nb_sub_images, window_size, recovery, image_horiz_size): Construct the lane iterator. Args: nb_sub_images (integer): the number of ...
237ca81580db43525d8945017c0565b9722046ad
<|skeleton|> class LaneIterator: """Class that returns the limits of the slice of a lane.""" def __init__(self, nb_sub_images, window_size, recovery, image_horiz_size): """Construct the lane iterator. Args: nb_sub_images (integer): the number of sub-images that has been sliced. window_size (integer): t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LaneIterator: """Class that returns the limits of the slice of a lane.""" def __init__(self, nb_sub_images, window_size, recovery, image_horiz_size): """Construct the lane iterator. Args: nb_sub_images (integer): the number of sub-images that has been sliced. window_size (integer): the width of t...
the_stack_v2_python_sparse
src/d5_model_evaluation/slice_lane/image_magnifier/lane_iterator.py
remingtonCarmi/TrackingSwimmingENPC
train
0
55b5e2f7bf8b0a8465c3027cc138873c0433ffad
[ "job_thread = JobThread(queue_name, sleep_time, from_right)\njob_thread.setDaemon(True)\njob_thread.start()\nself.threads[job_thread.getName()] = job_thread\nsys.stdout.write('start a job thread, name: %s, ident: %s, queue_name: %s\\n' % (job_thread.getName(), job_thread.ident, queue_name))", "if not job_name in ...
<|body_start_0|> job_thread = JobThread(queue_name, sleep_time, from_right) job_thread.setDaemon(True) job_thread.start() self.threads[job_thread.getName()] = job_thread sys.stdout.write('start a job thread, name: %s, ident: %s, queue_name: %s\n' % (job_thread.getName(), job_thre...
管理工作线程, 开启/停止工作线程
JobThreadManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JobThreadManager: """管理工作线程, 开启/停止工作线程""" def add(self, queue_name, sleep_time, from_right=True): """开启一个工作线程""" <|body_0|> def stop(self, job_name): """安全的停止一个工作线程 正在转换中的时候,会等待转换完成后自动退出""" <|body_1|> <|end_skeleton|> <|body_start_0|> job_thread...
stack_v2_sparse_classes_10k_train_002709
2,159
no_license
[ { "docstring": "开启一个工作线程", "name": "add", "signature": "def add(self, queue_name, sleep_time, from_right=True)" }, { "docstring": "安全的停止一个工作线程 正在转换中的时候,会等待转换完成后自动退出", "name": "stop", "signature": "def stop(self, job_name)" } ]
2
stack_v2_sparse_classes_30k_train_007042
Implement the Python class `JobThreadManager` described below. Class description: 管理工作线程, 开启/停止工作线程 Method signatures and docstrings: - def add(self, queue_name, sleep_time, from_right=True): 开启一个工作线程 - def stop(self, job_name): 安全的停止一个工作线程 正在转换中的时候,会等待转换完成后自动退出
Implement the Python class `JobThreadManager` described below. Class description: 管理工作线程, 开启/停止工作线程 Method signatures and docstrings: - def add(self, queue_name, sleep_time, from_right=True): 开启一个工作线程 - def stop(self, job_name): 安全的停止一个工作线程 正在转换中的时候,会等待转换完成后自动退出 <|skeleton|> class JobThreadManager: """管理工作线程, 开启...
05dae4225db1fedbe738d317bf44aca8604c9eed
<|skeleton|> class JobThreadManager: """管理工作线程, 开启/停止工作线程""" def add(self, queue_name, sleep_time, from_right=True): """开启一个工作线程""" <|body_0|> def stop(self, job_name): """安全的停止一个工作线程 正在转换中的时候,会等待转换完成后自动退出""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class JobThreadManager: """管理工作线程, 开启/停止工作线程""" def add(self, queue_name, sleep_time, from_right=True): """开启一个工作线程""" job_thread = JobThread(queue_name, sleep_time, from_right) job_thread.setDaemon(True) job_thread.start() self.threads[job_thread.getName()] = job_thread...
the_stack_v2_python_sparse
Python/PythonC++Scala/script/.svn/pristine/55/55b5e2f7bf8b0a8465c3027cc138873c0433ffad.svn-base
cash2one/dataMining-1
train
0
ce4f3652ea3f9af32a181eb52fa9f879083b2c91
[ "orig_query = self.request.get('query')\nlogging.debug('Received raw query %r', orig_query)\nif not self.QUERY_LIMIT_RE.search(orig_query):\n orig_query += ' LIMIT 30'\nquery = orig_query\nquery, columns = self._RemoveSelectFromQuery(query)\nif query == orig_query and columns == self.DEFAULT_COLUMNS:\n orig_q...
<|body_start_0|> orig_query = self.request.get('query') logging.debug('Received raw query %r', orig_query) if not self.QUERY_LIMIT_RE.search(orig_query): orig_query += ' LIMIT 30' query = orig_query query, columns = self._RemoveSelectFromQuery(query) if query ...
Provide interface for interacting with DB.
MainPage
[ "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MainPage: """Provide interface for interacting with DB.""" def get(self): """Support GET to stats page.""" <|body_0|> def _RemoveSelectFromQuery(self, query): """Remove SELECT clause from |query|, return tuple (new_query, columns).""" <|body_1|> def ...
stack_v2_sparse_classes_10k_train_002710
9,774
permissive
[ { "docstring": "Support GET to stats page.", "name": "get", "signature": "def get(self)" }, { "docstring": "Remove SELECT clause from |query|, return tuple (new_query, columns).", "name": "_RemoveSelectFromQuery", "signature": "def _RemoveSelectFromQuery(self, query)" }, { "docst...
5
null
Implement the Python class `MainPage` described below. Class description: Provide interface for interacting with DB. Method signatures and docstrings: - def get(self): Support GET to stats page. - def _RemoveSelectFromQuery(self, query): Remove SELECT clause from |query|, return tuple (new_query, columns). - def _Adj...
Implement the Python class `MainPage` described below. Class description: Provide interface for interacting with DB. Method signatures and docstrings: - def get(self): Support GET to stats page. - def _RemoveSelectFromQuery(self, query): Remove SELECT clause from |query|, return tuple (new_query, columns). - def _Adj...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class MainPage: """Provide interface for interacting with DB.""" def get(self): """Support GET to stats page.""" <|body_0|> def _RemoveSelectFromQuery(self, query): """Remove SELECT clause from |query|, return tuple (new_query, columns).""" <|body_1|> def ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MainPage: """Provide interface for interacting with DB.""" def get(self): """Support GET to stats page.""" orig_query = self.request.get('query') logging.debug('Received raw query %r', orig_query) if not self.QUERY_LIMIT_RE.search(orig_query): orig_query += ' L...
the_stack_v2_python_sparse
third_party/chromite/appengine/chromiumos-build-stats/stats.py
metux/chromium-suckless
train
5
b36fcfe7d6d5350afb995f1862d974729d01e333
[ "parser.add_argument('appname', help='The sample app name, e.g. \"finance\".')\nparser.add_argument('--instance-id', required=True, type=str, help='The Cloud Spanner instance ID for the sample app.')\nparser.add_argument('--database-id', type=str, help='ID of the new Cloud Spanner database to create for the sample ...
<|body_start_0|> parser.add_argument('appname', help='The sample app name, e.g. "finance".') parser.add_argument('--instance-id', required=True, type=str, help='The Cloud Spanner instance ID for the sample app.') parser.add_argument('--database-id', type=str, help='ID of the new Cloud Spanner da...
Initialize a Cloud Spanner sample app. This command creates a Cloud Spanner database in the given instance for the sample app and loads any initial data required by the application.
Init
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Init: """Initialize a Cloud Spanner sample app. This command creates a Cloud Spanner database in the given instance for the sample app and loads any initial data required by the application.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args...
stack_v2_sparse_classes_10k_train_002711
9,146
permissive
[ { "docstring": "Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed.", "name": "Args", "signature": "def Args(parser)" }, { "docstring"...
2
stack_v2_sparse_classes_30k_val_000148
Implement the Python class `Init` described below. Class description: Initialize a Cloud Spanner sample app. This command creates a Cloud Spanner database in the given instance for the sample app and loads any initial data required by the application. Method signatures and docstrings: - def Args(parser): Args is call...
Implement the Python class `Init` described below. Class description: Initialize a Cloud Spanner sample app. This command creates a Cloud Spanner database in the given instance for the sample app and loads any initial data required by the application. Method signatures and docstrings: - def Args(parser): Args is call...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class Init: """Initialize a Cloud Spanner sample app. This command creates a Cloud Spanner database in the given instance for the sample app and loads any initial data required by the application.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Init: """Initialize a Cloud Spanner sample app. This command creates a Cloud Spanner database in the given instance for the sample app and loads any initial data required by the application.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An ...
the_stack_v2_python_sparse
lib/surface/spanner/samples/init.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
bb0c5155111e0c6ad0be0dcc95af68e9fde7e24b
[ "response = self.client.get(reverse('education:index'))\nself.assertEqual(response.status_code, 200)\nself.assertEqual(response.context.get('json_data'), None)\nself.assertContains(response, 'High School Graduation')\nself.assertContains(response, 'How Rates Were Calculated')\nself.assertContains(response, 'Home')\...
<|body_start_0|> response = self.client.get(reverse('education:index')) self.assertEqual(response.status_code, 200) self.assertEqual(response.context.get('json_data'), None) self.assertContains(response, 'High School Graduation') self.assertContains(response, 'How Rates Were Calc...
EducationIndexViewTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EducationIndexViewTests: def test_no_data(self): """If no data is in the database, no content is displayed but there is no map of graudation rates.""" <|body_0|> def test_with_data(self): """If state data is in the database, make sure the conents renders and a graph ...
stack_v2_sparse_classes_10k_train_002712
9,266
no_license
[ { "docstring": "If no data is in the database, no content is displayed but there is no map of graudation rates.", "name": "test_no_data", "signature": "def test_no_data(self)" }, { "docstring": "If state data is in the database, make sure the conents renders and a graph of the graudation rates i...
2
stack_v2_sparse_classes_30k_train_003805
Implement the Python class `EducationIndexViewTests` described below. Class description: Implement the EducationIndexViewTests class. Method signatures and docstrings: - def test_no_data(self): If no data is in the database, no content is displayed but there is no map of graudation rates. - def test_with_data(self): ...
Implement the Python class `EducationIndexViewTests` described below. Class description: Implement the EducationIndexViewTests class. Method signatures and docstrings: - def test_no_data(self): If no data is in the database, no content is displayed but there is no map of graudation rates. - def test_with_data(self): ...
2a8e2dc4e9b3cb92d4d437b37e61940a9486b81f
<|skeleton|> class EducationIndexViewTests: def test_no_data(self): """If no data is in the database, no content is displayed but there is no map of graudation rates.""" <|body_0|> def test_with_data(self): """If state data is in the database, make sure the conents renders and a graph ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EducationIndexViewTests: def test_no_data(self): """If no data is in the database, no content is displayed but there is no map of graudation rates.""" response = self.client.get(reverse('education:index')) self.assertEqual(response.status_code, 200) self.assertEqual(response.co...
the_stack_v2_python_sparse
education/tests.py
smeds1/mysite
train
1
959c5ba910b87b05bc1cdf67bfbd126391f5caaf
[ "super().__init__()\nself.input_channel_size = input_channels\nself.output_channel_size = output_channels\nself.num_nodes = num_nodes\nGraphConv.global_count += 1\nself.name = name if name else 'Graph_{}'.format(GraphConv.global_count)\nvalue = math.sqrt(6 / (input_channels + output_channels))\nmat_weights = []\nid...
<|body_start_0|> super().__init__() self.input_channel_size = input_channels self.output_channel_size = output_channels self.num_nodes = num_nodes GraphConv.global_count += 1 self.name = name if name else 'Graph_{}'.format(GraphConv.global_count) value = math.sqrt...
Graph Conv layer. See: https://arxiv.org/abs/1609.02907
GraphConv
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GraphConv: """Graph Conv layer. See: https://arxiv.org/abs/1609.02907""" def __init__(self, input_channels, output_channels, num_nodes, bias=True, activation=lbann.Relu, name=None): """Initialize Graph layer Args: input_channels (int): The size of the input node features output_chann...
stack_v2_sparse_classes_10k_train_002713
4,744
permissive
[ { "docstring": "Initialize Graph layer Args: input_channels (int): The size of the input node features output_channels (int): The output size of the node features num_nodes (int): Number of vertices in the graph bias (bool): Whether to apply biases after weights transform activation (type): Activation layer for...
2
null
Implement the Python class `GraphConv` described below. Class description: Graph Conv layer. See: https://arxiv.org/abs/1609.02907 Method signatures and docstrings: - def __init__(self, input_channels, output_channels, num_nodes, bias=True, activation=lbann.Relu, name=None): Initialize Graph layer Args: input_channel...
Implement the Python class `GraphConv` described below. Class description: Graph Conv layer. See: https://arxiv.org/abs/1609.02907 Method signatures and docstrings: - def __init__(self, input_channels, output_channels, num_nodes, bias=True, activation=lbann.Relu, name=None): Initialize Graph layer Args: input_channel...
e8cf85eed2acbd3383892bf7cb2d88b44c194f4f
<|skeleton|> class GraphConv: """Graph Conv layer. See: https://arxiv.org/abs/1609.02907""" def __init__(self, input_channels, output_channels, num_nodes, bias=True, activation=lbann.Relu, name=None): """Initialize Graph layer Args: input_channels (int): The size of the input node features output_chann...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GraphConv: """Graph Conv layer. See: https://arxiv.org/abs/1609.02907""" def __init__(self, input_channels, output_channels, num_nodes, bias=True, activation=lbann.Relu, name=None): """Initialize Graph layer Args: input_channels (int): The size of the input node features output_channels (int): Th...
the_stack_v2_python_sparse
python/lbann/modules/graph/sparse/GraphConv.py
LLNL/lbann
train
225
03290573509782957b78362f1e42cfa560d5a89b
[ "Parametre.__init__(self, 'conquérir', 'conquer')\nself.tronquer = True\nself.aide_courte = 'conquit un navire et équipage'\nself.aide_longue = \"Cette commande permet de conquérir un navire adverse : si vous en avez le droit, vous en deviendrez son propriétaire. Vous aurez également les droits de commander les mat...
<|body_start_0|> Parametre.__init__(self, 'conquérir', 'conquer') self.tronquer = True self.aide_courte = 'conquit un navire et équipage' self.aide_longue = "Cette commande permet de conquérir un navire adverse : si vous en avez le droit, vous en deviendrez son propriétaire. Vous aurez é...
Commande 'équipage conquérir'.
PrmConquerir
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmConquerir: """Commande 'équipage conquérir'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|> <|body_start_0|> Para...
stack_v2_sparse_classes_10k_train_002714
4,608
permissive
[ { "docstring": "Constructeur du paramètre", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Interprétation du paramètre", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
null
Implement the Python class `PrmConquerir` described below. Class description: Commande 'équipage conquérir'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre
Implement the Python class `PrmConquerir` described below. Class description: Commande 'équipage conquérir'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre <|skeleton|> class PrmConquerir: """Commande...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmConquerir: """Commande 'équipage conquérir'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PrmConquerir: """Commande 'équipage conquérir'.""" def __init__(self): """Constructeur du paramètre""" Parametre.__init__(self, 'conquérir', 'conquer') self.tronquer = True self.aide_courte = 'conquit un navire et équipage' self.aide_longue = "Cette commande permet...
the_stack_v2_python_sparse
src/secondaires/navigation/commandes/equipage/conquerir.py
vincent-lg/tsunami
train
5
2786c897b3bfa47724930c4c6540cd8794f9efd3
[ "assert isinstance(output_size, (int, tuple))\nif isinstance(output_size, int):\n self.output_size = (output_size, output_size)\nelse:\n assert len(output_size) == 2\n self.output_size = output_size", "imidx, image, label = (sample['imidx'], sample['image'], sample['label'])\nif random.random() >= 0.5:\n...
<|body_start_0|> assert isinstance(output_size, (int, tuple)) if isinstance(output_size, int): self.output_size = (output_size, output_size) else: assert len(output_size) == 2 self.output_size = output_size <|end_body_0|> <|body_start_1|> imidx, image...
RandomCrop operation
RandomCrop
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomCrop: """RandomCrop operation""" def __init__(self, output_size): """RandomCrop definition""" <|body_0|> def __call__(self, sample): """RandomCrop compute""" <|body_1|> <|end_skeleton|> <|body_start_0|> assert isinstance(output_size, (int,...
stack_v2_sparse_classes_10k_train_002715
14,055
permissive
[ { "docstring": "RandomCrop definition", "name": "__init__", "signature": "def __init__(self, output_size)" }, { "docstring": "RandomCrop compute", "name": "__call__", "signature": "def __call__(self, sample)" } ]
2
null
Implement the Python class `RandomCrop` described below. Class description: RandomCrop operation Method signatures and docstrings: - def __init__(self, output_size): RandomCrop definition - def __call__(self, sample): RandomCrop compute
Implement the Python class `RandomCrop` described below. Class description: RandomCrop operation Method signatures and docstrings: - def __init__(self, output_size): RandomCrop definition - def __call__(self, sample): RandomCrop compute <|skeleton|> class RandomCrop: """RandomCrop operation""" def __init__(...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class RandomCrop: """RandomCrop operation""" def __init__(self, output_size): """RandomCrop definition""" <|body_0|> def __call__(self, sample): """RandomCrop compute""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RandomCrop: """RandomCrop operation""" def __init__(self, output_size): """RandomCrop definition""" assert isinstance(output_size, (int, tuple)) if isinstance(output_size, int): self.output_size = (output_size, output_size) else: assert len(output_s...
the_stack_v2_python_sparse
research/cv/u2net/src/data_loader.py
mindspore-ai/models
train
301
fc6ce3b5da8592f44271f6622bb653bbe1aba0c9
[ "super(Envelope, self).__init__()\nself.p = exponent\nself.a = -(self.p + 1) * (self.p + 2) / 2\nself.b = self.p * (self.p + 2)\nself.c = -self.p * (self.p + 1) / 2", "p, a, b, c = (self.p, self.a, self.b, self.c)\nx_pow_p0 = x.pow(p)\nx_pow_p1 = x_pow_p0 * x\nenv_val = 1.0 / x + a * x_pow_p0 + b * x_pow_p1 + c *...
<|body_start_0|> super(Envelope, self).__init__() self.p = exponent self.a = -(self.p + 1) * (self.p + 2) / 2 self.b = self.p * (self.p + 2) self.c = -self.p * (self.p + 1) / 2 <|end_body_0|> <|body_start_1|> p, a, b, c = (self.p, self.a, self.b, self.c) x_pow_p0...
Envelope.
Envelope
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Envelope: """Envelope.""" def __init__(self, exponent) -> None: """Initialize envelope. Args: exponent: exponent of the envelope.""" <|body_0|> def forward(self, x): """Forward pass. Args: x: input. Returns: Envelope of x.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_10k_train_002716
34,044
permissive
[ { "docstring": "Initialize envelope. Args: exponent: exponent of the envelope.", "name": "__init__", "signature": "def __init__(self, exponent) -> None" }, { "docstring": "Forward pass. Args: x: input. Returns: Envelope of x.", "name": "forward", "signature": "def forward(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_004763
Implement the Python class `Envelope` described below. Class description: Envelope. Method signatures and docstrings: - def __init__(self, exponent) -> None: Initialize envelope. Args: exponent: exponent of the envelope. - def forward(self, x): Forward pass. Args: x: input. Returns: Envelope of x.
Implement the Python class `Envelope` described below. Class description: Envelope. Method signatures and docstrings: - def __init__(self, exponent) -> None: Initialize envelope. Args: exponent: exponent of the envelope. - def forward(self, x): Forward pass. Args: x: input. Returns: Envelope of x. <|skeleton|> class...
0b69b7d5b261f2f9af3984793c1295b9b80cd01a
<|skeleton|> class Envelope: """Envelope.""" def __init__(self, exponent) -> None: """Initialize envelope. Args: exponent: exponent of the envelope.""" <|body_0|> def forward(self, x): """Forward pass. Args: x: input. Returns: Envelope of x.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Envelope: """Envelope.""" def __init__(self, exponent) -> None: """Initialize envelope. Args: exponent: exponent of the envelope.""" super(Envelope, self).__init__() self.p = exponent self.a = -(self.p + 1) * (self.p + 2) / 2 self.b = self.p * (self.p + 2) ...
the_stack_v2_python_sparse
src/gt4sd/frameworks/gflownet/ml/models/mxmnet.py
GT4SD/gt4sd-core
train
239
a1f62f9554d8a41caffb18e10b9127c43dbecbe3
[ "for i in range(len(shifts) - 1)[::-1]:\n shifts[i] += shifts[i + 1]\nreturn ''.join([chr((ord(c) - 97 + s) % 26 + 97) for c, s in zip(S, shifts)])", "s = [ord(c) for c in S]\nfor i, shift in enumerate(shifts):\n for j in range(i + 1):\n s[j] += shift % 26\nreturn ''.join([chr((n - 97) % 26 + 97) for...
<|body_start_0|> for i in range(len(shifts) - 1)[::-1]: shifts[i] += shifts[i + 1] return ''.join([chr((ord(c) - 97 + s) % 26 + 97) for c, s in zip(S, shifts)]) <|end_body_0|> <|body_start_1|> s = [ord(c) for c in S] for i, shift in enumerate(shifts): for j in ra...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def shiftingLetters(self, S, shifts): """:type S: str :type shifts: List[int] :rtype: str""" <|body_0|> def shiftingLetters_TLE(self, S, shifts): """:type S: str :type shifts: List[int] :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_002717
2,168
no_license
[ { "docstring": ":type S: str :type shifts: List[int] :rtype: str", "name": "shiftingLetters", "signature": "def shiftingLetters(self, S, shifts)" }, { "docstring": ":type S: str :type shifts: List[int] :rtype: str", "name": "shiftingLetters_TLE", "signature": "def shiftingLetters_TLE(sel...
2
stack_v2_sparse_classes_30k_train_006052
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shiftingLetters(self, S, shifts): :type S: str :type shifts: List[int] :rtype: str - def shiftingLetters_TLE(self, S, shifts): :type S: str :type shifts: List[int] :rtype: st...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shiftingLetters(self, S, shifts): :type S: str :type shifts: List[int] :rtype: str - def shiftingLetters_TLE(self, S, shifts): :type S: str :type shifts: List[int] :rtype: st...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def shiftingLetters(self, S, shifts): """:type S: str :type shifts: List[int] :rtype: str""" <|body_0|> def shiftingLetters_TLE(self, S, shifts): """:type S: str :type shifts: List[int] :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def shiftingLetters(self, S, shifts): """:type S: str :type shifts: List[int] :rtype: str""" for i in range(len(shifts) - 1)[::-1]: shifts[i] += shifts[i + 1] return ''.join([chr((ord(c) - 97 + s) % 26 + 97) for c, s in zip(S, shifts)]) def shiftingLetters_TL...
the_stack_v2_python_sparse
src/lt_848.py
oxhead/CodingYourWay
train
0
da2f89f2c3d6dcff588b6b25b7dde4721b9db986
[ "V = np.ones((neu_dim, x_dim)) / 2\nW = np.ones((output_dim, neu_dim)) / 2\nY = np.zeros(output_dim)\nV = normalization_all(V)\nself.V = V\nself.W = W\nself.Y = Y\nself.lr = lr\nself.lr_out = lr_out", "z_layer = np.dot(self.V, x.T)\nargmax = np.argmax(z_layer)\nreturn argmax", "self.V[argmax] = self.V[argmax] +...
<|body_start_0|> V = np.ones((neu_dim, x_dim)) / 2 W = np.ones((output_dim, neu_dim)) / 2 Y = np.zeros(output_dim) V = normalization_all(V) self.V = V self.W = W self.Y = Y self.lr = lr self.lr_out = lr_out <|end_body_0|> <|body_start_1|> ...
competitive_network
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class competitive_network: def __init__(self, x_dim, neu_dim, output_dim, lr, lr_out): """类参数初始化""" <|body_0|> def forward_propagation(self, x): """前向传播 input:self(object):类参数 x(mat):一个训练样本 output:argmax(int):被激活的权重向量指针""" <|body_1|> def back_propagation(self,...
stack_v2_sparse_classes_10k_train_002718
4,419
no_license
[ { "docstring": "类参数初始化", "name": "__init__", "signature": "def __init__(self, x_dim, neu_dim, output_dim, lr, lr_out)" }, { "docstring": "前向传播 input:self(object):类参数 x(mat):一个训练样本 output:argmax(int):被激活的权重向量指针", "name": "forward_propagation", "signature": "def forward_propagation(self, x...
6
stack_v2_sparse_classes_30k_train_005041
Implement the Python class `competitive_network` described below. Class description: Implement the competitive_network class. Method signatures and docstrings: - def __init__(self, x_dim, neu_dim, output_dim, lr, lr_out): 类参数初始化 - def forward_propagation(self, x): 前向传播 input:self(object):类参数 x(mat):一个训练样本 output:argm...
Implement the Python class `competitive_network` described below. Class description: Implement the competitive_network class. Method signatures and docstrings: - def __init__(self, x_dim, neu_dim, output_dim, lr, lr_out): 类参数初始化 - def forward_propagation(self, x): 前向传播 input:self(object):类参数 x(mat):一个训练样本 output:argm...
97e69c71af972f22c38b714b659a374d04c08b84
<|skeleton|> class competitive_network: def __init__(self, x_dim, neu_dim, output_dim, lr, lr_out): """类参数初始化""" <|body_0|> def forward_propagation(self, x): """前向传播 input:self(object):类参数 x(mat):一个训练样本 output:argmax(int):被激活的权重向量指针""" <|body_1|> def back_propagation(self,...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class competitive_network: def __init__(self, x_dim, neu_dim, output_dim, lr, lr_out): """类参数初始化""" V = np.ones((neu_dim, x_dim)) / 2 W = np.ones((output_dim, neu_dim)) / 2 Y = np.zeros(output_dim) V = normalization_all(V) self.V = V self.W = W self.Y ...
the_stack_v2_python_sparse
HW2/Hermit_7.py
gavinatthu/ANN_course
train
3
05668b57bdb7acb5d38f6d265e74ea38e2cb1b71
[ "try:\n plugin = module.Plugin\nexcept AttributeError:\n return False\ncommand = data[invocation_length:]\ntry:\n result = plugin.run(self, command)\nexcept TypeError:\n result = plugin().run(self, command)\nplugin_ran = True\nreturn (plugin_ran, result)", "if plugin_list:\n plugin_ran = False\n ...
<|body_start_0|> try: plugin = module.Plugin except AttributeError: return False command = data[invocation_length:] try: result = plugin.run(self, command) except TypeError: result = plugin().run(self, command) plugin_ran = ...
PluginRunner
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PluginRunner: def run_plugin(self, module, data, invocation_length): """Run the plugin in the given module. :param self: :param module: :param data: :param invocation_length: :return:""" <|body_0|> def process_plugins(self, plugin_list, data, help_mode_on=False): """...
stack_v2_sparse_classes_10k_train_002719
4,870
no_license
[ { "docstring": "Run the plugin in the given module. :param self: :param module: :param data: :param invocation_length: :return:", "name": "run_plugin", "signature": "def run_plugin(self, module, data, invocation_length)" }, { "docstring": "Process plugins to see if the data should be intercepted...
2
stack_v2_sparse_classes_30k_train_004665
Implement the Python class `PluginRunner` described below. Class description: Implement the PluginRunner class. Method signatures and docstrings: - def run_plugin(self, module, data, invocation_length): Run the plugin in the given module. :param self: :param module: :param data: :param invocation_length: :return: - d...
Implement the Python class `PluginRunner` described below. Class description: Implement the PluginRunner class. Method signatures and docstrings: - def run_plugin(self, module, data, invocation_length): Run the plugin in the given module. :param self: :param module: :param data: :param invocation_length: :return: - d...
fb0aa92ea05dc05416a0a2cf3cc7a698b25f1d38
<|skeleton|> class PluginRunner: def run_plugin(self, module, data, invocation_length): """Run the plugin in the given module. :param self: :param module: :param data: :param invocation_length: :return:""" <|body_0|> def process_plugins(self, plugin_list, data, help_mode_on=False): """...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PluginRunner: def run_plugin(self, module, data, invocation_length): """Run the plugin in the given module. :param self: :param module: :param data: :param invocation_length: :return:""" try: plugin = module.Plugin except AttributeError: return False com...
the_stack_v2_python_sparse
common.py
RattleyCooper/Oyster
train
2
5c9508b93bd508833fd8ef0ebaa2b275eb015812
[ "self.previous = datetime.datetime.now()\nself.servo_0 = Servo(servos[0], initial_positions[0], 5)\nself.servo_1 = Servo(servos[1], initial_positions[1], 5)\nself.servo_2 = Servo(servos[2], initial_positions[2], 5)\nself.servos = [self.servo_0, self.servo_1, self.servo_2]\nself.reposition = False\nself.grabbed = Fa...
<|body_start_0|> self.previous = datetime.datetime.now() self.servo_0 = Servo(servos[0], initial_positions[0], 5) self.servo_1 = Servo(servos[1], initial_positions[1], 5) self.servo_2 = Servo(servos[2], initial_positions[2], 5) self.servos = [self.servo_0, self.servo_1, self.serv...
Base class for grabber which directly implements servo
Grabber
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Grabber: """Base class for grabber which directly implements servo""" def __init__(self, servos, initial_positions): """Constructor for grabber class :param servos: Array of grabber servo id`s :param initial_positions: Array of servo positions""" <|body_0|> def grab(self...
stack_v2_sparse_classes_10k_train_002720
4,112
permissive
[ { "docstring": "Constructor for grabber class :param servos: Array of grabber servo id`s :param initial_positions: Array of servo positions", "name": "__init__", "signature": "def __init__(self, servos, initial_positions)" }, { "docstring": "Function that contains commands to close grabber :para...
6
stack_v2_sparse_classes_30k_train_000203
Implement the Python class `Grabber` described below. Class description: Base class for grabber which directly implements servo Method signatures and docstrings: - def __init__(self, servos, initial_positions): Constructor for grabber class :param servos: Array of grabber servo id`s :param initial_positions: Array of...
Implement the Python class `Grabber` described below. Class description: Base class for grabber which directly implements servo Method signatures and docstrings: - def __init__(self, servos, initial_positions): Constructor for grabber class :param servos: Array of grabber servo id`s :param initial_positions: Array of...
c8898bef493618c19ba9f3c564ee25481fd4695e
<|skeleton|> class Grabber: """Base class for grabber which directly implements servo""" def __init__(self, servos, initial_positions): """Constructor for grabber class :param servos: Array of grabber servo id`s :param initial_positions: Array of servo positions""" <|body_0|> def grab(self...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Grabber: """Base class for grabber which directly implements servo""" def __init__(self, servos, initial_positions): """Constructor for grabber class :param servos: Array of grabber servo id`s :param initial_positions: Array of servo positions""" self.previous = datetime.datetime.now() ...
the_stack_v2_python_sparse
src/entities/movement/grabber.py
DwarfExop/IDP
train
0
5821076a103befe2a060e9d1e26b59ce44188ccd
[ "log = MissionClockEvent(user=self.user1, team_on_clock=True, team_on_timeout=False)\nlog.save()\nself.assertIsNotNone(log.__unicode__())", "log = MissionClockEvent(user=self.user1, team_on_clock=False, team_on_timeout=False)\nlog.save()\nlog = MissionClockEvent(user=self.user2, team_on_clock=True, team_on_timeou...
<|body_start_0|> log = MissionClockEvent(user=self.user1, team_on_clock=True, team_on_timeout=False) log.save() self.assertIsNotNone(log.__unicode__()) <|end_body_0|> <|body_start_1|> log = MissionClockEvent(user=self.user1, team_on_clock=False, team_on_timeout=False) log.save()...
Tests the MissionClockEvent model.
TestMissionClockEventModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestMissionClockEventModel: """Tests the MissionClockEvent model.""" def test_unicode(self): """Tests the unicode method executes.""" <|body_0|> def test_user_on_clock(self): """Tests the user_on_clock method.""" <|body_1|> def test_user_on_timeout(s...
stack_v2_sparse_classes_10k_train_002721
3,380
permissive
[ { "docstring": "Tests the unicode method executes.", "name": "test_unicode", "signature": "def test_unicode(self)" }, { "docstring": "Tests the user_on_clock method.", "name": "test_user_on_clock", "signature": "def test_user_on_clock(self)" }, { "docstring": "Tests the user_on_t...
4
stack_v2_sparse_classes_30k_train_003209
Implement the Python class `TestMissionClockEventModel` described below. Class description: Tests the MissionClockEvent model. Method signatures and docstrings: - def test_unicode(self): Tests the unicode method executes. - def test_user_on_clock(self): Tests the user_on_clock method. - def test_user_on_timeout(self)...
Implement the Python class `TestMissionClockEventModel` described below. Class description: Tests the MissionClockEvent model. Method signatures and docstrings: - def test_unicode(self): Tests the unicode method executes. - def test_user_on_clock(self): Tests the user_on_clock method. - def test_user_on_timeout(self)...
509f36562fc895433fcd01da755a35dd04581025
<|skeleton|> class TestMissionClockEventModel: """Tests the MissionClockEvent model.""" def test_unicode(self): """Tests the unicode method executes.""" <|body_0|> def test_user_on_clock(self): """Tests the user_on_clock method.""" <|body_1|> def test_user_on_timeout(s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestMissionClockEventModel: """Tests the MissionClockEvent model.""" def test_unicode(self): """Tests the unicode method executes.""" log = MissionClockEvent(user=self.user1, team_on_clock=True, team_on_timeout=False) log.save() self.assertIsNotNone(log.__unicode__()) ...
the_stack_v2_python_sparse
server/auvsi_suas/models/mission_clock_event_test.py
matcheydj/interop
train
1
ebf76420f3873e687371e29f074708814bb132ff
[ "option_view = '\\n 1. 列出所有学生\\n 2. 查询\\n '\nprint('学生信息系统'.center(cls.width, '='))\nprint(option_view)\nnumber = input('请选择(Ctrl + c 退出):')\nfunc_dict = {'1': cls.list_student, '2': cls.search}\nif number not in func_dict.keys():\n raise Exception('【提示】:输入有误, 请重新选择')\nfunc = func_dict[numbe...
<|body_start_0|> option_view = '\n 1. 列出所有学生\n 2. 查询\n ' print('学生信息系统'.center(cls.width, '=')) print(option_view) number = input('请选择(Ctrl + c 退出):') func_dict = {'1': cls.list_student, '2': cls.search} if number not in func_dict.keys(): ...
View
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class View: def menu(cls): """主菜单""" <|body_0|> def list_student(cls): """列出所有学生""" <|body_1|> def search(cls): """查询""" <|body_2|> def search_student(cls): """查询学生信息""" <|body_3|> def search_score(cls): """查询成...
stack_v2_sparse_classes_10k_train_002722
3,327
no_license
[ { "docstring": "主菜单", "name": "menu", "signature": "def menu(cls)" }, { "docstring": "列出所有学生", "name": "list_student", "signature": "def list_student(cls)" }, { "docstring": "查询", "name": "search", "signature": "def search(cls)" }, { "docstring": "查询学生信息", "na...
5
stack_v2_sparse_classes_30k_train_001072
Implement the Python class `View` described below. Class description: Implement the View class. Method signatures and docstrings: - def menu(cls): 主菜单 - def list_student(cls): 列出所有学生 - def search(cls): 查询 - def search_student(cls): 查询学生信息 - def search_score(cls): 查询成绩
Implement the Python class `View` described below. Class description: Implement the View class. Method signatures and docstrings: - def menu(cls): 主菜单 - def list_student(cls): 列出所有学生 - def search(cls): 查询 - def search_student(cls): 查询学生信息 - def search_score(cls): 查询成绩 <|skeleton|> class View: def menu(cls): ...
b7f29743883739e3b298d49a170f367944ee0d9a
<|skeleton|> class View: def menu(cls): """主菜单""" <|body_0|> def list_student(cls): """列出所有学生""" <|body_1|> def search(cls): """查询""" <|body_2|> def search_student(cls): """查询学生信息""" <|body_3|> def search_score(cls): """查询成...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class View: def menu(cls): """主菜单""" option_view = '\n 1. 列出所有学生\n 2. 查询\n ' print('学生信息系统'.center(cls.width, '=')) print(option_view) number = input('请选择(Ctrl + c 退出):') func_dict = {'1': cls.list_student, '2': cls.search} if number not i...
the_stack_v2_python_sparse
16-17/01_界面/src/view.py
ucookie/basic-python
train
0
5233f8f4300c916a7730fd5d82b380c62cabd9bb
[ "portal_types = getToolByName(self.context, 'portal_types')\ntransaction = self.context\nentries = transaction.entries()\nif not transaction.canUndoOrReverse():\n raise AccessControl_Unauthorized('No permission to create transactionentries, or there are no entries to reverse')\ntransaction_folder = transaction.g...
<|body_start_0|> portal_types = getToolByName(self.context, 'portal_types') transaction = self.context entries = transaction.entries() if not transaction.canUndoOrReverse(): raise AccessControl_Unauthorized('No permission to create transactionentries, or there are no entries ...
Transaction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transaction: def reverse_transaction(self): """Reverse a transaction - create a debit for a credit and a credit for a debit for each transaction entry""" <|body_0|> def undo_transaction(self): """Undo a transaction - remove the reference to the transaction, and do a ...
stack_v2_sparse_classes_10k_train_002723
2,892
no_license
[ { "docstring": "Reverse a transaction - create a debit for a credit and a credit for a debit for each transaction entry", "name": "reverse_transaction", "signature": "def reverse_transaction(self)" }, { "docstring": "Undo a transaction - remove the reference to the transaction, and do a debit/cr...
2
stack_v2_sparse_classes_30k_train_000812
Implement the Python class `Transaction` described below. Class description: Implement the Transaction class. Method signatures and docstrings: - def reverse_transaction(self): Reverse a transaction - create a debit for a credit and a credit for a debit for each transaction entry - def undo_transaction(self): Undo a ...
Implement the Python class `Transaction` described below. Class description: Implement the Transaction class. Method signatures and docstrings: - def reverse_transaction(self): Reverse a transaction - create a debit for a credit and a credit for a debit for each transaction entry - def undo_transaction(self): Undo a ...
77abccb6f7454f09a11e17841ba2049d4f11915c
<|skeleton|> class Transaction: def reverse_transaction(self): """Reverse a transaction - create a debit for a credit and a credit for a debit for each transaction entry""" <|body_0|> def undo_transaction(self): """Undo a transaction - remove the reference to the transaction, and do a ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Transaction: def reverse_transaction(self): """Reverse a transaction - create a debit for a credit and a credit for a debit for each transaction entry""" portal_types = getToolByName(self.context, 'portal_types') transaction = self.context entries = transaction.entries() ...
the_stack_v2_python_sparse
Products/UpfrontAccounting/browser/transaction.py
rochecompaan/Products.UpfrontAccounting
train
0
7a87f9c55b7753fd63557ef72ee8a5708aa00ffb
[ "super(EncoderMix, self).__init__()\ntyp = etype.lstrip('vgg').rstrip('p')\nif typ not in ['lstm', 'gru', 'blstm', 'bgru']:\n logging.error('Error: need to specify an appropriate encoder architecture')\nif etype.startswith('vgg'):\n if etype[-1] == 'p':\n self.enc_mix = torch.nn.ModuleList([VGG2L(in_ch...
<|body_start_0|> super(EncoderMix, self).__init__() typ = etype.lstrip('vgg').rstrip('p') if typ not in ['lstm', 'gru', 'blstm', 'bgru']: logging.error('Error: need to specify an appropriate encoder architecture') if etype.startswith('vgg'): if etype[-1] == 'p': ...
Encoder module for the case of multi-speaker mixture speech. :param str etype: type of encoder network :param int idim: number of dimensions of encoder network :param int elayers_sd: number of layers of speaker differentiate part in encoder network :param int elayers_rec: number of layers of shared recognition part in ...
EncoderMix
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderMix: """Encoder module for the case of multi-speaker mixture speech. :param str etype: type of encoder network :param int idim: number of dimensions of encoder network :param int elayers_sd: number of layers of speaker differentiate part in encoder network :param int elayers_rec: number of...
stack_v2_sparse_classes_10k_train_002724
30,819
permissive
[ { "docstring": "Initialize the encoder of single-channel multi-speaker ASR.", "name": "__init__", "signature": "def __init__(self, etype, idim, elayers_sd, elayers_rec, eunits, eprojs, subsample, dropout, num_spkrs=2, in_channel=1)" }, { "docstring": "Encodermix forward. :param torch.Tensor xs_p...
2
stack_v2_sparse_classes_30k_train_004238
Implement the Python class `EncoderMix` described below. Class description: Encoder module for the case of multi-speaker mixture speech. :param str etype: type of encoder network :param int idim: number of dimensions of encoder network :param int elayers_sd: number of layers of speaker differentiate part in encoder ne...
Implement the Python class `EncoderMix` described below. Class description: Encoder module for the case of multi-speaker mixture speech. :param str etype: type of encoder network :param int idim: number of dimensions of encoder network :param int elayers_sd: number of layers of speaker differentiate part in encoder ne...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class EncoderMix: """Encoder module for the case of multi-speaker mixture speech. :param str etype: type of encoder network :param int idim: number of dimensions of encoder network :param int elayers_sd: number of layers of speaker differentiate part in encoder network :param int elayers_rec: number of...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EncoderMix: """Encoder module for the case of multi-speaker mixture speech. :param str etype: type of encoder network :param int idim: number of dimensions of encoder network :param int elayers_sd: number of layers of speaker differentiate part in encoder network :param int elayers_rec: number of layers of sh...
the_stack_v2_python_sparse
espnet/nets/pytorch_backend/e2e_asr_mix.py
espnet/espnet
train
7,242
9fcf56722eb12d308e917e9dc1fd65371bb3ecfd
[ "self.account_id = account_id\nself.conference_id = conference_id\nself.name = name\nself.recording_id = recording_id\nself.duration = duration\nself.channels = channels\nself.start_time = APIHelper.RFC3339DateTime(start_time) if start_time else None\nself.end_time = APIHelper.RFC3339DateTime(end_time) if end_time ...
<|body_start_0|> self.account_id = account_id self.conference_id = conference_id self.name = name self.recording_id = recording_id self.duration = duration self.channels = channels self.start_time = APIHelper.RFC3339DateTime(start_time) if start_time else None ...
Implementation of the 'ConferenceRecordingMetadata' model. TODO: type model description here. Attributes: account_id (string): TODO: type description here. conference_id (string): TODO: type description here. name (string): TODO: type description here. recording_id (string): TODO: type description here. duration (strin...
ConferenceRecordingMetadata
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConferenceRecordingMetadata: """Implementation of the 'ConferenceRecordingMetadata' model. TODO: type model description here. Attributes: account_id (string): TODO: type description here. conference_id (string): TODO: type description here. name (string): TODO: type description here. recording_id...
stack_v2_sparse_classes_10k_train_002725
4,419
permissive
[ { "docstring": "Constructor for the ConferenceRecordingMetadata class", "name": "__init__", "signature": "def __init__(self, account_id=None, conference_id=None, name=None, recording_id=None, duration=None, channels=None, start_time=None, end_time=None, file_format=None, status=None, media_url=None)" ...
2
stack_v2_sparse_classes_30k_train_000364
Implement the Python class `ConferenceRecordingMetadata` described below. Class description: Implementation of the 'ConferenceRecordingMetadata' model. TODO: type model description here. Attributes: account_id (string): TODO: type description here. conference_id (string): TODO: type description here. name (string): TO...
Implement the Python class `ConferenceRecordingMetadata` described below. Class description: Implementation of the 'ConferenceRecordingMetadata' model. TODO: type model description here. Attributes: account_id (string): TODO: type description here. conference_id (string): TODO: type description here. name (string): TO...
447df3cc8cb7acaf3361d842630c432a9c31ce6e
<|skeleton|> class ConferenceRecordingMetadata: """Implementation of the 'ConferenceRecordingMetadata' model. TODO: type model description here. Attributes: account_id (string): TODO: type description here. conference_id (string): TODO: type description here. name (string): TODO: type description here. recording_id...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ConferenceRecordingMetadata: """Implementation of the 'ConferenceRecordingMetadata' model. TODO: type model description here. Attributes: account_id (string): TODO: type description here. conference_id (string): TODO: type description here. name (string): TODO: type description here. recording_id (string): TO...
the_stack_v2_python_sparse
bandwidth/voice/models/conference_recording_metadata.py
Bandwidth/python-sdk
train
10
4dc8223b3c0d9b54b669b139449a49bd4c4e5fc5
[ "Frame.__init__(self, spec.FRAME_HEADER, channel_number)\nself.body_size = body_size\nself.properties = props", "pieces = self.properties.encode()\npieces.insert(0, struct.pack('>HxxQ', self.properties.INDEX, self.body_size))\nreturn self._marshal(pieces)" ]
<|body_start_0|> Frame.__init__(self, spec.FRAME_HEADER, channel_number) self.body_size = body_size self.properties = props <|end_body_0|> <|body_start_1|> pieces = self.properties.encode() pieces.insert(0, struct.pack('>HxxQ', self.properties.INDEX, self.body_size)) ret...
Header frame object mapping. AMQP content header frames are mapped on top of this class for creating or accessing their data and attributes.
Header
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Header: """Header frame object mapping. AMQP content header frames are mapped on top of this class for creating or accessing their data and attributes.""" def __init__(self, channel_number, body_size, props): """Parameters: - channel_number: int - body_size: int - props: spec.BasicPr...
stack_v2_sparse_classes_10k_train_002726
12,681
no_license
[ { "docstring": "Parameters: - channel_number: int - body_size: int - props: spec.BasicProperties object", "name": "__init__", "signature": "def __init__(self, channel_number, body_size, props)" }, { "docstring": "Return the AMQP binary encoded value of the frame", "name": "marshal", "sig...
2
null
Implement the Python class `Header` described below. Class description: Header frame object mapping. AMQP content header frames are mapped on top of this class for creating or accessing their data and attributes. Method signatures and docstrings: - def __init__(self, channel_number, body_size, props): Parameters: - c...
Implement the Python class `Header` described below. Class description: Header frame object mapping. AMQP content header frames are mapped on top of this class for creating or accessing their data and attributes. Method signatures and docstrings: - def __init__(self, channel_number, body_size, props): Parameters: - c...
a427d8b2790350b524b66ac14534fd836ae10476
<|skeleton|> class Header: """Header frame object mapping. AMQP content header frames are mapped on top of this class for creating or accessing their data and attributes.""" def __init__(self, channel_number, body_size, props): """Parameters: - channel_number: int - body_size: int - props: spec.BasicPr...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Header: """Header frame object mapping. AMQP content header frames are mapped on top of this class for creating or accessing their data and attributes.""" def __init__(self, channel_number, body_size, props): """Parameters: - channel_number: int - body_size: int - props: spec.BasicProperties obje...
the_stack_v2_python_sparse
scripts/autoland/vendor/lib/python/pika/frame.py
lsblakk/tools
train
1
e7ae9b564fa3d46691c6ca7e722d41e511f4cbd0
[ "tmp_date = pendulum.parse(self.date.name)\nplan_date = tmp_date.format('YYYY-MM-DD')\nrecord = self.env['metro_park_maintenance.day_plan'].create([{'plan_name': self.name, 'plan_date': plan_date, 'state': 'draft', 'week_plan_id': self.week_plan_id.id, 'pms_work_class_info': self.pms_work_class_info.id, 'run_trains...
<|body_start_0|> tmp_date = pendulum.parse(self.date.name) plan_date = tmp_date.format('YYYY-MM-DD') record = self.env['metro_park_maintenance.day_plan'].create([{'plan_name': self.name, 'plan_date': plan_date, 'state': 'draft', 'week_plan_id': self.week_plan_id.id, 'pms_work_class_info': self.p...
重写onok函数,每条线路各自实现各自的
DayPlanWizard
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DayPlanWizard: """重写onok函数,每条线路各自实现各自的""" def on_ok(self): """点击确定按扭, 创建的时候就把当日的运行图数据放进去,这样便于修改 :return:""" <|body_0|> def get_day_plan_action(self): """取得日计划动作 :return:""" <|body_1|> def get_parent_plan_data(self): """获取上一级计划的检修计划数据 :return:...
stack_v2_sparse_classes_10k_train_002727
3,982
no_license
[ { "docstring": "点击确定按扭, 创建的时候就把当日的运行图数据放进去,这样便于修改 :return:", "name": "on_ok", "signature": "def on_ok(self)" }, { "docstring": "取得日计划动作 :return:", "name": "get_day_plan_action", "signature": "def get_day_plan_action(self)" }, { "docstring": "获取上一级计划的检修计划数据 :return:", "name": ...
3
null
Implement the Python class `DayPlanWizard` described below. Class description: 重写onok函数,每条线路各自实现各自的 Method signatures and docstrings: - def on_ok(self): 点击确定按扭, 创建的时候就把当日的运行图数据放进去,这样便于修改 :return: - def get_day_plan_action(self): 取得日计划动作 :return: - def get_parent_plan_data(self): 获取上一级计划的检修计划数据 :return:
Implement the Python class `DayPlanWizard` described below. Class description: 重写onok函数,每条线路各自实现各自的 Method signatures and docstrings: - def on_ok(self): 点击确定按扭, 创建的时候就把当日的运行图数据放进去,这样便于修改 :return: - def get_day_plan_action(self): 取得日计划动作 :return: - def get_parent_plan_data(self): 获取上一级计划的检修计划数据 :return: <|skeleton|> ...
13b428a5c4ade6278e3e5e996ef10d9fb0fea4b9
<|skeleton|> class DayPlanWizard: """重写onok函数,每条线路各自实现各自的""" def on_ok(self): """点击确定按扭, 创建的时候就把当日的运行图数据放进去,这样便于修改 :return:""" <|body_0|> def get_day_plan_action(self): """取得日计划动作 :return:""" <|body_1|> def get_parent_plan_data(self): """获取上一级计划的检修计划数据 :return:...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DayPlanWizard: """重写onok函数,每条线路各自实现各自的""" def on_ok(self): """点击确定按扭, 创建的时候就把当日的运行图数据放进去,这样便于修改 :return:""" tmp_date = pendulum.parse(self.date.name) plan_date = tmp_date.format('YYYY-MM-DD') record = self.env['metro_park_maintenance.day_plan'].create([{'plan_name': self.n...
the_stack_v2_python_sparse
mdias_addons/metro_park_base_data_6/models/day_plan_wizard.py
rezaghanimi/main_mdias
train
0
61ea60970f9ac454e652c8b6092c027e6e76996e
[ "super(DecoderBlock, self).__init__()\nself.mha1 = MultiHeadAttention(dm, h)\nself.mha2 = MultiHeadAttention(dm, h)\nself.dense_hidden = tf.keras.layers.Dense(hidden, activation='relu')\nself.dense_output = tf.keras.layers.Dense(dm)\nself.dropout1 = tf.keras.layers.Dropout(drop_rate)\nself.dropout2 = tf.keras.layer...
<|body_start_0|> super(DecoderBlock, self).__init__() self.mha1 = MultiHeadAttention(dm, h) self.mha2 = MultiHeadAttention(dm, h) self.dense_hidden = tf.keras.layers.Dense(hidden, activation='relu') self.dense_output = tf.keras.layers.Dense(dm) self.dropout1 = tf.keras.la...
Transformer Decoder Block
DecoderBlock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecoderBlock: """Transformer Decoder Block""" def __init__(self, dm, h, hidden, drop_rate=0.1): """[ Class constructor] Args: dm ([type]): [the dimensionality of the model] h ([type]): [the number of heads] hidden ([type]): [# of hidden units in the fully connected layer] drop_rate (...
stack_v2_sparse_classes_10k_train_002728
3,778
no_license
[ { "docstring": "[ Class constructor] Args: dm ([type]): [the dimensionality of the model] h ([type]): [the number of heads] hidden ([type]): [# of hidden units in the fully connected layer] drop_rate (float, optional): [dropout rate]. Defaults to 0.1. Public instance attributes: - mha1: the first MultiHeadAtten...
2
null
Implement the Python class `DecoderBlock` described below. Class description: Transformer Decoder Block Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): [ Class constructor] Args: dm ([type]): [the dimensionality of the model] h ([type]): [the number of heads] hidden ([type]): [# ...
Implement the Python class `DecoderBlock` described below. Class description: Transformer Decoder Block Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): [ Class constructor] Args: dm ([type]): [the dimensionality of the model] h ([type]): [the number of heads] hidden ([type]): [# ...
eb47cd4d12e2f0627bb5e5af28cc0802ff13d0d9
<|skeleton|> class DecoderBlock: """Transformer Decoder Block""" def __init__(self, dm, h, hidden, drop_rate=0.1): """[ Class constructor] Args: dm ([type]): [the dimensionality of the model] h ([type]): [the number of heads] hidden ([type]): [# of hidden units in the fully connected layer] drop_rate (...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DecoderBlock: """Transformer Decoder Block""" def __init__(self, dm, h, hidden, drop_rate=0.1): """[ Class constructor] Args: dm ([type]): [the dimensionality of the model] h ([type]): [the number of heads] hidden ([type]): [# of hidden units in the fully connected layer] drop_rate (float, option...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/8-transformer_decoder_block.py
rodrigocruz13/holbertonschool-machine_learning
train
4
75aaa95b5105e4e0f18431fbb86be30af07c3e5e
[ "if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(email=self.normalize_email(email))\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(email, password=password)\nuser.is_admin = True\nuser.save(using=self._db)\nreturn user" ]
<|body_start_0|> if not email: raise ValueError('Users must have an email address') user = self.model(email=self.normalize_email(email)) user.set_password(password) user.save(using=self._db) return user <|end_body_0|> <|body_start_1|> user = self.create_user(...
TrixUserManager
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrixUserManager: def create_user(self, email, password=None): """Creates and saves a User with the given email and password.""" <|body_0|> def create_superuser(self, email, password): """Creates and saves a superuser with the given email and password.""" <|bo...
stack_v2_sparse_classes_10k_train_002729
9,283
permissive
[ { "docstring": "Creates and saves a User with the given email and password.", "name": "create_user", "signature": "def create_user(self, email, password=None)" }, { "docstring": "Creates and saves a superuser with the given email and password.", "name": "create_superuser", "signature": "...
2
stack_v2_sparse_classes_30k_test_000223
Implement the Python class `TrixUserManager` described below. Class description: Implement the TrixUserManager class. Method signatures and docstrings: - def create_user(self, email, password=None): Creates and saves a User with the given email and password. - def create_superuser(self, email, password): Creates and ...
Implement the Python class `TrixUserManager` described below. Class description: Implement the TrixUserManager class. Method signatures and docstrings: - def create_user(self, email, password=None): Creates and saves a User with the given email and password. - def create_superuser(self, email, password): Creates and ...
22d315a99c7f914a85f070c0639e056ec4fe8757
<|skeleton|> class TrixUserManager: def create_user(self, email, password=None): """Creates and saves a User with the given email and password.""" <|body_0|> def create_superuser(self, email, password): """Creates and saves a superuser with the given email and password.""" <|bo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TrixUserManager: def create_user(self, email, password=None): """Creates and saves a User with the given email and password.""" if not email: raise ValueError('Users must have an email address') user = self.model(email=self.normalize_email(email)) user.set_password(...
the_stack_v2_python_sparse
trix/trix_core/models.py
devilry/trix2
train
2
971b033fc41126b850d323387751a1624d6e78e1
[ "app.config.setdefault('SQLALCHEMY_DATABASE_URI', app.config.get('CLASSIC_DATABASE_URI', 'sqlite://'))\napp.config.setdefault('SQLALCHEMY_TRACK_MODIFICATIONS', False)\nsuper(ClassicSQLAlchemy, self).init_app(app)", "super(ClassicSQLAlchemy, self).apply_pool_defaults(app, options)\nif app.config['SQLALCHEMY_DATABA...
<|body_start_0|> app.config.setdefault('SQLALCHEMY_DATABASE_URI', app.config.get('CLASSIC_DATABASE_URI', 'sqlite://')) app.config.setdefault('SQLALCHEMY_TRACK_MODIFICATIONS', False) super(ClassicSQLAlchemy, self).init_app(app) <|end_body_0|> <|body_start_1|> super(ClassicSQLAlchemy, sel...
SQLAlchemy integration for the classic database.
ClassicSQLAlchemy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassicSQLAlchemy: """SQLAlchemy integration for the classic database.""" def init_app(self, app: Flask) -> None: """Set default configuration.""" <|body_0|> def apply_pool_defaults(self, app: Flask, options: Any) -> None: """Set options for create_engine().""" ...
stack_v2_sparse_classes_10k_train_002730
3,561
permissive
[ { "docstring": "Set default configuration.", "name": "init_app", "signature": "def init_app(self, app: Flask) -> None" }, { "docstring": "Set options for create_engine().", "name": "apply_pool_defaults", "signature": "def apply_pool_defaults(self, app: Flask, options: Any) -> None" } ]
2
stack_v2_sparse_classes_30k_train_005641
Implement the Python class `ClassicSQLAlchemy` described below. Class description: SQLAlchemy integration for the classic database. Method signatures and docstrings: - def init_app(self, app: Flask) -> None: Set default configuration. - def apply_pool_defaults(self, app: Flask, options: Any) -> None: Set options for ...
Implement the Python class `ClassicSQLAlchemy` described below. Class description: SQLAlchemy integration for the classic database. Method signatures and docstrings: - def init_app(self, app: Flask) -> None: Set default configuration. - def apply_pool_defaults(self, app: Flask, options: Any) -> None: Set options for ...
6077ce4e0685d67ce7010800083a898857158112
<|skeleton|> class ClassicSQLAlchemy: """SQLAlchemy integration for the classic database.""" def init_app(self, app: Flask) -> None: """Set default configuration.""" <|body_0|> def apply_pool_defaults(self, app: Flask, options: Any) -> None: """Set options for create_engine().""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ClassicSQLAlchemy: """SQLAlchemy integration for the classic database.""" def init_app(self, app: Flask) -> None: """Set default configuration.""" app.config.setdefault('SQLALCHEMY_DATABASE_URI', app.config.get('CLASSIC_DATABASE_URI', 'sqlite://')) app.config.setdefault('SQLALCHEM...
the_stack_v2_python_sparse
core/arxiv/submission/services/classic/util.py
arXiv/arxiv-submission-core
train
14
892cbc07a1524f47caaf9eddeb1e1485bb79c915
[ "data = form.cleaned_data\nif validate_token(self.request, data['token'], allow_test=True):\n self.success_url = reverse('questions', kwargs={'course': data['course'].id})\n return super().form_valid(form)\nmessages.warning(self.request, 'Invalid Token. Please try again. Note: Tokens are caSE SensITive')\nret...
<|body_start_0|> data = form.cleaned_data if validate_token(self.request, data['token'], allow_test=True): self.success_url = reverse('questions', kwargs={'course': data['course'].id}) return super().form_valid(form) messages.warning(self.request, 'Invalid Token. Please t...
This view allows the user to choose which examination to take. Renders a self explanatory form and all fields are required. Redirects to questions view if choices are valid otherwise, returns the form with error message(s) for corrections. If the user account is inactive, they're redirected to the Home Page.
ChooseQuestionView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChooseQuestionView: """This view allows the user to choose which examination to take. Renders a self explanatory form and all fields are required. Redirects to questions view if choices are valid otherwise, returns the form with error message(s) for corrections. If the user account is inactive, t...
stack_v2_sparse_classes_10k_train_002731
29,759
no_license
[ { "docstring": "Validate exam Token and other requirements.", "name": "form_valid", "signature": "def form_valid(self, form)" }, { "docstring": "Return the data used in the templates rendering.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_000094
Implement the Python class `ChooseQuestionView` described below. Class description: This view allows the user to choose which examination to take. Renders a self explanatory form and all fields are required. Redirects to questions view if choices are valid otherwise, returns the form with error message(s) for correcti...
Implement the Python class `ChooseQuestionView` described below. Class description: This view allows the user to choose which examination to take. Renders a self explanatory form and all fields are required. Redirects to questions view if choices are valid otherwise, returns the form with error message(s) for correcti...
06bc577d01d3dbf6c425e03dcb903977a38e377c
<|skeleton|> class ChooseQuestionView: """This view allows the user to choose which examination to take. Renders a self explanatory form and all fields are required. Redirects to questions view if choices are valid otherwise, returns the form with error message(s) for corrections. If the user account is inactive, t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ChooseQuestionView: """This view allows the user to choose which examination to take. Renders a self explanatory form and all fields are required. Redirects to questions view if choices are valid otherwise, returns the form with error message(s) for corrections. If the user account is inactive, they're redire...
the_stack_v2_python_sparse
cbt/views.py
Festusali/CBTest
train
6
65af988e10bdc94a5c147884d4f93bc35c01ffee
[ "length = len(nums)\nif length <= 1:\n return length\ndp = [1] * length\nfor i in range(1, length):\n if nums[i] > nums[i - 1]:\n dp[i] = dp[i - 1] + 1\nreturn max(dp)", "if not nums:\n return 0\nl = len(nums)\nres = 0\ntmp = nums[0] - 1\ncount = 0\nfor x in range(l):\n if nums[x] > tmp:\n ...
<|body_start_0|> length = len(nums) if length <= 1: return length dp = [1] * length for i in range(1, length): if nums[i] > nums[i - 1]: dp[i] = dp[i - 1] + 1 return max(dp) <|end_body_0|> <|body_start_1|> if not nums: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findLengthOfLCIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findLengthOfLCIS2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> length = len(nums) if leng...
stack_v2_sparse_classes_10k_train_002732
1,878
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "findLengthOfLCIS", "signature": "def findLengthOfLCIS(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "findLengthOfLCIS2", "signature": "def findLengthOfLCIS2(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findLengthOfLCIS(self, nums): :type nums: List[int] :rtype: int - def findLengthOfLCIS2(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 findLengthOfLCIS(self, nums): :type nums: List[int] :rtype: int - def findLengthOfLCIS2(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def ...
b0f498ebe84e46b7e17e94759dd462891dcc8f85
<|skeleton|> class Solution: def findLengthOfLCIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findLengthOfLCIS2(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 findLengthOfLCIS(self, nums): """:type nums: List[int] :rtype: int""" length = len(nums) if length <= 1: return length dp = [1] * length for i in range(1, length): if nums[i] > nums[i - 1]: dp[i] = dp[i - 1] + 1 ...
the_stack_v2_python_sparse
字节跳动/array-and-sorting_4.py
wulinlw/leetcode_cn
train
0
e382713dbf6209d3d754f3a0e1e13855f155fb67
[ "request = data_set.get('request')\nuser = data_set.get('user')\nif user:\n username = cls.analyze(user, uuid)\n driver = cls.analyze_class.get_user(username)\n CompatAPPDriver.driver = driver\nelse:\n user = data_set.get('session')\n driver = cls.session_class.get_session(user)\nfor step in request:...
<|body_start_0|> request = data_set.get('request') user = data_set.get('user') if user: username = cls.analyze(user, uuid) driver = cls.analyze_class.get_user(username) CompatAPPDriver.driver = driver else: user = data_set.get('session') ...
APPDriver
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class APPDriver: def run(cls, data_set, uuid, host, **kwargs): """Webdriver驱动执行浏览器元素定位与元素动作操作 :param data_set: 测试用例节点信息 { "path": "/login", "user": "user1", "version": 2, "request": [ {"eventName": "元素点击", "event": "click", "locations": ["css selector", "#kw"], "input": "输入内容"}, {"eventName": ...
stack_v2_sparse_classes_10k_train_002733
6,213
permissive
[ { "docstring": "Webdriver驱动执行浏览器元素定位与元素动作操作 :param data_set: 测试用例节点信息 { \"path\": \"/login\", \"user\": \"user1\", \"version\": 2, \"request\": [ {\"eventName\": \"元素点击\", \"event\": \"click\", \"locations\": [\"css selector\", \"#kw\"], \"input\": \"输入内容\"}, {\"eventName\": \"元素名称\", \"event\": \"click\", \"lo...
2
stack_v2_sparse_classes_30k_train_003521
Implement the Python class `APPDriver` described below. Class description: Implement the APPDriver class. Method signatures and docstrings: - def run(cls, data_set, uuid, host, **kwargs): Webdriver驱动执行浏览器元素定位与元素动作操作 :param data_set: 测试用例节点信息 { "path": "/login", "user": "user1", "version": 2, "request": [ {"eventName"...
Implement the Python class `APPDriver` described below. Class description: Implement the APPDriver class. Method signatures and docstrings: - def run(cls, data_set, uuid, host, **kwargs): Webdriver驱动执行浏览器元素定位与元素动作操作 :param data_set: 测试用例节点信息 { "path": "/login", "user": "user1", "version": 2, "request": [ {"eventName"...
5ecae8652c9f71aaa78cc0fd181d431cb130cab1
<|skeleton|> class APPDriver: def run(cls, data_set, uuid, host, **kwargs): """Webdriver驱动执行浏览器元素定位与元素动作操作 :param data_set: 测试用例节点信息 { "path": "/login", "user": "user1", "version": 2, "request": [ {"eventName": "元素点击", "event": "click", "locations": ["css selector", "#kw"], "input": "输入内容"}, {"eventName": ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class APPDriver: def run(cls, data_set, uuid, host, **kwargs): """Webdriver驱动执行浏览器元素定位与元素动作操作 :param data_set: 测试用例节点信息 { "path": "/login", "user": "user1", "version": 2, "request": [ {"eventName": "元素点击", "event": "click", "locations": ["css selector", "#kw"], "input": "输入内容"}, {"eventName": "元素名称", "event...
the_stack_v2_python_sparse
giantstar/drivers/appDriver.py
DaoSen-v/giantstar
train
0
9c0565a7a799b4d983060bea22a4462692fd3731
[ "if key:\n if cls.objects.filter(key=key).exists():\n return cls.objects.filter(key=key).first()\nif cls.objects.filter(key=None).exists():\n return cls.objects.filter(key=None).first()\nreturn None", "if self.is_default_value:\n if self.key is None and self.__class__.objects.exclude(pk=self.pk).f...
<|body_start_0|> if key: if cls.objects.filter(key=key).exists(): return cls.objects.filter(key=key).first() if cls.objects.filter(key=None).exists(): return cls.objects.filter(key=None).first() return None <|end_body_0|> <|body_start_1|> if self....
Mixin for storing value with a unique default value for all and a unique default value for each item associated by key
StoreDataWithDefaultValueByKey
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StoreDataWithDefaultValueByKey: """Mixin for storing value with a unique default value for all and a unique default value for each item associated by key""" def default_value(cls, key=None): """Return default value which is: - default value for the key if exists - else generic defaul...
stack_v2_sparse_classes_10k_train_002734
2,174
no_license
[ { "docstring": "Return default value which is: - default value for the key if exists - else generic default value if exists - else None", "name": "default_value", "signature": "def default_value(cls, key=None)" }, { "docstring": "verify that: - an unique value exists without a key - an unique va...
2
null
Implement the Python class `StoreDataWithDefaultValueByKey` described below. Class description: Mixin for storing value with a unique default value for all and a unique default value for each item associated by key Method signatures and docstrings: - def default_value(cls, key=None): Return default value which is: - ...
Implement the Python class `StoreDataWithDefaultValueByKey` described below. Class description: Mixin for storing value with a unique default value for all and a unique default value for each item associated by key Method signatures and docstrings: - def default_value(cls, key=None): Return default value which is: - ...
95d21cd6036a99c5f399b700a5426e9e2e17e878
<|skeleton|> class StoreDataWithDefaultValueByKey: """Mixin for storing value with a unique default value for all and a unique default value for each item associated by key""" def default_value(cls, key=None): """Return default value which is: - default value for the key if exists - else generic defaul...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StoreDataWithDefaultValueByKey: """Mixin for storing value with a unique default value for all and a unique default value for each item associated by key""" def default_value(cls, key=None): """Return default value which is: - default value for the key if exists - else generic default value if ex...
the_stack_v2_python_sparse
helpers/mixins/store_data_with_default_value_by_key.py
alexandrenorman/mixeur
train
0
81da77d8ade9f28e3235c0fb4f2cf51b5d1c0fde
[ "super().__init__()\nself.document_store: Optional[KeywordDocumentStore] = document_store\nself.top_k = top_k\nself.custom_query = custom_query\nself.all_terms_must_match = all_terms_must_match\nself.scale_score = scale_score", "document_store = document_store or self.document_store\nif document_store is None:\n ...
<|body_start_0|> super().__init__() self.document_store: Optional[KeywordDocumentStore] = document_store self.top_k = top_k self.custom_query = custom_query self.all_terms_must_match = all_terms_must_match self.scale_score = scale_score <|end_body_0|> <|body_start_1|> ...
BM25Retriever
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BM25Retriever: def __init__(self, document_store: Optional[KeywordDocumentStore]=None, top_k: int=10, all_terms_must_match: bool=False, custom_query: Optional[str]=None, scale_score: bool=True): """:param document_store: An instance of one of the following DocumentStores to retrieve from...
stack_v2_sparse_classes_10k_train_002735
35,145
permissive
[ { "docstring": ":param document_store: An instance of one of the following DocumentStores to retrieve from: InMemoryDocumentStore, ElasticsearchDocumentStore and OpenSearchDocumentStore. If None, a document store must be passed to the retrieve method for this Retriever to work. :param all_terms_must_match: Whet...
3
null
Implement the Python class `BM25Retriever` described below. Class description: Implement the BM25Retriever class. Method signatures and docstrings: - def __init__(self, document_store: Optional[KeywordDocumentStore]=None, top_k: int=10, all_terms_must_match: bool=False, custom_query: Optional[str]=None, scale_score: ...
Implement the Python class `BM25Retriever` described below. Class description: Implement the BM25Retriever class. Method signatures and docstrings: - def __init__(self, document_store: Optional[KeywordDocumentStore]=None, top_k: int=10, all_terms_must_match: bool=False, custom_query: Optional[str]=None, scale_score: ...
5f1256ac7e5734c2ea481e72cb7e02c34baf8c43
<|skeleton|> class BM25Retriever: def __init__(self, document_store: Optional[KeywordDocumentStore]=None, top_k: int=10, all_terms_must_match: bool=False, custom_query: Optional[str]=None, scale_score: bool=True): """:param document_store: An instance of one of the following DocumentStores to retrieve from...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BM25Retriever: def __init__(self, document_store: Optional[KeywordDocumentStore]=None, top_k: int=10, all_terms_must_match: bool=False, custom_query: Optional[str]=None, scale_score: bool=True): """:param document_store: An instance of one of the following DocumentStores to retrieve from: InMemoryDocu...
the_stack_v2_python_sparse
haystack/nodes/retriever/sparse.py
deepset-ai/haystack
train
10,599
f33f764617eb62dc99f6da5d7e4f03a484289520
[ "d = departmentmanage(self.driver)\nd.open_departmentmanage()\nself.assertEqual(d.verify(), True)\nd.delete()\nself.assertEqual(d.reason(), '请选择一条数据')\nfunction.screenshot(self.driver, 'department_unselect.jpg')", "d = departmentmanage(self.driver)\nd.open_departmentmanage()\nself.assertEqual(d.verify(), True)\nd...
<|body_start_0|> d = departmentmanage(self.driver) d.open_departmentmanage() self.assertEqual(d.verify(), True) d.delete() self.assertEqual(d.reason(), '请选择一条数据') function.screenshot(self.driver, 'department_unselect.jpg') <|end_body_0|> <|body_start_1|> d = depa...
Test030_Deparment_List_Error
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test030_Deparment_List_Error: def test_unselect(self): """不选择任何部门""" <|body_0|> def test_multiselect(self): """选择两个部门""" <|body_1|> <|end_skeleton|> <|body_start_0|> d = departmentmanage(self.driver) d.open_departmentmanage() self.as...
stack_v2_sparse_classes_10k_train_002736
966
no_license
[ { "docstring": "不选择任何部门", "name": "test_unselect", "signature": "def test_unselect(self)" }, { "docstring": "选择两个部门", "name": "test_multiselect", "signature": "def test_multiselect(self)" } ]
2
stack_v2_sparse_classes_30k_train_001611
Implement the Python class `Test030_Deparment_List_Error` described below. Class description: Implement the Test030_Deparment_List_Error class. Method signatures and docstrings: - def test_unselect(self): 不选择任何部门 - def test_multiselect(self): 选择两个部门
Implement the Python class `Test030_Deparment_List_Error` described below. Class description: Implement the Test030_Deparment_List_Error class. Method signatures and docstrings: - def test_unselect(self): 不选择任何部门 - def test_multiselect(self): 选择两个部门 <|skeleton|> class Test030_Deparment_List_Error: def test_unse...
6f42c25249fc642cecc270578a180820988d45b5
<|skeleton|> class Test030_Deparment_List_Error: def test_unselect(self): """不选择任何部门""" <|body_0|> def test_multiselect(self): """选择两个部门""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Test030_Deparment_List_Error: def test_unselect(self): """不选择任何部门""" d = departmentmanage(self.driver) d.open_departmentmanage() self.assertEqual(d.verify(), True) d.delete() self.assertEqual(d.reason(), '请选择一条数据') function.screenshot(self.driver, 'depar...
the_stack_v2_python_sparse
GlxssLive_web/TestCase/Manage_Department/Test030_department_list_error.py
rrmiracle/GlxssLive
train
0
02eaaaa47a370e3bf2f2849f22dd1479e4fcd13d
[ "self.capacity = capacity\nself.length = 0\nself.dict = collections.OrderedDict()", "if key in self.dict:\n val = self.dict[key]\n del self.dict[key]\n self.dict[key] = val\n return val\nelse:\n return -1", "if key in self.dict:\n del self.dict[key]\n self.dict[key] = value\nelse:\n if s...
<|body_start_0|> self.capacity = capacity self.length = 0 self.dict = collections.OrderedDict() <|end_body_0|> <|body_start_1|> if key in self.dict: val = self.dict[key] del self.dict[key] self.dict[key] = val return val else: ...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:rtype: int""" <|body_1|> def set(self, key, value): """:type key: int :type value: int :rtype: nothing""" <|body_2|> <|end_skeleton|> <...
stack_v2_sparse_classes_10k_train_002737
2,645
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: nothing", "name": "set", "sig...
3
null
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :rtype: int - def set(self, key, value): :type key: int :type value: int :rtype: nothing
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :rtype: int - def set(self, key, value): :type key: int :type value: int :rtype: nothing <|skeleton|> cla...
56383c2b07448a9017a7a707afb66e08b403ee76
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:rtype: int""" <|body_1|> def set(self, key, value): """:type key: int :type value: int :rtype: nothing""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.length = 0 self.dict = collections.OrderedDict() def get(self, key): """:rtype: int""" if key in self.dict: val = self.dict[key] del self...
the_stack_v2_python_sparse
ALL_SOLUTIONS/146_OO_LRU_Cache.py
jamiezeminzhang/Leetcode_Python
train
2
70f558bb745f952980e493d930e815bf2081db3e
[ "self.game_active = False\nself.al_settings = al_settings\nself.reset_stats()\nself.high_score = 0", "self.ships_left = self.al_settings.ship_limit\nself.score = 0\nself.level = 1" ]
<|body_start_0|> self.game_active = False self.al_settings = al_settings self.reset_stats() self.high_score = 0 <|end_body_0|> <|body_start_1|> self.ships_left = self.al_settings.ship_limit self.score = 0 self.level = 1 <|end_body_1|>
跟踪游戏的统计信息
GameStats
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameStats: """跟踪游戏的统计信息""" def __init__(self, al_settings): """初始化统计信息""" <|body_0|> def reset_stats(self): """初始化在游戏运行期间可能改变的统计信息""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.game_active = False self.al_settings = al_settings ...
stack_v2_sparse_classes_10k_train_002738
594
no_license
[ { "docstring": "初始化统计信息", "name": "__init__", "signature": "def __init__(self, al_settings)" }, { "docstring": "初始化在游戏运行期间可能改变的统计信息", "name": "reset_stats", "signature": "def reset_stats(self)" } ]
2
stack_v2_sparse_classes_30k_train_005212
Implement the Python class `GameStats` described below. Class description: 跟踪游戏的统计信息 Method signatures and docstrings: - def __init__(self, al_settings): 初始化统计信息 - def reset_stats(self): 初始化在游戏运行期间可能改变的统计信息
Implement the Python class `GameStats` described below. Class description: 跟踪游戏的统计信息 Method signatures and docstrings: - def __init__(self, al_settings): 初始化统计信息 - def reset_stats(self): 初始化在游戏运行期间可能改变的统计信息 <|skeleton|> class GameStats: """跟踪游戏的统计信息""" def __init__(self, al_settings): """初始化统计信息""" ...
bef0e99939b9fd4885b25ffea360b5745e7cc809
<|skeleton|> class GameStats: """跟踪游戏的统计信息""" def __init__(self, al_settings): """初始化统计信息""" <|body_0|> def reset_stats(self): """初始化在游戏运行期间可能改变的统计信息""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GameStats: """跟踪游戏的统计信息""" def __init__(self, al_settings): """初始化统计信息""" self.game_active = False self.al_settings = al_settings self.reset_stats() self.high_score = 0 def reset_stats(self): """初始化在游戏运行期间可能改变的统计信息""" self.ships_left = self.al_...
the_stack_v2_python_sparse
game_stats.py
ssf-czh/alien_invision
train
0
d29e9d9caa306fa9ecdf502a9a4b7203fdc637e2
[ "self.logger = Log()\nself.logger.info('########################### TestCertification START ###########################')\nconfig = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue()\napp_package = config['appPackage_chezhu']\napp_activity = config['appActivity_chezhu']\nself.db = DbOperation...
<|body_start_0|> self.logger = Log() self.logger.info('########################### TestCertification START ###########################') config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() app_package = config['appPackage_chezhu'] app_activity = con...
凯京车主APP 身份认证
TestCertification
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCertification: """凯京车主APP 身份认证""" def setUp(self): """前置条件准备""" <|body_0|> def tearDown(self): """测试环境重置""" <|body_1|> def test_bvt_certification(self): """身份认证""" <|body_2|> <|end_skeleton|> <|body_start_0|> self.logger...
stack_v2_sparse_classes_10k_train_002739
2,842
no_license
[ { "docstring": "前置条件准备", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "测试环境重置", "name": "tearDown", "signature": "def tearDown(self)" }, { "docstring": "身份认证", "name": "test_bvt_certification", "signature": "def test_bvt_certification(self)" } ]
3
stack_v2_sparse_classes_30k_train_002969
Implement the Python class `TestCertification` described below. Class description: 凯京车主APP 身份认证 Method signatures and docstrings: - def setUp(self): 前置条件准备 - def tearDown(self): 测试环境重置 - def test_bvt_certification(self): 身份认证
Implement the Python class `TestCertification` described below. Class description: 凯京车主APP 身份认证 Method signatures and docstrings: - def setUp(self): 前置条件准备 - def tearDown(self): 测试环境重置 - def test_bvt_certification(self): 身份认证 <|skeleton|> class TestCertification: """凯京车主APP 身份认证""" def setUp(self): ...
4112ee34827a68289ba95a30518c4b1ecf38a3b2
<|skeleton|> class TestCertification: """凯京车主APP 身份认证""" def setUp(self): """前置条件准备""" <|body_0|> def tearDown(self): """测试环境重置""" <|body_1|> def test_bvt_certification(self): """身份认证""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestCertification: """凯京车主APP 身份认证""" def setUp(self): """前置条件准备""" self.logger = Log() self.logger.info('########################### TestCertification START ###########################') config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() ...
the_stack_v2_python_sparse
BVT/chezhuAPP/driver_unregister/test_case/test_certification_chezhu.py
penny1205/AppUI
train
0
414066553086dd0ceb7e4a5861656b1c1695ed38
[ "assert instance is None\nsuper(UserApplicationCreationForm, self).__init__(data=data, initial=initial, instance=instance)\nself.user = user\nself.fields['local_site'].queryset = LocalSite.objects.filter(users=user)", "instance = super(UserApplicationCreationForm, self).save(commit=False)\ninstance.user = self.us...
<|body_start_0|> assert instance is None super(UserApplicationCreationForm, self).__init__(data=data, initial=initial, instance=instance) self.user = user self.fields['local_site'].queryset = LocalSite.objects.filter(users=user) <|end_body_0|> <|body_start_1|> instance = super(U...
A form for an end user to update an Application.
UserApplicationCreationForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserApplicationCreationForm: """A form for an end user to update an Application.""" def __init__(self, user, data, initial=None, instance=None): """Initialize the form. Args: user (django.contrib.auth.models.User): The user changing the form. Ignored, but included to match :py:meth:`...
stack_v2_sparse_classes_10k_train_002740
13,782
permissive
[ { "docstring": "Initialize the form. Args: user (django.contrib.auth.models.User): The user changing the form. Ignored, but included to match :py:meth:`UserApplicationCreationForm.__init__`. data (dict): The provided data. initial (dict, optional): The initial form values. instance (reviewboard.oauth.models.App...
2
stack_v2_sparse_classes_30k_train_005745
Implement the Python class `UserApplicationCreationForm` described below. Class description: A form for an end user to update an Application. Method signatures and docstrings: - def __init__(self, user, data, initial=None, instance=None): Initialize the form. Args: user (django.contrib.auth.models.User): The user cha...
Implement the Python class `UserApplicationCreationForm` described below. Class description: A form for an end user to update an Application. Method signatures and docstrings: - def __init__(self, user, data, initial=None, instance=None): Initialize the form. Args: user (django.contrib.auth.models.User): The user cha...
c3a991f1e9d7682239a1ab0e8661cee6da01d537
<|skeleton|> class UserApplicationCreationForm: """A form for an end user to update an Application.""" def __init__(self, user, data, initial=None, instance=None): """Initialize the form. Args: user (django.contrib.auth.models.User): The user changing the form. Ignored, but included to match :py:meth:`...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserApplicationCreationForm: """A form for an end user to update an Application.""" def __init__(self, user, data, initial=None, instance=None): """Initialize the form. Args: user (django.contrib.auth.models.User): The user changing the form. Ignored, but included to match :py:meth:`UserApplicati...
the_stack_v2_python_sparse
reviewboard/oauth/forms.py
reviewboard/reviewboard
train
1,141
b9d676a34e4a83f592580247ecde07aa85750585
[ "params = dict(request.query_params)\nparams.update(dict(request.data))\nqueryset = kwargs.get('queryset', None)\nagg_field, group_fields, date_part = self.validate_request(params, queryset)\nif not params.get('show_null_groups', False) and (not params.get('show_nulls', False)):\n q_object = Q()\n for field i...
<|body_start_0|> params = dict(request.query_params) params.update(dict(request.data)) queryset = kwargs.get('queryset', None) agg_field, group_fields, date_part = self.validate_request(params, queryset) if not params.get('show_null_groups', False) and (not params.get('show_nulls...
Aggregate a queryset. Any pre-aggregation operations on the queryset (e.g. filtering) is already done (it's handled at the view level, in the get_queryset method).
AggregateQuerysetMixin
[ "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AggregateQuerysetMixin: """Aggregate a queryset. Any pre-aggregation operations on the queryset (e.g. filtering) is already done (it's handled at the view level, in the get_queryset method).""" def aggregate(self, request, *args, **kwargs): """Perform an aggregate function on a Djang...
stack_v2_sparse_classes_10k_train_002741
10,956
permissive
[ { "docstring": "Perform an aggregate function on a Django queryset with an optional group by field.", "name": "aggregate", "signature": "def aggregate(self, request, *args, **kwargs)" }, { "docstring": "F-expression of col, wrapped if needed with SQL function call Assumes that there's an SQL fun...
3
stack_v2_sparse_classes_30k_train_000813
Implement the Python class `AggregateQuerysetMixin` described below. Class description: Aggregate a queryset. Any pre-aggregation operations on the queryset (e.g. filtering) is already done (it's handled at the view level, in the get_queryset method). Method signatures and docstrings: - def aggregate(self, request, *...
Implement the Python class `AggregateQuerysetMixin` described below. Class description: Aggregate a queryset. Any pre-aggregation operations on the queryset (e.g. filtering) is already done (it's handled at the view level, in the get_queryset method). Method signatures and docstrings: - def aggregate(self, request, *...
38f920438697930ae3ac57bbcaae9034877d8fb7
<|skeleton|> class AggregateQuerysetMixin: """Aggregate a queryset. Any pre-aggregation operations on the queryset (e.g. filtering) is already done (it's handled at the view level, in the get_queryset method).""" def aggregate(self, request, *args, **kwargs): """Perform an aggregate function on a Djang...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AggregateQuerysetMixin: """Aggregate a queryset. Any pre-aggregation operations on the queryset (e.g. filtering) is already done (it's handled at the view level, in the get_queryset method).""" def aggregate(self, request, *args, **kwargs): """Perform an aggregate function on a Django queryset wi...
the_stack_v2_python_sparse
usaspending_api/common/mixins.py
fedspendingtransparency/usaspending-api
train
276
3a14029ec4b6b63ca761985e8e6950028285728d
[ "if target == 0:\n res.append(tem_res)\n return\nif index >= len(candidates) or target < candidates[index]:\n return\nfor i in range(index, len(candidates)):\n if i > index and candidates[i] == candidates[i - 1]:\n continue\n if target < candidates[i]:\n break\n self.curSum(self, can...
<|body_start_0|> if target == 0: res.append(tem_res) return if index >= len(candidates) or target < candidates[index]: return for i in range(index, len(candidates)): if i > index and candidates[i] == candidates[i - 1]: continue ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def curSum(self, candidates, index, target, tem_res, res): """:param candidates: :param target: :param tem_res: 当前的结果 :param res: 全局的结果 :return:当前搜索的结果""" <|body_0|> def combinationSum(self, candidates, target): """:type candidates: List[int] :type target: ...
stack_v2_sparse_classes_10k_train_002742
1,196
no_license
[ { "docstring": ":param candidates: :param target: :param tem_res: 当前的结果 :param res: 全局的结果 :return:当前搜索的结果", "name": "curSum", "signature": "def curSum(self, candidates, index, target, tem_res, res)" }, { "docstring": ":type candidates: List[int] :type target: int :rtype: List[List[int]] :组合相加", ...
2
stack_v2_sparse_classes_30k_train_004172
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def curSum(self, candidates, index, target, tem_res, res): :param candidates: :param target: :param tem_res: 当前的结果 :param res: 全局的结果 :return:当前搜索的结果 - def combinationSum(self, ca...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def curSum(self, candidates, index, target, tem_res, res): :param candidates: :param target: :param tem_res: 当前的结果 :param res: 全局的结果 :return:当前搜索的结果 - def combinationSum(self, ca...
45fafcc5dd8f3a9dd26984dc6e82441cc2e8f8d7
<|skeleton|> class Solution: def curSum(self, candidates, index, target, tem_res, res): """:param candidates: :param target: :param tem_res: 当前的结果 :param res: 全局的结果 :return:当前搜索的结果""" <|body_0|> def combinationSum(self, candidates, target): """:type candidates: List[int] :type target: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def curSum(self, candidates, index, target, tem_res, res): """:param candidates: :param target: :param tem_res: 当前的结果 :param res: 全局的结果 :return:当前搜索的结果""" if target == 0: res.append(tem_res) return if index >= len(candidates) or target < candidates[ind...
the_stack_v2_python_sparse
T40.py
zhanggyang/leedcode
train
0
68b52a74cae7391bac16318b84b53373aa6afdd0
[ "h = {}\ni = 0\nc = 0\ncc = 0\nwhile i < len(s):\n if s[i] not in h:\n h[s[i]] = i\n cc += 1\n i += 1\n else:\n i = h[s[i]] + 1\n h = {}\n c = max(cc, c)\n cc = 0\nc = max(cc, c)\nreturn c", "h = {}\ni = 0\nc = 0\ncc = 0\nt = -1\nwhile i < len(s):\n if s[i...
<|body_start_0|> h = {} i = 0 c = 0 cc = 0 while i < len(s): if s[i] not in h: h[s[i]] = i cc += 1 i += 1 else: i = h[s[i]] + 1 h = {} c = max(cc, c) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" <|body_0|> def lengthOfLongestSubstring1(self, s): """:type s: str :rtype: int""" <|body_1|> def lengthOfLongestSubstring2(self, s): """:type s: str :rtype: int""" ...
stack_v2_sparse_classes_10k_train_002743
1,723
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "lengthOfLongestSubstring", "signature": "def lengthOfLongestSubstring(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "lengthOfLongestSubstring1", "signature": "def lengthOfLongestSubstring1(self, s)" }, { "docst...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s): :type s: str :rtype: int - def lengthOfLongestSubstring1(self, s): :type s: str :rtype: int - def lengthOfLongestSubstring2(self, s): :type...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s): :type s: str :rtype: int - def lengthOfLongestSubstring1(self, s): :type s: str :rtype: int - def lengthOfLongestSubstring2(self, s): :type...
5b535795cdd742b7810ea163e0868b022736647d
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" <|body_0|> def lengthOfLongestSubstring1(self, s): """:type s: str :rtype: int""" <|body_1|> def lengthOfLongestSubstring2(self, s): """:type s: str :rtype: int""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" h = {} i = 0 c = 0 cc = 0 while i < len(s): if s[i] not in h: h[s[i]] = i cc += 1 i += 1 else: ...
the_stack_v2_python_sparse
Leetcode_Longest_Substring_wo_rep_chars.py
Cbkhare/Codes
train
0
90eb0741763786791b3bb7a0bda0ba3851097594
[ "col = self.db.tag_ware\nvals = col.find()\nkey = [item['total'] for item in vals]\nres = {'tag': key}\nlogger.info('获取所有标签')\nreturn BackstageHTTPResponse(message=u'成功获取所有标签', data=res).to_response()", "collection = self.db.tag_ware\ndata = self.request_data(request)\nname = data['name']\ntag = data['tag']\ntag_...
<|body_start_0|> col = self.db.tag_ware vals = col.find() key = [item['total'] for item in vals] res = {'tag': key} logger.info('获取所有标签') return BackstageHTTPResponse(message=u'成功获取所有标签', data=res).to_response() <|end_body_0|> <|body_start_1|> collection = self.d...
ManualTagView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManualTagView: def get(self, request): """获取所有标签 --- :param request: :return:""" <|body_0|> def post(self, request): """新增一个标签 --- parameters: - name: name description: 名称 type: string paramType: form required: true - name: tag description: 标签 type: string paramType:...
stack_v2_sparse_classes_10k_train_002744
7,342
no_license
[ { "docstring": "获取所有标签 --- :param request: :return:", "name": "get", "signature": "def get(self, request)" }, { "docstring": "新增一个标签 --- parameters: - name: name description: 名称 type: string paramType: form required: true - name: tag description: 标签 type: string paramType: form required: true - ...
4
null
Implement the Python class `ManualTagView` described below. Class description: Implement the ManualTagView class. Method signatures and docstrings: - def get(self, request): 获取所有标签 --- :param request: :return: - def post(self, request): 新增一个标签 --- parameters: - name: name description: 名称 type: string paramType: form ...
Implement the Python class `ManualTagView` described below. Class description: Implement the ManualTagView class. Method signatures and docstrings: - def get(self, request): 获取所有标签 --- :param request: :return: - def post(self, request): 新增一个标签 --- parameters: - name: name description: 名称 type: string paramType: form ...
c50def8cde58fd4663032b860eb058302cbac6da
<|skeleton|> class ManualTagView: def get(self, request): """获取所有标签 --- :param request: :return:""" <|body_0|> def post(self, request): """新增一个标签 --- parameters: - name: name description: 名称 type: string paramType: form required: true - name: tag description: 标签 type: string paramType:...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ManualTagView: def get(self, request): """获取所有标签 --- :param request: :return:""" col = self.db.tag_ware vals = col.find() key = [item['total'] for item in vals] res = {'tag': key} logger.info('获取所有标签') return BackstageHTTPResponse(message=u'成功获取所有标签', da...
the_stack_v2_python_sparse
src/api/backstage/views/manual_tags.py
fan1018wen/Alpha
train
0
ad7ba22445301b9385ebed15e19b5233c9d39bae
[ "if is_callable(type_):\n callable_args = type_.__args__\n argument_types = [PredicateType.get_type(t) for t in callable_args[:-1]]\n return_type = PredicateType.get_type(callable_args[-1])\n return FunctionType(argument_types, return_type)\nelif is_generic(type_):\n name = get_generic_name(type_)\ne...
<|body_start_0|> if is_callable(type_): callable_args = type_.__args__ argument_types = [PredicateType.get_type(t) for t in callable_args[:-1]] return_type = PredicateType.get_type(callable_args[-1]) return FunctionType(argument_types, return_type) elif is...
A base class for `types` in a domain language. This serves much the same purpose as ``typing.Type``, but we add a few conveniences to these types, so we construct separate classes for them and group them together under ``PredicateType`` to have a good type annotation for these types.
PredicateType
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PredicateType: """A base class for `types` in a domain language. This serves much the same purpose as ``typing.Type``, but we add a few conveniences to these types, so we construct separate classes for them and group them together under ``PredicateType`` to have a good type annotation for these t...
stack_v2_sparse_classes_10k_train_002745
39,954
permissive
[ { "docstring": "Converts a python ``Type`` (as you might get from a type annotation) into a ``PredicateType``. If the ``Type`` is callable, this will return a ``FunctionType``; otherwise, it will return a ``BasicType``. ``BasicTypes`` have a single ``name`` parameter - we typically get this from ``type_.__name_...
2
null
Implement the Python class `PredicateType` described below. Class description: A base class for `types` in a domain language. This serves much the same purpose as ``typing.Type``, but we add a few conveniences to these types, so we construct separate classes for them and group them together under ``PredicateType`` to ...
Implement the Python class `PredicateType` described below. Class description: A base class for `types` in a domain language. This serves much the same purpose as ``typing.Type``, but we add a few conveniences to these types, so we construct separate classes for them and group them together under ``PredicateType`` to ...
ccf60824b28f0ce8ceda44a7ce52a0d117669115
<|skeleton|> class PredicateType: """A base class for `types` in a domain language. This serves much the same purpose as ``typing.Type``, but we add a few conveniences to these types, so we construct separate classes for them and group them together under ``PredicateType`` to have a good type annotation for these t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PredicateType: """A base class for `types` in a domain language. This serves much the same purpose as ``typing.Type``, but we add a few conveniences to these types, so we construct separate classes for them and group them together under ``PredicateType`` to have a good type annotation for these types.""" ...
the_stack_v2_python_sparse
allennlp/allennlp/semparse/domain_languages/domain_language.py
ethanjperez/convince
train
27
74f1111f9ecdaf80c30922405f488a499f7bda05
[ "super(Net, self).__init__()\nself.input_dim = input_dim\nself.hidden_size = hidden_size\nself.output_dim = output_dim\nself.num_layers = num_layers\nself.layer_type = layer_type\nself.output_activation = output_activation\nself.internal_batch_norm = internal_batch_norm\nself.skip_connection = skip_connection\nself...
<|body_start_0|> super(Net, self).__init__() self.input_dim = input_dim self.hidden_size = hidden_size self.output_dim = output_dim self.num_layers = num_layers self.layer_type = layer_type self.output_activation = output_activation self.internal_batch_nor...
RealNVP neural network definitions.
Net
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Net: """RealNVP neural network definitions.""" def __init__(self, input_dim: int, hidden_size: int, output_dim: int=None, num_layers: int=3, layer_type: Literal['s', 't']='s', output_activation: Literal['tanh', 'lrelu']='tanh', internal_batch_norm: bool=False, skip_connection: bool=False) ->...
stack_v2_sparse_classes_10k_train_002746
8,028
permissive
[ { "docstring": "RealNVP neural network definition. :param input_dim: Data input dimension. :param hidden_size: Neural network hidden size. :param output_dim: Output dimension. :param num_layers: Number of linear layers. :param layer_type: \"s\" vs \"t\" type layer. :param output_activation: \"s\" network output...
2
stack_v2_sparse_classes_30k_train_006143
Implement the Python class `Net` described below. Class description: RealNVP neural network definitions. Method signatures and docstrings: - def __init__(self, input_dim: int, hidden_size: int, output_dim: int=None, num_layers: int=3, layer_type: Literal['s', 't']='s', output_activation: Literal['tanh', 'lrelu']='tan...
Implement the Python class `Net` described below. Class description: RealNVP neural network definitions. Method signatures and docstrings: - def __init__(self, input_dim: int, hidden_size: int, output_dim: int=None, num_layers: int=3, layer_type: Literal['s', 't']='s', output_activation: Literal['tanh', 'lrelu']='tan...
f470849d5b7b90dc5a65bab8a536de1d57c1021a
<|skeleton|> class Net: """RealNVP neural network definitions.""" def __init__(self, input_dim: int, hidden_size: int, output_dim: int=None, num_layers: int=3, layer_type: Literal['s', 't']='s', output_activation: Literal['tanh', 'lrelu']='tanh', internal_batch_norm: bool=False, skip_connection: bool=False) ->...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Net: """RealNVP neural network definitions.""" def __init__(self, input_dim: int, hidden_size: int, output_dim: int=None, num_layers: int=3, layer_type: Literal['s', 't']='s', output_activation: Literal['tanh', 'lrelu']='tanh', internal_batch_norm: bool=False, skip_connection: bool=False) -> None: ...
the_stack_v2_python_sparse
conformation/model.py
ks8/conformation
train
1
579a0b07dad117162c119cc43c9ae6f84a3085f4
[ "mock_settings.ENABLE_NOTIFICATIONS = True\n\n@do_maybe_notification\ndef create_split():\n Splits = namedtuple('Splits', 'data')\n return Splits([{'id': 1}, {'id': 2}])\ncreate_split()\nmock_queue.add.assert_has_calls([mock.call(params={'split': 1}, url='/notifications/notify/'), mock.call(params={'split': 2...
<|body_start_0|> mock_settings.ENABLE_NOTIFICATIONS = True @do_maybe_notification def create_split(): Splits = namedtuple('Splits', 'data') return Splits([{'id': 1}, {'id': 2}]) create_split() mock_queue.add.assert_has_calls([mock.call(params={'split': 1}...
NotifyTestCase
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotifyTestCase: def test_task_queue_decorator(self, mock_queue, mock_settings): """Test the decorator that puts message tasks in the queue.""" <|body_0|> def test_notify_endpoint(self, mock_send): """Test sending an update message from a post to /notify.""" <...
stack_v2_sparse_classes_10k_train_002747
2,183
permissive
[ { "docstring": "Test the decorator that puts message tasks in the queue.", "name": "test_task_queue_decorator", "signature": "def test_task_queue_decorator(self, mock_queue, mock_settings)" }, { "docstring": "Test sending an update message from a post to /notify.", "name": "test_notify_endpo...
2
stack_v2_sparse_classes_30k_train_005396
Implement the Python class `NotifyTestCase` described below. Class description: Implement the NotifyTestCase class. Method signatures and docstrings: - def test_task_queue_decorator(self, mock_queue, mock_settings): Test the decorator that puts message tasks in the queue. - def test_notify_endpoint(self, mock_send): ...
Implement the Python class `NotifyTestCase` described below. Class description: Implement the NotifyTestCase class. Method signatures and docstrings: - def test_task_queue_decorator(self, mock_queue, mock_settings): Test the decorator that puts message tasks in the queue. - def test_notify_endpoint(self, mock_send): ...
46c4a1fe409a45e8595210a5cf242425d40d4b41
<|skeleton|> class NotifyTestCase: def test_task_queue_decorator(self, mock_queue, mock_settings): """Test the decorator that puts message tasks in the queue.""" <|body_0|> def test_notify_endpoint(self, mock_send): """Test sending an update message from a post to /notify.""" <...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NotifyTestCase: def test_task_queue_decorator(self, mock_queue, mock_settings): """Test the decorator that puts message tasks in the queue.""" mock_settings.ENABLE_NOTIFICATIONS = True @do_maybe_notification def create_split(): Splits = namedtuple('Splits', 'data')...
the_stack_v2_python_sparse
apps/notifications/tests.py
tractiming/trac-gae
train
5
6f1bcea99af09f0bd30fab0cc486c8e6fe043792
[ "self.center = center\nself.indices = indices\nself.score = score\nself.left = None\nself.right = None", "self.left = _BisectingTree(indices=self.indices[labels == 0], center=centers[0], score=scores[0])\nself.right = _BisectingTree(indices=self.indices[labels == 1], center=centers[1], score=scores[1])\nself.indi...
<|body_start_0|> self.center = center self.indices = indices self.score = score self.left = None self.right = None <|end_body_0|> <|body_start_1|> self.left = _BisectingTree(indices=self.indices[labels == 0], center=centers[0], score=scores[0]) self.right = _Bise...
Tree structure representing the hierarchical clusters of BisectingKMeans.
_BisectingTree
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _BisectingTree: """Tree structure representing the hierarchical clusters of BisectingKMeans.""" def __init__(self, center, indices, score): """Create a new cluster node in the tree. The node holds the center of this cluster and the indices of the data points that belong to it.""" ...
stack_v2_sparse_classes_10k_train_002748
18,882
permissive
[ { "docstring": "Create a new cluster node in the tree. The node holds the center of this cluster and the indices of the data points that belong to it.", "name": "__init__", "signature": "def __init__(self, center, indices, score)" }, { "docstring": "Split the cluster node into two subclusters.",...
4
null
Implement the Python class `_BisectingTree` described below. Class description: Tree structure representing the hierarchical clusters of BisectingKMeans. Method signatures and docstrings: - def __init__(self, center, indices, score): Create a new cluster node in the tree. The node holds the center of this cluster and...
Implement the Python class `_BisectingTree` described below. Class description: Tree structure representing the hierarchical clusters of BisectingKMeans. Method signatures and docstrings: - def __init__(self, center, indices, score): Create a new cluster node in the tree. The node holds the center of this cluster and...
061f8777b48e5491b0c57bb8e0bc7067c103079d
<|skeleton|> class _BisectingTree: """Tree structure representing the hierarchical clusters of BisectingKMeans.""" def __init__(self, center, indices, score): """Create a new cluster node in the tree. The node holds the center of this cluster and the indices of the data points that belong to it.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _BisectingTree: """Tree structure representing the hierarchical clusters of BisectingKMeans.""" def __init__(self, center, indices, score): """Create a new cluster node in the tree. The node holds the center of this cluster and the indices of the data points that belong to it.""" self.cen...
the_stack_v2_python_sparse
sklearn/cluster/_bisect_k_means.py
scikit-learn/scikit-learn
train
58,456
33ec09ba13f6846d5027bb4199082f3bab99bd67
[ "if not l or not r or r < l:\n return list()\nt = list()\nfor i in range(l, r + 1, 1):\n if self.is_self_dividing(i):\n t.append(i)\nreturn t", "if not i:\n return False\np = i\nwhile p > 0:\n p, d = divmod(p, 10)\n if d == 0 or i % d != 0:\n return False\nreturn True" ]
<|body_start_0|> if not l or not r or r < l: return list() t = list() for i in range(l, r + 1, 1): if self.is_self_dividing(i): t.append(i) return t <|end_body_0|> <|body_start_1|> if not i: return False p = i w...
Iteration over all integers in range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range
Solution2
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution2: """Iteration over all integers in range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range""" def find_self_dividing_nums(self, l, r): """Determines all self-dividing numbers...
stack_v2_sparse_classes_10k_train_002749
3,918
permissive
[ { "docstring": "Determines all self-dividing numbers within target limits (inclusive). :param int l: lower limit of target range :param int r: upper limit of target range :return: array of all self-dividing numbers in range :rtype: list[int]", "name": "find_self_dividing_nums", "signature": "def find_se...
2
stack_v2_sparse_classes_30k_train_004466
Implement the Python class `Solution2` described below. Class description: Iteration over all integers in range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range Method signatures and docstrings: - def find_self_dividi...
Implement the Python class `Solution2` described below. Class description: Iteration over all integers in range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range Method signatures and docstrings: - def find_self_dividi...
69f90877c5466927e8b081c4268cbcda074813ec
<|skeleton|> class Solution2: """Iteration over all integers in range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range""" def find_self_dividing_nums(self, l, r): """Determines all self-dividing numbers...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution2: """Iteration over all integers in range. Time complexity: O(n ** m) - Amortized iterate over all integers and contained digits Space complexity: O(n) - Amortized store all integers in range""" def find_self_dividing_nums(self, l, r): """Determines all self-dividing numbers within targe...
the_stack_v2_python_sparse
0728_self_dividing_numbers/python_source.py
arthurdysart/LeetCode
train
0
7576348745a1722575e4c4a2164b05aeca070a5f
[ "s1, s2 = ('', '')\nwhile l1:\n s1 = s1 + str(l1.val)\n l1 = l1.next\nwhile l2:\n s2 = s2 + str(l2.val)\n l2 = l2.next\nnum = int(s1[::-1]) + int(s2[::-1])\nnum = str(num)[::-1]\npivot = head = ListNode(num[0])\nfor x in num[1:]:\n head.next = ListNode(int(x))\n head = head.next\nreturn pivot", ...
<|body_start_0|> s1, s2 = ('', '') while l1: s1 = s1 + str(l1.val) l1 = l1.next while l2: s2 = s2 + str(l2.val) l2 = l2.next num = int(s1[::-1]) + int(s2[::-1]) num = str(num)[::-1] pivot = head = ListNode(num[0]) fo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addTwoNumbers1(self, l1: ListNode, l2: ListNode) -> ListNode: """先遍历生成int,求值后再生成链表。""" <|body_0|> def addTwoNumbers2(self, l1: ListNode, l2: ListNode) -> ListNode: """内置函数divmod() x,y = divmod(m,n) x = m//n y = m%n""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k_train_002750
2,266
no_license
[ { "docstring": "先遍历生成int,求值后再生成链表。", "name": "addTwoNumbers1", "signature": "def addTwoNumbers1(self, l1: ListNode, l2: ListNode) -> ListNode" }, { "docstring": "内置函数divmod() x,y = divmod(m,n) x = m//n y = m%n", "name": "addTwoNumbers2", "signature": "def addTwoNumbers2(self, l1: ListNod...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addTwoNumbers1(self, l1: ListNode, l2: ListNode) -> ListNode: 先遍历生成int,求值后再生成链表。 - def addTwoNumbers2(self, l1: ListNode, l2: ListNode) -> ListNode: 内置函数divmod() x,y = divmod...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addTwoNumbers1(self, l1: ListNode, l2: ListNode) -> ListNode: 先遍历生成int,求值后再生成链表。 - def addTwoNumbers2(self, l1: ListNode, l2: ListNode) -> ListNode: 内置函数divmod() x,y = divmod...
2bbb1640589aab34f2bc42489283033cc11fb885
<|skeleton|> class Solution: def addTwoNumbers1(self, l1: ListNode, l2: ListNode) -> ListNode: """先遍历生成int,求值后再生成链表。""" <|body_0|> def addTwoNumbers2(self, l1: ListNode, l2: ListNode) -> ListNode: """内置函数divmod() x,y = divmod(m,n) x = m//n y = m%n""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def addTwoNumbers1(self, l1: ListNode, l2: ListNode) -> ListNode: """先遍历生成int,求值后再生成链表。""" s1, s2 = ('', '') while l1: s1 = s1 + str(l1.val) l1 = l1.next while l2: s2 = s2 + str(l2.val) l2 = l2.next num = int(s1[...
the_stack_v2_python_sparse
002_add-two-numbers.py
helloocc/algorithm
train
1
70716cd42162faaa4fb32feda47f1aea36b63610
[ "schema = getattr(cls, '__schema__')\nif schema is None:\n raise Exception(f'{cls.__name__}: not serializable; missing schema')\nreturn schema", "d = self.schema().dump(self) if camel_case else {humps.decamelize(k): v for k, v in self.schema().dump(self).items()}\nif drop_nulls:\n d = _drop_nulls(d)\ns = js...
<|body_start_0|> schema = getattr(cls, '__schema__') if schema is None: raise Exception(f'{cls.__name__}: not serializable; missing schema') return schema <|end_body_0|> <|body_start_1|> d = self.schema().dump(self) if camel_case else {humps.decamelize(k): v for k, v in self...
Marks that a class is serializeable to JSON.
Serializable
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Serializable: """Marks that a class is serializeable to JSON.""" def schema(cls): """Gets the marshmallow serializer for the implementing class.""" <|body_0|> def to_json(self, camel_case: bool=True, pretty_print: bool=True, drop_nulls: bool=False) -> str: """Con...
stack_v2_sparse_classes_10k_train_002751
2,677
permissive
[ { "docstring": "Gets the marshmallow serializer for the implementing class.", "name": "schema", "signature": "def schema(cls)" }, { "docstring": "Convert an implementing instance to JSON. Parameters ---------- camel_case : bool (default True) If True, the keys of the returned dict will be camel-...
3
stack_v2_sparse_classes_30k_train_003597
Implement the Python class `Serializable` described below. Class description: Marks that a class is serializeable to JSON. Method signatures and docstrings: - def schema(cls): Gets the marshmallow serializer for the implementing class. - def to_json(self, camel_case: bool=True, pretty_print: bool=True, drop_nulls: bo...
Implement the Python class `Serializable` described below. Class description: Marks that a class is serializeable to JSON. Method signatures and docstrings: - def schema(cls): Gets the marshmallow serializer for the implementing class. - def to_json(self, camel_case: bool=True, pretty_print: bool=True, drop_nulls: bo...
dca436188e062fd07dfe589ee61e8bb97aa3ea98
<|skeleton|> class Serializable: """Marks that a class is serializeable to JSON.""" def schema(cls): """Gets the marshmallow serializer for the implementing class.""" <|body_0|> def to_json(self, camel_case: bool=True, pretty_print: bool=True, drop_nulls: bool=False) -> str: """Con...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Serializable: """Marks that a class is serializeable to JSON.""" def schema(cls): """Gets the marshmallow serializer for the implementing class.""" schema = getattr(cls, '__schema__') if schema is None: raise Exception(f'{cls.__name__}: not serializable; missing schema...
the_stack_v2_python_sparse
core/json.py
clohr/model-service
train
1
49e2e64348c5563e3bedafceb853bf9ffc423d4a
[ "if isinstance(final_states, Qobj) or final_states is None:\n self.final_states = [final_states]\n self.probabilities = [probabilities]\n if cbits:\n self.cbits = [cbits]\nelse:\n inds = list(filter(lambda x: final_states[x] is not None, range(len(final_states))))\n self.final_states = [final_...
<|body_start_0|> if isinstance(final_states, Qobj) or final_states is None: self.final_states = [final_states] self.probabilities = [probabilities] if cbits: self.cbits = [cbits] else: inds = list(filter(lambda x: final_states[x] is not Non...
Result of a quantum circuit simulation.
CircuitResult
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CircuitResult: """Result of a quantum circuit simulation.""" def __init__(self, final_states, probabilities, cbits=None): """Store result of CircuitSimulator. Parameters ---------- final_states: list of Qobj. List of output kets or density matrices. probabilities: list of float. List...
stack_v2_sparse_classes_10k_train_002752
23,944
permissive
[ { "docstring": "Store result of CircuitSimulator. Parameters ---------- final_states: list of Qobj. List of output kets or density matrices. probabilities: list of float. List of probabilities of obtaining each output state. cbits: list of list of int, optional List of cbits for each output.", "name": "__in...
4
stack_v2_sparse_classes_30k_train_002433
Implement the Python class `CircuitResult` described below. Class description: Result of a quantum circuit simulation. Method signatures and docstrings: - def __init__(self, final_states, probabilities, cbits=None): Store result of CircuitSimulator. Parameters ---------- final_states: list of Qobj. List of output ket...
Implement the Python class `CircuitResult` described below. Class description: Result of a quantum circuit simulation. Method signatures and docstrings: - def __init__(self, final_states, probabilities, cbits=None): Store result of CircuitSimulator. Parameters ---------- final_states: list of Qobj. List of output ket...
a5e97023cc84ba7509b0ee65d742b8a0ae19fdf0
<|skeleton|> class CircuitResult: """Result of a quantum circuit simulation.""" def __init__(self, final_states, probabilities, cbits=None): """Store result of CircuitSimulator. Parameters ---------- final_states: list of Qobj. List of output kets or density matrices. probabilities: list of float. List...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CircuitResult: """Result of a quantum circuit simulation.""" def __init__(self, final_states, probabilities, cbits=None): """Store result of CircuitSimulator. Parameters ---------- final_states: list of Qobj. List of output kets or density matrices. probabilities: list of float. List of probabili...
the_stack_v2_python_sparse
src/qutip_qip/circuit/circuitsimulator.py
qutip/qutip-qip
train
84
cefbd0464db5762ad670394baf0502c961302603
[ "self.caffe = Caffe.objects.create(name='kafo', city='Gliwice', street='Wieczorka', house_number='14', postal_code='44-100')\nself.filtry = Caffe.objects.create(name='filtry', city='Warszawa', street='Filry', house_number='14', postal_code='44-100')\nfirst_cat = Category.objects.create(name='first', caffe=self.caff...
<|body_start_0|> self.caffe = Caffe.objects.create(name='kafo', city='Gliwice', street='Wieczorka', house_number='14', postal_code='44-100') self.filtry = Caffe.objects.create(name='filtry', city='Warszawa', street='Filry', house_number='14', postal_code='44-100') first_cat = Category.objects.cr...
FullProduct tests.
FullProductModelTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FullProductModelTest: """FullProduct tests.""" def setUp(self): """Test data setup.""" <|body_0|> def test_full_product(self): """Test creating FullProducts.""" <|body_1|> def test_fullproduct_validation(self): """Check if FullProduct has pro...
stack_v2_sparse_classes_10k_train_002753
14,711
permissive
[ { "docstring": "Test data setup.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test creating FullProducts.", "name": "test_full_product", "signature": "def test_full_product(self)" }, { "docstring": "Check if FullProduct has proper validation.", "name":...
3
stack_v2_sparse_classes_30k_train_000532
Implement the Python class `FullProductModelTest` described below. Class description: FullProduct tests. Method signatures and docstrings: - def setUp(self): Test data setup. - def test_full_product(self): Test creating FullProducts. - def test_fullproduct_validation(self): Check if FullProduct has proper validation.
Implement the Python class `FullProductModelTest` described below. Class description: FullProduct tests. Method signatures and docstrings: - def setUp(self): Test data setup. - def test_full_product(self): Test creating FullProducts. - def test_fullproduct_validation(self): Check if FullProduct has proper validation....
cdb7f5edb29255c7e874eaa6231621063210a8b0
<|skeleton|> class FullProductModelTest: """FullProduct tests.""" def setUp(self): """Test data setup.""" <|body_0|> def test_full_product(self): """Test creating FullProducts.""" <|body_1|> def test_fullproduct_validation(self): """Check if FullProduct has pro...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FullProductModelTest: """FullProduct tests.""" def setUp(self): """Test data setup.""" self.caffe = Caffe.objects.create(name='kafo', city='Gliwice', street='Wieczorka', house_number='14', postal_code='44-100') self.filtry = Caffe.objects.create(name='filtry', city='Warszawa', str...
the_stack_v2_python_sparse
caffe/reports/test_models.py
VirrageS/io-kawiarnie
train
3
9495ccc6c21bd33d4569f3b40b22860e6fc2821b
[ "if not self.ITEM_MODEL:\n raise NotImplementedError(f'ITEM_MODEL attribute not defined for {__class__}')\nids = []\nfor k in [self.ITEM_KEY + x for x in ['', '[]', 's', 's[]']]:\n if (ids := self.request.query_params.getlist(k, [])):\n break\nvalid_ids = []\nfor id in ids:\n try:\n valid_ids...
<|body_start_0|> if not self.ITEM_MODEL: raise NotImplementedError(f'ITEM_MODEL attribute not defined for {__class__}') ids = [] for k in [self.ITEM_KEY + x for x in ['', '[]', 's', 's[]']]: if (ids := self.request.query_params.getlist(k, [])): break ...
Mixin for extracting multiple objects from query params. Each subclass *must* have an attribute called 'ITEM_KEY', which is used to determine what 'key' is used in the query parameters. This mixin defines a 'get_items' method which provides a generic implementation to return a list of matching database model instances
ReportFilterMixin
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReportFilterMixin: """Mixin for extracting multiple objects from query params. Each subclass *must* have an attribute called 'ITEM_KEY', which is used to determine what 'key' is used in the query parameters. This mixin defines a 'get_items' method which provides a generic implementation to return...
stack_v2_sparse_classes_10k_train_002754
19,444
permissive
[ { "docstring": "Return a list of database objects from query parameters", "name": "get_items", "signature": "def get_items(self)" }, { "docstring": "Filter the queryset based on the provided report ID values. As each 'report' instance may optionally define its own filters, the resulting queryset...
2
stack_v2_sparse_classes_30k_test_000162
Implement the Python class `ReportFilterMixin` described below. Class description: Mixin for extracting multiple objects from query params. Each subclass *must* have an attribute called 'ITEM_KEY', which is used to determine what 'key' is used in the query parameters. This mixin defines a 'get_items' method which prov...
Implement the Python class `ReportFilterMixin` described below. Class description: Mixin for extracting multiple objects from query params. Each subclass *must* have an attribute called 'ITEM_KEY', which is used to determine what 'key' is used in the query parameters. This mixin defines a 'get_items' method which prov...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class ReportFilterMixin: """Mixin for extracting multiple objects from query params. Each subclass *must* have an attribute called 'ITEM_KEY', which is used to determine what 'key' is used in the query parameters. This mixin defines a 'get_items' method which provides a generic implementation to return...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ReportFilterMixin: """Mixin for extracting multiple objects from query params. Each subclass *must* have an attribute called 'ITEM_KEY', which is used to determine what 'key' is used in the query parameters. This mixin defines a 'get_items' method which provides a generic implementation to return a list of ma...
the_stack_v2_python_sparse
InvenTree/report/api.py
inventree/InvenTree
train
3,077
273e47b6b21f6bb431b5e18a3d1cf31a782263b3
[ "super(LeNetRegressorMLP, self).__init__()\nself.fc2 = nn.Linear(input_dims, 1)\nself.restored = False", "out = F.dropout(F.relu(feat), training=self.training)\nout = F.sigmoid(self.fc2(out))\nreturn out" ]
<|body_start_0|> super(LeNetRegressorMLP, self).__init__() self.fc2 = nn.Linear(input_dims, 1) self.restored = False <|end_body_0|> <|body_start_1|> out = F.dropout(F.relu(feat), training=self.training) out = F.sigmoid(self.fc2(out)) return out <|end_body_1|>
LeNet classifier model for ADDA.
LeNetRegressorMLP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LeNetRegressorMLP: """LeNet classifier model for ADDA.""" def __init__(self, input_dims): """Init LeNet encoder.""" <|body_0|> def forward(self, feat): """Forward the LeNet classifier.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(LeNetR...
stack_v2_sparse_classes_10k_train_002755
1,889
no_license
[ { "docstring": "Init LeNet encoder.", "name": "__init__", "signature": "def __init__(self, input_dims)" }, { "docstring": "Forward the LeNet classifier.", "name": "forward", "signature": "def forward(self, feat)" } ]
2
stack_v2_sparse_classes_30k_test_000159
Implement the Python class `LeNetRegressorMLP` described below. Class description: LeNet classifier model for ADDA. Method signatures and docstrings: - def __init__(self, input_dims): Init LeNet encoder. - def forward(self, feat): Forward the LeNet classifier.
Implement the Python class `LeNetRegressorMLP` described below. Class description: LeNet classifier model for ADDA. Method signatures and docstrings: - def __init__(self, input_dims): Init LeNet encoder. - def forward(self, feat): Forward the LeNet classifier. <|skeleton|> class LeNetRegressorMLP: """LeNet class...
44557a9b79d4ae9ac3c90f726c1e7cb82346f95d
<|skeleton|> class LeNetRegressorMLP: """LeNet classifier model for ADDA.""" def __init__(self, input_dims): """Init LeNet encoder.""" <|body_0|> def forward(self, feat): """Forward the LeNet classifier.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LeNetRegressorMLP: """LeNet classifier model for ADDA.""" def __init__(self, input_dims): """Init LeNet encoder.""" super(LeNetRegressorMLP, self).__init__() self.fc2 = nn.Linear(input_dims, 1) self.restored = False def forward(self, feat): """Forward the LeNe...
the_stack_v2_python_sparse
models/adda_models/MPL.py
abr-98/FADACS_Parking_Prediction
train
0
ba742a4109302b4a02b092c8a0a3da2d63fa7074
[ "self.d = {}\nself.cap = capacity\nself.head = Node(-1, -1, None)\nList.initHead(self.head)", "if key not in self.d:\n return -1\nself.d[key].hit()\nreturn self.d[key].value", "if self.cap == 0:\n return\nif key in self.d:\n self.d[key].hit()\n self.d[key].value = value\nelse:\n if len(self.d) >=...
<|body_start_0|> self.d = {} self.cap = capacity self.head = Node(-1, -1, None) List.initHead(self.head) <|end_body_0|> <|body_start_1|> if key not in self.d: return -1 self.d[key].hit() return self.d[key].value <|end_body_1|> <|body_start_2|> ...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:rtype: int""" <|body_1|> def set(self, key, value): """:type key: int :type value: int :rtype: nothing""" <|body_2|> <|end_skeleton|> <...
stack_v2_sparse_classes_10k_train_002756
1,549
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: nothing", "name": "set", "sig...
3
stack_v2_sparse_classes_30k_train_001022
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :rtype: int - def set(self, key, value): :type key: int :type value: int :rtype: nothing
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :rtype: int - def set(self, key, value): :type key: int :type value: int :rtype: nothing <|skeleton|> cla...
929dde1723fb2f54870c8a9badc80fc23e8400d3
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:rtype: int""" <|body_1|> def set(self, key, value): """:type key: int :type value: int :rtype: nothing""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.d = {} self.cap = capacity self.head = Node(-1, -1, None) List.initHead(self.head) def get(self, key): """:rtype: int""" if key not in self.d: return -1 self....
the_stack_v2_python_sparse
_algorithms_challenges/leetcode/lc-all-solutions/146.lru-cache/lru-cache.py
syurskyi/Algorithms_and_Data_Structure
train
4
4f4874928b6577a830d552dc4adebfaab0ca441c
[ "QtWidgets.QWidget.__init__(self, *args, **kargs)\nif constraints_dict == None:\n constraints_dict = {}\nself.constants_manager = constants_manager\nself.constraints_dict = self.constants_manager.constrains\nself.widget_dict = {}\nlayout = QtWidgets.QFormLayout()\nfor k in list(self.constants_manager.keys()):\n ...
<|body_start_0|> QtWidgets.QWidget.__init__(self, *args, **kargs) if constraints_dict == None: constraints_dict = {} self.constants_manager = constants_manager self.constraints_dict = self.constants_manager.constrains self.widget_dict = {} layout = QtWidgets.Q...
CMWidget
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CMWidget: def __init__(self, constants_manager, constraints_dict=None, key_list=None, *args, **kargs): """This class will manage the constants with a gui interface. Each value is caracterized by its name (called key), its type, its initial value and its description. These information are...
stack_v2_sparse_classes_10k_train_002757
5,116
no_license
[ { "docstring": "This class will manage the constants with a gui interface. Each value is caracterized by its name (called key), its type, its initial value and its description. These information are given in values_dict. - constants_manager : the constant manager instance to represent", "name": "__init__", ...
4
stack_v2_sparse_classes_30k_val_000347
Implement the Python class `CMWidget` described below. Class description: Implement the CMWidget class. Method signatures and docstrings: - def __init__(self, constants_manager, constraints_dict=None, key_list=None, *args, **kargs): This class will manage the constants with a gui interface. Each value is caracterized...
Implement the Python class `CMWidget` described below. Class description: Implement the CMWidget class. Method signatures and docstrings: - def __init__(self, constants_manager, constraints_dict=None, key_list=None, *args, **kargs): This class will manage the constants with a gui interface. Each value is caracterized...
14c9e51fa31fd3ff4113f33e26619d07c9f1dc7c
<|skeleton|> class CMWidget: def __init__(self, constants_manager, constraints_dict=None, key_list=None, *args, **kargs): """This class will manage the constants with a gui interface. Each value is caracterized by its name (called key), its type, its initial value and its description. These information are...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CMWidget: def __init__(self, constants_manager, constraints_dict=None, key_list=None, *args, **kargs): """This class will manage the constants with a gui interface. Each value is caracterized by its name (called key), its type, its initial value and its description. These information are given in valu...
the_stack_v2_python_sparse
ConstantsManager/ConstantsManagerWidget.py
grumpfou/AthenaWriter
train
0
7dccaef5ad5037d3ae6870574e63861d9cf8f585
[ "self.curl_buffer = CurlBuffer()\nself.curl = pycurl.Curl()\nself.curl.setopt(self.curl.VERBOSE, 0)\nself.curl.setopt(self.curl.WRITEFUNCTION, self.curl_buffer.body_callback)\nself.curl.setopt(self.curl.URL, self.url)\nself.curl.perform()", "query_string = '?sensor=false&address=%s' % urlquote(address)\nself.url ...
<|body_start_0|> self.curl_buffer = CurlBuffer() self.curl = pycurl.Curl() self.curl.setopt(self.curl.VERBOSE, 0) self.curl.setopt(self.curl.WRITEFUNCTION, self.curl_buffer.body_callback) self.curl.setopt(self.curl.URL, self.url) self.curl.perform() <|end_body_0|> <|body...
Retrieve latitude/longitude coordinate for an address. Production uses Google's geocoding service. Test mode uses Open Street Maps' geocoding service. Option (for performance boost) to allow Jenkins to return static location.
GeocodeLocation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeocodeLocation: """Retrieve latitude/longitude coordinate for an address. Production uses Google's geocoding service. Test mode uses Open Street Maps' geocoding service. Option (for performance boost) to allow Jenkins to return static location.""" def _execute_curl(self): """Use cur...
stack_v2_sparse_classes_10k_train_002758
4,650
no_license
[ { "docstring": "Use curl to submit request to geocoder service.", "name": "_execute_curl", "signature": "def _execute_curl(self)" }, { "docstring": "Use google API to retrieve lat/long coords for this address.", "name": "_google_service", "signature": "def _google_service(self, address)"...
5
stack_v2_sparse_classes_30k_train_000453
Implement the Python class `GeocodeLocation` described below. Class description: Retrieve latitude/longitude coordinate for an address. Production uses Google's geocoding service. Test mode uses Open Street Maps' geocoding service. Option (for performance boost) to allow Jenkins to return static location. Method sign...
Implement the Python class `GeocodeLocation` described below. Class description: Retrieve latitude/longitude coordinate for an address. Production uses Google's geocoding service. Test mode uses Open Street Maps' geocoding service. Option (for performance boost) to allow Jenkins to return static location. Method sign...
a780ccdc3350d4b5c7990c65d1af8d71060c62cc
<|skeleton|> class GeocodeLocation: """Retrieve latitude/longitude coordinate for an address. Production uses Google's geocoding service. Test mode uses Open Street Maps' geocoding service. Option (for performance boost) to allow Jenkins to return static location.""" def _execute_curl(self): """Use cur...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GeocodeLocation: """Retrieve latitude/longitude coordinate for an address. Production uses Google's geocoding service. Test mode uses Open Street Maps' geocoding service. Option (for performance boost) to allow Jenkins to return static location.""" def _execute_curl(self): """Use curl to submit r...
the_stack_v2_python_sparse
geolocation/geocode_address.py
wcirillo/ten
train
0
6f8f3fafedd4d67f38afac40fd5f50399532339a
[ "if overlays is None:\n raise ValueError('Must specify overlays.')\nself._toolchains = []\nself._require_explicit_default_toolchain = True\nself._require_explicit_default_toolchain = False\nfor overlay_path in overlays:\n self._AddToolchainsFromOverlayDir(overlay_path)", "config_path = os.path.join(overlay_...
<|body_start_0|> if overlays is None: raise ValueError('Must specify overlays.') self._toolchains = [] self._require_explicit_default_toolchain = True self._require_explicit_default_toolchain = False for overlay_path in overlays: self._AddToolchainsFromOve...
Represents a list of toolchains.
ToolchainList
[ "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ToolchainList: """Represents a list of toolchains.""" def __init__(self, overlays): """Construct an instance. Args: overlays: list of overlay directories to add toolchains from.""" <|body_0|> def _AddToolchainsFromOverlayDir(self, overlay_dir): """Add toolchains ...
stack_v2_sparse_classes_10k_train_002759
4,300
permissive
[ { "docstring": "Construct an instance. Args: overlays: list of overlay directories to add toolchains from.", "name": "__init__", "signature": "def __init__(self, overlays)" }, { "docstring": "Add toolchains to |self| from the given overlay. Does not include overlays that this overlay depends on....
4
null
Implement the Python class `ToolchainList` described below. Class description: Represents a list of toolchains. Method signatures and docstrings: - def __init__(self, overlays): Construct an instance. Args: overlays: list of overlay directories to add toolchains from. - def _AddToolchainsFromOverlayDir(self, overlay_...
Implement the Python class `ToolchainList` described below. Class description: Represents a list of toolchains. Method signatures and docstrings: - def __init__(self, overlays): Construct an instance. Args: overlays: list of overlay directories to add toolchains from. - def _AddToolchainsFromOverlayDir(self, overlay_...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class ToolchainList: """Represents a list of toolchains.""" def __init__(self, overlays): """Construct an instance. Args: overlays: list of overlay directories to add toolchains from.""" <|body_0|> def _AddToolchainsFromOverlayDir(self, overlay_dir): """Add toolchains ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ToolchainList: """Represents a list of toolchains.""" def __init__(self, overlays): """Construct an instance. Args: overlays: list of overlay directories to add toolchains from.""" if overlays is None: raise ValueError('Must specify overlays.') self._toolchains = [] ...
the_stack_v2_python_sparse
third_party/chromite/lib/toolchain_list.py
metux/chromium-suckless
train
5
e63f6accc744295ac34222e1e8b5c59f05dc8d3d
[ "if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(email=self.normalize_email(email))\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(email, password=password)\nuser.is_admin = True\nuser.save(using=self._db)\nreturn user" ]
<|body_start_0|> if not email: raise ValueError('Users must have an email address') user = self.model(email=self.normalize_email(email)) user.set_password(password) user.save(using=self._db) return user <|end_body_0|> <|body_start_1|> user = self.create_user(...
MyUserManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyUserManager: def create_user(self, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, email, password=None): """Creates and saves a superuser with the given email, date of bi...
stack_v2_sparse_classes_10k_train_002760
4,400
permissive
[ { "docstring": "Creates and saves a User with the given email, date of birth and password.", "name": "create_user", "signature": "def create_user(self, email, password=None)" }, { "docstring": "Creates and saves a superuser with the given email, date of birth and password.", "name": "create_...
2
stack_v2_sparse_classes_30k_train_002358
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, email, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, email, password=Non...
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, email, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, email, password=Non...
0b61f67ce3158cf727d3570daf60bff1b0417360
<|skeleton|> class MyUserManager: def create_user(self, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, email, password=None): """Creates and saves a superuser with the given email, date of bi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MyUserManager: def create_user(self, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" if not email: raise ValueError('Users must have an email address') user = self.model(email=self.normalize_email(email)) user....
the_stack_v2_python_sparse
Business_Coaching_Platform/user/models.py
SDOS2020/Team_1_Business_Coaching_Platform
train
0
ee34a45dfaf26346c0d07dad02df79e8308c93fc
[ "n = n_sersic\nx_red = self._x_reduced(x, y, n, R_sersic, center_x, center_y)\nb = self.b_n(n)\nhyper2f2_bx = util.hyper2F2_array(2 * n, 2 * n, 1 + 2 * n, 1 + 2 * n, -b * x_red)\nf_eff = np.exp(b) * R_sersic ** 2 / 2.0 * k_eff\nf_ = f_eff * x_red ** (2 * n) * hyper2f2_bx\nreturn f_", "x_ = x - center_x\ny_ = y - ...
<|body_start_0|> n = n_sersic x_red = self._x_reduced(x, y, n, R_sersic, center_x, center_y) b = self.b_n(n) hyper2f2_bx = util.hyper2F2_array(2 * n, 2 * n, 1 + 2 * n, 1 + 2 * n, -b * x_red) f_eff = np.exp(b) * R_sersic ** 2 / 2.0 * k_eff f_ = f_eff * x_red ** (2 * n) * h...
this class contains functions to evaluate a Sersic mass profile: https://arxiv.org/pdf/astro-ph/0311559.pdf .. math:: \\kappa(R) = \\kappa_{\\rm eff} \\exp \\left[ -b_n (R/R_{\\rm Sersic})^{\\frac{1}{n}}\\right] with :math:`b_{n}\\approx 1.999n-0.327` Examples -------- Example for converting physical mass units into co...
Sersic
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sersic: """this class contains functions to evaluate a Sersic mass profile: https://arxiv.org/pdf/astro-ph/0311559.pdf .. math:: \\kappa(R) = \\kappa_{\\rm eff} \\exp \\left[ -b_n (R/R_{\\rm Sersic})^{\\frac{1}{n}}\\right] with :math:`b_{n}\\approx 1.999n-0.327` Examples -------- Example for conv...
stack_v2_sparse_classes_10k_train_002761
4,388
permissive
[ { "docstring": ":param x: x-coordinate :param y: y-coordinate :param n_sersic: Sersic index :param R_sersic: half light radius :param k_eff: convergence at half light radius :param center_x: x-center :param center_y: y-center :return:", "name": "function", "signature": "def function(self, x, y, n_sersic...
3
stack_v2_sparse_classes_30k_train_004630
Implement the Python class `Sersic` described below. Class description: this class contains functions to evaluate a Sersic mass profile: https://arxiv.org/pdf/astro-ph/0311559.pdf .. math:: \\kappa(R) = \\kappa_{\\rm eff} \\exp \\left[ -b_n (R/R_{\\rm Sersic})^{\\frac{1}{n}}\\right] with :math:`b_{n}\\approx 1.999n-0....
Implement the Python class `Sersic` described below. Class description: this class contains functions to evaluate a Sersic mass profile: https://arxiv.org/pdf/astro-ph/0311559.pdf .. math:: \\kappa(R) = \\kappa_{\\rm eff} \\exp \\left[ -b_n (R/R_{\\rm Sersic})^{\\frac{1}{n}}\\right] with :math:`b_{n}\\approx 1.999n-0....
73c9645f26f6983fe7961104075ebe8bf7a4b54c
<|skeleton|> class Sersic: """this class contains functions to evaluate a Sersic mass profile: https://arxiv.org/pdf/astro-ph/0311559.pdf .. math:: \\kappa(R) = \\kappa_{\\rm eff} \\exp \\left[ -b_n (R/R_{\\rm Sersic})^{\\frac{1}{n}}\\right] with :math:`b_{n}\\approx 1.999n-0.327` Examples -------- Example for conv...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Sersic: """this class contains functions to evaluate a Sersic mass profile: https://arxiv.org/pdf/astro-ph/0311559.pdf .. math:: \\kappa(R) = \\kappa_{\\rm eff} \\exp \\left[ -b_n (R/R_{\\rm Sersic})^{\\frac{1}{n}}\\right] with :math:`b_{n}\\approx 1.999n-0.327` Examples -------- Example for converting physic...
the_stack_v2_python_sparse
lenstronomy/LensModel/Profiles/sersic.py
lenstronomy/lenstronomy
train
41
3e56e0bc6a88cfed99a3b9a024311f14daa90b10
[ "super(Group_RDB, self).__init__()\nself.InChan = InChannel\nself.OutChan = OutChannel\nself.G = growRate\nself.C = nConvLayers\nif self.InChan != self.G:\n self.InConv = nn.Conv2d(self.InChan, self.G, 1, padding=0, stride=1)\nif self.OutChan != self.G and self.OutChan != self.InChan:\n self.OutConv = nn.Conv...
<|body_start_0|> super(Group_RDB, self).__init__() self.InChan = InChannel self.OutChan = OutChannel self.G = growRate self.C = nConvLayers if self.InChan != self.G: self.InConv = nn.Conv2d(self.InChan, self.G, 1, padding=0, stride=1) if self.OutChan !...
Group residual dense block.
Group_RDB
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Group_RDB: """Group residual dense block.""" def __init__(self, InChannel, OutChannel, growRate, nConvLayers, kSize=3): """Initialize Block. :param InChannel: channel number of input :type InChannel: int :param OutChannel: channel number of output :type OutChannel: int :param growRat...
stack_v2_sparse_classes_10k_train_002762
13,650
permissive
[ { "docstring": "Initialize Block. :param InChannel: channel number of input :type InChannel: int :param OutChannel: channel number of output :type OutChannel: int :param growRate: growth rate of block :type growRate: int :param nConvLayers: the number of convlution layer :type nConvLayers: int :param kSize: ker...
2
null
Implement the Python class `Group_RDB` described below. Class description: Group residual dense block. Method signatures and docstrings: - def __init__(self, InChannel, OutChannel, growRate, nConvLayers, kSize=3): Initialize Block. :param InChannel: channel number of input :type InChannel: int :param OutChannel: chan...
Implement the Python class `Group_RDB` described below. Class description: Group residual dense block. Method signatures and docstrings: - def __init__(self, InChannel, OutChannel, growRate, nConvLayers, kSize=3): Initialize Block. :param InChannel: channel number of input :type InChannel: int :param OutChannel: chan...
df51ed9c1d6dbde1deef63f2a037a369f8554406
<|skeleton|> class Group_RDB: """Group residual dense block.""" def __init__(self, InChannel, OutChannel, growRate, nConvLayers, kSize=3): """Initialize Block. :param InChannel: channel number of input :type InChannel: int :param OutChannel: channel number of output :type OutChannel: int :param growRat...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Group_RDB: """Group residual dense block.""" def __init__(self, InChannel, OutChannel, growRate, nConvLayers, kSize=3): """Initialize Block. :param InChannel: channel number of input :type InChannel: int :param OutChannel: channel number of output :type OutChannel: int :param growRate: growth rat...
the_stack_v2_python_sparse
built-in/TensorFlow/Research/cv/image_classification/Darts_for_TensorFlow/automl/vega/search_space/networks/pytorch/esrbodys/erdb_esr.py
Huawei-Ascend/modelzoo
train
1
38f3a4f431116540174ad959300bfcbb07efd330
[ "self._source = source\nself._time_provider = time_provider\nself._storage_engine = storage_engine", "if slack_task.archived:\n return\nasync with self._storage_engine.get_unit_of_work() as uow:\n slack_task_collection = await uow.slack_task_collection_repository.load_by_id(slack_task.slack_task_collection_...
<|body_start_0|> self._source = source self._time_provider = time_provider self._storage_engine = storage_engine <|end_body_0|> <|body_start_1|> if slack_task.archived: return async with self._storage_engine.get_unit_of_work() as uow: slack_task_collectio...
Shared service for archiving a slack task.
SlackTaskArchiveService
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SlackTaskArchiveService: """Shared service for archiving a slack task.""" def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None: """Constructor.""" <|body_0|> async def do_it(self, progress_reporter: ProgressRep...
stack_v2_sparse_classes_10k_train_002763
2,869
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None" }, { "docstring": "Execute the service's action.", "name": "do_it", "signature": "async def do_it(self, prog...
2
stack_v2_sparse_classes_30k_train_003169
Implement the Python class `SlackTaskArchiveService` described below. Class description: Shared service for archiving a slack task. Method signatures and docstrings: - def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None: Constructor. - async def do_it(self...
Implement the Python class `SlackTaskArchiveService` described below. Class description: Shared service for archiving a slack task. Method signatures and docstrings: - def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None: Constructor. - async def do_it(self...
911ecd560142a9b4e57498f2b090f9469a0718a1
<|skeleton|> class SlackTaskArchiveService: """Shared service for archiving a slack task.""" def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None: """Constructor.""" <|body_0|> async def do_it(self, progress_reporter: ProgressRep...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SlackTaskArchiveService: """Shared service for archiving a slack task.""" def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None: """Constructor.""" self._source = source self._time_provider = time_provider self._s...
the_stack_v2_python_sparse
src/core/jupiter/core/domain/push_integrations/slack/service/archive_service.py
horia141/jupiter
train
16
8901fcce99cdfd94525b3892d9f5d2948c0e33ca
[ "results_per_page = min(max(results_per_page, 1), 50)\nquery = models.Event.query\nif since_id:\n after = first_or_abort(models.Event.query.filter(models.Event.id == since_id), 409)\n query = query.filter(models.Event.cursor > after.cursor)\nelif max_id:\n before = first_or_abort(models.Event.query.filter(...
<|body_start_0|> results_per_page = min(max(results_per_page, 1), 50) query = models.Event.query if since_id: after = first_or_abort(models.Event.query.filter(models.Event.id == since_id), 409) query = query.filter(models.Event.cursor > after.cursor) elif max_id: ...
Events
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Events: def get(self, results_per_page=50, event_type_slug=None, since_id=None, max_id=None): """--- description: Retrieve a collection of event types. parameters: - api_version - results_per_page - in: query name: event_type_slug type: string description: slug of event_type this event c...
stack_v2_sparse_classes_10k_train_002764
15,999
no_license
[ { "docstring": "--- description: Retrieve a collection of event types. parameters: - api_version - results_per_page - in: query name: event_type_slug type: string description: slug of event_type this event conforms to. - in: query name: since_id type: string format: uuid description: get all events since this e...
2
stack_v2_sparse_classes_30k_train_004251
Implement the Python class `Events` described below. Class description: Implement the Events class. Method signatures and docstrings: - def get(self, results_per_page=50, event_type_slug=None, since_id=None, max_id=None): --- description: Retrieve a collection of event types. parameters: - api_version - results_per_p...
Implement the Python class `Events` described below. Class description: Implement the Events class. Method signatures and docstrings: - def get(self, results_per_page=50, event_type_slug=None, since_id=None, max_id=None): --- description: Retrieve a collection of event types. parameters: - api_version - results_per_p...
dbba9f3b292ffef6ea924608fa54237171f0aaeb
<|skeleton|> class Events: def get(self, results_per_page=50, event_type_slug=None, since_id=None, max_id=None): """--- description: Retrieve a collection of event types. parameters: - api_version - results_per_page - in: query name: event_type_slug type: string description: slug of event_type this event c...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Events: def get(self, results_per_page=50, event_type_slug=None, since_id=None, max_id=None): """--- description: Retrieve a collection of event types. parameters: - api_version - results_per_page - in: query name: event_type_slug type: string description: slug of event_type this event conforms to. - ...
the_stack_v2_python_sparse
apis/event/directorofme_event/resources.py
DirectorOfMe/directorof.me
train
0
4cf4eee6ef3bc0ec8202263745620a13f0b25227
[ "input_len = len(input_ids)\nif not (input_len == len(input_mask) and input_len == len(segment_ids) and (input_len == len(labels_mask)) and (input_len == len(tag_labels)) and (input_len == len(semiotic_labels))):\n raise ValueError('All feature lists should have the same length ({})'.format(input_len))\nself.fea...
<|body_start_0|> input_len = len(input_ids) if not (input_len == len(input_mask) and input_len == len(segment_ids) and (input_len == len(labels_mask)) and (input_len == len(tag_labels)) and (input_len == len(semiotic_labels))): raise ValueError('All feature lists should have the same length ...
Class for training and inference examples for BERT. Attributes: editing_task: The EditingTask from which this example was created. Needed when realizing labels predicted for this example. features: Feature dictionary.
BertExample
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BertExample: """Class for training and inference examples for BERT. Attributes: editing_task: The EditingTask from which this example was created. Needed when realizing labels predicted for this example. features: Feature dictionary.""" def __init__(self, input_ids: List[int], input_mask: Li...
stack_v2_sparse_classes_10k_train_002765
15,095
permissive
[ { "docstring": "Inputs to the example wrapper Args: input_ids: indices of tokens which constitute batches of masked text segments input_mask: bool tensor with 0s in place of source tokens to be masked segment_ids: bool tensor with 0's and 1's to denote the text segment type tag_labels: indices of tokens which s...
3
null
Implement the Python class `BertExample` described below. Class description: Class for training and inference examples for BERT. Attributes: editing_task: The EditingTask from which this example was created. Needed when realizing labels predicted for this example. features: Feature dictionary. Method signatures and d...
Implement the Python class `BertExample` described below. Class description: Class for training and inference examples for BERT. Attributes: editing_task: The EditingTask from which this example was created. Needed when realizing labels predicted for this example. features: Feature dictionary. Method signatures and d...
c20a16ea8aa2a9d8e31a98eb22178ddb9d5935e7
<|skeleton|> class BertExample: """Class for training and inference examples for BERT. Attributes: editing_task: The EditingTask from which this example was created. Needed when realizing labels predicted for this example. features: Feature dictionary.""" def __init__(self, input_ids: List[int], input_mask: Li...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BertExample: """Class for training and inference examples for BERT. Attributes: editing_task: The EditingTask from which this example was created. Needed when realizing labels predicted for this example. features: Feature dictionary.""" def __init__(self, input_ids: List[int], input_mask: List[int], segm...
the_stack_v2_python_sparse
nemo/collections/nlp/data/text_normalization_as_tagging/bert_example.py
NVIDIA/NeMo
train
7,957
019a1bc2ec210a47c12e13b9deaba9791ba4caa3
[ "self.input_dist = [5, 25, 15, 10, 15]\nself.input_fuel = [1, 2, 1, 0, 3]\nself.mpg = 10\nself.output = 4\nreturn (self.input_dist, self.input_fuel, self.mpg, self.output)", "input_dist, input_fuel, mpg, proper_output = self.setUp()\noutput = ValidStartingCity.validStartingCity(input_dist, input_fuel, mpg)\nself....
<|body_start_0|> self.input_dist = [5, 25, 15, 10, 15] self.input_fuel = [1, 2, 1, 0, 3] self.mpg = 10 self.output = 4 return (self.input_dist, self.input_fuel, self.mpg, self.output) <|end_body_0|> <|body_start_1|> input_dist, input_fuel, mpg, proper_output = self.setUp...
Class with unittests for ValidStartingCity.py
test_ValidStartingCity
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test_ValidStartingCity: """Class with unittests for ValidStartingCity.py""" def setUp(self): """SetUp values for tests.""" <|body_0|> def test_ExpectedOutput(self): """Checks if returned output is as expected.""" <|body_1|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_10k_train_002766
1,003
no_license
[ { "docstring": "SetUp values for tests.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Checks if returned output is as expected.", "name": "test_ExpectedOutput", "signature": "def test_ExpectedOutput(self)" } ]
2
stack_v2_sparse_classes_30k_train_004790
Implement the Python class `test_ValidStartingCity` described below. Class description: Class with unittests for ValidStartingCity.py Method signatures and docstrings: - def setUp(self): SetUp values for tests. - def test_ExpectedOutput(self): Checks if returned output is as expected.
Implement the Python class `test_ValidStartingCity` described below. Class description: Class with unittests for ValidStartingCity.py Method signatures and docstrings: - def setUp(self): SetUp values for tests. - def test_ExpectedOutput(self): Checks if returned output is as expected. <|skeleton|> class test_ValidSt...
3aa62ad36c3b06b2a3b05f1f8e2a9e21d68b371f
<|skeleton|> class test_ValidStartingCity: """Class with unittests for ValidStartingCity.py""" def setUp(self): """SetUp values for tests.""" <|body_0|> def test_ExpectedOutput(self): """Checks if returned output is as expected.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class test_ValidStartingCity: """Class with unittests for ValidStartingCity.py""" def setUp(self): """SetUp values for tests.""" self.input_dist = [5, 25, 15, 10, 15] self.input_fuel = [1, 2, 1, 0, 3] self.mpg = 10 self.output = 4 return (self.input_dist, self.in...
the_stack_v2_python_sparse
AlgoExpert_algorithms/Medium/ValidStartingCity/test_ValidStartingCity.py
JakubKazimierski/PythonPortfolio
train
9
6dbefce93d59ca47e7188e8ce3229f0797609d94
[ "arcpy.AddMessage(u'\\t1. Verificando disponibilidad de licencia SPATIAL ANALYST')\nlicense = arcpy.CheckExtension('spatial')\nif license != 'Available':\n raise RuntimeError('\\tError: %s' % license)\narcpy.AddMessage(u'\\t2. Enviando informacion a la GEODATABASE')\narcpy.CheckOutExtension('spatial')\ngeoquimic...
<|body_start_0|> arcpy.AddMessage(u'\t1. Verificando disponibilidad de licencia SPATIAL ANALYST') license = arcpy.CheckExtension('spatial') if license != 'Available': raise RuntimeError('\tError: %s' % license) arcpy.AddMessage(u'\t2. Enviando informacion a la GEODATABASE') ...
Clase que contiene el procesamiento para el tratamiento de la variable geoquimica
Geoquimica
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Geoquimica: """Clase que contiene el procesamiento para el tratamiento de la variable geoquimica""" def process(self): """Enviando el raster ingresado al File Geodatabase :return:""" <|body_0|> def main(self): """Funcion principal del proceso :return:""" ...
stack_v2_sparse_classes_10k_train_002767
1,567
no_license
[ { "docstring": "Enviando el raster ingresado al File Geodatabase :return:", "name": "process", "signature": "def process(self)" }, { "docstring": "Funcion principal del proceso :return:", "name": "main", "signature": "def main(self)" } ]
2
stack_v2_sparse_classes_30k_train_000557
Implement the Python class `Geoquimica` described below. Class description: Clase que contiene el procesamiento para el tratamiento de la variable geoquimica Method signatures and docstrings: - def process(self): Enviando el raster ingresado al File Geodatabase :return: - def main(self): Funcion principal del proceso...
Implement the Python class `Geoquimica` described below. Class description: Clase que contiene el procesamiento para el tratamiento de la variable geoquimica Method signatures and docstrings: - def process(self): Enviando el raster ingresado al File Geodatabase :return: - def main(self): Funcion principal del proceso...
89bcea828bc8720fc1dcf82439b06b1f272bb096
<|skeleton|> class Geoquimica: """Clase que contiene el procesamiento para el tratamiento de la variable geoquimica""" def process(self): """Enviando el raster ingresado al File Geodatabase :return:""" <|body_0|> def main(self): """Funcion principal del proceso :return:""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Geoquimica: """Clase que contiene el procesamiento para el tratamiento de la variable geoquimica""" def process(self): """Enviando el raster ingresado al File Geodatabase :return:""" arcpy.AddMessage(u'\t1. Verificando disponibilidad de licencia SPATIAL ANALYST') license = arcpy.C...
the_stack_v2_python_sparse
Install/dev/scripts/pmmGeoquimica.py
ryali93/addinPotencialMinero
train
0
1dc25f3e8bd1e2a153e5e3147c1941088acffc95
[ "info = OrderedDict({})\ntry:\n info_editors = OrderedDict({})\n for instance in obj.editors.all():\n info_editors[instance.pk] = instance.pen_name\n info['editors'] = info_editors\nexcept Editor.DoesNotExist as e:\n info['editors'] = str(e)\ntry:\n info['domain'] = domain.DOMAIN_DICT[obj.doma...
<|body_start_0|> info = OrderedDict({}) try: info_editors = OrderedDict({}) for instance in obj.editors.all(): info_editors[instance.pk] = instance.pen_name info['editors'] = info_editors except Editor.DoesNotExist as e: info['edito...
Problem Base Serializer
ProblemBaseSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProblemBaseSerializer: """Problem Base Serializer""" def get_info_data(self, obj, *args, **kwargs): """Get Information Data :param obj: :param args: :param kwargs: :return:""" <|body_0|> def get_links_url(self, obj, *args, **kwargs): """Get links url :param obj: ...
stack_v2_sparse_classes_10k_train_002768
6,316
no_license
[ { "docstring": "Get Information Data :param obj: :param args: :param kwargs: :return:", "name": "get_info_data", "signature": "def get_info_data(self, obj, *args, **kwargs)" }, { "docstring": "Get links url :param obj: :param args: :param kwargs: :return:", "name": "get_links_url", "sign...
2
stack_v2_sparse_classes_30k_train_002625
Implement the Python class `ProblemBaseSerializer` described below. Class description: Problem Base Serializer Method signatures and docstrings: - def get_info_data(self, obj, *args, **kwargs): Get Information Data :param obj: :param args: :param kwargs: :return: - def get_links_url(self, obj, *args, **kwargs): Get l...
Implement the Python class `ProblemBaseSerializer` described below. Class description: Problem Base Serializer Method signatures and docstrings: - def get_info_data(self, obj, *args, **kwargs): Get Information Data :param obj: :param args: :param kwargs: :return: - def get_links_url(self, obj, *args, **kwargs): Get l...
acd31a2f43d7ea83fc9bb34627f5dca94763eade
<|skeleton|> class ProblemBaseSerializer: """Problem Base Serializer""" def get_info_data(self, obj, *args, **kwargs): """Get Information Data :param obj: :param args: :param kwargs: :return:""" <|body_0|> def get_links_url(self, obj, *args, **kwargs): """Get links url :param obj: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProblemBaseSerializer: """Problem Base Serializer""" def get_info_data(self, obj, *args, **kwargs): """Get Information Data :param obj: :param args: :param kwargs: :return:""" info = OrderedDict({}) try: info_editors = OrderedDict({}) for instance in obj.ed...
the_stack_v2_python_sparse
problem/serializers.py
JoenyBui/mywaterbuffalo
train
0
0f9c22d0619771241895bda5077b516105d52d89
[ "self.x = x\nself.M = np.shape(x)[0]\nself.N = np.shape(x)[1]", "X = np.zeros([self.M, self.N], dtype=np.complex)\nfor m in range(self.M):\n for n in range(self.N):\n for i in range(self.M):\n for j in range(self.N):\n X[m, n] = X[m, n] + self.x[i, j] / np.sqrt(self.M * self.N)...
<|body_start_0|> self.x = x self.M = np.shape(x)[0] self.N = np.shape(x)[1] <|end_body_0|> <|body_start_1|> X = np.zeros([self.M, self.N], dtype=np.complex) for m in range(self.M): for n in range(self.N): for i in range(self.M): fo...
2-D DFT
DFT_2D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DFT_2D: """2-D DFT""" def __init__(self, x): """input time-domain signal x""" <|body_0|> def solve(self): """\\\\\\ METHOD: Compute DFT of x""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.x = x self.M = np.shape(x)[0] self....
stack_v2_sparse_classes_10k_train_002769
4,947
no_license
[ { "docstring": "input time-domain signal x", "name": "__init__", "signature": "def __init__(self, x)" }, { "docstring": "\\\\\\\\\\\\ METHOD: Compute DFT of x", "name": "solve", "signature": "def solve(self)" } ]
2
stack_v2_sparse_classes_30k_train_006030
Implement the Python class `DFT_2D` described below. Class description: 2-D DFT Method signatures and docstrings: - def __init__(self, x): input time-domain signal x - def solve(self): \\\\\\ METHOD: Compute DFT of x
Implement the Python class `DFT_2D` described below. Class description: 2-D DFT Method signatures and docstrings: - def __init__(self, x): input time-domain signal x - def solve(self): \\\\\\ METHOD: Compute DFT of x <|skeleton|> class DFT_2D: """2-D DFT""" def __init__(self, x): """input time-domai...
b72322cfc6d81c996117cea2160ee312da62d3ed
<|skeleton|> class DFT_2D: """2-D DFT""" def __init__(self, x): """input time-domain signal x""" <|body_0|> def solve(self): """\\\\\\ METHOD: Compute DFT of x""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DFT_2D: """2-D DFT""" def __init__(self, x): """input time-domain signal x""" self.x = x self.M = np.shape(x)[0] self.N = np.shape(x)[1] def solve(self): """\\\\\\ METHOD: Compute DFT of x""" X = np.zeros([self.M, self.N], dtype=np.complex) for...
the_stack_v2_python_sparse
2D Signal Processing and Image De-noising/discrete_signal.py
FG-14/Signals-and-Information-Processing-DSP-
train
0
3f83768c5a7eedde914eed225b6aca5165f1d72b
[ "slide = openslide.OpenSlide(wsi_name)\ndimensions = slide.dimensions\nlevels = slide.level_count\nlevel = levels - 1\ndownsample = slide.level_downsamples[level]\nprint(level, downsample)\nthumbnail_rgb = cv2.cvtColor(np.asarray(slide.read_region((0, 0), level, slide.level_dimensions[level]).convert('RGB')), cv2.C...
<|body_start_0|> slide = openslide.OpenSlide(wsi_name) dimensions = slide.dimensions levels = slide.level_count level = levels - 1 downsample = slide.level_downsamples[level] print(level, downsample) thumbnail_rgb = cv2.cvtColor(np.asarray(slide.read_region((0, 0)...
WSIROI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WSIROI: def __init__(self, wsi_name): """get a circle roi of wsi file, it should encampus almost all the cells area :param wsi_name: wsi full file name :return dimensions: slide width,height in level 0 :return center: center x,y of roi circle :return radius: radius of roi circle""" ...
stack_v2_sparse_classes_10k_train_002770
5,710
no_license
[ { "docstring": "get a circle roi of wsi file, it should encampus almost all the cells area :param wsi_name: wsi full file name :return dimensions: slide width,height in level 0 :return center: center x,y of roi circle :return radius: radius of roi circle", "name": "__init__", "signature": "def __init__(...
2
stack_v2_sparse_classes_30k_train_006138
Implement the Python class `WSIROI` described below. Class description: Implement the WSIROI class. Method signatures and docstrings: - def __init__(self, wsi_name): get a circle roi of wsi file, it should encampus almost all the cells area :param wsi_name: wsi full file name :return dimensions: slide width,height in...
Implement the Python class `WSIROI` described below. Class description: Implement the WSIROI class. Method signatures and docstrings: - def __init__(self, wsi_name): get a circle roi of wsi file, it should encampus almost all the cells area :param wsi_name: wsi full file name :return dimensions: slide width,height in...
d77cec4438364deab94c37b45bdfde3e0b03b879
<|skeleton|> class WSIROI: def __init__(self, wsi_name): """get a circle roi of wsi file, it should encampus almost all the cells area :param wsi_name: wsi full file name :return dimensions: slide width,height in level 0 :return center: center x,y of roi circle :return radius: radius of roi circle""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WSIROI: def __init__(self, wsi_name): """get a circle roi of wsi file, it should encampus almost all the cells area :param wsi_name: wsi full file name :return dimensions: slide width,height in level 0 :return center: center x,y of roi circle :return radius: radius of roi circle""" slide = ope...
the_stack_v2_python_sparse
train_c1/roi_extract/WSI_ROI.py
liyu10000/tct
train
15
8ef19b4e017591febff6a92fa907b75b0377db43
[ "l = len(nums)\nif l <= 1:\n return 0\na = str(max(nums))\nk = len(a)\n\ndef radixSort(A, k):\n for k in range(k):\n s = [[] for i in range(10)]\n for i in A:\n s[i // 10 ** k % 10].append(i)\n A = [a for b in s for a in b]\n print(A)\n return A\nnums = radixSort(nums, k)...
<|body_start_0|> l = len(nums) if l <= 1: return 0 a = str(max(nums)) k = len(a) def radixSort(A, k): for k in range(k): s = [[] for i in range(10)] for i in A: s[i // 10 ** k % 10].append(i) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maximumGap(self, nums): """:type nums: List[int] :rtype: int 66ms""" <|body_0|> def maximumGap_1(self, nums): """:type nums: List[int] :rtype: int 49ms""" <|body_1|> <|end_skeleton|> <|body_start_0|> l = len(nums) if l <= 1: ...
stack_v2_sparse_classes_10k_train_002771
1,855
no_license
[ { "docstring": ":type nums: List[int] :rtype: int 66ms", "name": "maximumGap", "signature": "def maximumGap(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int 49ms", "name": "maximumGap_1", "signature": "def maximumGap_1(self, nums)" } ]
2
stack_v2_sparse_classes_30k_test_000346
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maximumGap(self, nums): :type nums: List[int] :rtype: int 66ms - def maximumGap_1(self, nums): :type nums: List[int] :rtype: int 49ms
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maximumGap(self, nums): :type nums: List[int] :rtype: int 66ms - def maximumGap_1(self, nums): :type nums: List[int] :rtype: int 49ms <|skeleton|> class Solution: def m...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def maximumGap(self, nums): """:type nums: List[int] :rtype: int 66ms""" <|body_0|> def maximumGap_1(self, nums): """:type nums: List[int] :rtype: int 49ms""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maximumGap(self, nums): """:type nums: List[int] :rtype: int 66ms""" l = len(nums) if l <= 1: return 0 a = str(max(nums)) k = len(a) def radixSort(A, k): for k in range(k): s = [[] for i in range(10)] ...
the_stack_v2_python_sparse
MaximumGap_HARD_164.py
953250587/leetcode-python
train
2
fefe4314a7e38bd4b026125831965d044fe2c171
[ "self.list = nums\nself.dic = {}\nself.k = len(nums)\nfor i, n in enumerate(self.list):\n self.dic[i] = n", "for i in range(self.k):\n self.list[i] = self.dic[i]\nreturn self.list", "index = list(range(self.k))\nrandom.shuffle(index)\nfor i, j in enumerate(index):\n self.list[i] = self.dic[j]\nreturn s...
<|body_start_0|> self.list = nums self.dic = {} self.k = len(nums) for i, n in enumerate(self.list): self.dic[i] = n <|end_body_0|> <|body_start_1|> for i in range(self.k): self.list[i] = self.dic[i] return self.list <|end_body_1|> <|body_start_2...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def reset(self): """Resets the array to its original configuration and return it. :rtype: List[int]""" <|body_1|> def shuffle(self): """Returns a random shuffling of the a...
stack_v2_sparse_classes_10k_train_002772
954
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": "Resets the array to its original configuration and return it. :rtype: List[int]", "name": "reset", "signature": "def reset(self)" }, { "docstring": "Returns a ra...
3
stack_v2_sparse_classes_30k_train_004659
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def reset(self): Resets the array to its original configuration and return it. :rtype: List[int] - def shuffle(self): Returns a ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def reset(self): Resets the array to its original configuration and return it. :rtype: List[int] - def shuffle(self): Returns a ...
2f46f85e1e297b0a50fdb66956b1d05622a4063d
<|skeleton|> class Solution: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def reset(self): """Resets the array to its original configuration and return it. :rtype: List[int]""" <|body_1|> def shuffle(self): """Returns a random shuffling of the a...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, nums): """:type nums: List[int]""" self.list = nums self.dic = {} self.k = len(nums) for i, n in enumerate(self.list): self.dic[i] = n def reset(self): """Resets the array to its original configuration and return it....
the_stack_v2_python_sparse
dan/Problems/Medium/Array/384. Shuffle an Array/solution.py
xudaaaaan/Leetcode
train
0
0f375f0f5bc5ff81b28b2302bee2d5b5a5954aac
[ "def preOrder(node):\n if not node:\n return ['None']\n return [str(node.val)] + preOrder(node.left) + preOrder(node.right)\nreturn ' '.join(preOrder(root))", "def preOrder(it):\n v = next(it)\n if v == 'None':\n return None\n node = TreeNode(int(v))\n node.left = preOrder(it)\n ...
<|body_start_0|> def preOrder(node): if not node: return ['None'] return [str(node.val)] + preOrder(node.left) + preOrder(node.right) return ' '.join(preOrder(root)) <|end_body_0|> <|body_start_1|> def preOrder(it): v = next(it) if...
Codec3
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec3: 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_002773
4,842
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_005730
Implement the Python class `Codec3` described below. Class description: Implement the Codec3 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 :rtyp...
Implement the Python class `Codec3` described below. Class description: Implement the Codec3 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 :rtyp...
63120dbaabd7c3c19633ebe952bcee4cf826b0e0
<|skeleton|> class Codec3: 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 Codec3: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def preOrder(node): if not node: return ['None'] return [str(node.val)] + preOrder(node.left) + preOrder(node.right) return ' '.join(preO...
the_stack_v2_python_sparse
297. Serialize and Deserialize Binary Tree _ tee.py
CaizhiXu/LeetCode-Python-Solutions
train
0
cdda8a14090380a17b41430e97cd910c05171aed
[ "self.kv = {keys[i]: values[i] for i in range(len(keys))}\nself.vk = defaultdict(list)\nfor i in range(len(keys)):\n vk[values[i]].append(keys[i])\nself.d = Trie()\nfor word in dictionary:\n self.d.insert(word)", "res = []\nfor ch in word1:\n res.append(self.kv[ch])\nreturn ''.join(res)", "res = []\nfo...
<|body_start_0|> self.kv = {keys[i]: values[i] for i in range(len(keys))} self.vk = defaultdict(list) for i in range(len(keys)): vk[values[i]].append(keys[i]) self.d = Trie() for word in dictionary: self.d.insert(word) <|end_body_0|> <|body_start_1|> ...
Encrypter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encrypter: def __init__(self, keys, values, dictionary): """:type keys: List[str] :type values: List[str] :type dictionary: List[str]""" <|body_0|> def encrypt(self, word1): """:type word1: str :rtype: str""" <|body_1|> def decrypt(self, word2): ...
stack_v2_sparse_classes_10k_train_002774
2,665
no_license
[ { "docstring": ":type keys: List[str] :type values: List[str] :type dictionary: List[str]", "name": "__init__", "signature": "def __init__(self, keys, values, dictionary)" }, { "docstring": ":type word1: str :rtype: str", "name": "encrypt", "signature": "def encrypt(self, word1)" }, ...
3
null
Implement the Python class `Encrypter` described below. Class description: Implement the Encrypter class. Method signatures and docstrings: - def __init__(self, keys, values, dictionary): :type keys: List[str] :type values: List[str] :type dictionary: List[str] - def encrypt(self, word1): :type word1: str :rtype: str...
Implement the Python class `Encrypter` described below. Class description: Implement the Encrypter class. Method signatures and docstrings: - def __init__(self, keys, values, dictionary): :type keys: List[str] :type values: List[str] :type dictionary: List[str] - def encrypt(self, word1): :type word1: str :rtype: str...
ee59b82125f100970c842d5e1245287c484d6649
<|skeleton|> class Encrypter: def __init__(self, keys, values, dictionary): """:type keys: List[str] :type values: List[str] :type dictionary: List[str]""" <|body_0|> def encrypt(self, word1): """:type word1: str :rtype: str""" <|body_1|> def decrypt(self, word2): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Encrypter: def __init__(self, keys, values, dictionary): """:type keys: List[str] :type values: List[str] :type dictionary: List[str]""" self.kv = {keys[i]: values[i] for i in range(len(keys))} self.vk = defaultdict(list) for i in range(len(keys)): vk[values[i]].app...
the_stack_v2_python_sparse
_CodeTopics/LeetCode_contest/weekly/weekly2022/287/unfinished--287_4.py
BIAOXYZ/variousCodes
train
0
d205a0585ccfdbb1075d2b33e40a4b0bbbd1cd71
[ "super().__init__()\nself.decoder = nn.Sequential(nn.Conv2d(512, 512, kernel_size=1), nn.ReLU(inplace=True), nn.Dropout(0.8), nn.Conv2d(512, 512, kernel_size=1), nn.ReLU(inplace=True))\nself.layer = nn.ConvTranspose2d(1280, num_classes, kernel_size=2, stride=2, dilation=1)", "pool_3, pool_4 = pools\nx = self.deco...
<|body_start_0|> super().__init__() self.decoder = nn.Sequential(nn.Conv2d(512, 512, kernel_size=1), nn.ReLU(inplace=True), nn.Dropout(0.8), nn.Conv2d(512, 512, kernel_size=1), nn.ReLU(inplace=True)) self.layer = nn.ConvTranspose2d(1280, num_classes, kernel_size=2, stride=2, dilation=1) <|end_bo...
Column Decoder.
ColumnDecoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ColumnDecoder: """Column Decoder.""" def __init__(self, num_classes: int): """Initialize Column Decoder. Args: num_classes (int): Number of classes per point.""" <|body_0|> def forward(self, x, pools): """Forward pass. Args: x (tensor): Batch of images to perform...
stack_v2_sparse_classes_10k_train_002775
5,468
no_license
[ { "docstring": "Initialize Column Decoder. Args: num_classes (int): Number of classes per point.", "name": "__init__", "signature": "def __init__(self, num_classes: int)" }, { "docstring": "Forward pass. Args: x (tensor): Batch of images to perform forward-pass. pools (Tuple[tensor, tensor]): Th...
2
null
Implement the Python class `ColumnDecoder` described below. Class description: Column Decoder. Method signatures and docstrings: - def __init__(self, num_classes: int): Initialize Column Decoder. Args: num_classes (int): Number of classes per point. - def forward(self, x, pools): Forward pass. Args: x (tensor): Batch...
Implement the Python class `ColumnDecoder` described below. Class description: Column Decoder. Method signatures and docstrings: - def __init__(self, num_classes: int): Initialize Column Decoder. Args: num_classes (int): Number of classes per point. - def forward(self, x, pools): Forward pass. Args: x (tensor): Batch...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class ColumnDecoder: """Column Decoder.""" def __init__(self, num_classes: int): """Initialize Column Decoder. Args: num_classes (int): Number of classes per point.""" <|body_0|> def forward(self, x, pools): """Forward pass. Args: x (tensor): Batch of images to perform...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ColumnDecoder: """Column Decoder.""" def __init__(self, num_classes: int): """Initialize Column Decoder. Args: num_classes (int): Number of classes per point.""" super().__init__() self.decoder = nn.Sequential(nn.Conv2d(512, 512, kernel_size=1), nn.ReLU(inplace=True), nn.Dropout(0...
the_stack_v2_python_sparse
generated/test_tomassosorio_OCR_tablenet.py
jansel/pytorch-jit-paritybench
train
35
44159b0a3772fe353e137cb16998a13b41e49740
[ "super(ScatterConnection, self).__init__()\nself.scatter_type = scatter_type\nassert self.scatter_type in ['cover', 'add']", "device = x.device\nB, M, N = x.shape\nH, W = spatial_size\nindex = location.view(-1, 2)\nbias = torch.arange(B).mul_(H * W).unsqueeze(1).repeat(1, M).view(-1).to(device)\nindex = index[:, ...
<|body_start_0|> super(ScatterConnection, self).__init__() self.scatter_type = scatter_type assert self.scatter_type in ['cover', 'add'] <|end_body_0|> <|body_start_1|> device = x.device B, M, N = x.shape H, W = spatial_size index = location.view(-1, 2) b...
Overview: Scatter feature to its corresponding location In AlphaStar, each entity is embedded into a tensor, and these tensors are scattered into a feature map with map size.
ScatterConnection
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScatterConnection: """Overview: Scatter feature to its corresponding location In AlphaStar, each entity is embedded into a tensor, and these tensors are scattered into a feature map with map size.""" def __init__(self, scatter_type: str) -> None: """Overview: Init class Arguments: - ...
stack_v2_sparse_classes_10k_train_002776
3,626
permissive
[ { "docstring": "Overview: Init class Arguments: - scatter_type (:obj:`str`): Supports ['add', 'cover']. If two entities have the same location, \\\\ scatter_type decides the first one should be covered or added to second one", "name": "__init__", "signature": "def __init__(self, scatter_type: str) -> No...
2
null
Implement the Python class `ScatterConnection` described below. Class description: Overview: Scatter feature to its corresponding location In AlphaStar, each entity is embedded into a tensor, and these tensors are scattered into a feature map with map size. Method signatures and docstrings: - def __init__(self, scatt...
Implement the Python class `ScatterConnection` described below. Class description: Overview: Scatter feature to its corresponding location In AlphaStar, each entity is embedded into a tensor, and these tensors are scattered into a feature map with map size. Method signatures and docstrings: - def __init__(self, scatt...
eb483fa6e46602d58c8e7d2ca1e566adca28e703
<|skeleton|> class ScatterConnection: """Overview: Scatter feature to its corresponding location In AlphaStar, each entity is embedded into a tensor, and these tensors are scattered into a feature map with map size.""" def __init__(self, scatter_type: str) -> None: """Overview: Init class Arguments: - ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ScatterConnection: """Overview: Scatter feature to its corresponding location In AlphaStar, each entity is embedded into a tensor, and these tensors are scattered into a feature map with map size.""" def __init__(self, scatter_type: str) -> None: """Overview: Init class Arguments: - scatter_type ...
the_stack_v2_python_sparse
ding/torch_utils/network/scatter_connection.py
shengxuesun/DI-engine
train
1
b73ffda33853681d59c795061ab508641444e095
[ "if len(s) == 0:\n self.answer = True\ncur_string = ''\nfor i in range(min(max_len, len(s))):\n cur_string += s[i]\n if cur_string in words:\n self.is_word_break(s[i + 1:], words, max_len)", "if len(wordDict) == 0:\n return False\nself.answer = False\nmax_len = len(max(wordDict, key=len))\nself...
<|body_start_0|> if len(s) == 0: self.answer = True cur_string = '' for i in range(min(max_len, len(s))): cur_string += s[i] if cur_string in words: self.is_word_break(s[i + 1:], words, max_len) <|end_body_0|> <|body_start_1|> if len(w...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def is_word_break(self, s, words, max_len): """s: string words: set with words""" <|body_0|> def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(s)...
stack_v2_sparse_classes_10k_train_002777
1,243
no_license
[ { "docstring": "s: string words: set with words", "name": "is_word_break", "signature": "def is_word_break(self, s, words, max_len)" }, { "docstring": ":type s: str :type wordDict: List[str] :rtype: bool", "name": "wordBreak", "signature": "def wordBreak(self, s, wordDict)" } ]
2
stack_v2_sparse_classes_30k_train_005777
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def is_word_break(self, s, words, max_len): s: string words: set with words - def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def is_word_break(self, s, words, max_len): s: string words: set with words - def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool <|skeleton|> ...
98f02403996e62d358d7ca589902698346ac91ec
<|skeleton|> class Solution: def is_word_break(self, s, words, max_len): """s: string words: set with words""" <|body_0|> def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def is_word_break(self, s, words, max_len): """s: string words: set with words""" if len(s) == 0: self.answer = True cur_string = '' for i in range(min(max_len, len(s))): cur_string += s[i] if cur_string in words: se...
the_stack_v2_python_sparse
onsite_solutions/139_word_break.py
owoshch/LeetCode
train
1
22d0c183a8fd94a53b7c172bb6955cc73a7b9aa1
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('jkmoy_mfflynn', 'jkmoy_mfflynn')\nurl = 'http://gis.cityofboston.gov/arcgis/rest/services/PublicSafety/OpenData/MapServer/2/query?where=1%3D1&outFields=*&outSR=4326&f=json'\nresponse = urllib.request.url...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('jkmoy_mfflynn', 'jkmoy_mfflynn') url = 'http://gis.cityofboston.gov/arcgis/rest/services/PublicSafety/OpenData/MapServer/2/query?where=1%3D1&outFields=*&o...
fire_departments
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class fire_departments: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everyth...
stack_v2_sparse_classes_10k_train_002778
3,941
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
null
Implement the Python class `fire_departments` described below. Class description: Implement the fire_departments class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=N...
Implement the Python class `fire_departments` described below. Class description: Implement the fire_departments class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=N...
90284cf3debbac36eead07b8d2339cdd191b86cf
<|skeleton|> class fire_departments: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everyth...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class fire_departments: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('jkmoy_mfflynn', 'jkmoy_mfflynn') ...
the_stack_v2_python_sparse
jkmoy_mfflynn/fire_departments.py
maximega/course-2019-spr-proj
train
2
1d80b38b793fdd2f0e6cc0ed08f9d1c0bdd385a0
[ "self.comparer_title = ComparerTitle()\nself.comparer_desciption = ComparerDescription()\nself.comparer_text = ComparerText()\nself.comparer_author = ComparerAuthor()\nself.comparer_date = ComparerDate()", "result = ArticleCandidate()\nresult.title = self.comparer_title.extract(item, article_candidates)\nresult.d...
<|body_start_0|> self.comparer_title = ComparerTitle() self.comparer_desciption = ComparerDescription() self.comparer_text = ComparerText() self.comparer_author = ComparerAuthor() self.comparer_date = ComparerDate() <|end_body_0|> <|body_start_1|> result = ArticleCandida...
Sends the list of ArticleCandidates to the subcomparer and saves the result in Article.
Comparer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Comparer: """Sends the list of ArticleCandidates to the subcomparer and saves the result in Article.""" def __init__(self): """Initializes the Comparer classes with an object each.""" <|body_0|> def compare(self, item, article_candidates): """Compares the article...
stack_v2_sparse_classes_10k_train_002779
1,833
no_license
[ { "docstring": "Initializes the Comparer classes with an object each.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Compares the article candidates using the different submodules and saves the best results in new ArticleCandidate object :param item: The NewscrawlerIt...
2
stack_v2_sparse_classes_30k_train_007164
Implement the Python class `Comparer` described below. Class description: Sends the list of ArticleCandidates to the subcomparer and saves the result in Article. Method signatures and docstrings: - def __init__(self): Initializes the Comparer classes with an object each. - def compare(self, item, article_candidates):...
Implement the Python class `Comparer` described below. Class description: Sends the list of ArticleCandidates to the subcomparer and saves the result in Article. Method signatures and docstrings: - def __init__(self): Initializes the Comparer classes with an object each. - def compare(self, item, article_candidates):...
733a48b20fbe45fe86f656d6a40afdc41be2c223
<|skeleton|> class Comparer: """Sends the list of ArticleCandidates to the subcomparer and saves the result in Article.""" def __init__(self): """Initializes the Comparer classes with an object each.""" <|body_0|> def compare(self, item, article_candidates): """Compares the article...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Comparer: """Sends the list of ArticleCandidates to the subcomparer and saves the result in Article.""" def __init__(self): """Initializes the Comparer classes with an object each.""" self.comparer_title = ComparerTitle() self.comparer_desciption = ComparerDescription() se...
the_stack_v2_python_sparse
archive_crawling (as on Neo)/pipeline/extractor/comparer/comparer.py
Anacoder1/archive_crawling
train
0
fce2acde174d06ee3dd4886fd72a3d7152b13e55
[ "max_area = 0\nn = len(height)\nh_prev = 0\nfor i in range(0, n - 1):\n hi = height[i]\n if hi <= h_prev:\n continue\n for j in range(i + 1, n):\n hj = height[j]\n h = min(hi, hj)\n area = (j - i) * h\n if area > max_area:\n max_area = area\n h_prev ...
<|body_start_0|> max_area = 0 n = len(height) h_prev = 0 for i in range(0, n - 1): hi = height[i] if hi <= h_prev: continue for j in range(i + 1, n): hj = height[j] h = min(hi, hj) area = ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxArea_v1(self, height: List[int]) -> int: """A simple solution.""" <|body_0|> def maxArea_v2(self, height: List[int]) -> int: """Use two pointers. Move the one with shorter height.""" <|body_1|> <|end_skeleton|> <|body_start_0|> max_...
stack_v2_sparse_classes_10k_train_002780
2,035
no_license
[ { "docstring": "A simple solution.", "name": "maxArea_v1", "signature": "def maxArea_v1(self, height: List[int]) -> int" }, { "docstring": "Use two pointers. Move the one with shorter height.", "name": "maxArea_v2", "signature": "def maxArea_v2(self, height: List[int]) -> int" } ]
2
stack_v2_sparse_classes_30k_train_001723
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea_v1(self, height: List[int]) -> int: A simple solution. - def maxArea_v2(self, height: List[int]) -> int: Use two pointers. Move the one with shorter height.
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea_v1(self, height: List[int]) -> int: A simple solution. - def maxArea_v2(self, height: List[int]) -> int: Use two pointers. Move the one with shorter height. <|skelet...
97a2386f5e3adbd7138fd123810c3232bdf7f622
<|skeleton|> class Solution: def maxArea_v1(self, height: List[int]) -> int: """A simple solution.""" <|body_0|> def maxArea_v2(self, height: List[int]) -> int: """Use two pointers. Move the one with shorter height.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxArea_v1(self, height: List[int]) -> int: """A simple solution.""" max_area = 0 n = len(height) h_prev = 0 for i in range(0, n - 1): hi = height[i] if hi <= h_prev: continue for j in range(i + 1, n): ...
the_stack_v2_python_sparse
python3/string_array/container_with_most_water.py
victorchu/algorithms
train
0
d0622ec9a9fb891ae2c9a0a875e3f0e5666725ed
[ "super().__init__()\nself.cfg = cfg\nself.task_queue = task_queue\nself.result_queue = result_queue\nself.gpu_id = gpu_id\nself.device = torch.device('cuda:{}'.format(self.gpu_id)) if self.cfg.NUM_GPUS else 'cpu'", "model = Predictor(self.cfg, gpu_id=self.gpu_id)\nwhile True:\n task = self.task_queue.get()\n ...
<|body_start_0|> super().__init__() self.cfg = cfg self.task_queue = task_queue self.result_queue = result_queue self.gpu_id = gpu_id self.device = torch.device('cuda:{}'.format(self.gpu_id)) if self.cfg.NUM_GPUS else 'cpu' <|end_body_0|> <|body_start_1|> model =...
_Predictor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Predictor: def __init__(self, cfg, task_queue, result_queue, gpu_id=None): """Predict Worker for Detectron2. Args: cfg (CfgNode): configs. Details can be found in slowfast/config/defaults.py task_queue (mp.Queue): a shared queue for incoming task. result_queue (mp.Queue): a shared queue...
stack_v2_sparse_classes_10k_train_002781
9,808
permissive
[ { "docstring": "Predict Worker for Detectron2. Args: cfg (CfgNode): configs. Details can be found in slowfast/config/defaults.py task_queue (mp.Queue): a shared queue for incoming task. result_queue (mp.Queue): a shared queue for predicted results. gpu_id (int): index of the GPU device for the current child pro...
2
stack_v2_sparse_classes_30k_train_001441
Implement the Python class `_Predictor` described below. Class description: Implement the _Predictor class. Method signatures and docstrings: - def __init__(self, cfg, task_queue, result_queue, gpu_id=None): Predict Worker for Detectron2. Args: cfg (CfgNode): configs. Details can be found in slowfast/config/defaults....
Implement the Python class `_Predictor` described below. Class description: Implement the _Predictor class. Method signatures and docstrings: - def __init__(self, cfg, task_queue, result_queue, gpu_id=None): Predict Worker for Detectron2. Args: cfg (CfgNode): configs. Details can be found in slowfast/config/defaults....
6092dad7be32bb1d6b71fe1bade258dc8b492fe3
<|skeleton|> class _Predictor: def __init__(self, cfg, task_queue, result_queue, gpu_id=None): """Predict Worker for Detectron2. Args: cfg (CfgNode): configs. Details can be found in slowfast/config/defaults.py task_queue (mp.Queue): a shared queue for incoming task. result_queue (mp.Queue): a shared queue...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _Predictor: def __init__(self, cfg, task_queue, result_queue, gpu_id=None): """Predict Worker for Detectron2. Args: cfg (CfgNode): configs. Details can be found in slowfast/config/defaults.py task_queue (mp.Queue): a shared queue for incoming task. result_queue (mp.Queue): a shared queue for predicted...
the_stack_v2_python_sparse
slowfast/visualization/async_predictor.py
facebookresearch/SlowFast
train
6,221
6851f6320b96f8defc30e40b99b7cb387ac6c84f
[ "self.places = {}\nself.transitions = {}\nself.successful_firings = []\nself.a = {}", "pn_copy = PetriNetModel()\nfor place in petri_net_model.places.values():\n pn_copy.add_place(place.tokens, place.place_id, place.label)\nfor t in petri_net_model.transitions.values():\n input_place_ids = [arc.place.place_...
<|body_start_0|> self.places = {} self.transitions = {} self.successful_firings = [] self.a = {} <|end_body_0|> <|body_start_1|> pn_copy = PetriNetModel() for place in petri_net_model.places.values(): pn_copy.add_place(place.tokens, place.place_id, place.labe...
PetriNetModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PetriNetModel: def __init__(self): """Initialize an empty Petri net.""" <|body_0|> def make_copy_of(petri_net_model): """Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance of PetriNetModel to be copied""" <|body_1|> def add_pl...
stack_v2_sparse_classes_10k_train_002782
27,136
no_license
[ { "docstring": "Initialize an empty Petri net.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance of PetriNetModel to be copied", "name": "make_copy_of", "signature": "def make_copy_of(...
5
stack_v2_sparse_classes_30k_train_003333
Implement the Python class `PetriNetModel` described below. Class description: Implement the PetriNetModel class. Method signatures and docstrings: - def __init__(self): Initialize an empty Petri net. - def make_copy_of(petri_net_model): Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance o...
Implement the Python class `PetriNetModel` described below. Class description: Implement the PetriNetModel class. Method signatures and docstrings: - def __init__(self): Initialize an empty Petri net. - def make_copy_of(petri_net_model): Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance o...
8e9a3a8151069757475808c48511c9d7486ea334
<|skeleton|> class PetriNetModel: def __init__(self): """Initialize an empty Petri net.""" <|body_0|> def make_copy_of(petri_net_model): """Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance of PetriNetModel to be copied""" <|body_1|> def add_pl...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PetriNetModel: def __init__(self): """Initialize an empty Petri net.""" self.places = {} self.transitions = {} self.successful_firings = [] self.a = {} def make_copy_of(petri_net_model): """Makes a deep copy of a PetriNetModel instance. Args: petri_net_mode...
the_stack_v2_python_sparse
Stochasticity-Net/Stochastic_PN_Architecture_v2.py
PN-Alzheimers-Parkinsons/PN_Alzheimers_Parkinsons
train
0
728950db8566de00e1ed17390c14d5bdabba0c12
[ "super(CAServerCert, self).__init__(None, config.kubeconfig, verbose)\nself.config = config\nself.verbose = verbose", "cert = self.config.config_options['cert']['value']\nif cert and os.path.exists(cert):\n return open(cert).read()\nreturn None", "if self.config.config_options['backup']['value']:\n import...
<|body_start_0|> super(CAServerCert, self).__init__(None, config.kubeconfig, verbose) self.config = config self.verbose = verbose <|end_body_0|> <|body_start_1|> cert = self.config.config_options['cert']['value'] if cert and os.path.exists(cert): return open(cert).re...
Class to wrap the oc adm ca create-server-cert command line
CAServerCert
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CAServerCert: """Class to wrap the oc adm ca create-server-cert command line""" def __init__(self, config, verbose=False): """Constructor for oadm ca""" <|body_0|> def get(self): """get the current cert file If a file exists by the same name in the specified loca...
stack_v2_sparse_classes_10k_train_002783
6,137
permissive
[ { "docstring": "Constructor for oadm ca", "name": "__init__", "signature": "def __init__(self, config, verbose=False)" }, { "docstring": "get the current cert file If a file exists by the same name in the specified location then the cert exists", "name": "get", "signature": "def get(self...
5
null
Implement the Python class `CAServerCert` described below. Class description: Class to wrap the oc adm ca create-server-cert command line Method signatures and docstrings: - def __init__(self, config, verbose=False): Constructor for oadm ca - def get(self): get the current cert file If a file exists by the same name ...
Implement the Python class `CAServerCert` described below. Class description: Class to wrap the oc adm ca create-server-cert command line Method signatures and docstrings: - def __init__(self, config, verbose=False): Constructor for oadm ca - def get(self): get the current cert file If a file exists by the same name ...
e342f6659a4ef1a188ff403e2fc6b06ac6d119c7
<|skeleton|> class CAServerCert: """Class to wrap the oc adm ca create-server-cert command line""" def __init__(self, config, verbose=False): """Constructor for oadm ca""" <|body_0|> def get(self): """get the current cert file If a file exists by the same name in the specified loca...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CAServerCert: """Class to wrap the oc adm ca create-server-cert command line""" def __init__(self, config, verbose=False): """Constructor for oadm ca""" super(CAServerCert, self).__init__(None, config.kubeconfig, verbose) self.config = config self.verbose = verbose de...
the_stack_v2_python_sparse
openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/src/class/oc_adm_ca_server_cert.py
openshift/openshift-tools
train
170
51f6da55b44ef8565b8294046b1a8ac99c0f79ab
[ "lifecycle_arg = self.args[0]\nurl_args = self.args[1:]\nif not UrlsAreForSingleProvider(url_args):\n raise CommandException('\"%s\" command spanning providers not allowed.' % self.command_name)\nlifecycle_file = open(lifecycle_arg, 'r')\nlifecycle_txt = lifecycle_file.read()\nlifecycle_file.close()\nsome_matche...
<|body_start_0|> lifecycle_arg = self.args[0] url_args = self.args[1:] if not UrlsAreForSingleProvider(url_args): raise CommandException('"%s" command spanning providers not allowed.' % self.command_name) lifecycle_file = open(lifecycle_arg, 'r') lifecycle_txt = lifec...
Implementation of gsutil lifecycle command.
LifecycleCommand
[ "BSD-3-Clause", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LifecycleCommand: """Implementation of gsutil lifecycle command.""" def _SetLifecycleConfig(self): """Sets lifecycle configuration for a Google Cloud Storage bucket.""" <|body_0|> def _GetLifecycleConfig(self): """Gets lifecycle configuration for a Google Cloud S...
stack_v2_sparse_classes_10k_train_002784
7,415
permissive
[ { "docstring": "Sets lifecycle configuration for a Google Cloud Storage bucket.", "name": "_SetLifecycleConfig", "signature": "def _SetLifecycleConfig(self)" }, { "docstring": "Gets lifecycle configuration for a Google Cloud Storage bucket.", "name": "_GetLifecycleConfig", "signature": "...
3
null
Implement the Python class `LifecycleCommand` described below. Class description: Implementation of gsutil lifecycle command. Method signatures and docstrings: - def _SetLifecycleConfig(self): Sets lifecycle configuration for a Google Cloud Storage bucket. - def _GetLifecycleConfig(self): Gets lifecycle configuration...
Implement the Python class `LifecycleCommand` described below. Class description: Implementation of gsutil lifecycle command. Method signatures and docstrings: - def _SetLifecycleConfig(self): Sets lifecycle configuration for a Google Cloud Storage bucket. - def _GetLifecycleConfig(self): Gets lifecycle configuration...
53102de187a48ac2cfc241fef54dcbc29c453a8e
<|skeleton|> class LifecycleCommand: """Implementation of gsutil lifecycle command.""" def _SetLifecycleConfig(self): """Sets lifecycle configuration for a Google Cloud Storage bucket.""" <|body_0|> def _GetLifecycleConfig(self): """Gets lifecycle configuration for a Google Cloud S...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LifecycleCommand: """Implementation of gsutil lifecycle command.""" def _SetLifecycleConfig(self): """Sets lifecycle configuration for a Google Cloud Storage bucket.""" lifecycle_arg = self.args[0] url_args = self.args[1:] if not UrlsAreForSingleProvider(url_args): ...
the_stack_v2_python_sparse
third_party/gsutil/gslib/commands/lifecycle.py
catapult-project/catapult
train
2,032
d675ffb926b6f8f2fb131440c062b5fa10eee2f4
[ "super().__init__()\nfull_list = [input_dim] + list(hidden_dims) + [z_dim]\nself.encoder = MLP(dim_list=full_list)\nfull_list.reverse()\nself.decoder = MLP(dim_list=full_list)\nself.noise = noise", "z = self.encoder(x)\nif self.noise > 0:\n z_decoder = z + self.noise * torch.randn_like(z)\nelse:\n z_decoder...
<|body_start_0|> super().__init__() full_list = [input_dim] + list(hidden_dims) + [z_dim] self.encoder = MLP(dim_list=full_list) full_list.reverse() self.decoder = MLP(dim_list=full_list) self.noise = noise <|end_body_0|> <|body_start_1|> z = self.encoder(x) ...
Vanilla Autoencoder torch module
AutoencoderModule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutoencoderModule: """Vanilla Autoencoder torch module""" def __init__(self, input_dim, hidden_dims, z_dim, noise=0): """Init. Args: input_dim(int): Dimension of the input data. hidden_dims(List[int]): List of hidden dimensions. Do not include dimensions of the input layer and the bo...
stack_v2_sparse_classes_10k_train_002785
10,936
no_license
[ { "docstring": "Init. Args: input_dim(int): Dimension of the input data. hidden_dims(List[int]): List of hidden dimensions. Do not include dimensions of the input layer and the bottleneck. See MLP for example. z_dim(int): Bottleneck dimension. noise(float): Variance of the gaussian noise applied to the latent s...
2
stack_v2_sparse_classes_30k_train_007008
Implement the Python class `AutoencoderModule` described below. Class description: Vanilla Autoencoder torch module Method signatures and docstrings: - def __init__(self, input_dim, hidden_dims, z_dim, noise=0): Init. Args: input_dim(int): Dimension of the input data. hidden_dims(List[int]): List of hidden dimensions...
Implement the Python class `AutoencoderModule` described below. Class description: Vanilla Autoencoder torch module Method signatures and docstrings: - def __init__(self, input_dim, hidden_dims, z_dim, noise=0): Init. Args: input_dim(int): Dimension of the input data. hidden_dims(List[int]): List of hidden dimensions...
9027b529eaa4cf0a38f25512141810f92db99639
<|skeleton|> class AutoencoderModule: """Vanilla Autoencoder torch module""" def __init__(self, input_dim, hidden_dims, z_dim, noise=0): """Init. Args: input_dim(int): Dimension of the input data. hidden_dims(List[int]): List of hidden dimensions. Do not include dimensions of the input layer and the bo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AutoencoderModule: """Vanilla Autoencoder torch module""" def __init__(self, input_dim, hidden_dims, z_dim, noise=0): """Init. Args: input_dim(int): Dimension of the input data. hidden_dims(List[int]): List of hidden dimensions. Do not include dimensions of the input layer and the bottleneck. See...
the_stack_v2_python_sparse
grae/models/torch_modules.py
jakerhodes/GRAE
train
0
5a9f8dd7fbfc5d15af38965d539cddb9db9eec21
[ "name = input('请输入增加的课程名称:')\nif name in Data.courses_dict:\n print('课程已存在,请使用其他课程名称')\n return self.add_course()\nteacher = input('请输入授课老师:')\nlimit = input('请输入人数:')\ntimes = input('请输入课程时长:')\nscore = input('请输入分数:')\ndes = input('请输入课程描述:')\ncourse = Course(name, teacher, limit, times, score, des)\ncourse...
<|body_start_0|> name = input('请输入增加的课程名称:') if name in Data.courses_dict: print('课程已存在,请使用其他课程名称') return self.add_course() teacher = input('请输入授课老师:') limit = input('请输入人数:') times = input('请输入课程时长:') score = input('请输入分数:') des = input('...
管理员类
Admin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Admin: """管理员类""" def add_course(self): """添加课程""" <|body_0|> def check_course(self): """查看课程""" <|body_1|> def update_course(self): """修改课程""" <|body_2|> def delete_course(self): """删除课程""" <|body_3|> <|end_skel...
stack_v2_sparse_classes_10k_train_002786
4,039
no_license
[ { "docstring": "添加课程", "name": "add_course", "signature": "def add_course(self)" }, { "docstring": "查看课程", "name": "check_course", "signature": "def check_course(self)" }, { "docstring": "修改课程", "name": "update_course", "signature": "def update_course(self)" }, { ...
4
stack_v2_sparse_classes_30k_train_000411
Implement the Python class `Admin` described below. Class description: 管理员类 Method signatures and docstrings: - def add_course(self): 添加课程 - def check_course(self): 查看课程 - def update_course(self): 修改课程 - def delete_course(self): 删除课程
Implement the Python class `Admin` described below. Class description: 管理员类 Method signatures and docstrings: - def add_course(self): 添加课程 - def check_course(self): 查看课程 - def update_course(self): 修改课程 - def delete_course(self): 删除课程 <|skeleton|> class Admin: """管理员类""" def add_course(self): """添加课程...
e11f5fcb10f37a0f0663e4c746ca862b076f9aee
<|skeleton|> class Admin: """管理员类""" def add_course(self): """添加课程""" <|body_0|> def check_course(self): """查看课程""" <|body_1|> def update_course(self): """修改课程""" <|body_2|> def delete_course(self): """删除课程""" <|body_3|> <|end_skel...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Admin: """管理员类""" def add_course(self): """添加课程""" name = input('请输入增加的课程名称:') if name in Data.courses_dict: print('课程已存在,请使用其他课程名称') return self.add_course() teacher = input('请输入授课老师:') limit = input('请输入人数:') times = input('请输入课程时长...
the_stack_v2_python_sparse
dmeo/day12/code/demo_01homework.py
liujiang9/python0421
train
1
471d2f791f86f996fa061967d95ecb388b1d6f8f
[ "self.algorithm = algorithm\nself.mode = mode\nself.data_key_length = data_key_length\nself.iv_length = iv_length\nself.auth_length = self.tag_len = auth_length\nself.auth_key_length = auth_key_length", "if kdf.input_length is None:\n return True\nif self.data_key_length > kdf.input_length(self):\n raise In...
<|body_start_0|> self.algorithm = algorithm self.mode = mode self.data_key_length = data_key_length self.iv_length = iv_length self.auth_length = self.tag_len = auth_length self.auth_key_length = auth_key_length <|end_body_0|> <|body_start_1|> if kdf.input_length...
Static definition of encryption algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: Encryption algorithm to use :type algorithm: cryptography.io ciphers algorithm object :param mode: Encryption mode in which to operate :type mode: cryptography.io ciphers modes...
EncryptionSuite
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncryptionSuite: """Static definition of encryption algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: Encryption algorithm to use :type algorithm: cryptography.io ciphers algorithm object :param mode: Encryption mode in which to operat...
stack_v2_sparse_classes_10k_train_002787
14,661
permissive
[ { "docstring": "Prepare a new EncryptionSuite.", "name": "__init__", "signature": "def __init__(self, algorithm, mode, data_key_length, iv_length, auth_length, auth_key_length=0)" }, { "docstring": "Determine whether a KDFSuite can be used with this EncryptionSuite. :param kdf: KDFSuite to evalu...
2
stack_v2_sparse_classes_30k_train_006913
Implement the Python class `EncryptionSuite` described below. Class description: Static definition of encryption algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: Encryption algorithm to use :type algorithm: cryptography.io ciphers algorithm object :param m...
Implement the Python class `EncryptionSuite` described below. Class description: Static definition of encryption algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: Encryption algorithm to use :type algorithm: cryptography.io ciphers algorithm object :param m...
3ba8019681ed95c41bb9448f0c3897d1aecc7559
<|skeleton|> class EncryptionSuite: """Static definition of encryption algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: Encryption algorithm to use :type algorithm: cryptography.io ciphers algorithm object :param mode: Encryption mode in which to operat...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EncryptionSuite: """Static definition of encryption algorithm details. .. warning:: These members must only be used as part of an AlgorithmSuite. :param algorithm: Encryption algorithm to use :type algorithm: cryptography.io ciphers algorithm object :param mode: Encryption mode in which to operate :type mode:...
the_stack_v2_python_sparse
src/aws_encryption_sdk/identifiers.py
aws/aws-encryption-sdk-python
train
137
ba47d5cff5803b1ab354517493b6c1d14210dc85
[ "self._cache_whitelist = set(benchmark_setup['cache_whitelist'])\nself._original_requests = set(cache_validation_result['effective_encoded_data_lengths'].keys())\nself._original_post_requests = set(cache_validation_result['effective_post_requests'])\nself._original_cached_requests = self._original_requests.intersec...
<|body_start_0|> self._cache_whitelist = set(benchmark_setup['cache_whitelist']) self._original_requests = set(cache_validation_result['effective_encoded_data_lengths'].keys()) self._original_post_requests = set(cache_validation_result['effective_post_requests']) self._original_cached_re...
Object to verify benchmark run from traces and WPR log stored in the runner output directory.
_RunOutputVerifier
[ "BSD-3-Clause", "LGPL-2.0-or-later", "LicenseRef-scancode-unknown-license-reference", "GPL-2.0-only", "Apache-2.0", "LicenseRef-scancode-unknown", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _RunOutputVerifier: """Object to verify benchmark run from traces and WPR log stored in the runner output directory.""" def __init__(self, cache_validation_result, benchmark_setup): """Constructor. Args: cache_validation_result: JSON of the cache validation task. benchmark_setup: JSO...
stack_v2_sparse_classes_10k_train_002788
28,927
permissive
[ { "docstring": "Constructor. Args: cache_validation_result: JSON of the cache validation task. benchmark_setup: JSON of the benchmark setup.", "name": "__init__", "signature": "def __init__(self, cache_validation_result, benchmark_setup)" }, { "docstring": "Verifies a trace with the cache valida...
3
stack_v2_sparse_classes_30k_train_006206
Implement the Python class `_RunOutputVerifier` described below. Class description: Object to verify benchmark run from traces and WPR log stored in the runner output directory. Method signatures and docstrings: - def __init__(self, cache_validation_result, benchmark_setup): Constructor. Args: cache_validation_result...
Implement the Python class `_RunOutputVerifier` described below. Class description: Object to verify benchmark run from traces and WPR log stored in the runner output directory. Method signatures and docstrings: - def __init__(self, cache_validation_result, benchmark_setup): Constructor. Args: cache_validation_result...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class _RunOutputVerifier: """Object to verify benchmark run from traces and WPR log stored in the runner output directory.""" def __init__(self, cache_validation_result, benchmark_setup): """Constructor. Args: cache_validation_result: JSON of the cache validation task. benchmark_setup: JSO...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _RunOutputVerifier: """Object to verify benchmark run from traces and WPR log stored in the runner output directory.""" def __init__(self, cache_validation_result, benchmark_setup): """Constructor. Args: cache_validation_result: JSON of the cache validation task. benchmark_setup: JSON of the benc...
the_stack_v2_python_sparse
tools/android/loading/sandwich_prefetch.py
metux/chromium-suckless
train
5
d249acb48540e89f3c55617851d80935a2de8fb3
[ "def backTrack(n, res, tmp, flag, row):\n if row == n:\n z = []\n for t in tmp:\n z.append(''.join(t))\n res.append(z)\n else:\n for col in range(n):\n if flag[row] and flag[n + col] and flag[2 * n + row + col] and flag[5 * n - 2 + col - row]:\n ...
<|body_start_0|> def backTrack(n, res, tmp, flag, row): if row == n: z = [] for t in tmp: z.append(''.join(t)) res.append(z) else: for col in range(n): if flag[row] and flag[n + col] a...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def totalNQueens(self, n): """:type n: int :rtype: int""" <|body_0|> def totalNQueens0(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> def backTrack(n, res, tmp, flag, row): if row == n: ...
stack_v2_sparse_classes_10k_train_002789
2,109
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "totalNQueens", "signature": "def totalNQueens(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "totalNQueens0", "signature": "def totalNQueens0(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_001691
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def totalNQueens(self, n): :type n: int :rtype: int - def totalNQueens0(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def totalNQueens(self, n): :type n: int :rtype: int - def totalNQueens0(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def totalNQueens(self, n): "...
9e49b2c6003b957276737005d4aaac276b44d251
<|skeleton|> class Solution: def totalNQueens(self, n): """:type n: int :rtype: int""" <|body_0|> def totalNQueens0(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def totalNQueens(self, n): """:type n: int :rtype: int""" def backTrack(n, res, tmp, flag, row): if row == n: z = [] for t in tmp: z.append(''.join(t)) res.append(z) else: for ...
the_stack_v2_python_sparse
PythonCode/src/0052_N-Queens_II.py
oneyuan/CodeforFun
train
0
e8757510f01e318dba95862d835874c69e97286d
[ "low, high = (0, len(height) - 1)\nret = 0\nwhile low < high:\n ret = max(min(height[low], height[high]) * (high - low), ret)\n if height[low] <= height[high]:\n low += 1\n else:\n high -= 1\nreturn ret", "i = 0\nj = len(height) - 1\nmax_value = 0\ntop = max(height)\nwhile i < j:\n if to...
<|body_start_0|> low, high = (0, len(height) - 1) ret = 0 while low < high: ret = max(min(height[low], height[high]) * (high - low), ret) if height[low] <= height[high]: low += 1 else: high -= 1 return ret <|end_body_0|>...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxArea(self, height: List[int]) -> int: """Updated at 2022/01/04 Runtime: 1491 ms, faster than 5.01% Memory Usage: 27.6 MB, less than 22.34% n == height.length 2 <= n <= 10^5 0 <= height[i] <= 10^4 :param height: :return:""" <|body_0|> def maxArea2(self, heigh...
stack_v2_sparse_classes_10k_train_002790
1,839
permissive
[ { "docstring": "Updated at 2022/01/04 Runtime: 1491 ms, faster than 5.01% Memory Usage: 27.6 MB, less than 22.34% n == height.length 2 <= n <= 10^5 0 <= height[i] <= 10^4 :param height: :return:", "name": "maxArea", "signature": "def maxArea(self, height: List[int]) -> int" }, { "docstring": "Up...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea(self, height: List[int]) -> int: Updated at 2022/01/04 Runtime: 1491 ms, faster than 5.01% Memory Usage: 27.6 MB, less than 22.34% n == height.length 2 <= n <= 10^5 0...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea(self, height: List[int]) -> int: Updated at 2022/01/04 Runtime: 1491 ms, faster than 5.01% Memory Usage: 27.6 MB, less than 22.34% n == height.length 2 <= n <= 10^5 0...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def maxArea(self, height: List[int]) -> int: """Updated at 2022/01/04 Runtime: 1491 ms, faster than 5.01% Memory Usage: 27.6 MB, less than 22.34% n == height.length 2 <= n <= 10^5 0 <= height[i] <= 10^4 :param height: :return:""" <|body_0|> def maxArea2(self, heigh...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxArea(self, height: List[int]) -> int: """Updated at 2022/01/04 Runtime: 1491 ms, faster than 5.01% Memory Usage: 27.6 MB, less than 22.34% n == height.length 2 <= n <= 10^5 0 <= height[i] <= 10^4 :param height: :return:""" low, high = (0, len(height) - 1) ret = 0 ...
the_stack_v2_python_sparse
src/11-ContainerWithMostWater.py
Jiezhi/myleetcode
train
1
24c3fa2ed01e9e9a7a05aaf3eb9d54c95726ba31
[ "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!')" ]
<|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...
Proto file describing the keyword plan ad group keyword service. Service to manage Keyword Plan ad group keywords. KeywordPlanAdGroup is required to add ad group keywords. Positive and negative keywords are supported. A maximum of 10,000 positive keywords are allowed per keyword plan. A maximum of 1,000 negative keywor...
KeywordPlanAdGroupKeywordServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeywordPlanAdGroupKeywordServiceServicer: """Proto file describing the keyword plan ad group keyword service. Service to manage Keyword Plan ad group keywords. KeywordPlanAdGroup is required to add ad group keywords. Positive and negative keywords are supported. A maximum of 10,000 positive keywo...
stack_v2_sparse_classes_10k_train_002791
7,403
permissive
[ { "docstring": "Returns the requested Keyword Plan ad group keyword in full detail.", "name": "GetKeywordPlanAdGroupKeyword", "signature": "def GetKeywordPlanAdGroupKeyword(self, request, context)" }, { "docstring": "Creates, updates, or removes Keyword Plan ad group keywords. Operation statuses...
2
stack_v2_sparse_classes_30k_train_004575
Implement the Python class `KeywordPlanAdGroupKeywordServiceServicer` described below. Class description: Proto file describing the keyword plan ad group keyword service. Service to manage Keyword Plan ad group keywords. KeywordPlanAdGroup is required to add ad group keywords. Positive and negative keywords are suppor...
Implement the Python class `KeywordPlanAdGroupKeywordServiceServicer` described below. Class description: Proto file describing the keyword plan ad group keyword service. Service to manage Keyword Plan ad group keywords. KeywordPlanAdGroup is required to add ad group keywords. Positive and negative keywords are suppor...
969eff5b6c3cec59d21191fa178cffb6270074c3
<|skeleton|> class KeywordPlanAdGroupKeywordServiceServicer: """Proto file describing the keyword plan ad group keyword service. Service to manage Keyword Plan ad group keywords. KeywordPlanAdGroup is required to add ad group keywords. Positive and negative keywords are supported. A maximum of 10,000 positive keywo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class KeywordPlanAdGroupKeywordServiceServicer: """Proto file describing the keyword plan ad group keyword service. Service to manage Keyword Plan ad group keywords. KeywordPlanAdGroup is required to add ad group keywords. Positive and negative keywords are supported. A maximum of 10,000 positive keywords are allow...
the_stack_v2_python_sparse
google/ads/google_ads/v6/proto/services/keyword_plan_ad_group_keyword_service_pb2_grpc.py
VincentFritzsche/google-ads-python
train
0
b7125ee4085eaa9bb16722583bf045bf9c6f40b6
[ "from django.conf.urls import patterns, url\nurls = super(RecurrenceRuleAdmin, self).get_urls()\nmy_urls = patterns('', url('^preview/$', self.admin_site.admin_view(self.preview), name='icekit_events_recurrencerule_preview'))\nreturn my_urls + urls", "recurrence_rule = request.POST.get('recurrence_rule')\nlimit =...
<|body_start_0|> from django.conf.urls import patterns, url urls = super(RecurrenceRuleAdmin, self).get_urls() my_urls = patterns('', url('^preview/$', self.admin_site.admin_view(self.preview), name='icekit_events_recurrencerule_preview')) return my_urls + urls <|end_body_0|> <|body_sta...
RecurrenceRuleAdmin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecurrenceRuleAdmin: def get_urls(self): """Add a preview URL.""" <|body_0|> def preview(self, request): """Return a occurrences in JSON format up until the configured limit.""" <|body_1|> <|end_skeleton|> <|body_start_0|> from django.conf.urls impo...
stack_v2_sparse_classes_10k_train_002792
14,586
permissive
[ { "docstring": "Add a preview URL.", "name": "get_urls", "signature": "def get_urls(self)" }, { "docstring": "Return a occurrences in JSON format up until the configured limit.", "name": "preview", "signature": "def preview(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_003793
Implement the Python class `RecurrenceRuleAdmin` described below. Class description: Implement the RecurrenceRuleAdmin class. Method signatures and docstrings: - def get_urls(self): Add a preview URL. - def preview(self, request): Return a occurrences in JSON format up until the configured limit.
Implement the Python class `RecurrenceRuleAdmin` described below. Class description: Implement the RecurrenceRuleAdmin class. Method signatures and docstrings: - def get_urls(self): Add a preview URL. - def preview(self, request): Return a occurrences in JSON format up until the configured limit. <|skeleton|> class ...
c507ea5b1864303732c53ad7c5800571fca5fa94
<|skeleton|> class RecurrenceRuleAdmin: def get_urls(self): """Add a preview URL.""" <|body_0|> def preview(self, request): """Return a occurrences in JSON format up until the configured limit.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RecurrenceRuleAdmin: def get_urls(self): """Add a preview URL.""" from django.conf.urls import patterns, url urls = super(RecurrenceRuleAdmin, self).get_urls() my_urls = patterns('', url('^preview/$', self.admin_site.admin_view(self.preview), name='icekit_events_recurrencerule_...
the_stack_v2_python_sparse
icekit_events/admin.py
ic-labs/django-icekit
train
53
c4ccf1752680a47b6be2c06ac2209b125daa556e
[ "s1 = list(map(int, version1.split('.')))\ns2 = list(map(int, version2.split('.')))\nif len(s1) > len(s2):\n s2.extend([0] * (len(s1) - len(s2)))\nelif len(s1) < len(s2):\n s1.extend([0] * (len(s2) - len(s1)))\nif s1 > s2:\n return 1\nelif s1 < s2:\n return -1\nelse:\n return 0", "s1 = list(map(int...
<|body_start_0|> s1 = list(map(int, version1.split('.'))) s2 = list(map(int, version2.split('.'))) if len(s1) > len(s2): s2.extend([0] * (len(s1) - len(s2))) elif len(s1) < len(s2): s1.extend([0] * (len(s2) - len(s1))) if s1 > s2: return 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def compareVersion(self, version1, version2): """:type version1: str :type version2: str :rtype: int""" <|body_0|> def compareVersion_1(self, version1, version2): """:type version1: str :type version2: str :rtype: int""" <|body_1|> <|end_skeleton|>...
stack_v2_sparse_classes_10k_train_002793
3,635
no_license
[ { "docstring": ":type version1: str :type version2: str :rtype: int", "name": "compareVersion", "signature": "def compareVersion(self, version1, version2)" }, { "docstring": ":type version1: str :type version2: str :rtype: int", "name": "compareVersion_1", "signature": "def compareVersio...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def compareVersion(self, version1, version2): :type version1: str :type version2: str :rtype: int - def compareVersion_1(self, version1, version2): :type version1: str :type vers...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def compareVersion(self, version1, version2): :type version1: str :type version2: str :rtype: int - def compareVersion_1(self, version1, version2): :type version1: str :type vers...
3d9e0ad2f6ed92ec969556f75d97c51ea4854719
<|skeleton|> class Solution: def compareVersion(self, version1, version2): """:type version1: str :type version2: str :rtype: int""" <|body_0|> def compareVersion_1(self, version1, version2): """:type version1: str :type version2: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def compareVersion(self, version1, version2): """:type version1: str :type version2: str :rtype: int""" s1 = list(map(int, version1.split('.'))) s2 = list(map(int, version2.split('.'))) if len(s1) > len(s2): s2.extend([0] * (len(s1) - len(s2))) eli...
the_stack_v2_python_sparse
Solutions/0165_compareVersion.py
YoupengLi/leetcode-sorting
train
3
fbe664acda29fa4f09813d4a03f0baa3fb8597d1
[ "if 'event_uuid' in self.kwargs:\n self.event_proposal = get_object_or_404(models.EventProposal, uuid=self.kwargs['event_uuid'], user=request.user)\nelif 'speaker_uuid' in self.kwargs:\n self.speaker_proposal = get_object_or_404(models.SpeakerProposal, uuid=self.kwargs['speaker_uuid'], user=request.user)\nels...
<|body_start_0|> if 'event_uuid' in self.kwargs: self.event_proposal = get_object_or_404(models.EventProposal, uuid=self.kwargs['event_uuid'], user=request.user) elif 'speaker_uuid' in self.kwargs: self.speaker_proposal = get_object_or_404(models.SpeakerProposal, uuid=self.kwargs...
Mixin with code shared between all the Url views
UrlViewMixin
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UrlViewMixin: """Mixin with code shared between all the Url views""" def dispatch(self, request, *args, **kwargs): """Check that we have a valid SpeakerProposal or EventProposal and that it belongs to the current user""" <|body_0|> def get_context_data(self, **kwargs): ...
stack_v2_sparse_classes_10k_train_002794
7,691
permissive
[ { "docstring": "Check that we have a valid SpeakerProposal or EventProposal and that it belongs to the current user", "name": "dispatch", "signature": "def dispatch(self, request, *args, **kwargs)" }, { "docstring": "Include the proposal in the template context", "name": "get_context_data", ...
3
stack_v2_sparse_classes_30k_train_006518
Implement the Python class `UrlViewMixin` described below. Class description: Mixin with code shared between all the Url views Method signatures and docstrings: - def dispatch(self, request, *args, **kwargs): Check that we have a valid SpeakerProposal or EventProposal and that it belongs to the current user - def get...
Implement the Python class `UrlViewMixin` described below. Class description: Mixin with code shared between all the Url views Method signatures and docstrings: - def dispatch(self, request, *args, **kwargs): Check that we have a valid SpeakerProposal or EventProposal and that it belongs to the current user - def get...
767deb7f58429e9162e0c2ef79be9f0f38f37ce1
<|skeleton|> class UrlViewMixin: """Mixin with code shared between all the Url views""" def dispatch(self, request, *args, **kwargs): """Check that we have a valid SpeakerProposal or EventProposal and that it belongs to the current user""" <|body_0|> def get_context_data(self, **kwargs): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UrlViewMixin: """Mixin with code shared between all the Url views""" def dispatch(self, request, *args, **kwargs): """Check that we have a valid SpeakerProposal or EventProposal and that it belongs to the current user""" if 'event_uuid' in self.kwargs: self.event_proposal = ge...
the_stack_v2_python_sparse
src/program/mixins.py
bornhack/bornhack-website
train
9
46aa752faeaf6715f7310e1134068c8bb0897a25
[ "super(LSTM, self).__init__()\nself.input_dim = input_dim\nself.hidden_dim = hidden_dim\nself.num_layers = num_layers\nself.learning_rate = learning_rate\nself.num_epochs = num_epochs\nself.lstm = nn.LSTM(self.input_dim, self.hidden_dim, self.num_layers, batch_first=True)\nself.linear = nn.Linear(self.hidden_dim, o...
<|body_start_0|> super(LSTM, self).__init__() self.input_dim = input_dim self.hidden_dim = hidden_dim self.num_layers = num_layers self.learning_rate = learning_rate self.num_epochs = num_epochs self.lstm = nn.LSTM(self.input_dim, self.hidden_dim, self.num_layers,...
Class for LSTM
LSTM
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LSTM: """Class for LSTM""" def __init__(self, input_dim, output_dim=1, hidden_dim=10, num_layers=2, learning_rate=0.001, num_epochs=100): """Initilize LSTM model Args: input_dim: int -- dimension of expected features in input X output_dim: int -- dimension of the output feature, for ...
stack_v2_sparse_classes_10k_train_002795
3,540
no_license
[ { "docstring": "Initilize LSTM model Args: input_dim: int -- dimension of expected features in input X output_dim: int -- dimension of the output feature, for regrssion problem, the output_dim = 1 hidden_dim: int -- number of hidden units for LSTM num_layers: int -- number of stacked recurrent layers. num_epoch...
4
stack_v2_sparse_classes_30k_train_001664
Implement the Python class `LSTM` described below. Class description: Class for LSTM Method signatures and docstrings: - def __init__(self, input_dim, output_dim=1, hidden_dim=10, num_layers=2, learning_rate=0.001, num_epochs=100): Initilize LSTM model Args: input_dim: int -- dimension of expected features in input X...
Implement the Python class `LSTM` described below. Class description: Class for LSTM Method signatures and docstrings: - def __init__(self, input_dim, output_dim=1, hidden_dim=10, num_layers=2, learning_rate=0.001, num_epochs=100): Initilize LSTM model Args: input_dim: int -- dimension of expected features in input X...
d7e651024b07587b46497183d90934561a4839e2
<|skeleton|> class LSTM: """Class for LSTM""" def __init__(self, input_dim, output_dim=1, hidden_dim=10, num_layers=2, learning_rate=0.001, num_epochs=100): """Initilize LSTM model Args: input_dim: int -- dimension of expected features in input X output_dim: int -- dimension of the output feature, for ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LSTM: """Class for LSTM""" def __init__(self, input_dim, output_dim=1, hidden_dim=10, num_layers=2, learning_rate=0.001, num_epochs=100): """Initilize LSTM model Args: input_dim: int -- dimension of expected features in input X output_dim: int -- dimension of the output feature, for regrssion pro...
the_stack_v2_python_sparse
model/recnet.py
SSF-climate/SSF
train
7
269fe995e823f8a01f6c561d2b476b449a47f3e6
[ "if ip_version not in (u'ip4', u'ip6'):\n raise ValueError(u'IP version is not in correct format')\ncmd = u'adl_allowlist_enable_disable'\nerr_msg = f\"Failed to add ADL allowlist on interface {interface} on host {node[u'host']}\"\nargs = dict(sw_if_index=Topology.get_interface_sw_index(node, interface), fib_id=...
<|body_start_0|> if ip_version not in (u'ip4', u'ip6'): raise ValueError(u'IP version is not in correct format') cmd = u'adl_allowlist_enable_disable' err_msg = f"Failed to add ADL allowlist on interface {interface} on host {node[u'host']}" args = dict(sw_if_index=Topology.ge...
ADL utilities.
Adl
[ "GPL-1.0-or-later", "CC-BY-4.0", "Apache-2.0", "LicenseRef-scancode-dco-1.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Adl: """ADL utilities.""" def adl_add_allowlist_entry(node, interface, ip_version, fib_id, default_adl=0): """Add adl allowlisted entry. :param node: Node to add ADL allowlist on. :param interface: Interface of the node where the ADL is added. :param ip_version: IP version. 'ip4' and...
stack_v2_sparse_classes_10k_train_002796
3,282
permissive
[ { "docstring": "Add adl allowlisted entry. :param node: Node to add ADL allowlist on. :param interface: Interface of the node where the ADL is added. :param ip_version: IP version. 'ip4' and 'ip6' are valid values. :param fib_id: Specify the fib table ID. :param default_adl: 1 => enable non-ip4, non-ip6 filtrat...
2
stack_v2_sparse_classes_30k_train_002893
Implement the Python class `Adl` described below. Class description: ADL utilities. Method signatures and docstrings: - def adl_add_allowlist_entry(node, interface, ip_version, fib_id, default_adl=0): Add adl allowlisted entry. :param node: Node to add ADL allowlist on. :param interface: Interface of the node where t...
Implement the Python class `Adl` described below. Class description: ADL utilities. Method signatures and docstrings: - def adl_add_allowlist_entry(node, interface, ip_version, fib_id, default_adl=0): Add adl allowlisted entry. :param node: Node to add ADL allowlist on. :param interface: Interface of the node where t...
947057d7310cd1602119258c6b82fbb25fe1b79d
<|skeleton|> class Adl: """ADL utilities.""" def adl_add_allowlist_entry(node, interface, ip_version, fib_id, default_adl=0): """Add adl allowlisted entry. :param node: Node to add ADL allowlist on. :param interface: Interface of the node where the ADL is added. :param ip_version: IP version. 'ip4' and...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Adl: """ADL utilities.""" def adl_add_allowlist_entry(node, interface, ip_version, fib_id, default_adl=0): """Add adl allowlisted entry. :param node: Node to add ADL allowlist on. :param interface: Interface of the node where the ADL is added. :param ip_version: IP version. 'ip4' and 'ip6' are va...
the_stack_v2_python_sparse
resources/libraries/python/Adl.py
FDio/csit
train
28
f4bc479ce6564f62a032c892a5f4afbfa832db78
[ "self.host = host\nself.header = header\nself.postSite = requests.session()\nself.rf = ManageConfig().getConfig('pds')", "try:\n if r.status_code == 302 and self.rf['pds'] in r.headers['location']:\n header = json.loads(self.header)\n header['cookie'] = self.rf['pdscookie']\n self.postSite...
<|body_start_0|> self.host = host self.header = header self.postSite = requests.session() self.rf = ManageConfig().getConfig('pds') <|end_body_0|> <|body_start_1|> try: if r.status_code == 302 and self.rf['pds'] in r.headers['location']: header = json...
发送请求类
sendRequest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class sendRequest: """发送请求类""" def __init__(self, host, header): """请求数据初始化 @host:请求的地址前缀 @header:请求头信息""" <|body_0|> def hooks(self, r, *args, **kwargs): """为解决302跨域跳转到pds时,不传cookie实现的钩子方法,人为指定cookie并去请求302跳转连接 :param r: 原始请求的响应信息 :param args: :param kwargs: :return: ...
stack_v2_sparse_classes_10k_train_002797
2,867
no_license
[ { "docstring": "请求数据初始化 @host:请求的地址前缀 @header:请求头信息", "name": "__init__", "signature": "def __init__(self, host, header)" }, { "docstring": "为解决302跨域跳转到pds时,不传cookie实现的钩子方法,人为指定cookie并去请求302跳转连接 :param r: 原始请求的响应信息 :param args: :param kwargs: :return: and \"Set-Cookie\" in r.headers.keys()", ...
3
stack_v2_sparse_classes_30k_train_005516
Implement the Python class `sendRequest` described below. Class description: 发送请求类 Method signatures and docstrings: - def __init__(self, host, header): 请求数据初始化 @host:请求的地址前缀 @header:请求头信息 - def hooks(self, r, *args, **kwargs): 为解决302跨域跳转到pds时,不传cookie实现的钩子方法,人为指定cookie并去请求302跳转连接 :param r: 原始请求的响应信息 :param args: :pa...
Implement the Python class `sendRequest` described below. Class description: 发送请求类 Method signatures and docstrings: - def __init__(self, host, header): 请求数据初始化 @host:请求的地址前缀 @header:请求头信息 - def hooks(self, r, *args, **kwargs): 为解决302跨域跳转到pds时,不传cookie实现的钩子方法,人为指定cookie并去请求302跳转连接 :param r: 原始请求的响应信息 :param args: :pa...
c3af12063eea585afbfb97d1ef933a41f110c919
<|skeleton|> class sendRequest: """发送请求类""" def __init__(self, host, header): """请求数据初始化 @host:请求的地址前缀 @header:请求头信息""" <|body_0|> def hooks(self, r, *args, **kwargs): """为解决302跨域跳转到pds时,不传cookie实现的钩子方法,人为指定cookie并去请求302跳转连接 :param r: 原始请求的响应信息 :param args: :param kwargs: :return: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class sendRequest: """发送请求类""" def __init__(self, host, header): """请求数据初始化 @host:请求的地址前缀 @header:请求头信息""" self.host = host self.header = header self.postSite = requests.session() self.rf = ManageConfig().getConfig('pds') def hooks(self, r, *args, **kwargs): ...
the_stack_v2_python_sparse
Webservice/BaseAutomationTestFramework_HB/util/HttpMethod.py
Simonluepang/Upgrading-is-the-happiest-thing
train
1
6925179f89cbc157740e9df21a43e6a9d4bc5539
[ "allure.dynamic.title('Testing invite_more_women function (positive)')\nallure.dynamic.severity(allure.severity_level.NORMAL)\nallure.dynamic.description_html('<h3>Codewars badge:</h3><img src=\"https://www.codewars.com/users/myFirstCode/badges/large\"><h3>Test Description:</h3><p></p>')\nwith allure.step('Enter te...
<|body_start_0|> allure.dynamic.title('Testing invite_more_women function (positive)') allure.dynamic.severity(allure.severity_level.NORMAL) allure.dynamic.description_html('<h3>Codewars badge:</h3><img src="https://www.codewars.com/users/myFirstCode/badges/large"><h3>Test Description:</h3><p></...
Simple Fun #152: Invite More Women? Testing invite_more_women function
InviteMoreWomenTestCase
[ "Unlicense", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InviteMoreWomenTestCase: """Simple Fun #152: Invite More Women? Testing invite_more_women function""" def test_invite_more_women_positive(self): """Simple Fun #152: Invite More Women? Testing invite_more_women function (positive) :return:""" <|body_0|> def test_invite_mo...
stack_v2_sparse_classes_10k_train_002798
2,818
permissive
[ { "docstring": "Simple Fun #152: Invite More Women? Testing invite_more_women function (positive) :return:", "name": "test_invite_more_women_positive", "signature": "def test_invite_more_women_positive(self)" }, { "docstring": "Simple Fun #152: Invite More Women? Testing invite_more_women functi...
2
null
Implement the Python class `InviteMoreWomenTestCase` described below. Class description: Simple Fun #152: Invite More Women? Testing invite_more_women function Method signatures and docstrings: - def test_invite_more_women_positive(self): Simple Fun #152: Invite More Women? Testing invite_more_women function (positiv...
Implement the Python class `InviteMoreWomenTestCase` described below. Class description: Simple Fun #152: Invite More Women? Testing invite_more_women function Method signatures and docstrings: - def test_invite_more_women_positive(self): Simple Fun #152: Invite More Women? Testing invite_more_women function (positiv...
ba3ea81125b6082d867f0ae34c6c9be15e153966
<|skeleton|> class InviteMoreWomenTestCase: """Simple Fun #152: Invite More Women? Testing invite_more_women function""" def test_invite_more_women_positive(self): """Simple Fun #152: Invite More Women? Testing invite_more_women function (positive) :return:""" <|body_0|> def test_invite_mo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InviteMoreWomenTestCase: """Simple Fun #152: Invite More Women? Testing invite_more_women function""" def test_invite_more_women_positive(self): """Simple Fun #152: Invite More Women? Testing invite_more_women function (positive) :return:""" allure.dynamic.title('Testing invite_more_women...
the_stack_v2_python_sparse
kyu_7/simple_fun_152/test_invite_more_women.py
qamine-test/codewars
train
0
9a271f9b08b3c1b6fd0d99f87872cbeb78d93115
[ "if db_field.name == 'user':\n kwargs['queryset'] = User.objects.filter(id=request.user.id)\n kwargs['initial'] = request.user.id\nelif db_field.name == 'topic' and (not request.user.is_superuser):\n kwargs['queryset'] = Topic.objects.filter(id__in=request.user.profile.topics.all())\nreturn super(TaskAdmin...
<|body_start_0|> if db_field.name == 'user': kwargs['queryset'] = User.objects.filter(id=request.user.id) kwargs['initial'] = request.user.id elif db_field.name == 'topic' and (not request.user.is_superuser): kwargs['queryset'] = Topic.objects.filter(id__in=request.us...
TaskAdmin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskAdmin: def formfield_for_foreignkey(self, db_field, request, **kwargs): """Assigns default value for User field. limits Topics field to user's topics.""" <|body_0|> def formfield_for_manytomany(self, db_field, request, **kwargs): """Limits the choices of professo...
stack_v2_sparse_classes_10k_train_002799
9,167
permissive
[ { "docstring": "Assigns default value for User field. limits Topics field to user's topics.", "name": "formfield_for_foreignkey", "signature": "def formfield_for_foreignkey(self, db_field, request, **kwargs)" }, { "docstring": "Limits the choices of professors for the limit of user.", "name"...
3
stack_v2_sparse_classes_30k_train_004323
Implement the Python class `TaskAdmin` described below. Class description: Implement the TaskAdmin class. Method signatures and docstrings: - def formfield_for_foreignkey(self, db_field, request, **kwargs): Assigns default value for User field. limits Topics field to user's topics. - def formfield_for_manytomany(self...
Implement the Python class `TaskAdmin` described below. Class description: Implement the TaskAdmin class. Method signatures and docstrings: - def formfield_for_foreignkey(self, db_field, request, **kwargs): Assigns default value for User field. limits Topics field to user's topics. - def formfield_for_manytomany(self...
70638c121ea85ff0e6a650c5f2641b0b3b04d6d0
<|skeleton|> class TaskAdmin: def formfield_for_foreignkey(self, db_field, request, **kwargs): """Assigns default value for User field. limits Topics field to user's topics.""" <|body_0|> def formfield_for_manytomany(self, db_field, request, **kwargs): """Limits the choices of professo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TaskAdmin: def formfield_for_foreignkey(self, db_field, request, **kwargs): """Assigns default value for User field. limits Topics field to user's topics.""" if db_field.name == 'user': kwargs['queryset'] = User.objects.filter(id=request.user.id) kwargs['initial'] = req...
the_stack_v2_python_sparse
cms/admin.py
Ibrahem3amer/bala7
train
0