blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
3df4e1858e26fe7e014b54b644efe469609bcf35
[ "result = {}\nup_off_station = format_result2one(StudentLineSeat().get_one_bus_station(login_user_id))\nbus_station_list = format_result(StudentLineSeat().get_all_bus_station(login_user_id))\nif up_off_station and bus_station_list:\n result['up_off_station'] = up_off_station\n result['bus_station_list'] = bus...
<|body_start_0|> result = {} up_off_station = format_result2one(StudentLineSeat().get_one_bus_station(login_user_id)) bus_station_list = format_result(StudentLineSeat().get_all_bus_station(login_user_id)) if up_off_station and bus_station_list: result['up_off_station'] = up_o...
BusStationService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BusStationService: def get_bus_station(self, login_user_id): """获取校车列表""" <|body_0|> def update_bus_station(self, login_user_id, info): """修改上下车站点 :param login_user_id: :param info: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = {...
stack_v2_sparse_classes_36k_train_020900
2,478
no_license
[ { "docstring": "获取校车列表", "name": "get_bus_station", "signature": "def get_bus_station(self, login_user_id)" }, { "docstring": "修改上下车站点 :param login_user_id: :param info: :return:", "name": "update_bus_station", "signature": "def update_bus_station(self, login_user_id, info)" } ]
2
stack_v2_sparse_classes_30k_train_001292
Implement the Python class `BusStationService` described below. Class description: Implement the BusStationService class. Method signatures and docstrings: - def get_bus_station(self, login_user_id): 获取校车列表 - def update_bus_station(self, login_user_id, info): 修改上下车站点 :param login_user_id: :param info: :return:
Implement the Python class `BusStationService` described below. Class description: Implement the BusStationService class. Method signatures and docstrings: - def get_bus_station(self, login_user_id): 获取校车列表 - def update_bus_station(self, login_user_id, info): 修改上下车站点 :param login_user_id: :param info: :return: <|ske...
a7cf5a0b6daa372ed860dc43d92c55fcde764eb9
<|skeleton|> class BusStationService: def get_bus_station(self, login_user_id): """获取校车列表""" <|body_0|> def update_bus_station(self, login_user_id, info): """修改上下车站点 :param login_user_id: :param info: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BusStationService: def get_bus_station(self, login_user_id): """获取校车列表""" result = {} up_off_station = format_result2one(StudentLineSeat().get_one_bus_station(login_user_id)) bus_station_list = format_result(StudentLineSeat().get_all_bus_station(login_user_id)) if up_of...
the_stack_v2_python_sparse
python_project/smart_schoolBus_project/app/schoolbus_situation/services/bus_station_service.py
malqch/aibus
train
0
ee67d5cd5b790a807698b12233d15949a1caa381
[ "for i in range(1, len(s), 1):\n if len(s) % i == 0:\n t = s[0:i]\n if self.isit(s, t):\n return True\nreturn False", "for i in range(0, len(s), len(t)):\n if s[i:i + len(t)] != t:\n return False\nreturn True" ]
<|body_start_0|> for i in range(1, len(s), 1): if len(s) % i == 0: t = s[0:i] if self.isit(s, t): return True return False <|end_body_0|> <|body_start_1|> for i in range(0, len(s), len(t)): if s[i:i + len(t)] != t: ...
静态类
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """静态类""" def repeatedSubstringPattern(self, s: str) -> bool: """题目要求 :param s: :return:""" <|body_0|> def isit(self, s: str, t: str) -> bool: """判断t是否是S的循环子串 :param s: 大串 :param t: 小串 :return: bool""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_020901
891
no_license
[ { "docstring": "题目要求 :param s: :return:", "name": "repeatedSubstringPattern", "signature": "def repeatedSubstringPattern(self, s: str) -> bool" }, { "docstring": "判断t是否是S的循环子串 :param s: 大串 :param t: 小串 :return: bool", "name": "isit", "signature": "def isit(self, s: str, t: str) -> bool" ...
2
null
Implement the Python class `Solution` described below. Class description: 静态类 Method signatures and docstrings: - def repeatedSubstringPattern(self, s: str) -> bool: 题目要求 :param s: :return: - def isit(self, s: str, t: str) -> bool: 判断t是否是S的循环子串 :param s: 大串 :param t: 小串 :return: bool
Implement the Python class `Solution` described below. Class description: 静态类 Method signatures and docstrings: - def repeatedSubstringPattern(self, s: str) -> bool: 题目要求 :param s: :return: - def isit(self, s: str, t: str) -> bool: 判断t是否是S的循环子串 :param s: 大串 :param t: 小串 :return: bool <|skeleton|> class Solution: ...
c7becb56e207ee2de6dbf662c98db7eb5b9471ff
<|skeleton|> class Solution: """静态类""" def repeatedSubstringPattern(self, s: str) -> bool: """题目要求 :param s: :return:""" <|body_0|> def isit(self, s: str, t: str) -> bool: """判断t是否是S的循环子串 :param s: 大串 :param t: 小串 :return: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """静态类""" def repeatedSubstringPattern(self, s: str) -> bool: """题目要求 :param s: :return:""" for i in range(1, len(s), 1): if len(s) % i == 0: t = s[0:i] if self.isit(s, t): return True return False def ...
the_stack_v2_python_sparse
problemset/459. 重复的子字符串/solution.py
KevenGe/LeetCode-Solutions
train
1
24cd457259d79a1d81d4a951c9c228a1402cf834
[ "if isinstance(key, int):\n return RouterAlert(key)\nif key not in RouterAlert._member_map_:\n extend_enum(RouterAlert, key, default)\nreturn RouterAlert[key]", "if not (isinstance(value, int) and 0 <= value <= 65535):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 66 <= value <= ...
<|body_start_0|> if isinstance(key, int): return RouterAlert(key) if key not in RouterAlert._member_map_: extend_enum(RouterAlert, key, default) return RouterAlert[key] <|end_body_0|> <|body_start_1|> if not (isinstance(value, int) and 0 <= value <= 65535): ...
Enumeration class for RouterAlert.
RouterAlert
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RouterAlert: """Enumeration class for RouterAlert.""" def get(key, default=-1): """Backport support for original codes.""" <|body_0|> def _missing_(cls, value): """Lookup function used when value is not found.""" <|body_1|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_36k_train_020902
7,255
no_license
[ { "docstring": "Backport support for original codes.", "name": "get", "signature": "def get(key, default=-1)" }, { "docstring": "Lookup function used when value is not found.", "name": "_missing_", "signature": "def _missing_(cls, value)" } ]
2
null
Implement the Python class `RouterAlert` described below. Class description: Enumeration class for RouterAlert. Method signatures and docstrings: - def get(key, default=-1): Backport support for original codes. - def _missing_(cls, value): Lookup function used when value is not found.
Implement the Python class `RouterAlert` described below. Class description: Enumeration class for RouterAlert. Method signatures and docstrings: - def get(key, default=-1): Backport support for original codes. - def _missing_(cls, value): Lookup function used when value is not found. <|skeleton|> class RouterAlert:...
fd43ccca1d032f8f230c4467dcb5df757669ef13
<|skeleton|> class RouterAlert: """Enumeration class for RouterAlert.""" def get(key, default=-1): """Backport support for original codes.""" <|body_0|> def _missing_(cls, value): """Lookup function used when value is not found.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RouterAlert: """Enumeration class for RouterAlert.""" def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return RouterAlert(key) if key not in RouterAlert._member_map_: extend_enum(RouterAlert, key, default) ...
the_stack_v2_python_sparse
venv/lib/python3.6/site-packages/pcapkit/const/ipv4/router_alert.py
IvanLetteri/MLfeaturesExtractor
train
0
f86f7cfb1d1410c499eb26df1a33f74c37600c25
[ "if hook_name in ('startup', 'shutdown') and controller is not None:\n raise TGConfigError('Startup and Shutdown hooks cannot be registered on controllers')\nif hook_name == 'controller_wrapper':\n raise TGConfigError('tg.hooks.wrap_controller must be used to register wrappers')\nif controller is None:\n c...
<|body_start_0|> if hook_name in ('startup', 'shutdown') and controller is not None: raise TGConfigError('Startup and Shutdown hooks cannot be registered on controllers') if hook_name == 'controller_wrapper': raise TGConfigError('tg.hooks.wrap_controller must be used to register ...
Manages hooks registrations and notifications
_TGHooks
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _TGHooks: """Manages hooks registrations and notifications""" def register(self, hook_name, func, controller=None): """Registers a TurboGears hook. Given an hook name and a function it registers the provided function for that role. For a complete list of hooks provided by default hav...
stack_v2_sparse_classes_36k_train_020903
7,031
no_license
[ { "docstring": "Registers a TurboGears hook. Given an hook name and a function it registers the provided function for that role. For a complete list of hooks provided by default have a look at :ref:`hooks_and_events`. It permits to register hooks both application wide or for specific controllers:: tg.hooks.regi...
4
stack_v2_sparse_classes_30k_train_000859
Implement the Python class `_TGHooks` described below. Class description: Manages hooks registrations and notifications Method signatures and docstrings: - def register(self, hook_name, func, controller=None): Registers a TurboGears hook. Given an hook name and a function it registers the provided function for that r...
Implement the Python class `_TGHooks` described below. Class description: Manages hooks registrations and notifications Method signatures and docstrings: - def register(self, hook_name, func, controller=None): Registers a TurboGears hook. Given an hook name and a function it registers the provided function for that r...
fcf1955cafc34c25986a14b841a9f05d11dd86d0
<|skeleton|> class _TGHooks: """Manages hooks registrations and notifications""" def register(self, hook_name, func, controller=None): """Registers a TurboGears hook. Given an hook name and a function it registers the provided function for that role. For a complete list of hooks provided by default hav...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _TGHooks: """Manages hooks registrations and notifications""" def register(self, hook_name, func, controller=None): """Registers a TurboGears hook. Given an hook name and a function it registers the provided function for that role. For a complete list of hooks provided by default have a look at :...
the_stack_v2_python_sparse
tgenv/lib/python2.6/site-packages/tg/configuration/hooks.py
garrettmc/TGWikiTutorial
train
1
4b6d1a60fde46b36f10518a8b0683bbfab40a08f
[ "if n < 1 or m < 1:\n return -1\nremainIndex = 0\nfor i in range(1, n + 1):\n remainIndex = (remainIndex + m) % i\nreturn remainIndex", "if n < 1 or m < 1:\n return -1\nnode = head = LinkNode(0)\nfor i in range(1, n):\n head.next = LinkNode(i)\n head = head.next\nhead.next = node\ncount = 1\nwhile ...
<|body_start_0|> if n < 1 or m < 1: return -1 remainIndex = 0 for i in range(1, n + 1): remainIndex = (remainIndex + m) % i return remainIndex <|end_body_0|> <|body_start_1|> if n < 1 or m < 1: return -1 node = head = LinkNode(0) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def LastRemaining_Solution(self, n, m): """数学解法""" <|body_0|> def LastRemaining(self, n, m): """链表解法, 0, 1, 2, 3, 4... 报数分别是1, 2, 3""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n < 1 or m < 1: return -1 remainInde...
stack_v2_sparse_classes_36k_train_020904
4,311
no_license
[ { "docstring": "数学解法", "name": "LastRemaining_Solution", "signature": "def LastRemaining_Solution(self, n, m)" }, { "docstring": "链表解法, 0, 1, 2, 3, 4... 报数分别是1, 2, 3", "name": "LastRemaining", "signature": "def LastRemaining(self, n, m)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def LastRemaining_Solution(self, n, m): 数学解法 - def LastRemaining(self, n, m): 链表解法, 0, 1, 2, 3, 4... 报数分别是1, 2, 3
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def LastRemaining_Solution(self, n, m): 数学解法 - def LastRemaining(self, n, m): 链表解法, 0, 1, 2, 3, 4... 报数分别是1, 2, 3 <|skeleton|> class Solution: def LastRemaining_Solution(se...
8c0c2a8bcd51825e6902e4d03dabbaf6f303ba83
<|skeleton|> class Solution: def LastRemaining_Solution(self, n, m): """数学解法""" <|body_0|> def LastRemaining(self, n, m): """链表解法, 0, 1, 2, 3, 4... 报数分别是1, 2, 3""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def LastRemaining_Solution(self, n, m): """数学解法""" if n < 1 or m < 1: return -1 remainIndex = 0 for i in range(1, n + 1): remainIndex = (remainIndex + m) % i return remainIndex def LastRemaining(self, n, m): """链表解法, 0, 1, ...
the_stack_v2_python_sparse
python_fundemental/45_Joseph_Game.py
Deanwinger/python_project
train
0
e05fa7d75fe7e6999ff70beb79c92004f036a7f5
[ "env = management.env['sale.order']\ndate_begin = date_bx + ' 05:00:00'\ndate_end_dt = datetime.datetime.strptime(date_ex, _DATE_FORMAT) + datetime.timedelta(hours=24) + datetime.timedelta(hours=5, minutes=0)\ndate_end = date_end_dt.strftime(_DATE_HOUR_FORMAT)\nimplementor = OdooDbImpl(env, date_begin, date_end, do...
<|body_start_0|> env = management.env['sale.order'] date_begin = date_bx + ' 05:00:00' date_end_dt = datetime.datetime.strptime(date_ex, _DATE_FORMAT) + datetime.timedelta(hours=24) + datetime.timedelta(hours=5, minutes=0) date_end = date_end_dt.strftime(_DATE_HOUR_FORMAT) implem...
ManagementDb
ManagementDb
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManagementDb: """ManagementDb""" def get_orders_filter_by_doctor(management, date_bx, date_ex, doctor): """Provides sales between begin date and end date. Filters: by Doctor. Used by - Management""" <|body_0|> def get_orders_filter(management, date_bx, date_ex, state_arr...
stack_v2_sparse_classes_36k_train_020905
6,978
no_license
[ { "docstring": "Provides sales between begin date and end date. Filters: by Doctor. Used by - Management", "name": "get_orders_filter_by_doctor", "signature": "def get_orders_filter_by_doctor(management, date_bx, date_ex, doctor)" }, { "docstring": "Used by Management", "name": "get_orders_f...
4
null
Implement the Python class `ManagementDb` described below. Class description: ManagementDb Method signatures and docstrings: - def get_orders_filter_by_doctor(management, date_bx, date_ex, doctor): Provides sales between begin date and end date. Filters: by Doctor. Used by - Management - def get_orders_filter(managem...
Implement the Python class `ManagementDb` described below. Class description: ManagementDb Method signatures and docstrings: - def get_orders_filter_by_doctor(management, date_bx, date_ex, doctor): Provides sales between begin date and end date. Filters: by Doctor. Used by - Management - def get_orders_filter(managem...
c15f8b146392d47a9040404a4ac8e45a1b062198
<|skeleton|> class ManagementDb: """ManagementDb""" def get_orders_filter_by_doctor(management, date_bx, date_ex, doctor): """Provides sales between begin date and end date. Filters: by Doctor. Used by - Management""" <|body_0|> def get_orders_filter(management, date_bx, date_ex, state_arr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ManagementDb: """ManagementDb""" def get_orders_filter_by_doctor(management, date_bx, date_ex, doctor): """Provides sales between begin date and end date. Filters: by Doctor. Used by - Management""" env = management.env['sale.order'] date_begin = date_bx + ' 05:00:00' date...
the_stack_v2_python_sparse
models/management/management_db.py
gibil5/openhealth
train
1
32c54e1bbd090701fa95ef6740b368281cb9ef20
[ "QMainWindow.__init__(self, parent)\nui_path = os.path.join(os.path.dirname(__file__), 'gui/import.ui')\nself.ui = load_ui(ui_path, baseinstance=self)\nself._myParent = parent\nself._myProjectName = ''\nself._myIPTS = None\nself._currRowIndex = -1\nself._numRows = 0\nself.ui.pushButton_selectAll.clicked.connect(sel...
<|body_start_0|> QMainWindow.__init__(self, parent) ui_path = os.path.join(os.path.dirname(__file__), 'gui/import.ui') self.ui = load_ui(ui_path, baseinstance=self) self._myParent = parent self._myProjectName = '' self._myIPTS = None self._currRowIndex = -1 ...
GUI (sub) for select run to reduce as final decision before reduction
FinalSelectRunToReduceDialog
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FinalSelectRunToReduceDialog: """GUI (sub) for select run to reduce as final decision before reduction""" def __init__(self, parent): """Set up main window""" <|body_0|> def doClearAllSelection(self): """Clear all selected runs for not reduction""" <|body...
stack_v2_sparse_classes_36k_train_020906
5,669
no_license
[ { "docstring": "Set up main window", "name": "__init__", "signature": "def __init__(self, parent)" }, { "docstring": "Clear all selected runs for not reduction", "name": "doClearAllSelection", "signature": "def doClearAllSelection(self)" }, { "docstring": "Select all runs to redu...
6
stack_v2_sparse_classes_30k_train_010108
Implement the Python class `FinalSelectRunToReduceDialog` described below. Class description: GUI (sub) for select run to reduce as final decision before reduction Method signatures and docstrings: - def __init__(self, parent): Set up main window - def doClearAllSelection(self): Clear all selected runs for not reduct...
Implement the Python class `FinalSelectRunToReduceDialog` described below. Class description: GUI (sub) for select run to reduce as final decision before reduction Method signatures and docstrings: - def __init__(self, parent): Set up main window - def doClearAllSelection(self): Clear all selected runs for not reduct...
875a5b99a7a6f51129844bf8052fc6f231497d71
<|skeleton|> class FinalSelectRunToReduceDialog: """GUI (sub) for select run to reduce as final decision before reduction""" def __init__(self, parent): """Set up main window""" <|body_0|> def doClearAllSelection(self): """Clear all selected runs for not reduction""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FinalSelectRunToReduceDialog: """GUI (sub) for select run to reduce as final decision before reduction""" def __init__(self, parent): """Set up main window""" QMainWindow.__init__(self, parent) ui_path = os.path.join(os.path.dirname(__file__), 'gui/import.ui') self.ui = lo...
the_stack_v2_python_sparse
pyvdrive/interface/Dialog_FinalSelectRunToReduce.py
neutrons/PyVDrive
train
2
a32042b9b4e4880db0f7f2b220bcd15349d90c89
[ "GroupFactory(type_id='area')\nurl = reverse('ietf.secr.areas.views.list_areas')\nself.client.login(username='secretary', password='secretary+password')\nresponse = self.client.get(url)\nself.assertEqual(response.status_code, 200)", "area = GroupEventFactory(type='started', group__type_id='area').group\nurl = rev...
<|body_start_0|> GroupFactory(type_id='area') url = reverse('ietf.secr.areas.views.list_areas') self.client.login(username='secretary', password='secretary+password') response = self.client.get(url) self.assertEqual(response.status_code, 200) <|end_body_0|> <|body_start_1|> ...
SecrAreasTestCase
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SecrAreasTestCase: def test_main(self): """Main Test""" <|body_0|> def test_view(self): """View Test""" <|body_1|> def test_add(self): """Add Test""" <|body_2|> <|end_skeleton|> <|body_start_0|> GroupFactory(type_id='area') ...
stack_v2_sparse_classes_36k_train_020907
1,934
permissive
[ { "docstring": "Main Test", "name": "test_main", "signature": "def test_main(self)" }, { "docstring": "View Test", "name": "test_view", "signature": "def test_view(self)" }, { "docstring": "Add Test", "name": "test_add", "signature": "def test_add(self)" } ]
3
stack_v2_sparse_classes_30k_train_006754
Implement the Python class `SecrAreasTestCase` described below. Class description: Implement the SecrAreasTestCase class. Method signatures and docstrings: - def test_main(self): Main Test - def test_view(self): View Test - def test_add(self): Add Test
Implement the Python class `SecrAreasTestCase` described below. Class description: Implement the SecrAreasTestCase class. Method signatures and docstrings: - def test_main(self): Main Test - def test_view(self): View Test - def test_add(self): Add Test <|skeleton|> class SecrAreasTestCase: def test_main(self): ...
aeaae292fbd55aca1b6043227ec105e67d73367f
<|skeleton|> class SecrAreasTestCase: def test_main(self): """Main Test""" <|body_0|> def test_view(self): """View Test""" <|body_1|> def test_add(self): """Add Test""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SecrAreasTestCase: def test_main(self): """Main Test""" GroupFactory(type_id='area') url = reverse('ietf.secr.areas.views.list_areas') self.client.login(username='secretary', password='secretary+password') response = self.client.get(url) self.assertEqual(respons...
the_stack_v2_python_sparse
ietf/secr/areas/tests.py
omunroe-com/ietfdb2
train
2
b5827e0479028da039e67738a0081c76486a77d6
[ "if not inorder or not postorder:\n return None\nroot_v = postorder.pop()\nroot = TreeNode(root_v)\nroot_index = inorder.index(root_v)\nleft_inorder, right_inorder = (inorder[:root_index], inorder[root_index + 1:])\nleft_postorder, right_postorder = (postorder[:len(left_inorder)], postorder[len(left_inorder):])\...
<|body_start_0|> if not inorder or not postorder: return None root_v = postorder.pop() root = TreeNode(root_v) root_index = inorder.index(root_v) left_inorder, right_inorder = (inorder[:root_index], inorder[root_index + 1:]) left_postorder, right_postorder = (...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def buildTree(self, inorder, postorder): """:type inorder: List[int] :type postorder: List[int] :rtype: TreeNode""" <|body_0|> def buildTree1(self, inorder, postorder): """:type inorder: List[int] :type postorder: List[int] :rtype: TreeNode""" <|bod...
stack_v2_sparse_classes_36k_train_020908
2,184
no_license
[ { "docstring": ":type inorder: List[int] :type postorder: List[int] :rtype: TreeNode", "name": "buildTree", "signature": "def buildTree(self, inorder, postorder)" }, { "docstring": ":type inorder: List[int] :type postorder: List[int] :rtype: TreeNode", "name": "buildTree1", "signature": ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def buildTree(self, inorder, postorder): :type inorder: List[int] :type postorder: List[int] :rtype: TreeNode - def buildTree1(self, inorder, postorder): :type inorder: List[int]...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def buildTree(self, inorder, postorder): :type inorder: List[int] :type postorder: List[int] :rtype: TreeNode - def buildTree1(self, inorder, postorder): :type inorder: List[int]...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: def buildTree(self, inorder, postorder): """:type inorder: List[int] :type postorder: List[int] :rtype: TreeNode""" <|body_0|> def buildTree1(self, inorder, postorder): """:type inorder: List[int] :type postorder: List[int] :rtype: TreeNode""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def buildTree(self, inorder, postorder): """:type inorder: List[int] :type postorder: List[int] :rtype: TreeNode""" if not inorder or not postorder: return None root_v = postorder.pop() root = TreeNode(root_v) root_index = inorder.index(root_v) ...
the_stack_v2_python_sparse
106.从中序与后序遍历序列构造二叉树.py
yangyuxiang1996/leetcode
train
0
f1714e047dd62af8cda94e7f0f065c0b02983926
[ "res = []\nif num // 100 != 0:\n res.append(self.dict[num // 100])\n res.append('Hundred')\n num %= 100\nif num != 0:\n if num < 21:\n res.append(self.dict[num])\n else:\n res.append(self.dict[num // 10 * 10])\n if num % 10 != 0:\n res.append(self.dict[num % 10])\nretu...
<|body_start_0|> res = [] if num // 100 != 0: res.append(self.dict[num // 100]) res.append('Hundred') num %= 100 if num != 0: if num < 21: res.append(self.dict[num]) else: res.append(self.dict[num // 10 *...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _convensionWithinThousand(self, num): """convert to words for number within one thousand""" <|body_0|> def numberToWords(self, num): """:type num: int :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = [] if num ...
stack_v2_sparse_classes_36k_train_020909
2,195
no_license
[ { "docstring": "convert to words for number within one thousand", "name": "_convensionWithinThousand", "signature": "def _convensionWithinThousand(self, num)" }, { "docstring": ":type num: int :rtype: str", "name": "numberToWords", "signature": "def numberToWords(self, num)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _convensionWithinThousand(self, num): convert to words for number within one thousand - def numberToWords(self, num): :type num: int :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _convensionWithinThousand(self, num): convert to words for number within one thousand - def numberToWords(self, num): :type num: int :rtype: str <|skeleton|> class Solution:...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def _convensionWithinThousand(self, num): """convert to words for number within one thousand""" <|body_0|> def numberToWords(self, num): """:type num: int :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def _convensionWithinThousand(self, num): """convert to words for number within one thousand""" res = [] if num // 100 != 0: res.append(self.dict[num // 100]) res.append('Hundred') num %= 100 if num != 0: if num < 21: ...
the_stack_v2_python_sparse
code273IntegerToEnglishWords.py
cybelewang/leetcode-python
train
0
b41ac4610f28f45088ba8ce584e8c2d8b10393f1
[ "try:\n if 'created' in kwargs:\n extra = TYPE_FIXES.get(self.translator.provider_instance.driver.type, {})\n self.translator.provider_instance.driver.create_zone(domain=self.name, type=self.type, ttl=self.ttl, extra=extra)\n else:\n LOGGER.warning('libcloud Zone updating not implemented'...
<|body_start_0|> try: if 'created' in kwargs: extra = TYPE_FIXES.get(self.translator.provider_instance.driver.type, {}) self.translator.provider_instance.driver.create_zone(domain=self.name, type=self.type, ttl=self.ttl, extra=extra) else: ...
LCloud intermediate Zone object
LCloudZoneObject
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LCloudZoneObject: """LCloud intermediate Zone object""" def save(self, **kwargs) -> ProviderResult: """Save this instance""" <|body_0|> def delete(self, **kwargs) -> ProviderResult: """Delete this instance""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_020910
2,645
permissive
[ { "docstring": "Save this instance", "name": "save", "signature": "def save(self, **kwargs) -> ProviderResult" }, { "docstring": "Delete this instance", "name": "delete", "signature": "def delete(self, **kwargs) -> ProviderResult" } ]
2
stack_v2_sparse_classes_30k_train_005000
Implement the Python class `LCloudZoneObject` described below. Class description: LCloud intermediate Zone object Method signatures and docstrings: - def save(self, **kwargs) -> ProviderResult: Save this instance - def delete(self, **kwargs) -> ProviderResult: Delete this instance
Implement the Python class `LCloudZoneObject` described below. Class description: LCloud intermediate Zone object Method signatures and docstrings: - def save(self, **kwargs) -> ProviderResult: Save this instance - def delete(self, **kwargs) -> ProviderResult: Delete this instance <|skeleton|> class LCloudZoneObject...
2305b1e27abb0bfe9fcee93b79e012c62cba712e
<|skeleton|> class LCloudZoneObject: """LCloud intermediate Zone object""" def save(self, **kwargs) -> ProviderResult: """Save this instance""" <|body_0|> def delete(self, **kwargs) -> ProviderResult: """Delete this instance""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LCloudZoneObject: """LCloud intermediate Zone object""" def save(self, **kwargs) -> ProviderResult: """Save this instance""" try: if 'created' in kwargs: extra = TYPE_FIXES.get(self.translator.provider_instance.driver.type, {}) self.translator.p...
the_stack_v2_python_sparse
supervisr/provider/libcloud/providers/translators/zone.py
BeryJu/supervisr
train
1
49bea5216e02a8c891f34824e163cd961e813ca2
[ "self.string = pageinfo\nself.isvalid = True\nself.begin = bsl\nself.endloc = 0\nself.discount = self.find(self.string, gds, end, cb=True)\nself.price = self.find(self.string, gps, end)\nself.ogprice = self.find(self.string, gops, end)\nself.name = self.find(self.string, gns, end, cwe=True)", "try:\n startloc ...
<|body_start_0|> self.string = pageinfo self.isvalid = True self.begin = bsl self.endloc = 0 self.discount = self.find(self.string, gds, end, cb=True) self.price = self.find(self.string, gps, end) self.ogprice = self.find(self.string, gops, end) self.name ...
game
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class game: def __init__(self, pageinfo, bsl: int, gns, gds, gps, gops, end): """Arguments: bsl is the beginning search location. It should be an integer pageinfo is the html of a website converted to a string gns is the 'game's name start'; it is what to look for directly before a game's name...
stack_v2_sparse_classes_36k_train_020911
4,903
permissive
[ { "docstring": "Arguments: bsl is the beginning search location. It should be an integer pageinfo is the html of a website converted to a string gns is the 'game's name start'; it is what to look for directly before a game's name gds is the 'game's discount start'; it is what to look for directly before a game'...
2
null
Implement the Python class `game` described below. Class description: Implement the game class. Method signatures and docstrings: - def __init__(self, pageinfo, bsl: int, gns, gds, gps, gops, end): Arguments: bsl is the beginning search location. It should be an integer pageinfo is the html of a website converted to ...
Implement the Python class `game` described below. Class description: Implement the game class. Method signatures and docstrings: - def __init__(self, pageinfo, bsl: int, gns, gds, gps, gops, end): Arguments: bsl is the beginning search location. It should be an integer pageinfo is the html of a website converted to ...
8648e42feb610228021b42646c1c4c8b929e745a
<|skeleton|> class game: def __init__(self, pageinfo, bsl: int, gns, gds, gps, gops, end): """Arguments: bsl is the beginning search location. It should be an integer pageinfo is the html of a website converted to a string gns is the 'game's name start'; it is what to look for directly before a game's name...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class game: def __init__(self, pageinfo, bsl: int, gns, gds, gps, gops, end): """Arguments: bsl is the beginning search location. It should be an integer pageinfo is the html of a website converted to a string gns is the 'game's name start'; it is what to look for directly before a game's name gds is the 'g...
the_stack_v2_python_sparse
3_advanced/chapter20/solutions/txt_write_practice.py
thestrawberryqueen/python
train
0
dc3eb246d561af1c0ff95b3feed58fb6b9e1ba5b
[ "def func_recursion(node, lower=float('-inf'), upper=float('inf')):\n if not node:\n return True\n val = node.val\n if val <= lower or val >= upper:\n return False\n if not func_recursion(node.left, lower, val):\n return False\n if not func_recursion(node.right, val, upper):\n ...
<|body_start_0|> def func_recursion(node, lower=float('-inf'), upper=float('inf')): if not node: return True val = node.val if val <= lower or val >= upper: return False if not func_recursion(node.left, lower, val): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValidBST(self, root): """递归法判定给出的二叉树是否为BST。 复杂度分析 时间复杂度 : O(N)。每个结点访问一次。 空间复杂度 : O(N)。跟进了整棵树。 :param root: :return:""" <|body_0|> def isValidBST_iteration(self, root): """迭代法判断二叉树是否为BST 复杂度分析 时间复杂度 : O(N)O(N)。每个结点访问一次。 空间复杂度 : O(N)O(N)。我们跟进了整棵树。 :para...
stack_v2_sparse_classes_36k_train_020912
3,189
no_license
[ { "docstring": "递归法判定给出的二叉树是否为BST。 复杂度分析 时间复杂度 : O(N)。每个结点访问一次。 空间复杂度 : O(N)。跟进了整棵树。 :param root: :return:", "name": "isValidBST", "signature": "def isValidBST(self, root)" }, { "docstring": "迭代法判断二叉树是否为BST 复杂度分析 时间复杂度 : O(N)O(N)。每个结点访问一次。 空间复杂度 : O(N)O(N)。我们跟进了整棵树。 :param root: :return:", "...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST(self, root): 递归法判定给出的二叉树是否为BST。 复杂度分析 时间复杂度 : O(N)。每个结点访问一次。 空间复杂度 : O(N)。跟进了整棵树。 :param root: :return: - def isValidBST_iteration(self, root): 迭代法判断二叉树是否为BST 复杂度分...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST(self, root): 递归法判定给出的二叉树是否为BST。 复杂度分析 时间复杂度 : O(N)。每个结点访问一次。 空间复杂度 : O(N)。跟进了整棵树。 :param root: :return: - def isValidBST_iteration(self, root): 迭代法判断二叉树是否为BST 复杂度分...
62ad010a992c031e8c0fe4d1a9b6f9364f96ed4c
<|skeleton|> class Solution: def isValidBST(self, root): """递归法判定给出的二叉树是否为BST。 复杂度分析 时间复杂度 : O(N)。每个结点访问一次。 空间复杂度 : O(N)。跟进了整棵树。 :param root: :return:""" <|body_0|> def isValidBST_iteration(self, root): """迭代法判断二叉树是否为BST 复杂度分析 时间复杂度 : O(N)O(N)。每个结点访问一次。 空间复杂度 : O(N)O(N)。我们跟进了整棵树。 :para...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isValidBST(self, root): """递归法判定给出的二叉树是否为BST。 复杂度分析 时间复杂度 : O(N)。每个结点访问一次。 空间复杂度 : O(N)。跟进了整棵树。 :param root: :return:""" def func_recursion(node, lower=float('-inf'), upper=float('inf')): if not node: return True val = node.val ...
the_stack_v2_python_sparse
leetcode/solved/098_.py
usnnu/python_foundation
train
0
1cec0651b533ca798a85d01220d1c25bdee42354
[ "CalendarHelper = calendar_helpers.CalendarHelper\nnumber_of_participants = len(participants)\ndates_of_month = CalendarHelper.get_days_of_month(year, month)\nlist_of_saturdays = CalendarHelper.get_day_list_of_month(year, month, SATURDAY)\nlist_invalid_saturdays = []\nfor index, is_valid_sat in enumerate(saturday_l...
<|body_start_0|> CalendarHelper = calendar_helpers.CalendarHelper number_of_participants = len(participants) dates_of_month = CalendarHelper.get_days_of_month(year, month) list_of_saturdays = CalendarHelper.get_day_list_of_month(year, month, SATURDAY) list_invalid_saturdays = [] ...
Class containing helper methods to create Roster.
CreateRosterHelper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateRosterHelper: """Class containing helper methods to create Roster.""" def prepare_roster(self, participants: List[model_init_service.ModelService.get_participant_model_class], holiday_list: List[datetime.date], saturday_list: List[bool], is_sunday_included: bool, session_list: List[str...
stack_v2_sparse_classes_36k_train_020913
4,575
permissive
[ { "docstring": "Method to get the list containig number of sessions for each participants and the remaining days to be catered. The return value would be as follows<br>", "name": "prepare_roster", "signature": "def prepare_roster(self, participants: List[model_init_service.ModelService.get_participant_m...
2
stack_v2_sparse_classes_30k_val_001104
Implement the Python class `CreateRosterHelper` described below. Class description: Class containing helper methods to create Roster. Method signatures and docstrings: - def prepare_roster(self, participants: List[model_init_service.ModelService.get_participant_model_class], holiday_list: List[datetime.date], saturda...
Implement the Python class `CreateRosterHelper` described below. Class description: Class containing helper methods to create Roster. Method signatures and docstrings: - def prepare_roster(self, participants: List[model_init_service.ModelService.get_participant_model_class], holiday_list: List[datetime.date], saturda...
23131aff6e0c20497bde632ed32aadcad0947e56
<|skeleton|> class CreateRosterHelper: """Class containing helper methods to create Roster.""" def prepare_roster(self, participants: List[model_init_service.ModelService.get_participant_model_class], holiday_list: List[datetime.date], saturday_list: List[bool], is_sunday_included: bool, session_list: List[str...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CreateRosterHelper: """Class containing helper methods to create Roster.""" def prepare_roster(self, participants: List[model_init_service.ModelService.get_participant_model_class], holiday_list: List[datetime.date], saturday_list: List[bool], is_sunday_included: bool, session_list: List[str], year: int,...
the_stack_v2_python_sparse
roster-backend/roster_project/roster_api/utils/helpers/business_helpers/create_roster_helper.py
akhilanil/roster
train
0
005f3a262959acbc5d028dbf38c3b7335056a283
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
A set of methods for managing Organization users.
UserServiceServicer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserServiceServicer: """A set of methods for managing Organization users.""" def ListMembers(self, request, context): """List organization active members.""" <|body_0|> def DeleteMembership(self, request, context): """Delete user membership.""" <|body_1|>...
stack_v2_sparse_classes_36k_train_020914
4,946
permissive
[ { "docstring": "List organization active members.", "name": "ListMembers", "signature": "def ListMembers(self, request, context)" }, { "docstring": "Delete user membership.", "name": "DeleteMembership", "signature": "def DeleteMembership(self, request, context)" } ]
2
stack_v2_sparse_classes_30k_train_006564
Implement the Python class `UserServiceServicer` described below. Class description: A set of methods for managing Organization users. Method signatures and docstrings: - def ListMembers(self, request, context): List organization active members. - def DeleteMembership(self, request, context): Delete user membership.
Implement the Python class `UserServiceServicer` described below. Class description: A set of methods for managing Organization users. Method signatures and docstrings: - def ListMembers(self, request, context): List organization active members. - def DeleteMembership(self, request, context): Delete user membership. ...
b906a014dd893e2697864e1e48e814a8d9fbc48c
<|skeleton|> class UserServiceServicer: """A set of methods for managing Organization users.""" def ListMembers(self, request, context): """List organization active members.""" <|body_0|> def DeleteMembership(self, request, context): """Delete user membership.""" <|body_1|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserServiceServicer: """A set of methods for managing Organization users.""" def ListMembers(self, request, context): """List organization active members.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplemented...
the_stack_v2_python_sparse
yandex/cloud/organizationmanager/v1/user_service_pb2_grpc.py
yandex-cloud/python-sdk
train
63
50e49557d9f115fb046b3b381dee29d439bf8d1f
[ "values = {'class_path': None, 'enabled': True, 'in_progress_behavior': None, 'name': name, 'locked': False, 'profile': None, 'protected': False, 'region': None, 'required_by': None, 'requires': None, 'stack_name': None, 'stack_policy_path': None, 'tags': None, 'template_path': None, 'termination_protection': False...
<|body_start_0|> values = {'class_path': None, 'enabled': True, 'in_progress_behavior': None, 'name': name, 'locked': False, 'profile': None, 'protected': False, 'region': None, 'required_by': None, 'requires': None, 'stack_name': None, 'stack_policy_path': None, 'tags': None, 'template_path': None, 'terminatio...
Stack definition for use in hooks to avoid cyclic imports.
HookStackDefinition
[ "Apache-2.0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HookStackDefinition: """Stack definition for use in hooks to avoid cyclic imports.""" def __init__(self, name, **kwargs): """Instantiate class.""" <|body_0|> def __getattr__(self, key): """Implement dot notation.""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_36k_train_020915
9,661
permissive
[ { "docstring": "Instantiate class.", "name": "__init__", "signature": "def __init__(self, name, **kwargs)" }, { "docstring": "Implement dot notation.", "name": "__getattr__", "signature": "def __getattr__(self, key)" } ]
2
null
Implement the Python class `HookStackDefinition` described below. Class description: Stack definition for use in hooks to avoid cyclic imports. Method signatures and docstrings: - def __init__(self, name, **kwargs): Instantiate class. - def __getattr__(self, key): Implement dot notation.
Implement the Python class `HookStackDefinition` described below. Class description: Stack definition for use in hooks to avoid cyclic imports. Method signatures and docstrings: - def __init__(self, name, **kwargs): Instantiate class. - def __getattr__(self, key): Implement dot notation. <|skeleton|> class HookStack...
94aebff4f83b294653192a1b74111f6a9f114de2
<|skeleton|> class HookStackDefinition: """Stack definition for use in hooks to avoid cyclic imports.""" def __init__(self, name, **kwargs): """Instantiate class.""" <|body_0|> def __getattr__(self, key): """Implement dot notation.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HookStackDefinition: """Stack definition for use in hooks to avoid cyclic imports.""" def __init__(self, name, **kwargs): """Instantiate class.""" values = {'class_path': None, 'enabled': True, 'in_progress_behavior': None, 'name': name, 'locked': False, 'profile': None, 'protected': Fals...
the_stack_v2_python_sparse
runway/cfngin/hooks/base.py
edgarpoce/runway
train
1
7d48359e5b9532ada9a0bf6ce0859bfacef18e85
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AppliedConditionalAccessPolicy()", "from .applied_conditional_access_policy_result import AppliedConditionalAccessPolicyResult\nfrom .applied_conditional_access_policy_result import AppliedConditionalAccessPolicyResult\nfields: Dict[st...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return AppliedConditionalAccessPolicy() <|end_body_0|> <|body_start_1|> from .applied_conditional_access_policy_result import AppliedConditionalAccessPolicyResult from .applied_conditional_acce...
AppliedConditionalAccessPolicy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AppliedConditionalAccessPolicy: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AppliedConditionalAccessPolicy: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator v...
stack_v2_sparse_classes_36k_train_020916
4,450
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: AppliedConditionalAccessPolicy", "name": "create_from_discriminator_value", "signature": "def create_from_di...
3
stack_v2_sparse_classes_30k_train_017444
Implement the Python class `AppliedConditionalAccessPolicy` described below. Class description: Implement the AppliedConditionalAccessPolicy class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AppliedConditionalAccessPolicy: Creates a new instance of...
Implement the Python class `AppliedConditionalAccessPolicy` described below. Class description: Implement the AppliedConditionalAccessPolicy class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AppliedConditionalAccessPolicy: Creates a new instance of...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class AppliedConditionalAccessPolicy: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AppliedConditionalAccessPolicy: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator v...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AppliedConditionalAccessPolicy: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AppliedConditionalAccessPolicy: """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 creat...
the_stack_v2_python_sparse
msgraph/generated/models/applied_conditional_access_policy.py
microsoftgraph/msgraph-sdk-python
train
135
e091d03d3ea5ec4d503bd736aafba91aba0ab645
[ "test_obj = Furniture(1, 2, 3, 4, 5, 6)\nself.assertEqual(test_obj.product_code, 1)\nself.assertEqual(test_obj.description, 2)\nself.assertEqual(test_obj.market_price, 3)\nself.assertEqual(test_obj.rental_price, 4)\nself.assertEqual(test_obj.material, 5)\nself.assertEqual(test_obj.size, 6)", "test_obj = Furniture...
<|body_start_0|> test_obj = Furniture(1, 2, 3, 4, 5, 6) self.assertEqual(test_obj.product_code, 1) self.assertEqual(test_obj.description, 2) self.assertEqual(test_obj.market_price, 3) self.assertEqual(test_obj.rental_price, 4) self.assertEqual(test_obj.material, 5) ...
Test Furniture class
FurnitureTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FurnitureTest: """Test Furniture class""" def test_init(self): """Test init""" <|body_0|> def test_return_dict(self): """Test return as dict func""" <|body_1|> <|end_skeleton|> <|body_start_0|> test_obj = Furniture(1, 2, 3, 4, 5, 6) self...
stack_v2_sparse_classes_36k_train_020917
4,928
no_license
[ { "docstring": "Test init", "name": "test_init", "signature": "def test_init(self)" }, { "docstring": "Test return as dict func", "name": "test_return_dict", "signature": "def test_return_dict(self)" } ]
2
stack_v2_sparse_classes_30k_train_010702
Implement the Python class `FurnitureTest` described below. Class description: Test Furniture class Method signatures and docstrings: - def test_init(self): Test init - def test_return_dict(self): Test return as dict func
Implement the Python class `FurnitureTest` described below. Class description: Test Furniture class Method signatures and docstrings: - def test_init(self): Test init - def test_return_dict(self): Test return as dict func <|skeleton|> class FurnitureTest: """Test Furniture class""" def test_init(self): ...
6ffd7b4ab8346076d3b6cc02ca1ebca3bf028697
<|skeleton|> class FurnitureTest: """Test Furniture class""" def test_init(self): """Test init""" <|body_0|> def test_return_dict(self): """Test return as dict func""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FurnitureTest: """Test Furniture class""" def test_init(self): """Test init""" test_obj = Furniture(1, 2, 3, 4, 5, 6) self.assertEqual(test_obj.product_code, 1) self.assertEqual(test_obj.description, 2) self.assertEqual(test_obj.market_price, 3) self.assert...
the_stack_v2_python_sparse
students/JasneetChandok/lesson01/assignment/test_unit.py
UWPCE-PythonCert-ClassRepos/220-Advanced-Summer-2019
train
4
43014415d4e4b7c3a2ca6aa1907409479c864587
[ "self.item = item\nself.key = key\nself.left = left\nself.right = right\nself._size = 1", "if self.key == key:\n self.item = item\nelif self.key < key:\n if self.right:\n self.right.insert(item, key)\n else:\n self.right = BSTreeNode(item, key)\nelif self.left:\n self.left.insert(item, k...
<|body_start_0|> self.item = item self.key = key self.left = left self.right = right self._size = 1 <|end_body_0|> <|body_start_1|> if self.key == key: self.item = item elif self.key < key: if self.right: self.right.insert(...
Binary search tree node (subtree)
BSTreeNode
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BSTreeNode: """Binary search tree node (subtree)""" def __init__(self, item, key, left=None, right=None): """Tree node constructor. :param item: node's item :param key: item's key :param left (BSTreeNode): left child (subtree) :param right (BSTreeNode): right child (subtree)""" ...
stack_v2_sparse_classes_36k_train_020918
3,986
no_license
[ { "docstring": "Tree node constructor. :param item: node's item :param key: item's key :param left (BSTreeNode): left child (subtree) :param right (BSTreeNode): right child (subtree)", "name": "__init__", "signature": "def __init__(self, item, key, left=None, right=None)" }, { "docstring": "Assi...
6
stack_v2_sparse_classes_30k_train_019148
Implement the Python class `BSTreeNode` described below. Class description: Binary search tree node (subtree) Method signatures and docstrings: - def __init__(self, item, key, left=None, right=None): Tree node constructor. :param item: node's item :param key: item's key :param left (BSTreeNode): left child (subtree) ...
Implement the Python class `BSTreeNode` described below. Class description: Binary search tree node (subtree) Method signatures and docstrings: - def __init__(self, item, key, left=None, right=None): Tree node constructor. :param item: node's item :param key: item's key :param left (BSTreeNode): left child (subtree) ...
61746b48482eb0701f5c7211b153a3726c24f355
<|skeleton|> class BSTreeNode: """Binary search tree node (subtree)""" def __init__(self, item, key, left=None, right=None): """Tree node constructor. :param item: node's item :param key: item's key :param left (BSTreeNode): left child (subtree) :param right (BSTreeNode): right child (subtree)""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BSTreeNode: """Binary search tree node (subtree)""" def __init__(self, item, key, left=None, right=None): """Tree node constructor. :param item: node's item :param key: item's key :param left (BSTreeNode): left child (subtree) :param right (BSTreeNode): right child (subtree)""" self.item ...
the_stack_v2_python_sparse
mpiaa/search/bstree_node.py
sergey-suslov/mpiaa-sem3
train
0
0282584d3a0d651c43310be13a3b14766b2cdf18
[ "def direct_drop(layer, prob):\n \"\"\" Build a condition node if we are in train_phase. thus we can use the\n is_training_ placeholder to switch.\n Build a prob*layer node when we're not in train_phase.\n Returns the correct node\"\"\"\n if train_phase:\n layer = tf.co...
<|body_start_0|> def direct_drop(layer, prob): """ Build a condition node if we are in train_phase. thus we can use the is_training_ placeholder to switch. Build a prob*layer node when we're not in train_phase. Returns the correct node""" ...
Build a LeNet-like network with direct dropout layers
LeNetDirectDropout
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LeNetDirectDropout: """Build a LeNet-like network with direct dropout layers""" def _inference(self, images, num_classes, is_training_, train_phase=False, l2_penalty=0.0): """Build the LeNet-like network. Args: images: Images returned from distorted_inputs() or inputs(). num_classes:...
stack_v2_sparse_classes_36k_train_020919
5,471
no_license
[ { "docstring": "Build the LeNet-like network. Args: images: Images returned from distorted_inputs() or inputs(). num_classes: Number of classes to predict is_training_: enable/disable training ops at run time train_phase: Boolean to enable/disable training ops at build time l2_penalty: float value, weight decay...
3
null
Implement the Python class `LeNetDirectDropout` described below. Class description: Build a LeNet-like network with direct dropout layers Method signatures and docstrings: - def _inference(self, images, num_classes, is_training_, train_phase=False, l2_penalty=0.0): Build the LeNet-like network. Args: images: Images r...
Implement the Python class `LeNetDirectDropout` described below. Class description: Build a LeNet-like network with direct dropout layers Method signatures and docstrings: - def _inference(self, images, num_classes, is_training_, train_phase=False, l2_penalty=0.0): Build the LeNet-like network. Args: images: Images r...
d494b3041069d377d6a7a9c296a14334f2fa5acc
<|skeleton|> class LeNetDirectDropout: """Build a LeNet-like network with direct dropout layers""" def _inference(self, images, num_classes, is_training_, train_phase=False, l2_penalty=0.0): """Build the LeNet-like network. Args: images: Images returned from distorted_inputs() or inputs(). num_classes:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LeNetDirectDropout: """Build a LeNet-like network with direct dropout layers""" def _inference(self, images, num_classes, is_training_, train_phase=False, l2_penalty=0.0): """Build the LeNet-like network. Args: images: Images returned from distorted_inputs() or inputs(). num_classes: Number of cl...
the_stack_v2_python_sparse
python/galeone_dynamic-training-bench/dynamic-training-bench-master/models/LeNetDirectDropout.py
LiuFang816/SALSTM_py_data
train
10
e312b1d5d6279ab5fa4cae313f044f9ed3b4a023
[ "actual = clean_text('check out this link: https://cyphon.io')\nexpected = 'check out this link'\nself.assertEqual(actual, expected)", "actual = clean_text('@foobar hey there')\nexpected = 'hey there'\nself.assertEqual(actual, expected)", "actual = clean_text('#foobar hey there')\nexpected = 'foobar hey there'\...
<|body_start_0|> actual = clean_text('check out this link: https://cyphon.io') expected = 'check out this link' self.assertEqual(actual, expected) <|end_body_0|> <|body_start_1|> actual = clean_text('@foobar hey there') expected = 'hey there' self.assertEqual(actual, exp...
Tests the clean_text() function.
CleanTextTestCase
[ "LicenseRef-scancode-proprietary-license", "GPL-3.0-only", "LicenseRef-scancode-unknown-license-reference", "GPL-1.0-or-later", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-other-copyleft", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CleanTextTestCase: """Tests the clean_text() function.""" def test_clean_url(self): """Tests the clean_text() function for text containing a URL.""" <|body_0|> def test_clean_at(self): """Tests the clean_text() function for text containing an @ symbol.""" ...
stack_v2_sparse_classes_36k_train_020920
4,456
permissive
[ { "docstring": "Tests the clean_text() function for text containing a URL.", "name": "test_clean_url", "signature": "def test_clean_url(self)" }, { "docstring": "Tests the clean_text() function for text containing an @ symbol.", "name": "test_clean_at", "signature": "def test_clean_at(se...
3
stack_v2_sparse_classes_30k_train_008482
Implement the Python class `CleanTextTestCase` described below. Class description: Tests the clean_text() function. Method signatures and docstrings: - def test_clean_url(self): Tests the clean_text() function for text containing a URL. - def test_clean_at(self): Tests the clean_text() function for text containing an...
Implement the Python class `CleanTextTestCase` described below. Class description: Tests the clean_text() function. Method signatures and docstrings: - def test_clean_url(self): Tests the clean_text() function for text containing a URL. - def test_clean_at(self): Tests the clean_text() function for text containing an...
a379a134c0c5af14df4ed2afa066c1626506b754
<|skeleton|> class CleanTextTestCase: """Tests the clean_text() function.""" def test_clean_url(self): """Tests the clean_text() function for text containing a URL.""" <|body_0|> def test_clean_at(self): """Tests the clean_text() function for text containing an @ symbol.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CleanTextTestCase: """Tests the clean_text() function.""" def test_clean_url(self): """Tests the clean_text() function for text containing a URL.""" actual = clean_text('check out this link: https://cyphon.io') expected = 'check out this link' self.assertEqual(actual, expe...
the_stack_v2_python_sparse
Incident-Response/Tools/cyphon/cyphon/lab/sentiment/test_sentiment.py
foss2cyber/Incident-Playbook
train
1
2752037d02a31f81e926fa7be34b3c4bfc67e1d5
[ "re = cloudparking_service().mockCarInOut(send_data['carNum'], 0, send_data['inClientID'])\nresult = re\nAssertions().assert_in_text(result, expect['screen'])\nAssertions().assert_in_text(result, expect['voice'])", "re = Information(userLogin).getPresentCar(send_data['parkName'], send_data['carNum'])\nresult = re...
<|body_start_0|> re = cloudparking_service().mockCarInOut(send_data['carNum'], 0, send_data['inClientID']) result = re Assertions().assert_in_text(result, expect['screen']) Assertions().assert_in_text(result, expect['voice']) <|end_body_0|> <|body_start_1|> re = Information(user...
白名单宽进宽出
TestWhitelistWideInOutProcess
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestWhitelistWideInOutProcess: """白名单宽进宽出""" def test_mockCarIn(self, send_data, expect): """模拟车辆进场""" <|body_0|> def test_presentCar(self, userLogin, send_data, expect): """查看在场记录""" <|body_1|> def test_mockCarOut(self, send_data, expect): "...
stack_v2_sparse_classes_36k_train_020921
1,988
no_license
[ { "docstring": "模拟车辆进场", "name": "test_mockCarIn", "signature": "def test_mockCarIn(self, send_data, expect)" }, { "docstring": "查看在场记录", "name": "test_presentCar", "signature": "def test_presentCar(self, userLogin, send_data, expect)" }, { "docstring": "模拟车辆离场", "name": "tes...
4
null
Implement the Python class `TestWhitelistWideInOutProcess` described below. Class description: 白名单宽进宽出 Method signatures and docstrings: - def test_mockCarIn(self, send_data, expect): 模拟车辆进场 - def test_presentCar(self, userLogin, send_data, expect): 查看在场记录 - def test_mockCarOut(self, send_data, expect): 模拟车辆离场 - def ...
Implement the Python class `TestWhitelistWideInOutProcess` described below. Class description: 白名单宽进宽出 Method signatures and docstrings: - def test_mockCarIn(self, send_data, expect): 模拟车辆进场 - def test_presentCar(self, userLogin, send_data, expect): 查看在场记录 - def test_mockCarOut(self, send_data, expect): 模拟车辆离场 - def ...
34c368c109867da26d9256bca85f872b0fac2ea7
<|skeleton|> class TestWhitelistWideInOutProcess: """白名单宽进宽出""" def test_mockCarIn(self, send_data, expect): """模拟车辆进场""" <|body_0|> def test_presentCar(self, userLogin, send_data, expect): """查看在场记录""" <|body_1|> def test_mockCarOut(self, send_data, expect): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestWhitelistWideInOutProcess: """白名单宽进宽出""" def test_mockCarIn(self, send_data, expect): """模拟车辆进场""" re = cloudparking_service().mockCarInOut(send_data['carNum'], 0, send_data['inClientID']) result = re Assertions().assert_in_text(result, expect['screen']) Assert...
the_stack_v2_python_sparse
test_suite/parkingConfig/useParking/lightRuleChannel/test_whitelistWideInOutProcess.py
oyebino/pomp_api
train
1
963dbd77e8c2e6756dc99c775be29740019f072f
[ "dictionary = self.formatDict(results)\nfinal = {}\nfor entry in dictionary:\n final[entry['jobid']] = entry['task']\nreturn final", "if isinstance(jobID, list):\n if len(jobID) == 0:\n return {}\n binds = []\n for ID in jobID:\n binds.append({'jobid': int(ID)})\nelif isinstance(jobID, i...
<|body_start_0|> dictionary = self.formatDict(results) final = {} for entry in dictionary: final[entry['jobid']] = entry['task'] return final <|end_body_0|> <|body_start_1|> if isinstance(jobID, list): if len(jobID) == 0: return {} ...
GetTask
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetTask: def format(self, results): """Should create one dictionary of the form {'jobid':'taskName'}""" <|body_0|> def execute(self, jobID, conn=None, transaction=False): """Should handle bulk and regular attempts to find the task""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k_train_020922
1,509
permissive
[ { "docstring": "Should create one dictionary of the form {'jobid':'taskName'}", "name": "format", "signature": "def format(self, results)" }, { "docstring": "Should handle bulk and regular attempts to find the task", "name": "execute", "signature": "def execute(self, jobID, conn=None, tr...
2
null
Implement the Python class `GetTask` described below. Class description: Implement the GetTask class. Method signatures and docstrings: - def format(self, results): Should create one dictionary of the form {'jobid':'taskName'} - def execute(self, jobID, conn=None, transaction=False): Should handle bulk and regular at...
Implement the Python class `GetTask` described below. Class description: Implement the GetTask class. Method signatures and docstrings: - def format(self, results): Should create one dictionary of the form {'jobid':'taskName'} - def execute(self, jobID, conn=None, transaction=False): Should handle bulk and regular at...
de110ccf6fc63ef5589b4e871ef4d51d5bce7a25
<|skeleton|> class GetTask: def format(self, results): """Should create one dictionary of the form {'jobid':'taskName'}""" <|body_0|> def execute(self, jobID, conn=None, transaction=False): """Should handle bulk and regular attempts to find the task""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetTask: def format(self, results): """Should create one dictionary of the form {'jobid':'taskName'}""" dictionary = self.formatDict(results) final = {} for entry in dictionary: final[entry['jobid']] = entry['task'] return final def execute(self, jobID,...
the_stack_v2_python_sparse
src/python/WMCore/WMBS/MySQL/Jobs/GetTask.py
vkuznet/WMCore
train
0
d4997c678a24d2f08149fa26c65e0f2736d0ec95
[ "super().__init__()\nself._ui = Ui_CpfcDialog()\nself._ui.setupUi(self)\nself._ui.new_pfc_line_edit.setValidator(QDoubleValidator())\nwith open('.steelcase_pfc', 'a+') as file:\n self.current_pfc = file.read()\nself._ui.current_pfc_line_edit.setText(self.current_pfc)\nself.move(QDesktopWidget().availableGeometry...
<|body_start_0|> super().__init__() self._ui = Ui_CpfcDialog() self._ui.setupUi(self) self._ui.new_pfc_line_edit.setValidator(QDoubleValidator()) with open('.steelcase_pfc', 'a+') as file: self.current_pfc = file.read() self._ui.current_pfc_line_edit.setText(s...
QDialog class containing methods to change the pass/fail criteria.
CpfcDialog
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CpfcDialog: """QDialog class containing methods to change the pass/fail criteria.""" def __init__(self): """Start_steelcase init method.""" <|body_0|> def accept(self): """Overiding of QDialog accept method.""" <|body_1|> def _check_input(self, obj):...
stack_v2_sparse_classes_36k_train_020923
2,474
permissive
[ { "docstring": "Start_steelcase init method.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Overiding of QDialog accept method.", "name": "accept", "signature": "def accept(self)" }, { "docstring": "Method to create input for the zero condition.", ...
3
stack_v2_sparse_classes_30k_val_000197
Implement the Python class `CpfcDialog` described below. Class description: QDialog class containing methods to change the pass/fail criteria. Method signatures and docstrings: - def __init__(self): Start_steelcase init method. - def accept(self): Overiding of QDialog accept method. - def _check_input(self, obj): Met...
Implement the Python class `CpfcDialog` described below. Class description: QDialog class containing methods to change the pass/fail criteria. Method signatures and docstrings: - def __init__(self): Start_steelcase init method. - def accept(self): Overiding of QDialog accept method. - def _check_input(self, obj): Met...
024def3d5654e772e6ac598b6555cdcdd8a26287
<|skeleton|> class CpfcDialog: """QDialog class containing methods to change the pass/fail criteria.""" def __init__(self): """Start_steelcase init method.""" <|body_0|> def accept(self): """Overiding of QDialog accept method.""" <|body_1|> def _check_input(self, obj):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CpfcDialog: """QDialog class containing methods to change the pass/fail criteria.""" def __init__(self): """Start_steelcase init method.""" super().__init__() self._ui = Ui_CpfcDialog() self._ui.setupUi(self) self._ui.new_pfc_line_edit.setValidator(QDoubleValidator...
the_stack_v2_python_sparse
src/cpfc_dialog.py
lawrencend/steelcase
train
0
ad43de3c5a81158d7d4c73d6f0fd37f197c70c2f
[ "df = df.reset_index(drop=True)\nfor i in range(len(df)):\n feature = df.loc[i, 'column_name']\n df.loc[i, 'original_name'] = '_'.join(str(feature).split('_')[:-1])\n df.loc[i, 'binning_method'] = 'ChiMerge' if 'ChiMerge' in feature.split('_')[-1] else 'DecisionTree'\n df.loc[i, 'binning_number'] = feat...
<|body_start_0|> df = df.reset_index(drop=True) for i in range(len(df)): feature = df.loc[i, 'column_name'] df.loc[i, 'original_name'] = '_'.join(str(feature).split('_')[:-1]) df.loc[i, 'binning_method'] = 'ChiMerge' if 'ChiMerge' in feature.split('_')[-1] else 'Decis...
功能:整理评分卡应用的特征单调性筛选输入数据 输入:整理的分箱编码数据集 df 控制:保留特征列表 keep_columns_list 输出:过滤后特征数据集
FeatureSelectionByMonotonicityRule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureSelectionByMonotonicityRule: """功能:整理评分卡应用的特征单调性筛选输入数据 输入:整理的分箱编码数据集 df 控制:保留特征列表 keep_columns_list 输出:过滤后特征数据集""" def _filter_data(self, df): """保留具有单调性的变量 :param df: 带单调性判断的编码规则 :return: 具有单调性的编码规则""" <|body_0|> def fit(self, df): """单调性判断服务 :param df: 单...
stack_v2_sparse_classes_36k_train_020924
32,082
no_license
[ { "docstring": "保留具有单调性的变量 :param df: 带单调性判断的编码规则 :return: 具有单调性的编码规则", "name": "_filter_data", "signature": "def _filter_data(self, df)" }, { "docstring": "单调性判断服务 :param df: 单调性判断输入数据 :return: 具有单调性的编码规则", "name": "fit", "signature": "def fit(self, df)" } ]
2
stack_v2_sparse_classes_30k_test_000224
Implement the Python class `FeatureSelectionByMonotonicityRule` described below. Class description: 功能:整理评分卡应用的特征单调性筛选输入数据 输入:整理的分箱编码数据集 df 控制:保留特征列表 keep_columns_list 输出:过滤后特征数据集 Method signatures and docstrings: - def _filter_data(self, df): 保留具有单调性的变量 :param df: 带单调性判断的编码规则 :return: 具有单调性的编码规则 - def fit(self, df):...
Implement the Python class `FeatureSelectionByMonotonicityRule` described below. Class description: 功能:整理评分卡应用的特征单调性筛选输入数据 输入:整理的分箱编码数据集 df 控制:保留特征列表 keep_columns_list 输出:过滤后特征数据集 Method signatures and docstrings: - def _filter_data(self, df): 保留具有单调性的变量 :param df: 带单调性判断的编码规则 :return: 具有单调性的编码规则 - def fit(self, df):...
47c95814d2bfcaf1f30cb892db0d09c8c88901e7
<|skeleton|> class FeatureSelectionByMonotonicityRule: """功能:整理评分卡应用的特征单调性筛选输入数据 输入:整理的分箱编码数据集 df 控制:保留特征列表 keep_columns_list 输出:过滤后特征数据集""" def _filter_data(self, df): """保留具有单调性的变量 :param df: 带单调性判断的编码规则 :return: 具有单调性的编码规则""" <|body_0|> def fit(self, df): """单调性判断服务 :param df: 单...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FeatureSelectionByMonotonicityRule: """功能:整理评分卡应用的特征单调性筛选输入数据 输入:整理的分箱编码数据集 df 控制:保留特征列表 keep_columns_list 输出:过滤后特征数据集""" def _filter_data(self, df): """保留具有单调性的变量 :param df: 带单调性判断的编码规则 :return: 具有单调性的编码规则""" df = df.reset_index(drop=True) for i in range(len(df)): fea...
the_stack_v2_python_sparse
mldesigntoolkit/mldesigntoolkit/modules/feature_engineering/_feature_select.py
Stormzqz/py
train
0
77fe400c5078ab9f6cdd076d6c73ef6d561029ef
[ "if isinstance(key, int):\n return MPTCPOption(key)\nif key not in MPTCPOption._member_map_:\n return extend_enum(MPTCPOption, key, default)\nreturn MPTCPOption[key]", "if not (isinstance(value, int) and 0 <= value <= 255):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 9 <= value...
<|body_start_0|> if isinstance(key, int): return MPTCPOption(key) if key not in MPTCPOption._member_map_: return extend_enum(MPTCPOption, key, default) return MPTCPOption[key] <|end_body_0|> <|body_start_1|> if not (isinstance(value, int) and 0 <= value <= 255): ...
[MPTCPOption] Multipath TCP options [:rfc:`6824`]
MPTCPOption
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MPTCPOption: """[MPTCPOption] Multipath TCP options [:rfc:`6824`]""" def get(key: 'int | str', default: 'int'=-1) -> 'MPTCPOption': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_020925
2,275
permissive
[ { "docstring": "Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:", "name": "get", "signature": "def get(key: 'int | str', default: 'int'=-1) -> 'MPTCPOption'" }, { "docstring": "Lookup function used when value is not found....
2
null
Implement the Python class `MPTCPOption` described below. Class description: [MPTCPOption] Multipath TCP options [:rfc:`6824`] Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'MPTCPOption': Backport support for original codes. Args: key: Key to get enum item. default: Default value...
Implement the Python class `MPTCPOption` described below. Class description: [MPTCPOption] Multipath TCP options [:rfc:`6824`] Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'MPTCPOption': Backport support for original codes. Args: key: Key to get enum item. default: Default value...
a6fe49ec58f09e105bec5a00fb66d9b3f22730d9
<|skeleton|> class MPTCPOption: """[MPTCPOption] Multipath TCP options [:rfc:`6824`]""" def get(key: 'int | str', default: 'int'=-1) -> 'MPTCPOption': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MPTCPOption: """[MPTCPOption] Multipath TCP options [:rfc:`6824`]""" def get(key: 'int | str', default: 'int'=-1) -> 'MPTCPOption': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" if isinstance(key, int): ...
the_stack_v2_python_sparse
pcapkit/const/tcp/mp_tcp_option.py
JarryShaw/PyPCAPKit
train
204
ad9e716393b8df9ef1396fb0b04c3bcb39c6b415
[ "if isinstance(queue_rq, STRING_TYPES):\n jobqueue = JobQueue.query.filter_by(name=queue_rq).first()\nelse:\n jobqueue = JobQueue.query.filter_by(id=queue_rq).first()\nif not jobqueue:\n return (jsonify(error='Requested job queue %r not found' % queue_rq), NOT_FOUND)\nreturn (jsonify(jobqueue.to_dict()), O...
<|body_start_0|> if isinstance(queue_rq, STRING_TYPES): jobqueue = JobQueue.query.filter_by(name=queue_rq).first() else: jobqueue = JobQueue.query.filter_by(id=queue_rq).first() if not jobqueue: return (jsonify(error='Requested job queue %r not found' % queue_...
SingleJobQueueAPI
[ "BSD-3-Clause", "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SingleJobQueueAPI: def get(self, queue_rq): """A ``GET`` to this endpoint will return the requested job queue .. http:get:: /api/v1/jobqueues/[<str:name>|<int:id>] HTTP/1.1 **Request** .. sourcecode:: http GET /api/v1/jobqueues/Test%20Queue HTTP/1.1 Accept: application/json **Response** ...
stack_v2_sparse_classes_36k_train_020926
11,392
permissive
[ { "docstring": "A ``GET`` to this endpoint will return the requested job queue .. http:get:: /api/v1/jobqueues/[<str:name>|<int:id>] HTTP/1.1 **Request** .. sourcecode:: http GET /api/v1/jobqueues/Test%20Queue HTTP/1.1 Accept: application/json **Response** .. sourcecode:: http HTTP/1.1 200 OK Content-Type: appl...
3
stack_v2_sparse_classes_30k_train_000618
Implement the Python class `SingleJobQueueAPI` described below. Class description: Implement the SingleJobQueueAPI class. Method signatures and docstrings: - def get(self, queue_rq): A ``GET`` to this endpoint will return the requested job queue .. http:get:: /api/v1/jobqueues/[<str:name>|<int:id>] HTTP/1.1 **Request...
Implement the Python class `SingleJobQueueAPI` described below. Class description: Implement the SingleJobQueueAPI class. Method signatures and docstrings: - def get(self, queue_rq): A ``GET`` to this endpoint will return the requested job queue .. http:get:: /api/v1/jobqueues/[<str:name>|<int:id>] HTTP/1.1 **Request...
ea04bbcb807eb669415c569417b4b1b68e75d29d
<|skeleton|> class SingleJobQueueAPI: def get(self, queue_rq): """A ``GET`` to this endpoint will return the requested job queue .. http:get:: /api/v1/jobqueues/[<str:name>|<int:id>] HTTP/1.1 **Request** .. sourcecode:: http GET /api/v1/jobqueues/Test%20Queue HTTP/1.1 Accept: application/json **Response** ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SingleJobQueueAPI: def get(self, queue_rq): """A ``GET`` to this endpoint will return the requested job queue .. http:get:: /api/v1/jobqueues/[<str:name>|<int:id>] HTTP/1.1 **Request** .. sourcecode:: http GET /api/v1/jobqueues/Test%20Queue HTTP/1.1 Accept: application/json **Response** .. sourcecode:...
the_stack_v2_python_sparse
pyfarm/master/api/jobqueues.py
pyfarm/pyfarm-master
train
2
98a313f2c66063b91b0ebb911eda2c0709d19f57
[ "if head == None or head.next == None:\n return head\nnewHead = None\nwhile head != None:\n temp = head.next\n head.next = newHead\n newHead = head\n head = temp\nreturn newHead", "cur, prev = (head, None)\nwhile cur:\n cur.next, prev, cur = (prev, cur, cur.next)\nreturn prev" ]
<|body_start_0|> if head == None or head.next == None: return head newHead = None while head != None: temp = head.next head.next = newHead newHead = head head = temp return newHead <|end_body_0|> <|body_start_1|> cur, p...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def reverseList1(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if head == None or head.next == None...
stack_v2_sparse_classes_36k_train_020927
2,178
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "reverseList", "signature": "def reverseList(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "reverseList1", "signature": "def reverseList1(self, head)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): :type head: ListNode :rtype: ListNode - def reverseList1(self, head): :type head: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): :type head: ListNode :rtype: ListNode - def reverseList1(self, head): :type head: ListNode :rtype: ListNode <|skeleton|> class Solution: def re...
1379a6dc2400751ecf79ccd6ed401a1fb0d78046
<|skeleton|> class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def reverseList1(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" if head == None or head.next == None: return head newHead = None while head != None: temp = head.next head.next = newHead newHead = head ...
the_stack_v2_python_sparse
Python3.6/206-Py3-E-Reverse Linked List.py
Hidenver2016/Leetcode
train
1
3be89f3d288f881ea6ccf1fe7a8ed0060398c25b
[ "with open(path, encoding='cp437') as f:\n raw_data = f.read().splitlines()\n self.detectors = raw_data[detector_row].split('\\t')[data_columns]\n self.bias = np.array(raw_data[bias_row].split('\\t')[data_columns]).astype(float)\n self.calibration = np.array(raw_data[calibration_row].split('\\t')[data_c...
<|body_start_0|> with open(path, encoding='cp437') as f: raw_data = f.read().splitlines() self.detectors = raw_data[detector_row].split('\t')[data_columns] self.bias = np.array(raw_data[bias_row].split('\t')[data_columns]).astype(float) self.calibration = np.array...
Load a file from a Sun Nuclear Profiler device. This accepts .prs files.
SNCProfiler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SNCProfiler: """Load a file from a Sun Nuclear Profiler device. This accepts .prs files.""" def __init__(self, path: str, gain_row: int=20, detector_row: int=106, bias_row: int=107, calibration_row: int=108, data_row: int=-1, data_columns: slice=slice(5, 259)): """Parameters --------...
stack_v2_sparse_classes_36k_train_020928
9,453
permissive
[ { "docstring": "Parameters ---------- path : str Path to the .prs file. detector_row bias_row calibration_row data_row data_columns The range of columns that the data is in. Usually, there are some columns before and after the real data.", "name": "__init__", "signature": "def __init__(self, path: str, ...
2
stack_v2_sparse_classes_30k_train_020437
Implement the Python class `SNCProfiler` described below. Class description: Load a file from a Sun Nuclear Profiler device. This accepts .prs files. Method signatures and docstrings: - def __init__(self, path: str, gain_row: int=20, detector_row: int=106, bias_row: int=107, calibration_row: int=108, data_row: int=-1...
Implement the Python class `SNCProfiler` described below. Class description: Load a file from a Sun Nuclear Profiler device. This accepts .prs files. Method signatures and docstrings: - def __init__(self, path: str, gain_row: int=20, detector_row: int=106, bias_row: int=107, calibration_row: int=108, data_row: int=-1...
5c2cfe971f2f6a8d27b0d81159e0f1bacba007b8
<|skeleton|> class SNCProfiler: """Load a file from a Sun Nuclear Profiler device. This accepts .prs files.""" def __init__(self, path: str, gain_row: int=20, detector_row: int=106, bias_row: int=107, calibration_row: int=108, data_row: int=-1, data_columns: slice=slice(5, 259)): """Parameters --------...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SNCProfiler: """Load a file from a Sun Nuclear Profiler device. This accepts .prs files.""" def __init__(self, path: str, gain_row: int=20, detector_row: int=106, bias_row: int=107, calibration_row: int=108, data_row: int=-1, data_columns: slice=slice(5, 259)): """Parameters ---------- path : str...
the_stack_v2_python_sparse
pylinac/core/io.py
jrkerns/pylinac
train
129
2cd423217af03d8b8edbc873ca1d4edf26eac669
[ "self.name = name\nself.description = description\nself.statement_descriptor = statement_descriptor\nself.items = items\nself.shippable = shippable\nself.payment_methods = payment_methods\nself.installments = installments\nself.currency = currency\nself.interval = interval\nself.interval_count = interval_count\nsel...
<|body_start_0|> self.name = name self.description = description self.statement_descriptor = statement_descriptor self.items = items self.shippable = shippable self.payment_methods = payment_methods self.installments = installments self.currency = currency...
Implementation of the 'CreatePlanRequest' model. Request for creating a plan Attributes: name (string): Plan's name description (string): Description statement_descriptor (string): Text that will be printed on the credit card's statement items (list of CreatePlanItemRequest): Plan items shippable (bool): Indicates if t...
CreatePlanRequest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreatePlanRequest: """Implementation of the 'CreatePlanRequest' model. Request for creating a plan Attributes: name (string): Plan's name description (string): Description statement_descriptor (string): Text that will be printed on the credit card's statement items (list of CreatePlanItemRequest)...
stack_v2_sparse_classes_36k_train_020929
6,468
permissive
[ { "docstring": "Constructor for the CreatePlanRequest class", "name": "__init__", "signature": "def __init__(self, name=None, description=None, statement_descriptor=None, items=None, shippable=None, payment_methods=None, installments=None, currency=None, interval=None, interval_count=None, billing_days=...
2
null
Implement the Python class `CreatePlanRequest` described below. Class description: Implementation of the 'CreatePlanRequest' model. Request for creating a plan Attributes: name (string): Plan's name description (string): Description statement_descriptor (string): Text that will be printed on the credit card's statemen...
Implement the Python class `CreatePlanRequest` described below. Class description: Implementation of the 'CreatePlanRequest' model. Request for creating a plan Attributes: name (string): Plan's name description (string): Description statement_descriptor (string): Text that will be printed on the credit card's statemen...
95c80c35dd57bb2a238faeaf30d1e3b4544d2298
<|skeleton|> class CreatePlanRequest: """Implementation of the 'CreatePlanRequest' model. Request for creating a plan Attributes: name (string): Plan's name description (string): Description statement_descriptor (string): Text that will be printed on the credit card's statement items (list of CreatePlanItemRequest)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CreatePlanRequest: """Implementation of the 'CreatePlanRequest' model. Request for creating a plan Attributes: name (string): Plan's name description (string): Description statement_descriptor (string): Text that will be printed on the credit card's statement items (list of CreatePlanItemRequest): Plan items ...
the_stack_v2_python_sparse
mundiapi/models/create_plan_request.py
mundipagg/MundiAPI-PYTHON
train
10
5a1813cb35ad501e5e775fd3f6742d4995fcecf8
[ "super(SkipGram, self).__init__()\nself.vocab_size = vocab_size\nself.emb_dimension = emb_dimension\nself.c_emb = nn.Embedding(vocab_size, emb_dimension, embedding_table=Uniform(0.5 / emb_dimension))\nself.n_emb = nn.Embedding(vocab_size, emb_dimension, embedding_table=Uniform(0))\nself.mul = ops.Mul()\nself.sum = ...
<|body_start_0|> super(SkipGram, self).__init__() self.vocab_size = vocab_size self.emb_dimension = emb_dimension self.c_emb = nn.Embedding(vocab_size, emb_dimension, embedding_table=Uniform(0.5 / emb_dimension)) self.n_emb = nn.Embedding(vocab_size, emb_dimension, embedding_tabl...
Skip gram model of word2vec. Attributes: vocab_size: Vocabulary size. emb_dimension: Embedding dimension. c_emb: Embedding for center word. n_emb: Embedding for neighbor word.
SkipGram
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SkipGram: """Skip gram model of word2vec. Attributes: vocab_size: Vocabulary size. emb_dimension: Embedding dimension. c_emb: Embedding for center word. n_emb: Embedding for neighbor word.""" def __init__(self, vocab_size, emb_dimension): """Initialize model parameters. Apply for two...
stack_v2_sparse_classes_36k_train_020930
3,900
permissive
[ { "docstring": "Initialize model parameters. Apply for two embedding layers. Initialize layer weight. Args: vocab_size: Vocabulary size. emb_dimension: Embedding dimension. Returns: None", "name": "__init__", "signature": "def __init__(self, vocab_size, emb_dimension)" }, { "docstring": "Forward...
3
stack_v2_sparse_classes_30k_train_009627
Implement the Python class `SkipGram` described below. Class description: Skip gram model of word2vec. Attributes: vocab_size: Vocabulary size. emb_dimension: Embedding dimension. c_emb: Embedding for center word. n_emb: Embedding for neighbor word. Method signatures and docstrings: - def __init__(self, vocab_size, e...
Implement the Python class `SkipGram` described below. Class description: Skip gram model of word2vec. Attributes: vocab_size: Vocabulary size. emb_dimension: Embedding dimension. c_emb: Embedding for center word. n_emb: Embedding for neighbor word. Method signatures and docstrings: - def __init__(self, vocab_size, e...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class SkipGram: """Skip gram model of word2vec. Attributes: vocab_size: Vocabulary size. emb_dimension: Embedding dimension. c_emb: Embedding for center word. n_emb: Embedding for neighbor word.""" def __init__(self, vocab_size, emb_dimension): """Initialize model parameters. Apply for two...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SkipGram: """Skip gram model of word2vec. Attributes: vocab_size: Vocabulary size. emb_dimension: Embedding dimension. c_emb: Embedding for center word. n_emb: Embedding for neighbor word.""" def __init__(self, vocab_size, emb_dimension): """Initialize model parameters. Apply for two embedding la...
the_stack_v2_python_sparse
research/nlp/skipgram/src/skipgram.py
mindspore-ai/models
train
301
393ef2139f74724982f8e72afb06fedb139bc048
[ "queryset = queryset.annotate(parts_manufactured=SubqueryCount('manufactured_parts'))\nqueryset = queryset.annotate(parts_supplied=SubqueryCount('supplied_parts'))\nreturn queryset", "super().save()\ncompany = self.instance\nremote_img = getattr(self, 'remote_image_file', None)\nif remote_img and company:\n fm...
<|body_start_0|> queryset = queryset.annotate(parts_manufactured=SubqueryCount('manufactured_parts')) queryset = queryset.annotate(parts_supplied=SubqueryCount('supplied_parts')) return queryset <|end_body_0|> <|body_start_1|> super().save() company = self.instance remot...
Serializer for Company object (full detail)
CompanySerializer
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompanySerializer: """Serializer for Company object (full detail)""" def annotate_queryset(queryset): """Annoate the supplied queryset with aggregated information""" <|body_0|> def save(self): """Save the Company instance""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_020931
11,419
permissive
[ { "docstring": "Annoate the supplied queryset with aggregated information", "name": "annotate_queryset", "signature": "def annotate_queryset(queryset)" }, { "docstring": "Save the Company instance", "name": "save", "signature": "def save(self)" } ]
2
null
Implement the Python class `CompanySerializer` described below. Class description: Serializer for Company object (full detail) Method signatures and docstrings: - def annotate_queryset(queryset): Annoate the supplied queryset with aggregated information - def save(self): Save the Company instance
Implement the Python class `CompanySerializer` described below. Class description: Serializer for Company object (full detail) Method signatures and docstrings: - def annotate_queryset(queryset): Annoate the supplied queryset with aggregated information - def save(self): Save the Company instance <|skeleton|> class ...
5a08ef908dd5344b4433436a4679d122f7f99e41
<|skeleton|> class CompanySerializer: """Serializer for Company object (full detail)""" def annotate_queryset(queryset): """Annoate the supplied queryset with aggregated information""" <|body_0|> def save(self): """Save the Company instance""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CompanySerializer: """Serializer for Company object (full detail)""" def annotate_queryset(queryset): """Annoate the supplied queryset with aggregated information""" queryset = queryset.annotate(parts_manufactured=SubqueryCount('manufactured_parts')) queryset = queryset.annotate(p...
the_stack_v2_python_sparse
InvenTree/company/serializers.py
onurtatli/InvenTree
train
0
c76dc4f3c93d23a5a734b0ddd74ea7bc57b7cb59
[ "subsets = self.subsets(nums)\nresult = []\nfor subset in subsets:\n sorted_subset = sorted(subset)\n if sorted_subset not in result:\n result.append(sorted_subset)\nreturn result", "length_of_nums = len(nums)\nnumber_of_subarrays = 2 ** length_of_nums\nresult = []\nfor i in range(0, number_of_subarr...
<|body_start_0|> subsets = self.subsets(nums) result = [] for subset in subsets: sorted_subset = sorted(subset) if sorted_subset not in result: result.append(sorted_subset) return result <|end_body_0|> <|body_start_1|> length_of_nums = len...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subsetsWithDup(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def subsets(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> subsets = self.subsets...
stack_v2_sparse_classes_36k_train_020932
1,223
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "subsetsWithDup", "signature": "def subsetsWithDup(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "subsets", "signature": "def subsets(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_013155
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsetsWithDup(self, nums): :type nums: List[int] :rtype: List[List[int]] - def subsets(self, nums): :type nums: List[int] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsetsWithDup(self, nums): :type nums: List[int] :rtype: List[List[int]] - def subsets(self, nums): :type nums: List[int] :rtype: List[List[int]] <|skeleton|> class Solutio...
fcf6c3d5d60d13706950247d8a2327adc5faf17e
<|skeleton|> class Solution: def subsetsWithDup(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def subsets(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def subsetsWithDup(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" subsets = self.subsets(nums) result = [] for subset in subsets: sorted_subset = sorted(subset) if sorted_subset not in result: result.append(sor...
the_stack_v2_python_sparse
Medium/Subsets2.py
mangalagb/Leetcode
train
0
e17b2b5f2d3f9991b3e1554ed00acdc34006f18c
[ "body = self.data['body']\nraw = striptags(body)\nif len(raw) < ContentForm.BODY_LENGTH_MIN:\n raise forms_.ValidationError(_('Your text must be at least {} characters long.').format(ContentForm.BODY_LENGTH_MIN))\nreturn body", "title = self.data['title']\nif len(title) < ContentForm.TITLE_LENGTH_MIN:\n rai...
<|body_start_0|> body = self.data['body'] raw = striptags(body) if len(raw) < ContentForm.BODY_LENGTH_MIN: raise forms_.ValidationError(_('Your text must be at least {} characters long.').format(ContentForm.BODY_LENGTH_MIN)) return body <|end_body_0|> <|body_start_1|> ...
Formulaire de contenu
ContentForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContentForm: """Formulaire de contenu""" def clean_body(self): """Valider et traiter le champ de texte""" <|body_0|> def clean_title(self): """Valider et traiter le champ de titre""" <|body_1|> <|end_skeleton|> <|body_start_0|> body = self.data[...
stack_v2_sparse_classes_36k_train_020933
2,989
no_license
[ { "docstring": "Valider et traiter le champ de texte", "name": "clean_body", "signature": "def clean_body(self)" }, { "docstring": "Valider et traiter le champ de titre", "name": "clean_title", "signature": "def clean_title(self)" } ]
2
null
Implement the Python class `ContentForm` described below. Class description: Formulaire de contenu Method signatures and docstrings: - def clean_body(self): Valider et traiter le champ de texte - def clean_title(self): Valider et traiter le champ de titre
Implement the Python class `ContentForm` described below. Class description: Formulaire de contenu Method signatures and docstrings: - def clean_body(self): Valider et traiter le champ de texte - def clean_title(self): Valider et traiter le champ de titre <|skeleton|> class ContentForm: """Formulaire de contenu"...
8cef6f6e89c1990e2b25f83e54e0c3481d83b6d7
<|skeleton|> class ContentForm: """Formulaire de contenu""" def clean_body(self): """Valider et traiter le champ de texte""" <|body_0|> def clean_title(self): """Valider et traiter le champ de titre""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ContentForm: """Formulaire de contenu""" def clean_body(self): """Valider et traiter le champ de texte""" body = self.data['body'] raw = striptags(body) if len(raw) < ContentForm.BODY_LENGTH_MIN: raise forms_.ValidationError(_('Your text must be at least {} cha...
the_stack_v2_python_sparse
scoop/content/forms/content.py
artscoop/scoop
train
0
aa5a5b6e36d631cbac9d42a7014a4ed874f2af52
[ "self.D = 2\nself.gamma = gamma\nself.kT = kT\nself.diffusion = kT / gamma\nself.sqrt_2diffusion = np.sqrt(2 * self.diffusion)\nself.sigma = np.sqrt(2 * gamma * kT)\nself.lattice0type = lattice0type\nself.N_width = N_width\nself.N_height = N_height\nself.M_width = M_width\nself.M_height = M_height\nself.M_link1 = i...
<|body_start_0|> self.D = 2 self.gamma = gamma self.kT = kT self.diffusion = kT / gamma self.sqrt_2diffusion = np.sqrt(2 * self.diffusion) self.sigma = np.sqrt(2 * gamma * kT) self.lattice0type = lattice0type self.N_width = N_width self.N_height = ...
a thermal chain of bonded particles that has identical brownian particles inputs: N - #particles gamma - drag coefficient kT - temprature Larc0 - initial arc length chain0type - choose from: -straight_stretched -triangle_stretched -circle -random zigzag
SquareLattice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SquareLattice: """a thermal chain of bonded particles that has identical brownian particles inputs: N - #particles gamma - drag coefficient kT - temprature Larc0 - initial arc length chain0type - choose from: -straight_stretched -triangle_stretched -circle -random zigzag""" def __init__(self...
stack_v2_sparse_classes_36k_train_020934
11,175
no_license
[ { "docstring": "consider the lattice as a square lattice of L shapes the hanging particles at the top and right are not used to calculate anything M is inside unit cell N is number of unit cells note that this lattice has a redundancy the linking particles are listed two times in self.r and self.f this is to en...
2
stack_v2_sparse_classes_30k_train_014168
Implement the Python class `SquareLattice` described below. Class description: a thermal chain of bonded particles that has identical brownian particles inputs: N - #particles gamma - drag coefficient kT - temprature Larc0 - initial arc length chain0type - choose from: -straight_stretched -triangle_stretched -circle -...
Implement the Python class `SquareLattice` described below. Class description: a thermal chain of bonded particles that has identical brownian particles inputs: N - #particles gamma - drag coefficient kT - temprature Larc0 - initial arc length chain0type - choose from: -straight_stretched -triangle_stretched -circle -...
855b502fea8dd93971f3073944388999c27859db
<|skeleton|> class SquareLattice: """a thermal chain of bonded particles that has identical brownian particles inputs: N - #particles gamma - drag coefficient kT - temprature Larc0 - initial arc length chain0type - choose from: -straight_stretched -triangle_stretched -circle -random zigzag""" def __init__(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SquareLattice: """a thermal chain of bonded particles that has identical brownian particles inputs: N - #particles gamma - drag coefficient kT - temprature Larc0 - initial arc length chain0type - choose from: -straight_stretched -triangle_stretched -circle -random zigzag""" def __init__(self, N_width, N_...
the_stack_v2_python_sparse
2d_md_simulator/Lattice.py
SimonStuij/MDsimulator_python
train
0
0dacc7baba55b27ec3e2f9c84838f7ecdcfbbffc
[ "if host is None:\n try:\n self.host = socket.gethostbyname(socket.gethostname())\n except:\n self.host = '127.0.0.1'\nelse:\n self.host = host\nself.port = port\nself.site_path = site_path\nthreading.Thread.__init__(self)\nself.daemon = True", "os.chdir(self.site_path)\nself.server = TestS...
<|body_start_0|> if host is None: try: self.host = socket.gethostbyname(socket.gethostname()) except: self.host = '127.0.0.1' else: self.host = host self.port = port self.site_path = site_path threading.Thread.__...
WebServer
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WebServer: def __init__(self, site_path, host=None, port=8880): """A single threaded SimpleHTTPServer This creates a daemon thread that sits and listens for web requests the thread stays alive untill the parent thread dies. By default we listen at localhost:8080""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_020935
2,111
permissive
[ { "docstring": "A single threaded SimpleHTTPServer This creates a daemon thread that sits and listens for web requests the thread stays alive untill the parent thread dies. By default we listen at localhost:8080", "name": "__init__", "signature": "def __init__(self, site_path, host=None, port=8880)" }...
2
stack_v2_sparse_classes_30k_train_017292
Implement the Python class `WebServer` described below. Class description: Implement the WebServer class. Method signatures and docstrings: - def __init__(self, site_path, host=None, port=8880): A single threaded SimpleHTTPServer This creates a daemon thread that sits and listens for web requests the thread stays ali...
Implement the Python class `WebServer` described below. Class description: Implement the WebServer class. Method signatures and docstrings: - def __init__(self, site_path, host=None, port=8880): A single threaded SimpleHTTPServer This creates a daemon thread that sits and listens for web requests the thread stays ali...
09b962a7316e142ff917be47502cbfac4aed7ed6
<|skeleton|> class WebServer: def __init__(self, site_path, host=None, port=8880): """A single threaded SimpleHTTPServer This creates a daemon thread that sits and listens for web requests the thread stays alive untill the parent thread dies. By default we listen at localhost:8080""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WebServer: def __init__(self, site_path, host=None, port=8880): """A single threaded SimpleHTTPServer This creates a daemon thread that sits and listens for web requests the thread stays alive untill the parent thread dies. By default we listen at localhost:8080""" if host is None: ...
the_stack_v2_python_sparse
staticpy/web_server.py
toddsifleet/staticpy
train
1
aef0ca8c96df3298026a946d01d61c1f80312bdf
[ "if event is None:\n event = np.ones(np.shape(time))\ntime, event = validate_samples(time, event, n_dim=1, equal_lengths=True)\nif any((t <= 0 for t in time)):\n raise ValueError(\"Entries of parameter 'time' must be positive.\")\nif any((x not in (0, 1) for x in event)):\n raise ValueError(\"Entries of pa...
<|body_start_0|> if event is None: event = np.ones(np.shape(time)) time, event = validate_samples(time, event, n_dim=1, equal_lengths=True) if any((t <= 0 for t in time)): raise ValueError("Entries of parameter 'time' must be positive.") if any((x not in (0, 1) fo...
Non-parametric survival function estimator for right-censored data. Properties ---------- time : numpy.ndarray Vector of observed event times. event : numpy.ndarray Failure indicator (0=right-censored, 1=failure). survival : numpy.ndarray Estimate of the survival function at each observed failure time.
KaplanMeier
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KaplanMeier: """Non-parametric survival function estimator for right-censored data. Properties ---------- time : numpy.ndarray Vector of observed event times. event : numpy.ndarray Failure indicator (0=right-censored, 1=failure). survival : numpy.ndarray Estimate of the survival function at each ...
stack_v2_sparse_classes_36k_train_020936
5,387
permissive
[ { "docstring": "Fit the Kaplan-Meier estimator using Efron's \"redistribution to the right\" algorithm. Parameters ---------- time : array-like, of shape (n,) Vector of observed event times. event : array-like, of shape (n,) Vector of 0's and 1's, 0 indicating a right-censored event, 1 indicating a failure. Ret...
2
stack_v2_sparse_classes_30k_val_001034
Implement the Python class `KaplanMeier` described below. Class description: Non-parametric survival function estimator for right-censored data. Properties ---------- time : numpy.ndarray Vector of observed event times. event : numpy.ndarray Failure indicator (0=right-censored, 1=failure). survival : numpy.ndarray Est...
Implement the Python class `KaplanMeier` described below. Class description: Non-parametric survival function estimator for right-censored data. Properties ---------- time : numpy.ndarray Vector of observed event times. event : numpy.ndarray Failure indicator (0=right-censored, 1=failure). survival : numpy.ndarray Est...
04525b5d6777be3ccdc6ad44e4cbfe24a8875933
<|skeleton|> class KaplanMeier: """Non-parametric survival function estimator for right-censored data. Properties ---------- time : numpy.ndarray Vector of observed event times. event : numpy.ndarray Failure indicator (0=right-censored, 1=failure). survival : numpy.ndarray Estimate of the survival function at each ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KaplanMeier: """Non-parametric survival function estimator for right-censored data. Properties ---------- time : numpy.ndarray Vector of observed event times. event : numpy.ndarray Failure indicator (0=right-censored, 1=failure). survival : numpy.ndarray Estimate of the survival function at each observed fail...
the_stack_v2_python_sparse
stattools/survival/kaplan_meier.py
roarkemc/StatTools
train
0
2da750b4b196d236e289d467d04796659b218130
[ "base_directory_glob = f'{self.multihost_base_directory}-*'\nbase_directories = tf.io.gfile.glob(base_directory_glob)\nif self.base_directory not in base_directories:\n return None\ncheckpoints = {}\nfor base_directory in base_directories:\n checkpoint_manager = tf.train.CheckpointManager(tf.train.Checkpoint(...
<|body_start_0|> base_directory_glob = f'{self.multihost_base_directory}-*' base_directories = tf.io.gfile.glob(base_directory_glob) if self.base_directory not in base_directories: return None checkpoints = {} for base_directory in base_directories: checkp...
An subclass of `Checkpoint` that synchronizes between multiple JAX hosts.
QueryMultihostCheckpoint
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QueryMultihostCheckpoint: """An subclass of `Checkpoint` that synchronizes between multiple JAX hosts.""" def get_all_checkpoints_to_restore_from(self): """Returns the latest checkpoint available on all hosts.""" <|body_0|> def restore_from_path(self, state: T, path: str...
stack_v2_sparse_classes_36k_train_020937
7,517
permissive
[ { "docstring": "Returns the latest checkpoint available on all hosts.", "name": "get_all_checkpoints_to_restore_from", "signature": "def get_all_checkpoints_to_restore_from(self)" }, { "docstring": "Restores from a given checkpoint path. Args: state : A flax checkpoint to be stored or to serve a...
2
stack_v2_sparse_classes_30k_train_011134
Implement the Python class `QueryMultihostCheckpoint` described below. Class description: An subclass of `Checkpoint` that synchronizes between multiple JAX hosts. Method signatures and docstrings: - def get_all_checkpoints_to_restore_from(self): Returns the latest checkpoint available on all hosts. - def restore_fro...
Implement the Python class `QueryMultihostCheckpoint` described below. Class description: An subclass of `Checkpoint` that synchronizes between multiple JAX hosts. Method signatures and docstrings: - def get_all_checkpoints_to_restore_from(self): Returns the latest checkpoint available on all hosts. - def restore_fro...
1ed54e21f889775cf9e78ff736f804472c9b4337
<|skeleton|> class QueryMultihostCheckpoint: """An subclass of `Checkpoint` that synchronizes between multiple JAX hosts.""" def get_all_checkpoints_to_restore_from(self): """Returns the latest checkpoint available on all hosts.""" <|body_0|> def restore_from_path(self, state: T, path: str...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QueryMultihostCheckpoint: """An subclass of `Checkpoint` that synchronizes between multiple JAX hosts.""" def get_all_checkpoints_to_restore_from(self): """Returns the latest checkpoint available on all hosts.""" base_directory_glob = f'{self.multihost_base_directory}-*' base_dire...
the_stack_v2_python_sparse
xmcgan/utils/task_manager.py
jiny419/xmcgan_image_generation
train
0
5641100448b83aa4f90dad9abb3732bc7bbdf896
[ "data = request.data\nserializer = self.serializer_class(data=data)\nserializer.is_valid(raise_exception=True)\nuser = serializer.validated_data['user']\ntoken = AuthToken.objects.create(user)\nlogin(request, user)\nprefixes = prefix_service.find(user=user).all()\nif len(prefixes) == 1:\n user.profile.product_ac...
<|body_start_0|> data = request.data serializer = self.serializer_class(data=data) serializer.is_valid(raise_exception=True) user = serializer.validated_data['user'] token = AuthToken.objects.create(user) login(request, user) prefixes = prefix_service.find(user=us...
UserLoginView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserLoginView: def post(self, request, *args, **kwargs): """logs in the user""" <|body_0|> def get(self, request): """validates if user is still logged in, in which case returns app token""" <|body_1|> <|end_skeleton|> <|body_start_0|> data = reques...
stack_v2_sparse_classes_36k_train_020938
11,433
no_license
[ { "docstring": "logs in the user", "name": "post", "signature": "def post(self, request, *args, **kwargs)" }, { "docstring": "validates if user is still logged in, in which case returns app token", "name": "get", "signature": "def get(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_018848
Implement the Python class `UserLoginView` described below. Class description: Implement the UserLoginView class. Method signatures and docstrings: - def post(self, request, *args, **kwargs): logs in the user - def get(self, request): validates if user is still logged in, in which case returns app token
Implement the Python class `UserLoginView` described below. Class description: Implement the UserLoginView class. Method signatures and docstrings: - def post(self, request, *args, **kwargs): logs in the user - def get(self, request): validates if user is still logged in, in which case returns app token <|skeleton|>...
338fd6396dbdce971bc542718fbb9608bdcfc2a7
<|skeleton|> class UserLoginView: def post(self, request, *args, **kwargs): """logs in the user""" <|body_0|> def get(self, request): """validates if user is still logged in, in which case returns app token""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserLoginView: def post(self, request, *args, **kwargs): """logs in the user""" data = request.data serializer = self.serializer_class(data=data) serializer.is_valid(raise_exception=True) user = serializer.validated_data['user'] token = AuthToken.objects.create(...
the_stack_v2_python_sparse
api/views/account_views.py
sai9912/mypyton
train
0
7176962bd8c5f25a42cdb36b4a53f027e1259760
[ "db.session.add(self)\nif commit is True:\n db.session.commit()", "try:\n code = kwargs['code']\nexcept KeyError:\n code = uuid.uuid4()\nobj = VerificationCodes(verified_user=kwargs['user'], code=code, types=kwargs['types'], status=kwargs['status'], created_by=str(kwargs['user'].id))\ndb.session.add(obj)...
<|body_start_0|> db.session.add(self) if commit is True: db.session.commit() <|end_body_0|> <|body_start_1|> try: code = kwargs['code'] except KeyError: code = uuid.uuid4() obj = VerificationCodes(verified_user=kwargs['user'], code=code, types...
verification codes model
VerificationCodes
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VerificationCodes: """verification codes model""" def save(self, commit=True): """VerificationCodes save method""" <|body_0|> def save_verification_code(**kwargs): """save verification code to db""" <|body_1|> <|end_skeleton|> <|body_start_0|> d...
stack_v2_sparse_classes_36k_train_020939
2,150
no_license
[ { "docstring": "VerificationCodes save method", "name": "save", "signature": "def save(self, commit=True)" }, { "docstring": "save verification code to db", "name": "save_verification_code", "signature": "def save_verification_code(**kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_005953
Implement the Python class `VerificationCodes` described below. Class description: verification codes model Method signatures and docstrings: - def save(self, commit=True): VerificationCodes save method - def save_verification_code(**kwargs): save verification code to db
Implement the Python class `VerificationCodes` described below. Class description: verification codes model Method signatures and docstrings: - def save(self, commit=True): VerificationCodes save method - def save_verification_code(**kwargs): save verification code to db <|skeleton|> class VerificationCodes: """...
4dc5f5e816e3c461b8a60c5f61c7eafc08050579
<|skeleton|> class VerificationCodes: """verification codes model""" def save(self, commit=True): """VerificationCodes save method""" <|body_0|> def save_verification_code(**kwargs): """save verification code to db""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VerificationCodes: """verification codes model""" def save(self, commit=True): """VerificationCodes save method""" db.session.add(self) if commit is True: db.session.commit() def save_verification_code(**kwargs): """save verification code to db""" ...
the_stack_v2_python_sparse
app/models/verification_codes.py
ekramulmostafa/ms-auth
train
0
2bdd5a02f1774029c2134f6488806c0edff5bba9
[ "self.hass = hass\nself.speech = None\nself.card = None\nself.reprompt = None\nself.session_attributes = {}\nself.should_end_session = True\nif intent is not None and 'slots' in intent:\n self.variables = {key: value['value'] for key, value in intent['slots'].items() if 'value' in value}\nelse:\n self.variabl...
<|body_start_0|> self.hass = hass self.speech = None self.card = None self.reprompt = None self.session_attributes = {} self.should_end_session = True if intent is not None and 'slots' in intent: self.variables = {key: value['value'] for key, value in ...
Help generating the response for Alexa.
AlexaResponse
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlexaResponse: """Help generating the response for Alexa.""" def __init__(self, hass, intent=None): """Initialize the response.""" <|body_0|> def add_card(self, card_type, title, content): """Add a card to the response.""" <|body_1|> def add_speech(s...
stack_v2_sparse_classes_36k_train_020940
6,645
permissive
[ { "docstring": "Initialize the response.", "name": "__init__", "signature": "def __init__(self, hass, intent=None)" }, { "docstring": "Add a card to the response.", "name": "add_card", "signature": "def add_card(self, card_type, title, content)" }, { "docstring": "Add speech to t...
5
null
Implement the Python class `AlexaResponse` described below. Class description: Help generating the response for Alexa. Method signatures and docstrings: - def __init__(self, hass, intent=None): Initialize the response. - def add_card(self, card_type, title, content): Add a card to the response. - def add_speech(self,...
Implement the Python class `AlexaResponse` described below. Class description: Help generating the response for Alexa. Method signatures and docstrings: - def __init__(self, hass, intent=None): Initialize the response. - def add_card(self, card_type, title, content): Add a card to the response. - def add_speech(self,...
ca0e92aba83de2fd6cb1cc4d14f3b4471f17cf3d
<|skeleton|> class AlexaResponse: """Help generating the response for Alexa.""" def __init__(self, hass, intent=None): """Initialize the response.""" <|body_0|> def add_card(self, card_type, title, content): """Add a card to the response.""" <|body_1|> def add_speech(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AlexaResponse: """Help generating the response for Alexa.""" def __init__(self, hass, intent=None): """Initialize the response.""" self.hass = hass self.speech = None self.card = None self.reprompt = None self.session_attributes = {} self.should_end...
the_stack_v2_python_sparse
homeassistant/components/alexa.py
Smart-Torvy/torvy-home-assistant
train
2
df88988a47b2ecf8fc7e57e0f507b9bc2d8d86ba
[ "N = len(Profits)\n\ndef dfs(i, k, c):\n if k == 0 or i == N:\n return c\n ret = [dfs(i + 1, k, c)]\n if Capital[i] <= c:\n ret.append(dfs(i + 1, k - 1, c + Profits[i]))\n return max(ret)\nreturn dfs(0, k, W)", "N = len(Profits)\nmemo = {k: W}\ncp = list(sorted(zip(Capital, Profits)))\nf...
<|body_start_0|> N = len(Profits) def dfs(i, k, c): if k == 0 or i == N: return c ret = [dfs(i + 1, k, c)] if Capital[i] <= c: ret.append(dfs(i + 1, k - 1, c + Profits[i])) return max(ret) return dfs(0, k, W) <|end_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMaximizedCapital(self, k: int, W: int, Profits: List[int], Capital: List[int]) -> int: """Nov 01, 2020 12:26""" <|body_0|> def findMaximizedCapital(self, k: int, W: int, Profits: List[int], Capital: List[int]) -> int: """Nov 01, 2020 13:05""" ...
stack_v2_sparse_classes_36k_train_020941
12,781
no_license
[ { "docstring": "Nov 01, 2020 12:26", "name": "findMaximizedCapital", "signature": "def findMaximizedCapital(self, k: int, W: int, Profits: List[int], Capital: List[int]) -> int" }, { "docstring": "Nov 01, 2020 13:05", "name": "findMaximizedCapital", "signature": "def findMaximizedCapital...
4
stack_v2_sparse_classes_30k_train_010827
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaximizedCapital(self, k: int, W: int, Profits: List[int], Capital: List[int]) -> int: Nov 01, 2020 12:26 - def findMaximizedCapital(self, k: int, W: int, Profits: List[i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaximizedCapital(self, k: int, W: int, Profits: List[int], Capital: List[int]) -> int: Nov 01, 2020 12:26 - def findMaximizedCapital(self, k: int, W: int, Profits: List[i...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def findMaximizedCapital(self, k: int, W: int, Profits: List[int], Capital: List[int]) -> int: """Nov 01, 2020 12:26""" <|body_0|> def findMaximizedCapital(self, k: int, W: int, Profits: List[int], Capital: List[int]) -> int: """Nov 01, 2020 13:05""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMaximizedCapital(self, k: int, W: int, Profits: List[int], Capital: List[int]) -> int: """Nov 01, 2020 12:26""" N = len(Profits) def dfs(i, k, c): if k == 0 or i == N: return c ret = [dfs(i + 1, k, c)] if Capital[i]...
the_stack_v2_python_sparse
leetcode/solved/502_IPO/solution.py
sungminoh/algorithms
train
0
467b62c5c6dbd3ff8834c49ebb91a6b8b0e504c7
[ "for k in range(len(self.mset) + 1):\n for comb in Combinations_setk(self.mset, k):\n yield comb", "k = 0\nn = len(self.mset)\nb = binomial(n, k)\nwhile r >= b:\n r -= b\n k += 1\n b = binomial(n, k)\nreturn [self.mset[i] for i in from_rank(r, n, k)]", "x = [self.mset.index(_) for _ in x]\nr ...
<|body_start_0|> for k in range(len(self.mset) + 1): for comb in Combinations_setk(self.mset, k): yield comb <|end_body_0|> <|body_start_1|> k = 0 n = len(self.mset) b = binomial(n, k) while r >= b: r -= b k += 1 b ...
Combinations_set
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Combinations_set: def __iter__(self): """EXAMPLES:: sage: Combinations([1,2,3]).list() #indirect doctest [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]""" <|body_0|> def unrank(self, r): """EXAMPLES:: sage: c = Combinations([1,2,3]) sage: c.list() == map(c.un...
stack_v2_sparse_classes_36k_train_020942
16,000
no_license
[ { "docstring": "EXAMPLES:: sage: Combinations([1,2,3]).list() #indirect doctest [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]", "name": "__iter__", "signature": "def __iter__(self)" }, { "docstring": "EXAMPLES:: sage: c = Combinations([1,2,3]) sage: c.list() == map(c.unrank, range(c.car...
3
stack_v2_sparse_classes_30k_train_004987
Implement the Python class `Combinations_set` described below. Class description: Implement the Combinations_set class. Method signatures and docstrings: - def __iter__(self): EXAMPLES:: sage: Combinations([1,2,3]).list() #indirect doctest [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]] - def unrank(self, r): ...
Implement the Python class `Combinations_set` described below. Class description: Implement the Combinations_set class. Method signatures and docstrings: - def __iter__(self): EXAMPLES:: sage: Combinations([1,2,3]).list() #indirect doctest [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]] - def unrank(self, r): ...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class Combinations_set: def __iter__(self): """EXAMPLES:: sage: Combinations([1,2,3]).list() #indirect doctest [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]""" <|body_0|> def unrank(self, r): """EXAMPLES:: sage: c = Combinations([1,2,3]) sage: c.list() == map(c.un...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Combinations_set: def __iter__(self): """EXAMPLES:: sage: Combinations([1,2,3]).list() #indirect doctest [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]""" for k in range(len(self.mset) + 1): for comb in Combinations_setk(self.mset, k): yield comb def un...
the_stack_v2_python_sparse
sage/src/sage/combinat/combination.py
bopopescu/geosci
train
0
0341adbcc9667e041ccd24776d3d8b1a0d8eb714
[ "super().__init__(**kwargs)\nself.alpha = alpha\nself.gamma = gamma\nself.label_smoothing = label_smoothing", "normalizer, y_true = y\nalpha = tf.convert_to_tensor(self.alpha, dtype=y_pred.dtype)\ngamma = tf.convert_to_tensor(self.gamma, dtype=y_pred.dtype)\npred_prob = tf.sigmoid(y_pred)\np_t = y_true * pred_pro...
<|body_start_0|> super().__init__(**kwargs) self.alpha = alpha self.gamma = gamma self.label_smoothing = label_smoothing <|end_body_0|> <|body_start_1|> normalizer, y_true = y alpha = tf.convert_to_tensor(self.alpha, dtype=y_pred.dtype) gamma = tf.convert_to_tens...
Compute the focal loss between `logits` and the golden `target` values. Focal loss = -(1-pt)^gamma * log(pt) where pt is the probability of being classified to the true class.
FocalLoss
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FocalLoss: """Compute the focal loss between `logits` and the golden `target` values. Focal loss = -(1-pt)^gamma * log(pt) where pt is the probability of being classified to the true class.""" def __init__(self, alpha, gamma, label_smoothing=0.0, **kwargs): """Initialize focal loss. ...
stack_v2_sparse_classes_36k_train_020943
17,443
permissive
[ { "docstring": "Initialize focal loss. Args: alpha: A float32 scalar multiplying alpha to the loss from positive examples and (1-alpha) to the loss from negative examples. gamma: A float32 scalar modulating loss from hard and easy examples. label_smoothing: Float in [0, 1]. If > `0` then smooth the labels. **kw...
2
stack_v2_sparse_classes_30k_train_014787
Implement the Python class `FocalLoss` described below. Class description: Compute the focal loss between `logits` and the golden `target` values. Focal loss = -(1-pt)^gamma * log(pt) where pt is the probability of being classified to the true class. Method signatures and docstrings: - def __init__(self, alpha, gamma...
Implement the Python class `FocalLoss` described below. Class description: Compute the focal loss between `logits` and the golden `target` values. Focal loss = -(1-pt)^gamma * log(pt) where pt is the probability of being classified to the true class. Method signatures and docstrings: - def __init__(self, alpha, gamma...
a5388a45f71a949639b35cc5b990bd130d2d8164
<|skeleton|> class FocalLoss: """Compute the focal loss between `logits` and the golden `target` values. Focal loss = -(1-pt)^gamma * log(pt) where pt is the probability of being classified to the true class.""" def __init__(self, alpha, gamma, label_smoothing=0.0, **kwargs): """Initialize focal loss. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FocalLoss: """Compute the focal loss between `logits` and the golden `target` values. Focal loss = -(1-pt)^gamma * log(pt) where pt is the probability of being classified to the true class.""" def __init__(self, alpha, gamma, label_smoothing=0.0, **kwargs): """Initialize focal loss. Args: alpha: ...
the_stack_v2_python_sparse
TensorFlow2/Detection/Efficientdet/utils/train_lib.py
NVIDIA/DeepLearningExamples
train
11,838
12403df832b5bec19b75176bf1a3d032d8b6564e
[ "if not re.match('\\\\w+@\\\\w+.\\\\w+', email):\n raise serializers.ValidationError('邮箱格式不正确')\nreturn email", "bind_token = attrs['bind_token']\nopenid = OAuthBase.check_save_user_token(bind_token)\nif not openid:\n raise serializers.ValidationError('无效的bind_token')\nattrs['openid'] = openid\nreal_email_c...
<|body_start_0|> if not re.match('\\w+@\\w+.\\w+', email): raise serializers.ValidationError('邮箱格式不正确') return email <|end_body_0|> <|body_start_1|> bind_token = attrs['bind_token'] openid = OAuthBase.check_save_user_token(bind_token) if not openid: raise...
第三方账户绑定的序列化器
OAuthSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OAuthSerializer: """第三方账户绑定的序列化器""" def validate_email(self, email): """验证邮箱格式 :param value: :return:""" <|body_0|> def validate(self, attrs): """验证access_token :param attrs: :return:""" <|body_1|> def create(self, validated_data): """保存用户 :p...
stack_v2_sparse_classes_36k_train_020944
4,280
no_license
[ { "docstring": "验证邮箱格式 :param value: :return:", "name": "validate_email", "signature": "def validate_email(self, email)" }, { "docstring": "验证access_token :param attrs: :return:", "name": "validate", "signature": "def validate(self, attrs)" }, { "docstring": "保存用户 :param validate...
3
stack_v2_sparse_classes_30k_train_015260
Implement the Python class `OAuthSerializer` described below. Class description: 第三方账户绑定的序列化器 Method signatures and docstrings: - def validate_email(self, email): 验证邮箱格式 :param value: :return: - def validate(self, attrs): 验证access_token :param attrs: :return: - def create(self, validated_data): 保存用户 :param validated_...
Implement the Python class `OAuthSerializer` described below. Class description: 第三方账户绑定的序列化器 Method signatures and docstrings: - def validate_email(self, email): 验证邮箱格式 :param value: :return: - def validate(self, attrs): 验证access_token :param attrs: :return: - def create(self, validated_data): 保存用户 :param validated_...
952453482f5eb25bf642a132382801423f35b80c
<|skeleton|> class OAuthSerializer: """第三方账户绑定的序列化器""" def validate_email(self, email): """验证邮箱格式 :param value: :return:""" <|body_0|> def validate(self, attrs): """验证access_token :param attrs: :return:""" <|body_1|> def create(self, validated_data): """保存用户 :p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OAuthSerializer: """第三方账户绑定的序列化器""" def validate_email(self, email): """验证邮箱格式 :param value: :return:""" if not re.match('\\w+@\\w+.\\w+', email): raise serializers.ValidationError('邮箱格式不正确') return email def validate(self, attrs): """验证access_token :param...
the_stack_v2_python_sparse
meiduo_mall/oauth/serializers.py
juehuan182/MeiduoShopping
train
0
dbb50fd1ea93ee7b5d369d25c3eb98016d8c1d5b
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn CalendarSharingMessageAction()", "from .calendar_sharing_action import CalendarSharingAction\nfrom .calendar_sharing_action_importance import CalendarSharingActionImportance\nfrom .calendar_sharing_action_type import CalendarSharingAct...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return CalendarSharingMessageAction() <|end_body_0|> <|body_start_1|> from .calendar_sharing_action import CalendarSharingAction from .calendar_sharing_action_importance import CalendarSharingA...
CalendarSharingMessageAction
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CalendarSharingMessageAction: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarSharingMessageAction: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value...
stack_v2_sparse_classes_36k_train_020945
3,763
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: CalendarSharingMessageAction", "name": "create_from_discriminator_value", "signature": "def create_from_disc...
3
stack_v2_sparse_classes_30k_train_009072
Implement the Python class `CalendarSharingMessageAction` described below. Class description: Implement the CalendarSharingMessageAction class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarSharingMessageAction: Creates a new instance of the a...
Implement the Python class `CalendarSharingMessageAction` described below. Class description: Implement the CalendarSharingMessageAction class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarSharingMessageAction: Creates a new instance of the a...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class CalendarSharingMessageAction: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarSharingMessageAction: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CalendarSharingMessageAction: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarSharingMessageAction: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create th...
the_stack_v2_python_sparse
msgraph/generated/models/calendar_sharing_message_action.py
microsoftgraph/msgraph-sdk-python
train
135
e89f669ef8fc4c950b6a3d70901a9dbfa4b24c0e
[ "dp = [[math.inf] * (N + 1) for _ in range(K + 1)]\nfor i in range(1, K + 1):\n dp[i][0] = 0\n dp[i][1] = 1\nfor j in range(1, N + 1):\n dp[1][j] = j\nfor i in range(2, K + 1):\n for j in range(2, N + 1):\n for k in range(1, j + 1):\n dp[i][j] = min(dp[i][j], 1 + max(dp[i - 1][k - 1], ...
<|body_start_0|> dp = [[math.inf] * (N + 1) for _ in range(K + 1)] for i in range(1, K + 1): dp[i][0] = 0 dp[i][1] = 1 for j in range(1, N + 1): dp[1][j] = j for i in range(2, K + 1): for j in range(2, N + 1): for k in range...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def superEggDrop_solution_1_brute_force(self, K: int, N: int) -> int: """:type K: int :type N: int :rtype: int""" <|body_0|> def superEggDrop_solution_2_optimization_one(self, K: int, N: int) -> int: """:type K: int :type N: int :rtype: int""" <|bod...
stack_v2_sparse_classes_36k_train_020946
7,392
no_license
[ { "docstring": ":type K: int :type N: int :rtype: int", "name": "superEggDrop_solution_1_brute_force", "signature": "def superEggDrop_solution_1_brute_force(self, K: int, N: int) -> int" }, { "docstring": ":type K: int :type N: int :rtype: int", "name": "superEggDrop_solution_2_optimization_...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def superEggDrop_solution_1_brute_force(self, K: int, N: int) -> int: :type K: int :type N: int :rtype: int - def superEggDrop_solution_2_optimization_one(self, K: int, N: int) -...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def superEggDrop_solution_1_brute_force(self, K: int, N: int) -> int: :type K: int :type N: int :rtype: int - def superEggDrop_solution_2_optimization_one(self, K: int, N: int) -...
f2621cd76822a922c49b60f32931f26cce1c571d
<|skeleton|> class Solution: def superEggDrop_solution_1_brute_force(self, K: int, N: int) -> int: """:type K: int :type N: int :rtype: int""" <|body_0|> def superEggDrop_solution_2_optimization_one(self, K: int, N: int) -> int: """:type K: int :type N: int :rtype: int""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def superEggDrop_solution_1_brute_force(self, K: int, N: int) -> int: """:type K: int :type N: int :rtype: int""" dp = [[math.inf] * (N + 1) for _ in range(K + 1)] for i in range(1, K + 1): dp[i][0] = 0 dp[i][1] = 1 for j in range(1, N + 1): ...
the_stack_v2_python_sparse
Dynamic_Programming/019_leetcode_P_887_SuperEggDrop/Solution.py
Keshav1506/competitive_programming
train
0
258fa2d7c5873801c63264e09d57e339eeaa4b37
[ "super().__init__()\nself.in_chans = in_chans\nself.out_chans = out_chans\nself.chans = chans\nself.num_pool_layers = num_pool_layers\nself.drop_prob = drop_prob\nself.down_sample_layers = nn.ModuleList([ConvBlock(in_chans, chans, drop_prob)])\nch = chans\nfor i in range(num_pool_layers - 1):\n self.down_sample_...
<|body_start_0|> super().__init__() self.in_chans = in_chans self.out_chans = out_chans self.chans = chans self.num_pool_layers = num_pool_layers self.drop_prob = drop_prob self.down_sample_layers = nn.ModuleList([ConvBlock(in_chans, chans, drop_prob)]) ch...
PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234–241. Springer, 2015.
UnetModelTakeEverywhereWithIntermediate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnetModelTakeEverywhereWithIntermediate: """PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted ...
stack_v2_sparse_classes_36k_train_020947
30,521
no_license
[ { "docstring": "Args: in_chans (int): Number of channels in the input to the U-Net model. out_chans (int): Number of channels in the output to the U-Net model. chans (int): Number of output channels of the first convolution layer. num_pool_layers (int): Number of down-sampling and up-sampling layers. drop_prob ...
2
stack_v2_sparse_classes_30k_train_002394
Implement the Python class `UnetModelTakeEverywhereWithIntermediate` described below. Class description: PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical...
Implement the Python class `UnetModelTakeEverywhereWithIntermediate` described below. Class description: PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical...
219652c8a08c4f2f682acd9f95a4e1b3fd36b70b
<|skeleton|> class UnetModelTakeEverywhereWithIntermediate: """PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UnetModelTakeEverywhereWithIntermediate: """PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention,...
the_stack_v2_python_sparse
lemawarersn_t1assist/models.py
Bala93/Holistic-MRI-Reconstruction
train
1
e51492f2dd2cad288eff1ca0cc612c448c94d74c
[ "l = [0 for i in range(32)]\nindex = 31\nwhile n != 0:\n l[index] = n % 2\n n = n // 2\n index -= 1\nnumber = 0\nfor i in range(len(l)):\n number += l[i] * 2 ** i\nreturn number", "num = bin(n)[2:]\nnum = str((32 - len(num)) * '0' + num)[::-1]\nreturn int(num, 2)" ]
<|body_start_0|> l = [0 for i in range(32)] index = 31 while n != 0: l[index] = n % 2 n = n // 2 index -= 1 number = 0 for i in range(len(l)): number += l[i] * 2 ** i return number <|end_body_0|> <|body_start_1|> nu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverse_bits(self, n): """Generic Style""" <|body_0|> def reverse_bits2(self, n): """Python Style""" <|body_1|> <|end_skeleton|> <|body_start_0|> l = [0 for i in range(32)] index = 31 while n != 0: l[index] ...
stack_v2_sparse_classes_36k_train_020948
845
no_license
[ { "docstring": "Generic Style", "name": "reverse_bits", "signature": "def reverse_bits(self, n)" }, { "docstring": "Python Style", "name": "reverse_bits2", "signature": "def reverse_bits2(self, n)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse_bits(self, n): Generic Style - def reverse_bits2(self, n): Python Style
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse_bits(self, n): Generic Style - def reverse_bits2(self, n): Python Style <|skeleton|> class Solution: def reverse_bits(self, n): """Generic Style""" ...
b7e92f9a7c4d6652d4901b189f51063ce5520653
<|skeleton|> class Solution: def reverse_bits(self, n): """Generic Style""" <|body_0|> def reverse_bits2(self, n): """Python Style""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverse_bits(self, n): """Generic Style""" l = [0 for i in range(32)] index = 31 while n != 0: l[index] = n % 2 n = n // 2 index -= 1 number = 0 for i in range(len(l)): number += l[i] * 2 ** i ...
the_stack_v2_python_sparse
leetcode/easy/reverse_bits.py
abkunal/Data-Structures-and-Algorithms
train
2
7c95171619985a7770772a094f52bad2824d330c
[ "super().__init__(name, entity_id, CATEGORY_SENSOR, *args, **kwargs)\nself._hass = hass\nself._entity_id = entity_id\nserv_humidity = add_preload_service(self, SERV_HUMIDITY_SENSOR)\nself.char_humidity = serv_humidity.get_characteristic(CHAR_CURRENT_HUMIDITY)\nself.char_humidity.value = 0", "if new_state is None:...
<|body_start_0|> super().__init__(name, entity_id, CATEGORY_SENSOR, *args, **kwargs) self._hass = hass self._entity_id = entity_id serv_humidity = add_preload_service(self, SERV_HUMIDITY_SENSOR) self.char_humidity = serv_humidity.get_characteristic(CHAR_CURRENT_HUMIDITY) ...
Generate a HumiditySensor accessory as humidity sensor.
HumiditySensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HumiditySensor: """Generate a HumiditySensor accessory as humidity sensor.""" def __init__(self, hass, entity_id, name, *args, **kwargs): """Initialize a HumiditySensor accessory object.""" <|body_0|> def update_state(self, entity_id=None, old_state=None, new_state=None)...
stack_v2_sparse_classes_36k_train_020949
3,357
permissive
[ { "docstring": "Initialize a HumiditySensor accessory object.", "name": "__init__", "signature": "def __init__(self, hass, entity_id, name, *args, **kwargs)" }, { "docstring": "Update accessory after state change.", "name": "update_state", "signature": "def update_state(self, entity_id=N...
2
stack_v2_sparse_classes_30k_train_019989
Implement the Python class `HumiditySensor` described below. Class description: Generate a HumiditySensor accessory as humidity sensor. Method signatures and docstrings: - def __init__(self, hass, entity_id, name, *args, **kwargs): Initialize a HumiditySensor accessory object. - def update_state(self, entity_id=None,...
Implement the Python class `HumiditySensor` described below. Class description: Generate a HumiditySensor accessory as humidity sensor. Method signatures and docstrings: - def __init__(self, hass, entity_id, name, *args, **kwargs): Initialize a HumiditySensor accessory object. - def update_state(self, entity_id=None,...
5c4529d044463083bad73cdbf9d17d8cb2b29afa
<|skeleton|> class HumiditySensor: """Generate a HumiditySensor accessory as humidity sensor.""" def __init__(self, hass, entity_id, name, *args, **kwargs): """Initialize a HumiditySensor accessory object.""" <|body_0|> def update_state(self, entity_id=None, old_state=None, new_state=None)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HumiditySensor: """Generate a HumiditySensor accessory as humidity sensor.""" def __init__(self, hass, entity_id, name, *args, **kwargs): """Initialize a HumiditySensor accessory object.""" super().__init__(name, entity_id, CATEGORY_SENSOR, *args, **kwargs) self._hass = hass ...
the_stack_v2_python_sparse
homeassistant/components/homekit/type_sensors.py
simpss/home-assistant
train
1
c44e944c01e3bfd683202eb0be5df3168253293b
[ "l = len(nums1) + len(nums2)\nmid = l // 2\nif l % 2 == 1:\n return self.kth(nums1, nums2, mid)\nelse:\n return (self.kth(nums1, nums2, mid) + self.kth(nums1, nums2, mid - 1)) / 2", "if len(A) > len(B):\n A, B = (B, A)\nif not A:\n return B[k]\nif k == len(A) + len(B) - 1:\n return max(A[-1], B[-1]...
<|body_start_0|> l = len(nums1) + len(nums2) mid = l // 2 if l % 2 == 1: return self.kth(nums1, nums2, mid) else: return (self.kth(nums1, nums2, mid) + self.kth(nums1, nums2, mid - 1)) / 2 <|end_body_0|> <|body_start_1|> if len(A) > len(B): A,...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1, nums2) -> float: """median of even len is at mid = even // 2 median of odd len is the average of (mid - 1) and mid elements""" <|body_0|> def kth(self, A, B, k): """find the kth element of two sorted array only for mi...
stack_v2_sparse_classes_36k_train_020950
1,620
no_license
[ { "docstring": "median of even len is at mid = even // 2 median of odd len is the average of (mid - 1) and mid elements", "name": "findMedianSortedArrays", "signature": "def findMedianSortedArrays(self, nums1, nums2) -> float" }, { "docstring": "find the kth element of two sorted array only for ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1, nums2) -> float: median of even len is at mid = even // 2 median of odd len is the average of (mid - 1) and mid elements - def kth(self, A...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1, nums2) -> float: median of even len is at mid = even // 2 median of odd len is the average of (mid - 1) and mid elements - def kth(self, A...
3736bf8d082c8b5f92f88b09eef5060b3c6c46cb
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1, nums2) -> float: """median of even len is at mid = even // 2 median of odd len is the average of (mid - 1) and mid elements""" <|body_0|> def kth(self, A, B, k): """find the kth element of two sorted array only for mi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMedianSortedArrays(self, nums1, nums2) -> float: """median of even len is at mid = even // 2 median of odd len is the average of (mid - 1) and mid elements""" l = len(nums1) + len(nums2) mid = l // 2 if l % 2 == 1: return self.kth(nums1, nums2, mid...
the_stack_v2_python_sparse
BinarySearch/MedianofTwoSortedArrays.py
JieFrye/leetcode
train
1
16281d1b69f59ea377fe24472bf6017853af13c8
[ "super(_PyramidPoolingModule, self).__init__()\nself.features = []\nfor s in setting:\n self.features.append(nn.Sequential(nn.AdaptiveAvgPool2d(s), nn.Conv2d(in_dim, reduction_dim, kernel_size=1, bias=False), nn.BatchNorm2d(reduction_dim, momentum=0.95), nn.ReLU(inplace=True)))\nself.features = nn.ModuleList(sel...
<|body_start_0|> super(_PyramidPoolingModule, self).__init__() self.features = [] for s in setting: self.features.append(nn.Sequential(nn.AdaptiveAvgPool2d(s), nn.Conv2d(in_dim, reduction_dim, kernel_size=1, bias=False), nn.BatchNorm2d(reduction_dim, momentum=0.95), nn.ReLU(inplace=T...
Creates a pyramid pooling module
_PyramidPoolingModule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _PyramidPoolingModule: """Creates a pyramid pooling module""" def __init__(self, in_dim, reduction_dim, setting): """Initializes the pyramid pooling module""" <|body_0|> def forward(self, x): """Computes a forward pass through the network. Parameters ---------- x...
stack_v2_sparse_classes_36k_train_020951
4,011
no_license
[ { "docstring": "Initializes the pyramid pooling module", "name": "__init__", "signature": "def __init__(self, in_dim, reduction_dim, setting)" }, { "docstring": "Computes a forward pass through the network. Parameters ---------- x : torch.Tensor Input features Returns: torch.Tensor Output featur...
2
stack_v2_sparse_classes_30k_train_018806
Implement the Python class `_PyramidPoolingModule` described below. Class description: Creates a pyramid pooling module Method signatures and docstrings: - def __init__(self, in_dim, reduction_dim, setting): Initializes the pyramid pooling module - def forward(self, x): Computes a forward pass through the network. Pa...
Implement the Python class `_PyramidPoolingModule` described below. Class description: Creates a pyramid pooling module Method signatures and docstrings: - def __init__(self, in_dim, reduction_dim, setting): Initializes the pyramid pooling module - def forward(self, x): Computes a forward pass through the network. Pa...
d833bc755cf10b16cc09038aae682387a1d1d936
<|skeleton|> class _PyramidPoolingModule: """Creates a pyramid pooling module""" def __init__(self, in_dim, reduction_dim, setting): """Initializes the pyramid pooling module""" <|body_0|> def forward(self, x): """Computes a forward pass through the network. Parameters ---------- x...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _PyramidPoolingModule: """Creates a pyramid pooling module""" def __init__(self, in_dim, reduction_dim, setting): """Initializes the pyramid pooling module""" super(_PyramidPoolingModule, self).__init__() self.features = [] for s in setting: self.features.appen...
the_stack_v2_python_sparse
core/models/backbone/pspnet.py
mhashas/Temples-Classifier
train
0
af99f48e1b0f91b83035567f88a474f33dc09e7b
[ "self.resource_name = str_id\nCDevice.__init__(self, self.resource_name)\nself.obj_parent = obj_device\nself.set_logger(self.obj_parent.obj_logger)\nself.set_rest_agent(self.obj_parent.obj_rest_agent)\nself.str_device_type = self.obj_parent.str_device_type\nself.uri = '{}/{}'.format(self.obj_parent.uri, self.resour...
<|body_start_0|> self.resource_name = str_id CDevice.__init__(self, self.resource_name) self.obj_parent = obj_device self.set_logger(self.obj_parent.obj_logger) self.set_rest_agent(self.obj_parent.obj_rest_agent) self.str_device_type = self.obj_parent.str_device_type ...
CSku
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CSku: def __init__(self, obj_device, str_id): """@param obj_device: Parent device that init this one @type obj_device: CDevice @param str_id: id of this SKU @type str_id: string""" <|body_0|> def update(self): """Update monorail data of self""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_020952
2,803
no_license
[ { "docstring": "@param obj_device: Parent device that init this one @type obj_device: CDevice @param str_id: id of this SKU @type str_id: string", "name": "__init__", "signature": "def __init__(self, obj_device, str_id)" }, { "docstring": "Update monorail data of self", "name": "update", ...
4
stack_v2_sparse_classes_30k_train_002874
Implement the Python class `CSku` described below. Class description: Implement the CSku class. Method signatures and docstrings: - def __init__(self, obj_device, str_id): @param obj_device: Parent device that init this one @type obj_device: CDevice @param str_id: id of this SKU @type str_id: string - def update(self...
Implement the Python class `CSku` described below. Class description: Implement the CSku class. Method signatures and docstrings: - def __init__(self, obj_device, str_id): @param obj_device: Parent device that init this one @type obj_device: CDevice @param str_id: id of this SKU @type str_id: string - def update(self...
8290fc0ccbde0a6a7d8784aec04c88cc325cfa4c
<|skeleton|> class CSku: def __init__(self, obj_device, str_id): """@param obj_device: Parent device that init this one @type obj_device: CDevice @param str_id: id of this SKU @type str_id: string""" <|body_0|> def update(self): """Update monorail data of self""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CSku: def __init__(self, obj_device, str_id): """@param obj_device: Parent device that init this one @type obj_device: CDevice @param str_id: id of this SKU @type str_id: string""" self.resource_name = str_id CDevice.__init__(self, self.resource_name) self.obj_parent = obj_devi...
the_stack_v2_python_sparse
idic/monorail/Sku.py
InfraSIM/test
train
1
c3096c3c335acda40c457610d618589d73f8b90c
[ "l, r = (0, len(height) - 1)\nwater = 0\nwhile l < r:\n if height[l] < height[r]:\n i = l + 1\n while i < r and height[i] < height[l]:\n water += height[l] - height[i]\n i += 1\n l = i\n else:\n i = r - 1\n while i > l and height[i] < height[r]:\n ...
<|body_start_0|> l, r = (0, len(height) - 1) water = 0 while l < r: if height[l] < height[r]: i = l + 1 while i < r and height[i] < height[l]: water += height[l] - height[i] i += 1 l = i ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def trap1(self, height: List[int]) -> int: """greedy time: O(N) space: O(1)""" <|body_0|> def trap2(self, height: List[int]) -> int: """monotonic stack time: O(N) space: O(N)""" <|body_1|> <|end_skeleton|> <|body_start_0|> l, r = (0, len(h...
stack_v2_sparse_classes_36k_train_020953
1,641
no_license
[ { "docstring": "greedy time: O(N) space: O(1)", "name": "trap1", "signature": "def trap1(self, height: List[int]) -> int" }, { "docstring": "monotonic stack time: O(N) space: O(N)", "name": "trap2", "signature": "def trap2(self, height: List[int]) -> int" } ]
2
stack_v2_sparse_classes_30k_train_016826
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap1(self, height: List[int]) -> int: greedy time: O(N) space: O(1) - def trap2(self, height: List[int]) -> int: monotonic stack time: O(N) space: O(N)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap1(self, height: List[int]) -> int: greedy time: O(N) space: O(1) - def trap2(self, height: List[int]) -> int: monotonic stack time: O(N) space: O(N) <|skeleton|> class S...
6ff1941ff213a843013100ac7033e2d4f90fbd6a
<|skeleton|> class Solution: def trap1(self, height: List[int]) -> int: """greedy time: O(N) space: O(1)""" <|body_0|> def trap2(self, height: List[int]) -> int: """monotonic stack time: O(N) space: O(N)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def trap1(self, height: List[int]) -> int: """greedy time: O(N) space: O(1)""" l, r = (0, len(height) - 1) water = 0 while l < r: if height[l] < height[r]: i = l + 1 while i < r and height[i] < height[l]: ...
the_stack_v2_python_sparse
Leetcode 0042. Trapping Rain Water.py
Chaoran-sjsu/leetcode
train
0
911c1af33c13bebc987992cd258ae301ceabdb92
[ "cmd_args = options.get('cmd_args', [''])\nexpected_substring = options.get('expected_substring', None)\ncall_task('pavelib.assets.update_assets', args=cmd_args)\nself.assertTrue(self._is_substring_in_list(self.task_messages, expected_substring), msg=f'{expected_substring} not found in messages')", "for message i...
<|body_start_0|> cmd_args = options.get('cmd_args', ['']) expected_substring = options.get('expected_substring', None) call_task('pavelib.assets.update_assets', args=cmd_args) self.assertTrue(self._is_substring_in_list(self.task_messages, expected_substring), msg=f'{expected_substring} n...
These are nearly end-to-end tests, because they observe output from the commandline request, but do not actually execute the commandline on the terminal/process
TestUpdateAssetsTask
[ "MIT", "AGPL-3.0-only", "AGPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestUpdateAssetsTask: """These are nearly end-to-end tests, because they observe output from the commandline request, but do not actually execute the commandline on the terminal/process""" def test_update_assets_task_collectstatic_log_arg(self, options): """Scoped test that only look...
stack_v2_sparse_classes_36k_train_020954
14,737
permissive
[ { "docstring": "Scoped test that only looks at what is passed to the collecstatic options", "name": "test_update_assets_task_collectstatic_log_arg", "signature": "def test_update_assets_task_collectstatic_log_arg(self, options)" }, { "docstring": "Return true a given string is somewhere in a lis...
2
null
Implement the Python class `TestUpdateAssetsTask` described below. Class description: These are nearly end-to-end tests, because they observe output from the commandline request, but do not actually execute the commandline on the terminal/process Method signatures and docstrings: - def test_update_assets_task_collect...
Implement the Python class `TestUpdateAssetsTask` described below. Class description: These are nearly end-to-end tests, because they observe output from the commandline request, but do not actually execute the commandline on the terminal/process Method signatures and docstrings: - def test_update_assets_task_collect...
5809eaca7079a15ee56b0b7fcfea425337046c97
<|skeleton|> class TestUpdateAssetsTask: """These are nearly end-to-end tests, because they observe output from the commandline request, but do not actually execute the commandline on the terminal/process""" def test_update_assets_task_collectstatic_log_arg(self, options): """Scoped test that only look...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestUpdateAssetsTask: """These are nearly end-to-end tests, because they observe output from the commandline request, but do not actually execute the commandline on the terminal/process""" def test_update_assets_task_collectstatic_log_arg(self, options): """Scoped test that only looks at what is ...
the_stack_v2_python_sparse
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/pavelib/paver_tests/test_assets.py
luque/better-ways-of-thinking-about-software
train
3
51ba188f797c263aebb91c02b922df7478b794bd
[ "QMimeData.__init__(self)\nself._local_instance = p_data\nif p_data is not None:\n try:\n p_data = dumps(p_data)\n except Exception:\n return\n self.setData(self.MIME_TYPE, dumps(p_data.__class__) + p_data)", "if self._local_instance is not None:\n return self._local_instance\nio = Strin...
<|body_start_0|> QMimeData.__init__(self) self._local_instance = p_data if p_data is not None: try: p_data = dumps(p_data) except Exception: return self.setData(self.MIME_TYPE, dumps(p_data.__class__) + p_data) <|end_body_0|> <...
The OrcMimeData wraps a Python instance as MIME data.
OrcMimeData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrcMimeData: """The OrcMimeData wraps a Python instance as MIME data.""" def __init__(self, p_data=None): """Initialise the instance.""" <|body_0|> def instance(self): """Return the instance.""" <|body_1|> <|end_skeleton|> <|body_start_0|> QMime...
stack_v2_sparse_classes_36k_train_020955
13,946
no_license
[ { "docstring": "Initialise the instance.", "name": "__init__", "signature": "def __init__(self, p_data=None)" }, { "docstring": "Return the instance.", "name": "instance", "signature": "def instance(self)" } ]
2
stack_v2_sparse_classes_30k_train_017424
Implement the Python class `OrcMimeData` described below. Class description: The OrcMimeData wraps a Python instance as MIME data. Method signatures and docstrings: - def __init__(self, p_data=None): Initialise the instance. - def instance(self): Return the instance.
Implement the Python class `OrcMimeData` described below. Class description: The OrcMimeData wraps a Python instance as MIME data. Method signatures and docstrings: - def __init__(self, p_data=None): Initialise the instance. - def instance(self): Return the instance. <|skeleton|> class OrcMimeData: """The OrcMim...
f3ccbbceaed4f4996f6907a2f4880c2fd3f82bbb
<|skeleton|> class OrcMimeData: """The OrcMimeData wraps a Python instance as MIME data.""" def __init__(self, p_data=None): """Initialise the instance.""" <|body_0|> def instance(self): """Return the instance.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrcMimeData: """The OrcMimeData wraps a Python instance as MIME data.""" def __init__(self, p_data=None): """Initialise the instance.""" QMimeData.__init__(self) self._local_instance = p_data if p_data is not None: try: p_data = dumps(p_data) ...
the_stack_v2_python_sparse
OrcView/Lib/LibTree.py
pubselenium/OrcTestToolsKit
train
0
b427427086471f1f817c57521cb48782490d3351
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ContainerEvidence()", "from .alert_evidence import AlertEvidence\nfrom .container_image_evidence import ContainerImageEvidence\nfrom .kubernetes_pod_evidence import KubernetesPodEvidence\nfrom .alert_evidence import AlertEvidence\nfrom...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return ContainerEvidence() <|end_body_0|> <|body_start_1|> from .alert_evidence import AlertEvidence from .container_image_evidence import ContainerImageEvidence from .kubernetes_pod_ev...
ContainerEvidence
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContainerEvidence: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ContainerEvidence: """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...
stack_v2_sparse_classes_36k_train_020956
3,852
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: ContainerEvidence", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_v...
3
null
Implement the Python class `ContainerEvidence` described below. Class description: Implement the ContainerEvidence class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ContainerEvidence: Creates a new instance of the appropriate class based on discrim...
Implement the Python class `ContainerEvidence` described below. Class description: Implement the ContainerEvidence class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ContainerEvidence: Creates a new instance of the appropriate class based on discrim...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class ContainerEvidence: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ContainerEvidence: """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...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ContainerEvidence: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ContainerEvidence: """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: Cont...
the_stack_v2_python_sparse
msgraph/generated/models/security/container_evidence.py
microsoftgraph/msgraph-sdk-python
train
135
1fc0ee3f712f489f85e4c228e12e4d9da14da7a6
[ "home = os.path.expanduser('~')\nif name == 'desktop':\n return os.path.join(home, 'Desktop')\nelif name == 'documents':\n return os.path.join(home, 'Documents')\nelif name == 'downloads':\n return os.path.join(home, 'Downloads')\nelif name == 'applications' or name == 'programs':\n return os.path.join(...
<|body_start_0|> home = os.path.expanduser('~') if name == 'desktop': return os.path.join(home, 'Desktop') elif name == 'documents': return os.path.join(home, 'Documents') elif name == 'downloads': return os.path.join(home, 'Downloads') elif na...
Exports
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Exports: def get_known_path(name: str, param: str='', approot=None): """特殊なフォルダ・ファイルの名前からパスを得る。""" <|body_0|> def start_file(path, operation=None): """デフォルトの方法でパスを開く。""" <|body_1|> def has_hidden_attribute(path): """隠し属性がついているファイルか。""" <|...
stack_v2_sparse_classes_36k_train_020957
2,665
permissive
[ { "docstring": "特殊なフォルダ・ファイルの名前からパスを得る。", "name": "get_known_path", "signature": "def get_known_path(name: str, param: str='', approot=None)" }, { "docstring": "デフォルトの方法でパスを開く。", "name": "start_file", "signature": "def start_file(path, operation=None)" }, { "docstring": "隠し属性がついて...
3
stack_v2_sparse_classes_30k_train_018294
Implement the Python class `Exports` described below. Class description: Implement the Exports class. Method signatures and docstrings: - def get_known_path(name: str, param: str='', approot=None): 特殊なフォルダ・ファイルの名前からパスを得る。 - def start_file(path, operation=None): デフォルトの方法でパスを開く。 - def has_hidden_attribute(path): 隠し属性がつ...
Implement the Python class `Exports` described below. Class description: Implement the Exports class. Method signatures and docstrings: - def get_known_path(name: str, param: str='', approot=None): 特殊なフォルダ・ファイルの名前からパスを得る。 - def start_file(path, operation=None): デフォルトの方法でパスを開く。 - def has_hidden_attribute(path): 隠し属性がつ...
f3d89b4449b04e5e587915f3b3623dfbe5ba01d8
<|skeleton|> class Exports: def get_known_path(name: str, param: str='', approot=None): """特殊なフォルダ・ファイルの名前からパスを得る。""" <|body_0|> def start_file(path, operation=None): """デフォルトの方法でパスを開く。""" <|body_1|> def has_hidden_attribute(path): """隠し属性がついているファイルか。""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Exports: def get_known_path(name: str, param: str='', approot=None): """特殊なフォルダ・ファイルの名前からパスを得る。""" home = os.path.expanduser('~') if name == 'desktop': return os.path.join(home, 'Desktop') elif name == 'documents': return os.path.join(home, 'Documents') ...
the_stack_v2_python_sparse
machaon/platforms/osx/path.py
betasewer/machaon
train
4
58de4c2654c6ab3c86707f74eb019eed82c0dfae
[ "g = [[] for _ in range(n)]\nfor a, b in edges:\n g[a].append(b)\n g[b].append(a)\nret = [0] * n\n\ndef dfs(a, p):\n counter = defaultdict(int)\n counter[labels[a]] += 1\n for b in g[a]:\n if b == p:\n continue\n for l, c in dfs(b, a).items():\n counter[l] += c\n ...
<|body_start_0|> g = [[] for _ in range(n)] for a, b in edges: g[a].append(b) g[b].append(a) ret = [0] * n def dfs(a, p): counter = defaultdict(int) counter[labels[a]] += 1 for b in g[a]: if b == p: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countSubTrees(self, n: int, edges: List[List[int]], labels: str) -> List[int]: """Mar 05, 2023 14:37""" <|body_0|> def countSubTrees(self, n: int, edges: List[List[int]], labels: str) -> List[int]: """Mar 05, 2023 14:39 Use one counter""" <|body...
stack_v2_sparse_classes_36k_train_020958
3,712
no_license
[ { "docstring": "Mar 05, 2023 14:37", "name": "countSubTrees", "signature": "def countSubTrees(self, n: int, edges: List[List[int]], labels: str) -> List[int]" }, { "docstring": "Mar 05, 2023 14:39 Use one counter", "name": "countSubTrees", "signature": "def countSubTrees(self, n: int, ed...
2
stack_v2_sparse_classes_30k_train_003019
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countSubTrees(self, n: int, edges: List[List[int]], labels: str) -> List[int]: Mar 05, 2023 14:37 - def countSubTrees(self, n: int, edges: List[List[int]], labels: str) -> Li...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countSubTrees(self, n: int, edges: List[List[int]], labels: str) -> List[int]: Mar 05, 2023 14:37 - def countSubTrees(self, n: int, edges: List[List[int]], labels: str) -> Li...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def countSubTrees(self, n: int, edges: List[List[int]], labels: str) -> List[int]: """Mar 05, 2023 14:37""" <|body_0|> def countSubTrees(self, n: int, edges: List[List[int]], labels: str) -> List[int]: """Mar 05, 2023 14:39 Use one counter""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countSubTrees(self, n: int, edges: List[List[int]], labels: str) -> List[int]: """Mar 05, 2023 14:37""" g = [[] for _ in range(n)] for a, b in edges: g[a].append(b) g[b].append(a) ret = [0] * n def dfs(a, p): counter = ...
the_stack_v2_python_sparse
leetcode/solved/1643_Number_of_Nodes_in_the_Sub-Tree_With_the_Same_Label/solution.py
sungminoh/algorithms
train
0
e091e0ffff07df32ce5f80bf0f0bf0b12bca1c8d
[ "TreatmentInfoView.validate_treatment_info_request(id_patient, id_treatment_cycle, id_treatment)\ntreatment_info = TreatmentService.treatment_info(id_treatment)\nreturn JsonResponse(treatment_info)", "Utils.validate_uuid(id_patient)\nUtils.validate_uuid(id_treatment_cycle)\nUtils.validate_uuid(id_treatment)" ]
<|body_start_0|> TreatmentInfoView.validate_treatment_info_request(id_patient, id_treatment_cycle, id_treatment) treatment_info = TreatmentService.treatment_info(id_treatment) return JsonResponse(treatment_info) <|end_body_0|> <|body_start_1|> Utils.validate_uuid(id_patient) Uti...
All endpoints related to treatment info actions
TreatmentInfoView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TreatmentInfoView: """All endpoints related to treatment info actions""" def get(request, id_patient, id_treatment_cycle, id_treatment): """Action when calling the endpoint with GET""" <|body_0|> def validate_treatment_info_request(id_patient, id_treatment_cycle, id_trea...
stack_v2_sparse_classes_36k_train_020959
3,356
no_license
[ { "docstring": "Action when calling the endpoint with GET", "name": "get", "signature": "def get(request, id_patient, id_treatment_cycle, id_treatment)" }, { "docstring": "Validates the treatment information received in the request body :param id_patient: Id of the patient received :param id_tre...
2
stack_v2_sparse_classes_30k_train_018523
Implement the Python class `TreatmentInfoView` described below. Class description: All endpoints related to treatment info actions Method signatures and docstrings: - def get(request, id_patient, id_treatment_cycle, id_treatment): Action when calling the endpoint with GET - def validate_treatment_info_request(id_pati...
Implement the Python class `TreatmentInfoView` described below. Class description: All endpoints related to treatment info actions Method signatures and docstrings: - def get(request, id_patient, id_treatment_cycle, id_treatment): Action when calling the endpoint with GET - def validate_treatment_info_request(id_pati...
941e8b2870f8724db3d5103dda5157fd597cfcc7
<|skeleton|> class TreatmentInfoView: """All endpoints related to treatment info actions""" def get(request, id_patient, id_treatment_cycle, id_treatment): """Action when calling the endpoint with GET""" <|body_0|> def validate_treatment_info_request(id_patient, id_treatment_cycle, id_trea...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TreatmentInfoView: """All endpoints related to treatment info actions""" def get(request, id_patient, id_treatment_cycle, id_treatment): """Action when calling the endpoint with GET""" TreatmentInfoView.validate_treatment_info_request(id_patient, id_treatment_cycle, id_treatment) ...
the_stack_v2_python_sparse
backend/martin_helder/views/treatment_info_view.py
JoaoAlvaroFerreira/FEUP-LGP
train
1
4e891eeb643036e61a3a120984403f3a7c9e7a96
[ "self.generator = generator\nself.commons = pywikibot.Site('commons', 'commons')\nself.repo = pywikibot.Site().data_repository()", "for itempage in self.generator:\n pywikibot.output(u'Working on %s' % (itempage.title(),))\n if not itempage.exists():\n pywikibot.output(u'Item does not exist, skipping...
<|body_start_0|> self.generator = generator self.commons = pywikibot.Site('commons', 'commons') self.repo = pywikibot.Site().data_repository() <|end_body_0|> <|body_start_1|> for itempage in self.generator: pywikibot.output(u'Working on %s' % (itempage.title(),)) ...
A bot to Commons Category sitelinks
MissingCommonsSitelinkBot
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MissingCommonsSitelinkBot: """A bot to Commons Category sitelinks""" def __init__(self, generator): """Arguments: * generator - A generator that yields ItemPage objects.""" <|body_0|> def run(self): """Starts the robot.""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_36k_train_020960
4,707
no_license
[ { "docstring": "Arguments: * generator - A generator that yields ItemPage objects.", "name": "__init__", "signature": "def __init__(self, generator)" }, { "docstring": "Starts the robot.", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_002475
Implement the Python class `MissingCommonsSitelinkBot` described below. Class description: A bot to Commons Category sitelinks Method signatures and docstrings: - def __init__(self, generator): Arguments: * generator - A generator that yields ItemPage objects. - def run(self): Starts the robot.
Implement the Python class `MissingCommonsSitelinkBot` described below. Class description: A bot to Commons Category sitelinks Method signatures and docstrings: - def __init__(self, generator): Arguments: * generator - A generator that yields ItemPage objects. - def run(self): Starts the robot. <|skeleton|> class Mi...
99a96e49cfe6b2d3151da7ad5469792d80171be3
<|skeleton|> class MissingCommonsSitelinkBot: """A bot to Commons Category sitelinks""" def __init__(self, generator): """Arguments: * generator - A generator that yields ItemPage objects.""" <|body_0|> def run(self): """Starts the robot.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MissingCommonsSitelinkBot: """A bot to Commons Category sitelinks""" def __init__(self, generator): """Arguments: * generator - A generator that yields ItemPage objects.""" self.generator = generator self.commons = pywikibot.Site('commons', 'commons') self.repo = pywikibot...
the_stack_v2_python_sparse
bot/wikidata/commons_category_missing_sitelink.py
multichill/toollabs
train
18
b31f4e139658a1ac6b3fbf3ff20beb012c45f11e
[ "super().__init__(config_entry, driver, info)\nself._target_value = self.get_zwave_value(TARGET_VALUE_PROPERTY)\nassert self.info.platform_data_template\nself._lookup_map = cast(dict[int, str], self.info.platform_data_template.static_data)\nself._attr_options = list(self._lookup_map.values())", "if self.info.prim...
<|body_start_0|> super().__init__(config_entry, driver, info) self._target_value = self.get_zwave_value(TARGET_VALUE_PROPERTY) assert self.info.platform_data_template self._lookup_map = cast(dict[int, str], self.info.platform_data_template.static_data) self._attr_options = list(s...
Representation of a Z-Wave Multilevel Switch CC select entity.
ZwaveMultilevelSwitchSelectEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZwaveMultilevelSwitchSelectEntity: """Representation of a Z-Wave Multilevel Switch CC select entity.""" def __init__(self, config_entry: ConfigEntry, driver: Driver, info: ZwaveDiscoveryInfo) -> None: """Initialize a ZwaveSelectEntity entity.""" <|body_0|> def current_op...
stack_v2_sparse_classes_36k_train_020961
7,555
permissive
[ { "docstring": "Initialize a ZwaveSelectEntity entity.", "name": "__init__", "signature": "def __init__(self, config_entry: ConfigEntry, driver: Driver, info: ZwaveDiscoveryInfo) -> None" }, { "docstring": "Return the selected entity option to represent the entity state.", "name": "current_o...
3
stack_v2_sparse_classes_30k_train_002199
Implement the Python class `ZwaveMultilevelSwitchSelectEntity` described below. Class description: Representation of a Z-Wave Multilevel Switch CC select entity. Method signatures and docstrings: - def __init__(self, config_entry: ConfigEntry, driver: Driver, info: ZwaveDiscoveryInfo) -> None: Initialize a ZwaveSelec...
Implement the Python class `ZwaveMultilevelSwitchSelectEntity` described below. Class description: Representation of a Z-Wave Multilevel Switch CC select entity. Method signatures and docstrings: - def __init__(self, config_entry: ConfigEntry, driver: Driver, info: ZwaveDiscoveryInfo) -> None: Initialize a ZwaveSelec...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ZwaveMultilevelSwitchSelectEntity: """Representation of a Z-Wave Multilevel Switch CC select entity.""" def __init__(self, config_entry: ConfigEntry, driver: Driver, info: ZwaveDiscoveryInfo) -> None: """Initialize a ZwaveSelectEntity entity.""" <|body_0|> def current_op...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZwaveMultilevelSwitchSelectEntity: """Representation of a Z-Wave Multilevel Switch CC select entity.""" def __init__(self, config_entry: ConfigEntry, driver: Driver, info: ZwaveDiscoveryInfo) -> None: """Initialize a ZwaveSelectEntity entity.""" super().__init__(config_entry, driver, info...
the_stack_v2_python_sparse
homeassistant/components/zwave_js/select.py
home-assistant/core
train
35,501
123e088cafc8e624e4ddbb680a0f4ee775aad23e
[ "super().__init__()\nself.nf = nf\nw = torch.empty(nx, nf)\nnn.init.normal_(w, std=0.02)\nself.weight = nn.Parameter(w)\nself.bias = nn.Parameter(torch.zeros(nf))", "size_out = x.size()[:-1] + (self.nf,)\nx = torch.addmm(self.bias, x.view(-1, x.size(-1)), self.weight)\nx = x.view(*size_out)\nreturn x" ]
<|body_start_0|> super().__init__() self.nf = nf w = torch.empty(nx, nf) nn.init.normal_(w, std=0.02) self.weight = nn.Parameter(w) self.bias = nn.Parameter(torch.zeros(nf)) <|end_body_0|> <|body_start_1|> size_out = x.size()[:-1] + (self.nf,) x = torch.a...
1D-convolutional layer (eqv to FCN) as defined by Radford et al. for OpenAI GPT (and also used in GPT-2). Basically works like a linear layer but the weights are transposed. Note: Code adopted from: https://github.com/huggingface/transformers/blob/master/src/transformers/modeling_utils.py Args: nf (int): The number of ...
Conv1D
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Conv1D: """1D-convolutional layer (eqv to FCN) as defined by Radford et al. for OpenAI GPT (and also used in GPT-2). Basically works like a linear layer but the weights are transposed. Note: Code adopted from: https://github.com/huggingface/transformers/blob/master/src/transformers/modeling_utils...
stack_v2_sparse_classes_36k_train_020962
2,885
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, nf: int, nx: int) -> None" }, { "docstring": "Forward pass Args: x (Tensor): [..., nx] input features Returns: Tensor: [..., nf] output features", "name": "forward", "signature": "def forward(self, x: Tens...
2
stack_v2_sparse_classes_30k_train_020787
Implement the Python class `Conv1D` described below. Class description: 1D-convolutional layer (eqv to FCN) as defined by Radford et al. for OpenAI GPT (and also used in GPT-2). Basically works like a linear layer but the weights are transposed. Note: Code adopted from: https://github.com/huggingface/transformers/blob...
Implement the Python class `Conv1D` described below. Class description: 1D-convolutional layer (eqv to FCN) as defined by Radford et al. for OpenAI GPT (and also used in GPT-2). Basically works like a linear layer but the weights are transposed. Note: Code adopted from: https://github.com/huggingface/transformers/blob...
eb28d09957641cc594b3e5acf4ace2e4dc193584
<|skeleton|> class Conv1D: """1D-convolutional layer (eqv to FCN) as defined by Radford et al. for OpenAI GPT (and also used in GPT-2). Basically works like a linear layer but the weights are transposed. Note: Code adopted from: https://github.com/huggingface/transformers/blob/master/src/transformers/modeling_utils...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Conv1D: """1D-convolutional layer (eqv to FCN) as defined by Radford et al. for OpenAI GPT (and also used in GPT-2). Basically works like a linear layer but the weights are transposed. Note: Code adopted from: https://github.com/huggingface/transformers/blob/master/src/transformers/modeling_utils.py Args: nf ...
the_stack_v2_python_sparse
trphysx/transformer/utils.py
yus-nas/transformer-physx
train
0
c6ca49cbd3f50b8bf68872607230bf358dc8c1ad
[ "inorderMap = {}\nfor idx, value in enumerate(inorder):\n inorderMap[value] = idx\nreturn self.buildTreeHelper(inorder, postorder, inorderMap)", "if not inorder or not postorder:\n return None\nroot = TreeNode(postorder.pop())\nrootIdxFromInorder = inorder.index(root.val)\nroot.right = self.buildTreeHelper(...
<|body_start_0|> inorderMap = {} for idx, value in enumerate(inorder): inorderMap[value] = idx return self.buildTreeHelper(inorder, postorder, inorderMap) <|end_body_0|> <|body_start_1|> if not inorder or not postorder: return None root = TreeNode(postord...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def buildTree(self, inorder, postorder): """:type inorder: List[int] :type postorder: List[int] :rtype: TreeNode""" <|body_0|> def buildTreeHelper(self, inorder, postorder, inorderMap): """:type inorder: List[int] :type postorder: List[int] :rtype: TreeNode...
stack_v2_sparse_classes_36k_train_020963
1,895
permissive
[ { "docstring": ":type inorder: List[int] :type postorder: List[int] :rtype: TreeNode", "name": "buildTree", "signature": "def buildTree(self, inorder, postorder)" }, { "docstring": ":type inorder: List[int] :type postorder: List[int] :rtype: TreeNode", "name": "buildTreeHelper", "signatu...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def buildTree(self, inorder, postorder): :type inorder: List[int] :type postorder: List[int] :rtype: TreeNode - def buildTreeHelper(self, inorder, postorder, inorderMap): :type i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def buildTree(self, inorder, postorder): :type inorder: List[int] :type postorder: List[int] :rtype: TreeNode - def buildTreeHelper(self, inorder, postorder, inorderMap): :type i...
20ae1a048eddbc9a32c819cf61258e2b57572f05
<|skeleton|> class Solution: def buildTree(self, inorder, postorder): """:type inorder: List[int] :type postorder: List[int] :rtype: TreeNode""" <|body_0|> def buildTreeHelper(self, inorder, postorder, inorderMap): """:type inorder: List[int] :type postorder: List[int] :rtype: TreeNode...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def buildTree(self, inorder, postorder): """:type inorder: List[int] :type postorder: List[int] :rtype: TreeNode""" inorderMap = {} for idx, value in enumerate(inorder): inorderMap[value] = idx return self.buildTreeHelper(inorder, postorder, inorderMap) ...
the_stack_v2_python_sparse
leetcode.com/python/106_Construct_Binary_Tree_from_Inorder_and_Postorder_Traversal.py
partho-maple/coding-interview-gym
train
862
7f9be951db40216dbef352b4d1c8c1487bfcec29
[ "self.threshold = threshold\nself.sampling_method = sampling_method\nself.eps = eps\nself.delta = delta\nself._store_every = store_every\nself.func_of_freq = func_of_freq\nself._inclusion_prob = [0.0]\nself.elements = set()", "if not isinstance(sample, ThresholdSample):\n raise TypeError('Tried to create a pri...
<|body_start_0|> self.threshold = threshold self.sampling_method = sampling_method self.eps = eps self.delta = delta self._store_every = store_every self.func_of_freq = func_of_freq self._inclusion_prob = [0.0] self.elements = set() <|end_body_0|> <|body_...
Threshold sampling with differential privacy (returns sampled keys only). This class implements threshold sampling, and then performs subsampling to satisfy the differential privacy constraints. The private sample only includes keys (and no information about their frequencies). The sketch only supports aggregated data:...
PrivateThresholdSampleKeysOnly
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrivateThresholdSampleKeysOnly: """Threshold sampling with differential privacy (returns sampled keys only). This class implements threshold sampling, and then performs subsampling to satisfy the differential privacy constraints. The private sample only includes keys (and no information about the...
stack_v2_sparse_classes_36k_train_020964
32,453
permissive
[ { "docstring": "Initializes an empty sample. Args: threshold: The sampling threshold eps: The differential privacy parameter epsilon delta: The differential privacy parameter delta sampling_method: A class that provides functions to compute the score and inclusion probability according to the underlying non-pri...
4
stack_v2_sparse_classes_30k_train_018835
Implement the Python class `PrivateThresholdSampleKeysOnly` described below. Class description: Threshold sampling with differential privacy (returns sampled keys only). This class implements threshold sampling, and then performs subsampling to satisfy the differential privacy constraints. The private sample only incl...
Implement the Python class `PrivateThresholdSampleKeysOnly` described below. Class description: Threshold sampling with differential privacy (returns sampled keys only). This class implements threshold sampling, and then performs subsampling to satisfy the differential privacy constraints. The private sample only incl...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class PrivateThresholdSampleKeysOnly: """Threshold sampling with differential privacy (returns sampled keys only). This class implements threshold sampling, and then performs subsampling to satisfy the differential privacy constraints. The private sample only includes keys (and no information about the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrivateThresholdSampleKeysOnly: """Threshold sampling with differential privacy (returns sampled keys only). This class implements threshold sampling, and then performs subsampling to satisfy the differential privacy constraints. The private sample only includes keys (and no information about their frequencie...
the_stack_v2_python_sparse
private_sampling/private_sampling.py
Jimmy-INL/google-research
train
1
ce0e00663ad3f0a622b5112d516c0316df177f2f
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn PrincipalResourceMembershipsScope()", "from .access_review_scope import AccessReviewScope\nfrom .access_review_scope import AccessReviewScope\nfields: Dict[str, Callable[[Any], None]] = {'principalScopes': lambda n: setattr(self, 'prin...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return PrincipalResourceMembershipsScope() <|end_body_0|> <|body_start_1|> from .access_review_scope import AccessReviewScope from .access_review_scope import AccessReviewScope fields: ...
PrincipalResourceMembershipsScope
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrincipalResourceMembershipsScope: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrincipalResourceMembershipsScope: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discrimin...
stack_v2_sparse_classes_36k_train_020965
2,713
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: PrincipalResourceMembershipsScope", "name": "create_from_discriminator_value", "signature": "def create_from...
3
stack_v2_sparse_classes_30k_train_009261
Implement the Python class `PrincipalResourceMembershipsScope` described below. Class description: Implement the PrincipalResourceMembershipsScope class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrincipalResourceMembershipsScope: Creates a new in...
Implement the Python class `PrincipalResourceMembershipsScope` described below. Class description: Implement the PrincipalResourceMembershipsScope class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrincipalResourceMembershipsScope: Creates a new in...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class PrincipalResourceMembershipsScope: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrincipalResourceMembershipsScope: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discrimin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrincipalResourceMembershipsScope: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrincipalResourceMembershipsScope: """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...
the_stack_v2_python_sparse
msgraph/generated/models/principal_resource_memberships_scope.py
microsoftgraph/msgraph-sdk-python
train
135
cf58fcdc9b8992c75065587a53a9f5a42e6610bf
[ "well = WellService.get_by_well_id(well_id)\nif well is None:\n return self.format_failure(404, 'Well Not Found')\nreturn self.format_success(200, {'well': well})", "well = WellService.get_by_well_id(well_id)\nif well is None:\n self.format_failure(404, 'Well Not Found')\nreturn self.format_success(200, {'w...
<|body_start_0|> well = WellService.get_by_well_id(well_id) if well is None: return self.format_failure(404, 'Well Not Found') return self.format_success(200, {'well': well}) <|end_body_0|> <|body_start_1|> well = WellService.get_by_well_id(well_id) if well is None: ...
API Resource for /wells/<well_id>/hygiene
WellHygiene
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WellHygiene: """API Resource for /wells/<well_id>/hygiene""" def get(self, well_id, **_): """GET /wells/<well_id>/hygiene""" <|body_0|> def post(self, well_id: str): """POST /wells/<well_id>/hygiene""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_020966
1,884
no_license
[ { "docstring": "GET /wells/<well_id>/hygiene", "name": "get", "signature": "def get(self, well_id, **_)" }, { "docstring": "POST /wells/<well_id>/hygiene", "name": "post", "signature": "def post(self, well_id: str)" } ]
2
stack_v2_sparse_classes_30k_train_016122
Implement the Python class `WellHygiene` described below. Class description: API Resource for /wells/<well_id>/hygiene Method signatures and docstrings: - def get(self, well_id, **_): GET /wells/<well_id>/hygiene - def post(self, well_id: str): POST /wells/<well_id>/hygiene
Implement the Python class `WellHygiene` described below. Class description: API Resource for /wells/<well_id>/hygiene Method signatures and docstrings: - def get(self, well_id, **_): GET /wells/<well_id>/hygiene - def post(self, well_id: str): POST /wells/<well_id>/hygiene <|skeleton|> class WellHygiene: """API...
8ab4034413262ff2271740d73df72b3d83ce5918
<|skeleton|> class WellHygiene: """API Resource for /wells/<well_id>/hygiene""" def get(self, well_id, **_): """GET /wells/<well_id>/hygiene""" <|body_0|> def post(self, well_id: str): """POST /wells/<well_id>/hygiene""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WellHygiene: """API Resource for /wells/<well_id>/hygiene""" def get(self, well_id, **_): """GET /wells/<well_id>/hygiene""" well = WellService.get_by_well_id(well_id) if well is None: return self.format_failure(404, 'Well Not Found') return self.format_success...
the_stack_v2_python_sparse
app/main/controllers/wells/well_hygiene_controller.py
Malawi-Water-Wells-project/malawi-auth-api
train
1
7f21dcf95b011292844fa197982adee16c80fead
[ "super().__init__()\nt = int(abs(math.log(in_channels, 2) + beta) / gamma)\nkernel_size = max(t if t % 2 else t + 1, 3)\npadding = (kernel_size - 1) // 2\nself.conv = nn.Conv1d(1, 1, kernel_size=kernel_size, padding=padding, bias=False)\nself.gate = Activation(gate_activation)", "B = x.shape[0]\ny = x.mean((2, 3)...
<|body_start_0|> super().__init__() t = int(abs(math.log(in_channels, 2) + beta) / gamma) kernel_size = max(t if t % 2 else t + 1, 3) padding = (kernel_size - 1) // 2 self.conv = nn.Conv1d(1, 1, kernel_size=kernel_size, padding=padding, bias=False) self.gate = Activation(...
ECA
[ "MIT", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ECA: def __init__(self, in_channels: int, beta: int=1, gamma: int=2, gate_activation: str='sigmoid', **kwargs) -> None: """Efficient Channel Attention (ECA). https://arxiv.org/abs/1910.03151 Parameters ---------- in_channels : int Number of input channels. beta : int, default=1 Coefficie...
stack_v2_sparse_classes_36k_train_020967
11,576
permissive
[ { "docstring": "Efficient Channel Attention (ECA). https://arxiv.org/abs/1910.03151 Parameters ---------- in_channels : int Number of input channels. beta : int, default=1 Coefficient used to compute the kernel size adaptively. gamma : int, default=2 Coefficient used to compute the kernel size adaptively. gate_...
2
null
Implement the Python class `ECA` described below. Class description: Implement the ECA class. Method signatures and docstrings: - def __init__(self, in_channels: int, beta: int=1, gamma: int=2, gate_activation: str='sigmoid', **kwargs) -> None: Efficient Channel Attention (ECA). https://arxiv.org/abs/1910.03151 Param...
Implement the Python class `ECA` described below. Class description: Implement the ECA class. Method signatures and docstrings: - def __init__(self, in_channels: int, beta: int=1, gamma: int=2, gate_activation: str='sigmoid', **kwargs) -> None: Efficient Channel Attention (ECA). https://arxiv.org/abs/1910.03151 Param...
7f79405012eb934b419bbdba8de23f35e840ca85
<|skeleton|> class ECA: def __init__(self, in_channels: int, beta: int=1, gamma: int=2, gate_activation: str='sigmoid', **kwargs) -> None: """Efficient Channel Attention (ECA). https://arxiv.org/abs/1910.03151 Parameters ---------- in_channels : int Number of input channels. beta : int, default=1 Coefficie...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ECA: def __init__(self, in_channels: int, beta: int=1, gamma: int=2, gate_activation: str='sigmoid', **kwargs) -> None: """Efficient Channel Attention (ECA). https://arxiv.org/abs/1910.03151 Parameters ---------- in_channels : int Number of input channels. beta : int, default=1 Coefficient used to com...
the_stack_v2_python_sparse
cellseg_models_pytorch/modules/attention_modules.py
okunator/cellseg_models.pytorch
train
43
8301df83c054ad3e6341b3c5da1b8d9c9f5c7868
[ "self.drone_connection.disconnect()\nif self.groundcam is not None:\n self.groundcam._close()", "if self.use_wifi:\n return False\ncommand_tuple, enum_tuple = self.command_parser.get_command_tuple_with_enum('minidrone', 'UsbAccessory', 'GunControl', 'FIRE')\nreturn self.drone_connection.send_enum_command_pa...
<|body_start_0|> self.drone_connection.disconnect() if self.groundcam is not None: self.groundcam._close() <|end_body_0|> <|body_start_1|> if self.use_wifi: return False command_tuple, enum_tuple = self.command_parser.get_command_tuple_with_enum('minidrone', 'Usb...
Mambo
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mambo: def disconnect(self): """Disconnect the BLE connection. Always call this at the end of your programs to cleanly disconnect. :return: void""" <|body_0|> def fire_gun(self): """Fire the gun (assumes it is attached) - note not supposed under wifi since the camera...
stack_v2_sparse_classes_36k_train_020968
31,062
permissive
[ { "docstring": "Disconnect the BLE connection. Always call this at the end of your programs to cleanly disconnect. :return: void", "name": "disconnect", "signature": "def disconnect(self)" }, { "docstring": "Fire the gun (assumes it is attached) - note not supposed under wifi since the camera ta...
2
stack_v2_sparse_classes_30k_train_010717
Implement the Python class `Mambo` described below. Class description: Implement the Mambo class. Method signatures and docstrings: - def disconnect(self): Disconnect the BLE connection. Always call this at the end of your programs to cleanly disconnect. :return: void - def fire_gun(self): Fire the gun (assumes it is...
Implement the Python class `Mambo` described below. Class description: Implement the Mambo class. Method signatures and docstrings: - def disconnect(self): Disconnect the BLE connection. Always call this at the end of your programs to cleanly disconnect. :return: void - def fire_gun(self): Fire the gun (assumes it is...
99ab19f7896bc30cf059244962a7da318d4672bf
<|skeleton|> class Mambo: def disconnect(self): """Disconnect the BLE connection. Always call this at the end of your programs to cleanly disconnect. :return: void""" <|body_0|> def fire_gun(self): """Fire the gun (assumes it is attached) - note not supposed under wifi since the camera...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Mambo: def disconnect(self): """Disconnect the BLE connection. Always call this at the end of your programs to cleanly disconnect. :return: void""" self.drone_connection.disconnect() if self.groundcam is not None: self.groundcam._close() def fire_gun(self): """...
the_stack_v2_python_sparse
Madrid/July2022/ProfessorX-BCI/src/drone/vendor/Minidrone.py
SaturdaysAI/Projects
train
35
621e71db710ee9f6e39d0e640f56cf368ecde545
[ "Parametre.__init__(self, 'liste', 'list')\nself.groupe = 'administrateur'\nself.aide_courte = 'liste les questeurs existants'\nself.aide_longue = 'Cette commande liste les questeurs existants.'", "questeurs = list(importeur.commerce.questeurs.values())\nquesteurs = [q for q in questeurs if q.salle]\nquesteurs = ...
<|body_start_0|> Parametre.__init__(self, 'liste', 'list') self.groupe = 'administrateur' self.aide_courte = 'liste les questeurs existants' self.aide_longue = 'Cette commande liste les questeurs existants.' <|end_body_0|> <|body_start_1|> questeurs = list(importeur.commerce.que...
Commande 'questeur liste'.
PrmListe
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmListe: """Commande 'questeur liste'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|> <|body_start_0|> Parametre.__...
stack_v2_sparse_classes_36k_train_020969
2,892
permissive
[ { "docstring": "Constructeur du paramètre", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Interprétation du paramètre", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
null
Implement the Python class `PrmListe` described below. Class description: Commande 'questeur liste'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre
Implement the Python class `PrmListe` described below. Class description: Commande 'questeur liste'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre <|skeleton|> class PrmListe: """Commande 'questeur l...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmListe: """Commande 'questeur liste'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrmListe: """Commande 'questeur liste'.""" def __init__(self): """Constructeur du paramètre""" Parametre.__init__(self, 'liste', 'list') self.groupe = 'administrateur' self.aide_courte = 'liste les questeurs existants' self.aide_longue = 'Cette commande liste les q...
the_stack_v2_python_sparse
src/primaires/commerce/commandes/questeur/liste.py
vincent-lg/tsunami
train
5
f1b274c77f585ce8990e5626afbd35304c4bc976
[ "tasks_file = tfds.core.tfds_path(_TASKS_FNAME)\ntasks = tasks_file.read_text().splitlines()\nreturn self.dataset_info_from_configs(features=tfds.features.FeaturesDict({'num_nodes': tfds.features.Tensor(shape=(None,), dtype=np.int64), 'node_feat': tfds.features.Tensor(shape=(None, 9), dtype=np.float32), 'num_edges'...
<|body_start_0|> tasks_file = tfds.core.tfds_path(_TASKS_FNAME) tasks = tasks_file.read_text().splitlines() return self.dataset_info_from_configs(features=tfds.features.FeaturesDict({'num_nodes': tfds.features.Tensor(shape=(None,), dtype=np.int64), 'node_feat': tfds.features.Tensor(shape=(None, ...
DatasetBuilder for ogbg_molpcba dataset.
Builder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Builder: """DatasetBuilder for ogbg_molpcba dataset.""" def _info(self) -> tfds.core.DatasetInfo: """Returns the dataset metadata.""" <|body_0|> def _split_generators(self, dl_manager: tfds.download.DownloadManager): """Returns SplitGenerators.""" <|body_...
stack_v2_sparse_classes_36k_train_020970
6,334
permissive
[ { "docstring": "Returns the dataset metadata.", "name": "_info", "signature": "def _info(self) -> tfds.core.DatasetInfo" }, { "docstring": "Returns SplitGenerators.", "name": "_split_generators", "signature": "def _split_generators(self, dl_manager: tfds.download.DownloadManager)" }, ...
3
null
Implement the Python class `Builder` described below. Class description: DatasetBuilder for ogbg_molpcba dataset. Method signatures and docstrings: - def _info(self) -> tfds.core.DatasetInfo: Returns the dataset metadata. - def _split_generators(self, dl_manager: tfds.download.DownloadManager): Returns SplitGenerator...
Implement the Python class `Builder` described below. Class description: DatasetBuilder for ogbg_molpcba dataset. Method signatures and docstrings: - def _info(self) -> tfds.core.DatasetInfo: Returns the dataset metadata. - def _split_generators(self, dl_manager: tfds.download.DownloadManager): Returns SplitGenerator...
41ae3cf1439711ed2f50f99caa0e6702082e6d37
<|skeleton|> class Builder: """DatasetBuilder for ogbg_molpcba dataset.""" def _info(self) -> tfds.core.DatasetInfo: """Returns the dataset metadata.""" <|body_0|> def _split_generators(self, dl_manager: tfds.download.DownloadManager): """Returns SplitGenerators.""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Builder: """DatasetBuilder for ogbg_molpcba dataset.""" def _info(self) -> tfds.core.DatasetInfo: """Returns the dataset metadata.""" tasks_file = tfds.core.tfds_path(_TASKS_FNAME) tasks = tasks_file.read_text().splitlines() return self.dataset_info_from_configs(features=t...
the_stack_v2_python_sparse
tensorflow_datasets/datasets/ogbg_molpcba/ogbg_molpcba_dataset_builder.py
tensorflow/datasets
train
4,224
7e726f2026339d9021aa190e9cba07901a977eb5
[ "startBin = start >> Binner.binFirstShift\nendBin = end - 1 >> Binner.binFirstShift\nfor binOff in offsets:\n if startBin == endBin:\n return baseOffset + binOff + startBin\n startBin >>= Binner.binNextShift\n endBin >>= Binner.binNextShift\nraise Exception(\"can't compute bin: start %d, end %d out ...
<|body_start_0|> startBin = start >> Binner.binFirstShift endBin = end - 1 >> Binner.binFirstShift for binOff in offsets: if startBin == endBin: return baseOffset + binOff + startBin startBin >>= Binner.binNextShift endBin >>= Binner.binNextShi...
functions to translate ranges to bin numbers
Binner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Binner: """functions to translate ranges to bin numbers""" def __calcBinForOffsets(start, end, baseOffset, offsets): """get the bin for a range""" <|body_0|> def calcBin(start, end): """get the bin for a range""" <|body_1|> def __getOverlappingBinsFo...
stack_v2_sparse_classes_36k_train_020971
10,668
permissive
[ { "docstring": "get the bin for a range", "name": "__calcBinForOffsets", "signature": "def __calcBinForOffsets(start, end, baseOffset, offsets)" }, { "docstring": "get the bin for a range", "name": "calcBin", "signature": "def calcBin(start, end)" }, { "docstring": "generate bins...
5
stack_v2_sparse_classes_30k_train_014326
Implement the Python class `Binner` described below. Class description: functions to translate ranges to bin numbers Method signatures and docstrings: - def __calcBinForOffsets(start, end, baseOffset, offsets): get the bin for a range - def calcBin(start, end): get the bin for a range - def __getOverlappingBinsForOff...
Implement the Python class `Binner` described below. Class description: functions to translate ranges to bin numbers Method signatures and docstrings: - def __calcBinForOffsets(start, end, baseOffset, offsets): get the bin for a range - def calcBin(start, end): get the bin for a range - def __getOverlappingBinsForOff...
5889b03380d92455b909c1ca0535fd590abbbe54
<|skeleton|> class Binner: """functions to translate ranges to bin numbers""" def __calcBinForOffsets(start, end, baseOffset, offsets): """get the bin for a range""" <|body_0|> def calcBin(start, end): """get the bin for a range""" <|body_1|> def __getOverlappingBinsFo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Binner: """functions to translate ranges to bin numbers""" def __calcBinForOffsets(start, end, baseOffset, offsets): """get the bin for a range""" startBin = start >> Binner.binFirstShift endBin = end - 1 >> Binner.binFirstShift for binOff in offsets: if startB...
the_stack_v2_python_sparse
tools/rangeFinder.py
ComparativeGenomicsToolkit/Comparative-Annotation-Toolkit
train
144
7c459991652686190842ef83ace793a4e4560cd2
[ "self.nwalkers = nwalkers\nself.ndim = ndim\nself.nelec = nelec\nself.init_domain = init\nself.pos = None\nself.status = None\nself.cuda = cuda\nif cuda:\n self.device = torch.device('cuda')\nelse:\n self.device = torch.device('cpu')", "if self.cuda:\n self.device = torch.device('cuda')\nif pos is not No...
<|body_start_0|> self.nwalkers = nwalkers self.ndim = ndim self.nelec = nelec self.init_domain = init self.pos = None self.status = None self.cuda = cuda if cuda: self.device = torch.device('cuda') else: self.device = torch....
Walkers
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Walkers: def __init__(self, nwalkers: int=100, nelec: int=1, ndim: int=3, init: Union[Dict, None]=None, cuda: bool=False): """Creates Walkers for the sampler. Args: nwalkers (int, optional): Number of walkers. Defaults to 100. nelec (int, optional): number of electron. Defaults to 1. ndi...
stack_v2_sparse_classes_36k_train_020972
4,967
permissive
[ { "docstring": "Creates Walkers for the sampler. Args: nwalkers (int, optional): Number of walkers. Defaults to 100. nelec (int, optional): number of electron. Defaults to 1. ndim (int, optional): Number of dimensions. Defaults to 3. init (dict, optional): method to initialize the walkers. Defaults to None. (se...
6
null
Implement the Python class `Walkers` described below. Class description: Implement the Walkers class. Method signatures and docstrings: - def __init__(self, nwalkers: int=100, nelec: int=1, ndim: int=3, init: Union[Dict, None]=None, cuda: bool=False): Creates Walkers for the sampler. Args: nwalkers (int, optional): N...
Implement the Python class `Walkers` described below. Class description: Implement the Walkers class. Method signatures and docstrings: - def __init__(self, nwalkers: int=100, nelec: int=1, ndim: int=3, init: Union[Dict, None]=None, cuda: bool=False): Creates Walkers for the sampler. Args: nwalkers (int, optional): N...
439a79e97ee63057e3032d28a1a5ebafd2d5b5e4
<|skeleton|> class Walkers: def __init__(self, nwalkers: int=100, nelec: int=1, ndim: int=3, init: Union[Dict, None]=None, cuda: bool=False): """Creates Walkers for the sampler. Args: nwalkers (int, optional): Number of walkers. Defaults to 100. nelec (int, optional): number of electron. Defaults to 1. ndi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Walkers: def __init__(self, nwalkers: int=100, nelec: int=1, ndim: int=3, init: Union[Dict, None]=None, cuda: bool=False): """Creates Walkers for the sampler. Args: nwalkers (int, optional): Number of walkers. Defaults to 100. nelec (int, optional): number of electron. Defaults to 1. ndim (int, option...
the_stack_v2_python_sparse
qmctorch/sampler/walkers.py
NLESC-JCER/QMCTorch
train
22
76a85141c7322572151b5e01e3b127e88c2fa269
[ "jsonschema.Draft4Validator.check_schema(schema)\nself.validator = jsonschema.Draft4Validator(schema)\nassert isinstance(field_vals, dict)\nassert all((isinstance(val, list) for val in field_vals.values()))\nself.field_vals = {field: frozenset(vals) for field, vals in field_vals.items()}", "issues = list(self.val...
<|body_start_0|> jsonschema.Draft4Validator.check_schema(schema) self.validator = jsonschema.Draft4Validator(schema) assert isinstance(field_vals, dict) assert all((isinstance(val, list) for val in field_vals.values())) self.field_vals = {field: frozenset(vals) for field, vals in...
Validate a single question against the schema.
QValidator
[ "MIT", "CC-BY-SA-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QValidator: """Validate a single question against the schema.""" def __init__(self, schema, field_vals={}): """Create a new QValidator with the given `schema` dict. :param dict(str, list(str)) field_vals: For each key present, ensure the corresponding key in a question maps to a subs...
stack_v2_sparse_classes_36k_train_020973
3,215
permissive
[ { "docstring": "Create a new QValidator with the given `schema` dict. :param dict(str, list(str)) field_vals: For each key present, ensure the corresponding key in a question maps to a subset of the given value.", "name": "__init__", "signature": "def __init__(self, schema, field_vals={})" }, { ...
2
null
Implement the Python class `QValidator` described below. Class description: Validate a single question against the schema. Method signatures and docstrings: - def __init__(self, schema, field_vals={}): Create a new QValidator with the given `schema` dict. :param dict(str, list(str)) field_vals: For each key present, ...
Implement the Python class `QValidator` described below. Class description: Validate a single question against the schema. Method signatures and docstrings: - def __init__(self, schema, field_vals={}): Create a new QValidator with the given `schema` dict. :param dict(str, list(str)) field_vals: For each key present, ...
2cb4b45dd14a230aa0e800042e893f8dfb23beda
<|skeleton|> class QValidator: """Validate a single question against the schema.""" def __init__(self, schema, field_vals={}): """Create a new QValidator with the given `schema` dict. :param dict(str, list(str)) field_vals: For each key present, ensure the corresponding key in a question maps to a subs...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QValidator: """Validate a single question against the schema.""" def __init__(self, schema, field_vals={}): """Create a new QValidator with the given `schema` dict. :param dict(str, list(str)) field_vals: For each key present, ensure the corresponding key in a question maps to a subset of the giv...
the_stack_v2_python_sparse
_Job-Search/interview-questions-master/validate.py
bgoonz/UsefulResourceRepo2.0
train
10
3c5070507aac4c54dc51a619dced20d44993a80b
[ "prev = -1\nres = float('-inf')\nif seats[0] == 1:\n prev = 0\nfor i, seat in enumerate(seats):\n if i == 1:\n if prev == -1:\n res = max(res, i)\n else:\n res = max(res, (i - prev) // 2)\n prev = i\nif seat[-1] == 0:\n res = max(res, len(seats) - 1 - prev)\nretur...
<|body_start_0|> prev = -1 res = float('-inf') if seats[0] == 1: prev = 0 for i, seat in enumerate(seats): if i == 1: if prev == -1: res = max(res, i) else: res = max(res, (i - prev) // 2) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxDistToClosest2(self, seats): """:type seats: List[int] :rtype: int""" <|body_0|> def maxDistToClosest(self, seats): """:type seats: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> prev = -1 res = float(...
stack_v2_sparse_classes_36k_train_020974
1,617
no_license
[ { "docstring": ":type seats: List[int] :rtype: int", "name": "maxDistToClosest2", "signature": "def maxDistToClosest2(self, seats)" }, { "docstring": ":type seats: List[int] :rtype: int", "name": "maxDistToClosest", "signature": "def maxDistToClosest(self, seats)" } ]
2
stack_v2_sparse_classes_30k_train_021066
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxDistToClosest2(self, seats): :type seats: List[int] :rtype: int - def maxDistToClosest(self, seats): :type seats: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxDistToClosest2(self, seats): :type seats: List[int] :rtype: int - def maxDistToClosest(self, seats): :type seats: List[int] :rtype: int <|skeleton|> class Solution: ...
1a3c1f4d6e9d3444039f087763b93241f4ba7892
<|skeleton|> class Solution: def maxDistToClosest2(self, seats): """:type seats: List[int] :rtype: int""" <|body_0|> def maxDistToClosest(self, seats): """:type seats: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxDistToClosest2(self, seats): """:type seats: List[int] :rtype: int""" prev = -1 res = float('-inf') if seats[0] == 1: prev = 0 for i, seat in enumerate(seats): if i == 1: if prev == -1: res = m...
the_stack_v2_python_sparse
Algorithm/849_Max_Distance_To_Closest_People.py
Gi1ia/TechNoteBook
train
7
53b4a1cbbf1dd4744a57e15fb25741cbbf2c088d
[ "time = timezone.now() + datetime.timedelta(days=10)\nq = Question(question_text='Are we in future??', pub_date=time)\nself.assertIs(q.was_published_recently(), False)", "time = timezone.now() - datetime.timedelta(days=2)\nq = Question(question_text='Are we in future??', pub_date=time)\nself.assertIs(q.was_publis...
<|body_start_0|> time = timezone.now() + datetime.timedelta(days=10) q = Question(question_text='Are we in future??', pub_date=time) self.assertIs(q.was_published_recently(), False) <|end_body_0|> <|body_start_1|> time = timezone.now() - datetime.timedelta(days=2) q = Question(q...
QuestionMethodTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionMethodTests: def test_was_published_recently_with_future_question(self): """was_published_recently should return False if published date is in the future.""" <|body_0|> def test_was_published_recently_with_old_question(self): """was_published_recently should ...
stack_v2_sparse_classes_36k_train_020975
4,246
no_license
[ { "docstring": "was_published_recently should return False if published date is in the future.", "name": "test_was_published_recently_with_future_question", "signature": "def test_was_published_recently_with_future_question(self)" }, { "docstring": "was_published_recently should return False if ...
4
null
Implement the Python class `QuestionMethodTests` described below. Class description: Implement the QuestionMethodTests class. Method signatures and docstrings: - def test_was_published_recently_with_future_question(self): was_published_recently should return False if published date is in the future. - def test_was_pu...
Implement the Python class `QuestionMethodTests` described below. Class description: Implement the QuestionMethodTests class. Method signatures and docstrings: - def test_was_published_recently_with_future_question(self): was_published_recently should return False if published date is in the future. - def test_was_pu...
acbb6d21a8182feabcb3329e17c76ac3af375255
<|skeleton|> class QuestionMethodTests: def test_was_published_recently_with_future_question(self): """was_published_recently should return False if published date is in the future.""" <|body_0|> def test_was_published_recently_with_old_question(self): """was_published_recently should ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuestionMethodTests: def test_was_published_recently_with_future_question(self): """was_published_recently should return False if published date is in the future.""" time = timezone.now() + datetime.timedelta(days=10) q = Question(question_text='Are we in future??', pub_date=time) ...
the_stack_v2_python_sparse
pythonTutorial/django/mysite/polls/tests.py
rajatgirotra/study
train
6
2b2b3b8c712bc4e12329ec12fd1664201ac5fd9b
[ "if len(ransomNote) > len(magazine):\n return False\nd = dict()\nfor char in magazine:\n if char in d:\n d[char] = d[char] + 1\n else:\n d[char] = 1\nfor char in ransomNote:\n if char in d and d[char] > 0:\n d[char] = d[char] - 1\n else:\n return False\nreturn True", "if...
<|body_start_0|> if len(ransomNote) > len(magazine): return False d = dict() for char in magazine: if char in d: d[char] = d[char] + 1 else: d[char] = 1 for char in ransomNote: if char in d and d[char] > 0: ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canConstruct1(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" <|body_0|> def canConstruct2(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k_train_020976
996
permissive
[ { "docstring": ":type ransomNote: str :type magazine: str :rtype: bool", "name": "canConstruct1", "signature": "def canConstruct1(self, ransomNote, magazine)" }, { "docstring": ":type ransomNote: str :type magazine: str :rtype: bool", "name": "canConstruct2", "signature": "def canConstru...
2
stack_v2_sparse_classes_30k_train_001975
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canConstruct1(self, ransomNote, magazine): :type ransomNote: str :type magazine: str :rtype: bool - def canConstruct2(self, ransomNote, magazine): :type ransomNote: str :type...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canConstruct1(self, ransomNote, magazine): :type ransomNote: str :type magazine: str :rtype: bool - def canConstruct2(self, ransomNote, magazine): :type ransomNote: str :type...
03876232521a20d32f8fa4e7d6d19cf208739a79
<|skeleton|> class Solution: def canConstruct1(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" <|body_0|> def canConstruct2(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canConstruct1(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" if len(ransomNote) > len(magazine): return False d = dict() for char in magazine: if char in d: d[char] = d[char] + 1 ...
the_stack_v2_python_sparse
Python/ransom-note.py
coolryze/LeetCode
train
4
46fbc83852d00ff2a80b2b00ffcb099e9e96064f
[ "UVMSequenceItem.__init__(self, name)\nself.value: List[int] = [0]\nself.path = UVM_FRONTDOOR\nself.status = 0\nself.fname = ''\nself.lineno = 0\nself.bd_kind = ''\nself.prior = -1\nself.extension = None\nself.parent = None\nself.offset = 0\nself.kind = UVM_READ\nself.element = None\nself.element_kind = -1\nself.ma...
<|body_start_0|> UVMSequenceItem.__init__(self, name) self.value: List[int] = [0] self.path = UVM_FRONTDOOR self.status = 0 self.fname = '' self.lineno = 0 self.bd_kind = '' self.prior = -1 self.extension = None self.parent = None s...
CLASS: UVMRegItem Defines an abstract register transaction item. No bus-specific information is present, although a handle to a `UVMRegMap` is provided in case a user wishes to implement a custom address translation algorithm.
UVMRegItem
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UVMRegItem: """CLASS: UVMRegItem Defines an abstract register transaction item. No bus-specific information is present, although a handle to a `UVMRegMap` is provided in case a user wishes to implement a custom address translation algorithm.""" def __init__(self, name='') -> None: ""...
stack_v2_sparse_classes_36k_train_020977
9,874
permissive
[ { "docstring": "Create a new instance of this type, giving it the optional `name`. Args: name (str): Name of the instance", "name": "__init__", "signature": "def __init__(self, name='') -> None" }, { "docstring": "Function: convert2string Returns a string showing the contents of this transaction...
3
stack_v2_sparse_classes_30k_train_017314
Implement the Python class `UVMRegItem` described below. Class description: CLASS: UVMRegItem Defines an abstract register transaction item. No bus-specific information is present, although a handle to a `UVMRegMap` is provided in case a user wishes to implement a custom address translation algorithm. Method signatur...
Implement the Python class `UVMRegItem` described below. Class description: CLASS: UVMRegItem Defines an abstract register transaction item. No bus-specific information is present, although a handle to a `UVMRegMap` is provided in case a user wishes to implement a custom address translation algorithm. Method signatur...
fc5f955701b2b56c1fddac195c70cb3ebb9139fe
<|skeleton|> class UVMRegItem: """CLASS: UVMRegItem Defines an abstract register transaction item. No bus-specific information is present, although a handle to a `UVMRegMap` is provided in case a user wishes to implement a custom address translation algorithm.""" def __init__(self, name='') -> None: ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UVMRegItem: """CLASS: UVMRegItem Defines an abstract register transaction item. No bus-specific information is present, although a handle to a `UVMRegMap` is provided in case a user wishes to implement a custom address translation algorithm.""" def __init__(self, name='') -> None: """Create a new...
the_stack_v2_python_sparse
src/uvm/reg/uvm_reg_item.py
tpoikela/uvm-python
train
199
c970759c31ed17d65566c66f589bc780431f8463
[ "signature, key = read_fmt('4sH', fp)\ntry:\n key = ImageResourceID(key)\nexcept ValueError:\n if ImageResourceID.is_path_info(key):\n logger.debug('Undefined PATH_INFO found: %d' % key)\n elif ImageResourceID.is_plugin_resource(key):\n logger.debug('Undefined PLUGIN_RESOURCE found: %d' % key...
<|body_start_0|> signature, key = read_fmt('4sH', fp) try: key = ImageResourceID(key) except ValueError: if ImageResourceID.is_path_info(key): logger.debug('Undefined PATH_INFO found: %d' % key) elif ImageResourceID.is_plugin_resource(key): ...
Image resource block. .. py:attribute:: signature Binary signature, always ``b'8BIM'``. .. py:attribute:: key Unique identifier for the resource. See :py:class:`~psd_tools.constants.ImageResourceID`. .. py:attribute:: name .. py:attribute:: data The resource data.
ImageResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageResource: """Image resource block. .. py:attribute:: signature Binary signature, always ``b'8BIM'``. .. py:attribute:: key Unique identifier for the resource. See :py:class:`~psd_tools.constants.ImageResourceID`. .. py:attribute:: name .. py:attribute:: data The resource data.""" def re...
stack_v2_sparse_classes_36k_train_020978
30,369
permissive
[ { "docstring": "Read the element from a file-like object. :param fp: file-like object :rtype: :py:class:`.ImageResource`", "name": "read", "signature": "def read(cls, fp, encoding='macroman')" }, { "docstring": "Write the element to a file-like object. :param fp: file-like object :rtype: int", ...
2
stack_v2_sparse_classes_30k_train_001573
Implement the Python class `ImageResource` described below. Class description: Image resource block. .. py:attribute:: signature Binary signature, always ``b'8BIM'``. .. py:attribute:: key Unique identifier for the resource. See :py:class:`~psd_tools.constants.ImageResourceID`. .. py:attribute:: name .. py:attribute::...
Implement the Python class `ImageResource` described below. Class description: Image resource block. .. py:attribute:: signature Binary signature, always ``b'8BIM'``. .. py:attribute:: key Unique identifier for the resource. See :py:class:`~psd_tools.constants.ImageResourceID`. .. py:attribute:: name .. py:attribute::...
0e3ac5b64061c7eb87c6eeacce4b9792d1f479b5
<|skeleton|> class ImageResource: """Image resource block. .. py:attribute:: signature Binary signature, always ``b'8BIM'``. .. py:attribute:: key Unique identifier for the resource. See :py:class:`~psd_tools.constants.ImageResourceID`. .. py:attribute:: name .. py:attribute:: data The resource data.""" def re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageResource: """Image resource block. .. py:attribute:: signature Binary signature, always ``b'8BIM'``. .. py:attribute:: key Unique identifier for the resource. See :py:class:`~psd_tools.constants.ImageResourceID`. .. py:attribute:: name .. py:attribute:: data The resource data.""" def read(cls, fp, e...
the_stack_v2_python_sparse
psd_tools/psd/image_resources.py
sfneal/psd-tools3
train
30
711d3d0969e312c9f467c2458b9d17def42666e8
[ "super(BottleNeck, self).__init__()\nself.inp_bn = inp_bn\nadd_block = []\nif droprate > 0:\n add_block += [nn.Dropout(p=droprate)]\nadd_block += [nn.Linear(input_dim, num_bottleneck)]\nadd_block += [nn.BatchNorm1D(num_bottleneck)]\nadd_block += [nn.LeakyReLU(0.1)]\nadd_block = nn.Sequential(*add_block)\nself.ad...
<|body_start_0|> super(BottleNeck, self).__init__() self.inp_bn = inp_bn add_block = [] if droprate > 0: add_block += [nn.Dropout(p=droprate)] add_block += [nn.Linear(input_dim, num_bottleneck)] add_block += [nn.BatchNorm1D(num_bottleneck)] add_block +...
bottleneck
BottleNeck
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BottleNeck: """bottleneck""" def __init__(self, input_dim, num_bottleneck, droprate=0.5, inp_bn=False): """init""" <|body_0|> def forward(self, x): """forward""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(BottleNeck, self).__init__() ...
stack_v2_sparse_classes_36k_train_020979
994
permissive
[ { "docstring": "init", "name": "__init__", "signature": "def __init__(self, input_dim, num_bottleneck, droprate=0.5, inp_bn=False)" }, { "docstring": "forward", "name": "forward", "signature": "def forward(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_015936
Implement the Python class `BottleNeck` described below. Class description: bottleneck Method signatures and docstrings: - def __init__(self, input_dim, num_bottleneck, droprate=0.5, inp_bn=False): init - def forward(self, x): forward
Implement the Python class `BottleNeck` described below. Class description: bottleneck Method signatures and docstrings: - def __init__(self, input_dim, num_bottleneck, droprate=0.5, inp_bn=False): init - def forward(self, x): forward <|skeleton|> class BottleNeck: """bottleneck""" def __init__(self, input_...
b8ec015fa9e16c0a879c619ee1f2aab8a393c7bd
<|skeleton|> class BottleNeck: """bottleneck""" def __init__(self, input_dim, num_bottleneck, droprate=0.5, inp_bn=False): """init""" <|body_0|> def forward(self, x): """forward""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BottleNeck: """bottleneck""" def __init__(self, input_dim, num_bottleneck, droprate=0.5, inp_bn=False): """init""" super(BottleNeck, self).__init__() self.inp_bn = inp_bn add_block = [] if droprate > 0: add_block += [nn.Dropout(p=droprate)] add_...
the_stack_v2_python_sparse
ST_DM/KDD2022-DuMapper/DME/arch/gears/neck.py
sserdoubleh/Research
train
10
30bd1d1296bad3941e7174f1fc07a2e29b80ab5e
[ "self.num_points = num_points\nself.x_values = [init_coords[0]]\nself.y_values = [init_coords[1]]\nself.z_values = [init_coords[2]]\nself.theta_ = []\nself.phi_ = []\nself.theta = 0\nself.theta_.append(self.theta)\nself.phi = init_phi\nself.phi_.append(self.phi)\nself.deltaTheta = 0\nself.deltaPhi = 0", "while le...
<|body_start_0|> self.num_points = num_points self.x_values = [init_coords[0]] self.y_values = [init_coords[1]] self.z_values = [init_coords[2]] self.theta_ = [] self.phi_ = [] self.theta = 0 self.theta_.append(self.theta) self.phi = init_phi ...
A class to generate random datas.
GenerateLine3D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GenerateLine3D: """A class to generate random datas.""" def __init__(self, init_coords=[], init_theta=0, init_phi=0, num_points=5000): """Initialize attributes of a data.""" <|body_0|> def fill_points(self): """Calculate all the points in the data.""" <|b...
stack_v2_sparse_classes_36k_train_020980
20,287
no_license
[ { "docstring": "Initialize attributes of a data.", "name": "__init__", "signature": "def __init__(self, init_coords=[], init_theta=0, init_phi=0, num_points=5000)" }, { "docstring": "Calculate all the points in the data.", "name": "fill_points", "signature": "def fill_points(self)" } ]
2
stack_v2_sparse_classes_30k_train_012986
Implement the Python class `GenerateLine3D` described below. Class description: A class to generate random datas. Method signatures and docstrings: - def __init__(self, init_coords=[], init_theta=0, init_phi=0, num_points=5000): Initialize attributes of a data. - def fill_points(self): Calculate all the points in the...
Implement the Python class `GenerateLine3D` described below. Class description: A class to generate random datas. Method signatures and docstrings: - def __init__(self, init_coords=[], init_theta=0, init_phi=0, num_points=5000): Initialize attributes of a data. - def fill_points(self): Calculate all the points in the...
6e7a278031ff0a1eb51e7810b326d66524d4aef3
<|skeleton|> class GenerateLine3D: """A class to generate random datas.""" def __init__(self, init_coords=[], init_theta=0, init_phi=0, num_points=5000): """Initialize attributes of a data.""" <|body_0|> def fill_points(self): """Calculate all the points in the data.""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GenerateLine3D: """A class to generate random datas.""" def __init__(self, init_coords=[], init_theta=0, init_phi=0, num_points=5000): """Initialize attributes of a data.""" self.num_points = num_points self.x_values = [init_coords[0]] self.y_values = [init_coords[1]] ...
the_stack_v2_python_sparse
check_data/generate_data/generate_data.py
c-feng/Neuron-Tracking
train
1
c1e287f1ad9aa7f3f2fffae267ba8339c549fb9f
[ "dl = DisplayList()\nam = IAddressManagement(self)\nfor address in am.getAddresses():\n dl.add(address.getId(), address.getName() + ' - ' + address.getAddress1())\nreturn dl", "dl = DisplayList()\npm = IShippingManagement(self.getShop())\nfor shipping_method in pm.getShippingMethods():\n dl.add(shipping_met...
<|body_start_0|> dl = DisplayList() am = IAddressManagement(self) for address in am.getAddresses(): dl.add(address.getId(), address.getName() + ' - ' + address.getAddress1()) return dl <|end_body_0|> <|body_start_1|> dl = DisplayList() pm = IShippingManagemen...
A customer can buy products from a shop. A customer has addresses and payment methods. A customer exists additionally to the members of Plone. Whenever a member wants to buy something a customer content object is added for this member. This is intended to be changed to use remember in future.
Customer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Customer: """A customer can buy products from a shop. A customer has addresses and payment methods. A customer exists additionally to the members of Plone. Whenever a member wants to buy something a customer content object is added for this member. This is intended to be changed to use remember i...
stack_v2_sparse_classes_36k_train_020981
4,537
no_license
[ { "docstring": "Returns all addresses as DisplayList.", "name": "_getAddressesAsDL", "signature": "def _getAddressesAsDL(self)" }, { "docstring": "Returns all shipping methods as DisplayList.", "name": "_getShippingMethodsAsDL", "signature": "def _getShippingMethodsAsDL(self)" }, { ...
3
null
Implement the Python class `Customer` described below. Class description: A customer can buy products from a shop. A customer has addresses and payment methods. A customer exists additionally to the members of Plone. Whenever a member wants to buy something a customer content object is added for this member. This is i...
Implement the Python class `Customer` described below. Class description: A customer can buy products from a shop. A customer has addresses and payment methods. A customer exists additionally to the members of Plone. Whenever a member wants to buy something a customer content object is added for this member. This is i...
26e9a40f8e25684a1c156ac1cea08e6796e4c2d7
<|skeleton|> class Customer: """A customer can buy products from a shop. A customer has addresses and payment methods. A customer exists additionally to the members of Plone. Whenever a member wants to buy something a customer content object is added for this member. This is intended to be changed to use remember i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Customer: """A customer can buy products from a shop. A customer has addresses and payment methods. A customer exists additionally to the members of Plone. Whenever a member wants to buy something a customer content object is added for this member. This is intended to be changed to use remember in future.""" ...
the_stack_v2_python_sparse
Attic_from_svn_import/easyshop.customer/easyshop/customer/content/customer.py
Easyshop/Easyshop
train
3
40ecb2662a9d3b74b1bfb38180ba8a4fe3e436db
[ "self.delay = delay\nself.ticks = ticks\nself.tick_count = 0\nself.timer = None\nself.done = False\nself.callback = callback", "if not self.timer:\n self.timer = now\n self.callback(self.tick_count)\nelif not self.done and now - self.timer > self.delay:\n self.tick_count += 1\n self.timer = now\n i...
<|body_start_0|> self.delay = delay self.ticks = ticks self.tick_count = 0 self.timer = None self.done = False self.callback = callback <|end_body_0|> <|body_start_1|> if not self.timer: self.timer = now self.callback(self.tick_count) ...
Very simple timer. It does not take care about how late it checks tick.
Timer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Timer: """Very simple timer. It does not take care about how late it checks tick.""" def __init__(self, delay, callback, ticks=-1): """Delay is given in milliseconds; ticks is a number of ticks the timer will make before setting self.done to True. Pass a value -1 to bypass. callback ...
stack_v2_sparse_classes_36k_train_020982
4,928
no_license
[ { "docstring": "Delay is given in milliseconds; ticks is a number of ticks the timer will make before setting self.done to True. Pass a value -1 to bypass. callback specify function of one argument (tick count), that is called when 'delay' passed, but it is not called automaticly - check_tick must be called.", ...
2
stack_v2_sparse_classes_30k_train_013460
Implement the Python class `Timer` described below. Class description: Very simple timer. It does not take care about how late it checks tick. Method signatures and docstrings: - def __init__(self, delay, callback, ticks=-1): Delay is given in milliseconds; ticks is a number of ticks the timer will make before settin...
Implement the Python class `Timer` described below. Class description: Very simple timer. It does not take care about how late it checks tick. Method signatures and docstrings: - def __init__(self, delay, callback, ticks=-1): Delay is given in milliseconds; ticks is a number of ticks the timer will make before settin...
026ef53b5ed9683691b8f136ceae756fe6dd7f07
<|skeleton|> class Timer: """Very simple timer. It does not take care about how late it checks tick.""" def __init__(self, delay, callback, ticks=-1): """Delay is given in milliseconds; ticks is a number of ticks the timer will make before setting self.done to True. Pass a value -1 to bypass. callback ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Timer: """Very simple timer. It does not take care about how late it checks tick.""" def __init__(self, delay, callback, ticks=-1): """Delay is given in milliseconds; ticks is a number of ticks the timer will make before setting self.done to True. Pass a value -1 to bypass. callback specify funct...
the_stack_v2_python_sparse
data/tools.py
jpaulovic/Asteroids
train
0
acb3b08a4bcde379f3affcc629e731e68fba24be
[ "review_id = label.review_id\nlast_review_id = label.last_review_id\ntext_id = label.text_id\nlast_text_id = label.last_text_id\nreview = label.review\ntext = label.text\nlabel_attrs = label.attributes\npred_attrs = pred.attributes\nattr_annotation_pairs = zip(label_attrs, pred_attrs)\nfor label_attr_annotation, pr...
<|body_start_0|> review_id = label.review_id last_review_id = label.last_review_id text_id = label.text_id last_text_id = label.last_text_id review = label.review text = label.text label_attrs = label.attributes pred_attrs = pred.attributes attr_an...
定量評価または、エラー分析に使いやすいようにフォーマットを定めたクラス Attributes: review_id (int): レビュー番号 last_review_id (int): 最後のレビュー番号 text_id (int): レビュー文中の文番号 last_text_id (int): レビュー文中の最後の文番号 review (str): レビュー本文 text (str): 評価対象の文 label (int): 正解ラベル pred (int): 属性抽出結果 label_attrs (Tuple[AttrAnnotation, ...]): 正解アノテーション pred_attrs (Tuple[AttrAnno...
DataForEvaluation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataForEvaluation: """定量評価または、エラー分析に使いやすいようにフォーマットを定めたクラス Attributes: review_id (int): レビュー番号 last_review_id (int): 最後のレビュー番号 text_id (int): レビュー文中の文番号 last_text_id (int): レビュー文中の最後の文番号 review (str): レビュー本文 text (str): 評価対象の文 label (int): 正解ラベル pred (int): 属性抽出結果 label_attrs (Tuple[AttrAnnotation...
stack_v2_sparse_classes_36k_train_020983
10,681
no_license
[ { "docstring": "正解データと属性抽出結果データからインスタンス化し、属性ごとにインスタンスを返すジェネレータ関数 Args: pred (TextWithAttrAnnotation): 属性抽出結果データ label (TextWithAttrAnnotation): 正解データ Returns: 属性とそれに対応するDataForEvaluationインスタンスのジェネレータ", "name": "iterator_from_text_with_annotation_pair", "signature": "def iterator_from_text_with_annotatio...
2
stack_v2_sparse_classes_30k_train_003905
Implement the Python class `DataForEvaluation` described below. Class description: 定量評価または、エラー分析に使いやすいようにフォーマットを定めたクラス Attributes: review_id (int): レビュー番号 last_review_id (int): 最後のレビュー番号 text_id (int): レビュー文中の文番号 last_text_id (int): レビュー文中の最後の文番号 review (str): レビュー本文 text (str): 評価対象の文 label (int): 正解ラベル pred (int): 属...
Implement the Python class `DataForEvaluation` described below. Class description: 定量評価または、エラー分析に使いやすいようにフォーマットを定めたクラス Attributes: review_id (int): レビュー番号 last_review_id (int): 最後のレビュー番号 text_id (int): レビュー文中の文番号 last_text_id (int): レビュー文中の最後の文番号 review (str): レビュー本文 text (str): 評価対象の文 label (int): 正解ラベル pred (int): 属...
a4c6334b779a94814b7798a0fbfe9a148bf18d3a
<|skeleton|> class DataForEvaluation: """定量評価または、エラー分析に使いやすいようにフォーマットを定めたクラス Attributes: review_id (int): レビュー番号 last_review_id (int): 最後のレビュー番号 text_id (int): レビュー文中の文番号 last_text_id (int): レビュー文中の最後の文番号 review (str): レビュー本文 text (str): 評価対象の文 label (int): 正解ラベル pred (int): 属性抽出結果 label_attrs (Tuple[AttrAnnotation...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataForEvaluation: """定量評価または、エラー分析に使いやすいようにフォーマットを定めたクラス Attributes: review_id (int): レビュー番号 last_review_id (int): 最後のレビュー番号 text_id (int): レビュー文中の文番号 last_text_id (int): レビュー文中の最後の文番号 review (str): レビュー本文 text (str): 評価対象の文 label (int): 正解ラベル pred (int): 属性抽出結果 label_attrs (Tuple[AttrAnnotation, ...]): 正解アノ...
the_stack_v2_python_sparse
src/review_research/evaluation/attr_extraction_evaluater.py
S38knt-ks/ReviewResearch
train
0
12345da3ad71cbbda7c47bc19e76481739bfc0da
[ "with open(filepath) as fp:\n self.data = fp.read().splitlines()\nself.width = len(self.data[0])\nself.x = 0\nself.y = 0\nself.placement = (0, 0)", "_x = (self.placement[0] + self.x) % self.width\n_y = (self.placement[0] + self.y) % self.width\nself.placement = (_x, _y)", "self.x = x\nself.y = y\nself.placem...
<|body_start_0|> with open(filepath) as fp: self.data = fp.read().splitlines() self.width = len(self.data[0]) self.x = 0 self.y = 0 self.placement = (0, 0) <|end_body_0|> <|body_start_1|> _x = (self.placement[0] + self.x) % self.width _y = (self.place...
Generic Sled class
Sled
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sled: """Generic Sled class""" def __init__(self, filepath): """init""" <|body_0|> def _new_position(self): """calc new position""" <|body_1|> def find_trees(self, x, y): """find the trees in the way based on slope""" <|body_2|> <|en...
stack_v2_sparse_classes_36k_train_020984
1,345
permissive
[ { "docstring": "init", "name": "__init__", "signature": "def __init__(self, filepath)" }, { "docstring": "calc new position", "name": "_new_position", "signature": "def _new_position(self)" }, { "docstring": "find the trees in the way based on slope", "name": "find_trees", ...
3
stack_v2_sparse_classes_30k_train_004596
Implement the Python class `Sled` described below. Class description: Generic Sled class Method signatures and docstrings: - def __init__(self, filepath): init - def _new_position(self): calc new position - def find_trees(self, x, y): find the trees in the way based on slope
Implement the Python class `Sled` described below. Class description: Generic Sled class Method signatures and docstrings: - def __init__(self, filepath): init - def _new_position(self): calc new position - def find_trees(self, x, y): find the trees in the way based on slope <|skeleton|> class Sled: """Generic S...
9481e4b518eacb86beb42f83906872dcc871c3f7
<|skeleton|> class Sled: """Generic Sled class""" def __init__(self, filepath): """init""" <|body_0|> def _new_position(self): """calc new position""" <|body_1|> def find_trees(self, x, y): """find the trees in the way based on slope""" <|body_2|> <|en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Sled: """Generic Sled class""" def __init__(self, filepath): """init""" with open(filepath) as fp: self.data = fp.read().splitlines() self.width = len(self.data[0]) self.x = 0 self.y = 0 self.placement = (0, 0) def _new_position(self): ...
the_stack_v2_python_sparse
day3/run.py
layertwo/adventofcode2020
train
0
707aef503547fc51c6b2fb2e8bff1d3cb6419ff3
[ "super().__init__(hass=hass, logger=_LOGGER, name=name, update_interval=timedelta(minutes=5))\nself.api = api\nself.name = name\nself.latitude = int(latitude)\nself.longitude = int(longitude)\nself.threshold = int(threshold)", "try:\n return await self.api.get_forecast_data(self.longitude, self.latitude)\nexce...
<|body_start_0|> super().__init__(hass=hass, logger=_LOGGER, name=name, update_interval=timedelta(minutes=5)) self.api = api self.name = name self.latitude = int(latitude) self.longitude = int(longitude) self.threshold = int(threshold) <|end_body_0|> <|body_start_1|> ...
Class to manage fetching data from the NOAA Aurora API.
AuroraDataUpdateCoordinator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuroraDataUpdateCoordinator: """Class to manage fetching data from the NOAA Aurora API.""" def __init__(self, hass: HomeAssistant, name: str, api: AuroraForecast, latitude: float, longitude: float, threshold: float) -> None: """Initialize the data updater.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_020985
1,334
permissive
[ { "docstring": "Initialize the data updater.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant, name: str, api: AuroraForecast, latitude: float, longitude: float, threshold: float) -> None" }, { "docstring": "Fetch the data from the NOAA Aurora Forecast.", "name": "_...
2
null
Implement the Python class `AuroraDataUpdateCoordinator` described below. Class description: Class to manage fetching data from the NOAA Aurora API. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, name: str, api: AuroraForecast, latitude: float, longitude: float, threshold: float) -> None:...
Implement the Python class `AuroraDataUpdateCoordinator` described below. Class description: Class to manage fetching data from the NOAA Aurora API. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, name: str, api: AuroraForecast, latitude: float, longitude: float, threshold: float) -> None:...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class AuroraDataUpdateCoordinator: """Class to manage fetching data from the NOAA Aurora API.""" def __init__(self, hass: HomeAssistant, name: str, api: AuroraForecast, latitude: float, longitude: float, threshold: float) -> None: """Initialize the data updater.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuroraDataUpdateCoordinator: """Class to manage fetching data from the NOAA Aurora API.""" def __init__(self, hass: HomeAssistant, name: str, api: AuroraForecast, latitude: float, longitude: float, threshold: float) -> None: """Initialize the data updater.""" super().__init__(hass=hass, l...
the_stack_v2_python_sparse
homeassistant/components/aurora/coordinator.py
home-assistant/core
train
35,501
afda35c857caf037e0b4e2803a1860c2a1f9fce2
[ "self.client = None\nself.channel = None\nself.delimiter = delimiter", "start = time()\nclient = paramiko.SSHClient()\nclient.set_missing_host_key_policy(paramiko.AutoAddPolicy())\nclient.connect(node['host'], username=node['honeycomb']['user'], password=node['honeycomb']['passwd'], pkey=None, port=node['honeycom...
<|body_start_0|> self.client = None self.channel = None self.delimiter = delimiter <|end_body_0|> <|body_start_1|> start = time() client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect(node['host'], username=node...
Implements methods for creating and managing Netconf sessions.
Netconf
[ "CC-BY-4.0", "Apache-2.0", "LicenseRef-scancode-dco-1.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Netconf: """Implements methods for creating and managing Netconf sessions.""" def __init__(self, delimiter=']]>]]>'): """Initializer. Note: Passing the channel object as a robotframework argument closes the channel. Class variables are used instead, to persist the connection channel ...
stack_v2_sparse_classes_36k_train_020986
5,637
permissive
[ { "docstring": "Initializer. Note: Passing the channel object as a robotframework argument closes the channel. Class variables are used instead, to persist the connection channel throughout test cases.", "name": "__init__", "signature": "def __init__(self, delimiter=']]>]]>')" }, { "docstring": ...
5
stack_v2_sparse_classes_30k_val_000016
Implement the Python class `Netconf` described below. Class description: Implements methods for creating and managing Netconf sessions. Method signatures and docstrings: - def __init__(self, delimiter=']]>]]>'): Initializer. Note: Passing the channel object as a robotframework argument closes the channel. Class varia...
Implement the Python class `Netconf` described below. Class description: Implements methods for creating and managing Netconf sessions. Method signatures and docstrings: - def __init__(self, delimiter=']]>]]>'): Initializer. Note: Passing the channel object as a robotframework argument closes the channel. Class varia...
3151c98618c78e3782e48bbe4d9c8f906c126f69
<|skeleton|> class Netconf: """Implements methods for creating and managing Netconf sessions.""" def __init__(self, delimiter=']]>]]>'): """Initializer. Note: Passing the channel object as a robotframework argument closes the channel. Class variables are used instead, to persist the connection channel ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Netconf: """Implements methods for creating and managing Netconf sessions.""" def __init__(self, delimiter=']]>]]>'): """Initializer. Note: Passing the channel object as a robotframework argument closes the channel. Class variables are used instead, to persist the connection channel throughout te...
the_stack_v2_python_sparse
resources/libraries/python/honeycomb/Netconf.py
preym17/csit
train
0
51268626e17402dd27ff8f3f689c3fbf1e94cad0
[ "m_bin = bin(m)[2:]\ndiff = n - m\nans = 0\nfor i in range(len(m_bin)):\n if m_bin[-1 - i] == '1':\n cur = int(m_bin[-1 - i:], 2)\n moves_to_change = (1 << i + 1) - cur\n if moves_to_change > diff:\n ans |= 1 << i\nreturn ans", "digit = 1\nwhile m != n:\n digit <<= 1\n m >...
<|body_start_0|> m_bin = bin(m)[2:] diff = n - m ans = 0 for i in range(len(m_bin)): if m_bin[-1 - i] == '1': cur = int(m_bin[-1 - i:], 2) moves_to_change = (1 << i + 1) - cur if moves_to_change > diff: ans |...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rangeBitwiseAnd(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_0|> def rangeBitwiseAnd2(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> m_bin = bin(m)[2:] d...
stack_v2_sparse_classes_36k_train_020987
853
no_license
[ { "docstring": ":type m: int :type n: int :rtype: int", "name": "rangeBitwiseAnd", "signature": "def rangeBitwiseAnd(self, m, n)" }, { "docstring": ":type m: int :type n: int :rtype: int", "name": "rangeBitwiseAnd2", "signature": "def rangeBitwiseAnd2(self, m, n)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rangeBitwiseAnd(self, m, n): :type m: int :type n: int :rtype: int - def rangeBitwiseAnd2(self, m, n): :type m: int :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rangeBitwiseAnd(self, m, n): :type m: int :type n: int :rtype: int - def rangeBitwiseAnd2(self, m, n): :type m: int :type n: int :rtype: int <|skeleton|> class Solution: ...
0da45559271d3dba687858b8945b3e361ecc813c
<|skeleton|> class Solution: def rangeBitwiseAnd(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_0|> def rangeBitwiseAnd2(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rangeBitwiseAnd(self, m, n): """:type m: int :type n: int :rtype: int""" m_bin = bin(m)[2:] diff = n - m ans = 0 for i in range(len(m_bin)): if m_bin[-1 - i] == '1': cur = int(m_bin[-1 - i:], 2) moves_to_change =...
the_stack_v2_python_sparse
201-bitwise-and-numbers-range/solution.py
katryo/leetcode
train
0
510f2305a55ad99d420bdc20b0c73551a0b56a18
[ "super(softCrossEntropy, self).__init__()\nself.alpha = alpha\nreturn", "KD_loss = self.alpha\nKD_loss *= nn.KLDivLoss(size_average=False)(fcnal.log_softmax(inputs, dim=1), fcnal.softmax(target, dim=1))\nKD_loss += (1 - self.alpha) * fcnal.cross_entropy(inputs, true_labels)\nreturn KD_loss" ]
<|body_start_0|> super(softCrossEntropy, self).__init__() self.alpha = alpha return <|end_body_0|> <|body_start_1|> KD_loss = self.alpha KD_loss *= nn.KLDivLoss(size_average=False)(fcnal.log_softmax(inputs, dim=1), fcnal.softmax(target, dim=1)) KD_loss += (1 - self.alpha...
softCrossEntropy
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class softCrossEntropy: def __init__(self, alpha=0.95): """:param alpha: Strength (0-1) of influence from soft labels in training""" <|body_0|> def forward(self, inputs, target, true_labels): """:param inputs: predictions :param target: target (soft) labels :param true_lab...
stack_v2_sparse_classes_36k_train_020988
15,691
permissive
[ { "docstring": ":param alpha: Strength (0-1) of influence from soft labels in training", "name": "__init__", "signature": "def __init__(self, alpha=0.95)" }, { "docstring": ":param inputs: predictions :param target: target (soft) labels :param true_labels: true (hard) labels :return: loss", ...
2
stack_v2_sparse_classes_30k_train_008487
Implement the Python class `softCrossEntropy` described below. Class description: Implement the softCrossEntropy class. Method signatures and docstrings: - def __init__(self, alpha=0.95): :param alpha: Strength (0-1) of influence from soft labels in training - def forward(self, inputs, target, true_labels): :param in...
Implement the Python class `softCrossEntropy` described below. Class description: Implement the softCrossEntropy class. Method signatures and docstrings: - def __init__(self, alpha=0.95): :param alpha: Strength (0-1) of influence from soft labels in training - def forward(self, inputs, target, true_labels): :param in...
5335672f84c0e4461744f9f5e43ae233179daf27
<|skeleton|> class softCrossEntropy: def __init__(self, alpha=0.95): """:param alpha: Strength (0-1) of influence from soft labels in training""" <|body_0|> def forward(self, inputs, target, true_labels): """:param inputs: predictions :param target: target (soft) labels :param true_lab...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class softCrossEntropy: def __init__(self, alpha=0.95): """:param alpha: Strength (0-1) of influence from soft labels in training""" super(softCrossEntropy, self).__init__() self.alpha = alpha return def forward(self, inputs, target, true_labels): """:param inputs: predi...
the_stack_v2_python_sparse
cyphercat/train.py
ninalopatina/cyphercat
train
1
9c6b7d5f36717db491a9ea6ce49dfba1a188c62b
[ "template = '%s.XXXXXX%s' % (prefix, suffix)\nargs = ['mktemp']\nif is_dir:\n args += ['-d']\nargs += ['--tmpdir' if dir is None else '--tmpdir=%s' % dir]\nargs += [template]\nreturn self._device.CheckOutput(args).strip()", "path = self.mktemp(False, **kargs)\ntry:\n yield path\nfinally:\n self._device.C...
<|body_start_0|> template = '%s.XXXXXX%s' % (prefix, suffix) args = ['mktemp'] if is_dir: args += ['-d'] args += ['--tmpdir' if dir is None else '--tmpdir=%s' % dir] args += [template] return self._device.CheckOutput(args).strip() <|end_body_0|> <|body_start_...
Provides access to temporary files and directories on DUT-based systems. Examples: temp_dir = self.dut.temp.mktemp(True, '.ext', 'mytmp') with self.dut.temp.TempFile() as tmp_path: self.dut.Call('echo test > %s' % tmp_path) with self.dut.temp.TempDirectory() as tmp_dir: self.dut.Call('gen_output -C %s' % tmp_dir)
TemporaryFiles
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TemporaryFiles: """Provides access to temporary files and directories on DUT-based systems. Examples: temp_dir = self.dut.temp.mktemp(True, '.ext', 'mytmp') with self.dut.temp.TempFile() as tmp_path: self.dut.Call('echo test > %s' % tmp_path) with self.dut.temp.TempDirectory() as tmp_dir: self.du...
stack_v2_sparse_classes_36k_train_020989
3,493
permissive
[ { "docstring": "Creates a temporary file or directory on DUT.", "name": "mktemp", "signature": "def mktemp(self, is_dir, suffix='', prefix='cftmp', dir=None)" }, { "docstring": "Yields an unopened temporary file. The file is not opened, and it is deleted when the context manager is closed if it ...
3
null
Implement the Python class `TemporaryFiles` described below. Class description: Provides access to temporary files and directories on DUT-based systems. Examples: temp_dir = self.dut.temp.mktemp(True, '.ext', 'mytmp') with self.dut.temp.TempFile() as tmp_path: self.dut.Call('echo test > %s' % tmp_path) with self.dut.t...
Implement the Python class `TemporaryFiles` described below. Class description: Provides access to temporary files and directories on DUT-based systems. Examples: temp_dir = self.dut.temp.mktemp(True, '.ext', 'mytmp') with self.dut.temp.TempFile() as tmp_path: self.dut.Call('echo test > %s' % tmp_path) with self.dut.t...
a1b0fccd68987d8cd9c89710adc3c04b868347ec
<|skeleton|> class TemporaryFiles: """Provides access to temporary files and directories on DUT-based systems. Examples: temp_dir = self.dut.temp.mktemp(True, '.ext', 'mytmp') with self.dut.temp.TempFile() as tmp_path: self.dut.Call('echo test > %s' % tmp_path) with self.dut.temp.TempDirectory() as tmp_dir: self.du...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TemporaryFiles: """Provides access to temporary files and directories on DUT-based systems. Examples: temp_dir = self.dut.temp.mktemp(True, '.ext', 'mytmp') with self.dut.temp.TempFile() as tmp_path: self.dut.Call('echo test > %s' % tmp_path) with self.dut.temp.TempDirectory() as tmp_dir: self.dut.Call('gen_o...
the_stack_v2_python_sparse
py/device/temp.py
bridder/factory
train
0
2fa91fb56af0c6973bad27064aa87ea9d00b207f
[ "if OPER.imode_Efunc != 'Customize':\n self.freq = OPER.freq\n self.Vdc = OPER.Vdc\n self.Vrf = OPER.Vrf\n self.d_sh = OPER.d_sh\n if OPER.imode_Efunc == 'Dual':\n self.freq2 = OPER.freq2\n self.Vrf2 = OPER.Vrf2", "E = np.zeros(3)\nE[1] = -self.Vdc / self.d_sh - self.Vrf / self.d_sh *...
<|body_start_0|> if OPER.imode_Efunc != 'Customize': self.freq = OPER.freq self.Vdc = OPER.Vdc self.Vrf = OPER.Vrf self.d_sh = OPER.d_sh if OPER.imode_Efunc == 'Dual': self.freq2 = OPER.freq2 self.Vrf2 = OPER.Vrf2 <|end_...
Create EFUNC() object just for sheath model.
EFUNC
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EFUNC: """Create EFUNC() object just for sheath model.""" def load(self, OPER): """Load parameters from obj OPER. OPER: obj, contains all parameters.""" <|body_0|> def sgl_freq(self, t): """E-field function of time with single frquency. The E-field is negative, o...
stack_v2_sparse_classes_36k_train_020990
2,007
no_license
[ { "docstring": "Load parameters from obj OPER. OPER: obj, contains all parameters.", "name": "load", "signature": "def load(self, OPER)" }, { "docstring": "E-field function of time with single frquency. The E-field is negative, only along z-axis. E: arr(3) of float, E-field", "name": "sgl_fr...
5
stack_v2_sparse_classes_30k_train_010912
Implement the Python class `EFUNC` described below. Class description: Create EFUNC() object just for sheath model. Method signatures and docstrings: - def load(self, OPER): Load parameters from obj OPER. OPER: obj, contains all parameters. - def sgl_freq(self, t): E-field function of time with single frquency. The E...
Implement the Python class `EFUNC` described below. Class description: Create EFUNC() object just for sheath model. Method signatures and docstrings: - def load(self, OPER): Load parameters from obj OPER. OPER: obj, contains all parameters. - def sgl_freq(self, t): E-field function of time with single frquency. The E...
8a30014179d1c031b6cba2b7a34bac015b1e6ab5
<|skeleton|> class EFUNC: """Create EFUNC() object just for sheath model.""" def load(self, OPER): """Load parameters from obj OPER. OPER: obj, contains all parameters.""" <|body_0|> def sgl_freq(self, t): """E-field function of time with single frquency. The E-field is negative, o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EFUNC: """Create EFUNC() object just for sheath model.""" def load(self, OPER): """Load parameters from obj OPER. OPER: obj, contains all parameters.""" if OPER.imode_Efunc != 'Customize': self.freq = OPER.freq self.Vdc = OPER.Vdc self.Vrf = OPER.Vrf ...
the_stack_v2_python_sparse
run/Sheath2D/Efunc.py
buckees/Langmuir
train
0
dceb2f2cb00d255e437826b574cbb22b31bf7de1
[ "partinfo = dict(classes=[], features=[], samples=[])\nfor partname in datadict:\n partition = Partition(datadict[partname], f'{dataset}-{partname}')\n for attr in partinfo:\n partinfo[attr].append(getattr(partition, attr))\n setattr(self, partname.lower(), partition)\nself.classes = tuple(partinfo[...
<|body_start_0|> partinfo = dict(classes=[], features=[], samples=[]) for partname in datadict: partition = Partition(datadict[partname], f'{dataset}-{partname}') for attr in partinfo: partinfo[attr].append(getattr(partition, attr)) setattr(self, partn...
The Dataset class defines the main interfaces for datasets created with this repo. It instantiates Partition objects for each partition of the the dataset and defines methods for viewing metadata and partition information. :func:`__init__`: instantiates Dataset objects :func:`__repr__`: shows dataset metadata and infor...
Dataset
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dataset: """The Dataset class defines the main interfaces for datasets created with this repo. It instantiates Partition objects for each partition of the the dataset and defines methods for viewing metadata and partition information. :func:`__init__`: instantiates Dataset objects :func:`__repr__...
stack_v2_sparse_classes_36k_train_020991
13,734
permissive
[ { "docstring": "This method instantiates a Dataset object with attributes to access the underlying data and labels (as Partition objects), as well as collects and saves partition information and metadata. :param datadict: the partitions to save :type datadict: dict of numpy ndarray objects :param dataset: name ...
2
stack_v2_sparse_classes_30k_train_011868
Implement the Python class `Dataset` described below. Class description: The Dataset class defines the main interfaces for datasets created with this repo. It instantiates Partition objects for each partition of the the dataset and defines methods for viewing metadata and partition information. :func:`__init__`: insta...
Implement the Python class `Dataset` described below. Class description: The Dataset class defines the main interfaces for datasets created with this repo. It instantiates Partition objects for each partition of the the dataset and defines methods for viewing metadata and partition information. :func:`__init__`: insta...
5a508b78cccc581b3b99ec2ba179ecb7fa31aafb
<|skeleton|> class Dataset: """The Dataset class defines the main interfaces for datasets created with this repo. It instantiates Partition objects for each partition of the the dataset and defines methods for viewing metadata and partition information. :func:`__init__`: instantiates Dataset objects :func:`__repr__...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dataset: """The Dataset class defines the main interfaces for datasets created with this repo. It instantiates Partition objects for each partition of the the dataset and defines methods for viewing metadata and partition information. :func:`__init__`: instantiates Dataset objects :func:`__repr__`: shows data...
the_stack_v2_python_sparse
mlds/datasets.py
sheatsley/datasets
train
13
9f7f6c8356ee33de22be64dbb5c9e4dc14f61a45
[ "with tf.variable_scope(name):\n self._linear = tf.get_variable('linear', shape=[dim_summary, dim_summary], trainable=True, initializer=tf.initializers.orthogonal())\n self._bilinear = tf.get_variable('bilinear', shape=[dim_latent, dim_summary], trainable=True, initializer=tf.initializers.orthogonal())\nself....
<|body_start_0|> with tf.variable_scope(name): self._linear = tf.get_variable('linear', shape=[dim_summary, dim_summary], trainable=True, initializer=tf.initializers.orthogonal()) self._bilinear = tf.get_variable('bilinear', shape=[dim_latent, dim_summary], trainable=True, initializer=tf...
DGI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DGI: def __init__(self, dim_latent, dim_summary, name='DGI'): """Deep Graph Infomax""" <|body_0|> def score(self, graph, histories, states, observations, beliefs, lookaheads): """Args: histories: A 2-ary tuple: - global_histories: A (..., B, dH) Tensor. - local_histo...
stack_v2_sparse_classes_36k_train_020992
18,953
no_license
[ { "docstring": "Deep Graph Infomax", "name": "__init__", "signature": "def __init__(self, dim_latent, dim_summary, name='DGI')" }, { "docstring": "Args: histories: A 2-ary tuple: - global_histories: A (..., B, dH) Tensor. - local_histories: A (..., B, N, dH) Tensor. states: A 2-ary tuple: - glob...
2
stack_v2_sparse_classes_30k_train_015099
Implement the Python class `DGI` described below. Class description: Implement the DGI class. Method signatures and docstrings: - def __init__(self, dim_latent, dim_summary, name='DGI'): Deep Graph Infomax - def score(self, graph, histories, states, observations, beliefs, lookaheads): Args: histories: A 2-ary tuple: ...
Implement the Python class `DGI` described below. Class description: Implement the DGI class. Method signatures and docstrings: - def __init__(self, dim_latent, dim_summary, name='DGI'): Deep Graph Infomax - def score(self, graph, histories, states, observations, beliefs, lookaheads): Args: histories: A 2-ary tuple: ...
056c1578139ce9e342663f03aa208356f0c35fec
<|skeleton|> class DGI: def __init__(self, dim_latent, dim_summary, name='DGI'): """Deep Graph Infomax""" <|body_0|> def score(self, graph, histories, states, observations, beliefs, lookaheads): """Args: histories: A 2-ary tuple: - global_histories: A (..., B, dH) Tensor. - local_histo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DGI: def __init__(self, dim_latent, dim_summary, name='DGI'): """Deep Graph Infomax""" with tf.variable_scope(name): self._linear = tf.get_variable('linear', shape=[dim_summary, dim_summary], trainable=True, initializer=tf.initializers.orthogonal()) self._bilinear = tf....
the_stack_v2_python_sparse
auxiliary.py
fanyang01/relational-ssm
train
4
b66eba0f27ea4c4301190a7243ef02aa631504e7
[ "self.sim = sim\nself.tokenizer = tokenizer if tokenizer else NGrams(n=6)\nself.minsize = minsize\nself.remove_duplicates = remove_duplicates", "if not values:\n return list()\nblocks = self._get_blocks(values)\nfreq = values if isinstance(values, Counter) else ONE()\nclusters = defaultdict(Cluster)\nfor block...
<|body_start_0|> self.sim = sim self.tokenizer = tokenizer if tokenizer else NGrams(n=6) self.minsize = minsize self.remove_duplicates = remove_duplicates <|end_body_0|> <|body_start_1|> if not values: return list() blocks = self._get_blocks(values) f...
Nearest Neighbor clustering algorithm that is based on a hybrid clustring approach. The algorithm works by performing a first pass over the strings in order to group them into blocks of strings that share at least on token (e.g., n-gram). It then uses a given string similarity function to compute similarity between str...
kNNClusterer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class kNNClusterer: """Nearest Neighbor clustering algorithm that is based on a hybrid clustring approach. The algorithm works by performing a first pass over the strings in order to group them into blocks of strings that share at least on token (e.g., n-gram). It then uses a given string similarity fu...
stack_v2_sparse_classes_36k_train_020993
11,308
permissive
[ { "docstring": "Initialize the string tokenizer, the similarity constraint, and the minimal size for generated clusters. Parameters ---------- sim: openclean.function.similarity.base.SimilarityConstraint String similarity constraint for grouping strings in the generated blocks. tokenizer: openclean.function.tok...
4
null
Implement the Python class `kNNClusterer` described below. Class description: Nearest Neighbor clustering algorithm that is based on a hybrid clustring approach. The algorithm works by performing a first pass over the strings in order to group them into blocks of strings that share at least on token (e.g., n-gram). It...
Implement the Python class `kNNClusterer` described below. Class description: Nearest Neighbor clustering algorithm that is based on a hybrid clustring approach. The algorithm works by performing a first pass over the strings in order to group them into blocks of strings that share at least on token (e.g., n-gram). It...
e3d0e04f90468c49f29ca53edc2feb12465c24d5
<|skeleton|> class kNNClusterer: """Nearest Neighbor clustering algorithm that is based on a hybrid clustring approach. The algorithm works by performing a first pass over the strings in order to group them into blocks of strings that share at least on token (e.g., n-gram). It then uses a given string similarity fu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class kNNClusterer: """Nearest Neighbor clustering algorithm that is based on a hybrid clustring approach. The algorithm works by performing a first pass over the strings in order to group them into blocks of strings that share at least on token (e.g., n-gram). It then uses a given string similarity function to com...
the_stack_v2_python_sparse
openclean/cluster/knn.py
Denisfench/openclean-core
train
0
b3bc4aa93366b2409f7bb0ccdc6ea3679dc0e94a
[ "if bundle.obj.latitude is None:\n return None\nreturn float(bundle.obj.latitude)", "if bundle.obj.longitude is None:\n return None\nreturn float(bundle.obj.longitude)" ]
<|body_start_0|> if bundle.obj.latitude is None: return None return float(bundle.obj.latitude) <|end_body_0|> <|body_start_1|> if bundle.obj.longitude is None: return None return float(bundle.obj.longitude) <|end_body_1|>
LocationResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocationResource: def dehydrate_latitude(self, bundle): """Overrides the default of strings as serialized DecimalField values""" <|body_0|> def dehydrate_longitude(self, bundle): """Overrides the default of strings as serialized DecimalField values""" <|body_...
stack_v2_sparse_classes_36k_train_020994
5,945
no_license
[ { "docstring": "Overrides the default of strings as serialized DecimalField values", "name": "dehydrate_latitude", "signature": "def dehydrate_latitude(self, bundle)" }, { "docstring": "Overrides the default of strings as serialized DecimalField values", "name": "dehydrate_longitude", "s...
2
null
Implement the Python class `LocationResource` described below. Class description: Implement the LocationResource class. Method signatures and docstrings: - def dehydrate_latitude(self, bundle): Overrides the default of strings as serialized DecimalField values - def dehydrate_longitude(self, bundle): Overrides the de...
Implement the Python class `LocationResource` described below. Class description: Implement the LocationResource class. Method signatures and docstrings: - def dehydrate_latitude(self, bundle): Overrides the default of strings as serialized DecimalField values - def dehydrate_longitude(self, bundle): Overrides the de...
3ed85e856a026001a1d91d09d31d944c64704824
<|skeleton|> class LocationResource: def dehydrate_latitude(self, bundle): """Overrides the default of strings as serialized DecimalField values""" <|body_0|> def dehydrate_longitude(self, bundle): """Overrides the default of strings as serialized DecimalField values""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LocationResource: def dehydrate_latitude(self, bundle): """Overrides the default of strings as serialized DecimalField values""" if bundle.obj.latitude is None: return None return float(bundle.obj.latitude) def dehydrate_longitude(self, bundle): """Overrides th...
the_stack_v2_python_sparse
scenable/places/api.py
gregarious/betasite
train
0
601034d873d29dac934b7c63ff0f0a33d36bb082
[ "super(ContextOnlySoftDotAttention, self).__init__()\nif context_dim is None:\n context_dim = dim\nself.linear_in = nn.Linear(dim, context_dim, bias=False)\nself.sm = nn.Softmax(dim=1)", "target = self.linear_in(h).unsqueeze(2)\nattn = torch.bmm(context, target).squeeze(2)\nif mask is not None:\n attn.data....
<|body_start_0|> super(ContextOnlySoftDotAttention, self).__init__() if context_dim is None: context_dim = dim self.linear_in = nn.Linear(dim, context_dim, bias=False) self.sm = nn.Softmax(dim=1) <|end_body_0|> <|body_start_1|> target = self.linear_in(h).unsqueeze(2)...
Like SoftDot, but don't concatenat h or perform the non-linearity transform Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT.
ContextOnlySoftDotAttention
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContextOnlySoftDotAttention: """Like SoftDot, but don't concatenat h or perform the non-linearity transform Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT.""" def __init__(self, dim, context_dim=None): """Initialize layer.""" <|body_0|> def f...
stack_v2_sparse_classes_36k_train_020995
22,228
permissive
[ { "docstring": "Initialize layer.", "name": "__init__", "signature": "def __init__(self, dim, context_dim=None)" }, { "docstring": "Propagate h through the network. h: batch x dim context: batch x seq_len x dim mask: batch x seq_len indices to be masked", "name": "forward", "signature": ...
2
stack_v2_sparse_classes_30k_train_010527
Implement the Python class `ContextOnlySoftDotAttention` described below. Class description: Like SoftDot, but don't concatenat h or perform the non-linearity transform Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT. Method signatures and docstrings: - def __init__(self, dim, context_dim=...
Implement the Python class `ContextOnlySoftDotAttention` described below. Class description: Like SoftDot, but don't concatenat h or perform the non-linearity transform Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT. Method signatures and docstrings: - def __init__(self, dim, context_dim=...
868fb53d6b7978bbb10439a59e65044c811ee5c2
<|skeleton|> class ContextOnlySoftDotAttention: """Like SoftDot, but don't concatenat h or perform the non-linearity transform Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT.""" def __init__(self, dim, context_dim=None): """Initialize layer.""" <|body_0|> def f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ContextOnlySoftDotAttention: """Like SoftDot, but don't concatenat h or perform the non-linearity transform Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT.""" def __init__(self, dim, context_dim=None): """Initialize layer.""" super(ContextOnlySoftDotAttention,...
the_stack_v2_python_sparse
tasks/R2R/speaker/model.py
weituo12321/PREVALENT_R2R
train
8
2f4782734481b8acafbdaa84869973fce7efc81b
[ "try:\n response = requests.get(rank_model_url, timeout=TIMEOUT)\n return StringIO(response.text)\nexcept Exception as ex:\n LOG.warning(ex)", "try:\n return ConfigObj(stringio).dict()\nexcept Exception as ex:\n LOG.error(ex)", "response = self.fetch_rank_model(rank_model_url)\nconfig = self.pars...
<|body_start_0|> try: response = requests.get(rank_model_url, timeout=TIMEOUT) return StringIO(response.text) except Exception as ex: LOG.warning(ex) <|end_body_0|> <|body_start_1|> try: return ConfigObj(stringio).dict() except Exception a...
RankModelHandler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RankModelHandler: def fetch_rank_model(self, rank_model_url): """Send HTTP request to retrieve rank model config file Args: rank_model_url(str): URL to resource containing rank model configuration Returns: StringIO(response.text): A StringIO containing the content of the config file""" ...
stack_v2_sparse_classes_36k_train_020996
5,712
permissive
[ { "docstring": "Send HTTP request to retrieve rank model config file Args: rank_model_url(str): URL to resource containing rank model configuration Returns: StringIO(response.text): A StringIO containing the content of the config file", "name": "fetch_rank_model", "signature": "def fetch_rank_model(self...
6
null
Implement the Python class `RankModelHandler` described below. Class description: Implement the RankModelHandler class. Method signatures and docstrings: - def fetch_rank_model(self, rank_model_url): Send HTTP request to retrieve rank model config file Args: rank_model_url(str): URL to resource containing rank model ...
Implement the Python class `RankModelHandler` described below. Class description: Implement the RankModelHandler class. Method signatures and docstrings: - def fetch_rank_model(self, rank_model_url): Send HTTP request to retrieve rank model config file Args: rank_model_url(str): URL to resource containing rank model ...
1e6a633ba0a83495047ee7b66db1ebf690ee465f
<|skeleton|> class RankModelHandler: def fetch_rank_model(self, rank_model_url): """Send HTTP request to retrieve rank model config file Args: rank_model_url(str): URL to resource containing rank model configuration Returns: StringIO(response.text): A StringIO containing the content of the config file""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RankModelHandler: def fetch_rank_model(self, rank_model_url): """Send HTTP request to retrieve rank model config file Args: rank_model_url(str): URL to resource containing rank model configuration Returns: StringIO(response.text): A StringIO containing the content of the config file""" try: ...
the_stack_v2_python_sparse
scout/adapter/mongo/rank_model.py
Clinical-Genomics/scout
train
143
18f3c4e9f1ec2dd0cde3e8094f3c21404dfb3a85
[ "super().__init__()\nself._id = request_id\nself._project_name = project_name\nself._model_path = model_path\nself._input_precision = input_precision\nself._model_output_path = model_output_path\nself._output_precision = output_precision\nself._mode = mode\nself._workload_path = workload_path\nself._status = status...
<|body_start_0|> super().__init__() self._id = request_id self._project_name = project_name self._model_path = model_path self._input_precision = input_precision self._model_output_path = model_output_path self._output_precision = output_precision self._mo...
Create template for workload_list entity.
WorkloadInfo
[ "MIT", "Intel", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkloadInfo: """Create template for workload_list entity.""" def __init__(self, request_id: str, project_name: Optional[str], workload_path: Optional[str], model_path: Optional[str], input_precision: Optional[str], model_output_path: Optional[str], output_precision: Optional[str], mode: Opt...
stack_v2_sparse_classes_36k_train_020997
12,851
permissive
[ { "docstring": "Initialize configuration WorkloadInfo class.", "name": "__init__", "signature": "def __init__(self, request_id: str, project_name: Optional[str], workload_path: Optional[str], model_path: Optional[str], input_precision: Optional[str], model_output_path: Optional[str], output_precision: O...
3
null
Implement the Python class `WorkloadInfo` described below. Class description: Create template for workload_list entity. Method signatures and docstrings: - def __init__(self, request_id: str, project_name: Optional[str], workload_path: Optional[str], model_path: Optional[str], input_precision: Optional[str], model_ou...
Implement the Python class `WorkloadInfo` described below. Class description: Create template for workload_list entity. Method signatures and docstrings: - def __init__(self, request_id: str, project_name: Optional[str], workload_path: Optional[str], model_path: Optional[str], input_precision: Optional[str], model_ou...
3976edc4215398e69ce0213f87ec295f5dc96e0e
<|skeleton|> class WorkloadInfo: """Create template for workload_list entity.""" def __init__(self, request_id: str, project_name: Optional[str], workload_path: Optional[str], model_path: Optional[str], input_precision: Optional[str], model_output_path: Optional[str], output_precision: Optional[str], mode: Opt...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkloadInfo: """Create template for workload_list entity.""" def __init__(self, request_id: str, project_name: Optional[str], workload_path: Optional[str], model_path: Optional[str], input_precision: Optional[str], model_output_path: Optional[str], output_precision: Optional[str], mode: Optional[str], m...
the_stack_v2_python_sparse
neural_compressor/ux/utils/workload/workloads_list.py
Skp80/neural-compressor
train
0
b7751561e1e48816b07c5a13e413056751e3f4b5
[ "keywords = models.Goal.objects.values_list('keywords', flat=True)\nkeywords = [(kw, kw) for sublist in keywords for kw in sublist if kw]\nkeywords = sorted(set(keywords))\nreturn keywords", "lookup = self.value()\nif lookup:\n queryset = queryset.filter(keywords__contains=[lookup])\nreturn queryset" ]
<|body_start_0|> keywords = models.Goal.objects.values_list('keywords', flat=True) keywords = [(kw, kw) for sublist in keywords for kw in sublist if kw] keywords = sorted(set(keywords)) return keywords <|end_body_0|> <|body_start_1|> lookup = self.value() if lookup: ...
An admin list filter based on the values from a model's `keywords` ArrayField. For more info, see the django docs: https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter
ArrayFieldListFilter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArrayFieldListFilter: """An admin list filter based on the values from a model's `keywords` ArrayField. For more info, see the django docs: https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter""" def lookups(self, request, model_admin): ...
stack_v2_sparse_classes_36k_train_020998
23,419
permissive
[ { "docstring": "Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar.", "name": "lookups", "signature": "def lookups(self, request,...
2
null
Implement the Python class `ArrayFieldListFilter` described below. Class description: An admin list filter based on the values from a model's `keywords` ArrayField. For more info, see the django docs: https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter Method signature...
Implement the Python class `ArrayFieldListFilter` described below. Class description: An admin list filter based on the values from a model's `keywords` ArrayField. For more info, see the django docs: https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter Method signature...
3d22179c581ab3da18900483930d5ecc0a5fca73
<|skeleton|> class ArrayFieldListFilter: """An admin list filter based on the values from a model's `keywords` ArrayField. For more info, see the django docs: https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter""" def lookups(self, request, model_admin): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArrayFieldListFilter: """An admin list filter based on the values from a model's `keywords` ArrayField. For more info, see the django docs: https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter""" def lookups(self, request, model_admin): """Returns a...
the_stack_v2_python_sparse
tndata_backend/goals/admin.py
tndatacommons/tndata_backend
train
1
b2ab6448dc3ef24e707ee73cedaa18b3677d1f13
[ "result = []\ncount = 1\nfor num in reversed(digits):\n if count == 1:\n sum = num + 1\n if sum > 9:\n result.insert(0, 0)\n else:\n result.insert(0, sum)\n count = 0\n else:\n result.insert(0, num)\nif count == 1:\n result.insert(0, 1)\nreturn r...
<|body_start_0|> result = [] count = 1 for num in reversed(digits): if count == 1: sum = num + 1 if sum > 9: result.insert(0, 0) else: result.insert(0, sum) count = 0 ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def plus_one(self, digits: List[int]) -> List[int]: """一个数组加1操作 Args: digits: 数组数字 Returns: 加1后结果""" <|body_0|> def plus_one2(self, digits: List[int]) -> List[int]: """一个数组加1操作 Args: digits: 数组数字 Returns: 加1后结果""" <|body_1|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_020999
2,584
permissive
[ { "docstring": "一个数组加1操作 Args: digits: 数组数字 Returns: 加1后结果", "name": "plus_one", "signature": "def plus_one(self, digits: List[int]) -> List[int]" }, { "docstring": "一个数组加1操作 Args: digits: 数组数字 Returns: 加1后结果", "name": "plus_one2", "signature": "def plus_one2(self, digits: List[int]) -> ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def plus_one(self, digits: List[int]) -> List[int]: 一个数组加1操作 Args: digits: 数组数字 Returns: 加1后结果 - def plus_one2(self, digits: List[int]) -> List[int]: 一个数组加1操作 Args: digits: 数组数字 ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def plus_one(self, digits: List[int]) -> List[int]: 一个数组加1操作 Args: digits: 数组数字 Returns: 加1后结果 - def plus_one2(self, digits: List[int]) -> List[int]: 一个数组加1操作 Args: digits: 数组数字 ...
50f35eef6a0ad63173efed10df3c835b1dceaa3f
<|skeleton|> class Solution: def plus_one(self, digits: List[int]) -> List[int]: """一个数组加1操作 Args: digits: 数组数字 Returns: 加1后结果""" <|body_0|> def plus_one2(self, digits: List[int]) -> List[int]: """一个数组加1操作 Args: digits: 数组数字 Returns: 加1后结果""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def plus_one(self, digits: List[int]) -> List[int]: """一个数组加1操作 Args: digits: 数组数字 Returns: 加1后结果""" result = [] count = 1 for num in reversed(digits): if count == 1: sum = num + 1 if sum > 9: result.inse...
the_stack_v2_python_sparse
src/leetcodepython/math/plus_one_66.py
zhangyu345293721/leetcode
train
101