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
faed9bb27328d9831be61a72b39f60808dd77580
[ "super(OperationIdsCache, self).__init__()\nself.reservations_list = []\nself.max_size = size", "super(OperationIdsCache, self).__setitem__(key, value)\nself.reservations_list.append(key)\nto_remove = len(self) - self.max_size\nfor _ in range(to_remove):\n old_key = self.reservations_list.pop(0)\n del self[...
<|body_start_0|> super(OperationIdsCache, self).__init__() self.reservations_list = [] self.max_size = size <|end_body_0|> <|body_start_1|> super(OperationIdsCache, self).__setitem__(key, value) self.reservations_list.append(key) to_remove = len(self) - self.max_size ...
A cache of recently created operations
OperationIdsCache
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OperationIdsCache: """A cache of recently created operations""" def __init__(self, size=256): """Creates new OperationsCache. Args: size: An integer specifying the maximum size of the cache.""" <|body_0|> def __setitem__(self, key, value): """Adds a new operation...
stack_v2_sparse_classes_36k_train_012500
836
permissive
[ { "docstring": "Creates new OperationsCache. Args: size: An integer specifying the maximum size of the cache.", "name": "__init__", "signature": "def __init__(self, size=256)" }, { "docstring": "Adds a new operation to the cache. Args: key: A string specifying the operation ID. value: A dictiona...
2
null
Implement the Python class `OperationIdsCache` described below. Class description: A cache of recently created operations Method signatures and docstrings: - def __init__(self, size=256): Creates new OperationsCache. Args: size: An integer specifying the maximum size of the cache. - def __setitem__(self, key, value):...
Implement the Python class `OperationIdsCache` described below. Class description: A cache of recently created operations Method signatures and docstrings: - def __init__(self, size=256): Creates new OperationsCache. Args: size: An integer specifying the maximum size of the cache. - def __setitem__(self, key, value):...
be17e5f658d7b42b5aa7eeb7a5ddd4962f3ea82f
<|skeleton|> class OperationIdsCache: """A cache of recently created operations""" def __init__(self, size=256): """Creates new OperationsCache. Args: size: An integer specifying the maximum size of the cache.""" <|body_0|> def __setitem__(self, key, value): """Adds a new operation...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OperationIdsCache: """A cache of recently created operations""" def __init__(self, size=256): """Creates new OperationsCache. Args: size: An integer specifying the maximum size of the cache.""" super(OperationIdsCache, self).__init__() self.reservations_list = [] self.max_...
the_stack_v2_python_sparse
InfrastructureManager/appscale/infrastructure/operation_ids_cache.py
obino/appscale
train
1
99a2270d59587fcadbf077e9d9ffb83da95939d9
[ "super().__init__()\nself.l_length = l_length\nself.min_value = min_value\nself.max_value = max_value\nself.distinct_elements = distinct_elements\nself.worst_case = worst_case\nself._construct()", "new_element = random.randint(a=self.min_value, b=self.max_value)\nwhile new_element in already_used:\n new_elemen...
<|body_start_0|> super().__init__() self.l_length = l_length self.min_value = min_value self.max_value = max_value self.distinct_elements = distinct_elements self.worst_case = worst_case self._construct() <|end_body_0|> <|body_start_1|> new_element = rand...
InputList
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InputList: def __init__(self, l_length: int=100, min_value: int=0, max_value: int=10000, distinct_elements: bool=True, worst_case: bool=False): """Object of input list for algorithms Parameters ---------- l_length (int): Length of the input list min_value (int): Minimal value of the elem...
stack_v2_sparse_classes_36k_train_012501
3,885
permissive
[ { "docstring": "Object of input list for algorithms Parameters ---------- l_length (int): Length of the input list min_value (int): Minimal value of the elements of the list max_value (int): Maximal value of the elements of the list distinct_elements (bool): distinct elements in the list worst_case (bool): in t...
3
stack_v2_sparse_classes_30k_train_004944
Implement the Python class `InputList` described below. Class description: Implement the InputList class. Method signatures and docstrings: - def __init__(self, l_length: int=100, min_value: int=0, max_value: int=10000, distinct_elements: bool=True, worst_case: bool=False): Object of input list for algorithms Paramet...
Implement the Python class `InputList` described below. Class description: Implement the InputList class. Method signatures and docstrings: - def __init__(self, l_length: int=100, min_value: int=0, max_value: int=10000, distinct_elements: bool=True, worst_case: bool=False): Object of input list for algorithms Paramet...
20d8df6172906337f81583dabb841d66b8f31857
<|skeleton|> class InputList: def __init__(self, l_length: int=100, min_value: int=0, max_value: int=10000, distinct_elements: bool=True, worst_case: bool=False): """Object of input list for algorithms Parameters ---------- l_length (int): Length of the input list min_value (int): Minimal value of the elem...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InputList: def __init__(self, l_length: int=100, min_value: int=0, max_value: int=10000, distinct_elements: bool=True, worst_case: bool=False): """Object of input list for algorithms Parameters ---------- l_length (int): Length of the input list min_value (int): Minimal value of the elements of the li...
the_stack_v2_python_sparse
new_algs/Sequence+algorithms/Selection+algorithm/inputs.py
coolsnake/JupyterNotebook
train
0
00af92de8d7ae98cd5080e9f0bd324a3d3aad1e9
[ "res = []\n\ndef dfs(root, depth):\n if not root:\n return\n if depth >= len(res):\n res.append(0)\n res[depth] = root.val\n dfs(root.left, depth + 1)\n dfs(root.right, depth + 1)\ndfs(root, 0)\nreturn res", "from collections import deque\nmax_depth = -1\nq = deque([(root, 0)])\nright...
<|body_start_0|> res = [] def dfs(root, depth): if not root: return if depth >= len(res): res.append(0) res[depth] = root.val dfs(root.left, depth + 1) dfs(root.right, depth + 1) dfs(root, 0) ret...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rightSideView1(self, root: TreeNode) -> List[int]: """dfs""" <|body_0|> def rightSideView2(self, root: TreeNode) -> List[int]: """bfs""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = [] def dfs(root, depth): i...
stack_v2_sparse_classes_36k_train_012502
1,667
no_license
[ { "docstring": "dfs", "name": "rightSideView1", "signature": "def rightSideView1(self, root: TreeNode) -> List[int]" }, { "docstring": "bfs", "name": "rightSideView2", "signature": "def rightSideView2(self, root: TreeNode) -> List[int]" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rightSideView1(self, root: TreeNode) -> List[int]: dfs - def rightSideView2(self, root: TreeNode) -> List[int]: bfs
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rightSideView1(self, root: TreeNode) -> List[int]: dfs - def rightSideView2(self, root: TreeNode) -> List[int]: bfs <|skeleton|> class Solution: def rightSideView1(self...
40726506802d2d60028fdce206696b1df2f63ece
<|skeleton|> class Solution: def rightSideView1(self, root: TreeNode) -> List[int]: """dfs""" <|body_0|> def rightSideView2(self, root: TreeNode) -> List[int]: """bfs""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rightSideView1(self, root: TreeNode) -> List[int]: """dfs""" res = [] def dfs(root, depth): if not root: return if depth >= len(res): res.append(0) res[depth] = root.val dfs(root.left, depth ...
the_stack_v2_python_sparse
二刷+题解/剑指offer/rightSideView.py
1oser5/LeetCode
train
0
9ef01a2b83306d49cc62802196499c1c7f28619e
[ "strlen = len(s)\nmax = 0\nimax = 0\njmax = 0\nif str == '' or strlen == 1:\n return s\ndp = [[0] * (strlen + 1) for j in range(strlen + 1)]\nfor i in range(strlen - 2, -1, -1):\n for j in range(i, strlen):\n if i == j:\n dp[i][j] = 1\n if max < 1:\n max = 1\n ...
<|body_start_0|> strlen = len(s) max = 0 imax = 0 jmax = 0 if str == '' or strlen == 1: return s dp = [[0] * (strlen + 1) for j in range(strlen + 1)] for i in range(strlen - 2, -1, -1): for j in range(i, strlen): if i == j: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome1(self, s): """给定一个字符串 s,找到 s 中最长的回文子串。你可以假设 s 的最大长度为 1000。 :type s: str :rtype: str 动态规划法 最长回文子串""" <|body_0|> def longestPalindrome2(self, s): """:param s: str :return: str 试图使用中心扩展法""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_36k_train_012503
2,416
no_license
[ { "docstring": "给定一个字符串 s,找到 s 中最长的回文子串。你可以假设 s 的最大长度为 1000。 :type s: str :rtype: str 动态规划法 最长回文子串", "name": "longestPalindrome1", "signature": "def longestPalindrome1(self, s)" }, { "docstring": ":param s: str :return: str 试图使用中心扩展法", "name": "longestPalindrome2", "signature": "def long...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome1(self, s): 给定一个字符串 s,找到 s 中最长的回文子串。你可以假设 s 的最大长度为 1000。 :type s: str :rtype: str 动态规划法 最长回文子串 - def longestPalindrome2(self, s): :param s: str :return: str ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome1(self, s): 给定一个字符串 s,找到 s 中最长的回文子串。你可以假设 s 的最大长度为 1000。 :type s: str :rtype: str 动态规划法 最长回文子串 - def longestPalindrome2(self, s): :param s: str :return: str ...
e7a7b7537edbbb8fa35c2dddf2b122cf863e479d
<|skeleton|> class Solution: def longestPalindrome1(self, s): """给定一个字符串 s,找到 s 中最长的回文子串。你可以假设 s 的最大长度为 1000。 :type s: str :rtype: str 动态规划法 最长回文子串""" <|body_0|> def longestPalindrome2(self, s): """:param s: str :return: str 试图使用中心扩展法""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindrome1(self, s): """给定一个字符串 s,找到 s 中最长的回文子串。你可以假设 s 的最大长度为 1000。 :type s: str :rtype: str 动态规划法 最长回文子串""" strlen = len(s) max = 0 imax = 0 jmax = 0 if str == '' or strlen == 1: return s dp = [[0] * (strlen + 1) for j...
the_stack_v2_python_sparse
Dynamic programming/最长回文子串L5.py
QiuHongHao123/Algorithm-Practise
train
0
af97b5f564546693546ca7660bbd349b93fdc8b0
[ "if 'sign' in data:\n del data['sign']\ndataList = []\nfor key in sorted(data):\n dataList.append('%s=%s' % (key, data[key]))\nreturn '&'.join(dataList).strip()", "data = data + api_key.strip()\nmd5 = hashlib.md5()\nmd5.update(data.encode(encoding='UTF-8'))\nreturn md5.hexdigest()", "if cls.md5_sign(data)...
<|body_start_0|> if 'sign' in data: del data['sign'] dataList = [] for key in sorted(data): dataList.append('%s=%s' % (key, data[key])) return '&'.join(dataList).strip() <|end_body_0|> <|body_start_1|> data = data + api_key.strip() md5 = hashlib.m...
MD5签名和验签
SignatureAndVerification
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignatureAndVerification: """MD5签名和验签""" def data_processing(cls, data): """:param data: 需要签名的数据,字典类型 :return: 处理后的字符串,格式为:参数名称=参数值,并用&连接""" <|body_0|> def md5_sign(cls, data, api_key): """MD5签名 :param api_key: MD5签名需要的字符串 :return: 签名后的字符串sign""" <|body_1...
stack_v2_sparse_classes_36k_train_012504
2,421
no_license
[ { "docstring": ":param data: 需要签名的数据,字典类型 :return: 处理后的字符串,格式为:参数名称=参数值,并用&连接", "name": "data_processing", "signature": "def data_processing(cls, data)" }, { "docstring": "MD5签名 :param api_key: MD5签名需要的字符串 :return: 签名后的字符串sign", "name": "md5_sign", "signature": "def md5_sign(cls, data, a...
3
stack_v2_sparse_classes_30k_train_004004
Implement the Python class `SignatureAndVerification` described below. Class description: MD5签名和验签 Method signatures and docstrings: - def data_processing(cls, data): :param data: 需要签名的数据,字典类型 :return: 处理后的字符串,格式为:参数名称=参数值,并用&连接 - def md5_sign(cls, data, api_key): MD5签名 :param api_key: MD5签名需要的字符串 :return: 签名后的字符串sig...
Implement the Python class `SignatureAndVerification` described below. Class description: MD5签名和验签 Method signatures and docstrings: - def data_processing(cls, data): :param data: 需要签名的数据,字典类型 :return: 处理后的字符串,格式为:参数名称=参数值,并用&连接 - def md5_sign(cls, data, api_key): MD5签名 :param api_key: MD5签名需要的字符串 :return: 签名后的字符串sig...
80527bc439395a14a0ff00d773123a6eac2019b7
<|skeleton|> class SignatureAndVerification: """MD5签名和验签""" def data_processing(cls, data): """:param data: 需要签名的数据,字典类型 :return: 处理后的字符串,格式为:参数名称=参数值,并用&连接""" <|body_0|> def md5_sign(cls, data, api_key): """MD5签名 :param api_key: MD5签名需要的字符串 :return: 签名后的字符串sign""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SignatureAndVerification: """MD5签名和验签""" def data_processing(cls, data): """:param data: 需要签名的数据,字典类型 :return: 处理后的字符串,格式为:参数名称=参数值,并用&连接""" if 'sign' in data: del data['sign'] dataList = [] for key in sorted(data): dataList.append('%s=%s' % (key, d...
the_stack_v2_python_sparse
MD5method.py
ManT21/SevendAutoTest
train
0
7f645254ced2e1ee7631e6f70b8f62a9707302fb
[ "user_id = self.scope['url_route']['kwargs']['token']\nuser_group_name = f'user_{user_id}'\nawait self.channel_layer.group_add(user_group_name, self.channel_name)\nawait self.accept()", "task_title = event['task_title']\nuser = event['user_id']\nevaluator = event['evaluator']\nawait self.send(text_data=json.dumps...
<|body_start_0|> user_id = self.scope['url_route']['kwargs']['token'] user_group_name = f'user_{user_id}' await self.channel_layer.group_add(user_group_name, self.channel_name) await self.accept() <|end_body_0|> <|body_start_1|> task_title = event['task_title'] user = ev...
Async consumer to handle notification logic.
NotificationConsumer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotificationConsumer: """Async consumer to handle notification logic.""" async def connect(self): """Handle websocket connection asynchronously. Add current user to group by his id. This is done for user take only notification about self solutions, not everyone.""" <|body_0|>...
stack_v2_sparse_classes_36k_train_012505
3,843
no_license
[ { "docstring": "Handle websocket connection asynchronously. Add current user to group by his id. This is done for user take only notification about self solutions, not everyone.", "name": "connect", "signature": "async def connect(self)" }, { "docstring": "Receive new message event and send it t...
2
null
Implement the Python class `NotificationConsumer` described below. Class description: Async consumer to handle notification logic. Method signatures and docstrings: - async def connect(self): Handle websocket connection asynchronously. Add current user to group by his id. This is done for user take only notification ...
Implement the Python class `NotificationConsumer` described below. Class description: Async consumer to handle notification logic. Method signatures and docstrings: - async def connect(self): Handle websocket connection asynchronously. Add current user to group by his id. This is done for user take only notification ...
0879ade24685b628624dce06698f8a0afd042000
<|skeleton|> class NotificationConsumer: """Async consumer to handle notification logic.""" async def connect(self): """Handle websocket connection asynchronously. Add current user to group by his id. This is done for user take only notification about self solutions, not everyone.""" <|body_0|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NotificationConsumer: """Async consumer to handle notification logic.""" async def connect(self): """Handle websocket connection asynchronously. Add current user to group by his id. This is done for user take only notification about self solutions, not everyone.""" user_id = self.scope['u...
the_stack_v2_python_sparse
camp-python-2021-course-tracker-develop/apps/websockets/consumers.py
rhanmar/oi_projects_summer_2021
train
0
5716191e2f070ef8397849ff602a1cfa6936bdb1
[ "data = []\nwith open(file_path, '-r') as f:\n dict_data = json.load(f.read())\n for i in dict_data:\n data.append(tuple(i.values()))\nreturn data", "page = Home_page(browser)\npage.get(StaticConfig.pchome_url)\nif page.monetate_icon is True:\n page.monetate_icon.click()\nelse:\n pass\npage.sea...
<|body_start_0|> data = [] with open(file_path, '-r') as f: dict_data = json.load(f.read()) for i in dict_data: data.append(tuple(i.values())) return data <|end_body_0|> <|body_start_1|> page = Home_page(browser) page.get(StaticConfig.pcho...
搜索测试
Test_Search
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_Search: """搜索测试""" def get_data(self, file_path): """读取参数化文件""" <|body_0|> def test_1search_key_word(self, name, key_words, browser): """首页关键字搜索""" <|body_1|> <|end_skeleton|> <|body_start_0|> data = [] with open(file_path, '-r') as...
stack_v2_sparse_classes_36k_train_012506
1,360
no_license
[ { "docstring": "读取参数化文件", "name": "get_data", "signature": "def get_data(self, file_path)" }, { "docstring": "首页关键字搜索", "name": "test_1search_key_word", "signature": "def test_1search_key_word(self, name, key_words, browser)" } ]
2
null
Implement the Python class `Test_Search` described below. Class description: 搜索测试 Method signatures and docstrings: - def get_data(self, file_path): 读取参数化文件 - def test_1search_key_word(self, name, key_words, browser): 首页关键字搜索
Implement the Python class `Test_Search` described below. Class description: 搜索测试 Method signatures and docstrings: - def get_data(self, file_path): 读取参数化文件 - def test_1search_key_word(self, name, key_words, browser): 首页关键字搜索 <|skeleton|> class Test_Search: """搜索测试""" def get_data(self, file_path): ...
567836fc9aebcc67acb2816364ba89ffa8d356db
<|skeleton|> class Test_Search: """搜索测试""" def get_data(self, file_path): """读取参数化文件""" <|body_0|> def test_1search_key_word(self, name, key_words, browser): """首页关键字搜索""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_Search: """搜索测试""" def get_data(self, file_path): """读取参数化文件""" data = [] with open(file_path, '-r') as f: dict_data = json.load(f.read()) for i in dict_data: data.append(tuple(i.values())) return data def test_1search_key_...
the_stack_v2_python_sparse
pytestFrame/test_case/test_pczh/test_mainsteam.py
JasonTang7/inspiration
train
0
920f7b98e248f836c90086ca7e8d13fc00973ba6
[ "try:\n org = Organization.objects.get(pk=organization_pk)\nexcept ObjectDoesNotExist:\n return JsonResponse({'status': 'error', 'message': 'Could not retrieve organization at organization_pk = ' + str(organization_pk)}, status=status.HTTP_404_NOT_FOUND)\nusers = []\nfor u in org.organizationuser_set.all():\n...
<|body_start_0|> try: org = Organization.objects.get(pk=organization_pk) except ObjectDoesNotExist: return JsonResponse({'status': 'error', 'message': 'Could not retrieve organization at organization_pk = ' + str(organization_pk)}, status=status.HTTP_404_NOT_FOUND) users ...
OrganizationUserViewSet
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrganizationUserViewSet: def list(self, request, organization_pk): """Retrieve all users belonging to an org.""" <|body_0|> def add(self, request, organization_pk, pk): """Adds an existing user to an organization as an owner.""" <|body_1|> def remove(sel...
stack_v2_sparse_classes_36k_train_012507
5,593
permissive
[ { "docstring": "Retrieve all users belonging to an org.", "name": "list", "signature": "def list(self, request, organization_pk)" }, { "docstring": "Adds an existing user to an organization as an owner.", "name": "add", "signature": "def add(self, request, organization_pk, pk)" }, { ...
3
null
Implement the Python class `OrganizationUserViewSet` described below. Class description: Implement the OrganizationUserViewSet class. Method signatures and docstrings: - def list(self, request, organization_pk): Retrieve all users belonging to an org. - def add(self, request, organization_pk, pk): Adds an existing us...
Implement the Python class `OrganizationUserViewSet` described below. Class description: Implement the OrganizationUserViewSet class. Method signatures and docstrings: - def list(self, request, organization_pk): Retrieve all users belonging to an org. - def add(self, request, organization_pk, pk): Adds an existing us...
680b6a2b45f3c568d779d8ac86553a0b08c384c8
<|skeleton|> class OrganizationUserViewSet: def list(self, request, organization_pk): """Retrieve all users belonging to an org.""" <|body_0|> def add(self, request, organization_pk, pk): """Adds an existing user to an organization as an owner.""" <|body_1|> def remove(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrganizationUserViewSet: def list(self, request, organization_pk): """Retrieve all users belonging to an org.""" try: org = Organization.objects.get(pk=organization_pk) except ObjectDoesNotExist: return JsonResponse({'status': 'error', 'message': 'Could not retr...
the_stack_v2_python_sparse
seed/views/v3/organization_users.py
SEED-platform/seed
train
108
18d716877f083c49a62db27fb61836cb05c93ddc
[ "l = len(nums)\ni = 0\nwhile i < l:\n j = i + 1\n while j < l:\n if nums[i] == nums[j]:\n return nums[i]\n j += 1\n i += 1\nreturn 0", "l = len(nums)\nfast = nums[nums[0]]\nslow = nums[0]\nwhile fast != slow:\n fast = nums[nums[fast]]\n slow = nums[slow]\nfast = 0\nwhile fa...
<|body_start_0|> l = len(nums) i = 0 while i < l: j = i + 1 while j < l: if nums[i] == nums[j]: return nums[i] j += 1 i += 1 return 0 <|end_body_0|> <|body_start_1|> l = len(nums) fas...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findDuplicate1(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findDuplicate(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> l = len(nums) i = 0 whil...
stack_v2_sparse_classes_36k_train_012508
1,495
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "findDuplicate1", "signature": "def findDuplicate1(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "findDuplicate", "signature": "def findDuplicate(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_009594
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicate1(self, nums): :type nums: List[int] :rtype: int - def findDuplicate(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicate1(self, nums): :type nums: List[int] :rtype: int - def findDuplicate(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def findDu...
e5b018493bbd12edcdcd0434f35d9c358106d391
<|skeleton|> class Solution: def findDuplicate1(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findDuplicate(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findDuplicate1(self, nums): """:type nums: List[int] :rtype: int""" l = len(nums) i = 0 while i < l: j = i + 1 while j < l: if nums[i] == nums[j]: return nums[i] j += 1 i += 1 ...
the_stack_v2_python_sparse
py/leetcode/287.py
wfeng1991/learnpy
train
0
2a4d6f68db9b63d5d26253d58fb1b43cdb25206e
[ "last_comment_by = self.data.get('last_comment_by', None)\nif last_comment_by is None:\n last_comment_by = self.BASE_LAST_COMMENT_BY.copy()\nnow = datetime.datetime.utcnow().isoformat()\nif is_public is True:\n last_comment_by['public']['name'] = user.get_initials()\n last_comment_by['public']['date_of'] =...
<|body_start_0|> last_comment_by = self.data.get('last_comment_by', None) if last_comment_by is None: last_comment_by = self.BASE_LAST_COMMENT_BY.copy() now = datetime.datetime.utcnow().isoformat() if is_public is True: last_comment_by['public']['name'] = user.get...
Save the last comment (public|privileged) in the data field
ItemLastCommentByMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ItemLastCommentByMixin: """Save the last comment (public|privileged) in the data field""" def set_last_comment_by(self, is_public, user): """Save in our data field the appropriate last user info for whoever commented take note that college comments should not be shown to normal users...
stack_v2_sparse_classes_36k_train_012509
17,116
no_license
[ { "docstring": "Save in our data field the appropriate last user info for whoever commented take note that college comments should not be shown to normal users", "name": "set_last_comment_by", "signature": "def set_last_comment_by(self, is_public, user)" }, { "docstring": "So get the last commen...
2
null
Implement the Python class `ItemLastCommentByMixin` described below. Class description: Save the last comment (public|privileged) in the data field Method signatures and docstrings: - def set_last_comment_by(self, is_public, user): Save in our data field the appropriate last user info for whoever commented take note ...
Implement the Python class `ItemLastCommentByMixin` described below. Class description: Save the last comment (public|privileged) in the data field Method signatures and docstrings: - def set_last_comment_by(self, is_public, user): Save in our data field the appropriate last user info for whoever commented take note ...
cdda3dd17a776bf2a07fe093304160bf3c43199b
<|skeleton|> class ItemLastCommentByMixin: """Save the last comment (public|privileged) in the data field""" def set_last_comment_by(self, is_public, user): """Save in our data field the appropriate last user info for whoever commented take note that college comments should not be shown to normal users...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ItemLastCommentByMixin: """Save the last comment (public|privileged) in the data field""" def set_last_comment_by(self, is_public, user): """Save in our data field the appropriate last user info for whoever commented take note that college comments should not be shown to normal users""" l...
the_stack_v2_python_sparse
toolkit/core/item/mixins.py
rosscdh/toolkit
train
1
8fa63dba2eed1fe8f1c1b7c4ec7c6fd169937506
[ "global knowledge_maintain_page, admin_page\nknowledge_maintain_page = KnowledgeMaintainPage(self.driver)\nadmin_page = AdminPage(self.driver)\nadmin_page.into_subsystem('业务管理')\nadmin_page.select_menu('首页/渠道终端管理/维护知识库')", "admin_page.select_menu('T维护知识库')\nknowledge_maintain_page.query_knowledge_maintain(device=...
<|body_start_0|> global knowledge_maintain_page, admin_page knowledge_maintain_page = KnowledgeMaintainPage(self.driver) admin_page = AdminPage(self.driver) admin_page.into_subsystem('业务管理') admin_page.select_menu('首页/渠道终端管理/维护知识库') <|end_body_0|> <|body_start_1|> admin_...
TestKnowledgeMaintain
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestKnowledgeMaintain: def set_up(self): """前置操作 :return:""" <|body_0|> def test_query_knowledge_maintain(self, set_up): """知识库维护查询 :return:""" <|body_1|> def test_reset_query_knowledge_maintain(self): """重置查询 :return:""" <|body_2|> ...
stack_v2_sparse_classes_36k_train_012510
2,029
no_license
[ { "docstring": "前置操作 :return:", "name": "set_up", "signature": "def set_up(self)" }, { "docstring": "知识库维护查询 :return:", "name": "test_query_knowledge_maintain", "signature": "def test_query_knowledge_maintain(self, set_up)" }, { "docstring": "重置查询 :return:", "name": "test_res...
4
stack_v2_sparse_classes_30k_train_005516
Implement the Python class `TestKnowledgeMaintain` described below. Class description: Implement the TestKnowledgeMaintain class. Method signatures and docstrings: - def set_up(self): 前置操作 :return: - def test_query_knowledge_maintain(self, set_up): 知识库维护查询 :return: - def test_reset_query_knowledge_maintain(self): 重置查...
Implement the Python class `TestKnowledgeMaintain` described below. Class description: Implement the TestKnowledgeMaintain class. Method signatures and docstrings: - def set_up(self): 前置操作 :return: - def test_query_knowledge_maintain(self, set_up): 知识库维护查询 :return: - def test_reset_query_knowledge_maintain(self): 重置查...
86d1b085af2d3808ac8472d541f4bf26d26591e0
<|skeleton|> class TestKnowledgeMaintain: def set_up(self): """前置操作 :return:""" <|body_0|> def test_query_knowledge_maintain(self, set_up): """知识库维护查询 :return:""" <|body_1|> def test_reset_query_knowledge_maintain(self): """重置查询 :return:""" <|body_2|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestKnowledgeMaintain: def set_up(self): """前置操作 :return:""" global knowledge_maintain_page, admin_page knowledge_maintain_page = KnowledgeMaintainPage(self.driver) admin_page = AdminPage(self.driver) admin_page.into_subsystem('业务管理') admin_page.select_menu('首页/...
the_stack_v2_python_sparse
src/cases/business_manage/channel_device_manage/knowledge_manage/test_knowledge_maintain_page_350.py
102244653/SeleniumByPython
train
2
bdde52b96920c9784a149e0b3608ec417c5a011e
[ "session = self._factory.create(self._transact)\nsession.start()\n\ndef run():\n result = UserAPI().get([u'anon'])\n session.auth.login(u'anon', result[u'anon']['id'])\n return session\nreturn session.transact.run(run)", "username = username.decode('utf-8').lower()\npassword = password.decode('utf-8')\nn...
<|body_start_0|> session = self._factory.create(self._transact) session.start() def run(): result = UserAPI().get([u'anon']) session.auth.login(u'anon', result[u'anon']['id']) return session return session.transact.run(run) <|end_body_0|> <|body_star...
FacadeAuthMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FacadeAuthMixin: def createAnonymousSession(self): """Create a session for an anonymous user. @return: A C{Deferred} that will fire with an L{AuthenticatedSession}.""" <|body_0|> def createUserWithPassword(self, session, username, password, name, email): """Create a ...
stack_v2_sparse_classes_36k_train_012511
7,824
permissive
[ { "docstring": "Create a session for an anonymous user. @return: A C{Deferred} that will fire with an L{AuthenticatedSession}.", "name": "createAnonymousSession", "signature": "def createAnonymousSession(self)" }, { "docstring": "Create a new L{User}. @param session: The L{AuthenticatedSession} ...
5
stack_v2_sparse_classes_30k_train_006070
Implement the Python class `FacadeAuthMixin` described below. Class description: Implement the FacadeAuthMixin class. Method signatures and docstrings: - def createAnonymousSession(self): Create a session for an anonymous user. @return: A C{Deferred} that will fire with an L{AuthenticatedSession}. - def createUserWit...
Implement the Python class `FacadeAuthMixin` described below. Class description: Implement the FacadeAuthMixin class. Method signatures and docstrings: - def createAnonymousSession(self): Create a session for an anonymous user. @return: A C{Deferred} that will fire with an L{AuthenticatedSession}. - def createUserWit...
b5a8c8349f3eaf3364cc4efba4736c3e33b30d96
<|skeleton|> class FacadeAuthMixin: def createAnonymousSession(self): """Create a session for an anonymous user. @return: A C{Deferred} that will fire with an L{AuthenticatedSession}.""" <|body_0|> def createUserWithPassword(self, session, username, password, name, email): """Create a ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FacadeAuthMixin: def createAnonymousSession(self): """Create a session for an anonymous user. @return: A C{Deferred} that will fire with an L{AuthenticatedSession}.""" session = self._factory.create(self._transact) session.start() def run(): result = UserAPI().get(...
the_stack_v2_python_sparse
fluiddb/api/authentication.py
fluidinfo/fluiddb
train
3
70ef6cc43803b8f9174915e716d989a87481d073
[ "super().__init__(agent)\ndefault_action = default_action or (0,) * len(action_mask)\nif len(action_mask) != len(default_action):\n error_format = 'Action mask size {} and default action size {} ' + 'should be the same.'\n raise ValueError(error_format.format(len(action_mask), len(default_action)))\nself.acti...
<|body_start_0|> super().__init__(agent) default_action = default_action or (0,) * len(action_mask) if len(action_mask) != len(default_action): error_format = 'Action mask size {} and default action size {} ' + 'should be the same.' raise ValueError(error_format.format(le...
An agent that turns a masked action into it's unmasked form.
UnmaskedActionAgent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnmaskedActionAgent: """An agent that turns a masked action into it's unmasked form.""" def __init__(self, agent: RLAgent, action_mask: Tuple[bool, ...], default_action: Optional[Tuple[float, ...]]): """Creates the unmasked action wrapper over the agent. Args: agent: The agent to wra...
stack_v2_sparse_classes_36k_train_012512
2,179
permissive
[ { "docstring": "Creates the unmasked action wrapper over the agent. Args: agent: The agent to wrap. action_mask: A mask that the given actions use. default_action: The default values for the action, by default a vector of zeros.", "name": "__init__", "signature": "def __init__(self, agent: RLAgent, acti...
2
null
Implement the Python class `UnmaskedActionAgent` described below. Class description: An agent that turns a masked action into it's unmasked form. Method signatures and docstrings: - def __init__(self, agent: RLAgent, action_mask: Tuple[bool, ...], default_action: Optional[Tuple[float, ...]]): Creates the unmasked act...
Implement the Python class `UnmaskedActionAgent` described below. Class description: An agent that turns a masked action into it's unmasked form. Method signatures and docstrings: - def __init__(self, agent: RLAgent, action_mask: Tuple[bool, ...], default_action: Optional[Tuple[float, ...]]): Creates the unmasked act...
cde3be1c69bfd76fe4a78fa529e851d0a78318c7
<|skeleton|> class UnmaskedActionAgent: """An agent that turns a masked action into it's unmasked form.""" def __init__(self, agent: RLAgent, action_mask: Tuple[bool, ...], default_action: Optional[Tuple[float, ...]]): """Creates the unmasked action wrapper over the agent. Args: agent: The agent to wra...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UnmaskedActionAgent: """An agent that turns a masked action into it's unmasked form.""" def __init__(self, agent: RLAgent, action_mask: Tuple[bool, ...], default_action: Optional[Tuple[float, ...]]): """Creates the unmasked action wrapper over the agent. Args: agent: The agent to wrap. action_mas...
the_stack_v2_python_sparse
hlrl/torch/agents/wrappers/unmasked_action_agent.py
Chainso/HLRL
train
3
69d86528506dcd6bd4ba6c8b111bf7c5bcc68e39
[ "self.criteria = got3.manager.TweetCriteria()\nself.manager = got3.manager.TweetManager()\nself.helper = Utility.Helper(rootPath)", "if username:\n criteria = self.criteria.setUsername(username)\nelse:\n criteria = self.criteria.setQuerySearch(query).setSince(start).setUntil(end).setMaxTweets(maxTweets)\nre...
<|body_start_0|> self.criteria = got3.manager.TweetCriteria() self.manager = got3.manager.TweetManager() self.helper = Utility.Helper(rootPath) <|end_body_0|> <|body_start_1|> if username: criteria = self.criteria.setUsername(username) else: criteria = se...
Use GetOldTweets-python to crawl the Twitter data.
GetTwitterData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetTwitterData: """Use GetOldTweets-python to crawl the Twitter data.""" def __init__(self, rootPath): """Initialize the Parameters. Parameters: criteria (object): the criteria object for got module manager (object): the manager object for got module helper (object): the helper objec...
stack_v2_sparse_classes_36k_train_012513
2,216
no_license
[ { "docstring": "Initialize the Parameters. Parameters: criteria (object): the criteria object for got module manager (object): the manager object for got module helper (object): the helper object for Utility.Helper module", "name": "__init__", "signature": "def __init__(self, rootPath)" }, { "do...
3
stack_v2_sparse_classes_30k_train_011628
Implement the Python class `GetTwitterData` described below. Class description: Use GetOldTweets-python to crawl the Twitter data. Method signatures and docstrings: - def __init__(self, rootPath): Initialize the Parameters. Parameters: criteria (object): the criteria object for got module manager (object): the manage...
Implement the Python class `GetTwitterData` described below. Class description: Use GetOldTweets-python to crawl the Twitter data. Method signatures and docstrings: - def __init__(self, rootPath): Initialize the Parameters. Parameters: criteria (object): the criteria object for got module manager (object): the manage...
e2cdf786fd11f0fc3dbd393cad02383d3a206bf7
<|skeleton|> class GetTwitterData: """Use GetOldTweets-python to crawl the Twitter data.""" def __init__(self, rootPath): """Initialize the Parameters. Parameters: criteria (object): the criteria object for got module manager (object): the manager object for got module helper (object): the helper objec...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetTwitterData: """Use GetOldTweets-python to crawl the Twitter data.""" def __init__(self, rootPath): """Initialize the Parameters. Parameters: criteria (object): the criteria object for got module manager (object): the manager object for got module helper (object): the helper object for Utility...
the_stack_v2_python_sparse
Twitter/GetTwitterData.py
sxhmilyoyo/Rudetect34
train
0
ddc304c2429249dcd6e6d556229135bbbf3c478e
[ "if not words:\n return -1\nstart = 0\nend = len(words) - 1\nwhile start + 1 < end:\n mid = end + (start - end) / 2\n compare_result = self.compare(prefix, words[mid])\n if compare_result == 0:\n end = mid\n if compare_result > 0:\n start = mid\n else:\n end = mid\nif self.com...
<|body_start_0|> if not words: return -1 start = 0 end = len(words) - 1 while start + 1 < end: mid = end + (start - end) / 2 compare_result = self.compare(prefix, words[mid]) if compare_result == 0: end = mid if ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def search_first(self, prefix, words): """Search the first prefix from a list of words.""" <|body_0|> def compare(self, prefix, word): """Compare prefix with word. :return int: 0 if prefix is a prefix or word 1 if prefix is lexically larger than word -1 oth...
stack_v2_sparse_classes_36k_train_012514
1,881
no_license
[ { "docstring": "Search the first prefix from a list of words.", "name": "search_first", "signature": "def search_first(self, prefix, words)" }, { "docstring": "Compare prefix with word. :return int: 0 if prefix is a prefix or word 1 if prefix is lexically larger than word -1 otherwise (if prefix...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search_first(self, prefix, words): Search the first prefix from a list of words. - def compare(self, prefix, word): Compare prefix with word. :return int: 0 if prefix is a pr...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search_first(self, prefix, words): Search the first prefix from a list of words. - def compare(self, prefix, word): Compare prefix with word. :return int: 0 if prefix is a pr...
d634941087bc51869f43c0d8044db09b7bdbaf58
<|skeleton|> class Solution: def search_first(self, prefix, words): """Search the first prefix from a list of words.""" <|body_0|> def compare(self, prefix, word): """Compare prefix with word. :return int: 0 if prefix is a prefix or word 1 if prefix is lexically larger than word -1 oth...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def search_first(self, prefix, words): """Search the first prefix from a list of words.""" if not words: return -1 start = 0 end = len(words) - 1 while start + 1 < end: mid = end + (start - end) / 2 compare_result = self.com...
the_stack_v2_python_sparse
Twitter_Find_First_Prefix_Match_From_a_Sorted_String_Array.py
susunini/leetcode
train
1
f1bd9715d132746b0d658375c57ed3ed0ef8e10e
[ "self.entity_description = description\nself._client = htu21d_client\nself._attr_name = f'{name}_{description.key}'", "await self.hass.async_add_executor_job(self._client.update)\nif self._client.sensor.sample_ok:\n if self.entity_description.key == SENSOR_TEMPERATURE:\n value = round(self._client.senso...
<|body_start_0|> self.entity_description = description self._client = htu21d_client self._attr_name = f'{name}_{description.key}' <|end_body_0|> <|body_start_1|> await self.hass.async_add_executor_job(self._client.update) if self._client.sensor.sample_ok: if self.ent...
Implementation of the HTU21D sensor.
HTU21DSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HTU21DSensor: """Implementation of the HTU21D sensor.""" def __init__(self, htu21d_client, name, description: SensorEntityDescription): """Initialize the sensor.""" <|body_0|> async def async_update(self): """Get the latest data from the HTU21D sensor and update ...
stack_v2_sparse_classes_36k_train_012515
3,360
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, htu21d_client, name, description: SensorEntityDescription)" }, { "docstring": "Get the latest data from the HTU21D sensor and update the state.", "name": "async_update", "signature": "async def ...
2
stack_v2_sparse_classes_30k_train_004703
Implement the Python class `HTU21DSensor` described below. Class description: Implementation of the HTU21D sensor. Method signatures and docstrings: - def __init__(self, htu21d_client, name, description: SensorEntityDescription): Initialize the sensor. - async def async_update(self): Get the latest data from the HTU2...
Implement the Python class `HTU21DSensor` described below. Class description: Implementation of the HTU21D sensor. Method signatures and docstrings: - def __init__(self, htu21d_client, name, description: SensorEntityDescription): Initialize the sensor. - async def async_update(self): Get the latest data from the HTU2...
8de7966104911bca6f855a1755a6d71a07afb9de
<|skeleton|> class HTU21DSensor: """Implementation of the HTU21D sensor.""" def __init__(self, htu21d_client, name, description: SensorEntityDescription): """Initialize the sensor.""" <|body_0|> async def async_update(self): """Get the latest data from the HTU21D sensor and update ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HTU21DSensor: """Implementation of the HTU21D sensor.""" def __init__(self, htu21d_client, name, description: SensorEntityDescription): """Initialize the sensor.""" self.entity_description = description self._client = htu21d_client self._attr_name = f'{name}_{description.k...
the_stack_v2_python_sparse
homeassistant/components/htu21d/sensor.py
AlexxIT/home-assistant
train
9
464981c5fb9ad2168bf1c6cd20cee6b33580630e
[ "N, channel, height, width = X.shape\nPheight, Pwidth = self.pooling\nassert (height - Pheight) % self.stride[0] == 0\nassert (width - Pwidth) % self.stride[1] == 0\nout_height = np.uint32(1 + (height - Pheight) / self.stride[0])\nout_width = np.uint32(1 + (width - Pwidth) / self.stride[1])\nA = np.zeros((N, channe...
<|body_start_0|> N, channel, height, width = X.shape Pheight, Pwidth = self.pooling assert (height - Pheight) % self.stride[0] == 0 assert (width - Pwidth) % self.stride[1] == 0 out_height = np.uint32(1 + (height - Pheight) / self.stride[0]) out_width = np.uint32(1 + (wid...
MaxPool2DNaive
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaxPool2DNaive: def forward_npdl(self, X, **kwargs): """Effectue la propagation avant d'une couche MaxPool2D Arguments: X {ndarray} -- Sortie de la couche précédente. Returns: ndarray -- Scores de la couche""" <|body_0|> def backward_npdl(self, dA, **kwargs): """Effe...
stack_v2_sparse_classes_36k_train_012516
6,145
no_license
[ { "docstring": "Effectue la propagation avant d'une couche MaxPool2D Arguments: X {ndarray} -- Sortie de la couche précédente. Returns: ndarray -- Scores de la couche", "name": "forward_npdl", "signature": "def forward_npdl(self, X, **kwargs)" }, { "docstring": "Effectue la rétro-propagation. Ar...
2
stack_v2_sparse_classes_30k_train_003157
Implement the Python class `MaxPool2DNaive` described below. Class description: Implement the MaxPool2DNaive class. Method signatures and docstrings: - def forward_npdl(self, X, **kwargs): Effectue la propagation avant d'une couche MaxPool2D Arguments: X {ndarray} -- Sortie de la couche précédente. Returns: ndarray -...
Implement the Python class `MaxPool2DNaive` described below. Class description: Implement the MaxPool2DNaive class. Method signatures and docstrings: - def forward_npdl(self, X, **kwargs): Effectue la propagation avant d'une couche MaxPool2D Arguments: X {ndarray} -- Sortie de la couche précédente. Returns: ndarray -...
4d1fdfa2e5f9f9e09a812a42029ceaa27d42e734
<|skeleton|> class MaxPool2DNaive: def forward_npdl(self, X, **kwargs): """Effectue la propagation avant d'une couche MaxPool2D Arguments: X {ndarray} -- Sortie de la couche précédente. Returns: ndarray -- Scores de la couche""" <|body_0|> def backward_npdl(self, dA, **kwargs): """Effe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MaxPool2DNaive: def forward_npdl(self, X, **kwargs): """Effectue la propagation avant d'une couche MaxPool2D Arguments: X {ndarray} -- Sortie de la couche précédente. Returns: ndarray -- Scores de la couche""" N, channel, height, width = X.shape Pheight, Pwidth = self.pooling a...
the_stack_v2_python_sparse
layers/MaxPool.py
plparent/NPDL
train
0
3428254ebd03184863b551679e9fd7b823dd5d10
[ "super().__init__(**kwargs)\nself.server_url = server_url.rstrip('/')\nself.repo_name = repo\nself.branch = branch\nself.client = Github(login_or_token=token, base_url=self.server_url)\ntry:\n self.github_repository = self.client.get_repo(self.repo_name)\nexcept GithubException as e:\n self.log.error(f\"Error...
<|body_start_0|> super().__init__(**kwargs) self.server_url = server_url.rstrip('/') self.repo_name = repo self.branch = branch self.client = Github(login_or_token=token, base_url=self.server_url) try: self.github_repository = self.client.get_repo(self.repo_na...
GithubClient
[ "Apache-2.0", "CC-BY-4.0", "LicenseRef-scancode-unknown-license-reference", "CC-BY-SA-4.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GithubClient: def __init__(self, token: str, repo: str, branch: Optional[str]=None, server_url: Optional[str]='https://api.github.com', **kwargs): """Creates a Github Client for Elyra :param token: Personal Access Token for use with Github See https://docs.github.com/en/github/authentica...
stack_v2_sparse_classes_36k_train_012517
4,901
permissive
[ { "docstring": "Creates a Github Client for Elyra :param token: Personal Access Token for use with Github See https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token :param repo: Github Repository to use. Use Form : [Github Username/Org]/[Repository Name] e.g. elyra/examples ...
3
null
Implement the Python class `GithubClient` described below. Class description: Implement the GithubClient class. Method signatures and docstrings: - def __init__(self, token: str, repo: str, branch: Optional[str]=None, server_url: Optional[str]='https://api.github.com', **kwargs): Creates a Github Client for Elyra :pa...
Implement the Python class `GithubClient` described below. Class description: Implement the GithubClient class. Method signatures and docstrings: - def __init__(self, token: str, repo: str, branch: Optional[str]=None, server_url: Optional[str]='https://api.github.com', **kwargs): Creates a Github Client for Elyra :pa...
3c27ada25a27b719529e88268bed38d135e40805
<|skeleton|> class GithubClient: def __init__(self, token: str, repo: str, branch: Optional[str]=None, server_url: Optional[str]='https://api.github.com', **kwargs): """Creates a Github Client for Elyra :param token: Personal Access Token for use with Github See https://docs.github.com/en/github/authentica...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GithubClient: def __init__(self, token: str, repo: str, branch: Optional[str]=None, server_url: Optional[str]='https://api.github.com', **kwargs): """Creates a Github Client for Elyra :param token: Personal Access Token for use with Github See https://docs.github.com/en/github/authenticating-to-github...
the_stack_v2_python_sparse
elyra/util/github.py
elyra-ai/elyra
train
1,707
6845fce1ba34338edc7609910045926ad84d205c
[ "super(amgx, self).__init__(**kwargs)\nself.__branch = kwargs.pop('branch', 'master')\nself.__cmake_opts = kwargs.pop('cmake_opts', [])\nself.__ospackages = kwargs.pop('ospackages', ['git', 'make'])\nself.__prefix = kwargs.pop('prefix', '/usr/local/amgx')\nself.__repository = kwargs.pop('repository', 'https://githu...
<|body_start_0|> super(amgx, self).__init__(**kwargs) self.__branch = kwargs.pop('branch', 'master') self.__cmake_opts = kwargs.pop('cmake_opts', []) self.__ospackages = kwargs.pop('ospackages', ['git', 'make']) self.__prefix = kwargs.pop('prefix', '/usr/local/amgx') self...
The `amgx` building block downloads, configures, builds, and installs the [AMGX](https://developer.nvidia.com/amgx) component. The [CMake](#cmake) building block should be installed prior to this building block. Installing an MPI building block before this one is optional and will build the [AMGX](https://developer.nvi...
amgx
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class amgx: """The `amgx` building block downloads, configures, builds, and installs the [AMGX](https://developer.nvidia.com/amgx) component. The [CMake](#cmake) building block should be installed prior to this building block. Installing an MPI building block before this one is optional and will build ...
stack_v2_sparse_classes_36k_train_012518
5,713
permissive
[ { "docstring": "Initialize building block", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Generate the set of instructions to install the runtime specific components from a build in a previous stage. # Examples ```python a = amgx(...) Stage0 += a Stage1 += a....
2
stack_v2_sparse_classes_30k_train_008496
Implement the Python class `amgx` described below. Class description: The `amgx` building block downloads, configures, builds, and installs the [AMGX](https://developer.nvidia.com/amgx) component. The [CMake](#cmake) building block should be installed prior to this building block. Installing an MPI building block befo...
Implement the Python class `amgx` described below. Class description: The `amgx` building block downloads, configures, builds, and installs the [AMGX](https://developer.nvidia.com/amgx) component. The [CMake](#cmake) building block should be installed prior to this building block. Installing an MPI building block befo...
60fd2a51c171258a6b3f93c2523101cb7018ba1b
<|skeleton|> class amgx: """The `amgx` building block downloads, configures, builds, and installs the [AMGX](https://developer.nvidia.com/amgx) component. The [CMake](#cmake) building block should be installed prior to this building block. Installing an MPI building block before this one is optional and will build ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class amgx: """The `amgx` building block downloads, configures, builds, and installs the [AMGX](https://developer.nvidia.com/amgx) component. The [CMake](#cmake) building block should be installed prior to this building block. Installing an MPI building block before this one is optional and will build the [AMGX](ht...
the_stack_v2_python_sparse
hpccm/building_blocks/amgx.py
NVIDIA/hpc-container-maker
train
419
7da043b6c9f50050315a84a9df3f27ed613581ce
[ "for module in self.register_module():\n sig_env = list(filter(lambda _sig: not callable(_sig) and (_sig.startswith('g_') or _sig.startswith('_g_')), dir(module)))\n module_name = module.__name__\n for sig in sig_env:\n setattr(self, '{}_{}'.format(module_name, sig), module.__dict__[sig])", "from ...
<|body_start_0|> for module in self.register_module(): sig_env = list(filter(lambda _sig: not callable(_sig) and (_sig.startswith('g_') or _sig.startswith('_g_')), dir(module))) module_name = module.__name__ for sig in sig_env: setattr(self, '{}_{}'.format(mod...
多任务主进程内存设置拷贝执行者类
AbuEnvProcess
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AbuEnvProcess: """多任务主进程内存设置拷贝执行者类""" def __init__(self): """迭代注册了的需要拷贝内存设置的模块,通过筛选模块中以g_或者_g_开头的属性,将这些属性拷贝为类属性变量""" <|body_0|> def register_module(self): """注册需要拷贝内存的模块,不要全局模块注册,否则很多交叉引用,也不要做为类变量存储否则多进程传递pickle时会出错 :return:""" <|body_1|> def copy_pr...
stack_v2_sparse_classes_36k_train_012519
6,236
permissive
[ { "docstring": "迭代注册了的需要拷贝内存设置的模块,通过筛选模块中以g_或者_g_开头的属性,将这些属性拷贝为类属性变量", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "注册需要拷贝内存的模块,不要全局模块注册,否则很多交叉引用,也不要做为类变量存储否则多进程传递pickle时会出错 :return:", "name": "register_module", "signature": "def register_module(self)" }, ...
4
stack_v2_sparse_classes_30k_train_019818
Implement the Python class `AbuEnvProcess` described below. Class description: 多任务主进程内存设置拷贝执行者类 Method signatures and docstrings: - def __init__(self): 迭代注册了的需要拷贝内存设置的模块,通过筛选模块中以g_或者_g_开头的属性,将这些属性拷贝为类属性变量 - def register_module(self): 注册需要拷贝内存的模块,不要全局模块注册,否则很多交叉引用,也不要做为类变量存储否则多进程传递pickle时会出错 :return: - def copy_proces...
Implement the Python class `AbuEnvProcess` described below. Class description: 多任务主进程内存设置拷贝执行者类 Method signatures and docstrings: - def __init__(self): 迭代注册了的需要拷贝内存设置的模块,通过筛选模块中以g_或者_g_开头的属性,将这些属性拷贝为类属性变量 - def register_module(self): 注册需要拷贝内存的模块,不要全局模块注册,否则很多交叉引用,也不要做为类变量存储否则多进程传递pickle时会出错 :return: - def copy_proces...
2e5ab17f2d20deb3c68c927f6208ea89db7c639d
<|skeleton|> class AbuEnvProcess: """多任务主进程内存设置拷贝执行者类""" def __init__(self): """迭代注册了的需要拷贝内存设置的模块,通过筛选模块中以g_或者_g_开头的属性,将这些属性拷贝为类属性变量""" <|body_0|> def register_module(self): """注册需要拷贝内存的模块,不要全局模块注册,否则很多交叉引用,也不要做为类变量存储否则多进程传递pickle时会出错 :return:""" <|body_1|> def copy_pr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AbuEnvProcess: """多任务主进程内存设置拷贝执行者类""" def __init__(self): """迭代注册了的需要拷贝内存设置的模块,通过筛选模块中以g_或者_g_开头的属性,将这些属性拷贝为类属性变量""" for module in self.register_module(): sig_env = list(filter(lambda _sig: not callable(_sig) and (_sig.startswith('g_') or _sig.startswith('_g_')), dir(module)))...
the_stack_v2_python_sparse
abupy/CoreBu/ABuEnvProcess.py
luqin/firefly
train
1
682f3971891ee784eb77dbe2ae7e337b6693e3a5
[ "def _initial_placefield_computation(active_session, pf_computation_config, prev_output_result: ComputationResult):\n prev_output_result.computed_data['pf1D'], prev_output_result.computed_data['pf2D'] = perform_compute_placefields(active_session.spikes_df, active_session.position, pf_computation_config, None, No...
<|body_start_0|> def _initial_placefield_computation(active_session, pf_computation_config, prev_output_result: ComputationResult): prev_output_result.computed_data['pf1D'], prev_output_result.computed_data['pf2D'] = perform_compute_placefields(active_session.spikes_df, active_session.position, pf_c...
PlacefieldComputations
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlacefieldComputations: def _perform_baseline_placefield_computation(computation_result: ComputationResult, debug_print=False): """Builds the initial 1D and 2D placefields Provides""" <|body_0|> def _perform_time_dependent_placefield_computation(computation_result: Computati...
stack_v2_sparse_classes_36k_train_012520
4,390
permissive
[ { "docstring": "Builds the initial 1D and 2D placefields Provides", "name": "_perform_baseline_placefield_computation", "signature": "def _perform_baseline_placefield_computation(computation_result: ComputationResult, debug_print=False)" }, { "docstring": "Builds the time-dependent 2D placefield...
2
null
Implement the Python class `PlacefieldComputations` described below. Class description: Implement the PlacefieldComputations class. Method signatures and docstrings: - def _perform_baseline_placefield_computation(computation_result: ComputationResult, debug_print=False): Builds the initial 1D and 2D placefields Provi...
Implement the Python class `PlacefieldComputations` described below. Class description: Implement the PlacefieldComputations class. Method signatures and docstrings: - def _perform_baseline_placefield_computation(computation_result: ComputationResult, debug_print=False): Builds the initial 1D and 2D placefields Provi...
212399d826284b394fce8894ff1a93133aef783f
<|skeleton|> class PlacefieldComputations: def _perform_baseline_placefield_computation(computation_result: ComputationResult, debug_print=False): """Builds the initial 1D and 2D placefields Provides""" <|body_0|> def _perform_time_dependent_placefield_computation(computation_result: Computati...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlacefieldComputations: def _perform_baseline_placefield_computation(computation_result: ComputationResult, debug_print=False): """Builds the initial 1D and 2D placefields Provides""" def _initial_placefield_computation(active_session, pf_computation_config, prev_output_result: ComputationResu...
the_stack_v2_python_sparse
src/pyphoplacecellanalysis/General/Pipeline/Stages/ComputationFunctions/PlacefieldComputations.py
CommanderPho/pyPhoPlaceCellAnalysis
train
1
967f07f17bd7592ae11624adf5b5570d48232120
[ "nodes = dict()\nfor c in set([c for w in words for c in w]):\n nodes[c] = Node(c)\nfor w1, w2 in zip(words, words[1:]):\n for c1, c2 in zip(w1, w2):\n if c1 != c2:\n n1 = nodes[c1]\n if c2 not in n1.edges:\n n1.edges.add(c2)\n nodes[c2].in_degree += ...
<|body_start_0|> nodes = dict() for c in set([c for w in words for c in w]): nodes[c] = Node(c) for w1, w2 in zip(words, words[1:]): for c1, c2 in zip(w1, w2): if c1 != c2: n1 = nodes[c1] if c2 not in n1.edges: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def alienOrder_v1(self, words: List[str]) -> str: """Use a Node structure to store the graph data.""" <|body_0|> def alienOrder_v2(self, words: List[str]) -> str: """Use two structures (dict and Counter) to store the information.""" <|body_1|> <|en...
stack_v2_sparse_classes_36k_train_012521
5,541
no_license
[ { "docstring": "Use a Node structure to store the graph data.", "name": "alienOrder_v1", "signature": "def alienOrder_v1(self, words: List[str]) -> str" }, { "docstring": "Use two structures (dict and Counter) to store the information.", "name": "alienOrder_v2", "signature": "def alienOr...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def alienOrder_v1(self, words: List[str]) -> str: Use a Node structure to store the graph data. - def alienOrder_v2(self, words: List[str]) -> str: Use two structures (dict and C...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def alienOrder_v1(self, words: List[str]) -> str: Use a Node structure to store the graph data. - def alienOrder_v2(self, words: List[str]) -> str: Use two structures (dict and C...
97a2386f5e3adbd7138fd123810c3232bdf7f622
<|skeleton|> class Solution: def alienOrder_v1(self, words: List[str]) -> str: """Use a Node structure to store the graph data.""" <|body_0|> def alienOrder_v2(self, words: List[str]) -> str: """Use two structures (dict and Counter) to store the information.""" <|body_1|> <|en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def alienOrder_v1(self, words: List[str]) -> str: """Use a Node structure to store the graph data.""" nodes = dict() for c in set([c for w in words for c in w]): nodes[c] = Node(c) for w1, w2 in zip(words, words[1:]): for c1, c2 in zip(w1, w2):...
the_stack_v2_python_sparse
python3/trees_and_graphs/alien_dictionary.py
victorchu/algorithms
train
0
56707e053eb99c55a1d3ff79d03f75e669f887c8
[ "if 'title' not in validated_data:\n raise ValidationError({'title': ['This field is required.']})\nquestion = Question.create(validated_data['title'], validated_data['user'], keywords=validated_data.get('keywords', None))\nif 'answer' in validated_data and validated_data['answer'] != '':\n Answer.create(vali...
<|body_start_0|> if 'title' not in validated_data: raise ValidationError({'title': ['This field is required.']}) question = Question.create(validated_data['title'], validated_data['user'], keywords=validated_data.get('keywords', None)) if 'answer' in validated_data and validated_data...
Serialize question
QuestionSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionSerializer: """Serialize question""" def create(self, validated_data): """Create new question from validated_data""" <|body_0|> def update(self, instance, validated_data): """Update existing question by validated_data""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k_train_012522
7,932
no_license
[ { "docstring": "Create new question from validated_data", "name": "create", "signature": "def create(self, validated_data)" }, { "docstring": "Update existing question by validated_data", "name": "update", "signature": "def update(self, instance, validated_data)" } ]
2
stack_v2_sparse_classes_30k_train_019519
Implement the Python class `QuestionSerializer` described below. Class description: Serialize question Method signatures and docstrings: - def create(self, validated_data): Create new question from validated_data - def update(self, instance, validated_data): Update existing question by validated_data
Implement the Python class `QuestionSerializer` described below. Class description: Serialize question Method signatures and docstrings: - def create(self, validated_data): Create new question from validated_data - def update(self, instance, validated_data): Update existing question by validated_data <|skeleton|> cl...
670752a3b48619eeba2fa9f2cf133e6050737a73
<|skeleton|> class QuestionSerializer: """Serialize question""" def create(self, validated_data): """Create new question from validated_data""" <|body_0|> def update(self, instance, validated_data): """Update existing question by validated_data""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuestionSerializer: """Serialize question""" def create(self, validated_data): """Create new question from validated_data""" if 'title' not in validated_data: raise ValidationError({'title': ['This field is required.']}) question = Question.create(validated_data['title...
the_stack_v2_python_sparse
controller/src/api/serializers.py
Sapunov/qua
train
1
051a4a20994cba91e2de1bdbf1fa5da6a4c37bbe
[ "super(QIntSpinner3DS, self).__init__(parent)\nself.size = size\nself.step = step\nself.default_value = default_value\nself.mouseStartPosY = 0\nself.startValue = 0\nself.current_value = 0\nself.setMaximumSize(self.size)\nself.setSingleStep(self.step)\nself.setValue(self.default_value)", "if event.type() == qtc.QE...
<|body_start_0|> super(QIntSpinner3DS, self).__init__(parent) self.size = size self.step = step self.default_value = default_value self.mouseStartPosY = 0 self.startValue = 0 self.current_value = 0 self.setMaximumSize(self.size) self.setSingleStep(...
Custom QDoubleSpinBox widget mimicking 3dsMax style "UI Spinner Controls" initialize with : size, step, default_value, parent
QIntSpinner3DS
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QIntSpinner3DS: """Custom QDoubleSpinBox widget mimicking 3dsMax style "UI Spinner Controls" initialize with : size, step, default_value, parent""" def __init__(self, size, step=1, default_value=0, parent=None): """Initialization""" <|body_0|> def mousePressEvent(self, e...
stack_v2_sparse_classes_36k_train_012523
4,069
no_license
[ { "docstring": "Initialization", "name": "__init__", "signature": "def __init__(self, size, step=1, default_value=0, parent=None)" }, { "docstring": "Re-define mousePressEvent to implement right-click/left-click", "name": "mousePressEvent", "signature": "def mousePressEvent(self, event)"...
4
stack_v2_sparse_classes_30k_train_012479
Implement the Python class `QIntSpinner3DS` described below. Class description: Custom QDoubleSpinBox widget mimicking 3dsMax style "UI Spinner Controls" initialize with : size, step, default_value, parent Method signatures and docstrings: - def __init__(self, size, step=1, default_value=0, parent=None): Initializati...
Implement the Python class `QIntSpinner3DS` described below. Class description: Custom QDoubleSpinBox widget mimicking 3dsMax style "UI Spinner Controls" initialize with : size, step, default_value, parent Method signatures and docstrings: - def __init__(self, size, step=1, default_value=0, parent=None): Initializati...
6537d2f4a62afa0b5ea745a93193d1bc1379a24d
<|skeleton|> class QIntSpinner3DS: """Custom QDoubleSpinBox widget mimicking 3dsMax style "UI Spinner Controls" initialize with : size, step, default_value, parent""" def __init__(self, size, step=1, default_value=0, parent=None): """Initialization""" <|body_0|> def mousePressEvent(self, e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QIntSpinner3DS: """Custom QDoubleSpinBox widget mimicking 3dsMax style "UI Spinner Controls" initialize with : size, step, default_value, parent""" def __init__(self, size, step=1, default_value=0, parent=None): """Initialization""" super(QIntSpinner3DS, self).__init__(parent) sel...
the_stack_v2_python_sparse
Custom_Widgets/Custom_3dsMaxStyleSpinner.py
LucasPancarte/learning_PySide2
train
0
dce69a502b7ba635b7f1ce3554d89c7c59c7fa41
[ "super().__init__()\nself.client = 'localhost'\nself.folder = '/home/sirius/shared/screens-iocs/data_by_day/'\nself.folder += '2023-02-23-SI_nonlinear_optics_opt_RCDS_matlab/'\nself.folder += 'run1/'\nself.input_fname = 'input.mat'\nself.output_fname = 'output.mat'\nself.onaxis_rf_phase = 0\nself.offaxis_rf_phase =...
<|body_start_0|> super().__init__() self.client = 'localhost' self.folder = '/home/sirius/shared/screens-iocs/data_by_day/' self.folder += '2023-02-23-SI_nonlinear_optics_opt_RCDS_matlab/' self.folder += 'run1/' self.input_fname = 'input.mat' self.output_fname = '...
.
DynapServerParams
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DynapServerParams: """.""" def __init__(self): """.""" <|body_0|> def __str__(self): """.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__() self.client = 'localhost' self.folder = '/home/sirius/shared/screens-ioc...
stack_v2_sparse_classes_36k_train_012524
25,073
permissive
[ { "docstring": ".", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ".", "name": "__str__", "signature": "def __str__(self)" } ]
2
stack_v2_sparse_classes_30k_test_000036
Implement the Python class `DynapServerParams` described below. Class description: . Method signatures and docstrings: - def __init__(self): . - def __str__(self): .
Implement the Python class `DynapServerParams` described below. Class description: . Method signatures and docstrings: - def __init__(self): . - def __str__(self): . <|skeleton|> class DynapServerParams: """.""" def __init__(self): """.""" <|body_0|> def __str__(self): """.""" ...
39644161d98964a3a3d80d63269201f0a1712e82
<|skeleton|> class DynapServerParams: """.""" def __init__(self): """.""" <|body_0|> def __str__(self): """.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DynapServerParams: """.""" def __init__(self): """.""" super().__init__() self.client = 'localhost' self.folder = '/home/sirius/shared/screens-iocs/data_by_day/' self.folder += '2023-02-23-SI_nonlinear_optics_opt_RCDS_matlab/' self.folder += 'run1/' ...
the_stack_v2_python_sparse
apsuite/commisslib/dynap_opt_rcds.py
lnls-fac/apsuite
train
1
e1503bdc515cff30f2d36cedff0c87f37cd12b73
[ "Bar.__init__(self, w, h)\nself.character = character\nself._colour = HP_GREEN", "self._base.fill(DARK_PURPLE)\nratio = self.character.curr_hp / self.character.max_hp\nif ratio > 0.5:\n self._colour = HP_GREEN\nelif ratio < 0.2:\n self._colour = HP_RED\nelse:\n self._colour = HP_YELLOW\nnew_w = int(ratio...
<|body_start_0|> Bar.__init__(self, w, h) self.character = character self._colour = HP_GREEN <|end_body_0|> <|body_start_1|> self._base.fill(DARK_PURPLE) ratio = self.character.curr_hp / self.character.max_hp if ratio > 0.5: self._colour = HP_GREEN el...
Class for drawing health bars in a battle screen.
HPBar
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HPBar: """Class for drawing health bars in a battle screen.""" def __init__(self, w, h, character): """Class constructor for HP bars. args: character: Character object; specifies the character associated with the bar colour: colour tuple; colour of the bar""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_012525
3,427
no_license
[ { "docstring": "Class constructor for HP bars. args: character: Character object; specifies the character associated with the bar colour: colour tuple; colour of the bar", "name": "__init__", "signature": "def __init__(self, w, h, character)" }, { "docstring": "Updates the bar based on current H...
2
stack_v2_sparse_classes_30k_train_016237
Implement the Python class `HPBar` described below. Class description: Class for drawing health bars in a battle screen. Method signatures and docstrings: - def __init__(self, w, h, character): Class constructor for HP bars. args: character: Character object; specifies the character associated with the bar colour: co...
Implement the Python class `HPBar` described below. Class description: Class for drawing health bars in a battle screen. Method signatures and docstrings: - def __init__(self, w, h, character): Class constructor for HP bars. args: character: Character object; specifies the character associated with the bar colour: co...
e86420c145c1d929649ac5d4c98a4d1b75e218a7
<|skeleton|> class HPBar: """Class for drawing health bars in a battle screen.""" def __init__(self, w, h, character): """Class constructor for HP bars. args: character: Character object; specifies the character associated with the bar colour: colour tuple; colour of the bar""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HPBar: """Class for drawing health bars in a battle screen.""" def __init__(self, w, h, character): """Class constructor for HP bars. args: character: Character object; specifies the character associated with the bar colour: colour tuple; colour of the bar""" Bar.__init__(self, w, h) ...
the_stack_v2_python_sparse
src/entities/bar.py
nuclearkittens/ot-projekti
train
0
d03ee669190088afdd6989a640d3c5450b48c37e
[ "if not isinstance(cath_id, CathID):\n cath_id = CathID(cath_id)\ndepth = cath_id.depth\nfiltered_entries = [c for c in self.entries if c.cath_id_to_depth(depth) == cath_id]\nreturn self.__class__(entries=filtered_entries)", "sorted_entries = sorted(self.entries)\nreps = {}\nfor entry in sorted_entries:\n r...
<|body_start_0|> if not isinstance(cath_id, CathID): cath_id = CathID(cath_id) depth = cath_id.depth filtered_entries = [c for c in self.entries if c.cath_id_to_depth(depth) == cath_id] return self.__class__(entries=filtered_entries) <|end_body_0|> <|body_start_1|> s...
Mixin for container classes that have entries with :class:`HasCathIDMixin`
HasEntriesWithCathIDMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HasEntriesWithCathIDMixin: """Mixin for container classes that have entries with :class:`HasCathIDMixin`""" def filter_cath_id(self, cath_id): """Returns a new container after filtering to only include entries within a given CATH ID""" <|body_0|> def filter_reps(self, de...
stack_v2_sparse_classes_36k_train_012526
14,116
permissive
[ { "docstring": "Returns a new container after filtering to only include entries within a given CATH ID", "name": "filter_cath_id", "signature": "def filter_cath_id(self, cath_id)" }, { "docstring": "Returns a new container after filtering to only include one rep at a given depth", "name": "f...
2
stack_v2_sparse_classes_30k_train_002839
Implement the Python class `HasEntriesWithCathIDMixin` described below. Class description: Mixin for container classes that have entries with :class:`HasCathIDMixin` Method signatures and docstrings: - def filter_cath_id(self, cath_id): Returns a new container after filtering to only include entries within a given CA...
Implement the Python class `HasEntriesWithCathIDMixin` described below. Class description: Mixin for container classes that have entries with :class:`HasCathIDMixin` Method signatures and docstrings: - def filter_cath_id(self, cath_id): Returns a new container after filtering to only include entries within a given CA...
39de100ebc18eac2c4da10e4b5fd22b6926b69a4
<|skeleton|> class HasEntriesWithCathIDMixin: """Mixin for container classes that have entries with :class:`HasCathIDMixin`""" def filter_cath_id(self, cath_id): """Returns a new container after filtering to only include entries within a given CATH ID""" <|body_0|> def filter_reps(self, de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HasEntriesWithCathIDMixin: """Mixin for container classes that have entries with :class:`HasCathIDMixin`""" def filter_cath_id(self, cath_id): """Returns a new container after filtering to only include entries within a given CATH ID""" if not isinstance(cath_id, CathID): cath_...
the_stack_v2_python_sparse
cathpy/core/release.py
UCL/cathpy
train
12
e06e5b1453e576aee5d5b87a3bcbfe2762deb1f5
[ "if self.state_model.op_state in [DevState.FAULT, DevState.UNKNOWN]:\n tango.Except.throw_exception(f'Command TelescopeOn is not allowed in current state {self.state_model.op_state}.', 'Failed to invoke On command on CspMasterLeafNode.', 'CspMasterLeafNode.TelescopeOn()', tango.ErrSeverity.ERR)\nreturn True", ...
<|body_start_0|> if self.state_model.op_state in [DevState.FAULT, DevState.UNKNOWN]: tango.Except.throw_exception(f'Command TelescopeOn is not allowed in current state {self.state_model.op_state}.', 'Failed to invoke On command on CspMasterLeafNode.', 'CspMasterLeafNode.TelescopeOn()', tango.ErrSeve...
A class for CSP Subarray's TelescopeOn() command. Invokes method to start Delay Calculation.
TelescopeOn
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TelescopeOn: """A class for CSP Subarray's TelescopeOn() command. Invokes method to start Delay Calculation.""" def check_allowed(self): """Checks whether this command is allowed to be run in current device state :return: True if this command is allowed to be run in current device st...
stack_v2_sparse_classes_36k_train_012527
3,692
permissive
[ { "docstring": "Checks whether this command is allowed to be run in current device state :return: True if this command is allowed to be run in current device state :rtype: boolean :raises: DevFailed if this command is not allowed to be run in current device state", "name": "check_allowed", "signature": ...
3
null
Implement the Python class `TelescopeOn` described below. Class description: A class for CSP Subarray's TelescopeOn() command. Invokes method to start Delay Calculation. Method signatures and docstrings: - def check_allowed(self): Checks whether this command is allowed to be run in current device state :return: True ...
Implement the Python class `TelescopeOn` described below. Class description: A class for CSP Subarray's TelescopeOn() command. Invokes method to start Delay Calculation. Method signatures and docstrings: - def check_allowed(self): Checks whether this command is allowed to be run in current device state :return: True ...
7ee65a9c8dada9b28893144b372a398bd0646195
<|skeleton|> class TelescopeOn: """A class for CSP Subarray's TelescopeOn() command. Invokes method to start Delay Calculation.""" def check_allowed(self): """Checks whether this command is allowed to be run in current device state :return: True if this command is allowed to be run in current device st...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TelescopeOn: """A class for CSP Subarray's TelescopeOn() command. Invokes method to start Delay Calculation.""" def check_allowed(self): """Checks whether this command is allowed to be run in current device state :return: True if this command is allowed to be run in current device state :rtype: b...
the_stack_v2_python_sparse
temp_src/ska_tmc_cspsubarrayleafnode_mid/telescope_on_command.py
ska-telescope/tmc-prototype
train
4
559bb1c3225d860b471acd76df31dfd3acb0f954
[ "self.batcher = Batcher(config, input_type, tokenizer, labeled_file)\nself.input_type = input_type\nself.list_k = list_k\nif self.input_type == 'dev':\n self.best_dev_score = 0\n self.score_filename = os.path.join(exp_dir, 'dev_scores.json')\n self.best_model_filename = os.path.join(exp_dir, 'best_model')\...
<|body_start_0|> self.batcher = Batcher(config, input_type, tokenizer, labeled_file) self.input_type = input_type self.list_k = list_k if self.input_type == 'dev': self.best_dev_score = 0 self.score_filename = os.path.join(exp_dir, 'dev_scores.json') s...
Evaluator
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Evaluator: def __init__(self, config, vocab, tokenizer, input_type, exp_dir, list_k, labeled_file=None, output_file=None): """param config: configuration to use for evaluation param vocab: vocabulary to use param tokenizer: tokenizer to use param input_type: input type of either dev/test...
stack_v2_sparse_classes_36k_train_012528
3,893
permissive
[ { "docstring": "param config: configuration to use for evaluation param vocab: vocabulary to use param tokenizer: tokenizer to use param input_type: input type of either dev/test param exp_dir: experiment directory to save output param list_k: list of k to evaluate hits@k param labeled_file: labeled file to use...
2
stack_v2_sparse_classes_30k_train_018257
Implement the Python class `Evaluator` described below. Class description: Implement the Evaluator class. Method signatures and docstrings: - def __init__(self, config, vocab, tokenizer, input_type, exp_dir, list_k, labeled_file=None, output_file=None): param config: configuration to use for evaluation param vocab: v...
Implement the Python class `Evaluator` described below. Class description: Implement the Evaluator class. Method signatures and docstrings: - def __init__(self, config, vocab, tokenizer, input_type, exp_dir, list_k, labeled_file=None, output_file=None): param config: configuration to use for evaluation param vocab: v...
b33977257ed3e6f95d95da570367e099ea24161f
<|skeleton|> class Evaluator: def __init__(self, config, vocab, tokenizer, input_type, exp_dir, list_k, labeled_file=None, output_file=None): """param config: configuration to use for evaluation param vocab: vocabulary to use param tokenizer: tokenizer to use param input_type: input type of either dev/test...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Evaluator: def __init__(self, config, vocab, tokenizer, input_type, exp_dir, list_k, labeled_file=None, output_file=None): """param config: configuration to use for evaluation param vocab: vocabulary to use param tokenizer: tokenizer to use param input_type: input type of either dev/test param exp_dir...
the_stack_v2_python_sparse
src/main/objects/Evaluator.py
fgregg/stance
train
0
31ffd7044c3a9e7b8704136acf1e536397557f2d
[ "self.num = 0\nself.n = n\nself.prices = {}\nself.discount = discount\nfor i, id_of_product in enumerate(products):\n self.prices[id_of_product] = prices[i]", "ret = 0\nself.num += 1\nfor i, id_of_product in enumerate(product):\n ret += self.prices[id_of_product] * amount[i]\nif self.num == self.n:\n ret...
<|body_start_0|> self.num = 0 self.n = n self.prices = {} self.discount = discount for i, id_of_product in enumerate(products): self.prices[id_of_product] = prices[i] <|end_body_0|> <|body_start_1|> ret = 0 self.num += 1 for i, id_of_product i...
Cashier
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cashier: def __init__(self, n, discount, products, prices): """:type n: int :type discount: int :type products: List[int] :type prices: List[int]""" <|body_0|> def getBill(self, product, amount): """:type product: List[int] :type amount: List[int] :rtype: float""" ...
stack_v2_sparse_classes_36k_train_012529
943
no_license
[ { "docstring": ":type n: int :type discount: int :type products: List[int] :type prices: List[int]", "name": "__init__", "signature": "def __init__(self, n, discount, products, prices)" }, { "docstring": ":type product: List[int] :type amount: List[int] :rtype: float", "name": "getBill", ...
2
stack_v2_sparse_classes_30k_train_017390
Implement the Python class `Cashier` described below. Class description: Implement the Cashier class. Method signatures and docstrings: - def __init__(self, n, discount, products, prices): :type n: int :type discount: int :type products: List[int] :type prices: List[int] - def getBill(self, product, amount): :type pr...
Implement the Python class `Cashier` described below. Class description: Implement the Cashier class. Method signatures and docstrings: - def __init__(self, n, discount, products, prices): :type n: int :type discount: int :type products: List[int] :type prices: List[int] - def getBill(self, product, amount): :type pr...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Cashier: def __init__(self, n, discount, products, prices): """:type n: int :type discount: int :type products: List[int] :type prices: List[int]""" <|body_0|> def getBill(self, product, amount): """:type product: List[int] :type amount: List[int] :rtype: float""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cashier: def __init__(self, n, discount, products, prices): """:type n: int :type discount: int :type products: List[int] :type prices: List[int]""" self.num = 0 self.n = n self.prices = {} self.discount = discount for i, id_of_product in enumerate(products): ...
the_stack_v2_python_sparse
python/leetcode/1357_Apply_Discount_Every_n_Orders.py
bobcaoge/my-code
train
0
1880cd4df327820ff9cb4000834099a742d9e20b
[ "collection_name_to_id_dict = {}\ncollections_stream = CollectionsList(authenticator=authenticator, site_id=site_id)\ncollections_records = collections_stream.read_records(sync_mode='full_refresh')\nfor collection_obj in collections_records:\n collection_name_to_id_dict[collection_obj['name']] = collection_obj['...
<|body_start_0|> collection_name_to_id_dict = {} collections_stream = CollectionsList(authenticator=authenticator, site_id=site_id) collections_records = collections_stream.read_records(sync_mode='full_refresh') for collection_obj in collections_records: collection_name_to_id...
This is the main class that defines the methods that will be called by Airbyte infrastructure
SourceWebflow
[ "Apache-2.0", "BSD-3-Clause", "MIT", "Elastic-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SourceWebflow: """This is the main class that defines the methods that will be called by Airbyte infrastructure""" def _get_collection_name_to_id_dict(authenticator: str=None, site_id: str=None) -> Mapping[str, str]: """Most of the Webflow APIs require the collection id, but the stre...
stack_v2_sparse_classes_36k_train_012530
14,515
permissive
[ { "docstring": "Most of the Webflow APIs require the collection id, but the streams that we are generating use the collection name. This function will return a dictionary containing collection_name: collection_id entries.", "name": "_get_collection_name_to_id_dict", "signature": "def _get_collection_nam...
5
null
Implement the Python class `SourceWebflow` described below. Class description: This is the main class that defines the methods that will be called by Airbyte infrastructure Method signatures and docstrings: - def _get_collection_name_to_id_dict(authenticator: str=None, site_id: str=None) -> Mapping[str, str]: Most of...
Implement the Python class `SourceWebflow` described below. Class description: This is the main class that defines the methods that will be called by Airbyte infrastructure Method signatures and docstrings: - def _get_collection_name_to_id_dict(authenticator: str=None, site_id: str=None) -> Mapping[str, str]: Most of...
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
<|skeleton|> class SourceWebflow: """This is the main class that defines the methods that will be called by Airbyte infrastructure""" def _get_collection_name_to_id_dict(authenticator: str=None, site_id: str=None) -> Mapping[str, str]: """Most of the Webflow APIs require the collection id, but the stre...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SourceWebflow: """This is the main class that defines the methods that will be called by Airbyte infrastructure""" def _get_collection_name_to_id_dict(authenticator: str=None, site_id: str=None) -> Mapping[str, str]: """Most of the Webflow APIs require the collection id, but the streams that we a...
the_stack_v2_python_sparse
dts/airbyte/airbyte-integrations/connectors/source-webflow/source_webflow/source.py
alldatacenter/alldata
train
774
e3cfe059b3b47304dd36f2076b1eb158cf6383f9
[ "question = 'What language did you first learn speak?'\nmy_servey = AnonymousSurvey(question)\nmy_servey.store_response('English')\nself.assertIn('English', my_servey.responses)", "question = 'What language did you first learn speak?'\nmy_servey = AnonymousSurvey(question)\nresponses = ['English', 'Spanish', 'Man...
<|body_start_0|> question = 'What language did you first learn speak?' my_servey = AnonymousSurvey(question) my_servey.store_response('English') self.assertIn('English', my_servey.responses) <|end_body_0|> <|body_start_1|> question = 'What language did you first learn speak?' ...
Тесты для класса AnonymousSurvey
TestAnonymousSurvey
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAnonymousSurvey: """Тесты для класса AnonymousSurvey""" def test_store_single_response(self): """Проверяет, что один ответ сохранён правильно.""" <|body_0|> def test_store_three_responses(self): """Проверяет, что три ответа были созранены правильно.""" ...
stack_v2_sparse_classes_36k_train_012531
4,185
no_license
[ { "docstring": "Проверяет, что один ответ сохранён правильно.", "name": "test_store_single_response", "signature": "def test_store_single_response(self)" }, { "docstring": "Проверяет, что три ответа были созранены правильно.", "name": "test_store_three_responses", "signature": "def test_...
2
null
Implement the Python class `TestAnonymousSurvey` described below. Class description: Тесты для класса AnonymousSurvey Method signatures and docstrings: - def test_store_single_response(self): Проверяет, что один ответ сохранён правильно. - def test_store_three_responses(self): Проверяет, что три ответа были созранены...
Implement the Python class `TestAnonymousSurvey` described below. Class description: Тесты для класса AnonymousSurvey Method signatures and docstrings: - def test_store_single_response(self): Проверяет, что один ответ сохранён правильно. - def test_store_three_responses(self): Проверяет, что три ответа были созранены...
b87319409a94e26faf084c22b1eb6a1d55458282
<|skeleton|> class TestAnonymousSurvey: """Тесты для класса AnonymousSurvey""" def test_store_single_response(self): """Проверяет, что один ответ сохранён правильно.""" <|body_0|> def test_store_three_responses(self): """Проверяет, что три ответа были созранены правильно.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestAnonymousSurvey: """Тесты для класса AnonymousSurvey""" def test_store_single_response(self): """Проверяет, что один ответ сохранён правильно.""" question = 'What language did you first learn speak?' my_servey = AnonymousSurvey(question) my_servey.store_response('Engli...
the_stack_v2_python_sparse
python_learning/chapter_11/f_test_survey.py
DanilWH/Python
train
0
c8d60afff504245edf0668c4fbfb985f725afdc6
[ "data = ConfigStore.get_config()\nif 'power_profiles' not in data:\n raise NotFound('No power profiles in config file')\nfor power in data['power_profiles']:\n if not power['id'] == int(profile_id):\n continue\n return (power, 200)\nraise NotFound('Power profile ' + str(profile_id) + ' not found in ...
<|body_start_0|> data = ConfigStore.get_config() if 'power_profiles' not in data: raise NotFound('No power profiles in config file') for power in data['power_profiles']: if not power['id'] == int(profile_id): continue return (power, 200) ...
Handles /power_profiles/<profile_id> HTTP requests
Power
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Power: """Handles /power_profiles/<profile_id> HTTP requests""" def get(profile_id): """Handles HTTP GET /power_profiles/<profile_id> request. Retrieve single power profile Raises NotFound Parameters: profile_id: Id of power profile to retrieve Returns: response, status code""" ...
stack_v2_sparse_classes_36k_train_012532
7,986
permissive
[ { "docstring": "Handles HTTP GET /power_profiles/<profile_id> request. Retrieve single power profile Raises NotFound Parameters: profile_id: Id of power profile to retrieve Returns: response, status code", "name": "get", "signature": "def get(profile_id)" }, { "docstring": "Handles HTTP DELETE /...
3
stack_v2_sparse_classes_30k_train_014518
Implement the Python class `Power` described below. Class description: Handles /power_profiles/<profile_id> HTTP requests Method signatures and docstrings: - def get(profile_id): Handles HTTP GET /power_profiles/<profile_id> request. Retrieve single power profile Raises NotFound Parameters: profile_id: Id of power pr...
Implement the Python class `Power` described below. Class description: Handles /power_profiles/<profile_id> HTTP requests Method signatures and docstrings: - def get(profile_id): Handles HTTP GET /power_profiles/<profile_id> request. Retrieve single power profile Raises NotFound Parameters: profile_id: Id of power pr...
86883b2b5cc71ee543b39878f37b5a6f533594fa
<|skeleton|> class Power: """Handles /power_profiles/<profile_id> HTTP requests""" def get(profile_id): """Handles HTTP GET /power_profiles/<profile_id> request. Retrieve single power profile Raises NotFound Parameters: profile_id: Id of power profile to retrieve Returns: response, status code""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Power: """Handles /power_profiles/<profile_id> HTTP requests""" def get(profile_id): """Handles HTTP GET /power_profiles/<profile_id> request. Retrieve single power profile Raises NotFound Parameters: profile_id: Id of power profile to retrieve Returns: response, status code""" data = Con...
the_stack_v2_python_sparse
appqos/appqos/rest/rest_power.py
intel/intel-cmt-cat
train
528
045900bf89057e4fae9a7a2120d5c3e602de28d0
[ "super().__init__()\nself.head = head\nself.member = member", "if not struct_ctype or not struct_ctype.is_struct_union():\n err = 'request for member in something not a structure or union'\n raise CompilerError(err, self.r)\noffset, ctype = struct_ctype.get_offset(self.member.content)\nif offset is None:\n ...
<|body_start_0|> super().__init__() self.head = head self.member = member <|end_body_0|> <|body_start_1|> if not struct_ctype or not struct_ctype.is_struct_union(): err = 'request for member in something not a structure or union' raise CompilerError(err, self.r) ...
Struct/union object lookup (. or ->)
_ObjLookup
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _ObjLookup: """Struct/union object lookup (. or ->)""" def __init__(self, head, member): """Initialize node.""" <|body_0|> def get_offset_info(self, struct_ctype): """Given a struct ctype, return the member offset and ctype. If the given ctype is None, emits the ...
stack_v2_sparse_classes_36k_train_012533
45,651
permissive
[ { "docstring": "Initialize node.", "name": "__init__", "signature": "def __init__(self, head, member)" }, { "docstring": "Given a struct ctype, return the member offset and ctype. If the given ctype is None, emits the error for requesting a member in something not a structure or union.", "na...
2
stack_v2_sparse_classes_30k_train_012631
Implement the Python class `_ObjLookup` described below. Class description: Struct/union object lookup (. or ->) Method signatures and docstrings: - def __init__(self, head, member): Initialize node. - def get_offset_info(self, struct_ctype): Given a struct ctype, return the member offset and ctype. If the given ctyp...
Implement the Python class `_ObjLookup` described below. Class description: Struct/union object lookup (. or ->) Method signatures and docstrings: - def __init__(self, head, member): Initialize node. - def get_offset_info(self, struct_ctype): Given a struct ctype, return the member offset and ctype. If the given ctyp...
6232136be38a29e8c18beae3d23e49ecfb7906fd
<|skeleton|> class _ObjLookup: """Struct/union object lookup (. or ->)""" def __init__(self, head, member): """Initialize node.""" <|body_0|> def get_offset_info(self, struct_ctype): """Given a struct ctype, return the member offset and ctype. If the given ctype is None, emits the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _ObjLookup: """Struct/union object lookup (. or ->)""" def __init__(self, head, member): """Initialize node.""" super().__init__() self.head = head self.member = member def get_offset_info(self, struct_ctype): """Given a struct ctype, return the member offset ...
the_stack_v2_python_sparse
shivyc/tree/expr_nodes.py
ShivamSarodia/ShivyC
train
1,072
b17200050cf0a563da67949e330d8ee1fe0d8028
[ "self._sock = socket\nself._timeout_cb = timeout_cb\nself._send_period = Waldo._default_values['heartbeat_send_period']\nself._timeout = Waldo._default_values['heartbeat_timeout_period']\nself._lock = threading.Lock()\nself._partner_alive = True", "self._time_since_last_beat = time.time()\nself._send_thread = thr...
<|body_start_0|> self._sock = socket self._timeout_cb = timeout_cb self._send_period = Waldo._default_values['heartbeat_send_period'] self._timeout = Waldo._default_values['heartbeat_timeout_period'] self._lock = threading.Lock() self._partner_alive = True <|end_body_0|> ...
Implementation of a simple endpoint to endpoint heartbeat. Periodically sends heartbeats to the partner endpoint and listens for heartbeats from the partner endpoint. It is meant to be integrated within the Waldo endpoint and to use the same socket being used by the endpoint to communicate with its partner.
Heartbeat
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Heartbeat: """Implementation of a simple endpoint to endpoint heartbeat. Periodically sends heartbeats to the partner endpoint and listens for heartbeats from the partner endpoint. It is meant to be integrated within the Waldo endpoint and to use the same socket being used by the endpoint to comm...
stack_v2_sparse_classes_36k_train_012534
3,604
no_license
[ { "docstring": "Initializes the Heartbeat object. @param socket Python socket object. Should already be connected. @param timeout_cb Callback function which is invoked upon timeout. @param send_period Time (in seconds) representing how often to send heartbeats to the partner endpoint. The default period is 5 se...
5
stack_v2_sparse_classes_30k_train_016180
Implement the Python class `Heartbeat` described below. Class description: Implementation of a simple endpoint to endpoint heartbeat. Periodically sends heartbeats to the partner endpoint and listens for heartbeats from the partner endpoint. It is meant to be integrated within the Waldo endpoint and to use the same so...
Implement the Python class `Heartbeat` described below. Class description: Implementation of a simple endpoint to endpoint heartbeat. Periodically sends heartbeats to the partner endpoint and listens for heartbeats from the partner endpoint. It is meant to be integrated within the Waldo endpoint and to use the same so...
729a51f04d540111af01c283b1c17ad1489b664a
<|skeleton|> class Heartbeat: """Implementation of a simple endpoint to endpoint heartbeat. Periodically sends heartbeats to the partner endpoint and listens for heartbeats from the partner endpoint. It is meant to be integrated within the Waldo endpoint and to use the same socket being used by the endpoint to comm...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Heartbeat: """Implementation of a simple endpoint to endpoint heartbeat. Periodically sends heartbeats to the partner endpoint and listens for heartbeats from the partner endpoint. It is meant to be integrated within the Waldo endpoint and to use the same socket being used by the endpoint to communicate with ...
the_stack_v2_python_sparse
waldo/lib/waldoHeartbeat.py
bmistree/Waldo
train
0
71b451a96fb3ec06fbb539955938c8fe47bf8701
[ "super(ActorNetwork, self).__init__()\nif norm_in:\n self.in_fn = nn.BatchNorm1d(input_dim)\n self.in_fn.weight.data.fill_(1)\n self.in_fn.bias.data.fill_(0)\nelse:\n self.in_fn = lambda x: x\nself.fc1 = nn.Linear(input_dim, hidden_dim)\nself.fc2 = nn.Linear(hidden_dim, hidden_dim)\nself.fc3 = nn.Linear...
<|body_start_0|> super(ActorNetwork, self).__init__() if norm_in: self.in_fn = nn.BatchNorm1d(input_dim) self.in_fn.weight.data.fill_(1) self.in_fn.bias.data.fill_(0) else: self.in_fn = lambda x: x self.fc1 = nn.Linear(input_dim, hidden_dim...
Deep Actor/Policy-Network choosing action based on individual observation
ActorNetwork
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActorNetwork: """Deep Actor/Policy-Network choosing action based on individual observation""" def __init__(self, input_dim, output_dim, hidden_dim=64, dropout_p=0.0, discrete_actions=True, nonlin=F.relu, norm_in=True): """Initialize parameters and build model. :param input_dim: dimen...
stack_v2_sparse_classes_36k_train_012535
3,561
no_license
[ { "docstring": "Initialize parameters and build model. :param input_dim: dimension of network input :param output_dim: dimension of last layer :param dropout_p: dropout probability :param discrete_actions: flag indicating if actions are discrete :param nonlin: nonlinearity to use :param norm_in: normalise input...
2
stack_v2_sparse_classes_30k_train_019915
Implement the Python class `ActorNetwork` described below. Class description: Deep Actor/Policy-Network choosing action based on individual observation Method signatures and docstrings: - def __init__(self, input_dim, output_dim, hidden_dim=64, dropout_p=0.0, discrete_actions=True, nonlin=F.relu, norm_in=True): Initi...
Implement the Python class `ActorNetwork` described below. Class description: Deep Actor/Policy-Network choosing action based on individual observation Method signatures and docstrings: - def __init__(self, input_dim, output_dim, hidden_dim=64, dropout_p=0.0, discrete_actions=True, nonlin=F.relu, norm_in=True): Initi...
2afa0a9d83bd66a151c1a19242c5ef22cf4eb1f6
<|skeleton|> class ActorNetwork: """Deep Actor/Policy-Network choosing action based on individual observation""" def __init__(self, input_dim, output_dim, hidden_dim=64, dropout_p=0.0, discrete_actions=True, nonlin=F.relu, norm_in=True): """Initialize parameters and build model. :param input_dim: dimen...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ActorNetwork: """Deep Actor/Policy-Network choosing action based on individual observation""" def __init__(self, input_dim, output_dim, hidden_dim=64, dropout_p=0.0, discrete_actions=True, nonlin=F.relu, norm_in=True): """Initialize parameters and build model. :param input_dim: dimension of netwo...
the_stack_v2_python_sparse
marl_algorithms/maddpg/model.py
Jarvis-K/MSc_Curiosity_MARL
train
0
50bfa94f976ed95b12dd2a8d1f81271675ce2246
[ "try:\n collection = []\n for doc in Collection.objects(id=id):\n collection.append({'_id': str(ObjectId(doc['id'])), 'name': doc['name'], 'owner': doc['owner']['username'], 'private': doc['private'], 'snippets_id': [{'label': i['title'], 'value': str(ObjectId(i['id']))} for i in doc['snippets']], 'sni...
<|body_start_0|> try: collection = [] for doc in Collection.objects(id=id): collection.append({'_id': str(ObjectId(doc['id'])), 'name': doc['name'], 'owner': doc['owner']['username'], 'private': doc['private'], 'snippets_id': [{'label': i['title'], 'value': str(ObjectId(i...
Requests against the Collection model to `api/collections/<id>` (singular)
CollectionApi
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CollectionApi: """Requests against the Collection model to `api/collections/<id>` (singular)""" def get(self, id): """Retrieve one Collection object with a matching id. Yields: Identify a Collection object against a Collection model Flags: If it doesn't exist. Returns: [{dict}] mappa...
stack_v2_sparse_classes_36k_train_012536
9,315
permissive
[ { "docstring": "Retrieve one Collection object with a matching id. Yields: Identify a Collection object against a Collection model Flags: If it doesn't exist. Returns: [{dict}] mappable JSON Flask Response, 200, with dereferenced nested fields full of data, as an array even for one document to keep the frontend...
3
stack_v2_sparse_classes_30k_train_004082
Implement the Python class `CollectionApi` described below. Class description: Requests against the Collection model to `api/collections/<id>` (singular) Method signatures and docstrings: - def get(self, id): Retrieve one Collection object with a matching id. Yields: Identify a Collection object against a Collection ...
Implement the Python class `CollectionApi` described below. Class description: Requests against the Collection model to `api/collections/<id>` (singular) Method signatures and docstrings: - def get(self, id): Retrieve one Collection object with a matching id. Yields: Identify a Collection object against a Collection ...
76fa490b6b3e5c4f5d554df4498c485f974c7581
<|skeleton|> class CollectionApi: """Requests against the Collection model to `api/collections/<id>` (singular)""" def get(self, id): """Retrieve one Collection object with a matching id. Yields: Identify a Collection object against a Collection model Flags: If it doesn't exist. Returns: [{dict}] mappa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CollectionApi: """Requests against the Collection model to `api/collections/<id>` (singular)""" def get(self, id): """Retrieve one Collection object with a matching id. Yields: Identify a Collection object against a Collection model Flags: If it doesn't exist. Returns: [{dict}] mappable JSON Flas...
the_stack_v2_python_sparse
backend/resources/collection.py
taralika/cheathub
train
0
24ae75f360d4f19452fffb23b28050a4897969d0
[ "kwargs['is_master'] = False\nconnection_kwargs = dict(self.connection_kwargs)\nconnection_kwargs.update(kwargs)\nbase_args = inspect.getargspec(redis.client.Redis.__init__).args\nbase_args.append('is_master')\nbase_args.append('check_connection')\nextra_kwargs = {key: connection_kwargs[key] for key in connection_k...
<|body_start_0|> kwargs['is_master'] = False connection_kwargs = dict(self.connection_kwargs) connection_kwargs.update(kwargs) base_args = inspect.getargspec(redis.client.Redis.__init__).args base_args.append('is_master') base_args.append('check_connection') extra...
self Sentinel class.
MySentinel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MySentinel: """self Sentinel class.""" def slave_for(self, service_name, redis_class=Redis, connection_pool_obj=None, connection_pool_class=SentinelConnectionPool, **kwargs): """overwrite slave_for to split the connection_kwargs to the redis_class.""" <|body_0|> def mast...
stack_v2_sparse_classes_36k_train_012537
7,378
no_license
[ { "docstring": "overwrite slave_for to split the connection_kwargs to the redis_class.", "name": "slave_for", "signature": "def slave_for(self, service_name, redis_class=Redis, connection_pool_obj=None, connection_pool_class=SentinelConnectionPool, **kwargs)" }, { "docstring": "overwrite master_...
2
stack_v2_sparse_classes_30k_train_012992
Implement the Python class `MySentinel` described below. Class description: self Sentinel class. Method signatures and docstrings: - def slave_for(self, service_name, redis_class=Redis, connection_pool_obj=None, connection_pool_class=SentinelConnectionPool, **kwargs): overwrite slave_for to split the connection_kwarg...
Implement the Python class `MySentinel` described below. Class description: self Sentinel class. Method signatures and docstrings: - def slave_for(self, service_name, redis_class=Redis, connection_pool_obj=None, connection_pool_class=SentinelConnectionPool, **kwargs): overwrite slave_for to split the connection_kwarg...
bcbd1abefe1d79d633327f80eb52688299ffbd90
<|skeleton|> class MySentinel: """self Sentinel class.""" def slave_for(self, service_name, redis_class=Redis, connection_pool_obj=None, connection_pool_class=SentinelConnectionPool, **kwargs): """overwrite slave_for to split the connection_kwargs to the redis_class.""" <|body_0|> def mast...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MySentinel: """self Sentinel class.""" def slave_for(self, service_name, redis_class=Redis, connection_pool_obj=None, connection_pool_class=SentinelConnectionPool, **kwargs): """overwrite slave_for to split the connection_kwargs to the redis_class.""" kwargs['is_master'] = False c...
the_stack_v2_python_sparse
fab_admin/myredis.py
cw1427/fab-admin
train
9
61f94f4e3f247da315ad8791f541dea72160ca8c
[ "width = [root]\nval = [root.val]\ni = 0\nwhile i < len(width):\n cur = width[i]\n if cur.left is not None:\n width.append(cur.left)\n val.append(cur.left.val)\n if cur.right is not None:\n width.append(cur.right)\n val.append(cur.right.val)\n i += 1\nval.sort()\nreturn val[k...
<|body_start_0|> width = [root] val = [root.val] i = 0 while i < len(width): cur = width[i] if cur.left is not None: width.append(cur.left) val.append(cur.left.val) if cur.right is not None: width.append(...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def kthSmallest(self, root, k): """:type root: TreeNode :type k: int :rtype: int""" <|body_0|> def kthSmallest2(self, root, k): """:type root: TreeNode :type k: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> width = [root]...
stack_v2_sparse_classes_36k_train_012538
1,763
no_license
[ { "docstring": ":type root: TreeNode :type k: int :rtype: int", "name": "kthSmallest", "signature": "def kthSmallest(self, root, k)" }, { "docstring": ":type root: TreeNode :type k: int :rtype: int", "name": "kthSmallest2", "signature": "def kthSmallest2(self, root, k)" } ]
2
stack_v2_sparse_classes_30k_train_012568
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthSmallest(self, root, k): :type root: TreeNode :type k: int :rtype: int - def kthSmallest2(self, root, k): :type root: TreeNode :type k: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthSmallest(self, root, k): :type root: TreeNode :type k: int :rtype: int - def kthSmallest2(self, root, k): :type root: TreeNode :type k: int :rtype: int <|skeleton|> class...
90d07a53a537212f41740adb8e65c4e30c3c4f64
<|skeleton|> class Solution: def kthSmallest(self, root, k): """:type root: TreeNode :type k: int :rtype: int""" <|body_0|> def kthSmallest2(self, root, k): """:type root: TreeNode :type k: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def kthSmallest(self, root, k): """:type root: TreeNode :type k: int :rtype: int""" width = [root] val = [root.val] i = 0 while i < len(width): cur = width[i] if cur.left is not None: width.append(cur.left) ...
the_stack_v2_python_sparse
排序与搜索和二叉树/二叉搜索树中第K小的元素.py
xianytt/LeetCode
train
0
4566c329e13a252d9f7624fe3e7d45cdd4a30bec
[ "i = n\ncnt = 0\nwhile i > 0:\n print('i is {0},n is {1}'.format(i, n))\n sq = math.sqrt(i)\n if sq - sq // 1 == 0:\n n -= i\n i = n\n cnt += 1\n else:\n i -= 1\nreturn cnt", "dq = deque()\ndq.append(n)\nstep = 0\nwhile dq:\n for i in range(len(dq)):\n pop = dq.po...
<|body_start_0|> i = n cnt = 0 while i > 0: print('i is {0},n is {1}'.format(i, n)) sq = math.sqrt(i) if sq - sq // 1 == 0: n -= i i = n cnt += 1 else: i -= 1 return cnt <|end_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numSquares_failed(self, n): """:type n: int :rtype: int""" <|body_0|> def numSquares_slow(self, n): """:type n: int :rtype: int""" <|body_1|> def numSquares(self, n): """:type n: int :rtype: int""" <|body_2|> <|end_skeleton...
stack_v2_sparse_classes_36k_train_012539
2,586
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "numSquares_failed", "signature": "def numSquares_failed(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "numSquares_slow", "signature": "def numSquares_slow(self, n)" }, { "docstring": ":type n: int :rtype: int",...
3
stack_v2_sparse_classes_30k_train_009545
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSquares_failed(self, n): :type n: int :rtype: int - def numSquares_slow(self, n): :type n: int :rtype: int - def numSquares(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSquares_failed(self, n): :type n: int :rtype: int - def numSquares_slow(self, n): :type n: int :rtype: int - def numSquares(self, n): :type n: int :rtype: int <|skeleton|...
93266095329e2e8e949a72371b88b07382a60e0d
<|skeleton|> class Solution: def numSquares_failed(self, n): """:type n: int :rtype: int""" <|body_0|> def numSquares_slow(self, n): """:type n: int :rtype: int""" <|body_1|> def numSquares(self, n): """:type n: int :rtype: int""" <|body_2|> <|end_skeleton...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numSquares_failed(self, n): """:type n: int :rtype: int""" i = n cnt = 0 while i > 0: print('i is {0},n is {1}'.format(i, n)) sq = math.sqrt(i) if sq - sq // 1 == 0: n -= i i = n c...
the_stack_v2_python_sparse
numSquares.py
shivangi-prog/leetcode
train
0
e09eca9387b3fae4b74f7f48c362b8b3d40da401
[ "if not a1 or not a2:\n return list()\nif len(a1) < len(a2):\n u = list(set(a1))\n v = list(set(a2))\nelse:\n u = list(set(a2))\n v = list(set(a1))\nu.sort()\nr = [x for x in v if self.is_present(x, u)]\nreturn r", "l = 0\nr = len(u) - 1\nwhile l <= r:\n m = l + (r - l) // 2\n if u[m] == x:\n...
<|body_start_0|> if not a1 or not a2: return list() if len(a1) < len(a2): u = list(set(a1)) v = list(set(a2)) else: u = list(set(a2)) v = list(set(a1)) u.sort() r = [x for x in v if self.is_present(x, u)] return ...
Iteration over all elements of smaller input array with binary search. Time complexity: O(min(len(n), len(m))) - Traverse all elements of smaller input array Space complexity: O(min(len(n), len(m))) - Amortized collect all elements of smaller input array
Solution2
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution2: """Iteration over all elements of smaller input array with binary search. Time complexity: O(min(len(n), len(m))) - Traverse all elements of smaller input array Space complexity: O(min(len(n), len(m))) - Amortized collect all elements of smaller input array""" def find_intersectio...
stack_v2_sparse_classes_36k_train_012540
3,821
permissive
[ { "docstring": "Determines common elements in both input arrays. :param list[int] a1: first input array :param list[int] a2: second input array :return: array of elements common to both input arrays :rtype: list[int]", "name": "find_intersection", "signature": "def find_intersection(self, a1, a2)" }, ...
2
null
Implement the Python class `Solution2` described below. Class description: Iteration over all elements of smaller input array with binary search. Time complexity: O(min(len(n), len(m))) - Traverse all elements of smaller input array Space complexity: O(min(len(n), len(m))) - Amortized collect all elements of smaller i...
Implement the Python class `Solution2` described below. Class description: Iteration over all elements of smaller input array with binary search. Time complexity: O(min(len(n), len(m))) - Traverse all elements of smaller input array Space complexity: O(min(len(n), len(m))) - Amortized collect all elements of smaller i...
69f90877c5466927e8b081c4268cbcda074813ec
<|skeleton|> class Solution2: """Iteration over all elements of smaller input array with binary search. Time complexity: O(min(len(n), len(m))) - Traverse all elements of smaller input array Space complexity: O(min(len(n), len(m))) - Amortized collect all elements of smaller input array""" def find_intersectio...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution2: """Iteration over all elements of smaller input array with binary search. Time complexity: O(min(len(n), len(m))) - Traverse all elements of smaller input array Space complexity: O(min(len(n), len(m))) - Amortized collect all elements of smaller input array""" def find_intersection(self, a1, a...
the_stack_v2_python_sparse
0349_intersection_two_arrays/python_source.py
arthurdysart/LeetCode
train
0
ea17631ac4dd76bd8f9486f65c6a1478b87d973c
[ "self._pubsub = pubsub_bus\nself._player = player_\nbuilder = Gtk.Builder.new_from_string(resources.read_text('pepper_music_player.ui', 'player_status_position_slider.glade'), length=-1)\nself.widget = builder.get_object('container')\nalignment.set_direction_recursive(self.widget, Gtk.TextDirection.LTR)\nself._posi...
<|body_start_0|> self._pubsub = pubsub_bus self._player = player_ builder = Gtk.Builder.new_from_string(resources.read_text('pepper_music_player.ui', 'player_status_position_slider.glade'), length=-1) self.widget = builder.get_object('container') alignment.set_direction_recursive...
Position slider, including labels for the current position and duration. Attributes: widget: Widget containing the slider and labels. slider: Slider for seeking. This is public for use in tests only.
PositionSlider
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PositionSlider: """Position slider, including labels for the current position and duration. Attributes: widget: Widget containing the slider and labels. slider: Slider for seeking. This is public for use in tests only.""" def __init__(self, *, pubsub_bus: pubsub.PubSub, player_: player.Playe...
stack_v2_sparse_classes_36k_train_012541
7,252
permissive
[ { "docstring": "Initializer. Args: pubsub_bus: PubSub message bus. player_: Player.", "name": "__init__", "signature": "def __init__(self, *, pubsub_bus: pubsub.PubSub, player_: player.Player) -> None" }, { "docstring": "Handler for PlayStatus updates.", "name": "_handle_play_status", "s...
3
stack_v2_sparse_classes_30k_train_020995
Implement the Python class `PositionSlider` described below. Class description: Position slider, including labels for the current position and duration. Attributes: widget: Widget containing the slider and labels. slider: Slider for seeking. This is public for use in tests only. Method signatures and docstrings: - de...
Implement the Python class `PositionSlider` described below. Class description: Position slider, including labels for the current position and duration. Attributes: widget: Widget containing the slider and labels. slider: Slider for seeking. This is public for use in tests only. Method signatures and docstrings: - de...
2a45aef6deb6247c42d63b5f7475ec5517ea9321
<|skeleton|> class PositionSlider: """Position slider, including labels for the current position and duration. Attributes: widget: Widget containing the slider and labels. slider: Slider for seeking. This is public for use in tests only.""" def __init__(self, *, pubsub_bus: pubsub.PubSub, player_: player.Playe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PositionSlider: """Position slider, including labels for the current position and duration. Attributes: widget: Widget containing the slider and labels. slider: Slider for seeking. This is public for use in tests only.""" def __init__(self, *, pubsub_bus: pubsub.PubSub, player_: player.Player) -> None: ...
the_stack_v2_python_sparse
pepper_music_player/ui/player_status.py
EmDBaum/pepper-music-player
train
0
0a01aa7280ddbe8bb01c13de47e1fd3683f53f12
[ "self.list_heap = []\nself.size = 0\nif iterable:\n for val in iterable:\n self.push(val)", "while val // 2 > 0:\n if self.list_heap[val] < self.list_heap[val // 2]:\n temp = self.list_heap[val // 2]\n self.list_heap[val // 2] = self.list_heap[val]\n self.list_heap[val] = temp\n ...
<|body_start_0|> self.list_heap = [] self.size = 0 if iterable: for val in iterable: self.push(val) <|end_body_0|> <|body_start_1|> while val // 2 > 0: if self.list_heap[val] < self.list_heap[val // 2]: temp = self.list_heap[val //...
The Binary Heap Class. __init__([iterable]): takes an optional iterable object when instantiating the class. _perc_ip(val): Send the value up the heap as it is pushed in. push(val): Append a value to the end of the list, increase list size, push the index that is equal to size, up the list. _perc_down(val): Send a valu...
BBinnyHeap
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BBinnyHeap: """The Binary Heap Class. __init__([iterable]): takes an optional iterable object when instantiating the class. _perc_ip(val): Send the value up the heap as it is pushed in. push(val): Append a value to the end of the list, increase list size, push the index that is equal to size, up ...
stack_v2_sparse_classes_36k_train_012542
3,124
permissive
[ { "docstring": "Take an optional iterable object when instantiating the class. Initialize size to zero.", "name": "__init__", "signature": "def __init__(self, iterable=None)" }, { "docstring": "Send the value up the heap as it is pushed in.", "name": "_perc_up", "signature": "def _perc_u...
6
stack_v2_sparse_classes_30k_train_008735
Implement the Python class `BBinnyHeap` described below. Class description: The Binary Heap Class. __init__([iterable]): takes an optional iterable object when instantiating the class. _perc_ip(val): Send the value up the heap as it is pushed in. push(val): Append a value to the end of the list, increase list size, pu...
Implement the Python class `BBinnyHeap` described below. Class description: The Binary Heap Class. __init__([iterable]): takes an optional iterable object when instantiating the class. _perc_ip(val): Send the value up the heap as it is pushed in. push(val): Append a value to the end of the list, increase list size, pu...
7951b0f0a880edd9fae5de1edc8d9290746cdbc4
<|skeleton|> class BBinnyHeap: """The Binary Heap Class. __init__([iterable]): takes an optional iterable object when instantiating the class. _perc_ip(val): Send the value up the heap as it is pushed in. push(val): Append a value to the end of the list, increase list size, push the index that is equal to size, up ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BBinnyHeap: """The Binary Heap Class. __init__([iterable]): takes an optional iterable object when instantiating the class. _perc_ip(val): Send the value up the heap as it is pushed in. push(val): Append a value to the end of the list, increase list size, push the index that is equal to size, up the list. _pe...
the_stack_v2_python_sparse
src/binheap.py
Copenbacon/data-structures
train
0
872203336420d05f7776ca38a46f0947a0c0de1e
[ "self.source = source\nself.line_num = 0\nreturn", "s = self.source.readline()\nself.line_num += 1\nreturn s" ]
<|body_start_0|> self.source = source self.line_num = 0 return <|end_body_0|> <|body_start_1|> s = self.source.readline() self.line_num += 1 return s <|end_body_1|>
FileWithLineNum
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileWithLineNum: def __init__(self, source): """start at line 0""" <|body_0|> def read(self, bytes): """read the next line and inc the line number""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.source = source self.line_num = 0 ...
stack_v2_sparse_classes_36k_train_012543
1,785
no_license
[ { "docstring": "start at line 0", "name": "__init__", "signature": "def __init__(self, source)" }, { "docstring": "read the next line and inc the line number", "name": "read", "signature": "def read(self, bytes)" } ]
2
null
Implement the Python class `FileWithLineNum` described below. Class description: Implement the FileWithLineNum class. Method signatures and docstrings: - def __init__(self, source): start at line 0 - def read(self, bytes): read the next line and inc the line number
Implement the Python class `FileWithLineNum` described below. Class description: Implement the FileWithLineNum class. Method signatures and docstrings: - def __init__(self, source): start at line 0 - def read(self, bytes): read the next line and inc the line number <|skeleton|> class FileWithLineNum: def __init...
eba6c1489b503fdcf040a126942643b355867bcd
<|skeleton|> class FileWithLineNum: def __init__(self, source): """start at line 0""" <|body_0|> def read(self, bytes): """read the next line and inc the line number""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileWithLineNum: def __init__(self, source): """start at line 0""" self.source = source self.line_num = 0 return def read(self, bytes): """read the next line and inc the line number""" s = self.source.readline() self.line_num += 1 return s
the_stack_v2_python_sparse
src/ibm/teal/util/xml_file_reader.py
ppjsand/pyteal
train
1
716ec896226449afe3205e7c147ad000e9181a5d
[ "self.tiles = self._create_tiles(map_data)\nself._connect_tiles()\nself.start = self.tiles[0][0]", "tiles = []\nfor i in range(len(map_data)):\n new_row = []\n for k in range(len(map_data[i])):\n icon = map_data[i][k]\n new_row.append(Tile(k, i, icon, TILE_DESCS[icon]))\n tiles.append(new_r...
<|body_start_0|> self.tiles = self._create_tiles(map_data) self._connect_tiles() self.start = self.tiles[0][0] <|end_body_0|> <|body_start_1|> tiles = [] for i in range(len(map_data)): new_row = [] for k in range(len(map_data[i])): icon = ...
A class to represent a map made of several connected tiles.
Map
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Map: """A class to represent a map made of several connected tiles.""" def __init__(self, map_data: list): """Given a list of lists representing map data, construct Tiles to represent each location, connect adjacent tiles, and assign a starting point. In a valid map, the starting poi...
stack_v2_sparse_classes_36k_train_012544
9,181
no_license
[ { "docstring": "Given a list of lists representing map data, construct Tiles to represent each location, connect adjacent tiles, and assign a starting point. In a valid map, the starting point will NOT be a wall, and every gem in the map will be accessible through up/down/left/right movements, beginning from th...
5
null
Implement the Python class `Map` described below. Class description: A class to represent a map made of several connected tiles. Method signatures and docstrings: - def __init__(self, map_data: list): Given a list of lists representing map data, construct Tiles to represent each location, connect adjacent tiles, and ...
Implement the Python class `Map` described below. Class description: A class to represent a map made of several connected tiles. Method signatures and docstrings: - def __init__(self, map_data: list): Given a list of lists representing map data, construct Tiles to represent each location, connect adjacent tiles, and ...
c7437d387dc2b9a8039c60d8786373899c2e28bd
<|skeleton|> class Map: """A class to represent a map made of several connected tiles.""" def __init__(self, map_data: list): """Given a list of lists representing map data, construct Tiles to represent each location, connect adjacent tiles, and assign a starting point. In a valid map, the starting poi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Map: """A class to represent a map made of several connected tiles.""" def __init__(self, map_data: list): """Given a list of lists representing map data, construct Tiles to represent each location, connect adjacent tiles, and assign a starting point. In a valid map, the starting point will NOT b...
the_stack_v2_python_sparse
CSC148/A2/part1/final drillbot.py
xxcocoymlxx/Study-Notes
train
2
e4ba491480cf19ca86f43be06ede87e7ec90a56a
[ "self.config = Config.parse(config_entry)\nself.config_entry = config_entry\n_LOGGER.debug(f'{DOMAIN} EufySecurityOptionFlowHandler - {config_entry.options}')\nself.schema = vol.Schema({vol.Optional(ConfigField.sync_interval.name, default=self.config.sync_interval): int, vol.Optional(ConfigField.rtsp_server_address...
<|body_start_0|> self.config = Config.parse(config_entry) self.config_entry = config_entry _LOGGER.debug(f'{DOMAIN} EufySecurityOptionFlowHandler - {config_entry.options}') self.schema = vol.Schema({vol.Optional(ConfigField.sync_interval.name, default=self.config.sync_interval): int, vol...
Option flow handler for integration
EufySecurityOptionFlowHandler
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EufySecurityOptionFlowHandler: """Option flow handler for integration""" def __init__(self, config_entry: ConfigEntry) -> None: """Initialize option flow handler""" <|body_0|> async def async_step_init(self, user_input=None): """Form handler""" <|body_1|>...
stack_v2_sparse_classes_36k_train_012545
6,892
permissive
[ { "docstring": "Initialize option flow handler", "name": "__init__", "signature": "def __init__(self, config_entry: ConfigEntry) -> None" }, { "docstring": "Form handler", "name": "async_step_init", "signature": "async def async_step_init(self, user_input=None)" } ]
2
null
Implement the Python class `EufySecurityOptionFlowHandler` described below. Class description: Option flow handler for integration Method signatures and docstrings: - def __init__(self, config_entry: ConfigEntry) -> None: Initialize option flow handler - async def async_step_init(self, user_input=None): Form handler
Implement the Python class `EufySecurityOptionFlowHandler` described below. Class description: Option flow handler for integration Method signatures and docstrings: - def __init__(self, config_entry: ConfigEntry) -> None: Initialize option flow handler - async def async_step_init(self, user_input=None): Form handler ...
8548d9999ddd54f13d6a307e013abcb8c897a74e
<|skeleton|> class EufySecurityOptionFlowHandler: """Option flow handler for integration""" def __init__(self, config_entry: ConfigEntry) -> None: """Initialize option flow handler""" <|body_0|> async def async_step_init(self, user_input=None): """Form handler""" <|body_1|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EufySecurityOptionFlowHandler: """Option flow handler for integration""" def __init__(self, config_entry: ConfigEntry) -> None: """Initialize option flow handler""" self.config = Config.parse(config_entry) self.config_entry = config_entry _LOGGER.debug(f'{DOMAIN} EufySecur...
the_stack_v2_python_sparse
custom_components/eufy_security/config_flow.py
bacco007/HomeAssistantConfig
train
98
96533c1d9d89100cfdc726bb1c499b87ac46db3c
[ "self.lists = [v1, v2]\nself.pointer_list = [0] * 2\nself.cur_list = 0\nself.total_size = sum((len(i) for i in self.lists))\nself.got = 0", "if self.hasNext():\n v = self.lists[self.cur_list][self.pointer_list[self.cur_list]]\n self.pointer_list[self.cur_list] += 1\n self.cur_list = (self.cur_list + 1) %...
<|body_start_0|> self.lists = [v1, v2] self.pointer_list = [0] * 2 self.cur_list = 0 self.total_size = sum((len(i) for i in self.lists)) self.got = 0 <|end_body_0|> <|body_start_1|> if self.hasNext(): v = self.lists[self.cur_list][self.pointer_list[self.cur_l...
ZigzagIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZigzagIterator: def __init__(self, v1, v2): """Initialize your data structure here. :type v1: List[int] :type v2: List[int]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end...
stack_v2_sparse_classes_36k_train_012546
1,202
no_license
[ { "docstring": "Initialize your data structure here. :type v1: List[int] :type v2: List[int]", "name": "__init__", "signature": "def __init__(self, v1, v2)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name"...
3
null
Implement the Python class `ZigzagIterator` described below. Class description: Implement the ZigzagIterator class. Method signatures and docstrings: - def __init__(self, v1, v2): Initialize your data structure here. :type v1: List[int] :type v2: List[int] - def next(self): :rtype: int - def hasNext(self): :rtype: bo...
Implement the Python class `ZigzagIterator` described below. Class description: Implement the ZigzagIterator class. Method signatures and docstrings: - def __init__(self, v1, v2): Initialize your data structure here. :type v1: List[int] :type v2: List[int] - def next(self): :rtype: int - def hasNext(self): :rtype: bo...
490c38a9478838ff23c9f910cc950633b1e3f994
<|skeleton|> class ZigzagIterator: def __init__(self, v1, v2): """Initialize your data structure here. :type v1: List[int] :type v2: List[int]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZigzagIterator: def __init__(self, v1, v2): """Initialize your data structure here. :type v1: List[int] :type v2: List[int]""" self.lists = [v1, v2] self.pointer_list = [0] * 2 self.cur_list = 0 self.total_size = sum((len(i) for i in self.lists)) self.got = 0 ...
the_stack_v2_python_sparse
Zigzag Iterator/solution.py
normanyahq/LeetCodeSolution
train
0
bb1c16e7f0a35a17ac50abf264c020c1bd2ea353
[ "self.open('https://www.baidu.com')\nself.find_element('#kw')\nself.send_values(search_key, css='#kw')\nself.click_element(css='#su')\nif fun == 'test2':\n self.assertEqual(1, 2)", "self.open('https://www.baidu.com')\nfor i in range(5):\n with self.subTest(parrern=i):\n self.send_values(i, css='#kw')...
<|body_start_0|> self.open('https://www.baidu.com') self.find_element('#kw') self.send_values(search_key, css='#kw') self.click_element(css='#su') if fun == 'test2': self.assertEqual(1, 2) <|end_body_0|> <|body_start_1|> self.open('https://www.baidu.com') ...
This is Test a
DemoTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DemoTest: """This is Test a""" def test_login(self, fun, search_key): """test_login_1""" <|body_0|> def test_subtest(self): """test subtest_1""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.open('https://www.baidu.com') self.find_el...
stack_v2_sparse_classes_36k_train_012547
1,275
no_license
[ { "docstring": "test_login_1", "name": "test_login", "signature": "def test_login(self, fun, search_key)" }, { "docstring": "test subtest_1", "name": "test_subtest", "signature": "def test_subtest(self)" } ]
2
stack_v2_sparse_classes_30k_train_007815
Implement the Python class `DemoTest` described below. Class description: This is Test a Method signatures and docstrings: - def test_login(self, fun, search_key): test_login_1 - def test_subtest(self): test subtest_1
Implement the Python class `DemoTest` described below. Class description: This is Test a Method signatures and docstrings: - def test_login(self, fun, search_key): test_login_1 - def test_subtest(self): test subtest_1 <|skeleton|> class DemoTest: """This is Test a""" def test_login(self, fun, search_key): ...
c38e5e21001325878be824c0858f3060df184d48
<|skeleton|> class DemoTest: """This is Test a""" def test_login(self, fun, search_key): """test_login_1""" <|body_0|> def test_subtest(self): """test subtest_1""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DemoTest: """This is Test a""" def test_login(self, fun, search_key): """test_login_1""" self.open('https://www.baidu.com') self.find_element('#kw') self.send_values(search_key, css='#kw') self.click_element(css='#su') if fun == 'test2': self.as...
the_stack_v2_python_sparse
demo/testcases/normal_test/test_1.py
670662282/SelenPyTest
train
0
1807cd4c53499022753c9d87b4717ca0d4f92e2a
[ "for e in submission.elements.values():\n posed_corners = e.pose.transform_all_from(e.bounds.corners())\n e.posed_bbox = ComputeBbox().from_point_cloud(posed_corners)\nfor e in ground_truth.elements.values():\n posed_corners = e.pose.transform_all_from(e.bounds.corners())\n e.posed_bbox = ComputeBbox()....
<|body_start_0|> for e in submission.elements.values(): posed_corners = e.pose.transform_all_from(e.bounds.corners()) e.posed_bbox = ComputeBbox().from_point_cloud(posed_corners) for e in ground_truth.elements.values(): posed_corners = e.pose.transform_all_from(e.boun...
Algorithm to evaluate a submission for the bounding box track.
BBEvaluator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BBEvaluator: """Algorithm to evaluate a submission for the bounding box track.""" def __init__(self, submission, ground_truth, settings=None): """Constructor. Computes similarity between all elements in the submission and ground_truth and also computes data association caches. Inputs...
stack_v2_sparse_classes_36k_train_012548
4,356
permissive
[ { "docstring": "Constructor. Computes similarity between all elements in the submission and ground_truth and also computes data association caches. Inputs: submission (ProjectScene) - Submitted scene to be evaluated ground_truth (ProjectScene) - The ground truth scene settings (dict) - configuration for the eva...
3
stack_v2_sparse_classes_30k_train_017425
Implement the Python class `BBEvaluator` described below. Class description: Algorithm to evaluate a submission for the bounding box track. Method signatures and docstrings: - def __init__(self, submission, ground_truth, settings=None): Constructor. Computes similarity between all elements in the submission and groun...
Implement the Python class `BBEvaluator` described below. Class description: Algorithm to evaluate a submission for the bounding box track. Method signatures and docstrings: - def __init__(self, submission, ground_truth, settings=None): Constructor. Computes similarity between all elements in the submission and groun...
073811351a7259ccabd145e2307f1656c50552cf
<|skeleton|> class BBEvaluator: """Algorithm to evaluate a submission for the bounding box track.""" def __init__(self, submission, ground_truth, settings=None): """Constructor. Computes similarity between all elements in the submission and ground_truth and also computes data association caches. Inputs...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BBEvaluator: """Algorithm to evaluate a submission for the bounding box track.""" def __init__(self, submission, ground_truth, settings=None): """Constructor. Computes similarity between all elements in the submission and ground_truth and also computes data association caches. Inputs: submission ...
the_stack_v2_python_sparse
sumo/metrics/bb_evaluator.py
RishabhJain2018/sumo-challenge
train
0
a8f2962b8b197f638ee917f9c175e551197e0a26
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric()", "from .entity import Entity\nfrom .entity import Entity\nfields: Dict[str, Callable[[Any], None]] = {'osCheckFailedPercentage': lambda n: setattr(self, 'os_check_failed...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric() <|end_body_0|> <|body_start_1|> from .entity import Entity from .entity import Entity fields: Dict[str, Callable[...
The user experience analytics hardware readiness entity contains account level information about hardware blockers for windows upgrade.
UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric: """The user experience analytics hardware readiness entity contains account level information about hardware blockers for windows upgrade.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExper...
stack_v2_sparse_classes_36k_train_012549
7,532
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: UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric", "name": "create_from_discriminator_value", ...
3
stack_v2_sparse_classes_30k_train_019698
Implement the Python class `UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric` described below. Class description: The user experience analytics hardware readiness entity contains account level information about hardware blockers for windows upgrade. Method signatures and docstrings: - def create_from_di...
Implement the Python class `UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric` described below. Class description: The user experience analytics hardware readiness entity contains account level information about hardware blockers for windows upgrade. Method signatures and docstrings: - def create_from_di...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric: """The user experience analytics hardware readiness entity contains account level information about hardware blockers for windows upgrade.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExper...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserExperienceAnalyticsWorkFromAnywhereHardwareReadinessMetric: """The user experience analytics hardware readiness entity contains account level information about hardware blockers for windows upgrade.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalytic...
the_stack_v2_python_sparse
msgraph/generated/models/user_experience_analytics_work_from_anywhere_hardware_readiness_metric.py
microsoftgraph/msgraph-sdk-python
train
135
c3e45acad087ed28cd648d637fb225c4e8709c60
[ "user = User.objects.create(username='testuser', password='qwerty12345Q!')\nrecruiter = User.objects.create(username='recruiter2', first_name='first_recruiter', last_name='last_recruiter', email='recruiter@mail.com')\ncandidate = User.objects.create(username='candidate2', first_name='first_candidate', last_name='la...
<|body_start_0|> user = User.objects.create(username='testuser', password='qwerty12345Q!') recruiter = User.objects.create(username='recruiter2', first_name='first_recruiter', last_name='last_recruiter', email='recruiter@mail.com') candidate = User.objects.create(username='candidate2', first_nam...
Test POST request Interviews app
InterviewsPostTestCases
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InterviewsPostTestCases: """Test POST request Interviews app""" def setUp(self): """Create new data in in linked tables""" <|body_0|> def test_post_create_interviews(self): """Test for POST Interviews""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_012550
6,694
no_license
[ { "docstring": "Create new data in in linked tables", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test for POST Interviews", "name": "test_post_create_interviews", "signature": "def test_post_create_interviews(self)" } ]
2
null
Implement the Python class `InterviewsPostTestCases` described below. Class description: Test POST request Interviews app Method signatures and docstrings: - def setUp(self): Create new data in in linked tables - def test_post_create_interviews(self): Test for POST Interviews
Implement the Python class `InterviewsPostTestCases` described below. Class description: Test POST request Interviews app Method signatures and docstrings: - def setUp(self): Create new data in in linked tables - def test_post_create_interviews(self): Test for POST Interviews <|skeleton|> class InterviewsPostTestCas...
f448ec0453818d55c5c9d30aaa4f19e1d7ca5867
<|skeleton|> class InterviewsPostTestCases: """Test POST request Interviews app""" def setUp(self): """Create new data in in linked tables""" <|body_0|> def test_post_create_interviews(self): """Test for POST Interviews""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InterviewsPostTestCases: """Test POST request Interviews app""" def setUp(self): """Create new data in in linked tables""" user = User.objects.create(username='testuser', password='qwerty12345Q!') recruiter = User.objects.create(username='recruiter2', first_name='first_recruiter',...
the_stack_v2_python_sparse
Portfolio/tech-interview/techinterview/interviews/test_interviews.py
HeCToR74/Python
train
1
b0f7473b5387043ecb040ede04506630850022a2
[ "super(PPO_CriticNetwork, self).__init__()\nxp_input = L.Placeholder((None, D_obs))\nxp = L.Linear(hidden_sizes[0])(xp_input)\nxp = L.ReLU()(xp)\nxp = L.Linear(hidden_sizes[1])(xp)\nxp = L.ReLU()(xp)\nxp = L.Linear(1)(xp)\nself.model = L.Functional(inputs=xp_input, outputs=xp)\nself.model.build((None, D_obs))", "...
<|body_start_0|> super(PPO_CriticNetwork, self).__init__() xp_input = L.Placeholder((None, D_obs)) xp = L.Linear(hidden_sizes[0])(xp_input) xp = L.ReLU()(xp) xp = L.Linear(hidden_sizes[1])(xp) xp = L.ReLU()(xp) xp = L.Linear(1)(xp) self.model = L.Functiona...
PPO custom critic network structure
PPO_CriticNetwork
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PPO_CriticNetwork: """PPO custom critic network structure""" def __init__(self, D_obs, hidden_sizes=[64, 64]): """Constructor for PPO critic network Args: D_obs: observation space dimension, scalar hidden_sizes: list of fully connected dimension""" <|body_0|> def forward...
stack_v2_sparse_classes_36k_train_012551
5,859
permissive
[ { "docstring": "Constructor for PPO critic network Args: D_obs: observation space dimension, scalar hidden_sizes: list of fully connected dimension", "name": "__init__", "signature": "def __init__(self, D_obs, hidden_sizes=[64, 64])" }, { "docstring": "Forward pass of actor network. Input assume...
2
stack_v2_sparse_classes_30k_train_006883
Implement the Python class `PPO_CriticNetwork` described below. Class description: PPO custom critic network structure Method signatures and docstrings: - def __init__(self, D_obs, hidden_sizes=[64, 64]): Constructor for PPO critic network Args: D_obs: observation space dimension, scalar hidden_sizes: list of fully c...
Implement the Python class `PPO_CriticNetwork` described below. Class description: PPO custom critic network structure Method signatures and docstrings: - def __init__(self, D_obs, hidden_sizes=[64, 64]): Constructor for PPO critic network Args: D_obs: observation space dimension, scalar hidden_sizes: list of fully c...
2556bd9c362a53e0a94da914ba59b5d4621c4081
<|skeleton|> class PPO_CriticNetwork: """PPO custom critic network structure""" def __init__(self, D_obs, hidden_sizes=[64, 64]): """Constructor for PPO critic network Args: D_obs: observation space dimension, scalar hidden_sizes: list of fully connected dimension""" <|body_0|> def forward...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PPO_CriticNetwork: """PPO custom critic network structure""" def __init__(self, D_obs, hidden_sizes=[64, 64]): """Constructor for PPO critic network Args: D_obs: observation space dimension, scalar hidden_sizes: list of fully connected dimension""" super(PPO_CriticNetwork, self).__init__(...
the_stack_v2_python_sparse
surreal/model/model_builders/builders.py
PeihongYu/surreal
train
0
156d0ef95d585b74975a6d0822c3636faf6e7a03
[ "super().__init__()\nself.conv_name = conv_name\nif conv_name in self.conv_dict:\n self.conv_layer = self.conv_dict[conv_name]\nelse:\n raise KeyError(f'Unknown model name \"{conv_name}\".Available models are: {str(self.conv_dict.keys())}')\nself.conv_layers = torch.nn.ModuleList()\ndefault_conv_hparams = sel...
<|body_start_0|> super().__init__() self.conv_name = conv_name if conv_name in self.conv_dict: self.conv_layer = self.conv_dict[conv_name] else: raise KeyError(f'Unknown model name "{conv_name}".Available models are: {str(self.conv_dict.keys())}') self.con...
GNN Regressor model
GNNRegressor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GNNRegressor: """GNN Regressor model""" def __init__(self, in_channels, out_channels, conv_name, conv_hparams, num_layers, hidden_channels, num_layers_fc, hidden_channels_fc, hidden_channels_flows, num_transforms): """Arguments: - in_channels: [int] number of input channels - out_cha...
stack_v2_sparse_classes_36k_train_012552
3,796
permissive
[ { "docstring": "Arguments: - in_channels: [int] number of input channels - out_channels: [int] number of output channels - conv_name [str]: name of the GNN layer - conv_hparams: [dict] dictionary with extra kargs for GNN layer - num_layers: [int] number of GNN hidden layers - hidden_channels: [int] number of GN...
2
stack_v2_sparse_classes_30k_train_008200
Implement the Python class `GNNRegressor` described below. Class description: GNN Regressor model Method signatures and docstrings: - def __init__(self, in_channels, out_channels, conv_name, conv_hparams, num_layers, hidden_channels, num_layers_fc, hidden_channels_fc, hidden_channels_flows, num_transforms): Arguments...
Implement the Python class `GNNRegressor` described below. Class description: GNN Regressor model Method signatures and docstrings: - def __init__(self, in_channels, out_channels, conv_name, conv_hparams, num_layers, hidden_channels, num_layers_fc, hidden_channels_fc, hidden_channels_flows, num_transforms): Arguments...
bfafeff3354cc760f35f34aca19bdd50e5998054
<|skeleton|> class GNNRegressor: """GNN Regressor model""" def __init__(self, in_channels, out_channels, conv_name, conv_hparams, num_layers, hidden_channels, num_layers_fc, hidden_channels_fc, hidden_channels_flows, num_transforms): """Arguments: - in_channels: [int] number of input channels - out_cha...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GNNRegressor: """GNN Regressor model""" def __init__(self, in_channels, out_channels, conv_name, conv_hparams, num_layers, hidden_channels, num_layers_fc, hidden_channels_fc, hidden_channels_flows, num_transforms): """Arguments: - in_channels: [int] number of input channels - out_channels: [int] ...
the_stack_v2_python_sparse
src/dsphs_gnn/gnn.py
trivnguyen/dsphs_gnn
train
2
e3f6f6f8928b32d5e3c6235d92e58fae2bb0f5d9
[ "out = io.BytesIO()\nwith gzip.GzipFile(fileobj=out, mode='w') as fo:\n fo.write(_str.encode())\nbytes_obj = out.getvalue()\nreturn bytes_obj", "tf.logging.info('Writing file: {}'.format(file_path))\nif content_encoding not in {None, 'gzip'}:\n raise ValueError('content_coding {} not supported in write_to_f...
<|body_start_0|> out = io.BytesIO() with gzip.GzipFile(fileobj=out, mode='w') as fo: fo.write(_str.encode()) bytes_obj = out.getvalue() return bytes_obj <|end_body_0|> <|body_start_1|> tf.logging.info('Writing file: {}'.format(file_path)) if content_encoding ...
Definition of data utility functions
DataUtils
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataUtils: """Definition of data utility functions""" def gzip_str(_str: str) -> bytes: """Encode string to compressed bytes Arguments: _str {str} -- string to be compressed Returns: bytes -- compressed bytes""" <|body_0|> def write_to_file(self, str_content: str, file_p...
stack_v2_sparse_classes_36k_train_012553
2,331
permissive
[ { "docstring": "Encode string to compressed bytes Arguments: _str {str} -- string to be compressed Returns: bytes -- compressed bytes", "name": "gzip_str", "signature": "def gzip_str(_str: str) -> bytes" }, { "docstring": "Write string to a (compressed) file Arguments: str_content {str} -- strin...
3
stack_v2_sparse_classes_30k_train_005377
Implement the Python class `DataUtils` described below. Class description: Definition of data utility functions Method signatures and docstrings: - def gzip_str(_str: str) -> bytes: Encode string to compressed bytes Arguments: _str {str} -- string to be compressed Returns: bytes -- compressed bytes - def write_to_fil...
Implement the Python class `DataUtils` described below. Class description: Definition of data utility functions Method signatures and docstrings: - def gzip_str(_str: str) -> bytes: Encode string to compressed bytes Arguments: _str {str} -- string to be compressed Returns: bytes -- compressed bytes - def write_to_fil...
baa6689a6344f417758d4d8b4e6c6e966a510b32
<|skeleton|> class DataUtils: """Definition of data utility functions""" def gzip_str(_str: str) -> bytes: """Encode string to compressed bytes Arguments: _str {str} -- string to be compressed Returns: bytes -- compressed bytes""" <|body_0|> def write_to_file(self, str_content: str, file_p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataUtils: """Definition of data utility functions""" def gzip_str(_str: str) -> bytes: """Encode string to compressed bytes Arguments: _str {str} -- string to be compressed Returns: bytes -- compressed bytes""" out = io.BytesIO() with gzip.GzipFile(fileobj=out, mode='w') as fo: ...
the_stack_v2_python_sparse
lib/data_utils.py
tmaone/s3vdc
train
0
ce0051d6d7d1be360862cda89b738f7f972c66a6
[ "widget = self._widget\nif not widget:\n return self._default_size\nreturn widget.GetMaxSize()", "if self._widget is not widget:\n self.Clear(deleteWindows=False)\n old = self._widget\n if old:\n old.Hide()\n self._widget = widget\n if widget:\n widget.Show()\n res = super(w...
<|body_start_0|> widget = self._widget if not widget: return self._default_size return widget.GetMaxSize() <|end_body_0|> <|body_start_1|> if self._widget is not widget: self.Clear(deleteWindows=False) old = self._widget if old: ...
A custom wx Sizer for sizing a single child widget. There can only be one widget in this sizer at a time and it should be added via the .Add(...) method. Old items will be removed automatically (but not destroyed).
wxSingleWidgetSizer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class wxSingleWidgetSizer: """A custom wx Sizer for sizing a single child widget. There can only be one widget in this sizer at a time and it should be added via the .Add(...) method. Old items will be removed automatically (but not destroyed).""" def CalcMax(self): """A method to compute ...
stack_v2_sparse_classes_36k_train_012554
2,025
permissive
[ { "docstring": "A method to compute the maximum size allowed by the sizer. This is not a native wx sizer method, but is included for convenience.", "name": "CalcMax", "signature": "def CalcMax(self)" }, { "docstring": "Adds the given widget to the sizer, removing the old widget if present. The o...
4
null
Implement the Python class `wxSingleWidgetSizer` described below. Class description: A custom wx Sizer for sizing a single child widget. There can only be one widget in this sizer at a time and it should be added via the .Add(...) method. Old items will be removed automatically (but not destroyed). Method signatures ...
Implement the Python class `wxSingleWidgetSizer` described below. Class description: A custom wx Sizer for sizing a single child widget. There can only be one widget in this sizer at a time and it should be added via the .Add(...) method. Old items will be removed automatically (but not destroyed). Method signatures ...
15c20b035a73187e8e66fa20a43c3a4372d008bd
<|skeleton|> class wxSingleWidgetSizer: """A custom wx Sizer for sizing a single child widget. There can only be one widget in this sizer at a time and it should be added via the .Add(...) method. Old items will be removed automatically (but not destroyed).""" def CalcMax(self): """A method to compute ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class wxSingleWidgetSizer: """A custom wx Sizer for sizing a single child widget. There can only be one widget in this sizer at a time and it should be added via the .Add(...) method. Old items will be removed automatically (but not destroyed).""" def CalcMax(self): """A method to compute the maximum s...
the_stack_v2_python_sparse
enaml/wx/wx_single_widget_sizer.py
ContinuumIO/enaml
train
2
201baff64043997c3684f8a68b37ce77190717e7
[ "for i in orm.Item.objects.all():\n try:\n i.status.remove(orm.Status.objects.get(name='Usable'))\n i.save()\n except ObjectDoesNotExist:\n pass\ntry:\n orm.Status.delete(orm.Status.objects.get(name='Usable'))\nexcept ObjectDoesNotExist:\n pass", "try:\n usable = orm.Status.obj...
<|body_start_0|> for i in orm.Item.objects.all(): try: i.status.remove(orm.Status.objects.get(name='Usable')) i.save() except ObjectDoesNotExist: pass try: orm.Status.delete(orm.Status.objects.get(name='Usable')) ...
Migration
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Migration: def forwards(self, orm): """Loop through all items and delete the Usable status At the end remove 'Usable' status from Status""" <|body_0|> def backwards(self, orm): """Add 'Usable' status to Status. Loop through all items and add the Usable status if not ...
stack_v2_sparse_classes_36k_train_012555
12,509
permissive
[ { "docstring": "Loop through all items and delete the Usable status At the end remove 'Usable' status from Status", "name": "forwards", "signature": "def forwards(self, orm)" }, { "docstring": "Add 'Usable' status to Status. Loop through all items and add the Usable status if not exist", "na...
2
stack_v2_sparse_classes_30k_train_018437
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Loop through all items and delete the Usable status At the end remove 'Usable' status from Status - def backwards(self, orm): Add 'Usable' status to St...
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Loop through all items and delete the Usable status At the end remove 'Usable' status from Status - def backwards(self, orm): Add 'Usable' status to St...
7096ff360a6161118bb454b2874318eade69c6df
<|skeleton|> class Migration: def forwards(self, orm): """Loop through all items and delete the Usable status At the end remove 'Usable' status from Status""" <|body_0|> def backwards(self, orm): """Add 'Usable' status to Status. Loop through all items and add the Usable status if not ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Migration: def forwards(self, orm): """Loop through all items and delete the Usable status At the end remove 'Usable' status from Status""" for i in orm.Item.objects.all(): try: i.status.remove(orm.Status.objects.get(name='Usable')) i.save() ...
the_stack_v2_python_sparse
Machine/migrations/0008_remove_usable_status.py
abztrakt/labtracker
train
0
9ecd0f30fa882e48d8ccf2fa684ec5047c70c450
[ "super(GilbertElliott, self).__init__(PacketLoss.__name__)\nif prhk is None:\n p = float(GilbertElliott.__DEFAULT_P)\n r = float(GilbertElliott.__DEFAULT_R)\n b = float(1.0 - GilbertElliott.__DEFAULT_H)\n g = float(1.0 - GilbertElliott.__DEFAULT_K)\nelse:\n for param in range(4):\n check_argum...
<|body_start_0|> super(GilbertElliott, self).__init__(PacketLoss.__name__) if prhk is None: p = float(GilbertElliott.__DEFAULT_P) r = float(GilbertElliott.__DEFAULT_R) b = float(1.0 - GilbertElliott.__DEFAULT_H) g = float(1.0 - GilbertElliott.__DEFAULT_K) ...
This class implements the Gilbert-Elliott packet loss model.
GilbertElliott
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GilbertElliott: """This class implements the Gilbert-Elliott packet loss model.""" def __init__(self, prhk=None): """*Parameters*: - **prhk** (`tuple`): a `tuple` that contains four model parameters: :math:`0\\leqslant p,r,h,k\\leqslant 1`, respectively (each of type `float`). The pa...
stack_v2_sparse_classes_36k_train_012556
6,499
permissive
[ { "docstring": "*Parameters*: - **prhk** (`tuple`): a `tuple` that contains four model parameters: :math:`0\\\\leqslant p,r,h,k\\\\leqslant 1`, respectively (each of type `float`). The parameters default to the following values: * :math:`p=0.00001333`, * :math:`r=0.00601795`, * :math:`h=0.55494900`, * :math:`k=...
2
stack_v2_sparse_classes_30k_train_003678
Implement the Python class `GilbertElliott` described below. Class description: This class implements the Gilbert-Elliott packet loss model. Method signatures and docstrings: - def __init__(self, prhk=None): *Parameters*: - **prhk** (`tuple`): a `tuple` that contains four model parameters: :math:`0\\leqslant p,r,h,k\...
Implement the Python class `GilbertElliott` described below. Class description: This class implements the Gilbert-Elliott packet loss model. Method signatures and docstrings: - def __init__(self, prhk=None): *Parameters*: - **prhk** (`tuple`): a `tuple` that contains four model parameters: :math:`0\\leqslant p,r,h,k\...
ed93d1e3067c569dd4194658b0d02da6b0ab4bed
<|skeleton|> class GilbertElliott: """This class implements the Gilbert-Elliott packet loss model.""" def __init__(self, prhk=None): """*Parameters*: - **prhk** (`tuple`): a `tuple` that contains four model parameters: :math:`0\\leqslant p,r,h,k\\leqslant 1`, respectively (each of type `float`). The pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GilbertElliott: """This class implements the Gilbert-Elliott packet loss model.""" def __init__(self, prhk=None): """*Parameters*: - **prhk** (`tuple`): a `tuple` that contains four model parameters: :math:`0\\leqslant p,r,h,k\\leqslant 1`, respectively (each of type `float`). The parameters defa...
the_stack_v2_python_sparse
sim2net/packet_loss/gilbert_elliott.py
mkalewski/sim2net
train
14
bfda53fbb253e99a8aa1086af9e69c1c83720e8e
[ "def traverse_longest(row, col, prev_num):\n if not (0 <= row < m and 0 <= col < n):\n return 0\n current_num = matrix[row][col]\n if current_num <= prev_num:\n return 0\n up = traverse_longest(row - 1, col, current_num)\n down = traverse_longest(row + 1, col, current_num)\n left = t...
<|body_start_0|> def traverse_longest(row, col, prev_num): if not (0 <= row < m and 0 <= col < n): return 0 current_num = matrix[row][col] if current_num <= prev_num: return 0 up = traverse_longest(row - 1, col, current_num) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestIncreasingPath(self, matrix: list[list[int]]) -> int: """DFS""" <|body_0|> def longestIncreasingPath(self, matrix: List[List[int]]) -> int: """memoization""" <|body_1|> <|end_skeleton|> <|body_start_0|> def traverse_longest(row,...
stack_v2_sparse_classes_36k_train_012557
1,958
no_license
[ { "docstring": "DFS", "name": "longestIncreasingPath", "signature": "def longestIncreasingPath(self, matrix: list[list[int]]) -> int" }, { "docstring": "memoization", "name": "longestIncreasingPath", "signature": "def longestIncreasingPath(self, matrix: List[List[int]]) -> int" } ]
2
stack_v2_sparse_classes_30k_train_021196
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestIncreasingPath(self, matrix: list[list[int]]) -> int: DFS - def longestIncreasingPath(self, matrix: List[List[int]]) -> int: memoization
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestIncreasingPath(self, matrix: list[list[int]]) -> int: DFS - def longestIncreasingPath(self, matrix: List[List[int]]) -> int: memoization <|skeleton|> class Solution: ...
e50dc0642f087f37ab3234390be3d8a0ed48fe62
<|skeleton|> class Solution: def longestIncreasingPath(self, matrix: list[list[int]]) -> int: """DFS""" <|body_0|> def longestIncreasingPath(self, matrix: List[List[int]]) -> int: """memoization""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestIncreasingPath(self, matrix: list[list[int]]) -> int: """DFS""" def traverse_longest(row, col, prev_num): if not (0 <= row < m and 0 <= col < n): return 0 current_num = matrix[row][col] if current_num <= prev_num: ...
the_stack_v2_python_sparse
Leetcode/329. Longest Increasing Path in a Matrix.py
brlala/Educative-Grokking-Coding-Exercise
train
3
0db12b209c223fd9f22bf09d9ba9a6d0971f6016
[ "self.days = days\nself.end_time = end_time\nself.is_all_day = is_all_day\nself.start_time = start_time", "if dictionary is None:\n return None\ndays = dictionary.get('days')\nend_time = cohesity_management_sdk.models.time_of_day.TimeOfDay.from_dictionary(dictionary.get('endTime')) if dictionary.get('endTime')...
<|body_start_0|> self.days = days self.end_time = end_time self.is_all_day = is_all_day self.start_time = start_time <|end_body_0|> <|body_start_1|> if dictionary is None: return None days = dictionary.get('days') end_time = cohesity_management_sdk.mo...
Implementation of the 'TimeOfAWeek' model. Specifies a time period by specifying a single daily time period and one or more days of the week, for example 9 AM - 5 PM on Monday, Wednesday or Friday. If different time periods are required on different days, then multiple instances of this Weekly Time Period must be speci...
TimeOfAWeek
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeOfAWeek: """Implementation of the 'TimeOfAWeek' model. Specifies a time period by specifying a single daily time period and one or more days of the week, for example 9 AM - 5 PM on Monday, Wednesday or Friday. If different time periods are required on different days, then multiple instances o...
stack_v2_sparse_classes_36k_train_012558
2,834
permissive
[ { "docstring": "Constructor for the TimeOfAWeek class", "name": "__init__", "signature": "def __init__(self, days=None, end_time=None, is_all_day=None, start_time=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representat...
2
stack_v2_sparse_classes_30k_train_002807
Implement the Python class `TimeOfAWeek` described below. Class description: Implementation of the 'TimeOfAWeek' model. Specifies a time period by specifying a single daily time period and one or more days of the week, for example 9 AM - 5 PM on Monday, Wednesday or Friday. If different time periods are required on di...
Implement the Python class `TimeOfAWeek` described below. Class description: Implementation of the 'TimeOfAWeek' model. Specifies a time period by specifying a single daily time period and one or more days of the week, for example 9 AM - 5 PM on Monday, Wednesday or Friday. If different time periods are required on di...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class TimeOfAWeek: """Implementation of the 'TimeOfAWeek' model. Specifies a time period by specifying a single daily time period and one or more days of the week, for example 9 AM - 5 PM on Monday, Wednesday or Friday. If different time periods are required on different days, then multiple instances o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimeOfAWeek: """Implementation of the 'TimeOfAWeek' model. Specifies a time period by specifying a single daily time period and one or more days of the week, for example 9 AM - 5 PM on Monday, Wednesday or Friday. If different time periods are required on different days, then multiple instances of this Weekly...
the_stack_v2_python_sparse
cohesity_management_sdk/models/time_of_a_week.py
cohesity/management-sdk-python
train
24
b2cdd5f1a09aa4ef54d733b74cc4eed06b3835e1
[ "s = sessionmanage(self.driver)\ns.open_sessionmanage()\nself.assertEqual(s.verify(), True)\ns.check()\nself.assertEqual(s.reason(), '请选择一条数据')\nfunction.screenshot(self.driver, 'session_unselect.jpg')", "s = sessionmanage(self.driver)\ns.open_sessionmanage()\nself.assertEqual(s.verify(), True)\ns.multi_select()\...
<|body_start_0|> s = sessionmanage(self.driver) s.open_sessionmanage() self.assertEqual(s.verify(), True) s.check() self.assertEqual(s.reason(), '请选择一条数据') function.screenshot(self.driver, 'session_unselect.jpg') <|end_body_0|> <|body_start_1|> s = sessionmanage(...
Test049_Session_List_Error
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test049_Session_List_Error: def test_unselect(self): """不选择任何会话""" <|body_0|> def test_multiselect(self): """选择两条会话""" <|body_1|> <|end_skeleton|> <|body_start_0|> s = sessionmanage(self.driver) s.open_sessionmanage() self.assertEqua...
stack_v2_sparse_classes_36k_train_012559
939
no_license
[ { "docstring": "不选择任何会话", "name": "test_unselect", "signature": "def test_unselect(self)" }, { "docstring": "选择两条会话", "name": "test_multiselect", "signature": "def test_multiselect(self)" } ]
2
stack_v2_sparse_classes_30k_test_000044
Implement the Python class `Test049_Session_List_Error` described below. Class description: Implement the Test049_Session_List_Error class. Method signatures and docstrings: - def test_unselect(self): 不选择任何会话 - def test_multiselect(self): 选择两条会话
Implement the Python class `Test049_Session_List_Error` described below. Class description: Implement the Test049_Session_List_Error class. Method signatures and docstrings: - def test_unselect(self): 不选择任何会话 - def test_multiselect(self): 选择两条会话 <|skeleton|> class Test049_Session_List_Error: def test_unselect(s...
6f42c25249fc642cecc270578a180820988d45b5
<|skeleton|> class Test049_Session_List_Error: def test_unselect(self): """不选择任何会话""" <|body_0|> def test_multiselect(self): """选择两条会话""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test049_Session_List_Error: def test_unselect(self): """不选择任何会话""" s = sessionmanage(self.driver) s.open_sessionmanage() self.assertEqual(s.verify(), True) s.check() self.assertEqual(s.reason(), '请选择一条数据') function.screenshot(self.driver, 'session_unsele...
the_stack_v2_python_sparse
GlxssLive_web/TestCase/Manage_Session/Test049_session_list_error.py
rrmiracle/GlxssLive
train
0
91d49558ef3d3d5b8092493a8a375b3df14f9147
[ "new_dtype = src_array.dtype.descr + [dtype]\nnew_array = np.array([list(x) for x in src_array])\nadd = []\nfor i in add_row:\n add.append([i])\nnew_array = np.append(new_array, add, 1)\nnew_array = np.array([tuple(x) for x in new_array], dtype=new_dtype)\nreturn new_array", "new_dtype = []\nfor key, dtype in ...
<|body_start_0|> new_dtype = src_array.dtype.descr + [dtype] new_array = np.array([list(x) for x in src_array]) add = [] for i in add_row: add.append([i]) new_array = np.append(new_array, add, 1) new_array = np.array([tuple(x) for x in new_array], dtype=new_dt...
numpy array関連
Array
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Array: """numpy array関連""" def add_data(src_array, add_row, dtype): """ラベル付きarrayに新しい一次元dataを加える⇒commopy行き??""" <|body_0|> def extract(src_array, *labels): """labelsのデータのみを抽出してarrayをreturn""" <|body_1|> def trim(array, label, value): """label...
stack_v2_sparse_classes_36k_train_012560
17,123
no_license
[ { "docstring": "ラベル付きarrayに新しい一次元dataを加える⇒commopy行き??", "name": "add_data", "signature": "def add_data(src_array, add_row, dtype)" }, { "docstring": "labelsのデータのみを抽出してarrayをreturn", "name": "extract", "signature": "def extract(src_array, *labels)" }, { "docstring": "labelsのデータがva...
6
stack_v2_sparse_classes_30k_val_000630
Implement the Python class `Array` described below. Class description: numpy array関連 Method signatures and docstrings: - def add_data(src_array, add_row, dtype): ラベル付きarrayに新しい一次元dataを加える⇒commopy行き?? - def extract(src_array, *labels): labelsのデータのみを抽出してarrayをreturn - def trim(array, label, value): labelsのデータがvalueと等しい...
Implement the Python class `Array` described below. Class description: numpy array関連 Method signatures and docstrings: - def add_data(src_array, add_row, dtype): ラベル付きarrayに新しい一次元dataを加える⇒commopy行き?? - def extract(src_array, *labels): labelsのデータのみを抽出してarrayをreturn - def trim(array, label, value): labelsのデータがvalueと等しい...
d210cf6f8fb370ff6deecc949c7dcb3df653d1ca
<|skeleton|> class Array: """numpy array関連""" def add_data(src_array, add_row, dtype): """ラベル付きarrayに新しい一次元dataを加える⇒commopy行き??""" <|body_0|> def extract(src_array, *labels): """labelsのデータのみを抽出してarrayをreturn""" <|body_1|> def trim(array, label, value): """label...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Array: """numpy array関連""" def add_data(src_array, add_row, dtype): """ラベル付きarrayに新しい一次元dataを加える⇒commopy行き??""" new_dtype = src_array.dtype.descr + [dtype] new_array = np.array([list(x) for x in src_array]) add = [] for i in add_row: add.append([i]) ...
the_stack_v2_python_sparse
module/commopy.py
buriedwood/00_workSpace
train
0
8b59d4d402404d30eb3b476e64efde8f3277f06b
[ "cookies = []\nfor pairs in split_header(string):\n for name, value in pairs:\n if name.startswith('$'):\n continue\n cookies.append(self.new(name=name, value=notnone(value, '')))\nreturn cookies", "name = str(notnone(self.name, ''))\nif not name:\n return ''\nvalue = str(notnone(se...
<|body_start_0|> cookies = [] for pairs in split_header(string): for name, value in pairs: if name.startswith('$'): continue cookies.append(self.new(name=name, value=notnone(value, ''))) return cookies <|end_body_0|> <|body_start_1...
:mod:`Pyjo.Cookie.Request` inherits all attributes and methods from :mod:`Pyjo.Cookie` and implements the following new ones.
Pyjo_Cookie_Request
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pyjo_Cookie_Request: """:mod:`Pyjo.Cookie.Request` inherits all attributes and methods from :mod:`Pyjo.Cookie` and implements the following new ones.""" def parse(self, string=''): """:: cookies = Pyjo.Cookie.Request.parse('f=b; g=a') Parse cookies.""" <|body_0|> def to_...
stack_v2_sparse_classes_36k_train_012561
1,565
no_license
[ { "docstring": ":: cookies = Pyjo.Cookie.Request.parse('f=b; g=a') Parse cookies.", "name": "parse", "signature": "def parse(self, string='')" }, { "docstring": ":: string = cookie.to_str() Render cookie.", "name": "to_str", "signature": "def to_str(self)" } ]
2
stack_v2_sparse_classes_30k_train_016594
Implement the Python class `Pyjo_Cookie_Request` described below. Class description: :mod:`Pyjo.Cookie.Request` inherits all attributes and methods from :mod:`Pyjo.Cookie` and implements the following new ones. Method signatures and docstrings: - def parse(self, string=''): :: cookies = Pyjo.Cookie.Request.parse('f=b...
Implement the Python class `Pyjo_Cookie_Request` described below. Class description: :mod:`Pyjo.Cookie.Request` inherits all attributes and methods from :mod:`Pyjo.Cookie` and implements the following new ones. Method signatures and docstrings: - def parse(self, string=''): :: cookies = Pyjo.Cookie.Request.parse('f=b...
31197cd2765d12fdf0d508bc0981743e5fb58e87
<|skeleton|> class Pyjo_Cookie_Request: """:mod:`Pyjo.Cookie.Request` inherits all attributes and methods from :mod:`Pyjo.Cookie` and implements the following new ones.""" def parse(self, string=''): """:: cookies = Pyjo.Cookie.Request.parse('f=b; g=a') Parse cookies.""" <|body_0|> def to_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Pyjo_Cookie_Request: """:mod:`Pyjo.Cookie.Request` inherits all attributes and methods from :mod:`Pyjo.Cookie` and implements the following new ones.""" def parse(self, string=''): """:: cookies = Pyjo.Cookie.Request.parse('f=b; g=a') Parse cookies.""" cookies = [] for pairs in sp...
the_stack_v2_python_sparse
Pyjo/Cookie/Request.py
dex4er/Pyjoyment
train
0
8b45521141ccdbb54aff80605ac945d79988821a
[ "logger.info('Check 角色管理 begin')\nAPI().assertElementByName(self.testcase, self.driver, self.logger, Name.role_management)\nlogger.info('Check 角色管理 end')", "logger.info('Check 角色列表 begin')\nname = API().getTextByXpath(self.testcase, self.driver, self.logger, Xpath.role_management_name)\ncreator = API().getTextByX...
<|body_start_0|> logger.info('Check 角色管理 begin') API().assertElementByName(self.testcase, self.driver, self.logger, Name.role_management) logger.info('Check 角色管理 end') <|end_body_0|> <|body_start_1|> logger.info('Check 角色列表 begin') name = API().getTextByXpath(self.testcase, self...
RoleManagementPage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoleManagementPage: def validSelf(self): """验证角色列表页面 :return:""" <|body_0|> def checkRoleList(self): """检查角色列表是否为空 :return:""" <|body_1|> def clickOnNewRoleButton(self): """点击新建角色按钮 :return:""" <|body_2|> def validNewRolePage(self): ...
stack_v2_sparse_classes_36k_train_012562
4,182
no_license
[ { "docstring": "验证角色列表页面 :return:", "name": "validSelf", "signature": "def validSelf(self)" }, { "docstring": "检查角色列表是否为空 :return:", "name": "checkRoleList", "signature": "def checkRoleList(self)" }, { "docstring": "点击新建角色按钮 :return:", "name": "clickOnNewRoleButton", "sig...
5
stack_v2_sparse_classes_30k_train_011075
Implement the Python class `RoleManagementPage` described below. Class description: Implement the RoleManagementPage class. Method signatures and docstrings: - def validSelf(self): 验证角色列表页面 :return: - def checkRoleList(self): 检查角色列表是否为空 :return: - def clickOnNewRoleButton(self): 点击新建角色按钮 :return: - def validNewRolePa...
Implement the Python class `RoleManagementPage` described below. Class description: Implement the RoleManagementPage class. Method signatures and docstrings: - def validSelf(self): 验证角色列表页面 :return: - def checkRoleList(self): 检查角色列表是否为空 :return: - def clickOnNewRoleButton(self): 点击新建角色按钮 :return: - def validNewRolePa...
67e2acc9a99da81022e286e8d8ec7ccb12636ff3
<|skeleton|> class RoleManagementPage: def validSelf(self): """验证角色列表页面 :return:""" <|body_0|> def checkRoleList(self): """检查角色列表是否为空 :return:""" <|body_1|> def clickOnNewRoleButton(self): """点击新建角色按钮 :return:""" <|body_2|> def validNewRolePage(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RoleManagementPage: def validSelf(self): """验证角色列表页面 :return:""" logger.info('Check 角色管理 begin') API().assertElementByName(self.testcase, self.driver, self.logger, Name.role_management) logger.info('Check 角色管理 end') def checkRoleList(self): """检查角色列表是否为空 :return:""...
the_stack_v2_python_sparse
pages/ios/shanghu/roleManagementPage.py
liu111xiao111/UItest
train
1
91bd2fc96977683de140f76944af0733510f0a17
[ "super().__init__()\nself.gmm_size = gmm_size\nself.sample_size = sample_size\nself.input_slice = input_slice\nself.target_slice = target_slice\nself.stdout = stdout\nself.save_plots = save_plots\nos.makedirs(plot_dir, exist_ok=True)\nself.plot_dir = plot_dir", "random.seed(datetime.now())\nsample_indexes = rando...
<|body_start_0|> super().__init__() self.gmm_size = gmm_size self.sample_size = sample_size self.input_slice = input_slice self.target_slice = target_slice self.stdout = stdout self.save_plots = save_plots os.makedirs(plot_dir, exist_ok=True) self....
DecypherAll
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecypherAll: def __init__(self, gmm_size=1, sample_size=3, input_slice=lambda x: x[0:1], target_slice=lambda x: x[1:2], stdout=False, save_plots=True, plot_dir='plots'): """Class constructor that instantiates with a few vital settings in order to decypher the output :type target_slice: o...
stack_v2_sparse_classes_36k_train_012563
3,310
permissive
[ { "docstring": "Class constructor that instantiates with a few vital settings in order to decypher the output :type target_slice: object :param gmm_size: size as an integer of the gaussian mixture model :param sample_size: size as an integer of the number of samples to log :param stdout: boolean whether or not ...
2
stack_v2_sparse_classes_30k_train_012436
Implement the Python class `DecypherAll` described below. Class description: Implement the DecypherAll class. Method signatures and docstrings: - def __init__(self, gmm_size=1, sample_size=3, input_slice=lambda x: x[0:1], target_slice=lambda x: x[1:2], stdout=False, save_plots=True, plot_dir='plots'): Class construct...
Implement the Python class `DecypherAll` described below. Class description: Implement the DecypherAll class. Method signatures and docstrings: - def __init__(self, gmm_size=1, sample_size=3, input_slice=lambda x: x[0:1], target_slice=lambda x: x[1:2], stdout=False, save_plots=True, plot_dir='plots'): Class construct...
6ade84c0ac1197b21d189f905ec559505ca15159
<|skeleton|> class DecypherAll: def __init__(self, gmm_size=1, sample_size=3, input_slice=lambda x: x[0:1], target_slice=lambda x: x[1:2], stdout=False, save_plots=True, plot_dir='plots'): """Class constructor that instantiates with a few vital settings in order to decypher the output :type target_slice: o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DecypherAll: def __init__(self, gmm_size=1, sample_size=3, input_slice=lambda x: x[0:1], target_slice=lambda x: x[1:2], stdout=False, save_plots=True, plot_dir='plots'): """Class constructor that instantiates with a few vital settings in order to decypher the output :type target_slice: object :param g...
the_stack_v2_python_sparse
model/topoml_util/PyplotLogger.py
Empythy/geometry-learning
train
0
fd370e017757197189a3d98a241114b6c8ffc0c0
[ "super(Critic, self).__init__()\nself.state_size = state_size\nself.action_size = action_size\nself.linear1 = nn.Linear(self.state_size + self.action_size, 128)\nself.linear2 = nn.Linear(128, 256)\nself.linear3 = nn.Linear(256, 1)\nself.relu = nn.ReLU()\nself.weight_init()", "model_input = torch.cat([state, actio...
<|body_start_0|> super(Critic, self).__init__() self.state_size = state_size self.action_size = action_size self.linear1 = nn.Linear(self.state_size + self.action_size, 128) self.linear2 = nn.Linear(128, 256) self.linear3 = nn.Linear(256, 1) self.relu = nn.ReLU() ...
Critic
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Critic: def __init__(self, state_size, action_size): """init function Args: - state_size: int - action_size: int""" <|body_0|> def forward(self, state, action): """forward function Args: - state: torch.FloatTensor, shape==[batch_size, state_size] - action: torch.Floa...
stack_v2_sparse_classes_36k_train_012564
2,778
no_license
[ { "docstring": "init function Args: - state_size: int - action_size: int", "name": "__init__", "signature": "def __init__(self, state_size, action_size)" }, { "docstring": "forward function Args: - state: torch.FloatTensor, shape==[batch_size, state_size] - action: torch.FloatTensor, shape==[bat...
3
stack_v2_sparse_classes_30k_val_000475
Implement the Python class `Critic` described below. Class description: Implement the Critic class. Method signatures and docstrings: - def __init__(self, state_size, action_size): init function Args: - state_size: int - action_size: int - def forward(self, state, action): forward function Args: - state: torch.FloatT...
Implement the Python class `Critic` described below. Class description: Implement the Critic class. Method signatures and docstrings: - def __init__(self, state_size, action_size): init function Args: - state_size: int - action_size: int - def forward(self, state, action): forward function Args: - state: torch.FloatT...
2c622764bc1197e0ec5b1b3c30a9d12611b25738
<|skeleton|> class Critic: def __init__(self, state_size, action_size): """init function Args: - state_size: int - action_size: int""" <|body_0|> def forward(self, state, action): """forward function Args: - state: torch.FloatTensor, shape==[batch_size, state_size] - action: torch.Floa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Critic: def __init__(self, state_size, action_size): """init function Args: - state_size: int - action_size: int""" super(Critic, self).__init__() self.state_size = state_size self.action_size = action_size self.linear1 = nn.Linear(self.state_size + self.action_size, 12...
the_stack_v2_python_sparse
DDPG/model.py
keiiti975/RL_sample
train
0
bf373e2ca5851e71b9eb14437d6ef66fab794c53
[ "MAX_INT = pow(2, 31)\nrev = 0\nt = x\nwhile t != 0:\n rev = rev * 10 + t % 10\n if rev > MAX_INT:\n return 0\n t = t // 10\nreturn rev", "if x < 0:\n return False\nxrev = self.reverse(x)\nif x == xrev:\n return True\nelse:\n return False" ]
<|body_start_0|> MAX_INT = pow(2, 31) rev = 0 t = x while t != 0: rev = rev * 10 + t % 10 if rev > MAX_INT: return 0 t = t // 10 return rev <|end_body_0|> <|body_start_1|> if x < 0: return False xrev...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverse(self, x): """:type x: int :rtype: int""" <|body_0|> def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> MAX_INT = pow(2, 31) rev = 0 t = x while t != 0...
stack_v2_sparse_classes_36k_train_012565
1,171
no_license
[ { "docstring": ":type x: int :rtype: int", "name": "reverse", "signature": "def reverse(self, x)" }, { "docstring": ":type x: int :rtype: bool", "name": "isPalindrome", "signature": "def isPalindrome(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_000281
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse(self, x): :type x: int :rtype: int - def isPalindrome(self, x): :type x: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse(self, x): :type x: int :rtype: int - def isPalindrome(self, x): :type x: int :rtype: bool <|skeleton|> class Solution: def reverse(self, x): """:type x:...
0901a144f2ea058523a8e45ffc9af4648163b0e4
<|skeleton|> class Solution: def reverse(self, x): """:type x: int :rtype: int""" <|body_0|> def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverse(self, x): """:type x: int :rtype: int""" MAX_INT = pow(2, 31) rev = 0 t = x while t != 0: rev = rev * 10 + t % 10 if rev > MAX_INT: return 0 t = t // 10 return rev def isPalindrome(se...
the_stack_v2_python_sparse
_9-PalindromeNumber/PalindromeNumber2.py
q1003722295/WeonLeetcode
train
1
b956596338ec082f9ab18daa3abece65b6978826
[ "if self.context['user'].email == value:\n raise serializers.ValidationError(\"You can't add yourself to the company\")\nreturn value", "if str(value) not in roles:\n raise serializers.ValidationError({'role': 'Role {} does not exist'.format(value)})\nreturn value" ]
<|body_start_0|> if self.context['user'].email == value: raise serializers.ValidationError("You can't add yourself to the company") return value <|end_body_0|> <|body_start_1|> if str(value) not in roles: raise serializers.ValidationError({'role': 'Role {} does not exist...
Serializer params class.
EmployeeParamsSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmployeeParamsSerializer: """Serializer params class.""" def validate_email(self, value): """Employee parameter validation.""" <|body_0|> def validate_role(self, value): """Employee role validation.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_012566
3,659
no_license
[ { "docstring": "Employee parameter validation.", "name": "validate_email", "signature": "def validate_email(self, value)" }, { "docstring": "Employee role validation.", "name": "validate_role", "signature": "def validate_role(self, value)" } ]
2
null
Implement the Python class `EmployeeParamsSerializer` described below. Class description: Serializer params class. Method signatures and docstrings: - def validate_email(self, value): Employee parameter validation. - def validate_role(self, value): Employee role validation.
Implement the Python class `EmployeeParamsSerializer` described below. Class description: Serializer params class. Method signatures and docstrings: - def validate_email(self, value): Employee parameter validation. - def validate_role(self, value): Employee role validation. <|skeleton|> class EmployeeParamsSerialize...
252b0ebd77eefbcc945a0efc3068cc3421f46d5f
<|skeleton|> class EmployeeParamsSerializer: """Serializer params class.""" def validate_email(self, value): """Employee parameter validation.""" <|body_0|> def validate_role(self, value): """Employee role validation.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmployeeParamsSerializer: """Serializer params class.""" def validate_email(self, value): """Employee parameter validation.""" if self.context['user'].email == value: raise serializers.ValidationError("You can't add yourself to the company") return value def valid...
the_stack_v2_python_sparse
app/companies/serializers/employees_serializer.py
vsokoltsov/Interview360Server
train
2
eb3d706448ad8185b656449b7fd56946ce62a17b
[ "self.is_valid = True\npsp = {}\nfor skey in self.SPECS:\n psp[skey] = ''\nfor field in input_fields:\n key, value = re.split(':', field)\n psp[key.upper()] = value\nself.psp = psp", "for skey in self.SPECS:\n if self.psp[skey] == '' and skey != 'CID':\n return False\nreturn True", "for skey ...
<|body_start_0|> self.is_valid = True psp = {} for skey in self.SPECS: psp[skey] = '' for field in input_fields: key, value = re.split(':', field) psp[key.upper()] = value self.psp = psp <|end_body_0|> <|body_start_1|> for skey in self...
Validates passport based on the required fields. Input fields: byr (Birth Year) - four digits; at least 1920 and at most 2002. iyr (Issue Year) - four digits; at least 2010 and at most 2020. eyr (Expiration Year) - four digits; at least 2020 and at most 2030. hgt (Height) - a number followed by either cm or in: If cm, ...
PassportValidator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PassportValidator: """Validates passport based on the required fields. Input fields: byr (Birth Year) - four digits; at least 1920 and at most 2002. iyr (Issue Year) - four digits; at least 2010 and at most 2020. eyr (Expiration Year) - four digits; at least 2020 and at most 2030. hgt (Height) - ...
stack_v2_sparse_classes_36k_train_012567
3,972
no_license
[ { "docstring": "Args: input_fields (list): All available input fields.", "name": "__init__", "signature": "def __init__(self, input_fields)" }, { "docstring": "Validate passport entries. Args: Returns: bool: Valid or not.", "name": "validate_4a", "signature": "def validate_4a(self)" },...
3
stack_v2_sparse_classes_30k_train_017649
Implement the Python class `PassportValidator` described below. Class description: Validates passport based on the required fields. Input fields: byr (Birth Year) - four digits; at least 1920 and at most 2002. iyr (Issue Year) - four digits; at least 2010 and at most 2020. eyr (Expiration Year) - four digits; at least...
Implement the Python class `PassportValidator` described below. Class description: Validates passport based on the required fields. Input fields: byr (Birth Year) - four digits; at least 1920 and at most 2002. iyr (Issue Year) - four digits; at least 2010 and at most 2020. eyr (Expiration Year) - four digits; at least...
7c2a69f2ea5fe8b6b9d73e31ba394798fce60217
<|skeleton|> class PassportValidator: """Validates passport based on the required fields. Input fields: byr (Birth Year) - four digits; at least 1920 and at most 2002. iyr (Issue Year) - four digits; at least 2010 and at most 2020. eyr (Expiration Year) - four digits; at least 2020 and at most 2030. hgt (Height) - ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PassportValidator: """Validates passport based on the required fields. Input fields: byr (Birth Year) - four digits; at least 1920 and at most 2002. iyr (Issue Year) - four digits; at least 2010 and at most 2020. eyr (Expiration Year) - four digits; at least 2020 and at most 2030. hgt (Height) - a number foll...
the_stack_v2_python_sparse
2020/d04.py
hchkrdtn/advent-of-code
train
0
2cee45fee9f5157adcc3d25658527508e0281eb5
[ "next_service_obj = self.env['next.service.days']\nservice_obj = self.env['fleet.vehicle.log.services']\nincre_obj = self.env['next.increment.number']\nservice_active_id = service_obj.browse(self._context['active_id'])\nnext_service_obj.create({'vehicle_id': self.vehicle_id and self.vehicle_id.id or False, 'days': ...
<|body_start_0|> next_service_obj = self.env['next.service.days'] service_obj = self.env['fleet.vehicle.log.services'] incre_obj = self.env['next.increment.number'] service_active_id = service_obj.browse(self._context['active_id']) next_service_obj.create({'vehicle_id': self.vehi...
Added Next Service and Odometer Increment.
UpdateNextServiceConfig
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateNextServiceConfig: """Added Next Service and Odometer Increment.""" def action_done(self): """Method to set Next Service Day and Odometer Increment.""" <|body_0|> def default_get(self, default_fields): """Method is used to set Vehicle Id.""" <|body_...
stack_v2_sparse_classes_36k_train_012568
1,726
no_license
[ { "docstring": "Method to set Next Service Day and Odometer Increment.", "name": "action_done", "signature": "def action_done(self)" }, { "docstring": "Method is used to set Vehicle Id.", "name": "default_get", "signature": "def default_get(self, default_fields)" } ]
2
null
Implement the Python class `UpdateNextServiceConfig` described below. Class description: Added Next Service and Odometer Increment. Method signatures and docstrings: - def action_done(self): Method to set Next Service Day and Odometer Increment. - def default_get(self, default_fields): Method is used to set Vehicle I...
Implement the Python class `UpdateNextServiceConfig` described below. Class description: Added Next Service and Odometer Increment. Method signatures and docstrings: - def action_done(self): Method to set Next Service Day and Odometer Increment. - def default_get(self, default_fields): Method is used to set Vehicle I...
7618a365ac78c0f59390a3a6b5fcdd9f76a5ddec
<|skeleton|> class UpdateNextServiceConfig: """Added Next Service and Odometer Increment.""" def action_done(self): """Method to set Next Service Day and Odometer Increment.""" <|body_0|> def default_get(self, default_fields): """Method is used to set Vehicle Id.""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateNextServiceConfig: """Added Next Service and Odometer Increment.""" def action_done(self): """Method to set Next Service Day and Odometer Increment.""" next_service_obj = self.env['next.service.days'] service_obj = self.env['fleet.vehicle.log.services'] incre_obj = s...
the_stack_v2_python_sparse
fleet_operations/wizard/update_next_service.py
JayVora-SerpentCS/fleet_management
train
29
59f807542b550a07d64ae0ac56cfc8b5e9582621
[ "if value is None or self.MIN_PRIORITY <= value <= self.MAX_PRIORITY:\n return value\nerr_args = (key, self.MIN_PRIORITY, self.MAX_PRIORITY, value)\nraise ValueError('%s must be between %s and %s, got %s instead' % err_args)", "if value is None or value >= 0:\n return value\nraise ValueError('%s cannot be l...
<|body_start_0|> if value is None or self.MIN_PRIORITY <= value <= self.MAX_PRIORITY: return value err_args = (key, self.MIN_PRIORITY, self.MAX_PRIORITY, value) raise ValueError('%s must be between %s and %s, got %s instead' % err_args) <|end_body_0|> <|body_start_1|> if val...
Mixin that adds a `state` column and uses a class level `STATE_ENUM` attribute to assist in validation.
ValidatePriorityMixin
[ "BSD-3-Clause", "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidatePriorityMixin: """Mixin that adds a `state` column and uses a class level `STATE_ENUM` attribute to assist in validation.""" def validate_priority(self, key, value): """ensures the value provided to priority is valid""" <|body_0|> def validate_attempts(self, key,...
stack_v2_sparse_classes_36k_train_012569
16,227
permissive
[ { "docstring": "ensures the value provided to priority is valid", "name": "validate_priority", "signature": "def validate_priority(self, key, value)" }, { "docstring": "ensures the number of attempts provided is valid", "name": "validate_attempts", "signature": "def validate_attempts(sel...
2
stack_v2_sparse_classes_30k_train_009419
Implement the Python class `ValidatePriorityMixin` described below. Class description: Mixin that adds a `state` column and uses a class level `STATE_ENUM` attribute to assist in validation. Method signatures and docstrings: - def validate_priority(self, key, value): ensures the value provided to priority is valid - ...
Implement the Python class `ValidatePriorityMixin` described below. Class description: Mixin that adds a `state` column and uses a class level `STATE_ENUM` attribute to assist in validation. Method signatures and docstrings: - def validate_priority(self, key, value): ensures the value provided to priority is valid - ...
ea04bbcb807eb669415c569417b4b1b68e75d29d
<|skeleton|> class ValidatePriorityMixin: """Mixin that adds a `state` column and uses a class level `STATE_ENUM` attribute to assist in validation.""" def validate_priority(self, key, value): """ensures the value provided to priority is valid""" <|body_0|> def validate_attempts(self, key,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ValidatePriorityMixin: """Mixin that adds a `state` column and uses a class level `STATE_ENUM` attribute to assist in validation.""" def validate_priority(self, key, value): """ensures the value provided to priority is valid""" if value is None or self.MIN_PRIORITY <= value <= self.MAX_PR...
the_stack_v2_python_sparse
pyfarm/models/core/mixins.py
pyfarm/pyfarm-master
train
2
1a695f96d59e0b7e5ece1c7563a7f2e76e5d647e
[ "phone = self.data.get('phone')\nif not re.match('^1[3-9]\\\\d{9}$', phone):\n raise forms.ValidationError(u'无效的手机号码')\nreturn phone", "data = self.data\nphone = data.get('phone')\npassword = data.get('password')\nif password not in cache.get(u'pwds_{}'.format(phone), []):\n raise forms.ValidationError(u'动态...
<|body_start_0|> phone = self.data.get('phone') if not re.match('^1[3-9]\\d{9}$', phone): raise forms.ValidationError(u'无效的手机号码') return phone <|end_body_0|> <|body_start_1|> data = self.data phone = data.get('phone') password = data.get('password') i...
Form for user login with phone
PhoneLoginForm
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PhoneLoginForm: """Form for user login with phone""" def clean_phone(self): """Check phone number""" <|body_0|> def clean(self): """Check phone and password""" <|body_1|> <|end_skeleton|> <|body_start_0|> phone = self.data.get('phone') i...
stack_v2_sparse_classes_36k_train_012570
4,670
permissive
[ { "docstring": "Check phone number", "name": "clean_phone", "signature": "def clean_phone(self)" }, { "docstring": "Check phone and password", "name": "clean", "signature": "def clean(self)" } ]
2
stack_v2_sparse_classes_30k_train_014702
Implement the Python class `PhoneLoginForm` described below. Class description: Form for user login with phone Method signatures and docstrings: - def clean_phone(self): Check phone number - def clean(self): Check phone and password
Implement the Python class `PhoneLoginForm` described below. Class description: Form for user login with phone Method signatures and docstrings: - def clean_phone(self): Check phone number - def clean(self): Check phone and password <|skeleton|> class PhoneLoginForm: """Form for user login with phone""" def...
0ea016745d92054bd4df8d934c1b67fd61b6f845
<|skeleton|> class PhoneLoginForm: """Form for user login with phone""" def clean_phone(self): """Check phone number""" <|body_0|> def clean(self): """Check phone and password""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PhoneLoginForm: """Form for user login with phone""" def clean_phone(self): """Check phone number""" phone = self.data.get('phone') if not re.match('^1[3-9]\\d{9}$', phone): raise forms.ValidationError(u'无效的手机号码') return phone def clean(self): """C...
the_stack_v2_python_sparse
accounts/forms.py
ygrass/handsome
train
0
0385c7f0deeb55f6c38847633693a9160f816003
[ "super(CnnEncoder, self).__init__()\nself.cnn = nn.Sequential()\nfor i in range(args.layer_num):\n if i == 0:\n input_dim = args.embedding_dim\n else:\n input_dim = args.hidden_dim\n self.cnn.add_module('conv_layer{:d}'.format(i), nn.Conv1d(in_channels=input_dim, out_channels=args.hidden_dim,...
<|body_start_0|> super(CnnEncoder, self).__init__() self.cnn = nn.Sequential() for i in range(args.layer_num): if i == 0: input_dim = args.embedding_dim else: input_dim = args.hidden_dim self.cnn.add_module('conv_layer{:d}'.form...
Basic CNN encoder module, input embeddings and output hidden states.
CnnEncoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CnnEncoder: """Basic CNN encoder module, input embeddings and output hidden states.""" def __init__(self, args): """args.hidden_dim -- dimension of filters. args.kernel_size -- kernel size of the conv1d. args.layer_num -- number of CNN layers. args.embedding_dim -- dimension of word ...
stack_v2_sparse_classes_36k_train_012571
6,319
no_license
[ { "docstring": "args.hidden_dim -- dimension of filters. args.kernel_size -- kernel size of the conv1d. args.layer_num -- number of CNN layers. args.embedding_dim -- dimension of word embeddings.", "name": "__init__", "signature": "def __init__(self, args)" }, { "docstring": "Inputs: e -- input ...
2
stack_v2_sparse_classes_30k_train_015994
Implement the Python class `CnnEncoder` described below. Class description: Basic CNN encoder module, input embeddings and output hidden states. Method signatures and docstrings: - def __init__(self, args): args.hidden_dim -- dimension of filters. args.kernel_size -- kernel size of the conv1d. args.layer_num -- numbe...
Implement the Python class `CnnEncoder` described below. Class description: Basic CNN encoder module, input embeddings and output hidden states. Method signatures and docstrings: - def __init__(self, args): args.hidden_dim -- dimension of filters. args.kernel_size -- kernel size of the conv1d. args.layer_num -- numbe...
e79606e24ecc6fd713b481afb527c34eec7d5d66
<|skeleton|> class CnnEncoder: """Basic CNN encoder module, input embeddings and output hidden states.""" def __init__(self, args): """args.hidden_dim -- dimension of filters. args.kernel_size -- kernel size of the conv1d. args.layer_num -- number of CNN layers. args.embedding_dim -- dimension of word ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CnnEncoder: """Basic CNN encoder module, input embeddings and output hidden states.""" def __init__(self, args): """args.hidden_dim -- dimension of filters. args.kernel_size -- kernel size of the conv1d. args.layer_num -- number of CNN layers. args.embedding_dim -- dimension of word embeddings.""...
the_stack_v2_python_sparse
rationalize/models/encoder.py
anshiquanshu66/factcheck-acl2021
train
0
b2c86791cb35f668eb8e29f3fbbb2ac6b348c0a1
[ "def dfs(num):\n if num <= 9:\n return num\n return dfs(dfs(num // 10) + num % 10)\nres = dfs(num)\nreturn res", "if not num:\n return 0\nreturn (num - 1) % 9 + 1" ]
<|body_start_0|> def dfs(num): if num <= 9: return num return dfs(dfs(num // 10) + num % 10) res = dfs(num) return res <|end_body_0|> <|body_start_1|> if not num: return 0 return (num - 1) % 9 + 1 <|end_body_1|>
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addDigits(self, num: int) -> int: """方法一:递归 @param num: @return:""" <|body_0|> def addDigits(self, num: int) -> int: """方法二:数学O(1) @param num: @return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> def dfs(num): if num <=...
stack_v2_sparse_classes_36k_train_012572
1,039
no_license
[ { "docstring": "方法一:递归 @param num: @return:", "name": "addDigits", "signature": "def addDigits(self, num: int) -> int" }, { "docstring": "方法二:数学O(1) @param num: @return:", "name": "addDigits", "signature": "def addDigits(self, num: int) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addDigits(self, num: int) -> int: 方法一:递归 @param num: @return: - def addDigits(self, num: int) -> int: 方法二:数学O(1) @param num: @return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addDigits(self, num: int) -> int: 方法一:递归 @param num: @return: - def addDigits(self, num: int) -> int: 方法二:数学O(1) @param num: @return: <|skeleton|> class Solution: def a...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def addDigits(self, num: int) -> int: """方法一:递归 @param num: @return:""" <|body_0|> def addDigits(self, num: int) -> int: """方法二:数学O(1) @param num: @return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def addDigits(self, num: int) -> int: """方法一:递归 @param num: @return:""" def dfs(num): if num <= 9: return num return dfs(dfs(num // 10) + num % 10) res = dfs(num) return res def addDigits(self, num: int) -> int: """...
the_stack_v2_python_sparse
LeetCode/数学/258. 各位相加.py
yiming1012/MyLeetCode
train
2
c74217be9f7714ab14d92844a4b4d4cedc75bfe4
[ "a = np.exp(x - np.max(x))\nf = a / (1 + a)\nreturn f", "f = logit.f(x)\ndf = f * (1 - f)\nreturn df" ]
<|body_start_0|> a = np.exp(x - np.max(x)) f = a / (1 + a) return f <|end_body_0|> <|body_start_1|> f = logit.f(x) df = f * (1 - f) return df <|end_body_1|>
Class for the logit function.
logit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class logit: """Class for the logit function.""" def f(x): """The logit function.""" <|body_0|> def df(x): """The derivative of the logit function.""" <|body_1|> <|end_skeleton|> <|body_start_0|> a = np.exp(x - np.max(x)) f = a / (1 + a) ...
stack_v2_sparse_classes_36k_train_012573
12,501
no_license
[ { "docstring": "The logit function.", "name": "f", "signature": "def f(x)" }, { "docstring": "The derivative of the logit function.", "name": "df", "signature": "def df(x)" } ]
2
stack_v2_sparse_classes_30k_train_009475
Implement the Python class `logit` described below. Class description: Class for the logit function. Method signatures and docstrings: - def f(x): The logit function. - def df(x): The derivative of the logit function.
Implement the Python class `logit` described below. Class description: Class for the logit function. Method signatures and docstrings: - def f(x): The logit function. - def df(x): The derivative of the logit function. <|skeleton|> class logit: """Class for the logit function.""" def f(x): """The log...
5bbd2dc3fa274f6e48b2d4ef387b3939483cafe8
<|skeleton|> class logit: """Class for the logit function.""" def f(x): """The logit function.""" <|body_0|> def df(x): """The derivative of the logit function.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class logit: """Class for the logit function.""" def f(x): """The logit function.""" a = np.exp(x - np.max(x)) f = a / (1 + a) return f def df(x): """The derivative of the logit function.""" f = logit.f(x) df = f * (1 - f) return df
the_stack_v2_python_sparse
Project2/neural_network.py
fridalarsen/FYS-STK4155
train
0
28d63dbe16b78bd3f1936921f44496b263b0ea2c
[ "if x is None or y is None:\n raise ValueError('Any observation variable cannot be None')\nif category_id is not None:\n category_id = int(category_id)\nreturn Observation(float(x), float(y), category_id)", "if len(values) != 3:\n raise ValueError('Invalid observation structure')\nreturn ObservationFacto...
<|body_start_0|> if x is None or y is None: raise ValueError('Any observation variable cannot be None') if category_id is not None: category_id = int(category_id) return Observation(float(x), float(y), category_id) <|end_body_0|> <|body_start_1|> if len(values) !...
Factory for creation Observation instances
ObservationFactory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObservationFactory: """Factory for creation Observation instances""" def create_observation(x, y, category_id=None): """Creates new instance of Observation based on x, y""" <|body_0|> def create_observation_from_tuple(values): """Creates new instance of Observati...
stack_v2_sparse_classes_36k_train_012574
2,463
no_license
[ { "docstring": "Creates new instance of Observation based on x, y", "name": "create_observation", "signature": "def create_observation(x, y, category_id=None)" }, { "docstring": "Creates new instance of Observation based on a tuple", "name": "create_observation_from_tuple", "signature": ...
2
stack_v2_sparse_classes_30k_train_012906
Implement the Python class `ObservationFactory` described below. Class description: Factory for creation Observation instances Method signatures and docstrings: - def create_observation(x, y, category_id=None): Creates new instance of Observation based on x, y - def create_observation_from_tuple(values): Creates new ...
Implement the Python class `ObservationFactory` described below. Class description: Factory for creation Observation instances Method signatures and docstrings: - def create_observation(x, y, category_id=None): Creates new instance of Observation based on x, y - def create_observation_from_tuple(values): Creates new ...
6354e3640bcbb09544084d017dd0e0f0d2f398c0
<|skeleton|> class ObservationFactory: """Factory for creation Observation instances""" def create_observation(x, y, category_id=None): """Creates new instance of Observation based on x, y""" <|body_0|> def create_observation_from_tuple(values): """Creates new instance of Observati...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ObservationFactory: """Factory for creation Observation instances""" def create_observation(x, y, category_id=None): """Creates new instance of Observation based on x, y""" if x is None or y is None: raise ValueError('Any observation variable cannot be None') if catego...
the_stack_v2_python_sparse
domain/shared/observation.py
jasphall/k_nearest_neighbours
train
0
a22ed3e64460539683906e2d6e3218494c17a836
[ "queryset = self.get_child_qs(graph_id)\nserializer = self.get_serializer(queryset, many=True)\nreturn response.Response(serializer.data)", "graph_id = self.request.resolver_match.kwargs['graph_id']\ngraph = self.get_graph(graph_id)\nserializer.save(graph=graph)" ]
<|body_start_0|> queryset = self.get_child_qs(graph_id) serializer = self.get_serializer(queryset, many=True) return response.Response(serializer.data) <|end_body_0|> <|body_start_1|> graph_id = self.request.resolver_match.kwargs['graph_id'] graph = self.get_graph(graph_id) ...
A ListCreateAPIView mixin for graph children objects. E.g. NodeViews and EdgeViews Child here refers to node or edge object
GraphChildListCreateViewMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GraphChildListCreateViewMixin: """A ListCreateAPIView mixin for graph children objects. E.g. NodeViews and EdgeViews Child here refers to node or edge object""" def list_(self, request, graph_id): """Return all the children of a given graph""" <|body_0|> def perform_crea...
stack_v2_sparse_classes_36k_train_012575
1,932
no_license
[ { "docstring": "Return all the children of a given graph", "name": "list_", "signature": "def list_(self, request, graph_id)" }, { "docstring": "Add the graph to the child object.", "name": "perform_create_", "signature": "def perform_create_(self, serializer)" } ]
2
stack_v2_sparse_classes_30k_val_000744
Implement the Python class `GraphChildListCreateViewMixin` described below. Class description: A ListCreateAPIView mixin for graph children objects. E.g. NodeViews and EdgeViews Child here refers to node or edge object Method signatures and docstrings: - def list_(self, request, graph_id): Return all the children of ...
Implement the Python class `GraphChildListCreateViewMixin` described below. Class description: A ListCreateAPIView mixin for graph children objects. E.g. NodeViews and EdgeViews Child here refers to node or edge object Method signatures and docstrings: - def list_(self, request, graph_id): Return all the children of ...
9e01ff8ab73f6d9d16606ec1c8b7c91cdfa9cd2c
<|skeleton|> class GraphChildListCreateViewMixin: """A ListCreateAPIView mixin for graph children objects. E.g. NodeViews and EdgeViews Child here refers to node or edge object""" def list_(self, request, graph_id): """Return all the children of a given graph""" <|body_0|> def perform_crea...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GraphChildListCreateViewMixin: """A ListCreateAPIView mixin for graph children objects. E.g. NodeViews and EdgeViews Child here refers to node or edge object""" def list_(self, request, graph_id): """Return all the children of a given graph""" queryset = self.get_child_qs(graph_id) ...
the_stack_v2_python_sparse
server/utils/views/mixins.py
Aviemusca/bjj-digraph
train
0
f92db47e58f45f4d4ad588403506197b1d8e26f2
[ "self.data = data\nself.progress = progress\nself.loglevel = loglevel\nself.logname = logname\nself._check_required_attributes()\nself.logger = logging.getLogger(f'{self.logname} {self.data}')\nself.logger.setLevel(self.loglevel)\nself.logformat = '[%(name)s %(levelname)s] %(message)s'\nhandler = logging.StreamHand...
<|body_start_0|> self.data = data self.progress = progress self.loglevel = loglevel self.logname = logname self._check_required_attributes() self.logger = logging.getLogger(f'{self.logname} {self.data}') self.logger.setLevel(self.loglevel) self.logformat =...
Abstract base class for all cclib method classes. Subclasses defined by cclib: CDA - charde decomposition analysis CSPA - C-squared population analysis Density - density matrix calculation FragmentAnalysis - fragment analysis for ADF output LPA - Löwdin population analysis MBO - Mayer's bond orders Moments - multipole ...
Method
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Method: """Abstract base class for all cclib method classes. Subclasses defined by cclib: CDA - charde decomposition analysis CSPA - C-squared population analysis Density - density matrix calculation FragmentAnalysis - fragment analysis for ADF output LPA - Löwdin population analysis MBO - Mayer'...
stack_v2_sparse_classes_36k_train_012576
2,470
permissive
[ { "docstring": "Initialise the Logfile object. This constructor is typically called by the constructor of a subclass.", "name": "__init__", "signature": "def __init__(self, data: 'cclib.parser.data.ccData', progress: Optional[Progress]=None, loglevel: int=logging.INFO, logname: str='Log') -> None" }, ...
2
stack_v2_sparse_classes_30k_train_011561
Implement the Python class `Method` described below. Class description: Abstract base class for all cclib method classes. Subclasses defined by cclib: CDA - charde decomposition analysis CSPA - C-squared population analysis Density - density matrix calculation FragmentAnalysis - fragment analysis for ADF output LPA - ...
Implement the Python class `Method` described below. Class description: Abstract base class for all cclib method classes. Subclasses defined by cclib: CDA - charde decomposition analysis CSPA - C-squared population analysis Density - density matrix calculation FragmentAnalysis - fragment analysis for ADF output LPA - ...
b8d42a163ce9bafd4b660e2a933f56a8cc54fd9b
<|skeleton|> class Method: """Abstract base class for all cclib method classes. Subclasses defined by cclib: CDA - charde decomposition analysis CSPA - C-squared population analysis Density - density matrix calculation FragmentAnalysis - fragment analysis for ADF output LPA - Löwdin population analysis MBO - Mayer'...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Method: """Abstract base class for all cclib method classes. Subclasses defined by cclib: CDA - charde decomposition analysis CSPA - C-squared population analysis Density - density matrix calculation FragmentAnalysis - fragment analysis for ADF output LPA - Löwdin population analysis MBO - Mayer's bond orders...
the_stack_v2_python_sparse
cclib/method/calculationmethod.py
cclib/cclib
train
285
bb0c5155111e0c6ad0be0dcc95af68e9fde7e24b
[ "for s in STATES:\n response = self.client.get(reverse('education:state_detail', args=(s,)))\n self.assertEqual(response.status_code, 200)\n self.assertNotEqual(response.context.get('message'), None)\n self.assertContains(response, 'Error: No data for state {}'.format(s))", "create_null_states()\nfor ...
<|body_start_0|> for s in STATES: response = self.client.get(reverse('education:state_detail', args=(s,))) self.assertEqual(response.status_code, 200) self.assertNotEqual(response.context.get('message'), None) self.assertContains(response, 'Error: No data for stat...
EducationStateDetailsViewTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EducationStateDetailsViewTest: def test_no_data(self): """Make sure each state page renders if there is no database data.""" <|body_0|> def test_with_null_data(self): """Make sure each state page renders if there is data in the database.""" <|body_1|> de...
stack_v2_sparse_classes_36k_train_012577
9,266
no_license
[ { "docstring": "Make sure each state page renders if there is no database data.", "name": "test_no_data", "signature": "def test_no_data(self)" }, { "docstring": "Make sure each state page renders if there is data in the database.", "name": "test_with_null_data", "signature": "def test_w...
3
stack_v2_sparse_classes_30k_test_000202
Implement the Python class `EducationStateDetailsViewTest` described below. Class description: Implement the EducationStateDetailsViewTest class. Method signatures and docstrings: - def test_no_data(self): Make sure each state page renders if there is no database data. - def test_with_null_data(self): Make sure each ...
Implement the Python class `EducationStateDetailsViewTest` described below. Class description: Implement the EducationStateDetailsViewTest class. Method signatures and docstrings: - def test_no_data(self): Make sure each state page renders if there is no database data. - def test_with_null_data(self): Make sure each ...
2a8e2dc4e9b3cb92d4d437b37e61940a9486b81f
<|skeleton|> class EducationStateDetailsViewTest: def test_no_data(self): """Make sure each state page renders if there is no database data.""" <|body_0|> def test_with_null_data(self): """Make sure each state page renders if there is data in the database.""" <|body_1|> de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EducationStateDetailsViewTest: def test_no_data(self): """Make sure each state page renders if there is no database data.""" for s in STATES: response = self.client.get(reverse('education:state_detail', args=(s,))) self.assertEqual(response.status_code, 200) ...
the_stack_v2_python_sparse
education/tests.py
smeds1/mysite
train
1
e8936994808e6f1a18a7dabbcf92d1570ab6efee
[ "super(AdaptiveParameterizedStrategy, self).__init__(network, bound)\nself.size = size\nself.history = history\nself.remainder = remainder\nself.sigma = sigma\nself.strategies = [np.random.uniform(-self.bound, self.bound, size=FeatureMatrix.TOTAL_FEATURES) for _ in range(self.size)]\nself.strategy = self.strategies...
<|body_start_0|> super(AdaptiveParameterizedStrategy, self).__init__(network, bound) self.size = size self.history = history self.remainder = remainder self.sigma = sigma self.strategies = [np.random.uniform(-self.bound, self.bound, size=FeatureMatrix.TOTAL_FEATURES) for ...
A adaptive and parameterized neuron selection strategy. Adaptive and parameterized neuron selection strategy is a strategy that changes the parameterized neuron selection strategy adaptively with respect to the model, data, or even time. These updates are done in online; in other words, the strategies are updated while...
AdaptiveParameterizedStrategy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdaptiveParameterizedStrategy: """A adaptive and parameterized neuron selection strategy. Adaptive and parameterized neuron selection strategy is a strategy that changes the parameterized neuron selection strategy adaptively with respect to the model, data, or even time. These updates are done in...
stack_v2_sparse_classes_36k_train_012578
17,144
permissive
[ { "docstring": "Create a adaptive parameterized strategy, and initialize its variables. Args: network: A wrapped Keras model with `adapt.Network`. bound: A floating point number indicates the absolute value of minimum and maximum bounds. size: A positive integer. The number of strategies to create at once. hist...
4
stack_v2_sparse_classes_30k_train_012949
Implement the Python class `AdaptiveParameterizedStrategy` described below. Class description: A adaptive and parameterized neuron selection strategy. Adaptive and parameterized neuron selection strategy is a strategy that changes the parameterized neuron selection strategy adaptively with respect to the model, data, ...
Implement the Python class `AdaptiveParameterizedStrategy` described below. Class description: A adaptive and parameterized neuron selection strategy. Adaptive and parameterized neuron selection strategy is a strategy that changes the parameterized neuron selection strategy adaptively with respect to the model, data, ...
0b801d2d2e828ac480d1097cb3bdd82b1e25c15b
<|skeleton|> class AdaptiveParameterizedStrategy: """A adaptive and parameterized neuron selection strategy. Adaptive and parameterized neuron selection strategy is a strategy that changes the parameterized neuron selection strategy adaptively with respect to the model, data, or even time. These updates are done in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdaptiveParameterizedStrategy: """A adaptive and parameterized neuron selection strategy. Adaptive and parameterized neuron selection strategy is a strategy that changes the parameterized neuron selection strategy adaptively with respect to the model, data, or even time. These updates are done in online; in o...
the_stack_v2_python_sparse
code/deep/ReMoS/CV_adv/DNNtest/strategy/adapt.py
jindongwang/transferlearning
train
12,773
e4f42b7f890dd3329982db3f90e5d757abff2762
[ "dp = [float('inf')] * (n + 1)\ndp[0] = 0\nfor i in range(1, n + 1):\n for j in range(1, int(sqrt(i)) + 1):\n square = j * j\n if i >= square:\n dp[i] = min(dp[i], dp[i - square] + 1)\nreturn dp[-1]", "memo = dict()\n\ndef dfs(target):\n if target in memo:\n return memo[targe...
<|body_start_0|> dp = [float('inf')] * (n + 1) dp[0] = 0 for i in range(1, n + 1): for j in range(1, int(sqrt(i)) + 1): square = j * j if i >= square: dp[i] = min(dp[i], dp[i - square] + 1) return dp[-1] <|end_body_0|> <|bo...
四平方定理: 任何一个正整数都可以表示成不超过四个整数的平方之和。 推论:满足四数平方和定理的数n(四个整数的情况),必定满足 n = 4 ^ a * (8b + 7)
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """四平方定理: 任何一个正整数都可以表示成不超过四个整数的平方之和。 推论:满足四数平方和定理的数n(四个整数的情况),必定满足 n = 4 ^ a * (8b + 7)""" def numSquares1(self, n: int) -> int: """DP: 类似题目322 coin change. 本题的'coin'就是平方数""" <|body_0|> def numSquares2(self, n: int) -> int: """DFS会超时""" <|body_1...
stack_v2_sparse_classes_36k_train_012579
2,859
no_license
[ { "docstring": "DP: 类似题目322 coin change. 本题的'coin'就是平方数", "name": "numSquares1", "signature": "def numSquares1(self, n: int) -> int" }, { "docstring": "DFS会超时", "name": "numSquares2", "signature": "def numSquares2(self, n: int) -> int" }, { "docstring": "BFS:类似于寻找最短路径 从根节点开始像下逐层延...
3
null
Implement the Python class `Solution` described below. Class description: 四平方定理: 任何一个正整数都可以表示成不超过四个整数的平方之和。 推论:满足四数平方和定理的数n(四个整数的情况),必定满足 n = 4 ^ a * (8b + 7) Method signatures and docstrings: - def numSquares1(self, n: int) -> int: DP: 类似题目322 coin change. 本题的'coin'就是平方数 - def numSquares2(self, n: int) -> int: DFS会超...
Implement the Python class `Solution` described below. Class description: 四平方定理: 任何一个正整数都可以表示成不超过四个整数的平方之和。 推论:满足四数平方和定理的数n(四个整数的情况),必定满足 n = 4 ^ a * (8b + 7) Method signatures and docstrings: - def numSquares1(self, n: int) -> int: DP: 类似题目322 coin change. 本题的'coin'就是平方数 - def numSquares2(self, n: int) -> int: DFS会超...
2bbb1640589aab34f2bc42489283033cc11fb885
<|skeleton|> class Solution: """四平方定理: 任何一个正整数都可以表示成不超过四个整数的平方之和。 推论:满足四数平方和定理的数n(四个整数的情况),必定满足 n = 4 ^ a * (8b + 7)""" def numSquares1(self, n: int) -> int: """DP: 类似题目322 coin change. 本题的'coin'就是平方数""" <|body_0|> def numSquares2(self, n: int) -> int: """DFS会超时""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """四平方定理: 任何一个正整数都可以表示成不超过四个整数的平方之和。 推论:满足四数平方和定理的数n(四个整数的情况),必定满足 n = 4 ^ a * (8b + 7)""" def numSquares1(self, n: int) -> int: """DP: 类似题目322 coin change. 本题的'coin'就是平方数""" dp = [float('inf')] * (n + 1) dp[0] = 0 for i in range(1, n + 1): for j in r...
the_stack_v2_python_sparse
279_perfect-squares.py
helloocc/algorithm
train
1
3b69fce22acd93cf3477ddaee8089e73ddee32a4
[ "svm = SVC(kernel=kernel_type, gamma='auto')\nprint('Fitting SVM to training data....')\nsvm = svm.fit(training_data_vecs, train_labels[col_name])\nreturn svm", "result = model.predict(test_vector)\noutput = pd.DataFrame(data={'id': test_data['id'], test_col_name: result})\noutput.to_csv(output_name, index=False,...
<|body_start_0|> svm = SVC(kernel=kernel_type, gamma='auto') print('Fitting SVM to training data....') svm = svm.fit(training_data_vecs, train_labels[col_name]) return svm <|end_body_0|> <|body_start_1|> result = model.predict(test_vector) output = pd.DataFrame(data={'id...
RunSVM
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunSVM: def train_svm(self, training_data_vecs, train_labels, col_name, kernel_type): """Return SVM model""" <|body_0|> def predict_svm(self, model, test_vector, test_data, test_id_col, test_col_name, output_name): """Return output of SVM prediction and save to csv""...
stack_v2_sparse_classes_36k_train_012580
697
no_license
[ { "docstring": "Return SVM model", "name": "train_svm", "signature": "def train_svm(self, training_data_vecs, train_labels, col_name, kernel_type)" }, { "docstring": "Return output of SVM prediction and save to csv", "name": "predict_svm", "signature": "def predict_svm(self, model, test_...
2
stack_v2_sparse_classes_30k_test_001121
Implement the Python class `RunSVM` described below. Class description: Implement the RunSVM class. Method signatures and docstrings: - def train_svm(self, training_data_vecs, train_labels, col_name, kernel_type): Return SVM model - def predict_svm(self, model, test_vector, test_data, test_id_col, test_col_name, outp...
Implement the Python class `RunSVM` described below. Class description: Implement the RunSVM class. Method signatures and docstrings: - def train_svm(self, training_data_vecs, train_labels, col_name, kernel_type): Return SVM model - def predict_svm(self, model, test_vector, test_data, test_id_col, test_col_name, outp...
141fa19637bd34854fe07b670a6103f69c085700
<|skeleton|> class RunSVM: def train_svm(self, training_data_vecs, train_labels, col_name, kernel_type): """Return SVM model""" <|body_0|> def predict_svm(self, model, test_vector, test_data, test_id_col, test_col_name, output_name): """Return output of SVM prediction and save to csv""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RunSVM: def train_svm(self, training_data_vecs, train_labels, col_name, kernel_type): """Return SVM model""" svm = SVC(kernel=kernel_type, gamma='auto') print('Fitting SVM to training data....') svm = svm.fit(training_data_vecs, train_labels[col_name]) return svm d...
the_stack_v2_python_sparse
RunSVM.py
ianovski/customer-review-sentiment
train
0
c3487c9498a8753a39e8449b8ff603f967bbf513
[ "self.app = app\nself.script_name = script_name\nself.scheme = scheme\nself.server = server", "script_name = environ.get('HTTP_X_SCRIPT_NAME', '') or self.script_name\nif script_name:\n environ['SCRIPT_NAME'] = script_name\n path_info = environ['PATH_INFO']\n if path_info.startswith(script_name):\n ...
<|body_start_0|> self.app = app self.script_name = script_name self.scheme = scheme self.server = server <|end_body_0|> <|body_start_1|> script_name = environ.get('HTTP_X_SCRIPT_NAME', '') or self.script_name if script_name: environ['SCRIPT_NAME'] = script_na...
Allow to use a reverse proxy. http://blog.macuyiko.com/post/2016/fixing-flask-url_for-when-behind-mod_proxy.html
ReverseProxied
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReverseProxied: """Allow to use a reverse proxy. http://blog.macuyiko.com/post/2016/fixing-flask-url_for-when-behind-mod_proxy.html""" def __init__(self, app, script_name=None, scheme=None, server=None): """Create a new wrapper for Flask.""" <|body_0|> def __call__(self,...
stack_v2_sparse_classes_36k_train_012581
1,794
permissive
[ { "docstring": "Create a new wrapper for Flask.", "name": "__init__", "signature": "def __init__(self, app, script_name=None, scheme=None, server=None)" }, { "docstring": "Set environment for Flask.", "name": "__call__", "signature": "def __call__(self, environ, start_response)" } ]
2
stack_v2_sparse_classes_30k_train_009651
Implement the Python class `ReverseProxied` described below. Class description: Allow to use a reverse proxy. http://blog.macuyiko.com/post/2016/fixing-flask-url_for-when-behind-mod_proxy.html Method signatures and docstrings: - def __init__(self, app, script_name=None, scheme=None, server=None): Create a new wrapper...
Implement the Python class `ReverseProxied` described below. Class description: Allow to use a reverse proxy. http://blog.macuyiko.com/post/2016/fixing-flask-url_for-when-behind-mod_proxy.html Method signatures and docstrings: - def __init__(self, app, script_name=None, scheme=None, server=None): Create a new wrapper...
47e1c99e3be3c1b099d3772bc077f5666020eb0b
<|skeleton|> class ReverseProxied: """Allow to use a reverse proxy. http://blog.macuyiko.com/post/2016/fixing-flask-url_for-when-behind-mod_proxy.html""" def __init__(self, app, script_name=None, scheme=None, server=None): """Create a new wrapper for Flask.""" <|body_0|> def __call__(self,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReverseProxied: """Allow to use a reverse proxy. http://blog.macuyiko.com/post/2016/fixing-flask-url_for-when-behind-mod_proxy.html""" def __init__(self, app, script_name=None, scheme=None, server=None): """Create a new wrapper for Flask.""" self.app = app self.script_name = scrip...
the_stack_v2_python_sparse
sacredboard/app/webapi/proxy.py
nagyist/sacredboard
train
0
af214953f110d8307d05885141edf65d0251fab0
[ "schools_profiles_urls_xpath1 = '//*[@id=\"FindSchoolContainer\"]/div[5]/div[3]/div[2]/div/div/a/@href'\nschools_profiles_urls_xpath2 = '//*[@id=\"FindSchoolContainer\"]/div[5]/div[6]/div[2]/div/div/a/@href'\ndriver = webdriver.Chrome()\ndriver.get(response.url)\ntime.sleep(5)\ndom = lxml.html.fromstring(driver.pag...
<|body_start_0|> schools_profiles_urls_xpath1 = '//*[@id="FindSchoolContainer"]/div[5]/div[3]/div[2]/div/div/a/@href' schools_profiles_urls_xpath2 = '//*[@id="FindSchoolContainer"]/div[5]/div[6]/div[2]/div/div/a/@href' driver = webdriver.Chrome() driver.get(response.url) time.sle...
a scrapy spider to crawl csviamonde.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found
CsviamondeSpiderSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CsviamondeSpiderSpider: """a scrapy spider to crawl csviamonde.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found""" def parse(self, response): """extr...
stack_v2_sparse_classes_36k_train_012582
4,277
no_license
[ { "docstring": "extract schools_profiles_urls from the two sections Elementary Schools and Secondary Schools", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "parse school profile page to get all the item data", "name": "parse_school_profile", "signature": "d...
2
stack_v2_sparse_classes_30k_train_009887
Implement the Python class `CsviamondeSpiderSpider` described below. Class description: a scrapy spider to crawl csviamonde.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found Method sig...
Implement the Python class `CsviamondeSpiderSpider` described below. Class description: a scrapy spider to crawl csviamonde.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found Method sig...
350264cf6da323692c2838d8cb235ef61085851b
<|skeleton|> class CsviamondeSpiderSpider: """a scrapy spider to crawl csviamonde.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found""" def parse(self, response): """extr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CsviamondeSpiderSpider: """a scrapy spider to crawl csviamonde.ca domain to get school_name street_address city province postal_code phone_number school_url school_grades school_language school_type school_board response_url for each school found""" def parse(self, response): """extract schools_p...
the_stack_v2_python_sparse
school_scraping/spiders/csviamonde_spider.py
ramadanmostafa/canada_school_scraping
train
0
aacbae6dca7e6b62df3e57d03bba8c84b375ccd0
[ "if 'line_item' in self.request.GET:\n try:\n part_id = self.request.GET.get('line_item')\n part = SalesOrderLineItem.objects.get(id=part_id).part\n except Part.DoesNotExist:\n return None\nelif 'pk' in self.request.POST:\n try:\n part_id = self.request.POST.get('pk')\n p...
<|body_start_0|> if 'line_item' in self.request.GET: try: part_id = self.request.GET.get('line_item') part = SalesOrderLineItem.objects.get(id=part_id).part except Part.DoesNotExist: return None elif 'pk' in self.request.POST: ...
View for inspecting part pricing information.
LineItemPricing
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LineItemPricing: """View for inspecting part pricing information.""" def get_part(self, id=False): """Return the Part instance associated with this view""" <|body_0|> def get_so(self, pk=False): """Return the SalesOrderLineItem associated with this view""" ...
stack_v2_sparse_classes_36k_train_012583
14,977
permissive
[ { "docstring": "Return the Part instance associated with this view", "name": "get_part", "signature": "def get_part(self, id=False)" }, { "docstring": "Return the SalesOrderLineItem associated with this view", "name": "get_so", "signature": "def get_so(self, pk=False)" }, { "docs...
5
null
Implement the Python class `LineItemPricing` described below. Class description: View for inspecting part pricing information. Method signatures and docstrings: - def get_part(self, id=False): Return the Part instance associated with this view - def get_so(self, pk=False): Return the SalesOrderLineItem associated wit...
Implement the Python class `LineItemPricing` described below. Class description: View for inspecting part pricing information. Method signatures and docstrings: - def get_part(self, id=False): Return the Part instance associated with this view - def get_so(self, pk=False): Return the SalesOrderLineItem associated wit...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class LineItemPricing: """View for inspecting part pricing information.""" def get_part(self, id=False): """Return the Part instance associated with this view""" <|body_0|> def get_so(self, pk=False): """Return the SalesOrderLineItem associated with this view""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LineItemPricing: """View for inspecting part pricing information.""" def get_part(self, id=False): """Return the Part instance associated with this view""" if 'line_item' in self.request.GET: try: part_id = self.request.GET.get('line_item') part...
the_stack_v2_python_sparse
InvenTree/order/views.py
inventree/InvenTree
train
3,077
960dfa1fe7919376001a2906ffefde75b7bbc77f
[ "super(SurnameGenerationModel, self).__init__()\nself.char_emb = nn.Embedding(num_embeddings=char_vocab_size, embedding_dim=char_embedding_size, padding_idx=padding_idx)\nself.rnn = nn.GRU(input_size=char_embedding_size, hidden_size=rnn_hidden_size, batch_first=batch_first)\nself.fc = nn.Linear(in_features=rnn_hidd...
<|body_start_0|> super(SurnameGenerationModel, self).__init__() self.char_emb = nn.Embedding(num_embeddings=char_vocab_size, embedding_dim=char_embedding_size, padding_idx=padding_idx) self.rnn = nn.GRU(input_size=char_embedding_size, hidden_size=rnn_hidden_size, batch_first=batch_first) ...
SurnameGenerationModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SurnameGenerationModel: def __init__(self, char_embedding_size, char_vocab_size, rnn_hidden_size, batch_first=True, padding_idx=0, dropout_p=0.5): """Args: char_embedding_size (int): The size of the character embeddings char_vocab_size (int): The number of characters to embed rnn_hidden_...
stack_v2_sparse_classes_36k_train_012584
28,880
no_license
[ { "docstring": "Args: char_embedding_size (int): The size of the character embeddings char_vocab_size (int): The number of characters to embed rnn_hidden_size (int): The size of the RNN's hidden state batch_first (bool): Informs whether the input tensors will have batch or the sequence on the 0th dimension padd...
2
stack_v2_sparse_classes_30k_train_019378
Implement the Python class `SurnameGenerationModel` described below. Class description: Implement the SurnameGenerationModel class. Method signatures and docstrings: - def __init__(self, char_embedding_size, char_vocab_size, rnn_hidden_size, batch_first=True, padding_idx=0, dropout_p=0.5): Args: char_embedding_size (...
Implement the Python class `SurnameGenerationModel` described below. Class description: Implement the SurnameGenerationModel class. Method signatures and docstrings: - def __init__(self, char_embedding_size, char_vocab_size, rnn_hidden_size, batch_first=True, padding_idx=0, dropout_p=0.5): Args: char_embedding_size (...
ba8feae92c875c1e65ad5a25a2363393ab0daf79
<|skeleton|> class SurnameGenerationModel: def __init__(self, char_embedding_size, char_vocab_size, rnn_hidden_size, batch_first=True, padding_idx=0, dropout_p=0.5): """Args: char_embedding_size (int): The size of the character embeddings char_vocab_size (int): The number of characters to embed rnn_hidden_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SurnameGenerationModel: def __init__(self, char_embedding_size, char_vocab_size, rnn_hidden_size, batch_first=True, padding_idx=0, dropout_p=0.5): """Args: char_embedding_size (int): The size of the character embeddings char_vocab_size (int): The number of characters to embed rnn_hidden_size (int): Th...
the_stack_v2_python_sparse
chapter_7/unconditioned_surname_gen.py
kerenskybr/nlp_pytorch_book
train
0
c49741e88d6666702907653723254268e92b73bd
[ "s_index = f_index = 0\nmin_length = float('inf')\nwhile f_index < len(nums):\n sub_sum = sum(nums[s_index:f_index + 1])\n if sub_sum < s:\n f_index += 1\n elif sub_sum > s:\n if min_length > f_index - s_index + 1:\n min_length = f_index - s_index + 1\n s_index += 1\n els...
<|body_start_0|> s_index = f_index = 0 min_length = float('inf') while f_index < len(nums): sub_sum = sum(nums[s_index:f_index + 1]) if sub_sum < s: f_index += 1 elif sub_sum > s: if min_length > f_index - s_index + 1: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minSubArrayLen(self, s, nums): """:type s: int :type nums: List[int] :rtype: int""" <|body_0|> def minSubArrayLen_II(self, s, nums): """:type s: int :type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> s_in...
stack_v2_sparse_classes_36k_train_012585
1,418
no_license
[ { "docstring": ":type s: int :type nums: List[int] :rtype: int", "name": "minSubArrayLen", "signature": "def minSubArrayLen(self, s, nums)" }, { "docstring": ":type s: int :type nums: List[int] :rtype: int", "name": "minSubArrayLen_II", "signature": "def minSubArrayLen_II(self, s, nums)"...
2
stack_v2_sparse_classes_30k_train_001987
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minSubArrayLen(self, s, nums): :type s: int :type nums: List[int] :rtype: int - def minSubArrayLen_II(self, s, nums): :type s: int :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minSubArrayLen(self, s, nums): :type s: int :type nums: List[int] :rtype: int - def minSubArrayLen_II(self, s, nums): :type s: int :type nums: List[int] :rtype: int <|skelet...
1461b10b8910fa90a311939c6df9082a8526f9b1
<|skeleton|> class Solution: def minSubArrayLen(self, s, nums): """:type s: int :type nums: List[int] :rtype: int""" <|body_0|> def minSubArrayLen_II(self, s, nums): """:type s: int :type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minSubArrayLen(self, s, nums): """:type s: int :type nums: List[int] :rtype: int""" s_index = f_index = 0 min_length = float('inf') while f_index < len(nums): sub_sum = sum(nums[s_index:f_index + 1]) if sub_sum < s: f_index ...
the_stack_v2_python_sparse
Medium/209_minimumSizeSubArraySum.py
Yucheng7713/CodingPracticeByYuch
train
0
7bf94723357d75790a5614d990d0a1c7e3b1b865
[ "kwargs['default'] = default\nkwargs['types'] = (tuple, list)\nsuper().__init__(**kwargs)", "if isinstance(value, (list, tuple)) and all((isinstance(x, (int, float)) for x in value)):\n return value\nvalue = super().parse(value)\nif value is None or value is UNDEF:\n return value\nif callable(value):\n r...
<|body_start_0|> kwargs['default'] = default kwargs['types'] = (tuple, list) super().__init__(**kwargs) <|end_body_0|> <|body_start_1|> if isinstance(value, (list, tuple)) and all((isinstance(x, (int, float)) for x in value)): return value value = super().parse(value...
Defines a line dash property. The value must be provided as a list or tuple of numbers defining the length of lines and spaces in-between.
DashProperty
[ "LicenseRef-scancode-philippe-de-muyter", "LicenseRef-scancode-commercial-license", "AGPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DashProperty: """Defines a line dash property. The value must be provided as a list or tuple of numbers defining the length of lines and spaces in-between.""" def __init__(self, default=UNDEF, **kwargs): """Initializes a new instance of DashProperty.""" <|body_0|> def pa...
stack_v2_sparse_classes_36k_train_012586
4,576
permissive
[ { "docstring": "Initializes a new instance of DashProperty.", "name": "__init__", "signature": "def __init__(self, default=UNDEF, **kwargs)" }, { "docstring": "Validates and converts given value.", "name": "parse", "signature": "def parse(self, value)" } ]
2
null
Implement the Python class `DashProperty` described below. Class description: Defines a line dash property. The value must be provided as a list or tuple of numbers defining the length of lines and spaces in-between. Method signatures and docstrings: - def __init__(self, default=UNDEF, **kwargs): Initializes a new in...
Implement the Python class `DashProperty` described below. Class description: Defines a line dash property. The value must be provided as a list or tuple of numbers defining the length of lines and spaces in-between. Method signatures and docstrings: - def __init__(self, default=UNDEF, **kwargs): Initializes a new in...
d59b1bc056f3037b7b7ab635b6deb41120612965
<|skeleton|> class DashProperty: """Defines a line dash property. The value must be provided as a list or tuple of numbers defining the length of lines and spaces in-between.""" def __init__(self, default=UNDEF, **kwargs): """Initializes a new instance of DashProperty.""" <|body_0|> def pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DashProperty: """Defines a line dash property. The value must be provided as a list or tuple of numbers defining the length of lines and spaces in-between.""" def __init__(self, default=UNDEF, **kwargs): """Initializes a new instance of DashProperty.""" kwargs['default'] = default ...
the_stack_v2_python_sparse
pero/properties/special.py
xxao/pero
train
31
f7b5d7eaa64b76249b580d82a7e821f923b2a2a2
[ "lesson = Lessons.query.filter_by(id=self.lesson.data).first()\nacademy = Academy.query.filter_by(name=self.academy.data).first()\nstudent = Student.query.filter_by(academy_id=academy.id).filter_by(name=self.name.data).first()\nif student is not None:\n raise ValidationError('Student name is already in the syste...
<|body_start_0|> lesson = Lessons.query.filter_by(id=self.lesson.data).first() academy = Academy.query.filter_by(name=self.academy.data).first() student = Student.query.filter_by(academy_id=academy.id).filter_by(name=self.name.data).first() if student is not None: raise Valid...
Form for getting initial student data
CreateStudentForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateStudentForm: """Form for getting initial student data""" def validate_name(self, name): """Validate name has yet to be used within the academy""" <|body_0|> def validate_phone2(self, phone): """Validate phone is unique""" <|body_1|> def validat...
stack_v2_sparse_classes_36k_train_012587
19,666
no_license
[ { "docstring": "Validate name has yet to be used within the academy", "name": "validate_name", "signature": "def validate_name(self, name)" }, { "docstring": "Validate phone is unique", "name": "validate_phone2", "signature": "def validate_phone2(self, phone)" }, { "docstring": "...
4
stack_v2_sparse_classes_30k_train_005002
Implement the Python class `CreateStudentForm` described below. Class description: Form for getting initial student data Method signatures and docstrings: - def validate_name(self, name): Validate name has yet to be used within the academy - def validate_phone2(self, phone): Validate phone is unique - def validate_ph...
Implement the Python class `CreateStudentForm` described below. Class description: Form for getting initial student data Method signatures and docstrings: - def validate_name(self, name): Validate name has yet to be used within the academy - def validate_phone2(self, phone): Validate phone is unique - def validate_ph...
e2404fef23258448764aaf9fabb36b6575ddf163
<|skeleton|> class CreateStudentForm: """Form for getting initial student data""" def validate_name(self, name): """Validate name has yet to be used within the academy""" <|body_0|> def validate_phone2(self, phone): """Validate phone is unique""" <|body_1|> def validat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CreateStudentForm: """Form for getting initial student data""" def validate_name(self, name): """Validate name has yet to be used within the academy""" lesson = Lessons.query.filter_by(id=self.lesson.data).first() academy = Academy.query.filter_by(name=self.academy.data).first() ...
the_stack_v2_python_sparse
app/students/forms.py
Kwsswart/Academy
train
0
e3500b582d897d9d4b9fa0e8bdf95199c1775ca3
[ "dp = [0] + [sys.maxsize] * amount\nfor i in range(amount):\n for cent in coins:\n if cent + i > amount:\n continue\n else:\n dp[i + cent] = min(dp[i] + 1, dp[i + cent])\nprint(dp)\nreturn dp[-1] if dp[-1] != sys.maxsize else -1", "minCoins, coinsUsed = self.dpMakeChange(coi...
<|body_start_0|> dp = [0] + [sys.maxsize] * amount for i in range(amount): for cent in coins: if cent + i > amount: continue else: dp[i + cent] = min(dp[i] + 1, dp[i + cent]) print(dp) return dp[-1] if dp...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def coinChange(self, coins, amount): """Worked :type coins: List[int] :type amount: int :rtype: int""" <|body_0|> def coinChange2(self, coins, amount): """This solution and it's helper function were not accepted by leetcode judge. :type coins: List[int] :ty...
stack_v2_sparse_classes_36k_train_012588
2,354
no_license
[ { "docstring": "Worked :type coins: List[int] :type amount: int :rtype: int", "name": "coinChange", "signature": "def coinChange(self, coins, amount)" }, { "docstring": "This solution and it's helper function were not accepted by leetcode judge. :type coins: List[int] :type amount: int :rtype: i...
3
stack_v2_sparse_classes_30k_train_017190
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def coinChange(self, coins, amount): Worked :type coins: List[int] :type amount: int :rtype: int - def coinChange2(self, coins, amount): This solution and it's helper function we...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def coinChange(self, coins, amount): Worked :type coins: List[int] :type amount: int :rtype: int - def coinChange2(self, coins, amount): This solution and it's helper function we...
e319481834d0d0519d50bbf00e4f46374bbcf091
<|skeleton|> class Solution: def coinChange(self, coins, amount): """Worked :type coins: List[int] :type amount: int :rtype: int""" <|body_0|> def coinChange2(self, coins, amount): """This solution and it's helper function were not accepted by leetcode judge. :type coins: List[int] :ty...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def coinChange(self, coins, amount): """Worked :type coins: List[int] :type amount: int :rtype: int""" dp = [0] + [sys.maxsize] * amount for i in range(amount): for cent in coins: if cent + i > amount: continue e...
the_stack_v2_python_sparse
coin_change_322.py
raghavgr/Leetcode
train
1
09555195b025a37cd8a10ab0fe9d0e4427648e79
[ "self.is_email_otp_setup_done = is_email_otp_setup_done\nself.is_totp_setup_done = is_totp_setup_done\nself.is_user_exempt_from_mfa = is_user_exempt_from_mfa", "if dictionary is None:\n return None\nis_email_otp_setup_done = dictionary.get('isEmailOtpSetupDone')\nis_totp_setup_done = dictionary.get('isTotpSetu...
<|body_start_0|> self.is_email_otp_setup_done = is_email_otp_setup_done self.is_totp_setup_done = is_totp_setup_done self.is_user_exempt_from_mfa = is_user_exempt_from_mfa <|end_body_0|> <|body_start_1|> if dictionary is None: return None is_email_otp_setup_done = di...
Implementation of the 'MfaInfo' model. Specifies information about MFA. Attributes: is_email_otp_setup_done (bool): Specifies if email OTP setup is done on the user. is_totp_setup_done (bool): Specifies if TOTP setup is done on the user. is_user_exempt_from_mfa (bool): Specifies if MFA is disabled on the user.
MfaInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MfaInfo: """Implementation of the 'MfaInfo' model. Specifies information about MFA. Attributes: is_email_otp_setup_done (bool): Specifies if email OTP setup is done on the user. is_totp_setup_done (bool): Specifies if TOTP setup is done on the user. is_user_exempt_from_mfa (bool): Specifies if MF...
stack_v2_sparse_classes_36k_train_012589
2,122
permissive
[ { "docstring": "Constructor for the MfaInfo class", "name": "__init__", "signature": "def __init__(self, is_email_otp_setup_done=None, is_totp_setup_done=None, is_user_exempt_from_mfa=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A d...
2
null
Implement the Python class `MfaInfo` described below. Class description: Implementation of the 'MfaInfo' model. Specifies information about MFA. Attributes: is_email_otp_setup_done (bool): Specifies if email OTP setup is done on the user. is_totp_setup_done (bool): Specifies if TOTP setup is done on the user. is_user_...
Implement the Python class `MfaInfo` described below. Class description: Implementation of the 'MfaInfo' model. Specifies information about MFA. Attributes: is_email_otp_setup_done (bool): Specifies if email OTP setup is done on the user. is_totp_setup_done (bool): Specifies if TOTP setup is done on the user. is_user_...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class MfaInfo: """Implementation of the 'MfaInfo' model. Specifies information about MFA. Attributes: is_email_otp_setup_done (bool): Specifies if email OTP setup is done on the user. is_totp_setup_done (bool): Specifies if TOTP setup is done on the user. is_user_exempt_from_mfa (bool): Specifies if MF...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MfaInfo: """Implementation of the 'MfaInfo' model. Specifies information about MFA. Attributes: is_email_otp_setup_done (bool): Specifies if email OTP setup is done on the user. is_totp_setup_done (bool): Specifies if TOTP setup is done on the user. is_user_exempt_from_mfa (bool): Specifies if MFA is disabled...
the_stack_v2_python_sparse
cohesity_management_sdk/models/mfa_info.py
cohesity/management-sdk-python
train
24
27628ab0aba9c31805f0d7fae5bba47058b3a066
[ "memo = dict()\n\ndef dfs(node):\n if not node:\n return 0\n if node in memo.keys():\n return memo[node]\n money = node.val\n if node.left:\n money += dfs(node.left.left) + dfs(node.left.right)\n if node.right:\n money += dfs(node.right.left) + dfs(node.right.right)\n r...
<|body_start_0|> memo = dict() def dfs(node): if not node: return 0 if node in memo.keys(): return memo[node] money = node.val if node.left: money += dfs(node.left.left) + dfs(node.left.right) if...
分析:爷爷偷的钱 + 4个孙子偷的钱 VS 两个儿子偷的钱,哪个组合钱多,就当做当前节点能偷的最大钱数。
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """分析:爷爷偷的钱 + 4个孙子偷的钱 VS 两个儿子偷的钱,哪个组合钱多,就当做当前节点能偷的最大钱数。""" def rob1(self, root: TreeNode) -> int: """DFS记忆优化,无需重复计算""" <|body_0|> def rob2(self, root: TreeNode) -> int: """DP树形版本 1. 定义状态: dp[node][j] 表示node结点能够获得的最大值。 a) j = 0 表示 node 结点不偷取 b) j = 1 表示 ...
stack_v2_sparse_classes_36k_train_012590
2,676
no_license
[ { "docstring": "DFS记忆优化,无需重复计算", "name": "rob1", "signature": "def rob1(self, root: TreeNode) -> int" }, { "docstring": "DP树形版本 1. 定义状态: dp[node][j] 表示node结点能够获得的最大值。 a) j = 0 表示 node 结点不偷取 b) j = 1 表示 node 结点偷取 2. 状态转移方程: 根据当前结点偷或者不偷,就决定了需要从哪些子结点里的对应的状态转移过来。 a) 如果当前结点偷,左右子结点均不能偷。 b) 如果当前结点不偷,左右...
2
stack_v2_sparse_classes_30k_train_011616
Implement the Python class `Solution` described below. Class description: 分析:爷爷偷的钱 + 4个孙子偷的钱 VS 两个儿子偷的钱,哪个组合钱多,就当做当前节点能偷的最大钱数。 Method signatures and docstrings: - def rob1(self, root: TreeNode) -> int: DFS记忆优化,无需重复计算 - def rob2(self, root: TreeNode) -> int: DP树形版本 1. 定义状态: dp[node][j] 表示node结点能够获得的最大值。 a) j = 0 表示 no...
Implement the Python class `Solution` described below. Class description: 分析:爷爷偷的钱 + 4个孙子偷的钱 VS 两个儿子偷的钱,哪个组合钱多,就当做当前节点能偷的最大钱数。 Method signatures and docstrings: - def rob1(self, root: TreeNode) -> int: DFS记忆优化,无需重复计算 - def rob2(self, root: TreeNode) -> int: DP树形版本 1. 定义状态: dp[node][j] 表示node结点能够获得的最大值。 a) j = 0 表示 no...
2bbb1640589aab34f2bc42489283033cc11fb885
<|skeleton|> class Solution: """分析:爷爷偷的钱 + 4个孙子偷的钱 VS 两个儿子偷的钱,哪个组合钱多,就当做当前节点能偷的最大钱数。""" def rob1(self, root: TreeNode) -> int: """DFS记忆优化,无需重复计算""" <|body_0|> def rob2(self, root: TreeNode) -> int: """DP树形版本 1. 定义状态: dp[node][j] 表示node结点能够获得的最大值。 a) j = 0 表示 node 结点不偷取 b) j = 1 表示 ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """分析:爷爷偷的钱 + 4个孙子偷的钱 VS 两个儿子偷的钱,哪个组合钱多,就当做当前节点能偷的最大钱数。""" def rob1(self, root: TreeNode) -> int: """DFS记忆优化,无需重复计算""" memo = dict() def dfs(node): if not node: return 0 if node in memo.keys(): return memo[node] ...
the_stack_v2_python_sparse
337_house-robber-iii.py
helloocc/algorithm
train
1
22c8885b8c2db9ce65e0d8454cb7fd7a7ab4ad18
[ "self.dgate_shape = dgate.get('shape')\nself.dgate_dtype = dgate.get('dtype')\nself.w_shape = input_weight.get('shape')\nself.w_dtype = input_weight.get('dtype')\nif dropout_mask:\n self.dropout_mask_shape = dropout_mask.get('shape')\n self.dropout_mask_dtype = dropout_mask.get('dtype')\nelse:\n self.dropo...
<|body_start_0|> self.dgate_shape = dgate.get('shape') self.dgate_dtype = dgate.get('dtype') self.w_shape = input_weight.get('shape') self.w_dtype = input_weight.get('dtype') if dropout_mask: self.dropout_mask_shape = dropout_mask.get('shape') self.dropout...
Class: use to store LstmCellGradInput input parameters Modify : 2019-12-28
LstmCellGradInput
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LstmCellGradInput: """Class: use to store LstmCellGradInput input parameters Modify : 2019-12-28""" def __init__(self, dgate, input_weight, dropout_mask, dxt, dht, keep_prob, kernel_name): """init LstmCellGradInput base parameters Parameters ---------- dgate: dict the gradient of fou...
stack_v2_sparse_classes_36k_train_012591
19,409
no_license
[ { "docstring": "init LstmCellGradInput base parameters Parameters ---------- dgate: dict the gradient of four gate input_weight: dict weight dropout_mask: dict the mask of dropout keep_prob: dict the keep prob kernel_name: str op kernel name Returns ------- None", "name": "__init__", "signature": "def _...
3
null
Implement the Python class `LstmCellGradInput` described below. Class description: Class: use to store LstmCellGradInput input parameters Modify : 2019-12-28 Method signatures and docstrings: - def __init__(self, dgate, input_weight, dropout_mask, dxt, dht, keep_prob, kernel_name): init LstmCellGradInput base paramet...
Implement the Python class `LstmCellGradInput` described below. Class description: Class: use to store LstmCellGradInput input parameters Modify : 2019-12-28 Method signatures and docstrings: - def __init__(self, dgate, input_weight, dropout_mask, dxt, dht, keep_prob, kernel_name): init LstmCellGradInput base paramet...
148511a31bfd195df889291946c43bb585acb546
<|skeleton|> class LstmCellGradInput: """Class: use to store LstmCellGradInput input parameters Modify : 2019-12-28""" def __init__(self, dgate, input_weight, dropout_mask, dxt, dht, keep_prob, kernel_name): """init LstmCellGradInput base parameters Parameters ---------- dgate: dict the gradient of fou...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LstmCellGradInput: """Class: use to store LstmCellGradInput input parameters Modify : 2019-12-28""" def __init__(self, dgate, input_weight, dropout_mask, dxt, dht, keep_prob, kernel_name): """init LstmCellGradInput base parameters Parameters ---------- dgate: dict the gradient of four gate input_...
the_stack_v2_python_sparse
convertor/huawei/impl/basic_lstm_cell_input_grad.py
jizhuoran/caffe-huawei-atlas-convertor
train
4
ec282bdb0904c758eb2cd13ceabfd6efa0a64df2
[ "dp = BIT3(1010)\nteam = sorted(zip(scores, ages))\nfor score, age in team:\n preMax = dp.query(age)\n dp.update(age, preMax + score)\nreturn dp.query(1010)", "n = len(scores)\nteam = sorted(zip(ages, scores))\ndp = [score for _, score in team]\nfor i in range(1, n):\n for j in range(i):\n if team...
<|body_start_0|> dp = BIT3(1010) team = sorted(zip(scores, ages)) for score, age in team: preMax = dp.query(age) dp.update(age, preMax + score) return dp.query(1010) <|end_body_0|> <|body_start_1|> n = len(scores) team = sorted(zip(ages, scores)) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def bestTeamScore1(self, scores: List[int], ages: List[int]) -> int: """O(nlogn) 树状数组记录""" <|body_0|> def bestTeamScore2(self, scores: List[int], ages: List[int]) -> int: """O(n^2)""" <|body_1|> <|end_skeleton|> <|body_start_0|> dp = BIT3(...
stack_v2_sparse_classes_36k_train_012592
2,692
no_license
[ { "docstring": "O(nlogn) 树状数组记录", "name": "bestTeamScore1", "signature": "def bestTeamScore1(self, scores: List[int], ages: List[int]) -> int" }, { "docstring": "O(n^2)", "name": "bestTeamScore2", "signature": "def bestTeamScore2(self, scores: List[int], ages: List[int]) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def bestTeamScore1(self, scores: List[int], ages: List[int]) -> int: O(nlogn) 树状数组记录 - def bestTeamScore2(self, scores: List[int], ages: List[int]) -> int: O(n^2)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def bestTeamScore1(self, scores: List[int], ages: List[int]) -> int: O(nlogn) 树状数组记录 - def bestTeamScore2(self, scores: List[int], ages: List[int]) -> int: O(n^2) <|skeleton|> c...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def bestTeamScore1(self, scores: List[int], ages: List[int]) -> int: """O(nlogn) 树状数组记录""" <|body_0|> def bestTeamScore2(self, scores: List[int], ages: List[int]) -> int: """O(n^2)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def bestTeamScore1(self, scores: List[int], ages: List[int]) -> int: """O(nlogn) 树状数组记录""" dp = BIT3(1010) team = sorted(zip(scores, ages)) for score, age in team: preMax = dp.query(age) dp.update(age, preMax + score) return dp.query(10...
the_stack_v2_python_sparse
11_动态规划/lis最长上升子序列问题/dp变形/1626. 无矛盾的最佳球队-分数和最大的LIS.py
981377660LMT/algorithm-study
train
225
4afa32d14c64d257bf334a82061d307cda2fde20
[ "self.access_key_id = access_key_id\nself.access_key_secret = access_key_secret\nself.region_id = region_id\nself.client = AcsClient(self.access_key_id, self.access_key_secret, self.region_id)", "request = action_model()\nresponse = self.client.do_action_with_exception(request)\nresult = json.loads(response.decod...
<|body_start_0|> self.access_key_id = access_key_id self.access_key_secret = access_key_secret self.region_id = region_id self.client = AcsClient(self.access_key_id, self.access_key_secret, self.region_id) <|end_body_0|> <|body_start_1|> request = action_model() response...
通过阿里云SDK获取API返回数据
AliyunAPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AliyunAPI: """通过阿里云SDK获取API返回数据""" def __init__(self, access_key_id=settings.AccessKeyId, access_key_secret=settings.AccessKeySecret, region_id='cn-shenzhen'): """实例化 传入AccessKeyId ,AccessKeySecret,RegionId :param access_key_id: :param access_key_secret: :param region_id:""" ...
stack_v2_sparse_classes_36k_train_012593
3,689
no_license
[ { "docstring": "实例化 传入AccessKeyId ,AccessKeySecret,RegionId :param access_key_id: :param access_key_secret: :param region_id:", "name": "__init__", "signature": "def __init__(self, access_key_id=settings.AccessKeyId, access_key_secret=settings.AccessKeySecret, region_id='cn-shenzhen')" }, { "doc...
6
stack_v2_sparse_classes_30k_train_014134
Implement the Python class `AliyunAPI` described below. Class description: 通过阿里云SDK获取API返回数据 Method signatures and docstrings: - def __init__(self, access_key_id=settings.AccessKeyId, access_key_secret=settings.AccessKeySecret, region_id='cn-shenzhen'): 实例化 传入AccessKeyId ,AccessKeySecret,RegionId :param access_key_id...
Implement the Python class `AliyunAPI` described below. Class description: 通过阿里云SDK获取API返回数据 Method signatures and docstrings: - def __init__(self, access_key_id=settings.AccessKeyId, access_key_secret=settings.AccessKeySecret, region_id='cn-shenzhen'): 实例化 传入AccessKeyId ,AccessKeySecret,RegionId :param access_key_id...
57eeaa273c006af941be41499d2294d93105cf50
<|skeleton|> class AliyunAPI: """通过阿里云SDK获取API返回数据""" def __init__(self, access_key_id=settings.AccessKeyId, access_key_secret=settings.AccessKeySecret, region_id='cn-shenzhen'): """实例化 传入AccessKeyId ,AccessKeySecret,RegionId :param access_key_id: :param access_key_secret: :param region_id:""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AliyunAPI: """通过阿里云SDK获取API返回数据""" def __init__(self, access_key_id=settings.AccessKeyId, access_key_secret=settings.AccessKeySecret, region_id='cn-shenzhen'): """实例化 传入AccessKeyId ,AccessKeySecret,RegionId :param access_key_id: :param access_key_secret: :param region_id:""" self.access_k...
the_stack_v2_python_sparse
utils/aliyun_sdk.py
hardyxia/AutoOps
train
3
b56a033581dd529f285a21ea85b11b295499f7c2
[ "recovery_hash = kwargs['recovery_hash']\nuser = Hasher.reverse_hash(recovery_hash)\nif user is not None:\n if user.is_active:\n request.session['recovery_user_pk'] = user.pk\n context = {'page_title': 'Reset Password', 'reset_password_form': ResetPasswordForm(auto_id=True)}\n context.update...
<|body_start_0|> recovery_hash = kwargs['recovery_hash'] user = Hasher.reverse_hash(recovery_hash) if user is not None: if user.is_active: request.session['recovery_user_pk'] = user.pk context = {'page_title': 'Reset Password', 'reset_password_form': R...
This class allows user to reset password from recovery email.
ResetPasswordView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResetPasswordView: """This class allows user to reset password from recovery email.""" def get(self, request, *args, **kwargs): """Handles GET requests to 'account_reset_password' named route. Resets user password. Returns: HttpResponse with reset_password template if user is active ...
stack_v2_sparse_classes_36k_train_012594
17,941
permissive
[ { "docstring": "Handles GET requests to 'account_reset_password' named route. Resets user password. Returns: HttpResponse with reset_password template if user is active otherwise, flashes 'Account not activated' error to the session.", "name": "get", "signature": "def get(self, request, *args, **kwargs)...
2
null
Implement the Python class `ResetPasswordView` described below. Class description: This class allows user to reset password from recovery email. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Handles GET requests to 'account_reset_password' named route. Resets user password. Returns: Htt...
Implement the Python class `ResetPasswordView` described below. Class description: This class allows user to reset password from recovery email. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Handles GET requests to 'account_reset_password' named route. Resets user password. Returns: Htt...
3704cbe6e69ba3e4c53401d3bbc339208e9ebccd
<|skeleton|> class ResetPasswordView: """This class allows user to reset password from recovery email.""" def get(self, request, *args, **kwargs): """Handles GET requests to 'account_reset_password' named route. Resets user password. Returns: HttpResponse with reset_password template if user is active ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResetPasswordView: """This class allows user to reset password from recovery email.""" def get(self, request, *args, **kwargs): """Handles GET requests to 'account_reset_password' named route. Resets user password. Returns: HttpResponse with reset_password template if user is active otherwise, fl...
the_stack_v2_python_sparse
troupon/authentication/views.py
morristech/troupon
train
0
a32d00fec978d9851d70d62bba109da632218e8b
[ "super(ODEFunc, self).__init__()\nself.l1 = nn.Linear(3, num_hidden)\nself.l2 = nn.Linear(num_hidden, num_hidden)\nself.l3 = nn.Linear(num_hidden, num_hidden)\nself.l4 = nn.Linear(num_hidden, 3)\nself.cond = nn.Linear(latent_len, num_hidden)\nself.tanh = nn.Tanh()\nself.relu = nn.ReLU()\nself.nfe = 0\nself.zeros = ...
<|body_start_0|> super(ODEFunc, self).__init__() self.l1 = nn.Linear(3, num_hidden) self.l2 = nn.Linear(num_hidden, num_hidden) self.l3 = nn.Linear(num_hidden, num_hidden) self.l4 = nn.Linear(num_hidden, 3) self.cond = nn.Linear(latent_len, num_hidden) self.tanh =...
This refers to the dynamics function f(x,t) in a IVP defined as dh(x,t)/dt = f(x,t). For a given location (t) on point (x) trajectory, it returns the direction of 'flow'. Refer to Section 3 (Dynamics Equation) in the paper for details.
ODEFunc
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ODEFunc: """This refers to the dynamics function f(x,t) in a IVP defined as dh(x,t)/dt = f(x,t). For a given location (t) on point (x) trajectory, it returns the direction of 'flow'. Refer to Section 3 (Dynamics Equation) in the paper for details.""" def __init__(self, num_hidden=512, latent...
stack_v2_sparse_classes_36k_train_012595
17,869
permissive
[ { "docstring": "Initialization. num_hidden: number of nodes in a hidden layer latent_len: size of the latent code being used", "name": "__init__", "signature": "def __init__(self, num_hidden=512, latent_len=512)" }, { "docstring": "t: Torch tensor of shape (1,) xz: Torch tensor of shape (N, #pts...
2
stack_v2_sparse_classes_30k_train_004288
Implement the Python class `ODEFunc` described below. Class description: This refers to the dynamics function f(x,t) in a IVP defined as dh(x,t)/dt = f(x,t). For a given location (t) on point (x) trajectory, it returns the direction of 'flow'. Refer to Section 3 (Dynamics Equation) in the paper for details. Method si...
Implement the Python class `ODEFunc` described below. Class description: This refers to the dynamics function f(x,t) in a IVP defined as dh(x,t)/dt = f(x,t). For a given location (t) on point (x) trajectory, it returns the direction of 'flow'. Refer to Section 3 (Dynamics Equation) in the paper for details. Method si...
429c3d431b36358e43c61692e0d02df3ea255635
<|skeleton|> class ODEFunc: """This refers to the dynamics function f(x,t) in a IVP defined as dh(x,t)/dt = f(x,t). For a given location (t) on point (x) trajectory, it returns the direction of 'flow'. Refer to Section 3 (Dynamics Equation) in the paper for details.""" def __init__(self, num_hidden=512, latent...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ODEFunc: """This refers to the dynamics function f(x,t) in a IVP defined as dh(x,t)/dt = f(x,t). For a given location (t) on point (x) trajectory, it returns the direction of 'flow'. Refer to Section 3 (Dynamics Equation) in the paper for details.""" def __init__(self, num_hidden=512, latent_len=512): ...
the_stack_v2_python_sparse
model/meshflow.py
kierannp/3dsnet
train
0
5e4198dcc9da98e7c4922d426edff324a07f9969
[ "@self.router.get('/info', response_model=Dict[str, Info], response_model_exclude={'minzoom', 'maxzoom', 'center'}, response_model_exclude_none=True, responses={200: {'description': \"Return dataset's basic info or the list of available assets.\"}})\ndef info(src_path=Depends(self.path_dependency), asset_params=Dep...
<|body_start_0|> @self.router.get('/info', response_model=Dict[str, Info], response_model_exclude={'minzoom', 'maxzoom', 'center'}, response_model_exclude_none=True, responses={200: {'description': "Return dataset's basic info or the list of available assets."}}) def info(src_path=Depends(self.path_depe...
Custom Tiler Factory for MultiBaseReader classes. Note: To be able to use the rio_tiler.io.MultiBaseReader we need to be able to pass a `assets` argument to most of its methods. By using the `AssetsBidxExprParams` for the `layer_dependency`, the .tile(), .point(), .preview() and the .part() methods will receive assets,...
MultiBaseTilerFactory
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiBaseTilerFactory: """Custom Tiler Factory for MultiBaseReader classes. Note: To be able to use the rio_tiler.io.MultiBaseReader we need to be able to pass a `assets` argument to most of its methods. By using the `AssetsBidxExprParams` for the `layer_dependency`, the .tile(), .point(), .previ...
stack_v2_sparse_classes_36k_train_012596
48,399
permissive
[ { "docstring": "Register /info endpoint.", "name": "info", "signature": "def info(self)" }, { "docstring": "Register /metadata endpoint.", "name": "metadata", "signature": "def metadata(self)" } ]
2
stack_v2_sparse_classes_30k_test_000007
Implement the Python class `MultiBaseTilerFactory` described below. Class description: Custom Tiler Factory for MultiBaseReader classes. Note: To be able to use the rio_tiler.io.MultiBaseReader we need to be able to pass a `assets` argument to most of its methods. By using the `AssetsBidxExprParams` for the `layer_dep...
Implement the Python class `MultiBaseTilerFactory` described below. Class description: Custom Tiler Factory for MultiBaseReader classes. Note: To be able to use the rio_tiler.io.MultiBaseReader we need to be able to pass a `assets` argument to most of its methods. By using the `AssetsBidxExprParams` for the `layer_dep...
2168c9284b39a46c4d1a095542c77addc690a738
<|skeleton|> class MultiBaseTilerFactory: """Custom Tiler Factory for MultiBaseReader classes. Note: To be able to use the rio_tiler.io.MultiBaseReader we need to be able to pass a `assets` argument to most of its methods. By using the `AssetsBidxExprParams` for the `layer_dependency`, the .tile(), .point(), .previ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiBaseTilerFactory: """Custom Tiler Factory for MultiBaseReader classes. Note: To be able to use the rio_tiler.io.MultiBaseReader we need to be able to pass a `assets` argument to most of its methods. By using the `AssetsBidxExprParams` for the `layer_dependency`, the .tile(), .point(), .preview() and the ...
the_stack_v2_python_sparse
src/titiler/core/titiler/core/factory.py
kylebarron/titiler
train
0
77954a077f38705c155e2227989ef72a48571399
[ "try:\n if isinstance(number, float) and (not number.is_integer()):\n raise ValueError\n number = int(number)\nexcept (TypeError, ValueError):\n raise PageNotAnInteger(_('That page number is not an integer'))\nif number < 1:\n raise EmptyPage(_('That page number is less than 1'))\nreturn number",...
<|body_start_0|> try: if isinstance(number, float) and (not number.is_integer()): raise ValueError number = int(number) except (TypeError, ValueError): raise PageNotAnInteger(_('That page number is not an integer')) if number < 1: r...
Paginator for `SumoSearch` classes. Inherits from the default django paginator with a few adjustments. The default paginator attempts to call len() on the `object_list` first, and then query for an individual page. However, since elasticsearch returns the total number of results at the same time as querying for a singl...
SumoSearchPaginator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SumoSearchPaginator: """Paginator for `SumoSearch` classes. Inherits from the default django paginator with a few adjustments. The default paginator attempts to call len() on the `object_list` first, and then query for an individual page. However, since elasticsearch returns the total number of r...
stack_v2_sparse_classes_36k_train_012597
16,315
permissive
[ { "docstring": "Validate the given 1-based page number, without checking if the number is greater than the total number of pages.", "name": "pre_validate_number", "signature": "def pre_validate_number(self, number)" }, { "docstring": "Return a Page object for the given 1-based page number.", ...
2
stack_v2_sparse_classes_30k_train_018215
Implement the Python class `SumoSearchPaginator` described below. Class description: Paginator for `SumoSearch` classes. Inherits from the default django paginator with a few adjustments. The default paginator attempts to call len() on the `object_list` first, and then query for an individual page. However, since elas...
Implement the Python class `SumoSearchPaginator` described below. Class description: Paginator for `SumoSearch` classes. Inherits from the default django paginator with a few adjustments. The default paginator attempts to call len() on the `object_list` first, and then query for an individual page. However, since elas...
67ec527bfc32c715bf9f29d5e01362c4903aebd2
<|skeleton|> class SumoSearchPaginator: """Paginator for `SumoSearch` classes. Inherits from the default django paginator with a few adjustments. The default paginator attempts to call len() on the `object_list` first, and then query for an individual page. However, since elasticsearch returns the total number of r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SumoSearchPaginator: """Paginator for `SumoSearch` classes. Inherits from the default django paginator with a few adjustments. The default paginator attempts to call len() on the `object_list` first, and then query for an individual page. However, since elasticsearch returns the total number of results at the...
the_stack_v2_python_sparse
kitsune/search/base.py
mozilla/kitsune
train
1,218
8d3fbc72f95891fe45b86724380600c7616d8be8
[ "super(Actor, self).__init__()\nself.log_std_min = log_std_min\nself.log_std_max = log_std_max\nself.hidden = nn.Linear(in_dim, 32)\nself.mu_layer = nn.Linear(32, out_dim)\nself.mu_layer = init_layer_uniform(self.mu_layer)\nself.log_std_layer = nn.Linear(32, out_dim)\nself.log_std_layer = init_layer_uniform(self.lo...
<|body_start_0|> super(Actor, self).__init__() self.log_std_min = log_std_min self.log_std_max = log_std_max self.hidden = nn.Linear(in_dim, 32) self.mu_layer = nn.Linear(32, out_dim) self.mu_layer = init_layer_uniform(self.mu_layer) self.log_std_layer = nn.Linear...
Actor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Actor: def __init__(self, in_dim: int, out_dim: int, log_std_min: int=-20, log_std_max: int=0): """Initialize.""" <|body_0|> def forward(self, state: torch.Tensor) -> torch.Tensor: """Forward method implementation.""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_36k_train_012598
13,315
no_license
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, in_dim: int, out_dim: int, log_std_min: int=-20, log_std_max: int=0)" }, { "docstring": "Forward method implementation.", "name": "forward", "signature": "def forward(self, state: torch.Tensor) -> torch.Te...
2
stack_v2_sparse_classes_30k_train_013510
Implement the Python class `Actor` described below. Class description: Implement the Actor class. Method signatures and docstrings: - def __init__(self, in_dim: int, out_dim: int, log_std_min: int=-20, log_std_max: int=0): Initialize. - def forward(self, state: torch.Tensor) -> torch.Tensor: Forward method implementa...
Implement the Python class `Actor` described below. Class description: Implement the Actor class. Method signatures and docstrings: - def __init__(self, in_dim: int, out_dim: int, log_std_min: int=-20, log_std_max: int=0): Initialize. - def forward(self, state: torch.Tensor) -> torch.Tensor: Forward method implementa...
14ddfb81295c349acc2ede7588ebc73c235246c0
<|skeleton|> class Actor: def __init__(self, in_dim: int, out_dim: int, log_std_min: int=-20, log_std_max: int=0): """Initialize.""" <|body_0|> def forward(self, state: torch.Tensor) -> torch.Tensor: """Forward method implementation.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Actor: def __init__(self, in_dim: int, out_dim: int, log_std_min: int=-20, log_std_max: int=0): """Initialize.""" super(Actor, self).__init__() self.log_std_min = log_std_min self.log_std_max = log_std_max self.hidden = nn.Linear(in_dim, 32) self.mu_layer = nn.L...
the_stack_v2_python_sparse
PPO_GAE_TEST/PPO_gae_test2.py
namjiwon1023/Reinforcement_learning
train
2
82642c71d32ee2f4d612e7684df97cf930b112eb
[ "errors = {}\nif user_input is not None:\n try:\n device = await self._async_get_device(user_input[CONF_HOST])\n except GridNetConnectionError:\n errors['base'] = 'cannot_connect'\n else:\n await self.async_set_unique_id(device.n2g_id, raise_on_progress=False)\n self._abort_if_u...
<|body_start_0|> errors = {} if user_input is not None: try: device = await self._async_get_device(user_input[CONF_HOST]) except GridNetConnectionError: errors['base'] = 'cannot_connect' else: await self.async_set_unique...
Config flow for Pure Energie integration.
PureEnergieFlowHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PureEnergieFlowHandler: """Config flow for Pure Energie integration.""" async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: """Handle a flow initialized by the user.""" <|body_0|> async def async_step_zeroconf(self, discovery_info: zero...
stack_v2_sparse_classes_36k_train_012599
3,686
permissive
[ { "docstring": "Handle a flow initialized by the user.", "name": "async_step_user", "signature": "async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult" }, { "docstring": "Handle zeroconf discovery.", "name": "async_step_zeroconf", "signature": "async def ...
4
null
Implement the Python class `PureEnergieFlowHandler` described below. Class description: Config flow for Pure Energie integration. Method signatures and docstrings: - async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: Handle a flow initialized by the user. - async def async_step_zer...
Implement the Python class `PureEnergieFlowHandler` described below. Class description: Config flow for Pure Energie integration. Method signatures and docstrings: - async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: Handle a flow initialized by the user. - async def async_step_zer...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class PureEnergieFlowHandler: """Config flow for Pure Energie integration.""" async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: """Handle a flow initialized by the user.""" <|body_0|> async def async_step_zeroconf(self, discovery_info: zero...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PureEnergieFlowHandler: """Config flow for Pure Energie integration.""" async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: """Handle a flow initialized by the user.""" errors = {} if user_input is not None: try: devic...
the_stack_v2_python_sparse
homeassistant/components/pure_energie/config_flow.py
home-assistant/core
train
35,501