blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
92d897d3613bf38f74ff95557c17964b76e4ba8b
[ "longest_streak = 0\nnum_set = set(nums)\nfor num in num_set:\n if num - 1 not in num_set:\n current_num = num\n current_streak = 1\n while current_num + 1 in num_set:\n current_num += 1\n current_streak += 1\n longest_streak = max(longest_streak, current_streak)...
<|body_start_0|> longest_streak = 0 num_set = set(nums) for num in num_set: if num - 1 not in num_set: current_num = num current_streak = 1 while current_num + 1 in num_set: current_num += 1 curre...
Sequence
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sequence: def find_longest_consecutive(self, nums: List[int]) -> int: """Approach: Hash Set and Intelligence Sequence Building Time Complexity: O(n) Space Complexity: O(n) :param nums: :return:""" <|body_0|> def find_longest_consecutive_(self, nums: List[int]) -> int: ...
stack_v2_sparse_classes_75kplus_train_066100
2,192
no_license
[ { "docstring": "Approach: Hash Set and Intelligence Sequence Building Time Complexity: O(n) Space Complexity: O(n) :param nums: :return:", "name": "find_longest_consecutive", "signature": "def find_longest_consecutive(self, nums: List[int]) -> int" }, { "docstring": "Approach: Sorting Time Compl...
3
stack_v2_sparse_classes_30k_train_044749
Implement the Python class `Sequence` described below. Class description: Implement the Sequence class. Method signatures and docstrings: - def find_longest_consecutive(self, nums: List[int]) -> int: Approach: Hash Set and Intelligence Sequence Building Time Complexity: O(n) Space Complexity: O(n) :param nums: :retur...
Implement the Python class `Sequence` described below. Class description: Implement the Sequence class. Method signatures and docstrings: - def find_longest_consecutive(self, nums: List[int]) -> int: Approach: Hash Set and Intelligence Sequence Building Time Complexity: O(n) Space Complexity: O(n) :param nums: :retur...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class Sequence: def find_longest_consecutive(self, nums: List[int]) -> int: """Approach: Hash Set and Intelligence Sequence Building Time Complexity: O(n) Space Complexity: O(n) :param nums: :return:""" <|body_0|> def find_longest_consecutive_(self, nums: List[int]) -> int: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Sequence: def find_longest_consecutive(self, nums: List[int]) -> int: """Approach: Hash Set and Intelligence Sequence Building Time Complexity: O(n) Space Complexity: O(n) :param nums: :return:""" longest_streak = 0 num_set = set(nums) for num in num_set: if num - 1...
the_stack_v2_python_sparse
data_structures/longest_consecutive_sequence.py
Shiv2157k/leet_code
train
1
678c6ccb2c1ca11d88da31277e3aa1250f5bb083
[ "CustomColors = ctypes.c_uint32 * 16\ncolors = sublime.load_settings('color_helper.palettes').get('win_picker_custom', [])\nlength = len(colors)\nif length > 16:\n colors = colors[0:16]\nif length < 16:\n delta = 16 - length\n colors.extend(['color(srgb 1 1 1)'] * delta)\nfor index, color in enumerate(colo...
<|body_start_0|> CustomColors = ctypes.c_uint32 * 16 colors = sublime.load_settings('color_helper.palettes').get('win_picker_custom', []) length = len(colors) if length > 16: colors = colors[0:16] if length < 16: delta = 16 - length colors.exte...
Windows color picker. https://docs.microsoft.com/en-us/windows/win32/api/commdlg/ns-commdlg-choosecolorw-r1
WinPick
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WinPick: """Windows color picker. https://docs.microsoft.com/en-us/windows/win32/api/commdlg/ns-commdlg-choosecolorw-r1""" def get_win_pick_colors(self): """Get windows custom colors.""" <|body_0|> def set_win_pick_colors(self, colors): """Set windows custom colo...
stack_v2_sparse_classes_75kplus_train_066101
5,509
permissive
[ { "docstring": "Get windows custom colors.", "name": "get_win_pick_colors", "signature": "def get_win_pick_colors(self)" }, { "docstring": "Set windows custom colors.", "name": "set_win_pick_colors", "signature": "def set_win_pick_colors(self, colors)" }, { "docstring": "Pick the...
3
null
Implement the Python class `WinPick` described below. Class description: Windows color picker. https://docs.microsoft.com/en-us/windows/win32/api/commdlg/ns-commdlg-choosecolorw-r1 Method signatures and docstrings: - def get_win_pick_colors(self): Get windows custom colors. - def set_win_pick_colors(self, colors): Se...
Implement the Python class `WinPick` described below. Class description: Windows color picker. https://docs.microsoft.com/en-us/windows/win32/api/commdlg/ns-commdlg-choosecolorw-r1 Method signatures and docstrings: - def get_win_pick_colors(self): Get windows custom colors. - def set_win_pick_colors(self, colors): Se...
ad4d779bff57a65b7c77cda0b79c10cf904eb817
<|skeleton|> class WinPick: """Windows color picker. https://docs.microsoft.com/en-us/windows/win32/api/commdlg/ns-commdlg-choosecolorw-r1""" def get_win_pick_colors(self): """Get windows custom colors.""" <|body_0|> def set_win_pick_colors(self, colors): """Set windows custom colo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WinPick: """Windows color picker. https://docs.microsoft.com/en-us/windows/win32/api/commdlg/ns-commdlg-choosecolorw-r1""" def get_win_pick_colors(self): """Get windows custom colors.""" CustomColors = ctypes.c_uint32 * 16 colors = sublime.load_settings('color_helper.palettes').ge...
the_stack_v2_python_sparse
ch_native_picker.py
facelessuser/ColorHelper
train
279
0b2f1764da11de4295e03c7198bdd556ab5aeedf
[ "if not s:\n return 0\nlength = len(s)\nif length == 1:\n return 1\nans = 0\nfor i in range(length):\n for j in range(i + 1, length + 1):\n substring = s[i:j]\n sub_len = len(substring)\n if len(set(substring)) == sub_len:\n ans = max([ans, sub_len])\nreturn ans", "def che...
<|body_start_0|> if not s: return 0 length = len(s) if length == 1: return 1 ans = 0 for i in range(length): for j in range(i + 1, length + 1): substring = s[i:j] sub_len = len(substring) if len(s...
Solution
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s: str) -> int: """A straight forward solution costing O(n^2) time Failed: Exceed time limitation.""" <|body_0|> def lengthOfLongestSubstring_v2(self, s: str) -> int: """Leverage binary-search to reduce the number of itera...
stack_v2_sparse_classes_75kplus_train_066102
3,108
permissive
[ { "docstring": "A straight forward solution costing O(n^2) time Failed: Exceed time limitation.", "name": "lengthOfLongestSubstring", "signature": "def lengthOfLongestSubstring(self, s: str) -> int" }, { "docstring": "Leverage binary-search to reduce the number of iterations. Time: O(nlogn) Fail...
4
stack_v2_sparse_classes_30k_train_021108
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s: str) -> int: A straight forward solution costing O(n^2) time Failed: Exceed time limitation. - def lengthOfLongestSubstring_v2(self, s: str)...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s: str) -> int: A straight forward solution costing O(n^2) time Failed: Exceed time limitation. - def lengthOfLongestSubstring_v2(self, s: str)...
226cecde136531341ce23cdf88529345be1912fc
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s: str) -> int: """A straight forward solution costing O(n^2) time Failed: Exceed time limitation.""" <|body_0|> def lengthOfLongestSubstring_v2(self, s: str) -> int: """Leverage binary-search to reduce the number of itera...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def lengthOfLongestSubstring(self, s: str) -> int: """A straight forward solution costing O(n^2) time Failed: Exceed time limitation.""" if not s: return 0 length = len(s) if length == 1: return 1 ans = 0 for i in range(length):...
the_stack_v2_python_sparse
Leetcode/Intermediate/Array_and_string/3_Longest_Substring_Without_Repeating_Characters.py
ZR-Huang/AlgorithmsPractices
train
1
dcabc077bea36188fecb33dd6128db2f7454d8a1
[ "self.class_type = class_type\nself.blender_model_path = os.path.join(cfg.dataset_dir, cfg.dataset_name, '{0}/{0}.ply'.format(class_type))\nself.orig_model_path = os.path.join(cfg.dataset_dir, cfg.origin_dataset_name, '{}/mesh.ply'.format(class_type))\nself.model_aligner = ModelAligner(class_type)", "rot, tra = (...
<|body_start_0|> self.class_type = class_type self.blender_model_path = os.path.join(cfg.dataset_dir, cfg.dataset_name, '{0}/{0}.ply'.format(class_type)) self.orig_model_path = os.path.join(cfg.dataset_dir, cfg.origin_dataset_name, '{}/mesh.ply'.format(class_type)) self.model_aligner = M...
PoseTransformer
PoseTransformer
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PoseTransformer: """PoseTransformer""" def __init__(self, class_type): """__init__""" <|body_0|> def orig_pose_to_blender_pose(self, pose): """orig_pose_to_blender_pose""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.class_type = class_type...
stack_v2_sparse_classes_75kplus_train_066103
12,892
permissive
[ { "docstring": "__init__", "name": "__init__", "signature": "def __init__(self, class_type)" }, { "docstring": "orig_pose_to_blender_pose", "name": "orig_pose_to_blender_pose", "signature": "def orig_pose_to_blender_pose(self, pose)" } ]
2
stack_v2_sparse_classes_30k_train_018463
Implement the Python class `PoseTransformer` described below. Class description: PoseTransformer Method signatures and docstrings: - def __init__(self, class_type): __init__ - def orig_pose_to_blender_pose(self, pose): orig_pose_to_blender_pose
Implement the Python class `PoseTransformer` described below. Class description: PoseTransformer Method signatures and docstrings: - def __init__(self, class_type): __init__ - def orig_pose_to_blender_pose(self, pose): orig_pose_to_blender_pose <|skeleton|> class PoseTransformer: """PoseTransformer""" def _...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class PoseTransformer: """PoseTransformer""" def __init__(self, class_type): """__init__""" <|body_0|> def orig_pose_to_blender_pose(self, pose): """orig_pose_to_blender_pose""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PoseTransformer: """PoseTransformer""" def __init__(self, class_type): """__init__""" self.class_type = class_type self.blender_model_path = os.path.join(cfg.dataset_dir, cfg.dataset_name, '{0}/{0}.ply'.format(class_type)) self.orig_model_path = os.path.join(cfg.dataset_di...
the_stack_v2_python_sparse
official/cv/PVNet/src/evaluation_dataset.py
mindspore-ai/models
train
301
b43d9835302e46c04b1d3f306673d13d66b13da5
[ "super().__init__(em_size=em_size, batch_size=batch_size, nb_epochs=nb_epochs, initialiser=initialiser, nb_negs=nb_negs, optimiser=optimiser, lr=lr, loss=loss, nb_ents=nb_ents, nb_rels=nb_rels, reg_wt=reg_wt, seed=seed, verbose=verbose, log_interval=log_interval)\nself.margin = margin\nself.similarity = similarity"...
<|body_start_0|> super().__init__(em_size=em_size, batch_size=batch_size, nb_epochs=nb_epochs, initialiser=initialiser, nb_negs=nb_negs, optimiser=optimiser, lr=lr, loss=loss, nb_ents=nb_ents, nb_rels=nb_rels, reg_wt=reg_wt, seed=seed, verbose=verbose, log_interval=log_interval) self.margin = margin ...
The Translating Embedding model (TransE)
TransE
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransE: """The Translating Embedding model (TransE)""" def __init__(self, em_size=100, batch_size=128, nb_epochs=100, initialiser='xavier_uniform', nb_negs=2, margin=1.0, optimiser='amsgrad', lr=0.01, similarity='l1', nb_ents=0, nb_rels=0, reg_wt=0.01, loss='default', seed=1234, verbose=1, l...
stack_v2_sparse_classes_75kplus_train_066104
16,614
permissive
[ { "docstring": "Initialise new instance of the class TranslatingEmbeddingModel Parameters ---------- em_size: int embedding vector size batch_size: int batch size nb_epochs: int number of epoch i.e training iterations initialiser: str initialiser name e.g. xavier_uniform or he_normal nb_negs: int number of nega...
3
stack_v2_sparse_classes_30k_train_028265
Implement the Python class `TransE` described below. Class description: The Translating Embedding model (TransE) Method signatures and docstrings: - def __init__(self, em_size=100, batch_size=128, nb_epochs=100, initialiser='xavier_uniform', nb_negs=2, margin=1.0, optimiser='amsgrad', lr=0.01, similarity='l1', nb_ent...
Implement the Python class `TransE` described below. Class description: The Translating Embedding model (TransE) Method signatures and docstrings: - def __init__(self, em_size=100, batch_size=128, nb_epochs=100, initialiser='xavier_uniform', nb_negs=2, margin=1.0, optimiser='amsgrad', lr=0.01, similarity='l1', nb_ent...
e1204cb78bb91ffe3126df62d2d14b20da950694
<|skeleton|> class TransE: """The Translating Embedding model (TransE)""" def __init__(self, em_size=100, batch_size=128, nb_epochs=100, initialiser='xavier_uniform', nb_negs=2, margin=1.0, optimiser='amsgrad', lr=0.01, similarity='l1', nb_ents=0, nb_rels=0, reg_wt=0.01, loss='default', seed=1234, verbose=1, l...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TransE: """The Translating Embedding model (TransE)""" def __init__(self, em_size=100, batch_size=128, nb_epochs=100, initialiser='xavier_uniform', nb_negs=2, margin=1.0, optimiser='amsgrad', lr=0.01, similarity='l1', nb_ents=0, nb_rels=0, reg_wt=0.01, loss='default', seed=1234, verbose=1, log_interval=5...
the_stack_v2_python_sparse
benchmarking/libkge/libkge/embedding/models.py
hpi-sam/GNN-Effectants
train
2
5e386d8279c2df5bcd22301a6047d6a37acd0cc8
[ "Presentation.__init__(self, pere, detail, attribut, False)\nif pere and detail:\n self.construire(detail)", "supporter = self.ajouter_choix('peut supporter', 'u', Flottant, detail, 'peut_supporter')\nsupporter.parent = self\nsupporter.prompt = 'Entrez le poids que le détail peut supporter : '\nsupporter.aide_...
<|body_start_0|> Presentation.__init__(self, pere, detail, attribut, False) if pere and detail: self.construire(detail) <|end_body_0|> <|body_start_1|> supporter = self.ajouter_choix('peut supporter', 'u', Flottant, detail, 'peut_supporter') supporter.parent = self s...
Ce contexte permet d'éditer la partie support d'un détail.
EdtSupport
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EdtSupport: """Ce contexte permet d'éditer la partie support d'un détail.""" def __init__(self, pere, detail=None, attribut=None): """Constructeur de l'éditeur""" <|body_0|> def construire(self, detail): """Construction de l'éditeur""" <|body_1|> <|end_s...
stack_v2_sparse_classes_75kplus_train_066105
5,188
permissive
[ { "docstring": "Constructeur de l'éditeur", "name": "__init__", "signature": "def __init__(self, pere, detail=None, attribut=None)" }, { "docstring": "Construction de l'éditeur", "name": "construire", "signature": "def construire(self, detail)" } ]
2
stack_v2_sparse_classes_30k_train_030352
Implement the Python class `EdtSupport` described below. Class description: Ce contexte permet d'éditer la partie support d'un détail. Method signatures and docstrings: - def __init__(self, pere, detail=None, attribut=None): Constructeur de l'éditeur - def construire(self, detail): Construction de l'éditeur
Implement the Python class `EdtSupport` described below. Class description: Ce contexte permet d'éditer la partie support d'un détail. Method signatures and docstrings: - def __init__(self, pere, detail=None, attribut=None): Constructeur de l'éditeur - def construire(self, detail): Construction de l'éditeur <|skelet...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class EdtSupport: """Ce contexte permet d'éditer la partie support d'un détail.""" def __init__(self, pere, detail=None, attribut=None): """Constructeur de l'éditeur""" <|body_0|> def construire(self, detail): """Construction de l'éditeur""" <|body_1|> <|end_s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EdtSupport: """Ce contexte permet d'éditer la partie support d'un détail.""" def __init__(self, pere, detail=None, attribut=None): """Constructeur de l'éditeur""" Presentation.__init__(self, pere, detail, attribut, False) if pere and detail: self.construire(detail) ...
the_stack_v2_python_sparse
src/primaires/salle/editeurs/redit/edt_support.py
vincent-lg/tsunami
train
5
79c756691ca4186debb8c1de5da3f520db87cfc7
[ "blog = get_object_or_404(BlogEntry, slug=kwargs.get('slug', None))\nself.template_name = blog.template.path\nself.entry = blog\nreturn super(BlogDetailView, self).get(request, *args, **kwargs)", "context = super(BlogDetailView, self).get_context_data(**kwargs)\ntag_lines = [('Create simple, human-like, conversat...
<|body_start_0|> blog = get_object_or_404(BlogEntry, slug=kwargs.get('slug', None)) self.template_name = blog.template.path self.entry = blog return super(BlogDetailView, self).get(request, *args, **kwargs) <|end_body_0|> <|body_start_1|> context = super(BlogDetailView, self).ge...
Our view to set the template path prior to a regular get request.
BlogDetailView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlogDetailView: """Our view to set the template path prior to a regular get request.""" def get(self, request, *args, **kwargs): """Here we base our render on the selected template/blog entry.""" <|body_0|> def get_context_data(self, **kwargs): """Set the blog en...
stack_v2_sparse_classes_75kplus_train_066106
3,135
no_license
[ { "docstring": "Here we base our render on the selected template/blog entry.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Set the blog entry context.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_012227
Implement the Python class `BlogDetailView` described below. Class description: Our view to set the template path prior to a regular get request. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Here we base our render on the selected template/blog entry. - def get_context_data(self, **kwa...
Implement the Python class `BlogDetailView` described below. Class description: Our view to set the template path prior to a regular get request. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Here we base our render on the selected template/blog entry. - def get_context_data(self, **kwa...
4cd52c07bb64e9d9381a957323d277489a02181a
<|skeleton|> class BlogDetailView: """Our view to set the template path prior to a regular get request.""" def get(self, request, *args, **kwargs): """Here we base our render on the selected template/blog entry.""" <|body_0|> def get_context_data(self, **kwargs): """Set the blog en...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BlogDetailView: """Our view to set the template path prior to a regular get request.""" def get(self, request, *args, **kwargs): """Here we base our render on the selected template/blog entry.""" blog = get_object_or_404(BlogEntry, slug=kwargs.get('slug', None)) self.template_name...
the_stack_v2_python_sparse
cms/blog/views.py
webmaxdev0110/digi-django
train
0
672bc0b431ad911a6ddb79efe399be5b5d10e4c2
[ "self.__logger_handler = logger_handler\nself.__retry_times = retry_times\nself.__request_timeout = request_timeout\nself.__base_headers = base_headers\nself.__request_session = requests.Session()\nself.__request_session.mount('http://', HTTPAdapter(max_retries=self.__retry_times))\nself.__request_session.mount('ht...
<|body_start_0|> self.__logger_handler = logger_handler self.__retry_times = retry_times self.__request_timeout = request_timeout self.__base_headers = base_headers self.__request_session = requests.Session() self.__request_session.mount('http://', HTTPAdapter(max_retries...
对requests的二次封装,格式化response解析,重试机制
BaseClient
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseClient: """对requests的二次封装,格式化response解析,重试机制""" def __init__(self, logger_handler=_logger, retry_times=3, request_timeout=10, base_headers=None): """:param logger_handler: 若需要将请求接口的错误日志与其他日志一起收集,请传递公用的logger :param retry_times: :param request_timeout: :param base_headers:""" ...
stack_v2_sparse_classes_75kplus_train_066107
3,264
no_license
[ { "docstring": ":param logger_handler: 若需要将请求接口的错误日志与其他日志一起收集,请传递公用的logger :param retry_times: :param request_timeout: :param base_headers:", "name": "__init__", "signature": "def __init__(self, logger_handler=_logger, retry_times=3, request_timeout=10, base_headers=None)" }, { "docstring": ":pa...
3
null
Implement the Python class `BaseClient` described below. Class description: 对requests的二次封装,格式化response解析,重试机制 Method signatures and docstrings: - def __init__(self, logger_handler=_logger, retry_times=3, request_timeout=10, base_headers=None): :param logger_handler: 若需要将请求接口的错误日志与其他日志一起收集,请传递公用的logger :param retry_ti...
Implement the Python class `BaseClient` described below. Class description: 对requests的二次封装,格式化response解析,重试机制 Method signatures and docstrings: - def __init__(self, logger_handler=_logger, retry_times=3, request_timeout=10, base_headers=None): :param logger_handler: 若需要将请求接口的错误日志与其他日志一起收集,请传递公用的logger :param retry_ti...
499c6e38287474e47b9038040f7598e65fde5c03
<|skeleton|> class BaseClient: """对requests的二次封装,格式化response解析,重试机制""" def __init__(self, logger_handler=_logger, retry_times=3, request_timeout=10, base_headers=None): """:param logger_handler: 若需要将请求接口的错误日志与其他日志一起收集,请传递公用的logger :param retry_times: :param request_timeout: :param base_headers:""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseClient: """对requests的二次封装,格式化response解析,重试机制""" def __init__(self, logger_handler=_logger, retry_times=3, request_timeout=10, base_headers=None): """:param logger_handler: 若需要将请求接口的错误日志与其他日志一起收集,请传递公用的logger :param retry_times: :param request_timeout: :param base_headers:""" self.__lo...
the_stack_v2_python_sparse
utils4py/request_client/client.py
hbyhl/utils4py
train
0
88191b9953d4386e656aa8f67f751cd75d38ae13
[ "result = []\nif root is not None:\n vec = []\n for child in root.children:\n vec.extend(self.postorder(child))\n result.extend(vec)\n result.append(root.val)\nreturn result", "stack, result = ([root], [])\nwhile len(stack) != 0 and root is not None:\n n = stack.pop()\n result.insert(0, n...
<|body_start_0|> result = [] if root is not None: vec = [] for child in root.children: vec.extend(self.postorder(child)) result.extend(vec) result.append(root.val) return result <|end_body_0|> <|body_start_1|> stack, result...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def postorder2(self, root): """:type root: Node :rtype: List[int]""" <|body_0|> def postorder(self, root): """:type root: Node :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = [] if root is not None: ...
stack_v2_sparse_classes_75kplus_train_066108
844
no_license
[ { "docstring": ":type root: Node :rtype: List[int]", "name": "postorder2", "signature": "def postorder2(self, root)" }, { "docstring": ":type root: Node :rtype: List[int]", "name": "postorder", "signature": "def postorder(self, root)" } ]
2
stack_v2_sparse_classes_30k_test_002894
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def postorder2(self, root): :type root: Node :rtype: List[int] - def postorder(self, root): :type root: Node :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def postorder2(self, root): :type root: Node :rtype: List[int] - def postorder(self, root): :type root: Node :rtype: List[int] <|skeleton|> class Solution: def postorder2(s...
77ee7186a918cf865a038d9da5ae71e0aa6b64dc
<|skeleton|> class Solution: def postorder2(self, root): """:type root: Node :rtype: List[int]""" <|body_0|> def postorder(self, root): """:type root: Node :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def postorder2(self, root): """:type root: Node :rtype: List[int]""" result = [] if root is not None: vec = [] for child in root.children: vec.extend(self.postorder(child)) result.extend(vec) result.append(root.v...
the_stack_v2_python_sparse
776-n-ary-tree-postorder-traversal/solution.py
GoingMyWay/LeetCode
train
2
67419ae39c4c1d55eaadac51c32a11a4373a431c
[ "logger.info(status)\nimporter_status = ImporterStatuses.find_by_name(status.name)\nif importer_status:\n if status.state == 'success':\n importer_status.state = 'success'\n else:\n importer_status.state = 'failure'\n importer_status.reason = status.reason\n importer_status.trace =...
<|body_start_0|> logger.info(status) importer_status = ImporterStatuses.find_by_name(status.name) if importer_status: if status.state == 'success': importer_status.state = 'success' else: importer_status.state = 'failure' im...
API endpoint, rerun an importer that has failed.
ImportRetry
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImportRetry: """API endpoint, rerun an importer that has failed.""" def status_has_changed(self, status: ImporterStatus): """Receive the status of an importer and persist it to the Importer Status table :param status: Status object defining the state of an importer""" <|body_...
stack_v2_sparse_classes_75kplus_train_066109
2,670
permissive
[ { "docstring": "Receive the status of an importer and persist it to the Importer Status table :param status: Status object defining the state of an importer", "name": "status_has_changed", "signature": "def status_has_changed(self, status: ImporterStatus)" }, { "docstring": "POST request, allow ...
3
stack_v2_sparse_classes_30k_train_019862
Implement the Python class `ImportRetry` described below. Class description: API endpoint, rerun an importer that has failed. Method signatures and docstrings: - def status_has_changed(self, status: ImporterStatus): Receive the status of an importer and persist it to the Importer Status table :param status: Status ob...
Implement the Python class `ImportRetry` described below. Class description: API endpoint, rerun an importer that has failed. Method signatures and docstrings: - def status_has_changed(self, status: ImporterStatus): Receive the status of an importer and persist it to the Importer Status table :param status: Status ob...
5d123691d1f25d0b85e20e4e8293266bf23c9f8a
<|skeleton|> class ImportRetry: """API endpoint, rerun an importer that has failed.""" def status_has_changed(self, status: ImporterStatus): """Receive the status of an importer and persist it to the Importer Status table :param status: Status object defining the state of an importer""" <|body_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImportRetry: """API endpoint, rerun an importer that has failed.""" def status_has_changed(self, status: ImporterStatus): """Receive the status of an importer and persist it to the Importer Status table :param status: Status object defining the state of an importer""" logger.info(status) ...
the_stack_v2_python_sparse
Analytics/resources/import_retry.py
thanosbnt/SharingCitiesDashboard
train
0
47c7c77377fd280e09521a28e89968dd05f3778f
[ "self.width = width\nself.height = height\nself.food = deque(food)\nself.next_food = []\nif self.food:\n self.next_food = self.food.popleft()\nself.curr_pos = [0, 0]\nself.body = deque()\nself.body.append([0, 0])\nself.foods = 0", "move_dict = {'U': [-1, 0], 'L': [0, -1], 'R': [0, 1], 'D': [1, 0]}\nnext_pos = ...
<|body_start_0|> self.width = width self.height = height self.food = deque(food) self.next_food = [] if self.food: self.next_food = self.food.popleft() self.curr_pos = [0, 0] self.body = deque() self.body.append([0, 0]) self.foods = 0 <...
SnakeGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t...
stack_v2_sparse_classes_75kplus_train_066110
1,963
no_license
[ { "docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0].", "name": "__init__", "signature": "def __init__(self, widt...
2
stack_v2_sparse_classes_30k_train_021131
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -...
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -...
31bbbd996d0a9783dc7d516b9af8c0e76792befa
<|skeleton|> class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is a...
the_stack_v2_python_sparse
design/0353_design_snake_game.py
helenayyan/leetcode
train
0
a1db9b99510be44f4495f8f426fcbc85a8fadc61
[ "self._head = Node(None, None, None)\nself._head.prev_node = self._head.next_node = self._head\nAbstractList.__init__(self, sourceCollection)", "cursor = self._head.next_node\nwhile cursor != self._head:\n yield cursor.value\n cursor = cursor.next_node", "if key == len(self):\n return self._head\nelif ...
<|body_start_0|> self._head = Node(None, None, None) self._head.prev_node = self._head.next_node = self._head AbstractList.__init__(self, sourceCollection) <|end_body_0|> <|body_start_1|> cursor = self._head.next_node while cursor != self._head: yield cursor.value ...
A link-based list implementation.
LinkedList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinkedList: """A link-based list implementation.""" def __init__(self, sourceCollection=None): """Set the initial state of self, which includes the contents of sourceCollection, if it's present.""" <|body_0|> def __iter__(self): """Supports iteration over a view ...
stack_v2_sparse_classes_75kplus_train_066111
2,887
no_license
[ { "docstring": "Set the initial state of self, which includes the contents of sourceCollection, if it's present.", "name": "__init__", "signature": "def __init__(self, sourceCollection=None)" }, { "docstring": "Supports iteration over a view of self.", "name": "__iter__", "signature": "d...
6
stack_v2_sparse_classes_30k_train_038026
Implement the Python class `LinkedList` described below. Class description: A link-based list implementation. Method signatures and docstrings: - def __init__(self, sourceCollection=None): Set the initial state of self, which includes the contents of sourceCollection, if it's present. - def __iter__(self): Supports i...
Implement the Python class `LinkedList` described below. Class description: A link-based list implementation. Method signatures and docstrings: - def __init__(self, sourceCollection=None): Set the initial state of self, which includes the contents of sourceCollection, if it's present. - def __iter__(self): Supports i...
00ef549389241bdcab29aaba5b9c7c4895d8975c
<|skeleton|> class LinkedList: """A link-based list implementation.""" def __init__(self, sourceCollection=None): """Set the initial state of self, which includes the contents of sourceCollection, if it's present.""" <|body_0|> def __iter__(self): """Supports iteration over a view ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LinkedList: """A link-based list implementation.""" def __init__(self, sourceCollection=None): """Set the initial state of self, which includes the contents of sourceCollection, if it's present.""" self._head = Node(None, None, None) self._head.prev_node = self._head.next_node = s...
the_stack_v2_python_sparse
Chapter9_Lists/linkedlist.py
caoxiang104/DataStructuresOfPython
train
4
a096c0ee3a624af25f5592acad3c1d77e8f2c2b9
[ "mes = ''\ntry:\n url = 'https://api.nytimes.com/svc/books/v3/lists/current/hardcover-fiction.json'\n res = requests.get(url, {'api-key': BS_BOOK_KEY})\n allList = json.loads(res.text)\n books = allList['results']['books']\n if len(books) == 0:\n return ''\n book = random.choice(list(books)...
<|body_start_0|> mes = '' try: url = 'https://api.nytimes.com/svc/books/v3/lists/current/hardcover-fiction.json' res = requests.get(url, {'api-key': BS_BOOK_KEY}) allList = json.loads(res.text) books = allList['results']['books'] if len(books) ...
In this class, delete user endpoint is implemented
DeleteUser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeleteUser: """In this class, delete user endpoint is implemented""" def bestsellers(): """returns a message including a book recommendation in the format "NAME OF THE BOOK " by "AUTHOR". "DESCRIPTION". This function returns a message including a book recomendation taken by NYT bests...
stack_v2_sparse_classes_75kplus_train_066112
4,470
no_license
[ { "docstring": "returns a message including a book recommendation in the format \"NAME OF THE BOOK \" by \"AUTHOR\". \"DESCRIPTION\". This function returns a message including a book recomendation taken by NYT bestseller list.", "name": "bestsellers", "signature": "def bestsellers()" }, { "docst...
3
stack_v2_sparse_classes_30k_train_004903
Implement the Python class `DeleteUser` described below. Class description: In this class, delete user endpoint is implemented Method signatures and docstrings: - def bestsellers(): returns a message including a book recommendation in the format "NAME OF THE BOOK " by "AUTHOR". "DESCRIPTION". This function returns a ...
Implement the Python class `DeleteUser` described below. Class description: In this class, delete user endpoint is implemented Method signatures and docstrings: - def bestsellers(): returns a message including a book recommendation in the format "NAME OF THE BOOK " by "AUTHOR". "DESCRIPTION". This function returns a ...
f7aebee17a0a79e8d3c2927733bce8015b4a9da3
<|skeleton|> class DeleteUser: """In this class, delete user endpoint is implemented""" def bestsellers(): """returns a message including a book recommendation in the format "NAME OF THE BOOK " by "AUTHOR". "DESCRIPTION". This function returns a message including a book recomendation taken by NYT bests...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeleteUser: """In this class, delete user endpoint is implemented""" def bestsellers(): """returns a message including a book recommendation in the format "NAME OF THE BOOK " by "AUTHOR". "DESCRIPTION". This function returns a message including a book recomendation taken by NYT bestseller list.""...
the_stack_v2_python_sparse
practice-app/platon_api/rest_api/delete_user_t/delete_user_f.py
bounswe/bounswe2020group7
train
18
51f610034378c05817e8fd87d729d1a483cf1c99
[ "result_particles = []\nnd_timestamp, non_data, non_start, non_end = self._chunker.get_next_non_data_with_index(clean=False)\ntimestamp, chunk, start, end = self._chunker.get_next_data_with_index()\nself.handle_non_data(non_data, non_end, start)\nwhile chunk is not None:\n header_match = SIO_HEADER_MATCHER.match...
<|body_start_0|> result_particles = [] nd_timestamp, non_data, non_start, non_end = self._chunker.get_next_non_data_with_index(clean=False) timestamp, chunk, start, end = self._chunker.get_next_data_with_index() self.handle_non_data(non_data, non_end, start) while chunk is not No...
Parser for Ctdmo telemetered data (SIO Mule). This parser handles both CT and CO data from the SIO Mule.
CtdmoGhqrSioTelemeteredParser
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CtdmoGhqrSioTelemeteredParser: """Parser for Ctdmo telemetered data (SIO Mule). This parser handles both CT and CO data from the SIO Mule.""" def parse_chunks(self): """Parse chunks for the Telemetered parser. Parse out any pending data chunks in the chunker. If it is a valid data pi...
stack_v2_sparse_classes_75kplus_train_066113
33,252
permissive
[ { "docstring": "Parse chunks for the Telemetered parser. Parse out any pending data chunks in the chunker. If it is a valid data piece, build a particle. Go until the chunker has no more valid data. @retval a list of tuples with sample particles encountered in this parsing, plus the state. An empty list of noth...
3
null
Implement the Python class `CtdmoGhqrSioTelemeteredParser` described below. Class description: Parser for Ctdmo telemetered data (SIO Mule). This parser handles both CT and CO data from the SIO Mule. Method signatures and docstrings: - def parse_chunks(self): Parse chunks for the Telemetered parser. Parse out any pen...
Implement the Python class `CtdmoGhqrSioTelemeteredParser` described below. Class description: Parser for Ctdmo telemetered data (SIO Mule). This parser handles both CT and CO data from the SIO Mule. Method signatures and docstrings: - def parse_chunks(self): Parse chunks for the Telemetered parser. Parse out any pen...
bdbf01f5614e7188ce19596704794466e5683b30
<|skeleton|> class CtdmoGhqrSioTelemeteredParser: """Parser for Ctdmo telemetered data (SIO Mule). This parser handles both CT and CO data from the SIO Mule.""" def parse_chunks(self): """Parse chunks for the Telemetered parser. Parse out any pending data chunks in the chunker. If it is a valid data pi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CtdmoGhqrSioTelemeteredParser: """Parser for Ctdmo telemetered data (SIO Mule). This parser handles both CT and CO data from the SIO Mule.""" def parse_chunks(self): """Parse chunks for the Telemetered parser. Parse out any pending data chunks in the chunker. If it is a valid data piece, build a ...
the_stack_v2_python_sparse
mi/dataset/parser/ctdmo_ghqr_sio.py
oceanobservatories/mi-instrument
train
1
e248b9673dcc2d9f7fe63e193a56a10bd3b9fb09
[ "if not os.access(filepath, os.R_OK):\n raise IOError('Could not read/access zeek log file: {:s}'.format(filepath))\nself._filepath = filepath\nself._delimiter = delimiter\nself._tail = tail\nself._strict = strict\nself.field_names = []\nself.field_types = []\nself.type_converters = []\nself.type_mapper = {'bool...
<|body_start_0|> if not os.access(filepath, os.R_OK): raise IOError('Could not read/access zeek log file: {:s}'.format(filepath)) self._filepath = filepath self._delimiter = delimiter self._tail = tail self._strict = strict self.field_names = [] self.f...
ZeekLogReader: This class reads in various Zeek logs. The class inherits from the FileTailer class so it supports the following use cases: - Read contents of a Zeek log file (tail=False) - Read contents + 'tail -f' Zeek log file (tail=True) Args: filepath (str): The full path the file (/full/path/to/the/file.txt) delim...
ZeekLogReader
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZeekLogReader: """ZeekLogReader: This class reads in various Zeek logs. The class inherits from the FileTailer class so it supports the following use cases: - Read contents of a Zeek log file (tail=False) - Read contents + 'tail -f' Zeek log file (tail=True) Args: filepath (str): The full path th...
stack_v2_sparse_classes_75kplus_train_066114
9,090
permissive
[ { "docstring": "Initialization for the ZeekLogReader Class", "name": "__init__", "signature": "def __init__(self, filepath, delimiter='\\t', tail=False, strict=False)" }, { "docstring": "The readrows method reads in the header of the Zeek log and then uses the parent class to yield each row of t...
5
stack_v2_sparse_classes_30k_train_050084
Implement the Python class `ZeekLogReader` described below. Class description: ZeekLogReader: This class reads in various Zeek logs. The class inherits from the FileTailer class so it supports the following use cases: - Read contents of a Zeek log file (tail=False) - Read contents + 'tail -f' Zeek log file (tail=True)...
Implement the Python class `ZeekLogReader` described below. Class description: ZeekLogReader: This class reads in various Zeek logs. The class inherits from the FileTailer class so it supports the following use cases: - Read contents of a Zeek log file (tail=False) - Read contents + 'tail -f' Zeek log file (tail=True)...
1d83a44a4d171b1f99a48b6706da4f495c9f63f9
<|skeleton|> class ZeekLogReader: """ZeekLogReader: This class reads in various Zeek logs. The class inherits from the FileTailer class so it supports the following use cases: - Read contents of a Zeek log file (tail=False) - Read contents + 'tail -f' Zeek log file (tail=True) Args: filepath (str): The full path th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ZeekLogReader: """ZeekLogReader: This class reads in various Zeek logs. The class inherits from the FileTailer class so it supports the following use cases: - Read contents of a Zeek log file (tail=False) - Read contents + 'tail -f' Zeek log file (tail=True) Args: filepath (str): The full path the file (/full...
the_stack_v2_python_sparse
zat/zeek_log_reader.py
SuperCowPowers/zat
train
191
dd177adcf8af24319a485c21aadfeefacdc4f91d
[ "cr_line_obj = self.env['credit.control.line']\ncr_lines = cr_line_obj.search([('id', 'in', line_ids), ('partner_id', '=', partner_id), ('policy_level_id', '=', level_id), ('currency_id', '=', currency_id), ('operating_unit_id', '=', operating_unit_id)])\nreturn cr_lines", "comms = self.browse()\nif not lines:\n ...
<|body_start_0|> cr_line_obj = self.env['credit.control.line'] cr_lines = cr_line_obj.search([('id', 'in', line_ids), ('partner_id', '=', partner_id), ('policy_level_id', '=', level_id), ('currency_id', '=', currency_id), ('operating_unit_id', '=', operating_unit_id)]) return cr_lines <|end_body...
CreditCommunication
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreditCommunication: def _get_credit_lines(self, line_ids, partner_id, level_id, currency_id, operating_unit_id): """Return credit lines related to a partner and a policy level""" <|body_0|> def _generate_comm_from_credit_lines(self, lines): """Aggregate credit contr...
stack_v2_sparse_classes_75kplus_train_066115
3,117
no_license
[ { "docstring": "Return credit lines related to a partner and a policy level", "name": "_get_credit_lines", "signature": "def _get_credit_lines(self, line_ids, partner_id, level_id, currency_id, operating_unit_id)" }, { "docstring": "Aggregate credit control line by partner, level, and currency I...
2
stack_v2_sparse_classes_30k_train_003104
Implement the Python class `CreditCommunication` described below. Class description: Implement the CreditCommunication class. Method signatures and docstrings: - def _get_credit_lines(self, line_ids, partner_id, level_id, currency_id, operating_unit_id): Return credit lines related to a partner and a policy level - d...
Implement the Python class `CreditCommunication` described below. Class description: Implement the CreditCommunication class. Method signatures and docstrings: - def _get_credit_lines(self, line_ids, partner_id, level_id, currency_id, operating_unit_id): Return credit lines related to a partner and a policy level - d...
d2db7afb71d0459d3f453f14f0e44275b480c491
<|skeleton|> class CreditCommunication: def _get_credit_lines(self, line_ids, partner_id, level_id, currency_id, operating_unit_id): """Return credit lines related to a partner and a policy level""" <|body_0|> def _generate_comm_from_credit_lines(self, lines): """Aggregate credit contr...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CreditCommunication: def _get_credit_lines(self, line_ids, partner_id, level_id, currency_id, operating_unit_id): """Return credit lines related to a partner and a policy level""" cr_line_obj = self.env['credit.control.line'] cr_lines = cr_line_obj.search([('id', 'in', line_ids), ('par...
the_stack_v2_python_sparse
bdu_account/wizard/credit_control_communication.py
kumarinie/bdu-addons
train
0
cf0f1df8f532da2aefa06001d44d225cb74eaf3a
[ "region_spec = concepts.ResourceSpec('cloudbuild.projects.locations', resource_name='region', projectsId=concepts.DEFAULT_PROJECT_ATTRIBUTE_CONFIG, locationsId=resource_args.RegionAttributeConfig())\nconcept_parsers.ConceptParser.ForResource('--region', region_spec, 'Cloud region', required=True).AddToParser(parser...
<|body_start_0|> region_spec = concepts.ResourceSpec('cloudbuild.projects.locations', resource_name='region', projectsId=concepts.DEFAULT_PROJECT_ATTRIBUTE_CONFIG, locationsId=resource_args.RegionAttributeConfig()) concept_parsers.ConceptParser.ForResource('--region', region_spec, 'Cloud region', requir...
Create a build trigger for a GCB v2 repository.
CreateRepository
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateRepository: """Create a build trigger for a GCB v2 repository.""" def Args(parser): """Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some information, but behaves like an ArgumentParser.""" <|...
stack_v2_sparse_classes_75kplus_train_066116
7,136
permissive
[ { "docstring": "Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some information, but behaves like an ArgumentParser.", "name": "Args", "signature": "def Args(parser)" }, { "docstring": "Parses command line arguments int...
3
stack_v2_sparse_classes_30k_train_019685
Implement the Python class `CreateRepository` described below. Class description: Create a build trigger for a GCB v2 repository. Method signatures and docstrings: - def Args(parser): Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some infor...
Implement the Python class `CreateRepository` described below. Class description: Create a build trigger for a GCB v2 repository. Method signatures and docstrings: - def Args(parser): Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some infor...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class CreateRepository: """Create a build trigger for a GCB v2 repository.""" def Args(parser): """Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some information, but behaves like an ArgumentParser.""" <|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CreateRepository: """Create a build trigger for a GCB v2 repository.""" def Args(parser): """Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some information, but behaves like an ArgumentParser.""" region_spec = c...
the_stack_v2_python_sparse
lib/surface/builds/triggers/create/repository.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
9ecf7215d0d47f2e0981678d11e942073af5549a
[ "self.reqparser = reqparse.RequestParser()\nself.reqparser.add_argument('alert_id', required=True, type=int, help='Alert Id missing', location=['form', 'json'])\nself.reqparser.add_argument('widget_id', required=False, type=int, store_missing=False, location=['form', 'json'])\nself.reqparser.add_argument('activated...
<|body_start_0|> self.reqparser = reqparse.RequestParser() self.reqparser.add_argument('alert_id', required=True, type=int, help='Alert Id missing', location=['form', 'json']) self.reqparser.add_argument('widget_id', required=False, type=int, store_missing=False, location=['form', 'json']) ...
Update an existing alert.
UpdateAlert
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateAlert: """Update an existing alert.""" def __init__(self) -> None: """Instantiate reparse for POST request.""" <|body_0|> def post(self) -> (dict, HTTPStatus): """Update an alert. :return: On success return the updated alert and an HTTP status code 200(OK),...
stack_v2_sparse_classes_75kplus_train_066117
2,703
permissive
[ { "docstring": "Instantiate reparse for POST request.", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Update an alert. :return: On success return the updated alert and an HTTP status code 200(OK), Otherwise return an error with the appropriate HTTP status code"...
2
null
Implement the Python class `UpdateAlert` described below. Class description: Update an existing alert. Method signatures and docstrings: - def __init__(self) -> None: Instantiate reparse for POST request. - def post(self) -> (dict, HTTPStatus): Update an alert. :return: On success return the updated alert and an HTTP...
Implement the Python class `UpdateAlert` described below. Class description: Update an existing alert. Method signatures and docstrings: - def __init__(self) -> None: Instantiate reparse for POST request. - def post(self) -> (dict, HTTPStatus): Update an alert. :return: On success return the updated alert and an HTTP...
5d123691d1f25d0b85e20e4e8293266bf23c9f8a
<|skeleton|> class UpdateAlert: """Update an existing alert.""" def __init__(self) -> None: """Instantiate reparse for POST request.""" <|body_0|> def post(self) -> (dict, HTTPStatus): """Update an alert. :return: On success return the updated alert and an HTTP status code 200(OK),...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UpdateAlert: """Update an existing alert.""" def __init__(self) -> None: """Instantiate reparse for POST request.""" self.reqparser = reqparse.RequestParser() self.reqparser.add_argument('alert_id', required=True, type=int, help='Alert Id missing', location=['form', 'json']) ...
the_stack_v2_python_sparse
Analytics/resources/alerts/update_alert.py
thanosbnt/SharingCitiesDashboard
train
0
929f8c20ce54e89463fe1c564862a947b098f474
[ "self.options = dict()\nfor option in options.split():\n key, value = key_value(option)\n self.options[key] = value\napp_env_key = 'udp_' + pathlib.Path(sys.argv[0]).stem\napp_env_value = os.getenv(app_env_key, '')\nfor option in app_env_value.split():\n key, value = key_value(option)\n self.options[key...
<|body_start_0|> self.options = dict() for option in options.split(): key, value = key_value(option) self.options[key] = value app_env_key = 'udp_' + pathlib.Path(sys.argv[0]).stem app_env_value = os.getenv(app_env_key, '') for option in app_env_value.spli...
Options
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Options: def __init__(self, options=''): """Priority: command line, env vars, optional option.""" <|body_0|> def get(self, key, default=None): """Returns value of option key as a string; if not matched and no default, returns empty string.""" <|body_1|> <|en...
stack_v2_sparse_classes_75kplus_train_066118
30,266
no_license
[ { "docstring": "Priority: command line, env vars, optional option.", "name": "__init__", "signature": "def __init__(self, options='')" }, { "docstring": "Returns value of option key as a string; if not matched and no default, returns empty string.", "name": "get", "signature": "def get(s...
2
null
Implement the Python class `Options` described below. Class description: Implement the Options class. Method signatures and docstrings: - def __init__(self, options=''): Priority: command line, env vars, optional option. - def get(self, key, default=None): Returns value of option key as a string; if not matched and n...
Implement the Python class `Options` described below. Class description: Implement the Options class. Method signatures and docstrings: - def __init__(self, options=''): Priority: command line, env vars, optional option. - def get(self, key, default=None): Returns value of option key as a string; if not matched and n...
64b24de4bb4aa4424c35a0ef6bd9ec0338e3843f
<|skeleton|> class Options: def __init__(self, options=''): """Priority: command line, env vars, optional option.""" <|body_0|> def get(self, key, default=None): """Returns value of option key as a string; if not matched and no default, returns empty string.""" <|body_1|> <|en...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Options: def __init__(self, options=''): """Priority: command line, env vars, optional option.""" self.options = dict() for option in options.split(): key, value = key_value(option) self.options[key] = value app_env_key = 'udp_' + pathlib.Path(sys.argv[0...
the_stack_v2_python_sparse
dev/src/capture.py
jeremybnelson/NymicsRepo
train
0
458fc6d2eb0cefb46faf3f408673f097f7dba671
[ "start = 10\nend = 50\ne1_start = 10\ne1_end = 20\ne2_start = 30\ne2_end = 40\ne3_start = 45\ne3_end = 50\nt = Transcript('t1', 'chr1', start, end, '+', 'gene1', None)\ne1 = Edge('e1', 'chr1', e1_start, e1_end, '+', 'gene1', 't1', None)\ne2 = Edge('e2', 'chr1', e2_start, e2_end, '+', 'gene1', 't1', None)\ne3 = Edge...
<|body_start_0|> start = 10 end = 50 e1_start = 10 e1_end = 20 e2_start = 30 e2_end = 40 e3_start = 45 e3_end = 50 t = Transcript('t1', 'chr1', start, end, '+', 'gene1', None) e1 = Edge('e1', 'chr1', e1_start, e1_end, '+', 'gene1', 't1', No...
TestAddEdgeToTranscript
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAddEdgeToTranscript: def test1(self): """Task: Add three exons to the transcript that belong in the following order: e1, e2, e3 (10,20) (30,40) (45,50) In this version of the test, we attempt to add them in order e1, e2, e3""" <|body_0|> def test2(self): """Task:...
stack_v2_sparse_classes_75kplus_train_066119
2,883
permissive
[ { "docstring": "Task: Add three exons to the transcript that belong in the following order: e1, e2, e3 (10,20) (30,40) (45,50) In this version of the test, we attempt to add them in order e1, e2, e3", "name": "test1", "signature": "def test1(self)" }, { "docstring": "Task: Add three exons to the...
3
null
Implement the Python class `TestAddEdgeToTranscript` described below. Class description: Implement the TestAddEdgeToTranscript class. Method signatures and docstrings: - def test1(self): Task: Add three exons to the transcript that belong in the following order: e1, e2, e3 (10,20) (30,40) (45,50) In this version of t...
Implement the Python class `TestAddEdgeToTranscript` described below. Class description: Implement the TestAddEdgeToTranscript class. Method signatures and docstrings: - def test1(self): Task: Add three exons to the transcript that belong in the following order: e1, e2, e3 (10,20) (30,40) (45,50) In this version of t...
8014faed5f982e5e106ec05239e47d65878e76c3
<|skeleton|> class TestAddEdgeToTranscript: def test1(self): """Task: Add three exons to the transcript that belong in the following order: e1, e2, e3 (10,20) (30,40) (45,50) In this version of the test, we attempt to add them in order e1, e2, e3""" <|body_0|> def test2(self): """Task:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestAddEdgeToTranscript: def test1(self): """Task: Add three exons to the transcript that belong in the following order: e1, e2, e3 (10,20) (30,40) (45,50) In this version of the test, we attempt to add them in order e1, e2, e3""" start = 10 end = 50 e1_start = 10 e1_en...
the_stack_v2_python_sparse
archived/talon_3.0down_testing_suite/test_add_exon_to_transcript.py
kopardev/TALON
train
0
7155e05e73315f1bf994f74ab327938287a38a3f
[ "if kwargs.has_key('solr_server'):\n self.solr_server = kwargs.get('solr_server')\nelse:\n self.solr_server = 'http://0.0.0.0:8983/solr'\nif kwargs.has_key('query'):\n self.query = kwargs.get('query')\nelse:\n self.query = None\nif kwargs.has_key('cache'):\n self.cache_location = kwargs.get('cache')\...
<|body_start_0|> if kwargs.has_key('solr_server'): self.solr_server = kwargs.get('solr_server') else: self.solr_server = 'http://0.0.0.0:8983/solr' if kwargs.has_key('query'): self.query = kwargs.get('query') else: self.query = None ...
`SolrBot` is the base bot for connecting to Solr server and retrieving and evaluating the results to a native Python object.
SolrBot
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SolrBot: """`SolrBot` is the base bot for connecting to Solr server and retrieving and evaluating the results to a native Python object.""" def __init__(self, **kwargs): """`SolrBot` initializes an instance of a bot Parameters: `solr_server`: URL to Solr server, defaults to http://0....
stack_v2_sparse_classes_75kplus_train_066120
4,213
permissive
[ { "docstring": "`SolrBot` initializes an instance of a bot Parameters: `solr_server`: URL to Solr server, defaults to http://0.0.0.0:8983/solr `query`: Solr query, optional `cache`: Solr cache location, optional", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": ...
3
null
Implement the Python class `SolrBot` described below. Class description: `SolrBot` is the base bot for connecting to Solr server and retrieving and evaluating the results to a native Python object. Method signatures and docstrings: - def __init__(self, **kwargs): `SolrBot` initializes an instance of a bot Parameters:...
Implement the Python class `SolrBot` described below. Class description: `SolrBot` is the base bot for connecting to Solr server and retrieving and evaluating the results to a native Python object. Method signatures and docstrings: - def __init__(self, **kwargs): `SolrBot` initializes an instance of a bot Parameters:...
b5c44fa008f9afb4441988803921a93ffd615c30
<|skeleton|> class SolrBot: """`SolrBot` is the base bot for connecting to Solr server and retrieving and evaluating the results to a native Python object.""" def __init__(self, **kwargs): """`SolrBot` initializes an instance of a bot Parameters: `solr_server`: URL to Solr server, defaults to http://0....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SolrBot: """`SolrBot` is the base bot for connecting to Solr server and retrieving and evaluating the results to a native Python object.""" def __init__(self, **kwargs): """`SolrBot` initializes an instance of a bot Parameters: `solr_server`: URL to Solr server, defaults to http://0.0.0.0:8983/so...
the_stack_v2_python_sparse
aristotle/apps/grx/bots/solrbots.py
jermnelson/Discover-Aristotle
train
15
82376ac0d97b16566ff93a5466100c4479a7da77
[ "clients = cls.fetch_all_clients()\nfor client in clients:\n Client.update_or_create({'clockify_id': client['clockify_id']}, {'name': client['name']})\nreturn clients", "url = '{}/workspaces/{}/clients'.format(V1_API_URL, WORKSPACE_ID)\nresponses = requests.get(url, headers=HEADERS)\nreturn [{'clockify_id': cl...
<|body_start_0|> clients = cls.fetch_all_clients() for client in clients: Client.update_or_create({'clockify_id': client['clockify_id']}, {'name': client['name']}) return clients <|end_body_0|> <|body_start_1|> url = '{}/workspaces/{}/clients'.format(V1_API_URL, WORKSPACE_ID...
Client
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Client: def save_from_clockify(cls): """Check if all clients in clockify are register as clients in the database. Create a new client if necessary.""" <|body_0|> def fetch_all_clients(archived=None): """Find all clients from Clockify on NEO's workspace. Returns list ...
stack_v2_sparse_classes_75kplus_train_066121
1,492
no_license
[ { "docstring": "Check if all clients in clockify are register as clients in the database. Create a new client if necessary.", "name": "save_from_clockify", "signature": "def save_from_clockify(cls)" }, { "docstring": "Find all clients from Clockify on NEO's workspace. Returns list of dictionarie...
3
null
Implement the Python class `Client` described below. Class description: Implement the Client class. Method signatures and docstrings: - def save_from_clockify(cls): Check if all clients in clockify are register as clients in the database. Create a new client if necessary. - def fetch_all_clients(archived=None): Find ...
Implement the Python class `Client` described below. Class description: Implement the Client class. Method signatures and docstrings: - def save_from_clockify(cls): Check if all clients in clockify are register as clients in the database. Create a new client if necessary. - def fetch_all_clients(archived=None): Find ...
739cf6fcc62b1e0bb84bef25c3dd3dc23a0a7066
<|skeleton|> class Client: def save_from_clockify(cls): """Check if all clients in clockify are register as clients in the database. Create a new client if necessary.""" <|body_0|> def fetch_all_clients(archived=None): """Find all clients from Clockify on NEO's workspace. Returns list ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Client: def save_from_clockify(cls): """Check if all clients in clockify are register as clients in the database. Create a new client if necessary.""" clients = cls.fetch_all_clients() for client in clients: Client.update_or_create({'clockify_id': client['clockify_id']}, {'...
the_stack_v2_python_sparse
models/client.py
neo-empresarial/clockify-integration
train
4
286c1d1ca2ceee3f818564b1e7012d36cb15677a
[ "dummy = ListNode(-1)\ndummy.next = head\ncurrent = dummy\nwhile current.next and current.next.next:\n next_1, next_2, next_3 = (current.next, current.next.next, current.next.next.next)\n current.next = next_2\n next_2.next = next_1\n next_1.next = next_3\n current = next_1\nreturn dummy.next", "du...
<|body_start_0|> dummy = ListNode(-1) dummy.next = head current = dummy while current.next and current.next.next: next_1, next_2, next_3 = (current.next, current.next.next, current.next.next.next) current.next = next_2 next_2.next = next_1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def swapPairs(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def swapPairs_v2(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> def swapPairs_illegal(self, head): """:type head: ListNode :rtype: Li...
stack_v2_sparse_classes_75kplus_train_066122
2,388
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "swapPairs", "signature": "def swapPairs(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "swapPairs_v2", "signature": "def swapPairs_v2(self, head)" }, { "docstring": ":type head: List...
3
stack_v2_sparse_classes_30k_train_012763
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def swapPairs(self, head): :type head: ListNode :rtype: ListNode - def swapPairs_v2(self, head): :type head: ListNode :rtype: ListNode - def swapPairs_illegal(self, head): :type ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def swapPairs(self, head): :type head: ListNode :rtype: ListNode - def swapPairs_v2(self, head): :type head: ListNode :rtype: ListNode - def swapPairs_illegal(self, head): :type ...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def swapPairs(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def swapPairs_v2(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> def swapPairs_illegal(self, head): """:type head: ListNode :rtype: Li...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def swapPairs(self, head): """:type head: ListNode :rtype: ListNode""" dummy = ListNode(-1) dummy.next = head current = dummy while current.next and current.next.next: next_1, next_2, next_3 = (current.next, current.next.next, current.next.next.nex...
the_stack_v2_python_sparse
src/lt_24.py
oxhead/CodingYourWay
train
0
848bdea728b98ab322402d9ca52f3c750b936002
[ "self.parameters = {'encoding': 'utf-8', 'text': True}\nself.stdout = None\nself.stderr = None\nself.returncode = None", "from subprocess import DEVNULL, PIPE, Popen, STDOUT\n\ndef comunicate(parameters):\n popen = Popen(**parameters)\n stdout, stderr = popen.communicate()\n return (popen, stdout, stderr...
<|body_start_0|> self.parameters = {'encoding': 'utf-8', 'text': True} self.stdout = None self.stderr = None self.returncode = None <|end_body_0|> <|body_start_1|> from subprocess import DEVNULL, PIPE, Popen, STDOUT def comunicate(parameters): popen = Popen(...
A helper class for executing a command line process.
Process
[ "MIT", "GPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Process: """A helper class for executing a command line process.""" def __init__(self) -> None: """Initialize a Process instance.""" <|body_0|> def execute(cls, args: list[str], shell: bool=False, capture_output: bool=True, split: bool=True, outpath: str=None) -> Process...
stack_v2_sparse_classes_75kplus_train_066123
2,615
permissive
[ { "docstring": "Initialize a Process instance.", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Execute a command line process. Args: args (list[str]): The command line arguments to execute. shell (bool, optional): If True, execute the command line using the she...
2
stack_v2_sparse_classes_30k_train_016976
Implement the Python class `Process` described below. Class description: A helper class for executing a command line process. Method signatures and docstrings: - def __init__(self) -> None: Initialize a Process instance. - def execute(cls, args: list[str], shell: bool=False, capture_output: bool=True, split: bool=Tru...
Implement the Python class `Process` described below. Class description: A helper class for executing a command line process. Method signatures and docstrings: - def __init__(self) -> None: Initialize a Process instance. - def execute(cls, args: list[str], shell: bool=False, capture_output: bool=True, split: bool=Tru...
00e14fc190ebff66cf50ff911f25cf5ad3529f8f
<|skeleton|> class Process: """A helper class for executing a command line process.""" def __init__(self) -> None: """Initialize a Process instance.""" <|body_0|> def execute(cls, args: list[str], shell: bool=False, capture_output: bool=True, split: bool=True, outpath: str=None) -> Process...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Process: """A helper class for executing a command line process.""" def __init__(self) -> None: """Initialize a Process instance.""" self.parameters = {'encoding': 'utf-8', 'text': True} self.stdout = None self.stderr = None self.returncode = None def execute(...
the_stack_v2_python_sparse
scripts/addon_library/local/ImagePaste/imagepaste/process.py
Tilapiatsu/blender-custom_config
train
6
acbe2a1e5d3c6f9afdb1bd71a23e3a215b175a16
[ "l = [0] * 26\nfor c in tasks:\n l[ord(c) - ord('A')] += 1\nl.sort()\ntime = 0\nwhile l[25] > 0:\n i = 0\n while i <= n:\n if l[25] == 0:\n break\n if i < 26 and l[25 - i] > 0:\n l[25 - i] -= 1\n time += 1\n i += 1\n l.sort()\nreturn time", "task_count...
<|body_start_0|> l = [0] * 26 for c in tasks: l[ord(c) - ord('A')] += 1 l.sort() time = 0 while l[25] > 0: i = 0 while i <= n: if l[25] == 0: break if i < 26 and l[25 - i] > 0: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def leastInterval(self, tasks, n): """:type tasks: List[str] :type n: int :rtype: int""" <|body_0|> def leasetInterval2(self, tasks, n): """from submission :param tasks: :param n: :return:""" <|body_1|> def leasetInterval3(self, tasks, n): ...
stack_v2_sparse_classes_75kplus_train_066124
1,562
no_license
[ { "docstring": ":type tasks: List[str] :type n: int :rtype: int", "name": "leastInterval", "signature": "def leastInterval(self, tasks, n)" }, { "docstring": "from submission :param tasks: :param n: :return:", "name": "leasetInterval2", "signature": "def leasetInterval2(self, tasks, n)" ...
3
stack_v2_sparse_classes_30k_train_046640
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def leastInterval(self, tasks, n): :type tasks: List[str] :type n: int :rtype: int - def leasetInterval2(self, tasks, n): from submission :param tasks: :param n: :return: - def l...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def leastInterval(self, tasks, n): :type tasks: List[str] :type n: int :rtype: int - def leasetInterval2(self, tasks, n): from submission :param tasks: :param n: :return: - def l...
2526f8c0dec7101123123740e146ee4081e979ee
<|skeleton|> class Solution: def leastInterval(self, tasks, n): """:type tasks: List[str] :type n: int :rtype: int""" <|body_0|> def leasetInterval2(self, tasks, n): """from submission :param tasks: :param n: :return:""" <|body_1|> def leasetInterval3(self, tasks, n): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def leastInterval(self, tasks, n): """:type tasks: List[str] :type n: int :rtype: int""" l = [0] * 26 for c in tasks: l[ord(c) - ord('A')] += 1 l.sort() time = 0 while l[25] > 0: i = 0 while i <= n: i...
the_stack_v2_python_sparse
621. Task Scheduler.py
zhangpengGenedock/leetcode_python
train
1
8c8238b8bab8f285a02a2c26dcdf8fce399d5ebd
[ "environment = SandboxEnvironment(client_id=PAYPAL_CLIENT_ID, client_secret=PAYPAL_CLIENT_SECRET)\nself.client = PayPalHttpClient(environment)\nself.process_notification = {PayPalStrings.WEBHOOK_APPROVED.value: self.capture, PayPalStrings.WEBHOOK_COMPLETED.value: self.fulfill}", "capture_id = wh_data['resource'][...
<|body_start_0|> environment = SandboxEnvironment(client_id=PAYPAL_CLIENT_ID, client_secret=PAYPAL_CLIENT_SECRET) self.client = PayPalHttpClient(environment) self.process_notification = {PayPalStrings.WEBHOOK_APPROVED.value: self.capture, PayPalStrings.WEBHOOK_COMPLETED.value: self.fulfill} <|en...
Клиент платёжной системы PayPal. Содержит методы для инициализации сессии и обработки платежей в виде PayPal Checkout - выписки, захвата, верификации и завершения Checkout.
PaypalClient
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PaypalClient: """Клиент платёжной системы PayPal. Содержит методы для инициализации сессии и обработки платежей в виде PayPal Checkout - выписки, захвата, верификации и завершения Checkout.""" def __init__(self) -> None: """Инициализирует сессию работы с системой PayPal.""" <...
stack_v2_sparse_classes_75kplus_train_066125
8,853
no_license
[ { "docstring": "Инициализирует сессию работы с системой PayPal.", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Завершает заказ, уведомляет клиента.", "name": "fulfill", "signature": "def fulfill(self, wh_data: Dict[str, Any]) -> None" }, { "doc...
6
stack_v2_sparse_classes_30k_train_051202
Implement the Python class `PaypalClient` described below. Class description: Клиент платёжной системы PayPal. Содержит методы для инициализации сессии и обработки платежей в виде PayPal Checkout - выписки, захвата, верификации и завершения Checkout. Method signatures and docstrings: - def __init__(self) -> None: Ини...
Implement the Python class `PaypalClient` described below. Class description: Клиент платёжной системы PayPal. Содержит методы для инициализации сессии и обработки платежей в виде PayPal Checkout - выписки, захвата, верификации и завершения Checkout. Method signatures and docstrings: - def __init__(self) -> None: Ини...
015adcc4e138cdcc6163c0f7cb8a5fd6abe43266
<|skeleton|> class PaypalClient: """Клиент платёжной системы PayPal. Содержит методы для инициализации сессии и обработки платежей в виде PayPal Checkout - выписки, захвата, верификации и завершения Checkout.""" def __init__(self) -> None: """Инициализирует сессию работы с системой PayPal.""" <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PaypalClient: """Клиент платёжной системы PayPal. Содержит методы для инициализации сессии и обработки платежей в виде PayPal Checkout - выписки, захвата, верификации и завершения Checkout.""" def __init__(self) -> None: """Инициализирует сессию работы с системой PayPal.""" environment = ...
the_stack_v2_python_sparse
billing/paypal/client.py
half-cat/gu-chatbot-01
train
0
4f7f29a5462632656f04f8baa03e1e0f7085c275
[ "if not isinstance(data, np.ndarray):\n raise TypeError('data must be a 2D numpy.ndarray')\nif len(data.shape) != 2:\n raise TypeError('data must be a 2D numpy.ndarray')\nif data.shape[1] < 2:\n raise ValueError('data must contain multiple data points')\nd, n = data.shape\nself.mean = np.mean(data, axis=1,...
<|body_start_0|> if not isinstance(data, np.ndarray): raise TypeError('data must be a 2D numpy.ndarray') if len(data.shape) != 2: raise TypeError('data must be a 2D numpy.ndarray') if data.shape[1] < 2: raise ValueError('data must contain multiple data points'...
multiNormal
MultiNormal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiNormal: """multiNormal""" def __init__(self, data): """Multivariate Normal distribution Set the public instance""" <|body_0|> def pdf(self, x): """calculates the PDF at a data point""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not isi...
stack_v2_sparse_classes_75kplus_train_066126
1,419
no_license
[ { "docstring": "Multivariate Normal distribution Set the public instance", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "calculates the PDF at a data point", "name": "pdf", "signature": "def pdf(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_041218
Implement the Python class `MultiNormal` described below. Class description: multiNormal Method signatures and docstrings: - def __init__(self, data): Multivariate Normal distribution Set the public instance - def pdf(self, x): calculates the PDF at a data point
Implement the Python class `MultiNormal` described below. Class description: multiNormal Method signatures and docstrings: - def __init__(self, data): Multivariate Normal distribution Set the public instance - def pdf(self, x): calculates the PDF at a data point <|skeleton|> class MultiNormal: """multiNormal""" ...
7dafc37d306fcf2ea0f5af5bd97dfd78d388100c
<|skeleton|> class MultiNormal: """multiNormal""" def __init__(self, data): """Multivariate Normal distribution Set the public instance""" <|body_0|> def pdf(self, x): """calculates the PDF at a data point""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultiNormal: """multiNormal""" def __init__(self, data): """Multivariate Normal distribution Set the public instance""" if not isinstance(data, np.ndarray): raise TypeError('data must be a 2D numpy.ndarray') if len(data.shape) != 2: raise TypeError('data mu...
the_stack_v2_python_sparse
math/0x06-multivariate_prob/multinormal.py
AndresSern/holbertonschool-machine_learning-1
train
0
7ab7303db9ca1d69ac18f3c0a73adc5e4c7f21ba
[ "labels_queryset = NodeLabel.objects.filter(project_id=project_id)\nif cluster_id != node_constants.PROJECT_ALL_CLUSTER:\n labels_queryset = labels_queryset.filter(cluster_id=cluster_id)\nreturn labels_queryset", "data = set([])\nfor info in labels_queryset:\n labels = info.node_labels\n if not key_name:...
<|body_start_0|> labels_queryset = NodeLabel.objects.filter(project_id=project_id) if cluster_id != node_constants.PROJECT_ALL_CLUSTER: labels_queryset = labels_queryset.filter(cluster_id=cluster_id) return labels_queryset <|end_body_0|> <|body_start_1|> data = set([]) ...
QueryNodeLabelKeys
[ "BSD-3-Clause", "LicenseRef-scancode-unicode", "ICU", "LicenseRef-scancode-unknown-license-reference", "Artistic-2.0", "Zlib", "LicenseRef-scancode-openssl", "NAIST-2003", "ISC", "NTP", "BSL-1.0", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QueryNodeLabelKeys: def get_queryset(self, project_id, cluster_id): """filter the labels record""" <|body_0|> def compose_data(self, labels_queryset, key_name=None): """compose the label keys or values""" <|body_1|> def label_keys(self, request, project_...
stack_v2_sparse_classes_75kplus_train_066127
2,901
permissive
[ { "docstring": "filter the labels record", "name": "get_queryset", "signature": "def get_queryset(self, project_id, cluster_id)" }, { "docstring": "compose the label keys or values", "name": "compose_data", "signature": "def compose_data(self, labels_queryset, key_name=None)" }, { ...
4
stack_v2_sparse_classes_30k_train_025543
Implement the Python class `QueryNodeLabelKeys` described below. Class description: Implement the QueryNodeLabelKeys class. Method signatures and docstrings: - def get_queryset(self, project_id, cluster_id): filter the labels record - def compose_data(self, labels_queryset, key_name=None): compose the label keys or v...
Implement the Python class `QueryNodeLabelKeys` described below. Class description: Implement the QueryNodeLabelKeys class. Method signatures and docstrings: - def get_queryset(self, project_id, cluster_id): filter the labels record - def compose_data(self, labels_queryset, key_name=None): compose the label keys or v...
96373cda9d87038aceb0b4858ce89e7873c8e149
<|skeleton|> class QueryNodeLabelKeys: def get_queryset(self, project_id, cluster_id): """filter the labels record""" <|body_0|> def compose_data(self, labels_queryset, key_name=None): """compose the label keys or values""" <|body_1|> def label_keys(self, request, project_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QueryNodeLabelKeys: def get_queryset(self, project_id, cluster_id): """filter the labels record""" labels_queryset = NodeLabel.objects.filter(project_id=project_id) if cluster_id != node_constants.PROJECT_ALL_CLUSTER: labels_queryset = labels_queryset.filter(cluster_id=clus...
the_stack_v2_python_sparse
bcs-app/backend/apps/cluster/views/node_views/query_apis.py
freyzheng/bk-bcs-saas
train
0
299d79229cd592ff51bf999ca53b85427bd47cd0
[ "if len(nums) < 1:\n return False\nk = max(nums)\ntemp = [0] * (k + 1)\nfor i in nums:\n temp[i] += 1\nfor i in range(len(temp)):\n if temp[i] >= 2:\n return True\nreturn False", "if len(nums) < 1:\n return False\nif len(nums) != len(set(nums)):\n return True\nreturn False", "if len(nums) ...
<|body_start_0|> if len(nums) < 1: return False k = max(nums) temp = [0] * (k + 1) for i in nums: temp[i] += 1 for i in range(len(temp)): if temp[i] >= 2: return True return False <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def containsDuplicate(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def containsDuplicate2(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> def containsDuplicate2(self, nums): """:type nums: List[int] ...
stack_v2_sparse_classes_75kplus_train_066128
1,683
no_license
[ { "docstring": ":type nums: List[int] :rtype: bool", "name": "containsDuplicate", "signature": "def containsDuplicate(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: bool", "name": "containsDuplicate2", "signature": "def containsDuplicate2(self, nums)" }, { "docstri...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsDuplicate(self, nums): :type nums: List[int] :rtype: bool - def containsDuplicate2(self, nums): :type nums: List[int] :rtype: bool - def containsDuplicate2(self, nums...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsDuplicate(self, nums): :type nums: List[int] :rtype: bool - def containsDuplicate2(self, nums): :type nums: List[int] :rtype: bool - def containsDuplicate2(self, nums...
f022677c042db3598003df1a320a70f0edc4f870
<|skeleton|> class Solution: def containsDuplicate(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def containsDuplicate2(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> def containsDuplicate2(self, nums): """:type nums: List[int] ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def containsDuplicate(self, nums): """:type nums: List[int] :rtype: bool""" if len(nums) < 1: return False k = max(nums) temp = [0] * (k + 1) for i in nums: temp[i] += 1 for i in range(len(temp)): if temp[i] >= 2: ...
the_stack_v2_python_sparse
ArrayDeal/cunzaichongfuyuansu.py
daisyzl/program-exercise-python
train
0
45a9f1755ed081ec4907951950e90ef818be4af4
[ "if n < 2:\n return False\nelse:\n for d in range(2, int(sqrt(n)) + 1):\n if n % d == 0:\n return False\n return True", "if n <= 0:\n raise ValueError('n must be positive integer')\nelif n == 1:\n return 2\nelse:\n count = 1\n candidate = 1\n while count < n:\n can...
<|body_start_0|> if n < 2: return False else: for d in range(2, int(sqrt(n)) + 1): if n % d == 0: return False return True <|end_body_0|> <|body_start_1|> if n <= 0: raise ValueError('n must be positive integer'...
generator of prime numbers
Prime
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Prime: """generator of prime numbers""" def is_prime(n): """check if input "n" is prime number or not""" <|body_0|> def get_nth_prime(n): """find and return the nth prime number""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n < 2: ...
stack_v2_sparse_classes_75kplus_train_066129
1,019
no_license
[ { "docstring": "check if input \"n\" is prime number or not", "name": "is_prime", "signature": "def is_prime(n)" }, { "docstring": "find and return the nth prime number", "name": "get_nth_prime", "signature": "def get_nth_prime(n)" } ]
2
null
Implement the Python class `Prime` described below. Class description: generator of prime numbers Method signatures and docstrings: - def is_prime(n): check if input "n" is prime number or not - def get_nth_prime(n): find and return the nth prime number
Implement the Python class `Prime` described below. Class description: generator of prime numbers Method signatures and docstrings: - def is_prime(n): check if input "n" is prime number or not - def get_nth_prime(n): find and return the nth prime number <|skeleton|> class Prime: """generator of prime numbers""" ...
1e93dac2273d217577eda80c015eb3e735693f18
<|skeleton|> class Prime: """generator of prime numbers""" def is_prime(n): """check if input "n" is prime number or not""" <|body_0|> def get_nth_prime(n): """find and return the nth prime number""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Prime: """generator of prime numbers""" def is_prime(n): """check if input "n" is prime number or not""" if n < 2: return False else: for d in range(2, int(sqrt(n)) + 1): if n % d == 0: return False return Tru...
the_stack_v2_python_sparse
src/introduction_to_computer_science_and_programming/assn01/ps1a.py
LeqiaoP1/PythonBeginner
train
0
320f4209ab6cdf67b06a13fc214539a90cf2075f
[ "protocol, location = self.split(url)\nif protocol == self.protocol:\n return self.find(location)\nelse:\n return None", "try:\n content = self.store[location]\n return StringIO(content)\nexcept:\n reason = 'location \"%s\" not in document store' % location\n raise Exception(reason)", "parts =...
<|body_start_0|> protocol, location = self.split(url) if protocol == self.protocol: return self.find(location) else: return None <|end_body_0|> <|body_start_1|> try: content = self.store[location] return StringIO(content) except: ...
The I{suds} document store provides a local repository for xml documnts. @cvar protocol: The URL protocol for the store. @type protocol: str @cvar store: The mapping of URL location to documents. @type store: dict
DocumentStore
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DocumentStore: """The I{suds} document store provides a local repository for xml documnts. @cvar protocol: The URL protocol for the store. @type protocol: str @cvar store: The mapping of URL location to documents. @type store: dict""" def open(self, url): """Open a document at the sp...
stack_v2_sparse_classes_75kplus_train_066130
18,337
permissive
[ { "docstring": "Open a document at the specified url. @param url: A document URL. @type url: str @return: A file pointer to the document. @rtype: StringIO", "name": "open", "signature": "def open(self, url)" }, { "docstring": "Find the specified location in the store. @param location: The I{loca...
3
stack_v2_sparse_classes_30k_train_037015
Implement the Python class `DocumentStore` described below. Class description: The I{suds} document store provides a local repository for xml documnts. @cvar protocol: The URL protocol for the store. @type protocol: str @cvar store: The mapping of URL location to documents. @type store: dict Method signatures and doc...
Implement the Python class `DocumentStore` described below. Class description: The I{suds} document store provides a local repository for xml documnts. @cvar protocol: The URL protocol for the store. @type protocol: str @cvar store: The mapping of URL location to documents. @type store: dict Method signatures and doc...
7d8843fcdfe179f018af2038f813795f7182b714
<|skeleton|> class DocumentStore: """The I{suds} document store provides a local repository for xml documnts. @cvar protocol: The URL protocol for the store. @type protocol: str @cvar store: The mapping of URL location to documents. @type store: dict""" def open(self, url): """Open a document at the sp...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DocumentStore: """The I{suds} document store provides a local repository for xml documnts. @cvar protocol: The URL protocol for the store. @type protocol: str @cvar store: The mapping of URL location to documents. @type store: dict""" def open(self, url): """Open a document at the specified url. ...
the_stack_v2_python_sparse
suds/store.py
CybernetiX-S3C/interactive-tutorials
train
1
b34cd735cd2b4c1ff9ab0091f79aa1f659cb044e
[ "super().__init__()\nself.status_bar = self.statusBar()\nmain_frame = MainFrame(self.status_bar, smbedit)\nself.setCentralWidget(main_frame)\nself.menu_bar = MenuBar(self, main_frame, smbedit)\nself.setGeometry(150, 150, 550, 500)\nself.status_bar.showMessage('Ready')", "percent = ('{0:.' + str(decimals) + 'f}')....
<|body_start_0|> super().__init__() self.status_bar = self.statusBar() main_frame = MainFrame(self.status_bar, smbedit) self.setCentralWidget(main_frame) self.menu_bar = MenuBar(self, main_frame, smbedit) self.setGeometry(150, 150, 550, 500) self.status_bar.showMe...
Window
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Window: def __init__(self, smbedit): """@type smbedit: SMBEditGUI""" <|body_0|> def print_progress_bar(self, iteration, total, prefix='', suffix='', decimals=1, length=20, fill='X'): """Original: https://stackoverflow.com/questions/3173320/text-progress-bar-in-the-co...
stack_v2_sparse_classes_75kplus_train_066131
1,829
no_license
[ { "docstring": "@type smbedit: SMBEditGUI", "name": "__init__", "signature": "def __init__(self, smbedit)" }, { "docstring": "Original: https://stackoverflow.com/questions/3173320/text-progress-bar-in-the-console Call in a loop to create terminal progress bar @params: iteration - Required : curr...
2
stack_v2_sparse_classes_30k_train_046746
Implement the Python class `Window` described below. Class description: Implement the Window class. Method signatures and docstrings: - def __init__(self, smbedit): @type smbedit: SMBEditGUI - def print_progress_bar(self, iteration, total, prefix='', suffix='', decimals=1, length=20, fill='X'): Original: https://stac...
Implement the Python class `Window` described below. Class description: Implement the Window class. Method signatures and docstrings: - def __init__(self, smbedit): @type smbedit: SMBEditGUI - def print_progress_bar(self, iteration, total, prefix='', suffix='', decimals=1, length=20, fill='X'): Original: https://stac...
12fe1b39513cf0d1ca8edd9adb6c11269c58fbb5
<|skeleton|> class Window: def __init__(self, smbedit): """@type smbedit: SMBEditGUI""" <|body_0|> def print_progress_bar(self, iteration, total, prefix='', suffix='', decimals=1, length=20, fill='X'): """Original: https://stackoverflow.com/questions/3173320/text-progress-bar-in-the-co...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Window: def __init__(self, smbedit): """@type smbedit: SMBEditGUI""" super().__init__() self.status_bar = self.statusBar() main_frame = MainFrame(self.status_bar, smbedit) self.setCentralWidget(main_frame) self.menu_bar = MenuBar(self, main_frame, smbedit) ...
the_stack_v2_python_sparse
smlib/gui/window.py
p-hofmann/SMBEdit
train
6
fd6fa49d49e33477589e8e0c933ffc3972c52073
[ "i = 0\ndigits = ''\nret = NestedInteger()\nwhile i < len(s):\n if '0' <= s[i] <= '9' or s[i] == '-':\n digits += s[i]\n else:\n if digits:\n num = int(digits)\n buf = NestedInteger(num)\n ret.add(buf)\n if s[i] == '[':\n start = i\n ...
<|body_start_0|> i = 0 digits = '' ret = NestedInteger() while i < len(s): if '0' <= s[i] <= '9' or s[i] == '-': digits += s[i] else: if digits: num = int(digits) buf = NestedInteger(num) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def buff(self, s): """# using DFS # find all single integers # as for the list in it , call self to manage :type s: str :rtype: NestedInteger""" <|body_0|> def deserialize(self, s): """:type s: str :rtype: NestedInteger""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_75kplus_train_066132
2,855
no_license
[ { "docstring": "# using DFS # find all single integers # as for the list in it , call self to manage :type s: str :rtype: NestedInteger", "name": "buff", "signature": "def buff(self, s)" }, { "docstring": ":type s: str :rtype: NestedInteger", "name": "deserialize", "signature": "def dese...
2
stack_v2_sparse_classes_30k_train_001111
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def buff(self, s): # using DFS # find all single integers # as for the list in it , call self to manage :type s: str :rtype: NestedInteger - def deserialize(self, s): :type s: st...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def buff(self, s): # using DFS # find all single integers # as for the list in it , call self to manage :type s: str :rtype: NestedInteger - def deserialize(self, s): :type s: st...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def buff(self, s): """# using DFS # find all single integers # as for the list in it , call self to manage :type s: str :rtype: NestedInteger""" <|body_0|> def deserialize(self, s): """:type s: str :rtype: NestedInteger""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def buff(self, s): """# using DFS # find all single integers # as for the list in it , call self to manage :type s: str :rtype: NestedInteger""" i = 0 digits = '' ret = NestedInteger() while i < len(s): if '0' <= s[i] <= '9' or s[i] == '-': ...
the_stack_v2_python_sparse
python/leetcode/385_Mini_Parser.py
bobcaoge/my-code
train
0
7e0a334559fcbd6c07f546ffff12e6b77351f6b3
[ "order_by = self.request.GET.get('order_by', '-upload_date')\nif self.kwargs['action'] == 'last':\n pictures = Picture.objects.all().order_by(order_by)\nelif self.kwargs['action'] == 'user':\n if 'pk' in self.kwargs:\n user = get_user_model()\n pictures = Picture.objects.filter(user=user.objects...
<|body_start_0|> order_by = self.request.GET.get('order_by', '-upload_date') if self.kwargs['action'] == 'last': pictures = Picture.objects.all().order_by(order_by) elif self.kwargs['action'] == 'user': if 'pk' in self.kwargs: user = get_user_model() ...
Display list pictures. **Context** 'pictures', get by Picture.objects.filter, **Template:** 'gallery/full_gallery.html' **parameter action:** - 'last': last pictures - 'user': user pictures - 'category' : pictures of one category
GalleryListView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GalleryListView: """Display list pictures. **Context** 'pictures', get by Picture.objects.filter, **Template:** 'gallery/full_gallery.html' **parameter action:** - 'last': last pictures - 'user': user pictures - 'category' : pictures of one category""" def get_queryset(self): """retu...
stack_v2_sparse_classes_75kplus_train_066133
5,747
no_license
[ { "docstring": "return pictures, Depends on the action parameter", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "add title in global context.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_040449
Implement the Python class `GalleryListView` described below. Class description: Display list pictures. **Context** 'pictures', get by Picture.objects.filter, **Template:** 'gallery/full_gallery.html' **parameter action:** - 'last': last pictures - 'user': user pictures - 'category' : pictures of one category Method ...
Implement the Python class `GalleryListView` described below. Class description: Display list pictures. **Context** 'pictures', get by Picture.objects.filter, **Template:** 'gallery/full_gallery.html' **parameter action:** - 'last': last pictures - 'user': user pictures - 'category' : pictures of one category Method ...
edbc4397f301102f136dba68b45a56a3f60cac7b
<|skeleton|> class GalleryListView: """Display list pictures. **Context** 'pictures', get by Picture.objects.filter, **Template:** 'gallery/full_gallery.html' **parameter action:** - 'last': last pictures - 'user': user pictures - 'category' : pictures of one category""" def get_queryset(self): """retu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GalleryListView: """Display list pictures. **Context** 'pictures', get by Picture.objects.filter, **Template:** 'gallery/full_gallery.html' **parameter action:** - 'last': last pictures - 'user': user pictures - 'category' : pictures of one category""" def get_queryset(self): """return pictures, ...
the_stack_v2_python_sparse
gallery/views.py
lemarak/OC_Photosite
train
1
4d1697041006bdd3b9ab72e0177d698dbc96e84e
[ "logging.info('Start sample output')\nif (title := articles.get('title', None)) is not None:\n self._print_title(title, colorize=kwargs.get('colorize', False))\nfor article in articles['articles']:\n self._print_article(article, colorize=kwargs.get('colorize', False))", "if kwargs.get('colorize', False):\n ...
<|body_start_0|> logging.info('Start sample output') if (title := articles.get('title', None)) is not None: self._print_title(title, colorize=kwargs.get('colorize', False)) for article in articles['articles']: self._print_article(article, colorize=kwargs.get('colorize', F...
Class controller for sample output in standard out.
SamplePrintController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SamplePrintController: """Class controller for sample output in standard out.""" def print_to(self, articles, **kwargs): """Procedure for sample output of news articles. :param articles: dict with title and list of news articles :param kwargs: optional params. Use to extend a count g...
stack_v2_sparse_classes_75kplus_train_066134
14,360
no_license
[ { "docstring": "Procedure for sample output of news articles. :param articles: dict with title and list of news articles :param kwargs: optional params. Use to extend a count given params in base method colorize: bool - print the result of the utility in colorized mode :type articles: dict", "name": "print_...
3
null
Implement the Python class `SamplePrintController` described below. Class description: Class controller for sample output in standard out. Method signatures and docstrings: - def print_to(self, articles, **kwargs): Procedure for sample output of news articles. :param articles: dict with title and list of news article...
Implement the Python class `SamplePrintController` described below. Class description: Class controller for sample output in standard out. Method signatures and docstrings: - def print_to(self, articles, **kwargs): Procedure for sample output of news articles. :param articles: dict with title and list of news article...
8a3ae96ca94ef750e6da0615e6467d80a2b40ac2
<|skeleton|> class SamplePrintController: """Class controller for sample output in standard out.""" def print_to(self, articles, **kwargs): """Procedure for sample output of news articles. :param articles: dict with title and list of news articles :param kwargs: optional params. Use to extend a count g...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SamplePrintController: """Class controller for sample output in standard out.""" def print_to(self, articles, **kwargs): """Procedure for sample output of news articles. :param articles: dict with title and list of news articles :param kwargs: optional params. Use to extend a count given params i...
the_stack_v2_python_sparse
rssreader/output_controller.py
TeRRoRlsT/PythonHomework
train
0
9f816a5dbdb90ecc305f560b95dc1bb479319909
[ "utc_now = timezone.now()\nexpired = auth_token.created < utc_now - timezone.timedelta(hours=24)\nreturn expired", "token, created = Token.objects.get_or_create(user=user)\nif not created:\n token.created = timezone.now()\n token.save()\nreturn token" ]
<|body_start_0|> utc_now = timezone.now() expired = auth_token.created < utc_now - timezone.timedelta(hours=24) return expired <|end_body_0|> <|body_start_1|> token, created = Token.objects.get_or_create(user=user) if not created: token.created = timezone.now() ...
Handles variations in auth token
AuthTokenHandler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthTokenHandler: """Handles variations in auth token""" def expired_token(auth_token): """Checks expiry of auth token""" <|body_0|> def create_auth_token(user): """Creates an auth token for a user""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_066135
718
permissive
[ { "docstring": "Checks expiry of auth token", "name": "expired_token", "signature": "def expired_token(auth_token)" }, { "docstring": "Creates an auth token for a user", "name": "create_auth_token", "signature": "def create_auth_token(user)" } ]
2
null
Implement the Python class `AuthTokenHandler` described below. Class description: Handles variations in auth token Method signatures and docstrings: - def expired_token(auth_token): Checks expiry of auth token - def create_auth_token(user): Creates an auth token for a user
Implement the Python class `AuthTokenHandler` described below. Class description: Handles variations in auth token Method signatures and docstrings: - def expired_token(auth_token): Checks expiry of auth token - def create_auth_token(user): Creates an auth token for a user <|skeleton|> class AuthTokenHandler: ""...
d0f73bf166ad41f243cff6d82caced2f9facf2f9
<|skeleton|> class AuthTokenHandler: """Handles variations in auth token""" def expired_token(auth_token): """Checks expiry of auth token""" <|body_0|> def create_auth_token(user): """Creates an auth token for a user""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AuthTokenHandler: """Handles variations in auth token""" def expired_token(auth_token): """Checks expiry of auth token""" utc_now = timezone.now() expired = auth_token.created < utc_now - timezone.timedelta(hours=24) return expired def create_auth_token(user): ...
the_stack_v2_python_sparse
authors/utils/authentication_handlers.py
andela/ah-the-immortals-backend
train
3
225bfce3dd8611ddd90bf48606676b54a84abd7e
[ "direct_x = [1, -1, -1, 0, 1, -1, 0, 1]\ndirect_y = [0, 0, -1, -1, -1, 1, 1, 1]\nm = len(board)\nn = len(board[0])\nlive_num = 0\nfor k in range(8):\n x = direct_x[k] + j\n y = direct_y[k] + i\n if 0 <= x < n and 0 <= y < m and (board[y][x] % 2 > 0):\n live_num += 1\nreturn live_num", "m = len(boa...
<|body_start_0|> direct_x = [1, -1, -1, 0, 1, -1, 0, 1] direct_y = [0, 0, -1, -1, -1, 1, 1, 1] m = len(board) n = len(board[0]) live_num = 0 for k in range(8): x = direct_x[k] + j y = direct_y[k] + i if 0 <= x < n and 0 <= y < m and (bo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def liveAroundCellNum(self, i, j, board): """Return the live cell number around the position (i, j) in the board.""" <|body_0|> def gameOfLife(self, board): """next_state current_state (01) represents (dead, live) (00) represents(dead, dead) (11) represents...
stack_v2_sparse_classes_75kplus_train_066136
3,332
no_license
[ { "docstring": "Return the live cell number around the position (i, j) in the board.", "name": "liveAroundCellNum", "signature": "def liveAroundCellNum(self, i, j, board)" }, { "docstring": "next_state current_state (01) represents (dead, live) (00) represents(dead, dead) (11) represents(live, l...
2
stack_v2_sparse_classes_30k_train_006297
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def liveAroundCellNum(self, i, j, board): Return the live cell number around the position (i, j) in the board. - def gameOfLife(self, board): next_state current_state (01) repres...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def liveAroundCellNum(self, i, j, board): Return the live cell number around the position (i, j) in the board. - def gameOfLife(self, board): next_state current_state (01) repres...
052bd7915257679877dbe55b60ed1abb7528eaa2
<|skeleton|> class Solution: def liveAroundCellNum(self, i, j, board): """Return the live cell number around the position (i, j) in the board.""" <|body_0|> def gameOfLife(self, board): """next_state current_state (01) represents (dead, live) (00) represents(dead, dead) (11) represents...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def liveAroundCellNum(self, i, j, board): """Return the live cell number around the position (i, j) in the board.""" direct_x = [1, -1, -1, 0, 1, -1, 0, 1] direct_y = [0, 0, -1, -1, -1, 1, 1, 1] m = len(board) n = len(board[0]) live_num = 0 for...
the_stack_v2_python_sparse
python_solution/Array/289_GameOfLife.py
Dimen61/leetcode
train
4
e1f18609127cb27249f632cf7a86026ec4719baf
[ "self.bar: BarData = None\nself.on_bar: Callable = on_bar\nself.interval: Interval = interval\nself.interval_count: int = 0\nself.window: int = window\nself.window_bar: BarData = None\nself.on_window_bar: Callable = on_window_bar\nself.last_tick: TickData = None\nself.last_bar: BarData = None", "new_minute = Fals...
<|body_start_0|> self.bar: BarData = None self.on_bar: Callable = on_bar self.interval: Interval = interval self.interval_count: int = 0 self.window: int = window self.window_bar: BarData = None self.on_window_bar: Callable = on_window_bar self.last_tick: ...
For: 1. generating 1 minute bar data from tick data 2. generateing x minute bar/x hour bar data from 1 minute data Notice: 1. for x minute bar, x must be able to divide 60: 2, 3, 5, 6, 10, 15, 20, 30 2. for x hour bar, x can be any number
BarGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BarGenerator: """For: 1. generating 1 minute bar data from tick data 2. generateing x minute bar/x hour bar data from 1 minute data Notice: 1. for x minute bar, x must be able to divide 60: 2, 3, 5, 6, 10, 15, 20, 30 2. for x hour bar, x can be any number""" def __init__(self, on_bar: Callab...
stack_v2_sparse_classes_75kplus_train_066137
41,911
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, on_bar: Callable, window: int=0, on_window_bar: Callable=None, interval: Interval=Interval.MINUTE)" }, { "docstring": "Update new tick data into generator.", "name": "update_tick", "signature": "def update...
4
stack_v2_sparse_classes_30k_train_005987
Implement the Python class `BarGenerator` described below. Class description: For: 1. generating 1 minute bar data from tick data 2. generateing x minute bar/x hour bar data from 1 minute data Notice: 1. for x minute bar, x must be able to divide 60: 2, 3, 5, 6, 10, 15, 20, 30 2. for x hour bar, x can be any number M...
Implement the Python class `BarGenerator` described below. Class description: For: 1. generating 1 minute bar data from tick data 2. generateing x minute bar/x hour bar data from 1 minute data Notice: 1. for x minute bar, x must be able to divide 60: 2, 3, 5, 6, 10, 15, 20, 30 2. for x hour bar, x can be any number M...
7f4fd3cd202712b083ed7dc2f346ba4bb1bda6d7
<|skeleton|> class BarGenerator: """For: 1. generating 1 minute bar data from tick data 2. generateing x minute bar/x hour bar data from 1 minute data Notice: 1. for x minute bar, x must be able to divide 60: 2, 3, 5, 6, 10, 15, 20, 30 2. for x hour bar, x can be any number""" def __init__(self, on_bar: Callab...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BarGenerator: """For: 1. generating 1 minute bar data from tick data 2. generateing x minute bar/x hour bar data from 1 minute data Notice: 1. for x minute bar, x must be able to divide 60: 2, 3, 5, 6, 10, 15, 20, 30 2. for x hour bar, x can be any number""" def __init__(self, on_bar: Callable, window: i...
the_stack_v2_python_sparse
vnpy/trader/utility.py
msincenselee/vnpy
train
359
a685ddab270ac094cb74e6919a6483505746d994
[ "super().process()\nfile_metadata_name_with_path = self.transformer_src_filename\ntry:\n if CUtils.equal_ignore_case(self.transformer_type, self.Transformer_DOM_MDB):\n xml_obj = self.mdb_to_xml(file_metadata_name_with_path)\n elif CUtils.equal_ignore_case(self.transformer_type, self.Transformer_DOM_MA...
<|body_start_0|> super().process() file_metadata_name_with_path = self.transformer_src_filename try: if CUtils.equal_ignore_case(self.transformer_type, self.Transformer_DOM_MDB): xml_obj = self.mdb_to_xml(file_metadata_name_with_path) elif CUtils.equal_ign...
CMDTransformerDOM
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CMDTransformerDOM: def process(self) -> str: """:return:""" <|body_0|> def mdb_to_xml(self, file_metadata_name_with_path: str): """TODO 王学谦 mdb文件转xml,在函数外提前定义xml对象并获取父节点传入,函数会将通过父节点构造xml对象 by王学谦 :param file_metadata_name_with_path:查询的mdb文件全名,带路径 :return xml_obj:将文件内容...
stack_v2_sparse_classes_75kplus_train_066138
7,832
no_license
[ { "docstring": ":return:", "name": "process", "signature": "def process(self) -> str" }, { "docstring": "TODO 王学谦 mdb文件转xml,在函数外提前定义xml对象并获取父节点传入,函数会将通过父节点构造xml对象 by王学谦 :param file_metadata_name_with_path:查询的mdb文件全名,带路径 :return xml_obj:将文件内容存储好的项目对象", "name": "mdb_to_xml", "signature": "...
4
null
Implement the Python class `CMDTransformerDOM` described below. Class description: Implement the CMDTransformerDOM class. Method signatures and docstrings: - def process(self) -> str: :return: - def mdb_to_xml(self, file_metadata_name_with_path: str): TODO 王学谦 mdb文件转xml,在函数外提前定义xml对象并获取父节点传入,函数会将通过父节点构造xml对象 by王学谦 :p...
Implement the Python class `CMDTransformerDOM` described below. Class description: Implement the CMDTransformerDOM class. Method signatures and docstrings: - def process(self) -> str: :return: - def mdb_to_xml(self, file_metadata_name_with_path: str): TODO 王学谦 mdb文件转xml,在函数外提前定义xml对象并获取父节点传入,函数会将通过父节点构造xml对象 by王学谦 :p...
58516401a054ff0d25bfb244810a37838c4c8cf6
<|skeleton|> class CMDTransformerDOM: def process(self) -> str: """:return:""" <|body_0|> def mdb_to_xml(self, file_metadata_name_with_path: str): """TODO 王学谦 mdb文件转xml,在函数外提前定义xml对象并获取父节点传入,函数会将通过父节点构造xml对象 by王学谦 :param file_metadata_name_with_path:查询的mdb文件全名,带路径 :return xml_obj:将文件内容...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CMDTransformerDOM: def process(self) -> str: """:return:""" super().process() file_metadata_name_with_path = self.transformer_src_filename try: if CUtils.equal_ignore_case(self.transformer_type, self.Transformer_DOM_MDB): xml_obj = self.mdb_to_xml(fi...
the_stack_v2_python_sparse
imetadata/business/metadata/base/parser/metadata/busmetadata/c_mdTransformerDOM.py
GISdeveloper2017/imetadata
train
0
8d8515bf8a5aceea7b95a52ee632ca9eac95fa12
[ "content = [w for w in menu_list]\nheight = len(menu_list)\nwidth = 0\nfor entry in menu_list:\n if len(entry.original_widget.text) > width:\n width = len(entry.original_widget.text)\nself._listbox = urwid.AttrWrap(urwid.ListBox(content), attr[0])\noverlay = urwid.Overlay(self._listbox, body, 'center', wi...
<|body_start_0|> content = [w for w in menu_list] height = len(menu_list) width = 0 for entry in menu_list: if len(entry.original_widget.text) > width: width = len(entry.original_widget.text) self._listbox = urwid.AttrWrap(urwid.ListBox(content), attr[...
Creates a popup menu on top of another BoxWidget. Attributes: selected -- Contains the item the user has selected by pressing <RETURN>, or None if nothing has been selected.
Popup
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Popup: """Creates a popup menu on top of another BoxWidget. Attributes: selected -- Contains the item the user has selected by pressing <RETURN>, or None if nothing has been selected.""" def __init__(self, menu_list, attr, pos, body): """menu_list -- a list of strings with the menu e...
stack_v2_sparse_classes_75kplus_train_066139
45,709
no_license
[ { "docstring": "menu_list -- a list of strings with the menu entries attr -- a tuple (background, active_item) of attributes pos -- a tuple (x, y), position of the menu widget body -- widget displayed beneath the message widget", "name": "__init__", "signature": "def __init__(self, menu_list, attr, pos,...
2
stack_v2_sparse_classes_30k_train_005881
Implement the Python class `Popup` described below. Class description: Creates a popup menu on top of another BoxWidget. Attributes: selected -- Contains the item the user has selected by pressing <RETURN>, or None if nothing has been selected. Method signatures and docstrings: - def __init__(self, menu_list, attr, p...
Implement the Python class `Popup` described below. Class description: Creates a popup menu on top of another BoxWidget. Attributes: selected -- Contains the item the user has selected by pressing <RETURN>, or None if nothing has been selected. Method signatures and docstrings: - def __init__(self, menu_list, attr, p...
0ac6653219c2701c13c508c5c4fc9bc3437eea06
<|skeleton|> class Popup: """Creates a popup menu on top of another BoxWidget. Attributes: selected -- Contains the item the user has selected by pressing <RETURN>, or None if nothing has been selected.""" def __init__(self, menu_list, attr, pos, body): """menu_list -- a list of strings with the menu e...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Popup: """Creates a popup menu on top of another BoxWidget. Attributes: selected -- Contains the item the user has selected by pressing <RETURN>, or None if nothing has been selected.""" def __init__(self, menu_list, attr, pos, body): """menu_list -- a list of strings with the menu entries attr -...
the_stack_v2_python_sparse
repoData/socketubs-pyhn/allPythonContent.py
aCoffeeYin/pyreco
train
0
d7ffbbba5eca98c6c9a7cf145708652c67038441
[ "self.count = {}\nfor word in dictionary:\n abbr = word\n if len(abbr) > 2:\n abbr = word[0] + str(len(word) - 2) + word[-1]\n if abbr not in self.count:\n self.count[abbr] = word\n elif word != self.count[abbr]:\n self.count[abbr] = None", "abbr = word\nif len(abbr) > 2:\n abb...
<|body_start_0|> self.count = {} for word in dictionary: abbr = word if len(abbr) > 2: abbr = word[0] + str(len(word) - 2) + word[-1] if abbr not in self.count: self.count[abbr] = word elif word != self.count[abbr]: ...
ValidWordAbbr
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidWordAbbr: def __init__(self, dictionary): """initialize your data structure here. :type dictionary: List[str]""" <|body_0|> def isUnique(self, word): """check if a word is unique. :type word: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_75kplus_train_066140
999
no_license
[ { "docstring": "initialize your data structure here. :type dictionary: List[str]", "name": "__init__", "signature": "def __init__(self, dictionary)" }, { "docstring": "check if a word is unique. :type word: str :rtype: bool", "name": "isUnique", "signature": "def isUnique(self, word)" ...
2
stack_v2_sparse_classes_30k_train_011146
Implement the Python class `ValidWordAbbr` described below. Class description: Implement the ValidWordAbbr class. Method signatures and docstrings: - def __init__(self, dictionary): initialize your data structure here. :type dictionary: List[str] - def isUnique(self, word): check if a word is unique. :type word: str ...
Implement the Python class `ValidWordAbbr` described below. Class description: Implement the ValidWordAbbr class. Method signatures and docstrings: - def __init__(self, dictionary): initialize your data structure here. :type dictionary: List[str] - def isUnique(self, word): check if a word is unique. :type word: str ...
580366c7de5f27a931930aeec5e08aa043aa1d54
<|skeleton|> class ValidWordAbbr: def __init__(self, dictionary): """initialize your data structure here. :type dictionary: List[str]""" <|body_0|> def isUnique(self, word): """check if a word is unique. :type word: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ValidWordAbbr: def __init__(self, dictionary): """initialize your data structure here. :type dictionary: List[str]""" self.count = {} for word in dictionary: abbr = word if len(abbr) > 2: abbr = word[0] + str(len(word) - 2) + word[-1] ...
the_stack_v2_python_sparse
288-Unique-Word-Abbreviation/solution.py
z502185331/leetcode-python
train
0
803e14302f022f89cd945e30f297f5957bc06e4b
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn UserExperienceAnalyticsDevicePerformance()", "from .disk_type import DiskType\nfrom .entity import Entity\nfrom .user_experience_analytics_health_state import UserExperienceAnalyticsHealthState\nfrom .disk_type import DiskType\nfrom .e...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return UserExperienceAnalyticsDevicePerformance() <|end_body_0|> <|body_start_1|> from .disk_type import DiskType from .entity import Entity from .user_experience_analytics_health_state...
The user experience analytics device performance entity contains device boot performance details.
UserExperienceAnalyticsDevicePerformance
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserExperienceAnalyticsDevicePerformance: """The user experience analytics device performance entity contains device boot performance details.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsDevicePerformance: """Creates a new in...
stack_v2_sparse_classes_75kplus_train_066141
8,307
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: UserExperienceAnalyticsDevicePerformance", "name": "create_from_discriminator_value", "signature": "def crea...
3
stack_v2_sparse_classes_30k_train_035280
Implement the Python class `UserExperienceAnalyticsDevicePerformance` described below. Class description: The user experience analytics device performance entity contains device boot performance details. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> U...
Implement the Python class `UserExperienceAnalyticsDevicePerformance` described below. Class description: The user experience analytics device performance entity contains device boot performance details. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> U...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class UserExperienceAnalyticsDevicePerformance: """The user experience analytics device performance entity contains device boot performance details.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsDevicePerformance: """Creates a new in...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserExperienceAnalyticsDevicePerformance: """The user experience analytics device performance entity contains device boot performance details.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsDevicePerformance: """Creates a new instance of the...
the_stack_v2_python_sparse
msgraph/generated/models/user_experience_analytics_device_performance.py
microsoftgraph/msgraph-sdk-python
train
135
90ca9a93d82ffcdbc8162233b3882379fc231733
[ "self.df = df\nself.data = df.values\nself.offset_mapper = OffsetMapper()\nself.offset_mapper.set_offset_list(list(df.index))\nself.cols_to_indexes = {k: v for v, k in enumerate(df.columns)}", "col_indexes = np.vectorize(self.cols_to_indexes.get)(col_ids)\nrow_indexes = self.offset_mapper.map(np.asanyarray(row_id...
<|body_start_0|> self.df = df self.data = df.values self.offset_mapper = OffsetMapper() self.offset_mapper.set_offset_list(list(df.index)) self.cols_to_indexes = {k: v for v, k in enumerate(df.columns)} <|end_body_0|> <|body_start_1|> col_indexes = np.vectorize(self.cols...
Utility class to allow a pandas dataframe to be treated like a 2-D array, indexed by rowid, colname For use in vectorized expressions where the desired values depend on both a row column selector e.g. size_terms.get(df.dest_taz, df.purpose) :: df = pd.DataFrame({'a': [1,2,3,4,5], 'b': [10,20,30,40,50]}, index=[100,101,...
DataFrameMatrix
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataFrameMatrix: """Utility class to allow a pandas dataframe to be treated like a 2-D array, indexed by rowid, colname For use in vectorized expressions where the desired values depend on both a row column selector e.g. size_terms.get(df.dest_taz, df.purpose) :: df = pd.DataFrame({'a': [1,2,3,4,...
stack_v2_sparse_classes_75kplus_train_066142
17,362
permissive
[ { "docstring": "Parameters ---------- df - pandas dataframe of uniform type", "name": "__init__", "signature": "def __init__(self, df)" }, { "docstring": "Parameters ---------- row_ids - list of row_ids (df index values) col_ids - list of column names, one per row_id, specifying column from whic...
2
stack_v2_sparse_classes_30k_train_031501
Implement the Python class `DataFrameMatrix` described below. Class description: Utility class to allow a pandas dataframe to be treated like a 2-D array, indexed by rowid, colname For use in vectorized expressions where the desired values depend on both a row column selector e.g. size_terms.get(df.dest_taz, df.purpos...
Implement the Python class `DataFrameMatrix` described below. Class description: Utility class to allow a pandas dataframe to be treated like a 2-D array, indexed by rowid, colname For use in vectorized expressions where the desired values depend on both a row column selector e.g. size_terms.get(df.dest_taz, df.purpos...
0f456746da31d0708a977d679ff8964c0ae7c673
<|skeleton|> class DataFrameMatrix: """Utility class to allow a pandas dataframe to be treated like a 2-D array, indexed by rowid, colname For use in vectorized expressions where the desired values depend on both a row column selector e.g. size_terms.get(df.dest_taz, df.purpose) :: df = pd.DataFrame({'a': [1,2,3,4,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataFrameMatrix: """Utility class to allow a pandas dataframe to be treated like a 2-D array, indexed by rowid, colname For use in vectorized expressions where the desired values depend on both a row column selector e.g. size_terms.get(df.dest_taz, df.purpose) :: df = pd.DataFrame({'a': [1,2,3,4,5], 'b': [10,...
the_stack_v2_python_sparse
activitysim/core/skim.py
ual/activitysim
train
2
40d57d540c5df70b01b10496bd42a261213e80f2
[ "logger.info('Introducing registration session')\nupdate = update.callback_query\nchat_id = update.message.chat_id\nif not admin_exists(chat_id):\n logger.info('Unauthenticated admin - ending')\n update.message.reply_text('Você precisa estar autenticado para fazer este procedimento!')\n context.bot.delete_...
<|body_start_0|> logger.info('Introducing registration session') update = update.callback_query chat_id = update.message.chat_id if not admin_exists(chat_id): logger.info('Unauthenticated admin - ending') update.message.reply_text('Você precisa estar autenticado p...
Register an admin
RegisterAdmin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegisterAdmin: """Register an admin""" def index(update, context): """Start the conversation""" <|body_0|> def email(update, context): """Get new admin's email""" <|body_1|> def password(update, context): """Get new admin's password""" ...
stack_v2_sparse_classes_75kplus_train_066143
4,736
permissive
[ { "docstring": "Start the conversation", "name": "index", "signature": "def index(update, context)" }, { "docstring": "Get new admin's email", "name": "email", "signature": "def email(update, context)" }, { "docstring": "Get new admin's password", "name": "password", "sig...
5
stack_v2_sparse_classes_30k_train_004242
Implement the Python class `RegisterAdmin` described below. Class description: Register an admin Method signatures and docstrings: - def index(update, context): Start the conversation - def email(update, context): Get new admin's email - def password(update, context): Get new admin's password - def end(update, contex...
Implement the Python class `RegisterAdmin` described below. Class description: Register an admin Method signatures and docstrings: - def index(update, context): Start the conversation - def email(update, context): Get new admin's email - def password(update, context): Get new admin's password - def end(update, contex...
7a4f0a7f12c3aa438a523f67200e4d1e59415cca
<|skeleton|> class RegisterAdmin: """Register an admin""" def index(update, context): """Start the conversation""" <|body_0|> def email(update, context): """Get new admin's email""" <|body_1|> def password(update, context): """Get new admin's password""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RegisterAdmin: """Register an admin""" def index(update, context): """Start the conversation""" logger.info('Introducing registration session') update = update.callback_query chat_id = update.message.chat_id if not admin_exists(chat_id): logger.info('Un...
the_stack_v2_python_sparse
bot/admin/register_admin.py
Alohomora-team/2019.2-AlohomoraBot
train
0
524c53cdf7274980df7c783ea6f4ae2584b1a533
[ "input_data = {}\ninput_data['title'] = kwargs.get('title', None)\ninput_data['description'] = kwargs.get('description', None)\ninput_data['tags'] = kwargs.get('tags', [])\ninput_data['categories'] = kwargs.get('categories', [])\ninput_data['video'] = kwargs.get('video', None)\nreturn input_data", "input_data = {...
<|body_start_0|> input_data = {} input_data['title'] = kwargs.get('title', None) input_data['description'] = kwargs.get('description', None) input_data['tags'] = kwargs.get('tags', []) input_data['categories'] = kwargs.get('categories', []) input_data['video'] = kwargs.ge...
Validations for theclient information
VideoValidations
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VideoValidations: """Validations for theclient information""" def validate_video_data(self, kwargs): """Runs all the individual client registration data validations in one function Args: kwargs (dict): request data Returns: input_data (dict): validated data""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_066144
1,862
permissive
[ { "docstring": "Runs all the individual client registration data validations in one function Args: kwargs (dict): request data Returns: input_data (dict): validated data", "name": "validate_video_data", "signature": "def validate_video_data(self, kwargs)" }, { "docstring": "Runs all the corporat...
2
stack_v2_sparse_classes_30k_train_026440
Implement the Python class `VideoValidations` described below. Class description: Validations for theclient information Method signatures and docstrings: - def validate_video_data(self, kwargs): Runs all the individual client registration data validations in one function Args: kwargs (dict): request data Returns: inp...
Implement the Python class `VideoValidations` described below. Class description: Validations for theclient information Method signatures and docstrings: - def validate_video_data(self, kwargs): Runs all the individual client registration data validations in one function Args: kwargs (dict): request data Returns: inp...
04ff9ebb5da482e5b2642a89654a5b5f0128eaaa
<|skeleton|> class VideoValidations: """Validations for theclient information""" def validate_video_data(self, kwargs): """Runs all the individual client registration data validations in one function Args: kwargs (dict): request data Returns: input_data (dict): validated data""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VideoValidations: """Validations for theclient information""" def validate_video_data(self, kwargs): """Runs all the individual client registration data validations in one function Args: kwargs (dict): request data Returns: input_data (dict): validated data""" input_data = {} inpu...
the_stack_v2_python_sparse
app/api/videos/validators/validate_input.py
lunyamwis/laylinks-bend
train
0
946c0e46b7e3e6b2a39f7d7686a6a31e7051d7df
[ "super(LSTM, self).__init__()\nself.hidden_size = d_model\nself.lstm = nn.LSTM(input_size=input_size, hidden_size=d_model, num_layers=layers, batch_first=True)\nself.fc1 = nn.Linear(d_model, d_model)\nself.fc2 = nn.Linear(d_model, out_len)\nself.drop_out = nn.Dropout(dropout)\nself.device = device\nself.num_layers ...
<|body_start_0|> super(LSTM, self).__init__() self.hidden_size = d_model self.lstm = nn.LSTM(input_size=input_size, hidden_size=d_model, num_layers=layers, batch_first=True) self.fc1 = nn.Linear(d_model, d_model) self.fc2 = nn.Linear(d_model, out_len) self.drop_out = nn.D...
An implementation of LSTM for forecasting.
LSTM
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LSTM: """An implementation of LSTM for forecasting.""" def __init__(self, input_size, out_len, d_model=512, layers=3, dropout=0.0, device=torch.device('cuda:0')): """Initializes a LSTM instance. Args: input_size: Input features dimension out_len: Forecasting horizon d_model: Hidden l...
stack_v2_sparse_classes_75kplus_train_066145
4,262
permissive
[ { "docstring": "Initializes a LSTM instance. Args: input_size: Input features dimension out_len: Forecasting horizon d_model: Hidden layer dimension layers: Number of LSTM layers. dropout: Fraction of neurons affected by Dropout (default=0.0). device: Device used by the model", "name": "__init__", "sign...
2
stack_v2_sparse_classes_30k_train_024607
Implement the Python class `LSTM` described below. Class description: An implementation of LSTM for forecasting. Method signatures and docstrings: - def __init__(self, input_size, out_len, d_model=512, layers=3, dropout=0.0, device=torch.device('cuda:0')): Initializes a LSTM instance. Args: input_size: Input features...
Implement the Python class `LSTM` described below. Class description: An implementation of LSTM for forecasting. Method signatures and docstrings: - def __init__(self, input_size, out_len, d_model=512, layers=3, dropout=0.0, device=torch.device('cuda:0')): Initializes a LSTM instance. Args: input_size: Input features...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class LSTM: """An implementation of LSTM for forecasting.""" def __init__(self, input_size, out_len, d_model=512, layers=3, dropout=0.0, device=torch.device('cuda:0')): """Initializes a LSTM instance. Args: input_size: Input features dimension out_len: Forecasting horizon d_model: Hidden l...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LSTM: """An implementation of LSTM for forecasting.""" def __init__(self, input_size, out_len, d_model=512, layers=3, dropout=0.0, device=torch.device('cuda:0')): """Initializes a LSTM instance. Args: input_size: Input features dimension out_len: Forecasting horizon d_model: Hidden layer dimensio...
the_stack_v2_python_sparse
ime/models/lstm.py
Jimmy-INL/google-research
train
1
0cd3a5e0c458872aecf851529f6d7406d7e188f9
[ "response = super(JsonMemory, self).Read()\ntry:\n data = json.loads(response.strip())\nexcept ValueError:\n data = response.strip()\nreturn data", "data = json.dumps(what) + '\\n'\nif len(data) > self.size:\n raise MemoryOverflow('Data is of length {} whilst the memory will only hold {}'.format(len(data...
<|body_start_0|> response = super(JsonMemory, self).Read() try: data = json.loads(response.strip()) except ValueError: data = response.strip() return data <|end_body_0|> <|body_start_1|> data = json.dumps(what) + '\n' if len(data) > self.size: ...
JSON shared memory handler. Reads and writes JSON data rather than just plain strings
JsonMemory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JsonMemory: """JSON shared memory handler. Reads and writes JSON data rather than just plain strings""" def Read(self): """Reads the data from memory, and .strip()'s the trailing linebreak""" <|body_0|> def Write(self, what): """Writes data to shared memory. Conv...
stack_v2_sparse_classes_75kplus_train_066146
3,221
no_license
[ { "docstring": "Reads the data from memory, and .strip()'s the trailing linebreak", "name": "Read", "signature": "def Read(self)" }, { "docstring": "Writes data to shared memory. Converts to JSON data, so should probably only accept dicts since any other datatype doesn't really make sense", ...
3
stack_v2_sparse_classes_30k_train_040516
Implement the Python class `JsonMemory` described below. Class description: JSON shared memory handler. Reads and writes JSON data rather than just plain strings Method signatures and docstrings: - def Read(self): Reads the data from memory, and .strip()'s the trailing linebreak - def Write(self, what): Writes data t...
Implement the Python class `JsonMemory` described below. Class description: JSON shared memory handler. Reads and writes JSON data rather than just plain strings Method signatures and docstrings: - def Read(self): Reads the data from memory, and .strip()'s the trailing linebreak - def Write(self, what): Writes data t...
50de3488a2140343c364efc2615cf6e67f152be0
<|skeleton|> class JsonMemory: """JSON shared memory handler. Reads and writes JSON data rather than just plain strings""" def Read(self): """Reads the data from memory, and .strip()'s the trailing linebreak""" <|body_0|> def Write(self, what): """Writes data to shared memory. Conv...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class JsonMemory: """JSON shared memory handler. Reads and writes JSON data rather than just plain strings""" def Read(self): """Reads the data from memory, and .strip()'s the trailing linebreak""" response = super(JsonMemory, self).Read() try: data = json.loads(response.str...
the_stack_v2_python_sparse
carbon/common/lib/launcherapi.py
nanxijw/Clara-Pretty-One-Dick
train
0
afb56ce2864fb14579beda356238f2d3c34d755d
[ "if root == None:\n return '[]'\nque = []\nque.append(root)\nres = []\nwhile any(que):\n next_level = []\n while len(que) > 0:\n cur = que.pop(0)\n if cur == None:\n res.append(None)\n next_level.append(None)\n next_level.append(None)\n else:\n ...
<|body_start_0|> if root == None: return '[]' que = [] que.append(root) res = [] while any(que): next_level = [] while len(que) > 0: cur = que.pop(0) if cur == None: res.append(None) ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_066147
3,172
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_001438
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:...
0d6f414e7610fedb2ec4818ecf88d51aa69e1355
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if root == None: return '[]' que = [] que.append(root) res = [] while any(que): next_level = [] while len(que) > 0: ...
the_stack_v2_python_sparse
0449_Serialize_and_Deserialize_BST.py
chien-wei/LeetCode
train
0
b538204372d05e885181a52780166e3e3007f2a2
[ "TaskProvider.__init__(self, task_id, input_file_path)\nif os.path.isfile(reference_file_path) is True:\n self.reference_file_path = reference_file_path\n self.reference_file_name = os.path.basename(reference_file_path)\nelse:\n self.acknowledge_error()\nself.input_frame_in = str(input_frame_in)\nself.inpu...
<|body_start_0|> TaskProvider.__init__(self, task_id, input_file_path) if os.path.isfile(reference_file_path) is True: self.reference_file_path = reference_file_path self.reference_file_name = os.path.basename(reference_file_path) else: self.acknowledge_error(...
This class defines an Export task
ExportProvider
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExportProvider: """This class defines an Export task""" def __init__(self, task_id, input_file_path, input_frame_in, input_frame_out, reference_file_path, reference_width, reference_height, split_required): """Export initialization :param task_id: The task identifier :type task_id: i...
stack_v2_sparse_classes_75kplus_train_066148
4,137
permissive
[ { "docstring": "Export initialization :param task_id: The task identifier :type task_id: int :param input_file_path: The input video file path :type input_file_path: str :param input_frame_in: The first video frame of future exported media :type input_frame_in: int :param input_frame_out: The last video frame o...
2
stack_v2_sparse_classes_30k_train_027775
Implement the Python class `ExportProvider` described below. Class description: This class defines an Export task Method signatures and docstrings: - def __init__(self, task_id, input_file_path, input_frame_in, input_frame_out, reference_file_path, reference_width, reference_height, split_required): Export initializa...
Implement the Python class `ExportProvider` described below. Class description: This class defines an Export task Method signatures and docstrings: - def __init__(self, task_id, input_file_path, input_frame_in, input_frame_out, reference_file_path, reference_width, reference_height, split_required): Export initializa...
48c1b202673a948e1ca51fbd44ac4c1a037f4ef7
<|skeleton|> class ExportProvider: """This class defines an Export task""" def __init__(self, task_id, input_file_path, input_frame_in, input_frame_out, reference_file_path, reference_width, reference_height, split_required): """Export initialization :param task_id: The task identifier :type task_id: i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExportProvider: """This class defines an Export task""" def __init__(self, task_id, input_file_path, input_frame_in, input_frame_out, reference_file_path, reference_width, reference_height, split_required): """Export initialization :param task_id: The task identifier :type task_id: int :param inp...
the_stack_v2_python_sparse
pixelwalker/worker/task_providers/export.py
thomMar/pixelwalker
train
0
fbad5cb3794cca062faba6abaf128cfb67d092b2
[ "self.email = email\nself.pwd = pwd\nself.uid = None\nself.auth_id = None\nself.uid_hex = None", "data = {'email': self.email, 'locale': 'en', 'platform': '0', 'password': sha1(self.pwd.encode()).hexdigest(), 'env': 'home'}\nheaders = {'Cookie': f'evercookie={randint(1000000, 99999999)};'}\nwhile True:\n try:\...
<|body_start_0|> self.email = email self.pwd = pwd self.uid = None self.auth_id = None self.uid_hex = None <|end_body_0|> <|body_start_1|> data = {'email': self.email, 'locale': 'en', 'platform': '0', 'password': sha1(self.pwd.encode()).hexdigest(), 'env': 'home'} ...
A class to manage account.
Account
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Account: """A class to manage account.""" def __init__(self, email, pwd): """Initialise attributes.""" <|body_0|> def login(self): """sends login request and returns uid and loginid.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.email = e...
stack_v2_sparse_classes_75kplus_train_066149
1,245
no_license
[ { "docstring": "Initialise attributes.", "name": "__init__", "signature": "def __init__(self, email, pwd)" }, { "docstring": "sends login request and returns uid and loginid.", "name": "login", "signature": "def login(self)" } ]
2
stack_v2_sparse_classes_30k_train_008561
Implement the Python class `Account` described below. Class description: A class to manage account. Method signatures and docstrings: - def __init__(self, email, pwd): Initialise attributes. - def login(self): sends login request and returns uid and loginid.
Implement the Python class `Account` described below. Class description: A class to manage account. Method signatures and docstrings: - def __init__(self, email, pwd): Initialise attributes. - def login(self): sends login request and returns uid and loginid. <|skeleton|> class Account: """A class to manage accou...
d27b2f5373bcef96a3e7b14070dc8ad14aca0d10
<|skeleton|> class Account: """A class to manage account.""" def __init__(self, email, pwd): """Initialise attributes.""" <|body_0|> def login(self): """sends login request and returns uid and loginid.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Account: """A class to manage account.""" def __init__(self, email, pwd): """Initialise attributes.""" self.email = email self.pwd = pwd self.uid = None self.auth_id = None self.uid_hex = None def login(self): """sends login request and returns...
the_stack_v2_python_sparse
account.py
khanxbahria/modbot_ourworld
train
0
9d768c2eafb3c4ec4d4c5cd674176a5e02f63088
[ "if num_pages > self.MAX_KIDS_BOOK_PAGES:\n num_pages = self.MAX_KIDS_BOOK_PAGES\ntitle = title.upper()\nBook.__init__(self, author, title, subject, num_pages)\nself._start_age = min_age\nself._age_range = max_age - min_age", "out = \"Hi kids. Today we're going to learn about \" + self.get_topic()\nout += ' in...
<|body_start_0|> if num_pages > self.MAX_KIDS_BOOK_PAGES: num_pages = self.MAX_KIDS_BOOK_PAGES title = title.upper() Book.__init__(self, author, title, subject, num_pages) self._start_age = min_age self._age_range = max_age - min_age <|end_body_0|> <|body_start_1|> ...
KidsBook
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KidsBook: def __init__(self, author, title, subject, num_pages, min_age, max_age): """(KidsBook, str, str, str, int, int, int) -> NoneType Initialize this kids book with the author's name (author), the title of the book (title), the subject that the book covers (subject) the total number...
stack_v2_sparse_classes_75kplus_train_066150
3,569
no_license
[ { "docstring": "(KidsBook, str, str, str, int, int, int) -> NoneType Initialize this kids book with the author's name (author), the title of the book (title), the subject that the book covers (subject) the total number of pages (num_pages), and the minimum and maximum ages for which this book is appropriate (mi...
2
null
Implement the Python class `KidsBook` described below. Class description: Implement the KidsBook class. Method signatures and docstrings: - def __init__(self, author, title, subject, num_pages, min_age, max_age): (KidsBook, str, str, str, int, int, int) -> NoneType Initialize this kids book with the author's name (au...
Implement the Python class `KidsBook` described below. Class description: Implement the KidsBook class. Method signatures and docstrings: - def __init__(self, author, title, subject, num_pages, min_age, max_age): (KidsBook, str, str, str, int, int, int) -> NoneType Initialize this kids book with the author's name (au...
dffbef98cbf43eccc13fafb40df1aaada50850f4
<|skeleton|> class KidsBook: def __init__(self, author, title, subject, num_pages, min_age, max_age): """(KidsBook, str, str, str, int, int, int) -> NoneType Initialize this kids book with the author's name (author), the title of the book (title), the subject that the book covers (subject) the total number...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KidsBook: def __init__(self, author, title, subject, num_pages, min_age, max_age): """(KidsBook, str, str, str, int, int, int) -> NoneType Initialize this kids book with the author's name (author), the title of the book (title), the subject that the book covers (subject) the total number of pages (num...
the_stack_v2_python_sparse
Fall_2016_CSCA08_Intro_to_Computer_Science_I/Week__10_Inheritance/week10.py
BoZhaoUT/Teaching
train
0
a96c94f516245759d9c9106bd0acd430dd4e9ab4
[ "from sunpy.coordinates.sun import _angular_radius\nif not isinstance(self.observer, HeliographicStonyhurst):\n if self.observer is None:\n raise ValueError('The observer must be defined, not `None`.')\n raise ValueError('The observer must be fully defined by specifying `obstime`.')\nreturn _angular_ra...
<|body_start_0|> from sunpy.coordinates.sun import _angular_radius if not isinstance(self.observer, HeliographicStonyhurst): if self.observer is None: raise ValueError('The observer must be defined, not `None`.') raise ValueError('The observer must be fully define...
A coordinate or frame in the Helioprojective Cartesian (HPC) system, which is observer-based. - The origin is the location of the observer. - ``Tx`` (aka "theta_x") is the angle relative to the plane containing the Sun-observer line and the Sun's rotation axis, with positive values in the direction of the Sun's west li...
Helioprojective
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Helioprojective: """A coordinate or frame in the Helioprojective Cartesian (HPC) system, which is observer-based. - The origin is the location of the observer. - ``Tx`` (aka "theta_x") is the angle relative to the plane containing the Sun-observer line and the Sun's rotation axis, with positive v...
stack_v2_sparse_classes_75kplus_train_066151
35,206
permissive
[ { "docstring": "Angular radius of the Sun as seen by the observer. The ``rsun`` frame attribute is the radius of the Sun in length units. The tangent vector from the observer to the edge of the Sun forms a right-angle triangle with the radius of the Sun as the far side and the Sun-observer distance as the hypot...
3
stack_v2_sparse_classes_30k_train_021333
Implement the Python class `Helioprojective` described below. Class description: A coordinate or frame in the Helioprojective Cartesian (HPC) system, which is observer-based. - The origin is the location of the observer. - ``Tx`` (aka "theta_x") is the angle relative to the plane containing the Sun-observer line and t...
Implement the Python class `Helioprojective` described below. Class description: A coordinate or frame in the Helioprojective Cartesian (HPC) system, which is observer-based. - The origin is the location of the observer. - ``Tx`` (aka "theta_x") is the angle relative to the plane containing the Sun-observer line and t...
edd3ea805f4540d41ce2932a0e865cab2d6a4cf5
<|skeleton|> class Helioprojective: """A coordinate or frame in the Helioprojective Cartesian (HPC) system, which is observer-based. - The origin is the location of the observer. - ``Tx`` (aka "theta_x") is the angle relative to the plane containing the Sun-observer line and the Sun's rotation axis, with positive v...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Helioprojective: """A coordinate or frame in the Helioprojective Cartesian (HPC) system, which is observer-based. - The origin is the location of the observer. - ``Tx`` (aka "theta_x") is the angle relative to the plane containing the Sun-observer line and the Sun's rotation axis, with positive values in the ...
the_stack_v2_python_sparse
sunpy/coordinates/frames.py
sunpy/sunpy
train
792
3517c72d341daa48fc8445f92728c972de696922
[ "ExecutionContext().transition(ExecutionContext.phases.VERIFICATION)\nlogstr = 'FileCopy: Checking destination is writable, \"%s\"' % self.dst\nlogger.info('{0}: {1}'.format(self.file_context, logstr))\nif not filesys.writable_path_or_ancestor(self.dst):\n return self.verification_codes.UNWRITABLE_TARGET\nlogstr...
<|body_start_0|> ExecutionContext().transition(ExecutionContext.phases.VERIFICATION) logstr = 'FileCopy: Checking destination is writable, "%s"' % self.dst logger.info('{0}: {1}'.format(self.file_context, logstr)) if not filesys.writable_path_or_ancestor(self.dst): return sel...
FileCopyAction
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileCopyAction: def verify_can_exec(self, filesys): """Check to ensure that execution can proceed without errors. Ensures that the source file exists and is readable, and that the target file can be created or is writable.""" <|body_0|> def execute(self, filesys): ""...
stack_v2_sparse_classes_75kplus_train_066152
2,327
permissive
[ { "docstring": "Check to ensure that execution can proceed without errors. Ensures that the source file exists and is readable, and that the target file can be created or is writable.", "name": "verify_can_exec", "signature": "def verify_can_exec(self, filesys)" }, { "docstring": "FileCopyAction...
2
null
Implement the Python class `FileCopyAction` described below. Class description: Implement the FileCopyAction class. Method signatures and docstrings: - def verify_can_exec(self, filesys): Check to ensure that execution can proceed without errors. Ensures that the source file exists and is readable, and that the targe...
Implement the Python class `FileCopyAction` described below. Class description: Implement the FileCopyAction class. Method signatures and docstrings: - def verify_can_exec(self, filesys): Check to ensure that execution can proceed without errors. Ensures that the source file exists and is readable, and that the targe...
5711b5c71e39b958bc8185c6b893358de7598ae2
<|skeleton|> class FileCopyAction: def verify_can_exec(self, filesys): """Check to ensure that execution can proceed without errors. Ensures that the source file exists and is readable, and that the target file can be created or is writable.""" <|body_0|> def execute(self, filesys): ""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FileCopyAction: def verify_can_exec(self, filesys): """Check to ensure that execution can proceed without errors. Ensures that the source file exists and is readable, and that the target file can be created or is writable.""" ExecutionContext().transition(ExecutionContext.phases.VERIFICATION) ...
the_stack_v2_python_sparse
salve/action/copy/file.py
sirosen/SALVE
train
0
7b1844290a71928844dfeea8f1dc15d25741f5bb
[ "queryset = ExerciseModel.objects.all()\ncampaign = get_object_or_404(queryset, pk=pk)\nserializer = CampaignSerializer(campaign)\nreturn Response(serializer.data)", "campaign = CampaignModel.objects.get(pk=pk)\nserializer = Ca(campaign, data=request.data)\nif serializer.is_valid(raise_exception=True):\n seria...
<|body_start_0|> queryset = ExerciseModel.objects.all() campaign = get_object_or_404(queryset, pk=pk) serializer = CampaignSerializer(campaign) return Response(serializer.data) <|end_body_0|> <|body_start_1|> campaign = CampaignModel.objects.get(pk=pk) serializer = Ca(ca...
API for retrieving, updating and deleting of a exercise (GET, PUT and DELETE)
ExerciseRetrieveUpdateDestroy
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExerciseRetrieveUpdateDestroy: """API for retrieving, updating and deleting of a exercise (GET, PUT and DELETE)""" def retrieve(self, request, pk=None, **kwargs): """Retrieve a exercise instance. :param request: request object. :param pk: primary key. :param kwargs: keywords argument...
stack_v2_sparse_classes_75kplus_train_066153
4,561
no_license
[ { "docstring": "Retrieve a exercise instance. :param request: request object. :param pk: primary key. :param kwargs: keywords arguments. :return: exercise instance.", "name": "retrieve", "signature": "def retrieve(self, request, pk=None, **kwargs)" }, { "docstring": "Update existing exercise. :p...
3
stack_v2_sparse_classes_30k_train_031395
Implement the Python class `ExerciseRetrieveUpdateDestroy` described below. Class description: API for retrieving, updating and deleting of a exercise (GET, PUT and DELETE) Method signatures and docstrings: - def retrieve(self, request, pk=None, **kwargs): Retrieve a exercise instance. :param request: request object....
Implement the Python class `ExerciseRetrieveUpdateDestroy` described below. Class description: API for retrieving, updating and deleting of a exercise (GET, PUT and DELETE) Method signatures and docstrings: - def retrieve(self, request, pk=None, **kwargs): Retrieve a exercise instance. :param request: request object....
288f76ba84dcf2bc108504b7c58b0b0431028add
<|skeleton|> class ExerciseRetrieveUpdateDestroy: """API for retrieving, updating and deleting of a exercise (GET, PUT and DELETE)""" def retrieve(self, request, pk=None, **kwargs): """Retrieve a exercise instance. :param request: request object. :param pk: primary key. :param kwargs: keywords argument...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExerciseRetrieveUpdateDestroy: """API for retrieving, updating and deleting of a exercise (GET, PUT and DELETE)""" def retrieve(self, request, pk=None, **kwargs): """Retrieve a exercise instance. :param request: request object. :param pk: primary key. :param kwargs: keywords arguments. :return: e...
the_stack_v2_python_sparse
api/views.py
tefatt/TeeM
train
0
ac4248d86d3735522d0748d8ef2329577e155b31
[ "if not raw or raw == '0':\n return 'None'\nif raw.isdigit():\n emoji = discord.utils.get(ctx.bot.get_all_emojis(), id=raw)\n return str(emoji) if emoji else raw\nelse:\n return raw", "if userstr.lower() in ['0', 'none']:\n return None\nif userstr.endswith('>') and userstr.startswith('<'):\n id_...
<|body_start_0|> if not raw or raw == '0': return 'None' if raw.isdigit(): emoji = discord.utils.get(ctx.bot.get_all_emojis(), id=raw) return str(emoji) if emoji else raw else: return raw <|end_body_0|> <|body_start_1|> if userstr.lower() ...
EMOJI type.
EMOJI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EMOJI: """EMOJI type.""" async def humanise(self, ctx, raw): """Expect raw to be emoji id or unicode. Empty values are None and 0.""" <|body_0|> async def understand(self, ctx, userstr): """User can enter an emoji id, custom emoji, or unicode built in emoji.""" ...
stack_v2_sparse_classes_75kplus_train_066154
9,355
no_license
[ { "docstring": "Expect raw to be emoji id or unicode. Empty values are None and 0.", "name": "humanise", "signature": "async def humanise(self, ctx, raw)" }, { "docstring": "User can enter an emoji id, custom emoji, or unicode built in emoji.", "name": "understand", "signature": "async d...
2
stack_v2_sparse_classes_30k_train_003676
Implement the Python class `EMOJI` described below. Class description: EMOJI type. Method signatures and docstrings: - async def humanise(self, ctx, raw): Expect raw to be emoji id or unicode. Empty values are None and 0. - async def understand(self, ctx, userstr): User can enter an emoji id, custom emoji, or unicode...
Implement the Python class `EMOJI` described below. Class description: EMOJI type. Method signatures and docstrings: - async def humanise(self, ctx, raw): Expect raw to be emoji id or unicode. Empty values are None and 0. - async def understand(self, ctx, userstr): User can enter an emoji id, custom emoji, or unicode...
d32000a0165b8a29e2758cadc261af5f715b2289
<|skeleton|> class EMOJI: """EMOJI type.""" async def humanise(self, ctx, raw): """Expect raw to be emoji id or unicode. Empty values are None and 0.""" <|body_0|> async def understand(self, ctx, userstr): """User can enter an emoji id, custom emoji, or unicode built in emoji.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EMOJI: """EMOJI type.""" async def humanise(self, ctx, raw): """Expect raw to be emoji id or unicode. Empty values are None and 0.""" if not raw or raw == '0': return 'None' if raw.isdigit(): emoji = discord.utils.get(ctx.bot.get_all_emojis(), id=raw) ...
the_stack_v2_python_sparse
settingTypes.py
dangolbeeker/paradox
train
1
7f57142e31d183769fe08e09ade90cea2da182c4
[ "n = len(s)\n\ndef backtrack(st=0):\n if st > n:\n return True\n for i in range(st + 1, n + 2):\n if s[st:i] in wordDict:\n if backtrack(st=i) is True:\n return True\n return False\nreturn backtrack()", "n = len(s)\nmemo = [None] * (n + 2)\n\ndef backtrack(st=0):\n...
<|body_start_0|> n = len(s) def backtrack(st=0): if st > n: return True for i in range(st + 1, n + 2): if s[st:i] in wordDict: if backtrack(st=i) is True: return True return False ret...
OfficialSolution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OfficialSolution: def wordBreakApproach1(self, s: str, wordDict: List[str]) -> bool: """== Approach 1: Brute Force == == Algorithm == The naive approach to solve this problem is to use recursion and backtracking. For finding the solution, we check every possible prefix of that string in ...
stack_v2_sparse_classes_75kplus_train_066155
2,838
no_license
[ { "docstring": "== Approach 1: Brute Force == == Algorithm == The naive approach to solve this problem is to use recursion and backtracking. For finding the solution, we check every possible prefix of that string in the dictionary of words. If it is found in the dictionary, then the recursive function is called...
2
stack_v2_sparse_classes_30k_train_043970
Implement the Python class `OfficialSolution` described below. Class description: Implement the OfficialSolution class. Method signatures and docstrings: - def wordBreakApproach1(self, s: str, wordDict: List[str]) -> bool: == Approach 1: Brute Force == == Algorithm == The naive approach to solve this problem is to us...
Implement the Python class `OfficialSolution` described below. Class description: Implement the OfficialSolution class. Method signatures and docstrings: - def wordBreakApproach1(self, s: str, wordDict: List[str]) -> bool: == Approach 1: Brute Force == == Algorithm == The naive approach to solve this problem is to us...
221f0cb3105e4ccaec40cd1d37b9d7d5e218c731
<|skeleton|> class OfficialSolution: def wordBreakApproach1(self, s: str, wordDict: List[str]) -> bool: """== Approach 1: Brute Force == == Algorithm == The naive approach to solve this problem is to use recursion and backtracking. For finding the solution, we check every possible prefix of that string in ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OfficialSolution: def wordBreakApproach1(self, s: str, wordDict: List[str]) -> bool: """== Approach 1: Brute Force == == Algorithm == The naive approach to solve this problem is to use recursion and backtracking. For finding the solution, we check every possible prefix of that string in the dictionary...
the_stack_v2_python_sparse
problems/word_break.py
saubhik/leetcode
train
3
35ebd862f2db95944c1c51cd8d63e4d17570b69e
[ "assert query_batch_cnt.is_contiguous()\nassert key_batch_cnt.is_contiguous()\nassert index_pair_batch.is_contiguous()\nassert index_pair.is_contiguous()\nassert attn_weight.is_contiguous()\nassert value_features.is_contiguous()\nb = query_batch_cnt.shape[0]\ntotal_query_num, local_size = index_pair.size()\ntotal_k...
<|body_start_0|> assert query_batch_cnt.is_contiguous() assert key_batch_cnt.is_contiguous() assert index_pair_batch.is_contiguous() assert index_pair.is_contiguous() assert attn_weight.is_contiguous() assert value_features.is_contiguous() b = query_batch_cnt.shap...
Generate the attention result based on: * the generated attention pair index (total_query_num, local_size); * value features (total_key_num, nhead, hdim) * attn_weight (total_query_num, local_size, nhead) Generate the attention result. * (total_query_num, nhead, hdim)
AttentionValueComputation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttentionValueComputation: """Generate the attention result based on: * the generated attention pair index (total_query_num, local_size); * value features (total_key_num, nhead, hdim) * attn_weight (total_query_num, local_size, nhead) Generate the attention result. * (total_query_num, nhead, hdim...
stack_v2_sparse_classes_75kplus_train_066156
8,019
no_license
[ { "docstring": ":param ctx: :param query_batch_cnt: A integer tensor with shape [bs], indicating the query amount for each batch. :param key_batch_cnt: A integer tensor with shape [bs], indicating the key amount of each batch. :param index_pair_batch: A integer tensor with shape [total_query_num], indicating th...
2
stack_v2_sparse_classes_30k_train_047540
Implement the Python class `AttentionValueComputation` described below. Class description: Generate the attention result based on: * the generated attention pair index (total_query_num, local_size); * value features (total_key_num, nhead, hdim) * attn_weight (total_query_num, local_size, nhead) Generate the attention ...
Implement the Python class `AttentionValueComputation` described below. Class description: Generate the attention result based on: * the generated attention pair index (total_query_num, local_size); * value features (total_key_num, nhead, hdim) * attn_weight (total_query_num, local_size, nhead) Generate the attention ...
bbc78ca91e851f0f04459b1a8bbe96ab44bf41bc
<|skeleton|> class AttentionValueComputation: """Generate the attention result based on: * the generated attention pair index (total_query_num, local_size); * value features (total_key_num, nhead, hdim) * attn_weight (total_query_num, local_size, nhead) Generate the attention result. * (total_query_num, nhead, hdim...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AttentionValueComputation: """Generate the attention result based on: * the generated attention pair index (total_query_num, local_size); * value features (total_key_num, nhead, hdim) * attn_weight (total_query_num, local_size, nhead) Generate the attention result. * (total_query_num, nhead, hdim)""" def...
the_stack_v2_python_sparse
EQNet/eqnet/ops/attention/attention_utils_v2.py
dvlab-research/DeepVision3D
train
94
6f9e1a91e170b2ce6bd3f4b5d92ea9e84f89396a
[ "value = 0\nself.alist = []\nfor v in nums:\n value += v\n self.alist.append(value)", "if i == 0:\n return self.alist[j]\nreturn self.alist[j] - self.alist[i - 1]" ]
<|body_start_0|> value = 0 self.alist = [] for v in nums: value += v self.alist.append(value) <|end_body_0|> <|body_start_1|> if i == 0: return self.alist[j] return self.alist[j] - self.alist[i - 1] <|end_body_1|>
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """initialize your data structure here. :type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """sum of elements nums[i..j], inclusive. :type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_75kplus_train_066157
855
no_license
[ { "docstring": "initialize your data structure here. :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": "sum of elements nums[i..j], inclusive. :type i: int :type j: int :rtype: int", "name": "sumRange", "signature": "def sumRange(self, ...
2
null
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): initialize your data structure here. :type nums: List[int] - def sumRange(self, i, j): sum of elements nums[i..j], inclusive. :type i: int :type j: int ...
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): initialize your data structure here. :type nums: List[int] - def sumRange(self, i, j): sum of elements nums[i..j], inclusive. :type i: int :type j: int ...
4be02e380ed1c761d54e27e1c56fbadc4f3d70c3
<|skeleton|> class NumArray: def __init__(self, nums): """initialize your data structure here. :type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """sum of elements nums[i..j], inclusive. :type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumArray: def __init__(self, nums): """initialize your data structure here. :type nums: List[int]""" value = 0 self.alist = [] for v in nums: value += v self.alist.append(value) def sumRange(self, i, j): """sum of elements nums[i..j], inclus...
the_stack_v2_python_sparse
303-Range Sum Query - Immutable.py
ymcdull/Leetcode-Solution
train
0
97dc5441dcf3a9b439a15a6f5d3b37ead429fec4
[ "\"\"\" User cannot attend events if they are not logged in \"\"\"\nif not self.request.user.is_authenticated:\n return queryset.none()\nuser_attendees = Attendee.objects.filter(user=self.request.user)\nattending_events = [attendee.event.pk for attendee in user_attendees]\nif value:\n return queryset.filter(p...
<|body_start_0|> """ User cannot attend events if they are not logged in """ if not self.request.user.is_authenticated: return queryset.none() user_attendees = Attendee.objects.filter(user=self.request.user) attending_events = [attendee.event.pk for attendee in user_attendees...
EventDateFilter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EventDateFilter: def filter_is_attendee(self, queryset, name, value): """Filter events based on if a user is attending them or not.""" <|body_0|> def filter_can_change(self, queryset, name, value): """Filter events based on if the user has permission to change them""...
stack_v2_sparse_classes_75kplus_train_066158
2,500
permissive
[ { "docstring": "Filter events based on if a user is attending them or not.", "name": "filter_is_attendee", "signature": "def filter_is_attendee(self, queryset, name, value)" }, { "docstring": "Filter events based on if the user has permission to change them", "name": "filter_can_change", ...
2
stack_v2_sparse_classes_30k_train_013683
Implement the Python class `EventDateFilter` described below. Class description: Implement the EventDateFilter class. Method signatures and docstrings: - def filter_is_attendee(self, queryset, name, value): Filter events based on if a user is attending them or not. - def filter_can_change(self, queryset, name, value)...
Implement the Python class `EventDateFilter` described below. Class description: Implement the EventDateFilter class. Method signatures and docstrings: - def filter_is_attendee(self, queryset, name, value): Filter events based on if a user is attending them or not. - def filter_can_change(self, queryset, name, value)...
6f4aca2a4522698366ecdc6ab63c807ce5df2a96
<|skeleton|> class EventDateFilter: def filter_is_attendee(self, queryset, name, value): """Filter events based on if a user is attending them or not.""" <|body_0|> def filter_can_change(self, queryset, name, value): """Filter events based on if the user has permission to change them""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EventDateFilter: def filter_is_attendee(self, queryset, name, value): """Filter events based on if a user is attending them or not.""" """ User cannot attend events if they are not logged in """ if not self.request.user.is_authenticated: return queryset.none() user_...
the_stack_v2_python_sparse
apps/events/filters.py
emilps/onlineweb4
train
0
71672e0e28716c9e616da4d1ca891c617c1b0c16
[ "response = self.client.get('/2014/12/')\nself.assertEqual(response.status_code, 200)\nself.assertContains(response, 'No post')\nself.assertQuerysetEqual(response.context['post_list'], [])", "create_post(title='first post', slug='first-post', content='test content', publish_time='2014-12-15 08:01:02')\nresponse =...
<|body_start_0|> response = self.client.get('/2014/12/') self.assertEqual(response.status_code, 200) self.assertContains(response, 'No post') self.assertQuerysetEqual(response.context['post_list'], []) <|end_body_0|> <|body_start_1|> create_post(title='first post', slug='first-p...
ArchiveListTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArchiveListTests: def test_archive_view_with_no_post(self): """Test with not post""" <|body_0|> def test_archive_view_with_one_post(self): """Test with one post""" <|body_1|> def test_archive_view_with_two_post(self): """Test with two post""" ...
stack_v2_sparse_classes_75kplus_train_066159
9,880
no_license
[ { "docstring": "Test with not post", "name": "test_archive_view_with_no_post", "signature": "def test_archive_view_with_no_post(self)" }, { "docstring": "Test with one post", "name": "test_archive_view_with_one_post", "signature": "def test_archive_view_with_one_post(self)" }, { ...
3
null
Implement the Python class `ArchiveListTests` described below. Class description: Implement the ArchiveListTests class. Method signatures and docstrings: - def test_archive_view_with_no_post(self): Test with not post - def test_archive_view_with_one_post(self): Test with one post - def test_archive_view_with_two_post...
Implement the Python class `ArchiveListTests` described below. Class description: Implement the ArchiveListTests class. Method signatures and docstrings: - def test_archive_view_with_no_post(self): Test with not post - def test_archive_view_with_one_post(self): Test with one post - def test_archive_view_with_two_post...
d3b62c9a2ca5a50b62f9a1f0385bfc11b2234bac
<|skeleton|> class ArchiveListTests: def test_archive_view_with_no_post(self): """Test with not post""" <|body_0|> def test_archive_view_with_one_post(self): """Test with one post""" <|body_1|> def test_archive_view_with_two_post(self): """Test with two post""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ArchiveListTests: def test_archive_view_with_no_post(self): """Test with not post""" response = self.client.get('/2014/12/') self.assertEqual(response.status_code, 200) self.assertContains(response, 'No post') self.assertQuerysetEqual(response.context['post_list'], []) ...
the_stack_v2_python_sparse
blog/tests.py
dengshilong/dengshilong
train
3
aa14fc261b54db9a2ab6cd09c586f1dece3d837a
[ "assert isinstance(fraction, float) and fraction > 0.0\nself.fraction = fraction\nsuper(SubsamplingStep, self).__init__(optimizer=optimizer, scope=scope, summary_labels=summary_labels)", "arguments_iter = iter(arguments.values())\nsome_argument = next(arguments_iter)\ntry:\n while not isinstance(some_argument,...
<|body_start_0|> assert isinstance(fraction, float) and fraction > 0.0 self.fraction = fraction super(SubsamplingStep, self).__init__(optimizer=optimizer, scope=scope, summary_labels=summary_labels) <|end_body_0|> <|body_start_1|> arguments_iter = iter(arguments.values()) some_a...
The subsampling-step meta optimizer randomly samples a subset of batch instances to calculate the optimization step of another optimizer.
SubsamplingStep
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubsamplingStep: """The subsampling-step meta optimizer randomly samples a subset of batch instances to calculate the optimization step of another optimizer.""" def __init__(self, optimizer, fraction=0.1, scope='subsampling-step', summary_labels=()): """Creates a new subsampling-step...
stack_v2_sparse_classes_75kplus_train_066160
4,026
permissive
[ { "docstring": "Creates a new subsampling-step meta optimizer instance. Args: optimizer: The optimizer which is modified by this meta optimizer. fraction: The fraction of instances of the batch to subsample.", "name": "__init__", "signature": "def __init__(self, optimizer, fraction=0.1, scope='subsampli...
2
stack_v2_sparse_classes_30k_train_035378
Implement the Python class `SubsamplingStep` described below. Class description: The subsampling-step meta optimizer randomly samples a subset of batch instances to calculate the optimization step of another optimizer. Method signatures and docstrings: - def __init__(self, optimizer, fraction=0.1, scope='subsampling-...
Implement the Python class `SubsamplingStep` described below. Class description: The subsampling-step meta optimizer randomly samples a subset of batch instances to calculate the optimization step of another optimizer. Method signatures and docstrings: - def __init__(self, optimizer, fraction=0.1, scope='subsampling-...
afd56f7dc73cb7f21b4ea9b7a3cd85a1c3e5eeec
<|skeleton|> class SubsamplingStep: """The subsampling-step meta optimizer randomly samples a subset of batch instances to calculate the optimization step of another optimizer.""" def __init__(self, optimizer, fraction=0.1, scope='subsampling-step', summary_labels=()): """Creates a new subsampling-step...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SubsamplingStep: """The subsampling-step meta optimizer randomly samples a subset of batch instances to calculate the optimization step of another optimizer.""" def __init__(self, optimizer, fraction=0.1, scope='subsampling-step', summary_labels=()): """Creates a new subsampling-step meta optimiz...
the_stack_v2_python_sparse
tensorforce/core/optimizers/subsampling_step.py
miskolc/tensorforce
train
1
c62c2f563f3c36428319d5c13bb0644237e3ebd4
[ "super(LoopyBeliefUpdateInference, self).__init__(model)\nself._update_order = update_order\nself._damping = damping\nself._callback = callback", "old_separator = self._separator_potential[edge]\nvariables_to_keep = old_separator.variable_set\nbelief0 = self.beliefs[edge[0]]\nbelief1 = self.beliefs[edge[1]]\nnew_...
<|body_start_0|> super(LoopyBeliefUpdateInference, self).__init__(model) self._update_order = update_order self._damping = damping self._callback = callback <|end_body_0|> <|body_start_1|> old_separator = self._separator_potential[edge] variables_to_keep = old_separator....
An inference object to calibrate the potentials.
LoopyBeliefUpdateInference
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoopyBeliefUpdateInference: """An inference object to calibrate the potentials.""" def __init__(self, model, update_order=None, damping=0.0, callback=None): """Constructor. :param model: The model. :param update_order: A message update protocol. If `None`, `FloodingProtocol` is used....
stack_v2_sparse_classes_75kplus_train_066161
18,882
permissive
[ { "docstring": "Constructor. :param model: The model. :param update_order: A message update protocol. If `None`, `FloodingProtocol` is used. :param damping: The damping to use on each iteration. :param callback: A function to call with (the inference object, update order object) as parameters whenever the updat...
3
stack_v2_sparse_classes_30k_train_025523
Implement the Python class `LoopyBeliefUpdateInference` described below. Class description: An inference object to calibrate the potentials. Method signatures and docstrings: - def __init__(self, model, update_order=None, damping=0.0, callback=None): Constructor. :param model: The model. :param update_order: A messag...
Implement the Python class `LoopyBeliefUpdateInference` described below. Class description: An inference object to calibrate the potentials. Method signatures and docstrings: - def __init__(self, model, update_order=None, damping=0.0, callback=None): Constructor. :param model: The model. :param update_order: A messag...
445b2cf8736a4a28cff2b074a32afe8fe6986d53
<|skeleton|> class LoopyBeliefUpdateInference: """An inference object to calibrate the potentials.""" def __init__(self, model, update_order=None, damping=0.0, callback=None): """Constructor. :param model: The model. :param update_order: A message update protocol. If `None`, `FloodingProtocol` is used....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LoopyBeliefUpdateInference: """An inference object to calibrate the potentials.""" def __init__(self, model, update_order=None, damping=0.0, callback=None): """Constructor. :param model: The model. :param update_order: A message update protocol. If `None`, `FloodingProtocol` is used. :param dampi...
the_stack_v2_python_sparse
Statistical_methods/LoopyBeliefPropagation/pyugm/infer_message.py
WN1695173791/Background-Subtraction-Unsupervised-Learning
train
1
10618d8a39ddf338bb856a86dfe491a24df399fb
[ "super(LocationReader, self).__init__(*args, **kwargs)\nself.location_indexes = []\nself.chromosome_list = []\nif 'chromosome_list' in kwargs.keys():\n self.chromosome_list = kwargs['chromosome_list']\nself.labels = [None, None, None]\nif 'label_chr' in kwargs.keys():\n self.labels[0] = kwargs['label_chr']\ni...
<|body_start_0|> super(LocationReader, self).__init__(*args, **kwargs) self.location_indexes = [] self.chromosome_list = [] if 'chromosome_list' in kwargs.keys(): self.chromosome_list = kwargs['chromosome_list'] self.labels = [None, None, None] if 'label_chr' ...
LocationReader adds location data to a header. Wraps a table object associate a Location to the values.
LocationReader
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocationReader: """LocationReader adds location data to a header. Wraps a table object associate a Location to the values.""" def __init__(self, *args, **kwargs): """__init__ creates a new LocationParser.""" <|body_0|> def next(self): """Return the next element."...
stack_v2_sparse_classes_75kplus_train_066162
5,320
permissive
[ { "docstring": "__init__ creates a new LocationParser.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Return the next element.", "name": "next", "signature": "def next(self)" } ]
2
stack_v2_sparse_classes_30k_val_000839
Implement the Python class `LocationReader` described below. Class description: LocationReader adds location data to a header. Wraps a table object associate a Location to the values. Method signatures and docstrings: - def __init__(self, *args, **kwargs): __init__ creates a new LocationParser. - def next(self): Retu...
Implement the Python class `LocationReader` described below. Class description: LocationReader adds location data to a header. Wraps a table object associate a Location to the values. Method signatures and docstrings: - def __init__(self, *args, **kwargs): __init__ creates a new LocationParser. - def next(self): Retu...
bbf7ca288d798d8f1c6156ddf45fed31892bd557
<|skeleton|> class LocationReader: """LocationReader adds location data to a header. Wraps a table object associate a Location to the values.""" def __init__(self, *args, **kwargs): """__init__ creates a new LocationParser.""" <|body_0|> def next(self): """Return the next element."...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LocationReader: """LocationReader adds location data to a header. Wraps a table object associate a Location to the values.""" def __init__(self, *args, **kwargs): """__init__ creates a new LocationParser.""" super(LocationReader, self).__init__(*args, **kwargs) self.location_index...
the_stack_v2_python_sparse
table/Location/reader.py
DenverN3/Nimbus
train
0
88f7a4cb5d9b595d2dd4dc809c66f9a96c2c6041
[ "gemGenericTree.__init__(self, name=treeName, description=description)\nself.dacValX = array('f', [0])\nself.gemTree.Branch('dacValX', self.dacValX, 'dacValX/F')\nself.nameX = r.vector('string')()\nself.nameX.push_back(nameX)\nself.gemTree.Branch('nameX', self.nameX)\nself.rate = array('d', [0.0])\nself.gemTree.Bra...
<|body_start_0|> gemGenericTree.__init__(self, name=treeName, description=description) self.dacValX = array('f', [0]) self.gemTree.Branch('dacValX', self.dacValX, 'dacValX/F') self.nameX = r.vector('string')() self.nameX.push_back(nameX) self.gemTree.Branch('nameX', self....
gemSbitRateTreeStructure
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class gemSbitRateTreeStructure: def __init__(self, nameX, treeName='rateTree', description='Generic GEM Tree for measuring SBIT Rate vs. Arbitrary Registers'): """nameX Name of the register being scanned against, e.g. 'CFG_THR_ARM_DAC' treeName TName of the TTree description Phrase describing ...
stack_v2_sparse_classes_75kplus_train_066163
19,956
permissive
[ { "docstring": "nameX Name of the register being scanned against, e.g. 'CFG_THR_ARM_DAC' treeName TName of the TTree description Phrase describing the TTree", "name": "__init__", "signature": "def __init__(self, nameX, treeName='rateTree', description='Generic GEM Tree for measuring SBIT Rate vs. Arbitr...
2
stack_v2_sparse_classes_30k_train_048690
Implement the Python class `gemSbitRateTreeStructure` described below. Class description: Implement the gemSbitRateTreeStructure class. Method signatures and docstrings: - def __init__(self, nameX, treeName='rateTree', description='Generic GEM Tree for measuring SBIT Rate vs. Arbitrary Registers'): nameX Name of the ...
Implement the Python class `gemSbitRateTreeStructure` described below. Class description: Implement the gemSbitRateTreeStructure class. Method signatures and docstrings: - def __init__(self, nameX, treeName='rateTree', description='Generic GEM Tree for measuring SBIT Rate vs. Arbitrary Registers'): nameX Name of the ...
6259740f3deb6c11123b6c6d9c70f3a6c58abe59
<|skeleton|> class gemSbitRateTreeStructure: def __init__(self, nameX, treeName='rateTree', description='Generic GEM Tree for measuring SBIT Rate vs. Arbitrary Registers'): """nameX Name of the register being scanned against, e.g. 'CFG_THR_ARM_DAC' treeName TName of the TTree description Phrase describing ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class gemSbitRateTreeStructure: def __init__(self, nameX, treeName='rateTree', description='Generic GEM Tree for measuring SBIT Rate vs. Arbitrary Registers'): """nameX Name of the register being scanned against, e.g. 'CFG_THR_ARM_DAC' treeName TName of the TTree description Phrase describing the TTree""" ...
the_stack_v2_python_sparse
utils/treeStructure.py
cms-gem-daq-project/vfatqc-python-scripts
train
1
c87ba6ad7088bdda68e193c1a19e0d1d1ea3d5c4
[ "logger.info('Overriding class: Optimizer -> GWO.')\nsuper(GWO, self).__init__()\nself.build(params)\nlogger.info('Class overrided.')", "r1 = r.generate_uniform_random_number()\nr2 = r.generate_uniform_random_number()\nA = 2 * a * r1 - a\nC = 2 * r2\nreturn (A, C)", "space.agents.sort(key=lambda x: x.fit)\nalph...
<|body_start_0|> logger.info('Overriding class: Optimizer -> GWO.') super(GWO, self).__init__() self.build(params) logger.info('Class overrided.') <|end_body_0|> <|body_start_1|> r1 = r.generate_uniform_random_number() r2 = r.generate_uniform_random_number() A = ...
A GWO class, inherited from Optimizer. This is the designed class to define GWO-related variables and methods. References: S. Mirjalili, S. Mirjalili and A. Lewis. Grey Wolf Optimizer. Advances in Engineering Software (2014).
GWO
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GWO: """A GWO class, inherited from Optimizer. This is the designed class to define GWO-related variables and methods. References: S. Mirjalili, S. Mirjalili and A. Lewis. Grey Wolf Optimizer. Advances in Engineering Software (2014).""" def __init__(self, params=None): """Initializat...
stack_v2_sparse_classes_75kplus_train_066164
3,452
permissive
[ { "docstring": "Initialization method. Args: params (dict): Contains key-value parameters to the meta-heuristics.", "name": "__init__", "signature": "def __init__(self, params=None)" }, { "docstring": "Calculates the mathematical coefficients. Args: a (float): Linear constant. Returns: Both `A` ...
3
stack_v2_sparse_classes_30k_train_007165
Implement the Python class `GWO` described below. Class description: A GWO class, inherited from Optimizer. This is the designed class to define GWO-related variables and methods. References: S. Mirjalili, S. Mirjalili and A. Lewis. Grey Wolf Optimizer. Advances in Engineering Software (2014). Method signatures and d...
Implement the Python class `GWO` described below. Class description: A GWO class, inherited from Optimizer. This is the designed class to define GWO-related variables and methods. References: S. Mirjalili, S. Mirjalili and A. Lewis. Grey Wolf Optimizer. Advances in Engineering Software (2014). Method signatures and d...
09e5485b9e30eca622ad404e85c22de0c42c8abd
<|skeleton|> class GWO: """A GWO class, inherited from Optimizer. This is the designed class to define GWO-related variables and methods. References: S. Mirjalili, S. Mirjalili and A. Lewis. Grey Wolf Optimizer. Advances in Engineering Software (2014).""" def __init__(self, params=None): """Initializat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GWO: """A GWO class, inherited from Optimizer. This is the designed class to define GWO-related variables and methods. References: S. Mirjalili, S. Mirjalili and A. Lewis. Grey Wolf Optimizer. Advances in Engineering Software (2014).""" def __init__(self, params=None): """Initialization method. A...
the_stack_v2_python_sparse
opytimizer/optimizers/population/gwo.py
himanshuRepo/opytimizer
train
0
77bb74909fd0bd4be3d2549aa6d416b55afd0a83
[ "try:\n token = get_source_token(request)\n data = get_process_info_data('downloads', ticket_number)\n process_token_validation(hash_tokens(token), data, 'presqt-source-token')\nexcept PresQTValidationError as e:\n return Response(data={'error': e.data}, status=e.status_code)\nif response_format and res...
<|body_start_0|> try: token = get_source_token(request) data = get_process_info_data('downloads', ticket_number) process_token_validation(hash_tokens(token), data, 'presqt-source-token') except PresQTValidationError as e: return Response(data={'error': e.d...
**Supported HTTP Methods** * GET: - Check if a resource download is finished on the server matching the ticket number. If the download is pending, failed, or the response_format is 'json' then return a JSON representation of the state. Otherwise return the file contents. * PATCH: - Cancel the resource download process ...
DownloadJob
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DownloadJob: """**Supported HTTP Methods** * GET: - Check if a resource download is finished on the server matching the ticket number. If the download is pending, failed, or the response_format is 'json' then return a JSON representation of the state. Otherwise return the file contents. * PATCH: ...
stack_v2_sparse_classes_75kplus_train_066165
8,223
permissive
[ { "docstring": "Check in on the resource's download process state. Parameters ---------- ticket_number : str The ticket number of the download being prepared. response_format: str The type of response to return. Either json or zip Returns ------- 200: OK Returns the zip of resources to be downloaded. or { \"sta...
2
stack_v2_sparse_classes_30k_train_021603
Implement the Python class `DownloadJob` described below. Class description: **Supported HTTP Methods** * GET: - Check if a resource download is finished on the server matching the ticket number. If the download is pending, failed, or the response_format is 'json' then return a JSON representation of the state. Otherw...
Implement the Python class `DownloadJob` described below. Class description: **Supported HTTP Methods** * GET: - Check if a resource download is finished on the server matching the ticket number. If the download is pending, failed, or the response_format is 'json' then return a JSON representation of the state. Otherw...
b920527bf8998696f516d65a50f0a5c3862c4558
<|skeleton|> class DownloadJob: """**Supported HTTP Methods** * GET: - Check if a resource download is finished on the server matching the ticket number. If the download is pending, failed, or the response_format is 'json' then return a JSON representation of the state. Otherwise return the file contents. * PATCH: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DownloadJob: """**Supported HTTP Methods** * GET: - Check if a resource download is finished on the server matching the ticket number. If the download is pending, failed, or the response_format is 'json' then return a JSON representation of the state. Otherwise return the file contents. * PATCH: - Cancel the ...
the_stack_v2_python_sparse
presqt/api_v1/views/download/download_job.py
craig-willis/presqt
train
0
720028f5b2238451a7b85a406bc48c94fc0c7aa0
[ "super(LSTMAttention, self).__init__()\nself.input_size = input_size\nself.hidden_size = hidden_size\nself.batch_first = batch_first\nself.lstm_cell = nn.LSTMCell(input_size, hidden_size)\nif attn_type == 'soft':\n self.attention_layer = SoftDotAttention(hidden_size)\nelif attn_type == 'mlp':\n self.attention...
<|body_start_0|> super(LSTMAttention, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.batch_first = batch_first self.lstm_cell = nn.LSTMCell(input_size, hidden_size) if attn_type == 'soft': self.attention_layer = SoftDotAttent...
A long short-term memory (LSTM) cell with attention.
LSTMAttention
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LSTMAttention: """A long short-term memory (LSTM) cell with attention.""" def __init__(self, input_size, hidden_size, batch_first=True, attn_type='soft'): """Initialize params.""" <|body_0|> def forward(self, input, hidden, ctx, ctx_mask=None): """Propogate input...
stack_v2_sparse_classes_75kplus_train_066166
23,258
permissive
[ { "docstring": "Initialize params.", "name": "__init__", "signature": "def __init__(self, input_size, hidden_size, batch_first=True, attn_type='soft')" }, { "docstring": "Propogate input through the network.", "name": "forward", "signature": "def forward(self, input, hidden, ctx, ctx_mas...
2
stack_v2_sparse_classes_30k_train_049868
Implement the Python class `LSTMAttention` described below. Class description: A long short-term memory (LSTM) cell with attention. Method signatures and docstrings: - def __init__(self, input_size, hidden_size, batch_first=True, attn_type='soft'): Initialize params. - def forward(self, input, hidden, ctx, ctx_mask=N...
Implement the Python class `LSTMAttention` described below. Class description: A long short-term memory (LSTM) cell with attention. Method signatures and docstrings: - def __init__(self, input_size, hidden_size, batch_first=True, attn_type='soft'): Initialize params. - def forward(self, input, hidden, ctx, ctx_mask=N...
37e04d08f47d64dd2cf6bb280c26fb5887c91686
<|skeleton|> class LSTMAttention: """A long short-term memory (LSTM) cell with attention.""" def __init__(self, input_size, hidden_size, batch_first=True, attn_type='soft'): """Initialize params.""" <|body_0|> def forward(self, input, hidden, ctx, ctx_mask=None): """Propogate input...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LSTMAttention: """A long short-term memory (LSTM) cell with attention.""" def __init__(self, input_size, hidden_size, batch_first=True, attn_type='soft'): """Initialize params.""" super(LSTMAttention, self).__init__() self.input_size = input_size self.hidden_size = hidden_...
the_stack_v2_python_sparse
trankit/layers/seq2seq.py
nlp-uoregon/trankit
train
731
7b6a5b759b27157c47385b419291b0d40a151db4
[ "gid = request.GET.get('gid', None)\ng = Group.objects.get(pk=gid)\ng_obj = g.user_set.all()\nreturn render(request, 'users/group/group_user.html', {'group_user': g_obj, 'g': g})", "ret = {'status': 0}\nuid = QueryDict(request.body).get('uid', None)\ngid = QueryDict(request.body).get('gid', None)\ntry:\n user_...
<|body_start_0|> gid = request.GET.get('gid', None) g = Group.objects.get(pk=gid) g_obj = g.user_set.all() return render(request, 'users/group/group_user.html', {'group_user': g_obj, 'g': g}) <|end_body_0|> <|body_start_1|> ret = {'status': 0} uid = QueryDict(request.bod...
GroupGrouplistView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupGrouplistView: def get(self, request): """展示用户组内成员""" <|body_0|> def delete(self, request): """删除组内成员""" <|body_1|> <|end_skeleton|> <|body_start_0|> gid = request.GET.get('gid', None) g = Group.objects.get(pk=gid) g_obj = g.use...
stack_v2_sparse_classes_75kplus_train_066167
12,839
no_license
[ { "docstring": "展示用户组内成员", "name": "get", "signature": "def get(self, request)" }, { "docstring": "删除组内成员", "name": "delete", "signature": "def delete(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_053097
Implement the Python class `GroupGrouplistView` described below. Class description: Implement the GroupGrouplistView class. Method signatures and docstrings: - def get(self, request): 展示用户组内成员 - def delete(self, request): 删除组内成员
Implement the Python class `GroupGrouplistView` described below. Class description: Implement the GroupGrouplistView class. Method signatures and docstrings: - def get(self, request): 展示用户组内成员 - def delete(self, request): 删除组内成员 <|skeleton|> class GroupGrouplistView: def get(self, request): """展示用户组内成员"...
fc565af20312410214dec638e85fc35fc85eef2d
<|skeleton|> class GroupGrouplistView: def get(self, request): """展示用户组内成员""" <|body_0|> def delete(self, request): """删除组内成员""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GroupGrouplistView: def get(self, request): """展示用户组内成员""" gid = request.GET.get('gid', None) g = Group.objects.get(pk=gid) g_obj = g.user_set.all() return render(request, 'users/group/group_user.html', {'group_user': g_obj, 'g': g}) def delete(self, request): ...
the_stack_v2_python_sparse
accounts/views.py
xiaoyaolaotou/Devops
train
6
c3fd98ca23fccea5c87d78b8c5c1aa2b36d57dde
[ "self.long = long * CSTE_DEG_RAD\nself.cola = cola * CSTE_DEG_RAD\nself.x = RAYON_PLANETE * sin(self.cola) * cos(self.long)\nself.y = RAYON_PLANETE * sin(self.cola) * sin(self.long)\nself.z = RAYON_PLANETE * cos(self.cola)", "x_dist = self.x - sat.x\ny_dist = self.y - sat.y\nz_dist = self.z - sat.z\nreturn hypot3...
<|body_start_0|> self.long = long * CSTE_DEG_RAD self.cola = cola * CSTE_DEG_RAD self.x = RAYON_PLANETE * sin(self.cola) * cos(self.long) self.y = RAYON_PLANETE * sin(self.cola) * sin(self.long) self.z = RAYON_PLANETE * cos(self.cola) <|end_body_0|> <|body_start_1|> x_di...
Point
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Point: def __init__(self, cola, long): """Initialise un point (en fonction des paramètres donnés)""" <|body_0|> def distance(self, sat): """Retourne le distance entre le ppoint et le satellite""" <|body_1|> def detecté(self, satellites): """Dit s...
stack_v2_sparse_classes_75kplus_train_066168
4,825
no_license
[ { "docstring": "Initialise un point (en fonction des paramètres donnés)", "name": "__init__", "signature": "def __init__(self, cola, long)" }, { "docstring": "Retourne le distance entre le ppoint et le satellite", "name": "distance", "signature": "def distance(self, sat)" }, { "d...
3
stack_v2_sparse_classes_30k_train_041050
Implement the Python class `Point` described below. Class description: Implement the Point class. Method signatures and docstrings: - def __init__(self, cola, long): Initialise un point (en fonction des paramètres donnés) - def distance(self, sat): Retourne le distance entre le ppoint et le satellite - def detecté(se...
Implement the Python class `Point` described below. Class description: Implement the Point class. Method signatures and docstrings: - def __init__(self, cola, long): Initialise un point (en fonction des paramètres donnés) - def distance(self, sat): Retourne le distance entre le ppoint et le satellite - def detecté(se...
bb90efcbb3383a5168d77809bc8b05e790dedece
<|skeleton|> class Point: def __init__(self, cola, long): """Initialise un point (en fonction des paramètres donnés)""" <|body_0|> def distance(self, sat): """Retourne le distance entre le ppoint et le satellite""" <|body_1|> def detecté(self, satellites): """Dit s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Point: def __init__(self, cola, long): """Initialise un point (en fonction des paramètres donnés)""" self.long = long * CSTE_DEG_RAD self.cola = cola * CSTE_DEG_RAD self.x = RAYON_PLANETE * sin(self.cola) * cos(self.long) self.y = RAYON_PLANETE * sin(self.cola) * sin(se...
the_stack_v2_python_sparse
Python/TIPE/TIPE v.SPE.2.0.py
Solenoide420/Projects
train
0
85c92667f174749c2d68e710f2fce59dc1338007
[ "self.plugin = OpticalFlow(iterations=20)\nself.plugin.boxsize = 3\nself.smoothing_kernel = 3\nrainfall_block = np.array([[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 2.0, 2.0, 2.0, 2.0, 1.0, 1.0], [1.0, 2.0, 3.0, 3.0, 2.0, 1.0, 1.0], [1.0, 2.0, 3.0, 3.0, 2.0, 1.0, 1.0], [1.0, 2.0, 2.0, 2.0, 2.0, 1.0, 1.0], [1.0, 1.0...
<|body_start_0|> self.plugin = OpticalFlow(iterations=20) self.plugin.boxsize = 3 self.smoothing_kernel = 3 rainfall_block = np.array([[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 2.0, 2.0, 2.0, 2.0, 1.0, 1.0], [1.0, 2.0, 3.0, 3.0, 2.0, 1.0, 1.0], [1.0, 2.0, 3.0, 3.0, 2.0, 1.0, 1.0], [1.0,...
Test the process_dimensionless method
Test_process_dimensionless
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_process_dimensionless: """Test the process_dimensionless method""" def setUp(self): """Set up plugin options and input rainfall-like matrices that produce non-singular outputs. Large matrices with zeros are needed for the smoothing algorithms to behave sensibly.""" <|bod...
stack_v2_sparse_classes_75kplus_train_066169
37,677
permissive
[ { "docstring": "Set up plugin options and input rainfall-like matrices that produce non-singular outputs. Large matrices with zeros are needed for the smoothing algorithms to behave sensibly.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test outputs are of the correct typ...
3
null
Implement the Python class `Test_process_dimensionless` described below. Class description: Test the process_dimensionless method Method signatures and docstrings: - def setUp(self): Set up plugin options and input rainfall-like matrices that produce non-singular outputs. Large matrices with zeros are needed for the ...
Implement the Python class `Test_process_dimensionless` described below. Class description: Test the process_dimensionless method Method signatures and docstrings: - def setUp(self): Set up plugin options and input rainfall-like matrices that produce non-singular outputs. Large matrices with zeros are needed for the ...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_process_dimensionless: """Test the process_dimensionless method""" def setUp(self): """Set up plugin options and input rainfall-like matrices that produce non-singular outputs. Large matrices with zeros are needed for the smoothing algorithms to behave sensibly.""" <|bod...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test_process_dimensionless: """Test the process_dimensionless method""" def setUp(self): """Set up plugin options and input rainfall-like matrices that produce non-singular outputs. Large matrices with zeros are needed for the smoothing algorithms to behave sensibly.""" self.plugin = Opti...
the_stack_v2_python_sparse
improver_tests/nowcasting/optical_flow/test_OpticalFlow.py
metoppv/improver
train
101
cfb257a209e5983c57a763ba7e8263885234e9df
[ "messenger = kwargs['messenger']\nuser = kwargs['user']\nis_online = messenger.is_user_online(user)\nself.response({'online': is_online}, 200)", "messenger = kwargs['messenger']\nuser = kwargs['user']\ncount = messenger.send_to_user(user, self.request.body)\nself.response({'count': count})\nlogger.debug('Message ...
<|body_start_0|> messenger = kwargs['messenger'] user = kwargs['user'] is_online = messenger.is_user_online(user) self.response({'online': is_online}, 200) <|end_body_0|> <|body_start_1|> messenger = kwargs['messenger'] user = kwargs['user'] count = messenger.sen...
UserHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserHandler: def get(self, *args, **kwargs): """Retrieves the number of users online.""" <|body_0|> def post(self, *args, **kwargs): """Sends a message to a user.""" <|body_1|> def delete(self, *args, **kwargs): """Forces logout of a user.""" ...
stack_v2_sparse_classes_75kplus_train_066170
31,754
no_license
[ { "docstring": "Retrieves the number of users online.", "name": "get", "signature": "def get(self, *args, **kwargs)" }, { "docstring": "Sends a message to a user.", "name": "post", "signature": "def post(self, *args, **kwargs)" }, { "docstring": "Forces logout of a user.", "n...
3
null
Implement the Python class `UserHandler` described below. Class description: Implement the UserHandler class. Method signatures and docstrings: - def get(self, *args, **kwargs): Retrieves the number of users online. - def post(self, *args, **kwargs): Sends a message to a user. - def delete(self, *args, **kwargs): For...
Implement the Python class `UserHandler` described below. Class description: Implement the UserHandler class. Method signatures and docstrings: - def get(self, *args, **kwargs): Retrieves the number of users online. - def post(self, *args, **kwargs): Sends a message to a user. - def delete(self, *args, **kwargs): For...
0ac6653219c2701c13c508c5c4fc9bc3437eea06
<|skeleton|> class UserHandler: def get(self, *args, **kwargs): """Retrieves the number of users online.""" <|body_0|> def post(self, *args, **kwargs): """Sends a message to a user.""" <|body_1|> def delete(self, *args, **kwargs): """Forces logout of a user.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserHandler: def get(self, *args, **kwargs): """Retrieves the number of users online.""" messenger = kwargs['messenger'] user = kwargs['user'] is_online = messenger.is_user_online(user) self.response({'online': is_online}, 200) def post(self, *args, **kwargs): ...
the_stack_v2_python_sparse
repoData/thunderpush-thunderpush/allPythonContent.py
aCoffeeYin/pyreco
train
0
a32e084117fb7e11b2c48299039cdee330adbd71
[ "self.nom = nom\nself.intervalles = intervalles\nself.myScale = ()", "for valeur in self.intervalles:\n if valeur == 2:\n print('1 ton')\n else:\n print('1/2 ton')", "idx = notes.index(debut)\nfor valeur in self.intervalles:\n idx = idx + valeur\n idx = idx % 12\n self.myScale = sel...
<|body_start_0|> self.nom = nom self.intervalles = intervalles self.myScale = () <|end_body_0|> <|body_start_1|> for valeur in self.intervalles: if valeur == 2: print('1 ton') else: print('1/2 ton') <|end_body_1|> <|body_start_2|>...
gamme
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class gamme: def __init__(self, nom, intervalles): """Nom de la gamme, majeure, mineure, etc. et ces intervalles.""" <|body_0|> def inter(self): """Affichage des intervalles""" <|body_1|> def tone(self, debut): """Construction de la gamme""" <|...
stack_v2_sparse_classes_75kplus_train_066171
3,586
no_license
[ { "docstring": "Nom de la gamme, majeure, mineure, etc. et ces intervalles.", "name": "__init__", "signature": "def __init__(self, nom, intervalles)" }, { "docstring": "Affichage des intervalles", "name": "inter", "signature": "def inter(self)" }, { "docstring": "Construction de ...
3
stack_v2_sparse_classes_30k_train_010119
Implement the Python class `gamme` described below. Class description: Implement the gamme class. Method signatures and docstrings: - def __init__(self, nom, intervalles): Nom de la gamme, majeure, mineure, etc. et ces intervalles. - def inter(self): Affichage des intervalles - def tone(self, debut): Construction de ...
Implement the Python class `gamme` described below. Class description: Implement the gamme class. Method signatures and docstrings: - def __init__(self, nom, intervalles): Nom de la gamme, majeure, mineure, etc. et ces intervalles. - def inter(self): Affichage des intervalles - def tone(self, debut): Construction de ...
51620d80a53c8e47c1b3d9eb3e5422ae0649a867
<|skeleton|> class gamme: def __init__(self, nom, intervalles): """Nom de la gamme, majeure, mineure, etc. et ces intervalles.""" <|body_0|> def inter(self): """Affichage des intervalles""" <|body_1|> def tone(self, debut): """Construction de la gamme""" <|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class gamme: def __init__(self, nom, intervalles): """Nom de la gamme, majeure, mineure, etc. et ces intervalles.""" self.nom = nom self.intervalles = intervalles self.myScale = () def inter(self): """Affichage des intervalles""" for valeur in self.intervalles: ...
the_stack_v2_python_sparse
guitar/gamme.py
parmentelat/moocpython
train
17
18a0223bd9bb75b7737e7b052e28ba1f4a9117d5
[ "if params.get('alert_type'):\n if params['alert_type'] not in ['error', 'warning', 'info', 'success']:\n raise ApiError('Parameter alert_type must be either error, warning, info or success')\nreturn super(Event, cls).create(attach_host_name=attach_host_name, **params)", "def timestamp_to_integer(k, v):...
<|body_start_0|> if params.get('alert_type'): if params['alert_type'] not in ['error', 'warning', 'info', 'success']: raise ApiError('Parameter alert_type must be either error, warning, info or success') return super(Event, cls).create(attach_host_name=attach_host_name, **par...
A wrapper around Event HTTP API.
Event
[ "Apache-2.0", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Event: """A wrapper around Event HTTP API.""" def create(cls, attach_host_name=True, **params): """Post an event. :param title: title for the new event :type title: string :param text: event message :type text: string :param aggregation_key: key by which to group events in event stre...
stack_v2_sparse_classes_75kplus_train_066172
3,376
permissive
[ { "docstring": "Post an event. :param title: title for the new event :type title: string :param text: event message :type text: string :param aggregation_key: key by which to group events in event stream :type aggregation_key: string :param alert_type: \"error\", \"warning\", \"info\" or \"success\". :type aler...
2
stack_v2_sparse_classes_30k_train_024077
Implement the Python class `Event` described below. Class description: A wrapper around Event HTTP API. Method signatures and docstrings: - def create(cls, attach_host_name=True, **params): Post an event. :param title: title for the new event :type title: string :param text: event message :type text: string :param ag...
Implement the Python class `Event` described below. Class description: A wrapper around Event HTTP API. Method signatures and docstrings: - def create(cls, attach_host_name=True, **params): Post an event. :param title: title for the new event :type title: string :param text: event message :type text: string :param ag...
11a38d0c8d6b156758e7500500d706b7159d18ed
<|skeleton|> class Event: """A wrapper around Event HTTP API.""" def create(cls, attach_host_name=True, **params): """Post an event. :param title: title for the new event :type title: string :param text: event message :type text: string :param aggregation_key: key by which to group events in event stre...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Event: """A wrapper around Event HTTP API.""" def create(cls, attach_host_name=True, **params): """Post an event. :param title: title for the new event :type title: string :param text: event message :type text: string :param aggregation_key: key by which to group events in event stream :type aggr...
the_stack_v2_python_sparse
datadog/api/events.py
DataDog/datadogpy
train
602
318c2b630d4160945c7c93b5968e91e28e6a0e46
[ "tmp = nums[:len(nums) - k]\nnums[:len(nums) - k] = []\nnums += tmp", "tmp = nums[len(nums) - k:]\nnums[len(nums) - k:] = []\nnums[:0] = tmp", "k %= len(nums)\ntmp = nums * 2\ndel nums[:]\nnums[:] = tmp[len(nums) - k:2 * len(nums) - k]", "k %= len(nums)\nnums.reverse()\nnums[:k] = reversed(nums[:k])\nnums[k:]...
<|body_start_0|> tmp = nums[:len(nums) - k] nums[:len(nums) - k] = [] nums += tmp <|end_body_0|> <|body_start_1|> tmp = nums[len(nums) - k:] nums[len(nums) - k:] = [] nums[:0] = tmp <|end_body_1|> <|body_start_2|> k %= len(nums) tmp = nums * 2 de...
Do not return anything, modify nums in-place instead.
Solution
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Do not return anything, modify nums in-place instead.""" def rotate1(self, nums, k): """move the first term (52ms)""" <|body_0|> def rotate2(self, nums, k): """move the last term (52ms)""" <|body_1|> def rotate3(self, nums, k): "...
stack_v2_sparse_classes_75kplus_train_066173
2,073
permissive
[ { "docstring": "move the first term (52ms)", "name": "rotate1", "signature": "def rotate1(self, nums, k)" }, { "docstring": "move the last term (52ms)", "name": "rotate2", "signature": "def rotate2(self, nums, k)" }, { "docstring": "copy the list (56ms)", "name": "rotate3", ...
5
stack_v2_sparse_classes_30k_train_051418
Implement the Python class `Solution` described below. Class description: Do not return anything, modify nums in-place instead. Method signatures and docstrings: - def rotate1(self, nums, k): move the first term (52ms) - def rotate2(self, nums, k): move the last term (52ms) - def rotate3(self, nums, k): copy the list...
Implement the Python class `Solution` described below. Class description: Do not return anything, modify nums in-place instead. Method signatures and docstrings: - def rotate1(self, nums, k): move the first term (52ms) - def rotate2(self, nums, k): move the last term (52ms) - def rotate3(self, nums, k): copy the list...
49a0b03c55d8a702785888d473ef96539265ce9c
<|skeleton|> class Solution: """Do not return anything, modify nums in-place instead.""" def rotate1(self, nums, k): """move the first term (52ms)""" <|body_0|> def rotate2(self, nums, k): """move the last term (52ms)""" <|body_1|> def rotate3(self, nums, k): "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """Do not return anything, modify nums in-place instead.""" def rotate1(self, nums, k): """move the first term (52ms)""" tmp = nums[:len(nums) - k] nums[:len(nums) - k] = [] nums += tmp def rotate2(self, nums, k): """move the last term (52ms)""" ...
the_stack_v2_python_sparse
leetcode/0189_rotate_array.py
chaosWsF/Python-Practice
train
1
4d049e638b60c678137b6a7d85543dce34a9d82f
[ "super().__init__(value, msg_id, msg_args)\nself._than = kwargs.get('than', 0.0)\nself._msg_args.update({'than': str(self._than)})", "if self._value is None:\n return\nNumber().validate(self._value)\nif float(self._value) >= float(self._than):\n raise _error.RuleError(self._msg_id, self._msg_args)" ]
<|body_start_0|> super().__init__(value, msg_id, msg_args) self._than = kwargs.get('than', 0.0) self._msg_args.update({'than': str(self._than)}) <|end_body_0|> <|body_start_1|> if self._value is None: return Number().validate(self._value) if float(self._value...
Less
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Less: def __init__(self, value: float=None, msg_id: str=None, msg_args: dict=None, **kwargs): """Init.""" <|body_0|> def _do_validate(self): """Do actual validation of the rule.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__(value,...
stack_v2_sparse_classes_75kplus_train_066174
15,784
permissive
[ { "docstring": "Init.", "name": "__init__", "signature": "def __init__(self, value: float=None, msg_id: str=None, msg_args: dict=None, **kwargs)" }, { "docstring": "Do actual validation of the rule.", "name": "_do_validate", "signature": "def _do_validate(self)" } ]
2
null
Implement the Python class `Less` described below. Class description: Implement the Less class. Method signatures and docstrings: - def __init__(self, value: float=None, msg_id: str=None, msg_args: dict=None, **kwargs): Init. - def _do_validate(self): Do actual validation of the rule.
Implement the Python class `Less` described below. Class description: Implement the Less class. Method signatures and docstrings: - def __init__(self, value: float=None, msg_id: str=None, msg_args: dict=None, **kwargs): Init. - def _do_validate(self): Do actual validation of the rule. <|skeleton|> class Less: d...
e4896722709607bda88b4a69400dcde4bf7e5f0a
<|skeleton|> class Less: def __init__(self, value: float=None, msg_id: str=None, msg_args: dict=None, **kwargs): """Init.""" <|body_0|> def _do_validate(self): """Do actual validation of the rule.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Less: def __init__(self, value: float=None, msg_id: str=None, msg_args: dict=None, **kwargs): """Init.""" super().__init__(value, msg_id, msg_args) self._than = kwargs.get('than', 0.0) self._msg_args.update({'than': str(self._than)}) def _do_validate(self): """Do a...
the_stack_v2_python_sparse
pytsite/validation/_rule.py
pytsite/pytsite
train
12
9fdc965a8da50427be46cfc887b7949c7913fa02
[ "TaskManager.__init__(self)\nif task_result_timeout is None:\n task_result_timeout = 0\ntask.props[_KEY_DYNAMIC_TARGETS] = dynamic_targets\ntask.props[_KEY_TASK_RESULT_TIMEOUT] = task_result_timeout\ntask.props[_KEY_SEND_TARGET_COUNTS] = {}\ntask.props[_KEY_PENDING_CLIENT] = None", "client_name = client_task.c...
<|body_start_0|> TaskManager.__init__(self) if task_result_timeout is None: task_result_timeout = 0 task.props[_KEY_DYNAMIC_TARGETS] = dynamic_targets task.props[_KEY_TASK_RESULT_TIMEOUT] = task_result_timeout task.props[_KEY_SEND_TARGET_COUNTS] = {} task.prop...
AnyRelayTaskManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnyRelayTaskManager: def __init__(self, task: Task, task_result_timeout, dynamic_targets): """Task manager for relay controller on SendOrder.ANY. Args: task (Task): an instance of Task task_result_timeout (int): timeout value on reply of one client dynamic_targets (bool): allow clients t...
stack_v2_sparse_classes_75kplus_train_066175
6,797
permissive
[ { "docstring": "Task manager for relay controller on SendOrder.ANY. Args: task (Task): an instance of Task task_result_timeout (int): timeout value on reply of one client dynamic_targets (bool): allow clients to join after this task starts", "name": "__init__", "signature": "def __init__(self, task: Tas...
4
stack_v2_sparse_classes_30k_train_007339
Implement the Python class `AnyRelayTaskManager` described below. Class description: Implement the AnyRelayTaskManager class. Method signatures and docstrings: - def __init__(self, task: Task, task_result_timeout, dynamic_targets): Task manager for relay controller on SendOrder.ANY. Args: task (Task): an instance of ...
Implement the Python class `AnyRelayTaskManager` described below. Class description: Implement the AnyRelayTaskManager class. Method signatures and docstrings: - def __init__(self, task: Task, task_result_timeout, dynamic_targets): Task manager for relay controller on SendOrder.ANY. Args: task (Task): an instance of ...
1433290c203bd23f34c29e11795ce592bc067888
<|skeleton|> class AnyRelayTaskManager: def __init__(self, task: Task, task_result_timeout, dynamic_targets): """Task manager for relay controller on SendOrder.ANY. Args: task (Task): an instance of Task task_result_timeout (int): timeout value on reply of one client dynamic_targets (bool): allow clients t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AnyRelayTaskManager: def __init__(self, task: Task, task_result_timeout, dynamic_targets): """Task manager for relay controller on SendOrder.ANY. Args: task (Task): an instance of Task task_result_timeout (int): timeout value on reply of one client dynamic_targets (bool): allow clients to join after t...
the_stack_v2_python_sparse
nvflare/apis/impl/any_relay_manager.py
NVIDIA/NVFlare
train
442
efaa33a816453e5a50e7d4fff1f4ca0231a4be1a
[ "template_vars = {}\nif zoe_lib.config.get_conf().oauth_client_id != '':\n template_vars['with_gitlab_oauth'] = True\nself.render('login.jinja2', **template_vars)", "login_type = self.get_argument('login', 'userpass')\nif login_type == 'OAUTH':\n egitlab = EurecomGitLabClient(client_id=zoe_lib.config.get_co...
<|body_start_0|> template_vars = {} if zoe_lib.config.get_conf().oauth_client_id != '': template_vars['with_gitlab_oauth'] = True self.render('login.jinja2', **template_vars) <|end_body_0|> <|body_start_1|> login_type = self.get_argument('login', 'userpass') if login...
The login web page.
LoginWeb
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginWeb: """The login web page.""" def get(self): """Login page.""" <|body_0|> def post(self): """Try to authenticate.""" <|body_1|> <|end_skeleton|> <|body_start_0|> template_vars = {} if zoe_lib.config.get_conf().oauth_client_id != ''...
stack_v2_sparse_classes_75kplus_train_066176
5,323
permissive
[ { "docstring": "Login page.", "name": "get", "signature": "def get(self)" }, { "docstring": "Try to authenticate.", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_052481
Implement the Python class `LoginWeb` described below. Class description: The login web page. Method signatures and docstrings: - def get(self): Login page. - def post(self): Try to authenticate.
Implement the Python class `LoginWeb` described below. Class description: The login web page. Method signatures and docstrings: - def get(self): Login page. - def post(self): Try to authenticate. <|skeleton|> class LoginWeb: """The login web page.""" def get(self): """Login page.""" <|body_0...
c8e0c908af1954a8b41d0f6de23d08589564f0ab
<|skeleton|> class LoginWeb: """The login web page.""" def get(self): """Login page.""" <|body_0|> def post(self): """Try to authenticate.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LoginWeb: """The login web page.""" def get(self): """Login page.""" template_vars = {} if zoe_lib.config.get_conf().oauth_client_id != '': template_vars['with_gitlab_oauth'] = True self.render('login.jinja2', **template_vars) def post(self): """Tr...
the_stack_v2_python_sparse
zoe_api/web/start.py
DistributedSystemsGroup/zoe
train
60
d74bde5a245995f1cc7290603c108ad0a55a9bc8
[ "self.window_data = window_data\nself.filter_weights = torch.tensor(filter_weights, dtype=torch.float32)\nself.biases = torch.tensor(biases, dtype=torch.float32)", "is_np = isinstance(inputs, np.ndarray)\nif is_np:\n inputs = torch.tensor(inputs, dtype=torch.float32)\ninputs = self.window_data.unflatten_inputs...
<|body_start_0|> self.window_data = window_data self.filter_weights = torch.tensor(filter_weights, dtype=torch.float32) self.biases = torch.tensor(biases, dtype=torch.float32) <|end_body_0|> <|body_start_1|> is_np = isinstance(inputs, np.ndarray) if is_np: inputs = t...
Represents a 2D Convolution layer in a network.
Conv2DLayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Conv2DLayer: """Represents a 2D Convolution layer in a network.""" def __init__(self, window_data, filter_weights, biases): """Constructs a new Conv2DLayer.""" <|body_0|> def compute(self, inputs, jacobian=False): """Computes the 2D convolution given an input vec...
stack_v2_sparse_classes_75kplus_train_066177
3,146
permissive
[ { "docstring": "Constructs a new Conv2DLayer.", "name": "__init__", "signature": "def __init__(self, window_data, filter_weights, biases)" }, { "docstring": "Computes the 2D convolution given an input vector. If @jacobian=True, it only computes the homogeneous portion (i.e., does not add biases)...
4
stack_v2_sparse_classes_30k_train_027769
Implement the Python class `Conv2DLayer` described below. Class description: Represents a 2D Convolution layer in a network. Method signatures and docstrings: - def __init__(self, window_data, filter_weights, biases): Constructs a new Conv2DLayer. - def compute(self, inputs, jacobian=False): Computes the 2D convoluti...
Implement the Python class `Conv2DLayer` described below. Class description: Represents a 2D Convolution layer in a network. Method signatures and docstrings: - def __init__(self, window_data, filter_weights, biases): Constructs a new Conv2DLayer. - def compute(self, inputs, jacobian=False): Computes the 2D convoluti...
19abf589e84ee67317134573054c648bb25c244d
<|skeleton|> class Conv2DLayer: """Represents a 2D Convolution layer in a network.""" def __init__(self, window_data, filter_weights, biases): """Constructs a new Conv2DLayer.""" <|body_0|> def compute(self, inputs, jacobian=False): """Computes the 2D convolution given an input vec...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Conv2DLayer: """Represents a 2D Convolution layer in a network.""" def __init__(self, window_data, filter_weights, biases): """Constructs a new Conv2DLayer.""" self.window_data = window_data self.filter_weights = torch.tensor(filter_weights, dtype=torch.float32) self.biase...
the_stack_v2_python_sparse
pysyrenn/frontend/conv2d_layer.py
95616ARG/SyReNN
train
38
96fdda78822fb0276fd2bab6741ade3b27a0501f
[ "self.tf, self.tar_iter = (tf, tar_iter)\nself.tarinfo_list = tarinfo_list\nself.index = index\nself.buffer = ''\nself.at_end = 0", "if length < 0:\n while self.addtobuffer():\n pass\n real_len = len(self.buffer)\nelse:\n while len(self.buffer) < length:\n if not self.addtobuffer():\n ...
<|body_start_0|> self.tf, self.tar_iter = (tf, tar_iter) self.tarinfo_list = tarinfo_list self.index = index self.buffer = '' self.at_end = 0 <|end_body_0|> <|body_start_1|> if length < 0: while self.addtobuffer(): pass real_len = ...
Emulate a file like object from multivols Maintains a buffer about the size of a volume. When it is read() to the end, pull in more volumes as desired.
Multivol_Filelike
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Multivol_Filelike: """Emulate a file like object from multivols Maintains a buffer about the size of a volume. When it is read() to the end, pull in more volumes as desired.""" def __init__(self, tf, tar_iter, tarinfo_list, index): """Initializer. tf is TarFile obj, tarinfo is first ...
stack_v2_sparse_classes_75kplus_train_066178
21,671
no_license
[ { "docstring": "Initializer. tf is TarFile obj, tarinfo is first tarinfo", "name": "__init__", "signature": "def __init__(self, tf, tar_iter, tarinfo_list, index)" }, { "docstring": "Read length bytes from file", "name": "read", "signature": "def read(self, length=-1)" }, { "docs...
4
stack_v2_sparse_classes_30k_train_016401
Implement the Python class `Multivol_Filelike` described below. Class description: Emulate a file like object from multivols Maintains a buffer about the size of a volume. When it is read() to the end, pull in more volumes as desired. Method signatures and docstrings: - def __init__(self, tf, tar_iter, tarinfo_list, ...
Implement the Python class `Multivol_Filelike` described below. Class description: Emulate a file like object from multivols Maintains a buffer about the size of a volume. When it is read() to the end, pull in more volumes as desired. Method signatures and docstrings: - def __init__(self, tf, tar_iter, tarinfo_list, ...
ef6d0f4bdff52be379784325e504de22cfe149de
<|skeleton|> class Multivol_Filelike: """Emulate a file like object from multivols Maintains a buffer about the size of a volume. When it is read() to the end, pull in more volumes as desired.""" def __init__(self, tf, tar_iter, tarinfo_list, index): """Initializer. tf is TarFile obj, tarinfo is first ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Multivol_Filelike: """Emulate a file like object from multivols Maintains a buffer about the size of a volume. When it is read() to the end, pull in more volumes as desired.""" def __init__(self, tf, tar_iter, tarinfo_list, index): """Initializer. tf is TarFile obj, tarinfo is first tarinfo""" ...
the_stack_v2_python_sparse
duplicity/patchdir.py
henrysher/duplicity
train
90
6cb8e8b2a640bb0d5701a3aea9c9941385db6deb
[ "self.option = dict()\nself.option_source = dict()\nenviron_var = environ_var.upper()\noptions = options.strip()\ncommand_line = str(sys.argv[1:])\ncontext = f'program injection ({options})'\nfor option in shlex.split(options):\n self.set_option(option, context)\nenviron_options = os.getenv(environ_var, '').stri...
<|body_start_0|> self.option = dict() self.option_source = dict() environ_var = environ_var.upper() options = options.strip() command_line = str(sys.argv[1:]) context = f'program injection ({options})' for option in shlex.split(options): self.set_optio...
Option
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Option: def __init__(self, environ_var='', options=''): """Loads option values in reverse priority order. Priority: command line > environment variable > code injection Load order: code injection > environment variable > command line""" <|body_0|> def __call__(self, key, def...
stack_v2_sparse_classes_75kplus_train_066179
4,634
no_license
[ { "docstring": "Loads option values in reverse priority order. Priority: command line > environment variable > code injection Load order: code injection > environment variable > command line", "name": "__init__", "signature": "def __init__(self, environ_var='', options='')" }, { "docstring": "Re...
4
stack_v2_sparse_classes_30k_train_049487
Implement the Python class `Option` described below. Class description: Implement the Option class. Method signatures and docstrings: - def __init__(self, environ_var='', options=''): Loads option values in reverse priority order. Priority: command line > environment variable > code injection Load order: code injecti...
Implement the Python class `Option` described below. Class description: Implement the Option class. Method signatures and docstrings: - def __init__(self, environ_var='', options=''): Loads option values in reverse priority order. Priority: command line > environment variable > code injection Load order: code injecti...
51ee8a0a2f3075ae718339842edaa1b3911ebd7f
<|skeleton|> class Option: def __init__(self, environ_var='', options=''): """Loads option values in reverse priority order. Priority: command line > environment variable > code injection Load order: code injection > environment variable > command line""" <|body_0|> def __call__(self, key, def...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Option: def __init__(self, environ_var='', options=''): """Loads option values in reverse priority order. Priority: command line > environment variable > code injection Load order: code injection > environment variable > command line""" self.option = dict() self.option_source = dict() ...
the_stack_v2_python_sparse
option.py
jeremybnelson/python-udp-util
train
1
78e45815818e19e21312160c5d6353edc30c691c
[ "self.typedefs = typedefs\nself.body_json = body_json\nself.types = ['classification_defs', 'enum_defs', 'entity_defs']", "existing_entitydefs_names = []\nexisting_enumdefs_names = []\nexisting_classificationdefs_names = []\nfor typedef in ATLAS_CLIENT.typedefs:\n existing_entitydefs_names = [entity.name for e...
<|body_start_0|> self.typedefs = typedefs self.body_json = body_json self.types = ['classification_defs', 'enum_defs', 'entity_defs'] <|end_body_0|> <|body_start_1|> existing_entitydefs_names = [] existing_enumdefs_names = [] existing_classificationdefs_names = [] ...
Create typedefs on Atlas (it cannot update existing ones)
AtlasTypedefsCreateOperator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AtlasTypedefsCreateOperator: """Create typedefs on Atlas (it cannot update existing ones)""" def __init__(self, typedefs, body_json, **kwargs): """It uses the typedefs model and validate the content before sending it to Atlas Args: typedefs(Typedefs): Typedefs object with info to cre...
stack_v2_sparse_classes_75kplus_train_066180
3,894
permissive
[ { "docstring": "It uses the typedefs model and validate the content before sending it to Atlas Args: typedefs(Typedefs): Typedefs object with info to create the typedefs in Atlas bodyjson(str): Body in json format as given as body when calling the API", "name": "__init__", "signature": "def __init__(sel...
4
null
Implement the Python class `AtlasTypedefsCreateOperator` described below. Class description: Create typedefs on Atlas (it cannot update existing ones) Method signatures and docstrings: - def __init__(self, typedefs, body_json, **kwargs): It uses the typedefs model and validate the content before sending it to Atlas A...
Implement the Python class `AtlasTypedefsCreateOperator` described below. Class description: Create typedefs on Atlas (it cannot update existing ones) Method signatures and docstrings: - def __init__(self, typedefs, body_json, **kwargs): It uses the typedefs model and validate the content before sending it to Atlas A...
f95a5513d34ec18bfa9adfab7ae0c13abd85b808
<|skeleton|> class AtlasTypedefsCreateOperator: """Create typedefs on Atlas (it cannot update existing ones)""" def __init__(self, typedefs, body_json, **kwargs): """It uses the typedefs model and validate the content before sending it to Atlas Args: typedefs(Typedefs): Typedefs object with info to cre...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AtlasTypedefsCreateOperator: """Create typedefs on Atlas (it cannot update existing ones)""" def __init__(self, typedefs, body_json, **kwargs): """It uses the typedefs model and validate the content before sending it to Atlas Args: typedefs(Typedefs): Typedefs object with info to create the typed...
the_stack_v2_python_sparse
det/operators/atlas_typedefs_create.py
jpoullet2000/det
train
0
0cfb1932604ea86b2c3dfcebb78f5a1671d900f5
[ "user = get_a_user(fuelid)\nif not user:\n api.abort(404)\nelse:\n return user\ndata = request.json\nreturn get_a_user(data=data)", "user = complete_users(fuelid)\nif not user:\n api.abort(404)\nelse:\n return user\ndata = request.json\nreturn complete_users(data=data)", "user = delete_user(fuelid)\...
<|body_start_0|> user = get_a_user(fuelid) if not user: api.abort(404) else: return user data = request.json return get_a_user(data=data) <|end_body_0|> <|body_start_1|> user = complete_users(fuelid) if not user: api.abort(404)...
Fuelgate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Fuelgate: def get(self, fuelid): """get a Fuelgate given its identifier""" <|body_0|> def put(self, fuelid): """Fuelgate Updated""" <|body_1|> def delete(self, fuelid): """Fuelgate Deleted""" <|body_2|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_75kplus_train_066181
2,585
no_license
[ { "docstring": "get a Fuelgate given its identifier", "name": "get", "signature": "def get(self, fuelid)" }, { "docstring": "Fuelgate Updated", "name": "put", "signature": "def put(self, fuelid)" }, { "docstring": "Fuelgate Deleted", "name": "delete", "signature": "def de...
3
stack_v2_sparse_classes_30k_train_035628
Implement the Python class `Fuelgate` described below. Class description: Implement the Fuelgate class. Method signatures and docstrings: - def get(self, fuelid): get a Fuelgate given its identifier - def put(self, fuelid): Fuelgate Updated - def delete(self, fuelid): Fuelgate Deleted
Implement the Python class `Fuelgate` described below. Class description: Implement the Fuelgate class. Method signatures and docstrings: - def get(self, fuelid): get a Fuelgate given its identifier - def put(self, fuelid): Fuelgate Updated - def delete(self, fuelid): Fuelgate Deleted <|skeleton|> class Fuelgate: ...
4fa4042304ee01cf23ecc81f9c27977fd12c31b9
<|skeleton|> class Fuelgate: def get(self, fuelid): """get a Fuelgate given its identifier""" <|body_0|> def put(self, fuelid): """Fuelgate Updated""" <|body_1|> def delete(self, fuelid): """Fuelgate Deleted""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Fuelgate: def get(self, fuelid): """get a Fuelgate given its identifier""" user = get_a_user(fuelid) if not user: api.abort(404) else: return user data = request.json return get_a_user(data=data) def put(self, fuelid): """Fue...
the_stack_v2_python_sparse
main/controller/fuelgate_controller.py
Gauravkumar45/Flask-RESTPlus-API
train
0
3b29838a84dd7a58ad4eff9f29b9e99e1358b71f
[ "super().__init__()\nif nonlinear_activation:\n nonlinear_activation = nonlinear_activation.lower()\ninitialize(self, init_type)\nself.layers = nn.LayerList()\nassert len(kernel_sizes) == 2\nassert kernel_sizes[0] % 2 == 1\nassert kernel_sizes[1] % 2 == 1\nself.layers.append(nn.Sequential(getattr(nn, pad)((np.pr...
<|body_start_0|> super().__init__() if nonlinear_activation: nonlinear_activation = nonlinear_activation.lower() initialize(self, init_type) self.layers = nn.LayerList() assert len(kernel_sizes) == 2 assert kernel_sizes[0] % 2 == 1 assert kernel_sizes[...
MelGAN discriminator module.
MelGANDiscriminator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MelGANDiscriminator: """MelGAN discriminator module.""" def __init__(self, in_channels: int=1, out_channels: int=1, kernel_sizes: List[int]=[5, 3], channels: int=16, max_downsample_channels: int=1024, bias: bool=True, downsample_scales: List[int]=[4, 4, 4, 4], nonlinear_activation: str='leak...
stack_v2_sparse_classes_75kplus_train_066182
20,745
permissive
[ { "docstring": "Initilize MelGAN discriminator module. Args: in_channels (int): Number of input channels. out_channels (int): Number of output channels. kernel_sizes (List[int]): List of two kernel sizes. The prod will be used for the first conv layer, and the first and the second kernel sizes will be used for ...
2
stack_v2_sparse_classes_30k_train_020552
Implement the Python class `MelGANDiscriminator` described below. Class description: MelGAN discriminator module. Method signatures and docstrings: - def __init__(self, in_channels: int=1, out_channels: int=1, kernel_sizes: List[int]=[5, 3], channels: int=16, max_downsample_channels: int=1024, bias: bool=True, downsa...
Implement the Python class `MelGANDiscriminator` described below. Class description: MelGAN discriminator module. Method signatures and docstrings: - def __init__(self, in_channels: int=1, out_channels: int=1, kernel_sizes: List[int]=[5, 3], channels: int=16, max_downsample_channels: int=1024, bias: bool=True, downsa...
17854a04d43c231eff66bfed9d6aa55e94a29e79
<|skeleton|> class MelGANDiscriminator: """MelGAN discriminator module.""" def __init__(self, in_channels: int=1, out_channels: int=1, kernel_sizes: List[int]=[5, 3], channels: int=16, max_downsample_channels: int=1024, bias: bool=True, downsample_scales: List[int]=[4, 4, 4, 4], nonlinear_activation: str='leak...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MelGANDiscriminator: """MelGAN discriminator module.""" def __init__(self, in_channels: int=1, out_channels: int=1, kernel_sizes: List[int]=[5, 3], channels: int=16, max_downsample_channels: int=1024, bias: bool=True, downsample_scales: List[int]=[4, 4, 4, 4], nonlinear_activation: str='leakyrelu', nonli...
the_stack_v2_python_sparse
paddlespeech/t2s/models/melgan/melgan.py
anniyanvr/DeepSpeech-1
train
0
d135553b1196dd21eaa087ab07ce8472dba61499
[ "value = super().__getattribute__(name)\nif name == 'uid' and value is None and self.id:\n return perfect_hash.encode(self.id)\nreturn value", "defer_uid = False\nif not self.id:\n defer_uid = True\nsuper().save(*args, **kwargs)\nif defer_uid:\n self.uid = perfect_hash.encode(self.id)\n super().save(f...
<|body_start_0|> value = super().__getattribute__(name) if name == 'uid' and value is None and self.id: return perfect_hash.encode(self.id) return value <|end_body_0|> <|body_start_1|> defer_uid = False if not self.id: defer_uid = True super().sav...
Add user-friendly UID to any model. Note that database value will be NULL upon first saving.
UidMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UidMixin: """Add user-friendly UID to any model. Note that database value will be NULL upon first saving.""" def __getattribute__(self, name): """Add UID value to the model when we have ID available.""" <|body_0|> def save(self, *args, **kwargs): """Add UID right...
stack_v2_sparse_classes_75kplus_train_066183
4,079
permissive
[ { "docstring": "Add UID value to the model when we have ID available.", "name": "__getattribute__", "signature": "def __getattribute__(self, name)" }, { "docstring": "Add UID right after we obtain ID from the database.", "name": "save", "signature": "def save(self, *args, **kwargs)" } ...
2
stack_v2_sparse_classes_30k_val_000767
Implement the Python class `UidMixin` described below. Class description: Add user-friendly UID to any model. Note that database value will be NULL upon first saving. Method signatures and docstrings: - def __getattribute__(self, name): Add UID value to the model when we have ID available. - def save(self, *args, **k...
Implement the Python class `UidMixin` described below. Class description: Add user-friendly UID to any model. Note that database value will be NULL upon first saving. Method signatures and docstrings: - def __getattribute__(self, name): Add UID value to the model when we have ID available. - def save(self, *args, **k...
84c4fa10aefbd792a956cef3d727623ca78cb5fd
<|skeleton|> class UidMixin: """Add user-friendly UID to any model. Note that database value will be NULL upon first saving.""" def __getattribute__(self, name): """Add UID value to the model when we have ID available.""" <|body_0|> def save(self, *args, **kwargs): """Add UID right...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UidMixin: """Add user-friendly UID to any model. Note that database value will be NULL upon first saving.""" def __getattribute__(self, name): """Add UID value to the model when we have ID available.""" value = super().__getattribute__(name) if name == 'uid' and value is None and ...
the_stack_v2_python_sparse
market/utils/models.py
katomaso/django-market
train
0
fe6c897bac95d21d3386153b11ae415b9737c291
[ "print('Testing D_recognize')\nstates = ['1', '2', '3', '4']\ndomain = ['b', 'a', '!']\nstart_state = '1'\naccept_state = ['4']\nstate_table = [('1', 'b', '2'), ('2', 'a', '3'), ('3', 'a', '3'), ('3', '!', '4')]\nFSA = state_machine.Finite_State_Automata(states, domain, start_state, accept_state, state_table)\nself...
<|body_start_0|> print('Testing D_recognize') states = ['1', '2', '3', '4'] domain = ['b', 'a', '!'] start_state = '1' accept_state = ['4'] state_table = [('1', 'b', '2'), ('2', 'a', '3'), ('3', 'a', '3'), ('3', '!', '4')] FSA = state_machine.Finite_State_Automata...
TestFSA
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestFSA: def test_d_recognize(self): """Test the basic D_Recognize algorithm using the sheep languages discussed in class the regex is defined as /^baa+!$/""" <|body_0|> def test_d_recognize_b(self): """Tests the second d_recognize function by defining a machine that...
stack_v2_sparse_classes_75kplus_train_066184
4,133
no_license
[ { "docstring": "Test the basic D_Recognize algorithm using the sheep languages discussed in class the regex is defined as /^baa+!$/", "name": "test_d_recognize", "signature": "def test_d_recognize(self)" }, { "docstring": "Tests the second d_recognize function by defining a machine that searches...
3
stack_v2_sparse_classes_30k_train_029794
Implement the Python class `TestFSA` described below. Class description: Implement the TestFSA class. Method signatures and docstrings: - def test_d_recognize(self): Test the basic D_Recognize algorithm using the sheep languages discussed in class the regex is defined as /^baa+!$/ - def test_d_recognize_b(self): Test...
Implement the Python class `TestFSA` described below. Class description: Implement the TestFSA class. Method signatures and docstrings: - def test_d_recognize(self): Test the basic D_Recognize algorithm using the sheep languages discussed in class the regex is defined as /^baa+!$/ - def test_d_recognize_b(self): Test...
1f7dd50123b5b69d8268bc071a4adc5b3b8a76e6
<|skeleton|> class TestFSA: def test_d_recognize(self): """Test the basic D_Recognize algorithm using the sheep languages discussed in class the regex is defined as /^baa+!$/""" <|body_0|> def test_d_recognize_b(self): """Tests the second d_recognize function by defining a machine that...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestFSA: def test_d_recognize(self): """Test the basic D_Recognize algorithm using the sheep languages discussed in class the regex is defined as /^baa+!$/""" print('Testing D_recognize') states = ['1', '2', '3', '4'] domain = ['b', 'a', '!'] start_state = '1' a...
the_stack_v2_python_sparse
test.py
lzambella/csc470-proj1
train
0
eedc647d421195246fd8a46d998b671ae95678df
[ "super(GANLoss, self).__init__()\nself.register_buffer('real_label', torch.tensor(target_real_label))\nself.register_buffer('fake_label', torch.tensor(target_fake_label))\nself.gan_mode = gan_mode\nif gan_mode == 'lsgan':\n self.loss = nn.MSELoss()\nelif gan_mode == 'vanilla':\n self.loss = nn.BCEWithLogitsLo...
<|body_start_0|> super(GANLoss, self).__init__() self.register_buffer('real_label', torch.tensor(target_real_label)) self.register_buffer('fake_label', torch.tensor(target_fake_label)) self.gan_mode = gan_mode if gan_mode == 'lsgan': self.loss = nn.MSELoss() e...
Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input.
GANLoss
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GANLoss: """Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input.""" def __init__(self, gan_mode, target_real_label=1.0, target_fake_label=0.0): """Initialize the GANLoss class. Parameters: ga...
stack_v2_sparse_classes_75kplus_train_066185
13,787
permissive
[ { "docstring": "Initialize the GANLoss class. Parameters: gan_mode (str) - - the type of GAN objective. It currently supports vanilla, lsgan, and wgangp. target_real_label (bool) - - label for a real image target_fake_label (bool) - - label of a fake image Note: Do not use sigmoid as the last layer of Discrimin...
3
stack_v2_sparse_classes_30k_train_040112
Implement the Python class `GANLoss` described below. Class description: Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input. Method signatures and docstrings: - def __init__(self, gan_mode, target_real_label=1.0, target_fake...
Implement the Python class `GANLoss` described below. Class description: Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input. Method signatures and docstrings: - def __init__(self, gan_mode, target_real_label=1.0, target_fake...
ebb8c0333bbd33c063b6dd4a21a0559eb86d13e9
<|skeleton|> class GANLoss: """Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input.""" def __init__(self, gan_mode, target_real_label=1.0, target_fake_label=0.0): """Initialize the GANLoss class. Parameters: ga...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GANLoss: """Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input.""" def __init__(self, gan_mode, target_real_label=1.0, target_fake_label=0.0): """Initialize the GANLoss class. Parameters: gan_mode (str) ...
the_stack_v2_python_sparse
simplegan_experiments/models/base_networks.py
Qun-Li/OroJaR
train
0
8f30b958fbf66dceadf4beef94e766733cd2be06
[ "self.validate_parameters(accept=accept, customer_id=customer_id, account_id=account_id)\n_url_path = '/aggregation/v1/customers/{customerId}/accounts/{accountId}/statement'\n_url_path = APIHelper.append_url_with_template_parameters(_url_path, {'customerId': customer_id, 'accountId': account_id})\n_query_builder = ...
<|body_start_0|> self.validate_parameters(accept=accept, customer_id=customer_id, account_id=account_id) _url_path = '/aggregation/v1/customers/{customerId}/accounts/{accountId}/statement' _url_path = APIHelper.append_url_with_template_parameters(_url_path, {'customerId': customer_id, 'accountId...
A Controller to access Endpoints in the finicityapi API.
BankStatementsController
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BankStatementsController: """A Controller to access Endpoints in the finicityapi API.""" def get_customer_account_statement(self, accept, customer_id, account_id, index=1): """Does a GET request to /aggregation/v1/customers/{customerId}/accounts/{accountId}/statement. Connect to the ...
stack_v2_sparse_classes_75kplus_train_066186
8,471
permissive
[ { "docstring": "Does a GET request to /aggregation/v1/customers/{customerId}/accounts/{accountId}/statement. Connect to the account’s financial institution and download the most recent monthly statement for the account, in PDF format. This is an interactive refresh, so MFA challenges may be required. The index ...
2
null
Implement the Python class `BankStatementsController` described below. Class description: A Controller to access Endpoints in the finicityapi API. Method signatures and docstrings: - def get_customer_account_statement(self, accept, customer_id, account_id, index=1): Does a GET request to /aggregation/v1/customers/{cu...
Implement the Python class `BankStatementsController` described below. Class description: A Controller to access Endpoints in the finicityapi API. Method signatures and docstrings: - def get_customer_account_statement(self, accept, customer_id, account_id, index=1): Does a GET request to /aggregation/v1/customers/{cu...
b2ab1ded435db75c78d42261f5e4acd2a3061487
<|skeleton|> class BankStatementsController: """A Controller to access Endpoints in the finicityapi API.""" def get_customer_account_statement(self, accept, customer_id, account_id, index=1): """Does a GET request to /aggregation/v1/customers/{customerId}/accounts/{accountId}/statement. Connect to the ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BankStatementsController: """A Controller to access Endpoints in the finicityapi API.""" def get_customer_account_statement(self, accept, customer_id, account_id, index=1): """Does a GET request to /aggregation/v1/customers/{customerId}/accounts/{accountId}/statement. Connect to the account’s fin...
the_stack_v2_python_sparse
finicityapi/controllers/bank_statements_controller.py
monarchmoney/finicity-python
train
0
debcf4b83978cc72bfa5cc1a5d689aa8b423d7a1
[ "w = ''\nwhile True:\n ch = fp.read(1)\n if ch == ' ':\n break\n w += ch\nline = fp.read(4 * self._size)\nvec = np.zeros(self._size, dtype=np.float32)\nfor i in xrange(self._size):\n vec[i] = struct.unpack_from('<f', line, offset=4 * i)[0]\nreturn (w, vec)", "self._vocab = []\nwith open(filenam...
<|body_start_0|> w = '' while True: ch = fp.read(1) if ch == ' ': break w += ch line = fp.read(4 * self._size) vec = np.zeros(self._size, dtype=np.float32) for i in xrange(self._size): vec[i] = struct.unpack_from('<f...
Word2VecConverter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Word2VecConverter: def _decodeLine(self, fp): """Decode a line in the file. Args: fp: The file descriptor.""" <|body_0|> def load(self, filename): """Load a pre-trained word2vec file. Args: filename: The pre-trained word2vec model.""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_75kplus_train_066187
5,073
no_license
[ { "docstring": "Decode a line in the file. Args: fp: The file descriptor.", "name": "_decodeLine", "signature": "def _decodeLine(self, fp)" }, { "docstring": "Load a pre-trained word2vec file. Args: filename: The pre-trained word2vec model.", "name": "load", "signature": "def load(self, ...
2
null
Implement the Python class `Word2VecConverter` described below. Class description: Implement the Word2VecConverter class. Method signatures and docstrings: - def _decodeLine(self, fp): Decode a line in the file. Args: fp: The file descriptor. - def load(self, filename): Load a pre-trained word2vec file. Args: filenam...
Implement the Python class `Word2VecConverter` described below. Class description: Implement the Word2VecConverter class. Method signatures and docstrings: - def _decodeLine(self, fp): Decode a line in the file. Args: fp: The file descriptor. - def load(self, filename): Load a pre-trained word2vec file. Args: filenam...
2017df820668ae6bf460379e5858ada925834e89
<|skeleton|> class Word2VecConverter: def _decodeLine(self, fp): """Decode a line in the file. Args: fp: The file descriptor.""" <|body_0|> def load(self, filename): """Load a pre-trained word2vec file. Args: filename: The pre-trained word2vec model.""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Word2VecConverter: def _decodeLine(self, fp): """Decode a line in the file. Args: fp: The file descriptor.""" w = '' while True: ch = fp.read(1) if ch == ' ': break w += ch line = fp.read(4 * self._size) vec = np.zeros...
the_stack_v2_python_sparse
utils/embedding_converter.py
yekeren/Story-Video_ads_understanding
train
12
76ebaff00d30b4fa0fa2c6a1e149d24917050a54
[ "maxArea = 0\nl = 0\nr = len(height) - 1\nwhile l < r:\n maxArea = max(maxArea, min(height[l], height[r]) * (r - l))\n if height[l] < height[r]:\n l += 1\n else:\n r -= 1\nreturn maxArea", "ptr1 = 0\nptr2 = len(height) - 1\narea = 0\nwhile ptr1 < ptr2:\n a = 0\n if height[ptr1] > heig...
<|body_start_0|> maxArea = 0 l = 0 r = len(height) - 1 while l < r: maxArea = max(maxArea, min(height[l], height[r]) * (r - l)) if height[l] < height[r]: l += 1 else: r -= 1 return maxArea <|end_body_0|> <|body_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxArea(self, height): """双指针法 :type height: List[int] :rtype: int""" <|body_0|> def maxArea2(self, height): """与上同理,但这个时间快一点 :type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> maxArea = 0 l = 0...
stack_v2_sparse_classes_75kplus_train_066188
1,050
no_license
[ { "docstring": "双指针法 :type height: List[int] :rtype: int", "name": "maxArea", "signature": "def maxArea(self, height)" }, { "docstring": "与上同理,但这个时间快一点 :type height: List[int] :rtype: int", "name": "maxArea2", "signature": "def maxArea2(self, height)" } ]
2
stack_v2_sparse_classes_30k_test_001739
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea(self, height): 双指针法 :type height: List[int] :rtype: int - def maxArea2(self, height): 与上同理,但这个时间快一点 :type height: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea(self, height): 双指针法 :type height: List[int] :rtype: int - def maxArea2(self, height): 与上同理,但这个时间快一点 :type height: List[int] :rtype: int <|skeleton|> class Solution: ...
5ded4c79f567639042bcf6eb71ece910f54a5af9
<|skeleton|> class Solution: def maxArea(self, height): """双指针法 :type height: List[int] :rtype: int""" <|body_0|> def maxArea2(self, height): """与上同理,但这个时间快一点 :type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxArea(self, height): """双指针法 :type height: List[int] :rtype: int""" maxArea = 0 l = 0 r = len(height) - 1 while l < r: maxArea = max(maxArea, min(height[l], height[r]) * (r - l)) if height[l] < height[r]: l += 1 ...
the_stack_v2_python_sparse
11.Container With Most Water.py
redrumshinning/Leetcode
train
0
a99b567277147063307a96e3e32d303f9139c279
[ "form = ArtistForm({'name': '', 'artist_statement': 'test', 'image': 'test'})\nself.assertFalse(form.is_valid())\nself.assertIn('name', form.errors.keys())\nself.assertEqual(form.errors['name'][0], 'This field is required.')", "form = ArtistForm({'name': 'test', 'artist_statement': '', 'image': 'test'})\nself.ass...
<|body_start_0|> form = ArtistForm({'name': '', 'artist_statement': 'test', 'image': 'test'}) self.assertFalse(form.is_valid()) self.assertIn('name', form.errors.keys()) self.assertEqual(form.errors['name'][0], 'This field is required.') <|end_body_0|> <|body_start_1|> form = Ar...
Test that the artist form works
TestArtistForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestArtistForm: """Test that the artist form works""" def test_name_is_required(self): """Test if form submits without name field""" <|body_0|> def test_artist_statement_is_required(self): """Test if form submits without artist_statement field""" <|body_1...
stack_v2_sparse_classes_75kplus_train_066189
1,801
no_license
[ { "docstring": "Test if form submits without name field", "name": "test_name_is_required", "signature": "def test_name_is_required(self)" }, { "docstring": "Test if form submits without artist_statement field", "name": "test_artist_statement_is_required", "signature": "def test_artist_st...
3
stack_v2_sparse_classes_30k_val_000760
Implement the Python class `TestArtistForm` described below. Class description: Test that the artist form works Method signatures and docstrings: - def test_name_is_required(self): Test if form submits without name field - def test_artist_statement_is_required(self): Test if form submits without artist_statement fiel...
Implement the Python class `TestArtistForm` described below. Class description: Test that the artist form works Method signatures and docstrings: - def test_name_is_required(self): Test if form submits without name field - def test_artist_statement_is_required(self): Test if form submits without artist_statement fiel...
b4ef7a46708711bda460667b1f602d0bd67c0bae
<|skeleton|> class TestArtistForm: """Test that the artist form works""" def test_name_is_required(self): """Test if form submits without name field""" <|body_0|> def test_artist_statement_is_required(self): """Test if form submits without artist_statement field""" <|body_1...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestArtistForm: """Test that the artist form works""" def test_name_is_required(self): """Test if form submits without name field""" form = ArtistForm({'name': '', 'artist_statement': 'test', 'image': 'test'}) self.assertFalse(form.is_valid()) self.assertIn('name', form.er...
the_stack_v2_python_sparse
artists/test_forms.py
AmyOShea/MS4-ARTstop
train
1
6d9ac025c045c4a2229592af45d628938d3b7109
[ "super().__init__(*transforms, transform_call=transform_call, shuffle=shuffle, **kwargs)\nif random_sampler is None:\n random_sampler = UniformParameter(0.0, 1.0)\nself.register_sampler('prob', random_sampler, size=(len(self.transforms),))\nif check_scalar(dropout):\n dropout = [dropout] * len(self.transforms...
<|body_start_0|> super().__init__(*transforms, transform_call=transform_call, shuffle=shuffle, **kwargs) if random_sampler is None: random_sampler = UniformParameter(0.0, 1.0) self.register_sampler('prob', random_sampler, size=(len(self.transforms),)) if check_scalar(dropout)...
Compose multiple transforms to one and randomly apply them
DropoutCompose
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DropoutCompose: """Compose multiple transforms to one and randomly apply them""" def __init__(self, *transforms: Union[AbstractTransform, Sequence[AbstractTransform]], dropout: Union[float, Sequence[float]]=0.5, shuffle: bool=False, random_sampler: ContinuousParameter=None, transform_call: C...
stack_v2_sparse_classes_75kplus_train_066190
9,508
permissive
[ { "docstring": "Args: *transforms: one or multiple transformations which are applied in consecutive order dropout: if provided as float, each transform is skipped with the given probability if :attr:`dropout` is a sequence, it needs to specify the dropout probability for each given transform shuffle: apply tran...
2
stack_v2_sparse_classes_30k_train_051955
Implement the Python class `DropoutCompose` described below. Class description: Compose multiple transforms to one and randomly apply them Method signatures and docstrings: - def __init__(self, *transforms: Union[AbstractTransform, Sequence[AbstractTransform]], dropout: Union[float, Sequence[float]]=0.5, shuffle: boo...
Implement the Python class `DropoutCompose` described below. Class description: Compose multiple transforms to one and randomly apply them Method signatures and docstrings: - def __init__(self, *transforms: Union[AbstractTransform, Sequence[AbstractTransform]], dropout: Union[float, Sequence[float]]=0.5, shuffle: boo...
ab6fbcfe7215c2a5b8e401b70909f6a32d0d167b
<|skeleton|> class DropoutCompose: """Compose multiple transforms to one and randomly apply them""" def __init__(self, *transforms: Union[AbstractTransform, Sequence[AbstractTransform]], dropout: Union[float, Sequence[float]]=0.5, shuffle: bool=False, random_sampler: ContinuousParameter=None, transform_call: C...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DropoutCompose: """Compose multiple transforms to one and randomly apply them""" def __init__(self, *transforms: Union[AbstractTransform, Sequence[AbstractTransform]], dropout: Union[float, Sequence[float]]=0.5, shuffle: bool=False, random_sampler: ContinuousParameter=None, transform_call: Callable[[Any,...
the_stack_v2_python_sparse
rising/transforms/compose.py
PhoenixDL/rising
train
318
0393b356f4e7f91a01c53ad8f01e3c2ac012e020
[ "run_id = str(uuid.uuid1())\nif not run.id.startswith(self.OFFLINE_RUN):\n run_id = run.id\n parent_id, portal_url = ('none', 'none')\n if run.parent is not None:\n parent_id = run.parent.id\n portal_url = run.parent.get_portal_url()\n self.custom_dimensions = {'custom_dimensions': {'paren...
<|body_start_0|> run_id = str(uuid.uuid1()) if not run.id.startswith(self.OFFLINE_RUN): run_id = run.id parent_id, portal_url = ('none', 'none') if run.parent is not None: parent_id = run.parent.id portal_url = run.parent.get_portal_url...
ObservabilityAbstract
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObservabilityAbstract: def get_run_id_and_set_context(self, run): """gets the correlation ID by the in following order: - If the script is running in an Online run Context of AML --> run_id - If the script is running where a build_id environment variable is set --> build_id - Else --> ge...
stack_v2_sparse_classes_75kplus_train_066191
4,694
permissive
[ { "docstring": "gets the correlation ID by the in following order: - If the script is running in an Online run Context of AML --> run_id - If the script is running where a build_id environment variable is set --> build_id - Else --> generate a unique id Sets also the custom context dimensions based on On or Off...
3
stack_v2_sparse_classes_30k_train_001424
Implement the Python class `ObservabilityAbstract` described below. Class description: Implement the ObservabilityAbstract class. Method signatures and docstrings: - def get_run_id_and_set_context(self, run): gets the correlation ID by the in following order: - If the script is running in an Online run Context of AML...
Implement the Python class `ObservabilityAbstract` described below. Class description: Implement the ObservabilityAbstract class. Method signatures and docstrings: - def get_run_id_and_set_context(self, run): gets the correlation ID by the in following order: - If the script is running in an Online run Context of AML...
220353f06be7bfc9fd6d7e650fe4dbc67a7708de
<|skeleton|> class ObservabilityAbstract: def get_run_id_and_set_context(self, run): """gets the correlation ID by the in following order: - If the script is running in an Online run Context of AML --> run_id - If the script is running where a build_id environment variable is set --> build_id - Else --> ge...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ObservabilityAbstract: def get_run_id_and_set_context(self, run): """gets the correlation ID by the in following order: - If the script is running in an Online run Context of AML --> run_id - If the script is running where a build_id environment variable is set --> build_id - Else --> generate a uniqu...
the_stack_v2_python_sparse
common/azureml_appinsights_logger/azureml_appinsights_logger/logger_interface.py
h2floh/MLOpsManufacturing
train
0
74ca648b0d57481b2ddb8bf97d3edf415c39089f
[ "super(SoftDotAttention, self).__init__()\nself.linear_in = nn.Linear(query_dim, ctx_dim, bias=False)\nself.sm = nn.Softmax()\nself.linear_out = nn.Linear(query_dim + ctx_dim, query_dim, bias=False)\nself.tanh = nn.Tanh()", "target = self.linear_in(h).unsqueeze(2)\nattn = torch.bmm(context, target).squeeze(2)\nlo...
<|body_start_0|> super(SoftDotAttention, self).__init__() self.linear_in = nn.Linear(query_dim, ctx_dim, bias=False) self.sm = nn.Softmax() self.linear_out = nn.Linear(query_dim + ctx_dim, query_dim, bias=False) self.tanh = nn.Tanh() <|end_body_0|> <|body_start_1|> targe...
Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT.
SoftDotAttention
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SoftDotAttention: """Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT.""" def __init__(self, query_dim, ctx_dim): """Initialize layer.""" <|body_0|> def forward(self, h, context, mask=None, output_tilde=True, output_prob=Tru...
stack_v2_sparse_classes_75kplus_train_066192
22,199
permissive
[ { "docstring": "Initialize layer.", "name": "__init__", "signature": "def __init__(self, query_dim, ctx_dim)" }, { "docstring": "Propagate h through the network. h: batch x dim context: batch x seq_len x dim mask: batch x seq_len indices to be masked", "name": "forward", "signature": "de...
2
stack_v2_sparse_classes_30k_train_021017
Implement the Python class `SoftDotAttention` described below. Class description: Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT. Method signatures and docstrings: - def __init__(self, query_dim, ctx_dim): Initialize layer. - def forward(self, h, context, mask=None, ou...
Implement the Python class `SoftDotAttention` described below. Class description: Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT. Method signatures and docstrings: - def __init__(self, query_dim, ctx_dim): Initialize layer. - def forward(self, h, context, mask=None, ou...
868fb53d6b7978bbb10439a59e65044c811ee5c2
<|skeleton|> class SoftDotAttention: """Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT.""" def __init__(self, query_dim, ctx_dim): """Initialize layer.""" <|body_0|> def forward(self, h, context, mask=None, output_tilde=True, output_prob=Tru...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SoftDotAttention: """Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT.""" def __init__(self, query_dim, ctx_dim): """Initialize layer.""" super(SoftDotAttention, self).__init__() self.linear_in = nn.Linear(query_dim, ctx_dim, bias=Fal...
the_stack_v2_python_sparse
r2r_src/model.py
weituo12321/PREVALENT_R2R
train
8
4eacd20f5a33997e23ba307cbfb1d171da6d5a9f
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('janellc_rstiffel', 'janellc_rstiffel')\nurl = 'http://datamechanics.io/data/census_tracts_list2.csv'\nvalues = csv_to_json(url)\nrepo.dropCollection('bostonTracts')\nrepo.createCollection('bostonTracts')...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('janellc_rstiffel', 'janellc_rstiffel') url = 'http://datamechanics.io/data/census_tracts_list2.csv' values = csv_to_json(url) repo.dropCol...
getIncome
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class getIncome: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything hap...
stack_v2_sparse_classes_75kplus_train_066193
5,611
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
null
Implement the Python class `getIncome` described below. Class description: Implement the getIncome class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=N...
Implement the Python class `getIncome` described below. Class description: Implement the getIncome class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=N...
b5ccaad97f6e35f9580e645ca764f36eb3406f43
<|skeleton|> class getIncome: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything hap...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class getIncome: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('janellc_rstiffel', 'janellc_rstiffel') ...
the_stack_v2_python_sparse
janellc_rstiffel/getIncome.py
dwang1995/course-2018-spr-proj
train
1
baeb1692c364b207be0a1e7412fdc8c51b531ed4
[ "def check(l, r):\n if not l and (not r):\n return True\n elif not l or not r:\n return False\n return check(l.left, r.right) and check(l.right, r.left) if l.val == r.val else False\nreturn check(root, root)", "queue = [root, root]\nwhile queue:\n t1, t2 = (queue.pop(0), queue.pop(0))\n ...
<|body_start_0|> def check(l, r): if not l and (not r): return True elif not l or not r: return False return check(l.left, r.right) and check(l.right, r.left) if l.val == r.val else False return check(root, root) <|end_body_0|> <|body_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isSymmetric(self, root): """递归 :type root: TreeNode :rtype: bool""" <|body_0|> def isSymmetric2(self, root): """类bfs 每次提取两个结点并比较它们的值。 然后,将两个结点的左右子结点按相反的顺序插入队列中。 当队列为空时,或者我们检测到树不对称(即从队列中取出两个不相等的连续结点)时,算法结束。 :param root: :return:""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_066194
2,654
no_license
[ { "docstring": "递归 :type root: TreeNode :rtype: bool", "name": "isSymmetric", "signature": "def isSymmetric(self, root)" }, { "docstring": "类bfs 每次提取两个结点并比较它们的值。 然后,将两个结点的左右子结点按相反的顺序插入队列中。 当队列为空时,或者我们检测到树不对称(即从队列中取出两个不相等的连续结点)时,算法结束。 :param root: :return:", "name": "isSymmetric2", "signa...
3
stack_v2_sparse_classes_30k_train_022751
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSymmetric(self, root): 递归 :type root: TreeNode :rtype: bool - def isSymmetric2(self, root): 类bfs 每次提取两个结点并比较它们的值。 然后,将两个结点的左右子结点按相反的顺序插入队列中。 当队列为空时,或者我们检测到树不对称(即从队列中取出两个不相等...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSymmetric(self, root): 递归 :type root: TreeNode :rtype: bool - def isSymmetric2(self, root): 类bfs 每次提取两个结点并比较它们的值。 然后,将两个结点的左右子结点按相反的顺序插入队列中。 当队列为空时,或者我们检测到树不对称(即从队列中取出两个不相等...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def isSymmetric(self, root): """递归 :type root: TreeNode :rtype: bool""" <|body_0|> def isSymmetric2(self, root): """类bfs 每次提取两个结点并比较它们的值。 然后,将两个结点的左右子结点按相反的顺序插入队列中。 当队列为空时,或者我们检测到树不对称(即从队列中取出两个不相等的连续结点)时,算法结束。 :param root: :return:""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isSymmetric(self, root): """递归 :type root: TreeNode :rtype: bool""" def check(l, r): if not l and (not r): return True elif not l or not r: return False return check(l.left, r.right) and check(l.right, r.left) if...
the_stack_v2_python_sparse
101_对称二叉树.py
lovehhf/LeetCode
train
0
5ef5945412e965502c46996f9d8489fbdc62663b
[ "if head is None:\n return head\nodd_pointer = head\neven_pointer = even_head = head.next\nwhile even_pointer is not None:\n third_pointer = even_pointer.next\n if third_pointer is None:\n even_pointer.next = None\n else:\n even_pointer.next = third_pointer.next\n odd_pointer.next = thi...
<|body_start_0|> if head is None: return head odd_pointer = head even_pointer = even_head = head.next while even_pointer is not None: third_pointer = even_pointer.next if third_pointer is None: even_pointer.next = None else:...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def oddEvenList(self, head: ListNode) -> ListNode: """https://leetcode-cn.com/problems/odd-even-linked-list/solution/qi-ou-lian-biao-by-leetcode-solution/""" <|body_0|> def oddEvenList2(self, head: ListNode) -> ListNode: """https://leetcode-cn.com/problems/...
stack_v2_sparse_classes_75kplus_train_066195
2,773
no_license
[ { "docstring": "https://leetcode-cn.com/problems/odd-even-linked-list/solution/qi-ou-lian-biao-by-leetcode-solution/", "name": "oddEvenList", "signature": "def oddEvenList(self, head: ListNode) -> ListNode" }, { "docstring": "https://leetcode-cn.com/problems/odd-even-linked-list/solution/kuai-la...
2
stack_v2_sparse_classes_30k_train_004209
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def oddEvenList(self, head: ListNode) -> ListNode: https://leetcode-cn.com/problems/odd-even-linked-list/solution/qi-ou-lian-biao-by-leetcode-solution/ - def oddEvenList2(self, h...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def oddEvenList(self, head: ListNode) -> ListNode: https://leetcode-cn.com/problems/odd-even-linked-list/solution/qi-ou-lian-biao-by-leetcode-solution/ - def oddEvenList2(self, h...
3ea03cd8b1fa507553ebee4fd765c4cc4b5814b6
<|skeleton|> class Solution: def oddEvenList(self, head: ListNode) -> ListNode: """https://leetcode-cn.com/problems/odd-even-linked-list/solution/qi-ou-lian-biao-by-leetcode-solution/""" <|body_0|> def oddEvenList2(self, head: ListNode) -> ListNode: """https://leetcode-cn.com/problems/...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def oddEvenList(self, head: ListNode) -> ListNode: """https://leetcode-cn.com/problems/odd-even-linked-list/solution/qi-ou-lian-biao-by-leetcode-solution/""" if head is None: return head odd_pointer = head even_pointer = even_head = head.next while...
the_stack_v2_python_sparse
Odd_Even_Linked_List_328.py
jay6413682/Leetcode
train
0
8d25ce8af433792ce2f23ffbd8cf1c5d13d62a8f
[ "sleep(2)\nself.find_ele(self._ele_goto_add_member).click()\nreturn AddMemberPage(self.driver)", "sleep(2)\nrow_list = self.find_eles(self._row_list)\nname_list = [i.text for i in row_list]\nreturn name_list" ]
<|body_start_0|> sleep(2) self.find_ele(self._ele_goto_add_member).click() return AddMemberPage(self.driver) <|end_body_0|> <|body_start_1|> sleep(2) row_list = self.find_eles(self._row_list) name_list = [i.text for i in row_list] return name_list <|end_body_1|>
ContactPage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContactPage: def goto_add_member(self): """跳转添加成员页面 :return: AddMember类""" <|body_0|> def get_contact_list(self): """获取成员列表 :return: 成员名字列表""" <|body_1|> <|end_skeleton|> <|body_start_0|> sleep(2) self.find_ele(self._ele_goto_add_member).cli...
stack_v2_sparse_classes_75kplus_train_066196
1,581
no_license
[ { "docstring": "跳转添加成员页面 :return: AddMember类", "name": "goto_add_member", "signature": "def goto_add_member(self)" }, { "docstring": "获取成员列表 :return: 成员名字列表", "name": "get_contact_list", "signature": "def get_contact_list(self)" } ]
2
stack_v2_sparse_classes_30k_train_007864
Implement the Python class `ContactPage` described below. Class description: Implement the ContactPage class. Method signatures and docstrings: - def goto_add_member(self): 跳转添加成员页面 :return: AddMember类 - def get_contact_list(self): 获取成员列表 :return: 成员名字列表
Implement the Python class `ContactPage` described below. Class description: Implement the ContactPage class. Method signatures and docstrings: - def goto_add_member(self): 跳转添加成员页面 :return: AddMember类 - def get_contact_list(self): 获取成员列表 :return: 成员名字列表 <|skeleton|> class ContactPage: def goto_add_member(self)...
ba773dc444c005b1dff40a949743e941f7171c86
<|skeleton|> class ContactPage: def goto_add_member(self): """跳转添加成员页面 :return: AddMember类""" <|body_0|> def get_contact_list(self): """获取成员列表 :return: 成员名字列表""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ContactPage: def goto_add_member(self): """跳转添加成员页面 :return: AddMember类""" sleep(2) self.find_ele(self._ele_goto_add_member).click() return AddMemberPage(self.driver) def get_contact_list(self): """获取成员列表 :return: 成员名字列表""" sleep(2) row_list = self....
the_stack_v2_python_sparse
class_3_1_task/page/contact_page.py
wanglei96/taskBase
train
0
a2d6af3d9ec871089d0fe30569f047ec486de9ac
[ "try:\n template_xsl_rendering_object = template_xsl_rendering_api.get_by_id(pk)\n template_xsl_rendering_serializer = TemplateXslRenderingSerializer(template_xsl_rendering_object)\n return Response(template_xsl_rendering_serializer.data)\nexcept exceptions.DoesNotExist:\n content = {'message': 'XSL ren...
<|body_start_0|> try: template_xsl_rendering_object = template_xsl_rendering_api.get_by_id(pk) template_xsl_rendering_serializer = TemplateXslRenderingSerializer(template_xsl_rendering_object) return Response(template_xsl_rendering_serializer.data) except exceptions.D...
TemplateXslRendering details view
TemplateXslRenderingDetail
[ "NIST-Software" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TemplateXslRenderingDetail: """TemplateXslRendering details view""" def get(self, request, pk): """Get `TemplateXSLRendering` object from db Args: request: HTTP request pk: ObjectId Returns: TemplateXSLRendering""" <|body_0|> def patch(self, request, pk): """Edit...
stack_v2_sparse_classes_75kplus_train_066197
14,418
permissive
[ { "docstring": "Get `TemplateXSLRendering` object from db Args: request: HTTP request pk: ObjectId Returns: TemplateXSLRendering", "name": "get", "signature": "def get(self, request, pk)" }, { "docstring": "Edit `TemplateXSLRendering` object from db Args: request: HTTP request pk: ObjectId Retur...
3
stack_v2_sparse_classes_30k_train_020432
Implement the Python class `TemplateXslRenderingDetail` described below. Class description: TemplateXslRendering details view Method signatures and docstrings: - def get(self, request, pk): Get `TemplateXSLRendering` object from db Args: request: HTTP request pk: ObjectId Returns: TemplateXSLRendering - def patch(sel...
Implement the Python class `TemplateXslRenderingDetail` described below. Class description: TemplateXslRendering details view Method signatures and docstrings: - def get(self, request, pk): Get `TemplateXSLRendering` object from db Args: request: HTTP request pk: ObjectId Returns: TemplateXSLRendering - def patch(sel...
f032036d95076f92b164389fdbec7415567e7b0f
<|skeleton|> class TemplateXslRenderingDetail: """TemplateXslRendering details view""" def get(self, request, pk): """Get `TemplateXSLRendering` object from db Args: request: HTTP request pk: ObjectId Returns: TemplateXSLRendering""" <|body_0|> def patch(self, request, pk): """Edit...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TemplateXslRenderingDetail: """TemplateXslRendering details view""" def get(self, request, pk): """Get `TemplateXSLRendering` object from db Args: request: HTTP request pk: ObjectId Returns: TemplateXSLRendering""" try: template_xsl_rendering_object = template_xsl_rendering_ap...
the_stack_v2_python_sparse
core_main_app/rest/template_xsl_rendering/views.py
usnistgov/core_main_app
train
3
9d0311eee66d247c2e9b7f04a8f3221b3a29d538
[ "if num_rows == 1 or num_rows >= len(s):\n return s\nresult = []\ncycle = 2 * num_rows - 2\nfor row in range(num_rows):\n for curr in range(row, len(s), cycle):\n result.append(s[curr])\n mid_row_index = curr + cycle - 2 * row\n if row != 0 and row != num_rows - 1 and (mid_row_index < len...
<|body_start_0|> if num_rows == 1 or num_rows >= len(s): return s result = [] cycle = 2 * num_rows - 2 for row in range(num_rows): for curr in range(row, len(s), cycle): result.append(s[curr]) mid_row_index = curr + cycle - 2 * row ...
ZigZag
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZigZag: def convert_(self, s: str, num_rows: int) -> str: """Approach: Visit By Row Time Complexity: O(N) Space Complexity: O(N) :param s: :param num_rows: :return:""" <|body_0|> def convert(self, s: str, num_rows: int) -> str: """Approach: Sort by Row Time Complexit...
stack_v2_sparse_classes_75kplus_train_066198
1,651
no_license
[ { "docstring": "Approach: Visit By Row Time Complexity: O(N) Space Complexity: O(N) :param s: :param num_rows: :return:", "name": "convert_", "signature": "def convert_(self, s: str, num_rows: int) -> str" }, { "docstring": "Approach: Sort by Row Time Complexity: O(N) Space Complexity: O(N) :par...
2
stack_v2_sparse_classes_30k_train_014583
Implement the Python class `ZigZag` described below. Class description: Implement the ZigZag class. Method signatures and docstrings: - def convert_(self, s: str, num_rows: int) -> str: Approach: Visit By Row Time Complexity: O(N) Space Complexity: O(N) :param s: :param num_rows: :return: - def convert(self, s: str, ...
Implement the Python class `ZigZag` described below. Class description: Implement the ZigZag class. Method signatures and docstrings: - def convert_(self, s: str, num_rows: int) -> str: Approach: Visit By Row Time Complexity: O(N) Space Complexity: O(N) :param s: :param num_rows: :return: - def convert(self, s: str, ...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class ZigZag: def convert_(self, s: str, num_rows: int) -> str: """Approach: Visit By Row Time Complexity: O(N) Space Complexity: O(N) :param s: :param num_rows: :return:""" <|body_0|> def convert(self, s: str, num_rows: int) -> str: """Approach: Sort by Row Time Complexit...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ZigZag: def convert_(self, s: str, num_rows: int) -> str: """Approach: Visit By Row Time Complexity: O(N) Space Complexity: O(N) :param s: :param num_rows: :return:""" if num_rows == 1 or num_rows >= len(s): return s result = [] cycle = 2 * num_rows - 2 for ...
the_stack_v2_python_sparse
revisited__2021/math_and_string/zig_zag_conversion.py
Shiv2157k/leet_code
train
1
42154493083a67dac70c4862fc1205eb76e4c0e9
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn IntelligenceProfileIndicator()", "from .indicator import Indicator\nfrom .indicator import Indicator\nfields: Dict[str, Callable[[Any], None]] = {'firstSeenDateTime': lambda n: setattr(self, 'first_seen_date_time', n.get_datetime_value...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return IntelligenceProfileIndicator() <|end_body_0|> <|body_start_1|> from .indicator import Indicator from .indicator import Indicator fields: Dict[str, Callable[[Any], None]] = {'firs...
IntelligenceProfileIndicator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IntelligenceProfileIndicator: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IntelligenceProfileIndicator: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value...
stack_v2_sparse_classes_75kplus_train_066199
2,959
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: IntelligenceProfileIndicator", "name": "create_from_discriminator_value", "signature": "def create_from_disc...
3
stack_v2_sparse_classes_30k_train_037587
Implement the Python class `IntelligenceProfileIndicator` described below. Class description: Implement the IntelligenceProfileIndicator class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IntelligenceProfileIndicator: Creates a new instance of the a...
Implement the Python class `IntelligenceProfileIndicator` described below. Class description: Implement the IntelligenceProfileIndicator class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IntelligenceProfileIndicator: Creates a new instance of the a...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class IntelligenceProfileIndicator: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IntelligenceProfileIndicator: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IntelligenceProfileIndicator: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IntelligenceProfileIndicator: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create th...
the_stack_v2_python_sparse
msgraph/generated/models/security/intelligence_profile_indicator.py
microsoftgraph/msgraph-sdk-python
train
135