blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
50ba99a16374d14ea8ac3fca26dd55229e62c7cb
[ "world_size = int(os.environ['WORLD_SIZE'])\nnode_rank = int(os.environ['RANK'])\nlocal_rank = int(os.environ['LOCAL_RANK'])\nself.result_file_template = result_file_template\ntorch.distributed.init_process_group(backend='nccl')\ncuda.set_device(local_rank)\nlabel_mapping = {0, 'right', 1, 'left', 2, 'neutral'}\nte...
<|body_start_0|> world_size = int(os.environ['WORLD_SIZE']) node_rank = int(os.environ['RANK']) local_rank = int(os.environ['LOCAL_RANK']) self.result_file_template = result_file_template torch.distributed.init_process_group(backend='nccl') cuda.set_device(local_rank) ...
Pretends to be a training script that is forked into (potentially) multiple processes on multiple machines. This minimal test script is used with test_multiprocess_sampler.py. It merely draws samples from an Sqlite test database via a distributed sampler. Each forked instance of this script runs through two epochs over...
TrainProcessTestHelper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrainProcessTestHelper: """Pretends to be a training script that is forked into (potentially) multiple processes on multiple machines. This minimal test script is used with test_multiprocess_sampler.py. It merely draws samples from an Sqlite test database via a distributed sampler. Each forked in...
stack_v2_sparse_classes_36k_train_033900
6,063
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, result_file_template)" }, { "docstring": "Ask for all the samples in a loop Write the result to a file as a dict @param epoch: @type epoch:", "name": "run", "signature": "def run(self, epoch, accumulated_d...
2
stack_v2_sparse_classes_30k_train_012632
Implement the Python class `TrainProcessTestHelper` described below. Class description: Pretends to be a training script that is forked into (potentially) multiple processes on multiple machines. This minimal test script is used with test_multiprocess_sampler.py. It merely draws samples from an Sqlite test database vi...
Implement the Python class `TrainProcessTestHelper` described below. Class description: Pretends to be a training script that is forked into (potentially) multiple processes on multiple machines. This minimal test script is used with test_multiprocess_sampler.py. It merely draws samples from an Sqlite test database vi...
854358d573831cd47d926448412daf3062d8c291
<|skeleton|> class TrainProcessTestHelper: """Pretends to be a training script that is forked into (potentially) multiple processes on multiple machines. This minimal test script is used with test_multiprocess_sampler.py. It merely draws samples from an Sqlite test database via a distributed sampler. Each forked in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrainProcessTestHelper: """Pretends to be a training script that is forked into (potentially) multiple processes on multiple machines. This minimal test script is used with test_multiprocess_sampler.py. It merely draws samples from an Sqlite test database via a distributed sampler. Each forked instance of thi...
the_stack_v2_python_sparse
src/classifier/training_script_test_helper.py
paepcke/bert_train_parallel
train
0
d205a0585ccfdbb1075d2b33e40a4b0bbbd1cd71
[ "super().__init__()\nself.decoder = nn.Sequential(nn.Conv2d(512, 512, kernel_size=1), nn.ReLU(inplace=True), nn.Dropout(0.8), nn.Conv2d(512, 512, kernel_size=1), nn.ReLU(inplace=True))\nself.layer = nn.ConvTranspose2d(1280, num_classes, kernel_size=2, stride=2, dilation=1)", "pool_3, pool_4 = pools\nx = self.deco...
<|body_start_0|> super().__init__() self.decoder = nn.Sequential(nn.Conv2d(512, 512, kernel_size=1), nn.ReLU(inplace=True), nn.Dropout(0.8), nn.Conv2d(512, 512, kernel_size=1), nn.ReLU(inplace=True)) self.layer = nn.ConvTranspose2d(1280, num_classes, kernel_size=2, stride=2, dilation=1) <|end_bo...
Column Decoder.
ColumnDecoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ColumnDecoder: """Column Decoder.""" def __init__(self, num_classes: int): """Initialize Column Decoder. Args: num_classes (int): Number of classes per point.""" <|body_0|> def forward(self, x, pools): """Forward pass. Args: x (tensor): Batch of images to perform...
stack_v2_sparse_classes_36k_train_033901
5,468
no_license
[ { "docstring": "Initialize Column Decoder. Args: num_classes (int): Number of classes per point.", "name": "__init__", "signature": "def __init__(self, num_classes: int)" }, { "docstring": "Forward pass. Args: x (tensor): Batch of images to perform forward-pass. pools (Tuple[tensor, tensor]): Th...
2
stack_v2_sparse_classes_30k_train_011386
Implement the Python class `ColumnDecoder` described below. Class description: Column Decoder. Method signatures and docstrings: - def __init__(self, num_classes: int): Initialize Column Decoder. Args: num_classes (int): Number of classes per point. - def forward(self, x, pools): Forward pass. Args: x (tensor): Batch...
Implement the Python class `ColumnDecoder` described below. Class description: Column Decoder. Method signatures and docstrings: - def __init__(self, num_classes: int): Initialize Column Decoder. Args: num_classes (int): Number of classes per point. - def forward(self, x, pools): Forward pass. Args: x (tensor): Batch...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class ColumnDecoder: """Column Decoder.""" def __init__(self, num_classes: int): """Initialize Column Decoder. Args: num_classes (int): Number of classes per point.""" <|body_0|> def forward(self, x, pools): """Forward pass. Args: x (tensor): Batch of images to perform...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ColumnDecoder: """Column Decoder.""" def __init__(self, num_classes: int): """Initialize Column Decoder. Args: num_classes (int): Number of classes per point.""" super().__init__() self.decoder = nn.Sequential(nn.Conv2d(512, 512, kernel_size=1), nn.ReLU(inplace=True), nn.Dropout(0...
the_stack_v2_python_sparse
generated/test_tomassosorio_OCR_tablenet.py
jansel/pytorch-jit-paritybench
train
35
5861aa6a68c84768509d543fbd4efcd5c1eb78c1
[ "lo = 0\nhi = len(nums) - 1\nwhile lo < hi:\n mid = (lo + hi) // 2\n if nums[mid] == target:\n return mid\n elif nums[mid] < target:\n lo = mid + 1\n else:\n hi = mid - 1\nreturn lo if target <= nums[lo] else lo + 1", "length = len(nums)\nfor i in range(length):\n if nums[i] >=...
<|body_start_0|> lo = 0 hi = len(nums) - 1 while lo < hi: mid = (lo + hi) // 2 if nums[mid] == target: return mid elif nums[mid] < target: lo = mid + 1 else: hi = mid - 1 return lo if target <...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchInsert(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def searchInsert_myfirst(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_36k_train_033902
1,074
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "searchInsert", "signature": "def searchInsert(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "searchInsert_myfirst", "signature": "def searchInsert_myfirs...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchInsert(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def searchInsert_myfirst(self, nums, target): :type nums: List[int] :type target: int ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchInsert(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def searchInsert_myfirst(self, nums, target): :type nums: List[int] :type target: int ...
f0d9070fa292ca36971a465a805faddb12025482
<|skeleton|> class Solution: def searchInsert(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def searchInsert_myfirst(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def searchInsert(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" lo = 0 hi = len(nums) - 1 while lo < hi: mid = (lo + hi) // 2 if nums[mid] == target: return mid elif nums[mid] < target...
the_stack_v2_python_sparse
35.SearchInsertPosition.py
JerryRoc/leetcode
train
0
b2a91db4a2002481d3672358796262551739df3c
[ "self.__logger = State().getLogger('Postprocessing_Component_Logger')\nself.__logger.info('Starting __init__()', 'Postprocessing:__init__')\n'\\n Todo: create some Postprocessing Classes \\n '\nself.__logger.info('Finished __init__()', 'Postprocessing:__init__')", "self.__logger.info('Starting execu...
<|body_start_0|> self.__logger = State().getLogger('Postprocessing_Component_Logger') self.__logger.info('Starting __init__()', 'Postprocessing:__init__') '\n Todo: create some Postprocessing Classes \n ' self.__logger.info('Finished __init__()', 'Postprocessing:__init__') ...
Postprocessing
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Postprocessing: def __init__(self, config): """Constructor, initialisiert Membervariablen. Parameters ---------- config : Config Die Konfiguration. Example ------- >>> Postprocessing(config)""" <|body_0|> def execute(self, classification): """Führt Postprocessingschr...
stack_v2_sparse_classes_36k_train_033903
1,779
no_license
[ { "docstring": "Constructor, initialisiert Membervariablen. Parameters ---------- config : Config Die Konfiguration. Example ------- >>> Postprocessing(config)", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Führt Postprocessingschritte auf die Klassifizierung ...
2
stack_v2_sparse_classes_30k_train_008889
Implement the Python class `Postprocessing` described below. Class description: Implement the Postprocessing class. Method signatures and docstrings: - def __init__(self, config): Constructor, initialisiert Membervariablen. Parameters ---------- config : Config Die Konfiguration. Example ------- >>> Postprocessing(co...
Implement the Python class `Postprocessing` described below. Class description: Implement the Postprocessing class. Method signatures and docstrings: - def __init__(self, config): Constructor, initialisiert Membervariablen. Parameters ---------- config : Config Die Konfiguration. Example ------- >>> Postprocessing(co...
3daaa72b193ebfb55894b47b6a752cdc2192bb6b
<|skeleton|> class Postprocessing: def __init__(self, config): """Constructor, initialisiert Membervariablen. Parameters ---------- config : Config Die Konfiguration. Example ------- >>> Postprocessing(config)""" <|body_0|> def execute(self, classification): """Führt Postprocessingschr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Postprocessing: def __init__(self, config): """Constructor, initialisiert Membervariablen. Parameters ---------- config : Config Die Konfiguration. Example ------- >>> Postprocessing(config)""" self.__logger = State().getLogger('Postprocessing_Component_Logger') self.__logger.info('Sta...
the_stack_v2_python_sparse
SheetMusicScanner/Postprocessing_Component/Postprocessing/Postprocessing.py
jadeskon/score-scan
train
0
44e06198f514cdc6420cf78ddcabba26a5d51796
[ "self.agent_project_id = agent_project_id\nself.conflicting_packages = conflicting_packages\nsuper().__init__(self._build_error_message())", "conflicting_packages = sorted(self.conflicting_packages, key=str)\nmessage = f\"cannot add project '{self.agent_project_id}': the following AEA dependencies have conflicts ...
<|body_start_0|> self.agent_project_id = agent_project_id self.conflicting_packages = conflicting_packages super().__init__(self._build_error_message()) <|end_body_0|> <|body_start_1|> conflicting_packages = sorted(self.conflicting_packages, key=str) message = f"cannot add proje...
Check consistency of package versions against already added project.
ProjectPackageConsistencyCheckError
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectPackageConsistencyCheckError: """Check consistency of package versions against already added project.""" def __init__(self, agent_project_id: PublicId, conflicting_packages: List[Tuple[PackageIdPrefix, str, str, Set[PublicId]]]): """Initialize the exception. :param agent_proje...
stack_v2_sparse_classes_36k_train_033904
43,010
permissive
[ { "docstring": "Initialize the exception. :param agent_project_id: the agent project id whose addition has failed. :param conflicting_packages: the conflicting packages.", "name": "__init__", "signature": "def __init__(self, agent_project_id: PublicId, conflicting_packages: List[Tuple[PackageIdPrefix, s...
2
null
Implement the Python class `ProjectPackageConsistencyCheckError` described below. Class description: Check consistency of package versions against already added project. Method signatures and docstrings: - def __init__(self, agent_project_id: PublicId, conflicting_packages: List[Tuple[PackageIdPrefix, str, str, Set[P...
Implement the Python class `ProjectPackageConsistencyCheckError` described below. Class description: Check consistency of package versions against already added project. Method signatures and docstrings: - def __init__(self, agent_project_id: PublicId, conflicting_packages: List[Tuple[PackageIdPrefix, str, str, Set[P...
bec49adaeba661d8d0f03ac9935dc89f39d95a0d
<|skeleton|> class ProjectPackageConsistencyCheckError: """Check consistency of package versions against already added project.""" def __init__(self, agent_project_id: PublicId, conflicting_packages: List[Tuple[PackageIdPrefix, str, str, Set[PublicId]]]): """Initialize the exception. :param agent_proje...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProjectPackageConsistencyCheckError: """Check consistency of package versions against already added project.""" def __init__(self, agent_project_id: PublicId, conflicting_packages: List[Tuple[PackageIdPrefix, str, str, Set[PublicId]]]): """Initialize the exception. :param agent_project_id: the ag...
the_stack_v2_python_sparse
aea/manager/manager.py
fetchai/agents-aea
train
192
a44ddc9ddf68798ffc106d110f5437c4bb3b80ea
[ "for i in range(self.backupCount - 1, 0, -1):\n sfn = self.rotation_filename('%s.%d' % (self.baseFilename, i))\n dfn = self.rotation_filename('%s.%d' % (self.baseFilename, i + 1))\n if os.path.exists(sfn):\n if os.path.exists(dfn):\n os.remove(dfn)\n os.chmod(sfn, stat.S_IRUSR)\n ...
<|body_start_0|> for i in range(self.backupCount - 1, 0, -1): sfn = self.rotation_filename('%s.%d' % (self.baseFilename, i)) dfn = self.rotation_filename('%s.%d' % (self.baseFilename, i + 1)) if os.path.exists(sfn): if os.path.exists(dfn): ...
Inherit RotatingFileHandler for multiprocess compatibility.
MultiCompatibleRotatingFileHandler
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "MIT", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiCompatibleRotatingFileHandler: """Inherit RotatingFileHandler for multiprocess compatibility.""" def rolling_rename(self): """Rolling rename log files.""" <|body_0|> def doRollover(self): """Do a rollover, as described in __init__().""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_033905
8,220
permissive
[ { "docstring": "Rolling rename log files.", "name": "rolling_rename", "signature": "def rolling_rename(self)" }, { "docstring": "Do a rollover, as described in __init__().", "name": "doRollover", "signature": "def doRollover(self)" }, { "docstring": "Open the current base file wi...
3
null
Implement the Python class `MultiCompatibleRotatingFileHandler` described below. Class description: Inherit RotatingFileHandler for multiprocess compatibility. Method signatures and docstrings: - def rolling_rename(self): Rolling rename log files. - def doRollover(self): Do a rollover, as described in __init__(). - d...
Implement the Python class `MultiCompatibleRotatingFileHandler` described below. Class description: Inherit RotatingFileHandler for multiprocess compatibility. Method signatures and docstrings: - def rolling_rename(self): Rolling rename log files. - def doRollover(self): Do a rollover, as described in __init__(). - d...
a774d893fb2f21dbc3edb5cd89f9e6eec274ebf1
<|skeleton|> class MultiCompatibleRotatingFileHandler: """Inherit RotatingFileHandler for multiprocess compatibility.""" def rolling_rename(self): """Rolling rename log files.""" <|body_0|> def doRollover(self): """Do a rollover, as described in __init__().""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiCompatibleRotatingFileHandler: """Inherit RotatingFileHandler for multiprocess compatibility.""" def rolling_rename(self): """Rolling rename log files.""" for i in range(self.backupCount - 1, 0, -1): sfn = self.rotation_filename('%s.%d' % (self.baseFilename, i)) ...
the_stack_v2_python_sparse
mindinsight/utils/log.py
mindspore-ai/mindinsight
train
224
e5ab5511bfc15c6f36690c752b5cbeb03171476d
[ "context = super(ExhibitionCreateView, self).get_context_data(**kwargs)\ncontext['page_title'] = u'Создание новой выставки'\nreturn context", "message = super(ExhibitionCreateView, self).form_valid(form)\nmes = u'Выставка {} успешно добавлена.'.format(self.object.name)\nmessages.success(self.request, mes)\nreturn...
<|body_start_0|> context = super(ExhibitionCreateView, self).get_context_data(**kwargs) context['page_title'] = u'Создание новой выставки' return context <|end_body_0|> <|body_start_1|> message = super(ExhibitionCreateView, self).form_valid(form) mes = u'Выставка {} успешно доба...
Add new exhibition
ExhibitionCreateView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExhibitionCreateView: """Add new exhibition""" def get_context_data(self, **kwargs): """Extends context data :param kwargs: :return: context""" <|body_0|> def form_valid(self, form): """The successful addition of new exhibition :param form: :return: message""" ...
stack_v2_sparse_classes_36k_train_033906
5,515
no_license
[ { "docstring": "Extends context data :param kwargs: :return: context", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, { "docstring": "The successful addition of new exhibition :param form: :return: message", "name": "form_valid", "signature": "def form...
2
stack_v2_sparse_classes_30k_train_020389
Implement the Python class `ExhibitionCreateView` described below. Class description: Add new exhibition Method signatures and docstrings: - def get_context_data(self, **kwargs): Extends context data :param kwargs: :return: context - def form_valid(self, form): The successful addition of new exhibition :param form: :...
Implement the Python class `ExhibitionCreateView` described below. Class description: Add new exhibition Method signatures and docstrings: - def get_context_data(self, **kwargs): Extends context data :param kwargs: :return: context - def form_valid(self, form): The successful addition of new exhibition :param form: :...
8eb18b831e034302f90585a179110336bb18af45
<|skeleton|> class ExhibitionCreateView: """Add new exhibition""" def get_context_data(self, **kwargs): """Extends context data :param kwargs: :return: context""" <|body_0|> def form_valid(self, form): """The successful addition of new exhibition :param form: :return: message""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExhibitionCreateView: """Add new exhibition""" def get_context_data(self, **kwargs): """Extends context data :param kwargs: :return: context""" context = super(ExhibitionCreateView, self).get_context_data(**kwargs) context['page_title'] = u'Создание новой выставки' return ...
the_stack_v2_python_sparse
exhibition/views.py
YevheniiaSmyrnova/butterflies
train
0
62c9aaf0413b0e8b040f57d2b37a2a3ff5280e51
[ "super(Timeline, self).__init__(width=width, height=height)\nself._page_title = page_title\nself._time_points = []\nself._option = {'baseOption': {'timeline': {'axisType': 'category', 'autoPlay': is_auto_play, 'loop': is_loop_play, 'rewind': is_rewind_play, 'show': is_timeline_show, 'symbol': timeline_symbol, 'symb...
<|body_start_0|> super(Timeline, self).__init__(width=width, height=height) self._page_title = page_title self._time_points = [] self._option = {'baseOption': {'timeline': {'axisType': 'category', 'autoPlay': is_auto_play, 'loop': is_loop_play, 'rewind': is_rewind_play, 'show': is_timeli...
时间线轮播多张图
Timeline
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Timeline: """时间线轮播多张图""" def __init__(self, page_title=PAGE_TITLE, width=800, height=400, is_auto_play=False, is_loop_play=True, is_rewind_play=False, is_timeline_show=True, timeline_play_interval=2000, timeline_symbol='emptyCircle', timeline_symbol_size=10, timeline_left='auto', timeline_ri...
stack_v2_sparse_classes_36k_train_033907
4,408
permissive
[ { "docstring": ":param is_auto_play: 是否自动播放,默认为 Flase :param is_loop_play: 是否循环播放,默认为 True :param is_rewind_play: 是否方向播放,默认为 Flase :param is_timeline_show: 是否显示 timeline 组件。默认为 True,如果设置为false,不会显示,但是功能还存在。 :param timeline_play_interval: 播放的速度(跳动的间隔),单位毫秒(ms)。 :param timeline_symbol: 标记的图形。有'circle', 'rect', 'r...
3
stack_v2_sparse_classes_30k_train_004300
Implement the Python class `Timeline` described below. Class description: 时间线轮播多张图 Method signatures and docstrings: - def __init__(self, page_title=PAGE_TITLE, width=800, height=400, is_auto_play=False, is_loop_play=True, is_rewind_play=False, is_timeline_show=True, timeline_play_interval=2000, timeline_symbol='empt...
Implement the Python class `Timeline` described below. Class description: 时间线轮播多张图 Method signatures and docstrings: - def __init__(self, page_title=PAGE_TITLE, width=800, height=400, is_auto_play=False, is_loop_play=True, is_rewind_play=False, is_timeline_show=True, timeline_play_interval=2000, timeline_symbol='empt...
0bc901fdd31d69a2084355cd63a1e0a54ed5276a
<|skeleton|> class Timeline: """时间线轮播多张图""" def __init__(self, page_title=PAGE_TITLE, width=800, height=400, is_auto_play=False, is_loop_play=True, is_rewind_play=False, is_timeline_show=True, timeline_play_interval=2000, timeline_symbol='emptyCircle', timeline_symbol_size=10, timeline_left='auto', timeline_ri...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Timeline: """时间线轮播多张图""" def __init__(self, page_title=PAGE_TITLE, width=800, height=400, is_auto_play=False, is_loop_play=True, is_rewind_play=False, is_timeline_show=True, timeline_play_interval=2000, timeline_symbol='emptyCircle', timeline_symbol_size=10, timeline_left='auto', timeline_right='auto', t...
the_stack_v2_python_sparse
pyecharts/custom/timeline.py
yutiansut/pyecharts
train
2
d4b0066044d90a7f8e381a41f2ead03660738d6c
[ "mspec = model.ModelSpec(input={'text_a': types.TextSegment(), 'text_b': types.TextSegment()}, output={})\ndspec = mspec.input\nself.assertTrue(mspec.is_compatible_with_dataset(dspec))", "mspec = model.ModelSpec(input={'text_a': types.TextSegment(), 'text_b': types.TextSegment()}, output={})\ndspec = {'premise': ...
<|body_start_0|> mspec = model.ModelSpec(input={'text_a': types.TextSegment(), 'text_b': types.TextSegment()}, output={}) dspec = mspec.input self.assertTrue(mspec.is_compatible_with_dataset(dspec)) <|end_body_0|> <|body_start_1|> mspec = model.ModelSpec(input={'text_a': types.TextSegme...
SpecTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpecTest: def test_compatibility_fullmatch(self): """Test with an exact match.""" <|body_0|> def test_compatibility_mismatch(self): """Test with specs that don't match.""" <|body_1|> def test_compatibility_extrafield(self): """Test with an extra ...
stack_v2_sparse_classes_36k_train_033908
4,744
permissive
[ { "docstring": "Test with an exact match.", "name": "test_compatibility_fullmatch", "signature": "def test_compatibility_fullmatch(self)" }, { "docstring": "Test with specs that don't match.", "name": "test_compatibility_mismatch", "signature": "def test_compatibility_mismatch(self)" }...
5
null
Implement the Python class `SpecTest` described below. Class description: Implement the SpecTest class. Method signatures and docstrings: - def test_compatibility_fullmatch(self): Test with an exact match. - def test_compatibility_mismatch(self): Test with specs that don't match. - def test_compatibility_extrafield(s...
Implement the Python class `SpecTest` described below. Class description: Implement the SpecTest class. Method signatures and docstrings: - def test_compatibility_fullmatch(self): Test with an exact match. - def test_compatibility_mismatch(self): Test with specs that don't match. - def test_compatibility_extrafield(s...
a41130960d6ccb92acf6ffc603377eaecce8a62b
<|skeleton|> class SpecTest: def test_compatibility_fullmatch(self): """Test with an exact match.""" <|body_0|> def test_compatibility_mismatch(self): """Test with specs that don't match.""" <|body_1|> def test_compatibility_extrafield(self): """Test with an extra ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpecTest: def test_compatibility_fullmatch(self): """Test with an exact match.""" mspec = model.ModelSpec(input={'text_a': types.TextSegment(), 'text_b': types.TextSegment()}, output={}) dspec = mspec.input self.assertTrue(mspec.is_compatible_with_dataset(dspec)) def test_...
the_stack_v2_python_sparse
lit_nlp/api/model_test.py
PAIR-code/lit
train
3,201
9156ea9d49cc8c34ed1a4f8620566d632ef7ff0d
[ "data_list = models.Server.objects.all()\nserializer = serializers.MySerializer(instance=data_list, many=True)\nreturn JsonResponse(serializer.data, safe=False)", "data = JSONParser().parse(request)\nserializer = serializers.MySerializer(data=data)\nif serializer.is_valid():\n serializer.save()\nreturn HttpRes...
<|body_start_0|> data_list = models.Server.objects.all() serializer = serializers.MySerializer(instance=data_list, many=True) return JsonResponse(serializer.data, safe=False) <|end_body_0|> <|body_start_1|> data = JSONParser().parse(request) serializer = serializers.MySerializer...
ServerView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServerView: def get(self, request, *args, **kwargs): """获取列表 :param request: :param args: :param kwargs: :return:""" <|body_0|> def post(self, request, *args, **kwargs): """创建数据 :param request: request经过封装 :param args: :param kwargs: :return:""" <|body_1|> <...
stack_v2_sparse_classes_36k_train_033909
6,597
permissive
[ { "docstring": "获取列表 :param request: :param args: :param kwargs: :return:", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "创建数据 :param request: request经过封装 :param args: :param kwargs: :return:", "name": "post", "signature": "def post(self, reques...
2
null
Implement the Python class `ServerView` described below. Class description: Implement the ServerView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): 获取列表 :param request: :param args: :param kwargs: :return: - def post(self, request, *args, **kwargs): 创建数据 :param request: request经过封...
Implement the Python class `ServerView` described below. Class description: Implement the ServerView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): 获取列表 :param request: :param args: :param kwargs: :return: - def post(self, request, *args, **kwargs): 创建数据 :param request: request经过封...
4ff1d02d2b6dd54e96f7179fa000548936b691e7
<|skeleton|> class ServerView: def get(self, request, *args, **kwargs): """获取列表 :param request: :param args: :param kwargs: :return:""" <|body_0|> def post(self, request, *args, **kwargs): """创建数据 :param request: request经过封装 :param args: :param kwargs: :return:""" <|body_1|> <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ServerView: def get(self, request, *args, **kwargs): """获取列表 :param request: :param args: :param kwargs: :return:""" data_list = models.Server.objects.all() serializer = serializers.MySerializer(instance=data_list, many=True) return JsonResponse(serializer.data, safe=False) ...
the_stack_v2_python_sparse
CMDB_SYSTEM/autoserver/server/views.py
MMingLeung/Python_Study
train
3
af00d63970ed50f846ba6bb2be62bc662bc00015
[ "queue = deque()\nqueue.append(root)\nwhile queue:\n size = len(queue)\n self.value = queue[0].val\n for _ in range(size):\n node = queue.popleft()\n if node.left:\n queue.append(node.left)\n if node.right:\n queue.append(node.right)\nreturn self.value", "queue ...
<|body_start_0|> queue = deque() queue.append(root) while queue: size = len(queue) self.value = queue[0].val for _ in range(size): node = queue.popleft() if node.left: queue.append(node.left) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findBottomLeftValue(self, root: TreeNode) -> int: """BFS""" <|body_0|> def findBottomLeftValue_1(self, root: TreeNode) -> int: """改进版BFS""" <|body_1|> def findBottomLeftValue_2(self, root: TreeNode) -> int: """DFS""" <|body_...
stack_v2_sparse_classes_36k_train_033910
1,622
no_license
[ { "docstring": "BFS", "name": "findBottomLeftValue", "signature": "def findBottomLeftValue(self, root: TreeNode) -> int" }, { "docstring": "改进版BFS", "name": "findBottomLeftValue_1", "signature": "def findBottomLeftValue_1(self, root: TreeNode) -> int" }, { "docstring": "DFS", ...
3
stack_v2_sparse_classes_30k_train_003683
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findBottomLeftValue(self, root: TreeNode) -> int: BFS - def findBottomLeftValue_1(self, root: TreeNode) -> int: 改进版BFS - def findBottomLeftValue_2(self, root: TreeNode) -> in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findBottomLeftValue(self, root: TreeNode) -> int: BFS - def findBottomLeftValue_1(self, root: TreeNode) -> int: 改进版BFS - def findBottomLeftValue_2(self, root: TreeNode) -> in...
3508e1ce089131b19603c3206aab4cf43023bb19
<|skeleton|> class Solution: def findBottomLeftValue(self, root: TreeNode) -> int: """BFS""" <|body_0|> def findBottomLeftValue_1(self, root: TreeNode) -> int: """改进版BFS""" <|body_1|> def findBottomLeftValue_2(self, root: TreeNode) -> int: """DFS""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findBottomLeftValue(self, root: TreeNode) -> int: """BFS""" queue = deque() queue.append(root) while queue: size = len(queue) self.value = queue[0].val for _ in range(size): node = queue.popleft() ...
the_stack_v2_python_sparse
algorithm/leetcode/bfs/13-找树左下角的值.py
lxconfig/UbuntuCode_bak
train
0
8134be26b083bea97f14a1f9d00d6aa12556a004
[ "super(PositionalEncoding, self).__init__()\nself.d_model = d_model\nself.reverse = reverse\nself.xscale = math.sqrt(self.d_model)\nself.dropout = torch.nn.Dropout(p=dropout_rate)\nself.pe = None\nself.extend_pe(torch.tensor(0.0).expand(1, max_len))\nself._register_load_state_dict_pre_hook(_pre_hook)", "if self.p...
<|body_start_0|> super(PositionalEncoding, self).__init__() self.d_model = d_model self.reverse = reverse self.xscale = math.sqrt(self.d_model) self.dropout = torch.nn.Dropout(p=dropout_rate) self.pe = None self.extend_pe(torch.tensor(0.0).expand(1, max_len)) ...
Positional encoding. Args: d_model (int): Embedding dimension. dropout_rate (float): Dropout rate. max_len (int): Maximum input length. reverse (bool): Whether to reverse the input position.
PositionalEncoding
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PositionalEncoding: """Positional encoding. Args: d_model (int): Embedding dimension. dropout_rate (float): Dropout rate. max_len (int): Maximum input length. reverse (bool): Whether to reverse the input position.""" def __init__(self, d_model, dropout_rate, max_len=5000, reverse=False): ...
stack_v2_sparse_classes_36k_train_033911
37,737
permissive
[ { "docstring": "Construct an PositionalEncoding object.", "name": "__init__", "signature": "def __init__(self, d_model, dropout_rate, max_len=5000, reverse=False)" }, { "docstring": "Reset the positional encodings.", "name": "extend_pe", "signature": "def extend_pe(self, x)" }, { ...
3
null
Implement the Python class `PositionalEncoding` described below. Class description: Positional encoding. Args: d_model (int): Embedding dimension. dropout_rate (float): Dropout rate. max_len (int): Maximum input length. reverse (bool): Whether to reverse the input position. Method signatures and docstrings: - def __i...
Implement the Python class `PositionalEncoding` described below. Class description: Positional encoding. Args: d_model (int): Embedding dimension. dropout_rate (float): Dropout rate. max_len (int): Maximum input length. reverse (bool): Whether to reverse the input position. Method signatures and docstrings: - def __i...
31d50b1ea1dea92f4182c5b2b6fe9fe4c981ae39
<|skeleton|> class PositionalEncoding: """Positional encoding. Args: d_model (int): Embedding dimension. dropout_rate (float): Dropout rate. max_len (int): Maximum input length. reverse (bool): Whether to reverse the input position.""" def __init__(self, d_model, dropout_rate, max_len=5000, reverse=False): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PositionalEncoding: """Positional encoding. Args: d_model (int): Embedding dimension. dropout_rate (float): Dropout rate. max_len (int): Maximum input length. reverse (bool): Whether to reverse the input position.""" def __init__(self, d_model, dropout_rate, max_len=5000, reverse=False): """Const...
the_stack_v2_python_sparse
SVS/model/layers/conformer_related.py
SJTMusicTeam/SVS_system
train
85
c61e854800f4d24ed7d1d7c5f493e2b6729f036a
[ "if self.code == 'qcloud':\n _logger.info('>>>{}-正在使用腾讯云短信发送验证码<<<'.format(phone))\n templates = self.env['sms.template'].search([('partner_id', '=', self.id), ('ttype', '=', 'code')])\n if not templates:\n return {'state': False, 'msg': '发送失败:系统没有找到可用于发送验证码的模板'}\n s_sender = SmsSingleSender(self...
<|body_start_0|> if self.code == 'qcloud': _logger.info('>>>{}-正在使用腾讯云短信发送验证码<<<'.format(phone)) templates = self.env['sms.template'].search([('partner_id', '=', self.id), ('ttype', '=', 'code')]) if not templates: return {'state': False, 'msg': '发送失败:系统没有找到可用...
SmsPartner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SmsPartner: def send_message_code(self, user, phone, ttype): """发送验证码方法 :param user: 系统用户 :param phone: 手机号码 :param ttype: 消息类型 :return:""" <|body_0|> def send_registration_message(self, user, phone): """新用户创建成功后发送通知短信: 短信参数为两个参数,分别为账号和密码 短信模板: 《您的账号已创建成功。账号:${userna...
stack_v2_sparse_classes_36k_train_033912
3,415
permissive
[ { "docstring": "发送验证码方法 :param user: 系统用户 :param phone: 手机号码 :param ttype: 消息类型 :return:", "name": "send_message_code", "signature": "def send_message_code(self, user, phone, ttype)" }, { "docstring": "新用户创建成功后发送通知短信: 短信参数为两个参数,分别为账号和密码 短信模板: 《您的账号已创建成功。账号:${username},初始密码:${pwd},请及时修改初始密码。》 :pa...
2
null
Implement the Python class `SmsPartner` described below. Class description: Implement the SmsPartner class. Method signatures and docstrings: - def send_message_code(self, user, phone, ttype): 发送验证码方法 :param user: 系统用户 :param phone: 手机号码 :param ttype: 消息类型 :return: - def send_registration_message(self, user, phone): ...
Implement the Python class `SmsPartner` described below. Class description: Implement the SmsPartner class. Method signatures and docstrings: - def send_message_code(self, user, phone, ttype): 发送验证码方法 :param user: 系统用户 :param phone: 手机号码 :param ttype: 消息类型 :return: - def send_registration_message(self, user, phone): ...
8608aaeae7a8c86d53b68ce26b7b308f779c3dd8
<|skeleton|> class SmsPartner: def send_message_code(self, user, phone, ttype): """发送验证码方法 :param user: 系统用户 :param phone: 手机号码 :param ttype: 消息类型 :return:""" <|body_0|> def send_registration_message(self, user, phone): """新用户创建成功后发送通知短信: 短信参数为两个参数,分别为账号和密码 短信模板: 《您的账号已创建成功。账号:${userna...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SmsPartner: def send_message_code(self, user, phone, ttype): """发送验证码方法 :param user: 系统用户 :param phone: 手机号码 :param ttype: 消息类型 :return:""" if self.code == 'qcloud': _logger.info('>>>{}-正在使用腾讯云短信发送验证码<<<'.format(phone)) templates = self.env['sms.template'].search([('par...
the_stack_v2_python_sparse
sms_qcloud/models/sms_partner.py
niulinlnc/odooExtModel
train
4
be46f6b3c9e2aa853af8435c713ef4fe43b694f5
[ "super(TempDirMixin, self).setUp()\nif self.tempDirPrefix is not None:\n prefix = self.tempDirPrefix\nelse:\n prefix = 'test_'\nself.temp_dir = tempfile.mkdtemp(prefix=prefix)", "super(TempDirMixin, self).tearDown()\ntry:\n shutil.rmtree(six.text_type(self.temp_dir))\nexcept OSError:\n msg = 'Failed t...
<|body_start_0|> super(TempDirMixin, self).setUp() if self.tempDirPrefix is not None: prefix = self.tempDirPrefix else: prefix = 'test_' self.temp_dir = tempfile.mkdtemp(prefix=prefix) <|end_body_0|> <|body_start_1|> super(TempDirMixin, self).tearDown() ...
TempDirMixin
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TempDirMixin: def setUp(self): """Creates a pristine temp directory.""" <|body_0|> def tearDown(self): """Removes temp directory and all its contents.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(TempDirMixin, self).setUp() if self....
stack_v2_sparse_classes_36k_train_033913
877
permissive
[ { "docstring": "Creates a pristine temp directory.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Removes temp directory and all its contents.", "name": "tearDown", "signature": "def tearDown(self)" } ]
2
null
Implement the Python class `TempDirMixin` described below. Class description: Implement the TempDirMixin class. Method signatures and docstrings: - def setUp(self): Creates a pristine temp directory. - def tearDown(self): Removes temp directory and all its contents.
Implement the Python class `TempDirMixin` described below. Class description: Implement the TempDirMixin class. Method signatures and docstrings: - def setUp(self): Creates a pristine temp directory. - def tearDown(self): Removes temp directory and all its contents. <|skeleton|> class TempDirMixin: def setUp(se...
1ef9a42d4eaa70d9b3e6e7fa519396c1e1174fcb
<|skeleton|> class TempDirMixin: def setUp(self): """Creates a pristine temp directory.""" <|body_0|> def tearDown(self): """Removes temp directory and all its contents.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TempDirMixin: def setUp(self): """Creates a pristine temp directory.""" super(TempDirMixin, self).setUp() if self.tempDirPrefix is not None: prefix = self.tempDirPrefix else: prefix = 'test_' self.temp_dir = tempfile.mkdtemp(prefix=prefix) d...
the_stack_v2_python_sparse
yepes/test_mixins/tempdir.py
samuelmaudo/yepes
train
0
6e8232eead4a1f47b24718ff0c85c9d620cf1f1b
[ "if super(PointLight, self).Light(lightID, mode):\n glLightf(lightID, GL_CONSTANT_ATTENUATION, self.attenuation[0])\n glLightf(lightID, GL_LINEAR_ATTENUATION, self.attenuation[1])\n glLightf(lightID, GL_QUADRATIC_ATTENUATION, self.attenuation[2])\n return 1\nelse:\n return 0", "if direction is None...
<|body_start_0|> if super(PointLight, self).Light(lightID, mode): glLightf(lightID, GL_CONSTANT_ATTENUATION, self.attenuation[0]) glLightf(lightID, GL_LINEAR_ATTENUATION, self.attenuation[1]) glLightf(lightID, GL_QUADRATIC_ATTENUATION, self.attenuation[2]) return ...
PointLight node attributes: attenuation -- 3 values giving the light-attenuation values for constant, linear and quadratic attenuation (+ Light attributes) http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-IS-VRML97WithAmendment1/part1/nodesRef.html#PointLight
PointLight
[ "GPL-1.0-or-later", "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-other-copyleft", "LGPL-2.1-or-later", "GPL-3.0-only", "LGPL-2.0-or-later", "GPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PointLight: """PointLight node attributes: attenuation -- 3 values giving the light-attenuation values for constant, linear and quadratic attenuation (+ Light attributes) http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-IS-VRML97WithAmendment1/part1/nodesRef.html#PointLight""" def ...
stack_v2_sparse_classes_36k_train_033914
6,768
permissive
[ { "docstring": "Render the light (i.e. cause it to alter the scene", "name": "Light", "signature": "def Light(self, lightID, mode=None)" }, { "docstring": "Calculate our model-side matrix", "name": "modelMatrix", "signature": "def modelMatrix(self, direction=None)" } ]
2
null
Implement the Python class `PointLight` described below. Class description: PointLight node attributes: attenuation -- 3 values giving the light-attenuation values for constant, linear and quadratic attenuation (+ Light attributes) http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-IS-VRML97WithAmendment1/part...
Implement the Python class `PointLight` described below. Class description: PointLight node attributes: attenuation -- 3 values giving the light-attenuation values for constant, linear and quadratic attenuation (+ Light attributes) http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-IS-VRML97WithAmendment1/part...
7f600ad153270feff12aa7aa86d7ed0a49ebc71c
<|skeleton|> class PointLight: """PointLight node attributes: attenuation -- 3 values giving the light-attenuation values for constant, linear and quadratic attenuation (+ Light attributes) http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-IS-VRML97WithAmendment1/part1/nodesRef.html#PointLight""" def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PointLight: """PointLight node attributes: attenuation -- 3 values giving the light-attenuation values for constant, linear and quadratic attenuation (+ Light attributes) http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-IS-VRML97WithAmendment1/part1/nodesRef.html#PointLight""" def Light(self, l...
the_stack_v2_python_sparse
pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/OpenGLContext/scenegraph/light.py
alexus37/AugmentedRealityChess
train
1
13fd766f365af07d6b4f89e1bff3fcce008cea0c
[ "super(Linear, self).__init__()\nself.fc0 = paddle.nn.Linear(in_features=in_features, out_features=out_features)\nself.sigmoid = paddle.nn.Sigmoid()", "out = self.fc0(x)\nout = self.sigmoid(out)\nreturn out" ]
<|body_start_0|> super(Linear, self).__init__() self.fc0 = paddle.nn.Linear(in_features=in_features, out_features=out_features) self.sigmoid = paddle.nn.Sigmoid() <|end_body_0|> <|body_start_1|> out = self.fc0(x) out = self.sigmoid(out) return out <|end_body_1|>
Linear
Linear
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Linear: """Linear""" def __init__(self, in_features=3, out_features=10): """init""" <|body_0|> def forward(self, x): """forward""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(Linear, self).__init__() self.fc0 = paddle.nn.Linear(in...
stack_v2_sparse_classes_36k_train_033915
543
no_license
[ { "docstring": "init", "name": "__init__", "signature": "def __init__(self, in_features=3, out_features=10)" }, { "docstring": "forward", "name": "forward", "signature": "def forward(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_013853
Implement the Python class `Linear` described below. Class description: Linear Method signatures and docstrings: - def __init__(self, in_features=3, out_features=10): init - def forward(self, x): forward
Implement the Python class `Linear` described below. Class description: Linear Method signatures and docstrings: - def __init__(self, in_features=3, out_features=10): init - def forward(self, x): forward <|skeleton|> class Linear: """Linear""" def __init__(self, in_features=3, out_features=10): """i...
bd3790ce72a2a26611b5eda3901651b5a809348f
<|skeleton|> class Linear: """Linear""" def __init__(self, in_features=3, out_features=10): """init""" <|body_0|> def forward(self, x): """forward""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Linear: """Linear""" def __init__(self, in_features=3, out_features=10): """init""" super(Linear, self).__init__() self.fc0 = paddle.nn.Linear(in_features=in_features, out_features=out_features) self.sigmoid = paddle.nn.Sigmoid() def forward(self, x): """forwa...
the_stack_v2_python_sparse
framework/e2e/moduletrans/diy/layer/linear.py
PaddlePaddle/PaddleTest
train
42
828108489105deb1c9e53751fbbdc299c430d8c0
[ "assert self.EOS not in s, 'Input string cannot contain null character (%s)' % self.EOS\ns += self.EOS\nrotations = []\nfor i in range(len(s)):\n rotations.append(s[i:] + s[:i])\n sortedRotations = sorted(rotations)\nbwtTransformedString = ''\nfor rotation in sortedRotations:\n bwtTransformedString += rota...
<|body_start_0|> assert self.EOS not in s, 'Input string cannot contain null character (%s)' % self.EOS s += self.EOS rotations = [] for i in range(len(s)): rotations.append(s[i:] + s[:i]) sortedRotations = sorted(rotations) bwtTransformedString = '' ...
BurrowsWheeler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BurrowsWheeler: def transform(self, s): """Simplest Burrows-Wheeler transform implementation, O(n^2) respective to the length of the text.""" <|body_0|> def inverse(self, s): """Simplest Inverse Burrow-Wheeler transform implementation.""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k_train_033916
5,036
no_license
[ { "docstring": "Simplest Burrows-Wheeler transform implementation, O(n^2) respective to the length of the text.", "name": "transform", "signature": "def transform(self, s)" }, { "docstring": "Simplest Inverse Burrow-Wheeler transform implementation.", "name": "inverse", "signature": "def...
2
null
Implement the Python class `BurrowsWheeler` described below. Class description: Implement the BurrowsWheeler class. Method signatures and docstrings: - def transform(self, s): Simplest Burrows-Wheeler transform implementation, O(n^2) respective to the length of the text. - def inverse(self, s): Simplest Inverse Burro...
Implement the Python class `BurrowsWheeler` described below. Class description: Implement the BurrowsWheeler class. Method signatures and docstrings: - def transform(self, s): Simplest Burrows-Wheeler transform implementation, O(n^2) respective to the length of the text. - def inverse(self, s): Simplest Inverse Burro...
ff77118fe81d82c835f71a41e70e3f7f303028bf
<|skeleton|> class BurrowsWheeler: def transform(self, s): """Simplest Burrows-Wheeler transform implementation, O(n^2) respective to the length of the text.""" <|body_0|> def inverse(self, s): """Simplest Inverse Burrow-Wheeler transform implementation.""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BurrowsWheeler: def transform(self, s): """Simplest Burrows-Wheeler transform implementation, O(n^2) respective to the length of the text.""" assert self.EOS not in s, 'Input string cannot contain null character (%s)' % self.EOS s += self.EOS rotations = [] for i in ran...
the_stack_v2_python_sparse
genomics/bio/alignment/bwt.py
HussainAther/biology
train
11
2a5c8224f6d8021823e5c34a03fd5f9334161d2d
[ "self._enc_out = ChaCha20Poly1305(out_key)\nself._enc_in = ChaCha20Poly1305(in_key)\nself._out_counter = 0\nself._in_counter = 0\nself._nonce_length = nonce_length", "if nounce is None:\n nounce = self._out_counter.to_bytes(length=self._nonce_length, byteorder='little')\n self._out_counter += 1\nif len(noun...
<|body_start_0|> self._enc_out = ChaCha20Poly1305(out_key) self._enc_in = ChaCha20Poly1305(in_key) self._out_counter = 0 self._in_counter = 0 self._nonce_length = nonce_length <|end_body_0|> <|body_start_1|> if nounce is None: nounce = self._out_counter.to_by...
CHACHA20 encryption/decryption layer.
Chacha20Cipher
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Chacha20Cipher: """CHACHA20 encryption/decryption layer.""" def __init__(self, out_key, in_key, nonce_length=8): """Initialize a new Chacha20Cipher.""" <|body_0|> def encrypt(self, data, nounce=None, aad=None): """Encrypt data with counter or specified nounce."""...
stack_v2_sparse_classes_36k_train_033917
1,498
permissive
[ { "docstring": "Initialize a new Chacha20Cipher.", "name": "__init__", "signature": "def __init__(self, out_key, in_key, nonce_length=8)" }, { "docstring": "Encrypt data with counter or specified nounce.", "name": "encrypt", "signature": "def encrypt(self, data, nounce=None, aad=None)" ...
3
stack_v2_sparse_classes_30k_train_012316
Implement the Python class `Chacha20Cipher` described below. Class description: CHACHA20 encryption/decryption layer. Method signatures and docstrings: - def __init__(self, out_key, in_key, nonce_length=8): Initialize a new Chacha20Cipher. - def encrypt(self, data, nounce=None, aad=None): Encrypt data with counter or...
Implement the Python class `Chacha20Cipher` described below. Class description: CHACHA20 encryption/decryption layer. Method signatures and docstrings: - def __init__(self, out_key, in_key, nonce_length=8): Initialize a new Chacha20Cipher. - def encrypt(self, data, nounce=None, aad=None): Encrypt data with counter or...
6d47d0b807992343d08927f3e511b1451b396421
<|skeleton|> class Chacha20Cipher: """CHACHA20 encryption/decryption layer.""" def __init__(self, out_key, in_key, nonce_length=8): """Initialize a new Chacha20Cipher.""" <|body_0|> def encrypt(self, data, nounce=None, aad=None): """Encrypt data with counter or specified nounce."""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Chacha20Cipher: """CHACHA20 encryption/decryption layer.""" def __init__(self, out_key, in_key, nonce_length=8): """Initialize a new Chacha20Cipher.""" self._enc_out = ChaCha20Poly1305(out_key) self._enc_in = ChaCha20Poly1305(in_key) self._out_counter = 0 self._in_...
the_stack_v2_python_sparse
pyatv/support/chacha20.py
cchampignon/pyatv
train
0
e6fcededbfd5e5af9392bc246fc7de3efdcfaff1
[ "params = request.query_params\npage = int(params.get('page', 1))\npage_size = int(params.get('page_size', 10))\nkeyword = params.get('keyword')\ntotal_only = params.get('total_only')\nsort_by = request.data.get('sort_by')\nobj = Strategy.objects\nif keyword:\n obj = obj.filter(name__icontains=keyword)\ntotal_co...
<|body_start_0|> params = request.query_params page = int(params.get('page', 1)) page_size = int(params.get('page_size', 10)) keyword = params.get('keyword') total_only = params.get('total_only') sort_by = request.data.get('sort_by') obj = Strategy.objects ...
StrategiesAPIView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StrategiesAPIView: def get(request): """策略列表接口""" <|body_0|> def post(request): """策略创建接口""" <|body_1|> <|end_skeleton|> <|body_start_0|> params = request.query_params page = int(params.get('page', 1)) page_size = int(params.get('pag...
stack_v2_sparse_classes_36k_train_033918
9,461
no_license
[ { "docstring": "策略列表接口", "name": "get", "signature": "def get(request)" }, { "docstring": "策略创建接口", "name": "post", "signature": "def post(request)" } ]
2
stack_v2_sparse_classes_30k_train_005851
Implement the Python class `StrategiesAPIView` described below. Class description: Implement the StrategiesAPIView class. Method signatures and docstrings: - def get(request): 策略列表接口 - def post(request): 策略创建接口
Implement the Python class `StrategiesAPIView` described below. Class description: Implement the StrategiesAPIView class. Method signatures and docstrings: - def get(request): 策略列表接口 - def post(request): 策略创建接口 <|skeleton|> class StrategiesAPIView: def get(request): """策略列表接口""" <|body_0|> ...
bb85b52598d68956bde8756c8321ade7b8479ba7
<|skeleton|> class StrategiesAPIView: def get(request): """策略列表接口""" <|body_0|> def post(request): """策略创建接口""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StrategiesAPIView: def get(request): """策略列表接口""" params = request.query_params page = int(params.get('page', 1)) page_size = int(params.get('page_size', 10)) keyword = params.get('keyword') total_only = params.get('total_only') sort_by = request.data.ge...
the_stack_v2_python_sparse
curd_test/configure/views.py
huiiiuh/huihuiproject
train
0
00f16caf3bbf4332331b9c95d63fd6fb6374db70
[ "count = {}\nfor i in nums:\n if i in count:\n count[i] += 1\n else:\n count[i] = 1\nfor i in count:\n if count[i] > len(nums) // 2:\n return i", "count = 0\nres = None\nfor num in nums:\n if count == 0:\n res = num\n if num == res:\n count += 1\n else:\n ...
<|body_start_0|> count = {} for i in nums: if i in count: count[i] += 1 else: count[i] = 1 for i in count: if count[i] > len(nums) // 2: return i <|end_body_0|> <|body_start_1|> count = 0 res = N...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def majorityElement(self, nums): """时间复杂度 O(n) 空间复杂度 O(n) :type nums: List[int] :rtype: int""" <|body_0|> def mmm(self, nums): """时间复杂度 O(n) 空间复杂度 O(1) :param nums: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> count = {} ...
stack_v2_sparse_classes_36k_train_033919
1,650
no_license
[ { "docstring": "时间复杂度 O(n) 空间复杂度 O(n) :type nums: List[int] :rtype: int", "name": "majorityElement", "signature": "def majorityElement(self, nums)" }, { "docstring": "时间复杂度 O(n) 空间复杂度 O(1) :param nums: :return:", "name": "mmm", "signature": "def mmm(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def majorityElement(self, nums): 时间复杂度 O(n) 空间复杂度 O(n) :type nums: List[int] :rtype: int - def mmm(self, nums): 时间复杂度 O(n) 空间复杂度 O(1) :param nums: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def majorityElement(self, nums): 时间复杂度 O(n) 空间复杂度 O(n) :type nums: List[int] :rtype: int - def mmm(self, nums): 时间复杂度 O(n) 空间复杂度 O(1) :param nums: :return: <|skeleton|> class So...
1040b5dbbe509abe42df848bc34dd1626d7a05fb
<|skeleton|> class Solution: def majorityElement(self, nums): """时间复杂度 O(n) 空间复杂度 O(n) :type nums: List[int] :rtype: int""" <|body_0|> def mmm(self, nums): """时间复杂度 O(n) 空间复杂度 O(1) :param nums: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def majorityElement(self, nums): """时间复杂度 O(n) 空间复杂度 O(n) :type nums: List[int] :rtype: int""" count = {} for i in nums: if i in count: count[i] += 1 else: count[i] = 1 for i in count: if count[i] > l...
the_stack_v2_python_sparse
list/majorityElement.py
NJ-zero/LeetCode_Answer
train
1
b642a17b1d605b3659eb2f7f368b2f4ee2ab8594
[ "raw = super(self.__class__, self).get_value_for_datastore(model_instance)\nif raw is None:\n raise ValueError(_(\"Password can't be empty\"))\ntry:\n if len(raw) > 12:\n alg, seed, passw = raw.split('$')\n return raw\nexcept Exception:\n pass\nif len(raw) < 5:\n raise ValueError(_('Invali...
<|body_start_0|> raw = super(self.__class__, self).get_value_for_datastore(model_instance) if raw is None: raise ValueError(_("Password can't be empty")) try: if len(raw) > 12: alg, seed, passw = raw.split('$') return raw except Exc...
Extends default TextProperty, so we are sure that passwords are always saved encrypted with SHA1
PasswordProperty
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PasswordProperty: """Extends default TextProperty, so we are sure that passwords are always saved encrypted with SHA1""" def get_value_for_datastore(self, model_instance): """Extract the value from a model instance and convert it to a encrypted password that goes in the datastore."""...
stack_v2_sparse_classes_36k_train_033920
2,797
no_license
[ { "docstring": "Extract the value from a model instance and convert it to a encrypted password that goes in the datastore.", "name": "get_value_for_datastore", "signature": "def get_value_for_datastore(self, model_instance)" }, { "docstring": "Convert a value as found in the datastore to string....
2
stack_v2_sparse_classes_30k_train_017656
Implement the Python class `PasswordProperty` described below. Class description: Extends default TextProperty, so we are sure that passwords are always saved encrypted with SHA1 Method signatures and docstrings: - def get_value_for_datastore(self, model_instance): Extract the value from a model instance and convert ...
Implement the Python class `PasswordProperty` described below. Class description: Extends default TextProperty, so we are sure that passwords are always saved encrypted with SHA1 Method signatures and docstrings: - def get_value_for_datastore(self, model_instance): Extract the value from a model instance and convert ...
f8315a2d37db6dca26c8b4af100fd6f1d6fcae20
<|skeleton|> class PasswordProperty: """Extends default TextProperty, so we are sure that passwords are always saved encrypted with SHA1""" def get_value_for_datastore(self, model_instance): """Extract the value from a model instance and convert it to a encrypted password that goes in the datastore."""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PasswordProperty: """Extends default TextProperty, so we are sure that passwords are always saved encrypted with SHA1""" def get_value_for_datastore(self, model_instance): """Extract the value from a model instance and convert it to a encrypted password that goes in the datastore.""" raw ...
the_stack_v2_python_sparse
trunk/src/webapp/geouser/properties.py
hhkaos/GeoRemindMe_Web
train
0
ab87269cb25a751db5b14e4c1fe2914a25778318
[ "super(MinMaxPreprocessor, self).__init__(mdp_info, clip_obs, alpha)\nobs_low, obs_high = (mdp_info.observation_space.low.copy(), mdp_info.observation_space.high.copy())\nself._obs_mask = np.where(np.logical_and(np.abs(obs_low) < 1e+20, np.abs(obs_high) < 1e+20))\nassert np.squeeze(self._obs_mask).size > 0, 'All ob...
<|body_start_0|> super(MinMaxPreprocessor, self).__init__(mdp_info, clip_obs, alpha) obs_low, obs_high = (mdp_info.observation_space.low.copy(), mdp_info.observation_space.high.copy()) self._obs_mask = np.where(np.logical_and(np.abs(obs_low) < 1e+20, np.abs(obs_high) < 1e+20)) assert np....
Preprocess observations from the environment using the bounds of the observation space of the environment. For observations that are not limited falls back to using running mean standardization.
MinMaxPreprocessor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MinMaxPreprocessor: """Preprocess observations from the environment using the bounds of the observation space of the environment. For observations that are not limited falls back to using running mean standardization.""" def __init__(self, mdp_info, clip_obs=10.0, alpha=1e-32): """Co...
stack_v2_sparse_classes_36k_train_033921
4,016
permissive
[ { "docstring": "Constructor. Args: mdp_info (MDPInfo): information of the MDP; clip_obs (float, 10.): values to clip the normalized observations; alpha (float, 1e-32): moving average catchup parameter for the normalization.", "name": "__init__", "signature": "def __init__(self, mdp_info, clip_obs=10.0, ...
2
stack_v2_sparse_classes_30k_train_021028
Implement the Python class `MinMaxPreprocessor` described below. Class description: Preprocess observations from the environment using the bounds of the observation space of the environment. For observations that are not limited falls back to using running mean standardization. Method signatures and docstrings: - def...
Implement the Python class `MinMaxPreprocessor` described below. Class description: Preprocess observations from the environment using the bounds of the observation space of the environment. For observations that are not limited falls back to using running mean standardization. Method signatures and docstrings: - def...
2decae31459a3481130afe1263bc0a5ba7954a99
<|skeleton|> class MinMaxPreprocessor: """Preprocess observations from the environment using the bounds of the observation space of the environment. For observations that are not limited falls back to using running mean standardization.""" def __init__(self, mdp_info, clip_obs=10.0, alpha=1e-32): """Co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MinMaxPreprocessor: """Preprocess observations from the environment using the bounds of the observation space of the environment. For observations that are not limited falls back to using running mean standardization.""" def __init__(self, mdp_info, clip_obs=10.0, alpha=1e-32): """Constructor. Ar...
the_stack_v2_python_sparse
mushroom_rl/utils/preprocessors.py
MushroomRL/mushroom-rl
train
477
ca68f8d026cd743949c19a3efad8a44e0f8a1f44
[ "super().__init__(name=name, **kwargs)\nif background_weight < 0 or background_weight > 1:\n raise ValueError(f'The background weight for Cross Entropy must be within [0, 1], got {background_weight}.')\nself.binary = binary\nself.background_weight = background_weight\nself.smooth = smooth\nself.flatten = tf.kera...
<|body_start_0|> super().__init__(name=name, **kwargs) if background_weight < 0 or background_weight > 1: raise ValueError(f'The background weight for Cross Entropy must be within [0, 1], got {background_weight}.') self.binary = binary self.background_weight = background_weig...
Define weighted cross-entropy. The formulation is: loss = − w_fg * y_true log(y_pred) - w_bg * (1−y_true) log(1−y_pred)
CrossEntropy
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CrossEntropy: """Define weighted cross-entropy. The formulation is: loss = − w_fg * y_true log(y_pred) - w_bg * (1−y_true) log(1−y_pred)""" def __init__(self, binary: bool=False, background_weight: float=0.0, smooth: float=EPS, name: str='CrossEntropy', **kwargs): """Init. :param bin...
stack_v2_sparse_classes_36k_train_033922
12,718
permissive
[ { "docstring": "Init. :param binary: if True, project y_true, y_pred to 0 or 1 :param background_weight: weight for background, where y == 0. :param smooth: smooth constant for log. :param name: name of the loss. :param kwargs: additional arguments.", "name": "__init__", "signature": "def __init__(self,...
3
null
Implement the Python class `CrossEntropy` described below. Class description: Define weighted cross-entropy. The formulation is: loss = − w_fg * y_true log(y_pred) - w_bg * (1−y_true) log(1−y_pred) Method signatures and docstrings: - def __init__(self, binary: bool=False, background_weight: float=0.0, smooth: float=E...
Implement the Python class `CrossEntropy` described below. Class description: Define weighted cross-entropy. The formulation is: loss = − w_fg * y_true log(y_pred) - w_bg * (1−y_true) log(1−y_pred) Method signatures and docstrings: - def __init__(self, binary: bool=False, background_weight: float=0.0, smooth: float=E...
650a2f1a88ad3c6932be305d6a98a36e26feedc6
<|skeleton|> class CrossEntropy: """Define weighted cross-entropy. The formulation is: loss = − w_fg * y_true log(y_pred) - w_bg * (1−y_true) log(1−y_pred)""" def __init__(self, binary: bool=False, background_weight: float=0.0, smooth: float=EPS, name: str='CrossEntropy', **kwargs): """Init. :param bin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CrossEntropy: """Define weighted cross-entropy. The formulation is: loss = − w_fg * y_true log(y_pred) - w_bg * (1−y_true) log(1−y_pred)""" def __init__(self, binary: bool=False, background_weight: float=0.0, smooth: float=EPS, name: str='CrossEntropy', **kwargs): """Init. :param binary: if True,...
the_stack_v2_python_sparse
deepreg/loss/label.py
DeepRegNet/DeepReg
train
509
cba4696bc488650a83a6f7a0a0c4c33f1770df5e
[ "assert type(data) is list\nif len(data) > 1:\n self.images = torch.cat(tuple([data_set_data['images'] for data_set_data in data]), 0).to(device)\n self.ltr_targets = torch.cat(tuple([data_set_data['ltr_targets'] for data_set_data in data]), 0)[:, :-1].to(device)\n self.rtl_targets = torch.cat(tuple([data_...
<|body_start_0|> assert type(data) is list if len(data) > 1: self.images = torch.cat(tuple([data_set_data['images'] for data_set_data in data]), 0).to(device) self.ltr_targets = torch.cat(tuple([data_set_data['ltr_targets'] for data_set_data in data]), 0)[:, :-1].to(device) ...
Batch class, Contains all the attributes for one training iteration
Batch
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Batch: """Batch class, Contains all the attributes for one training iteration""" def __init__(self, data, device, pad_id=0, bidirectional=False): """:param data: list with dictionaries with all the data attributes for one training pass, each dict is from one dataset :param device: re...
stack_v2_sparse_classes_36k_train_033923
2,534
no_license
[ { "docstring": ":param data: list with dictionaries with all the data attributes for one training pass, each dict is from one dataset :param device: reference to GPU or CPU depending on the configurations :param: bidirectional: if True, decode sequence bidirectional :param pad_id: padding symbol id", "name"...
2
stack_v2_sparse_classes_30k_train_019692
Implement the Python class `Batch` described below. Class description: Batch class, Contains all the attributes for one training iteration Method signatures and docstrings: - def __init__(self, data, device, pad_id=0, bidirectional=False): :param data: list with dictionaries with all the data attributes for one train...
Implement the Python class `Batch` described below. Class description: Batch class, Contains all the attributes for one training iteration Method signatures and docstrings: - def __init__(self, data, device, pad_id=0, bidirectional=False): :param data: list with dictionaries with all the data attributes for one train...
ab83a47ef2e107dd7160ea0ca1832fa0531926b7
<|skeleton|> class Batch: """Batch class, Contains all the attributes for one training iteration""" def __init__(self, data, device, pad_id=0, bidirectional=False): """:param data: list with dictionaries with all the data attributes for one training pass, each dict is from one dataset :param device: re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Batch: """Batch class, Contains all the attributes for one training iteration""" def __init__(self, data, device, pad_id=0, bidirectional=False): """:param data: list with dictionaries with all the data attributes for one training pass, each dict is from one dataset :param device: reference to GP...
the_stack_v2_python_sparse
src/Batch.py
MauritsBleeker/Bi-STET
train
72
1099acb6e84b4c95dcd0779733248cdc778f5d8a
[ "self.start = start\nself.end = end\ndx = end[0] - start[0]\nif dx == 0:\n self.m = None\n self.n = None\nelse:\n self.m = float(end[1] - start[1]) / dx\n self.n = float(start[1] * end[0] - end[1] * start[0]) / dx", "if self.m == None:\n if abs(x - self.start[0]) > 0.6:\n return False\n e...
<|body_start_0|> self.start = start self.end = end dx = end[0] - start[0] if dx == 0: self.m = None self.n = None else: self.m = float(end[1] - start[1]) / dx self.n = float(start[1] * end[0] - end[1] * start[0]) / dx <|end_body_0|>...
Represents a line between two points.
Segment
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Segment: """Represents a line between two points.""" def __init__(self, start, end): """Constructor. - start: An (x, y) pair with the coordinates where the line starts. - end: An (x, y) pair with the coordinates where the line ends.""" <|body_0|> def contains_point(self,...
stack_v2_sparse_classes_36k_train_033924
8,303
no_license
[ { "docstring": "Constructor. - start: An (x, y) pair with the coordinates where the line starts. - end: An (x, y) pair with the coordinates where the line ends.", "name": "__init__", "signature": "def __init__(self, start, end)" }, { "docstring": "Determines if the point is part of the segment."...
3
stack_v2_sparse_classes_30k_train_008807
Implement the Python class `Segment` described below. Class description: Represents a line between two points. Method signatures and docstrings: - def __init__(self, start, end): Constructor. - start: An (x, y) pair with the coordinates where the line starts. - end: An (x, y) pair with the coordinates where the line ...
Implement the Python class `Segment` described below. Class description: Represents a line between two points. Method signatures and docstrings: - def __init__(self, start, end): Constructor. - start: An (x, y) pair with the coordinates where the line starts. - end: An (x, y) pair with the coordinates where the line ...
3a7762c06d1c1fd115cf6e563a45b323c78926bd
<|skeleton|> class Segment: """Represents a line between two points.""" def __init__(self, start, end): """Constructor. - start: An (x, y) pair with the coordinates where the line starts. - end: An (x, y) pair with the coordinates where the line ends.""" <|body_0|> def contains_point(self,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Segment: """Represents a line between two points.""" def __init__(self, start, end): """Constructor. - start: An (x, y) pair with the coordinates where the line starts. - end: An (x, y) pair with the coordinates where the line ends.""" self.start = start self.end = end dx ...
the_stack_v2_python_sparse
game/framework/geometry.py
sugar-activities/4444-activity
train
0
c6c2d01db5c4093f6b325c8dd9fd8c5501ba34dc
[ "fetch_full_feed = False\nlast_fetch_time = 'last_fetch_mock'\ninitial_interval = 'initial_mock'\nassert get_added_after(fetch_full_feed, initial_interval, last_fetch_time) == last_fetch_time", "fetch_full_feed = True\nlast_fetch_time = 'last_fetch_mock'\ninitial_interval = 'initial_mock'\nassert get_added_after(...
<|body_start_0|> fetch_full_feed = False last_fetch_time = 'last_fetch_mock' initial_interval = 'initial_mock' assert get_added_after(fetch_full_feed, initial_interval, last_fetch_time) == last_fetch_time <|end_body_0|> <|body_start_1|> fetch_full_feed = True last_fetch_...
Scenario: Test get_added_after
TestGetAddedAfter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestGetAddedAfter: """Scenario: Test get_added_after""" def test_get_last_fetch_time(self): """Scenario: fetch_full_feed and last fetch is set Given: - fetch_full_feed is false - last fetch time is set When: - calling get_added_after Then: - return last fetch time""" <|body_0...
stack_v2_sparse_classes_36k_train_033925
9,956
permissive
[ { "docstring": "Scenario: fetch_full_feed and last fetch is set Given: - fetch_full_feed is false - last fetch time is set When: - calling get_added_after Then: - return last fetch time", "name": "test_get_last_fetch_time", "signature": "def test_get_last_fetch_time(self)" }, { "docstring": "Sce...
3
stack_v2_sparse_classes_30k_train_014939
Implement the Python class `TestGetAddedAfter` described below. Class description: Scenario: Test get_added_after Method signatures and docstrings: - def test_get_last_fetch_time(self): Scenario: fetch_full_feed and last fetch is set Given: - fetch_full_feed is false - last fetch time is set When: - calling get_added...
Implement the Python class `TestGetAddedAfter` described below. Class description: Scenario: Test get_added_after Method signatures and docstrings: - def test_get_last_fetch_time(self): Scenario: fetch_full_feed and last fetch is set Given: - fetch_full_feed is false - last fetch time is set When: - calling get_added...
01b57f8c658c2faed047313d3034e8052ffa83ce
<|skeleton|> class TestGetAddedAfter: """Scenario: Test get_added_after""" def test_get_last_fetch_time(self): """Scenario: fetch_full_feed and last fetch is set Given: - fetch_full_feed is false - last fetch time is set When: - calling get_added_after Then: - return last fetch time""" <|body_0...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestGetAddedAfter: """Scenario: Test get_added_after""" def test_get_last_fetch_time(self): """Scenario: fetch_full_feed and last fetch is set Given: - fetch_full_feed is false - last fetch time is set When: - calling get_added_after Then: - return last fetch time""" fetch_full_feed = Fal...
the_stack_v2_python_sparse
Packs/FeedTAXII/Integrations/FeedTAXII2/FeedTAXII2_test.py
adambaumeister/content
train
2
6f446e2ef3f403c60ff5f7f25eb434eea7ca3343
[ "rt = []\n\ndef inorder(root):\n if not root:\n return\n rt.append(str(root.val))\n inorder(root.left)\n inorder(root.right)\ninorder(root)\nreturn ' '.join(rt)", "vals = collections.deque((int(i) for i in data.split()))\n\ndef buildTree(min, max):\n if vals and vals[0] > min and (vals[0] < ...
<|body_start_0|> rt = [] def inorder(root): if not root: return rt.append(str(root.val)) inorder(root.left) inorder(root.right) inorder(root) return ' '.join(rt) <|end_body_0|> <|body_start_1|> vals = collections.d...
Codec2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec2: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_36k_train_033926
3,374
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_006436
Implement the Python class `Codec2` described below. Class description: Implement the Codec2 class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtyp...
Implement the Python class `Codec2` described below. Class description: Implement the Codec2 class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtyp...
0e99f9a5226507706b3ee66fd04bae813755ef40
<|skeleton|> class Codec2: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec2: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" rt = [] def inorder(root): if not root: return rt.append(str(root.val)) inorder(root.left) inorder(root.right) ...
the_stack_v2_python_sparse
medium/tree/test_449_Serialize_and_Deserialize_BST.py
wuxu1019/leetcode_sophia
train
1
fe35a416008fe22430b51b9de591ddb2c81fa175
[ "self._each_result_cont = each_result_cont\nself._num_expected_results = num_expected_results\nself._num_continuations_issued = 0\nself._all_results_cont = all_results_cont\nself._results_received = 0", "assert self._num_continuations_issued < self._num_expected_results\nself._num_continuations_issued += 1\nthis_...
<|body_start_0|> self._each_result_cont = each_result_cont self._num_expected_results = num_expected_results self._num_continuations_issued = 0 self._all_results_cont = all_results_cont self._results_received = 0 <|end_body_0|> <|body_start_1|> assert self._num_continuat...
A simple utility class for scheduling an continuation to be executed when several calls have all completed (regardless of the order in which they complete). Allows an action to be executed when each individual result arrives, as well as another when all have arrived. Note nothing is done to combine together the results...
WhenAllResultsReceived
[ "MIT", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WhenAllResultsReceived: """A simple utility class for scheduling an continuation to be executed when several calls have all completed (regardless of the order in which they complete). Allows an action to be executed when each individual result arrives, as well as another when all have arrived. No...
stack_v2_sparse_classes_36k_train_033927
12,637
permissive
[ { "docstring": "Creates a ResultsCombiner that will invoke <all_results_cont> (with no arguments) when it has received <num_expected_results> (via the `continuation_for_result` method). <each_result_cont> is a continuation which is invoked with each individual result.", "name": "__init__", "signature": ...
2
null
Implement the Python class `WhenAllResultsReceived` described below. Class description: A simple utility class for scheduling an continuation to be executed when several calls have all completed (regardless of the order in which they complete). Allows an action to be executed when each individual result arrives, as we...
Implement the Python class `WhenAllResultsReceived` described below. Class description: A simple utility class for scheduling an continuation to be executed when several calls have all completed (regardless of the order in which they complete). Allows an action to be executed when each individual result arrives, as we...
8fa75e67c0db8f632b135379740051cd10ff31f2
<|skeleton|> class WhenAllResultsReceived: """A simple utility class for scheduling an continuation to be executed when several calls have all completed (regardless of the order in which they complete). Allows an action to be executed when each individual result arrives, as well as another when all have arrived. No...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WhenAllResultsReceived: """A simple utility class for scheduling an continuation to be executed when several calls have all completed (regardless of the order in which they complete). Allows an action to be executed when each individual result arrives, as well as another when all have arrived. Note nothing is...
the_stack_v2_python_sparse
rlo/src/rlo/worker.py
tomjaguarpaw/knossos-ksc
train
0
2779e52c6a1efaeadd4bb2177176091dc8fb1da7
[ "self.time_range = params_pre['time_range']\nself.plot_dir = params_pre['plot_dir']\nself.logger = logging.getLogger('simple')", "plotter = plot_ecei_timeslice(data_chunk)\ntidx_plot = [data_chunk.tb.time_to_idx(t) for t in self.time_range]\nif tidx_plot[0] is not None:\n self.logger.info(f'Plotting data into ...
<|body_start_0|> self.time_range = params_pre['time_range'] self.plot_dir = params_pre['plot_dir'] self.logger = logging.getLogger('simple') <|end_body_0|> <|body_start_1|> plotter = plot_ecei_timeslice(data_chunk) tidx_plot = [data_chunk.tb.time_to_idx(t) for t in self.time_ran...
Plots the pre-processed data and stores it to a file. Plots are made using the instantaneous data in the pipeline. That is, the position of the plot routine in the preprocessing pipeline is important.
pre_plot
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class pre_plot: """Plots the pre-processed data and stores it to a file. Plots are made using the instantaneous data in the pipeline. That is, the position of the plot routine in the preprocessing pipeline is important.""" def __init__(self, params_pre): """Instantiates the pre_plot class ...
stack_v2_sparse_classes_36k_train_033928
1,831
no_license
[ { "docstring": "Instantiates the pre_plot class as a callable. Args: params_pre (dictionary): Preprocessing section of Delta configuration Returns: None", "name": "__init__", "signature": "def __init__(self, params_pre)" }, { "docstring": "Plots the data chunk. Args: data_chunk (2d image): Data ...
2
stack_v2_sparse_classes_30k_train_018372
Implement the Python class `pre_plot` described below. Class description: Plots the pre-processed data and stores it to a file. Plots are made using the instantaneous data in the pipeline. That is, the position of the plot routine in the preprocessing pipeline is important. Method signatures and docstrings: - def __i...
Implement the Python class `pre_plot` described below. Class description: Plots the pre-processed data and stores it to a file. Plots are made using the instantaneous data in the pipeline. That is, the position of the plot routine in the preprocessing pipeline is important. Method signatures and docstrings: - def __i...
7ce63705e18c427f448c8d720c950a54add07966
<|skeleton|> class pre_plot: """Plots the pre-processed data and stores it to a file. Plots are made using the instantaneous data in the pipeline. That is, the position of the plot routine in the preprocessing pipeline is important.""" def __init__(self, params_pre): """Instantiates the pre_plot class ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class pre_plot: """Plots the pre-processed data and stores it to a file. Plots are made using the instantaneous data in the pipeline. That is, the position of the plot routine in the preprocessing pipeline is important.""" def __init__(self, params_pre): """Instantiates the pre_plot class as a callable...
the_stack_v2_python_sparse
delta/preprocess/pre_plot.py
rkube/delta
train
7
1e15e54e6f32fd3b7a97542a8a025be3e74543fe
[ "if target <= 1:\n raise ValueError(f'Target iteration of ETA must be > 1, got {target}')\nself.targetIteration = target\nself._ti = None\nself._xi = None", "if self._ti is None:\n if current > 0:\n self._ti = time.time()\n self._xi = current\n return None\nif current <= self._xi:\n retu...
<|body_start_0|> if target <= 1: raise ValueError(f'Target iteration of ETA must be > 1, got {target}') self.targetIteration = target self._ti = None self._xi = None <|end_body_0|> <|body_start_1|> if self._ti is None: if current > 0: self...
! Estimate the time of arrival for iterations. The ETA is computed from a linear regression to the starting time and current time (time at execution of the __call__ method). This is not very stable for strongly changing durations of individual iterations but gives a good estimate for mostly stable durations. The start ...
ETA
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ETA: """! Estimate the time of arrival for iterations. The ETA is computed from a linear regression to the starting time and current time (time at execution of the __call__ method). This is not very stable for strongly changing durations of individual iterations but gives a good estimate for most...
stack_v2_sparse_classes_36k_train_033929
29,663
permissive
[ { "docstring": "!Initialize with a given target iteration number.", "name": "__init__", "signature": "def __init__(self, target)" }, { "docstring": "! Estimate the time of arrival given a current iteration. \\\\param current Iteration number the loop is currently at. \\\\returns - Estimated time...
3
stack_v2_sparse_classes_30k_train_020378
Implement the Python class `ETA` described below. Class description: ! Estimate the time of arrival for iterations. The ETA is computed from a linear regression to the starting time and current time (time at execution of the __call__ method). This is not very stable for strongly changing durations of individual iterat...
Implement the Python class `ETA` described below. Class description: ! Estimate the time of arrival for iterations. The ETA is computed from a linear regression to the starting time and current time (time at execution of the __call__ method). This is not very stable for strongly changing durations of individual iterat...
41557db1965bf3801bfadf9ece39ec1dab9b7660
<|skeleton|> class ETA: """! Estimate the time of arrival for iterations. The ETA is computed from a linear regression to the starting time and current time (time at execution of the __call__ method). This is not very stable for strongly changing durations of individual iterations but gives a good estimate for most...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ETA: """! Estimate the time of arrival for iterations. The ETA is computed from a linear regression to the starting time and current time (time at execution of the __call__ method). This is not very stable for strongly changing durations of individual iterations but gives a good estimate for mostly stable dur...
the_stack_v2_python_sparse
src/isle/cli.py
evanberkowitz/isle
train
3
aca1ca176e186147cd154092535529a837d984a3
[ "super().__init__()\nself.in_channels = in_channels\nself.out_channels = out_channels\nself.stride = stride", "for p in self.parameters():\n p.requires_grad = False\nFrozenBatchNorm2d.convert_frozen_batchnorm(self)\nreturn self" ]
<|body_start_0|> super().__init__() self.in_channels = in_channels self.out_channels = out_channels self.stride = stride <|end_body_0|> <|body_start_1|> for p in self.parameters(): p.requires_grad = False FrozenBatchNorm2d.convert_frozen_batchnorm(self) ...
A CNN block is assumed to have input channels, output channels and a stride. The input and output of `forward()` method must be NCHW tensors. The method can perform arbitrary computation but must match the given channels and stride specification. Attribute: in_channels (int): out_channels (int): stride (int):
CNNBlockBase
[ "GPL-1.0-or-later", "Apache-2.0", "BSD-2-Clause", "MIT", "BSD-3-Clause", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CNNBlockBase: """A CNN block is assumed to have input channels, output channels and a stride. The input and output of `forward()` method must be NCHW tensors. The method can perform arbitrary computation but must match the given channels and stride specification. Attribute: in_channels (int): out...
stack_v2_sparse_classes_36k_train_033930
4,708
permissive
[ { "docstring": "The `__init__` method of any subclass should also contain these arguments. Args: in_channels (int): out_channels (int): stride (int):", "name": "__init__", "signature": "def __init__(self, in_channels, out_channels, stride)" }, { "docstring": "Make this block not trainable. This ...
2
stack_v2_sparse_classes_30k_train_019861
Implement the Python class `CNNBlockBase` described below. Class description: A CNN block is assumed to have input channels, output channels and a stride. The input and output of `forward()` method must be NCHW tensors. The method can perform arbitrary computation but must match the given channels and stride specifica...
Implement the Python class `CNNBlockBase` described below. Class description: A CNN block is assumed to have input channels, output channels and a stride. The input and output of `forward()` method must be NCHW tensors. The method can perform arbitrary computation but must match the given channels and stride specifica...
92acc188d3a0f634de58463b6676e70df83ef808
<|skeleton|> class CNNBlockBase: """A CNN block is assumed to have input channels, output channels and a stride. The input and output of `forward()` method must be NCHW tensors. The method can perform arbitrary computation but must match the given channels and stride specification. Attribute: in_channels (int): out...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CNNBlockBase: """A CNN block is assumed to have input channels, output channels and a stride. The input and output of `forward()` method must be NCHW tensors. The method can perform arbitrary computation but must match the given channels and stride specification. Attribute: in_channels (int): out_channels (in...
the_stack_v2_python_sparse
PyTorch/dev/cv/image_classification/SlowFast_ID0646_for_PyTorch/detectron2/detectron2/layers/blocks.py
Ascend/ModelZoo-PyTorch
train
23
d50deeb81f686e7080bee79b5bcf135dc77cb782
[ "drawing = Drawing(200, 280)\ngraph = VerticalBarChart()\ngraph.x = self.graph_x\ngraph.y = self.graph_y\ngraph.width = self.width\ngraph.height = self.height\ngraph.valueAxis.forceZero = 1\ngraph.valueAxis.valueMin = self.value_min\ngraph.valueAxis.valueMax = self.value_max\ngraph.valueAxis.valueStep = self.value_...
<|body_start_0|> drawing = Drawing(200, 280) graph = VerticalBarChart() graph.x = self.graph_x graph.y = self.graph_y graph.width = self.width graph.height = self.height graph.valueAxis.forceZero = 1 graph.valueAxis.valueMin = self.value_min graph....
Class for drawing a customized bar chart
BarChart
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BarChart: """Class for drawing a customized bar chart""" def vertical_bar_chart(self): """Draws a vertical bar chart :return: vertical bar chart""" <|body_0|> def horizontal_bar_graph(self): """Draws a horizontal bar chart :return: horizontal bar chart""" ...
stack_v2_sparse_classes_36k_train_033931
9,685
no_license
[ { "docstring": "Draws a vertical bar chart :return: vertical bar chart", "name": "vertical_bar_chart", "signature": "def vertical_bar_chart(self)" }, { "docstring": "Draws a horizontal bar chart :return: horizontal bar chart", "name": "horizontal_bar_graph", "signature": "def horizontal_...
2
stack_v2_sparse_classes_30k_val_000453
Implement the Python class `BarChart` described below. Class description: Class for drawing a customized bar chart Method signatures and docstrings: - def vertical_bar_chart(self): Draws a vertical bar chart :return: vertical bar chart - def horizontal_bar_graph(self): Draws a horizontal bar chart :return: horizontal...
Implement the Python class `BarChart` described below. Class description: Class for drawing a customized bar chart Method signatures and docstrings: - def vertical_bar_chart(self): Draws a vertical bar chart :return: vertical bar chart - def horizontal_bar_graph(self): Draws a horizontal bar chart :return: horizontal...
941e8b2870f8724db3d5103dda5157fd597cfcc7
<|skeleton|> class BarChart: """Class for drawing a customized bar chart""" def vertical_bar_chart(self): """Draws a vertical bar chart :return: vertical bar chart""" <|body_0|> def horizontal_bar_graph(self): """Draws a horizontal bar chart :return: horizontal bar chart""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BarChart: """Class for drawing a customized bar chart""" def vertical_bar_chart(self): """Draws a vertical bar chart :return: vertical bar chart""" drawing = Drawing(200, 280) graph = VerticalBarChart() graph.x = self.graph_x graph.y = self.graph_y graph.wi...
the_stack_v2_python_sparse
backend/martin_helder/services/report_service.py
JoaoAlvaroFerreira/FEUP-LGP
train
1
76fa9560349137f2b5fce217ef75085fc321a3a2
[ "toSend = ''\nfor s in self.strings:\n toSend += self.receiver.encode(s)\nfor packetSize in range(1, 20):\n a = self.receiver(maxLength=699)\n got = []\n for s in diceString(toSend, packetSize):\n out, code = a.getNewFrames(s)\n self.assertEqual(decoders.OK, code)\n got.extend(out)\...
<|body_start_0|> toSend = '' for s in self.strings: toSend += self.receiver.encode(s) for packetSize in range(1, 20): a = self.receiver(maxLength=699) got = [] for s in diceString(toSend, packetSize): out, code = a.getNewFrames(s) ...
CommonTests
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommonTests: def test_buffer(self): """Test that when strings are received in chunks of different lengths, they are still parsed correctly.""" <|body_0|> def test_illegalWithPacketSizes(self): """Assert that illegal strings return the correct error code even when the...
stack_v2_sparse_classes_36k_train_033932
7,794
permissive
[ { "docstring": "Test that when strings are received in chunks of different lengths, they are still parsed correctly.", "name": "test_buffer", "signature": "def test_buffer(self)" }, { "docstring": "Assert that illegal strings return the correct error code even when they arrive in variable packet...
2
stack_v2_sparse_classes_30k_train_001325
Implement the Python class `CommonTests` described below. Class description: Implement the CommonTests class. Method signatures and docstrings: - def test_buffer(self): Test that when strings are received in chunks of different lengths, they are still parsed correctly. - def test_illegalWithPacketSizes(self): Assert ...
Implement the Python class `CommonTests` described below. Class description: Implement the CommonTests class. Method signatures and docstrings: - def test_buffer(self): Test that when strings are received in chunks of different lengths, they are still parsed correctly. - def test_illegalWithPacketSizes(self): Assert ...
386e1aeb5197e197e806b3b6a0c11ab9315c8ab5
<|skeleton|> class CommonTests: def test_buffer(self): """Test that when strings are received in chunks of different lengths, they are still parsed correctly.""" <|body_0|> def test_illegalWithPacketSizes(self): """Assert that illegal strings return the correct error code even when the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommonTests: def test_buffer(self): """Test that when strings are received in chunks of different lengths, they are still parsed correctly.""" toSend = '' for s in self.strings: toSend += self.receiver.encode(s) for packetSize in range(1, 20): a = self.r...
the_stack_v2_python_sparse
minerva/test_decoders.py
ludiosarchive/Minerva
train
1
544dcc39c796d7e7ac8c22d8a17dbce670697412
[ "if self.request.get('sheriff'):\n self._DumpAnomalyDataForSheriff()\nelif self.request.get('test_path'):\n self._DumpTestData()\nelse:\n self.ReportError('No parameters specified.')", "test_path = self.request.get('test_path')\nnum_points = int(self.request.get('num_points', _DEFAULT_MAX_POINTS))\nend_r...
<|body_start_0|> if self.request.get('sheriff'): self._DumpAnomalyDataForSheriff() elif self.request.get('test_path'): self._DumpTestData() else: self.ReportError('No parameters specified.') <|end_body_0|> <|body_start_1|> test_path = self.request.get...
Handler for extracting entities from datastore.
DumpGraphJsonHandler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DumpGraphJsonHandler: """Handler for extracting entities from datastore.""" def get(self): """Handles dumping dashboard data.""" <|body_0|> def _DumpTestData(self): """Dumps data for the requested test. Request parameters: test_path: A single full test path, incl...
stack_v2_sparse_classes_36k_train_033933
6,420
permissive
[ { "docstring": "Handles dumping dashboard data.", "name": "get", "signature": "def get(self)" }, { "docstring": "Dumps data for the requested test. Request parameters: test_path: A single full test path, including master/bot. num_points: Max number of Row entities (optional). end_rev: Ending rev...
5
null
Implement the Python class `DumpGraphJsonHandler` described below. Class description: Handler for extracting entities from datastore. Method signatures and docstrings: - def get(self): Handles dumping dashboard data. - def _DumpTestData(self): Dumps data for the requested test. Request parameters: test_path: A single...
Implement the Python class `DumpGraphJsonHandler` described below. Class description: Handler for extracting entities from datastore. Method signatures and docstrings: - def get(self): Handles dumping dashboard data. - def _DumpTestData(self): Dumps data for the requested test. Request parameters: test_path: A single...
53102de187a48ac2cfc241fef54dcbc29c453a8e
<|skeleton|> class DumpGraphJsonHandler: """Handler for extracting entities from datastore.""" def get(self): """Handles dumping dashboard data.""" <|body_0|> def _DumpTestData(self): """Dumps data for the requested test. Request parameters: test_path: A single full test path, incl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DumpGraphJsonHandler: """Handler for extracting entities from datastore.""" def get(self): """Handles dumping dashboard data.""" if self.request.get('sheriff'): self._DumpAnomalyDataForSheriff() elif self.request.get('test_path'): self._DumpTestData() ...
the_stack_v2_python_sparse
dashboard/dashboard/dump_graph_json.py
catapult-project/catapult
train
2,032
678d91f20f0ef249524e84ef9db262846b6e4c00
[ "with ClusterRpcProxy(CONFIG_RPC) as rpc:\n response_data = rpc.query_brands.list(num_page, limit)\n return Response(response=response_data, status=200, mimetype='application/json')", "data = request.json\nwith ClusterRpcProxy(CONFIG_RPC) as rpc:\n response_data = rpc.command_brands.add(data)\n return...
<|body_start_0|> with ClusterRpcProxy(CONFIG_RPC) as rpc: response_data = rpc.query_brands.list(num_page, limit) return Response(response=response_data, status=200, mimetype='application/json') <|end_body_0|> <|body_start_1|> data = request.json with ClusterRpcProxy(CONF...
BrandsCollection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BrandsCollection: def get(self, num_page=5, limit=5): """returns a list of brands""" <|body_0|> def post(self): """creates a new brand""" <|body_1|> <|end_skeleton|> <|body_start_0|> with ClusterRpcProxy(CONFIG_RPC) as rpc: response_data...
stack_v2_sparse_classes_36k_train_033934
2,584
no_license
[ { "docstring": "returns a list of brands", "name": "get", "signature": "def get(self, num_page=5, limit=5)" }, { "docstring": "creates a new brand", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_017601
Implement the Python class `BrandsCollection` described below. Class description: Implement the BrandsCollection class. Method signatures and docstrings: - def get(self, num_page=5, limit=5): returns a list of brands - def post(self): creates a new brand
Implement the Python class `BrandsCollection` described below. Class description: Implement the BrandsCollection class. Method signatures and docstrings: - def get(self, num_page=5, limit=5): returns a list of brands - def post(self): creates a new brand <|skeleton|> class BrandsCollection: def get(self, num_pa...
3f4c93c631e5d5b52acd2ce11e220ff3fbec07b6
<|skeleton|> class BrandsCollection: def get(self, num_page=5, limit=5): """returns a list of brands""" <|body_0|> def post(self): """creates a new brand""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BrandsCollection: def get(self, num_page=5, limit=5): """returns a list of brands""" with ClusterRpcProxy(CONFIG_RPC) as rpc: response_data = rpc.query_brands.list(num_page, limit) return Response(response=response_data, status=200, mimetype='application/json') def...
the_stack_v2_python_sparse
orchestrator/apis/brand_ns.py
bsmi021/eahub_shopco
train
0
0c537649fc89f3a6db7c05b8ef1c75265fe7524d
[ "reflection_table = SumAndPrfIntensityReducer.reduce_on_intensities(reflection_table)\nreflection_table = ScaleIntensityReducer.reduce_on_intensities(reflection_table)\nreturn reflection_table", "reflection_table = SumAndPrfIntensityReducer.apply_scaling_factors(reflection_table)\nreflection_table = ScaleIntensit...
<|body_start_0|> reflection_table = SumAndPrfIntensityReducer.reduce_on_intensities(reflection_table) reflection_table = ScaleIntensityReducer.reduce_on_intensities(reflection_table) return reflection_table <|end_body_0|> <|body_start_1|> reflection_table = SumAndPrfIntensityReducer.app...
Reduction methods for data with sum, profile and scale intensities. Only reflections with valid values for all intensity types are retained.
AllSumPrfScaleIntensityReducer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AllSumPrfScaleIntensityReducer: """Reduction methods for data with sum, profile and scale intensities. Only reflections with valid values for all intensity types are retained.""" def reduce_on_intensities(reflection_table): """Select those with valid reflections for all values.""" ...
stack_v2_sparse_classes_36k_train_033935
38,270
permissive
[ { "docstring": "Select those with valid reflections for all values.", "name": "reduce_on_intensities", "signature": "def reduce_on_intensities(reflection_table)" }, { "docstring": "Apply corrections to the intensities and variances.", "name": "apply_scaling_factors", "signature": "def ap...
2
null
Implement the Python class `AllSumPrfScaleIntensityReducer` described below. Class description: Reduction methods for data with sum, profile and scale intensities. Only reflections with valid values for all intensity types are retained. Method signatures and docstrings: - def reduce_on_intensities(reflection_table): ...
Implement the Python class `AllSumPrfScaleIntensityReducer` described below. Class description: Reduction methods for data with sum, profile and scale intensities. Only reflections with valid values for all intensity types are retained. Method signatures and docstrings: - def reduce_on_intensities(reflection_table): ...
88bf7f7c5ac44defc046ebf0719cde748092cfff
<|skeleton|> class AllSumPrfScaleIntensityReducer: """Reduction methods for data with sum, profile and scale intensities. Only reflections with valid values for all intensity types are retained.""" def reduce_on_intensities(reflection_table): """Select those with valid reflections for all values.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AllSumPrfScaleIntensityReducer: """Reduction methods for data with sum, profile and scale intensities. Only reflections with valid values for all intensity types are retained.""" def reduce_on_intensities(reflection_table): """Select those with valid reflections for all values.""" reflect...
the_stack_v2_python_sparse
src/dials/util/filter_reflections.py
dials/dials
train
71
c496dbd0244bc28e482f95e7d831f9c6b753f613
[ "self.device_bus = device_bus\nself.device_index = device_index\nself.disk_size_bytes = disk_size_bytes", "if dictionary is None:\n return None\ndevice_bus = dictionary.get('deviceBus')\ndevice_index = dictionary.get('deviceIndex')\ndisk_size_bytes = dictionary.get('diskSizeBytes')\nreturn cls(device_bus, devi...
<|body_start_0|> self.device_bus = device_bus self.device_index = device_index self.disk_size_bytes = disk_size_bytes <|end_body_0|> <|body_start_1|> if dictionary is None: return None device_bus = dictionary.get('deviceBus') device_index = dictionary.get('de...
Implementation of the 'VirtualDiskConfig' model. Acropolis Virtual Disk Attributes: device_bus (string): The device bus for the virtual disk device. device_index (int): Index of the device on the adapter type. disk_size_bytes (long|int): Disk size in Bytes.
VirtualDiskConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VirtualDiskConfig: """Implementation of the 'VirtualDiskConfig' model. Acropolis Virtual Disk Attributes: device_bus (string): The device bus for the virtual disk device. device_index (int): Index of the device on the adapter type. disk_size_bytes (long|int): Disk size in Bytes.""" def __ini...
stack_v2_sparse_classes_36k_train_033936
1,862
permissive
[ { "docstring": "Constructor for the VirtualDiskConfig class", "name": "__init__", "signature": "def __init__(self, device_bus=None, device_index=None, disk_size_bytes=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary represe...
2
stack_v2_sparse_classes_30k_train_003230
Implement the Python class `VirtualDiskConfig` described below. Class description: Implementation of the 'VirtualDiskConfig' model. Acropolis Virtual Disk Attributes: device_bus (string): The device bus for the virtual disk device. device_index (int): Index of the device on the adapter type. disk_size_bytes (long|int)...
Implement the Python class `VirtualDiskConfig` described below. Class description: Implementation of the 'VirtualDiskConfig' model. Acropolis Virtual Disk Attributes: device_bus (string): The device bus for the virtual disk device. device_index (int): Index of the device on the adapter type. disk_size_bytes (long|int)...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class VirtualDiskConfig: """Implementation of the 'VirtualDiskConfig' model. Acropolis Virtual Disk Attributes: device_bus (string): The device bus for the virtual disk device. device_index (int): Index of the device on the adapter type. disk_size_bytes (long|int): Disk size in Bytes.""" def __ini...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VirtualDiskConfig: """Implementation of the 'VirtualDiskConfig' model. Acropolis Virtual Disk Attributes: device_bus (string): The device bus for the virtual disk device. device_index (int): Index of the device on the adapter type. disk_size_bytes (long|int): Disk size in Bytes.""" def __init__(self, dev...
the_stack_v2_python_sparse
cohesity_management_sdk/models/virtual_disk_config.py
cohesity/management-sdk-python
train
24
a82b9c3b0ccd9a8e17c5328e965f7d2e2bc6ce47
[ "if len(s) < (1 << k) + k - 1:\n return False\ncur = int(s[:k], base=2)\ncodes = set([cur])\nbegin = 0\nend = k\nwhile len(codes) != 2 ** k and end < len(s):\n cur = (cur - 2 ** (k - 1) * int(s[begin]) << 1) + int(s[end])\n codes.add(cur)\n end += 1\n begin += 1\nreturn len(codes) == 2 ** k", "code...
<|body_start_0|> if len(s) < (1 << k) + k - 1: return False cur = int(s[:k], base=2) codes = set([cur]) begin = 0 end = k while len(codes) != 2 ** k and end < len(s): cur = (cur - 2 ** (k - 1) * int(s[begin]) << 1) + int(s[end]) codes.a...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasAllCodes(self, s, k): """:type s: str :type k: int :rtype: bool""" <|body_0|> def hasAllCodes1(self, s, k): """:type s: str :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(s) < (1 << k) + k - 1: ...
stack_v2_sparse_classes_36k_train_033937
1,032
no_license
[ { "docstring": ":type s: str :type k: int :rtype: bool", "name": "hasAllCodes", "signature": "def hasAllCodes(self, s, k)" }, { "docstring": ":type s: str :type k: int :rtype: bool", "name": "hasAllCodes1", "signature": "def hasAllCodes1(self, s, k)" } ]
2
stack_v2_sparse_classes_30k_train_015569
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasAllCodes(self, s, k): :type s: str :type k: int :rtype: bool - def hasAllCodes1(self, s, k): :type s: str :type k: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasAllCodes(self, s, k): :type s: str :type k: int :rtype: bool - def hasAllCodes1(self, s, k): :type s: str :type k: int :rtype: bool <|skeleton|> class Solution: def ...
9d394cd2862703cfb7a7b505b35deda7450a692e
<|skeleton|> class Solution: def hasAllCodes(self, s, k): """:type s: str :type k: int :rtype: bool""" <|body_0|> def hasAllCodes1(self, s, k): """:type s: str :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def hasAllCodes(self, s, k): """:type s: str :type k: int :rtype: bool""" if len(s) < (1 << k) + k - 1: return False cur = int(s[:k], base=2) codes = set([cur]) begin = 0 end = k while len(codes) != 2 ** k and end < len(s): ...
the_stack_v2_python_sparse
1461.检查一个字符串是否包含所有长度为-k-的二进制子串.py
Ezi4Zy/leetcode
train
0
7f2af0ebde25c221a0a63c207324e765d46e704c
[ "super(SVRenderLayer, self).__init__()\nself.layer = render_layer\nself.camera = camera\nself.keep = keep_output\nself.attr = attr", "self.layer.renderer.eye = self.camera\nself.layer.renderer.light_direction = -self.camera\nout = self.layer(input)\nif self.keep:\n setattr(input, self.attr, out)\nreturn out" ]
<|body_start_0|> super(SVRenderLayer, self).__init__() self.layer = render_layer self.camera = camera self.keep = keep_output self.attr = attr <|end_body_0|> <|body_start_1|> self.layer.renderer.eye = self.camera self.layer.renderer.light_direction = -self.camera...
A class representing a signle view rendering layer Attributes ---------- layer : RenderLayer a rendering layer camera : Tensor the positions of the camera keep : bool if True keeps the output in an attribute of the input data attr : str the name of the attribute to store the output to Methods ------- forward(input) ret...
SVRenderLayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SVRenderLayer: """A class representing a signle view rendering layer Attributes ---------- layer : RenderLayer a rendering layer camera : Tensor the positions of the camera keep : bool if True keeps the output in an attribute of the input data attr : str the name of the attribute to store the out...
stack_v2_sparse_classes_36k_train_033938
9,441
permissive
[ { "docstring": "Parameters ---------- render_layer : RenderLayer a rendering layer camera : Tensor the positions of the camera keep_output : bool (optional) if True keeps the output in an attribute of the input data (default is False) attr : str (optional) the name of the attribute to store the output to (defau...
2
stack_v2_sparse_classes_30k_val_000035
Implement the Python class `SVRenderLayer` described below. Class description: A class representing a signle view rendering layer Attributes ---------- layer : RenderLayer a rendering layer camera : Tensor the positions of the camera keep : bool if True keeps the output in an attribute of the input data attr : str the...
Implement the Python class `SVRenderLayer` described below. Class description: A class representing a signle view rendering layer Attributes ---------- layer : RenderLayer a rendering layer camera : Tensor the positions of the camera keep : bool if True keeps the output in an attribute of the input data attr : str the...
2615b66dd4addfd5c03d9d91a24c7da414294308
<|skeleton|> class SVRenderLayer: """A class representing a signle view rendering layer Attributes ---------- layer : RenderLayer a rendering layer camera : Tensor the positions of the camera keep : bool if True keeps the output in an attribute of the input data attr : str the name of the attribute to store the out...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SVRenderLayer: """A class representing a signle view rendering layer Attributes ---------- layer : RenderLayer a rendering layer camera : Tensor the positions of the camera keep : bool if True keeps the output in an attribute of the input data attr : str the name of the attribute to store the output to Method...
the_stack_v2_python_sparse
ACME/layer/RenderLayer.py
mauriziokovacic/ACME
train
3
739b536a345bfca29f875fc78d6b8a083759b866
[ "coininfo.query.__init__(self, coin_bw_info.eventname)\nself.interfaces = interfaces\nif self.interfaces == None:\n self.interfaces = []\nself.mode = mode", "ilist = ''\nfor i in self.interfaces:\n ilist += 'interface=\"' + str(i) + '\"'\n ilist += ' or '\nreturn ilist[:-3]", "s = '*'\nif self.mode == ...
<|body_start_0|> coininfo.query.__init__(self, coin_bw_info.eventname) self.interfaces = interfaces if self.interfaces == None: self.interfaces = [] self.mode = mode <|end_body_0|> <|body_start_1|> ilist = '' for i in self.interfaces: ilist += 'in...
Class to query bandwidth @author ykk @date Aug 2011
bandwidth_query
[ "LicenseRef-scancode-x11-stanford" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class bandwidth_query: """Class to query bandwidth @author ykk @date Aug 2011""" def __init__(self, mode, interfaces=None): """Initialize @param interfaces list of interfaces to return result""" <|body_0|> def get_condition(self): """Get conditions""" <|body_1|...
stack_v2_sparse_classes_36k_train_033939
8,177
permissive
[ { "docstring": "Initialize @param interfaces list of interfaces to return result", "name": "__init__", "signature": "def __init__(self, mode, interfaces=None)" }, { "docstring": "Get conditions", "name": "get_condition", "signature": "def get_condition(self)" }, { "docstring": "R...
3
null
Implement the Python class `bandwidth_query` described below. Class description: Class to query bandwidth @author ykk @date Aug 2011 Method signatures and docstrings: - def __init__(self, mode, interfaces=None): Initialize @param interfaces list of interfaces to return result - def get_condition(self): Get conditions...
Implement the Python class `bandwidth_query` described below. Class description: Class to query bandwidth @author ykk @date Aug 2011 Method signatures and docstrings: - def __init__(self, mode, interfaces=None): Initialize @param interfaces list of interfaces to return result - def get_condition(self): Get conditions...
c3f5a31b74d5587671329eea9582ac8aed0c58a4
<|skeleton|> class bandwidth_query: """Class to query bandwidth @author ykk @date Aug 2011""" def __init__(self, mode, interfaces=None): """Initialize @param interfaces list of interfaces to return result""" <|body_0|> def get_condition(self): """Get conditions""" <|body_1|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class bandwidth_query: """Class to query bandwidth @author ykk @date Aug 2011""" def __init__(self, mode, interfaces=None): """Initialize @param interfaces list of interfaces to return result""" coininfo.query.__init__(self, coin_bw_info.eventname) self.interfaces = interfaces i...
the_stack_v2_python_sparse
yapc/local/networkstate.py
yapkke/yapc
train
1
c3aaf0ee533e346a02fd9548f8f84618e50da679
[ "self.var_lags = var_lags\nself.model = model\nself.datafreq = datafreq", "lagged_data = []\nfor i, v in enumerate(var_lags):\n for l in var_lags[v]:\n if l == 'cur':\n lagged_data.append(X[:, [i]])\n elif l.endswith('M'):\n lag_avg = rolling_mean(X[:, [i]], l[:-1], datafreq...
<|body_start_0|> self.var_lags = var_lags self.model = model self.datafreq = datafreq <|end_body_0|> <|body_start_1|> lagged_data = [] for i, v in enumerate(var_lags): for l in var_lags[v]: if l == 'cur': lagged_data.append(X[:, [i...
Modelwrapper that lags takes Tair, SWdown, RelHum, Wind, and Rainf, and lags them to estimate Qle fluxes.
LagAverageWrapper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LagAverageWrapper: """Modelwrapper that lags takes Tair, SWdown, RelHum, Wind, and Rainf, and lags them to estimate Qle fluxes.""" def __init__(self, var_lags, model, datafreq=0.5): """Model wrapper :var_lags: OrderedDict like {'Tair': ['cur', '2d'], 'Rainf': ['cur', '2h', '7d', '30d...
stack_v2_sparse_classes_36k_train_033940
19,534
permissive
[ { "docstring": "Model wrapper :var_lags: OrderedDict like {'Tair': ['cur', '2d'], 'Rainf': ['cur', '2h', '7d', '30d', ... :model: model to use lagged variables with :datafreq: data frequency in hours", "name": "__init__", "signature": "def __init__(self, var_lags, model, datafreq=0.5)" }, { "doc...
5
stack_v2_sparse_classes_30k_train_002541
Implement the Python class `LagAverageWrapper` described below. Class description: Modelwrapper that lags takes Tair, SWdown, RelHum, Wind, and Rainf, and lags them to estimate Qle fluxes. Method signatures and docstrings: - def __init__(self, var_lags, model, datafreq=0.5): Model wrapper :var_lags: OrderedDict like ...
Implement the Python class `LagAverageWrapper` described below. Class description: Modelwrapper that lags takes Tair, SWdown, RelHum, Wind, and Rainf, and lags them to estimate Qle fluxes. Method signatures and docstrings: - def __init__(self, var_lags, model, datafreq=0.5): Model wrapper :var_lags: OrderedDict like ...
b82c3f50f69f2cd5be5e97897009e1afee6b167d
<|skeleton|> class LagAverageWrapper: """Modelwrapper that lags takes Tair, SWdown, RelHum, Wind, and Rainf, and lags them to estimate Qle fluxes.""" def __init__(self, var_lags, model, datafreq=0.5): """Model wrapper :var_lags: OrderedDict like {'Tair': ['cur', '2d'], 'Rainf': ['cur', '2h', '7d', '30d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LagAverageWrapper: """Modelwrapper that lags takes Tair, SWdown, RelHum, Wind, and Rainf, and lags them to estimate Qle fluxes.""" def __init__(self, var_lags, model, datafreq=0.5): """Model wrapper :var_lags: OrderedDict like {'Tair': ['cur', '2d'], 'Rainf': ['cur', '2h', '7d', '30d', ... :model...
the_stack_v2_python_sparse
empirical_lsm/transforms.py
naught101/empirical_lsm
train
3
c32129c77f04840651d90ebb9a50df32385d6cc9
[ "dp = [float('inf') for _ in range(amount + 1)]\ndp[0] = 0\nfor n in range(amount + 1):\n for coin in coins:\n if n + coin <= amount:\n dp[n + coin] = min(dp[n + coin], dp[n] + 1)\nreturn dp[-1] if dp[-1] < float('inf') else -1", "def search(amount, count, index):\n if amount == 0:\n ...
<|body_start_0|> dp = [float('inf') for _ in range(amount + 1)] dp[0] = 0 for n in range(amount + 1): for coin in coins: if n + coin <= amount: dp[n + coin] = min(dp[n + coin], dp[n] + 1) return dp[-1] if dp[-1] < float('inf') else -1 <|end...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def coinChange(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" <|body_0|> def coinChange_search(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_36k_train_033941
2,530
no_license
[ { "docstring": ":type coins: List[int] :type amount: int :rtype: int", "name": "coinChange", "signature": "def coinChange(self, coins, amount)" }, { "docstring": ":type coins: List[int] :type amount: int :rtype: int", "name": "coinChange_search", "signature": "def coinChange_search(self,...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def coinChange(self, coins, amount): :type coins: List[int] :type amount: int :rtype: int - def coinChange_search(self, coins, amount): :type coins: List[int] :type amount: int :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def coinChange(self, coins, amount): :type coins: List[int] :type amount: int :rtype: int - def coinChange_search(self, coins, amount): :type coins: List[int] :type amount: int :...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def coinChange(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" <|body_0|> def coinChange_search(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def coinChange(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" dp = [float('inf') for _ in range(amount + 1)] dp[0] = 0 for n in range(amount + 1): for coin in coins: if n + coin <= amount: ...
the_stack_v2_python_sparse
src/lt_322.py
oxhead/CodingYourWay
train
0
7ffc2ef2ec955cff639e2b275b0d2ee44708282f
[ "if not root:\n return None\nelse:\n root.left, root.right = (self.invertTree1(root.right), self.invertTree1(root.left))\nreturn root", "if not root:\n return root\nstack = [root]\nwhile stack:\n node = stack.pop()\n if node:\n node.left, node.right = (node.right, node.left)\n stack +...
<|body_start_0|> if not root: return None else: root.left, root.right = (self.invertTree1(root.right), self.invertTree1(root.left)) return root <|end_body_0|> <|body_start_1|> if not root: return root stack = [root] while stack: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def invertTree1(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_0|> def invertTree2(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return None ...
stack_v2_sparse_classes_36k_train_033942
916
no_license
[ { "docstring": ":type root: TreeNode :rtype: TreeNode", "name": "invertTree1", "signature": "def invertTree1(self, root)" }, { "docstring": ":type root: TreeNode :rtype: TreeNode", "name": "invertTree2", "signature": "def invertTree2(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_009427
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def invertTree1(self, root): :type root: TreeNode :rtype: TreeNode - def invertTree2(self, root): :type root: TreeNode :rtype: TreeNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def invertTree1(self, root): :type root: TreeNode :rtype: TreeNode - def invertTree2(self, root): :type root: TreeNode :rtype: TreeNode <|skeleton|> class Solution: def inv...
8fb6c1d947046dabd58ff8482b2c0b41f39aa988
<|skeleton|> class Solution: def invertTree1(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_0|> def invertTree2(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def invertTree1(self, root): """:type root: TreeNode :rtype: TreeNode""" if not root: return None else: root.left, root.right = (self.invertTree1(root.right), self.invertTree1(root.left)) return root def invertTree2(self, root): ""...
the_stack_v2_python_sparse
Python/LeetCode/226.py
czx94/Algorithms-Collection
train
2
45bbf26a7c8806afc1ba58bebe5c39579533d567
[ "if not self._errors:\n self._errors = ErrorDict()\nself._errors['upload_of_work'] = self.error_class([self.DEF_NO_UPLOAD])", "cleaned_data = self.cleaned_data\nupload = cleaned_data.get('upload_of_work')\nif not upload:\n raise gsoc_forms.ValidationError(self.DEF_NO_UPLOAD)\nreturn upload" ]
<|body_start_0|> if not self._errors: self._errors = ErrorDict() self._errors['upload_of_work'] = self.error_class([self.DEF_NO_UPLOAD]) <|end_body_0|> <|body_start_1|> cleaned_data = self.cleaned_data upload = cleaned_data.get('upload_of_work') if not upload: ...
Django form for submitting code samples for a project.
CodeSampleUploadFileForm
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CodeSampleUploadFileForm: """Django form for submitting code samples for a project.""" def addFileRequiredError(self): """Appends a form error message indicating that this field is required.""" <|body_0|> def clean_upload_of_work(self): """Ensure that file field ...
stack_v2_sparse_classes_36k_train_033943
21,398
permissive
[ { "docstring": "Appends a form error message indicating that this field is required.", "name": "addFileRequiredError", "signature": "def addFileRequiredError(self)" }, { "docstring": "Ensure that file field has data.", "name": "clean_upload_of_work", "signature": "def clean_upload_of_wor...
2
null
Implement the Python class `CodeSampleUploadFileForm` described below. Class description: Django form for submitting code samples for a project. Method signatures and docstrings: - def addFileRequiredError(self): Appends a form error message indicating that this field is required. - def clean_upload_of_work(self): En...
Implement the Python class `CodeSampleUploadFileForm` described below. Class description: Django form for submitting code samples for a project. Method signatures and docstrings: - def addFileRequiredError(self): Appends a form error message indicating that this field is required. - def clean_upload_of_work(self): En...
f581989f168189fa3a58c028eff327a16c03e438
<|skeleton|> class CodeSampleUploadFileForm: """Django form for submitting code samples for a project.""" def addFileRequiredError(self): """Appends a form error message indicating that this field is required.""" <|body_0|> def clean_upload_of_work(self): """Ensure that file field ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CodeSampleUploadFileForm: """Django form for submitting code samples for a project.""" def addFileRequiredError(self): """Appends a form error message indicating that this field is required.""" if not self._errors: self._errors = ErrorDict() self._errors['upload_of_wor...
the_stack_v2_python_sparse
app/soc/modules/gsoc/views/project_details.py
sambitgaan/nupic.son
train
0
ab50a40c51ec49071ac28573eca681a990def741
[ "self.role_id = arg.get('role_id')\nself.user_id = arg.get('user_id')\nself.active = arg.get('active')", "if commit:\n db.session.add(self)\n db.session.commit()", "search = {'user_id': user_id, 'role_id': role_id}\nuser_role = UserRole.query\nresult = user_role.filter_by(**search).first()\nreturn result"...
<|body_start_0|> self.role_id = arg.get('role_id') self.user_id = arg.get('user_id') self.active = arg.get('active') <|end_body_0|> <|body_start_1|> if commit: db.session.add(self) db.session.commit() <|end_body_1|> <|body_start_2|> search = {'user_id': ...
User role model
UserRole
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserRole: """User role model""" def __init__(self, **arg): """User role cobstructor""" <|body_0|> def save(self, commit=True): """User role save""" <|body_1|> def get_by_uid_rid(self, user_id, role_id): """User role uid rid""" <|body_...
stack_v2_sparse_classes_36k_train_033944
1,979
no_license
[ { "docstring": "User role cobstructor", "name": "__init__", "signature": "def __init__(self, **arg)" }, { "docstring": "User role save", "name": "save", "signature": "def save(self, commit=True)" }, { "docstring": "User role uid rid", "name": "get_by_uid_rid", "signature"...
3
stack_v2_sparse_classes_30k_train_018049
Implement the Python class `UserRole` described below. Class description: User role model Method signatures and docstrings: - def __init__(self, **arg): User role cobstructor - def save(self, commit=True): User role save - def get_by_uid_rid(self, user_id, role_id): User role uid rid
Implement the Python class `UserRole` described below. Class description: User role model Method signatures and docstrings: - def __init__(self, **arg): User role cobstructor - def save(self, commit=True): User role save - def get_by_uid_rid(self, user_id, role_id): User role uid rid <|skeleton|> class UserRole: ...
4dc5f5e816e3c461b8a60c5f61c7eafc08050579
<|skeleton|> class UserRole: """User role model""" def __init__(self, **arg): """User role cobstructor""" <|body_0|> def save(self, commit=True): """User role save""" <|body_1|> def get_by_uid_rid(self, user_id, role_id): """User role uid rid""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserRole: """User role model""" def __init__(self, **arg): """User role cobstructor""" self.role_id = arg.get('role_id') self.user_id = arg.get('user_id') self.active = arg.get('active') def save(self, commit=True): """User role save""" if commit: ...
the_stack_v2_python_sparse
app/models/user_role.py
ekramulmostafa/ms-auth
train
0
2858c938ca3a0c39bdec654ba994f789328e59bb
[ "self.mins = mins\nself.maxs = maxs\nself.children = []", "for axis in range(3):\n if coord[axis] < self.mins[axis] or coord[axis] > self.maxs[axis]:\n return False\nreturn True", "for corner in itertools.product(*zip(self.mins, self.maxs)):\n if manhattan_dist(nanobot.coord, corner) > nanobot.r:\n...
<|body_start_0|> self.mins = mins self.maxs = maxs self.children = [] <|end_body_0|> <|body_start_1|> for axis in range(3): if coord[axis] < self.mins[axis] or coord[axis] > self.maxs[axis]: return False return True <|end_body_1|> <|body_start_2|> ...
Node in an octree
OctreeNode
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OctreeNode: """Node in an octree""" def __init__(self, mins, maxs): """Constructor mins: [x, y, z] lower bound maxs: [x, y, z] (inclusive) upper-bound""" <|body_0|> def in_node(self, coord): """Return True if coord is in this node""" <|body_1|> def n...
stack_v2_sparse_classes_36k_train_033945
8,665
permissive
[ { "docstring": "Constructor mins: [x, y, z] lower bound maxs: [x, y, z] (inclusive) upper-bound", "name": "__init__", "signature": "def __init__(self, mins, maxs)" }, { "docstring": "Return True if coord is in this node", "name": "in_node", "signature": "def in_node(self, coord)" }, ...
4
stack_v2_sparse_classes_30k_train_011285
Implement the Python class `OctreeNode` described below. Class description: Node in an octree Method signatures and docstrings: - def __init__(self, mins, maxs): Constructor mins: [x, y, z] lower bound maxs: [x, y, z] (inclusive) upper-bound - def in_node(self, coord): Return True if coord is in this node - def nanob...
Implement the Python class `OctreeNode` described below. Class description: Node in an octree Method signatures and docstrings: - def __init__(self, mins, maxs): Constructor mins: [x, y, z] lower bound maxs: [x, y, z] (inclusive) upper-bound - def in_node(self, coord): Return True if coord is in this node - def nanob...
6671ef8c16a837f697bb3fb91004d1bd892814ba
<|skeleton|> class OctreeNode: """Node in an octree""" def __init__(self, mins, maxs): """Constructor mins: [x, y, z] lower bound maxs: [x, y, z] (inclusive) upper-bound""" <|body_0|> def in_node(self, coord): """Return True if coord is in this node""" <|body_1|> def n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OctreeNode: """Node in an octree""" def __init__(self, mins, maxs): """Constructor mins: [x, y, z] lower bound maxs: [x, y, z] (inclusive) upper-bound""" self.mins = mins self.maxs = maxs self.children = [] def in_node(self, coord): """Return True if coord is ...
the_stack_v2_python_sparse
2018/day23/challenge.py
ericgreveson/adventofcode
train
0
8c1333ec140f6f4614400c1978dff5049c1b46d5
[ "result = list()\nfor num in range(1, n + 1):\n devide_by_3 = num % 3 == 0\n devide_by_5 = num % 5 == 0\n if devide_by_5 and devide_by_3:\n result.append('FizzBuzz')\n elif devide_by_3:\n result.append('Fizz')\n elif devide_by_5:\n result.append('Buzz')\n else:\n result...
<|body_start_0|> result = list() for num in range(1, n + 1): devide_by_3 = num % 3 == 0 devide_by_5 = num % 5 == 0 if devide_by_5 and devide_by_3: result.append('FizzBuzz') elif devide_by_3: result.append('Fizz') ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fizzBuzz(self, n: int) -> List[str]: """:param n: :return: 模拟法 就像你每次玩 FizzBuzz 那样,你只需要判断这个数是能被 3 整除? 还是能被 5 整除? 或者是都能被整除。 初始化一个空的答案列表。 遍历 1 ... N1...N。 对于每个数,判断它能不能同时被 3 和 5 整除,如果可以就把 FizzBuzz 加入答案列表。 如果不行,判断它能不能被 3 整除,如果可以,把 Fizz 加入答案列表。 如果还是不行,判断它能不能被 5 整除,如果可以,把 Buzz 加入答...
stack_v2_sparse_classes_36k_train_033946
4,650
no_license
[ { "docstring": ":param n: :return: 模拟法 就像你每次玩 FizzBuzz 那样,你只需要判断这个数是能被 3 整除? 还是能被 5 整除? 或者是都能被整除。 初始化一个空的答案列表。 遍历 1 ... N1...N。 对于每个数,判断它能不能同时被 3 和 5 整除,如果可以就把 FizzBuzz 加入答案列表。 如果不行,判断它能不能被 3 整除,如果可以,把 Fizz 加入答案列表。 如果还是不行,判断它能不能被 5 整除,如果可以,把 Buzz 加入答案列表。 如果以上都不行,把这个数加入答案列表。 时间击败62.51%,内存击败8.54%", "name": "f...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fizzBuzz(self, n: int) -> List[str]: :param n: :return: 模拟法 就像你每次玩 FizzBuzz 那样,你只需要判断这个数是能被 3 整除? 还是能被 5 整除? 或者是都能被整除。 初始化一个空的答案列表。 遍历 1 ... N1...N。 对于每个数,判断它能不能同时被 3 和 5 整除,...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fizzBuzz(self, n: int) -> List[str]: :param n: :return: 模拟法 就像你每次玩 FizzBuzz 那样,你只需要判断这个数是能被 3 整除? 还是能被 5 整除? 或者是都能被整除。 初始化一个空的答案列表。 遍历 1 ... N1...N。 对于每个数,判断它能不能同时被 3 和 5 整除,...
2dc982e690b153c33bc7e27a63604f754a0df90c
<|skeleton|> class Solution: def fizzBuzz(self, n: int) -> List[str]: """:param n: :return: 模拟法 就像你每次玩 FizzBuzz 那样,你只需要判断这个数是能被 3 整除? 还是能被 5 整除? 或者是都能被整除。 初始化一个空的答案列表。 遍历 1 ... N1...N。 对于每个数,判断它能不能同时被 3 和 5 整除,如果可以就把 FizzBuzz 加入答案列表。 如果不行,判断它能不能被 3 整除,如果可以,把 Fizz 加入答案列表。 如果还是不行,判断它能不能被 5 整除,如果可以,把 Buzz 加入答...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def fizzBuzz(self, n: int) -> List[str]: """:param n: :return: 模拟法 就像你每次玩 FizzBuzz 那样,你只需要判断这个数是能被 3 整除? 还是能被 5 整除? 或者是都能被整除。 初始化一个空的答案列表。 遍历 1 ... N1...N。 对于每个数,判断它能不能同时被 3 和 5 整除,如果可以就把 FizzBuzz 加入答案列表。 如果不行,判断它能不能被 3 整除,如果可以,把 Fizz 加入答案列表。 如果还是不行,判断它能不能被 5 整除,如果可以,把 Buzz 加入答案列表。 如果以上都不行,把...
the_stack_v2_python_sparse
412_fizz-buzz.py
95275059/Algorithm
train
0
474533da8eead71a122d484bdba9674e9a70323f
[ "if self.action == 'list':\n return super().get_queryset().filter(Q(created_by=self.request.user) | Q(recipient=self.request.user))\nreturn super().get_queryset()", "referral = self.get_object()\ncontext = {**self.get_serializer_context(), 'check_association_permissions': False, 'referral': referral, 'user': r...
<|body_start_0|> if self.action == 'list': return super().get_queryset().filter(Q(created_by=self.request.user) | Q(recipient=self.request.user)) return super().get_queryset() <|end_body_0|> <|body_start_1|> referral = self.get_object() context = {**self.get_serializer_conte...
Company referral view set.
CompanyReferralViewSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompanyReferralViewSet: """Company referral view set.""" def get_queryset(self): """Get a queryset for list action that is filtered to the authenticated user's sent and received referrals, otherwise return original queryset.""" <|body_0|> def complete(self, request, **kw...
stack_v2_sparse_classes_36k_train_033947
2,490
permissive
[ { "docstring": "Get a queryset for list action that is filtered to the authenticated user's sent and received referrals, otherwise return original queryset.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "View for completing a referral. Completing a referral in...
2
null
Implement the Python class `CompanyReferralViewSet` described below. Class description: Company referral view set. Method signatures and docstrings: - def get_queryset(self): Get a queryset for list action that is filtered to the authenticated user's sent and received referrals, otherwise return original queryset. - ...
Implement the Python class `CompanyReferralViewSet` described below. Class description: Company referral view set. Method signatures and docstrings: - def get_queryset(self): Get a queryset for list action that is filtered to the authenticated user's sent and received referrals, otherwise return original queryset. - ...
a92faabf73fb93b5bfd94fd465eafc3e29aa6d8e
<|skeleton|> class CompanyReferralViewSet: """Company referral view set.""" def get_queryset(self): """Get a queryset for list action that is filtered to the authenticated user's sent and received referrals, otherwise return original queryset.""" <|body_0|> def complete(self, request, **kw...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CompanyReferralViewSet: """Company referral view set.""" def get_queryset(self): """Get a queryset for list action that is filtered to the authenticated user's sent and received referrals, otherwise return original queryset.""" if self.action == 'list': return super().get_quer...
the_stack_v2_python_sparse
datahub/company_referral/views.py
cgsunkel/data-hub-api
train
0
dce1b2c1ab11b2b9157d0cc875eca336de575a86
[ "QObject.__init__(self, parent)\nself._lias = []\nself.__logger.info('dtype:%s', dtype)\nassert len(fRefs) == len(phases)\nassert len(fRefs) == len(bws)\nself.nRefs = len(fRefs)\nself.nSamples = 0\nself.subtractOffset = subtractOffset\ndecimations = np.asarray(np.power(2, np.round(np.log2(sampleRate / (bws * 40))))...
<|body_start_0|> QObject.__init__(self, parent) self._lias = [] self.__logger.info('dtype:%s', dtype) assert len(fRefs) == len(phases) assert len(fRefs) == len(bws) self.nRefs = len(fRefs) self.nSamples = 0 self.subtractOffset = subtractOffset deci...
Combines multiple single lock-in instances under one hood.
LockIns
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LockIns: """Combines multiple single lock-in instances under one hood.""" def __init__(self, sampleRate, fRefs, phases, bws, lpfOrders, desiredChunkSize, dcBw, dcFilterOrder, subtractOffset=False, parent=None): """Initialize a set of lock-ins given the following input parameters: *sa...
stack_v2_sparse_classes_36k_train_033948
44,064
no_license
[ { "docstring": "Initialize a set of lock-ins given the following input parameters: *sampleRate*: Sample-rate of input data-stream in Hz *fRefs*: Array of lock-in frequencies *phases*: Array of phase offsets *bws*: Array of bandwidths for the lock-in low-pass filters *lpfOrders*: Array of orders of the LPF filte...
2
null
Implement the Python class `LockIns` described below. Class description: Combines multiple single lock-in instances under one hood. Method signatures and docstrings: - def __init__(self, sampleRate, fRefs, phases, bws, lpfOrders, desiredChunkSize, dcBw, dcFilterOrder, subtractOffset=False, parent=None): Initialize a ...
Implement the Python class `LockIns` described below. Class description: Combines multiple single lock-in instances under one hood. Method signatures and docstrings: - def __init__(self, sampleRate, fRefs, phases, bws, lpfOrders, desiredChunkSize, dcBw, dcFilterOrder, subtractOffset=False, parent=None): Initialize a ...
ffba586a4aec423c3dd126be535ea07d84b10eff
<|skeleton|> class LockIns: """Combines multiple single lock-in instances under one hood.""" def __init__(self, sampleRate, fRefs, phases, bws, lpfOrders, desiredChunkSize, dcBw, dcFilterOrder, subtractOffset=False, parent=None): """Initialize a set of lock-ins given the following input parameters: *sa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LockIns: """Combines multiple single lock-in instances under one hood.""" def __init__(self, sampleRate, fRefs, phases, bws, lpfOrders, desiredChunkSize, dcBw, dcFilterOrder, subtractOffset=False, parent=None): """Initialize a set of lock-ins given the following input parameters: *sampleRate*: Sa...
the_stack_v2_python_sparse
TES/MultitoneLockin.py
AvirupRoy/research
train
0
b8190db61cd9e2fbe6e99a5bf851bdf8fcd79d2a
[ "cnt = collections.defaultdict(list)\nfor s in strs:\n cnt[tuple(sorted(Counter(s).items()))].append(s)\nreturn [x for x in cnt.values()]", "d = collections.defaultdict(list)\nfor s in strs:\n key = frozenset(collections.Counter(s).items())\n d[key].append(s)\nreturn list(d.values())" ]
<|body_start_0|> cnt = collections.defaultdict(list) for s in strs: cnt[tuple(sorted(Counter(s).items()))].append(s) return [x for x in cnt.values()] <|end_body_0|> <|body_start_1|> d = collections.defaultdict(list) for s in strs: key = frozenset(collecti...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def groupAnagrams(self, strs: List[str]) -> List[List[str]]: """Runtime: 311 ms, faster than 10.81% Memory Usage: 21.6 MB, less than 9.93% 1 <= strs.length <= 10^4 0 <= strs[i].length <= 100 strs[i] consists of lowercase English letters.""" <|body_0|> def groupAnag...
stack_v2_sparse_classes_36k_train_033949
1,599
permissive
[ { "docstring": "Runtime: 311 ms, faster than 10.81% Memory Usage: 21.6 MB, less than 9.93% 1 <= strs.length <= 10^4 0 <= strs[i].length <= 100 strs[i] consists of lowercase English letters.", "name": "groupAnagrams", "signature": "def groupAnagrams(self, strs: List[str]) -> List[List[str]]" }, { ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def groupAnagrams(self, strs: List[str]) -> List[List[str]]: Runtime: 311 ms, faster than 10.81% Memory Usage: 21.6 MB, less than 9.93% 1 <= strs.length <= 10^4 0 <= strs[i].leng...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def groupAnagrams(self, strs: List[str]) -> List[List[str]]: Runtime: 311 ms, faster than 10.81% Memory Usage: 21.6 MB, less than 9.93% 1 <= strs.length <= 10^4 0 <= strs[i].leng...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def groupAnagrams(self, strs: List[str]) -> List[List[str]]: """Runtime: 311 ms, faster than 10.81% Memory Usage: 21.6 MB, less than 9.93% 1 <= strs.length <= 10^4 0 <= strs[i].length <= 100 strs[i] consists of lowercase English letters.""" <|body_0|> def groupAnag...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def groupAnagrams(self, strs: List[str]) -> List[List[str]]: """Runtime: 311 ms, faster than 10.81% Memory Usage: 21.6 MB, less than 9.93% 1 <= strs.length <= 10^4 0 <= strs[i].length <= 100 strs[i] consists of lowercase English letters.""" cnt = collections.defaultdict(list) ...
the_stack_v2_python_sparse
src/49-GroupAnagrams.py
Jiezhi/myleetcode
train
1
032cef86e10c43d8b85dd26658516506164c5ffb
[ "super(CreateIngest, self).__init__('create_ingest_jobs')\nself.create_ingest_type = None\nself.ingest_id = None\nself.scan_id = None\nself.strike_id = None", "json_dict = {'create_ingest_type': self.create_ingest_type, 'ingest_id': self.ingest_id}\nif self.create_ingest_type == STRIKE_JOB_TYPE:\n json_dict['s...
<|body_start_0|> super(CreateIngest, self).__init__('create_ingest_jobs') self.create_ingest_type = None self.ingest_id = None self.scan_id = None self.strike_id = None <|end_body_0|> <|body_start_1|> json_dict = {'create_ingest_type': self.create_ingest_type, 'ingest_id...
Command message that creates the ingest job
CreateIngest
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateIngest: """Command message that creates the ingest job""" def __init__(self): """Constructor""" <|body_0|> def to_json(self): """See :meth:`messaging.messages.message.CommandMessage.to_json`""" <|body_1|> def from_json(json_dict): """Se...
stack_v2_sparse_classes_36k_train_033950
5,186
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "See :meth:`messaging.messages.message.CommandMessage.to_json`", "name": "to_json", "signature": "def to_json(self)" }, { "docstring": "See :meth:`messaging.messages.message.Comm...
4
stack_v2_sparse_classes_30k_train_017310
Implement the Python class `CreateIngest` described below. Class description: Command message that creates the ingest job Method signatures and docstrings: - def __init__(self): Constructor - def to_json(self): See :meth:`messaging.messages.message.CommandMessage.to_json` - def from_json(json_dict): See :meth:`messag...
Implement the Python class `CreateIngest` described below. Class description: Command message that creates the ingest job Method signatures and docstrings: - def __init__(self): Constructor - def to_json(self): See :meth:`messaging.messages.message.CommandMessage.to_json` - def from_json(json_dict): See :meth:`messag...
28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b
<|skeleton|> class CreateIngest: """Command message that creates the ingest job""" def __init__(self): """Constructor""" <|body_0|> def to_json(self): """See :meth:`messaging.messages.message.CommandMessage.to_json`""" <|body_1|> def from_json(json_dict): """Se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CreateIngest: """Command message that creates the ingest job""" def __init__(self): """Constructor""" super(CreateIngest, self).__init__('create_ingest_jobs') self.create_ingest_type = None self.ingest_id = None self.scan_id = None self.strike_id = None ...
the_stack_v2_python_sparse
scale/ingest/messages/create_ingest_jobs.py
kfconsultant/scale
train
0
d67be9963d1ff3e8431591af26382a2c4182ecf2
[ "res = {}\n\ndef dfs(node, order):\n if not node:\n return\n res[order] = node.val\n dfs(node.left, order * 2 + 1)\n dfs(node.right, order * 2 + 2)\ndfs(root, 0)\nreturn str(res)", "l = eval(data)\nfor key in l:\n l[key] = TreeNode(l[key])\nfor k in l:\n if k * 2 + 1 in l:\n l[k].l...
<|body_start_0|> res = {} def dfs(node, order): if not node: return res[order] = node.val dfs(node.left, order * 2 + 1) dfs(node.right, order * 2 + 2) dfs(root, 0) return str(res) <|end_body_0|> <|body_start_1|> l ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_033951
1,234
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
9ae68ada9f63483323cdeaa0f7da3410a0669371
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" res = {} def dfs(node, order): if not node: return res[order] = node.val dfs(node.left, order * 2 + 1) dfs(node.r...
the_stack_v2_python_sparse
problems/0297.serialize-and-deserialize-binary-tree/serialize-and-deserialize-binary-tree.py
tirsott/lc-go
train
0
4686f6e5d567a321d2c44bd161d17808b55ca3c5
[ "self.log = logging.getLogger('OpenPixelLED')\nself.opc_client = opc_client\nself.debug = debug\nself.channel = int(channel)\nself.led = int(led)\nself.opc_client.add_pixel(self.channel, self.led)", "if self.debug:\n self.log.debug('Setting color: %s', color)\nself.opc_client.set_pixel_color(self.channel, self...
<|body_start_0|> self.log = logging.getLogger('OpenPixelLED') self.opc_client = opc_client self.debug = debug self.channel = int(channel) self.led = int(led) self.opc_client.add_pixel(self.channel, self.led) <|end_body_0|> <|body_start_1|> if self.debug: ...
One LED on the openpixel platform.
OpenPixelLED
[ "MIT", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OpenPixelLED: """One LED on the openpixel platform.""" def __init__(self, opc_client, channel, led, debug): """Initialise Openpixel LED obeject.""" <|body_0|> def color(self, color): """Set color of the led. Args: color: color tuple""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k_train_033952
7,154
permissive
[ { "docstring": "Initialise Openpixel LED obeject.", "name": "__init__", "signature": "def __init__(self, opc_client, channel, led, debug)" }, { "docstring": "Set color of the led. Args: color: color tuple", "name": "color", "signature": "def color(self, color)" } ]
2
stack_v2_sparse_classes_30k_val_000846
Implement the Python class `OpenPixelLED` described below. Class description: One LED on the openpixel platform. Method signatures and docstrings: - def __init__(self, opc_client, channel, led, debug): Initialise Openpixel LED obeject. - def color(self, color): Set color of the led. Args: color: color tuple
Implement the Python class `OpenPixelLED` described below. Class description: One LED on the openpixel platform. Method signatures and docstrings: - def __init__(self, opc_client, channel, led, debug): Initialise Openpixel LED obeject. - def color(self, color): Set color of the led. Args: color: color tuple <|skelet...
00937ab2ff51b1dc668bf465282ffa8ff1eebbd8
<|skeleton|> class OpenPixelLED: """One LED on the openpixel platform.""" def __init__(self, opc_client, channel, led, debug): """Initialise Openpixel LED obeject.""" <|body_0|> def color(self, color): """Set color of the led. Args: color: color tuple""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OpenPixelLED: """One LED on the openpixel platform.""" def __init__(self, opc_client, channel, led, debug): """Initialise Openpixel LED obeject.""" self.log = logging.getLogger('OpenPixelLED') self.opc_client = opc_client self.debug = debug self.channel = int(chann...
the_stack_v2_python_sparse
mpf/platforms/openpixel.py
vgrillot/mpf
train
0
1f07a9714ea50c7b34cb01050863600b811acce4
[ "super(RationaleNet, self).__init__()\nif arch == 's2vt':\n self.caption_net = S2VTModel(glove_loader, dropout_p, hidden_size, vid_feat_size, max_len)\nelif arch == 's2vt-att':\n self.caption_net = S2VTAttModel(glove_loader, dropout_p, hidden_size, vid_feat_size, max_len)\nelse:\n raise NotImplementedError...
<|body_start_0|> super(RationaleNet, self).__init__() if arch == 's2vt': self.caption_net = S2VTModel(glove_loader, dropout_p, hidden_size, vid_feat_size, max_len) elif arch == 's2vt-att': self.caption_net = S2VTAttModel(glove_loader, dropout_p, hidden_size, vid_feat_size...
RationaleNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RationaleNet: def __init__(self, glove_loader, dropout_p, hidden_size, vid_feat_size, max_len, tau, arch, pretrained_base=None): """Args: glove_loader: GLoVe embedding loader dropout_p: Dropout probability for intermediate dropout layers hidden_size: Size of the intermediate linear layer...
stack_v2_sparse_classes_36k_train_033953
3,887
no_license
[ { "docstring": "Args: glove_loader: GLoVe embedding loader dropout_p: Dropout probability for intermediate dropout layers hidden_size: Size of the intermediate linear layers vid_feat_size: Size of the video features max_len: Max length to rollout tau: non-negative scalar temperature arch: video captioning netwo...
2
stack_v2_sparse_classes_30k_train_018749
Implement the Python class `RationaleNet` described below. Class description: Implement the RationaleNet class. Method signatures and docstrings: - def __init__(self, glove_loader, dropout_p, hidden_size, vid_feat_size, max_len, tau, arch, pretrained_base=None): Args: glove_loader: GLoVe embedding loader dropout_p: D...
Implement the Python class `RationaleNet` described below. Class description: Implement the RationaleNet class. Method signatures and docstrings: - def __init__(self, glove_loader, dropout_p, hidden_size, vid_feat_size, max_len, tau, arch, pretrained_base=None): Args: glove_loader: GLoVe embedding loader dropout_p: D...
5f347de39f5583cd043c6f572178da08f7c0de94
<|skeleton|> class RationaleNet: def __init__(self, glove_loader, dropout_p, hidden_size, vid_feat_size, max_len, tau, arch, pretrained_base=None): """Args: glove_loader: GLoVe embedding loader dropout_p: Dropout probability for intermediate dropout layers hidden_size: Size of the intermediate linear layer...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RationaleNet: def __init__(self, glove_loader, dropout_p, hidden_size, vid_feat_size, max_len, tau, arch, pretrained_base=None): """Args: glove_loader: GLoVe embedding loader dropout_p: Dropout probability for intermediate dropout layers hidden_size: Size of the intermediate linear layers vid_feat_siz...
the_stack_v2_python_sparse
model/RationaleNet.py
AmmieQi/pytorch-video-caption-rationale
train
0
c35d85072252f369e3f6de541b829036b21cf77a
[ "attrs = []\nfor attrName in self.orderedAttributes:\n try:\n attrValue = getattr(self.klass, attrName)\n hookClass = self.klass\n except AttributeError:\n attrValue = getattr(self.modelClass, attrName)\n hookClass = self.modelClass\n if isinstance(attrValue, Type):\n if ...
<|body_start_0|> attrs = [] for attrName in self.orderedAttributes: try: attrValue = getattr(self.klass, attrName) hookClass = self.klass except AttributeError: attrValue = getattr(self.modelClass, attrName) hookClas...
This class gives information about an Appy class.
ClassDescriptor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassDescriptor: """This class gives information about an Appy class.""" def getOrderedAppyAttributes(self, condition=None): """Returns the appy types for all attributes of this class and parent class(es). If a p_condition is specified, ony Appy types matching the condition will be r...
stack_v2_sparse_classes_36k_train_033954
10,177
no_license
[ { "docstring": "Returns the appy types for all attributes of this class and parent class(es). If a p_condition is specified, ony Appy types matching the condition will be returned. p_condition must be a string containing an expression that will be evaluated with, in its context, \"self\" being this ClassDescrip...
4
stack_v2_sparse_classes_30k_train_006618
Implement the Python class `ClassDescriptor` described below. Class description: This class gives information about an Appy class. Method signatures and docstrings: - def getOrderedAppyAttributes(self, condition=None): Returns the appy types for all attributes of this class and parent class(es). If a p_condition is s...
Implement the Python class `ClassDescriptor` described below. Class description: This class gives information about an Appy class. Method signatures and docstrings: - def getOrderedAppyAttributes(self, condition=None): Returns the appy types for all attributes of this class and parent class(es). If a p_condition is s...
866b33c1af866524eb2a3a7bde896c6836fc69f9
<|skeleton|> class ClassDescriptor: """This class gives information about an Appy class.""" def getOrderedAppyAttributes(self, condition=None): """Returns the appy types for all attributes of this class and parent class(es). If a p_condition is specified, ony Appy types matching the condition will be r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClassDescriptor: """This class gives information about an Appy class.""" def getOrderedAppyAttributes(self, condition=None): """Returns the appy types for all attributes of this class and parent class(es). If a p_condition is specified, ony Appy types matching the condition will be returned. p_co...
the_stack_v2_python_sparse
appy/gen/descriptors.py
thefrolov/open-drug-store
train
0
876d1d26635d85f2f94a706ea78757ce80e3824d
[ "if 'even' == 'odd':\n arrayextension = 5\nelse:\n arrayextension = 0\narraylength = 96 + arrayextension\nMaxVal = 255\nMinVal = 0\nself.gentest = bytes([MaxVal // 2] * arraylength)", "with self.assertRaises(TypeError):\n result = bytesfunc.bmin(1, nosimd=True)\nwith self.assertRaises(TypeError):\n re...
<|body_start_0|> if 'even' == 'odd': arrayextension = 5 else: arrayextension = 0 arraylength = 96 + arrayextension MaxVal = 255 MinVal = 0 self.gentest = bytes([MaxVal // 2] * arraylength) <|end_body_0|> <|body_start_1|> with self.assertRa...
Test bmin for basic parameter tests. op_template_params
bmin_parameter_even_arraysize_without_simd_bytes
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class bmin_parameter_even_arraysize_without_simd_bytes: """Test bmin for basic parameter tests. op_template_params""" def setUp(self): """Initialise.""" <|body_0|> def test_bmin_param_function_01(self): """Test bmin - Sequence type bytes. Test invalid parameter type ev...
stack_v2_sparse_classes_36k_train_033955
49,998
permissive
[ { "docstring": "Initialise.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test bmin - Sequence type bytes. Test invalid parameter type even length array without SIMD.", "name": "test_bmin_param_function_01", "signature": "def test_bmin_param_function_01(self)" },...
5
stack_v2_sparse_classes_30k_train_006922
Implement the Python class `bmin_parameter_even_arraysize_without_simd_bytes` described below. Class description: Test bmin for basic parameter tests. op_template_params Method signatures and docstrings: - def setUp(self): Initialise. - def test_bmin_param_function_01(self): Test bmin - Sequence type bytes. Test inva...
Implement the Python class `bmin_parameter_even_arraysize_without_simd_bytes` described below. Class description: Test bmin for basic parameter tests. op_template_params Method signatures and docstrings: - def setUp(self): Initialise. - def test_bmin_param_function_01(self): Test bmin - Sequence type bytes. Test inva...
28fe0705fc59b0646a4d44e539c919173e8e8b99
<|skeleton|> class bmin_parameter_even_arraysize_without_simd_bytes: """Test bmin for basic parameter tests. op_template_params""" def setUp(self): """Initialise.""" <|body_0|> def test_bmin_param_function_01(self): """Test bmin - Sequence type bytes. Test invalid parameter type ev...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class bmin_parameter_even_arraysize_without_simd_bytes: """Test bmin for basic parameter tests. op_template_params""" def setUp(self): """Initialise.""" if 'even' == 'odd': arrayextension = 5 else: arrayextension = 0 arraylength = 96 + arrayextension ...
the_stack_v2_python_sparse
unittest/test_bmin.py
m1griffin/bytesfunc
train
2
88411dd749eb56e49cb92649bcc4932959a13d9f
[ "period_obj = self.pool.get('account.period')\nperiod_ids = period_obj.next(cr, uid, start_period, periods_nbr, context=context)\nif not period_ids:\n return None\nreturn period_obj.browse(cr, uid, period_ids, context=context)", "period_obj = self.pool.get('account.period')\nids = period_obj.search(cr, uid, [(...
<|body_start_0|> period_obj = self.pool.get('account.period') period_ids = period_obj.next(cr, uid, start_period, periods_nbr, context=context) if not period_ids: return None return period_obj.browse(cr, uid, period_ids, context=context) <|end_body_0|> <|body_start_1|> ...
add new methods to the account_period object
account_period
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class account_period: """add new methods to the account_period object""" def _get_next_periods(self, cr, uid, start_period, periods_nbr, context=None): """return a list of browse record periods that follow the "start_period" for the given version. periods_nbr is the limit of periods to ret...
stack_v2_sparse_classes_36k_train_033956
2,473
no_license
[ { "docstring": "return a list of browse record periods that follow the \"start_period\" for the given version. periods_nbr is the limit of periods to return", "name": "_get_next_periods", "signature": "def _get_next_periods(self, cr, uid, start_period, periods_nbr, context=None)" }, { "docstring...
2
null
Implement the Python class `account_period` described below. Class description: add new methods to the account_period object Method signatures and docstrings: - def _get_next_periods(self, cr, uid, start_period, periods_nbr, context=None): return a list of browse record periods that follow the "start_period" for the ...
Implement the Python class `account_period` described below. Class description: add new methods to the account_period object Method signatures and docstrings: - def _get_next_periods(self, cr, uid, start_period, periods_nbr, context=None): return a list of browse record periods that follow the "start_period" for the ...
01c8294e969cce818a33fd06682560e0344c217c
<|skeleton|> class account_period: """add new methods to the account_period object""" def _get_next_periods(self, cr, uid, start_period, periods_nbr, context=None): """return a list of browse record periods that follow the "start_period" for the given version. periods_nbr is the limit of periods to ret...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class account_period: """add new methods to the account_period object""" def _get_next_periods(self, cr, uid, start_period, periods_nbr, context=None): """return a list of browse record periods that follow the "start_period" for the given version. periods_nbr is the limit of periods to return""" ...
the_stack_v2_python_sparse
Varios/alimentacion/__unported__/budget/account.py
ELNOGAL/GALIPAT_LUGO
train
0
735163253e9db66f44247a3ce6ca1a30873b3af4
[ "order_id = request.GET.get('order_id')\ntry:\n OrderInfo.objects.get(order_id=order_id, user=request.user)\nexcept OrderInfo.DoesNotExist:\n return http.HttpResponseNotFound('订单不存在')\ntry:\n uncomment_goods = OrderGoods.objects.filter(order_id=order_id, is_commented=False)\nexcept Exception:\n return h...
<|body_start_0|> order_id = request.GET.get('order_id') try: OrderInfo.objects.get(order_id=order_id, user=request.user) except OrderInfo.DoesNotExist: return http.HttpResponseNotFound('订单不存在') try: uncomment_goods = OrderGoods.objects.filter(order_id=...
订单商品评价
OrderCommentView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrderCommentView: """订单商品评价""" def get(self, request): """展示商品评价页面""" <|body_0|> def post(self, request): """评价订单商品""" <|body_1|> <|end_skeleton|> <|body_start_0|> order_id = request.GET.get('order_id') try: OrderInfo.objects...
stack_v2_sparse_classes_36k_train_033957
13,412
permissive
[ { "docstring": "展示商品评价页面", "name": "get", "signature": "def get(self, request)" }, { "docstring": "评价订单商品", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_009712
Implement the Python class `OrderCommentView` described below. Class description: 订单商品评价 Method signatures and docstrings: - def get(self, request): 展示商品评价页面 - def post(self, request): 评价订单商品
Implement the Python class `OrderCommentView` described below. Class description: 订单商品评价 Method signatures and docstrings: - def get(self, request): 展示商品评价页面 - def post(self, request): 评价订单商品 <|skeleton|> class OrderCommentView: """订单商品评价""" def get(self, request): """展示商品评价页面""" <|body_0|> ...
2434231795b3319dfda60b19af18442ee5f6fa73
<|skeleton|> class OrderCommentView: """订单商品评价""" def get(self, request): """展示商品评价页面""" <|body_0|> def post(self, request): """评价订单商品""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrderCommentView: """订单商品评价""" def get(self, request): """展示商品评价页面""" order_id = request.GET.get('order_id') try: OrderInfo.objects.get(order_id=order_id, user=request.user) except OrderInfo.DoesNotExist: return http.HttpResponseNotFound('订单不存在') ...
the_stack_v2_python_sparse
meiduo_project/meiduo_mall/meiduo_mall/apps/orders/views.py
xlztongxue/meiduoshangcheng
train
0
118e116620c4c28e2f77cc9f0c520ee3c8e82320
[ "try:\n user_id = EasyUUID(user_id)\nexcept ValueError:\n logger.warn(f'Invalid ACTOR UUID f{user_id}')\n data = user_schema.copy()\n data['id'] = str(user_id)\n data['fullname'] = ''\n return data\nif user_id == SystemUser.id:\n user = SystemUser\nelse:\n user = UserProfile.get(user_id)\nre...
<|body_start_0|> try: user_id = EasyUUID(user_id) except ValueError: logger.warn(f'Invalid ACTOR UUID f{user_id}') data = user_schema.copy() data['id'] = str(user_id) data['fullname'] = '' return data if user_id == SystemUse...
Leica implementation of the IUserProfileQuery interface.
LeicaUserProfileQuery
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LeicaUserProfileQuery: """Leica implementation of the IUserProfileQuery interface.""" def get_data(self, user_id: AnyUUID) -> dict: """Get a map with user data.""" <|body_0|> def get_all_data(self, principal_ids: list) -> list: """Get all user data from a list of...
stack_v2_sparse_classes_36k_train_033958
2,844
no_license
[ { "docstring": "Get a map with user data.", "name": "get_data", "signature": "def get_data(self, user_id: AnyUUID) -> dict" }, { "docstring": "Get all user data from a list of principals.", "name": "get_all_data", "signature": "def get_all_data(self, principal_ids: list) -> list" }, ...
4
stack_v2_sparse_classes_30k_train_009806
Implement the Python class `LeicaUserProfileQuery` described below. Class description: Leica implementation of the IUserProfileQuery interface. Method signatures and docstrings: - def get_data(self, user_id: AnyUUID) -> dict: Get a map with user data. - def get_all_data(self, principal_ids: list) -> list: Get all use...
Implement the Python class `LeicaUserProfileQuery` described below. Class description: Leica implementation of the IUserProfileQuery interface. Method signatures and docstrings: - def get_data(self, user_id: AnyUUID) -> dict: Get a map with user data. - def get_all_data(self, principal_ids: list) -> list: Get all use...
e85c0ba0992bccb80878e89ec791ee64754646b0
<|skeleton|> class LeicaUserProfileQuery: """Leica implementation of the IUserProfileQuery interface.""" def get_data(self, user_id: AnyUUID) -> dict: """Get a map with user data.""" <|body_0|> def get_all_data(self, principal_ids: list) -> list: """Get all user data from a list of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LeicaUserProfileQuery: """Leica implementation of the IUserProfileQuery interface.""" def get_data(self, user_id: AnyUUID) -> dict: """Get a map with user data.""" try: user_id = EasyUUID(user_id) except ValueError: logger.warn(f'Invalid ACTOR UUID f{user_i...
the_stack_v2_python_sparse
src/briefy/leica/utilities/userprofile.py
BriefyHQ/briefy.leica
train
0
a2f874b9f44153708444e521229fb1d1d0639a71
[ "self.oldStep = None\nself.oldGradient = None\nself.coeff_function = coeff_function", "newGradient = function.gradient(point)\nif 'direction' in state:\n oldGradient = state['gradient']\n oldStep = state['direction']\n if all(newGradient == oldGradient):\n coeff = 0\n step = -newGradient\n ...
<|body_start_0|> self.oldStep = None self.oldGradient = None self.coeff_function = coeff_function <|end_body_0|> <|body_start_1|> newGradient = function.gradient(point) if 'direction' in state: oldGradient = state['gradient'] oldStep = state['direction'] ...
The basic conjugate gradient step
ConjugateGradientStep
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConjugateGradientStep: """The basic conjugate gradient step""" def __init__(self, coeff_function): """Initialization of the gradient step - coeff_function is the function that will compute the appropriate coefficient""" <|body_0|> def __call__(self, function, point, stat...
stack_v2_sparse_classes_36k_train_033959
3,963
permissive
[ { "docstring": "Initialization of the gradient step - coeff_function is the function that will compute the appropriate coefficient", "name": "__init__", "signature": "def __init__(self, coeff_function)" }, { "docstring": "Computes a gradient step based on a function and a point", "name": "__...
2
null
Implement the Python class `ConjugateGradientStep` described below. Class description: The basic conjugate gradient step Method signatures and docstrings: - def __init__(self, coeff_function): Initialization of the gradient step - coeff_function is the function that will compute the appropriate coefficient - def __ca...
Implement the Python class `ConjugateGradientStep` described below. Class description: The basic conjugate gradient step Method signatures and docstrings: - def __init__(self, coeff_function): Initialization of the gradient step - coeff_function is the function that will compute the appropriate coefficient - def __ca...
3d298e908ff55340cd3612078508be0c791f63a8
<|skeleton|> class ConjugateGradientStep: """The basic conjugate gradient step""" def __init__(self, coeff_function): """Initialization of the gradient step - coeff_function is the function that will compute the appropriate coefficient""" <|body_0|> def __call__(self, function, point, stat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConjugateGradientStep: """The basic conjugate gradient step""" def __init__(self, coeff_function): """Initialization of the gradient step - coeff_function is the function that will compute the appropriate coefficient""" self.oldStep = None self.oldGradient = None self.coef...
the_stack_v2_python_sparse
PyDSTool/Toolbox/optimizers/step/conjugate_gradient_step.py
mdlama/pydstool
train
2
f1b1fb46dae71dca67c8c0bedd81a6b0fd1922ab
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
The DLP API is a service that allows clients to detect the presence of Personally Identifiable Information (PII) and other privacy-sensitive data in user-supplied, unstructured data streams, like text blocks or images. The service also includes methods for sensitive data redaction and scheduling of data scans on Google...
DlpServiceServicer
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DlpServiceServicer: """The DLP API is a service that allows clients to detect the presence of Personally Identifiable Information (PII) and other privacy-sensitive data in user-supplied, unstructured data streams, like text blocks or images. The service also includes methods for sensitive data re...
stack_v2_sparse_classes_36k_train_033960
9,424
permissive
[ { "docstring": "Find potentially sensitive info in a list of strings. This method has limits on input size, processing time, and output size.", "name": "InspectContent", "signature": "def InspectContent(self, request, context)" }, { "docstring": "Redact potentially sensitive info from a list of ...
6
stack_v2_sparse_classes_30k_train_007374
Implement the Python class `DlpServiceServicer` described below. Class description: The DLP API is a service that allows clients to detect the presence of Personally Identifiable Information (PII) and other privacy-sensitive data in user-supplied, unstructured data streams, like text blocks or images. The service also...
Implement the Python class `DlpServiceServicer` described below. Class description: The DLP API is a service that allows clients to detect the presence of Personally Identifiable Information (PII) and other privacy-sensitive data in user-supplied, unstructured data streams, like text blocks or images. The service also...
86977c0e2e97011359b619c88db47168181908ea
<|skeleton|> class DlpServiceServicer: """The DLP API is a service that allows clients to detect the presence of Personally Identifiable Information (PII) and other privacy-sensitive data in user-supplied, unstructured data streams, like text blocks or images. The service also includes methods for sensitive data re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DlpServiceServicer: """The DLP API is a service that allows clients to detect the presence of Personally Identifiable Information (PII) and other privacy-sensitive data in user-supplied, unstructured data streams, like text blocks or images. The service also includes methods for sensitive data redaction and s...
the_stack_v2_python_sparse
generated/python/proto-google-cloud-dlp-v2beta1/google/cloud/proto/privacy/dlp/v2beta1/dlp_pb2_grpc.py
QPC-github/api-client-staging
train
1
c271a343c58153dda279e8a017bab3a959ced606
[ "self.public_ip = public_ip\nself.uplink = uplink\nself.port_rules = port_rules", "if dictionary is None:\n return None\npublic_ip = dictionary.get('publicIp')\nuplink = dictionary.get('uplink')\nport_rules = None\nif dictionary.get('portRules') != None:\n port_rules = list()\n for structure in dictionar...
<|body_start_0|> self.public_ip = public_ip self.uplink = uplink self.port_rules = port_rules <|end_body_0|> <|body_start_1|> if dictionary is None: return None public_ip = dictionary.get('publicIp') uplink = dictionary.get('uplink') port_rules = None...
Implementation of the 'Rule7' model. TODO: type model description here. Attributes: public_ip (string): The IP address that will be used to access the internal resource from the WAN uplink (Uplink1Enum): The physical WAN interface on which the traffic will arrive ('internet1' or, if available, 'internet2') port_rules (...
Rule7Model
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rule7Model: """Implementation of the 'Rule7' model. TODO: type model description here. Attributes: public_ip (string): The IP address that will be used to access the internal resource from the WAN uplink (Uplink1Enum): The physical WAN interface on which the traffic will arrive ('internet1' or, i...
stack_v2_sparse_classes_36k_train_033961
2,338
permissive
[ { "docstring": "Constructor for the Rule7Model class", "name": "__init__", "signature": "def __init__(self, public_ip=None, uplink=None, port_rules=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the obje...
2
null
Implement the Python class `Rule7Model` described below. Class description: Implementation of the 'Rule7' model. TODO: type model description here. Attributes: public_ip (string): The IP address that will be used to access the internal resource from the WAN uplink (Uplink1Enum): The physical WAN interface on which the...
Implement the Python class `Rule7Model` described below. Class description: Implementation of the 'Rule7' model. TODO: type model description here. Attributes: public_ip (string): The IP address that will be used to access the internal resource from the WAN uplink (Uplink1Enum): The physical WAN interface on which the...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class Rule7Model: """Implementation of the 'Rule7' model. TODO: type model description here. Attributes: public_ip (string): The IP address that will be used to access the internal resource from the WAN uplink (Uplink1Enum): The physical WAN interface on which the traffic will arrive ('internet1' or, i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Rule7Model: """Implementation of the 'Rule7' model. TODO: type model description here. Attributes: public_ip (string): The IP address that will be used to access the internal resource from the WAN uplink (Uplink1Enum): The physical WAN interface on which the traffic will arrive ('internet1' or, if available, ...
the_stack_v2_python_sparse
meraki_sdk/models/rule_7_model.py
RaulCatalano/meraki-python-sdk
train
1
d1128666882ce426356e2a13d4c0c5305c48c5f7
[ "self.od = OrderedDict()\nself.total = 0\nself.last = 300", "if timestamp < self.last - 299:\n return\nif timestamp > self.last:\n self.last = timestamp\n for t in self.od:\n if t < self.last - 299:\n self.total -= self.od[t]\n del self.od[t]\n else:\n break...
<|body_start_0|> self.od = OrderedDict() self.total = 0 self.last = 300 <|end_body_0|> <|body_start_1|> if timestamp < self.last - 299: return if timestamp > self.last: self.last = timestamp for t in self.od: if t < self.last -...
HitCounter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HitCounter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def hit(self, timestamp): """Record a hit. @param timestamp - The current timestamp (in seconds granularity). :type timestamp: int :rtype: void""" <|body_1|> def getHit...
stack_v2_sparse_classes_36k_train_033962
1,677
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Record a hit. @param timestamp - The current timestamp (in seconds granularity). :type timestamp: int :rtype: void", "name": "hit", "signature": "def hit(self, ...
3
stack_v2_sparse_classes_30k_train_000810
Implement the Python class `HitCounter` described below. Class description: Implement the HitCounter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def hit(self, timestamp): Record a hit. @param timestamp - The current timestamp (in seconds granularity). :type ti...
Implement the Python class `HitCounter` described below. Class description: Implement the HitCounter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def hit(self, timestamp): Record a hit. @param timestamp - The current timestamp (in seconds granularity). :type ti...
70f16a872cb203f77eeddb812e734ad1d46df79d
<|skeleton|> class HitCounter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def hit(self, timestamp): """Record a hit. @param timestamp - The current timestamp (in seconds granularity). :type timestamp: int :rtype: void""" <|body_1|> def getHit...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HitCounter: def __init__(self): """Initialize your data structure here.""" self.od = OrderedDict() self.total = 0 self.last = 300 def hit(self, timestamp): """Record a hit. @param timestamp - The current timestamp (in seconds granularity). :type timestamp: int :rty...
the_stack_v2_python_sparse
design-hit-counter.py
cannium/leetcode
train
0
a4e34f5d5a020f5b26d062a7207d2e4712082278
[ "if HAS_ISBD and ISelectableBrowserDefault.providedBy(target):\n return target.getLayout()\nelse:\n view = target.getTypeInfo().getActionById('view') or 'base_view'\n if view == 'view':\n view = target.portal_type.lower() + '_view'\n return view", "data = [HelpCenterReferenceManualPage.Searchab...
<|body_start_0|> if HAS_ISBD and ISelectableBrowserDefault.providedBy(target): return target.getLayout() else: view = target.getTypeInfo().getActionById('view') or 'base_view' if view == 'view': view = target.portal_type.lower() + '_view' r...
Represents a page that can contain Tabbed Pages.
CompositePage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompositePage: """Represents a page that can contain Tabbed Pages.""" def getTargetObjectLayout(self, target): """Returns target object 'view' action page template""" <|body_0|> def SearchableText(self): """Append references' searchable fields.""" <|body_...
stack_v2_sparse_classes_36k_train_033963
6,158
no_license
[ { "docstring": "Returns target object 'view' action page template", "name": "getTargetObjectLayout", "signature": "def getTargetObjectLayout(self, target)" }, { "docstring": "Append references' searchable fields.", "name": "SearchableText", "signature": "def SearchableText(self)" }, ...
3
null
Implement the Python class `CompositePage` described below. Class description: Represents a page that can contain Tabbed Pages. Method signatures and docstrings: - def getTargetObjectLayout(self, target): Returns target object 'view' action page template - def SearchableText(self): Append references' searchable field...
Implement the Python class `CompositePage` described below. Class description: Represents a page that can contain Tabbed Pages. Method signatures and docstrings: - def getTargetObjectLayout(self, target): Returns target object 'view' action page template - def SearchableText(self): Append references' searchable field...
5cf0ba31dfbff8d2c1b4aa8ab6f69c7a0ae9870d
<|skeleton|> class CompositePage: """Represents a page that can contain Tabbed Pages.""" def getTargetObjectLayout(self, target): """Returns target object 'view' action page template""" <|body_0|> def SearchableText(self): """Append references' searchable fields.""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CompositePage: """Represents a page that can contain Tabbed Pages.""" def getTargetObjectLayout(self, target): """Returns target object 'view' action page template""" if HAS_ISBD and ISelectableBrowserDefault.providedBy(target): return target.getLayout() else: ...
the_stack_v2_python_sparse
plone.products/BungeniHelpCenter/branches/plone4/content/CompositePage.py
malangalanga/bungeni-portal
train
0
aae29f00df7c467d5a99deb3678440a9c69c090c
[ "super(SurnameClassifier, self).__init__()\nself.emb = nn.Embedding(num_embeddings=num_embeddings, embedding_dim=embedding_size, padding_idx=padding_idx)\nself.rnn = ElmanRNN(input_size=embedding_size, hidden_size=rnn_hidden_size, batch_first=batch_first)\nself.fc1 = nn.Linear(in_features=rnn_hidden_size, out_featu...
<|body_start_0|> super(SurnameClassifier, self).__init__() self.emb = nn.Embedding(num_embeddings=num_embeddings, embedding_dim=embedding_size, padding_idx=padding_idx) self.rnn = ElmanRNN(input_size=embedding_size, hidden_size=rnn_hidden_size, batch_first=batch_first) self.fc1 = nn.Line...
A Classifier with an RNN to extract features and an MLP to classify
SurnameClassifier
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SurnameClassifier: """A Classifier with an RNN to extract features and an MLP to classify""" def __init__(self, embedding_size, num_embeddings, num_classes, rnn_hidden_size, batch_first=True, padding_idx=0): """Args: embedding_size (int): The size of the character embeddings num_embe...
stack_v2_sparse_classes_36k_train_033964
28,260
no_license
[ { "docstring": "Args: embedding_size (int): The size of the character embeddings num_embeddings (int): The number of characters to embed num_classes (int): The size of the prediction vector Note: the number of nationalities rnn_hidden_size (int): The size of the RNN's hidden state batch_first (bool): Informs wh...
2
stack_v2_sparse_classes_30k_train_018101
Implement the Python class `SurnameClassifier` described below. Class description: A Classifier with an RNN to extract features and an MLP to classify Method signatures and docstrings: - def __init__(self, embedding_size, num_embeddings, num_classes, rnn_hidden_size, batch_first=True, padding_idx=0): Args: embedding_...
Implement the Python class `SurnameClassifier` described below. Class description: A Classifier with an RNN to extract features and an MLP to classify Method signatures and docstrings: - def __init__(self, embedding_size, num_embeddings, num_classes, rnn_hidden_size, batch_first=True, padding_idx=0): Args: embedding_...
ba8feae92c875c1e65ad5a25a2363393ab0daf79
<|skeleton|> class SurnameClassifier: """A Classifier with an RNN to extract features and an MLP to classify""" def __init__(self, embedding_size, num_embeddings, num_classes, rnn_hidden_size, batch_first=True, padding_idx=0): """Args: embedding_size (int): The size of the character embeddings num_embe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SurnameClassifier: """A Classifier with an RNN to extract features and an MLP to classify""" def __init__(self, embedding_size, num_embeddings, num_classes, rnn_hidden_size, batch_first=True, padding_idx=0): """Args: embedding_size (int): The size of the character embeddings num_embeddings (int):...
the_stack_v2_python_sparse
chapter_6/elman_rnn.py
kerenskybr/nlp_pytorch_book
train
0
0cf0b80f9605081cd12d77fd86260304c714246d
[ "sp = ' ' if opt_sp and self.name in COMPOUND else ''\nif self.elem_type is None:\n return CPP_TYPE[self.name] + sp\nreturn CPP_TYPE[self.name] % self.elem_type.cppType(opt_sp=True) + sp", "type = self.cppType()\nif self.name in BY_CREF:\n type += ' const&'\nreturn type", "cpp_type = self.cppType()\nif se...
<|body_start_0|> sp = ' ' if opt_sp and self.name in COMPOUND else '' if self.elem_type is None: return CPP_TYPE[self.name] + sp return CPP_TYPE[self.name] % self.elem_type.cppType(opt_sp=True) + sp <|end_body_0|> <|body_start_1|> type = self.cppType() if self.name i...
IDLType
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IDLType: def cppType(self, opt_sp=False): """Gets the C++ type declaration of this IDL type. The opt_sp puts a trailing space after a closing angle bracket if the type itself ends with a closing angle bracket.""" <|body_0|> def cppArgType(self): """Gets the C++ type ...
stack_v2_sparse_classes_36k_train_033965
15,282
no_license
[ { "docstring": "Gets the C++ type declaration of this IDL type. The opt_sp puts a trailing space after a closing angle bracket if the type itself ends with a closing angle bracket.", "name": "cppType", "signature": "def cppType(self, opt_sp=False)" }, { "docstring": "Gets the C++ type declaratio...
4
stack_v2_sparse_classes_30k_train_021373
Implement the Python class `IDLType` described below. Class description: Implement the IDLType class. Method signatures and docstrings: - def cppType(self, opt_sp=False): Gets the C++ type declaration of this IDL type. The opt_sp puts a trailing space after a closing angle bracket if the type itself ends with a closi...
Implement the Python class `IDLType` described below. Class description: Implement the IDLType class. Method signatures and docstrings: - def cppType(self, opt_sp=False): Gets the C++ type declaration of this IDL type. The opt_sp puts a trailing space after a closing angle bracket if the type itself ends with a closi...
ad831300367843058ee7c01a82e745f026e1fcbf
<|skeleton|> class IDLType: def cppType(self, opt_sp=False): """Gets the C++ type declaration of this IDL type. The opt_sp puts a trailing space after a closing angle bracket if the type itself ends with a closing angle bracket.""" <|body_0|> def cppArgType(self): """Gets the C++ type ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IDLType: def cppType(self, opt_sp=False): """Gets the C++ type declaration of this IDL type. The opt_sp puts a trailing space after a closing angle bracket if the type itself ends with a closing angle bracket.""" sp = ' ' if opt_sp and self.name in COMPOUND else '' if self.elem_type is...
the_stack_v2_python_sparse
python/idl_cpp_types.py
ogoodman/serf
train
1
ba0588867ab05212f57c28474e4533677104f219
[ "targ = self.caller.search(self.lhs)\nif not targ:\n return\nself.msg('Modifiers on %s: %s' % (targ, ', '.join((str(ob) for ob in targ.modifiers.all()))))", "from server.utils.arx_utils import dict_from_choices_field\nchoices = dict_from_choices_field(RollModifier, 'CHECK_CHOICES')\ntry:\n value = int(self....
<|body_start_0|> targ = self.caller.search(self.lhs) if not targ: return self.msg('Modifiers on %s: %s' % (targ, ', '.join((str(ob) for ob in targ.modifiers.all())))) <|end_body_0|> <|body_start_1|> from server.utils.arx_utils import dict_from_choices_field choices =...
Adds modifiers to objects Usage: @modifiers <object> @modifiers/search <tag name> @modifiers/targetmod <object>=<value>,<tag name>,check @modifiers/usermod <object>=<value>,<tag name>,check Sets modifiers for the most common usages - an object providing a bonus against those with a particular tag (targetmod) for a give...
CmdModifiers
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CmdModifiers: """Adds modifiers to objects Usage: @modifiers <object> @modifiers/search <tag name> @modifiers/targetmod <object>=<value>,<tag name>,check @modifiers/usermod <object>=<value>,<tag name>,check Sets modifiers for the most common usages - an object providing a bonus against those with...
stack_v2_sparse_classes_36k_train_033966
7,392
permissive
[ { "docstring": "Displays modifiers on target", "name": "display_mods", "signature": "def display_mods(self)" }, { "docstring": "Adds a modifier to target", "name": "add_mod", "signature": "def add_mod(self)" }, { "docstring": "Searches for modifiers for/against a given tag", ...
4
null
Implement the Python class `CmdModifiers` described below. Class description: Adds modifiers to objects Usage: @modifiers <object> @modifiers/search <tag name> @modifiers/targetmod <object>=<value>,<tag name>,check @modifiers/usermod <object>=<value>,<tag name>,check Sets modifiers for the most common usages - an obje...
Implement the Python class `CmdModifiers` described below. Class description: Adds modifiers to objects Usage: @modifiers <object> @modifiers/search <tag name> @modifiers/targetmod <object>=<value>,<tag name>,check @modifiers/usermod <object>=<value>,<tag name>,check Sets modifiers for the most common usages - an obje...
363a1f14fd1a640580a4bf4486a1afe776757557
<|skeleton|> class CmdModifiers: """Adds modifiers to objects Usage: @modifiers <object> @modifiers/search <tag name> @modifiers/targetmod <object>=<value>,<tag name>,check @modifiers/usermod <object>=<value>,<tag name>,check Sets modifiers for the most common usages - an object providing a bonus against those with...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CmdModifiers: """Adds modifiers to objects Usage: @modifiers <object> @modifiers/search <tag name> @modifiers/targetmod <object>=<value>,<tag name>,check @modifiers/usermod <object>=<value>,<tag name>,check Sets modifiers for the most common usages - an object providing a bonus against those with a particular...
the_stack_v2_python_sparse
world/conditions/condition_commands.py
Arx-Game/arxcode
train
52
ba8f4b5e2c67d01c55534a2a6b80d56f284e47c6
[ "self.capacity = capacity\nself.valueDict = {}\nself.countDict = {}\nself.frequencyDict = {}\nself.frequencyDict[1] = OrderedDict()\nself.min = -1", "if key not in self.valueDict:\n return -1\ncount = self.countDict[key]\nself.countDict[key] = count + 1\ndel self.frequencyDict[count][key]\nif count == self.min...
<|body_start_0|> self.capacity = capacity self.valueDict = {} self.countDict = {} self.frequencyDict = {} self.frequencyDict[1] = OrderedDict() self.min = -1 <|end_body_0|> <|body_start_1|> if key not in self.valueDict: return -1 count = self....
LFUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_033967
3,706
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: void", "name": "pu...
3
null
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void <|sk...
7a459e9742958e63be8886874904e5ab2489411a
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LFUCache: def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.valueDict = {} self.countDict = {} self.frequencyDict = {} self.frequencyDict[1] = OrderedDict() self.min = -1 def get(self, key): """:type key: ...
the_stack_v2_python_sparse
Hard/460.py
Hellofafar/Leetcode
train
6
0c7b1cfbf2e1d5472abbfe9ae038b643e0d875b3
[ "cnt, stack = (0, [])\nfor c in s:\n if 0 == len(stack) or stack[-1] == c:\n stack.append(c)\n else:\n stack.pop()\n if 0 == len(stack):\n cnt += 1\nreturn cnt", "lc, rc, cnt = (0, 0, 0)\nfor c in s:\n if c == 'L':\n lc += 1\n elif c == 'R':\n rc += 1\n if lc =...
<|body_start_0|> cnt, stack = (0, []) for c in s: if 0 == len(stack) or stack[-1] == c: stack.append(c) else: stack.pop() if 0 == len(stack): cnt += 1 return cnt <|end_body_0|> <|body_start_1|> lc, rc, c...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def balancedStringSplit0(self, s): """:type s: str :rtype: int""" <|body_0|> def balancedStringSplit(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> cnt, stack = (0, []) for c in s: ...
stack_v2_sparse_classes_36k_train_033968
1,184
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "balancedStringSplit0", "signature": "def balancedStringSplit0(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "balancedStringSplit", "signature": "def balancedStringSplit(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_005703
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def balancedStringSplit0(self, s): :type s: str :rtype: int - def balancedStringSplit(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def balancedStringSplit0(self, s): :type s: str :rtype: int - def balancedStringSplit(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def balancedStringSpli...
5376dd48b1cefb4faba9d2ef6a8a497b6b1d6c67
<|skeleton|> class Solution: def balancedStringSplit0(self, s): """:type s: str :rtype: int""" <|body_0|> def balancedStringSplit(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def balancedStringSplit0(self, s): """:type s: str :rtype: int""" cnt, stack = (0, []) for c in s: if 0 == len(stack) or stack[-1] == c: stack.append(c) else: stack.pop() if 0 == len(stack): c...
the_stack_v2_python_sparse
python/problem-stack-and-queue/split_a_string_in_balanced_strings.py
hyunjun/practice
train
3
5f149ca45fd6be17ab8a68c8f981ecd76e593a9c
[ "try:\n error = response.json()['error']\n self._message = error['message']\n self.code = error['code']\n self.type = error['type']\nexcept:\n self._message = response.reason\n self.code = response.status_code\n self.type = PINN_ERROR_CODE_MAP[response.status_code]\nsuper(PinnError, self).__ini...
<|body_start_0|> try: error = response.json()['error'] self._message = error['message'] self.code = error['code'] self.type = error['type'] except: self._message = response.reason self.code = response.status_code self.ty...
Base exception class for a Pinn API Error.
PinnError
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PinnError: """Base exception class for a Pinn API Error.""" def __init__(self, response): """Create a PinnError object with a response dictionary object.""" <|body_0|> def from_response(response): """Create an error of the right PinnError subclass from an API res...
stack_v2_sparse_classes_36k_train_033969
4,553
permissive
[ { "docstring": "Create a PinnError object with a response dictionary object.", "name": "__init__", "signature": "def __init__(self, response)" }, { "docstring": "Create an error of the right PinnError subclass from an API response.", "name": "from_response", "signature": "def from_respon...
2
stack_v2_sparse_classes_30k_train_004391
Implement the Python class `PinnError` described below. Class description: Base exception class for a Pinn API Error. Method signatures and docstrings: - def __init__(self, response): Create a PinnError object with a response dictionary object. - def from_response(response): Create an error of the right PinnError sub...
Implement the Python class `PinnError` described below. Class description: Base exception class for a Pinn API Error. Method signatures and docstrings: - def __init__(self, response): Create a PinnError object with a response dictionary object. - def from_response(response): Create an error of the right PinnError sub...
d7d3f2d2a4cdc3eb01ae85a117c0e3d8bc1732bd
<|skeleton|> class PinnError: """Base exception class for a Pinn API Error.""" def __init__(self, response): """Create a PinnError object with a response dictionary object.""" <|body_0|> def from_response(response): """Create an error of the right PinnError subclass from an API res...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PinnError: """Base exception class for a Pinn API Error.""" def __init__(self, response): """Create a PinnError object with a response dictionary object.""" try: error = response.json()['error'] self._message = error['message'] self.code = error['code']...
the_stack_v2_python_sparse
pinn/errors.py
pinntech/pinn-python
train
2
64b7c7f0da2ad9311d1e4b7d4250557d71de380b
[ "can_edit_player(player_id)\ntickets = g.db.query(Ticket).filter(Ticket.player_id == player_id, Ticket.used_date == None)\nret = [add_ticket_links(t) for t in tickets]\nreturn ret", "args = request.json\nissuer_id = args.get('issuer_id')\nticket_type = args.get('ticket_type')\ndetails = args.get('details')\nexter...
<|body_start_0|> can_edit_player(player_id) tickets = g.db.query(Ticket).filter(Ticket.player_id == player_id, Ticket.used_date == None) ret = [add_ticket_links(t) for t in tickets] return ret <|end_body_0|> <|body_start_1|> args = request.json issuer_id = args.get('issu...
TicketsEndpoint
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TicketsEndpoint: def get(self, player_id): """Get a list of outstanding tickets for the player""" <|body_0|> def post(self, player_id): """Create a ticket for a player. Only available to services""" <|body_1|> <|end_skeleton|> <|body_start_0|> can_e...
stack_v2_sparse_classes_36k_train_033970
4,333
permissive
[ { "docstring": "Get a list of outstanding tickets for the player", "name": "get", "signature": "def get(self, player_id)" }, { "docstring": "Create a ticket for a player. Only available to services", "name": "post", "signature": "def post(self, player_id)" } ]
2
stack_v2_sparse_classes_30k_train_020955
Implement the Python class `TicketsEndpoint` described below. Class description: Implement the TicketsEndpoint class. Method signatures and docstrings: - def get(self, player_id): Get a list of outstanding tickets for the player - def post(self, player_id): Create a ticket for a player. Only available to services
Implement the Python class `TicketsEndpoint` described below. Class description: Implement the TicketsEndpoint class. Method signatures and docstrings: - def get(self, player_id): Get a list of outstanding tickets for the player - def post(self, player_id): Create a ticket for a player. Only available to services <|...
58439d9398006616bbf438da6c5dbe7c32e7a379
<|skeleton|> class TicketsEndpoint: def get(self, player_id): """Get a list of outstanding tickets for the player""" <|body_0|> def post(self, player_id): """Create a ticket for a player. Only available to services""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TicketsEndpoint: def get(self, player_id): """Get a list of outstanding tickets for the player""" can_edit_player(player_id) tickets = g.db.query(Ticket).filter(Ticket.player_id == player_id, Ticket.used_date == None) ret = [add_ticket_links(t) for t in tickets] return ...
the_stack_v2_python_sparse
driftbase/players/tickets/endpoints.py
1939Games/drift-base
train
0
af45545786eaefc38599295785f64e4a9214a561
[ "self.total = total\nself.calls = 1\nself.progress = 0.0\nsys.stdout.write('Progress | ' + ' ' * 50 + ' |' + '0.0% ')\nself.init_time = time.time()", "self.progress = self.calls / float(self.total) * 100\neta, vel = self.compute_eta()\nself.show_progress(eta, vel)\nself.calls += 1", "end_time = time.time()\nite...
<|body_start_0|> self.total = total self.calls = 1 self.progress = 0.0 sys.stdout.write('Progress | ' + ' ' * 50 + ' |' + '0.0% ') self.init_time = time.time() <|end_body_0|> <|body_start_1|> self.progress = self.calls / float(self.total) * 100 eta, vel = self.co...
Print progress bar in console.
ProgressBar
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProgressBar: """Print progress bar in console.""" def __init__(self, total): """Create a bar. :param int total: number of iterations""" <|body_0|> def __call__(self): """Update bar.""" <|body_1|> def compute_eta(self): """Compute ETA. Compare...
stack_v2_sparse_classes_36k_train_033971
8,762
permissive
[ { "docstring": "Create a bar. :param int total: number of iterations", "name": "__init__", "signature": "def __init__(self, total)" }, { "docstring": "Update bar.", "name": "__call__", "signature": "def __call__(self)" }, { "docstring": "Compute ETA. Compare current time with ini...
4
stack_v2_sparse_classes_30k_train_016900
Implement the Python class `ProgressBar` described below. Class description: Print progress bar in console. Method signatures and docstrings: - def __init__(self, total): Create a bar. :param int total: number of iterations - def __call__(self): Update bar. - def compute_eta(self): Compute ETA. Compare current time w...
Implement the Python class `ProgressBar` described below. Class description: Print progress bar in console. Method signatures and docstrings: - def __init__(self, total): Create a bar. :param int total: number of iterations - def __call__(self): Update bar. - def compute_eta(self): Compute ETA. Compare current time w...
559e1c4574865694e47f52bb202c560fc6252d2d
<|skeleton|> class ProgressBar: """Print progress bar in console.""" def __init__(self, total): """Create a bar. :param int total: number of iterations""" <|body_0|> def __call__(self): """Update bar.""" <|body_1|> def compute_eta(self): """Compute ETA. Compare...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProgressBar: """Print progress bar in console.""" def __init__(self, total): """Create a bar. :param int total: number of iterations""" self.total = total self.calls = 1 self.progress = 0.0 sys.stdout.write('Progress | ' + ' ' * 50 + ' |' + '0.0% ') self.in...
the_stack_v2_python_sparse
batman/misc/misc.py
tupui/batman
train
2
4c672518cb3a862842e2fa52f46c34befbc17dd8
[ "buildflags = OrderedDict()\nif NBURN is not None:\n buildflags['NBURN'] = str(NBURN)\nif JMZ is not None:\n buildflags['JMZ'] = str(JMZ)\nif FULDAT is not None:\n buildflags['FULDAT'] = FULDAT\nif NAME is not None:\n buildflags['NAME'] = NAME\nself.buildflags = buildflags\nself.makeflags = [f'{k}={v}' ...
<|body_start_0|> buildflags = OrderedDict() if NBURN is not None: buildflags['NBURN'] = str(NBURN) if JMZ is not None: buildflags['JMZ'] = str(JMZ) if FULDAT is not None: buildflags['FULDAT'] = FULDAT if NAME is not None: buildflags...
_BuildKepler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _BuildKepler: def __init__(self, NBURN=None, JMZ=None, FULDAT=None, NAME=None, machine='CPU', hashing=False, update=True): """Note - all initilisation needed is done in class definition for now. Maybe that should go here instead ...""" <|body_0|> def build_library_check(self...
stack_v2_sparse_classes_36k_train_033972
4,916
permissive
[ { "docstring": "Note - all initilisation needed is done in class definition for now. Maybe that should go here instead ...", "name": "__init__", "signature": "def __init__(self, NBURN=None, JMZ=None, FULDAT=None, NAME=None, machine='CPU', hashing=False, update=True)" }, { "docstring": "check whe...
2
stack_v2_sparse_classes_30k_train_009691
Implement the Python class `_BuildKepler` described below. Class description: Implement the _BuildKepler class. Method signatures and docstrings: - def __init__(self, NBURN=None, JMZ=None, FULDAT=None, NAME=None, machine='CPU', hashing=False, update=True): Note - all initilisation needed is done in class definition f...
Implement the Python class `_BuildKepler` described below. Class description: Implement the _BuildKepler class. Method signatures and docstrings: - def __init__(self, NBURN=None, JMZ=None, FULDAT=None, NAME=None, machine='CPU', hashing=False, update=True): Note - all initilisation needed is done in class definition f...
98fc181bab054619d12ffa4173ad5c469803c2ec
<|skeleton|> class _BuildKepler: def __init__(self, NBURN=None, JMZ=None, FULDAT=None, NAME=None, machine='CPU', hashing=False, update=True): """Note - all initilisation needed is done in class definition for now. Maybe that should go here instead ...""" <|body_0|> def build_library_check(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _BuildKepler: def __init__(self, NBURN=None, JMZ=None, FULDAT=None, NAME=None, machine='CPU', hashing=False, update=True): """Note - all initilisation needed is done in class definition for now. Maybe that should go here instead ...""" buildflags = OrderedDict() if NBURN is not None: ...
the_stack_v2_python_sparse
kepler_python_packages/python_scripts/kepler/code/_build.py
adam-m-jcbs/xrb-sens-datashare
train
1
56d363c33e789c88e75e1dff26f8d4144e547fbe
[ "self.check_parameters(params)\ncos = np.cos(params[0] / 2)\nsin = -1j * np.sin(params[0] / 2)\nreturn UnitaryMatrix([[cos, 0, 0, sin], [0, cos, sin, 0], [0, sin, cos, 0], [sin, 0, 0, cos]])", "self.check_parameters(params)\ndcos = -np.sin(params[0] / 2) / 2\ndsin = -1j * np.cos(params[0] / 2) / 2\nreturn np.arra...
<|body_start_0|> self.check_parameters(params) cos = np.cos(params[0] / 2) sin = -1j * np.sin(params[0] / 2) return UnitaryMatrix([[cos, 0, 0, sin], [0, cos, sin, 0], [0, sin, cos, 0], [sin, 0, 0, cos]]) <|end_body_0|> <|body_start_1|> self.check_parameters(params) dcos ...
A gate representing an arbitrary rotation around the XX axis.
RXXGate
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RXXGate: """A gate representing an arbitrary rotation around the XX axis.""" def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix: """Returns the unitary for this gate, see Unitary for more info.""" <|body_0|> def get_grad(self, params: Sequence[float]=[]) ...
stack_v2_sparse_classes_36k_train_033973
2,165
permissive
[ { "docstring": "Returns the unitary for this gate, see Unitary for more info.", "name": "get_unitary", "signature": "def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix" }, { "docstring": "Returns the gradient for this gate, see Gate for more info.", "name": "get_grad", "s...
3
stack_v2_sparse_classes_30k_train_013232
Implement the Python class `RXXGate` described below. Class description: A gate representing an arbitrary rotation around the XX axis. Method signatures and docstrings: - def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix: Returns the unitary for this gate, see Unitary for more info. - def get_grad(se...
Implement the Python class `RXXGate` described below. Class description: A gate representing an arbitrary rotation around the XX axis. Method signatures and docstrings: - def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix: Returns the unitary for this gate, see Unitary for more info. - def get_grad(se...
3083218c2f4e3c3ce4ba027d12caa30c384d7665
<|skeleton|> class RXXGate: """A gate representing an arbitrary rotation around the XX axis.""" def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix: """Returns the unitary for this gate, see Unitary for more info.""" <|body_0|> def get_grad(self, params: Sequence[float]=[]) ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RXXGate: """A gate representing an arbitrary rotation around the XX axis.""" def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix: """Returns the unitary for this gate, see Unitary for more info.""" self.check_parameters(params) cos = np.cos(params[0] / 2) si...
the_stack_v2_python_sparse
bqskit/ir/gates/parameterized/rxx.py
mtreinish/bqskit
train
0
ad51420c82fd88cfa1a906cea7ecd3984e2feec8
[ "attr = handler_input.attributes_manager.session_attributes\nplayers_dict = attr.get('players_dict', {})\nif player_name in players_dict.keys():\n logger.warning('create_new_player: Player already found.')\n return\nnew_player = Player(player_name)\nnew_player_dict = PlayerEncoder.encode_player_to_dict(new_pl...
<|body_start_0|> attr = handler_input.attributes_manager.session_attributes players_dict = attr.get('players_dict', {}) if player_name in players_dict.keys(): logger.warning('create_new_player: Player already found.') return new_player = Player(player_name) ...
Methods for accessing player class through session attributes.
PlayerDict
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlayerDict: """Methods for accessing player class through session attributes.""" def create_new_player(handler_input, player_name: str) -> None: """Creates new player and adds it to the players_dict""" <|body_0|> def load_player_obj(handler_input) -> object: """L...
stack_v2_sparse_classes_36k_train_033974
2,835
permissive
[ { "docstring": "Creates new player and adds it to the players_dict", "name": "create_new_player", "signature": "def create_new_player(handler_input, player_name: str) -> None" }, { "docstring": "Loads player object from players_dict", "name": "load_player_obj", "signature": "def load_pla...
3
null
Implement the Python class `PlayerDict` described below. Class description: Methods for accessing player class through session attributes. Method signatures and docstrings: - def create_new_player(handler_input, player_name: str) -> None: Creates new player and adds it to the players_dict - def load_player_obj(handle...
Implement the Python class `PlayerDict` described below. Class description: Methods for accessing player class through session attributes. Method signatures and docstrings: - def create_new_player(handler_input, player_name: str) -> None: Creates new player and adds it to the players_dict - def load_player_obj(handle...
1072dea1a5be0b339211ff39db6a89a90aca64c1
<|skeleton|> class PlayerDict: """Methods for accessing player class through session attributes.""" def create_new_player(handler_input, player_name: str) -> None: """Creates new player and adds it to the players_dict""" <|body_0|> def load_player_obj(handler_input) -> object: """L...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlayerDict: """Methods for accessing player class through session attributes.""" def create_new_player(handler_input, player_name: str) -> None: """Creates new player and adds it to the players_dict""" attr = handler_input.attributes_manager.session_attributes players_dict = attr....
the_stack_v2_python_sparse
1_code/players/players_dict.py
jaimiles23/Multiplication-Medley
train
0
694980c435f450e71bb63c29850a61355cef16a7
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
EvalDispatcherServicer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EvalDispatcherServicer: """Missing associated documentation comment in .proto file.""" def TakeEvalJob(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def SubmitEvalJobResult(self, request, context): """Missing a...
stack_v2_sparse_classes_36k_train_033975
4,546
permissive
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "TakeEvalJob", "signature": "def TakeEvalJob(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "SubmitEvalJobResult", "signature": "def SubmitEv...
2
stack_v2_sparse_classes_30k_train_005135
Implement the Python class `EvalDispatcherServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def TakeEvalJob(self, request, context): Missing associated documentation comment in .proto file. - def SubmitEvalJobResult(self, request...
Implement the Python class `EvalDispatcherServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def TakeEvalJob(self, request, context): Missing associated documentation comment in .proto file. - def SubmitEvalJobResult(self, request...
1ddd92aa56ba10fa468396de8f8824c83ba9d0ba
<|skeleton|> class EvalDispatcherServicer: """Missing associated documentation comment in .proto file.""" def TakeEvalJob(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def SubmitEvalJobResult(self, request, context): """Missing a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EvalDispatcherServicer: """Missing associated documentation comment in .proto file.""" def TakeEvalJob(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemente...
the_stack_v2_python_sparse
grl/algos/p2sro/eval_dispatcher/protobuf/eval_dispatcher_pb2_grpc.py
RL-code-lib/nxdo
train
0
e753452d7460b808bf887b7d8cf0a4474f68da9b
[ "super(PowerOn, self).__init__()\nself.switches = switches\nreturn", "self.turn_all_off()\nparams = parameters.id_switch.parameters\nself.logger.info(\"Turning on {0} (switch '{1}')\".format(params.identifier, params.switch))\nself.switches[params.identifier](params.switch)\nreturn '{0}'.format(params.identifier)...
<|body_start_0|> super(PowerOn, self).__init__() self.switches = switches return <|end_body_0|> <|body_start_1|> self.turn_all_off() params = parameters.id_switch.parameters self.logger.info("Turning on {0} (switch '{1}')".format(params.identifier, params.switch)) ...
A class to power-on a networked-switch
PowerOn
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PowerOn: """A class to power-on a networked-switch""" def __init__(self, switches): """:param: - `switches`: A dictionary of identifiers:switches""" <|body_0|> def __call__(self, parameters): """:param: - `parameters`: namedtuple with parameters.id_switch.paramet...
stack_v2_sparse_classes_36k_train_033976
1,138
permissive
[ { "docstring": ":param: - `switches`: A dictionary of identifiers:switches", "name": "__init__", "signature": "def __init__(self, switches)" }, { "docstring": ":param: - `parameters`: namedtuple with parameters.id_switch.parameters", "name": "__call__", "signature": "def __call__(self, p...
3
null
Implement the Python class `PowerOn` described below. Class description: A class to power-on a networked-switch Method signatures and docstrings: - def __init__(self, switches): :param: - `switches`: A dictionary of identifiers:switches - def __call__(self, parameters): :param: - `parameters`: namedtuple with paramet...
Implement the Python class `PowerOn` described below. Class description: A class to power-on a networked-switch Method signatures and docstrings: - def __init__(self, switches): :param: - `switches`: A dictionary of identifiers:switches - def __call__(self, parameters): :param: - `parameters`: namedtuple with paramet...
b4d1c77e1d611fe2b30768b42bdc7493afb0ea95
<|skeleton|> class PowerOn: """A class to power-on a networked-switch""" def __init__(self, switches): """:param: - `switches`: A dictionary of identifiers:switches""" <|body_0|> def __call__(self, parameters): """:param: - `parameters`: namedtuple with parameters.id_switch.paramet...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PowerOn: """A class to power-on a networked-switch""" def __init__(self, switches): """:param: - `switches`: A dictionary of identifiers:switches""" super(PowerOn, self).__init__() self.switches = switches return def __call__(self, parameters): """:param: - `p...
the_stack_v2_python_sparse
apetools/commands/poweron.py
russell-n/oldape
train
0
2037e7c5693e1c0d3a05ed9229553eb3c3cd4a81
[ "re_string = re.compile('[a-zA-Z0-9]')\nline = ''.join(re_string.findall(s)).lower()\nlenth = len(line)\nfor i in range(lenth // 2):\n if line[i] != line[lenth - i - 1]:\n print(line[i], i)\n return False\nreturn True", "s = s.lower()\ncharacter = 'abcdefghijklmnopqrstuvwxyz0123456789'\nl = []\nf...
<|body_start_0|> re_string = re.compile('[a-zA-Z0-9]') line = ''.join(re_string.findall(s)).lower() lenth = len(line) for i in range(lenth // 2): if line[i] != line[lenth - i - 1]: print(line[i], i) return False return True <|end_body_0...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, s): """:type s: str :rtype: bool""" <|body_0|> def other_isPalindrome(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> re_string = re.compile('[a-zA-Z0-9]') line = ''.joi...
stack_v2_sparse_classes_36k_train_033977
1,062
no_license
[ { "docstring": ":type s: str :rtype: bool", "name": "isPalindrome", "signature": "def isPalindrome(self, s)" }, { "docstring": ":type s: str :rtype: bool", "name": "other_isPalindrome", "signature": "def other_isPalindrome(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_002796
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, s): :type s: str :rtype: bool - def other_isPalindrome(self, s): :type s: str :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, s): :type s: str :rtype: bool - def other_isPalindrome(self, s): :type s: str :rtype: bool <|skeleton|> class Solution: def isPalindrome(self, s): ...
d156c6a13c89727f80ed6244cae40574395ecf34
<|skeleton|> class Solution: def isPalindrome(self, s): """:type s: str :rtype: bool""" <|body_0|> def other_isPalindrome(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isPalindrome(self, s): """:type s: str :rtype: bool""" re_string = re.compile('[a-zA-Z0-9]') line = ''.join(re_string.findall(s)).lower() lenth = len(line) for i in range(lenth // 2): if line[i] != line[lenth - i - 1]: print(lin...
the_stack_v2_python_sparse
easy/125.py
longhao54/leetcode
train
0
83eb9591ec43bd8df783ead499a14763e9402da8
[ "def build(i1, i2, j1, j2):\n if i1 == i2 and j1 == j2:\n return Node(grid[i1][j1], True, None, None, None, None)\n im = i1 + (i2 - i1) // 2\n jm = j1 + (j2 - j1) // 2\n lt = build(i1, im, j1, jm)\n lb = build(im + 1, i2, j1, jm)\n rt = build(i1, im, jm + 1, j2)\n rb = build(im + 1, i2, ...
<|body_start_0|> def build(i1, i2, j1, j2): if i1 == i2 and j1 == j2: return Node(grid[i1][j1], True, None, None, None, None) im = i1 + (i2 - i1) // 2 jm = j1 + (j2 - j1) // 2 lt = build(i1, im, j1, jm) lb = build(im + 1, i2, j1, jm) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def construct(self, grid: List[List[int]]) -> 'Node': """Apr 28, 2020 22:55""" <|body_0|> def construct(self, grid: List[List[int]]) -> 'Node': """Apr 02, 2023 15:21""" <|body_1|> <|end_skeleton|> <|body_start_0|> def build(i1, i2, j1, j2)...
stack_v2_sparse_classes_36k_train_033978
5,878
no_license
[ { "docstring": "Apr 28, 2020 22:55", "name": "construct", "signature": "def construct(self, grid: List[List[int]]) -> 'Node'" }, { "docstring": "Apr 02, 2023 15:21", "name": "construct", "signature": "def construct(self, grid: List[List[int]]) -> 'Node'" } ]
2
stack_v2_sparse_classes_30k_train_008269
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def construct(self, grid: List[List[int]]) -> 'Node': Apr 28, 2020 22:55 - def construct(self, grid: List[List[int]]) -> 'Node': Apr 02, 2023 15:21
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def construct(self, grid: List[List[int]]) -> 'Node': Apr 28, 2020 22:55 - def construct(self, grid: List[List[int]]) -> 'Node': Apr 02, 2023 15:21 <|skeleton|> class Solution: ...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def construct(self, grid: List[List[int]]) -> 'Node': """Apr 28, 2020 22:55""" <|body_0|> def construct(self, grid: List[List[int]]) -> 'Node': """Apr 02, 2023 15:21""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def construct(self, grid: List[List[int]]) -> 'Node': """Apr 28, 2020 22:55""" def build(i1, i2, j1, j2): if i1 == i2 and j1 == j2: return Node(grid[i1][j1], True, None, None, None, None) im = i1 + (i2 - i1) // 2 jm = j1 + (j2 - j1)...
the_stack_v2_python_sparse
leetcode/solved/772_Construct_Quad_Tree/solution.py
sungminoh/algorithms
train
0
5730b3d0651858fa7d349af2c34395ade286145a
[ "self.s = []\n\ndef dfs_visit(root):\n if not root:\n self.s.append('null')\n return\n self.s.append(root.val)\n dfs_visit(root.left)\n dfs_visit(root.right)\ndfs_visit(root)\nprint(self.s)\nstrs = ''\nfor i in self.s:\n strs += str(i) + ','\nreturn strs[:-1]", "s = data.split(',')\ns...
<|body_start_0|> self.s = [] def dfs_visit(root): if not root: self.s.append('null') return self.s.append(root.val) dfs_visit(root.left) dfs_visit(root.right) dfs_visit(root) print(self.s) strs = '' ...
199ms
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: """199ms""" 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_ske...
stack_v2_sparse_classes_36k_train_033979
3,990
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_012630
Implement the Python class `Codec` described below. Class description: 199ms 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: TreeNode
Implement the Python class `Codec` described below. Class description: 199ms 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: TreeNode <|skeleton...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Codec: """199ms""" 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_ske...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: """199ms""" def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" self.s = [] def dfs_visit(root): if not root: self.s.append('null') return self.s.append(root.val) ...
the_stack_v2_python_sparse
SerializeAndDeserializeBinaryTree_HARD_297.py
953250587/leetcode-python
train
2
635c6cf359ae76df657825622c906038cf48c194
[ "if self.field:\n return f'Top results for \"{self.field:s}\"'\nreturn 'Top results for an unknown field'", "self.field = field\nformatted_field_name = self.format_field_by_type(field)\nencoding = {'x': {'field': field, 'type': 'nominal', 'sort': {'op': 'sum', 'field': order_field, 'order': 'descending'}}, 'y'...
<|body_start_0|> if self.field: return f'Top results for "{self.field:s}"' return 'Top results for an unknown field' <|end_body_0|> <|body_start_1|> self.field = field formatted_field_name = self.format_field_by_type(field) encoding = {'x': {'field': field, 'type': '...
Terms Bucket Aggregation.
TermsAggregation
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TermsAggregation: """Terms Bucket Aggregation.""" def chart_title(self): """Returns a title for the chart.""" <|body_0|> def run(self, field, limit=10, supported_charts='table', start_time='', end_time='', order_field='count'): """Run the aggregation. Args: field...
stack_v2_sparse_classes_36k_train_033980
5,187
permissive
[ { "docstring": "Returns a title for the chart.", "name": "chart_title", "signature": "def chart_title(self)" }, { "docstring": "Run the aggregation. Args: field: What field to aggregate on. limit: How many buckets to return. supported_charts: Chart type to render. Defaults to table. start_time: ...
2
stack_v2_sparse_classes_30k_train_013886
Implement the Python class `TermsAggregation` described below. Class description: Terms Bucket Aggregation. Method signatures and docstrings: - def chart_title(self): Returns a title for the chart. - def run(self, field, limit=10, supported_charts='table', start_time='', end_time='', order_field='count'): Run the agg...
Implement the Python class `TermsAggregation` described below. Class description: Terms Bucket Aggregation. Method signatures and docstrings: - def chart_title(self): Returns a title for the chart. - def run(self, field, limit=10, supported_charts='table', start_time='', end_time='', order_field='count'): Run the agg...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class TermsAggregation: """Terms Bucket Aggregation.""" def chart_title(self): """Returns a title for the chart.""" <|body_0|> def run(self, field, limit=10, supported_charts='table', start_time='', end_time='', order_field='count'): """Run the aggregation. Args: field...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TermsAggregation: """Terms Bucket Aggregation.""" def chart_title(self): """Returns a title for the chart.""" if self.field: return f'Top results for "{self.field:s}"' return 'Top results for an unknown field' def run(self, field, limit=10, supported_charts='table...
the_stack_v2_python_sparse
timesketch/lib/aggregators/bucket.py
google/timesketch
train
2,263
d58f1f7d19152545a554fea724914d35321128bd
[ "self.screen_width = 1000\nself.screen_height = 680\nself.bg_color = (230, 230, 230)\nself.ship_speed_factor = 1.5\nself.ship_limit = 3\nself.bullet_speed_factor = 3\nself.bullet_width = 3\nself.bullet_height = 15\nself.bullet_color = (60, 60, 60)\nself.bullet_allowed = 3\nself.alien_speed_factor = 1\nself.fleet_dr...
<|body_start_0|> self.screen_width = 1000 self.screen_height = 680 self.bg_color = (230, 230, 230) self.ship_speed_factor = 1.5 self.ship_limit = 3 self.bullet_speed_factor = 3 self.bullet_width = 3 self.bullet_height = 15 self.bullet_color = (60, ...
A Class to store all settings for Alien Invasion
Settings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Settings: """A Class to store all settings for Alien Invasion""" def __init__(self): """Initialize the game setting's""" <|body_0|> def initialize_dynamic_setting(self): """Initialize setting that change throughout the game""" <|body_1|> def increase...
stack_v2_sparse_classes_36k_train_033981
1,505
no_license
[ { "docstring": "Initialize the game setting's", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Initialize setting that change throughout the game", "name": "initialize_dynamic_setting", "signature": "def initialize_dynamic_setting(self)" }, { "docstring"...
3
stack_v2_sparse_classes_30k_train_010955
Implement the Python class `Settings` described below. Class description: A Class to store all settings for Alien Invasion Method signatures and docstrings: - def __init__(self): Initialize the game setting's - def initialize_dynamic_setting(self): Initialize setting that change throughout the game - def increase_spe...
Implement the Python class `Settings` described below. Class description: A Class to store all settings for Alien Invasion Method signatures and docstrings: - def __init__(self): Initialize the game setting's - def initialize_dynamic_setting(self): Initialize setting that change throughout the game - def increase_spe...
e85198ab8b95abbe43e9c9bde44661525bca8977
<|skeleton|> class Settings: """A Class to store all settings for Alien Invasion""" def __init__(self): """Initialize the game setting's""" <|body_0|> def initialize_dynamic_setting(self): """Initialize setting that change throughout the game""" <|body_1|> def increase...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Settings: """A Class to store all settings for Alien Invasion""" def __init__(self): """Initialize the game setting's""" self.screen_width = 1000 self.screen_height = 680 self.bg_color = (230, 230, 230) self.ship_speed_factor = 1.5 self.ship_limit = 3 ...
the_stack_v2_python_sparse
pygame/settings.py
pratikv06/Python-Crash-Course
train
2
92e65c8717bff0abe3e07d54aab2fa8ea88cf683
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn SolutionsRoot()", "from .booking_business import BookingBusiness\nfrom .booking_currency import BookingCurrency\nfrom .booking_business import BookingBusiness\nfrom .booking_currency import BookingCurrency\nfields: Dict[str, Callable[[...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return SolutionsRoot() <|end_body_0|> <|body_start_1|> from .booking_business import BookingBusiness from .booking_currency import BookingCurrency from .booking_business import BookingB...
SolutionsRoot
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SolutionsRoot: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SolutionsRoot: """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...
stack_v2_sparse_classes_36k_train_033982
3,222
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: SolutionsRoot", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value...
3
stack_v2_sparse_classes_30k_train_011329
Implement the Python class `SolutionsRoot` described below. Class description: Implement the SolutionsRoot class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SolutionsRoot: Creates a new instance of the appropriate class based on discriminator value...
Implement the Python class `SolutionsRoot` described below. Class description: Implement the SolutionsRoot class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SolutionsRoot: Creates a new instance of the appropriate class based on discriminator value...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class SolutionsRoot: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SolutionsRoot: """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...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SolutionsRoot: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SolutionsRoot: """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: SolutionsRoo...
the_stack_v2_python_sparse
msgraph/generated/models/solutions_root.py
microsoftgraph/msgraph-sdk-python
train
135
a2b905b763f9dd3a2e43cef49d236e2cecebff0d
[ "def strfy(node):\n if node is None:\n return ''\n left_string = strfy(node.left)\n right_string = strfy(node.right)\n return str(node.val) + '$' + left_string + right_string\nres = strfy(root)\nreturn res", "def tree(lst):\n if not lst:\n return None\n node = TreeNode(lst[0])\n ...
<|body_start_0|> def strfy(node): if node is None: return '' left_string = strfy(node.left) right_string = strfy(node.right) return str(node.val) + '$' + left_string + right_string res = strfy(root) return res <|end_body_0|> <|body...
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 e.g.: 7$2$5$9$8$10$""" <|body_1|> <|end...
stack_v2_sparse_classes_36k_train_033983
2,353
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode e.g.: 7$2$5$9$8$10$", "name": "deserialize", "signatu...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
f96a2273c6831a8035e1adacfa452f73c599ae16
<|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 e.g.: 7$2$5$9$8$10$""" <|body_1|> <|end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def strfy(node): if node is None: return '' left_string = strfy(node.left) right_string = strfy(node.right) return str(nod...
the_stack_v2_python_sparse
Python/449_SerializeandDeserializeBST.py
here0009/LeetCode
train
1
cabc1ded6accc5b6360ff2b10def6e2d30ac7e4d
[ "super(PixelSelector, self).__init__()\nassert momentManager.kernelWidth == calMomentManager.kernelWidth\nself.keys = copy.copy(MomentManager.keys)\nself.momentManager = momentManager\nself.calMomentManager = calMomentManager", "if limit.name not in self.keys:\n raise ValueError('Limit name must be in:' + str(...
<|body_start_0|> super(PixelSelector, self).__init__() assert momentManager.kernelWidth == calMomentManager.kernelWidth self.keys = copy.copy(MomentManager.keys) self.momentManager = momentManager self.calMomentManager = calMomentManager <|end_body_0|> <|body_start_1|> i...
A simple pixel selector. Inherit from a list, and we'll contain a list of our MomentLimit objects. We'll go through our list, and any pixels which are numerically within the limits for all MomentLimit objects "pass" and are kept. In the end, we return a boolean image with True set for accepted pixels.
PixelSelector
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PixelSelector: """A simple pixel selector. Inherit from a list, and we'll contain a list of our MomentLimit objects. We'll go through our list, and any pixels which are numerically within the limits for all MomentLimit objects "pass" and are kept. In the end, we return a boolean image with True s...
stack_v2_sparse_classes_36k_train_033984
11,918
no_license
[ { "docstring": "Construct @param momentManager MomentManager for the image we're selecting from @param calMomentManager The MomentManager for the calibration image.", "name": "__init__", "signature": "def __init__(self, momentManager, calMomentManager)" }, { "docstring": "Overload our parent lis...
4
stack_v2_sparse_classes_30k_train_007882
Implement the Python class `PixelSelector` described below. Class description: A simple pixel selector. Inherit from a list, and we'll contain a list of our MomentLimit objects. We'll go through our list, and any pixels which are numerically within the limits for all MomentLimit objects "pass" and are kept. In the end...
Implement the Python class `PixelSelector` described below. Class description: A simple pixel selector. Inherit from a list, and we'll contain a list of our MomentLimit objects. We'll go through our list, and any pixels which are numerically within the limits for all MomentLimit objects "pass" and are kept. In the end...
f826f98369125b9aa0aa6f7228913a503cea80a4
<|skeleton|> class PixelSelector: """A simple pixel selector. Inherit from a list, and we'll contain a list of our MomentLimit objects. We'll go through our list, and any pixels which are numerically within the limits for all MomentLimit objects "pass" and are kept. In the end, we return a boolean image with True s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PixelSelector: """A simple pixel selector. Inherit from a list, and we'll contain a list of our MomentLimit objects. We'll go through our list, and any pixels which are numerically within the limits for all MomentLimit objects "pass" and are kept. In the end, we return a boolean image with True set for accept...
the_stack_v2_python_sparse
python/lsst/meas/artifact/momentCalculator.py
lsst-dm/meas_artifact
train
3
51159822727d1eef0074618b80366d8c8ae8d915
[ "group = Group.objects.filter(name='teachers')\nusers = User.objects.filter(groups__in=group)\nif obj in users:\n return 'teachers'\nelse:\n return 'students'", "exams = []\nqueryset = ExamSheet.objects.filter(owner=obj)\nfor q in queryset:\n exams.append(q.title)\nreturn exams" ]
<|body_start_0|> group = Group.objects.filter(name='teachers') users = User.objects.filter(groups__in=group) if obj in users: return 'teachers' else: return 'students' <|end_body_0|> <|body_start_1|> exams = [] queryset = ExamSheet.objects.filter(...
UserSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserSerializer: def get_group(self, obj): """Simply returns a groups name to which user belongs""" <|body_0|> def get_owned_exams(self, obj): """Get exams owned by teacher""" <|body_1|> <|end_skeleton|> <|body_start_0|> group = Group.objects.filter(...
stack_v2_sparse_classes_36k_train_033985
3,922
no_license
[ { "docstring": "Simply returns a groups name to which user belongs", "name": "get_group", "signature": "def get_group(self, obj)" }, { "docstring": "Get exams owned by teacher", "name": "get_owned_exams", "signature": "def get_owned_exams(self, obj)" } ]
2
stack_v2_sparse_classes_30k_train_009663
Implement the Python class `UserSerializer` described below. Class description: Implement the UserSerializer class. Method signatures and docstrings: - def get_group(self, obj): Simply returns a groups name to which user belongs - def get_owned_exams(self, obj): Get exams owned by teacher
Implement the Python class `UserSerializer` described below. Class description: Implement the UserSerializer class. Method signatures and docstrings: - def get_group(self, obj): Simply returns a groups name to which user belongs - def get_owned_exams(self, obj): Get exams owned by teacher <|skeleton|> class UserSeri...
2651ac12078c7d5435d1fb23585bb275c974ce30
<|skeleton|> class UserSerializer: def get_group(self, obj): """Simply returns a groups name to which user belongs""" <|body_0|> def get_owned_exams(self, obj): """Get exams owned by teacher""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserSerializer: def get_group(self, obj): """Simply returns a groups name to which user belongs""" group = Group.objects.filter(name='teachers') users = User.objects.filter(groups__in=group) if obj in users: return 'teachers' else: return 'studen...
the_stack_v2_python_sparse
ExamAPI/Sheets/serializers.py
mtyton/ExamSheetEvaluator-API
train
0
1ccc6b3c837d06beaade1866b8bc0760385d92dd
[ "if n > 0:\n sum = x\n for i in range(n - 1):\n sum *= x\nelif n < 0:\n sum = 1 / x\n for i in range(n + 1, 0):\n sum *= 1 / x\nelse:\n sum = 1\nreturn sum", "if not x:\n return 1\nif n < 0:\n return 1 / self.myPow3(x, -n)\nif n % 2:\n return x * self.myPow3(x, n - 1)\nreturn...
<|body_start_0|> if n > 0: sum = x for i in range(n - 1): sum *= x elif n < 0: sum = 1 / x for i in range(n + 1, 0): sum *= 1 / x else: sum = 1 return sum <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def myPow2(self, x: float, n: int) -> float: """暴力. 使用循环。 leetcode说超过时间限制 Args: x: n: Returns:""" <|body_0|> def myPow3(self, x: float, n: int) -> float: """分而治之的方法。 x * x * x = y 1. 如果n的个数是偶数 y = x^(n/2) sum = y * y = (x * x)^(n/2) 2. 如果n的个数是奇数 y = x^(x//2...
stack_v2_sparse_classes_36k_train_033986
1,987
no_license
[ { "docstring": "暴力. 使用循环。 leetcode说超过时间限制 Args: x: n: Returns:", "name": "myPow2", "signature": "def myPow2(self, x: float, n: int) -> float" }, { "docstring": "分而治之的方法。 x * x * x = y 1. 如果n的个数是偶数 y = x^(n/2) sum = y * y = (x * x)^(n/2) 2. 如果n的个数是奇数 y = x^(x//2) sum = y * y * x = x * (x * x)^((n...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def myPow2(self, x: float, n: int) -> float: 暴力. 使用循环。 leetcode说超过时间限制 Args: x: n: Returns: - def myPow3(self, x: float, n: int) -> float: 分而治之的方法。 x * x * x = y 1. 如果n的个数是偶数 y =...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def myPow2(self, x: float, n: int) -> float: 暴力. 使用循环。 leetcode说超过时间限制 Args: x: n: Returns: - def myPow3(self, x: float, n: int) -> float: 分而治之的方法。 x * x * x = y 1. 如果n的个数是偶数 y =...
c0dd577481b46129d950354d567d332a4d091137
<|skeleton|> class Solution: def myPow2(self, x: float, n: int) -> float: """暴力. 使用循环。 leetcode说超过时间限制 Args: x: n: Returns:""" <|body_0|> def myPow3(self, x: float, n: int) -> float: """分而治之的方法。 x * x * x = y 1. 如果n的个数是偶数 y = x^(n/2) sum = y * y = (x * x)^(n/2) 2. 如果n的个数是奇数 y = x^(x//2...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def myPow2(self, x: float, n: int) -> float: """暴力. 使用循环。 leetcode说超过时间限制 Args: x: n: Returns:""" if n > 0: sum = x for i in range(n - 1): sum *= x elif n < 0: sum = 1 / x for i in range(n + 1, 0): ...
the_stack_v2_python_sparse
leetcode/50_POW(x, n).py
tenqaz/crazy_arithmetic
train
0
b7e586d22a41071ddb8e0d4f850c2456c0d7bd9e
[ "if root is None:\n return 'X#'\nleftSerialized = self.serialize(root.left)\nrightSerialized = self.serialize(root.right)\nreturn str(root.val) + '#' + leftSerialized + rightSerialized", "def dfs():\n val = next(data)\n if val == 'X':\n return None\n node = TreeNode(int(val))\n node.left = d...
<|body_start_0|> if root is None: return 'X#' leftSerialized = self.serialize(root.left) rightSerialized = self.serialize(root.right) return str(root.val) + '#' + leftSerialized + rightSerialized <|end_body_0|> <|body_start_1|> def dfs(): val = next(data)...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if root is Non...
stack_v2_sparse_classes_36k_train_033987
2,092
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
480de9be082fdcbcafe68e2cd5fd819dc7815e64
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" if root is None: return 'X#' leftSerialized = self.serialize(root.left) rightSerialized = self.serialize(root.right) return str(root.val) + '#' + leftSerialized + rig...
the_stack_v2_python_sparse
2021_06_28_serialize-and-deserialize-bst.py
trinhgliedt/Algo_Practice
train
1
a45844a171ea713c6917c90a037bc0154aa619e9
[ "if 'email' not in data or data['email'] is '':\n raise MyCustomError(ExceptionType.EmptyField, 'email field should not be empty')\nif 'password' not in data or data['password'] is '':\n raise MyCustomError(ExceptionType.EmptyField, 'password field should not be empty')\nreturn True", "if len(data['email'])...
<|body_start_0|> if 'email' not in data or data['email'] is '': raise MyCustomError(ExceptionType.EmptyField, 'email field should not be empty') if 'password' not in data or data['password'] is '': raise MyCustomError(ExceptionType.EmptyField, 'password field should not be empty'...
Validation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Validation: def validate_data(data: dict) -> object: """it takes data as input and returns boolean value :rtype: boolean""" <|body_0|> def validate_register(data: dict) -> object: """this method takes dictionary data as input and it validates the length of characters...
stack_v2_sparse_classes_36k_train_033988
1,450
no_license
[ { "docstring": "it takes data as input and returns boolean value :rtype: boolean", "name": "validate_data", "signature": "def validate_data(data: dict) -> object" }, { "docstring": "this method takes dictionary data as input and it validates the length of characters :return: True if the data is ...
2
stack_v2_sparse_classes_30k_train_002275
Implement the Python class `Validation` described below. Class description: Implement the Validation class. Method signatures and docstrings: - def validate_data(data: dict) -> object: it takes data as input and returns boolean value :rtype: boolean - def validate_register(data: dict) -> object: this method takes dic...
Implement the Python class `Validation` described below. Class description: Implement the Validation class. Method signatures and docstrings: - def validate_data(data: dict) -> object: it takes data as input and returns boolean value :rtype: boolean - def validate_register(data: dict) -> object: this method takes dic...
ed986626949590841f5fd0f8f2fa12737bfe48a7
<|skeleton|> class Validation: def validate_data(data: dict) -> object: """it takes data as input and returns boolean value :rtype: boolean""" <|body_0|> def validate_register(data: dict) -> object: """this method takes dictionary data as input and it validates the length of characters...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Validation: def validate_data(data: dict) -> object: """it takes data as input and returns boolean value :rtype: boolean""" if 'email' not in data or data['email'] is '': raise MyCustomError(ExceptionType.EmptyField, 'email field should not be empty') if 'password' not in d...
the_stack_v2_python_sparse
fundoo/fundooapp/utils.py
TarunVyda6/FundooNotes
train
0
b53e4603b387644eeccbed8a999ac75b4d1f426b
[ "f = self.dtype_f(self.init)\nself.A.mult(u, f.impl)\nfa1 = self.init.getVecArray(f.impl)\nfa1[0] = 0\nfa1[-1] = 0\nfa2 = self.init.getVecArray(f.expl)\nxa = self.init.getVecArray(u)\nfor i in range(self.xs, self.xe):\n fa2[i] = self.lambda0 ** 2 * xa[i] * (1 - xa[i] ** self.nu)\nfa2[0] = 0\nfa2[-1] = 0\nreturn ...
<|body_start_0|> f = self.dtype_f(self.init) self.A.mult(u, f.impl) fa1 = self.init.getVecArray(f.impl) fa1[0] = 0 fa1[-1] = 0 fa2 = self.init.getVecArray(f.expl) xa = self.init.getVecArray(u) for i in range(self.xs, self.xe): fa2[i] = self.lam...
Problem class implementing the semi-implicit 2D Gray-Scott reaction-diffusion equation with periodic BC and PETSc
petsc_fisher_semiimplicit
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class petsc_fisher_semiimplicit: """Problem class implementing the semi-implicit 2D Gray-Scott reaction-diffusion equation with periodic BC and PETSc""" def eval_f(self, u, t): """Routine to evaluate the RHS Args: u (dtype_u): current values t (float): current time Returns: dtype_f: the RH...
stack_v2_sparse_classes_36k_train_033989
16,584
permissive
[ { "docstring": "Routine to evaluate the RHS Args: u (dtype_u): current values t (float): current time Returns: dtype_f: the RHS", "name": "eval_f", "signature": "def eval_f(self, u, t)" }, { "docstring": "Simple linear solver for (I-factor*A)u = rhs Args: rhs (dtype_f): right-hand side for the l...
2
null
Implement the Python class `petsc_fisher_semiimplicit` described below. Class description: Problem class implementing the semi-implicit 2D Gray-Scott reaction-diffusion equation with periodic BC and PETSc Method signatures and docstrings: - def eval_f(self, u, t): Routine to evaluate the RHS Args: u (dtype_u): curren...
Implement the Python class `petsc_fisher_semiimplicit` described below. Class description: Problem class implementing the semi-implicit 2D Gray-Scott reaction-diffusion equation with periodic BC and PETSc Method signatures and docstrings: - def eval_f(self, u, t): Routine to evaluate the RHS Args: u (dtype_u): curren...
1a51834bedffd4472e344bed28f4d766614b1537
<|skeleton|> class petsc_fisher_semiimplicit: """Problem class implementing the semi-implicit 2D Gray-Scott reaction-diffusion equation with periodic BC and PETSc""" def eval_f(self, u, t): """Routine to evaluate the RHS Args: u (dtype_u): current values t (float): current time Returns: dtype_f: the RH...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class petsc_fisher_semiimplicit: """Problem class implementing the semi-implicit 2D Gray-Scott reaction-diffusion equation with periodic BC and PETSc""" def eval_f(self, u, t): """Routine to evaluate the RHS Args: u (dtype_u): current values t (float): current time Returns: dtype_f: the RHS""" ...
the_stack_v2_python_sparse
pySDC/implementations/problem_classes/GeneralizedFisher_1D_PETSc.py
Parallel-in-Time/pySDC
train
30
9f5e41779b1f788b16a422a70f003d4f6931b65f
[ "conditions = cars_search_query.to_conditions()\nfound_cars = db.query(Car).filter(and_(*conditions)).all()\navailability_dates = cars_search_query.availability_dates\nfound_cars = self._filter_by_availability_dates(db, found_cars, availability_dates)\nreturn found_cars", "if availability_dates:\n cars = [_car...
<|body_start_0|> conditions = cars_search_query.to_conditions() found_cars = db.query(Car).filter(and_(*conditions)).all() availability_dates = cars_search_query.availability_dates found_cars = self._filter_by_availability_dates(db, found_cars, availability_dates) return found_ca...
CarService
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CarService: def get_by_criteria(self, db: Session, cars_search_query: CarsSearchQuery) -> List[Car]: """Returns cars matching criteria given in CarsSearchQuery""" <|body_0|> def _filter_by_availability_dates(self, db: Session, cars: List[Car], availability_dates: Optional[Av...
stack_v2_sparse_classes_36k_train_033990
1,597
permissive
[ { "docstring": "Returns cars matching criteria given in CarsSearchQuery", "name": "get_by_criteria", "signature": "def get_by_criteria(self, db: Session, cars_search_query: CarsSearchQuery) -> List[Car]" }, { "docstring": "Given list of cars, returns filtered list of cars that excludes cars that...
2
stack_v2_sparse_classes_30k_train_005174
Implement the Python class `CarService` described below. Class description: Implement the CarService class. Method signatures and docstrings: - def get_by_criteria(self, db: Session, cars_search_query: CarsSearchQuery) -> List[Car]: Returns cars matching criteria given in CarsSearchQuery - def _filter_by_availability...
Implement the Python class `CarService` described below. Class description: Implement the CarService class. Method signatures and docstrings: - def get_by_criteria(self, db: Session, cars_search_query: CarsSearchQuery) -> List[Car]: Returns cars matching criteria given in CarsSearchQuery - def _filter_by_availability...
ba70199d329895a5295ceddd0ecc4c61928890dd
<|skeleton|> class CarService: def get_by_criteria(self, db: Session, cars_search_query: CarsSearchQuery) -> List[Car]: """Returns cars matching criteria given in CarsSearchQuery""" <|body_0|> def _filter_by_availability_dates(self, db: Session, cars: List[Car], availability_dates: Optional[Av...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CarService: def get_by_criteria(self, db: Session, cars_search_query: CarsSearchQuery) -> List[Car]: """Returns cars matching criteria given in CarsSearchQuery""" conditions = cars_search_query.to_conditions() found_cars = db.query(Car).filter(and_(*conditions)).all() availabil...
the_stack_v2_python_sparse
backend/app/services/cars_service.py
BartlomiejRasztabiga/Rentally
train
2
2bf9372a29a8401b64bf725faf0bcf6e2811db27
[ "with open(pkl_path, 'r') as f:\n dd = pickle.load(f)\nself.v_template = tf.Variable(undo_chumpy(dd['v_template']), name='v_template', dtype=dtype, trainable=False)\nself.size = [self.v_template.shape[0].value, 3]\nself.num_betas = dd['shapedirs'].shape[-1]\nshapedir = np.reshape(undo_chumpy(dd['shapedirs']), [-...
<|body_start_0|> with open(pkl_path, 'r') as f: dd = pickle.load(f) self.v_template = tf.Variable(undo_chumpy(dd['v_template']), name='v_template', dtype=dtype, trainable=False) self.size = [self.v_template.shape[0].value, 3] self.num_betas = dd['shapedirs'].shape[-1] ...
SMPL
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SMPL: def __init__(self, pkl_path, joint_type='cocoplus', dtype=tf.float32): """pkl_path is the path to a SMPL model""" <|body_0|> def __call__(self, beta, theta, get_skin=False, name=None): """Obtain SMPL with shape (beta) & pose (theta) inputs. Theta includes the g...
stack_v2_sparse_classes_36k_train_033991
5,935
permissive
[ { "docstring": "pkl_path is the path to a SMPL model", "name": "__init__", "signature": "def __init__(self, pkl_path, joint_type='cocoplus', dtype=tf.float32)" }, { "docstring": "Obtain SMPL with shape (beta) & pose (theta) inputs. Theta includes the global rotation. Args: beta: N x 10 theta: N ...
2
stack_v2_sparse_classes_30k_train_019585
Implement the Python class `SMPL` described below. Class description: Implement the SMPL class. Method signatures and docstrings: - def __init__(self, pkl_path, joint_type='cocoplus', dtype=tf.float32): pkl_path is the path to a SMPL model - def __call__(self, beta, theta, get_skin=False, name=None): Obtain SMPL with...
Implement the Python class `SMPL` described below. Class description: Implement the SMPL class. Method signatures and docstrings: - def __init__(self, pkl_path, joint_type='cocoplus', dtype=tf.float32): pkl_path is the path to a SMPL model - def __call__(self, beta, theta, get_skin=False, name=None): Obtain SMPL with...
6ff7fc867e9e185d547ada11713a60fbf3caa902
<|skeleton|> class SMPL: def __init__(self, pkl_path, joint_type='cocoplus', dtype=tf.float32): """pkl_path is the path to a SMPL model""" <|body_0|> def __call__(self, beta, theta, get_skin=False, name=None): """Obtain SMPL with shape (beta) & pose (theta) inputs. Theta includes the g...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SMPL: def __init__(self, pkl_path, joint_type='cocoplus', dtype=tf.float32): """pkl_path is the path to a SMPL model""" with open(pkl_path, 'r') as f: dd = pickle.load(f) self.v_template = tf.Variable(undo_chumpy(dd['v_template']), name='v_template', dtype=dtype, trainable=...
the_stack_v2_python_sparse
src/tf_smpl/batch_smpl.py
akanazawa/motion_reconstruction
train
297
9c397ea40a8b4ad8a5d50d7daadd5034c9214943
[ "plugin = Plugin(distribution='norm')\nself.assertEqual(plugin.distribution, stats.norm)\nself.assertEqual(plugin.shape_parameters, [])", "plugin = Plugin(distribution='truncnorm', shape_parameters=[0, np.inf])\nself.assertEqual(plugin.distribution, scipy_cont_distns.truncnorm)\nself.assertEqual(plugin.shape_para...
<|body_start_0|> plugin = Plugin(distribution='norm') self.assertEqual(plugin.distribution, stats.norm) self.assertEqual(plugin.shape_parameters, []) <|end_body_0|> <|body_start_1|> plugin = Plugin(distribution='truncnorm', shape_parameters=[0, np.inf]) self.assertEqual(plugin.d...
Test the __init__ method.
Test__init__
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test__init__: """Test the __init__ method.""" def test_valid_distribution(self): """Test for a valid distribution.""" <|body_0|> def test_valid_distribution_with_shape_parameters(self): """Test for a valid distribution with shape parameters.""" <|body_1|>...
stack_v2_sparse_classes_36k_train_033992
5,343
permissive
[ { "docstring": "Test for a valid distribution.", "name": "test_valid_distribution", "signature": "def test_valid_distribution(self)" }, { "docstring": "Test for a valid distribution with shape parameters.", "name": "test_valid_distribution_with_shape_parameters", "signature": "def test_v...
4
null
Implement the Python class `Test__init__` described below. Class description: Test the __init__ method. Method signatures and docstrings: - def test_valid_distribution(self): Test for a valid distribution. - def test_valid_distribution_with_shape_parameters(self): Test for a valid distribution with shape parameters. ...
Implement the Python class `Test__init__` described below. Class description: Test the __init__ method. Method signatures and docstrings: - def test_valid_distribution(self): Test for a valid distribution. - def test_valid_distribution_with_shape_parameters(self): Test for a valid distribution with shape parameters. ...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test__init__: """Test the __init__ method.""" def test_valid_distribution(self): """Test for a valid distribution.""" <|body_0|> def test_valid_distribution_with_shape_parameters(self): """Test for a valid distribution with shape parameters.""" <|body_1|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test__init__: """Test the __init__ method.""" def test_valid_distribution(self): """Test for a valid distribution.""" plugin = Plugin(distribution='norm') self.assertEqual(plugin.distribution, stats.norm) self.assertEqual(plugin.shape_parameters, []) def test_valid_di...
the_stack_v2_python_sparse
improver_tests/ensemble_copula_coupling/test_ConvertLocationAndScaleParameters.py
metoppv/improver
train
101
e51e966d8f81dec7292f72803b5a98978663d81c
[ "year = self.get_year()\nmonth = self.get_month()\ndate = _date_from_string(year, self.get_year_format(), month, self.get_month_format())\nif queryset is None:\n queryset = self.get_queryset()\nif not self.allow_future and date > date.today():\n raise Http404('Future {} not available because{}. allow_future i...
<|body_start_0|> year = self.get_year() month = self.get_month() date = _date_from_string(year, self.get_year_format(), month, self.get_month_format()) if queryset is None: queryset = self.get_queryset() if not self.allow_future and date > date.today(): ra...
DateObjectMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DateObjectMixin: def get_object(self, queryset=None): """In this method django builds the keyword arguments for the query(to find the object in the database) The method creates the date kwargs for queryset and then pass that query set to the super queryset that contains the slug. :param ...
stack_v2_sparse_classes_36k_train_033993
6,230
permissive
[ { "docstring": "In this method django builds the keyword arguments for the query(to find the object in the database) The method creates the date kwargs for queryset and then pass that query set to the super queryset that contains the slug. :param queryset: :return:", "name": "get_object", "signature": "...
2
stack_v2_sparse_classes_30k_train_015443
Implement the Python class `DateObjectMixin` described below. Class description: Implement the DateObjectMixin class. Method signatures and docstrings: - def get_object(self, queryset=None): In this method django builds the keyword arguments for the query(to find the object in the database) The method creates the dat...
Implement the Python class `DateObjectMixin` described below. Class description: Implement the DateObjectMixin class. Method signatures and docstrings: - def get_object(self, queryset=None): In this method django builds the keyword arguments for the query(to find the object in the database) The method creates the dat...
26f11c944c34cd11b5961ec1b5eeb5cb3a7acdf8
<|skeleton|> class DateObjectMixin: def get_object(self, queryset=None): """In this method django builds the keyword arguments for the query(to find the object in the database) The method creates the date kwargs for queryset and then pass that query set to the super queryset that contains the slug. :param ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DateObjectMixin: def get_object(self, queryset=None): """In this method django builds the keyword arguments for the query(to find the object in the database) The method creates the date kwargs for queryset and then pass that query set to the super queryset that contains the slug. :param queryset: :ret...
the_stack_v2_python_sparse
suorganizer/blogs/mixins.py
mohammadasim/suorganiser
train
0
d8fd92235c7250909a84326b40d03d184af10f6f
[ "rst = {'data': {'list': []}}\ntry:\n rst['errcode'] = 0\n page_num = int(request.params['pageNum']) - 1\n page_size = int(request.params['pageSize'])\n query = request.params['query']\n model = http.request.env['project_manage.project_manage']\n domain = []\n if query and query != '':\n ...
<|body_start_0|> rst = {'data': {'list': []}} try: rst['errcode'] = 0 page_num = int(request.params['pageNum']) - 1 page_size = int(request.params['pageSize']) query = request.params['query'] model = http.request.env['project_manage.project_man...
接口
ProjectManage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectManage: """接口""" def get_project(self, **kw): """取得所有的项目 :param kw: :return:""" <|body_0|> def get_project_info(self, **kw): """取得项目信息 :param kw: :return:""" <|body_1|> def get_project_info(self, **kw): """获取登陆用户的信息 :param kw: :return:...
stack_v2_sparse_classes_36k_train_033994
3,532
no_license
[ { "docstring": "取得所有的项目 :param kw: :return:", "name": "get_project", "signature": "def get_project(self, **kw)" }, { "docstring": "取得项目信息 :param kw: :return:", "name": "get_project_info", "signature": "def get_project_info(self, **kw)" }, { "docstring": "获取登陆用户的信息 :param kw: :ret...
3
null
Implement the Python class `ProjectManage` described below. Class description: 接口 Method signatures and docstrings: - def get_project(self, **kw): 取得所有的项目 :param kw: :return: - def get_project_info(self, **kw): 取得项目信息 :param kw: :return: - def get_project_info(self, **kw): 获取登陆用户的信息 :param kw: :return:
Implement the Python class `ProjectManage` described below. Class description: 接口 Method signatures and docstrings: - def get_project(self, **kw): 取得所有的项目 :param kw: :return: - def get_project_info(self, **kw): 取得项目信息 :param kw: :return: - def get_project_info(self, **kw): 获取登陆用户的信息 :param kw: :return: <|skeleton|> ...
13b428a5c4ade6278e3e5e996ef10d9fb0fea4b9
<|skeleton|> class ProjectManage: """接口""" def get_project(self, **kw): """取得所有的项目 :param kw: :return:""" <|body_0|> def get_project_info(self, **kw): """取得项目信息 :param kw: :return:""" <|body_1|> def get_project_info(self, **kw): """获取登陆用户的信息 :param kw: :return:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProjectManage: """接口""" def get_project(self, **kw): """取得所有的项目 :param kw: :return:""" rst = {'data': {'list': []}} try: rst['errcode'] = 0 page_num = int(request.params['pageNum']) - 1 page_size = int(request.params['pageSize']) que...
the_stack_v2_python_sparse
mdias_addons/project_manage/controllers/controllers.py
rezaghanimi/main_mdias
train
0
20d30ecdbe34ec6c50e6c8d605bcd6f89be0e765
[ "max_end = min((itv[E] for itvs in schedule for itv in itvs))\nq = []\nfor i, itvs in enumerate(schedule):\n j = 0\n itv = itvs[j]\n heapq.heappush(q, (itv[S], i, j))\nret = []\nwhile q:\n _, i, j = heapq.heappop(q)\n itv = schedule[i][j]\n if max_end < itv[S]:\n ret.append([max_end, itv[S]...
<|body_start_0|> max_end = min((itv[E] for itvs in schedule for itv in itvs)) q = [] for i, itvs in enumerate(schedule): j = 0 itv = itvs[j] heapq.heappush(q, (itv[S], i, j)) ret = [] while q: _, i, j = heapq.heappop(q) ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def employeeFreeTime(self, schedule: List[List[List[int]]]) -> List[List[int]]: """Method 1 Looking at the head of each list through iterator Merge interval of heads, need to sort, then use heap After merge, find the open interval No need to merge, find the max end time, and co...
stack_v2_sparse_classes_36k_train_033995
4,451
permissive
[ { "docstring": "Method 1 Looking at the head of each list through iterator Merge interval of heads, need to sort, then use heap After merge, find the open interval No need to merge, find the max end time, and compare to the min start time Method 2 Better algorithm to find the open interval [s, e], we can think ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def employeeFreeTime(self, schedule: List[List[List[int]]]) -> List[List[int]]: Method 1 Looking at the head of each list through iterator Merge interval of heads, need to sort, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def employeeFreeTime(self, schedule: List[List[List[int]]]) -> List[List[int]]: Method 1 Looking at the head of each list through iterator Merge interval of heads, need to sort, ...
c82a0a5f8d5e027c614612de7f396d28e8511155
<|skeleton|> class Solution: def employeeFreeTime(self, schedule: List[List[List[int]]]) -> List[List[int]]: """Method 1 Looking at the head of each list through iterator Merge interval of heads, need to sort, then use heap After merge, find the open interval No need to merge, find the max end time, and co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def employeeFreeTime(self, schedule: List[List[List[int]]]) -> List[List[int]]: """Method 1 Looking at the head of each list through iterator Merge interval of heads, need to sort, then use heap After merge, find the open interval No need to merge, find the max end time, and compare to the m...
the_stack_v2_python_sparse
LeetCode/759 Employee Free Time.py
firefeifei/CodePool
train
1
e63d64cb04c0c49b58f5ef17893f5d4da6233fab
[ "self.validate_only_one_lead(data)\nself.validate_force_delete(data)\nreturn data", "order = self.context['order']\nforce_delete = self.context['force_delete']\nif order.status != OrderStatus.DRAFT and force_delete:\n raise ValidationError('You cannot delete any assignees at this stage.')\nreturn data", "ord...
<|body_start_0|> self.validate_only_one_lead(data) self.validate_force_delete(data) return data <|end_body_0|> <|body_start_1|> order = self.context['order'] force_delete = self.context['force_delete'] if order.status != OrderStatus.DRAFT and force_delete: ra...
DRF List serializer for OrderAssignee(s).
OrderAssigneeListSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrderAssigneeListSerializer: """DRF List serializer for OrderAssignee(s).""" def validate(self, data): """Validate the list of assignees.""" <|body_0|> def validate_force_delete(self, data): """Validate that assignees cannot be deleted if the order.status == paid...
stack_v2_sparse_classes_36k_train_033996
21,268
permissive
[ { "docstring": "Validate the list of assignees.", "name": "validate", "signature": "def validate(self, data)" }, { "docstring": "Validate that assignees cannot be deleted if the order.status == paid.", "name": "validate_force_delete", "signature": "def validate_force_delete(self, data)" ...
4
null
Implement the Python class `OrderAssigneeListSerializer` described below. Class description: DRF List serializer for OrderAssignee(s). Method signatures and docstrings: - def validate(self, data): Validate the list of assignees. - def validate_force_delete(self, data): Validate that assignees cannot be deleted if the...
Implement the Python class `OrderAssigneeListSerializer` described below. Class description: DRF List serializer for OrderAssignee(s). Method signatures and docstrings: - def validate(self, data): Validate the list of assignees. - def validate_force_delete(self, data): Validate that assignees cannot be deleted if the...
a92faabf73fb93b5bfd94fd465eafc3e29aa6d8e
<|skeleton|> class OrderAssigneeListSerializer: """DRF List serializer for OrderAssignee(s).""" def validate(self, data): """Validate the list of assignees.""" <|body_0|> def validate_force_delete(self, data): """Validate that assignees cannot be deleted if the order.status == paid...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrderAssigneeListSerializer: """DRF List serializer for OrderAssignee(s).""" def validate(self, data): """Validate the list of assignees.""" self.validate_only_one_lead(data) self.validate_force_delete(data) return data def validate_force_delete(self, data): "...
the_stack_v2_python_sparse
datahub/omis/order/serializers.py
cgsunkel/data-hub-api
train
0
ee915f61ab1415e4035b9d0ebebe89163c0bbcbf
[ "if style != None:\n options = {'bright': '1', 'dim': '2', 'underline': '4', 'black': '30', 'red': '31', 'green': '32', 'yellow': '33', 'blue': '34', 'magenta': '35', 'cyan': '36', 'white': '37'}\n code = options[style]\n if bold:\n code = '1;%s' % code\n return '\\x1b[' + code + 'm%s\\x1b[0m'\ne...
<|body_start_0|> if style != None: options = {'bright': '1', 'dim': '2', 'underline': '4', 'black': '30', 'red': '31', 'green': '32', 'yellow': '33', 'blue': '34', 'magenta': '35', 'cyan': '36', 'white': '37'} code = options[style] if bold: code = '1;%s' % cod...
Print2Console
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Print2Console: def get_format_options(style, bold): """Define the ANSI escape sequences for modifying the style of the output""" <|body_0|> def p(format_str, var, first_col_w=24, line_width=72, style=None, bold=False, decimals=2): """The variables to be printed ('var...
stack_v2_sparse_classes_36k_train_033997
2,722
permissive
[ { "docstring": "Define the ANSI escape sequences for modifying the style of the output", "name": "get_format_options", "signature": "def get_format_options(style, bold)" }, { "docstring": "The variables to be printed ('var') must be added inside a list. First colum width is selected 24 character...
2
null
Implement the Python class `Print2Console` described below. Class description: Implement the Print2Console class. Method signatures and docstrings: - def get_format_options(style, bold): Define the ANSI escape sequences for modifying the style of the output - def p(format_str, var, first_col_w=24, line_width=72, styl...
Implement the Python class `Print2Console` described below. Class description: Implement the Print2Console class. Method signatures and docstrings: - def get_format_options(style, bold): Define the ANSI escape sequences for modifying the style of the output - def p(format_str, var, first_col_w=24, line_width=72, styl...
2b0e44b166d699ace2b103d064e45e8da997bdb5
<|skeleton|> class Print2Console: def get_format_options(style, bold): """Define the ANSI escape sequences for modifying the style of the output""" <|body_0|> def p(format_str, var, first_col_w=24, line_width=72, style=None, bold=False, decimals=2): """The variables to be printed ('var...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Print2Console: def get_format_options(style, bold): """Define the ANSI escape sequences for modifying the style of the output""" if style != None: options = {'bright': '1', 'dim': '2', 'underline': '4', 'black': '30', 'red': '31', 'green': '32', 'yellow': '33', 'blue': '34', 'magen...
the_stack_v2_python_sparse
p3iv_utils/src/p3iv_utils/consoleprint.py
philippbrusius/P3IV
train
0
53f36807f85cb5c6de0e623b2795c303145f83d3
[ "super().__init__()\nself.hidden_channels = hidden_channels\nself.num_filters = num_filters\nself.num_interactions = num_interactions\nself.cutoff = cutoff\nself.embedding = Embedding(100, hidden_channels, max_norm=10.0)\nself.interactions = ModuleList()\nfor _ in range(num_interactions):\n block = InteractionBl...
<|body_start_0|> super().__init__() self.hidden_channels = hidden_channels self.num_filters = num_filters self.num_interactions = num_interactions self.cutoff = cutoff self.embedding = Embedding(100, hidden_channels, max_norm=10.0) self.interactions = ModuleList()...
SchNet encoder.
SchNetEncoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SchNetEncoder: """SchNet encoder.""" def __init__(self, hidden_channels: int=128, num_filters: int=128, num_interactions: int=6, edge_channels: int=100, cutoff: float=10.0, smooth: bool=False) -> None: """Construct a SchNet encoder. Args: hidden_channels: number of hidden channels. n...
stack_v2_sparse_classes_36k_train_033998
15,380
permissive
[ { "docstring": "Construct a SchNet encoder. Args: hidden_channels: number of hidden channels. num_filters: number of filters. num_interactions: number of interactions. edge_channels: number of edge channels. cutoff: cutoff distance. smooth: whether to use smooth cutoff.", "name": "__init__", "signature"...
2
stack_v2_sparse_classes_30k_train_014910
Implement the Python class `SchNetEncoder` described below. Class description: SchNet encoder. Method signatures and docstrings: - def __init__(self, hidden_channels: int=128, num_filters: int=128, num_interactions: int=6, edge_channels: int=100, cutoff: float=10.0, smooth: bool=False) -> None: Construct a SchNet enc...
Implement the Python class `SchNetEncoder` described below. Class description: SchNet encoder. Method signatures and docstrings: - def __init__(self, hidden_channels: int=128, num_filters: int=128, num_interactions: int=6, edge_channels: int=100, cutoff: float=10.0, smooth: bool=False) -> None: Construct a SchNet enc...
0b69b7d5b261f2f9af3984793c1295b9b80cd01a
<|skeleton|> class SchNetEncoder: """SchNet encoder.""" def __init__(self, hidden_channels: int=128, num_filters: int=128, num_interactions: int=6, edge_channels: int=100, cutoff: float=10.0, smooth: bool=False) -> None: """Construct a SchNet encoder. Args: hidden_channels: number of hidden channels. n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SchNetEncoder: """SchNet encoder.""" def __init__(self, hidden_channels: int=128, num_filters: int=128, num_interactions: int=6, edge_channels: int=100, cutoff: float=10.0, smooth: bool=False) -> None: """Construct a SchNet encoder. Args: hidden_channels: number of hidden channels. num_filters: n...
the_stack_v2_python_sparse
src/gt4sd/algorithms/generation/diffusion/geodiff/model/layers.py
GT4SD/gt4sd-core
train
239
65e234d719cc214e5dc0196fa270295bbff27cd2
[ "params = {'action': 'query', 'meta': 'notifications', 'notformat': 'special'}\nfor key, value in kwargs.items():\n params['not' + key] = value\ndata = self.simple_request(**params).submit()\nnotifications = data['query']['notifications']['list']\nreturn (Notification.fromJSON(self, notification) for notificatio...
<|body_start_0|> params = {'action': 'query', 'meta': 'notifications', 'notformat': 'special'} for key, value in kwargs.items(): params['not' + key] = value data = self.simple_request(**params).submit() notifications = data['query']['notifications']['list'] return (No...
APISite mixin for Echo extension.
EchoMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EchoMixin: """APISite mixin for Echo extension.""" def notifications(self, **kwargs): """Yield Notification objects from the Echo extension. :keyword Optional[str] format: If specified, notifications will be returned formatted this way. Its value is either ``model``, ``special`` or `...
stack_v2_sparse_classes_36k_train_033999
28,091
permissive
[ { "docstring": "Yield Notification objects from the Echo extension. :keyword Optional[str] format: If specified, notifications will be returned formatted this way. Its value is either ``model``, ``special`` or ``None``. Default is ``special``. .. seealso:: :api:`Notifications` for other keywords.", "name": ...
2
null
Implement the Python class `EchoMixin` described below. Class description: APISite mixin for Echo extension. Method signatures and docstrings: - def notifications(self, **kwargs): Yield Notification objects from the Echo extension. :keyword Optional[str] format: If specified, notifications will be returned formatted ...
Implement the Python class `EchoMixin` described below. Class description: APISite mixin for Echo extension. Method signatures and docstrings: - def notifications(self, **kwargs): Yield Notification objects from the Echo extension. :keyword Optional[str] format: If specified, notifications will be returned formatted ...
5c01e6bfcd328bc6eae643e661f1a0ae57612808
<|skeleton|> class EchoMixin: """APISite mixin for Echo extension.""" def notifications(self, **kwargs): """Yield Notification objects from the Echo extension. :keyword Optional[str] format: If specified, notifications will be returned formatted this way. Its value is either ``model``, ``special`` or `...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EchoMixin: """APISite mixin for Echo extension.""" def notifications(self, **kwargs): """Yield Notification objects from the Echo extension. :keyword Optional[str] format: If specified, notifications will be returned formatted this way. Its value is either ``model``, ``special`` or ``None``. Defa...
the_stack_v2_python_sparse
pywikibot/site/_extensions.py
wikimedia/pywikibot
train
432