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
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
9a2e3ec46e565c30ec121349ae78b06f15b3e245
[ "key = ndb.Key(models.InstanceGroupManager, 'fake-key')\ninstance_group_managers.delete(key)\nself.failIf(key.get())", "def json_request(url, *_args, **_kwargs):\n return {'targetLink': url}\nself.mock(instance_group_managers.net, 'json_request', json_request)\nkey = models.InstanceGroupManager(key=instance_gr...
<|body_start_0|> key = ndb.Key(models.InstanceGroupManager, 'fake-key') instance_group_managers.delete(key) self.failIf(key.get()) <|end_body_0|> <|body_start_1|> def json_request(url, *_args, **_kwargs): return {'targetLink': url} self.mock(instance_group_managers.n...
Tests for instance_group_managers.delete.
DeleteTest
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeleteTest: """Tests for instance_group_managers.delete.""" def test_entity_doesnt_exist(self): """Ensures nothing happens when the entity doesn't exist.""" <|body_0|> def test_deletes(self): """Ensures an instance group manager is deleted.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_006800
34,211
permissive
[ { "docstring": "Ensures nothing happens when the entity doesn't exist.", "name": "test_entity_doesnt_exist", "signature": "def test_entity_doesnt_exist(self)" }, { "docstring": "Ensures an instance group manager is deleted.", "name": "test_deletes", "signature": "def test_deletes(self)" ...
6
stack_v2_sparse_classes_30k_train_040758
Implement the Python class `DeleteTest` described below. Class description: Tests for instance_group_managers.delete. Method signatures and docstrings: - def test_entity_doesnt_exist(self): Ensures nothing happens when the entity doesn't exist. - def test_deletes(self): Ensures an instance group manager is deleted. -...
Implement the Python class `DeleteTest` described below. Class description: Tests for instance_group_managers.delete. Method signatures and docstrings: - def test_entity_doesnt_exist(self): Ensures nothing happens when the entity doesn't exist. - def test_deletes(self): Ensures an instance group manager is deleted. -...
0a4fdfc25f89833026be6a8b29c0a27b8f3c5fc4
<|skeleton|> class DeleteTest: """Tests for instance_group_managers.delete.""" def test_entity_doesnt_exist(self): """Ensures nothing happens when the entity doesn't exist.""" <|body_0|> def test_deletes(self): """Ensures an instance group manager is deleted.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeleteTest: """Tests for instance_group_managers.delete.""" def test_entity_doesnt_exist(self): """Ensures nothing happens when the entity doesn't exist.""" key = ndb.Key(models.InstanceGroupManager, 'fake-key') instance_group_managers.delete(key) self.failIf(key.get()) ...
the_stack_v2_python_sparse
appengine/gce-backend/instance_group_managers_test.py
Swift1313/luci-py
train
0
ccef145855acdf4ec688594d9015bd9958d8fabf
[ "self.player1 = player1\nself.player2 = player2\nself.result = result\nself.id = id", "self.result[str(self.player1.id)] = result_player1\nself.result[str(self.player2.id)] = result_player2\nself.player1.score += result_player1\nself.player2.score += result_player2\nself.player1.save()\nself.player2.save()", "i...
<|body_start_0|> self.player1 = player1 self.player2 = player2 self.result = result self.id = id <|end_body_0|> <|body_start_1|> self.result[str(self.player1.id)] = result_player1 self.result[str(self.player2.id)] = result_player2 self.player1.score += result_pla...
Class of a match from a round.
Match
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Match: """Class of a match from a round.""" def __init__(self, player1, player2, result={}, id=None): """All the attribute of a match.""" <|body_0|> def add_result(self, result_player1, result_player2): """Add the result.""" <|body_1|> def __str__(se...
stack_v2_sparse_classes_75kplus_train_006801
2,395
no_license
[ { "docstring": "All the attribute of a match.", "name": "__init__", "signature": "def __init__(self, player1, player2, result={}, id=None)" }, { "docstring": "Add the result.", "name": "add_result", "signature": "def add_result(self, result_player1, result_player2)" }, { "docstri...
5
null
Implement the Python class `Match` described below. Class description: Class of a match from a round. Method signatures and docstrings: - def __init__(self, player1, player2, result={}, id=None): All the attribute of a match. - def add_result(self, result_player1, result_player2): Add the result. - def __str__(self):...
Implement the Python class `Match` described below. Class description: Class of a match from a round. Method signatures and docstrings: - def __init__(self, player1, player2, result={}, id=None): All the attribute of a match. - def add_result(self, result_player1, result_player2): Add the result. - def __str__(self):...
651006f6abc99ba2445c978ab7566c3c8e4192de
<|skeleton|> class Match: """Class of a match from a round.""" def __init__(self, player1, player2, result={}, id=None): """All the attribute of a match.""" <|body_0|> def add_result(self, result_player1, result_player2): """Add the result.""" <|body_1|> def __str__(se...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Match: """Class of a match from a round.""" def __init__(self, player1, player2, result={}, id=None): """All the attribute of a match.""" self.player1 = player1 self.player2 = player2 self.result = result self.id = id def add_result(self, result_player1, resul...
the_stack_v2_python_sparse
app/models/match.py
LisaInc/App-chess
train
0
f14bed489841b35f5cb0103699c0d3c0a3594674
[ "def dfs(root1, root2):\n if root1 is None and root2 is None:\n return True\n if root1 is None or root2 is None:\n return False\n if root1.val != root2.val:\n return False\n return dfs(root1.left, root2.left) and dfs(root1.right, root2.right) or (dfs(root1.left, root2.right) and dfs...
<|body_start_0|> def dfs(root1, root2): if root1 is None and root2 is None: return True if root1 is None or root2 is None: return False if root1.val != root2.val: return False return dfs(root1.left, root2.left) and d...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def flipEquiv(self, root1, root2): """:type root1: TreeNode :type root2: TreeNode :rtype: bool""" <|body_0|> def flipEquiv2(self, root1, root2): """:type root1: TreeNode :type root2: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_75kplus_train_006802
2,038
no_license
[ { "docstring": ":type root1: TreeNode :type root2: TreeNode :rtype: bool", "name": "flipEquiv", "signature": "def flipEquiv(self, root1, root2)" }, { "docstring": ":type root1: TreeNode :type root2: TreeNode :rtype: bool", "name": "flipEquiv2", "signature": "def flipEquiv2(self, root1, r...
2
stack_v2_sparse_classes_30k_val_001597
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flipEquiv(self, root1, root2): :type root1: TreeNode :type root2: TreeNode :rtype: bool - def flipEquiv2(self, root1, root2): :type root1: TreeNode :type root2: TreeNode :rty...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flipEquiv(self, root1, root2): :type root1: TreeNode :type root2: TreeNode :rtype: bool - def flipEquiv2(self, root1, root2): :type root1: TreeNode :type root2: TreeNode :rty...
813235789ce422a3bab198317aafc46fbc61625e
<|skeleton|> class Solution: def flipEquiv(self, root1, root2): """:type root1: TreeNode :type root2: TreeNode :rtype: bool""" <|body_0|> def flipEquiv2(self, root1, root2): """:type root1: TreeNode :type root2: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def flipEquiv(self, root1, root2): """:type root1: TreeNode :type root2: TreeNode :rtype: bool""" def dfs(root1, root2): if root1 is None and root2 is None: return True if root1 is None or root2 is None: return False ...
the_stack_v2_python_sparse
7.BINARY TREE and BST/951_flip equivalent binary tree_MED/solution.py
kimmyoo/python_leetcode
train
1
dc2a811c85b65d6d816dbf2af138d685a0466602
[ "if not lists:\n return\nsize = len(lists)\nans = lists[0]\nfor i in range(1, size):\n self.mergeTwoLists(ans, lists[i])\nreturn ans", "dummy = tmp = ListNode(-1)\nwhile l1 and l2:\n if l1.val <= l2.val:\n tmp.next = l1\n l1 = l1.next\n else:\n tmp.next = l2\n l2 = l2.next\...
<|body_start_0|> if not lists: return size = len(lists) ans = lists[0] for i in range(1, size): self.mergeTwoLists(ans, lists[i]) return ans <|end_body_0|> <|body_start_1|> dummy = tmp = ListNode(-1) while l1 and l2: if l1.val ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeKLists(self, lists): """n 是所有链表中元素的总和,k 是链表个数。 法一:暴力,两两合并,O(KN) 自顶向下的编程思想 [[],[1]] 过不了""" <|body_0|> def mergeTwoLists(self, l1, l2): """法一:迭代法 + 哨兵 T: O(m+n) S: O(1)""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not lists: ...
stack_v2_sparse_classes_75kplus_train_006803
4,671
no_license
[ { "docstring": "n 是所有链表中元素的总和,k 是链表个数。 法一:暴力,两两合并,O(KN) 自顶向下的编程思想 [[],[1]] 过不了", "name": "mergeKLists", "signature": "def mergeKLists(self, lists)" }, { "docstring": "法一:迭代法 + 哨兵 T: O(m+n) S: O(1)", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1, l2)" } ]
2
stack_v2_sparse_classes_30k_train_010248
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeKLists(self, lists): n 是所有链表中元素的总和,k 是链表个数。 法一:暴力,两两合并,O(KN) 自顶向下的编程思想 [[],[1]] 过不了 - def mergeTwoLists(self, l1, l2): 法一:迭代法 + 哨兵 T: O(m+n) S: O(1)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeKLists(self, lists): n 是所有链表中元素的总和,k 是链表个数。 法一:暴力,两两合并,O(KN) 自顶向下的编程思想 [[],[1]] 过不了 - def mergeTwoLists(self, l1, l2): 法一:迭代法 + 哨兵 T: O(m+n) S: O(1) <|skeleton|> class ...
39ca91cc973f8a339496db160cf2e17dd59e5831
<|skeleton|> class Solution: def mergeKLists(self, lists): """n 是所有链表中元素的总和,k 是链表个数。 法一:暴力,两两合并,O(KN) 自顶向下的编程思想 [[],[1]] 过不了""" <|body_0|> def mergeTwoLists(self, l1, l2): """法一:迭代法 + 哨兵 T: O(m+n) S: O(1)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def mergeKLists(self, lists): """n 是所有链表中元素的总和,k 是链表个数。 法一:暴力,两两合并,O(KN) 自顶向下的编程思想 [[],[1]] 过不了""" if not lists: return size = len(lists) ans = lists[0] for i in range(1, size): self.mergeTwoLists(ans, lists[i]) return ans ...
the_stack_v2_python_sparse
leetcode/heap/23. Merge k Sorted Lists.py
xiang12835/python-learning
train
2
f7896360b1176c5b14b793cece3ab81321262c09
[ "self.maxlen = maxlen\nself.val_range = val_range\nself.img = np.ones((maxlen, maxlen))\nself.time_step = 0\nself.one_img = np.ones((maxlen, maxlen))", "assert isinstance(data, np.ndarray)\ndata = np.expand_dims(data, 1)\ndata = cv2.resize(data, (1, self.maxlen), interpolation=cv2.INTER_LINEAR)\nif self.time_step...
<|body_start_0|> self.maxlen = maxlen self.val_range = val_range self.img = np.ones((maxlen, maxlen)) self.time_step = 0 self.one_img = np.ones((maxlen, maxlen)) <|end_body_0|> <|body_start_1|> assert isinstance(data, np.ndarray) data = np.expand_dims(data, 1) ...
Overview: DistributionTimeImage can be used to store images accorrding to time_steps, for data with 3 dims(time, category, value) Interface: __init__, add_one_time_step, get_image
DistributionTimeImage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DistributionTimeImage: """Overview: DistributionTimeImage can be used to store images accorrding to time_steps, for data with 3 dims(time, category, value) Interface: __init__, add_one_time_step, get_image""" def __init__(self, maxlen=600, val_range=None): """Overview: init the Distr...
stack_v2_sparse_classes_75kplus_train_006804
19,939
permissive
[ { "docstring": "Overview: init the DistributionTimeImage class Arguments: - maxlen (:obj:`int`): the max length of data inputs - val_range (:obj:`dict` or :obj:`None`): contain :obj:`int` type val_range['min'] and val_range['max'], default set to None", "name": "__init__", "signature": "def __init__(sel...
3
null
Implement the Python class `DistributionTimeImage` described below. Class description: Overview: DistributionTimeImage can be used to store images accorrding to time_steps, for data with 3 dims(time, category, value) Interface: __init__, add_one_time_step, get_image Method signatures and docstrings: - def __init__(se...
Implement the Python class `DistributionTimeImage` described below. Class description: Overview: DistributionTimeImage can be used to store images accorrding to time_steps, for data with 3 dims(time, category, value) Interface: __init__, add_one_time_step, get_image Method signatures and docstrings: - def __init__(se...
09d507c412235a2f0cf9c0b3485ec9ed15fb6421
<|skeleton|> class DistributionTimeImage: """Overview: DistributionTimeImage can be used to store images accorrding to time_steps, for data with 3 dims(time, category, value) Interface: __init__, add_one_time_step, get_image""" def __init__(self, maxlen=600, val_range=None): """Overview: init the Distr...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DistributionTimeImage: """Overview: DistributionTimeImage can be used to store images accorrding to time_steps, for data with 3 dims(time, category, value) Interface: __init__, add_one_time_step, get_image""" def __init__(self, maxlen=600, val_range=None): """Overview: init the DistributionTimeIm...
the_stack_v2_python_sparse
ctools/utils/log_helper.py
LFhase/DI-star
train
1
851b9bc37be675536dfe9e48832ff31179ba7434
[ "e = ConsoleEvent()\ne.copyin(self)\nreturn e", "if not input:\n raise NoInput()\nself.bot = bot\nself.console = console\nself.nick = getpass.getuser()\nself.auth = self.nick + '@' + bot.uuid\nself.userhost = self.auth\nself.origin = self.userhost\nself.txt = input\nself.usercmnd = input.split()[0]\nself.chann...
<|body_start_0|> e = ConsoleEvent() e.copyin(self) return e <|end_body_0|> <|body_start_1|> if not input: raise NoInput() self.bot = bot self.console = console self.nick = getpass.getuser() self.auth = self.nick + '@' + bot.uuid self.u...
ConsoleEvent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConsoleEvent: def __deepcopy__(self, a): """deepcopy an console event.""" <|body_0|> def parse(self, bot, input, console, *args, **kwargs): """overload this.""" <|body_1|> <|end_skeleton|> <|body_start_0|> e = ConsoleEvent() e.copyin(self) ...
stack_v2_sparse_classes_75kplus_train_006805
1,009
permissive
[ { "docstring": "deepcopy an console event.", "name": "__deepcopy__", "signature": "def __deepcopy__(self, a)" }, { "docstring": "overload this.", "name": "parse", "signature": "def parse(self, bot, input, console, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_016479
Implement the Python class `ConsoleEvent` described below. Class description: Implement the ConsoleEvent class. Method signatures and docstrings: - def __deepcopy__(self, a): deepcopy an console event. - def parse(self, bot, input, console, *args, **kwargs): overload this.
Implement the Python class `ConsoleEvent` described below. Class description: Implement the ConsoleEvent class. Method signatures and docstrings: - def __deepcopy__(self, a): deepcopy an console event. - def parse(self, bot, input, console, *args, **kwargs): overload this. <|skeleton|> class ConsoleEvent: def _...
4d9ba385555da03f881f6c4354c062f7f3c9949c
<|skeleton|> class ConsoleEvent: def __deepcopy__(self, a): """deepcopy an console event.""" <|body_0|> def parse(self, bot, input, console, *args, **kwargs): """overload this.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConsoleEvent: def __deepcopy__(self, a): """deepcopy an console event.""" e = ConsoleEvent() e.copyin(self) return e def parse(self, bot, input, console, *args, **kwargs): """overload this.""" if not input: raise NoInput() self.bot = bot...
the_stack_v2_python_sparse
jsb/lib/console/event.py
melmothx/jsonbot
train
9
6138f91b5a19eff11fc95d1f7b40f91b249088d8
[ "if self.memory:\n if isinstance(self.data, bytes):\n return self.data\nwith helpers.ensure_open(self):\n if not size:\n buffer = b''\n while True:\n chunk = cast(bytes, self.byte_stream.read1())\n buffer += chunk\n if not chunk:\n break\n ...
<|body_start_0|> if self.memory: if isinstance(self.data, bytes): return self.data with helpers.ensure_open(self): if not size: buffer = b'' while True: chunk = cast(bytes, self.byte_stream.read1()) ...
FileResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileResource: def read_file(self, *, size: Optional[int]=None) -> bytes: """Read bytes into memory Returns: any[][]: resource bytes""" <|body_0|> def write_file(self, target: Optional[Union[FileResource, str]]=None, **options: Any): """Write bytes to the target""" ...
stack_v2_sparse_classes_75kplus_train_006806
1,952
permissive
[ { "docstring": "Read bytes into memory Returns: any[][]: resource bytes", "name": "read_file", "signature": "def read_file(self, *, size: Optional[int]=None) -> bytes" }, { "docstring": "Write bytes to the target", "name": "write_file", "signature": "def write_file(self, target: Optional...
2
stack_v2_sparse_classes_30k_train_026470
Implement the Python class `FileResource` described below. Class description: Implement the FileResource class. Method signatures and docstrings: - def read_file(self, *, size: Optional[int]=None) -> bytes: Read bytes into memory Returns: any[][]: resource bytes - def write_file(self, target: Optional[Union[FileResou...
Implement the Python class `FileResource` described below. Class description: Implement the FileResource class. Method signatures and docstrings: - def read_file(self, *, size: Optional[int]=None) -> bytes: Read bytes into memory Returns: any[][]: resource bytes - def write_file(self, target: Optional[Union[FileResou...
740319edeee58f12cc6956a53356f3065ff18cbb
<|skeleton|> class FileResource: def read_file(self, *, size: Optional[int]=None) -> bytes: """Read bytes into memory Returns: any[][]: resource bytes""" <|body_0|> def write_file(self, target: Optional[Union[FileResource, str]]=None, **options: Any): """Write bytes to the target""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FileResource: def read_file(self, *, size: Optional[int]=None) -> bytes: """Read bytes into memory Returns: any[][]: resource bytes""" if self.memory: if isinstance(self.data, bytes): return self.data with helpers.ensure_open(self): if not size: ...
the_stack_v2_python_sparse
frictionless/resources/file.py
frictionlessdata/frictionless-py
train
295
0caf8b440f056164b5309a37d901f538c4455932
[ "super(Decoder, self).__init__()\nself.dm = dm\nself.N = N\nself.embedding = tf.keras.layers.Embedding(target_vocab, dm)\nself.positional_encoding = positional_encoding(max_seq_len, dm)\nself.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for _ in range(N)]\nself.dropout = tf.keras.layers.Dropout(drop_rate)", "...
<|body_start_0|> super(Decoder, self).__init__() self.dm = dm self.N = N self.embedding = tf.keras.layers.Embedding(target_vocab, dm) self.positional_encoding = positional_encoding(max_seq_len, dm) self.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for _ in range(N)] ...
to Decoder for machine translation
Decoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """to Decoder for machine translation""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """constructor @N: number of blocks in encoder @dm: dimensionality of model @h: number of heads @hidden: number of hidden units in fully connected layer @...
stack_v2_sparse_classes_75kplus_train_006807
2,701
no_license
[ { "docstring": "constructor @N: number of blocks in encoder @dm: dimensionality of model @h: number of heads @hidden: number of hidden units in fully connected layer @target_vocab: size of target vocabulary @max_seq_len: maximum sequence length possible @drop_rate: dropout rate *Sets following public instance a...
2
stack_v2_sparse_classes_30k_train_001702
Implement the Python class `Decoder` described below. Class description: to Decoder for machine translation Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): constructor @N: number of blocks in encoder @dm: dimensionality of model @h: number of heads @...
Implement the Python class `Decoder` described below. Class description: to Decoder for machine translation Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): constructor @N: number of blocks in encoder @dm: dimensionality of model @h: number of heads @...
e20b284d5f1841952104d7d9a0274cff80eb304d
<|skeleton|> class Decoder: """to Decoder for machine translation""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """constructor @N: number of blocks in encoder @dm: dimensionality of model @h: number of heads @hidden: number of hidden units in fully connected layer @...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Decoder: """to Decoder for machine translation""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """constructor @N: number of blocks in encoder @dm: dimensionality of model @h: number of heads @hidden: number of hidden units in fully connected layer @target_vocab:...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/10-transformer_decoder.py
jgadelugo/holbertonschool-machine_learning
train
1
ff3b9e50d76412c03d885cffd3e0b37dc9178479
[ "super(self.__class__, self).add_args(parser)\nparser.add_argument('-z', '--keys-data-csv', default=None, help='Pre-generated keys CSV file path')\nparser.add_argument('-k', '--lookup-data-dir', default=None, help='Model lookup/keys data directory path')\nparser.add_argument('-l', '--lookup-package-dir', default=No...
<|body_start_0|> super(self.__class__, self).add_args(parser) parser.add_argument('-z', '--keys-data-csv', default=None, help='Pre-generated keys CSV file path') parser.add_argument('-k', '--lookup-data-dir', default=None, help='Model lookup/keys data directory path') parser.add_argument...
Run models end to end. The command line arguments can be supplied in the configuration file (``oasislmf.json`` by default or specified with the ``--config`` flag).
RunCmd
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunCmd: """Run models end to end. The command line arguments can be supplied in the configuration file (``oasislmf.json`` by default or specified with the ``--config`` flag).""" def add_args(self, parser): """Run models end to end. :param parser: The argument parser object :type pars...
stack_v2_sparse_classes_75kplus_train_006808
28,137
permissive
[ { "docstring": "Run models end to end. :param parser: The argument parser object :type parser: ArgumentParser", "name": "add_args", "signature": "def add_args(self, parser)" }, { "docstring": "Generate Oasis files (items, coverages, GUL summary) for a model :param args: The arguments from the co...
2
null
Implement the Python class `RunCmd` described below. Class description: Run models end to end. The command line arguments can be supplied in the configuration file (``oasislmf.json`` by default or specified with the ``--config`` flag). Method signatures and docstrings: - def add_args(self, parser): Run models end to ...
Implement the Python class `RunCmd` described below. Class description: Run models end to end. The command line arguments can be supplied in the configuration file (``oasislmf.json`` by default or specified with the ``--config`` flag). Method signatures and docstrings: - def add_args(self, parser): Run models end to ...
6a754053ae7aa041fcdfd552b4860f5146ae2ae2
<|skeleton|> class RunCmd: """Run models end to end. The command line arguments can be supplied in the configuration file (``oasislmf.json`` by default or specified with the ``--config`` flag).""" def add_args(self, parser): """Run models end to end. :param parser: The argument parser object :type pars...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RunCmd: """Run models end to end. The command line arguments can be supplied in the configuration file (``oasislmf.json`` by default or specified with the ``--config`` flag).""" def add_args(self, parser): """Run models end to end. :param parser: The argument parser object :type parser: ArgumentP...
the_stack_v2_python_sparse
oasislmf/cli/model.py
strategist922/OasisLMF
train
1
2acc2f4d5857bd1cb500d6ac0e73ffd842163694
[ "result = Playlist.objects.filter(creator=creator).values('id', 'name', 'annotation', 'content', 'image', 'published', 'slug', 'created_at').reverse()\nresult_list = [i for i in result]\nreturn result_list", "result = Playlist.objects.filter(published=True).order_by('created_at').reverse()\nresult.order_by('creat...
<|body_start_0|> result = Playlist.objects.filter(creator=creator).values('id', 'name', 'annotation', 'content', 'image', 'published', 'slug', 'created_at').reverse() result_list = [i for i in result] return result_list <|end_body_0|> <|body_start_1|> result = Playlist.objects.filter(pu...
Playlist model manager
PlaylistManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlaylistManager: """Playlist model manager""" def user_items(self, creator): """User created blogs""" <|body_0|> def published(self): """All published playlists.""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = Playlist.objects.filter(cr...
stack_v2_sparse_classes_75kplus_train_006809
2,398
no_license
[ { "docstring": "User created blogs", "name": "user_items", "signature": "def user_items(self, creator)" }, { "docstring": "All published playlists.", "name": "published", "signature": "def published(self)" } ]
2
stack_v2_sparse_classes_30k_train_036478
Implement the Python class `PlaylistManager` described below. Class description: Playlist model manager Method signatures and docstrings: - def user_items(self, creator): User created blogs - def published(self): All published playlists.
Implement the Python class `PlaylistManager` described below. Class description: Playlist model manager Method signatures and docstrings: - def user_items(self, creator): User created blogs - def published(self): All published playlists. <|skeleton|> class PlaylistManager: """Playlist model manager""" def u...
67ef8219b4c49dd3962509bd481a1c1b8aafc6a3
<|skeleton|> class PlaylistManager: """Playlist model manager""" def user_items(self, creator): """User created blogs""" <|body_0|> def published(self): """All published playlists.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PlaylistManager: """Playlist model manager""" def user_items(self, creator): """User created blogs""" result = Playlist.objects.filter(creator=creator).values('id', 'name', 'annotation', 'content', 'image', 'published', 'slug', 'created_at').reverse() result_list = [i for i in res...
the_stack_v2_python_sparse
playlist/models.py
vacuumfull/na
train
0
d2e145089a1330b44238bcb6f9b92cb3b802667e
[ "driver = self.driver\ndriver.get(self.base_url)\nhomepage = HomePage(self.driver)\nhomepage.click_xz()\nhomepage.sleep(0.5)\nhomepage.click_yzgl()\nhomepage.click_yzkzsq()\nhomepage.switch_frame(driver.find_element_by_xpath(\"//iframe[@src='http://oa2.eascs.com/eaoa/assetsStampManufactureSearchPre.do']\"))\ndriver...
<|body_start_0|> driver = self.driver driver.get(self.base_url) homepage = HomePage(self.driver) homepage.click_xz() homepage.sleep(0.5) homepage.click_yzgl() homepage.click_yzkzsq() homepage.switch_frame(driver.find_element_by_xpath("//iframe[@src='http:/...
印章管理
Start
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Start: """印章管理""" def test1_yzkzsq(self): """印章刻制申请""" <|body_0|> def test2_yzdjcx(self): """印章登记查询""" <|body_1|> def test3_yzsysq(self): """印章使用申请""" <|body_2|> def test4_jzbfsq(self): """借转.报废申请""" <|body_3|> ...
stack_v2_sparse_classes_75kplus_train_006810
4,325
no_license
[ { "docstring": "印章刻制申请", "name": "test1_yzkzsq", "signature": "def test1_yzkzsq(self)" }, { "docstring": "印章登记查询", "name": "test2_yzdjcx", "signature": "def test2_yzdjcx(self)" }, { "docstring": "印章使用申请", "name": "test3_yzsysq", "signature": "def test3_yzsysq(self)" }, ...
5
null
Implement the Python class `Start` described below. Class description: 印章管理 Method signatures and docstrings: - def test1_yzkzsq(self): 印章刻制申请 - def test2_yzdjcx(self): 印章登记查询 - def test3_yzsysq(self): 印章使用申请 - def test4_jzbfsq(self): 借转.报废申请 - def test5_jzdjcx(self): 借.转单据查询
Implement the Python class `Start` described below. Class description: 印章管理 Method signatures and docstrings: - def test1_yzkzsq(self): 印章刻制申请 - def test2_yzdjcx(self): 印章登记查询 - def test3_yzsysq(self): 印章使用申请 - def test4_jzbfsq(self): 借转.报废申请 - def test5_jzdjcx(self): 借.转单据查询 <|skeleton|> class Start: """印章管理"""...
a90695147681163d45d4951f6a921eda816500bb
<|skeleton|> class Start: """印章管理""" def test1_yzkzsq(self): """印章刻制申请""" <|body_0|> def test2_yzdjcx(self): """印章登记查询""" <|body_1|> def test3_yzsysq(self): """印章使用申请""" <|body_2|> def test4_jzbfsq(self): """借转.报废申请""" <|body_3|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Start: """印章管理""" def test1_yzkzsq(self): """印章刻制申请""" driver = self.driver driver.get(self.base_url) homepage = HomePage(self.driver) homepage.click_xz() homepage.sleep(0.5) homepage.click_yzgl() homepage.click_yzkzsq() homepage.swi...
the_stack_v2_python_sparse
xz_test_case/xz_yzgl.py
shengli520/yyt
train
0
79468e7349b3ff1dac533c0f751bfed38c7a080f
[ "self.eks = AwsClient().connect('eks', region_name)\ntry:\n self.eks.list_clusters()\nexcept EndpointConnectionError:\n print('eks resource is not available in this aws region')\n return", "for cluster in self.list_clusters(older_than_seconds):\n try:\n self.eks.delete_cluster(name=cluster)\n ...
<|body_start_0|> self.eks = AwsClient().connect('eks', region_name) try: self.eks.list_clusters() except EndpointConnectionError: print('eks resource is not available in this aws region') return <|end_body_0|> <|body_start_1|> for cluster in self.list...
Abstract eks nuke in a class.
NukeEks
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NukeEks: """Abstract eks nuke in a class.""" def __init__(self, region_name=None) -> None: """Initialize eks nuke.""" <|body_0|> def nuke(self, older_than_seconds: float) -> None: """EKS cluster deleting function. Deleting all EKS clusters with a timestamp greate...
stack_v2_sparse_classes_75kplus_train_006811
1,891
permissive
[ { "docstring": "Initialize eks nuke.", "name": "__init__", "signature": "def __init__(self, region_name=None) -> None" }, { "docstring": "EKS cluster deleting function. Deleting all EKS clusters with a timestamp greater than older_than_seconds. :param int older_than_seconds: The timestamp in sec...
3
stack_v2_sparse_classes_30k_train_042637
Implement the Python class `NukeEks` described below. Class description: Abstract eks nuke in a class. Method signatures and docstrings: - def __init__(self, region_name=None) -> None: Initialize eks nuke. - def nuke(self, older_than_seconds: float) -> None: EKS cluster deleting function. Deleting all EKS clusters wi...
Implement the Python class `NukeEks` described below. Class description: Abstract eks nuke in a class. Method signatures and docstrings: - def __init__(self, region_name=None) -> None: Initialize eks nuke. - def nuke(self, older_than_seconds: float) -> None: EKS cluster deleting function. Deleting all EKS clusters wi...
25c4159e71935a9903a41540c168992586c5ba0c
<|skeleton|> class NukeEks: """Abstract eks nuke in a class.""" def __init__(self, region_name=None) -> None: """Initialize eks nuke.""" <|body_0|> def nuke(self, older_than_seconds: float) -> None: """EKS cluster deleting function. Deleting all EKS clusters with a timestamp greate...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NukeEks: """Abstract eks nuke in a class.""" def __init__(self, region_name=None) -> None: """Initialize eks nuke.""" self.eks = AwsClient().connect('eks', region_name) try: self.eks.list_clusters() except EndpointConnectionError: print('eks resourc...
the_stack_v2_python_sparse
package/nuke/compute/eks.py
diodonfrost/terraform-aws-lambda-nuke
train
20
0c7b1cfbf2e1d5472abbfe9ae038b643e0d875b3
[ "cnt, stack = (0, [])\nfor c in s:\n if 0 == len(stack) or stack[-1] == c:\n stack.append(c)\n else:\n stack.pop()\n if 0 == len(stack):\n cnt += 1\nreturn cnt", "lc, rc, cnt = (0, 0, 0)\nfor c in s:\n if c == 'L':\n lc += 1\n elif c == 'R':\n rc += 1\n if lc =...
<|body_start_0|> cnt, stack = (0, []) for c in s: if 0 == len(stack) or stack[-1] == c: stack.append(c) else: stack.pop() if 0 == len(stack): cnt += 1 return cnt <|end_body_0|> <|body_start_1|> lc, rc, c...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def balancedStringSplit0(self, s): """:type s: str :rtype: int""" <|body_0|> def balancedStringSplit(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> cnt, stack = (0, []) for c in s: ...
stack_v2_sparse_classes_75kplus_train_006812
1,184
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "balancedStringSplit0", "signature": "def balancedStringSplit0(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "balancedStringSplit", "signature": "def balancedStringSplit(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_026519
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def balancedStringSplit0(self, s): :type s: str :rtype: int - def balancedStringSplit(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def balancedStringSplit0(self, s): :type s: str :rtype: int - def balancedStringSplit(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def balancedStringSpli...
5376dd48b1cefb4faba9d2ef6a8a497b6b1d6c67
<|skeleton|> class Solution: def balancedStringSplit0(self, s): """:type s: str :rtype: int""" <|body_0|> def balancedStringSplit(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def balancedStringSplit0(self, s): """:type s: str :rtype: int""" cnt, stack = (0, []) for c in s: if 0 == len(stack) or stack[-1] == c: stack.append(c) else: stack.pop() if 0 == len(stack): c...
the_stack_v2_python_sparse
python/problem-stack-and-queue/split_a_string_in_balanced_strings.py
hyunjun/practice
train
3
eecae2b3a335072953931b93ec0318deeeb51412
[ "res.append(path)\nfor i in range(s, len(nums)):\n self.dfs(nums, path + [nums[i]], res, i + 1)", "res = []\nself.dfs(nums, [], res, 0)\nreturn res" ]
<|body_start_0|> res.append(path) for i in range(s, len(nums)): self.dfs(nums, path + [nums[i]], res, i + 1) <|end_body_0|> <|body_start_1|> res = [] self.dfs(nums, [], res, 0) return res <|end_body_1|>
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def dfs(self, nums, path, res, s): """:type nums: list[int] :type path: list[int] :type res: list[list[int]] :type s: int This algorithm use s to indicate the start position of the nums. So we can get different paths which ranges from (s:len(nums))""" <|body_0|> de...
stack_v2_sparse_classes_75kplus_train_006813
709
no_license
[ { "docstring": ":type nums: list[int] :type path: list[int] :type res: list[list[int]] :type s: int This algorithm use s to indicate the start position of the nums. So we can get different paths which ranges from (s:len(nums))", "name": "dfs", "signature": "def dfs(self, nums, path, res, s)" }, { ...
2
stack_v2_sparse_classes_30k_train_033756
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def dfs(self, nums, path, res, s): :type nums: list[int] :type path: list[int] :type res: list[list[int]] :type s: int This algorithm use s to indicate the start position of the ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def dfs(self, nums, path, res, s): :type nums: list[int] :type path: list[int] :type res: list[list[int]] :type s: int This algorithm use s to indicate the start position of the ...
7b5c5eca6426ef50d0f2bad4f6df2c8fb0357155
<|skeleton|> class Solution: def dfs(self, nums, path, res, s): """:type nums: list[int] :type path: list[int] :type res: list[list[int]] :type s: int This algorithm use s to indicate the start position of the nums. So we can get different paths which ranges from (s:len(nums))""" <|body_0|> de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def dfs(self, nums, path, res, s): """:type nums: list[int] :type path: list[int] :type res: list[list[int]] :type s: int This algorithm use s to indicate the start position of the nums. So we can get different paths which ranges from (s:len(nums))""" res.append(path) for i i...
the_stack_v2_python_sparse
com/hxdavid/leetcode/78Subsets.py
hxssgaa/pyleetcode
train
0
ccbe77f60ae3df66e50284001bd2bcef0ba6a6d8
[ "self.server = server\nself.modules = {}\nself.commands = {}\nself.events = {}\nself.module_handler = None", "allmsgs = ['privmsg', 'privnotice', 'pubmsg', 'pubnotice']\nparsed_event = self.parse_event(event, connection)\nif event.type in allmsgs:\n self.message_handler(parsed_event)\ntry:\n for module, act...
<|body_start_0|> self.server = server self.modules = {} self.commands = {} self.events = {} self.module_handler = None <|end_body_0|> <|body_start_1|> allmsgs = ['privmsg', 'privnotice', 'pubmsg', 'pubnotice'] parsed_event = self.parse_event(event, connection) ...
Class to handle irc events.
EventHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EventHandler: """Class to handle irc events.""" def __init__(self, server): """Constructor @param the irclib server object""" <|body_0|> def dispatcher(self, connection, event): """Dispatches an event to an event handler function. Taken from the irclib source."""...
stack_v2_sparse_classes_75kplus_train_006814
3,884
permissive
[ { "docstring": "Constructor @param the irclib server object", "name": "__init__", "signature": "def __init__(self, server)" }, { "docstring": "Dispatches an event to an event handler function. Taken from the irclib source.", "name": "dispatcher", "signature": "def dispatcher(self, connec...
5
stack_v2_sparse_classes_30k_train_040343
Implement the Python class `EventHandler` described below. Class description: Class to handle irc events. Method signatures and docstrings: - def __init__(self, server): Constructor @param the irclib server object - def dispatcher(self, connection, event): Dispatches an event to an event handler function. Taken from ...
Implement the Python class `EventHandler` described below. Class description: Class to handle irc events. Method signatures and docstrings: - def __init__(self, server): Constructor @param the irclib server object - def dispatcher(self, connection, event): Dispatches an event to an event handler function. Taken from ...
a254459af73475dd321c5bd9188ac9d9e7bb667d
<|skeleton|> class EventHandler: """Class to handle irc events.""" def __init__(self, server): """Constructor @param the irclib server object""" <|body_0|> def dispatcher(self, connection, event): """Dispatches an event to an event handler function. Taken from the irclib source."""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EventHandler: """Class to handle irc events.""" def __init__(self, server): """Constructor @param the irclib server object""" self.server = server self.modules = {} self.commands = {} self.events = {} self.module_handler = None def dispatcher(self, con...
the_stack_v2_python_sparse
piebot/handlers/eventhandler.py
klnusbaum/piebot
train
0
e7b39cdec7b506416d86f4cbe7c8390a270ee8dc
[ "BaseWorkerThread.__init__(self)\nmyThread = threading.currentThread()\nself.queue = queue\nself.config = config\nself.condorAPI = PyCondorAPI()\nself.daoFactory = DAOFactory(package='WMCore.WMBS', logger=logging, dbinterface=myThread.dbi)\nself.listSubsWithoutJobs = self.daoFactory(classname='Subscriptions.GetSubs...
<|body_start_0|> BaseWorkerThread.__init__(self) myThread = threading.currentThread() self.queue = queue self.config = config self.condorAPI = PyCondorAPI() self.daoFactory = DAOFactory(package='WMCore.WMBS', logger=logging, dbinterface=myThread.dbi) self.listSubs...
Polls for Work
WorkQueueManagerWorkPoller
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkQueueManagerWorkPoller: """Polls for Work""" def __init__(self, queue, config): """Initialise class members""" <|body_0|> def setup(self, parameters): """Called at startup - introduce random delay to avoid workers all starting at once""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_006815
4,257
permissive
[ { "docstring": "Initialise class members", "name": "__init__", "signature": "def __init__(self, queue, config)" }, { "docstring": "Called at startup - introduce random delay to avoid workers all starting at once", "name": "setup", "signature": "def setup(self, parameters)" }, { "...
6
stack_v2_sparse_classes_30k_test_001674
Implement the Python class `WorkQueueManagerWorkPoller` described below. Class description: Polls for Work Method signatures and docstrings: - def __init__(self, queue, config): Initialise class members - def setup(self, parameters): Called at startup - introduce random delay to avoid workers all starting at once - d...
Implement the Python class `WorkQueueManagerWorkPoller` described below. Class description: Polls for Work Method signatures and docstrings: - def __init__(self, queue, config): Initialise class members - def setup(self, parameters): Called at startup - introduce random delay to avoid workers all starting at once - d...
de110ccf6fc63ef5589b4e871ef4d51d5bce7a25
<|skeleton|> class WorkQueueManagerWorkPoller: """Polls for Work""" def __init__(self, queue, config): """Initialise class members""" <|body_0|> def setup(self, parameters): """Called at startup - introduce random delay to avoid workers all starting at once""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WorkQueueManagerWorkPoller: """Polls for Work""" def __init__(self, queue, config): """Initialise class members""" BaseWorkerThread.__init__(self) myThread = threading.currentThread() self.queue = queue self.config = config self.condorAPI = PyCondorAPI() ...
the_stack_v2_python_sparse
src/python/WMComponent/WorkQueueManager/WorkQueueManagerWorkPoller.py
vkuznet/WMCore
train
0
a639412340c7c976da22e0ae2f1cb875ddf94df8
[ "r = Round.query.get(round_id)\nif r is not None:\n data = {'round': r.json()}\n if r.is_general_look():\n data.update({'data': {'mapping': {}, 'couples': []}})\n else:\n data.update({'data': r.adjudication_data(r.first_dance().dance_id)})\n return data\nabort(404, 'Unknown round_id')", ...
<|body_start_0|> r = Round.query.get(round_id) if r is not None: data = {'round': r.json()} if r.is_general_look(): data.update({'data': {'mapping': {}, 'couples': []}}) else: data.update({'data': r.adjudication_data(r.first_dance().dan...
RoundAPIAdjudication
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoundAPIAdjudication: def get(self, round_id): """Get adjudication data for the first dance of the round""" <|body_0|> def patch(self, round_id): """Update the target marks for the round""" <|body_1|> <|end_skeleton|> <|body_start_0|> r = Round.quer...
stack_v2_sparse_classes_75kplus_train_006816
25,303
no_license
[ { "docstring": "Get adjudication data for the first dance of the round", "name": "get", "signature": "def get(self, round_id)" }, { "docstring": "Update the target marks for the round", "name": "patch", "signature": "def patch(self, round_id)" } ]
2
stack_v2_sparse_classes_30k_train_032095
Implement the Python class `RoundAPIAdjudication` described below. Class description: Implement the RoundAPIAdjudication class. Method signatures and docstrings: - def get(self, round_id): Get adjudication data for the first dance of the round - def patch(self, round_id): Update the target marks for the round
Implement the Python class `RoundAPIAdjudication` described below. Class description: Implement the RoundAPIAdjudication class. Method signatures and docstrings: - def get(self, round_id): Get adjudication data for the first dance of the round - def patch(self, round_id): Update the target marks for the round <|skel...
079b109fd13683a31d1d632faa5ab72cf0e78ddf
<|skeleton|> class RoundAPIAdjudication: def get(self, round_id): """Get adjudication data for the first dance of the round""" <|body_0|> def patch(self, round_id): """Update the target marks for the round""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RoundAPIAdjudication: def get(self, round_id): """Get adjudication data for the first dance of the round""" r = Round.query.get(round_id) if r is not None: data = {'round': r.json()} if r.is_general_look(): data.update({'data': {'mapping': {}, 'c...
the_stack_v2_python_sparse
backend/apis/round/apis.py
AlenAlic/DANCE
train
0
93785cc6ceb94f426051f3195e42dfe537a93606
[ "def foo(num):\n if num == 0:\n return [1]\n prev = foo(num - 1)\n return [1] + [prev[i] + prev[i + 1] for i in range(num - 1)] + [1]\nres = []\nfor i in range(numRows):\n res.append(foo(i))\nreturn res", "triangle = []\nfor row_num in range(numRows):\n row = [None for _ in range(row_num + 1...
<|body_start_0|> def foo(num): if num == 0: return [1] prev = foo(num - 1) return [1] + [prev[i] + prev[i + 1] for i in range(num - 1)] + [1] res = [] for i in range(numRows): res.append(foo(i)) return res <|end_body_0|> <|...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def generate(self, numRows): """:type numRows: int :rtype: List[List[int]]""" <|body_0|> def generate(self, numRows): """:type numRows: int :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> def foo(num): i...
stack_v2_sparse_classes_75kplus_train_006817
1,234
no_license
[ { "docstring": ":type numRows: int :rtype: List[List[int]]", "name": "generate", "signature": "def generate(self, numRows)" }, { "docstring": ":type numRows: int :rtype: List[List[int]]", "name": "generate", "signature": "def generate(self, numRows)" } ]
2
stack_v2_sparse_classes_30k_train_026035
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generate(self, numRows): :type numRows: int :rtype: List[List[int]] - def generate(self, numRows): :type numRows: int :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generate(self, numRows): :type numRows: int :rtype: List[List[int]] - def generate(self, numRows): :type numRows: int :rtype: List[List[int]] <|skeleton|> class Solution: ...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def generate(self, numRows): """:type numRows: int :rtype: List[List[int]]""" <|body_0|> def generate(self, numRows): """:type numRows: int :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def generate(self, numRows): """:type numRows: int :rtype: List[List[int]]""" def foo(num): if num == 0: return [1] prev = foo(num - 1) return [1] + [prev[i] + prev[i + 1] for i in range(num - 1)] + [1] res = [] for ...
the_stack_v2_python_sparse
0118_Pascal's_Triangle.py
bingli8802/leetcode
train
0
93815847430abce6873358c37b12feb81b4db241
[ "logger = logging.getLogger('AllInOneJsonLogCoordinator')\nlogger.setLevel(logging.INFO)\nlogging.basicConfig()\nself.logger = logger\nself.logger.info('init starts')\nself.src_paths = src_paths\nself.user_log_validator = UserLogValidator()\nself.app_log_validator = AppLogValidator()\nself.logger.info('init finishe...
<|body_start_0|> logger = logging.getLogger('AllInOneJsonLogCoordinator') logger.setLevel(logging.INFO) logging.basicConfig() self.logger = logger self.logger.info('init starts') self.src_paths = src_paths self.user_log_validator = UserLogValidator() self....
Coordinator coordinates all_in_one json log to all_in_one_validated json log from two aspects, validating user and validating application. see Validator Class in more detail for validation process.
AllInOneJsonLogCoordinator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AllInOneJsonLogCoordinator: """Coordinator coordinates all_in_one json log to all_in_one_validated json log from two aspects, validating user and validating application. see Validator Class in more detail for validation process.""" def __init__(self, src_paths=src_paths): """- `src_p...
stack_v2_sparse_classes_75kplus_train_006818
2,848
no_license
[ { "docstring": "- `src_path`: src path in which all_in_one json log for a user is coordinated with validator.", "name": "__init__", "signature": "def __init__(self, src_paths=src_paths)" }, { "docstring": "coordinate all_in_one json file with (app, user)-validator", "name": "coordinate", ...
2
stack_v2_sparse_classes_30k_train_052623
Implement the Python class `AllInOneJsonLogCoordinator` described below. Class description: Coordinator coordinates all_in_one json log to all_in_one_validated json log from two aspects, validating user and validating application. see Validator Class in more detail for validation process. Method signatures and docstr...
Implement the Python class `AllInOneJsonLogCoordinator` described below. Class description: Coordinator coordinates all_in_one json log to all_in_one_validated json log from two aspects, validating user and validating application. see Validator Class in more detail for validation process. Method signatures and docstr...
e3268f0f7ff4f5a4a68931e28c483184bbf8e926
<|skeleton|> class AllInOneJsonLogCoordinator: """Coordinator coordinates all_in_one json log to all_in_one_validated json log from two aspects, validating user and validating application. see Validator Class in more detail for validation process.""" def __init__(self, src_paths=src_paths): """- `src_p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AllInOneJsonLogCoordinator: """Coordinator coordinates all_in_one json log to all_in_one_validated json log from two aspects, validating user and validating application. see Validator Class in more detail for validation process.""" def __init__(self, src_paths=src_paths): """- `src_path`: src pat...
the_stack_v2_python_sparse
external_attachements/src/data_management/coordinator/all_in_one_json_log_coordinator.py
khalilhajji/discovering_user_habbits_from_smartphone_logs
train
0
44e7698556b0cf9e1d35e81235036272dd9730ea
[ "self.toupper = {}\nself.tolower = {}\nself.codepoints = []\nfor line in unicode_data_lines:\n fields = line.split(';')\n self.__set_casemap(fields[CODEPOINT_FIELD], upper=fields[UPPERCASE_FIELD], lower=fields[LOWERCASE_FIELD])\nself.codepoints.extend(self.toupper.keys())\nfor line in special_casing_lines:\n ...
<|body_start_0|> self.toupper = {} self.tolower = {} self.codepoints = [] for line in unicode_data_lines: fields = line.split(';') self.__set_casemap(fields[CODEPOINT_FIELD], upper=fields[UPPERCASE_FIELD], lower=fields[LOWERCASE_FIELD]) self.codepoints.ext...
Unicode case mapping helper. This class holds the list of codepoints, and their uppercase and lowercase mappings.
CaseMap
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CaseMap: """Unicode case mapping helper. This class holds the list of codepoints, and their uppercase and lowercase mappings.""" def __init__(self, unicode_data_lines, special_casing_lines, casefolding_lines): """Construct with the lines from UnicodeData and SpecialCasing.""" ...
stack_v2_sparse_classes_75kplus_train_006819
10,498
permissive
[ { "docstring": "Construct with the lines from UnicodeData and SpecialCasing.", "name": "__init__", "signature": "def __init__(self, unicode_data_lines, special_casing_lines, casefolding_lines)" }, { "docstring": "Set a case mapping. Mark the upper and lower case forms of cp. If a form is empty, ...
3
stack_v2_sparse_classes_30k_train_027930
Implement the Python class `CaseMap` described below. Class description: Unicode case mapping helper. This class holds the list of codepoints, and their uppercase and lowercase mappings. Method signatures and docstrings: - def __init__(self, unicode_data_lines, special_casing_lines, casefolding_lines): Construct with...
Implement the Python class `CaseMap` described below. Class description: Unicode case mapping helper. This class holds the list of codepoints, and their uppercase and lowercase mappings. Method signatures and docstrings: - def __init__(self, unicode_data_lines, special_casing_lines, casefolding_lines): Construct with...
440578b31ecce46fcc5ba2ad745ffd5712d63a35
<|skeleton|> class CaseMap: """Unicode case mapping helper. This class holds the list of codepoints, and their uppercase and lowercase mappings.""" def __init__(self, unicode_data_lines, special_casing_lines, casefolding_lines): """Construct with the lines from UnicodeData and SpecialCasing.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CaseMap: """Unicode case mapping helper. This class holds the list of codepoints, and their uppercase and lowercase mappings.""" def __init__(self, unicode_data_lines, special_casing_lines, casefolding_lines): """Construct with the lines from UnicodeData and SpecialCasing.""" self.toupper...
the_stack_v2_python_sparse
utils/genUnicodeTable.py
facebook/hermes
train
8,449
bf0fcf389638ae57744b106e826e41758ad0b8a9
[ "argument = lab04.eratosthenes(1)\nexpected = []\nself.assertEqual(expected, argument, 'There are no prime numbers in the list.')", "argument = lab04.eratosthenes(2)\nexpected = [2]\nself.assertEqual(expected, argument, 'The list contains one prime number.')", "argument = lab04.eratosthenes(31)\nexpected = [2, ...
<|body_start_0|> argument = lab04.eratosthenes(1) expected = [] self.assertEqual(expected, argument, 'There are no prime numbers in the list.') <|end_body_0|> <|body_start_1|> argument = lab04.eratosthenes(2) expected = [2] self.assertEqual(expected, argument, 'The list ...
Test
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test: def test_smallest_bound(self): """Test the upper bound of one.""" <|body_0|> def test_list_of_one(self): """Test the upper bound of two.""" <|body_1|> def test_list_of_several(self): """Test an upper bound that returns a list of many intege...
stack_v2_sparse_classes_75kplus_train_006820
1,187
no_license
[ { "docstring": "Test the upper bound of one.", "name": "test_smallest_bound", "signature": "def test_smallest_bound(self)" }, { "docstring": "Test the upper bound of two.", "name": "test_list_of_one", "signature": "def test_list_of_one(self)" }, { "docstring": "Test an upper boun...
4
stack_v2_sparse_classes_30k_test_002624
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def test_smallest_bound(self): Test the upper bound of one. - def test_list_of_one(self): Test the upper bound of two. - def test_list_of_several(self): Test an upper bound that returns ...
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def test_smallest_bound(self): Test the upper bound of one. - def test_list_of_one(self): Test the upper bound of two. - def test_list_of_several(self): Test an upper bound that returns ...
a7014be9881ec4a2d0b332fef353a29f5dbb05de
<|skeleton|> class Test: def test_smallest_bound(self): """Test the upper bound of one.""" <|body_0|> def test_list_of_one(self): """Test the upper bound of two.""" <|body_1|> def test_list_of_several(self): """Test an upper bound that returns a list of many intege...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test: def test_smallest_bound(self): """Test the upper bound of one.""" argument = lab04.eratosthenes(1) expected = [] self.assertEqual(expected, argument, 'There are no prime numbers in the list.') def test_list_of_one(self): """Test the upper bound of two.""" ...
the_stack_v2_python_sparse
Lab04/test_eratosthenes.py
ronliang6/A01199458_1510
train
0
e5e5a3a9eeba82b04e6b4d73692cdc406ee1749b
[ "user_perms = self._permissions.has_access(user)\nif not user_perms:\n return True\nreturn self._default_manager.filter(user_perms, pk=self.pk).exists()", "if queryset is None:\n queryset = cls._default_manager\nreturn queryset.filter(cls._permissions.has_access(user))" ]
<|body_start_0|> user_perms = self._permissions.has_access(user) if not user_perms: return True return self._default_manager.filter(user_perms, pk=self.pk).exists() <|end_body_0|> <|body_start_1|> if queryset is None: queryset = cls._default_manager retur...
Django Abstract model class for object-level permissions.
PermissionsForObjectMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PermissionsForObjectMixin: """Django Abstract model class for object-level permissions.""" def has_permission_to_object(self, user): """Check if user has all rights to single object.""" <|body_0|> def _get_objects_for_user(cls, user, queryset=None): """Return obj...
stack_v2_sparse_classes_75kplus_train_006821
12,541
permissive
[ { "docstring": "Check if user has all rights to single object.", "name": "has_permission_to_object", "signature": "def has_permission_to_object(self, user)" }, { "docstring": "Return objects (as queryset) to which user has access. :rtype: `django.db.models.QuerySet`", "name": "_get_objects_f...
2
null
Implement the Python class `PermissionsForObjectMixin` described below. Class description: Django Abstract model class for object-level permissions. Method signatures and docstrings: - def has_permission_to_object(self, user): Check if user has all rights to single object. - def _get_objects_for_user(cls, user, query...
Implement the Python class `PermissionsForObjectMixin` described below. Class description: Django Abstract model class for object-level permissions. Method signatures and docstrings: - def has_permission_to_object(self, user): Check if user has all rights to single object. - def _get_objects_for_user(cls, user, query...
b4a72356f527b1f12c7babd7465d2d7fa3ffb0d3
<|skeleton|> class PermissionsForObjectMixin: """Django Abstract model class for object-level permissions.""" def has_permission_to_object(self, user): """Check if user has all rights to single object.""" <|body_0|> def _get_objects_for_user(cls, user, queryset=None): """Return obj...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PermissionsForObjectMixin: """Django Abstract model class for object-level permissions.""" def has_permission_to_object(self, user): """Check if user has all rights to single object.""" user_perms = self._permissions.has_access(user) if not user_perms: return True ...
the_stack_v2_python_sparse
src/ralph/lib/permissions/models.py
allegro/ralph
train
1,970
94ee3271b6315ef1303563c4099952ca2b79caf3
[ "person_identifiers = list(set([f[:3] for f in os.listdir(self.path)]))\nindex = np.random.randint(0, 1000, len(person_identifiers))\nreturn [(person_identifiers[i], index[i]) for i in range(len(index))]", "def get_file_path(path, person_identifier, index, postfix):\n return os.path.join(path, '{}_{}.{}'.forma...
<|body_start_0|> person_identifiers = list(set([f[:3] for f in os.listdir(self.path)])) index = np.random.randint(0, 1000, len(person_identifiers)) return [(person_identifiers[i], index[i]) for i in range(len(index))] <|end_body_0|> <|body_start_1|> def get_file_path(path, person_identi...
Loads Data from a refined dataset
RefinedMPIIDataLoader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RefinedMPIIDataLoader: """Loads Data from a refined dataset""" def sample_identifiers(self): """Samples a random image between 0 and 1000 from the refined MPII dataset Returns: list of tuples (person_identifier, index)""" <|body_0|> def get_data(self, identifiers): ...
stack_v2_sparse_classes_75kplus_train_006822
5,807
no_license
[ { "docstring": "Samples a random image between 0 and 1000 from the refined MPII dataset Returns: list of tuples (person_identifier, index)", "name": "sample_identifiers", "signature": "def sample_identifiers(self)" }, { "docstring": "Returns the data for given identifiers Args: identifiers: list...
2
stack_v2_sparse_classes_30k_train_054279
Implement the Python class `RefinedMPIIDataLoader` described below. Class description: Loads Data from a refined dataset Method signatures and docstrings: - def sample_identifiers(self): Samples a random image between 0 and 1000 from the refined MPII dataset Returns: list of tuples (person_identifier, index) - def ge...
Implement the Python class `RefinedMPIIDataLoader` described below. Class description: Loads Data from a refined dataset Method signatures and docstrings: - def sample_identifiers(self): Samples a random image between 0 and 1000 from the refined MPII dataset Returns: list of tuples (person_identifier, index) - def ge...
dfb046f3e752dc71aa2c20d63aa75f80edc3f560
<|skeleton|> class RefinedMPIIDataLoader: """Loads Data from a refined dataset""" def sample_identifiers(self): """Samples a random image between 0 and 1000 from the refined MPII dataset Returns: list of tuples (person_identifier, index)""" <|body_0|> def get_data(self, identifiers): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RefinedMPIIDataLoader: """Loads Data from a refined dataset""" def sample_identifiers(self): """Samples a random image between 0 and 1000 from the refined MPII dataset Returns: list of tuples (person_identifier, index)""" person_identifiers = list(set([f[:3] for f in os.listdir(self.path)...
the_stack_v2_python_sparse
src/visualisations/data_loading.py
mcbuehler/FP-GAN
train
1
5cee8f5de037c00a8a219bd097bcd41da9b85faa
[ "self.value_dict = {}\nfor i in range(len(nums)):\n if nums[i]:\n self.value_dict[i] = nums[i]", "a_value_dict = self.value_dict\nb_value_dict = vec.value_dict\ntemp_value = 0\nif len(a_value_dict) > len(b_value_dict):\n b_value_dict, a_value_dict = (a_value_dict, b_value_dict)\nfor key, value in a_v...
<|body_start_0|> self.value_dict = {} for i in range(len(nums)): if nums[i]: self.value_dict[i] = nums[i] <|end_body_0|> <|body_start_1|> a_value_dict = self.value_dict b_value_dict = vec.value_dict temp_value = 0 if len(a_value_dict) > len(b_...
SparseVector
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SparseVector: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def dotProduct(self, vec): """:type vec: 'SparseVector' :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.value_dict = {} for i in range(len(nums))...
stack_v2_sparse_classes_75kplus_train_006823
1,129
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type vec: 'SparseVector' :rtype: int", "name": "dotProduct", "signature": "def dotProduct(self, vec)" } ]
2
stack_v2_sparse_classes_30k_train_022680
Implement the Python class `SparseVector` described below. Class description: Implement the SparseVector class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def dotProduct(self, vec): :type vec: 'SparseVector' :rtype: int
Implement the Python class `SparseVector` described below. Class description: Implement the SparseVector class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def dotProduct(self, vec): :type vec: 'SparseVector' :rtype: int <|skeleton|> class SparseVector: def __init__(sel...
dc45210cb2cc50bfefd8c21c865e6ee2163a022a
<|skeleton|> class SparseVector: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def dotProduct(self, vec): """:type vec: 'SparseVector' :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SparseVector: def __init__(self, nums): """:type nums: List[int]""" self.value_dict = {} for i in range(len(nums)): if nums[i]: self.value_dict[i] = nums[i] def dotProduct(self, vec): """:type vec: 'SparseVector' :rtype: int""" a_value_d...
the_stack_v2_python_sparse
practice/solution/1570_dot_product_of_two_sparse_vectors.py
kesarb/leetcode-summary-python
train
0
27ffc7d0b6818a2cce1d58d0393392cd6af9cadb
[ "self.c_num = c_num\nself.c_name = c_name\nself.teacher = teacher", "if isinstance(teacher, Teacher) and teacher.t_name:\n self.teacher = teacher.t_name\n rest_dist = {'课程名称': self.c_name, '教师名称': self.teacher}\n return rest_dist\nelse:\n return None" ]
<|body_start_0|> self.c_num = c_num self.c_name = c_name self.teacher = teacher <|end_body_0|> <|body_start_1|> if isinstance(teacher, Teacher) and teacher.t_name: self.teacher = teacher.t_name rest_dist = {'课程名称': self.c_name, '教师名称': self.teacher} r...
定义课程类
Cource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cource: """定义课程类""" def __init__(self, c_num, c_name, teacher=None): """定义构造函数描述课程编号、课程名称、授课教师""" <|body_0|> def binding(self, teacher): """实现课程绑定授课教师""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.c_num = c_num self.c_name = c_nam...
stack_v2_sparse_classes_75kplus_train_006824
1,792
no_license
[ { "docstring": "定义构造函数描述课程编号、课程名称、授课教师", "name": "__init__", "signature": "def __init__(self, c_num, c_name, teacher=None)" }, { "docstring": "实现课程绑定授课教师", "name": "binding", "signature": "def binding(self, teacher)" } ]
2
stack_v2_sparse_classes_30k_train_049912
Implement the Python class `Cource` described below. Class description: 定义课程类 Method signatures and docstrings: - def __init__(self, c_num, c_name, teacher=None): 定义构造函数描述课程编号、课程名称、授课教师 - def binding(self, teacher): 实现课程绑定授课教师
Implement the Python class `Cource` described below. Class description: 定义课程类 Method signatures and docstrings: - def __init__(self, c_num, c_name, teacher=None): 定义构造函数描述课程编号、课程名称、授课教师 - def binding(self, teacher): 实现课程绑定授课教师 <|skeleton|> class Cource: """定义课程类""" def __init__(self, c_num, c_name, teacher=...
48f15687f6639d1415aeba7e419beb91234d87e2
<|skeleton|> class Cource: """定义课程类""" def __init__(self, c_num, c_name, teacher=None): """定义构造函数描述课程编号、课程名称、授课教师""" <|body_0|> def binding(self, teacher): """实现课程绑定授课教师""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Cource: """定义课程类""" def __init__(self, c_num, c_name, teacher=None): """定义构造函数描述课程编号、课程名称、授课教师""" self.c_num = c_num self.c_name = c_name self.teacher = teacher def binding(self, teacher): """实现课程绑定授课教师""" if isinstance(teacher, Teacher) and teacher.t_...
the_stack_v2_python_sparse
homework/project_58/example.py
AnacondaFeng/AnacondaFeng
train
0
1f469c4a7678bd681ee263ed81c12bfcf5d203d3
[ "if not A:\n return -1\nn = len(A)\nsortedA, index = zip(*sorted(((a, i) for i, a in enumerate(A))))\nindex_max = [index[-1]] * n\nfor i in range(n - 2, -1, -1):\n index_max[i] = max(index[i], index_max[i + 1])\nres = 0\nfor i, j in zip(index, index_max):\n res = max(res, j - i)\nreturn res", "if not A:\...
<|body_start_0|> if not A: return -1 n = len(A) sortedA, index = zip(*sorted(((a, i) for i, a in enumerate(A)))) index_max = [index[-1]] * n for i in range(n - 2, -1, -1): index_max[i] = max(index[i], index_max[i + 1]) res = 0 for i, j in z...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maximumGap(self, A): """Time Complexity: O(nlogn)""" <|body_0|> def naiveMaximumGap(self, A): """Time Complexity: O(n*n)""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not A: return -1 n = len(A) sortedA...
stack_v2_sparse_classes_75kplus_train_006825
2,223
permissive
[ { "docstring": "Time Complexity: O(nlogn)", "name": "maximumGap", "signature": "def maximumGap(self, A)" }, { "docstring": "Time Complexity: O(n*n)", "name": "naiveMaximumGap", "signature": "def naiveMaximumGap(self, A)" } ]
2
stack_v2_sparse_classes_30k_train_034700
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maximumGap(self, A): Time Complexity: O(nlogn) - def naiveMaximumGap(self, A): Time Complexity: O(n*n)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maximumGap(self, A): Time Complexity: O(nlogn) - def naiveMaximumGap(self, A): Time Complexity: O(n*n) <|skeleton|> class Solution: def maximumGap(self, A): """...
77bc551a03a2a3e3808e50016ece14adb5cfbd96
<|skeleton|> class Solution: def maximumGap(self, A): """Time Complexity: O(nlogn)""" <|body_0|> def naiveMaximumGap(self, A): """Time Complexity: O(n*n)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maximumGap(self, A): """Time Complexity: O(nlogn)""" if not A: return -1 n = len(A) sortedA, index = zip(*sorted(((a, i) for i, a in enumerate(A)))) index_max = [index[-1]] * n for i in range(n - 2, -1, -1): index_max[i] = m...
the_stack_v2_python_sparse
quizzes/interviewbit/programming/arrays/max_distance.py
JiniousChoi/encyclopedia-in-code
train
2
cdd26fcae9b29bdd70101d3edd484c1dcee03993
[ "super().__init__(params=RespMatParams(), target=self._run_respmat)\nsofb, tune, curr, rfgen = self._create_devices()\nself.devices['sofb'] = sofb\nself.devices['tune'] = tune\nself.devices['curr'] = curr\nself.devices['rfgen'] = rfgen\nself.confdb = ConfigDBClient(config_type='si_orbcorr_respm')", "if self._stop...
<|body_start_0|> super().__init__(params=RespMatParams(), target=self._run_respmat) sofb, tune, curr, rfgen = self._create_devices() self.devices['sofb'] = sofb self.devices['tune'] = tune self.devices['curr'] = curr self.devices['rfgen'] = rfgen self.confdb = Con...
.
MeasureRespMat
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MeasureRespMat: """.""" def __init__(self): """.""" <|body_0|> def _run_respmat(self): """.""" <|body_1|> def _measure_respm(self): """.""" <|body_2|> def _get_loco_setup(self, orbmat_name): """.""" <|body_3|> ...
stack_v2_sparse_classes_75kplus_train_006826
5,185
permissive
[ { "docstring": ".", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ".", "name": "_run_respmat", "signature": "def _run_respmat(self)" }, { "docstring": ".", "name": "_measure_respm", "signature": "def _measure_respm(self)" }, { "docstring"...
6
stack_v2_sparse_classes_30k_train_022676
Implement the Python class `MeasureRespMat` described below. Class description: . Method signatures and docstrings: - def __init__(self): . - def _run_respmat(self): . - def _measure_respm(self): . - def _get_loco_setup(self, orbmat_name): . - def _get_bpm_variation(self, period=10): . - def _create_devices(): .
Implement the Python class `MeasureRespMat` described below. Class description: . Method signatures and docstrings: - def __init__(self): . - def _run_respmat(self): . - def _measure_respm(self): . - def _get_loco_setup(self, orbmat_name): . - def _get_bpm_variation(self, period=10): . - def _create_devices(): . <|s...
39644161d98964a3a3d80d63269201f0a1712e82
<|skeleton|> class MeasureRespMat: """.""" def __init__(self): """.""" <|body_0|> def _run_respmat(self): """.""" <|body_1|> def _measure_respm(self): """.""" <|body_2|> def _get_loco_setup(self, orbmat_name): """.""" <|body_3|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MeasureRespMat: """.""" def __init__(self): """.""" super().__init__(params=RespMatParams(), target=self._run_respmat) sofb, tune, curr, rfgen = self._create_devices() self.devices['sofb'] = sofb self.devices['tune'] = tune self.devices['curr'] = curr ...
the_stack_v2_python_sparse
apsuite/commisslib/measure_respmat.py
lnls-fac/apsuite
train
1
b81e79a69d51c92a95221f4c12bc04e93dfa55b8
[ "if not root:\n return None\nres = []\nl = [root, '*']\nwhile l:\n ll = []\n for n in l:\n if n == '*':\n res.append('*')\n else:\n res.append(str(n.val))\n for nn in n.children:\n ll.append(nn)\n ll.append('*')\n l = ll\nreturn ',...
<|body_start_0|> if not root: return None res = [] l = [root, '*'] while l: ll = [] for n in l: if n == '*': res.append('*') else: res.append(str(n.val)) for nn...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_75kplus_train_006827
1,548
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: Node :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node", "name": "deserialize", "signature": "def deserialize(self, ...
2
stack_v2_sparse_classes_30k_train_045467
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod...
36d7f9e967a62db77622e0888f61999d7f37579a
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" if not root: return None res = [] l = [root, '*'] while l: ll = [] for n in l: if n == '*': re...
the_stack_v2_python_sparse
apple/P0428_apple.py
westgate458/LeetCode
train
0
5ebefc01e80cdd571928bceeb277005ef622e265
[ "args = request.args.to_dict()\nvalidator.validate(args, validator.USER_CONTENT)\nusername = get_jwt_identity()\nuser_titles = user_controller.get_user_titles(username, args)\nif not user_titles:\n return ('', 404)\nuser_titles_dto = user_schema.serialize_user_titles(username, user_titles)\nresponse = Response(r...
<|body_start_0|> args = request.args.to_dict() validator.validate(args, validator.USER_CONTENT) username = get_jwt_identity() user_titles = user_controller.get_user_titles(username, args) if not user_titles: return ('', 404) user_titles_dto = user_schema.seria...
UserTitlesResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserTitlesResource: def get(self): """Get user related titles""" <|body_0|> def post(self, title_id): """Add a title to user's watchlist""" <|body_1|> def delete(self, title_id): """Remove a title from a watchlist""" <|body_2|> <|end_ske...
stack_v2_sparse_classes_75kplus_train_006828
4,871
no_license
[ { "docstring": "Get user related titles", "name": "get", "signature": "def get(self)" }, { "docstring": "Add a title to user's watchlist", "name": "post", "signature": "def post(self, title_id)" }, { "docstring": "Remove a title from a watchlist", "name": "delete", "signa...
3
stack_v2_sparse_classes_30k_train_032403
Implement the Python class `UserTitlesResource` described below. Class description: Implement the UserTitlesResource class. Method signatures and docstrings: - def get(self): Get user related titles - def post(self, title_id): Add a title to user's watchlist - def delete(self, title_id): Remove a title from a watchli...
Implement the Python class `UserTitlesResource` described below. Class description: Implement the UserTitlesResource class. Method signatures and docstrings: - def get(self): Get user related titles - def post(self, title_id): Add a title to user's watchlist - def delete(self, title_id): Remove a title from a watchli...
e0c8ea99886f10aea14b9ca95af8a4f42f2af493
<|skeleton|> class UserTitlesResource: def get(self): """Get user related titles""" <|body_0|> def post(self, title_id): """Add a title to user's watchlist""" <|body_1|> def delete(self, title_id): """Remove a title from a watchlist""" <|body_2|> <|end_ske...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserTitlesResource: def get(self): """Get user related titles""" args = request.args.to_dict() validator.validate(args, validator.USER_CONTENT) username = get_jwt_identity() user_titles = user_controller.get_user_titles(username, args) if not user_titles: ...
the_stack_v2_python_sparse
imdb_api/resources/user_resources.py
Matiasmoratti7/imdb
train
0
2738a587cdebd824e5a118e99e4aefeb834e1e21
[ "super(DWSepConv, self).__init__()\nif norm_layer is None:\n norm_layer = nn.BatchNorm2d\nif kernel_size == 3:\n conv_dw = conv3x3\nelif kernel_size == 5:\n conv_dw = conv5x5\nelse:\n raise ValueError('DWSepConv class only supports kernel size 3x3, 5x5')\nself._outplanes = inplanes * stride\nself.convdw...
<|body_start_0|> super(DWSepConv, self).__init__() if norm_layer is None: norm_layer = nn.BatchNorm2d if kernel_size == 3: conv_dw = conv3x3 elif kernel_size == 5: conv_dw = conv5x5 else: raise ValueError('DWSepConv class only suppo...
depthwise-separable convolution block structure: - conv-dw > bn > relu > 1x1-conv > bn notes: - kernel_size of conv-dw should be parametried, could be 3x3 or 5x5 - output channels = input channels * stride
DWSepConv
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DWSepConv: """depthwise-separable convolution block structure: - conv-dw > bn > relu > 1x1-conv > bn notes: - kernel_size of conv-dw should be parametried, could be 3x3 or 5x5 - output channels = input channels * stride""" def __init__(self, inplanes, kernel_size, stride=1, dropout=0, norm_l...
stack_v2_sparse_classes_75kplus_train_006829
20,656
no_license
[ { "docstring": "Constructor Args: inplanes: (int) number of input channels to the block kernel_size: (int) kernel_size of conv-dw filter, either 3x3 or 5x5 is supported stride: (int) stride of conv-dw filter dropout: (float) p = dropout; default = 0 (no dropout effect) norm_layer: (nn.Module) normalization laye...
2
stack_v2_sparse_classes_30k_train_043676
Implement the Python class `DWSepConv` described below. Class description: depthwise-separable convolution block structure: - conv-dw > bn > relu > 1x1-conv > bn notes: - kernel_size of conv-dw should be parametried, could be 3x3 or 5x5 - output channels = input channels * stride Method signatures and docstrings: - d...
Implement the Python class `DWSepConv` described below. Class description: depthwise-separable convolution block structure: - conv-dw > bn > relu > 1x1-conv > bn notes: - kernel_size of conv-dw should be parametried, could be 3x3 or 5x5 - output channels = input channels * stride Method signatures and docstrings: - d...
a0c51824b9c4c458918ef9a40a925cd576137d75
<|skeleton|> class DWSepConv: """depthwise-separable convolution block structure: - conv-dw > bn > relu > 1x1-conv > bn notes: - kernel_size of conv-dw should be parametried, could be 3x3 or 5x5 - output channels = input channels * stride""" def __init__(self, inplanes, kernel_size, stride=1, dropout=0, norm_l...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DWSepConv: """depthwise-separable convolution block structure: - conv-dw > bn > relu > 1x1-conv > bn notes: - kernel_size of conv-dw should be parametried, could be 3x3 or 5x5 - output channels = input channels * stride""" def __init__(self, inplanes, kernel_size, stride=1, dropout=0, norm_layer=None): ...
the_stack_v2_python_sparse
model/mnasnet.py
baihuaxie/ConvLab
train
0
bac7eb9694e74420e2190ac4dda1dc34118be6d1
[ "connected_indexes = []\nfor i in reversed(range(0, idx)):\n if row[i] == 1:\n connected_indexes.append(i)\n else:\n break\nfor i in range(idx, len(row)):\n if row[i] == 1:\n connected_indexes.append(i)\n else:\n break\nreturn connected_indexes", "opens = [i for i in pre_tu...
<|body_start_0|> connected_indexes = [] for i in reversed(range(0, idx)): if row[i] == 1: connected_indexes.append(i) else: break for i in range(idx, len(row)): if row[i] == 1: connected_indexes.append(i) ...
Percolation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Percolation: def expand_check(self, idx, row): """to check the valid tunnel connecting in this row starting from the tunnel point from last tunnel then expand the tunnel to all the indexes that is directly linked to tunnel connecting point""" <|body_0|> def isPercolate(self,...
stack_v2_sparse_classes_75kplus_train_006830
3,374
no_license
[ { "docstring": "to check the valid tunnel connecting in this row starting from the tunnel point from last tunnel then expand the tunnel to all the indexes that is directly linked to tunnel connecting point", "name": "expand_check", "signature": "def expand_check(self, idx, row)" }, { "docstring"...
3
stack_v2_sparse_classes_30k_train_012339
Implement the Python class `Percolation` described below. Class description: Implement the Percolation class. Method signatures and docstrings: - def expand_check(self, idx, row): to check the valid tunnel connecting in this row starting from the tunnel point from last tunnel then expand the tunnel to all the indexes...
Implement the Python class `Percolation` described below. Class description: Implement the Percolation class. Method signatures and docstrings: - def expand_check(self, idx, row): to check the valid tunnel connecting in this row starting from the tunnel point from last tunnel then expand the tunnel to all the indexes...
143422321cbc3715ca08f6c3af8f960a55887ced
<|skeleton|> class Percolation: def expand_check(self, idx, row): """to check the valid tunnel connecting in this row starting from the tunnel point from last tunnel then expand the tunnel to all the indexes that is directly linked to tunnel connecting point""" <|body_0|> def isPercolate(self,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Percolation: def expand_check(self, idx, row): """to check the valid tunnel connecting in this row starting from the tunnel point from last tunnel then expand the tunnel to all the indexes that is directly linked to tunnel connecting point""" connected_indexes = [] for i in reversed(ra...
the_stack_v2_python_sparse
QuickProjects/Algorithm/p01_percolation.py
jxie0755/Learning_Python
train
0
be7cf03f075ceb1caddbb63776fddc593f338b31
[ "bfs = collections.deque([root])\nserial_builder = []\nwhile len(bfs) > 0:\n curr = bfs.popleft()\n if curr is not None:\n serial_builder.append(str(curr.val))\n bfs.append(curr.left)\n bfs.append(curr.right)\n serial_builder.append(',')\nwhile len(serial_builder) > 0 and serial_builde...
<|body_start_0|> bfs = collections.deque([root]) serial_builder = [] while len(bfs) > 0: curr = bfs.popleft() if curr is not None: serial_builder.append(str(curr.val)) bfs.append(curr.left) bfs.append(curr.right) ...
Codec
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_006831
3,250
permissive
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
ad435df1bd95fb2c6e17d2d9ff349282c98ee0f4
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" bfs = collections.deque([root]) serial_builder = [] while len(bfs) > 0: curr = bfs.popleft() if curr is not None: serial_builder.a...
the_stack_v2_python_sparse
python3/297.serialize-and-deserialize-binary-tree.245224010.ac.py
Diego-Zulu/leetcode_answers
train
0
1407a1406d8f1f1aa6b85954f9263abc181dae20
[ "super(SRTM, self).__init__(site, **kwargs)\nif math.fabs(self.site.ul_lonlat[1]) > 60 or math.fabs(self.site.lr_lonlat[1]) > 60:\n raise ValueError('Latitude over +-60deg - No SRTM data available!')\nself.srtm_codes = self.get_srtm_codes(self.site)\nif not self.dem_version:\n self.dem_version = 1001", "fil...
<|body_start_0|> super(SRTM, self).__init__(site, **kwargs) if math.fabs(self.site.ul_lonlat[1]) > 60 or math.fabs(self.site.lr_lonlat[1]) > 60: raise ValueError('Latitude over +-60deg - No SRTM data available!') self.srtm_codes = self.get_srtm_codes(self.site) if not self.de...
Base class to get an SRTM DEM/MNT for a given site.
SRTM
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SRTM: """Base class to get an SRTM DEM/MNT for a given site.""" def __init__(self, site, **kwargs): """Initialise an SRTM-type DEM. :param site: The :class:`prepare_mnt.mnt.SiteInfo` struct containing the basic information. :param kwargs: Forwarded parameters to :class:`prepare_mnt.m...
stack_v2_sparse_classes_75kplus_train_006832
4,554
permissive
[ { "docstring": "Initialise an SRTM-type DEM. :param site: The :class:`prepare_mnt.mnt.SiteInfo` struct containing the basic information. :param kwargs: Forwarded parameters to :class:`prepare_mnt.mnt.MNTBase`", "name": "__init__", "signature": "def __init__(self, site, **kwargs)" }, { "docstring...
4
stack_v2_sparse_classes_30k_train_020683
Implement the Python class `SRTM` described below. Class description: Base class to get an SRTM DEM/MNT for a given site. Method signatures and docstrings: - def __init__(self, site, **kwargs): Initialise an SRTM-type DEM. :param site: The :class:`prepare_mnt.mnt.SiteInfo` struct containing the basic information. :pa...
Implement the Python class `SRTM` described below. Class description: Base class to get an SRTM DEM/MNT for a given site. Method signatures and docstrings: - def __init__(self, site, **kwargs): Initialise an SRTM-type DEM. :param site: The :class:`prepare_mnt.mnt.SiteInfo` struct containing the basic information. :pa...
9688780f8dd8244e60603e1f11385e1fadc90cb4
<|skeleton|> class SRTM: """Base class to get an SRTM DEM/MNT for a given site.""" def __init__(self, site, **kwargs): """Initialise an SRTM-type DEM. :param site: The :class:`prepare_mnt.mnt.SiteInfo` struct containing the basic information. :param kwargs: Forwarded parameters to :class:`prepare_mnt.m...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SRTM: """Base class to get an SRTM DEM/MNT for a given site.""" def __init__(self, site, **kwargs): """Initialise an SRTM-type DEM. :param site: The :class:`prepare_mnt.mnt.SiteInfo` struct containing the basic information. :param kwargs: Forwarded parameters to :class:`prepare_mnt.mnt.MNTBase`""...
the_stack_v2_python_sparse
StartMaja/prepare_mnt/mnt/SRTM.py
alexgoussev/maja_gitlab
train
0
8f53ddaf683c0a5a5d42b293ce8f4ad809593a51
[ "if params is not None:\n means = params[0]\n covs = params[1]\nelse:\n means = T.zeros_like(obs)\n covs = T.ones_like(obs)\nnormalisers = (2.0 * np.pi * covs) ** (-0.5)\ndensities = T.exp(-(obs - means) ** 2 / (2.0 * covs))\nreturn normalisers * densities", "if params is not None:\n means = params...
<|body_start_0|> if params is not None: means = params[0] covs = params[1] else: means = T.zeros_like(obs) covs = T.ones_like(obs) normalisers = (2.0 * np.pi * covs) ** (-0.5) densities = T.exp(-(obs - means) ** 2 / (2.0 * covs)) re...
Class for the multivariate Gaussian distribution with diagonal covariance structure
GaussianDiagonal
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GaussianDiagonal: """Class for the multivariate Gaussian distribution with diagonal covariance structure""" def density(self, obs, params=None): """Get the density of a point under the distribution :param obs: observation :param params: list of parameters mu, covs :return: density"""...
stack_v2_sparse_classes_75kplus_train_006833
4,232
permissive
[ { "docstring": "Get the density of a point under the distribution :param obs: observation :param params: list of parameters mu, covs :return: density", "name": "density", "signature": "def density(self, obs, params=None)" }, { "docstring": "Get the log-density of a point under the distribution :...
3
null
Implement the Python class `GaussianDiagonal` described below. Class description: Class for the multivariate Gaussian distribution with diagonal covariance structure Method signatures and docstrings: - def density(self, obs, params=None): Get the density of a point under the distribution :param obs: observation :para...
Implement the Python class `GaussianDiagonal` described below. Class description: Class for the multivariate Gaussian distribution with diagonal covariance structure Method signatures and docstrings: - def density(self, obs, params=None): Get the density of a point under the distribution :param obs: observation :para...
48a59c73b6afcabba457d65c7596a71b515533e6
<|skeleton|> class GaussianDiagonal: """Class for the multivariate Gaussian distribution with diagonal covariance structure""" def density(self, obs, params=None): """Get the density of a point under the distribution :param obs: observation :param params: list of parameters mu, covs :return: density"""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GaussianDiagonal: """Class for the multivariate Gaussian distribution with diagonal covariance structure""" def density(self, obs, params=None): """Get the density of a point under the distribution :param obs: observation :param params: list of parameters mu, covs :return: density""" if p...
the_stack_v2_python_sparse
Translation/src/tools/distributions.py
IsakFalk/project
train
0
30d363e37ac5d60d8851ce5fa025e3941fda4f84
[ "min_start = min((v.start for v in overlapping_variants))\nself.variant_indices = [(v.start - min_start, v.end - min_start) for v in overlapping_variants]\nself.size = max((v.end - min_start for v in overlapping_variants))", "if len(nonref_genotype_counts) != len(self.variant_indices):\n raise ValueError('Vari...
<|body_start_0|> min_start = min((v.start for v in overlapping_variants)) self.variant_indices = [(v.start - min_start, v.end - min_start) for v in overlapping_variants] self.size = max((v.end - min_start for v in overlapping_variants)) <|end_body_0|> <|body_start_1|> if len(nonref_geno...
Represents the reference genome spanned by overlapping Variants. Each Variant affects a portion of the reference genome that is determined by its start and end coordinates. For a given set of Variants, they are deemed compatible if the total area along the reference genome that is called as non-reference genotypes neve...
_VariantCompatibilityCalculator
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _VariantCompatibilityCalculator: """Represents the reference genome spanned by overlapping Variants. Each Variant affects a portion of the reference genome that is determined by its start and end coordinates. For a given set of Variants, they are deemed compatible if the total area along the refe...
stack_v2_sparse_classes_75kplus_train_006834
20,898
permissive
[ { "docstring": "Constructor. Args: overlapping_variants: list(Variant). The Variant protos of interest.", "name": "__init__", "signature": "def __init__(self, overlapping_variants)" }, { "docstring": "Returns True if and only if all variants are compatible. Args: nonref_genotype_counts: list of ...
2
stack_v2_sparse_classes_30k_train_018719
Implement the Python class `_VariantCompatibilityCalculator` described below. Class description: Represents the reference genome spanned by overlapping Variants. Each Variant affects a portion of the reference genome that is determined by its start and end coordinates. For a given set of Variants, they are deemed comp...
Implement the Python class `_VariantCompatibilityCalculator` described below. Class description: Represents the reference genome spanned by overlapping Variants. Each Variant affects a portion of the reference genome that is determined by its start and end coordinates. For a given set of Variants, they are deemed comp...
ab068c4588a02e2167051bd9e74c0c9579462b51
<|skeleton|> class _VariantCompatibilityCalculator: """Represents the reference genome spanned by overlapping Variants. Each Variant affects a portion of the reference genome that is determined by its start and end coordinates. For a given set of Variants, they are deemed compatible if the total area along the refe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _VariantCompatibilityCalculator: """Represents the reference genome spanned by overlapping Variants. Each Variant affects a portion of the reference genome that is determined by its start and end coordinates. For a given set of Variants, they are deemed compatible if the total area along the reference genome ...
the_stack_v2_python_sparse
deepvariant/haplotypes.py
google/deepvariant
train
3,002
fb6b85b6bba11054c5ec916cb67322b82dec70b6
[ "resp, body = self.get('/')\nbody = json.loads(body)\nself.expected_success(200, resp.status)\nreturn rest_client.ResponseBody(resp, body)", "resp, body = self.get(version + '/')\nbody = json.loads(body)\nself.expected_success(200, resp.status)\nreturn rest_client.ResponseBody(resp, body)" ]
<|body_start_0|> resp, body = self.get('/') body = json.loads(body) self.expected_success(200, resp.status) return rest_client.ResponseBody(resp, body) <|end_body_0|> <|body_start_1|> resp, body = self.get(version + '/') body = json.loads(body) self.expected_succ...
NetworkVersionsClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetworkVersionsClient: def list_versions(self): """Do a GET / to fetch available API version information. For more information, please refer to the official API reference: https://docs.openstack.org/api-ref/network/v2/index.html#list-api-versions""" <|body_0|> def show_versi...
stack_v2_sparse_classes_75kplus_train_006835
1,823
permissive
[ { "docstring": "Do a GET / to fetch available API version information. For more information, please refer to the official API reference: https://docs.openstack.org/api-ref/network/v2/index.html#list-api-versions", "name": "list_versions", "signature": "def list_versions(self)" }, { "docstring": ...
2
stack_v2_sparse_classes_30k_train_015527
Implement the Python class `NetworkVersionsClient` described below. Class description: Implement the NetworkVersionsClient class. Method signatures and docstrings: - def list_versions(self): Do a GET / to fetch available API version information. For more information, please refer to the official API reference: https:...
Implement the Python class `NetworkVersionsClient` described below. Class description: Implement the NetworkVersionsClient class. Method signatures and docstrings: - def list_versions(self): Do a GET / to fetch available API version information. For more information, please refer to the official API reference: https:...
3932a799e620a20d7abf7b89e21b520683a1809b
<|skeleton|> class NetworkVersionsClient: def list_versions(self): """Do a GET / to fetch available API version information. For more information, please refer to the official API reference: https://docs.openstack.org/api-ref/network/v2/index.html#list-api-versions""" <|body_0|> def show_versi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NetworkVersionsClient: def list_versions(self): """Do a GET / to fetch available API version information. For more information, please refer to the official API reference: https://docs.openstack.org/api-ref/network/v2/index.html#list-api-versions""" resp, body = self.get('/') body = js...
the_stack_v2_python_sparse
tempest/lib/services/network/versions_client.py
openstack/tempest
train
270
3eee3c20521da9edd15910b1581b27b1cb60cd9a
[ "super(SigprocReadBlock, self).__init__()\nself.filename = filename\nself.gulp_nframe = gulp_nframe\nself.core = core", "with SigprocFile().open(self.filename, 'rb') as ifile:\n ifile.read_header()\n ohdr = {}\n ohdr['frame_shape'] = (ifile.nchans, ifile.nifs)\n ohdr['frame_size'] = ifile.nchans * ifi...
<|body_start_0|> super(SigprocReadBlock, self).__init__() self.filename = filename self.gulp_nframe = gulp_nframe self.core = core <|end_body_0|> <|body_start_1|> with SigprocFile().open(self.filename, 'rb') as ifile: ifile.read_header() ohdr = {} ...
This block reads in a sigproc filterbank (.fil) file into a ring buffer
SigprocReadBlock
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SigprocReadBlock: """This block reads in a sigproc filterbank (.fil) file into a ring buffer""" def __init__(self, filename, gulp_nframe=4096, core=-1): """@param[in] filename filterbank file to read @param[in] gulp_nframe Time samples to read in at a time @param[in] core Which CPU c...
stack_v2_sparse_classes_75kplus_train_006836
49,813
permissive
[ { "docstring": "@param[in] filename filterbank file to read @param[in] gulp_nframe Time samples to read in at a time @param[in] core Which CPU core to bind to (-1) is any", "name": "__init__", "signature": "def __init__(self, filename, gulp_nframe=4096, core=-1)" }, { "docstring": "Read in the s...
2
stack_v2_sparse_classes_30k_test_001940
Implement the Python class `SigprocReadBlock` described below. Class description: This block reads in a sigproc filterbank (.fil) file into a ring buffer Method signatures and docstrings: - def __init__(self, filename, gulp_nframe=4096, core=-1): @param[in] filename filterbank file to read @param[in] gulp_nframe Time...
Implement the Python class `SigprocReadBlock` described below. Class description: This block reads in a sigproc filterbank (.fil) file into a ring buffer Method signatures and docstrings: - def __init__(self, filename, gulp_nframe=4096, core=-1): @param[in] filename filterbank file to read @param[in] gulp_nframe Time...
5a93e5d4e906694cf754ac4f1015640a710ffc02
<|skeleton|> class SigprocReadBlock: """This block reads in a sigproc filterbank (.fil) file into a ring buffer""" def __init__(self, filename, gulp_nframe=4096, core=-1): """@param[in] filename filterbank file to read @param[in] gulp_nframe Time samples to read in at a time @param[in] core Which CPU c...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SigprocReadBlock: """This block reads in a sigproc filterbank (.fil) file into a ring buffer""" def __init__(self, filename, gulp_nframe=4096, core=-1): """@param[in] filename filterbank file to read @param[in] gulp_nframe Time samples to read in at a time @param[in] core Which CPU core to bind t...
the_stack_v2_python_sparse
python/bifrost/block.py
ledatelescope/bifrost
train
66
d833109d33eefa34e3e65f9418ed3c29f020c052
[ "img, target = (self.data[index], int(self.targets[index]))\nimg = Image.fromarray(img.numpy(), mode='L')\ntransform = self.__get_transformation__(target)\nif transform is not None:\n img = transform(img)\nif self.target_transform is not None:\n exit(0)\n target = self.target_transform(target)\nreturn (img...
<|body_start_0|> img, target = (self.data[index], int(self.targets[index])) img = Image.fromarray(img.numpy(), mode='L') transform = self.__get_transformation__(target) if transform is not None: img = transform(img) if self.target_transform is not None: ex...
Extension of pytorch's FashionMNIST class to distinguish between classes.
CustomFashionMNIST
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomFashionMNIST: """Extension of pytorch's FashionMNIST class to distinguish between classes.""" def __getitem__(self, index): """Args: index (int): Index Returns: tuple: (image, target) where target is index of the target class.""" <|body_0|> def __get_transformation...
stack_v2_sparse_classes_75kplus_train_006837
1,406
no_license
[ { "docstring": "Args: index (int): Index Returns: tuple: (image, target) where target is index of the target class.", "name": "__getitem__", "signature": "def __getitem__(self, index)" }, { "docstring": "Returns the transformation if it is inside of a dictionary with labels as keys. :param label...
2
stack_v2_sparse_classes_30k_train_009654
Implement the Python class `CustomFashionMNIST` described below. Class description: Extension of pytorch's FashionMNIST class to distinguish between classes. Method signatures and docstrings: - def __getitem__(self, index): Args: index (int): Index Returns: tuple: (image, target) where target is index of the target c...
Implement the Python class `CustomFashionMNIST` described below. Class description: Extension of pytorch's FashionMNIST class to distinguish between classes. Method signatures and docstrings: - def __getitem__(self, index): Args: index (int): Index Returns: tuple: (image, target) where target is index of the target c...
0b15855e7222e17345d20ca946b0d86c2d1ae29d
<|skeleton|> class CustomFashionMNIST: """Extension of pytorch's FashionMNIST class to distinguish between classes.""" def __getitem__(self, index): """Args: index (int): Index Returns: tuple: (image, target) where target is index of the target class.""" <|body_0|> def __get_transformation...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CustomFashionMNIST: """Extension of pytorch's FashionMNIST class to distinguish between classes.""" def __getitem__(self, index): """Args: index (int): Index Returns: tuple: (image, target) where target is index of the target class.""" img, target = (self.data[index], int(self.targets[ind...
the_stack_v2_python_sparse
utils/data_loaders.py
Jeronics/fashion-mnist-test-case
train
0
09df73bb58594e6327779dccb78b9da47fa903e9
[ "super(SP_TransformerNetwork, self).__init__()\nself.power_list = self.cal_K(default_type)\nself.sigmoid = nn.Sigmoid()\nself.bn = nn.InstanceNorm2d(nc)", "from math import log\nx = []\nif k != 0:\n for i in range(1, k + 1):\n lower = round(log(1 - 0.5 / (k + 1) * i) / log(0.5 / (k + 1) * i), 2)\n ...
<|body_start_0|> super(SP_TransformerNetwork, self).__init__() self.power_list = self.cal_K(default_type) self.sigmoid = nn.Sigmoid() self.bn = nn.InstanceNorm2d(nc) <|end_body_0|> <|body_start_1|> from math import log x = [] if k != 0: for i in range...
Sturture-Preserving Transformation (SPT) as Equa. (2) in Ref. [1] Ref: [1] SPIN: Structure-Preserving Inner Offset Network for Scene Text Recognition. AAAI-2021.
SP_TransformerNetwork
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SP_TransformerNetwork: """Sturture-Preserving Transformation (SPT) as Equa. (2) in Ref. [1] Ref: [1] SPIN: Structure-Preserving Inner Offset Network for Scene Text Recognition. AAAI-2021.""" def __init__(self, nc=1, default_type=5): """Based on SPIN Args: nc (int): number of input ch...
stack_v2_sparse_classes_75kplus_train_006838
14,444
permissive
[ { "docstring": "Based on SPIN Args: nc (int): number of input channels (usually in 1 or 3) default_type (int): the complexity of transformation intensities (by default set to 6 as the paper)", "name": "__init__", "signature": "def __init__(self, nc=1, default_type=5)" }, { "docstring": "Args: k ...
3
stack_v2_sparse_classes_30k_train_043742
Implement the Python class `SP_TransformerNetwork` described below. Class description: Sturture-Preserving Transformation (SPT) as Equa. (2) in Ref. [1] Ref: [1] SPIN: Structure-Preserving Inner Offset Network for Scene Text Recognition. AAAI-2021. Method signatures and docstrings: - def __init__(self, nc=1, default_...
Implement the Python class `SP_TransformerNetwork` described below. Class description: Sturture-Preserving Transformation (SPT) as Equa. (2) in Ref. [1] Ref: [1] SPIN: Structure-Preserving Inner Offset Network for Scene Text Recognition. AAAI-2021. Method signatures and docstrings: - def __init__(self, nc=1, default_...
fb47a96d1a38f5ce634c6f12d710ed5300cc89fc
<|skeleton|> class SP_TransformerNetwork: """Sturture-Preserving Transformation (SPT) as Equa. (2) in Ref. [1] Ref: [1] SPIN: Structure-Preserving Inner Offset Network for Scene Text Recognition. AAAI-2021.""" def __init__(self, nc=1, default_type=5): """Based on SPIN Args: nc (int): number of input ch...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SP_TransformerNetwork: """Sturture-Preserving Transformation (SPT) as Equa. (2) in Ref. [1] Ref: [1] SPIN: Structure-Preserving Inner Offset Network for Scene Text Recognition. AAAI-2021.""" def __init__(self, nc=1, default_type=5): """Based on SPIN Args: nc (int): number of input channels (usual...
the_stack_v2_python_sparse
davarocr/davarocr/davar_rcg/models/transformations/spin_transformation.py
OCRWorld/DAVAR-Lab-OCR
train
0
91356981c6e69fba83be673ce5a2c0bf17cbf784
[ "ports = serial.tools.list_ports.comports(include_links=False)\nresults = []\nfor port in ports:\n results.append(str(port.device))\nreturn results", "avaliable_arduino_ports = self.avaliable_arduino_com()\nself.clear()\nfor avaliable_port in avaliable_arduino_ports:\n self.addItem(avaliable_port)\nsuper(Ar...
<|body_start_0|> ports = serial.tools.list_ports.comports(include_links=False) results = [] for port in ports: results.append(str(port.device)) return results <|end_body_0|> <|body_start_1|> avaliable_arduino_ports = self.avaliable_arduino_com() self.clear() ...
This class allows the combobox to recognize arduinos connected as soon as the user clicks the combobox.
ArduinoComboBox
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArduinoComboBox: """This class allows the combobox to recognize arduinos connected as soon as the user clicks the combobox.""" def avaliable_arduino_com(self): """This fuction returns all the available COM ports in a list of strings.""" <|body_0|> def showPopup(self): ...
stack_v2_sparse_classes_75kplus_train_006839
33,787
permissive
[ { "docstring": "This fuction returns all the available COM ports in a list of strings.", "name": "avaliable_arduino_com", "signature": "def avaliable_arduino_com(self)" }, { "docstring": "This function appends to the original showPopup function from the QComboBox by adding the avaliable arduino ...
2
stack_v2_sparse_classes_30k_train_030998
Implement the Python class `ArduinoComboBox` described below. Class description: This class allows the combobox to recognize arduinos connected as soon as the user clicks the combobox. Method signatures and docstrings: - def avaliable_arduino_com(self): This fuction returns all the available COM ports in a list of st...
Implement the Python class `ArduinoComboBox` described below. Class description: This class allows the combobox to recognize arduinos connected as soon as the user clicks the combobox. Method signatures and docstrings: - def avaliable_arduino_com(self): This fuction returns all the available COM ports in a list of st...
72e742611ba96b0df542781ded0685f525bea82b
<|skeleton|> class ArduinoComboBox: """This class allows the combobox to recognize arduinos connected as soon as the user clicks the combobox.""" def avaliable_arduino_com(self): """This fuction returns all the available COM ports in a list of strings.""" <|body_0|> def showPopup(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ArduinoComboBox: """This class allows the combobox to recognize arduinos connected as soon as the user clicks the combobox.""" def avaliable_arduino_com(self): """This fuction returns all the available COM ports in a list of strings.""" ports = serial.tools.list_ports.comports(include_lin...
the_stack_v2_python_sparse
Software/python/config_dialog.py
edavalosanaya/SKORE
train
2
1f806ff3816176218de728a213e79e4962c51361
[ "if not root:\n return '#'\ntmp = [str(root.val)]\ntmp += [self.serialize(root.left)]\ntmp += [self.serialize(root.right)]\nreturn ' '.join(tmp)", "data = data.split(' ')\n\ndef decode(data):\n if not data:\n return None\n curr = data.pop(0)\n if curr == '#':\n return None\n node = Tr...
<|body_start_0|> if not root: return '#' tmp = [str(root.val)] tmp += [self.serialize(root.left)] tmp += [self.serialize(root.right)] return ' '.join(tmp) <|end_body_0|> <|body_start_1|> data = data.split(' ') def decode(data): if not dat...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_006840
961
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
3caa324123c6ff62ed1e2e795915c7d9f9a8c57f
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '#' tmp = [str(root.val)] tmp += [self.serialize(root.left)] tmp += [self.serialize(root.right)] return ' '.join(tmp) ...
the_stack_v2_python_sparse
problems/serialize_deserialize_tree.py
celisun/LC19
train
0
e03a23c0ad780e473b43fe52800f845373992ef3
[ "CtrlDev.__init__(self, parent)\nself._diag = DiagUsb(self)\nself._compat = CompatUsb(self)\nself._guiClass = GUIUsb", "self._callInfo()\nself._callCompat()\nself._callDiag()" ]
<|body_start_0|> CtrlDev.__init__(self, parent) self._diag = DiagUsb(self) self._compat = CompatUsb(self) self._guiClass = GUIUsb <|end_body_0|> <|body_start_1|> self._callInfo() self._callCompat() self._callDiag() <|end_body_1|>
Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificacao, compatibilidade, diagnostico e cria a tela de exibicao.
CtrlUsb
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CtrlUsb: """Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificacao, compatibilidade, diagnostico e cria a tela de exibicao.""" def __init__(self, parent): """Construtor que inicializa os atributos '_diag', '_compat' e '_guiClass' definidos na classe base ...
stack_v2_sparse_classes_75kplus_train_006841
1,097
no_license
[ { "docstring": "Construtor que inicializa os atributos '_diag', '_compat' e '_guiClass' definidos na classe base 'CtrlDev'.", "name": "__init__", "signature": "def __init__(self, parent)" }, { "docstring": "Executa o info, compat e diag (dependendo do resultado do compatibilidade) e cria as tela...
2
stack_v2_sparse_classes_30k_train_048370
Implement the Python class `CtrlUsb` described below. Class description: Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificacao, compatibilidade, diagnostico e cria a tela de exibicao. Method signatures and docstrings: - def __init__(self, parent): Construtor que inicializa os atributos '...
Implement the Python class `CtrlUsb` described below. Class description: Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificacao, compatibilidade, diagnostico e cria a tela de exibicao. Method signatures and docstrings: - def __init__(self, parent): Construtor que inicializa os atributos '...
bda0c2c8977dd1246339f1f0f4718d29e8795f21
<|skeleton|> class CtrlUsb: """Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificacao, compatibilidade, diagnostico e cria a tela de exibicao.""" def __init__(self, parent): """Construtor que inicializa os atributos '_diag', '_compat' e '_guiClass' definidos na classe base ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CtrlUsb: """Estende a classe 'CtrlDev'. Classe de controle que chama os testes de identificacao, compatibilidade, diagnostico e cria a tela de exibicao.""" def __init__(self, parent): """Construtor que inicializa os atributos '_diag', '_compat' e '_guiClass' definidos na classe base 'CtrlDev'."""...
the_stack_v2_python_sparse
src/libs/usb/ctrl_usb.py
adrianomelo/ldc-desktop
train
1
4e3b956e49d316fc39a312447a6c40fce850868e
[ "self.user_tweet_map = {}\nself.follower_followee_map = {}\nself.tweet_time_map = {}\nself.tweet_time_count = 0", "if userId in self.user_tweet_map:\n self.user_tweet_map.get(userId).append(tweetId)\nelse:\n self.user_tweet_map[userId] = [tweetId]\nself.tweet_time_count += 1\nself.tweet_time_map[tweetId] = ...
<|body_start_0|> self.user_tweet_map = {} self.follower_followee_map = {} self.tweet_time_map = {} self.tweet_time_count = 0 <|end_body_0|> <|body_start_1|> if userId in self.user_tweet_map: self.user_tweet_map.get(userId).append(tweetId) else: se...
Twitter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId, tweetId): """Compose a new tweet. :type userId: int :type tweetId: int :rtype: void""" <|body_1|> def getNewsFeed(self, userId): """Ret...
stack_v2_sparse_classes_75kplus_train_006842
5,253
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Compose a new tweet. :type userId: int :type tweetId: int :rtype: void", "name": "postTweet", "signature": "def postTweet(self, userId, tweetId)" }, { "...
5
null
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId, tweetId): Compose a new tweet. :type userId: int :type tweetId: int :rtype: void - def getNew...
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId, tweetId): Compose a new tweet. :type userId: int :type tweetId: int :rtype: void - def getNew...
052bd7915257679877dbe55b60ed1abb7528eaa2
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId, tweetId): """Compose a new tweet. :type userId: int :type tweetId: int :rtype: void""" <|body_1|> def getNewsFeed(self, userId): """Ret...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Twitter: def __init__(self): """Initialize your data structure here.""" self.user_tweet_map = {} self.follower_followee_map = {} self.tweet_time_map = {} self.tweet_time_count = 0 def postTweet(self, userId, tweetId): """Compose a new tweet. :type userId: i...
the_stack_v2_python_sparse
python_solution/Combination/355_DesignTwitter.py
Dimen61/leetcode
train
4
7f0869daf5ad82c7c601fe520782a73940adefee
[ "H, C, W = self.shape\ndtype = self.channel_types[0]\nDS = np.dtype(dtype).itemsize\nSOFF = 8 + DS * W * C\nstrides = (SOFF, DS * W, DS)\nnbytes = SOFF * H\nself.fp.seek(self.first_offset, 0)\nimage = np.frombuffer(self.fp.read(nbytes), dtype=dtype, count=-1, offset=8)\nself.image = np.lib.stride_tricks.as_strided(...
<|body_start_0|> H, C, W = self.shape dtype = self.channel_types[0] DS = np.dtype(dtype).itemsize SOFF = 8 + DS * W * C strides = (SOFF, DS * W, DS) nbytes = SOFF * H self.fp.seek(self.first_offset, 0) image = np.frombuffer(self.fp.read(nbytes), dtype=dtyp...
ExrReader
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExrReader: def _read_image(self): """Override original _read_image, since that one assumes ims are float16 but we use float32 here""" <|body_0|> def _read_header(self): """Override original _read_header, since that one doesn't allow for cycles' long attribute names""...
stack_v2_sparse_classes_75kplus_train_006843
6,993
permissive
[ { "docstring": "Override original _read_image, since that one assumes ims are float16 but we use float32 here", "name": "_read_image", "signature": "def _read_image(self)" }, { "docstring": "Override original _read_header, since that one doesn't allow for cycles' long attribute names", "name...
2
stack_v2_sparse_classes_30k_train_041641
Implement the Python class `ExrReader` described below. Class description: Implement the ExrReader class. Method signatures and docstrings: - def _read_image(self): Override original _read_image, since that one assumes ims are float16 but we use float32 here - def _read_header(self): Override original _read_header, s...
Implement the Python class `ExrReader` described below. Class description: Implement the ExrReader class. Method signatures and docstrings: - def _read_image(self): Override original _read_image, since that one assumes ims are float16 but we use float32 here - def _read_header(self): Override original _read_header, s...
0b1157a6601106d4c8387c13703000e26a2937aa
<|skeleton|> class ExrReader: def _read_image(self): """Override original _read_image, since that one assumes ims are float16 but we use float32 here""" <|body_0|> def _read_header(self): """Override original _read_header, since that one doesn't allow for cycles' long attribute names""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExrReader: def _read_image(self): """Override original _read_image, since that one assumes ims are float16 but we use float32 here""" H, C, W = self.shape dtype = self.channel_types[0] DS = np.dtype(dtype).itemsize SOFF = 8 + DS * W * C strides = (SOFF, DS * W, ...
the_stack_v2_python_sparse
bpycv/exr_image_parser.py
DIYer22/bpycv
train
398
b378cb9ed44b6c757c9d8c607cbd3dc0b2f5469e
[ "self.suite_plan_finder = suite_plan_finder.SuitePlanFinder()\nself.suite_plan_finder.suite_plan_dirs = [os.path.join(uc.ROOT, uc.CTS_INT_DIR)]\nself.suite_plan_finder.root_dir = uc.ROOT", "suite_plan = 'cts'\npath = os.path.join(uc.ROOT, uc.CTS_INT_DIR, suite_plan + '.xml')\nwant_info = test_info.TestInfo(test_n...
<|body_start_0|> self.suite_plan_finder = suite_plan_finder.SuitePlanFinder() self.suite_plan_finder.suite_plan_dirs = [os.path.join(uc.ROOT, uc.CTS_INT_DIR)] self.suite_plan_finder.root_dir = uc.ROOT <|end_body_0|> <|body_start_1|> suite_plan = 'cts' path = os.path.join(uc.ROOT...
Unit tests for suite_plan_finder.py
SuitePlanFinderUnittests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SuitePlanFinderUnittests: """Unit tests for suite_plan_finder.py""" def setUp(self): """Set up stuff for testing.""" <|body_0|> def test_get_test_info_from_path(self): """Test _get_test_info_from_path. Strategy: If suite_path is to cts file --> test_info: test_na...
stack_v2_sparse_classes_75kplus_train_006844
9,006
no_license
[ { "docstring": "Set up stuff for testing.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test _get_test_info_from_path. Strategy: If suite_path is to cts file --> test_info: test_name=cts, test_runner=TestSuiteTestRunner, build_target=set(['cts'] suite='cts') If suite_path ...
4
stack_v2_sparse_classes_30k_train_034943
Implement the Python class `SuitePlanFinderUnittests` described below. Class description: Unit tests for suite_plan_finder.py Method signatures and docstrings: - def setUp(self): Set up stuff for testing. - def test_get_test_info_from_path(self): Test _get_test_info_from_path. Strategy: If suite_path is to cts file -...
Implement the Python class `SuitePlanFinderUnittests` described below. Class description: Unit tests for suite_plan_finder.py Method signatures and docstrings: - def setUp(self): Set up stuff for testing. - def test_get_test_info_from_path(self): Test _get_test_info_from_path. Strategy: If suite_path is to cts file -...
78a61ca023cbf1a0cecfef8b97df2b274ac3a988
<|skeleton|> class SuitePlanFinderUnittests: """Unit tests for suite_plan_finder.py""" def setUp(self): """Set up stuff for testing.""" <|body_0|> def test_get_test_info_from_path(self): """Test _get_test_info_from_path. Strategy: If suite_path is to cts file --> test_info: test_na...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SuitePlanFinderUnittests: """Unit tests for suite_plan_finder.py""" def setUp(self): """Set up stuff for testing.""" self.suite_plan_finder = suite_plan_finder.SuitePlanFinder() self.suite_plan_finder.suite_plan_dirs = [os.path.join(uc.ROOT, uc.CTS_INT_DIR)] self.suite_pla...
the_stack_v2_python_sparse
tools/asuite/atest/test_finders/suite_plan_finder_unittest.py
ZYHGOD-1/Aosp11
train
0
b9faf9508138c607caf24b0d0aeb3b43bda9d1ed
[ "super().__init__(triples_factory=triples_factory, num_negs_per_pos=num_negs_per_pos, filtered=filtered)\nself.corruption_scheme = corruption_scheme or ('h', 't')\nself._corruption_indices = [LOOKUP[side] for side in self.corruption_scheme]", "if self.num_negs_per_pos > 1:\n positive_batch = positive_batch.rep...
<|body_start_0|> super().__init__(triples_factory=triples_factory, num_negs_per_pos=num_negs_per_pos, filtered=filtered) self.corruption_scheme = corruption_scheme or ('h', 't') self._corruption_indices = [LOOKUP[side] for side in self.corruption_scheme] <|end_body_0|> <|body_start_1|> ...
A basic negative sampler. This negative sampler that corrupts positive triples $(h,r,t) \\in \\mathcal{K}$ by replacing either $h$, $r$ or $t$ based on the chosen corruption scheme. The corruption scheme can contain $h$, $r$ and $t$ or any subset of these. Steps: 1. Randomly (uniformly) determine whether $h$, $r$ or $t...
BasicNegativeSampler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicNegativeSampler: """A basic negative sampler. This negative sampler that corrupts positive triples $(h,r,t) \\in \\mathcal{K}$ by replacing either $h$, $r$ or $t$ based on the chosen corruption scheme. The corruption scheme can contain $h$, $r$ and $t$ or any subset of these. Steps: 1. Rando...
stack_v2_sparse_classes_75kplus_train_006845
4,652
permissive
[ { "docstring": "Initialize the negative sampler with the given entities. :param triples_factory: The factory holding the triples to sample from :param num_negs_per_pos: Number of negative samples to make per positive triple. Defaults to 1. :param filtered: Whether proposed corrupted triples that are in the trai...
2
stack_v2_sparse_classes_30k_train_034926
Implement the Python class `BasicNegativeSampler` described below. Class description: A basic negative sampler. This negative sampler that corrupts positive triples $(h,r,t) \\in \\mathcal{K}$ by replacing either $h$, $r$ or $t$ based on the chosen corruption scheme. The corruption scheme can contain $h$, $r$ and $t$ ...
Implement the Python class `BasicNegativeSampler` described below. Class description: A basic negative sampler. This negative sampler that corrupts positive triples $(h,r,t) \\in \\mathcal{K}$ by replacing either $h$, $r$ or $t$ based on the chosen corruption scheme. The corruption scheme can contain $h$, $r$ and $t$ ...
eeaf1d623aa881c0c897772372988390e1d8302d
<|skeleton|> class BasicNegativeSampler: """A basic negative sampler. This negative sampler that corrupts positive triples $(h,r,t) \\in \\mathcal{K}$ by replacing either $h$, $r$ or $t$ based on the chosen corruption scheme. The corruption scheme can contain $h$, $r$ and $t$ or any subset of these. Steps: 1. Rando...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BasicNegativeSampler: """A basic negative sampler. This negative sampler that corrupts positive triples $(h,r,t) \\in \\mathcal{K}$ by replacing either $h$, $r$ or $t$ based on the chosen corruption scheme. The corruption scheme can contain $h$, $r$ and $t$ or any subset of these. Steps: 1. Randomly (uniforml...
the_stack_v2_python_sparse
src/pykeen/sampling/basic_negative_sampler.py
Moon-xm/pykeen
train
1
9f698b853477b6f876f0a946e8dad425a05bedb7
[ "if not date_string and (not time_string):\n raise errors.ParseError('Missing date or time string.')\ntry:\n month_string, day_of_month_string, year_string = date_string.split('/')\n year = int(year_string, 10)\n month = int(month_string, 10)\n day_of_month = int(day_of_month_string, 10)\nexcept (Att...
<|body_start_0|> if not date_string and (not time_string): raise errors.ParseError('Missing date or time string.') try: month_string, day_of_month_string, year_string = date_string.split('/') year = int(year_string, 10) month = int(month_string, 10) ...
Parses the McAfee AV Access Protection Log.
McafeeAccessProtectionParser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class McafeeAccessProtectionParser: """Parses the McAfee AV Access Protection Log.""" def _CreateDateTime(self, date_string, time_string): """Creates a date time value from the date time strings. The format stores the date and time as 2 separate strings separated by a tab. The time is in l...
stack_v2_sparse_classes_75kplus_train_006846
6,022
permissive
[ { "docstring": "Creates a date time value from the date time strings. The format stores the date and time as 2 separate strings separated by a tab. The time is in local time. The month and day can be either 1 or 2 characters long, for example: \"7/30/2013\\\\t10:22:48 AM\" Args: date_string (str): date string. ...
3
stack_v2_sparse_classes_30k_train_010724
Implement the Python class `McafeeAccessProtectionParser` described below. Class description: Parses the McAfee AV Access Protection Log. Method signatures and docstrings: - def _CreateDateTime(self, date_string, time_string): Creates a date time value from the date time strings. The format stores the date and time a...
Implement the Python class `McafeeAccessProtectionParser` described below. Class description: Parses the McAfee AV Access Protection Log. Method signatures and docstrings: - def _CreateDateTime(self, date_string, time_string): Creates a date time value from the date time strings. The format stores the date and time a...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class McafeeAccessProtectionParser: """Parses the McAfee AV Access Protection Log.""" def _CreateDateTime(self, date_string, time_string): """Creates a date time value from the date time strings. The format stores the date and time as 2 separate strings separated by a tab. The time is in l...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class McafeeAccessProtectionParser: """Parses the McAfee AV Access Protection Log.""" def _CreateDateTime(self, date_string, time_string): """Creates a date time value from the date time strings. The format stores the date and time as 2 separate strings separated by a tab. The time is in local time. Th...
the_stack_v2_python_sparse
plaso/parsers/mcafeeav.py
log2timeline/plaso
train
1,506
ee67d5cd5b790a807698b12233d15949a1caa381
[ "for i in range(1, len(s), 1):\n if len(s) % i == 0:\n t = s[0:i]\n if self.isit(s, t):\n return True\nreturn False", "for i in range(0, len(s), len(t)):\n if s[i:i + len(t)] != t:\n return False\nreturn True" ]
<|body_start_0|> for i in range(1, len(s), 1): if len(s) % i == 0: t = s[0:i] if self.isit(s, t): return True return False <|end_body_0|> <|body_start_1|> for i in range(0, len(s), len(t)): if s[i:i + len(t)] != t: ...
静态类
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """静态类""" def repeatedSubstringPattern(self, s: str) -> bool: """题目要求 :param s: :return:""" <|body_0|> def isit(self, s: str, t: str) -> bool: """判断t是否是S的循环子串 :param s: 大串 :param t: 小串 :return: bool""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_75kplus_train_006847
891
no_license
[ { "docstring": "题目要求 :param s: :return:", "name": "repeatedSubstringPattern", "signature": "def repeatedSubstringPattern(self, s: str) -> bool" }, { "docstring": "判断t是否是S的循环子串 :param s: 大串 :param t: 小串 :return: bool", "name": "isit", "signature": "def isit(self, s: str, t: str) -> bool" ...
2
stack_v2_sparse_classes_30k_train_020784
Implement the Python class `Solution` described below. Class description: 静态类 Method signatures and docstrings: - def repeatedSubstringPattern(self, s: str) -> bool: 题目要求 :param s: :return: - def isit(self, s: str, t: str) -> bool: 判断t是否是S的循环子串 :param s: 大串 :param t: 小串 :return: bool
Implement the Python class `Solution` described below. Class description: 静态类 Method signatures and docstrings: - def repeatedSubstringPattern(self, s: str) -> bool: 题目要求 :param s: :return: - def isit(self, s: str, t: str) -> bool: 判断t是否是S的循环子串 :param s: 大串 :param t: 小串 :return: bool <|skeleton|> class Solution: ...
c7becb56e207ee2de6dbf662c98db7eb5b9471ff
<|skeleton|> class Solution: """静态类""" def repeatedSubstringPattern(self, s: str) -> bool: """题目要求 :param s: :return:""" <|body_0|> def isit(self, s: str, t: str) -> bool: """判断t是否是S的循环子串 :param s: 大串 :param t: 小串 :return: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """静态类""" def repeatedSubstringPattern(self, s: str) -> bool: """题目要求 :param s: :return:""" for i in range(1, len(s), 1): if len(s) % i == 0: t = s[0:i] if self.isit(s, t): return True return False def ...
the_stack_v2_python_sparse
problemset/459. 重复的子字符串/solution.py
KevenGe/LeetCode-Solutions
train
1
135e3bb45694183e0d5d7638d2502879384ebd1d
[ "for integer, numeral in self.known_values:\n result = roman_numeral.to_roman(integer)\n self.assertEqual(numeral, result)", "for integer, numeral in self.known_values:\n result = roman_numeral.from_roman(numeral)\n self.assertEqual(integer, result)" ]
<|body_start_0|> for integer, numeral in self.known_values: result = roman_numeral.to_roman(integer) self.assertEqual(numeral, result) <|end_body_0|> <|body_start_1|> for integer, numeral in self.known_values: result = roman_numeral.from_roman(numeral) se...
KnownValues
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KnownValues: def test_to_roman_known_values(self): """to_roman should give known result with known input""" <|body_0|> def test_from_roman_known_values(self): """from_roman should give known result with known input""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_75kplus_train_006848
4,436
permissive
[ { "docstring": "to_roman should give known result with known input", "name": "test_to_roman_known_values", "signature": "def test_to_roman_known_values(self)" }, { "docstring": "from_roman should give known result with known input", "name": "test_from_roman_known_values", "signature": "d...
2
stack_v2_sparse_classes_30k_train_033568
Implement the Python class `KnownValues` described below. Class description: Implement the KnownValues class. Method signatures and docstrings: - def test_to_roman_known_values(self): to_roman should give known result with known input - def test_from_roman_known_values(self): from_roman should give known result with ...
Implement the Python class `KnownValues` described below. Class description: Implement the KnownValues class. Method signatures and docstrings: - def test_to_roman_known_values(self): to_roman should give known result with known input - def test_from_roman_known_values(self): from_roman should give known result with ...
f6697489389406ec00e0583ffa9eb738bdbd650c
<|skeleton|> class KnownValues: def test_to_roman_known_values(self): """to_roman should give known result with known input""" <|body_0|> def test_from_roman_known_values(self): """from_roman should give known result with known input""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KnownValues: def test_to_roman_known_values(self): """to_roman should give known result with known input""" for integer, numeral in self.known_values: result = roman_numeral.to_roman(integer) self.assertEqual(numeral, result) def test_from_roman_known_values(self):...
the_stack_v2_python_sparse
python/Oct22/test-roman.py
souradeepta/leetcode-practice
train
1
2b3b932f4d6a7722c9cb668aede8ec9de32cecdd
[ "self.client = MongoClient('db.infinity.buda.link', 27017, connect=False)\nself.db = self.client.styria\nself.documents = self.db.documents\ncount = self.documents.count()\nif count <= 0:\n files = parser.parse('../20news-18828', 'iso-8859-1')\n for file_name, file_content in files.items():\n self.inse...
<|body_start_0|> self.client = MongoClient('db.infinity.buda.link', 27017, connect=False) self.db = self.client.styria self.documents = self.db.documents count = self.documents.count() if count <= 0: files = parser.parse('../20news-18828', 'iso-8859-1') fo...
DocumentBase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DocumentBase: def __init__(self): """Create db connection and load data from the local folder.""" <|body_0|> def insert(self, content): """Private method for mongodb insertion operation.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.client = ...
stack_v2_sparse_classes_75kplus_train_006849
4,283
no_license
[ { "docstring": "Create db connection and load data from the local folder.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Private method for mongodb insertion operation.", "name": "insert", "signature": "def insert(self, content)" } ]
2
stack_v2_sparse_classes_30k_train_038323
Implement the Python class `DocumentBase` described below. Class description: Implement the DocumentBase class. Method signatures and docstrings: - def __init__(self): Create db connection and load data from the local folder. - def insert(self, content): Private method for mongodb insertion operation.
Implement the Python class `DocumentBase` described below. Class description: Implement the DocumentBase class. Method signatures and docstrings: - def __init__(self): Create db connection and load data from the local folder. - def insert(self, content): Private method for mongodb insertion operation. <|skeleton|> c...
51d31b936d1ad249a284adaff8338693ede2cb5a
<|skeleton|> class DocumentBase: def __init__(self): """Create db connection and load data from the local folder.""" <|body_0|> def insert(self, content): """Private method for mongodb insertion operation.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DocumentBase: def __init__(self): """Create db connection and load data from the local folder.""" self.client = MongoClient('db.infinity.buda.link', 27017, connect=False) self.db = self.client.styria self.documents = self.db.documents count = self.documents.count() ...
the_stack_v2_python_sparse
database/rest.py
gitbuda/infinity
train
2
d9bb81a4c648ca92f8e753db6a63f96372010783
[ "path = os.path.join(URDF_ROOT, self.filepath)\norn = pybullet.getQuaternionFromEuler(self.orientation)\ncollisionScale = self.scale\nself.visualShapeId = physics.createVisualShape(shapeType=pybullet.GEOM_MESH, fileName=path, rgbaColor=self.rgbaColor, specularColor=self.specularColor, visualFramePosition=self.shift...
<|body_start_0|> path = os.path.join(URDF_ROOT, self.filepath) orn = pybullet.getQuaternionFromEuler(self.orientation) collisionScale = self.scale self.visualShapeId = physics.createVisualShape(shapeType=pybullet.GEOM_MESH, fileName=path, rgbaColor=self.rgbaColor, specularColor=self.spec...
PhysicsObject
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PhysicsObject: def __init__(self, physics, position, orientation, visual_only=True): """Create a new object at position and orientation""" <|body_0|> def move(self, X, Y, Z, orientation=None): """Move an object to position X,Y,Z in the global coordinate system Vertic...
stack_v2_sparse_classes_75kplus_train_006850
5,491
permissive
[ { "docstring": "Create a new object at position and orientation", "name": "__init__", "signature": "def __init__(self, physics, position, orientation, visual_only=True)" }, { "docstring": "Move an object to position X,Y,Z in the global coordinate system Vertical position and orientation are not ...
3
stack_v2_sparse_classes_30k_train_034904
Implement the Python class `PhysicsObject` described below. Class description: Implement the PhysicsObject class. Method signatures and docstrings: - def __init__(self, physics, position, orientation, visual_only=True): Create a new object at position and orientation - def move(self, X, Y, Z, orientation=None): Move ...
Implement the Python class `PhysicsObject` described below. Class description: Implement the PhysicsObject class. Method signatures and docstrings: - def __init__(self, physics, position, orientation, visual_only=True): Create a new object at position and orientation - def move(self, X, Y, Z, orientation=None): Move ...
6eed945af797f164dddd0d69a7f47183b621db22
<|skeleton|> class PhysicsObject: def __init__(self, physics, position, orientation, visual_only=True): """Create a new object at position and orientation""" <|body_0|> def move(self, X, Y, Z, orientation=None): """Move an object to position X,Y,Z in the global coordinate system Vertic...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PhysicsObject: def __init__(self, physics, position, orientation, visual_only=True): """Create a new object at position and orientation""" path = os.path.join(URDF_ROOT, self.filepath) orn = pybullet.getQuaternionFromEuler(self.orientation) collisionScale = self.scale s...
the_stack_v2_python_sparse
src/simulator/sim/simulation/environment/simulation_objects.py
maxkferg/point-cloud-buffers
train
8
8ed482b63451820da2bc1cabca72f67d9c4be799
[ "table_name = os.environ.get('CHANNEL_ACCESS_TOKEN_DB')\nsuper().__init__(table_name)\nself._table = self._db.Table(table_name)", "key = {'channelId': channel_id}\ntry:\n item = self._get_item(key)\nexcept Exception as e:\n raise e\nreturn item", "key = {'channelId': channel_id}\nexpression = 'set channel...
<|body_start_0|> table_name = os.environ.get('CHANNEL_ACCESS_TOKEN_DB') super().__init__(table_name) self._table = self._db.Table(table_name) <|end_body_0|> <|body_start_1|> key = {'channelId': channel_id} try: item = self._get_item(key) except Exception as e...
ChannelAccessToken操作用クラス
ChannelAccessToken
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChannelAccessToken: """ChannelAccessToken操作用クラス""" def __init__(self): """初期化メソッド""" <|body_0|> def get_item(self, channel_id): """channelIdからアイテムを取得する Parameters ---------- channel_id : str チャネルID Returns ------- item : dict チャネルの情報""" <|body_1|> de...
stack_v2_sparse_classes_75kplus_train_006851
2,804
permissive
[ { "docstring": "初期化メソッド", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "channelIdからアイテムを取得する Parameters ---------- channel_id : str チャネルID Returns ------- item : dict チャネルの情報", "name": "get_item", "signature": "def get_item(self, channel_id)" }, { "docs...
4
stack_v2_sparse_classes_30k_train_023879
Implement the Python class `ChannelAccessToken` described below. Class description: ChannelAccessToken操作用クラス Method signatures and docstrings: - def __init__(self): 初期化メソッド - def get_item(self, channel_id): channelIdからアイテムを取得する Parameters ---------- channel_id : str チャネルID Returns ------- item : dict チャネルの情報 - def up...
Implement the Python class `ChannelAccessToken` described below. Class description: ChannelAccessToken操作用クラス Method signatures and docstrings: - def __init__(self): 初期化メソッド - def get_item(self, channel_id): channelIdからアイテムを取得する Parameters ---------- channel_id : str チャネルID Returns ------- item : dict チャネルの情報 - def up...
5667bc2d1db6d60950d8b9b6d6265e56b406ea1f
<|skeleton|> class ChannelAccessToken: """ChannelAccessToken操作用クラス""" def __init__(self): """初期化メソッド""" <|body_0|> def get_item(self, channel_id): """channelIdからアイテムを取得する Parameters ---------- channel_id : str チャネルID Returns ------- item : dict チャネルの情報""" <|body_1|> de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ChannelAccessToken: """ChannelAccessToken操作用クラス""" def __init__(self): """初期化メソッド""" table_name = os.environ.get('CHANNEL_ACCESS_TOKEN_DB') super().__init__(table_name) self._table = self._db.Table(table_name) def get_item(self, channel_id): """channelIdからアイテム...
the_stack_v2_python_sparse
backend/Layer/layer/common/channel_access_token.py
tacck/line-api-use-case-smart-retail
train
1
96583bc8c5ec1f6d0656edc10035738d24ee5b0c
[ "self.prefix_list = defaultdict(list)\nself.prefix_set = defaultdict(dict)\nself.suffix_list = defaultdict(list)\nself.suffix_set = defaultdict(dict)\nfor i in reversed(range(len(words))):\n for j in range(len(words[i]) + 1):\n prefix = words[i][0:j]\n suffix = words[i][j:len(words[i])]\n se...
<|body_start_0|> self.prefix_list = defaultdict(list) self.prefix_set = defaultdict(dict) self.suffix_list = defaultdict(list) self.suffix_set = defaultdict(dict) for i in reversed(range(len(words))): for j in range(len(words[i]) + 1): prefix = words[i...
WordFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordFilter: def __init__(self, words): """:type words: List[str]""" <|body_0|> def f(self, prefix, suffix): """:type prefix: str :type suffix: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.prefix_list = defaultdict(list) ...
stack_v2_sparse_classes_75kplus_train_006852
1,570
no_license
[ { "docstring": ":type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type prefix: str :type suffix: str :rtype: int", "name": "f", "signature": "def f(self, prefix, suffix)" } ]
2
stack_v2_sparse_classes_30k_train_039771
Implement the Python class `WordFilter` described below. Class description: Implement the WordFilter class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int
Implement the Python class `WordFilter` described below. Class description: Implement the WordFilter class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int <|skeleton|> class WordFilter: def __in...
516d5f08fc9b1b71b14d43687221a06d07dc51fc
<|skeleton|> class WordFilter: def __init__(self, words): """:type words: List[str]""" <|body_0|> def f(self, prefix, suffix): """:type prefix: str :type suffix: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WordFilter: def __init__(self, words): """:type words: List[str]""" self.prefix_list = defaultdict(list) self.prefix_set = defaultdict(dict) self.suffix_list = defaultdict(list) self.suffix_set = defaultdict(dict) for i in reversed(range(len(words))): ...
the_stack_v2_python_sparse
src/_745_1.py
lydxlx1/LeetCode
train
110
5ede4684b5bc30d8711e8b58d9c627957b27f22c
[ "self.spectra = data\nn_spectra, n_bands = data.shape\nif header is None:\n header = {}\nheader = header.copy()\nself.bands = BandInfo()\ncenters = header.pop('wavelength', None)\nif centers is not None:\n if len(centers) != n_bands:\n raise ValueError('Number of band centers does not match data')\n ...
<|body_start_0|> self.spectra = data n_spectra, n_bands = data.shape if header is None: header = {} header = header.copy() self.bands = BandInfo() centers = header.pop('wavelength', None) if centers is not None: if len(centers) != n_bands: ...
The envi.SpectralLibrary class holds data contained in an ENVI-formatted spectral library file (.sli files), which stores data as specified by a corresponding .hdr header file. The primary members of an Envi.SpectralLibrary object are: `spectra` (:class:`numpy.ndarray`): A subscriptable array of all spectra in the libr...
SpectralLibrary
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpectralLibrary: """The envi.SpectralLibrary class holds data contained in an ENVI-formatted spectral library file (.sli files), which stores data as specified by a corresponding .hdr header file. The primary members of an Envi.SpectralLibrary object are: `spectra` (:class:`numpy.ndarray`): A sub...
stack_v2_sparse_classes_75kplus_train_006853
36,543
permissive
[ { "docstring": "Creates a new spectral library array Arguments: `data` (array-like): Array with shape `CxB`, where `C` is the number of spectra in the library and `B` is the number of bands for each spectrum. `header` (dict): Optional dict of ENVI header parameters. `params` (Params): Optional SpyFile Params ob...
2
stack_v2_sparse_classes_30k_train_012087
Implement the Python class `SpectralLibrary` described below. Class description: The envi.SpectralLibrary class holds data contained in an ENVI-formatted spectral library file (.sli files), which stores data as specified by a corresponding .hdr header file. The primary members of an Envi.SpectralLibrary object are: `s...
Implement the Python class `SpectralLibrary` described below. Class description: The envi.SpectralLibrary class holds data contained in an ENVI-formatted spectral library file (.sli files), which stores data as specified by a corresponding .hdr header file. The primary members of an Envi.SpectralLibrary object are: `s...
0659ee71614455d99a80ffd4f5f5edd8d032608c
<|skeleton|> class SpectralLibrary: """The envi.SpectralLibrary class holds data contained in an ENVI-formatted spectral library file (.sli files), which stores data as specified by a corresponding .hdr header file. The primary members of an Envi.SpectralLibrary object are: `spectra` (:class:`numpy.ndarray`): A sub...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpectralLibrary: """The envi.SpectralLibrary class holds data contained in an ENVI-formatted spectral library file (.sli files), which stores data as specified by a corresponding .hdr header file. The primary members of an Envi.SpectralLibrary object are: `spectra` (:class:`numpy.ndarray`): A subscriptable ar...
the_stack_v2_python_sparse
spectral/io/envi.py
spectralpython/spectral
train
527
9e5987c9c7c213938c2e3a27ff389bb3859e4273
[ "super().__init__(params)\nself.results_requested = self.params['results_requested'] if 'results_requested' in self.params else 1\nself.indri_path = self.params['indri_path']\nself.index = pyndri.Index(self.params['index'])\nself.term2id, self.id2term, self.id2df = self.index.get_dictionary()\nself.id2tf = self.ind...
<|body_start_0|> super().__init__(params) self.results_requested = self.params['results_requested'] if 'results_requested' in self.params else 1 self.indri_path = self.params['indri_path'] self.index = pyndri.Index(self.params['index']) self.term2id, self.id2term, self.id2df = se...
Indri
[ "MIT", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Indri: def __init__(self, params): """The Indri retrieval model. Indri is an open-source search engine implemented as part of the lemur project by UMass Amherst and CMU. Refer to http://lemurproject.org/indri.php for more information. The retrieval model used here is based on language mo...
stack_v2_sparse_classes_75kplus_train_006854
3,156
permissive
[ { "docstring": "The Indri retrieval model. Indri is an open-source search engine implemented as part of the lemur project by UMass Amherst and CMU. Refer to http://lemurproject.org/indri.php for more information. The retrieval model used here is based on language modeling framework and retrieves documents using...
3
stack_v2_sparse_classes_30k_val_000350
Implement the Python class `Indri` described below. Class description: Implement the Indri class. Method signatures and docstrings: - def __init__(self, params): The Indri retrieval model. Indri is an open-source search engine implemented as part of the lemur project by UMass Amherst and CMU. Refer to http://lemurpro...
Implement the Python class `Indri` described below. Class description: Implement the Indri class. Method signatures and docstrings: - def __init__(self, params): The Indri retrieval model. Indri is an open-source search engine implemented as part of the lemur project by UMass Amherst and CMU. Refer to http://lemurpro...
f2f29d0dcb4d47a1f75e8add8501555486b5115f
<|skeleton|> class Indri: def __init__(self, params): """The Indri retrieval model. Indri is an open-source search engine implemented as part of the lemur project by UMass Amherst and CMU. Refer to http://lemurproject.org/indri.php for more information. The retrieval model used here is based on language mo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Indri: def __init__(self, params): """The Indri retrieval model. Indri is an open-source search engine implemented as part of the lemur project by UMass Amherst and CMU. Refer to http://lemurproject.org/indri.php for more information. The retrieval model used here is based on language modeling framewo...
the_stack_v2_python_sparse
macaw/core/retrieval/indri.py
hamed-zamani/macaw
train
2
dad48737cb4a8dfe74a14f172368a6a80c56f6c5
[ "super().__init__(id, x, y, angle, margin_x, margin_y, scale, landscape, canvas)\nself.loader = [Folk(self.id, self.x, self.y, self.angle, margin_x, margin_y, scale, landscape, canvas), Chassis(self.id, self.x, self.y, self.angle, margin_x, margin_y, scale, landscape, canvas), MobileVision(self.id, self.x, self.y, ...
<|body_start_0|> super().__init__(id, x, y, angle, margin_x, margin_y, scale, landscape, canvas) self.loader = [Folk(self.id, self.x, self.y, self.angle, margin_x, margin_y, scale, landscape, canvas), Chassis(self.id, self.x, self.y, self.angle, margin_x, margin_y, scale, landscape, canvas), MobileVisio...
2D Mapを作成するユーティリティクラス。
SpoolMobileVision
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpoolMobileVision: """2D Mapを作成するユーティリティクラス。""" def __init__(self, id, x, y, angle, margin_x, margin_y, scale, landscape=None, canvas=None): """エージェント画像を構成する描画オブジェクトを生成し、Pillow(PIL) drawオブジェクトを更新する。 Tkinter canvasオブジェクトを引数指定した場合は、canvasも更新する。 引数: id Marvelmind モバイルビーコンID x 対象オブジェクトの開...
stack_v2_sparse_classes_75kplus_train_006855
33,429
no_license
[ { "docstring": "エージェント画像を構成する描画オブジェクトを生成し、Pillow(PIL) drawオブジェクトを更新する。 Tkinter canvasオブジェクトを引数指定した場合は、canvasも更新する。 引数: id Marvelmind モバイルビーコンID x 対象オブジェクトの開始時点のX座標 y 対象オブジェクトの開始時点のY座標 angle 画像左下を原点右をX軸、上をY軸としたときの角度(単位:度) margin_x 画像左下を原点としたときの上下X座標 margin_y 画像左下を原点としたときの右左Y座標 scale 画像をスケールアップする場合の倍率 landscape ベ...
3
stack_v2_sparse_classes_30k_train_009209
Implement the Python class `SpoolMobileVision` described below. Class description: 2D Mapを作成するユーティリティクラス。 Method signatures and docstrings: - def __init__(self, id, x, y, angle, margin_x, margin_y, scale, landscape=None, canvas=None): エージェント画像を構成する描画オブジェクトを生成し、Pillow(PIL) drawオブジェクトを更新する。 Tkinter canvasオブジェクトを引数指定した場...
Implement the Python class `SpoolMobileVision` described below. Class description: 2D Mapを作成するユーティリティクラス。 Method signatures and docstrings: - def __init__(self, id, x, y, angle, margin_x, margin_y, scale, landscape=None, canvas=None): エージェント画像を構成する描画オブジェクトを生成し、Pillow(PIL) drawオブジェクトを更新する。 Tkinter canvasオブジェクトを引数指定した場...
1ec8c285fcb3996eaa77869b15af993696e113a8
<|skeleton|> class SpoolMobileVision: """2D Mapを作成するユーティリティクラス。""" def __init__(self, id, x, y, angle, margin_x, margin_y, scale, landscape=None, canvas=None): """エージェント画像を構成する描画オブジェクトを生成し、Pillow(PIL) drawオブジェクトを更新する。 Tkinter canvasオブジェクトを引数指定した場合は、canvasも更新する。 引数: id Marvelmind モバイルビーコンID x 対象オブジェクトの開...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpoolMobileVision: """2D Mapを作成するユーティリティクラス。""" def __init__(self, id, x, y, angle, margin_x, margin_y, scale, landscape=None, canvas=None): """エージェント画像を構成する描画オブジェクトを生成し、Pillow(PIL) drawオブジェクトを更新する。 Tkinter canvasオブジェクトを引数指定した場合は、canvasも更新する。 引数: id Marvelmind モバイルビーコンID x 対象オブジェクトの開始時点のX座標 y 対象オ...
the_stack_v2_python_sparse
parts/VisionGenerator/SpoolMobile.py
coolerking/agent_smith
train
0
9537f616fd08bbf9c0d972b325ede4bfa87e3ce2
[ "for cfg_label, cfg_value in cls.values:\n if cfg_label == label:\n return cfg_value\nreturn None", "for cfg_label, cfg_value in cls.values:\n if cfg_value == value:\n return cfg_label\nreturn None" ]
<|body_start_0|> for cfg_label, cfg_value in cls.values: if cfg_label == label: return cfg_value return None <|end_body_0|> <|body_start_1|> for cfg_label, cfg_value in cls.values: if cfg_value == value: return cfg_label return Non...
pqos_mba_config enumeration
CPqosMbaConfig
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CPqosMbaConfig: """pqos_mba_config enumeration""" def get_value(cls, label): """Converts text label ('any', 'default' or 'ctrl') to its native representation. Parameters: label: a text label Returns: native representation of configuration or None""" <|body_0|> def get_la...
stack_v2_sparse_classes_75kplus_train_006856
14,148
permissive
[ { "docstring": "Converts text label ('any', 'default' or 'ctrl') to its native representation. Parameters: label: a text label Returns: native representation of configuration or None", "name": "get_value", "signature": "def get_value(cls, label)" }, { "docstring": "Converts native representation...
2
stack_v2_sparse_classes_30k_train_038810
Implement the Python class `CPqosMbaConfig` described below. Class description: pqos_mba_config enumeration Method signatures and docstrings: - def get_value(cls, label): Converts text label ('any', 'default' or 'ctrl') to its native representation. Parameters: label: a text label Returns: native representation of co...
Implement the Python class `CPqosMbaConfig` described below. Class description: pqos_mba_config enumeration Method signatures and docstrings: - def get_value(cls, label): Converts text label ('any', 'default' or 'ctrl') to its native representation. Parameters: label: a text label Returns: native representation of co...
86883b2b5cc71ee543b39878f37b5a6f533594fa
<|skeleton|> class CPqosMbaConfig: """pqos_mba_config enumeration""" def get_value(cls, label): """Converts text label ('any', 'default' or 'ctrl') to its native representation. Parameters: label: a text label Returns: native representation of configuration or None""" <|body_0|> def get_la...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CPqosMbaConfig: """pqos_mba_config enumeration""" def get_value(cls, label): """Converts text label ('any', 'default' or 'ctrl') to its native representation. Parameters: label: a text label Returns: native representation of configuration or None""" for cfg_label, cfg_value in cls.values:...
the_stack_v2_python_sparse
lib/python/pqos/native_struct.py
intel/intel-cmt-cat
train
528
d14738842ace94d36e9deb10ec66db2580f6625c
[ "res = []\nif not root:\n return res\nqueue = collections.deque()\nqueue.append(root)\nlost_num_index = 0\nwhile queue:\n cur_node = queue.popleft()\n if not cur_node:\n res.append(cur_node)\n continue\n res.append(cur_node.val)\n lost_num_index = len(res)\n queue.append(cur_node.lef...
<|body_start_0|> res = [] if not root: return res queue = collections.deque() queue.append(root) lost_num_index = 0 while queue: cur_node = queue.popleft() if not cur_node: res.append(cur_node) continue ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_006857
2,084
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_013893
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
f43d70cac56bdf6377b22b865174af822902ff78
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" res = [] if not root: return res queue = collections.deque() queue.append(root) lost_num_index = 0 while queue: cur_node =...
the_stack_v2_python_sparse
剑指offer/序列化二叉树.py
ltzp/LeetCode
train
0
a63005a95dd112c59f77838a19d82eef2ce51d8d
[ "super().__init__()\nself.num_layers = num_layers\nself.alpha = alpha", "with g.local_scope():\n labels = F.one_hot(labels).float()\n if mask is not None:\n y = torch.zeros_like(labels)\n y[mask] = labels[mask]\n else:\n y = labels\n degs = g.in_degrees().clamp(min=1)\n norm = ...
<|body_start_0|> super().__init__() self.num_layers = num_layers self.alpha = alpha <|end_body_0|> <|body_start_1|> with g.local_scope(): labels = F.one_hot(labels).float() if mask is not None: y = torch.zeros_like(labels) y[mask] ...
LabelPropagation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabelPropagation: def __init__(self, num_layers, alpha): """标签传播模型 .. math:: Y^{(t+1)} = \\alpha D^{-1/2}AD^{-1/2}Y^{(t)} + (1-\\alpha)Y^{(t)} :param num_layers: int 传播层数 :param alpha: float α参数""" <|body_0|> def forward(self, g, labels, mask=None): """:param g: DGLG...
stack_v2_sparse_classes_75kplus_train_006858
1,606
no_license
[ { "docstring": "标签传播模型 .. math:: Y^{(t+1)} = \\\\alpha D^{-1/2}AD^{-1/2}Y^{(t)} + (1-\\\\alpha)Y^{(t)} :param num_layers: int 传播层数 :param alpha: float α参数", "name": "__init__", "signature": "def __init__(self, num_layers, alpha)" }, { "docstring": ":param g: DGLGraph 无向图 :param labels: tensor(N)...
2
null
Implement the Python class `LabelPropagation` described below. Class description: Implement the LabelPropagation class. Method signatures and docstrings: - def __init__(self, num_layers, alpha): 标签传播模型 .. math:: Y^{(t+1)} = \\alpha D^{-1/2}AD^{-1/2}Y^{(t)} + (1-\\alpha)Y^{(t)} :param num_layers: int 传播层数 :param alpha...
Implement the Python class `LabelPropagation` described below. Class description: Implement the LabelPropagation class. Method signatures and docstrings: - def __init__(self, num_layers, alpha): 标签传播模型 .. math:: Y^{(t+1)} = \\alpha D^{-1/2}AD^{-1/2}Y^{(t)} + (1-\\alpha)Y^{(t)} :param num_layers: int 传播层数 :param alpha...
b40071dc9f9fb20f081f4ed4944a7b65de919c18
<|skeleton|> class LabelPropagation: def __init__(self, num_layers, alpha): """标签传播模型 .. math:: Y^{(t+1)} = \\alpha D^{-1/2}AD^{-1/2}Y^{(t)} + (1-\\alpha)Y^{(t)} :param num_layers: int 传播层数 :param alpha: float α参数""" <|body_0|> def forward(self, g, labels, mask=None): """:param g: DGLG...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LabelPropagation: def __init__(self, num_layers, alpha): """标签传播模型 .. math:: Y^{(t+1)} = \\alpha D^{-1/2}AD^{-1/2}Y^{(t)} + (1-\\alpha)Y^{(t)} :param num_layers: int 传播层数 :param alpha: float α参数""" super().__init__() self.num_layers = num_layers self.alpha = alpha def forw...
the_stack_v2_python_sparse
gnn/lp/model.py
deepdumbo/pytorch-tutorial-1
train
0
24b665a55547780cb839d46de5fed7e28a3e811e
[ "super().__init__()\nself._outputs = outputs\nself.power = power", "new_outputs = None\nif self._outputs is not None:\n if min(self._outputs + idcs) < 0:\n raise NotImplementedError(f'Negative indexing not supported for {self.__class__.__name__} when subsetting outputs and only transforming some outputs...
<|body_start_0|> super().__init__() self._outputs = outputs self.power = power <|end_body_0|> <|body_start_1|> new_outputs = None if self._outputs is not None: if min(self._outputs + idcs) < 0: raise NotImplementedError(f'Negative indexing not support...
Power-transform outcomes. Useful if the targets are modeled using a (multivariate) power transform of a Normal distribution. This means that we can use a standard GP model on the power-transformed outcomes and un-transform the model posterior of that GP.
Power
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Power: """Power-transform outcomes. Useful if the targets are modeled using a (multivariate) power transform of a Normal distribution. This means that we can use a standard GP model on the power-transformed outcomes and un-transform the model posterior of that GP.""" def __init__(self, power...
stack_v2_sparse_classes_75kplus_train_006859
31,087
permissive
[ { "docstring": "Power-transform outcomes. Args: outputs: Which of the outputs to power-transform. If omitted, all outputs will be standardized.", "name": "__init__", "signature": "def __init__(self, power: float, outputs: Optional[List[int]]=None) -> None" }, { "docstring": "Subset the transform...
5
stack_v2_sparse_classes_30k_train_044476
Implement the Python class `Power` described below. Class description: Power-transform outcomes. Useful if the targets are modeled using a (multivariate) power transform of a Normal distribution. This means that we can use a standard GP model on the power-transformed outcomes and un-transform the model posterior of th...
Implement the Python class `Power` described below. Class description: Power-transform outcomes. Useful if the targets are modeled using a (multivariate) power transform of a Normal distribution. This means that we can use a standard GP model on the power-transformed outcomes and un-transform the model posterior of th...
4cc5ed59b2e8a9c780f786830c548e05cc74d53c
<|skeleton|> class Power: """Power-transform outcomes. Useful if the targets are modeled using a (multivariate) power transform of a Normal distribution. This means that we can use a standard GP model on the power-transformed outcomes and un-transform the model posterior of that GP.""" def __init__(self, power...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Power: """Power-transform outcomes. Useful if the targets are modeled using a (multivariate) power transform of a Normal distribution. This means that we can use a standard GP model on the power-transformed outcomes and un-transform the model posterior of that GP.""" def __init__(self, power: float, outp...
the_stack_v2_python_sparse
botorch/models/transforms/outcome.py
pytorch/botorch
train
2,891
436aff508784bf6d5a0bb59bc871b4715427940a
[ "if not email:\n raise ValidationError(_('Missing email address: %(value)s'), code='missing', params={'value': email})\nif not username:\n raise ValidationError(_('Missing username: %(value)s'), code='missing', params={'value': username})\nif not role:\n raise ValidationError(_('Missing role: %(value)s'), ...
<|body_start_0|> if not email: raise ValidationError(_('Missing email address: %(value)s'), code='missing', params={'value': email}) if not username: raise ValidationError(_('Missing username: %(value)s'), code='missing', params={'value': username}) if not role: ...
Manager for 'CustomAuthUser' model.
CustomAuthUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomAuthUserManager: """Manager for 'CustomAuthUser' model.""" def create_user(self, username, email, role, language, is_staff, is_superuser, password=None): """Creates and saves a OSCM User with the given username, email, role, language and password.""" <|body_0|> def...
stack_v2_sparse_classes_75kplus_train_006860
2,603
no_license
[ { "docstring": "Creates and saves a OSCM User with the given username, email, role, language and password.", "name": "create_user", "signature": "def create_user(self, username, email, role, language, is_staff, is_superuser, password=None)" }, { "docstring": "Creates and saves an OSCM super user...
2
stack_v2_sparse_classes_30k_train_011131
Implement the Python class `CustomAuthUserManager` described below. Class description: Manager for 'CustomAuthUser' model. Method signatures and docstrings: - def create_user(self, username, email, role, language, is_staff, is_superuser, password=None): Creates and saves a OSCM User with the given username, email, ro...
Implement the Python class `CustomAuthUserManager` described below. Class description: Manager for 'CustomAuthUser' model. Method signatures and docstrings: - def create_user(self, username, email, role, language, is_staff, is_superuser, password=None): Creates and saves a OSCM User with the given username, email, ro...
d81637d584d2e5ac2c764501d8cf91366d7bb946
<|skeleton|> class CustomAuthUserManager: """Manager for 'CustomAuthUser' model.""" def create_user(self, username, email, role, language, is_staff, is_superuser, password=None): """Creates and saves a OSCM User with the given username, email, role, language and password.""" <|body_0|> def...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CustomAuthUserManager: """Manager for 'CustomAuthUser' model.""" def create_user(self, username, email, role, language, is_staff, is_superuser, password=None): """Creates and saves a OSCM User with the given username, email, role, language and password.""" if not email: raise ...
the_stack_v2_python_sparse
oscm/oscm_app/authentication/custom_auth_user_manager.py
mlf1/smsystem
train
1
7c511a6602f391e3bffb9781f6f1a91ddf583559
[ "if x is None or x == 'None':\n return False\nreturn True", "if x is None or x == 'None':\n return False\nreturn True", "if x is None or x == 'None':\n return False\nreturn True", "if x is None or x == 'None':\n return False\nreturn True", "if x is None or x == 'None':\n return False\nreturn ...
<|body_start_0|> if x is None or x == 'None': return False return True <|end_body_0|> <|body_start_1|> if x is None or x == 'None': return False return True <|end_body_1|> <|body_start_2|> if x is None or x == 'None': return False ret...
MDF_Unit_validator_nonstandard_geocodes
[ "LicenseRef-scancode-public-domain", "CC0-1.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MDF_Unit_validator_nonstandard_geocodes: def is_valid_TABBLKST(self, x): """2020 Tabulation State (FIPS)""" <|body_0|> def is_valid_TABBLKCOU(self, x): """2020 Tabulation County (FIPS)""" <|body_1|> def is_valid_TABTRACTCE(self, x): """2020 Tabul...
stack_v2_sparse_classes_75kplus_train_006861
23,123
permissive
[ { "docstring": "2020 Tabulation State (FIPS)", "name": "is_valid_TABBLKST", "signature": "def is_valid_TABBLKST(self, x)" }, { "docstring": "2020 Tabulation County (FIPS)", "name": "is_valid_TABBLKCOU", "signature": "def is_valid_TABBLKCOU(self, x)" }, { "docstring": "2020 Tabula...
5
stack_v2_sparse_classes_30k_train_004600
Implement the Python class `MDF_Unit_validator_nonstandard_geocodes` described below. Class description: Implement the MDF_Unit_validator_nonstandard_geocodes class. Method signatures and docstrings: - def is_valid_TABBLKST(self, x): 2020 Tabulation State (FIPS) - def is_valid_TABBLKCOU(self, x): 2020 Tabulation Coun...
Implement the Python class `MDF_Unit_validator_nonstandard_geocodes` described below. Class description: Implement the MDF_Unit_validator_nonstandard_geocodes class. Method signatures and docstrings: - def is_valid_TABBLKST(self, x): 2020 Tabulation State (FIPS) - def is_valid_TABBLKCOU(self, x): 2020 Tabulation Coun...
7f7ba44055da15d13b191180249e656e1bd398c6
<|skeleton|> class MDF_Unit_validator_nonstandard_geocodes: def is_valid_TABBLKST(self, x): """2020 Tabulation State (FIPS)""" <|body_0|> def is_valid_TABBLKCOU(self, x): """2020 Tabulation County (FIPS)""" <|body_1|> def is_valid_TABTRACTCE(self, x): """2020 Tabul...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MDF_Unit_validator_nonstandard_geocodes: def is_valid_TABBLKST(self, x): """2020 Tabulation State (FIPS)""" if x is None or x == 'None': return False return True def is_valid_TABBLKCOU(self, x): """2020 Tabulation County (FIPS)""" if x is None or x == '...
the_stack_v2_python_sparse
das_decennial/programs/writer/cef_2020/mdf_validator_classes_nonstandard_geocodes.py
p-b-j/uscb-das-container-public
train
1
a5239302f4363af91b7d7174f95bc71151327ab6
[ "self.__func = func\nself.__include_commands = include_commands if include_commands else '.*'\nself.__exclude_commands = exclude_commands", "if not re.match(self.__include_commands, command_path):\n return False\nif self.__exclude_commands and re.match(self.__exclude_commands, command_path):\n return False\...
<|body_start_0|> self.__func = func self.__include_commands = include_commands if include_commands else '.*' self.__exclude_commands = exclude_commands <|end_body_0|> <|body_start_1|> if not re.match(self.__include_commands, command_path): return False if self.__excl...
Encapsulates a function to be run before or after command execution.
RunHook
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunHook: """Encapsulates a function to be run before or after command execution.""" def __init__(self, func, include_commands=None, exclude_commands=None): """Constructs the hook. Args: func: function, The no args function to run. include_commands: str, A regex for the command paths ...
stack_v2_sparse_classes_75kplus_train_006862
10,532
permissive
[ { "docstring": "Constructs the hook. Args: func: function, The no args function to run. include_commands: str, A regex for the command paths to run. If not provided, the hook will be run for all commands. exclude_commands: str, A regex for the command paths to exclude. If not provided, nothing will be excluded....
2
stack_v2_sparse_classes_30k_train_043060
Implement the Python class `RunHook` described below. Class description: Encapsulates a function to be run before or after command execution. Method signatures and docstrings: - def __init__(self, func, include_commands=None, exclude_commands=None): Constructs the hook. Args: func: function, The no args function to r...
Implement the Python class `RunHook` described below. Class description: Encapsulates a function to be run before or after command execution. Method signatures and docstrings: - def __init__(self, func, include_commands=None, exclude_commands=None): Constructs the hook. Args: func: function, The no args function to r...
90d87b2adb1eab7f218b075886aa620d8d6eeedb
<|skeleton|> class RunHook: """Encapsulates a function to be run before or after command execution.""" def __init__(self, func, include_commands=None, exclude_commands=None): """Constructs the hook. Args: func: function, The no args function to run. include_commands: str, A regex for the command paths ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RunHook: """Encapsulates a function to be run before or after command execution.""" def __init__(self, func, include_commands=None, exclude_commands=None): """Constructs the hook. Args: func: function, The no args function to run. include_commands: str, A regex for the command paths to run. If no...
the_stack_v2_python_sparse
old/google-cloud-sdk/.install/.backup/lib/googlecloudsdk/calliope/frontend.py
altock/dev
train
0
e8ff47c7aacdefc6f024ec1a289439da927a6274
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('jguerero_mgarcia7', 'jguerero_mgarcia7')\nurl = 'http://datamechanics.io/data/jguerero_mgarcia7/censusincomedata.json'\nresponse = urllib.request.urlopen(url).read().decode('utf-8')\nr = json.loads(respo...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('jguerero_mgarcia7', 'jguerero_mgarcia7') url = 'http://datamechanics.io/data/jguerero_mgarcia7/censusincomedata.json' response = urllib.request.ur...
population
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class population: 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 everything ha...
stack_v2_sparse_classes_75kplus_train_006863
5,741
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 `population` described below. Class description: Implement the population 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=None, endTime...
Implement the Python class `population` described below. Class description: Implement the population 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=None, endTime...
0df485d0469c5451ebdcd684bed2a0960ba3ab84
<|skeleton|> class population: 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 everything ha...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class population: 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('jguerero_mgarcia7', 'jguerero_mgarcia7')...
the_stack_v2_python_sparse
jguerero_mgarcia7/population.py
lingyigu/course-2017-spr-proj
train
0
2b5dfb686d9c171a41895ab370823ccbb514b542
[ "gcc, *_ = packager.identify(installation=self)\nself.version, _ = packager.info(package=gcc)\nflavor = self.flavor\nself.wrapper = gcc\nwrapper = 'bin/{.wrapper}'.format(self)\nprefix = packager.findfirst(target=wrapper, contents=packager.contents(package=gcc))\nself.bindir = [prefix / 'bin'] if prefix else []\nse...
<|body_start_0|> gcc, *_ = packager.identify(installation=self) self.version, _ = packager.info(package=gcc) flavor = self.flavor self.wrapper = gcc wrapper = 'bin/{.wrapper}'.format(self) prefix = packager.findfirst(target=wrapper, contents=packager.contents(package=gcc)...
Support for GCC installations
Default
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Default: """Support for GCC installations""" def dpkg(self, packager): """Attempt to repair my configuration""" <|body_0|> def macports(self, packager): """Attempt to repair my configuration""" <|body_1|> def retrieveVersion(self): """Get my ...
stack_v2_sparse_classes_75kplus_train_006864
9,096
permissive
[ { "docstring": "Attempt to repair my configuration", "name": "dpkg", "signature": "def dpkg(self, packager)" }, { "docstring": "Attempt to repair my configuration", "name": "macports", "signature": "def macports(self, packager)" }, { "docstring": "Get my version number directly f...
3
stack_v2_sparse_classes_30k_train_054173
Implement the Python class `Default` described below. Class description: Support for GCC installations Method signatures and docstrings: - def dpkg(self, packager): Attempt to repair my configuration - def macports(self, packager): Attempt to repair my configuration - def retrieveVersion(self): Get my version number ...
Implement the Python class `Default` described below. Class description: Support for GCC installations Method signatures and docstrings: - def dpkg(self, packager): Attempt to repair my configuration - def macports(self, packager): Attempt to repair my configuration - def retrieveVersion(self): Get my version number ...
d741c44ffb3e9e1f726bf492202ac8738bb4aa1c
<|skeleton|> class Default: """Support for GCC installations""" def dpkg(self, packager): """Attempt to repair my configuration""" <|body_0|> def macports(self, packager): """Attempt to repair my configuration""" <|body_1|> def retrieveVersion(self): """Get my ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Default: """Support for GCC installations""" def dpkg(self, packager): """Attempt to repair my configuration""" gcc, *_ = packager.identify(installation=self) self.version, _ = packager.info(package=gcc) flavor = self.flavor self.wrapper = gcc wrapper = 'bi...
the_stack_v2_python_sparse
packages/pyre/externals/GCC.py
pyre/pyre
train
27
6686b9ffc6573f146a957b5eb063297d49c57622
[ "result = {'result': 'NG'}\ncontent = CtrlDSSection().get_usecase_by_doc_id(doc_id, 'USERCASE')\nif content:\n result = {'result': 'OK', 'content': content}\nreturn result", "result = {'result': 'NG', 'error': ''}\ndata_json = request.get_json()\nsec_obj = CtrlDSSection()\nflag, error = sec_obj.usecase_add(dat...
<|body_start_0|> result = {'result': 'NG'} content = CtrlDSSection().get_usecase_by_doc_id(doc_id, 'USERCASE') if content: result = {'result': 'OK', 'content': content} return result <|end_body_0|> <|body_start_1|> result = {'result': 'NG', 'error': ''} data_...
ApiDSDocUsecase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiDSDocUsecase: def get(self, doc_id): """获取文档下所有usecase的说明 :param doc_id: :return:""" <|body_0|> def post(self): """保存和修改文档下usecase的说明 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = {'result': 'NG'} content = CtrlDSSecti...
stack_v2_sparse_classes_75kplus_train_006865
31,026
no_license
[ { "docstring": "获取文档下所有usecase的说明 :param doc_id: :return:", "name": "get", "signature": "def get(self, doc_id)" }, { "docstring": "保存和修改文档下usecase的说明 :return:", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_046822
Implement the Python class `ApiDSDocUsecase` described below. Class description: Implement the ApiDSDocUsecase class. Method signatures and docstrings: - def get(self, doc_id): 获取文档下所有usecase的说明 :param doc_id: :return: - def post(self): 保存和修改文档下usecase的说明 :return:
Implement the Python class `ApiDSDocUsecase` described below. Class description: Implement the ApiDSDocUsecase class. Method signatures and docstrings: - def get(self, doc_id): 获取文档下所有usecase的说明 :param doc_id: :return: - def post(self): 保存和修改文档下usecase的说明 :return: <|skeleton|> class ApiDSDocUsecase: def get(sel...
64b31e7bdfcb8a4c95f0a8a607f0bcff576cec11
<|skeleton|> class ApiDSDocUsecase: def get(self, doc_id): """获取文档下所有usecase的说明 :param doc_id: :return:""" <|body_0|> def post(self): """保存和修改文档下usecase的说明 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ApiDSDocUsecase: def get(self, doc_id): """获取文档下所有usecase的说明 :param doc_id: :return:""" result = {'result': 'NG'} content = CtrlDSSection().get_usecase_by_doc_id(doc_id, 'USERCASE') if content: result = {'result': 'OK', 'content': content} return result ...
the_stack_v2_python_sparse
Source/collaboration_2/app/api_1_0/api_ds_doc.py
lsn1183/web_project
train
0
b82fc800dfec98c3254c3396b08fe1a4a5919eb8
[ "heap = []\nprojects = sorted(zip(Profits, Capital), key=lambda l: l[1])\nindex = 0\nfor i in range(k):\n while index < len(projects):\n if projects[index][1] > W:\n break\n else:\n self.heap_add(heap, projects[index][0])\n index += 1\n if not heap:\n break\n ...
<|body_start_0|> heap = [] projects = sorted(zip(Profits, Capital), key=lambda l: l[1]) index = 0 for i in range(k): while index < len(projects): if projects[index][1] > W: break else: self.heap_add(heap,...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMaximizedCapital(self, k, W, Profits, Capital): """:type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int""" <|body_0|> def heap_poll(heap): """堆弹出""" <|body_1|> def heap_add(heap, val): """堆添加""...
stack_v2_sparse_classes_75kplus_train_006866
2,105
no_license
[ { "docstring": ":type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int", "name": "findMaximizedCapital", "signature": "def findMaximizedCapital(self, k, W, Profits, Capital)" }, { "docstring": "堆弹出", "name": "heap_poll", "signature": "def heap_poll(heap)"...
3
stack_v2_sparse_classes_30k_train_004139
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaximizedCapital(self, k, W, Profits, Capital): :type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int - def heap_poll(heap): 堆弹出 - def h...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaximizedCapital(self, k, W, Profits, Capital): :type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int - def heap_poll(heap): 堆弹出 - def h...
86352d3f51ab030afdb7b472a80bc8cab7260c08
<|skeleton|> class Solution: def findMaximizedCapital(self, k, W, Profits, Capital): """:type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int""" <|body_0|> def heap_poll(heap): """堆弹出""" <|body_1|> def heap_add(heap, val): """堆添加""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findMaximizedCapital(self, k, W, Profits, Capital): """:type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int""" heap = [] projects = sorted(zip(Profits, Capital), key=lambda l: l[1]) index = 0 for i in range(k): ...
the_stack_v2_python_sparse
leetcode/_502_IPO.py
scolphew/leetcode_python
train
0
d744553582f583f0511df77036c9fe6129c60953
[ "self.hab = hab\nself.msgs = decking.Deck()\nself.cues = cues if cues is not None else decking.Deck()\nself.ims = ims if ims is not None else bytearray()\nself.verifier = verifier\nself.witq = agenting.WitnessInquisitor(hab=hab, klas=agenting.HttpWitnesser)\ndoers = [self.witq, doing.doify(self.msgDo)]\nsuper(Issue...
<|body_start_0|> self.hab = hab self.msgs = decking.Deck() self.cues = cues if cues is not None else decking.Deck() self.ims = ims if ims is not None else bytearray() self.verifier = verifier self.witq = agenting.WitnessInquisitor(hab=hab, klas=agenting.HttpWitnesser) ...
Sample class that handles a credential Issue `exn` message. By default, this handler verifies the credential with the provided verifier. The incoming message must have the following format: { "vc" [ { "vc": { "v": "KERI10JSON00011c_", //KERI Version String "x": "EeyJ0eXBlIjogWyJWZXJpZmlhYmxlQ3JlZGVudGlhbCI", // Identif...
IssueHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IssueHandler: """Sample class that handles a credential Issue `exn` message. By default, this handler verifies the credential with the provided verifier. The incoming message must have the following format: { "vc" [ { "vc": { "v": "KERI10JSON00011c_", //KERI Version String "x": "EeyJ0eXBlIjogWyJW...
stack_v2_sparse_classes_75kplus_train_006867
22,714
permissive
[ { "docstring": "Parameters: wallet (Wallet) credential wallet that will hold the issued credentials typ (JSONSchema) credential type to accept", "name": "__init__", "signature": "def __init__(self, hab, verifier, ims=None, cues=None, **kwa)" }, { "docstring": "Handle incoming messages by parsing...
2
stack_v2_sparse_classes_30k_train_045897
Implement the Python class `IssueHandler` described below. Class description: Sample class that handles a credential Issue `exn` message. By default, this handler verifies the credential with the provided verifier. The incoming message must have the following format: { "vc" [ { "vc": { "v": "KERI10JSON00011c_", //KERI...
Implement the Python class `IssueHandler` described below. Class description: Sample class that handles a credential Issue `exn` message. By default, this handler verifies the credential with the provided verifier. The incoming message must have the following format: { "vc" [ { "vc": { "v": "KERI10JSON00011c_", //KERI...
467f952912b17dede8a8f4ebce73241408b63e8c
<|skeleton|> class IssueHandler: """Sample class that handles a credential Issue `exn` message. By default, this handler verifies the credential with the provided verifier. The incoming message must have the following format: { "vc" [ { "vc": { "v": "KERI10JSON00011c_", //KERI Version String "x": "EeyJ0eXBlIjogWyJW...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IssueHandler: """Sample class that handles a credential Issue `exn` message. By default, this handler verifies the credential with the provided verifier. The incoming message must have the following format: { "vc" [ { "vc": { "v": "KERI10JSON00011c_", //KERI Version String "x": "EeyJ0eXBlIjogWyJWZXJpZmlhYmxlQ...
the_stack_v2_python_sparse
src/keri/vc/handling.py
dlandi/keripy-1
train
0
c00fe289eb2b02751a4404bf79361e1a4a5837bc
[ "try:\n sport = self.kwargs['sport']\nexcept KeyError:\n sport = 'nba'\nsite_sport_manager = sports.classes.SiteSportManager()\ninjury_serializer_class = site_sport_manager.get_injury_serializer_class(sport)\nreturn injury_serializer_class", "sport = self.kwargs['sport']\nsite_sport_manager = sports.classes...
<|body_start_0|> try: sport = self.kwargs['sport'] except KeyError: sport = 'nba' site_sport_manager = sports.classes.SiteSportManager() injury_serializer_class = site_sport_manager.get_injury_serializer_class(sport) return injury_serializer_class <|end_bo...
Retrieve the contests which are relevant to the home page lobby.
LeagueInjuryAPIView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LeagueInjuryAPIView: """Retrieve the contests which are relevant to the home page lobby.""" def get_serializer_class(self): """override for having to set the self.serializer_class""" <|body_0|> def get_queryset(self): """Return a QuerySet from the LobbyContest mo...
stack_v2_sparse_classes_75kplus_train_006868
26,966
no_license
[ { "docstring": "override for having to set the self.serializer_class", "name": "get_serializer_class", "signature": "def get_serializer_class(self)" }, { "docstring": "Return a QuerySet from the LobbyContest model.", "name": "get_queryset", "signature": "def get_queryset(self)" } ]
2
stack_v2_sparse_classes_30k_train_012154
Implement the Python class `LeagueInjuryAPIView` described below. Class description: Retrieve the contests which are relevant to the home page lobby. Method signatures and docstrings: - def get_serializer_class(self): override for having to set the self.serializer_class - def get_queryset(self): Return a QuerySet fro...
Implement the Python class `LeagueInjuryAPIView` described below. Class description: Retrieve the contests which are relevant to the home page lobby. Method signatures and docstrings: - def get_serializer_class(self): override for having to set the self.serializer_class - def get_queryset(self): Return a QuerySet fro...
4796fa9d88b56f80def011e2b043ce595bfce8c4
<|skeleton|> class LeagueInjuryAPIView: """Retrieve the contests which are relevant to the home page lobby.""" def get_serializer_class(self): """override for having to set the self.serializer_class""" <|body_0|> def get_queryset(self): """Return a QuerySet from the LobbyContest mo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LeagueInjuryAPIView: """Retrieve the contests which are relevant to the home page lobby.""" def get_serializer_class(self): """override for having to set the self.serializer_class""" try: sport = self.kwargs['sport'] except KeyError: sport = 'nba' s...
the_stack_v2_python_sparse
sports/views.py
nakamotohideyoshi/draftboard-web
train
0
11308f47d1166fd60753b4ff1f512052d4e3a6b1
[ "restaurant_keywords = RestaurantKeyword.objects.all()\nrestaurant = self.request.query_params.get('restaurant', None)\nif restaurant is not None:\n restaurant_keywords = restaurant_keywords.filter(restaurant__id=restaurant)\nserializer = RestaurantKeywordSerializer(restaurant_keywords, many=True, context={'requ...
<|body_start_0|> restaurant_keywords = RestaurantKeyword.objects.all() restaurant = self.request.query_params.get('restaurant', None) if restaurant is not None: restaurant_keywords = restaurant_keywords.filter(restaurant__id=restaurant) serializer = RestaurantKeywordSerialize...
Restaurant Keywords
RestaurantKeywordView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestaurantKeywordView: """Restaurant Keywords""" def list(self, request): """Handle GET requests to restaurant_keywords resource Returns: Response -- JSON serialized list of restaurant_keywords""" <|body_0|> def retrieve(self, request, pk=None): """Handle GET req...
stack_v2_sparse_classes_75kplus_train_006869
3,197
no_license
[ { "docstring": "Handle GET requests to restaurant_keywords resource Returns: Response -- JSON serialized list of restaurant_keywords", "name": "list", "signature": "def list(self, request)" }, { "docstring": "Handle GET requests for single keyword Returns: Response -- JSON serialized keyword ins...
3
stack_v2_sparse_classes_30k_train_038693
Implement the Python class `RestaurantKeywordView` described below. Class description: Restaurant Keywords Method signatures and docstrings: - def list(self, request): Handle GET requests to restaurant_keywords resource Returns: Response -- JSON serialized list of restaurant_keywords - def retrieve(self, request, pk=...
Implement the Python class `RestaurantKeywordView` described below. Class description: Restaurant Keywords Method signatures and docstrings: - def list(self, request): Handle GET requests to restaurant_keywords resource Returns: Response -- JSON serialized list of restaurant_keywords - def retrieve(self, request, pk=...
c32f40f862cb06354d9f987d79e199faa239d3c5
<|skeleton|> class RestaurantKeywordView: """Restaurant Keywords""" def list(self, request): """Handle GET requests to restaurant_keywords resource Returns: Response -- JSON serialized list of restaurant_keywords""" <|body_0|> def retrieve(self, request, pk=None): """Handle GET req...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RestaurantKeywordView: """Restaurant Keywords""" def list(self, request): """Handle GET requests to restaurant_keywords resource Returns: Response -- JSON serialized list of restaurant_keywords""" restaurant_keywords = RestaurantKeyword.objects.all() restaurant = self.request.quer...
the_stack_v2_python_sparse
blessipeapi/views/restaurant_keyword.py
gqgonzales/blessipe-api
train
0
e4896afd471e4a9f01f99844c52e617b0c536817
[ "swap_user = None\ntry:\n swap_user = EmailUser.objects.get(id=int(self.checkout_session.basket_owner()))\nexcept:\n pass\nif swap_user:\n user = swap_user\n basket.owner = user\n basket.save()\norder = self.place_order(order_number=order_number, user=user, basket=basket, shipping_address=shipping_ad...
<|body_start_0|> swap_user = None try: swap_user = EmailUser.objects.get(id=int(self.checkout_session.basket_owner())) except: pass if swap_user: user = swap_user basket.owner = user basket.save() order = self.place_orde...
OrderPlacementMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrderPlacementMixin: def handle_order_placement(self, order_number, user, basket, shipping_address, shipping_method, shipping_charge, billing_address, order_total, **kwargs): """Write out the order models and return the appropriate HTTP response We deliberately pass the basket in here as...
stack_v2_sparse_classes_75kplus_train_006870
2,860
permissive
[ { "docstring": "Write out the order models and return the appropriate HTTP response We deliberately pass the basket in here as the one tied to the request isn't necessarily the correct one to use in placing the order. This can happen when a basket gets frozen.", "name": "handle_order_placement", "signat...
2
stack_v2_sparse_classes_30k_train_015665
Implement the Python class `OrderPlacementMixin` described below. Class description: Implement the OrderPlacementMixin class. Method signatures and docstrings: - def handle_order_placement(self, order_number, user, basket, shipping_address, shipping_method, shipping_charge, billing_address, order_total, **kwargs): Wr...
Implement the Python class `OrderPlacementMixin` described below. Class description: Implement the OrderPlacementMixin class. Method signatures and docstrings: - def handle_order_placement(self, order_number, user, basket, shipping_address, shipping_method, shipping_charge, billing_address, order_total, **kwargs): Wr...
b87c4bf4226e3e2b2f0bc24303f5d107f94f134e
<|skeleton|> class OrderPlacementMixin: def handle_order_placement(self, order_number, user, basket, shipping_address, shipping_method, shipping_charge, billing_address, order_total, **kwargs): """Write out the order models and return the appropriate HTTP response We deliberately pass the basket in here as...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OrderPlacementMixin: def handle_order_placement(self, order_number, user, basket, shipping_address, shipping_method, shipping_charge, billing_address, order_total, **kwargs): """Write out the order models and return the appropriate HTTP response We deliberately pass the basket in here as the one tied ...
the_stack_v2_python_sparse
ledger/checkout/mixins.py
gaiaresources/ledger
train
2
1b5eaa4d3815c35db393c211abe8c1e5b94fd275
[ "query = 'SELECT DISTINCT(created_at) FROM links_present LIMIT 1;'\nself.cursor.execute(query)\ncreated_at, = self.cursor.fetchone()\nreturn created_at", "query = \"SELECT id FROM datetime_archive WHERE datetime_archive = '{}';\".format(self.links_creation_date())\nself.cursor.execute(query)\nid, = self.cursor.fe...
<|body_start_0|> query = 'SELECT DISTINCT(created_at) FROM links_present LIMIT 1;' self.cursor.execute(query) created_at, = self.cursor.fetchone() return created_at <|end_body_0|> <|body_start_1|> query = "SELECT id FROM datetime_archive WHERE datetime_archive = '{}';".format(se...
linkArchiver
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class linkArchiver: def links_creation_date(self): """This method returns the datetime when the links in the links_present table were created.""" <|body_0|> def datetime_archive_id(self): """This method returns the datetime_archive id of the datetime corresponding to the c...
stack_v2_sparse_classes_75kplus_train_006871
12,136
no_license
[ { "docstring": "This method returns the datetime when the links in the links_present table were created.", "name": "links_creation_date", "signature": "def links_creation_date(self)" }, { "docstring": "This method returns the datetime_archive id of the datetime corresponding to the creation date...
5
stack_v2_sparse_classes_30k_train_001525
Implement the Python class `linkArchiver` described below. Class description: Implement the linkArchiver class. Method signatures and docstrings: - def links_creation_date(self): This method returns the datetime when the links in the links_present table were created. - def datetime_archive_id(self): This method retur...
Implement the Python class `linkArchiver` described below. Class description: Implement the linkArchiver class. Method signatures and docstrings: - def links_creation_date(self): This method returns the datetime when the links in the links_present table were created. - def datetime_archive_id(self): This method retur...
6edd56fd77c04de0c9fc2aa02fc19ad450820cda
<|skeleton|> class linkArchiver: def links_creation_date(self): """This method returns the datetime when the links in the links_present table were created.""" <|body_0|> def datetime_archive_id(self): """This method returns the datetime_archive id of the datetime corresponding to the c...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class linkArchiver: def links_creation_date(self): """This method returns the datetime when the links in the links_present table were created.""" query = 'SELECT DISTINCT(created_at) FROM links_present LIMIT 1;' self.cursor.execute(query) created_at, = self.cursor.fetchone() ...
the_stack_v2_python_sparse
python/db/dbArchive.py
aldrinison/RESE2NSE-Visualization
train
0
d3f8868c5b2513a8cf0eb847f65f3db0b0d140b7
[ "super(MnistNet, self).__init__()\nself.convblock1 = nn.Sequential(nn.Conv2d(in_channels=1, out_channels=7, kernel_size=(3, 3), padding=0, bias=False), nn.BatchNorm2d(7) if not use_ghost_batch_norm else GhostBatchNorm(7, num_splits), nn.ReLU(), nn.Dropout(dropout_value))\nself.convblock2 = nn.Sequential(nn.Conv2d(i...
<|body_start_0|> super(MnistNet, self).__init__() self.convblock1 = nn.Sequential(nn.Conv2d(in_channels=1, out_channels=7, kernel_size=(3, 3), padding=0, bias=False), nn.BatchNorm2d(7) if not use_ghost_batch_norm else GhostBatchNorm(7, num_splits), nn.ReLU(), nn.Dropout(dropout_value)) self.conv...
MnistNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MnistNet: def __init__(self, use_ghost_batch_norm: bool=False, num_splits: int=2, dropout_value: float=0): """Model used on MNIST dataset. Model summary: .. code-block:: none ---------------------------------------------------------------- Layer (type) Output Shape Param # ==============...
stack_v2_sparse_classes_75kplus_train_006872
6,784
no_license
[ { "docstring": "Model used on MNIST dataset. Model summary: .. code-block:: none ---------------------------------------------------------------- Layer (type) Output Shape Param # ================================================================ Conv2d-1 [-1, 7, 26, 26] 63 BatchNorm2d-2 [-1, 7, 26, 26] 14 ReLU-3...
2
stack_v2_sparse_classes_30k_train_021402
Implement the Python class `MnistNet` described below. Class description: Implement the MnistNet class. Method signatures and docstrings: - def __init__(self, use_ghost_batch_norm: bool=False, num_splits: int=2, dropout_value: float=0): Model used on MNIST dataset. Model summary: .. code-block:: none ----------------...
Implement the Python class `MnistNet` described below. Class description: Implement the MnistNet class. Method signatures and docstrings: - def __init__(self, use_ghost_batch_norm: bool=False, num_splits: int=2, dropout_value: float=0): Model used on MNIST dataset. Model summary: .. code-block:: none ----------------...
5ca77b7691d15fa5c7a904e1797b87e4ae659a8a
<|skeleton|> class MnistNet: def __init__(self, use_ghost_batch_norm: bool=False, num_splits: int=2, dropout_value: float=0): """Model used on MNIST dataset. Model summary: .. code-block:: none ---------------------------------------------------------------- Layer (type) Output Shape Param # ==============...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MnistNet: def __init__(self, use_ghost_batch_norm: bool=False, num_splits: int=2, dropout_value: float=0): """Model used on MNIST dataset. Model summary: .. code-block:: none ---------------------------------------------------------------- Layer (type) Output Shape Param # ============================...
the_stack_v2_python_sparse
athena/models/mnist.py
firekind/athena
train
1
e44ca393f1970a08b88b045422a099b883e84ae4
[ "if not root:\n return ''\narr = []\nqueue = [root]\nwhile queue:\n node = queue.pop(0)\n arr.append(str(node.val) if node else 'null')\n if node:\n queue.append(node.left)\n queue.append(node.right)\nwhile arr[-1] == 'null':\n arr.pop()\nreturn ','.join(arr)", "if not data:\n retu...
<|body_start_0|> if not root: return '' arr = [] queue = [root] while queue: node = queue.pop(0) arr.append(str(node.val) if node else 'null') if node: queue.append(node.left) queue.append(node.right) ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_006873
2,195
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_009105
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
26fddfdbd09c30376cb0720e13baf0402c3a1e90
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '' arr = [] queue = [root] while queue: node = queue.pop(0) arr.append(str(node.val) if node else 'null') ...
the_stack_v2_python_sparse
2022.2.8start/297.二叉树的序列化与反序列化.py
cosJin/LeetCode
train
0
da054bd21ff209cd6eb64cdd2cc767a27f7e28dc
[ "user = current_user(request)\nsequences = list(Sequence.objects.filter(user=user).values())\nreturn JsonResponse({'data': sequences})", "user = current_user(request)\ndata = json.loads(request.body)\nfiletype = data['input_file_format']\nparser = Parser(data['raw_sequence'], filetype)\nfor rec in parser.records:...
<|body_start_0|> user = current_user(request) sequences = list(Sequence.objects.filter(user=user).values()) return JsonResponse({'data': sequences}) <|end_body_0|> <|body_start_1|> user = current_user(request) data = json.loads(request.body) filetype = data['input_file_f...
Sequence views
SequencesView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SequencesView: """Sequence views""" def get(self, request): """Retrieve all sequences for current user""" <|body_0|> def post(self, request): """Save new sequence with user_id = current_user.id to database""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_75kplus_train_006874
2,932
no_license
[ { "docstring": "Retrieve all sequences for current user", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Save new sequence with user_id = current_user.id to database", "name": "post", "signature": "def post(self, request)" } ]
2
null
Implement the Python class `SequencesView` described below. Class description: Sequence views Method signatures and docstrings: - def get(self, request): Retrieve all sequences for current user - def post(self, request): Save new sequence with user_id = current_user.id to database
Implement the Python class `SequencesView` described below. Class description: Sequence views Method signatures and docstrings: - def get(self, request): Retrieve all sequences for current user - def post(self, request): Save new sequence with user_id = current_user.id to database <|skeleton|> class SequencesView: ...
5db3bf535f0e0261e9d2a0c7ef25cc70d25afa3a
<|skeleton|> class SequencesView: """Sequence views""" def get(self, request): """Retrieve all sequences for current user""" <|body_0|> def post(self, request): """Save new sequence with user_id = current_user.id to database""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SequencesView: """Sequence views""" def get(self, request): """Retrieve all sequences for current user""" user = current_user(request) sequences = list(Sequence.objects.filter(user=user).values()) return JsonResponse({'data': sequences}) def post(self, request): ...
the_stack_v2_python_sparse
dna_sequence/views.py
cossentino/dna-seq-viewer_backend
train
0
1789d6a1ff19bcd2ae62d822ef7817fbe2a4818f
[ "self.res = []\n\ndef traverse(node):\n if node is None:\n return\n self.res.append(node.val)\n if node.children is None:\n return\n for c in node.children:\n traverse(c)\ntraverse(root)\nreturn self.res", "res = []\nstack = [root]\nwhile stack:\n n = stack.pop()\n if n is N...
<|body_start_0|> self.res = [] def traverse(node): if node is None: return self.res.append(node.val) if node.children is None: return for c in node.children: traverse(c) traverse(root) return...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def preorder(self, root): """:type root: Node :rtype: List[int]""" <|body_0|> def solve2(self, root): """:type root: Node :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.res = [] def traverse(node): ...
stack_v2_sparse_classes_75kplus_train_006875
1,303
no_license
[ { "docstring": ":type root: Node :rtype: List[int]", "name": "preorder", "signature": "def preorder(self, root)" }, { "docstring": ":type root: Node :rtype: List[int]", "name": "solve2", "signature": "def solve2(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorder(self, root): :type root: Node :rtype: List[int] - def solve2(self, root): :type root: Node :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorder(self, root): :type root: Node :rtype: List[int] - def solve2(self, root): :type root: Node :rtype: List[int] <|skeleton|> class Solution: def preorder(self, ro...
a5cb862f0c5a3cfd21468141800568c2dedded0a
<|skeleton|> class Solution: def preorder(self, root): """:type root: Node :rtype: List[int]""" <|body_0|> def solve2(self, root): """:type root: Node :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def preorder(self, root): """:type root: Node :rtype: List[int]""" self.res = [] def traverse(node): if node is None: return self.res.append(node.val) if node.children is None: return for c in no...
the_stack_v2_python_sparse
python/leetcode/tree/589_N-aray_preorder.py
Levintsky/topcoder
train
0
f4662effe99b533f906a1c3edd7a65f950feda13
[ "url = await super()._api_url()\ncomponent = self._parameter('component')\nbranch = self._parameter('branch')\nmetric_keys = 'tests,test_errors,test_failures,skipped_tests'\nreturn URL(f'{url}/api/measures/component?component={component}&branch={branch}&metricKeys={metric_keys}')", "url = await super()._landing_u...
<|body_start_0|> url = await super()._api_url() component = self._parameter('component') branch = self._parameter('branch') metric_keys = 'tests,test_errors,test_failures,skipped_tests' return URL(f'{url}/api/measures/component?component={component}&branch={branch}&metricKeys={me...
SonarQube collector for the tests metric.
SonarQubeTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SonarQubeTests: """SonarQube collector for the tests metric.""" async def _api_url(self) -> URL: """Extend to add the measures path and parameters.""" <|body_0|> async def _landing_url(self, responses: SourceResponses) -> URL: """Extend to add the measures path a...
stack_v2_sparse_classes_75kplus_train_006876
2,318
permissive
[ { "docstring": "Extend to add the measures path and parameters.", "name": "_api_url", "signature": "async def _api_url(self) -> URL" }, { "docstring": "Extend to add the measures path and parameters.", "name": "_landing_url", "signature": "async def _landing_url(self, responses: SourceRe...
4
stack_v2_sparse_classes_30k_train_015253
Implement the Python class `SonarQubeTests` described below. Class description: SonarQube collector for the tests metric. Method signatures and docstrings: - async def _api_url(self) -> URL: Extend to add the measures path and parameters. - async def _landing_url(self, responses: SourceResponses) -> URL: Extend to ad...
Implement the Python class `SonarQubeTests` described below. Class description: SonarQube collector for the tests metric. Method signatures and docstrings: - async def _api_url(self) -> URL: Extend to add the measures path and parameters. - async def _landing_url(self, responses: SourceResponses) -> URL: Extend to ad...
5d9952bf0bd47895824fa78428d3e4f4d6b5d9b3
<|skeleton|> class SonarQubeTests: """SonarQube collector for the tests metric.""" async def _api_url(self) -> URL: """Extend to add the measures path and parameters.""" <|body_0|> async def _landing_url(self, responses: SourceResponses) -> URL: """Extend to add the measures path a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SonarQubeTests: """SonarQube collector for the tests metric.""" async def _api_url(self) -> URL: """Extend to add the measures path and parameters.""" url = await super()._api_url() component = self._parameter('component') branch = self._parameter('branch') metric_...
the_stack_v2_python_sparse
components/collector/src/source_collectors/sonarqube/tests.py
ICTU/quality-time
train
43
106f72fc320b7c2f5c3743091c3f0dfeb99a35b6
[ "Version.objects.all().delete()\nTestModel.objects.all().delete()\nTestManyToManyModel.objects.all().delete()\nreversion.register(TestModel, follow=('testmanytomanymodel_set',))\nreversion.register(TestManyToManyModel, follow=('relations',))", "with reversion.revision:\n test1 = TestModel.objects.create(name='...
<|body_start_0|> Version.objects.all().delete() TestModel.objects.all().delete() TestManyToManyModel.objects.all().delete() reversion.register(TestModel, follow=('testmanytomanymodel_set',)) reversion.register(TestManyToManyModel, follow=('relations',)) <|end_body_0|> <|body_sta...
Tests the ManyToMany support.
ReversionManyToManyTest
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReversionManyToManyTest: """Tests the ManyToMany support.""" def setUp(self): """Sets up the TestModel.""" <|body_0|> def testCanCreateRevision(self): """Tests that a revision containing both models is created.""" <|body_1|> def testCanCreateRevision...
stack_v2_sparse_classes_75kplus_train_006877
24,355
permissive
[ { "docstring": "Sets up the TestModel.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Tests that a revision containing both models is created.", "name": "testCanCreateRevision", "signature": "def testCanCreateRevision(self)" }, { "docstring": "Tests that a r...
6
stack_v2_sparse_classes_30k_train_028840
Implement the Python class `ReversionManyToManyTest` described below. Class description: Tests the ManyToMany support. Method signatures and docstrings: - def setUp(self): Sets up the TestModel. - def testCanCreateRevision(self): Tests that a revision containing both models is created. - def testCanCreateRevisionRela...
Implement the Python class `ReversionManyToManyTest` described below. Class description: Tests the ManyToMany support. Method signatures and docstrings: - def setUp(self): Sets up the TestModel. - def testCanCreateRevision(self): Tests that a revision containing both models is created. - def testCanCreateRevisionRela...
abc3fbfb34f791f84e9a9d4dc522966421778ab2
<|skeleton|> class ReversionManyToManyTest: """Tests the ManyToMany support.""" def setUp(self): """Sets up the TestModel.""" <|body_0|> def testCanCreateRevision(self): """Tests that a revision containing both models is created.""" <|body_1|> def testCanCreateRevision...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ReversionManyToManyTest: """Tests the ManyToMany support.""" def setUp(self): """Sets up the TestModel.""" Version.objects.all().delete() TestModel.objects.all().delete() TestManyToManyModel.objects.all().delete() reversion.register(TestModel, follow=('testmanytoma...
the_stack_v2_python_sparse
py/django_tools/django-reversion/src/reversion/tests.py
marceltoben/evandrix.github.com
train
3
b15ba7cef3508df1cfd81dfdec7a09b6c41493af
[ "Object.__init__(**locals())\nif emulator is not None:\n assert surface is None\n self.emulator_type = 'numerical'\nelif surface is not None:\n assert emulator is None\n self.emulator_type = 'analytic'\n self.emulator = surface\nelse:\n Logger.log('One of emulator or surface needs to be provided',...
<|body_start_0|> Object.__init__(**locals()) if emulator is not None: assert surface is None self.emulator_type = 'numerical' elif surface is not None: assert emulator is None self.emulator_type = 'analytic' self.emulator = surface ...
Evaluator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Evaluator: def __init__(self, planner, emulator=None, surface=None, campaign=Campaign(), database=None): """The Evaluator does higher level operations that Planners and Emulators do not do on their own. For instance, communicating parameters and measurements to each other, keeping track ...
stack_v2_sparse_classes_75kplus_train_006878
3,397
permissive
[ { "docstring": "The Evaluator does higher level operations that Planners and Emulators do not do on their own. For instance, communicating parameters and measurements to each other, keeping track of them ensuring they match, and storing these in a Campaign object. All this can also be done by the user using pla...
2
null
Implement the Python class `Evaluator` described below. Class description: Implement the Evaluator class. Method signatures and docstrings: - def __init__(self, planner, emulator=None, surface=None, campaign=Campaign(), database=None): The Evaluator does higher level operations that Planners and Emulators do not do o...
Implement the Python class `Evaluator` described below. Class description: Implement the Evaluator class. Method signatures and docstrings: - def __init__(self, planner, emulator=None, surface=None, campaign=Campaign(), database=None): The Evaluator does higher level operations that Planners and Emulators do not do o...
f57ad769918c0d5d805c439ab5ffbd180af698fa
<|skeleton|> class Evaluator: def __init__(self, planner, emulator=None, surface=None, campaign=Campaign(), database=None): """The Evaluator does higher level operations that Planners and Emulators do not do on their own. For instance, communicating parameters and measurements to each other, keeping track ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Evaluator: def __init__(self, planner, emulator=None, surface=None, campaign=Campaign(), database=None): """The Evaluator does higher level operations that Planners and Emulators do not do on their own. For instance, communicating parameters and measurements to each other, keeping track of them ensuri...
the_stack_v2_python_sparse
src/olympus/evaluators/evaluator.py
priyansh-1902/olympus
train
0
153d4f5a990a839141e976693161448d44c8c43d
[ "cart = self.get_object()\ntry:\n product = Product.objects.get(pk=request.data['product_id'])\n quantity = int(request.data['quantity'])\nexcept Exception as e:\n return Response(e, status=status.HTTP_404_NOT_FOUND)\nexisting_cart_item = CartItem.objects.filter(cart=cart, product=product).first()\nif exis...
<|body_start_0|> cart = self.get_object() try: product = Product.objects.get(pk=request.data['product_id']) quantity = int(request.data['quantity']) except Exception as e: return Response(e, status=status.HTTP_404_NOT_FOUND) existing_cart_item = CartIt...
API endpoint to Cart CRUD
CartViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CartViewSet: """API endpoint to Cart CRUD""" def add_to_cart(self, request, pk=None): """Add an item to a user's cart. Return the updated cart. Json { "product_id": "1", "quantity": "2" }""" <|body_0|> def remove_from_cart(self, request, pk=None): """Remove an it...
stack_v2_sparse_classes_75kplus_train_006879
6,344
no_license
[ { "docstring": "Add an item to a user's cart. Return the updated cart. Json { \"product_id\": \"1\", \"quantity\": \"2\" }", "name": "add_to_cart", "signature": "def add_to_cart(self, request, pk=None)" }, { "docstring": "Remove an item from a user's cart. Return the updated cart.", "name": ...
2
null
Implement the Python class `CartViewSet` described below. Class description: API endpoint to Cart CRUD Method signatures and docstrings: - def add_to_cart(self, request, pk=None): Add an item to a user's cart. Return the updated cart. Json { "product_id": "1", "quantity": "2" } - def remove_from_cart(self, request, p...
Implement the Python class `CartViewSet` described below. Class description: API endpoint to Cart CRUD Method signatures and docstrings: - def add_to_cart(self, request, pk=None): Add an item to a user's cart. Return the updated cart. Json { "product_id": "1", "quantity": "2" } - def remove_from_cart(self, request, p...
be4f4e20b1226e6c8985a546afc5f95d8f7eb9bf
<|skeleton|> class CartViewSet: """API endpoint to Cart CRUD""" def add_to_cart(self, request, pk=None): """Add an item to a user's cart. Return the updated cart. Json { "product_id": "1", "quantity": "2" }""" <|body_0|> def remove_from_cart(self, request, pk=None): """Remove an it...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CartViewSet: """API endpoint to Cart CRUD""" def add_to_cart(self, request, pk=None): """Add an item to a user's cart. Return the updated cart. Json { "product_id": "1", "quantity": "2" }""" cart = self.get_object() try: product = Product.objects.get(pk=request.data['p...
the_stack_v2_python_sparse
api/apps/cart/views.py
psswid/DRFApp
train
0
793051d0fcc1e48f3807677faf16cdb4ab6d8803
[ "try:\n cls.cache.set(image_record.image_short_url, os.path.join(image_record.storage_full_dir, image_record.image_filename))\nexcept Exception as e:\n logger.warning('Value was not cached: '.format(e))", "try:\n return cls.cache.get(image_short_url)\nexcept Exception as e:\n logger.warning('Cached va...
<|body_start_0|> try: cls.cache.set(image_record.image_short_url, os.path.join(image_record.storage_full_dir, image_record.image_filename)) except Exception as e: logger.warning('Value was not cached: '.format(e)) <|end_body_0|> <|body_start_1|> try: return c...
Special type of Cache manager that will be responsible for caching image_short_url and image_full_path either on Redis on SimpleCache
ImageUrlCacheManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageUrlCacheManager: """Special type of Cache manager that will be responsible for caching image_short_url and image_full_path either on Redis on SimpleCache""" def cache_image_short_url(cls, image_record): """Helper function to cache image's short_url and image full_path. Image sho...
stack_v2_sparse_classes_75kplus_train_006880
2,169
permissive
[ { "docstring": "Helper function to cache image's short_url and image full_path. Image short_url is cached as key, and image full path is cached as value :param image_record: :return: None", "name": "cache_image_short_url", "signature": "def cache_image_short_url(cls, image_record)" }, { "docstri...
2
stack_v2_sparse_classes_30k_train_023612
Implement the Python class `ImageUrlCacheManager` described below. Class description: Special type of Cache manager that will be responsible for caching image_short_url and image_full_path either on Redis on SimpleCache Method signatures and docstrings: - def cache_image_short_url(cls, image_record): Helper function ...
Implement the Python class `ImageUrlCacheManager` described below. Class description: Special type of Cache manager that will be responsible for caching image_short_url and image_full_path either on Redis on SimpleCache Method signatures and docstrings: - def cache_image_short_url(cls, image_record): Helper function ...
f1097c7b081acdd74f35c7aa04e2fed2ecb16e85
<|skeleton|> class ImageUrlCacheManager: """Special type of Cache manager that will be responsible for caching image_short_url and image_full_path either on Redis on SimpleCache""" def cache_image_short_url(cls, image_record): """Helper function to cache image's short_url and image full_path. Image sho...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImageUrlCacheManager: """Special type of Cache manager that will be responsible for caching image_short_url and image_full_path either on Redis on SimpleCache""" def cache_image_short_url(cls, image_record): """Helper function to cache image's short_url and image full_path. Image short_url is cac...
the_stack_v2_python_sparse
classes/cache_managers.py
veken1199/CityLibraries
train
0
33f01f6a41f63f4a22c9c3457d71ed2d44853e5e
[ "super(InTriggerDistanceToLocation, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._target_location = target_location\nself._actor = actor\nself._distance = distance", "new_status = py_trees.common.Status.RUNNING\nlocation = CarlaDataProvider.get_location(self._actor)\nif...
<|body_start_0|> super(InTriggerDistanceToLocation, self).__init__(name) self.logger.debug('%s.__init__()' % self.__class__.__name__) self._target_location = target_location self._actor = actor self._distance = distance <|end_body_0|> <|body_start_1|> new_status = py_tre...
This class contains the trigger (condition) for a distance to a fixed location of a scenario
InTriggerDistanceToLocation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InTriggerDistanceToLocation: """This class contains the trigger (condition) for a distance to a fixed location of a scenario""" def __init__(self, actor, target_location, distance, name='InTriggerDistanceToLocation'): """Setup trigger distance""" <|body_0|> def update(se...
stack_v2_sparse_classes_75kplus_train_006881
25,380
permissive
[ { "docstring": "Setup trigger distance", "name": "__init__", "signature": "def __init__(self, actor, target_location, distance, name='InTriggerDistanceToLocation')" }, { "docstring": "Check if the actor is within trigger distance to the target location", "name": "update", "signature": "d...
2
stack_v2_sparse_classes_30k_train_034121
Implement the Python class `InTriggerDistanceToLocation` described below. Class description: This class contains the trigger (condition) for a distance to a fixed location of a scenario Method signatures and docstrings: - def __init__(self, actor, target_location, distance, name='InTriggerDistanceToLocation'): Setup ...
Implement the Python class `InTriggerDistanceToLocation` described below. Class description: This class contains the trigger (condition) for a distance to a fixed location of a scenario Method signatures and docstrings: - def __init__(self, actor, target_location, distance, name='InTriggerDistanceToLocation'): Setup ...
1d3e8339f8e60f7bdcaefeff49ec238b1746b047
<|skeleton|> class InTriggerDistanceToLocation: """This class contains the trigger (condition) for a distance to a fixed location of a scenario""" def __init__(self, actor, target_location, distance, name='InTriggerDistanceToLocation'): """Setup trigger distance""" <|body_0|> def update(se...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InTriggerDistanceToLocation: """This class contains the trigger (condition) for a distance to a fixed location of a scenario""" def __init__(self, actor, target_location, distance, name='InTriggerDistanceToLocation'): """Setup trigger distance""" super(InTriggerDistanceToLocation, self)._...
the_stack_v2_python_sparse
srunner/scenariomanager/atomic_scenario_behavior.py
chauvinSimon/scenario_runner
train
2
86951d6db83ab5f1900c3e52c12cae259b1c6310
[ "super(ActorCnn, self).__init__()\nself.conv1 = nn.Conv2d(num_images, 32, 8, 4)\nself.conv2 = nn.Conv2d(32, 64, 4, 2)\nself.conv3 = nn.Conv2d(64, 64, 3)\nself.fc1 = nn.Linear(1024, 400)\nself.fc2 = nn.Linear(400, 300)\nself.fc3 = nn.Linear(300, num_actions)\nfan_in, _ = nn.init._calculate_fan_in_and_fan_out(self.co...
<|body_start_0|> super(ActorCnn, self).__init__() self.conv1 = nn.Conv2d(num_images, 32, 8, 4) self.conv2 = nn.Conv2d(32, 64, 4, 2) self.conv3 = nn.Conv2d(64, 64, 3) self.fc1 = nn.Linear(1024, 400) self.fc2 = nn.Linear(400, 300) self.fc3 = nn.Linear(300, num_actio...
Represents an Actor in the Actor to Critic Model.
ActorCnn
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActorCnn: """Represents an Actor in the Actor to Critic Model.""" def __init__(self, num_images, num_actions): """Initialise layers. Args: num_images (int) : Number of greyscale images num_actions (int) : Number of actions""" <|body_0|> def forward(self, batch): ...
stack_v2_sparse_classes_75kplus_train_006882
13,450
no_license
[ { "docstring": "Initialise layers. Args: num_images (int) : Number of greyscale images num_actions (int) : Number of actions", "name": "__init__", "signature": "def __init__(self, num_images, num_actions)" }, { "docstring": "Generate action policy for the batch of observations. Args: batch (floa...
2
stack_v2_sparse_classes_30k_val_001061
Implement the Python class `ActorCnn` described below. Class description: Represents an Actor in the Actor to Critic Model. Method signatures and docstrings: - def __init__(self, num_images, num_actions): Initialise layers. Args: num_images (int) : Number of greyscale images num_actions (int) : Number of actions - de...
Implement the Python class `ActorCnn` described below. Class description: Represents an Actor in the Actor to Critic Model. Method signatures and docstrings: - def __init__(self, num_images, num_actions): Initialise layers. Args: num_images (int) : Number of greyscale images num_actions (int) : Number of actions - de...
6dcb04e79f776fc780b843208e2c689578c94bb3
<|skeleton|> class ActorCnn: """Represents an Actor in the Actor to Critic Model.""" def __init__(self, num_images, num_actions): """Initialise layers. Args: num_images (int) : Number of greyscale images num_actions (int) : Number of actions""" <|body_0|> def forward(self, batch): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ActorCnn: """Represents an Actor in the Actor to Critic Model.""" def __init__(self, num_images, num_actions): """Initialise layers. Args: num_images (int) : Number of greyscale images num_actions (int) : Number of actions""" super(ActorCnn, self).__init__() self.conv1 = nn.Conv2d...
the_stack_v2_python_sparse
retina_reinforcement_sim/src/model/models.py
lewisboyd/MsciProject
train
0
892cbc07a1524f47caaf9eddeb1e1485bb79c915
[ "data = form.cleaned_data\nself.success_url = reverse('course_result', kwargs={'course': int(data['course'].id)})\nreturn super().form_valid(form)", "context = super().get_context_data(**kwargs)\ncontext['title_text'] = 'Choose Course Result To Display'\ncontext['detail_text'] = 'Please select the <strong>Course\...
<|body_start_0|> data = form.cleaned_data self.success_url = reverse('course_result', kwargs={'course': int(data['course'].id)}) return super().form_valid(form) <|end_body_0|> <|body_start_1|> context = super().get_context_data(**kwargs) context['title_text'] = 'Choose Course Re...
View for choosing which course result to display. Check that the user's account is still active. Redirects to course_result view on form valid.
ShowCourseResultView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShowCourseResultView: """View for choosing which course result to display. Check that the user's account is still active. Redirects to course_result view on form valid.""" def form_valid(self, form): """Compute the success URL and call super.form_valid()""" <|body_0|> de...
stack_v2_sparse_classes_75kplus_train_006883
29,759
no_license
[ { "docstring": "Compute the success URL and call super.form_valid()", "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_043214
Implement the Python class `ShowCourseResultView` described below. Class description: View for choosing which course result to display. Check that the user's account is still active. Redirects to course_result view on form valid. Method signatures and docstrings: - def form_valid(self, form): Compute the success URL ...
Implement the Python class `ShowCourseResultView` described below. Class description: View for choosing which course result to display. Check that the user's account is still active. Redirects to course_result view on form valid. Method signatures and docstrings: - def form_valid(self, form): Compute the success URL ...
06bc577d01d3dbf6c425e03dcb903977a38e377c
<|skeleton|> class ShowCourseResultView: """View for choosing which course result to display. Check that the user's account is still active. Redirects to course_result view on form valid.""" def form_valid(self, form): """Compute the success URL and call super.form_valid()""" <|body_0|> de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ShowCourseResultView: """View for choosing which course result to display. Check that the user's account is still active. Redirects to course_result view on form valid.""" def form_valid(self, form): """Compute the success URL and call super.form_valid()""" data = form.cleaned_data ...
the_stack_v2_python_sparse
cbt/views.py
Festusali/CBTest
train
6
1827159197cf616b96bf28aaf9dde7d297e21408
[ "super(EncoderBlock, self).__init__()\nself.mha = MultiHeadAttention(dm, h)\nself.dense_hidden = tf.keras.layers.Dense(hidden, activation='relu')\nself.dense_output = tf.keras.layers.Dense(dm)\nself.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1e-06)\nself.layernorm2 = tf.keras.layers.LayerNormalization(...
<|body_start_0|> super(EncoderBlock, self).__init__() self.mha = MultiHeadAttention(dm, h) self.dense_hidden = tf.keras.layers.Dense(hidden, activation='relu') self.dense_output = tf.keras.layers.Dense(dm) self.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1e-06) ...
[summary] Args: tf ([type]): [description]
EncoderBlock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderBlock: """[summary] Args: tf ([type]): [description]""" def __init__(self, dm, h, hidden, drop_rate=0.1): """[summary] Args: dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] drop_rate (float, optional): [description]. Defaults to 0.1.""" ...
stack_v2_sparse_classes_75kplus_train_006884
1,702
no_license
[ { "docstring": "[summary] Args: dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] drop_rate (float, optional): [description]. Defaults to 0.1.", "name": "__init__", "signature": "def __init__(self, dm, h, hidden, drop_rate=0.1)" }, { "docstring": "[summary] Args...
2
stack_v2_sparse_classes_30k_val_000355
Implement the Python class `EncoderBlock` described below. Class description: [summary] Args: tf ([type]): [description] Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): [summary] Args: dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] drop_rate (...
Implement the Python class `EncoderBlock` described below. Class description: [summary] Args: tf ([type]): [description] Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): [summary] Args: dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] drop_rate (...
5f86dee95f4d1c32014d0d74a368f342ff3ce6f7
<|skeleton|> class EncoderBlock: """[summary] Args: tf ([type]): [description]""" def __init__(self, dm, h, hidden, drop_rate=0.1): """[summary] Args: dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] drop_rate (float, optional): [description]. Defaults to 0.1.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EncoderBlock: """[summary] Args: tf ([type]): [description]""" def __init__(self, dm, h, hidden, drop_rate=0.1): """[summary] Args: dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] drop_rate (float, optional): [description]. Defaults to 0.1.""" super(Enc...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/7-transformer_encoder_block.py
d1sd41n/holbertonschool-machine_learning
train
0
63486076b78466c6e2ae0a103a628f366a413ab2
[ "time.sleep(2)\nMsgLoginPage(web_page).login(data['username'], data['code'])\nlogging.info('开始断言')\ntime.sleep(3)\ntry:\n assert MsgLoginPage(web_page).login_success() == data['check']\n logging.info('登录成功')\nexcept:\n print('登录失败')\n common.save_screenShot(web_page, model_name='登录页面')\n raise", "M...
<|body_start_0|> time.sleep(2) MsgLoginPage(web_page).login(data['username'], data['code']) logging.info('开始断言') time.sleep(3) try: assert MsgLoginPage(web_page).login_success() == data['check'] logging.info('登录成功') except: print('登录失败'...
TestMsgLogin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestMsgLogin: def test_Msg_login_success(self, data, web_page): """成功登录""" <|body_0|> def test_Msg_usernotin(self, data, web_page): """验证码错误""" <|body_1|> def test_Msg_usernotin2(self, data, web_page): """手机号码错误""" <|body_2|> <|end_skele...
stack_v2_sparse_classes_75kplus_train_006885
2,325
no_license
[ { "docstring": "成功登录", "name": "test_Msg_login_success", "signature": "def test_Msg_login_success(self, data, web_page)" }, { "docstring": "验证码错误", "name": "test_Msg_usernotin", "signature": "def test_Msg_usernotin(self, data, web_page)" }, { "docstring": "手机号码错误", "name": "t...
3
stack_v2_sparse_classes_30k_train_042818
Implement the Python class `TestMsgLogin` described below. Class description: Implement the TestMsgLogin class. Method signatures and docstrings: - def test_Msg_login_success(self, data, web_page): 成功登录 - def test_Msg_usernotin(self, data, web_page): 验证码错误 - def test_Msg_usernotin2(self, data, web_page): 手机号码错误
Implement the Python class `TestMsgLogin` described below. Class description: Implement the TestMsgLogin class. Method signatures and docstrings: - def test_Msg_login_success(self, data, web_page): 成功登录 - def test_Msg_usernotin(self, data, web_page): 验证码错误 - def test_Msg_usernotin2(self, data, web_page): 手机号码错误 <|sk...
b262c13e55a6e9eae1d4fa11d50b71814028261c
<|skeleton|> class TestMsgLogin: def test_Msg_login_success(self, data, web_page): """成功登录""" <|body_0|> def test_Msg_usernotin(self, data, web_page): """验证码错误""" <|body_1|> def test_Msg_usernotin2(self, data, web_page): """手机号码错误""" <|body_2|> <|end_skele...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestMsgLogin: def test_Msg_login_success(self, data, web_page): """成功登录""" time.sleep(2) MsgLoginPage(web_page).login(data['username'], data['code']) logging.info('开始断言') time.sleep(3) try: assert MsgLoginPage(web_page).login_success() == data['check...
the_stack_v2_python_sparse
TestCase/test_C_web/test_login_msg.py
xjx985426946/Test_UI
train
0
5f68c12b451b9f1fc219fdbbb55790095818cf07
[ "self.restaurant_name = restaurant_name\nself.cuisine_type = cuisine_type\nself.flavors = ['vanilla', 'chocolate', 'strawberry']", "print('Avaliable flavors: ')\nfor flavor in self.flavors:\n print('\\t' + flavor.title())" ]
<|body_start_0|> self.restaurant_name = restaurant_name self.cuisine_type = cuisine_type self.flavors = ['vanilla', 'chocolate', 'strawberry'] <|end_body_0|> <|body_start_1|> print('Avaliable flavors: ') for flavor in self.flavors: print('\t' + flavor.title()) <|end_...
Type of restaurant that specifically serves ice cream
IceCreamStand
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IceCreamStand: """Type of restaurant that specifically serves ice cream""" def __init__(self, restaurant_name, cuisine_type='ice-cream'): """Initialize name and attributes""" <|body_0|> def show_flavors(self): """prints ice cream flavors""" <|body_1|> <|...
stack_v2_sparse_classes_75kplus_train_006886
1,761
no_license
[ { "docstring": "Initialize name and attributes", "name": "__init__", "signature": "def __init__(self, restaurant_name, cuisine_type='ice-cream')" }, { "docstring": "prints ice cream flavors", "name": "show_flavors", "signature": "def show_flavors(self)" } ]
2
stack_v2_sparse_classes_30k_train_031728
Implement the Python class `IceCreamStand` described below. Class description: Type of restaurant that specifically serves ice cream Method signatures and docstrings: - def __init__(self, restaurant_name, cuisine_type='ice-cream'): Initialize name and attributes - def show_flavors(self): prints ice cream flavors
Implement the Python class `IceCreamStand` described below. Class description: Type of restaurant that specifically serves ice cream Method signatures and docstrings: - def __init__(self, restaurant_name, cuisine_type='ice-cream'): Initialize name and attributes - def show_flavors(self): prints ice cream flavors <|s...
b93c3cd5e1c1b91079db2281137a8451f2566885
<|skeleton|> class IceCreamStand: """Type of restaurant that specifically serves ice cream""" def __init__(self, restaurant_name, cuisine_type='ice-cream'): """Initialize name and attributes""" <|body_0|> def show_flavors(self): """prints ice cream flavors""" <|body_1|> <|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IceCreamStand: """Type of restaurant that specifically serves ice cream""" def __init__(self, restaurant_name, cuisine_type='ice-cream'): """Initialize name and attributes""" self.restaurant_name = restaurant_name self.cuisine_type = cuisine_type self.flavors = ['vanilla',...
the_stack_v2_python_sparse
Crash Course/ch9-Classes/ice-cream.py
jpc0016/Python-Examples
train
1
5c4249ee4352c5b4d54c1ba6660b9d14d303e7a6
[ "alternatives = AlternativeTrack.all().filter('replacement_for_id = ', track_id).filter('replacement_type = ', track_type)\njson = []\nfor alternative in alternatives:\n json.append(get_alternative_struct(alternative))\nself.response.headers['Content-Type'] = 'application/json'\nself.response.out.write(simplejso...
<|body_start_0|> alternatives = AlternativeTrack.all().filter('replacement_for_id = ', track_id).filter('replacement_type = ', track_type) json = [] for alternative in alternatives: json.append(get_alternative_struct(alternative)) self.response.headers['Content-Type'] = 'appl...
AlternativesHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlternativesHandler: def get(self, track_type, track_id): """get alternatives for a track""" <|body_0|> def post(self, track_type, track_id): """change rating or add a new alternative track""" <|body_1|> <|end_skeleton|> <|body_start_0|> alternative...
stack_v2_sparse_classes_75kplus_train_006887
2,221
permissive
[ { "docstring": "get alternatives for a track", "name": "get", "signature": "def get(self, track_type, track_id)" }, { "docstring": "change rating or add a new alternative track", "name": "post", "signature": "def post(self, track_type, track_id)" } ]
2
null
Implement the Python class `AlternativesHandler` described below. Class description: Implement the AlternativesHandler class. Method signatures and docstrings: - def get(self, track_type, track_id): get alternatives for a track - def post(self, track_type, track_id): change rating or add a new alternative track
Implement the Python class `AlternativesHandler` described below. Class description: Implement the AlternativesHandler class. Method signatures and docstrings: - def get(self, track_type, track_id): get alternatives for a track - def post(self, track_type, track_id): change rating or add a new alternative track <|sk...
1855f242f15a9a66a8868ced849ddd77385426e7
<|skeleton|> class AlternativesHandler: def get(self, track_type, track_id): """get alternatives for a track""" <|body_0|> def post(self, track_type, track_id): """change rating or add a new alternative track""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AlternativesHandler: def get(self, track_type, track_id): """get alternatives for a track""" alternatives = AlternativeTrack.all().filter('replacement_for_id = ', track_id).filter('replacement_type = ', track_type) json = [] for alternative in alternatives: json.app...
the_stack_v2_python_sparse
alternatives.py
blen2r/youtify
train
0
9e07f29985be5f80dfa9f6181cd62dbc06572741
[ "self.main_path = main_path\nself.ch_list = ch_list\nself.feature_labels = []\nfor n in ch_list:\n self.feature_labels += [x.__name__ + '_' + str(n) for x in param_list]\nself.feature_labels += [x.__name__ for x in cross_ch_param_list]\nself.feature_labels = np.array(self.feature_labels)\nself.thresh_array, self...
<|body_start_0|> self.main_path = main_path self.ch_list = ch_list self.feature_labels = [] for n in ch_list: self.feature_labels += [x.__name__ + '_' + str(n) for x in param_list] self.feature_labels += [x.__name__ for x in cross_ch_param_list] self.feature_l...
MethodTest Tests different feature combinations for seizure prediction
MethodTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MethodTest: """MethodTest Tests different feature combinations for seizure prediction""" def __init__(self, main_path): """ThreshMetrics(main_path) Parameters ---------- input_path : Str, path to parent directory.""" <|body_0|> def multi_folder(self): """multi_fo...
stack_v2_sparse_classes_75kplus_train_006888
11,938
permissive
[ { "docstring": "ThreshMetrics(main_path) Parameters ---------- input_path : Str, path to parent directory.", "name": "__init__", "signature": "def __init__(self, main_path)" }, { "docstring": "multi_folder(self) Loop though folder paths get seizure metrics and save to csv Parameters ---------- m...
5
null
Implement the Python class `MethodTest` described below. Class description: MethodTest Tests different feature combinations for seizure prediction Method signatures and docstrings: - def __init__(self, main_path): ThreshMetrics(main_path) Parameters ---------- input_path : Str, path to parent directory. - def multi_f...
Implement the Python class `MethodTest` described below. Class description: MethodTest Tests different feature combinations for seizure prediction Method signatures and docstrings: - def __init__(self, main_path): ThreshMetrics(main_path) Parameters ---------- input_path : Str, path to parent directory. - def multi_f...
fd238749a8b80af1bd0902f737bc9017c4e29756
<|skeleton|> class MethodTest: """MethodTest Tests different feature combinations for seizure prediction""" def __init__(self, main_path): """ThreshMetrics(main_path) Parameters ---------- input_path : Str, path to parent directory.""" <|body_0|> def multi_folder(self): """multi_fo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MethodTest: """MethodTest Tests different feature combinations for seizure prediction""" def __init__(self, main_path): """ThreshMetrics(main_path) Parameters ---------- input_path : Str, path to parent directory.""" self.main_path = main_path self.ch_list = ch_list self.f...
the_stack_v2_python_sparse
model_selection/test_models.py
bhargavaganti/logic_seizedetect
train
0
346b6f61c44f289153f3cdb186efb90fc5bd265b
[ "if not root:\n return []\n\ndef preorder(root):\n stack, res = ([root], [])\n while stack:\n cur = stack.pop(-1)\n if cur:\n stack.append(cur.right)\n stack.append(cur.left)\n res.append(str(cur.val))\n else:\n res.append('.')\n res = '#'...
<|body_start_0|> if not root: return [] def preorder(root): stack, res = ([root], []) while stack: cur = stack.pop(-1) if cur: stack.append(cur.right) stack.append(cur.left) r...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_006889
1,353
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
dfa14495eff102c711860e37272850bdea6d1a98
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return [] def preorder(root): stack, res = ([root], []) while stack: cur = stack.pop(-1) if cur:...
the_stack_v2_python_sparse
tree/297. Serialize and Deserialize Binary Tree.py
lcltopismine/Leetcode-problem-collection
train
0
febd66555c1eed16ba25792950e20ee58883a497
[ "kernel_width = float(kernel_width)\n\ndef kernel(d):\n return np.sqrt(np.exp(-d ** 2 / kernel_width ** 2))\nself.random_state = check_random_state(random_state)\nself.feature_selection = feature_selection\nself.base = lime_base.LimeBase(kernel, verbose, random_state=self.random_state)\nself.dist = dist\nself.ve...
<|body_start_0|> kernel_width = float(kernel_width) def kernel(d): return np.sqrt(np.exp(-d ** 2 / kernel_width ** 2)) self.random_state = check_random_state(random_state) self.feature_selection = feature_selection self.base = lime_base.LimeBase(kernel, verbose, rand...
Explains predictions on Image (i.e. matrix) data. For numerical features, perturb them by sampling from a Normal(0,1) and doing the inverse operation of mean-centering and scaling, according to the means and stds in the training data. For categorical features, perturb by sampling according to the training distribution,...
LimeImageExplainerLinearRegression
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LimeImageExplainerLinearRegression: """Explains predictions on Image (i.e. matrix) data. For numerical features, perturb them by sampling from a Normal(0,1) and doing the inverse operation of mean-centering and scaling, according to the means and stds in the training data. For categorical feature...
stack_v2_sparse_classes_75kplus_train_006890
16,477
no_license
[ { "docstring": "Init function. Args: dist: sampling distance kernel_width: kernel width for the exponential kernel. If None, defaults to sqrt(number of columns) * 0.75 verbose: if true, print local prediction values from linear model feature_selection: feature selection method. can be 'forward_selection', 'lass...
4
stack_v2_sparse_classes_30k_train_051477
Implement the Python class `LimeImageExplainerLinearRegression` described below. Class description: Explains predictions on Image (i.e. matrix) data. For numerical features, perturb them by sampling from a Normal(0,1) and doing the inverse operation of mean-centering and scaling, according to the means and stds in the...
Implement the Python class `LimeImageExplainerLinearRegression` described below. Class description: Explains predictions on Image (i.e. matrix) data. For numerical features, perturb them by sampling from a Normal(0,1) and doing the inverse operation of mean-centering and scaling, according to the means and stds in the...
79cdc3eaa4c5826b6b9d9454aa08b68baa3e7fc4
<|skeleton|> class LimeImageExplainerLinearRegression: """Explains predictions on Image (i.e. matrix) data. For numerical features, perturb them by sampling from a Normal(0,1) and doing the inverse operation of mean-centering and scaling, according to the means and stds in the training data. For categorical feature...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LimeImageExplainerLinearRegression: """Explains predictions on Image (i.e. matrix) data. For numerical features, perturb them by sampling from a Normal(0,1) and doing the inverse operation of mean-centering and scaling, according to the means and stds in the training data. For categorical features, perturb by...
the_stack_v2_python_sparse
openapi/lime_ridge_regression.py
Minzc/OpenAPI-1
train
0
946e7659b849b17fcd3edd7bedd53697934b8554
[ "args = utils.get_args_raw(message).split(' ')\nreply = await message.get_reply_message()\nuser, tag = (None, None)\ntry:\n if len(args) == 1:\n args = utils.get_args_raw(message)\n user = await message.client.get_entity(args if not args.isnumeric() else int(args))\n tag = 'Hey'\n elif le...
<|body_start_0|> args = utils.get_args_raw(message).split(' ') reply = await message.get_reply_message() user, tag = (None, None) try: if len(args) == 1: args = utils.get_args_raw(message) user = await message.client.get_entity(args if not args...
Secretly tag a user
TagMod
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TagMod: """Secretly tag a user""" async def tagcmd(self, message): """.tag <@> <text>.""" <|body_0|> async def tagallcmd(self, message): """.tagall <text> - tag all users in chat""" <|body_1|> <|end_skeleton|> <|body_start_0|> args = utils.get_a...
stack_v2_sparse_classes_75kplus_train_006891
1,551
no_license
[ { "docstring": ".tag <@> <text>.", "name": "tagcmd", "signature": "async def tagcmd(self, message)" }, { "docstring": ".tagall <text> - tag all users in chat", "name": "tagallcmd", "signature": "async def tagallcmd(self, message)" } ]
2
stack_v2_sparse_classes_30k_train_046150
Implement the Python class `TagMod` described below. Class description: Secretly tag a user Method signatures and docstrings: - async def tagcmd(self, message): .tag <@> <text>. - async def tagallcmd(self, message): .tagall <text> - tag all users in chat
Implement the Python class `TagMod` described below. Class description: Secretly tag a user Method signatures and docstrings: - async def tagcmd(self, message): .tag <@> <text>. - async def tagallcmd(self, message): .tagall <text> - tag all users in chat <|skeleton|> class TagMod: """Secretly tag a user""" ...
f70ed62e39470335aba81ce0e8cac4e3c71e1500
<|skeleton|> class TagMod: """Secretly tag a user""" async def tagcmd(self, message): """.tag <@> <text>.""" <|body_0|> async def tagallcmd(self, message): """.tagall <text> - tag all users in chat""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TagMod: """Secretly tag a user""" async def tagcmd(self, message): """.tag <@> <text>.""" args = utils.get_args_raw(message).split(' ') reply = await message.get_reply_message() user, tag = (None, None) try: if len(args) == 1: args = uti...
the_stack_v2_python_sparse
tags.py
SergaTV/FTG-Modules
train
0
098ca878c22181e967649c49a8a71045cdf1a85b
[ "self._block_specs = block_specs\nself._batch_norm_activation = batch_norm_activation\nself._data_format = data_format", "x = images\nwith tf.variable_scope('efficientnet'):\n x = nn_ops.conv2d_fixed_padding(inputs=x, filters=32, kernel_size=3, strides=2, data_format=self._data_format)\n x = tf.identity(x, ...
<|body_start_0|> self._block_specs = block_specs self._batch_norm_activation = batch_norm_activation self._data_format = data_format <|end_body_0|> <|body_start_1|> x = images with tf.variable_scope('efficientnet'): x = nn_ops.conv2d_fixed_padding(inputs=x, filters=3...
Class to build EfficientNet and X family models.
EfficientNetX
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EfficientNetX: """Class to build EfficientNet and X family models.""" def __init__(self, block_specs=build_block_specs(), batch_norm_activation=nn_ops.BatchNormActivation(), data_format='channels_last'): """EfficientNet initialization function. Args: block_specs: a list of BlockSpec ...
stack_v2_sparse_classes_75kplus_train_006892
7,394
permissive
[ { "docstring": "EfficientNet initialization function. Args: block_specs: a list of BlockSpec objects that specifies the EfficientNet network. By default, the previously discovered EfficientNet-A1 is used. batch_norm_activation: an operation that includes a batch normalization layer followed by an optional activ...
2
stack_v2_sparse_classes_30k_train_012422
Implement the Python class `EfficientNetX` described below. Class description: Class to build EfficientNet and X family models. Method signatures and docstrings: - def __init__(self, block_specs=build_block_specs(), batch_norm_activation=nn_ops.BatchNormActivation(), data_format='channels_last'): EfficientNet initial...
Implement the Python class `EfficientNetX` described below. Class description: Class to build EfficientNet and X family models. Method signatures and docstrings: - def __init__(self, block_specs=build_block_specs(), batch_norm_activation=nn_ops.BatchNormActivation(), data_format='channels_last'): EfficientNet initial...
0f7adb97a93ec3e3485c261d030c507eb16b33e4
<|skeleton|> class EfficientNetX: """Class to build EfficientNet and X family models.""" def __init__(self, block_specs=build_block_specs(), batch_norm_activation=nn_ops.BatchNormActivation(), data_format='channels_last'): """EfficientNet initialization function. Args: block_specs: a list of BlockSpec ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EfficientNetX: """Class to build EfficientNet and X family models.""" def __init__(self, block_specs=build_block_specs(), batch_norm_activation=nn_ops.BatchNormActivation(), data_format='channels_last'): """EfficientNet initialization function. Args: block_specs: a list of BlockSpec objects that ...
the_stack_v2_python_sparse
models/official/detection/modeling/architecture/efficientnet.py
tensorflow/tpu
train
5,627
e661330204e9fe0062cfb9fc6c7a668abb66c9b2
[ "self.barcode = barcode\nself.location = location\nself.online = online", "if dictionary is None:\n return None\nbarcode = dictionary.get('barcode')\nlocation = dictionary.get('location')\nonline = dictionary.get('online')\nreturn cls(barcode, location, online)" ]
<|body_start_0|> self.barcode = barcode self.location = location self.online = online <|end_body_0|> <|body_start_1|> if dictionary is None: return None barcode = dictionary.get('barcode') location = dictionary.get('location') online = dictionary.get(...
Implementation of the 'TapeMediaInformation' model. Provides information about a single tape media in a QStar Archive Vault. Attributes: barcode (string): Specifies a unique identifier for the media. location (string): Specifies the location of the offline media as recorded by the backup administrator using media manag...
TapeMediaInformation
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TapeMediaInformation: """Implementation of the 'TapeMediaInformation' model. Provides information about a single tape media in a QStar Archive Vault. Attributes: barcode (string): Specifies a unique identifier for the media. location (string): Specifies the location of the offline media as record...
stack_v2_sparse_classes_75kplus_train_006893
2,046
permissive
[ { "docstring": "Constructor for the TapeMediaInformation class", "name": "__init__", "signature": "def __init__(self, barcode=None, location=None, online=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of th...
2
stack_v2_sparse_classes_30k_train_008785
Implement the Python class `TapeMediaInformation` described below. Class description: Implementation of the 'TapeMediaInformation' model. Provides information about a single tape media in a QStar Archive Vault. Attributes: barcode (string): Specifies a unique identifier for the media. location (string): Specifies the ...
Implement the Python class `TapeMediaInformation` described below. Class description: Implementation of the 'TapeMediaInformation' model. Provides information about a single tape media in a QStar Archive Vault. Attributes: barcode (string): Specifies a unique identifier for the media. location (string): Specifies the ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class TapeMediaInformation: """Implementation of the 'TapeMediaInformation' model. Provides information about a single tape media in a QStar Archive Vault. Attributes: barcode (string): Specifies a unique identifier for the media. location (string): Specifies the location of the offline media as record...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TapeMediaInformation: """Implementation of the 'TapeMediaInformation' model. Provides information about a single tape media in a QStar Archive Vault. Attributes: barcode (string): Specifies a unique identifier for the media. location (string): Specifies the location of the offline media as recorded by the bac...
the_stack_v2_python_sparse
cohesity_management_sdk/models/tape_media_information.py
cohesity/management-sdk-python
train
24
d65a58daf2b0ddcab9a40becf5fc6b01532cc9f4
[ "self.pre = [i for i in range(n)]\ngroup = n\nfor link in s:\n x, y = link\n root1 = self.unionsearch(x)\n root2 = self.unionsearch(y)\n if root1 != root2:\n self.pre[root1] = root2\n group -= 1\nreturn group", "son = root\nwhile root != self.pre[root]:\n root = self.pre[root]\nwhile ...
<|body_start_0|> self.pre = [i for i in range(n)] group = n for link in s: x, y = link root1 = self.unionsearch(x) root2 = self.unionsearch(y) if root1 != root2: self.pre[root1] = root2 group -= 1 return grou...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def union(self, n, s): """n:节点总个数 s: 所有的连接 return:返回有多少个独立连通子图""" <|body_0|> def unionsearch(self, root): """找到最终上级""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.pre = [i for i in range(n)] group = n for link in s: ...
stack_v2_sparse_classes_75kplus_train_006894
1,527
no_license
[ { "docstring": "n:节点总个数 s: 所有的连接 return:返回有多少个独立连通子图", "name": "union", "signature": "def union(self, n, s)" }, { "docstring": "找到最终上级", "name": "unionsearch", "signature": "def unionsearch(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_013727
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def union(self, n, s): n:节点总个数 s: 所有的连接 return:返回有多少个独立连通子图 - def unionsearch(self, root): 找到最终上级
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def union(self, n, s): n:节点总个数 s: 所有的连接 return:返回有多少个独立连通子图 - def unionsearch(self, root): 找到最终上级 <|skeleton|> class Solution: def union(self, n, s): """n:节点总个数 s: ...
5b55e35f15c7bf098203a6aabbb7aad6b14579fa
<|skeleton|> class Solution: def union(self, n, s): """n:节点总个数 s: 所有的连接 return:返回有多少个独立连通子图""" <|body_0|> def unionsearch(self, root): """找到最终上级""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def union(self, n, s): """n:节点总个数 s: 所有的连接 return:返回有多少个独立连通子图""" self.pre = [i for i in range(n)] group = n for link in s: x, y = link root1 = self.unionsearch(x) root2 = self.unionsearch(y) if root1 != root2: ...
the_stack_v2_python_sparse
gatherAlgorithms/并查集.py
queryor/algorithms
train
0
d4a33d100c1a3b15ace4f1c91d47961e7d167e4b
[ "argument_group.add_argument('--status_view', '--status-view', dest='status_view_mode', choices=cls._STATUS_VIEW_TYPES, action='store', metavar='TYPE', default=status_view.StatusView.MODE_WINDOW, help='The processing status view mode: \"file\", \"linear\", \"none\" or \"window\".')\nargument_group.add_argument('--s...
<|body_start_0|> argument_group.add_argument('--status_view', '--status-view', dest='status_view_mode', choices=cls._STATUS_VIEW_TYPES, action='store', metavar='TYPE', default=status_view.StatusView.MODE_WINDOW, help='The processing status view mode: "file", "linear", "none" or "window".') argument_grou...
Status view CLI arguments helper.
StatusViewArgumentsHelper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StatusViewArgumentsHelper: """Status view CLI arguments helper.""" def AddArguments(cls, argument_group): """Adds command line arguments to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line arguments this helper ...
stack_v2_sparse_classes_75kplus_train_006895
3,122
permissive
[ { "docstring": "Adds command line arguments to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line arguments this helper supports. Args: argument_group (argparse._ArgumentGroup|argparse.ArgumentParser): argparse group.", "name": "AddArgum...
2
stack_v2_sparse_classes_30k_train_054444
Implement the Python class `StatusViewArgumentsHelper` described below. Class description: Status view CLI arguments helper. Method signatures and docstrings: - def AddArguments(cls, argument_group): Adds command line arguments to an argument group. This function takes an argument parser or an argument group object a...
Implement the Python class `StatusViewArgumentsHelper` described below. Class description: Status view CLI arguments helper. Method signatures and docstrings: - def AddArguments(cls, argument_group): Adds command line arguments to an argument group. This function takes an argument parser or an argument group object a...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class StatusViewArgumentsHelper: """Status view CLI arguments helper.""" def AddArguments(cls, argument_group): """Adds command line arguments to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line arguments this helper ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StatusViewArgumentsHelper: """Status view CLI arguments helper.""" def AddArguments(cls, argument_group): """Adds command line arguments to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line arguments this helper supports. Arg...
the_stack_v2_python_sparse
plaso/cli/helpers/status_view.py
log2timeline/plaso
train
1,506
5c5c726a7f952842d402883fa6f34b8ee349d865
[ "self.means = means\nself.stds = stds\nself.replace_nan_token = replace_nan_token\nself.atomwise = atomwise\nself.no_scale = no_scale", "X = np.array(X).astype(float)\nif atomlens is not None and self.atomwise:\n atomlens = np.array(atomlens).astype(int).reshape(-1, 1)\n X = X / atomlens\nself.means = np.na...
<|body_start_0|> self.means = means self.stds = stds self.replace_nan_token = replace_nan_token self.atomwise = atomwise self.no_scale = no_scale <|end_body_0|> <|body_start_1|> X = np.array(X).astype(float) if atomlens is not None and self.atomwise: ...
A StandardScaler normalizes a dataset. When fit on a dataset, the StandardScaler learns the mean and standard deviation across the 0th axis. When transforming a dataset, the StandardScaler subtracts the means and divides by the standard deviations. If using an atomic model, then treat the mean and std as atomwise scali...
StandardScaler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StandardScaler: """A StandardScaler normalizes a dataset. When fit on a dataset, the StandardScaler learns the mean and standard deviation across the 0th axis. When transforming a dataset, the StandardScaler subtracts the means and divides by the standard deviations. If using an atomic model, the...
stack_v2_sparse_classes_75kplus_train_006896
4,052
permissive
[ { "docstring": "Initialize StandardScaler, optionally with means and standard deviations precomputed. :param means: An optional 1D numpy array of precomputed means. :param stds: An optional 1D numpy array of precomputed standard deviations. :param replace_nan_token: The token to use in place of nans. :param ato...
4
stack_v2_sparse_classes_30k_train_011431
Implement the Python class `StandardScaler` described below. Class description: A StandardScaler normalizes a dataset. When fit on a dataset, the StandardScaler learns the mean and standard deviation across the 0th axis. When transforming a dataset, the StandardScaler subtracts the means and divides by the standard de...
Implement the Python class `StandardScaler` described below. Class description: A StandardScaler normalizes a dataset. When fit on a dataset, the StandardScaler learns the mean and standard deviation across the 0th axis. When transforming a dataset, the StandardScaler subtracts the means and divides by the standard de...
a7a137a09589474a5c5a83f75fbddbddfb877dc8
<|skeleton|> class StandardScaler: """A StandardScaler normalizes a dataset. When fit on a dataset, the StandardScaler learns the mean and standard deviation across the 0th axis. When transforming a dataset, the StandardScaler subtracts the means and divides by the standard deviations. If using an atomic model, the...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StandardScaler: """A StandardScaler normalizes a dataset. When fit on a dataset, the StandardScaler learns the mean and standard deviation across the 0th axis. When transforming a dataset, the StandardScaler subtracts the means and divides by the standard deviations. If using an atomic model, then treat the m...
the_stack_v2_python_sparse
chemprop/data/scaler.py
aamini/chemprop
train
85
73cd8cd59396e908a3db3efd064b6c56c542892a
[ "super().__init__()\nself.depth = depth\nself.tag = tag\nself._checked = False\nself.toggle_active()\nself.setEditable(False)\nrgb = color.replace(')', '').replace(' ', '').split('(')[-1].split(',')\nself.setForeground(QColor(*[int(r) for r in rgb]))\nself.setText(txt)", "fnt = QFont('Roboto', 14)\nif self._check...
<|body_start_0|> super().__init__() self.depth = depth self.tag = tag self._checked = False self.toggle_active() self.setEditable(False) rgb = color.replace(')', '').replace(' ', '').split('(')[-1].split(',') self.setForeground(QColor(*[int(r) for r in rgb...
StandardItem
[ "BSD-3-Clause", "GPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StandardItem: def __init__(self, txt='', tag=None, depth=0, color=None): """Items in the tree list with some extended functionality to specify/update their look.""" <|body_0|> def toggle_active(self): """When a mesh corresponding to the item's region get's rendered, ...
stack_v2_sparse_classes_75kplus_train_006897
1,232
permissive
[ { "docstring": "Items in the tree list with some extended functionality to specify/update their look.", "name": "__init__", "signature": "def __init__(self, txt='', tag=None, depth=0, color=None)" }, { "docstring": "When a mesh corresponding to the item's region get's rendered, change the font t...
2
stack_v2_sparse_classes_30k_train_039111
Implement the Python class `StandardItem` described below. Class description: Implement the StandardItem class. Method signatures and docstrings: - def __init__(self, txt='', tag=None, depth=0, color=None): Items in the tree list with some extended functionality to specify/update their look. - def toggle_active(self)...
Implement the Python class `StandardItem` described below. Class description: Implement the StandardItem class. Method signatures and docstrings: - def __init__(self, txt='', tag=None, depth=0, color=None): Items in the tree list with some extended functionality to specify/update their look. - def toggle_active(self)...
a14ead80c1dbc75f20a145a49394dc467c4f7bf1
<|skeleton|> class StandardItem: def __init__(self, txt='', tag=None, depth=0, color=None): """Items in the tree list with some extended functionality to specify/update their look.""" <|body_0|> def toggle_active(self): """When a mesh corresponding to the item's region get's rendered, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StandardItem: def __init__(self, txt='', tag=None, depth=0, color=None): """Items in the tree list with some extended functionality to specify/update their look.""" super().__init__() self.depth = depth self.tag = tag self._checked = False self.toggle_active() ...
the_stack_v2_python_sparse
brainrender/gui/widgets/tree.py
brainglobe/brainrender
train
345
77c782de871df58cb52a00a4cda82fe62f1e4ba5
[ "super(OfferRenewCommands, self).__init__(*args, **kwargs)\nself.endpoint = 'offers'\nself.command_uuid = None\nself.offer_id = None\nself._headers = {'Accept': 'application/vnd.allegro.public.v1+json', 'Content-type': 'application/vnd.allegro.public.v1+json'}", "self.offer_id = offer_id\nself.command_uuid = comm...
<|body_start_0|> super(OfferRenewCommands, self).__init__(*args, **kwargs) self.endpoint = 'offers' self.command_uuid = None self.offer_id = None self._headers = {'Accept': 'application/vnd.allegro.public.v1+json', 'Content-type': 'application/vnd.allegro.public.v1+json'} <|end_b...
Manage offer renew commands
OfferRenewCommands
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OfferRenewCommands: """Manage offer renew commands""" def __init__(self, *args, **kwargs): """Initialize the endpoint""" <|body_0|> def create(self, offer_id, command_uuid, body): """Renew a single offer by id. :param offer_id: The unique id for the offer. :type ...
stack_v2_sparse_classes_75kplus_train_006898
2,339
permissive
[ { "docstring": "Initialize the endpoint", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Renew a single offer by id. :param offer_id: The unique id for the offer. :type offer_id: :py:class:`str` :param command_uuid: The global unique ID (UUID) for this ...
3
stack_v2_sparse_classes_30k_train_013564
Implement the Python class `OfferRenewCommands` described below. Class description: Manage offer renew commands Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize the endpoint - def create(self, offer_id, command_uuid, body): Renew a single offer by id. :param offer_id: The unique id ...
Implement the Python class `OfferRenewCommands` described below. Class description: Manage offer renew commands Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize the endpoint - def create(self, offer_id, command_uuid, body): Renew a single offer by id. :param offer_id: The unique id ...
112b0f2570fcf3840645dd62f6f7150956e56f9c
<|skeleton|> class OfferRenewCommands: """Manage offer renew commands""" def __init__(self, *args, **kwargs): """Initialize the endpoint""" <|body_0|> def create(self, offer_id, command_uuid, body): """Renew a single offer by id. :param offer_id: The unique id for the offer. :type ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OfferRenewCommands: """Manage offer renew commands""" def __init__(self, *args, **kwargs): """Initialize the endpoint""" super(OfferRenewCommands, self).__init__(*args, **kwargs) self.endpoint = 'offers' self.command_uuid = None self.offer_id = None self._h...
the_stack_v2_python_sparse
allegroapi/entities/offerrenewcommands.py
krystianmagdziarz/python-allegro
train
0
1da93feee008f45bcae8e2ebd44b68fe9eacb62e
[ "text_list = []\nif not regex:\n regex = '\\\\s+'\nif not txt_target:\n txt_target = txt_src[:-4] + '_tokenized.txt'\ntemp_target = txt_target[:-4] + '_temp.txt'\ntxt_writer = open(temp_target, 'w')\nword_count = 0\ntry:\n read_src = open(txt_src, 'r')\n readline_src = read_src.readlines()\n if readl...
<|body_start_0|> text_list = [] if not regex: regex = '\\s+' if not txt_target: txt_target = txt_src[:-4] + '_tokenized.txt' temp_target = txt_target[:-4] + '_temp.txt' txt_writer = open(temp_target, 'w') word_count = 0 try: rea...
TxtManipulator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TxtManipulator: def tokenize_txt_file(cls, txt_src, txt_target=None, regex=None): """Converts txt file into tokens Args: txt_src(str): Source txt file location txt_target(str, optional): Target txt file location, if left blank will replace the src file regex(str, optional): Regex on how ...
stack_v2_sparse_classes_75kplus_train_006899
3,058
no_license
[ { "docstring": "Converts txt file into tokens Args: txt_src(str): Source txt file location txt_target(str, optional): Target txt file location, if left blank will replace the src file regex(str, optional): Regex on how to split the tokens, if left blank will use space", "name": "tokenize_txt_file", "sig...
4
stack_v2_sparse_classes_30k_val_001730
Implement the Python class `TxtManipulator` described below. Class description: Implement the TxtManipulator class. Method signatures and docstrings: - def tokenize_txt_file(cls, txt_src, txt_target=None, regex=None): Converts txt file into tokens Args: txt_src(str): Source txt file location txt_target(str, optional)...
Implement the Python class `TxtManipulator` described below. Class description: Implement the TxtManipulator class. Method signatures and docstrings: - def tokenize_txt_file(cls, txt_src, txt_target=None, regex=None): Converts txt file into tokens Args: txt_src(str): Source txt file location txt_target(str, optional)...
1cd33aa6c5dd08b29c14b55e24c2f4ee66203a08
<|skeleton|> class TxtManipulator: def tokenize_txt_file(cls, txt_src, txt_target=None, regex=None): """Converts txt file into tokens Args: txt_src(str): Source txt file location txt_target(str, optional): Target txt file location, if left blank will replace the src file regex(str, optional): Regex on how ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TxtManipulator: def tokenize_txt_file(cls, txt_src, txt_target=None, regex=None): """Converts txt file into tokens Args: txt_src(str): Source txt file location txt_target(str, optional): Target txt file location, if left blank will replace the src file regex(str, optional): Regex on how to split the t...
the_stack_v2_python_sparse
web_service/lib/TxtManipulator.py
amumu/noox_project_ai
train
0