blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
d302d4d888939057c62c35405668e750e665f10b
[ "if self.panel_url:\n return '{}&fullscreen'.format(self.panel_url.replace('dashboard-solo', 'dashboard'))\nreturn None", "panel_url = self.panel_url.replace(urlparse.urljoin(self.grafana_instance.url, '/'), '')\nrendered_image_url = urlparse.urljoin('render/', panel_url)\nrendered_image_url = '{}&width={}&hei...
<|body_start_0|> if self.panel_url: return '{}&fullscreen'.format(self.panel_url.replace('dashboard-solo', 'dashboard')) return None <|end_body_0|> <|body_start_1|> panel_url = self.panel_url.replace(urlparse.urljoin(self.grafana_instance.url, '/'), '') rendered_image_url = ...
Data about a Grafana panel.
GrafanaPanel
[ "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GrafanaPanel: """Data about a Grafana panel.""" def modifiable_url(self): """Url with modifiable time range, dashboard link, etc""" <|body_0|> def get_rendered_image(self): """Get a .png image of this panel""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_006100
5,474
permissive
[ { "docstring": "Url with modifiable time range, dashboard link, etc", "name": "modifiable_url", "signature": "def modifiable_url(self)" }, { "docstring": "Get a .png image of this panel", "name": "get_rendered_image", "signature": "def get_rendered_image(self)" } ]
2
stack_v2_sparse_classes_30k_train_011705
Implement the Python class `GrafanaPanel` described below. Class description: Data about a Grafana panel. Method signatures and docstrings: - def modifiable_url(self): Url with modifiable time range, dashboard link, etc - def get_rendered_image(self): Get a .png image of this panel
Implement the Python class `GrafanaPanel` described below. Class description: Data about a Grafana panel. Method signatures and docstrings: - def modifiable_url(self): Url with modifiable time range, dashboard link, etc - def get_rendered_image(self): Get a .png image of this panel <|skeleton|> class GrafanaPanel: ...
61bf94af813b026d29288c6e3967d2225fdc4686
<|skeleton|> class GrafanaPanel: """Data about a Grafana panel.""" def modifiable_url(self): """Url with modifiable time range, dashboard link, etc""" <|body_0|> def get_rendered_image(self): """Get a .png image of this panel""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GrafanaPanel: """Data about a Grafana panel.""" def modifiable_url(self): """Url with modifiable time range, dashboard link, etc""" if self.panel_url: return '{}&fullscreen'.format(self.panel_url.replace('dashboard-solo', 'dashboard')) return None def get_rendered...
the_stack_v2_python_sparse
cabot/metricsapp/models/grafana.py
Affirm/cabot
train
13
e8936994808e6f1a18a7dabbcf92d1570ab6efee
[ "super(ParameterizedStrategy, self).__init__(network)\nself.matrix = FeatureMatrix(network)\nself.bound = bound\nself.label = None\nself.covered_count = None\nself.objective_covered = None\nself.strategy = np.random.uniform(-self.bound, self.bound, size=FeatureMatrix.TOTAL_FEATURES)", "scores = self.matrix.dot(se...
<|body_start_0|> super(ParameterizedStrategy, self).__init__(network) self.matrix = FeatureMatrix(network) self.bound = bound self.label = None self.covered_count = None self.objective_covered = None self.strategy = np.random.uniform(-self.bound, self.bound, size=...
A strategy that uses a parameterized selection strategy. Parameterized neuron selection strategy is a strategy that parameterized neurons and scores with a selection vector. Please see the following paper for more details: Effective White-Box Testing for Deep Neural Networks with Adaptive Neuron-Selection Strategy http...
ParameterizedStrategy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParameterizedStrategy: """A strategy that uses a parameterized selection strategy. Parameterized neuron selection strategy is a strategy that parameterized neurons and scores with a selection vector. Please see the following paper for more details: Effective White-Box Testing for Deep Neural Netw...
stack_v2_sparse_classes_36k_train_006101
17,144
permissive
[ { "docstring": "Create a parameterized strategy, and initialize its variables. Args: network: A wrapped Keras model with `adapt.Network`. bound: A floating point number indicates the absolute value of minimum and maximum bounds. Example: >>> from adapt import Network >>> from adapt.strategy import Parameterized...
4
stack_v2_sparse_classes_30k_test_001158
Implement the Python class `ParameterizedStrategy` described below. Class description: A strategy that uses a parameterized selection strategy. Parameterized neuron selection strategy is a strategy that parameterized neurons and scores with a selection vector. Please see the following paper for more details: Effective...
Implement the Python class `ParameterizedStrategy` described below. Class description: A strategy that uses a parameterized selection strategy. Parameterized neuron selection strategy is a strategy that parameterized neurons and scores with a selection vector. Please see the following paper for more details: Effective...
0b801d2d2e828ac480d1097cb3bdd82b1e25c15b
<|skeleton|> class ParameterizedStrategy: """A strategy that uses a parameterized selection strategy. Parameterized neuron selection strategy is a strategy that parameterized neurons and scores with a selection vector. Please see the following paper for more details: Effective White-Box Testing for Deep Neural Netw...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ParameterizedStrategy: """A strategy that uses a parameterized selection strategy. Parameterized neuron selection strategy is a strategy that parameterized neurons and scores with a selection vector. Please see the following paper for more details: Effective White-Box Testing for Deep Neural Networks with Ada...
the_stack_v2_python_sparse
code/deep/ReMoS/CV_adv/DNNtest/strategy/adapt.py
jindongwang/transferlearning
train
12,773
d676b2e26dfe293749e8ee58a2232fdcd179f829
[ "a = array([(1.0, 0), (0.5, sqrt(3.0) / 2)])\nsuper(Triangular_Lattice, self).__init__(a=a, catoms=catoms, name='triangular', N=N)\nc6vg = C6vGroup()\nself.usegroup(c6vg)", "ks = super(Triangular_Lattice, self).kspace\nM0 = ks.b[1] / 2.0\nK0 = (ks.b[0] + 2 * ks.b[1]) / 3.0\nc6vg = C6vGroup()\nM = []\nK = []\nfor ...
<|body_start_0|> a = array([(1.0, 0), (0.5, sqrt(3.0) / 2)]) super(Triangular_Lattice, self).__init__(a=a, catoms=catoms, name='triangular', N=N) c6vg = C6vGroup() self.usegroup(c6vg) <|end_body_0|> <|body_start_1|> ks = super(Triangular_Lattice, self).kspace M0 = ks.b[1...
Triangular Lattice, using C6v Group. Construct ---------------- Triangular_Lattice(N,catoms=[(0.,0.)])
Triangular_Lattice
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Triangular_Lattice: """Triangular Lattice, using C6v Group. Construct ---------------- Triangular_Lattice(N,catoms=[(0.,0.)])""" def __init__(self, N, catoms=[(0.0, 0.0)]): """Basic information of Triangular Lattice""" <|body_0|> def kspace(self): """Get the <KSp...
stack_v2_sparse_classes_36k_train_006102
5,854
permissive
[ { "docstring": "Basic information of Triangular Lattice", "name": "__init__", "signature": "def __init__(self, N, catoms=[(0.0, 0.0)])" }, { "docstring": "Get the <KSpace> instance.", "name": "kspace", "signature": "def kspace(self)" } ]
2
stack_v2_sparse_classes_30k_train_013354
Implement the Python class `Triangular_Lattice` described below. Class description: Triangular Lattice, using C6v Group. Construct ---------------- Triangular_Lattice(N,catoms=[(0.,0.)]) Method signatures and docstrings: - def __init__(self, N, catoms=[(0.0, 0.0)]): Basic information of Triangular Lattice - def kspac...
Implement the Python class `Triangular_Lattice` described below. Class description: Triangular Lattice, using C6v Group. Construct ---------------- Triangular_Lattice(N,catoms=[(0.,0.)]) Method signatures and docstrings: - def __init__(self, N, catoms=[(0.0, 0.0)]): Basic information of Triangular Lattice - def kspac...
88be712b2d17603f7a3c38836dabe8dbdee2aba3
<|skeleton|> class Triangular_Lattice: """Triangular Lattice, using C6v Group. Construct ---------------- Triangular_Lattice(N,catoms=[(0.,0.)])""" def __init__(self, N, catoms=[(0.0, 0.0)]): """Basic information of Triangular Lattice""" <|body_0|> def kspace(self): """Get the <KSp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Triangular_Lattice: """Triangular Lattice, using C6v Group. Construct ---------------- Triangular_Lattice(N,catoms=[(0.,0.)])""" def __init__(self, N, catoms=[(0.0, 0.0)]): """Basic information of Triangular Lattice""" a = array([(1.0, 0), (0.5, sqrt(3.0) / 2)]) super(Triangular_L...
the_stack_v2_python_sparse
giggleliu/tba/lattice/latticelib.py
Lynn-015/NJU_DMRG
train
2
0f8885626266ce0606f249d42c897092424da552
[ "parser = argparse.ArgumentParser()\nparser.add_argument('--loglevel', dest='loglevel', nargs='?', type=int, default=default_loglevel, choices=ArgumentParser.CHOICES)\nreturn parser.parse_args()", "parser = argparse.ArgumentParser()\nparser.add_argument('--house', dest='house')\nparser.add_argument('--loglevel', ...
<|body_start_0|> parser = argparse.ArgumentParser() parser.add_argument('--loglevel', dest='loglevel', nargs='?', type=int, default=default_loglevel, choices=ArgumentParser.CHOICES) return parser.parse_args() <|end_body_0|> <|body_start_1|> parser = argparse.ArgumentParser() par...
ArgumentParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArgumentParser: def logging_parser(default_loglevel=logging.DEBUG): """Gets a default argument parser including the house id and logging level :return:""" <|body_0|> def house_parser(default_loglevel=logging.DEBUG): """Gets a default argument parser including the hou...
stack_v2_sparse_classes_36k_train_006103
4,097
permissive
[ { "docstring": "Gets a default argument parser including the house id and logging level :return:", "name": "logging_parser", "signature": "def logging_parser(default_loglevel=logging.DEBUG)" }, { "docstring": "Gets a default argument parser including the house id and logging level :return:", ...
5
stack_v2_sparse_classes_30k_train_003321
Implement the Python class `ArgumentParser` described below. Class description: Implement the ArgumentParser class. Method signatures and docstrings: - def logging_parser(default_loglevel=logging.DEBUG): Gets a default argument parser including the house id and logging level :return: - def house_parser(default_loglev...
Implement the Python class `ArgumentParser` described below. Class description: Implement the ArgumentParser class. Method signatures and docstrings: - def logging_parser(default_loglevel=logging.DEBUG): Gets a default argument parser including the house id and logging level :return: - def house_parser(default_loglev...
981329bf85b5c1e8d8481efc40a90d5a676944df
<|skeleton|> class ArgumentParser: def logging_parser(default_loglevel=logging.DEBUG): """Gets a default argument parser including the house id and logging level :return:""" <|body_0|> def house_parser(default_loglevel=logging.DEBUG): """Gets a default argument parser including the hou...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArgumentParser: def logging_parser(default_loglevel=logging.DEBUG): """Gets a default argument parser including the house id and logging level :return:""" parser = argparse.ArgumentParser() parser.add_argument('--loglevel', dest='loglevel', nargs='?', type=int, default=default_loglevel...
the_stack_v2_python_sparse
sphere_plugins/sphere/utils/utils.py
IRC-SPHERE/SPHERE-HyperStream
train
4
570ea037b6f647fa98a805432505a45b2fd08f99
[ "if root == None:\n return 'null'\nqueue = [root]\nres = ''\nindex = 0\nwhile index != len(queue):\n node = queue[index]\n if node != None:\n res += str(node.val)\n queue.append(node.left)\n queue.append(node.right)\n else:\n res += 'null'\n res += ','\n index += 1\nret...
<|body_start_0|> if root == None: return 'null' queue = [root] res = '' index = 0 while index != len(queue): node = queue[index] if node != None: res += str(node.val) queue.append(node.left) queue...
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_36k_train_006104
1,982
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:...
2fda37371f1c5afcab80214580e8e5fd72b48a3b
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if root == None: return 'null' queue = [root] res = '' index = 0 while index != len(queue): node = queue[index] if nod...
the_stack_v2_python_sparse
others/剑指 Offer/37/main.py
pauvrepetit/leetcode
train
0
fa6e62edb56a37cb380edc14e6d8c0cc11ac5fec
[ "if len(matrix):\n r, c = (len(matrix), len(matrix[0]))\n self.val = matrix\n for i in range(r):\n for j in range(1, c):\n self.val[i][j] += self.val[i][j - 1]\nelse:\n self.val = 0", "ret_sum = 0\nif self.val == 0:\n return 0\nfor r in range(row1, row2 + 1):\n if col1 == 0:\n ...
<|body_start_0|> if len(matrix): r, c = (len(matrix), len(matrix[0])) self.val = matrix for i in range(r): for j in range(1, c): self.val[i][j] += self.val[i][j - 1] else: self.val = 0 <|end_body_0|> <|body_start_1|> ...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_006105
1,027
no_license
[ { "docstring": ":type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": ":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int", "name": "sumRegion", "signature": "def sumRegion(self, row1, col1, row2, col2)" ...
2
null
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
5222394470adf3522c11b11e59d05b0ddff09e20
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" if len(matrix): r, c = (len(matrix), len(matrix[0])) self.val = matrix for i in range(r): for j in range(1, c): self.val[i][j] += self.val[i][j - 1...
the_stack_v2_python_sparse
mycode/dynamic programming/Range Sum Query 2D - Immutable.py
guoguanglu/leetcode
train
0
41fb1c2d094a0c2c1c32909c6105440436191b5f
[ "def decode(s, i):\n \"\"\"Decode string s from position i.\n :param s: string to be decoded until ']' or end of the string.\n :param i: start position.\n :return: decoded string and the final position.\n \"\"\"\n ans, k = ('', '')\n while i < len(s):\n c ...
<|body_start_0|> def decode(s, i): """Decode string s from position i. :param s: string to be decoded until ']' or end of the string. :param i: start position. :return: decoded string and the final position. """ ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def decodeString_v1(self, s: str) -> str: """Use recurssion. Similar to a DFS traversal.""" <|body_0|> def decodeString_v2(self, s: str) -> str: """Use stack and loop. Note that using a stack is almost identical to using recurssion.""" <|body_1|> <...
stack_v2_sparse_classes_36k_train_006106
3,069
no_license
[ { "docstring": "Use recurssion. Similar to a DFS traversal.", "name": "decodeString_v1", "signature": "def decodeString_v1(self, s: str) -> str" }, { "docstring": "Use stack and loop. Note that using a stack is almost identical to using recurssion.", "name": "decodeString_v2", "signature...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def decodeString_v1(self, s: str) -> str: Use recurssion. Similar to a DFS traversal. - def decodeString_v2(self, s: str) -> str: Use stack and loop. Note that using a stack is a...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def decodeString_v1(self, s: str) -> str: Use recurssion. Similar to a DFS traversal. - def decodeString_v2(self, s: str) -> str: Use stack and loop. Note that using a stack is a...
97a2386f5e3adbd7138fd123810c3232bdf7f622
<|skeleton|> class Solution: def decodeString_v1(self, s: str) -> str: """Use recurssion. Similar to a DFS traversal.""" <|body_0|> def decodeString_v2(self, s: str) -> str: """Use stack and loop. Note that using a stack is almost identical to using recurssion.""" <|body_1|> <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def decodeString_v1(self, s: str) -> str: """Use recurssion. Similar to a DFS traversal.""" def decode(s, i): """Decode string s from position i. :param s: string to be decoded until ']' or end of the string. :param i: start positio...
the_stack_v2_python_sparse
python3/trees_and_graphs/decode_string.py
victorchu/algorithms
train
0
7f38b4005a156acd239974c2aa1ee31a3a3e6dc4
[ "bot_messages = []\nbrian_bot = UserUtils.get_brian_bot()\nfor u1, u2 in [[user1, user2], [user2, user1]]:\n chat = ChatUtils.find_chat([brian_bot, u1])\n message = models.Message.objects.create(chat=chat, text=message_text.format(user1=u1.first_name, user2=u2.first_name), sender=brian_bot)\n bot_messages....
<|body_start_0|> bot_messages = [] brian_bot = UserUtils.get_brian_bot() for u1, u2 in [[user1, user2], [user2, user1]]: chat = ChatUtils.find_chat([brian_bot, u1]) message = models.Message.objects.create(chat=chat, text=message_text.format(user1=u1.first_name, user2=u2.f...
Utilities for chats.
ChatUtils
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChatUtils: """Utilities for chats.""" def create_bot_chat_creation_messages(user1, user2, message_text): """Creates messages from Brian Bot to two users that a chat between them has been created. No push notifications are sent for these message. :param user1: A user. :param user2: A ...
stack_v2_sparse_classes_36k_train_006107
2,787
permissive
[ { "docstring": "Creates messages from Brian Bot to two users that a chat between them has been created. No push notifications are sent for these message. :param user1: A user. :param user2: A user. :param message_text: The bot message to notify users of the new match. Can contain placeholders {user1} and {user2...
3
stack_v2_sparse_classes_30k_train_021568
Implement the Python class `ChatUtils` described below. Class description: Utilities for chats. Method signatures and docstrings: - def create_bot_chat_creation_messages(user1, user2, message_text): Creates messages from Brian Bot to two users that a chat between them has been created. No push notifications are sent ...
Implement the Python class `ChatUtils` described below. Class description: Utilities for chats. Method signatures and docstrings: - def create_bot_chat_creation_messages(user1, user2, message_text): Creates messages from Brian Bot to two users that a chat between them has been created. No push notifications are sent ...
90ed2592f30afcb454111148a8121e1b9820e507
<|skeleton|> class ChatUtils: """Utilities for chats.""" def create_bot_chat_creation_messages(user1, user2, message_text): """Creates messages from Brian Bot to two users that a chat between them has been created. No push notifications are sent for these message. :param user1: A user. :param user2: A ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChatUtils: """Utilities for chats.""" def create_bot_chat_creation_messages(user1, user2, message_text): """Creates messages from Brian Bot to two users that a chat between them has been created. No push notifications are sent for these message. :param user1: A user. :param user2: A user. :param ...
the_stack_v2_python_sparse
friends/utilities/chat_utils.py
kairathmann/friends-backend
train
0
9bb37a21fb0424dd3adda1339a0cead1e51e7ebd
[ "opt = input('choose game method:\\n' + ' 1) built-in puzzle\\n' + ' 2) rng puzzle\\n' + ' 3) user puzzle\\n')\nif opt == 1:\n puzzle = input('select puzzle (1-2):')\n if puzzle == 1:\n self.state = np.array([[0, 3, 0, 2, 9, 7, 0, 0, 4], [5, 0, 0, 0, 3, 0, 6, 2, 7], [0, 0, 0, 0, 6, 0, 0, 9, 0], [0, 0, ...
<|body_start_0|> opt = input('choose game method:\n' + ' 1) built-in puzzle\n' + ' 2) rng puzzle\n' + ' 3) user puzzle\n') if opt == 1: puzzle = input('select puzzle (1-2):') if puzzle == 1: self.state = np.array([[0, 3, 0, 2, 9, 7, 0, 0, 4], [5, 0, 0, 0, 3, 0, 6,...
sudoku game state and solver class
Sudoku
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sudoku: """sudoku game state and solver class""" def __init__(self): """initialize the board and vars""" <|body_0|> def solve(self): """solver loop that checks, steps, and prints""" <|body_1|> def checkboard(self): """iterate through board wr...
stack_v2_sparse_classes_36k_train_006108
4,686
permissive
[ { "docstring": "initialize the board and vars", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "solver loop that checks, steps, and prints", "name": "solve", "signature": "def solve(self)" }, { "docstring": "iterate through board writing potentials dict",...
6
stack_v2_sparse_classes_30k_train_010087
Implement the Python class `Sudoku` described below. Class description: sudoku game state and solver class Method signatures and docstrings: - def __init__(self): initialize the board and vars - def solve(self): solver loop that checks, steps, and prints - def checkboard(self): iterate through board writing potential...
Implement the Python class `Sudoku` described below. Class description: sudoku game state and solver class Method signatures and docstrings: - def __init__(self): initialize the board and vars - def solve(self): solver loop that checks, steps, and prints - def checkboard(self): iterate through board writing potential...
33aec6dc0bada8d9fe26a6df73d45eaf34e509c6
<|skeleton|> class Sudoku: """sudoku game state and solver class""" def __init__(self): """initialize the board and vars""" <|body_0|> def solve(self): """solver loop that checks, steps, and prints""" <|body_1|> def checkboard(self): """iterate through board wr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Sudoku: """sudoku game state and solver class""" def __init__(self): """initialize the board and vars""" opt = input('choose game method:\n' + ' 1) built-in puzzle\n' + ' 2) rng puzzle\n' + ' 3) user puzzle\n') if opt == 1: puzzle = input('select puzzle (1-2):') ...
the_stack_v2_python_sparse
python/dsbook/1.17-exercises/sudoku.py
jonjon33/sandbox
train
0
ea8c39bc97a8e417a50e5e3755f7ac3f1c4180d4
[ "self._logger = logging.getLogger('stone.compiler')\nself.api = api\nself.backend_module = backend_module\nself.backend_args = backend_args\nself.build_path = build_path\nif clean_build and os.path.exists(self.build_path):\n logging.info('Cleaning existing build directory %s...', self.build_path)\n shutil.rmt...
<|body_start_0|> self._logger = logging.getLogger('stone.compiler') self.api = api self.backend_module = backend_module self.backend_args = backend_args self.build_path = build_path if clean_build and os.path.exists(self.build_path): logging.info('Cleaning exi...
Applies a collection of backends found in a single backend module to an API specification.
Compiler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Compiler: """Applies a collection of backends found in a single backend module to an API specification.""" def __init__(self, api, backend_module, backend_args, build_path, clean_build=False): """Creates a Compiler. :param stone.ir.Api api: A Stone description of the API. :param back...
stack_v2_sparse_classes_36k_train_006109
4,380
permissive
[ { "docstring": "Creates a Compiler. :param stone.ir.Api api: A Stone description of the API. :param backend_module: Python module that contains at least one top-level class definition that descends from a :class:`stone.backend.Backend`. :param list(str) backend_args: A list of command-line arguments to pass to ...
5
stack_v2_sparse_classes_30k_train_020954
Implement the Python class `Compiler` described below. Class description: Applies a collection of backends found in a single backend module to an API specification. Method signatures and docstrings: - def __init__(self, api, backend_module, backend_args, build_path, clean_build=False): Creates a Compiler. :param ston...
Implement the Python class `Compiler` described below. Class description: Applies a collection of backends found in a single backend module to an API specification. Method signatures and docstrings: - def __init__(self, api, backend_module, backend_args, build_path, clean_build=False): Creates a Compiler. :param ston...
0c9ceb748ac4dcdea5ff69c97704daccdcb7e60e
<|skeleton|> class Compiler: """Applies a collection of backends found in a single backend module to an API specification.""" def __init__(self, api, backend_module, backend_args, build_path, clean_build=False): """Creates a Compiler. :param stone.ir.Api api: A Stone description of the API. :param back...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Compiler: """Applies a collection of backends found in a single backend module to an API specification.""" def __init__(self, api, backend_module, backend_args, build_path, clean_build=False): """Creates a Compiler. :param stone.ir.Api api: A Stone description of the API. :param backend_module: P...
the_stack_v2_python_sparse
stone/compiler.py
dropbox/stone
train
440
25fa50fb7404b71cb74cb8286b7222ed2f877697
[ "len1, len2 = (len(nums1), len(nums2))\nres = [0] * k\nfor i in xrange(max(0, k - len2), min(k, len1) + 1):\n subarray1 = self.get_max_subarray(nums1, i)\n subarray2 = self.get_max_subarray(nums2, k - i)\n res = max(res, [max(subarray1, subarray2).pop(0) for _ in xrange(k)])\nreturn res", "res = [0] * k\...
<|body_start_0|> len1, len2 = (len(nums1), len(nums2)) res = [0] * k for i in xrange(max(0, k - len2), min(k, len1) + 1): subarray1 = self.get_max_subarray(nums1, i) subarray2 = self.get_max_subarray(nums2, k - i) res = max(res, [max(subarray1, subarray2).pop(...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxNumber(self, nums1, nums2, k): """:type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[int]""" <|body_0|> def get_max_subarray(self, nums, k): """A method to get the max subarray while preserve the related position in nums""" ...
stack_v2_sparse_classes_36k_train_006110
1,116
no_license
[ { "docstring": ":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[int]", "name": "maxNumber", "signature": "def maxNumber(self, nums1, nums2, k)" }, { "docstring": "A method to get the max subarray while preserve the related position in nums", "name": "get_max_subarray"...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxNumber(self, nums1, nums2, k): :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[int] - def get_max_subarray(self, nums, k): A method to get the max ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxNumber(self, nums1, nums2, k): :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[int] - def get_max_subarray(self, nums, k): A method to get the max ...
580366c7de5f27a931930aeec5e08aa043aa1d54
<|skeleton|> class Solution: def maxNumber(self, nums1, nums2, k): """:type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[int]""" <|body_0|> def get_max_subarray(self, nums, k): """A method to get the max subarray while preserve the related position in nums""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxNumber(self, nums1, nums2, k): """:type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[int]""" len1, len2 = (len(nums1), len(nums2)) res = [0] * k for i in xrange(max(0, k - len2), min(k, len1) + 1): subarray1 = self.get_max_subar...
the_stack_v2_python_sparse
321-Create-Maximum-Number/solution.py
z502185331/leetcode-python
train
0
578e53d4cb013ec851e991cbba692698cbeb54fc
[ "if not student.is_active:\n return False\nif semester.records_closing is not None and time > semester.records_closing:\n return False\nt0_record = None\ntry:\n t0_record = cls.objects.get(student=student, semester=semester)\nexcept cls.DoesNotExist:\n return False\nif time < t0_record.time:\n return...
<|body_start_0|> if not student.is_active: return False if semester.records_closing is not None and time > semester.records_closing: return False t0_record = None try: t0_record = cls.objects.get(student=student, semester=semester) except cls.D...
This model stores a T0 for a student. T0 is a time when they can enroll into each groups (except of those that are still closed).
T0Times
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class T0Times: """This model stores a T0 for a student. T0 is a time when they can enroll into each groups (except of those that are still closed).""" def is_after_t0(cls, student: Student, semester: Semester, time: datetime) -> bool: """Checks whether the T0 for student has passed. The fu...
stack_v2_sparse_classes_36k_train_006111
12,426
no_license
[ { "docstring": "Checks whether the T0 for student has passed. The function will return False if student is inactive, his T0 is not in the database, the enrollment is closed in the semester or has not yet started.", "name": "is_after_t0", "signature": "def is_after_t0(cls, student: Student, semester: Sem...
2
stack_v2_sparse_classes_30k_train_001180
Implement the Python class `T0Times` described below. Class description: This model stores a T0 for a student. T0 is a time when they can enroll into each groups (except of those that are still closed). Method signatures and docstrings: - def is_after_t0(cls, student: Student, semester: Semester, time: datetime) -> b...
Implement the Python class `T0Times` described below. Class description: This model stores a T0 for a student. T0 is a time when they can enroll into each groups (except of those that are still closed). Method signatures and docstrings: - def is_after_t0(cls, student: Student, semester: Semester, time: datetime) -> b...
2299f5f57d67efb3ad8b661e9a22709d9eeec922
<|skeleton|> class T0Times: """This model stores a T0 for a student. T0 is a time when they can enroll into each groups (except of those that are still closed).""" def is_after_t0(cls, student: Student, semester: Semester, time: datetime) -> bool: """Checks whether the T0 for student has passed. The fu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class T0Times: """This model stores a T0 for a student. T0 is a time when they can enroll into each groups (except of those that are still closed).""" def is_after_t0(cls, student: Student, semester: Semester, time: datetime) -> bool: """Checks whether the T0 for student has passed. The function will r...
the_stack_v2_python_sparse
zapisy/apps/enrollment/records/models/opening_times.py
iiuni/projektzapisy
train
34
d1d0fd8823504200abccdeeb501718200bfd4d00
[ "super(RNNEncoder, self).__init__()\nself.batch = batch\nself.units = units\nself.embedding = tf.keras.layers.Embedding(vocab, embedding)\nself.gru = tf.keras.layers.GRU(units, recurrent_initializer='glorot_uniform', return_sequences=True, return_state=True)", "initializer = tf.keras.initializers.Zeros()\nhidden ...
<|body_start_0|> super(RNNEncoder, self).__init__() self.batch = batch self.units = units self.embedding = tf.keras.layers.Embedding(vocab, embedding) self.gru = tf.keras.layers.GRU(units, recurrent_initializer='glorot_uniform', return_sequences=True, return_state=True) <|end_bod...
Rnn encoder class
RNNEncoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RNNEncoder: """Rnn encoder class""" def __init__(self, vocab, embedding, units, batch): """Function that initializes variables""" <|body_0|> def initialize_hidden_state(self): """Function that initializes the hidden states for the RNN cell to a tensor of zeros"""...
stack_v2_sparse_classes_36k_train_006112
1,198
no_license
[ { "docstring": "Function that initializes variables", "name": "__init__", "signature": "def __init__(self, vocab, embedding, units, batch)" }, { "docstring": "Function that initializes the hidden states for the RNN cell to a tensor of zeros", "name": "initialize_hidden_state", "signature...
3
stack_v2_sparse_classes_30k_train_008809
Implement the Python class `RNNEncoder` described below. Class description: Rnn encoder class Method signatures and docstrings: - def __init__(self, vocab, embedding, units, batch): Function that initializes variables - def initialize_hidden_state(self): Function that initializes the hidden states for the RNN cell to...
Implement the Python class `RNNEncoder` described below. Class description: Rnn encoder class Method signatures and docstrings: - def __init__(self, vocab, embedding, units, batch): Function that initializes variables - def initialize_hidden_state(self): Function that initializes the hidden states for the RNN cell to...
9dbf8221d4eb22dbc2487cb55e84a801a38aa5c8
<|skeleton|> class RNNEncoder: """Rnn encoder class""" def __init__(self, vocab, embedding, units, batch): """Function that initializes variables""" <|body_0|> def initialize_hidden_state(self): """Function that initializes the hidden states for the RNN cell to a tensor of zeros"""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RNNEncoder: """Rnn encoder class""" def __init__(self, vocab, embedding, units, batch): """Function that initializes variables""" super(RNNEncoder, self).__init__() self.batch = batch self.units = units self.embedding = tf.keras.layers.Embedding(vocab, embedding) ...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/0-rnn_encoder.py
yasmineholb/holbertonschool-machine_learning
train
0
748114d06c300dc139966cfcba4747530920265c
[ "if '_xml_ns' in kwargs:\n self._xml_ns = kwargs['_xml_ns']\nif '_xml_ns_key' in kwargs:\n self._xml_ns_key = kwargs['_xml_ns_key']\nself.TypeID = TypeID\nself.CurrentIndex = CurrentIndex\nself.MatchCollections = MatchCollections\nsuper(MatchType, self).__init__(**kwargs)", "if self.MatchCollections is None...
<|body_start_0|> if '_xml_ns' in kwargs: self._xml_ns = kwargs['_xml_ns'] if '_xml_ns_key' in kwargs: self._xml_ns_key = kwargs['_xml_ns_key'] self.TypeID = TypeID self.CurrentIndex = CurrentIndex self.MatchCollections = MatchCollections super(Matc...
The is an array element for match information.
MatchType
[ "MIT", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MatchType: """The is an array element for match information.""" def __init__(self, TypeID: str=None, CurrentIndex: Optional[int]=None, MatchCollections: Optional[List[MatchCollectionType]]=None, **kwargs): """Parameters ---------- TypeID : str CurrentIndex : None|int MatchCollections...
stack_v2_sparse_classes_36k_train_006113
8,888
permissive
[ { "docstring": "Parameters ---------- TypeID : str CurrentIndex : None|int MatchCollections : None|List[MatchCollectionType] kwargs", "name": "__init__", "signature": "def __init__(self, TypeID: str=None, CurrentIndex: Optional[int]=None, MatchCollections: Optional[List[MatchCollectionType]]=None, **kwa...
2
null
Implement the Python class `MatchType` described below. Class description: The is an array element for match information. Method signatures and docstrings: - def __init__(self, TypeID: str=None, CurrentIndex: Optional[int]=None, MatchCollections: Optional[List[MatchCollectionType]]=None, **kwargs): Parameters -------...
Implement the Python class `MatchType` described below. Class description: The is an array element for match information. Method signatures and docstrings: - def __init__(self, TypeID: str=None, CurrentIndex: Optional[int]=None, MatchCollections: Optional[List[MatchCollectionType]]=None, **kwargs): Parameters -------...
de1b1886f161a83b6c89aadc7a2c7cfc4892ef81
<|skeleton|> class MatchType: """The is an array element for match information.""" def __init__(self, TypeID: str=None, CurrentIndex: Optional[int]=None, MatchCollections: Optional[List[MatchCollectionType]]=None, **kwargs): """Parameters ---------- TypeID : str CurrentIndex : None|int MatchCollections...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MatchType: """The is an array element for match information.""" def __init__(self, TypeID: str=None, CurrentIndex: Optional[int]=None, MatchCollections: Optional[List[MatchCollectionType]]=None, **kwargs): """Parameters ---------- TypeID : str CurrentIndex : None|int MatchCollections : None|List[...
the_stack_v2_python_sparse
sarpy/io/complex/sicd_elements/MatchInfo.py
ngageoint/sarpy
train
192
e50e6e8c278bdb72bc43d3d9bba64d3f204d78e9
[ "super(TestAdmin2, cls).setUpClass()\ncls.pagelogin = PageLogin(cls.browserclass.get_driver())\ncls.pageindex = PageIndex(cls.browserclass.get_driver())", "self.log.info('--------- Start Login ---------')\nself.browserclass.get_driver().get(self.loginurl)\ncaptvalue = self.pagelogin.getcaptcha(self.loginurl, self...
<|body_start_0|> super(TestAdmin2, cls).setUpClass() cls.pagelogin = PageLogin(cls.browserclass.get_driver()) cls.pageindex = PageIndex(cls.browserclass.get_driver()) <|end_body_0|> <|body_start_1|> self.log.info('--------- Start Login ---------') self.browserclass.get_driver()....
TestAdmin2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAdmin2: def setUpClass(cls): """测试类中所有测试方法执行前执行的方法""" <|body_0|> def test_a_weblogin(self): """登录测试,并为后面的菜单页面check测试,提供登录后的系统操作 :return:""" <|body_1|> def test_b_pagecheck(self, menu1, menu2, menu3, check_a): """数据驱动,左侧菜单点击及页面显示check 三个参数依次是 ...
stack_v2_sparse_classes_36k_train_006114
3,534
no_license
[ { "docstring": "测试类中所有测试方法执行前执行的方法", "name": "setUpClass", "signature": "def setUpClass(cls)" }, { "docstring": "登录测试,并为后面的菜单页面check测试,提供登录后的系统操作 :return:", "name": "test_a_weblogin", "signature": "def test_a_weblogin(self)" }, { "docstring": "数据驱动,左侧菜单点击及页面显示check 三个参数依次是 一级菜单 二...
3
null
Implement the Python class `TestAdmin2` described below. Class description: Implement the TestAdmin2 class. Method signatures and docstrings: - def setUpClass(cls): 测试类中所有测试方法执行前执行的方法 - def test_a_weblogin(self): 登录测试,并为后面的菜单页面check测试,提供登录后的系统操作 :return: - def test_b_pagecheck(self, menu1, menu2, menu3, check_a): 数据驱...
Implement the Python class `TestAdmin2` described below. Class description: Implement the TestAdmin2 class. Method signatures and docstrings: - def setUpClass(cls): 测试类中所有测试方法执行前执行的方法 - def test_a_weblogin(self): 登录测试,并为后面的菜单页面check测试,提供登录后的系统操作 :return: - def test_b_pagecheck(self, menu1, menu2, menu3, check_a): 数据驱...
08b98e08b76ed2a4984efb7f543ed63eabe30757
<|skeleton|> class TestAdmin2: def setUpClass(cls): """测试类中所有测试方法执行前执行的方法""" <|body_0|> def test_a_weblogin(self): """登录测试,并为后面的菜单页面check测试,提供登录后的系统操作 :return:""" <|body_1|> def test_b_pagecheck(self, menu1, menu2, menu3, check_a): """数据驱动,左侧菜单点击及页面显示check 三个参数依次是 ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestAdmin2: def setUpClass(cls): """测试类中所有测试方法执行前执行的方法""" super(TestAdmin2, cls).setUpClass() cls.pagelogin = PageLogin(cls.browserclass.get_driver()) cls.pageindex = PageIndex(cls.browserclass.get_driver()) def test_a_weblogin(self): """登录测试,并为后面的菜单页面check测试,提供登录后...
the_stack_v2_python_sparse
Sys_Carloan/TestClass/TestAdmin2.py
duozi/webUITestLight
train
0
6ddfafd7856fda302593489726e8f1f46fb6ee67
[ "user = self.login()\nif not user or not user.is_active:\n raise ValidationError('Sorry that was an invalid login. Please try again.')\nreturn self.cleaned_data", "username = self.cleaned_data.get('username')\npassword = self.cleaned_data.get('password')\nuser = authenticate(username=username, password=passwor...
<|body_start_0|> user = self.login() if not user or not user.is_active: raise ValidationError('Sorry that was an invalid login. Please try again.') return self.cleaned_data <|end_body_0|> <|body_start_1|> username = self.cleaned_data.get('username') password = self.c...
Manage logins to the app.
LoginForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginForm: """Manage logins to the app.""" def clean(self): """Make sure the login worked. :return: dict, the cleaned_data.""" <|body_0|> def login(self): """Authenticate the user for logging in. :return: User, the authenticated user.""" <|body_1|> <|end...
stack_v2_sparse_classes_36k_train_006115
3,096
permissive
[ { "docstring": "Make sure the login worked. :return: dict, the cleaned_data.", "name": "clean", "signature": "def clean(self)" }, { "docstring": "Authenticate the user for logging in. :return: User, the authenticated user.", "name": "login", "signature": "def login(self)" } ]
2
stack_v2_sparse_classes_30k_train_001506
Implement the Python class `LoginForm` described below. Class description: Manage logins to the app. Method signatures and docstrings: - def clean(self): Make sure the login worked. :return: dict, the cleaned_data. - def login(self): Authenticate the user for logging in. :return: User, the authenticated user.
Implement the Python class `LoginForm` described below. Class description: Manage logins to the app. Method signatures and docstrings: - def clean(self): Make sure the login worked. :return: dict, the cleaned_data. - def login(self): Authenticate the user for logging in. :return: User, the authenticated user. <|skel...
7e2c1f147cc10bccaac8ddaf15c7d8287527e2c1
<|skeleton|> class LoginForm: """Manage logins to the app.""" def clean(self): """Make sure the login worked. :return: dict, the cleaned_data.""" <|body_0|> def login(self): """Authenticate the user for logging in. :return: User, the authenticated user.""" <|body_1|> <|end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoginForm: """Manage logins to the app.""" def clean(self): """Make sure the login worked. :return: dict, the cleaned_data.""" user = self.login() if not user or not user.is_active: raise ValidationError('Sorry that was an invalid login. Please try again.') ret...
the_stack_v2_python_sparse
loader/forms.py
lnlfp/lnlfp
train
2
4f3320ad73bcc1cd6d6795b273cc99eebcebb0b2
[ "self.head = None\nself.tail = None\nself.length = 0", "if index < 0 or index >= self.length:\n return -1\nresult = self.head\nfor i in range(index):\n result = result.next\nreturn result.val", "if self.head is None:\n self.head = self.ListNode(val, None, None)\n self.tail = self.head\nelse:\n te...
<|body_start_0|> self.head = None self.tail = None self.length = 0 <|end_body_0|> <|body_start_1|> if index < 0 or index >= self.length: return -1 result = self.head for i in range(index): result = result.next return result.val <|end_body_...
MyLinkedList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyLinkedList: def __init__(self): """Initialize your data structure here.""" <|body_0|> def get(self, index: int) -> int: """Get the value of the index-th node in the linked list. If the index is invalid, return -1.""" <|body_1|> def addAtHead(self, val:...
stack_v2_sparse_classes_36k_train_006116
3,577
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Get the value of the index-th node in the linked list. If the index is invalid, return -1.", "name": "get", "signature": "def get(self, index: int) -> int" },...
6
stack_v2_sparse_classes_30k_train_013086
Implement the Python class `MyLinkedList` described below. Class description: Implement the MyLinkedList class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def get(self, index: int) -> int: Get the value of the index-th node in the linked list. If the index is invali...
Implement the Python class `MyLinkedList` described below. Class description: Implement the MyLinkedList class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def get(self, index: int) -> int: Get the value of the index-th node in the linked list. If the index is invali...
a0ab59ba0a1a11a06b7086aa8f791293ec9c7139
<|skeleton|> class MyLinkedList: def __init__(self): """Initialize your data structure here.""" <|body_0|> def get(self, index: int) -> int: """Get the value of the index-th node in the linked list. If the index is invalid, return -1.""" <|body_1|> def addAtHead(self, val:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyLinkedList: def __init__(self): """Initialize your data structure here.""" self.head = None self.tail = None self.length = 0 def get(self, index: int) -> int: """Get the value of the index-th node in the linked list. If the index is invalid, return -1.""" ...
the_stack_v2_python_sparse
leetCodePython2020/707.design-linked-list.py
HOZH/leetCode
train
2
cebd2e800c23b454505d335c8e1406011aeaea8e
[ "self.map = {}\nfor sentence, time in zip(sentences, times):\n self.map[sentence] = time", "if c == '#':\n self.map[self.cur_sent] = self.map.get(self.cur_sent, 0) + 1\n self.cur_sent = ''\n return []\nresults = []\nself.cur_sent += c\nfor key in self.map:\n if key.startswith(self.cur_sent):\n ...
<|body_start_0|> self.map = {} for sentence, time in zip(sentences, times): self.map[sentence] = time <|end_body_0|> <|body_start_1|> if c == '#': self.map[self.cur_sent] = self.map.get(self.cur_sent, 0) + 1 self.cur_sent = '' return [] re...
AutocompleteSystem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" <|body_0|> def input(self, c): """:type c: str :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.map = {} ...
stack_v2_sparse_classes_36k_train_006117
1,199
no_license
[ { "docstring": ":type sentences: List[str] :type times: List[int]", "name": "__init__", "signature": "def __init__(self, sentences, times)" }, { "docstring": ":type c: str :rtype: List[str]", "name": "input", "signature": "def input(self, c)" } ]
2
null
Implement the Python class `AutocompleteSystem` described below. Class description: Implement the AutocompleteSystem class. Method signatures and docstrings: - def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int] - def input(self, c): :type c: str :rtype: List[str]
Implement the Python class `AutocompleteSystem` described below. Class description: Implement the AutocompleteSystem class. Method signatures and docstrings: - def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int] - def input(self, c): :type c: str :rtype: List[str] <|skeleton|> cla...
c08fdd1556b6dbbdda8ad6210aa0eaa97074ae3b
<|skeleton|> class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" <|body_0|> def input(self, c): """:type c: str :rtype: List[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" self.map = {} for sentence, time in zip(sentences, times): self.map[sentence] = time def input(self, c): """:type c: str :rtype: List[str]""" ...
the_stack_v2_python_sparse
python/review/str_auto_complete_ht.py
sumitkrm/lang-1
train
0
d2e7d46f5cdeb69140574ed57b1b244ac413e1a3
[ "nums_map = dict()\nfor num in nums:\n nums_map[num] = True\nmiss_num = 1\nwhile miss_num in nums_map:\n miss_num += 1\nreturn miss_num", "nums_len = len(nums)\nfor i in range(nums_len):\n while nums[i] != i + 1 and 0 < nums[i] <= nums_len and (nums[nums[i] - 1] != nums[i]):\n nums[nums[i] - 1], n...
<|body_start_0|> nums_map = dict() for num in nums: nums_map[num] = True miss_num = 1 while miss_num in nums_map: miss_num += 1 return miss_num <|end_body_0|> <|body_start_1|> nums_len = len(nums) for i in range(nums_len): whil...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def firstMissingPositive(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def firstMissingPositive(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> nums_map = dict() f...
stack_v2_sparse_classes_36k_train_006118
799
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "firstMissingPositive", "signature": "def firstMissingPositive(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "firstMissingPositive", "signature": "def firstMissingPositive(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstMissingPositive(self, nums): :type nums: List[int] :rtype: int - def firstMissingPositive(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstMissingPositive(self, nums): :type nums: List[int] :rtype: int - def firstMissingPositive(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: ...
052bd7915257679877dbe55b60ed1abb7528eaa2
<|skeleton|> class Solution: def firstMissingPositive(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def firstMissingPositive(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def firstMissingPositive(self, nums): """:type nums: List[int] :rtype: int""" nums_map = dict() for num in nums: nums_map[num] = True miss_num = 1 while miss_num in nums_map: miss_num += 1 return miss_num def firstMissingPo...
the_stack_v2_python_sparse
python_solution/Array/41_FirstMissingPositive.py
Dimen61/leetcode
train
4
df0bfdd6f9c355d9108f078218804a9b15d25f2a
[ "query_builder = Configuration.BASE_URI\nquery_builder += '/ws/scatterplot'\nquery_builder = APIHelper.append_url_with_query_parameters(query_builder, {'q': options.get('q', None), 'x': options.get('x', None), 'y': options.get('y', None), 'fq': options.get('fq', None), 'height': options.get('height', None), 'pointc...
<|body_start_0|> query_builder = Configuration.BASE_URI query_builder += '/ws/scatterplot' query_builder = APIHelper.append_url_with_query_parameters(query_builder, {'q': options.get('q', None), 'x': options.get('x', None), 'y': options.get('y', None), 'fq': options.get('fq', None), 'height': op...
A Controller to access Endpoints in the AtlasOfLivingAustraliaOccurrencesLib API.
ScatterplotController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScatterplotController: """A Controller to access Endpoints in the AtlasOfLivingAustraliaOccurrencesLib API.""" def get_scatterplot_image(self, options=dict()): """Does a GET request to /ws/scatterplot. Return an image for occurrences and two environmental layers as a scatterplot. Arg...
stack_v2_sparse_classes_36k_train_006119
9,072
no_license
[ { "docstring": "Does a GET request to /ws/scatterplot. Return an image for occurrences and two environmental layers as a scatterplot. Args: options (dict, optional): Key-value pairs for any of the parameters to this API Endpoint. All parameters to the endpoint are supplied through the dictionary with their name...
2
stack_v2_sparse_classes_30k_train_014069
Implement the Python class `ScatterplotController` described below. Class description: A Controller to access Endpoints in the AtlasOfLivingAustraliaOccurrencesLib API. Method signatures and docstrings: - def get_scatterplot_image(self, options=dict()): Does a GET request to /ws/scatterplot. Return an image for occur...
Implement the Python class `ScatterplotController` described below. Class description: A Controller to access Endpoints in the AtlasOfLivingAustraliaOccurrencesLib API. Method signatures and docstrings: - def get_scatterplot_image(self, options=dict()): Does a GET request to /ws/scatterplot. Return an image for occur...
a9f803ea42bef4eb3720d5dd92a53dc98e8f2678
<|skeleton|> class ScatterplotController: """A Controller to access Endpoints in the AtlasOfLivingAustraliaOccurrencesLib API.""" def get_scatterplot_image(self, options=dict()): """Does a GET request to /ws/scatterplot. Return an image for occurrences and two environmental layers as a scatterplot. Arg...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScatterplotController: """A Controller to access Endpoints in the AtlasOfLivingAustraliaOccurrencesLib API.""" def get_scatterplot_image(self, options=dict()): """Does a GET request to /ws/scatterplot. Return an image for occurrences and two environmental layers as a scatterplot. Args: options (d...
the_stack_v2_python_sparse
AtlasOfLivingAustraliaOccurrencesLib/Controllers/ScatterplotController.py
chm052/naturehack
train
2
70437f949a1b790fe0dc879fd379d9dcb00d5444
[ "self.config = config\nself.add_entities = add_entities\nself.oauth = oauth", "hass = request.app['hass']\ndata = request.query\nresponse_message = 'Fitbit has been successfully authorized!\\n You can close this window now!'\nresult = None\nif data.get('code') is not None:\n redirect_uri = f'{get_url(ha...
<|body_start_0|> self.config = config self.add_entities = add_entities self.oauth = oauth <|end_body_0|> <|body_start_1|> hass = request.app['hass'] data = request.query response_message = 'Fitbit has been successfully authorized!\n You can close this window now!'...
Handle OAuth finish callback requests.
FitbitAuthCallbackView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FitbitAuthCallbackView: """Handle OAuth finish callback requests.""" def __init__(self, config, add_entities, oauth): """Initialize the OAuth callback view.""" <|body_0|> def get(self, request): """Finish OAuth callback request.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k_train_006120
19,565
permissive
[ { "docstring": "Initialize the OAuth callback view.", "name": "__init__", "signature": "def __init__(self, config, add_entities, oauth)" }, { "docstring": "Finish OAuth callback request.", "name": "get", "signature": "def get(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_011242
Implement the Python class `FitbitAuthCallbackView` described below. Class description: Handle OAuth finish callback requests. Method signatures and docstrings: - def __init__(self, config, add_entities, oauth): Initialize the OAuth callback view. - def get(self, request): Finish OAuth callback request.
Implement the Python class `FitbitAuthCallbackView` described below. Class description: Handle OAuth finish callback requests. Method signatures and docstrings: - def __init__(self, config, add_entities, oauth): Initialize the OAuth callback view. - def get(self, request): Finish OAuth callback request. <|skeleton|>...
ed4ab403deaed9e8c95e0db728477fcb012bf4fa
<|skeleton|> class FitbitAuthCallbackView: """Handle OAuth finish callback requests.""" def __init__(self, config, add_entities, oauth): """Initialize the OAuth callback view.""" <|body_0|> def get(self, request): """Finish OAuth callback request.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FitbitAuthCallbackView: """Handle OAuth finish callback requests.""" def __init__(self, config, add_entities, oauth): """Initialize the OAuth callback view.""" self.config = config self.add_entities = add_entities self.oauth = oauth def get(self, request): """...
the_stack_v2_python_sparse
homeassistant/components/fitbit/sensor.py
tchellomello/home-assistant
train
8
82b2d8c031da6bb5e3cba80238a398ec3704c79c
[ "self.default_recipients = config[CONF_DEFAULT_RECIPIENTS]\nself.sender = config[CONF_SENDER]\nself.client = Client(config[CONF_SERVICE_PLAN_ID], config[CONF_API_KEY])", "targets = kwargs.get(ATTR_TARGET, self.default_recipients)\ndata = kwargs.get(ATTR_DATA) or {}\nclx_args = {ATTR_MESSAGE: message, ATTR_SENDER:...
<|body_start_0|> self.default_recipients = config[CONF_DEFAULT_RECIPIENTS] self.sender = config[CONF_SENDER] self.client = Client(config[CONF_SERVICE_PLAN_ID], config[CONF_API_KEY]) <|end_body_0|> <|body_start_1|> targets = kwargs.get(ATTR_TARGET, self.default_recipients) data =...
Send Notifications to Sinch SMS recipients.
SinchNotificationService
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SinchNotificationService: """Send Notifications to Sinch SMS recipients.""" def __init__(self, config): """Initialize the service.""" <|body_0|> def send_message(self, message='', **kwargs): """Send a message to a user.""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_36k_train_006121
3,370
permissive
[ { "docstring": "Initialize the service.", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Send a message to a user.", "name": "send_message", "signature": "def send_message(self, message='', **kwargs)" } ]
2
null
Implement the Python class `SinchNotificationService` described below. Class description: Send Notifications to Sinch SMS recipients. Method signatures and docstrings: - def __init__(self, config): Initialize the service. - def send_message(self, message='', **kwargs): Send a message to a user.
Implement the Python class `SinchNotificationService` described below. Class description: Send Notifications to Sinch SMS recipients. Method signatures and docstrings: - def __init__(self, config): Initialize the service. - def send_message(self, message='', **kwargs): Send a message to a user. <|skeleton|> class Si...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class SinchNotificationService: """Send Notifications to Sinch SMS recipients.""" def __init__(self, config): """Initialize the service.""" <|body_0|> def send_message(self, message='', **kwargs): """Send a message to a user.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SinchNotificationService: """Send Notifications to Sinch SMS recipients.""" def __init__(self, config): """Initialize the service.""" self.default_recipients = config[CONF_DEFAULT_RECIPIENTS] self.sender = config[CONF_SENDER] self.client = Client(config[CONF_SERVICE_PLAN_I...
the_stack_v2_python_sparse
homeassistant/components/sinch/notify.py
home-assistant/core
train
35,501
af01f5fd79cc664a79cbc881d9b21e07ff36c642
[ "self.access_key_id = access_key_id\nself.auth_method = auth_method\nself.ca_certificate = ca_certificate\nself.cmk_alias = cmk_alias\nself.cmk_arn = cmk_arn\nself.cmk_key_id = cmk_key_id\nself.iam_role_arn = iam_role_arn\nself.region = region\nself.secret_access_key = secret_access_key\nself.verify_s_s_l = verify_...
<|body_start_0|> self.access_key_id = access_key_id self.auth_method = auth_method self.ca_certificate = ca_certificate self.cmk_alias = cmk_alias self.cmk_arn = cmk_arn self.cmk_key_id = cmk_key_id self.iam_role_arn = iam_role_arn self.region = region ...
Implementation of the 'AwsKmsConfiguration' model. TODO: type description here. Attributes: access_key_id (string): Access key id needed to access the cloud account. When update cluster config, should encrypte accessKeyId with cluster ID. auth_method (AuthMethodEnum): Specifies the authentication method to be used for ...
AwsKmsConfiguration
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AwsKmsConfiguration: """Implementation of the 'AwsKmsConfiguration' model. TODO: type description here. Attributes: access_key_id (string): Access key id needed to access the cloud account. When update cluster config, should encrypte accessKeyId with cluster ID. auth_method (AuthMethodEnum): Spec...
stack_v2_sparse_classes_36k_train_006122
4,533
permissive
[ { "docstring": "Constructor for the AwsKmsConfiguration class", "name": "__init__", "signature": "def __init__(self, access_key_id=None, auth_method=None, ca_certificate=None, cmk_alias=None, cmk_arn=None, cmk_key_id=None, iam_role_arn=None, region=None, secret_access_key=None, verify_s_s_l=None)" }, ...
2
stack_v2_sparse_classes_30k_train_009278
Implement the Python class `AwsKmsConfiguration` described below. Class description: Implementation of the 'AwsKmsConfiguration' model. TODO: type description here. Attributes: access_key_id (string): Access key id needed to access the cloud account. When update cluster config, should encrypte accessKeyId with cluster...
Implement the Python class `AwsKmsConfiguration` described below. Class description: Implementation of the 'AwsKmsConfiguration' model. TODO: type description here. Attributes: access_key_id (string): Access key id needed to access the cloud account. When update cluster config, should encrypte accessKeyId with cluster...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class AwsKmsConfiguration: """Implementation of the 'AwsKmsConfiguration' model. TODO: type description here. Attributes: access_key_id (string): Access key id needed to access the cloud account. When update cluster config, should encrypte accessKeyId with cluster ID. auth_method (AuthMethodEnum): Spec...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AwsKmsConfiguration: """Implementation of the 'AwsKmsConfiguration' model. TODO: type description here. Attributes: access_key_id (string): Access key id needed to access the cloud account. When update cluster config, should encrypte accessKeyId with cluster ID. auth_method (AuthMethodEnum): Specifies the aut...
the_stack_v2_python_sparse
cohesity_management_sdk/models/aws_kms_configuration.py
cohesity/management-sdk-python
train
24
1ac0ef75dbb36aaf0434179755d81ac04d5e078e
[ "password1 = self.cleaned_data.get('password1')\npassword2 = self.cleaned_data.get('password2')\nif password1 and password2:\n if password1 != password2:\n raise forms.ValidationError(\"Passwords are n't the same\")\nelse:\n raise forms.ValidationError(\"Passwords can't be empty\")\nreturn password2", ...
<|body_start_0|> password1 = self.cleaned_data.get('password1') password2 = self.cleaned_data.get('password2') if password1 and password2: if password1 != password2: raise forms.ValidationError("Passwords are n't the same") else: raise forms.Valida...
A form for registering new users with all required field
UserCreationForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserCreationForm: """A form for registering new users with all required field""" def clean_password2(self): """Check to ensure passwords are the same""" <|body_0|> def save(self, commit=True): """Save password in hashed form""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k_train_006123
2,376
no_license
[ { "docstring": "Check to ensure passwords are the same", "name": "clean_password2", "signature": "def clean_password2(self)" }, { "docstring": "Save password in hashed form", "name": "save", "signature": "def save(self, commit=True)" } ]
2
stack_v2_sparse_classes_30k_train_016724
Implement the Python class `UserCreationForm` described below. Class description: A form for registering new users with all required field Method signatures and docstrings: - def clean_password2(self): Check to ensure passwords are the same - def save(self, commit=True): Save password in hashed form
Implement the Python class `UserCreationForm` described below. Class description: A form for registering new users with all required field Method signatures and docstrings: - def clean_password2(self): Check to ensure passwords are the same - def save(self, commit=True): Save password in hashed form <|skeleton|> cla...
dbee8cab22d83e8b5d29c5172b5c3b1cdd729610
<|skeleton|> class UserCreationForm: """A form for registering new users with all required field""" def clean_password2(self): """Check to ensure passwords are the same""" <|body_0|> def save(self, commit=True): """Save password in hashed form""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserCreationForm: """A form for registering new users with all required field""" def clean_password2(self): """Check to ensure passwords are the same""" password1 = self.cleaned_data.get('password1') password2 = self.cleaned_data.get('password2') if password1 and password2...
the_stack_v2_python_sparse
webproject/src/accounts/forms.py
Ajitesh27/SuperMarket-Management-System
train
19
44989cde7ffa5b0aa8582c90078a959c3082d95f
[ "super().__init__()\nself.center_form_priors = build_priors(image_size=image_size, **priors_cfg)\nself.corner_form_priors = center_to_corner_form(self.center_form_priors)\nself.center_variance = center_variance\nself.size_variance = size_variance\nself.iou_threshold = iou_threshold", "if type(gt_boxes) is numpy.n...
<|body_start_0|> super().__init__() self.center_form_priors = build_priors(image_size=image_size, **priors_cfg) self.corner_form_priors = center_to_corner_form(self.center_form_priors) self.center_variance = center_variance self.size_variance = size_variance self.iou_thre...
description
SSDAnnotationTransform
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SSDAnnotationTransform: """description""" def __init__(self, *, image_size: Any, priors_cfg: NOD, center_variance: Any, size_variance: Any, iou_threshold: Any): """:param image_size: :type image_size: :param priors_cfg: :type priors_cfg: :param center_variance: :type center_variance:...
stack_v2_sparse_classes_36k_train_006124
3,743
permissive
[ { "docstring": ":param image_size: :type image_size: :param priors_cfg: :type priors_cfg: :param center_variance: :type center_variance: :param size_variance: :type size_variance: :param iou_threshold: :type iou_threshold:", "name": "__init__", "signature": "def __init__(self, *, image_size: Any, priors...
2
null
Implement the Python class `SSDAnnotationTransform` described below. Class description: description Method signatures and docstrings: - def __init__(self, *, image_size: Any, priors_cfg: NOD, center_variance: Any, size_variance: Any, iou_threshold: Any): :param image_size: :type image_size: :param priors_cfg: :type p...
Implement the Python class `SSDAnnotationTransform` described below. Class description: description Method signatures and docstrings: - def __init__(self, *, image_size: Any, priors_cfg: NOD, center_variance: Any, size_variance: Any, iou_threshold: Any): :param image_size: :type image_size: :param priors_cfg: :type p...
06839b08d8e8f274c02a6bcd31bf1b32d3dc04e4
<|skeleton|> class SSDAnnotationTransform: """description""" def __init__(self, *, image_size: Any, priors_cfg: NOD, center_variance: Any, size_variance: Any, iou_threshold: Any): """:param image_size: :type image_size: :param priors_cfg: :type priors_cfg: :param center_variance: :type center_variance:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SSDAnnotationTransform: """description""" def __init__(self, *, image_size: Any, priors_cfg: NOD, center_variance: Any, size_variance: Any, iou_threshold: Any): """:param image_size: :type image_size: :param priors_cfg: :type priors_cfg: :param center_variance: :type center_variance: :param size_...
the_stack_v2_python_sparse
neodroidvision/detection/single_stage/ssd/bounding_boxes/ssd_transforms.py
aivclab/vision
train
1
fbc7491a9b48d5a2eebd844a31cc626c2b7abc42
[ "fulltext = db.session.query(Fulltext).get(id)\nif not fulltext:\n return not_found_error('<Fulltext(id={})> not found'.format(id))\nif g.current_user.is_admin is False and fulltext.review.users.filter_by(id=g.current_user.id).one_or_none() is None:\n return forbidden_error('{} forbidden to get this fulltext'...
<|body_start_0|> fulltext = db.session.query(Fulltext).get(id) if not fulltext: return not_found_error('<Fulltext(id={})> not found'.format(id)) if g.current_user.is_admin is False and fulltext.review.users.filter_by(id=g.current_user.id).one_or_none() is None: return for...
FulltextResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FulltextResource: def get(self, id, fields): """get record for a single fulltext by id""" <|body_0|> def delete(self, id, test): """delete record for a single fulltext by id""" <|body_1|> <|end_skeleton|> <|body_start_0|> fulltext = db.session.query...
stack_v2_sparse_classes_36k_train_006125
3,581
no_license
[ { "docstring": "get record for a single fulltext by id", "name": "get", "signature": "def get(self, id, fields)" }, { "docstring": "delete record for a single fulltext by id", "name": "delete", "signature": "def delete(self, id, test)" } ]
2
null
Implement the Python class `FulltextResource` described below. Class description: Implement the FulltextResource class. Method signatures and docstrings: - def get(self, id, fields): get record for a single fulltext by id - def delete(self, id, test): delete record for a single fulltext by id
Implement the Python class `FulltextResource` described below. Class description: Implement the FulltextResource class. Method signatures and docstrings: - def get(self, id, fields): get record for a single fulltext by id - def delete(self, id, test): delete record for a single fulltext by id <|skeleton|> class Full...
37936769dd7c4de05e44508eeb5eaf7b8cdf1c14
<|skeleton|> class FulltextResource: def get(self, id, fields): """get record for a single fulltext by id""" <|body_0|> def delete(self, id, test): """delete record for a single fulltext by id""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FulltextResource: def get(self, id, fields): """get record for a single fulltext by id""" fulltext = db.session.query(Fulltext).get(id) if not fulltext: return not_found_error('<Fulltext(id={})> not found'.format(id)) if g.current_user.is_admin is False and fulltext...
the_stack_v2_python_sparse
colandr/api/resources/fulltexts.py
datakind/permanent-colandr-back
train
13
c592dde74f81df459ca629172241f383b399ac34
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Provides text analysis operations such as sentiment analysis and entity recognition.
LanguageServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LanguageServiceServicer: """Provides text analysis operations such as sentiment analysis and entity recognition.""" def AnalyzeSentiment(self, request, context): """Analyzes the sentiment of the provided text.""" <|body_0|> def AnalyzeEntities(self, request, context): ...
stack_v2_sparse_classes_36k_train_006126
8,150
permissive
[ { "docstring": "Analyzes the sentiment of the provided text.", "name": "AnalyzeSentiment", "signature": "def AnalyzeSentiment(self, request, context)" }, { "docstring": "Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for eac...
6
stack_v2_sparse_classes_30k_train_012255
Implement the Python class `LanguageServiceServicer` described below. Class description: Provides text analysis operations such as sentiment analysis and entity recognition. Method signatures and docstrings: - def AnalyzeSentiment(self, request, context): Analyzes the sentiment of the provided text. - def AnalyzeEnti...
Implement the Python class `LanguageServiceServicer` described below. Class description: Provides text analysis operations such as sentiment analysis and entity recognition. Method signatures and docstrings: - def AnalyzeSentiment(self, request, context): Analyzes the sentiment of the provided text. - def AnalyzeEnti...
253e419666f5dacf4566135faf5d451600020374
<|skeleton|> class LanguageServiceServicer: """Provides text analysis operations such as sentiment analysis and entity recognition.""" def AnalyzeSentiment(self, request, context): """Analyzes the sentiment of the provided text.""" <|body_0|> def AnalyzeEntities(self, request, context): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LanguageServiceServicer: """Provides text analysis operations such as sentiment analysis and entity recognition.""" def AnalyzeSentiment(self, request, context): """Analyzes the sentiment of the provided text.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details(...
the_stack_v2_python_sparse
venv/lib/python3.7/site-packages/google/cloud/language_v1beta2/proto/language_service_pb2_grpc.py
nicholasadamou/stockmine
train
2
3848ea739e8c653a33d2c9e2bac4a13ae6ea9551
[ "response = requests.post(url=url, data=data, cookies=cookie, headers=header, verify=False)\nif get_cookie != None:\n cookie_value_jar = response.cookies\n cookie_value = requests.utils.dict_from_cookiejar(cookie_value_jar)\n write_cookie(cookie_value, get_cookie['is_cookie'])\nres = response.text\nreturn ...
<|body_start_0|> response = requests.post(url=url, data=data, cookies=cookie, headers=header, verify=False) if get_cookie != None: cookie_value_jar = response.cookies cookie_value = requests.utils.dict_from_cookiejar(cookie_value_jar) write_cookie(cookie_value, get_co...
BaseRequest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseRequest: def send_post(self, url, data, cookie=None, get_cookie=None, header=None): """发送post请求""" <|body_0|> def send_get(self, url, data, cookie=None, get_cookie=None, header=None): """发送get请求""" <|body_1|> def run_main(self, method, url, data, coo...
stack_v2_sparse_classes_36k_train_006127
2,202
no_license
[ { "docstring": "发送post请求", "name": "send_post", "signature": "def send_post(self, url, data, cookie=None, get_cookie=None, header=None)" }, { "docstring": "发送get请求", "name": "send_get", "signature": "def send_get(self, url, data, cookie=None, get_cookie=None, header=None)" }, { "...
3
stack_v2_sparse_classes_30k_train_004700
Implement the Python class `BaseRequest` described below. Class description: Implement the BaseRequest class. Method signatures and docstrings: - def send_post(self, url, data, cookie=None, get_cookie=None, header=None): 发送post请求 - def send_get(self, url, data, cookie=None, get_cookie=None, header=None): 发送get请求 - de...
Implement the Python class `BaseRequest` described below. Class description: Implement the BaseRequest class. Method signatures and docstrings: - def send_post(self, url, data, cookie=None, get_cookie=None, header=None): 发送post请求 - def send_get(self, url, data, cookie=None, get_cookie=None, header=None): 发送get请求 - de...
40f39930bb0856cb337cd44d2219da5f3f5db68a
<|skeleton|> class BaseRequest: def send_post(self, url, data, cookie=None, get_cookie=None, header=None): """发送post请求""" <|body_0|> def send_get(self, url, data, cookie=None, get_cookie=None, header=None): """发送get请求""" <|body_1|> def run_main(self, method, url, data, coo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseRequest: def send_post(self, url, data, cookie=None, get_cookie=None, header=None): """发送post请求""" response = requests.post(url=url, data=data, cookies=cookie, headers=header, verify=False) if get_cookie != None: cookie_value_jar = response.cookies cookie_va...
the_stack_v2_python_sparse
Base/base_request.py
caiguoqiang/Imooc
train
0
58f5c77553c1294baaeb9911fb1119fdba89704a
[ "self.c = capacity\nself.cc = 0\nself.h = {}\nself.m = []", "if key in self.h:\n self.m.remove(key)\n self.m.append(key)\n return self.h[key]\nelse:\n return -1", "if self.cc < self.c:\n self.cc += 1\n self.h.update({key: value})\n self.m.append(key)\nelse:\n self.h.update({key: value})\...
<|body_start_0|> self.c = capacity self.cc = 0 self.h = {} self.m = [] <|end_body_0|> <|body_start_1|> if key in self.h: self.m.remove(key) self.m.append(key) return self.h[key] else: return -1 <|end_body_1|> <|body_start_...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_006128
833
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: void", "name": "pu...
3
stack_v2_sparse_classes_30k_train_017729
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void <|sk...
418172cee1bf48bb2aed3b84fe8b4defd9ef4fdf
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.c = capacity self.cc = 0 self.h = {} self.m = [] def get(self, key): """:type key: int :rtype: int""" if key in self.h: self.m.remove(key) self.m.append(k...
the_stack_v2_python_sparse
LRU Cache.py
TianyaoHua/LeetCodeSolutions
train
0
a6d618bdd10cf1ef7f19c2134eaacb8f966b9442
[ "assert len(set(ms)) == 1\nVp = [list(eigen_basis(m)) for m in ms]\nVb = [q.subs(x, s) for q in eigen_basis(n)]\nQ = [mu.subs(x, s) for mu in eigen_basis(r)]\nCoupledProblem.__init__(self, Vp, Vb, Q, beam)\nself.params = params", "if isinstance(self.beam, LineBeam):\n dim = max(self.n, self.r)\n Bb = eigen_...
<|body_start_0|> assert len(set(ms)) == 1 Vp = [list(eigen_basis(m)) for m in ms] Vb = [q.subs(x, s) for q in eigen_basis(n)] Q = [mu.subs(x, s) for mu in eigen_basis(r)] CoupledProblem.__init__(self, Vp, Vb, Q, beam) self.params = params <|end_body_0|> <|body_start_1|> ...
Parent for coupled problems with spaces Vp, Vb, Q are spanned by functions from eigenbasis
CoupledEigen
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoupledEigen: """Parent for coupled problems with spaces Vp, Vb, Q are spanned by functions from eigenbasis""" def __init__(self, ms, n, r, beam, params): """Solver with ms[i] functions for i-th comp of Vp, n for Vb and r for Q.""" <|body_0|> def Bb_matrix(self): ...
stack_v2_sparse_classes_36k_train_006129
2,158
no_license
[ { "docstring": "Solver with ms[i] functions for i-th comp of Vp, n for Vb and r for Q.", "name": "__init__", "signature": "def __init__(self, ms, n, r, beam, params)" }, { "docstring": "Matrix of the constraint on the beam", "name": "Bb_matrix", "signature": "def Bb_matrix(self)" }, ...
3
stack_v2_sparse_classes_30k_train_014753
Implement the Python class `CoupledEigen` described below. Class description: Parent for coupled problems with spaces Vp, Vb, Q are spanned by functions from eigenbasis Method signatures and docstrings: - def __init__(self, ms, n, r, beam, params): Solver with ms[i] functions for i-th comp of Vp, n for Vb and r for Q...
Implement the Python class `CoupledEigen` described below. Class description: Parent for coupled problems with spaces Vp, Vb, Q are spanned by functions from eigenbasis Method signatures and docstrings: - def __init__(self, ms, n, r, beam, params): Solver with ms[i] functions for i-th comp of Vp, n for Vb and r for Q...
2fb3686804e836d4031fbf231a36a0f9ac8a3012
<|skeleton|> class CoupledEigen: """Parent for coupled problems with spaces Vp, Vb, Q are spanned by functions from eigenbasis""" def __init__(self, ms, n, r, beam, params): """Solver with ms[i] functions for i-th comp of Vp, n for Vb and r for Q.""" <|body_0|> def Bb_matrix(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CoupledEigen: """Parent for coupled problems with spaces Vp, Vb, Q are spanned by functions from eigenbasis""" def __init__(self, ms, n, r, beam, params): """Solver with ms[i] functions for i-th comp of Vp, n for Vb and r for Q.""" assert len(set(ms)) == 1 Vp = [list(eigen_basis(m...
the_stack_v2_python_sparse
kent-report/py/coupled_eigen.py
MiroK/cutFEM-beam
train
0
87582888ab2665183465f46d5938441f413f5cca
[ "self.idxs = idxs\nself.logmin = float(logmin)\nself.logmax = float(logmax)\nself.logparam = logparam\nnamestr = 'logunidraw'\nfor ii in idxs:\n namestr += '_{}'.format(ii)\nself.__name__ = namestr", "q = x.copy()\nlqxy = 0\nfor ii in self.idxs:\n if self.logparam:\n q[ii] = np.random.uniform(self.lo...
<|body_start_0|> self.idxs = idxs self.logmin = float(logmin) self.logmax = float(logmax) self.logparam = logparam namestr = 'logunidraw' for ii in idxs: namestr += '_{}'.format(ii) self.__name__ = namestr <|end_body_0|> <|body_start_1|> q = x...
object for custom log-uniform draws
LogUniDraw
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogUniDraw: """object for custom log-uniform draws""" def __init__(self, idxs, logmin, logmax, logparam=True): """:param idx: index of parameter to use for jump""" <|body_0|> def __call__(self, x, iter, beta): """proposal from log-uniform distribution""" ...
stack_v2_sparse_classes_36k_train_006130
8,178
permissive
[ { "docstring": ":param idx: index of parameter to use for jump", "name": "__init__", "signature": "def __init__(self, idxs, logmin, logmax, logparam=True)" }, { "docstring": "proposal from log-uniform distribution", "name": "__call__", "signature": "def __call__(self, x, iter, beta)" }...
2
stack_v2_sparse_classes_30k_val_000750
Implement the Python class `LogUniDraw` described below. Class description: object for custom log-uniform draws Method signatures and docstrings: - def __init__(self, idxs, logmin, logmax, logparam=True): :param idx: index of parameter to use for jump - def __call__(self, x, iter, beta): proposal from log-uniform dis...
Implement the Python class `LogUniDraw` described below. Class description: object for custom log-uniform draws Method signatures and docstrings: - def __init__(self, idxs, logmin, logmax, logparam=True): :param idx: index of parameter to use for jump - def __call__(self, x, iter, beta): proposal from log-uniform dis...
8d98ea04ea71fa404275f0a0a4fd67c94d37b159
<|skeleton|> class LogUniDraw: """object for custom log-uniform draws""" def __init__(self, idxs, logmin, logmax, logparam=True): """:param idx: index of parameter to use for jump""" <|body_0|> def __call__(self, x, iter, beta): """proposal from log-uniform distribution""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LogUniDraw: """object for custom log-uniform draws""" def __init__(self, idxs, logmin, logmax, logparam=True): """:param idx: index of parameter to use for jump""" self.idxs = idxs self.logmin = float(logmin) self.logmax = float(logmax) self.logparam = logparam ...
the_stack_v2_python_sparse
utils/sample_helpers.py
paulthebaker/nano11_bwm
train
3
ef10982b6e273e7456dff909c70456075cd34d19
[ "logs.log_info('You are using the vgK channel: Kv1p1 ')\nself.time_unit = 1000.0\nself.vrev = -65\nself.m = 1.0 / (1 + np.exp((V - -30.5) / -11.3943))\nself.h = 1.0 / (1 + np.exp((V - -30.0) / 27.3943))\nself._mpower = 1\nself._hpower = 2", "self._mInf = 1.0 / (1 + np.exp((V - -30.5) / -11.3943))\nself._mTau = 30...
<|body_start_0|> logs.log_info('You are using the vgK channel: Kv1p1 ') self.time_unit = 1000.0 self.vrev = -65 self.m = 1.0 / (1 + np.exp((V - -30.5) / -11.3943)) self.h = 1.0 / (1 + np.exp((V - -30.0) / 27.3943)) self._mpower = 1 self._hpower = 2 <|end_body_0|> ...
Kv1.1 model from Christie et al, cloned from rat brain, studied in xenopus. Kv1.1 are low-voltage activated (LVA) channels, expressed primarily in the central nervous system, and which open with small depolarizations at or below resting potential Reference: Christie MJ. et al. Expression of a cloned rat brain potassium...
Kv1p1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Kv1p1: """Kv1.1 model from Christie et al, cloned from rat brain, studied in xenopus. Kv1.1 are low-voltage activated (LVA) channels, expressed primarily in the central nervous system, and which open with small depolarizations at or below resting potential Reference: Christie MJ. et al. Expressio...
stack_v2_sparse_classes_36k_train_006131
24,227
no_license
[ { "docstring": "Run initialization calculation for m and h gates of the channel at starting Vmem value.", "name": "_init_state", "signature": "def _init_state(self, V)" }, { "docstring": "Update the state of m and h gates of the channel given their present value and present simulation Vmem.", ...
2
null
Implement the Python class `Kv1p1` described below. Class description: Kv1.1 model from Christie et al, cloned from rat brain, studied in xenopus. Kv1.1 are low-voltage activated (LVA) channels, expressed primarily in the central nervous system, and which open with small depolarizations at or below resting potential R...
Implement the Python class `Kv1p1` described below. Class description: Kv1.1 model from Christie et al, cloned from rat brain, studied in xenopus. Kv1.1 are low-voltage activated (LVA) channels, expressed primarily in the central nervous system, and which open with small depolarizations at or below resting potential R...
dd03ff5e3df3ef48d887a6566a6286fcd168880b
<|skeleton|> class Kv1p1: """Kv1.1 model from Christie et al, cloned from rat brain, studied in xenopus. Kv1.1 are low-voltage activated (LVA) channels, expressed primarily in the central nervous system, and which open with small depolarizations at or below resting potential Reference: Christie MJ. et al. Expressio...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Kv1p1: """Kv1.1 model from Christie et al, cloned from rat brain, studied in xenopus. Kv1.1 are low-voltage activated (LVA) channels, expressed primarily in the central nervous system, and which open with small depolarizations at or below resting potential Reference: Christie MJ. et al. Expression of a cloned...
the_stack_v2_python_sparse
betse/science/channels/vg_k.py
R-Stefano/betse-ml
train
0
c11272ce6271903bba6c7ec0e3d90bb09cb6c505
[ "self.user = user\nself.password = password\nif host:\n self.host = host", "if not from_addr:\n from_addr = self.user\ndata = 'From: %s\\nTo: %s\\nSubject: %s\\n\\n%s' % (from_addr, to_addrs, subject, message)\ntry:\n server = smtplib.SMTP(self.host)\n server.ehlo()\n server.starttls()\n server....
<|body_start_0|> self.user = user self.password = password if host: self.host = host <|end_body_0|> <|body_start_1|> if not from_addr: from_addr = self.user data = 'From: %s\nTo: %s\nSubject: %s\n\n%s' % (from_addr, to_addrs, subject, message) try...
Send email through Gmail. use: Gmailer(user, password[, host]) use: send(to_addrs, subject, message[, from_addrs])
Gmailer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Gmailer: """Send email through Gmail. use: Gmailer(user, password[, host]) use: send(to_addrs, subject, message[, from_addrs])""" def __init__(self, user, password, host=None): """Set Google username and passsword. use: Gmailer(user, password[, host])""" <|body_0|> def s...
stack_v2_sparse_classes_36k_train_006132
1,781
no_license
[ { "docstring": "Set Google username and passsword. use: Gmailer(user, password[, host])", "name": "__init__", "signature": "def __init__(self, user, password, host=None)" }, { "docstring": "Set username and passsword use: send(to_addrs, subject, message[, from_addrs])", "name": "send", "...
2
stack_v2_sparse_classes_30k_train_012308
Implement the Python class `Gmailer` described below. Class description: Send email through Gmail. use: Gmailer(user, password[, host]) use: send(to_addrs, subject, message[, from_addrs]) Method signatures and docstrings: - def __init__(self, user, password, host=None): Set Google username and passsword. use: Gmailer...
Implement the Python class `Gmailer` described below. Class description: Send email through Gmail. use: Gmailer(user, password[, host]) use: send(to_addrs, subject, message[, from_addrs]) Method signatures and docstrings: - def __init__(self, user, password, host=None): Set Google username and passsword. use: Gmailer...
b02b9025add538a927538122558778c505a6c37b
<|skeleton|> class Gmailer: """Send email through Gmail. use: Gmailer(user, password[, host]) use: send(to_addrs, subject, message[, from_addrs])""" def __init__(self, user, password, host=None): """Set Google username and passsword. use: Gmailer(user, password[, host])""" <|body_0|> def s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Gmailer: """Send email through Gmail. use: Gmailer(user, password[, host]) use: send(to_addrs, subject, message[, from_addrs])""" def __init__(self, user, password, host=None): """Set Google username and passsword. use: Gmailer(user, password[, host])""" self.user = user self.pass...
the_stack_v2_python_sparse
libs/gmailer.py
yezooz/24goals
train
0
5d705cfb3d080c018b0b3fa01284b2454494da47
[ "self._term_doc_matrix = term_doc_matrix\nself._term_doc_matrix_factory = term_doc_matrix_factory\nassert term_doc_matrix_factory._nlp is None\nassert term_doc_matrix_factory.category_text_iter is None\nself._category = category\nself._clf = None\nself._proba = None", "self._clf = PassiveAggressiveClassifier(n_it...
<|body_start_0|> self._term_doc_matrix = term_doc_matrix self._term_doc_matrix_factory = term_doc_matrix_factory assert term_doc_matrix_factory._nlp is None assert term_doc_matrix_factory.category_text_iter is None self._category = category self._clf = None self._...
DeployedClassifierFactory
[ "MIT", "CC-BY-NC-SA-4.0", "LicenseRef-scancode-proprietary-license", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeployedClassifierFactory: def __init__(self, term_doc_matrix, term_doc_matrix_factory, category, nlp=None): """This is a class that enables one to train and save a classification model. Parameters ---------- term_doc_matrix : TermDocMatrix term_doc_matrix_factory : TermDocMatrixFactory ...
stack_v2_sparse_classes_36k_train_006133
2,832
permissive
[ { "docstring": "This is a class that enables one to train and save a classification model. Parameters ---------- term_doc_matrix : TermDocMatrix term_doc_matrix_factory : TermDocMatrixFactory category : str Category name nlp : spacy parser", "name": "__init__", "signature": "def __init__(self, term_doc_...
3
stack_v2_sparse_classes_30k_train_006399
Implement the Python class `DeployedClassifierFactory` described below. Class description: Implement the DeployedClassifierFactory class. Method signatures and docstrings: - def __init__(self, term_doc_matrix, term_doc_matrix_factory, category, nlp=None): This is a class that enables one to train and save a classific...
Implement the Python class `DeployedClassifierFactory` described below. Class description: Implement the DeployedClassifierFactory class. Method signatures and docstrings: - def __init__(self, term_doc_matrix, term_doc_matrix_factory, category, nlp=None): This is a class that enables one to train and save a classific...
b41e3a875faf6dd886e49e524345202432db1b21
<|skeleton|> class DeployedClassifierFactory: def __init__(self, term_doc_matrix, term_doc_matrix_factory, category, nlp=None): """This is a class that enables one to train and save a classification model. Parameters ---------- term_doc_matrix : TermDocMatrix term_doc_matrix_factory : TermDocMatrixFactory ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeployedClassifierFactory: def __init__(self, term_doc_matrix, term_doc_matrix_factory, category, nlp=None): """This is a class that enables one to train and save a classification model. Parameters ---------- term_doc_matrix : TermDocMatrix term_doc_matrix_factory : TermDocMatrixFactory category : str...
the_stack_v2_python_sparse
scattertext/DeployedClassifier.py
JasonKessler/scattertext
train
2,187
e1054b304d7557ebad7fbfe99f4e76880defd500
[ "self.host = database_config['host']\nif user is None:\n self.user = database_config['user']\nelse:\n self.user = user\nif password is None:\n self.password = database_config['password']\nelse:\n self.password = password\nself.database_name = database_config['database']\nif 'port' in database_config:\n ...
<|body_start_0|> self.host = database_config['host'] if user is None: self.user = database_config['user'] else: self.user = user if password is None: self.password = database_config['password'] else: self.password = password ...
Class to hold info on some connection.
DatabaseConnector
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatabaseConnector: """Class to hold info on some connection.""" def __init__(self, database_config, user=None, password=None): """Class to easily connect and disconnect some database. :param database_config: The config section for the database.""" <|body_0|> def connect(...
stack_v2_sparse_classes_36k_train_006134
1,483
no_license
[ { "docstring": "Class to easily connect and disconnect some database. :param database_config: The config section for the database.", "name": "__init__", "signature": "def __init__(self, database_config, user=None, password=None)" }, { "docstring": "Connect to some database. :return: The database...
2
stack_v2_sparse_classes_30k_train_016690
Implement the Python class `DatabaseConnector` described below. Class description: Class to hold info on some connection. Method signatures and docstrings: - def __init__(self, database_config, user=None, password=None): Class to easily connect and disconnect some database. :param database_config: The config section ...
Implement the Python class `DatabaseConnector` described below. Class description: Class to hold info on some connection. Method signatures and docstrings: - def __init__(self, database_config, user=None, password=None): Class to easily connect and disconnect some database. :param database_config: The config section ...
e10166847bd112fcd4fb7044e1478515104017e4
<|skeleton|> class DatabaseConnector: """Class to hold info on some connection.""" def __init__(self, database_config, user=None, password=None): """Class to easily connect and disconnect some database. :param database_config: The config section for the database.""" <|body_0|> def connect(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatabaseConnector: """Class to hold info on some connection.""" def __init__(self, database_config, user=None, password=None): """Class to easily connect and disconnect some database. :param database_config: The config section for the database.""" self.host = database_config['host'] ...
the_stack_v2_python_sparse
scripts/database/connect_database.py
Tubbz-alt/harmony
train
0
5492778001410c75eb48373e4ad53175a0d7e4d6
[ "if root == None:\n return 0\nelse:\n return 1 + self.caculate(root.left) + self.caculate(root.right)", "if root == None:\n return 0\nleft_size = self.caculate(root.left)\nif k == left_size + 1:\n return root.val\nelif k < left_size + 1:\n return self.kthSmallest(root.left, k)\nelif k > left_size +...
<|body_start_0|> if root == None: return 0 else: return 1 + self.caculate(root.left) + self.caculate(root.right) <|end_body_0|> <|body_start_1|> if root == None: return 0 left_size = self.caculate(root.left) if k == left_size + 1: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def caculate(self, root): """caculate the tree's sons""" <|body_0|> def kthSmallest(self, root, k): """:type root: TreeNode :type k: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if root == None: return 0 ...
stack_v2_sparse_classes_36k_train_006135
1,422
no_license
[ { "docstring": "caculate the tree's sons", "name": "caculate", "signature": "def caculate(self, root)" }, { "docstring": ":type root: TreeNode :type k: int :rtype: int", "name": "kthSmallest", "signature": "def kthSmallest(self, root, k)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def caculate(self, root): caculate the tree's sons - def kthSmallest(self, root, k): :type root: TreeNode :type k: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def caculate(self, root): caculate the tree's sons - def kthSmallest(self, root, k): :type root: TreeNode :type k: int :rtype: int <|skeleton|> class Solution: def caculate...
2447f760f08fb3879c5f03d8650e30ff74115d3d
<|skeleton|> class Solution: def caculate(self, root): """caculate the tree's sons""" <|body_0|> def kthSmallest(self, root, k): """:type root: TreeNode :type k: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def caculate(self, root): """caculate the tree's sons""" if root == None: return 0 else: return 1 + self.caculate(root.left) + self.caculate(root.right) def kthSmallest(self, root, k): """:type root: TreeNode :type k: int :rtype: int""" ...
the_stack_v2_python_sparse
6.21/230.二叉搜素树中第K小的元素.py
pythonnewbird/LeetCodeSolution
train
4
31244b9a94674da0a9adb370d85d19452aade290
[ "self.phoneDictSts = {}\nself.availableNums = []\nfor i in range(maxNumbers):\n self.phoneDictSts[i] = True\n heapq.heappush(self.availableNums, i)", "if len(self.availableNums) > 0:\n num = heapq.heappop(self.availableNums)\n self.phoneDictSts[num] = False\n return num\nelse:\n return -1", "i...
<|body_start_0|> self.phoneDictSts = {} self.availableNums = [] for i in range(maxNumbers): self.phoneDictSts[i] = True heapq.heappush(self.availableNums, i) <|end_body_0|> <|body_start_1|> if len(self.availableNums) > 0: num = heapq.heappop(self.avai...
PhoneDirectory
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PhoneDirectory: def __init__(self, maxNumbers): """Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory. :type maxNumbers: int""" <|body_0|> def get(self): """Provide a number which is not assigned to a...
stack_v2_sparse_classes_36k_train_006136
1,577
permissive
[ { "docstring": "Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory. :type maxNumbers: int", "name": "__init__", "signature": "def __init__(self, maxNumbers)" }, { "docstring": "Provide a number which is not assigned to anyone. @r...
4
null
Implement the Python class `PhoneDirectory` described below. Class description: Implement the PhoneDirectory class. Method signatures and docstrings: - def __init__(self, maxNumbers): Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory. :type maxNumber...
Implement the Python class `PhoneDirectory` described below. Class description: Implement the PhoneDirectory class. Method signatures and docstrings: - def __init__(self, maxNumbers): Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory. :type maxNumber...
20ae1a048eddbc9a32c819cf61258e2b57572f05
<|skeleton|> class PhoneDirectory: def __init__(self, maxNumbers): """Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory. :type maxNumbers: int""" <|body_0|> def get(self): """Provide a number which is not assigned to a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PhoneDirectory: def __init__(self, maxNumbers): """Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory. :type maxNumbers: int""" self.phoneDictSts = {} self.availableNums = [] for i in range(maxNumbers): ...
the_stack_v2_python_sparse
leetcode.com/python/379_Design_Phone_Directory.py
partho-maple/coding-interview-gym
train
862
cfdef5a5b01241a659c4476355383b228f0e5934
[ "try:\n tags = TagService.get_tags()\nexcept AppException:\n raise\nexcept Exception:\n raise AppException(exception_message.get('FETCH_TAG_EXCEPTION'))\nreturn (Response(True, tags).__dict__, 200)", "try:\n input_data = api.payload\n TagService.create_tag(input_data)\nexcept AppException:\n rai...
<|body_start_0|> try: tags = TagService.get_tags() except AppException: raise except Exception: raise AppException(exception_message.get('FETCH_TAG_EXCEPTION')) return (Response(True, tags).__dict__, 200) <|end_body_0|> <|body_start_1|> try: ...
TagController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TagController: def get(self): """Fetches all tags :return:""" <|body_0|> def post(self): """Api for creating new tag for machine :return:""" <|body_1|> def delete(self): """Delete tag""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_006137
1,657
no_license
[ { "docstring": "Fetches all tags :return:", "name": "get", "signature": "def get(self)" }, { "docstring": "Api for creating new tag for machine :return:", "name": "post", "signature": "def post(self)" }, { "docstring": "Delete tag", "name": "delete", "signature": "def del...
3
stack_v2_sparse_classes_30k_train_003470
Implement the Python class `TagController` described below. Class description: Implement the TagController class. Method signatures and docstrings: - def get(self): Fetches all tags :return: - def post(self): Api for creating new tag for machine :return: - def delete(self): Delete tag
Implement the Python class `TagController` described below. Class description: Implement the TagController class. Method signatures and docstrings: - def get(self): Fetches all tags :return: - def post(self): Api for creating new tag for machine :return: - def delete(self): Delete tag <|skeleton|> class TagControlle...
a4a452a02a1f1882c9e3f862854746d2fc7f54b6
<|skeleton|> class TagController: def get(self): """Fetches all tags :return:""" <|body_0|> def post(self): """Api for creating new tag for machine :return:""" <|body_1|> def delete(self): """Delete tag""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TagController: def get(self): """Fetches all tags :return:""" try: tags = TagService.get_tags() except AppException: raise except Exception: raise AppException(exception_message.get('FETCH_TAG_EXCEPTION')) return (Response(True, tags)...
the_stack_v2_python_sparse
controllers/tag_controller.py
himani07/ManageCloud
train
0
46aec80a6e221972ea9647708cf556e76502de7a
[ "prev, current = (None, head)\nwhile current:\n temp = current.next\n current.next = prev\n prev = current\n current = temp\nreturn prev", "def reverse(prev, current):\n if not current:\n return prev\n temp = current.next\n current.next = prev\n return reverse(current, temp)\nreturn...
<|body_start_0|> prev, current = (None, head) while current: temp = current.next current.next = prev prev = current current = temp return prev <|end_body_0|> <|body_start_1|> def reverse(prev, current): if not current: ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]: """Iterative approach Time complexity: O(n) Space complexity: O(1)""" <|body_0|> def reverseListRecursive(self, head: Optional[ListNode]) -> Optional[ListNode]: """Recursive approach Tim...
stack_v2_sparse_classes_36k_train_006138
1,202
permissive
[ { "docstring": "Iterative approach Time complexity: O(n) Space complexity: O(1)", "name": "reverseList", "signature": "def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]" }, { "docstring": "Recursive approach Time complexity: O(n) Space complexity: O(n)", "name": "reverseL...
2
stack_v2_sparse_classes_30k_train_005026
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]: Iterative approach Time complexity: O(n) Space complexity: O(1) - def reverseListRecursive(self, head: Opti...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]: Iterative approach Time complexity: O(n) Space complexity: O(1) - def reverseListRecursive(self, head: Opti...
32b0878f63e5edd19a1fbe13bfa4c518a4261e23
<|skeleton|> class Solution: def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]: """Iterative approach Time complexity: O(n) Space complexity: O(1)""" <|body_0|> def reverseListRecursive(self, head: Optional[ListNode]) -> Optional[ListNode]: """Recursive approach Tim...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]: """Iterative approach Time complexity: O(n) Space complexity: O(1)""" prev, current = (None, head) while current: temp = current.next current.next = prev prev = current ...
the_stack_v2_python_sparse
leetcode/Linked Lists/206. Reverse Linked List.py
danielfsousa/algorithms-solutions
train
2
a2c7ccf2ad4b09dc8612eb5296653f0761c3e88e
[ "fields = super().get_fields()\nfields['current_user_permissions'] = CurrentUserPermissionsSerializer(read_only=True)\nreturn fields", "data = super().to_representation(instance)\nif 'fields' not in self.request.query_params or 'current_user_permissions' in self.request.query_params['fields']:\n data['current_...
<|body_start_0|> fields = super().get_fields() fields['current_user_permissions'] = CurrentUserPermissionsSerializer(read_only=True) return fields <|end_body_0|> <|body_start_1|> data = super().to_representation(instance) if 'fields' not in self.request.query_params or 'current_...
Augment serializer class.
SerializerWithPermissions
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SerializerWithPermissions: """Augment serializer class.""" def get_fields(serializer_self): """Return serializer's fields.""" <|body_0|> def to_representation(serializer_self, instance: models.Model): """Object serializer.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_006139
5,053
permissive
[ { "docstring": "Return serializer's fields.", "name": "get_fields", "signature": "def get_fields(serializer_self)" }, { "docstring": "Object serializer.", "name": "to_representation", "signature": "def to_representation(serializer_self, instance: models.Model)" } ]
2
null
Implement the Python class `SerializerWithPermissions` described below. Class description: Augment serializer class. Method signatures and docstrings: - def get_fields(serializer_self): Return serializer's fields. - def to_representation(serializer_self, instance: models.Model): Object serializer.
Implement the Python class `SerializerWithPermissions` described below. Class description: Augment serializer class. Method signatures and docstrings: - def get_fields(serializer_self): Return serializer's fields. - def to_representation(serializer_self, instance: models.Model): Object serializer. <|skeleton|> class...
25c0c45235ef37beb45c1af4c917fbbae6282016
<|skeleton|> class SerializerWithPermissions: """Augment serializer class.""" def get_fields(serializer_self): """Return serializer's fields.""" <|body_0|> def to_representation(serializer_self, instance: models.Model): """Object serializer.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SerializerWithPermissions: """Augment serializer class.""" def get_fields(serializer_self): """Return serializer's fields.""" fields = super().get_fields() fields['current_user_permissions'] = CurrentUserPermissionsSerializer(read_only=True) return fields def to_repre...
the_stack_v2_python_sparse
resolwe/permissions/mixins.py
genialis/resolwe
train
35
741c6773ee9da987a6884ccf683917d9f868c4c8
[ "kwargs = super(NewbobRelative, cls).load_initial_kwargs_from_config(config)\nkwargs.update({'relativeErrorThreshold': config.float('newbob_relative_error_threshold', -0.01), 'learningRateDecayFactor': config.float('newbob_learning_rate_decay', 0.5)})\nreturn kwargs", "super(NewbobRelative, self).__init__(**kwarg...
<|body_start_0|> kwargs = super(NewbobRelative, cls).load_initial_kwargs_from_config(config) kwargs.update({'relativeErrorThreshold': config.float('newbob_relative_error_threshold', -0.01), 'learningRateDecayFactor': config.float('newbob_learning_rate_decay', 0.5)}) return kwargs <|end_body_0|> ...
NewbobRelative
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NewbobRelative: def load_initial_kwargs_from_config(cls, config): """:type config: Config.Config :rtype: dict[str]""" <|body_0|> def __init__(self, relativeErrorThreshold, learningRateDecayFactor, **kwargs): """:param float defaultLearningRate: learning rate for epoc...
stack_v2_sparse_classes_36k_train_006140
19,323
no_license
[ { "docstring": ":type config: Config.Config :rtype: dict[str]", "name": "load_initial_kwargs_from_config", "signature": "def load_initial_kwargs_from_config(cls, config)" }, { "docstring": ":param float defaultLearningRate: learning rate for epoch 1+2 :type relativeErrorThreshold: float :type le...
3
stack_v2_sparse_classes_30k_train_014807
Implement the Python class `NewbobRelative` described below. Class description: Implement the NewbobRelative class. Method signatures and docstrings: - def load_initial_kwargs_from_config(cls, config): :type config: Config.Config :rtype: dict[str] - def __init__(self, relativeErrorThreshold, learningRateDecayFactor, ...
Implement the Python class `NewbobRelative` described below. Class description: Implement the NewbobRelative class. Method signatures and docstrings: - def load_initial_kwargs_from_config(cls, config): :type config: Config.Config :rtype: dict[str] - def __init__(self, relativeErrorThreshold, learningRateDecayFactor, ...
d494b3041069d377d6a7a9c296a14334f2fa5acc
<|skeleton|> class NewbobRelative: def load_initial_kwargs_from_config(cls, config): """:type config: Config.Config :rtype: dict[str]""" <|body_0|> def __init__(self, relativeErrorThreshold, learningRateDecayFactor, **kwargs): """:param float defaultLearningRate: learning rate for epoc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NewbobRelative: def load_initial_kwargs_from_config(cls, config): """:type config: Config.Config :rtype: dict[str]""" kwargs = super(NewbobRelative, cls).load_initial_kwargs_from_config(config) kwargs.update({'relativeErrorThreshold': config.float('newbob_relative_error_threshold', -0....
the_stack_v2_python_sparse
python/rwth-i6_returnn/returnn-master/LearningRateControl.py
LiuFang816/SALSTM_py_data
train
10
e80916f52ec9e55e0abc080368b1e8b1a91b5c8d
[ "redis = Redis.get_instance(1)\nuser_as_json = redis.get('doula:user:%s' % username)\nif user_as_json:\n return json.loads(user_as_json)\nelse:\n return None", "if not 'email' in user:\n user['email'] = 'no-reply@surveymonkey.com'\nif not 'settings' in user:\n user['settings'] = {}\nif not 'notify_me'...
<|body_start_0|> redis = Redis.get_instance(1) user_as_json = redis.get('doula:user:%s' % username) if user_as_json: return json.loads(user_as_json) else: return None <|end_body_0|> <|body_start_1|> if not 'email' in user: user['email'] = 'no-...
The user represents a user that has logged into Doula via GitHub Example user object: user = { 'username': '', 'oauth_token': '', 'avatar_url': '', 'email': '', 'settings': { 'notify_me': 'failed', 'subscribed_to': ['my_jobs'] } }
User
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class User: """The user represents a user that has logged into Doula via GitHub Example user object: user = { 'username': '', 'oauth_token': '', 'avatar_url': '', 'email': '', 'settings': { 'notify_me': 'failed', 'subscribed_to': ['my_jobs'] } }""" def find(username): """Find the user in t...
stack_v2_sparse_classes_36k_train_006141
2,506
permissive
[ { "docstring": "Find the user in the redis db by username Users are stored in redis with the key: 'doula:user:[username]'", "name": "find", "signature": "def find(username)" }, { "docstring": "Save the user object to redis and make sure the user has all right key values", "name": "save", ...
4
stack_v2_sparse_classes_30k_val_000360
Implement the Python class `User` described below. Class description: The user represents a user that has logged into Doula via GitHub Example user object: user = { 'username': '', 'oauth_token': '', 'avatar_url': '', 'email': '', 'settings': { 'notify_me': 'failed', 'subscribed_to': ['my_jobs'] } } Method signatures...
Implement the Python class `User` described below. Class description: The user represents a user that has logged into Doula via GitHub Example user object: user = { 'username': '', 'oauth_token': '', 'avatar_url': '', 'email': '', 'settings': { 'notify_me': 'failed', 'subscribed_to': ['my_jobs'] } } Method signatures...
239a8c522c9d3488920581f802f7a1ef1f5f6355
<|skeleton|> class User: """The user represents a user that has logged into Doula via GitHub Example user object: user = { 'username': '', 'oauth_token': '', 'avatar_url': '', 'email': '', 'settings': { 'notify_me': 'failed', 'subscribed_to': ['my_jobs'] } }""" def find(username): """Find the user in t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class User: """The user represents a user that has logged into Doula via GitHub Example user object: user = { 'username': '', 'oauth_token': '', 'avatar_url': '', 'email': '', 'settings': { 'notify_me': 'failed', 'subscribed_to': ['my_jobs'] } }""" def find(username): """Find the user in the redis db b...
the_stack_v2_python_sparse
doula/models/user.py
msabramo/Doula
train
0
71b4ba13e85dad5800089b4efe0d300d5185f144
[ "names = set()\nconnections = list()\nwith open(filename, 'r') as myfile:\n for line in myfile.readlines():\n con = line.strip().split(',')\n connections.append(con)\n names.add(con[0])\n names.add(con[1])\nself.names = sorted(list(names))\nn = len(self.names)\nself.n = n\nA = np.zero...
<|body_start_0|> names = set() connections = list() with open(filename, 'r') as myfile: for line in myfile.readlines(): con = line.strip().split(',') connections.append(con) names.add(con[0]) names.add(con[1]) se...
Predict links between nodes of a network.
LinkPredictor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinkPredictor: """Predict links between nodes of a network.""" def __init__(self, filename='social_network.csv'): """Create the effective resistance matrix by constructing an adjacency matrix. Parameters: filename (str): The name of a file containing graph data.""" <|body_0|>...
stack_v2_sparse_classes_36k_train_006142
6,778
no_license
[ { "docstring": "Create the effective resistance matrix by constructing an adjacency matrix. Parameters: filename (str): The name of a file containing graph data.", "name": "__init__", "signature": "def __init__(self, filename='social_network.csv')" }, { "docstring": "Predict the next link, eithe...
3
stack_v2_sparse_classes_30k_train_007697
Implement the Python class `LinkPredictor` described below. Class description: Predict links between nodes of a network. Method signatures and docstrings: - def __init__(self, filename='social_network.csv'): Create the effective resistance matrix by constructing an adjacency matrix. Parameters: filename (str): The na...
Implement the Python class `LinkPredictor` described below. Class description: Predict links between nodes of a network. Method signatures and docstrings: - def __init__(self, filename='social_network.csv'): Create the effective resistance matrix by constructing an adjacency matrix. Parameters: filename (str): The na...
6e969de3a8337b0bd9bb4ba7abac722ab5c065ab
<|skeleton|> class LinkPredictor: """Predict links between nodes of a network.""" def __init__(self, filename='social_network.csv'): """Create the effective resistance matrix by constructing an adjacency matrix. Parameters: filename (str): The name of a file containing graph data.""" <|body_0|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinkPredictor: """Predict links between nodes of a network.""" def __init__(self, filename='social_network.csv'): """Create the effective resistance matrix by constructing an adjacency matrix. Parameters: filename (str): The name of a file containing graph data.""" names = set() c...
the_stack_v2_python_sparse
Class/ACME_Volume_1-Python/DrazinInverse/drazin.py
scj1420/Class-Projects-Research
train
0
d66b1f5f73f2e1f15c574871c2971068441dda0c
[ "self.params = params\nself.dev_mode = dev_mode\nself.result_list = []", "result = scale_result(result, scaler)\nif self.dev_mode:\n self.result_list.append(result)\nelse:\n self._send_request(result)", "response = requests.post(self.params['aggregationServiceUrl'], json={'update': result})\nif response.s...
<|body_start_0|> self.params = params self.dev_mode = dev_mode self.result_list = [] <|end_body_0|> <|body_start_1|> result = scale_result(result, scaler) if self.dev_mode: self.result_list.append(result) else: self._send_request(result) <|end_bod...
Process results. Args: params (dict): Dictionary of parameters. dev_mode (bool): Specify if dev_mode is on.
ResultProcessor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResultProcessor: """Process results. Args: params (dict): Dictionary of parameters. dev_mode (bool): Specify if dev_mode is on.""" def __init__(self, params, dev_mode): """Initialize result processor.""" <|body_0|> def __call__(self, result, scaler=1): """Process...
stack_v2_sparse_classes_36k_train_006143
13,445
permissive
[ { "docstring": "Initialize result processor.", "name": "__init__", "signature": "def __init__(self, params, dev_mode)" }, { "docstring": "Process the result. If dev_mode is set to true, it appends the result to a list. Else it send the post request to `aggregationServiceUrl`. Args: result (dict)...
4
stack_v2_sparse_classes_30k_train_001360
Implement the Python class `ResultProcessor` described below. Class description: Process results. Args: params (dict): Dictionary of parameters. dev_mode (bool): Specify if dev_mode is on. Method signatures and docstrings: - def __init__(self, params, dev_mode): Initialize result processor. - def __call__(self, resul...
Implement the Python class `ResultProcessor` described below. Class description: Process results. Args: params (dict): Dictionary of parameters. dev_mode (bool): Specify if dev_mode is on. Method signatures and docstrings: - def __init__(self, params, dev_mode): Initialize result processor. - def __call__(self, resul...
d575747f2e45672b88f2545ff79c9ae771e483a6
<|skeleton|> class ResultProcessor: """Process results. Args: params (dict): Dictionary of parameters. dev_mode (bool): Specify if dev_mode is on.""" def __init__(self, params, dev_mode): """Initialize result processor.""" <|body_0|> def __call__(self, result, scaler=1): """Process...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResultProcessor: """Process results. Args: params (dict): Dictionary of parameters. dev_mode (bool): Specify if dev_mode is on.""" def __init__(self, params, dev_mode): """Initialize result processor.""" self.params = params self.dev_mode = dev_mode self.result_list = [] ...
the_stack_v2_python_sparse
opalalgorithms/utils/algorithmrunner.py
OPAL-Project/opalalgorithms
train
10
391d8181f8fd64850043c1ecea4eb1ad70f0f661
[ "super().__init__()\nself.conv = nn.Sequential(nn.Conv2D(1, odim, 3, 2), nn.ReLU(), nn.Conv2D(odim, odim, 3, 2), nn.ReLU())\nself.out = nn.Sequential(nn.Linear(odim * (((idim - 1) // 2 - 1) // 2), odim), pos_enc if pos_enc is not None else PositionalEncoding(odim, dropout_rate))", "x = x.unsqueeze(1)\nx = self.co...
<|body_start_0|> super().__init__() self.conv = nn.Sequential(nn.Conv2D(1, odim, 3, 2), nn.ReLU(), nn.Conv2D(odim, odim, 3, 2), nn.ReLU()) self.out = nn.Sequential(nn.Linear(odim * (((idim - 1) // 2 - 1) // 2), odim), pos_enc if pos_enc is not None else PositionalEncoding(odim, dropout_rate)) <|...
Convolutional 2D subsampling (to 1/4 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (nn.Layer): Custom position encoding layer.
Conv2dSubsampling
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Conv2dSubsampling: """Convolutional 2D subsampling (to 1/4 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (nn.Layer): Custom position encoding layer.""" def __init__(self, idim, odim, dropout_rate, pos_enc=None): ...
stack_v2_sparse_classes_36k_train_006144
2,748
permissive
[ { "docstring": "Construct an Conv2dSubsampling object.", "name": "__init__", "signature": "def __init__(self, idim, odim, dropout_rate, pos_enc=None)" }, { "docstring": "Subsample x. Args: x (Tensor): Input tensor (#batch, time, idim). x_mask (Tensor): Input mask (#batch, 1, time). Returns: Tens...
3
null
Implement the Python class `Conv2dSubsampling` described below. Class description: Convolutional 2D subsampling (to 1/4 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (nn.Layer): Custom position encoding layer. Method signatures and docstrings: - ...
Implement the Python class `Conv2dSubsampling` described below. Class description: Convolutional 2D subsampling (to 1/4 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (nn.Layer): Custom position encoding layer. Method signatures and docstrings: - ...
17854a04d43c231eff66bfed9d6aa55e94a29e79
<|skeleton|> class Conv2dSubsampling: """Convolutional 2D subsampling (to 1/4 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (nn.Layer): Custom position encoding layer.""" def __init__(self, idim, odim, dropout_rate, pos_enc=None): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Conv2dSubsampling: """Convolutional 2D subsampling (to 1/4 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (nn.Layer): Custom position encoding layer.""" def __init__(self, idim, odim, dropout_rate, pos_enc=None): """Construct ...
the_stack_v2_python_sparse
paddlespeech/t2s/modules/transformer/subsampling.py
anniyanvr/DeepSpeech-1
train
0
ec6c2326762d753e3b2b903ec46089302904aee2
[ "if self._short_id is None:\n if hasattr(self, 'eadid') and self.eadid.value:\n eadid = self.eadid.value\n else:\n eadid = None\n self._short_id = shortform_id(self.id, eadid)\nreturn self._short_id", "if self._title is None:\n if hasattr(self, 'did') and hasattr(self.did, 'unittitle'):\...
<|body_start_0|> if self._short_id is None: if hasattr(self, 'eadid') and self.eadid.value: eadid = self.eadid.value else: eadid = None self._short_id = shortform_id(self.id, eadid) return self._short_id <|end_body_0|> <|body_start_1|>...
Top-level (c01) series. Customized version of :class:`eulcore.xmlmap.eadmap.Component`
Series
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Series: """Top-level (c01) series. Customized version of :class:`eulcore.xmlmap.eadmap.Component`""" def short_id(self): """Short-form id (without eadid prefix) for use in external urls.""" <|body_0|> def title(self): """Title of series without the date.""" ...
stack_v2_sparse_classes_36k_train_006145
4,050
no_license
[ { "docstring": "Short-form id (without eadid prefix) for use in external urls.", "name": "short_id", "signature": "def short_id(self)" }, { "docstring": "Title of series without the date.", "name": "title", "signature": "def title(self)" } ]
2
null
Implement the Python class `Series` described below. Class description: Top-level (c01) series. Customized version of :class:`eulcore.xmlmap.eadmap.Component` Method signatures and docstrings: - def short_id(self): Short-form id (without eadid prefix) for use in external urls. - def title(self): Title of series witho...
Implement the Python class `Series` described below. Class description: Top-level (c01) series. Customized version of :class:`eulcore.xmlmap.eadmap.Component` Method signatures and docstrings: - def short_id(self): Short-form id (without eadid prefix) for use in external urls. - def title(self): Title of series witho...
579d926794fc5662312e3f009c4b1a0d589867c9
<|skeleton|> class Series: """Top-level (c01) series. Customized version of :class:`eulcore.xmlmap.eadmap.Component`""" def short_id(self): """Short-form id (without eadid prefix) for use in external urls.""" <|body_0|> def title(self): """Title of series without the date.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Series: """Top-level (c01) series. Customized version of :class:`eulcore.xmlmap.eadmap.Component`""" def short_id(self): """Short-form id (without eadid prefix) for use in external urls.""" if self._short_id is None: if hasattr(self, 'eadid') and self.eadid.value: ...
the_stack_v2_python_sparse
keep/common/eadmap.py
emory-libraries/TheKeep
train
0
e6b851c4f7dbe161c3358a7fe87b576d481f02e6
[ "if root is None:\n return 0\nqueue = [root]\ndepth = 0\nwhile queue != []:\n depth += 1\n for i in range(len(queue)):\n if queue[0].left is not None:\n queue.append(queue[0].left)\n if queue[0].right is not None:\n queue.append(queue[0].right)\n queue.pop(0)\nret...
<|body_start_0|> if root is None: return 0 queue = [root] depth = 0 while queue != []: depth += 1 for i in range(len(queue)): if queue[0].left is not None: queue.append(queue[0].left) if queue[0].righ...
DFS
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """DFS""" def maxDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def maxDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if root is None: return 0 ...
stack_v2_sparse_classes_36k_train_006146
2,157
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "maxDepth", "signature": "def maxDepth(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "maxDepth", "signature": "def maxDepth(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: DFS Method signatures and docstrings: - def maxDepth(self, root): :type root: TreeNode :rtype: int - def maxDepth(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: DFS Method signatures and docstrings: - def maxDepth(self, root): :type root: TreeNode :rtype: int - def maxDepth(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: """DFS""" def maxDepth(self, root): "...
e41a86e9d4615079247ef3ef9a35537f4b40d338
<|skeleton|> class Solution: """DFS""" def maxDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def maxDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """DFS""" def maxDepth(self, root): """:type root: TreeNode :rtype: int""" if root is None: return 0 queue = [root] depth = 0 while queue != []: depth += 1 for i in range(len(queue)): if queue[0].left is...
the_stack_v2_python_sparse
Algorithms/二叉树的最大深度.py
pppineapple/LeetCode
train
0
484ab52a9b288846d4ff055d7a46687ac2ba512d
[ "super(NormalizeImage, self).__init__()\nself.mean = mean\nself.std = std\nself.is_scale = is_scale\nself.is_channel_first = is_channel_first\nif not (isinstance(self.mean, list) and isinstance(self.std, list) and isinstance(self.is_scale, bool)):\n raise TypeError('{}: input type is invalid.'.format(self))\nfro...
<|body_start_0|> super(NormalizeImage, self).__init__() self.mean = mean self.std = std self.is_scale = is_scale self.is_channel_first = is_channel_first if not (isinstance(self.mean, list) and isinstance(self.std, list) and isinstance(self.is_scale, bool)): r...
NormalizeImage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NormalizeImage: def __init__(self, mean=[0.485, 0.456, 0.406], std=[1, 1, 1], is_scale=True, is_channel_first=True): """Args: mean (list): the pixel mean std (list): the pixel variance""" <|body_0|> def __call__(self, sample, context=None): """Normalize the image. Op...
stack_v2_sparse_classes_36k_train_006147
39,037
permissive
[ { "docstring": "Args: mean (list): the pixel mean std (list): the pixel variance", "name": "__init__", "signature": "def __init__(self, mean=[0.485, 0.456, 0.406], std=[1, 1, 1], is_scale=True, is_channel_first=True)" }, { "docstring": "Normalize the image. Operators: 1.(optional) Scale the imag...
2
stack_v2_sparse_classes_30k_train_009342
Implement the Python class `NormalizeImage` described below. Class description: Implement the NormalizeImage class. Method signatures and docstrings: - def __init__(self, mean=[0.485, 0.456, 0.406], std=[1, 1, 1], is_scale=True, is_channel_first=True): Args: mean (list): the pixel mean std (list): the pixel variance ...
Implement the Python class `NormalizeImage` described below. Class description: Implement the NormalizeImage class. Method signatures and docstrings: - def __init__(self, mean=[0.485, 0.456, 0.406], std=[1, 1, 1], is_scale=True, is_channel_first=True): Args: mean (list): the pixel mean std (list): the pixel variance ...
420527996b6da60ca401717a734329f126ed0680
<|skeleton|> class NormalizeImage: def __init__(self, mean=[0.485, 0.456, 0.406], std=[1, 1, 1], is_scale=True, is_channel_first=True): """Args: mean (list): the pixel mean std (list): the pixel variance""" <|body_0|> def __call__(self, sample, context=None): """Normalize the image. Op...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NormalizeImage: def __init__(self, mean=[0.485, 0.456, 0.406], std=[1, 1, 1], is_scale=True, is_channel_first=True): """Args: mean (list): the pixel mean std (list): the pixel variance""" super(NormalizeImage, self).__init__() self.mean = mean self.std = std self.is_sca...
the_stack_v2_python_sparse
PaddleCV/PaddleDetection/ppdet/data/transform/operators.py
chenbjin/models
train
3
4733cceed5f5e562b2c330358c115c8da883b44e
[ "similarities = sequences.new_zeros((cluster_centers_count, cluster_centers_count), dtype=torch.float)\noccurred_seqs = sequence_occurrences > 0\nif not occurred_seqs.any():\n return similarities\nsequences = sequences[occurred_seqs]\nsequence_occurrences = sequence_occurrences[occurred_seqs]\nsimilarities_flat ...
<|body_start_0|> similarities = sequences.new_zeros((cluster_centers_count, cluster_centers_count), dtype=torch.float) occurred_seqs = sequence_occurrences > 0 if not occurred_seqs.any(): return similarities sequences = sequences[occurred_seqs] sequence_occurrences = ...
ClusterUtils
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClusterUtils: def compute_similarities(cluster_centers_count: int, sequences: torch.Tensor, sequence_occurrences: torch.Tensor) -> torch.Tensor: """Compute cluster centers similarities. Args: cluster_centers_count: number of cluster centers sequences: tensor[sequences_count, sequence_len...
stack_v2_sparse_classes_36k_train_006148
38,858
permissive
[ { "docstring": "Compute cluster centers similarities. Args: cluster_centers_count: number of cluster centers sequences: tensor[sequences_count, sequence_length] = cluster_center_id sequence_occurrences: tensor[sequences_count] = number_of_occurrences Returns: tensor[cluster_centers_count, cluster_centers_count]...
2
stack_v2_sparse_classes_30k_train_007723
Implement the Python class `ClusterUtils` described below. Class description: Implement the ClusterUtils class. Method signatures and docstrings: - def compute_similarities(cluster_centers_count: int, sequences: torch.Tensor, sequence_occurrences: torch.Tensor) -> torch.Tensor: Compute cluster centers similarities. A...
Implement the Python class `ClusterUtils` described below. Class description: Implement the ClusterUtils class. Method signatures and docstrings: - def compute_similarities(cluster_centers_count: int, sequences: torch.Tensor, sequence_occurrences: torch.Tensor) -> torch.Tensor: Compute cluster centers similarities. A...
81d72b82ec96948c26d292d709f18c9c77a17ba4
<|skeleton|> class ClusterUtils: def compute_similarities(cluster_centers_count: int, sequences: torch.Tensor, sequence_occurrences: torch.Tensor) -> torch.Tensor: """Compute cluster centers similarities. Args: cluster_centers_count: number of cluster centers sequences: tensor[sequences_count, sequence_len...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClusterUtils: def compute_similarities(cluster_centers_count: int, sequences: torch.Tensor, sequence_occurrences: torch.Tensor) -> torch.Tensor: """Compute cluster centers similarities. Args: cluster_centers_count: number of cluster centers sequences: tensor[sequences_count, sequence_length] = cluster...
the_stack_v2_python_sparse
torchsim/gui/observers/cluster_observer.py
andreofner/torchsim
train
0
603691d1509b668cf8a5ea530b286ac41029f5cc
[ "timeout: float = kwargs.get('timeout', 2.0)\nresponse = self._session.head(self._path(f'/'), allow_redirects=True, timeout=timeout)\nreturn bool(response.status_code == status.OK)", "r = self._session.head(self._path(f'/pdf/{identifier}'), allow_redirects=True)\nif r.status_code == status.OK:\n return True\ni...
<|body_start_0|> timeout: float = kwargs.get('timeout', 2.0) response = self._session.head(self._path(f'/'), allow_redirects=True, timeout=timeout) return bool(response.status_code == status.OK) <|end_body_0|> <|body_start_1|> r = self._session.head(self._path(f'/pdf/{identifier}'), all...
Provides an interface to get PDFs.
CanonicalPDF
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CanonicalPDF: """Provides an interface to get PDFs.""" def is_available(self, **kwargs: Any) -> bool: """Determine whether canonical PDFs are available.""" <|body_0|> def exists(self, identifier: str) -> bool: """Determine whether or not a target URL is available...
stack_v2_sparse_classes_36k_train_006149
3,680
permissive
[ { "docstring": "Determine whether canonical PDFs are available.", "name": "is_available", "signature": "def is_available(self, **kwargs: Any) -> bool" }, { "docstring": "Determine whether or not a target URL is available (HEAD request). Parameters ---------- identifier : str arXiv identifier for...
3
stack_v2_sparse_classes_30k_train_011547
Implement the Python class `CanonicalPDF` described below. Class description: Provides an interface to get PDFs. Method signatures and docstrings: - def is_available(self, **kwargs: Any) -> bool: Determine whether canonical PDFs are available. - def exists(self, identifier: str) -> bool: Determine whether or not a ta...
Implement the Python class `CanonicalPDF` described below. Class description: Provides an interface to get PDFs. Method signatures and docstrings: - def is_available(self, **kwargs: Any) -> bool: Determine whether canonical PDFs are available. - def exists(self, identifier: str) -> bool: Determine whether or not a ta...
36008457022cde245d78b3ad91e0a95aa21bc420
<|skeleton|> class CanonicalPDF: """Provides an interface to get PDFs.""" def is_available(self, **kwargs: Any) -> bool: """Determine whether canonical PDFs are available.""" <|body_0|> def exists(self, identifier: str) -> bool: """Determine whether or not a target URL is available...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CanonicalPDF: """Provides an interface to get PDFs.""" def is_available(self, **kwargs: Any) -> bool: """Determine whether canonical PDFs are available.""" timeout: float = kwargs.get('timeout', 2.0) response = self._session.head(self._path(f'/'), allow_redirects=True, timeout=tim...
the_stack_v2_python_sparse
fulltext/services/legacy/legacy.py
arXiv/arxiv-fulltext
train
38
a9dd14cf8b725888fd2afb51028023c7476bd15d
[ "self.device_path = device_path\nself.guid = guid\nself.is_boot_volume = is_boot_volume\nself.is_extended_attributes_supported = is_extended_attributes_supported\nself.is_protected = is_protected\nself.is_shared_volume = is_shared_volume\nself.label = label\nself.logical_size_bytes = logical_size_bytes\nself.mount_...
<|body_start_0|> self.device_path = device_path self.guid = guid self.is_boot_volume = is_boot_volume self.is_extended_attributes_supported = is_extended_attributes_supported self.is_protected = is_protected self.is_shared_volume = is_shared_volume self.label = la...
Implementation of the 'PhysicalVolume' model. Specifies volume information about a Physical Protection Source. Attributes: device_path (string): Specifies the path to the device that hosts the volume locally. guid (string): Specifies an id for the Physical Volume. is_boot_volume (bool): Specifies whether the volume is ...
PhysicalVolume
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PhysicalVolume: """Implementation of the 'PhysicalVolume' model. Specifies volume information about a Physical Protection Source. Attributes: device_path (string): Specifies the path to the device that hosts the volume locally. guid (string): Specifies an id for the Physical Volume. is_boot_volum...
stack_v2_sparse_classes_36k_train_006150
5,033
permissive
[ { "docstring": "Constructor for the PhysicalVolume class", "name": "__init__", "signature": "def __init__(self, device_path=None, guid=None, is_boot_volume=None, is_extended_attributes_supported=None, is_protected=None, is_shared_volume=None, label=None, logical_size_bytes=None, mount_points=None, mount...
2
null
Implement the Python class `PhysicalVolume` described below. Class description: Implementation of the 'PhysicalVolume' model. Specifies volume information about a Physical Protection Source. Attributes: device_path (string): Specifies the path to the device that hosts the volume locally. guid (string): Specifies an id...
Implement the Python class `PhysicalVolume` described below. Class description: Implementation of the 'PhysicalVolume' model. Specifies volume information about a Physical Protection Source. Attributes: device_path (string): Specifies the path to the device that hosts the volume locally. guid (string): Specifies an id...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class PhysicalVolume: """Implementation of the 'PhysicalVolume' model. Specifies volume information about a Physical Protection Source. Attributes: device_path (string): Specifies the path to the device that hosts the volume locally. guid (string): Specifies an id for the Physical Volume. is_boot_volum...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PhysicalVolume: """Implementation of the 'PhysicalVolume' model. Specifies volume information about a Physical Protection Source. Attributes: device_path (string): Specifies the path to the device that hosts the volume locally. guid (string): Specifies an id for the Physical Volume. is_boot_volume (bool): Spe...
the_stack_v2_python_sparse
cohesity_management_sdk/models/physical_volume.py
cohesity/management-sdk-python
train
24
b097669829826d57218b56d17b47a55831c33581
[ "self.derivatives = derivatives\nfor param_str in params:\n if not hasattr(self, param_str):\n setattr(self, param_str, self._make_param_function(param_str))\nsuper().__init__(params=params)", "def param_function(ext, module, g_inp, g_out, bpQuantities):\n \"\"\"Calculates gradient with the help of d...
<|body_start_0|> self.derivatives = derivatives for param_str in params: if not hasattr(self, param_str): setattr(self, param_str, self._make_param_function(param_str)) super().__init__(params=params) <|end_body_0|> <|body_start_1|> def param_function(ext, mo...
Calculates the gradient. Passes the calls for the parameters to the derivatives class. Implements functions with method names from params. If child class wants to overwrite these methods - for example to support an additional external module - it can do so using the interface for parameter "param1":: param1(ext, module...
GradBaseModule
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GradBaseModule: """Calculates the gradient. Passes the calls for the parameters to the derivatives class. Implements functions with method names from params. If child class wants to overwrite these methods - for example to support an additional external module - it can do so using the interface f...
stack_v2_sparse_classes_36k_train_006151
2,424
permissive
[ { "docstring": "Initializes all methods. If the param method has already been defined, it is left unchanged. Args: derivatives(backpack.core.derivatives.basederivatives.BaseParameterDerivatives): # noqa: B950 Derivatives object assigned to self.derivatives. params (list[str]): list of strings with parameter nam...
2
null
Implement the Python class `GradBaseModule` described below. Class description: Calculates the gradient. Passes the calls for the parameters to the derivatives class. Implements functions with method names from params. If child class wants to overwrite these methods - for example to support an additional external modu...
Implement the Python class `GradBaseModule` described below. Class description: Calculates the gradient. Passes the calls for the parameters to the derivatives class. Implements functions with method names from params. If child class wants to overwrite these methods - for example to support an additional external modu...
1ebfb4055be72ed9e0f9d101d78806bd4119645e
<|skeleton|> class GradBaseModule: """Calculates the gradient. Passes the calls for the parameters to the derivatives class. Implements functions with method names from params. If child class wants to overwrite these methods - for example to support an additional external module - it can do so using the interface f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GradBaseModule: """Calculates the gradient. Passes the calls for the parameters to the derivatives class. Implements functions with method names from params. If child class wants to overwrite these methods - for example to support an additional external module - it can do so using the interface for parameter ...
the_stack_v2_python_sparse
backpack/extensions/firstorder/gradient/base.py
f-dangel/backpack
train
505
3547327a987b356285be5ebc56c271bfa6fff12b
[ "Stream.Stream_Energy.__init__(self, initScript)\nself.CreatePort(SIG, SIG_PORT)\nself.GetPort(SIG_PORT).SetSignalType(ENERGY_VAR)", "sigPort = self.GetPort(SIG_PORT)\ninPort = self.GetPort(IN_PORT)\noutPort = self.GetPort(OUT_PORT)\nsigValue = sigPort.GetValue()\nif sigValue == None:\n sigValue = inPort.GetVa...
<|body_start_0|> Stream.Stream_Energy.__init__(self, initScript) self.CreatePort(SIG, SIG_PORT) self.GetPort(SIG_PORT).SetSignalType(ENERGY_VAR) <|end_body_0|> <|body_start_1|> sigPort = self.GetPort(SIG_PORT) inPort = self.GetPort(IN_PORT) outPort = self.GetPort(OUT_POR...
Class for the sensor. Inherits from Stream_Energy provides a signal port for reporting a energy value, but can also use that signal to 'calculate' the energy
EnergySensor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnergySensor: """Class for the sensor. Inherits from Stream_Energy provides a signal port for reporting a energy value, but can also use that signal to 'calculate' the energy""" def __init__(self, initScript=None): """Init the sensor Init Info: varType = GENERIC_VAR""" <|body...
stack_v2_sparse_classes_36k_train_006152
3,056
no_license
[ { "docstring": "Init the sensor Init Info: varType = GENERIC_VAR", "name": "__init__", "signature": "def __init__(self, initScript=None)" }, { "docstring": "Solve", "name": "Solve", "signature": "def Solve(self)" } ]
2
stack_v2_sparse_classes_30k_train_000189
Implement the Python class `EnergySensor` described below. Class description: Class for the sensor. Inherits from Stream_Energy provides a signal port for reporting a energy value, but can also use that signal to 'calculate' the energy Method signatures and docstrings: - def __init__(self, initScript=None): Init the ...
Implement the Python class `EnergySensor` described below. Class description: Class for the sensor. Inherits from Stream_Energy provides a signal port for reporting a energy value, but can also use that signal to 'calculate' the energy Method signatures and docstrings: - def __init__(self, initScript=None): Init the ...
8fb4c90180dc96be66f7ca05a30e59a8735fc072
<|skeleton|> class EnergySensor: """Class for the sensor. Inherits from Stream_Energy provides a signal port for reporting a energy value, but can also use that signal to 'calculate' the energy""" def __init__(self, initScript=None): """Init the sensor Init Info: varType = GENERIC_VAR""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnergySensor: """Class for the sensor. Inherits from Stream_Energy provides a signal port for reporting a energy value, but can also use that signal to 'calculate' the energy""" def __init__(self, initScript=None): """Init the sensor Init Info: varType = GENERIC_VAR""" Stream.Stream_Energ...
the_stack_v2_python_sparse
sim/unitop/Sensor.py
psy007/NNPC-CHEMICAL-SIM-
train
1
afcfa1cbc68632c2acc0fafe0c1427319653fd69
[ "passports = parse(filename)\nvalid_passports = [passport for passport in passports if is_valid_passport1(passport)]\nreturn len(valid_passports)", "passports = parse(filename)\nvalid_passports = [passport for passport in passports if is_valid_passport2(passport)]\nreturn len(valid_passports)" ]
<|body_start_0|> passports = parse(filename) valid_passports = [passport for passport in passports if is_valid_passport1(passport)] return len(valid_passports) <|end_body_0|> <|body_start_1|> passports = parse(filename) valid_passports = [passport for passport in passports if is...
AoC 2020 Day 04
Day04
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Day04: """AoC 2020 Day 04""" def part1(filename: str) -> int: """Given a filename, solve 2020 day 04 part 1""" <|body_0|> def part2(filename: str) -> int: """Given a filename, solve 2020 day 04 part 2""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_006153
2,461
no_license
[ { "docstring": "Given a filename, solve 2020 day 04 part 1", "name": "part1", "signature": "def part1(filename: str) -> int" }, { "docstring": "Given a filename, solve 2020 day 04 part 2", "name": "part2", "signature": "def part2(filename: str) -> int" } ]
2
stack_v2_sparse_classes_30k_train_002005
Implement the Python class `Day04` described below. Class description: AoC 2020 Day 04 Method signatures and docstrings: - def part1(filename: str) -> int: Given a filename, solve 2020 day 04 part 1 - def part2(filename: str) -> int: Given a filename, solve 2020 day 04 part 2
Implement the Python class `Day04` described below. Class description: AoC 2020 Day 04 Method signatures and docstrings: - def part1(filename: str) -> int: Given a filename, solve 2020 day 04 part 1 - def part2(filename: str) -> int: Given a filename, solve 2020 day 04 part 2 <|skeleton|> class Day04: """AoC 202...
e89db235837d2d05848210a18c9c2a4456085570
<|skeleton|> class Day04: """AoC 2020 Day 04""" def part1(filename: str) -> int: """Given a filename, solve 2020 day 04 part 1""" <|body_0|> def part2(filename: str) -> int: """Given a filename, solve 2020 day 04 part 2""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Day04: """AoC 2020 Day 04""" def part1(filename: str) -> int: """Given a filename, solve 2020 day 04 part 1""" passports = parse(filename) valid_passports = [passport for passport in passports if is_valid_passport1(passport)] return len(valid_passports) def part2(file...
the_stack_v2_python_sparse
2020/python2020/aoc/day04.py
mreishus/aoc
train
16
bdf3e276085636e30406ca017a1167ca99be5cdc
[ "super().__init__()\nself.input_channels = input_channels\nself.output_channels = output_channels\nself.data_layout = data_layout\nGraphConv.global_count += 1\nself.name = name if name else 'Graph_{}'.format(GraphConv.global_count)\nvalue = math.sqrt(6 / (input_channels + output_channels))\nself.mat_weights = lbann...
<|body_start_0|> super().__init__() self.input_channels = input_channels self.output_channels = output_channels self.data_layout = data_layout GraphConv.global_count += 1 self.name = name if name else 'Graph_{}'.format(GraphConv.global_count) value = math.sqrt(6 /...
Graph Conv layer. See: https://arxiv.org/abs/1609.02907
GraphConv
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GraphConv: """Graph Conv layer. See: https://arxiv.org/abs/1609.02907""" def __init__(self, input_channels, output_channels, bias=True, activation=lbann.Relu, name=None, data_layout='data_parallel'): """Initialize Graph layer Args: input_channels (int): The size of the input node fea...
stack_v2_sparse_classes_36k_train_006154
5,326
permissive
[ { "docstring": "Initialize Graph layer Args: input_channels (int): The size of the input node features output_channels (int): The output size of the node features bias (bool): Whether to apply biases after MatMul name (str): Default name of the layer is GCN_{number} data_layout (str): Data layout activation (ty...
2
stack_v2_sparse_classes_30k_train_000239
Implement the Python class `GraphConv` described below. Class description: Graph Conv layer. See: https://arxiv.org/abs/1609.02907 Method signatures and docstrings: - def __init__(self, input_channels, output_channels, bias=True, activation=lbann.Relu, name=None, data_layout='data_parallel'): Initialize Graph layer A...
Implement the Python class `GraphConv` described below. Class description: Graph Conv layer. See: https://arxiv.org/abs/1609.02907 Method signatures and docstrings: - def __init__(self, input_channels, output_channels, bias=True, activation=lbann.Relu, name=None, data_layout='data_parallel'): Initialize Graph layer A...
57116ecc030c0d17bc941f81131c1a335bc2c4ad
<|skeleton|> class GraphConv: """Graph Conv layer. See: https://arxiv.org/abs/1609.02907""" def __init__(self, input_channels, output_channels, bias=True, activation=lbann.Relu, name=None, data_layout='data_parallel'): """Initialize Graph layer Args: input_channels (int): The size of the input node fea...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GraphConv: """Graph Conv layer. See: https://arxiv.org/abs/1609.02907""" def __init__(self, input_channels, output_channels, bias=True, activation=lbann.Relu, name=None, data_layout='data_parallel'): """Initialize Graph layer Args: input_channels (int): The size of the input node features output_...
the_stack_v2_python_sparse
python/lbann/modules/graph/sparse/GraphConv.py
oyamay/lbann
train
0
555c8a6f8091c7e47c2c87f6762c78fae3129f34
[ "super().__init__()\nself.up_conv = nn.ConvTranspose2d(in_channels, out_channels // 2, kernel_size=2, stride=2)\nself.bn1 = nn.BatchNorm2d(out_channels // 2)\nself.dropout = nn.Dropout2d(dropout_prob) if dropout_prob > 0.0 else None\nself.dropout2 = nn.Dropout2d(0.5)\nself.act_function1 = act(inplace=True)\nself.ac...
<|body_start_0|> super().__init__() self.up_conv = nn.ConvTranspose2d(in_channels, out_channels // 2, kernel_size=2, stride=2) self.bn1 = nn.BatchNorm2d(out_channels // 2) self.dropout = nn.Dropout2d(dropout_prob) if dropout_prob > 0.0 else None self.dropout2 = nn.Dropout2d(0.5) ...
Up Transition Block.
UpTransition
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpTransition: """Up Transition Block.""" def __init__(self, in_channels: int, out_channels: int, convs: int, act: nn.Module=nn.ELU, dropout_prob: float=0.0): """Parameters ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. convs : int...
stack_v2_sparse_classes_36k_train_006155
8,968
permissive
[ { "docstring": "Parameters ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. convs : int Number of LUConv layers. act : nn.Module Activation function. dropout_prob : float Dropout probability.", "name": "__init__", "signature": "def __init__(self, in_ch...
2
stack_v2_sparse_classes_30k_train_020303
Implement the Python class `UpTransition` described below. Class description: Up Transition Block. Method signatures and docstrings: - def __init__(self, in_channels: int, out_channels: int, convs: int, act: nn.Module=nn.ELU, dropout_prob: float=0.0): Parameters ---------- in_channels : int Number of input channels. ...
Implement the Python class `UpTransition` described below. Class description: Up Transition Block. Method signatures and docstrings: - def __init__(self, in_channels: int, out_channels: int, convs: int, act: nn.Module=nn.ELU, dropout_prob: float=0.0): Parameters ---------- in_channels : int Number of input channels. ...
6d15dd55ca5ed6fc9fbfd31d8488ee7bab453066
<|skeleton|> class UpTransition: """Up Transition Block.""" def __init__(self, in_channels: int, out_channels: int, convs: int, act: nn.Module=nn.ELU, dropout_prob: float=0.0): """Parameters ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. convs : int...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpTransition: """Up Transition Block.""" def __init__(self, in_channels: int, out_channels: int, convs: int, act: nn.Module=nn.ELU, dropout_prob: float=0.0): """Parameters ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. convs : int Number of LU...
the_stack_v2_python_sparse
mridc/collections/segmentation/models/vnet_base/vnet_block.py
wdika/mridc
train
40
505999933a931ff59a7e1dfa82ecd7e3396a79d7
[ "super(RelativisticAdvLoss, self).__init__()\nself.mode = mode\nself.device = device\nself.BCEloss = nn.BCEWithLogitsLoss().to(device)", "mean_fake = torch.mean(fake_dis, dim=0, keepdim=True)\nmean_real = torch.mean(real_dis, dim=0, keepdim=True)\nD_real = real_dis - mean_fake\nD_fake = fake_dis - mean_real\nzero...
<|body_start_0|> super(RelativisticAdvLoss, self).__init__() self.mode = mode self.device = device self.BCEloss = nn.BCEWithLogitsLoss().to(device) <|end_body_0|> <|body_start_1|> mean_fake = torch.mean(fake_dis, dim=0, keepdim=True) mean_real = torch.mean(real_dis, dim=...
RelativisticAdvLoss
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelativisticAdvLoss: def __init__(self, mode, device): """:param mode: mode to compute adversarial loss: bce or l1 :param device: device""" <|body_0|> def forward(self, fake_dis, real_dis, model): """:param fake_dis: predicted image from generator output :param real_...
stack_v2_sparse_classes_36k_train_006156
7,116
no_license
[ { "docstring": ":param mode: mode to compute adversarial loss: bce or l1 :param device: device", "name": "__init__", "signature": "def __init__(self, mode, device)" }, { "docstring": ":param fake_dis: predicted image from generator output :param real_dis: real image :param model: generator or di...
2
stack_v2_sparse_classes_30k_train_011480
Implement the Python class `RelativisticAdvLoss` described below. Class description: Implement the RelativisticAdvLoss class. Method signatures and docstrings: - def __init__(self, mode, device): :param mode: mode to compute adversarial loss: bce or l1 :param device: device - def forward(self, fake_dis, real_dis, mod...
Implement the Python class `RelativisticAdvLoss` described below. Class description: Implement the RelativisticAdvLoss class. Method signatures and docstrings: - def __init__(self, mode, device): :param mode: mode to compute adversarial loss: bce or l1 :param device: device - def forward(self, fake_dis, real_dis, mod...
eb9325edb73208ea992eda4be2a92119be867d10
<|skeleton|> class RelativisticAdvLoss: def __init__(self, mode, device): """:param mode: mode to compute adversarial loss: bce or l1 :param device: device""" <|body_0|> def forward(self, fake_dis, real_dis, model): """:param fake_dis: predicted image from generator output :param real_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RelativisticAdvLoss: def __init__(self, mode, device): """:param mode: mode to compute adversarial loss: bce or l1 :param device: device""" super(RelativisticAdvLoss, self).__init__() self.mode = mode self.device = device self.BCEloss = nn.BCEWithLogitsLoss().to(device)...
the_stack_v2_python_sparse
base_model/base_losses/base_losses.py
Oorgien/Scene-Inpainting
train
1
2305f2f0d959554ce14adc6c6bf39e80efc65800
[ "if not root:\n return 0\nif not root.left and (not root.right):\n return 1\nif not root.left:\n return 1 + self.minDepthRecursive(root.right)\nif not root.right:\n return 1 + self.minDepthRecursive(root.left)\nreturn 1 + min(self.minDepthRecursive(root.left), self.minDepthRecursive(root.right))", "if...
<|body_start_0|> if not root: return 0 if not root.left and (not root.right): return 1 if not root.left: return 1 + self.minDepthRecursive(root.right) if not root.right: return 1 + self.minDepthRecursive(root.left) return 1 + min(se...
MinimumDepthOfBinaryTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MinimumDepthOfBinaryTree: def minDepthRecursive(self, root: TreeNode) -> int: """Recursive solution. Check all cases below, this is different from max depth of binary tree question 1. Base case: Leaf node. Return 1, because height of node is 1 2. Left subtree is null (right subtree is no...
stack_v2_sparse_classes_36k_train_006157
6,761
no_license
[ { "docstring": "Recursive solution. Check all cases below, this is different from max depth of binary tree question 1. Base case: Leaf node. Return 1, because height of node is 1 2. Left subtree is null (right subtree is non-null) 3. Right subtree is null (left subtree is non-null) 4. Left and Right subtree are...
2
null
Implement the Python class `MinimumDepthOfBinaryTree` described below. Class description: Implement the MinimumDepthOfBinaryTree class. Method signatures and docstrings: - def minDepthRecursive(self, root: TreeNode) -> int: Recursive solution. Check all cases below, this is different from max depth of binary tree que...
Implement the Python class `MinimumDepthOfBinaryTree` described below. Class description: Implement the MinimumDepthOfBinaryTree class. Method signatures and docstrings: - def minDepthRecursive(self, root: TreeNode) -> int: Recursive solution. Check all cases below, this is different from max depth of binary tree que...
33184f22ac6346f8734d4fcb98f4b52cf157931e
<|skeleton|> class MinimumDepthOfBinaryTree: def minDepthRecursive(self, root: TreeNode) -> int: """Recursive solution. Check all cases below, this is different from max depth of binary tree question 1. Base case: Leaf node. Return 1, because height of node is 1 2. Left subtree is null (right subtree is no...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MinimumDepthOfBinaryTree: def minDepthRecursive(self, root: TreeNode) -> int: """Recursive solution. Check all cases below, this is different from max depth of binary tree question 1. Base case: Leaf node. Return 1, because height of node is 1 2. Left subtree is null (right subtree is non-null) 3. Rig...
the_stack_v2_python_sparse
DataStructures/TreesGraphs/MinimumDepthOfBinaryTree/MinimumDepthOfBinaryTree.py
cagriozcaglar/ProgrammingExamples
train
0
3f590307c4e50d1541efba93db3325a8e347bd33
[ "self.instance_keypair = self.os_conn.create_key(key_name='instancekey')\nzone = self.os_conn.nova.availability_zones.find(zoneName='nova')\nhost = zone.hosts.keys()[0]\nself.setup_rules_for_default_sec_group()\nnet, subnet = self.create_internal_network_with_subnet()\nself.os_conn.create_server(name='server01', av...
<|body_start_0|> self.instance_keypair = self.os_conn.create_key(key_name='instancekey') zone = self.os_conn.nova.availability_zones.find(zoneName='nova') host = zone.hosts.keys()[0] self.setup_rules_for_default_sec_group() net, subnet = self.create_internal_network_with_subnet()...
Check restarts of openvswitch-agents.
TestOVSRestartTwoVmsOnSingleCompute
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestOVSRestartTwoVmsOnSingleCompute: """Check restarts of openvswitch-agents.""" def _prepare_openstack(self): """Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create networks net01: net01__subnet, 192.168.1.0/24 3. Launch vm1 and vm2 in net01 network...
stack_v2_sparse_classes_36k_train_006158
41,546
no_license
[ { "docstring": "Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create networks net01: net01__subnet, 192.168.1.0/24 3. Launch vm1 and vm2 in net01 network on a single compute compute 4. Go to vm1 console and send pings to vm2", "name": "_prepare_openstack", "signature": "...
2
stack_v2_sparse_classes_30k_train_020602
Implement the Python class `TestOVSRestartTwoVmsOnSingleCompute` described below. Class description: Check restarts of openvswitch-agents. Method signatures and docstrings: - def _prepare_openstack(self): Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create networks net01: net01__subn...
Implement the Python class `TestOVSRestartTwoVmsOnSingleCompute` described below. Class description: Check restarts of openvswitch-agents. Method signatures and docstrings: - def _prepare_openstack(self): Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create networks net01: net01__subn...
8aced2855b78b5f123195d188c80e27b43888a2e
<|skeleton|> class TestOVSRestartTwoVmsOnSingleCompute: """Check restarts of openvswitch-agents.""" def _prepare_openstack(self): """Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create networks net01: net01__subnet, 192.168.1.0/24 3. Launch vm1 and vm2 in net01 network...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestOVSRestartTwoVmsOnSingleCompute: """Check restarts of openvswitch-agents.""" def _prepare_openstack(self): """Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create networks net01: net01__subnet, 192.168.1.0/24 3. Launch vm1 and vm2 in net01 network on a single ...
the_stack_v2_python_sparse
mos_tests/neutron/python_tests/test_ovs_restart.py
Mirantis/mos-integration-tests
train
16
011bc5956b1e9ec88ee3aa2f277415a06ff1e2ad
[ "user = User.objects.get(email=email)\nsalt = sha1(str(random.random())).hexdigest()[:5]\nkey = sha1(salt + user.username).hexdigest()\nResetPassword.objects.create(user=user, activation_key=key)\nurl = '{}{}'.format('tandlr://', key)\nurl_web = '{}{}/{}'.format(settings.FRONTEND_RECOVERY_PASSWORD_URL, key, user.em...
<|body_start_0|> user = User.objects.get(email=email) salt = sha1(str(random.random())).hexdigest()[:5] key = sha1(salt + user.username).hexdigest() ResetPassword.objects.create(user=user, activation_key=key) url = '{}{}'.format('tandlr://', key) url_web = '{}{}/{}'.forma...
ActivationKeysManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActivationKeysManager: def reset_user_password(self, email, request=None): """Custom reset password""" <|body_0|> def activation_user(self, user, request=None): """Custom activation user""" <|body_1|> <|end_skeleton|> <|body_start_0|> user = User.ob...
stack_v2_sparse_classes_36k_train_006159
5,482
permissive
[ { "docstring": "Custom reset password", "name": "reset_user_password", "signature": "def reset_user_password(self, email, request=None)" }, { "docstring": "Custom activation user", "name": "activation_user", "signature": "def activation_user(self, user, request=None)" } ]
2
null
Implement the Python class `ActivationKeysManager` described below. Class description: Implement the ActivationKeysManager class. Method signatures and docstrings: - def reset_user_password(self, email, request=None): Custom reset password - def activation_user(self, user, request=None): Custom activation user
Implement the Python class `ActivationKeysManager` described below. Class description: Implement the ActivationKeysManager class. Method signatures and docstrings: - def reset_user_password(self, email, request=None): Custom reset password - def activation_user(self, user, request=None): Custom activation user <|ske...
7349ce18f56658d67daedf5e1abb352b5c15a029
<|skeleton|> class ActivationKeysManager: def reset_user_password(self, email, request=None): """Custom reset password""" <|body_0|> def activation_user(self, user, request=None): """Custom activation user""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ActivationKeysManager: def reset_user_password(self, email, request=None): """Custom reset password""" user = User.objects.get(email=email) salt = sha1(str(random.random())).hexdigest()[:5] key = sha1(salt + user.username).hexdigest() ResetPassword.objects.create(user=u...
the_stack_v2_python_sparse
src/tandlr/registration/models.py
shrmoud/schoolapp
train
0
df859ad61ad861d19bf9e8343c4ecc8ea4d1f5b8
[ "if endWord not in wordList:\n return 0\nqueue = deque([(beginWord, 1)])\nvisted = set([beginWord])\nchars = [chr(ord('a') + i) for i in range(26)]\nwhile queue:\n word, step = queue.popleft()\n if word == endWord:\n return step\n for i in range(len(word)):\n for c in chars:\n n...
<|body_start_0|> if endWord not in wordList: return 0 queue = deque([(beginWord, 1)]) visted = set([beginWord]) chars = [chr(ord('a') + i) for i in range(26)] while queue: word, step = queue.popleft() if word == endWord: return ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def ladderLength(self, beginWord, endWord, wordList): """:type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int Time Limit Exceeded""" <|body_0|> def ladderLength1(self, beginWord, endWord, wordList): """:type beginWord: str :type end...
stack_v2_sparse_classes_36k_train_006160
2,378
no_license
[ { "docstring": ":type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int Time Limit Exceeded", "name": "ladderLength", "signature": "def ladderLength(self, beginWord, endWord, wordList)" }, { "docstring": ":type beginWord: str :type endWord: str :type wordList: List[str] :rt...
2
stack_v2_sparse_classes_30k_train_007609
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def ladderLength(self, beginWord, endWord, wordList): :type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int Time Limit Exceeded - def ladderLength1(self, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def ladderLength(self, beginWord, endWord, wordList): :type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int Time Limit Exceeded - def ladderLength1(self, ...
bad06f681d8d3f2b841cb3c8a969198b8643f864
<|skeleton|> class Solution: def ladderLength(self, beginWord, endWord, wordList): """:type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int Time Limit Exceeded""" <|body_0|> def ladderLength1(self, beginWord, endWord, wordList): """:type beginWord: str :type end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def ladderLength(self, beginWord, endWord, wordList): """:type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int Time Limit Exceeded""" if endWord not in wordList: return 0 queue = deque([(beginWord, 1)]) visted = set([beginWord]) ...
the_stack_v2_python_sparse
127_word_ladder.py
subicWang/leetcode_aotang
train
0
da1d1184ef77c3d4f4f8389cdd4213f0d1aaac29
[ "self.num_points = num_points\nself.x_values = [0]\nself.y_values = [0]", "while len(self.x_values) < self.num_points:\n x_step = self.get_step()\n y_step = self.get_step()\n if x_step == 0 and y_step == 0:\n continue\n next_x = self.x_values[-1] + x_step\n next_y = self.y_values[-1] + y_ste...
<|body_start_0|> self.num_points = num_points self.x_values = [0] self.y_values = [0] <|end_body_0|> <|body_start_1|> while len(self.x_values) < self.num_points: x_step = self.get_step() y_step = self.get_step() if x_step == 0 and y_step == 0: ...
一个生产随机漫步数据的类
RandomWalk
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomWalk: """一个生产随机漫步数据的类""" def __init__(self, num_points=5000): """初始化随机漫步的属性""" <|body_0|> def fill_walk(self): """计算随机漫步包含的所有点""" <|body_1|> def get_step(self): """获取每次漫步的距离和方向""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_006161
1,452
no_license
[ { "docstring": "初始化随机漫步的属性", "name": "__init__", "signature": "def __init__(self, num_points=5000)" }, { "docstring": "计算随机漫步包含的所有点", "name": "fill_walk", "signature": "def fill_walk(self)" }, { "docstring": "获取每次漫步的距离和方向", "name": "get_step", "signature": "def get_step(s...
3
null
Implement the Python class `RandomWalk` described below. Class description: 一个生产随机漫步数据的类 Method signatures and docstrings: - def __init__(self, num_points=5000): 初始化随机漫步的属性 - def fill_walk(self): 计算随机漫步包含的所有点 - def get_step(self): 获取每次漫步的距离和方向
Implement the Python class `RandomWalk` described below. Class description: 一个生产随机漫步数据的类 Method signatures and docstrings: - def __init__(self, num_points=5000): 初始化随机漫步的属性 - def fill_walk(self): 计算随机漫步包含的所有点 - def get_step(self): 获取每次漫步的距离和方向 <|skeleton|> class RandomWalk: """一个生产随机漫步数据的类""" def __init__(s...
6f91fe5e7cbedcdf4b8f7baa7641fd615b4d6141
<|skeleton|> class RandomWalk: """一个生产随机漫步数据的类""" def __init__(self, num_points=5000): """初始化随机漫步的属性""" <|body_0|> def fill_walk(self): """计算随机漫步包含的所有点""" <|body_1|> def get_step(self): """获取每次漫步的距离和方向""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomWalk: """一个生产随机漫步数据的类""" def __init__(self, num_points=5000): """初始化随机漫步的属性""" self.num_points = num_points self.x_values = [0] self.y_values = [0] def fill_walk(self): """计算随机漫步包含的所有点""" while len(self.x_values) < self.num_points: x_...
the_stack_v2_python_sparse
demos/data-analysis/data_visual_by_generate/random_walk.py
romanticair/python
train
0
e117251e912cd0899dcc123843678db4a2e92211
[ "self.control = control = myEditorAreaWidget(self, parent)\nself._filter = EditorAreaDropFilter(self)\nself.control.installEventFilter(self._filter)\nif sys.platform == 'darwin':\n next_seq = 'Ctrl+}'\n prev_seq = 'Ctrl+{'\nelse:\n next_seq = 'Ctrl+PgDown'\n prev_seq = 'Ctrl+PgUp'\nshortcut = QtGui.QSho...
<|body_start_0|> self.control = control = myEditorAreaWidget(self, parent) self._filter = EditorAreaDropFilter(self) self.control.installEventFilter(self._filter) if sys.platform == 'darwin': next_seq = 'Ctrl+}' prev_seq = 'Ctrl+{' else: next_s...
myAdvancedEditorAreaPane
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class myAdvancedEditorAreaPane: def create(self, parent): """Create and set the toolkit-specific control that represents the pane.""" <|body_0|> def remove_editor(self, editor): """Removes an editor from the pane.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_006162
7,390
permissive
[ { "docstring": "Create and set the toolkit-specific control that represents the pane.", "name": "create", "signature": "def create(self, parent)" }, { "docstring": "Removes an editor from the pane.", "name": "remove_editor", "signature": "def remove_editor(self, editor)" } ]
2
null
Implement the Python class `myAdvancedEditorAreaPane` described below. Class description: Implement the myAdvancedEditorAreaPane class. Method signatures and docstrings: - def create(self, parent): Create and set the toolkit-specific control that represents the pane. - def remove_editor(self, editor): Removes an edit...
Implement the Python class `myAdvancedEditorAreaPane` described below. Class description: Implement the myAdvancedEditorAreaPane class. Method signatures and docstrings: - def create(self, parent): Create and set the toolkit-specific control that represents the pane. - def remove_editor(self, editor): Removes an edit...
8cfc8085393ace2aee6b98d36bfd6fba0bcb41c6
<|skeleton|> class myAdvancedEditorAreaPane: def create(self, parent): """Create and set the toolkit-specific control that represents the pane.""" <|body_0|> def remove_editor(self, editor): """Removes an editor from the pane.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class myAdvancedEditorAreaPane: def create(self, parent): """Create and set the toolkit-specific control that represents the pane.""" self.control = control = myEditorAreaWidget(self, parent) self._filter = EditorAreaDropFilter(self) self.control.installEventFilter(self._filter) ...
the_stack_v2_python_sparse
pychron/envisage/tasks/advanced_editor_area_pane.py
NMGRL/pychron
train
38
a4733ce990067ef7eab4073f308d66952e132018
[ "super(mod_xes, self).__init__(address=address, **kwds)\nself.pickle_dirname = cspad_tbx.getOptString(pickle_dirname)\nself.pickle_basename = cspad_tbx.getOptString(pickle_basename)\nself.roi = cspad_tbx.getOptROI(roi)", "super(mod_xes, self).event(evt, env)\nif evt.get('skip_event'):\n return\nif self.roi is ...
<|body_start_0|> super(mod_xes, self).__init__(address=address, **kwds) self.pickle_dirname = cspad_tbx.getOptString(pickle_dirname) self.pickle_basename = cspad_tbx.getOptString(pickle_basename) self.roi = cspad_tbx.getOptROI(roi) <|end_body_0|> <|body_start_1|> super(mod_xes, ...
Class for generating first- and second-order statistics within the pyana framework XXX Maybe this module should be renamed to mod_stat12, mod_sstat or some such?
mod_xes
[ "BSD-3-Clause", "BSD-3-Clause-LBNL" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class mod_xes: """Class for generating first- and second-order statistics within the pyana framework XXX Maybe this module should be renamed to mod_stat12, mod_sstat or some such?""" def __init__(self, address, pickle_dirname='.', pickle_basename='', roi=None, **kwds): """The mod_average c...
stack_v2_sparse_classes_36k_train_006163
4,349
permissive
[ { "docstring": "The mod_average class constructor stores the parameters passed from the pyana configuration file in instance variables. All parameters, except @p address are optional, and hence need not be defined in pyana.cfg. @param address Full data source address of the DAQ device @param pickle_dirname Dire...
3
null
Implement the Python class `mod_xes` described below. Class description: Class for generating first- and second-order statistics within the pyana framework XXX Maybe this module should be renamed to mod_stat12, mod_sstat or some such? Method signatures and docstrings: - def __init__(self, address, pickle_dirname='.',...
Implement the Python class `mod_xes` described below. Class description: Class for generating first- and second-order statistics within the pyana framework XXX Maybe this module should be renamed to mod_stat12, mod_sstat or some such? Method signatures and docstrings: - def __init__(self, address, pickle_dirname='.',...
77d66c719b5746f37af51ad593e2941ed6fbba17
<|skeleton|> class mod_xes: """Class for generating first- and second-order statistics within the pyana framework XXX Maybe this module should be renamed to mod_stat12, mod_sstat or some such?""" def __init__(self, address, pickle_dirname='.', pickle_basename='', roi=None, **kwds): """The mod_average c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class mod_xes: """Class for generating first- and second-order statistics within the pyana framework XXX Maybe this module should be renamed to mod_stat12, mod_sstat or some such?""" def __init__(self, address, pickle_dirname='.', pickle_basename='', roi=None, **kwds): """The mod_average class construc...
the_stack_v2_python_sparse
modules/cctbx_project/xfel/cxi/cspad_ana/mod_xes.py
jorgediazjr/dials-dev20191018
train
0
b2c8849b114ffbfe4722b43a1884203fb935c767
[ "self._mask_num_classes = num_classes if use_category_for_mask else 1\nself._use_category_for_mask = use_category_for_mask\nself._num_downsample_channels = num_downsample_channels\nself._mask_crop_size = mask_crop_size\nself._num_convs = num_convs\nself._batch_norm_activation = batch_norm_activation", "with tf.va...
<|body_start_0|> self._mask_num_classes = num_classes if use_category_for_mask else 1 self._use_category_for_mask = use_category_for_mask self._num_downsample_channels = num_downsample_channels self._mask_crop_size = mask_crop_size self._num_convs = num_convs self._batch_...
ShapemaskCoarsemaskHead head.
ShapemaskCoarsemaskHead
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShapemaskCoarsemaskHead: """ShapemaskCoarsemaskHead head.""" def __init__(self, num_classes, num_downsample_channels, mask_crop_size, use_category_for_mask, num_convs, batch_norm_activation): """Initialize params to build ShapeMask coarse and fine prediction head. Args: num_classes: ...
stack_v2_sparse_classes_36k_train_006164
46,218
permissive
[ { "docstring": "Initialize params to build ShapeMask coarse and fine prediction head. Args: num_classes: `int` number of mask classification categories. num_downsample_channels: `int` number of filters at mask head. mask_crop_size: feature crop size. use_category_for_mask: use class information in mask branch. ...
3
null
Implement the Python class `ShapemaskCoarsemaskHead` described below. Class description: ShapemaskCoarsemaskHead head. Method signatures and docstrings: - def __init__(self, num_classes, num_downsample_channels, mask_crop_size, use_category_for_mask, num_convs, batch_norm_activation): Initialize params to build Shape...
Implement the Python class `ShapemaskCoarsemaskHead` described below. Class description: ShapemaskCoarsemaskHead head. Method signatures and docstrings: - def __init__(self, num_classes, num_downsample_channels, mask_crop_size, use_category_for_mask, num_convs, batch_norm_activation): Initialize params to build Shape...
0f7adb97a93ec3e3485c261d030c507eb16b33e4
<|skeleton|> class ShapemaskCoarsemaskHead: """ShapemaskCoarsemaskHead head.""" def __init__(self, num_classes, num_downsample_channels, mask_crop_size, use_category_for_mask, num_convs, batch_norm_activation): """Initialize params to build ShapeMask coarse and fine prediction head. Args: num_classes: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShapemaskCoarsemaskHead: """ShapemaskCoarsemaskHead head.""" def __init__(self, num_classes, num_downsample_channels, mask_crop_size, use_category_for_mask, num_convs, batch_norm_activation): """Initialize params to build ShapeMask coarse and fine prediction head. Args: num_classes: `int` number ...
the_stack_v2_python_sparse
models/official/detection/modeling/architecture/heads.py
tensorflow/tpu
train
5,627
c33383580f7ddf7a92122fc8650d60b05dfcbfd6
[ "discrete_space, continuous_space = env.action_space.spaces\nassert isinstance(continuous_space, spaces.Box) or isinstance(continuous_space, spaces.Tuple), 'expected Box or Tuple for continuous action space, got {}'.format(type(continuous_space))\nsuper().__init__(env)\nself.low = np.zeros(continuous_space.shape, d...
<|body_start_0|> discrete_space, continuous_space = env.action_space.spaces assert isinstance(continuous_space, spaces.Box) or isinstance(continuous_space, spaces.Tuple), 'expected Box or Tuple for continuous action space, got {}'.format(type(continuous_space)) super().__init__(env) self...
Rescales the continuous actions of a parameterized action space.
RescaleParameterizedAction
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RescaleParameterizedAction: """Rescales the continuous actions of a parameterized action space.""" def __init__(self, env: Env, low: float, high: float): """Rescales the continuous actions of the parameterized action space to have the low and high given. Args: env: The environment wi...
stack_v2_sparse_classes_36k_train_006165
3,671
permissive
[ { "docstring": "Rescales the continuous actions of the parameterized action space to have the low and high given. Args: env: The environment with the action space to wrap. low: The infinum of the action space. hi gh: The suprenum of the action space.", "name": "__init__", "signature": "def __init__(self...
3
null
Implement the Python class `RescaleParameterizedAction` described below. Class description: Rescales the continuous actions of a parameterized action space. Method signatures and docstrings: - def __init__(self, env: Env, low: float, high: float): Rescales the continuous actions of the parameterized action space to h...
Implement the Python class `RescaleParameterizedAction` described below. Class description: Rescales the continuous actions of a parameterized action space. Method signatures and docstrings: - def __init__(self, env: Env, low: float, high: float): Rescales the continuous actions of the parameterized action space to h...
cde3be1c69bfd76fe4a78fa529e851d0a78318c7
<|skeleton|> class RescaleParameterizedAction: """Rescales the continuous actions of a parameterized action space.""" def __init__(self, env: Env, low: float, high: float): """Rescales the continuous actions of the parameterized action space to have the low and high given. Args: env: The environment wi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RescaleParameterizedAction: """Rescales the continuous actions of a parameterized action space.""" def __init__(self, env: Env, low: float, high: float): """Rescales the continuous actions of the parameterized action space to have the low and high given. Args: env: The environment with the action...
the_stack_v2_python_sparse
hlrl/core/envs/gym/wrappers/rescale_parameterized_action.py
Chainso/HLRL
train
3
0b55c5d84ee26f11cc18460b2254ad0c99c82f28
[ "self.request.errors.add('body', 'data', \"Can't update lot for tender stage2\")\nself.request.errors.status = 403\nreturn", "self.request.errors.add('body', 'data', \"Can't create lot for tender stage2\")\nself.request.errors.status = 403\nreturn", "self.request.errors.add('body', 'data', \"Can't delete lot fo...
<|body_start_0|> self.request.errors.add('body', 'data', "Can't update lot for tender stage2") self.request.errors.status = 403 return <|end_body_0|> <|body_start_1|> self.request.errors.add('body', 'data', "Can't create lot for tender stage2") self.request.errors.status = 403 ...
TenderStage2EULotResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TenderStage2EULotResource: def patch(self): """Update of lot""" <|body_0|> def collection_post(self): """Add a lot""" <|body_1|> def delete(self): """Lot deleting""" <|body_2|> <|end_skeleton|> <|body_start_0|> self.request.erro...
stack_v2_sparse_classes_36k_train_006166
2,757
permissive
[ { "docstring": "Update of lot", "name": "patch", "signature": "def patch(self)" }, { "docstring": "Add a lot", "name": "collection_post", "signature": "def collection_post(self)" }, { "docstring": "Lot deleting", "name": "delete", "signature": "def delete(self)" } ]
3
stack_v2_sparse_classes_30k_train_006203
Implement the Python class `TenderStage2EULotResource` described below. Class description: Implement the TenderStage2EULotResource class. Method signatures and docstrings: - def patch(self): Update of lot - def collection_post(self): Add a lot - def delete(self): Lot deleting
Implement the Python class `TenderStage2EULotResource` described below. Class description: Implement the TenderStage2EULotResource class. Method signatures and docstrings: - def patch(self): Update of lot - def collection_post(self): Add a lot - def delete(self): Lot deleting <|skeleton|> class TenderStage2EULotReso...
fb955c110ceb40ca7b82b11280602145385a017f
<|skeleton|> class TenderStage2EULotResource: def patch(self): """Update of lot""" <|body_0|> def collection_post(self): """Add a lot""" <|body_1|> def delete(self): """Lot deleting""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TenderStage2EULotResource: def patch(self): """Update of lot""" self.request.errors.add('body', 'data', "Can't update lot for tender stage2") self.request.errors.status = 403 return def collection_post(self): """Add a lot""" self.request.errors.add('body', ...
the_stack_v2_python_sparse
openprocurement/tender/competitivedialogue/views/stage2/lot.py
VDigitall/openprocurement.tender.competitivedialogue
train
0
f2e3089fd4f1179f25a16c39cadd49fb3d572b09
[ "assert check_argument_types()\nsuper(StyleTokenLayer, self).__init__()\ngst_embs = paddle.randn(shape=[gst_tokens, gst_token_dim // gst_heads])\nself.gst_embs = paddle.create_parameter(shape=gst_embs.shape, dtype=str(gst_embs.numpy().dtype), default_initializer=paddle.nn.initializer.Assign(gst_embs))\nself.mha = M...
<|body_start_0|> assert check_argument_types() super(StyleTokenLayer, self).__init__() gst_embs = paddle.randn(shape=[gst_tokens, gst_token_dim // gst_heads]) self.gst_embs = paddle.create_parameter(shape=gst_embs.shape, dtype=str(gst_embs.numpy().dtype), default_initializer=paddle.nn.in...
Style token layer module. This module is style token layer introduced in `Style Tokens: Unsupervised Style Modeling, Control and Transfer in End-to-End Speech Synthesis`. .. _`Style Tokens: Unsupervised Style Modeling, Control and Transfer in End-to-End Speech Synthesis`: https://arxiv.org/abs/1803.09017 Parameters ---...
StyleTokenLayer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StyleTokenLayer: """Style token layer module. This module is style token layer introduced in `Style Tokens: Unsupervised Style Modeling, Control and Transfer in End-to-End Speech Synthesis`. .. _`Style Tokens: Unsupervised Style Modeling, Control and Transfer in End-to-End Speech Synthesis`: http...
stack_v2_sparse_classes_36k_train_006167
10,798
permissive
[ { "docstring": "Initilize style token layer module.", "name": "__init__", "signature": "def __init__(self, ref_embed_dim: int=128, gst_tokens: int=10, gst_token_dim: int=256, gst_heads: int=4, dropout_rate: float=0.0)" }, { "docstring": "Calculate forward propagation. Parameters ---------- ref_e...
2
null
Implement the Python class `StyleTokenLayer` described below. Class description: Style token layer module. This module is style token layer introduced in `Style Tokens: Unsupervised Style Modeling, Control and Transfer in End-to-End Speech Synthesis`. .. _`Style Tokens: Unsupervised Style Modeling, Control and Transfe...
Implement the Python class `StyleTokenLayer` described below. Class description: Style token layer module. This module is style token layer introduced in `Style Tokens: Unsupervised Style Modeling, Control and Transfer in End-to-End Speech Synthesis`. .. _`Style Tokens: Unsupervised Style Modeling, Control and Transfe...
8705a2a8405e3c63f2174d69880d2b5525a6c9fd
<|skeleton|> class StyleTokenLayer: """Style token layer module. This module is style token layer introduced in `Style Tokens: Unsupervised Style Modeling, Control and Transfer in End-to-End Speech Synthesis`. .. _`Style Tokens: Unsupervised Style Modeling, Control and Transfer in End-to-End Speech Synthesis`: http...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StyleTokenLayer: """Style token layer module. This module is style token layer introduced in `Style Tokens: Unsupervised Style Modeling, Control and Transfer in End-to-End Speech Synthesis`. .. _`Style Tokens: Unsupervised Style Modeling, Control and Transfer in End-to-End Speech Synthesis`: https://arxiv.org...
the_stack_v2_python_sparse
parakeet/modules/style_encoder.py
PaddlePaddle/Parakeet
train
609
771d0a7fd546cd8ae30a47c296fc62c68c4566ea
[ "categories = Category.objects.all()\ncates = []\nnav_cates = []\nfor category in categories:\n if category.is_nav:\n nav_cates.append(category)\n else:\n cates.append(category)\nreturn {'nav_cates': nav_cates, 'cates': cates}", "sidebars = SideBar.objects.filter(status=1)\nrecently_posts = Po...
<|body_start_0|> categories = Category.objects.all() cates = [] nav_cates = [] for category in categories: if category.is_nav: nav_cates.append(category) else: cates.append(category) return {'nav_cates': nav_cates, 'cates': ...
CommonMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommonMixin: def get_category_context(self): """分类 1、nav_cates = categoryies.filter(is_nav=True) 导航分类 2、cates = categories.filter(is_nav=False) 普通分类 3、Category.objects.all()返回一个queryset对象复制给categories""" <|body_0|> def get_context_data(self, **kwargs): """侧边栏""" ...
stack_v2_sparse_classes_36k_train_006168
5,314
permissive
[ { "docstring": "分类 1、nav_cates = categoryies.filter(is_nav=True) 导航分类 2、cates = categories.filter(is_nav=False) 普通分类 3、Category.objects.all()返回一个queryset对象复制给categories", "name": "get_category_context", "signature": "def get_category_context(self)" }, { "docstring": "侧边栏", "name": "get_conte...
2
stack_v2_sparse_classes_30k_train_017908
Implement the Python class `CommonMixin` described below. Class description: Implement the CommonMixin class. Method signatures and docstrings: - def get_category_context(self): 分类 1、nav_cates = categoryies.filter(is_nav=True) 导航分类 2、cates = categories.filter(is_nav=False) 普通分类 3、Category.objects.all()返回一个queryset对象复...
Implement the Python class `CommonMixin` described below. Class description: Implement the CommonMixin class. Method signatures and docstrings: - def get_category_context(self): 分类 1、nav_cates = categoryies.filter(is_nav=True) 导航分类 2、cates = categories.filter(is_nav=False) 普通分类 3、Category.objects.all()返回一个queryset对象复...
52e74f18d37abc6e937d7cb5c752bc9dfd6ed662
<|skeleton|> class CommonMixin: def get_category_context(self): """分类 1、nav_cates = categoryies.filter(is_nav=True) 导航分类 2、cates = categories.filter(is_nav=False) 普通分类 3、Category.objects.all()返回一个queryset对象复制给categories""" <|body_0|> def get_context_data(self, **kwargs): """侧边栏""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommonMixin: def get_category_context(self): """分类 1、nav_cates = categoryies.filter(is_nav=True) 导航分类 2、cates = categories.filter(is_nav=False) 普通分类 3、Category.objects.all()返回一个queryset对象复制给categories""" categories = Category.objects.all() cates = [] nav_cates = [] for ...
the_stack_v2_python_sparse
Myblog/blog/views.py
Family-TreeSY/Myblog
train
5
2ccc503f8a9efd4aa08f95ef77e3b4988adb1420
[ "comments = CommentsPhotos.query.order_by(asc(CommentsPhotos.PhotoID), asc(CommentsPhotos.Created)).all()\ncontents = jsonify({'comments': [{'commentID': comment.CommentID, 'photoID': comment.PhotoID, 'userID': comment.UserID, 'name': get_username(comment.UserID), 'comment': comment.Comment, 'createdAt': get_iso_fo...
<|body_start_0|> comments = CommentsPhotos.query.order_by(asc(CommentsPhotos.PhotoID), asc(CommentsPhotos.Created)).all() contents = jsonify({'comments': [{'commentID': comment.CommentID, 'photoID': comment.PhotoID, 'userID': comment.UserID, 'name': get_username(comment.UserID), 'comment': comment.Comme...
PhotoCommentsView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PhotoCommentsView: def index(self): """Return all comments for all photos.""" <|body_0|> def get(self, photo_id): """Return the comments for a specific photo.""" <|body_1|> def post(self): """Add a comment to a photo specified in the payload.""" ...
stack_v2_sparse_classes_36k_train_006169
26,847
permissive
[ { "docstring": "Return all comments for all photos.", "name": "index", "signature": "def index(self)" }, { "docstring": "Return the comments for a specific photo.", "name": "get", "signature": "def get(self, photo_id)" }, { "docstring": "Add a comment to a photo specified in the ...
5
stack_v2_sparse_classes_30k_train_019069
Implement the Python class `PhotoCommentsView` described below. Class description: Implement the PhotoCommentsView class. Method signatures and docstrings: - def index(self): Return all comments for all photos. - def get(self, photo_id): Return the comments for a specific photo. - def post(self): Add a comment to a p...
Implement the Python class `PhotoCommentsView` described below. Class description: Implement the PhotoCommentsView class. Method signatures and docstrings: - def index(self): Return all comments for all photos. - def get(self, photo_id): Return the comments for a specific photo. - def post(self): Add a comment to a p...
62f8e8e904e379541193f0cbb91a8434b47f538f
<|skeleton|> class PhotoCommentsView: def index(self): """Return all comments for all photos.""" <|body_0|> def get(self, photo_id): """Return the comments for a specific photo.""" <|body_1|> def post(self): """Add a comment to a photo specified in the payload.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PhotoCommentsView: def index(self): """Return all comments for all photos.""" comments = CommentsPhotos.query.order_by(asc(CommentsPhotos.PhotoID), asc(CommentsPhotos.Created)).all() contents = jsonify({'comments': [{'commentID': comment.CommentID, 'photoID': comment.PhotoID, 'userID':...
the_stack_v2_python_sparse
apps/comments/views.py
Torniojaws/vortech-backend
train
0
d2358f34e298d0542adfe7debf59b270859f0e2c
[ "pos = 1\ncur = k\ncount = k\nwhile pos < n:\n if k % 2 == 0:\n cur = cur // 2\n else:\n cur = cur // 2 + 1\n count += cur\n pos += 1\nreturn count", "l = 1\nr = m\nmid = l + (r - l) // 2\nwhile l <= r:\n v = self.compute(n, mid)\n if v == m:\n return mid\n elif v > m:\n ...
<|body_start_0|> pos = 1 cur = k count = k while pos < n: if k % 2 == 0: cur = cur // 2 else: cur = cur // 2 + 1 count += cur pos += 1 return count <|end_body_0|> <|body_start_1|> l = 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def compute(self, n, k): """第一天吃k块, 至少需要多少块. :param k: :return:""" <|body_0|> def twosplit(self, n, m): """:param n: 天数 :param m: 巧克力数量 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> pos = 1 cur = k count = k ...
stack_v2_sparse_classes_36k_train_006170
914
no_license
[ { "docstring": "第一天吃k块, 至少需要多少块. :param k: :return:", "name": "compute", "signature": "def compute(self, n, k)" }, { "docstring": ":param n: 天数 :param m: 巧克力数量 :return:", "name": "twosplit", "signature": "def twosplit(self, n, m)" } ]
2
stack_v2_sparse_classes_30k_train_015837
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def compute(self, n, k): 第一天吃k块, 至少需要多少块. :param k: :return: - def twosplit(self, n, m): :param n: 天数 :param m: 巧克力数量 :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def compute(self, n, k): 第一天吃k块, 至少需要多少块. :param k: :return: - def twosplit(self, n, m): :param n: 天数 :param m: 巧克力数量 :return: <|skeleton|> class Solution: def compute(self...
4e03eee4558800e6e23504840401bb0544fac752
<|skeleton|> class Solution: def compute(self, n, k): """第一天吃k块, 至少需要多少块. :param k: :return:""" <|body_0|> def twosplit(self, n, m): """:param n: 天数 :param m: 巧克力数量 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def compute(self, n, k): """第一天吃k块, 至少需要多少块. :param k: :return:""" pos = 1 cur = k count = k while pos < n: if k % 2 == 0: cur = cur // 2 else: cur = cur // 2 + 1 count += cur pos ...
the_stack_v2_python_sparse
leetcode_ex/ex贪吃的小q.py
LNZ001/Analysis-of-algorithm-exercises
train
0
87d52fce0c5028d4b402759a700e64d54da1b79c
[ "self.gyx = 0\nself.gyy = 0\nself.gyz = 0\nself.acx = 0\nself.acy = 0\nself.acz = 0\nself.prs = 0\nself.temp = 0\nself.arduino = arduino", "dicioDeDados = self.arduino.dicioDeDados\nif 'acx' in dicioDeDados:\n self.acx = dicioDeDados['acx']\nif 'acy' in dicioDeDados:\n self.acy = dicioDeDados['acy']\nif 'ac...
<|body_start_0|> self.gyx = 0 self.gyy = 0 self.gyz = 0 self.acx = 0 self.acy = 0 self.acz = 0 self.prs = 0 self.temp = 0 self.arduino = arduino <|end_body_0|> <|body_start_1|> dicioDeDados = self.arduino.dicioDeDados if 'acx' in d...
Um objeto dessa classe deve ser criado quando quiser realizar a comunicação ou obter dados da MPU (Acelerômetro e Giroscópio). Para utilizar a classe, criamos o construtor colocando como parâmetros se queremos pegar os parâmetros. Depois, utilizamos a função atualiza() para fazer a aquisição pelo I2C. Por fim, acessa o...
IMU
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IMU: """Um objeto dessa classe deve ser criado quando quiser realizar a comunicação ou obter dados da MPU (Acelerômetro e Giroscópio). Para utilizar a classe, criamos o construtor colocando como parâmetros se queremos pegar os parâmetros. Depois, utilizamos a função atualiza() para fazer a aquisi...
stack_v2_sparse_classes_36k_train_006171
1,618
permissive
[ { "docstring": "Inicializa a classe com os parâmetros setados para adquirir e realiza configurações para aquisição do I2C.", "name": "__init__", "signature": "def __init__(self, arduino)" }, { "docstring": "Le valor analogico do ADC e transforma isso em pressão e velocidade. Todas as variaveis s...
2
stack_v2_sparse_classes_30k_train_007642
Implement the Python class `IMU` described below. Class description: Um objeto dessa classe deve ser criado quando quiser realizar a comunicação ou obter dados da MPU (Acelerômetro e Giroscópio). Para utilizar a classe, criamos o construtor colocando como parâmetros se queremos pegar os parâmetros. Depois, utilizamos ...
Implement the Python class `IMU` described below. Class description: Um objeto dessa classe deve ser criado quando quiser realizar a comunicação ou obter dados da MPU (Acelerômetro e Giroscópio). Para utilizar a classe, criamos o construtor colocando como parâmetros se queremos pegar os parâmetros. Depois, utilizamos ...
28162dab4b115232442a331dbdeacd13c0b1abc2
<|skeleton|> class IMU: """Um objeto dessa classe deve ser criado quando quiser realizar a comunicação ou obter dados da MPU (Acelerômetro e Giroscópio). Para utilizar a classe, criamos o construtor colocando como parâmetros se queremos pegar os parâmetros. Depois, utilizamos a função atualiza() para fazer a aquisi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IMU: """Um objeto dessa classe deve ser criado quando quiser realizar a comunicação ou obter dados da MPU (Acelerômetro e Giroscópio). Para utilizar a classe, criamos o construtor colocando como parâmetros se queremos pegar os parâmetros. Depois, utilizamos a função atualiza() para fazer a aquisição pelo I2C....
the_stack_v2_python_sparse
code/libs/sensors/imu.py
solkan1201/Vivace
train
0
d9b0202788216d0a3536f3d80b470c2da58c54d5
[ "self.settings = tools.getSettingsObject()\nlastBackup = int(self.settings['System']['Backup']['lastBackup'])\nnow = int(tools.makeDateStamp())\nself.doBackup()\nprojConf = tools.getProjectSettingsObject()\nprojConf['System']['Backup']['lastBackup'] = now\nprojConf.write()\nself.settings['System']['Backup']['lastBa...
<|body_start_0|> self.settings = tools.getSettingsObject() lastBackup = int(self.settings['System']['Backup']['lastBackup']) now = int(tools.makeDateStamp()) self.doBackup() projConf = tools.getProjectSettingsObject() projConf['System']['Backup']['lastBackup'] = now ...
BackupProject
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BackupProject: def main(self): """Here we will manage the backup process.""" <|body_0|> def doBackup(self): """This is the main backup process.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.settings = tools.getSettingsObject() lastBac...
stack_v2_sparse_classes_36k_train_006172
2,572
no_license
[ { "docstring": "Here we will manage the backup process.", "name": "main", "signature": "def main(self)" }, { "docstring": "This is the main backup process.", "name": "doBackup", "signature": "def doBackup(self)" } ]
2
null
Implement the Python class `BackupProject` described below. Class description: Implement the BackupProject class. Method signatures and docstrings: - def main(self): Here we will manage the backup process. - def doBackup(self): This is the main backup process.
Implement the Python class `BackupProject` described below. Class description: Implement the BackupProject class. Method signatures and docstrings: - def main(self): Here we will manage the backup process. - def doBackup(self): This is the main backup process. <|skeleton|> class BackupProject: def main(self): ...
315e2e7544e2001404b8d7dbfdd1ffbee5e389f8
<|skeleton|> class BackupProject: def main(self): """Here we will manage the backup process.""" <|body_0|> def doBackup(self): """This is the main backup process.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BackupProject: def main(self): """Here we will manage the backup process.""" self.settings = tools.getSettingsObject() lastBackup = int(self.settings['System']['Backup']['lastBackup']) now = int(tools.makeDateStamp()) self.doBackup() projConf = tools.getProjectS...
the_stack_v2_python_sparse
bin/python/lib_system/backup_project.py
sillsdevarchive/ptxplus
train
0
17cac3f29858b7edb8053fab35a6f5e04545cc6f
[ "if verbose:\n print('SQL Database type %s verbose=%s' % (db_dict, verbose))\nsuper(SQLLastScanTable, self).__init__(db_dict, dbtype, verbose)\nself.connection = None", "try:\n print('database characteristics')\n for key in self.db_dict:\n print('%s: %s' % (key, self.db_dict[key]))\nexcept ValueE...
<|body_start_0|> if verbose: print('SQL Database type %s verbose=%s' % (db_dict, verbose)) super(SQLLastScanTable, self).__init__(db_dict, dbtype, verbose) self.connection = None <|end_body_0|> <|body_start_1|> try: print('database characteristics') ...
SQL table for Last scan
SQLLastScanTable
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SQLLastScanTable: """SQL table for Last scan""" def __init__(self, db_dict, dbtype, verbose): """Pass through to SQL""" <|body_0|> def db_info(self): """Display the db info and Return info on the database used as a dictionary.""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k_train_006173
6,482
permissive
[ { "docstring": "Pass through to SQL", "name": "__init__", "signature": "def __init__(self, db_dict, dbtype, verbose)" }, { "docstring": "Display the db info and Return info on the database used as a dictionary.", "name": "db_info", "signature": "def db_info(self)" } ]
2
stack_v2_sparse_classes_30k_train_017763
Implement the Python class `SQLLastScanTable` described below. Class description: SQL table for Last scan Method signatures and docstrings: - def __init__(self, db_dict, dbtype, verbose): Pass through to SQL - def db_info(self): Display the db info and Return info on the database used as a dictionary.
Implement the Python class `SQLLastScanTable` described below. Class description: SQL table for Last scan Method signatures and docstrings: - def __init__(self, db_dict, dbtype, verbose): Pass through to SQL - def db_info(self): Display the db info and Return info on the database used as a dictionary. <|skeleton|> c...
9c60b3489f02592bd9099b8719ca23ae43a9eaa5
<|skeleton|> class SQLLastScanTable: """SQL table for Last scan""" def __init__(self, db_dict, dbtype, verbose): """Pass through to SQL""" <|body_0|> def db_info(self): """Display the db info and Return info on the database used as a dictionary.""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SQLLastScanTable: """SQL table for Last scan""" def __init__(self, db_dict, dbtype, verbose): """Pass through to SQL""" if verbose: print('SQL Database type %s verbose=%s' % (db_dict, verbose)) super(SQLLastScanTable, self).__init__(db_dict, dbtype, verbose) s...
the_stack_v2_python_sparse
smipyping/_lastscantable.py
KSchopmeyer/smipyping
train
0
34045d5cf713f009d944664c24c7d912d94e9354
[ "self.inputs = []\nself.outputs = []\nself.pos = pos\nself.new_w = None\nself.new_b = None\nself.extra_attr = None\nself.klayer = klayer\nif klayer is None:\n return\nself.name = prefix + klayer.name + postfix\nself.type = helper.getKerasLayerType(self.klayer)\nif hasattr(klayer, 'data_format'):\n if helper.d...
<|body_start_0|> self.inputs = [] self.outputs = [] self.pos = pos self.new_w = None self.new_b = None self.extra_attr = None self.klayer = klayer if klayer is None: return self.name = prefix + klayer.name + postfix self.type = ...
Intermedia structure for model graph
TreeNode
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TreeNode: """Intermedia structure for model graph""" def __init__(self, klayer=None, prefix='', postfix='', pos=0): """Initialize a tree node object # Arguments: klayer: The layer defined in keras. prefix: The prefix inherited from the parent layer. No prefix by default. postfix: Usu...
stack_v2_sparse_classes_36k_train_006174
3,764
permissive
[ { "docstring": "Initialize a tree node object # Arguments: klayer: The layer defined in keras. prefix: The prefix inherited from the parent layer. No prefix by default. postfix: Usually the position name of the node for the shared layer. pos: The position of the current node among all duplicated shared layers."...
6
stack_v2_sparse_classes_30k_train_004984
Implement the Python class `TreeNode` described below. Class description: Intermedia structure for model graph Method signatures and docstrings: - def __init__(self, klayer=None, prefix='', postfix='', pos=0): Initialize a tree node object # Arguments: klayer: The layer defined in keras. prefix: The prefix inherited ...
Implement the Python class `TreeNode` described below. Class description: Intermedia structure for model graph Method signatures and docstrings: - def __init__(self, klayer=None, prefix='', postfix='', pos=0): Initialize a tree node object # Arguments: klayer: The layer defined in keras. prefix: The prefix inherited ...
7ba4fe3fd9f606d39cf61b46080c3dc244dfe207
<|skeleton|> class TreeNode: """Intermedia structure for model graph""" def __init__(self, klayer=None, prefix='', postfix='', pos=0): """Initialize a tree node object # Arguments: klayer: The layer defined in keras. prefix: The prefix inherited from the parent layer. No prefix by default. postfix: Usu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TreeNode: """Intermedia structure for model graph""" def __init__(self, klayer=None, prefix='', postfix='', pos=0): """Initialize a tree node object # Arguments: klayer: The layer defined in keras. prefix: The prefix inherited from the parent layer. No prefix by default. postfix: Usually the posi...
the_stack_v2_python_sparse
keras-onnx/onnx_keras/tree_structure.py
WeiChe-Huang/ONNX_Convertor
train
0
9c3a655c5779af63b5e3bd80a2eaf6e10eff0cd2
[ "super(WorkflowsYamlConfigurationWriter, self).__init__()\nself.__filesystem = filesystem\nself.__tables_configuration = tables_configuration\nself.__logger = logger", "common_data = {'table_base_location': 's3://${swampBucket}/<source>/<database>.<schema>/', 'db_connection_string': tables_information['db_connect...
<|body_start_0|> super(WorkflowsYamlConfigurationWriter, self).__init__() self.__filesystem = filesystem self.__tables_configuration = tables_configuration self.__logger = logger <|end_body_0|> <|body_start_1|> common_data = {'table_base_location': 's3://${swampBucket}/<source>/...
Write the YAML configuration files needed to run the workflows
WorkflowsYamlConfigurationWriter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkflowsYamlConfigurationWriter: """Write the YAML configuration files needed to run the workflows""" def __init__(self, filesystem, tables_configuration, logger): """Initialize the class :param filesystem: Filesystem :param tables_configuration: TablesConfiguration :param logger: L...
stack_v2_sparse_classes_36k_train_006175
4,261
permissive
[ { "docstring": "Initialize the class :param filesystem: Filesystem :param tables_configuration: TablesConfiguration :param logger: Logging", "name": "__init__", "signature": "def __init__(self, filesystem, tables_configuration, logger)" }, { "docstring": "Given tables and database connection inf...
2
null
Implement the Python class `WorkflowsYamlConfigurationWriter` described below. Class description: Write the YAML configuration files needed to run the workflows Method signatures and docstrings: - def __init__(self, filesystem, tables_configuration, logger): Initialize the class :param filesystem: Filesystem :param t...
Implement the Python class `WorkflowsYamlConfigurationWriter` described below. Class description: Write the YAML configuration files needed to run the workflows Method signatures and docstrings: - def __init__(self, filesystem, tables_configuration, logger): Initialize the class :param filesystem: Filesystem :param t...
d0e52277daff523eda63f5d3137b5a990413923d
<|skeleton|> class WorkflowsYamlConfigurationWriter: """Write the YAML configuration files needed to run the workflows""" def __init__(self, filesystem, tables_configuration, logger): """Initialize the class :param filesystem: Filesystem :param tables_configuration: TablesConfiguration :param logger: L...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkflowsYamlConfigurationWriter: """Write the YAML configuration files needed to run the workflows""" def __init__(self, filesystem, tables_configuration, logger): """Initialize the class :param filesystem: Filesystem :param tables_configuration: TablesConfiguration :param logger: Logging""" ...
the_stack_v2_python_sparse
src/slippinj/filesystem/yaml_configuration.py
cupid4/slippin-jimmy
train
0
29a8e30590090fdb239510371528bf28671d5b6c
[ "if not root:\n return []\norder = [[]]\nqueue = [(root, 0)]\nwhile queue:\n curr = queue[0]\n if len(order) < curr[1] + 1:\n order.append([])\n order[curr[1]].append(curr[0].val)\n del queue[0]\n if curr[0].left:\n queue.append((curr[0].left, curr[1] + 1))\n if curr[0].right:\n ...
<|body_start_0|> if not root: return [] order = [[]] queue = [(root, 0)] while queue: curr = queue[0] if len(order) < curr[1] + 1: order.append([]) order[curr[1]].append(curr[0].val) del queue[0] if c...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def levelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def levelOrderBottom(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: ...
stack_v2_sparse_classes_36k_train_006176
2,510
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "levelOrder", "signature": "def levelOrder(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "levelOrderBottom", "signature": "def levelOrderBottom(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_018822
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder(self, root): :type root: TreeNode :rtype: List[List[int]] - def levelOrderBottom(self, root): :type root: TreeNode :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder(self, root): :type root: TreeNode :rtype: List[List[int]] - def levelOrderBottom(self, root): :type root: TreeNode :rtype: List[List[int]] <|skeleton|> class Solu...
0584b86642dff667f5bf6b7acfbbce86a41a55b6
<|skeleton|> class Solution: def levelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def levelOrderBottom(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def levelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]]""" if not root: return [] order = [[]] queue = [(root, 0)] while queue: curr = queue[0] if len(order) < curr[1] + 1: order.append([]...
the_stack_v2_python_sparse
python_solution/101_110/BinaryTreeLevelOrderTraversal.py
CescWang1991/LeetCode-Python
train
1
18304955acfc7cdcf25e313a437e1f6a78c305d3
[ "if len(self.children) == 1 and self.children[0].qname() == (dav_namespace, 'all'):\n return True\n\ndef isAggregate(supportedPrivilege):\n sp = supportedPrivilege.childOfType(Privilege)\n if sp == self:\n\n def find(supportedPrivilege):\n if supportedPrivilege.childOfType(Privilege) == s...
<|body_start_0|> if len(self.children) == 1 and self.children[0].qname() == (dav_namespace, 'all'): return True def isAggregate(supportedPrivilege): sp = supportedPrivilege.childOfType(Privilege) if sp == self: def find(supportedPrivilege): ...
Identifies a privilege. (RFC 3744, sections 5.3 and 5.5.1)
Privilege
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Privilege: """Identifies a privilege. (RFC 3744, sections 5.3 and 5.5.1)""" def isAggregateOf(self, subprivilege, supportedPrivileges): """Check whether this privilege is an aggregate of another. @param subprivilege: a L{Privilege} @param supportedPrivileges: a L{SupportedPrivilegeSe...
stack_v2_sparse_classes_36k_train_006177
26,487
permissive
[ { "docstring": "Check whether this privilege is an aggregate of another. @param subprivilege: a L{Privilege} @param supportedPrivileges: a L{SupportedPrivilegeSet} @return: C{True} is this privilege is an aggregate of C{subprivilege} according to C{supportedPrivileges}.", "name": "isAggregateOf", "signa...
2
stack_v2_sparse_classes_30k_train_015469
Implement the Python class `Privilege` described below. Class description: Identifies a privilege. (RFC 3744, sections 5.3 and 5.5.1) Method signatures and docstrings: - def isAggregateOf(self, subprivilege, supportedPrivileges): Check whether this privilege is an aggregate of another. @param subprivilege: a L{Privil...
Implement the Python class `Privilege` described below. Class description: Identifies a privilege. (RFC 3744, sections 5.3 and 5.5.1) Method signatures and docstrings: - def isAggregateOf(self, subprivilege, supportedPrivileges): Check whether this privilege is an aggregate of another. @param subprivilege: a L{Privil...
cb2962f1f1927f1e52ea405094fa3e7e180f23cb
<|skeleton|> class Privilege: """Identifies a privilege. (RFC 3744, sections 5.3 and 5.5.1)""" def isAggregateOf(self, subprivilege, supportedPrivileges): """Check whether this privilege is an aggregate of another. @param subprivilege: a L{Privilege} @param supportedPrivileges: a L{SupportedPrivilegeSe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Privilege: """Identifies a privilege. (RFC 3744, sections 5.3 and 5.5.1)""" def isAggregateOf(self, subprivilege, supportedPrivileges): """Check whether this privilege is an aggregate of another. @param subprivilege: a L{Privilege} @param supportedPrivileges: a L{SupportedPrivilegeSet} @return: C...
the_stack_v2_python_sparse
txdav/xml/rfc3744.py
ass-a2s/ccs-calendarserver
train
2
3d2b488ec37bf23033803e9a30c8c872f48ab3e8
[ "Sum = 0\nif n == 1 or n == 0:\n return 1\nif n % 2 == 0:\n for i in range(0, n // 2):\n Sum += 2 * self.numTrees(i) * self.numTrees(n - 1 - i)\n return Sum\nelse:\n for i in range(0, n // 2):\n Sum += 2 * self.numTrees(i) * self.numTrees(n - 1 - i)\n return Sum + self.numTrees(n // 2) ...
<|body_start_0|> Sum = 0 if n == 1 or n == 0: return 1 if n % 2 == 0: for i in range(0, n // 2): Sum += 2 * self.numTrees(i) * self.numTrees(n - 1 - i) return Sum else: for i in range(0, n // 2): Sum += 2 * s...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numTrees(self, n): """:type n: int :rtype: int""" <|body_0|> def numTrees2(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> Sum = 0 if n == 1 or n == 0: return 1 if n % 2...
stack_v2_sparse_classes_36k_train_006178
1,102
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "numTrees", "signature": "def numTrees(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "numTrees2", "signature": "def numTrees2(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_004835
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numTrees(self, n): :type n: int :rtype: int - def numTrees2(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numTrees(self, n): :type n: int :rtype: int - def numTrees2(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def numTrees(self, n): """:type n: i...
6ed06f5d1b27b5d13e8a2f590d781053bccf3a12
<|skeleton|> class Solution: def numTrees(self, n): """:type n: int :rtype: int""" <|body_0|> def numTrees2(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numTrees(self, n): """:type n: int :rtype: int""" Sum = 0 if n == 1 or n == 0: return 1 if n % 2 == 0: for i in range(0, n // 2): Sum += 2 * self.numTrees(i) * self.numTrees(n - 1 - i) return Sum else: ...
the_stack_v2_python_sparse
Tree/Unique Binary Search Trees.py
lll109512/LeetCode
train
0
f16c84514defbbc1319eead11515ff60d318300d
[ "self.min_val = min_val\nself.max_val = max_val\nself.alpha = alpha\nself.beta = beta", "if X.pixeltype != 'float':\n raise ValueError('image.pixeltype must be float ... use TypeCast transform or clone to float')\ninsuffix = X._libsuffix\ncast_fn = utils.get_lib_fn('sigmoidAntsImage%s' % insuffix)\ncasted_ptr ...
<|body_start_0|> self.min_val = min_val self.max_val = max_val self.alpha = alpha self.beta = beta <|end_body_0|> <|body_start_1|> if X.pixeltype != 'float': raise ValueError('image.pixeltype must be float ... use TypeCast transform or clone to float') insuff...
Transform an image using a sigmoid function
SigmoidIntensity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SigmoidIntensity: """Transform an image using a sigmoid function""" def __init__(self, min_val, max_val, alpha, beta): """Initialize a SigmoidIntensity transform Arguments --------- min_val : float minimum value max_val : float maximum value alpha : float alpha value for sigmoid beta...
stack_v2_sparse_classes_36k_train_006179
24,297
permissive
[ { "docstring": "Initialize a SigmoidIntensity transform Arguments --------- min_val : float minimum value max_val : float maximum value alpha : float alpha value for sigmoid beta : flaot beta value for sigmoid Example ------- >>> import ants >>> sigscaler = ants.contrib.SigmoidIntensity(0,1,1,1)", "name": "...
2
null
Implement the Python class `SigmoidIntensity` described below. Class description: Transform an image using a sigmoid function Method signatures and docstrings: - def __init__(self, min_val, max_val, alpha, beta): Initialize a SigmoidIntensity transform Arguments --------- min_val : float minimum value max_val : float...
Implement the Python class `SigmoidIntensity` described below. Class description: Transform an image using a sigmoid function Method signatures and docstrings: - def __init__(self, min_val, max_val, alpha, beta): Initialize a SigmoidIntensity transform Arguments --------- min_val : float minimum value max_val : float...
41f2dd3fcf72654f284dac1a9448033e963f0afb
<|skeleton|> class SigmoidIntensity: """Transform an image using a sigmoid function""" def __init__(self, min_val, max_val, alpha, beta): """Initialize a SigmoidIntensity transform Arguments --------- min_val : float minimum value max_val : float maximum value alpha : float alpha value for sigmoid beta...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SigmoidIntensity: """Transform an image using a sigmoid function""" def __init__(self, min_val, max_val, alpha, beta): """Initialize a SigmoidIntensity transform Arguments --------- min_val : float minimum value max_val : float maximum value alpha : float alpha value for sigmoid beta : flaot beta...
the_stack_v2_python_sparse
ants/contrib/sampling/transforms.py
ANTsX/ANTsPy
train
483
f134a40446d6c1f8cd4e047c68d64a3af6a7bde6
[ "i = low - 1\nchange = array[high]\nfor j in range(low, high):\n if array[j] <= change:\n i = i + 1\n array[i], array[j] = (array[j], array[i])\narray[i + 1], array[high] = (array[high], array[i + 1])\nreturn i + 1", "if low < high:\n pi = self.splitter(array, low, high)\n self.quickSort(ar...
<|body_start_0|> i = low - 1 change = array[high] for j in range(low, high): if array[j] <= change: i = i + 1 array[i], array[j] = (array[j], array[i]) array[i + 1], array[high] = (array[high], array[i + 1]) return i + 1 <|end_body_0|> ...
QuickSort
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuickSort: def splitter(array: list, low: int, high: int) -> int: """A function that splits an array Parameters low - starting boundary value high - starting boundary value array - entered list""" <|body_0|> def quickSort(self, array, low, high) -> None: """Main func...
stack_v2_sparse_classes_36k_train_006180
1,236
no_license
[ { "docstring": "A function that splits an array Parameters low - starting boundary value high - starting boundary value array - entered list", "name": "splitter", "signature": "def splitter(array: list, low: int, high: int) -> int" }, { "docstring": "Main function of sorting", "name": "quick...
2
stack_v2_sparse_classes_30k_train_021011
Implement the Python class `QuickSort` described below. Class description: Implement the QuickSort class. Method signatures and docstrings: - def splitter(array: list, low: int, high: int) -> int: A function that splits an array Parameters low - starting boundary value high - starting boundary value array - entered l...
Implement the Python class `QuickSort` described below. Class description: Implement the QuickSort class. Method signatures and docstrings: - def splitter(array: list, low: int, high: int) -> int: A function that splits an array Parameters low - starting boundary value high - starting boundary value array - entered l...
dad4ccf4e3d420dc7fa04656efc851088bb57eb7
<|skeleton|> class QuickSort: def splitter(array: list, low: int, high: int) -> int: """A function that splits an array Parameters low - starting boundary value high - starting boundary value array - entered list""" <|body_0|> def quickSort(self, array, low, high) -> None: """Main func...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuickSort: def splitter(array: list, low: int, high: int) -> int: """A function that splits an array Parameters low - starting boundary value high - starting boundary value array - entered list""" i = low - 1 change = array[high] for j in range(low, high): if array[...
the_stack_v2_python_sparse
algorithms/algorithms_practice/quick_sort.py
lazorikv/python-education
train
0
97ee880dbda4007a4d29b15025b672cf45d9ebf9
[ "self.archival_target = archival_target\nself.cloud_replication_target = cloud_replication_target\nself.days_to_keep = days_to_keep\nself.hold_for_legal_purpose = hold_for_legal_purpose\nself.replication_target = replication_target\nself.mtype = mtype", "if dictionary is None:\n return None\narchival_target = ...
<|body_start_0|> self.archival_target = archival_target self.cloud_replication_target = cloud_replication_target self.days_to_keep = days_to_keep self.hold_for_legal_purpose = hold_for_legal_purpose self.replication_target = replication_target self.mtype = mtype <|end_bod...
Implementation of the 'RunJobSnapshotTarget' model. Specifies settings for a Copy Task when a Protection is run. It gives the target location for the Snapshot and its retention. Attributes: archival_target (ArchivalExternalTarget): Specifies the Archival External Target for storing a copied Snapshot. If the type is not...
RunJobSnapshotTarget
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunJobSnapshotTarget: """Implementation of the 'RunJobSnapshotTarget' model. Specifies settings for a Copy Task when a Protection is run. It gives the target location for the Snapshot and its retention. Attributes: archival_target (ArchivalExternalTarget): Specifies the Archival External Target f...
stack_v2_sparse_classes_36k_train_006181
5,344
permissive
[ { "docstring": "Constructor for the RunJobSnapshotTarget class", "name": "__init__", "signature": "def __init__(self, archival_target=None, cloud_replication_target=None, days_to_keep=None, hold_for_legal_purpose=None, replication_target=None, mtype=None)" }, { "docstring": "Creates an instance ...
2
null
Implement the Python class `RunJobSnapshotTarget` described below. Class description: Implementation of the 'RunJobSnapshotTarget' model. Specifies settings for a Copy Task when a Protection is run. It gives the target location for the Snapshot and its retention. Attributes: archival_target (ArchivalExternalTarget): S...
Implement the Python class `RunJobSnapshotTarget` described below. Class description: Implementation of the 'RunJobSnapshotTarget' model. Specifies settings for a Copy Task when a Protection is run. It gives the target location for the Snapshot and its retention. Attributes: archival_target (ArchivalExternalTarget): S...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RunJobSnapshotTarget: """Implementation of the 'RunJobSnapshotTarget' model. Specifies settings for a Copy Task when a Protection is run. It gives the target location for the Snapshot and its retention. Attributes: archival_target (ArchivalExternalTarget): Specifies the Archival External Target f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RunJobSnapshotTarget: """Implementation of the 'RunJobSnapshotTarget' model. Specifies settings for a Copy Task when a Protection is run. It gives the target location for the Snapshot and its retention. Attributes: archival_target (ArchivalExternalTarget): Specifies the Archival External Target for storing a ...
the_stack_v2_python_sparse
cohesity_management_sdk/models/run_job_snapshot_target.py
cohesity/management-sdk-python
train
24
ed23ecd66262e9a323d2d2943b8f08f6728d1b19
[ "self.debug = debug\nself.model_file_path = model_file_path\ntry:\n self.model_grammar = nocomment(open(ModelParser.grammar_file, 'r').read())\nexcept OSError as e:\n raise ModelGrammarFileOpen(ModelParser.grammar_file)\ntry:\n self.model_text = nocomment(open(self.model_file_path, 'r').read())\nexcept OSE...
<|body_start_0|> self.debug = debug self.model_file_path = model_file_path try: self.model_grammar = nocomment(open(ModelParser.grammar_file, 'r').read()) except OSError as e: raise ModelGrammarFileOpen(ModelParser.grammar_file) try: self.model...
Parses an Executable UML subsystem model input file using the arpeggio parser generator Attributes - grammar_file -- (class based) Name of the system file defining the Executable UML grammar - root_rule_name -- (class based) Name of the top level grammar element found in grammar file - debug -- debug flag (used to set ...
ModelParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelParser: """Parses an Executable UML subsystem model input file using the arpeggio parser generator Attributes - grammar_file -- (class based) Name of the system file defining the Executable UML grammar - root_rule_name -- (class based) Name of the top level grammar element found in grammar f...
stack_v2_sparse_classes_36k_train_006182
4,980
permissive
[ { "docstring": "Constructor :param model_file_path: Where to find the user supplied model input file :param debug: Debug flag", "name": "__init__", "signature": "def __init__(self, model_file_path, debug=True)" }, { "docstring": "Parse the model file and return the content :return: The abstract ...
2
stack_v2_sparse_classes_30k_train_019953
Implement the Python class `ModelParser` described below. Class description: Parses an Executable UML subsystem model input file using the arpeggio parser generator Attributes - grammar_file -- (class based) Name of the system file defining the Executable UML grammar - root_rule_name -- (class based) Name of the top l...
Implement the Python class `ModelParser` described below. Class description: Parses an Executable UML subsystem model input file using the arpeggio parser generator Attributes - grammar_file -- (class based) Name of the system file defining the Executable UML grammar - root_rule_name -- (class based) Name of the top l...
088e27cded9eca2cacba2c6168c03caf4b43ef72
<|skeleton|> class ModelParser: """Parses an Executable UML subsystem model input file using the arpeggio parser generator Attributes - grammar_file -- (class based) Name of the system file defining the Executable UML grammar - root_rule_name -- (class based) Name of the top level grammar element found in grammar f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModelParser: """Parses an Executable UML subsystem model input file using the arpeggio parser generator Attributes - grammar_file -- (class based) Name of the system file defining the Executable UML grammar - root_rule_name -- (class based) Name of the top level grammar element found in grammar file - debug -...
the_stack_v2_python_sparse
flatland/input/model_parser.py
Laurelinex/flatland-model-diagram-editor
train
0
152aff2507e410d3883eb54100d6d8551b621fb7
[ "self.user = user\nself.client = client\nself.key = key\nself.secret = secret\nself.endpoint = endpoint\nself.cred_type = cred_type\nself.token_properties = token_properties", "credentials_path = expanduser(expandvars(path))\nif not exists(credentials_path):\n raise HereCredentialsException('Unable to find cre...
<|body_start_0|> self.user = user self.client = client self.key = key self.secret = secret self.endpoint = endpoint self.cred_type = cred_type self.token_properties = token_properties <|end_body_0|> <|body_start_1|> credentials_path = expanduser(expandvar...
HereCredentials
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HereCredentials: def __init__(self, user: str, client: str, key: str, secret: str, endpoint: str='https://account.api.here.com/oauth2/token', cred_type: str='DEFAULT', token_properties: dict=None): """Instantiate the credentials object. :param user: the HERE user id :param client: the HE...
stack_v2_sparse_classes_36k_train_006183
2,705
permissive
[ { "docstring": "Instantiate the credentials object. :param user: the HERE user id :param client: the HERE client id :param key: the HERE access key id :param secret: there HERE access key secret :param endpoint: the URL of the HERE account service :param cred_type: the type of credentials eg: DEFAULT, TOKEN :to...
2
stack_v2_sparse_classes_30k_val_000990
Implement the Python class `HereCredentials` described below. Class description: Implement the HereCredentials class. Method signatures and docstrings: - def __init__(self, user: str, client: str, key: str, secret: str, endpoint: str='https://account.api.here.com/oauth2/token', cred_type: str='DEFAULT', token_propert...
Implement the Python class `HereCredentials` described below. Class description: Implement the HereCredentials class. Method signatures and docstrings: - def __init__(self, user: str, client: str, key: str, secret: str, endpoint: str='https://account.api.here.com/oauth2/token', cred_type: str='DEFAULT', token_propert...
e45f6c578733b3adce5a32dba575884ff76274b3
<|skeleton|> class HereCredentials: def __init__(self, user: str, client: str, key: str, secret: str, endpoint: str='https://account.api.here.com/oauth2/token', cred_type: str='DEFAULT', token_properties: dict=None): """Instantiate the credentials object. :param user: the HERE user id :param client: the HE...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HereCredentials: def __init__(self, user: str, client: str, key: str, secret: str, endpoint: str='https://account.api.here.com/oauth2/token', cred_type: str='DEFAULT', token_properties: dict=None): """Instantiate the credentials object. :param user: the HERE user id :param client: the HERE client id :...
the_stack_v2_python_sparse
XYZHubConnector/xyz_qgis/common/here_credentials.py
heremaps/xyz-qgis-plugin
train
23
7d7db67781d618d26200cfc1b908775614ba4f68
[ "sl = []\n\ndef buildString(root, sl):\n if root == None:\n sl.append('X')\n else:\n sl.append(str(root.val))\n buildString(root.left, sl)\n buildString(root.right, sl)\nbuildString(root, sl)\nreturn ','.join(sl)", "data = data.split(',')\n\ndef buildTree(data):\n val = data.p...
<|body_start_0|> sl = [] def buildString(root, sl): if root == None: sl.append('X') else: sl.append(str(root.val)) buildString(root.left, sl) buildString(root.right, sl) buildString(root, sl) return ...
采用前序遍历. 序列化,即将二叉树转成字符串。因为二叉树中包含null节点。需要采用一个特殊字符标记,因为这里的二叉树的值都是数字,所以可以采用非数字作为标记,如采用X。每个节点间用,分割。然后就是按照前序遍历的方法,输入二叉树成字符串。 反序列化,即将刚才生成的字符串转换成二叉树。首先,将字符串按照,split成字符串数组的形式,该数组中每一个元素即为一个二叉树的节点。这里本来可以很简单的用一个全局变量记录,当前遍历的数组index,但是因为题目中要求采用stateless的方式,所以必须换种方式。可以采用list的方式,将已经遍历的节点删除,剩下的就是当该字符串不是X时,按照前序遍历的方式重建二叉树。
Codec
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: """采用前序遍历. 序列化,即将二叉树转成字符串。因为二叉树中包含null节点。需要采用一个特殊字符标记,因为这里的二叉树的值都是数字,所以可以采用非数字作为标记,如采用X。每个节点间用,分割。然后就是按照前序遍历的方法,输入二叉树成字符串。 反序列化,即将刚才生成的字符串转换成二叉树。首先,将字符串按照,split成字符串数组的形式,该数组中每一个元素即为一个二叉树的节点。这里本来可以很简单的用一个全局变量记录,当前遍历的数组index,但是因为题目中要求采用stateless的方式,所以必须换种方式。可以采用list的方式,将已经遍历的节点删除,剩下的就是当该字符串不...
stack_v2_sparse_classes_36k_train_006184
2,142
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: 采用前序遍历. 序列化,即将二叉树转成字符串。因为二叉树中包含null节点。需要采用一个特殊字符标记,因为这里的二叉树的值都是数字,所以可以采用非数字作为标记,如采用X。每个节点间用,分割。然后就是按照前序遍历的方法,输入二叉树成字符串。 反序列化,即将刚才生成的字符串转换成二叉树。首先,将字符串按照,split成字符串数组的形式,该数组中每一个元素即为一个二叉树的节点。这里本来可以很简单的用一个全局变量记录,当前遍历的数组index,但是因为题目中要求采用stateless的方式,所以必须...
Implement the Python class `Codec` described below. Class description: 采用前序遍历. 序列化,即将二叉树转成字符串。因为二叉树中包含null节点。需要采用一个特殊字符标记,因为这里的二叉树的值都是数字,所以可以采用非数字作为标记,如采用X。每个节点间用,分割。然后就是按照前序遍历的方法,输入二叉树成字符串。 反序列化,即将刚才生成的字符串转换成二叉树。首先,将字符串按照,split成字符串数组的形式,该数组中每一个元素即为一个二叉树的节点。这里本来可以很简单的用一个全局变量记录,当前遍历的数组index,但是因为题目中要求采用stateless的方式,所以必须...
b49633ac8edc7bd96dec4b44f7e6acf504cda2a6
<|skeleton|> class Codec: """采用前序遍历. 序列化,即将二叉树转成字符串。因为二叉树中包含null节点。需要采用一个特殊字符标记,因为这里的二叉树的值都是数字,所以可以采用非数字作为标记,如采用X。每个节点间用,分割。然后就是按照前序遍历的方法,输入二叉树成字符串。 反序列化,即将刚才生成的字符串转换成二叉树。首先,将字符串按照,split成字符串数组的形式,该数组中每一个元素即为一个二叉树的节点。这里本来可以很简单的用一个全局变量记录,当前遍历的数组index,但是因为题目中要求采用stateless的方式,所以必须换种方式。可以采用list的方式,将已经遍历的节点删除,剩下的就是当该字符串不...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: """采用前序遍历. 序列化,即将二叉树转成字符串。因为二叉树中包含null节点。需要采用一个特殊字符标记,因为这里的二叉树的值都是数字,所以可以采用非数字作为标记,如采用X。每个节点间用,分割。然后就是按照前序遍历的方法,输入二叉树成字符串。 反序列化,即将刚才生成的字符串转换成二叉树。首先,将字符串按照,split成字符串数组的形式,该数组中每一个元素即为一个二叉树的节点。这里本来可以很简单的用一个全局变量记录,当前遍历的数组index,但是因为题目中要求采用stateless的方式,所以必须换种方式。可以采用list的方式,将已经遍历的节点删除,剩下的就是当该字符串不是X时,按照前序遍历的方式...
the_stack_v2_python_sparse
算法/Python/297. Serialize and Deserialize Binary Tree.py
honchen22/LeetCode
train
1
160427c655ff89686c3af2e5697f70d41fa5728c
[ "self.data = _data\nself.cov = _cov\nself.z = _z\nself.prior = _prior\nself.LikeFunc = Likelihood(_data, _cov)", "_mod = model(_theta, self.z)\nself.u = -self.LikeFunc.get_likelihood(_mod) - self.prior.get_log_pdf(_theta)\nreturn self.u", "theta_grad = torch.tensor(_theta.clone(), requires_grad=True)\nval = sel...
<|body_start_0|> self.data = _data self.cov = _cov self.z = _z self.prior = _prior self.LikeFunc = Likelihood(_data, _cov) <|end_body_0|> <|body_start_1|> _mod = model(_theta, self.z) self.u = -self.LikeFunc.get_likelihood(_mod) - self.prior.get_log_pdf(_theta) ...
Potential
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Potential: def __init__(self, _data, _cov, _z, _prior): """Computes potential energy and its gradient. dat: array (ndata), data. _cov: array (1, ndata), data error z: array (ndata), redshift. prior: object, prior.""" <|body_0|> def value(self, _theta): """Returns pot...
stack_v2_sparse_classes_36k_train_006185
16,303
no_license
[ { "docstring": "Computes potential energy and its gradient. dat: array (ndata), data. _cov: array (1, ndata), data error z: array (ndata), redshift. prior: object, prior.", "name": "__init__", "signature": "def __init__(self, _data, _cov, _z, _prior)" }, { "docstring": "Returns potential log val...
3
stack_v2_sparse_classes_30k_train_020911
Implement the Python class `Potential` described below. Class description: Implement the Potential class. Method signatures and docstrings: - def __init__(self, _data, _cov, _z, _prior): Computes potential energy and its gradient. dat: array (ndata), data. _cov: array (1, ndata), data error z: array (ndata), redshift...
Implement the Python class `Potential` described below. Class description: Implement the Potential class. Method signatures and docstrings: - def __init__(self, _data, _cov, _z, _prior): Computes potential energy and its gradient. dat: array (ndata), data. _cov: array (1, ndata), data error z: array (ndata), redshift...
8789f692d81c5435a5888b6b151ccf6187d5a064
<|skeleton|> class Potential: def __init__(self, _data, _cov, _z, _prior): """Computes potential energy and its gradient. dat: array (ndata), data. _cov: array (1, ndata), data error z: array (ndata), redshift. prior: object, prior.""" <|body_0|> def value(self, _theta): """Returns pot...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Potential: def __init__(self, _data, _cov, _z, _prior): """Computes potential energy and its gradient. dat: array (ndata), data. _cov: array (1, ndata), data error z: array (ndata), redshift. prior: object, prior.""" self.data = _data self.cov = _cov self.z = _z self.pr...
the_stack_v2_python_sparse
p18/toy.py
fluowhy/MCMC-methods
train
1
ca4ec8e5cda1856c6340492f7846df17eba81d29
[ "def _9Tuple(a12=dflt, lat2=dflt, lon2=dflt, azi2=dflt, s12=dflt, m12=dflt, M12=dflt, M21=dflt, S12=dflt, **unused):\n return Direct9Tuple(a12, lat2, lon2, azi2, s12, m12, M12, M21, S12)\nreturn _9Tuple(**self)", "def _12Tuple(lat1=dflt, lon1=dflt, azi1=dflt, lat2=dflt, lon2=dflt, azi2=dflt, s12=dflt, a12=dflt...
<|body_start_0|> def _9Tuple(a12=dflt, lat2=dflt, lon2=dflt, azi2=dflt, s12=dflt, m12=dflt, M12=dflt, M21=dflt, S12=dflt, **unused): return Direct9Tuple(a12, lat2, lon2, azi2, s12, m12, M12, M21, S12) return _9Tuple(**self) <|end_body_0|> <|body_start_1|> def _12Tuple(lat1=dflt, lon...
Basic C{dict} with both key I{and} attribute access to the C{dict} items. Results of all C{geodesic} methods are returned as a L{GDict} instance.
GDict
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GDict: """Basic C{dict} with both key I{and} attribute access to the C{dict} items. Results of all C{geodesic} methods are returned as a L{GDict} instance.""" def toDirect9Tuple(self, dflt=NAN): """Convert this L{GDict} result to a 9-tuple, like I{Karney}'s method C{geographiclib.geo...
stack_v2_sparse_classes_36k_train_006186
27,898
permissive
[ { "docstring": "Convert this L{GDict} result to a 9-tuple, like I{Karney}'s method C{geographiclib.geodesic.Geodesic._GenDirect}. @return: L{Direct9Tuple}C{(a12, lat2, lon2, azi2, s12, m12, M12, M21, S12)}", "name": "toDirect9Tuple", "signature": "def toDirect9Tuple(self, dflt=NAN)" }, { "docstr...
3
stack_v2_sparse_classes_30k_train_019952
Implement the Python class `GDict` described below. Class description: Basic C{dict} with both key I{and} attribute access to the C{dict} items. Results of all C{geodesic} methods are returned as a L{GDict} instance. Method signatures and docstrings: - def toDirect9Tuple(self, dflt=NAN): Convert this L{GDict} result ...
Implement the Python class `GDict` described below. Class description: Basic C{dict} with both key I{and} attribute access to the C{dict} items. Results of all C{geodesic} methods are returned as a L{GDict} instance. Method signatures and docstrings: - def toDirect9Tuple(self, dflt=NAN): Convert this L{GDict} result ...
3a7c03c42237102af0a9ab23b2d550020a601d98
<|skeleton|> class GDict: """Basic C{dict} with both key I{and} attribute access to the C{dict} items. Results of all C{geodesic} methods are returned as a L{GDict} instance.""" def toDirect9Tuple(self, dflt=NAN): """Convert this L{GDict} result to a 9-tuple, like I{Karney}'s method C{geographiclib.geo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GDict: """Basic C{dict} with both key I{and} attribute access to the C{dict} items. Results of all C{geodesic} methods are returned as a L{GDict} instance.""" def toDirect9Tuple(self, dflt=NAN): """Convert this L{GDict} result to a 9-tuple, like I{Karney}'s method C{geographiclib.geodesic.Geodesi...
the_stack_v2_python_sparse
pygeodesy/karney.py
ahaywardtvuk/PyGeodesy
train
0
57e3fe0ecd2b8eb2c0d9f12488bd0ef6b3352a74
[ "logging.info('======test_login1_normal=====')\nl = LoginView(self.driver)\nl.login_action('15013038819', 'yyy333')\nself.assertTrue(l.check_login_status('login_ok'), msg='login fail!')", "logging.info('======test_login2_normal=====')\nl = LoginView(self.driver)\nl.login_action('15013038819', 'yyy331')\nself.asse...
<|body_start_0|> logging.info('======test_login1_normal=====') l = LoginView(self.driver) l.login_action('15013038819', 'yyy333') self.assertTrue(l.check_login_status('login_ok'), msg='login fail!') <|end_body_0|> <|body_start_1|> logging.info('======test_login2_normal=====') ...
LoginTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginTest: def test_login1_normal(self): """1.正确的手机号与密码""" <|body_0|> def test_login2_normal(self): """2.正确的手机号与错误密码""" <|body_1|> def test_login3_normal(self): """3.未注册的手机号码""" <|body_2|> def test_login4_normal(self): """4.正...
stack_v2_sparse_classes_36k_train_006187
2,390
no_license
[ { "docstring": "1.正确的手机号与密码", "name": "test_login1_normal", "signature": "def test_login1_normal(self)" }, { "docstring": "2.正确的手机号与错误密码", "name": "test_login2_normal", "signature": "def test_login2_normal(self)" }, { "docstring": "3.未注册的手机号码", "name": "test_login3_normal", ...
6
null
Implement the Python class `LoginTest` described below. Class description: Implement the LoginTest class. Method signatures and docstrings: - def test_login1_normal(self): 1.正确的手机号与密码 - def test_login2_normal(self): 2.正确的手机号与错误密码 - def test_login3_normal(self): 3.未注册的手机号码 - def test_login4_normal(self): 4.正确邮箱与正确密码 -...
Implement the Python class `LoginTest` described below. Class description: Implement the LoginTest class. Method signatures and docstrings: - def test_login1_normal(self): 1.正确的手机号与密码 - def test_login2_normal(self): 2.正确的手机号与错误密码 - def test_login3_normal(self): 3.未注册的手机号码 - def test_login4_normal(self): 4.正确邮箱与正确密码 -...
80539f8d3fc5ccb5c07aab2ad37a9c071bb4944d
<|skeleton|> class LoginTest: def test_login1_normal(self): """1.正确的手机号与密码""" <|body_0|> def test_login2_normal(self): """2.正确的手机号与错误密码""" <|body_1|> def test_login3_normal(self): """3.未注册的手机号码""" <|body_2|> def test_login4_normal(self): """4.正...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoginTest: def test_login1_normal(self): """1.正确的手机号与密码""" logging.info('======test_login1_normal=====') l = LoginView(self.driver) l.login_action('15013038819', 'yyy333') self.assertTrue(l.check_login_status('login_ok'), msg='login fail!') def test_login2_normal(s...
the_stack_v2_python_sparse
WFX_App_Test/test_case/test_01_login.py
yangyuexiong/WFX_Test
train
0
9f60fff98431a4911dc8d793b750592448ae60f2
[ "m = {}\nres = []\nfor i in nums1:\n m[i] = m.setdefault(i, 0) + 1\nfor i in nums2:\n if i in m and m[i] > 0:\n res.append(i)\n m[i] -= 1\nreturn res", "nums1.sort()\nnums2.sort()\ni, j = (0, 0)\nres = []\nwhile i < len(nums1) and j < len(nums2):\n if nums1[i] == nums2[j]:\n res.appe...
<|body_start_0|> m = {} res = [] for i in nums1: m[i] = m.setdefault(i, 0) + 1 for i in nums2: if i in m and m[i] > 0: res.append(i) m[i] -= 1 return res <|end_body_0|> <|body_start_1|> nums1.sort() nums2.so...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def intersect(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" <|body_0|> def intersectSort(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_36k_train_006188
2,765
no_license
[ { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: List[int]", "name": "intersect", "signature": "def intersect(self, nums1, nums2)" }, { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: List[int]", "name": "intersectSort", "signature": "def intersec...
2
stack_v2_sparse_classes_30k_train_000214
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intersect(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: List[int] - def intersectSort(self, nums1, nums2): :type nums1: List[int] :type nums2: Li...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intersect(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: List[int] - def intersectSort(self, nums1, nums2): :type nums1: List[int] :type nums2: Li...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def intersect(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" <|body_0|> def intersectSort(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def intersect(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" m = {} res = [] for i in nums1: m[i] = m.setdefault(i, 0) + 1 for i in nums2: if i in m and m[i] > 0: res.append(i)...
the_stack_v2_python_sparse
I/IntersectionofTwoArraysII.py
bssrdf/pyleet
train
2
92da236757cbd5ab41c4147e912e813044e2de30
[ "if not nums:\n return False\narr = [1] * len(nums)\np1 = p2 = 1\nfor i in range(len(nums)):\n arr[i] *= p1\n arr[~i] *= p2\n p1 *= nums[i]\n p2 *= nums[~i]\nreturn arr", "if not nums:\n return False\np = 1\nn = len(nums)\noutput = []\nfor i in range(n):\n output.append(p)\n p = p * nums[i...
<|body_start_0|> if not nums: return False arr = [1] * len(nums) p1 = p2 = 1 for i in range(len(nums)): arr[i] *= p1 arr[~i] *= p2 p1 *= nums[i] p2 *= nums[~i] return arr <|end_body_0|> <|body_start_1|> if not n...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: """https://www.youtube.com/watch?v=tSRFtR3pv74 :param nums: :return:""" <|body_0|> def productExceptSelf(self, nums: List[int]) -> List[int]: """Numbers [1 2 3 4 5] Pass 1: [- 1 12 123 1234] Pass 2:...
stack_v2_sparse_classes_36k_train_006189
958
no_license
[ { "docstring": "https://www.youtube.com/watch?v=tSRFtR3pv74 :param nums: :return:", "name": "productExceptSelf", "signature": "def productExceptSelf(self, nums: List[int]) -> List[int]" }, { "docstring": "Numbers [1 2 3 4 5] Pass 1: [- 1 12 123 1234] Pass 2: [2345 345 45 5 -]", "name": "prod...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def productExceptSelf(self, nums: List[int]) -> List[int]: https://www.youtube.com/watch?v=tSRFtR3pv74 :param nums: :return: - def productExceptSelf(self, nums: List[int]) -> Lis...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def productExceptSelf(self, nums: List[int]) -> List[int]: https://www.youtube.com/watch?v=tSRFtR3pv74 :param nums: :return: - def productExceptSelf(self, nums: List[int]) -> Lis...
e50dc0642f087f37ab3234390be3d8a0ed48fe62
<|skeleton|> class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: """https://www.youtube.com/watch?v=tSRFtR3pv74 :param nums: :return:""" <|body_0|> def productExceptSelf(self, nums: List[int]) -> List[int]: """Numbers [1 2 3 4 5] Pass 1: [- 1 12 123 1234] Pass 2:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: """https://www.youtube.com/watch?v=tSRFtR3pv74 :param nums: :return:""" if not nums: return False arr = [1] * len(nums) p1 = p2 = 1 for i in range(len(nums)): arr[i] *= p1 ...
the_stack_v2_python_sparse
Leetcode/238. Product of Array Except Self.py
brlala/Educative-Grokking-Coding-Exercise
train
3
1a614a75e3a793c22e184c4d00499e08ad9c89f8
[ "self.summary = {}\nself.dictionary = set(dictionary)\nfor word in self.dictionary:\n if len(word) <= 2:\n self.summary[word] = self.summary.get(word, 0) + 1\n else:\n newWord = word[0] + str(len(word) - 2) + word[-1]\n self.summary[newWord] = self.summary.get(newWord, 0) + 1", "if len(...
<|body_start_0|> self.summary = {} self.dictionary = set(dictionary) for word in self.dictionary: if len(word) <= 2: self.summary[word] = self.summary.get(word, 0) + 1 else: newWord = word[0] + str(len(word) - 2) + word[-1] ...
ValidWordAbbr
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidWordAbbr: def __init__(self, dictionary): """:type dictionary: List[str]""" <|body_0|> def isUnique(self, word): """:type word: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.summary = {} self.dictionary = set(dic...
stack_v2_sparse_classes_36k_train_006190
912
no_license
[ { "docstring": ":type dictionary: List[str]", "name": "__init__", "signature": "def __init__(self, dictionary)" }, { "docstring": ":type word: str :rtype: bool", "name": "isUnique", "signature": "def isUnique(self, word)" } ]
2
null
Implement the Python class `ValidWordAbbr` described below. Class description: Implement the ValidWordAbbr class. Method signatures and docstrings: - def __init__(self, dictionary): :type dictionary: List[str] - def isUnique(self, word): :type word: str :rtype: bool
Implement the Python class `ValidWordAbbr` described below. Class description: Implement the ValidWordAbbr class. Method signatures and docstrings: - def __init__(self, dictionary): :type dictionary: List[str] - def isUnique(self, word): :type word: str :rtype: bool <|skeleton|> class ValidWordAbbr: def __init_...
0e10a40921d9fa5ca8c53859e4b17bcb62ee899a
<|skeleton|> class ValidWordAbbr: def __init__(self, dictionary): """:type dictionary: List[str]""" <|body_0|> def isUnique(self, word): """:type word: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ValidWordAbbr: def __init__(self, dictionary): """:type dictionary: List[str]""" self.summary = {} self.dictionary = set(dictionary) for word in self.dictionary: if len(word) <= 2: self.summary[word] = self.summary.get(word, 0) + 1 else: ...
the_stack_v2_python_sparse
uniqueWordAbbreviation.py
peinanteng/leetcode
train
0
c39c395f30e35b9fa92d1dd9c556153e9b8ddf5c
[ "NamedObject.__init__(self, root, definitions)\npmd = Metadata()\npmd.wrappers = dict(element=repr, type=repr)\nself.__metadata__.__print__ = pmd\ntns = definitions.tns\nself.element = self.__getref('element', tns)\nself.type = self.__getref('type', tns)", "s = self.root.get(a)\nif s is None:\n return s\nelse:...
<|body_start_0|> NamedObject.__init__(self, root, definitions) pmd = Metadata() pmd.wrappers = dict(element=repr, type=repr) self.__metadata__.__print__ = pmd tns = definitions.tns self.element = self.__getref('element', tns) self.type = self.__getref('type', tns)...
Represents <message><part/></message>. @ivar element: The value of the {element} attribute. Stored as a I{qref} as converted by L{suds.xsd.qualify}. @type element: str @ivar type: The value of the {type} attribute. Stored as a I{qref} as converted by L{suds.xsd.qualify}. @type type: str
Part
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Part: """Represents <message><part/></message>. @ivar element: The value of the {element} attribute. Stored as a I{qref} as converted by L{suds.xsd.qualify}. @type element: str @ivar type: The value of the {type} attribute. Stored as a I{qref} as converted by L{suds.xsd.qualify}. @type type: str"...
stack_v2_sparse_classes_36k_train_006191
30,914
permissive
[ { "docstring": "@param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions}", "name": "__init__", "signature": "def __init__(self, root, definitions)" }, { "docstring": "Get the qualified value of attribute named 'a'.", ...
2
stack_v2_sparse_classes_30k_train_002018
Implement the Python class `Part` described below. Class description: Represents <message><part/></message>. @ivar element: The value of the {element} attribute. Stored as a I{qref} as converted by L{suds.xsd.qualify}. @type element: str @ivar type: The value of the {type} attribute. Stored as a I{qref} as converted b...
Implement the Python class `Part` described below. Class description: Represents <message><part/></message>. @ivar element: The value of the {element} attribute. Stored as a I{qref} as converted by L{suds.xsd.qualify}. @type element: str @ivar type: The value of the {type} attribute. Stored as a I{qref} as converted b...
7d8843fcdfe179f018af2038f813795f7182b714
<|skeleton|> class Part: """Represents <message><part/></message>. @ivar element: The value of the {element} attribute. Stored as a I{qref} as converted by L{suds.xsd.qualify}. @type element: str @ivar type: The value of the {type} attribute. Stored as a I{qref} as converted by L{suds.xsd.qualify}. @type type: str"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Part: """Represents <message><part/></message>. @ivar element: The value of the {element} attribute. Stored as a I{qref} as converted by L{suds.xsd.qualify}. @type element: str @ivar type: The value of the {type} attribute. Stored as a I{qref} as converted by L{suds.xsd.qualify}. @type type: str""" def _...
the_stack_v2_python_sparse
suds/wsdl.py
CybernetiX-S3C/interactive-tutorials
train
1
bd1b24f536bd75a33690848d4b8f6eee045cf609
[ "self.context = context\nself.field = field\nself.widget = widget", "html = self.widget.render().strip()\ntransforms = getToolByName(self.context, 'portal_transforms')\nstream = transforms.convertTo('text/plain', html, mimetype='text/html')\nreturn stream.getData().strip()" ]
<|body_start_0|> self.context = context self.field = field self.widget = widget <|end_body_0|> <|body_start_1|> html = self.widget.render().strip() transforms = getToolByName(self.context, 'portal_transforms') stream = transforms.convertTo('text/plain', html, mimetype='t...
Fallback field converter which uses the rendered widget in display mode for generating a indexable string.
DefaultDexterityTextIndexFieldConverter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefaultDexterityTextIndexFieldConverter: """Fallback field converter which uses the rendered widget in display mode for generating a indexable string.""" def __init__(self, context, field, widget): """Initialize field converter""" <|body_0|> def convert(self): ""...
stack_v2_sparse_classes_36k_train_006192
5,051
no_license
[ { "docstring": "Initialize field converter", "name": "__init__", "signature": "def __init__(self, context, field, widget)" }, { "docstring": "Convert the adapted field value to text/plain for indexing", "name": "convert", "signature": "def convert(self)" } ]
2
stack_v2_sparse_classes_30k_train_020981
Implement the Python class `DefaultDexterityTextIndexFieldConverter` described below. Class description: Fallback field converter which uses the rendered widget in display mode for generating a indexable string. Method signatures and docstrings: - def __init__(self, context, field, widget): Initialize field converter...
Implement the Python class `DefaultDexterityTextIndexFieldConverter` described below. Class description: Fallback field converter which uses the rendered widget in display mode for generating a indexable string. Method signatures and docstrings: - def __init__(self, context, field, widget): Initialize field converter...
51827ba0f63d8d342a360cd4b10213fd3a29557f
<|skeleton|> class DefaultDexterityTextIndexFieldConverter: """Fallback field converter which uses the rendered widget in display mode for generating a indexable string.""" def __init__(self, context, field, widget): """Initialize field converter""" <|body_0|> def convert(self): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DefaultDexterityTextIndexFieldConverter: """Fallback field converter which uses the rendered widget in display mode for generating a indexable string.""" def __init__(self, context, field, widget): """Initialize field converter""" self.context = context self.field = field ...
the_stack_v2_python_sparse
plone/app/dexterity/textindexer/converters.py
plone/plone.app.dexterity
train
12
89f55a19cbbbc135f23c8bb6ef2dd05c737a3f25
[ "val = 0\ncal = [val]\nfor i in nums:\n val += i\n cal.append(val)\nself.cal = cal", "try:\n return self.cal[j + 1] - self.cal[i]\nexcept IndexError:\n return 0" ]
<|body_start_0|> val = 0 cal = [val] for i in nums: val += i cal.append(val) self.cal = cal <|end_body_0|> <|body_start_1|> try: return self.cal[j + 1] - self.cal[i] except IndexError: return 0 <|end_body_1|>
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> val = 0 cal = [val] for i in nums: ...
stack_v2_sparse_classes_36k_train_006193
586
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type j: int :rtype: int", "name": "sumRange", "signature": "def sumRange(self, i, j)" } ]
2
null
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int <|skeleton|> class NumArray: def __init__(self, nums): ...
d8ed762d1005975f0de4f07760c9671195621c88
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumArray: def __init__(self, nums): """:type nums: List[int]""" val = 0 cal = [val] for i in nums: val += i cal.append(val) self.cal = cal def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" try: ...
the_stack_v2_python_sparse
range-sum-query-immutable/solution.py
uxlsl/leetcode_practice
train
0
c43098e360efe030c96e00170f5b328229875bdf
[ "self.username = username\nself.password = md5(password.encode('utf-8')).hexdigest()\nself.base_params = {'user': self.username, 'pass2': self.password, 'softid': '895210'}\nself.headers = {'Connection': 'Keep-Alive', 'User-Agent': 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)'}", "params = {'c...
<|body_start_0|> self.username = username self.password = md5(password.encode('utf-8')).hexdigest() self.base_params = {'user': self.username, 'pass2': self.password, 'softid': '895210'} self.headers = {'Connection': 'Keep-Alive', 'User-Agent': 'Mozilla/4.0 (compatible; MSIE 8.0; Windows...
GtClickShot
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GtClickShot: def __init__(self, username, password): """初始化超级鹰 softid已固化到程序 args: username(str):超级鹰普通用户名 password(str):超级鹰密码""" <|body_0|> def PostPic(self, im, codetype): """发送图片至打码平台 args: im(Byte): 图片字节 codetype(str): 题目类型 参考 http://www.chaojiying.com/price.html r...
stack_v2_sparse_classes_36k_train_006194
26,194
no_license
[ { "docstring": "初始化超级鹰 softid已固化到程序 args: username(str):超级鹰普通用户名 password(str):超级鹰密码", "name": "__init__", "signature": "def __init__(self, username, password)" }, { "docstring": "发送图片至打码平台 args: im(Byte): 图片字节 codetype(str): 题目类型 参考 http://www.chaojiying.com/price.html return(json):返回打码信息,包含坐标信...
3
null
Implement the Python class `GtClickShot` described below. Class description: Implement the GtClickShot class. Method signatures and docstrings: - def __init__(self, username, password): 初始化超级鹰 softid已固化到程序 args: username(str):超级鹰普通用户名 password(str):超级鹰密码 - def PostPic(self, im, codetype): 发送图片至打码平台 args: im(Byte): 图片...
Implement the Python class `GtClickShot` described below. Class description: Implement the GtClickShot class. Method signatures and docstrings: - def __init__(self, username, password): 初始化超级鹰 softid已固化到程序 args: username(str):超级鹰普通用户名 password(str):超级鹰密码 - def PostPic(self, im, codetype): 发送图片至打码平台 args: im(Byte): 图片...
dc9dbbb5bf5e3d29cd664219826ca334916b953f
<|skeleton|> class GtClickShot: def __init__(self, username, password): """初始化超级鹰 softid已固化到程序 args: username(str):超级鹰普通用户名 password(str):超级鹰密码""" <|body_0|> def PostPic(self, im, codetype): """发送图片至打码平台 args: im(Byte): 图片字节 codetype(str): 题目类型 参考 http://www.chaojiying.com/price.html r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GtClickShot: def __init__(self, username, password): """初始化超级鹰 softid已固化到程序 args: username(str):超级鹰普通用户名 password(str):超级鹰密码""" self.username = username self.password = md5(password.encode('utf-8')).hexdigest() self.base_params = {'user': self.username, 'pass2': self.password, ...
the_stack_v2_python_sparse
skill/crawler_gov.py
mj3428/python_for_practice
train
1
ef405907432352d1c603073d8e5a0f959d91d4c0
[ "url = f'{cls.base_url}{cls.snapshot_urls[snapshot_type]}'\nresponse = requests.get(url)\nsnapshots = response.json()\nfor epoch, snapshot in snapshots.items():\n snapshot.update({'epoch': int(epoch)})\nreturn sorted(snapshots.values(), key=lambda i: i['epoch'])", "url = f'{cls.base_url}{cls.epoch_rewards_link...
<|body_start_0|> url = f'{cls.base_url}{cls.snapshot_urls[snapshot_type]}' response = requests.get(url) snapshots = response.json() for epoch, snapshot in snapshots.items(): snapshot.update({'epoch': int(epoch)}) return sorted(snapshots.values(), key=lambda i: i['epoc...
Perp Off-chain storage for staking rewards, ... .
PerpOffChainStorage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PerpOffChainStorage: """Perp Off-chain storage for staking rewards, ... .""" def get_epoch_snapshots(cls, snapshot_type: str) -> List[PerpSnapshot]: """Load epoch (weekly) immediate or vesting snapshots.""" <|body_0|> def get_rewards(cls, epoch: int, hash_: str) -> Dict[...
stack_v2_sparse_classes_36k_train_006195
7,973
permissive
[ { "docstring": "Load epoch (weekly) immediate or vesting snapshots.", "name": "get_epoch_snapshots", "signature": "def get_epoch_snapshots(cls, snapshot_type: str) -> List[PerpSnapshot]" }, { "docstring": "Load perp rewards for whole epoch.", "name": "get_rewards", "signature": "def get_...
2
null
Implement the Python class `PerpOffChainStorage` described below. Class description: Perp Off-chain storage for staking rewards, ... . Method signatures and docstrings: - def get_epoch_snapshots(cls, snapshot_type: str) -> List[PerpSnapshot]: Load epoch (weekly) immediate or vesting snapshots. - def get_rewards(cls, ...
Implement the Python class `PerpOffChainStorage` described below. Class description: Perp Off-chain storage for staking rewards, ... . Method signatures and docstrings: - def get_epoch_snapshots(cls, snapshot_type: str) -> List[PerpSnapshot]: Load epoch (weekly) immediate or vesting snapshots. - def get_rewards(cls, ...
eaa9b81b826471fa1c7748c42162e46ad55183d4
<|skeleton|> class PerpOffChainStorage: """Perp Off-chain storage for staking rewards, ... .""" def get_epoch_snapshots(cls, snapshot_type: str) -> List[PerpSnapshot]: """Load epoch (weekly) immediate or vesting snapshots.""" <|body_0|> def get_rewards(cls, epoch: int, hash_: str) -> Dict[...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PerpOffChainStorage: """Perp Off-chain storage for staking rewards, ... .""" def get_epoch_snapshots(cls, snapshot_type: str) -> List[PerpSnapshot]: """Load epoch (weekly) immediate or vesting snapshots.""" url = f'{cls.base_url}{cls.snapshot_urls[snapshot_type]}' response = reque...
the_stack_v2_python_sparse
blockapi/v2/api/perpetual/perpetual.py
crypkit/blockapi
train
22
14385afa20792ec779d1da6def124dde74e858c4
[ "value = self._prepare_item(key, value)\nqs = self._get_queryset()\nfn = '.'.join([self.__field_name__, key])\nqs.update_one({'$set': {fn: value}})\nself._data[key] = value\nself.__log__.append(MapSet(key=key, value=value))\nif reload:\n self.reload()", "qs = self._get_queryset()\nfn = '.'.join([self.__field_n...
<|body_start_0|> value = self._prepare_item(key, value) qs = self._get_queryset() fn = '.'.join([self.__field_name__, key]) qs.update_one({'$set': {fn: value}}) self._data[key] = value self.__log__.append(MapSet(key=key, value=value)) if reload: self.r...
Map.
Map
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Map: """Map.""" def set(self, key, value, reload=True): """Set key directly in database. See `$set` in MongoDB's `set`.""" <|body_0|> def unset(self, key, reload=True): """Unset key directly in database. See `$unset` in MongoDB's `unset`.""" <|body_1|> <...
stack_v2_sparse_classes_36k_train_006196
5,850
no_license
[ { "docstring": "Set key directly in database. See `$set` in MongoDB's `set`.", "name": "set", "signature": "def set(self, key, value, reload=True)" }, { "docstring": "Unset key directly in database. See `$unset` in MongoDB's `unset`.", "name": "unset", "signature": "def unset(self, key, ...
2
stack_v2_sparse_classes_30k_train_006477
Implement the Python class `Map` described below. Class description: Map. Method signatures and docstrings: - def set(self, key, value, reload=True): Set key directly in database. See `$set` in MongoDB's `set`. - def unset(self, key, reload=True): Unset key directly in database. See `$unset` in MongoDB's `unset`.
Implement the Python class `Map` described below. Class description: Map. Method signatures and docstrings: - def set(self, key, value, reload=True): Set key directly in database. See `$set` in MongoDB's `set`. - def unset(self, key, reload=True): Unset key directly in database. See `$unset` in MongoDB's `unset`. <|...
b3b9f2fdd5987c718b9db600fd7881630bfef944
<|skeleton|> class Map: """Map.""" def set(self, key, value, reload=True): """Set key directly in database. See `$set` in MongoDB's `set`.""" <|body_0|> def unset(self, key, reload=True): """Unset key directly in database. See `$unset` in MongoDB's `unset`.""" <|body_1|> <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Map: """Map.""" def set(self, key, value, reload=True): """Set key directly in database. See `$set` in MongoDB's `set`.""" value = self._prepare_item(key, value) qs = self._get_queryset() fn = '.'.join([self.__field_name__, key]) qs.update_one({'$set': {fn: value}}...
the_stack_v2_python_sparse
yadm/fields/map.py
habibutsu/yadm
train
0
d0bc0d7027bf414c625d9d773737b6807f5441a0
[ "if len(nums) == 1:\n return nums[0]\nres = self.getMaxSubArray(nums, len(nums) - 1)\nreturn max(res[0], res[1])", "if i >= 2:\n res = self.getMaxSubArray(nums, i - 1)\n return (max(res[0], res[1]), nums[i] + max(res[1], 0))\nelse:\n return (nums[0], nums[1] + max(nums[0], 0))" ]
<|body_start_0|> if len(nums) == 1: return nums[0] res = self.getMaxSubArray(nums, len(nums) - 1) return max(res[0], res[1]) <|end_body_0|> <|body_start_1|> if i >= 2: res = self.getMaxSubArray(nums, i - 1) return (max(res[0], res[1]), nums[i] + max(r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def getMaxSubArray(self, nums, i): """:rtype: tuple[int,int] [0]: max within [0,i] when not ending with nums[i] [1]: max within [0,i] when ending with nums[i]""" <|body_...
stack_v2_sparse_classes_36k_train_006197
687
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSubArray", "signature": "def maxSubArray(self, nums)" }, { "docstring": ":rtype: tuple[int,int] [0]: max within [0,i] when not ending with nums[i] [1]: max within [0,i] when ending with nums[i]", "name": "getMaxSubArray", "s...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): :type nums: List[int] :rtype: int - def getMaxSubArray(self, nums, i): :rtype: tuple[int,int] [0]: max within [0,i] when not ending with nums[i] [1]:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): :type nums: List[int] :rtype: int - def getMaxSubArray(self, nums, i): :rtype: tuple[int,int] [0]: max within [0,i] when not ending with nums[i] [1]:...
f6019c6a04f6923e4ec3bb156c9ad80e6545c127
<|skeleton|> class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def getMaxSubArray(self, nums, i): """:rtype: tuple[int,int] [0]: max within [0,i] when not ending with nums[i] [1]: max within [0,i] when ending with nums[i]""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" if len(nums) == 1: return nums[0] res = self.getMaxSubArray(nums, len(nums) - 1) return max(res[0], res[1]) def getMaxSubArray(self, nums, i): """:rtype: tuple[int,int] [0]: ...
the_stack_v2_python_sparse
Algorithms/p053_Maximum_Subarray/p053_Maximum_Subarray_2.py
lbingbing/leetcode
train
0
7a843b8a94331af7a0d4a47c06e38b188d19659c
[ "super(Test200SmartSanityUi001, self).prepare()\nself.tmp = {'file': [], 'dir': []}\nself.logger.info('Preconditions:')\nself.logger.info('1. Open Micro/WIN;')", "super(Test200SmartSanityUi001, self).process()\nself.logger.info('Step actions:')\nself.logger.info('Expected results:')\nself.logger.info('1. New a pr...
<|body_start_0|> super(Test200SmartSanityUi001, self).prepare() self.tmp = {'file': [], 'dir': []} self.logger.info('Preconditions:') self.logger.info('1. Open Micro/WIN;') <|end_body_0|> <|body_start_1|> super(Test200SmartSanityUi001, self).process() self.logger.info('S...
Project No.: test_200smart_sanity_ui_001 Preconditions: 1. Open Micro/WIN; Step actions: 1. New a project; 2. Save the project; 3. Open an existed project; 4. Save as the project; 5. Close the project; Expected results: 1. Create successful; 2. Save successful; 3. Open successful; 4. Save successful; 5. Close successfu...
Test200SmartSanityUi001
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test200SmartSanityUi001: """Project No.: test_200smart_sanity_ui_001 Preconditions: 1. Open Micro/WIN; Step actions: 1. New a project; 2. Save the project; 3. Open an existed project; 4. Save as the project; 5. Close the project; Expected results: 1. Create successful; 2. Save successful; 3. Open...
stack_v2_sparse_classes_36k_train_006198
3,454
no_license
[ { "docstring": "the preparation before executing the test steps Args: Example: Return: Author: Wang, Xing Yu IsInterface: False ChangeInfo: Wang, Xing Yu 2019-10-30 create", "name": "prepare", "signature": "def prepare(self)" }, { "docstring": "execute the test steps Args: Example: Return: Autho...
3
null
Implement the Python class `Test200SmartSanityUi001` described below. Class description: Project No.: test_200smart_sanity_ui_001 Preconditions: 1. Open Micro/WIN; Step actions: 1. New a project; 2. Save the project; 3. Open an existed project; 4. Save as the project; 5. Close the project; Expected results: 1. Create ...
Implement the Python class `Test200SmartSanityUi001` described below. Class description: Project No.: test_200smart_sanity_ui_001 Preconditions: 1. Open Micro/WIN; Step actions: 1. New a project; 2. Save the project; 3. Open an existed project; 4. Save as the project; 5. Close the project; Expected results: 1. Create ...
2d3490393737b3e5f086cb6623369b988ffce67f
<|skeleton|> class Test200SmartSanityUi001: """Project No.: test_200smart_sanity_ui_001 Preconditions: 1. Open Micro/WIN; Step actions: 1. New a project; 2. Save the project; 3. Open an existed project; 4. Save as the project; 5. Close the project; Expected results: 1. Create successful; 2. Save successful; 3. Open...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test200SmartSanityUi001: """Project No.: test_200smart_sanity_ui_001 Preconditions: 1. Open Micro/WIN; Step actions: 1. New a project; 2. Save the project; 3. Open an existed project; 4. Save as the project; 5. Close the project; Expected results: 1. Create successful; 2. Save successful; 3. Open successful; ...
the_stack_v2_python_sparse
test_case/no_piling/sanity_ui/base/ui/test_200smart_sanity_ui_001.py
Lewescaiyong/auto_test_framework
train
1
f4e473994e46fb10d7249745bb3d6571b3bec214
[ "ans = []\nnums = [1] + nums + [1]\nfor i in range(1, len(nums) - 1):\n ans.append(reduce(lambda x, y: x * y, nums[:i]) * reduce(lambda x, y: x * y, nums[i + 1:]))\nreturn ans", "tmp_val = 1\ntmp = [0] * len(nums)\nfor i in range(len(nums)):\n tmp[i] = tmp_val\n tmp_val *= nums[i]\ntmp_val = 1\nfor i in ...
<|body_start_0|> ans = [] nums = [1] + nums + [1] for i in range(1, len(nums) - 1): ans.append(reduce(lambda x, y: x * y, nums[:i]) * reduce(lambda x, y: x * y, nums[i + 1:])) return ans <|end_body_0|> <|body_start_1|> tmp_val = 1 tmp = [0] * len(nums) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def productExceptSelf1(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def productExceptSelf(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ans = [] num...
stack_v2_sparse_classes_36k_train_006199
1,054
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "productExceptSelf1", "signature": "def productExceptSelf1(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "productExceptSelf", "signature": "def productExceptSelf(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def productExceptSelf1(self, nums): :type nums: List[int] :rtype: List[int] - def productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def productExceptSelf1(self, nums): :type nums: List[int] :rtype: List[int] - def productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int] <|skeleton|> class Solut...
2c47abbf020f44c97e7e439735e4b0d49f3b843f
<|skeleton|> class Solution: def productExceptSelf1(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def productExceptSelf(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def productExceptSelf1(self, nums): """:type nums: List[int] :rtype: List[int]""" ans = [] nums = [1] + nums + [1] for i in range(1, len(nums) - 1): ans.append(reduce(lambda x, y: x * y, nums[:i]) * reduce(lambda x, y: x * y, nums[i + 1:])) return ...
the_stack_v2_python_sparse
LeetCode/LeetCode238product-of-array-except-self.py
weiguangjiayou/LeetCode
train
0