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
5f3fdc590786f3bc14a6c7c2e347e0b2d58cdded
[ "articles = Selector(response).xpath('//div[@class=\"fc-item__header\"]/h3')\ncategory = {'https://www.theguardian.com/international': 'General', 'https://www.theguardian.com/uk/culture': 'Culture', 'https://www.theguardian.com/uk/sport': 'Sports', 'https://www.theguardian.com/uk/technology': 'Technology', 'https:/...
<|body_start_0|> articles = Selector(response).xpath('//div[@class="fc-item__header"]/h3') category = {'https://www.theguardian.com/international': 'General', 'https://www.theguardian.com/uk/culture': 'Culture', 'https://www.theguardian.com/uk/sport': 'Sports', 'https://www.theguardian.com/uk/technology...
Spider that will scrape for articles from The Guardian
GuardianSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GuardianSpider: """Spider that will scrape for articles from The Guardian""" def parse(self, response): """Method to parse articles using Xpaths""" <|body_0|> def guardian_article(self, response): """Call back method to create a News Article object based on scrap...
stack_v2_sparse_classes_36k_train_022200
2,197
no_license
[ { "docstring": "Method to parse articles using Xpaths", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "Call back method to create a News Article object based on scraped data", "name": "guardian_article", "signature": "def guardian_article(self, response)" ...
2
stack_v2_sparse_classes_30k_train_003103
Implement the Python class `GuardianSpider` described below. Class description: Spider that will scrape for articles from The Guardian Method signatures and docstrings: - def parse(self, response): Method to parse articles using Xpaths - def guardian_article(self, response): Call back method to create a News Article ...
Implement the Python class `GuardianSpider` described below. Class description: Spider that will scrape for articles from The Guardian Method signatures and docstrings: - def parse(self, response): Method to parse articles using Xpaths - def guardian_article(self, response): Call back method to create a News Article ...
85553f1b5bce4c1060729ff2061946a54c1d34d2
<|skeleton|> class GuardianSpider: """Spider that will scrape for articles from The Guardian""" def parse(self, response): """Method to parse articles using Xpaths""" <|body_0|> def guardian_article(self, response): """Call back method to create a News Article object based on scrap...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GuardianSpider: """Spider that will scrape for articles from The Guardian""" def parse(self, response): """Method to parse articles using Xpaths""" articles = Selector(response).xpath('//div[@class="fc-item__header"]/h3') category = {'https://www.theguardian.com/international': 'G...
the_stack_v2_python_sparse
news_scraper/news_scraper/spiders/guardian_scraper.py
yaraya24/news_web_application
train
0
2d3353cbc91b7afa92c88e429be3a2bfb2222176
[ "import collections\nself.keys = collections.deque()\nself.container = {}\nself.capacity = capacity", "if key in self.keys:\n self.keys.remove(key)\n self.keys.appendleft(key)\n return self.container[key]\nelse:\n return -1", "if key in self.keys:\n self.keys.remove(key)\n self.keys.appendleft...
<|body_start_0|> import collections self.keys = collections.deque() self.container = {} self.capacity = capacity <|end_body_0|> <|body_start_1|> if key in self.keys: self.keys.remove(key) self.keys.appendleft(key) return self.container[key] ...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:rtype: int""" <|body_1|> def set(self, key, value): """:type key: int :type value: int :rtype: nothing""" <|body_2|> <|end_skeleton|> <...
stack_v2_sparse_classes_36k_train_022201
1,091
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: nothing", "name": "set", "sig...
3
null
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :rtype: int - def set(self, key, value): :type key: int :type value: int :rtype: nothing
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :rtype: int - def set(self, key, value): :type key: int :type value: int :rtype: nothing <|skeleton|> cla...
0b871029b17e7b230e953c2d210d8f0f43a97706
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:rtype: int""" <|body_1|> def set(self, key, value): """:type key: int :type value: int :rtype: nothing""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" import collections self.keys = collections.deque() self.container = {} self.capacity = capacity def get(self, key): """:rtype: int""" if key in self.keys: self.keys.remove...
the_stack_v2_python_sparse
leetcode/146.py
LeptusHe/lightoys
train
0
47510d7029e8af23795e38e0ae5da4674fff0773
[ "data = self.request.get('data', {})\nself_id = data['self_id']\nuser = self.request.app['models']['user']\ncompany = self.request.app['models']['company']\nuser_id = self.request.rel_url.query.get('id')\nif user_id:\n account = await user.get_user(user_id)\n access = user_id == self_id\n users_company = a...
<|body_start_0|> data = self.request.get('data', {}) self_id = data['self_id'] user = self.request.app['models']['user'] company = self.request.app['models']['company'] user_id = self.request.rel_url.query.get('id') if user_id: account = await user.get_user(us...
AccountDetails
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountDetails: async def get(self): """Страница проосмотра данных о пользователе""" <|body_0|> async def post(self): """Обновление данных пользователя""" <|body_1|> <|end_skeleton|> <|body_start_0|> data = self.request.get('data', {}) self_...
stack_v2_sparse_classes_36k_train_022202
3,877
no_license
[ { "docstring": "Страница проосмотра данных о пользователе", "name": "get", "signature": "async def get(self)" }, { "docstring": "Обновление данных пользователя", "name": "post", "signature": "async def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_015027
Implement the Python class `AccountDetails` described below. Class description: Implement the AccountDetails class. Method signatures and docstrings: - async def get(self): Страница проосмотра данных о пользователе - async def post(self): Обновление данных пользователя
Implement the Python class `AccountDetails` described below. Class description: Implement the AccountDetails class. Method signatures and docstrings: - async def get(self): Страница проосмотра данных о пользователе - async def post(self): Обновление данных пользователя <|skeleton|> class AccountDetails: async d...
c8726ad77079b981453c11d5c7fc39bc838eec67
<|skeleton|> class AccountDetails: async def get(self): """Страница проосмотра данных о пользователе""" <|body_0|> async def post(self): """Обновление данных пользователя""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccountDetails: async def get(self): """Страница проосмотра данных о пользователе""" data = self.request.get('data', {}) self_id = data['self_id'] user = self.request.app['models']['user'] company = self.request.app['models']['company'] user_id = self.request.re...
the_stack_v2_python_sparse
auth/views.py
ArtemZaitsev1994/chat
train
0
cf1bfb511989c038ed46684e7276a5525cdc2684
[ "prevMax = 0\ncurrMax = 0\nfor i, v in enumerate(nums):\n currMax, prevMax = (max(currMax, prevMax + v), currMax)\nreturn currMax", "if not nums:\n return 0\nif len(nums) <= 2:\n return max(nums)\ndp = [0] * len(nums)\nfor i in range(len(nums)):\n dp[i] = max(dp[i - 2] + nums[i], dp[i - 1])\nreturn dp...
<|body_start_0|> prevMax = 0 currMax = 0 for i, v in enumerate(nums): currMax, prevMax = (max(currMax, prevMax + v), currMax) return currMax <|end_body_0|> <|body_start_1|> if not nums: return 0 if len(nums) <= 2: return max(nums) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int 空间复杂度:O(1)""" <|body_0|> def rob1(self, nums): """:type nums: List[int] :rtype: int 空间复杂度:O(n)""" <|body_1|> <|end_skeleton|> <|body_start_0|> prevMax = 0 currMax = 0 ...
stack_v2_sparse_classes_36k_train_022203
1,576
no_license
[ { "docstring": ":type nums: List[int] :rtype: int 空间复杂度:O(1)", "name": "rob", "signature": "def rob(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int 空间复杂度:O(n)", "name": "rob1", "signature": "def rob1(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums): :type nums: List[int] :rtype: int 空间复杂度:O(1) - def rob1(self, nums): :type nums: List[int] :rtype: int 空间复杂度:O(n)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums): :type nums: List[int] :rtype: int 空间复杂度:O(1) - def rob1(self, nums): :type nums: List[int] :rtype: int 空间复杂度:O(n) <|skeleton|> class Solution: def rob(...
069bb0b751ef7f469036b9897436eb5d138ffa24
<|skeleton|> class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int 空间复杂度:O(1)""" <|body_0|> def rob1(self, nums): """:type nums: List[int] :rtype: int 空间复杂度:O(n)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int 空间复杂度:O(1)""" prevMax = 0 currMax = 0 for i, v in enumerate(nums): currMax, prevMax = (max(currMax, prevMax + v), currMax) return currMax def rob1(self, nums): """:type nums: Li...
the_stack_v2_python_sparse
算法/动态规划/打家劫舍.py
RichieSong/algorithm
train
0
c1ed4699b07ef12be9d0ea2203d9b65e23324a3a
[ "for member in self.community_members:\n for coopr_exchrxn in member.coopr_exchrxns:\n member.biomass_reaction.objective_coefficient = 0\n coopr_exchrxn.objective_coefficient = 1\n member.fba(build_new_optModel=False, reset_fluxes=False, store_opt_fluxes=False, flux_key=None, stdout_msgs=Fal...
<|body_start_0|> for member in self.community_members: for coopr_exchrxn in member.coopr_exchrxns: member.biomass_reaction.objective_coefficient = 0 coopr_exchrxn.objective_coefficient = 1 member.fba(build_new_optModel=False, reset_fluxes=False, store_...
Performs DMMM for the cooperation level simulation Ali R. Zomorrodi - Daniel Segre Lab @ Boston University Last updated: 01-14-2015
DMMM_coopr_level
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DMMM_coopr_level: """Performs DMMM for the cooperation level simulation Ali R. Zomorrodi - Daniel Segre Lab @ Boston University Last updated: 01-14-2015""" def update_coopr_exchrxn_bounds(self): """Udates the bounds on the flux of cooperative reactions""" <|body_0|> def ...
stack_v2_sparse_classes_36k_train_022204
2,306
no_license
[ { "docstring": "Udates the bounds on the flux of cooperative reactions", "name": "update_coopr_exchrxn_bounds", "signature": "def update_coopr_exchrxn_bounds(self)" }, { "docstring": "Compute the upper bound on the uptake rates of the shared compounds (LB on exchange fluxes) using kinetic expres...
2
stack_v2_sparse_classes_30k_train_003075
Implement the Python class `DMMM_coopr_level` described below. Class description: Performs DMMM for the cooperation level simulation Ali R. Zomorrodi - Daniel Segre Lab @ Boston University Last updated: 01-14-2015 Method signatures and docstrings: - def update_coopr_exchrxn_bounds(self): Udates the bounds on the flux...
Implement the Python class `DMMM_coopr_level` described below. Class description: Performs DMMM for the cooperation level simulation Ali R. Zomorrodi - Daniel Segre Lab @ Boston University Last updated: 01-14-2015 Method signatures and docstrings: - def update_coopr_exchrxn_bounds(self): Udates the bounds on the flux...
7c6137bf7b7379cc98bf4ce319610448592bc075
<|skeleton|> class DMMM_coopr_level: """Performs DMMM for the cooperation level simulation Ali R. Zomorrodi - Daniel Segre Lab @ Boston University Last updated: 01-14-2015""" def update_coopr_exchrxn_bounds(self): """Udates the bounds on the flux of cooperative reactions""" <|body_0|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DMMM_coopr_level: """Performs DMMM for the cooperation level simulation Ali R. Zomorrodi - Daniel Segre Lab @ Boston University Last updated: 01-14-2015""" def update_coopr_exchrxn_bounds(self): """Udates the bounds on the flux of cooperative reactions""" for member in self.community_memb...
the_stack_v2_python_sparse
EcoliPairs/DMMM_coopr_level.py
aarthi31/DS_lab
train
0
ea0e2a332631deb595899121644a2335b0bb30d9
[ "if not root:\n return []\nresults = []\nself.bfs(root, results, 0)\nreturn results", "if not root:\n return\nif level == len(results):\n current = [root.val]\n results.append(current)\nelse:\n level_result = results[level]\n level_result.append(root.val)\n results[level] = level_result\nself...
<|body_start_0|> if not root: return [] results = [] self.bfs(root, results, 0) return results <|end_body_0|> <|body_start_1|> if not root: return if level == len(results): current = [root.val] results.append(current) ...
方法1:递归 算法的时间复杂度是O(n), 而空间复杂度则是递归栈的大小,即树的深度,O(logn)
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """方法1:递归 算法的时间复杂度是O(n), 而空间复杂度则是递归栈的大小,即树的深度,O(logn)""" def levelOrder1(self, root): """层序遍历:递归,前序遍历的方式扫描树,保存层序遍历的结果 :type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def bfs(self, root, results, level): """level 记录当前遍历的层""" <|body_1|>...
stack_v2_sparse_classes_36k_train_022205
2,866
no_license
[ { "docstring": "层序遍历:递归,前序遍历的方式扫描树,保存层序遍历的结果 :type root: TreeNode :rtype: List[List[int]]", "name": "levelOrder1", "signature": "def levelOrder1(self, root)" }, { "docstring": "level 记录当前遍历的层", "name": "bfs", "signature": "def bfs(self, root, results, level)" }, { "docstring": "前...
3
null
Implement the Python class `Solution` described below. Class description: 方法1:递归 算法的时间复杂度是O(n), 而空间复杂度则是递归栈的大小,即树的深度,O(logn) Method signatures and docstrings: - def levelOrder1(self, root): 层序遍历:递归,前序遍历的方式扫描树,保存层序遍历的结果 :type root: TreeNode :rtype: List[List[int]] - def bfs(self, root, results, level): level 记录当前遍历的层 ...
Implement the Python class `Solution` described below. Class description: 方法1:递归 算法的时间复杂度是O(n), 而空间复杂度则是递归栈的大小,即树的深度,O(logn) Method signatures and docstrings: - def levelOrder1(self, root): 层序遍历:递归,前序遍历的方式扫描树,保存层序遍历的结果 :type root: TreeNode :rtype: List[List[int]] - def bfs(self, root, results, level): level 记录当前遍历的层 ...
852fad258f5070c7b93c35252f7404e85e709ea6
<|skeleton|> class Solution: """方法1:递归 算法的时间复杂度是O(n), 而空间复杂度则是递归栈的大小,即树的深度,O(logn)""" def levelOrder1(self, root): """层序遍历:递归,前序遍历的方式扫描树,保存层序遍历的结果 :type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def bfs(self, root, results, level): """level 记录当前遍历的层""" <|body_1|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """方法1:递归 算法的时间复杂度是O(n), 而空间复杂度则是递归栈的大小,即树的深度,O(logn)""" def levelOrder1(self, root): """层序遍历:递归,前序遍历的方式扫描树,保存层序遍历的结果 :type root: TreeNode :rtype: List[List[int]]""" if not root: return [] results = [] self.bfs(root, results, 0) return results...
the_stack_v2_python_sparse
101-200/102. Binary Tree Level Order Traversal.py
SunnyMarkLiu/LeetCode
train
1
3107ebf23cd2b71091924d1014a89e8933702b05
[ "super(RoundRobinPlacementMixin, self).__init__(*args, **kwargs)\nself._cov_devices = cov_devices\nself._inv_devices = inv_devices", "cov_update_thunks, inv_update_thunks = self.make_vars_and_create_op_thunks(scope=scope)\ncov_update_ops = [thunk() for thunk in cov_update_thunks]\ninv_update_ops = [thunk() for th...
<|body_start_0|> super(RoundRobinPlacementMixin, self).__init__(*args, **kwargs) self._cov_devices = cov_devices self._inv_devices = inv_devices <|end_body_0|> <|body_start_1|> cov_update_thunks, inv_update_thunks = self.make_vars_and_create_op_thunks(scope=scope) cov_update_ops...
Implements round robin placement strategy for ops and variables.
RoundRobinPlacementMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoundRobinPlacementMixin: """Implements round robin placement strategy for ops and variables.""" def __init__(self, cov_devices=None, inv_devices=None, *args, **kwargs): """Initializes the RoundRobinPlacementMixin class. Args: cov_devices: Iterable of device strings (e.g. '/gpu:0'). ...
stack_v2_sparse_classes_36k_train_022206
7,555
permissive
[ { "docstring": "Initializes the RoundRobinPlacementMixin class. Args: cov_devices: Iterable of device strings (e.g. '/gpu:0'). Covariance computations will be placed on these devices in a round-robin fashion. Can be None, which means that no devices are specified. inv_devices: Iterable of device strings (e.g. '...
3
null
Implement the Python class `RoundRobinPlacementMixin` described below. Class description: Implements round robin placement strategy for ops and variables. Method signatures and docstrings: - def __init__(self, cov_devices=None, inv_devices=None, *args, **kwargs): Initializes the RoundRobinPlacementMixin class. Args: ...
Implement the Python class `RoundRobinPlacementMixin` described below. Class description: Implements round robin placement strategy for ops and variables. Method signatures and docstrings: - def __init__(self, cov_devices=None, inv_devices=None, *args, **kwargs): Initializes the RoundRobinPlacementMixin class. Args: ...
cabf6e4f1970dc14302f87414f170de19944bac2
<|skeleton|> class RoundRobinPlacementMixin: """Implements round robin placement strategy for ops and variables.""" def __init__(self, cov_devices=None, inv_devices=None, *args, **kwargs): """Initializes the RoundRobinPlacementMixin class. Args: cov_devices: Iterable of device strings (e.g. '/gpu:0'). ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RoundRobinPlacementMixin: """Implements round robin placement strategy for ops and variables.""" def __init__(self, cov_devices=None, inv_devices=None, *args, **kwargs): """Initializes the RoundRobinPlacementMixin class. Args: cov_devices: Iterable of device strings (e.g. '/gpu:0'). Covariance co...
the_stack_v2_python_sparse
Keras_tensorflow_nightly/source2.7/tensorflow/contrib/kfac/python/ops/placement.py
ryfeus/lambda-packs
train
1,283
473ea668bd8cd63beafea221b74d1212abdf1525
[ "self._to = dest\nself._from = source\nself._pwd = pwds\nself.status = None", "file_path = os.path.join(self._from, filename)\nfor pwd in self._pwd:\n unr = unrar.UnrarSpoon(file_path, self._to, pwd)\n status = unr.update_loop(callback=proc)\n self.status = status\n if status[unrar.STATUS_OK]:\n ...
<|body_start_0|> self._to = dest self._from = source self._pwd = pwds self.status = None <|end_body_0|> <|body_start_1|> file_path = os.path.join(self._from, filename) for pwd in self._pwd: unr = unrar.UnrarSpoon(file_path, self._to, pwd) status =...
extractor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class extractor: def __init__(self, source, dest, pwds): """Creates and configures an extractor-object""" <|body_0|> def extract(self, filename, proc=None): """Starts extractor-utility and extracts packets.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_022207
845
no_license
[ { "docstring": "Creates and configures an extractor-object", "name": "__init__", "signature": "def __init__(self, source, dest, pwds)" }, { "docstring": "Starts extractor-utility and extracts packets.", "name": "extract", "signature": "def extract(self, filename, proc=None)" } ]
2
stack_v2_sparse_classes_30k_train_010218
Implement the Python class `extractor` described below. Class description: Implement the extractor class. Method signatures and docstrings: - def __init__(self, source, dest, pwds): Creates and configures an extractor-object - def extract(self, filename, proc=None): Starts extractor-utility and extracts packets.
Implement the Python class `extractor` described below. Class description: Implement the extractor class. Method signatures and docstrings: - def __init__(self, source, dest, pwds): Creates and configures an extractor-object - def extract(self, filename, proc=None): Starts extractor-utility and extracts packets. <|s...
353ab0f9a651233ad1cbc1c463dd052fa28dc35d
<|skeleton|> class extractor: def __init__(self, source, dest, pwds): """Creates and configures an extractor-object""" <|body_0|> def extract(self, filename, proc=None): """Starts extractor-utility and extracts packets.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class extractor: def __init__(self, source, dest, pwds): """Creates and configures an extractor-object""" self._to = dest self._from = source self._pwd = pwds self.status = None def extract(self, filename, proc=None): """Starts extractor-utility and extracts pack...
the_stack_v2_python_sparse
src/pfextractor.py
boon-code/pfrinc4
train
0
bacbd62fd7d096ec3c7dac3854ba016606484181
[ "if not root:\n return ''\n\ndef helper(node, ret):\n if not node:\n return ret.append('')\n ret.append(str(node.val))\n helper(node.left, ret)\n helper(node.right, ret)\n return ret\nret = helper(root, list())\nprint(ret)\nreturn ','.join(ret)", "if not data:\n return None\n\ndef help...
<|body_start_0|> if not root: return '' def helper(node, ret): if not node: return ret.append('') ret.append(str(node.val)) helper(node.left, ret) helper(node.right, ret) return ret ret = helper(root, list()...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_022208
1,417
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_000183
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
73d65512eef07475b5790864cce1fdf3f6f4277a
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '' def helper(node, ret): if not node: return ret.append('') ret.append(str(node.val)) helper...
the_stack_v2_python_sparse
leetcode/serialize-and-deserialize-binary-tree-dfs.py
Jingwu010/Code-Practice
train
0
c6057703d8aebb9008181f9bf6431850a9bb0d41
[ "ObjectManager.__init__(self)\nself.getters.update({'session_user_role_requirements': 'get_many_to_one', 'name': 'get_general'})\nself.setters.update({'session_user_role_requirements': 'set_many', 'name': 'set_general'})\nself.my_django_model = facade.models.SessionUserRole", "if optional_parameters is None:\n ...
<|body_start_0|> ObjectManager.__init__(self) self.getters.update({'session_user_role_requirements': 'get_many_to_one', 'name': 'get_general'}) self.setters.update({'session_user_role_requirements': 'set_many', 'name': 'set_general'}) self.my_django_model = facade.models.SessionUserRole ...
Manage SessionUserRoles in the Power Reg system
SessionUserRoleManager
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SessionUserRoleManager: """Manage SessionUserRoles in the Power Reg system""" def __init__(self): """constructor""" <|body_0|> def create(self, auth_token, name, optional_parameters=None): """Create a new SessionUserRole Optional parameters include: url URL for a...
stack_v2_sparse_classes_36k_train_022209
1,576
permissive
[ { "docstring": "constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Create a new SessionUserRole Optional parameters include: url URL for a website @param name Name for this session user role @param optional_parameters Dictionary of optional parameter names and...
2
stack_v2_sparse_classes_30k_train_002197
Implement the Python class `SessionUserRoleManager` described below. Class description: Manage SessionUserRoles in the Power Reg system Method signatures and docstrings: - def __init__(self): constructor - def create(self, auth_token, name, optional_parameters=None): Create a new SessionUserRole Optional parameters i...
Implement the Python class `SessionUserRoleManager` described below. Class description: Manage SessionUserRoles in the Power Reg system Method signatures and docstrings: - def __init__(self): constructor - def create(self, auth_token, name, optional_parameters=None): Create a new SessionUserRole Optional parameters i...
a59457bc37f0501aea1f54d006a6de94ff80511c
<|skeleton|> class SessionUserRoleManager: """Manage SessionUserRoles in the Power Reg system""" def __init__(self): """constructor""" <|body_0|> def create(self, auth_token, name, optional_parameters=None): """Create a new SessionUserRole Optional parameters include: url URL for a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SessionUserRoleManager: """Manage SessionUserRoles in the Power Reg system""" def __init__(self): """constructor""" ObjectManager.__init__(self) self.getters.update({'session_user_role_requirements': 'get_many_to_one', 'name': 'get_general'}) self.setters.update({'session_...
the_stack_v2_python_sparse
pr_services/event_system/session_user_role_manager.py
ninemoreminutes/openassign-server
train
0
adcb2fe0a6a863be9c0d9ed77c5d13381f8e28c8
[ "self.test.path = '../Digits-2020S2/0/'\nnum_files = 13\nself.assertEqual(num_files, len(self.test), 'number of 0 image files')", "self.test.path = '../Digits-2020S2/0/'\nnum_paths = 13\nself.assertEqual(self.rel_path, self.test.path, 'testing path getter')\nself.assertEqual('HSV', self.test.mode, 'test mode gett...
<|body_start_0|> self.test.path = '../Digits-2020S2/0/' num_files = 13 self.assertEqual(num_files, len(self.test), 'number of 0 image files') <|end_body_0|> <|body_start_1|> self.test.path = '../Digits-2020S2/0/' num_paths = 13 self.assertEqual(self.rel_path, self.test.p...
PURPOSE: Testing class to test imageLoader
test_imageLoader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test_imageLoader: """PURPOSE: Testing class to test imageLoader""" def test_len(self): """PURPOSE: testin if the defined class length function will return the correct number files in a specified directory""" <|body_0|> def test_getters(self): """PURPOSE: testing ...
stack_v2_sparse_classes_36k_train_022210
3,332
no_license
[ { "docstring": "PURPOSE: testin if the defined class length function will return the correct number files in a specified directory", "name": "test_len", "signature": "def test_len(self)" }, { "docstring": "PURPOSE: testing all the accessors available in the class", "name": "test_getters", ...
5
stack_v2_sparse_classes_30k_train_015417
Implement the Python class `test_imageLoader` described below. Class description: PURPOSE: Testing class to test imageLoader Method signatures and docstrings: - def test_len(self): PURPOSE: testin if the defined class length function will return the correct number files in a specified directory - def test_getters(sel...
Implement the Python class `test_imageLoader` described below. Class description: PURPOSE: Testing class to test imageLoader Method signatures and docstrings: - def test_len(self): PURPOSE: testin if the defined class length function will return the correct number files in a specified directory - def test_getters(sel...
4558a1a8b2f68cfa28371f8a802961869d4e5736
<|skeleton|> class test_imageLoader: """PURPOSE: Testing class to test imageLoader""" def test_len(self): """PURPOSE: testin if the defined class length function will return the correct number files in a specified directory""" <|body_0|> def test_getters(self): """PURPOSE: testing ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class test_imageLoader: """PURPOSE: Testing class to test imageLoader""" def test_len(self): """PURPOSE: testin if the defined class length function will return the correct number files in a specified directory""" self.test.path = '../Digits-2020S2/0/' num_files = 13 self.assert...
the_stack_v2_python_sparse
programme/test_ImageLoader.py
TeeRuckus/Digit-Recogination
train
0
7eaf3e36f8ee9b5fc0b58c933795f9eddc60af64
[ "size = len(self)\nidx = operator.index(idx)\nif not -size <= idx < size:\n raise IndexError('index {} is out of range'.format(idx))\nidx %= size\nreturn next(itertools.islice(iterator, idx, None))", "if isinstance(idx, str):\n return self._sub_layers[idx]\nelif isinstance(idx, slice):\n return self.__cl...
<|body_start_0|> size = len(self) idx = operator.index(idx) if not -size <= idx < size: raise IndexError('index {} is out of range'.format(idx)) idx %= size return next(itertools.islice(iterator, idx, None)) <|end_body_0|> <|body_start_1|> if isinstance(idx, ...
Sequential
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sequential: def _get_item_by_idx(self, iterator, idx): """Get the idx-th item of the iterator""" <|body_0|> def __getitem__(self, idx: Union[slice, int, str]): """get mm is sequential instance mm[1] mm[-1] mm[1:] mm['L1']""" <|body_1|> def __setitem__(se...
stack_v2_sparse_classes_36k_train_022211
2,919
no_license
[ { "docstring": "Get the idx-th item of the iterator", "name": "_get_item_by_idx", "signature": "def _get_item_by_idx(self, iterator, idx)" }, { "docstring": "get mm is sequential instance mm[1] mm[-1] mm[1:] mm['L1']", "name": "__getitem__", "signature": "def __getitem__(self, idx: Union...
4
stack_v2_sparse_classes_30k_train_004926
Implement the Python class `Sequential` described below. Class description: Implement the Sequential class. Method signatures and docstrings: - def _get_item_by_idx(self, iterator, idx): Get the idx-th item of the iterator - def __getitem__(self, idx: Union[slice, int, str]): get mm is sequential instance mm[1] mm[-1...
Implement the Python class `Sequential` described below. Class description: Implement the Sequential class. Method signatures and docstrings: - def _get_item_by_idx(self, iterator, idx): Get the idx-th item of the iterator - def __getitem__(self, idx: Union[slice, int, str]): get mm is sequential instance mm[1] mm[-1...
353e7abfa7b02b45d2b7fec096b58e07651eb71d
<|skeleton|> class Sequential: def _get_item_by_idx(self, iterator, idx): """Get the idx-th item of the iterator""" <|body_0|> def __getitem__(self, idx: Union[slice, int, str]): """get mm is sequential instance mm[1] mm[-1] mm[1:] mm['L1']""" <|body_1|> def __setitem__(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Sequential: def _get_item_by_idx(self, iterator, idx): """Get the idx-th item of the iterator""" size = len(self) idx = operator.index(idx) if not -size <= idx < size: raise IndexError('index {} is out of range'.format(idx)) idx %= size return next(i...
the_stack_v2_python_sparse
pp/paddle/container.py
js-ts/AI
train
0
a466d4e73543c0124692b9e4c4b8ad714b5a82ec
[ "interval = self.coordinator.data[self.entity_description.key][self.channel_type]\nif interval.channel_type == ChannelType.FEED_IN:\n return format_cents_to_dollars(interval.per_kwh) * -1\nreturn format_cents_to_dollars(interval.per_kwh)", "interval = self.coordinator.data[self.entity_description.key][self.cha...
<|body_start_0|> interval = self.coordinator.data[self.entity_description.key][self.channel_type] if interval.channel_type == ChannelType.FEED_IN: return format_cents_to_dollars(interval.per_kwh) * -1 return format_cents_to_dollars(interval.per_kwh) <|end_body_0|> <|body_start_1|> ...
Amber Price Sensor.
AmberPriceSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AmberPriceSensor: """Amber Price Sensor.""" def native_value(self) -> float | None: """Return the current price in $/kWh.""" <|body_0|> def extra_state_attributes(self) -> Mapping[str, Any] | None: """Return additional pieces of information about the price.""" ...
stack_v2_sparse_classes_36k_train_022212
9,224
permissive
[ { "docstring": "Return the current price in $/kWh.", "name": "native_value", "signature": "def native_value(self) -> float | None" }, { "docstring": "Return additional pieces of information about the price.", "name": "extra_state_attributes", "signature": "def extra_state_attributes(self...
2
stack_v2_sparse_classes_30k_train_005872
Implement the Python class `AmberPriceSensor` described below. Class description: Amber Price Sensor. Method signatures and docstrings: - def native_value(self) -> float | None: Return the current price in $/kWh. - def extra_state_attributes(self) -> Mapping[str, Any] | None: Return additional pieces of information a...
Implement the Python class `AmberPriceSensor` described below. Class description: Amber Price Sensor. Method signatures and docstrings: - def native_value(self) -> float | None: Return the current price in $/kWh. - def extra_state_attributes(self) -> Mapping[str, Any] | None: Return additional pieces of information a...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class AmberPriceSensor: """Amber Price Sensor.""" def native_value(self) -> float | None: """Return the current price in $/kWh.""" <|body_0|> def extra_state_attributes(self) -> Mapping[str, Any] | None: """Return additional pieces of information about the price.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AmberPriceSensor: """Amber Price Sensor.""" def native_value(self) -> float | None: """Return the current price in $/kWh.""" interval = self.coordinator.data[self.entity_description.key][self.channel_type] if interval.channel_type == ChannelType.FEED_IN: return format_...
the_stack_v2_python_sparse
homeassistant/components/amberelectric/sensor.py
home-assistant/core
train
35,501
c1f68990bba40b5def56350b367db36bd8f19b57
[ "try:\n for q in question:\n int(q)\nexcept Exception as e:\n logger.error(f'format_question: Asking non-int tables {e}')\nspeech_list = (' ', str(question[0]), ' times ', str(question[1]))\nreturn ''.join(speech_list)", "question = QuestionAttr.get_question_tables(handler_input, integers=False)\nq...
<|body_start_0|> try: for q in question: int(q) except Exception as e: logger.error(f'format_question: Asking non-int tables {e}') speech_list = (' ', str(question[0]), ' times ', str(question[1])) return ''.join(speech_list) <|end_body_0|> <|bo...
GenQuestions
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GenQuestions: def format_question(question: tuple) -> str: """Formats the question for Alexa <speak>""" <|body_0|> def get_same_question(handler_input) -> str: """Returns the same question to the user.""" <|body_1|> def check_same_question(handler_input,...
stack_v2_sparse_classes_36k_train_022213
1,723
permissive
[ { "docstring": "Formats the question for Alexa <speak>", "name": "format_question", "signature": "def format_question(question: tuple) -> str" }, { "docstring": "Returns the same question to the user.", "name": "get_same_question", "signature": "def get_same_question(handler_input) -> st...
3
null
Implement the Python class `GenQuestions` described below. Class description: Implement the GenQuestions class. Method signatures and docstrings: - def format_question(question: tuple) -> str: Formats the question for Alexa <speak> - def get_same_question(handler_input) -> str: Returns the same question to the user. ...
Implement the Python class `GenQuestions` described below. Class description: Implement the GenQuestions class. Method signatures and docstrings: - def format_question(question: tuple) -> str: Formats the question for Alexa <speak> - def get_same_question(handler_input) -> str: Returns the same question to the user. ...
1072dea1a5be0b339211ff39db6a89a90aca64c1
<|skeleton|> class GenQuestions: def format_question(question: tuple) -> str: """Formats the question for Alexa <speak>""" <|body_0|> def get_same_question(handler_input) -> str: """Returns the same question to the user.""" <|body_1|> def check_same_question(handler_input,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GenQuestions: def format_question(question: tuple) -> str: """Formats the question for Alexa <speak>""" try: for q in question: int(q) except Exception as e: logger.error(f'format_question: Asking non-int tables {e}') speech_list = (' '...
the_stack_v2_python_sparse
1_code/mult_questions/gen_questions.py
jaimiles23/Multiplication-Medley
train
0
2bb48278d4b7da9ea4dd7e94511308f4c56cf7e4
[ "now = pendulum.now('utc')\nschedules = await models.Schedule.where({'active': {'_eq': True}, 'flow': {'archived': {'_eq': False}}, '_and': [{'_or': [{'schedule_start': {'_lte': str(now.add(days=1))}}, {'schedule_start': {'_is_null': True}}]}, {'_or': [{'schedule_end': {'_gte': str(now)}}, {'schedule_end': {'_is_nu...
<|body_start_0|> now = pendulum.now('utc') schedules = await models.Schedule.where({'active': {'_eq': True}, 'flow': {'archived': {'_eq': False}}, '_and': [{'_or': [{'schedule_start': {'_lte': str(now.add(days=1))}}, {'schedule_start': {'_is_null': True}}]}, {'_or': [{'schedule_end': {'_gte': str(now)}}...
The Scheduler is a service that creates new flow runs for flows with active schedules. Schedules that are eligible for scheduling have the following properties: - the schedule has already started, or starts within the next 24 hours - the schedule has not ended - the schedule is active - the schedule's flow is not archi...
Scheduler
[ "LicenseRef-scancode-proprietary-license", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Scheduler: """The Scheduler is a service that creates new flow runs for flows with active schedules. Schedules that are eligible for scheduling have the following properties: - the schedule has already started, or starts within the next 24 hours - the schedule has not ended - the schedule is acti...
stack_v2_sparse_classes_36k_train_022214
3,674
permissive
[ { "docstring": "Args: - n_flows (int): the maximum number of flows to schedule Returns: - int: The number of scheduled runs", "name": "schedule_flows", "signature": "async def schedule_flows(self, n_flows=100) -> int" }, { "docstring": "Run the scheduler loop one time. As long as `schedule_flows...
2
stack_v2_sparse_classes_30k_train_010410
Implement the Python class `Scheduler` described below. Class description: The Scheduler is a service that creates new flow runs for flows with active schedules. Schedules that are eligible for scheduling have the following properties: - the schedule has already started, or starts within the next 24 hours - the schedu...
Implement the Python class `Scheduler` described below. Class description: The Scheduler is a service that creates new flow runs for flows with active schedules. Schedules that are eligible for scheduling have the following properties: - the schedule has already started, or starts within the next 24 hours - the schedu...
f2ae050df8258aebfc0a97ffcd3e38344180f53e
<|skeleton|> class Scheduler: """The Scheduler is a service that creates new flow runs for flows with active schedules. Schedules that are eligible for scheduling have the following properties: - the schedule has already started, or starts within the next 24 hours - the schedule has not ended - the schedule is acti...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Scheduler: """The Scheduler is a service that creates new flow runs for flows with active schedules. Schedules that are eligible for scheduling have the following properties: - the schedule has already started, or starts within the next 24 hours - the schedule has not ended - the schedule is active - the sche...
the_stack_v2_python_sparse
server/src/prefect_server/services/scheduler/scheduler.py
manesioz/prefect
train
0
82929a6d01f74118c1ecf85b8ecd77595444fb78
[ "response = {'errors': {}}\nif setting_type == AdminSetting.Settings_type.number:\n try:\n value = int(value)\n if not min <= value <= max:\n message = 'value must be between {min} and {max}'\n message = message.format(min=min, max=max)\n response['errors'][setting]...
<|body_start_0|> response = {'errors': {}} if setting_type == AdminSetting.Settings_type.number: try: value = int(value) if not min <= value <= max: message = 'value must be between {min} and {max}' message = message.for...
AdminSettingSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdminSettingSerializer: def validate_setting_value(self, min, max, setting, text, setting_type, value): """Validates setting value""" <|body_0|> def create(self, validated_data): """Create/updates admin setting values.""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_022215
2,982
no_license
[ { "docstring": "Validates setting value", "name": "validate_setting_value", "signature": "def validate_setting_value(self, min, max, setting, text, setting_type, value)" }, { "docstring": "Create/updates admin setting values.", "name": "create", "signature": "def create(self, validated_d...
2
stack_v2_sparse_classes_30k_train_000321
Implement the Python class `AdminSettingSerializer` described below. Class description: Implement the AdminSettingSerializer class. Method signatures and docstrings: - def validate_setting_value(self, min, max, setting, text, setting_type, value): Validates setting value - def create(self, validated_data): Create/upd...
Implement the Python class `AdminSettingSerializer` described below. Class description: Implement the AdminSettingSerializer class. Method signatures and docstrings: - def validate_setting_value(self, min, max, setting, text, setting_type, value): Validates setting value - def create(self, validated_data): Create/upd...
5d5bc4c1eecbf627d38260e4d314d8451d67a4f5
<|skeleton|> class AdminSettingSerializer: def validate_setting_value(self, min, max, setting, text, setting_type, value): """Validates setting value""" <|body_0|> def create(self, validated_data): """Create/updates admin setting values.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdminSettingSerializer: def validate_setting_value(self, min, max, setting, text, setting_type, value): """Validates setting value""" response = {'errors': {}} if setting_type == AdminSetting.Settings_type.number: try: value = int(value) if n...
the_stack_v2_python_sparse
curation-api/src/patients/serializers/admin_settings.py
mohanj1919/django_app_test
train
0
5de99a428b2d3fe48774d03cf04de9c0aae0c7f4
[ "self.data_list_name = data_list_name\nself.batch_call_func = batch_call_func\nself.get_config_dict_func = get_config_dict_func\nself.get_config_dict_args = get_config_dict_args or ()\nself.get_config_dict_kwargs = get_config_dict_kwargs or {}\nself.get_data = get_data\nself.extend_result = extend_result\nself.batc...
<|body_start_0|> self.data_list_name = data_list_name self.batch_call_func = batch_call_func self.get_config_dict_func = get_config_dict_func self.get_config_dict_args = get_config_dict_args or () self.get_config_dict_kwargs = get_config_dict_kwargs or {} self.get_data = ...
并发控制器 功能:细粒度控制不同执行逻辑的单次并发量,将批量任务先按设置的单次并发限制数量进行分批,批次间选择并行或串行 背景: - 并发 ssh 连接问题 使用 paramiko 远程连接时发现,当任务量 > CONCURRENT_NUMBER 时,部分线程出现 self.chan.recv(RECV_BUFLEN) 超时的问题 经测试,如果需要下发多条命令,一次并发量 <= CONCURRENT_NUMBER 是安全的 - JOB 执行脚本接口调用限频 ...
ConcurrentController
[ "MIT", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConcurrentController: """并发控制器 功能:细粒度控制不同执行逻辑的单次并发量,将批量任务先按设置的单次并发限制数量进行分批,批次间选择并行或串行 背景: - 并发 ssh 连接问题 使用 paramiko 远程连接时发现,当任务量 > CONCURRENT_NUMBER 时,部分线程出现 self.chan.recv(RECV_BUFLEN) 超时的问题 经测试,如果需要下发多条命令,一次并发量 <= CONCURRENT_NUMBER 是安全的 - JOB 执行脚本接口调用限频 ...""" def __init__(self, data_list_...
stack_v2_sparse_classes_36k_train_022216
6,948
permissive
[ { "docstring": ":param data_list_name: 待执行对象列表名称 :param batch_call_func: 批量执行方法,定义方式参考 batch_call :param get_config_dict_func: 获取配置方法 :param get_config_dict_args: 获取配置方法 位置参数 :param get_config_dict_kwargs: 获取配置方法 关键字参数 :param get_data: 对 batch_call_func 结果进行预处理 :param extend_result: 是否展开结果 :param batch_call_kwa...
3
null
Implement the Python class `ConcurrentController` described below. Class description: 并发控制器 功能:细粒度控制不同执行逻辑的单次并发量,将批量任务先按设置的单次并发限制数量进行分批,批次间选择并行或串行 背景: - 并发 ssh 连接问题 使用 paramiko 远程连接时发现,当任务量 > CONCURRENT_NUMBER 时,部分线程出现 self.chan.recv(RECV_BUFLEN) 超时的问题 经测试,如果需要下发多条命令,一次并发量 <= CONCURRENT_NUMBER 是安全的 - JOB 执行脚本接口调用限频 .....
Implement the Python class `ConcurrentController` described below. Class description: 并发控制器 功能:细粒度控制不同执行逻辑的单次并发量,将批量任务先按设置的单次并发限制数量进行分批,批次间选择并行或串行 背景: - 并发 ssh 连接问题 使用 paramiko 远程连接时发现,当任务量 > CONCURRENT_NUMBER 时,部分线程出现 self.chan.recv(RECV_BUFLEN) 超时的问题 经测试,如果需要下发多条命令,一次并发量 <= CONCURRENT_NUMBER 是安全的 - JOB 执行脚本接口调用限频 .....
72d2104783443bff26c752c5bd934a013b302b6d
<|skeleton|> class ConcurrentController: """并发控制器 功能:细粒度控制不同执行逻辑的单次并发量,将批量任务先按设置的单次并发限制数量进行分批,批次间选择并行或串行 背景: - 并发 ssh 连接问题 使用 paramiko 远程连接时发现,当任务量 > CONCURRENT_NUMBER 时,部分线程出现 self.chan.recv(RECV_BUFLEN) 超时的问题 经测试,如果需要下发多条命令,一次并发量 <= CONCURRENT_NUMBER 是安全的 - JOB 执行脚本接口调用限频 ...""" def __init__(self, data_list_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConcurrentController: """并发控制器 功能:细粒度控制不同执行逻辑的单次并发量,将批量任务先按设置的单次并发限制数量进行分批,批次间选择并行或串行 背景: - 并发 ssh 连接问题 使用 paramiko 远程连接时发现,当任务量 > CONCURRENT_NUMBER 时,部分线程出现 self.chan.recv(RECV_BUFLEN) 超时的问题 经测试,如果需要下发多条命令,一次并发量 <= CONCURRENT_NUMBER 是安全的 - JOB 执行脚本接口调用限频 ...""" def __init__(self, data_list_name: str, ba...
the_stack_v2_python_sparse
apps/core/concurrent/controller.py
TencentBlueKing/bk-nodeman
train
54
2ebd1fd73f5b889e5e16957e7eb85d9fd8fafbc3
[ "with open(os.path.join(self.TMPL_DIR, 'compute.pkglist')) as f:\n pkgs = f.read()\npkgs = pkgs.replace('\\n', ' ')\nreturn pkgs", "opts = []\nopts.append('url=http://%s/install/autoinst/%s' % (CONF.conductor.host_ip, node.name))\nopts.append('live-installer/net-image=http://%s/install/%s/install/filesystem.sq...
<|body_start_0|> with open(os.path.join(self.TMPL_DIR, 'compute.pkglist')) as f: pkgs = f.read() pkgs = pkgs.replace('\n', ' ') return pkgs <|end_body_0|> <|body_start_1|> opts = [] opts.append('url=http://%s/install/autoinst/%s' % (CONF.conductor.host_ip, node.name)...
Interface for hardware control actions.
UbuntuInterface
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UbuntuInterface: """Interface for hardware control actions.""" def _get_pkg_list(self): """Return pkg list form pkg template""" <|body_0|> def build_os_boot_str(self, node, osimage): """Generate command line string for specific os image :param node: the node to a...
stack_v2_sparse_classes_36k_train_022217
1,323
no_license
[ { "docstring": "Return pkg list form pkg template", "name": "_get_pkg_list", "signature": "def _get_pkg_list(self)" }, { "docstring": "Generate command line string for specific os image :param node: the node to act on. :param osimage: osimage object. :returns command line string for os repo", ...
2
null
Implement the Python class `UbuntuInterface` described below. Class description: Interface for hardware control actions. Method signatures and docstrings: - def _get_pkg_list(self): Return pkg list form pkg template - def build_os_boot_str(self, node, osimage): Generate command line string for specific os image :para...
Implement the Python class `UbuntuInterface` described below. Class description: Interface for hardware control actions. Method signatures and docstrings: - def _get_pkg_list(self): Return pkg list form pkg template - def build_os_boot_str(self, node, osimage): Generate command line string for specific os image :para...
f5cf3c054a603c03cb3583d685ecda5a6870c274
<|skeleton|> class UbuntuInterface: """Interface for hardware control actions.""" def _get_pkg_list(self): """Return pkg list form pkg template""" <|body_0|> def build_os_boot_str(self, node, osimage): """Generate command line string for specific os image :param node: the node to a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UbuntuInterface: """Interface for hardware control actions.""" def _get_pkg_list(self): """Return pkg list form pkg template""" with open(os.path.join(self.TMPL_DIR, 'compute.pkglist')) as f: pkgs = f.read() pkgs = pkgs.replace('\n', ' ') return pkgs def b...
the_stack_v2_python_sparse
xcat3/plugins/osimage/ubuntu/ubuntu.py
chenglch/xcat3
train
1
ec26c73f2ab189b55b53dbdfcf44d4b890a40935
[ "self.radius = radius\nself.bits = bits\nself.chirality = chirality\nself.sanitize = sanitize", "try:\n molecule = Chem.MolFromSmiles(smiles, sanitize=self.sanitize)\n if not self.sanitize:\n molecule.UpdatePropertyCache(strict=False)\n AllChem.FastFindRings(molecule)\n fingerprint = AllChe...
<|body_start_0|> self.radius = radius self.bits = bits self.chirality = chirality self.sanitize = sanitize <|end_body_0|> <|body_start_1|> try: molecule = Chem.MolFromSmiles(smiles, sanitize=self.sanitize) if not self.sanitize: molecule.Up...
Get fingerprints starting from SMILES.
SMILESToMorganFingerprints
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SMILESToMorganFingerprints: """Get fingerprints starting from SMILES.""" def __init__(self, radius: int=2, bits: int=512, chirality=True, sanitize=False) -> None: """Initialize a SMILES to fingerprints object. Args: radius (int): radius of the fingerprints. bits (int): bits used to r...
stack_v2_sparse_classes_36k_train_022218
22,008
permissive
[ { "docstring": "Initialize a SMILES to fingerprints object. Args: radius (int): radius of the fingerprints. bits (int): bits used to represent the fingerprints.", "name": "__init__", "signature": "def __init__(self, radius: int=2, bits: int=512, chirality=True, sanitize=False) -> None" }, { "doc...
2
stack_v2_sparse_classes_30k_train_005381
Implement the Python class `SMILESToMorganFingerprints` described below. Class description: Get fingerprints starting from SMILES. Method signatures and docstrings: - def __init__(self, radius: int=2, bits: int=512, chirality=True, sanitize=False) -> None: Initialize a SMILES to fingerprints object. Args: radius (int...
Implement the Python class `SMILESToMorganFingerprints` described below. Class description: Get fingerprints starting from SMILES. Method signatures and docstrings: - def __init__(self, radius: int=2, bits: int=512, chirality=True, sanitize=False) -> None: Initialize a SMILES to fingerprints object. Args: radius (int...
27ca3f8c5b5463cd081be5abdea04f5bfa076f39
<|skeleton|> class SMILESToMorganFingerprints: """Get fingerprints starting from SMILES.""" def __init__(self, radius: int=2, bits: int=512, chirality=True, sanitize=False) -> None: """Initialize a SMILES to fingerprints object. Args: radius (int): radius of the fingerprints. bits (int): bits used to r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SMILESToMorganFingerprints: """Get fingerprints starting from SMILES.""" def __init__(self, radius: int=2, bits: int=512, chirality=True, sanitize=False) -> None: """Initialize a SMILES to fingerprints object. Args: radius (int): radius of the fingerprints. bits (int): bits used to represent the ...
the_stack_v2_python_sparse
pytoda/smiles/transforms.py
PaccMann/paccmann_datasets
train
22
5cbf41907be14db21aa462a5268bead26576aeb9
[ "df = self.read_pdf()\nresult = {}\nfor item in df.to_dict(orient='records'):\n key = item['dwd_id']\n value = item\n result[key] = value\nreturn result", "import tabula\ndf = tabula.read_pdf(self.url, multiple_tables=False, pages=1)[0]\ndf.columns = ['name', 'dwd_id', 'wmo_id', 'coordinates_wgs84_text',...
<|body_start_0|> df = self.read_pdf() result = {} for item in df.to_dict(orient='records'): key = item['dwd_id'] value = item result[key] = value return result <|end_body_0|> <|body_start_1|> import tabula df = tabula.read_pdf(self.url...
Parse list of sites from PDF documents [1,2] and output as Python dictionary. [1] https://www.dwd.de/DE/derdwd/messnetz/atmosphaerenbeobachtung/_functions/HaeufigGesucht/koordinaten-radarverbund.pdf?__blob=publicationFile # noqa:E501,B950 [2] https://www.dwd.de/DE/leistungen/radolan/radolan_info/radolan_radvor_op_kompo...
DwdRadarSitesGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DwdRadarSitesGenerator: """Parse list of sites from PDF documents [1,2] and output as Python dictionary. [1] https://www.dwd.de/DE/derdwd/messnetz/atmosphaerenbeobachtung/_functions/HaeufigGesucht/koordinaten-radarverbund.pdf?__blob=publicationFile # noqa:E501,B950 [2] https://www.dwd.de/DE/leist...
stack_v2_sparse_classes_36k_train_022219
4,442
permissive
[ { "docstring": "Build dictionary from DataFrame containing radar site information.", "name": "all", "signature": "def all(self) -> Dict" }, { "docstring": "Parse PDF file and build DataFrame containing radar site information.", "name": "read_pdf", "signature": "def read_pdf(self) -> pd.D...
2
stack_v2_sparse_classes_30k_train_004434
Implement the Python class `DwdRadarSitesGenerator` described below. Class description: Parse list of sites from PDF documents [1,2] and output as Python dictionary. [1] https://www.dwd.de/DE/derdwd/messnetz/atmosphaerenbeobachtung/_functions/HaeufigGesucht/koordinaten-radarverbund.pdf?__blob=publicationFile # noqa:E5...
Implement the Python class `DwdRadarSitesGenerator` described below. Class description: Parse list of sites from PDF documents [1,2] and output as Python dictionary. [1] https://www.dwd.de/DE/derdwd/messnetz/atmosphaerenbeobachtung/_functions/HaeufigGesucht/koordinaten-radarverbund.pdf?__blob=publicationFile # noqa:E5...
3c5c63b5b8d3e19511ad789bb499bdaa9b1976d9
<|skeleton|> class DwdRadarSitesGenerator: """Parse list of sites from PDF documents [1,2] and output as Python dictionary. [1] https://www.dwd.de/DE/derdwd/messnetz/atmosphaerenbeobachtung/_functions/HaeufigGesucht/koordinaten-radarverbund.pdf?__blob=publicationFile # noqa:E501,B950 [2] https://www.dwd.de/DE/leist...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DwdRadarSitesGenerator: """Parse list of sites from PDF documents [1,2] and output as Python dictionary. [1] https://www.dwd.de/DE/derdwd/messnetz/atmosphaerenbeobachtung/_functions/HaeufigGesucht/koordinaten-radarverbund.pdf?__blob=publicationFile # noqa:E501,B950 [2] https://www.dwd.de/DE/leistungen/radolan...
the_stack_v2_python_sparse
wetterdienst/provider/dwd/radar/sites.py
waltherg/wetterdienst
train
0
2955a24ef7d61ddce4e07a01bdd518262cab889f
[ "differentiator.refresh()\nop = differentiator.generate_differentiable_op(sampled_op=op)\nqubit = cirq.GridQubit(0, 0)\ncircuit = util.convert_to_tensor([cirq.Circuit(cirq.X(qubit) ** sympy.Symbol('alpha'))])\npsums = util.convert_to_tensor([[cirq.Z(qubit)]])\nsymbol_values_array = np.array([[0.123]], dtype=np.floa...
<|body_start_0|> differentiator.refresh() op = differentiator.generate_differentiable_op(sampled_op=op) qubit = cirq.GridQubit(0, 0) circuit = util.convert_to_tensor([cirq.Circuit(cirq.X(qubit) ** sympy.Symbol('alpha'))]) psums = util.convert_to_tensor([[cirq.Z(qubit)]]) ...
Test approximate correctness of noisy methods.
NoisyGradientCorrectnessTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NoisyGradientCorrectnessTest: """Test approximate correctness of noisy methods.""" def test_sampled_value_with_simple_circuit(self, differentiator, op, num_samples): """Test the value of sampled differentiator with simple circuit.""" <|body_0|> def test_approx_equality_s...
stack_v2_sparse_classes_36k_train_022220
22,303
permissive
[ { "docstring": "Test the value of sampled differentiator with simple circuit.", "name": "test_sampled_value_with_simple_circuit", "signature": "def test_sampled_value_with_simple_circuit(self, differentiator, op, num_samples)" }, { "docstring": "Test small circuits with limited depth.", "nam...
3
stack_v2_sparse_classes_30k_train_010819
Implement the Python class `NoisyGradientCorrectnessTest` described below. Class description: Test approximate correctness of noisy methods. Method signatures and docstrings: - def test_sampled_value_with_simple_circuit(self, differentiator, op, num_samples): Test the value of sampled differentiator with simple circu...
Implement the Python class `NoisyGradientCorrectnessTest` described below. Class description: Test approximate correctness of noisy methods. Method signatures and docstrings: - def test_sampled_value_with_simple_circuit(self, differentiator, op, num_samples): Test the value of sampled differentiator with simple circu...
f56257bceb988b743790e1e480eac76fd036d4ff
<|skeleton|> class NoisyGradientCorrectnessTest: """Test approximate correctness of noisy methods.""" def test_sampled_value_with_simple_circuit(self, differentiator, op, num_samples): """Test the value of sampled differentiator with simple circuit.""" <|body_0|> def test_approx_equality_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NoisyGradientCorrectnessTest: """Test approximate correctness of noisy methods.""" def test_sampled_value_with_simple_circuit(self, differentiator, op, num_samples): """Test the value of sampled differentiator with simple circuit.""" differentiator.refresh() op = differentiator.ge...
the_stack_v2_python_sparse
tensorflow_quantum/python/differentiators/gradient_test.py
tensorflow/quantum
train
1,799
9b7b63047894283a9229c425580475405d0f8be9
[ "u = self.dtype_u(u0)\ndf.solve(self.M - factor * self.K, u.values.vector(), rhs.values.vector())\nreturn u", "f = self.dtype_f(self.V)\nself.K.mult(u.values.vector(), f.impl.values.vector())\nself.g.t = t\nf.expl = self.dtype_u(df.interpolate(self.g, self.V))\nf.expl = self.apply_mass_matrix(f.expl)\nreturn f" ]
<|body_start_0|> u = self.dtype_u(u0) df.solve(self.M - factor * self.K, u.values.vector(), rhs.values.vector()) return u <|end_body_0|> <|body_start_1|> f = self.dtype_f(self.V) self.K.mult(u.values.vector(), f.impl.values.vector()) self.g.t = t f.expl = self.dt...
Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1], expects mass matrix sweeper
fenics_heat_mass
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class fenics_heat_mass: """Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1], expects mass matrix sweeper""" def solve_system(self, rhs, factor, u0, t): """Dolfin's linear solver for :math:`(M - factor A) \\vec{u} = \\vec{rhs}`. Parameters ---------- rhs : dtype...
stack_v2_sparse_classes_36k_train_022221
8,456
permissive
[ { "docstring": "Dolfin's linear solver for :math:`(M - factor A) \\\\vec{u} = \\\\vec{rhs}`. Parameters ---------- rhs : dtype_f Right-hand side for the nonlinear system. factor : float Abbrev. for the node-to-node stepsize (or any other factor required). u0 : dtype_u Initial guess for the iterative solver (not...
2
null
Implement the Python class `fenics_heat_mass` described below. Class description: Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1], expects mass matrix sweeper Method signatures and docstrings: - def solve_system(self, rhs, factor, u0, t): Dolfin's linear solver for :math:`(M - factor A) ...
Implement the Python class `fenics_heat_mass` described below. Class description: Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1], expects mass matrix sweeper Method signatures and docstrings: - def solve_system(self, rhs, factor, u0, t): Dolfin's linear solver for :math:`(M - factor A) ...
1a51834bedffd4472e344bed28f4d766614b1537
<|skeleton|> class fenics_heat_mass: """Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1], expects mass matrix sweeper""" def solve_system(self, rhs, factor, u0, t): """Dolfin's linear solver for :math:`(M - factor A) \\vec{u} = \\vec{rhs}`. Parameters ---------- rhs : dtype...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class fenics_heat_mass: """Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1], expects mass matrix sweeper""" def solve_system(self, rhs, factor, u0, t): """Dolfin's linear solver for :math:`(M - factor A) \\vec{u} = \\vec{rhs}`. Parameters ---------- rhs : dtype_f Right-hand...
the_stack_v2_python_sparse
pySDC/implementations/problem_classes/HeatEquation_1D_FEniCS_matrix_forced.py
Parallel-in-Time/pySDC
train
30
927a0f6b59bae99c311ddc4480abf826eb58ed11
[ "if request.method == 'POST':\n name = request.data.get('name', None)\n if name != None:\n a = Help_category.create_category(name)\n return Response({'status': 1, 'msg': '创建成功', 'id': a})\n else:\n return Response({'status': 0, 'msg': 'post方式访问'})", "if request.method == 'POST':\n ...
<|body_start_0|> if request.method == 'POST': name = request.data.get('name', None) if name != None: a = Help_category.create_category(name) return Response({'status': 1, 'msg': '创建成功', 'id': a}) else: return Response({'status':...
help_category
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class help_category: def POST_create(self, request): """创建分类""" <|body_0|> def DELETE_category(self, request): """删除分类""" <|body_1|> def Get_category_list(self, request): """获取分类""" <|body_2|> <|end_skeleton|> <|body_start_0|> if requ...
stack_v2_sparse_classes_36k_train_022222
7,936
no_license
[ { "docstring": "创建分类", "name": "POST_create", "signature": "def POST_create(self, request)" }, { "docstring": "删除分类", "name": "DELETE_category", "signature": "def DELETE_category(self, request)" }, { "docstring": "获取分类", "name": "Get_category_list", "signature": "def Get_...
3
null
Implement the Python class `help_category` described below. Class description: Implement the help_category class. Method signatures and docstrings: - def POST_create(self, request): 创建分类 - def DELETE_category(self, request): 删除分类 - def Get_category_list(self, request): 获取分类
Implement the Python class `help_category` described below. Class description: Implement the help_category class. Method signatures and docstrings: - def POST_create(self, request): 创建分类 - def DELETE_category(self, request): 删除分类 - def Get_category_list(self, request): 获取分类 <|skeleton|> class help_category: def...
19c45abe61d34c8c5b43b618f0e86e539645e914
<|skeleton|> class help_category: def POST_create(self, request): """创建分类""" <|body_0|> def DELETE_category(self, request): """删除分类""" <|body_1|> def Get_category_list(self, request): """获取分类""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class help_category: def POST_create(self, request): """创建分类""" if request.method == 'POST': name = request.data.get('name', None) if name != None: a = Help_category.create_category(name) return Response({'status': 1, 'msg': '创建成功', 'id': a}) ...
the_stack_v2_python_sparse
help_center/views.py
DearXXD/community-resource-share
train
0
7a4569c635c6911a87fb1af9dfe0af2705fcff6d
[ "self.model = ModelZoo().get_model(PipeStepConfig.model.model_desc, PipeStepConfig.model.pretrained_model_file)\narch_params_key = '{}.out_channels'\nsearch_space = [dict(key=arch_params_key.format(name), type='HALF', range=[module.out_channels]) for name, module in self.model.named_modules() if is_conv2d(module)]\...
<|body_start_0|> self.model = ModelZoo().get_model(PipeStepConfig.model.model_desc, PipeStepConfig.model.pretrained_model_file) arch_params_key = '{}.out_channels' search_space = [dict(key=arch_params_key.format(name), type='HALF', range=[module.out_channels]) for name, module in self.model.name...
Prune SearchSpace.
PruneDAGSearchSpace
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PruneDAGSearchSpace: """Prune SearchSpace.""" def get_space(self, desc): """Get model and input.""" <|body_0|> def to_desc(self, desc): """Decode to model desc.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.model = ModelZoo().get_model(Pi...
stack_v2_sparse_classes_36k_train_022223
6,169
permissive
[ { "docstring": "Get model and input.", "name": "get_space", "signature": "def get_space(self, desc)" }, { "docstring": "Decode to model desc.", "name": "to_desc", "signature": "def to_desc(self, desc)" } ]
2
stack_v2_sparse_classes_30k_train_015470
Implement the Python class `PruneDAGSearchSpace` described below. Class description: Prune SearchSpace. Method signatures and docstrings: - def get_space(self, desc): Get model and input. - def to_desc(self, desc): Decode to model desc.
Implement the Python class `PruneDAGSearchSpace` described below. Class description: Prune SearchSpace. Method signatures and docstrings: - def get_space(self, desc): Get model and input. - def to_desc(self, desc): Decode to model desc. <|skeleton|> class PruneDAGSearchSpace: """Prune SearchSpace.""" def ge...
52b53582fe7df95d7aacc8425013fd18645d079f
<|skeleton|> class PruneDAGSearchSpace: """Prune SearchSpace.""" def get_space(self, desc): """Get model and input.""" <|body_0|> def to_desc(self, desc): """Decode to model desc.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PruneDAGSearchSpace: """Prune SearchSpace.""" def get_space(self, desc): """Get model and input.""" self.model = ModelZoo().get_model(PipeStepConfig.model.model_desc, PipeStepConfig.model.pretrained_model_file) arch_params_key = '{}.out_channels' search_space = [dict(key=a...
the_stack_v2_python_sparse
vega/algorithms/compression/prune_dag/prune_dag.py
yiziqi/vega
train
0
28873866299b8b300da3d047735ea065dbd4090b
[ "res = cipher\ntry:\n original_text_utf = cipher.encode('utf-8')\n pad_str = chr(1) * (8 - len(original_text_utf) % 8)\n encrypted = DESUtils._GENERATOR.encrypt(original_text_utf + pad_str.encode('utf-8'))\n print('明文: {}\\n密文: {}'.format(cipher, encrypted))\n res = encrypted\nexcept Exception as e:\...
<|body_start_0|> res = cipher try: original_text_utf = cipher.encode('utf-8') pad_str = chr(1) * (8 - len(original_text_utf) % 8) encrypted = DESUtils._GENERATOR.encrypt(original_text_utf + pad_str.encode('utf-8')) print('明文: {}\n密文: {}'.format(cipher, enc...
DESUtils
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DESUtils: def encrypt_des(cipher: str): """:param cipher: 原文 类型 str 方法内会转 utf-8 :return res: 密文 类型 bytes""" <|body_0|> def decrypt_des(encrypted: bytes): """:param encrypted: 密文 类型 bytes :return res: 明文 类型 str 以通过 utf-8 解码""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_022224
1,527
no_license
[ { "docstring": ":param cipher: 原文 类型 str 方法内会转 utf-8 :return res: 密文 类型 bytes", "name": "encrypt_des", "signature": "def encrypt_des(cipher: str)" }, { "docstring": ":param encrypted: 密文 类型 bytes :return res: 明文 类型 str 以通过 utf-8 解码", "name": "decrypt_des", "signature": "def decrypt_des(e...
2
stack_v2_sparse_classes_30k_train_008232
Implement the Python class `DESUtils` described below. Class description: Implement the DESUtils class. Method signatures and docstrings: - def encrypt_des(cipher: str): :param cipher: 原文 类型 str 方法内会转 utf-8 :return res: 密文 类型 bytes - def decrypt_des(encrypted: bytes): :param encrypted: 密文 类型 bytes :return res: 明文 类型 ...
Implement the Python class `DESUtils` described below. Class description: Implement the DESUtils class. Method signatures and docstrings: - def encrypt_des(cipher: str): :param cipher: 原文 类型 str 方法内会转 utf-8 :return res: 密文 类型 bytes - def decrypt_des(encrypted: bytes): :param encrypted: 密文 类型 bytes :return res: 明文 类型 ...
bd6cc35d1639868f5a5d465b5b78669081323ae8
<|skeleton|> class DESUtils: def encrypt_des(cipher: str): """:param cipher: 原文 类型 str 方法内会转 utf-8 :return res: 密文 类型 bytes""" <|body_0|> def decrypt_des(encrypted: bytes): """:param encrypted: 密文 类型 bytes :return res: 明文 类型 str 以通过 utf-8 解码""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DESUtils: def encrypt_des(cipher: str): """:param cipher: 原文 类型 str 方法内会转 utf-8 :return res: 密文 类型 bytes""" res = cipher try: original_text_utf = cipher.encode('utf-8') pad_str = chr(1) * (8 - len(original_text_utf) % 8) encrypted = DESUtils._GENERAT...
the_stack_v2_python_sparse
utils/encrypt_tool.py
EastTang/BlockChain
train
0
109a7f4b043dc9bb993cd3ba83c004b66adc1b9c
[ "plugin = NeighbourSelection()\nexpected = 'nearest'\nresult = plugin.neighbour_finding_method_name()\nself.assertEqual(result, expected)", "plugin = NeighbourSelection(land_constraint=True)\nexpected = 'nearest_land'\nresult = plugin.neighbour_finding_method_name()\nself.assertEqual(result, expected)", "plugin...
<|body_start_0|> plugin = NeighbourSelection() expected = 'nearest' result = plugin.neighbour_finding_method_name() self.assertEqual(result, expected) <|end_body_0|> <|body_start_1|> plugin = NeighbourSelection(land_constraint=True) expected = 'nearest_land' resu...
Test the function for generating the name that describes the neighbour finding method.
Test_neighbour_finding_method_name
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_neighbour_finding_method_name: """Test the function for generating the name that describes the neighbour finding method.""" def test_nearest(self): """Test name generated when using the default nearest neighbour method.""" <|body_0|> def test_nearest_land(self): ...
stack_v2_sparse_classes_36k_train_022225
40,371
permissive
[ { "docstring": "Test name generated when using the default nearest neighbour method.", "name": "test_nearest", "signature": "def test_nearest(self)" }, { "docstring": "Test name generated when using the nearest land neighbour method.", "name": "test_nearest_land", "signature": "def test_...
4
null
Implement the Python class `Test_neighbour_finding_method_name` described below. Class description: Test the function for generating the name that describes the neighbour finding method. Method signatures and docstrings: - def test_nearest(self): Test name generated when using the default nearest neighbour method. - ...
Implement the Python class `Test_neighbour_finding_method_name` described below. Class description: Test the function for generating the name that describes the neighbour finding method. Method signatures and docstrings: - def test_nearest(self): Test name generated when using the default nearest neighbour method. - ...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_neighbour_finding_method_name: """Test the function for generating the name that describes the neighbour finding method.""" def test_nearest(self): """Test name generated when using the default nearest neighbour method.""" <|body_0|> def test_nearest_land(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_neighbour_finding_method_name: """Test the function for generating the name that describes the neighbour finding method.""" def test_nearest(self): """Test name generated when using the default nearest neighbour method.""" plugin = NeighbourSelection() expected = 'nearest' ...
the_stack_v2_python_sparse
improver_tests/spotdata/test_NeighbourSelection.py
metoppv/improver
train
101
54a721536873271c1042882b8e0d69779100a6f2
[ "super().__init__()\nself.num_groups, remainder = divmod(num_features, 16)\nif remainder:\n self.num_groups = num_features // remainder\nself.num_features = num_features\nself.eps = eps\nself.weight = Parameter(torch.ones(1, self.num_groups, 1))\nself.bias = Parameter(torch.zeros(1, self.num_groups, 1))\nself.bn...
<|body_start_0|> super().__init__() self.num_groups, remainder = divmod(num_features, 16) if remainder: self.num_groups = num_features // remainder self.num_features = num_features self.eps = eps self.weight = Parameter(torch.ones(1, self.num_groups, 1)) ...
BCNorm
[ "MIT", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BCNorm: def __init__(self, num_features: int, eps: float=1e-07, estimate: bool=False) -> None: """Batch channel normalization. https://arxiv.org/abs/1911.09738 Infers the num_groups from the num_features to avoid errors. By default: uses 16 channels per group. If channels <= 16, squashes...
stack_v2_sparse_classes_36k_train_022226
1,946
permissive
[ { "docstring": "Batch channel normalization. https://arxiv.org/abs/1911.09738 Infers the num_groups from the num_features to avoid errors. By default: uses 16 channels per group. If channels <= 16, squashes to batch layer norm magic number 16 comes from the paper: https://arxiv.org/abs/1803.08494 Parameters ---...
2
null
Implement the Python class `BCNorm` described below. Class description: Implement the BCNorm class. Method signatures and docstrings: - def __init__(self, num_features: int, eps: float=1e-07, estimate: bool=False) -> None: Batch channel normalization. https://arxiv.org/abs/1911.09738 Infers the num_groups from the nu...
Implement the Python class `BCNorm` described below. Class description: Implement the BCNorm class. Method signatures and docstrings: - def __init__(self, num_features: int, eps: float=1e-07, estimate: bool=False) -> None: Batch channel normalization. https://arxiv.org/abs/1911.09738 Infers the num_groups from the nu...
7f79405012eb934b419bbdba8de23f35e840ca85
<|skeleton|> class BCNorm: def __init__(self, num_features: int, eps: float=1e-07, estimate: bool=False) -> None: """Batch channel normalization. https://arxiv.org/abs/1911.09738 Infers the num_groups from the num_features to avoid errors. By default: uses 16 channels per group. If channels <= 16, squashes...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BCNorm: def __init__(self, num_features: int, eps: float=1e-07, estimate: bool=False) -> None: """Batch channel normalization. https://arxiv.org/abs/1911.09738 Infers the num_groups from the num_features to avoid errors. By default: uses 16 channels per group. If channels <= 16, squashes to batch laye...
the_stack_v2_python_sparse
cellseg_models_pytorch/modules/norm/bcn.py
okunator/cellseg_models.pytorch
train
43
9e5d51eb69414a9ebe68e9fc2c5728c25fb53117
[ "if not security_services.is_superuser(user_id):\n user_permissions = security_services.get_user_permissions(user_id)\n user_permission_ids = [p.id for p in user_permissions]\n _permission_ids = permission_ids\n if not isinstance(permission_ids, (list, tuple, set)):\n _permission_ids = [permissio...
<|body_start_0|> if not security_services.is_superuser(user_id): user_permissions = security_services.get_user_permissions(user_id) user_permission_ids = [p.id for p in user_permissions] _permission_ids = permission_ids if not isinstance(permission_ids, (list, tup...
BaseAuthorizer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseAuthorizer: def authorize(self, user_id, permission_ids): """Authorizes user for permissions. @param user_id: user ID @param permission_ids: list of permission ID""" <|body_0|> def is_in_role(self, permission_ids, user_id=None): """Returns True if current user ha...
stack_v2_sparse_classes_36k_train_022227
1,912
no_license
[ { "docstring": "Authorizes user for permissions. @param user_id: user ID @param permission_ids: list of permission ID", "name": "authorize", "signature": "def authorize(self, user_id, permission_ids)" }, { "docstring": "Returns True if current user has permissions. @param permission_ids: list of...
2
stack_v2_sparse_classes_30k_train_012165
Implement the Python class `BaseAuthorizer` described below. Class description: Implement the BaseAuthorizer class. Method signatures and docstrings: - def authorize(self, user_id, permission_ids): Authorizes user for permissions. @param user_id: user ID @param permission_ids: list of permission ID - def is_in_role(s...
Implement the Python class `BaseAuthorizer` described below. Class description: Implement the BaseAuthorizer class. Method signatures and docstrings: - def authorize(self, user_id, permission_ids): Authorizes user for permissions. @param user_id: user ID @param permission_ids: list of permission ID - def is_in_role(s...
a2ee333d2a4fe9821f3d24ee15d458f226ffcde5
<|skeleton|> class BaseAuthorizer: def authorize(self, user_id, permission_ids): """Authorizes user for permissions. @param user_id: user ID @param permission_ids: list of permission ID""" <|body_0|> def is_in_role(self, permission_ids, user_id=None): """Returns True if current user ha...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseAuthorizer: def authorize(self, user_id, permission_ids): """Authorizes user for permissions. @param user_id: user ID @param permission_ids: list of permission ID""" if not security_services.is_superuser(user_id): user_permissions = security_services.get_user_permissions(user_i...
the_stack_v2_python_sparse
src/deltapy/security/authorization/authorizer.py
hamed1361554/sportmagazine-server
train
0
e1f2c067e1b18b0688adaa425b177c218225e8e7
[ "super(Bottleneck, self).__init__()\nself.in_channel = in_channel\nself.out_channel = out_channel\nself.depth = out_channel // 4\nself.stride = stride\nself.rate = rate\nif self.out_channel == self.in_channel:\n self.conv2d_shortcut = Subsample(self.stride)\nelse:\n self.conv2d_shortcut = nn.Conv2dBnAct(self....
<|body_start_0|> super(Bottleneck, self).__init__() self.in_channel = in_channel self.out_channel = out_channel self.depth = out_channel // 4 self.stride = stride self.rate = rate if self.out_channel == self.in_channel: self.conv2d_shortcut = Subsample...
Bottleneck residual unit variant with BN after convolutions.
Bottleneck
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bottleneck: """Bottleneck residual unit variant with BN after convolutions.""" def __init__(self, in_channel, out_channel, stride, rate=1): """Args: in_channel: in channel. out_channel: out channel. stride: The ResNet unit's stride. Determines the amount of downsampling of the units ...
stack_v2_sparse_classes_36k_train_022228
11,719
permissive
[ { "docstring": "Args: in_channel: in channel. out_channel: out channel. stride: The ResNet unit's stride. Determines the amount of downsampling of the units output compared to its input. rate: An integer, rate for atrous convolution.", "name": "__init__", "signature": "def __init__(self, in_channel, out...
2
null
Implement the Python class `Bottleneck` described below. Class description: Bottleneck residual unit variant with BN after convolutions. Method signatures and docstrings: - def __init__(self, in_channel, out_channel, stride, rate=1): Args: in_channel: in channel. out_channel: out channel. stride: The ResNet unit's st...
Implement the Python class `Bottleneck` described below. Class description: Bottleneck residual unit variant with BN after convolutions. Method signatures and docstrings: - def __init__(self, in_channel, out_channel, stride, rate=1): Args: in_channel: in channel. out_channel: out channel. stride: The ResNet unit's st...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class Bottleneck: """Bottleneck residual unit variant with BN after convolutions.""" def __init__(self, in_channel, out_channel, stride, rate=1): """Args: in_channel: in channel. out_channel: out channel. stride: The ResNet unit's stride. Determines the amount of downsampling of the units ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Bottleneck: """Bottleneck residual unit variant with BN after convolutions.""" def __init__(self, in_channel, out_channel, stride, rate=1): """Args: in_channel: in channel. out_channel: out channel. stride: The ResNet unit's stride. Determines the amount of downsampling of the units output compar...
the_stack_v2_python_sparse
research/cv/ArtTrack/src/model/resnet/resnet.py
mindspore-ai/models
train
301
c81d2666a954b0bb499770c184ac5f040680e3da
[ "self.size = 0\nself.capacity = capacity\nself.cache = {}\nself.stack = []", "if key in self.cache:\n index = -1\n for k in range(0, len(self.stack)):\n if self.stack[k] == key:\n index = k\n break\n if index != -1:\n self.stack.pop(index)\n self.stack.append(key)\n...
<|body_start_0|> self.size = 0 self.capacity = capacity self.cache = {} self.stack = [] <|end_body_0|> <|body_start_1|> if key in self.cache: index = -1 for k in range(0, len(self.stack)): if self.stack[k] == key: index...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_022229
2,806
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: None", "name": "pu...
3
null
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None <|sk...
7bef356ff61b37b30338ac5d448b76817395c10c
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.size = 0 self.capacity = capacity self.cache = {} self.stack = [] def get(self, key): """:type key: int :rtype: int""" if key in self.cache: index = -1 fo...
the_stack_v2_python_sparse
Design/146. LRU Cache.py
jojojoseph94/leetcode-problems
train
0
c0acda14a12e79a16a966dae7b96024e903e6587
[ "self.filename = filename\nself.on_error = on_error\nif allrevisions:\n self._parse = self._parse_all\nelse:\n self._parse = self._parse_only_latest", "with open_archive(self.filename) as source:\n context = iterparse(source, events=('start', 'end', 'start-ns'))\n self.root = None\n while True:\n ...
<|body_start_0|> self.filename = filename self.on_error = on_error if allrevisions: self._parse = self._parse_all else: self._parse = self._parse_only_latest <|end_body_0|> <|body_start_1|> with open_archive(self.filename) as source: context =...
Represents an XML dump file. Reads the local file at initialization, parses it, and offers access to the resulting XmlEntries via a generator. .. versionadded:: 7.2 the `on_error` parameter .. versionchanged:: 7.2 `allrevisions` parameter must be given as keyword parameter Usage example: >>> from pywikibot import xmlre...
XmlDump
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XmlDump: """Represents an XML dump file. Reads the local file at initialization, parses it, and offers access to the resulting XmlEntries via a generator. .. versionadded:: 7.2 the `on_error` parameter .. versionchanged:: 7.2 `allrevisions` parameter must be given as keyword parameter Usage examp...
stack_v2_sparse_classes_36k_train_022230
7,163
permissive
[ { "docstring": "Initializer.", "name": "__init__", "signature": "def __init__(self, filename, *, allrevisions: bool=False, on_error: Optional[Callable[[Type[BaseException]], None]]=None) -> None" }, { "docstring": "Generator using ElementTree iterparse function. .. versionchanged:: 7.2 if a Pars...
6
null
Implement the Python class `XmlDump` described below. Class description: Represents an XML dump file. Reads the local file at initialization, parses it, and offers access to the resulting XmlEntries via a generator. .. versionadded:: 7.2 the `on_error` parameter .. versionchanged:: 7.2 `allrevisions` parameter must be...
Implement the Python class `XmlDump` described below. Class description: Represents an XML dump file. Reads the local file at initialization, parses it, and offers access to the resulting XmlEntries via a generator. .. versionadded:: 7.2 the `on_error` parameter .. versionchanged:: 7.2 `allrevisions` parameter must be...
5c01e6bfcd328bc6eae643e661f1a0ae57612808
<|skeleton|> class XmlDump: """Represents an XML dump file. Reads the local file at initialization, parses it, and offers access to the resulting XmlEntries via a generator. .. versionadded:: 7.2 the `on_error` parameter .. versionchanged:: 7.2 `allrevisions` parameter must be given as keyword parameter Usage examp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XmlDump: """Represents an XML dump file. Reads the local file at initialization, parses it, and offers access to the resulting XmlEntries via a generator. .. versionadded:: 7.2 the `on_error` parameter .. versionchanged:: 7.2 `allrevisions` parameter must be given as keyword parameter Usage example: >>> from ...
the_stack_v2_python_sparse
pywikibot/xmlreader.py
wikimedia/pywikibot
train
432
ee6475f54db8beec0ada304b22068b11ad606c88
[ "ui_projects = UIProject.objects.filter(id=ui_project_id)\ndata_list = []\nfor ui_project in ui_projects:\n ui_project_dict = {'ui_project_name': ui_project.ui_project_name, 'isParent': True}\n ui_case_list = []\n ui_test_case = UITestCase.objects.filter(ui_project_id=ui_project.id)\n for ui_test_cases ...
<|body_start_0|> ui_projects = UIProject.objects.filter(id=ui_project_id) data_list = [] for ui_project in ui_projects: ui_project_dict = {'ui_project_name': ui_project.ui_project_name, 'isParent': True} ui_case_list = [] ui_test_case = UITestCase.objects.filt...
GetUiCaseTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetUiCaseTree: def get(self, request, ui_project_id, *args, **kwargs): """获取UI测试用例树形结构 :param request: :param ui_project_id: ui项目id :param args: :param kwargs: :return:""" <|body_0|> def post(self, request, ui_test_task_id, *args, **kwargs): """修改UI用例树形结构 :param requ...
stack_v2_sparse_classes_36k_train_022231
13,627
no_license
[ { "docstring": "获取UI测试用例树形结构 :param request: :param ui_project_id: ui项目id :param args: :param kwargs: :return:", "name": "get", "signature": "def get(self, request, ui_project_id, *args, **kwargs)" }, { "docstring": "修改UI用例树形结构 :param request: :param ui_test_task_id: ui任务id :param args: :param k...
2
null
Implement the Python class `GetUiCaseTree` described below. Class description: Implement the GetUiCaseTree class. Method signatures and docstrings: - def get(self, request, ui_project_id, *args, **kwargs): 获取UI测试用例树形结构 :param request: :param ui_project_id: ui项目id :param args: :param kwargs: :return: - def post(self, ...
Implement the Python class `GetUiCaseTree` described below. Class description: Implement the GetUiCaseTree class. Method signatures and docstrings: - def get(self, request, ui_project_id, *args, **kwargs): 获取UI测试用例树形结构 :param request: :param ui_project_id: ui项目id :param args: :param kwargs: :return: - def post(self, ...
730bbb7a048e0f41a2fb61c8cdf554bcc2bd042c
<|skeleton|> class GetUiCaseTree: def get(self, request, ui_project_id, *args, **kwargs): """获取UI测试用例树形结构 :param request: :param ui_project_id: ui项目id :param args: :param kwargs: :return:""" <|body_0|> def post(self, request, ui_test_task_id, *args, **kwargs): """修改UI用例树形结构 :param requ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetUiCaseTree: def get(self, request, ui_project_id, *args, **kwargs): """获取UI测试用例树形结构 :param request: :param ui_project_id: ui项目id :param args: :param kwargs: :return:""" ui_projects = UIProject.objects.filter(id=ui_project_id) data_list = [] for ui_project in ui_projects: ...
the_stack_v2_python_sparse
automated_main/view/ui_automation/ui_test_task/ui_test_task_view.py
a877429929/TestPlatformDjango
train
0
5f519e7db1a54688c1ea312b26a86f4287651141
[ "if not value:\n return []\nreturn [name.strip() for name in value.split(',')]", "super(DatabaseListField, self).validate(value)\nfor db_name in value:\n self.validate_mssql_identifier(db_name)" ]
<|body_start_0|> if not value: return [] return [name.strip() for name in value.split(',')] <|end_body_0|> <|body_start_1|> super(DatabaseListField, self).validate(value) for db_name in value: self.validate_mssql_identifier(db_name) <|end_body_1|>
DatabaseListField
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatabaseListField: def to_python(self, value): """Normalize data to a list of strings.""" <|body_0|> def validate(self, value): """Check if value consists only of valid names.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not value: ...
stack_v2_sparse_classes_36k_train_022232
30,278
permissive
[ { "docstring": "Normalize data to a list of strings.", "name": "to_python", "signature": "def to_python(self, value)" }, { "docstring": "Check if value consists only of valid names.", "name": "validate", "signature": "def validate(self, value)" } ]
2
null
Implement the Python class `DatabaseListField` described below. Class description: Implement the DatabaseListField class. Method signatures and docstrings: - def to_python(self, value): Normalize data to a list of strings. - def validate(self, value): Check if value consists only of valid names.
Implement the Python class `DatabaseListField` described below. Class description: Implement the DatabaseListField class. Method signatures and docstrings: - def to_python(self, value): Normalize data to a list of strings. - def validate(self, value): Check if value consists only of valid names. <|skeleton|> class D...
54e2ea8a71385b1c7624b3d2c8056bd8a2c2e2f7
<|skeleton|> class DatabaseListField: def to_python(self, value): """Normalize data to a list of strings.""" <|body_0|> def validate(self, value): """Check if value consists only of valid names.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatabaseListField: def to_python(self, value): """Normalize data to a list of strings.""" if not value: return [] return [name.strip() for name in value.split(',')] def validate(self, value): """Check if value consists only of valid names.""" super(Data...
the_stack_v2_python_sparse
muranodashboard/dynamic_ui/fields.py
openstack/murano-dashboard
train
38
b575dfaa4f025268bd7bbc66addcbb406b60f1b9
[ "l1_val = self.node2num(l1)\nl2_val = self.node2num(l2)\ntotal_val = l1_val + l2_val\nreturn self.num2node(total_val)", "num = ''\np = string_nodes\nwhile p != None:\n num += str(p.val)\n p = p.next\nreturn int(num)", "num = str(num)\ni = ListNode(int(num[0]))\nhead = i\nfor c in num[1:]:\n j = ListNod...
<|body_start_0|> l1_val = self.node2num(l1) l2_val = self.node2num(l2) total_val = l1_val + l2_val return self.num2node(total_val) <|end_body_0|> <|body_start_1|> num = '' p = string_nodes while p != None: num += str(p.val) p = p.next ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addTwoNumbers(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def node2num(self, string_nodes): """:param string_nodes: ListNode :return:""" <|body_1|> def num2node(self, num): """:param num: i...
stack_v2_sparse_classes_36k_train_022233
1,311
no_license
[ { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "addTwoNumbers", "signature": "def addTwoNumbers(self, l1, l2)" }, { "docstring": ":param string_nodes: ListNode :return:", "name": "node2num", "signature": "def node2num(self, string_nodes)" }, { "d...
3
stack_v2_sparse_classes_30k_train_005437
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addTwoNumbers(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def node2num(self, string_nodes): :param string_nodes: ListNode :return: - def num2node(...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addTwoNumbers(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def node2num(self, string_nodes): :param string_nodes: ListNode :return: - def num2node(...
06ccb31f5ab700c14649f75c1d82ee27b61f3a29
<|skeleton|> class Solution: def addTwoNumbers(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def node2num(self, string_nodes): """:param string_nodes: ListNode :return:""" <|body_1|> def num2node(self, num): """:param num: i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def addTwoNumbers(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" l1_val = self.node2num(l1) l2_val = self.node2num(l2) total_val = l1_val + l2_val return self.num2node(total_val) def node2num(self, string_nodes): """:p...
the_stack_v2_python_sparse
add_two_numbers_2.py
ryh95/PyLeetcode
train
1
f2518582f76eccf5de27171fd07b9106130dac1b
[ "user = super(AdminUserForm, self).save(commit=False)\nuser.is_admin = True\npassword = self.cleaned_data['password']\nif password:\n user.set_password(password)\nif commit:\n user.save()\n user.groups = self.cleaned_data['groups']\nreturn user", "cleaned_data = super(AdminUserForm, self).clean()\npasswo...
<|body_start_0|> user = super(AdminUserForm, self).save(commit=False) user.is_admin = True password = self.cleaned_data['password'] if password: user.set_password(password) if commit: user.save() user.groups = self.cleaned_data['groups'] ...
Form for ADD and EDIT ADMIN USERS
AdminUserForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdminUserForm: """Form for ADD and EDIT ADMIN USERS""" def save(self, commit=True): """Extra processing: Set additional default values for new users :return: Dictionary""" <|body_0|> def clean(self): """Extra validation for fields that depends on other fields :re...
stack_v2_sparse_classes_36k_train_022234
3,229
no_license
[ { "docstring": "Extra processing: Set additional default values for new users :return: Dictionary", "name": "save", "signature": "def save(self, commit=True)" }, { "docstring": "Extra validation for fields that depends on other fields :return: Dictionary", "name": "clean", "signature": "...
2
stack_v2_sparse_classes_30k_train_021306
Implement the Python class `AdminUserForm` described below. Class description: Form for ADD and EDIT ADMIN USERS Method signatures and docstrings: - def save(self, commit=True): Extra processing: Set additional default values for new users :return: Dictionary - def clean(self): Extra validation for fields that depend...
Implement the Python class `AdminUserForm` described below. Class description: Form for ADD and EDIT ADMIN USERS Method signatures and docstrings: - def save(self, commit=True): Extra processing: Set additional default values for new users :return: Dictionary - def clean(self): Extra validation for fields that depend...
26323d5bc650589123811d505ecef8f9f2d9d962
<|skeleton|> class AdminUserForm: """Form for ADD and EDIT ADMIN USERS""" def save(self, commit=True): """Extra processing: Set additional default values for new users :return: Dictionary""" <|body_0|> def clean(self): """Extra validation for fields that depends on other fields :re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdminUserForm: """Form for ADD and EDIT ADMIN USERS""" def save(self, commit=True): """Extra processing: Set additional default values for new users :return: Dictionary""" user = super(AdminUserForm, self).save(commit=False) user.is_admin = True password = self.cleaned_dat...
the_stack_v2_python_sparse
django/vron/core/admin/forms.py
peterwoody/vron
train
0
e7adb7f8edc8346ad656326dcb8c75350924576b
[ "if hasattr(file, 'write'):\n file_ctx = nullcontext(file)\nelse:\n file_ctx = open(file, 'w')\nwith file_ctx as fp:\n for d in self:\n json.dump(d.dict(), fp)\n fp.write('\\n')", "if hasattr(file, 'read'):\n file_ctx = nullcontext(file)\nelse:\n file_ctx = open(file)\nfrom ....docume...
<|body_start_0|> if hasattr(file, 'write'): file_ctx = nullcontext(file) else: file_ctx = open(file, 'w') with file_ctx as fp: for d in self: json.dump(d.dict(), fp) fp.write('\n') <|end_body_0|> <|body_start_1|> if has...
Save/load a array into a JSON file.
JsonIOMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JsonIOMixin: """Save/load a array into a JSON file.""" def save_json(self, file: Union[str, TextIO]) -> None: """Save array elements into a JSON file. Comparing to :meth:`save_binary`, it is human-readable but slower to save/load and the file size larger. :param file: File or filenam...
stack_v2_sparse_classes_36k_train_022235
1,417
permissive
[ { "docstring": "Save array elements into a JSON file. Comparing to :meth:`save_binary`, it is human-readable but slower to save/load and the file size larger. :param file: File or filename to which the data is saved.", "name": "save_json", "signature": "def save_json(self, file: Union[str, TextIO]) -> N...
2
stack_v2_sparse_classes_30k_train_018474
Implement the Python class `JsonIOMixin` described below. Class description: Save/load a array into a JSON file. Method signatures and docstrings: - def save_json(self, file: Union[str, TextIO]) -> None: Save array elements into a JSON file. Comparing to :meth:`save_binary`, it is human-readable but slower to save/lo...
Implement the Python class `JsonIOMixin` described below. Class description: Save/load a array into a JSON file. Method signatures and docstrings: - def save_json(self, file: Union[str, TextIO]) -> None: Save array elements into a JSON file. Comparing to :meth:`save_binary`, it is human-readable but slower to save/lo...
34c34acfb0115ad2ec4cc8e2e9a86c521855612f
<|skeleton|> class JsonIOMixin: """Save/load a array into a JSON file.""" def save_json(self, file: Union[str, TextIO]) -> None: """Save array elements into a JSON file. Comparing to :meth:`save_binary`, it is human-readable but slower to save/load and the file size larger. :param file: File or filenam...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JsonIOMixin: """Save/load a array into a JSON file.""" def save_json(self, file: Union[str, TextIO]) -> None: """Save array elements into a JSON file. Comparing to :meth:`save_binary`, it is human-readable but slower to save/load and the file size larger. :param file: File or filename to which th...
the_stack_v2_python_sparse
jina/types/arrays/mixins/io/json.py
amitesh1as/jina
train
0
b29c492a5833cbb30ba4247a872c518d9727e25a
[ "data = {'args': (data.pop('name'),)}\nmethod = rebalance.status\nreturn await self.middleware.call('gluster.method.run', method, data)", "data = {'args': (data.pop('name'),)}\nmethod = rebalance.fix_layout_start\nreturn await self.middleware.call('gluster.method.run', method, data)", "options = {'args': (data....
<|body_start_0|> data = {'args': (data.pop('name'),)} method = rebalance.status return await self.middleware.call('gluster.method.run', method, data) <|end_body_0|> <|body_start_1|> data = {'args': (data.pop('name'),)} method = rebalance.fix_layout_start return await sel...
GlusterRebalanceService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GlusterRebalanceService: async def status(self, job, data): """Return the status of a rebalance operation for a given gluster volume. `name` String representing the gluster volume.""" <|body_0|> async def fix_layout(self, job, data): """Start a fix-layout operation f...
stack_v2_sparse_classes_36k_train_022236
2,514
no_license
[ { "docstring": "Return the status of a rebalance operation for a given gluster volume. `name` String representing the gluster volume.", "name": "status", "signature": "async def status(self, job, data)" }, { "docstring": "Start a fix-layout operation for a given gluster volume. `name` String rep...
4
stack_v2_sparse_classes_30k_train_012177
Implement the Python class `GlusterRebalanceService` described below. Class description: Implement the GlusterRebalanceService class. Method signatures and docstrings: - async def status(self, job, data): Return the status of a rebalance operation for a given gluster volume. `name` String representing the gluster vol...
Implement the Python class `GlusterRebalanceService` described below. Class description: Implement the GlusterRebalanceService class. Method signatures and docstrings: - async def status(self, job, data): Return the status of a rebalance operation for a given gluster volume. `name` String representing the gluster vol...
7404f896226978409291d48c4dc723ed34f21329
<|skeleton|> class GlusterRebalanceService: async def status(self, job, data): """Return the status of a rebalance operation for a given gluster volume. `name` String representing the gluster volume.""" <|body_0|> async def fix_layout(self, job, data): """Start a fix-layout operation f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GlusterRebalanceService: async def status(self, job, data): """Return the status of a rebalance operation for a given gluster volume. `name` String representing the gluster volume.""" data = {'args': (data.pop('name'),)} method = rebalance.status return await self.middleware.ca...
the_stack_v2_python_sparse
src/middlewared/middlewared/plugins/gluster_linux/rebalance.py
haoshao/freenas
train
1
b9b9c89c7b6bebe0f9a65395b49ce93366956486
[ "file_offset = file_object.tell()\nif format_version == 1:\n data_type_map = self._GetDataTypeMap('recycle_bin_metadata_utf16le_string')\nelse:\n data_type_map = self._GetDataTypeMap('recycle_bin_metadata_utf16le_string_with_size')\ntry:\n original_filename, _ = self._ReadStructureFromFileObject(file_objec...
<|body_start_0|> file_offset = file_object.tell() if format_version == 1: data_type_map = self._GetDataTypeMap('recycle_bin_metadata_utf16le_string') else: data_type_map = self._GetDataTypeMap('recycle_bin_metadata_utf16le_string_with_size') try: origi...
Parses the Windows $Recycle.Bin $I files.
WinRecycleBinParser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WinRecycleBinParser: """Parses the Windows $Recycle.Bin $I files.""" def _ParseOriginalFilename(self, file_object, format_version): """Parses the original filename. Args: file_object (FileIO): file-like object. format_version (int): format version. Returns: str: filename or None on e...
stack_v2_sparse_classes_36k_train_022237
9,268
permissive
[ { "docstring": "Parses the original filename. Args: file_object (FileIO): file-like object. format_version (int): format version. Returns: str: filename or None on error. Raises: ParseError: if the original filename cannot be read.", "name": "_ParseOriginalFilename", "signature": "def _ParseOriginalFile...
2
stack_v2_sparse_classes_30k_train_020155
Implement the Python class `WinRecycleBinParser` described below. Class description: Parses the Windows $Recycle.Bin $I files. Method signatures and docstrings: - def _ParseOriginalFilename(self, file_object, format_version): Parses the original filename. Args: file_object (FileIO): file-like object. format_version (...
Implement the Python class `WinRecycleBinParser` described below. Class description: Parses the Windows $Recycle.Bin $I files. Method signatures and docstrings: - def _ParseOriginalFilename(self, file_object, format_version): Parses the original filename. Args: file_object (FileIO): file-like object. format_version (...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class WinRecycleBinParser: """Parses the Windows $Recycle.Bin $I files.""" def _ParseOriginalFilename(self, file_object, format_version): """Parses the original filename. Args: file_object (FileIO): file-like object. format_version (int): format version. Returns: str: filename or None on e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WinRecycleBinParser: """Parses the Windows $Recycle.Bin $I files.""" def _ParseOriginalFilename(self, file_object, format_version): """Parses the original filename. Args: file_object (FileIO): file-like object. format_version (int): format version. Returns: str: filename or None on error. Raises:...
the_stack_v2_python_sparse
plaso/parsers/recycler.py
log2timeline/plaso
train
1,506
3e67135375e8e9ffc5c02e10c0562c42049e6251
[ "user = request.user\naddress = Address.objects.get_default_address(user)\nreturn render(request, 'user_center_site.html', {'page': 'address', 'address': address})", "receiver = request.POST.get('receiver')\naddr = request.POST.get('addr')\nzip_code = request.POST.get('zip_code')\nphone = request.POST.get('phone'...
<|body_start_0|> user = request.user address = Address.objects.get_default_address(user) return render(request, 'user_center_site.html', {'page': 'address', 'address': address}) <|end_body_0|> <|body_start_1|> receiver = request.POST.get('receiver') addr = request.POST.get('addr...
用户中心-地址页
AddressView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddressView: """用户中心-地址页""" def get(self, request): """显示""" <|body_0|> def post(self, request): """地址的添加""" <|body_1|> <|end_skeleton|> <|body_start_0|> user = request.user address = Address.objects.get_default_address(user) ret...
stack_v2_sparse_classes_36k_train_022238
11,775
no_license
[ { "docstring": "显示", "name": "get", "signature": "def get(self, request)" }, { "docstring": "地址的添加", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_010563
Implement the Python class `AddressView` described below. Class description: 用户中心-地址页 Method signatures and docstrings: - def get(self, request): 显示 - def post(self, request): 地址的添加
Implement the Python class `AddressView` described below. Class description: 用户中心-地址页 Method signatures and docstrings: - def get(self, request): 显示 - def post(self, request): 地址的添加 <|skeleton|> class AddressView: """用户中心-地址页""" def get(self, request): """显示""" <|body_0|> def post(self,...
91293b05eb28697f5dec7f99a0f608904f6a0b1f
<|skeleton|> class AddressView: """用户中心-地址页""" def get(self, request): """显示""" <|body_0|> def post(self, request): """地址的添加""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AddressView: """用户中心-地址页""" def get(self, request): """显示""" user = request.user address = Address.objects.get_default_address(user) return render(request, 'user_center_site.html', {'page': 'address', 'address': address}) def post(self, request): """地址的添加""" ...
the_stack_v2_python_sparse
dailyfresh/apps/user/views.py
IronmanJay/Python_Project
train
15
4245b8dd090b10c23e3a190e16d04a677ffff113
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
UpdateStream is the RPC version of binlog.UpdateStream.
UpdateStreamServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateStreamServicer: """UpdateStream is the RPC version of binlog.UpdateStream.""" def StreamKeyRange(self, request, context): """StreamKeyRange returns the binlog transactions related to the specified Keyrange.""" <|body_0|> def StreamTables(self, request, context): ...
stack_v2_sparse_classes_36k_train_022239
2,389
permissive
[ { "docstring": "StreamKeyRange returns the binlog transactions related to the specified Keyrange.", "name": "StreamKeyRange", "signature": "def StreamKeyRange(self, request, context)" }, { "docstring": "StreamTables returns the binlog transactions related to the specified Tables.", "name": "...
2
stack_v2_sparse_classes_30k_train_017120
Implement the Python class `UpdateStreamServicer` described below. Class description: UpdateStream is the RPC version of binlog.UpdateStream. Method signatures and docstrings: - def StreamKeyRange(self, request, context): StreamKeyRange returns the binlog transactions related to the specified Keyrange. - def StreamTa...
Implement the Python class `UpdateStreamServicer` described below. Class description: UpdateStream is the RPC version of binlog.UpdateStream. Method signatures and docstrings: - def StreamKeyRange(self, request, context): StreamKeyRange returns the binlog transactions related to the specified Keyrange. - def StreamTa...
c873c58fc95bc1b322d788bdb32f2305780cbcfd
<|skeleton|> class UpdateStreamServicer: """UpdateStream is the RPC version of binlog.UpdateStream.""" def StreamKeyRange(self, request, context): """StreamKeyRange returns the binlog transactions related to the specified Keyrange.""" <|body_0|> def StreamTables(self, request, context): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateStreamServicer: """UpdateStream is the RPC version of binlog.UpdateStream.""" def StreamKeyRange(self, request, context): """StreamKeyRange returns the binlog transactions related to the specified Keyrange.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_detai...
the_stack_v2_python_sparse
py/vtproto/binlogservice_pb2_grpc.py
HubSpot/vitess
train
7
4b23fd5f28b07117592e4c1ff78c0161f6094be4
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\ntry:\n mapping_value = parse_node.get_child_node('@odata.type').get_str_value()\nexcept AttributeError:\n mapping_value = None\nif mapping_value and mapping_value.casefold() == '#microsoft.graph.activityBasedTimeoutPolicy'.casefold():\n ...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') try: mapping_value = parse_node.get_child_node('@odata.type').get_str_value() except AttributeError: mapping_value = None if mapping_value and mapping_value.casefold() ==...
StsPolicy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StsPolicy: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> StsPolicy: """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: StsPol...
stack_v2_sparse_classes_36k_train_022240
5,376
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: StsPolicy", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(par...
3
null
Implement the Python class `StsPolicy` described below. Class description: Implement the StsPolicy class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> StsPolicy: Creates a new instance of the appropriate class based on discriminator value Args: parse...
Implement the Python class `StsPolicy` described below. Class description: Implement the StsPolicy class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> StsPolicy: Creates a new instance of the appropriate class based on discriminator value Args: parse...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class StsPolicy: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> StsPolicy: """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: StsPol...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StsPolicy: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> StsPolicy: """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: StsPolicy""" ...
the_stack_v2_python_sparse
msgraph/generated/models/sts_policy.py
microsoftgraph/msgraph-sdk-python
train
135
508379a6da7d28af15ed0f1d661a0c6490d125e9
[ "if table == self.USERTABLE:\n query = sql.SQL('SELECT {fields} from {table} where {pkey} = %s;').format(fields=sql.SQL(',').join([sql.Identifier('uid'), sql.Identifier('email'), sql.Identifier('display_name'), sql.Identifier('type'), sql.Identifier('roleid'), sql.Identifier('roleissuer')]), table=sql.Identifier...
<|body_start_0|> if table == self.USERTABLE: query = sql.SQL('SELECT {fields} from {table} where {pkey} = %s;').format(fields=sql.SQL(',').join([sql.Identifier('uid'), sql.Identifier('email'), sql.Identifier('display_name'), sql.Identifier('type'), sql.Identifier('roleid'), sql.Identifier('roleissue...
AuditDAO
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuditDAO: def getTableValueByIntID(self, table, pkeyname, pkeyval, cursor): """Get all values on a given table with a given primary key. TO BE USED INTERNALLY ONLY. :param table: string representing the table name. :param pkeyname: string identifying the primary key's column name. :param...
stack_v2_sparse_classes_36k_train_022241
4,281
no_license
[ { "docstring": "Get all values on a given table with a given primary key. TO BE USED INTERNALLY ONLY. :param table: string representing the table name. :param pkeyname: string identifying the primary key's column name. :param pkeyval: representing the primary key's value. :param cursor: psycopg2 connection curs...
3
stack_v2_sparse_classes_30k_val_000484
Implement the Python class `AuditDAO` described below. Class description: Implement the AuditDAO class. Method signatures and docstrings: - def getTableValueByIntID(self, table, pkeyname, pkeyval, cursor): Get all values on a given table with a given primary key. TO BE USED INTERNALLY ONLY. :param table: string repre...
Implement the Python class `AuditDAO` described below. Class description: Implement the AuditDAO class. Method signatures and docstrings: - def getTableValueByIntID(self, table, pkeyname, pkeyval, cursor): Get all values on a given table with a given primary key. TO BE USED INTERNALLY ONLY. :param table: string repre...
24e1e25d2e512105c9bf70b5e33b1afed4790f71
<|skeleton|> class AuditDAO: def getTableValueByIntID(self, table, pkeyname, pkeyval, cursor): """Get all values on a given table with a given primary key. TO BE USED INTERNALLY ONLY. :param table: string representing the table name. :param pkeyname: string identifying the primary key's column name. :param...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuditDAO: def getTableValueByIntID(self, table, pkeyname, pkeyval, cursor): """Get all values on a given table with a given primary key. TO BE USED INTERNALLY ONLY. :param table: string representing the table name. :param pkeyname: string identifying the primary key's column name. :param pkeyval: repr...
the_stack_v2_python_sparse
flask/app/DAOs/AuditDAO.py
InTheNou/InTheNou-Backend
train
0
b219452a72cc74876124d76ca356e7c5fdb35992
[ "self._inset = inset\nself._term_width = (maxwidth or get_terminal_size()[0]) - inset * 4\nself._items: List[Tuple[str, str]] = []\nself._max_name_width = 0\nself._max_value_width = 0", "self._items.extend(item_list)\nfor name, value in item_list:\n self._max_name_width = max(self._max_name_width, len(name))\n...
<|body_start_0|> self._inset = inset self._term_width = (maxwidth or get_terminal_size()[0]) - inset * 4 self._items: List[Tuple[str, str]] = [] self._max_name_width = 0 self._max_value_width = 0 <|end_body_0|> <|body_start_1|> self._items.extend(item_list) for n...
@brief Formats a set of values in multiple columns. The value_list must be a list of bi-tuples (name, value) sorted in the desired display order. The number of columns will be determined by the terminal width and maximum value width. The values will be printed in column major order.
ColumnFormatter
[ "CC-BY-4.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ColumnFormatter: """@brief Formats a set of values in multiple columns. The value_list must be a list of bi-tuples (name, value) sorted in the desired display order. The number of columns will be determined by the terminal width and maximum value width. The values will be printed in column major ...
stack_v2_sparse_classes_36k_train_022242
3,831
permissive
[ { "docstring": "@brief Constructor. @param self The object. @param maxwidth Number of characters to which the output width must be constrained. If not provided, then the width of the stdout terminal is used. If getting the terminal width fails, for instance if stdout is not a terminal, then a default of 80 char...
4
stack_v2_sparse_classes_30k_train_009641
Implement the Python class `ColumnFormatter` described below. Class description: @brief Formats a set of values in multiple columns. The value_list must be a list of bi-tuples (name, value) sorted in the desired display order. The number of columns will be determined by the terminal width and maximum value width. The ...
Implement the Python class `ColumnFormatter` described below. Class description: @brief Formats a set of values in multiple columns. The value_list must be a list of bi-tuples (name, value) sorted in the desired display order. The number of columns will be determined by the terminal width and maximum value width. The ...
9253740baf46ebf4eacbce6bf3369150c5fb8ee0
<|skeleton|> class ColumnFormatter: """@brief Formats a set of values in multiple columns. The value_list must be a list of bi-tuples (name, value) sorted in the desired display order. The number of columns will be determined by the terminal width and maximum value width. The values will be printed in column major ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ColumnFormatter: """@brief Formats a set of values in multiple columns. The value_list must be a list of bi-tuples (name, value) sorted in the desired display order. The number of columns will be determined by the terminal width and maximum value width. The values will be printed in column major order.""" ...
the_stack_v2_python_sparse
pyocd/utility/columns.py
pyocd/pyOCD
train
507
f2df48ce47531d9055a8ab64fc92149a9468b80e
[ "self.a = a\nself.b = b\nself.X = [random.randint(0, mx) for _ in range(3)]\nself.Y = [random.randint(0, my) for _ in range(3)]\nsuper().__init__(ContinuousSpace(a, b, open_brackets=False))", "a = self.a\nb = self.b\nreturn (a + b) / 2", "a = self.a\nb = self.b\nreturn (a - b) ** 2 / 12", "a = self.a\nb = sel...
<|body_start_0|> self.a = a self.b = b self.X = [random.randint(0, mx) for _ in range(3)] self.Y = [random.randint(0, my) for _ in range(3)] super().__init__(ContinuousSpace(a, b, open_brackets=False)) <|end_body_0|> <|body_start_1|> a = self.a b = self.b ...
Simple uniform distribution.
UniformDist
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UniformDist: """Simple uniform distribution.""" def __init__(self, a=0, b=1): """Create U(a, b) distribution. :param a The left boundary of the interval. :param b The right boundary of the interval.""" <|body_0|> def expectation(self): """Calculates the expectati...
stack_v2_sparse_classes_36k_train_022243
2,448
permissive
[ { "docstring": "Create U(a, b) distribution. :param a The left boundary of the interval. :param b The right boundary of the interval.", "name": "__init__", "signature": "def __init__(self, a=0, b=1)" }, { "docstring": "Calculates the expectations for that distribution. :returns The expectation o...
5
stack_v2_sparse_classes_30k_train_014269
Implement the Python class `UniformDist` described below. Class description: Simple uniform distribution. Method signatures and docstrings: - def __init__(self, a=0, b=1): Create U(a, b) distribution. :param a The left boundary of the interval. :param b The right boundary of the interval. - def expectation(self): Cal...
Implement the Python class `UniformDist` described below. Class description: Simple uniform distribution. Method signatures and docstrings: - def __init__(self, a=0, b=1): Create U(a, b) distribution. :param a The left boundary of the interval. :param b The right boundary of the interval. - def expectation(self): Cal...
4c854e90bfd4acaa511c1786c96f0610d7aea037
<|skeleton|> class UniformDist: """Simple uniform distribution.""" def __init__(self, a=0, b=1): """Create U(a, b) distribution. :param a The left boundary of the interval. :param b The right boundary of the interval.""" <|body_0|> def expectation(self): """Calculates the expectati...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UniformDist: """Simple uniform distribution.""" def __init__(self, a=0, b=1): """Create U(a, b) distribution. :param a The left boundary of the interval. :param b The right boundary of the interval.""" self.a = a self.b = b self.X = [random.randint(0, mx) for _ in range(3)...
the_stack_v2_python_sparse
src/continuous/uniform.py
kosmitive/univariate-distributions
train
0
64b0aebde2ea7ccd7d7b8f27c4d2f4fd4c260da4
[ "super().__init__(rundate=rundate, time=time, satellite=satellite, system=system)\nself.file_key = file_key\nself.day_offset = day_offset\nself.sat_name = satellite\nself.file_path = file_path", "date_to_read = rundate + timedelta(days=self.day_offset)\nfile_vars = config.date_vars(date_to_read)\nfile_vars['provi...
<|body_start_0|> super().__init__(rundate=rundate, time=time, satellite=satellite, system=system) self.file_key = file_key self.day_offset = day_offset self.sat_name = satellite self.file_path = file_path <|end_body_0|> <|body_start_1|> date_to_read = rundate + timedelta...
A class for representing apriori slr orbits SP3 orbit files can be read. Attributes: day_offset (int): Day offset used to calculate the day to read. dset_orbit (Dataset): Dataset object, which includes orbits read from SP3 file dset_raw (Dataset): Dataset object, which includes observations etc. file_key (str): Key to ...
Slr
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Slr: """A class for representing apriori slr orbits SP3 orbit files can be read. Attributes: day_offset (int): Day offset used to calculate the day to read. dset_orbit (Dataset): Dataset object, which includes orbits read from SP3 file dset_raw (Dataset): Dataset object, which includes observatio...
stack_v2_sparse_classes_36k_train_022244
3,900
permissive
[ { "docstring": "Set up a new PreciseOrbit object, does not parse any data TODO: Remove dependency on rundate, use time to read correct files. (What to do with dataset?) Args: rundate (date): Date of model run. time (Time): Time epochs at the satellite for which to calculate the apriori orbit. satellite (list): ...
2
null
Implement the Python class `Slr` described below. Class description: A class for representing apriori slr orbits SP3 orbit files can be read. Attributes: day_offset (int): Day offset used to calculate the day to read. dset_orbit (Dataset): Dataset object, which includes orbits read from SP3 file dset_raw (Dataset): Da...
Implement the Python class `Slr` described below. Class description: A class for representing apriori slr orbits SP3 orbit files can be read. Attributes: day_offset (int): Day offset used to calculate the day to read. dset_orbit (Dataset): Dataset object, which includes orbits read from SP3 file dset_raw (Dataset): Da...
0c8c5c68adca08f97e22cab1bce10e382a7fbf77
<|skeleton|> class Slr: """A class for representing apriori slr orbits SP3 orbit files can be read. Attributes: day_offset (int): Day offset used to calculate the day to read. dset_orbit (Dataset): Dataset object, which includes orbits read from SP3 file dset_raw (Dataset): Dataset object, which includes observatio...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Slr: """A class for representing apriori slr orbits SP3 orbit files can be read. Attributes: day_offset (int): Day offset used to calculate the day to read. dset_orbit (Dataset): Dataset object, which includes orbits read from SP3 file dset_raw (Dataset): Dataset object, which includes observations etc. file_...
the_stack_v2_python_sparse
where/apriori/orbit/slr.py
kartverket/where
train
21
0bbfc8cf59f2a4b0273284db2abdac4d4615fb5e
[ "user_id = payload['user_id']\nrows = await get_blueprints(self.db, user_id=user_id)\nblueprints, errors = BlueprintSchema(many=True).dump(rows)\nif errors:\n json_response({'error': errors}, status=400)\nreturn json_response({'blueprints': blueprints})", "user_id = payload['user_id']\ndata = await self.reques...
<|body_start_0|> user_id = payload['user_id'] rows = await get_blueprints(self.db, user_id=user_id) blueprints, errors = BlueprintSchema(many=True).dump(rows) if errors: json_response({'error': errors}, status=400) return json_response({'blueprints': blueprints}) <|en...
Views to handle blueprints.
Blueprint
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Blueprint: """Views to handle blueprints.""" async def get(self, payload): """Get blueprints.""" <|body_0|> async def delete(self, payload): """Delete a blueprint.""" <|body_1|> <|end_skeleton|> <|body_start_0|> user_id = payload['user_id'] ...
stack_v2_sparse_classes_36k_train_022245
5,954
permissive
[ { "docstring": "Get blueprints.", "name": "get", "signature": "async def get(self, payload)" }, { "docstring": "Delete a blueprint.", "name": "delete", "signature": "async def delete(self, payload)" } ]
2
null
Implement the Python class `Blueprint` described below. Class description: Views to handle blueprints. Method signatures and docstrings: - async def get(self, payload): Get blueprints. - async def delete(self, payload): Delete a blueprint.
Implement the Python class `Blueprint` described below. Class description: Views to handle blueprints. Method signatures and docstrings: - async def get(self, payload): Get blueprints. - async def delete(self, payload): Delete a blueprint. <|skeleton|> class Blueprint: """Views to handle blueprints.""" asyn...
e94889ce784f4399ca74f78be3bc42a5cd880d70
<|skeleton|> class Blueprint: """Views to handle blueprints.""" async def get(self, payload): """Get blueprints.""" <|body_0|> async def delete(self, payload): """Delete a blueprint.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Blueprint: """Views to handle blueprints.""" async def get(self, payload): """Get blueprints.""" user_id = payload['user_id'] rows = await get_blueprints(self.db, user_id=user_id) blueprints, errors = BlueprintSchema(many=True).dump(rows) if errors: jso...
the_stack_v2_python_sparse
blueprints/views.py
cassinyio/cassiny-spawner
train
1
d0565f83db422e3d3436761b64934a05366ebf17
[ "value = '<div>'\nclase = 'actions'\nurl_cont = '/roles/'\nperm_mod = PoseePermiso('modificar rol')\nperm_del = PoseePermiso('eliminar rol')\nif perm_mod.is_met(request.environ):\n value += '<div>' + '<a href=\"' + url_cont + str(obj.id_rol) + '/edit' + '\" class=\"' + clase + '\">Modificar</a>' + '</div><br />'...
<|body_start_0|> value = '<div>' clase = 'actions' url_cont = '/roles/' perm_mod = PoseePermiso('modificar rol') perm_del = PoseePermiso('eliminar rol') if perm_mod.is_met(request.environ): value += '<div>' + '<a href="' + url_cont + str(obj.id_rol) + '/edit' ...
RolTableFiller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RolTableFiller: def __actions__(self, obj): """Links de acciones para un registro dado""" <|body_0|> def _do_get_provider_count_and_objs(self, **kw): """Se muestra la lista de rol si se tiene un permiso necesario. Caso contrario le muestra sus roles.""" <|bod...
stack_v2_sparse_classes_36k_train_022246
31,597
no_license
[ { "docstring": "Links de acciones para un registro dado", "name": "__actions__", "signature": "def __actions__(self, obj)" }, { "docstring": "Se muestra la lista de rol si se tiene un permiso necesario. Caso contrario le muestra sus roles.", "name": "_do_get_provider_count_and_objs", "si...
2
stack_v2_sparse_classes_30k_train_000303
Implement the Python class `RolTableFiller` described below. Class description: Implement the RolTableFiller class. Method signatures and docstrings: - def __actions__(self, obj): Links de acciones para un registro dado - def _do_get_provider_count_and_objs(self, **kw): Se muestra la lista de rol si se tiene un permi...
Implement the Python class `RolTableFiller` described below. Class description: Implement the RolTableFiller class. Method signatures and docstrings: - def __actions__(self, obj): Links de acciones para un registro dado - def _do_get_provider_count_and_objs(self, **kw): Se muestra la lista de rol si se tiene un permi...
997531e130d1951b483f4a6a67f2df7467cd9fd1
<|skeleton|> class RolTableFiller: def __actions__(self, obj): """Links de acciones para un registro dado""" <|body_0|> def _do_get_provider_count_and_objs(self, **kw): """Se muestra la lista de rol si se tiene un permiso necesario. Caso contrario le muestra sus roles.""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RolTableFiller: def __actions__(self, obj): """Links de acciones para un registro dado""" value = '<div>' clase = 'actions' url_cont = '/roles/' perm_mod = PoseePermiso('modificar rol') perm_del = PoseePermiso('eliminar rol') if perm_mod.is_met(request.e...
the_stack_v2_python_sparse
lpm/controllers/rol.py
jorgeramirez/LPM
train
1
e63bfd60c32618f882979dbda128340c96c6ebd2
[ "voyage_id_with_pilot = []\nupcoming_voyage_list = LL_API().get_upcoming_voyages()\nfor voyage in upcoming_voyage_list:\n if pilot.getCrewID() in voyage.getCrewOnVoyage():\n voyage_id_with_pilot.append(voyage.getVoyageID())\nreturn voyage_id_with_pilot", "old_license = employee.getLicense()\nnew_license...
<|body_start_0|> voyage_id_with_pilot = [] upcoming_voyage_list = LL_API().get_upcoming_voyages() for voyage in upcoming_voyage_list: if pilot.getCrewID() in voyage.getCrewOnVoyage(): voyage_id_with_pilot.append(voyage.getVoyageID()) return voyage_id_with_pilo...
Class to edit pilot license
EditEmployeeLicense
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EditEmployeeLicense: """Class to edit pilot license""" def isPilotOnFutureVoyage(self, pilot): """Checks if pilot instance is working on other voyages in the future. If he is, a list of the IDs for the voyages he is working on is returned.""" <|body_0|> def startEditEmpl...
stack_v2_sparse_classes_36k_train_022247
1,685
no_license
[ { "docstring": "Checks if pilot instance is working on other voyages in the future. If he is, a list of the IDs for the voyages he is working on is returned.", "name": "isPilotOnFutureVoyage", "signature": "def isPilotOnFutureVoyage(self, pilot)" }, { "docstring": "Changes pilot license.", "...
2
null
Implement the Python class `EditEmployeeLicense` described below. Class description: Class to edit pilot license Method signatures and docstrings: - def isPilotOnFutureVoyage(self, pilot): Checks if pilot instance is working on other voyages in the future. If he is, a list of the IDs for the voyages he is working on ...
Implement the Python class `EditEmployeeLicense` described below. Class description: Class to edit pilot license Method signatures and docstrings: - def isPilotOnFutureVoyage(self, pilot): Checks if pilot instance is working on other voyages in the future. If he is, a list of the IDs for the voyages he is working on ...
265115eb2bb4e7c30635b83b524d0aa5e0bbdcb6
<|skeleton|> class EditEmployeeLicense: """Class to edit pilot license""" def isPilotOnFutureVoyage(self, pilot): """Checks if pilot instance is working on other voyages in the future. If he is, a list of the IDs for the voyages he is working on is returned.""" <|body_0|> def startEditEmpl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EditEmployeeLicense: """Class to edit pilot license""" def isPilotOnFutureVoyage(self, pilot): """Checks if pilot instance is working on other voyages in the future. If he is, a list of the IDs for the voyages he is working on is returned.""" voyage_id_with_pilot = [] upcoming_voy...
the_stack_v2_python_sparse
NaNair/UI/EditMenus/edit_employee_licence.py
helenaj18/Dagbok
train
0
e53f5b36f7ba730f6b1c917f031edf2513b8f21c
[ "self.groups = game.all_sprites\npygame.sprite.Sprite.__init__(self, self.groups)\nself.game = game\nself.image = game.player_img\nself.rect = self.image.get_rect()\nself.vel = vec(0, 0)\nself.pos = vec(x, y) * TILESIZE", "self.handle_input()\nself.pos += self.vel * self.game.dt\nself.rect.x = self.pos.x\nself.co...
<|body_start_0|> self.groups = game.all_sprites pygame.sprite.Sprite.__init__(self, self.groups) self.game = game self.image = game.player_img self.rect = self.image.get_rect() self.vel = vec(0, 0) self.pos = vec(x, y) * TILESIZE <|end_body_0|> <|body_start_1|> ...
Player
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Player: def __init__(self, game, x, y): """Use a game image, preloaded in Game, and add new vectors to handle position and desired velocity (input)""" <|body_0|> def update(self): """Let's get those vectors to work!""" <|body_1|> def handle_input(self): ...
stack_v2_sparse_classes_36k_train_022248
2,790
no_license
[ { "docstring": "Use a game image, preloaded in Game, and add new vectors to handle position and desired velocity (input)", "name": "__init__", "signature": "def __init__(self, game, x, y)" }, { "docstring": "Let's get those vectors to work!", "name": "update", "signature": "def update(se...
4
stack_v2_sparse_classes_30k_train_013701
Implement the Python class `Player` described below. Class description: Implement the Player class. Method signatures and docstrings: - def __init__(self, game, x, y): Use a game image, preloaded in Game, and add new vectors to handle position and desired velocity (input) - def update(self): Let's get those vectors t...
Implement the Python class `Player` described below. Class description: Implement the Player class. Method signatures and docstrings: - def __init__(self, game, x, y): Use a game image, preloaded in Game, and add new vectors to handle position and desired velocity (input) - def update(self): Let's get those vectors t...
349367254f85e3e4273cede067ca950913a1332c
<|skeleton|> class Player: def __init__(self, game, x, y): """Use a game image, preloaded in Game, and add new vectors to handle position and desired velocity (input)""" <|body_0|> def update(self): """Let's get those vectors to work!""" <|body_1|> def handle_input(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Player: def __init__(self, game, x, y): """Use a game image, preloaded in Game, and add new vectors to handle position and desired velocity (input)""" self.groups = game.all_sprites pygame.sprite.Sprite.__init__(self, self.groups) self.game = game self.image = game.play...
the_stack_v2_python_sparse
11-videogames/Referencia/05-Vectores y sprites/sprites.py
pythoncanarias/eoi
train
26
b8ae939fca594afb1d38637766f2c78bc9e1b08b
[ "super(MLFBlockProcessor, self).__init__(sendee, sending=sending)\nself.set_sendee(sendee)\nself._current = None\nself._label_event_handler = label_event_handler", "if isinstance(event, MLFRecordStartEvent):\n assert hasattr(event, 'record_filename')\n self._current = []\nelif isinstance(event, MLFLabelEven...
<|body_start_0|> super(MLFBlockProcessor, self).__init__(sendee, sending=sending) self.set_sendee(sendee) self._current = None self._label_event_handler = label_event_handler <|end_body_0|> <|body_start_1|> if isinstance(event, MLFRecordStartEvent): assert hasattr(ev...
Generator for blocks of mlf data from a stream of MLF processor events. Event types sent: MLFBlockEvent >>> module_dir, module_name = os.path.split(__file__) >>> files = tuple(os.path.join(module_dir, mlf_file) for mlf_file in ('f1.mlf', 'f2.mlf', 'mono.mlf')) >>> result = [] >>> def handler0(label_evt): return label_e...
MLFBlockProcessor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MLFBlockProcessor: """Generator for blocks of mlf data from a stream of MLF processor events. Event types sent: MLFBlockEvent >>> module_dir, module_name = os.path.split(__file__) >>> files = tuple(os.path.join(module_dir, mlf_file) for mlf_file in ('f1.mlf', 'f2.mlf', 'mono.mlf')) >>> result = [...
stack_v2_sparse_classes_36k_train_022249
13,578
permissive
[ { "docstring": "label_event_handler is a callable which takes MLFLabelEvents; the values returned will be appended to the list for each record. If None, the label events themselves will be appended. sendee is a function to call with our output events.", "name": "__init__", "signature": "def __init__(sel...
2
stack_v2_sparse_classes_30k_test_000250
Implement the Python class `MLFBlockProcessor` described below. Class description: Generator for blocks of mlf data from a stream of MLF processor events. Event types sent: MLFBlockEvent >>> module_dir, module_name = os.path.split(__file__) >>> files = tuple(os.path.join(module_dir, mlf_file) for mlf_file in ('f1.mlf'...
Implement the Python class `MLFBlockProcessor` described below. Class description: Generator for blocks of mlf data from a stream of MLF processor events. Event types sent: MLFBlockEvent >>> module_dir, module_name = os.path.split(__file__) >>> files = tuple(os.path.join(module_dir, mlf_file) for mlf_file in ('f1.mlf'...
f270a1be86372b7044615e4fd82032029e123bc1
<|skeleton|> class MLFBlockProcessor: """Generator for blocks of mlf data from a stream of MLF processor events. Event types sent: MLFBlockEvent >>> module_dir, module_name = os.path.split(__file__) >>> files = tuple(os.path.join(module_dir, mlf_file) for mlf_file in ('f1.mlf', 'f2.mlf', 'mono.mlf')) >>> result = [...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MLFBlockProcessor: """Generator for blocks of mlf data from a stream of MLF processor events. Event types sent: MLFBlockEvent >>> module_dir, module_name = os.path.split(__file__) >>> files = tuple(os.path.join(module_dir, mlf_file) for mlf_file in ('f1.mlf', 'f2.mlf', 'mono.mlf')) >>> result = [] >>> def han...
the_stack_v2_python_sparse
resources/Onyx-1.0.511/py/onyx/htkfiles/mlfprocess.py
eternity668/speechAD
train
0
1e8363b3f4bafded2833da49a732cce47a07b3d1
[ "supported_ops = ['shearX', 'shearY', 'translateX', 'translateY', 'rotate', 'color', 'posterize', 'solarize', 'contrast', 'sharpness', 'brightness', 'autocontrast', 'equalize', 'invert']\nassert operation1 in supported_ops and operation2 in supported_ops, 'SubPolicy:one of oper1 or oper2 refers to an unsupported op...
<|body_start_0|> supported_ops = ['shearX', 'shearY', 'translateX', 'translateY', 'rotate', 'color', 'posterize', 'solarize', 'contrast', 'sharpness', 'brightness', 'autocontrast', 'equalize', 'invert'] assert operation1 in supported_ops and operation2 in supported_ops, 'SubPolicy:one of oper1 or oper2 ...
Definition of a SubPolicy. A SubPolicy consists of two augmentation operations, each of those parametrized as operation, probability, magnitude. The two operations are applied sequentially on the image upon call.
SubPolicy
[ "LicenseRef-scancode-unknown-license-reference", "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubPolicy: """Definition of a SubPolicy. A SubPolicy consists of two augmentation operations, each of those parametrized as operation, probability, magnitude. The two operations are applied sequentially on the image upon call.""" def __init__(self, operation1, probability1, magnitude_idx1, o...
stack_v2_sparse_classes_36k_train_022250
13,416
permissive
[ { "docstring": "Initialize a SubPolicy. Args: operation1 (str): Key specifying the first augmentation operation. There are fourteen key values altogether (see supported_ops below listing supported operations). probability1 (float): Probability within [0., 1.] of applying the first augmentation operation. magnit...
2
null
Implement the Python class `SubPolicy` described below. Class description: Definition of a SubPolicy. A SubPolicy consists of two augmentation operations, each of those parametrized as operation, probability, magnitude. The two operations are applied sequentially on the image upon call. Method signatures and docstrin...
Implement the Python class `SubPolicy` described below. Class description: Definition of a SubPolicy. A SubPolicy consists of two augmentation operations, each of those parametrized as operation, probability, magnitude. The two operations are applied sequentially on the image upon call. Method signatures and docstrin...
2f4a93fb4888180755a8ef55f4b977ef8f60a89e
<|skeleton|> class SubPolicy: """Definition of a SubPolicy. A SubPolicy consists of two augmentation operations, each of those parametrized as operation, probability, magnitude. The two operations are applied sequentially on the image upon call.""" def __init__(self, operation1, probability1, magnitude_idx1, o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubPolicy: """Definition of a SubPolicy. A SubPolicy consists of two augmentation operations, each of those parametrized as operation, probability, magnitude. The two operations are applied sequentially on the image upon call.""" def __init__(self, operation1, probability1, magnitude_idx1, operation2, pr...
the_stack_v2_python_sparse
large_language_model/megatron-lm/megatron/data/autoaugment.py
mlcommons/training
train
431
90e08401cf50ef80d42fcfa6c388650e5fc09d54
[ "if not vertex:\n return jsonify_response({'error': 'Vertex not found'}, 404)\ntemplates = Template.get_templates_with_details(vertex.id)\nreturn jsonify_response(templates, 200)", "if not vertex:\n return jsonify_response({'error': 'Vertex not found'}, 404)\nschema = TemplateListSchema()\ndata = schema.loa...
<|body_start_0|> if not vertex: return jsonify_response({'error': 'Vertex not found'}, 404) templates = Template.get_templates_with_details(vertex.id) return jsonify_response(templates, 200) <|end_body_0|> <|body_start_1|> if not vertex: return jsonify_response({...
Container for the LIST and CREATE Template endpoints for a given Team
ListCreateTemplatesView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListCreateTemplatesView: """Container for the LIST and CREATE Template endpoints for a given Team""" def get(self, vertex=None, vertex_type='team', vertex_id=None): """LIST Endpoint for a team's templates""" <|body_0|> def post(self, vertex=None, vertex_type='team', vert...
stack_v2_sparse_classes_36k_train_022251
44,865
no_license
[ { "docstring": "LIST Endpoint for a team's templates", "name": "get", "signature": "def get(self, vertex=None, vertex_type='team', vertex_id=None)" }, { "docstring": "CREATE Endpoint for a team's templates", "name": "post", "signature": "def post(self, vertex=None, vertex_type='team', ve...
2
stack_v2_sparse_classes_30k_train_015964
Implement the Python class `ListCreateTemplatesView` described below. Class description: Container for the LIST and CREATE Template endpoints for a given Team Method signatures and docstrings: - def get(self, vertex=None, vertex_type='team', vertex_id=None): LIST Endpoint for a team's templates - def post(self, verte...
Implement the Python class `ListCreateTemplatesView` described below. Class description: Container for the LIST and CREATE Template endpoints for a given Team Method signatures and docstrings: - def get(self, vertex=None, vertex_type='team', vertex_id=None): LIST Endpoint for a team's templates - def post(self, verte...
00434985013b65fe45b0a8c8a7f0b50bb727087a
<|skeleton|> class ListCreateTemplatesView: """Container for the LIST and CREATE Template endpoints for a given Team""" def get(self, vertex=None, vertex_type='team', vertex_id=None): """LIST Endpoint for a team's templates""" <|body_0|> def post(self, vertex=None, vertex_type='team', vert...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ListCreateTemplatesView: """Container for the LIST and CREATE Template endpoints for a given Team""" def get(self, vertex=None, vertex_type='team', vertex_id=None): """LIST Endpoint for a team's templates""" if not vertex: return jsonify_response({'error': 'Vertex not found'},...
the_stack_v2_python_sparse
core/views.py
gingerComms/gingerCommsAPIs
train
0
5ae1dad12423857ae9522503c1c5d5f3ba40b9ab
[ "if (not unlockhash or not transaction_xdr) and (not args):\n raise j.exceptions.Value(f\"missing a required argument: 'unlockhash' and 'transaction_xdr'\")\nif args:\n try:\n if 'unlockhash' in args:\n unlockhash = args.get('unlockhash', None)\n else:\n raise j.exceptions....
<|body_start_0|> if (not unlockhash or not transaction_xdr) and (not args): raise j.exceptions.Value(f"missing a required argument: 'unlockhash' and 'transaction_xdr'") if args: try: if 'unlockhash' in args: unlockhash = args.get('unlockhash', ...
unlock_service
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class unlock_service: def create_unlockhash_transaction(self, unlockhash: str=None, transaction_xdr: str=None, args: dict=None) -> dict: """param:unlockhash (str) param:transaction_xdr (str) return: unlockhash_transaction obj dict""" <|body_0|> def get_unlockhash_transaction(self,...
stack_v2_sparse_classes_36k_train_022252
3,224
permissive
[ { "docstring": "param:unlockhash (str) param:transaction_xdr (str) return: unlockhash_transaction obj dict", "name": "create_unlockhash_transaction", "signature": "def create_unlockhash_transaction(self, unlockhash: str=None, transaction_xdr: str=None, args: dict=None) -> dict" }, { "docstring":...
2
stack_v2_sparse_classes_30k_train_017189
Implement the Python class `unlock_service` described below. Class description: Implement the unlock_service class. Method signatures and docstrings: - def create_unlockhash_transaction(self, unlockhash: str=None, transaction_xdr: str=None, args: dict=None) -> dict: param:unlockhash (str) param:transaction_xdr (str) ...
Implement the Python class `unlock_service` described below. Class description: Implement the unlock_service class. Method signatures and docstrings: - def create_unlockhash_transaction(self, unlockhash: str=None, transaction_xdr: str=None, args: dict=None) -> dict: param:unlockhash (str) param:transaction_xdr (str) ...
4f95bb3d2f339ffe63b245b4206f3e77f09ab659
<|skeleton|> class unlock_service: def create_unlockhash_transaction(self, unlockhash: str=None, transaction_xdr: str=None, args: dict=None) -> dict: """param:unlockhash (str) param:transaction_xdr (str) return: unlockhash_transaction obj dict""" <|body_0|> def get_unlockhash_transaction(self,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class unlock_service: def create_unlockhash_transaction(self, unlockhash: str=None, transaction_xdr: str=None, args: dict=None) -> dict: """param:unlockhash (str) param:transaction_xdr (str) return: unlockhash_transaction obj dict""" if (not unlockhash or not transaction_xdr) and (not args): ...
the_stack_v2_python_sparse
ThreeBotPackages/unlock_service/actors/unlock_service.py
threefoldfoundation/tft-stellar
train
8
a1d1941c8d5a17ab0253b2dd00cfb4ed988033cb
[ "raw = cls.validate_payload(payload)\nday = raw[0] & 31\nmonth = raw[1] & 15\nyear = raw[2] & 127\nif not DPTDate._test_range(day, month, year):\n raise ConversionError('Could not parse DPTDate', raw=raw)\nif year >= 90:\n year += 1900\nelse:\n year += 2000\ntry:\n return time.strptime(f'{year} {month} ...
<|body_start_0|> raw = cls.validate_payload(payload) day = raw[0] & 31 month = raw[1] & 15 year = raw[2] & 127 if not DPTDate._test_range(day, month, year): raise ConversionError('Could not parse DPTDate', raw=raw) if year >= 90: year += 1900 ...
Abstraction for KNX 3 octet date (DPT 11.001).
DPTDate
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DPTDate: """Abstraction for KNX 3 octet date (DPT 11.001).""" def from_knx(cls, payload: DPTArray | DPTBinary) -> time.struct_time: """Parse/deserialize from KNX/IP raw data.""" <|body_0|> def to_knx(cls, value: time.struct_time) -> DPTArray: """Serialize to KNX/...
stack_v2_sparse_classes_36k_train_022253
2,138
permissive
[ { "docstring": "Parse/deserialize from KNX/IP raw data.", "name": "from_knx", "signature": "def from_knx(cls, payload: DPTArray | DPTBinary) -> time.struct_time" }, { "docstring": "Serialize to KNX/IP raw data from time.struct_time.", "name": "to_knx", "signature": "def to_knx(cls, value...
3
null
Implement the Python class `DPTDate` described below. Class description: Abstraction for KNX 3 octet date (DPT 11.001). Method signatures and docstrings: - def from_knx(cls, payload: DPTArray | DPTBinary) -> time.struct_time: Parse/deserialize from KNX/IP raw data. - def to_knx(cls, value: time.struct_time) -> DPTArr...
Implement the Python class `DPTDate` described below. Class description: Abstraction for KNX 3 octet date (DPT 11.001). Method signatures and docstrings: - def from_knx(cls, payload: DPTArray | DPTBinary) -> time.struct_time: Parse/deserialize from KNX/IP raw data. - def to_knx(cls, value: time.struct_time) -> DPTArr...
48d4e31365c15e632b275f0d129cd9f2b2b5717d
<|skeleton|> class DPTDate: """Abstraction for KNX 3 octet date (DPT 11.001).""" def from_knx(cls, payload: DPTArray | DPTBinary) -> time.struct_time: """Parse/deserialize from KNX/IP raw data.""" <|body_0|> def to_knx(cls, value: time.struct_time) -> DPTArray: """Serialize to KNX/...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DPTDate: """Abstraction for KNX 3 octet date (DPT 11.001).""" def from_knx(cls, payload: DPTArray | DPTBinary) -> time.struct_time: """Parse/deserialize from KNX/IP raw data.""" raw = cls.validate_payload(payload) day = raw[0] & 31 month = raw[1] & 15 year = raw[2]...
the_stack_v2_python_sparse
xknx/dpt/dpt_date.py
XKNX/xknx
train
248
1354c164bff22431e66e75a1cd4ad38bdb8383ca
[ "self.aliases = aliases\nself.states = states\nself.timestamp = edera.helpers.now()", "for task in tasks:\n alias = edera.helpers.sha1(task)[:10]\n self.aliases[task] = alias\n self.states[alias] = TaskState(task)" ]
<|body_start_0|> self.aliases = aliases self.states = states self.timestamp = edera.helpers.now() <|end_body_0|> <|body_start_1|> for task in tasks: alias = edera.helpers.sha1(task)[:10] self.aliases[task] = alias self.states[alias] = TaskState(task) ...
A monitoring snapshot core that holds basic information about the workflow. Attributes: aliases (Mapping[String, String]) - the aliases by task name states (Mapping[String, TaskState]) - the task states by alias timestamp (DateTime) - the time the snapshot was last actualized See also: $TaskState
MonitoringSnapshotCore
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MonitoringSnapshotCore: """A monitoring snapshot core that holds basic information about the workflow. Attributes: aliases (Mapping[String, String]) - the aliases by task name states (Mapping[String, TaskState]) - the task states by alias timestamp (DateTime) - the time the snapshot was last actu...
stack_v2_sparse_classes_36k_train_022254
11,918
permissive
[ { "docstring": "Args: aliases (Mapping[String, String]) - aliases by task name states (Mapping[String, TaskState]) - task states by alias", "name": "__init__", "signature": "def __init__(self, aliases, states)" }, { "docstring": "Add the new tasks to the snapshot core. Creates aliases and initia...
2
null
Implement the Python class `MonitoringSnapshotCore` described below. Class description: A monitoring snapshot core that holds basic information about the workflow. Attributes: aliases (Mapping[String, String]) - the aliases by task name states (Mapping[String, TaskState]) - the task states by alias timestamp (DateTime...
Implement the Python class `MonitoringSnapshotCore` described below. Class description: A monitoring snapshot core that holds basic information about the workflow. Attributes: aliases (Mapping[String, String]) - the aliases by task name states (Mapping[String, TaskState]) - the task states by alias timestamp (DateTime...
c4ddb5d8a25906c3bd773c91afb3260fc0b704f2
<|skeleton|> class MonitoringSnapshotCore: """A monitoring snapshot core that holds basic information about the workflow. Attributes: aliases (Mapping[String, String]) - the aliases by task name states (Mapping[String, TaskState]) - the task states by alias timestamp (DateTime) - the time the snapshot was last actu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MonitoringSnapshotCore: """A monitoring snapshot core that holds basic information about the workflow. Attributes: aliases (Mapping[String, String]) - the aliases by task name states (Mapping[String, TaskState]) - the task states by alias timestamp (DateTime) - the time the snapshot was last actualized See al...
the_stack_v2_python_sparse
edera/monitoring/snapshot.py
thoughteer/edera
train
3
24c0eca60e4b90b60e8991bbd27f5d587f97dfc2
[ "pc = DotDict()\nf2jd = copy.deepcopy(cannonical_json_dump)\npc.upload_file_minidump_flash2 = DotDict()\npc.upload_file_minidump_flash2.json_dump = f2jd\npc.upload_file_minidump_flash2.json_dump['threads'][0]['frames'][2]['function'] = 'NtAlpcSendWaitReceivePort'\nfake_processor = create_basic_fake_processor()\nrc ...
<|body_start_0|> pc = DotDict() f2jd = copy.deepcopy(cannonical_json_dump) pc.upload_file_minidump_flash2 = DotDict() pc.upload_file_minidump_flash2.json_dump = f2jd pc.upload_file_minidump_flash2.json_dump['threads'][0]['frames'][2]['function'] = 'NtAlpcSendWaitReceivePort' ...
TestSendWaitReceivePort
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSendWaitReceivePort: def test_action_case_1(self): """success - target found in top 5 frames of stack""" <|body_0|> def test_action_case_2(self): """failure - target not found in top 5 frames of stack""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_022255
27,276
no_license
[ { "docstring": "success - target found in top 5 frames of stack", "name": "test_action_case_1", "signature": "def test_action_case_1(self)" }, { "docstring": "failure - target not found in top 5 frames of stack", "name": "test_action_case_2", "signature": "def test_action_case_2(self)" ...
2
stack_v2_sparse_classes_30k_train_016226
Implement the Python class `TestSendWaitReceivePort` described below. Class description: Implement the TestSendWaitReceivePort class. Method signatures and docstrings: - def test_action_case_1(self): success - target found in top 5 frames of stack - def test_action_case_2(self): failure - target not found in top 5 fr...
Implement the Python class `TestSendWaitReceivePort` described below. Class description: Implement the TestSendWaitReceivePort class. Method signatures and docstrings: - def test_action_case_1(self): success - target found in top 5 frames of stack - def test_action_case_2(self): failure - target not found in top 5 fr...
9c9b7701d7ddf9f3cbba1a4d0aa65758e8b49528
<|skeleton|> class TestSendWaitReceivePort: def test_action_case_1(self): """success - target found in top 5 frames of stack""" <|body_0|> def test_action_case_2(self): """failure - target not found in top 5 frames of stack""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestSendWaitReceivePort: def test_action_case_1(self): """success - target found in top 5 frames of stack""" pc = DotDict() f2jd = copy.deepcopy(cannonical_json_dump) pc.upload_file_minidump_flash2 = DotDict() pc.upload_file_minidump_flash2.json_dump = f2jd pc.u...
the_stack_v2_python_sparse
socorro/unittest/processor/test_skunk_classifiers.py
v1ka5/socorro
train
0
78db40fb04392f1ed8f704f94d25b288d06de41f
[ "super().__init__()\nself.land_model_path = land_model_path\nself.sky_model_path = sky_model_path\nwith open(self.land_model_path, 'rb') as f:\n ckpt = pickle.load(f)\n self.ground = ckpt['G_ema'].eval()\n self.ground.rendering_kwargs['white_back'] = False\n if 'world2cam_poses' in ckpt:\n self.w...
<|body_start_0|> super().__init__() self.land_model_path = land_model_path self.sky_model_path = sky_model_path with open(self.land_model_path, 'rb') as f: ckpt = pickle.load(f) self.ground = ckpt['G_ema'].eval() self.ground.rendering_kwargs['white_bac...
Extendable triplane wrapper.
ModelFull
[ "CC-BY-4.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelFull: """Extendable triplane wrapper.""" def __init__(self, land_model_path, sky_model_path): """Initialize wrapper for full model, consisting of land and sky. Args: land_model_path: str containing the path to land model, using the triplane backbone sky_model_path: str containin...
stack_v2_sparse_classes_36k_train_022256
3,113
permissive
[ { "docstring": "Initialize wrapper for full model, consisting of land and sky. Args: land_model_path: str containing the path to land model, using the triplane backbone sky_model_path: str containing the path to sky model", "name": "__init__", "signature": "def __init__(self, land_model_path, sky_model_...
2
stack_v2_sparse_classes_30k_train_013899
Implement the Python class `ModelFull` described below. Class description: Extendable triplane wrapper. Method signatures and docstrings: - def __init__(self, land_model_path, sky_model_path): Initialize wrapper for full model, consisting of land and sky. Args: land_model_path: str containing the path to land model, ...
Implement the Python class `ModelFull` described below. Class description: Extendable triplane wrapper. Method signatures and docstrings: - def __init__(self, land_model_path, sky_model_path): Initialize wrapper for full model, consisting of land and sky. Args: land_model_path: str containing the path to land model, ...
c1ae273841592fce4c993bf35cdd0a6424e73da4
<|skeleton|> class ModelFull: """Extendable triplane wrapper.""" def __init__(self, land_model_path, sky_model_path): """Initialize wrapper for full model, consisting of land and sky. Args: land_model_path: str containing the path to land model, using the triplane backbone sky_model_path: str containin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModelFull: """Extendable triplane wrapper.""" def __init__(self, land_model_path, sky_model_path): """Initialize wrapper for full model, consisting of land and sky. Args: land_model_path: str containing the path to land model, using the triplane backbone sky_model_path: str containing the path to...
the_stack_v2_python_sparse
persistent-nature/models/triplane/model_full.py
ishine/google-research
train
0
0ab3d46aa9155999d1bccc5fb25b5041d5be5896
[ "_db = 'keystone'\n_file_key = 'mysqldump-file'\nlogging.info('Execute mysqldump action')\nif self.application_name == 'percona-cluster':\n action = zaza.model.run_action_on_leader(self.application_name, 'set-pxc-strict-mode', action_params={'mode': 'MASTER'})\naction = zaza.model.run_action_on_leader(self.appli...
<|body_start_0|> _db = 'keystone' _file_key = 'mysqldump-file' logging.info('Execute mysqldump action') if self.application_name == 'percona-cluster': action = zaza.model.run_action_on_leader(self.application_name, 'set-pxc-strict-mode', action_params={'mode': 'MASTER'}) ...
Common mysql charm tests.
MySQLCommonTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MySQLCommonTests: """Common mysql charm tests.""" def test_110_mysqldump(self): """Backup mysql. Run the mysqldump action.""" <|body_0|> def test_910_restart_on_config_change(self): """Checking restart happens on config change. Change max connections and assert t...
stack_v2_sparse_classes_36k_train_022257
45,009
permissive
[ { "docstring": "Backup mysql. Run the mysqldump action.", "name": "test_110_mysqldump", "signature": "def test_110_mysqldump(self)" }, { "docstring": "Checking restart happens on config change. Change max connections and assert that change propagates to the correct file and that services are res...
3
null
Implement the Python class `MySQLCommonTests` described below. Class description: Common mysql charm tests. Method signatures and docstrings: - def test_110_mysqldump(self): Backup mysql. Run the mysqldump action. - def test_910_restart_on_config_change(self): Checking restart happens on config change. Change max con...
Implement the Python class `MySQLCommonTests` described below. Class description: Common mysql charm tests. Method signatures and docstrings: - def test_110_mysqldump(self): Backup mysql. Run the mysqldump action. - def test_910_restart_on_config_change(self): Checking restart happens on config change. Change max con...
3b17ad9d97c57b6e62797d4e3333e4b83e43a447
<|skeleton|> class MySQLCommonTests: """Common mysql charm tests.""" def test_110_mysqldump(self): """Backup mysql. Run the mysqldump action.""" <|body_0|> def test_910_restart_on_config_change(self): """Checking restart happens on config change. Change max connections and assert t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MySQLCommonTests: """Common mysql charm tests.""" def test_110_mysqldump(self): """Backup mysql. Run the mysqldump action.""" _db = 'keystone' _file_key = 'mysqldump-file' logging.info('Execute mysqldump action') if self.application_name == 'percona-cluster': ...
the_stack_v2_python_sparse
zaza/openstack/charm_tests/mysql/tests.py
openstack-charmers/zaza-openstack-tests
train
7
7f05141f5cd167c71d209658dda2fbc516e983b1
[ "from aha.widget.form import Form\nfrom aha.widget.field import TextField, RichText\nfrom formencode import validators as v\n\nclass AddForm(Form):\n multipart = True\n form_title = u'Add New Category'\n button_title = u'Add'\n submit = u'Save'\n name = TextField(title=u'ID', args={'size': 40}, valid...
<|body_start_0|> from aha.widget.form import Form from aha.widget.field import TextField, RichText from formencode import validators as v class AddForm(Form): multipart = True form_title = u'Add New Category' button_title = u'Add' submit =...
The controller for blog category
BlogcategoryController
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlogcategoryController: """The controller for blog category""" def get_form(self, kind, ins=None): """A method to return form object based on given kind. kind must be one of 'add' or 'edit'""" <|body_0|> def add_new_object(cls, v, ins): """A method to obtain new ...
stack_v2_sparse_classes_36k_train_022258
2,210
permissive
[ { "docstring": "A method to return form object based on given kind. kind must be one of 'add' or 'edit'", "name": "get_form", "signature": "def get_form(self, kind, ins=None)" }, { "docstring": "A method to obtain new object", "name": "add_new_object", "signature": "def add_new_object(cl...
2
stack_v2_sparse_classes_30k_train_003724
Implement the Python class `BlogcategoryController` described below. Class description: The controller for blog category Method signatures and docstrings: - def get_form(self, kind, ins=None): A method to return form object based on given kind. kind must be one of 'add' or 'edit' - def add_new_object(cls, v, ins): A ...
Implement the Python class `BlogcategoryController` described below. Class description: The controller for blog category Method signatures and docstrings: - def get_form(self, kind, ins=None): A method to return form object based on given kind. kind must be one of 'add' or 'edit' - def add_new_object(cls, v, ins): A ...
e1209f7d44d1c59ff9d373b7d89d414f31a9c28b
<|skeleton|> class BlogcategoryController: """The controller for blog category""" def get_form(self, kind, ins=None): """A method to return form object based on given kind. kind must be one of 'add' or 'edit'""" <|body_0|> def add_new_object(cls, v, ins): """A method to obtain new ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BlogcategoryController: """The controller for blog category""" def get_form(self, kind, ins=None): """A method to return form object based on given kind. kind must be one of 'add' or 'edit'""" from aha.widget.form import Form from aha.widget.field import TextField, RichText ...
the_stack_v2_python_sparse
applications/aha.application.coreblog3/application/controller/blogcategory.py
Letractively/aha-gae
train
0
fa2af28e286bf670d1e12dd7e26469bcd7ebe88d
[ "self.dim = dim\nself.x_pos = x_pos\nself.bars = bars\nself.speed = speed\nself.palette = palette\nself.sin = sin\nself.surface = pygame.Surface((dim[0], dim[1]), flags=pygame.SRCALPHA)\nbar_width = 10\nself.bar_surface = pygame.Surface((bar_width, dim[1]), flags=pygame.SRCALPHA)\nfor index, degree in enumerate(ran...
<|body_start_0|> self.dim = dim self.x_pos = x_pos self.bars = bars self.speed = speed self.palette = palette self.sin = sin self.surface = pygame.Surface((dim[0], dim[1]), flags=pygame.SRCALPHA) bar_width = 10 self.bar_surface = pygame.Surface((ba...
some simple vertical raster bar
VerticalRasterBar
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VerticalRasterBar: """some simple vertical raster bar""" def __init__(self, dim: tuple, x_pos: int, bars: int=5, speed: int=2, palette: list=PALETTE, sin: list=SIN): """:param dim: dimensio of surface to draw on :param x_pos: central x position :param bars: how many bars to draw :par...
stack_v2_sparse_classes_36k_train_022259
5,116
no_license
[ { "docstring": ":param dim: dimensio of surface to draw on :param x_pos: central x position :param bars: how many bars to draw :param speed: speed per frame, 1 euqal one pixel per frame :param palette: palette to use 256 colors :param sin: pre calculated sins for 360 degrees", "name": "__init__", "signa...
2
null
Implement the Python class `VerticalRasterBar` described below. Class description: some simple vertical raster bar Method signatures and docstrings: - def __init__(self, dim: tuple, x_pos: int, bars: int=5, speed: int=2, palette: list=PALETTE, sin: list=SIN): :param dim: dimensio of surface to draw on :param x_pos: c...
Implement the Python class `VerticalRasterBar` described below. Class description: some simple vertical raster bar Method signatures and docstrings: - def __init__(self, dim: tuple, x_pos: int, bars: int=5, speed: int=2, palette: list=PALETTE, sin: list=SIN): :param dim: dimensio of surface to draw on :param x_pos: c...
1fd421195a2888c0588a49f5a043a1110eedcdbf
<|skeleton|> class VerticalRasterBar: """some simple vertical raster bar""" def __init__(self, dim: tuple, x_pos: int, bars: int=5, speed: int=2, palette: list=PALETTE, sin: list=SIN): """:param dim: dimensio of surface to draw on :param x_pos: central x position :param bars: how many bars to draw :par...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VerticalRasterBar: """some simple vertical raster bar""" def __init__(self, dim: tuple, x_pos: int, bars: int=5, speed: int=2, palette: list=PALETTE, sin: list=SIN): """:param dim: dimensio of surface to draw on :param x_pos: central x position :param bars: how many bars to draw :param speed: spe...
the_stack_v2_python_sparse
effects/RasterBar.py
gunny26/pygame
train
5
fbc902fce61f281ed5facf76e9e5d61630dd9308
[ "dp = [0, 0]\nfor i in range(1, len(s)):\n if s[i - 1:i + 1] == '()':\n dp.append(dp[i - 1] + 2)\n elif s[i - 1:i + 1] == '))' and i - dp[i] - 1 >= 0 and (s[i - dp[i] - 1] == '('):\n dp.append(dp[i] + 2 + dp[i - dp[i] - 1])\n else:\n dp.append(0)\nprint(dp)\nreturn max(dp)", "dp = [0...
<|body_start_0|> dp = [0, 0] for i in range(1, len(s)): if s[i - 1:i + 1] == '()': dp.append(dp[i - 1] + 2) elif s[i - 1:i + 1] == '))' and i - dp[i] - 1 >= 0 and (s[i - dp[i] - 1] == '('): dp.append(dp[i] + 2 + dp[i - dp[i] - 1]) else:...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestValidParentheses1(self, s): """:type s: str :rtype: int""" <|body_0|> def longestValidParentheses(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> dp = [0, 0] for i in range(1, len(s)...
stack_v2_sparse_classes_36k_train_022260
1,557
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "longestValidParentheses1", "signature": "def longestValidParentheses1(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "longestValidParentheses", "signature": "def longestValidParentheses(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_006467
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestValidParentheses1(self, s): :type s: str :rtype: int - def longestValidParentheses(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestValidParentheses1(self, s): :type s: str :rtype: int - def longestValidParentheses(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def longestVal...
d6ddbef76dd8630234f669d272d1f8065c6be128
<|skeleton|> class Solution: def longestValidParentheses1(self, s): """:type s: str :rtype: int""" <|body_0|> def longestValidParentheses(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestValidParentheses1(self, s): """:type s: str :rtype: int""" dp = [0, 0] for i in range(1, len(s)): if s[i - 1:i + 1] == '()': dp.append(dp[i - 1] + 2) elif s[i - 1:i + 1] == '))' and i - dp[i] - 1 >= 0 and (s[i - dp[i] - 1] ==...
the_stack_v2_python_sparse
dp/32. Longest Valid Parentheses.py
Mang0o/leetcode
train
0
0c19baaed8b431a649a08a96819e1047e32afe55
[ "try:\n getattr(logging, value.upper())\nexcept AttributeError as err:\n raise ValueError(f'{value.upper()} is not a valid level') from err\nreturn value.upper()", "assert issubclass(self.__class__, MixinLoggingSettings)\nassert hasattr(self, 'LOG_LEVEL')\nreturn getattr(logging, self.LOG_LEVEL.upper())" ]
<|body_start_0|> try: getattr(logging, value.upper()) except AttributeError as err: raise ValueError(f'{value.upper()} is not a valid level') from err return value.upper() <|end_body_0|> <|body_start_1|> assert issubclass(self.__class__, MixinLoggingSettings) ...
USAGE example in packages/settings-library/tests/test_utils_logging.py::test_mixin_logging
MixinLoggingSettings
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MixinLoggingSettings: """USAGE example in packages/settings-library/tests/test_utils_logging.py::test_mixin_logging""" def validate_log_level(cls, value: str) -> str: """Standard implementation for @validator("LOG_LEVEL")""" <|body_0|> def log_level(self) -> int: ...
stack_v2_sparse_classes_36k_train_022261
862
permissive
[ { "docstring": "Standard implementation for @validator(\"LOG_LEVEL\")", "name": "validate_log_level", "signature": "def validate_log_level(cls, value: str) -> str" }, { "docstring": "Can be used in logging.setLogLevel()", "name": "log_level", "signature": "def log_level(self) -> int" }...
2
stack_v2_sparse_classes_30k_train_005445
Implement the Python class `MixinLoggingSettings` described below. Class description: USAGE example in packages/settings-library/tests/test_utils_logging.py::test_mixin_logging Method signatures and docstrings: - def validate_log_level(cls, value: str) -> str: Standard implementation for @validator("LOG_LEVEL") - def...
Implement the Python class `MixinLoggingSettings` described below. Class description: USAGE example in packages/settings-library/tests/test_utils_logging.py::test_mixin_logging Method signatures and docstrings: - def validate_log_level(cls, value: str) -> str: Standard implementation for @validator("LOG_LEVEL") - def...
f4c57ffc7b494ac06a2692cb5539d3acfd3d1d63
<|skeleton|> class MixinLoggingSettings: """USAGE example in packages/settings-library/tests/test_utils_logging.py::test_mixin_logging""" def validate_log_level(cls, value: str) -> str: """Standard implementation for @validator("LOG_LEVEL")""" <|body_0|> def log_level(self) -> int: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MixinLoggingSettings: """USAGE example in packages/settings-library/tests/test_utils_logging.py::test_mixin_logging""" def validate_log_level(cls, value: str) -> str: """Standard implementation for @validator("LOG_LEVEL")""" try: getattr(logging, value.upper()) except ...
the_stack_v2_python_sparse
packages/settings-library/src/settings_library/utils_logging.py
ITISFoundation/osparc-simcore
train
39
e4004e6ff6192bc6b95f6114e689734fc9f54be1
[ "if self.PossuiVertices([antecessor, suscessor]):\n arco = Arco(antecessor, suscessor, valor)\n self._arestas.add(arco)", "for arco in self._arestas:\n mesmo_antecessor = arco.ObterAntecessor() == antecessor\n mesmo_suscessor = arco.ObterSuscessor() == suscessor\n if mesmo_antecessor and mesmo_susc...
<|body_start_0|> if self.PossuiVertices([antecessor, suscessor]): arco = Arco(antecessor, suscessor, valor) self._arestas.add(arco) <|end_body_0|> <|body_start_1|> for arco in self._arestas: mesmo_antecessor = arco.ObterAntecessor() == antecessor mesmo_su...
DigrafoValorado
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DigrafoValorado: def Conecta(self, antecessor, suscessor, valor=None): """Conecta os vrtices v1 e v2 em G com valor associado""" <|body_0|> def ValorDaConexao(self, antecessor, suscessor): """Retorna o valor da conexo entre v1 e v2 se ela existir""" <|body_1|...
stack_v2_sparse_classes_36k_train_022262
801
no_license
[ { "docstring": "Conecta os vrtices v1 e v2 em G com valor associado", "name": "Conecta", "signature": "def Conecta(self, antecessor, suscessor, valor=None)" }, { "docstring": "Retorna o valor da conexo entre v1 e v2 se ela existir", "name": "ValorDaConexao", "signature": "def ValorDaCone...
2
null
Implement the Python class `DigrafoValorado` described below. Class description: Implement the DigrafoValorado class. Method signatures and docstrings: - def Conecta(self, antecessor, suscessor, valor=None): Conecta os vrtices v1 e v2 em G com valor associado - def ValorDaConexao(self, antecessor, suscessor): Retorna...
Implement the Python class `DigrafoValorado` described below. Class description: Implement the DigrafoValorado class. Method signatures and docstrings: - def Conecta(self, antecessor, suscessor, valor=None): Conecta os vrtices v1 e v2 em G com valor associado - def ValorDaConexao(self, antecessor, suscessor): Retorna...
7559ddc567091a7352fcf2942b57afe4351466ce
<|skeleton|> class DigrafoValorado: def Conecta(self, antecessor, suscessor, valor=None): """Conecta os vrtices v1 e v2 em G com valor associado""" <|body_0|> def ValorDaConexao(self, antecessor, suscessor): """Retorna o valor da conexo entre v1 e v2 se ela existir""" <|body_1|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DigrafoValorado: def Conecta(self, antecessor, suscessor, valor=None): """Conecta os vrtices v1 e v2 em G com valor associado""" if self.PossuiVertices([antecessor, suscessor]): arco = Arco(antecessor, suscessor, valor) self._arestas.add(arco) def ValorDaConexao(se...
the_stack_v2_python_sparse
python/Grafo/src/grafo/DigrafoValorado.py
katcipis/playground
train
0
f95ced32053371a02b13a7e58e4031bce9c3bafa
[ "result = data_types.WebTestResult('foo', ['debug'], 'Pass', 'step', 'build_id')\nresult.SetDuration(datetime.timedelta(seconds=30), datetime.timedelta(seconds=100))\nself.assertFalse(result.is_slow_result)", "result = data_types.WebTestResult('foo', ['debug'], 'Pass', 'step', 'build_id')\nresult.SetDuration(date...
<|body_start_0|> result = data_types.WebTestResult('foo', ['debug'], 'Pass', 'step', 'build_id') result.SetDuration(datetime.timedelta(seconds=30), datetime.timedelta(seconds=100)) self.assertFalse(result.is_slow_result) <|end_body_0|> <|body_start_1|> result = data_types.WebTestResult(...
WebTestResultUnittest
[ "LGPL-2.0-or-later", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-only", "GPL-1.0-or-later", "GPL-2.0-only", "LGPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-other-copyleft", "BSD-3-Clause", "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WebTestResultUnittest: def testSetDurationNotSlow(self) -> None: """Tests that setting a duration for a non-slow result works.""" <|body_0|> def testSetDurationSlow(self) -> None: """Tests that setting a duration for a slow result works.""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k_train_022263
14,588
permissive
[ { "docstring": "Tests that setting a duration for a non-slow result works.", "name": "testSetDurationNotSlow", "signature": "def testSetDurationNotSlow(self) -> None" }, { "docstring": "Tests that setting a duration for a slow result works.", "name": "testSetDurationSlow", "signature": "...
2
null
Implement the Python class `WebTestResultUnittest` described below. Class description: Implement the WebTestResultUnittest class. Method signatures and docstrings: - def testSetDurationNotSlow(self) -> None: Tests that setting a duration for a non-slow result works. - def testSetDurationSlow(self) -> None: Tests that...
Implement the Python class `WebTestResultUnittest` described below. Class description: Implement the WebTestResultUnittest class. Method signatures and docstrings: - def testSetDurationNotSlow(self) -> None: Tests that setting a duration for a non-slow result works. - def testSetDurationSlow(self) -> None: Tests that...
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
<|skeleton|> class WebTestResultUnittest: def testSetDurationNotSlow(self) -> None: """Tests that setting a duration for a non-slow result works.""" <|body_0|> def testSetDurationSlow(self) -> None: """Tests that setting a duration for a slow result works.""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WebTestResultUnittest: def testSetDurationNotSlow(self) -> None: """Tests that setting a duration for a non-slow result works.""" result = data_types.WebTestResult('foo', ['debug'], 'Pass', 'step', 'build_id') result.SetDuration(datetime.timedelta(seconds=30), datetime.timedelta(second...
the_stack_v2_python_sparse
third_party/blink/tools/blinkpy/web_tests/stale_expectation_removal/data_types_unittest.py
chromium/chromium
train
17,408
0d45420f9fe08f495301927c0b660680c93873ef
[ "formats = [(len(x), x) for x in format.split('|')]\nformats.sort()\nformats.reverse()\nformats = [x[1] for x in formats]\nself.res = [re.compile(x.replace('#', '\\\\d').replace('@', '[A-Z]')) for x in formats]", "for re_ in self.res:\n retval = re_.findall(str_)\n if retval:\n break\nreturn retval a...
<|body_start_0|> formats = [(len(x), x) for x in format.split('|')] formats.sort() formats.reverse() formats = [x[1] for x in formats] self.res = [re.compile(x.replace('#', '\\d').replace('@', '[A-Z]')) for x in formats] <|end_body_0|> <|body_start_1|> for re_ in self.re...
Utility class of PostalCode. Allows finding and splitting of postalcode in strings
PostalCodeFormat
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostalCodeFormat: """Utility class of PostalCode. Allows finding and splitting of postalcode in strings""" def __init__(self, format): """Create regexp patterns for matching""" <|body_0|> def get(self, str_): """Return the postal code from the string str_""" ...
stack_v2_sparse_classes_36k_train_022264
8,410
no_license
[ { "docstring": "Create regexp patterns for matching", "name": "__init__", "signature": "def __init__(self, format)" }, { "docstring": "Return the postal code from the string str_", "name": "get", "signature": "def get(self, str_)" }, { "docstring": "Split str_ into (postalcode, r...
3
null
Implement the Python class `PostalCodeFormat` described below. Class description: Utility class of PostalCode. Allows finding and splitting of postalcode in strings Method signatures and docstrings: - def __init__(self, format): Create regexp patterns for matching - def get(self, str_): Return the postal code from th...
Implement the Python class `PostalCodeFormat` described below. Class description: Utility class of PostalCode. Allows finding and splitting of postalcode in strings Method signatures and docstrings: - def __init__(self, format): Create regexp patterns for matching - def get(self, str_): Return the postal code from th...
1081f3a5ff8864a31b2dcd89406fac076a908e78
<|skeleton|> class PostalCodeFormat: """Utility class of PostalCode. Allows finding and splitting of postalcode in strings""" def __init__(self, format): """Create regexp patterns for matching""" <|body_0|> def get(self, str_): """Return the postal code from the string str_""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PostalCodeFormat: """Utility class of PostalCode. Allows finding and splitting of postalcode in strings""" def __init__(self, format): """Create regexp patterns for matching""" formats = [(len(x), x) for x in format.split('|')] formats.sort() formats.reverse() form...
the_stack_v2_python_sparse
extra-addons/account_banking/sepa/postalcode.py
sgeerish/sirr_production
train
0
5d34bd06a6c6d25ddb1504b9a11774fa159c88f1
[ "super(DistillLoss, self).__init__(**kw)\nself.ignore_indices = ignore_index\nself.reduction = reduction\nself.temperature = temperature\nself.mixture = mixture\nself.sm = torch.nn.Softmax(-1)\nself.logsm = torch.nn.LogSoftmax(-1)\nself.hardCE = CELoss(reduction='none', ignore_index=ignore_index, weight=weight, mod...
<|body_start_0|> super(DistillLoss, self).__init__(**kw) self.ignore_indices = ignore_index self.reduction = reduction self.temperature = temperature self.mixture = mixture self.sm = torch.nn.Softmax(-1) self.logsm = torch.nn.LogSoftmax(-1) self.hardCE = C...
Distillation (KD) loss for sequences of categorical distributions
DistillLoss
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DistillLoss: """Distillation (KD) loss for sequences of categorical distributions""" def __init__(self, weight=None, reduction='mean', ignore_index=-100, temperature=1.0, mixture=0.5, **kw): """:param ignore_index: gold ids whose time steps will be ignored :param temperature: softmax...
stack_v2_sparse_classes_36k_train_022265
20,169
permissive
[ { "docstring": ":param ignore_index: gold ids whose time steps will be ignored :param temperature: softmax temperature (!: will not be applied if soft_gold_mode is not \"logits\") :param mixture: mixing portion of soft and hard gold (1 => only soft kl, 0 => only hard ce) :param kw:", "name": "__init__", ...
2
stack_v2_sparse_classes_30k_val_000714
Implement the Python class `DistillLoss` described below. Class description: Distillation (KD) loss for sequences of categorical distributions Method signatures and docstrings: - def __init__(self, weight=None, reduction='mean', ignore_index=-100, temperature=1.0, mixture=0.5, **kw): :param ignore_index: gold ids who...
Implement the Python class `DistillLoss` described below. Class description: Distillation (KD) loss for sequences of categorical distributions Method signatures and docstrings: - def __init__(self, weight=None, reduction='mean', ignore_index=-100, temperature=1.0, mixture=0.5, **kw): :param ignore_index: gold ids who...
8cf2e697830ef09dca40692e7d254b61f9ffdf8d
<|skeleton|> class DistillLoss: """Distillation (KD) loss for sequences of categorical distributions""" def __init__(self, weight=None, reduction='mean', ignore_index=-100, temperature=1.0, mixture=0.5, **kw): """:param ignore_index: gold ids whose time steps will be ignored :param temperature: softmax...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DistillLoss: """Distillation (KD) loss for sequences of categorical distributions""" def __init__(self, weight=None, reduction='mean', ignore_index=-100, temperature=1.0, mixture=0.5, **kw): """:param ignore_index: gold ids whose time steps will be ignored :param temperature: softmax temperature ...
the_stack_v2_python_sparse
kbcqa/method_ir/grounding/semantic_matching/qelos/loss.py
BayLee001/SkeletonKBQA
train
0
c5299f241f5cb8708a1411d24e2d406780bd89d1
[ "self.head = Node(0)\nself.tail = Node(0)\nself.head.insert(self.tail)\nself.dic = {}", "if key in self.dic:\n node = self.dic[key]\n if node.next.value == node.value + 1:\n node.next.keys.add(key)\n self.dic[key] = node.next\n node.keys.remove(key)\n if len(node.keys) == 0:\n ...
<|body_start_0|> self.head = Node(0) self.tail = Node(0) self.head.insert(self.tail) self.dic = {} <|end_body_0|> <|body_start_1|> if key in self.dic: node = self.dic[key] if node.next.value == node.value + 1: node.next.keys.add(key) ...
AllOne
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AllOne: def __init__(self): """Initialize your data structure here.""" <|body_0|> def inc(self, key: str) -> None: """Inserts a new key <Key> with value 1. Or increments an existing key by 1.""" <|body_1|> def dec(self, key: str) -> None: """Decr...
stack_v2_sparse_classes_36k_train_022266
3,186
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Inserts a new key <Key> with value 1. Or increments an existing key by 1.", "name": "inc", "signature": "def inc(self, key: str) -> None" }, { "docstrin...
5
stack_v2_sparse_classes_30k_test_001098
Implement the Python class `AllOne` described below. Class description: Implement the AllOne class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def inc(self, key: str) -> None: Inserts a new key <Key> with value 1. Or increments an existing key by 1. - def dec(self, ...
Implement the Python class `AllOne` described below. Class description: Implement the AllOne class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def inc(self, key: str) -> None: Inserts a new key <Key> with value 1. Or increments an existing key by 1. - def dec(self, ...
920b65db80031fad45d495431eda8d3fb4ef06e5
<|skeleton|> class AllOne: def __init__(self): """Initialize your data structure here.""" <|body_0|> def inc(self, key: str) -> None: """Inserts a new key <Key> with value 1. Or increments an existing key by 1.""" <|body_1|> def dec(self, key: str) -> None: """Decr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AllOne: def __init__(self): """Initialize your data structure here.""" self.head = Node(0) self.tail = Node(0) self.head.insert(self.tail) self.dic = {} def inc(self, key: str) -> None: """Inserts a new key <Key> with value 1. Or increments an existing key ...
the_stack_v2_python_sparse
hard/ex432.py
ziyuan-shen/leetcode_algorithm_python_solution
train
2
b03336620a74a6518aecba253737eb2d8fbdbc62
[ "super(Cramer, self).__init__()\nself.a = array_check(a, 1)\nself.n = int_check(n, 1)", "t = np.zeros(shape=self.a.shape, dtype=np.float)\nfor i, item in enumerate(np.nditer(t[:-self.n + 1], op_flags=['readwrite'])):\n x = self.a[i:i + self.n]\n tau = (x.mean() - self.a.mean()) / self.a.std()\n item[...]...
<|body_start_0|> super(Cramer, self).__init__() self.a = array_check(a, 1) self.n = int_check(n, 1) <|end_body_0|> <|body_start_1|> t = np.zeros(shape=self.a.shape, dtype=np.float) for i, item in enumerate(np.nditer(t[:-self.n + 1], op_flags=['readwrite'])): x = self...
Cramer mutation detection.
Cramer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cramer: """Cramer mutation detection.""" def __init__(self, a: array_like, n: int): """:param a: array_like 1-D array :param n: int testing length""" <|body_0|> def testing(self): """Slide and test. :return: class self""" <|body_1|> def t_test(self, ...
stack_v2_sparse_classes_36k_train_022267
8,892
no_license
[ { "docstring": ":param a: array_like 1-D array :param n: int testing length", "name": "__init__", "signature": "def __init__(self, a: array_like, n: int)" }, { "docstring": "Slide and test. :return: class self", "name": "testing", "signature": "def testing(self)" }, { "docstring"...
3
stack_v2_sparse_classes_30k_train_012310
Implement the Python class `Cramer` described below. Class description: Cramer mutation detection. Method signatures and docstrings: - def __init__(self, a: array_like, n: int): :param a: array_like 1-D array :param n: int testing length - def testing(self): Slide and test. :return: class self - def t_test(self, alph...
Implement the Python class `Cramer` described below. Class description: Cramer mutation detection. Method signatures and docstrings: - def __init__(self, a: array_like, n: int): :param a: array_like 1-D array :param n: int testing length - def testing(self): Slide and test. :return: class self - def t_test(self, alph...
1c8d5fbf3676dc81e9f143e93ee2564359519b11
<|skeleton|> class Cramer: """Cramer mutation detection.""" def __init__(self, a: array_like, n: int): """:param a: array_like 1-D array :param n: int testing length""" <|body_0|> def testing(self): """Slide and test. :return: class self""" <|body_1|> def t_test(self, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cramer: """Cramer mutation detection.""" def __init__(self, a: array_like, n: int): """:param a: array_like 1-D array :param n: int testing length""" super(Cramer, self).__init__() self.a = array_check(a, 1) self.n = int_check(n, 1) def testing(self): """Slide...
the_stack_v2_python_sparse
statistics/mutation.py
qliu0/PythonInAirSeaScience
train
0
c7245f2d1887a982782877f740e12a1dfac3a3d3
[ "user_auth = TokenAuthentication()\naccess = user_auth.get(request)\ntry:\n user_email = access['email']\nexcept KeyError:\n return Response('You are logged out.', status=200)\nuser = User.objects.get(email_address=user_email)\nuser_id = user.id\naudio_path = request.data['audio_path']\ndata = {'user_id': use...
<|body_start_0|> user_auth = TokenAuthentication() access = user_auth.get(request) try: user_email = access['email'] except KeyError: return Response('You are logged out.', status=200) user = User.objects.get(email_address=user_email) user_id = use...
MakeDeletePitt
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MakeDeletePitt: def post(cls, request) -> Response: """Makes a pitt :return: Response with audio's name""" <|body_0|> def delete(cls, request) -> Response: """Deletes a pitt :param request: :return: Response dict""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_022268
2,078
no_license
[ { "docstring": "Makes a pitt :return: Response with audio's name", "name": "post", "signature": "def post(cls, request) -> Response" }, { "docstring": "Deletes a pitt :param request: :return: Response dict", "name": "delete", "signature": "def delete(cls, request) -> Response" } ]
2
stack_v2_sparse_classes_30k_train_002539
Implement the Python class `MakeDeletePitt` described below. Class description: Implement the MakeDeletePitt class. Method signatures and docstrings: - def post(cls, request) -> Response: Makes a pitt :return: Response with audio's name - def delete(cls, request) -> Response: Deletes a pitt :param request: :return: R...
Implement the Python class `MakeDeletePitt` described below. Class description: Implement the MakeDeletePitt class. Method signatures and docstrings: - def post(cls, request) -> Response: Makes a pitt :return: Response with audio's name - def delete(cls, request) -> Response: Deletes a pitt :param request: :return: R...
4ae72142e792c3295781e5e6a95caf3854d18c6f
<|skeleton|> class MakeDeletePitt: def post(cls, request) -> Response: """Makes a pitt :return: Response with audio's name""" <|body_0|> def delete(cls, request) -> Response: """Deletes a pitt :param request: :return: Response dict""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MakeDeletePitt: def post(cls, request) -> Response: """Makes a pitt :return: Response with audio's name""" user_auth = TokenAuthentication() access = user_auth.get(request) try: user_email = access['email'] except KeyError: return Response('You a...
the_stack_v2_python_sparse
src/api_client/views/make_delete_pitt_view.py
alexfurmenkov/backend-2019-trainee-sync
train
0
c13c192f178dfb0d0c158247284aed57359fdc9b
[ "url = utils.urljoin(self.base_path, self.id, 'aggregates')\nmicroversion = self._get_microversion(session, action='fetch')\nresponse = session.get(url, microversion=microversion)\nexceptions.raise_from_response(response)\ndata = response.json()\nupdates = {'aggregates': data['aggregates']}\nif utils.supports_micro...
<|body_start_0|> url = utils.urljoin(self.base_path, self.id, 'aggregates') microversion = self._get_microversion(session, action='fetch') response = session.get(url, microversion=microversion) exceptions.raise_from_response(response) data = response.json() updates = {'ag...
ResourceProvider
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResourceProvider: def fetch_aggregates(self, session): """List aggregates set on the resource provider :param session: The session to use for making this request :return: The resource provider with aggregates populated""" <|body_0|> def set_aggregates(self, session, aggregat...
stack_v2_sparse_classes_36k_train_022269
4,067
permissive
[ { "docstring": "List aggregates set on the resource provider :param session: The session to use for making this request :return: The resource provider with aggregates populated", "name": "fetch_aggregates", "signature": "def fetch_aggregates(self, session)" }, { "docstring": "Replaces aggregates...
2
null
Implement the Python class `ResourceProvider` described below. Class description: Implement the ResourceProvider class. Method signatures and docstrings: - def fetch_aggregates(self, session): List aggregates set on the resource provider :param session: The session to use for making this request :return: The resource...
Implement the Python class `ResourceProvider` described below. Class description: Implement the ResourceProvider class. Method signatures and docstrings: - def fetch_aggregates(self, session): List aggregates set on the resource provider :param session: The session to use for making this request :return: The resource...
d474eb84c605c429bb9cccb166cabbdd1654d73c
<|skeleton|> class ResourceProvider: def fetch_aggregates(self, session): """List aggregates set on the resource provider :param session: The session to use for making this request :return: The resource provider with aggregates populated""" <|body_0|> def set_aggregates(self, session, aggregat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResourceProvider: def fetch_aggregates(self, session): """List aggregates set on the resource provider :param session: The session to use for making this request :return: The resource provider with aggregates populated""" url = utils.urljoin(self.base_path, self.id, 'aggregates') micro...
the_stack_v2_python_sparse
openstack/placement/v1/resource_provider.py
openstack/openstacksdk
train
124
e5e8f20f1c2d992ca4e010d7fda8c7b3a97f46c0
[ "assert len(images) == 2, AttributeError('Can stitch only two images')\nself.images = images\nself.nfeatures = nfeatures\nself.details = details\nself.keypoints = []\nself.descriptors = []\nself.good_matches = []", "orb = ORB_create(nfeatures=self.nfeatures)\nkeypoints1, descriptors1 = orb.detectAndCompute(self.i...
<|body_start_0|> assert len(images) == 2, AttributeError('Can stitch only two images') self.images = images self.nfeatures = nfeatures self.details = details self.keypoints = [] self.descriptors = [] self.good_matches = [] <|end_body_0|> <|body_start_1|> ...
The Stitcher class implements manual stitching between two images. Panorama (stitch) algorithm: - Detect keypoints and descriptors. - Detect a set of matching points that is present in both images (overlapping area). - Apply the RANSAC method to improve the matching process detection. - Apply perspective transformation...
Stitcher
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Stitcher: """The Stitcher class implements manual stitching between two images. Panorama (stitch) algorithm: - Detect keypoints and descriptors. - Detect a set of matching points that is present in both images (overlapping area). - Apply the RANSAC method to improve the matching process detection...
stack_v2_sparse_classes_36k_train_022270
6,130
permissive
[ { "docstring": "Create a new Stitcher instance. :param images: The two images to stitch :type images: list :param nfeatures: The maximum number of features to be detected in each image :type nfeatures: int :param details: The flag to indicate whether show keypoints or not :type details: bool", "name": "__in...
5
stack_v2_sparse_classes_30k_train_003442
Implement the Python class `Stitcher` described below. Class description: The Stitcher class implements manual stitching between two images. Panorama (stitch) algorithm: - Detect keypoints and descriptors. - Detect a set of matching points that is present in both images (overlapping area). - Apply the RANSAC method to...
Implement the Python class `Stitcher` described below. Class description: The Stitcher class implements manual stitching between two images. Panorama (stitch) algorithm: - Detect keypoints and descriptors. - Detect a set of matching points that is present in both images (overlapping area). - Apply the RANSAC method to...
5613440dc04140845600b8c37a2b28786d504815
<|skeleton|> class Stitcher: """The Stitcher class implements manual stitching between two images. Panorama (stitch) algorithm: - Detect keypoints and descriptors. - Detect a set of matching points that is present in both images (overlapping area). - Apply the RANSAC method to improve the matching process detection...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Stitcher: """The Stitcher class implements manual stitching between two images. Panorama (stitch) algorithm: - Detect keypoints and descriptors. - Detect a set of matching points that is present in both images (overlapping area). - Apply the RANSAC method to improve the matching process detection. - Apply per...
the_stack_v2_python_sparse
src/panorama/stitcher.py
vmariiechko/python-image-processing
train
2
8e15159a1d1f72f24f04bba85111ed10c5f38789
[ "try:\n return KnowAudio.objects.filter(knowledge=int(self.kwargs['pk']))\nexcept:\n return KnowAudio.objects.all()", "instance = self.get_queryset()\nserializer = self.get_serializer(instance, many=True)\nreturn Response(serializer.data)" ]
<|body_start_0|> try: return KnowAudio.objects.filter(knowledge=int(self.kwargs['pk'])) except: return KnowAudio.objects.all() <|end_body_0|> <|body_start_1|> instance = self.get_queryset() serializer = self.get_serializer(instance, many=True) return Resp...
知识点音频
KnowledgeAudioViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KnowledgeAudioViewSet: """知识点音频""" def get_queryset(self): """获取知识点音频 根据知识点id查询音频 :return:""" <|body_0|> def retrieve(self, request, *args, **kwargs): """url请求 http://127.0.0.1:8000/know_audio/1/ 其中的1代表知识点的id号 返回该知识点对应的所有音频 :param request: :param args: :param kwa...
stack_v2_sparse_classes_36k_train_022271
7,211
no_license
[ { "docstring": "获取知识点音频 根据知识点id查询音频 :return:", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "url请求 http://127.0.0.1:8000/know_audio/1/ 其中的1代表知识点的id号 返回该知识点对应的所有音频 :param request: :param args: :param kwargs: :return:", "name": "retrieve", "signature": "d...
2
stack_v2_sparse_classes_30k_train_002668
Implement the Python class `KnowledgeAudioViewSet` described below. Class description: 知识点音频 Method signatures and docstrings: - def get_queryset(self): 获取知识点音频 根据知识点id查询音频 :return: - def retrieve(self, request, *args, **kwargs): url请求 http://127.0.0.1:8000/know_audio/1/ 其中的1代表知识点的id号 返回该知识点对应的所有音频 :param request: :p...
Implement the Python class `KnowledgeAudioViewSet` described below. Class description: 知识点音频 Method signatures and docstrings: - def get_queryset(self): 获取知识点音频 根据知识点id查询音频 :return: - def retrieve(self, request, *args, **kwargs): url请求 http://127.0.0.1:8000/know_audio/1/ 其中的1代表知识点的id号 返回该知识点对应的所有音频 :param request: :p...
9205dfd8dd0c822a9f5352db845fc12c319db3e3
<|skeleton|> class KnowledgeAudioViewSet: """知识点音频""" def get_queryset(self): """获取知识点音频 根据知识点id查询音频 :return:""" <|body_0|> def retrieve(self, request, *args, **kwargs): """url请求 http://127.0.0.1:8000/know_audio/1/ 其中的1代表知识点的id号 返回该知识点对应的所有音频 :param request: :param args: :param kwa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KnowledgeAudioViewSet: """知识点音频""" def get_queryset(self): """获取知识点音频 根据知识点id查询音频 :return:""" try: return KnowAudio.objects.filter(knowledge=int(self.kwargs['pk'])) except: return KnowAudio.objects.all() def retrieve(self, request, *args, **kwargs): ...
the_stack_v2_python_sparse
apps/library/views.py
bbright3493/gz_v1.0.0
train
0
df7cef20f8b60fcdc1f4c6921d6ce09472a6535b
[ "serializer = HttpUserSerializer(request.user)\nresponse = serializer.data\nresponse['token'] = _get_auth_token(request.user)\nreturn Response(JSONRenderer().render(response), status=status.HTTP_200_OK)", "serializer = UserAccountUpdateSerializer(instance=request.user, data=request.data)\nserializer.is_valid(rais...
<|body_start_0|> serializer = HttpUserSerializer(request.user) response = serializer.data response['token'] = _get_auth_token(request.user) return Response(JSONRenderer().render(response), status=status.HTTP_200_OK) <|end_body_0|> <|body_start_1|> serializer = UserAccountUpdateS...
AccountView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountView: def get(self, request): """Retrieves account information.""" <|body_0|> def put(self, request): """Updates account information from request data.""" <|body_1|> <|end_skeleton|> <|body_start_0|> serializer = HttpUserSerializer(request.us...
stack_v2_sparse_classes_36k_train_022272
10,874
no_license
[ { "docstring": "Retrieves account information.", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Updates account information from request data.", "name": "put", "signature": "def put(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_018179
Implement the Python class `AccountView` described below. Class description: Implement the AccountView class. Method signatures and docstrings: - def get(self, request): Retrieves account information. - def put(self, request): Updates account information from request data.
Implement the Python class `AccountView` described below. Class description: Implement the AccountView class. Method signatures and docstrings: - def get(self, request): Retrieves account information. - def put(self, request): Updates account information from request data. <|skeleton|> class AccountView: def ge...
4cbf70e66c49087498b6bf58971ad58b8330994d
<|skeleton|> class AccountView: def get(self, request): """Retrieves account information.""" <|body_0|> def put(self, request): """Updates account information from request data.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccountView: def get(self, request): """Retrieves account information.""" serializer = HttpUserSerializer(request.user) response = serializer.data response['token'] = _get_auth_token(request.user) return Response(JSONRenderer().render(response), status=status.HTTP_200_O...
the_stack_v2_python_sparse
ETWeb/accounts/api/views.py
adarsharegmi/employeeMS
train
1
5bf3a626ae092b2fe0d1c2d8623b2609f9d3e34d
[ "if not head:\n return None\nself.head = None\nself.reverse_recur(head)\nreturn self.head", "if not node:\n return\nhead = ListNode(node.val)\nhead.next = self.head\nself.head = head\nself.reverse_recur(node.next)" ]
<|body_start_0|> if not head: return None self.head = None self.reverse_recur(head) return self.head <|end_body_0|> <|body_start_1|> if not node: return head = ListNode(node.val) head.next = self.head self.head = head self....
Solution2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution2: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def reverse_recur(self, node): """:type node: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not head: return No...
stack_v2_sparse_classes_36k_train_022273
1,997
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "reverseList", "signature": "def reverseList(self, head)" }, { "docstring": ":type node: ListNode :rtype: ListNode", "name": "reverse_recur", "signature": "def reverse_recur(self, node)" } ]
2
stack_v2_sparse_classes_30k_train_016856
Implement the Python class `Solution2` described below. Class description: Implement the Solution2 class. Method signatures and docstrings: - def reverseList(self, head): :type head: ListNode :rtype: ListNode - def reverse_recur(self, node): :type node: ListNode :rtype: ListNode
Implement the Python class `Solution2` described below. Class description: Implement the Solution2 class. Method signatures and docstrings: - def reverseList(self, head): :type head: ListNode :rtype: ListNode - def reverse_recur(self, node): :type node: ListNode :rtype: ListNode <|skeleton|> class Solution2: de...
f832227c4d0e0b1c0cc326561187004ef24e2a68
<|skeleton|> class Solution2: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def reverse_recur(self, node): """:type node: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution2: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" if not head: return None self.head = None self.reverse_recur(head) return self.head def reverse_recur(self, node): """:type node: ListNode :rtype: ListNode""" ...
the_stack_v2_python_sparse
206.py
Gackle/leetcode_practice
train
0
80b2c664bf95039f3f1c8abb460ba7dc04c81b88
[ "hue_limit = _check_and_convert_limit_value(hue_limit, None, 0)\nsaturation_limit = _check_and_convert_limit_value(saturation_limit)\nvalue_limit = _check_and_convert_limit_value(value_limit)\nself.hsv = ops.Hsv(device='gpu')\nself.hue_uniform = ops.Uniform(range=hue_limit)\nself.saturation_uniform = ops.Uniform(ra...
<|body_start_0|> hue_limit = _check_and_convert_limit_value(hue_limit, None, 0) saturation_limit = _check_and_convert_limit_value(saturation_limit) value_limit = _check_and_convert_limit_value(value_limit) self.hsv = ops.Hsv(device='gpu') self.hue_uniform = ops.Uniform(range=hue_...
Randomly performs HSV manipulation. To change hue, saturation and/or value of the image, pass corresponding coefficients. Keep in mind, that hue has additive delta argument, while for saturation and value they are multiplicative.
RandomHueSaturationValue
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomHueSaturationValue: """Randomly performs HSV manipulation. To change hue, saturation and/or value of the image, pass corresponding coefficients. Keep in mind, that hue has additive delta argument, while for saturation and value they are multiplicative.""" def __init__(self, p: float=0....
stack_v2_sparse_classes_36k_train_022274
22,608
no_license
[ { "docstring": "Initialization Args: p (float, optional): Probability to apply this transformation. Defaults to .5. hue_limit (Union[List,float], optional): Range for changing hue in [min,max] value format. If provided as a single float, the range will be (-limit, limit). Defaults to 20.. saturation_limit (Unio...
2
stack_v2_sparse_classes_30k_train_015826
Implement the Python class `RandomHueSaturationValue` described below. Class description: Randomly performs HSV manipulation. To change hue, saturation and/or value of the image, pass corresponding coefficients. Keep in mind, that hue has additive delta argument, while for saturation and value they are multiplicative....
Implement the Python class `RandomHueSaturationValue` described below. Class description: Randomly performs HSV manipulation. To change hue, saturation and/or value of the image, pass corresponding coefficients. Keep in mind, that hue has additive delta argument, while for saturation and value they are multiplicative....
1532db8447d03e75d5ec26f93111270a4ccb7a7e
<|skeleton|> class RandomHueSaturationValue: """Randomly performs HSV manipulation. To change hue, saturation and/or value of the image, pass corresponding coefficients. Keep in mind, that hue has additive delta argument, while for saturation and value they are multiplicative.""" def __init__(self, p: float=0....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomHueSaturationValue: """Randomly performs HSV manipulation. To change hue, saturation and/or value of the image, pass corresponding coefficients. Keep in mind, that hue has additive delta argument, while for saturation and value they are multiplicative.""" def __init__(self, p: float=0.5, hue_limit:...
the_stack_v2_python_sparse
src/development/vortex/development/utils/data/augment/modules/nvidia_dali/modules.py
jesslynsepthiaa/vortex
train
0
5a79ae9a7a59f3365740a0fdf8a389177daa53cb
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AppleManagedIdentityProvider()", "from .identity_provider_base import IdentityProviderBase\nfrom .identity_provider_base import IdentityProviderBase\nfields: Dict[str, Callable[[Any], None]] = {'certificateData': lambda n: setattr(self...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return AppleManagedIdentityProvider() <|end_body_0|> <|body_start_1|> from .identity_provider_base import IdentityProviderBase from .identity_provider_base import IdentityProviderBase f...
AppleManagedIdentityProvider
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AppleManagedIdentityProvider: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AppleManagedIdentityProvider: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value...
stack_v2_sparse_classes_36k_train_022275
2,952
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: AppleManagedIdentityProvider", "name": "create_from_discriminator_value", "signature": "def create_from_disc...
3
stack_v2_sparse_classes_30k_train_015118
Implement the Python class `AppleManagedIdentityProvider` described below. Class description: Implement the AppleManagedIdentityProvider class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AppleManagedIdentityProvider: Creates a new instance of the a...
Implement the Python class `AppleManagedIdentityProvider` described below. Class description: Implement the AppleManagedIdentityProvider class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AppleManagedIdentityProvider: Creates a new instance of the a...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class AppleManagedIdentityProvider: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AppleManagedIdentityProvider: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AppleManagedIdentityProvider: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AppleManagedIdentityProvider: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create th...
the_stack_v2_python_sparse
msgraph/generated/models/apple_managed_identity_provider.py
microsoftgraph/msgraph-sdk-python
train
135
52bbfc6a0c577ad69c1e9504cd0d9ff5ed751616
[ "with open(trainTextNLTK4russian, encoding='utf-8') as f:\n sents = list(read_corpus_to_nltk(f))\ncontextTegger = PMContextTagger(train=sents, type_='full')\ngraphemAnaliz = GraphematicAnalysis(textOriginal)\ntextTokenz = graphemAnaliz.get_sentences()\ntagsDict = contextTegger.tag(textTokenz)\ntokenPosList = sel...
<|body_start_0|> with open(trainTextNLTK4russian, encoding='utf-8') as f: sents = list(read_corpus_to_nltk(f)) contextTegger = PMContextTagger(train=sents, type_='full') graphemAnaliz = GraphematicAnalysis(textOriginal) textTokenz = graphemAnaliz.get_sentences() tagsD...
Класс текстового анализа. Включает в себя морфологию и синтаксис
TextAnalysis
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextAnalysis: """Класс текстового анализа. Включает в себя морфологию и синтаксис""" def morph_analysis(self, trainTextNLTK4russian, textOriginal, rusTag=False): """Морфологический анализ текста :param trainTextNLTK4russian: текст с табцляциями для тренировки модели :param textOrigin...
stack_v2_sparse_classes_36k_train_022276
4,012
no_license
[ { "docstring": "Морфологический анализ текста :param trainTextNLTK4russian: текст с табцляциями для тренировки модели :param textOriginal: путь к файлу с текстом :return: список tag pymorphy", "name": "morph_analysis", "signature": "def morph_analysis(self, trainTextNLTK4russian, textOriginal, rusTag=Fa...
3
null
Implement the Python class `TextAnalysis` described below. Class description: Класс текстового анализа. Включает в себя морфологию и синтаксис Method signatures and docstrings: - def morph_analysis(self, trainTextNLTK4russian, textOriginal, rusTag=False): Морфологический анализ текста :param trainTextNLTK4russian: те...
Implement the Python class `TextAnalysis` described below. Class description: Класс текстового анализа. Включает в себя морфологию и синтаксис Method signatures and docstrings: - def morph_analysis(self, trainTextNLTK4russian, textOriginal, rusTag=False): Морфологический анализ текста :param trainTextNLTK4russian: те...
94337c6a3ea113285bd1ffb7bb891c1c4fed90e6
<|skeleton|> class TextAnalysis: """Класс текстового анализа. Включает в себя морфологию и синтаксис""" def morph_analysis(self, trainTextNLTK4russian, textOriginal, rusTag=False): """Морфологический анализ текста :param trainTextNLTK4russian: текст с табцляциями для тренировки модели :param textOrigin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TextAnalysis: """Класс текстового анализа. Включает в себя морфологию и синтаксис""" def morph_analysis(self, trainTextNLTK4russian, textOriginal, rusTag=False): """Морфологический анализ текста :param trainTextNLTK4russian: текст с табцляциями для тренировки модели :param textOriginal: путь к фа...
the_stack_v2_python_sparse
parsing/TextAnalysis.py
Ameise-github/WordProcessing
train
0
d588aa76e6abacd044c38036a98d0974d9634855
[ "def dfs(target):\n if target == 0:\n self.ans += 1\n for i in range(len(nums)):\n if nums[i] <= target:\n dfs(target - nums[i])\nnums.sort()\nself.ans = 0\ndfs(target)\nreturn self.ans", "nums.sort()\ndp = [1]\ni = 1\nwhile i <= target:\n count = 0\n for n in nums:\n i...
<|body_start_0|> def dfs(target): if target == 0: self.ans += 1 for i in range(len(nums)): if nums[i] <= target: dfs(target - nums[i]) nums.sort() self.ans = 0 dfs(target) return self.ans <|end_body_0|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def combinationSum4dfs(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def combinationSum4(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_022277
962
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "combinationSum4dfs", "signature": "def combinationSum4dfs(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "combinationSum4", "signature": "def combinationS...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum4dfs(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def combinationSum4(self, nums, target): :type nums: List[int] :type target: int...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum4dfs(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def combinationSum4(self, nums, target): :type nums: List[int] :type target: int...
ab49373ff3fc306a03a90de02e1801b8cbe520d7
<|skeleton|> class Solution: def combinationSum4dfs(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def combinationSum4(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def combinationSum4dfs(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" def dfs(target): if target == 0: self.ans += 1 for i in range(len(nums)): if nums[i] <= target: dfs(target...
the_stack_v2_python_sparse
finished/377.py
yiguid/LeetCodePractise
train
0
683aa450de08efbc5807f226a4e7b562771af962
[ "self._trait = trait\nself._obj = obj\nself._name = name", "obj = self._obj\nname = self._name\nself._trait.validate(obj, name, payload)\nobj.trait_property_changed(name, None, payload)" ]
<|body_start_0|> self._trait = trait self._obj = obj self._name = name <|end_body_0|> <|body_start_1|> obj = self._obj name = self._name self._trait.validate(obj, name, payload) obj.trait_property_changed(name, None, payload) <|end_body_1|>
A thin object which is used to dispatch a notification for an EnamlEvent. Instances of this class are callable with at most one argument, which will be the payload of the event. Instances of this dispatcher should not be held onto, since they maintain a strong reference to the underlying object.
EnamlEventDispatcher
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnamlEventDispatcher: """A thin object which is used to dispatch a notification for an EnamlEvent. Instances of this class are callable with at most one argument, which will be the payload of the event. Instances of this dispatcher should not be held onto, since they maintain a strong reference t...
stack_v2_sparse_classes_36k_train_022278
20,546
permissive
[ { "docstring": "Initialize an event dispatcher. Parameters ---------- trait : Instance(TraitType) The trait type instance on which validate will be called with the event payload. obj : Instance(HasTraits) The HasTraits object on which the event is being emitted. name : string The name of the event being emitted...
2
null
Implement the Python class `EnamlEventDispatcher` described below. Class description: A thin object which is used to dispatch a notification for an EnamlEvent. Instances of this class are callable with at most one argument, which will be the payload of the event. Instances of this dispatcher should not be held onto, s...
Implement the Python class `EnamlEventDispatcher` described below. Class description: A thin object which is used to dispatch a notification for an EnamlEvent. Instances of this class are callable with at most one argument, which will be the payload of the event. Instances of this dispatcher should not be held onto, s...
96828b254ac9fdfa2e5b6b31eff93a4933cbc0aa
<|skeleton|> class EnamlEventDispatcher: """A thin object which is used to dispatch a notification for an EnamlEvent. Instances of this class are callable with at most one argument, which will be the payload of the event. Instances of this dispatcher should not be held onto, since they maintain a strong reference t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnamlEventDispatcher: """A thin object which is used to dispatch a notification for an EnamlEvent. Instances of this class are callable with at most one argument, which will be the payload of the event. Instances of this dispatcher should not be held onto, since they maintain a strong reference to the underly...
the_stack_v2_python_sparse
enaml/core/trait_types.py
agrawalprash/enaml
train
0
713bd4e449f9662e217a021f40188011afd95300
[ "self.rawdata = {}\nf = open(filename, 'r')\nheader = f.readline().strip().split(',')\nfor line in f:\n items = line.strip().split(',')\n date = re.match('(\\\\d\\\\d\\\\d\\\\d)(\\\\d\\\\d)(\\\\d\\\\d)', items[header.index('DATE')])\n year = int(date.group(1))\n month = int(date.group(2))\n day = int...
<|body_start_0|> self.rawdata = {} f = open(filename, 'r') header = f.readline().strip().split(',') for line in f: items = line.strip().split(',') date = re.match('(\\d\\d\\d\\d)(\\d\\d)(\\d\\d)', items[header.index('DATE')]) year = int(date.group(1)) ...
The collection of temperature records loaded from given csv file
Climate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Climate: """The collection of temperature records loaded from given csv file""" def __init__(self, filename): """Initialize a Climate instance, which stores the temperature records loaded from a given csv file specified by filename. Args: filename: name of the csv file (str)""" ...
stack_v2_sparse_classes_36k_train_022279
15,636
no_license
[ { "docstring": "Initialize a Climate instance, which stores the temperature records loaded from a given csv file specified by filename. Args: filename: name of the csv file (str)", "name": "__init__", "signature": "def __init__(self, filename)" }, { "docstring": "Get the daily temperatures for t...
3
null
Implement the Python class `Climate` described below. Class description: The collection of temperature records loaded from given csv file Method signatures and docstrings: - def __init__(self, filename): Initialize a Climate instance, which stores the temperature records loaded from a given csv file specified by file...
Implement the Python class `Climate` described below. Class description: The collection of temperature records loaded from given csv file Method signatures and docstrings: - def __init__(self, filename): Initialize a Climate instance, which stores the temperature records loaded from a given csv file specified by file...
46cda997697c80e6e9d1ca51218d5e8d1620eb29
<|skeleton|> class Climate: """The collection of temperature records loaded from given csv file""" def __init__(self, filename): """Initialize a Climate instance, which stores the temperature records loaded from a given csv file specified by filename. Args: filename: name of the csv file (str)""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Climate: """The collection of temperature records loaded from given csv file""" def __init__(self, filename): """Initialize a Climate instance, which stores the temperature records loaded from a given csv file specified by filename. Args: filename: name of the csv file (str)""" self.rawda...
the_stack_v2_python_sparse
MIT/MIT_60002/ProblemSets/PS5/ps5.py
mplefort/Python_Learning
train
0
6b2c4143a80df5931e14f92675e9c4bdb2ab2741
[ "super(TransformerLayer, self).__init__()\nself.attention = Attention(input_dim, head_dim, output_dim, head_num, dropout)\nself.layernorm1 = build_normalization('LN')(output_dim)\nself.dropout = dropout\nlayers = []\ndims = [output_dim] + [hidden_dim] * (mlp_num - 1) + [output_dim]\nfor i in range(mlp_num):\n la...
<|body_start_0|> super(TransformerLayer, self).__init__() self.attention = Attention(input_dim, head_dim, output_dim, head_num, dropout) self.layernorm1 = build_normalization('LN')(output_dim) self.dropout = dropout layers = [] dims = [output_dim] + [hidden_dim] * (mlp_nu...
Overview: In transformer layer, first computes entries's attention and applies a feedforward layer
TransformerLayer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerLayer: """Overview: In transformer layer, first computes entries's attention and applies a feedforward layer""" def __init__(self, input_dim: int, head_dim: int, hidden_dim: int, output_dim: int, head_num: int, mlp_num: int, dropout: nn.Module, activation: nn.Module) -> None: ...
stack_v2_sparse_classes_36k_train_022280
8,556
permissive
[ { "docstring": "Overview: Init transformer layer Arguments: - input_dim (:obj:`int`): dimension of input - head_dim (:obj:`int`): dimension of each head - hidden_dim (:obj:`int`): dimension of hidden layer in mlp - output_dim (:obj:`int`): dimension of output - head_num (:obj:`int`): number of heads for multihe...
2
null
Implement the Python class `TransformerLayer` described below. Class description: Overview: In transformer layer, first computes entries's attention and applies a feedforward layer Method signatures and docstrings: - def __init__(self, input_dim: int, head_dim: int, hidden_dim: int, output_dim: int, head_num: int, ml...
Implement the Python class `TransformerLayer` described below. Class description: Overview: In transformer layer, first computes entries's attention and applies a feedforward layer Method signatures and docstrings: - def __init__(self, input_dim: int, head_dim: int, hidden_dim: int, output_dim: int, head_num: int, ml...
eb483fa6e46602d58c8e7d2ca1e566adca28e703
<|skeleton|> class TransformerLayer: """Overview: In transformer layer, first computes entries's attention and applies a feedforward layer""" def __init__(self, input_dim: int, head_dim: int, hidden_dim: int, output_dim: int, head_num: int, mlp_num: int, dropout: nn.Module, activation: nn.Module) -> None: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TransformerLayer: """Overview: In transformer layer, first computes entries's attention and applies a feedforward layer""" def __init__(self, input_dim: int, head_dim: int, hidden_dim: int, output_dim: int, head_num: int, mlp_num: int, dropout: nn.Module, activation: nn.Module) -> None: """Overvi...
the_stack_v2_python_sparse
ding/torch_utils/network/transformer.py
shengxuesun/DI-engine
train
1
5dbc889ee969f27b6eb0448fb10647882657fe2f
[ "super().__init__(plugin, 'system database')\nself.plugins_settings_service = PluginSettingsService(project, plugin)\nself.session = project_engine(project)[1]", "session = self.session()\ntry:\n self.plugins_settings_service.reset(store=SettingValueStore.DB, session=session)\nexcept sqlalchemy.exc.Operational...
<|body_start_0|> super().__init__(plugin, 'system database') self.plugins_settings_service = PluginSettingsService(project, plugin) self.session = project_engine(project)[1] <|end_body_0|> <|body_start_1|> session = self.session() try: self.plugins_settings_service.r...
Handle removal of a plugin's settings from the system database `plugin_settings` table.
DbRemoveManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DbRemoveManager: """Handle removal of a plugin's settings from the system database `plugin_settings` table.""" def __init__(self, plugin, project): """Construct a DbRemoveManager instance.""" <|body_0|> def remove(self): """Remove the plugin's settings from the s...
stack_v2_sparse_classes_36k_train_022281
4,693
permissive
[ { "docstring": "Construct a DbRemoveManager instance.", "name": "__init__", "signature": "def __init__(self, plugin, project)" }, { "docstring": "Remove the plugin's settings from the system database `plugin_settings` table.", "name": "remove", "signature": "def remove(self)" } ]
2
null
Implement the Python class `DbRemoveManager` described below. Class description: Handle removal of a plugin's settings from the system database `plugin_settings` table. Method signatures and docstrings: - def __init__(self, plugin, project): Construct a DbRemoveManager instance. - def remove(self): Remove the plugin'...
Implement the Python class `DbRemoveManager` described below. Class description: Handle removal of a plugin's settings from the system database `plugin_settings` table. Method signatures and docstrings: - def __init__(self, plugin, project): Construct a DbRemoveManager instance. - def remove(self): Remove the plugin'...
332959c88e2f8d6dbdd7d91b56edadf8723abd2f
<|skeleton|> class DbRemoveManager: """Handle removal of a plugin's settings from the system database `plugin_settings` table.""" def __init__(self, plugin, project): """Construct a DbRemoveManager instance.""" <|body_0|> def remove(self): """Remove the plugin's settings from the s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DbRemoveManager: """Handle removal of a plugin's settings from the system database `plugin_settings` table.""" def __init__(self, plugin, project): """Construct a DbRemoveManager instance.""" super().__init__(plugin, 'system database') self.plugins_settings_service = PluginSetting...
the_stack_v2_python_sparse
src/meltano/core/plugin_location_remove.py
forestlzj/meltano
train
0
16e509d461bbcd8e35e1a729109b639bad08f2db
[ "self.method = method\nself.url = url\nself.params = params[:]\nself.body = body\nself.headers = headers.copy()\nself.timeout = timeout\nself.stream = stream\nself.follow_redirects = follow_redirects\nself._cookies = None", "if self._cookies is None:\n self._cookies = http.cookiejar.CookieJar()\nreturn self._c...
<|body_start_0|> self.method = method self.url = url self.params = params[:] self.body = body self.headers = headers.copy() self.timeout = timeout self.stream = stream self.follow_redirects = follow_redirects self._cookies = None <|end_body_0|> <|...
Request to HttpService.
HttpRequest
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HttpRequest: """Request to HttpService.""" def __init__(self, method, url, params, body, headers, timeout, stream, follow_redirects): """Arguments: |method| - HTTP method to use |url| - relative URL to the resource, without query parameters |params| - list of (key, value) pairs to pu...
stack_v2_sparse_classes_36k_train_022282
31,532
permissive
[ { "docstring": "Arguments: |method| - HTTP method to use |url| - relative URL to the resource, without query parameters |params| - list of (key, value) pairs to put into GET parameters |body| - encoded body of the request (None or str) |headers| - dict with request headers |timeout| - socket read timeout (None ...
3
stack_v2_sparse_classes_30k_train_016014
Implement the Python class `HttpRequest` described below. Class description: Request to HttpService. Method signatures and docstrings: - def __init__(self, method, url, params, body, headers, timeout, stream, follow_redirects): Arguments: |method| - HTTP method to use |url| - relative URL to the resource, without que...
Implement the Python class `HttpRequest` described below. Class description: Request to HttpService. Method signatures and docstrings: - def __init__(self, method, url, params, body, headers, timeout, stream, follow_redirects): Arguments: |method| - HTTP method to use |url| - relative URL to the resource, without que...
10cc5fdcca53e2a1690867acbe6fce099273f092
<|skeleton|> class HttpRequest: """Request to HttpService.""" def __init__(self, method, url, params, body, headers, timeout, stream, follow_redirects): """Arguments: |method| - HTTP method to use |url| - relative URL to the resource, without query parameters |params| - list of (key, value) pairs to pu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HttpRequest: """Request to HttpService.""" def __init__(self, method, url, params, body, headers, timeout, stream, follow_redirects): """Arguments: |method| - HTTP method to use |url| - relative URL to the resource, without query parameters |params| - list of (key, value) pairs to put into GET pa...
the_stack_v2_python_sparse
client/utils/net.py
luci/luci-py
train
84
e51310745e19a11f12f7db76d984da214026537b
[ "self.year = year\nself.dupersids = dupersids\nself.HIS_LOOKUPS = {2018: {'model': HospitalInpatientStays18, 'fields': {'DUPERSID', 'EVNTIDX', 'IPBEGYR', 'IPBEGMM', 'NUMNIGHX'}}, 2017: {'model': HospitalInpatientStays17, 'fields': {'DUPERSID', 'EVNTIDX', 'IPBEGYR', 'IPBEGMM', 'NUMNIGHX'}}, 2016: {'model': HospitalI...
<|body_start_0|> self.year = year self.dupersids = dupersids self.HIS_LOOKUPS = {2018: {'model': HospitalInpatientStays18, 'fields': {'DUPERSID', 'EVNTIDX', 'IPBEGYR', 'IPBEGMM', 'NUMNIGHX'}}, 2017: {'model': HospitalInpatientStays17, 'fields': {'DUPERSID', 'EVNTIDX', 'IPBEGYR', 'IPBEGMM', 'NUMN...
Queries the HospitalInpatientStays Tables. Encodes fields from strings to usable data types.
HospitalInpatientStaysEncoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HospitalInpatientStaysEncoder: """Queries the HospitalInpatientStays Tables. Encodes fields from strings to usable data types.""" def __init__(self, year, dupersids=None): """Required_Inputs: year: Year to fetch data for Optional Inputs: dupersids: list of respondent dupersids to exc...
stack_v2_sparse_classes_36k_train_022283
4,638
permissive
[ { "docstring": "Required_Inputs: year: Year to fetch data for Optional Inputs: dupersids: list of respondent dupersids to exclusively fetch data for", "name": "__init__", "signature": "def __init__(self, year, dupersids=None)" }, { "docstring": "Groups events by respondents. Stores the number of...
2
stack_v2_sparse_classes_30k_train_018429
Implement the Python class `HospitalInpatientStaysEncoder` described below. Class description: Queries the HospitalInpatientStays Tables. Encodes fields from strings to usable data types. Method signatures and docstrings: - def __init__(self, year, dupersids=None): Required_Inputs: year: Year to fetch data for Option...
Implement the Python class `HospitalInpatientStaysEncoder` described below. Class description: Queries the HospitalInpatientStays Tables. Encodes fields from strings to usable data types. Method signatures and docstrings: - def __init__(self, year, dupersids=None): Required_Inputs: year: Year to fetch data for Option...
cd98ff6b484799fc0f2f447b3945621bd013bee6
<|skeleton|> class HospitalInpatientStaysEncoder: """Queries the HospitalInpatientStays Tables. Encodes fields from strings to usable data types.""" def __init__(self, year, dupersids=None): """Required_Inputs: year: Year to fetch data for Optional Inputs: dupersids: list of respondent dupersids to exc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HospitalInpatientStaysEncoder: """Queries the HospitalInpatientStays Tables. Encodes fields from strings to usable data types.""" def __init__(self, year, dupersids=None): """Required_Inputs: year: Year to fetch data for Optional Inputs: dupersids: list of respondent dupersids to exclusively fetc...
the_stack_v2_python_sparse
meps_db/processors/encoders/hosptial_inpatient_stays_encoder.py
explore-meps/meps_dev
train
0
bc565084cf105c5b45bad5fad6f551f2c4877ba2
[ "form = RegistrationForm()\ncontext = {'form': form}\nreturn render(request, 'accounts/register.html', context)", "form = RegistrationForm(request.POST)\nif form.is_valid():\n first_name = form.cleaned_data['first_name']\n last_name = form.cleaned_data['last_name']\n phone_number = form.cleaned_data['pho...
<|body_start_0|> form = RegistrationForm() context = {'form': form} return render(request, 'accounts/register.html', context) <|end_body_0|> <|body_start_1|> form = RegistrationForm(request.POST) if form.is_valid(): first_name = form.cleaned_data['first_name'] ...
View for registration in the site.
RegisterView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegisterView: """View for registration in the site.""" def get(self, request, *args, **kwargs): """Render the register template.""" <|body_0|> def post(self, request, *args, **kwargs): """Register for new user and after create profile for him. Try to move his car...
stack_v2_sparse_classes_36k_train_022284
10,704
permissive
[ { "docstring": "Render the register template.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Register for new user and after create profile for him. Try to move his cart items to new cart.", "name": "post", "signature": "def post(self, request,...
2
null
Implement the Python class `RegisterView` described below. Class description: View for registration in the site. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Render the register template. - def post(self, request, *args, **kwargs): Register for new user and after create profile for him...
Implement the Python class `RegisterView` described below. Class description: View for registration in the site. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Render the register template. - def post(self, request, *args, **kwargs): Register for new user and after create profile for him...
cbb16fc9ab2b85232e4c05446697fc82b78bc8e4
<|skeleton|> class RegisterView: """View for registration in the site.""" def get(self, request, *args, **kwargs): """Render the register template.""" <|body_0|> def post(self, request, *args, **kwargs): """Register for new user and after create profile for him. Try to move his car...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegisterView: """View for registration in the site.""" def get(self, request, *args, **kwargs): """Render the register template.""" form = RegistrationForm() context = {'form': form} return render(request, 'accounts/register.html', context) def post(self, request, *ar...
the_stack_v2_python_sparse
shop/accounts/views.py
Anych/mila-iris
train
0
84b12c12cb1755b776b78536491abf9cd8c76c3c
[ "self.ami_creation_frequency = ami_creation_frequency\nself.create_ami_for_run = create_ami_for_run\nself.should_create_ami = should_create_ami\nself.volume_exclusion_params = volume_exclusion_params", "if dictionary is None:\n return None\nami_creation_frequency = dictionary.get('amiCreationFrequency')\ncreat...
<|body_start_0|> self.ami_creation_frequency = ami_creation_frequency self.create_ami_for_run = create_ami_for_run self.should_create_ami = should_create_ami self.volume_exclusion_params = volume_exclusion_params <|end_body_0|> <|body_start_1|> if dictionary is None: ...
Implementation of the 'AWSSnapshotManagerParams' model. TODO: type description here. Attributes: ami_creation_frequency (int): The frequency of AMI creation. This should be set if the option to create AMI is set. A value of n creates an AMI from the snapshots after every n runs. eg. n = 2 implies every alternate backup...
AWSSnapshotManagerParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AWSSnapshotManagerParams: """Implementation of the 'AWSSnapshotManagerParams' model. TODO: type description here. Attributes: ami_creation_frequency (int): The frequency of AMI creation. This should be set if the option to create AMI is set. A value of n creates an AMI from the snapshots after ev...
stack_v2_sparse_classes_36k_train_022285
3,025
permissive
[ { "docstring": "Constructor for the AWSSnapshotManagerParams class", "name": "__init__", "signature": "def __init__(self, ami_creation_frequency=None, create_ami_for_run=None, should_create_ami=None, volume_exclusion_params=None)" }, { "docstring": "Creates an instance of this model from a dicti...
2
stack_v2_sparse_classes_30k_train_008786
Implement the Python class `AWSSnapshotManagerParams` described below. Class description: Implementation of the 'AWSSnapshotManagerParams' model. TODO: type description here. Attributes: ami_creation_frequency (int): The frequency of AMI creation. This should be set if the option to create AMI is set. A value of n cre...
Implement the Python class `AWSSnapshotManagerParams` described below. Class description: Implementation of the 'AWSSnapshotManagerParams' model. TODO: type description here. Attributes: ami_creation_frequency (int): The frequency of AMI creation. This should be set if the option to create AMI is set. A value of n cre...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class AWSSnapshotManagerParams: """Implementation of the 'AWSSnapshotManagerParams' model. TODO: type description here. Attributes: ami_creation_frequency (int): The frequency of AMI creation. This should be set if the option to create AMI is set. A value of n creates an AMI from the snapshots after ev...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AWSSnapshotManagerParams: """Implementation of the 'AWSSnapshotManagerParams' model. TODO: type description here. Attributes: ami_creation_frequency (int): The frequency of AMI creation. This should be set if the option to create AMI is set. A value of n creates an AMI from the snapshots after every n runs. e...
the_stack_v2_python_sparse
cohesity_management_sdk/models/aws_snapshot_manager_params.py
cohesity/management-sdk-python
train
24
0e91ae879cfa7c931f9f1da1526fb6cc2de199b0
[ "self.delta_r_min = limits_delta_r[0]\nself.delta_r_max = limits_delta_r[1]\nself.area = area\nself.lm_class = lm_class\nself.delta_angle_min = limits_delta_angle[0]\nself.delta_angle_max = limits_delta_angle[1]\nself.n = n\nif n == 3:\n alpha = 60\n self.radius = np.sqrt(area) * np.sqrt(4.0 / (3.0 * np.sqrt(...
<|body_start_0|> self.delta_r_min = limits_delta_r[0] self.delta_r_max = limits_delta_r[1] self.area = area self.lm_class = lm_class self.delta_angle_min = limits_delta_angle[0] self.delta_angle_max = limits_delta_angle[1] self.n = n if n == 3: ...
This class implements a functor for sampling constraint parameters for 2d-polytopes with n=3,4,5 vertices. The functor takes a sample of data as input and ouputs a torch tensor with generated vertice coordinates of the polytope [x0, y0, x1, y1, ..., xn, yn]. For construction, an equilateral 2d-polytope is constructed a...
LmPolytopeRand
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LmPolytopeRand: """This class implements a functor for sampling constraint parameters for 2d-polytopes with n=3,4,5 vertices. The functor takes a sample of data as input and ouputs a torch tensor with generated vertice coordinates of the polytope [x0, y0, x1, y1, ..., xn, yn]. For construction, a...
stack_v2_sparse_classes_36k_train_022286
5,562
permissive
[ { "docstring": "Constructor for setting options. Args: area (int): Specifies the covered area of the equilateral 2d-polytope when the sampled deviations of the polar coordinates are zero. lm_class (str): Defines the landmark the polytope is constructed around. n (int): number of vertices (e.g. 3 -> triangle) li...
3
stack_v2_sparse_classes_30k_train_000182
Implement the Python class `LmPolytopeRand` described below. Class description: This class implements a functor for sampling constraint parameters for 2d-polytopes with n=3,4,5 vertices. The functor takes a sample of data as input and ouputs a torch tensor with generated vertice coordinates of the polytope [x0, y0, x1...
Implement the Python class `LmPolytopeRand` described below. Class description: This class implements a functor for sampling constraint parameters for 2d-polytopes with n=3,4,5 vertices. The functor takes a sample of data as input and ouputs a torch tensor with generated vertice coordinates of the polytope [x0, y0, x1...
3f53a4694f3c6b229679ef9014ac98573f45fd43
<|skeleton|> class LmPolytopeRand: """This class implements a functor for sampling constraint parameters for 2d-polytopes with n=3,4,5 vertices. The functor takes a sample of data as input and ouputs a torch tensor with generated vertice coordinates of the polytope [x0, y0, x1, y1, ..., xn, yn]. For construction, a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LmPolytopeRand: """This class implements a functor for sampling constraint parameters for 2d-polytopes with n=3,4,5 vertices. The functor takes a sample of data as input and ouputs a torch tensor with generated vertice coordinates of the polytope [x0, y0, x1, y1, ..., xn, yn]. For construction, an equilateral...
the_stack_v2_python_sparse
data/celeba_plugins/constr_para_generator_polytope.py
mbroso/constraintnet_facial_detect
train
0
be9a7462be4842eb8df4a3e1d834e74c8e159e3a
[ "self.crypto = crypto\nself.liveness = liveness\nself.game_instance = game_instance\nself.mailbox = mailbox\nself.agent_name = agent_name\nself.dialogues = game_instance.dialogues\nself.negotiation_behaviour = FIPABehaviour(crypto, game_instance, agent_name)", "assert message.get('performative') == FIPAMessage.Pe...
<|body_start_0|> self.crypto = crypto self.liveness = liveness self.game_instance = game_instance self.mailbox = mailbox self.agent_name = agent_name self.dialogues = game_instance.dialogues self.negotiation_behaviour = FIPABehaviour(crypto, game_instance, agent_n...
The DialogueReactions class defines the reactions of an agent in the context of a Dialogue.
DialogueReactions
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DialogueReactions: """The DialogueReactions class defines the reactions of an agent in the context of a Dialogue.""" def __init__(self, crypto: Crypto, liveness: Liveness, game_instance: GameInstance, mailbox: MailBox, agent_name: str) -> None: """Instantiate the DialogueReactions. :...
stack_v2_sparse_classes_36k_train_022287
22,792
permissive
[ { "docstring": "Instantiate the DialogueReactions. :param crypto: the crypto module :param liveness: the liveness module :param game_instance: the game instance :param mailbox: the mailbox of the agent :param agent_name: the agent name :return: None", "name": "__init__", "signature": "def __init__(self,...
5
stack_v2_sparse_classes_30k_train_013321
Implement the Python class `DialogueReactions` described below. Class description: The DialogueReactions class defines the reactions of an agent in the context of a Dialogue. Method signatures and docstrings: - def __init__(self, crypto: Crypto, liveness: Liveness, game_instance: GameInstance, mailbox: MailBox, agent...
Implement the Python class `DialogueReactions` described below. Class description: The DialogueReactions class defines the reactions of an agent in the context of a Dialogue. Method signatures and docstrings: - def __init__(self, crypto: Crypto, liveness: Liveness, game_instance: GameInstance, mailbox: MailBox, agent...
33c4aa24ca8daf26f2c8f2d2fa38d7f4bf750cfa
<|skeleton|> class DialogueReactions: """The DialogueReactions class defines the reactions of an agent in the context of a Dialogue.""" def __init__(self, crypto: Crypto, liveness: Liveness, game_instance: GameInstance, mailbox: MailBox, agent_name: str) -> None: """Instantiate the DialogueReactions. :...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DialogueReactions: """The DialogueReactions class defines the reactions of an agent in the context of a Dialogue.""" def __init__(self, crypto: Crypto, liveness: Liveness, game_instance: GameInstance, mailbox: MailBox, agent_name: str) -> None: """Instantiate the DialogueReactions. :param crypto:...
the_stack_v2_python_sparse
tac/agents/participant/v1/base/reactions.py
fetchai/agents-tac
train
30
4cf192f77e7463bb0ab2f40617e9be6afdd9fe07
[ "formatter = logging.Formatter(format_)\nroot_logger = logging.getLogger('')\nroot_logger.setLevel(logging_level)\nif stream is not None:\n Logger.__console_h = logging.StreamHandler(stream)\n Logger.__console_h.setLevel(logging_level)\n Logger.__console_h.setFormatter(formatter)\n root_logger.addHandle...
<|body_start_0|> formatter = logging.Formatter(format_) root_logger = logging.getLogger('') root_logger.setLevel(logging_level) if stream is not None: Logger.__console_h = logging.StreamHandler(stream) Logger.__console_h.setLevel(logging_level) Logger....
Logger
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Logger: def start(stream=sys.stderr, file_path=None, logging_level=logging.WARNING, format_='%(asctime)s %(levelname)s %(message)s'): """@param stream: output stream where logs are written. If C{None}, logs are not written to any stream. @param file_path: if it is not C{None}, logging me...
stack_v2_sparse_classes_36k_train_022288
1,680
permissive
[ { "docstring": "@param stream: output stream where logs are written. If C{None}, logs are not written to any stream. @param file_path: if it is not C{None}, logging messages are written not only to the stream, but to the specified file as well. @param logging_level: logging level accepted by logging devices", ...
2
stack_v2_sparse_classes_30k_train_019619
Implement the Python class `Logger` described below. Class description: Implement the Logger class. Method signatures and docstrings: - def start(stream=sys.stderr, file_path=None, logging_level=logging.WARNING, format_='%(asctime)s %(levelname)s %(message)s'): @param stream: output stream where logs are written. If ...
Implement the Python class `Logger` described below. Class description: Implement the Logger class. Method signatures and docstrings: - def start(stream=sys.stderr, file_path=None, logging_level=logging.WARNING, format_='%(asctime)s %(levelname)s %(message)s'): @param stream: output stream where logs are written. If ...
f0120f6dadf88dc8b0250a9825593d0fb41b1a01
<|skeleton|> class Logger: def start(stream=sys.stderr, file_path=None, logging_level=logging.WARNING, format_='%(asctime)s %(levelname)s %(message)s'): """@param stream: output stream where logs are written. If C{None}, logs are not written to any stream. @param file_path: if it is not C{None}, logging me...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Logger: def start(stream=sys.stderr, file_path=None, logging_level=logging.WARNING, format_='%(asctime)s %(levelname)s %(message)s'): """@param stream: output stream where logs are written. If C{None}, logs are not written to any stream. @param file_path: if it is not C{None}, logging messages are wri...
the_stack_v2_python_sparse
concurrent_tree_crawler/common/logger.py
pombredanne/tree_crawler
train
0
377682c9e234a8da72d3c1a28a6ddbf1846f0b22
[ "self.list_of_all_labels = find_all_labels(list(frecords()), get_labels_of_record)\nself.k_list = k_list\nPRINTER('[MlKnnFractionalEnsembledStrongest: init] labels: ' + str(self.list_of_all_labels))\nPRINTER('[MlKnnFractionalEnsembledStrongest: init]: START OF TRAINING...')\nself.mlknn_fractionals = {}\nfor k in se...
<|body_start_0|> self.list_of_all_labels = find_all_labels(list(frecords()), get_labels_of_record) self.k_list = k_list PRINTER('[MlKnnFractionalEnsembledStrongest: init] labels: ' + str(self.list_of_all_labels)) PRINTER('[MlKnnFractionalEnsembledStrongest: init]: START OF TRAINING...') ...
@deprecated: use MlknnTEnsembled instead. Naive Bayes with KNN as features. Modification of a classifier based on a publication: Ml-knn: A Lazy Learning Approach to Multi-Label Learning Min-Ling Zhang, Zhi-Hua Zhou. A threshold is being chosen for each class, maximizing the f-measure. Ensemble of such MlKnn's is create...
MlKnnFractionalEnsembledStrongest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MlKnnFractionalEnsembledStrongest: """@deprecated: use MlknnTEnsembled instead. Naive Bayes with KNN as features. Modification of a classifier based on a publication: Ml-knn: A Lazy Learning Approach to Multi-Label Learning Min-Ling Zhang, Zhi-Hua Zhou. A threshold is being chosen for each class,...
stack_v2_sparse_classes_36k_train_022289
4,279
no_license
[ { "docstring": "Constructor. @type frecords: list of records @param frecords: used to calculate parameters (probabilities) and nearest neighbours amongst the records it returns; NOTE: if a user wants to manipulate, which codes to consider(e.g. higher or lower level) it is good to give a specific frecords parame...
2
stack_v2_sparse_classes_30k_train_018524
Implement the Python class `MlKnnFractionalEnsembledStrongest` described below. Class description: @deprecated: use MlknnTEnsembled instead. Naive Bayes with KNN as features. Modification of a classifier based on a publication: Ml-knn: A Lazy Learning Approach to Multi-Label Learning Min-Ling Zhang, Zhi-Hua Zhou. A th...
Implement the Python class `MlKnnFractionalEnsembledStrongest` described below. Class description: @deprecated: use MlknnTEnsembled instead. Naive Bayes with KNN as features. Modification of a classifier based on a publication: Ml-knn: A Lazy Learning Approach to Multi-Label Learning Min-Ling Zhang, Zhi-Hua Zhou. A th...
e38508de91f8a7bda3096c6f0a361734207357a5
<|skeleton|> class MlKnnFractionalEnsembledStrongest: """@deprecated: use MlknnTEnsembled instead. Naive Bayes with KNN as features. Modification of a classifier based on a publication: Ml-knn: A Lazy Learning Approach to Multi-Label Learning Min-Ling Zhang, Zhi-Hua Zhou. A threshold is being chosen for each class,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MlKnnFractionalEnsembledStrongest: """@deprecated: use MlknnTEnsembled instead. Naive Bayes with KNN as features. Modification of a classifier based on a publication: Ml-knn: A Lazy Learning Approach to Multi-Label Learning Min-Ling Zhang, Zhi-Hua Zhou. A threshold is being chosen for each class, maximizing t...
the_stack_v2_python_sparse
src/main/python/document_classification/mlknn/mlknn_ensembled_fractional.py
pszostek/research-python-backup
train
0
3155e8e8ac5ffe622d83cc7a4cb55ba226ef511e
[ "if self.current_user is None:\n return\ntry:\n execution_id = int(execution_id)\nexcept ValueError:\n self.set_status(400, 'Parameter must be an integer')\ntry:\n e = self.api_endpoint.execution_by_id(self.current_user, execution_id)\nexcept ZoeException as e:\n self.set_status(e.status_code, e.mess...
<|body_start_0|> if self.current_user is None: return try: execution_id = int(execution_id) except ValueError: self.set_status(400, 'Parameter must be an integer') try: e = self.api_endpoint.execution_by_id(self.current_user, execution_id) ...
The Execution API endpoint.
ExecutionAPI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExecutionAPI: """The Execution API endpoint.""" def get(self, execution_id): """GET a single execution by its ID.""" <|body_0|> def delete(self, execution_id: int): """Terminate an execution. :param execution_id: the execution to be terminated""" <|body_1...
stack_v2_sparse_classes_36k_train_022290
6,687
permissive
[ { "docstring": "GET a single execution by its ID.", "name": "get", "signature": "def get(self, execution_id)" }, { "docstring": "Terminate an execution. :param execution_id: the execution to be terminated", "name": "delete", "signature": "def delete(self, execution_id: int)" } ]
2
stack_v2_sparse_classes_30k_train_010533
Implement the Python class `ExecutionAPI` described below. Class description: The Execution API endpoint. Method signatures and docstrings: - def get(self, execution_id): GET a single execution by its ID. - def delete(self, execution_id: int): Terminate an execution. :param execution_id: the execution to be terminate...
Implement the Python class `ExecutionAPI` described below. Class description: The Execution API endpoint. Method signatures and docstrings: - def get(self, execution_id): GET a single execution by its ID. - def delete(self, execution_id: int): Terminate an execution. :param execution_id: the execution to be terminate...
c8e0c908af1954a8b41d0f6de23d08589564f0ab
<|skeleton|> class ExecutionAPI: """The Execution API endpoint.""" def get(self, execution_id): """GET a single execution by its ID.""" <|body_0|> def delete(self, execution_id: int): """Terminate an execution. :param execution_id: the execution to be terminated""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExecutionAPI: """The Execution API endpoint.""" def get(self, execution_id): """GET a single execution by its ID.""" if self.current_user is None: return try: execution_id = int(execution_id) except ValueError: self.set_status(400, 'Para...
the_stack_v2_python_sparse
zoe_api/rest_api/execution.py
DistributedSystemsGroup/zoe
train
60
b2335e57994164743df1ac49174db7bd7d9e9c54
[ "SeleniumService.__init__(self)\nself.engine = 'bing'\nself.URLBASE = 'http://bing.com/search?'", "params = {'q': query}\nbrowser_url = '{}{}'.format(self.URLBASE, urlencode(params))\nself.load_page(browser_url)\ntitles = list()\nurls = list()\nsnippets = list()\nresult_divs = self.browser.find_elements_by_class_...
<|body_start_0|> SeleniumService.__init__(self) self.engine = 'bing' self.URLBASE = 'http://bing.com/search?' <|end_body_0|> <|body_start_1|> params = {'q': query} browser_url = '{}{}'.format(self.URLBASE, urlencode(params)) self.load_page(browser_url) titles = l...
Specialized service for scraping bing.com search engine
BingService
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BingService: """Specialized service for scraping bing.com search engine""" def __init__(self): """Initialize virtual browser and set correct url base""" <|body_0|> def process_query(self, query): """Process query and return all titles and snippets in one list Arg...
stack_v2_sparse_classes_36k_train_022291
8,761
permissive
[ { "docstring": "Initialize virtual browser and set correct url base", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Process query and return all titles and snippets in one list Arguments: query -- query that we want to answer", "name": "process_query", "signatu...
2
stack_v2_sparse_classes_30k_train_001196
Implement the Python class `BingService` described below. Class description: Specialized service for scraping bing.com search engine Method signatures and docstrings: - def __init__(self): Initialize virtual browser and set correct url base - def process_query(self, query): Process query and return all titles and sni...
Implement the Python class `BingService` described below. Class description: Specialized service for scraping bing.com search engine Method signatures and docstrings: - def __init__(self): Initialize virtual browser and set correct url base - def process_query(self, query): Process query and return all titles and sni...
af03252e19075feec3fa478fa271ea3ae8cf8d11
<|skeleton|> class BingService: """Specialized service for scraping bing.com search engine""" def __init__(self): """Initialize virtual browser and set correct url base""" <|body_0|> def process_query(self, query): """Process query and return all titles and snippets in one list Arg...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BingService: """Specialized service for scraping bing.com search engine""" def __init__(self): """Initialize virtual browser and set correct url base""" SeleniumService.__init__(self) self.engine = 'bing' self.URLBASE = 'http://bing.com/search?' def process_query(self...
the_stack_v2_python_sparse
services/SeleniumServices.py
kubasikora/WEDT-Projekt
train
0
017005a9942002b1c99bd927dee08f8d76159a8d
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Proto file describing the Campaign Criterion service. Service to manage campaign criteria.
CampaignCriterionServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CampaignCriterionServiceServicer: """Proto file describing the Campaign Criterion service. Service to manage campaign criteria.""" def GetCampaignCriterion(self, request, context): """Returns the requested criterion in full detail.""" <|body_0|> def MutateCampaignCriteri...
stack_v2_sparse_classes_36k_train_022292
5,776
permissive
[ { "docstring": "Returns the requested criterion in full detail.", "name": "GetCampaignCriterion", "signature": "def GetCampaignCriterion(self, request, context)" }, { "docstring": "Creates, updates, or removes criteria. Operation statuses are returned.", "name": "MutateCampaignCriteria", ...
2
stack_v2_sparse_classes_30k_test_000889
Implement the Python class `CampaignCriterionServiceServicer` described below. Class description: Proto file describing the Campaign Criterion service. Service to manage campaign criteria. Method signatures and docstrings: - def GetCampaignCriterion(self, request, context): Returns the requested criterion in full det...
Implement the Python class `CampaignCriterionServiceServicer` described below. Class description: Proto file describing the Campaign Criterion service. Service to manage campaign criteria. Method signatures and docstrings: - def GetCampaignCriterion(self, request, context): Returns the requested criterion in full det...
969eff5b6c3cec59d21191fa178cffb6270074c3
<|skeleton|> class CampaignCriterionServiceServicer: """Proto file describing the Campaign Criterion service. Service to manage campaign criteria.""" def GetCampaignCriterion(self, request, context): """Returns the requested criterion in full detail.""" <|body_0|> def MutateCampaignCriteri...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CampaignCriterionServiceServicer: """Proto file describing the Campaign Criterion service. Service to manage campaign criteria.""" def GetCampaignCriterion(self, request, context): """Returns the requested criterion in full detail.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) ...
the_stack_v2_python_sparse
google/ads/google_ads/v6/proto/services/campaign_criterion_service_pb2_grpc.py
VincentFritzsche/google-ads-python
train
0
f6e43e2e6705cb23932543627f5d824a485557fa
[ "cur = head\nprev = None\nwhile cur != tail:\n next = cur.next\n cur.next = prev\n prev = cur\n cur = next\nreturn prev", "res = ListNode(0)\nres.next = head\ncur = res\nwhile head:\n tail = head\n for i in range(k):\n if tail != None:\n tail = tail.next\n else:\n ...
<|body_start_0|> cur = head prev = None while cur != tail: next = cur.next cur.next = prev prev = cur cur = next return prev <|end_body_0|> <|body_start_1|> res = ListNode(0) res.next = head cur = res while ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList(self, head, tail): """:param head: ListNode :param tail: ListNode :return: ListNode""" <|body_0|> def reverseKGroup(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_022293
1,217
no_license
[ { "docstring": ":param head: ListNode :param tail: ListNode :return: ListNode", "name": "reverseList", "signature": "def reverseList(self, head, tail)" }, { "docstring": ":type head: ListNode :type k: int :rtype: ListNode", "name": "reverseKGroup", "signature": "def reverseKGroup(self, h...
2
stack_v2_sparse_classes_30k_train_011071
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head, tail): :param head: ListNode :param tail: ListNode :return: ListNode - def reverseKGroup(self, head, k): :type head: ListNode :type k: int :rtype: Lis...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head, tail): :param head: ListNode :param tail: ListNode :return: ListNode - def reverseKGroup(self, head, k): :type head: ListNode :type k: int :rtype: Lis...
43bcf65d31f1b729ac8ca293635f46ffbe03c80b
<|skeleton|> class Solution: def reverseList(self, head, tail): """:param head: ListNode :param tail: ListNode :return: ListNode""" <|body_0|> def reverseKGroup(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList(self, head, tail): """:param head: ListNode :param tail: ListNode :return: ListNode""" cur = head prev = None while cur != tail: next = cur.next cur.next = prev prev = cur cur = next return prev ...
the_stack_v2_python_sparse
25.py
luckkyzhou/leetcode
train
0
8090abe249abd6d4b38d7e32e8ec2f29ac17084f
[ "self.places = {}\nself.transitions = {}\nself.successful_firings = []", "pn_copy = PetriNetModel()\nfor place in petri_net_model.places.values():\n pn_copy.add_place(place.tokens, place.place_id, place.label)\nfor t in petri_net_model.transitions.values():\n input_place_ids = [arc.place.place_id for arc in...
<|body_start_0|> self.places = {} self.transitions = {} self.successful_firings = [] <|end_body_0|> <|body_start_1|> pn_copy = PetriNetModel() for place in petri_net_model.places.values(): pn_copy.add_place(place.tokens, place.place_id, place.label) for t in ...
PetriNetModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PetriNetModel: def __init__(self): """Initialize an empty Petri net.""" <|body_0|> def make_copy_of(petri_net_model): """Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance of PetriNetModel to be copied""" <|body_1|> def add_pl...
stack_v2_sparse_classes_36k_train_022294
36,183
no_license
[ { "docstring": "Initialize an empty Petri net.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance of PetriNetModel to be copied", "name": "make_copy_of", "signature": "def make_copy_of(...
5
stack_v2_sparse_classes_30k_train_010205
Implement the Python class `PetriNetModel` described below. Class description: Implement the PetriNetModel class. Method signatures and docstrings: - def __init__(self): Initialize an empty Petri net. - def make_copy_of(petri_net_model): Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance o...
Implement the Python class `PetriNetModel` described below. Class description: Implement the PetriNetModel class. Method signatures and docstrings: - def __init__(self): Initialize an empty Petri net. - def make_copy_of(petri_net_model): Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance o...
8e9a3a8151069757475808c48511c9d7486ea334
<|skeleton|> class PetriNetModel: def __init__(self): """Initialize an empty Petri net.""" <|body_0|> def make_copy_of(petri_net_model): """Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance of PetriNetModel to be copied""" <|body_1|> def add_pl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PetriNetModel: def __init__(self): """Initialize an empty Petri net.""" self.places = {} self.transitions = {} self.successful_firings = [] def make_copy_of(petri_net_model): """Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance of Petri...
the_stack_v2_python_sparse
Archive/MaddyPNwithdiagrams.py
PN-Alzheimers-Parkinsons/PN_Alzheimers_Parkinsons
train
0
1880230762d092e1ce473d67bd832efe1ec825b8
[ "self.d_model = d_model\nsuper(FeatureExtractionNetwork, self).__init__()\nself.layer1 = nn.Sequential(nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.MaxPool2d(kernel_size=2, stride=2))\nself.layer2 = nn.Sequential(nn.Conv2d(64, 128, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.MaxPool2d(...
<|body_start_0|> self.d_model = d_model super(FeatureExtractionNetwork, self).__init__() self.layer1 = nn.Sequential(nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.MaxPool2d(kernel_size=2, stride=2)) self.layer2 = nn.Sequential(nn.Conv2d(64, 128, kernel_size=3, strid...
https://arxiv.org/pdf/1507.05717.pdf, VGG based feature extractor
FeatureExtractionNetwork
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureExtractionNetwork: """https://arxiv.org/pdf/1507.05717.pdf, VGG based feature extractor""" def __init__(self, d_model): """:param d_model: visual embeddings dim""" <|body_0|> def forward(self, x, source_mask=None): """:param x: :param source_mask: :return:...
stack_v2_sparse_classes_36k_train_022295
1,627
no_license
[ { "docstring": ":param d_model: visual embeddings dim", "name": "__init__", "signature": "def __init__(self, d_model)" }, { "docstring": ":param x: :param source_mask: :return:", "name": "forward", "signature": "def forward(self, x, source_mask=None)" } ]
2
stack_v2_sparse_classes_30k_train_013495
Implement the Python class `FeatureExtractionNetwork` described below. Class description: https://arxiv.org/pdf/1507.05717.pdf, VGG based feature extractor Method signatures and docstrings: - def __init__(self, d_model): :param d_model: visual embeddings dim - def forward(self, x, source_mask=None): :param x: :param ...
Implement the Python class `FeatureExtractionNetwork` described below. Class description: https://arxiv.org/pdf/1507.05717.pdf, VGG based feature extractor Method signatures and docstrings: - def __init__(self, d_model): :param d_model: visual embeddings dim - def forward(self, x, source_mask=None): :param x: :param ...
ab83a47ef2e107dd7160ea0ca1832fa0531926b7
<|skeleton|> class FeatureExtractionNetwork: """https://arxiv.org/pdf/1507.05717.pdf, VGG based feature extractor""" def __init__(self, d_model): """:param d_model: visual embeddings dim""" <|body_0|> def forward(self, x, source_mask=None): """:param x: :param source_mask: :return:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FeatureExtractionNetwork: """https://arxiv.org/pdf/1507.05717.pdf, VGG based feature extractor""" def __init__(self, d_model): """:param d_model: visual embeddings dim""" self.d_model = d_model super(FeatureExtractionNetwork, self).__init__() self.layer1 = nn.Sequential(nn...
the_stack_v2_python_sparse
src/FeatureExtractionNetwork.py
MauritsBleeker/Bi-STET
train
72
ccdef9faaa1dcc269a110be1e7b50769f4ad1e98
[ "if target.platform.name == 'android':\n message_handler.warning('using Windows to host Android deployment is untested')\n return True\nreturn super().supported_target(target, message_handler)", "vs_version = os.environ.get('VisualStudioVersion', '0.0')\nvs_major = vs_version.split('.')[0]\nif vs_major == '...
<|body_start_0|> if target.platform.name == 'android': message_handler.warning('using Windows to host Android deployment is untested') return True return super().supported_target(target, message_handler) <|end_body_0|> <|body_start_1|> vs_version = os.environ.get('Visual...
Encapsulate any Windows x86 architecture.
WindowsArchitecture
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WindowsArchitecture: """Encapsulate any Windows x86 architecture.""" def supported_target(self, target, message_handler): """Check that this architecture can host a target architecture.""" <|body_0|> def msvc_target(optional=False): """Return '32' or 64' dependin...
stack_v2_sparse_classes_36k_train_022296
23,766
permissive
[ { "docstring": "Check that this architecture can host a target architecture.", "name": "supported_target", "signature": "def supported_target(self, target, message_handler)" }, { "docstring": "Return '32' or 64' depending the architecture being targeted by MSVC and raise an exception if a suppor...
2
stack_v2_sparse_classes_30k_train_008258
Implement the Python class `WindowsArchitecture` described below. Class description: Encapsulate any Windows x86 architecture. Method signatures and docstrings: - def supported_target(self, target, message_handler): Check that this architecture can host a target architecture. - def msvc_target(optional=False): Return...
Implement the Python class `WindowsArchitecture` described below. Class description: Encapsulate any Windows x86 architecture. Method signatures and docstrings: - def supported_target(self, target, message_handler): Check that this architecture can host a target architecture. - def msvc_target(optional=False): Return...
4ed2b1b9a2407afcbffdf304020d42b81c4c8cdc
<|skeleton|> class WindowsArchitecture: """Encapsulate any Windows x86 architecture.""" def supported_target(self, target, message_handler): """Check that this architecture can host a target architecture.""" <|body_0|> def msvc_target(optional=False): """Return '32' or 64' dependin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WindowsArchitecture: """Encapsulate any Windows x86 architecture.""" def supported_target(self, target, message_handler): """Check that this architecture can host a target architecture.""" if target.platform.name == 'android': message_handler.warning('using Windows to host And...
the_stack_v2_python_sparse
note/demo/pyqt_demo/pyqtdeploy-3.3.0/pyqtdeploy/platforms.py
onsunsl/onsunsl.github.io
train
1
e46cfcd3f40f76248b8e0b88734e1db0e747a6ab
[ "init_state = np.array([1, 1])\np = [0.1, 0.2, 0.3, 0.4]\nwith QuantumTape() as tape:\n prep = qml.BasisState(init_state, wires=[0, 'a'])\n ops = [qml.RX(p[0], wires=0), qml.Rot(*p[1:], wires=0).inv(), qml.CNOT(wires=[0, 'a'])]\n m1 = qml.probs(wires=0)\n m2 = qml.probs(wires='a')\ntape.inv()\nassert ta...
<|body_start_0|> init_state = np.array([1, 1]) p = [0.1, 0.2, 0.3, 0.4] with QuantumTape() as tape: prep = qml.BasisState(init_state, wires=[0, 'a']) ops = [qml.RX(p[0], wires=0), qml.Rot(*p[1:], wires=0).inv(), qml.CNOT(wires=[0, 'a'])] m1 = qml.probs(wires=0...
Tests for tape inversion
TestInverse
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestInverse: """Tests for tape inversion""" def test_inverse(self): """Test that inversion works as expected""" <|body_0|> def test_parameter_transforms(self): """Test that inversion correctly changes trainable parameters""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_022297
49,877
permissive
[ { "docstring": "Test that inversion works as expected", "name": "test_inverse", "signature": "def test_inverse(self)" }, { "docstring": "Test that inversion correctly changes trainable parameters", "name": "test_parameter_transforms", "signature": "def test_parameter_transforms(self)" ...
2
stack_v2_sparse_classes_30k_train_016168
Implement the Python class `TestInverse` described below. Class description: Tests for tape inversion Method signatures and docstrings: - def test_inverse(self): Test that inversion works as expected - def test_parameter_transforms(self): Test that inversion correctly changes trainable parameters
Implement the Python class `TestInverse` described below. Class description: Tests for tape inversion Method signatures and docstrings: - def test_inverse(self): Test that inversion works as expected - def test_parameter_transforms(self): Test that inversion correctly changes trainable parameters <|skeleton|> class ...
0c1c805fd5dfce465a8955ee3faf81037023a23e
<|skeleton|> class TestInverse: """Tests for tape inversion""" def test_inverse(self): """Test that inversion works as expected""" <|body_0|> def test_parameter_transforms(self): """Test that inversion correctly changes trainable parameters""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestInverse: """Tests for tape inversion""" def test_inverse(self): """Test that inversion works as expected""" init_state = np.array([1, 1]) p = [0.1, 0.2, 0.3, 0.4] with QuantumTape() as tape: prep = qml.BasisState(init_state, wires=[0, 'a']) ops ...
the_stack_v2_python_sparse
artifacts/old_dataset_versions/original_commits_v02/pennylane/pennylane#1243/before/test_tape.py
MattePalte/Bugs-Quantum-Computing-Platforms
train
4
2ec247a99e66f79f4dc75cc0817e473c113075c6
[ "form = super(AjaxCreateView, self).get_form()\nif form.initial.get('part', None):\n form.fields['part'].widget = HiddenInput()\nreturn form", "initials = super(SupplierPartCreate, self).get_initial().copy()\nmanufacturer_id = self.get_param('manufacturer')\nsupplier_id = self.get_param('supplier')\npart_id = ...
<|body_start_0|> form = super(AjaxCreateView, self).get_form() if form.initial.get('part', None): form.fields['part'].widget = HiddenInput() return form <|end_body_0|> <|body_start_1|> initials = super(SupplierPartCreate, self).get_initial().copy() manufacturer_id = ...
Create view for making new SupplierPart
SupplierPartCreate
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SupplierPartCreate: """Create view for making new SupplierPart""" def get_form(self): """Create Form instance to create a new SupplierPart object. Hide some fields if they are not appropriate in context""" <|body_0|> def get_initial(self): """Provide initial data...
stack_v2_sparse_classes_36k_train_022298
12,536
permissive
[ { "docstring": "Create Form instance to create a new SupplierPart object. Hide some fields if they are not appropriate in context", "name": "get_form", "signature": "def get_form(self)" }, { "docstring": "Provide initial data for new SupplierPart: - If 'supplier_id' provided, pre-fill supplier f...
2
stack_v2_sparse_classes_30k_train_001931
Implement the Python class `SupplierPartCreate` described below. Class description: Create view for making new SupplierPart Method signatures and docstrings: - def get_form(self): Create Form instance to create a new SupplierPart object. Hide some fields if they are not appropriate in context - def get_initial(self):...
Implement the Python class `SupplierPartCreate` described below. Class description: Create view for making new SupplierPart Method signatures and docstrings: - def get_form(self): Create Form instance to create a new SupplierPart object. Hide some fields if they are not appropriate in context - def get_initial(self):...
daab81fa2cf6f3ce1760e31d8cd94951c6dffdd2
<|skeleton|> class SupplierPartCreate: """Create view for making new SupplierPart""" def get_form(self): """Create Form instance to create a new SupplierPart object. Hide some fields if they are not appropriate in context""" <|body_0|> def get_initial(self): """Provide initial data...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SupplierPartCreate: """Create view for making new SupplierPart""" def get_form(self): """Create Form instance to create a new SupplierPart object. Hide some fields if they are not appropriate in context""" form = super(AjaxCreateView, self).get_form() if form.initial.get('part', N...
the_stack_v2_python_sparse
InvenTree/company/views.py
fritzlim/InvenTree
train
1
1654c48b582aeb5fea13282b4a6b851ca6e0f326
[ "res = []\nif not root:\n return ''\nqueue = [root]\nwhile queue:\n node = queue.pop(0)\n if node != '#':\n res.append(str(node.val))\n if node.left:\n queue.append(node.left)\n else:\n queue.append('#')\n if node.right:\n queue.append(node.right...
<|body_start_0|> res = [] if not root: return '' queue = [root] while queue: node = queue.pop(0) if node != '#': res.append(str(node.val)) if node.left: queue.append(node.left) else: ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, raw_data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_022299
3,125
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, raw_data): Decodes your encoded data to tree. :type data: str :rt...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, raw_data): Decodes your encoded data to tree. :type data: str :rt...
fab9433ff7f66d00023e3af271cf309b2d481722
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, raw_data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" res = [] if not root: return '' queue = [root] while queue: node = queue.pop(0) if node != '#': res.append(str...
the_stack_v2_python_sparse
solutions/0297-serialize-and-deserialize-binary-tree/serialize-and-deserialize-binary-tree.py
moqi112358/leetcode
train
3