blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
6b9711afb9dfe4c2623942eb01f67400b45a0864
[ "username = self.cleaned_data.get('username')\nis_exist = models.UserInfo.objects.filter(username=username)\nif is_exist.exists():\n raise ValidationError('用户名已经存在')\nelse:\n return username", "pwd = self.cleaned_data.get('password')\nre_pwd = self.cleaned_data.get('re_password')\nif pwd == re_pwd:\n ret...
<|body_start_0|> username = self.cleaned_data.get('username') is_exist = models.UserInfo.objects.filter(username=username) if is_exist.exists(): raise ValidationError('用户名已经存在') else: return username <|end_body_0|> <|body_start_1|> pwd = self.cleaned_data...
用户注册校验 使用form组件 字段名称必须和数据库对应 re_password在数据库不存在,在存储数据前会删掉 RegexValidator forms中使用正则过滤
RegisterForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegisterForm: """用户注册校验 使用form组件 字段名称必须和数据库对应 re_password在数据库不存在,在存储数据前会删掉 RegexValidator forms中使用正则过滤""" def clean_username(self): """局部钩子 clean_username 对username字段进行校验 检测用户名唯一性 ValidationError 弹出异常 :return: 成功:用户名 失败:错误信息""" <|body_0|> def clean(self): """全局钩子...
stack_v2_sparse_classes_10k_train_006900
5,228
no_license
[ { "docstring": "局部钩子 clean_username 对username字段进行校验 检测用户名唯一性 ValidationError 弹出异常 :return: 成功:用户名 失败:错误信息", "name": "clean_username", "signature": "def clean_username(self)" }, { "docstring": "全局钩子 获取cleaned_data中的所有数据 检测两次输入的密码是否一致 :return: 成功: 返回cleaned_data 数据 失败:返回错误信息,并指定那个input返回错误信息", ...
3
stack_v2_sparse_classes_30k_train_003707
Implement the Python class `RegisterForm` described below. Class description: 用户注册校验 使用form组件 字段名称必须和数据库对应 re_password在数据库不存在,在存储数据前会删掉 RegexValidator forms中使用正则过滤 Method signatures and docstrings: - def clean_username(self): 局部钩子 clean_username 对username字段进行校验 检测用户名唯一性 ValidationError 弹出异常 :return: 成功:用户名 失败:错误信息 - ...
Implement the Python class `RegisterForm` described below. Class description: 用户注册校验 使用form组件 字段名称必须和数据库对应 re_password在数据库不存在,在存储数据前会删掉 RegexValidator forms中使用正则过滤 Method signatures and docstrings: - def clean_username(self): 局部钩子 clean_username 对username字段进行校验 检测用户名唯一性 ValidationError 弹出异常 :return: 成功:用户名 失败:错误信息 - ...
d7fc68d3d23345df5bfb09d4a84686c8b49a5ad7
<|skeleton|> class RegisterForm: """用户注册校验 使用form组件 字段名称必须和数据库对应 re_password在数据库不存在,在存储数据前会删掉 RegexValidator forms中使用正则过滤""" def clean_username(self): """局部钩子 clean_username 对username字段进行校验 检测用户名唯一性 ValidationError 弹出异常 :return: 成功:用户名 失败:错误信息""" <|body_0|> def clean(self): """全局钩子...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RegisterForm: """用户注册校验 使用form组件 字段名称必须和数据库对应 re_password在数据库不存在,在存储数据前会删掉 RegexValidator forms中使用正则过滤""" def clean_username(self): """局部钩子 clean_username 对username字段进行校验 检测用户名唯一性 ValidationError 弹出异常 :return: 成功:用户名 失败:错误信息""" username = self.cleaned_data.get('username') is_exist...
the_stack_v2_python_sparse
day21/homework/CMS/fault_reporting/forms.py
214031230/Python21
train
0
e318c2c5c922960ab49634f1943513ce804a2302
[ "delay = DelayFilter()\noriginal = delay(0)\nnorm = NormFilter()\nshift = ShiftSWFilter(window_size=2, strict_windows=False, cs=False)\nmean = MeanSWFilter(window_size=25, cs=False)\nstd = StdSWFilter(window_size=25, strict_windows=True)\ndtr = DecisionTreeRegressorSWFilter(window_size=100, strict_windows=True, ove...
<|body_start_0|> delay = DelayFilter() original = delay(0) norm = NormFilter() shift = ShiftSWFilter(window_size=2, strict_windows=False, cs=False) mean = MeanSWFilter(window_size=25, cs=False) std = StdSWFilter(window_size=25, strict_windows=True) dtr = DecisionT...
...
DtrEventSelector
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DtrEventSelector: """...""" def seq_filters(): """:return:""" <|body_0|> def filter_events(self, event_seq, **kwargs): """Should be implemented :param event_seq:""" <|body_1|> <|end_skeleton|> <|body_start_0|> delay = DelayFilter() origi...
stack_v2_sparse_classes_10k_train_006901
4,290
permissive
[ { "docstring": ":return:", "name": "seq_filters", "signature": "def seq_filters()" }, { "docstring": "Should be implemented :param event_seq:", "name": "filter_events", "signature": "def filter_events(self, event_seq, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_005864
Implement the Python class `DtrEventSelector` described below. Class description: ... Method signatures and docstrings: - def seq_filters(): :return: - def filter_events(self, event_seq, **kwargs): Should be implemented :param event_seq:
Implement the Python class `DtrEventSelector` described below. Class description: ... Method signatures and docstrings: - def seq_filters(): :return: - def filter_events(self, event_seq, **kwargs): Should be implemented :param event_seq: <|skeleton|> class DtrEventSelector: """...""" def seq_filters(): ...
617ff45c9c3c96bbd9a975aef15f1b2697282b9c
<|skeleton|> class DtrEventSelector: """...""" def seq_filters(): """:return:""" <|body_0|> def filter_events(self, event_seq, **kwargs): """Should be implemented :param event_seq:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DtrEventSelector: """...""" def seq_filters(): """:return:""" delay = DelayFilter() original = delay(0) norm = NormFilter() shift = ShiftSWFilter(window_size=2, strict_windows=False, cs=False) mean = MeanSWFilter(window_size=25, cs=False) std = StdS...
the_stack_v2_python_sparse
shot_detector/selectors/event/dtr_event_selector.py
w495/python-video-shot-detector
train
20
b978db0826b73b580f4d19c86880a25ec10a8417
[ "from pages.regions.accordion import Accordion\nfrom pages.regions.treeaccordionitem import LegacyTreeAccordionItem\nreturn Accordion(self.testsetup, LegacyTreeAccordionItem)", "self.click_on_catalog_item('All Catalog Items')\nself.get_element(*self._configuration_button_locator).click()\nself.get_element(*self._...
<|body_start_0|> from pages.regions.accordion import Accordion from pages.regions.treeaccordionitem import LegacyTreeAccordionItem return Accordion(self.testsetup, LegacyTreeAccordionItem) <|end_body_0|> <|body_start_1|> self.click_on_catalog_item('All Catalog Items') self.get_e...
Catalog Item page
CatalogItems
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CatalogItems: """Catalog Item page""" def accordion(self): """accordion""" <|body_0|> def add_new_catalog_item(self): """click on Configuration and then Add new catalog item btn""" <|body_1|> def add_new_catalog_bundle(self): """Click on Conf...
stack_v2_sparse_classes_10k_train_006902
11,585
no_license
[ { "docstring": "accordion", "name": "accordion", "signature": "def accordion(self)" }, { "docstring": "click on Configuration and then Add new catalog item btn", "name": "add_new_catalog_item", "signature": "def add_new_catalog_item(self)" }, { "docstring": "Click on Configuratio...
6
null
Implement the Python class `CatalogItems` described below. Class description: Catalog Item page Method signatures and docstrings: - def accordion(self): accordion - def add_new_catalog_item(self): click on Configuration and then Add new catalog item btn - def add_new_catalog_bundle(self): Click on Configuration and t...
Implement the Python class `CatalogItems` described below. Class description: Catalog Item page Method signatures and docstrings: - def accordion(self): accordion - def add_new_catalog_item(self): click on Configuration and then Add new catalog item btn - def add_new_catalog_bundle(self): Click on Configuration and t...
51bb86fda7d897e90444a6a0380a5aa2c61be6ff
<|skeleton|> class CatalogItems: """Catalog Item page""" def accordion(self): """accordion""" <|body_0|> def add_new_catalog_item(self): """click on Configuration and then Add new catalog item btn""" <|body_1|> def add_new_catalog_bundle(self): """Click on Conf...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CatalogItems: """Catalog Item page""" def accordion(self): """accordion""" from pages.regions.accordion import Accordion from pages.regions.treeaccordionitem import LegacyTreeAccordionItem return Accordion(self.testsetup, LegacyTreeAccordionItem) def add_new_catalog_i...
the_stack_v2_python_sparse
pages/services_subpages/catalog_subpages/catalog_items.py
sshveta/cfme_tests
train
0
b72592d05f7acb19c1a272189dd6789d3f4d890a
[ "try:\n with open(yaml_file_path, 'r') as f:\n self.doc = yaml.load(f)\nexcept Exception as ex:\n message = 'Exception: An exception occured: {}'.format(ex)\n raise Exception(message)", "param_value = self.doc[appliance][param]\nif param_value == '':\n message = 'Value is not updated for the pa...
<|body_start_0|> try: with open(yaml_file_path, 'r') as f: self.doc = yaml.load(f) except Exception as ex: message = 'Exception: An exception occured: {}'.format(ex) raise Exception(message) <|end_body_0|> <|body_start_1|> param_value = self.d...
GetYamlValue
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetYamlValue: def __init__(self, yaml_file_path=yaml_path): """:param yaml_file_path: Path of yaml file, Default will the config.yaml file""" <|body_0|> def get_config(self, appliance, param): """This function gives the yaml value corresponding to the parameter sampl...
stack_v2_sparse_classes_10k_train_006903
1,425
no_license
[ { "docstring": ":param yaml_file_path: Path of yaml file, Default will the config.yaml file", "name": "__init__", "signature": "def __init__(self, yaml_file_path=yaml_path)" }, { "docstring": "This function gives the yaml value corresponding to the parameter sample Yaml file xstream_details: xtm...
2
null
Implement the Python class `GetYamlValue` described below. Class description: Implement the GetYamlValue class. Method signatures and docstrings: - def __init__(self, yaml_file_path=yaml_path): :param yaml_file_path: Path of yaml file, Default will the config.yaml file - def get_config(self, appliance, param): This f...
Implement the Python class `GetYamlValue` described below. Class description: Implement the GetYamlValue class. Method signatures and docstrings: - def __init__(self, yaml_file_path=yaml_path): :param yaml_file_path: Path of yaml file, Default will the config.yaml file - def get_config(self, appliance, param): This f...
93dd6d14ae4b0856aa7c6f059904cc1f13800e5f
<|skeleton|> class GetYamlValue: def __init__(self, yaml_file_path=yaml_path): """:param yaml_file_path: Path of yaml file, Default will the config.yaml file""" <|body_0|> def get_config(self, appliance, param): """This function gives the yaml value corresponding to the parameter sampl...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GetYamlValue: def __init__(self, yaml_file_path=yaml_path): """:param yaml_file_path: Path of yaml file, Default will the config.yaml file""" try: with open(yaml_file_path, 'r') as f: self.doc = yaml.load(f) except Exception as ex: message = 'Exc...
the_stack_v2_python_sparse
automation_framework/utils/GetYamlValue.py
vijaymaddukuri/python_repo
train
0
eac5417971633ce3a2982c832dd850dc619b8617
[ "super().__init__(coordinator)\nself._attr_device_info = DeviceInfo(entry_type=DeviceEntryType.SERVICE, identifiers={(DOMAIN, f'{coordinator.latitude}-{coordinator.longitude}')}, manufacturer=MANUFACTURER, name=name, configuration_url=URL.format(latitude=coordinator.latitude, longitude=coordinator.longitude))\nself...
<|body_start_0|> super().__init__(coordinator) self._attr_device_info = DeviceInfo(entry_type=DeviceEntryType.SERVICE, identifiers={(DOMAIN, f'{coordinator.latitude}-{coordinator.longitude}')}, manufacturer=MANUFACTURER, name=name, configuration_url=URL.format(latitude=coordinator.latitude, longitude=co...
Define an Airly sensor.
AirlySensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AirlySensor: """Define an Airly sensor.""" def __init__(self, coordinator: AirlyDataUpdateCoordinator, name: str, description: AirlySensorEntityDescription) -> None: """Initialize.""" <|body_0|> def _handle_coordinator_update(self) -> None: """Handle updated data...
stack_v2_sparse_classes_10k_train_006904
7,989
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, coordinator: AirlyDataUpdateCoordinator, name: str, description: AirlySensorEntityDescription) -> None" }, { "docstring": "Handle updated data from the coordinator.", "name": "_handle_coordinator_update", ...
2
null
Implement the Python class `AirlySensor` described below. Class description: Define an Airly sensor. Method signatures and docstrings: - def __init__(self, coordinator: AirlyDataUpdateCoordinator, name: str, description: AirlySensorEntityDescription) -> None: Initialize. - def _handle_coordinator_update(self) -> None...
Implement the Python class `AirlySensor` described below. Class description: Define an Airly sensor. Method signatures and docstrings: - def __init__(self, coordinator: AirlyDataUpdateCoordinator, name: str, description: AirlySensorEntityDescription) -> None: Initialize. - def _handle_coordinator_update(self) -> None...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class AirlySensor: """Define an Airly sensor.""" def __init__(self, coordinator: AirlyDataUpdateCoordinator, name: str, description: AirlySensorEntityDescription) -> None: """Initialize.""" <|body_0|> def _handle_coordinator_update(self) -> None: """Handle updated data...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AirlySensor: """Define an Airly sensor.""" def __init__(self, coordinator: AirlyDataUpdateCoordinator, name: str, description: AirlySensorEntityDescription) -> None: """Initialize.""" super().__init__(coordinator) self._attr_device_info = DeviceInfo(entry_type=DeviceEntryType.SERV...
the_stack_v2_python_sparse
homeassistant/components/airly/sensor.py
home-assistant/core
train
35,501
4e839ba3808743ba8c8785079521bbfa02a0e34f
[ "data = {}\nid = request.GET.get('id', None)\ndetailed_requirement_id = request.GET.get('detailed_requirement_id', None)\noffering_course_id = request.GET.get('offering_course_id', None)\nfield_of_study_id = request.GET.get('field_of_study_id', None)\nif id is not None:\n data['id'] = id\nif detailed_requirement...
<|body_start_0|> data = {} id = request.GET.get('id', None) detailed_requirement_id = request.GET.get('detailed_requirement_id', None) offering_course_id = request.GET.get('offering_course_id', None) field_of_study_id = request.GET.get('field_of_study_id', None) if id is ...
支撑课程view
IndicatorFactors
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IndicatorFactors: """支撑课程view""" def get(self, request): """查询支撑课程""" <|body_0|> def put(self, request): """修改支撑课程""" <|body_1|> def post(self, request): """增加支撑课程""" <|body_2|> def delete(self, request): """删除支撑课程""" ...
stack_v2_sparse_classes_10k_train_006905
15,061
permissive
[ { "docstring": "查询支撑课程", "name": "get", "signature": "def get(self, request)" }, { "docstring": "修改支撑课程", "name": "put", "signature": "def put(self, request)" }, { "docstring": "增加支撑课程", "name": "post", "signature": "def post(self, request)" }, { "docstring": "删除支...
4
stack_v2_sparse_classes_30k_val_000257
Implement the Python class `IndicatorFactors` described below. Class description: 支撑课程view Method signatures and docstrings: - def get(self, request): 查询支撑课程 - def put(self, request): 修改支撑课程 - def post(self, request): 增加支撑课程 - def delete(self, request): 删除支撑课程
Implement the Python class `IndicatorFactors` described below. Class description: 支撑课程view Method signatures and docstrings: - def get(self, request): 查询支撑课程 - def put(self, request): 修改支撑课程 - def post(self, request): 增加支撑课程 - def delete(self, request): 删除支撑课程 <|skeleton|> class IndicatorFactors: """支撑课程view""" ...
7aaa1be773718de1beb3ce0080edca7c4114b7ad
<|skeleton|> class IndicatorFactors: """支撑课程view""" def get(self, request): """查询支撑课程""" <|body_0|> def put(self, request): """修改支撑课程""" <|body_1|> def post(self, request): """增加支撑课程""" <|body_2|> def delete(self, request): """删除支撑课程""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IndicatorFactors: """支撑课程view""" def get(self, request): """查询支撑课程""" data = {} id = request.GET.get('id', None) detailed_requirement_id = request.GET.get('detailed_requirement_id', None) offering_course_id = request.GET.get('offering_course_id', None) fiel...
the_stack_v2_python_sparse
plan/views.py
MIXISAMA/MIS-backend
train
0
24946af70bd19f4df06148cc31a255e1e471b47b
[ "if not kwargs.get('obj_ids'):\n obj_model = facade.get_route_map_entry_by_search(self.search)\n objects = obj_model['query_set']\n only_main_property = False\nelse:\n ids = kwargs.get('obj_ids').split(';')\n objects = facade.get_route_map_entry_by_ids(ids)\n only_main_property = True\n obj_mod...
<|body_start_0|> if not kwargs.get('obj_ids'): obj_model = facade.get_route_map_entry_by_search(self.search) objects = obj_model['query_set'] only_main_property = False else: ids = kwargs.get('obj_ids').split(';') objects = facade.get_route_map...
RouteMapEntryDBView
[ "Apache-2.0", "BSD-3-Clause", "MIT", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RouteMapEntryDBView: def get(self, request, *args, **kwargs): """Returns a list of RouteMapEntries by ids ou dict.""" <|body_0|> def post(self, request, *args, **kwargs): """Create new RouteMapEntry.""" <|body_1|> def put(self, request, *args, **kwargs):...
stack_v2_sparse_classes_10k_train_006906
9,414
permissive
[ { "docstring": "Returns a list of RouteMapEntries by ids ou dict.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Create new RouteMapEntry.", "name": "post", "signature": "def post(self, request, *args, **kwargs)" }, { "docstring": "Upda...
4
null
Implement the Python class `RouteMapEntryDBView` described below. Class description: Implement the RouteMapEntryDBView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Returns a list of RouteMapEntries by ids ou dict. - def post(self, request, *args, **kwargs): Create new RouteMapEn...
Implement the Python class `RouteMapEntryDBView` described below. Class description: Implement the RouteMapEntryDBView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Returns a list of RouteMapEntries by ids ou dict. - def post(self, request, *args, **kwargs): Create new RouteMapEn...
eb27e1d977a1c4bb1fee8fb51b8d8050c64696d9
<|skeleton|> class RouteMapEntryDBView: def get(self, request, *args, **kwargs): """Returns a list of RouteMapEntries by ids ou dict.""" <|body_0|> def post(self, request, *args, **kwargs): """Create new RouteMapEntry.""" <|body_1|> def put(self, request, *args, **kwargs):...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RouteMapEntryDBView: def get(self, request, *args, **kwargs): """Returns a list of RouteMapEntries by ids ou dict.""" if not kwargs.get('obj_ids'): obj_model = facade.get_route_map_entry_by_search(self.search) objects = obj_model['query_set'] only_main_prope...
the_stack_v2_python_sparse
networkapi/api_route_map/v4/views.py
globocom/GloboNetworkAPI
train
86
6e2d01a30ec210e96623e2cda8d11110f6e1dc1f
[ "n = len(A)\nMX = [-float('inf') for _ in range(n + 1)]\nMI = [float('inf') for _ in range(n + 1)]\nfor i in range(n):\n MX[i + 1] = max(M[i], A[i])\nfor i in range(n - 1, -1, -1):\n MI[i] = min(MI[i + 1], A[i])\nfor l in range(1, n + 1):\n if MX[l] <= MI[l]:\n return l\nraise", "MX = [0 for _ in ...
<|body_start_0|> n = len(A) MX = [-float('inf') for _ in range(n + 1)] MI = [float('inf') for _ in range(n + 1)] for i in range(n): MX[i + 1] = max(M[i], A[i]) for i in range(n - 1, -1, -1): MI[i] = min(MI[i + 1], A[i]) for l in range(1, n + 1): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def partitionDisjoint(self, A: List[int]) -> int: """max(left) <= min(right) similar to 2 in terms of keyboard stroke count""" <|body_0|> def partitionDisjoint_2(self, A: List[int]) -> int: """max(left) <= min(right)""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_10k_train_006907
1,705
no_license
[ { "docstring": "max(left) <= min(right) similar to 2 in terms of keyboard stroke count", "name": "partitionDisjoint", "signature": "def partitionDisjoint(self, A: List[int]) -> int" }, { "docstring": "max(left) <= min(right)", "name": "partitionDisjoint_2", "signature": "def partitionDis...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def partitionDisjoint(self, A: List[int]) -> int: max(left) <= min(right) similar to 2 in terms of keyboard stroke count - def partitionDisjoint_2(self, A: List[int]) -> int: max...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def partitionDisjoint(self, A: List[int]) -> int: max(left) <= min(right) similar to 2 in terms of keyboard stroke count - def partitionDisjoint_2(self, A: List[int]) -> int: max...
929dde1723fb2f54870c8a9badc80fc23e8400d3
<|skeleton|> class Solution: def partitionDisjoint(self, A: List[int]) -> int: """max(left) <= min(right) similar to 2 in terms of keyboard stroke count""" <|body_0|> def partitionDisjoint_2(self, A: List[int]) -> int: """max(left) <= min(right)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def partitionDisjoint(self, A: List[int]) -> int: """max(left) <= min(right) similar to 2 in terms of keyboard stroke count""" n = len(A) MX = [-float('inf') for _ in range(n + 1)] MI = [float('inf') for _ in range(n + 1)] for i in range(n): MX[i +...
the_stack_v2_python_sparse
_algorithms_challenges/leetcode/LeetCode/915 Partition Array into Disjoint Intervals.py
syurskyi/Algorithms_and_Data_Structure
train
4
3911f7185aac3929ed43dc52ff80c3b894a367ee
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\ntry:\n mapping_value = parse_node.get_child_node('@odata.type').get_str_value()\nexcept AttributeError:\n mapping_value = None\nif mapping_value and mapping_value.casefold() == '#microsoft.graph.win32LobAppFileSystemRule'.casefold():\n ...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') try: mapping_value = parse_node.get_child_node('@odata.type').get_str_value() except AttributeError: mapping_value = None if mapping_value and mapping_value.casefold() ==...
A base complex type to store the detection or requirement rule data for a Win32 LOB app.
Win32LobAppRule
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Win32LobAppRule: """A base complex type to store the detection or requirement rule data for a Win32 LOB app.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobAppRule: """Creates a new instance of the appropriate class based on discriminator valu...
stack_v2_sparse_classes_10k_train_006908
4,926
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: Win32LobAppRule", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_val...
3
null
Implement the Python class `Win32LobAppRule` described below. Class description: A base complex type to store the detection or requirement rule data for a Win32 LOB app. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobAppRule: Creates a new inst...
Implement the Python class `Win32LobAppRule` described below. Class description: A base complex type to store the detection or requirement rule data for a Win32 LOB app. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobAppRule: Creates a new inst...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Win32LobAppRule: """A base complex type to store the detection or requirement rule data for a Win32 LOB app.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobAppRule: """Creates a new instance of the appropriate class based on discriminator valu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Win32LobAppRule: """A base complex type to store the detection or requirement rule data for a Win32 LOB app.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobAppRule: """Creates a new instance of the appropriate class based on discriminator value Args: parse...
the_stack_v2_python_sparse
msgraph/generated/models/win32_lob_app_rule.py
microsoftgraph/msgraph-sdk-python
train
135
0bc268e0959ebd52db661aadc09388190f61175c
[ "super(Linker_complex, self).__init__()\nself.config = config\nself.encoder = encoder\nself.entity_embeddings_real = nn.Embedding(self.config.entity_size, self.config.embedding_dim)\nself.entity_embeddings_img = nn.Embedding(self.config.entity_size, self.config.embedding_dim)\nif self.config.priors:\n self.char_...
<|body_start_0|> super(Linker_complex, self).__init__() self.config = config self.encoder = encoder self.entity_embeddings_real = nn.Embedding(self.config.entity_size, self.config.embedding_dim) self.entity_embeddings_img = nn.Embedding(self.config.entity_size, self.config.embedd...
Linker_complex
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Linker_complex: def __init__(self, config, encoder): """:param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions""" <|body_0|> def forward(self, entity_candidates, mention_representation, sentence, char_sc...
stack_v2_sparse_classes_10k_train_006909
42,719
permissive
[ { "docstring": ":param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions", "name": "__init__", "signature": "def __init__(self, config, encoder)" }, { "docstring": ":return: unnormalized log probabilities (logits) of gold enti...
2
stack_v2_sparse_classes_30k_train_004588
Implement the Python class `Linker_complex` described below. Class description: Implement the Linker_complex class. Method signatures and docstrings: - def __init__(self, config, encoder): :param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions - ...
Implement the Python class `Linker_complex` described below. Class description: Implement the Linker_complex class. Method signatures and docstrings: - def __init__(self, config, encoder): :param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions - ...
6a7dcd7d3756327c61ef949e5b4f6af6e2849187
<|skeleton|> class Linker_complex: def __init__(self, config, encoder): """:param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions""" <|body_0|> def forward(self, entity_candidates, mention_representation, sentence, char_sc...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Linker_complex: def __init__(self, config, encoder): """:param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions""" super(Linker_complex, self).__init__() self.config = config self.encoder = encoder s...
the_stack_v2_python_sparse
typenet/src/model.py
dhruvdcoder/dl-with-constraints
train
0
24da3e2f5f2a4d1053868c84264d30811ad91d2b
[ "url = 'projects/%s/tags/%s' % (project_id, tag)\nresp, body = self.put(url, '{}')\nself.expected_success(201, resp.status)\nreturn rest_client.ResponseBody(resp, body)", "url = 'projects/%s/tags' % project_id\nresp, body = self.get(url)\nself.expected_success(200, resp.status)\nbody = json.loads(body)\nreturn re...
<|body_start_0|> url = 'projects/%s/tags/%s' % (project_id, tag) resp, body = self.put(url, '{}') self.expected_success(201, resp.status) return rest_client.ResponseBody(resp, body) <|end_body_0|> <|body_start_1|> url = 'projects/%s/tags' % project_id resp, body = self.g...
ProjectTagsClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectTagsClient: def update_project_tag(self, project_id, tag): """Updates the specified tag and adds it to the project's list of tags.""" <|body_0|> def list_project_tags(self, project_id): """List tags for a project.""" <|body_1|> def update_all_proj...
stack_v2_sparse_classes_10k_train_006910
3,220
permissive
[ { "docstring": "Updates the specified tag and adds it to the project's list of tags.", "name": "update_project_tag", "signature": "def update_project_tag(self, project_id, tag)" }, { "docstring": "List tags for a project.", "name": "list_project_tags", "signature": "def list_project_tags...
6
null
Implement the Python class `ProjectTagsClient` described below. Class description: Implement the ProjectTagsClient class. Method signatures and docstrings: - def update_project_tag(self, project_id, tag): Updates the specified tag and adds it to the project's list of tags. - def list_project_tags(self, project_id): L...
Implement the Python class `ProjectTagsClient` described below. Class description: Implement the ProjectTagsClient class. Method signatures and docstrings: - def update_project_tag(self, project_id, tag): Updates the specified tag and adds it to the project's list of tags. - def list_project_tags(self, project_id): L...
3932a799e620a20d7abf7b89e21b520683a1809b
<|skeleton|> class ProjectTagsClient: def update_project_tag(self, project_id, tag): """Updates the specified tag and adds it to the project's list of tags.""" <|body_0|> def list_project_tags(self, project_id): """List tags for a project.""" <|body_1|> def update_all_proj...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProjectTagsClient: def update_project_tag(self, project_id, tag): """Updates the specified tag and adds it to the project's list of tags.""" url = 'projects/%s/tags/%s' % (project_id, tag) resp, body = self.put(url, '{}') self.expected_success(201, resp.status) return r...
the_stack_v2_python_sparse
tempest/lib/services/identity/v3/project_tags_client.py
openstack/tempest
train
270
f6797c753535093d995b1fea07443c77cb3058f7
[ "if input_type == 'f':\n file = open(path, 'r')\nelif input_type == 's':\n file = path\nelse:\n raise exceptions.BadInputError(f'invalid input type {input_type}')\npdl = yaml.safe_load(file)\nself.type_checks = {'typedef': self.validate_typedef, 'component': self.validate_component, 'graph': self.validate_...
<|body_start_0|> if input_type == 'f': file = open(path, 'r') elif input_type == 's': file = path else: raise exceptions.BadInputError(f'invalid input type {input_type}') pdl = yaml.safe_load(file) self.type_checks = {'typedef': self.validate_t...
Represents a single PDL file.
File
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class File: """Represents a single PDL file.""" def __init__(self, path, input_type='f'): """Initialize a File object from a file's worth of PDL. The PDL file should contain exactly three fields: - name: the namespace that the file's contents belong in, - imports: a list of imports that th...
stack_v2_sparse_classes_10k_train_006911
5,874
permissive
[ { "docstring": "Initialize a File object from a file's worth of PDL. The PDL file should contain exactly three fields: - name: the namespace that the file's contents belong in, - imports: a list of imports that the file's contents use, - body: the body of PDL. Parameters ---------- path: string path should cont...
6
stack_v2_sparse_classes_30k_train_003722
Implement the Python class `File` described below. Class description: Represents a single PDL file. Method signatures and docstrings: - def __init__(self, path, input_type='f'): Initialize a File object from a file's worth of PDL. The PDL file should contain exactly three fields: - name: the namespace that the file's...
Implement the Python class `File` described below. Class description: Represents a single PDL file. Method signatures and docstrings: - def __init__(self, path, input_type='f'): Initialize a File object from a file's worth of PDL. The PDL file should contain exactly three fields: - name: the namespace that the file's...
345e7d47efdac04c2c5f70d55f83bd77acdbb511
<|skeleton|> class File: """Represents a single PDL file.""" def __init__(self, path, input_type='f'): """Initialize a File object from a file's worth of PDL. The PDL file should contain exactly three fields: - name: the namespace that the file's contents belong in, - imports: a list of imports that th...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class File: """Represents a single PDL file.""" def __init__(self, path, input_type='f'): """Initialize a File object from a file's worth of PDL. The PDL file should contain exactly three fields: - name: the namespace that the file's contents belong in, - imports: a list of imports that the file's cont...
the_stack_v2_python_sparse
topside/pdl/file.py
roguextech/Waterloo-Rocketry-topside
train
0
c02dc20e9e0c84b1eec4e24f2729b26e0afd166f
[ "logging.Handler.__init__(self)\nself.oqueue = out_queue\nself.session = None", "try:\n e_inf = record.exc_info\n if e_inf:\n dummy = self.format(record)\n record.exc_info = None\n dummy\n record.handle = self.session.handle if self.session is not None else None\n if self.session ...
<|body_start_0|> logging.Handler.__init__(self) self.oqueue = out_queue self.session = None <|end_body_0|> <|body_start_1|> try: e_inf = record.exc_info if e_inf: dummy = self.format(record) record.exc_info = None d...
Log handler that sends the log up the 'event pipe'. This is a rather novel solution that seems overlooked in documentation or exisiting code, try it!
IPCLogHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IPCLogHandler: """Log handler that sends the log up the 'event pipe'. This is a rather novel solution that seems overlooked in documentation or exisiting code, try it!""" def __init__(self, out_queue): """Constructor method, requires multiprocessing.Pipe""" <|body_0|> de...
stack_v2_sparse_classes_10k_train_006912
2,168
no_license
[ { "docstring": "Constructor method, requires multiprocessing.Pipe", "name": "__init__", "signature": "def __init__(self, out_queue)" }, { "docstring": "emit log record via IPC output queue", "name": "emit", "signature": "def emit(self, record)" } ]
2
stack_v2_sparse_classes_30k_train_001826
Implement the Python class `IPCLogHandler` described below. Class description: Log handler that sends the log up the 'event pipe'. This is a rather novel solution that seems overlooked in documentation or exisiting code, try it! Method signatures and docstrings: - def __init__(self, out_queue): Constructor method, re...
Implement the Python class `IPCLogHandler` described below. Class description: Log handler that sends the log up the 'event pipe'. This is a rather novel solution that seems overlooked in documentation or exisiting code, try it! Method signatures and docstrings: - def __init__(self, out_queue): Constructor method, re...
7b03a35f12d2b7a10fa4709b09107935c6f14000
<|skeleton|> class IPCLogHandler: """Log handler that sends the log up the 'event pipe'. This is a rather novel solution that seems overlooked in documentation or exisiting code, try it!""" def __init__(self, out_queue): """Constructor method, requires multiprocessing.Pipe""" <|body_0|> de...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IPCLogHandler: """Log handler that sends the log up the 'event pipe'. This is a rather novel solution that seems overlooked in documentation or exisiting code, try it!""" def __init__(self, out_queue): """Constructor method, requires multiprocessing.Pipe""" logging.Handler.__init__(self) ...
the_stack_v2_python_sparse
bbs/ipc.py
jonny290/yos-x84
train
2
015dcf019daa518cea756c0b30993eb52246411b
[ "if len(prices) < 2:\n return 0\ndp = [[[0 for _ in range(2)] for _ in range(k + 1)] for _ in range(len(prices))]\nfor i in range(1, k + 1):\n dp[0][i][0] = 0\n dp[0][i][1] = -prices[0]\nfor i in range(1, len(prices)):\n for j in range(1, k + 1):\n dp[i][j][0] = max(dp[i - 1][j][0], dp[i - 1][j][...
<|body_start_0|> if len(prices) < 2: return 0 dp = [[[0 for _ in range(2)] for _ in range(k + 1)] for _ in range(len(prices))] for i in range(1, k + 1): dp[0][i][0] = 0 dp[0][i][1] = -prices[0] for i in range(1, len(prices)): for j in range...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, k: int, prices: List[int]) -> int: """动态规划 方程为 dp[i][k][j] 0 <= i < len(prices) 表示天数 dp[i][k][0] 表示当前天未持股,有以下两种情况: 1. 昨天未持股今天也未持股 2. 昨天持股,今天卖出 dp[i][k][0] = max(dp[i - 1][k][0], dp[i - 1][k][1] + prices[i]) dp[i][k][1] 表示当前天持股,有以下两种情况: 1. 昨天持股,今天也持股 2. 昨天未持股...
stack_v2_sparse_classes_10k_train_006913
2,774
no_license
[ { "docstring": "动态规划 方程为 dp[i][k][j] 0 <= i < len(prices) 表示天数 dp[i][k][0] 表示当前天未持股,有以下两种情况: 1. 昨天未持股今天也未持股 2. 昨天持股,今天卖出 dp[i][k][0] = max(dp[i - 1][k][0], dp[i - 1][k][1] + prices[i]) dp[i][k][1] 表示当前天持股,有以下两种情况: 1. 昨天持股,今天也持股 2. 昨天未持股,今天买入 dp[i][k][1] = max(dp[i - 1][k][1], dp[i - 1][k - 1][0] - prices[i]) :p...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, k: int, prices: List[int]) -> int: 动态规划 方程为 dp[i][k][j] 0 <= i < len(prices) 表示天数 dp[i][k][0] 表示当前天未持股,有以下两种情况: 1. 昨天未持股今天也未持股 2. 昨天持股,今天卖出 dp[i][k][0] = max(...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, k: int, prices: List[int]) -> int: 动态规划 方程为 dp[i][k][j] 0 <= i < len(prices) 表示天数 dp[i][k][0] 表示当前天未持股,有以下两种情况: 1. 昨天未持股今天也未持股 2. 昨天持股,今天卖出 dp[i][k][0] = max(...
9acba92695c06406f12f997a720bfe1deb9464a8
<|skeleton|> class Solution: def maxProfit(self, k: int, prices: List[int]) -> int: """动态规划 方程为 dp[i][k][j] 0 <= i < len(prices) 表示天数 dp[i][k][0] 表示当前天未持股,有以下两种情况: 1. 昨天未持股今天也未持股 2. 昨天持股,今天卖出 dp[i][k][0] = max(dp[i - 1][k][0], dp[i - 1][k][1] + prices[i]) dp[i][k][1] 表示当前天持股,有以下两种情况: 1. 昨天持股,今天也持股 2. 昨天未持股...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, k: int, prices: List[int]) -> int: """动态规划 方程为 dp[i][k][j] 0 <= i < len(prices) 表示天数 dp[i][k][0] 表示当前天未持股,有以下两种情况: 1. 昨天未持股今天也未持股 2. 昨天持股,今天卖出 dp[i][k][0] = max(dp[i - 1][k][0], dp[i - 1][k][1] + prices[i]) dp[i][k][1] 表示当前天持股,有以下两种情况: 1. 昨天持股,今天也持股 2. 昨天未持股,今天买入 dp[i][k]...
the_stack_v2_python_sparse
datastructure/dp_exercise/MaxProfit5.py
yinhuax/leet_code
train
0
c1fb96d281ff340126642b38e421cb45381803dd
[ "config = current_app.cea_config\ndashboards = cea.plots.read_dashboards(config, current_app.plot_cache)\nreturn dashboard_to_dict(dashboards[dashboard_index])", "config = current_app.cea_config\ncea.plots.delete_dashboard(config, dashboard_index)\nreturn {'message': 'deleted dashboard'}", "form = api.payload\n...
<|body_start_0|> config = current_app.cea_config dashboards = cea.plots.read_dashboards(config, current_app.plot_cache) return dashboard_to_dict(dashboards[dashboard_index]) <|end_body_0|> <|body_start_1|> config = current_app.cea_config cea.plots.delete_dashboard(config, dashbo...
Dashboard
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dashboard: def get(self, dashboard_index): """Get Dashboard""" <|body_0|> def delete(self, dashboard_index): """Delete Dashboard""" <|body_1|> def patch(self, dashboard_index): """Update Dashboard properties""" <|body_2|> <|end_skeleton|...
stack_v2_sparse_classes_10k_train_006914
9,106
permissive
[ { "docstring": "Get Dashboard", "name": "get", "signature": "def get(self, dashboard_index)" }, { "docstring": "Delete Dashboard", "name": "delete", "signature": "def delete(self, dashboard_index)" }, { "docstring": "Update Dashboard properties", "name": "patch", "signatu...
3
null
Implement the Python class `Dashboard` described below. Class description: Implement the Dashboard class. Method signatures and docstrings: - def get(self, dashboard_index): Get Dashboard - def delete(self, dashboard_index): Delete Dashboard - def patch(self, dashboard_index): Update Dashboard properties
Implement the Python class `Dashboard` described below. Class description: Implement the Dashboard class. Method signatures and docstrings: - def get(self, dashboard_index): Get Dashboard - def delete(self, dashboard_index): Delete Dashboard - def patch(self, dashboard_index): Update Dashboard properties <|skeleton|...
b84bcefdfdfc2bc0e009b5284b74391a957995ac
<|skeleton|> class Dashboard: def get(self, dashboard_index): """Get Dashboard""" <|body_0|> def delete(self, dashboard_index): """Delete Dashboard""" <|body_1|> def patch(self, dashboard_index): """Update Dashboard properties""" <|body_2|> <|end_skeleton|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Dashboard: def get(self, dashboard_index): """Get Dashboard""" config = current_app.cea_config dashboards = cea.plots.read_dashboards(config, current_app.plot_cache) return dashboard_to_dict(dashboards[dashboard_index]) def delete(self, dashboard_index): """Delete ...
the_stack_v2_python_sparse
cea/interfaces/dashboard/api/dashboard.py
architecture-building-systems/CityEnergyAnalyst
train
166
ca813c490d8b9b04f642140945bdb8fe6c8f1aeb
[ "content_type = ContentType.objects.get_for_model(instance.__class__)\nqueryset = super(RateManager, self).filter(content_type=content_type, object_id=instance.id)\nreturn queryset", "try:\n my_avg = self.filter_by_model(instance).aggregate(Avg('rating'))\nexcept ZeroDivisionError:\n logging.error(error_han...
<|body_start_0|> content_type = ContentType.objects.get_for_model(instance.__class__) queryset = super(RateManager, self).filter(content_type=content_type, object_id=instance.id) return queryset <|end_body_0|> <|body_start_1|> try: my_avg = self.filter_by_model(instance).agg...
RateManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RateManager: def filter_by_model(self, instance): """filter kardane content bar assasse model""" <|body_0|> def avg_rate(self, instance, avg=0): """emtiaz dehi be post bar assasse rate entekhab shude (az 1 ta 5) taghsim bar tedad e user haey ke be in post emtiaz dada...
stack_v2_sparse_classes_10k_train_006915
2,877
permissive
[ { "docstring": "filter kardane content bar assasse model", "name": "filter_by_model", "signature": "def filter_by_model(self, instance)" }, { "docstring": "emtiaz dehi be post bar assasse rate entekhab shude (az 1 ta 5) taghsim bar tedad e user haey ke be in post emtiaz dadan", "name": "avg_...
2
stack_v2_sparse_classes_30k_train_006760
Implement the Python class `RateManager` described below. Class description: Implement the RateManager class. Method signatures and docstrings: - def filter_by_model(self, instance): filter kardane content bar assasse model - def avg_rate(self, instance, avg=0): emtiaz dehi be post bar assasse rate entekhab shude (az...
Implement the Python class `RateManager` described below. Class description: Implement the RateManager class. Method signatures and docstrings: - def filter_by_model(self, instance): filter kardane content bar assasse model - def avg_rate(self, instance, avg=0): emtiaz dehi be post bar assasse rate entekhab shude (az...
aef47922fdd6488550881ed9d42bf30a0d33a32a
<|skeleton|> class RateManager: def filter_by_model(self, instance): """filter kardane content bar assasse model""" <|body_0|> def avg_rate(self, instance, avg=0): """emtiaz dehi be post bar assasse rate entekhab shude (az 1 ta 5) taghsim bar tedad e user haey ke be in post emtiaz dada...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RateManager: def filter_by_model(self, instance): """filter kardane content bar assasse model""" content_type = ContentType.objects.get_for_model(instance.__class__) queryset = super(RateManager, self).filter(content_type=content_type, object_id=instance.id) return queryset ...
the_stack_v2_python_sparse
src/rates/models.py
m3h-D/Myinfoblog
train
0
6fadbdb7d59da050da98b6ebfaa1449f04b33e5f
[ "result = {'result': 'NG', 'error': ''}\ndata_json = request.get_json(force=True)\nflag, error = CtrlUserGroup().update_manager_group(data_json)\nif flag:\n result['result'] = 'OK'\nelse:\n result['error'] = error\nreturn result", "result = {'result': 'NG', 'error': ''}\nflag, error = CtrlUserGroup().delete...
<|body_start_0|> result = {'result': 'NG', 'error': ''} data_json = request.get_json(force=True) flag, error = CtrlUserGroup().update_manager_group(data_json) if flag: result['result'] = 'OK' else: result['error'] = error return result <|end_body_0...
项目体制组的删除与更新
ApiManagerGroup
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiManagerGroup: """项目体制组的删除与更新""" def post(self): """更新""" <|body_0|> def delete(self, proj_id, group_id, commit_user): """删除""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = {'result': 'NG', 'error': ''} data_json = request.get...
stack_v2_sparse_classes_10k_train_006916
3,031
no_license
[ { "docstring": "更新", "name": "post", "signature": "def post(self)" }, { "docstring": "删除", "name": "delete", "signature": "def delete(self, proj_id, group_id, commit_user)" } ]
2
stack_v2_sparse_classes_30k_train_002976
Implement the Python class `ApiManagerGroup` described below. Class description: 项目体制组的删除与更新 Method signatures and docstrings: - def post(self): 更新 - def delete(self, proj_id, group_id, commit_user): 删除
Implement the Python class `ApiManagerGroup` described below. Class description: 项目体制组的删除与更新 Method signatures and docstrings: - def post(self): 更新 - def delete(self, proj_id, group_id, commit_user): 删除 <|skeleton|> class ApiManagerGroup: """项目体制组的删除与更新""" def post(self): """更新""" <|body_0|>...
64b31e7bdfcb8a4c95f0a8a607f0bcff576cec11
<|skeleton|> class ApiManagerGroup: """项目体制组的删除与更新""" def post(self): """更新""" <|body_0|> def delete(self, proj_id, group_id, commit_user): """删除""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ApiManagerGroup: """项目体制组的删除与更新""" def post(self): """更新""" result = {'result': 'NG', 'error': ''} data_json = request.get_json(force=True) flag, error = CtrlUserGroup().update_manager_group(data_json) if flag: result['result'] = 'OK' else: ...
the_stack_v2_python_sparse
koala/koala_server/app/api_1_0/api_user_group.py
lsn1183/web_project
train
0
6d5ed1d2eb359dbfbee3cac333e9e97acd6e0ad6
[ "self.height = max(availheight, self.CODEBARHEIGHT)\nself.border = border\nif len(subtype) != 1 or subtype not in ascii_uppercase + string_digits:\n raise ValueError(\"Invalid subtype '%s'\" % subtype)\nif not number and len(prefix) > 6 or not prefix.isalnum():\n raise ValueError(\"Invalid prefix '%s'\" % pre...
<|body_start_0|> self.height = max(availheight, self.CODEBARHEIGHT) self.border = border if len(subtype) != 1 or subtype not in ascii_uppercase + string_digits: raise ValueError("Invalid subtype '%s'" % subtype) if not number and len(prefix) > 6 or not prefix.isalnum(): ...
Base class for LTO labels. Specification taken from "IBM LTO Ultrium Cartridge Label Specification, Revision 3" available on May 14th 2008 from : http://www-1.ibm.com/support/docview.wss?rs=543&context=STCVQ6R&q1=ssg1*&uid=ssg1S7000429&loc=en_US&cs=utf-8&lang=en+en
BaseLTOLabel
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseLTOLabel: """Base class for LTO labels. Specification taken from "IBM LTO Ultrium Cartridge Label Specification, Revision 3" available on May 14th 2008 from : http://www-1.ibm.com/support/docview.wss?rs=543&context=STCVQ6R&q1=ssg1*&uid=ssg1S7000429&loc=en_US&cs=utf-8&lang=en+en""" def __...
stack_v2_sparse_classes_10k_train_006917
7,377
permissive
[ { "docstring": "Initializes an LTO label. prefix : Up to six characters from [A-Z][0-9]. Defaults to \"\". number : Label's number or None. Defaults to None. subtype : LTO subtype string , e.g. \"1\" for LTO1. Defaults to \"1\". border : None, or the width of the label's border. Defaults to None. checksum : Boo...
2
stack_v2_sparse_classes_30k_train_002792
Implement the Python class `BaseLTOLabel` described below. Class description: Base class for LTO labels. Specification taken from "IBM LTO Ultrium Cartridge Label Specification, Revision 3" available on May 14th 2008 from : http://www-1.ibm.com/support/docview.wss?rs=543&context=STCVQ6R&q1=ssg1*&uid=ssg1S7000429&loc=e...
Implement the Python class `BaseLTOLabel` described below. Class description: Base class for LTO labels. Specification taken from "IBM LTO Ultrium Cartridge Label Specification, Revision 3" available on May 14th 2008 from : http://www-1.ibm.com/support/docview.wss?rs=543&context=STCVQ6R&q1=ssg1*&uid=ssg1S7000429&loc=e...
c28aa50e2d6d3451b47e114094a86c03c87d4c50
<|skeleton|> class BaseLTOLabel: """Base class for LTO labels. Specification taken from "IBM LTO Ultrium Cartridge Label Specification, Revision 3" available on May 14th 2008 from : http://www-1.ibm.com/support/docview.wss?rs=543&context=STCVQ6R&q1=ssg1*&uid=ssg1S7000429&loc=en_US&cs=utf-8&lang=en+en""" def __...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BaseLTOLabel: """Base class for LTO labels. Specification taken from "IBM LTO Ultrium Cartridge Label Specification, Revision 3" available on May 14th 2008 from : http://www-1.ibm.com/support/docview.wss?rs=543&context=STCVQ6R&q1=ssg1*&uid=ssg1S7000429&loc=en_US&cs=utf-8&lang=en+en""" def __init__(self, ...
the_stack_v2_python_sparse
src/reportlab/graphics/barcode/lto.py
MrBitBucket/reportlab-mirror
train
64
6fdcc72bc044065bd13d29e7e9e577c10cb1da1a
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Fido2KeyRestrictions()", "from .fido2_restriction_enforcement_type import Fido2RestrictionEnforcementType\nfrom .fido2_restriction_enforcement_type import Fido2RestrictionEnforcementType\nfields: Dict[str, Callable[[Any], None]] = {'aa...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return Fido2KeyRestrictions() <|end_body_0|> <|body_start_1|> from .fido2_restriction_enforcement_type import Fido2RestrictionEnforcementType from .fido2_restriction_enforcement_type import Fid...
Fido2KeyRestrictions
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Fido2KeyRestrictions: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Fido2KeyRestrictions: """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 ...
stack_v2_sparse_classes_10k_train_006918
3,446
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: Fido2KeyRestrictions", "name": "create_from_discriminator_value", "signature": "def create_from_discriminato...
3
null
Implement the Python class `Fido2KeyRestrictions` described below. Class description: Implement the Fido2KeyRestrictions class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Fido2KeyRestrictions: Creates a new instance of the appropriate class based o...
Implement the Python class `Fido2KeyRestrictions` described below. Class description: Implement the Fido2KeyRestrictions class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Fido2KeyRestrictions: Creates a new instance of the appropriate class based o...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Fido2KeyRestrictions: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Fido2KeyRestrictions: """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 ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Fido2KeyRestrictions: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Fido2KeyRestrictions: """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...
the_stack_v2_python_sparse
msgraph/generated/models/fido2_key_restrictions.py
microsoftgraph/msgraph-sdk-python
train
135
7c7aadf180f5945e5395d110ad6c651d698b224c
[ "if user is None:\n user = ctx.author\nwith utils.Embed(use_random_colour=True) as embed:\n embed.set_image(url=user.avatar_url)\nawait ctx.send(embed=embed)", "data = {'channel_name': ctx.channel.name, 'category_name': ctx.channel.category.name, 'guild_name': ctx.guild.name, 'guild_icon_url': str(ctx.guild...
<|body_start_0|> if user is None: user = ctx.author with utils.Embed(use_random_colour=True) as embed: embed.set_image(url=user.avatar_url) await ctx.send(embed=embed) <|end_body_0|> <|body_start_1|> data = {'channel_name': ctx.channel.name, 'category_name': ctx....
UserInfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserInfo: async def avatar(self, ctx: utils.Context, user: discord.User=None): """Shows you the avatar of a given user""" <|body_0|> async def createlog(self, ctx: utils.Context, amount: int=100): """Create a log of chat""" <|body_1|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_10k_train_006919
2,686
no_license
[ { "docstring": "Shows you the avatar of a given user", "name": "avatar", "signature": "async def avatar(self, ctx: utils.Context, user: discord.User=None)" }, { "docstring": "Create a log of chat", "name": "createlog", "signature": "async def createlog(self, ctx: utils.Context, amount: i...
2
stack_v2_sparse_classes_30k_train_005500
Implement the Python class `UserInfo` described below. Class description: Implement the UserInfo class. Method signatures and docstrings: - async def avatar(self, ctx: utils.Context, user: discord.User=None): Shows you the avatar of a given user - async def createlog(self, ctx: utils.Context, amount: int=100): Create...
Implement the Python class `UserInfo` described below. Class description: Implement the UserInfo class. Method signatures and docstrings: - async def avatar(self, ctx: utils.Context, user: discord.User=None): Shows you the avatar of a given user - async def createlog(self, ctx: utils.Context, amount: int=100): Create...
454a21afb33db5acc06e939caec8e545d762142e
<|skeleton|> class UserInfo: async def avatar(self, ctx: utils.Context, user: discord.User=None): """Shows you the avatar of a given user""" <|body_0|> async def createlog(self, ctx: utils.Context, amount: int=100): """Create a log of chat""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserInfo: async def avatar(self, ctx: utils.Context, user: discord.User=None): """Shows you the avatar of a given user""" if user is None: user = ctx.author with utils.Embed(use_random_colour=True) as embed: embed.set_image(url=user.avatar_url) await ctx...
the_stack_v2_python_sparse
cogs/user_info.py
fadedmax/Apple.Py
train
0
f9e05cc1bbfbe611d3785949ff87568079704d9a
[ "self.hass = hass\nself.loaded: dict[str, set[str]] = {}\nself.cache: dict[str, dict[str, dict[str, Any]]] = {}", "components_to_load = components - self.loaded.setdefault(language, set())\nif components_to_load:\n await self._async_load(language, components_to_load)\ncached = self.cache.get(language, {})\nret...
<|body_start_0|> self.hass = hass self.loaded: dict[str, set[str]] = {} self.cache: dict[str, dict[str, dict[str, Any]]] = {} <|end_body_0|> <|body_start_1|> components_to_load = components - self.loaded.setdefault(language, set()) if components_to_load: await self._...
Cache for flattened translations.
_TranslationCache
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _TranslationCache: """Cache for flattened translations.""" def __init__(self, hass: HomeAssistant) -> None: """Initialize the cache.""" <|body_0|> async def async_fetch(self, language: str, category: str, components: set[str]) -> list[dict[str, dict[str, Any]]]: ...
stack_v2_sparse_classes_10k_train_006920
10,520
permissive
[ { "docstring": "Initialize the cache.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant) -> None" }, { "docstring": "Load resources into the cache.", "name": "async_fetch", "signature": "async def async_fetch(self, language: str, category: str, components: set[st...
4
null
Implement the Python class `_TranslationCache` described below. Class description: Cache for flattened translations. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant) -> None: Initialize the cache. - async def async_fetch(self, language: str, category: str, components: set[str]) -> list[dict...
Implement the Python class `_TranslationCache` described below. Class description: Cache for flattened translations. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant) -> None: Initialize the cache. - async def async_fetch(self, language: str, category: str, components: set[str]) -> list[dict...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class _TranslationCache: """Cache for flattened translations.""" def __init__(self, hass: HomeAssistant) -> None: """Initialize the cache.""" <|body_0|> async def async_fetch(self, language: str, category: str, components: set[str]) -> list[dict[str, dict[str, Any]]]: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _TranslationCache: """Cache for flattened translations.""" def __init__(self, hass: HomeAssistant) -> None: """Initialize the cache.""" self.hass = hass self.loaded: dict[str, set[str]] = {} self.cache: dict[str, dict[str, dict[str, Any]]] = {} async def async_fetch(s...
the_stack_v2_python_sparse
homeassistant/helpers/translation.py
home-assistant/core
train
35,501
3ce597e3152c1182e3141e2370e04f1e61f2f2ad
[ "super(SelfAttention, self).__init__(options, is_training)\nif not isinstance(options, graph_network_pb2.SelfAttention):\n raise ValueError('Options has to be an SelfAttention proto.')\nself.add_bi_directional_edges = options.add_bi_directional_edges\nself.add_self_loop_edges = options.add_self_loop_edges", "n...
<|body_start_0|> super(SelfAttention, self).__init__(options, is_training) if not isinstance(options, graph_network_pb2.SelfAttention): raise ValueError('Options has to be an SelfAttention proto.') self.add_bi_directional_edges = options.add_bi_directional_edges self.add_self...
Self attention model using a RNN cell.
SelfAttention
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SelfAttention: """Self attention model using a RNN cell.""" def __init__(self, options, is_training=False): """Initializes the graph network. Args: options: proto to store the configs. is_training: if True, build the training graph.""" <|body_0|> def _build_graph(self, g...
stack_v2_sparse_classes_10k_train_006921
18,418
permissive
[ { "docstring": "Initializes the graph network. Args: options: proto to store the configs. is_training: if True, build the training graph.", "name": "__init__", "signature": "def __init__(self, options, is_training=False)" }, { "docstring": "Builds graph network. Args: graphs_tuple: A GraphTuple ...
2
stack_v2_sparse_classes_30k_train_001694
Implement the Python class `SelfAttention` described below. Class description: Self attention model using a RNN cell. Method signatures and docstrings: - def __init__(self, options, is_training=False): Initializes the graph network. Args: options: proto to store the configs. is_training: if True, build the training g...
Implement the Python class `SelfAttention` described below. Class description: Self attention model using a RNN cell. Method signatures and docstrings: - def __init__(self, options, is_training=False): Initializes the graph network. Args: options: proto to store the configs. is_training: if True, build the training g...
4d20dadffe7584ac2c7f26419960512380b8d06e
<|skeleton|> class SelfAttention: """Self attention model using a RNN cell.""" def __init__(self, options, is_training=False): """Initializes the graph network. Args: options: proto to store the configs. is_training: if True, build the training graph.""" <|body_0|> def _build_graph(self, g...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SelfAttention: """Self attention model using a RNN cell.""" def __init__(self, options, is_training=False): """Initializes the graph network. Args: options: proto to store the configs. is_training: if True, build the training graph.""" super(SelfAttention, self).__init__(options, is_train...
the_stack_v2_python_sparse
modeling/modules/graph_networks.py
yekeren/WSSGG
train
40
e9ee9f9afcb5ec4266e57963e3065a2b9d2cf24e
[ "self.encode_type = hyper_parameters['model'].get('encode_type', 'MAX')\nself.n_win = hyper_parameters['model'].get('n_win', 3)\nsuper().__init__(hyper_parameters)", "super().create_model(hyper_parameters)\nembedding = self.word_embedding.output\n\ndef win_mean(x):\n res_list = []\n for i in range(self.len_...
<|body_start_0|> self.encode_type = hyper_parameters['model'].get('encode_type', 'MAX') self.n_win = hyper_parameters['model'].get('n_win', 3) super().__init__(hyper_parameters) <|end_body_0|> <|body_start_1|> super().create_model(hyper_parameters) embedding = self.word_embeddin...
SWEMGraph
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SWEMGraph: def __init__(self, hyper_parameters): """初始化 :param hyper_parameters: json,超参""" <|body_0|> def create_model(self, hyper_parameters): """构建神经网络 :param hyper_parameters:json, hyper parameters of network :return: tensor, moedl""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_10k_train_006922
2,341
permissive
[ { "docstring": "初始化 :param hyper_parameters: json,超参", "name": "__init__", "signature": "def __init__(self, hyper_parameters)" }, { "docstring": "构建神经网络 :param hyper_parameters:json, hyper parameters of network :return: tensor, moedl", "name": "create_model", "signature": "def create_mod...
2
stack_v2_sparse_classes_30k_train_004606
Implement the Python class `SWEMGraph` described below. Class description: Implement the SWEMGraph class. Method signatures and docstrings: - def __init__(self, hyper_parameters): 初始化 :param hyper_parameters: json,超参 - def create_model(self, hyper_parameters): 构建神经网络 :param hyper_parameters:json, hyper parameters of ...
Implement the Python class `SWEMGraph` described below. Class description: Implement the SWEMGraph class. Method signatures and docstrings: - def __init__(self, hyper_parameters): 初始化 :param hyper_parameters: json,超参 - def create_model(self, hyper_parameters): 构建神经网络 :param hyper_parameters:json, hyper parameters of ...
640e3f44f90d9d8046546f7e1a93a29ebe5c8d30
<|skeleton|> class SWEMGraph: def __init__(self, hyper_parameters): """初始化 :param hyper_parameters: json,超参""" <|body_0|> def create_model(self, hyper_parameters): """构建神经网络 :param hyper_parameters:json, hyper parameters of network :return: tensor, moedl""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SWEMGraph: def __init__(self, hyper_parameters): """初始化 :param hyper_parameters: json,超参""" self.encode_type = hyper_parameters['model'].get('encode_type', 'MAX') self.n_win = hyper_parameters['model'].get('n_win', 3) super().__init__(hyper_parameters) def create_model(sel...
the_stack_v2_python_sparse
keras_textclassification/m15_SWEM/graph.py
wzjames/Keras-TextClassification
train
1
835296b8bf555f955db865bc87f64328015dced8
[ "super(TransformerEncoderLayer, self).__init__()\nself.layer_norm = nn.LayerNorm(size, eps=1e-06)\nself.src_src_att = MultiHeadedAttention(num_heads, size, dropout=dropout)\nself.feed_forward = PositionwiseFeedForward(input_size=size, ff_size=ff_size, dropout=dropout)\nself.dropout = nn.Dropout(dropout)\nself.size ...
<|body_start_0|> super(TransformerEncoderLayer, self).__init__() self.layer_norm = nn.LayerNorm(size, eps=1e-06) self.src_src_att = MultiHeadedAttention(num_heads, size, dropout=dropout) self.feed_forward = PositionwiseFeedForward(input_size=size, ff_size=ff_size, dropout=dropout) ...
One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer.
TransformerEncoderLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerEncoderLayer: """One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer.""" def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1): """A single Transformer layer. :param size: :param ff_size: :p...
stack_v2_sparse_classes_10k_train_006923
6,117
no_license
[ { "docstring": "A single Transformer layer. :param size: :param ff_size: :param num_heads: :param dropout:", "name": "__init__", "signature": "def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1)" }, { "docstring": "Forward pass for a single transformer encoder l...
2
stack_v2_sparse_classes_30k_train_004164
Implement the Python class `TransformerEncoderLayer` described below. Class description: One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer. Method signatures and docstrings: - def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1): A ...
Implement the Python class `TransformerEncoderLayer` described below. Class description: One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer. Method signatures and docstrings: - def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1): A ...
e213665be8d3820fa2fc0aa9afe9949fd2e3d488
<|skeleton|> class TransformerEncoderLayer: """One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer.""" def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1): """A single Transformer layer. :param size: :param ff_size: :p...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TransformerEncoderLayer: """One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer.""" def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1): """A single Transformer layer. :param size: :param ff_size: :param num_head...
the_stack_v2_python_sparse
modules/transformer_layers.py
zqp111/transformer_ar
train
1
ef8495f4415279d10c485d25a04cdbe32618085a
[ "if threshold is None:\n threshold = self._threshold\nif self._classifier is not None:\n top_matches = min(top_matches, self._matcher_tup.length - 1)\n dists, inds = self._classifier.search(np.array(emb).astype('float32'), k=top_matches)\n dists = np.squeeze(dists).tolist()\n inds = np.squeeze(inds)....
<|body_start_0|> if threshold is None: threshold = self._threshold if self._classifier is not None: top_matches = min(top_matches, self._matcher_tup.length - 1) dists, inds = self._classifier.search(np.array(emb).astype('float32'), k=top_matches) dists = n...
Classify face id using Faiss
FaissMatcher
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FaissMatcher: """Classify face id using Faiss""" def match(self, emb, top_matches=Config.Matcher.MAX_TOP_MATCHES, threshold=None, return_dists=False, always_return_closest=True): """See superclass doc""" <|body_0|> def fit(self, embs, labels): """Fit current matc...
stack_v2_sparse_classes_10k_train_006924
16,051
no_license
[ { "docstring": "See superclass doc", "name": "match", "signature": "def match(self, emb, top_matches=Config.Matcher.MAX_TOP_MATCHES, threshold=None, return_dists=False, always_return_closest=True)" }, { "docstring": "Fit current matcher to new embs and labels :param embs: list of embs :param lab...
3
stack_v2_sparse_classes_30k_train_002495
Implement the Python class `FaissMatcher` described below. Class description: Classify face id using Faiss Method signatures and docstrings: - def match(self, emb, top_matches=Config.Matcher.MAX_TOP_MATCHES, threshold=None, return_dists=False, always_return_closest=True): See superclass doc - def fit(self, embs, labe...
Implement the Python class `FaissMatcher` described below. Class description: Classify face id using Faiss Method signatures and docstrings: - def match(self, emb, top_matches=Config.Matcher.MAX_TOP_MATCHES, threshold=None, return_dists=False, always_return_closest=True): See superclass doc - def fit(self, embs, labe...
0f97af4e110b0e8de8d1b9f18fcd3f69c69b54cc
<|skeleton|> class FaissMatcher: """Classify face id using Faiss""" def match(self, emb, top_matches=Config.Matcher.MAX_TOP_MATCHES, threshold=None, return_dists=False, always_return_closest=True): """See superclass doc""" <|body_0|> def fit(self, embs, labels): """Fit current matc...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FaissMatcher: """Classify face id using Faiss""" def match(self, emb, top_matches=Config.Matcher.MAX_TOP_MATCHES, threshold=None, return_dists=False, always_return_closest=True): """See superclass doc""" if threshold is None: threshold = self._threshold if self._classi...
the_stack_v2_python_sparse
src/matcher.py
duongle98/Face-Rec
train
1
1a24651b2c711492f6dd3e6a6596b57059001220
[ "self.leads, self.times, count = ([], times, {})\nlead = -1\nfor p, t in zip(persons, times):\n count[p] = count.get(p, 0) + 1\n if count.get(lead, 0) <= count[p]:\n lead = p\n self.leads.append(lead)", "l, r = (0, len(self.times) - 1)\nwhile l <= r:\n mid = (l + r) // 2\n if self.times[mid]...
<|body_start_0|> self.leads, self.times, count = ([], times, {}) lead = -1 for p, t in zip(persons, times): count[p] = count.get(p, 0) + 1 if count.get(lead, 0) <= count[p]: lead = p self.leads.append(lead) <|end_body_0|> <|body_start_1|> ...
TopVotedCandidate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TopVotedCandidate: def __init__(self, persons, times): """:type persons: List[int] :type times: List[int]""" <|body_0|> def q(self, t): """:type t: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.leads, self.times, count = ([], ...
stack_v2_sparse_classes_10k_train_006925
1,680
no_license
[ { "docstring": ":type persons: List[int] :type times: List[int]", "name": "__init__", "signature": "def __init__(self, persons, times)" }, { "docstring": ":type t: int :rtype: int", "name": "q", "signature": "def q(self, t)" } ]
2
null
Implement the Python class `TopVotedCandidate` described below. Class description: Implement the TopVotedCandidate class. Method signatures and docstrings: - def __init__(self, persons, times): :type persons: List[int] :type times: List[int] - def q(self, t): :type t: int :rtype: int
Implement the Python class `TopVotedCandidate` described below. Class description: Implement the TopVotedCandidate class. Method signatures and docstrings: - def __init__(self, persons, times): :type persons: List[int] :type times: List[int] - def q(self, t): :type t: int :rtype: int <|skeleton|> class TopVotedCandi...
035ef08434fa1ca781a6fb2f9eed3538b7d20c02
<|skeleton|> class TopVotedCandidate: def __init__(self, persons, times): """:type persons: List[int] :type times: List[int]""" <|body_0|> def q(self, t): """:type t: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TopVotedCandidate: def __init__(self, persons, times): """:type persons: List[int] :type times: List[int]""" self.leads, self.times, count = ([], times, {}) lead = -1 for p, t in zip(persons, times): count[p] = count.get(p, 0) + 1 if count.get(lead, 0) <...
the_stack_v2_python_sparse
leetcode_python/Binary_Search/online-election.py
yennanliu/CS_basics
train
64
feb813fbd495df89816e1555c0653a3a62f6879c
[ "userBag = hallitem.itemSystem.loadUserAssets(self.userId).getUserBag()\nitemPermanent = userBag.getItemByKindId(config.PERMANENT_MONTH_CARD_KINDID)\nitem = userBag.getItemByKindId(config.MONTH_CARD_KINDID)\ngiftList = []\nfor giftId in self.giftListConf:\n giftConf = config.getGiftConf(self.clientId, giftId)\n ...
<|body_start_0|> userBag = hallitem.itemSystem.loadUserAssets(self.userId).getUserBag() itemPermanent = userBag.getItemByKindId(config.PERMANENT_MONTH_CARD_KINDID) item = userBag.getItemByKindId(config.MONTH_CARD_KINDID) giftList = [] for giftId in self.giftListConf: ...
月卡礼包
MonthCardGift
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MonthCardGift: """月卡礼包""" def getCurrentGiftConf(self): """获取当前可显示礼包的配置""" <|body_0|> def getGiftInfo(self): """获取礼包信息""" <|body_1|> def addGiftData(self, giftId): """使礼包变为可领取状态并添加礼包数据""" <|body_2|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_10k_train_006926
26,749
no_license
[ { "docstring": "获取当前可显示礼包的配置", "name": "getCurrentGiftConf", "signature": "def getCurrentGiftConf(self)" }, { "docstring": "获取礼包信息", "name": "getGiftInfo", "signature": "def getGiftInfo(self)" }, { "docstring": "使礼包变为可领取状态并添加礼包数据", "name": "addGiftData", "signature": "def...
3
stack_v2_sparse_classes_30k_train_005071
Implement the Python class `MonthCardGift` described below. Class description: 月卡礼包 Method signatures and docstrings: - def getCurrentGiftConf(self): 获取当前可显示礼包的配置 - def getGiftInfo(self): 获取礼包信息 - def addGiftData(self, giftId): 使礼包变为可领取状态并添加礼包数据
Implement the Python class `MonthCardGift` described below. Class description: 月卡礼包 Method signatures and docstrings: - def getCurrentGiftConf(self): 获取当前可显示礼包的配置 - def getGiftInfo(self): 获取礼包信息 - def addGiftData(self, giftId): 使礼包变为可领取状态并添加礼包数据 <|skeleton|> class MonthCardGift: """月卡礼包""" def getCurrentGif...
fa1591863985a418fd361eb6dac36d1301bc1231
<|skeleton|> class MonthCardGift: """月卡礼包""" def getCurrentGiftConf(self): """获取当前可显示礼包的配置""" <|body_0|> def getGiftInfo(self): """获取礼包信息""" <|body_1|> def addGiftData(self, giftId): """使礼包变为可领取状态并添加礼包数据""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MonthCardGift: """月卡礼包""" def getCurrentGiftConf(self): """获取当前可显示礼包的配置""" userBag = hallitem.itemSystem.loadUserAssets(self.userId).getUserBag() itemPermanent = userBag.getItemByKindId(config.PERMANENT_MONTH_CARD_KINDID) item = userBag.getItemByKindId(config.MONTH_CARD_KI...
the_stack_v2_python_sparse
learn_tu_you/wx_superboss/trunk/hall37-newfish/src/newfish/entity/gift/gift_system.py
isoundy000/learn_python
train
0
f076b38a31c15a6ce54a7ff1c79162ccfe17464d
[ "x_values = []\ny_values = []\nfor i, row in enumerate(grid):\n for j, val in enumerate(row):\n if val == 1:\n x_values.append(i)\n y_values.append(j)\nx_values.sort()\ny_values.sort()\nif x_values:\n return self.get_min_dist(x_values) + self.get_min_dist(y_values)\nelse:\n ret...
<|body_start_0|> x_values = [] y_values = [] for i, row in enumerate(grid): for j, val in enumerate(row): if val == 1: x_values.append(i) y_values.append(j) x_values.sort() y_values.sort() if x_values: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minTotalDistance(self, grid): """:type grid: List[List[int]] :rtype: int""" <|body_0|> def get_min_dist(self, arr): """https://en.wikipedia.org/wiki/Median_absolute_deviation.""" <|body_1|> <|end_skeleton|> <|body_start_0|> x_values = ...
stack_v2_sparse_classes_10k_train_006927
1,717
no_license
[ { "docstring": ":type grid: List[List[int]] :rtype: int", "name": "minTotalDistance", "signature": "def minTotalDistance(self, grid)" }, { "docstring": "https://en.wikipedia.org/wiki/Median_absolute_deviation.", "name": "get_min_dist", "signature": "def get_min_dist(self, arr)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minTotalDistance(self, grid): :type grid: List[List[int]] :rtype: int - def get_min_dist(self, arr): https://en.wikipedia.org/wiki/Median_absolute_deviation.
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minTotalDistance(self, grid): :type grid: List[List[int]] :rtype: int - def get_min_dist(self, arr): https://en.wikipedia.org/wiki/Median_absolute_deviation. <|skeleton|> cl...
33c623f226981942780751554f0593f2c71cf458
<|skeleton|> class Solution: def minTotalDistance(self, grid): """:type grid: List[List[int]] :rtype: int""" <|body_0|> def get_min_dist(self, arr): """https://en.wikipedia.org/wiki/Median_absolute_deviation.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def minTotalDistance(self, grid): """:type grid: List[List[int]] :rtype: int""" x_values = [] y_values = [] for i, row in enumerate(grid): for j, val in enumerate(row): if val == 1: x_values.append(i) ...
the_stack_v2_python_sparse
math/leetcode_Best_Meeting_Point.py
monkeylyf/interviewjam
train
59
f71fb29799963828121804cc9c7f55e535a96040
[ "for i in range(1, len(nums)):\n nums[i] += nums[i - 1]\nself.nums = nums", "if i == 0:\n return self.nums[j]\nreturn self.nums[j] - self.nums[i - 1]" ]
<|body_start_0|> for i in range(1, len(nums)): nums[i] += nums[i - 1] self.nums = nums <|end_body_0|> <|body_start_1|> if i == 0: return self.nums[j] return self.nums[j] - self.nums[i - 1] <|end_body_1|>
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> for i in range(1, len(nums)): nums[i] += nums[i...
stack_v2_sparse_classes_10k_train_006928
1,602
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type j: int :rtype: int", "name": "sumRange", "signature": "def sumRange(self, i, j)" } ]
2
stack_v2_sparse_classes_30k_test_000192
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int <|skeleton|> class NumArray: def __init__(self, nums): ...
c53264340a71305dd6c715b4408b5dec408ef2cc
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NumArray: def __init__(self, nums): """:type nums: List[int]""" for i in range(1, len(nums)): nums[i] += nums[i - 1] self.nums = nums def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" if i == 0: return self.nums[j] ...
the_stack_v2_python_sparse
range-sum-query-immutable.py
seattlegirl/leetcode
train
0
e7a4d250251990927c740af6e38f019b72b7430e
[ "if self.doctype:\n yield '<!doctype html{}>'.format(self.doctypes[self.doctype])\nyield from super().header()\nyield '<html>'\nreturn", "if isinstance(document, str):\n yield document\n return\nif isinstance(document, Exception):\n yield str(document)\n return\nyield from super().body(document=doc...
<|body_start_0|> if self.doctype: yield '<!doctype html{}>'.format(self.doctypes[self.doctype]) yield from super().header() yield '<html>' return <|end_body_0|> <|body_start_1|> if isinstance(document, str): yield document return if is...
Support for HTML
HTML
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HTML: """Support for HTML""" def header(self): """Layout the {document} using my stationery for the header""" <|body_0|> def body(self, document=(), **kwds): """The body of the document""" <|body_1|> def footer(self): """Layout the {document}...
stack_v2_sparse_classes_10k_train_006929
2,137
permissive
[ { "docstring": "Layout the {document} using my stationery for the header", "name": "header", "signature": "def header(self)" }, { "docstring": "The body of the document", "name": "body", "signature": "def body(self, document=(), **kwds)" }, { "docstring": "Layout the {document} u...
3
null
Implement the Python class `HTML` described below. Class description: Support for HTML Method signatures and docstrings: - def header(self): Layout the {document} using my stationery for the header - def body(self, document=(), **kwds): The body of the document - def footer(self): Layout the {document} using my stati...
Implement the Python class `HTML` described below. Class description: Support for HTML Method signatures and docstrings: - def header(self): Layout the {document} using my stationery for the header - def body(self, document=(), **kwds): The body of the document - def footer(self): Layout the {document} using my stati...
d741c44ffb3e9e1f726bf492202ac8738bb4aa1c
<|skeleton|> class HTML: """Support for HTML""" def header(self): """Layout the {document} using my stationery for the header""" <|body_0|> def body(self, document=(), **kwds): """The body of the document""" <|body_1|> def footer(self): """Layout the {document}...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HTML: """Support for HTML""" def header(self): """Layout the {document} using my stationery for the header""" if self.doctype: yield '<!doctype html{}>'.format(self.doctypes[self.doctype]) yield from super().header() yield '<html>' return def body(...
the_stack_v2_python_sparse
packages/pyre/weaver/HTML.py
pyre/pyre
train
27
40bf947af3f03c23acc7fc10efb7893380ce96a9
[ "owner_id = request.manager.id\nexsign = app_models.exSign.objects(owner_id=owner_id)\nif exsign.count() > 0:\n exsign = exsign[0]\n is_create_new_data = False\n project_id = 'new_app:exsign:%s' % exsign.related_page_id\nelse:\n exsign = None\n is_create_new_data = True\n project_id = 'new_app:exs...
<|body_start_0|> owner_id = request.manager.id exsign = app_models.exSign.objects(owner_id=owner_id) if exsign.count() > 0: exsign = exsign[0] is_create_new_data = False project_id = 'new_app:exsign:%s' % exsign.related_page_id else: exsign...
exSign
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class exSign: def get(request): """响应GET""" <|body_0|> def api_put(request): """响应PUT""" <|body_1|> def api_post(request): """响应POST""" <|body_2|> <|end_skeleton|> <|body_start_0|> owner_id = request.manager.id exsign = app_mo...
stack_v2_sparse_classes_10k_train_006930
3,317
no_license
[ { "docstring": "响应GET", "name": "get", "signature": "def get(request)" }, { "docstring": "响应PUT", "name": "api_put", "signature": "def api_put(request)" }, { "docstring": "响应POST", "name": "api_post", "signature": "def api_post(request)" } ]
3
null
Implement the Python class `exSign` described below. Class description: Implement the exSign class. Method signatures and docstrings: - def get(request): 响应GET - def api_put(request): 响应PUT - def api_post(request): 响应POST
Implement the Python class `exSign` described below. Class description: Implement the exSign class. Method signatures and docstrings: - def get(request): 响应GET - def api_put(request): 响应PUT - def api_post(request): 响应POST <|skeleton|> class exSign: def get(request): """响应GET""" <|body_0|> d...
8b2f7befe92841bcc35e0e60cac5958ef3f3af54
<|skeleton|> class exSign: def get(request): """响应GET""" <|body_0|> def api_put(request): """响应PUT""" <|body_1|> def api_post(request): """响应POST""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class exSign: def get(request): """响应GET""" owner_id = request.manager.id exsign = app_models.exSign.objects(owner_id=owner_id) if exsign.count() > 0: exsign = exsign[0] is_create_new_data = False project_id = 'new_app:exsign:%s' % exsign.related_p...
the_stack_v2_python_sparse
weapp/apps/customerized_apps/exsign/exsign.py
chengdg/weizoom
train
1
e88f654ea304df2031b12a019ec4815fc6c65348
[ "super(GreedyPCTRAgent, self).__init__(action_space)\nself._choice_model = choice_model\nself._belief_state = belief_state", "del reward\ndoc_obs = observation['doc']\nself._choice_model.score_documents(self._belief_state, doc_obs.values())\nslate = self.findBestDocuments(self._choice_model.scores)\nlogging.debug...
<|body_start_0|> super(GreedyPCTRAgent, self).__init__(action_space) self._choice_model = choice_model self._belief_state = belief_state <|end_body_0|> <|body_start_1|> del reward doc_obs = observation['doc'] self._choice_model.score_documents(self._belief_state, doc_obs...
An agent that recommends slates with the highest pCTR items. This agent assumes knowledge of the true underlying choice model. Note that this implicitly means it receives observations of the true user and document states. This agent myopically creates slates with items that have the highest probability of being clicked...
GreedyPCTRAgent
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GreedyPCTRAgent: """An agent that recommends slates with the highest pCTR items. This agent assumes knowledge of the true underlying choice model. Note that this implicitly means it receives observations of the true user and document states. This agent myopically creates slates with items that ha...
stack_v2_sparse_classes_10k_train_006931
3,737
permissive
[ { "docstring": "Initializes a new greedy pCTR agent. Args: action_space: A gym.spaces object that specifies the format of actions belief_state: An instantiation of AbstractUserState assumed by the agent choice_model: An instantiation of AbstractChoiceModel assumed by the agent Default to a multinomial logit cho...
3
stack_v2_sparse_classes_30k_train_000001
Implement the Python class `GreedyPCTRAgent` described below. Class description: An agent that recommends slates with the highest pCTR items. This agent assumes knowledge of the true underlying choice model. Note that this implicitly means it receives observations of the true user and document states. This agent myopi...
Implement the Python class `GreedyPCTRAgent` described below. Class description: An agent that recommends slates with the highest pCTR items. This agent assumes knowledge of the true underlying choice model. Note that this implicitly means it receives observations of the true user and document states. This agent myopi...
63fcacb177a029196abe57910bde88f737d5cca0
<|skeleton|> class GreedyPCTRAgent: """An agent that recommends slates with the highest pCTR items. This agent assumes knowledge of the true underlying choice model. Note that this implicitly means it receives observations of the true user and document states. This agent myopically creates slates with items that ha...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GreedyPCTRAgent: """An agent that recommends slates with the highest pCTR items. This agent assumes knowledge of the true underlying choice model. Note that this implicitly means it receives observations of the true user and document states. This agent myopically creates slates with items that have the highes...
the_stack_v2_python_sparse
recsim/agents/greedy_pctr_agent.py
kittipatv/recsim-no-tf
train
1
912b6eb073c8bb0b49a0df46e7999a3f8716df9f
[ "eps_space = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nd_space = [100, 1000, 10000]\nfor eps in eps_space:\n for d in d_space:\n gamma, _ = privunit.find_best_gamma(d, eps)\n self.assertLessEqual(0, gamma)\n self.assertLessEqual(gamma, 1)\n if gamma <= np.sqrt(np.pi / (2 * (d - 1))) * (np.exp(...
<|body_start_0|> eps_space = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] d_space = [100, 1000, 10000] for eps in eps_space: for d in d_space: gamma, _ = privunit.find_best_gamma(d, eps) self.assertLessEqual(0, gamma) self.assertLessEqual(gamma, 1) ...
PrivunitTest
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrivunitTest: def test_gamma_is_in_range(self): """Test whether gamma adheres to (16a) or (16b) in the original paper.""" <|body_0|> def test_c2_is_less_equal_c1(self): """Tests if c2 is less than or equal to c1.""" <|body_1|> def test_m_is_less_equal_on...
stack_v2_sparse_classes_10k_train_006932
3,348
permissive
[ { "docstring": "Test whether gamma adheres to (16a) or (16b) in the original paper.", "name": "test_gamma_is_in_range", "signature": "def test_gamma_is_in_range(self)" }, { "docstring": "Tests if c2 is less than or equal to c1.", "name": "test_c2_is_less_equal_c1", "signature": "def test...
4
null
Implement the Python class `PrivunitTest` described below. Class description: Implement the PrivunitTest class. Method signatures and docstrings: - def test_gamma_is_in_range(self): Test whether gamma adheres to (16a) or (16b) in the original paper. - def test_c2_is_less_equal_c1(self): Tests if c2 is less than or eq...
Implement the Python class `PrivunitTest` described below. Class description: Implement the PrivunitTest class. Method signatures and docstrings: - def test_gamma_is_in_range(self): Test whether gamma adheres to (16a) or (16b) in the original paper. - def test_c2_is_less_equal_c1(self): Tests if c2 is less than or eq...
329e60fa56b87f691303638ceb9dfa1fc5083953
<|skeleton|> class PrivunitTest: def test_gamma_is_in_range(self): """Test whether gamma adheres to (16a) or (16b) in the original paper.""" <|body_0|> def test_c2_is_less_equal_c1(self): """Tests if c2 is less than or equal to c1.""" <|body_1|> def test_m_is_less_equal_on...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PrivunitTest: def test_gamma_is_in_range(self): """Test whether gamma adheres to (16a) or (16b) in the original paper.""" eps_space = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] d_space = [100, 1000, 10000] for eps in eps_space: for d in d_space: gamma, _ = priv...
the_stack_v2_python_sparse
rcc_dp/mean_estimation/privunit_test.py
google-research/federated
train
595
0f2090733ed508c29f786b2b06ca5d9aeb6f63e6
[ "self.server, self.clients = (NfsServer(server), [NfsClient(server, client) for client in clients])\nself.directory_to_share = directory_to_share\nself.directory_to_mount = directory_to_mount", "self.server.share(self.directory_to_share, privileges=privileges)\nfor client in self.clients:\n client.mount(self.d...
<|body_start_0|> self.server, self.clients = (NfsServer(server), [NfsClient(server, client) for client in clients]) self.directory_to_share = directory_to_share self.directory_to_mount = directory_to_mount <|end_body_0|> <|body_start_1|> self.server.share(self.directory_to_share, privil...
NfsConnection
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NfsConnection: def __init__(self, server, clients, directory_to_share, directory_to_mount): """Shares a folder across multiple clients using NFS. Shares `directory_to_share` on `server` across `clients` mounting the shared folder at `directory_to_mount`.""" <|body_0|> def sh...
stack_v2_sparse_classes_10k_train_006933
4,906
permissive
[ { "docstring": "Shares a folder across multiple clients using NFS. Shares `directory_to_share` on `server` across `clients` mounting the shared folder at `directory_to_mount`.", "name": "__init__", "signature": "def __init__(self, server, clients, directory_to_share, directory_to_mount)" }, { "d...
4
null
Implement the Python class `NfsConnection` described below. Class description: Implement the NfsConnection class. Method signatures and docstrings: - def __init__(self, server, clients, directory_to_share, directory_to_mount): Shares a folder across multiple clients using NFS. Shares `directory_to_share` on `server` ...
Implement the Python class `NfsConnection` described below. Class description: Implement the NfsConnection class. Method signatures and docstrings: - def __init__(self, server, clients, directory_to_share, directory_to_mount): Shares a folder across multiple clients using NFS. Shares `directory_to_share` on `server` ...
4882e593be50cecbebb2e6bf7b95dcce82324ea1
<|skeleton|> class NfsConnection: def __init__(self, server, clients, directory_to_share, directory_to_mount): """Shares a folder across multiple clients using NFS. Shares `directory_to_share` on `server` across `clients` mounting the shared folder at `directory_to_mount`.""" <|body_0|> def sh...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NfsConnection: def __init__(self, server, clients, directory_to_share, directory_to_mount): """Shares a folder across multiple clients using NFS. Shares `directory_to_share` on `server` across `clients` mounting the shared folder at `directory_to_mount`.""" self.server, self.clients = (NfsServ...
the_stack_v2_python_sparse
lib/nfs.py
couchbaselabs/TAF
train
16
1b78c7d9d8a926db4786577ea8ebd650eecd1d3c
[ "super(LandmarkGeneratorHeatmap, self).__init__(dim, output_size, landmark_indizes, landmark_flip_pairs, data_format, pre_transformation, post_transformation)\nself.output_size_np = list(reversed(self.output_size))\nself.sigma = sigma\nself.scale_factor = scale_factor\nself.normalize_center = normalize_center", "...
<|body_start_0|> super(LandmarkGeneratorHeatmap, self).__init__(dim, output_size, landmark_indizes, landmark_flip_pairs, data_format, pre_transformation, post_transformation) self.output_size_np = list(reversed(self.output_size)) self.sigma = sigma self.scale_factor = scale_factor ...
Generates images of Gaussian heatmaps
LandmarkGeneratorHeatmap
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LandmarkGeneratorHeatmap: """Generates images of Gaussian heatmaps""" def __init__(self, dim, output_size, sigma, scale_factor, normalize_center, landmark_indizes=None, landmark_flip_pairs=None, data_format='channels_first', pre_transformation=None, post_transformation=None): """Init...
stack_v2_sparse_classes_10k_train_006934
16,690
no_license
[ { "docstring": "Initializer :param output_size: output image size :param sigma: Gaussian sigma :param scale_factor: heatmap scale factor, each value of the Gaussian will be multiplied with this value :param normalize_center: if True, the value on the center is set to scale_factor otherwise, the default gaussian...
2
stack_v2_sparse_classes_30k_train_000293
Implement the Python class `LandmarkGeneratorHeatmap` described below. Class description: Generates images of Gaussian heatmaps Method signatures and docstrings: - def __init__(self, dim, output_size, sigma, scale_factor, normalize_center, landmark_indizes=None, landmark_flip_pairs=None, data_format='channels_first',...
Implement the Python class `LandmarkGeneratorHeatmap` described below. Class description: Generates images of Gaussian heatmaps Method signatures and docstrings: - def __init__(self, dim, output_size, sigma, scale_factor, normalize_center, landmark_indizes=None, landmark_flip_pairs=None, data_format='channels_first',...
ef6cee91264ba1fe6b40d9823a07647b95bcc2c4
<|skeleton|> class LandmarkGeneratorHeatmap: """Generates images of Gaussian heatmaps""" def __init__(self, dim, output_size, sigma, scale_factor, normalize_center, landmark_indizes=None, landmark_flip_pairs=None, data_format='channels_first', pre_transformation=None, post_transformation=None): """Init...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LandmarkGeneratorHeatmap: """Generates images of Gaussian heatmaps""" def __init__(self, dim, output_size, sigma, scale_factor, normalize_center, landmark_indizes=None, landmark_flip_pairs=None, data_format='channels_first', pre_transformation=None, post_transformation=None): """Initializer :para...
the_stack_v2_python_sparse
generators/landmark_generator.py
XiaoweiXu/MedicalDataAugmentationTool
train
1
59a00023644ee296d04b160e1830cad931a7ff6d
[ "self.env.revert_snapshot('deploy_ha_elasticsearch_kibana')\ntarget_node = {'slave-03': ['controller']}\nself.helpers.remove_nodes_from_cluster(target_node)\nself.check_plugin_online()\nself.helpers.run_ostf(should_fail=1)\nself.helpers.add_nodes_to_cluster(target_node)\nself.check_plugin_online()\nself.helpers.run...
<|body_start_0|> self.env.revert_snapshot('deploy_ha_elasticsearch_kibana') target_node = {'slave-03': ['controller']} self.helpers.remove_nodes_from_cluster(target_node) self.check_plugin_online() self.helpers.run_ostf(should_fail=1) self.helpers.add_nodes_to_cluster(tar...
Class for system tests for Elasticsearch-Kibana plugin.
TestNodesElasticsearchPlugin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestNodesElasticsearchPlugin: """Class for system tests for Elasticsearch-Kibana plugin.""" def add_remove_controller_elasticsearch_kibana(self): """Verify that the number of controllers can scale up and down Scenario: 1. Revert snapshot with 9 deployed nodes in HA configuration 2. R...
stack_v2_sparse_classes_10k_train_006935
7,162
no_license
[ { "docstring": "Verify that the number of controllers can scale up and down Scenario: 1. Revert snapshot with 9 deployed nodes in HA configuration 2. Remove one controller node and redeploy the cluster 3. Check that Elasticsearch/Kibana are running 4. Run OSTF 5. Add one controller node (return previous state) ...
5
stack_v2_sparse_classes_30k_train_003377
Implement the Python class `TestNodesElasticsearchPlugin` described below. Class description: Class for system tests for Elasticsearch-Kibana plugin. Method signatures and docstrings: - def add_remove_controller_elasticsearch_kibana(self): Verify that the number of controllers can scale up and down Scenario: 1. Rever...
Implement the Python class `TestNodesElasticsearchPlugin` described below. Class description: Class for system tests for Elasticsearch-Kibana plugin. Method signatures and docstrings: - def add_remove_controller_elasticsearch_kibana(self): Verify that the number of controllers can scale up and down Scenario: 1. Rever...
179249df2d206eeabb3955c9dc8cb78cac3c36c6
<|skeleton|> class TestNodesElasticsearchPlugin: """Class for system tests for Elasticsearch-Kibana plugin.""" def add_remove_controller_elasticsearch_kibana(self): """Verify that the number of controllers can scale up and down Scenario: 1. Revert snapshot with 9 deployed nodes in HA configuration 2. R...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestNodesElasticsearchPlugin: """Class for system tests for Elasticsearch-Kibana plugin.""" def add_remove_controller_elasticsearch_kibana(self): """Verify that the number of controllers can scale up and down Scenario: 1. Revert snapshot with 9 deployed nodes in HA configuration 2. Remove one con...
the_stack_v2_python_sparse
stacklight_tests/elasticsearch_kibana/test_system.py
rkhozinov/stacklight-integration-tests
train
1
942eb998d26bbb8b953c19ed6b3837aae7ed7fce
[ "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...
A service account is a special type of Google account that belongs to your application or a virtual machine (VM), instead of to an individual end user. Your application assumes the identity of the service account to call Google APIs, so that the users aren't directly involved. Service account credentials are used to te...
IAMCredentialsServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IAMCredentialsServicer: """A service account is a special type of Google account that belongs to your application or a virtual machine (VM), instead of to an individual end user. Your application assumes the identity of the service account to call Google APIs, so that the users aren't directly in...
stack_v2_sparse_classes_10k_train_006936
5,869
permissive
[ { "docstring": "Generates an OAuth 2.0 access token for a service account.", "name": "GenerateAccessToken", "signature": "def GenerateAccessToken(self, request, context)" }, { "docstring": "Generates an OpenID Connect ID token for a service account.", "name": "GenerateIdToken", "signatur...
4
stack_v2_sparse_classes_30k_train_007214
Implement the Python class `IAMCredentialsServicer` described below. Class description: A service account is a special type of Google account that belongs to your application or a virtual machine (VM), instead of to an individual end user. Your application assumes the identity of the service account to call Google API...
Implement the Python class `IAMCredentialsServicer` described below. Class description: A service account is a special type of Google account that belongs to your application or a virtual machine (VM), instead of to an individual end user. Your application assumes the identity of the service account to call Google API...
d897d56bce03d1fda98b79afb08264e51d46c421
<|skeleton|> class IAMCredentialsServicer: """A service account is a special type of Google account that belongs to your application or a virtual machine (VM), instead of to an individual end user. Your application assumes the identity of the service account to call Google APIs, so that the users aren't directly in...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IAMCredentialsServicer: """A service account is a special type of Google account that belongs to your application or a virtual machine (VM), instead of to an individual end user. Your application assumes the identity of the service account to call Google APIs, so that the users aren't directly involved. Servi...
the_stack_v2_python_sparse
iam/google/cloud/iam_credentials_v1/proto/iamcredentials_pb2_grpc.py
tswast/google-cloud-python
train
1
b5a11abdbed5c40b1a3a49a3d4794ca10c94c4fd
[ "if not is_exe(exe_path):\n msg = '{0} is not an executable'.format(exe_path)\n raise NotExecutableError(msg)\nself._exe_path = exe_path", "assert lreads != rreads\nself.__build_cmd(lreads, rreads, threads, outdir, prefix)\nif dry_run:\n return self._cmd\npipe = subprocess.run(self._cmd, shell=True, stdo...
<|body_start_0|> if not is_exe(exe_path): msg = '{0} is not an executable'.format(exe_path) raise NotExecutableError(msg) self._exe_path = exe_path <|end_body_0|> <|body_start_1|> assert lreads != rreads self.__build_cmd(lreads, rreads, threads, outdir, prefix) ...
Class for working with PEAR
Pear
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pear: """Class for working with PEAR""" def __init__(self, exe_path): """Instantiate with location of executable""" <|body_0|> def run(self, lreads, rreads, threads, outdir, prefix, dry_run=False): """Run PEAR to merge passed read files - lreads - forward reads -...
stack_v2_sparse_classes_10k_train_006937
3,102
permissive
[ { "docstring": "Instantiate with location of executable", "name": "__init__", "signature": "def __init__(self, exe_path)" }, { "docstring": "Run PEAR to merge passed read files - lreads - forward reads - rreads - reverse reads - threads - number of threads for pear to use - outdir - output direc...
3
stack_v2_sparse_classes_30k_train_000840
Implement the Python class `Pear` described below. Class description: Class for working with PEAR Method signatures and docstrings: - def __init__(self, exe_path): Instantiate with location of executable - def run(self, lreads, rreads, threads, outdir, prefix, dry_run=False): Run PEAR to merge passed read files - lre...
Implement the Python class `Pear` described below. Class description: Class for working with PEAR Method signatures and docstrings: - def __init__(self, exe_path): Instantiate with location of executable - def run(self, lreads, rreads, threads, outdir, prefix, dry_run=False): Run PEAR to merge passed read files - lre...
a3c64198aad3709a5c4d969f48ae0af11fdc25db
<|skeleton|> class Pear: """Class for working with PEAR""" def __init__(self, exe_path): """Instantiate with location of executable""" <|body_0|> def run(self, lreads, rreads, threads, outdir, prefix, dry_run=False): """Run PEAR to merge passed read files - lreads - forward reads -...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Pear: """Class for working with PEAR""" def __init__(self, exe_path): """Instantiate with location of executable""" if not is_exe(exe_path): msg = '{0} is not an executable'.format(exe_path) raise NotExecutableError(msg) self._exe_path = exe_path def r...
the_stack_v2_python_sparse
metapy/pycits/pear.py
peterthorpe5/public_scripts
train
35
ef0d35f80da8d9ee84f69a6605a7c3240511ecbb
[ "urls = response.css('ul li a::attr(\"href\")')\nprint('urls', urls)\nfor url in urls.re('/pickup/\\\\d+$'):\n yield response.follow(url, self.parse_topics)", "item = Headline()\nitem['title'] = response.css('title::text').get()\nitem['body'] = response.css('article p.sc-inlrYM').xpath('string()').get()\nyield...
<|body_start_0|> urls = response.css('ul li a::attr("href")') print('urls', urls) for url in urls.re('/pickup/\\d+$'): yield response.follow(url, self.parse_topics) <|end_body_0|> <|body_start_1|> item = Headline() item['title'] = response.css('title::text').get() ...
NewsSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NewsSpider: def parse(self, response): """トップページのトピックス一覧からここのトピックスへのリンクを抜き出して表示する Args: response ([type]): [description]""" <|body_0|> def parse_topics(self, response): """トピックスのページからタイトルと本文を抜き出す Args: response ([type]): [description]""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_10k_train_006938
1,225
no_license
[ { "docstring": "トップページのトピックス一覧からここのトピックスへのリンクを抜き出して表示する Args: response ([type]): [description]", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "トピックスのページからタイトルと本文を抜き出す Args: response ([type]): [description]", "name": "parse_topics", "signature": "def parse_t...
2
stack_v2_sparse_classes_30k_train_000145
Implement the Python class `NewsSpider` described below. Class description: Implement the NewsSpider class. Method signatures and docstrings: - def parse(self, response): トップページのトピックス一覧からここのトピックスへのリンクを抜き出して表示する Args: response ([type]): [description] - def parse_topics(self, response): トピックスのページからタイトルと本文を抜き出す Args: re...
Implement the Python class `NewsSpider` described below. Class description: Implement the NewsSpider class. Method signatures and docstrings: - def parse(self, response): トップページのトピックス一覧からここのトピックスへのリンクを抜き出して表示する Args: response ([type]): [description] - def parse_topics(self, response): トピックスのページからタイトルと本文を抜き出す Args: re...
f65681a6a1e478d0ac051d3bea8e7a354d2245d3
<|skeleton|> class NewsSpider: def parse(self, response): """トップページのトピックス一覧からここのトピックスへのリンクを抜き出して表示する Args: response ([type]): [description]""" <|body_0|> def parse_topics(self, response): """トピックスのページからタイトルと本文を抜き出す Args: response ([type]): [description]""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NewsSpider: def parse(self, response): """トップページのトピックス一覧からここのトピックスへのリンクを抜き出して表示する Args: response ([type]): [description]""" urls = response.css('ul li a::attr("href")') print('urls', urls) for url in urls.re('/pickup/\\d+$'): yield response.follow(url, self.parse_to...
the_stack_v2_python_sparse
chapter6/myproject/myproject/spiders/news.py
OtsukaTomoaki/PythonCrawlingScraping
train
0
9e228db3324cd172bbea850b528bb89d8db00247
[ "self.val = int(x)\nself.next = next\nself.random = random", "res, node = ([], self)\nwhile node:\n rand = node.random.val if node.random else None\n res.append([node.val, rand])\n node = node.next\nreturn res" ]
<|body_start_0|> self.val = int(x) self.next = next self.random = random <|end_body_0|> <|body_start_1|> res, node = ([], self) while node: rand = node.random.val if node.random else None res.append([node.val, rand]) node = node.next r...
Node
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Node: def __init__(self, x: int, next: 'Node'=None, random: 'Node'=None): """Provided by LeetCode.""" <|body_0|> def _path(self): """Used for testing. Returns the path of the linked list. Each element is the node's value, and the value of it's random node.""" ...
stack_v2_sparse_classes_10k_train_006939
1,851
no_license
[ { "docstring": "Provided by LeetCode.", "name": "__init__", "signature": "def __init__(self, x: int, next: 'Node'=None, random: 'Node'=None)" }, { "docstring": "Used for testing. Returns the path of the linked list. Each element is the node's value, and the value of it's random node.", "name...
2
null
Implement the Python class `Node` described below. Class description: Implement the Node class. Method signatures and docstrings: - def __init__(self, x: int, next: 'Node'=None, random: 'Node'=None): Provided by LeetCode. - def _path(self): Used for testing. Returns the path of the linked list. Each element is the no...
Implement the Python class `Node` described below. Class description: Implement the Node class. Method signatures and docstrings: - def __init__(self, x: int, next: 'Node'=None, random: 'Node'=None): Provided by LeetCode. - def _path(self): Used for testing. Returns the path of the linked list. Each element is the no...
c6d600bc74afd14e00d4f0ffed40696192b229c3
<|skeleton|> class Node: def __init__(self, x: int, next: 'Node'=None, random: 'Node'=None): """Provided by LeetCode.""" <|body_0|> def _path(self): """Used for testing. Returns the path of the linked list. Each element is the node's value, and the value of it's random node.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Node: def __init__(self, x: int, next: 'Node'=None, random: 'Node'=None): """Provided by LeetCode.""" self.val = int(x) self.next = next self.random = random def _path(self): """Used for testing. Returns the path of the linked list. Each element is the node's value...
the_stack_v2_python_sparse
python/Monthly/Feb2021/listrandompointerdeepcopy.py
Hilldrupca/LeetCode
train
0
f9e7fead436b149db2096f71f4c710d2a1a0881a
[ "comp = lambda x, y: 0 if x == y else -1 if x < y else 1\nself.sa = mysort([document[i:] for i in range(len(document))], comp)\npass", "out = []\nfor x in range(0, len(self.sa)):\n sub = self.sa[x]\n if searchstr == sub[0:len(searchstr)]:\n out.append(x)\n return out\npass", "for x in self.s...
<|body_start_0|> comp = lambda x, y: 0 if x == y else -1 if x < y else 1 self.sa = mysort([document[i:] for i in range(len(document))], comp) pass <|end_body_0|> <|body_start_1|> out = [] for x in range(0, len(self.sa)): sub = self.sa[x] if searchstr == s...
SuffixArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SuffixArray: def __init__(self, document: str): """Creates a suffix array for document (a string).""" <|body_0|> def positions(self, searchstr: str): """Returns all the positions of searchstr in the documented indexed by the suffix array.""" <|body_1|> d...
stack_v2_sparse_classes_10k_train_006940
8,672
no_license
[ { "docstring": "Creates a suffix array for document (a string).", "name": "__init__", "signature": "def __init__(self, document: str)" }, { "docstring": "Returns all the positions of searchstr in the documented indexed by the suffix array.", "name": "positions", "signature": "def positio...
3
stack_v2_sparse_classes_30k_train_006104
Implement the Python class `SuffixArray` described below. Class description: Implement the SuffixArray class. Method signatures and docstrings: - def __init__(self, document: str): Creates a suffix array for document (a string). - def positions(self, searchstr: str): Returns all the positions of searchstr in the docu...
Implement the Python class `SuffixArray` described below. Class description: Implement the SuffixArray class. Method signatures and docstrings: - def __init__(self, document: str): Creates a suffix array for document (a string). - def positions(self, searchstr: str): Returns all the positions of searchstr in the docu...
b4edf759b2916ab44f08741a6f19b103a9070203
<|skeleton|> class SuffixArray: def __init__(self, document: str): """Creates a suffix array for document (a string).""" <|body_0|> def positions(self, searchstr: str): """Returns all the positions of searchstr in the documented indexed by the suffix array.""" <|body_1|> d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SuffixArray: def __init__(self, document: str): """Creates a suffix array for document (a string).""" comp = lambda x, y: 0 if x == y else -1 if x < y else 1 self.sa = mysort([document[i:] for i in range(len(document))], comp) pass def positions(self, searchstr: str): ...
the_stack_v2_python_sparse
lab03/lab03.py
saronson/cs331-s21-jmallett2
train
2
3568cd4d8e40eee95f0a9716ba528f99e476e69f
[ "super(CoordinateInfo, self).__init__()\nself.name = name\nself.generic_level = False\nself.generic_lev_coords = {}\nself.axis = ''\n'Axis'\nself.value = ''\n'Coordinate value'\nself.standard_name = ''\n'Standard name'\nself.long_name = ''\n'Long name'\nself.out_name = ''\n'\\n Out name\\n\\n This is ...
<|body_start_0|> super(CoordinateInfo, self).__init__() self.name = name self.generic_level = False self.generic_lev_coords = {} self.axis = '' 'Axis' self.value = '' 'Coordinate value' self.standard_name = '' 'Standard name' self.l...
Class to read and store coordinate information.
CoordinateInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoordinateInfo: """Class to read and store coordinate information.""" def __init__(self, name): """Class to read and store coordinate information. Parameters ---------- name: str coordinate's name""" <|body_0|> def read_json(self, json_data): """Read coordinate i...
stack_v2_sparse_classes_10k_train_006941
34,873
permissive
[ { "docstring": "Class to read and store coordinate information. Parameters ---------- name: str coordinate's name", "name": "__init__", "signature": "def __init__(self, name)" }, { "docstring": "Read coordinate information from json. Non-present options will be set to empty Parameters ----------...
2
null
Implement the Python class `CoordinateInfo` described below. Class description: Class to read and store coordinate information. Method signatures and docstrings: - def __init__(self, name): Class to read and store coordinate information. Parameters ---------- name: str coordinate's name - def read_json(self, json_dat...
Implement the Python class `CoordinateInfo` described below. Class description: Class to read and store coordinate information. Method signatures and docstrings: - def __init__(self, name): Class to read and store coordinate information. Parameters ---------- name: str coordinate's name - def read_json(self, json_dat...
d5187438fea2928644cb53ecb26c6adb1e4cc947
<|skeleton|> class CoordinateInfo: """Class to read and store coordinate information.""" def __init__(self, name): """Class to read and store coordinate information. Parameters ---------- name: str coordinate's name""" <|body_0|> def read_json(self, json_data): """Read coordinate i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CoordinateInfo: """Class to read and store coordinate information.""" def __init__(self, name): """Class to read and store coordinate information. Parameters ---------- name: str coordinate's name""" super(CoordinateInfo, self).__init__() self.name = name self.generic_leve...
the_stack_v2_python_sparse
esmvalcore/cmor/table.py
ESMValGroup/ESMValCore
train
41
90d43a7b693fbf55f060706e1fdba5436b054ebe
[ "if context is None:\n context = {}\ndata = self.read(cr, uid, ids, context=context)[0]\nobj_account_move = self.pool.get('account.move')\nwf_service = netsvc.LocalService('workflow')\ndomain = [('state', '=', 'closed'), ('date', '>=', data['date_from']), ('date', '<=', data['date_to'])]\nif data['period_id']:\n...
<|body_start_0|> if context is None: context = {} data = self.read(cr, uid, ids, context=context)[0] obj_account_move = self.pool.get('account.move') wf_service = netsvc.LocalService('workflow') domain = [('state', '=', 'closed'), ('date', '>=', data['date_from']), ('...
This model to close moves in special period
account_close_period
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class account_close_period: """This model to close moves in special period""" def get_moves(self, cr, uid, ids, context=None): """Get All moves belong not in draft, posted or reversed state @return: dictionary of values""" <|body_0|> def close_period(self, cr, uid, ids, contex...
stack_v2_sparse_classes_10k_train_006942
3,896
no_license
[ { "docstring": "Get All moves belong not in draft, posted or reversed state @return: dictionary of values", "name": "get_moves", "signature": "def get_moves(self, cr, uid, ids, context=None)" }, { "docstring": "Validate all accounts belong in consolidation account or not @return: dictionary of v...
2
null
Implement the Python class `account_close_period` described below. Class description: This model to close moves in special period Method signatures and docstrings: - def get_moves(self, cr, uid, ids, context=None): Get All moves belong not in draft, posted or reversed state @return: dictionary of values - def close_p...
Implement the Python class `account_close_period` described below. Class description: This model to close moves in special period Method signatures and docstrings: - def get_moves(self, cr, uid, ids, context=None): Get All moves belong not in draft, posted or reversed state @return: dictionary of values - def close_p...
0b997095c260d58b026440967fea3a202bef7efb
<|skeleton|> class account_close_period: """This model to close moves in special period""" def get_moves(self, cr, uid, ids, context=None): """Get All moves belong not in draft, posted or reversed state @return: dictionary of values""" <|body_0|> def close_period(self, cr, uid, ids, contex...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class account_close_period: """This model to close moves in special period""" def get_moves(self, cr, uid, ids, context=None): """Get All moves belong not in draft, posted or reversed state @return: dictionary of values""" if context is None: context = {} data = self.read(cr...
the_stack_v2_python_sparse
v_7/Dongola/ntc/account_ntc/wizard/account_close_period.py
musabahmed/baba
train
0
b8af26faeb4444367f05b43d3ffe9fba193942e1
[ "obj = context.object\nif obj is None:\n return False\nreturn all([bool(obj), obj.type == 'MESH', obj.mode == 'EDIT'])", "scene = context.scene\npg = scene.pdt_pg\nobj = bpy.context.view_layer.objects.active\nif obj is None:\n self.report({'ERROR'}, PDT_ERR_NO_ACT_OBJ)\n return {'FINISHED'}\nif obj.mode ...
<|body_start_0|> obj = context.object if obj is None: return False return all([bool(obj), obj.type == 'MESH', obj.mode == 'EDIT']) <|end_body_0|> <|body_start_1|> scene = context.scene pg = scene.pdt_pg obj = bpy.context.view_layer.objects.active if o...
Rotate Selected Vertices about Pivot Point in View Plane
PDT_OT_ViewPlaneRotate
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PDT_OT_ViewPlaneRotate: """Rotate Selected Vertices about Pivot Point in View Plane""" def poll(cls, context): """Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing.""" <|body_0|> def execute(self, context): """Rotate Selected Vert...
stack_v2_sparse_classes_10k_train_006943
13,734
permissive
[ { "docstring": "Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing.", "name": "poll", "signature": "def poll(cls, context)" }, { "docstring": "Rotate Selected Vertices about Pivot Point. Note: Rotates any selected vertices about the Pivot Point in View Oriented co...
2
null
Implement the Python class `PDT_OT_ViewPlaneRotate` described below. Class description: Rotate Selected Vertices about Pivot Point in View Plane Method signatures and docstrings: - def poll(cls, context): Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing. - def execute(self, context):...
Implement the Python class `PDT_OT_ViewPlaneRotate` described below. Class description: Rotate Selected Vertices about Pivot Point in View Plane Method signatures and docstrings: - def poll(cls, context): Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing. - def execute(self, context):...
4d5c304878c1e0018d97c1b07bcaa3981632265a
<|skeleton|> class PDT_OT_ViewPlaneRotate: """Rotate Selected Vertices about Pivot Point in View Plane""" def poll(cls, context): """Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing.""" <|body_0|> def execute(self, context): """Rotate Selected Vert...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PDT_OT_ViewPlaneRotate: """Rotate Selected Vertices about Pivot Point in View Plane""" def poll(cls, context): """Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing.""" obj = context.object if obj is None: return False return all...
the_stack_v2_python_sparse
src/bpy/3.6/scripts/addons/precision_drawing_tools/pdt_pivot_point.py
RnoB/3DVisualSwarm
train
0
58f08e42e09cfd43ed70b3b55c7b0c876f8f68e7
[ "format_date = lambda d: d.date().strftime('%d.%m.%Y')\ndate_from, date_till = get_datetime_from_till(7)\nsubject = cls.get_full_subject('Подборка материалов %s-%s' % (format_date(date_from), format_date(date_till)))\ncontext = {'date_from': date_from.timestamp(), 'date_till': date_till.timestamp()}\ncls(subject, c...
<|body_start_0|> format_date = lambda d: d.date().strftime('%d.%m.%Y') date_from, date_till = get_datetime_from_till(7) subject = cls.get_full_subject('Подборка материалов %s-%s' % (format_date(date_from), format_date(date_till))) context = {'date_from': date_from.timestamp(), 'date_till...
Класс реализующий рассылку с подборкой новых материалов сайта (сводку).
PythonzEmailDigest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PythonzEmailDigest: """Класс реализующий рассылку с подборкой новых материалов сайта (сводку).""" def create(cls): """Создаёт депеши для рассылки еженедельной сводки. Реальная компиляция сводки происходит в compile(). :return:""" <|body_0|> def get_realms_data(cls, date_...
stack_v2_sparse_classes_10k_train_006944
16,316
no_license
[ { "docstring": "Создаёт депеши для рассылки еженедельной сводки. Реальная компиляция сводки происходит в compile(). :return:", "name": "create", "signature": "def create(cls)" }, { "docstring": "Возвращает данные о материалах за указанный период. :param date date_from: Дата начала периода :param...
5
stack_v2_sparse_classes_30k_train_003662
Implement the Python class `PythonzEmailDigest` described below. Class description: Класс реализующий рассылку с подборкой новых материалов сайта (сводку). Method signatures and docstrings: - def create(cls): Создаёт депеши для рассылки еженедельной сводки. Реальная компиляция сводки происходит в compile(). :return: ...
Implement the Python class `PythonzEmailDigest` described below. Class description: Класс реализующий рассылку с подборкой новых материалов сайта (сводку). Method signatures and docstrings: - def create(cls): Создаёт депеши для рассылки еженедельной сводки. Реальная компиляция сводки происходит в compile(). :return: ...
8d5d41755f33b7850af677ba0a2f26cba823daf9
<|skeleton|> class PythonzEmailDigest: """Класс реализующий рассылку с подборкой новых материалов сайта (сводку).""" def create(cls): """Создаёт депеши для рассылки еженедельной сводки. Реальная компиляция сводки происходит в compile(). :return:""" <|body_0|> def get_realms_data(cls, date_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PythonzEmailDigest: """Класс реализующий рассылку с подборкой новых материалов сайта (сводку).""" def create(cls): """Создаёт депеши для рассылки еженедельной сводки. Реальная компиляция сводки происходит в compile(). :return:""" format_date = lambda d: d.date().strftime('%d.%m.%Y') ...
the_stack_v2_python_sparse
apps/sitemessages.py
GraceAredel/pythonz
train
1
aae9886c497007d76f76c70320050dbe0dabddec
[ "size = len(candidates)\nif size <= 0:\n return []\ncandidates.sort()\npath = []\nres = []\nself._find_path(target, path, res, candidates, 0, size)\nreturn res", "if target == 0:\n res.append(path.copy())\nelse:\n for i in range(begin, size):\n left_num = target - candidates[i]\n if left_nu...
<|body_start_0|> size = len(candidates) if size <= 0: return [] candidates.sort() path = [] res = [] self._find_path(target, path, res, candidates, 0, size) return res <|end_body_0|> <|body_start_1|> if target == 0: res.append(path...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: """回溯法,层层递减,得到符合条件的路径就加入结果集中,超出则剪枝; 主要是要注意一些细节,避免重复等;""" <|body_0|> def _find_path(self, target, path, res, candidates, begin, size): """沿着路径往下走""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_10k_train_006945
2,269
no_license
[ { "docstring": "回溯法,层层递减,得到符合条件的路径就加入结果集中,超出则剪枝; 主要是要注意一些细节,避免重复等;", "name": "combinationSum", "signature": "def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]" }, { "docstring": "沿着路径往下走", "name": "_find_path", "signature": "def _find_path(self, target, path...
2
stack_v2_sparse_classes_30k_train_004083
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: 回溯法,层层递减,得到符合条件的路径就加入结果集中,超出则剪枝; 主要是要注意一些细节,避免重复等; - def _find_path(self, target, path, res, cand...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: 回溯法,层层递减,得到符合条件的路径就加入结果集中,超出则剪枝; 主要是要注意一些细节,避免重复等; - def _find_path(self, target, path, res, cand...
13e9f74be18949875b271a742b1dfe87485ff3a2
<|skeleton|> class Solution: def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: """回溯法,层层递减,得到符合条件的路径就加入结果集中,超出则剪枝; 主要是要注意一些细节,避免重复等;""" <|body_0|> def _find_path(self, target, path, res, candidates, begin, size): """沿着路径往下走""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: """回溯法,层层递减,得到符合条件的路径就加入结果集中,超出则剪枝; 主要是要注意一些细节,避免重复等;""" size = len(candidates) if size <= 0: return [] candidates.sort() path = [] res = [] self._find...
the_stack_v2_python_sparse
39_Combination_Sum.py
Joker-Jerome/leetcode
train
1
29cc16fb0d99d057a0938bdae89ef34b38679c34
[ "self.file = file\nself.bills = {'5': [], '10': [], '20': [], '50': [], '100': []}\nif len(self.file) != 0:\n with open(self.file, 'r') as f:\n text = f.read().splitlines()\n for line in text:\n if line.split(' ')[1] == '5':\n self.bills['5'].append(line.split(' ')[0])\n ...
<|body_start_0|> self.file = file self.bills = {'5': [], '10': [], '20': [], '50': [], '100': []} if len(self.file) != 0: with open(self.file, 'r') as f: text = f.read().splitlines() for line in text: if line.split(' ')[1] == '5': ...
WatchList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WatchList: def __init__(self, file=''): """This method takes in a filename and initializes a dictionary by the name of bills which contains serial numbers of all the denominations contained as keys.It also checks if the lists in the keys of bills are sorted and uses regex module to check...
stack_v2_sparse_classes_10k_train_006946
4,514
no_license
[ { "docstring": "This method takes in a filename and initializes a dictionary by the name of bills which contains serial numbers of all the denominations contained as keys.It also checks if the lists in the keys of bills are sorted and uses regex module to check for valid serial numbers.", "name": "__init__"...
6
stack_v2_sparse_classes_30k_train_007275
Implement the Python class `WatchList` described below. Class description: Implement the WatchList class. Method signatures and docstrings: - def __init__(self, file=''): This method takes in a filename and initializes a dictionary by the name of bills which contains serial numbers of all the denominations contained ...
Implement the Python class `WatchList` described below. Class description: Implement the WatchList class. Method signatures and docstrings: - def __init__(self, file=''): This method takes in a filename and initializes a dictionary by the name of bills which contains serial numbers of all the denominations contained ...
e773e87668af057c8adb1e012aa5d81f42c70f2a
<|skeleton|> class WatchList: def __init__(self, file=''): """This method takes in a filename and initializes a dictionary by the name of bills which contains serial numbers of all the denominations contained as keys.It also checks if the lists in the keys of bills are sorted and uses regex module to check...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WatchList: def __init__(self, file=''): """This method takes in a filename and initializes a dictionary by the name of bills which contains serial numbers of all the denominations contained as keys.It also checks if the lists in the keys of bills are sorted and uses regex module to check for valid ser...
the_stack_v2_python_sparse
HW/HW1/hw1.py
SiddhantBhardwaj2018/ISTA-350
train
0
14ffef7b8d46d353529df670c2c4fa0c97c348bb
[ "seo = SiteSeo.objects.get(choices='Password Reset')\ntemplate_name = 'registration/password_reset_form.html'\nreset_form = PasswordResetForm()\ncontext = {'reset_form': reset_form, 'seo': seo}\nreturn render(request, template_name, context)", "template_name = 'registration/password_reset_form.html'\nseo = SiteSe...
<|body_start_0|> seo = SiteSeo.objects.get(choices='Password Reset') template_name = 'registration/password_reset_form.html' reset_form = PasswordResetForm() context = {'reset_form': reset_form, 'seo': seo} return render(request, template_name, context) <|end_body_0|> <|body_sta...
PasswordResetView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PasswordResetView: def get(self, request): """get method to display the password reset form""" <|body_0|> def post(self, request): """post method to receive the email id entered by the customer, create token,id to send the password reset link to entered email""" ...
stack_v2_sparse_classes_10k_train_006947
36,770
permissive
[ { "docstring": "get method to display the password reset form", "name": "get", "signature": "def get(self, request)" }, { "docstring": "post method to receive the email id entered by the customer, create token,id to send the password reset link to entered email", "name": "post", "signatu...
2
stack_v2_sparse_classes_30k_train_003670
Implement the Python class `PasswordResetView` described below. Class description: Implement the PasswordResetView class. Method signatures and docstrings: - def get(self, request): get method to display the password reset form - def post(self, request): post method to receive the email id entered by the customer, cr...
Implement the Python class `PasswordResetView` described below. Class description: Implement the PasswordResetView class. Method signatures and docstrings: - def get(self, request): get method to display the password reset form - def post(self, request): post method to receive the email id entered by the customer, cr...
ab828ca95571c6dffef2b2392522e6a4160a2304
<|skeleton|> class PasswordResetView: def get(self, request): """get method to display the password reset form""" <|body_0|> def post(self, request): """post method to receive the email id entered by the customer, create token,id to send the password reset link to entered email""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PasswordResetView: def get(self, request): """get method to display the password reset form""" seo = SiteSeo.objects.get(choices='Password Reset') template_name = 'registration/password_reset_form.html' reset_form = PasswordResetForm() context = {'reset_form': reset_for...
the_stack_v2_python_sparse
login/views.py
Quanscendence/braynai
train
0
623b601cc60ddc8c53f32b4acb616684179ef870
[ "del observation\ndel a\nreturn -1", "del reward\ndel observation\ndel a\nreturn -1" ]
<|body_start_0|> del observation del a return -1 <|end_body_0|> <|body_start_1|> del reward del observation del a return -1 <|end_body_1|>
A MockExploration class that always returns -1.
MockExploration
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MockExploration: """A MockExploration class that always returns -1.""" def begin_episode(self, observation: np.ndarray, a: int) -> int: """Returns the same action passed by the agent.""" <|body_0|> def step(self, reward: float, observation: np.ndarray, a: int) -> int: ...
stack_v2_sparse_classes_10k_train_006948
11,665
permissive
[ { "docstring": "Returns the same action passed by the agent.", "name": "begin_episode", "signature": "def begin_episode(self, observation: np.ndarray, a: int) -> int" }, { "docstring": "Returns the same action passed by the agent.", "name": "step", "signature": "def step(self, reward: fl...
2
stack_v2_sparse_classes_30k_train_004694
Implement the Python class `MockExploration` described below. Class description: A MockExploration class that always returns -1. Method signatures and docstrings: - def begin_episode(self, observation: np.ndarray, a: int) -> int: Returns the same action passed by the agent. - def step(self, reward: float, observation...
Implement the Python class `MockExploration` described below. Class description: A MockExploration class that always returns -1. Method signatures and docstrings: - def begin_episode(self, observation: np.ndarray, a: int) -> int: Returns the same action passed by the agent. - def step(self, reward: float, observation...
72082feccf404e5bf946e513e4f6c0ae8fb279ad
<|skeleton|> class MockExploration: """A MockExploration class that always returns -1.""" def begin_episode(self, observation: np.ndarray, a: int) -> int: """Returns the same action passed by the agent.""" <|body_0|> def step(self, reward: float, observation: np.ndarray, a: int) -> int: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MockExploration: """A MockExploration class that always returns -1.""" def begin_episode(self, observation: np.ndarray, a: int) -> int: """Returns the same action passed by the agent.""" del observation del a return -1 def step(self, reward: float, observation: np.nda...
the_stack_v2_python_sparse
balloon_learning_environment/agents/quantile_agent_test.py
google/balloon-learning-environment
train
108
05e30fb880eb841c828cbd062efdc755935388cd
[ "caller = self.caller\nif hasattr(self.caller.location, 'get_detail'):\n detail = self.caller.location.get_detail(self.args, looker=self.caller)\n if detail:\n caller.location.msg_contents(f'$You() $conj(look) closely at {self.args}.\\n', from_obj=caller, exclude=caller)\n caller.msg(detail)\n ...
<|body_start_0|> caller = self.caller if hasattr(self.caller.location, 'get_detail'): detail = self.caller.location.get_detail(self.args, looker=self.caller) if detail: caller.location.msg_contents(f'$You() $conj(look) closely at {self.args}.\n', from_obj=caller, ...
look Usage: look look <obj> look <room detail> look *<account> Observes your location, details at your location or objects in your vicinity.
CmdExtendedRoomLook
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CmdExtendedRoomLook: """look Usage: look look <obj> look <room detail> look *<account> Observes your location, details at your location or objects in your vicinity.""" def look_detail(self): """Look for detail on room.""" <|body_0|> def func(self): """Handle the ...
stack_v2_sparse_classes_10k_train_006949
34,295
permissive
[ { "docstring": "Look for detail on room.", "name": "look_detail", "signature": "def look_detail(self)" }, { "docstring": "Handle the looking.", "name": "func", "signature": "def func(self)" } ]
2
null
Implement the Python class `CmdExtendedRoomLook` described below. Class description: look Usage: look look <obj> look <room detail> look *<account> Observes your location, details at your location or objects in your vicinity. Method signatures and docstrings: - def look_detail(self): Look for detail on room. - def fu...
Implement the Python class `CmdExtendedRoomLook` described below. Class description: look Usage: look look <obj> look <room detail> look *<account> Observes your location, details at your location or objects in your vicinity. Method signatures and docstrings: - def look_detail(self): Look for detail on room. - def fu...
b3ca58b5c1325a3bf57051dfe23560a08d2947b7
<|skeleton|> class CmdExtendedRoomLook: """look Usage: look look <obj> look <room detail> look *<account> Observes your location, details at your location or objects in your vicinity.""" def look_detail(self): """Look for detail on room.""" <|body_0|> def func(self): """Handle the ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CmdExtendedRoomLook: """look Usage: look look <obj> look <room detail> look *<account> Observes your location, details at your location or objects in your vicinity.""" def look_detail(self): """Look for detail on room.""" caller = self.caller if hasattr(self.caller.location, 'get_...
the_stack_v2_python_sparse
evennia/contrib/grid/extended_room/extended_room.py
evennia/evennia
train
1,781
3a8b2cf6d3f36cfe05234b8088f2db3fb8254e99
[ "self._logger = logger\nself._no_run = False\nif not is_exe(exe_path):\n self._logger.error('No trim_quality script available (exiting)')\n sys.exit(1)\nself._exe_path = exe_path\nself.format = 'fastq'", "self.__build_cmd(infname, outdir)\nmsg = ['Running...', '\\t%s' % self._cmd]\nfor m in msg:\n self._...
<|body_start_0|> self._logger = logger self._no_run = False if not is_exe(exe_path): self._logger.error('No trim_quality script available (exiting)') sys.exit(1) self._exe_path = exe_path self.format = 'fastq' <|end_body_0|> <|body_start_1|> self....
Class for working with trim_quality
Trim_Quality
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Trim_Quality: """Class for working with trim_quality""" def __init__(self, exe_path, logger): """Instantiate with location of executable""" <|body_0|> def run(self, infname, outdir): """Run trim_quality on the passed file""" <|body_1|> def __build_cm...
stack_v2_sparse_classes_10k_train_006950
3,597
permissive
[ { "docstring": "Instantiate with location of executable", "name": "__init__", "signature": "def __init__(self, exe_path, logger)" }, { "docstring": "Run trim_quality on the passed file", "name": "run", "signature": "def run(self, infname, outdir)" }, { "docstring": "Build a comma...
3
stack_v2_sparse_classes_30k_train_003638
Implement the Python class `Trim_Quality` described below. Class description: Class for working with trim_quality Method signatures and docstrings: - def __init__(self, exe_path, logger): Instantiate with location of executable - def run(self, infname, outdir): Run trim_quality on the passed file - def __build_cmd(se...
Implement the Python class `Trim_Quality` described below. Class description: Class for working with trim_quality Method signatures and docstrings: - def __init__(self, exe_path, logger): Instantiate with location of executable - def run(self, infname, outdir): Run trim_quality on the passed file - def __build_cmd(se...
a3c64198aad3709a5c4d969f48ae0af11fdc25db
<|skeleton|> class Trim_Quality: """Class for working with trim_quality""" def __init__(self, exe_path, logger): """Instantiate with location of executable""" <|body_0|> def run(self, infname, outdir): """Run trim_quality on the passed file""" <|body_1|> def __build_cm...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Trim_Quality: """Class for working with trim_quality""" def __init__(self, exe_path, logger): """Instantiate with location of executable""" self._logger = logger self._no_run = False if not is_exe(exe_path): self._logger.error('No trim_quality script available ...
the_stack_v2_python_sparse
metapy/pycits/seq_crumbs.py
peterthorpe5/public_scripts
train
35
a9ae7db40d5dfe0db8a5b380b155cd97b0f46df2
[ "n = len(nums)\ncounter = Counter(nums)\nfreq = SortedList(counter.values())\nfor i in range(n - 1, -1, -1):\n if len(freq) <= 1:\n return i + 1\n if freq[0] == 1 and freq[1] == freq[-1]:\n return i + 1\n if freq[0] == freq[-2] and freq[-1] == freq[-2] + 1:\n return i + 1\n num = nu...
<|body_start_0|> n = len(nums) counter = Counter(nums) freq = SortedList(counter.values()) for i in range(n - 1, -1, -1): if len(freq) <= 1: return i + 1 if freq[0] == 1 and freq[1] == freq[-1]: return i + 1 if freq[0] =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxEqualFreq(self, nums: List[int]) -> int: """有序集合维护有序的频率 during iteration 1. decrement the biggest count or 2. decrement the smallest count 移除最多或者最少的""" <|body_0|> def maxEqualFreq2(self, nums: List[int]) -> int: """分三种情况讨论 1. 最大出现次数 maxFreq == 1 随意删除...
stack_v2_sparse_classes_10k_train_006951
3,113
no_license
[ { "docstring": "有序集合维护有序的频率 during iteration 1. decrement the biggest count or 2. decrement the smallest count 移除最多或者最少的", "name": "maxEqualFreq", "signature": "def maxEqualFreq(self, nums: List[int]) -> int" }, { "docstring": "分三种情况讨论 1. 最大出现次数 maxFreq == 1 随意删除一个元素 2. 所有数出现次数都是 maxFreq 或者 maxF...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxEqualFreq(self, nums: List[int]) -> int: 有序集合维护有序的频率 during iteration 1. decrement the biggest count or 2. decrement the smallest count 移除最多或者最少的 - def maxEqualFreq2(self,...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxEqualFreq(self, nums: List[int]) -> int: 有序集合维护有序的频率 during iteration 1. decrement the biggest count or 2. decrement the smallest count 移除最多或者最少的 - def maxEqualFreq2(self,...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def maxEqualFreq(self, nums: List[int]) -> int: """有序集合维护有序的频率 during iteration 1. decrement the biggest count or 2. decrement the smallest count 移除最多或者最少的""" <|body_0|> def maxEqualFreq2(self, nums: List[int]) -> int: """分三种情况讨论 1. 最大出现次数 maxFreq == 1 随意删除...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxEqualFreq(self, nums: List[int]) -> int: """有序集合维护有序的频率 during iteration 1. decrement the biggest count or 2. decrement the smallest count 移除最多或者最少的""" n = len(nums) counter = Counter(nums) freq = SortedList(counter.values()) for i in range(n - 1, -1, -...
the_stack_v2_python_sparse
5_map/经典题/哈希表统计/1224. 最大相等频率-有序集合维护有序的频率.py
981377660LMT/algorithm-study
train
225
cd2d54970da531e6bb5eaf99d1cbaed325663bf1
[ "self.SetStartDate(2004, 1, 1)\nself.SetEndDate(2015, 1, 1)\nself.SetCash(100000)\nself.AddEquity('SPY', Resolution.Daily)\nself.__macd = self.MACD('SPY', 12, 26, 9, MovingAverageType.Exponential, Resolution.Daily)\nself.__previous = datetime.min\nself.PlotIndicator('MACD', True, self.__macd, self.__macd.Signal)\ns...
<|body_start_0|> self.SetStartDate(2004, 1, 1) self.SetEndDate(2015, 1, 1) self.SetCash(100000) self.AddEquity('SPY', Resolution.Daily) self.__macd = self.MACD('SPY', 12, 26, 9, MovingAverageType.Exponential, Resolution.Daily) self.__previous = datetime.min self.P...
MACDTrendAlgorithm
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MACDTrendAlgorithm: def Initialize(self): """Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.""" <|body_0|> def OnData(self, data): """OnData event is the primary entry point for...
stack_v2_sparse_classes_10k_train_006952
2,822
permissive
[ { "docstring": "Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.", "name": "Initialize", "signature": "def Initialize(self)" }, { "docstring": "OnData event is the primary entry point for your algorithm. Eac...
2
null
Implement the Python class `MACDTrendAlgorithm` described below. Class description: Implement the MACDTrendAlgorithm class. Method signatures and docstrings: - def Initialize(self): Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized...
Implement the Python class `MACDTrendAlgorithm` described below. Class description: Implement the MACDTrendAlgorithm class. Method signatures and docstrings: - def Initialize(self): Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized...
b33dd3bc140e14b883f39ecf848a793cf7292277
<|skeleton|> class MACDTrendAlgorithm: def Initialize(self): """Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.""" <|body_0|> def OnData(self, data): """OnData event is the primary entry point for...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MACDTrendAlgorithm: def Initialize(self): """Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.""" self.SetStartDate(2004, 1, 1) self.SetEndDate(2015, 1, 1) self.SetCash(100000) self....
the_stack_v2_python_sparse
Algorithm.Python/MACDTrendAlgorithm.py
Capnode/Algoloop
train
87
0f375f0f5bc5ff81b28b2302bee2d5b5a5954aac
[ "stack, curr = ([], root)\nres = []\nwhile stack or curr:\n if curr:\n res.append(str(curr.val))\n stack.append(curr)\n curr = curr.left\n else:\n res.append('None')\n curr = stack.pop()\n curr = curr.right\nprint(res)\nreturn ' '.join(res)", "if not data:\n retu...
<|body_start_0|> stack, curr = ([], root) res = [] while stack or curr: if curr: res.append(str(curr.val)) stack.append(curr) curr = curr.left else: res.append('None') curr = stack.pop() ...
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_10k_train_006953
4,842
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_001925
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:...
63120dbaabd7c3c19633ebe952bcee4cf826b0e0
<|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_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" stack, curr = ([], root) res = [] while stack or curr: if curr: res.append(str(curr.val)) stack.append(curr) c...
the_stack_v2_python_sparse
297. Serialize and Deserialize Binary Tree _ tee.py
CaizhiXu/LeetCode-Python-Solutions
train
0
31f5a45e28ccb77adff1f5f3761e9297a121f0cd
[ "if not root:\n return -1\nret = 1 + max((self.findLeavesHelper(child, results) for child in (root.left, root.right)))\nif ret >= len(results):\n results.append([])\nresults[ret].append(root.val)\nreturn ret", "ret = []\nself.findLeavesHelper(root, ret)\nreturn ret" ]
<|body_start_0|> if not root: return -1 ret = 1 + max((self.findLeavesHelper(child, results) for child in (root.left, root.right))) if ret >= len(results): results.append([]) results[ret].append(root.val) return ret <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findLeavesHelper(self, root, results): """push root and all descendants to results return the distance from root to farthest leaf""" <|body_0|> def findLeaves(self, root: TreeNode) -> List[List[int]]: """:type root: TreeNode :rtype: List[List[int]]""" ...
stack_v2_sparse_classes_10k_train_006954
2,449
no_license
[ { "docstring": "push root and all descendants to results return the distance from root to farthest leaf", "name": "findLeavesHelper", "signature": "def findLeavesHelper(self, root, results)" }, { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "findLeaves", "signatur...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findLeavesHelper(self, root, results): push root and all descendants to results return the distance from root to farthest leaf - def findLeaves(self, root: TreeNode) -> List[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findLeavesHelper(self, root, results): push root and all descendants to results return the distance from root to farthest leaf - def findLeaves(self, root: TreeNode) -> List[...
f2621cd76822a922c49b60f32931f26cce1c571d
<|skeleton|> class Solution: def findLeavesHelper(self, root, results): """push root and all descendants to results return the distance from root to farthest leaf""" <|body_0|> def findLeaves(self, root: TreeNode) -> List[List[int]]: """:type root: TreeNode :rtype: List[List[int]]""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findLeavesHelper(self, root, results): """push root and all descendants to results return the distance from root to farthest leaf""" if not root: return -1 ret = 1 + max((self.findLeavesHelper(child, results) for child in (root.left, root.right))) if r...
the_stack_v2_python_sparse
Tree_and_BST/021_leetcode_P_366_FindLeavesOfBinaryTree/Solution.py
Keshav1506/competitive_programming
train
0
555ff7e75e6a06ccfb454c2367fd443e236d6063
[ "super(PostProcessor, self).__init__()\nself.score_thresh = score_thresh\nself.nms = nms\nself.detections_per_img = detections_per_img\nif box_coder is None:\n box_coder = BoxCoder(weights=(10.0, 10.0, 5.0, 5.0))\nself.box_coder = box_coder\nself.cls_agnostic_bbox_reg = cls_agnostic_bbox_reg\nself.is_repeat = is...
<|body_start_0|> super(PostProcessor, self).__init__() self.score_thresh = score_thresh self.nms = nms self.detections_per_img = detections_per_img if box_coder is None: box_coder = BoxCoder(weights=(10.0, 10.0, 5.0, 5.0)) self.box_coder = box_coder se...
From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results
PostProcessor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostProcessor: """From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results""" def __init__(self, score_thresh=0.05, nms=0.5, detections_per_img=100, box_coder=None, cls_agnostic_bbox_reg=False, is_repeat...
stack_v2_sparse_classes_10k_train_006955
7,503
permissive
[ { "docstring": "Arguments: score_thresh (float) nms (float) detections_per_img (int) box_coder (BoxCoder)", "name": "__init__", "signature": "def __init__(self, score_thresh=0.05, nms=0.5, detections_per_img=100, box_coder=None, cls_agnostic_bbox_reg=False, is_repeat=False)" }, { "docstring": "A...
6
stack_v2_sparse_classes_30k_train_003303
Implement the Python class `PostProcessor` described below. Class description: From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results Method signatures and docstrings: - def __init__(self, score_thresh=0.05, nms=0.5, detections...
Implement the Python class `PostProcessor` described below. Class description: From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results Method signatures and docstrings: - def __init__(self, score_thresh=0.05, nms=0.5, detections...
a0c9ed8850abe740eedf8bfc6e1577cc0aa3fc7b
<|skeleton|> class PostProcessor: """From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results""" def __init__(self, score_thresh=0.05, nms=0.5, detections_per_img=100, box_coder=None, cls_agnostic_bbox_reg=False, is_repeat...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PostProcessor: """From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results""" def __init__(self, score_thresh=0.05, nms=0.5, detections_per_img=100, box_coder=None, cls_agnostic_bbox_reg=False, is_repeat=False): ...
the_stack_v2_python_sparse
rcnn/modeling/cascade_rcnn/inference.py
rs9899/Parsing-R-CNN
train
0
d7de809cb6ec6c52b1835df62a2df121ee02c79e
[ "author = g.user\nnote = NoteModel.query.get(note_id)\nif not note:\n abort(404, error=f'Note with id={note_id} not found')\nif note.author != author:\n abort(403, error=f'Access denied to note with id={note_id}')\nreturn (note, 200)", "author = g.user\nnote = NoteModel.query.get(note_id)\nif not note:\n ...
<|body_start_0|> author = g.user note = NoteModel.query.get(note_id) if not note: abort(404, error=f'Note with id={note_id} not found') if note.author != author: abort(403, error=f'Access denied to note with id={note_id}') return (note, 200) <|end_body_0|>...
NoteResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NoteResource: def get(self, note_id): """Возвращает заметку пользователя. Требуется аутентификация. :param note_id: id заметки :return: замтку""" <|body_0|> def put(self, note_id, **kwargs): """Меняет заметку пользователя. Требуется аутентификация. :param note_id: id...
stack_v2_sparse_classes_10k_train_006956
11,305
no_license
[ { "docstring": "Возвращает заметку пользователя. Требуется аутентификация. :param note_id: id заметки :return: замтку", "name": "get", "signature": "def get(self, note_id)" }, { "docstring": "Меняет заметку пользователя. Требуется аутентификация. :param note_id: id заметки :param kwargs: парамет...
3
stack_v2_sparse_classes_30k_train_003101
Implement the Python class `NoteResource` described below. Class description: Implement the NoteResource class. Method signatures and docstrings: - def get(self, note_id): Возвращает заметку пользователя. Требуется аутентификация. :param note_id: id заметки :return: замтку - def put(self, note_id, **kwargs): Меняет з...
Implement the Python class `NoteResource` described below. Class description: Implement the NoteResource class. Method signatures and docstrings: - def get(self, note_id): Возвращает заметку пользователя. Требуется аутентификация. :param note_id: id заметки :return: замтку - def put(self, note_id, **kwargs): Меняет з...
adb9a3f4524ab76e8ba656344e2ed452e87b577c
<|skeleton|> class NoteResource: def get(self, note_id): """Возвращает заметку пользователя. Требуется аутентификация. :param note_id: id заметки :return: замтку""" <|body_0|> def put(self, note_id, **kwargs): """Меняет заметку пользователя. Требуется аутентификация. :param note_id: id...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NoteResource: def get(self, note_id): """Возвращает заметку пользователя. Требуется аутентификация. :param note_id: id заметки :return: замтку""" author = g.user note = NoteModel.query.get(note_id) if not note: abort(404, error=f'Note with id={note_id} not found') ...
the_stack_v2_python_sparse
api/resources/note.py
UshakovAleksandr/Blog
train
1
b105420447c6bebd1494e6b8cf1bcb9c0a81624a
[ "if k >= len(cardPoints):\n return sum(cardPoints)\nleft = [0] + list(itertools.accumulate(cardPoints))\nright = [0] + list(itertools.accumulate(reversed(cardPoints)))\nreturn max((left[i] + right[k - i] for i in range(k + 1)))", "n = len(cardPoints) - 1\n\n@lru_cache(None)\ndef rec(i, j):\n if i + (n - j) ...
<|body_start_0|> if k >= len(cardPoints): return sum(cardPoints) left = [0] + list(itertools.accumulate(cardPoints)) right = [0] + list(itertools.accumulate(reversed(cardPoints))) return max((left[i] + right[k - i] for i in range(k + 1))) <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxScore(self, cardPoints: List[int], k: int) -> int: """05/27/2021 15:20 DP Time complexity: O(n) Space complexity: O(n)""" <|body_0|> def maxScore(self, cardPoints: List[int], k: int) -> int: """TLE""" <|body_1|> def maxScore(self, cardPo...
stack_v2_sparse_classes_10k_train_006957
3,048
no_license
[ { "docstring": "05/27/2021 15:20 DP Time complexity: O(n) Space complexity: O(n)", "name": "maxScore", "signature": "def maxScore(self, cardPoints: List[int], k: int) -> int" }, { "docstring": "TLE", "name": "maxScore", "signature": "def maxScore(self, cardPoints: List[int], k: int) -> i...
3
stack_v2_sparse_classes_30k_train_006975
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxScore(self, cardPoints: List[int], k: int) -> int: 05/27/2021 15:20 DP Time complexity: O(n) Space complexity: O(n) - def maxScore(self, cardPoints: List[int], k: int) -> ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxScore(self, cardPoints: List[int], k: int) -> int: 05/27/2021 15:20 DP Time complexity: O(n) Space complexity: O(n) - def maxScore(self, cardPoints: List[int], k: int) -> ...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def maxScore(self, cardPoints: List[int], k: int) -> int: """05/27/2021 15:20 DP Time complexity: O(n) Space complexity: O(n)""" <|body_0|> def maxScore(self, cardPoints: List[int], k: int) -> int: """TLE""" <|body_1|> def maxScore(self, cardPo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxScore(self, cardPoints: List[int], k: int) -> int: """05/27/2021 15:20 DP Time complexity: O(n) Space complexity: O(n)""" if k >= len(cardPoints): return sum(cardPoints) left = [0] + list(itertools.accumulate(cardPoints)) right = [0] + list(itertool...
the_stack_v2_python_sparse
leetcode/solved/1538_Maximum_Points_You_Can_Obtain_from_Cards/solution.py
sungminoh/algorithms
train
0
9efc50638e516b542eddacc588fcc642faf7b0cd
[ "self.url = url\nheaders = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36 Maxthon/5.1.3.2000'}\nr = requests.get(url=self.url, headers=headers)\nif r.status_code == 200:\n self.text = r.text\nelse:\n self.text = None", "if self.te...
<|body_start_0|> self.url = url headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36 Maxthon/5.1.3.2000'} r = requests.get(url=self.url, headers=headers) if r.status_code == 200: self.text = r.t...
Extract_link
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Extract_link: def __init__(self, url): """初始化时访问url并将response的内容存储起来""" <|body_0|> def extract_link(self): """从页面中分析出链接""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.url = url headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW...
stack_v2_sparse_classes_10k_train_006958
1,794
no_license
[ { "docstring": "初始化时访问url并将response的内容存储起来", "name": "__init__", "signature": "def __init__(self, url)" }, { "docstring": "从页面中分析出链接", "name": "extract_link", "signature": "def extract_link(self)" } ]
2
stack_v2_sparse_classes_30k_train_004509
Implement the Python class `Extract_link` described below. Class description: Implement the Extract_link class. Method signatures and docstrings: - def __init__(self, url): 初始化时访问url并将response的内容存储起来 - def extract_link(self): 从页面中分析出链接
Implement the Python class `Extract_link` described below. Class description: Implement the Extract_link class. Method signatures and docstrings: - def __init__(self, url): 初始化时访问url并将response的内容存储起来 - def extract_link(self): 从页面中分析出链接 <|skeleton|> class Extract_link: def __init__(self, url): """初始化时访问u...
355c7251dda058deefc80f3bffbf6c541d92ad41
<|skeleton|> class Extract_link: def __init__(self, url): """初始化时访问url并将response的内容存储起来""" <|body_0|> def extract_link(self): """从页面中分析出链接""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Extract_link: def __init__(self, url): """初始化时访问url并将response的内容存储起来""" self.url = url headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36 Maxthon/5.1.3.2000'} r = requests.get(url=self.url, head...
the_stack_v2_python_sparse
module4-04threads/spider.py
echolvan/homework
train
0
b94c9c7d7c2f42509bd2d6aaa8a39c14b9b05835
[ "stack = []\ncurstring = ''\ncurnum = 0\nfor c in s:\n if c == '[':\n stack.append(curstring)\n stack.append(curnum)\n curnum = 0\n curstring = ''\n elif c == ']':\n num = stack.pop()\n prevstring = stack.pop()\n curstring = prevstring + num * curstring\n el...
<|body_start_0|> stack = [] curstring = '' curnum = 0 for c in s: if c == '[': stack.append(curstring) stack.append(curnum) curnum = 0 curstring = '' elif c == ']': num = stack.pop() ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def decodeString(self, s): """Stack time O(S+|s|) space O(S) 本题难点在于括号内嵌套括号,需要从内向外生成与拼接字符串,这与栈的先入后出特性对应。 算法流程: 构建辅助栈 stack, 遍历字符串 s 中每个字符 c; 当 c 为数字时,将数字字符转化为数字 multi,用于后续倍数计算; 当 c 为字母时,在 res 尾部添加 c; 当 c 为 [ 时,将当前 multi 和 res 入栈,并分别置空置 000: 记录此 [ 前的临时结果 res 至栈,用于发现对应 ] 后的拼接操作; 记...
stack_v2_sparse_classes_10k_train_006959
3,130
no_license
[ { "docstring": "Stack time O(S+|s|) space O(S) 本题难点在于括号内嵌套括号,需要从内向外生成与拼接字符串,这与栈的先入后出特性对应。 算法流程: 构建辅助栈 stack, 遍历字符串 s 中每个字符 c; 当 c 为数字时,将数字字符转化为数字 multi,用于后续倍数计算; 当 c 为字母时,在 res 尾部添加 c; 当 c 为 [ 时,将当前 multi 和 res 入栈,并分别置空置 000: 记录此 [ 前的临时结果 res 至栈,用于发现对应 ] 后的拼接操作; 记录此 [ 前的倍数 multi 至栈,用于发现对应 ] 后,获取 multi × [...] 字...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def decodeString(self, s): Stack time O(S+|s|) space O(S) 本题难点在于括号内嵌套括号,需要从内向外生成与拼接字符串,这与栈的先入后出特性对应。 算法流程: 构建辅助栈 stack, 遍历字符串 s 中每个字符 c; 当 c 为数字时,将数字字符转化为数字 multi,用于后续倍数计算; 当 c 为...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def decodeString(self, s): Stack time O(S+|s|) space O(S) 本题难点在于括号内嵌套括号,需要从内向外生成与拼接字符串,这与栈的先入后出特性对应。 算法流程: 构建辅助栈 stack, 遍历字符串 s 中每个字符 c; 当 c 为数字时,将数字字符转化为数字 multi,用于后续倍数计算; 当 c 为...
85f71621c54f6b0029f3a2746f022f89dd7419d9
<|skeleton|> class Solution: def decodeString(self, s): """Stack time O(S+|s|) space O(S) 本题难点在于括号内嵌套括号,需要从内向外生成与拼接字符串,这与栈的先入后出特性对应。 算法流程: 构建辅助栈 stack, 遍历字符串 s 中每个字符 c; 当 c 为数字时,将数字字符转化为数字 multi,用于后续倍数计算; 当 c 为字母时,在 res 尾部添加 c; 当 c 为 [ 时,将当前 multi 和 res 入栈,并分别置空置 000: 记录此 [ 前的临时结果 res 至栈,用于发现对应 ] 后的拼接操作; 记...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def decodeString(self, s): """Stack time O(S+|s|) space O(S) 本题难点在于括号内嵌套括号,需要从内向外生成与拼接字符串,这与栈的先入后出特性对应。 算法流程: 构建辅助栈 stack, 遍历字符串 s 中每个字符 c; 当 c 为数字时,将数字字符转化为数字 multi,用于后续倍数计算; 当 c 为字母时,在 res 尾部添加 c; 当 c 为 [ 时,将当前 multi 和 res 入栈,并分别置空置 000: 记录此 [ 前的临时结果 res 至栈,用于发现对应 ] 后的拼接操作; 记录此 [ 前的倍数 mult...
the_stack_v2_python_sparse
LeetCode/Stack/394_decode_string.py
XyK0907/for_work
train
0
ed2e07a76bfac34836053d5b79eaf2386e0fe269
[ "if output_image_topic is not None:\n self.image_publisher = rospy.Publisher(output_image_topic, ROS_Image, queue_size=10)\nelse:\n self.image_publisher = None\nrospy.Subscriber(input_image_topic, ROS_Image, self.callback)\nself.bridge = ROSBridge()\nself.ID = 0\nself.parser = argparse.ArgumentParser()\nself....
<|body_start_0|> if output_image_topic is not None: self.image_publisher = rospy.Publisher(output_image_topic, ROS_Image, queue_size=10) else: self.image_publisher = None rospy.Subscriber(input_image_topic, ROS_Image, self.callback) self.bridge = ROSBridge() ...
Synthetic_Data_Generation
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Synthetic_Data_Generation: def __init__(self, input_image_topic='/usb_cam/image_raw', output_image_topic='/opendr/synthetic_facial_images', device='cuda'): """Creates a ROS Node for SyntheticDataGeneration :param input_image_topic: Topic from which we are reading the input image :type in...
stack_v2_sparse_classes_10k_train_006960
5,315
permissive
[ { "docstring": "Creates a ROS Node for SyntheticDataGeneration :param input_image_topic: Topic from which we are reading the input image :type input_image_topic: str :param output_image_topic: Topic to which we are publishing the synthetic facial image (if None, we are not publishing any image) :type output_ima...
3
stack_v2_sparse_classes_30k_train_004152
Implement the Python class `Synthetic_Data_Generation` described below. Class description: Implement the Synthetic_Data_Generation class. Method signatures and docstrings: - def __init__(self, input_image_topic='/usb_cam/image_raw', output_image_topic='/opendr/synthetic_facial_images', device='cuda'): Creates a ROS N...
Implement the Python class `Synthetic_Data_Generation` described below. Class description: Implement the Synthetic_Data_Generation class. Method signatures and docstrings: - def __init__(self, input_image_topic='/usb_cam/image_raw', output_image_topic='/opendr/synthetic_facial_images', device='cuda'): Creates a ROS N...
b3d6ce670cdf63469fc5766630eb295d67b3d788
<|skeleton|> class Synthetic_Data_Generation: def __init__(self, input_image_topic='/usb_cam/image_raw', output_image_topic='/opendr/synthetic_facial_images', device='cuda'): """Creates a ROS Node for SyntheticDataGeneration :param input_image_topic: Topic from which we are reading the input image :type in...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Synthetic_Data_Generation: def __init__(self, input_image_topic='/usb_cam/image_raw', output_image_topic='/opendr/synthetic_facial_images', device='cuda'): """Creates a ROS Node for SyntheticDataGeneration :param input_image_topic: Topic from which we are reading the input image :type input_image_topi...
the_stack_v2_python_sparse
projects/opendr_ws/src/opendr_data_generation/scripts/synthetic_facial_generation_node.py
opendr-eu/opendr
train
535
6b0a3c65d424a58eca674bfeb5e503dda88075f4
[ "with self.assertRaise(ValueError) as error:\n Yearly_Income('a', 2001)\nself.assertTrue('Invalid type for data passed into this class' in str(error.exception))", "with self.assertRaise(ValueError) as error:\n Yearly_Income(data, 'a')\nself.assertTrue('Improper type for year passed into this class' in str(e...
<|body_start_0|> with self.assertRaise(ValueError) as error: Yearly_Income('a', 2001) self.assertTrue('Invalid type for data passed into this class' in str(error.exception)) <|end_body_0|> <|body_start_1|> with self.assertRaise(ValueError) as error: Yearly_Income(data, '...
Test
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test: def income_test1(self): """This function tests to see that the proper Error is raised when something besides a dataframe is passed for data into the class""" <|body_0|> def income_test2(self): """This function tests to see that the proper Error is raised when s...
stack_v2_sparse_classes_10k_train_006961
1,630
no_license
[ { "docstring": "This function tests to see that the proper Error is raised when something besides a dataframe is passed for data into the class", "name": "income_test1", "signature": "def income_test1(self)" }, { "docstring": "This function tests to see that the proper Error is raised when somet...
3
stack_v2_sparse_classes_30k_train_000412
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def income_test1(self): This function tests to see that the proper Error is raised when something besides a dataframe is passed for data into the class - def income_test2(self): This fun...
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def income_test1(self): This function tests to see that the proper Error is raised when something besides a dataframe is passed for data into the class - def income_test2(self): This fun...
f5bb1e51de4f84ab3dd62d3073aee4f56534afa1
<|skeleton|> class Test: def income_test1(self): """This function tests to see that the proper Error is raised when something besides a dataframe is passed for data into the class""" <|body_0|> def income_test2(self): """This function tests to see that the proper Error is raised when s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Test: def income_test1(self): """This function tests to see that the proper Error is raised when something besides a dataframe is passed for data into the class""" with self.assertRaise(ValueError) as error: Yearly_Income('a', 2001) self.assertTrue('Invalid type for data pa...
the_stack_v2_python_sparse
sar516/tests.py
ds-ga-1007/assignment9
train
2
6e37b1348c1be40e545799b6bc4e433b804de5af
[ "self.__author__ = 'GodSaveTheDoge'\nself.selector = '#mw-content-text li , p'\nself.url = 'https://{}.wikipedia.org/wiki/{}'\nself.apiurl = 'https://en.wikipedia.org/w/api.php?action=query&titles={}&format=json'", "if '-1' in requests.get(self.apiurl.format(page)).json()['query']['pages']:\n return False\nret...
<|body_start_0|> self.__author__ = 'GodSaveTheDoge' self.selector = '#mw-content-text li , p' self.url = 'https://{}.wikipedia.org/wiki/{}' self.apiurl = 'https://en.wikipedia.org/w/api.php?action=query&titles={}&format=json' <|end_body_0|> <|body_start_1|> if '-1' in requests.g...
Wikipedia
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Wikipedia: def __init__(self) -> None: """You can use this class to look up a page on wikipedia""" <|body_0|> def exists(self, page: str) -> bool: """Check if a page exists :param page: url of the page :return:""" <|body_1|> def getpage(self, page: str, ...
stack_v2_sparse_classes_10k_train_006962
1,240
no_license
[ { "docstring": "You can use this class to look up a page on wikipedia", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Check if a page exists :param page: url of the page :return:", "name": "exists", "signature": "def exists(self, page: str) -> bool" }...
3
stack_v2_sparse_classes_30k_train_002278
Implement the Python class `Wikipedia` described below. Class description: Implement the Wikipedia class. Method signatures and docstrings: - def __init__(self) -> None: You can use this class to look up a page on wikipedia - def exists(self, page: str) -> bool: Check if a page exists :param page: url of the page :re...
Implement the Python class `Wikipedia` described below. Class description: Implement the Wikipedia class. Method signatures and docstrings: - def __init__(self) -> None: You can use this class to look up a page on wikipedia - def exists(self, page: str) -> bool: Check if a page exists :param page: url of the page :re...
cc0db796c5516b36e82ef6f70c5649902366df62
<|skeleton|> class Wikipedia: def __init__(self) -> None: """You can use this class to look up a page on wikipedia""" <|body_0|> def exists(self, page: str) -> bool: """Check if a page exists :param page: url of the page :return:""" <|body_1|> def getpage(self, page: str, ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Wikipedia: def __init__(self) -> None: """You can use this class to look up a page on wikipedia""" self.__author__ = 'GodSaveTheDoge' self.selector = '#mw-content-text li , p' self.url = 'https://{}.wikipedia.org/wiki/{}' self.apiurl = 'https://en.wikipedia.org/w/api.ph...
the_stack_v2_python_sparse
methods/Wiki.py
ankit-sinha-18/MultiUserbot
train
0
f463be88b853bbd18d79428e0b26cc2b489eba14
[ "self.k = k\nself.arr = nums\nself.arr.sort()\nwhile len(self.arr) > self.k:\n self.arr.pop(0)", "self.arr.append(val)\nself.arr.sort()\nif len(self.arr) > self.k:\n self.arr.pop(0)\nreturn self.arr[0]" ]
<|body_start_0|> self.k = k self.arr = nums self.arr.sort() while len(self.arr) > self.k: self.arr.pop(0) <|end_body_0|> <|body_start_1|> self.arr.append(val) self.arr.sort() if len(self.arr) > self.k: self.arr.pop(0) return self.a...
KthLargest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.k = k self.arr = nums self.arr.sort()...
stack_v2_sparse_classes_10k_train_006963
630
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_002710
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
920b65db80031fad45d495431eda8d3fb4ef06e5
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.k = k self.arr = nums self.arr.sort() while len(self.arr) > self.k: self.arr.pop(0) def add(self, val): """:type val: int :rtype: int""" self.arr.appe...
the_stack_v2_python_sparse
easy/ex703.py
ziyuan-shen/leetcode_algorithm_python_solution
train
2
34214125728ef5378fc0039be119a79c54feb478
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn PrintTaskDefinition()", "from .app_identity import AppIdentity\nfrom .entity import Entity\nfrom .print_task import PrintTask\nfrom .app_identity import AppIdentity\nfrom .entity import Entity\nfrom .print_task import PrintTask\nfields...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return PrintTaskDefinition() <|end_body_0|> <|body_start_1|> from .app_identity import AppIdentity from .entity import Entity from .print_task import PrintTask from .app_identit...
PrintTaskDefinition
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrintTaskDefinition: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrintTaskDefinition: """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 ob...
stack_v2_sparse_classes_10k_train_006964
2,858
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: PrintTaskDefinition", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator...
3
stack_v2_sparse_classes_30k_train_001973
Implement the Python class `PrintTaskDefinition` described below. Class description: Implement the PrintTaskDefinition class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrintTaskDefinition: Creates a new instance of the appropriate class based on d...
Implement the Python class `PrintTaskDefinition` described below. Class description: Implement the PrintTaskDefinition class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrintTaskDefinition: Creates a new instance of the appropriate class based on d...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class PrintTaskDefinition: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrintTaskDefinition: """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 ob...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PrintTaskDefinition: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrintTaskDefinition: """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: ...
the_stack_v2_python_sparse
msgraph/generated/models/print_task_definition.py
microsoftgraph/msgraph-sdk-python
train
135
90bb4f0e13c4dfbad464e855fa6ce8530677ba8b
[ "if not -2 ** 31 < x < 2 ** 31 - 1:\n return 0\nif x < 0:\n y = int(str(-x)[::-1]) * -1\nelse:\n y = int(str(x)[::-1])\nif not -2 ** 31 < y < 2 ** 31 - 1:\n return 0\nreturn y", "x = str(x)\nif '-' not in str(x):\n y = int(str(x)[::-1])\nelse:\n x = [v for v in x if v != '-']\n x = ''.join(x)...
<|body_start_0|> if not -2 ** 31 < x < 2 ** 31 - 1: return 0 if x < 0: y = int(str(-x)[::-1]) * -1 else: y = int(str(x)[::-1]) if not -2 ** 31 < y < 2 ** 31 - 1: return 0 return y <|end_body_0|> <|body_start_1|> x = str(x) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverse(self, x): """:type x: int :rtype: int""" <|body_0|> def reverse_str(self, x): """:type x: int :rtype: int""" <|body_1|> def reverse_math(self, x): """:type x: int :rtype: int""" <|body_2|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_10k_train_006965
1,905
no_license
[ { "docstring": ":type x: int :rtype: int", "name": "reverse", "signature": "def reverse(self, x)" }, { "docstring": ":type x: int :rtype: int", "name": "reverse_str", "signature": "def reverse_str(self, x)" }, { "docstring": ":type x: int :rtype: int", "name": "reverse_math",...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse(self, x): :type x: int :rtype: int - def reverse_str(self, x): :type x: int :rtype: int - def reverse_math(self, x): :type x: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse(self, x): :type x: int :rtype: int - def reverse_str(self, x): :type x: int :rtype: int - def reverse_math(self, x): :type x: int :rtype: int <|skeleton|> class Solu...
2d5fa4cd696d5035ea8859befeadc5cc436959c9
<|skeleton|> class Solution: def reverse(self, x): """:type x: int :rtype: int""" <|body_0|> def reverse_str(self, x): """:type x: int :rtype: int""" <|body_1|> def reverse_math(self, x): """:type x: int :rtype: int""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def reverse(self, x): """:type x: int :rtype: int""" if not -2 ** 31 < x < 2 ** 31 - 1: return 0 if x < 0: y = int(str(-x)[::-1]) * -1 else: y = int(str(x)[::-1]) if not -2 ** 31 < y < 2 ** 31 - 1: return 0 ...
the_stack_v2_python_sparse
SourceCode/Python/Problem/00007.Reverse Integer.py
roger6blog/LeetCode
train
0
ea97491740fdb756629ae14602b1db028a3c93fa
[ "leoTkinterDialog.__init__(self, title, resizeable)\nself.createTopFrame()\nself.top.bind('<Key>', self.onKey)\nif message:\n self.createMessageFrame(message)\nbuttons = ({'text': 'Yes', 'command': self.yesButton, 'default': True}, {'text': 'No', 'command': self.noButton})\nself.createButtons(buttons)", "ch = ...
<|body_start_0|> leoTkinterDialog.__init__(self, title, resizeable) self.createTopFrame() self.top.bind('<Key>', self.onKey) if message: self.createMessageFrame(message) buttons = ({'text': 'Yes', 'command': self.yesButton, 'default': True}, {'text': 'No', 'command': ...
A class that creates a Tkinter dialog with two buttons: Yes and No.
tkinterAskYesNo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class tkinterAskYesNo: """A class that creates a Tkinter dialog with two buttons: Yes and No.""" def __init__(self, title, message=None, resizeable=False): """Create a dialog having yes and no buttons.""" <|body_0|> def onKey(self, event): """Handle keystroke events in...
stack_v2_sparse_classes_10k_train_006966
25,997
no_license
[ { "docstring": "Create a dialog having yes and no buttons.", "name": "__init__", "signature": "def __init__(self, title, message=None, resizeable=False)" }, { "docstring": "Handle keystroke events in dialogs having yes and no buttons.", "name": "onKey", "signature": "def onKey(self, even...
2
stack_v2_sparse_classes_30k_val_000224
Implement the Python class `tkinterAskYesNo` described below. Class description: A class that creates a Tkinter dialog with two buttons: Yes and No. Method signatures and docstrings: - def __init__(self, title, message=None, resizeable=False): Create a dialog having yes and no buttons. - def onKey(self, event): Handl...
Implement the Python class `tkinterAskYesNo` described below. Class description: A class that creates a Tkinter dialog with two buttons: Yes and No. Method signatures and docstrings: - def __init__(self, title, message=None, resizeable=False): Create a dialog having yes and no buttons. - def onKey(self, event): Handl...
28c22721e1bc313c120a8a6c288893bc566a5c67
<|skeleton|> class tkinterAskYesNo: """A class that creates a Tkinter dialog with two buttons: Yes and No.""" def __init__(self, title, message=None, resizeable=False): """Create a dialog having yes and no buttons.""" <|body_0|> def onKey(self, event): """Handle keystroke events in...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class tkinterAskYesNo: """A class that creates a Tkinter dialog with two buttons: Yes and No.""" def __init__(self, title, message=None, resizeable=False): """Create a dialog having yes and no buttons.""" leoTkinterDialog.__init__(self, title, resizeable) self.createTopFrame() s...
the_stack_v2_python_sparse
Projects/jyleo/src/leoTkinterDialog.py
leo-editor/leo-editor-contrib
train
6
d2d592d3ecb224608f13f4e89ae27264652d4913
[ "count = 0\nflag = 1\nwhile flag <= n:\n if n & flag:\n count += 1\n flag = flag << 1\n print(flag)\nprint(count)\nreturn count", "count = 0\nwhile n:\n count += 1\n n = n - 1 & n\nreturn count" ]
<|body_start_0|> count = 0 flag = 1 while flag <= n: if n & flag: count += 1 flag = flag << 1 print(flag) print(count) return count <|end_body_0|> <|body_start_1|> count = 0 while n: count += 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hammingWeight(self, n): """:type n: int :rtype: int""" <|body_0|> def hammingWeight2(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> count = 0 flag = 1 while flag <= n: ...
stack_v2_sparse_classes_10k_train_006967
606
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "hammingWeight", "signature": "def hammingWeight(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "hammingWeight2", "signature": "def hammingWeight2(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_006155
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hammingWeight(self, n): :type n: int :rtype: int - def hammingWeight2(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hammingWeight(self, n): :type n: int :rtype: int - def hammingWeight2(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def hammingWeight(self, n): ...
38eec6f07fdc16658372490cd8c68dcb3d88a77f
<|skeleton|> class Solution: def hammingWeight(self, n): """:type n: int :rtype: int""" <|body_0|> def hammingWeight2(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def hammingWeight(self, n): """:type n: int :rtype: int""" count = 0 flag = 1 while flag <= n: if n & flag: count += 1 flag = flag << 1 print(flag) print(count) return count def hammingWeight2(se...
the_stack_v2_python_sparse
offer/15.py
gebijiaxiaowang/leetcode
train
0
9a24c9335ef51e078bb970aa7705783607e06e86
[ "Editeur.__init__(self, pere, objet, attribut)\nself.ajouter_option('n', self.opt_creer_etat)\nself.ajouter_option('d', self.opt_supprimer_etat)", "prototype = self.objet\nmsg = '| |tit|' + 'Edition des états de {}'.format(prototype).ljust(76)\nmsg += '|ff||\\n' + self.opts.separateur + '\\n'\nmsg += 'Options :\\...
<|body_start_0|> Editeur.__init__(self, pere, objet, attribut) self.ajouter_option('n', self.opt_creer_etat) self.ajouter_option('d', self.opt_supprimer_etat) <|end_body_0|> <|body_start_1|> prototype = self.objet msg = '| |tit|' + 'Edition des états de {}'.format(prototype).lju...
Contexte-éditeur d'édition des états.
EdtEtats
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EdtEtats: """Contexte-éditeur d'édition des états.""" def __init__(self, pere, objet=None, attribut=None): """Constructeur de l'éditeur""" <|body_0|> def accueil(self): """Message d'accueil du contexte""" <|body_1|> def opt_creer_etat(self, arguments...
stack_v2_sparse_classes_10k_train_006968
4,367
permissive
[ { "docstring": "Constructeur de l'éditeur", "name": "__init__", "signature": "def __init__(self, pere, objet=None, attribut=None)" }, { "docstring": "Message d'accueil du contexte", "name": "accueil", "signature": "def accueil(self)" }, { "docstring": "Crée un nouvel état. Syntax...
5
null
Implement the Python class `EdtEtats` described below. Class description: Contexte-éditeur d'édition des états. Method signatures and docstrings: - def __init__(self, pere, objet=None, attribut=None): Constructeur de l'éditeur - def accueil(self): Message d'accueil du contexte - def opt_creer_etat(self, arguments): C...
Implement the Python class `EdtEtats` described below. Class description: Contexte-éditeur d'édition des états. Method signatures and docstrings: - def __init__(self, pere, objet=None, attribut=None): Constructeur de l'éditeur - def accueil(self): Message d'accueil du contexte - def opt_creer_etat(self, arguments): C...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class EdtEtats: """Contexte-éditeur d'édition des états.""" def __init__(self, pere, objet=None, attribut=None): """Constructeur de l'éditeur""" <|body_0|> def accueil(self): """Message d'accueil du contexte""" <|body_1|> def opt_creer_etat(self, arguments...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EdtEtats: """Contexte-éditeur d'édition des états.""" def __init__(self, pere, objet=None, attribut=None): """Constructeur de l'éditeur""" Editeur.__init__(self, pere, objet, attribut) self.ajouter_option('n', self.opt_creer_etat) self.ajouter_option('d', self.opt_supprime...
the_stack_v2_python_sparse
src/primaires/salle/editeurs/sbedit/edt_etats.py
vincent-lg/tsunami
train
5
6944c738e108175e6c7a35cda0a120ffcf5e1c54
[ "self.attr_flags = attr_flags\nself.dest_value = dest_value\nself.ldap_name = ldap_name\nself.same_value = same_value\nself.source_value = source_value\nself.status = status", "if dictionary is None:\n return None\nattr_flags = dictionary.get('attrFlags')\ndest_value = cohesity_management_sdk.models.compare_ad...
<|body_start_0|> self.attr_flags = attr_flags self.dest_value = dest_value self.ldap_name = ldap_name self.same_value = same_value self.source_value = source_value self.status = status <|end_body_0|> <|body_start_1|> if dictionary is None: return None...
Implementation of the 'CompareADObjectsResult_ADAttribute' model. TODO: type description here. Attributes: attr_flags (int): Object result flags of type ADAttributeFlags. dest_value (CompareADObjectsResult_ADAttributeValue): Destination attribute value if dest value exists (!ADAttributeFlags.kNotFound) and is different...
CompareADObjectsResult_ADAttribute
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompareADObjectsResult_ADAttribute: """Implementation of the 'CompareADObjectsResult_ADAttribute' model. TODO: type description here. Attributes: attr_flags (int): Object result flags of type ADAttributeFlags. dest_value (CompareADObjectsResult_ADAttributeValue): Destination attribute value if de...
stack_v2_sparse_classes_10k_train_006969
3,784
permissive
[ { "docstring": "Constructor for the CompareADObjectsResult_ADAttribute class", "name": "__init__", "signature": "def __init__(self, attr_flags=None, dest_value=None, ldap_name=None, same_value=None, source_value=None, status=None)" }, { "docstring": "Creates an instance of this model from a dict...
2
null
Implement the Python class `CompareADObjectsResult_ADAttribute` described below. Class description: Implementation of the 'CompareADObjectsResult_ADAttribute' model. TODO: type description here. Attributes: attr_flags (int): Object result flags of type ADAttributeFlags. dest_value (CompareADObjectsResult_ADAttributeVa...
Implement the Python class `CompareADObjectsResult_ADAttribute` described below. Class description: Implementation of the 'CompareADObjectsResult_ADAttribute' model. TODO: type description here. Attributes: attr_flags (int): Object result flags of type ADAttributeFlags. dest_value (CompareADObjectsResult_ADAttributeVa...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class CompareADObjectsResult_ADAttribute: """Implementation of the 'CompareADObjectsResult_ADAttribute' model. TODO: type description here. Attributes: attr_flags (int): Object result flags of type ADAttributeFlags. dest_value (CompareADObjectsResult_ADAttributeValue): Destination attribute value if de...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CompareADObjectsResult_ADAttribute: """Implementation of the 'CompareADObjectsResult_ADAttribute' model. TODO: type description here. Attributes: attr_flags (int): Object result flags of type ADAttributeFlags. dest_value (CompareADObjectsResult_ADAttributeValue): Destination attribute value if dest value exis...
the_stack_v2_python_sparse
cohesity_management_sdk/models/compare_ad_objects_result_ad_attribute.py
cohesity/management-sdk-python
train
24
7d9810ea4d21b6a6becb8acb1572f7495b048e6b
[ "self.m = collections.defaultdict(list)\nfor i, word in enumerate(words):\n self.m[word].append(i)", "idx1, idx2 = (self.m[word1], self.m[word2])\nres = float('inf')\ni = j = 0\nwhile i < len(idx1) and j < len(idx2):\n res = min(res, abs(idx1[i] - idx2[j]))\n if idx1[i] < idx2[j]:\n i += 1\n el...
<|body_start_0|> self.m = collections.defaultdict(list) for i, word in enumerate(words): self.m[word].append(i) <|end_body_0|> <|body_start_1|> idx1, idx2 = (self.m[word1], self.m[word2]) res = float('inf') i = j = 0 while i < len(idx1) and j < len(idx2): ...
WordDistance
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordDistance: def __init__(self, words): """:type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.m = collections.defaultdict(list...
stack_v2_sparse_classes_10k_train_006970
785
no_license
[ { "docstring": ":type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type word1: str :type word2: str :rtype: int", "name": "shortest", "signature": "def shortest(self, word1, word2)" } ]
2
null
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int <|skeleton|> class WordDistance: ...
5b14b6f42baf59b04cbcc8e115df4272029b64c8
<|skeleton|> class WordDistance: def __init__(self, words): """:type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WordDistance: def __init__(self, words): """:type words: List[str]""" self.m = collections.defaultdict(list) for i, word in enumerate(words): self.m[word].append(i) def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" id...
the_stack_v2_python_sparse
LeetCode/0244.Shortest-Word-Distance-Ii/Shortest-Word-Distance-Ii.py
htingwang/HandsOnAlgoDS
train
12
a7c6de54e0b4448064476e07c284c9ace13e00fd
[ "cnt = [0] * 2\nleft, right = (0, 0)\nres = 0\nwhile right < len(nums):\n cnt[nums[right]] += 1\n if nums[right] == 0:\n while cnt[0] > k:\n cnt[nums[left]] -= 1\n left += 1\n if cnt[0] <= k:\n while right + 1 < len(nums) and nums[right + 1] == 1:\n right += 1...
<|body_start_0|> cnt = [0] * 2 left, right = (0, 0) res = 0 while right < len(nums): cnt[nums[right]] += 1 if nums[right] == 0: while cnt[0] > k: cnt[nums[left]] -= 1 left += 1 if cnt[0] <= k: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestOnes(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def longestOnes2(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> cnt = [0] * ...
stack_v2_sparse_classes_10k_train_006971
1,278
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "longestOnes", "signature": "def longestOnes(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "longestOnes2", "signature": "def longestOnes2(self, nums, k)" } ]
2
stack_v2_sparse_classes_30k_train_003844
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestOnes(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def longestOnes2(self, nums, k): :type nums: List[int] :type k: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestOnes(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def longestOnes2(self, nums, k): :type nums: List[int] :type k: int :rtype: int <|skeleton|> cla...
a32a1add8720de35e0ddc0c51efe781fb04c9d4a
<|skeleton|> class Solution: def longestOnes(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def longestOnes2(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def longestOnes(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" cnt = [0] * 2 left, right = (0, 0) res = 0 while right < len(nums): cnt[nums[right]] += 1 if nums[right] == 0: while cnt[0] > k: ...
the_stack_v2_python_sparse
双指针/leetcode_1004_Max_Consecutive_Ones_III.py
cleverer123/Algorithm
train
0
cfe39d4fe3842f1c1a8a268abb61be7c34dda5be
[ "self._multFE = ',' in self._how\nif self._multFE:\n self._sepFE = self._how.split(', ')\nelse:\n self._sepFE = self._how\nif self._multFE:\n self._boolCombFE = ['x' in FE for FE in self._sepFE]\nelse:\n self._boolCombFE = 'x' in self._sepFE\nreturn self", "if not self._multFE:\n if self._boolCombF...
<|body_start_0|> self._multFE = ',' in self._how if self._multFE: self._sepFE = self._how.split(', ') else: self._sepFE = self._how if self._multFE: self._boolCombFE = ['x' in FE for FE in self._sepFE] else: self._boolCombFE = 'x' i...
Transformation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transformation: def inventorizeFE(self): """Function to determine how to transform""" <|body_0|> def FEColumns(self): """Creates the correct FE columns. If there are any combinations of FE the method creates a new column""" <|body_1|> def dataTransformat...
stack_v2_sparse_classes_10k_train_006972
35,310
no_license
[ { "docstring": "Function to determine how to transform", "name": "inventorizeFE", "signature": "def inventorizeFE(self)" }, { "docstring": "Creates the correct FE columns. If there are any combinations of FE the method creates a new column", "name": "FEColumns", "signature": "def FEColum...
4
stack_v2_sparse_classes_30k_train_006953
Implement the Python class `Transformation` described below. Class description: Implement the Transformation class. Method signatures and docstrings: - def inventorizeFE(self): Function to determine how to transform - def FEColumns(self): Creates the correct FE columns. If there are any combinations of FE the method ...
Implement the Python class `Transformation` described below. Class description: Implement the Transformation class. Method signatures and docstrings: - def inventorizeFE(self): Function to determine how to transform - def FEColumns(self): Creates the correct FE columns. If there are any combinations of FE the method ...
fd00afeae5ea691ca060c1e2b4fa9683a5c1f039
<|skeleton|> class Transformation: def inventorizeFE(self): """Function to determine how to transform""" <|body_0|> def FEColumns(self): """Creates the correct FE columns. If there are any combinations of FE the method creates a new column""" <|body_1|> def dataTransformat...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Transformation: def inventorizeFE(self): """Function to determine how to transform""" self._multFE = ',' in self._how if self._multFE: self._sepFE = self._how.split(', ') else: self._sepFE = self._how if self._multFE: self._boolCombFE...
the_stack_v2_python_sparse
Help_functions/MD_panel_estimation.py
MARQyie/PhD_project2_distance
train
0
1c1a8fca50b5a7993cf3d4e86a1b0939eb83e4c2
[ "from apysc import EventType\nfrom apysc import MouseEvent\nfrom apysc.event.handler import append_handler_expression\nfrom apysc.event.handler import get_handler_name\nfrom apysc.type.variable_name_interface import VariableNameInterface\nself_instance: VariableNameInterface = self._validate_self_is_variable_name_i...
<|body_start_0|> from apysc import EventType from apysc import MouseEvent from apysc.event.handler import append_handler_expression from apysc.event.handler import get_handler_name from apysc.type.variable_name_interface import VariableNameInterface self_instance: Variabl...
MouseOutInterface
[ "MIT", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MouseOutInterface: def mouseout(self, handler: Handler, options: Optional[Dict[str, Any]]=None) -> str: """Add mouse out event listener setting. Parameters ---------- handler : Handler Callable that called when mouse is outed on this instance. options : dict or None, default None Optiona...
stack_v2_sparse_classes_10k_train_006973
3,029
permissive
[ { "docstring": "Add mouse out event listener setting. Parameters ---------- handler : Handler Callable that called when mouse is outed on this instance. options : dict or None, default None Optional arguments dictionary to be passed to handler. Returns ------- name : str Handler's name.", "name": "mouseout"...
4
stack_v2_sparse_classes_30k_train_004141
Implement the Python class `MouseOutInterface` described below. Class description: Implement the MouseOutInterface class. Method signatures and docstrings: - def mouseout(self, handler: Handler, options: Optional[Dict[str, Any]]=None) -> str: Add mouse out event listener setting. Parameters ---------- handler : Handl...
Implement the Python class `MouseOutInterface` described below. Class description: Implement the MouseOutInterface class. Method signatures and docstrings: - def mouseout(self, handler: Handler, options: Optional[Dict[str, Any]]=None) -> str: Add mouse out event listener setting. Parameters ---------- handler : Handl...
5c6a4674e2e9684cb2cb1325dc9b070879d4d355
<|skeleton|> class MouseOutInterface: def mouseout(self, handler: Handler, options: Optional[Dict[str, Any]]=None) -> str: """Add mouse out event listener setting. Parameters ---------- handler : Handler Callable that called when mouse is outed on this instance. options : dict or None, default None Optiona...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MouseOutInterface: def mouseout(self, handler: Handler, options: Optional[Dict[str, Any]]=None) -> str: """Add mouse out event listener setting. Parameters ---------- handler : Handler Callable that called when mouse is outed on this instance. options : dict or None, default None Optional arguments di...
the_stack_v2_python_sparse
apysc/event/mouse_out_interface.py
TrendingTechnology/apysc
train
0
3d317fbd1b08326fd870ca9d738ca97b660df64d
[ "self.text = ''\nself.keywords = None\nself.seg = Segmentation(stop_words_file=stop_words_file, allow_speech_tags=allow_speech_tags, delimiters=delimiters)\nself.sentences = None\nself.words_no_filter = None\nself.words_no_stop_words = None\nself.words_all_filters = None", "self.text = text\nself.word_index = {}\...
<|body_start_0|> self.text = '' self.keywords = None self.seg = Segmentation(stop_words_file=stop_words_file, allow_speech_tags=allow_speech_tags, delimiters=delimiters) self.sentences = None self.words_no_filter = None self.words_no_stop_words = None self.words_a...
TextRankKeyword
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextRankKeyword: def __init__(self, stop_words_file='./stopwords.txt', allow_speech_tags=util.allow_speech_tags, delimiters=util.sentence_delimiters): """Keyword arguments: stop_words_file -- str,指定停止词文件路径(一行一个停止词),若为其他类型,则使用默认停止词文件 delimiters -- 默认值是`?!;?!。;… `,用来将文本拆分为句子。 Object Var: w...
stack_v2_sparse_classes_10k_train_006974
8,424
no_license
[ { "docstring": "Keyword arguments: stop_words_file -- str,指定停止词文件路径(一行一个停止词),若为其他类型,则使用默认停止词文件 delimiters -- 默认值是`?!;?!。;… `,用来将文本拆分为句子。 Object Var: words_no_filter -- 对sentences中每个句子分词而得到的两级列表。 words_no_stop_words -- 去掉words_no_filter中的停止词而得到的两级列表。 words_all_filters -- 保留words_no_stop_words中指定词性的单词而得到的两级列表。", ...
4
stack_v2_sparse_classes_30k_train_001285
Implement the Python class `TextRankKeyword` described below. Class description: Implement the TextRankKeyword class. Method signatures and docstrings: - def __init__(self, stop_words_file='./stopwords.txt', allow_speech_tags=util.allow_speech_tags, delimiters=util.sentence_delimiters): Keyword arguments: stop_words_...
Implement the Python class `TextRankKeyword` described below. Class description: Implement the TextRankKeyword class. Method signatures and docstrings: - def __init__(self, stop_words_file='./stopwords.txt', allow_speech_tags=util.allow_speech_tags, delimiters=util.sentence_delimiters): Keyword arguments: stop_words_...
7f7c4e56a8a66618feeb245b5394c0fc7d4f529a
<|skeleton|> class TextRankKeyword: def __init__(self, stop_words_file='./stopwords.txt', allow_speech_tags=util.allow_speech_tags, delimiters=util.sentence_delimiters): """Keyword arguments: stop_words_file -- str,指定停止词文件路径(一行一个停止词),若为其他类型,则使用默认停止词文件 delimiters -- 默认值是`?!;?!。;… `,用来将文本拆分为句子。 Object Var: w...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TextRankKeyword: def __init__(self, stop_words_file='./stopwords.txt', allow_speech_tags=util.allow_speech_tags, delimiters=util.sentence_delimiters): """Keyword arguments: stop_words_file -- str,指定停止词文件路径(一行一个停止词),若为其他类型,则使用默认停止词文件 delimiters -- 默认值是`?!;?!。;… `,用来将文本拆分为句子。 Object Var: words_no_filter...
the_stack_v2_python_sparse
KwordExtr/TextRank/TextRankKeyword.py
primingrx/NLP
train
0
cdc19af05f58fcb427e17f867790974aecb5254a
[ "if remote.ssh:\n return Connection(remote.ssh)\nelif remote.http:\n hostName = urlparse(remote.http).hostname\n username = None\n password = None\n if hostName in httpCredentials:\n username = httpCredentials[hostName].username\n password = httpCredentials[hostName].password\n retur...
<|body_start_0|> if remote.ssh: return Connection(remote.ssh) elif remote.http: hostName = urlparse(remote.http).hostname username = None password = None if hostName in httpCredentials: username = httpCredentials[hostName].usern...
Collection of drepo utility functions
Utils
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Utils: """Collection of drepo utility functions""" def createQueryConnection(remote, httpCredentials): """Create a query connection (HTTP or SSH) based on what's available in the given remote @param remote Remote @param httpCredentials A map of HTTP credentials""" <|body_0|> ...
stack_v2_sparse_classes_10k_train_006975
3,013
permissive
[ { "docstring": "Create a query connection (HTTP or SSH) based on what's available in the given remote @param remote Remote @param httpCredentials A map of HTTP credentials", "name": "createQueryConnection", "signature": "def createQueryConnection(remote, httpCredentials)" }, { "docstring": "Inje...
2
stack_v2_sparse_classes_30k_train_005270
Implement the Python class `Utils` described below. Class description: Collection of drepo utility functions Method signatures and docstrings: - def createQueryConnection(remote, httpCredentials): Create a query connection (HTTP or SSH) based on what's available in the given remote @param remote Remote @param httpCre...
Implement the Python class `Utils` described below. Class description: Collection of drepo utility functions Method signatures and docstrings: - def createQueryConnection(remote, httpCredentials): Create a query connection (HTTP or SSH) based on what's available in the given remote @param remote Remote @param httpCre...
58a035a08a7c58035c25f992c1b8aa33cc997cd2
<|skeleton|> class Utils: """Collection of drepo utility functions""" def createQueryConnection(remote, httpCredentials): """Create a query connection (HTTP or SSH) based on what's available in the given remote @param remote Remote @param httpCredentials A map of HTTP credentials""" <|body_0|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Utils: """Collection of drepo utility functions""" def createQueryConnection(remote, httpCredentials): """Create a query connection (HTTP or SSH) based on what's available in the given remote @param remote Remote @param httpCredentials A map of HTTP credentials""" if remote.ssh: ...
the_stack_v2_python_sparse
du/drepo/Utils.py
spiricn/DevUtils
train
1
2c8107e7a8d8da7babf3458be79656bf6ddf9cf4
[ "super(SelfAttention, self).__init__()\nself.units = units\nself.W = tf.keras.layers.Dense(units)\nself.U = tf.keras.layers.Dense(units)\nself.V = tf.keras.layers.Dense(1)", "prev = tf.expand_dims(s_prev, axis=1)\nscore = self.V(tf.nn.tanh(self.W(prev) + self.U(hidden_states)))\nweights = tf.nn.softmax(score, axi...
<|body_start_0|> super(SelfAttention, self).__init__() self.units = units self.W = tf.keras.layers.Dense(units) self.U = tf.keras.layers.Dense(units) self.V = tf.keras.layers.Dense(1) <|end_body_0|> <|body_start_1|> prev = tf.expand_dims(s_prev, axis=1) score = s...
class SelfAttention
SelfAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SelfAttention: """class SelfAttention""" def __init__(self, units): """Class constructor""" <|body_0|> def call(self, s_prev, hidden_states): """call function""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(SelfAttention, self).__init__() ...
stack_v2_sparse_classes_10k_train_006976
754
no_license
[ { "docstring": "Class constructor", "name": "__init__", "signature": "def __init__(self, units)" }, { "docstring": "call function", "name": "call", "signature": "def call(self, s_prev, hidden_states)" } ]
2
stack_v2_sparse_classes_30k_train_000095
Implement the Python class `SelfAttention` described below. Class description: class SelfAttention Method signatures and docstrings: - def __init__(self, units): Class constructor - def call(self, s_prev, hidden_states): call function
Implement the Python class `SelfAttention` described below. Class description: class SelfAttention Method signatures and docstrings: - def __init__(self, units): Class constructor - def call(self, s_prev, hidden_states): call function <|skeleton|> class SelfAttention: """class SelfAttention""" def __init__(...
a49eb348ff994f35b0efbbd5ac3ac8ae8ccb57d2
<|skeleton|> class SelfAttention: """class SelfAttention""" def __init__(self, units): """Class constructor""" <|body_0|> def call(self, s_prev, hidden_states): """call function""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SelfAttention: """class SelfAttention""" def __init__(self, units): """Class constructor""" super(SelfAttention, self).__init__() self.units = units self.W = tf.keras.layers.Dense(units) self.U = tf.keras.layers.Dense(units) self.V = tf.keras.layers.Dense(1...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/1-self_attention.py
salmenz/holbertonschool-machine_learning
train
4
72e365b959c1cd6aec2927d4b10361517de9c055
[ "self.middle = middle\nself.timeout = timeout\nself.locations = locations", "to_do = plan['visit']\nfor loc in to_do:\n position = self.locations[loc]\n arrived = self.middle.do({'go_to': position, 'timeout': self.timeout})\n self.display(1, 'Arrived at', loc, arrived)" ]
<|body_start_0|> self.middle = middle self.timeout = timeout self.locations = locations <|end_body_0|> <|body_start_1|> to_do = plan['visit'] for loc in to_do: position = self.locations[loc] arrived = self.middle.do({'go_to': position, 'timeout': self.tim...
Rob_top_layer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rob_top_layer: def __init__(self, middle, timeout=200, locations={'mail': (-5, 10), 'o103': (50, 10), 'o109': (100, 10), 'storage': (101, 51)}): """middle is the middle layer timeout is the number of steps the middle layer goes before giving up locations is a loc:pos dictionary where loc...
stack_v2_sparse_classes_10k_train_006977
3,349
no_license
[ { "docstring": "middle is the middle layer timeout is the number of steps the middle layer goes before giving up locations is a loc:pos dictionary where loc is a named location, and pos is an (x,y) position.", "name": "__init__", "signature": "def __init__(self, middle, timeout=200, locations={'mail': (...
2
stack_v2_sparse_classes_30k_train_000447
Implement the Python class `Rob_top_layer` described below. Class description: Implement the Rob_top_layer class. Method signatures and docstrings: - def __init__(self, middle, timeout=200, locations={'mail': (-5, 10), 'o103': (50, 10), 'o109': (100, 10), 'storage': (101, 51)}): middle is the middle layer timeout is ...
Implement the Python class `Rob_top_layer` described below. Class description: Implement the Rob_top_layer class. Method signatures and docstrings: - def __init__(self, middle, timeout=200, locations={'mail': (-5, 10), 'o103': (50, 10), 'o109': (100, 10), 'storage': (101, 51)}): middle is the middle layer timeout is ...
479d6120b75ac0ff602f032474cad440cadd9f31
<|skeleton|> class Rob_top_layer: def __init__(self, middle, timeout=200, locations={'mail': (-5, 10), 'o103': (50, 10), 'o109': (100, 10), 'storage': (101, 51)}): """middle is the middle layer timeout is the number of steps the middle layer goes before giving up locations is a loc:pos dictionary where loc...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Rob_top_layer: def __init__(self, middle, timeout=200, locations={'mail': (-5, 10), 'o103': (50, 10), 'o109': (100, 10), 'storage': (101, 51)}): """middle is the middle layer timeout is the number of steps the middle layer goes before giving up locations is a loc:pos dictionary where loc is a named lo...
the_stack_v2_python_sparse
ass1/aipython/agentTop.py
fckphil/COMP9814
train
5
83569443e35a57b8a489b7b74e4b49760d2ae5da
[ "self.x = input\nself.y = label\nself.sigmoid_layers = []\nself.rbm_layers = []\nself.n_layers = len(hidden_layer_size)\nif rng == None:\n rng = np.random.RandomState(111)\nassert self.n_layers > 0\nfor i in range(self.n_layers):\n if i == 0:\n input_size = n_ins\n else:\n input_size = hidden...
<|body_start_0|> self.x = input self.y = label self.sigmoid_layers = [] self.rbm_layers = [] self.n_layers = len(hidden_layer_size) if rng == None: rng = np.random.RandomState(111) assert self.n_layers > 0 for i in range(self.n_layers): ...
深度置信网络 几个问题:为什么引入sigmoid层(隐层),这是一个MLP和RBMs共存的网络,我们在训练RBMs的同时得到的更新参数值是与MLP共享的,即我们 其实是采用无监督预训练层层的RBM得到的参数,其实的得到的就是MLP的参数,然后最后再接一个Logstic层,用于做监督学习的,然 后再利用的finetune的方式微调一下参数。
DBN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DBN: """深度置信网络 几个问题:为什么引入sigmoid层(隐层),这是一个MLP和RBMs共存的网络,我们在训练RBMs的同时得到的更新参数值是与MLP共享的,即我们 其实是采用无监督预训练层层的RBM得到的参数,其实的得到的就是MLP的参数,然后最后再接一个Logstic层,用于做监督学习的,然 后再利用的finetune的方式微调一下参数。""" def __init__(self, input=None, label=None, n_ins=2, hidden_layer_size=[3, 3], n_out=2, rng=None): """:...
stack_v2_sparse_classes_10k_train_006978
5,851
no_license
[ { "docstring": ":param input: 输入数据的属性 :param label: 输入数据的标签 :param n_ins: 输入层, 数据属性的数量 :param hidden_layer_size: :param n_out: 输出层,总共要输出几个标签 :param rng: 随机数发生器", "name": "__init__", "signature": "def __init__(self, input=None, label=None, n_ins=2, hidden_layer_size=[3, 3], n_out=2, rng=None)" }, { ...
4
stack_v2_sparse_classes_30k_train_005020
Implement the Python class `DBN` described below. Class description: 深度置信网络 几个问题:为什么引入sigmoid层(隐层),这是一个MLP和RBMs共存的网络,我们在训练RBMs的同时得到的更新参数值是与MLP共享的,即我们 其实是采用无监督预训练层层的RBM得到的参数,其实的得到的就是MLP的参数,然后最后再接一个Logstic层,用于做监督学习的,然 后再利用的finetune的方式微调一下参数。 Method signatures and docstrings: - def __init__(self, input=None, label=None,...
Implement the Python class `DBN` described below. Class description: 深度置信网络 几个问题:为什么引入sigmoid层(隐层),这是一个MLP和RBMs共存的网络,我们在训练RBMs的同时得到的更新参数值是与MLP共享的,即我们 其实是采用无监督预训练层层的RBM得到的参数,其实的得到的就是MLP的参数,然后最后再接一个Logstic层,用于做监督学习的,然 后再利用的finetune的方式微调一下参数。 Method signatures and docstrings: - def __init__(self, input=None, label=None,...
8fda025b7fea0fd4ad9e9fafd4736f75ec452b2f
<|skeleton|> class DBN: """深度置信网络 几个问题:为什么引入sigmoid层(隐层),这是一个MLP和RBMs共存的网络,我们在训练RBMs的同时得到的更新参数值是与MLP共享的,即我们 其实是采用无监督预训练层层的RBM得到的参数,其实的得到的就是MLP的参数,然后最后再接一个Logstic层,用于做监督学习的,然 后再利用的finetune的方式微调一下参数。""" def __init__(self, input=None, label=None, n_ins=2, hidden_layer_size=[3, 3], n_out=2, rng=None): """:...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DBN: """深度置信网络 几个问题:为什么引入sigmoid层(隐层),这是一个MLP和RBMs共存的网络,我们在训练RBMs的同时得到的更新参数值是与MLP共享的,即我们 其实是采用无监督预训练层层的RBM得到的参数,其实的得到的就是MLP的参数,然后最后再接一个Logstic层,用于做监督学习的,然 后再利用的finetune的方式微调一下参数。""" def __init__(self, input=None, label=None, n_ins=2, hidden_layer_size=[3, 3], n_out=2, rng=None): """:param input: ...
the_stack_v2_python_sparse
Deep_learning/Simplify_model/DBN.py
chunchunya/machine_learning_algorithms
train
0
358b9fc7008e0fd736df204b022c6b2b48ccf631
[ "self.dict = collections.defaultdict(set)\nfor word in dictionary:\n if word:\n self.dict[word[0] + str(len(word) - 2) + word[-1]].add(word)", "if not word:\n return True\nkey = word[0] + str(len(word) - 2) + word[-1]\nif word in self.dict[key]:\n return len(self.dict[key]) == 1\nelse:\n return...
<|body_start_0|> self.dict = collections.defaultdict(set) for word in dictionary: if word: self.dict[word[0] + str(len(word) - 2) + word[-1]].add(word) <|end_body_0|> <|body_start_1|> if not word: return True key = word[0] + str(len(word) - 2) + w...
ValidWordAbbr
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidWordAbbr: def __init__(self, dictionary): """:type dictionary: List[str]""" <|body_0|> def isUnique(self, word): """:type word: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.dict = collections.defaultdict(set) fo...
stack_v2_sparse_classes_10k_train_006979
751
no_license
[ { "docstring": ":type dictionary: List[str]", "name": "__init__", "signature": "def __init__(self, dictionary)" }, { "docstring": ":type word: str :rtype: bool", "name": "isUnique", "signature": "def isUnique(self, word)" } ]
2
null
Implement the Python class `ValidWordAbbr` described below. Class description: Implement the ValidWordAbbr class. Method signatures and docstrings: - def __init__(self, dictionary): :type dictionary: List[str] - def isUnique(self, word): :type word: str :rtype: bool
Implement the Python class `ValidWordAbbr` described below. Class description: Implement the ValidWordAbbr class. Method signatures and docstrings: - def __init__(self, dictionary): :type dictionary: List[str] - def isUnique(self, word): :type word: str :rtype: bool <|skeleton|> class ValidWordAbbr: def __init_...
5b14b6f42baf59b04cbcc8e115df4272029b64c8
<|skeleton|> class ValidWordAbbr: def __init__(self, dictionary): """:type dictionary: List[str]""" <|body_0|> def isUnique(self, word): """:type word: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ValidWordAbbr: def __init__(self, dictionary): """:type dictionary: List[str]""" self.dict = collections.defaultdict(set) for word in dictionary: if word: self.dict[word[0] + str(len(word) - 2) + word[-1]].add(word) def isUnique(self, word): """...
the_stack_v2_python_sparse
LeetCode/0288.Unique-Word-Abbreviation/Unique-Word-Abbreviation.py
htingwang/HandsOnAlgoDS
train
12
38ec1daf7d822c2cb3aa3b3a717ced0153c80ce1
[ "webapp_user = args['webapp_user']\nship_info_id = (int(args['ship_id']),)\nnew_ship_info = {'ship_name': args['ship_name'], 'ship_address': args['ship_address'], 'ship_tel': args['ship_tel'], 'area': args['area']}\narea = args['area']\nif False in map(lambda x: x.isdigit(), area.split('_')):\n webapp_user_id = ...
<|body_start_0|> webapp_user = args['webapp_user'] ship_info_id = (int(args['ship_id']),) new_ship_info = {'ship_name': args['ship_name'], 'ship_address': args['ship_address'], 'ship_tel': args['ship_tel'], 'area': args['area']} area = args['area'] if False in map(lambda x: x.isd...
收货地址
AShipInfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AShipInfo: """收货地址""" def post(args): """@brief 修改收货地址 @param ship_id @param ship_name @param ship_address @param ship_tel @param area @return {result:True}""" <|body_0|> def put(args): """新建收货地址 @param ship_name @param ship_address @param ship_tel @param area @r...
stack_v2_sparse_classes_10k_train_006980
2,372
no_license
[ { "docstring": "@brief 修改收货地址 @param ship_id @param ship_name @param ship_address @param ship_tel @param area @return {result:True}", "name": "post", "signature": "def post(args)" }, { "docstring": "新建收货地址 @param ship_name @param ship_address @param ship_tel @param area @return {'ship_info_id': ...
3
null
Implement the Python class `AShipInfo` described below. Class description: 收货地址 Method signatures and docstrings: - def post(args): @brief 修改收货地址 @param ship_id @param ship_name @param ship_address @param ship_tel @param area @return {result:True} - def put(args): 新建收货地址 @param ship_name @param ship_address @param sh...
Implement the Python class `AShipInfo` described below. Class description: 收货地址 Method signatures and docstrings: - def post(args): @brief 修改收货地址 @param ship_id @param ship_name @param ship_address @param ship_tel @param area @return {result:True} - def put(args): 新建收货地址 @param ship_name @param ship_address @param sh...
15621db1a64ffe199619924b75a5b5c5e6416bed
<|skeleton|> class AShipInfo: """收货地址""" def post(args): """@brief 修改收货地址 @param ship_id @param ship_name @param ship_address @param ship_tel @param area @return {result:True}""" <|body_0|> def put(args): """新建收货地址 @param ship_name @param ship_address @param ship_tel @param area @r...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AShipInfo: """收货地址""" def post(args): """@brief 修改收货地址 @param ship_id @param ship_name @param ship_address @param ship_tel @param area @return {result:True}""" webapp_user = args['webapp_user'] ship_info_id = (int(args['ship_id']),) new_ship_info = {'ship_name': args['ship...
the_stack_v2_python_sparse
api/mall/a_ship_info.py
nuaays/apiserver
train
0
5e1e307d01d7f127a87b51c22cdc3118de1aa0f9
[ "res = []\n\ndef helper(root):\n if not root:\n return\n if root:\n helper(root.left)\n res.append(root.data)\n helper(root.right)\nhelper(root)\nreturn res", "res = []\nstack = []\np = root\nwhile p or stack:\n while p:\n stack.append(p)\n p = stack.pop()\n res.a...
<|body_start_0|> res = [] def helper(root): if not root: return if root: helper(root.left) res.append(root.data) helper(root.right) helper(root) return res <|end_body_0|> <|body_start_1|> re...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def inorderTraversal(self, root: TreeNode) -> List[int]: """递归 时间复杂度为 O(n) 空间复杂度为 O(n) 递归可以解决问题,但是考虑到效率,我们通常不推荐使用递归 :param root: :return:""" <|body_0|> def inorderTraversal2(self, root: TreeNode) -> List[int]: """迭代 通过栈 时间复杂度为 O(n) 空间复杂度为 O(n) 但是栈有个问题,虽然栈提高...
stack_v2_sparse_classes_10k_train_006981
3,517
no_license
[ { "docstring": "递归 时间复杂度为 O(n) 空间复杂度为 O(n) 递归可以解决问题,但是考虑到效率,我们通常不推荐使用递归 :param root: :return:", "name": "inorderTraversal", "signature": "def inorderTraversal(self, root: TreeNode) -> List[int]" }, { "docstring": "迭代 通过栈 时间复杂度为 O(n) 空间复杂度为 O(n) 但是栈有个问题,虽然栈提高了效率,但是嵌套循环非常烧脑,不易理解,容易造成一看就懂 一写就废的情况,而...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def inorderTraversal(self, root: TreeNode) -> List[int]: 递归 时间复杂度为 O(n) 空间复杂度为 O(n) 递归可以解决问题,但是考虑到效率,我们通常不推荐使用递归 :param root: :return: - def inorderTraversal2(self, root: TreeNod...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def inorderTraversal(self, root: TreeNode) -> List[int]: 递归 时间复杂度为 O(n) 空间复杂度为 O(n) 递归可以解决问题,但是考虑到效率,我们通常不推荐使用递归 :param root: :return: - def inorderTraversal2(self, root: TreeNod...
51943e2c2c4ec70c7c1d5b53c9fdf0a719428d7a
<|skeleton|> class Solution: def inorderTraversal(self, root: TreeNode) -> List[int]: """递归 时间复杂度为 O(n) 空间复杂度为 O(n) 递归可以解决问题,但是考虑到效率,我们通常不推荐使用递归 :param root: :return:""" <|body_0|> def inorderTraversal2(self, root: TreeNode) -> List[int]: """迭代 通过栈 时间复杂度为 O(n) 空间复杂度为 O(n) 但是栈有个问题,虽然栈提高...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def inorderTraversal(self, root: TreeNode) -> List[int]: """递归 时间复杂度为 O(n) 空间复杂度为 O(n) 递归可以解决问题,但是考虑到效率,我们通常不推荐使用递归 :param root: :return:""" res = [] def helper(root): if not root: return if root: helper(root.left) ...
the_stack_v2_python_sparse
LeetCode_practice/BinaryTree/0094_BinaryTreeInorderTraversal.py
LeBron-Jian/BasicAlgorithmPractice
train
13
9997586f3652df7b0bfbb50b4708e5fecc8345fb
[ "input_json = request.data\noutput_json = dict(zip(['AvailabilityDetails', 'AuthenticationDetails', 'Payload'], [request.data['AvailabilityDetails'], request.data['AuthenticationDetails'], None]))\nif 'APIParams' not in input_json or 'user_ip' not in input_json['APIParams']:\n user_ip_var = None\nelse:\n user...
<|body_start_0|> input_json = request.data output_json = dict(zip(['AvailabilityDetails', 'AuthenticationDetails', 'Payload'], [request.data['AvailabilityDetails'], request.data['AuthenticationDetails'], None])) if 'APIParams' not in input_json or 'user_ip' not in input_json['APIParams']: ...
This covers the API for fetching all support centre tickets raised by the user
GetUserGeosAPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetUserGeosAPI: """This covers the API for fetching all support centre tickets raised by the user""" def post(self, request): """Post Function to fetching common questions based on ticket type.""" <|body_0|> def get_user_geos_json(self, request): """this function...
stack_v2_sparse_classes_10k_train_006982
4,683
no_license
[ { "docstring": "Post Function to fetching common questions based on ticket type.", "name": "post", "signature": "def post(self, request)" }, { "docstring": "this function calls third party API to get user's country from ip_address in case user_ip is provided in the input. If user_ip is not provi...
2
stack_v2_sparse_classes_30k_test_000366
Implement the Python class `GetUserGeosAPI` described below. Class description: This covers the API for fetching all support centre tickets raised by the user Method signatures and docstrings: - def post(self, request): Post Function to fetching common questions based on ticket type. - def get_user_geos_json(self, re...
Implement the Python class `GetUserGeosAPI` described below. Class description: This covers the API for fetching all support centre tickets raised by the user Method signatures and docstrings: - def post(self, request): Post Function to fetching common questions based on ticket type. - def get_user_geos_json(self, re...
36eb9931f330e64902354c6fc471be2adf4b7049
<|skeleton|> class GetUserGeosAPI: """This covers the API for fetching all support centre tickets raised by the user""" def post(self, request): """Post Function to fetching common questions based on ticket type.""" <|body_0|> def get_user_geos_json(self, request): """this function...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GetUserGeosAPI: """This covers the API for fetching all support centre tickets raised by the user""" def post(self, request): """Post Function to fetching common questions based on ticket type.""" input_json = request.data output_json = dict(zip(['AvailabilityDetails', 'Authentica...
the_stack_v2_python_sparse
Generic/common/location/api/get_user_geos/views_get_user_geos.py
archiemb303/common_backend_django
train
0
d178d30106276ed713d76afe79af8f3802451c1e
[ "self.pump = Pump('127.0.0.1', 8000)\nself.sensor = Sensor('127.1.1.3', 9000)\nself.decider = Decider(100, 0.05)\nself.controller = Controller(self.sensor, self.pump, self.decider)", "self.sensor.measure = MagicMock(return_value=110)\nself.pump.get_state = MagicMock(return_value='PUMP_OFF')\nself.controller.tick ...
<|body_start_0|> self.pump = Pump('127.0.0.1', 8000) self.sensor = Sensor('127.1.1.3', 9000) self.decider = Decider(100, 0.05) self.controller = Controller(self.sensor, self.pump, self.decider) <|end_body_0|> <|body_start_1|> self.sensor.measure = MagicMock(return_value=110) ...
Unit tests for the Controller class
ControllerTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ControllerTests: """Unit tests for the Controller class""" def setUp(self): """setup :return:""" <|body_0|> def test_tick(self): """test tick of Controller class :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.pump = Pump('127.0.0....
stack_v2_sparse_classes_10k_train_006983
3,198
no_license
[ { "docstring": "setup :return:", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "test tick of Controller class :return:", "name": "test_tick", "signature": "def test_tick(self)" } ]
2
stack_v2_sparse_classes_30k_train_003152
Implement the Python class `ControllerTests` described below. Class description: Unit tests for the Controller class Method signatures and docstrings: - def setUp(self): setup :return: - def test_tick(self): test tick of Controller class :return:
Implement the Python class `ControllerTests` described below. Class description: Unit tests for the Controller class Method signatures and docstrings: - def setUp(self): setup :return: - def test_tick(self): test tick of Controller class :return: <|skeleton|> class ControllerTests: """Unit tests for the Controll...
263685ca90110609bfd05d621516727f8cd0028f
<|skeleton|> class ControllerTests: """Unit tests for the Controller class""" def setUp(self): """setup :return:""" <|body_0|> def test_tick(self): """test tick of Controller class :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ControllerTests: """Unit tests for the Controller class""" def setUp(self): """setup :return:""" self.pump = Pump('127.0.0.1', 8000) self.sensor = Sensor('127.1.1.3', 9000) self.decider = Decider(100, 0.05) self.controller = Controller(self.sensor, self.pump, self....
the_stack_v2_python_sparse
students/marc_charbo/assignment_6/assign_6/waterregulation/test.py
aurel1212/Sp2018-Online
train
0
b95d712a4835f82033d7abd63d28646b75595633
[ "i, j = (0, len(nums) - 1)\nwhile i <= j:\n mid = (i + j) // 2\n if nums[mid] == target:\n return mid\n elif nums[mid] > target:\n j = mid - 1\n else:\n i = mid + 1\nreturn i", "n = len(nums)\nif nums[n - 1] < target:\n return n\nelif nums[0] > target:\n return 0\nleft, righ...
<|body_start_0|> i, j = (0, len(nums) - 1) while i <= j: mid = (i + j) // 2 if nums[mid] == target: return mid elif nums[mid] > target: j = mid - 1 else: i = mid + 1 return i <|end_body_0|> <|body_st...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchInsert(self, nums: List[int], target: int) -> int: """二分查找""" <|body_0|> def searchInsert2(self, nums: List[int], target: int) -> int: """官方答案,返回第一个大于等于 target 的下标""" <|body_1|> <|end_skeleton|> <|body_start_0|> i, j = (0, len(nu...
stack_v2_sparse_classes_10k_train_006984
2,482
no_license
[ { "docstring": "二分查找", "name": "searchInsert", "signature": "def searchInsert(self, nums: List[int], target: int) -> int" }, { "docstring": "官方答案,返回第一个大于等于 target 的下标", "name": "searchInsert2", "signature": "def searchInsert2(self, nums: List[int], target: int) -> int" } ]
2
stack_v2_sparse_classes_30k_train_005254
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchInsert(self, nums: List[int], target: int) -> int: 二分查找 - def searchInsert2(self, nums: List[int], target: int) -> int: 官方答案,返回第一个大于等于 target 的下标
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchInsert(self, nums: List[int], target: int) -> int: 二分查找 - def searchInsert2(self, nums: List[int], target: int) -> int: 官方答案,返回第一个大于等于 target 的下标 <|skeleton|> class So...
52756b30e9d51794591aca030bc918e707f473f1
<|skeleton|> class Solution: def searchInsert(self, nums: List[int], target: int) -> int: """二分查找""" <|body_0|> def searchInsert2(self, nums: List[int], target: int) -> int: """官方答案,返回第一个大于等于 target 的下标""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def searchInsert(self, nums: List[int], target: int) -> int: """二分查找""" i, j = (0, len(nums) - 1) while i <= j: mid = (i + j) // 2 if nums[mid] == target: return mid elif nums[mid] > target: j = mid - 1 ...
the_stack_v2_python_sparse
35.搜索插入位置/solution.py
QtTao/daily_leetcode
train
0
3b08750108e602ee1a2738e031c57d1854f32304
[ "import collections\ndicts = collections.defaultdict(set)\nfor allow in allowed:\n dicts[allow[0:2]].add(allow[-1])\n\ndef dfs(s, c):\n if len(s) == 1 and s + c in dicts:\n return True\n for i in dicts[s[-1] + c]:\n for j in dicts[s]:\n dicts[s + c].add(j + i)\n for i in dicts[s...
<|body_start_0|> import collections dicts = collections.defaultdict(set) for allow in allowed: dicts[allow[0:2]].add(allow[-1]) def dfs(s, c): if len(s) == 1 and s + c in dicts: return True for i in dicts[s[-1] + c]: fo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def pyramidTransition(self, bottom, allowed): """:type bottom: str :type allowed: List[str] :rtype: bool""" <|body_0|> def pyramidTransition_1(self, bottom, allowed): """:type bottom: str :type allowed: List[str] :rtype: bool 85ms worry ans""" <|bod...
stack_v2_sparse_classes_10k_train_006985
4,317
no_license
[ { "docstring": ":type bottom: str :type allowed: List[str] :rtype: bool", "name": "pyramidTransition", "signature": "def pyramidTransition(self, bottom, allowed)" }, { "docstring": ":type bottom: str :type allowed: List[str] :rtype: bool 85ms worry ans", "name": "pyramidTransition_1", "s...
2
stack_v2_sparse_classes_30k_train_005540
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pyramidTransition(self, bottom, allowed): :type bottom: str :type allowed: List[str] :rtype: bool - def pyramidTransition_1(self, bottom, allowed): :type bottom: str :type al...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pyramidTransition(self, bottom, allowed): :type bottom: str :type allowed: List[str] :rtype: bool - def pyramidTransition_1(self, bottom, allowed): :type bottom: str :type al...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def pyramidTransition(self, bottom, allowed): """:type bottom: str :type allowed: List[str] :rtype: bool""" <|body_0|> def pyramidTransition_1(self, bottom, allowed): """:type bottom: str :type allowed: List[str] :rtype: bool 85ms worry ans""" <|bod...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def pyramidTransition(self, bottom, allowed): """:type bottom: str :type allowed: List[str] :rtype: bool""" import collections dicts = collections.defaultdict(set) for allow in allowed: dicts[allow[0:2]].add(allow[-1]) def dfs(s, c): i...
the_stack_v2_python_sparse
PyramidTransitionMatrix_MID_757.py
953250587/leetcode-python
train
2
7b0d8b5cfafb5b2dc39eb2872c0b1b30e3dd1b9d
[ "user = mixer.blend(User, email='newuser@gmail.com', phone='12345678', password='test_password_1')\nuser.set_password('test_password_1')\nuser.save()\nrequest_data_cases = [{'grant_type': 'password', 'login': user.email, 'password': 'test_password_1'}, {'grant_type': 'password', 'login': user.phone, 'password': 'te...
<|body_start_0|> user = mixer.blend(User, email='newuser@gmail.com', phone='12345678', password='test_password_1') user.set_password('test_password_1') user.save() request_data_cases = [{'grant_type': 'password', 'login': user.email, 'password': 'test_password_1'}, {'grant_type': 'passwo...
TestCustomLoginView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCustomLoginView: def test_post_with_email_and_phone(self): """Test: login by user with email / phone""" <|body_0|> def test_post_with_wallet_erc20(self): """Test: login by user with wallet ERC-20""" <|body_1|> def test_post_with_refresh_token(self): ...
stack_v2_sparse_classes_10k_train_006986
6,349
permissive
[ { "docstring": "Test: login by user with email / phone", "name": "test_post_with_email_and_phone", "signature": "def test_post_with_email_and_phone(self)" }, { "docstring": "Test: login by user with wallet ERC-20", "name": "test_post_with_wallet_erc20", "signature": "def test_post_with_w...
6
stack_v2_sparse_classes_30k_train_005437
Implement the Python class `TestCustomLoginView` described below. Class description: Implement the TestCustomLoginView class. Method signatures and docstrings: - def test_post_with_email_and_phone(self): Test: login by user with email / phone - def test_post_with_wallet_erc20(self): Test: login by user with wallet ER...
Implement the Python class `TestCustomLoginView` described below. Class description: Implement the TestCustomLoginView class. Method signatures and docstrings: - def test_post_with_email_and_phone(self): Test: login by user with email / phone - def test_post_with_wallet_erc20(self): Test: login by user with wallet ER...
f8930ff1c009ad18e522ab29680b4bcd50a6020e
<|skeleton|> class TestCustomLoginView: def test_post_with_email_and_phone(self): """Test: login by user with email / phone""" <|body_0|> def test_post_with_wallet_erc20(self): """Test: login by user with wallet ERC-20""" <|body_1|> def test_post_with_refresh_token(self): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestCustomLoginView: def test_post_with_email_and_phone(self): """Test: login by user with email / phone""" user = mixer.blend(User, email='newuser@gmail.com', phone='12345678', password='test_password_1') user.set_password('test_password_1') user.save() request_data_ca...
the_stack_v2_python_sparse
src/auth/tests.py
evis-market/web-interface-backend
train
2
90ca908e6aa8c2b879eae8b7a43f7c67a125af19
[ "super().initialize()\nself._remote_buttons_ambient_light = self.args.get('remote_buttons_ambient_light', {})\nfor remote_button_ambient_light in self._remote_buttons_ambient_light:\n self.listen_state(self.__on_ambient_light_button_pressed, remote_button_ambient_light)", "if new == 'on':\n self.log('FIRE C...
<|body_start_0|> super().initialize() self._remote_buttons_ambient_light = self.args.get('remote_buttons_ambient_light', {}) for remote_button_ambient_light in self._remote_buttons_ambient_light: self.listen_state(self.__on_ambient_light_button_pressed, remote_button_ambient_light) <...
LightManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LightManager: def initialize(self) -> None: """Initialize.""" <|body_0|> def __on_ambient_light_button_pressed(self, entity: Union[str, dict], attribute: str, old: dict, new: dict, kwargs: dict) -> None: """called when ambient remote that button pressed on controlls"...
stack_v2_sparse_classes_10k_train_006987
1,380
no_license
[ { "docstring": "Initialize.", "name": "initialize", "signature": "def initialize(self) -> None" }, { "docstring": "called when ambient remote that button pressed on controlls", "name": "__on_ambient_light_button_pressed", "signature": "def __on_ambient_light_button_pressed(self, entity: ...
2
stack_v2_sparse_classes_30k_train_002832
Implement the Python class `LightManager` described below. Class description: Implement the LightManager class. Method signatures and docstrings: - def initialize(self) -> None: Initialize. - def __on_ambient_light_button_pressed(self, entity: Union[str, dict], attribute: str, old: dict, new: dict, kwargs: dict) -> N...
Implement the Python class `LightManager` described below. Class description: Implement the LightManager class. Method signatures and docstrings: - def initialize(self) -> None: Initialize. - def __on_ambient_light_button_pressed(self, entity: Union[str, dict], attribute: str, old: dict, new: dict, kwargs: dict) -> N...
2c027d10e0e3aa86d97c83d1b9c3124cf980d160
<|skeleton|> class LightManager: def initialize(self) -> None: """Initialize.""" <|body_0|> def __on_ambient_light_button_pressed(self, entity: Union[str, dict], attribute: str, old: dict, new: dict, kwargs: dict) -> None: """called when ambient remote that button pressed on controlls"...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LightManager: def initialize(self) -> None: """Initialize.""" super().initialize() self._remote_buttons_ambient_light = self.args.get('remote_buttons_ambient_light', {}) for remote_button_ambient_light in self._remote_buttons_ambient_light: self.listen_state(self.__...
the_stack_v2_python_sparse
appdaemon/apps/lights/light_manager.py
forksbot/hassio
train
0
e9af86f6c1091cc9e7270711bba8db7bc0151066
[ "msg = '\\n\\nRunning SMA strategy | SMA1 = %d & SMA2 = %d' % (SMA1, SMA2)\nmsg += '\\nfixed costs %.2f | ' % self.ftc\nmsg += 'proportional costs %.4f' % self.ptc\nprint(msg)\nprint('=' * 55)\nself.position = 0\nself.amount = self._amount\nself.data['SMA1'] = self.data['price'].rolling(SMA1).mean()\nself.data['SMA...
<|body_start_0|> msg = '\n\nRunning SMA strategy | SMA1 = %d & SMA2 = %d' % (SMA1, SMA2) msg += '\nfixed costs %.2f | ' % self.ftc msg += 'proportional costs %.4f' % self.ptc print(msg) print('=' * 55) self.position = 0 self.amount = self._amount self.data...
BacktestLongOnly
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BacktestLongOnly: def run_sma_strategy(self, SMA1, SMA2): """Backtesting a SMA-based strategy. Parameters ========== SMA1, SMA2: int shorter and longer term simple moving average (in days)""" <|body_0|> def run_momentum_strategy(self, momentum): """Backtesting a mome...
stack_v2_sparse_classes_10k_train_006988
4,494
no_license
[ { "docstring": "Backtesting a SMA-based strategy. Parameters ========== SMA1, SMA2: int shorter and longer term simple moving average (in days)", "name": "run_sma_strategy", "signature": "def run_sma_strategy(self, SMA1, SMA2)" }, { "docstring": "Backtesting a momentum-based strategy. Parameters...
3
stack_v2_sparse_classes_30k_train_003947
Implement the Python class `BacktestLongOnly` described below. Class description: Implement the BacktestLongOnly class. Method signatures and docstrings: - def run_sma_strategy(self, SMA1, SMA2): Backtesting a SMA-based strategy. Parameters ========== SMA1, SMA2: int shorter and longer term simple moving average (in ...
Implement the Python class `BacktestLongOnly` described below. Class description: Implement the BacktestLongOnly class. Method signatures and docstrings: - def run_sma_strategy(self, SMA1, SMA2): Backtesting a SMA-based strategy. Parameters ========== SMA1, SMA2: int shorter and longer term simple moving average (in ...
bfc8baa153aec70caa8981b8e9215bb0be7f3163
<|skeleton|> class BacktestLongOnly: def run_sma_strategy(self, SMA1, SMA2): """Backtesting a SMA-based strategy. Parameters ========== SMA1, SMA2: int shorter and longer term simple moving average (in days)""" <|body_0|> def run_momentum_strategy(self, momentum): """Backtesting a mome...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BacktestLongOnly: def run_sma_strategy(self, SMA1, SMA2): """Backtesting a SMA-based strategy. Parameters ========== SMA1, SMA2: int shorter and longer term simple moving average (in days)""" msg = '\n\nRunning SMA strategy | SMA1 = %d & SMA2 = %d' % (SMA1, SMA2) msg += '\nfixed costs ...
the_stack_v2_python_sparse
code/pyquants/pyalgo/ch06/BacktestLongOnly.py
godknowspe/NoahsArk
train
1
f00fc9b4082a43d85cab5a599307a9f5c5ad5579
[ "if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(username=username, email=self.normalize_email(email), phone=phone)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(username=username, email=email, phone=phone, password=passw...
<|body_start_0|> if not email: raise ValueError('Users must have an email address') user = self.model(username=username, email=self.normalize_email(email), phone=phone) user.set_password(password) user.save(using=self._db) return user <|end_body_0|> <|body_start_1|> ...
This class handles the creation of our users. We need to create this class and extend BaseUserManager because our model (CustomUser) has additional fields to Django's default User class.
MyUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyUserManager: """This class handles the creation of our users. We need to create this class and extend BaseUserManager because our model (CustomUser) has additional fields to Django's default User class.""" def create_user(self, username, email, phone, password=None): """Create a Cu...
stack_v2_sparse_classes_10k_train_006989
22,769
no_license
[ { "docstring": "Create a CustomUser, which are the users on our site.", "name": "create_user", "signature": "def create_user(self, username, email, phone, password=None)" }, { "docstring": "Create a superuser, which is just a user object with special attributes.", "name": "create_superuser",...
2
stack_v2_sparse_classes_30k_train_002036
Implement the Python class `MyUserManager` described below. Class description: This class handles the creation of our users. We need to create this class and extend BaseUserManager because our model (CustomUser) has additional fields to Django's default User class. Method signatures and docstrings: - def create_user(...
Implement the Python class `MyUserManager` described below. Class description: This class handles the creation of our users. We need to create this class and extend BaseUserManager because our model (CustomUser) has additional fields to Django's default User class. Method signatures and docstrings: - def create_user(...
31ef33b573b991f9425e4b1edc09dbbd044a69b0
<|skeleton|> class MyUserManager: """This class handles the creation of our users. We need to create this class and extend BaseUserManager because our model (CustomUser) has additional fields to Django's default User class.""" def create_user(self, username, email, phone, password=None): """Create a Cu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MyUserManager: """This class handles the creation of our users. We need to create this class and extend BaseUserManager because our model (CustomUser) has additional fields to Django's default User class.""" def create_user(self, username, email, phone, password=None): """Create a CustomUser, whi...
the_stack_v2_python_sparse
ibet_apps/users/models.py
senclaymoreusa/ibet-django-backup
train
0
2481c6e91a9ed020ba39e63a3921e3875236f751
[ "count = 0\nfor i in range(1, len(nums)):\n if nums[i] < nums[i - 1]:\n count += 1\n if i + 1 < len(nums) and i - 2 >= 0:\n if nums[i + 1] < nums[i - 1] and nums[i - 2] > nums[i]:\n return False\n if count > 1:\n return False\nreturn True", "cnt = 0\nfor i in r...
<|body_start_0|> count = 0 for i in range(1, len(nums)): if nums[i] < nums[i - 1]: count += 1 if i + 1 < len(nums) and i - 2 >= 0: if nums[i + 1] < nums[i - 1] and nums[i - 2] > nums[i]: return False if c...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def checkPossibility(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def checkPossibility(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> def checkPossibility(self, nums): """:type nums: List[int] :rtyp...
stack_v2_sparse_classes_10k_train_006990
1,452
no_license
[ { "docstring": ":type nums: List[int] :rtype: bool", "name": "checkPossibility", "signature": "def checkPossibility(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: bool", "name": "checkPossibility", "signature": "def checkPossibility(self, nums)" }, { "docstring": "...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkPossibility(self, nums): :type nums: List[int] :rtype: bool - def checkPossibility(self, nums): :type nums: List[int] :rtype: bool - def checkPossibility(self, nums): :t...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkPossibility(self, nums): :type nums: List[int] :rtype: bool - def checkPossibility(self, nums): :type nums: List[int] :rtype: bool - def checkPossibility(self, nums): :t...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def checkPossibility(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def checkPossibility(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> def checkPossibility(self, nums): """:type nums: List[int] :rtyp...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def checkPossibility(self, nums): """:type nums: List[int] :rtype: bool""" count = 0 for i in range(1, len(nums)): if nums[i] < nums[i - 1]: count += 1 if i + 1 < len(nums) and i - 2 >= 0: if nums[i + 1] < nums[i...
the_stack_v2_python_sparse
0665_Non-decreasing_Array.py
bingli8802/leetcode
train
0
86032cf0a044b388109cde1acea1d15ff76b1105
[ "m, n = (len(grid), len(grid[0]))\n\ndef bfs(grid, i, j, visited):\n Q = deque()\n Q.append((i, j))\n while len(Q):\n i1, j1 = Q.popleft()\n if grid[i1][j1] == 1:\n return abs(i1 - i) + abs(j1 - j)\n visited[i1][j1] = 1\n if 0 <= j1 - 1 < n and visited[i1][j1 - 1] == ...
<|body_start_0|> m, n = (len(grid), len(grid[0])) def bfs(grid, i, j, visited): Q = deque() Q.append((i, j)) while len(Q): i1, j1 = Q.popleft() if grid[i1][j1] == 1: return abs(i1 - i) + abs(j1 - j) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxDistance(self, grid) -> int: """BFS,超时 :param list[list[int]] grid: :return:""" <|body_0|> def maxDistance2(self, grid) -> int: """多源BFS,其实就是有一个超级原点,然后从该点进行BFS遍历,多源点是超级原点的邻接点。 :param grid: :return:""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_10k_train_006991
3,231
no_license
[ { "docstring": "BFS,超时 :param list[list[int]] grid: :return:", "name": "maxDistance", "signature": "def maxDistance(self, grid) -> int" }, { "docstring": "多源BFS,其实就是有一个超级原点,然后从该点进行BFS遍历,多源点是超级原点的邻接点。 :param grid: :return:", "name": "maxDistance2", "signature": "def maxDistance2(self, gri...
2
stack_v2_sparse_classes_30k_train_007162
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxDistance(self, grid) -> int: BFS,超时 :param list[list[int]] grid: :return: - def maxDistance2(self, grid) -> int: 多源BFS,其实就是有一个超级原点,然后从该点进行BFS遍历,多源点是超级原点的邻接点。 :param grid: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxDistance(self, grid) -> int: BFS,超时 :param list[list[int]] grid: :return: - def maxDistance2(self, grid) -> int: 多源BFS,其实就是有一个超级原点,然后从该点进行BFS遍历,多源点是超级原点的邻接点。 :param grid: ...
837957ea22aa07ce28a6c23ea0419bd2011e1f88
<|skeleton|> class Solution: def maxDistance(self, grid) -> int: """BFS,超时 :param list[list[int]] grid: :return:""" <|body_0|> def maxDistance2(self, grid) -> int: """多源BFS,其实就是有一个超级原点,然后从该点进行BFS遍历,多源点是超级原点的邻接点。 :param grid: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxDistance(self, grid) -> int: """BFS,超时 :param list[list[int]] grid: :return:""" m, n = (len(grid), len(grid[0])) def bfs(grid, i, j, visited): Q = deque() Q.append((i, j)) while len(Q): i1, j1 = Q.popleft() ...
the_stack_v2_python_sparse
华为题库/地图分析.py
2226171237/Algorithmpractice
train
0
3be18b63166b8b629f38f48d3f1ef200feb5b42e
[ "cmd = 'sudo yum --color=never -y install %s' % ' '.join(packages)\noutput_expects = ['\\\\[sudo\\\\] password for .*:', 'No package (.*) available.', 'file .* from install of .* conflicts with file from package (.*?)\\r\\n', 'Error: (.*?) conflicts with .*?\\r\\n', 'Processing Conflict: .* conflicts (.*?)\\r\\n', ...
<|body_start_0|> cmd = 'sudo yum --color=never -y install %s' % ' '.join(packages) output_expects = ['\\[sudo\\] password for .*:', 'No package (.*) available.', 'file .* from install of .* conflicts with file from package (.*?)\r\n', 'Error: (.*?) conflicts with .*?\r\n', 'Processing Conflict: .* confl...
RedhatPackagerMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RedhatPackagerMixin: def _install(self, packages, time_out): """Attempts to install packages. Returns OK if the packages are installed or a result code if a recoverable-error occurred. Raises an exception if a non-recoverable error or timeout occurs.""" <|body_0|> def _remov...
stack_v2_sparse_classes_10k_train_006992
16,357
permissive
[ { "docstring": "Attempts to install packages. Returns OK if the packages are installed or a result code if a recoverable-error occurred. Raises an exception if a non-recoverable error or timeout occurs.", "name": "_install", "signature": "def _install(self, packages, time_out)" }, { "docstring":...
2
null
Implement the Python class `RedhatPackagerMixin` described below. Class description: Implement the RedhatPackagerMixin class. Method signatures and docstrings: - def _install(self, packages, time_out): Attempts to install packages. Returns OK if the packages are installed or a result code if a recoverable-error occur...
Implement the Python class `RedhatPackagerMixin` described below. Class description: Implement the RedhatPackagerMixin class. Method signatures and docstrings: - def _install(self, packages, time_out): Attempts to install packages. Returns OK if the packages are installed or a result code if a recoverable-error occur...
4288b8f78250cc3a1c93b019e2c3b4bf78df177c
<|skeleton|> class RedhatPackagerMixin: def _install(self, packages, time_out): """Attempts to install packages. Returns OK if the packages are installed or a result code if a recoverable-error occurred. Raises an exception if a non-recoverable error or timeout occurs.""" <|body_0|> def _remov...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RedhatPackagerMixin: def _install(self, packages, time_out): """Attempts to install packages. Returns OK if the packages are installed or a result code if a recoverable-error occurred. Raises an exception if a non-recoverable error or timeout occurs.""" cmd = 'sudo yum --color=never -y install...
the_stack_v2_python_sparse
trove/guestagent/pkg.py
openstack/trove
train
258
41e7948a5d4acfeffa0075528b818ee458353a07
[ "self._nums = nums\nself.tree = [0 for _ in range(len(nums) + 1)]\nfor i in range(len(nums)):\n val = nums[i]\n i += 1\n while i < len(self.tree):\n self.tree[i] += val\n i += i & -i\nprint(self.tree)", "val1 = self._nums[i]\nindex = i\ni = i + 1\nwhile i < len(self.tree):\n self.tree[i]...
<|body_start_0|> self._nums = nums self.tree = [0 for _ in range(len(nums) + 1)] for i in range(len(nums)): val = nums[i] i += 1 while i < len(self.tree): self.tree[i] += val i += i & -i print(self.tree) <|end_body_0|> ...
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def update(self, i, val): """:type i: int :type val: int :rtype: void""" <|body_1|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_2|...
stack_v2_sparse_classes_10k_train_006993
1,364
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type val: int :rtype: void", "name": "update", "signature": "def update(self, i, val)" }, { "docstring": ":type i: int :type j: int :rtype: int", ...
3
stack_v2_sparse_classes_30k_train_000780
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def update(self, i, val): :type i: int :type val: int :rtype: void - def sumRange(self, i, j): :type i: int :type j: int :rtype:...
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def update(self, i, val): :type i: int :type val: int :rtype: void - def sumRange(self, i, j): :type i: int :type j: int :rtype:...
a6d0e392134afe19d1aed2dfe7914b674e05ecc6
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def update(self, i, val): """:type i: int :type val: int :rtype: void""" <|body_1|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_2|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NumArray: def __init__(self, nums): """:type nums: List[int]""" self._nums = nums self.tree = [0 for _ in range(len(nums) + 1)] for i in range(len(nums)): val = nums[i] i += 1 while i < len(self.tree): self.tree[i] += val ...
the_stack_v2_python_sparse
307RangeSumQuery.py
Ting007/leetcodePractice
train
0
c457a8dd7eb601c308c7b0bb507ff5e0ba0d1524
[ "count = 1\narr = [0 for i in range(num_people)]\nwhile candies >= count:\n arr[(count - 1) % num_people] += count\n candies -= count\n count += 1\narr[(count - 1) % num_people] += candies\nreturn arr", "count = 1\narr = [0 for i in range(num_people)]\nwhile candies > 0:\n '\\n min(count, c...
<|body_start_0|> count = 1 arr = [0 for i in range(num_people)] while candies >= count: arr[(count - 1) % num_people] += count candies -= count count += 1 arr[(count - 1) % num_people] += candies return arr <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def distributeCandies(self, candies: int, num_people: int) -> List[int]: """执行用时 :64 ms, 在所有 Python3 提交中击败了18.87%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了23.58%的用户 :param candies: :param num_people: :return:""" <|body_0|> def distributeCandies2(self, candies: int, num_...
stack_v2_sparse_classes_10k_train_006994
3,806
no_license
[ { "docstring": "执行用时 :64 ms, 在所有 Python3 提交中击败了18.87%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了23.58%的用户 :param candies: :param num_people: :return:", "name": "distributeCandies", "signature": "def distributeCandies(self, candies: int, num_people: int) -> List[int]" }, { "docstring": "执行用时 :52 ms, 在所...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def distributeCandies(self, candies: int, num_people: int) -> List[int]: 执行用时 :64 ms, 在所有 Python3 提交中击败了18.87%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了23.58%的用户 :param candies: :para...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def distributeCandies(self, candies: int, num_people: int) -> List[int]: 执行用时 :64 ms, 在所有 Python3 提交中击败了18.87%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了23.58%的用户 :param candies: :para...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def distributeCandies(self, candies: int, num_people: int) -> List[int]: """执行用时 :64 ms, 在所有 Python3 提交中击败了18.87%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了23.58%的用户 :param candies: :param num_people: :return:""" <|body_0|> def distributeCandies2(self, candies: int, num_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def distributeCandies(self, candies: int, num_people: int) -> List[int]: """执行用时 :64 ms, 在所有 Python3 提交中击败了18.87%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了23.58%的用户 :param candies: :param num_people: :return:""" count = 1 arr = [0 for i in range(num_people)] while candies ...
the_stack_v2_python_sparse
LeetCode/1103. Distribute Candies to People.py
yiming1012/MyLeetCode
train
2
c75186ad1a92476048421c4b15c6f9ad0292734f
[ "if not load_data:\n return\ndata_paths = ['app_data', '..app_data']\nadp = None\nfor data_path in data_paths:\n if os.path.exists(os.path.join(os.curdir, data_path)):\n adp = os.path.join(os.curdir, data_path)\nif not adp:\n _logger.error('app data path not found.')\n return\nfiles = glob(os.pat...
<|body_start_0|> if not load_data: return data_paths = ['app_data', '..app_data'] adp = None for data_path in data_paths: if os.path.exists(os.path.join(os.curdir, data_path)): adp = os.path.join(os.curdir, data_path) if not adp: ...
base data generator object.
BaseGen
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseGen: """base data generator object.""" def __init__(self, load_data=True): """Initialize the QuestionnaireGen object. Try to re-use to save on loading files. :param load_data: load data from app_data directory""" <|body_0|> def update(self, resp): """Update t...
stack_v2_sparse_classes_10k_train_006995
2,060
permissive
[ { "docstring": "Initialize the QuestionnaireGen object. Try to re-use to save on loading files. :param load_data: load data from app_data directory", "name": "__init__", "signature": "def __init__(self, load_data=True)" }, { "docstring": "Update this object with response data :param resp: reques...
2
stack_v2_sparse_classes_30k_train_005739
Implement the Python class `BaseGen` described below. Class description: base data generator object. Method signatures and docstrings: - def __init__(self, load_data=True): Initialize the QuestionnaireGen object. Try to re-use to save on loading files. :param load_data: load data from app_data directory - def update(...
Implement the Python class `BaseGen` described below. Class description: base data generator object. Method signatures and docstrings: - def __init__(self, load_data=True): Initialize the QuestionnaireGen object. Try to re-use to save on loading files. :param load_data: load data from app_data directory - def update(...
461ae46aeda21d54de8a91aa5ef677676d5db541
<|skeleton|> class BaseGen: """base data generator object.""" def __init__(self, load_data=True): """Initialize the QuestionnaireGen object. Try to re-use to save on loading files. :param load_data: load data from app_data directory""" <|body_0|> def update(self, resp): """Update t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BaseGen: """base data generator object.""" def __init__(self, load_data=True): """Initialize the QuestionnaireGen object. Try to re-use to save on loading files. :param load_data: load data from app_data directory""" if not load_data: return data_paths = ['app_data', '...
the_stack_v2_python_sparse
rdr_service/data_gen/generators/base_gen.py
all-of-us/raw-data-repository
train
46
3e6a63db5f6e37635bbc84bf7ca5c8c630e9fc3e
[ "rt = self.rt\ninstances = self.instances\ngsi = rt['pcms']['gsi']\ngsi_state = rt['gsi_state']\ni8259_irq = gsi_state['i8259_irq']\nioapic_irq = gsi_state['ioapic_irq']\nfor i in range(24):\n gsi_addr = gsi[i].fetch_pointer()\n gsi_inst = instances[gsi_addr]\n self._MachineWatcher__notify_irq_split_create...
<|body_start_0|> rt = self.rt instances = self.instances gsi = rt['pcms']['gsi'] gsi_state = rt['gsi_state'] i8259_irq = gsi_state['i8259_irq'] ioapic_irq = gsi_state['ioapic_irq'] for i in range(24): gsi_addr = gsi[i].fetch_pointer() gsi_i...
Support for non-standard IRQ creation of PC i440fx based machines (Global Signaling Interrupts).
PCMachineWatcher
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PCMachineWatcher: """Support for non-standard IRQ creation of PC i440fx based machines (Global Signaling Interrupts).""" def on_pc_piix_gsi(self): """pc_piix.c:301 v2.12.0 1""" <|body_0|> def on_piix4_pm_gsi(self): """acpi/piix4.c:539 v5.1.0 acpi/piix4.c:578 v2.1...
stack_v2_sparse_classes_10k_train_006996
26,519
permissive
[ { "docstring": "pc_piix.c:301 v2.12.0 1", "name": "on_pc_piix_gsi", "signature": "def on_pc_piix_gsi(self)" }, { "docstring": "acpi/piix4.c:539 v5.1.0 acpi/piix4.c:578 v2.12.0", "name": "on_piix4_pm_gsi", "signature": "def on_piix4_pm_gsi(self)" } ]
2
stack_v2_sparse_classes_30k_train_005638
Implement the Python class `PCMachineWatcher` described below. Class description: Support for non-standard IRQ creation of PC i440fx based machines (Global Signaling Interrupts). Method signatures and docstrings: - def on_pc_piix_gsi(self): pc_piix.c:301 v2.12.0 1 - def on_piix4_pm_gsi(self): acpi/piix4.c:539 v5.1.0 ...
Implement the Python class `PCMachineWatcher` described below. Class description: Support for non-standard IRQ creation of PC i440fx based machines (Global Signaling Interrupts). Method signatures and docstrings: - def on_pc_piix_gsi(self): pc_piix.c:301 v2.12.0 1 - def on_piix4_pm_gsi(self): acpi/piix4.c:539 v5.1.0 ...
93e03c2b3f880f5c7c9f90e1ba5593dbf602bdb9
<|skeleton|> class PCMachineWatcher: """Support for non-standard IRQ creation of PC i440fx based machines (Global Signaling Interrupts).""" def on_pc_piix_gsi(self): """pc_piix.c:301 v2.12.0 1""" <|body_0|> def on_piix4_pm_gsi(self): """acpi/piix4.c:539 v5.1.0 acpi/piix4.c:578 v2.1...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PCMachineWatcher: """Support for non-standard IRQ creation of PC i440fx based machines (Global Signaling Interrupts).""" def on_pc_piix_gsi(self): """pc_piix.c:301 v2.12.0 1""" rt = self.rt instances = self.instances gsi = rt['pcms']['gsi'] gsi_state = rt['gsi_stat...
the_stack_v2_python_sparse
qemu/qemu_watcher.py
ispras/qdt
train
38
ff4986d247f8aee25bf3bbade1aa513a48303284
[ "init_weights = 'glorot_uniform'\nsuper(RNNDecoder, self).__init__()\nself.embedding = tf.keras.layers.Embedding(output_dim=embedding, input_dim=vocab)\nself.gru = tf.keras.layers.GRU(units=units, recurrent_initializer=init_weights, return_sequences=True, return_state=True)\nself.F = tf.keras.layers.Dense(units=voc...
<|body_start_0|> init_weights = 'glorot_uniform' super(RNNDecoder, self).__init__() self.embedding = tf.keras.layers.Embedding(output_dim=embedding, input_dim=vocab) self.gru = tf.keras.layers.GRU(units=units, recurrent_initializer=init_weights, return_sequences=True, return_state=True) ...
class RNNEncoder Inherits from tensorflow.keras.layers.Layer to encode 4 ML translation Args: tf ([type]): [description]
RNNDecoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RNNDecoder: """class RNNEncoder Inherits from tensorflow.keras.layers.Layer to encode 4 ML translation Args: tf ([type]): [description]""" def __init__(self, vocab, embedding, units, batch): """[Class constructor] Args: vocab ([int]): [size of the input vocabulary] embedding ([int]):...
stack_v2_sparse_classes_10k_train_006997
2,937
no_license
[ { "docstring": "[Class constructor] Args: vocab ([int]): [size of the input vocabulary] embedding ([int]): [dimensionality of the embedding vector] units ([int]): [number of hidden units in the RNN cell] batch ([int]): [batch size instance attributes] Attributes: batch Batch size units Number of hidden units in...
2
null
Implement the Python class `RNNDecoder` described below. Class description: class RNNEncoder Inherits from tensorflow.keras.layers.Layer to encode 4 ML translation Args: tf ([type]): [description] Method signatures and docstrings: - def __init__(self, vocab, embedding, units, batch): [Class constructor] Args: vocab (...
Implement the Python class `RNNDecoder` described below. Class description: class RNNEncoder Inherits from tensorflow.keras.layers.Layer to encode 4 ML translation Args: tf ([type]): [description] Method signatures and docstrings: - def __init__(self, vocab, embedding, units, batch): [Class constructor] Args: vocab (...
eb47cd4d12e2f0627bb5e5af28cc0802ff13d0d9
<|skeleton|> class RNNDecoder: """class RNNEncoder Inherits from tensorflow.keras.layers.Layer to encode 4 ML translation Args: tf ([type]): [description]""" def __init__(self, vocab, embedding, units, batch): """[Class constructor] Args: vocab ([int]): [size of the input vocabulary] embedding ([int]):...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RNNDecoder: """class RNNEncoder Inherits from tensorflow.keras.layers.Layer to encode 4 ML translation Args: tf ([type]): [description]""" def __init__(self, vocab, embedding, units, batch): """[Class constructor] Args: vocab ([int]): [size of the input vocabulary] embedding ([int]): [dimensional...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/2-rnn_decoder.py
rodrigocruz13/holbertonschool-machine_learning
train
4
546da4336aab8bb0e83a3be2303b77c6baa21bcd
[ "try:\n self.init_rotation = init_rotation\n super().__init__(task_list, qubits=qubits, sweep_points=sweep_points, nr_seqs=nr_seqs, cycles=cycles, init_rotation=init_rotation, **kw)\nexcept Exception as x:\n self.exception = x\n traceback.print_exc()", "pulse_op_codes_list = []\ntl = [self.preprocesse...
<|body_start_0|> try: self.init_rotation = init_rotation super().__init__(task_list, qubits=qubits, sweep_points=sweep_points, nr_seqs=nr_seqs, cycles=cycles, init_rotation=init_rotation, **kw) except Exception as x: self.exception = x traceback.print_exc(...
Class for running the single qubit cross-entropy benchmarking experiment on several qubits in parallel.
SingleQubitXEB
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SingleQubitXEB: """Class for running the single qubit cross-entropy benchmarking experiment on several qubits in parallel.""" def __init__(self, task_list, sweep_points=None, qubits=None, nr_seqs=None, cycles=None, init_rotation=None, **kw): """Init of the SingleQubitXEB class. The e...
stack_v2_sparse_classes_10k_train_006998
38,263
permissive
[ { "docstring": "Init of the SingleQubitXEB class. The experiment consists of applying [[Ry - Rz(theta)] * nr_cycles for nr_cycles in cycles] nr_seqs times, with random values of theta each time. Args: nr_seqs (int): the number of times to apply a random iteration of a sequence consisting of nr_cycles cycles. If...
2
stack_v2_sparse_classes_30k_train_004252
Implement the Python class `SingleQubitXEB` described below. Class description: Class for running the single qubit cross-entropy benchmarking experiment on several qubits in parallel. Method signatures and docstrings: - def __init__(self, task_list, sweep_points=None, qubits=None, nr_seqs=None, cycles=None, init_rota...
Implement the Python class `SingleQubitXEB` described below. Class description: Class for running the single qubit cross-entropy benchmarking experiment on several qubits in parallel. Method signatures and docstrings: - def __init__(self, task_list, sweep_points=None, qubits=None, nr_seqs=None, cycles=None, init_rota...
bc6733d774fe31a23f4c7e73e5eb0beed8d30e7d
<|skeleton|> class SingleQubitXEB: """Class for running the single qubit cross-entropy benchmarking experiment on several qubits in parallel.""" def __init__(self, task_list, sweep_points=None, qubits=None, nr_seqs=None, cycles=None, init_rotation=None, **kw): """Init of the SingleQubitXEB class. The e...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SingleQubitXEB: """Class for running the single qubit cross-entropy benchmarking experiment on several qubits in parallel.""" def __init__(self, task_list, sweep_points=None, qubits=None, nr_seqs=None, cycles=None, init_rotation=None, **kw): """Init of the SingleQubitXEB class. The experiment con...
the_stack_v2_python_sparse
pycqed/measurement/benchmarking/randomized_benchmarking.py
QudevETH/PycQED_py3
train
8
21e392a4eca73a9eac62e0fa3663b3b3b8a0b1eb
[ "super(PostProcessor, self).__init__()\nself.score_thresh = score_thresh\nself.nms = nms\nself.detections_per_img = detections_per_img\nself.box_coder = box_coder", "assert len(boxes) == 1, 'Only single feature'\nboxes = boxes[0]\nclass_logits, box_regression = x\nclass_prob = F.softmax(class_logits, -1)\nimage_s...
<|body_start_0|> super(PostProcessor, self).__init__() self.score_thresh = score_thresh self.nms = nms self.detections_per_img = detections_per_img self.box_coder = box_coder <|end_body_0|> <|body_start_1|> assert len(boxes) == 1, 'Only single feature' boxes = bo...
From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results
PostProcessor
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostProcessor: """From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results""" def __init__(self, score_thresh=0.05, nms=0.5, detections_per_img=100, box_coder=BoxCoder(weights=(10.0, 10.0, 5.0, 5.0))): ...
stack_v2_sparse_classes_10k_train_006999
8,271
permissive
[ { "docstring": "Arguments: score_thresh (float) nms (float) detections_per_img (int) box_coder (BoxCoder)", "name": "__init__", "signature": "def __init__(self, score_thresh=0.05, nms=0.5, detections_per_img=100, box_coder=BoxCoder(weights=(10.0, 10.0, 5.0, 5.0)))" }, { "docstring": "Arguments: ...
2
stack_v2_sparse_classes_30k_train_002771
Implement the Python class `PostProcessor` described below. Class description: From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results Method signatures and docstrings: - def __init__(self, score_thresh=0.05, nms=0.5, detections...
Implement the Python class `PostProcessor` described below. Class description: From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results Method signatures and docstrings: - def __init__(self, score_thresh=0.05, nms=0.5, detections...
11c38436a158c453e3011f8684570f7a55c03330
<|skeleton|> class PostProcessor: """From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results""" def __init__(self, score_thresh=0.05, nms=0.5, detections_per_img=100, box_coder=BoxCoder(weights=(10.0, 10.0, 5.0, 5.0))): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PostProcessor: """From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results""" def __init__(self, score_thresh=0.05, nms=0.5, detections_per_img=100, box_coder=BoxCoder(weights=(10.0, 10.0, 5.0, 5.0))): """Arg...
the_stack_v2_python_sparse
v0.5.0/nvidia/submission/code/object_detection/pytorch/maskrcnn_benchmark/modeling/post_processors/fast_rcnn.py
myelintek/results
train
0