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
ea275596f3bf4587236334e41112bc1cf25d5e55
[ "res = 0\nfor i in range(32):\n cnt = 0\n bit = 1 << i\n for num in nums:\n if num & bit != 0:\n cnt += 1\n if cnt % 3 != 0:\n res |= bit\nreturn res - 2 ** 32 if res > 2 ** 31 - 1 else res", "two, one = (0, 0)\nfor num in nums:\n one = one ^ num & ~two\n two = two ^ num...
<|body_start_0|> res = 0 for i in range(32): cnt = 0 bit = 1 << i for num in nums: if num & bit != 0: cnt += 1 if cnt % 3 != 0: res |= bit return res - 2 ** 32 if res > 2 ** 31 - 1 else res <|end_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def CountContinuousSequence2(self, nums) -> int: """找出数组中统计除了出现3次的数据 方法:位运算 :param nums: :return: 时间复杂度O(N),空间复杂度O(1)""" <|body_0|> def CountContinuousSequence2Plus(self, nums) -> int: """使用有穷自动机来解决实际问题,此种方法比较适合当前场景,但是不是用其他的,比如n个数据出现一次的情形 :param nums: :retu...
stack_v2_sparse_classes_36k_train_001900
2,511
no_license
[ { "docstring": "找出数组中统计除了出现3次的数据 方法:位运算 :param nums: :return: 时间复杂度O(N),空间复杂度O(1)", "name": "CountContinuousSequence2", "signature": "def CountContinuousSequence2(self, nums) -> int" }, { "docstring": "使用有穷自动机来解决实际问题,此种方法比较适合当前场景,但是不是用其他的,比如n个数据出现一次的情形 :param nums: :return:", "name": "CountC...
2
stack_v2_sparse_classes_30k_train_013396
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def CountContinuousSequence2(self, nums) -> int: 找出数组中统计除了出现3次的数据 方法:位运算 :param nums: :return: 时间复杂度O(N),空间复杂度O(1) - def CountContinuousSequence2Plus(self, nums) -> int: 使用有穷自动机来...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def CountContinuousSequence2(self, nums) -> int: 找出数组中统计除了出现3次的数据 方法:位运算 :param nums: :return: 时间复杂度O(N),空间复杂度O(1) - def CountContinuousSequence2Plus(self, nums) -> int: 使用有穷自动机来...
32941ee052d0985a9569441d314378700ff4d225
<|skeleton|> class Solution: def CountContinuousSequence2(self, nums) -> int: """找出数组中统计除了出现3次的数据 方法:位运算 :param nums: :return: 时间复杂度O(N),空间复杂度O(1)""" <|body_0|> def CountContinuousSequence2Plus(self, nums) -> int: """使用有穷自动机来解决实际问题,此种方法比较适合当前场景,但是不是用其他的,比如n个数据出现一次的情形 :param nums: :retu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def CountContinuousSequence2(self, nums) -> int: """找出数组中统计除了出现3次的数据 方法:位运算 :param nums: :return: 时间复杂度O(N),空间复杂度O(1)""" res = 0 for i in range(32): cnt = 0 bit = 1 << i for num in nums: if num & bit != 0: ...
the_stack_v2_python_sparse
cecilia-python/剑指offer/chapter-1/CountContinuousSequence-2.py
Cecilia520/algorithmic-learning-leetcode
train
7
64ece293d19c8849570a7454319f54241dd14df1
[ "prod_left = [1] * len(nums)\nprod_right = [1] * len(nums)\nprod = [0] * len(nums)\nfor idx in xrange(1, len(nums)):\n prod_left[idx] = prod_left[idx - 1] * nums[idx - 1]\nfor idx in xrange(len(nums) - 2, -1, -1):\n prod_right[idx] = prod_right[idx + 1] * nums[idx + 1]\nfor idx in xrange(len(nums)):\n prod...
<|body_start_0|> prod_left = [1] * len(nums) prod_right = [1] * len(nums) prod = [0] * len(nums) for idx in xrange(1, len(nums)): prod_left[idx] = prod_left[idx - 1] * nums[idx - 1] for idx in xrange(len(nums) - 2, -1, -1): prod_right[idx] = prod_right[idx...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def productExceptSelf(self, nums): """Time: O(n) Space: O(n) https://leetcode.com/problems/product-of-array-except-self/discuss/65622/Simple-Java-solution-in-O(n)-without-extra-space https://www.geeksforgeeks.org/a-product-array-puzzle/""" <|body_0|> def productExc...
stack_v2_sparse_classes_36k_train_001901
1,846
no_license
[ { "docstring": "Time: O(n) Space: O(n) https://leetcode.com/problems/product-of-array-except-self/discuss/65622/Simple-Java-solution-in-O(n)-without-extra-space https://www.geeksforgeeks.org/a-product-array-puzzle/", "name": "productExceptSelf", "signature": "def productExceptSelf(self, nums)" }, { ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def productExceptSelf(self, nums): Time: O(n) Space: O(n) https://leetcode.com/problems/product-of-array-except-self/discuss/65622/Simple-Java-solution-in-O(n)-without-extra-spac...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def productExceptSelf(self, nums): Time: O(n) Space: O(n) https://leetcode.com/problems/product-of-array-except-self/discuss/65622/Simple-Java-solution-in-O(n)-without-extra-spac...
57212d700dfba0db4925d9d4896f7f0b9635a5b5
<|skeleton|> class Solution: def productExceptSelf(self, nums): """Time: O(n) Space: O(n) https://leetcode.com/problems/product-of-array-except-self/discuss/65622/Simple-Java-solution-in-O(n)-without-extra-space https://www.geeksforgeeks.org/a-product-array-puzzle/""" <|body_0|> def productExc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def productExceptSelf(self, nums): """Time: O(n) Space: O(n) https://leetcode.com/problems/product-of-array-except-self/discuss/65622/Simple-Java-solution-in-O(n)-without-extra-space https://www.geeksforgeeks.org/a-product-array-puzzle/""" prod_left = [1] * len(nums) prod_rig...
the_stack_v2_python_sparse
product_array_except_self.py
baloooo/coding_practice
train
0
4ab24f254559735ed001325d999afe44c7b53e39
[ "start, end = (0, len(s) - 1)\nwhile start < end:\n if not s[start].isalnum():\n start += 1\n continue\n if not s[end].isalnum():\n end -= 1\n continue\n if s[start].lower() != s[end].lower():\n return False\n start += 1\n end -= 1\nreturn True", "t = 'asdfghjklqw...
<|body_start_0|> start, end = (0, len(s) - 1) while start < end: if not s[start].isalnum(): start += 1 continue if not s[end].isalnum(): end -= 1 continue if s[start].lower() != s[end].lower(): ...
给定一个字符串,验证它是否是回文串,只考虑字母和数字字符,可以忽略字母的大小写。 说明:本题中,我们将空字符串定义为有效的回文串。 示例 1: 输入: "A man, a plan, a canal: Panama" 输出: true 示例 2: 输入: "race a car" 输出: false
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """给定一个字符串,验证它是否是回文串,只考虑字母和数字字符,可以忽略字母的大小写。 说明:本题中,我们将空字符串定义为有效的回文串。 示例 1: 输入: "A man, a plan, a canal: Panama" 输出: true 示例 2: 输入: "race a car" 输出: false""" def isPalindrome(self, s): """:type s: str :rtype: bool""" <|body_0|> def isPalindrome1(self, s): ...
stack_v2_sparse_classes_36k_train_001902
1,995
no_license
[ { "docstring": ":type s: str :rtype: bool", "name": "isPalindrome", "signature": "def isPalindrome(self, s)" }, { "docstring": ":type s: str :rtype: bool", "name": "isPalindrome1", "signature": "def isPalindrome1(self, s)" }, { "docstring": ":type s: str :rtype: bool", "name"...
3
stack_v2_sparse_classes_30k_train_017965
Implement the Python class `Solution` described below. Class description: 给定一个字符串,验证它是否是回文串,只考虑字母和数字字符,可以忽略字母的大小写。 说明:本题中,我们将空字符串定义为有效的回文串。 示例 1: 输入: "A man, a plan, a canal: Panama" 输出: true 示例 2: 输入: "race a car" 输出: false Method signatures and docstrings: - def isPalindrome(self, s): :type s: str :rtype: bool - de...
Implement the Python class `Solution` described below. Class description: 给定一个字符串,验证它是否是回文串,只考虑字母和数字字符,可以忽略字母的大小写。 说明:本题中,我们将空字符串定义为有效的回文串。 示例 1: 输入: "A man, a plan, a canal: Panama" 输出: true 示例 2: 输入: "race a car" 输出: false Method signatures and docstrings: - def isPalindrome(self, s): :type s: str :rtype: bool - de...
40bca64cf3ed2fbc670b9e2cdf4f88d6c7b68134
<|skeleton|> class Solution: """给定一个字符串,验证它是否是回文串,只考虑字母和数字字符,可以忽略字母的大小写。 说明:本题中,我们将空字符串定义为有效的回文串。 示例 1: 输入: "A man, a plan, a canal: Panama" 输出: true 示例 2: 输入: "race a car" 输出: false""" def isPalindrome(self, s): """:type s: str :rtype: bool""" <|body_0|> def isPalindrome1(self, s): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """给定一个字符串,验证它是否是回文串,只考虑字母和数字字符,可以忽略字母的大小写。 说明:本题中,我们将空字符串定义为有效的回文串。 示例 1: 输入: "A man, a plan, a canal: Panama" 输出: true 示例 2: 输入: "race a car" 输出: false""" def isPalindrome(self, s): """:type s: str :rtype: bool""" start, end = (0, len(s) - 1) while start < end: ...
the_stack_v2_python_sparse
String/five.py
okliou/lcode
train
0
0fb98998ddaeef5c4bbfdb856d3133c142f8a643
[ "qapp_id = request.GET.get('qapp_id', 0)\nqapp = Qapp.objects.get(id=qapp_id)\nform = RevisionForm({'qapp': qapp})\nctx = {'form': form, 'qapp_id': qapp_id}\nreturn render(request, self.template_name, ctx)", "form = RevisionForm(request.POST)\nqapp_id = form.data.get('qapp', '')\nqapp = Qapp.objects.filter(id=qap...
<|body_start_0|> qapp_id = request.GET.get('qapp_id', 0) qapp = Qapp.objects.get(id=qapp_id) form = RevisionForm({'qapp': qapp}) ctx = {'form': form, 'qapp_id': qapp_id} return render(request, self.template_name, ctx) <|end_body_0|> <|body_start_1|> form = RevisionForm(r...
Class for creating new Revisions of a given QAPP.
RevisionCreate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RevisionCreate: """Class for creating new Revisions of a given QAPP.""" def get(self, request, *args, **kwargs): """Return a view with an empty form for creating a new QAPP.""" <|body_0|> def post(self, request, *args, **kwargs): """Process the post request with ...
stack_v2_sparse_classes_36k_train_001903
36,787
no_license
[ { "docstring": "Return a view with an empty form for creating a new QAPP.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Process the post request with a new Project Lead form filled out.", "name": "post", "signature": "def post(self, request, *...
2
null
Implement the Python class `RevisionCreate` described below. Class description: Class for creating new Revisions of a given QAPP. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Return a view with an empty form for creating a new QAPP. - def post(self, request, *args, **kwargs): Process t...
Implement the Python class `RevisionCreate` described below. Class description: Class for creating new Revisions of a given QAPP. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Return a view with an empty form for creating a new QAPP. - def post(self, request, *args, **kwargs): Process t...
ee419afa3c9f4b9ef3b30b62b693cfac956ce5b4
<|skeleton|> class RevisionCreate: """Class for creating new Revisions of a given QAPP.""" def get(self, request, *args, **kwargs): """Return a view with an empty form for creating a new QAPP.""" <|body_0|> def post(self, request, *args, **kwargs): """Process the post request with ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RevisionCreate: """Class for creating new Revisions of a given QAPP.""" def get(self, request, *args, **kwargs): """Return a view with an empty form for creating a new QAPP.""" qapp_id = request.GET.get('qapp_id', 0) qapp = Qapp.objects.get(id=qapp_id) form = RevisionForm(...
the_stack_v2_python_sparse
DataSearch/qar5/views.py
USEPA/FoodWaste
train
1
6d38d7fb28e65289892b5df40553884525e3d46f
[ "n = len(nums)\nj = 0\nfor i in range(n):\n if nums[i] != 0:\n nums[j] = nums[i]\n j += 1\nfor i in range(j, n):\n nums[i] = 0", "n = len(nums)\nj = 0\nfor i in range(n):\n if nums[i] != 0:\n nums[i], nums[j] = (nums[j], nums[i])\n j += 1", "n = len(nums)\nleft, right = (0, ...
<|body_start_0|> n = len(nums) j = 0 for i in range(n): if nums[i] != 0: nums[j] = nums[i] j += 1 for i in range(j, n): nums[i] = 0 <|end_body_0|> <|body_start_1|> n = len(nums) j = 0 for i in range(n): ...
OfficialSolution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OfficialSolution: def move_zeroes(self, nums: List[int]) -> None: """两次遍历(双指针)。""" <|body_0|> def move_zeroes_2(self, nums: List[int]) -> None: """一次遍历(快排思想,交换元素)。""" <|body_1|> def move_zeroes_3(self, nums: List[int]) -> None: """双指针。""" ...
stack_v2_sparse_classes_36k_train_001904
3,743
no_license
[ { "docstring": "两次遍历(双指针)。", "name": "move_zeroes", "signature": "def move_zeroes(self, nums: List[int]) -> None" }, { "docstring": "一次遍历(快排思想,交换元素)。", "name": "move_zeroes_2", "signature": "def move_zeroes_2(self, nums: List[int]) -> None" }, { "docstring": "双指针。", "name": "...
3
stack_v2_sparse_classes_30k_train_005560
Implement the Python class `OfficialSolution` described below. Class description: Implement the OfficialSolution class. Method signatures and docstrings: - def move_zeroes(self, nums: List[int]) -> None: 两次遍历(双指针)。 - def move_zeroes_2(self, nums: List[int]) -> None: 一次遍历(快排思想,交换元素)。 - def move_zeroes_3(self, nums: Li...
Implement the Python class `OfficialSolution` described below. Class description: Implement the OfficialSolution class. Method signatures and docstrings: - def move_zeroes(self, nums: List[int]) -> None: 两次遍历(双指针)。 - def move_zeroes_2(self, nums: List[int]) -> None: 一次遍历(快排思想,交换元素)。 - def move_zeroes_3(self, nums: Li...
6932d69353b94ec824dd0ddc86a92453f6673232
<|skeleton|> class OfficialSolution: def move_zeroes(self, nums: List[int]) -> None: """两次遍历(双指针)。""" <|body_0|> def move_zeroes_2(self, nums: List[int]) -> None: """一次遍历(快排思想,交换元素)。""" <|body_1|> def move_zeroes_3(self, nums: List[int]) -> None: """双指针。""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OfficialSolution: def move_zeroes(self, nums: List[int]) -> None: """两次遍历(双指针)。""" n = len(nums) j = 0 for i in range(n): if nums[i] != 0: nums[j] = nums[i] j += 1 for i in range(j, n): nums[i] = 0 def move_ze...
the_stack_v2_python_sparse
0283_move-zeroes.py
Nigirimeshi/leetcode
train
0
f4662effe99b533f906a1c3edd7a65f950feda13
[ "url = await super()._api_url()\ncomponent = self._parameter('component')\nbranch = self._parameter('branch')\nmetric_keys = 'tests,test_errors,test_failures,skipped_tests'\nreturn URL(f'{url}/api/measures/component?component={component}&branch={branch}&metricKeys={metric_keys}')", "url = await super()._landing_u...
<|body_start_0|> url = await super()._api_url() component = self._parameter('component') branch = self._parameter('branch') metric_keys = 'tests,test_errors,test_failures,skipped_tests' return URL(f'{url}/api/measures/component?component={component}&branch={branch}&metricKeys={me...
SonarQube collector for the tests metric.
SonarQubeTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SonarQubeTests: """SonarQube collector for the tests metric.""" async def _api_url(self) -> URL: """Extend to add the measures path and parameters.""" <|body_0|> async def _landing_url(self, responses: SourceResponses) -> URL: """Extend to add the measures path a...
stack_v2_sparse_classes_36k_train_001905
2,318
permissive
[ { "docstring": "Extend to add the measures path and parameters.", "name": "_api_url", "signature": "async def _api_url(self) -> URL" }, { "docstring": "Extend to add the measures path and parameters.", "name": "_landing_url", "signature": "async def _landing_url(self, responses: SourceRe...
4
null
Implement the Python class `SonarQubeTests` described below. Class description: SonarQube collector for the tests metric. Method signatures and docstrings: - async def _api_url(self) -> URL: Extend to add the measures path and parameters. - async def _landing_url(self, responses: SourceResponses) -> URL: Extend to ad...
Implement the Python class `SonarQubeTests` described below. Class description: SonarQube collector for the tests metric. Method signatures and docstrings: - async def _api_url(self) -> URL: Extend to add the measures path and parameters. - async def _landing_url(self, responses: SourceResponses) -> URL: Extend to ad...
5d9952bf0bd47895824fa78428d3e4f4d6b5d9b3
<|skeleton|> class SonarQubeTests: """SonarQube collector for the tests metric.""" async def _api_url(self) -> URL: """Extend to add the measures path and parameters.""" <|body_0|> async def _landing_url(self, responses: SourceResponses) -> URL: """Extend to add the measures path a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SonarQubeTests: """SonarQube collector for the tests metric.""" async def _api_url(self) -> URL: """Extend to add the measures path and parameters.""" url = await super()._api_url() component = self._parameter('component') branch = self._parameter('branch') metric_...
the_stack_v2_python_sparse
components/collector/src/source_collectors/sonarqube/tests.py
ICTU/quality-time
train
43
38dd0bdbac31d9409157cebea6ff65cae258f1f6
[ "self.filename = filename\nself.input_queue = input_queue\nself.pcap_writer = None\nself.snaplen = 0\nself.linktype = link_type\nself.EXIT = multiprocessing.Event()\nmultiprocessing.Process.__init__(self)", "logger.debug('Destroying PCAP Writer.')\nif self.pcap_writer is not None:\n try:\n self.pcap_wri...
<|body_start_0|> self.filename = filename self.input_queue = input_queue self.pcap_writer = None self.snaplen = 0 self.linktype = link_type self.EXIT = multiprocessing.Event() multiprocessing.Process.__init__(self) <|end_body_0|> <|body_start_1|> logger.d...
Very simple class to create a pcap file from a network stream
PcapWriter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PcapWriter: """Very simple class to create a pcap file from a network stream""" def __init__(self, filename, input_queue, link_type=dpkt.pcap.DLT_EN10MB): """Initialize our pcap writer""" <|body_0|> def __del__(self): """Try to close our file nicely""" <|...
stack_v2_sparse_classes_36k_train_001906
3,619
no_license
[ { "docstring": "Initialize our pcap writer", "name": "__init__", "signature": "def __init__(self, filename, input_queue, link_type=dpkt.pcap.DLT_EN10MB)" }, { "docstring": "Try to close our file nicely", "name": "__del__", "signature": "def __del__(self)" }, { "docstring": "Read ...
4
stack_v2_sparse_classes_30k_train_013872
Implement the Python class `PcapWriter` described below. Class description: Very simple class to create a pcap file from a network stream Method signatures and docstrings: - def __init__(self, filename, input_queue, link_type=dpkt.pcap.DLT_EN10MB): Initialize our pcap writer - def __del__(self): Try to close our file...
Implement the Python class `PcapWriter` described below. Class description: Very simple class to create a pcap file from a network stream Method signatures and docstrings: - def __init__(self, filename, input_queue, link_type=dpkt.pcap.DLT_EN10MB): Initialize our pcap writer - def __del__(self): Try to close our file...
8f92c4efb94061cb08b7e9b0ff96346565c12653
<|skeleton|> class PcapWriter: """Very simple class to create a pcap file from a network stream""" def __init__(self, filename, input_queue, link_type=dpkt.pcap.DLT_EN10MB): """Initialize our pcap writer""" <|body_0|> def __del__(self): """Try to close our file nicely""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PcapWriter: """Very simple class to create a pcap file from a network stream""" def __init__(self, filename, input_queue, link_type=dpkt.pcap.DLT_EN10MB): """Initialize our pcap writer""" self.filename = filename self.input_queue = input_queue self.pcap_writer = None ...
the_stack_v2_python_sparse
python-lophi/lophi/capture/network.py
puppycodes/LO-PHI
train
0
0825ba5adc39bc7b19989b5cd1296bb86ae77b5d
[ "disambiguator = ResnikWordSenseDisambiguation()\noutput = []\nfor line in self.contexts:\n similarity = disambiguator.get_sense(line.split()[0], line.split()[1])\n output.extend(similarity.split('\\n'))\nself.assertCountEqual(output, self.expected_senses)", "disambiguator = ResnikWordSenseDisambiguation()\...
<|body_start_0|> disambiguator = ResnikWordSenseDisambiguation() output = [] for line in self.contexts: similarity = disambiguator.get_sense(line.split()[0], line.split()[1]) output.extend(similarity.split('\n')) self.assertCountEqual(output, self.expected_senses)...
This class contains tests for the ResnikWordSenseDisambiguation class
TestResnikWordSenseDisambiguation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestResnikWordSenseDisambiguation: """This class contains tests for the ResnikWordSenseDisambiguation class""" def test_get_senses(self): """Test get_sense function :return: void""" <|body_0|> def test_get_similarities(self): """Test get_similarities function :re...
stack_v2_sparse_classes_36k_train_001907
5,565
no_license
[ { "docstring": "Test get_sense function :return: void", "name": "test_get_senses", "signature": "def test_get_senses(self)" }, { "docstring": "Test get_similarities function :return: void", "name": "test_get_similarities", "signature": "def test_get_similarities(self)" } ]
2
stack_v2_sparse_classes_30k_train_003459
Implement the Python class `TestResnikWordSenseDisambiguation` described below. Class description: This class contains tests for the ResnikWordSenseDisambiguation class Method signatures and docstrings: - def test_get_senses(self): Test get_sense function :return: void - def test_get_similarities(self): Test get_simi...
Implement the Python class `TestResnikWordSenseDisambiguation` described below. Class description: This class contains tests for the ResnikWordSenseDisambiguation class Method signatures and docstrings: - def test_get_senses(self): Test get_sense function :return: void - def test_get_similarities(self): Test get_simi...
7af7b357347ed526de7a3d6f16652843d214dcbf
<|skeleton|> class TestResnikWordSenseDisambiguation: """This class contains tests for the ResnikWordSenseDisambiguation class""" def test_get_senses(self): """Test get_sense function :return: void""" <|body_0|> def test_get_similarities(self): """Test get_similarities function :re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestResnikWordSenseDisambiguation: """This class contains tests for the ResnikWordSenseDisambiguation class""" def test_get_senses(self): """Test get_sense function :return: void""" disambiguator = ResnikWordSenseDisambiguation() output = [] for line in self.contexts: ...
the_stack_v2_python_sparse
WordSenseDisambiguation/resnik_wsd.py
zoew2/Projects
train
0
85715fc84d7e01f920c17b0e897216a04aa0253a
[ "self._repo = repo\nself._directories = in_directories\nself._has_extension = partial(has_extension, extensions=extensions)\nself._is_under_directories = partial(is_under_directories, directories=in_directories)\nself._diffed_file_has_extension = partial(diffed_file_has_extension, extensions=extensions)\nself._diff...
<|body_start_0|> self._repo = repo self._directories = in_directories self._has_extension = partial(has_extension, extensions=extensions) self._is_under_directories = partial(is_under_directories, directories=in_directories) self._diffed_file_has_extension = partial(diffed_file_h...
creates a policy bundle based on: - the current state of the policy git repo - filtering criteria on the policy git repo (specific directories, specific file types, etc) there are two types of bundles: - a full/complete bundle, representing the state of the repo at one commit - a diff bundle, representing only the *cha...
BundleMaker
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BundleMaker: """creates a policy bundle based on: - the current state of the policy git repo - filtering criteria on the policy git repo (specific directories, specific file types, etc) there are two types of bundles: - a full/complete bundle, representing the state of the repo at one commit - a ...
stack_v2_sparse_classes_36k_train_001908
7,335
permissive
[ { "docstring": "[summary] Args: repo (Repo): the policy repo in_directories (Set[Path]): the directories in the repo that we want to filter on. if the entire repo is relevant, pass Path(\".\") as the directory (all paths are relative to the repo root). extensions (Optional[List[str]]): optional filtering on fil...
3
null
Implement the Python class `BundleMaker` described below. Class description: creates a policy bundle based on: - the current state of the policy git repo - filtering criteria on the policy git repo (specific directories, specific file types, etc) there are two types of bundles: - a full/complete bundle, representing t...
Implement the Python class `BundleMaker` described below. Class description: creates a policy bundle based on: - the current state of the policy git repo - filtering criteria on the policy git repo (specific directories, specific file types, etc) there are two types of bundles: - a full/complete bundle, representing t...
fd5792d741a56417c5001140629f1b6fdd273aa8
<|skeleton|> class BundleMaker: """creates a policy bundle based on: - the current state of the policy git repo - filtering criteria on the policy git repo (specific directories, specific file types, etc) there are two types of bundles: - a full/complete bundle, representing the state of the repo at one commit - a ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BundleMaker: """creates a policy bundle based on: - the current state of the policy git repo - filtering criteria on the policy git repo (specific directories, specific file types, etc) there are two types of bundles: - a full/complete bundle, representing the state of the repo at one commit - a diff bundle, ...
the_stack_v2_python_sparse
opal_common/git/bundle_maker.py
ZeChArtiahSaher/opal
train
0
8449ca1ab3c8ac167156de3a98e241348c96ce7a
[ "self._status_queue = status_queue\nself._offset = offset\nself._length = length\nself._source_url = source_url\nself._destination_url = destination_url\nself._component_number = component_number\nself._total_components = total_components\nself._operation_name = operation_name\nself._process_id = process_id\nself._...
<|body_start_0|> self._status_queue = status_queue self._offset = offset self._length = length self._source_url = source_url self._destination_url = destination_url self._component_number = component_number self._total_components = total_components self._o...
Tracks file count and bytes progress info for large file operations. Information is sent to the status_queue, which will print aggregate it for printing to the user. Useful for heavy operations like copy or hash. Arguments similar to thread_messages.ProgressMessage.
FilesAndBytesProgressCallback
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilesAndBytesProgressCallback: """Tracks file count and bytes progress info for large file operations. Information is sent to the status_queue, which will print aggregate it for printing to the user. Useful for heavy operations like copy or hash. Arguments similar to thread_messages.ProgressMessa...
stack_v2_sparse_classes_36k_train_001909
4,851
permissive
[ { "docstring": "Initializes callback, saving non-changing variables. Args: status_queue (multiprocessing.Queue): Where to submit progress messages. If we spawn new worker processes, they will lose their reference to the correct version of this queue if we don't package it here. offset (int): Start of byte range...
2
null
Implement the Python class `FilesAndBytesProgressCallback` described below. Class description: Tracks file count and bytes progress info for large file operations. Information is sent to the status_queue, which will print aggregate it for printing to the user. Useful for heavy operations like copy or hash. Arguments s...
Implement the Python class `FilesAndBytesProgressCallback` described below. Class description: Tracks file count and bytes progress info for large file operations. Information is sent to the status_queue, which will print aggregate it for printing to the user. Useful for heavy operations like copy or hash. Arguments s...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class FilesAndBytesProgressCallback: """Tracks file count and bytes progress info for large file operations. Information is sent to the status_queue, which will print aggregate it for printing to the user. Useful for heavy operations like copy or hash. Arguments similar to thread_messages.ProgressMessa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FilesAndBytesProgressCallback: """Tracks file count and bytes progress info for large file operations. Information is sent to the status_queue, which will print aggregate it for printing to the user. Useful for heavy operations like copy or hash. Arguments similar to thread_messages.ProgressMessage.""" d...
the_stack_v2_python_sparse
lib/googlecloudsdk/command_lib/storage/progress_callbacks.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
95e98f3bb53a4ca89f728ece8400ea66ee0f631e
[ "numset = set()\nfor num in nums:\n if num in numset:\n numset.remove(num)\n else:\n numset.add(num)\nreturn numset.pop()", "singleton = 0\nfor num in nums:\n singleton ^= num\nreturn singleton" ]
<|body_start_0|> numset = set() for num in nums: if num in numset: numset.remove(num) else: numset.add(num) return numset.pop() <|end_body_0|> <|body_start_1|> singleton = 0 for num in nums: singleton ^= num ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNumber2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> numset = set() for num in nums: ...
stack_v2_sparse_classes_36k_train_001910
858
permissive
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "singleNumber", "signature": "def singleNumber(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "singleNumber2", "signature": "def singleNumber2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_002596
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: int - def singleNumber2(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: int - def singleNumber2(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def singleNu...
e11c4f1d6dcd02d1bb69534ddcf7bb957d6df318
<|skeleton|> class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNumber2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" numset = set() for num in nums: if num in numset: numset.remove(num) else: numset.add(num) return numset.pop() def singleNumber2(self, nu...
the_stack_v2_python_sparse
Python/single_number.py
paulolemus/leetcode
train
0
a68edcd8169d1a84ea6ba94ac707950b75ebedb1
[ "res = []\nfor i in range(R):\n for j in range(C):\n res.append([i, j])\nres = sorted(res, key=lambda x: abs(x[0] - r0) + abs(x[1] - c0))\nreturn res", "max_path = max(r0, R - r0 - 1) + max(c0, C - c0 - 1)\nres = defaultdict(list)\nresult = []\ndist = lambda i, j, r0, c0: abs(i - r0) + abs(j - c0)\nfor ...
<|body_start_0|> res = [] for i in range(R): for j in range(C): res.append([i, j]) res = sorted(res, key=lambda x: abs(x[0] - r0) + abs(x[1] - c0)) return res <|end_body_0|> <|body_start_1|> max_path = max(r0, R - r0 - 1) + max(c0, C - c0 - 1) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def allCellsDistOrder(self, R: int, C: int, r0: int, c0: int) -> List[List[int]]: """直接暴力法,循环之后根据曼哈顿距离排序。 :param R: :param C: :param r0: :param c0: :return:""" <|body_0|> def allCellsDistOrder2(self, R: int, C: int, r0: int, c0: int) -> List[List[int]]: """...
stack_v2_sparse_classes_36k_train_001911
1,798
no_license
[ { "docstring": "直接暴力法,循环之后根据曼哈顿距离排序。 :param R: :param C: :param r0: :param c0: :return:", "name": "allCellsDistOrder", "signature": "def allCellsDistOrder(self, R: int, C: int, r0: int, c0: int) -> List[List[int]]" }, { "docstring": "听说叫桶排序 :param R: :param C: :param r0: :param c0: :return:", ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def allCellsDistOrder(self, R: int, C: int, r0: int, c0: int) -> List[List[int]]: 直接暴力法,循环之后根据曼哈顿距离排序。 :param R: :param C: :param r0: :param c0: :return: - def allCellsDistOrder2...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def allCellsDistOrder(self, R: int, C: int, r0: int, c0: int) -> List[List[int]]: 直接暴力法,循环之后根据曼哈顿距离排序。 :param R: :param C: :param r0: :param c0: :return: - def allCellsDistOrder2...
578cacff5851c5c2522981693c34e3c318002d30
<|skeleton|> class Solution: def allCellsDistOrder(self, R: int, C: int, r0: int, c0: int) -> List[List[int]]: """直接暴力法,循环之后根据曼哈顿距离排序。 :param R: :param C: :param r0: :param c0: :return:""" <|body_0|> def allCellsDistOrder2(self, R: int, C: int, r0: int, c0: int) -> List[List[int]]: """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def allCellsDistOrder(self, R: int, C: int, r0: int, c0: int) -> List[List[int]]: """直接暴力法,循环之后根据曼哈顿距离排序。 :param R: :param C: :param r0: :param c0: :return:""" res = [] for i in range(R): for j in range(C): res.append([i, j]) res = sorted(r...
the_stack_v2_python_sparse
距离顺序排列矩阵单元格.py
cjrzs/MyLeetCode
train
8
0d0ac7aa72f9d4afce7038c1ab427f50cdb79631
[ "if not word:\n return None\nif word == '':\n return word\nword_list = list(word.strip().split())\nres = ''\nfor i in range(len(word_list) - 1, -1, -1):\n res += ' ' + word_list[i]\nreturn res", "wordlist = word.strip().split()\nstack = []\nres = ''\nfor wl in wordlist:\n stack.append(wl)\nfor i in ra...
<|body_start_0|> if not word: return None if word == '': return word word_list = list(word.strip().split()) res = '' for i in range(len(word_list) - 1, -1, -1): res += ' ' + word_list[i] return res <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def ReverseWords(self, word): """翻转单词 :param word: :return: 时间复杂度O(N),空间复杂度O(1)""" <|body_0|> def ReverseWordsByStack(self, word): """使用栈解决方案 :param word: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not word: re...
stack_v2_sparse_classes_36k_train_001912
2,556
no_license
[ { "docstring": "翻转单词 :param word: :return: 时间复杂度O(N),空间复杂度O(1)", "name": "ReverseWords", "signature": "def ReverseWords(self, word)" }, { "docstring": "使用栈解决方案 :param word: :return:", "name": "ReverseWordsByStack", "signature": "def ReverseWordsByStack(self, word)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def ReverseWords(self, word): 翻转单词 :param word: :return: 时间复杂度O(N),空间复杂度O(1) - def ReverseWordsByStack(self, word): 使用栈解决方案 :param word: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def ReverseWords(self, word): 翻转单词 :param word: :return: 时间复杂度O(N),空间复杂度O(1) - def ReverseWordsByStack(self, word): 使用栈解决方案 :param word: :return: <|skeleton|> class Solution: ...
32941ee052d0985a9569441d314378700ff4d225
<|skeleton|> class Solution: def ReverseWords(self, word): """翻转单词 :param word: :return: 时间复杂度O(N),空间复杂度O(1)""" <|body_0|> def ReverseWordsByStack(self, word): """使用栈解决方案 :param word: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def ReverseWords(self, word): """翻转单词 :param word: :return: 时间复杂度O(N),空间复杂度O(1)""" if not word: return None if word == '': return word word_list = list(word.strip().split()) res = '' for i in range(len(word_list) - 1, -1, -1): ...
the_stack_v2_python_sparse
cecilia-python/剑指offer/chapter-3/ReverseWords.py
Cecilia520/algorithmic-learning-leetcode
train
7
103f12bf86b08838c29e10229d3e3bec620ca505
[ "print('This command was deprecated, and will be removed in 0.2.0 use:')\nprint('rally plugin show %s' % query)\nplugin.PluginCommands().show(query)\nreturn 1", "print('This command was deprecated, and will be removed in 0.2.0 use:')\nprint('rally plugin list')\nplugin.PluginCommands().list()\nreturn 1" ]
<|body_start_0|> print('This command was deprecated, and will be removed in 0.2.0 use:') print('rally plugin show %s' % query) plugin.PluginCommands().show(query) return 1 <|end_body_0|> <|body_start_1|> print('This command was deprecated, and will be removed in 0.2.0 use:') ...
[deprecated] Allows you to get quick doc of rally entities.
InfoCommands
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InfoCommands: """[deprecated] Allows you to get quick doc of rally entities.""" def find(self, query): """Search for an entity that matches the query and print info about it. :param query: search query.""" <|body_0|> def list(self): """List main entities in Rally...
stack_v2_sparse_classes_36k_train_001913
1,610
permissive
[ { "docstring": "Search for an entity that matches the query and print info about it. :param query: search query.", "name": "find", "signature": "def find(self, query)" }, { "docstring": "List main entities in Rally for which rally info find works. Lists task scenario groups, deploy engines and s...
2
stack_v2_sparse_classes_30k_train_018334
Implement the Python class `InfoCommands` described below. Class description: [deprecated] Allows you to get quick doc of rally entities. Method signatures and docstrings: - def find(self, query): Search for an entity that matches the query and print info about it. :param query: search query. - def list(self): List m...
Implement the Python class `InfoCommands` described below. Class description: [deprecated] Allows you to get quick doc of rally entities. Method signatures and docstrings: - def find(self, query): Search for an entity that matches the query and print info about it. :param query: search query. - def list(self): List m...
4b3fa606e2bca7d7f0326ef3d0cfa67e93cbc18b
<|skeleton|> class InfoCommands: """[deprecated] Allows you to get quick doc of rally entities.""" def find(self, query): """Search for an entity that matches the query and print info about it. :param query: search query.""" <|body_0|> def list(self): """List main entities in Rally...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InfoCommands: """[deprecated] Allows you to get quick doc of rally entities.""" def find(self, query): """Search for an entity that matches the query and print info about it. :param query: search query.""" print('This command was deprecated, and will be removed in 0.2.0 use:') pri...
the_stack_v2_python_sparse
rally/cli/commands/info.py
cernops/rally
train
1
0e691ac7febb18c3510ed79ef05ee2592ef4e926
[ "super(PostConvNet, self).__init__()\nself.conv1 = Conv(in_channels=hp.num_mels * hp.outputs_per_step, out_channels=num_hidden, kernel_size=5, padding=4, w_init='tanh')\nself.conv_list = clones(Conv(in_channels=num_hidden, out_channels=num_hidden, kernel_size=5, padding=4, w_init='tanh'), 3)\nself.conv2 = Conv(in_c...
<|body_start_0|> super(PostConvNet, self).__init__() self.conv1 = Conv(in_channels=hp.num_mels * hp.outputs_per_step, out_channels=num_hidden, kernel_size=5, padding=4, w_init='tanh') self.conv_list = clones(Conv(in_channels=num_hidden, out_channels=num_hidden, kernel_size=5, padding=4, w_init='...
Post Convolutional Network (mel --> mel).
PostConvNet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostConvNet: """Post Convolutional Network (mel --> mel).""" def __init__(self, num_hidden): """:param num_hidden: dimension of hidden.""" <|body_0|> def forward(self, input_, mask=None): """forward.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_001914
17,934
permissive
[ { "docstring": ":param num_hidden: dimension of hidden.", "name": "__init__", "signature": "def __init__(self, num_hidden)" }, { "docstring": "forward.", "name": "forward", "signature": "def forward(self, input_, mask=None)" } ]
2
null
Implement the Python class `PostConvNet` described below. Class description: Post Convolutional Network (mel --> mel). Method signatures and docstrings: - def __init__(self, num_hidden): :param num_hidden: dimension of hidden. - def forward(self, input_, mask=None): forward.
Implement the Python class `PostConvNet` described below. Class description: Post Convolutional Network (mel --> mel). Method signatures and docstrings: - def __init__(self, num_hidden): :param num_hidden: dimension of hidden. - def forward(self, input_, mask=None): forward. <|skeleton|> class PostConvNet: """Po...
31d50b1ea1dea92f4182c5b2b6fe9fe4c981ae39
<|skeleton|> class PostConvNet: """Post Convolutional Network (mel --> mel).""" def __init__(self, num_hidden): """:param num_hidden: dimension of hidden.""" <|body_0|> def forward(self, input_, mask=None): """forward.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PostConvNet: """Post Convolutional Network (mel --> mel).""" def __init__(self, num_hidden): """:param num_hidden: dimension of hidden.""" super(PostConvNet, self).__init__() self.conv1 = Conv(in_channels=hp.num_mels * hp.outputs_per_step, out_channels=num_hidden, kernel_size=5, p...
the_stack_v2_python_sparse
SVS/model/layers/pretrain_module.py
SJTMusicTeam/SVS_system
train
85
193aa09793dbbf1e5df5737b0ebe5f0ee6a9e996
[ "ct = ContentType.objects.get_for_model(type(content_object))\nif distinction:\n dist_q = Q(eventrelation__distinction=distinction)\n cal_dist_q = Q(calendar__calendarrelation__distinction=distinction)\nelse:\n dist_q = Q()\n cal_dist_q = Q()\nif inherit:\n inherit_q = Q(cal_dist_q, calendar__calenda...
<|body_start_0|> ct = ContentType.objects.get_for_model(type(content_object)) if distinction: dist_q = Q(eventrelation__distinction=distinction) cal_dist_q = Q(calendar__calendarrelation__distinction=distinction) else: dist_q = Q() cal_dist_q = Q()...
>>> EventRelation.objects.all().delete() >>> CalendarRelation.objects.all().delete() >>> data = { ... 'title': 'Test1', ... 'start': datetime.datetime(2008, 1, 1), ... 'end': datetime.datetime(2008, 1, 11) ... } >>> Event.objects.all().delete() >>> event1 = Event(**data) >>> event1.save() >>> data['title'] = 'Test2' >>...
EventRelationManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EventRelationManager: """>>> EventRelation.objects.all().delete() >>> CalendarRelation.objects.all().delete() >>> data = { ... 'title': 'Test1', ... 'start': datetime.datetime(2008, 1, 1), ... 'end': datetime.datetime(2008, 1, 11) ... } >>> Event.objects.all().delete() >>> event1 = Event(**data) ...
stack_v2_sparse_classes_36k_train_001915
27,357
no_license
[ { "docstring": "returns a queryset full of events, that relate to the object through, the distinction If inherit is false it will not consider the calendars that the events belong to. If inherit is true it will inherit all of the relations and distinctions that any calendar that it belongs to has, as long as th...
2
stack_v2_sparse_classes_30k_train_015151
Implement the Python class `EventRelationManager` described below. Class description: >>> EventRelation.objects.all().delete() >>> CalendarRelation.objects.all().delete() >>> data = { ... 'title': 'Test1', ... 'start': datetime.datetime(2008, 1, 1), ... 'end': datetime.datetime(2008, 1, 11) ... } >>> Event.objects.all...
Implement the Python class `EventRelationManager` described below. Class description: >>> EventRelation.objects.all().delete() >>> CalendarRelation.objects.all().delete() >>> data = { ... 'title': 'Test1', ... 'start': datetime.datetime(2008, 1, 1), ... 'end': datetime.datetime(2008, 1, 11) ... } >>> Event.objects.all...
e0f86087145bd7bb181197f4498dba8783cb4759
<|skeleton|> class EventRelationManager: """>>> EventRelation.objects.all().delete() >>> CalendarRelation.objects.all().delete() >>> data = { ... 'title': 'Test1', ... 'start': datetime.datetime(2008, 1, 1), ... 'end': datetime.datetime(2008, 1, 11) ... } >>> Event.objects.all().delete() >>> event1 = Event(**data) ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EventRelationManager: """>>> EventRelation.objects.all().delete() >>> CalendarRelation.objects.all().delete() >>> data = { ... 'title': 'Test1', ... 'start': datetime.datetime(2008, 1, 1), ... 'end': datetime.datetime(2008, 1, 11) ... } >>> Event.objects.all().delete() >>> event1 = Event(**data) >>> event1.sa...
the_stack_v2_python_sparse
schedule/models/events.py
ippc/ippcdj
train
2
0ef5e23270e10ce384f9e26521411adb410bfab4
[ "self.obj = byref(c_void_p())\nLIB.mnt_polylineintegral_new.argtypes = [POINTER(c_void_p)]\nier = LIB.mnt_polylineintegral_new(self.obj)\nif ier:\n error_handler(FILE, '__init__', ier)", "LIB.mnt_polylineintegral_del.argtypes = [POINTER(c_void_p)]\nier = LIB.mnt_polylineintegral_del(self.obj)\nif ier:\n err...
<|body_start_0|> self.obj = byref(c_void_p()) LIB.mnt_polylineintegral_new.argtypes = [POINTER(c_void_p)] ier = LIB.mnt_polylineintegral_new(self.obj) if ier: error_handler(FILE, '__init__', ier) <|end_body_0|> <|body_start_1|> LIB.mnt_polylineintegral_del.argtypes =...
A class to compute line or flux integrals
PolylineIntegral
[ "0BSD" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PolylineIntegral: """A class to compute line or flux integrals""" def __init__(self): """Regrid edge field constructor""" <|body_0|> def __del__(self): """Regrid edge field destructor""" <|body_1|> def build(self, grid, xyz, counterclock, periodX): ...
stack_v2_sparse_classes_36k_train_001916
2,841
permissive
[ { "docstring": "Regrid edge field constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Regrid edge field destructor", "name": "__del__", "signature": "def __del__(self)" }, { "docstring": "Build the flux calculator :param grid: instance of Grid :...
4
stack_v2_sparse_classes_30k_train_017499
Implement the Python class `PolylineIntegral` described below. Class description: A class to compute line or flux integrals Method signatures and docstrings: - def __init__(self): Regrid edge field constructor - def __del__(self): Regrid edge field destructor - def build(self, grid, xyz, counterclock, periodX): Build...
Implement the Python class `PolylineIntegral` described below. Class description: A class to compute line or flux integrals Method signatures and docstrings: - def __init__(self): Regrid edge field constructor - def __del__(self): Regrid edge field destructor - def build(self, grid, xyz, counterclock, periodX): Build...
2414328ccbde223647df55ee4dbc7c7b4c79f967
<|skeleton|> class PolylineIntegral: """A class to compute line or flux integrals""" def __init__(self): """Regrid edge field constructor""" <|body_0|> def __del__(self): """Regrid edge field destructor""" <|body_1|> def build(self, grid, xyz, counterclock, periodX): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PolylineIntegral: """A class to compute line or flux integrals""" def __init__(self): """Regrid edge field constructor""" self.obj = byref(c_void_p()) LIB.mnt_polylineintegral_new.argtypes = [POINTER(c_void_p)] ier = LIB.mnt_polylineintegral_new(self.obj) if ier: ...
the_stack_v2_python_sparse
mint/polyline_integral.py
kinow/mint
train
0
87679fb7d9ffbe176792dbb847f2bbfff2fd2ab4
[ "seen = set()\nrows = len(board)\ncols = len(board[0])\nfor i in xrange(rows):\n for j in xrange(cols):\n if board[i][j] != '.':\n kr, kc, kb = self.encode(board, i, j)\n if kr in seen or kc in seen or kb in seen:\n return False\n seen.add(kr)\n s...
<|body_start_0|> seen = set() rows = len(board) cols = len(board[0]) for i in xrange(rows): for j in xrange(cols): if board[i][j] != '.': kr, kc, kb = self.encode(board, i, j) if kr in seen or kc in seen or kb in seen: ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValidSudoku(self, board): """:type board: List[List[str]] :rtype: bool""" <|body_0|> def encode(self, board, i, j): """returns a tuple of encodings one for each row, col, block""" <|body_1|> <|end_skeleton|> <|body_start_0|> seen = s...
stack_v2_sparse_classes_36k_train_001917
1,522
permissive
[ { "docstring": ":type board: List[List[str]] :rtype: bool", "name": "isValidSudoku", "signature": "def isValidSudoku(self, board)" }, { "docstring": "returns a tuple of encodings one for each row, col, block", "name": "encode", "signature": "def encode(self, board, i, j)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidSudoku(self, board): :type board: List[List[str]] :rtype: bool - def encode(self, board, i, j): returns a tuple of encodings one for each row, col, block
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidSudoku(self, board): :type board: List[List[str]] :rtype: bool - def encode(self, board, i, j): returns a tuple of encodings one for each row, col, block <|skeleton|>...
91db15a686a2f36bf0a00c9bedd5b14b46aaa97b
<|skeleton|> class Solution: def isValidSudoku(self, board): """:type board: List[List[str]] :rtype: bool""" <|body_0|> def encode(self, board, i, j): """returns a tuple of encodings one for each row, col, block""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isValidSudoku(self, board): """:type board: List[List[str]] :rtype: bool""" seen = set() rows = len(board) cols = len(board[0]) for i in xrange(rows): for j in xrange(cols): if board[i][j] != '.': kr, kc, kb ...
the_stack_v2_python_sparse
problems/36_valid-sudoku/main.py
young-geng/leet_code
train
0
30cbd1ada28240f02246a68d9885ded1c51c3ecd
[ "max_profit = 0\nlength = len(prices)\nfor i in range(length):\n pre = 0\n for j in range(i, length):\n pre = max(prices[j] - prices[i], pre)\n if max_profit < pre:\n max_profit = pre\nreturn max_profit", "min_price = float('inf')\nmax_profit = 0\nlength = len(prices)\nfor i in rang...
<|body_start_0|> max_profit = 0 length = len(prices) for i in range(length): pre = 0 for j in range(i, length): pre = max(prices[j] - prices[i], pre) if max_profit < pre: max_profit = pre return max_profit <|end_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit1(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> max_profit = 0 length = len(pric...
stack_v2_sparse_classes_36k_train_001918
1,044
no_license
[ { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices)" }, { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit1", "signature": "def maxProfit1(self, prices)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfit1(self, prices): :type prices: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfit1(self, prices): :type prices: List[int] :rtype: int <|skeleton|> class Solution: def maxPro...
d4a33dc28a6d3f99d5179fdb6a83b2ab8c5a0beb
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit1(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" max_profit = 0 length = len(prices) for i in range(length): pre = 0 for j in range(i, length): pre = max(prices[j] - prices[i], pre) if max_p...
the_stack_v2_python_sparse
leetcode/121_buy_stocks.py
294150302hxq/python_learn
train
0
0a023162405f264f2db69bdd9772be6959cc4857
[ "self.params = {'keyword': keyword, 'resource_type': kwargs['resource_type'], 'content_type': kwargs['content_type']}\nres = self.api_send(self.data['search_resource'])\nreturn res", "self.params = {'keyword': keyword, 'resource_type': kwargs['resource_type'], 'content_type': kwargs['content_type']}\nres = self.a...
<|body_start_0|> self.params = {'keyword': keyword, 'resource_type': kwargs['resource_type'], 'content_type': kwargs['content_type']} res = self.api_send(self.data['search_resource']) return res <|end_body_0|> <|body_start_1|> self.params = {'keyword': keyword, 'resource_type': kwargs['...
search 接口集
Search
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Search: """search 接口集""" def search_resource(self, keyword, **kwargs): """搜索内容""" <|body_0|> def search_suggest(self, keyword, **kwargs): """关键字匹配""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.params = {'keyword': keyword, 'resource_type'...
stack_v2_sparse_classes_36k_train_001919
991
no_license
[ { "docstring": "搜索内容", "name": "search_resource", "signature": "def search_resource(self, keyword, **kwargs)" }, { "docstring": "关键字匹配", "name": "search_suggest", "signature": "def search_suggest(self, keyword, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_002023
Implement the Python class `Search` described below. Class description: search 接口集 Method signatures and docstrings: - def search_resource(self, keyword, **kwargs): 搜索内容 - def search_suggest(self, keyword, **kwargs): 关键字匹配
Implement the Python class `Search` described below. Class description: search 接口集 Method signatures and docstrings: - def search_resource(self, keyword, **kwargs): 搜索内容 - def search_suggest(self, keyword, **kwargs): 关键字匹配 <|skeleton|> class Search: """search 接口集""" def search_resource(self, keyword, **kwar...
89a18576934822e6294a465e87bdbc9afa29f177
<|skeleton|> class Search: """search 接口集""" def search_resource(self, keyword, **kwargs): """搜索内容""" <|body_0|> def search_suggest(self, keyword, **kwargs): """关键字匹配""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Search: """search 接口集""" def search_resource(self, keyword, **kwargs): """搜索内容""" self.params = {'keyword': keyword, 'resource_type': kwargs['resource_type'], 'content_type': kwargs['content_type']} res = self.api_send(self.data['search_resource']) return res def sear...
the_stack_v2_python_sparse
api/app_api/search.py
bigllxx/testframework-api
train
1
711f3026c3542b1c071c37ba1e6cdd34aeec1dfd
[ "assert all((stddev_type in self.DEFINED_FOR_STANDARD_DEVIATION_TYPES for stddev_type in stddev_types))\nC = self.COEFFS[imt]\nimean = self._compute_magnitude_scaling(C, rup.mag) + self._compute_distance_scaling(C, dists.rrup, rup.mag)\nmean = np.log(10.0 ** (imean - 2.0) / g)\nmean = self._compute_site_scaling(sit...
<|body_start_0|> assert all((stddev_type in self.DEFINED_FOR_STANDARD_DEVIATION_TYPES for stddev_type in stddev_types)) C = self.COEFFS[imt] imean = self._compute_magnitude_scaling(C, rup.mag) + self._compute_distance_scaling(C, dists.rrup, rup.mag) mean = np.log(10.0 ** (imean - 2.0) / ...
Implements the Fukushima and Tanaka (1990) model correcting for site class. The authors specify that the ground motions should be raised by 40 % on soft soil sites and reduced by 40 % on rock sites. The specific site classification is not known, so it is assumed that in this context "average" site conditions refer to N...
FukushimaTanakaSite1990
[ "AGPL-3.0-only", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FukushimaTanakaSite1990: """Implements the Fukushima and Tanaka (1990) model correcting for site class. The authors specify that the ground motions should be raised by 40 % on soft soil sites and reduced by 40 % on rock sites. The specific site classification is not known, so it is assumed that i...
stack_v2_sparse_classes_36k_train_001920
6,513
permissive
[ { "docstring": "See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values.", "name": "get_mean_and_stddevs", "signature": "def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types)" }, { "docstring": "Scales the ground m...
2
stack_v2_sparse_classes_30k_train_009864
Implement the Python class `FukushimaTanakaSite1990` described below. Class description: Implements the Fukushima and Tanaka (1990) model correcting for site class. The authors specify that the ground motions should be raised by 40 % on soft soil sites and reduced by 40 % on rock sites. The specific site classificatio...
Implement the Python class `FukushimaTanakaSite1990` described below. Class description: Implements the Fukushima and Tanaka (1990) model correcting for site class. The authors specify that the ground motions should be raised by 40 % on soft soil sites and reduced by 40 % on rock sites. The specific site classificatio...
0da9ba5a575360081715e8b90c71d4b16c6687c8
<|skeleton|> class FukushimaTanakaSite1990: """Implements the Fukushima and Tanaka (1990) model correcting for site class. The authors specify that the ground motions should be raised by 40 % on soft soil sites and reduced by 40 % on rock sites. The specific site classification is not known, so it is assumed that i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FukushimaTanakaSite1990: """Implements the Fukushima and Tanaka (1990) model correcting for site class. The authors specify that the ground motions should be raised by 40 % on soft soil sites and reduced by 40 % on rock sites. The specific site classification is not known, so it is assumed that in this contex...
the_stack_v2_python_sparse
openquake/hazardlib/gsim/fukushima_tanaka_1990.py
GFZ-Centre-for-Early-Warning/shakyground
train
1
76742dec2a6053e9196ef9a60754c5f8be517e8c
[ "nums1 = sorted(nums1)\nnums2 = sorted(nums2)\nrst = []\ni, j = (0, 0)\nwhile i < len(nums1) and j < len(nums2):\n if nums1[i] == nums2[j]:\n rst.append(nums1[i])\n i += 1\n j += 1\n elif nums1[i] > nums2[j]:\n j += 1\n else:\n i += 1\nreturn rst", "if len(nums1) > len(...
<|body_start_0|> nums1 = sorted(nums1) nums2 = sorted(nums2) rst = [] i, j = (0, 0) while i < len(nums1) and j < len(nums2): if nums1[i] == nums2[j]: rst.append(nums1[i]) i += 1 j += 1 elif nums1[i] > nums2[j...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def intersect(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" <|body_0|> def intersect2(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k_train_001921
1,713
no_license
[ { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: List[int]", "name": "intersect", "signature": "def intersect(self, nums1, nums2)" }, { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: List[int]", "name": "intersect2", "signature": "def intersect2(...
2
stack_v2_sparse_classes_30k_train_000288
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intersect(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: List[int] - def intersect2(self, nums1, nums2): :type nums1: List[int] :type nums2: List[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intersect(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: List[int] - def intersect2(self, nums1, nums2): :type nums1: List[int] :type nums2: List[...
41365b549f1e6b04aac9f1632a66e71c1e05b322
<|skeleton|> class Solution: def intersect(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" <|body_0|> def intersect2(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def intersect(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" nums1 = sorted(nums1) nums2 = sorted(nums2) rst = [] i, j = (0, 0) while i < len(nums1) and j < len(nums2): if nums1[i] == nums2[j]: ...
the_stack_v2_python_sparse
python practice/Hashtable/e_350_intersection_of_2_array_ii.py
SuzyWu2014/coding-practice
train
1
57565e4b21d643a0af65f9be6f9acaa4b76c2d2b
[ "self.data = data\nproviders = {'paypal': paypal.direct_payment, 'payflowpro': payflowpro.DirectPayment, 'virtual_merchant': virtual_merchant}\nself.ms_provider = providers[e_settings.ms_provider]", "if not isinstance(self.data, txn_data):\n raise must_use_txn_data_exception\nif e_settings.DEMO_MODE:\n retu...
<|body_start_0|> self.data = data providers = {'paypal': paypal.direct_payment, 'payflowpro': payflowpro.DirectPayment, 'virtual_merchant': virtual_merchant} self.ms_provider = providers[e_settings.ms_provider] <|end_body_0|> <|body_start_1|> if not isinstance(self.data, txn_data): ...
class to process a transaction
process_txn
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class process_txn: """class to process a transaction""" def __init__(self, data): """constructor @param data instance of class txn_data""" <|body_0|> def charge(self): """charge a credit card""" <|body_1|> def credit(self): """credit a credit card ...
stack_v2_sparse_classes_36k_train_001922
4,023
permissive
[ { "docstring": "constructor @param data instance of class txn_data", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "charge a credit card", "name": "charge", "signature": "def charge(self)" }, { "docstring": "credit a credit card (refund)", "nam...
3
stack_v2_sparse_classes_30k_train_018641
Implement the Python class `process_txn` described below. Class description: class to process a transaction Method signatures and docstrings: - def __init__(self, data): constructor @param data instance of class txn_data - def charge(self): charge a credit card - def credit(self): credit a credit card (refund)
Implement the Python class `process_txn` described below. Class description: class to process a transaction Method signatures and docstrings: - def __init__(self, data): constructor @param data instance of class txn_data - def charge(self): charge a credit card - def credit(self): credit a credit card (refund) <|ske...
a59457bc37f0501aea1f54d006a6de94ff80511c
<|skeleton|> class process_txn: """class to process a transaction""" def __init__(self, data): """constructor @param data instance of class txn_data""" <|body_0|> def charge(self): """charge a credit card""" <|body_1|> def credit(self): """credit a credit card ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class process_txn: """class to process a transaction""" def __init__(self, data): """constructor @param data instance of class txn_data""" self.data = data providers = {'paypal': paypal.direct_payment, 'payflowpro': payflowpro.DirectPayment, 'virtual_merchant': virtual_merchant} ...
the_stack_v2_python_sparse
ecommerce/merchant_services.py
ninemoreminutes/openassign-server
train
0
86874b155c89d6239930c16fd87d8d38991d0438
[ "guild_id = get_guild_id(guild)\nuser_id = get_user_id(user)\nassert _assert__guild_ban_add__delete_message_duration(delete_message_duration)\ndata = {}\nif delete_message_duration > 0:\n if delete_message_duration > 604800:\n delete_message_duration = 604800\n data['delete_message_seconds'] = delete_m...
<|body_start_0|> guild_id = get_guild_id(guild) user_id = get_user_id(user) assert _assert__guild_ban_add__delete_message_duration(delete_message_duration) data = {} if delete_message_duration > 0: if delete_message_duration > 604800: delete_message_du...
ClientCompoundGuildBanEndpoints
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClientCompoundGuildBanEndpoints: async def guild_ban_add(self, guild, user, *, delete_message_duration=0, reason=None): """Bans the given user from the guild. This method is a coroutine. Parameters ---------- guild : ``Guild``, `int` The guild from where the user will be banned. user : `...
stack_v2_sparse_classes_36k_train_001923
9,134
permissive
[ { "docstring": "Bans the given user from the guild. This method is a coroutine. Parameters ---------- guild : ``Guild``, `int` The guild from where the user will be banned. user : ``ClientUserBase``, `int` The user to ban from the guild. delete_message_duration : `int` = `0`, Optional (Keyword only) How much se...
5
stack_v2_sparse_classes_30k_train_001154
Implement the Python class `ClientCompoundGuildBanEndpoints` described below. Class description: Implement the ClientCompoundGuildBanEndpoints class. Method signatures and docstrings: - async def guild_ban_add(self, guild, user, *, delete_message_duration=0, reason=None): Bans the given user from the guild. This meth...
Implement the Python class `ClientCompoundGuildBanEndpoints` described below. Class description: Implement the ClientCompoundGuildBanEndpoints class. Method signatures and docstrings: - async def guild_ban_add(self, guild, user, *, delete_message_duration=0, reason=None): Bans the given user from the guild. This meth...
53f24fdb38459dc5a4fd04f11bdbfee8295b76a4
<|skeleton|> class ClientCompoundGuildBanEndpoints: async def guild_ban_add(self, guild, user, *, delete_message_duration=0, reason=None): """Bans the given user from the guild. This method is a coroutine. Parameters ---------- guild : ``Guild``, `int` The guild from where the user will be banned. user : `...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClientCompoundGuildBanEndpoints: async def guild_ban_add(self, guild, user, *, delete_message_duration=0, reason=None): """Bans the given user from the guild. This method is a coroutine. Parameters ---------- guild : ``Guild``, `int` The guild from where the user will be banned. user : ``ClientUserBas...
the_stack_v2_python_sparse
hata/discord/client/compounds/guild_ban.py
HuyaneMatsu/hata
train
3
3434a8cbe42e400ef22b03e3762039db62a57f72
[ "if n == 0:\n return []\ncnts = [0] + [1] * 6 + [0] * (6 * n - 6)\nfor _ in range(n - 1):\n for i in range(6 * n, 0, -1):\n cnts[i] = sum(cnts[max(i - 6, 0):i])\nreturn list(filter(lambda a: a != 0, list(map(lambda a: a / 6 ** n, cnts))))", "def diceCnt(n):\n if n == 1:\n return [0] + [1] *...
<|body_start_0|> if n == 0: return [] cnts = [0] + [1] * 6 + [0] * (6 * n - 6) for _ in range(n - 1): for i in range(6 * n, 0, -1): cnts[i] = sum(cnts[max(i - 6, 0):i]) return list(filter(lambda a: a != 0, list(map(lambda a: a / 6 ** n, cnts)))) <|...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum_1(self, n: int) -> List[float]: """动态规划 迭代 :param n: :return:""" <|body_0|> def twoSum_2(self, n: int) -> List[float]: """动态规划 递归 :param n: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n == 0: return [...
stack_v2_sparse_classes_36k_train_001924
1,958
no_license
[ { "docstring": "动态规划 迭代 :param n: :return:", "name": "twoSum_1", "signature": "def twoSum_1(self, n: int) -> List[float]" }, { "docstring": "动态规划 递归 :param n: :return:", "name": "twoSum_2", "signature": "def twoSum_2(self, n: int) -> List[float]" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum_1(self, n: int) -> List[float]: 动态规划 迭代 :param n: :return: - def twoSum_2(self, n: int) -> List[float]: 动态规划 递归 :param n: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum_1(self, n: int) -> List[float]: 动态规划 迭代 :param n: :return: - def twoSum_2(self, n: int) -> List[float]: 动态规划 递归 :param n: :return: <|skeleton|> class Solution: d...
62419b49000e79962bcdc99cd98afd2fb82ea345
<|skeleton|> class Solution: def twoSum_1(self, n: int) -> List[float]: """动态规划 迭代 :param n: :return:""" <|body_0|> def twoSum_2(self, n: int) -> List[float]: """动态规划 递归 :param n: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def twoSum_1(self, n: int) -> List[float]: """动态规划 迭代 :param n: :return:""" if n == 0: return [] cnts = [0] + [1] * 6 + [0] * (6 * n - 6) for _ in range(n - 1): for i in range(6 * n, 0, -1): cnts[i] = sum(cnts[max(i - 6, 0):i]) ...
the_stack_v2_python_sparse
剑指 Offer(第 2 版)/twoSum.py
MaoningGuan/LeetCode
train
3
8b3a28c21606bd59a53cb7dedeec30a9ec736c36
[ "self.update_packages(dev=True)\nself.update_webpack_mix()\nself.update_css()\nself.remove_node_modules()", "make_full_directory(resources_path('css'))\nshutil.copyfile(self.get_template_path('_variables.scss'), resources_path('css/_variables.scss'))\nshutil.copyfile(self.get_template_path('app.scss'), resources_...
<|body_start_0|> self.update_packages(dev=True) self.update_webpack_mix() self.update_css() self.remove_node_modules() <|end_body_0|> <|body_start_1|> make_full_directory(resources_path('css')) shutil.copyfile(self.get_template_path('_variables.scss'), resources_path('cs...
Configure the front-end scaffolding for the application to use Bootstrap
Bootstrap
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bootstrap: """Configure the front-end scaffolding for the application to use Bootstrap""" def install(self): """Install the preset""" <|body_0|> def update_css(self): """Create/Override an app.scss file configured for the preset.""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k_train_001925
1,056
permissive
[ { "docstring": "Install the preset", "name": "install", "signature": "def install(self)" }, { "docstring": "Create/Override an app.scss file configured for the preset.", "name": "update_css", "signature": "def update_css(self)" } ]
2
null
Implement the Python class `Bootstrap` described below. Class description: Configure the front-end scaffolding for the application to use Bootstrap Method signatures and docstrings: - def install(self): Install the preset - def update_css(self): Create/Override an app.scss file configured for the preset.
Implement the Python class `Bootstrap` described below. Class description: Configure the front-end scaffolding for the application to use Bootstrap Method signatures and docstrings: - def install(self): Install the preset - def update_css(self): Create/Override an app.scss file configured for the preset. <|skeleton|...
e8e55e5fdced9f28cc8acb1577457a490e5b4b74
<|skeleton|> class Bootstrap: """Configure the front-end scaffolding for the application to use Bootstrap""" def install(self): """Install the preset""" <|body_0|> def update_css(self): """Create/Override an app.scss file configured for the preset.""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Bootstrap: """Configure the front-end scaffolding for the application to use Bootstrap""" def install(self): """Install the preset""" self.update_packages(dev=True) self.update_webpack_mix() self.update_css() self.remove_node_modules() def update_css(self): ...
the_stack_v2_python_sparse
src/masonite/presets/Bootstrap.py
MasoniteFramework/masonite
train
2,173
f72b942970e8d27d1939c7d400d412bad7831328
[ "for vehicle in self:\n if vehicle.issue_date and vehicle.target_date:\n if vehicle.target_date < vehicle.issue_date:\n msg = _('Target Completion Date Should Be Greater Than Issue Date.')\n raise ValidationError(msg)", "for vehicle in self:\n if vehicle.target_date and vehicle....
<|body_start_0|> for vehicle in self: if vehicle.issue_date and vehicle.target_date: if vehicle.target_date < vehicle.issue_date: msg = _('Target Completion Date Should Be Greater Than Issue Date.') raise ValidationError(msg) <|end_body_0|> <|...
Service Repair Line.
ServiceRepairLine
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServiceRepairLine: """Service Repair Line.""" def check_target_completion_date(self): """Method to check target completion date.""" <|body_0|> def check_etic_date(self): """Method to check etic date.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_001926
49,476
no_license
[ { "docstring": "Method to check target completion date.", "name": "check_target_completion_date", "signature": "def check_target_completion_date(self)" }, { "docstring": "Method to check etic date.", "name": "check_etic_date", "signature": "def check_etic_date(self)" } ]
2
stack_v2_sparse_classes_30k_train_002706
Implement the Python class `ServiceRepairLine` described below. Class description: Service Repair Line. Method signatures and docstrings: - def check_target_completion_date(self): Method to check target completion date. - def check_etic_date(self): Method to check etic date.
Implement the Python class `ServiceRepairLine` described below. Class description: Service Repair Line. Method signatures and docstrings: - def check_target_completion_date(self): Method to check target completion date. - def check_etic_date(self): Method to check etic date. <|skeleton|> class ServiceRepairLine: ...
7618a365ac78c0f59390a3a6b5fcdd9f76a5ddec
<|skeleton|> class ServiceRepairLine: """Service Repair Line.""" def check_target_completion_date(self): """Method to check target completion date.""" <|body_0|> def check_etic_date(self): """Method to check etic date.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ServiceRepairLine: """Service Repair Line.""" def check_target_completion_date(self): """Method to check target completion date.""" for vehicle in self: if vehicle.issue_date and vehicle.target_date: if vehicle.target_date < vehicle.issue_date: ...
the_stack_v2_python_sparse
fleet_operations/models/fleet_service.py
JayVora-SerpentCS/fleet_management
train
29
3eb7607bc9f8e763415a3290bcb21389307eaf27
[ "self._bp.HandleEvent(StateChartAuthorizationProcess.EVENT_APPROVE)\nself._bp.Commit()\nlimitOid = self._bp.Subject().Name()\nlimit = acm.FLimit[limitOid]\nmandate = Mandate(limit)\nlimit.Name(mandate.Name())\nlimit.LimitTarget().TemplatePath(self._bp.CurrentStep().DiaryEntry().Parameters()['Mandate target'])\nlimi...
<|body_start_0|> self._bp.HandleEvent(StateChartAuthorizationProcess.EVENT_APPROVE) self._bp.Commit() limitOid = self._bp.Subject().Name() limit = acm.FLimit[limitOid] mandate = Mandate(limit) limit.Name(mandate.Name()) limit.LimitTarget().TemplatePath(self._bp.Cu...
MenuItem on Business Process Sheet used to view a historical version of a specific breached mandate.
ApproveMandateMenuItem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApproveMandateMenuItem: """MenuItem on Business Process Sheet used to view a historical version of a specific breached mandate.""" def _Approve(self): """Approve the mandate.""" <|body_0|> def Invoke(self, eii): """OnClick method that executes when the menu item ...
stack_v2_sparse_classes_36k_train_001927
27,405
no_license
[ { "docstring": "Approve the mandate.", "name": "_Approve", "signature": "def _Approve(self)" }, { "docstring": "OnClick method that executes when the menu item is clicked. :param eii: FExtensionInvokationInfo", "name": "Invoke", "signature": "def Invoke(self, eii)" }, { "docstrin...
4
null
Implement the Python class `ApproveMandateMenuItem` described below. Class description: MenuItem on Business Process Sheet used to view a historical version of a specific breached mandate. Method signatures and docstrings: - def _Approve(self): Approve the mandate. - def Invoke(self, eii): OnClick method that execute...
Implement the Python class `ApproveMandateMenuItem` described below. Class description: MenuItem on Business Process Sheet used to view a historical version of a specific breached mandate. Method signatures and docstrings: - def _Approve(self): Approve the mandate. - def Invoke(self, eii): OnClick method that execute...
5e7cc7de3495145501ca53deb9efee2233ab7e1c
<|skeleton|> class ApproveMandateMenuItem: """MenuItem on Business Process Sheet used to view a historical version of a specific breached mandate.""" def _Approve(self): """Approve the mandate.""" <|body_0|> def Invoke(self, eii): """OnClick method that executes when the menu item ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApproveMandateMenuItem: """MenuItem on Business Process Sheet used to view a historical version of a specific breached mandate.""" def _Approve(self): """Approve the mandate.""" self._bp.HandleEvent(StateChartAuthorizationProcess.EVENT_APPROVE) self._bp.Commit() limitOid =...
the_stack_v2_python_sparse
Extensions/GenericMandates/FPythonCode/GenericMandatesMenu.py
webclinic017/fa-absa-py3
train
0
53ab89a3d82577ba0dc3f69e6177ddd14742d162
[ "left = 0\nright = x + 1\nwhile True:\n p = (left + right) // 2\n if p ** 2 <= x < (p + 1) ** 2:\n return p\n elif p ** 2 > x:\n right = p\n else:\n left = p", "import math\nif x == 0:\n return 0\nans = int(math.exp(0.5 * math.log(x)))\nreturn ans + 1 if (ans + 1) ** 2 <= x els...
<|body_start_0|> left = 0 right = x + 1 while True: p = (left + right) // 2 if p ** 2 <= x < (p + 1) ** 2: return p elif p ** 2 > x: right = p else: left = p <|end_body_0|> <|body_start_1|> i...
实现 int sqrt(int x) 函数。 计算并返回 x 的平方根,其中 x 是非负整数。 由于返回类型是整数,结果只保留整数的部分,小数部分将被舍去。 示例 1: 输入: 4 输出: 2 示例 2: 输入: 8 输出: 2 说明: 8 的平方根是 2.82842..., 由于返回类型是整数,小数部分将被舍去。
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """实现 int sqrt(int x) 函数。 计算并返回 x 的平方根,其中 x 是非负整数。 由于返回类型是整数,结果只保留整数的部分,小数部分将被舍去。 示例 1: 输入: 4 输出: 2 示例 2: 输入: 8 输出: 2 说明: 8 的平方根是 2.82842..., 由于返回类型是整数,小数部分将被舍去。""" def mySqrt(self, x: int) -> int: """对于任意整数,有a^2 <= x <= (a+1)^2,通过这个进行二分查找,快速找到目标值 :param x: :return:""" ...
stack_v2_sparse_classes_36k_train_001928
1,710
no_license
[ { "docstring": "对于任意整数,有a^2 <= x <= (a+1)^2,通过这个进行二分查找,快速找到目标值 :param x: :return:", "name": "mySqrt", "signature": "def mySqrt(self, x: int) -> int" }, { "docstring": "公式转换法,sqrt(x)= x^(1/2) = (e^(ln x))^(1/2) = e^(0.5*ln x) :param x: :return:", "name": "my_sqrt", "signature": "def my_sq...
2
stack_v2_sparse_classes_30k_train_008531
Implement the Python class `Solution` described below. Class description: 实现 int sqrt(int x) 函数。 计算并返回 x 的平方根,其中 x 是非负整数。 由于返回类型是整数,结果只保留整数的部分,小数部分将被舍去。 示例 1: 输入: 4 输出: 2 示例 2: 输入: 8 输出: 2 说明: 8 的平方根是 2.82842..., 由于返回类型是整数,小数部分将被舍去。 Method signatures and docstrings: - def mySqrt(self, x: int) -> int: 对于任意整数,有a^2 <= x...
Implement the Python class `Solution` described below. Class description: 实现 int sqrt(int x) 函数。 计算并返回 x 的平方根,其中 x 是非负整数。 由于返回类型是整数,结果只保留整数的部分,小数部分将被舍去。 示例 1: 输入: 4 输出: 2 示例 2: 输入: 8 输出: 2 说明: 8 的平方根是 2.82842..., 由于返回类型是整数,小数部分将被舍去。 Method signatures and docstrings: - def mySqrt(self, x: int) -> int: 对于任意整数,有a^2 <= x...
de86b04b1f874c50613c33e969ec7a7590cceaff
<|skeleton|> class Solution: """实现 int sqrt(int x) 函数。 计算并返回 x 的平方根,其中 x 是非负整数。 由于返回类型是整数,结果只保留整数的部分,小数部分将被舍去。 示例 1: 输入: 4 输出: 2 示例 2: 输入: 8 输出: 2 说明: 8 的平方根是 2.82842..., 由于返回类型是整数,小数部分将被舍去。""" def mySqrt(self, x: int) -> int: """对于任意整数,有a^2 <= x <= (a+1)^2,通过这个进行二分查找,快速找到目标值 :param x: :return:""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """实现 int sqrt(int x) 函数。 计算并返回 x 的平方根,其中 x 是非负整数。 由于返回类型是整数,结果只保留整数的部分,小数部分将被舍去。 示例 1: 输入: 4 输出: 2 示例 2: 输入: 8 输出: 2 说明: 8 的平方根是 2.82842..., 由于返回类型是整数,小数部分将被舍去。""" def mySqrt(self, x: int) -> int: """对于任意整数,有a^2 <= x <= (a+1)^2,通过这个进行二分查找,快速找到目标值 :param x: :return:""" left = 0 ...
the_stack_v2_python_sparse
069_Normal_SqrtX.py
CGump/leetcode-everyday
train
0
10dc631f51a198beed5cebbb93b3737f88e10dfe
[ "if callback is not None:\n callback()\nhead, tail = os.path.split(path)\nself.name = tail or head\nself.path = path\nself.children = []\nself.file_size = 0\nself.total_size = 0\nself.total_nodes = 0\ntry:\n dir_list = os.listdir(path)\nexcept OSError:\n pass\nelse:\n for name in dir_list:\n path...
<|body_start_0|> if callback is not None: callback() head, tail = os.path.split(path) self.name = tail or head self.path = path self.children = [] self.file_size = 0 self.total_size = 0 self.total_nodes = 0 try: dir_list = o...
Create a tree structure outlining a directory's size.
SizeTree
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SizeTree: """Create a tree structure outlining a directory's size.""" def __init__(self, path, callback=None): """Initialize the SizeTree object and search the path while updating.""" <|body_0|> def pop_child(self, name): """Return a named child or None if not fo...
stack_v2_sparse_classes_36k_train_001929
42,208
permissive
[ { "docstring": "Initialize the SizeTree object and search the path while updating.", "name": "__init__", "signature": "def __init__(self, path, callback=None)" }, { "docstring": "Return a named child or None if not found.", "name": "pop_child", "signature": "def pop_child(self, name)" ...
5
stack_v2_sparse_classes_30k_train_014363
Implement the Python class `SizeTree` described below. Class description: Create a tree structure outlining a directory's size. Method signatures and docstrings: - def __init__(self, path, callback=None): Initialize the SizeTree object and search the path while updating. - def pop_child(self, name): Return a named ch...
Implement the Python class `SizeTree` described below. Class description: Create a tree structure outlining a directory's size. Method signatures and docstrings: - def __init__(self, path, callback=None): Initialize the SizeTree object and search the path while updating. - def pop_child(self, name): Return a named ch...
d097ca0ad6a6aee2180d32dce6a3322621f655fd
<|skeleton|> class SizeTree: """Create a tree structure outlining a directory's size.""" def __init__(self, path, callback=None): """Initialize the SizeTree object and search the path while updating.""" <|body_0|> def pop_child(self, name): """Return a named child or None if not fo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SizeTree: """Create a tree structure outlining a directory's size.""" def __init__(self, path, callback=None): """Initialize the SizeTree object and search the path while updating.""" if callback is not None: callback() head, tail = os.path.split(path) self.nam...
the_stack_v2_python_sparse
recipes/Python/578154_Directory_Pruner_4/recipe-578154.py
betty29/code-1
train
0
cf220edcc0b38784d639e8c22fc16fae5eb008b0
[ "errors = {}\nuser = attrs['user']\nnew_email = attrs['new_email']\npassword = attrs.pop('password')\nif user.email == new_email:\n errors['email'] = 'Provided email address is same as your current one'\nelif User.objects.filter(email=new_email).exists():\n errors['email'] = 'Invalid email address'\nif errors...
<|body_start_0|> errors = {} user = attrs['user'] new_email = attrs['new_email'] password = attrs.pop('password') if user.email == new_email: errors['email'] = 'Provided email address is same as your current one' elif User.objects.filter(email=new_email).exist...
Serializer for starting a user email change
ChangeEmailRequestCreateSerializer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChangeEmailRequestCreateSerializer: """Serializer for starting a user email change""" def validate(self, attrs): """Validate the change request""" <|body_0|> def create(self, validated_data): """Create the email change request""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k_train_001930
16,669
permissive
[ { "docstring": "Validate the change request", "name": "validate", "signature": "def validate(self, attrs)" }, { "docstring": "Create the email change request", "name": "create", "signature": "def create(self, validated_data)" } ]
2
stack_v2_sparse_classes_30k_train_003308
Implement the Python class `ChangeEmailRequestCreateSerializer` described below. Class description: Serializer for starting a user email change Method signatures and docstrings: - def validate(self, attrs): Validate the change request - def create(self, validated_data): Create the email change request
Implement the Python class `ChangeEmailRequestCreateSerializer` described below. Class description: Serializer for starting a user email change Method signatures and docstrings: - def validate(self, attrs): Validate the change request - def create(self, validated_data): Create the email change request <|skeleton|> c...
c5d9cda4e1ed87463da74d7956f1e1f9258f365c
<|skeleton|> class ChangeEmailRequestCreateSerializer: """Serializer for starting a user email change""" def validate(self, attrs): """Validate the change request""" <|body_0|> def create(self, validated_data): """Create the email change request""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChangeEmailRequestCreateSerializer: """Serializer for starting a user email change""" def validate(self, attrs): """Validate the change request""" errors = {} user = attrs['user'] new_email = attrs['new_email'] password = attrs.pop('password') if user.email...
the_stack_v2_python_sparse
users/serializers.py
mitodl/mitxpro
train
12
f72955e6a7ab9aa5aed68fce16b59f7a201f1c3c
[ "self.id = id\nself.name = name\nself.code = code\nself.document = document\nself.description = description\nself.status = status\nself.created_at = created_at\nself.updated_at = updated_at\nself.address = address\nself.metadata = metadata\nself.deleted_at = deleted_at", "if dictionary is None:\n return None\n...
<|body_start_0|> self.id = id self.name = name self.code = code self.document = document self.description = description self.status = status self.created_at = created_at self.updated_at = updated_at self.address = address self.metadata = me...
Implementation of the 'GetSellerResponse' model. TODO: type model description here. Attributes: id (string): Identification name (string): TODO: type description here. code (string): TODO: type description here. document (string): TODO: type description here. description (string): Description status (string): Status cr...
GetSellerResponse
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetSellerResponse: """Implementation of the 'GetSellerResponse' model. TODO: type model description here. Attributes: id (string): Identification name (string): TODO: type description here. code (string): TODO: type description here. document (string): TODO: type description here. description (st...
stack_v2_sparse_classes_36k_train_001931
3,709
permissive
[ { "docstring": "Constructor for the GetSellerResponse class", "name": "__init__", "signature": "def __init__(self, id=None, name=None, code=None, document=None, description=None, status=None, created_at=None, updated_at=None, address=None, metadata=None, deleted_at=None)" }, { "docstring": "Crea...
2
stack_v2_sparse_classes_30k_train_000964
Implement the Python class `GetSellerResponse` described below. Class description: Implementation of the 'GetSellerResponse' model. TODO: type model description here. Attributes: id (string): Identification name (string): TODO: type description here. code (string): TODO: type description here. document (string): TODO:...
Implement the Python class `GetSellerResponse` described below. Class description: Implementation of the 'GetSellerResponse' model. TODO: type model description here. Attributes: id (string): Identification name (string): TODO: type description here. code (string): TODO: type description here. document (string): TODO:...
95c80c35dd57bb2a238faeaf30d1e3b4544d2298
<|skeleton|> class GetSellerResponse: """Implementation of the 'GetSellerResponse' model. TODO: type model description here. Attributes: id (string): Identification name (string): TODO: type description here. code (string): TODO: type description here. document (string): TODO: type description here. description (st...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetSellerResponse: """Implementation of the 'GetSellerResponse' model. TODO: type model description here. Attributes: id (string): Identification name (string): TODO: type description here. code (string): TODO: type description here. document (string): TODO: type description here. description (string): Descri...
the_stack_v2_python_sparse
mundiapi/models/get_seller_response.py
mundipagg/MundiAPI-PYTHON
train
10
aeb3ab99d75b26bd66743ad4a6bee3666807a4ab
[ "tests = {'3': 3, '3 dozen': 36, '50 dozen kW': 600000, '1 / 10': 0.1, '1/2 kW': 500, '1/2 dozen kW': 6000, '0.005 MW': 5000}\nfor val, expected in tests.items():\n q = InvenTree.conversion.convert_physical_value(val, 'W')\n self.assertAlmostEqual(q, expected, 0.01)\n q = InvenTree.conversion.convert_physi...
<|body_start_0|> tests = {'3': 3, '3 dozen': 36, '50 dozen kW': 600000, '1 / 10': 0.1, '1/2 kW': 500, '1/2 dozen kW': 6000, '0.005 MW': 5000} for val, expected in tests.items(): q = InvenTree.conversion.convert_physical_value(val, 'W') self.assertAlmostEqual(q, expected, 0.01) ...
Tests for conversion of physical units
ConversionTest
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConversionTest: """Tests for conversion of physical units""" def test_base_units(self): """Test conversion to specified base units""" <|body_0|> def test_dimensionless_units(self): """Tests for 'dimensonless' unit quantities""" <|body_1|> def test_in...
stack_v2_sparse_classes_36k_train_001932
41,191
permissive
[ { "docstring": "Test conversion to specified base units", "name": "test_base_units", "signature": "def test_base_units(self)" }, { "docstring": "Tests for 'dimensonless' unit quantities", "name": "test_dimensionless_units", "signature": "def test_dimensionless_units(self)" }, { "...
4
null
Implement the Python class `ConversionTest` described below. Class description: Tests for conversion of physical units Method signatures and docstrings: - def test_base_units(self): Test conversion to specified base units - def test_dimensionless_units(self): Tests for 'dimensonless' unit quantities - def test_invali...
Implement the Python class `ConversionTest` described below. Class description: Tests for conversion of physical units Method signatures and docstrings: - def test_base_units(self): Test conversion to specified base units - def test_dimensionless_units(self): Tests for 'dimensonless' unit quantities - def test_invali...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class ConversionTest: """Tests for conversion of physical units""" def test_base_units(self): """Test conversion to specified base units""" <|body_0|> def test_dimensionless_units(self): """Tests for 'dimensonless' unit quantities""" <|body_1|> def test_in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConversionTest: """Tests for conversion of physical units""" def test_base_units(self): """Test conversion to specified base units""" tests = {'3': 3, '3 dozen': 36, '50 dozen kW': 600000, '1 / 10': 0.1, '1/2 kW': 500, '1/2 dozen kW': 6000, '0.005 MW': 5000} for val, expected in t...
the_stack_v2_python_sparse
InvenTree/InvenTree/tests.py
inventree/InvenTree
train
3,077
93be7f01e7aaba9b4ce7a662b95a11163411ea2e
[ "print('Admin Verification Test')\nlogin = 'admin1'\nself.assertEqual(testVerifyLogin(login, login), True)", "print('Login Verification Test')\nlogin = 'Engineer1'\nself.assertEqual(testCred(login, login), True)", "print('Search Car By ID Test')\ncarID = '1'\nself.assertEqual(testCarID(carID), True)" ]
<|body_start_0|> print('Admin Verification Test') login = 'admin1' self.assertEqual(testVerifyLogin(login, login), True) <|end_body_0|> <|body_start_1|> print('Login Verification Test') login = 'Engineer1' self.assertEqual(testCred(login, login), True) <|end_body_1|> <|...
Function runs all Engineer Related Tests
TestStringMethods
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestStringMethods: """Function runs all Engineer Related Tests""" def test_login(self): """Function runs test to verify Admin login""" <|body_0|> def test_cred(self): """Function runs test to verify Engineer Login""" <|body_1|> def test_carID(self): ...
stack_v2_sparse_classes_36k_train_001933
2,875
no_license
[ { "docstring": "Function runs test to verify Admin login", "name": "test_login", "signature": "def test_login(self)" }, { "docstring": "Function runs test to verify Engineer Login", "name": "test_cred", "signature": "def test_cred(self)" }, { "docstring": "Function runs test to f...
3
stack_v2_sparse_classes_30k_train_020330
Implement the Python class `TestStringMethods` described below. Class description: Function runs all Engineer Related Tests Method signatures and docstrings: - def test_login(self): Function runs test to verify Admin login - def test_cred(self): Function runs test to verify Engineer Login - def test_carID(self): Func...
Implement the Python class `TestStringMethods` described below. Class description: Function runs all Engineer Related Tests Method signatures and docstrings: - def test_login(self): Function runs test to verify Admin login - def test_cred(self): Function runs test to verify Engineer Login - def test_carID(self): Func...
0beee478e7a95ed052feb262d1e9fa9c0bf27981
<|skeleton|> class TestStringMethods: """Function runs all Engineer Related Tests""" def test_login(self): """Function runs test to verify Admin login""" <|body_0|> def test_cred(self): """Function runs test to verify Engineer Login""" <|body_1|> def test_carID(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestStringMethods: """Function runs all Engineer Related Tests""" def test_login(self): """Function runs test to verify Admin login""" print('Admin Verification Test') login = 'admin1' self.assertEqual(testVerifyLogin(login, login), True) def test_cred(self): ...
the_stack_v2_python_sparse
engineerTest.py
rmit-s3602584-peter-moorhead/IoTAssignment2
train
0
35ebd862f2db95944c1c51cd8d63e4d17570b69e
[ "assert query_batch_cnt.is_contiguous()\nassert key_batch_cnt.is_contiguous()\nassert index_pair_batch.is_contiguous()\nassert index_pair.is_contiguous()\nassert attn_weight.is_contiguous()\nassert value_features.is_contiguous()\nb = query_batch_cnt.shape[0]\ntotal_query_num, local_size = index_pair.size()\ntotal_k...
<|body_start_0|> assert query_batch_cnt.is_contiguous() assert key_batch_cnt.is_contiguous() assert index_pair_batch.is_contiguous() assert index_pair.is_contiguous() assert attn_weight.is_contiguous() assert value_features.is_contiguous() b = query_batch_cnt.shap...
Generate the attention result based on: * the generated attention pair index (total_query_num, local_size); * value features (total_key_num, nhead, hdim) * attn_weight (total_query_num, local_size, nhead) Generate the attention result. * (total_query_num, nhead, hdim)
AttentionValueComputation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttentionValueComputation: """Generate the attention result based on: * the generated attention pair index (total_query_num, local_size); * value features (total_key_num, nhead, hdim) * attn_weight (total_query_num, local_size, nhead) Generate the attention result. * (total_query_num, nhead, hdim...
stack_v2_sparse_classes_36k_train_001934
8,019
no_license
[ { "docstring": ":param ctx: :param query_batch_cnt: A integer tensor with shape [bs], indicating the query amount for each batch. :param key_batch_cnt: A integer tensor with shape [bs], indicating the key amount of each batch. :param index_pair_batch: A integer tensor with shape [total_query_num], indicating th...
2
stack_v2_sparse_classes_30k_train_001568
Implement the Python class `AttentionValueComputation` described below. Class description: Generate the attention result based on: * the generated attention pair index (total_query_num, local_size); * value features (total_key_num, nhead, hdim) * attn_weight (total_query_num, local_size, nhead) Generate the attention ...
Implement the Python class `AttentionValueComputation` described below. Class description: Generate the attention result based on: * the generated attention pair index (total_query_num, local_size); * value features (total_key_num, nhead, hdim) * attn_weight (total_query_num, local_size, nhead) Generate the attention ...
bbc78ca91e851f0f04459b1a8bbe96ab44bf41bc
<|skeleton|> class AttentionValueComputation: """Generate the attention result based on: * the generated attention pair index (total_query_num, local_size); * value features (total_key_num, nhead, hdim) * attn_weight (total_query_num, local_size, nhead) Generate the attention result. * (total_query_num, nhead, hdim...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AttentionValueComputation: """Generate the attention result based on: * the generated attention pair index (total_query_num, local_size); * value features (total_key_num, nhead, hdim) * attn_weight (total_query_num, local_size, nhead) Generate the attention result. * (total_query_num, nhead, hdim)""" def...
the_stack_v2_python_sparse
EQNet/eqnet/ops/attention/attention_utils_v2.py
dvlab-research/DeepVision3D
train
94
3034cc42d3ec2dd867d1c68c0fdb9c31044b537e
[ "super().__init__()\nself.dim = dim if dim is not None else ()\nself.threshold_input = threshold_input\nself.threshold_target = threshold_target\nself.reduce_fn = reduce_fn", "if pred.shape != target.shape:\n raise ValueError(f'Invalid input and target shapes for metric \"{self.__class__.__name__}\". ({pred.sh...
<|body_start_0|> super().__init__() self.dim = dim if dim is not None else () self.threshold_input = threshold_input self.threshold_target = threshold_target self.reduce_fn = reduce_fn <|end_body_0|> <|body_start_1|> if pred.shape != target.shape: raise Value...
Recall
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Recall: def __init__(self, threshold_input: Optional[float]=0.5, threshold_target: Optional[float]=0.5, dim: Optional[int]=-1, reduce_fn: Optional[Callable]=torch.mean): """Compute Recall score between binary vectors. The recall is intuitively the ability of the classifier to find all th...
stack_v2_sparse_classes_36k_train_001935
2,251
permissive
[ { "docstring": "Compute Recall score between binary vectors. The recall is intuitively the ability of the classifier to find all the positive samples. >>> 'Recall = TP / (TP + FN), where TP = True Positives, FN = False Negatives.' :param threshold_input: The threshold value for binarize input vectors. (default:...
2
stack_v2_sparse_classes_30k_train_020368
Implement the Python class `Recall` described below. Class description: Implement the Recall class. Method signatures and docstrings: - def __init__(self, threshold_input: Optional[float]=0.5, threshold_target: Optional[float]=0.5, dim: Optional[int]=-1, reduce_fn: Optional[Callable]=torch.mean): Compute Recall score...
Implement the Python class `Recall` described below. Class description: Implement the Recall class. Method signatures and docstrings: - def __init__(self, threshold_input: Optional[float]=0.5, threshold_target: Optional[float]=0.5, dim: Optional[int]=-1, reduce_fn: Optional[Callable]=torch.mean): Compute Recall score...
91aa907a3f820e53902578c3d0110fe9a01c88e7
<|skeleton|> class Recall: def __init__(self, threshold_input: Optional[float]=0.5, threshold_target: Optional[float]=0.5, dim: Optional[int]=-1, reduce_fn: Optional[Callable]=torch.mean): """Compute Recall score between binary vectors. The recall is intuitively the ability of the classifier to find all th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Recall: def __init__(self, threshold_input: Optional[float]=0.5, threshold_target: Optional[float]=0.5, dim: Optional[int]=-1, reduce_fn: Optional[Callable]=torch.mean): """Compute Recall score between binary vectors. The recall is intuitively the ability of the classifier to find all the positive sam...
the_stack_v2_python_sparse
mlu/metrics/classification/recall.py
Labbeti/MLU
train
2
61ab676097bba957e7b77d2eb3118dfcdea76cd3
[ "d = devicemanage(self.driver)\nd.open_devicemanage()\nself.assertEqual(d.verify(), True)\nd.add()\nself.assertEqual(d.sub_tagname(), '设备管理-新增')\nd.add_save()\nself.assertEqual(d.error_name(), '不能为空哦')\nself.assertEqual(d.error_company(), '不能为空哦')\nself.assertEqual(d.error_serial(), '不能为空哦')\nself.assertEqual(d.err...
<|body_start_0|> d = devicemanage(self.driver) d.open_devicemanage() self.assertEqual(d.verify(), True) d.add() self.assertEqual(d.sub_tagname(), '设备管理-新增') d.add_save() self.assertEqual(d.error_name(), '不能为空哦') self.assertEqual(d.error_company(), '不能为空哦')...
Test038_Device_Add_Error
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test038_Device_Add_Error: def test_device_add_error1(self): """输入为空""" <|body_0|> def test_device_add_error2(self): """版本号输入无效""" <|body_1|> <|end_skeleton|> <|body_start_0|> d = devicemanage(self.driver) d.open_devicemanage() self.a...
stack_v2_sparse_classes_36k_train_001936
1,393
no_license
[ { "docstring": "输入为空", "name": "test_device_add_error1", "signature": "def test_device_add_error1(self)" }, { "docstring": "版本号输入无效", "name": "test_device_add_error2", "signature": "def test_device_add_error2(self)" } ]
2
stack_v2_sparse_classes_30k_train_000626
Implement the Python class `Test038_Device_Add_Error` described below. Class description: Implement the Test038_Device_Add_Error class. Method signatures and docstrings: - def test_device_add_error1(self): 输入为空 - def test_device_add_error2(self): 版本号输入无效
Implement the Python class `Test038_Device_Add_Error` described below. Class description: Implement the Test038_Device_Add_Error class. Method signatures and docstrings: - def test_device_add_error1(self): 输入为空 - def test_device_add_error2(self): 版本号输入无效 <|skeleton|> class Test038_Device_Add_Error: def test_dev...
6f42c25249fc642cecc270578a180820988d45b5
<|skeleton|> class Test038_Device_Add_Error: def test_device_add_error1(self): """输入为空""" <|body_0|> def test_device_add_error2(self): """版本号输入无效""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test038_Device_Add_Error: def test_device_add_error1(self): """输入为空""" d = devicemanage(self.driver) d.open_devicemanage() self.assertEqual(d.verify(), True) d.add() self.assertEqual(d.sub_tagname(), '设备管理-新增') d.add_save() self.assertEqual(d.err...
the_stack_v2_python_sparse
GlxssLive_web/TestCase/Manage_Device/Test038_device_add_error.py
rrmiracle/GlxssLive
train
0
2ed822bf062e673e96c43cb0eacff104b46ce73b
[ "super(Postnet, self).__init__()\nself.postnet = torch.nn.ModuleList()\nfor layer in range(n_layers - 1):\n ichans = odim if layer == 0 else n_chans\n ochans = odim if layer == n_layers - 1 else n_chans\n if use_batch_norm:\n self.postnet += [torch.nn.Sequential(torch.nn.Conv1d(ichans, ochans, n_fil...
<|body_start_0|> super(Postnet, self).__init__() self.postnet = torch.nn.ModuleList() for layer in range(n_layers - 1): ichans = odim if layer == 0 else n_chans ochans = odim if layer == n_layers - 1 else n_chans if use_batch_norm: self.postnet...
Postnet module for Spectrogram prediction network. This is a module of Postnet in Spectrogram prediction network, which described in `Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions`_. The Postnet predicts refines the predicted Mel-filterbank of the decoder, which helps to compensate the de...
Postnet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Postnet: """Postnet module for Spectrogram prediction network. This is a module of Postnet in Spectrogram prediction network, which described in `Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions`_. The Postnet predicts refines the predicted Mel-filterbank of the decode...
stack_v2_sparse_classes_36k_train_001937
18,988
no_license
[ { "docstring": "Initialize postnet module. Args: idim (int): Dimension of the inputs. odim (int): Dimension of the outputs. n_layers (int, optional): The number of layers. n_filts (int, optional): The number of filter size. n_units (int, optional): The number of filter channels. use_batch_norm (bool, optional):...
2
null
Implement the Python class `Postnet` described below. Class description: Postnet module for Spectrogram prediction network. This is a module of Postnet in Spectrogram prediction network, which described in `Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions`_. The Postnet predicts refines the...
Implement the Python class `Postnet` described below. Class description: Postnet module for Spectrogram prediction network. This is a module of Postnet in Spectrogram prediction network, which described in `Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions`_. The Postnet predicts refines the...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class Postnet: """Postnet module for Spectrogram prediction network. This is a module of Postnet in Spectrogram prediction network, which described in `Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions`_. The Postnet predicts refines the predicted Mel-filterbank of the decode...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Postnet: """Postnet module for Spectrogram prediction network. This is a module of Postnet in Spectrogram prediction network, which described in `Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions`_. The Postnet predicts refines the predicted Mel-filterbank of the decoder, which help...
the_stack_v2_python_sparse
generated/test_rishikksh20_hifigan_denoiser.py
jansel/pytorch-jit-paritybench
train
35
650a01d2bb406b8130ca3b47d07a5d55d6cef788
[ "super(IntValidator, self).__init__(v, *args, **kw)\ntry:\n self.value = int(self.value, base)\nexcept (ValueError, TypeError):\n raise ValueError(msg)", "if self.value < max:\n return self\nraise ValueError(msg % {'value': self.value, 'max': max})", "if self.value <= max:\n return self\nraise Value...
<|body_start_0|> super(IntValidator, self).__init__(v, *args, **kw) try: self.value = int(self.value, base) except (ValueError, TypeError): raise ValueError(msg) <|end_body_0|> <|body_start_1|> if self.value < max: return self raise ValueError...
Conversion and validation of integers
IntValidator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IntValidator: """Conversion and validation of integers""" def __init__(self, v, base=10, msg=i18n._L('Must be an integer'), *args, **kw): """Initialisation Check that the value is an integer In: - ``v`` -- value to validate""" <|body_0|> def lesser_than(self, max, msg=_L...
stack_v2_sparse_classes_36k_train_001938
11,080
permissive
[ { "docstring": "Initialisation Check that the value is an integer In: - ``v`` -- value to validate", "name": "__init__", "signature": "def __init__(self, v, base=10, msg=i18n._L('Must be an integer'), *args, **kw)" }, { "docstring": "Check that the value is lesser than a limit In: - ``max`` -- t...
5
null
Implement the Python class `IntValidator` described below. Class description: Conversion and validation of integers Method signatures and docstrings: - def __init__(self, v, base=10, msg=i18n._L('Must be an integer'), *args, **kw): Initialisation Check that the value is an integer In: - ``v`` -- value to validate - d...
Implement the Python class `IntValidator` described below. Class description: Conversion and validation of integers Method signatures and docstrings: - def __init__(self, v, base=10, msg=i18n._L('Must be an integer'), *args, **kw): Initialisation Check that the value is an integer In: - ``v`` -- value to validate - d...
9e251f053c4edeb46b59b46d22049b29d1498727
<|skeleton|> class IntValidator: """Conversion and validation of integers""" def __init__(self, v, base=10, msg=i18n._L('Must be an integer'), *args, **kw): """Initialisation Check that the value is an integer In: - ``v`` -- value to validate""" <|body_0|> def lesser_than(self, max, msg=_L...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IntValidator: """Conversion and validation of integers""" def __init__(self, v, base=10, msg=i18n._L('Must be an integer'), *args, **kw): """Initialisation Check that the value is an integer In: - ``v`` -- value to validate""" super(IntValidator, self).__init__(v, *args, **kw) try...
the_stack_v2_python_sparse
cifrado/web/codigo/Python/virtualenv-15.1.0/NAGARE_HOME/Lib/site-packages/nagare-0.5.1-py2.7.egg/nagare/validator.py
SanchezRuizCarlosEduardo/disor
train
0
b4a9ece9c6075a5a53bf23e04b83b9958144b053
[ "super().__init__()\nargs = parse_args()\nif args.model_name == 'resnet50':\n self.model = models.alexnet(pretrained=True).eval()\nelif args.model_name == 'resnet101':\n self.model = models.resnet101(pretrained=True).eval()\nelif args.model_name == 'alexnet':\n self.model = models.alexnet(pretrained=True)....
<|body_start_0|> super().__init__() args = parse_args() if args.model_name == 'resnet50': self.model = models.alexnet(pretrained=True).eval() elif args.model_name == 'resnet101': self.model = models.resnet101(pretrained=True).eval() elif args.model_name ==...
python inference model
Predictor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Predictor: """python inference model""" def __init__(self): """model name""" <|body_0|> def forward(self, x): """model forward inference Args: x: input Returns: y_pred: output""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__() ...
stack_v2_sparse_classes_36k_train_001939
6,533
no_license
[ { "docstring": "model name", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "model forward inference Args: x: input Returns: y_pred: output", "name": "forward", "signature": "def forward(self, x)" } ]
2
null
Implement the Python class `Predictor` described below. Class description: python inference model Method signatures and docstrings: - def __init__(self): model name - def forward(self, x): model forward inference Args: x: input Returns: y_pred: output
Implement the Python class `Predictor` described below. Class description: python inference model Method signatures and docstrings: - def __init__(self): model name - def forward(self, x): model forward inference Args: x: input Returns: y_pred: output <|skeleton|> class Predictor: """python inference model""" ...
bd3790ce72a2a26611b5eda3901651b5a809348f
<|skeleton|> class Predictor: """python inference model""" def __init__(self): """model name""" <|body_0|> def forward(self, x): """model forward inference Args: x: input Returns: y_pred: output""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Predictor: """python inference model""" def __init__(self): """model name""" super().__init__() args = parse_args() if args.model_name == 'resnet50': self.model = models.alexnet(pretrained=True).eval() elif args.model_name == 'resnet101': se...
the_stack_v2_python_sparse
inference/benchmark/python/torch/clas_benchmark.py
PaddlePaddle/PaddleTest
train
42
fa13ee733d7c1dbc1a122cb26e2911ee5ff5e0ee
[ "super(MultiResolutionBlock, self).__init__()\nself.dilated_conv1 = nn.Conv1d(in_channels=in_channels, out_channels=out_channels, kernel_size=3, dilation=1, padding=1, stride=1)\nself.bn1 = nn.BatchNorm1d(num_features=out_channels)\nself.dilated_conv2 = nn.Conv1d(in_channels=out_channels, out_channels=out_channels,...
<|body_start_0|> super(MultiResolutionBlock, self).__init__() self.dilated_conv1 = nn.Conv1d(in_channels=in_channels, out_channels=out_channels, kernel_size=3, dilation=1, padding=1, stride=1) self.bn1 = nn.BatchNorm1d(num_features=out_channels) self.dilated_conv2 = nn.Conv1d(in_channels...
MultiResolutionBlock
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiResolutionBlock: def __init__(self, in_channels, out_channels, combine_type='no'): """combine multi-temporal-scale features, by concatenating dilated convs :param in_channels: :param out_channels: :param combine_type: no: concat featuremaps without combination conv2d: each feature m...
stack_v2_sparse_classes_36k_train_001940
8,301
permissive
[ { "docstring": "combine multi-temporal-scale features, by concatenating dilated convs :param in_channels: :param out_channels: :param combine_type: no: concat featuremaps without combination conv2d: each feature map as one channel conv1d: each channel as one input channel last: only use the biggest temporal-sca...
2
stack_v2_sparse_classes_30k_train_014651
Implement the Python class `MultiResolutionBlock` described below. Class description: Implement the MultiResolutionBlock class. Method signatures and docstrings: - def __init__(self, in_channels, out_channels, combine_type='no'): combine multi-temporal-scale features, by concatenating dilated convs :param in_channels...
Implement the Python class `MultiResolutionBlock` described below. Class description: Implement the MultiResolutionBlock class. Method signatures and docstrings: - def __init__(self, in_channels, out_channels, combine_type='no'): combine multi-temporal-scale features, by concatenating dilated convs :param in_channels...
8de7389923c7d9c97c1e7a07c253deb5ca72455b
<|skeleton|> class MultiResolutionBlock: def __init__(self, in_channels, out_channels, combine_type='no'): """combine multi-temporal-scale features, by concatenating dilated convs :param in_channels: :param out_channels: :param combine_type: no: concat featuremaps without combination conv2d: each feature m...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiResolutionBlock: def __init__(self, in_channels, out_channels, combine_type='no'): """combine multi-temporal-scale features, by concatenating dilated convs :param in_channels: :param out_channels: :param combine_type: no: concat featuremaps without combination conv2d: each feature map as one chan...
the_stack_v2_python_sparse
models/crnn.py
hackerekcah/distinct-events-asc
train
4
195e9f7af3d9bed294119e902fa0df02db3f9d5d
[ "for i in range(len(s) // 2):\n s[i], s[-i - 1] = (s[-i - 1], s[i])\nreturn s", "for i in range(len(s) // 2):\n s[i], s[len(s) - i - 1] = (s[len(s) - i - 1], s[i])\nreturn s", "left = 0\nright = len(s) - 1\nwhile left < right:\n s[left], s[right] = (s[right], s[left])\n left += 1\n right -= 1\nre...
<|body_start_0|> for i in range(len(s) // 2): s[i], s[-i - 1] = (s[-i - 1], s[i]) return s <|end_body_0|> <|body_start_1|> for i in range(len(s) // 2): s[i], s[len(s) - i - 1] = (s[len(s) - i - 1], s[i]) return s <|end_body_1|> <|body_start_2|> left = 0 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseString(self, s: List[str]) -> None: """Do not return anything, modify s in-place instead.""" <|body_0|> def reverseString1(self, s: List[str]) -> None: """Do not return anything, modify s in-place instead.""" <|body_1|> def reverseSt...
stack_v2_sparse_classes_36k_train_001941
806
no_license
[ { "docstring": "Do not return anything, modify s in-place instead.", "name": "reverseString", "signature": "def reverseString(self, s: List[str]) -> None" }, { "docstring": "Do not return anything, modify s in-place instead.", "name": "reverseString1", "signature": "def reverseString1(se...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseString(self, s: List[str]) -> None: Do not return anything, modify s in-place instead. - def reverseString1(self, s: List[str]) -> None: Do not return anything, modify...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseString(self, s: List[str]) -> None: Do not return anything, modify s in-place instead. - def reverseString1(self, s: List[str]) -> None: Do not return anything, modify...
4272d2e9fa36c89952767bd9752f3ca9f1a48e0c
<|skeleton|> class Solution: def reverseString(self, s: List[str]) -> None: """Do not return anything, modify s in-place instead.""" <|body_0|> def reverseString1(self, s: List[str]) -> None: """Do not return anything, modify s in-place instead.""" <|body_1|> def reverseSt...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseString(self, s: List[str]) -> None: """Do not return anything, modify s in-place instead.""" for i in range(len(s) // 2): s[i], s[-i - 1] = (s[-i - 1], s[i]) return s def reverseString1(self, s: List[str]) -> None: """Do not return anything...
the_stack_v2_python_sparse
Leetcode_solutions/reverseString.py
morita657/Algorithms
train
0
47e96a4c4471783938103cbaae8f5532b431acb2
[ "if not case_sens:\n low = keep.lower()\n up = keep.upper()\n keep = low + up\nkeep = keep.encode('utf-8')\nself._strip_table = dict([(c, None) for c in self.allchars if c not in keep])", "if s is None:\n raise TypeError\nif isinstance(s, bytes):\n s = s.decode('utf8')\ns = str(s)\nreturn s.transla...
<|body_start_0|> if not case_sens: low = keep.lower() up = keep.upper() keep = low + up keep = keep.encode('utf-8') self._strip_table = dict([(c, None) for c in self.allchars if c not in keep]) <|end_body_0|> <|body_start_1|> if s is None: ...
Returns a filter object o(s): call to return a filtered string. Specifically, strips out everything in s that is not in keep. This filter is case sensitive by default.
KeepChars
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeepChars: """Returns a filter object o(s): call to return a filtered string. Specifically, strips out everything in s that is not in keep. This filter is case sensitive by default.""" def __init__(self, keep, case_sens=True): """Returns a new KeepChars object, based on string keep""...
stack_v2_sparse_classes_36k_train_001942
3,387
permissive
[ { "docstring": "Returns a new KeepChars object, based on string keep", "name": "__init__", "signature": "def __init__(self, keep, case_sens=True)" }, { "docstring": "f(s) -> s, translates using self.allchars and self.delchars", "name": "__call__", "signature": "def __call__(self, s)" }...
2
null
Implement the Python class `KeepChars` described below. Class description: Returns a filter object o(s): call to return a filtered string. Specifically, strips out everything in s that is not in keep. This filter is case sensitive by default. Method signatures and docstrings: - def __init__(self, keep, case_sens=True...
Implement the Python class `KeepChars` described below. Class description: Returns a filter object o(s): call to return a filtered string. Specifically, strips out everything in s that is not in keep. This filter is case sensitive by default. Method signatures and docstrings: - def __init__(self, keep, case_sens=True...
4dfd7c67564110ac4b3db6949351a83d92fae8ef
<|skeleton|> class KeepChars: """Returns a filter object o(s): call to return a filtered string. Specifically, strips out everything in s that is not in keep. This filter is case sensitive by default.""" def __init__(self, keep, case_sens=True): """Returns a new KeepChars object, based on string keep""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KeepChars: """Returns a filter object o(s): call to return a filtered string. Specifically, strips out everything in s that is not in keep. This filter is case sensitive by default.""" def __init__(self, keep, case_sens=True): """Returns a new KeepChars object, based on string keep""" if ...
the_stack_v2_python_sparse
src/cogent3/util/transform.py
GavinHuttley/cogent3
train
1
7219e6eda24c85b742be0a2092d97eceb8dde47a
[ "np.random.seed(12312)\nN = len(data)\nsamples = np.random.choice(N, K, replace=False)\ncenters = data[samples, :]\nlabels = np.ones(shape=N, dtype=np.int64) * -1\nfor i in range(niter):\n labels = np.argmin(dist.cdist(data, centers, 'euclidean'), axis=1)\n centers = [np.mean(data[labels == c], axis=0) for c ...
<|body_start_0|> np.random.seed(12312) N = len(data) samples = np.random.choice(N, K, replace=False) centers = data[samples, :] labels = np.ones(shape=N, dtype=np.int64) * -1 for i in range(niter): labels = np.argmin(dist.cdist(data, centers, 'euclidean'), axi...
Question1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Question1: def kMeans(self, data, K, niter): """Implement the K-Means algorithm. **For grading purposes only:** Do NOT change the random seed, otherwise we are not able to grade your code! This is true throughout this script. However, in practice, you never want to set a random seed like...
stack_v2_sparse_classes_36k_train_001943
15,694
no_license
[ { "docstring": "Implement the K-Means algorithm. **For grading purposes only:** Do NOT change the random seed, otherwise we are not able to grade your code! This is true throughout this script. However, in practice, you never want to set a random seed like this. For your own interest, after you have finished im...
2
null
Implement the Python class `Question1` described below. Class description: Implement the Question1 class. Method signatures and docstrings: - def kMeans(self, data, K, niter): Implement the K-Means algorithm. **For grading purposes only:** Do NOT change the random seed, otherwise we are not able to grade your code! T...
Implement the Python class `Question1` described below. Class description: Implement the Question1 class. Method signatures and docstrings: - def kMeans(self, data, K, niter): Implement the K-Means algorithm. **For grading purposes only:** Do NOT change the random seed, otherwise we are not able to grade your code! T...
adcb6b47164a909fe8b3cd3969c8bc3f3696893a
<|skeleton|> class Question1: def kMeans(self, data, K, niter): """Implement the K-Means algorithm. **For grading purposes only:** Do NOT change the random seed, otherwise we are not able to grade your code! This is true throughout this script. However, in practice, you never want to set a random seed like...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Question1: def kMeans(self, data, K, niter): """Implement the K-Means algorithm. **For grading purposes only:** Do NOT change the random seed, otherwise we are not able to grade your code! This is true throughout this script. However, in practice, you never want to set a random seed like this. For you...
the_stack_v2_python_sparse
ECE365/ML/lab4/main.py
RickyL-2000/ZJUI-lib
train
1
3a8e504c19d672ae1e44c704f51e2173d714e8ab
[ "auth_org = self.obtain_auth_organization()\nresult = db_Result.get(id)\nif not result:\n return ({'msg': f'Result id={id} not found!'}, HTTPStatus.NOT_FOUND)\nif not self.r.v_glo.can():\n c_orgs = result.task.collaboration.organizations\n if not (self.r.v_org.can() and auth_org in c_orgs):\n return...
<|body_start_0|> auth_org = self.obtain_auth_organization() result = db_Result.get(id) if not result: return ({'msg': f'Result id={id} not found!'}, HTTPStatus.NOT_FOUND) if not self.r.v_glo.can(): c_orgs = result.task.collaboration.organizations if no...
Resource for /api/result
Result
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Result: """Resource for /api/result""" def get(self, id): """Get a single result --- description: >- Returns a result from a task specified by an id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |--|--|--|--|--|--| |Result|Globa...
stack_v2_sparse_classes_36k_train_001944
12,589
permissive
[ { "docstring": "Get a single result --- description: >- Returns a result from a task specified by an id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |--|--|--|--|--|--| |Result|Global|View|❌|❌|View any result| |Result|Organization|View|✅|✅|View the result...
2
null
Implement the Python class `Result` described below. Class description: Resource for /api/result Method signatures and docstrings: - def get(self, id): Get a single result --- description: >- Returns a result from a task specified by an id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to ...
Implement the Python class `Result` described below. Class description: Resource for /api/result Method signatures and docstrings: - def get(self, id): Get a single result --- description: >- Returns a result from a task specified by an id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to ...
b3ff6e91ac4caeaf31c12c20f73dfc61cfd9baca
<|skeleton|> class Result: """Resource for /api/result""" def get(self, id): """Get a single result --- description: >- Returns a result from a task specified by an id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |--|--|--|--|--|--| |Result|Globa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Result: """Resource for /api/result""" def get(self, id): """Get a single result --- description: >- Returns a result from a task specified by an id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |--|--|--|--|--|--| |Result|Global|View|❌|❌|Vi...
the_stack_v2_python_sparse
vantage6-server/vantage6/server/resource/result.py
vantage6/vantage6
train
15
de0021731355bab58356928f59264dd7e5fc2b06
[ "registry = RegistryManager.get(dbname)\nuser_info = None\nwith registry.cursor() as cr:\n res_partner = registry.get('res.partner')\n user_info = res_partner.signup_retrieve_info(cr, openerp.SUPERUSER_ID, token)\nreturn user_info", "url = '/'\nregistry = RegistryManager.get(dbname)\nwith registry.cursor() ...
<|body_start_0|> registry = RegistryManager.get(dbname) user_info = None with registry.cursor() as cr: res_partner = registry.get('res.partner') user_info = res_partner.signup_retrieve_info(cr, openerp.SUPERUSER_ID, token) return user_info <|end_body_0|> <|body_s...
Controller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Controller: def retrieve(self, req, dbname, token): """retrieve the user info (name, login or email) corresponding to a signup token""" <|body_0|> def signup(self, req, dbname, token, name, login, password, state=''): """sign up a user (new or existing), and log it i...
stack_v2_sparse_classes_36k_train_001945
2,685
no_license
[ { "docstring": "retrieve the user info (name, login or email) corresponding to a signup token", "name": "retrieve", "signature": "def retrieve(self, req, dbname, token)" }, { "docstring": "sign up a user (new or existing), and log it in", "name": "signup", "signature": "def signup(self, ...
2
stack_v2_sparse_classes_30k_train_005462
Implement the Python class `Controller` described below. Class description: Implement the Controller class. Method signatures and docstrings: - def retrieve(self, req, dbname, token): retrieve the user info (name, login or email) corresponding to a signup token - def signup(self, req, dbname, token, name, login, pass...
Implement the Python class `Controller` described below. Class description: Implement the Controller class. Method signatures and docstrings: - def retrieve(self, req, dbname, token): retrieve the user info (name, login or email) corresponding to a signup token - def signup(self, req, dbname, token, name, login, pass...
911cc2b7cb845f3fb6c891e03b99a4020069d380
<|skeleton|> class Controller: def retrieve(self, req, dbname, token): """retrieve the user info (name, login or email) corresponding to a signup token""" <|body_0|> def signup(self, req, dbname, token, name, login, password, state=''): """sign up a user (new or existing), and log it i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Controller: def retrieve(self, req, dbname, token): """retrieve the user info (name, login or email) corresponding to a signup token""" registry = RegistryManager.get(dbname) user_info = None with registry.cursor() as cr: res_partner = registry.get('res.partner') ...
the_stack_v2_python_sparse
auth_signup/controllers/main.py
ShantiSR/openerp-addons
train
0
a7946c7463f9a377950c0f02c01a14416cb9249a
[ "i, t = (len(nums) - 1, len(nums) - 1)\nwhile i >= 1 and nums[i] <= nums[i - 1]:\n i -= 1\ni_orig = i\nif i > 0:\n while nums[t] <= nums[i - 1]:\n t -= 1\n nums[i - 1], nums[t] = (nums[t], nums[i - 1])\n t = len(nums) - 1\n while i < t and i != t:\n nums[i], nums[t] = (nums[t], nums[i])...
<|body_start_0|> i, t = (len(nums) - 1, len(nums) - 1) while i >= 1 and nums[i] <= nums[i - 1]: i -= 1 i_orig = i if i > 0: while nums[t] <= nums[i - 1]: t -= 1 nums[i - 1], nums[t] = (nums[t], nums[i - 1]) t = len(nums) - 1...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def nextPermutation(self, nums: 'List[int]') -> 'List[int]': """Do not return anything, modify nums in-place instead.""" <|body_0|> def nextPermutation_1(self, nums: 'List[int]') -> 'List[int]': """Do not return anything, modify nums in-place instead.""" ...
stack_v2_sparse_classes_36k_train_001946
3,168
no_license
[ { "docstring": "Do not return anything, modify nums in-place instead.", "name": "nextPermutation", "signature": "def nextPermutation(self, nums: 'List[int]') -> 'List[int]'" }, { "docstring": "Do not return anything, modify nums in-place instead.", "name": "nextPermutation_1", "signature...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextPermutation(self, nums: 'List[int]') -> 'List[int]': Do not return anything, modify nums in-place instead. - def nextPermutation_1(self, nums: 'List[int]') -> 'List[int]'...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextPermutation(self, nums: 'List[int]') -> 'List[int]': Do not return anything, modify nums in-place instead. - def nextPermutation_1(self, nums: 'List[int]') -> 'List[int]'...
3d9e0ad2f6ed92ec969556f75d97c51ea4854719
<|skeleton|> class Solution: def nextPermutation(self, nums: 'List[int]') -> 'List[int]': """Do not return anything, modify nums in-place instead.""" <|body_0|> def nextPermutation_1(self, nums: 'List[int]') -> 'List[int]': """Do not return anything, modify nums in-place instead.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def nextPermutation(self, nums: 'List[int]') -> 'List[int]': """Do not return anything, modify nums in-place instead.""" i, t = (len(nums) - 1, len(nums) - 1) while i >= 1 and nums[i] <= nums[i - 1]: i -= 1 i_orig = i if i > 0: while nu...
the_stack_v2_python_sparse
Solutions/0031_nextPermutation.py
YoupengLi/leetcode-sorting
train
3
0101cb4e170a8d168a24134fee231c0d44274d44
[ "session = db_apis.get_session()\nwith session.begin():\n if not amps_data:\n db_lb = self.loadbalancer_repo.get(session, id=loadbalancer[constants.LOADBALANCER_ID])\n amps_data = db_lb.amphorae\n amps_data = [amp for amp in amps_data if amp.status == constants.AMPHORA_ALLOCATED]\napply_qos = Ap...
<|body_start_0|> session = db_apis.get_session() with session.begin(): if not amps_data: db_lb = self.loadbalancer_repo.get(session, id=loadbalancer[constants.LOADBALANCER_ID]) amps_data = db_lb.amphorae amps_data = [amp for amp in amps_data if amp...
Apply Quality of Services to the VIP
ApplyQos
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApplyQos: """Apply Quality of Services to the VIP""" def _apply_qos_on_vrrp_ports(self, loadbalancer, amps_data, qos_policy_id, is_revert=False, request_qos_id=None): """Call network driver to apply QoS Policy on the vrrp ports.""" <|body_0|> def execute(self, loadbalanc...
stack_v2_sparse_classes_36k_train_001947
44,034
permissive
[ { "docstring": "Call network driver to apply QoS Policy on the vrrp ports.", "name": "_apply_qos_on_vrrp_ports", "signature": "def _apply_qos_on_vrrp_ports(self, loadbalancer, amps_data, qos_policy_id, is_revert=False, request_qos_id=None)" }, { "docstring": "Apply qos policy on the vrrp ports w...
3
stack_v2_sparse_classes_30k_train_009474
Implement the Python class `ApplyQos` described below. Class description: Apply Quality of Services to the VIP Method signatures and docstrings: - def _apply_qos_on_vrrp_ports(self, loadbalancer, amps_data, qos_policy_id, is_revert=False, request_qos_id=None): Call network driver to apply QoS Policy on the vrrp ports...
Implement the Python class `ApplyQos` described below. Class description: Apply Quality of Services to the VIP Method signatures and docstrings: - def _apply_qos_on_vrrp_ports(self, loadbalancer, amps_data, qos_policy_id, is_revert=False, request_qos_id=None): Call network driver to apply QoS Policy on the vrrp ports...
0426285a41464a5015494584f109eed35a0d44db
<|skeleton|> class ApplyQos: """Apply Quality of Services to the VIP""" def _apply_qos_on_vrrp_ports(self, loadbalancer, amps_data, qos_policy_id, is_revert=False, request_qos_id=None): """Call network driver to apply QoS Policy on the vrrp ports.""" <|body_0|> def execute(self, loadbalanc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApplyQos: """Apply Quality of Services to the VIP""" def _apply_qos_on_vrrp_ports(self, loadbalancer, amps_data, qos_policy_id, is_revert=False, request_qos_id=None): """Call network driver to apply QoS Policy on the vrrp ports.""" session = db_apis.get_session() with session.begi...
the_stack_v2_python_sparse
octavia/controller/worker/v2/tasks/network_tasks.py
openstack/octavia
train
147
4c832566bf9663352ff8ddec9f5b1744e794e7bd
[ "self.num_points = num_points\nself.distance = distance\nself.x_values: List[int] = [0]\nself.y_values: List[int] = [0]", "while len(self.x_values) < self.num_points:\n x_step: int = self.get_step()\n y_step: int = self.get_step()\n if x_step == 0 and y_step == 0:\n continue\n x: int = self.x_v...
<|body_start_0|> self.num_points = num_points self.distance = distance self.x_values: List[int] = [0] self.y_values: List[int] = [0] <|end_body_0|> <|body_start_1|> while len(self.x_values) < self.num_points: x_step: int = self.get_step() y_step: int = se...
A class to generate 'random' walks.
RandomWalk
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomWalk: """A class to generate 'random' walks.""" def __init__(self, num_points: int=5000, distance: str='medium') -> None: """Initialize class attributes for a 'random' walk.""" <|body_0|> def fill_walk(self) -> None: """Calculate all the points in the walk....
stack_v2_sparse_classes_36k_train_001948
1,862
no_license
[ { "docstring": "Initialize class attributes for a 'random' walk.", "name": "__init__", "signature": "def __init__(self, num_points: int=5000, distance: str='medium') -> None" }, { "docstring": "Calculate all the points in the walk.", "name": "fill_walk", "signature": "def fill_walk(self)...
3
stack_v2_sparse_classes_30k_train_018320
Implement the Python class `RandomWalk` described below. Class description: A class to generate 'random' walks. Method signatures and docstrings: - def __init__(self, num_points: int=5000, distance: str='medium') -> None: Initialize class attributes for a 'random' walk. - def fill_walk(self) -> None: Calculate all th...
Implement the Python class `RandomWalk` described below. Class description: A class to generate 'random' walks. Method signatures and docstrings: - def __init__(self, num_points: int=5000, distance: str='medium') -> None: Initialize class attributes for a 'random' walk. - def fill_walk(self) -> None: Calculate all th...
3f35958de497026da5e7d0d0a52fe3f20f2ef196
<|skeleton|> class RandomWalk: """A class to generate 'random' walks.""" def __init__(self, num_points: int=5000, distance: str='medium') -> None: """Initialize class attributes for a 'random' walk.""" <|body_0|> def fill_walk(self) -> None: """Calculate all the points in the walk....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomWalk: """A class to generate 'random' walks.""" def __init__(self, num_points: int=5000, distance: str='medium') -> None: """Initialize class attributes for a 'random' walk.""" self.num_points = num_points self.distance = distance self.x_values: List[int] = [0] ...
the_stack_v2_python_sparse
DataVisualization/chapter_15/random_walk.py
leetuckert10/CrashCourse
train
0
2cacff6b91cef823a92a8fac7b78b560245c2c6f
[ "self.ip = '172.31.139.156'\nself.port = '8001'\nself.conn = '{}:{}'.format(self.ip, self.port)", "try:\n auth = faceRecognition_pb2.Auth(token=auth_token())\n request = faceRecognition_pb2.faceData(auth=auth)\n with grpc.insecure_channel(self.conn) as channel:\n stub = faceRecognition_pb2_grpc.Fa...
<|body_start_0|> self.ip = '172.31.139.156' self.port = '8001' self.conn = '{}:{}'.format(self.ip, self.port) <|end_body_0|> <|body_start_1|> try: auth = faceRecognition_pb2.Auth(token=auth_token()) request = faceRecognition_pb2.faceData(auth=auth) wi...
FireHydrantFacecRecognitionClient
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FireHydrantFacecRecognitionClient: def __init__(self): """人脸识别grpc客户端""" <|body_0|> def update_library(self): """更新脸谱 :return:""" <|body_1|> def upload_face(self, face_image, uuid): """上传人脸 :param face_image: :param uuid: :return:""" <|bo...
stack_v2_sparse_classes_36k_train_001949
2,592
no_license
[ { "docstring": "人脸识别grpc客户端", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "更新脸谱 :return:", "name": "update_library", "signature": "def update_library(self)" }, { "docstring": "上传人脸 :param face_image: :param uuid: :return:", "name": "upload_face", ...
4
null
Implement the Python class `FireHydrantFacecRecognitionClient` described below. Class description: Implement the FireHydrantFacecRecognitionClient class. Method signatures and docstrings: - def __init__(self): 人脸识别grpc客户端 - def update_library(self): 更新脸谱 :return: - def upload_face(self, face_image, uuid): 上传人脸 :param...
Implement the Python class `FireHydrantFacecRecognitionClient` described below. Class description: Implement the FireHydrantFacecRecognitionClient class. Method signatures and docstrings: - def __init__(self): 人脸识别grpc客户端 - def update_library(self): 更新脸谱 :return: - def upload_face(self, face_image, uuid): 上传人脸 :param...
7467cd66e1fc91f0b3a264f8fc9b93f22f09fe7b
<|skeleton|> class FireHydrantFacecRecognitionClient: def __init__(self): """人脸识别grpc客户端""" <|body_0|> def update_library(self): """更新脸谱 :return:""" <|body_1|> def upload_face(self, face_image, uuid): """上传人脸 :param face_image: :param uuid: :return:""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FireHydrantFacecRecognitionClient: def __init__(self): """人脸识别grpc客户端""" self.ip = '172.31.139.156' self.port = '8001' self.conn = '{}:{}'.format(self.ip, self.port) def update_library(self): """更新脸谱 :return:""" try: auth = faceRecognition_pb2.A...
the_stack_v2_python_sparse
FireHydrant/common/grpc/facec_grpc_client.py
shoogoome/FireHydrant
train
4
e6e4825bfcdf41cab7b1d126b7980034a3b1e714
[ "m = n = -1\nfor i in range(len(nums) - 2, -1, -1):\n if nums[i] < nums[i + 1]:\n m = i\n break\nif m == -1:\n nums.reverse()\n return\nfor i in range(len(nums) - 1, m, -1):\n if nums[i] > nums[m]:\n n = i\n break\nnums[m], nums[n] = (nums[n], nums[m])\nnums[m + 1:] = nums[:m...
<|body_start_0|> m = n = -1 for i in range(len(nums) - 2, -1, -1): if nums[i] < nums[i + 1]: m = i break if m == -1: nums.reverse() return for i in range(len(nums) - 1, m, -1): if nums[i] > nums[m]: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def nextPermutation(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def nextPermutation_verbose(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-...
stack_v2_sparse_classes_36k_train_001950
3,233
no_license
[ { "docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.", "name": "nextPermutation", "signature": "def nextPermutation(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.", "...
2
stack_v2_sparse_classes_30k_train_002909
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextPermutation(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. - def nextPermutation_verbose(self, nums): :type nums: L...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextPermutation(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. - def nextPermutation_verbose(self, nums): :type nums: L...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def nextPermutation(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def nextPermutation_verbose(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def nextPermutation(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" m = n = -1 for i in range(len(nums) - 2, -1, -1): if nums[i] < nums[i + 1]: m = i break if m == ...
the_stack_v2_python_sparse
src/lt_31.py
oxhead/CodingYourWay
train
0
0ab3d46aa9155999d1bccc5fb25b5041d5be5896
[ "self.units = zaza.model.get_application_config(self.application)['min-cluster-size']['value']\nlogging.info('Ensuring PXC is bootstrapped')\nmsg = 'Percona cluster failed to bootstrap'\nassert self.is_pxc_bootstrapped(), msg\nlogging.info('Checking PXC cluster size >= {}'.format(self.units))\ncluster_size = int(se...
<|body_start_0|> self.units = zaza.model.get_application_config(self.application)['min-cluster-size']['value'] logging.info('Ensuring PXC is bootstrapped') msg = 'Percona cluster failed to bootstrap' assert self.is_pxc_bootstrapped(), msg logging.info('Checking PXC cluster size >...
Percona-cluster charm tests. .. note:: these have tests have been ported from amulet tests
PerconaClusterCharmTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PerconaClusterCharmTests: """Percona-cluster charm tests. .. note:: these have tests have been ported from amulet tests""" def test_100_bootstrapped_and_clustered(self): """Ensure PXC is bootstrapped and that peer units are clustered.""" <|body_0|> def test_130_change_ro...
stack_v2_sparse_classes_36k_train_001951
45,009
permissive
[ { "docstring": "Ensure PXC is bootstrapped and that peer units are clustered.", "name": "test_100_bootstrapped_and_clustered", "signature": "def test_100_bootstrapped_and_clustered(self)" }, { "docstring": "Change root password. Change the root password and verify the change was effectively appl...
2
null
Implement the Python class `PerconaClusterCharmTests` described below. Class description: Percona-cluster charm tests. .. note:: these have tests have been ported from amulet tests Method signatures and docstrings: - def test_100_bootstrapped_and_clustered(self): Ensure PXC is bootstrapped and that peer units are clu...
Implement the Python class `PerconaClusterCharmTests` described below. Class description: Percona-cluster charm tests. .. note:: these have tests have been ported from amulet tests Method signatures and docstrings: - def test_100_bootstrapped_and_clustered(self): Ensure PXC is bootstrapped and that peer units are clu...
3b17ad9d97c57b6e62797d4e3333e4b83e43a447
<|skeleton|> class PerconaClusterCharmTests: """Percona-cluster charm tests. .. note:: these have tests have been ported from amulet tests""" def test_100_bootstrapped_and_clustered(self): """Ensure PXC is bootstrapped and that peer units are clustered.""" <|body_0|> def test_130_change_ro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PerconaClusterCharmTests: """Percona-cluster charm tests. .. note:: these have tests have been ported from amulet tests""" def test_100_bootstrapped_and_clustered(self): """Ensure PXC is bootstrapped and that peer units are clustered.""" self.units = zaza.model.get_application_config(self...
the_stack_v2_python_sparse
zaza/openstack/charm_tests/mysql/tests.py
openstack-charmers/zaza-openstack-tests
train
7
a0ddd5fcfae36a337bb1a6a35a0d26b8b6a78e0b
[ "if isinstance(attribute, XAttributeDiscrete):\n return XAttributeDiscrete\nelif isinstance(attribute, XAttributeLiteral):\n return XAttributeLiteral\nelif isinstance(attribute, XAttributeContinuous):\n return XAttributeContinuous\nelif isinstance(attribute, XAttributeBoolean):\n return XAttributeBoolea...
<|body_start_0|> if isinstance(attribute, XAttributeDiscrete): return XAttributeDiscrete elif isinstance(attribute, XAttributeLiteral): return XAttributeLiteral elif isinstance(attribute, XAttributeContinuous): return XAttributeContinuous elif isinstan...
Utilities for working with attributes.
XAttributeUtils
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XAttributeUtils: """Utilities for working with attributes.""" def get_type(attribute): """For the given attribute, returns its type, i.e., the most high-level, typed interface this attribute implements. :param attribute: Attribute to analyze. :type attribute: XAttribute :return: Clas...
stack_v2_sparse_classes_36k_train_001952
4,322
no_license
[ { "docstring": "For the given attribute, returns its type, i.e., the most high-level, typed interface this attribute implements. :param attribute: Attribute to analyze. :type attribute: XAttribute :return: Class of this attribute. :rtype: type", "name": "get_type", "signature": "def get_type(attribute)"...
3
stack_v2_sparse_classes_30k_test_000064
Implement the Python class `XAttributeUtils` described below. Class description: Utilities for working with attributes. Method signatures and docstrings: - def get_type(attribute): For the given attribute, returns its type, i.e., the most high-level, typed interface this attribute implements. :param attribute: Attrib...
Implement the Python class `XAttributeUtils` described below. Class description: Utilities for working with attributes. Method signatures and docstrings: - def get_type(attribute): For the given attribute, returns its type, i.e., the most high-level, typed interface this attribute implements. :param attribute: Attrib...
b21d43650448d474cfa678c61ac02689859d6826
<|skeleton|> class XAttributeUtils: """Utilities for working with attributes.""" def get_type(attribute): """For the given attribute, returns its type, i.e., the most high-level, typed interface this attribute implements. :param attribute: Attribute to analyze. :type attribute: XAttribute :return: Clas...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XAttributeUtils: """Utilities for working with attributes.""" def get_type(attribute): """For the given attribute, returns its type, i.e., the most high-level, typed interface this attribute implements. :param attribute: Attribute to analyze. :type attribute: XAttribute :return: Class of this att...
the_stack_v2_python_sparse
opyenxes/utils/XAttributeUtils.py
TKasekamp/OpyenXes
train
0
90b4d1e25c03d46b677ff831bd79e6b859d1fb2a
[ "intervals = []\ninsertInt = interval('(1,3)')\nself.assertEqual(insert(intervals, insertInt), [insertInt])", "intervals = [interval('(0,3)'), interval('(6,10)')]\ninsertInt = interval('(4,5]')\nself.assertEqual(insert(intervals, insertInt), [interval('(0,3)'), interval('(4,5]'), interval('(6,10)')])", "interva...
<|body_start_0|> intervals = [] insertInt = interval('(1,3)') self.assertEqual(insert(intervals, insertInt), [insertInt]) <|end_body_0|> <|body_start_1|> intervals = [interval('(0,3)'), interval('(6,10)')] insertInt = interval('(4,5]') self.assertEqual(insert(intervals, ...
Tests for insert method method from interval class, grouped for clarity
InsertTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InsertTests: """Tests for insert method method from interval class, grouped for clarity""" def testEmptyList(self): """Test that insert works on empty list""" <|body_0|> def testInsertWithoutMerge(self): """Test that insert adds interval to list when none can be ...
stack_v2_sparse_classes_36k_train_001953
8,576
no_license
[ { "docstring": "Test that insert works on empty list", "name": "testEmptyList", "signature": "def testEmptyList(self)" }, { "docstring": "Test that insert adds interval to list when none can be merged", "name": "testInsertWithoutMerge", "signature": "def testInsertWithoutMerge(self)" }...
4
null
Implement the Python class `InsertTests` described below. Class description: Tests for insert method method from interval class, grouped for clarity Method signatures and docstrings: - def testEmptyList(self): Test that insert works on empty list - def testInsertWithoutMerge(self): Test that insert adds interval to l...
Implement the Python class `InsertTests` described below. Class description: Tests for insert method method from interval class, grouped for clarity Method signatures and docstrings: - def testEmptyList(self): Test that insert works on empty list - def testInsertWithoutMerge(self): Test that insert adds interval to l...
33c7a3e579c37ce3096099a350a7c8135b302ea4
<|skeleton|> class InsertTests: """Tests for insert method method from interval class, grouped for clarity""" def testEmptyList(self): """Test that insert works on empty list""" <|body_0|> def testInsertWithoutMerge(self): """Test that insert adds interval to list when none can be ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InsertTests: """Tests for insert method method from interval class, grouped for clarity""" def testEmptyList(self): """Test that insert works on empty list""" intervals = [] insertInt = interval('(1,3)') self.assertEqual(insert(intervals, insertInt), [insertInt]) def ...
the_stack_v2_python_sparse
lh1036/interval/test_interval.py
ds-ga-1007/assignment7
train
0
f3755bb54aa50a64bb193f1dd729787e10ed16e6
[ "self.status = status\nself.return_code = return_code\nself.return_message = return_message\nself.provider_name = provider_name\nself.score = score", "if dictionary is None:\n return None\nstatus = dictionary.get('status')\nreturn_code = dictionary.get('return_code')\nreturn_message = dictionary.get('return_me...
<|body_start_0|> self.status = status self.return_code = return_code self.return_message = return_message self.provider_name = provider_name self.score = score <|end_body_0|> <|body_start_1|> if dictionary is None: return None status = dictionary.get(...
Implementation of the 'GetAntifraudResponse' model. TODO: type model description here. Attributes: status (string): TODO: type description here. return_code (string): TODO: type description here. return_message (string): TODO: type description here. provider_name (string): TODO: type description here. score (string): T...
GetAntifraudResponse
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetAntifraudResponse: """Implementation of the 'GetAntifraudResponse' model. TODO: type model description here. Attributes: status (string): TODO: type description here. return_code (string): TODO: type description here. return_message (string): TODO: type description here. provider_name (string)...
stack_v2_sparse_classes_36k_train_001954
2,437
permissive
[ { "docstring": "Constructor for the GetAntifraudResponse class", "name": "__init__", "signature": "def __init__(self, status=None, return_code=None, return_message=None, provider_name=None, score=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dict...
2
null
Implement the Python class `GetAntifraudResponse` described below. Class description: Implementation of the 'GetAntifraudResponse' model. TODO: type model description here. Attributes: status (string): TODO: type description here. return_code (string): TODO: type description here. return_message (string): TODO: type d...
Implement the Python class `GetAntifraudResponse` described below. Class description: Implementation of the 'GetAntifraudResponse' model. TODO: type model description here. Attributes: status (string): TODO: type description here. return_code (string): TODO: type description here. return_message (string): TODO: type d...
95c80c35dd57bb2a238faeaf30d1e3b4544d2298
<|skeleton|> class GetAntifraudResponse: """Implementation of the 'GetAntifraudResponse' model. TODO: type model description here. Attributes: status (string): TODO: type description here. return_code (string): TODO: type description here. return_message (string): TODO: type description here. provider_name (string)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetAntifraudResponse: """Implementation of the 'GetAntifraudResponse' model. TODO: type model description here. Attributes: status (string): TODO: type description here. return_code (string): TODO: type description here. return_message (string): TODO: type description here. provider_name (string): TODO: type ...
the_stack_v2_python_sparse
mundiapi/models/get_antifraud_response.py
mundipagg/MundiAPI-PYTHON
train
10
6d254cd959bb9b5fa458d862289f585bc6f063a2
[ "L = list(map(int, str(N + 1)))\nres, n = (0, len(L))\n\ndef A(m, n):\n return 1 if n == 0 else A(m, n - 1) * (m - n + 1)\nfor i in range(1, n):\n res += 9 * A(9, i - 1)\ns = set()\nfor i, x in enumerate(L):\n for y in range(0 if i else 1, x):\n if y not in s:\n res += A(9 - i, n - i - 1)...
<|body_start_0|> L = list(map(int, str(N + 1))) res, n = (0, len(L)) def A(m, n): return 1 if n == 0 else A(m, n - 1) * (m - n + 1) for i in range(1, n): res += 9 * A(9, i - 1) s = set() for i, x in enumerate(L): for y in range(0 if i ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numDupDigitsAtMostN(self, N): """:param N: :return:""" <|body_0|> def numDupDigitsAtMostN2(self, N): """超时 :param N: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> L = list(map(int, str(N + 1))) res, n = (0, len(L)) ...
stack_v2_sparse_classes_36k_train_001955
2,023
no_license
[ { "docstring": ":param N: :return:", "name": "numDupDigitsAtMostN", "signature": "def numDupDigitsAtMostN(self, N)" }, { "docstring": "超时 :param N: :return:", "name": "numDupDigitsAtMostN2", "signature": "def numDupDigitsAtMostN2(self, N)" } ]
2
stack_v2_sparse_classes_30k_train_001597
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numDupDigitsAtMostN(self, N): :param N: :return: - def numDupDigitsAtMostN2(self, N): 超时 :param N: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numDupDigitsAtMostN(self, N): :param N: :return: - def numDupDigitsAtMostN2(self, N): 超时 :param N: :return: <|skeleton|> class Solution: def numDupDigitsAtMostN(self, N...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def numDupDigitsAtMostN(self, N): """:param N: :return:""" <|body_0|> def numDupDigitsAtMostN2(self, N): """超时 :param N: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numDupDigitsAtMostN(self, N): """:param N: :return:""" L = list(map(int, str(N + 1))) res, n = (0, len(L)) def A(m, n): return 1 if n == 0 else A(m, n - 1) * (m - n + 1) for i in range(1, n): res += 9 * A(9, i - 1) s = set(...
the_stack_v2_python_sparse
1012_至少有 1 位重复的数字.py
lovehhf/LeetCode
train
0
f406b36ad1b669abdba349279daccc8d4db6cc35
[ "self.enabled = enabled\nself.last_updated_timestamp_secs = last_updated_timestamp_secs\nself.pinned_time_secs = pinned_time_secs", "if dictionary is None:\n return None\nenabled = dictionary.get('enabled')\nlast_updated_timestamp_secs = dictionary.get('lastUpdatedTimestampSecs')\npinned_time_secs = dictionary...
<|body_start_0|> self.enabled = enabled self.last_updated_timestamp_secs = last_updated_timestamp_secs self.pinned_time_secs = pinned_time_secs <|end_body_0|> <|body_start_1|> if dictionary is None: return None enabled = dictionary.get('enabled') last_updated...
Implementation of the 'ViewPinningConfig' model. TODO: type description here. Attributes: enabled (bool, required): Specifies if view pinning is enabled. If set to true, view will be pinned to SSD. last_updated_timestamp_secs (long|int): Specifies the timestamp when view pinning config is last updated. pinned_time_secs...
ViewPinningConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ViewPinningConfig: """Implementation of the 'ViewPinningConfig' model. TODO: type description here. Attributes: enabled (bool, required): Specifies if view pinning is enabled. If set to true, view will be pinned to SSD. last_updated_timestamp_secs (long|int): Specifies the timestamp when view pin...
stack_v2_sparse_classes_36k_train_001956
2,126
permissive
[ { "docstring": "Constructor for the ViewPinningConfig class", "name": "__init__", "signature": "def __init__(self, enabled=None, last_updated_timestamp_secs=None, pinned_time_secs=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dicti...
2
stack_v2_sparse_classes_30k_train_019150
Implement the Python class `ViewPinningConfig` described below. Class description: Implementation of the 'ViewPinningConfig' model. TODO: type description here. Attributes: enabled (bool, required): Specifies if view pinning is enabled. If set to true, view will be pinned to SSD. last_updated_timestamp_secs (long|int)...
Implement the Python class `ViewPinningConfig` described below. Class description: Implementation of the 'ViewPinningConfig' model. TODO: type description here. Attributes: enabled (bool, required): Specifies if view pinning is enabled. If set to true, view will be pinned to SSD. last_updated_timestamp_secs (long|int)...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ViewPinningConfig: """Implementation of the 'ViewPinningConfig' model. TODO: type description here. Attributes: enabled (bool, required): Specifies if view pinning is enabled. If set to true, view will be pinned to SSD. last_updated_timestamp_secs (long|int): Specifies the timestamp when view pin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ViewPinningConfig: """Implementation of the 'ViewPinningConfig' model. TODO: type description here. Attributes: enabled (bool, required): Specifies if view pinning is enabled. If set to true, view will be pinned to SSD. last_updated_timestamp_secs (long|int): Specifies the timestamp when view pinning config i...
the_stack_v2_python_sparse
cohesity_management_sdk/models/view_pinning_config.py
cohesity/management-sdk-python
train
24
909d6e7e9ad569c8f9d1a7d6c07fe07d0836695d
[ "super().__init__()\nself.root = root\nfiles = glob.glob(os.path.join(root, '**.csv'))\nif not files:\n raise FileNotFoundError(f'Dataset not found in `root={self.root}`')\ntry:\n import pandas as pd\nexcept ImportError:\n raise ImportError('pandas is not installed and is required to use this dataset')\nda...
<|body_start_0|> super().__init__() self.root = root files = glob.glob(os.path.join(root, '**.csv')) if not files: raise FileNotFoundError(f'Dataset not found in `root={self.root}`') try: import pandas as pd except ImportError: raise Im...
Dataset for iNaturalist. `iNaturalist <https://www.inaturalist.org/>`__ is a joint initiative of the California Academy of Sciences and the National Geographic Society. It allows citizen scientists to upload observations of organisms that can be downloaded by scientists and researchers. If you use an iNaturalist datase...
INaturalist
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class INaturalist: """Dataset for iNaturalist. `iNaturalist <https://www.inaturalist.org/>`__ is a joint initiative of the California Academy of Sciences and the National Geographic Society. It allows citizen scientists to upload observations of organisms that can be downloaded by scientists and resear...
stack_v2_sparse_classes_36k_train_001957
3,857
permissive
[ { "docstring": "Initialize a new Dataset instance. Args: root: root directory where dataset can be found Raises: FileNotFoundError: if no files are found in ``root`` ImportError: if pandas is not installed", "name": "__init__", "signature": "def __init__(self, root: str='data') -> None" }, { "do...
2
null
Implement the Python class `INaturalist` described below. Class description: Dataset for iNaturalist. `iNaturalist <https://www.inaturalist.org/>`__ is a joint initiative of the California Academy of Sciences and the National Geographic Society. It allows citizen scientists to upload observations of organisms that can...
Implement the Python class `INaturalist` described below. Class description: Dataset for iNaturalist. `iNaturalist <https://www.inaturalist.org/>`__ is a joint initiative of the California Academy of Sciences and the National Geographic Society. It allows citizen scientists to upload observations of organisms that can...
29985861614b3b93f9ef5389469ebb98570de7dd
<|skeleton|> class INaturalist: """Dataset for iNaturalist. `iNaturalist <https://www.inaturalist.org/>`__ is a joint initiative of the California Academy of Sciences and the National Geographic Society. It allows citizen scientists to upload observations of organisms that can be downloaded by scientists and resear...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class INaturalist: """Dataset for iNaturalist. `iNaturalist <https://www.inaturalist.org/>`__ is a joint initiative of the California Academy of Sciences and the National Geographic Society. It allows citizen scientists to upload observations of organisms that can be downloaded by scientists and researchers. If you...
the_stack_v2_python_sparse
torchgeo/datasets/inaturalist.py
microsoft/torchgeo
train
1,724
cfcc50c14893e9388ca33733ef40f33689144a99
[ "debug('BlockObject.__str__ %s, %s, %s', self.name, self.args, self.opts)\ncode = ''\ncode += self._get_begin_code()\nfor opt in self.opts:\n if isinstance(opt, SceneItem):\n code += str(opt)\n else:\n code += self._get_line(str(opt))\ncode += self._get_end_code()\ndebug('BlockObject.__str__ Cod...
<|body_start_0|> debug('BlockObject.__str__ %s, %s, %s', self.name, self.args, self.opts) code = '' code += self._get_begin_code() for opt in self.opts: if isinstance(opt, SceneItem): code += str(opt) else: code += self._get_line(st...
provides methods to generate code blocks.
BlockObject
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlockObject: """provides methods to generate code blocks.""" def __str__(self): """return PoV code as string representation.""" <|body_0|> def _get_begin_code(self): """Start block of code.""" <|body_1|> def _get_end_code(self): """End block ...
stack_v2_sparse_classes_36k_train_001958
1,718
no_license
[ { "docstring": "return PoV code as string representation.", "name": "__str__", "signature": "def __str__(self)" }, { "docstring": "Start block of code.", "name": "_get_begin_code", "signature": "def _get_begin_code(self)" }, { "docstring": "End block of code.", "name": "_get_...
3
stack_v2_sparse_classes_30k_test_000559
Implement the Python class `BlockObject` described below. Class description: provides methods to generate code blocks. Method signatures and docstrings: - def __str__(self): return PoV code as string representation. - def _get_begin_code(self): Start block of code. - def _get_end_code(self): End block of code.
Implement the Python class `BlockObject` described below. Class description: provides methods to generate code blocks. Method signatures and docstrings: - def __str__(self): return PoV code as string representation. - def _get_begin_code(self): Start block of code. - def _get_end_code(self): End block of code. <|ske...
27c5d3f78c545ad01ecd6388cebb8326d164cbd0
<|skeleton|> class BlockObject: """provides methods to generate code blocks.""" def __str__(self): """return PoV code as string representation.""" <|body_0|> def _get_begin_code(self): """Start block of code.""" <|body_1|> def _get_end_code(self): """End block ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BlockObject: """provides methods to generate code blocks.""" def __str__(self): """return PoV code as string representation.""" debug('BlockObject.__str__ %s, %s, %s', self.name, self.args, self.opts) code = '' code += self._get_begin_code() for opt in self.opts: ...
the_stack_v2_python_sparse
pov/basic/BlockObject.py
pennyarcade/py_pov
train
0
8b085fff21261152e2cd43b3d0704ed56eb23550
[ "blackTypeDict = self.getDictBykey(self.__getBlacklistConfig().json(), 'name', blackType)\nself.url = '/mgr/park/parkBlacklist/save.do'\ndata = {'specialCarTypeConfigId': blackTypeDict['id'], 'carLicenseNumber': carNum, 'owner': 'apipytest', 'reason': 'pytest', 'remark1': 'pytest', 'blacklistForeverFlag': 'CLOSE', ...
<|body_start_0|> blackTypeDict = self.getDictBykey(self.__getBlacklistConfig().json(), 'name', blackType) self.url = '/mgr/park/parkBlacklist/save.do' data = {'specialCarTypeConfigId': blackTypeDict['id'], 'carLicenseNumber': carNum, 'owner': 'apipytest', 'reason': 'pytest', 'remark1': 'pytest',...
黑名单录入
ParkBlacklist
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParkBlacklist: """黑名单录入""" def addBlacklist(self, blackType, carNum): """新建黑名单车辆""" <|body_0|> def __getBlacklistConfig(self): """获取黑名单配置""" <|body_1|> def delBlacklist(self, parkName, carNum): """删除黑名单""" <|body_2|> def getBlack...
stack_v2_sparse_classes_36k_train_001959
13,467
no_license
[ { "docstring": "新建黑名单车辆", "name": "addBlacklist", "signature": "def addBlacklist(self, blackType, carNum)" }, { "docstring": "获取黑名单配置", "name": "__getBlacklistConfig", "signature": "def __getBlacklistConfig(self)" }, { "docstring": "删除黑名单", "name": "delBlacklist", "signat...
4
stack_v2_sparse_classes_30k_train_005736
Implement the Python class `ParkBlacklist` described below. Class description: 黑名单录入 Method signatures and docstrings: - def addBlacklist(self, blackType, carNum): 新建黑名单车辆 - def __getBlacklistConfig(self): 获取黑名单配置 - def delBlacklist(self, parkName, carNum): 删除黑名单 - def getBlacklist(self, parkName): 获取黑名单列表
Implement the Python class `ParkBlacklist` described below. Class description: 黑名单录入 Method signatures and docstrings: - def addBlacklist(self, blackType, carNum): 新建黑名单车辆 - def __getBlacklistConfig(self): 获取黑名单配置 - def delBlacklist(self, parkName, carNum): 删除黑名单 - def getBlacklist(self, parkName): 获取黑名单列表 <|skeleto...
34c368c109867da26d9256bca85f872b0fac2ea7
<|skeleton|> class ParkBlacklist: """黑名单录入""" def addBlacklist(self, blackType, carNum): """新建黑名单车辆""" <|body_0|> def __getBlacklistConfig(self): """获取黑名单配置""" <|body_1|> def delBlacklist(self, parkName, carNum): """删除黑名单""" <|body_2|> def getBlack...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ParkBlacklist: """黑名单录入""" def addBlacklist(self, blackType, carNum): """新建黑名单车辆""" blackTypeDict = self.getDictBykey(self.__getBlacklistConfig().json(), 'name', blackType) self.url = '/mgr/park/parkBlacklist/save.do' data = {'specialCarTypeConfigId': blackTypeDict['id'], ...
the_stack_v2_python_sparse
Api/parkingManage_service/carTypeManage_service/carTypeConfig.py
oyebino/pomp_api
train
1
505983bcf1c8145f8728cf27ba966c7ffe5b1912
[ "sql = ' from server_domain d left join server_server s on ( d.ip=s.inner_ip or d.ip=s.outer_ip ) where 1=1 '\nparams = []\nif kw:\n sql += ' and ( d.domain like %s or d.ip like %s or s.hostname like %s or s.area like %s ) '\n kw = '%' + kw + '%'\n params.extend([kw] * 4)\nif area:\n sql += ' and s.ar...
<|body_start_0|> sql = ' from server_domain d left join server_server s on ( d.ip=s.inner_ip or d.ip=s.outer_ip ) where 1=1 ' params = [] if kw: sql += ' and ( d.domain like %s or d.ip like %s or s.hostname like %s or s.area like %s ) ' kw = '%' + kw + '%' p...
Domain manager class
DomainManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DomainManager: """Domain manager class""" def page_search_data(self, page_start, page_size, orderby='domain', order_type='asc', kw='', area='', ip_category=2): """Domain get data by searching keyword and separate page info. :param page_start: separate page start record number :param ...
stack_v2_sparse_classes_36k_train_001960
6,776
no_license
[ { "docstring": "Domain get data by searching keyword and separate page info. :param page_start: separate page start record number :param page_size: the record number per page :param orderby: which column for order :param order_type: how to order (asc or desc) :param kw: search keyword for domain/ip/area/hostnam...
2
stack_v2_sparse_classes_30k_train_014958
Implement the Python class `DomainManager` described below. Class description: Domain manager class Method signatures and docstrings: - def page_search_data(self, page_start, page_size, orderby='domain', order_type='asc', kw='', area='', ip_category=2): Domain get data by searching keyword and separate page info. :pa...
Implement the Python class `DomainManager` described below. Class description: Domain manager class Method signatures and docstrings: - def page_search_data(self, page_start, page_size, orderby='domain', order_type='asc', kw='', area='', ip_category=2): Domain get data by searching keyword and separate page info. :pa...
b100a4a7201cd6e4f660ee8634db08b16e71cbbc
<|skeleton|> class DomainManager: """Domain manager class""" def page_search_data(self, page_start, page_size, orderby='domain', order_type='asc', kw='', area='', ip_category=2): """Domain get data by searching keyword and separate page info. :param page_start: separate page start record number :param ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DomainManager: """Domain manager class""" def page_search_data(self, page_start, page_size, orderby='domain', order_type='asc', kw='', area='', ip_category=2): """Domain get data by searching keyword and separate page info. :param page_start: separate page start record number :param page_size: th...
the_stack_v2_python_sparse
server/models.py
allan869/my_platform
train
0
7e44100e3ff51508276211a950ac239aec5e3d04
[ "email_addr = self.request.get('email')\nif email_addr is None or len(email_addr) == 0:\n return send_response(self, 401, 'Invalid email address')\nif not re.match(EMAIL_REGEX, email_addr):\n return send_response(self, 401, 'Invalid email address')\npassword = base64.b64encode(os.urandom(32))\nemail_entry = E...
<|body_start_0|> email_addr = self.request.get('email') if email_addr is None or len(email_addr) == 0: return send_response(self, 401, 'Invalid email address') if not re.match(EMAIL_REGEX, email_addr): return send_response(self, 401, 'Invalid email address') passw...
RegisterHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegisterHandler: def post(self): """Queue a name up for registration""" <|body_0|> def get(self): """Get the list of email addresses pending. Return [{'email': email address, 'date': UTC time of creation, 'password': password to use to encrypt the private key}]""" ...
stack_v2_sparse_classes_36k_train_001961
10,196
permissive
[ { "docstring": "Queue a name up for registration", "name": "post", "signature": "def post(self)" }, { "docstring": "Get the list of email addresses pending. Return [{'email': email address, 'date': UTC time of creation, 'password': password to use to encrypt the private key}]", "name": "get"...
3
stack_v2_sparse_classes_30k_train_013289
Implement the Python class `RegisterHandler` described below. Class description: Implement the RegisterHandler class. Method signatures and docstrings: - def post(self): Queue a name up for registration - def get(self): Get the list of email addresses pending. Return [{'email': email address, 'date': UTC time of crea...
Implement the Python class `RegisterHandler` described below. Class description: Implement the RegisterHandler class. Method signatures and docstrings: - def post(self): Queue a name up for registration - def get(self): Get the list of email addresses pending. Return [{'email': email address, 'date': UTC time of crea...
ae898e9fdc6d04d5e4432a986ff5ece7ac4b8061
<|skeleton|> class RegisterHandler: def post(self): """Queue a name up for registration""" <|body_0|> def get(self): """Get the list of email addresses pending. Return [{'email': email address, 'date': UTC time of creation, 'password': password to use to encrypt the private key}]""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegisterHandler: def post(self): """Queue a name up for registration""" email_addr = self.request.get('email') if email_addr is None or len(email_addr) == 0: return send_response(self, 401, 'Invalid email address') if not re.match(EMAIL_REGEX, email_addr): ...
the_stack_v2_python_sparse
demo/registrar/syndicate_signup.py
syndicate-storage/syndicate-core
train
6
082a15f72f49276fb5875647feeb974bdb6cf614
[ "self.model = model\nself.preprocess_fun = preprocess_func\nself.encoders = encoders\nself.transform_func = transform_func", "data_point['entity_id'] = 0\nwrapped_data_point = {0: data_point}\nwrapped_data_processed = self.preprocess_fun(wrapped_data_point)\ndata_processed = wrapped_data_processed[0]\nrewrapped_d...
<|body_start_0|> self.model = model self.preprocess_fun = preprocess_func self.encoders = encoders self.transform_func = transform_func <|end_body_0|> <|body_start_1|> data_point['entity_id'] = 0 wrapped_data_point = {0: data_point} wrapped_data_processed = self....
Predictor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Predictor: def __init__(self, model: Callable, encoders: Dict, preprocess_func: Callable, transform_func: Callable): """Base class for a machine learning model predictor. Args: model: A trained model with a `predict` method. encoders: Dictionary of encoders to be used during feature tran...
stack_v2_sparse_classes_36k_train_001962
1,552
no_license
[ { "docstring": "Base class for a machine learning model predictor. Args: model: A trained model with a `predict` method. encoders: Dictionary of encoders to be used during feature transformation. transform_func: Function to transform input data into features for the model.", "name": "__init__", "signatu...
2
null
Implement the Python class `Predictor` described below. Class description: Implement the Predictor class. Method signatures and docstrings: - def __init__(self, model: Callable, encoders: Dict, preprocess_func: Callable, transform_func: Callable): Base class for a machine learning model predictor. Args: model: A trai...
Implement the Python class `Predictor` described below. Class description: Implement the Predictor class. Method signatures and docstrings: - def __init__(self, model: Callable, encoders: Dict, preprocess_func: Callable, transform_func: Callable): Base class for a machine learning model predictor. Args: model: A trai...
f4c08cca00eea9dea15341b4abde56542372277e
<|skeleton|> class Predictor: def __init__(self, model: Callable, encoders: Dict, preprocess_func: Callable, transform_func: Callable): """Base class for a machine learning model predictor. Args: model: A trained model with a `predict` method. encoders: Dictionary of encoders to be used during feature tran...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Predictor: def __init__(self, model: Callable, encoders: Dict, preprocess_func: Callable, transform_func: Callable): """Base class for a machine learning model predictor. Args: model: A trained model with a `predict` method. encoders: Dictionary of encoders to be used during feature transformation. tr...
the_stack_v2_python_sparse
autodiscern/predictor.py
2018luyi/auto-discern
train
0
be790ce3e8df5304abc4c98cac52a2ff1068da94
[ "super(PG_LOSS, self).__init__()\nself.simulations = simulations\nself.trajectory_length = trajectory_length\nself.max_ent = max_ent", "flat_states = torch.flatten(state_tensor, start_dim=0, end_dim=1)\nflat_actions = torch.flatten(action_tensor, start_dim=0, end_dim=1)\nflat_cumsum = torch.flatten(cumulative_rol...
<|body_start_0|> super(PG_LOSS, self).__init__() self.simulations = simulations self.trajectory_length = trajectory_length self.max_ent = max_ent <|end_body_0|> <|body_start_1|> flat_states = torch.flatten(state_tensor, start_dim=0, end_dim=1) flat_actions = torch.flatte...
POLICY GRADIENTS LOSS FUNCTION
PG_LOSS
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PG_LOSS: """POLICY GRADIENTS LOSS FUNCTION""" def __init__(self, trajectory_length, simulations, max_ent=0, TRPO=0, PPO=0, beta=None): """INITIALIZATIONS""" <|body_0|> def forward(self, policy, state_tensor, action_tensor, reward_tensor, cumulative_rollout): """C...
stack_v2_sparse_classes_36k_train_001963
1,741
no_license
[ { "docstring": "INITIALIZATIONS", "name": "__init__", "signature": "def __init__(self, trajectory_length, simulations, max_ent=0, TRPO=0, PPO=0, beta=None)" }, { "docstring": "CONVERT FORMAT", "name": "forward", "signature": "def forward(self, policy, state_tensor, action_tensor, reward_...
2
stack_v2_sparse_classes_30k_train_020089
Implement the Python class `PG_LOSS` described below. Class description: POLICY GRADIENTS LOSS FUNCTION Method signatures and docstrings: - def __init__(self, trajectory_length, simulations, max_ent=0, TRPO=0, PPO=0, beta=None): INITIALIZATIONS - def forward(self, policy, state_tensor, action_tensor, reward_tensor, c...
Implement the Python class `PG_LOSS` described below. Class description: POLICY GRADIENTS LOSS FUNCTION Method signatures and docstrings: - def __init__(self, trajectory_length, simulations, max_ent=0, TRPO=0, PPO=0, beta=None): INITIALIZATIONS - def forward(self, policy, state_tensor, action_tensor, reward_tensor, c...
5790d3b3214dcf60657a92149162511d12cdfea7
<|skeleton|> class PG_LOSS: """POLICY GRADIENTS LOSS FUNCTION""" def __init__(self, trajectory_length, simulations, max_ent=0, TRPO=0, PPO=0, beta=None): """INITIALIZATIONS""" <|body_0|> def forward(self, policy, state_tensor, action_tensor, reward_tensor, cumulative_rollout): """C...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PG_LOSS: """POLICY GRADIENTS LOSS FUNCTION""" def __init__(self, trajectory_length, simulations, max_ent=0, TRPO=0, PPO=0, beta=None): """INITIALIZATIONS""" super(PG_LOSS, self).__init__() self.simulations = simulations self.trajectory_length = trajectory_length se...
the_stack_v2_python_sparse
Vanilla Policy Gradients/objective_function.py
WilderLavington/Probabalistic_RL
train
1
001d52c1f8244b72f82d25a0ab536d13f7a82d7b
[ "super().__init__(coordinator)\nself._attr_device_info = DeviceInfo(entry_type=DeviceEntryType.SERVICE, identifiers={(DOMAIN, str(coordinator.gios.station_id))}, manufacturer=MANUFACTURER, name=name, configuration_url=URL.format(station_id=coordinator.gios.station_id))\nself._attr_unique_id = f'{coordinator.gios.st...
<|body_start_0|> super().__init__(coordinator) self._attr_device_info = DeviceInfo(entry_type=DeviceEntryType.SERVICE, identifiers={(DOMAIN, str(coordinator.gios.station_id))}, manufacturer=MANUFACTURER, name=name, configuration_url=URL.format(station_id=coordinator.gios.station_id)) self._attr_...
Define an GIOS sensor.
GiosSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GiosSensor: """Define an GIOS sensor.""" def __init__(self, name: str, coordinator: GiosDataUpdateCoordinator, description: GiosSensorEntityDescription) -> None: """Initialize.""" <|body_0|> def extra_state_attributes(self) -> dict[str, Any]: """Return the state ...
stack_v2_sparse_classes_36k_train_001964
6,871
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, name: str, coordinator: GiosDataUpdateCoordinator, description: GiosSensorEntityDescription) -> None" }, { "docstring": "Return the state attributes.", "name": "extra_state_attributes", "signature": "def e...
3
stack_v2_sparse_classes_30k_train_002238
Implement the Python class `GiosSensor` described below. Class description: Define an GIOS sensor. Method signatures and docstrings: - def __init__(self, name: str, coordinator: GiosDataUpdateCoordinator, description: GiosSensorEntityDescription) -> None: Initialize. - def extra_state_attributes(self) -> dict[str, An...
Implement the Python class `GiosSensor` described below. Class description: Define an GIOS sensor. Method signatures and docstrings: - def __init__(self, name: str, coordinator: GiosDataUpdateCoordinator, description: GiosSensorEntityDescription) -> None: Initialize. - def extra_state_attributes(self) -> dict[str, An...
bfa315be51371a1b63e04342a0b275a57ae148bd
<|skeleton|> class GiosSensor: """Define an GIOS sensor.""" def __init__(self, name: str, coordinator: GiosDataUpdateCoordinator, description: GiosSensorEntityDescription) -> None: """Initialize.""" <|body_0|> def extra_state_attributes(self) -> dict[str, Any]: """Return the state ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GiosSensor: """Define an GIOS sensor.""" def __init__(self, name: str, coordinator: GiosDataUpdateCoordinator, description: GiosSensorEntityDescription) -> None: """Initialize.""" super().__init__(coordinator) self._attr_device_info = DeviceInfo(entry_type=DeviceEntryType.SERVICE,...
the_stack_v2_python_sparse
homeassistant/components/gios/sensor.py
bdraco/home-assistant
train
13
7ebef29c5a933741d88289edea372e4b38a5f084
[ "maxS = 0\nfor i in range(len(heights)):\n left = i - 1\n right = i + 1\n cnt = 1\n while left >= 0 and heights[i] <= heights[left]:\n left -= 1\n cnt += 1\n while right < len(heights) and heights[i] <= heights[right]:\n right += 1\n cnt += 1\n maxS = max(maxS, heights[...
<|body_start_0|> maxS = 0 for i in range(len(heights)): left = i - 1 right = i + 1 cnt = 1 while left >= 0 and heights[i] <= heights[left]: left -= 1 cnt += 1 while right < len(heights) and heights[i] <= heights[...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestRectangleArea1(self, heights): """:type heights: List[int] :rtype: int""" <|body_0|> def largestRectangleArea(self, heights): """:type heights: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> maxS = 0 ...
stack_v2_sparse_classes_36k_train_001965
1,478
no_license
[ { "docstring": ":type heights: List[int] :rtype: int", "name": "largestRectangleArea1", "signature": "def largestRectangleArea1(self, heights)" }, { "docstring": ":type heights: List[int] :rtype: int", "name": "largestRectangleArea", "signature": "def largestRectangleArea(self, heights)"...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestRectangleArea1(self, heights): :type heights: List[int] :rtype: int - def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestRectangleArea1(self, heights): :type heights: List[int] :rtype: int - def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int <|skeleton|> class...
2273ce2dcfd558eda4435360e0d3796c9ec17cca
<|skeleton|> class Solution: def largestRectangleArea1(self, heights): """:type heights: List[int] :rtype: int""" <|body_0|> def largestRectangleArea(self, heights): """:type heights: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def largestRectangleArea1(self, heights): """:type heights: List[int] :rtype: int""" maxS = 0 for i in range(len(heights)): left = i - 1 right = i + 1 cnt = 1 while left >= 0 and heights[i] <= heights[left]: left...
the_stack_v2_python_sparse
Top100/Largest Rectangle in Histogram.py
Goodnick123/LeetCode
train
0
84c5d6fbbb59b534228a54336f5a329a77dace56
[ "texture.Texture.__init__(self, name, 3)\nself.__selection = selection\nselection.register(self.getTextureName(), self.__selectionChanged)\nself.__init()\nself.refresh()", "self.bindTexture()\ngl.glTexParameteri(gl.GL_TEXTURE_3D, gl.GL_TEXTURE_MAG_FILTER, gl.GL_NEAREST)\ngl.glTexParameteri(gl.GL_TEXTURE_3D, gl.GL...
<|body_start_0|> texture.Texture.__init__(self, name, 3) self.__selection = selection selection.register(self.getTextureName(), self.__selectionChanged) self.__init() self.refresh() <|end_body_0|> <|body_start_1|> self.bindTexture() gl.glTexParameteri(gl.GL_TEXTU...
The ``SelectionTexture`` class is a :class:`.Texture` which can be used to represent a :class:`.Selection` instance. The ``Selection`` image array is stored as a single channel 3D texture, which is updated whenever the :attr:`.Selection.selection` property changes, and whenever the :meth:`refresh` method is called.
SelectionTexture
[ "BSD-3-Clause", "CC-BY-3.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SelectionTexture: """The ``SelectionTexture`` class is a :class:`.Texture` which can be used to represent a :class:`.Selection` instance. The ``Selection`` image array is stored as a single channel 3D texture, which is updated whenever the :attr:`.Selection.selection` property changes, and whenev...
stack_v2_sparse_classes_36k_train_001966
5,090
permissive
[ { "docstring": "Create a ``SelectionTexture``. :arg name: A unique name for this ``SelectionTexture``. :arg selection: The :class:`.Selection` instance.", "name": "__init__", "signature": "def __init__(self, name, selection)" }, { "docstring": "Called by :meth:`__init__`. Configures the GL textu...
5
null
Implement the Python class `SelectionTexture` described below. Class description: The ``SelectionTexture`` class is a :class:`.Texture` which can be used to represent a :class:`.Selection` instance. The ``Selection`` image array is stored as a single channel 3D texture, which is updated whenever the :attr:`.Selection....
Implement the Python class `SelectionTexture` described below. Class description: The ``SelectionTexture`` class is a :class:`.Texture` which can be used to represent a :class:`.Selection` instance. The ``Selection`` image array is stored as a single channel 3D texture, which is updated whenever the :attr:`.Selection....
46ccb4fe2b2346eb57576247f49714032b61307a
<|skeleton|> class SelectionTexture: """The ``SelectionTexture`` class is a :class:`.Texture` which can be used to represent a :class:`.Selection` instance. The ``Selection`` image array is stored as a single channel 3D texture, which is updated whenever the :attr:`.Selection.selection` property changes, and whenev...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SelectionTexture: """The ``SelectionTexture`` class is a :class:`.Texture` which can be used to represent a :class:`.Selection` instance. The ``Selection`` image array is stored as a single channel 3D texture, which is updated whenever the :attr:`.Selection.selection` property changes, and whenever the :meth:...
the_stack_v2_python_sparse
fsleyes/gl/textures/selectiontexture.py
sanjayankur31/fsleyes
train
1
0e46a0cc118ccc76b55fa23bc0c287da44e820a9
[ "stackA = {}\nwhile headA:\n stackA.append(headA)\n headA = headA.next\nif not stackA:\n return None\nwhile headB:\n if headB in stackA:\n return headB\n headB = headB.next\nreturn None", "if not headA or not headB:\n return None\npA = headA\npB = headB\nwhile pA != pB:\n if pA:\n ...
<|body_start_0|> stackA = {} while headA: stackA.append(headA) headA = headA.next if not stackA: return None while headB: if headB in stackA: return headB headB = headB.next return None <|end_body_0|> <|...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode: """Hash table solution stores every node of list A. Iterate through list B until a node of A is found.""" <|body_0|> def getIntersectionNode(self, headA, headB): """Two pointer sol...
stack_v2_sparse_classes_36k_train_001967
1,285
no_license
[ { "docstring": "Hash table solution stores every node of list A. Iterate through list B until a node of A is found.", "name": "getIntersectionNode", "signature": "def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode" }, { "docstring": "Two pointer solution When headA reach...
2
stack_v2_sparse_classes_30k_train_001985
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode: Hash table solution stores every node of list A. Iterate through list B until a node of A is found. -...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode: Hash table solution stores every node of list A. Iterate through list B until a node of A is found. -...
f33d004d7629d46fbc5670f5b384f8a604d7f1e7
<|skeleton|> class Solution: def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode: """Hash table solution stores every node of list A. Iterate through list B until a node of A is found.""" <|body_0|> def getIntersectionNode(self, headA, headB): """Two pointer sol...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode: """Hash table solution stores every node of list A. Iterate through list B until a node of A is found.""" stackA = {} while headA: stackA.append(headA) headA = headA.next ...
the_stack_v2_python_sparse
Intersection of Two Linked Lists.py
aulee888/LeetCode
train
0
fd300559c4bb90d17d90439b84f2bd8ddff1f339
[ "self.ch1_list = natsort.natsorted(ch1_list)\nself.label = label\nself.channels = channels", "files = [f for f in self.ch1_list if f.lower().endswith('ch' + str(self.channels[0]) + '.tif')]\ntiff_files = [TiffFile(tiffFile, self.channels, self.label) for tiffFile in files]\nreturn tiff_files" ]
<|body_start_0|> self.ch1_list = natsort.natsorted(ch1_list) self.label = label self.channels = channels <|end_body_0|> <|body_start_1|> files = [f for f in self.ch1_list if f.lower().endswith('ch' + str(self.channels[0]) + '.tif')] tiff_files = [TiffFile(tiffFile, self.channels...
This class represents list of tiff files. These tiff files are the output from the cell extractor plugin and are used as training and classification data.
TiffList
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TiffList: """This class represents list of tiff files. These tiff files are the output from the cell extractor plugin and are used as training and classification data.""" def __init__(self, ch1_list, channels, label=None): """A list of tiff files output by the cell extractor plugin t...
stack_v2_sparse_classes_36k_train_001968
2,889
permissive
[ { "docstring": "A list of tiff files output by the cell extractor plugin to be used in machine learning. Expects file names to end with \"ch[ch].tif\", where [ch] is the non-zero-padded channel index. Given a list of tiff files for the first channel, it will find the corresponding files for the channels passed ...
2
stack_v2_sparse_classes_30k_train_017987
Implement the Python class `TiffList` described below. Class description: This class represents list of tiff files. These tiff files are the output from the cell extractor plugin and are used as training and classification data. Method signatures and docstrings: - def __init__(self, ch1_list, channels, label=None): A...
Implement the Python class `TiffList` described below. Class description: This class represents list of tiff files. These tiff files are the output from the cell extractor plugin and are used as training and classification data. Method signatures and docstrings: - def __init__(self, ch1_list, channels, label=None): A...
a4cbdb0976a46deeb84105281e2a332f95fee1d7
<|skeleton|> class TiffList: """This class represents list of tiff files. These tiff files are the output from the cell extractor plugin and are used as training and classification data.""" def __init__(self, ch1_list, channels, label=None): """A list of tiff files output by the cell extractor plugin t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TiffList: """This class represents list of tiff files. These tiff files are the output from the cell extractor plugin and are used as training and classification data.""" def __init__(self, ch1_list, channels, label=None): """A list of tiff files output by the cell extractor plugin to be used in ...
the_stack_v2_python_sparse
cellfinder/tools/tiff.py
adamltyson/cellfinder
train
0
ce8a3413192894ef9c734a8954a999095d8d9acb
[ "super(ConfigMenu, self).__init__()\nself.xInitGui()\nmenubar.parent.Bind(wx.EVT_MENU, menubar.Handler, self.itemUDP)\nmenubar.parent.Bind(wx.EVT_MENU, menubar.Handler, self.itemFile)\nmenubar.parent.Bind(wx.EVT_MENU, menubar.Handler, self.itemWave)", "bmp = wx.GetApp().resources.Bitmap('16x16', 'udpsink')\nself....
<|body_start_0|> super(ConfigMenu, self).__init__() self.xInitGui() menubar.parent.Bind(wx.EVT_MENU, menubar.Handler, self.itemUDP) menubar.parent.Bind(wx.EVT_MENU, menubar.Handler, self.itemFile) menubar.parent.Bind(wx.EVT_MENU, menubar.Handler, self.itemWave) <|end_body_0|> <|...
The application's Config menu. It binds to the containing menu bar's "Handler" member as its menu handler.
ConfigMenu
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigMenu: """The application's Config menu. It binds to the containing menu bar's "Handler" member as its menu handler.""" def __init__(self, menubar): """Initializes the underlying wx.Menu item and triggers creation of the menu items.""" <|body_0|> def xInitGui(self):...
stack_v2_sparse_classes_36k_train_001969
6,684
no_license
[ { "docstring": "Initializes the underlying wx.Menu item and triggers creation of the menu items.", "name": "__init__", "signature": "def __init__(self, menubar)" }, { "docstring": "Adds the actual menu items.", "name": "xInitGui", "signature": "def xInitGui(self)" } ]
2
stack_v2_sparse_classes_30k_train_014477
Implement the Python class `ConfigMenu` described below. Class description: The application's Config menu. It binds to the containing menu bar's "Handler" member as its menu handler. Method signatures and docstrings: - def __init__(self, menubar): Initializes the underlying wx.Menu item and triggers creation of the m...
Implement the Python class `ConfigMenu` described below. Class description: The application's Config menu. It binds to the containing menu bar's "Handler" member as its menu handler. Method signatures and docstrings: - def __init__(self, menubar): Initializes the underlying wx.Menu item and triggers creation of the m...
629e48ab3bf9d9c52ac9863a03196573bbf526e1
<|skeleton|> class ConfigMenu: """The application's Config menu. It binds to the containing menu bar's "Handler" member as its menu handler.""" def __init__(self, menubar): """Initializes the underlying wx.Menu item and triggers creation of the menu items.""" <|body_0|> def xInitGui(self):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConfigMenu: """The application's Config menu. It binds to the containing menu bar's "Handler" member as its menu handler.""" def __init__(self, menubar): """Initializes the underlying wx.Menu item and triggers creation of the menu items.""" super(ConfigMenu, self).__init__() self....
the_stack_v2_python_sparse
python/app/asig/MenuBar.py
ludwigf/radio
train
0
e8dd4192789ae51df670c758cc1b3538bab8899b
[ "stdout_fp = six.StringIO()\nstderr_fp = six.StringIO()\ntry:\n with mock.patch.object(sys, 'stdout', stdout_fp):\n with mock.patch.object(sys, 'stderr', stderr_fp):\n yield\nfinally:\n if not capture:\n sys.stdout.write(stdout_fp.getvalue())\n sys.stderr.write(stderr_fp.getval...
<|body_start_0|> stdout_fp = six.StringIO() stderr_fp = six.StringIO() try: with mock.patch.object(sys, 'stdout', stdout_fp): with mock.patch.object(sys, 'stderr', stderr_fp): yield finally: if not capture: sys.s...
Shared test case for Python Fire tests.
BaseTestCase
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseTestCase: """Shared test case for Python Fire tests.""" def assertOutputMatches(self, stdout='.*', stderr='.*', capture=True): """Asserts that the context generates stdout and stderr matching regexps. Note: If wrapped code raises an exception, stdout and stderr will not be checke...
stack_v2_sparse_classes_36k_train_001970
3,252
permissive
[ { "docstring": "Asserts that the context generates stdout and stderr matching regexps. Note: If wrapped code raises an exception, stdout and stderr will not be checked. Args: stdout: (str) regexp to match against stdout (None will check no stdout) stderr: (str) regexp to match against stderr (None will check no...
2
stack_v2_sparse_classes_30k_train_021193
Implement the Python class `BaseTestCase` described below. Class description: Shared test case for Python Fire tests. Method signatures and docstrings: - def assertOutputMatches(self, stdout='.*', stderr='.*', capture=True): Asserts that the context generates stdout and stderr matching regexps. Note: If wrapped code ...
Implement the Python class `BaseTestCase` described below. Class description: Shared test case for Python Fire tests. Method signatures and docstrings: - def assertOutputMatches(self, stdout='.*', stderr='.*', capture=True): Asserts that the context generates stdout and stderr matching regexps. Note: If wrapped code ...
770a140e42e6d8f7d55b3211a6ba691d2a915a2d
<|skeleton|> class BaseTestCase: """Shared test case for Python Fire tests.""" def assertOutputMatches(self, stdout='.*', stderr='.*', capture=True): """Asserts that the context generates stdout and stderr matching regexps. Note: If wrapped code raises an exception, stdout and stderr will not be checke...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseTestCase: """Shared test case for Python Fire tests.""" def assertOutputMatches(self, stdout='.*', stderr='.*', capture=True): """Asserts that the context generates stdout and stderr matching regexps. Note: If wrapped code raises an exception, stdout and stderr will not be checked. Args: stdo...
the_stack_v2_python_sparse
clima/fire/testutils.py
d3rp/clima
train
4
2652e5cc0f0a7d01687ee69832cd9ee3788dc4fd
[ "DBFormatter.__init__(self, logger, dbi)\nself.logger = logger\nself.owner = '%s.' % owner if not owner in ('', '__MYSQL__') else ''\nself.sql = 'UPDATE %sDATASETS SET LAST_MODIFIED_BY=:myuser, LAST_MODIFICATION_DATE=:mydate,\\n DATASET_ACCESS_TYPE_ID = ( select DATASET_ACCESS_TYPE_ID from %sDATASET_ACCESS_T...
<|body_start_0|> DBFormatter.__init__(self, logger, dbi) self.logger = logger self.owner = '%s.' % owner if not owner in ('', '__MYSQL__') else '' self.sql = 'UPDATE %sDATASETS SET LAST_MODIFIED_BY=:myuser, LAST_MODIFICATION_DATE=:mydate,\n DATASET_ACCESS_TYPE_ID = ( select DATASE...
Dataset Update Statuss DAO class.
UpdateType
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateType: """Dataset Update Statuss DAO class.""" def __init__(self, logger, dbi, owner): """Add schema owner and sql.""" <|body_0|> def execute(self, conn, dataset, dataset_access_type, transaction=False): """for a given file""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k_train_001971
1,430
permissive
[ { "docstring": "Add schema owner and sql.", "name": "__init__", "signature": "def __init__(self, logger, dbi, owner)" }, { "docstring": "for a given file", "name": "execute", "signature": "def execute(self, conn, dataset, dataset_access_type, transaction=False)" } ]
2
null
Implement the Python class `UpdateType` described below. Class description: Dataset Update Statuss DAO class. Method signatures and docstrings: - def __init__(self, logger, dbi, owner): Add schema owner and sql. - def execute(self, conn, dataset, dataset_access_type, transaction=False): for a given file
Implement the Python class `UpdateType` described below. Class description: Dataset Update Statuss DAO class. Method signatures and docstrings: - def __init__(self, logger, dbi, owner): Add schema owner and sql. - def execute(self, conn, dataset, dataset_access_type, transaction=False): for a given file <|skeleton|>...
14df8bbe8ee8f874fe423399b18afef911fe78c7
<|skeleton|> class UpdateType: """Dataset Update Statuss DAO class.""" def __init__(self, logger, dbi, owner): """Add schema owner and sql.""" <|body_0|> def execute(self, conn, dataset, dataset_access_type, transaction=False): """for a given file""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateType: """Dataset Update Statuss DAO class.""" def __init__(self, logger, dbi, owner): """Add schema owner and sql.""" DBFormatter.__init__(self, logger, dbi) self.logger = logger self.owner = '%s.' % owner if not owner in ('', '__MYSQL__') else '' self.sql = ...
the_stack_v2_python_sparse
Server/Python/src/dbs/dao/Oracle/Dataset/UpdateType.py
vkuznet/DBS
train
0
d208ca4db22c8cf8466a505e4ff0d86271a9748e
[ "BaseDustNode.__init__(self, xml_node)\nself._value = utils.parse_coords(xml_node.text)\nunits = u.deg\nself._columns = [Column(name=col_names[0], unit=units), Column(name=col_names[1], unit=units), Column(name=col_names[2], dtype='S25')]", "base_string = BaseDustNode.__str__(self)\nvalues_str = 'values: ' + str(...
<|body_start_0|> BaseDustNode.__init__(self, xml_node) self._value = utils.parse_coords(xml_node.text) units = u.deg self._columns = [Column(name=col_names[0], unit=units), Column(name=col_names[1], unit=units), Column(name=col_names[2], dtype='S25')] <|end_body_0|> <|body_start_1|> ...
A node that contains RA, Dec coordinates. Outputs three values / columns: RA, Dec and a coordinate system description string.
CoordNode
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoordNode: """A node that contains RA, Dec coordinates. Outputs three values / columns: RA, Dec and a coordinate system description string.""" def __init__(self, xml_node, col_names): """Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data ...
stack_v2_sparse_classes_36k_train_001972
41,056
permissive
[ { "docstring": "Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data for this DustNode col_names : str the names of the columns associated with this item", "name": "__init__", "signature": "def __init__(self, xml_node, col_names)" }, { "docstring": "Re...
2
stack_v2_sparse_classes_30k_train_001555
Implement the Python class `CoordNode` described below. Class description: A node that contains RA, Dec coordinates. Outputs three values / columns: RA, Dec and a coordinate system description string. Method signatures and docstrings: - def __init__(self, xml_node, col_names): Parameters ---------- xml_node : `xml.et...
Implement the Python class `CoordNode` described below. Class description: A node that contains RA, Dec coordinates. Outputs three values / columns: RA, Dec and a coordinate system description string. Method signatures and docstrings: - def __init__(self, xml_node, col_names): Parameters ---------- xml_node : `xml.et...
51316d7417d7daf01a8b29d1df99037b9227c2bc
<|skeleton|> class CoordNode: """A node that contains RA, Dec coordinates. Outputs three values / columns: RA, Dec and a coordinate system description string.""" def __init__(self, xml_node, col_names): """Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CoordNode: """A node that contains RA, Dec coordinates. Outputs three values / columns: RA, Dec and a coordinate system description string.""" def __init__(self, xml_node, col_names): """Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data for this Dust...
the_stack_v2_python_sparse
astroquery/ipac/irsa/irsa_dust/core.py
astropy/astroquery
train
636
926c8355ab1b149d22e91fcc2890ea88e3841964
[ "self.input_data_description = input_data_description\nself.name = 'tfidf_matrix'\nself.new_input_data_description = {}\nself.new_input_data_description.update({'NI': len(vocab)})\nnew_input_types = [{'type': 'num', 'name': 'tfidf'}] * len(vocab)\nself.new_input_data_description.update({'input_types': new_input_typ...
<|body_start_0|> self.input_data_description = input_data_description self.name = 'tfidf_matrix' self.new_input_data_description = {} self.new_input_data_description.update({'NI': len(vocab)}) new_input_types = [{'type': 'num', 'name': 'tfidf'}] * len(vocab) self.new_inpu...
tfidf_matrix_model
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class tfidf_matrix_model: def __init__(self, vocab, df_dict, input_data_description): """Parameters ---------- vocab: list of string Vocabulary to ne used df_dict: dict Document frequency counts. input_data_description: dict Description of the input features""" <|body_0|> def tran...
stack_v2_sparse_classes_36k_train_001973
1,874
permissive
[ { "docstring": "Parameters ---------- vocab: list of string Vocabulary to ne used df_dict: dict Document frequency counts. input_data_description: dict Description of the input features", "name": "__init__", "signature": "def __init__(self, vocab, df_dict, input_data_description)" }, { "docstrin...
2
null
Implement the Python class `tfidf_matrix_model` described below. Class description: Implement the tfidf_matrix_model class. Method signatures and docstrings: - def __init__(self, vocab, df_dict, input_data_description): Parameters ---------- vocab: list of string Vocabulary to ne used df_dict: dict Document frequency...
Implement the Python class `tfidf_matrix_model` described below. Class description: Implement the tfidf_matrix_model class. Method signatures and docstrings: - def __init__(self, vocab, df_dict, input_data_description): Parameters ---------- vocab: list of string Vocabulary to ne used df_dict: dict Document frequency...
ccc0a7674a04ae0d00bedc38893b33184c5f68c6
<|skeleton|> class tfidf_matrix_model: def __init__(self, vocab, df_dict, input_data_description): """Parameters ---------- vocab: list of string Vocabulary to ne used df_dict: dict Document frequency counts. input_data_description: dict Description of the input features""" <|body_0|> def tran...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class tfidf_matrix_model: def __init__(self, vocab, df_dict, input_data_description): """Parameters ---------- vocab: list of string Vocabulary to ne used df_dict: dict Document frequency counts. input_data_description: dict Description of the input features""" self.input_data_description = input_da...
the_stack_v2_python_sparse
MMLL/preprocessors/tfidf_matrix.py
Musketeer-H2020/MMLL-Robust
train
0
89ab755025d75e2261ee0b0de9c2aabb154ea87a
[ "self._node = node\nif text is None:\n self._text = node.__class__.__name__.lower()\nelse:\n self._text = text", "if self.should_use_text:\n return self.error_template.format(self.code, self._text)\nreturn self.error_template.format(self.code)", "line_number = getattr(self._node, 'lineno', 0)\ncolumn_o...
<|body_start_0|> self._node = node if text is None: self._text = node.__class__.__name__.lower() else: self._text = text <|end_body_0|> <|body_start_1|> if self.should_use_text: return self.error_template.format(self.code, self._text) return s...
This is a base class for all style errors. It basically just defines how to create any error and how to format this error later on. Each subclass must define ``error_template`` and ``code`` fields.
BaseStyleViolation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseStyleViolation: """This is a base class for all style errors. It basically just defines how to create any error and how to format this error later on. Each subclass must define ``error_template`` and ``code`` fields.""" def __init__(self, node: Optional[ast.AST], text: str=None) -> None:...
stack_v2_sparse_classes_36k_train_001974
1,751
permissive
[ { "docstring": "Creates new instance of AST style violation.", "name": "__init__", "signature": "def __init__(self, node: Optional[ast.AST], text: str=None) -> None" }, { "docstring": "Returns error's formatted message.", "name": "message", "signature": "def message(self) -> str" }, ...
3
stack_v2_sparse_classes_30k_train_017321
Implement the Python class `BaseStyleViolation` described below. Class description: This is a base class for all style errors. It basically just defines how to create any error and how to format this error later on. Each subclass must define ``error_template`` and ``code`` fields. Method signatures and docstrings: - ...
Implement the Python class `BaseStyleViolation` described below. Class description: This is a base class for all style errors. It basically just defines how to create any error and how to format this error later on. Each subclass must define ``error_template`` and ``code`` fields. Method signatures and docstrings: - ...
d5a9841026122aec8f7dab0a5a4fe3d748cbe04d
<|skeleton|> class BaseStyleViolation: """This is a base class for all style errors. It basically just defines how to create any error and how to format this error later on. Each subclass must define ``error_template`` and ``code`` fields.""" def __init__(self, node: Optional[ast.AST], text: str=None) -> None:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseStyleViolation: """This is a base class for all style errors. It basically just defines how to create any error and how to format this error later on. Each subclass must define ``error_template`` and ``code`` fields.""" def __init__(self, node: Optional[ast.AST], text: str=None) -> None: """C...
the_stack_v2_python_sparse
wemake_python_styleguide/errors/base.py
sobolevn/wemake-python-styleguide
train
0
6dcdde7b9ca63a7b7b6499300108ea2595dd9def
[ "n = len(triangle)\ndp = triangle[n - 1][:]\nfor layer in range(n - 2, -1, -1):\n for i in range(layer + 1):\n dp[i] = min(dp[i], dp[i + 1]) + triangle[layer][i]\nreturn dp[0]", "n = len(triangle)\n\n@lru_cache(None)\ndef dfs(i, j):\n if i == n:\n return 0\n return triangle[i][j] + min(dfs(...
<|body_start_0|> n = len(triangle) dp = triangle[n - 1][:] for layer in range(n - 2, -1, -1): for i in range(layer + 1): dp[i] = min(dp[i], dp[i + 1]) + triangle[layer][i] return dp[0] <|end_body_0|> <|body_start_1|> n = len(triangle) @lru_ca...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minimumTotal(self, triangle): """:type triangle: List[List[int]] :rtype: int""" <|body_0|> def minimumTotalLRUCache(self, triangle): """:type triangle: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len...
stack_v2_sparse_classes_36k_train_001975
1,314
no_license
[ { "docstring": ":type triangle: List[List[int]] :rtype: int", "name": "minimumTotal", "signature": "def minimumTotal(self, triangle)" }, { "docstring": ":type triangle: List[List[int]] :rtype: int", "name": "minimumTotalLRUCache", "signature": "def minimumTotalLRUCache(self, triangle)" ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumTotal(self, triangle): :type triangle: List[List[int]] :rtype: int - def minimumTotalLRUCache(self, triangle): :type triangle: List[List[int]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumTotal(self, triangle): :type triangle: List[List[int]] :rtype: int - def minimumTotalLRUCache(self, triangle): :type triangle: List[List[int]] :rtype: int <|skeleton|...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def minimumTotal(self, triangle): """:type triangle: List[List[int]] :rtype: int""" <|body_0|> def minimumTotalLRUCache(self, triangle): """:type triangle: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minimumTotal(self, triangle): """:type triangle: List[List[int]] :rtype: int""" n = len(triangle) dp = triangle[n - 1][:] for layer in range(n - 2, -1, -1): for i in range(layer + 1): dp[i] = min(dp[i], dp[i + 1]) + triangle[layer][i] ...
the_stack_v2_python_sparse
T/Triangle.py
bssrdf/pyleet
train
2
5cf47dd35f6f2dfe3512306a62d4a1bafcbfbbaf
[ "user = users.get_current_user()\nif user:\n user_account = user_info.get_user_account()\n self.response.out.write(json.dumps(account_info(user_account)))\nelse:\n self.response.out.write(json.dumps(error_obj('User not logged in.')))", "user = users.get_current_user()\nif not user:\n self.response.out...
<|body_start_0|> user = users.get_current_user() if user: user_account = user_info.get_user_account() self.response.out.write(json.dumps(account_info(user_account))) else: self.response.out.write(json.dumps(error_obj('User not logged in.'))) <|end_body_0|> <|...
User
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class User: def get(self): """Get your status and blurb.""" <|body_0|> def put(self): """Set your status and blurb.""" <|body_1|> <|end_skeleton|> <|body_start_0|> user = users.get_current_user() if user: user_account = user_info.get_u...
stack_v2_sparse_classes_36k_train_001976
2,376
no_license
[ { "docstring": "Get your status and blurb.", "name": "get", "signature": "def get(self)" }, { "docstring": "Set your status and blurb.", "name": "put", "signature": "def put(self)" } ]
2
stack_v2_sparse_classes_30k_train_011605
Implement the Python class `User` described below. Class description: Implement the User class. Method signatures and docstrings: - def get(self): Get your status and blurb. - def put(self): Set your status and blurb.
Implement the Python class `User` described below. Class description: Implement the User class. Method signatures and docstrings: - def get(self): Get your status and blurb. - def put(self): Set your status and blurb. <|skeleton|> class User: def get(self): """Get your status and blurb.""" <|bod...
0f121a58617131c01ff76ccca0e46a41aae76db6
<|skeleton|> class User: def get(self): """Get your status and blurb.""" <|body_0|> def put(self): """Set your status and blurb.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class User: def get(self): """Get your status and blurb.""" user = users.get_current_user() if user: user_account = user_info.get_user_account() self.response.out.write(json.dumps(account_info(user_account))) else: self.response.out.write(json.dump...
the_stack_v2_python_sparse
controllers/user.py
ShelleyGoldberg/golight
train
0
3b99280aeacf4a2e3ffe46781a1054a83b47a6c7
[ "self.cache = {}\nself.count = collections.defaultdict(collections.OrderedDict)\nself.min = 0\nself.capacity = capacity", "if key not in self.cache:\n return -1\nvalue, count = self.cache[key]\ndel self.count[count][key]\nif count == self.min and (not self.count[count]):\n self.min += 1\nself.count[count + ...
<|body_start_0|> self.cache = {} self.count = collections.defaultdict(collections.OrderedDict) self.min = 0 self.capacity = capacity <|end_body_0|> <|body_start_1|> if key not in self.cache: return -1 value, count = self.cache[key] del self.count[coun...
LFUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_001977
2,355
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: void", "name": "pu...
3
null
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void <|sk...
f2bf9b13508cd01c8f383789569e55a438f77202
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LFUCache: def __init__(self, capacity): """:type capacity: int""" self.cache = {} self.count = collections.defaultdict(collections.OrderedDict) self.min = 0 self.capacity = capacity def get(self, key): """:type key: int :rtype: int""" if key not in ...
the_stack_v2_python_sparse
version1/460_LFU_Cache.py
moontree/leetcode
train
1
7ed96f610e4214619b4c58f8816d062002df0f9a
[ "conf = SparkConf()\nsettings = {key: value for key, value in settings.items() if not value == ''}\nconf.setAll(settings.items())\nif settings.get('enable_hive', False):\n self.spark = SparkSession.builder.config(conf=conf).enableHiveSupport().getOrCreate()\nelse:\n self.spark = SparkSession.builder.config(co...
<|body_start_0|> conf = SparkConf() settings = {key: value for key, value in settings.items() if not value == ''} conf.setAll(settings.items()) if settings.get('enable_hive', False): self.spark = SparkSession.builder.config(conf=conf).enableHiveSupport().getOrCreate() ...
SparkHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SparkHandler: def __init__(self, settings): """Initializes the SparkHandler with it's special connection string :param settings: settings from `mlapp > config.py` depending on handler type name.""" <|body_0|> def load_csv_file(self, file_path, sep=',', header=True, toPandas=...
stack_v2_sparse_classes_36k_train_001978
4,258
permissive
[ { "docstring": "Initializes the SparkHandler with it's special connection string :param settings: settings from `mlapp > config.py` depending on handler type name.", "name": "__init__", "signature": "def __init__(self, settings)" }, { "docstring": "This function reads a csv file and return a spa...
5
stack_v2_sparse_classes_30k_train_003747
Implement the Python class `SparkHandler` described below. Class description: Implement the SparkHandler class. Method signatures and docstrings: - def __init__(self, settings): Initializes the SparkHandler with it's special connection string :param settings: settings from `mlapp > config.py` depending on handler typ...
Implement the Python class `SparkHandler` described below. Class description: Implement the SparkHandler class. Method signatures and docstrings: - def __init__(self, settings): Initializes the SparkHandler with it's special connection string :param settings: settings from `mlapp > config.py` depending on handler typ...
db34927e4c45df93438e2b7129f01388f1a34753
<|skeleton|> class SparkHandler: def __init__(self, settings): """Initializes the SparkHandler with it's special connection string :param settings: settings from `mlapp > config.py` depending on handler type name.""" <|body_0|> def load_csv_file(self, file_path, sep=',', header=True, toPandas=...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SparkHandler: def __init__(self, settings): """Initializes the SparkHandler with it's special connection string :param settings: settings from `mlapp > config.py` depending on handler type name.""" conf = SparkConf() settings = {key: value for key, value in settings.items() if not valu...
the_stack_v2_python_sparse
mlapp/handlers/spark/spark_handler.py
ghas-results/mlapp
train
0
5f6ebde8c092cdb35eb286f1b37680831bddc529
[ "if jobject is None:\n jobject = Loader.new_instance(classname)\nself.enforce_type(jobject, 'weka.core.converters.Loader')\nsuper(Loader, self).__init__(jobject=jobject, options=options)\nself.incremental = False\nself.structure = None", "if not self.incremental:\n raise Exception('Not in incremental mode, ...
<|body_start_0|> if jobject is None: jobject = Loader.new_instance(classname) self.enforce_type(jobject, 'weka.core.converters.Loader') super(Loader, self).__init__(jobject=jobject, options=options) self.incremental = False self.structure = None <|end_body_0|> <|body...
Wrapper class for Loaders.
Loader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Loader: """Wrapper class for Loaders.""" def __init__(self, classname='weka.core.converters.ArffLoader', jobject=None, options=None): """Initializes the specified loader either using the classname or the JB_Object. :param classname: the classname of the loader :type classname: str :p...
stack_v2_sparse_classes_36k_train_001979
8,342
no_license
[ { "docstring": "Initializes the specified loader either using the classname or the JB_Object. :param classname: the classname of the loader :type classname: str :param jobject: the JB_Object to use :type jobject: JB_Object :param options: the list of commandline options to set :type options: list", "name": ...
4
stack_v2_sparse_classes_30k_train_016033
Implement the Python class `Loader` described below. Class description: Wrapper class for Loaders. Method signatures and docstrings: - def __init__(self, classname='weka.core.converters.ArffLoader', jobject=None, options=None): Initializes the specified loader either using the classname or the JB_Object. :param class...
Implement the Python class `Loader` described below. Class description: Wrapper class for Loaders. Method signatures and docstrings: - def __init__(self, classname='weka.core.converters.ArffLoader', jobject=None, options=None): Initializes the specified loader either using the classname or the JB_Object. :param class...
8e67a1c7653532fdf71b98cda1bf8c6bafef49f3
<|skeleton|> class Loader: """Wrapper class for Loaders.""" def __init__(self, classname='weka.core.converters.ArffLoader', jobject=None, options=None): """Initializes the specified loader either using the classname or the JB_Object. :param classname: the classname of the loader :type classname: str :p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Loader: """Wrapper class for Loaders.""" def __init__(self, classname='weka.core.converters.ArffLoader', jobject=None, options=None): """Initializes the specified loader either using the classname or the JB_Object. :param classname: the classname of the loader :type classname: str :param jobject:...
the_stack_v2_python_sparse
search_project/weka/core/converters.py
Joel-Venzke/Automated-nmr-assignment
train
2
3cf6c6bae7e049f9383abe3e2ccba296248b6a9f
[ "super(ConvLayer, self).__init__()\nself.atom_fea_len = atom_fea_len\nself.nbr_fea_len = nbr_fea_len\nself.fc_full = nn.Linear(2 * self.atom_fea_len + self.nbr_fea_len, 2 * self.atom_fea_len)\nself.sigmoid = nn.Sigmoid()\nself.softplus1 = nn.Softplus()\nself.bn1 = nn.BatchNorm1d(2 * self.atom_fea_len)\nself.bn2 = n...
<|body_start_0|> super(ConvLayer, self).__init__() self.atom_fea_len = atom_fea_len self.nbr_fea_len = nbr_fea_len self.fc_full = nn.Linear(2 * self.atom_fea_len + self.nbr_fea_len, 2 * self.atom_fea_len) self.sigmoid = nn.Sigmoid() self.softplus1 = nn.Softplus() ...
Convolutional operation on graphs
ConvLayer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvLayer: """Convolutional operation on graphs""" def __init__(self, atom_fea_len, nbr_fea_len): """Initialize ConvLayer. Parameters ---------- atom_fea_len: int Number of atom hidden features. nbr_fea_len: int Number of bond features.""" <|body_0|> def forward(self, at...
stack_v2_sparse_classes_36k_train_001980
6,960
permissive
[ { "docstring": "Initialize ConvLayer. Parameters ---------- atom_fea_len: int Number of atom hidden features. nbr_fea_len: int Number of bond features.", "name": "__init__", "signature": "def __init__(self, atom_fea_len, nbr_fea_len)" }, { "docstring": "Forward pass N: Total number of atoms in t...
2
stack_v2_sparse_classes_30k_train_016565
Implement the Python class `ConvLayer` described below. Class description: Convolutional operation on graphs Method signatures and docstrings: - def __init__(self, atom_fea_len, nbr_fea_len): Initialize ConvLayer. Parameters ---------- atom_fea_len: int Number of atom hidden features. nbr_fea_len: int Number of bond ...
Implement the Python class `ConvLayer` described below. Class description: Convolutional operation on graphs Method signatures and docstrings: - def __init__(self, atom_fea_len, nbr_fea_len): Initialize ConvLayer. Parameters ---------- atom_fea_len: int Number of atom hidden features. nbr_fea_len: int Number of bond ...
a1e733e4451706fc751699be884b1e1d318b3d56
<|skeleton|> class ConvLayer: """Convolutional operation on graphs""" def __init__(self, atom_fea_len, nbr_fea_len): """Initialize ConvLayer. Parameters ---------- atom_fea_len: int Number of atom hidden features. nbr_fea_len: int Number of bond features.""" <|body_0|> def forward(self, at...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConvLayer: """Convolutional operation on graphs""" def __init__(self, atom_fea_len, nbr_fea_len): """Initialize ConvLayer. Parameters ---------- atom_fea_len: int Number of atom hidden features. nbr_fea_len: int Number of bond features.""" super(ConvLayer, self).__init__() self.at...
the_stack_v2_python_sparse
xenonpy/model/cgcnn.py
yoshida-lab/XenonPy
train
122
69cd7a004977df6951dda67690458c86b1397761
[ "if isinstance(expressions, tuple):\n expressions = [expressions]\nmasks = [list(comp(self.loc[:, method], thr)) for method, comp, thr in expressions]\nif len(masks) > 1:\n masks = numpy.logical_and(*masks)\nelse:\n masks = masks[0]\nreturn TAPPredictionResult(self.loc[masks, :])", "if type(others) == ty...
<|body_start_0|> if isinstance(expressions, tuple): expressions = [expressions] masks = [list(comp(self.loc[:, method], thr)) for method, comp, thr in expressions] if len(masks) > 1: masks = numpy.logical_and(*masks) else: masks = masks[0] retu...
A :class:`~Fred2.Core.Result.TAPPredictionResult` object is a :class:`pandas.DataFrame` with single-indexing, where column Ids are the ` prediction names of the different prediction methods, and row ID the :class:`~Fred2.Core.Peptide.Peptide` object TAPPredictionResult: +--------------+-------------+ | Peptide Obj | Me...
TAPPredictionResult
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TAPPredictionResult: """A :class:`~Fred2.Core.Result.TAPPredictionResult` object is a :class:`pandas.DataFrame` with single-indexing, where column Ids are the ` prediction names of the different prediction methods, and row ID the :class:`~Fred2.Core.Peptide.Peptide` object TAPPredictionResult: +-...
stack_v2_sparse_classes_36k_train_001981
14,645
permissive
[ { "docstring": "Filters a result data frame based on a specified expression consisting of a list of triple with (method_name, comparator, threshold). The expression is applied to each row. If any of the columns fulfill the criteria the row remains. :param list((str,comparator,float)) expressions: A list of trip...
2
stack_v2_sparse_classes_30k_train_021544
Implement the Python class `TAPPredictionResult` described below. Class description: A :class:`~Fred2.Core.Result.TAPPredictionResult` object is a :class:`pandas.DataFrame` with single-indexing, where column Ids are the ` prediction names of the different prediction methods, and row ID the :class:`~Fred2.Core.Peptide....
Implement the Python class `TAPPredictionResult` described below. Class description: A :class:`~Fred2.Core.Result.TAPPredictionResult` object is a :class:`pandas.DataFrame` with single-indexing, where column Ids are the ` prediction names of the different prediction methods, and row ID the :class:`~Fred2.Core.Peptide....
b3e54c8c4ed12b780b61f74672e9667245a7bb78
<|skeleton|> class TAPPredictionResult: """A :class:`~Fred2.Core.Result.TAPPredictionResult` object is a :class:`pandas.DataFrame` with single-indexing, where column Ids are the ` prediction names of the different prediction methods, and row ID the :class:`~Fred2.Core.Peptide.Peptide` object TAPPredictionResult: +-...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TAPPredictionResult: """A :class:`~Fred2.Core.Result.TAPPredictionResult` object is a :class:`pandas.DataFrame` with single-indexing, where column Ids are the ` prediction names of the different prediction methods, and row ID the :class:`~Fred2.Core.Peptide.Peptide` object TAPPredictionResult: +--------------...
the_stack_v2_python_sparse
Fred2/Core/Result.py
FRED-2/Fred2
train
42
e2ee32bc0ef9c75d390207400f9a39758fc21886
[ "if not p and (not q):\n return True\nif not p or not q:\n return False\nif p.val != q.val:\n return False\nreturn self.isSameTree(p.left, q.left) and self.isSameTree(p.right, q.right)", "from collections import deque\n\ndef check(p, q):\n if not p and (not q):\n return True\n if not p or no...
<|body_start_0|> if not p and (not q): return True if not p or not q: return False if p.val != q.val: return False return self.isSameTree(p.left, q.left) and self.isSameTree(p.right, q.right) <|end_body_0|> <|body_start_1|> from collections im...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isSameTree(self, p, q): """Recursion time O(N) space O(log(n)) in the best case of completely balanced tree and O(n) in the worst case of completely unbalanced tree, to keep a recursion stack. :type p: TreeNode :type q: TreeNode :rtype: bool""" <|body_0|> def i...
stack_v2_sparse_classes_36k_train_001982
1,443
no_license
[ { "docstring": "Recursion time O(N) space O(log(n)) in the best case of completely balanced tree and O(n) in the worst case of completely unbalanced tree, to keep a recursion stack. :type p: TreeNode :type q: TreeNode :rtype: bool", "name": "isSameTree", "signature": "def isSameTree(self, p, q)" }, ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSameTree(self, p, q): Recursion time O(N) space O(log(n)) in the best case of completely balanced tree and O(n) in the worst case of completely unbalanced tree, to keep a r...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSameTree(self, p, q): Recursion time O(N) space O(log(n)) in the best case of completely balanced tree and O(n) in the worst case of completely unbalanced tree, to keep a r...
85f71621c54f6b0029f3a2746f022f89dd7419d9
<|skeleton|> class Solution: def isSameTree(self, p, q): """Recursion time O(N) space O(log(n)) in the best case of completely balanced tree and O(n) in the worst case of completely unbalanced tree, to keep a recursion stack. :type p: TreeNode :type q: TreeNode :rtype: bool""" <|body_0|> def i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isSameTree(self, p, q): """Recursion time O(N) space O(log(n)) in the best case of completely balanced tree and O(n) in the worst case of completely unbalanced tree, to keep a recursion stack. :type p: TreeNode :type q: TreeNode :rtype: bool""" if not p and (not q): r...
the_stack_v2_python_sparse
LeetCode/Tree/100_same_tree.py
XyK0907/for_work
train
0
911c23bb6fd03862ada11015902594bd870c326e
[ "self.screen = screen\nself.settings = settings\nself.screen_rect = screen.get_rect()\nself.stats = stats\nself.txt_color = (30, 30, 30)\nself.font = pygame.font.SysFont(None, 40)\nself.font_two = pygame.font.SysFont(None, 32)\nself.score_prep()\nself.prep_high_score()\nself.prep_level()", "score_str = '{:,}'.for...
<|body_start_0|> self.screen = screen self.settings = settings self.screen_rect = screen.get_rect() self.stats = stats self.txt_color = (30, 30, 30) self.font = pygame.font.SysFont(None, 40) self.font_two = pygame.font.SysFont(None, 32) self.score_prep() ...
Scoreboard to represent number of aliens killed
Scoreboard
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Scoreboard: """Scoreboard to represent number of aliens killed""" def __init__(self, screen, settings, stats): """Inits atrributes""" <|body_0|> def score_prep(self): """Renders the scoreboard""" <|body_1|> def draw_score(self): """Draws scor...
stack_v2_sparse_classes_36k_train_001983
1,890
no_license
[ { "docstring": "Inits atrributes", "name": "__init__", "signature": "def __init__(self, screen, settings, stats)" }, { "docstring": "Renders the scoreboard", "name": "score_prep", "signature": "def score_prep(self)" }, { "docstring": "Draws score to game", "name": "draw_score...
5
stack_v2_sparse_classes_30k_train_018122
Implement the Python class `Scoreboard` described below. Class description: Scoreboard to represent number of aliens killed Method signatures and docstrings: - def __init__(self, screen, settings, stats): Inits atrributes - def score_prep(self): Renders the scoreboard - def draw_score(self): Draws score to game - def...
Implement the Python class `Scoreboard` described below. Class description: Scoreboard to represent number of aliens killed Method signatures and docstrings: - def __init__(self, screen, settings, stats): Inits atrributes - def score_prep(self): Renders the scoreboard - def draw_score(self): Draws score to game - def...
e36fed32771509fd4ce1baec2f7fec9999fcfdf3
<|skeleton|> class Scoreboard: """Scoreboard to represent number of aliens killed""" def __init__(self, screen, settings, stats): """Inits atrributes""" <|body_0|> def score_prep(self): """Renders the scoreboard""" <|body_1|> def draw_score(self): """Draws scor...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Scoreboard: """Scoreboard to represent number of aliens killed""" def __init__(self, screen, settings, stats): """Inits atrributes""" self.screen = screen self.settings = settings self.screen_rect = screen.get_rect() self.stats = stats self.txt_color = (30,...
the_stack_v2_python_sparse
scoreboard.py
AlexLinGit/Space-Invaders
train
0
f0493c348d3af52f361513921d87bf8c06bc4055
[ "if s == s[::-1]:\n return s\nLen = 1\nstart = 0\nfor i in range(1, len(s)):\n p1, p2 = (i - Len, i + 1)\n if p1 >= 1:\n temp = s[p1 - 1:p2]\n if temp == temp[::-1]:\n start = p1 - 1\n Len += 2\n continue\n if p1 >= 0:\n temp = s[p1:p2]\n if t...
<|body_start_0|> if s == s[::-1]: return s Len = 1 start = 0 for i in range(1, len(s)): p1, p2 = (i - Len, i + 1) if p1 >= 1: temp = s[p1 - 1:p2] if temp == temp[::-1]: start = p1 - 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome_mysecond_fromcenter(self, s): """:type s: str :rtype: str""" <|body_1|> def longestPalindrome_myfirst(self, s): """:type s: str :rtype: str"...
stack_v2_sparse_classes_36k_train_001984
2,919
no_license
[ { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s)" }, { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome_mysecond_fromcenter", "signature": "def longestPalindrome_mysecond_fromcenter(self, s)" }, { ...
3
stack_v2_sparse_classes_30k_train_008394
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome_mysecond_fromcenter(self, s): :type s: str :rtype: str - def longestPalindrome_myfirst(self, s): ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome_mysecond_fromcenter(self, s): :type s: str :rtype: str - def longestPalindrome_myfirst(self, s): ...
f0d9070fa292ca36971a465a805faddb12025482
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome_mysecond_fromcenter(self, s): """:type s: str :rtype: str""" <|body_1|> def longestPalindrome_myfirst(self, s): """:type s: str :rtype: str"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" if s == s[::-1]: return s Len = 1 start = 0 for i in range(1, len(s)): p1, p2 = (i - Len, i + 1) if p1 >= 1: temp = s[p1 - 1:p2] ...
the_stack_v2_python_sparse
5.LongestPalindromicSubstring.py
JerryRoc/leetcode
train
0
43b158355814a9afa47971051ec53a63b8f5387d
[ "replacements = {',COMMA': 'COMMA', '\"DOUBLE-QUOTE': 'DOUBLE-QUOTE', '!EXCLAMATION-POINT': 'EXCLAMATION-POINT', '&AMPERSAND': 'AMPERSAND', \"'SINGLE-QUOTE\": 'SINGLE-QUOTE', '(LEFT-PAREN': 'LEFT-PAREN', ')RIGHT-PAREN': 'RIGHT-PAREN', '-DASH': 'DASH', '-HYPHEN': 'HYPHEN', '...ELLIPSIS': 'ELLIPSIS', '.PERIOD': 'PERI...
<|body_start_0|> replacements = {',COMMA': 'COMMA', '"DOUBLE-QUOTE': 'DOUBLE-QUOTE', '!EXCLAMATION-POINT': 'EXCLAMATION-POINT', '&AMPERSAND': 'AMPERSAND', "'SINGLE-QUOTE": 'SINGLE-QUOTE', '(LEFT-PAREN': 'LEFT-PAREN', ')RIGHT-PAREN': 'RIGHT-PAREN', '-DASH': 'DASH', '-HYPHEN': 'HYPHEN', '...ELLIPSIS': 'ELLIPSIS',...
normalize for the Aurora 4 database
Aurora4
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Aurora4: """normalize for the Aurora 4 database""" def __call__(self, transcription): """normalize a transcription Args: transcription: the transcription to be normalized as a string Returns: the normalized transcription as a string space seperated per character""" <|body_0|>...
stack_v2_sparse_classes_36k_train_001985
2,638
permissive
[ { "docstring": "normalize a transcription Args: transcription: the transcription to be normalized as a string Returns: the normalized transcription as a string space seperated per character", "name": "__call__", "signature": "def __call__(self, transcription)" }, { "docstring": "create the alpha...
2
stack_v2_sparse_classes_30k_train_001598
Implement the Python class `Aurora4` described below. Class description: normalize for the Aurora 4 database Method signatures and docstrings: - def __call__(self, transcription): normalize a transcription Args: transcription: the transcription to be normalized as a string Returns: the normalized transcription as a s...
Implement the Python class `Aurora4` described below. Class description: normalize for the Aurora 4 database Method signatures and docstrings: - def __call__(self, transcription): normalize a transcription Args: transcription: the transcription to be normalized as a string Returns: the normalized transcription as a s...
fb530cf617ff86fe8a249d4582dfe90a303da295
<|skeleton|> class Aurora4: """normalize for the Aurora 4 database""" def __call__(self, transcription): """normalize a transcription Args: transcription: the transcription to be normalized as a string Returns: the normalized transcription as a string space seperated per character""" <|body_0|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Aurora4: """normalize for the Aurora 4 database""" def __call__(self, transcription): """normalize a transcription Args: transcription: the transcription to be normalized as a string Returns: the normalized transcription as a string space seperated per character""" replacements = {',COMMA...
the_stack_v2_python_sparse
nabu/processing/target_normalizers/aurora4.py
DavidKarlas/nabu
train
1
dc0607cb87903b2f0498ee573c06bf62556ce175
[ "L = []\nfor c in s:\n if c != ')' and c != '(':\n continue\n if len(L) and c == ')' and (L[-1] == '('):\n L.pop()\n else:\n L.append(c)\nif len(L):\n return False\nelse:\n return True", "q = Queue()\nq.put((s, 0))\nmdepth, ans, dic = (None, [], {})\nwhile not q.empty():\n f...
<|body_start_0|> L = [] for c in s: if c != ')' and c != '(': continue if len(L) and c == ')' and (L[-1] == '('): L.pop() else: L.append(c) if len(L): return False else: return Tru...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValid(self, s): """:type s: str :rtype: bool""" <|body_0|> def removeInvalidParentheses(self, s): """:type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> L = [] for c in s: if c != ')' an...
stack_v2_sparse_classes_36k_train_001986
1,181
no_license
[ { "docstring": ":type s: str :rtype: bool", "name": "isValid", "signature": "def isValid(self, s)" }, { "docstring": ":type s: str :rtype: List[str]", "name": "removeInvalidParentheses", "signature": "def removeInvalidParentheses(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValid(self, s): :type s: str :rtype: bool - def removeInvalidParentheses(self, s): :type s: str :rtype: List[str]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValid(self, s): :type s: str :rtype: bool - def removeInvalidParentheses(self, s): :type s: str :rtype: List[str] <|skeleton|> class Solution: def isValid(self, s): ...
ed0837ce14a22660657ffd15ff99d7cb1804e8c1
<|skeleton|> class Solution: def isValid(self, s): """:type s: str :rtype: bool""" <|body_0|> def removeInvalidParentheses(self, s): """:type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isValid(self, s): """:type s: str :rtype: bool""" L = [] for c in s: if c != ')' and c != '(': continue if len(L) and c == ')' and (L[-1] == '('): L.pop() else: L.append(c) if len(...
the_stack_v2_python_sparse
python/301-remove-invalid-parentheses.py
ByronHsu/leetcode
train
5
2599df9f5dd544c1919cc88697b9cce75b5cf2d7
[ "self.temp_path = mkdtemp(prefix='pelicantests.')\nself.temp_cache = mkdtemp(prefix='pelican_cache.')\nos.chdir(TEST_DATA_DIR)", "rmtree(self.temp_path)\nrmtree(self.temp_cache)\nos.chdir(PLUGIN_DIR)", "base_path = os.path.dirname(os.path.abspath(__file__))\nbase_path = os.path.join(base_path, 'test_data')\ncon...
<|body_start_0|> self.temp_path = mkdtemp(prefix='pelicantests.') self.temp_cache = mkdtemp(prefix='pelican_cache.') os.chdir(TEST_DATA_DIR) <|end_body_0|> <|body_start_1|> rmtree(self.temp_path) rmtree(self.temp_cache) os.chdir(PLUGIN_DIR) <|end_body_1|> <|body_start_2...
Test running Pelican with the Plugin
TestFullRun
[ "AGPL-3.0-only", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestFullRun: """Test running Pelican with the Plugin""" def setUp(self): """Create temporary output and cache folders""" <|body_0|> def tearDown(self): """Remove output and cache folders""" <|body_1|> def test_generic_tag_with_config(self): "...
stack_v2_sparse_classes_36k_train_001987
2,091
permissive
[ { "docstring": "Create temporary output and cache folders", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Remove output and cache folders", "name": "tearDown", "signature": "def tearDown(self)" }, { "docstring": "Test generation of site with a generic tag tha...
3
stack_v2_sparse_classes_30k_train_003486
Implement the Python class `TestFullRun` described below. Class description: Test running Pelican with the Plugin Method signatures and docstrings: - def setUp(self): Create temporary output and cache folders - def tearDown(self): Remove output and cache folders - def test_generic_tag_with_config(self): Test generati...
Implement the Python class `TestFullRun` described below. Class description: Test running Pelican with the Plugin Method signatures and docstrings: - def setUp(self): Create temporary output and cache folders - def tearDown(self): Remove output and cache folders - def test_generic_tag_with_config(self): Test generati...
b5d68070b6f15677a183424c84e30440e128e1ea
<|skeleton|> class TestFullRun: """Test running Pelican with the Plugin""" def setUp(self): """Create temporary output and cache folders""" <|body_0|> def tearDown(self): """Remove output and cache folders""" <|body_1|> def test_generic_tag_with_config(self): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestFullRun: """Test running Pelican with the Plugin""" def setUp(self): """Create temporary output and cache folders""" self.temp_path = mkdtemp(prefix='pelicantests.') self.temp_cache = mkdtemp(prefix='pelican_cache.') os.chdir(TEST_DATA_DIR) def tearDown(self): ...
the_stack_v2_python_sparse
plugins/liquid_tags/test_generic.py
JackMcKew/jackmckew.dev
train
15
db6813d7fc60898eebd98c6d7898be207b29ca4e
[ "super().__init__()\nself.image = pygame.image.load(file)\nself.rect = self.image.get_rect()\nself.rect = self.image.get_rect()\nself.left_boundary = 0\nself.right_boundary = 0\nself.top_boundary = 0\nself.bottom_boundary = 0\nself.change_x = 0\nself.change_y = 0", "self.rect.x += self.change_x\nself.rect.y += se...
<|body_start_0|> super().__init__() self.image = pygame.image.load(file) self.rect = self.image.get_rect() self.rect = self.image.get_rect() self.left_boundary = 0 self.right_boundary = 0 self.top_boundary = 0 self.bottom_boundary = 0 self.change_x...
Enemy
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Enemy: def __init__(self, file): """Constructor. Pass in the color of the block, and its x and y position.""" <|body_0|> def update(self): """Called each frame.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__() self.image = ...
stack_v2_sparse_classes_36k_train_001988
17,546
no_license
[ { "docstring": "Constructor. Pass in the color of the block, and its x and y position.", "name": "__init__", "signature": "def __init__(self, file)" }, { "docstring": "Called each frame.", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_018653
Implement the Python class `Enemy` described below. Class description: Implement the Enemy class. Method signatures and docstrings: - def __init__(self, file): Constructor. Pass in the color of the block, and its x and y position. - def update(self): Called each frame.
Implement the Python class `Enemy` described below. Class description: Implement the Enemy class. Method signatures and docstrings: - def __init__(self, file): Constructor. Pass in the color of the block, and its x and y position. - def update(self): Called each frame. <|skeleton|> class Enemy: def __init__(sel...
31aa808a5516e653a1e06dec53b4cb74bd820c00
<|skeleton|> class Enemy: def __init__(self, file): """Constructor. Pass in the color of the block, and its x and y position.""" <|body_0|> def update(self): """Called each frame.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Enemy: def __init__(self, file): """Constructor. Pass in the color of the block, and its x and y position.""" super().__init__() self.image = pygame.image.load(file) self.rect = self.image.get_rect() self.rect = self.image.get_rect() self.left_boundary = 0 ...
the_stack_v2_python_sparse
Fa18_student_games/Olivia Asteroids/Asteroids.py
fwparkercode/IntroGames
train
0
093be06cf49b3ee130d3c67e3fd9aa17f7233f02
[ "repo = values['repo']\nif repo:\n if isinstance(v, dict):\n v.setdefault('tag', repo)\n elif isinstance(v, DockerImageBuildApiOptions) and (not v.tag):\n v.tag = repo\nreturn v", "if v and isinstance(v, dict):\n return ElasticContainerRegistryRepository.parse_obj({'repo_name': v.get('repo_...
<|body_start_0|> repo = values['repo'] if repo: if isinstance(v, dict): v.setdefault('tag', repo) elif isinstance(v, DockerImageBuildApiOptions) and (not v.tag): v.tag = repo return v <|end_body_0|> <|body_start_1|> if v and isinst...
Args passed to image.build.
ImageBuildArgs
[ "BSD-2-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageBuildArgs: """Args passed to image.build.""" def _set_docker(cls, v: Union[Dict[str, Any], DockerImageBuildApiOptions, Any], values: Dict[str, Any]) -> Any: """Set the value of ``docker``.""" <|body_0|> def _set_ecr_repo(cls, v: Any, values: Dict[str, Any]) -> Any: ...
stack_v2_sparse_classes_36k_train_001989
6,815
permissive
[ { "docstring": "Set the value of ``docker``.", "name": "_set_docker", "signature": "def _set_docker(cls, v: Union[Dict[str, Any], DockerImageBuildApiOptions, Any], values: Dict[str, Any]) -> Any" }, { "docstring": "Set the value of ``ecr_repo``.", "name": "_set_ecr_repo", "signature": "d...
4
null
Implement the Python class `ImageBuildArgs` described below. Class description: Args passed to image.build. Method signatures and docstrings: - def _set_docker(cls, v: Union[Dict[str, Any], DockerImageBuildApiOptions, Any], values: Dict[str, Any]) -> Any: Set the value of ``docker``. - def _set_ecr_repo(cls, v: Any, ...
Implement the Python class `ImageBuildArgs` described below. Class description: Args passed to image.build. Method signatures and docstrings: - def _set_docker(cls, v: Union[Dict[str, Any], DockerImageBuildApiOptions, Any], values: Dict[str, Any]) -> Any: Set the value of ``docker``. - def _set_ecr_repo(cls, v: Any, ...
0763b06aee07d2cf3f037a49ca0cb81a048c5deb
<|skeleton|> class ImageBuildArgs: """Args passed to image.build.""" def _set_docker(cls, v: Union[Dict[str, Any], DockerImageBuildApiOptions, Any], values: Dict[str, Any]) -> Any: """Set the value of ``docker``.""" <|body_0|> def _set_ecr_repo(cls, v: Any, values: Dict[str, Any]) -> Any: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageBuildArgs: """Args passed to image.build.""" def _set_docker(cls, v: Union[Dict[str, Any], DockerImageBuildApiOptions, Any], values: Dict[str, Any]) -> Any: """Set the value of ``docker``.""" repo = values['repo'] if repo: if isinstance(v, dict): v...
the_stack_v2_python_sparse
runway/cfngin/hooks/docker/image/_build.py
onicagroup/runway
train
156
fe112d44d20a4ab18a5484315af5045c967f735f
[ "if result == []:\n result.append(target)\n return result\nfirst = 0\nlast = len(result) - 1\nwhile last - first > 1:\n mid = (first + last) // 2\n if result[mid] > target:\n last = mid\n else:\n first = mid\nif result[first] >= target:\n result[first] = target\nelif result[last] >= ...
<|body_start_0|> if result == []: result.append(target) return result first = 0 last = len(result) - 1 while last - first > 1: mid = (first + last) // 2 if result[mid] > target: last = mid else: f...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def binaryinsert(self, result, target): """:type result: list :type target: int""" <|body_0|> def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if result == []: re...
stack_v2_sparse_classes_36k_train_001990
993
no_license
[ { "docstring": ":type result: list :type target: int", "name": "binaryinsert", "signature": "def binaryinsert(self, result, target)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "lengthOfLIS", "signature": "def lengthOfLIS(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_000612
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def binaryinsert(self, result, target): :type result: list :type target: int - def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def binaryinsert(self, result, target): :type result: list :type target: int - def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: d...
9bd2d706f014ce84356ba38fc7801da0285a91d3
<|skeleton|> class Solution: def binaryinsert(self, result, target): """:type result: list :type target: int""" <|body_0|> def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def binaryinsert(self, result, target): """:type result: list :type target: int""" if result == []: result.append(target) return result first = 0 last = len(result) - 1 while last - first > 1: mid = (first + last) // 2 ...
the_stack_v2_python_sparse
leetcode/lengthOfLIS-300.py
pittcat/Algorithm_Practice
train
0
2cc288720ee1001e678906c58328cb0fd5300a35
[ "self.w = width\nself.h = height\nself.food = food\nself.score = 0\nself.snake = collections.deque([(0, 0)])\nself.delta = {'U': (-1, 0), 'L': (0, -1), 'R': (0, 1), 'D': (1, 0)}\nself.visited = set((0, 0))", "x, y = self.snake[-1]\ndx, dy = self.delta[direction]\nnx, ny = (x + dx, y + dy)\nif nx < 0 or nx >= self...
<|body_start_0|> self.w = width self.h = height self.food = food self.score = 0 self.snake = collections.deque([(0, 0)]) self.delta = {'U': (-1, 0), 'L': (0, -1), 'R': (0, 1), 'D': (1, 0)} self.visited = set((0, 0)) <|end_body_0|> <|body_start_1|> x, y = ...
SnakeGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ...
stack_v2_sparse_classes_36k_train_001991
1,981
no_license
[ { "docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :type height: int :type food: List[List[int]]", ...
2
stack_v2_sparse_classes_30k_train_005602
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E...
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E...
6fec95b9b4d735727160905e754a698513bfb7d8
<|skeleton|> class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :...
the_stack_v2_python_sparse
leetcode/queue/design-snake-game.py
jwyx3/practices
train
2
3394e5734184e5830a44b78a851afe5ade0d2fb8
[ "config = self.xmpp['xep_0004'].Form()\nconfig['type'] = 'submit'\nfor field, value in self.profile.items():\n config.add_field(var=field, value=value)\nreturn self.xmpp['xep_0060'].set_node_config(None, node, config, ifrom=ifrom, block=block, callback=callback, timeout=timeout)", "if not options:\n options...
<|body_start_0|> config = self.xmpp['xep_0004'].Form() config['type'] = 'submit' for field, value in self.profile.items(): config.add_field(var=field, value=value) return self.xmpp['xep_0060'].set_node_config(None, node, config, ifrom=ifrom, block=block, callback=callback, ti...
XEP-0222: Persistent Storage of Public Data via PubSub
XEP_0222
[ "MIT", "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XEP_0222: """XEP-0222: Persistent Storage of Public Data via PubSub""" def configure(self, node, ifrom=None, block=None, callback=None, timeout=None): """Update a node's configuration to match the public storage profile.""" <|body_0|> def store(self, stanza, node=None, i...
stack_v2_sparse_classes_36k_train_001992
4,884
permissive
[ { "docstring": "Update a node's configuration to match the public storage profile.", "name": "configure", "signature": "def configure(self, node, ifrom=None, block=None, callback=None, timeout=None)" }, { "docstring": "Store public data via PEP. This is just a (very) thin wrapper around the XEP-...
3
null
Implement the Python class `XEP_0222` described below. Class description: XEP-0222: Persistent Storage of Public Data via PubSub Method signatures and docstrings: - def configure(self, node, ifrom=None, block=None, callback=None, timeout=None): Update a node's configuration to match the public storage profile. - def ...
Implement the Python class `XEP_0222` described below. Class description: XEP-0222: Persistent Storage of Public Data via PubSub Method signatures and docstrings: - def configure(self, node, ifrom=None, block=None, callback=None, timeout=None): Update a node's configuration to match the public storage profile. - def ...
cc1d470397de768ffcc41d2ed5ac3118d19f09f5
<|skeleton|> class XEP_0222: """XEP-0222: Persistent Storage of Public Data via PubSub""" def configure(self, node, ifrom=None, block=None, callback=None, timeout=None): """Update a node's configuration to match the public storage profile.""" <|body_0|> def store(self, stanza, node=None, i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XEP_0222: """XEP-0222: Persistent Storage of Public Data via PubSub""" def configure(self, node, ifrom=None, block=None, callback=None, timeout=None): """Update a node's configuration to match the public storage profile.""" config = self.xmpp['xep_0004'].Form() config['type'] = 's...
the_stack_v2_python_sparse
sleekxmpp/plugins/xep_0222.py
fritzy/SleekXMPP
train
658
b57df1e75351369793b1073e61ac2bd351abd0ef
[ "if not head or head.next:\n return head\nnew_head = self.reverse_(head.next)\nhead.next.next = new_head\nhead.next = None\nreturn new_head", "prev = None\ncurr = head\nwhile curr:\n next_node = curr.next\n curr.next = prev\n prev = curr\n curr = next_node\nreturn prev" ]
<|body_start_0|> if not head or head.next: return head new_head = self.reverse_(head.next) head.next.next = new_head head.next = None return new_head <|end_body_0|> <|body_start_1|> prev = None curr = head while curr: next_node = c...
LinkedList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinkedList: def reverse_(self, head: 'ListNode') -> 'ListNode': """Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param head: :return:""" <|body_0|> def reverse(self, head: 'ListNode') -> 'ListNode': """Approach: Iterative Time Complexity: O(N) Spa...
stack_v2_sparse_classes_36k_train_001993
1,231
no_license
[ { "docstring": "Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param head: :return:", "name": "reverse_", "signature": "def reverse_(self, head: 'ListNode') -> 'ListNode'" }, { "docstring": "Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param head: :return:...
2
stack_v2_sparse_classes_30k_train_002972
Implement the Python class `LinkedList` described below. Class description: Implement the LinkedList class. Method signatures and docstrings: - def reverse_(self, head: 'ListNode') -> 'ListNode': Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param head: :return: - def reverse(self, head: 'ListNode...
Implement the Python class `LinkedList` described below. Class description: Implement the LinkedList class. Method signatures and docstrings: - def reverse_(self, head: 'ListNode') -> 'ListNode': Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param head: :return: - def reverse(self, head: 'ListNode...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class LinkedList: def reverse_(self, head: 'ListNode') -> 'ListNode': """Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param head: :return:""" <|body_0|> def reverse(self, head: 'ListNode') -> 'ListNode': """Approach: Iterative Time Complexity: O(N) Spa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinkedList: def reverse_(self, head: 'ListNode') -> 'ListNode': """Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param head: :return:""" if not head or head.next: return head new_head = self.reverse_(head.next) head.next.next = new_head h...
the_stack_v2_python_sparse
goldman_sachs/reverse_linked_list.py
Shiv2157k/leet_code
train
1
dc1c516755136ad695e486e31155bc537afa8e0f
[ "class TestClass:\n\n def __init__(self, name, child=None) -> None:\n self.child = child\n self.bar = name\nt1 = TestClass('t1', TestClass('t1child'))\nt2 = TestClass('t2', TestClass('t2child'))\nt3 = TestClass('t3')\nnl = NodeList([t1, t2, t3])\nassert nl.bar == ['t1', 't2', 't3'], nl.bar\nassert ...
<|body_start_0|> class TestClass: def __init__(self, name, child=None) -> None: self.child = child self.bar = name t1 = TestClass('t1', TestClass('t1child')) t2 = TestClass('t2', TestClass('t2child')) t3 = TestClass('t3') nl = NodeList...
NodeListTestCase
[ "MIT", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NodeListTestCase: def test_simple_attributes(self) -> None: """Test simple attributes of a NodeList class""" <|body_0|> def test_callable_attributes(self) -> None: """Test callable attributes of a NodeList class""" <|body_1|> def test_null(self): ...
stack_v2_sparse_classes_36k_train_001994
44,672
permissive
[ { "docstring": "Test simple attributes of a NodeList class", "name": "test_simple_attributes", "signature": "def test_simple_attributes(self) -> None" }, { "docstring": "Test callable attributes of a NodeList class", "name": "test_callable_attributes", "signature": "def test_callable_att...
3
stack_v2_sparse_classes_30k_train_001172
Implement the Python class `NodeListTestCase` described below. Class description: Implement the NodeListTestCase class. Method signatures and docstrings: - def test_simple_attributes(self) -> None: Test simple attributes of a NodeList class - def test_callable_attributes(self) -> None: Test callable attributes of a N...
Implement the Python class `NodeListTestCase` described below. Class description: Implement the NodeListTestCase class. Method signatures and docstrings: - def test_simple_attributes(self) -> None: Test simple attributes of a NodeList class - def test_callable_attributes(self) -> None: Test callable attributes of a N...
b2a7d7066a2b854460a334a5fe737ea389655e6e
<|skeleton|> class NodeListTestCase: def test_simple_attributes(self) -> None: """Test simple attributes of a NodeList class""" <|body_0|> def test_callable_attributes(self) -> None: """Test callable attributes of a NodeList class""" <|body_1|> def test_null(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NodeListTestCase: def test_simple_attributes(self) -> None: """Test simple attributes of a NodeList class""" class TestClass: def __init__(self, name, child=None) -> None: self.child = child self.bar = name t1 = TestClass('t1', TestClass('t1...
the_stack_v2_python_sparse
SCons/UtilTests.py
SCons/scons
train
1,827
736fddeb62eb70f0a2d9a27d8516a4810175668b
[ "left, right = (0, len(s) - 1)\nwhile left <= right:\n if s[left] == s[right]:\n left += 1\n right -= 1\n else:\n return s[left:right] == s[left:right][::-1] or s[left + 1:right + 1] == s[left + 1:right + 1][::-1]\nreturn True", "left, right = (0, len(s) - 1)\nisPalindrome = lambda x: x...
<|body_start_0|> left, right = (0, len(s) - 1) while left <= right: if s[left] == s[right]: left += 1 right -= 1 else: return s[left:right] == s[left:right][::-1] or s[left + 1:right + 1] == s[left + 1:right + 1][::-1] retur...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def validPalindrome(self, s: str) -> bool: """执行用时 :112 ms, 在所有 Python3 提交中击败了72.38%的用户 内存消耗 :13.8 MB, 在所有 Python3 提交中击败了36.36%的用户 思路:双指针 1、利用left和right两个指针从首尾遍历,如果相同,则同时移动两个指针 2、当不相同时,说明必须删除一个,要么left,要么right 3、Python3中判断是否是回文:s==s[::-1]""" <|body_0|> def validPali...
stack_v2_sparse_classes_36k_train_001995
1,892
no_license
[ { "docstring": "执行用时 :112 ms, 在所有 Python3 提交中击败了72.38%的用户 内存消耗 :13.8 MB, 在所有 Python3 提交中击败了36.36%的用户 思路:双指针 1、利用left和right两个指针从首尾遍历,如果相同,则同时移动两个指针 2、当不相同时,说明必须删除一个,要么left,要么right 3、Python3中判断是否是回文:s==s[::-1]", "name": "validPalindrome", "signature": "def validPalindrome(self, s: str) -> bool" }, { ...
2
stack_v2_sparse_classes_30k_train_003249
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validPalindrome(self, s: str) -> bool: 执行用时 :112 ms, 在所有 Python3 提交中击败了72.38%的用户 内存消耗 :13.8 MB, 在所有 Python3 提交中击败了36.36%的用户 思路:双指针 1、利用left和right两个指针从首尾遍历,如果相同,则同时移动两个指针 2、当不...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validPalindrome(self, s: str) -> bool: 执行用时 :112 ms, 在所有 Python3 提交中击败了72.38%的用户 内存消耗 :13.8 MB, 在所有 Python3 提交中击败了36.36%的用户 思路:双指针 1、利用left和right两个指针从首尾遍历,如果相同,则同时移动两个指针 2、当不...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def validPalindrome(self, s: str) -> bool: """执行用时 :112 ms, 在所有 Python3 提交中击败了72.38%的用户 内存消耗 :13.8 MB, 在所有 Python3 提交中击败了36.36%的用户 思路:双指针 1、利用left和right两个指针从首尾遍历,如果相同,则同时移动两个指针 2、当不相同时,说明必须删除一个,要么left,要么right 3、Python3中判断是否是回文:s==s[::-1]""" <|body_0|> def validPali...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def validPalindrome(self, s: str) -> bool: """执行用时 :112 ms, 在所有 Python3 提交中击败了72.38%的用户 内存消耗 :13.8 MB, 在所有 Python3 提交中击败了36.36%的用户 思路:双指针 1、利用left和right两个指针从首尾遍历,如果相同,则同时移动两个指针 2、当不相同时,说明必须删除一个,要么left,要么right 3、Python3中判断是否是回文:s==s[::-1]""" left, right = (0, len(s) - 1) while...
the_stack_v2_python_sparse
LeetCode/双指针(two points)/680. Valid Palindrome II.py
yiming1012/MyLeetCode
train
2
42e73af0a8a0595994a59e3400f84348ec0959e1
[ "try:\n user: models.User = models.User.objects.create_user_from_json(data=request.data)\nexcept custom_exceptions.DataForNewUserNotProvidedException as e:\n return response.Response(data=e.get_response_format(), status=status.HTTP_400_BAD_REQUEST)\nexcept custom_exceptions.UserAlreadyExistsException as e:\n ...
<|body_start_0|> try: user: models.User = models.User.objects.create_user_from_json(data=request.data) except custom_exceptions.DataForNewUserNotProvidedException as e: return response.Response(data=e.get_response_format(), status=status.HTTP_400_BAD_REQUEST) except custo...
Endpoints for User objects.
UsersEndpoint
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UsersEndpoint: """Endpoints for User objects.""" def post(self, request: Request) -> response.Response: """Registers a new user.""" <|body_0|> def put(self, request: Request, user_id: int) -> response.Response: """Update a user.""" <|body_1|> def get...
stack_v2_sparse_classes_36k_train_001996
14,860
no_license
[ { "docstring": "Registers a new user.", "name": "post", "signature": "def post(self, request: Request) -> response.Response" }, { "docstring": "Update a user.", "name": "put", "signature": "def put(self, request: Request, user_id: int) -> response.Response" }, { "docstring": "Ret...
3
stack_v2_sparse_classes_30k_train_016036
Implement the Python class `UsersEndpoint` described below. Class description: Endpoints for User objects. Method signatures and docstrings: - def post(self, request: Request) -> response.Response: Registers a new user. - def put(self, request: Request, user_id: int) -> response.Response: Update a user. - def get(sel...
Implement the Python class `UsersEndpoint` described below. Class description: Endpoints for User objects. Method signatures and docstrings: - def post(self, request: Request) -> response.Response: Registers a new user. - def put(self, request: Request, user_id: int) -> response.Response: Update a user. - def get(sel...
b6d757895132b9b3c8c6682c11efadf993d5905b
<|skeleton|> class UsersEndpoint: """Endpoints for User objects.""" def post(self, request: Request) -> response.Response: """Registers a new user.""" <|body_0|> def put(self, request: Request, user_id: int) -> response.Response: """Update a user.""" <|body_1|> def get...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UsersEndpoint: """Endpoints for User objects.""" def post(self, request: Request) -> response.Response: """Registers a new user.""" try: user: models.User = models.User.objects.create_user_from_json(data=request.data) except custom_exceptions.DataForNewUserNotProvidedE...
the_stack_v2_python_sparse
main/model_api.py
kalolad1/cosmos
train
0
8ac412d9ae8f3fe85ddf6656e452016451333806
[ "self._sign = ZZ(sign)\nif self._sign != sign:\n raise TypeError('sign must be an integer')\nif self._sign != -1 and self._sign != 1:\n raise TypeError('sign must -1 or 1')\nif self._sign == -1:\n raise NotImplementedError('Despite that eclib has now -1 modular symbols the interface to them is not yet writ...
<|body_start_0|> self._sign = ZZ(sign) if self._sign != sign: raise TypeError('sign must be an integer') if self._sign != -1 and self._sign != 1: raise TypeError('sign must -1 or 1') if self._sign == -1: raise NotImplementedError('Despite that eclib ha...
ModularSymbolECLIB
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModularSymbolECLIB: def __init__(self, E, sign, normalize='L_ratio'): """Modular symbols attached to `E` using ``eclib``. INPUT: - ``E`` - an elliptic curve - ``sign`` - an integer, -1 or 1 - ``normalize`` - either 'L_ratio' (default) or 'none'; For 'L_ratio', the modular symbol is corre...
stack_v2_sparse_classes_36k_train_001997
30,238
no_license
[ { "docstring": "Modular symbols attached to `E` using ``eclib``. INPUT: - ``E`` - an elliptic curve - ``sign`` - an integer, -1 or 1 - ``normalize`` - either 'L_ratio' (default) or 'none'; For 'L_ratio', the modular symbol is correctly normalized by comparing it to the quotient of `L(E,1)` by the least positive...
3
stack_v2_sparse_classes_30k_train_020985
Implement the Python class `ModularSymbolECLIB` described below. Class description: Implement the ModularSymbolECLIB class. Method signatures and docstrings: - def __init__(self, E, sign, normalize='L_ratio'): Modular symbols attached to `E` using ``eclib``. INPUT: - ``E`` - an elliptic curve - ``sign`` - an integer,...
Implement the Python class `ModularSymbolECLIB` described below. Class description: Implement the ModularSymbolECLIB class. Method signatures and docstrings: - def __init__(self, E, sign, normalize='L_ratio'): Modular symbols attached to `E` using ``eclib``. INPUT: - ``E`` - an elliptic curve - ``sign`` - an integer,...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class ModularSymbolECLIB: def __init__(self, E, sign, normalize='L_ratio'): """Modular symbols attached to `E` using ``eclib``. INPUT: - ``E`` - an elliptic curve - ``sign`` - an integer, -1 or 1 - ``normalize`` - either 'L_ratio' (default) or 'none'; For 'L_ratio', the modular symbol is corre...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModularSymbolECLIB: def __init__(self, E, sign, normalize='L_ratio'): """Modular symbols attached to `E` using ``eclib``. INPUT: - ``E`` - an elliptic curve - ``sign`` - an integer, -1 or 1 - ``normalize`` - either 'L_ratio' (default) or 'none'; For 'L_ratio', the modular symbol is correctly normalize...
the_stack_v2_python_sparse
sage/src/sage/schemes/elliptic_curves/ell_modular_symbols.py
bopopescu/geosci
train
0
d06099f8c3fd861fd2b32acaa6d0f90e490897d2
[ "if not root:\n return True\n\ndef helper(tree):\n if not tree:\n return 0\n h_l = helper(tree.left)\n h_r = helper(tree.right)\n if h_l == -1 or h_r == -1 or abs(h_l - h_r) > 1:\n return -1\n return max(h_l, h_r) + 1\nreturn helper(root) >= 0", "if not root:\n return True\nstac...
<|body_start_0|> if not root: return True def helper(tree): if not tree: return 0 h_l = helper(tree.left) h_r = helper(tree.right) if h_l == -1 or h_r == -1 or abs(h_l - h_r) > 1: return -1 return ma...
Solution
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isBalanced(self, root): """DFS (recursive)""" <|body_0|> def isBalanced2(self, root): """DFS (iteration)""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return True def helper(tree): if not...
stack_v2_sparse_classes_36k_train_001998
1,781
permissive
[ { "docstring": "DFS (recursive)", "name": "isBalanced", "signature": "def isBalanced(self, root)" }, { "docstring": "DFS (iteration)", "name": "isBalanced2", "signature": "def isBalanced2(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBalanced(self, root): DFS (recursive) - def isBalanced2(self, root): DFS (iteration)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBalanced(self, root): DFS (recursive) - def isBalanced2(self, root): DFS (iteration) <|skeleton|> class Solution: def isBalanced(self, root): """DFS (recursiv...
49a0b03c55d8a702785888d473ef96539265ce9c
<|skeleton|> class Solution: def isBalanced(self, root): """DFS (recursive)""" <|body_0|> def isBalanced2(self, root): """DFS (iteration)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isBalanced(self, root): """DFS (recursive)""" if not root: return True def helper(tree): if not tree: return 0 h_l = helper(tree.left) h_r = helper(tree.right) if h_l == -1 or h_r == -1 or abs(h_...
the_stack_v2_python_sparse
leetcode/0110_balanced_binary_tree.py
chaosWsF/Python-Practice
train
1
5dbede1c21cce58a9c6fc38305de1ee173f98f7d
[ "descriptorFile = module.getConfigFile(module.getDescriptorName())\nif not descriptorFile:\n logger.debug('Deployment descriptor not found for EJB module:%s' % module.getName())\n return\ndescriptor = self.parseEjbModuleDescriptor(descriptorFile.content, module)\njbossDescriptorFile = module.getConfigFile(JBO...
<|body_start_0|> descriptorFile = module.getConfigFile(module.getDescriptorName()) if not descriptorFile: logger.debug('Deployment descriptor not found for EJB module:%s' % module.getName()) return descriptor = self.parseEjbModuleDescriptor(descriptorFile.content, module)...
JBossApplicationDescriptorParser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JBossApplicationDescriptorParser: def parseJBossEjbModuleDescriptor(self, module): """@type module: jee.EjbModule @rtype" jee_discoverer.EjbModuleDescriptor""" <|body_0|> def parseWebserviceDescriptor(self, content): """Parse webservice in 'weblogic-webservices.xml' ...
stack_v2_sparse_classes_36k_train_001999
2,978
no_license
[ { "docstring": "@type module: jee.EjbModule @rtype\" jee_discoverer.EjbModuleDescriptor", "name": "parseJBossEjbModuleDescriptor", "signature": "def parseJBossEjbModuleDescriptor(self, module)" }, { "docstring": "Parse webservice in 'weblogic-webservices.xml' :type content: str :param content: c...
2
null
Implement the Python class `JBossApplicationDescriptorParser` described below. Class description: Implement the JBossApplicationDescriptorParser class. Method signatures and docstrings: - def parseJBossEjbModuleDescriptor(self, module): @type module: jee.EjbModule @rtype" jee_discoverer.EjbModuleDescriptor - def pars...
Implement the Python class `JBossApplicationDescriptorParser` described below. Class description: Implement the JBossApplicationDescriptorParser class. Method signatures and docstrings: - def parseJBossEjbModuleDescriptor(self, module): @type module: jee.EjbModule @rtype" jee_discoverer.EjbModuleDescriptor - def pars...
c431e809e8d0f82e1bca7e3429dd0245560b5680
<|skeleton|> class JBossApplicationDescriptorParser: def parseJBossEjbModuleDescriptor(self, module): """@type module: jee.EjbModule @rtype" jee_discoverer.EjbModuleDescriptor""" <|body_0|> def parseWebserviceDescriptor(self, content): """Parse webservice in 'weblogic-webservices.xml' ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JBossApplicationDescriptorParser: def parseJBossEjbModuleDescriptor(self, module): """@type module: jee.EjbModule @rtype" jee_discoverer.EjbModuleDescriptor""" descriptorFile = module.getConfigFile(module.getDescriptorName()) if not descriptorFile: logger.debug('Deployment ...
the_stack_v2_python_sparse
reference/ucmdb/discovery/asm_jboss_discover.py
madmonkyang/cda-record
train
0