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
ad03cda38b6757ced0ac89e2c3df586205499aa3
[ "x = [int(c) for c in a]\ny = [int(c) for c in b]\nif len(x) > len(y):\n x, y = (y, x)\ncarry = 0\nfor i in range(len(x)):\n y[~i] = x[~i] + y[~i] + carry\n if y[~i] >= 2:\n y[~i] -= 2\n carry = 1\n else:\n carry = 0\ni = len(x)\nwhile i < len(y) and carry:\n y[~i] = y[~i] + carr...
<|body_start_0|> x = [int(c) for c in a] y = [int(c) for c in b] if len(x) > len(y): x, y = (y, x) carry = 0 for i in range(len(x)): y[~i] = x[~i] + y[~i] + carry if y[~i] >= 2: y[~i] -= 2 carry = 1 e...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addBinary(self, a, b): """:type a: str :type b: str :rtype: str""" <|body_0|> def addBinary1(self, a, b): """:type a: str :type b: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> x = [int(c) for c in a] y = [int...
stack_v2_sparse_classes_36k_train_000100
2,097
no_license
[ { "docstring": ":type a: str :type b: str :rtype: str", "name": "addBinary", "signature": "def addBinary(self, a, b)" }, { "docstring": ":type a: str :type b: str :rtype: str", "name": "addBinary1", "signature": "def addBinary1(self, a, b)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addBinary(self, a, b): :type a: str :type b: str :rtype: str - def addBinary1(self, a, b): :type a: str :type b: str :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addBinary(self, a, b): :type a: str :type b: str :rtype: str - def addBinary1(self, a, b): :type a: str :type b: str :rtype: str <|skeleton|> class Solution: def addBin...
4a1747b6497305f3821612d9c358a6795b1690da
<|skeleton|> class Solution: def addBinary(self, a, b): """:type a: str :type b: str :rtype: str""" <|body_0|> def addBinary1(self, a, b): """:type a: str :type b: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def addBinary(self, a, b): """:type a: str :type b: str :rtype: str""" x = [int(c) for c in a] y = [int(c) for c in b] if len(x) > len(y): x, y = (y, x) carry = 0 for i in range(len(x)): y[~i] = x[~i] + y[~i] + carry ...
the_stack_v2_python_sparse
Math/q067_add_binary.py
sevenhe716/LeetCode
train
0
d5b36cf5a8606b93c54d857930836efb5157838d
[ "self.dic = {}\nself.preorder = preorder\nfor i in range(len(inorder)):\n self.dic[inorder[i]] = i\nreturn self._build_tree(0, 0, len(inorder) - 1)", "if in_left > in_right:\n return\nroot = TreeNode(self.preorder[pre_left])\nroot_index = self.dic[root.val]\nleft_len = root_index - in_left\nroot.left = self...
<|body_start_0|> self.dic = {} self.preorder = preorder for i in range(len(inorder)): self.dic[inorder[i]] = i return self._build_tree(0, 0, len(inorder) - 1) <|end_body_0|> <|body_start_1|> if in_left > in_right: return root = TreeNode(self.preor...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def buildTree(self, preorder, inorder): """time: O(N) space: O(N) Args: preorder: list[int] inorder: list[int] Return: TreeNode""" <|body_0|> def _build_tree(self, pre_left, in_left, in_right): """Args: pre_left: int in_left: int in_right: int Return: TreeN...
stack_v2_sparse_classes_36k_train_000101
2,596
no_license
[ { "docstring": "time: O(N) space: O(N) Args: preorder: list[int] inorder: list[int] Return: TreeNode", "name": "buildTree", "signature": "def buildTree(self, preorder, inorder)" }, { "docstring": "Args: pre_left: int in_left: int in_right: int Return: TreeNode", "name": "_build_tree", "s...
2
stack_v2_sparse_classes_30k_train_020880
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def buildTree(self, preorder, inorder): time: O(N) space: O(N) Args: preorder: list[int] inorder: list[int] Return: TreeNode - def _build_tree(self, pre_left, in_left, in_right):...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def buildTree(self, preorder, inorder): time: O(N) space: O(N) Args: preorder: list[int] inorder: list[int] Return: TreeNode - def _build_tree(self, pre_left, in_left, in_right):...
101bce2fac8b188a4eb2f5e017293d21ad0ecb21
<|skeleton|> class Solution: def buildTree(self, preorder, inorder): """time: O(N) space: O(N) Args: preorder: list[int] inorder: list[int] Return: TreeNode""" <|body_0|> def _build_tree(self, pre_left, in_left, in_right): """Args: pre_left: int in_left: int in_right: int Return: TreeN...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def buildTree(self, preorder, inorder): """time: O(N) space: O(N) Args: preorder: list[int] inorder: list[int] Return: TreeNode""" self.dic = {} self.preorder = preorder for i in range(len(inorder)): self.dic[inorder[i]] = i return self._build_tree...
the_stack_v2_python_sparse
code/面试题07. 重建二叉树.py
AiZhanghan/Leetcode
train
0
b2caca50b861acd136c5211fc6d478e9b6671a05
[ "self.xmax = max(self.xmax, x)\nif node.left:\n xleft = x + 1 if node.left.val == node.val + 1 else 1\n self.backtrack(xleft, node.left)\nif node.right:\n xright = x + 1 if node.right.val == node.val + 1 else 1\n self.backtrack(xright, node.right)", "self.xmax = 0\nif root:\n self.backtrack(1, root...
<|body_start_0|> self.xmax = max(self.xmax, x) if node.left: xleft = x + 1 if node.left.val == node.val + 1 else 1 self.backtrack(xleft, node.left) if node.right: xright = x + 1 if node.right.val == node.val + 1 else 1 self.backtrack(xright, node.r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def backtrack(self, x, node): """x: length of consecutive path to this node.""" <|body_0|> def longestConsecutive(self, root: TreeNode) -> int: """DFS""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.xmax = max(self.xmax, x) if...
stack_v2_sparse_classes_36k_train_000102
1,006
no_license
[ { "docstring": "x: length of consecutive path to this node.", "name": "backtrack", "signature": "def backtrack(self, x, node)" }, { "docstring": "DFS", "name": "longestConsecutive", "signature": "def longestConsecutive(self, root: TreeNode) -> int" } ]
2
stack_v2_sparse_classes_30k_train_015035
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def backtrack(self, x, node): x: length of consecutive path to this node. - def longestConsecutive(self, root: TreeNode) -> int: DFS
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def backtrack(self, x, node): x: length of consecutive path to this node. - def longestConsecutive(self, root: TreeNode) -> int: DFS <|skeleton|> class Solution: def backtr...
6043134736452a6f4704b62857d0aed2e9571164
<|skeleton|> class Solution: def backtrack(self, x, node): """x: length of consecutive path to this node.""" <|body_0|> def longestConsecutive(self, root: TreeNode) -> int: """DFS""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def backtrack(self, x, node): """x: length of consecutive path to this node.""" self.xmax = max(self.xmax, x) if node.left: xleft = x + 1 if node.left.val == node.val + 1 else 1 self.backtrack(xleft, node.left) if node.right: xright...
the_stack_v2_python_sparse
src/0200-0299/0298.longest.consecutive.path.bt.py
gyang274/leetcode
train
1
187b9ad59a5c4ec00b649a64717e7fd7d6701a83
[ "data = {'label': [], 'group_by_data': [{'seriesNum': 0, 'seriesName': '校内培训', 'data': []}, {'seriesNum': 1, 'seriesName': '校外培训', 'data': []}]}\nrandom_key = list(group_records['campus_records'].keys())[0]\nlabels = [EnumData.AGE_LABEL, EnumData.EDUCATION_BACKGROUD_LABEL, EnumData.TITLE_LABEL]\nfor label in labels...
<|body_start_0|> data = {'label': [], 'group_by_data': [{'seriesNum': 0, 'seriesName': '校内培训', 'data': []}, {'seriesNum': 1, 'seriesName': '校外培训', 'data': []}]} random_key = list(group_records['campus_records'].keys())[0] labels = [EnumData.AGE_LABEL, EnumData.EDUCATION_BACKGROUD_LABEL, EnumData...
format data for canvas
CanvasDataFormater
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CanvasDataFormater: """format data for canvas""" def format_records_statistics_data(group_records): """format records statistics data Parameters: ---------- group_records: dict { 'campus_records': dict 'off_campus_records': dict }""" <|body_0|> def format_teachers_statis...
stack_v2_sparse_classes_36k_train_000103
7,426
no_license
[ { "docstring": "format records statistics data Parameters: ---------- group_records: dict { 'campus_records': dict 'off_campus_records': dict }", "name": "format_records_statistics_data", "signature": "def format_records_statistics_data(group_records)" }, { "docstring": "format statistics data P...
4
null
Implement the Python class `CanvasDataFormater` described below. Class description: format data for canvas Method signatures and docstrings: - def format_records_statistics_data(group_records): format records statistics data Parameters: ---------- group_records: dict { 'campus_records': dict 'off_campus_records': dic...
Implement the Python class `CanvasDataFormater` described below. Class description: format data for canvas Method signatures and docstrings: - def format_records_statistics_data(group_records): format records statistics data Parameters: ---------- group_records: dict { 'campus_records': dict 'off_campus_records': dic...
48cccddbe8347167cb6120a1cd7d61f9fc57cc7c
<|skeleton|> class CanvasDataFormater: """format data for canvas""" def format_records_statistics_data(group_records): """format records statistics data Parameters: ---------- group_records: dict { 'campus_records': dict 'off_campus_records': dict }""" <|body_0|> def format_teachers_statis...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CanvasDataFormater: """format data for canvas""" def format_records_statistics_data(group_records): """format records statistics data Parameters: ---------- group_records: dict { 'campus_records': dict 'off_campus_records': dict }""" data = {'label': [], 'group_by_data': [{'seriesNum': 0,...
the_stack_v2_python_sparse
data_warehouse/services/canvas_data_formater_service.py
DLUT-SIE/TMSFTT-BE
train
1
7d260fc3f3b9de7d635f8b1acfd65fbd72ca8f14
[ "super().__init__(d_model, q, v, h, attention_size, **kwargs)\nself._chunk_size = chunk_size\nself._future_mask = nn.Parameter(torch.triu(torch.ones((self._chunk_size, self._chunk_size)), diagonal=1).bool(), requires_grad=False)\nif self._attention_size is not None:\n self._attention_mask = nn.Parameter(generate...
<|body_start_0|> super().__init__(d_model, q, v, h, attention_size, **kwargs) self._chunk_size = chunk_size self._future_mask = nn.Parameter(torch.triu(torch.ones((self._chunk_size, self._chunk_size)), diagonal=1).bool(), requires_grad=False) if self._attention_size is not None: ...
Multi Head Attention block with chunk. Given 3 inputs of shape (batch_size, K, d_model), that will be used to compute query, keys and values, we output a self attention tensor of shape (batch_size, K, d_model). Queries, keys and values are divided in chunks of constant size. Parameters ---------- d_model: Dimension of ...
MultiHeadAttentionChunk
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiHeadAttentionChunk: """Multi Head Attention block with chunk. Given 3 inputs of shape (batch_size, K, d_model), that will be used to compute query, keys and values, we output a self attention tensor of shape (batch_size, K, d_model). Queries, keys and values are divided in chunks of constant...
stack_v2_sparse_classes_36k_train_000104
13,552
permissive
[ { "docstring": "Initialize the Multi Head Block.", "name": "__init__", "signature": "def __init__(self, d_model: int, q: int, v: int, h: int, attention_size: int=None, chunk_size: Optional[int]=168, **kwargs)" }, { "docstring": "Propagate forward the input through the MHB. We compute for each he...
2
null
Implement the Python class `MultiHeadAttentionChunk` described below. Class description: Multi Head Attention block with chunk. Given 3 inputs of shape (batch_size, K, d_model), that will be used to compute query, keys and values, we output a self attention tensor of shape (batch_size, K, d_model). Queries, keys and v...
Implement the Python class `MultiHeadAttentionChunk` described below. Class description: Multi Head Attention block with chunk. Given 3 inputs of shape (batch_size, K, d_model), that will be used to compute query, keys and values, we output a self attention tensor of shape (batch_size, K, d_model). Queries, keys and v...
0b801d2d2e828ac480d1097cb3bdd82b1e25c15b
<|skeleton|> class MultiHeadAttentionChunk: """Multi Head Attention block with chunk. Given 3 inputs of shape (batch_size, K, d_model), that will be used to compute query, keys and values, we output a self attention tensor of shape (batch_size, K, d_model). Queries, keys and values are divided in chunks of constant...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiHeadAttentionChunk: """Multi Head Attention block with chunk. Given 3 inputs of shape (batch_size, K, d_model), that will be used to compute query, keys and values, we output a self attention tensor of shape (batch_size, K, d_model). Queries, keys and values are divided in chunks of constant size. Parame...
the_stack_v2_python_sparse
code/deep/adarnn/tst/multiHeadAttention.py
jindongwang/transferlearning
train
12,773
01d4256b4fad17f594b71d8aa983f6c744797115
[ "print('Loading resources...')\nself.create_chitchat_bot()\nself.intent_recognizer = unpickle_file(Path(*paths['INTENT_RECOGNIZER']))\nself.tfidf_vectorizer = unpickle_file(Path(*paths['TFIDF_VECTORIZER']))\nself.ANSWER_TEMPLATE = 'I think its about {}\\nThis thread might help you: https://stackoverflow.com/questio...
<|body_start_0|> print('Loading resources...') self.create_chitchat_bot() self.intent_recognizer = unpickle_file(Path(*paths['INTENT_RECOGNIZER'])) self.tfidf_vectorizer = unpickle_file(Path(*paths['TFIDF_VECTORIZER'])) self.ANSWER_TEMPLATE = 'I think its about {}\nThis thread mi...
Class for the dialogue manager
DialogueManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DialogueManager: """Class for the dialogue manager""" def __init__(self, paths): """Constructor for the DialogueManager - Loads the intent recognizer (is this about programming, or just chit-chatting?) - Loads the tf-idf vectorizer (the vectorizer trained on the dialogue and StackOve...
stack_v2_sparse_classes_36k_train_000105
6,341
no_license
[ { "docstring": "Constructor for the DialogueManager - Loads the intent recognizer (is this about programming, or just chit-chatting?) - Loads the tf-idf vectorizer (the vectorizer trained on the dialogue and StackOverflow thread questions) Parameters ---------- paths : dict Where the keys are names, and the val...
3
stack_v2_sparse_classes_30k_train_014169
Implement the Python class `DialogueManager` described below. Class description: Class for the dialogue manager Method signatures and docstrings: - def __init__(self, paths): Constructor for the DialogueManager - Loads the intent recognizer (is this about programming, or just chit-chatting?) - Loads the tf-idf vector...
Implement the Python class `DialogueManager` described below. Class description: Class for the dialogue manager Method signatures and docstrings: - def __init__(self, paths): Constructor for the DialogueManager - Loads the intent recognizer (is this about programming, or just chit-chatting?) - Loads the tf-idf vector...
06ae79e02a1c528c50efa26c96efe0852e4bb795
<|skeleton|> class DialogueManager: """Class for the dialogue manager""" def __init__(self, paths): """Constructor for the DialogueManager - Loads the intent recognizer (is this about programming, or just chit-chatting?) - Loads the tf-idf vectorizer (the vectorizer trained on the dialogue and StackOve...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DialogueManager: """Class for the dialogue manager""" def __init__(self, paths): """Constructor for the DialogueManager - Loads the intent recognizer (is this about programming, or just chit-chatting?) - Loads the tf-idf vectorizer (the vectorizer trained on the dialogue and StackOverflow thread ...
the_stack_v2_python_sparse
course_6_natural_language_processing/week5_dialog_systems/dialogue_manager.py
loeiten/coursera_advanced_machine_learning
train
8
a8302935955d2a76d2c1ebbd9a08730968fcecac
[ "self.interpol = interpol\nself.gatherer = gatherer\nself.pointgen = pointgen\nself.shell = shell", "self.initial_points = initial_points\nself.shell.newline()\nself.shell.dashes()\nself.shell.say('-------------------------- Gathering Initial Data Set ' + '------------------------')\nself.shell.dashes()\nself.she...
<|body_start_0|> self.interpol = interpol self.gatherer = gatherer self.pointgen = pointgen self.shell = shell <|end_body_0|> <|body_start_1|> self.initial_points = initial_points self.shell.newline() self.shell.dashes() self.shell.say('------------------...
Training
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Training: def __init__(self, interpol, gatherer, pointgen, shell): """Training must be provided with and interpolator, a 'gatherer', which may be a benchmarking program or otherwise, a point generator, and a shell.""" <|body_0|> def initialize(self, initial_points): ...
stack_v2_sparse_classes_36k_train_000106
5,207
no_license
[ { "docstring": "Training must be provided with and interpolator, a 'gatherer', which may be a benchmarking program or otherwise, a point generator, and a shell.", "name": "__init__", "signature": "def __init__(self, interpol, gatherer, pointgen, shell)" }, { "docstring": "Gather an initial set o...
4
stack_v2_sparse_classes_30k_train_000271
Implement the Python class `Training` described below. Class description: Implement the Training class. Method signatures and docstrings: - def __init__(self, interpol, gatherer, pointgen, shell): Training must be provided with and interpolator, a 'gatherer', which may be a benchmarking program or otherwise, a point ...
Implement the Python class `Training` described below. Class description: Implement the Training class. Method signatures and docstrings: - def __init__(self, interpol, gatherer, pointgen, shell): Training must be provided with and interpolator, a 'gatherer', which may be a benchmarking program or otherwise, a point ...
e5fa2f1262d7a72ab770d919cc3b9a849a577267
<|skeleton|> class Training: def __init__(self, interpol, gatherer, pointgen, shell): """Training must be provided with and interpolator, a 'gatherer', which may be a benchmarking program or otherwise, a point generator, and a shell.""" <|body_0|> def initialize(self, initial_points): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Training: def __init__(self, interpol, gatherer, pointgen, shell): """Training must be provided with and interpolator, a 'gatherer', which may be a benchmarking program or otherwise, a point generator, and a shell.""" self.interpol = interpol self.gatherer = gatherer self.point...
the_stack_v2_python_sparse
Benchmarks/Tile_Benchmarks/calibration/interpolator/lib/training.py
UFCCMT/behavioural_emulation
train
0
040721f192918114ed0ae438c061f107e3931fab
[ "self.mouse = tcod.Mouse()\nself.tile_width = tile_width\nself.tile_height = tile_height\nself.mouse_x = None\nself.mouse_y = None\nself.mouse_moved = False\nself.lclick = False\nself.rclick = False\nself.key = tcod.Key()\nself.quit = False\nself.bus = bus", "tcod.sys_check_for_event(tcod.EVENT_KEY_PRESS | tcod.E...
<|body_start_0|> self.mouse = tcod.Mouse() self.tile_width = tile_width self.tile_height = tile_height self.mouse_x = None self.mouse_y = None self.mouse_moved = False self.lclick = False self.rclick = False self.key = tcod.Key() self.quit ...
Inputs
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Inputs: def __init__(self, bus, tile_width, tile_height): """Building the input reader simply requires to give the event bus so we can write inside.""" <|body_0|> def poll(self): """Check key and mouse input.""" <|body_1|> def poll_keys(self): ""...
stack_v2_sparse_classes_36k_train_000107
4,073
no_license
[ { "docstring": "Building the input reader simply requires to give the event bus so we can write inside.", "name": "__init__", "signature": "def __init__(self, bus, tile_width, tile_height)" }, { "docstring": "Check key and mouse input.", "name": "poll", "signature": "def poll(self)" },...
4
stack_v2_sparse_classes_30k_train_009781
Implement the Python class `Inputs` described below. Class description: Implement the Inputs class. Method signatures and docstrings: - def __init__(self, bus, tile_width, tile_height): Building the input reader simply requires to give the event bus so we can write inside. - def poll(self): Check key and mouse input....
Implement the Python class `Inputs` described below. Class description: Implement the Inputs class. Method signatures and docstrings: - def __init__(self, bus, tile_width, tile_height): Building the input reader simply requires to give the event bus so we can write inside. - def poll(self): Check key and mouse input....
049141c31fc165bb5cf4b2d224b90cbe9655997c
<|skeleton|> class Inputs: def __init__(self, bus, tile_width, tile_height): """Building the input reader simply requires to give the event bus so we can write inside.""" <|body_0|> def poll(self): """Check key and mouse input.""" <|body_1|> def poll_keys(self): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Inputs: def __init__(self, bus, tile_width, tile_height): """Building the input reader simply requires to give the event bus so we can write inside.""" self.mouse = tcod.Mouse() self.tile_width = tile_width self.tile_height = tile_height self.mouse_x = None self...
the_stack_v2_python_sparse
groggy/inputs/input.py
Raveline/groggy
train
0
0d72bce6b37703c275e5706c4ec71a85eeb0efeb
[ "self.api = None\nself.user_login = None\nself.user_pass = None\nself.user_token = None\nself._login()", "home = os.path.abspath(os.environ.get('HOME', ''))\nconfig_file_path = os.path.join(home, config_file_name)\nreturn config_file_path", "config = self._github_config(self.CONFIG)\nparser = configparser.RawCo...
<|body_start_0|> self.api = None self.user_login = None self.user_pass = None self.user_token = None self._login() <|end_body_0|> <|body_start_1|> home = os.path.abspath(os.environ.get('HOME', '')) config_file_path = os.path.join(home, config_file_name) r...
Provides integration with the GitHub API. Attributes: * api: An instance of github3 to interact with the GitHub API. * CONFIG: A string representing the config file name. * CONFIG_SECTION: A string representing the main config file section. * CONFIG_USER_LOGIN: A string representing the user login config. * CONFIG_USER...
GitHub
[ "MIT", "LicenseRef-scancode-free-unknown", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GitHub: """Provides integration with the GitHub API. Attributes: * api: An instance of github3 to interact with the GitHub API. * CONFIG: A string representing the config file name. * CONFIG_SECTION: A string representing the main config file section. * CONFIG_USER_LOGIN: A string representing th...
stack_v2_sparse_classes_36k_train_000108
6,388
permissive
[ { "docstring": "Inits GitHub. Args: * None. Returns: None.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Attempts to find the github config file. Adapted from https://github.com/sigmavirus24/github-cli. Args: * config_file_name: A String that represents the config fi...
4
stack_v2_sparse_classes_30k_train_012484
Implement the Python class `GitHub` described below. Class description: Provides integration with the GitHub API. Attributes: * api: An instance of github3 to interact with the GitHub API. * CONFIG: A string representing the config file name. * CONFIG_SECTION: A string representing the main config file section. * CONF...
Implement the Python class `GitHub` described below. Class description: Provides integration with the GitHub API. Attributes: * api: An instance of github3 to interact with the GitHub API. * CONFIG: A string representing the config file name. * CONFIG_SECTION: A string representing the main config file section. * CONF...
dd27b767cdc0c667655ab8e32e020ed4248bd112
<|skeleton|> class GitHub: """Provides integration with the GitHub API. Attributes: * api: An instance of github3 to interact with the GitHub API. * CONFIG: A string representing the config file name. * CONFIG_SECTION: A string representing the main config file section. * CONFIG_USER_LOGIN: A string representing th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GitHub: """Provides integration with the GitHub API. Attributes: * api: An instance of github3 to interact with the GitHub API. * CONFIG: A string representing the config file name. * CONFIG_SECTION: A string representing the main config file section. * CONFIG_USER_LOGIN: A string representing the user login ...
the_stack_v2_python_sparse
something-learned/Cloud-Computing/AWS/01-awesome-aws/awesome/lib/github.py
agarrharr/code-rush-101
train
4
7cbdc61620c4b00c9b6d4fec96623574ffd6ffb3
[ "super(NotifyMailgun, self).__init__(**kwargs)\nself.apikey = validate_regex(apikey)\nif not self.apikey:\n msg = 'An invalid Mailgun API Key ({}) was specified.'.format(apikey)\n self.logger.warning(msg)\n raise TypeError(msg)\nif not self.user:\n msg = 'No Mailgun username was specified.'\n self.lo...
<|body_start_0|> super(NotifyMailgun, self).__init__(**kwargs) self.apikey = validate_regex(apikey) if not self.apikey: msg = 'An invalid Mailgun API Key ({}) was specified.'.format(apikey) self.logger.warning(msg) raise TypeError(msg) if not self.user...
A wrapper for Mailgun Notifications
NotifyMailgun
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotifyMailgun: """A wrapper for Mailgun Notifications""" def __init__(self, apikey, targets, from_name=None, region_name=None, **kwargs): """Initialize Mailgun Object""" <|body_0|> def send(self, body, title='', notify_type=NotifyType.INFO, **kwargs): """Perform ...
stack_v2_sparse_classes_36k_train_000109
12,916
permissive
[ { "docstring": "Initialize Mailgun Object", "name": "__init__", "signature": "def __init__(self, apikey, targets, from_name=None, region_name=None, **kwargs)" }, { "docstring": "Perform Mailgun Notification", "name": "send", "signature": "def send(self, body, title='', notify_type=Notify...
4
stack_v2_sparse_classes_30k_train_001628
Implement the Python class `NotifyMailgun` described below. Class description: A wrapper for Mailgun Notifications Method signatures and docstrings: - def __init__(self, apikey, targets, from_name=None, region_name=None, **kwargs): Initialize Mailgun Object - def send(self, body, title='', notify_type=NotifyType.INFO...
Implement the Python class `NotifyMailgun` described below. Class description: A wrapper for Mailgun Notifications Method signatures and docstrings: - def __init__(self, apikey, targets, from_name=None, region_name=None, **kwargs): Initialize Mailgun Object - def send(self, body, title='', notify_type=NotifyType.INFO...
784e073eea64d2ee37cc52e7a2391bce35b05720
<|skeleton|> class NotifyMailgun: """A wrapper for Mailgun Notifications""" def __init__(self, apikey, targets, from_name=None, region_name=None, **kwargs): """Initialize Mailgun Object""" <|body_0|> def send(self, body, title='', notify_type=NotifyType.INFO, **kwargs): """Perform ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NotifyMailgun: """A wrapper for Mailgun Notifications""" def __init__(self, apikey, targets, from_name=None, region_name=None, **kwargs): """Initialize Mailgun Object""" super(NotifyMailgun, self).__init__(**kwargs) self.apikey = validate_regex(apikey) if not self.apikey: ...
the_stack_v2_python_sparse
apprise/plugins/NotifyMailgun.py
raman325/apprise
train
1
dfc5681b10b8d6eb3b321d6b91ff592ee23f1880
[ "if amount < 1:\n return 0\nreturn self.coin_change(coins, amount, [0] * (amount + 1))", "if remainder < 0:\n return -1\n'\\n NOTE: BASE CASE\\n The minimum coins needed to make change for 0 is always 0\\n coins no matter what coins we have.\\n '\nif remainder == 0:\n return 0...
<|body_start_0|> if amount < 1: return 0 return self.coin_change(coins, amount, [0] * (amount + 1)) <|end_body_0|> <|body_start_1|> if remainder < 0: return -1 '\n NOTE: BASE CASE\n The minimum coins needed to make change for 0 is always 0\n ...
TopDownSolution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TopDownSolution: def leastCoins(self, coins, amount): """Interface ---- :type coins: list of int :type amount: int :rtype: int Approach ---- 1. We use a recursive approach 2. At each stack frame we consider what choices do we have to make and how does this get us to our goal 3. What are ...
stack_v2_sparse_classes_36k_train_000110
5,135
no_license
[ { "docstring": "Interface ---- :type coins: list of int :type amount: int :rtype: int Approach ---- 1. We use a recursive approach 2. At each stack frame we consider what choices do we have to make and how does this get us to our goal 3. What are the base cases? - When the remainder is less then 0 - When the re...
2
stack_v2_sparse_classes_30k_train_015036
Implement the Python class `TopDownSolution` described below. Class description: Implement the TopDownSolution class. Method signatures and docstrings: - def leastCoins(self, coins, amount): Interface ---- :type coins: list of int :type amount: int :rtype: int Approach ---- 1. We use a recursive approach 2. At each s...
Implement the Python class `TopDownSolution` described below. Class description: Implement the TopDownSolution class. Method signatures and docstrings: - def leastCoins(self, coins, amount): Interface ---- :type coins: list of int :type amount: int :rtype: int Approach ---- 1. We use a recursive approach 2. At each s...
c0d49423885832b616ae3c7cd58e8f24c17cfd4d
<|skeleton|> class TopDownSolution: def leastCoins(self, coins, amount): """Interface ---- :type coins: list of int :type amount: int :rtype: int Approach ---- 1. We use a recursive approach 2. At each stack frame we consider what choices do we have to make and how does this get us to our goal 3. What are ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TopDownSolution: def leastCoins(self, coins, amount): """Interface ---- :type coins: list of int :type amount: int :rtype: int Approach ---- 1. We use a recursive approach 2. At each stack frame we consider what choices do we have to make and how does this get us to our goal 3. What are the base cases...
the_stack_v2_python_sparse
dynamicProgramming/min_coins_make_change.py
miaviles/Data-Structures-Algorithms-Python
train
0
45fe5814285e36df32f860f0546176d80f9c4a0e
[ "self._on_not_found: Callable[[str, str], None] | None = None\nrel_paths = {(key_map or {}).get(key, key): file for key, file in type(self).__dict__.items() if not key.startswith('_')}\nabs_paths = {key: f'{root}/{file}' for key, file in rel_paths.items()}\nself.__dict__ = abs_paths\nsuper().__init__(abs_paths)", ...
<|body_start_0|> self._on_not_found: Callable[[str, str], None] | None = None rel_paths = {(key_map or {}).get(key, key): file for key, file in type(self).__dict__.items() if not key.startswith('_')} abs_paths = {key: f'{root}/{file}' for key, file in rel_paths.items()} self.__dict__ = a...
Files instance inherits from dict so that .values(), items(), etc. are supported but also allows accessing attributes by dot notation. E.g. FILES.wbm_summary instead of FILES["wbm_summary"]. This enables tab completion in IDEs and auto-updating attribute names across the code base when changing the key of a file.
Files
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Files: """Files instance inherits from dict so that .values(), items(), etc. are supported but also allows accessing attributes by dot notation. E.g. FILES.wbm_summary instead of FILES["wbm_summary"]. This enables tab completion in IDEs and auto-updating attribute names across the code base when ...
stack_v2_sparse_classes_36k_train_000111
10,259
permissive
[ { "docstring": "Create a Files instance. Args: root (str, optional): Root directory used to absolufy every file path. Defaults to '~/.cache/matbench-discovery/[latest_figshare_release]' where latest_figshare_release is e.g. 1.0.0. Can also be set through env var MATBENCH_DISCOVERY_CACHE_DIR. key_map (dict[str, ...
2
null
Implement the Python class `Files` described below. Class description: Files instance inherits from dict so that .values(), items(), etc. are supported but also allows accessing attributes by dot notation. E.g. FILES.wbm_summary instead of FILES["wbm_summary"]. This enables tab completion in IDEs and auto-updating att...
Implement the Python class `Files` described below. Class description: Files instance inherits from dict so that .values(), items(), etc. are supported but also allows accessing attributes by dot notation. E.g. FILES.wbm_summary instead of FILES["wbm_summary"]. This enables tab completion in IDEs and auto-updating att...
5df80efbc23541d38f9f300256cc30d92c61cbce
<|skeleton|> class Files: """Files instance inherits from dict so that .values(), items(), etc. are supported but also allows accessing attributes by dot notation. E.g. FILES.wbm_summary instead of FILES["wbm_summary"]. This enables tab completion in IDEs and auto-updating attribute names across the code base when ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Files: """Files instance inherits from dict so that .values(), items(), etc. are supported but also allows accessing attributes by dot notation. E.g. FILES.wbm_summary instead of FILES["wbm_summary"]. This enables tab completion in IDEs and auto-updating attribute names across the code base when changing the ...
the_stack_v2_python_sparse
matbench_discovery/data.py
janosh/matbench-discovery
train
30
4ac01e9db0266170690e0c450adeb2258ce5ce60
[ "super(DiscriminatorNet, self).__init__()\nself.n_features = 784\nself.n_out = 1\nself.__model_fn()\nself.optimizer = optim.Adam(self.parameters(), lr=0.0002)", "self.hidden0 = nn.Sequential(nn.Linear(self.n_features, 1024), nn.LeakyReLU(0.2), nn.Dropout(0.3))\nself.hidden1 = nn.Sequential(nn.Linear(1024, 512), n...
<|body_start_0|> super(DiscriminatorNet, self).__init__() self.n_features = 784 self.n_out = 1 self.__model_fn() self.optimizer = optim.Adam(self.parameters(), lr=0.0002) <|end_body_0|> <|body_start_1|> self.hidden0 = nn.Sequential(nn.Linear(self.n_features, 1024), nn.Le...
Class DiscriminatorNet.
DiscriminatorNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DiscriminatorNet: """Class DiscriminatorNet.""" def __init__(self): """Constructor.""" <|body_0|> def __model_fn(self): """Specifies the network.""" <|body_1|> def forward(self, X): """Performs a forward-pass on the data. :param X: network in...
stack_v2_sparse_classes_36k_train_000112
11,950
no_license
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Specifies the network.", "name": "__model_fn", "signature": "def __model_fn(self)" }, { "docstring": "Performs a forward-pass on the data. :param X: network input", "name":...
3
stack_v2_sparse_classes_30k_train_004924
Implement the Python class `DiscriminatorNet` described below. Class description: Class DiscriminatorNet. Method signatures and docstrings: - def __init__(self): Constructor. - def __model_fn(self): Specifies the network. - def forward(self, X): Performs a forward-pass on the data. :param X: network input
Implement the Python class `DiscriminatorNet` described below. Class description: Class DiscriminatorNet. Method signatures and docstrings: - def __init__(self): Constructor. - def __model_fn(self): Specifies the network. - def forward(self, X): Performs a forward-pass on the data. :param X: network input <|skeleton...
98b71b76f664d5f6493bd7f90036531d8f6644a7
<|skeleton|> class DiscriminatorNet: """Class DiscriminatorNet.""" def __init__(self): """Constructor.""" <|body_0|> def __model_fn(self): """Specifies the network.""" <|body_1|> def forward(self, X): """Performs a forward-pass on the data. :param X: network in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DiscriminatorNet: """Class DiscriminatorNet.""" def __init__(self): """Constructor.""" super(DiscriminatorNet, self).__init__() self.n_features = 784 self.n_out = 1 self.__model_fn() self.optimizer = optim.Adam(self.parameters(), lr=0.0002) def __model...
the_stack_v2_python_sparse
06_python/misc/gan.py
pfisterer/Applied_ML_Fundamentals
train
0
0e160113b3b1ac49d900309bd380978b70a76ef0
[ "self.log = LogHandler(logger=logger)\nser = serial.Serial(port=port, baudrate=9600, timeout=1, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS)\nself.sio = io.TextIOWrapper(io.BufferedRWPair(ser, ser))\ninit_pressure = self.get_pressure()\nself.log.info(f'Successfully reading {in...
<|body_start_0|> self.log = LogHandler(logger=logger) ser = serial.Serial(port=port, baudrate=9600, timeout=1, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS) self.sio = io.TextIOWrapper(io.BufferedRWPair(ser, ser)) init_pressure = self.get_pressure() ...
AGC_100
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AGC_100: def __init__(self, port, logger=None): """Instantiates serial connection to pressure gauge""" <|body_0|> def get_pressure(self): """Returns pressure in mBar""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.log = LogHandler(logger=logger...
stack_v2_sparse_classes_36k_train_000113
939
permissive
[ { "docstring": "Instantiates serial connection to pressure gauge", "name": "__init__", "signature": "def __init__(self, port, logger=None)" }, { "docstring": "Returns pressure in mBar", "name": "get_pressure", "signature": "def get_pressure(self)" } ]
2
null
Implement the Python class `AGC_100` described below. Class description: Implement the AGC_100 class. Method signatures and docstrings: - def __init__(self, port, logger=None): Instantiates serial connection to pressure gauge - def get_pressure(self): Returns pressure in mBar
Implement the Python class `AGC_100` described below. Class description: Implement the AGC_100 class. Method signatures and docstrings: - def __init__(self, port, logger=None): Instantiates serial connection to pressure gauge - def get_pressure(self): Returns pressure in mBar <|skeleton|> class AGC_100: def __i...
c8794a342d30119a6be93b2dd30ea61b5c946d8a
<|skeleton|> class AGC_100: def __init__(self, port, logger=None): """Instantiates serial connection to pressure gauge""" <|body_0|> def get_pressure(self): """Returns pressure in mBar""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AGC_100: def __init__(self, port, logger=None): """Instantiates serial connection to pressure gauge""" self.log = LogHandler(logger=logger) ser = serial.Serial(port=port, baudrate=9600, timeout=1, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS) ...
the_stack_v2_python_sparse
pylabnet/hardware/pressure_gauge/agc_100.py
lukingroup/pylabnet
train
15
98140917a74b692d3f3d75c92dcf992fcff49e5d
[ "self.event_domain = event_domain\nself.params = params\nself.max_sent_length = params.get_int('max_sent_length')\nself.statistics = defaultdict(int)", "self.statistics.clear()\nexamples = []\n':type: list[nlplingo.tasks.event_sentence.EventSentenceExample]'\nfor doc in docs:\n for sent in doc.sentences:\n ...
<|body_start_0|> self.event_domain = event_domain self.params = params self.max_sent_length = params.get_int('max_sent_length') self.statistics = defaultdict(int) <|end_body_0|> <|body_start_1|> self.statistics.clear() examples = [] ':type: list[nlplingo.tasks.ev...
EventSentenceGenerator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EventSentenceGenerator: def __init__(self, event_domain, params): """:type event_domain: nlplingo.event.event_domain.EventDomain :type params: nlplingo.common.parameters.Parameters""" <|body_0|> def generate(self, docs): """:type docs: list[nlplingo.text.text_theory....
stack_v2_sparse_classes_36k_train_000114
6,318
permissive
[ { "docstring": ":type event_domain: nlplingo.event.event_domain.EventDomain :type params: nlplingo.common.parameters.Parameters", "name": "__init__", "signature": "def __init__(self, event_domain, params)" }, { "docstring": ":type docs: list[nlplingo.text.text_theory.Document]", "name": "gen...
6
null
Implement the Python class `EventSentenceGenerator` described below. Class description: Implement the EventSentenceGenerator class. Method signatures and docstrings: - def __init__(self, event_domain, params): :type event_domain: nlplingo.event.event_domain.EventDomain :type params: nlplingo.common.parameters.Paramet...
Implement the Python class `EventSentenceGenerator` described below. Class description: Implement the EventSentenceGenerator class. Method signatures and docstrings: - def __init__(self, event_domain, params): :type event_domain: nlplingo.event.event_domain.EventDomain :type params: nlplingo.common.parameters.Paramet...
32ff17b1320937faa3d3ebe727032f4b3e7a353d
<|skeleton|> class EventSentenceGenerator: def __init__(self, event_domain, params): """:type event_domain: nlplingo.event.event_domain.EventDomain :type params: nlplingo.common.parameters.Parameters""" <|body_0|> def generate(self, docs): """:type docs: list[nlplingo.text.text_theory....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EventSentenceGenerator: def __init__(self, event_domain, params): """:type event_domain: nlplingo.event.event_domain.EventDomain :type params: nlplingo.common.parameters.Parameters""" self.event_domain = event_domain self.params = params self.max_sent_length = params.get_int('m...
the_stack_v2_python_sparse
nlplingo/sandbox/misc/event_sentence.py
BBN-E/nlplingo
train
3
e6cda8c5842637fb7563c576797a75381c898f84
[ "if isinstance(obj, SecuritySavings):\n return SecuritySavingsSerializer(obj, context=self.context).to_representation(obj)\nelif isinstance(obj, SecurityShares):\n return SecuritySharesSerializer(obj, context=self.context).to_representation(obj)\nelif isinstance(obj, SecurityArticle):\n return SecurityArti...
<|body_start_0|> if isinstance(obj, SecuritySavings): return SecuritySavingsSerializer(obj, context=self.context).to_representation(obj) elif isinstance(obj, SecurityShares): return SecuritySharesSerializer(obj, context=self.context).to_representation(obj) elif isinstance...
SecuritySerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SecuritySerializer: def to_representation(self, obj): """The Serializer is selected depending on the type of security""" <|body_0|> def to_internal_value(self, data): """The Serializer is selected depending on the type of security""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k_train_000115
4,478
no_license
[ { "docstring": "The Serializer is selected depending on the type of security", "name": "to_representation", "signature": "def to_representation(self, obj)" }, { "docstring": "The Serializer is selected depending on the type of security", "name": "to_internal_value", "signature": "def to_...
2
stack_v2_sparse_classes_30k_val_000488
Implement the Python class `SecuritySerializer` described below. Class description: Implement the SecuritySerializer class. Method signatures and docstrings: - def to_representation(self, obj): The Serializer is selected depending on the type of security - def to_internal_value(self, data): The Serializer is selected...
Implement the Python class `SecuritySerializer` described below. Class description: Implement the SecuritySerializer class. Method signatures and docstrings: - def to_representation(self, obj): The Serializer is selected depending on the type of security - def to_internal_value(self, data): The Serializer is selected...
c5ac11e40a628c93c3865363e97b4f255a104ca8
<|skeleton|> class SecuritySerializer: def to_representation(self, obj): """The Serializer is selected depending on the type of security""" <|body_0|> def to_internal_value(self, data): """The Serializer is selected depending on the type of security""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SecuritySerializer: def to_representation(self, obj): """The Serializer is selected depending on the type of security""" if isinstance(obj, SecuritySavings): return SecuritySavingsSerializer(obj, context=self.context).to_representation(obj) elif isinstance(obj, SecurityShar...
the_stack_v2_python_sparse
loans/serializers.py
lubegamark/gosacco
train
2
ba5a4e19bc1af156ac0e7caf39cf21953f8089f7
[ "super().__init__()\nself._encoder = Encoder(layer_spec_input_res, layer_spec_target_res, kernel_size, initial_filters, filters_cap, encoding_dimension)\nself._decoder = Decoder(layer_spec_target_res, layer_spec_input_res, kernel_size, filters_cap, initial_filters, channels)", "encoding = self._encoder(inputs, tr...
<|body_start_0|> super().__init__() self._encoder = Encoder(layer_spec_input_res, layer_spec_target_res, kernel_size, initial_filters, filters_cap, encoding_dimension) self._decoder = Decoder(layer_spec_target_res, layer_spec_input_res, kernel_size, filters_cap, initial_filters, channels) <|end_...
Primitive Model for all convolutional autoencoders. Examples: * Direct Usage: .. testcode:: autoencoder = Autoencoder( layer_spec_input_res=(64, 64), layer_spec_target_res=(8, 8), kernel_size=5, initial_filters=32, filters_cap=128, encoding_dimension=100, channels=3, ) encoding, reconstruction = autoencoder(tf.zeros((1...
Autoencoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Autoencoder: """Primitive Model for all convolutional autoencoders. Examples: * Direct Usage: .. testcode:: autoencoder = Autoencoder( layer_spec_input_res=(64, 64), layer_spec_target_res=(8, 8), kernel_size=5, initial_filters=32, filters_cap=128, encoding_dimension=100, channels=3, ) encoding, r...
stack_v2_sparse_classes_36k_train_000116
6,511
permissive
[ { "docstring": "Instantiate the :py:class:`BaseAutoEncoder`. Args: layer_spec_input_res (:obj:`tuple` of (:obj:`int`, :obj:`int`)): Shape of the input tensors. layer_spec_target_res: (:obj:`tuple` of (:obj:`int`, :obj:`int`)): Shape of tensor desired as output of :func:`_get_layer_spec`. kernel_size (int): Kern...
2
stack_v2_sparse_classes_30k_train_016512
Implement the Python class `Autoencoder` described below. Class description: Primitive Model for all convolutional autoencoders. Examples: * Direct Usage: .. testcode:: autoencoder = Autoencoder( layer_spec_input_res=(64, 64), layer_spec_target_res=(8, 8), kernel_size=5, initial_filters=32, filters_cap=128, encoding_d...
Implement the Python class `Autoencoder` described below. Class description: Primitive Model for all convolutional autoencoders. Examples: * Direct Usage: .. testcode:: autoencoder = Autoencoder( layer_spec_input_res=(64, 64), layer_spec_target_res=(8, 8), kernel_size=5, initial_filters=32, filters_cap=128, encoding_d...
92ac86fb0c962854e0d80c44165e0e7ff126b3c1
<|skeleton|> class Autoencoder: """Primitive Model for all convolutional autoencoders. Examples: * Direct Usage: .. testcode:: autoencoder = Autoencoder( layer_spec_input_res=(64, 64), layer_spec_target_res=(8, 8), kernel_size=5, initial_filters=32, filters_cap=128, encoding_dimension=100, channels=3, ) encoding, r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Autoencoder: """Primitive Model for all convolutional autoencoders. Examples: * Direct Usage: .. testcode:: autoencoder = Autoencoder( layer_spec_input_res=(64, 64), layer_spec_target_res=(8, 8), kernel_size=5, initial_filters=32, filters_cap=128, encoding_dimension=100, channels=3, ) encoding, reconstruction...
the_stack_v2_python_sparse
src/ashpy/models/convolutional/autoencoders.py
zurutech/ashpy
train
89
e27d87eaf11730efd6ab4859a71433ef6fd3ebc7
[ "Xth = len(nums1) + len(nums2)\nif Xth / 2 == Xth // 2:\n return (self.findXthSortedArrarys(nums1, nums2, Xth // 2) + self.findXthSortedArrarys(nums1, nums2, Xth // 2 + 1)) / 2\nelse:\n return self.findXthSortedArrarys(nums1, nums2, Xth // 2 + 1)", "if Xth > len(nums1) + len(nums2):\n return -1\nto_drop_...
<|body_start_0|> Xth = len(nums1) + len(nums2) if Xth / 2 == Xth // 2: return (self.findXthSortedArrarys(nums1, nums2, Xth // 2) + self.findXthSortedArrarys(nums1, nums2, Xth // 2 + 1)) / 2 else: return self.findXthSortedArrarys(nums1, nums2, Xth // 2 + 1) <|end_body_0|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" <|body_0|> def findXthSortedArrarys(self, nums1, nums2, Xth=None): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" <|...
stack_v2_sparse_classes_36k_train_000117
1,819
no_license
[ { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: float", "name": "findMedianSortedArrays", "signature": "def findMedianSortedArrays(self, nums1, nums2)" }, { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: float", "name": "findXthSortedArrarys", "...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: float - def findXthSortedArrarys(self, nums1, nums2, Xth=None): :type nums1:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: float - def findXthSortedArrarys(self, nums1, nums2, Xth=None): :type nums1:...
d6ddbef76dd8630234f669d272d1f8065c6be128
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" <|body_0|> def findXthSortedArrarys(self, nums1, nums2, Xth=None): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" Xth = len(nums1) + len(nums2) if Xth / 2 == Xth // 2: return (self.findXthSortedArrarys(nums1, nums2, Xth // 2) + self.findXthSortedArrarys(nums1, num...
the_stack_v2_python_sparse
4_findMedianSortedArrays.py
Mang0o/leetcode
train
0
a4c77e6f218bde221ccf02bb1acd23a757f7a586
[ "super().__init__(coordinator)\ndescription = SENSOR_TYPES[kind]\nself._attrs: dict[str, Any] = {}\nself._attr_device_class = description.get(ATTR_DEVICE_CLASS)\nself._attr_device_info = device_info\nself._attr_entity_registry_enabled_default = description[ATTR_ENABLED]\nself._attr_icon = description[ATTR_ICON]\nse...
<|body_start_0|> super().__init__(coordinator) description = SENSOR_TYPES[kind] self._attrs: dict[str, Any] = {} self._attr_device_class = description.get(ATTR_DEVICE_CLASS) self._attr_device_info = device_info self._attr_entity_registry_enabled_default = description[ATTR...
Define an Brother Printer sensor.
BrotherPrinterSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BrotherPrinterSensor: """Define an Brother Printer sensor.""" def __init__(self, coordinator: BrotherDataUpdateCoordinator, kind: str, device_info: DeviceInfo) -> None: """Initialize.""" <|body_0|> def state(self) -> Any: """Return the state.""" <|body_1|...
stack_v2_sparse_classes_36k_train_000118
3,217
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, coordinator: BrotherDataUpdateCoordinator, kind: str, device_info: DeviceInfo) -> None" }, { "docstring": "Return the state.", "name": "state", "signature": "def state(self) -> Any" }, { "docstring...
3
null
Implement the Python class `BrotherPrinterSensor` described below. Class description: Define an Brother Printer sensor. Method signatures and docstrings: - def __init__(self, coordinator: BrotherDataUpdateCoordinator, kind: str, device_info: DeviceInfo) -> None: Initialize. - def state(self) -> Any: Return the state....
Implement the Python class `BrotherPrinterSensor` described below. Class description: Define an Brother Printer sensor. Method signatures and docstrings: - def __init__(self, coordinator: BrotherDataUpdateCoordinator, kind: str, device_info: DeviceInfo) -> None: Initialize. - def state(self) -> Any: Return the state....
2fee32fce03bc49e86cf2e7b741a15621a97cce5
<|skeleton|> class BrotherPrinterSensor: """Define an Brother Printer sensor.""" def __init__(self, coordinator: BrotherDataUpdateCoordinator, kind: str, device_info: DeviceInfo) -> None: """Initialize.""" <|body_0|> def state(self) -> Any: """Return the state.""" <|body_1|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BrotherPrinterSensor: """Define an Brother Printer sensor.""" def __init__(self, coordinator: BrotherDataUpdateCoordinator, kind: str, device_info: DeviceInfo) -> None: """Initialize.""" super().__init__(coordinator) description = SENSOR_TYPES[kind] self._attrs: dict[str, ...
the_stack_v2_python_sparse
homeassistant/components/brother/sensor.py
BenWoodford/home-assistant
train
11
5d1aadb7c69aab49f4a3ba6a4c20d9919aaa38fb
[ "iqCustomComboCtrl.__init__(self, *args, **kwargs)\nself.choice = list()\nself.filter_env = None\nself.choice_idx = -1\nself.data = None", "if data is None:\n self.data = list()\nelse:\n self.data = data\n choice = [element['description'] for element in self.data]\n self.setChoice(choice)\nreturn self...
<|body_start_0|> iqCustomComboCtrl.__init__(self, *args, **kwargs) self.choice = list() self.filter_env = None self.choice_idx = -1 self.data = None <|end_body_0|> <|body_start_1|> if data is None: self.data = list() else: self.data = data...
The control class is an extended selection from the specified list.
iqCustomChoice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class iqCustomChoice: """The control class is an extended selection from the specified list.""" def __init__(self, *args, **kwargs): """Constructor.""" <|body_0|> def setData(self, data=None): """Set data.""" <|body_1|> def setChoice(self, choice=None): ...
stack_v2_sparse_classes_36k_train_000119
19,825
no_license
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Set data.", "name": "setData", "signature": "def setData(self, data=None)" }, { "docstring": "Set choices.", "name": "setChoice", "signature": "def set...
4
null
Implement the Python class `iqCustomChoice` described below. Class description: The control class is an extended selection from the specified list. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Constructor. - def setData(self, data=None): Set data. - def setChoice(self, choice=None): Set ch...
Implement the Python class `iqCustomChoice` described below. Class description: The control class is an extended selection from the specified list. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Constructor. - def setData(self, data=None): Set data. - def setChoice(self, choice=None): Set ch...
7550e242746cb2fb1219474463f8db21f8e3e114
<|skeleton|> class iqCustomChoice: """The control class is an extended selection from the specified list.""" def __init__(self, *args, **kwargs): """Constructor.""" <|body_0|> def setData(self, data=None): """Set data.""" <|body_1|> def setChoice(self, choice=None): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class iqCustomChoice: """The control class is an extended selection from the specified list.""" def __init__(self, *args, **kwargs): """Constructor.""" iqCustomComboCtrl.__init__(self, *args, **kwargs) self.choice = list() self.filter_env = None self.choice_idx = -1 ...
the_stack_v2_python_sparse
iq/components/wx_filterchoicectrl/filter_builder_ctrl.py
XHermitOne/iq_framework
train
1
d15d3c0d50820b63dd4b4dee44cd473f17f6cdce
[ "super(ProjectQueueManager, self).__init__()\nself.zk_client = zk_client\nself.project_id = project_id\nproject_dsn_node = '/appscale/projects/{}/postgres_dsn'.format(project_id)\nglobal_dsn_node = '/appscale/tasks/postgres_dsn'\nif self.zk_client.exists(project_dsn_node):\n pg_dsn = self.zk_client.get(project_d...
<|body_start_0|> super(ProjectQueueManager, self).__init__() self.zk_client = zk_client self.project_id = project_id project_dsn_node = '/appscale/projects/{}/postgres_dsn'.format(project_id) global_dsn_node = '/appscale/tasks/postgres_dsn' if self.zk_client.exists(projec...
Keeps track of queue configuration details for a single project.
ProjectQueueManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectQueueManager: """Keeps track of queue configuration details for a single project.""" def __init__(self, zk_client, project_id): """Creates a new ProjectQueueManager. Args: zk_client: A KazooClient. project_id: A string specifying a project ID.""" <|body_0|> def up...
stack_v2_sparse_classes_36k_train_000120
7,391
permissive
[ { "docstring": "Creates a new ProjectQueueManager. Args: zk_client: A KazooClient. project_id: A string specifying a project ID.", "name": "__init__", "signature": "def __init__(self, zk_client, project_id)" }, { "docstring": "Caches new configuration details and cleans up old state. Args: queue...
6
stack_v2_sparse_classes_30k_train_015179
Implement the Python class `ProjectQueueManager` described below. Class description: Keeps track of queue configuration details for a single project. Method signatures and docstrings: - def __init__(self, zk_client, project_id): Creates a new ProjectQueueManager. Args: zk_client: A KazooClient. project_id: A string s...
Implement the Python class `ProjectQueueManager` described below. Class description: Keeps track of queue configuration details for a single project. Method signatures and docstrings: - def __init__(self, zk_client, project_id): Creates a new ProjectQueueManager. Args: zk_client: A KazooClient. project_id: A string s...
be17e5f658d7b42b5aa7eeb7a5ddd4962f3ea82f
<|skeleton|> class ProjectQueueManager: """Keeps track of queue configuration details for a single project.""" def __init__(self, zk_client, project_id): """Creates a new ProjectQueueManager. Args: zk_client: A KazooClient. project_id: A string specifying a project ID.""" <|body_0|> def up...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProjectQueueManager: """Keeps track of queue configuration details for a single project.""" def __init__(self, zk_client, project_id): """Creates a new ProjectQueueManager. Args: zk_client: A KazooClient. project_id: A string specifying a project ID.""" super(ProjectQueueManager, self).__...
the_stack_v2_python_sparse
AppTaskQueue/appscale/taskqueue/queue_manager.py
obino/appscale
train
1
71c46eab5e499496a2392bc6e1d452ee44cbb960
[ "toolshed_name = 'toolshed.g2.bx.psu.edu/repos/jjohnson/igvtools/igvtools_tile/1.0'\nshort_name = 'igvtools_tile'\nself.assertEqual(galaxy_workflow.parse_tool_name(toolshed_name), short_name)", "name = 'igvtools_tile'\nshort_name = 'igvtools_tile'\nself.assertEqual(galaxy_workflow.parse_tool_name(name), short_nam...
<|body_start_0|> toolshed_name = 'toolshed.g2.bx.psu.edu/repos/jjohnson/igvtools/igvtools_tile/1.0' short_name = 'igvtools_tile' self.assertEqual(galaxy_workflow.parse_tool_name(toolshed_name), short_name) <|end_body_0|> <|body_start_1|> name = 'igvtools_tile' short_name = 'igvt...
Test all functions in the galaxy_workflow module
GalaxyWorkflowTest
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GalaxyWorkflowTest: """Test all functions in the galaxy_workflow module""" def test_parse_tool_name_full(self): """Test with a toolshed name""" <|body_0|> def test_parse_tool_name_short(self): """Test with a non-toolshed name""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k_train_000121
738
permissive
[ { "docstring": "Test with a toolshed name", "name": "test_parse_tool_name_full", "signature": "def test_parse_tool_name_full(self)" }, { "docstring": "Test with a non-toolshed name", "name": "test_parse_tool_name_short", "signature": "def test_parse_tool_name_short(self)" } ]
2
stack_v2_sparse_classes_30k_train_017718
Implement the Python class `GalaxyWorkflowTest` described below. Class description: Test all functions in the galaxy_workflow module Method signatures and docstrings: - def test_parse_tool_name_full(self): Test with a toolshed name - def test_parse_tool_name_short(self): Test with a non-toolshed name
Implement the Python class `GalaxyWorkflowTest` described below. Class description: Test all functions in the galaxy_workflow module Method signatures and docstrings: - def test_parse_tool_name_full(self): Test with a toolshed name - def test_parse_tool_name_short(self): Test with a non-toolshed name <|skeleton|> cl...
fca97c904be407c6619608e13437f25a9fc9e979
<|skeleton|> class GalaxyWorkflowTest: """Test all functions in the galaxy_workflow module""" def test_parse_tool_name_full(self): """Test with a toolshed name""" <|body_0|> def test_parse_tool_name_short(self): """Test with a non-toolshed name""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GalaxyWorkflowTest: """Test all functions in the galaxy_workflow module""" def test_parse_tool_name_full(self): """Test with a toolshed name""" toolshed_name = 'toolshed.g2.bx.psu.edu/repos/jjohnson/igvtools/igvtools_tile/1.0' short_name = 'igvtools_tile' self.assertEqual(...
the_stack_v2_python_sparse
refinery/galaxy_connector/tests.py
ShuhratBek/refinery-platform
train
1
a2f72edc82606e21cf58be2fa1e349e4938d1a49
[ "self.start_number = start_number\nself.rename_pairs = []\nself.zfillsize = None\nself.process_rename()", "files = os.listdir('.')\nsorted(files)\ntotal_files = len(files)\nself.zfillsize = len(str(total_files))\nfileseq = self.start_number\nfor i, filename in enumerate(files):\n new_filename = str(fileseq).zf...
<|body_start_0|> self.start_number = start_number self.rename_pairs = [] self.zfillsize = None self.process_rename() <|end_body_0|> <|body_start_1|> files = os.listdir('.') sorted(files) total_files = len(files) self.zfillsize = len(str(total_files)) ...
This class takes a start number as parameter, loops thru all files on folder, prefixes numbers sequencially to all files, asks rename confirmation, if confirmed, renames all files on folder.
Renamer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Renamer: """This class takes a start number as parameter, loops thru all files on folder, prefixes numbers sequencially to all files, asks rename confirmation, if confirmed, renames all files on folder.""" def __init__(self, start_number): """start_number determines the first prefix ...
stack_v2_sparse_classes_36k_train_000122
2,741
no_license
[ { "docstring": "start_number determines the first prefix number for renames The numbering goes along the alphanumeric ordering given by sorted(files)", "name": "__init__", "signature": "def __init__(self, start_number)" }, { "docstring": "Prepare renames", "name": "prep_rename", "signatu...
5
stack_v2_sparse_classes_30k_train_016903
Implement the Python class `Renamer` described below. Class description: This class takes a start number as parameter, loops thru all files on folder, prefixes numbers sequencially to all files, asks rename confirmation, if confirmed, renames all files on folder. Method signatures and docstrings: - def __init__(self,...
Implement the Python class `Renamer` described below. Class description: This class takes a start number as parameter, loops thru all files on folder, prefixes numbers sequencially to all files, asks rename confirmation, if confirmed, renames all files on folder. Method signatures and docstrings: - def __init__(self,...
b4c5642c8d5843846d529630f8d93a7103676539
<|skeleton|> class Renamer: """This class takes a start number as parameter, loops thru all files on folder, prefixes numbers sequencially to all files, asks rename confirmation, if confirmed, renames all files on folder.""" def __init__(self, start_number): """start_number determines the first prefix ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Renamer: """This class takes a start number as parameter, loops thru all files on folder, prefixes numbers sequencially to all files, asks rename confirmation, if confirmed, renames all files on folder.""" def __init__(self, start_number): """start_number determines the first prefix number for re...
the_stack_v2_python_sparse
renameNumberPrefix.py
alclass/bin
train
0
c8c975b5de40c3c6b78dbebe52dea33b098d6e43
[ "def maxLengthBeforeI(num):\n lstBeforeI = [dp[j] for j in range(num) if nums[j] < nums[i]]\n return max(lstBeforeI) if lstBeforeI else 0\nn = len(nums)\ndp = [0] * n\ndp[0] = 1\nfor i in range(1, n):\n dp[i] = 1 + maxLengthBeforeI(i)\nreturn max(dp)", "if not nums:\n return 0\ndp = []\nfor i in range...
<|body_start_0|> def maxLengthBeforeI(num): lstBeforeI = [dp[j] for j in range(num) if nums[j] < nums[i]] return max(lstBeforeI) if lstBeforeI else 0 n = len(nums) dp = [0] * n dp[0] = 1 for i in range(1, n): dp[i] = 1 + maxLengthBeforeI(i) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" ...
stack_v2_sparse_classes_36k_train_000123
2,098
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "lengthOfLIS", "signature": "def lengthOfLIS(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "lengthOfLIS", "signature": "def lengthOfLIS(self, nums)" }, { "docstring": ":type nums: List[int] ...
4
stack_v2_sparse_classes_30k_val_000790
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int - def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int - def lengthOfLIS(self, nums): :type nums: List[in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int - def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int - def lengthOfLIS(self, nums): :type nums: List[in...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" def maxLengthBeforeI(num): lstBeforeI = [dp[j] for j in range(num) if nums[j] < nums[i]] return max(lstBeforeI) if lstBeforeI else 0 n = len(nums) dp = [0] * n dp[0] =...
the_stack_v2_python_sparse
0300_Longest_Increasing_Subsequence.py
bingli8802/leetcode
train
0
0d20c6f7ff0f58faade08b1e5b77340fd3878fec
[ "self.am_coeffs = None\nself.alt_coeffs = None\nself.reference_transmission = 1.0\nself.poly_am = None\nself.poly_alt = None\nself.configure_options(options)", "if not isinstance(options, dict):\n raise ValueError(f'Options must be a {dict}. Received {options}.')\nam_coeffs = get_float_list(options.get('amcoe...
<|body_start_0|> self.am_coeffs = None self.alt_coeffs = None self.reference_transmission = 1.0 self.poly_am = None self.poly_alt = None self.configure_options(options) <|end_body_0|> <|body_start_1|> if not isinstance(options, dict): raise ValueError...
AtranModel
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AtranModel: def __init__(self, options): """Initialize the ATRAN model for SOFIA. The ATRAN model is used to derive the relative transmission correction factor for a given altitude above the Earth's surface, observing a source at a given elevation. This can be used to determine the atmos...
stack_v2_sparse_classes_36k_train_000124
6,143
permissive
[ { "docstring": "Initialize the ATRAN model for SOFIA. The ATRAN model is used to derive the relative transmission correction factor for a given altitude above the Earth's surface, observing a source at a given elevation. This can be used to determine the atmospheric opacity. Please see :func:`AtranModel.get_rel...
4
stack_v2_sparse_classes_30k_train_010373
Implement the Python class `AtranModel` described below. Class description: Implement the AtranModel class. Method signatures and docstrings: - def __init__(self, options): Initialize the ATRAN model for SOFIA. The ATRAN model is used to derive the relative transmission correction factor for a given altitude above th...
Implement the Python class `AtranModel` described below. Class description: Implement the AtranModel class. Method signatures and docstrings: - def __init__(self, options): Initialize the ATRAN model for SOFIA. The ATRAN model is used to derive the relative transmission correction factor for a given altitude above th...
493700340cd34d5f319af6f3a562a82135bb30dd
<|skeleton|> class AtranModel: def __init__(self, options): """Initialize the ATRAN model for SOFIA. The ATRAN model is used to derive the relative transmission correction factor for a given altitude above the Earth's surface, observing a source at a given elevation. This can be used to determine the atmos...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AtranModel: def __init__(self, options): """Initialize the ATRAN model for SOFIA. The ATRAN model is used to derive the relative transmission correction factor for a given altitude above the Earth's surface, observing a source at a given elevation. This can be used to determine the atmospheric opacity...
the_stack_v2_python_sparse
sofia_redux/scan/custom/sofia/integration/models/atran.py
SOFIA-USRA/sofia_redux
train
12
0f6e53c6a63858aefee4676e267f685aa1a01006
[ "self.id = id\nself.backup_run_type = backup_run_type\nself.copy_partial = copy_partial\nself.datalock_config = datalock_config\nself.days_to_keep = days_to_keep\nself.multiplier = multiplier\nself.periodicity = periodicity\nself.source_cluster_id = source_cluster_id\nself.target = target", "if dictionary is None...
<|body_start_0|> self.id = id self.backup_run_type = backup_run_type self.copy_partial = copy_partial self.datalock_config = datalock_config self.days_to_keep = days_to_keep self.multiplier = multiplier self.periodicity = periodicity self.source_cluster_id...
Implementation of the 'SnapshotArchivalCopyPolicy' model. Specifies settings for copying Snapshots External Targets (such as AWS or Tape). This also specifies the retention policy that should be applied to Snapshots after they have been copied to the specified target. Attributes: id (string): Specified the Id for a sna...
SnapshotArchivalCopyPolicy
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnapshotArchivalCopyPolicy: """Implementation of the 'SnapshotArchivalCopyPolicy' model. Specifies settings for copying Snapshots External Targets (such as AWS or Tape). This also specifies the retention policy that should be applied to Snapshots after they have been copied to the specified targe...
stack_v2_sparse_classes_36k_train_000125
7,301
permissive
[ { "docstring": "Constructor for the SnapshotArchivalCopyPolicy class", "name": "__init__", "signature": "def __init__(self, id=None, backup_run_type=None, copy_partial=None, datalock_config=None, days_to_keep=None, multiplier=None, periodicity=None, source_cluster_id=None, target=None)" }, { "do...
2
null
Implement the Python class `SnapshotArchivalCopyPolicy` described below. Class description: Implementation of the 'SnapshotArchivalCopyPolicy' model. Specifies settings for copying Snapshots External Targets (such as AWS or Tape). This also specifies the retention policy that should be applied to Snapshots after they ...
Implement the Python class `SnapshotArchivalCopyPolicy` described below. Class description: Implementation of the 'SnapshotArchivalCopyPolicy' model. Specifies settings for copying Snapshots External Targets (such as AWS or Tape). This also specifies the retention policy that should be applied to Snapshots after they ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class SnapshotArchivalCopyPolicy: """Implementation of the 'SnapshotArchivalCopyPolicy' model. Specifies settings for copying Snapshots External Targets (such as AWS or Tape). This also specifies the retention policy that should be applied to Snapshots after they have been copied to the specified targe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SnapshotArchivalCopyPolicy: """Implementation of the 'SnapshotArchivalCopyPolicy' model. Specifies settings for copying Snapshots External Targets (such as AWS or Tape). This also specifies the retention policy that should be applied to Snapshots after they have been copied to the specified target. Attributes...
the_stack_v2_python_sparse
cohesity_management_sdk/models/snapshot_archival_copy_policy.py
cohesity/management-sdk-python
train
24
0efe5d502ffa1cb9a3ed2551e6d24b833f646ec0
[ "dp = [float('inf')] * (T + 1)\ndp[0] = 0\npre = [float('inf')] * (100 + 1)\nfor l, r in clips:\n for j in range(l, r + 1):\n pre[j] = min(pre[j], l)\nfor i in range(1, T + 1):\n if pre[i] != float('inf'):\n dp[i] = min(dp[i], dp[pre[i]] + 1)\nreturn dp[-1] if dp[-1] != float('inf') else -1", ...
<|body_start_0|> dp = [float('inf')] * (T + 1) dp[0] = 0 pre = [float('inf')] * (100 + 1) for l, r in clips: for j in range(l, r + 1): pre[j] = min(pre[j], l) for i in range(1, T + 1): if pre[i] != float('inf'): dp[i] = min(...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def videoStitching1(self, clips: List[List[int]], T: int) -> int: """思路:动态规划法 1. 获取每个位置对应的左边可以到达的最小位置,动态规划时从最小的位置转移 @param clips: @param T: @return:""" <|body_0|> def videoStitching2(self, clips: List[List[int]], T: int) -> int: """思路:贪心算法 @param clips: @pa...
stack_v2_sparse_classes_36k_train_000126
3,323
no_license
[ { "docstring": "思路:动态规划法 1. 获取每个位置对应的左边可以到达的最小位置,动态规划时从最小的位置转移 @param clips: @param T: @return:", "name": "videoStitching1", "signature": "def videoStitching1(self, clips: List[List[int]], T: int) -> int" }, { "docstring": "思路:贪心算法 @param clips: @param T: @return:", "name": "videoStitching2"...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def videoStitching1(self, clips: List[List[int]], T: int) -> int: 思路:动态规划法 1. 获取每个位置对应的左边可以到达的最小位置,动态规划时从最小的位置转移 @param clips: @param T: @return: - def videoStitching2(self, clip...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def videoStitching1(self, clips: List[List[int]], T: int) -> int: 思路:动态规划法 1. 获取每个位置对应的左边可以到达的最小位置,动态规划时从最小的位置转移 @param clips: @param T: @return: - def videoStitching2(self, clip...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def videoStitching1(self, clips: List[List[int]], T: int) -> int: """思路:动态规划法 1. 获取每个位置对应的左边可以到达的最小位置,动态规划时从最小的位置转移 @param clips: @param T: @return:""" <|body_0|> def videoStitching2(self, clips: List[List[int]], T: int) -> int: """思路:贪心算法 @param clips: @pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def videoStitching1(self, clips: List[List[int]], T: int) -> int: """思路:动态规划法 1. 获取每个位置对应的左边可以到达的最小位置,动态规划时从最小的位置转移 @param clips: @param T: @return:""" dp = [float('inf')] * (T + 1) dp[0] = 0 pre = [float('inf')] * (100 + 1) for l, r in clips: for ...
the_stack_v2_python_sparse
LeetCode/动态规划法(dp)/1024. 视频拼接.py
yiming1012/MyLeetCode
train
2
0f57db67533c3c2f0c4880f67ab5c1d5b05f233f
[ "assert isinstance(values, np.ndarray)\nassert len(values.shape) == 3\nself.values = values\nself.idx_map = idx_map", "if self.idx_map is not None:\n series_idx = np.array([self.idx_map[i] for i in series_idx])\nbatch_size = series_idx.shape[0] * time_idx.shape[0]\nseq_len = time_idx.shape[1]\nif seq_last:\n ...
<|body_start_0|> assert isinstance(values, np.ndarray) assert len(values.shape) == 3 self.values = values self.idx_map = idx_map <|end_body_0|> <|body_start_1|> if self.idx_map is not None: series_idx = np.array([self.idx_map[i] for i in series_idx]) batch_si...
TimeSeries
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeSeries: def __init__(self, values, idx_map=None): """Args: values: shape(N, dim, seq) idx_map: dict""" <|body_0|> def read_batch(self, series_idx, time_idx, seq_last): """Args: series_idx: shape(I) time_idx: shape(J, seq) seq_last(bool) Returns: shape(batch, dim,...
stack_v2_sparse_classes_36k_train_000127
17,496
permissive
[ { "docstring": "Args: values: shape(N, dim, seq) idx_map: dict", "name": "__init__", "signature": "def __init__(self, values, idx_map=None)" }, { "docstring": "Args: series_idx: shape(I) time_idx: shape(J, seq) seq_last(bool) Returns: shape(batch, dim, seq)", "name": "read_batch", "signa...
2
stack_v2_sparse_classes_30k_train_013814
Implement the Python class `TimeSeries` described below. Class description: Implement the TimeSeries class. Method signatures and docstrings: - def __init__(self, values, idx_map=None): Args: values: shape(N, dim, seq) idx_map: dict - def read_batch(self, series_idx, time_idx, seq_last): Args: series_idx: shape(I) ti...
Implement the Python class `TimeSeries` described below. Class description: Implement the TimeSeries class. Method signatures and docstrings: - def __init__(self, values, idx_map=None): Args: values: shape(N, dim, seq) idx_map: dict - def read_batch(self, series_idx, time_idx, seq_last): Args: series_idx: shape(I) ti...
04f8dfc8a508d433c8536c0e57f3c3d9df12c69c
<|skeleton|> class TimeSeries: def __init__(self, values, idx_map=None): """Args: values: shape(N, dim, seq) idx_map: dict""" <|body_0|> def read_batch(self, series_idx, time_idx, seq_last): """Args: series_idx: shape(I) time_idx: shape(J, seq) seq_last(bool) Returns: shape(batch, dim,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimeSeries: def __init__(self, values, idx_map=None): """Args: values: shape(N, dim, seq) idx_map: dict""" assert isinstance(values, np.ndarray) assert len(values.shape) == 3 self.values = values self.idx_map = idx_map def read_batch(self, series_idx, time_idx, seq...
the_stack_v2_python_sparse
deepseries/old_dataset.py
Relevation-143/Deep-Time-Series-Prediction
train
0
80b9bd6dd5fa29cffac45bae9693c4f343b66bfa
[ "request.user = None\nauth_header = authentication.get_authorization_header(request).split()\nauth_header_prefix = self.authentication_header_prefix.lower()\nif not auth_header:\n return None\nif len(auth_header) == 1:\n return None\nelif len(auth_header) > 2:\n return None\nprefix = auth_header[0].decode(...
<|body_start_0|> request.user = None auth_header = authentication.get_authorization_header(request).split() auth_header_prefix = self.authentication_header_prefix.lower() if not auth_header: return None if len(auth_header) == 1: return None elif le...
JWTAuthentication
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JWTAuthentication: def authenticate(self, request): """The `authenticate` method is called on every request, regardless of whether the endpoint requires authentication. `authenticate` has two possible return values: 1) `None` - We return `None` if we do not wish to authenticate. Usually ...
stack_v2_sparse_classes_36k_train_000128
3,554
permissive
[ { "docstring": "The `authenticate` method is called on every request, regardless of whether the endpoint requires authentication. `authenticate` has two possible return values: 1) `None` - We return `None` if we do not wish to authenticate. Usually this means we know authentication will fail. An example of this...
2
null
Implement the Python class `JWTAuthentication` described below. Class description: Implement the JWTAuthentication class. Method signatures and docstrings: - def authenticate(self, request): The `authenticate` method is called on every request, regardless of whether the endpoint requires authentication. `authenticate...
Implement the Python class `JWTAuthentication` described below. Class description: Implement the JWTAuthentication class. Method signatures and docstrings: - def authenticate(self, request): The `authenticate` method is called on every request, regardless of whether the endpoint requires authentication. `authenticate...
121636bbae446fb93f56c14a83ba819faf327d1f
<|skeleton|> class JWTAuthentication: def authenticate(self, request): """The `authenticate` method is called on every request, regardless of whether the endpoint requires authentication. `authenticate` has two possible return values: 1) `None` - We return `None` if we do not wish to authenticate. Usually ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JWTAuthentication: def authenticate(self, request): """The `authenticate` method is called on every request, regardless of whether the endpoint requires authentication. `authenticate` has two possible return values: 1) `None` - We return `None` if we do not wish to authenticate. Usually this means we ...
the_stack_v2_python_sparse
python/django/django-realworld/django-realworld-example-app/conduit/apps/authentication/backends.py
DataDog/trace-examples
train
106
56193e4a7cfda0884088689b116a56ef6c698665
[ "if params:\n raise ValueError(f'Observation parameters not supported; passed {params}')\npieces = [('player', 2, (2,))]\nif iig_obs_type.private_info == pyspiel.PrivateInfoType.SINGLE_PLAYER:\n pieces.append(('private_card', 3, (3,)))\nif iig_obs_type.public_info:\n if iig_obs_type.perfect_recall:\n ...
<|body_start_0|> if params: raise ValueError(f'Observation parameters not supported; passed {params}') pieces = [('player', 2, (2,))] if iig_obs_type.private_info == pyspiel.PrivateInfoType.SINGLE_PLAYER: pieces.append(('private_card', 3, (3,))) if iig_obs_type.pu...
Observer, conforming to the PyObserver interface (see observation.py).
KuhnPokerObserver
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KuhnPokerObserver: """Observer, conforming to the PyObserver interface (see observation.py).""" def __init__(self, iig_obs_type, params): """Initializes an empty observation tensor.""" <|body_0|> def set_from(self, state, player): """Updates `tensor` and `dict` t...
stack_v2_sparse_classes_36k_train_000129
7,683
permissive
[ { "docstring": "Initializes an empty observation tensor.", "name": "__init__", "signature": "def __init__(self, iig_obs_type, params)" }, { "docstring": "Updates `tensor` and `dict` to reflect `state` from PoV of `player`.", "name": "set_from", "signature": "def set_from(self, state, pla...
3
stack_v2_sparse_classes_30k_train_021499
Implement the Python class `KuhnPokerObserver` described below. Class description: Observer, conforming to the PyObserver interface (see observation.py). Method signatures and docstrings: - def __init__(self, iig_obs_type, params): Initializes an empty observation tensor. - def set_from(self, state, player): Updates ...
Implement the Python class `KuhnPokerObserver` described below. Class description: Observer, conforming to the PyObserver interface (see observation.py). Method signatures and docstrings: - def __init__(self, iig_obs_type, params): Initializes an empty observation tensor. - def set_from(self, state, player): Updates ...
6f3551fd990053cf2287b380fb9ad0b2a2607c18
<|skeleton|> class KuhnPokerObserver: """Observer, conforming to the PyObserver interface (see observation.py).""" def __init__(self, iig_obs_type, params): """Initializes an empty observation tensor.""" <|body_0|> def set_from(self, state, player): """Updates `tensor` and `dict` t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KuhnPokerObserver: """Observer, conforming to the PyObserver interface (see observation.py).""" def __init__(self, iig_obs_type, params): """Initializes an empty observation tensor.""" if params: raise ValueError(f'Observation parameters not supported; passed {params}') ...
the_stack_v2_python_sparse
open_spiel/python/games/kuhn_poker.py
sarahperrin/open_spiel
train
3
7980cac317f328fd6387eab10ef8309b30a155e7
[ "self.pool = heapq.nlargest(k, nums)\nheapq.heapify(self.pool)\nself.k = k", "if len(self.pool) < self.k:\n heapq.heappush(self.pool, val)\nelse:\n heapq.heappushpop(self.pool, val)\nreturn self.pool[0]" ]
<|body_start_0|> self.pool = heapq.nlargest(k, nums) heapq.heapify(self.pool) self.k = k <|end_body_0|> <|body_start_1|> if len(self.pool) < self.k: heapq.heappush(self.pool, val) else: heapq.heappushpop(self.pool, val) return self.pool[0] <|end_b...
KthLargest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.pool = heapq.nlargest(k, nums) heapq.heapify(...
stack_v2_sparse_classes_36k_train_000130
822
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_013807
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
bf900574ebec530f4af4494f81c84b31d36c9933
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.pool = heapq.nlargest(k, nums) heapq.heapify(self.pool) self.k = k def add(self, val): """:type val: int :rtype: int""" if len(self.pool) < self.k: heapq.heap...
the_stack_v2_python_sparse
easy/kth_largest_element_in_a_stream.py
luozhiping/leetcode
train
5
09edf147777f1ff5956cb528ee35ae9c7e033b25
[ "super(TaskTarget, self).__init__()\nself.service_name = service_name\nself.job_name = job_name\nself.region = region\nself.hostname = hostname\nself.task_num = task_num\nself._fields = ('service_name', 'job_name', 'region', 'hostname', 'task_num')", "collection.task.service_name = self.service_name\ncollection.t...
<|body_start_0|> super(TaskTarget, self).__init__() self.service_name = service_name self.job_name = job_name self.region = region self.hostname = hostname self.task_num = task_num self._fields = ('service_name', 'job_name', 'region', 'hostname', 'task_num') <|end...
Monitoring interface class for monitoring active jobs or processes.
TaskTarget
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskTarget: """Monitoring interface class for monitoring active jobs or processes.""" def __init__(self, service_name, job_name, region, hostname, task_num=0): """Create a Target object exporting info about a specific task. Args: service_name (str): service of which this task is a pa...
stack_v2_sparse_classes_36k_train_000131
4,448
permissive
[ { "docstring": "Create a Target object exporting info about a specific task. Args: service_name (str): service of which this task is a part. job_name (str): specific name of this task. region (str): general region in which this task is running. hostname (str): specific machine on which this task is running. tas...
2
null
Implement the Python class `TaskTarget` described below. Class description: Monitoring interface class for monitoring active jobs or processes. Method signatures and docstrings: - def __init__(self, service_name, job_name, region, hostname, task_num=0): Create a Target object exporting info about a specific task. Arg...
Implement the Python class `TaskTarget` described below. Class description: Monitoring interface class for monitoring active jobs or processes. Method signatures and docstrings: - def __init__(self, service_name, job_name, region, hostname, task_num=0): Create a Target object exporting info about a specific task. Arg...
53102de187a48ac2cfc241fef54dcbc29c453a8e
<|skeleton|> class TaskTarget: """Monitoring interface class for monitoring active jobs or processes.""" def __init__(self, service_name, job_name, region, hostname, task_num=0): """Create a Target object exporting info about a specific task. Args: service_name (str): service of which this task is a pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TaskTarget: """Monitoring interface class for monitoring active jobs or processes.""" def __init__(self, service_name, job_name, region, hostname, task_num=0): """Create a Target object exporting info about a specific task. Args: service_name (str): service of which this task is a part. job_name ...
the_stack_v2_python_sparse
third_party/gae_ts_mon/gae_ts_mon/common/targets.py
catapult-project/catapult
train
2,032
c7f88a6aea530ddce980a1920194f6cf1ace4630
[ "N = len(nums)\nsums = list(accumulate(nums))\nans = 0\nf, t = (0, 0)\nfor i in range(N - 2):\n while f <= i or (f < N - 1 and sums[i] > sums[f] - sums[i]):\n f += 1\n while t < f or (t < N - 1 and sums[t] - sums[i] <= sums[-1] - sums[t]):\n t += 1\n ans = (ans + t - f) % (10 ** 9 + 7)\nretur...
<|body_start_0|> N = len(nums) sums = list(accumulate(nums)) ans = 0 f, t = (0, 0) for i in range(N - 2): while f <= i or (f < N - 1 and sums[i] > sums[f] - sums[i]): f += 1 while t < f or (t < N - 1 and sums[t] - sums[i] <= sums[-1] - sums...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def waysToSplit(self, nums: List[int]) -> int: """1번 방법을 two pointer 문제로 풀어서 계산량을 줄임. i를 키우면 l이 커지고, m이 작아짐. j를 키우면 m이 커지고, r이 작아짐. i를 키우면서 j의 범위 f, t을 구함 i를 키우면 f를 키워야만 하고, t도 더 커질 수 있다. O(N) / O(N)""" <|body_0|> def waysToSplit1(self, nums: List[int]) -> int: ...
stack_v2_sparse_classes_36k_train_000132
1,569
no_license
[ { "docstring": "1번 방법을 two pointer 문제로 풀어서 계산량을 줄임. i를 키우면 l이 커지고, m이 작아짐. j를 키우면 m이 커지고, r이 작아짐. i를 키우면서 j의 범위 f, t을 구함 i를 키우면 f를 키워야만 하고, t도 더 커질 수 있다. O(N) / O(N)", "name": "waysToSplit", "signature": "def waysToSplit(self, nums: List[int]) -> int" }, { "docstring": "Prefix sum으로 2개의 포인트를 결정하...
2
stack_v2_sparse_classes_30k_train_003742
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def waysToSplit(self, nums: List[int]) -> int: 1번 방법을 two pointer 문제로 풀어서 계산량을 줄임. i를 키우면 l이 커지고, m이 작아짐. j를 키우면 m이 커지고, r이 작아짐. i를 키우면서 j의 범위 f, t을 구함 i를 키우면 f를 키워야만 하고, t도 더 커질...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def waysToSplit(self, nums: List[int]) -> int: 1번 방법을 two pointer 문제로 풀어서 계산량을 줄임. i를 키우면 l이 커지고, m이 작아짐. j를 키우면 m이 커지고, r이 작아짐. i를 키우면서 j의 범위 f, t을 구함 i를 키우면 f를 키워야만 하고, t도 더 커질...
c26aef2a59e5cc2d9b0658b9c7386a43267ff8a1
<|skeleton|> class Solution: def waysToSplit(self, nums: List[int]) -> int: """1번 방법을 two pointer 문제로 풀어서 계산량을 줄임. i를 키우면 l이 커지고, m이 작아짐. j를 키우면 m이 커지고, r이 작아짐. i를 키우면서 j의 범위 f, t을 구함 i를 키우면 f를 키워야만 하고, t도 더 커질 수 있다. O(N) / O(N)""" <|body_0|> def waysToSplit1(self, nums: List[int]) -> int: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def waysToSplit(self, nums: List[int]) -> int: """1번 방법을 two pointer 문제로 풀어서 계산량을 줄임. i를 키우면 l이 커지고, m이 작아짐. j를 키우면 m이 커지고, r이 작아짐. i를 키우면서 j의 범위 f, t을 구함 i를 키우면 f를 키워야만 하고, t도 더 커질 수 있다. O(N) / O(N)""" N = len(nums) sums = list(accumulate(nums)) ans = 0 f, t ...
the_stack_v2_python_sparse
Leetcode/1712.py
hanwgyu/algorithm_problem_solving
train
5
77c7b36eb83a0a6c36584a62e3bc93afafbe6257
[ "super(SelfAttention, self).__init__()\nself.W = tf.keras.layers.Dense(units)\nself.U = tf.keras.layers.Dense(units)\nself.V = tf.keras.layers.Dense(1)", "s_prev_with_time_axis = tf.expand_dims(s_prev, 1)\nW = self.W(s_prev_with_time_axis)\nU = self.U(hidden_states)\nscore = self.V(tf.nn.tanh(W + U))\nattention_w...
<|body_start_0|> super(SelfAttention, self).__init__() self.W = tf.keras.layers.Dense(units) self.U = tf.keras.layers.Dense(units) self.V = tf.keras.layers.Dense(1) <|end_body_0|> <|body_start_1|> s_prev_with_time_axis = tf.expand_dims(s_prev, 1) W = self.W(s_prev_with_t...
class that instantiates a self-attention layer
SelfAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SelfAttention: """class that instantiates a self-attention layer""" def __init__(self, units): """constructor""" <|body_0|> def call(self, s_prev, hidden_states): """function that builds the self-attention layer""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_36k_train_000133
929
no_license
[ { "docstring": "constructor", "name": "__init__", "signature": "def __init__(self, units)" }, { "docstring": "function that builds the self-attention layer", "name": "call", "signature": "def call(self, s_prev, hidden_states)" } ]
2
stack_v2_sparse_classes_30k_train_007834
Implement the Python class `SelfAttention` described below. Class description: class that instantiates a self-attention layer Method signatures and docstrings: - def __init__(self, units): constructor - def call(self, s_prev, hidden_states): function that builds the self-attention layer
Implement the Python class `SelfAttention` described below. Class description: class that instantiates a self-attention layer Method signatures and docstrings: - def __init__(self, units): constructor - def call(self, s_prev, hidden_states): function that builds the self-attention layer <|skeleton|> class SelfAttent...
7d3b348aec3b20da25b162b71f150c87c7c28d71
<|skeleton|> class SelfAttention: """class that instantiates a self-attention layer""" def __init__(self, units): """constructor""" <|body_0|> def call(self, s_prev, hidden_states): """function that builds the self-attention layer""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SelfAttention: """class that instantiates a self-attention layer""" def __init__(self, units): """constructor""" super(SelfAttention, self).__init__() self.W = tf.keras.layers.Dense(units) self.U = tf.keras.layers.Dense(units) self.V = tf.keras.layers.Dense(1) ...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/1-self_attention.py
dacastanogo/holbertonschool-machine_learning
train
0
0a7f7793d7bc9384f2dd8db7f6888ef3d4779a72
[ "super(CheckpointEventHandler, self).__init__()\nself.watches = set()\nself.handler = handler\nself.verbose = verbose\nself.experiment = experiment", "root, ext = os.path.splitext(event.src_path)\nbasename = os.path.basename(root)\nif ext == '.incomplete' and basename == 'checkpoint.pt':\n self.watches.add(eve...
<|body_start_0|> super(CheckpointEventHandler, self).__init__() self.watches = set() self.handler = handler self.verbose = verbose self.experiment = experiment <|end_body_0|> <|body_start_1|> root, ext = os.path.splitext(event.src_path) basename = os.path.basenam...
A filesystem event handler for new checkpoints
CheckpointEventHandler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckpointEventHandler: """A filesystem event handler for new checkpoints""" def __init__(self, handler, experiment, verbose=0): """Initialize the CheckpointEventHandler""" <|body_0|> def on_created(self, event): """Watcher for a new file""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_000134
6,605
permissive
[ { "docstring": "Initialize the CheckpointEventHandler", "name": "__init__", "signature": "def __init__(self, handler, experiment, verbose=0)" }, { "docstring": "Watcher for a new file", "name": "on_created", "signature": "def on_created(self, event)" }, { "docstring": "Handle whe...
3
stack_v2_sparse_classes_30k_test_000642
Implement the Python class `CheckpointEventHandler` described below. Class description: A filesystem event handler for new checkpoints Method signatures and docstrings: - def __init__(self, handler, experiment, verbose=0): Initialize the CheckpointEventHandler - def on_created(self, event): Watcher for a new file - d...
Implement the Python class `CheckpointEventHandler` described below. Class description: A filesystem event handler for new checkpoints Method signatures and docstrings: - def __init__(self, handler, experiment, verbose=0): Initialize the CheckpointEventHandler - def on_created(self, event): Watcher for a new file - d...
bbe1cdaecf1d7d104d27b1035a591ebbd3b5141e
<|skeleton|> class CheckpointEventHandler: """A filesystem event handler for new checkpoints""" def __init__(self, handler, experiment, verbose=0): """Initialize the CheckpointEventHandler""" <|body_0|> def on_created(self, event): """Watcher for a new file""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CheckpointEventHandler: """A filesystem event handler for new checkpoints""" def __init__(self, handler, experiment, verbose=0): """Initialize the CheckpointEventHandler""" super(CheckpointEventHandler, self).__init__() self.watches = set() self.handler = handler s...
the_stack_v2_python_sparse
actions/lambada_acc.py
SimengSun/revisit-nplm
train
13
2d818f2e97dac66db26807791e04dbcf161508cd
[ "erase_parser = argparse.ArgumentParser(description=cls.HELP, add_help=False)\nerase_options = erase_parser.add_argument_group('erase options')\nerase_options.add_argument('-c', '--chip', dest='erase_mode', action='store_const', const=FlashEraser.Mode.CHIP, help='Perform a chip erase.')\nerase_options.add_argument(...
<|body_start_0|> erase_parser = argparse.ArgumentParser(description=cls.HELP, add_help=False) erase_options = erase_parser.add_argument_group('erase options') erase_options.add_argument('-c', '--chip', dest='erase_mode', action='store_const', const=FlashEraser.Mode.CHIP, help='Perform a chip era...
@brief `pyocd erase` subcommand.
EraseSubcommand
[ "CC-BY-4.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EraseSubcommand: """@brief `pyocd erase` subcommand.""" def get_args(cls) -> List[argparse.ArgumentParser]: """@brief Add this subcommand to the subparsers object.""" <|body_0|> def invoke(self) -> int: """@brief Handle 'erase' subcommand.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_000135
4,957
permissive
[ { "docstring": "@brief Add this subcommand to the subparsers object.", "name": "get_args", "signature": "def get_args(cls) -> List[argparse.ArgumentParser]" }, { "docstring": "@brief Handle 'erase' subcommand.", "name": "invoke", "signature": "def invoke(self) -> int" } ]
2
stack_v2_sparse_classes_30k_test_000471
Implement the Python class `EraseSubcommand` described below. Class description: @brief `pyocd erase` subcommand. Method signatures and docstrings: - def get_args(cls) -> List[argparse.ArgumentParser]: @brief Add this subcommand to the subparsers object. - def invoke(self) -> int: @brief Handle 'erase' subcommand.
Implement the Python class `EraseSubcommand` described below. Class description: @brief `pyocd erase` subcommand. Method signatures and docstrings: - def get_args(cls) -> List[argparse.ArgumentParser]: @brief Add this subcommand to the subparsers object. - def invoke(self) -> int: @brief Handle 'erase' subcommand. <...
9253740baf46ebf4eacbce6bf3369150c5fb8ee0
<|skeleton|> class EraseSubcommand: """@brief `pyocd erase` subcommand.""" def get_args(cls) -> List[argparse.ArgumentParser]: """@brief Add this subcommand to the subparsers object.""" <|body_0|> def invoke(self) -> int: """@brief Handle 'erase' subcommand.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EraseSubcommand: """@brief `pyocd erase` subcommand.""" def get_args(cls) -> List[argparse.ArgumentParser]: """@brief Add this subcommand to the subparsers object.""" erase_parser = argparse.ArgumentParser(description=cls.HELP, add_help=False) erase_options = erase_parser.add_argu...
the_stack_v2_python_sparse
pyocd/subcommands/erase_cmd.py
pyocd/pyOCD
train
507
b1dcd0b9dcf074b5fde24a6e436e1acef0235e98
[ "trashs_json = []\nemail = request.user.username\ntrash_repos = syncwerk_api.get_trash_repos_by_owner(email)\nfor r in trash_repos:\n trash = {'repo_id': r.repo_id, 'owner_email': email, 'owner_name': email2nickname(email), 'owner_contact_email': email2contact_email(email), 'repo_name': r.repo_name, 'org_id': r....
<|body_start_0|> trashs_json = [] email = request.user.username trash_repos = syncwerk_api.get_trash_repos_by_owner(email) for r in trash_repos: trash = {'repo_id': r.repo_id, 'owner_email': email, 'owner_name': email2nickname(email), 'owner_contact_email': email2contact_emai...
DeletedRepos
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeletedRepos: def get(self, request): """get the deleted-repos of owner""" <|body_0|> def post(self, request): """restore deleted-repo return: return True if success, otherwise api_error""" <|body_1|> <|end_skeleton|> <|body_start_0|> trashs_json = ...
stack_v2_sparse_classes_36k_train_000136
2,806
permissive
[ { "docstring": "get the deleted-repos of owner", "name": "get", "signature": "def get(self, request)" }, { "docstring": "restore deleted-repo return: return True if success, otherwise api_error", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_018342
Implement the Python class `DeletedRepos` described below. Class description: Implement the DeletedRepos class. Method signatures and docstrings: - def get(self, request): get the deleted-repos of owner - def post(self, request): restore deleted-repo return: return True if success, otherwise api_error
Implement the Python class `DeletedRepos` described below. Class description: Implement the DeletedRepos class. Method signatures and docstrings: - def get(self, request): get the deleted-repos of owner - def post(self, request): restore deleted-repo return: return True if success, otherwise api_error <|skeleton|> c...
13b3ed26a04248211ef91ca70dccc617be27a3c3
<|skeleton|> class DeletedRepos: def get(self, request): """get the deleted-repos of owner""" <|body_0|> def post(self, request): """restore deleted-repo return: return True if success, otherwise api_error""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeletedRepos: def get(self, request): """get the deleted-repos of owner""" trashs_json = [] email = request.user.username trash_repos = syncwerk_api.get_trash_repos_by_owner(email) for r in trash_repos: trash = {'repo_id': r.repo_id, 'owner_email': email, 'o...
the_stack_v2_python_sparse
fhs/usr/share/python/syncwerk/restapi/restapi/api2/endpoints/deleted_repos.py
syncwerk/syncwerk-server-restapi
train
0
f4d621441d5f26ee0b92113d34a61302aa84f900
[ "start = ListNode(-1)\nstart.next = head\np = start\nwhile p.next:\n if p.next.val == val:\n p.next = p.next.next\n else:\n p = p.next\nreturn start.next", "if head is None:\n return None\nhead.next = self._removeElements(head.next, val)\nreturn head.next if head.val == val else head" ]
<|body_start_0|> start = ListNode(-1) start.next = head p = start while p.next: if p.next.val == val: p.next = p.next.next else: p = p.next return start.next <|end_body_0|> <|body_start_1|> if head is None: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeElements(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" <|body_0|> def _removeElements(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_000137
1,540
no_license
[ { "docstring": ":type head: ListNode :type val: int :rtype: ListNode", "name": "removeElements", "signature": "def removeElements(self, head, val)" }, { "docstring": ":type head: ListNode :type val: int :rtype: ListNode", "name": "_removeElements", "signature": "def _removeElements(self,...
2
stack_v2_sparse_classes_30k_train_020621
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElements(self, head, val): :type head: ListNode :type val: int :rtype: ListNode - def _removeElements(self, head, val): :type head: ListNode :type val: int :rtype: List...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElements(self, head, val): :type head: ListNode :type val: int :rtype: ListNode - def _removeElements(self, head, val): :type head: ListNode :type val: int :rtype: List...
1d1ffe25d8b49832acc1791261c959ce436a6362
<|skeleton|> class Solution: def removeElements(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" <|body_0|> def _removeElements(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeElements(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" start = ListNode(-1) start.next = head p = start while p.next: if p.next.val == val: p.next = p.next.next else: ...
the_stack_v2_python_sparse
03-单链表/3-虚拟头结点/01-203.py
qiaozhi827/leetcode-1
train
0
f01ae55610534fc174aeed663f397cd84fdeffeb
[ "user_uuid = get_jwt_identity()\ntry:\n page = int(request.args.get('page'))\nexcept (ValueError, TypeError):\n page = 1\nreturn MovieService.get_popular_movies(page, user_uuid)", "user_uuid = get_jwt_identity()\ndata = request.get_json()\nreturn MovieService.add_additional_movie(user_uuid, data)" ]
<|body_start_0|> user_uuid = get_jwt_identity() try: page = int(request.args.get('page')) except (ValueError, TypeError): page = 1 return MovieService.get_popular_movies(page, user_uuid) <|end_body_0|> <|body_start_1|> user_uuid = get_jwt_identity() ...
MovieResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovieResource: def get(self): """Get list of the most popular Movies""" <|body_0|> def post(self): """Add additional Movie for validation""" <|body_1|> <|end_skeleton|> <|body_start_0|> user_uuid = get_jwt_identity() try: page = ...
stack_v2_sparse_classes_36k_train_000138
8,217
no_license
[ { "docstring": "Get list of the most popular Movies", "name": "get", "signature": "def get(self)" }, { "docstring": "Add additional Movie for validation", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `MovieResource` described below. Class description: Implement the MovieResource class. Method signatures and docstrings: - def get(self): Get list of the most popular Movies - def post(self): Add additional Movie for validation
Implement the Python class `MovieResource` described below. Class description: Implement the MovieResource class. Method signatures and docstrings: - def get(self): Get list of the most popular Movies - def post(self): Add additional Movie for validation <|skeleton|> class MovieResource: def get(self): ...
2e7b4e07f149ede884cfe37130d9842ff9bb7be2
<|skeleton|> class MovieResource: def get(self): """Get list of the most popular Movies""" <|body_0|> def post(self): """Add additional Movie for validation""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MovieResource: def get(self): """Get list of the most popular Movies""" user_uuid = get_jwt_identity() try: page = int(request.args.get('page')) except (ValueError, TypeError): page = 1 return MovieService.get_popular_movies(page, user_uuid) ...
the_stack_v2_python_sparse
src/resources/movie_resource.py
RomainCtl/RecoFinement-api
train
0
258dd787b9119b8928eafee95259b747e61dcef3
[ "super().__init__()\nself.hidden_size = hidden_size\nself.embedding = nn.Embedding(output_size, hidden_size)\nself.gru = nn.GRU(hidden_size, hidden_size, num_layers=numlayers, batch_first=True)\nself.out = nn.Linear(hidden_size, output_size)\nself.softmax = nn.LogSoftmax(dim=2)", "emb = self.embedding(input)\nrel...
<|body_start_0|> super().__init__() self.hidden_size = hidden_size self.embedding = nn.Embedding(output_size, hidden_size) self.gru = nn.GRU(hidden_size, hidden_size, num_layers=numlayers, batch_first=True) self.out = nn.Linear(hidden_size, output_size) self.softmax = nn....
Generates a sequence of tokens in response to context.
DecoderRNN
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecoderRNN: """Generates a sequence of tokens in response to context.""" def __init__(self, output_size, hidden_size, numlayers): """Initialize decoder. :param input_size: size of embedding :param hidden_size: size of GRU hidden layers :param numlayers: number of GRU layers""" ...
stack_v2_sparse_classes_36k_train_000139
10,301
permissive
[ { "docstring": "Initialize decoder. :param input_size: size of embedding :param hidden_size: size of GRU hidden layers :param numlayers: number of GRU layers", "name": "__init__", "signature": "def __init__(self, output_size, hidden_size, numlayers)" }, { "docstring": "Return encoded state. :par...
2
null
Implement the Python class `DecoderRNN` described below. Class description: Generates a sequence of tokens in response to context. Method signatures and docstrings: - def __init__(self, output_size, hidden_size, numlayers): Initialize decoder. :param input_size: size of embedding :param hidden_size: size of GRU hidde...
Implement the Python class `DecoderRNN` described below. Class description: Generates a sequence of tokens in response to context. Method signatures and docstrings: - def __init__(self, output_size, hidden_size, numlayers): Initialize decoder. :param input_size: size of embedding :param hidden_size: size of GRU hidde...
ccf60824b28f0ce8ceda44a7ce52a0d117669115
<|skeleton|> class DecoderRNN: """Generates a sequence of tokens in response to context.""" def __init__(self, output_size, hidden_size, numlayers): """Initialize decoder. :param input_size: size of embedding :param hidden_size: size of GRU hidden layers :param numlayers: number of GRU layers""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DecoderRNN: """Generates a sequence of tokens in response to context.""" def __init__(self, output_size, hidden_size, numlayers): """Initialize decoder. :param input_size: size of embedding :param hidden_size: size of GRU hidden layers :param numlayers: number of GRU layers""" super().__i...
the_stack_v2_python_sparse
ParlAI/parlai/agents/example_seq2seq/example_seq2seq.py
ethanjperez/convince
train
27
4ae1bfd0f4ffa051b92d3188993bb0d667edc03a
[ "info = OrderedDict({})\ntry:\n if obj.student:\n info['student'] = obj.student.pen_name\nexcept Pupil.DoesNotExist as e:\n info['student'] = str(e)\ntry:\n if obj.exam:\n info['exam'] = obj.exam.name\nexcept Pupil.DoesNotExist as e:\n info['exam'] = str(e)\ntry:\n info_problems = Order...
<|body_start_0|> info = OrderedDict({}) try: if obj.student: info['student'] = obj.student.pen_name except Pupil.DoesNotExist as e: info['student'] = str(e) try: if obj.exam: info['exam'] = obj.exam.name except P...
Serialize the Exam Answer Key with links and info
ExamAnswersSerializers
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExamAnswersSerializers: """Serialize the Exam Answer Key with links and info""" def get_info_data(self, obj, *args, **kwargs): """Get Information data :param obj: :param args: :param kwargs: :return:""" <|body_0|> def get_links_url(self, obj, *args, **kwargs): ""...
stack_v2_sparse_classes_36k_train_000140
7,433
no_license
[ { "docstring": "Get Information data :param obj: :param args: :param kwargs: :return:", "name": "get_info_data", "signature": "def get_info_data(self, obj, *args, **kwargs)" }, { "docstring": "Get links url :param obj: :param args: :param kwargs: :return:", "name": "get_links_url", "sign...
2
stack_v2_sparse_classes_30k_train_019209
Implement the Python class `ExamAnswersSerializers` described below. Class description: Serialize the Exam Answer Key with links and info Method signatures and docstrings: - def get_info_data(self, obj, *args, **kwargs): Get Information data :param obj: :param args: :param kwargs: :return: - def get_links_url(self, o...
Implement the Python class `ExamAnswersSerializers` described below. Class description: Serialize the Exam Answer Key with links and info Method signatures and docstrings: - def get_info_data(self, obj, *args, **kwargs): Get Information data :param obj: :param args: :param kwargs: :return: - def get_links_url(self, o...
acd31a2f43d7ea83fc9bb34627f5dca94763eade
<|skeleton|> class ExamAnswersSerializers: """Serialize the Exam Answer Key with links and info""" def get_info_data(self, obj, *args, **kwargs): """Get Information data :param obj: :param args: :param kwargs: :return:""" <|body_0|> def get_links_url(self, obj, *args, **kwargs): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExamAnswersSerializers: """Serialize the Exam Answer Key with links and info""" def get_info_data(self, obj, *args, **kwargs): """Get Information data :param obj: :param args: :param kwargs: :return:""" info = OrderedDict({}) try: if obj.student: info['...
the_stack_v2_python_sparse
classroom/serializers.py
JoenyBui/mywaterbuffalo
train
0
01e3427781ed8033e95d9b54233100af3ac383da
[ "print('Output Class Started')\nmultiprocessing.Process.__init__(self, *args, **kw)\nself.queue = q\nself.workers = N\nself.sorting = sorting\nself.output = []", "while self.workers:\n p = self.queue.get()\n if p is None:\n self.workers -= 1\n else:\n self.output.append(p)\nprint(''.join((c...
<|body_start_0|> print('Output Class Started') multiprocessing.Process.__init__(self, *args, **kw) self.queue = q self.workers = N self.sorting = sorting self.output = [] <|end_body_0|> <|body_start_1|> while self.workers: p = self.queue.get() ...
OutThread
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OutThread: def __init__(self, N, q, sorting=True, *args, **kw): """Initialize process and save queue reference""" <|body_0|> def run(self): """Extracts items from the output queue and print untill all are done""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_000141
1,724
no_license
[ { "docstring": "Initialize process and save queue reference", "name": "__init__", "signature": "def __init__(self, N, q, sorting=True, *args, **kw)" }, { "docstring": "Extracts items from the output queue and print untill all are done", "name": "run", "signature": "def run(self)" } ]
2
null
Implement the Python class `OutThread` described below. Class description: Implement the OutThread class. Method signatures and docstrings: - def __init__(self, N, q, sorting=True, *args, **kw): Initialize process and save queue reference - def run(self): Extracts items from the output queue and print untill all are ...
Implement the Python class `OutThread` described below. Class description: Implement the OutThread class. Method signatures and docstrings: - def __init__(self, N, q, sorting=True, *args, **kw): Initialize process and save queue reference - def run(self): Extracts items from the output queue and print untill all are ...
7306581d542d6d045a9b2e6377ade0fc5ab8bc0e
<|skeleton|> class OutThread: def __init__(self, N, q, sorting=True, *args, **kw): """Initialize process and save queue reference""" <|body_0|> def run(self): """Extracts items from the output queue and print untill all are done""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OutThread: def __init__(self, N, q, sorting=True, *args, **kw): """Initialize process and save queue reference""" print('Output Class Started') multiprocessing.Process.__init__(self, *args, **kw) self.queue = q self.workers = N self.sorting = sorting sel...
the_stack_v2_python_sparse
PythonHomeWork/Py4/Py4_Lesson12/src/output.py
rduvalwa5/OReillyPy
train
0
0d7013bde870150a09a59ac82cc2a5dd5a3efb8d
[ "TokenAuthenticator(request.headers.get('Authorization')).authenticate()\nbanned_list = Session().query(User.userID, User.username).join(BannedList, User.userID == BannedList.bannedUserID).filter(BannedList.userID == g.userID)\nreturn ([{'userID': userID, 'username': username} for userID, username in banned_list], ...
<|body_start_0|> TokenAuthenticator(request.headers.get('Authorization')).authenticate() banned_list = Session().query(User.userID, User.username).join(BannedList, User.userID == BannedList.bannedUserID).filter(BannedList.userID == g.userID) return ([{'userID': userID, 'username': username} for ...
BannedLists
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BannedLists: def get(self): """View your Banned List.""" <|body_0|> def post(self): """Add a FilmFinder to your Banned List.""" <|body_1|> <|end_skeleton|> <|body_start_0|> TokenAuthenticator(request.headers.get('Authorization')).authenticate() ...
stack_v2_sparse_classes_36k_train_000142
3,081
no_license
[ { "docstring": "View your Banned List.", "name": "get", "signature": "def get(self)" }, { "docstring": "Add a FilmFinder to your Banned List.", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_018499
Implement the Python class `BannedLists` described below. Class description: Implement the BannedLists class. Method signatures and docstrings: - def get(self): View your Banned List. - def post(self): Add a FilmFinder to your Banned List.
Implement the Python class `BannedLists` described below. Class description: Implement the BannedLists class. Method signatures and docstrings: - def get(self): View your Banned List. - def post(self): Add a FilmFinder to your Banned List. <|skeleton|> class BannedLists: def get(self): """View your Bann...
db8862ea20ee441aed84099d44dd5695f0d950ee
<|skeleton|> class BannedLists: def get(self): """View your Banned List.""" <|body_0|> def post(self): """Add a FilmFinder to your Banned List.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BannedLists: def get(self): """View your Banned List.""" TokenAuthenticator(request.headers.get('Authorization')).authenticate() banned_list = Session().query(User.userID, User.username).join(BannedList, User.userID == BannedList.bannedUserID).filter(BannedList.userID == g.userID) ...
the_stack_v2_python_sparse
server/apis/banned_list.py
NishantChokkarapu/capstone-project-comp9900-h16a-tahelka
train
0
fa7434d1e859e4d94c2dade90d9bf66a990629cf
[ "if not root:\n return True\nnodes = [root]\nwhile nodes:\n node = nodes.pop()\n if abs(self.maxDepth(node.left) - self.maxDepth(node.right)) > 1:\n return False\n if node.left:\n nodes.append(node.left)\n if node.right:\n nodes.append(node.right)\nreturn True", "if not root:\n...
<|body_start_0|> if not root: return True nodes = [root] while nodes: node = nodes.pop() if abs(self.maxDepth(node.left) - self.maxDepth(node.right)) > 1: return False if node.left: nodes.append(node.left) ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isBalanced(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def maxDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return True nodes...
stack_v2_sparse_classes_36k_train_000143
2,310
permissive
[ { "docstring": ":type root: TreeNode :rtype: bool", "name": "isBalanced", "signature": "def isBalanced(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "maxDepth", "signature": "def maxDepth(self, root)" } ]
2
stack_v2_sparse_classes_30k_test_000881
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBalanced(self, root): :type root: TreeNode :rtype: bool - def maxDepth(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBalanced(self, root): :type root: TreeNode :rtype: bool - def maxDepth(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: def isBalanced(self,...
57080da5fbe5d62cbc0b8a34e362a8b0978d5b59
<|skeleton|> class Solution: def isBalanced(self, root): """:type root: TreeNode :rtype: bool""" <|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: def isBalanced(self, root): """:type root: TreeNode :rtype: bool""" if not root: return True nodes = [root] while nodes: node = nodes.pop() if abs(self.maxDepth(node.left) - self.maxDepth(node.right)) > 1: return Fal...
the_stack_v2_python_sparse
python/tree/0110_balanced_binary_tree.py
linshaoyong/leetcode
train
6
8aefaba9b382d84fe30da2e717b8ae922bd23c4f
[ "self.department = department\nself.dependents = dependents\nself.hired_at = APIHelper.HttpDateTime(hired_at) if hired_at else None\nself.joining_day = joining_day\nself.salary = salary\nself.working_days = working_days\nself.boss = boss\nself.additional_properties = additional_properties\nsuper(Employee, self).__i...
<|body_start_0|> self.department = department self.dependents = dependents self.hired_at = APIHelper.HttpDateTime(hired_at) if hired_at else None self.joining_day = joining_day self.salary = salary self.working_days = working_days self.boss = boss self.add...
Implementation of the 'Employee' model. TODO: type model description here. NOTE: This class inherits from 'Person'. Attributes: department (string): TODO: type description here. dependents (list of Person): TODO: type description here. hired_at (datetime): TODO: type description here. joining_day (Days): TODO: type des...
Employee
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Employee: """Implementation of the 'Employee' model. TODO: type model description here. NOTE: This class inherits from 'Person'. Attributes: department (string): TODO: type description here. dependents (list of Person): TODO: type description here. hired_at (datetime): TODO: type description here...
stack_v2_sparse_classes_36k_train_000144
13,843
permissive
[ { "docstring": "Constructor for the Employee class", "name": "__init__", "signature": "def __init__(self, address=None, age=None, birthday=None, birthtime=None, department=None, dependents=None, hired_at=None, joining_day='Monday', name=None, salary=None, uid=None, working_days=None, boss=None, person_t...
2
stack_v2_sparse_classes_30k_test_000183
Implement the Python class `Employee` described below. Class description: Implementation of the 'Employee' model. TODO: type model description here. NOTE: This class inherits from 'Person'. Attributes: department (string): TODO: type description here. dependents (list of Person): TODO: type description here. hired_at ...
Implement the Python class `Employee` described below. Class description: Implementation of the 'Employee' model. TODO: type model description here. NOTE: This class inherits from 'Person'. Attributes: department (string): TODO: type description here. dependents (list of Person): TODO: type description here. hired_at ...
49acc3d416a1dde7ea43b178d070484baf1b7f2b
<|skeleton|> class Employee: """Implementation of the 'Employee' model. TODO: type model description here. NOTE: This class inherits from 'Person'. Attributes: department (string): TODO: type description here. dependents (list of Person): TODO: type description here. hired_at (datetime): TODO: type description here...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Employee: """Implementation of the 'Employee' model. TODO: type model description here. NOTE: This class inherits from 'Person'. Attributes: department (string): TODO: type description here. dependents (list of Person): TODO: type description here. hired_at (datetime): TODO: type description here. joining_day...
the_stack_v2_python_sparse
PYTHON_GENERIC_LIB/tester/models/person.py
MaryamAdnan3/Tester1
train
0
b7ece0e7c282c97bfd4cc03f518aee043389ebe7
[ "self.apikey = apikey\nself.headers = {'User-Agent': 'Prowlpy/%s' % str(__version__), 'Content-type': 'application/x-www-form-urlencoded'}\nself.add = self.post", "h = Https(API_DOMAIN)\ndata = {'apikey': self.apikey, 'application': application, 'event': event, 'description': description, 'priority': priority}\ni...
<|body_start_0|> self.apikey = apikey self.headers = {'User-Agent': 'Prowlpy/%s' % str(__version__), 'Content-type': 'application/x-www-form-urlencoded'} self.add = self.post <|end_body_0|> <|body_start_1|> h = Https(API_DOMAIN) data = {'apikey': self.apikey, 'application': appl...
Prowl
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Prowl: def __init__(self, apikey, providerkey=None): """Initialize a Prowl instance.""" <|body_0|> def post(self, application=None, event=None, description=None, priority=0, providerkey=None): """Post a notification.. You must provide either event or description or b...
stack_v2_sparse_classes_36k_train_000145
2,977
no_license
[ { "docstring": "Initialize a Prowl instance.", "name": "__init__", "signature": "def __init__(self, apikey, providerkey=None)" }, { "docstring": "Post a notification.. You must provide either event or description or both. The parameters are : - application ; The name of your application or the a...
3
stack_v2_sparse_classes_30k_test_000449
Implement the Python class `Prowl` described below. Class description: Implement the Prowl class. Method signatures and docstrings: - def __init__(self, apikey, providerkey=None): Initialize a Prowl instance. - def post(self, application=None, event=None, description=None, priority=0, providerkey=None): Post a notifi...
Implement the Python class `Prowl` described below. Class description: Implement the Prowl class. Method signatures and docstrings: - def __init__(self, apikey, providerkey=None): Initialize a Prowl instance. - def post(self, application=None, event=None, description=None, priority=0, providerkey=None): Post a notifi...
6a1e71a1c001e6577c45cca06fa1b57be968d0ae
<|skeleton|> class Prowl: def __init__(self, apikey, providerkey=None): """Initialize a Prowl instance.""" <|body_0|> def post(self, application=None, event=None, description=None, priority=0, providerkey=None): """Post a notification.. You must provide either event or description or b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Prowl: def __init__(self, apikey, providerkey=None): """Initialize a Prowl instance.""" self.apikey = apikey self.headers = {'User-Agent': 'Prowlpy/%s' % str(__version__), 'Content-type': 'application/x-www-form-urlencoded'} self.add = self.post def post(self, application=...
the_stack_v2_python_sparse
prowlpy.py
minrivertea/laowailai
train
1
887cf0464b44e4287a33716e02adb5ba5c625a08
[ "BaseDiscretizer.__init__(self, feature_names=feature_names, fill_na=fill_na, return_numeric=return_numeric, return_array=return_array, decimal=decimal)\nif bins <= 1:\n raise Exception('bins必须大于1!')\nself.bins = bins", "if len(X.shape) == 1:\n vmax = X.max()\n vmin = X.min()\n if vmin == vmax:\n ...
<|body_start_0|> BaseDiscretizer.__init__(self, feature_names=feature_names, fill_na=fill_na, return_numeric=return_numeric, return_array=return_array, decimal=decimal) if bins <= 1: raise Exception('bins必须大于1!') self.bins = bins <|end_body_0|> <|body_start_1|> if len(X.shap...
SimpleBinsDiscretizer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleBinsDiscretizer: def __init__(self, feature_names=None, bins=10, fill_na=-1, return_numeric=True, return_array=False, decimal=2): """根据等分点离散化。 feature_names: 需要离散化的变量列表,非负整数或者字符串。 bins: 等分区间数。""" <|body_0|> def fit(self, X, y=None): """对feature_names中的变量获取各自离散化...
stack_v2_sparse_classes_36k_train_000146
13,441
no_license
[ { "docstring": "根据等分点离散化。 feature_names: 需要离散化的变量列表,非负整数或者字符串。 bins: 等分区间数。", "name": "__init__", "signature": "def __init__(self, feature_names=None, bins=10, fill_na=-1, return_numeric=True, return_array=False, decimal=2)" }, { "docstring": "对feature_names中的变量获取各自离散化分割点。 X: 一维或二维数组,或DataFrame,...
2
stack_v2_sparse_classes_30k_train_011470
Implement the Python class `SimpleBinsDiscretizer` described below. Class description: Implement the SimpleBinsDiscretizer class. Method signatures and docstrings: - def __init__(self, feature_names=None, bins=10, fill_na=-1, return_numeric=True, return_array=False, decimal=2): 根据等分点离散化。 feature_names: 需要离散化的变量列表,非负整...
Implement the Python class `SimpleBinsDiscretizer` described below. Class description: Implement the SimpleBinsDiscretizer class. Method signatures and docstrings: - def __init__(self, feature_names=None, bins=10, fill_na=-1, return_numeric=True, return_array=False, decimal=2): 根据等分点离散化。 feature_names: 需要离散化的变量列表,非负整...
2e5304fe3152509b60003ac41a60c0ed7f5cf6c7
<|skeleton|> class SimpleBinsDiscretizer: def __init__(self, feature_names=None, bins=10, fill_na=-1, return_numeric=True, return_array=False, decimal=2): """根据等分点离散化。 feature_names: 需要离散化的变量列表,非负整数或者字符串。 bins: 等分区间数。""" <|body_0|> def fit(self, X, y=None): """对feature_names中的变量获取各自离散化...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimpleBinsDiscretizer: def __init__(self, feature_names=None, bins=10, fill_na=-1, return_numeric=True, return_array=False, decimal=2): """根据等分点离散化。 feature_names: 需要离散化的变量列表,非负整数或者字符串。 bins: 等分区间数。""" BaseDiscretizer.__init__(self, feature_names=feature_names, fill_na=fill_na, return_numeric=...
the_stack_v2_python_sparse
installment_consume_model/discretize.py
tesla2349/Kaiyuan-Financial-Consumption-Risk-Control-Model
train
0
2e21c4a74dc7da26ce34caee047415bb0563d1b1
[ "if model_kwargs is None:\n model_kwargs = {}\nif stl_kwargs is None:\n stl_kwargs = {}\nself.in_column = in_column\nself.period = period\nif isinstance(model, str):\n if model == 'arima':\n self.model = ARIMA\n model_kwargs = {'order': (1, 1, 0)}\n elif model == 'holt':\n self.mode...
<|body_start_0|> if model_kwargs is None: model_kwargs = {} if stl_kwargs is None: stl_kwargs = {} self.in_column = in_column self.period = period if isinstance(model, str): if model == 'arima': self.model = ARIMA ...
_OneSegmentSTLTransform
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _OneSegmentSTLTransform: def __init__(self, in_column: str, period: int, model: Union[str, TimeSeriesModel]='arima', robust: bool=False, model_kwargs: Optional[Dict[str, Any]]=None, stl_kwargs: Optional[Dict[str, Any]]=None): """Init _OneSegmentSTLTransform. Parameters ---------- in_colu...
stack_v2_sparse_classes_36k_train_000147
5,887
permissive
[ { "docstring": "Init _OneSegmentSTLTransform. Parameters ---------- in_column: name of processed column period: size of seasonality model: model to predict trend, default options are: 1. \"arima\": `ARIMA(data, 1, 1, 0)` (default) 2. \"holt\": `ETSModel(data, trend='add')` Custom model should be a subclass of s...
4
null
Implement the Python class `_OneSegmentSTLTransform` described below. Class description: Implement the _OneSegmentSTLTransform class. Method signatures and docstrings: - def __init__(self, in_column: str, period: int, model: Union[str, TimeSeriesModel]='arima', robust: bool=False, model_kwargs: Optional[Dict[str, Any...
Implement the Python class `_OneSegmentSTLTransform` described below. Class description: Implement the _OneSegmentSTLTransform class. Method signatures and docstrings: - def __init__(self, in_column: str, period: int, model: Union[str, TimeSeriesModel]='arima', robust: bool=False, model_kwargs: Optional[Dict[str, Any...
b2453671b00affe2af23c4b10f556f6fb5d7d602
<|skeleton|> class _OneSegmentSTLTransform: def __init__(self, in_column: str, period: int, model: Union[str, TimeSeriesModel]='arima', robust: bool=False, model_kwargs: Optional[Dict[str, Any]]=None, stl_kwargs: Optional[Dict[str, Any]]=None): """Init _OneSegmentSTLTransform. Parameters ---------- in_colu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _OneSegmentSTLTransform: def __init__(self, in_column: str, period: int, model: Union[str, TimeSeriesModel]='arima', robust: bool=False, model_kwargs: Optional[Dict[str, Any]]=None, stl_kwargs: Optional[Dict[str, Any]]=None): """Init _OneSegmentSTLTransform. Parameters ---------- in_column: name of pr...
the_stack_v2_python_sparse
etna/transforms/stl.py
jingmouren/etna-ts
train
0
ff7dd86d50971ddd6dc7a4305177f33ff11dfe35
[ "self._app_process = None\nself._lib_directories = None\nself.lib_directory = None\nself.lib_major_version = 'lib_{}'.format(sys.version_info.major)\nself.lib_minor_version = '{}.{}'.format(self.lib_major_version, sys.version_info.minor)\nself.lib_micro_version = '{}.{}'.format(self.lib_minor_version, sys.version_i...
<|body_start_0|> self._app_process = None self._lib_directories = None self.lib_directory = None self.lib_major_version = 'lib_{}'.format(sys.version_info.major) self.lib_minor_version = '{}.{}'.format(self.lib_major_version, sys.version_info.minor) self.lib_micro_version...
Set App Lib Directory
AppLib
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AppLib: """Set App Lib Directory""" def __init__(self): """Initialize App properties.""" <|body_0|> def find_lib_directory(self): """Find the optimal lib directory.""" <|body_1|> def lib_directories(self): """Get all "lib" directories.""" ...
stack_v2_sparse_classes_36k_train_000148
4,138
permissive
[ { "docstring": "Initialize App properties.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Find the optimal lib directory.", "name": "find_lib_directory", "signature": "def find_lib_directory(self)" }, { "docstring": "Get all \"lib\" directories.", ...
5
stack_v2_sparse_classes_30k_train_003827
Implement the Python class `AppLib` described below. Class description: Set App Lib Directory Method signatures and docstrings: - def __init__(self): Initialize App properties. - def find_lib_directory(self): Find the optimal lib directory. - def lib_directories(self): Get all "lib" directories. - def run_app(self): ...
Implement the Python class `AppLib` described below. Class description: Set App Lib Directory Method signatures and docstrings: - def __init__(self): Initialize App properties. - def find_lib_directory(self): Find the optimal lib directory. - def lib_directories(self): Get all "lib" directories. - def run_app(self): ...
0f2e6a2d1c71f104b1522fd68ec01b9f9f3b92f9
<|skeleton|> class AppLib: """Set App Lib Directory""" def __init__(self): """Initialize App properties.""" <|body_0|> def find_lib_directory(self): """Find the optimal lib directory.""" <|body_1|> def lib_directories(self): """Get all "lib" directories.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AppLib: """Set App Lib Directory""" def __init__(self): """Initialize App properties.""" self._app_process = None self._lib_directories = None self.lib_directory = None self.lib_major_version = 'lib_{}'.format(sys.version_info.major) self.lib_minor_version ...
the_stack_v2_python_sparse
apps/TCPB_-_Disposable_Email_Address_Identifier/__main__.py
ThreatConnect-Inc/threatconnect-playbooks
train
76
ae1291bbee8b039669bad1292cf31c250d983a2e
[ "data = cls.createDataForReceipt(order, menu)\ntemplateFile = open('utils/receiptTemplate.html', 'r').read()\ntemplate = Template(templateFile.decode('utf8'))\nreturn template.render(data=data)", "data = cls.createDataForReceipt(order, menu)\noptions = {'page-size': 'A4', 'dpi': 400}\nhtmlReceipt = cls.generateHt...
<|body_start_0|> data = cls.createDataForReceipt(order, menu) templateFile = open('utils/receiptTemplate.html', 'r').read() template = Template(templateFile.decode('utf8')) return template.render(data=data) <|end_body_0|> <|body_start_1|> data = cls.createDataForReceipt(order, m...
Description: This class is used to generate pdf receipt from a given order object
ReceiptGenerator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReceiptGenerator: """Description: This class is used to generate pdf receipt from a given order object""" def generateHtmlReceipt(cls, order, menu): """DESCRIPTION: This class used Jinja2 templating engine to generate an HTML receipt for the given order ARGUMENTS: order: order to gen...
stack_v2_sparse_classes_36k_train_000149
3,828
no_license
[ { "docstring": "DESCRIPTION: This class used Jinja2 templating engine to generate an HTML receipt for the given order ARGUMENTS: order: order to generate the receipt menu: list of all the menus, this is used to get menu descriptions RETURNS: rendered html receipt file for the order", "name": "generateHtmlRe...
3
stack_v2_sparse_classes_30k_train_004474
Implement the Python class `ReceiptGenerator` described below. Class description: Description: This class is used to generate pdf receipt from a given order object Method signatures and docstrings: - def generateHtmlReceipt(cls, order, menu): DESCRIPTION: This class used Jinja2 templating engine to generate an HTML r...
Implement the Python class `ReceiptGenerator` described below. Class description: Description: This class is used to generate pdf receipt from a given order object Method signatures and docstrings: - def generateHtmlReceipt(cls, order, menu): DESCRIPTION: This class used Jinja2 templating engine to generate an HTML r...
e5139e131282d527753c142b0da8041819922424
<|skeleton|> class ReceiptGenerator: """Description: This class is used to generate pdf receipt from a given order object""" def generateHtmlReceipt(cls, order, menu): """DESCRIPTION: This class used Jinja2 templating engine to generate an HTML receipt for the given order ARGUMENTS: order: order to gen...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReceiptGenerator: """Description: This class is used to generate pdf receipt from a given order object""" def generateHtmlReceipt(cls, order, menu): """DESCRIPTION: This class used Jinja2 templating engine to generate an HTML receipt for the given order ARGUMENTS: order: order to generate the rec...
the_stack_v2_python_sparse
utils/ReceiptGenerator.py
BeeShall/POS-Python
train
0
6c518816ee557ceb7ca1b9b9d8394e9f60ffe162
[ "self.has_archival_copy = has_archival_copy\nself.has_local_copy = has_local_copy\nself.has_remote_copy = has_remote_copy\nself.modified_time_usecs = modified_time_usecs\nself.replica_info_list = replica_info_list\nself.size_bytes = size_bytes\nself.snapshot = snapshot", "if dictionary is None:\n return None\n...
<|body_start_0|> self.has_archival_copy = has_archival_copy self.has_local_copy = has_local_copy self.has_remote_copy = has_remote_copy self.modified_time_usecs = modified_time_usecs self.replica_info_list = replica_info_list self.size_bytes = size_bytes self.snap...
Implementation of the 'FileSnapshotInformation' model. Specifies the information about the snapshot that contains the file or folder. In addition, information about the file or folder is provided. Attributes: has_archival_copy (bool): If true, this snapshot is located on an archival target (such as a tape or AWS). has_...
FileSnapshotInformation
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileSnapshotInformation: """Implementation of the 'FileSnapshotInformation' model. Specifies the information about the snapshot that contains the file or folder. In addition, information about the file or folder is provided. Attributes: has_archival_copy (bool): If true, this snapshot is located ...
stack_v2_sparse_classes_36k_train_000150
4,043
permissive
[ { "docstring": "Constructor for the FileSnapshotInformation class", "name": "__init__", "signature": "def __init__(self, has_archival_copy=None, has_local_copy=None, has_remote_copy=None, modified_time_usecs=None, replica_info_list=None, size_bytes=None, snapshot=None)" }, { "docstring": "Create...
2
stack_v2_sparse_classes_30k_train_012126
Implement the Python class `FileSnapshotInformation` described below. Class description: Implementation of the 'FileSnapshotInformation' model. Specifies the information about the snapshot that contains the file or folder. In addition, information about the file or folder is provided. Attributes: has_archival_copy (bo...
Implement the Python class `FileSnapshotInformation` described below. Class description: Implementation of the 'FileSnapshotInformation' model. Specifies the information about the snapshot that contains the file or folder. In addition, information about the file or folder is provided. Attributes: has_archival_copy (bo...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class FileSnapshotInformation: """Implementation of the 'FileSnapshotInformation' model. Specifies the information about the snapshot that contains the file or folder. In addition, information about the file or folder is provided. Attributes: has_archival_copy (bool): If true, this snapshot is located ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileSnapshotInformation: """Implementation of the 'FileSnapshotInformation' model. Specifies the information about the snapshot that contains the file or folder. In addition, information about the file or folder is provided. Attributes: has_archival_copy (bool): If true, this snapshot is located on an archiva...
the_stack_v2_python_sparse
cohesity_management_sdk/models/file_snapshot_information.py
cohesity/management-sdk-python
train
24
c1cd41f0c9f2b559e3a5b65ee403196ed4936e17
[ "\"\"\"\n Treat each node as root, calculate their depths, return the minimum roots.\n This method will get TLE\n \"\"\"\ngraph = [[] for _ in range(n)]\nfor a, b in edges:\n graph[a].append(b)\n graph[b].append(a)\n\ndef get_height(root, visited):\n visited.add(root)\n heig...
<|body_start_0|> """ Treat each node as root, calculate their depths, return the minimum roots. This method will get TLE """ graph = [[] for _ in range(n)] for a, b in edges: graph[a].append(b) graph[b].append(a) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMinHeightTrees(self, n: int, edges: List[List[int]]) -> List[int]: """Brute Force, Time: O(V^2), Space: O(V)""" <|body_0|> def findMinHeightTrees(self, n: int, edges: List[List[int]]) -> List[int]: """BFS, Time: O(V), Space: O(V)""" <|body_1...
stack_v2_sparse_classes_36k_train_000151
3,079
no_license
[ { "docstring": "Brute Force, Time: O(V^2), Space: O(V)", "name": "findMinHeightTrees", "signature": "def findMinHeightTrees(self, n: int, edges: List[List[int]]) -> List[int]" }, { "docstring": "BFS, Time: O(V), Space: O(V)", "name": "findMinHeightTrees", "signature": "def findMinHeightT...
2
stack_v2_sparse_classes_30k_test_000398
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMinHeightTrees(self, n: int, edges: List[List[int]]) -> List[int]: Brute Force, Time: O(V^2), Space: O(V) - def findMinHeightTrees(self, n: int, edges: List[List[int]]) -...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMinHeightTrees(self, n: int, edges: List[List[int]]) -> List[int]: Brute Force, Time: O(V^2), Space: O(V) - def findMinHeightTrees(self, n: int, edges: List[List[int]]) -...
72136e3487d239f5b37e2d6393e034262a6bf599
<|skeleton|> class Solution: def findMinHeightTrees(self, n: int, edges: List[List[int]]) -> List[int]: """Brute Force, Time: O(V^2), Space: O(V)""" <|body_0|> def findMinHeightTrees(self, n: int, edges: List[List[int]]) -> List[int]: """BFS, Time: O(V), Space: O(V)""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMinHeightTrees(self, n: int, edges: List[List[int]]) -> List[int]: """Brute Force, Time: O(V^2), Space: O(V)""" """ Treat each node as root, calculate their depths, return the minimum roots. This method will get TLE """ ...
the_stack_v2_python_sparse
python/310-Minimum Height Trees.py
cwza/leetcode
train
0
bd1a9b9d54a1c15e3cf7769fd8823aafc6754247
[ "quizTakerId = kwargs['pk']\nquizTaker = QuizTakers.objects.filter(id=quizTakerId).first()\nresponse = StudentResponse.objects.filter(quiztaker=quizTaker)\nserializer = ResponseSerializer(response, many=True)\nreturn Response(serializer.data)", "quizTakerId = kwargs['pk']\nquizTaker = QuizTakers.objects.filter(id...
<|body_start_0|> quizTakerId = kwargs['pk'] quizTaker = QuizTakers.objects.filter(id=quizTakerId).first() response = StudentResponse.objects.filter(quiztaker=quizTaker) serializer = ResponseSerializer(response, many=True) return Response(serializer.data) <|end_body_0|> <|body_st...
ListCreateResponse
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListCreateResponse: def get(self, request, *args, **kwargs): """return quiz taker answers""" <|body_0|> def post(self, request, *args, **kwargs): """add quiz taker answers""" <|body_1|> <|end_skeleton|> <|body_start_0|> quizTakerId = kwargs['pk'] ...
stack_v2_sparse_classes_36k_train_000152
1,434
permissive
[ { "docstring": "return quiz taker answers", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "add quiz taker answers", "name": "post", "signature": "def post(self, request, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_010401
Implement the Python class `ListCreateResponse` described below. Class description: Implement the ListCreateResponse class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): return quiz taker answers - def post(self, request, *args, **kwargs): add quiz taker answers
Implement the Python class `ListCreateResponse` described below. Class description: Implement the ListCreateResponse class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): return quiz taker answers - def post(self, request, *args, **kwargs): add quiz taker answers <|skeleton|> class List...
bebeff8d055ea769773cd1c749f42408aa83f5b9
<|skeleton|> class ListCreateResponse: def get(self, request, *args, **kwargs): """return quiz taker answers""" <|body_0|> def post(self, request, *args, **kwargs): """add quiz taker answers""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ListCreateResponse: def get(self, request, *args, **kwargs): """return quiz taker answers""" quizTakerId = kwargs['pk'] quizTaker = QuizTakers.objects.filter(id=quizTakerId).first() response = StudentResponse.objects.filter(quiztaker=quizTaker) serializer = ResponseSeri...
the_stack_v2_python_sparse
backend/quiz/api/views/response.py
mahmoud-batman/quizz-app
train
0
80c065a92f132f34bbd1343dd0f91840b37e7bdf
[ "if not root:\n return '[]'\nque = [root]\nres = []\nwhile que:\n node = que.pop(0)\n if node:\n res.append(str(node.val))\n que.append(node.left)\n que.append(node.right)\n else:\n res.append('null')\nreturn '[' + ','.join(res) + ']'", "if data == '[]':\n return\nvals, ...
<|body_start_0|> if not root: return '[]' que = [root] res = [] while que: node = que.pop(0) if node: res.append(str(node.val)) que.append(node.left) que.append(node.right) else: ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_000153
2,077
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
8343f4258d20661f70f0462c358ef8b118a03de4
<|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 not root: return '[]' que = [root] res = [] while que: node = que.pop(0) if node: res.append(str(node.val))...
the_stack_v2_python_sparse
python/offer_37_Codec.py
Aiooon/MyLeetcode
train
0
d6e46b24598cb54012bcd51c7b2ef901e88e0d30
[ "_, _, nodes = node_to_edge(self.edges, directed=False)\nnodes_indices = dict(((n, i) for i, n in enumerate(nodes)))\nnnodes = len(nodes)\nweights = [x[-1] for x in self.edges]\nmax_x, min_x = (max(weights), min(weights))\ninf = 2 * max(abs(max_x), abs(min_x))\nfactor = 10 ** precision\nlogging.debug('TSP rescale: ...
<|body_start_0|> _, _, nodes = node_to_edge(self.edges, directed=False) nodes_indices = dict(((n, i) for i, n in enumerate(nodes))) nnodes = len(nodes) weights = [x[-1] for x in self.edges] max_x, min_x = (max(weights), min(weights)) inf = 2 * max(abs(max_x), abs(min_x)) ...
TSPDataModel
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TSPDataModel: def distance_matrix(self, precision=0) -> tuple: """Compute the distance matrix Returns: np.array: Numpy square matrix with integer entries as distance""" <|body_0|> def solve(self, time_limit=5, concorde=False, precision=0) -> list: """Solve the TSP in...
stack_v2_sparse_classes_36k_train_000154
12,559
permissive
[ { "docstring": "Compute the distance matrix Returns: np.array: Numpy square matrix with integer entries as distance", "name": "distance_matrix", "signature": "def distance_matrix(self, precision=0) -> tuple" }, { "docstring": "Solve the TSP instance. Args: time_limit (int, optional): Time limit ...
2
stack_v2_sparse_classes_30k_train_012855
Implement the Python class `TSPDataModel` described below. Class description: Implement the TSPDataModel class. Method signatures and docstrings: - def distance_matrix(self, precision=0) -> tuple: Compute the distance matrix Returns: np.array: Numpy square matrix with integer entries as distance - def solve(self, tim...
Implement the Python class `TSPDataModel` described below. Class description: Implement the TSPDataModel class. Method signatures and docstrings: - def distance_matrix(self, precision=0) -> tuple: Compute the distance matrix Returns: np.array: Numpy square matrix with integer entries as distance - def solve(self, tim...
695bd2eee98b14118b54fc37e38cd0222ce6a5e9
<|skeleton|> class TSPDataModel: def distance_matrix(self, precision=0) -> tuple: """Compute the distance matrix Returns: np.array: Numpy square matrix with integer entries as distance""" <|body_0|> def solve(self, time_limit=5, concorde=False, precision=0) -> list: """Solve the TSP in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TSPDataModel: def distance_matrix(self, precision=0) -> tuple: """Compute the distance matrix Returns: np.array: Numpy square matrix with integer entries as distance""" _, _, nodes = node_to_edge(self.edges, directed=False) nodes_indices = dict(((n, i) for i, n in enumerate(nodes))) ...
the_stack_v2_python_sparse
jcvi/algorithms/tsp.py
tanghaibao/jcvi
train
641
e378688782bc4d1f01ce5456f1b8ee24cb8c919f
[ "if not isinstance(actionspace, Dict):\n raise ValueError('actionspace must be Dict but found ' + str(actionspace))\nif len(agentComponentList) == 0:\n raise ValueError('There must be at least 1 agent in the list')\nfor agent in agentComponentList:\n if not isinstance(agent, QAgentComponent):\n rais...
<|body_start_0|> if not isinstance(actionspace, Dict): raise ValueError('actionspace must be Dict but found ' + str(actionspace)) if len(agentComponentList) == 0: raise ValueError('There must be at least 1 agent in the list') for agent in agentComponentList: i...
A QCoordinator is an agent that can coordinate a set of sub-agents in such a way that the sum of their actions is optimal. See #step for more details. The QCoordinator should work with environments that have a dictionary action space of the form: A={ "entityId1": Discrete(n1) "entitityId2": Discrete(n2) "entityId3": Di...
QCoordinator
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QCoordinator: """A QCoordinator is an agent that can coordinate a set of sub-agents in such a way that the sum of their actions is optimal. See #step for more details. The QCoordinator should work with environments that have a dictionary action space of the form: A={ "entityId1": Discrete(n1) "en...
stack_v2_sparse_classes_36k_train_000155
4,795
no_license
[ { "docstring": "@param AgentComponentList: a list of QAgentComponent. Size must be >=1. The agent environments should be equal to our environment, or to a Packed version of it. We can't check this because environments do not implement equals at this moment. @param environment the openAI Gym Env. Must have actio...
2
stack_v2_sparse_classes_30k_train_021055
Implement the Python class `QCoordinator` described below. Class description: A QCoordinator is an agent that can coordinate a set of sub-agents in such a way that the sum of their actions is optimal. See #step for more details. The QCoordinator should work with environments that have a dictionary action space of the ...
Implement the Python class `QCoordinator` described below. Class description: A QCoordinator is an agent that can coordinate a set of sub-agents in such a way that the sum of their actions is optimal. See #step for more details. The QCoordinator should work with environments that have a dictionary action space of the ...
e7d052c6a01e0470bfd011d9dc5ba95247466494
<|skeleton|> class QCoordinator: """A QCoordinator is an agent that can coordinate a set of sub-agents in such a way that the sum of their actions is optimal. See #step for more details. The QCoordinator should work with environments that have a dictionary action space of the form: A={ "entityId1": Discrete(n1) "en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QCoordinator: """A QCoordinator is an agent that can coordinate a set of sub-agents in such a way that the sum of their actions is optimal. See #step for more details. The QCoordinator should work with environments that have a dictionary action space of the form: A={ "entityId1": Discrete(n1) "entitityId2": D...
the_stack_v2_python_sparse
aiagents/multi/QCoordinator.py
INFLUENCEorg/aiagents
train
0
85817c87532492f212b765e0a5b13ad9f9c578f4
[ "super(ExperimentalLearner, self).__init__(**kwargs)\nif not isinstance(self.embedding_fn, tf.Module):\n raise ValueError('The `embedding_fn` provided to `ExperimentalLearner`s must be an instance of `tf.Module`.')\nself._built = False", "del onehot_labels\ndel predictions\nreturn tf.reduce_sum(input_tensor=se...
<|body_start_0|> super(ExperimentalLearner, self).__init__(**kwargs) if not isinstance(self.embedding_fn, tf.Module): raise ValueError('The `embedding_fn` provided to `ExperimentalLearner`s must be an instance of `tf.Module`.') self._built = False <|end_body_0|> <|body_start_1|> ...
An experimental learner.
ExperimentalLearner
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExperimentalLearner: """An experimental learner.""" def __init__(self, **kwargs): """Constructs an `ExperimentalLearner`. Args: **kwargs: Keyword arguments common to all `Learner`s. Raises: ValueError: If the `embedding_fn` provided is not an instance of `tf.Module`.""" <|bod...
stack_v2_sparse_classes_36k_train_000156
3,466
permissive
[ { "docstring": "Constructs an `ExperimentalLearner`. Args: **kwargs: Keyword arguments common to all `Learner`s. Raises: ValueError: If the `embedding_fn` provided is not an instance of `tf.Module`.", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Computes a r...
5
stack_v2_sparse_classes_30k_train_014953
Implement the Python class `ExperimentalLearner` described below. Class description: An experimental learner. Method signatures and docstrings: - def __init__(self, **kwargs): Constructs an `ExperimentalLearner`. Args: **kwargs: Keyword arguments common to all `Learner`s. Raises: ValueError: If the `embedding_fn` pro...
Implement the Python class `ExperimentalLearner` described below. Class description: An experimental learner. Method signatures and docstrings: - def __init__(self, **kwargs): Constructs an `ExperimentalLearner`. Args: **kwargs: Keyword arguments common to all `Learner`s. Raises: ValueError: If the `embedding_fn` pro...
13ca9ed2533056909f232168c759c096ae291740
<|skeleton|> class ExperimentalLearner: """An experimental learner.""" def __init__(self, **kwargs): """Constructs an `ExperimentalLearner`. Args: **kwargs: Keyword arguments common to all `Learner`s. Raises: ValueError: If the `embedding_fn` provided is not an instance of `tf.Module`.""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExperimentalLearner: """An experimental learner.""" def __init__(self, **kwargs): """Constructs an `ExperimentalLearner`. Args: **kwargs: Keyword arguments common to all `Learner`s. Raises: ValueError: If the `embedding_fn` provided is not an instance of `tf.Module`.""" super(Experimental...
the_stack_v2_python_sparse
meta_dataset/learners/experimental/base.py
google-research/meta-dataset
train
753
c4459562e654698cfad03bc7b8c8659413657eb2
[ "super(AdelaideFastNAS, self).__init__()\nself.desc = copy.deepcopy(net_desc)\nself.backbone_load_path = self.desc['backbone_load_path']\nif 'data_format' in self.desc:\n self.data_format = self.desc.get('data_format')\nelse:\n self.data_format = self.desc.get('data_format', 'channels_first')\n self.desc['...
<|body_start_0|> super(AdelaideFastNAS, self).__init__() self.desc = copy.deepcopy(net_desc) self.backbone_load_path = self.desc['backbone_load_path'] if 'data_format' in self.desc: self.data_format = self.desc.get('data_format') else: self.data_format = s...
Search space of AdelaideFastNAS.
AdelaideFastNAS
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdelaideFastNAS: """Search space of AdelaideFastNAS.""" def __init__(self, net_desc): """Construct the AdelaideFastNAS class. :param net_desc: config of the searched structure""" <|body_0|> def __call__(self, input_var, training): """Do an inference on AdelaideFa...
stack_v2_sparse_classes_36k_train_000157
2,352
permissive
[ { "docstring": "Construct the AdelaideFastNAS class. :param net_desc: config of the searched structure", "name": "__init__", "signature": "def __init__(self, net_desc)" }, { "docstring": "Do an inference on AdelaideFastNAS model. :param input_var: input tensor :return: output tensor", "name"...
2
null
Implement the Python class `AdelaideFastNAS` described below. Class description: Search space of AdelaideFastNAS. Method signatures and docstrings: - def __init__(self, net_desc): Construct the AdelaideFastNAS class. :param net_desc: config of the searched structure - def __call__(self, input_var, training): Do an in...
Implement the Python class `AdelaideFastNAS` described below. Class description: Search space of AdelaideFastNAS. Method signatures and docstrings: - def __init__(self, net_desc): Construct the AdelaideFastNAS class. :param net_desc: config of the searched structure - def __call__(self, input_var, training): Do an in...
df51ed9c1d6dbde1deef63f2a037a369f8554406
<|skeleton|> class AdelaideFastNAS: """Search space of AdelaideFastNAS.""" def __init__(self, net_desc): """Construct the AdelaideFastNAS class. :param net_desc: config of the searched structure""" <|body_0|> def __call__(self, input_var, training): """Do an inference on AdelaideFa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdelaideFastNAS: """Search space of AdelaideFastNAS.""" def __init__(self, net_desc): """Construct the AdelaideFastNAS class. :param net_desc: config of the searched structure""" super(AdelaideFastNAS, self).__init__() self.desc = copy.deepcopy(net_desc) self.backbone_load...
the_stack_v2_python_sparse
built-in/TensorFlow/Research/cv/image_classification/Cars_for_TensorFlow/automl/vega/search_space/networks/tensorflow/customs/adelaide.py
Huawei-Ascend/modelzoo
train
1
ca126b5979e94a5a80047e9d2c3c03b1005b568e
[ "def generate(A):\n if len(A) == 2 * n:\n if valid(A):\n ret.append(''.join(A))\n print(''.join(A))\n else:\n A.append('(')\n generate(A)\n A.pop()\n A.append(')')\n generate(A)\n A.pop()\n\ndef valid(A):\n bal = 0\n for i in A:\n ...
<|body_start_0|> def generate(A): if len(A) == 2 * n: if valid(A): ret.append(''.join(A)) print(''.join(A)) else: A.append('(') generate(A) A.pop() A.append(')') ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def generateParenthesis(self, n): """:type n: int :rtype: List[str]""" <|body_0|> def generateParenthesis(self, n): """:type n: int :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> def generate(A): if len(A) ==...
stack_v2_sparse_classes_36k_train_000158
1,568
no_license
[ { "docstring": ":type n: int :rtype: List[str]", "name": "generateParenthesis", "signature": "def generateParenthesis(self, n)" }, { "docstring": ":type n: int :rtype: List[str]", "name": "generateParenthesis", "signature": "def generateParenthesis(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_014444
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generateParenthesis(self, n): :type n: int :rtype: List[str] - def generateParenthesis(self, n): :type n: int :rtype: List[str]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generateParenthesis(self, n): :type n: int :rtype: List[str] - def generateParenthesis(self, n): :type n: int :rtype: List[str] <|skeleton|> class Solution: def generat...
d3e8669f932fc2e22711e8b7590d3365d020e189
<|skeleton|> class Solution: def generateParenthesis(self, n): """:type n: int :rtype: List[str]""" <|body_0|> def generateParenthesis(self, n): """:type n: int :rtype: List[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def generateParenthesis(self, n): """:type n: int :rtype: List[str]""" def generate(A): if len(A) == 2 * n: if valid(A): ret.append(''.join(A)) print(''.join(A)) else: A.append('(') ...
the_stack_v2_python_sparse
leetcode/22.py
liuweilin17/algorithm
train
3
1aedacd65b28e892af82b6d63e0cc404b2b67712
[ "context = kwargs.get('context', {})\ncontext['tiers'] = cls.related_serializers['tiers'](context.get('tier_objects', []), context=context, many=True).data\ncontext['levels'] = cls.related_serializers['levels'](context.get('level_objects', []), context=context, many=True).data\nprogram = Program.rf_aware_objects.se...
<|body_start_0|> context = kwargs.get('context', {}) context['tiers'] = cls.related_serializers['tiers'](context.get('tier_objects', []), context=context, many=True).data context['levels'] = cls.related_serializers['levels'](context.get('level_objects', []), context=context, many=True).data ...
Program Serializer component to serialize just program data for excel rendered IPTT output
IPTTExcelMixin
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IPTTExcelMixin: """Program Serializer component to serialize just program data for excel rendered IPTT output""" def load_for_pk(cls, program_pk, **kwargs): """Main entry point - loads a program with prefetched context for rendering Excel export of IPTT""" <|body_0|> def...
stack_v2_sparse_classes_36k_train_000159
10,971
permissive
[ { "docstring": "Main entry point - loads a program with prefetched context for rendering Excel export of IPTT", "name": "load_for_pk", "signature": "def load_for_pk(cls, program_pk, **kwargs)" }, { "docstring": "Returns serialized data _in order_ based on context key", "name": "get_levels", ...
2
null
Implement the Python class `IPTTExcelMixin` described below. Class description: Program Serializer component to serialize just program data for excel rendered IPTT output Method signatures and docstrings: - def load_for_pk(cls, program_pk, **kwargs): Main entry point - loads a program with prefetched context for rend...
Implement the Python class `IPTTExcelMixin` described below. Class description: Program Serializer component to serialize just program data for excel rendered IPTT output Method signatures and docstrings: - def load_for_pk(cls, program_pk, **kwargs): Main entry point - loads a program with prefetched context for rend...
7ca89ab1e5f55cbe4577d16d7281c6cf0936fc3d
<|skeleton|> class IPTTExcelMixin: """Program Serializer component to serialize just program data for excel rendered IPTT output""" def load_for_pk(cls, program_pk, **kwargs): """Main entry point - loads a program with prefetched context for rendering Excel export of IPTT""" <|body_0|> def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IPTTExcelMixin: """Program Serializer component to serialize just program data for excel rendered IPTT output""" def load_for_pk(cls, program_pk, **kwargs): """Main entry point - loads a program with prefetched context for rendering Excel export of IPTT""" context = kwargs.get('context', ...
the_stack_v2_python_sparse
workflow/serializers_new/iptt_program_serializers.py
mercycorps/toladata
train
0
d7cf0ec28adb38a224fc46d9222248a5a06c4f91
[ "response = self.client.get(reverse('home'))\nself.assertEqual(response.status_code, 200)\nself.assertContains(response, 'About Me')\nself.assertContains(response, 'March Madness')\nself.assertContains(response, 'graduation rates')", "response = self.client.get(reverse('aboutme'))\nself.assertEqual(response.statu...
<|body_start_0|> response = self.client.get(reverse('home')) self.assertEqual(response.status_code, 200) self.assertContains(response, 'About Me') self.assertContains(response, 'March Madness') self.assertContains(response, 'graduation rates') <|end_body_0|> <|body_start_1|> ...
AllPagesOpen
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AllPagesOpen: def test_index_loads(self): """Make sure main index page loads and displays content""" <|body_0|> def test_about_me_loads(self): """Make sure about me page loads and displays content""" <|body_1|> def test_basketball_project_loads(self): ...
stack_v2_sparse_classes_36k_train_000160
4,601
no_license
[ { "docstring": "Make sure main index page loads and displays content", "name": "test_index_loads", "signature": "def test_index_loads(self)" }, { "docstring": "Make sure about me page loads and displays content", "name": "test_about_me_loads", "signature": "def test_about_me_loads(self)"...
4
stack_v2_sparse_classes_30k_train_017055
Implement the Python class `AllPagesOpen` described below. Class description: Implement the AllPagesOpen class. Method signatures and docstrings: - def test_index_loads(self): Make sure main index page loads and displays content - def test_about_me_loads(self): Make sure about me page loads and displays content - def...
Implement the Python class `AllPagesOpen` described below. Class description: Implement the AllPagesOpen class. Method signatures and docstrings: - def test_index_loads(self): Make sure main index page loads and displays content - def test_about_me_loads(self): Make sure about me page loads and displays content - def...
2a8e2dc4e9b3cb92d4d437b37e61940a9486b81f
<|skeleton|> class AllPagesOpen: def test_index_loads(self): """Make sure main index page loads and displays content""" <|body_0|> def test_about_me_loads(self): """Make sure about me page loads and displays content""" <|body_1|> def test_basketball_project_loads(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AllPagesOpen: def test_index_loads(self): """Make sure main index page loads and displays content""" response = self.client.get(reverse('home')) self.assertEqual(response.status_code, 200) self.assertContains(response, 'About Me') self.assertContains(response, 'March Ma...
the_stack_v2_python_sparse
mysite/tests.py
smeds1/mysite
train
1
16ed45389b39fe2b182b29a726e1da79007c5736
[ "super().__init__(rho=rho, mus_prior=mus_prior, stds_prior=stds_prior, number_of_classes=number_of_classes, dim_input=dim_input, dim_channels=dim_channels, hidden_activation=hidden_activation, last_activation=last_activation)\nif rho == 'determinist':\n self.determinist = True\nelif type(rho) in [int, float]:\n ...
<|body_start_0|> super().__init__(rho=rho, mus_prior=mus_prior, stds_prior=stds_prior, number_of_classes=number_of_classes, dim_input=dim_input, dim_channels=dim_channels, hidden_activation=hidden_activation, last_activation=last_activation) if rho == 'determinist': self.determinist = True ...
Same as GaussianClassifier but without batch norm layers
GaussianClassifierNoBatchNorm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GaussianClassifierNoBatchNorm: """Same as GaussianClassifier but without batch norm layers""" def __init__(self, rho=-5, mus_prior=(0, 0), stds_prior=None, number_of_classes=10, dim_input=28, dim_channels=1, hidden_activation=F.relu, last_activation=F.softmax): """Args: rho (float): ...
stack_v2_sparse_classes_36k_train_000161
14,393
no_license
[ { "docstring": "Args: rho (float): parameter to get the std. std = log(1+exp(rho)) mus_prior (tuple): the means of the prior (weight and bias). Often will be (0,0) stds_prior (tuple): the stds of the prior (weight and bias) number_of_classes (int): number of different classes in the problem dim_input (int): dim...
2
stack_v2_sparse_classes_30k_train_009570
Implement the Python class `GaussianClassifierNoBatchNorm` described below. Class description: Same as GaussianClassifier but without batch norm layers Method signatures and docstrings: - def __init__(self, rho=-5, mus_prior=(0, 0), stds_prior=None, number_of_classes=10, dim_input=28, dim_channels=1, hidden_activatio...
Implement the Python class `GaussianClassifierNoBatchNorm` described below. Class description: Same as GaussianClassifier but without batch norm layers Method signatures and docstrings: - def __init__(self, rho=-5, mus_prior=(0, 0), stds_prior=None, number_of_classes=10, dim_input=28, dim_channels=1, hidden_activatio...
e0daf7d01a90ff6ce4f969b1f01075f7e2cc7c58
<|skeleton|> class GaussianClassifierNoBatchNorm: """Same as GaussianClassifier but without batch norm layers""" def __init__(self, rho=-5, mus_prior=(0, 0), stds_prior=None, number_of_classes=10, dim_input=28, dim_channels=1, hidden_activation=F.relu, last_activation=F.softmax): """Args: rho (float): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GaussianClassifierNoBatchNorm: """Same as GaussianClassifier but without batch norm layers""" def __init__(self, rho=-5, mus_prior=(0, 0), stds_prior=None, number_of_classes=10, dim_input=28, dim_channels=1, hidden_activation=F.relu, last_activation=F.softmax): """Args: rho (float): parameter to ...
the_stack_v2_python_sparse
src/models/bayesian_models/gaussian_classifiers.py
TheodoreAouad/Deterministic_vs_Bayesian
train
0
08635877872385efbd79cba81e702e25886cf1cc
[ "if resampler == None:\n self._resampler = ResamplerLayer(interpolation='LINEAR', boundary='REPLICATE')\n self._interpolation = 'LINEAR'\nelse:\n self._resampler = resampler\n self._interpolation = self._resampler.interpolation\nself._field_transform = field_transform\nsuper(ResampledFieldGridWarperLaye...
<|body_start_0|> if resampler == None: self._resampler = ResamplerLayer(interpolation='LINEAR', boundary='REPLICATE') self._interpolation = 'LINEAR' else: self._resampler = resampler self._interpolation = self._resampler.interpolation self._field_t...
The resampled field grid warper defines a grid based on sampling coordinate values from a spatially varying displacement field (passed as a tensor input) along an affine grid pattern in the field. This enables grids representing small patches of a larger transform, as well as the composition of multiple transforms befo...
ResampledFieldGridWarperLayer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResampledFieldGridWarperLayer: """The resampled field grid warper defines a grid based on sampling coordinate values from a spatially varying displacement field (passed as a tensor input) along an affine grid pattern in the field. This enables grids representing small patches of a larger transfor...
stack_v2_sparse_classes_36k_train_000162
11,338
permissive
[ { "docstring": "Constructs an ResampledFieldingGridWarperLayer. Args: source_shape: Iterable of integers determining the size of the source signal domain. output_shape: Iterable of integers determining the size of the destination resampled signal domain. coeff_shape: Shape of displacement field. interpolation: ...
3
null
Implement the Python class `ResampledFieldGridWarperLayer` described below. Class description: The resampled field grid warper defines a grid based on sampling coordinate values from a spatially varying displacement field (passed as a tensor input) along an affine grid pattern in the field. This enables grids represen...
Implement the Python class `ResampledFieldGridWarperLayer` described below. Class description: The resampled field grid warper defines a grid based on sampling coordinate values from a spatially varying displacement field (passed as a tensor input) along an affine grid pattern in the field. This enables grids represen...
84dd0f85c9a1ab8a72f4c55fcf073379acf5ae1b
<|skeleton|> class ResampledFieldGridWarperLayer: """The resampled field grid warper defines a grid based on sampling coordinate values from a spatially varying displacement field (passed as a tensor input) along an affine grid pattern in the field. This enables grids representing small patches of a larger transfor...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResampledFieldGridWarperLayer: """The resampled field grid warper defines a grid based on sampling coordinate values from a spatially varying displacement field (passed as a tensor input) along an affine grid pattern in the field. This enables grids representing small patches of a larger transform, as well as...
the_stack_v2_python_sparse
niftynet/layer/spatial_transformer.py
12SigmaTechnologies/NiftyNet-1
train
2
85807726b59473110c5a2dc4510cd979470af406
[ "super(Basic, self).__init__(input_file=input_file, params=params, BaselevelHandlerClass=BaselevelHandlerClass)\nK_sp = self.get_parameter_from_exponent('K_sp', raise_error=False)\nK_ss = self.get_parameter_from_exponent('K_ss', raise_error=False)\nlinear_diffusivity = self._length_factor ** 2.0 * self.get_paramete...
<|body_start_0|> super(Basic, self).__init__(input_file=input_file, params=params, BaselevelHandlerClass=BaselevelHandlerClass) K_sp = self.get_parameter_from_exponent('K_sp', raise_error=False) K_ss = self.get_parameter_from_exponent('K_ss', raise_error=False) linear_diffusivity = self....
A Basic computes erosion using linear diffusion, basic stream power, and Q~A.
Basic
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Basic: """A Basic computes erosion using linear diffusion, basic stream power, and Q~A.""" def __init__(self, input_file=None, params=None, BaselevelHandlerClass=None): """Initialize the Basic model.""" <|body_0|> def run_one_step(self, dt): """Advance model for ...
stack_v2_sparse_classes_36k_train_000163
4,084
permissive
[ { "docstring": "Initialize the Basic model.", "name": "__init__", "signature": "def __init__(self, input_file=None, params=None, BaselevelHandlerClass=None)" }, { "docstring": "Advance model for one time-step of duration dt.", "name": "run_one_step", "signature": "def run_one_step(self, ...
2
stack_v2_sparse_classes_30k_train_006412
Implement the Python class `Basic` described below. Class description: A Basic computes erosion using linear diffusion, basic stream power, and Q~A. Method signatures and docstrings: - def __init__(self, input_file=None, params=None, BaselevelHandlerClass=None): Initialize the Basic model. - def run_one_step(self, dt...
Implement the Python class `Basic` described below. Class description: A Basic computes erosion using linear diffusion, basic stream power, and Q~A. Method signatures and docstrings: - def __init__(self, input_file=None, params=None, BaselevelHandlerClass=None): Initialize the Basic model. - def run_one_step(self, dt...
1b756477b8a8ab6a8f1275b1b30ec84855c840ea
<|skeleton|> class Basic: """A Basic computes erosion using linear diffusion, basic stream power, and Q~A.""" def __init__(self, input_file=None, params=None, BaselevelHandlerClass=None): """Initialize the Basic model.""" <|body_0|> def run_one_step(self, dt): """Advance model for ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Basic: """A Basic computes erosion using linear diffusion, basic stream power, and Q~A.""" def __init__(self, input_file=None, params=None, BaselevelHandlerClass=None): """Initialize the Basic model.""" super(Basic, self).__init__(input_file=input_file, params=params, BaselevelHandlerClas...
the_stack_v2_python_sparse
terrainbento/derived_models/model_000_basic/model_000_basic.py
mcflugen/terrainbento
train
0
9bc1ff1330fa9eeaef7a82fca4b19c0c1341762b
[ "def recursive(root, ans):\n if not root:\n return\n recursive(root.left, ans)\n if root.val:\n ans.append(root.val)\n recursive(root.right, ans)\nans = []\nrecursive(root, ans)\nreturn ans", "stack = []\nans = []\ncurr_node = root\nwhile curr_node or stack:\n while curr_node:\n ...
<|body_start_0|> def recursive(root, ans): if not root: return recursive(root.left, ans) if root.val: ans.append(root.val) recursive(root.right, ans) ans = [] recursive(root, ans) return ans <|end_body_0|> <...
Solution
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def inorderTraversal(self, root: TreeNode) -> List[int]: """Recursive solution""" <|body_0|> def inorderTraversal(self, root: TreeNode) -> List[int]: """Iterative solution""" <|body_1|> def inorderTraversal(self, root: TreeNode) -> List[int]: ...
stack_v2_sparse_classes_36k_train_000164
2,156
permissive
[ { "docstring": "Recursive solution", "name": "inorderTraversal", "signature": "def inorderTraversal(self, root: TreeNode) -> List[int]" }, { "docstring": "Iterative solution", "name": "inorderTraversal", "signature": "def inorderTraversal(self, root: TreeNode) -> List[int]" }, { ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def inorderTraversal(self, root: TreeNode) -> List[int]: Recursive solution - def inorderTraversal(self, root: TreeNode) -> List[int]: Iterative solution - def inorderTraversal(s...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def inorderTraversal(self, root: TreeNode) -> List[int]: Recursive solution - def inorderTraversal(self, root: TreeNode) -> List[int]: Iterative solution - def inorderTraversal(s...
226cecde136531341ce23cdf88529345be1912fc
<|skeleton|> class Solution: def inorderTraversal(self, root: TreeNode) -> List[int]: """Recursive solution""" <|body_0|> def inorderTraversal(self, root: TreeNode) -> List[int]: """Iterative solution""" <|body_1|> def inorderTraversal(self, root: TreeNode) -> List[int]: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def inorderTraversal(self, root: TreeNode) -> List[int]: """Recursive solution""" def recursive(root, ans): if not root: return recursive(root.left, ans) if root.val: ans.append(root.val) recursive(root.r...
the_stack_v2_python_sparse
Leetcode/Intermediate/Tree and graph/94_Binary_Tree_Inorder_Traversal.py
ZR-Huang/AlgorithmsPractices
train
1
f79227895895befb9d6477caac884e53171e7c28
[ "super().__init__(parent)\nself.parent = parent\nself.order = self.parent.getParent().holder.getOrder()\nself.items = self.order.getItems()\nself.initUi()", "style = 'QLabel {\\n font-family: Asap;\\n font-weight: bold;\\n font-size: 25pt;\\n ...
<|body_start_0|> super().__init__(parent) self.parent = parent self.order = self.parent.getParent().holder.getOrder() self.items = self.order.getItems() self.initUi() <|end_body_0|> <|body_start_1|> style = 'QLabel {\n font-family: Asap;\n ...
Widget to select items to pop from one order to another one.
PopOrderWidget
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PopOrderWidget: """Widget to select items to pop from one order to another one.""" def __init__(self, parent): """Init.""" <|body_0|> def initUi(self): """UI setup.""" <|body_1|> def paintEvent(self, event): """Set window background color."""...
stack_v2_sparse_classes_36k_train_000165
27,111
no_license
[ { "docstring": "Init.", "name": "__init__", "signature": "def __init__(self, parent)" }, { "docstring": "UI setup.", "name": "initUi", "signature": "def initUi(self)" }, { "docstring": "Set window background color.", "name": "paintEvent", "signature": "def paintEvent(self...
3
stack_v2_sparse_classes_30k_train_021404
Implement the Python class `PopOrderWidget` described below. Class description: Widget to select items to pop from one order to another one. Method signatures and docstrings: - def __init__(self, parent): Init. - def initUi(self): UI setup. - def paintEvent(self, event): Set window background color.
Implement the Python class `PopOrderWidget` described below. Class description: Widget to select items to pop from one order to another one. Method signatures and docstrings: - def __init__(self, parent): Init. - def initUi(self): UI setup. - def paintEvent(self, event): Set window background color. <|skeleton|> cla...
a5d18593e689123cac34af552628ed2818ca5d59
<|skeleton|> class PopOrderWidget: """Widget to select items to pop from one order to another one.""" def __init__(self, parent): """Init.""" <|body_0|> def initUi(self): """UI setup.""" <|body_1|> def paintEvent(self, event): """Set window background color."""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PopOrderWidget: """Widget to select items to pop from one order to another one.""" def __init__(self, parent): """Init.""" super().__init__(parent) self.parent = parent self.order = self.parent.getParent().holder.getOrder() self.items = self.order.getItems() ...
the_stack_v2_python_sparse
Dialogs.py
edgary777/lonchepos
train
0
08747748a4c5268ae195f91b7576f0a88fa76a08
[ "current = self.head\nwhile current is not None:\n if current.value[0] == key:\n return current.value[1]\n current = current.next\nreturn None", "if self.is_empty():\n print('Список пуст')\nelse:\n current = self.head\n ind = 0\n while current is not None:\n if current.value[0] == ...
<|body_start_0|> current = self.head while current is not None: if current.value[0] == key: return current.value[1] current = current.next return None <|end_body_0|> <|body_start_1|> if self.is_empty(): print('Список пуст') els...
This is the linked list class for the hash table
LinkedListHash
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinkedListHash: """This is the linked list class for the hash table""" def this_value(self, key): """Method for checking the existence of a node with a given value in the list""" <|body_0|> def delete_value(self, key): """Method for removing a node / nodes by a g...
stack_v2_sparse_classes_36k_train_000166
2,309
no_license
[ { "docstring": "Method for checking the existence of a node with a given value in the list", "name": "this_value", "signature": "def this_value(self, key)" }, { "docstring": "Method for removing a node / nodes by a given key from the list", "name": "delete_value", "signature": "def delet...
2
stack_v2_sparse_classes_30k_train_020773
Implement the Python class `LinkedListHash` described below. Class description: This is the linked list class for the hash table Method signatures and docstrings: - def this_value(self, key): Method for checking the existence of a node with a given value in the list - def delete_value(self, key): Method for removing ...
Implement the Python class `LinkedListHash` described below. Class description: This is the linked list class for the hash table Method signatures and docstrings: - def this_value(self, key): Method for checking the existence of a node with a given value in the list - def delete_value(self, key): Method for removing ...
44d27242789d670efa64dd72f9a112a80df8373c
<|skeleton|> class LinkedListHash: """This is the linked list class for the hash table""" def this_value(self, key): """Method for checking the existence of a node with a given value in the list""" <|body_0|> def delete_value(self, key): """Method for removing a node / nodes by a g...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinkedListHash: """This is the linked list class for the hash table""" def this_value(self, key): """Method for checking the existence of a node with a given value in the list""" current = self.head while current is not None: if current.value[0] == key: ...
the_stack_v2_python_sparse
structures/hash_table.py
SvetlanaSumets11/python-education
train
0
22998bf2ee66a5879dfc44b581a6708a3eec786b
[ "user = get_a_UserRoles(UserRoleId)\nif not user:\n api.abort(404)\nelse:\n return user\ndata = request.json\nreturn get_a_UserRoles(data=data)", "user = complete_UserRoles(UserRoleId)\nif not user:\n api.abort(404)\nelse:\n return user\ndata = request.json\nreturn complete_UserRoles(data=data)", "u...
<|body_start_0|> user = get_a_UserRoles(UserRoleId) if not user: api.abort(404) else: return user data = request.json return get_a_UserRoles(data=data) <|end_body_0|> <|body_start_1|> user = complete_UserRoles(UserRoleId) if not user: ...
UserRoles
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserRoles: def get(self, UserRoleId): """get a UserRoles given its identifier""" <|body_0|> def put(self, UserRoleId): """UserRoles updated""" <|body_1|> def delete(self, UserRoleId): """UserRoles deleted""" <|body_2|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_000167
2,719
no_license
[ { "docstring": "get a UserRoles given its identifier", "name": "get", "signature": "def get(self, UserRoleId)" }, { "docstring": "UserRoles updated", "name": "put", "signature": "def put(self, UserRoleId)" }, { "docstring": "UserRoles deleted", "name": "delete", "signatur...
3
null
Implement the Python class `UserRoles` described below. Class description: Implement the UserRoles class. Method signatures and docstrings: - def get(self, UserRoleId): get a UserRoles given its identifier - def put(self, UserRoleId): UserRoles updated - def delete(self, UserRoleId): UserRoles deleted
Implement the Python class `UserRoles` described below. Class description: Implement the UserRoles class. Method signatures and docstrings: - def get(self, UserRoleId): get a UserRoles given its identifier - def put(self, UserRoleId): UserRoles updated - def delete(self, UserRoleId): UserRoles deleted <|skeleton|> c...
4fa4042304ee01cf23ecc81f9c27977fd12c31b9
<|skeleton|> class UserRoles: def get(self, UserRoleId): """get a UserRoles given its identifier""" <|body_0|> def put(self, UserRoleId): """UserRoles updated""" <|body_1|> def delete(self, UserRoleId): """UserRoles deleted""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserRoles: def get(self, UserRoleId): """get a UserRoles given its identifier""" user = get_a_UserRoles(UserRoleId) if not user: api.abort(404) else: return user data = request.json return get_a_UserRoles(data=data) def put(self, Use...
the_stack_v2_python_sparse
main/controller/UserRoles_controller.py
Gauravkumar45/Flask-RESTPlus-API
train
0
6ba23a850b67a8fb27034340ccc0aee22c6e62b1
[ "_type, qname, qclass, qtype, _id, ip = query\nself.has_result = False\nqname_lower = qname.lower()\n'List of servers to round-robin'\nservers = ['192.168.1.201', '192.168.1.202']\nserver = random.choice(servers)\nself.results = []\nif (qtype == 'A' or qtype == 'ANY') and qname_lower == 'test.domain.org':\n self...
<|body_start_0|> _type, qname, qclass, qtype, _id, ip = query self.has_result = False qname_lower = qname.lower() 'List of servers to round-robin' servers = ['192.168.1.201', '192.168.1.202'] server = random.choice(servers) self.results = [] if (qtype == '...
Handle PowerDNS pipe-backend domain name lookups.
DNSLookup
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DNSLookup: """Handle PowerDNS pipe-backend domain name lookups.""" def __init__(self, query): """parse DNS query and produce lookup result. query: a sequence containing the DNS query as per PowerDNS manual appendix A: http://downloads.powerdns.com/documentation/html/backends-detail.h...
stack_v2_sparse_classes_36k_train_000168
4,118
permissive
[ { "docstring": "parse DNS query and produce lookup result. query: a sequence containing the DNS query as per PowerDNS manual appendix A: http://downloads.powerdns.com/documentation/html/backends-detail.html#PIPEBACKEND-PROTOCOL", "name": "__init__", "signature": "def __init__(self, query)" }, { ...
2
stack_v2_sparse_classes_30k_train_009523
Implement the Python class `DNSLookup` described below. Class description: Handle PowerDNS pipe-backend domain name lookups. Method signatures and docstrings: - def __init__(self, query): parse DNS query and produce lookup result. query: a sequence containing the DNS query as per PowerDNS manual appendix A: http://do...
Implement the Python class `DNSLookup` described below. Class description: Handle PowerDNS pipe-backend domain name lookups. Method signatures and docstrings: - def __init__(self, query): parse DNS query and produce lookup result. query: a sequence containing the DNS query as per PowerDNS manual appendix A: http://do...
665d39a2bd82543d5196555f0801ef8fd4a3ee48
<|skeleton|> class DNSLookup: """Handle PowerDNS pipe-backend domain name lookups.""" def __init__(self, query): """parse DNS query and produce lookup result. query: a sequence containing the DNS query as per PowerDNS manual appendix A: http://downloads.powerdns.com/documentation/html/backends-detail.h...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DNSLookup: """Handle PowerDNS pipe-backend domain name lookups.""" def __init__(self, query): """parse DNS query and produce lookup result. query: a sequence containing the DNS query as per PowerDNS manual appendix A: http://downloads.powerdns.com/documentation/html/backends-detail.html#PIPEBACKE...
the_stack_v2_python_sparse
dockerized-gists/10069682/snippet.py
gistable/gistable
train
76
a9e79ced7f79f55849f13742310819e73a64dfb1
[ "self.cluster_info = cluster_info\nself.keyspace_info = keyspace_info\nself.name = name\nself.mtype = mtype\nself.uuid = uuid", "if dictionary is None:\n return None\ncluster_info = cohesity_management_sdk.models.cassandra_cluster.CassandraCluster.from_dictionary(dictionary.get('clusterInfo')) if dictionary.ge...
<|body_start_0|> self.cluster_info = cluster_info self.keyspace_info = keyspace_info self.name = name self.mtype = mtype self.uuid = uuid <|end_body_0|> <|body_start_1|> if dictionary is None: return None cluster_info = cohesity_management_sdk.models....
Implementation of the 'CassandraProtectionSource' model. Specifies an Object representing Cassandra. Attributes: cluster_info (CassandraCluster): Information of a Cassandra cluster, only valid for an entity of type kCluster. keyspace_info (CassandraKeyspace): Information of a cassandra keyspapce, only valid for an enti...
CassandraProtectionSource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CassandraProtectionSource: """Implementation of the 'CassandraProtectionSource' model. Specifies an Object representing Cassandra. Attributes: cluster_info (CassandraCluster): Information of a Cassandra cluster, only valid for an entity of type kCluster. keyspace_info (CassandraKeyspace): Informa...
stack_v2_sparse_classes_36k_train_000169
3,340
permissive
[ { "docstring": "Constructor for the CassandraProtectionSource class", "name": "__init__", "signature": "def __init__(self, cluster_info=None, keyspace_info=None, name=None, mtype=None, uuid=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary...
2
null
Implement the Python class `CassandraProtectionSource` described below. Class description: Implementation of the 'CassandraProtectionSource' model. Specifies an Object representing Cassandra. Attributes: cluster_info (CassandraCluster): Information of a Cassandra cluster, only valid for an entity of type kCluster. key...
Implement the Python class `CassandraProtectionSource` described below. Class description: Implementation of the 'CassandraProtectionSource' model. Specifies an Object representing Cassandra. Attributes: cluster_info (CassandraCluster): Information of a Cassandra cluster, only valid for an entity of type kCluster. key...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class CassandraProtectionSource: """Implementation of the 'CassandraProtectionSource' model. Specifies an Object representing Cassandra. Attributes: cluster_info (CassandraCluster): Information of a Cassandra cluster, only valid for an entity of type kCluster. keyspace_info (CassandraKeyspace): Informa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CassandraProtectionSource: """Implementation of the 'CassandraProtectionSource' model. Specifies an Object representing Cassandra. Attributes: cluster_info (CassandraCluster): Information of a Cassandra cluster, only valid for an entity of type kCluster. keyspace_info (CassandraKeyspace): Information of a cas...
the_stack_v2_python_sparse
cohesity_management_sdk/models/cassandra_protection_source.py
cohesity/management-sdk-python
train
24
66b0d04f9ff8ff6a25a73968d0081278f7593e60
[ "context = super(EntitiesView, self).get_context_data(**kwargs)\ncontext['entities'] = get_entities_list(self.request.session.get('token', False), self.kwargs.get('aiid')).get('entities')\ncontext['allow_regex'] = get_experiments_list(self.request.session.get('token', False), self.kwargs.get('aiid', False), 'regex-...
<|body_start_0|> context = super(EntitiesView, self).get_context_data(**kwargs) context['entities'] = get_entities_list(self.request.session.get('token', False), self.kwargs.get('aiid')).get('entities') context['allow_regex'] = get_experiments_list(self.request.session.get('token', False), self....
Manage AI Entities
EntitiesView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntitiesView: """Manage AI Entities""" def get_context_data(self, **kwargs): """Update context with Entities list""" <|body_0|> def form_valid(self, form): """Try to save Entity, can still be invalid""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_000170
39,842
permissive
[ { "docstring": "Update context with Entities list", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, { "docstring": "Try to save Entity, can still be invalid", "name": "form_valid", "signature": "def form_valid(self, form)" } ]
2
stack_v2_sparse_classes_30k_train_014699
Implement the Python class `EntitiesView` described below. Class description: Manage AI Entities Method signatures and docstrings: - def get_context_data(self, **kwargs): Update context with Entities list - def form_valid(self, form): Try to save Entity, can still be invalid
Implement the Python class `EntitiesView` described below. Class description: Manage AI Entities Method signatures and docstrings: - def get_context_data(self, **kwargs): Update context with Entities list - def form_valid(self, form): Try to save Entity, can still be invalid <|skeleton|> class EntitiesView: """M...
d632d00f9a22a7a826bba4896a7102b2ac8690ff
<|skeleton|> class EntitiesView: """Manage AI Entities""" def get_context_data(self, **kwargs): """Update context with Entities list""" <|body_0|> def form_valid(self, form): """Try to save Entity, can still be invalid""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EntitiesView: """Manage AI Entities""" def get_context_data(self, **kwargs): """Update context with Entities list""" context = super(EntitiesView, self).get_context_data(**kwargs) context['entities'] = get_entities_list(self.request.session.get('token', False), self.kwargs.get('ai...
the_stack_v2_python_sparse
src/studio/views.py
hutomadotAI/web-console
train
6
cfaeaf3d6153e8ebf5eda75940a73f497a4e8fcf
[ "self.pv_name = pv_name\nself.storage_class = storage_class\nself.volume = volume\nself.volume_path = volume_path", "if dictionary is None:\n return None\npv_name = dictionary.get('pvName')\nstorage_class = dictionary.get('storageClass')\nvolume = cohesity_management_sdk.models.pod_info_pod_spec_volume_info.Po...
<|body_start_0|> self.pv_name = pv_name self.storage_class = storage_class self.volume = volume self.volume_path = volume_path <|end_body_0|> <|body_start_1|> if dictionary is None: return None pv_name = dictionary.get('pvName') storage_class = dictio...
Implementation of the 'PodMetadata_VolumeInfo' model. TODO: type description here. Attributes: pv_name (string): The underlying PV name if this volume is a PVC. This will be used to identify name of the directory containing PVC data at the path /var/lib/kubelet/pods. storage_class (string): Name of the storage class. T...
PodMetadata_VolumeInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PodMetadata_VolumeInfo: """Implementation of the 'PodMetadata_VolumeInfo' model. TODO: type description here. Attributes: pv_name (string): The underlying PV name if this volume is a PVC. This will be used to identify name of the directory containing PVC data at the path /var/lib/kubelet/pods. st...
stack_v2_sparse_classes_36k_train_000171
2,473
permissive
[ { "docstring": "Constructor for the PodMetadata_VolumeInfo class", "name": "__init__", "signature": "def __init__(self, pv_name=None, storage_class=None, volume=None, volume_path=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictio...
2
stack_v2_sparse_classes_30k_train_016587
Implement the Python class `PodMetadata_VolumeInfo` described below. Class description: Implementation of the 'PodMetadata_VolumeInfo' model. TODO: type description here. Attributes: pv_name (string): The underlying PV name if this volume is a PVC. This will be used to identify name of the directory containing PVC dat...
Implement the Python class `PodMetadata_VolumeInfo` described below. Class description: Implementation of the 'PodMetadata_VolumeInfo' model. TODO: type description here. Attributes: pv_name (string): The underlying PV name if this volume is a PVC. This will be used to identify name of the directory containing PVC dat...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class PodMetadata_VolumeInfo: """Implementation of the 'PodMetadata_VolumeInfo' model. TODO: type description here. Attributes: pv_name (string): The underlying PV name if this volume is a PVC. This will be used to identify name of the directory containing PVC data at the path /var/lib/kubelet/pods. st...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PodMetadata_VolumeInfo: """Implementation of the 'PodMetadata_VolumeInfo' model. TODO: type description here. Attributes: pv_name (string): The underlying PV name if this volume is a PVC. This will be used to identify name of the directory containing PVC data at the path /var/lib/kubelet/pods. storage_class (...
the_stack_v2_python_sparse
cohesity_management_sdk/models/pod_metadata_volume_info.py
cohesity/management-sdk-python
train
24
3dbe257b5126749aad80941db64961baf9fcfc29
[ "user = instance\nuser_id = user.id\nnew_groups = validated_data.pop('groups', None)\nif new_groups is not None:\n UserInGroups = User.groups.through\n group_qs = UserInGroups.objects.filter(user=user)\n group_qs.exclude(group_id__in=(gr.id for gr in new_groups)).delete()\n for gr in new_groups:\n ...
<|body_start_0|> user = instance user_id = user.id new_groups = validated_data.pop('groups', None) if new_groups is not None: UserInGroups = User.groups.through group_qs = UserInGroups.objects.filter(user=user) group_qs.exclude(group_id__in=(gr.id for ...
Serializer for put and post requests
UserSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserSerializer: """Serializer for put and post requests""" def update(self, instance, validated_data): """update the user-attributes, including profile information""" <|body_0|> def create(self, validated_data): """Create a new user and its profile""" <|b...
stack_v2_sparse_classes_36k_train_000172
7,759
no_license
[ { "docstring": "update the user-attributes, including profile information", "name": "update", "signature": "def update(self, instance, validated_data)" }, { "docstring": "Create a new user and its profile", "name": "create", "signature": "def create(self, validated_data)" } ]
2
null
Implement the Python class `UserSerializer` described below. Class description: Serializer for put and post requests Method signatures and docstrings: - def update(self, instance, validated_data): update the user-attributes, including profile information - def create(self, validated_data): Create a new user and its p...
Implement the Python class `UserSerializer` described below. Class description: Serializer for put and post requests Method signatures and docstrings: - def update(self, instance, validated_data): update the user-attributes, including profile information - def create(self, validated_data): Create a new user and its p...
a5ba34f085f0d5af5ea3ded24706ea54ab39e7cb
<|skeleton|> class UserSerializer: """Serializer for put and post requests""" def update(self, instance, validated_data): """update the user-attributes, including profile information""" <|body_0|> def create(self, validated_data): """Create a new user and its profile""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserSerializer: """Serializer for put and post requests""" def update(self, instance, validated_data): """update the user-attributes, including profile information""" user = instance user_id = user.id new_groups = validated_data.pop('groups', None) if new_groups is...
the_stack_v2_python_sparse
repair/apps/login/serializers/users.py
MaxBo/REPAiR-Web
train
9
309c85fdf9231ca1d2f9311f344808ff18f9d27f
[ "hconfig: Dict[str, Any] = dict()\nconfigs = hyperrun.generate(hconfig)\nself.assertEqual(len(configs), 1)\nself.assertFalse(configs[0])", "hconfig = {'foo': 'bar'}\nconfigs = hyperrun.generate(hconfig)\nself.assertEqual(len(configs), 1)\nself.assertEqual(configs[0], hconfig)", "hconfig = {'foo': ['bar', 'car']...
<|body_start_0|> hconfig: Dict[str, Any] = dict() configs = hyperrun.generate(hconfig) self.assertEqual(len(configs), 1) self.assertFalse(configs[0]) <|end_body_0|> <|body_start_1|> hconfig = {'foo': 'bar'} configs = hyperrun.generate(hconfig) self.assertEqual(le...
Test cases for the hyper configuration generation function.
TestHyperRunGeneration
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestHyperRunGeneration: """Test cases for the hyper configuration generation function.""" def test_empty_dict_gives_empty_dict(self): """The configuration generator gives an empty dictionary on an empty dictionary.""" <|body_0|> def test_constant_dict_gives_single_dict(s...
stack_v2_sparse_classes_36k_train_000173
3,278
permissive
[ { "docstring": "The configuration generator gives an empty dictionary on an empty dictionary.", "name": "test_empty_dict_gives_empty_dict", "signature": "def test_empty_dict_gives_empty_dict(self)" }, { "docstring": "A single dictionary with constant values give a single dictionary.", "name"...
6
stack_v2_sparse_classes_30k_train_007368
Implement the Python class `TestHyperRunGeneration` described below. Class description: Test cases for the hyper configuration generation function. Method signatures and docstrings: - def test_empty_dict_gives_empty_dict(self): The configuration generator gives an empty dictionary on an empty dictionary. - def test_c...
Implement the Python class `TestHyperRunGeneration` described below. Class description: Test cases for the hyper configuration generation function. Method signatures and docstrings: - def test_empty_dict_gives_empty_dict(self): The configuration generator gives an empty dictionary on an empty dictionary. - def test_c...
0f0f654e488a1839455786ccc4ad023c0aa0c2e8
<|skeleton|> class TestHyperRunGeneration: """Test cases for the hyper configuration generation function.""" def test_empty_dict_gives_empty_dict(self): """The configuration generator gives an empty dictionary on an empty dictionary.""" <|body_0|> def test_constant_dict_gives_single_dict(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestHyperRunGeneration: """Test cases for the hyper configuration generation function.""" def test_empty_dict_gives_empty_dict(self): """The configuration generator gives an empty dictionary on an empty dictionary.""" hconfig: Dict[str, Any] = dict() configs = hyperrun.generate(hc...
the_stack_v2_python_sparse
utils/test_hyperrun.py
nuric/pix2rule
train
10
d791c9966a30ffb8256dbcc5013f7b90ff57dbc2
[ "stack = []\np = root\nLastVisited = None\ns = 0\nwhile p != None and p.val != '#' or stack:\n while p != None:\n stack.append(p)\n s += p.val\n p = p.left\n p = stack[-1]\n if p.left == None and p.right == None and (s == sum):\n return True\n if p.right == None or LastVisite...
<|body_start_0|> stack = [] p = root LastVisited = None s = 0 while p != None and p.val != '#' or stack: while p != None: stack.append(p) s += p.val p = p.left p = stack[-1] if p.left == None and ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasPathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: bool""" <|body_0|> def hasPathSum_self(self, root, sum): """:type root: TreeNode :type sum: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> st...
stack_v2_sparse_classes_36k_train_000174
1,467
no_license
[ { "docstring": ":type root: TreeNode :type sum: int :rtype: bool", "name": "hasPathSum", "signature": "def hasPathSum(self, root, sum)" }, { "docstring": ":type root: TreeNode :type sum: int :rtype: bool", "name": "hasPathSum_self", "signature": "def hasPathSum_self(self, root, sum)" }...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasPathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: bool - def hasPathSum_self(self, root, sum): :type root: TreeNode :type sum: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasPathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: bool - def hasPathSum_self(self, root, sum): :type root: TreeNode :type sum: int :rtype: bool <|skel...
ea492ec864b50547214ecbbb2cdeeac21e70229b
<|skeleton|> class Solution: def hasPathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: bool""" <|body_0|> def hasPathSum_self(self, root, sum): """:type root: TreeNode :type sum: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def hasPathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: bool""" stack = [] p = root LastVisited = None s = 0 while p != None and p.val != '#' or stack: while p != None: stack.append(p) ...
the_stack_v2_python_sparse
112_path_sum/sol.py
lianke123321/leetcode_sol
train
0
4b3e2fda65bef530db734d9cb1d0d156dcb11eab
[ "if isinstance(key, int):\n return QoSAttribute(key)\nif key not in QoSAttribute._member_map_:\n return extend_enum(QoSAttribute, key, default)\nreturn QoSAttribute[key]", "if not (isinstance(value, int) and 0 <= value <= 255):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 12 <= ...
<|body_start_0|> if isinstance(key, int): return QoSAttribute(key) if key not in QoSAttribute._member_map_: return extend_enum(QoSAttribute, key, default) return QoSAttribute[key] <|end_body_0|> <|body_start_1|> if not (isinstance(value, int) and 0 <= value <= 25...
[QoSAttribute] Quality-of-Service Attribute Registry
QoSAttribute
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QoSAttribute: """[QoSAttribute] Quality-of-Service Attribute Registry""" def get(key: 'int | str', default: 'int'=-1) -> 'QoSAttribute': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_000175
2,638
permissive
[ { "docstring": "Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:", "name": "get", "signature": "def get(key: 'int | str', default: 'int'=-1) -> 'QoSAttribute'" }, { "docstring": "Lookup function used when value is not found...
2
null
Implement the Python class `QoSAttribute` described below. Class description: [QoSAttribute] Quality-of-Service Attribute Registry Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'QoSAttribute': Backport support for original codes. Args: key: Key to get enum item. default: Default ...
Implement the Python class `QoSAttribute` described below. Class description: [QoSAttribute] Quality-of-Service Attribute Registry Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'QoSAttribute': Backport support for original codes. Args: key: Key to get enum item. default: Default ...
a6fe49ec58f09e105bec5a00fb66d9b3f22730d9
<|skeleton|> class QoSAttribute: """[QoSAttribute] Quality-of-Service Attribute Registry""" def get(key: 'int | str', default: 'int'=-1) -> 'QoSAttribute': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QoSAttribute: """[QoSAttribute] Quality-of-Service Attribute Registry""" def get(key: 'int | str', default: 'int'=-1) -> 'QoSAttribute': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" if isinstance(key, int):...
the_stack_v2_python_sparse
pcapkit/const/mh/qos_attribute.py
JarryShaw/PyPCAPKit
train
204
d5b1a3a90afbce4c4d262058ae6d71fc57075a07
[ "self.pos = f_positive\nself.neg = f_negative\nself.max_lines = 100000\nself.lemmatizer = WordNetLemmatizer()\nself.lexicon = self._create_lexicon()", "lexicon = []\nwith open(self.pos, 'r') as f_handle:\n contents = f_handle.readlines()\n for word in contents[:self.max_lines]:\n all_words = word_tok...
<|body_start_0|> self.pos = f_positive self.neg = f_negative self.max_lines = 100000 self.lemmatizer = WordNetLemmatizer() self.lexicon = self._create_lexicon() <|end_body_0|> <|body_start_1|> lexicon = [] with open(self.pos, 'r') as f_handle: content...
Process Sentiment Data.
Data
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Data: """Process Sentiment Data.""" def __init__(self, f_positive, f_negative): """Method to instantiate the class. Args: f_positive: File with positive sentiments f_negative: File with negative sentiments Returns: None""" <|body_0|> def _create_lexicon(self): ""...
stack_v2_sparse_classes_36k_train_000176
8,117
no_license
[ { "docstring": "Method to instantiate the class. Args: f_positive: File with positive sentiments f_negative: File with negative sentiments Returns: None", "name": "__init__", "signature": "def __init__(self, f_positive, f_negative)" }, { "docstring": "Create the lexicon from files. Args: None Re...
4
stack_v2_sparse_classes_30k_train_005964
Implement the Python class `Data` described below. Class description: Process Sentiment Data. Method signatures and docstrings: - def __init__(self, f_positive, f_negative): Method to instantiate the class. Args: f_positive: File with positive sentiments f_negative: File with negative sentiments Returns: None - def _...
Implement the Python class `Data` described below. Class description: Process Sentiment Data. Method signatures and docstrings: - def __init__(self, f_positive, f_negative): Method to instantiate the class. Args: f_positive: File with positive sentiments f_negative: File with negative sentiments Returns: None - def _...
36a7996b140cccb9003cba8367364645e2d65d85
<|skeleton|> class Data: """Process Sentiment Data.""" def __init__(self, f_positive, f_negative): """Method to instantiate the class. Args: f_positive: File with positive sentiments f_negative: File with negative sentiments Returns: None""" <|body_0|> def _create_lexicon(self): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Data: """Process Sentiment Data.""" def __init__(self, f_positive, f_negative): """Method to instantiate the class. Args: f_positive: File with positive sentiments f_negative: File with negative sentiments Returns: None""" self.pos = f_positive self.neg = f_negative self.m...
the_stack_v2_python_sparse
general/sentdex/tf-nltk-multilayer-perceptron.py
palisadoes/AI
train
1
d331132c1033ceb3ee702a119d156300fdec8b30
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Proto file describing the Campaign Label service. Service to manage labels on campaigns.
CampaignLabelServiceServicer
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CampaignLabelServiceServicer: """Proto file describing the Campaign Label service. Service to manage labels on campaigns.""" def GetCampaignLabel(self, request, context): """Returns the requested campaign-label relationship in full detail.""" <|body_0|> def MutateCampaig...
stack_v2_sparse_classes_36k_train_000177
3,479
permissive
[ { "docstring": "Returns the requested campaign-label relationship in full detail.", "name": "GetCampaignLabel", "signature": "def GetCampaignLabel(self, request, context)" }, { "docstring": "Creates and removes campaign-label relationships. Operation statuses are returned.", "name": "MutateC...
2
null
Implement the Python class `CampaignLabelServiceServicer` described below. Class description: Proto file describing the Campaign Label service. Service to manage labels on campaigns. Method signatures and docstrings: - def GetCampaignLabel(self, request, context): Returns the requested campaign-label relationship in ...
Implement the Python class `CampaignLabelServiceServicer` described below. Class description: Proto file describing the Campaign Label service. Service to manage labels on campaigns. Method signatures and docstrings: - def GetCampaignLabel(self, request, context): Returns the requested campaign-label relationship in ...
0fc8a7dbf31d9e8e2a4364df93bec5f6b7edd50a
<|skeleton|> class CampaignLabelServiceServicer: """Proto file describing the Campaign Label service. Service to manage labels on campaigns.""" def GetCampaignLabel(self, request, context): """Returns the requested campaign-label relationship in full detail.""" <|body_0|> def MutateCampaig...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CampaignLabelServiceServicer: """Proto file describing the Campaign Label service. Service to manage labels on campaigns.""" def GetCampaignLabel(self, request, context): """Returns the requested campaign-label relationship in full detail.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED...
the_stack_v2_python_sparse
google/ads/google_ads/v2/proto/services/campaign_label_service_pb2_grpc.py
juanmacugat/google-ads-python
train
1
d8bb70588fd341da77e3f0f82a6dbd984f6da13a
[ "title = request.GET.get('title', '')\ninterface_case_name = request.GET.get('interface_case_name', '')\nobj = RelevanceCaseSet.objects.filter(parent__interface_case_set_name=title)\nif interface_case_name:\n obj = RelevanceCaseSet.objects.filter(Q(parent__interface_case_set_name=title) & Q(interface_case_name__...
<|body_start_0|> title = request.GET.get('title', '') interface_case_name = request.GET.get('interface_case_name', '') obj = RelevanceCaseSet.objects.filter(parent__interface_case_set_name=title) if interface_case_name: obj = RelevanceCaseSet.objects.filter(Q(parent__interfac...
接口分类
RelevanceCaseSetList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelevanceCaseSetList: """接口分类""" def get(self, request, *args, **kwargs): """获取用例集关联用例列表""" <|body_0|> def post(self, request, *args, **kwargs): """添加用例集关联用例""" <|body_1|> def delete(self, request, pk, *args, **kwargs): """删除用例集关联用例""" ...
stack_v2_sparse_classes_36k_train_000178
5,044
no_license
[ { "docstring": "获取用例集关联用例列表", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "添加用例集关联用例", "name": "post", "signature": "def post(self, request, *args, **kwargs)" }, { "docstring": "删除用例集关联用例", "name": "delete", "signature": "def de...
3
stack_v2_sparse_classes_30k_train_008904
Implement the Python class `RelevanceCaseSetList` described below. Class description: 接口分类 Method signatures and docstrings: - def get(self, request, *args, **kwargs): 获取用例集关联用例列表 - def post(self, request, *args, **kwargs): 添加用例集关联用例 - def delete(self, request, pk, *args, **kwargs): 删除用例集关联用例
Implement the Python class `RelevanceCaseSetList` described below. Class description: 接口分类 Method signatures and docstrings: - def get(self, request, *args, **kwargs): 获取用例集关联用例列表 - def post(self, request, *args, **kwargs): 添加用例集关联用例 - def delete(self, request, pk, *args, **kwargs): 删除用例集关联用例 <|skeleton|> class Rele...
e5247d56eb3af770dca1eeb18571281355e58c08
<|skeleton|> class RelevanceCaseSetList: """接口分类""" def get(self, request, *args, **kwargs): """获取用例集关联用例列表""" <|body_0|> def post(self, request, *args, **kwargs): """添加用例集关联用例""" <|body_1|> def delete(self, request, pk, *args, **kwargs): """删除用例集关联用例""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RelevanceCaseSetList: """接口分类""" def get(self, request, *args, **kwargs): """获取用例集关联用例列表""" title = request.GET.get('title', '') interface_case_name = request.GET.get('interface_case_name', '') obj = RelevanceCaseSet.objects.filter(parent__interface_case_set_name=title) ...
the_stack_v2_python_sparse
easy/api/interFace/interfaceCaseSetMange.py
zhuzhanhao1/Easytest
train
1
ac92d98280c94f3bc8d3d4dc39547210bc6be7bc
[ "tags = result.tags.split()\nif ('blogger' in tags or ('undecided' in tags and 'SHORT_BIO_50' in tags)) and (any([t in tags for t in self.OR_TAGS]) if self.OR_TAGS else True):\n return True\nreturn False", "log.info('Started %s.pipeline(profile_id=%s, route=%s)' % (type(self).__name__, profile_id, route))\ntry...
<|body_start_0|> tags = result.tags.split() if ('blogger' in tags or ('undecided' in tags and 'SHORT_BIO_50' in tags)) and (any([t in tags for t in self.OR_TAGS]) if self.OR_TAGS else True): return True return False <|end_body_0|> <|body_start_1|> log.info('Started %s.pipeli...
This processor is used as a filter to proceed only if 2 conditions are satisfied: * have either 'blogger' or both 'SHORT_LEN_50' and 'undecided' tags AND * there is one or more of OR_TAGS tags
OnlyBloggersProcessor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OnlyBloggersProcessor: """This processor is used as a filter to proceed only if 2 conditions are satisfied: * have either 'blogger' or both 'SHORT_LEN_50' and 'undecided' tags AND * there is one or more of OR_TAGS tags""" def proceed(self, result): """This function determines conditi...
stack_v2_sparse_classes_36k_train_000179
30,721
no_license
[ { "docstring": "This function determines condition when it will proceed to the next Processor, Classifier or Upgrader in chain. gets Profile as result", "name": "proceed", "signature": "def proceed(self, result)" }, { "docstring": "This function is called when performing Processor as a part of p...
2
null
Implement the Python class `OnlyBloggersProcessor` described below. Class description: This processor is used as a filter to proceed only if 2 conditions are satisfied: * have either 'blogger' or both 'SHORT_LEN_50' and 'undecided' tags AND * there is one or more of OR_TAGS tags Method signatures and docstrings: - de...
Implement the Python class `OnlyBloggersProcessor` described below. Class description: This processor is used as a filter to proceed only if 2 conditions are satisfied: * have either 'blogger' or both 'SHORT_LEN_50' and 'undecided' tags AND * there is one or more of OR_TAGS tags Method signatures and docstrings: - de...
2f15c4ddd8bbb112c407d222ae48746b626c674f
<|skeleton|> class OnlyBloggersProcessor: """This processor is used as a filter to proceed only if 2 conditions are satisfied: * have either 'blogger' or both 'SHORT_LEN_50' and 'undecided' tags AND * there is one or more of OR_TAGS tags""" def proceed(self, result): """This function determines conditi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OnlyBloggersProcessor: """This processor is used as a filter to proceed only if 2 conditions are satisfied: * have either 'blogger' or both 'SHORT_LEN_50' and 'undecided' tags AND * there is one or more of OR_TAGS tags""" def proceed(self, result): """This function determines condition when it wi...
the_stack_v2_python_sparse
Projects/miami_metro/social_discovery/processors.py
TopWebGhost/Angular-Influencer
train
1
36ebfbd99598734f82e688a20403ec0c57c577b6
[ "self.generic_visit(node)\nis_multiple = len(node.targets) > 1\nis_compound = any(map(is_sequence_node, node.targets))\nis_simple = not is_compound\nif is_simple and is_multiple:\n return self.visit_simple_assign(node)\nelif is_compound and (is_multiple or is_sequence_node(node.value)):\n return self.visit_co...
<|body_start_0|> self.generic_visit(node) is_multiple = len(node.targets) > 1 is_compound = any(map(is_sequence_node, node.targets)) is_simple = not is_compound if is_simple and is_multiple: return self.visit_simple_assign(node) elif is_compound and (is_multip...
Eliminate statements with multiple targets. Converts any assignment or deletion statement with multiple targets to a sequences of statements which each have a single target. We are careful to preserve Python's evaluation order: https://docs.python.org/3/reference/expressions.html#evaluation-order This normalization is ...
EliminateMultipleTargets
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EliminateMultipleTargets: """Eliminate statements with multiple targets. Converts any assignment or deletion statement with multiple targets to a sequences of statements which each have a single target. We are careful to preserve Python's evaluation order: https://docs.python.org/3/reference/expr...
stack_v2_sparse_classes_36k_train_000180
15,969
permissive
[ { "docstring": "Replace multiple assignment with single assignments.", "name": "visit_Assign", "signature": "def visit_Assign(self, node)" }, { "docstring": "Visit assignment node whose targets are all simple.", "name": "visit_simple_assign", "signature": "def visit_simple_assign(self, n...
4
stack_v2_sparse_classes_30k_train_005779
Implement the Python class `EliminateMultipleTargets` described below. Class description: Eliminate statements with multiple targets. Converts any assignment or deletion statement with multiple targets to a sequences of statements which each have a single target. We are careful to preserve Python's evaluation order: h...
Implement the Python class `EliminateMultipleTargets` described below. Class description: Eliminate statements with multiple targets. Converts any assignment or deletion statement with multiple targets to a sequences of statements which each have a single target. We are careful to preserve Python's evaluation order: h...
a6097d36c8863925c774f04155e2af6cc8cb3859
<|skeleton|> class EliminateMultipleTargets: """Eliminate statements with multiple targets. Converts any assignment or deletion statement with multiple targets to a sequences of statements which each have a single target. We are careful to preserve Python's evaluation order: https://docs.python.org/3/reference/expr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EliminateMultipleTargets: """Eliminate statements with multiple targets. Converts any assignment or deletion statement with multiple targets to a sequences of statements which each have a single target. We are careful to preserve Python's evaluation order: https://docs.python.org/3/reference/expressions.html#...
the_stack_v2_python_sparse
flowgraph/trace/ast_transform.py
epatters/pyflowgraph
train
2
e065a55bed130229f0fa1da93016e9e42e6bc8d3
[ "self.host = host\nself.port = port\nself.secret = secret", "if dictionary is None:\n return None\nhost = dictionary.get('host')\nsecret = dictionary.get('secret')\nport = dictionary.get('port')\nreturn cls(host, secret, port)" ]
<|body_start_0|> self.host = host self.port = port self.secret = secret <|end_body_0|> <|body_start_1|> if dictionary is None: return None host = dictionary.get('host') secret = dictionary.get('secret') port = dictionary.get('port') return cls...
Implementation of the 'RadiusAccountingServer' model. TODO: type model description here. Attributes: host (string): IP address to which the APs will send RADIUS accounting messages port (int): Port on the RADIUS server that is listening for accounting messages secret (string): Shared key used to authenticate messages b...
RadiusAccountingServerModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RadiusAccountingServerModel: """Implementation of the 'RadiusAccountingServer' model. TODO: type model description here. Attributes: host (string): IP address to which the APs will send RADIUS accounting messages port (int): Port on the RADIUS server that is listening for accounting messages secr...
stack_v2_sparse_classes_36k_train_000181
1,986
permissive
[ { "docstring": "Constructor for the RadiusAccountingServerModel class", "name": "__init__", "signature": "def __init__(self, host=None, secret=None, port=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of th...
2
null
Implement the Python class `RadiusAccountingServerModel` described below. Class description: Implementation of the 'RadiusAccountingServer' model. TODO: type model description here. Attributes: host (string): IP address to which the APs will send RADIUS accounting messages port (int): Port on the RADIUS server that is...
Implement the Python class `RadiusAccountingServerModel` described below. Class description: Implementation of the 'RadiusAccountingServer' model. TODO: type model description here. Attributes: host (string): IP address to which the APs will send RADIUS accounting messages port (int): Port on the RADIUS server that is...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class RadiusAccountingServerModel: """Implementation of the 'RadiusAccountingServer' model. TODO: type model description here. Attributes: host (string): IP address to which the APs will send RADIUS accounting messages port (int): Port on the RADIUS server that is listening for accounting messages secr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RadiusAccountingServerModel: """Implementation of the 'RadiusAccountingServer' model. TODO: type model description here. Attributes: host (string): IP address to which the APs will send RADIUS accounting messages port (int): Port on the RADIUS server that is listening for accounting messages secret (string): ...
the_stack_v2_python_sparse
meraki_sdk/models/radius_accounting_server_model.py
RaulCatalano/meraki-python-sdk
train
1
276fd56c742ca1ba7de4d4fd2a785853918cacac
[ "s = DynamicArrayStack()\nself.assertEqual(0, len(s))\nself.assertEqual(0, len(s._array))", "s = DynamicArrayStack()\nself.assertEqual(0, len(s))\ns.push(1)\nself.assertEqual(1, len(s))\nself.assertEqual(1, len(s._array))\nself.assertEqual(1, s._array[0])\ns.push(StackEmptyException)\nself.assertEqual(2, len(s))\...
<|body_start_0|> s = DynamicArrayStack() self.assertEqual(0, len(s)) self.assertEqual(0, len(s._array)) <|end_body_0|> <|body_start_1|> s = DynamicArrayStack() self.assertEqual(0, len(s)) s.push(1) self.assertEqual(1, len(s)) self.assertEqual(1, len(s._ar...
TestDynamicArrayStack
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDynamicArrayStack: def test_instantiation(self): """Test basic object creation.""" <|body_0|> def test_push(self): """Test stack push operation.""" <|body_1|> def test_pop(self): """Test stack pop operation.""" <|body_2|> def tes...
stack_v2_sparse_classes_36k_train_000182
6,008
no_license
[ { "docstring": "Test basic object creation.", "name": "test_instantiation", "signature": "def test_instantiation(self)" }, { "docstring": "Test stack push operation.", "name": "test_push", "signature": "def test_push(self)" }, { "docstring": "Test stack pop operation.", "name...
4
stack_v2_sparse_classes_30k_train_015565
Implement the Python class `TestDynamicArrayStack` described below. Class description: Implement the TestDynamicArrayStack class. Method signatures and docstrings: - def test_instantiation(self): Test basic object creation. - def test_push(self): Test stack push operation. - def test_pop(self): Test stack pop operati...
Implement the Python class `TestDynamicArrayStack` described below. Class description: Implement the TestDynamicArrayStack class. Method signatures and docstrings: - def test_instantiation(self): Test basic object creation. - def test_push(self): Test stack push operation. - def test_pop(self): Test stack pop operati...
66e553842998e22ee8ec4f9ebe901f76089128de
<|skeleton|> class TestDynamicArrayStack: def test_instantiation(self): """Test basic object creation.""" <|body_0|> def test_push(self): """Test stack push operation.""" <|body_1|> def test_pop(self): """Test stack pop operation.""" <|body_2|> def tes...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDynamicArrayStack: def test_instantiation(self): """Test basic object creation.""" s = DynamicArrayStack() self.assertEqual(0, len(s)) self.assertEqual(0, len(s._array)) def test_push(self): """Test stack push operation.""" s = DynamicArrayStack() ...
the_stack_v2_python_sparse
python/dsa/stacks_test.py
nehararora/practise-code
train
0
4615cf2c86a7030a971ff4d1032e513b92d588c1
[ "super(SCPCheckOKResponse, self).__init__()\nself._operation = operation\nself._command = command", "result = self.scp_response_header.result\nif result != SCPResult.RC_OK:\n raise SpinnmanUnexpectedResponseCodeException(self._operation, self._command, result.name)" ]
<|body_start_0|> super(SCPCheckOKResponse, self).__init__() self._operation = operation self._command = command <|end_body_0|> <|body_start_1|> result = self.scp_response_header.result if result != SCPResult.RC_OK: raise SpinnmanUnexpectedResponseCodeException(self._...
An SCP response to a request which returns nothing other than OK
SCPCheckOKResponse
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SCPCheckOKResponse: """An SCP response to a request which returns nothing other than OK""" def __init__(self, operation, command): """:param operation: The operation being performed :type operation: str :param command: The command that was sent :type command: str""" <|body_0|...
stack_v2_sparse_classes_36k_train_000183
1,103
permissive
[ { "docstring": ":param operation: The operation being performed :type operation: str :param command: The command that was sent :type command: str", "name": "__init__", "signature": "def __init__(self, operation, command)" }, { "docstring": "See :py:meth:`spinnman.messages.scp.abstract_scp_respon...
2
stack_v2_sparse_classes_30k_train_019913
Implement the Python class `SCPCheckOKResponse` described below. Class description: An SCP response to a request which returns nothing other than OK Method signatures and docstrings: - def __init__(self, operation, command): :param operation: The operation being performed :type operation: str :param command: The comm...
Implement the Python class `SCPCheckOKResponse` described below. Class description: An SCP response to a request which returns nothing other than OK Method signatures and docstrings: - def __init__(self, operation, command): :param operation: The operation being performed :type operation: str :param command: The comm...
04fa1eaf78778edea3ba3afa4c527d20c491718e
<|skeleton|> class SCPCheckOKResponse: """An SCP response to a request which returns nothing other than OK""" def __init__(self, operation, command): """:param operation: The operation being performed :type operation: str :param command: The command that was sent :type command: str""" <|body_0|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SCPCheckOKResponse: """An SCP response to a request which returns nothing other than OK""" def __init__(self, operation, command): """:param operation: The operation being performed :type operation: str :param command: The command that was sent :type command: str""" super(SCPCheckOKRespon...
the_stack_v2_python_sparse
src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/spinnman/messages/scp/impl/scp_check_ok_response.py
Roboy/LSM_SpiNNaker_MyoArm
train
2
487367437e6ac8a14e1c6ee02d26d21d87de8fb1
[ "if author.lower() == 'beals':\n freqs = {'A': 0.074, 'R': 0.042, 'C': 0.033, 'G': 0.074, 'H': 0.029, 'N': 0.044, 'D': 0.059, 'E': 0.058, 'Q': 0.037, 'I': 0.038, 'L': 0.076, 'K': 0.072, 'M': 0.018, 'F': 0.04, 'P': 0.05, 'S': 0.081, 'T': 0.062, 'W': 0.013, 'Y': 0.033, 'V': 0.068}\nelif author.lower() == 'dayhoff'...
<|body_start_0|> if author.lower() == 'beals': freqs = {'A': 0.074, 'R': 0.042, 'C': 0.033, 'G': 0.074, 'H': 0.029, 'N': 0.044, 'D': 0.059, 'E': 0.058, 'Q': 0.037, 'I': 0.038, 'L': 0.076, 'K': 0.072, 'M': 0.018, 'F': 0.04, 'P': 0.05, 'S': 0.081, 'T': 0.062, 'W': 0.013, 'Y': 0.033, 'V': 0.068} ...
AminoAcidStats
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AminoAcidStats: def composition(cls, author='beals'): """Amino acid frequencies observed in the sequence data-bases. The index corresponds to different publications: M. Beals, L. Gross, S. Harrell www.tiem.utk.edu/~harrell/webmodules/aminoacid.htm Dayhoff (1978) Jones, D.T. Taylor, W.R. ...
stack_v2_sparse_classes_36k_train_000184
9,435
permissive
[ { "docstring": "Amino acid frequencies observed in the sequence data-bases. The index corresponds to different publications: M. Beals, L. Gross, S. Harrell www.tiem.utk.edu/~harrell/webmodules/aminoacid.htm Dayhoff (1978) Jones, D.T. Taylor, W.R. & Thornton, J.M.(1991) CABIOS 8:275-282", "name": "compositio...
2
null
Implement the Python class `AminoAcidStats` described below. Class description: Implement the AminoAcidStats class. Method signatures and docstrings: - def composition(cls, author='beals'): Amino acid frequencies observed in the sequence data-bases. The index corresponds to different publications: M. Beals, L. Gross,...
Implement the Python class `AminoAcidStats` described below. Class description: Implement the AminoAcidStats class. Method signatures and docstrings: - def composition(cls, author='beals'): Amino acid frequencies observed in the sequence data-bases. The index corresponds to different publications: M. Beals, L. Gross,...
a27152ef5437eb87ee31c317091356c4787f82a4
<|skeleton|> class AminoAcidStats: def composition(cls, author='beals'): """Amino acid frequencies observed in the sequence data-bases. The index corresponds to different publications: M. Beals, L. Gross, S. Harrell www.tiem.utk.edu/~harrell/webmodules/aminoacid.htm Dayhoff (1978) Jones, D.T. Taylor, W.R. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AminoAcidStats: def composition(cls, author='beals'): """Amino acid frequencies observed in the sequence data-bases. The index corresponds to different publications: M. Beals, L. Gross, S. Harrell www.tiem.utk.edu/~harrell/webmodules/aminoacid.htm Dayhoff (1978) Jones, D.T. Taylor, W.R. & Thornton, J....
the_stack_v2_python_sparse
mainPackage/clustalo.py
dtklinh/Protein-Rigid-Domains-Estimation
train
0
4daa02e84d42b8e83e5775b4360c825f68aa1b12
[ "res = [[]]\nfor i in nums:\n temp = []\n for j in res:\n temp.append(j + [i])\n res += temp\nreturn res", "nums.sort()\nres = []\nn = len(nums)\n\ndef dfs(cur, path):\n res.append(path)\n for i in range(cur, n):\n if i > cur and nums[i] == nums[i - 1]:\n continue\n ...
<|body_start_0|> res = [[]] for i in nums: temp = [] for j in res: temp.append(j + [i]) res += temp return res <|end_body_0|> <|body_start_1|> nums.sort() res = [] n = len(nums) def dfs(cur, path): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subsetsWithDup78(self, nums: List[int]) -> List[List[int]]: """78. 子集 数组元素互不相同""" <|body_0|> def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: """90. 子集 II 存在重复元素 看成 n叉树,去重只去同一层的相同元素,同一树分支的元素不去重。 对于数组[2,2,3]比如第一层取2;3,2的下一层取2,3;3没有下一层""" ...
stack_v2_sparse_classes_36k_train_000185
1,688
no_license
[ { "docstring": "78. 子集 数组元素互不相同", "name": "subsetsWithDup78", "signature": "def subsetsWithDup78(self, nums: List[int]) -> List[List[int]]" }, { "docstring": "90. 子集 II 存在重复元素 看成 n叉树,去重只去同一层的相同元素,同一树分支的元素不去重。 对于数组[2,2,3]比如第一层取2;3,2的下一层取2,3;3没有下一层", "name": "subsetsWithDup", "signature": ...
2
stack_v2_sparse_classes_30k_train_012830
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsetsWithDup78(self, nums: List[int]) -> List[List[int]]: 78. 子集 数组元素互不相同 - def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: 90. 子集 II 存在重复元素 看成 n叉树,去重只去同一层的相同...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsetsWithDup78(self, nums: List[int]) -> List[List[int]]: 78. 子集 数组元素互不相同 - def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: 90. 子集 II 存在重复元素 看成 n叉树,去重只去同一层的相同...
3fd69b85f52af861ff7e2c74d8aacc515b192615
<|skeleton|> class Solution: def subsetsWithDup78(self, nums: List[int]) -> List[List[int]]: """78. 子集 数组元素互不相同""" <|body_0|> def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: """90. 子集 II 存在重复元素 看成 n叉树,去重只去同一层的相同元素,同一树分支的元素不去重。 对于数组[2,2,3]比如第一层取2;3,2的下一层取2,3;3没有下一层""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def subsetsWithDup78(self, nums: List[int]) -> List[List[int]]: """78. 子集 数组元素互不相同""" res = [[]] for i in nums: temp = [] for j in res: temp.append(j + [i]) res += temp return res def subsetsWithDup(self, nums: ...
the_stack_v2_python_sparse
Array/Array_Subset_78_90.py
helloprogram6/leetcode_Cookbook_python
train
0
e9ccdde08dba6093cb43b287248cb76bbc806744
[ "self.head = head\nself.count = 0\nrepre = self.head\nwhile repre.next:\n repre = repre.next\n self.count += 1", "selected = random.randint(0, self.count)\nrepre = self.head\nwhile selected > 0:\n repre = repre.next\n selected -= 1\nreturn repre.val" ]
<|body_start_0|> self.head = head self.count = 0 repre = self.head while repre.next: repre = repre.next self.count += 1 <|end_body_0|> <|body_start_1|> selected = random.randint(0, self.count) repre = self.head while selected > 0: ...
RandomLinkedList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomLinkedList: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" <|body_0|> def getRandom(self): """Returns a random node's value. :rtype: int...
stack_v2_sparse_classes_36k_train_000186
4,813
no_license
[ { "docstring": "@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode", "name": "__init__", "signature": "def __init__(self, head)" }, { "docstring": "Returns a random node's value. :rtype: int", "name": "g...
2
null
Implement the Python class `RandomLinkedList` described below. Class description: Implement the RandomLinkedList class. Method signatures and docstrings: - def __init__(self, head): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListN...
Implement the Python class `RandomLinkedList` described below. Class description: Implement the RandomLinkedList class. Method signatures and docstrings: - def __init__(self, head): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListN...
2711bc08f15266bec4ca135e8e3e629df46713eb
<|skeleton|> class RandomLinkedList: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" <|body_0|> def getRandom(self): """Returns a random node's value. :rtype: int...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomLinkedList: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" self.head = head self.count = 0 repre = self.head while repre.next: ...
the_stack_v2_python_sparse
0.算法/20180814.py
unlimitediw/CheckCode
train
0
0ad294331f0ec042368d38f798268ff134f91dc7
[ "try:\n return cfg.evelocations.Get(locationID).locationName\nexcept KeyError:\n log.LogException()\n return '[no location: %d]' % locationID", "try:\n return cfg.evelocations.Get(locationID).GetRawName(languageID)\nexcept KeyError:\n log.LogException()\n return '[no location: %d]' % locationID"...
<|body_start_0|> try: return cfg.evelocations.Get(locationID).locationName except KeyError: log.LogException() return '[no location: %d]' % locationID <|end_body_0|> <|body_start_1|> try: return cfg.evelocations.Get(locationID).GetRawName(language...
The location property handler class that defines the methods to retrieve location-specific property data.
LocationPropertyHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocationPropertyHandler: """The location property handler class that defines the methods to retrieve location-specific property data.""" def _GetName(self, locationID, languageID, *args, **kwargs): """Retrieve name of the location""" <|body_0|> def _GetRawName(self, loca...
stack_v2_sparse_classes_36k_train_000187
3,191
no_license
[ { "docstring": "Retrieve name of the location", "name": "_GetName", "signature": "def _GetName(self, locationID, languageID, *args, **kwargs)" }, { "docstring": "Returns the localized name without respect to bilingual functionlity settings. Note that this does NOT work for celestials or stations...
3
null
Implement the Python class `LocationPropertyHandler` described below. Class description: The location property handler class that defines the methods to retrieve location-specific property data. Method signatures and docstrings: - def _GetName(self, locationID, languageID, *args, **kwargs): Retrieve name of the locat...
Implement the Python class `LocationPropertyHandler` described below. Class description: The location property handler class that defines the methods to retrieve location-specific property data. Method signatures and docstrings: - def _GetName(self, locationID, languageID, *args, **kwargs): Retrieve name of the locat...
50de3488a2140343c364efc2615cf6e67f152be0
<|skeleton|> class LocationPropertyHandler: """The location property handler class that defines the methods to retrieve location-specific property data.""" def _GetName(self, locationID, languageID, *args, **kwargs): """Retrieve name of the location""" <|body_0|> def _GetRawName(self, loca...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LocationPropertyHandler: """The location property handler class that defines the methods to retrieve location-specific property data.""" def _GetName(self, locationID, languageID, *args, **kwargs): """Retrieve name of the location""" try: return cfg.evelocations.Get(locationID...
the_stack_v2_python_sparse
localization/propertyHandlers/locationPropertyHandler.py
nanxijw/Clara-Pretty-One-Dick
train
0
5f5b10ad4cb85707afd21c08795d542ccc0ec1a9
[ "dtypes = data.dtypes\ndtypes = dtypes.reset_index()\ndtypes.columns = ['feature_name', 'types']\nobj_list = list(dtypes.loc[dtypes['types'] == 'object', 'feature_name'])\nobj_data = data.loc[:, obj_list]\nreturn obj_data", "from sklearn.preprocessing import LabelEncoder\ndata = data.loc[:, var_list]\ncols = data...
<|body_start_0|> dtypes = data.dtypes dtypes = dtypes.reset_index() dtypes.columns = ['feature_name', 'types'] obj_list = list(dtypes.loc[dtypes['types'] == 'object', 'feature_name']) obj_data = data.loc[:, obj_list] return obj_data <|end_body_0|> <|body_start_1|> ...
Label_Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Label_Encoder: def slice_obj_data(self, data): """提取数据类型为object的数据,可能需要填充缺失值,可能是类别型特征需要进行label或one-hot Args: data: Returns: 数据类型为object的数据子集""" <|body_0|> def label_encoder_fit(self, data, var_list): """提认为模拟label_encoder的fit过程,得到fit的字典,要求data为类别型的数据 Args: data:原数据框 ...
stack_v2_sparse_classes_36k_train_000188
4,010
no_license
[ { "docstring": "提取数据类型为object的数据,可能需要填充缺失值,可能是类别型特征需要进行label或one-hot Args: data: Returns: 数据类型为object的数据子集", "name": "slice_obj_data", "signature": "def slice_obj_data(self, data)" }, { "docstring": "提认为模拟label_encoder的fit过程,得到fit的字典,要求data为类别型的数据 Args: data:原数据框 var_list:数据类型为类别型的字段名列表 Returns:...
3
stack_v2_sparse_classes_30k_train_018776
Implement the Python class `Label_Encoder` described below. Class description: Implement the Label_Encoder class. Method signatures and docstrings: - def slice_obj_data(self, data): 提取数据类型为object的数据,可能需要填充缺失值,可能是类别型特征需要进行label或one-hot Args: data: Returns: 数据类型为object的数据子集 - def label_encoder_fit(self, data, var_list)...
Implement the Python class `Label_Encoder` described below. Class description: Implement the Label_Encoder class. Method signatures and docstrings: - def slice_obj_data(self, data): 提取数据类型为object的数据,可能需要填充缺失值,可能是类别型特征需要进行label或one-hot Args: data: Returns: 数据类型为object的数据子集 - def label_encoder_fit(self, data, var_list)...
cc25cb60f1c1c89b4591bbdaec8db1eeba818377
<|skeleton|> class Label_Encoder: def slice_obj_data(self, data): """提取数据类型为object的数据,可能需要填充缺失值,可能是类别型特征需要进行label或one-hot Args: data: Returns: 数据类型为object的数据子集""" <|body_0|> def label_encoder_fit(self, data, var_list): """提认为模拟label_encoder的fit过程,得到fit的字典,要求data为类别型的数据 Args: data:原数据框 ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Label_Encoder: def slice_obj_data(self, data): """提取数据类型为object的数据,可能需要填充缺失值,可能是类别型特征需要进行label或one-hot Args: data: Returns: 数据类型为object的数据子集""" dtypes = data.dtypes dtypes = dtypes.reset_index() dtypes.columns = ['feature_name', 'types'] obj_list = list(dtypes.loc[dtype...
the_stack_v2_python_sparse
bus_drop/loans_drop/feature_engineering/label_encoder.py
xeon-ye/dgg-pro
train
0
35cd4b3cf420be17e04d516e265e77d9d72c28e5
[ "self.switch_profiles = switch_profiles\nself.switches = switches\nself.stacks = stacks\nself.igmp_snooping_enabled = igmp_snooping_enabled\nself.flood_unknown_multicast_traffic_enabled = flood_unknown_multicast_traffic_enabled", "if dictionary is None:\n return None\nigmp_snooping_enabled = dictionary.get('ig...
<|body_start_0|> self.switch_profiles = switch_profiles self.switches = switches self.stacks = stacks self.igmp_snooping_enabled = igmp_snooping_enabled self.flood_unknown_multicast_traffic_enabled = flood_unknown_multicast_traffic_enabled <|end_body_0|> <|body_start_1|> ...
Implementation of the 'Override1' model. TODO: type model description here. Attributes: switch_profiles (list of string): List of switch profiles ids for template network switches (list of string): List of switch serials for non-template network stacks (list of string): List of switch stack ids for non-template network...
Override1Model
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Override1Model: """Implementation of the 'Override1' model. TODO: type model description here. Attributes: switch_profiles (list of string): List of switch profiles ids for template network switches (list of string): List of switch serials for non-template network stacks (list of string): List of...
stack_v2_sparse_classes_36k_train_000189
3,029
permissive
[ { "docstring": "Constructor for the Override1Model class", "name": "__init__", "signature": "def __init__(self, igmp_snooping_enabled=None, flood_unknown_multicast_traffic_enabled=None, switch_profiles=None, switches=None, stacks=None)" }, { "docstring": "Creates an instance of this model from a...
2
null
Implement the Python class `Override1Model` described below. Class description: Implementation of the 'Override1' model. TODO: type model description here. Attributes: switch_profiles (list of string): List of switch profiles ids for template network switches (list of string): List of switch serials for non-template n...
Implement the Python class `Override1Model` described below. Class description: Implementation of the 'Override1' model. TODO: type model description here. Attributes: switch_profiles (list of string): List of switch profiles ids for template network switches (list of string): List of switch serials for non-template n...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class Override1Model: """Implementation of the 'Override1' model. TODO: type model description here. Attributes: switch_profiles (list of string): List of switch profiles ids for template network switches (list of string): List of switch serials for non-template network stacks (list of string): List of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Override1Model: """Implementation of the 'Override1' model. TODO: type model description here. Attributes: switch_profiles (list of string): List of switch profiles ids for template network switches (list of string): List of switch serials for non-template network stacks (list of string): List of switch stack...
the_stack_v2_python_sparse
meraki_sdk/models/override_1_model.py
RaulCatalano/meraki-python-sdk
train
1
093d8a9bba46d5917950997bdca51a8bfa1432b5
[ "account = v['user.account']\npassword = v['user.password']\napp = Demo()\nres = app.login(account, password).json()\nassert res['code'] == 10000\nassert res['msg'] == 'login success'", "email = v['user.account']\npassword = '123456'\napp = Demo()\nres = app.login(email, password).json()\nassert res['code'] == 20...
<|body_start_0|> account = v['user.account'] password = v['user.password'] app = Demo() res = app.login(account, password).json() assert res['code'] == 10000 assert res['msg'] == 'login success' <|end_body_0|> <|body_start_1|> email = v['user.account'] pa...
TestLogin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestLogin: def test_login_success(self): """测试登录成功场景""" <|body_0|> def test_login_with_error_password(self): """测试使用错误的密码登录""" <|body_1|> <|end_skeleton|> <|body_start_0|> account = v['user.account'] password = v['user.password'] app...
stack_v2_sparse_classes_36k_train_000190
722
permissive
[ { "docstring": "测试登录成功场景", "name": "test_login_success", "signature": "def test_login_success(self)" }, { "docstring": "测试使用错误的密码登录", "name": "test_login_with_error_password", "signature": "def test_login_with_error_password(self)" } ]
2
stack_v2_sparse_classes_30k_train_000926
Implement the Python class `TestLogin` described below. Class description: Implement the TestLogin class. Method signatures and docstrings: - def test_login_success(self): 测试登录成功场景 - def test_login_with_error_password(self): 测试使用错误的密码登录
Implement the Python class `TestLogin` described below. Class description: Implement the TestLogin class. Method signatures and docstrings: - def test_login_success(self): 测试登录成功场景 - def test_login_with_error_password(self): 测试使用错误的密码登录 <|skeleton|> class TestLogin: def test_login_success(self): """测试登录...
36be435d4aab7a730a267a985fc4ea6493cab232
<|skeleton|> class TestLogin: def test_login_success(self): """测试登录成功场景""" <|body_0|> def test_login_with_error_password(self): """测试使用错误的密码登录""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestLogin: def test_login_success(self): """测试登录成功场景""" account = v['user.account'] password = v['user.password'] app = Demo() res = app.login(account, password).json() assert res['code'] == 10000 assert res['msg'] == 'login success' def test_login_...
the_stack_v2_python_sparse
src/walnuts/templates/test_suites/test_login.py
hzs618/walnuts
train
0
d5f3f5672bbc26e921e40e75080ad7584c1d2bba
[ "super(GlobalBodyHeadDiscriminator, self).__init__()\ncond_nc = cfg.cond_nc\nbg_cond_nc = cfg.bg_cond_nc\nndf = cfg.ndf\nn_layers = cfg.n_layers\nmax_nf_mult = cfg.max_nf_mult\nnorm_type = cfg.norm_type\nuse_sigmoid = cfg.use_sigmoid\nself.global_model = PatchDiscriminator(cond_nc, ndf=ndf, n_layers=n_layers, max_n...
<|body_start_0|> super(GlobalBodyHeadDiscriminator, self).__init__() cond_nc = cfg.cond_nc bg_cond_nc = cfg.bg_cond_nc ndf = cfg.ndf n_layers = cfg.n_layers max_nf_mult = cfg.max_nf_mult norm_type = cfg.norm_type use_sigmoid = cfg.use_sigmoid self....
GlobalBodyHeadDiscriminator
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license", "Apache-2.0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GlobalBodyHeadDiscriminator: def __init__(self, cfg, use_aug_bg=False): """Args: cfg (dict or EasyDict): the configurations, and it contains the followings, --cond_nc (int): the input dimension; --ndf (int): the number of filters at the first layer, default is 64; --n_layers (int): the n...
stack_v2_sparse_classes_36k_train_000191
11,501
permissive
[ { "docstring": "Args: cfg (dict or EasyDict): the configurations, and it contains the followings, --cond_nc (int): the input dimension; --ndf (int): the number of filters at the first layer, default is 64; --n_layers (int): the number of downsampling operations, such as the convolution with stride 2, default is...
2
stack_v2_sparse_classes_30k_train_008115
Implement the Python class `GlobalBodyHeadDiscriminator` described below. Class description: Implement the GlobalBodyHeadDiscriminator class. Method signatures and docstrings: - def __init__(self, cfg, use_aug_bg=False): Args: cfg (dict or EasyDict): the configurations, and it contains the followings, --cond_nc (int)...
Implement the Python class `GlobalBodyHeadDiscriminator` described below. Class description: Implement the GlobalBodyHeadDiscriminator class. Method signatures and docstrings: - def __init__(self, cfg, use_aug_bg=False): Args: cfg (dict or EasyDict): the configurations, and it contains the followings, --cond_nc (int)...
fcf9a18ffd66bf3fdd3eea4153a3bc4785131848
<|skeleton|> class GlobalBodyHeadDiscriminator: def __init__(self, cfg, use_aug_bg=False): """Args: cfg (dict or EasyDict): the configurations, and it contains the followings, --cond_nc (int): the input dimension; --ndf (int): the number of filters at the first layer, default is 64; --n_layers (int): the n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GlobalBodyHeadDiscriminator: def __init__(self, cfg, use_aug_bg=False): """Args: cfg (dict or EasyDict): the configurations, and it contains the followings, --cond_nc (int): the input dimension; --ndf (int): the number of filters at the first layer, default is 64; --n_layers (int): the number of downs...
the_stack_v2_python_sparse
iPERCore/models/networks/discriminators/multi_scale_dis.py
iPERDance/iPERCore
train
2,520
48853dbce7fb7d3b3746786f2fa925a6ea952785
[ "q_points = np.array(data[:, :2])\nim_points = np.array(data[:, 2:])\nH, mask = cv2.findHomography(srcPoints=q_points, dstPoints=im_points, method=0)\nreturn H", "list_ones = np.ones((data.shape[0], 1))\nsrc_p = np.append(data[:, :2], list_ones, axis=1)\ndst_p = np.append(data[:, 2:], list_ones, axis=1)\nsrc_p_tr...
<|body_start_0|> q_points = np.array(data[:, :2]) im_points = np.array(data[:, 2:]) H, mask = cv2.findHomography(srcPoints=q_points, dstPoints=im_points, method=0) return H <|end_body_0|> <|body_start_1|> list_ones = np.ones((data.shape[0], 1)) src_p = np.append(data[:, ...
Class for Homography estimation. It implements the interface needed by the ransac() function.
HomographyModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HomographyModel: """Class for Homography estimation. It implements the interface needed by the ransac() function.""" def fit(data): """Find and return perspective transformation H between the source (src) and the destination (dst) planes. The transformation minimizes the error of thi...
stack_v2_sparse_classes_36k_train_000192
16,214
no_license
[ { "docstring": "Find and return perspective transformation H between the source (src) and the destination (dst) planes. The transformation minimizes the error of this constraint H * src_points = dst_points for all given points, using homogeneous coordinates i.e., it fits the homography to ALL given input data. ...
2
null
Implement the Python class `HomographyModel` described below. Class description: Class for Homography estimation. It implements the interface needed by the ransac() function. Method signatures and docstrings: - def fit(data): Find and return perspective transformation H between the source (src) and the destination (d...
Implement the Python class `HomographyModel` described below. Class description: Class for Homography estimation. It implements the interface needed by the ransac() function. Method signatures and docstrings: - def fit(data): Find and return perspective transformation H between the source (src) and the destination (d...
2f9c33c4e1a26b3e9e699210ac974047936f49e1
<|skeleton|> class HomographyModel: """Class for Homography estimation. It implements the interface needed by the ransac() function.""" def fit(data): """Find and return perspective transformation H between the source (src) and the destination (dst) planes. The transformation minimizes the error of thi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HomographyModel: """Class for Homography estimation. It implements the interface needed by the ransac() function.""" def fit(data): """Find and return perspective transformation H between the source (src) and the destination (dst) planes. The transformation minimizes the error of this constraint ...
the_stack_v2_python_sparse
model/robust_matching.py
winkash/image-classification
train
0
2ea96482745dcc4cfd6c3417777055c6044370f7
[ "self.host = host\nself.port = port\nself.verbose = verbose\nself.meth = meth\nself.opts = opts\nself.flags = flags\nself.connect()", "context = zmq.Context()\npusher = context.socket(zmq.PUSH)\nfor opt in self.opts:\n pusher.setsockopt(opt, 1)\nprint('{0}://{1}:{2}'.format(self.meth, self.host, self.port))\np...
<|body_start_0|> self.host = host self.port = port self.verbose = verbose self.meth = meth self.opts = opts self.flags = flags self.connect() <|end_body_0|> <|body_start_1|> context = zmq.Context() pusher = context.socket(zmq.PUSH) for opt...
ZMQPush
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZMQPush: def __init__(self, host, port, opts=[], flags=0, meth='tcp', verbose=False): """create a Default ZMQ Pull socket""" <|body_0|> def connect(self): """open ZMQ pull socket return receiver object""" <|body_1|> def send(self, msg): """receiv...
stack_v2_sparse_classes_36k_train_000193
12,974
no_license
[ { "docstring": "create a Default ZMQ Pull socket", "name": "__init__", "signature": "def __init__(self, host, port, opts=[], flags=0, meth='tcp', verbose=False)" }, { "docstring": "open ZMQ pull socket return receiver object", "name": "connect", "signature": "def connect(self)" }, { ...
3
null
Implement the Python class `ZMQPush` described below. Class description: Implement the ZMQPush class. Method signatures and docstrings: - def __init__(self, host, port, opts=[], flags=0, meth='tcp', verbose=False): create a Default ZMQ Pull socket - def connect(self): open ZMQ pull socket return receiver object - def...
Implement the Python class `ZMQPush` described below. Class description: Implement the ZMQPush class. Method signatures and docstrings: - def __init__(self, host, port, opts=[], flags=0, meth='tcp', verbose=False): create a Default ZMQ Pull socket - def connect(self): open ZMQ pull socket return receiver object - def...
55041e6947b888242ff01cb18bd5f1ee4c4c8f28
<|skeleton|> class ZMQPush: def __init__(self, host, port, opts=[], flags=0, meth='tcp', verbose=False): """create a Default ZMQ Pull socket""" <|body_0|> def connect(self): """open ZMQ pull socket return receiver object""" <|body_1|> def send(self, msg): """receiv...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZMQPush: def __init__(self, host, port, opts=[], flags=0, meth='tcp', verbose=False): """create a Default ZMQ Pull socket""" self.host = host self.port = port self.verbose = verbose self.meth = meth self.opts = opts self.flags = flags self.connec...
the_stack_v2_python_sparse
NPC/gui/ZmqSockets.py
coquellen/NanoPeakCell
train
6
3085c74c4ec045d8afd05324f7931e3155871a40
[ "parser.add_argument('-show', dest='show', type=bool, default=True, help='show all the entries in category')\nparser.add_argument('-add', '--a', dest='add', type=str, help=\"Add a new category if it's possible\")\nparser.add_argument('-delete', '--d', dest='del', type=str, help=\"Delete a category if it's possible\...
<|body_start_0|> parser.add_argument('-show', dest='show', type=bool, default=True, help='show all the entries in category') parser.add_argument('-add', '--a', dest='add', type=str, help="Add a new category if it's possible") parser.add_argument('-delete', '--d', dest='del', type=str, help="Dele...
this class manages the parameters you can pass to python manage.py
Command
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Command: """this class manages the parameters you can pass to python manage.py""" def add_arguments(self, parser): """manages the args to pass to category""" <|body_0|> def _show(self): """shows the cat from the list""" <|body_1|> def _add(self, new_...
stack_v2_sparse_classes_36k_train_000194
3,635
no_license
[ { "docstring": "manages the args to pass to category", "name": "add_arguments", "signature": "def add_arguments(self, parser)" }, { "docstring": "shows the cat from the list", "name": "_show", "signature": "def _show(self)" }, { "docstring": "add a category to the list if it exis...
5
stack_v2_sparse_classes_30k_train_005458
Implement the Python class `Command` described below. Class description: this class manages the parameters you can pass to python manage.py Method signatures and docstrings: - def add_arguments(self, parser): manages the args to pass to category - def _show(self): shows the cat from the list - def _add(self, new_cat)...
Implement the Python class `Command` described below. Class description: this class manages the parameters you can pass to python manage.py Method signatures and docstrings: - def add_arguments(self, parser): manages the args to pass to category - def _show(self): shows the cat from the list - def _add(self, new_cat)...
378244474186a2fe25f91377f3628a1479329f99
<|skeleton|> class Command: """this class manages the parameters you can pass to python manage.py""" def add_arguments(self, parser): """manages the args to pass to category""" <|body_0|> def _show(self): """shows the cat from the list""" <|body_1|> def _add(self, new_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Command: """this class manages the parameters you can pass to python manage.py""" def add_arguments(self, parser): """manages the args to pass to category""" parser.add_argument('-show', dest='show', type=bool, default=True, help='show all the entries in category') parser.add_argu...
the_stack_v2_python_sparse
products/management/commands/category.py
blingstand/projet8
train
0
c6155b355152d4d1086fb83a5604c3b17cf973b4
[ "pressure = self.getPressure(target)\nif self.parent.currPowerPoints > 0:\n self.parent.currPowerPoints -= pressure\nreturn []", "if isinstance(self.parent.hitDelegate, HitSelfDelegate):\n return 1\nelse:\n return target.getAbility().powerPointsPressure()" ]
<|body_start_0|> pressure = self.getPressure(target) if self.parent.currPowerPoints > 0: self.parent.currPowerPoints -= pressure return [] <|end_body_0|> <|body_start_1|> if isinstance(self.parent.hitDelegate, HitSelfDelegate): return 1 else: ...
Represents the Remove PP Step in the Attack Process
RemovePPStep
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RemovePPStep: """Represents the Remove PP Step in the Attack Process""" def perform(self, user, target, environment): """Perform this step""" <|body_0|> def getPressure(self, target): """Return the Pressure exerted when using the attack""" <|body_1|> <|e...
stack_v2_sparse_classes_36k_train_000195
769
no_license
[ { "docstring": "Perform this step", "name": "perform", "signature": "def perform(self, user, target, environment)" }, { "docstring": "Return the Pressure exerted when using the attack", "name": "getPressure", "signature": "def getPressure(self, target)" } ]
2
stack_v2_sparse_classes_30k_train_000123
Implement the Python class `RemovePPStep` described below. Class description: Represents the Remove PP Step in the Attack Process Method signatures and docstrings: - def perform(self, user, target, environment): Perform this step - def getPressure(self, target): Return the Pressure exerted when using the attack
Implement the Python class `RemovePPStep` described below. Class description: Represents the Remove PP Step in the Attack Process Method signatures and docstrings: - def perform(self, user, target, environment): Perform this step - def getPressure(self, target): Return the Pressure exerted when using the attack <|sk...
3931eee5fd04e18bb1738a0b27a4c6979dc4db01
<|skeleton|> class RemovePPStep: """Represents the Remove PP Step in the Attack Process""" def perform(self, user, target, environment): """Perform this step""" <|body_0|> def getPressure(self, target): """Return the Pressure exerted when using the attack""" <|body_1|> <|e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RemovePPStep: """Represents the Remove PP Step in the Attack Process""" def perform(self, user, target, environment): """Perform this step""" pressure = self.getPressure(target) if self.parent.currPowerPoints > 0: self.parent.currPowerPoints -= pressure return ...
the_stack_v2_python_sparse
src/Battle/Attack/Steps/remove_pp_step.py
sgtnourry/Pokemon-Project
train
0
de8058ed1ee31e9988382a212a6fb1e2a35e6d0e
[ "if directory is None:\n directory = compat.get_saver_or_default().directory\n if not directory.endswith('/'):\n directory += '/'\n directory += 'best'\nsuper(KeepBestCheckpointSaver, self).__init__(checkpoint=tf.train.Checkpoint(**dict([(x.name.split(':')[0], x) for x in model.weights])), directory...
<|body_start_0|> if directory is None: directory = compat.get_saver_or_default().directory if not directory.endswith('/'): directory += '/' directory += 'best' super(KeepBestCheckpointSaver, self).__init__(checkpoint=tf.train.Checkpoint(**dict([(x.name...
Custom Checkpoint manager for saving and restoring variables.
KeepBestCheckpointSaver
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeepBestCheckpointSaver: """Custom Checkpoint manager for saving and restoring variables.""" def __init__(self, model, directory, metric, max_to_keep=8, checkpoint_name='ckpt'): """Initializes a custom checkpoint manager. Args: model: A keras model. directory: The path to a directory...
stack_v2_sparse_classes_36k_train_000196
17,097
permissive
[ { "docstring": "Initializes a custom checkpoint manager. Args: model: A keras model. directory: The path to a directory in which to write checkpoints. metric: A metric object. max_to_keep: The maximum checkpoint numbers to keep. checkpoint_name: The name of each checkpoint.", "name": "__init__", "signat...
2
null
Implement the Python class `KeepBestCheckpointSaver` described below. Class description: Custom Checkpoint manager for saving and restoring variables. Method signatures and docstrings: - def __init__(self, model, directory, metric, max_to_keep=8, checkpoint_name='ckpt'): Initializes a custom checkpoint manager. Args:...
Implement the Python class `KeepBestCheckpointSaver` described below. Class description: Custom Checkpoint manager for saving and restoring variables. Method signatures and docstrings: - def __init__(self, model, directory, metric, max_to_keep=8, checkpoint_name='ckpt'): Initializes a custom checkpoint manager. Args:...
06613a99305f02312a0e64ee3c3c50e7b00dcf0e
<|skeleton|> class KeepBestCheckpointSaver: """Custom Checkpoint manager for saving and restoring variables.""" def __init__(self, model, directory, metric, max_to_keep=8, checkpoint_name='ckpt'): """Initializes a custom checkpoint manager. Args: model: A keras model. directory: The path to a directory...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KeepBestCheckpointSaver: """Custom Checkpoint manager for saving and restoring variables.""" def __init__(self, model, directory, metric, max_to_keep=8, checkpoint_name='ckpt'): """Initializes a custom checkpoint manager. Args: model: A keras model. directory: The path to a directory in which to ...
the_stack_v2_python_sparse
neurst/neurst/utils/checkpoints.py
ohlionel/Prune-Tune
train
12
baf8338eddf4621f2f8e0ab2efc93c014e15355f
[ "self._name = name\nself._version = version\nself._release = release\nself._override = override", "full_version = None\nif self.version:\n full_version = self.version\n if self.release:\n full_version = '{}-{}'.format(self.version, self.release)\nreturn full_version", "if self.full_version:\n re...
<|body_start_0|> self._name = name self._version = version self._release = release self._override = override <|end_body_0|> <|body_start_1|> full_version = None if self.version: full_version = self.version if self.release: full_ver...
A package's authoritative version data. This class contains version information for a named package, and provides helper methods for formatting version/release data as well as version-enriched package name, for all supported OS families.
PackageVersion
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PackageVersion: """A package's authoritative version data. This class contains version information for a named package, and provides helper methods for formatting version/release data as well as version-enriched package name, for all supported OS families.""" def __init__(self, name: str, ve...
stack_v2_sparse_classes_36k_train_000197
14,999
permissive
[ { "docstring": "Initializes a package version. Arguments: name: the name of the package version: the version of the package release: the release of the package", "name": "__init__", "signature": "def __init__(self, name: str, version: Optional[str]=None, release: Optional[str]=None, override: Optional[s...
3
stack_v2_sparse_classes_30k_train_017203
Implement the Python class `PackageVersion` described below. Class description: A package's authoritative version data. This class contains version information for a named package, and provides helper methods for formatting version/release data as well as version-enriched package name, for all supported OS families. ...
Implement the Python class `PackageVersion` described below. Class description: A package's authoritative version data. This class contains version information for a named package, and provides helper methods for formatting version/release data as well as version-enriched package name, for all supported OS families. ...
6854d582f58592675afb3759585ce614b3db08f3
<|skeleton|> class PackageVersion: """A package's authoritative version data. This class contains version information for a named package, and provides helper methods for formatting version/release data as well as version-enriched package name, for all supported OS families.""" def __init__(self, name: str, ve...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PackageVersion: """A package's authoritative version data. This class contains version information for a named package, and provides helper methods for formatting version/release data as well as version-enriched package name, for all supported OS families.""" def __init__(self, name: str, version: Option...
the_stack_v2_python_sparse
buildchain/buildchain/versions.py
scality/metalk8s
train
321
f2c26e624e2c36cc619ada0a7b1565e4dc29b59a
[ "if not gui:\n gui = self.kernel.gui\nself.active_eventloop = gui", "if not gui:\n gui = self.kernel.gui\nreturn super().enable_matplotlib(gui)", "if not gui:\n gui = self.kernel.gui\nreturn super().enable_pylab(gui, import_all, welcome_message)" ]
<|body_start_0|> if not gui: gui = self.kernel.gui self.active_eventloop = gui <|end_body_0|> <|body_start_1|> if not gui: gui = self.kernel.gui return super().enable_matplotlib(gui) <|end_body_1|> <|body_start_2|> if not gui: gui = self.kern...
An in-process interactive shell.
InProcessInteractiveShell
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InProcessInteractiveShell: """An in-process interactive shell.""" def enable_gui(self, gui=None): """Enable GUI integration for the kernel.""" <|body_0|> def enable_matplotlib(self, gui=None): """Enable matplotlib integration for the kernel.""" <|body_1|>...
stack_v2_sparse_classes_36k_train_000198
7,067
permissive
[ { "docstring": "Enable GUI integration for the kernel.", "name": "enable_gui", "signature": "def enable_gui(self, gui=None)" }, { "docstring": "Enable matplotlib integration for the kernel.", "name": "enable_matplotlib", "signature": "def enable_matplotlib(self, gui=None)" }, { "...
3
null
Implement the Python class `InProcessInteractiveShell` described below. Class description: An in-process interactive shell. Method signatures and docstrings: - def enable_gui(self, gui=None): Enable GUI integration for the kernel. - def enable_matplotlib(self, gui=None): Enable matplotlib integration for the kernel. ...
Implement the Python class `InProcessInteractiveShell` described below. Class description: An in-process interactive shell. Method signatures and docstrings: - def enable_gui(self, gui=None): Enable GUI integration for the kernel. - def enable_matplotlib(self, gui=None): Enable matplotlib integration for the kernel. ...
f5042e35b945aded77b23470ead62d7eacefde92
<|skeleton|> class InProcessInteractiveShell: """An in-process interactive shell.""" def enable_gui(self, gui=None): """Enable GUI integration for the kernel.""" <|body_0|> def enable_matplotlib(self, gui=None): """Enable matplotlib integration for the kernel.""" <|body_1|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InProcessInteractiveShell: """An in-process interactive shell.""" def enable_gui(self, gui=None): """Enable GUI integration for the kernel.""" if not gui: gui = self.kernel.gui self.active_eventloop = gui def enable_matplotlib(self, gui=None): """Enable ma...
the_stack_v2_python_sparse
contrib/python/ipykernel/py3/ipykernel/inprocess/ipkernel.py
catboost/catboost
train
8,012
e306a5abb4a27fb915ec65c51672cef7591b576a
[ "for tv in self._testData:\n s2v = _S2V.new(t2b(tv[1]), tv[3])\n for s in tv[0]:\n s2v.update(t2b(s))\n result = s2v.derive()\n self.assertEqual(result, t2b(tv[2]))", "key = bchr(0) * 8 + bchr(255) * 8\nfor module in (AES, DES3):\n s2v = _S2V.new(key, module)\n max_comps = module.block_si...
<|body_start_0|> for tv in self._testData: s2v = _S2V.new(t2b(tv[1]), tv[3]) for s in tv[0]: s2v.update(t2b(s)) result = s2v.derive() self.assertEqual(result, t2b(tv[2])) <|end_body_0|> <|body_start_1|> key = bchr(0) * 8 + bchr(255) * 8 ...
S2V_Tests
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class S2V_Tests: def test1(self): """Verify correctness of test vector""" <|body_0|> def test2(self): """Verify that no more than 127(AES) and 63(TDES) components are accepted.""" <|body_1|> <|end_skeleton|> <|body_start_0|> for tv in self._testData: ...
stack_v2_sparse_classes_36k_train_000199
34,497
permissive
[ { "docstring": "Verify correctness of test vector", "name": "test1", "signature": "def test1(self)" }, { "docstring": "Verify that no more than 127(AES) and 63(TDES) components are accepted.", "name": "test2", "signature": "def test2(self)" } ]
2
null
Implement the Python class `S2V_Tests` described below. Class description: Implement the S2V_Tests class. Method signatures and docstrings: - def test1(self): Verify correctness of test vector - def test2(self): Verify that no more than 127(AES) and 63(TDES) components are accepted.
Implement the Python class `S2V_Tests` described below. Class description: Implement the S2V_Tests class. Method signatures and docstrings: - def test1(self): Verify correctness of test vector - def test2(self): Verify that no more than 127(AES) and 63(TDES) components are accepted. <|skeleton|> class S2V_Tests: ...
fa82044a2dc2f0f1f7454f5394e6d68fa923c289
<|skeleton|> class S2V_Tests: def test1(self): """Verify correctness of test vector""" <|body_0|> def test2(self): """Verify that no more than 127(AES) and 63(TDES) components are accepted.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class S2V_Tests: def test1(self): """Verify correctness of test vector""" for tv in self._testData: s2v = _S2V.new(t2b(tv[1]), tv[3]) for s in tv[0]: s2v.update(t2b(s)) result = s2v.derive() self.assertEqual(result, t2b(tv[2])) def...
the_stack_v2_python_sparse
venv/lib/python3.6/site-packages/Crypto/SelfTest/Protocol/test_KDF.py
masora1030/eigoyurusan
train
11