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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7825f57cafea9d52f6ef0ab1b16afd57b7d8cc74 | [
"intervals = sorted(intervals + [newInterval], key=lambda x: x[0])\nres = []\nfor interval in intervals:\n if not res or interval[0] > res[-1][1]:\n res.append(interval)\n else:\n res[-1][1] = max(interval[1], res[-1][1])\nreturn res",
"i, n = (0, len(intervals))\nres = []\nwhile i < n and new... | <|body_start_0|>
intervals = sorted(intervals + [newInterval], key=lambda x: x[0])
res = []
for interval in intervals:
if not res or interval[0] > res[-1][1]:
res.append(interval)
else:
res[-1][1] = max(interval[1], res[-1][1])
retu... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def insert2(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]:
"""将新区间添加到列表中,排序后再合并"""
<|body_0|>
def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]:
"""# TODO"""
<|body_1|>
<|end_skel... | stack_v2_sparse_classes_36k_train_034100 | 2,230 | no_license | [
{
"docstring": "将新区间添加到列表中,排序后再合并",
"name": "insert2",
"signature": "def insert2(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]"
},
{
"docstring": "# TODO",
"name": "insert",
"signature": "def insert(self, intervals: List[List[int]], newInterval: List[int]) ... | 2 | stack_v2_sparse_classes_30k_train_000746 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def insert2(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]: 将新区间添加到列表中,排序后再合并
- def insert(self, intervals: List[List[int]], newInterval: List[int])... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def insert2(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]: 将新区间添加到列表中,排序后再合并
- def insert(self, intervals: List[List[int]], newInterval: List[int])... | 4732fb80710a08a715c3e7080c394f5298b8326d | <|skeleton|>
class Solution:
def insert2(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]:
"""将新区间添加到列表中,排序后再合并"""
<|body_0|>
def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]:
"""# TODO"""
<|body_1|>
<|end_skel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def insert2(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]:
"""将新区间添加到列表中,排序后再合并"""
intervals = sorted(intervals + [newInterval], key=lambda x: x[0])
res = []
for interval in intervals:
if not res or interval[0] > res[-1][1]:
... | the_stack_v2_python_sparse | .leetcode/57.插入区间.py | xiaoruijiang/algorithm | train | 0 | |
95a471991bc9e5dd14f77180b6e002b3a149a142 | [
"self.t = self.ctx.convert(t)\nif 'degree' in kwargs:\n self.degree = kwargs['degree']\n self.dps_goal = int(1.38 * self.degree)\nelse:\n self.dps_goal = int(2.93 * self.ctx.dps)\n self.degree = max(16, self.dps_goal)\nif self.degree % 2 > 0:\n self.degree += 1\nM = self.degree\nself.dps_orig = self.... | <|body_start_0|>
self.t = self.ctx.convert(t)
if 'degree' in kwargs:
self.degree = kwargs['degree']
self.dps_goal = int(1.38 * self.degree)
else:
self.dps_goal = int(2.93 * self.ctx.dps)
self.degree = max(16, self.dps_goal)
if self.degree %... | Stehfest | [
"Apache-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Stehfest:
def calc_laplace_parameter(self, t, **kwargs):
"""The Gaver-Stehfest method is a discrete approximation of the Widder-Post inversion algorithm, rather than a direct approximation of the Bromwich contour integral. The method abscissa along the real axis, and therefore has issues... | stack_v2_sparse_classes_36k_train_034101 | 36,056 | permissive | [
{
"docstring": "The Gaver-Stehfest method is a discrete approximation of the Widder-Post inversion algorithm, rather than a direct approximation of the Bromwich contour integral. The method abscissa along the real axis, and therefore has issues inverting oscillatory functions (which have poles in pairs away fro... | 3 | null | Implement the Python class `Stehfest` described below.
Class description:
Implement the Stehfest class.
Method signatures and docstrings:
- def calc_laplace_parameter(self, t, **kwargs): The Gaver-Stehfest method is a discrete approximation of the Widder-Post inversion algorithm, rather than a direct approximation of... | Implement the Python class `Stehfest` described below.
Class description:
Implement the Stehfest class.
Method signatures and docstrings:
- def calc_laplace_parameter(self, t, **kwargs): The Gaver-Stehfest method is a discrete approximation of the Widder-Post inversion algorithm, rather than a direct approximation of... | f5042e35b945aded77b23470ead62d7eacefde92 | <|skeleton|>
class Stehfest:
def calc_laplace_parameter(self, t, **kwargs):
"""The Gaver-Stehfest method is a discrete approximation of the Widder-Post inversion algorithm, rather than a direct approximation of the Bromwich contour integral. The method abscissa along the real axis, and therefore has issues... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Stehfest:
def calc_laplace_parameter(self, t, **kwargs):
"""The Gaver-Stehfest method is a discrete approximation of the Widder-Post inversion algorithm, rather than a direct approximation of the Bromwich contour integral. The method abscissa along the real axis, and therefore has issues inverting osc... | the_stack_v2_python_sparse | contrib/python/mpmath/mpmath/calculus/inverselaplace.py | catboost/catboost | train | 8,012 | |
a707f7bc33a7190670796ae04b2a01a3c4be5472 | [
"cur_sum = 0\nways = 0\nif len(nums) == 0:\n return ways\nways = self.dfs(nums, cur_sum, S)\nreturn ways",
"ways = 0\nnums_length = len(nums)\nif nums_length == 0:\n if cur_sum == S:\n return 1\n return 0\nmultiple = [1, -1]\nfor value in multiple:\n new_num = nums[nums_length - 1]\n new_num... | <|body_start_0|>
cur_sum = 0
ways = 0
if len(nums) == 0:
return ways
ways = self.dfs(nums, cur_sum, S)
return ways
<|end_body_0|>
<|body_start_1|>
ways = 0
nums_length = len(nums)
if nums_length == 0:
if cur_sum == S:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findTargetSumWays(self, nums, S):
"""find the target sum by nums, and get the total ways to get that :param nums: :type: list[int] :param S: :type: int :return: :rtype: int"""
<|body_0|>
def dfs(self, nums, cur_sum, S):
"""depth first search the target ... | stack_v2_sparse_classes_36k_train_034102 | 2,744 | no_license | [
{
"docstring": "find the target sum by nums, and get the total ways to get that :param nums: :type: list[int] :param S: :type: int :return: :rtype: int",
"name": "findTargetSumWays",
"signature": "def findTargetSumWays(self, nums, S)"
},
{
"docstring": "depth first search the target num :param n... | 2 | stack_v2_sparse_classes_30k_val_000314 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findTargetSumWays(self, nums, S): find the target sum by nums, and get the total ways to get that :param nums: :type: list[int] :param S: :type: int :return: :rtype: int
- de... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findTargetSumWays(self, nums, S): find the target sum by nums, and get the total ways to get that :param nums: :type: list[int] :param S: :type: int :return: :rtype: int
- de... | 37710292b2cfc6060098363c8d5f8881a4c22b26 | <|skeleton|>
class Solution:
def findTargetSumWays(self, nums, S):
"""find the target sum by nums, and get the total ways to get that :param nums: :type: list[int] :param S: :type: int :return: :rtype: int"""
<|body_0|>
def dfs(self, nums, cur_sum, S):
"""depth first search the target ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findTargetSumWays(self, nums, S):
"""find the target sum by nums, and get the total ways to get that :param nums: :type: list[int] :param S: :type: int :return: :rtype: int"""
cur_sum = 0
ways = 0
if len(nums) == 0:
return ways
ways = self.dfs(... | the_stack_v2_python_sparse | python/pyleetcode/queue_and_stack/targetSum.py | yudongnan23/algorithmRoad | train | 0 | |
f4df295a349c9a3c85e322857c0ec8af352d00e7 | [
"pwd = subprocess.Popen('pwd', stdout=subprocess.PIPE, shell=True).communicate()[0].decode('utf-8').replace('\\n', '')\nself.__dict__['HOST'] = {'value': HOST, 'required': True, 'description': 'The target host'}\nself.__dict__['COMMUNITY'] = {'value': COMMUNITY, 'required': True, 'description': 'Community string'}\... | <|body_start_0|>
pwd = subprocess.Popen('pwd', stdout=subprocess.PIPE, shell=True).communicate()[0].decode('utf-8').replace('\n', '')
self.__dict__['HOST'] = {'value': HOST, 'required': True, 'description': 'The target host'}
self.__dict__['COMMUNITY'] = {'value': COMMUNITY, 'required': True, 'd... | Module Class | Module | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Module:
"""Module Class"""
def __init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP=None):
"""__init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP=None :param HOST: :param COMMUNITY: :param VERSION: :param TEMP: Initialize the module with the module's desired op... | stack_v2_sparse_classes_36k_train_034103 | 2,640 | no_license | [
{
"docstring": "__init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP=None :param HOST: :param COMMUNITY: :param VERSION: :param TEMP: Initialize the module with the module's desired options",
"name": "__init__",
"signature": "def __init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP... | 2 | stack_v2_sparse_classes_30k_train_005814 | Implement the Python class `Module` described below.
Class description:
Module Class
Method signatures and docstrings:
- def __init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP=None): __init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP=None :param HOST: :param COMMUNITY: :param VERSION: :param... | Implement the Python class `Module` described below.
Class description:
Module Class
Method signatures and docstrings:
- def __init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP=None): __init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP=None :param HOST: :param COMMUNITY: :param VERSION: :param... | 99e1d75b3d1af2e44740584be6c2ef1c1601c43c | <|skeleton|>
class Module:
"""Module Class"""
def __init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP=None):
"""__init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP=None :param HOST: :param COMMUNITY: :param VERSION: :param TEMP: Initialize the module with the module's desired op... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Module:
"""Module Class"""
def __init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP=None):
"""__init__(self, HOST=None, COMMUNITY='public', VERSION='1', TEMP=None :param HOST: :param COMMUNITY: :param VERSION: :param TEMP: Initialize the module with the module's desired options"""
... | the_stack_v2_python_sparse | modules/auxiliary/snmp_enum.py | h4cklife/intrukit | train | 3 |
a835c84bfeea1d9589e87285c64b1d89d7830193 | [
"try:\n the_user = User.objects.get(username=username)\nexcept User.DoesNotExist:\n raise UserNotFound\nif the_user.id == request.user.id:\n APIException.status_code = status.HTTP_400_BAD_REQUEST\n raise APIException({'message': 'You cannot follow yourself'})\nto_follow = Profile.objects.get(user_id=the... | <|body_start_0|>
try:
the_user = User.objects.get(username=username)
except User.DoesNotExist:
raise UserNotFound
if the_user.id == request.user.id:
APIException.status_code = status.HTTP_400_BAD_REQUEST
raise APIException({'message': 'You cannot f... | class for follow and unfollow users | FollowAPI | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FollowAPI:
"""class for follow and unfollow users"""
def post(self, request, username):
"""Follow a certain user"""
<|body_0|>
def delete(self, request, username):
"""Unfollow a certain user"""
<|body_1|>
def get(self, request, username):
"""... | stack_v2_sparse_classes_36k_train_034104 | 6,947 | permissive | [
{
"docstring": "Follow a certain user",
"name": "post",
"signature": "def post(self, request, username)"
},
{
"docstring": "Unfollow a certain user",
"name": "delete",
"signature": "def delete(self, request, username)"
},
{
"docstring": "get all users a user is following",
"n... | 3 | stack_v2_sparse_classes_30k_train_011002 | Implement the Python class `FollowAPI` described below.
Class description:
class for follow and unfollow users
Method signatures and docstrings:
- def post(self, request, username): Follow a certain user
- def delete(self, request, username): Unfollow a certain user
- def get(self, request, username): get all users a... | Implement the Python class `FollowAPI` described below.
Class description:
class for follow and unfollow users
Method signatures and docstrings:
- def post(self, request, username): Follow a certain user
- def delete(self, request, username): Unfollow a certain user
- def get(self, request, username): get all users a... | d0f73bf166ad41f243cff6d82caced2f9facf2f9 | <|skeleton|>
class FollowAPI:
"""class for follow and unfollow users"""
def post(self, request, username):
"""Follow a certain user"""
<|body_0|>
def delete(self, request, username):
"""Unfollow a certain user"""
<|body_1|>
def get(self, request, username):
"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FollowAPI:
"""class for follow and unfollow users"""
def post(self, request, username):
"""Follow a certain user"""
try:
the_user = User.objects.get(username=username)
except User.DoesNotExist:
raise UserNotFound
if the_user.id == request.user.id:
... | the_stack_v2_python_sparse | authors/apps/profiles/views.py | andela/ah-the-immortals-backend | train | 3 |
c9304ea608aa9e67a1ebe8f904f9ef6569871f3c | [
"self.width = width\nself.height = height\nself.pos = [[0, 0]]\nself.food = [list(f) for f in food]\nself.score = 0",
"head = list(self.pos[0])\ntail = self.pos.pop()\nif direction == 'U':\n head[0] -= 1\nelif direction == 'D':\n head[0] += 1\nelif direction == 'L':\n head[1] -= 1\nelif direction == 'R':... | <|body_start_0|>
self.width = width
self.height = height
self.pos = [[0, 0]]
self.food = [list(f) for f in food]
self.score = 0
<|end_body_0|>
<|body_start_1|>
head = list(self.pos[0])
tail = self.pos.pop()
if direction == 'U':
head[0] -= 1
... | 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_034105 | 1,699 | 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_020939 | 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... | 4fb6c83220f1da7ebc2d6aff70bccea5f0917b91 | <|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 | Design_Snake_Game.py | maruichen2004/LeetCode | train | 0 | |
e11b5fb77d4188909aceaedba784ed022d37c80a | [
"super().__init__(subarray, **kwargs)\nself.image_extractor = ImageExtractor.from_name(self.extractor_product, subarray=self.subarray, config=self.config)\nself.log.info(f'extractor {self.extractor_product}')\nprint('EXTRACTOR', self.image_extractor)\nself.data_volume_reducer = DataVolumeReducer.from_name(self.redu... | <|body_start_0|>
super().__init__(subarray, **kwargs)
self.image_extractor = ImageExtractor.from_name(self.extractor_product, subarray=self.subarray, config=self.config)
self.log.info(f'extractor {self.extractor_product}')
print('EXTRACTOR', self.image_extractor)
self.data_volume... | Calibrator to handle the LST camera calibration chain, in order to fill the DL1 data level in the event container. | LSTCameraCalibrator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LSTCameraCalibrator:
"""Calibrator to handle the LST camera calibration chain, in order to fill the DL1 data level in the event container."""
def __init__(self, subarray, **kwargs):
"""Parameters ---------- reducer_product : ctapipe.image.reducer.DataVolumeReducer The DataVolumeReduc... | stack_v2_sparse_classes_36k_train_034106 | 8,369 | permissive | [
{
"docstring": "Parameters ---------- reducer_product : ctapipe.image.reducer.DataVolumeReducer The DataVolumeReducer to use. If None, then NullDataVolumeReducer will be used by default, and waveforms will not be reduced. extractor_product : ctapipe.image.extractor.ImageExtractor The ImageExtractor to use. If N... | 4 | stack_v2_sparse_classes_30k_val_001039 | Implement the Python class `LSTCameraCalibrator` described below.
Class description:
Calibrator to handle the LST camera calibration chain, in order to fill the DL1 data level in the event container.
Method signatures and docstrings:
- def __init__(self, subarray, **kwargs): Parameters ---------- reducer_product : ct... | Implement the Python class `LSTCameraCalibrator` described below.
Class description:
Calibrator to handle the LST camera calibration chain, in order to fill the DL1 data level in the event container.
Method signatures and docstrings:
- def __init__(self, subarray, **kwargs): Parameters ---------- reducer_product : ct... | c6af6037d9377bd8dbc18c96f2821cf8ab040672 | <|skeleton|>
class LSTCameraCalibrator:
"""Calibrator to handle the LST camera calibration chain, in order to fill the DL1 data level in the event container."""
def __init__(self, subarray, **kwargs):
"""Parameters ---------- reducer_product : ctapipe.image.reducer.DataVolumeReducer The DataVolumeReduc... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LSTCameraCalibrator:
"""Calibrator to handle the LST camera calibration chain, in order to fill the DL1 data level in the event container."""
def __init__(self, subarray, **kwargs):
"""Parameters ---------- reducer_product : ctapipe.image.reducer.DataVolumeReducer The DataVolumeReducer to use. If... | the_stack_v2_python_sparse | lstchain/calib/camera/calibrator.py | lfoffano/cta-lstchain | train | 1 |
8e4c4c664708af06a08c5e86e5c2fed1f95ad638 | [
"_os = platform.system()\nif _os == 'Windows':\n return byte_string.decode('CP949')\nif _os == 'Linux' or _os == 'Darwin':\n return byte_string.decode('utf-8')",
"colored_print(f'Run: {command}', 'yellow')\nif command in get_command_black_list():\n colored_print('Out: Not supports', 'red')\n return\np... | <|body_start_0|>
_os = platform.system()
if _os == 'Windows':
return byte_string.decode('CP949')
if _os == 'Linux' or _os == 'Darwin':
return byte_string.decode('utf-8')
<|end_body_0|>
<|body_start_1|>
colored_print(f'Run: {command}', 'yellow')
if command... | Perform tests. | CommandRunner | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommandRunner:
"""Perform tests."""
def _convert_byte_to_string(self, byte_string: str) -> str:
"""Decodes Byte format strings and returns them as regular strings. Parameters: byte_string(b_str): String in Byte format. Returns: str: String decoded to utf-8 or cp949. If the execution ... | stack_v2_sparse_classes_36k_train_034107 | 2,697 | permissive | [
{
"docstring": "Decodes Byte format strings and returns them as regular strings. Parameters: byte_string(b_str): String in Byte format. Returns: str: String decoded to utf-8 or cp949. If the execution environment is'Windows', it is converted to'cp949'. If the execution environment is'Linux' or 'Mac OS', it is c... | 3 | null | Implement the Python class `CommandRunner` described below.
Class description:
Perform tests.
Method signatures and docstrings:
- def _convert_byte_to_string(self, byte_string: str) -> str: Decodes Byte format strings and returns them as regular strings. Parameters: byte_string(b_str): String in Byte format. Returns:... | Implement the Python class `CommandRunner` described below.
Class description:
Perform tests.
Method signatures and docstrings:
- def _convert_byte_to_string(self, byte_string: str) -> str: Decodes Byte format strings and returns them as regular strings. Parameters: byte_string(b_str): String in Byte format. Returns:... | 2d6fbc41376cfb8783655b4cf37121eba16848b6 | <|skeleton|>
class CommandRunner:
"""Perform tests."""
def _convert_byte_to_string(self, byte_string: str) -> str:
"""Decodes Byte format strings and returns them as regular strings. Parameters: byte_string(b_str): String in Byte format. Returns: str: String decoded to utf-8 or cp949. If the execution ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CommandRunner:
"""Perform tests."""
def _convert_byte_to_string(self, byte_string: str) -> str:
"""Decodes Byte format strings and returns them as regular strings. Parameters: byte_string(b_str): String in Byte format. Returns: str: String decoded to utf-8 or cp949. If the execution environment i... | the_stack_v2_python_sparse | timo/test_manager/command_runner.py | HwDhyeon/TIMO | train | 0 |
55d72c67ad38d7dae4f05c6d1cb7e56ae730e236 | [
"v0 = Vertex()\nself.assertIsNot(v0, None)\nself.assertIsInstance(v0, Vertex)",
"v0 = Vertex([1])\nself.assertIsNot(v0, None)\nself.assertIsInstance(v0, Vertex)\nv1 = Vertex([1, 2, 3])\nself.assertIsNot(v1, None)\nself.assertIsInstance(v1, Vertex)\nself.assertIsInstance(v1.coordinates(), Coordinates)\nv2 = Vertex... | <|body_start_0|>
v0 = Vertex()
self.assertIsNot(v0, None)
self.assertIsInstance(v0, Vertex)
<|end_body_0|>
<|body_start_1|>
v0 = Vertex([1])
self.assertIsNot(v0, None)
self.assertIsInstance(v0, Vertex)
v1 = Vertex([1, 2, 3])
self.assertIsNot(v1, None)
... | Test Vertex class calls | TestConstructor_Vertex | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestConstructor_Vertex:
"""Test Vertex class calls"""
def test_none(self):
"""Calling Vertex class with no key (key = None)"""
<|body_0|>
def test_iterable_simple(self):
"""Calling Vertex class with key containing simple types"""
<|body_1|>
def test_... | stack_v2_sparse_classes_36k_train_034108 | 6,423 | permissive | [
{
"docstring": "Calling Vertex class with no key (key = None)",
"name": "test_none",
"signature": "def test_none(self)"
},
{
"docstring": "Calling Vertex class with key containing simple types",
"name": "test_iterable_simple",
"signature": "def test_iterable_simple(self)"
},
{
"d... | 3 | stack_v2_sparse_classes_30k_train_005099 | Implement the Python class `TestConstructor_Vertex` described below.
Class description:
Test Vertex class calls
Method signatures and docstrings:
- def test_none(self): Calling Vertex class with no key (key = None)
- def test_iterable_simple(self): Calling Vertex class with key containing simple types
- def test_iter... | Implement the Python class `TestConstructor_Vertex` described below.
Class description:
Test Vertex class calls
Method signatures and docstrings:
- def test_none(self): Calling Vertex class with no key (key = None)
- def test_iterable_simple(self): Calling Vertex class with key containing simple types
- def test_iter... | f9b00a39bc16aea4abac60c0dd0aab2acac5adcf | <|skeleton|>
class TestConstructor_Vertex:
"""Test Vertex class calls"""
def test_none(self):
"""Calling Vertex class with no key (key = None)"""
<|body_0|>
def test_iterable_simple(self):
"""Calling Vertex class with key containing simple types"""
<|body_1|>
def test_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestConstructor_Vertex:
"""Test Vertex class calls"""
def test_none(self):
"""Calling Vertex class with no key (key = None)"""
v0 = Vertex()
self.assertIsNot(v0, None)
self.assertIsInstance(v0, Vertex)
def test_iterable_simple(self):
"""Calling Vertex class wi... | the_stack_v2_python_sparse | _BACKUPS_v3/v3_1/LightPicture_Test.py | nagame/LightPicture | train | 0 |
439211ae824a3b0c6df190407576414fe56453da | [
"self.name = name\nself.start = None\nself.end = None\nself.interval = None",
"sys.stdout.write('{:30}'.format(self.name + '...'))\nsys.stdout.flush()\nself.start = time.clock()\nreturn self",
"self.end = time.clock()\nself.interval = self.end - self.start\nsys.stdout.write(' {:.3f}s'.format(self.interval))\npr... | <|body_start_0|>
self.name = name
self.start = None
self.end = None
self.interval = None
<|end_body_0|>
<|body_start_1|>
sys.stdout.write('{:30}'.format(self.name + '...'))
sys.stdout.flush()
self.start = time.clock()
return self
<|end_body_1|>
<|body_st... | Keep track of execution time, printing status and time before and after. | Timer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Timer:
"""Keep track of execution time, printing status and time before and after."""
def __init__(self, name='Timing'):
"""Optionally give it a name."""
<|body_0|>
def __enter__(self):
"""When the context in entered, start the timer and print the timer name."""
... | stack_v2_sparse_classes_36k_train_034109 | 1,528 | permissive | [
{
"docstring": "Optionally give it a name.",
"name": "__init__",
"signature": "def __init__(self, name='Timing')"
},
{
"docstring": "When the context in entered, start the timer and print the timer name.",
"name": "__enter__",
"signature": "def __enter__(self)"
},
{
"docstring": ... | 3 | stack_v2_sparse_classes_30k_val_000014 | Implement the Python class `Timer` described below.
Class description:
Keep track of execution time, printing status and time before and after.
Method signatures and docstrings:
- def __init__(self, name='Timing'): Optionally give it a name.
- def __enter__(self): When the context in entered, start the timer and prin... | Implement the Python class `Timer` described below.
Class description:
Keep track of execution time, printing status and time before and after.
Method signatures and docstrings:
- def __init__(self, name='Timing'): Optionally give it a name.
- def __enter__(self): When the context in entered, start the timer and prin... | f65ba15890542db8a6c0b2024e500e895cee33d5 | <|skeleton|>
class Timer:
"""Keep track of execution time, printing status and time before and after."""
def __init__(self, name='Timing'):
"""Optionally give it a name."""
<|body_0|>
def __enter__(self):
"""When the context in entered, start the timer and print the timer name."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Timer:
"""Keep track of execution time, printing status and time before and after."""
def __init__(self, name='Timing'):
"""Optionally give it a name."""
self.name = name
self.start = None
self.end = None
self.interval = None
def __enter__(self):
"""Wh... | the_stack_v2_python_sparse | asr_tools/util.py | belambert/asr-tools | train | 6 |
04467bd48a0497a72f3b5b8aa7698dd34066df6f | [
"query = \"INSERT INTO {} (jti) VALUES ('{}')\".format(self.table, jti)\nself.cur.execute(query)\nself.conn.commit()",
"query = \"SELECT * FROM {} where jti = '{}'\".format(self.table, jti)\nself.cur.execute(query)\nresult = self.cur.fetchone()\nreturn bool(result)"
] | <|body_start_0|>
query = "INSERT INTO {} (jti) VALUES ('{}')".format(self.table, jti)
self.cur.execute(query)
self.conn.commit()
<|end_body_0|>
<|body_start_1|>
query = "SELECT * FROM {} where jti = '{}'".format(self.table, jti)
self.cur.execute(query)
result = self.cur.... | Revoked tokens model. | RevokedTokenModel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RevokedTokenModel:
"""Revoked tokens model."""
def save(self, jti):
"""Function to save new jti"""
<|body_0|>
def blacklistedTokens(self, jti):
"""check if jti is blacklisted"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
query = "INSERT INTO {... | stack_v2_sparse_classes_36k_train_034110 | 596 | permissive | [
{
"docstring": "Function to save new jti",
"name": "save",
"signature": "def save(self, jti)"
},
{
"docstring": "check if jti is blacklisted",
"name": "blacklistedTokens",
"signature": "def blacklistedTokens(self, jti)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009217 | Implement the Python class `RevokedTokenModel` described below.
Class description:
Revoked tokens model.
Method signatures and docstrings:
- def save(self, jti): Function to save new jti
- def blacklistedTokens(self, jti): check if jti is blacklisted | Implement the Python class `RevokedTokenModel` described below.
Class description:
Revoked tokens model.
Method signatures and docstrings:
- def save(self, jti): Function to save new jti
- def blacklistedTokens(self, jti): check if jti is blacklisted
<|skeleton|>
class RevokedTokenModel:
"""Revoked tokens model.... | 1ce6a4aed83ea4b1e4aadb29b65c696bbfaf9fc6 | <|skeleton|>
class RevokedTokenModel:
"""Revoked tokens model."""
def save(self, jti):
"""Function to save new jti"""
<|body_0|>
def blacklistedTokens(self, jti):
"""check if jti is blacklisted"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RevokedTokenModel:
"""Revoked tokens model."""
def save(self, jti):
"""Function to save new jti"""
query = "INSERT INTO {} (jti) VALUES ('{}')".format(self.table, jti)
self.cur.execute(query)
self.conn.commit()
def blacklistedTokens(self, jti):
"""check if jti... | the_stack_v2_python_sparse | app/api/v2/models/token_model.py | MRichardN/Qustioner-api-v2 | train | 1 |
529a3f31a04033bd3da99b20a8c6df469fe7f466 | [
"tails_pcr = TargetEnrichmentType.objects.get(name='PCR_with_tails')\ntargets = [target for target in target_names]\nfor tgt in Target.objects.filter(name__in=targets):\n for te in tgt.targetenrichment_set.all().filter(type=tails_pcr):\n for mpx in te.primersmultiplex_set.all():\n try:\n ... | <|body_start_0|>
tails_pcr = TargetEnrichmentType.objects.get(name='PCR_with_tails')
targets = [target for target in target_names]
for tgt in Target.objects.filter(name__in=targets):
for te in tgt.targetenrichment_set.all().filter(type=tails_pcr):
for mpx in te.primer... | CLineageWebServices | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CLineageWebServices:
def get_targets_data(ctx, target_names):
"""Elaborate query for targets. MATLAB example: get_targets_data(service_obj, struct('string',{{'Seq05944'}})) output columns: # Target name # Target: MS/Other Mutation # Basic Unit size # Expected Number of repeats # Basic Un... | stack_v2_sparse_classes_36k_train_034111 | 14,071 | no_license | [
{
"docstring": "Elaborate query for targets. MATLAB example: get_targets_data(service_obj, struct('string',{{'Seq05944'}})) output columns: # Target name # Target: MS/Other Mutation # Basic Unit size # Expected Number of repeats # Basic Unit Type # Chromosome # Length MS # Primer sequence - Left # Primer Tm - L... | 5 | null | Implement the Python class `CLineageWebServices` described below.
Class description:
Implement the CLineageWebServices class.
Method signatures and docstrings:
- def get_targets_data(ctx, target_names): Elaborate query for targets. MATLAB example: get_targets_data(service_obj, struct('string',{{'Seq05944'}})) output ... | Implement the Python class `CLineageWebServices` described below.
Class description:
Implement the CLineageWebServices class.
Method signatures and docstrings:
- def get_targets_data(ctx, target_names): Elaborate query for targets. MATLAB example: get_targets_data(service_obj, struct('string',{{'Seq05944'}})) output ... | e11a4aeec69d65c6d9fa74516ee48f50eccbef21 | <|skeleton|>
class CLineageWebServices:
def get_targets_data(ctx, target_names):
"""Elaborate query for targets. MATLAB example: get_targets_data(service_obj, struct('string',{{'Seq05944'}})) output columns: # Target name # Target: MS/Other Mutation # Basic Unit size # Expected Number of repeats # Basic Un... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CLineageWebServices:
def get_targets_data(ctx, target_names):
"""Elaborate query for targets. MATLAB example: get_targets_data(service_obj, struct('string',{{'Seq05944'}})) output columns: # Target name # Target: MS/Other Mutation # Basic Unit size # Expected Number of repeats # Basic Unit Type # Chro... | the_stack_v2_python_sparse | soap/views.py | shapirolab/clineage | train | 4 | |
9d3cf3d3c43f03f7e0943969d7f4924bc7ddfa22 | [
"self.apartment_code = apartment_code\ntry:\n sql = 'select apartment_id from apartment where apartment_code=\"%s\" ' % self.apartment_code\n self.apartment_id = base.searchSQL(sql)[0][0]\nexcept BaseException as e:\n base.consoleLog('查询自营公寓返回为空,sql:' + sql + '错误返回:' + str(e), 'e')",
"base.consoleLog('查询... | <|body_start_0|>
self.apartment_code = apartment_code
try:
sql = 'select apartment_id from apartment where apartment_code="%s" ' % self.apartment_code
self.apartment_id = base.searchSQL(sql)[0][0]
except BaseException as e:
base.consoleLog('查询自营公寓返回为空,sql:' + ... | 自营房源详情 | ApartmentInfo | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApartmentInfo:
"""自营房源详情"""
def __init__(self, apartment_code):
""":param apartment_code: 房源编号"""
<|body_0|>
def serach_apartment_cose_detail(self):
"""查询自营房源成本 :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.apartment_code = apart... | stack_v2_sparse_classes_36k_train_034112 | 4,668 | no_license | [
{
"docstring": ":param apartment_code: 房源编号",
"name": "__init__",
"signature": "def __init__(self, apartment_code)"
},
{
"docstring": "查询自营房源成本 :return:",
"name": "serach_apartment_cose_detail",
"signature": "def serach_apartment_cose_detail(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006822 | Implement the Python class `ApartmentInfo` described below.
Class description:
自营房源详情
Method signatures and docstrings:
- def __init__(self, apartment_code): :param apartment_code: 房源编号
- def serach_apartment_cose_detail(self): 查询自营房源成本 :return: | Implement the Python class `ApartmentInfo` described below.
Class description:
自营房源详情
Method signatures and docstrings:
- def __init__(self, apartment_code): :param apartment_code: 房源编号
- def serach_apartment_cose_detail(self): 查询自营房源成本 :return:
<|skeleton|>
class ApartmentInfo:
"""自营房源详情"""
def __init__(se... | b4f109a5a025f70940c3707a1e16881ef72c4b41 | <|skeleton|>
class ApartmentInfo:
"""自营房源详情"""
def __init__(self, apartment_code):
""":param apartment_code: 房源编号"""
<|body_0|>
def serach_apartment_cose_detail(self):
"""查询自营房源成本 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ApartmentInfo:
"""自营房源详情"""
def __init__(self, apartment_code):
""":param apartment_code: 房源编号"""
self.apartment_code = apartment_code
try:
sql = 'select apartment_id from apartment where apartment_code="%s" ' % self.apartment_code
self.apartment_id = base.... | the_stack_v2_python_sparse | python_isz_test/iszErpRequest/apartmentRequest.py | zhonglinglong/pyqt5_demo | train | 0 |
4800874ab142b35f943e2b66ad5316d04ca55b49 | [
"if user_index >= self.num_users or following_index >= self.num_users:\n raise ValueError('Number of users is %d, but indices %d and %d' + ' were requested' % (self.num_users, user_index, following_index))\nif self.user_profiles[following_index, user_index] == 0:\n self.user_profiles[following_index, user_ind... | <|body_start_0|>
if user_index >= self.num_users or following_index >= self.num_users:
raise ValueError('Number of users is %d, but indices %d and %d' + ' were requested' % (self.num_users, user_index, following_index))
if self.user_profiles[following_index, user_index] == 0:
sel... | A mixin for classes with a :attr:`~rec.models.recommender.BaseRecommender.user_profiles` attribute to gain the basic functionality of a binary social graph. It assumes a network adjacency matrix of size `|U|x|U|`. | BinarySocialGraph | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BinarySocialGraph:
"""A mixin for classes with a :attr:`~rec.models.recommender.BaseRecommender.user_profiles` attribute to gain the basic functionality of a binary social graph. It assumes a network adjacency matrix of size `|U|x|U|`."""
def follow(self, user_index, following_index):
... | stack_v2_sparse_classes_36k_train_034113 | 4,979 | permissive | [
{
"docstring": "Method to follow another user -- that is, to create a unidirectional link from one user to the other. Parameters ---------- user_index: int Index of the user initiating the follow. following_index: int Index of the user to be followed. Raises ------ ValueError If either of the user indices does ... | 4 | stack_v2_sparse_classes_30k_train_014476 | Implement the Python class `BinarySocialGraph` described below.
Class description:
A mixin for classes with a :attr:`~rec.models.recommender.BaseRecommender.user_profiles` attribute to gain the basic functionality of a binary social graph. It assumes a network adjacency matrix of size `|U|x|U|`.
Method signatures and... | Implement the Python class `BinarySocialGraph` described below.
Class description:
A mixin for classes with a :attr:`~rec.models.recommender.BaseRecommender.user_profiles` attribute to gain the basic functionality of a binary social graph. It assumes a network adjacency matrix of size `|U|x|U|`.
Method signatures and... | 21f9861f203df6857e951b060869d97e6027f15a | <|skeleton|>
class BinarySocialGraph:
"""A mixin for classes with a :attr:`~rec.models.recommender.BaseRecommender.user_profiles` attribute to gain the basic functionality of a binary social graph. It assumes a network adjacency matrix of size `|U|x|U|`."""
def follow(self, user_index, following_index):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BinarySocialGraph:
"""A mixin for classes with a :attr:`~rec.models.recommender.BaseRecommender.user_profiles` attribute to gain the basic functionality of a binary social graph. It assumes a network adjacency matrix of size `|U|x|U|`."""
def follow(self, user_index, following_index):
"""Method t... | the_stack_v2_python_sparse | rec/components/socialgraph.py | zputech/t-recs | train | 0 |
aba0708e11fcc763d2fe0adb2db515c2c2c51412 | [
"self.subtotal = subtotal\nself.state = state\nself.county = county",
"tax_rate = self.STATE_TAX.get(self.state, 0) + self.COUNTY_TAX.get(self.state, {}).get(self.county, 0)\ntax = self.subtotal * tax_rate\norder = {'tax': float(tax), 'total': float(self.subtotal + tax)}\nreturn order"
] | <|body_start_0|>
self.subtotal = subtotal
self.state = state
self.county = county
<|end_body_0|>
<|body_start_1|>
tax_rate = self.STATE_TAX.get(self.state, 0) + self.COUNTY_TAX.get(self.state, {}).get(self.county, 0)
tax = self.subtotal * tax_rate
order = {'tax': float(t... | Represents a simple point of sale system Attributes: STATES: (List) Constant defining the abbreviations for each of the 50 states STATE_TAX: (Dictionary) Base tax rate for each state COUNTY_TAX: (Dictionary) Incremental tax rate for each county, by state subtotal: (Float) Total purchase amount before taxes state: (Stri... | MultistateTaxes | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultistateTaxes:
"""Represents a simple point of sale system Attributes: STATES: (List) Constant defining the abbreviations for each of the 50 states STATE_TAX: (Dictionary) Base tax rate for each state COUNTY_TAX: (Dictionary) Incremental tax rate for each county, by state subtotal: (Float) Tota... | stack_v2_sparse_classes_36k_train_034114 | 3,005 | no_license | [
{
"docstring": "Initializes the class -- prompts user for input",
"name": "__init__",
"signature": "def __init__(self, subtotal=None, state=None, county=None)"
},
{
"docstring": "Calculates the total charges for the customer Args: n/a -- uses class attributes Returns: order: (Dict) { tax: (Float... | 2 | stack_v2_sparse_classes_30k_train_020854 | Implement the Python class `MultistateTaxes` described below.
Class description:
Represents a simple point of sale system Attributes: STATES: (List) Constant defining the abbreviations for each of the 50 states STATE_TAX: (Dictionary) Base tax rate for each state COUNTY_TAX: (Dictionary) Incremental tax rate for each ... | Implement the Python class `MultistateTaxes` described below.
Class description:
Represents a simple point of sale system Attributes: STATES: (List) Constant defining the abbreviations for each of the 50 states STATE_TAX: (Dictionary) Base tax rate for each state COUNTY_TAX: (Dictionary) Incremental tax rate for each ... | 218894fbad8ac3389003ce7321fd4c4020239fd6 | <|skeleton|>
class MultistateTaxes:
"""Represents a simple point of sale system Attributes: STATES: (List) Constant defining the abbreviations for each of the 50 states STATE_TAX: (Dictionary) Base tax rate for each state COUNTY_TAX: (Dictionary) Incremental tax rate for each county, by state subtotal: (Float) Tota... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultistateTaxes:
"""Represents a simple point of sale system Attributes: STATES: (List) Constant defining the abbreviations for each of the 50 states STATE_TAX: (Dictionary) Base tax rate for each state COUNTY_TAX: (Dictionary) Incremental tax rate for each county, by state subtotal: (Float) Total purchase am... | the_stack_v2_python_sparse | challenges/c20_MultistateSalesTax/multistate_tax/multistate_tax.py | andrew-rietz/FiftySeven_Coding_Challenges | train | 0 |
2b3aa3d95af52fe0dfa235046012c9c40b5ba3bb | [
"self.Wz = np.random.randn(h + i, h)\nself.bz = np.zeros((1, h))\nself.Wr = np.random.randn(h + i, h)\nself.br = np.zeros((1, h))\nself.Wh = np.random.randn(h + i, h)\nself.bh = np.zeros((1, h))\nself.Wy = np.random.randn(h, o)\nself.by = np.zeros((1, o))",
"m, _ = h_prev.shape\nh = np.concatenate((h_prev, x_t), ... | <|body_start_0|>
self.Wz = np.random.randn(h + i, h)
self.bz = np.zeros((1, h))
self.Wr = np.random.randn(h + i, h)
self.br = np.zeros((1, h))
self.Wh = np.random.randn(h + i, h)
self.bh = np.zeros((1, h))
self.Wy = np.random.randn(h, o)
self.by = np.zeros... | the GRU cell class GRU: gated recurrent unit | GRUCell | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GRUCell:
"""the GRU cell class GRU: gated recurrent unit"""
def __init__(self, i, h, o):
"""the GRUCell constructor i: dimensionality of the data h: dimensions of hidden state o: dimensions of output fields: (weights and biases) Wz, bz: for update gate Wr, br: for reset gate Wh, bh: ... | stack_v2_sparse_classes_36k_train_034115 | 2,314 | no_license | [
{
"docstring": "the GRUCell constructor i: dimensionality of the data h: dimensions of hidden state o: dimensions of output fields: (weights and biases) Wz, bz: for update gate Wr, br: for reset gate Wh, bh: for intermediate hidden state Wy, by: for output",
"name": "__init__",
"signature": "def __init_... | 2 | stack_v2_sparse_classes_30k_train_011932 | Implement the Python class `GRUCell` described below.
Class description:
the GRU cell class GRU: gated recurrent unit
Method signatures and docstrings:
- def __init__(self, i, h, o): the GRUCell constructor i: dimensionality of the data h: dimensions of hidden state o: dimensions of output fields: (weights and biases... | Implement the Python class `GRUCell` described below.
Class description:
the GRU cell class GRU: gated recurrent unit
Method signatures and docstrings:
- def __init__(self, i, h, o): the GRUCell constructor i: dimensionality of the data h: dimensions of hidden state o: dimensions of output fields: (weights and biases... | d86b0e0cae2dd07c761f84a493abc895007873ee | <|skeleton|>
class GRUCell:
"""the GRU cell class GRU: gated recurrent unit"""
def __init__(self, i, h, o):
"""the GRUCell constructor i: dimensionality of the data h: dimensions of hidden state o: dimensions of output fields: (weights and biases) Wz, bz: for update gate Wr, br: for reset gate Wh, bh: ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GRUCell:
"""the GRU cell class GRU: gated recurrent unit"""
def __init__(self, i, h, o):
"""the GRUCell constructor i: dimensionality of the data h: dimensions of hidden state o: dimensions of output fields: (weights and biases) Wz, bz: for update gate Wr, br: for reset gate Wh, bh: for intermedi... | the_stack_v2_python_sparse | supervised_learning/0x0D-RNNs/2-gru_cell.py | mag389/holbertonschool-machine_learning | train | 2 |
596fa382d3ed7cd23f56f5d32500932afb525c83 | [
"super().__init__(empty=empty)\nself.name: typing.Final[str] = name\nself.package_types: typing.List[PackageType] = list(package_types)",
"self.empty = False\nif package_type not in self.package_types:\n self.package_types.append(package_type)"
] | <|body_start_0|>
super().__init__(empty=empty)
self.name: typing.Final[str] = name
self.package_types: typing.List[PackageType] = list(package_types)
<|end_body_0|>
<|body_start_1|>
self.empty = False
if package_type not in self.package_types:
self.package_types.appe... | Cached details on a package stored on a server. | PackageCacheRecord | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PackageCacheRecord:
"""Cached details on a package stored on a server."""
def __init__(self, name: str, empty: bool=True, package_types: typing.Iterable[PackageType]=()) -> None:
"""Initialize new :class:`~PackageCacheRecord` instance."""
<|body_0|>
def update(self, pack... | stack_v2_sparse_classes_36k_train_034116 | 31,647 | permissive | [
{
"docstring": "Initialize new :class:`~PackageCacheRecord` instance.",
"name": "__init__",
"signature": "def __init__(self, name: str, empty: bool=True, package_types: typing.Iterable[PackageType]=()) -> None"
},
{
"docstring": "Update record after a file is uploaded to this package.",
"nam... | 2 | null | Implement the Python class `PackageCacheRecord` described below.
Class description:
Cached details on a package stored on a server.
Method signatures and docstrings:
- def __init__(self, name: str, empty: bool=True, package_types: typing.Iterable[PackageType]=()) -> None: Initialize new :class:`~PackageCacheRecord` i... | Implement the Python class `PackageCacheRecord` described below.
Class description:
Cached details on a package stored on a server.
Method signatures and docstrings:
- def __init__(self, name: str, empty: bool=True, package_types: typing.Iterable[PackageType]=()) -> None: Initialize new :class:`~PackageCacheRecord` i... | 45fb0a363ba7833deccee6db82a26a0b51a7ca75 | <|skeleton|>
class PackageCacheRecord:
"""Cached details on a package stored on a server."""
def __init__(self, name: str, empty: bool=True, package_types: typing.Iterable[PackageType]=()) -> None:
"""Initialize new :class:`~PackageCacheRecord` instance."""
<|body_0|>
def update(self, pack... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PackageCacheRecord:
"""Cached details on a package stored on a server."""
def __init__(self, name: str, empty: bool=True, package_types: typing.Iterable[PackageType]=()) -> None:
"""Initialize new :class:`~PackageCacheRecord` instance."""
super().__init__(empty=empty)
self.name: t... | the_stack_v2_python_sparse | binstar_client/commands/upload.py | Anaconda-Platform/anaconda-client | train | 119 |
cc31aba5b664993468fc4c55dbafdfa022526468 | [
"if not root or not p or (not q):\n return None\nif root == p or root == q:\n return root\nif not root.left:\n return self.lowestCommonAncestor(root.right, p, q)\nif not root.right:\n return self.lowestCommonAncestor(root.left, p, q)\nif self.contains(root.left, p) and self.contains(root.left, q):\n ... | <|body_start_0|>
if not root or not p or (not q):
return None
if root == p or root == q:
return root
if not root.left:
return self.lowestCommonAncestor(root.right, p, q)
if not root.right:
return self.lowestCommonAncestor(root.left, p, q)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lowestCommonAncestor(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode"""
<|body_0|>
def contains(self, root, node):
"""does tree root contains node?"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_36k_train_034117 | 5,241 | no_license | [
{
"docstring": ":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode",
"name": "lowestCommonAncestor",
"signature": "def lowestCommonAncestor(self, root, p, q)"
},
{
"docstring": "does tree root contains node?",
"name": "contains",
"signature": "def contains(self, ro... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lowestCommonAncestor(self, root, p, q): :type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode
- def contains(self, root, node): does tree root contains no... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lowestCommonAncestor(self, root, p, q): :type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode
- def contains(self, root, node): does tree root contains no... | e00cf94c5b86c8cca27e3bee69ad21e727b7679b | <|skeleton|>
class Solution:
def lowestCommonAncestor(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode"""
<|body_0|>
def contains(self, root, node):
"""does tree root contains node?"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lowestCommonAncestor(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode"""
if not root or not p or (not q):
return None
if root == p or root == q:
return root
if not root.left:
return... | the_stack_v2_python_sparse | tree/prob236.py | binchen15/leet-python | train | 1 | |
4ff9cacb63c53dcfa56e5ca61424cdc3f79f2d9c | [
"if Bcl2FastqServiceMixin._runner_service:\n return Bcl2FastqServiceMixin._runner_service\nelse:\n import multiprocessing\n nbr_of_cores = multiprocessing.cpu_count()\n Bcl2FastqServiceMixin._runner_service = LocalQAdapter(nbr_of_cores=nbr_of_cores, interval=2)\n return Bcl2FastqServiceMixin._runner_... | <|body_start_0|>
if Bcl2FastqServiceMixin._runner_service:
return Bcl2FastqServiceMixin._runner_service
else:
import multiprocessing
nbr_of_cores = multiprocessing.cpu_count()
Bcl2FastqServiceMixin._runner_service = LocalQAdapter(nbr_of_cores=nbr_of_cores,... | Provides bcl2fastq related services that can be mixed in. It will create adaptors to the runner service the first time a request is made and then keep that adaptor. These adaptors are static, so that only one such adaptor is created for the entire application. | Bcl2FastqServiceMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Bcl2FastqServiceMixin:
"""Provides bcl2fastq related services that can be mixed in. It will create adaptors to the runner service the first time a request is made and then keep that adaptor. These adaptors are static, so that only one such adaptor is created for the entire application."""
de... | stack_v2_sparse_classes_36k_train_034118 | 10,271 | permissive | [
{
"docstring": "Create an adaptor to the runner service unless one already exists",
"name": "runner_service",
"signature": "def runner_service()"
},
{
"docstring": "Create a command generation service unless one already exists.",
"name": "bcl2fastq_cmd_generation_service",
"signature": "... | 2 | stack_v2_sparse_classes_30k_train_000117 | Implement the Python class `Bcl2FastqServiceMixin` described below.
Class description:
Provides bcl2fastq related services that can be mixed in. It will create adaptors to the runner service the first time a request is made and then keep that adaptor. These adaptors are static, so that only one such adaptor is created... | Implement the Python class `Bcl2FastqServiceMixin` described below.
Class description:
Provides bcl2fastq related services that can be mixed in. It will create adaptors to the runner service the first time a request is made and then keep that adaptor. These adaptors are static, so that only one such adaptor is created... | afb1332c016d7af99cb710d3c6f4fe8f10775422 | <|skeleton|>
class Bcl2FastqServiceMixin:
"""Provides bcl2fastq related services that can be mixed in. It will create adaptors to the runner service the first time a request is made and then keep that adaptor. These adaptors are static, so that only one such adaptor is created for the entire application."""
de... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Bcl2FastqServiceMixin:
"""Provides bcl2fastq related services that can be mixed in. It will create adaptors to the runner service the first time a request is made and then keep that adaptor. These adaptors are static, so that only one such adaptor is created for the entire application."""
def runner_serv... | the_stack_v2_python_sparse | bcl2fastq/handlers/bcl2fastq_handlers.py | arteria-project/arteria-bcl2fastq | train | 3 |
a53967f0dfb27429a58db5f5553091c4c1f79ebb | [
"self.f = f\nself.gp = GP(X_init, Y_init, l, sigma_f)\nself.X_s = np.linspace(bounds[0], bounds[1], num=ac_samples)\nself.X_s = self.X_s.reshape(-1, 1)\nself.xsi = xsi\nself.minimize = minimize",
"mu_s, sigma_s = self.gp.predict(self.X_s)\nif self.minimize is True:\n Y_s = np.min(self.gp.Y)\n imp = Y_s - mu... | <|body_start_0|>
self.f = f
self.gp = GP(X_init, Y_init, l, sigma_f)
self.X_s = np.linspace(bounds[0], bounds[1], num=ac_samples)
self.X_s = self.X_s.reshape(-1, 1)
self.xsi = xsi
self.minimize = minimize
<|end_body_0|>
<|body_start_1|>
mu_s, sigma_s = self.gp.pr... | Performs Bayesian optimization on a noiseless 1D Gaussian process | BayesianOptimization | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BayesianOptimization:
"""Performs Bayesian optimization on a noiseless 1D Gaussian process"""
def __init__(self, f, X_init, Y_init, bounds, ac_samples, l=1, sigma_f=1, xsi=0.01, minimize=True):
"""Class constructor"""
<|body_0|>
def acquisition(self):
"""Calculat... | stack_v2_sparse_classes_36k_train_034119 | 2,305 | no_license | [
{
"docstring": "Class constructor",
"name": "__init__",
"signature": "def __init__(self, f, X_init, Y_init, bounds, ac_samples, l=1, sigma_f=1, xsi=0.01, minimize=True)"
},
{
"docstring": "Calculates the next best sample location",
"name": "acquisition",
"signature": "def acquisition(sel... | 3 | stack_v2_sparse_classes_30k_train_011646 | Implement the Python class `BayesianOptimization` described below.
Class description:
Performs Bayesian optimization on a noiseless 1D Gaussian process
Method signatures and docstrings:
- def __init__(self, f, X_init, Y_init, bounds, ac_samples, l=1, sigma_f=1, xsi=0.01, minimize=True): Class constructor
- def acquis... | Implement the Python class `BayesianOptimization` described below.
Class description:
Performs Bayesian optimization on a noiseless 1D Gaussian process
Method signatures and docstrings:
- def __init__(self, f, X_init, Y_init, bounds, ac_samples, l=1, sigma_f=1, xsi=0.01, minimize=True): Class constructor
- def acquis... | 161e33b23d398d7d01ad0d7740b78dda3f27e787 | <|skeleton|>
class BayesianOptimization:
"""Performs Bayesian optimization on a noiseless 1D Gaussian process"""
def __init__(self, f, X_init, Y_init, bounds, ac_samples, l=1, sigma_f=1, xsi=0.01, minimize=True):
"""Class constructor"""
<|body_0|>
def acquisition(self):
"""Calculat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BayesianOptimization:
"""Performs Bayesian optimization on a noiseless 1D Gaussian process"""
def __init__(self, f, X_init, Y_init, bounds, ac_samples, l=1, sigma_f=1, xsi=0.01, minimize=True):
"""Class constructor"""
self.f = f
self.gp = GP(X_init, Y_init, l, sigma_f)
sel... | the_stack_v2_python_sparse | unsupervised_learning/0x03-hyperparameter_tuning/5-bayes_opt.py | felipeserna/holbertonschool-machine_learning | train | 0 |
d0f9f1019b6036c90a1d10b02252b81ab022a419 | [
"queryset = self.filter_queryset(self.get_queryset())\nqueryset = queryset.filter(status=2)\nis_read = request.query_params.get('is_read', None)\nif is_read:\n if is_read == 'False':\n queryset = queryset.exclude(Q(messagepushuser_message_push__is_read=True), Q(messagepushuser_message_push__user=request.u... | <|body_start_0|>
queryset = self.filter_queryset(self.get_queryset())
queryset = queryset.filter(status=2)
is_read = request.query_params.get('is_read', None)
if is_read:
if is_read == 'False':
queryset = queryset.exclude(Q(messagepushuser_message_push__is_rea... | 消息推送模型的CRUD视图 | MessagePushModelViewSet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MessagePushModelViewSet:
"""消息推送模型的CRUD视图"""
def get_user_messages(self, request: Request, *args, **kwargs):
"""获取用户自己消息列表"""
<|body_0|>
def update_is_read(self, request: Request, *args, **kwargs):
"""修改为已读"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_36k_train_034120 | 16,018 | permissive | [
{
"docstring": "获取用户自己消息列表",
"name": "get_user_messages",
"signature": "def get_user_messages(self, request: Request, *args, **kwargs)"
},
{
"docstring": "修改为已读",
"name": "update_is_read",
"signature": "def update_is_read(self, request: Request, *args, **kwargs)"
}
] | 2 | null | Implement the Python class `MessagePushModelViewSet` described below.
Class description:
消息推送模型的CRUD视图
Method signatures and docstrings:
- def get_user_messages(self, request: Request, *args, **kwargs): 获取用户自己消息列表
- def update_is_read(self, request: Request, *args, **kwargs): 修改为已读 | Implement the Python class `MessagePushModelViewSet` described below.
Class description:
消息推送模型的CRUD视图
Method signatures and docstrings:
- def get_user_messages(self, request: Request, *args, **kwargs): 获取用户自己消息列表
- def update_is_read(self, request: Request, *args, **kwargs): 修改为已读
<|skeleton|>
class MessagePushMode... | 32b598f304bc41eebd4f8173236038120cdfaf87 | <|skeleton|>
class MessagePushModelViewSet:
"""消息推送模型的CRUD视图"""
def get_user_messages(self, request: Request, *args, **kwargs):
"""获取用户自己消息列表"""
<|body_0|>
def update_is_read(self, request: Request, *args, **kwargs):
"""修改为已读"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MessagePushModelViewSet:
"""消息推送模型的CRUD视图"""
def get_user_messages(self, request: Request, *args, **kwargs):
"""获取用户自己消息列表"""
queryset = self.filter_queryset(self.get_queryset())
queryset = queryset.filter(status=2)
is_read = request.query_params.get('is_read', None)
... | the_stack_v2_python_sparse | apps/vadmin/system/views.py | kuangzhanzhizi/ansible-ui-backend | train | 0 |
cbfc39fe8ba44971ee5add591c1b42b0bf6e0e39 | [
"super(WYSIWYGField, self).__init__(label, validators, **kwargs)\nself.allowed_tags = allowed_tags.split(' ')\nself.linkify = linkify",
"if valuelist:\n html = bleach.clean(valuelist[0], attributes=self.attributes, tags=self.allowed_tags)\n if self.linkify:\n html = bleach.linkify(html)\n self.dat... | <|body_start_0|>
super(WYSIWYGField, self).__init__(label, validators, **kwargs)
self.allowed_tags = allowed_tags.split(' ')
self.linkify = linkify
<|end_body_0|>
<|body_start_1|>
if valuelist:
html = bleach.clean(valuelist[0], attributes=self.attributes, tags=self.allowed_t... | text area with tinymce attached and html sanitizing | WYSIWYGField | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WYSIWYGField:
"""text area with tinymce attached and html sanitizing"""
def __init__(self, label='', validators=None, linkify=True, allowed_tags='h1 h2 h3 h4 h5 h6 a img a li ol ul pre quote blockquote b i u br div span p strong em', **kwargs):
"""initialize the WYSIWYGField. :param ... | stack_v2_sparse_classes_36k_train_034121 | 13,531 | permissive | [
{
"docstring": "initialize the WYSIWYGField. :param label: the label of the field (wtforms) :param validators: the validators as list (wtforms) :param linkify: whether linkify should run over the input (converting links to tags) :param allowed_tags: space separated list of allowed tags in the html input.",
... | 2 | stack_v2_sparse_classes_30k_train_019301 | Implement the Python class `WYSIWYGField` described below.
Class description:
text area with tinymce attached and html sanitizing
Method signatures and docstrings:
- def __init__(self, label='', validators=None, linkify=True, allowed_tags='h1 h2 h3 h4 h5 h6 a img a li ol ul pre quote blockquote b i u br div span p st... | Implement the Python class `WYSIWYGField` described below.
Class description:
text area with tinymce attached and html sanitizing
Method signatures and docstrings:
- def __init__(self, label='', validators=None, linkify=True, allowed_tags='h1 h2 h3 h4 h5 h6 a img a li ol ul pre quote blockquote b i u br div span p st... | 9b45664e46c451b2cbe00bb55583b043e769083d | <|skeleton|>
class WYSIWYGField:
"""text area with tinymce attached and html sanitizing"""
def __init__(self, label='', validators=None, linkify=True, allowed_tags='h1 h2 h3 h4 h5 h6 a img a li ol ul pre quote blockquote b i u br div span p strong em', **kwargs):
"""initialize the WYSIWYGField. :param ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WYSIWYGField:
"""text area with tinymce attached and html sanitizing"""
def __init__(self, label='', validators=None, linkify=True, allowed_tags='h1 h2 h3 h4 h5 h6 a img a li ol ul pre quote blockquote b i u br div span p strong em', **kwargs):
"""initialize the WYSIWYGField. :param label: the la... | the_stack_v2_python_sparse | camper/handlers/forms.py | comlounge/camper | train | 14 |
8dfdfa2dbd160eb19a040109f78a5b85a994dd80 | [
"self.golden_ratio = 1.618\nself.table_size = 65536\nself.table = [[] for _ in range(self.table_size)]\nself.hash = lambda i: i * math.ceil(self.golden_ratio * self.table_size) % self.table_size",
"self.remove(key)\nhkey = self.hash(key)\nself.table[hkey].append((key, value))",
"hkey = self.hash(key)\nix = -1\n... | <|body_start_0|>
self.golden_ratio = 1.618
self.table_size = 65536
self.table = [[] for _ in range(self.table_size)]
self.hash = lambda i: i * math.ceil(self.golden_ratio * self.table_size) % self.table_size
<|end_body_0|>
<|body_start_1|>
self.remove(key)
hkey = self.ha... | MyHashMap1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyHashMap1:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def put(self, key, value):
"""value will always be non-negative. :type key: int :type value: int :rtype: None"""
<|body_1|>
def get(self, key):
"""Returns the v... | stack_v2_sparse_classes_36k_train_034122 | 5,109 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "value will always be non-negative. :type key: int :type value: int :rtype: None",
"name": "put",
"signature": "def put(self, key, value)"
},
{
"docstrin... | 4 | stack_v2_sparse_classes_30k_train_020107 | Implement the Python class `MyHashMap1` described below.
Class description:
Implement the MyHashMap1 class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def put(self, key, value): value will always be non-negative. :type key: int :type value: int :rtype: None
- def ge... | Implement the Python class `MyHashMap1` described below.
Class description:
Implement the MyHashMap1 class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def put(self, key, value): value will always be non-negative. :type key: int :type value: int :rtype: None
- def ge... | 233d12deca34f51c3bb0406831cc07f3b72b50cf | <|skeleton|>
class MyHashMap1:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def put(self, key, value):
"""value will always be non-negative. :type key: int :type value: int :rtype: None"""
<|body_1|>
def get(self, key):
"""Returns the v... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MyHashMap1:
def __init__(self):
"""Initialize your data structure here."""
self.golden_ratio = 1.618
self.table_size = 65536
self.table = [[] for _ in range(self.table_size)]
self.hash = lambda i: i * math.ceil(self.golden_ratio * self.table_size) % self.table_size
... | the_stack_v2_python_sparse | Python/Design HashMap/main.py | briansu2004/MyLeet | train | 1 | |
34e5bf1e62fa4d428be8140c7abc2695db04fdbd | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ChatMessageHistoryItem()",
"from .chat_message_actions import ChatMessageActions\nfrom .chat_message_reaction import ChatMessageReaction\nfrom .chat_message_actions import ChatMessageActions\nfrom .chat_message_reaction import ChatMess... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return ChatMessageHistoryItem()
<|end_body_0|>
<|body_start_1|>
from .chat_message_actions import ChatMessageActions
from .chat_message_reaction import ChatMessageReaction
from .chat_me... | ChatMessageHistoryItem | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChatMessageHistoryItem:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ChatMessageHistoryItem:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create ... | stack_v2_sparse_classes_36k_train_034123 | 3,455 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ChatMessageHistoryItem",
"name": "create_from_discriminator_value",
"signature": "def create_from_discrimina... | 3 | null | Implement the Python class `ChatMessageHistoryItem` described below.
Class description:
Implement the ChatMessageHistoryItem class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ChatMessageHistoryItem: Creates a new instance of the appropriate class b... | Implement the Python class `ChatMessageHistoryItem` described below.
Class description:
Implement the ChatMessageHistoryItem class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ChatMessageHistoryItem: Creates a new instance of the appropriate class b... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class ChatMessageHistoryItem:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ChatMessageHistoryItem:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChatMessageHistoryItem:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ChatMessageHistoryItem:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Ret... | the_stack_v2_python_sparse | msgraph/generated/models/chat_message_history_item.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
df061f18456331417b18287ac54dc352358371c7 | [
"self.qs = qs\nself.cls = cls\nself.q = self.cls.query\nself.links = None",
"for field in self.qs.sort:\n sort_func = asc\n if field[0] == '-':\n field = field[1:]\n sort_func = desc\n self.q = self.q.order_by(sort_func(field))",
"def build_criterion(expression):\n \"\"\" Helper functi... | <|body_start_0|>
self.qs = qs
self.cls = cls
self.q = self.cls.query
self.links = None
<|end_body_0|>
<|body_start_1|>
for field in self.qs.sort:
sort_func = asc
if field[0] == '-':
field = field[1:]
sort_func = desc
... | QueryBuilder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QueryBuilder:
def __init__(self, qs, cls):
"""Parameters ---------- qs (QueryString): instance of QueryString cls (Model): Mapped class to DB table, based on SA Model class"""
<|body_0|>
def _apply_sort(self):
"""Applies sorting to a query"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_034124 | 4,810 | no_license | [
{
"docstring": "Parameters ---------- qs (QueryString): instance of QueryString cls (Model): Mapped class to DB table, based on SA Model class",
"name": "__init__",
"signature": "def __init__(self, qs, cls)"
},
{
"docstring": "Applies sorting to a query",
"name": "_apply_sort",
"signatur... | 5 | stack_v2_sparse_classes_30k_train_011491 | Implement the Python class `QueryBuilder` described below.
Class description:
Implement the QueryBuilder class.
Method signatures and docstrings:
- def __init__(self, qs, cls): Parameters ---------- qs (QueryString): instance of QueryString cls (Model): Mapped class to DB table, based on SA Model class
- def _apply_s... | Implement the Python class `QueryBuilder` described below.
Class description:
Implement the QueryBuilder class.
Method signatures and docstrings:
- def __init__(self, qs, cls): Parameters ---------- qs (QueryString): instance of QueryString cls (Model): Mapped class to DB table, based on SA Model class
- def _apply_s... | 34854cb17b9c6ad0b4f24d20924ebdd37f53c0d0 | <|skeleton|>
class QueryBuilder:
def __init__(self, qs, cls):
"""Parameters ---------- qs (QueryString): instance of QueryString cls (Model): Mapped class to DB table, based on SA Model class"""
<|body_0|>
def _apply_sort(self):
"""Applies sorting to a query"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QueryBuilder:
def __init__(self, qs, cls):
"""Parameters ---------- qs (QueryString): instance of QueryString cls (Model): Mapped class to DB table, based on SA Model class"""
self.qs = qs
self.cls = cls
self.q = self.cls.query
self.links = None
def _apply_sort(sel... | the_stack_v2_python_sparse | app/utils/query_builder.py | mantydze/toptal-api | train | 0 | |
587fcc5493081aa26787413f58e6f8e5d8782256 | [
"projekt_id = request.args.get('projekt_id')\nmodule = json.loads(request.args.get('module'))\nadm = ProjektAdministration()\nadm.update_projekte_hat_module(projekt_id, module)",
"projekt_id = request.args.get('projekt_id')\nmodule = json.loads(request.args.get('module'))\nadm = ProjektAdministration()\nadm.creat... | <|body_start_0|>
projekt_id = request.args.get('projekt_id')
module = json.loads(request.args.get('module'))
adm = ProjektAdministration()
adm.update_projekte_hat_module(projekt_id, module)
<|end_body_0|>
<|body_start_1|>
projekt_id = request.args.get('projekt_id')
modul... | ProjektehatModuleOperationen | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjektehatModuleOperationen:
def put(self):
"""Update von wählbaren Modulen eines bestimmten Projektes."""
<|body_0|>
def post(self):
"""Anlegen der wählbaren Module für ein bestimmtes Projekt."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
projek... | stack_v2_sparse_classes_36k_train_034125 | 29,521 | no_license | [
{
"docstring": "Update von wählbaren Modulen eines bestimmten Projektes.",
"name": "put",
"signature": "def put(self)"
},
{
"docstring": "Anlegen der wählbaren Module für ein bestimmtes Projekt.",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014630 | Implement the Python class `ProjektehatModuleOperationen` described below.
Class description:
Implement the ProjektehatModuleOperationen class.
Method signatures and docstrings:
- def put(self): Update von wählbaren Modulen eines bestimmten Projektes.
- def post(self): Anlegen der wählbaren Module für ein bestimmtes ... | Implement the Python class `ProjektehatModuleOperationen` described below.
Class description:
Implement the ProjektehatModuleOperationen class.
Method signatures and docstrings:
- def put(self): Update von wählbaren Modulen eines bestimmten Projektes.
- def post(self): Anlegen der wählbaren Module für ein bestimmtes ... | 9014f16fed08956bd28216e1373b60139e5caea1 | <|skeleton|>
class ProjektehatModuleOperationen:
def put(self):
"""Update von wählbaren Modulen eines bestimmten Projektes."""
<|body_0|>
def post(self):
"""Anlegen der wählbaren Module für ein bestimmtes Projekt."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProjektehatModuleOperationen:
def put(self):
"""Update von wählbaren Modulen eines bestimmten Projektes."""
projekt_id = request.args.get('projekt_id')
module = json.loads(request.args.get('module'))
adm = ProjektAdministration()
adm.update_projekte_hat_module(projekt_i... | the_stack_v2_python_sparse | src/main.py | leanderpeter/university_project_selector | train | 3 | |
cca133a86e81e27e073a4969da73d6a2d35bbc39 | [
"pulls_list = {'number': 79, 'created_at': '2018-08-12T05:31:14Z', 'state': 'open'}\nmock_res = PullsTest.MockRes(pulls_list, 200)\ntype(mock_response).return_value = mock.PropertyMock(return_value=mock_res)\ntype(mock_get).return_value = mock.PropertyMock(return_value=type(mock_response).return_value)\nfreezer = f... | <|body_start_0|>
pulls_list = {'number': 79, 'created_at': '2018-08-12T05:31:14Z', 'state': 'open'}
mock_res = PullsTest.MockRes(pulls_list, 200)
type(mock_response).return_value = mock.PropertyMock(return_value=mock_res)
type(mock_get).return_value = mock.PropertyMock(return_value=type(... | Test for Repository class inside repository package | PullsTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PullsTest:
"""Test for Repository class inside repository package"""
def test_created_time(self, mock_get, mock_response):
"""Test for pulls class inside pulls package"""
<|body_0|>
def test_closed_pull_request_time(self, mock_get, mock_response):
"""Test for pul... | stack_v2_sparse_classes_36k_train_034126 | 4,498 | no_license | [
{
"docstring": "Test for pulls class inside pulls package",
"name": "test_created_time",
"signature": "def test_created_time(self, mock_get, mock_response)"
},
{
"docstring": "Test for pulls class inside pulls package",
"name": "test_closed_pull_request_time",
"signature": "def test_clos... | 4 | stack_v2_sparse_classes_30k_test_000490 | Implement the Python class `PullsTest` described below.
Class description:
Test for Repository class inside repository package
Method signatures and docstrings:
- def test_created_time(self, mock_get, mock_response): Test for pulls class inside pulls package
- def test_closed_pull_request_time(self, mock_get, mock_re... | Implement the Python class `PullsTest` described below.
Class description:
Test for Repository class inside repository package
Method signatures and docstrings:
- def test_created_time(self, mock_get, mock_response): Test for pulls class inside pulls package
- def test_closed_pull_request_time(self, mock_get, mock_re... | 4b31f2c7d87c3ad15c7ab8b71a94abdada1faf63 | <|skeleton|>
class PullsTest:
"""Test for Repository class inside repository package"""
def test_created_time(self, mock_get, mock_response):
"""Test for pulls class inside pulls package"""
<|body_0|>
def test_closed_pull_request_time(self, mock_get, mock_response):
"""Test for pul... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PullsTest:
"""Test for Repository class inside repository package"""
def test_created_time(self, mock_get, mock_response):
"""Test for pulls class inside pulls package"""
pulls_list = {'number': 79, 'created_at': '2018-08-12T05:31:14Z', 'state': 'open'}
mock_res = PullsTest.MockRe... | the_stack_v2_python_sparse | unit_test/pulls_test.py | iamthebj/GitPred | train | 0 |
3b8e827d65ae4e00e89f40c0fe3e870c5d82f301 | [
"super().__init__()\nself.rov = rov\nself.pid = pid\nself.pid_trim = pid_trim\nself.last_output = 0\nself.__start = False\npid.set_output_limits(-25, 25)\nself.depth = depth",
"rot = self.rov.link1.getRotation()\ncurrent_depth = self.rov.getRigidBody('rovBody').getPosition()[2]\nself.pid.compute(current_depth)\no... | <|body_start_0|>
super().__init__()
self.rov = rov
self.pid = pid
self.pid_trim = pid_trim
self.last_output = 0
self.__start = False
pid.set_output_limits(-25, 25)
self.depth = depth
<|end_body_0|>
<|body_start_1|>
rot = self.rov.link1.getRotation... | RovController | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RovController:
def __init__(self, rov: RovAssembly, pid: PID_Controller, pid_trim: PID_Controller, depth):
"""Args: rov: pid: pid_trim: depth:"""
<|body_0|>
def pre(self, t):
"""Args: t:"""
<|body_1|>
def post(self, t):
"""can send depth and ever... | stack_v2_sparse_classes_36k_train_034127 | 2,360 | no_license | [
{
"docstring": "Args: rov: pid: pid_trim: depth:",
"name": "__init__",
"signature": "def __init__(self, rov: RovAssembly, pid: PID_Controller, pid_trim: PID_Controller, depth)"
},
{
"docstring": "Args: t:",
"name": "pre",
"signature": "def pre(self, t)"
},
{
"docstring": "can sen... | 3 | stack_v2_sparse_classes_30k_train_011416 | Implement the Python class `RovController` described below.
Class description:
Implement the RovController class.
Method signatures and docstrings:
- def __init__(self, rov: RovAssembly, pid: PID_Controller, pid_trim: PID_Controller, depth): Args: rov: pid: pid_trim: depth:
- def pre(self, t): Args: t:
- def post(sel... | Implement the Python class `RovController` described below.
Class description:
Implement the RovController class.
Method signatures and docstrings:
- def __init__(self, rov: RovAssembly, pid: PID_Controller, pid_trim: PID_Controller, depth): Args: rov: pid: pid_trim: depth:
- def pre(self, t): Args: t:
- def post(sel... | c9743d7dc61ce3f83a4616b7439a8459afb15502 | <|skeleton|>
class RovController:
def __init__(self, rov: RovAssembly, pid: PID_Controller, pid_trim: PID_Controller, depth):
"""Args: rov: pid: pid_trim: depth:"""
<|body_0|>
def pre(self, t):
"""Args: t:"""
<|body_1|>
def post(self, t):
"""can send depth and ever... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RovController:
def __init__(self, rov: RovAssembly, pid: PID_Controller, pid_trim: PID_Controller, depth):
"""Args: rov: pid: pid_trim: depth:"""
super().__init__()
self.rov = rov
self.pid = pid
self.pid_trim = pid_trim
self.last_output = 0
self.__start ... | the_stack_v2_python_sparse | Rov/rov_controller.py | Towed-ROV/digital-twin | train | 2 | |
db2c5312beb5bbae00b5c9b4ad44ef4c3c80e458 | [
"try:\n return User.objects.get(pk=pk)\nexcept Exception as e:\n print(e)\n raise Http404",
"response = self.serializer(data=request.data)\nif response.is_valid():\n user = self.get_object(response.data['user_id'])\n if user.is_superuser is True:\n return Response('editing of superuser passw... | <|body_start_0|>
try:
return User.objects.get(pk=pk)
except Exception as e:
print(e)
raise Http404
<|end_body_0|>
<|body_start_1|>
response = self.serializer(data=request.data)
if response.is_valid():
user = self.get_object(response.data['... | Modify User Password | UserModifyPasswordView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserModifyPasswordView:
"""Modify User Password"""
def get_object(pk):
"""..."""
<|body_0|>
def post(self, request, format=None):
"""..."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
return User.objects.get(pk=pk)
exce... | stack_v2_sparse_classes_36k_train_034128 | 4,540 | permissive | [
{
"docstring": "...",
"name": "get_object",
"signature": "def get_object(pk)"
},
{
"docstring": "...",
"name": "post",
"signature": "def post(self, request, format=None)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020793 | Implement the Python class `UserModifyPasswordView` described below.
Class description:
Modify User Password
Method signatures and docstrings:
- def get_object(pk): ...
- def post(self, request, format=None): ... | Implement the Python class `UserModifyPasswordView` described below.
Class description:
Modify User Password
Method signatures and docstrings:
- def get_object(pk): ...
- def post(self, request, format=None): ...
<|skeleton|>
class UserModifyPasswordView:
"""Modify User Password"""
def get_object(pk):
... | 9c7f82a3fdaa7a8f2f34062d8803b4f33f8c07b7 | <|skeleton|>
class UserModifyPasswordView:
"""Modify User Password"""
def get_object(pk):
"""..."""
<|body_0|>
def post(self, request, format=None):
"""..."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserModifyPasswordView:
"""Modify User Password"""
def get_object(pk):
"""..."""
try:
return User.objects.get(pk=pk)
except Exception as e:
print(e)
raise Http404
def post(self, request, format=None):
"""..."""
response = se... | the_stack_v2_python_sparse | apps/user/views/vuser.py | magocod/dj_chat | train | 2 |
31c019e543abc638152e1769653d1d6f47d8ed41 | [
"zero_state = np.array([[1], [0]], dtype=complex)\none_state = np.array([[0], [1]], dtype=complex)\none_one_state = np.kron(one_state, one_state)\nzero_zero_state = np.kron(zero_state, zero_state)\ncat_state = 1.0 / np.sqrt(2) * (zero_zero_state + one_one_state)\nself.density_matrix = np.dot(one_one_state, one_one_... | <|body_start_0|>
zero_state = np.array([[1], [0]], dtype=complex)
one_state = np.array([[0], [1]], dtype=complex)
one_one_state = np.kron(one_state, one_state)
zero_zero_state = np.kron(zero_state, zero_state)
cat_state = 1.0 / np.sqrt(2) * (zero_zero_state + one_one_state)
... | ChannelTest | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChannelTest:
def setUp(self):
"""Initialize a few density matrices"""
<|body_0|>
def test_amplitude_damping(self):
"""Test amplitude damping on a simple qubit state"""
<|body_1|>
def test_dephasing(self):
"""Test dephasing on a simple qubit state... | stack_v2_sparse_classes_36k_train_034129 | 6,706 | permissive | [
{
"docstring": "Initialize a few density matrices",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test amplitude damping on a simple qubit state",
"name": "test_amplitude_damping",
"signature": "def test_amplitude_damping(self)"
},
{
"docstring": "Test dephas... | 5 | null | Implement the Python class `ChannelTest` described below.
Class description:
Implement the ChannelTest class.
Method signatures and docstrings:
- def setUp(self): Initialize a few density matrices
- def test_amplitude_damping(self): Test amplitude damping on a simple qubit state
- def test_dephasing(self): Test depha... | Implement the Python class `ChannelTest` described below.
Class description:
Implement the ChannelTest class.
Method signatures and docstrings:
- def setUp(self): Initialize a few density matrices
- def test_amplitude_damping(self): Test amplitude damping on a simple qubit state
- def test_dephasing(self): Test depha... | 788481753c798a72c5cb3aa9f2aa9da3ce3190b0 | <|skeleton|>
class ChannelTest:
def setUp(self):
"""Initialize a few density matrices"""
<|body_0|>
def test_amplitude_damping(self):
"""Test amplitude damping on a simple qubit state"""
<|body_1|>
def test_dephasing(self):
"""Test dephasing on a simple qubit state... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChannelTest:
def setUp(self):
"""Initialize a few density matrices"""
zero_state = np.array([[1], [0]], dtype=complex)
one_state = np.array([[0], [1]], dtype=complex)
one_one_state = np.kron(one_state, one_state)
zero_zero_state = np.kron(zero_state, zero_state)
... | the_stack_v2_python_sparse | src/openfermion/utils/channel_state_test.py | quantumlib/OpenFermion | train | 1,481 | |
21303e0f6b18ddbc9265e8eccc492f26039f6e85 | [
"if self.value_type in self._values:\n return self._values[self.value_type] == STATE_ON\nreturn False",
"pres = self.gateway.const.Presentation\nclass_map = {pres.S_DOOR: 'opening', pres.S_MOTION: 'motion', pres.S_SMOKE: 'smoke'}\nif float(self.gateway.protocol_version) >= 1.5:\n class_map.update({pres.S_SP... | <|body_start_0|>
if self.value_type in self._values:
return self._values[self.value_type] == STATE_ON
return False
<|end_body_0|>
<|body_start_1|>
pres = self.gateway.const.Presentation
class_map = {pres.S_DOOR: 'opening', pres.S_MOTION: 'motion', pres.S_SMOKE: 'smoke'}
... | Represent the value of a MySensors Binary Sensor child node. | MySensorsBinarySensor | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MySensorsBinarySensor:
"""Represent the value of a MySensors Binary Sensor child node."""
def is_on(self):
"""Return True if the binary sensor is on."""
<|body_0|>
def sensor_class(self):
"""Return the class of this sensor, from SENSOR_CLASSES."""
<|body_... | stack_v2_sparse_classes_36k_train_034130 | 2,829 | permissive | [
{
"docstring": "Return True if the binary sensor is on.",
"name": "is_on",
"signature": "def is_on(self)"
},
{
"docstring": "Return the class of this sensor, from SENSOR_CLASSES.",
"name": "sensor_class",
"signature": "def sensor_class(self)"
}
] | 2 | null | Implement the Python class `MySensorsBinarySensor` described below.
Class description:
Represent the value of a MySensors Binary Sensor child node.
Method signatures and docstrings:
- def is_on(self): Return True if the binary sensor is on.
- def sensor_class(self): Return the class of this sensor, from SENSOR_CLASSE... | Implement the Python class `MySensorsBinarySensor` described below.
Class description:
Represent the value of a MySensors Binary Sensor child node.
Method signatures and docstrings:
- def is_on(self): Return True if the binary sensor is on.
- def sensor_class(self): Return the class of this sensor, from SENSOR_CLASSE... | ca0e92aba83de2fd6cb1cc4d14f3b4471f17cf3d | <|skeleton|>
class MySensorsBinarySensor:
"""Represent the value of a MySensors Binary Sensor child node."""
def is_on(self):
"""Return True if the binary sensor is on."""
<|body_0|>
def sensor_class(self):
"""Return the class of this sensor, from SENSOR_CLASSES."""
<|body_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MySensorsBinarySensor:
"""Represent the value of a MySensors Binary Sensor child node."""
def is_on(self):
"""Return True if the binary sensor is on."""
if self.value_type in self._values:
return self._values[self.value_type] == STATE_ON
return False
def sensor_cl... | the_stack_v2_python_sparse | homeassistant/components/binary_sensor/mysensors.py | Smart-Torvy/torvy-home-assistant | train | 2 |
ffccabc3167e6f1b826ec13065b814e38b507520 | [
"initializer = Initializer()\ninitializer.initialize_data_manager(data_setting_pth)\nself.task_setting_pth = task_setting_pth\nself.tsk_opt = initializer.init_task_option(task_setting_pth)\nself.writer = initializer.initialize_log_env()\nself.tsk_opt = initializer.get_task_option()\nself.data_loaders = initializer.... | <|body_start_0|>
initializer = Initializer()
initializer.initialize_data_manager(data_setting_pth)
self.task_setting_pth = task_setting_pth
self.tsk_opt = initializer.init_task_option(task_setting_pth)
self.writer = initializer.initialize_log_env()
self.tsk_opt = initiali... | Pipeline class, initialize env : data_manager, log settings and task settings run_task : run training based model or evaluation based model | Pipline | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Pipline:
"""Pipeline class, initialize env : data_manager, log settings and task settings run_task : run training based model or evaluation based model"""
def initialize(self, task_setting_pth='../settings/task_settings.json', data_setting_pth='../settings/data_settings.json', data_loaders=N... | stack_v2_sparse_classes_36k_train_034131 | 2,474 | permissive | [
{
"docstring": "initialize task environment :param task_setting_pth: the path of current task setting file :param data_setting_pth: the path of current data processing setting file (option if already set in task_setting_file) :param data_loaders: the dataloader for tasks :return: None",
"name": "initialize"... | 3 | null | Implement the Python class `Pipline` described below.
Class description:
Pipeline class, initialize env : data_manager, log settings and task settings run_task : run training based model or evaluation based model
Method signatures and docstrings:
- def initialize(self, task_setting_pth='../settings/task_settings.json... | Implement the Python class `Pipline` described below.
Class description:
Pipeline class, initialize env : data_manager, log settings and task settings run_task : run training based model or evaluation based model
Method signatures and docstrings:
- def initialize(self, task_setting_pth='../settings/task_settings.json... | 55339813d47c86a79268831f5b353924a2326fb3 | <|skeleton|>
class Pipline:
"""Pipeline class, initialize env : data_manager, log settings and task settings run_task : run training based model or evaluation based model"""
def initialize(self, task_setting_pth='../settings/task_settings.json', data_setting_pth='../settings/data_settings.json', data_loaders=N... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Pipline:
"""Pipeline class, initialize env : data_manager, log settings and task settings run_task : run training based model or evaluation based model"""
def initialize(self, task_setting_pth='../settings/task_settings.json', data_setting_pth='../settings/data_settings.json', data_loaders=None):
... | the_stack_v2_python_sparse | easyreg/piplines.py | uncbiag/easyreg | train | 139 |
7bc36659d2a32386ffb70d3ecfc793ebb262976c | [
"if client:\n results = client.get_metadata(endpoint)\nelse:\n results = kwargs\nself.endpoint = results['id']\nself.name = results['name']\nself.filename = self.name.lower().replace(' ', '-') + '-raw.csv'\nself.attribution = results['attribution']\nself.category = results['category']\nself.description = resu... | <|body_start_0|>
if client:
results = client.get_metadata(endpoint)
else:
results = kwargs
self.endpoint = results['id']
self.name = results['name']
self.filename = self.name.lower().replace(' ', '-') + '-raw.csv'
self.attribution = results['attrib... | DatasetMetaInformation | [
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DatasetMetaInformation:
def __init__(self, client: Socrata=None, endpoint: str='', **kwargs):
"""Initialize the Datset Meta Infomation class according to the provided endpoint. Parameters: ----------- client: `Socrata` Socrata client used by the `Client` class. endpoint: `str` Endpoint u... | stack_v2_sparse_classes_36k_train_034132 | 16,886 | permissive | [
{
"docstring": "Initialize the Datset Meta Infomation class according to the provided endpoint. Parameters: ----------- client: `Socrata` Socrata client used by the `Client` class. endpoint: `str` Endpoint used to fetch metadata.",
"name": "__init__",
"signature": "def __init__(self, client: Socrata=Non... | 2 | stack_v2_sparse_classes_30k_train_008942 | Implement the Python class `DatasetMetaInformation` described below.
Class description:
Implement the DatasetMetaInformation class.
Method signatures and docstrings:
- def __init__(self, client: Socrata=None, endpoint: str='', **kwargs): Initialize the Datset Meta Infomation class according to the provided endpoint. ... | Implement the Python class `DatasetMetaInformation` described below.
Class description:
Implement the DatasetMetaInformation class.
Method signatures and docstrings:
- def __init__(self, client: Socrata=None, endpoint: str='', **kwargs): Initialize the Datset Meta Infomation class according to the provided endpoint. ... | 458466bd5010e50278b71da9fe30d92842955aa5 | <|skeleton|>
class DatasetMetaInformation:
def __init__(self, client: Socrata=None, endpoint: str='', **kwargs):
"""Initialize the Datset Meta Infomation class according to the provided endpoint. Parameters: ----------- client: `Socrata` Socrata client used by the `Client` class. endpoint: `str` Endpoint u... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DatasetMetaInformation:
def __init__(self, client: Socrata=None, endpoint: str='', **kwargs):
"""Initialize the Datset Meta Infomation class according to the provided endpoint. Parameters: ----------- client: `Socrata` Socrata client used by the `Client` class. endpoint: `str` Endpoint used to fetch m... | the_stack_v2_python_sparse | Brownsville/data_api.py | CahhBrownsville/Brownsville-project | train | 0 | |
9d4e352c6c1384e32d4fbdc8faa94da3bb24bb8c | [
"self.server_host = server_host\nself.password = password\nself.from_user = from_user\nself.to_user_list = to_user_list\nself.server = self._init_server()",
"server = smtplib.SMTP(self.server_host, 25)\nserver.login(self.from_user, self.password)\nreturn server",
"from_user_format = Header(str(self.from_user) +... | <|body_start_0|>
self.server_host = server_host
self.password = password
self.from_user = from_user
self.to_user_list = to_user_list
self.server = self._init_server()
<|end_body_0|>
<|body_start_1|>
server = smtplib.SMTP(self.server_host, 25)
server.login(self.fr... | EmailUtil | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EmailUtil:
def __init__(self, server_host, password, from_user, to_user_list):
"""初始化发送邮件设置 :param server_host: 发送邮件的邮件服务器 :param password: 发送用户的密码 :param from_user: 发送邮件的用户邮箱 :param to_user_list: 接收邮件的用户邮箱列表"""
<|body_0|>
def _init_server(self):
"""邮件服务器初始化 :return:... | stack_v2_sparse_classes_36k_train_034133 | 1,955 | permissive | [
{
"docstring": "初始化发送邮件设置 :param server_host: 发送邮件的邮件服务器 :param password: 发送用户的密码 :param from_user: 发送邮件的用户邮箱 :param to_user_list: 接收邮件的用户邮箱列表",
"name": "__init__",
"signature": "def __init__(self, server_host, password, from_user, to_user_list)"
},
{
"docstring": "邮件服务器初始化 :return: 邮件服务器对象",
... | 3 | stack_v2_sparse_classes_30k_train_021142 | Implement the Python class `EmailUtil` described below.
Class description:
Implement the EmailUtil class.
Method signatures and docstrings:
- def __init__(self, server_host, password, from_user, to_user_list): 初始化发送邮件设置 :param server_host: 发送邮件的邮件服务器 :param password: 发送用户的密码 :param from_user: 发送邮件的用户邮箱 :param to_user... | Implement the Python class `EmailUtil` described below.
Class description:
Implement the EmailUtil class.
Method signatures and docstrings:
- def __init__(self, server_host, password, from_user, to_user_list): 初始化发送邮件设置 :param server_host: 发送邮件的邮件服务器 :param password: 发送用户的密码 :param from_user: 发送邮件的用户邮箱 :param to_user... | ed360d5aa7f733991fbbc8ab5af96e739c9e1142 | <|skeleton|>
class EmailUtil:
def __init__(self, server_host, password, from_user, to_user_list):
"""初始化发送邮件设置 :param server_host: 发送邮件的邮件服务器 :param password: 发送用户的密码 :param from_user: 发送邮件的用户邮箱 :param to_user_list: 接收邮件的用户邮箱列表"""
<|body_0|>
def _init_server(self):
"""邮件服务器初始化 :return:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EmailUtil:
def __init__(self, server_host, password, from_user, to_user_list):
"""初始化发送邮件设置 :param server_host: 发送邮件的邮件服务器 :param password: 发送用户的密码 :param from_user: 发送邮件的用户邮箱 :param to_user_list: 接收邮件的用户邮箱列表"""
self.server_host = server_host
self.password = password
self.from_... | the_stack_v2_python_sparse | automated_testing/requests_unittest_test/app/utils/EmailUtil.py | tzytammy/requests_unittest | train | 0 | |
1640622a489340843f4827919070f29659505d58 | [
"session = encryption.gethash(useful.dateToBytes())\nSessions.sessions.append((session, time.time() + duration))\nreturn session",
"result = False\nif session != None:\n for sessionId, expiration in Sessions.sessions:\n if sessionId == session:\n result = True\n break\nSessions.pur... | <|body_start_0|>
session = encryption.gethash(useful.dateToBytes())
Sessions.sessions.append((session, time.time() + duration))
return session
<|end_body_0|>
<|body_start_1|>
result = False
if session != None:
for sessionId, expiration in Sessions.sessions:
... | Class manage an http sessions | Sessions | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Sessions:
"""Class manage an http sessions"""
def create(duration):
"""Create new session"""
<|body_0|>
def check(session):
"""Check if the session not expired"""
<|body_1|>
def purge():
"""Purge older sessions (only expired)"""
<|bod... | stack_v2_sparse_classes_36k_train_034134 | 1,221 | permissive | [
{
"docstring": "Create new session",
"name": "create",
"signature": "def create(duration)"
},
{
"docstring": "Check if the session not expired",
"name": "check",
"signature": "def check(session)"
},
{
"docstring": "Purge older sessions (only expired)",
"name": "purge",
"s... | 4 | null | Implement the Python class `Sessions` described below.
Class description:
Class manage an http sessions
Method signatures and docstrings:
- def create(duration): Create new session
- def check(session): Check if the session not expired
- def purge(): Purge older sessions (only expired)
- def remove(sessionIdRemove): ... | Implement the Python class `Sessions` described below.
Class description:
Class manage an http sessions
Method signatures and docstrings:
- def create(duration): Create new session
- def check(session): Check if the session not expired
- def purge(): Purge older sessions (only expired)
- def remove(sessionIdRemove): ... | d86814625a7cd2f7e5fa01b8e1652efc811cef3a | <|skeleton|>
class Sessions:
"""Class manage an http sessions"""
def create(duration):
"""Create new session"""
<|body_0|>
def check(session):
"""Check if the session not expired"""
<|body_1|>
def purge():
"""Purge older sessions (only expired)"""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Sessions:
"""Class manage an http sessions"""
def create(duration):
"""Create new session"""
session = encryption.gethash(useful.dateToBytes())
Sessions.sessions.append((session, time.time() + duration))
return session
def check(session):
"""Check if the sessi... | the_stack_v2_python_sparse | modules/lib/server/sessions.py | antiquefu/pycameresp | train | 0 |
de7ca0271279d337d81584ddd0b811ddfdea1329 | [
"super(MultiHeadedAttention, self).__init__()\nassert embed_dim % num_heads == 0, f'num_heads={num_heads} should evenly divide embed_dim={embed_dim}'\nself.embed_dim = embed_dim\nself.num_heads = num_heads\nself.projection_dim = embed_dim // num_heads\nself.scale = self.projection_dim ** (-0.5)\nself.input_weights ... | <|body_start_0|>
super(MultiHeadedAttention, self).__init__()
assert embed_dim % num_heads == 0, f'num_heads={num_heads} should evenly divide embed_dim={embed_dim}'
self.embed_dim = embed_dim
self.num_heads = num_heads
self.projection_dim = embed_dim // num_heads
self.sca... | Implement a multi-headed attention module | MultiHeadedAttention | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiHeadedAttention:
"""Implement a multi-headed attention module"""
def __init__(self, embed_dim, num_heads=1):
"""Initialize the attention module"""
<|body_0|>
def reset_parameters(self):
"""Reset parameters using xavier initialization"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_034135 | 4,764 | permissive | [
{
"docstring": "Initialize the attention module",
"name": "__init__",
"signature": "def __init__(self, embed_dim, num_heads=1)"
},
{
"docstring": "Reset parameters using xavier initialization",
"name": "reset_parameters",
"signature": "def reset_parameters(self)"
},
{
"docstring"... | 5 | stack_v2_sparse_classes_30k_val_000367 | Implement the Python class `MultiHeadedAttention` described below.
Class description:
Implement a multi-headed attention module
Method signatures and docstrings:
- def __init__(self, embed_dim, num_heads=1): Initialize the attention module
- def reset_parameters(self): Reset parameters using xavier initialization
- d... | Implement the Python class `MultiHeadedAttention` described below.
Class description:
Implement a multi-headed attention module
Method signatures and docstrings:
- def __init__(self, embed_dim, num_heads=1): Initialize the attention module
- def reset_parameters(self): Reset parameters using xavier initialization
- d... | 0fa4adffa825af4a62b6e739b59c4125a7b6698e | <|skeleton|>
class MultiHeadedAttention:
"""Implement a multi-headed attention module"""
def __init__(self, embed_dim, num_heads=1):
"""Initialize the attention module"""
<|body_0|>
def reset_parameters(self):
"""Reset parameters using xavier initialization"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultiHeadedAttention:
"""Implement a multi-headed attention module"""
def __init__(self, embed_dim, num_heads=1):
"""Initialize the attention module"""
super(MultiHeadedAttention, self).__init__()
assert embed_dim % num_heads == 0, f'num_heads={num_heads} should evenly divide embe... | the_stack_v2_python_sparse | models/probe_attention.py | fallcat/synst | train | 1 |
b46a84277a6d9518a138f81436506fdb86067d43 | [
"self.birdstatus = [pygame.image.load('bird/4.png'), pygame.image.load('bird/5.png'), pygame.image.load('bird/6.png'), pygame.image.load('bird/7.png'), pygame.image.load('bird/8.png'), pygame.image.load('bird/9.png')]\nself.dead = False\nself.status = 0\nself.birdX = 180\nself.birdY = 300\nself.jump = False\nself.j... | <|body_start_0|>
self.birdstatus = [pygame.image.load('bird/4.png'), pygame.image.load('bird/5.png'), pygame.image.load('bird/6.png'), pygame.image.load('bird/7.png'), pygame.image.load('bird/8.png'), pygame.image.load('bird/9.png')]
self.dead = False
self.status = 0
self.birdX = 180
... | 定义一个小鸟类 | Bird | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Bird:
"""定义一个小鸟类"""
def __init__(self):
"""定义小鸟类初始化方法"""
<|body_0|>
def birdUpdate(self):
"""定义移动方法"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.birdstatus = [pygame.image.load('bird/4.png'), pygame.image.load('bird/5.png'), pygame.image... | stack_v2_sparse_classes_36k_train_034136 | 7,811 | no_license | [
{
"docstring": "定义小鸟类初始化方法",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "定义移动方法",
"name": "birdUpdate",
"signature": "def birdUpdate(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006621 | Implement the Python class `Bird` described below.
Class description:
定义一个小鸟类
Method signatures and docstrings:
- def __init__(self): 定义小鸟类初始化方法
- def birdUpdate(self): 定义移动方法 | Implement the Python class `Bird` described below.
Class description:
定义一个小鸟类
Method signatures and docstrings:
- def __init__(self): 定义小鸟类初始化方法
- def birdUpdate(self): 定义移动方法
<|skeleton|>
class Bird:
"""定义一个小鸟类"""
def __init__(self):
"""定义小鸟类初始化方法"""
<|body_0|>
def birdUpdate(self):
... | b2bf7ac34ccbb1e37a63109049607408f5487e8b | <|skeleton|>
class Bird:
"""定义一个小鸟类"""
def __init__(self):
"""定义小鸟类初始化方法"""
<|body_0|>
def birdUpdate(self):
"""定义移动方法"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Bird:
"""定义一个小鸟类"""
def __init__(self):
"""定义小鸟类初始化方法"""
self.birdstatus = [pygame.image.load('bird/4.png'), pygame.image.load('bird/5.png'), pygame.image.load('bird/6.png'), pygame.image.load('bird/7.png'), pygame.image.load('bird/8.png'), pygame.image.load('bird/9.png')]
self.de... | the_stack_v2_python_sparse | Python-2D游戏/pygame游戏开发.py | kyon1920/Python | train | 0 |
58953c5910dee224e691f3be8b79716d30d77171 | [
"def dfs(nd):\n if nd:\n s.add(nd.val)\n dfs(nd.left)\n dfs(nd.right)\ns = set()\ndfs(root)\nret = float('inf')\nfor v in s:\n if v > root.val and v < ret:\n ret = v\nif ret < float('inf'):\n return ret\nelse:\n return -1",
"self.ret = float('inf')\n\ndef dfs(nd):\n if n... | <|body_start_0|>
def dfs(nd):
if nd:
s.add(nd.val)
dfs(nd.left)
dfs(nd.right)
s = set()
dfs(root)
ret = float('inf')
for v in s:
if v > root.val and v < ret:
ret = v
if ret < float('in... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findSecondMinimumValue1(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def findSecondMinimumValue2(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def dfs(nd):
... | stack_v2_sparse_classes_36k_train_034137 | 1,646 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "findSecondMinimumValue1",
"signature": "def findSecondMinimumValue1(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "findSecondMinimumValue2",
"signature": "def findSecondMinimumValue2(self, root)"
}... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findSecondMinimumValue1(self, root): :type root: TreeNode :rtype: int
- def findSecondMinimumValue2(self, root): :type root: TreeNode :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findSecondMinimumValue1(self, root): :type root: TreeNode :rtype: int
- def findSecondMinimumValue2(self, root): :type root: TreeNode :rtype: int
<|skeleton|>
class Solution... | d3e8669f932fc2e22711e8b7590d3365d020e189 | <|skeleton|>
class Solution:
def findSecondMinimumValue1(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def findSecondMinimumValue2(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findSecondMinimumValue1(self, root):
""":type root: TreeNode :rtype: int"""
def dfs(nd):
if nd:
s.add(nd.val)
dfs(nd.left)
dfs(nd.right)
s = set()
dfs(root)
ret = float('inf')
for v in s:
... | the_stack_v2_python_sparse | leetcode/671.py | liuweilin17/algorithm | train | 3 | |
1bebf5d0ceac2ebb9379f272ee52d5b9dac018d6 | [
"key = LibraryLocatorV2.from_string(lib_key_str)\napi.require_permission_for_library_key(key, request.user, permissions.CAN_EDIT_THIS_CONTENT_LIBRARY)\napi.publish_changes(key)\nreturn Response({})",
"key = LibraryLocatorV2.from_string(lib_key_str)\napi.require_permission_for_library_key(key, request.user, permis... | <|body_start_0|>
key = LibraryLocatorV2.from_string(lib_key_str)
api.require_permission_for_library_key(key, request.user, permissions.CAN_EDIT_THIS_CONTENT_LIBRARY)
api.publish_changes(key)
return Response({})
<|end_body_0|>
<|body_start_1|>
key = LibraryLocatorV2.from_string(l... | Commit/publish or revert all of the draft changes made to the library. | LibraryCommitView | [
"AGPL-3.0-only",
"AGPL-3.0-or-later",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LibraryCommitView:
"""Commit/publish or revert all of the draft changes made to the library."""
def post(self, request, lib_key_str):
"""Commit the draft changes made to the specified block and its descendants."""
<|body_0|>
def delete(self, request, lib_key_str):
... | stack_v2_sparse_classes_36k_train_034138 | 42,120 | permissive | [
{
"docstring": "Commit the draft changes made to the specified block and its descendants.",
"name": "post",
"signature": "def post(self, request, lib_key_str)"
},
{
"docstring": "Revert the draft changes made to the specified block and its descendants. Restore it to the last published version",
... | 2 | null | Implement the Python class `LibraryCommitView` described below.
Class description:
Commit/publish or revert all of the draft changes made to the library.
Method signatures and docstrings:
- def post(self, request, lib_key_str): Commit the draft changes made to the specified block and its descendants.
- def delete(sel... | Implement the Python class `LibraryCommitView` described below.
Class description:
Commit/publish or revert all of the draft changes made to the library.
Method signatures and docstrings:
- def post(self, request, lib_key_str): Commit the draft changes made to the specified block and its descendants.
- def delete(sel... | 5809eaca7079a15ee56b0b7fcfea425337046c97 | <|skeleton|>
class LibraryCommitView:
"""Commit/publish or revert all of the draft changes made to the library."""
def post(self, request, lib_key_str):
"""Commit the draft changes made to the specified block and its descendants."""
<|body_0|>
def delete(self, request, lib_key_str):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LibraryCommitView:
"""Commit/publish or revert all of the draft changes made to the library."""
def post(self, request, lib_key_str):
"""Commit the draft changes made to the specified block and its descendants."""
key = LibraryLocatorV2.from_string(lib_key_str)
api.require_permiss... | the_stack_v2_python_sparse | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/content_libraries/views.py | luque/better-ways-of-thinking-about-software | train | 3 |
bea53f239bec18e6712a642e62da2a2be538149a | [
"for font in fonts:\n if font not in cls._fonts:\n cls._fonts[font] = _Font()\n cls._fonts[font].replace(cls._create_font(fonts[font], 16))\nif not cls._fonts['widget']:\n cls._fonts['widget'].replace(cls._create_font('Arial', 16))\nif not cls._fonts['title']:\n name = fonts['widget'] if 'widget'... | <|body_start_0|>
for font in fonts:
if font not in cls._fonts:
cls._fonts[font] = _Font()
cls._fonts[font].replace(cls._create_font(fonts[font], 16))
if not cls._fonts['widget']:
cls._fonts['widget'].replace(cls._create_font('Arial', 16))
if no... | Class containing fonts available for use. Index class to get fonts, such as ``Font["widget"]`` for the widget font. The default fonts are: widget: The default font for widgets. title: A larger title font. mono: A monospaced font. Attributes: col: (r,g,b) tuple, containing the default font colour. | Font | [
"MIT",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Font:
"""Class containing fonts available for use. Index class to get fonts, such as ``Font["widget"]`` for the widget font. The default fonts are: widget: The default font for widgets. title: A larger title font. mono: A monospaced font. Attributes: col: (r,g,b) tuple, containing the default fon... | stack_v2_sparse_classes_36k_train_034139 | 13,593 | permissive | [
{
"docstring": "Set fonts to a specific font. If a font exists, it will be replaced, otherwise it will be newly created. Args: fonts: Dictionary containing fonts to use. Key should be name of font. Value should be string naming either custom FreeType or a system font.",
"name": "set_fonts",
"signature":... | 2 | stack_v2_sparse_classes_30k_train_004753 | Implement the Python class `Font` described below.
Class description:
Class containing fonts available for use. Index class to get fonts, such as ``Font["widget"]`` for the widget font. The default fonts are: widget: The default font for widgets. title: A larger title font. mono: A monospaced font. Attributes: col: (r... | Implement the Python class `Font` described below.
Class description:
Class containing fonts available for use. Index class to get fonts, such as ``Font["widget"]`` for the widget font. The default fonts are: widget: The default font for widgets. title: A larger title font. mono: A monospaced font. Attributes: col: (r... | 95cb53b664f312e0830f010c0c96be94d4a4db90 | <|skeleton|>
class Font:
"""Class containing fonts available for use. Index class to get fonts, such as ``Font["widget"]`` for the widget font. The default fonts are: widget: The default font for widgets. title: A larger title font. mono: A monospaced font. Attributes: col: (r,g,b) tuple, containing the default fon... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Font:
"""Class containing fonts available for use. Index class to get fonts, such as ``Font["widget"]`` for the widget font. The default fonts are: widget: The default font for widgets. title: A larger title font. mono: A monospaced font. Attributes: col: (r,g,b) tuple, containing the default font colour."""
... | the_stack_v2_python_sparse | pygame/GUI- widgets-SGC/sgc3/widgets/_locals.py | furas/python-examples | train | 176 |
7e44100e3ff51508276211a950ac239aec5e3d04 | [
"if not check_auth(self, EMAILS_AUTH_SECRET):\n return send_response(self, 403, 'Access denied')\nemail_addr = urllib.unquote(email)\nif not re.match(EMAIL_REGEX, email_addr):\n return send_response(self, 401, 'Invalid request: invalid email')\nemail_key = ndb.Key(EmailEntry, email_addr)\nemail_entry = email_... | <|body_start_0|>
if not check_auth(self, EMAILS_AUTH_SECRET):
return send_response(self, 403, 'Access denied')
email_addr = urllib.unquote(email)
if not re.match(EMAIL_REGEX, email_addr):
return send_response(self, 401, 'Invalid request: invalid email')
email_key ... | ProvisionHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProvisionHandler:
def post(self, email):
"""Store a private key for a user. Takes a string under 'private_key' (encrypted with the user's password), stores it as base64, and deletes the password."""
<|body_0|>
def get(self, email):
"""Get back the encrypted private k... | stack_v2_sparse_classes_36k_train_034140 | 10,196 | permissive | [
{
"docstring": "Store a private key for a user. Takes a string under 'private_key' (encrypted with the user's password), stores it as base64, and deletes the password.",
"name": "post",
"signature": "def post(self, email)"
},
{
"docstring": "Get back the encrypted private key for the user. Retur... | 2 | stack_v2_sparse_classes_30k_test_001019 | Implement the Python class `ProvisionHandler` described below.
Class description:
Implement the ProvisionHandler class.
Method signatures and docstrings:
- def post(self, email): Store a private key for a user. Takes a string under 'private_key' (encrypted with the user's password), stores it as base64, and deletes t... | Implement the Python class `ProvisionHandler` described below.
Class description:
Implement the ProvisionHandler class.
Method signatures and docstrings:
- def post(self, email): Store a private key for a user. Takes a string under 'private_key' (encrypted with the user's password), stores it as base64, and deletes t... | ae898e9fdc6d04d5e4432a986ff5ece7ac4b8061 | <|skeleton|>
class ProvisionHandler:
def post(self, email):
"""Store a private key for a user. Takes a string under 'private_key' (encrypted with the user's password), stores it as base64, and deletes the password."""
<|body_0|>
def get(self, email):
"""Get back the encrypted private k... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProvisionHandler:
def post(self, email):
"""Store a private key for a user. Takes a string under 'private_key' (encrypted with the user's password), stores it as base64, and deletes the password."""
if not check_auth(self, EMAILS_AUTH_SECRET):
return send_response(self, 403, 'Acces... | the_stack_v2_python_sparse | demo/registrar/syndicate_signup.py | syndicate-storage/syndicate-core | train | 6 | |
e5058bcc8f73be55ae3b214074f9ec3cf7efe804 | [
"if len(filename) == 0:\n raise ValueError('Filename of package or module is empty')\nextension = os.path.splitext(filename)[1]\nif len(extension) > 0 and extension != '.py':\n raise ValueError(\"Filename must point to a valid Python file with the extension '.py' or a directory\")\ndirectory, filename = os.pa... | <|body_start_0|>
if len(filename) == 0:
raise ValueError('Filename of package or module is empty')
extension = os.path.splitext(filename)[1]
if len(extension) > 0 and extension != '.py':
raise ValueError("Filename must point to a valid Python file with the extension '.py'... | WhitelistGenerator | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WhitelistGenerator:
def getPackageName(self, filename):
"""Convert filename to Python package/module name. Arguments: filename -- Filename of package/module to generate name of. Note that this must be *relative* to the *root* of the project."""
<|body_0|>
def generate(self, ... | stack_v2_sparse_classes_36k_train_034141 | 5,688 | permissive | [
{
"docstring": "Convert filename to Python package/module name. Arguments: filename -- Filename of package/module to generate name of. Note that this must be *relative* to the *root* of the project.",
"name": "getPackageName",
"signature": "def getPackageName(self, filename)"
},
{
"docstring": "... | 2 | stack_v2_sparse_classes_30k_train_007269 | Implement the Python class `WhitelistGenerator` described below.
Class description:
Implement the WhitelistGenerator class.
Method signatures and docstrings:
- def getPackageName(self, filename): Convert filename to Python package/module name. Arguments: filename -- Filename of package/module to generate name of. Not... | Implement the Python class `WhitelistGenerator` described below.
Class description:
Implement the WhitelistGenerator class.
Method signatures and docstrings:
- def getPackageName(self, filename): Convert filename to Python package/module name. Arguments: filename -- Filename of package/module to generate name of. Not... | 0c4a1bddf3901340f44c28501ff677f2e9caef70 | <|skeleton|>
class WhitelistGenerator:
def getPackageName(self, filename):
"""Convert filename to Python package/module name. Arguments: filename -- Filename of package/module to generate name of. Note that this must be *relative* to the *root* of the project."""
<|body_0|>
def generate(self, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WhitelistGenerator:
def getPackageName(self, filename):
"""Convert filename to Python package/module name. Arguments: filename -- Filename of package/module to generate name of. Note that this must be *relative* to the *root* of the project."""
if len(filename) == 0:
raise ValueErr... | the_stack_v2_python_sparse | moduledependency/whitelist.py | DonaldWhyte/module-dependency | train | 5 | |
385d3cf9d5d1dd91ad4110eab40841a87aa3930c | [
"file_ = g.db.query(File).filter(File.id == id_).first()\ndata_dir = get_path('data')\ncache_timeout = 0 if g.debug else None\nif file_ is None:\n raise NotFound('No file exists with id={}'.format(id_))\nif file_.mime == 'application/zip':\n return send_from_directory(data_dir, file_.relpath(), mimetype=file_... | <|body_start_0|>
file_ = g.db.query(File).filter(File.id == id_).first()
data_dir = get_path('data')
cache_timeout = 0 if g.debug else None
if file_ is None:
raise NotFound('No file exists with id={}'.format(id_))
if file_.mime == 'application/zip':
return... | Manipulate files. | FileView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileView:
"""Manipulate files."""
def get(self, id_):
"""Get a file identified by ``id_``. :status 200: ok :status 401: authentication required :status 404: no file with that ID"""
<|body_0|>
def delete(self, id_):
"""Delete file identified by `id_`."""
<... | stack_v2_sparse_classes_36k_train_034142 | 2,365 | no_license | [
{
"docstring": "Get a file identified by ``id_``. :status 200: ok :status 401: authentication required :status 404: no file with that ID",
"name": "get",
"signature": "def get(self, id_)"
},
{
"docstring": "Delete file identified by `id_`.",
"name": "delete",
"signature": "def delete(sel... | 2 | stack_v2_sparse_classes_30k_train_009283 | Implement the Python class `FileView` described below.
Class description:
Manipulate files.
Method signatures and docstrings:
- def get(self, id_): Get a file identified by ``id_``. :status 200: ok :status 401: authentication required :status 404: no file with that ID
- def delete(self, id_): Delete file identified b... | Implement the Python class `FileView` described below.
Class description:
Manipulate files.
Method signatures and docstrings:
- def get(self, id_): Get a file identified by ``id_``. :status 200: ok :status 401: authentication required :status 404: no file with that ID
- def delete(self, id_): Delete file identified b... | 449630ebcacc1f7cb15c435152842b206cc1e8a3 | <|skeleton|>
class FileView:
"""Manipulate files."""
def get(self, id_):
"""Get a file identified by ``id_``. :status 200: ok :status 401: authentication required :status 404: no file with that ID"""
<|body_0|>
def delete(self, id_):
"""Delete file identified by `id_`."""
<... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FileView:
"""Manipulate files."""
def get(self, id_):
"""Get a file identified by ``id_``. :status 200: ok :status 401: authentication required :status 404: no file with that ID"""
file_ = g.db.query(File).filter(File.id == id_).first()
data_dir = get_path('data')
cache_ti... | the_stack_v2_python_sparse | lib/app/views/file.py | jaisanas/hgprofiler | train | 1 |
8680b6fcfc4989d7dc785e1e04da19704f09798f | [
"moveCnt = 0\nk = len(nums) - 1\nwhile k >= 0:\n if nums[k] == 0:\n nums.pop(k)\n nums.append(0)\n moveCnt = moveCnt + 1\n k = k - 1\nprint('Totally, {0} moves'.format(moveCnt))",
"moveEnable = False\nmoveCnt = 0\nk = len(nums) - 1\nwhile k >= 0:\n if nums[k] != 0:\n moveEnabl... | <|body_start_0|>
moveCnt = 0
k = len(nums) - 1
while k >= 0:
if nums[k] == 0:
nums.pop(k)
nums.append(0)
moveCnt = moveCnt + 1
k = k - 1
print('Totally, {0} moves'.format(moveCnt))
<|end_body_0|>
<|body_start_1|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def moveZeroes(self, nums) -> None:
"""Do not return anything, modify nums in-place instead. NOTE: This solution is inefficient, in the sense that the move for the trailing zeros should be skipped."""
<|body_0|>
def moveZeroesRefined(self, nums) -> None:
""... | stack_v2_sparse_classes_36k_train_034143 | 2,031 | no_license | [
{
"docstring": "Do not return anything, modify nums in-place instead. NOTE: This solution is inefficient, in the sense that the move for the trailing zeros should be skipped.",
"name": "moveZeroes",
"signature": "def moveZeroes(self, nums) -> None"
},
{
"docstring": "Do not return anything, modi... | 2 | stack_v2_sparse_classes_30k_train_009680 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def moveZeroes(self, nums) -> None: Do not return anything, modify nums in-place instead. NOTE: This solution is inefficient, in the sense that the move for the trailing zeros sh... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def moveZeroes(self, nums) -> None: Do not return anything, modify nums in-place instead. NOTE: This solution is inefficient, in the sense that the move for the trailing zeros sh... | 1007197ff0feda35001c0aaf13382af6869869b2 | <|skeleton|>
class Solution:
def moveZeroes(self, nums) -> None:
"""Do not return anything, modify nums in-place instead. NOTE: This solution is inefficient, in the sense that the move for the trailing zeros should be skipped."""
<|body_0|>
def moveZeroesRefined(self, nums) -> None:
""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def moveZeroes(self, nums) -> None:
"""Do not return anything, modify nums in-place instead. NOTE: This solution is inefficient, in the sense that the move for the trailing zeros should be skipped."""
moveCnt = 0
k = len(nums) - 1
while k >= 0:
if nums[k] ... | the_stack_v2_python_sparse | array-and-string/moveZeroes.py | chenxy3791/leetcode | train | 0 | |
91eed0080f5cca573d230e119b5e17439170e4ff | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Proto file describing the Customer service. Service to manage customers. | CustomerServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CustomerServiceServicer:
"""Proto file describing the Customer service. Service to manage customers."""
def GetCustomer(self, request, context):
"""Returns the requested customer in full detail."""
<|body_0|>
def MutateCustomer(self, request, context):
"""Updates... | stack_v2_sparse_classes_36k_train_034144 | 9,513 | permissive | [
{
"docstring": "Returns the requested customer in full detail.",
"name": "GetCustomer",
"signature": "def GetCustomer(self, request, context)"
},
{
"docstring": "Updates a customer. Operation statuses are returned.",
"name": "MutateCustomer",
"signature": "def MutateCustomer(self, reques... | 4 | stack_v2_sparse_classes_30k_train_001436 | Implement the Python class `CustomerServiceServicer` described below.
Class description:
Proto file describing the Customer service. Service to manage customers.
Method signatures and docstrings:
- def GetCustomer(self, request, context): Returns the requested customer in full detail.
- def MutateCustomer(self, reque... | Implement the Python class `CustomerServiceServicer` described below.
Class description:
Proto file describing the Customer service. Service to manage customers.
Method signatures and docstrings:
- def GetCustomer(self, request, context): Returns the requested customer in full detail.
- def MutateCustomer(self, reque... | 969eff5b6c3cec59d21191fa178cffb6270074c3 | <|skeleton|>
class CustomerServiceServicer:
"""Proto file describing the Customer service. Service to manage customers."""
def GetCustomer(self, request, context):
"""Returns the requested customer in full detail."""
<|body_0|>
def MutateCustomer(self, request, context):
"""Updates... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CustomerServiceServicer:
"""Proto file describing the Customer service. Service to manage customers."""
def GetCustomer(self, request, context):
"""Returns the requested customer in full detail."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not imp... | the_stack_v2_python_sparse | google/ads/google_ads/v6/proto/services/customer_service_pb2_grpc.py | VincentFritzsche/google-ads-python | train | 0 |
7fbe69881af241448c7d33658d310a283fc0da69 | [
"with Session() as lib:\n table_context = lib.virtualfile_from_data(check_kind='vector', data=data, x=x, y=y, z=z, required_z=False)\n with table_context as infile:\n if (outgrid := kwargs.get('G')) is None:\n kwargs.update({'>': outfile})\n lib.call_module(module='triangulate', args=... | <|body_start_0|>
with Session() as lib:
table_context = lib.virtualfile_from_data(check_kind='vector', data=data, x=x, y=y, z=z, required_z=False)
with table_context as infile:
if (outgrid := kwargs.get('G')) is None:
kwargs.update({'>': outfile})
... | Delaunay triangulation or Voronoi partitioning and gridding of Cartesian data. Triangulate reads in x,y[,z] data and performs Delaunay triangulation, i.e., it finds how the points should be connected to give the most equilateral triangulation possible. If a map projection (give ``region`` and ``projection``) is chosen ... | triangulate | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class triangulate:
"""Delaunay triangulation or Voronoi partitioning and gridding of Cartesian data. Triangulate reads in x,y[,z] data and performs Delaunay triangulation, i.e., it finds how the points should be connected to give the most equilateral triangulation possible. If a map projection (give ``... | stack_v2_sparse_classes_36k_train_034145 | 14,373 | permissive | [
{
"docstring": "Delaunay triangulation or Voronoi partitioning and gridding of Cartesian data. Must provide ``outfile`` or ``outgrid``. Full option list at :gmt-docs:`triangulate.html` {aliases} Parameters ---------- x/y/z : np.ndarray Arrays of x and y coordinates and values z of the data points. data : str or... | 3 | stack_v2_sparse_classes_30k_train_003903 | Implement the Python class `triangulate` described below.
Class description:
Delaunay triangulation or Voronoi partitioning and gridding of Cartesian data. Triangulate reads in x,y[,z] data and performs Delaunay triangulation, i.e., it finds how the points should be connected to give the most equilateral triangulation... | Implement the Python class `triangulate` described below.
Class description:
Delaunay triangulation or Voronoi partitioning and gridding of Cartesian data. Triangulate reads in x,y[,z] data and performs Delaunay triangulation, i.e., it finds how the points should be connected to give the most equilateral triangulation... | e4ee800e8045aa5f94ddaf7ad821421d007ab279 | <|skeleton|>
class triangulate:
"""Delaunay triangulation or Voronoi partitioning and gridding of Cartesian data. Triangulate reads in x,y[,z] data and performs Delaunay triangulation, i.e., it finds how the points should be connected to give the most equilateral triangulation possible. If a map projection (give ``... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class triangulate:
"""Delaunay triangulation or Voronoi partitioning and gridding of Cartesian data. Triangulate reads in x,y[,z] data and performs Delaunay triangulation, i.e., it finds how the points should be connected to give the most equilateral triangulation possible. If a map projection (give ``region`` and ... | the_stack_v2_python_sparse | pygmt/src/triangulate.py | GenericMappingTools/pygmt | train | 490 |
a7b47a5a44788ad09de86c3227d85f8ec52e2ce8 | [
"lexer_choices = [(lex[0], lex[0]) for lex in get_all_lexers()]\nwidgets = (TextInput(attrs=attrs), Select(attrs=attrs, choices=lexer_choices))\nsuper(LexersMappingWidget, self).__init__(widgets, attrs)",
"if value:\n return list(value)\nreturn [None, None]",
"key_lexer = [widget.value_from_datadict(data, fi... | <|body_start_0|>
lexer_choices = [(lex[0], lex[0]) for lex in get_all_lexers()]
widgets = (TextInput(attrs=attrs), Select(attrs=attrs, choices=lexer_choices))
super(LexersMappingWidget, self).__init__(widgets, attrs)
<|end_body_0|>
<|body_start_1|>
if value:
return list(valu... | A form widget for mapping a string to a Pygments Lexer class. This widget displays a text input with a drop-down list of Pygments Lexer names next to it. Version Added: 5.0 | LexersMappingWidget | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LexersMappingWidget:
"""A form widget for mapping a string to a Pygments Lexer class. This widget displays a text input with a drop-down list of Pygments Lexer names next to it. Version Added: 5.0"""
def __init__(self, attrs=None):
"""Initialize the LexersMappingWidget. Args: attrs (... | stack_v2_sparse_classes_36k_train_034146 | 16,804 | permissive | [
{
"docstring": "Initialize the LexersMappingWidget. Args: attrs (dict, optional): A dictionary containing HTML attributes to be set on the rendered widget.",
"name": "__init__",
"signature": "def __init__(self, attrs=None)"
},
{
"docstring": "Decompress the value into a list of values for each w... | 3 | stack_v2_sparse_classes_30k_train_021206 | Implement the Python class `LexersMappingWidget` described below.
Class description:
A form widget for mapping a string to a Pygments Lexer class. This widget displays a text input with a drop-down list of Pygments Lexer names next to it. Version Added: 5.0
Method signatures and docstrings:
- def __init__(self, attrs... | Implement the Python class `LexersMappingWidget` described below.
Class description:
A form widget for mapping a string to a Pygments Lexer class. This widget displays a text input with a drop-down list of Pygments Lexer names next to it. Version Added: 5.0
Method signatures and docstrings:
- def __init__(self, attrs... | c3a991f1e9d7682239a1ab0e8661cee6da01d537 | <|skeleton|>
class LexersMappingWidget:
"""A form widget for mapping a string to a Pygments Lexer class. This widget displays a text input with a drop-down list of Pygments Lexer names next to it. Version Added: 5.0"""
def __init__(self, attrs=None):
"""Initialize the LexersMappingWidget. Args: attrs (... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LexersMappingWidget:
"""A form widget for mapping a string to a Pygments Lexer class. This widget displays a text input with a drop-down list of Pygments Lexer names next to it. Version Added: 5.0"""
def __init__(self, attrs=None):
"""Initialize the LexersMappingWidget. Args: attrs (dict, optiona... | the_stack_v2_python_sparse | reviewboard/admin/form_widgets.py | reviewboard/reviewboard | train | 1,141 |
3823ba7e4e5dd3cebbb0c86c4be674cfdbd4cc70 | [
"if location is None:\n self.location = [0, 0]\nelse:\n self.location = double_gis_util.validate_location(location)\nself.radius = int(radius)\nself.popup = popup.replace(\"'\", '^') if isinstance(popup, str) else popup\nself.tooltip = tooltip.replace(\"'\", '^') if isinstance(tooltip, str) else tooltip\nself... | <|body_start_0|>
if location is None:
self.location = [0, 0]
else:
self.location = double_gis_util.validate_location(location)
self.radius = int(radius)
self.popup = popup.replace("'", '^') if isinstance(popup, str) else popup
self.tooltip = tooltip.replac... | Circle marker. | iq2GISCircleMarker | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class iq2GISCircleMarker:
"""Circle marker."""
def __init__(self, location, radius=10, popup=None, tooltip=None, color='blue', fill=True, fill_color='blue', **kwargs):
"""Constructor. :param location: Marker geolocation. :param radius: Marker circle radius. :param color: Circle color. :par... | stack_v2_sparse_classes_36k_train_034147 | 2,846 | no_license | [
{
"docstring": "Constructor. :param location: Marker geolocation. :param radius: Marker circle radius. :param color: Circle color. :param fill: Fill the inner area of the circle? :param fill_color: The fill color of the circle. :param popup: Marker pop-up text. A tooltip appears by clicking on the marker. :para... | 3 | stack_v2_sparse_classes_30k_train_011630 | Implement the Python class `iq2GISCircleMarker` described below.
Class description:
Circle marker.
Method signatures and docstrings:
- def __init__(self, location, radius=10, popup=None, tooltip=None, color='blue', fill=True, fill_color='blue', **kwargs): Constructor. :param location: Marker geolocation. :param radiu... | Implement the Python class `iq2GISCircleMarker` described below.
Class description:
Circle marker.
Method signatures and docstrings:
- def __init__(self, location, radius=10, popup=None, tooltip=None, color='blue', fill=True, fill_color='blue', **kwargs): Constructor. :param location: Marker geolocation. :param radiu... | 7550e242746cb2fb1219474463f8db21f8e3e114 | <|skeleton|>
class iq2GISCircleMarker:
"""Circle marker."""
def __init__(self, location, radius=10, popup=None, tooltip=None, color='blue', fill=True, fill_color='blue', **kwargs):
"""Constructor. :param location: Marker geolocation. :param radius: Marker circle radius. :param color: Circle color. :par... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class iq2GISCircleMarker:
"""Circle marker."""
def __init__(self, location, radius=10, popup=None, tooltip=None, color='blue', fill=True, fill_color='blue', **kwargs):
"""Constructor. :param location: Marker geolocation. :param radius: Marker circle radius. :param color: Circle color. :param fill: Fill... | the_stack_v2_python_sparse | iq/components/doublegis_indicator_manager/circle_marker.py | XHermitOne/iq_framework | train | 1 |
52e81c650b9a5848e3c2ceec13fe09aac81b9a81 | [
"self.de_key = b'C8lNZN4pa1mwMKkgAxqwZGSIw3SVFmQPxtLbqBMvn9Y='\nself.endecrypt = SimpleEnDecrypt(self.de_key)\ntry:\n self.con = sqlite3.connect('./auto_trader.db')\n self.cursor = self.con.cursor()\nexcept Exception as e:\n logger.error(f'<ERROR> {e}')\nif access_key and secret_key and slack_tocken_list:\... | <|body_start_0|>
self.de_key = b'C8lNZN4pa1mwMKkgAxqwZGSIw3SVFmQPxtLbqBMvn9Y='
self.endecrypt = SimpleEnDecrypt(self.de_key)
try:
self.con = sqlite3.connect('./auto_trader.db')
self.cursor = self.con.cursor()
except Exception as e:
logger.error(f'<ERRO... | DBEnDecrypt | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DBEnDecrypt:
def __init__(self, access_key=None, secret_key=None, slack_tocken_list=None):
"""DB와 연동하여 access_key, secret_key, slack_token 암호화 및 복호화 - 파라미터가 없는 경우 DB로부터 복호화하여 값 리턴 - 파라미터가 있는 경우 깂을 암호화하여 DB에 저장 Parameters ---------- access_key : str, optional DESCRIPTION. The default is N... | stack_v2_sparse_classes_36k_train_034148 | 9,211 | no_license | [
{
"docstring": "DB와 연동하여 access_key, secret_key, slack_token 암호화 및 복호화 - 파라미터가 없는 경우 DB로부터 복호화하여 값 리턴 - 파라미터가 있는 경우 깂을 암호화하여 DB에 저장 Parameters ---------- access_key : str, optional DESCRIPTION. The default is None. secret_key : tr, optional DESCRIPTION. The default is None. slack_tocken_list : str, optional DES... | 3 | stack_v2_sparse_classes_30k_val_000642 | Implement the Python class `DBEnDecrypt` described below.
Class description:
Implement the DBEnDecrypt class.
Method signatures and docstrings:
- def __init__(self, access_key=None, secret_key=None, slack_tocken_list=None): DB와 연동하여 access_key, secret_key, slack_token 암호화 및 복호화 - 파라미터가 없는 경우 DB로부터 복호화하여 값 리턴 - 파라미터가 ... | Implement the Python class `DBEnDecrypt` described below.
Class description:
Implement the DBEnDecrypt class.
Method signatures and docstrings:
- def __init__(self, access_key=None, secret_key=None, slack_tocken_list=None): DB와 연동하여 access_key, secret_key, slack_token 암호화 및 복호화 - 파라미터가 없는 경우 DB로부터 복호화하여 값 리턴 - 파라미터가 ... | dd4b6fe92547fdfb97a191741bad566464f85cfa | <|skeleton|>
class DBEnDecrypt:
def __init__(self, access_key=None, secret_key=None, slack_tocken_list=None):
"""DB와 연동하여 access_key, secret_key, slack_token 암호화 및 복호화 - 파라미터가 없는 경우 DB로부터 복호화하여 값 리턴 - 파라미터가 있는 경우 깂을 암호화하여 DB에 저장 Parameters ---------- access_key : str, optional DESCRIPTION. The default is N... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DBEnDecrypt:
def __init__(self, access_key=None, secret_key=None, slack_tocken_list=None):
"""DB와 연동하여 access_key, secret_key, slack_token 암호화 및 복호화 - 파라미터가 없는 경우 DB로부터 복호화하여 값 리턴 - 파라미터가 있는 경우 깂을 암호화하여 DB에 저장 Parameters ---------- access_key : str, optional DESCRIPTION. The default is None. secret_ke... | the_stack_v2_python_sparse | src/module/auto_trader/util.py | lucio-karin0506/graduation-project-P407 | train | 1 | |
02147fa3790e806bacbb50431c4ae4eb587cdd51 | [
"if hasattr(cls, '_default_tags'):\n tags = cls._default_tags()\nelse:\n tags = deepcopy(_default_tags)\nfor cl in reversed(inspect.getmro(cls)):\n if hasattr(cl, '_more_static_tags'):\n more_tags = cl._more_static_tags()\n tags.update(more_tags)\nreturn tags",
"if hasattr(self, '_default_t... | <|body_start_0|>
if hasattr(cls, '_default_tags'):
tags = cls._default_tags()
else:
tags = deepcopy(_default_tags)
for cl in reversed(inspect.getmro(cls)):
if hasattr(cl, '_more_static_tags'):
more_tags = cl._more_static_tags()
... | TagsMixin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TagsMixin:
def _get_tags(cls):
"""Method that collects all the static tags associated to any inheritting class. The Base class for cuML's estimators already uses this mixin, so most estimators don't need to use this Mixin directly. - Tags usage: In general, inheriting classes can use the... | stack_v2_sparse_classes_36k_train_034149 | 10,726 | permissive | [
{
"docstring": "Method that collects all the static tags associated to any inheritting class. The Base class for cuML's estimators already uses this mixin, so most estimators don't need to use this Mixin directly. - Tags usage: In general, inheriting classes can use the appropriate Mixins defined in this file. ... | 2 | stack_v2_sparse_classes_30k_train_008551 | Implement the Python class `TagsMixin` described below.
Class description:
Implement the TagsMixin class.
Method signatures and docstrings:
- def _get_tags(cls): Method that collects all the static tags associated to any inheritting class. The Base class for cuML's estimators already uses this mixin, so most estimato... | Implement the Python class `TagsMixin` described below.
Class description:
Implement the TagsMixin class.
Method signatures and docstrings:
- def _get_tags(cls): Method that collects all the static tags associated to any inheritting class. The Base class for cuML's estimators already uses this mixin, so most estimato... | 7d86042b8de06bc8acce632230fe5821bd36c17d | <|skeleton|>
class TagsMixin:
def _get_tags(cls):
"""Method that collects all the static tags associated to any inheritting class. The Base class for cuML's estimators already uses this mixin, so most estimators don't need to use this Mixin directly. - Tags usage: In general, inheriting classes can use the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TagsMixin:
def _get_tags(cls):
"""Method that collects all the static tags associated to any inheritting class. The Base class for cuML's estimators already uses this mixin, so most estimators don't need to use this Mixin directly. - Tags usage: In general, inheriting classes can use the appropriate M... | the_stack_v2_python_sparse | python/cuml/internals/mixins.py | rapidsai/cuml | train | 3,615 | |
415374d0cdf745a0774554af3f2a53b3363202a0 | [
"super(Discriminator, self).__init__()\nassert image_size % 16 == 0, 'image size must be a multiple of 16!'\nself.num_gpu = num_gpu\nself.layer = nn.Sequential()\nself.layer.add_module('init.{}-{}.conv'.format(num_channels, conv_dim), nn.Conv2d(num_channels, conv_dim, 4, 2, 1, bias=False))\nself.layer.add_module('i... | <|body_start_0|>
super(Discriminator, self).__init__()
assert image_size % 16 == 0, 'image size must be a multiple of 16!'
self.num_gpu = num_gpu
self.layer = nn.Sequential()
self.layer.add_module('init.{}-{}.conv'.format(num_channels, conv_dim), nn.Conv2d(num_channels, conv_dim,... | Model for Discriminator. | Discriminator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Discriminator:
"""Model for Discriminator."""
def __init__(self, num_channels, conv_dim, image_size, num_gpu, num_extra_layers, use_BN):
"""Init for Discriminator model."""
<|body_0|>
def forward(self, input):
"""Forward step for Discriminator model."""
<... | stack_v2_sparse_classes_36k_train_034150 | 7,633 | permissive | [
{
"docstring": "Init for Discriminator model.",
"name": "__init__",
"signature": "def __init__(self, num_channels, conv_dim, image_size, num_gpu, num_extra_layers, use_BN)"
},
{
"docstring": "Forward step for Discriminator model.",
"name": "forward",
"signature": "def forward(self, input... | 2 | stack_v2_sparse_classes_30k_train_013203 | Implement the Python class `Discriminator` described below.
Class description:
Model for Discriminator.
Method signatures and docstrings:
- def __init__(self, num_channels, conv_dim, image_size, num_gpu, num_extra_layers, use_BN): Init for Discriminator model.
- def forward(self, input): Forward step for Discriminato... | Implement the Python class `Discriminator` described below.
Class description:
Model for Discriminator.
Method signatures and docstrings:
- def __init__(self, num_channels, conv_dim, image_size, num_gpu, num_extra_layers, use_BN): Init for Discriminator model.
- def forward(self, input): Forward step for Discriminato... | fd4498da35ace5a3d1696ff4fbec3568eddbe6a1 | <|skeleton|>
class Discriminator:
"""Model for Discriminator."""
def __init__(self, num_channels, conv_dim, image_size, num_gpu, num_extra_layers, use_BN):
"""Init for Discriminator model."""
<|body_0|>
def forward(self, input):
"""Forward step for Discriminator model."""
<... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Discriminator:
"""Model for Discriminator."""
def __init__(self, num_channels, conv_dim, image_size, num_gpu, num_extra_layers, use_BN):
"""Init for Discriminator model."""
super(Discriminator, self).__init__()
assert image_size % 16 == 0, 'image size must be a multiple of 16!'
... | the_stack_v2_python_sparse | WGAN-GP/models.py | corenel/GAN-Zoo | train | 10 |
4b33f84939e545a9cec7089545c98779be03a490 | [
"job = self.project.create.job.Gpaw('gpaw', delete_existing_job=True)\njob.input['encut'] = 100\njob.input['kpoints'] = 3 * [1]\ns1 = self.project.atomistics.structure.bulk('Al', cubic=True)\ns2 = self.project.atomistics.structure.bulk('Al', cubic=True)\ns2.positions[0, 0] += 0.2\njob.structure = s1\nwith job.inter... | <|body_start_0|>
job = self.project.create.job.Gpaw('gpaw', delete_existing_job=True)
job.input['encut'] = 100
job.input['kpoints'] = 3 * [1]
s1 = self.project.atomistics.structure.bulk('Al', cubic=True)
s2 = self.project.atomistics.structure.bulk('Al', cubic=True)
s2.pos... | TestGpaw | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestGpaw:
def test_interactive_run(self):
"""Gpaw should run interactively, even if you update the structure to a new object."""
<|body_0|>
def test_interface_initialization(self):
"""Make sure that you can initialize the interactive interface without having already ... | stack_v2_sparse_classes_36k_train_034151 | 1,399 | permissive | [
{
"docstring": "Gpaw should run interactively, even if you update the structure to a new object.",
"name": "test_interactive_run",
"signature": "def test_interactive_run(self)"
},
{
"docstring": "Make sure that you can initialize the interactive interface without having already run the code.",
... | 2 | null | Implement the Python class `TestGpaw` described below.
Class description:
Implement the TestGpaw class.
Method signatures and docstrings:
- def test_interactive_run(self): Gpaw should run interactively, even if you update the structure to a new object.
- def test_interface_initialization(self): Make sure that you can... | Implement the Python class `TestGpaw` described below.
Class description:
Implement the TestGpaw class.
Method signatures and docstrings:
- def test_interactive_run(self): Gpaw should run interactively, even if you update the structure to a new object.
- def test_interface_initialization(self): Make sure that you can... | 4bebd2dd19df34f94bc043f78d497a890dc47fa7 | <|skeleton|>
class TestGpaw:
def test_interactive_run(self):
"""Gpaw should run interactively, even if you update the structure to a new object."""
<|body_0|>
def test_interface_initialization(self):
"""Make sure that you can initialize the interactive interface without having already ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestGpaw:
def test_interactive_run(self):
"""Gpaw should run interactively, even if you update the structure to a new object."""
job = self.project.create.job.Gpaw('gpaw', delete_existing_job=True)
job.input['encut'] = 100
job.input['kpoints'] = 3 * [1]
s1 = self.projec... | the_stack_v2_python_sparse | test_integration/test_gpaw.py | pyiron/pyiron_atomistics | train | 33 | |
b9c5a42722e0f32852f1a7e66001ce95775e0b94 | [
"super().__init__(name=name, address=address, terminator=terminator, **kwargs)\nself.add_function('reset', call_cmd='*RST')\nself.add_parameter(name='rf_center_frequency', unit='GHz', get_parser=float, set_cmd=':sense:frequency:rf:center {} GHz', get_cmd=':sense:frequency:rf:center?', docstring='The RF center frequ... | <|body_start_0|>
super().__init__(name=name, address=address, terminator=terminator, **kwargs)
self.add_function('reset', call_cmd='*RST')
self.add_parameter(name='rf_center_frequency', unit='GHz', get_parser=float, set_cmd=':sense:frequency:rf:center {} GHz', get_cmd=':sense:frequency:rf:center... | This is the QCoDeS python driver for the Agilent CXA N9000A power spectrum analyzer. | Agilent_N9000A | [
"GPL-2.0-only",
"GPL-2.0-or-later",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Agilent_N9000A:
"""This is the QCoDeS python driver for the Agilent CXA N9000A power spectrum analyzer."""
def __init__(self, name: str, address: str, terminator: str='\n', **kwargs):
"""QCoDeS driver for the power spectrum analyzer Agilent N9000A. Args: name (str): Name of the instr... | stack_v2_sparse_classes_36k_train_034152 | 3,887 | permissive | [
{
"docstring": "QCoDeS driver for the power spectrum analyzer Agilent N9000A. Args: name (str): Name of the instrument. address (str): Address of the instrument. terminator (str, optional, by default ``\"\\\\n\"``): Terminator character of the string reply.",
"name": "__init__",
"signature": "def __init... | 2 | null | Implement the Python class `Agilent_N9000A` described below.
Class description:
This is the QCoDeS python driver for the Agilent CXA N9000A power spectrum analyzer.
Method signatures and docstrings:
- def __init__(self, name: str, address: str, terminator: str='\n', **kwargs): QCoDeS driver for the power spectrum ana... | Implement the Python class `Agilent_N9000A` described below.
Class description:
This is the QCoDeS python driver for the Agilent CXA N9000A power spectrum analyzer.
Method signatures and docstrings:
- def __init__(self, name: str, address: str, terminator: str='\n', **kwargs): QCoDeS driver for the power spectrum ana... | e07c9f23339ab00b0f4c4cc46711593d88f7fc84 | <|skeleton|>
class Agilent_N9000A:
"""This is the QCoDeS python driver for the Agilent CXA N9000A power spectrum analyzer."""
def __init__(self, name: str, address: str, terminator: str='\n', **kwargs):
"""QCoDeS driver for the power spectrum analyzer Agilent N9000A. Args: name (str): Name of the instr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Agilent_N9000A:
"""This is the QCoDeS python driver for the Agilent CXA N9000A power spectrum analyzer."""
def __init__(self, name: str, address: str, terminator: str='\n', **kwargs):
"""QCoDeS driver for the power spectrum analyzer Agilent N9000A. Args: name (str): Name of the instrument. addres... | the_stack_v2_python_sparse | qcodes_contrib_drivers/drivers/Agilent/Agilent_N9000A.py | QCoDeS/Qcodes_contrib_drivers | train | 32 |
1fe5f6896d624d2925ff2c7ed4184cd5b3339c6c | [
"logs.log_info('You are using an Na+ leak channel')\nself.time_unit = 1.0\nself.vrev = 50\nself.m = np.ones(self.data_length)\nself.h = np.ones(self.data_length)\nself._mpower = 0\nself._hpower = 0",
"self._mInf = 1\nself._mTau = 1\nself._hInf = 1\nself._hTau = 1"
] | <|body_start_0|>
logs.log_info('You are using an Na+ leak channel')
self.time_unit = 1.0
self.vrev = 50
self.m = np.ones(self.data_length)
self.h = np.ones(self.data_length)
self._mpower = 0
self._hpower = 0
<|end_body_0|>
<|body_start_1|>
self._mInf = 1
... | Simple sodium leak channel -- always open -- for substance modulation. | NaLeak | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NaLeak:
"""Simple sodium leak channel -- always open -- for substance modulation."""
def _init_state(self, V):
"""Run initialization calculation for m and h gates of the channel at starting Vmem value."""
<|body_0|>
def _calculate_state(self, V):
"""Update the st... | stack_v2_sparse_classes_36k_train_034153 | 15,691 | no_license | [
{
"docstring": "Run initialization calculation for m and h gates of the channel at starting Vmem value.",
"name": "_init_state",
"signature": "def _init_state(self, V)"
},
{
"docstring": "Update the state of m and h gates of the channel given their present value and present simulation Vmem.",
... | 2 | null | Implement the Python class `NaLeak` described below.
Class description:
Simple sodium leak channel -- always open -- for substance modulation.
Method signatures and docstrings:
- def _init_state(self, V): Run initialization calculation for m and h gates of the channel at starting Vmem value.
- def _calculate_state(se... | Implement the Python class `NaLeak` described below.
Class description:
Simple sodium leak channel -- always open -- for substance modulation.
Method signatures and docstrings:
- def _init_state(self, V): Run initialization calculation for m and h gates of the channel at starting Vmem value.
- def _calculate_state(se... | dd03ff5e3df3ef48d887a6566a6286fcd168880b | <|skeleton|>
class NaLeak:
"""Simple sodium leak channel -- always open -- for substance modulation."""
def _init_state(self, V):
"""Run initialization calculation for m and h gates of the channel at starting Vmem value."""
<|body_0|>
def _calculate_state(self, V):
"""Update the st... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NaLeak:
"""Simple sodium leak channel -- always open -- for substance modulation."""
def _init_state(self, V):
"""Run initialization calculation for m and h gates of the channel at starting Vmem value."""
logs.log_info('You are using an Na+ leak channel')
self.time_unit = 1.0
... | the_stack_v2_python_sparse | betse/science/channels/vg_na.py | R-Stefano/betse-ml | train | 0 |
88db16947d7725b0567c56cac151ad10a48b9f0d | [
"super(NagiosEventLogTailer, self).__init__(log_path, logger)\nself.hostname = hostname\nself._event = event_func\nself._tags = tags\nself._passive_checks = passive_checks",
"try:\n m = RE_LINE_REG.match(line)\n if m is None:\n m = RE_LINE_EXT.match(line)\n if m is None:\n return False\n ... | <|body_start_0|>
super(NagiosEventLogTailer, self).__init__(log_path, logger)
self.hostname = hostname
self._event = event_func
self._tags = tags
self._passive_checks = passive_checks
<|end_body_0|>
<|body_start_1|>
try:
m = RE_LINE_REG.match(line)
... | NagiosEventLogTailer | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"BSD-3-Clause-Modification",
"Unlicense",
"Apache-2.0",
"LGPL-3.0-only",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"CC0-1.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NagiosEventLogTailer:
def __init__(self, log_path, logger, hostname, event_func, tags, passive_checks):
""":param log_path: string, path to the file to parse :param logger: Logger object :param hostname: string, name of the host this agent is running on :param event_func: function to cre... | stack_v2_sparse_classes_36k_train_034154 | 18,227 | permissive | [
{
"docstring": ":param log_path: string, path to the file to parse :param logger: Logger object :param hostname: string, name of the host this agent is running on :param event_func: function to create event, should accept dict :param passive_checks: bool, enable or not passive checks events",
"name": "__ini... | 3 | stack_v2_sparse_classes_30k_train_001306 | Implement the Python class `NagiosEventLogTailer` described below.
Class description:
Implement the NagiosEventLogTailer class.
Method signatures and docstrings:
- def __init__(self, log_path, logger, hostname, event_func, tags, passive_checks): :param log_path: string, path to the file to parse :param logger: Logger... | Implement the Python class `NagiosEventLogTailer` described below.
Class description:
Implement the NagiosEventLogTailer class.
Method signatures and docstrings:
- def __init__(self, log_path, logger, hostname, event_func, tags, passive_checks): :param log_path: string, path to the file to parse :param logger: Logger... | 406072e4294edff5b46b513f0cdf7c2c00fac9d2 | <|skeleton|>
class NagiosEventLogTailer:
def __init__(self, log_path, logger, hostname, event_func, tags, passive_checks):
""":param log_path: string, path to the file to parse :param logger: Logger object :param hostname: string, name of the host this agent is running on :param event_func: function to cre... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NagiosEventLogTailer:
def __init__(self, log_path, logger, hostname, event_func, tags, passive_checks):
""":param log_path: string, path to the file to parse :param logger: Logger object :param hostname: string, name of the host this agent is running on :param event_func: function to create event, sho... | the_stack_v2_python_sparse | nagios/datadog_checks/nagios/nagios.py | DataDog/integrations-core | train | 852 | |
1c14239a03d56df053ebcddf41168fb9455b0810 | [
"self.timeout = 5\nself.verbose = False\nself.buffer = 4096\nself.secret = None\nself.crypt = AES\nself.crypt_chunk_size = 16\nself.max_queue = 10",
"if not cls._instance:\n cls._instance = cls()\nreturn cls._instance",
"conf = ConfigParser()\nconf.read(path)\nif not conf.has_section(CONFIG_SECTION):\n re... | <|body_start_0|>
self.timeout = 5
self.verbose = False
self.buffer = 4096
self.secret = None
self.crypt = AES
self.crypt_chunk_size = 16
self.max_queue = 10
<|end_body_0|>
<|body_start_1|>
if not cls._instance:
cls._instance = cls()
re... | Simple object to hold jsonrpctcp configuration options | Config | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Config:
"""Simple object to hold jsonrpctcp configuration options"""
def __init__(self):
"""The default values for the configuration."""
<|body_0|>
def instance(cls):
"""Retrieves singleton"""
<|body_1|>
def load(self, path):
"""Loads setting... | stack_v2_sparse_classes_36k_train_034155 | 1,930 | permissive | [
{
"docstring": "The default values for the configuration.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Retrieves singleton",
"name": "instance",
"signature": "def instance(cls)"
},
{
"docstring": "Loads settings from a configuration file.",
"name... | 3 | stack_v2_sparse_classes_30k_train_014339 | Implement the Python class `Config` described below.
Class description:
Simple object to hold jsonrpctcp configuration options
Method signatures and docstrings:
- def __init__(self): The default values for the configuration.
- def instance(cls): Retrieves singleton
- def load(self, path): Loads settings from a config... | Implement the Python class `Config` described below.
Class description:
Simple object to hold jsonrpctcp configuration options
Method signatures and docstrings:
- def __init__(self): The default values for the configuration.
- def instance(cls): Retrieves singleton
- def load(self, path): Loads settings from a config... | 53897607f04bc390ff3b6ee8f052c74d90f825e9 | <|skeleton|>
class Config:
"""Simple object to hold jsonrpctcp configuration options"""
def __init__(self):
"""The default values for the configuration."""
<|body_0|>
def instance(cls):
"""Retrieves singleton"""
<|body_1|>
def load(self, path):
"""Loads setting... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Config:
"""Simple object to hold jsonrpctcp configuration options"""
def __init__(self):
"""The default values for the configuration."""
self.timeout = 5
self.verbose = False
self.buffer = 4096
self.secret = None
self.crypt = AES
self.crypt_chunk_si... | the_stack_v2_python_sparse | jsonrpctcp/config.py | sancelot/jsonrpctcp | train | 1 |
55693c6abbc419b4a4a54b7d080faeb784c72345 | [
"if not heights:\n return 0\nn = len(heights)\nlessFromLeft = [0] * n\nlessFromRight = [0] * n\nlessFromLeft[0] = -1\nlessFromRight[n - 1] = n\nfor i in range(1, n):\n p = i - 1\n '\\n for example in order to left[i]; if height[i - 1] < height[i] then \\n left[i] = i - 1; other wise w... | <|body_start_0|>
if not heights:
return 0
n = len(heights)
lessFromLeft = [0] * n
lessFromRight = [0] * n
lessFromLeft[0] = -1
lessFromRight[n - 1] = n
for i in range(1, n):
p = i - 1
'\n for example in order to left[... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def largestRectangleArea(self, heights):
"""For any bar i the maximum rectangle is of width r - l - 1 where r - is the last coordinate of the bar to the right with height h[r] >= h[i] and l - is the last coordinate of the bar to the left which height h[l] >= h[i] So if for any ... | stack_v2_sparse_classes_36k_train_034156 | 5,351 | no_license | [
{
"docstring": "For any bar i the maximum rectangle is of width r - l - 1 where r - is the last coordinate of the bar to the right with height h[r] >= h[i] and l - is the last coordinate of the bar to the left which height h[l] >= h[i] So if for any i coordinate we know his utmost higher (or of the same height)... | 4 | stack_v2_sparse_classes_30k_train_015245 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largestRectangleArea(self, heights): For any bar i the maximum rectangle is of width r - l - 1 where r - is the last coordinate of the bar to the right with height h[r] >= h[... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largestRectangleArea(self, heights): For any bar i the maximum rectangle is of width r - l - 1 where r - is the last coordinate of the bar to the right with height h[r] >= h[... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def largestRectangleArea(self, heights):
"""For any bar i the maximum rectangle is of width r - l - 1 where r - is the last coordinate of the bar to the right with height h[r] >= h[i] and l - is the last coordinate of the bar to the left which height h[l] >= h[i] So if for any ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def largestRectangleArea(self, heights):
"""For any bar i the maximum rectangle is of width r - l - 1 where r - is the last coordinate of the bar to the right with height h[r] >= h[i] and l - is the last coordinate of the bar to the left which height h[l] >= h[i] So if for any i coordinate w... | the_stack_v2_python_sparse | L/LargestRectangleinHistogram.py | bssrdf/pyleet | train | 2 | |
28d00bdc4e24aadfaca04d1011340b0a8cc94a3e | [
"if output_features is None:\n output_features = input_features\nsuper().__init__(input_features, output_features)\nif isinstance(morph_operation, MorphologicalOperations):\n self.morph_operation = MorphologicalOperations.get_operation(morph_operation)\nelse:\n self.morph_operation = morph_operation\nself.... | <|body_start_0|>
if output_features is None:
output_features = input_features
super().__init__(input_features, output_features)
if isinstance(morph_operation, MorphologicalOperations):
self.morph_operation = MorphologicalOperations.get_operation(morph_operation)
e... | Performs morphological operations on masks. | MorphologicalFilterTask | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MorphologicalFilterTask:
"""Performs morphological operations on masks."""
def __init__(self, input_features: FeaturesSpecification, output_features: FeaturesSpecification | None=None, *, morph_operation: MorphologicalOperations | Callable, struct_elem: np.ndarray | None=None):
""":p... | stack_v2_sparse_classes_36k_train_034157 | 6,762 | permissive | [
{
"docstring": ":param input_features: Input features to be processed. :param output_features: Outputs of input features. If not provided the `input_features` are overwritten. :param morph_operation: A morphological operation. :param struct_elem: A structuring element to be used with the morphological operation... | 2 | null | Implement the Python class `MorphologicalFilterTask` described below.
Class description:
Performs morphological operations on masks.
Method signatures and docstrings:
- def __init__(self, input_features: FeaturesSpecification, output_features: FeaturesSpecification | None=None, *, morph_operation: MorphologicalOperat... | Implement the Python class `MorphologicalFilterTask` described below.
Class description:
Performs morphological operations on masks.
Method signatures and docstrings:
- def __init__(self, input_features: FeaturesSpecification, output_features: FeaturesSpecification | None=None, *, morph_operation: MorphologicalOperat... | a65899e4632b50c9c41a67e1f7698c09b929d840 | <|skeleton|>
class MorphologicalFilterTask:
"""Performs morphological operations on masks."""
def __init__(self, input_features: FeaturesSpecification, output_features: FeaturesSpecification | None=None, *, morph_operation: MorphologicalOperations | Callable, struct_elem: np.ndarray | None=None):
""":p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MorphologicalFilterTask:
"""Performs morphological operations on masks."""
def __init__(self, input_features: FeaturesSpecification, output_features: FeaturesSpecification | None=None, *, morph_operation: MorphologicalOperations | Callable, struct_elem: np.ndarray | None=None):
""":param input_fe... | the_stack_v2_python_sparse | geometry/eolearn/geometry/morphology.py | sentinel-hub/eo-learn | train | 1,072 |
4ad5ba8dc99e7ed437d5a5421f6ddc49994b7b16 | [
"if len(A) <= 0:\n return 0\nl = len(A[0])\nmemory = {}\n\ndef dfs(row, column):\n if (row, column) in memory:\n return memory[row, column]\n if row == len(A) - 1:\n return A[row][column]\n min_val = float('inf')\n for next_column in range(max(0, column - 1), min(l - 1, column + 1) + 1)... | <|body_start_0|>
if len(A) <= 0:
return 0
l = len(A[0])
memory = {}
def dfs(row, column):
if (row, column) in memory:
return memory[row, column]
if row == len(A) - 1:
return A[row][column]
min_val = float('i... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minFallingPathSum(self, A):
""":type A: List[List[int]] :rtype: int 136 ms"""
<|body_0|>
def minFallingPathSum_1(self, A):
""":type A: List[List[int]] :rtype: int 40ms"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(A) <= 0:
... | stack_v2_sparse_classes_36k_train_034158 | 2,180 | no_license | [
{
"docstring": ":type A: List[List[int]] :rtype: int 136 ms",
"name": "minFallingPathSum",
"signature": "def minFallingPathSum(self, A)"
},
{
"docstring": ":type A: List[List[int]] :rtype: int 40ms",
"name": "minFallingPathSum_1",
"signature": "def minFallingPathSum_1(self, A)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005915 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minFallingPathSum(self, A): :type A: List[List[int]] :rtype: int 136 ms
- def minFallingPathSum_1(self, A): :type A: List[List[int]] :rtype: int 40ms | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minFallingPathSum(self, A): :type A: List[List[int]] :rtype: int 136 ms
- def minFallingPathSum_1(self, A): :type A: List[List[int]] :rtype: int 40ms
<|skeleton|>
class Solu... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def minFallingPathSum(self, A):
""":type A: List[List[int]] :rtype: int 136 ms"""
<|body_0|>
def minFallingPathSum_1(self, A):
""":type A: List[List[int]] :rtype: int 40ms"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def minFallingPathSum(self, A):
""":type A: List[List[int]] :rtype: int 136 ms"""
if len(A) <= 0:
return 0
l = len(A[0])
memory = {}
def dfs(row, column):
if (row, column) in memory:
return memory[row, column]
... | the_stack_v2_python_sparse | MinimumFallingPathSum_MID_931.py | 953250587/leetcode-python | train | 2 | |
803f68a59b240f6bc2cd96f5cb1602e5b68190a3 | [
"patten = ''\nfor x in p:\n if x == '*' and len(patten) > 0 and (patten[-1] == '*'):\n continue\n patten += x\nmem = dict()\n\ndef match(s, p):\n if (s, p) in mem:\n return mem[s, p]\n if len(p) == 0:\n return len(s) == 0\n if len(s) == 0:\n return p in '*' * len(p)\n i... | <|body_start_0|>
patten = ''
for x in p:
if x == '*' and len(patten) > 0 and (patten[-1] == '*'):
continue
patten += x
mem = dict()
def match(s, p):
if (s, p) in mem:
return mem[s, p]
if len(p) == 0:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isMatch(self, s, p):
""":type s: str :type p: str :rtype: bool"""
<|body_0|>
def isMatch2(self, s, p):
"""动态规划"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
patten = ''
for x in p:
if x == '*' and len(patten) > 0 ... | stack_v2_sparse_classes_36k_train_034159 | 2,412 | no_license | [
{
"docstring": ":type s: str :type p: str :rtype: bool",
"name": "isMatch",
"signature": "def isMatch(self, s, p)"
},
{
"docstring": "动态规划",
"name": "isMatch2",
"signature": "def isMatch2(self, s, p)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002487 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isMatch(self, s, p): :type s: str :type p: str :rtype: bool
- def isMatch2(self, s, p): 动态规划 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isMatch(self, s, p): :type s: str :type p: str :rtype: bool
- def isMatch2(self, s, p): 动态规划
<|skeleton|>
class Solution:
def isMatch(self, s, p):
""":type s: s... | 837957ea22aa07ce28a6c23ea0419bd2011e1f88 | <|skeleton|>
class Solution:
def isMatch(self, s, p):
""":type s: str :type p: str :rtype: bool"""
<|body_0|>
def isMatch2(self, s, p):
"""动态规划"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isMatch(self, s, p):
""":type s: str :type p: str :rtype: bool"""
patten = ''
for x in p:
if x == '*' and len(patten) > 0 and (patten[-1] == '*'):
continue
patten += x
mem = dict()
def match(s, p):
if (s... | the_stack_v2_python_sparse | Tencent/hard/通配符匹配.py | 2226171237/Algorithmpractice | train | 0 | |
4dbac9098615bbbbb443499d7e03d3cfaa0582aa | [
"ans = ListNode(0)\ntmp = ans\nwhile l1 and l2:\n if l1.val < l2.val:\n tmp.next = ListNode(l1.val)\n tmp = tmp.next\n l1 = l1.next\n else:\n tmp.next = ListNode(l2.val)\n tmp = tmp.next\n l2 = l2.next\nwhile l1:\n tmp.next = ListNode(l1.val)\n tmp = tmp.next\n ... | <|body_start_0|>
ans = ListNode(0)
tmp = ans
while l1 and l2:
if l1.val < l2.val:
tmp.next = ListNode(l1.val)
tmp = tmp.next
l1 = l1.next
else:
tmp.next = ListNode(l2.val)
tmp = tmp.next
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_0|>
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ans = Li... | stack_v2_sparse_classes_36k_train_034160 | 1,651 | no_license | [
{
"docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode",
"name": "mergeTwoLists",
"signature": "def mergeTwoLists(self, l1, l2)"
},
{
"docstring": ":type lists: List[ListNode] :rtype: ListNode",
"name": "mergeKLists",
"signature": "def mergeKLists(self, lists)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
- def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
- def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
<|skeleton|>... | 1520e1e9bb0c428797a3e5234e5b328110472c20 | <|skeleton|>
class Solution:
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_0|>
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
ans = ListNode(0)
tmp = ans
while l1 and l2:
if l1.val < l2.val:
tmp.next = ListNode(l1.val)
tmp = tmp.next
l1 = l... | the_stack_v2_python_sparse | LinkedList/23. Merge k Sorted Lists.py | tinkle1129/Leetcode_Solution | train | 0 | |
e445ed1538ee05817cc21de4e7dd161831db1330 | [
"decorrelated = []\nfor branch in range(branches):\n nl = nlsp.nonlinear_function.Hermite(degree=branch + 1, input_signal=input_signal)\n decorrelated.append(nl.GetOutput())\nreturn decorrelated",
"branches = max(self._select_branches)\ninput_wgn = self.GetExcitation()\noutput_wgn = self._system_response\nh... | <|body_start_0|>
decorrelated = []
for branch in range(branches):
nl = nlsp.nonlinear_function.Hermite(degree=branch + 1, input_signal=input_signal)
decorrelated.append(nl.GetOutput())
return decorrelated
<|end_body_0|>
<|body_start_1|>
branches = max(self._selec... | A class which identifies a model of a system using MISO approach which uses Hermite polynomials to decorrelate the input of the MISO subsystem. | MISOapproachusingHermite | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MISOapproachusingHermite:
"""A class which identifies a model of a system using MISO approach which uses Hermite polynomials to decorrelate the input of the MISO subsystem."""
def __get_decorrelated_inputs(self, input_signal, branches):
"""Get the array of decorrelated input signals ... | stack_v2_sparse_classes_36k_train_034161 | 2,819 | no_license | [
{
"docstring": "Get the array of decorrelated input signals using Hermite polynomial expansion.",
"name": "__get_decorrelated_inputs",
"signature": "def __get_decorrelated_inputs(self, input_signal, branches)"
},
{
"docstring": "Get the identified filter impulse responses. :return: the filter im... | 3 | stack_v2_sparse_classes_30k_train_011505 | Implement the Python class `MISOapproachusingHermite` described below.
Class description:
A class which identifies a model of a system using MISO approach which uses Hermite polynomials to decorrelate the input of the MISO subsystem.
Method signatures and docstrings:
- def __get_decorrelated_inputs(self, input_signal... | Implement the Python class `MISOapproachusingHermite` described below.
Class description:
A class which identifies a model of a system using MISO approach which uses Hermite polynomials to decorrelate the input of the MISO subsystem.
Method signatures and docstrings:
- def __get_decorrelated_inputs(self, input_signal... | 41ba79cddeb8f76ffed1d3435d629e014f7d04c5 | <|skeleton|>
class MISOapproachusingHermite:
"""A class which identifies a model of a system using MISO approach which uses Hermite polynomials to decorrelate the input of the MISO subsystem."""
def __get_decorrelated_inputs(self, input_signal, branches):
"""Get the array of decorrelated input signals ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MISOapproachusingHermite:
"""A class which identifies a model of a system using MISO approach which uses Hermite polynomials to decorrelate the input of the MISO subsystem."""
def __get_decorrelated_inputs(self, input_signal, branches):
"""Get the array of decorrelated input signals using Hermite... | the_stack_v2_python_sparse | model_generator/system_identification/wgn_identification/miso_approach_hermite.py | zuowanbushiwo/systemidentifier | train | 0 |
cd329413dd26b6a026c49aee3add7dc5659be70c | [
"startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('chamathd', 'chamathd')\nprint('Fetching five-foot sea level data from Boston ArcGIS Open Data')\ncolName = 'chamathd.sea_level_five'\nurl = 'http://bostonopendata-boston.opendata.arcgis.com/datasets/4ebe... | <|body_start_0|>
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('chamathd', 'chamathd')
print('Fetching five-foot sea level data from Boston ArcGIS Open Data')
colName = 'chamathd.sea_level_five'
url = '... | fetch_sea_level_data | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class fetch_sea_level_data:
def execute(trial=False):
"""Retrieve some data sets for the MongoDB collection."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everything happening in this... | stack_v2_sparse_classes_36k_train_034162 | 5,714 | no_license | [
{
"docstring": "Retrieve some data sets for the MongoDB collection.",
"name": "execute",
"signature": "def execute(trial=False)"
},
{
"docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new document describing that i... | 2 | stack_v2_sparse_classes_30k_train_020254 | Implement the Python class `fetch_sea_level_data` described below.
Class description:
Implement the fetch_sea_level_data class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets for the MongoDB collection.
- def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None... | Implement the Python class `fetch_sea_level_data` described below.
Class description:
Implement the fetch_sea_level_data class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets for the MongoDB collection.
- def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None... | 0df485d0469c5451ebdcd684bed2a0960ba3ab84 | <|skeleton|>
class fetch_sea_level_data:
def execute(trial=False):
"""Retrieve some data sets for the MongoDB collection."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everything happening in this... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class fetch_sea_level_data:
def execute(trial=False):
"""Retrieve some data sets for the MongoDB collection."""
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('chamathd', 'chamathd')
print('Fetching five-foo... | the_stack_v2_python_sparse | chamathd/fetch_sea_level_data.py | lingyigu/course-2017-spr-proj | train | 0 | |
4f78b0688b206fe974bd4a3e6b23f73c2e873eb7 | [
"max_nums = []\nif k > len(nums) or not nums:\n return max_nums\nif k == 1:\n return nums\ncurrent_window = nums[:k]\ncurrent_max = max(current_window)\nmax_nums.append(current_max)\nfor i in range(k, len(nums)):\n this_num = nums[i]\n if current_max < this_num:\n current_max = this_num\n ... | <|body_start_0|>
max_nums = []
if k > len(nums) or not nums:
return max_nums
if k == 1:
return nums
current_window = nums[:k]
current_max = max(current_window)
max_nums.append(current_max)
for i in range(k, len(nums)):
this_num ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxSlidingWindow1(self, nums, k):
""":type nums: List[int] :type k: int :rtype: List[int]"""
<|body_0|>
def maxSlidingWindow2(self, nums, k):
""":type nums: List[int] :type k: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0... | stack_v2_sparse_classes_36k_train_034163 | 2,152 | no_license | [
{
"docstring": ":type nums: List[int] :type k: int :rtype: List[int]",
"name": "maxSlidingWindow1",
"signature": "def maxSlidingWindow1(self, nums, k)"
},
{
"docstring": ":type nums: List[int] :type k: int :rtype: List[int]",
"name": "maxSlidingWindow2",
"signature": "def maxSlidingWindo... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSlidingWindow1(self, nums, k): :type nums: List[int] :type k: int :rtype: List[int]
- def maxSlidingWindow2(self, nums, k): :type nums: List[int] :type k: int :rtype: List... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSlidingWindow1(self, nums, k): :type nums: List[int] :type k: int :rtype: List[int]
- def maxSlidingWindow2(self, nums, k): :type nums: List[int] :type k: int :rtype: List... | 8fb6c1d947046dabd58ff8482b2c0b41f39aa988 | <|skeleton|>
class Solution:
def maxSlidingWindow1(self, nums, k):
""":type nums: List[int] :type k: int :rtype: List[int]"""
<|body_0|>
def maxSlidingWindow2(self, nums, k):
""":type nums: List[int] :type k: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxSlidingWindow1(self, nums, k):
""":type nums: List[int] :type k: int :rtype: List[int]"""
max_nums = []
if k > len(nums) or not nums:
return max_nums
if k == 1:
return nums
current_window = nums[:k]
current_max = max(curr... | the_stack_v2_python_sparse | Python/LeetCode/239.py | czx94/Algorithms-Collection | train | 2 | |
7761259dab72aad87d471ba08bf6310965a2fbd9 | [
"context = super(ChannelDetailView, self).get_context_data(**kwargs)\nfilename = self.object.attributes.get('log_file', default='channel_%s.log' % self.object.key)\nbucket = []\nfor log in (x.strip() for x in tail_log_file(filename, 0, self.max_num_lines)):\n if not log:\n continue\n time, msg = log.sp... | <|body_start_0|>
context = super(ChannelDetailView, self).get_context_data(**kwargs)
filename = self.object.attributes.get('log_file', default='channel_%s.log' % self.object.key)
bucket = []
for log in (x.strip() for x in tail_log_file(filename, 0, self.max_num_lines)):
if no... | Returns the log entries for a given channel. | ChannelDetailView | [
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChannelDetailView:
"""Returns the log entries for a given channel."""
def get_context_data(self, **kwargs):
"""Django hook; before we can display the channel logs, we need to recall the logfile and read its lines. Returns: context (dict): Django context object"""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_034164 | 35,922 | permissive | [
{
"docstring": "Django hook; before we can display the channel logs, we need to recall the logfile and read its lines. Returns: context (dict): Django context object",
"name": "get_context_data",
"signature": "def get_context_data(self, **kwargs)"
},
{
"docstring": "Override of Django hook that ... | 2 | null | Implement the Python class `ChannelDetailView` described below.
Class description:
Returns the log entries for a given channel.
Method signatures and docstrings:
- def get_context_data(self, **kwargs): Django hook; before we can display the channel logs, we need to recall the logfile and read its lines. Returns: cont... | Implement the Python class `ChannelDetailView` described below.
Class description:
Returns the log entries for a given channel.
Method signatures and docstrings:
- def get_context_data(self, **kwargs): Django hook; before we can display the channel logs, we need to recall the logfile and read its lines. Returns: cont... | 5e97df013399e1a401d0a7ec184c4b9eb3100edd | <|skeleton|>
class ChannelDetailView:
"""Returns the log entries for a given channel."""
def get_context_data(self, **kwargs):
"""Django hook; before we can display the channel logs, we need to recall the logfile and read its lines. Returns: context (dict): Django context object"""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChannelDetailView:
"""Returns the log entries for a given channel."""
def get_context_data(self, **kwargs):
"""Django hook; before we can display the channel logs, we need to recall the logfile and read its lines. Returns: context (dict): Django context object"""
context = super(ChannelDe... | the_stack_v2_python_sparse | evennia-engine/evennia/evennia/web/website/views.py | rajammanabrolu/WorldGeneration | train | 69 |
4cfcd500e415d9c5ff86b93b9635b32938362e27 | [
"nums = self._convertBST2Array(root)\nlength = len(nums)\nif length < 2:\n return False\ni, j = (0, length - 1)\nwhile i < j:\n sum_value = nums[i] + nums[j]\n if sum_value == k:\n return True\n elif sum_value < k:\n i += 1\n else:\n j -= 1\nreturn False",
"if root is None:\n ... | <|body_start_0|>
nums = self._convertBST2Array(root)
length = len(nums)
if length < 2:
return False
i, j = (0, length - 1)
while i < j:
sum_value = nums[i] + nums[j]
if sum_value == k:
return True
elif sum_value < k:... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findTarget(self, root, k):
""":type root: TreeNode :type k: int :rtype: bool"""
<|body_0|>
def _convertBST2Array(self, root):
""":type root: TreeNode :rtype: list"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
nums = self._convertBST2... | stack_v2_sparse_classes_36k_train_034165 | 2,419 | permissive | [
{
"docstring": ":type root: TreeNode :type k: int :rtype: bool",
"name": "findTarget",
"signature": "def findTarget(self, root, k)"
},
{
"docstring": ":type root: TreeNode :rtype: list",
"name": "_convertBST2Array",
"signature": "def _convertBST2Array(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009312 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findTarget(self, root, k): :type root: TreeNode :type k: int :rtype: bool
- def _convertBST2Array(self, root): :type root: TreeNode :rtype: list | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findTarget(self, root, k): :type root: TreeNode :type k: int :rtype: bool
- def _convertBST2Array(self, root): :type root: TreeNode :rtype: list
<|skeleton|>
class Solution:... | 05420b73d28220681cd7be8253bebcaa83966954 | <|skeleton|>
class Solution:
def findTarget(self, root, k):
""":type root: TreeNode :type k: int :rtype: bool"""
<|body_0|>
def _convertBST2Array(self, root):
""":type root: TreeNode :rtype: list"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findTarget(self, root, k):
""":type root: TreeNode :type k: int :rtype: bool"""
nums = self._convertBST2Array(root)
length = len(nums)
if length < 2:
return False
i, j = (0, length - 1)
while i < j:
sum_value = nums[i] + num... | the_stack_v2_python_sparse | two-sum-iv-input-is-a-bst/test.py | optionalg/challenges-leetcode-interesting | train | 0 | |
69df24143142a72d0f241dadf0b865be7ea7f793 | [
"if level == 0:\n self.turtle.forward(length)\nelse:\n length = length / 3\n self.turtle.forward(length)\n self.turtle.left(KochCurve.angle)\n self.turtle.forward(length)\n self.turtle.right(2 * KochCurve.angle)\n self.turtle.forward(length)\n self.turtle.left(KochCurve.angle)\n self.turt... | <|body_start_0|>
if level == 0:
self.turtle.forward(length)
else:
length = length / 3
self.turtle.forward(length)
self.turtle.left(KochCurve.angle)
self.turtle.forward(length)
self.turtle.right(2 * KochCurve.angle)
self.... | Implements draw method so that a Koch curve is drawn. | KochCurve | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KochCurve:
"""Implements draw method so that a Koch curve is drawn."""
def draw_koch(self, level, length):
"""Recursive function. At level zero just draws a forward line of given length. At higher levels does the following: divides length by 3 draws a (level-1) koch_curve then turns ... | stack_v2_sparse_classes_36k_train_034166 | 11,073 | no_license | [
{
"docstring": "Recursive function. At level zero just draws a forward line of given length. At higher levels does the following: divides length by 3 draws a (level-1) koch_curve then turns KochCurve.angle degrees left draws a (level-1) koch_curve then turns 2*KochCurve.angle degrees right draws a (level-1) koc... | 2 | stack_v2_sparse_classes_30k_test_000153 | Implement the Python class `KochCurve` described below.
Class description:
Implements draw method so that a Koch curve is drawn.
Method signatures and docstrings:
- def draw_koch(self, level, length): Recursive function. At level zero just draws a forward line of given length. At higher levels does the following: div... | Implement the Python class `KochCurve` described below.
Class description:
Implements draw method so that a Koch curve is drawn.
Method signatures and docstrings:
- def draw_koch(self, level, length): Recursive function. At level zero just draws a forward line of given length. At higher levels does the following: div... | 18004379826f172ee42f991bacf769fef5e40ddd | <|skeleton|>
class KochCurve:
"""Implements draw method so that a Koch curve is drawn."""
def draw_koch(self, level, length):
"""Recursive function. At level zero just draws a forward line of given length. At higher levels does the following: divides length by 3 draws a (level-1) koch_curve then turns ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KochCurve:
"""Implements draw method so that a Koch curve is drawn."""
def draw_koch(self, level, length):
"""Recursive function. At level zero just draws a forward line of given length. At higher levels does the following: divides length by 3 draws a (level-1) koch_curve then turns KochCurve.ang... | the_stack_v2_python_sparse | src_py/data structure/week4/fractal_drawing.py | awesome121/some_practice_source_code | train | 0 |
f3f5c3430f5c84f13b6654527d1004225d139f50 | [
"self.Wz = np.random.normal(size=(h + i, h))\nself.Wr = np.random.normal(size=(h + i, h))\nself.Wh = np.random.normal(size=(h + i, h))\nself.Wy = np.random.normal(size=(h, o))\nself.bz = np.zeros((1, h))\nself.br = np.zeros((1, h))\nself.bh = np.zeros((1, h))\nself.by = np.zeros((1, o))",
"x_max = np.max(x, axis=... | <|body_start_0|>
self.Wz = np.random.normal(size=(h + i, h))
self.Wr = np.random.normal(size=(h + i, h))
self.Wh = np.random.normal(size=(h + i, h))
self.Wy = np.random.normal(size=(h, o))
self.bz = np.zeros((1, h))
self.br = np.zeros((1, h))
self.bh = np.zeros((1... | Class GRUCell that represents a gated recurrent unit | GRUCell | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GRUCell:
"""Class GRUCell that represents a gated recurrent unit"""
def __init__(self, i, h, o):
"""class constructor Argumetns: - i is the dimensionality of the data - h is the dimensionality of the hidden state - o is the dimensionality of the outputs Public instance attributes Wz,... | stack_v2_sparse_classes_36k_train_034167 | 2,573 | no_license | [
{
"docstring": "class constructor Argumetns: - i is the dimensionality of the data - h is the dimensionality of the hidden state - o is the dimensionality of the outputs Public instance attributes Wz, Wr, Wh, Wy, bz, br, bh, by that represent the weights and biases of the cell - Wzand bz are for the update gate... | 3 | stack_v2_sparse_classes_30k_train_001848 | Implement the Python class `GRUCell` described below.
Class description:
Class GRUCell that represents a gated recurrent unit
Method signatures and docstrings:
- def __init__(self, i, h, o): class constructor Argumetns: - i is the dimensionality of the data - h is the dimensionality of the hidden state - o is the dim... | Implement the Python class `GRUCell` described below.
Class description:
Class GRUCell that represents a gated recurrent unit
Method signatures and docstrings:
- def __init__(self, i, h, o): class constructor Argumetns: - i is the dimensionality of the data - h is the dimensionality of the hidden state - o is the dim... | fc2cec306961f7ca2448965ddd3a2f656bbe10c7 | <|skeleton|>
class GRUCell:
"""Class GRUCell that represents a gated recurrent unit"""
def __init__(self, i, h, o):
"""class constructor Argumetns: - i is the dimensionality of the data - h is the dimensionality of the hidden state - o is the dimensionality of the outputs Public instance attributes Wz,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GRUCell:
"""Class GRUCell that represents a gated recurrent unit"""
def __init__(self, i, h, o):
"""class constructor Argumetns: - i is the dimensionality of the data - h is the dimensionality of the hidden state - o is the dimensionality of the outputs Public instance attributes Wz, Wr, Wh, Wy, ... | the_stack_v2_python_sparse | supervised_learning/0x0D-RNNs/2-gru_cell.py | dalexach/holbertonschool-machine_learning | train | 2 |
8bba0c546967d0c444c5bb7d6a6a8b5a78bc0df4 | [
"if description is None:\n description = ''\ndescription = ASCII_LOGO + '\\n' + description.lstrip(' ')\nsuper().__init__(usage=usage, description=description, formatter_class=argparse.RawTextHelpFormatter)",
"remaining = Options(*args)\nfor argument, options in copy.deepcopy(self.standard_arguments).items():\... | <|body_start_0|>
if description is None:
description = ''
description = ASCII_LOGO + '\n' + description.lstrip(' ')
super().__init__(usage=usage, description=description, formatter_class=argparse.RawTextHelpFormatter)
<|end_body_0|>
<|body_start_1|>
remaining = Options(*args... | Class for parsing command-line arguments. | ArgumentParser | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArgumentParser:
"""Class for parsing command-line arguments."""
def __init__(self, usage: Optional[str]=None, description: Optional[str]=None):
"""Construct `ArgumentParser`."""
<|body_0|>
def with_standard_arguments(self, *args: Union[str, Tuple[str, Any]]) -> 'Argument... | stack_v2_sparse_classes_36k_train_034168 | 4,796 | permissive | [
{
"docstring": "Construct `ArgumentParser`.",
"name": "__init__",
"signature": "def __init__(self, usage: Optional[str]=None, description: Optional[str]=None)"
},
{
"docstring": "Add standard, named arguments to the `ArgumentParser`. Standard argument is given, but can be overwritten as a tuple.... | 2 | stack_v2_sparse_classes_30k_test_000619 | Implement the Python class `ArgumentParser` described below.
Class description:
Class for parsing command-line arguments.
Method signatures and docstrings:
- def __init__(self, usage: Optional[str]=None, description: Optional[str]=None): Construct `ArgumentParser`.
- def with_standard_arguments(self, *args: Union[str... | Implement the Python class `ArgumentParser` described below.
Class description:
Class for parsing command-line arguments.
Method signatures and docstrings:
- def __init__(self, usage: Optional[str]=None, description: Optional[str]=None): Construct `ArgumentParser`.
- def with_standard_arguments(self, *args: Union[str... | f6e03282dd665c81d06eaa1ab55a07d138064e9a | <|skeleton|>
class ArgumentParser:
"""Class for parsing command-line arguments."""
def __init__(self, usage: Optional[str]=None, description: Optional[str]=None):
"""Construct `ArgumentParser`."""
<|body_0|>
def with_standard_arguments(self, *args: Union[str, Tuple[str, Any]]) -> 'Argument... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ArgumentParser:
"""Class for parsing command-line arguments."""
def __init__(self, usage: Optional[str]=None, description: Optional[str]=None):
"""Construct `ArgumentParser`."""
if description is None:
description = ''
description = ASCII_LOGO + '\n' + description.lstr... | the_stack_v2_python_sparse | src/graphnet/utilities/argparse.py | graphnet-team/graphnet | train | 55 |
d57b3824bdfca75f2c31c7c6116607f269eb7e22 | [
"if geo_opt:\n self.settings.input.ams.Task = 'GeometryOptimization'\nelse:\n self.settings.input.ams.Task = 'SinglePoint'\nself.settings.input.ams.Properties.NormalModes = 'Yes'\nself.settings.input.DFTB\nself.settings.input.DFTB.Model = 'GFN1-xTB'\nself.settings.input.DFTB.ResourcesDir = 'GFN1-xTB'\nself.se... | <|body_start_0|>
if geo_opt:
self.settings.input.ams.Task = 'GeometryOptimization'
else:
self.settings.input.ams.Task = 'SinglePoint'
self.settings.input.ams.Properties.NormalModes = 'Yes'
self.settings.input.DFTB
self.settings.input.DFTB.Model = 'GFN1-xTB... | Class used for geometry optimization + frequency jobs using DF tight binding methods | DFTBJob | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DFTBJob:
"""Class used for geometry optimization + frequency jobs using DF tight binding methods"""
def _set_std_settings(self, geo_opt=False):
"""Method that specifies standard settings for a DFTB geometry optimization + freqs job"""
<|body_0|>
def run(self, init=True, ... | stack_v2_sparse_classes_36k_train_034169 | 3,480 | no_license | [
{
"docstring": "Method that specifies standard settings for a DFTB geometry optimization + freqs job",
"name": "_set_std_settings",
"signature": "def _set_std_settings(self, geo_opt=False)"
},
{
"docstring": "Method that runs this job",
"name": "run",
"signature": "def run(self, init=Tru... | 2 | stack_v2_sparse_classes_30k_train_020840 | Implement the Python class `DFTBJob` described below.
Class description:
Class used for geometry optimization + frequency jobs using DF tight binding methods
Method signatures and docstrings:
- def _set_std_settings(self, geo_opt=False): Method that specifies standard settings for a DFTB geometry optimization + freqs... | Implement the Python class `DFTBJob` described below.
Class description:
Class used for geometry optimization + frequency jobs using DF tight binding methods
Method signatures and docstrings:
- def _set_std_settings(self, geo_opt=False): Method that specifies standard settings for a DFTB geometry optimization + freqs... | 30b64bd89023b8b7cdd37270bb8970b04c7a7081 | <|skeleton|>
class DFTBJob:
"""Class used for geometry optimization + frequency jobs using DF tight binding methods"""
def _set_std_settings(self, geo_opt=False):
"""Method that specifies standard settings for a DFTB geometry optimization + freqs job"""
<|body_0|>
def run(self, init=True, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DFTBJob:
"""Class used for geometry optimization + frequency jobs using DF tight binding methods"""
def _set_std_settings(self, geo_opt=False):
"""Method that specifies standard settings for a DFTB geometry optimization + freqs job"""
if geo_opt:
self.settings.input.ams.Task =... | the_stack_v2_python_sparse | comparion data and code/modules/jobs.py | YHordijk/bachelorproject | train | 0 |
bea5c71ff4e8f4b1623fe68e7e5d54419a35d5fa | [
"self.args = arguments or {}\nself.uri = uri\nself.location = location\nsuper().__init__(**kwargs)",
"from git.repo import Repo\nref = self.__determine_git_ref()\ndir_name = '_'.join([self.sanitize_git_path(self.uri), ref])\ncached_dir_path = self.cache_dir / dir_name\nif cached_dir_path.exists():\n return cac... | <|body_start_0|>
self.args = arguments or {}
self.uri = uri
self.location = location
super().__init__(**kwargs)
<|end_body_0|>
<|body_start_1|>
from git.repo import Repo
ref = self.__determine_git_ref()
dir_name = '_'.join([self.sanitize_git_path(self.uri), ref])... | Git Path Source. The Git path source can be tasked with cloning a remote repository and pointing to a specific module folder (or the root). | Git | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Git:
"""Git Path Source. The Git path source can be tasked with cloning a remote repository and pointing to a specific module folder (or the root)."""
def __init__(self, *, arguments: Optional[Dict[str, str]]=None, location: str='', uri: str='', **kwargs: Any) -> None:
"""Git Path So... | stack_v2_sparse_classes_36k_train_034170 | 4,143 | permissive | [
{
"docstring": "Git Path Source. Args: arguments: A reference can be passed along via the arguments so that a specific version of the repository is cloned. **commit**, **tag**, **branch** are all valid keys with respective output location: The relative location to the root of the repository where the module res... | 6 | stack_v2_sparse_classes_30k_train_015502 | Implement the Python class `Git` described below.
Class description:
Git Path Source. The Git path source can be tasked with cloning a remote repository and pointing to a specific module folder (or the root).
Method signatures and docstrings:
- def __init__(self, *, arguments: Optional[Dict[str, str]]=None, location:... | Implement the Python class `Git` described below.
Class description:
Git Path Source. The Git path source can be tasked with cloning a remote repository and pointing to a specific module folder (or the root).
Method signatures and docstrings:
- def __init__(self, *, arguments: Optional[Dict[str, str]]=None, location:... | 0763b06aee07d2cf3f037a49ca0cb81a048c5deb | <|skeleton|>
class Git:
"""Git Path Source. The Git path source can be tasked with cloning a remote repository and pointing to a specific module folder (or the root)."""
def __init__(self, *, arguments: Optional[Dict[str, str]]=None, location: str='', uri: str='', **kwargs: Any) -> None:
"""Git Path So... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Git:
"""Git Path Source. The Git path source can be tasked with cloning a remote repository and pointing to a specific module folder (or the root)."""
def __init__(self, *, arguments: Optional[Dict[str, str]]=None, location: str='', uri: str='', **kwargs: Any) -> None:
"""Git Path Source. Args: a... | the_stack_v2_python_sparse | runway/sources/git.py | onicagroup/runway | train | 156 |
9eeec201390b6d6f71793315d9ded7b4b81d8aa5 | [
"logging.info('========== choose_act ==========')\nWebDriverWait(self.driver, 20).until(lambda x: x.find_element_by_id(self.act_choose_id))\nself.driver.find_element_by_id(self.act_choose_id).click()\nsleep(1)\nacts = self.driver.find_elements_by_class_name(self.check_label_class)\nrandom.choice(acts).click()\nslee... | <|body_start_0|>
logging.info('========== choose_act ==========')
WebDriverWait(self.driver, 20).until(lambda x: x.find_element_by_id(self.act_choose_id))
self.driver.find_element_by_id(self.act_choose_id).click()
sleep(1)
acts = self.driver.find_elements_by_class_name(self.check... | 活动基类,封装一些公共方法 | ActivityCommon | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ActivityCommon:
"""活动基类,封装一些公共方法"""
def choose_act(self):
"""选择活动"""
<|body_0|>
def choose_expense(self):
"""选择费用明细"""
<|body_1|>
def apply_num(self):
"""赠送数量"""
<|body_2|>
def apply_amount(self):
"""赠送金额"""
<|bod... | stack_v2_sparse_classes_36k_train_034171 | 17,683 | no_license | [
{
"docstring": "选择活动",
"name": "choose_act",
"signature": "def choose_act(self)"
},
{
"docstring": "选择费用明细",
"name": "choose_expense",
"signature": "def choose_expense(self)"
},
{
"docstring": "赠送数量",
"name": "apply_num",
"signature": "def apply_num(self)"
},
{
"d... | 6 | stack_v2_sparse_classes_30k_train_011540 | Implement the Python class `ActivityCommon` described below.
Class description:
活动基类,封装一些公共方法
Method signatures and docstrings:
- def choose_act(self): 选择活动
- def choose_expense(self): 选择费用明细
- def apply_num(self): 赠送数量
- def apply_amount(self): 赠送金额
- def submit(self): 提交活动
- def reconfirm(self): 再次确认 | Implement the Python class `ActivityCommon` described below.
Class description:
活动基类,封装一些公共方法
Method signatures and docstrings:
- def choose_act(self): 选择活动
- def choose_expense(self): 选择费用明细
- def apply_num(self): 赠送数量
- def apply_amount(self): 赠送金额
- def submit(self): 提交活动
- def reconfirm(self): 再次确认
<|skeleton|>
... | 05a0430f134c59be968daa6fa60d72aa5a9fbc5e | <|skeleton|>
class ActivityCommon:
"""活动基类,封装一些公共方法"""
def choose_act(self):
"""选择活动"""
<|body_0|>
def choose_expense(self):
"""选择费用明细"""
<|body_1|>
def apply_num(self):
"""赠送数量"""
<|body_2|>
def apply_amount(self):
"""赠送金额"""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ActivityCommon:
"""活动基类,封装一些公共方法"""
def choose_act(self):
"""选择活动"""
logging.info('========== choose_act ==========')
WebDriverWait(self.driver, 20).until(lambda x: x.find_element_by_id(self.act_choose_id))
self.driver.find_element_by_id(self.act_choose_id).click()
... | the_stack_v2_python_sparse | ccloud/businessView/activity.py | dopqob/Python | train | 0 |
2d847b13623df0618d4b18aa8a341ec617691bc7 | [
"data = self.cleaned_data\ncategory = self.cleaned_data['phone_category']\nif PhoneCategory.objects.count() >= 4 and self.instance.pk is None:\n raise ValidationError(phone_category_error)\nif PhoneCategory.objects.filter(phone_category=category) and (not self.instance.pk):\n error_message = phone_category_er... | <|body_start_0|>
data = self.cleaned_data
category = self.cleaned_data['phone_category']
if PhoneCategory.objects.count() >= 4 and self.instance.pk is None:
raise ValidationError(phone_category_error)
if PhoneCategory.objects.filter(phone_category=category) and (not self.inst... | A form for validating Phone category data. | PhoneCategoryForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PhoneCategoryForm:
"""A form for validating Phone category data."""
def clean(self):
"""Validate that categories do not exceed four and a category has not been repeated."""
<|body_0|>
def clean_category_image(self):
"""Validate that the height and width of the im... | stack_v2_sparse_classes_36k_train_034172 | 2,354 | no_license | [
{
"docstring": "Validate that categories do not exceed four and a category has not been repeated.",
"name": "clean",
"signature": "def clean(self)"
},
{
"docstring": "Validate that the height and width of the image are equal.",
"name": "clean_category_image",
"signature": "def clean_cate... | 2 | stack_v2_sparse_classes_30k_train_011384 | Implement the Python class `PhoneCategoryForm` described below.
Class description:
A form for validating Phone category data.
Method signatures and docstrings:
- def clean(self): Validate that categories do not exceed four and a category has not been repeated.
- def clean_category_image(self): Validate that the heigh... | Implement the Python class `PhoneCategoryForm` described below.
Class description:
A form for validating Phone category data.
Method signatures and docstrings:
- def clean(self): Validate that categories do not exceed four and a category has not been repeated.
- def clean_category_image(self): Validate that the heigh... | 16ab89be35bebe4c9090415288205e5ea543df29 | <|skeleton|>
class PhoneCategoryForm:
"""A form for validating Phone category data."""
def clean(self):
"""Validate that categories do not exceed four and a category has not been repeated."""
<|body_0|>
def clean_category_image(self):
"""Validate that the height and width of the im... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PhoneCategoryForm:
"""A form for validating Phone category data."""
def clean(self):
"""Validate that categories do not exceed four and a category has not been repeated."""
data = self.cleaned_data
category = self.cleaned_data['phone_category']
if PhoneCategory.objects.cou... | the_stack_v2_python_sparse | hirola/front/forms/model_forms.py | JamesKirkAndSpock/Hirola | train | 0 |
68f32e911a2f0093db3d2f25e619f474f7e7c4e2 | [
"self.reqparser = reqparse.RequestParser()\nself.reqparser.add_argument('symbol', required=False, type=str, location=['form', 'json'])\nself.reqparser.add_argument('description', required=False, type=str, location=['form', 'json'])",
"if not get_jwt_claims()['admin']:\n return ({'message': 'Not Authorized.'}, ... | <|body_start_0|>
self.reqparser = reqparse.RequestParser()
self.reqparser.add_argument('symbol', required=False, type=str, location=['form', 'json'])
self.reqparser.add_argument('description', required=False, type=str, location=['form', 'json'])
<|end_body_0|>
<|body_start_1|>
if not ge... | Fetches a specified unit instance from the database by its symbol or description :post: :arg symbol: Symbol string of the unit eg 'kg' :arg description: The description of the unit :type symbol: str :type description: str | GetUnitOfMeasure | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetUnitOfMeasure:
"""Fetches a specified unit instance from the database by its symbol or description :post: :arg symbol: Symbol string of the unit eg 'kg' :arg description: The description of the unit :type symbol: str :type description: str"""
def __init__(self) -> None:
"""Instant... | stack_v2_sparse_classes_36k_train_034173 | 2,710 | permissive | [
{
"docstring": "Instantiates the endpoint to get a unit from the database table unit.",
"name": "__init__",
"signature": "def __init__(self) -> None"
},
{
"docstring": "Fetches a specified unit instance from the database by its symbol or description :post: :arg symbol: Symbol string of the unit ... | 2 | stack_v2_sparse_classes_30k_test_000358 | Implement the Python class `GetUnitOfMeasure` described below.
Class description:
Fetches a specified unit instance from the database by its symbol or description :post: :arg symbol: Symbol string of the unit eg 'kg' :arg description: The description of the unit :type symbol: str :type description: str
Method signatu... | Implement the Python class `GetUnitOfMeasure` described below.
Class description:
Fetches a specified unit instance from the database by its symbol or description :post: :arg symbol: Symbol string of the unit eg 'kg' :arg description: The description of the unit :type symbol: str :type description: str
Method signatu... | 5d123691d1f25d0b85e20e4e8293266bf23c9f8a | <|skeleton|>
class GetUnitOfMeasure:
"""Fetches a specified unit instance from the database by its symbol or description :post: :arg symbol: Symbol string of the unit eg 'kg' :arg description: The description of the unit :type symbol: str :type description: str"""
def __init__(self) -> None:
"""Instant... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GetUnitOfMeasure:
"""Fetches a specified unit instance from the database by its symbol or description :post: :arg symbol: Symbol string of the unit eg 'kg' :arg description: The description of the unit :type symbol: str :type description: str"""
def __init__(self) -> None:
"""Instantiates the end... | the_stack_v2_python_sparse | Analytics/resources/units/get_unit.py | thanosbnt/SharingCitiesDashboard | train | 0 |
ec2e36b1d7d2ad90f8fad72e1bdc4d7fd0ec7647 | [
"file = kwargs['file']\nwith open(file, 'rb') as data_file:\n first_char = data_file.read(1)\n if not first_char:\n return\n data_file.seek(0)\n self._items = pickle.load(data_file)",
"file = kwargs['file']\nwith open(file, 'wb') as data_file:\n pickle.dump(self._items, data_file)"
] | <|body_start_0|>
file = kwargs['file']
with open(file, 'rb') as data_file:
first_char = data_file.read(1)
if not first_char:
return
data_file.seek(0)
self._items = pickle.load(data_file)
<|end_body_0|>
<|body_start_1|>
file = kwarg... | RepositoryBinary | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RepositoryBinary:
def load_data(self, **kwargs):
"""Load repository from pickle file. :param kwargs: file - file to load the data from :return:"""
<|body_0|>
def save_data(self, **kwargs):
"""Save repository to pickle file. :param kwargs: file - file to load the data... | stack_v2_sparse_classes_36k_train_034174 | 839 | no_license | [
{
"docstring": "Load repository from pickle file. :param kwargs: file - file to load the data from :return:",
"name": "load_data",
"signature": "def load_data(self, **kwargs)"
},
{
"docstring": "Save repository to pickle file. :param kwargs: file - file to load the data from :return:",
"name... | 2 | null | Implement the Python class `RepositoryBinary` described below.
Class description:
Implement the RepositoryBinary class.
Method signatures and docstrings:
- def load_data(self, **kwargs): Load repository from pickle file. :param kwargs: file - file to load the data from :return:
- def save_data(self, **kwargs): Save r... | Implement the Python class `RepositoryBinary` described below.
Class description:
Implement the RepositoryBinary class.
Method signatures and docstrings:
- def load_data(self, **kwargs): Load repository from pickle file. :param kwargs: file - file to load the data from :return:
- def save_data(self, **kwargs): Save r... | 206b049700d8a3e03b52e57960cd44f85c415fe8 | <|skeleton|>
class RepositoryBinary:
def load_data(self, **kwargs):
"""Load repository from pickle file. :param kwargs: file - file to load the data from :return:"""
<|body_0|>
def save_data(self, **kwargs):
"""Save repository to pickle file. :param kwargs: file - file to load the data... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RepositoryBinary:
def load_data(self, **kwargs):
"""Load repository from pickle file. :param kwargs: file - file to load the data from :return:"""
file = kwargs['file']
with open(file, 'rb') as data_file:
first_char = data_file.read(1)
if not first_char:
... | the_stack_v2_python_sparse | semester_1/fp/assignment_09/src/repositories/repository_binary.py | caprapaul/assignments | train | 0 | |
d82445ab1bf97a4a602a854eba6df488ba92fdfd | [
"setToken = {'userId': userId}\ns = Serializer(cls.token_secret_key, cls.token_expiration)\ntoken = s.dumps(setToken)\nreturn token",
"s = Serializer(cls.token_secret_key)\ntry:\n setToken, header = s.loads(token, return_header=True)\nexcept BaseException:\n return False\nif setToken.has_key('userId'):\n ... | <|body_start_0|>
setToken = {'userId': userId}
s = Serializer(cls.token_secret_key, cls.token_expiration)
token = s.dumps(setToken)
return token
<|end_body_0|>
<|body_start_1|>
s = Serializer(cls.token_secret_key)
try:
setToken, header = s.loads(token, return... | 用户认证类 | Authentication | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Authentication:
"""用户认证类"""
def generateToken(cls, userId):
"""生成token"""
<|body_0|>
def verifyToken(cls, token):
"""token验证"""
<|body_1|>
def getVerifyToken(cls, token):
"""获得token内容信息"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_36k_train_034175 | 1,467 | no_license | [
{
"docstring": "生成token",
"name": "generateToken",
"signature": "def generateToken(cls, userId)"
},
{
"docstring": "token验证",
"name": "verifyToken",
"signature": "def verifyToken(cls, token)"
},
{
"docstring": "获得token内容信息",
"name": "getVerifyToken",
"signature": "def get... | 3 | stack_v2_sparse_classes_30k_train_014379 | Implement the Python class `Authentication` described below.
Class description:
用户认证类
Method signatures and docstrings:
- def generateToken(cls, userId): 生成token
- def verifyToken(cls, token): token验证
- def getVerifyToken(cls, token): 获得token内容信息 | Implement the Python class `Authentication` described below.
Class description:
用户认证类
Method signatures and docstrings:
- def generateToken(cls, userId): 生成token
- def verifyToken(cls, token): token验证
- def getVerifyToken(cls, token): 获得token内容信息
<|skeleton|>
class Authentication:
"""用户认证类"""
def generateTo... | 5feaf8b466c125e93fd08f31cc0eed99c9b4d164 | <|skeleton|>
class Authentication:
"""用户认证类"""
def generateToken(cls, userId):
"""生成token"""
<|body_0|>
def verifyToken(cls, token):
"""token验证"""
<|body_1|>
def getVerifyToken(cls, token):
"""获得token内容信息"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Authentication:
"""用户认证类"""
def generateToken(cls, userId):
"""生成token"""
setToken = {'userId': userId}
s = Serializer(cls.token_secret_key, cls.token_expiration)
token = s.dumps(setToken)
return token
def verifyToken(cls, token):
"""token验证"""
... | the_stack_v2_python_sparse | base/authentication/Authentication.py | goodcan/financial-system-backend | train | 1 |
902e665e9b46536b37710e8868871ab87a23c6c6 | [
"self.cel_valor = cel_valor\nself.cel_posicion = cel_posicion\nself.cel_visitada = False\nself.cel_controlador = None\nself.cel_simbolo = ''",
"if len(str(self.cel_valor)) % 2 == 0:\n if self.cel_controlador == juego_tablero.tab_jugadores[0].jug_nombre:\n return f'{self.cel_simbolo}{self.cel_valor}{self... | <|body_start_0|>
self.cel_valor = cel_valor
self.cel_posicion = cel_posicion
self.cel_visitada = False
self.cel_controlador = None
self.cel_simbolo = ''
<|end_body_0|>
<|body_start_1|>
if len(str(self.cel_valor)) % 2 == 0:
if self.cel_controlador == juego_tab... | Celda | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Celda:
def __init__(self, cel_valor, cel_posicion):
""":param cel_valor: int : valor numerico que tiene la celda :param cel_posicion: list : [x, y] : lista con componente x, y de la posicion de la celda en la matriz"""
<|body_0|>
def __str__(self):
""":return: str : ... | stack_v2_sparse_classes_36k_train_034176 | 34,093 | no_license | [
{
"docstring": ":param cel_valor: int : valor numerico que tiene la celda :param cel_posicion: list : [x, y] : lista con componente x, y de la posicion de la celda en la matriz",
"name": "__init__",
"signature": "def __init__(self, cel_valor, cel_posicion)"
},
{
"docstring": ":return: str : cade... | 2 | stack_v2_sparse_classes_30k_train_003664 | Implement the Python class `Celda` described below.
Class description:
Implement the Celda class.
Method signatures and docstrings:
- def __init__(self, cel_valor, cel_posicion): :param cel_valor: int : valor numerico que tiene la celda :param cel_posicion: list : [x, y] : lista con componente x, y de la posicion de ... | Implement the Python class `Celda` described below.
Class description:
Implement the Celda class.
Method signatures and docstrings:
- def __init__(self, cel_valor, cel_posicion): :param cel_valor: int : valor numerico que tiene la celda :param cel_posicion: list : [x, y] : lista con componente x, y de la posicion de ... | 4cde441eb614686a033da88ac1d6b753aa2a650a | <|skeleton|>
class Celda:
def __init__(self, cel_valor, cel_posicion):
""":param cel_valor: int : valor numerico que tiene la celda :param cel_posicion: list : [x, y] : lista con componente x, y de la posicion de la celda en la matriz"""
<|body_0|>
def __str__(self):
""":return: str : ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Celda:
def __init__(self, cel_valor, cel_posicion):
""":param cel_valor: int : valor numerico que tiene la celda :param cel_posicion: list : [x, y] : lista con componente x, y de la posicion de la celda en la matriz"""
self.cel_valor = cel_valor
self.cel_posicion = cel_posicion
... | the_stack_v2_python_sparse | MCD-ITESO/IDI-1/Tareas/Tarea8/termin_ai_tor.py | IFFranciscoME/FinTechLab | train | 1 | |
002c469bd1ed9c15918a9194cb968ec187203d0b | [
"try:\n self.sig_maker = _librsync.new_sigmaker(blocksize)\nexcept _librsync.librsyncError as e:\n raise librsyncError(str(e))\nself.gotsig = None\nself.buffer = ''\nself.sigstring_list = []",
"if self.gotsig:\n raise librsyncError('SigGenerator already provided signature')\nself.buffer += buf\nwhile len... | <|body_start_0|>
try:
self.sig_maker = _librsync.new_sigmaker(blocksize)
except _librsync.librsyncError as e:
raise librsyncError(str(e))
self.gotsig = None
self.buffer = ''
self.sigstring_list = []
<|end_body_0|>
<|body_start_1|>
if self.gotsig:
... | Calculate signature. Input and output is same as SigFile, but the interface is like md5 module, not filelike object | SigGenerator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SigGenerator:
"""Calculate signature. Input and output is same as SigFile, but the interface is like md5 module, not filelike object"""
def __init__(self, blocksize=_librsync.RS_DEFAULT_BLOCK_LEN):
"""Return new signature instance"""
<|body_0|>
def update(self, buf):
... | stack_v2_sparse_classes_36k_train_034177 | 8,383 | no_license | [
{
"docstring": "Return new signature instance",
"name": "__init__",
"signature": "def __init__(self, blocksize=_librsync.RS_DEFAULT_BLOCK_LEN)"
},
{
"docstring": "Add buf to data that signature will be calculated over",
"name": "update",
"signature": "def update(self, buf)"
},
{
... | 4 | stack_v2_sparse_classes_30k_train_017467 | Implement the Python class `SigGenerator` described below.
Class description:
Calculate signature. Input and output is same as SigFile, but the interface is like md5 module, not filelike object
Method signatures and docstrings:
- def __init__(self, blocksize=_librsync.RS_DEFAULT_BLOCK_LEN): Return new signature insta... | Implement the Python class `SigGenerator` described below.
Class description:
Calculate signature. Input and output is same as SigFile, but the interface is like md5 module, not filelike object
Method signatures and docstrings:
- def __init__(self, blocksize=_librsync.RS_DEFAULT_BLOCK_LEN): Return new signature insta... | ef6d0f4bdff52be379784325e504de22cfe149de | <|skeleton|>
class SigGenerator:
"""Calculate signature. Input and output is same as SigFile, but the interface is like md5 module, not filelike object"""
def __init__(self, blocksize=_librsync.RS_DEFAULT_BLOCK_LEN):
"""Return new signature instance"""
<|body_0|>
def update(self, buf):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SigGenerator:
"""Calculate signature. Input and output is same as SigFile, but the interface is like md5 module, not filelike object"""
def __init__(self, blocksize=_librsync.RS_DEFAULT_BLOCK_LEN):
"""Return new signature instance"""
try:
self.sig_maker = _librsync.new_sigmake... | the_stack_v2_python_sparse | duplicity/librsync.py | henrysher/duplicity | train | 90 |
98146c796c1d61f4f9a8de0d548ecabe5c3284b9 | [
"super(NeRFNetwork, self).__init__()\nself.device = device\nself.in_dim = in_dim\nself.hidden_dim = hidden_dim\nself.rgb_dim = rgb_dim\nself.style_dim = style_dim\nself.hidden_layers = hidden_layers\nself.name_prefix = name_prefix\nself.style_dim_dict = {}\nself.network = nn.ModuleList()\n_out_dim = in_dim\nfor idx... | <|body_start_0|>
super(NeRFNetwork, self).__init__()
self.device = device
self.in_dim = in_dim
self.hidden_dim = hidden_dim
self.rgb_dim = rgb_dim
self.style_dim = style_dim
self.hidden_layers = hidden_layers
self.name_prefix = name_prefix
self.sty... | Same architecture as TALLSIREN but adds a UniformBoxWarp to map input points to -1, 1 | NeRFNetwork_Small | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NeRFNetwork_Small:
"""Same architecture as TALLSIREN but adds a UniformBoxWarp to map input points to -1, 1"""
def __init__(self, in_dim=3, hidden_dim=256, rgb_dim=3, style_dim=512, hidden_layers=2, device=None, name_prefix='nerf', **kwargs):
""":param z_dim: :param hidden_dim: :para... | stack_v2_sparse_classes_36k_train_034178 | 22,624 | permissive | [
{
"docstring": ":param z_dim: :param hidden_dim: :param rgb_dim: :param device: :param kwargs:",
"name": "__init__",
"signature": "def __init__(self, in_dim=3, hidden_dim=256, rgb_dim=3, style_dim=512, hidden_layers=2, device=None, name_prefix='nerf', **kwargs)"
},
{
"docstring": ":param input: ... | 2 | stack_v2_sparse_classes_30k_train_015804 | Implement the Python class `NeRFNetwork_Small` described below.
Class description:
Same architecture as TALLSIREN but adds a UniformBoxWarp to map input points to -1, 1
Method signatures and docstrings:
- def __init__(self, in_dim=3, hidden_dim=256, rgb_dim=3, style_dim=512, hidden_layers=2, device=None, name_prefix=... | Implement the Python class `NeRFNetwork_Small` described below.
Class description:
Same architecture as TALLSIREN but adds a UniformBoxWarp to map input points to -1, 1
Method signatures and docstrings:
- def __init__(self, in_dim=3, hidden_dim=256, rgb_dim=3, style_dim=512, hidden_layers=2, device=None, name_prefix=... | 9244193048c73f55270d2df28fb160f42d5953ad | <|skeleton|>
class NeRFNetwork_Small:
"""Same architecture as TALLSIREN but adds a UniformBoxWarp to map input points to -1, 1"""
def __init__(self, in_dim=3, hidden_dim=256, rgb_dim=3, style_dim=512, hidden_layers=2, device=None, name_prefix='nerf', **kwargs):
""":param z_dim: :param hidden_dim: :para... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NeRFNetwork_Small:
"""Same architecture as TALLSIREN but adds a UniformBoxWarp to map input points to -1, 1"""
def __init__(self, in_dim=3, hidden_dim=256, rgb_dim=3, style_dim=512, hidden_layers=2, device=None, name_prefix='nerf', **kwargs):
""":param z_dim: :param hidden_dim: :param rgb_dim: :p... | the_stack_v2_python_sparse | exp/comm/models/nerf_network.py | tonywork/CIPS-3D | train | 0 |
702f2e341bed5c738fa7933090cea88f6fef50cc | [
"self.head = head\nself.length = 0\nnode = head\nwhile node:\n node = node.next\n self.length += 1",
"index = random.randrange(0, self.length)\nnode = self.head\nwhile index:\n node = node.next\n index -= 1\nreturn node.val"
] | <|body_start_0|>
self.head = head
self.length = 0
node = head
while node:
node = node.next
self.length += 1
<|end_body_0|>
<|body_start_1|>
index = random.randrange(0, self.length)
node = self.head
while index:
node = node.next... | Solution1 | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution1:
def __init__(self, head):
"""@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode"""
<|body_0|>
def getRandom(self):
"""Returns a random node's value. :rtype: int"""
... | stack_v2_sparse_classes_36k_train_034179 | 2,037 | permissive | [
{
"docstring": "@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode",
"name": "__init__",
"signature": "def __init__(self, head)"
},
{
"docstring": "Returns a random node's value. :rtype: int",
"name": "g... | 2 | stack_v2_sparse_classes_30k_train_016243 | Implement the Python class `Solution1` described below.
Class description:
Implement the Solution1 class.
Method signatures and docstrings:
- def __init__(self, head): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode
- def getR... | Implement the Python class `Solution1` described below.
Class description:
Implement the Solution1 class.
Method signatures and docstrings:
- def __init__(self, head): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode
- def getR... | 56b99c829921c534dead1563db726042bbd7155d | <|skeleton|>
class Solution1:
def __init__(self, head):
"""@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode"""
<|body_0|>
def getRandom(self):
"""Returns a random node's value. :rtype: int"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution1:
def __init__(self, head):
"""@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode"""
self.head = head
self.length = 0
node = head
while node:
node = node.next
... | the_stack_v2_python_sparse | python/problems/linked_list_random_node.py | vivaxy/algorithms | train | 1 | |
fda3e0c1928384564a0e661b68a02f6458ebf50e | [
"super().__init__(message.as_dict(), namespaced)\nself._message = message\nself.__module__ = 'libpod'",
"if hasattr(self._message, method):\n return getattr(self._message, method)\ntry:\n return self._message.parameters()[method]\nexcept KeyError as ex:\n raise AttributeError('No such attribute: {}'.form... | <|body_start_0|>
super().__init__(message.as_dict(), namespaced)
self._message = message
self.__module__ = 'libpod'
<|end_body_0|>
<|body_start_1|>
if hasattr(self._message, method):
return getattr(self._message, method)
try:
return self._message.paramete... | Class to Proxy VarlinkError methods. | VarlinkErrorProxy | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VarlinkErrorProxy:
"""Class to Proxy VarlinkError methods."""
def __init__(self, message, namespaced=False):
"""Construct proxy from Exception."""
<|body_0|>
def __getattr__(self, method):
"""Return attribute from proxied Exception."""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_36k_train_034180 | 2,437 | permissive | [
{
"docstring": "Construct proxy from Exception.",
"name": "__init__",
"signature": "def __init__(self, message, namespaced=False)"
},
{
"docstring": "Return attribute from proxied Exception.",
"name": "__getattr__",
"signature": "def __getattr__(self, method)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006562 | Implement the Python class `VarlinkErrorProxy` described below.
Class description:
Class to Proxy VarlinkError methods.
Method signatures and docstrings:
- def __init__(self, message, namespaced=False): Construct proxy from Exception.
- def __getattr__(self, method): Return attribute from proxied Exception. | Implement the Python class `VarlinkErrorProxy` described below.
Class description:
Class to Proxy VarlinkError methods.
Method signatures and docstrings:
- def __init__(self, message, namespaced=False): Construct proxy from Exception.
- def __getattr__(self, method): Return attribute from proxied Exception.
<|skelet... | ce2a8734f8b4203ec38078207297062263c49f6f | <|skeleton|>
class VarlinkErrorProxy:
"""Class to Proxy VarlinkError methods."""
def __init__(self, message, namespaced=False):
"""Construct proxy from Exception."""
<|body_0|>
def __getattr__(self, method):
"""Return attribute from proxied Exception."""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VarlinkErrorProxy:
"""Class to Proxy VarlinkError methods."""
def __init__(self, message, namespaced=False):
"""Construct proxy from Exception."""
super().__init__(message.as_dict(), namespaced)
self._message = message
self.__module__ = 'libpod'
def __getattr__(self, ... | the_stack_v2_python_sparse | tobiko/podman/_podman1/libs/errors.py | FedericoRessi/tobiko | train | 1 |
b5666fbb3af62fe0f4f38e3403d46b938c0c423e | [
"super().__init__(problem)\nself.best_path = None\nself.bound = bound",
"self.frontier = [Path(self.problem.start_node())]\nself.num_expanded = 0\nwhile self.frontier:\n path = self.frontier.pop()\n if path.cost + self.problem.heuristic(path.end()) < self.bound:\n self.display(3, 'Expanding:', path, ... | <|body_start_0|>
super().__init__(problem)
self.best_path = None
self.bound = bound
<|end_body_0|>
<|body_start_1|>
self.frontier = [Path(self.problem.start_node())]
self.num_expanded = 0
while self.frontier:
path = self.frontier.pop()
if path.cos... | returns a branch and bound searcher for a problem. An optimal path with cost less than bound can be found by calling search() | DF_branch_and_bound | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DF_branch_and_bound:
"""returns a branch and bound searcher for a problem. An optimal path with cost less than bound can be found by calling search()"""
def __init__(self, problem, bound=float('inf')):
"""creates a searcher than can be used with search() to find an optimal path. boun... | stack_v2_sparse_classes_36k_train_034181 | 2,841 | no_license | [
{
"docstring": "creates a searcher than can be used with search() to find an optimal path. bound gives the initial bound. By default this is infinite - meaning there is no initial pruning due to depth bound",
"name": "__init__",
"signature": "def __init__(self, problem, bound=float('inf'))"
},
{
... | 2 | stack_v2_sparse_classes_30k_train_010461 | Implement the Python class `DF_branch_and_bound` described below.
Class description:
returns a branch and bound searcher for a problem. An optimal path with cost less than bound can be found by calling search()
Method signatures and docstrings:
- def __init__(self, problem, bound=float('inf')): creates a searcher tha... | Implement the Python class `DF_branch_and_bound` described below.
Class description:
returns a branch and bound searcher for a problem. An optimal path with cost less than bound can be found by calling search()
Method signatures and docstrings:
- def __init__(self, problem, bound=float('inf')): creates a searcher tha... | 479d6120b75ac0ff602f032474cad440cadd9f31 | <|skeleton|>
class DF_branch_and_bound:
"""returns a branch and bound searcher for a problem. An optimal path with cost less than bound can be found by calling search()"""
def __init__(self, problem, bound=float('inf')):
"""creates a searcher than can be used with search() to find an optimal path. boun... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DF_branch_and_bound:
"""returns a branch and bound searcher for a problem. An optimal path with cost less than bound can be found by calling search()"""
def __init__(self, problem, bound=float('inf')):
"""creates a searcher than can be used with search() to find an optimal path. bound gives the i... | the_stack_v2_python_sparse | ass1/aipython/searchBranchAndBound.py | fckphil/COMP9814 | train | 5 |
b1097aff807464567e7df884146279f2fe3384e7 | [
"print(self.id_card)\nparam = {'idcard': self.id_card, 'username': 'api' + self.id_card + '_1', 'nationality': '汉族', 'maritalstatus': 0, 'level': 1, 'contact1': '15212365478', 'residenceaddress': '5101090201', 'address': '测试详细地址', 'emergencycontact1name': '测试', 'emergencycontact1address': '测试地址', 'emergencycontact1... | <|body_start_0|>
print(self.id_card)
param = {'idcard': self.id_card, 'username': 'api' + self.id_card + '_1', 'nationality': '汉族', 'maritalstatus': 0, 'level': 1, 'contact1': '15212365478', 'residenceaddress': '5101090201', 'address': '测试详细地址', 'emergencycontact1name': '测试', 'emergencycontact1address':... | TestBusiness1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestBusiness1:
def test_001(self):
"""添加人员-级别为:普通老人"""
<|body_0|>
def test_002(self):
"""政府端:根据身份证号查询UID"""
<|body_1|>
def test_003(self):
"""积分充值"""
<|body_2|>
def test_004(self):
"""服务订单生成"""
<|body_3|>
<|end_skele... | stack_v2_sparse_classes_36k_train_034182 | 3,118 | no_license | [
{
"docstring": "添加人员-级别为:普通老人",
"name": "test_001",
"signature": "def test_001(self)"
},
{
"docstring": "政府端:根据身份证号查询UID",
"name": "test_002",
"signature": "def test_002(self)"
},
{
"docstring": "积分充值",
"name": "test_003",
"signature": "def test_003(self)"
},
{
"d... | 4 | stack_v2_sparse_classes_30k_train_015254 | Implement the Python class `TestBusiness1` described below.
Class description:
Implement the TestBusiness1 class.
Method signatures and docstrings:
- def test_001(self): 添加人员-级别为:普通老人
- def test_002(self): 政府端:根据身份证号查询UID
- def test_003(self): 积分充值
- def test_004(self): 服务订单生成 | Implement the Python class `TestBusiness1` described below.
Class description:
Implement the TestBusiness1 class.
Method signatures and docstrings:
- def test_001(self): 添加人员-级别为:普通老人
- def test_002(self): 政府端:根据身份证号查询UID
- def test_003(self): 积分充值
- def test_004(self): 服务订单生成
<|skeleton|>
class TestBusiness1:
... | 024bb8f0e8be7d19abfb14b405ef79bd85cc6b7b | <|skeleton|>
class TestBusiness1:
def test_001(self):
"""添加人员-级别为:普通老人"""
<|body_0|>
def test_002(self):
"""政府端:根据身份证号查询UID"""
<|body_1|>
def test_003(self):
"""积分充值"""
<|body_2|>
def test_004(self):
"""服务订单生成"""
<|body_3|>
<|end_skele... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestBusiness1:
def test_001(self):
"""添加人员-级别为:普通老人"""
print(self.id_card)
param = {'idcard': self.id_card, 'username': 'api' + self.id_card + '_1', 'nationality': '汉族', 'maritalstatus': 0, 'level': 1, 'contact1': '15212365478', 'residenceaddress': '5101090201', 'address': '测试详细地址', 'e... | the_stack_v2_python_sparse | test_case/test_business/test_business_1_flow.py | cjuan123/auto_api | train | 0 | |
25567b440022713db26db2ac61a255f8a20ec988 | [
"self.type = 'ac'\nself.value = value\nself.timesZero = timesZero",
"sum = 0\nif self.timesZero > 1:\n sum += 2\nelif self.timesZero > 0:\n sum += 1\nreturn sum + 1"
] | <|body_start_0|>
self.type = 'ac'
self.value = value
self.timesZero = timesZero
<|end_body_0|>
<|body_start_1|>
sum = 0
if self.timesZero > 1:
sum += 2
elif self.timesZero > 0:
sum += 1
return sum + 1
<|end_body_1|>
| Descriptor for AC values | ac | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ac:
"""Descriptor for AC values"""
def __init__(self, value, timesZero):
""":param value: value to save in descriptor :param timesZero: count of leading zeros"""
<|body_0|>
def length(self):
"""Get count of values in this descriptor"""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_36k_train_034183 | 4,023 | no_license | [
{
"docstring": ":param value: value to save in descriptor :param timesZero: count of leading zeros",
"name": "__init__",
"signature": "def __init__(self, value, timesZero)"
},
{
"docstring": "Get count of values in this descriptor",
"name": "length",
"signature": "def length(self)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000530 | Implement the Python class `ac` described below.
Class description:
Descriptor for AC values
Method signatures and docstrings:
- def __init__(self, value, timesZero): :param value: value to save in descriptor :param timesZero: count of leading zeros
- def length(self): Get count of values in this descriptor | Implement the Python class `ac` described below.
Class description:
Descriptor for AC values
Method signatures and docstrings:
- def __init__(self, value, timesZero): :param value: value to save in descriptor :param timesZero: count of leading zeros
- def length(self): Get count of values in this descriptor
<|skelet... | 6d0e768de7deb7d6029d07441afefd4699df97d7 | <|skeleton|>
class ac:
"""Descriptor for AC values"""
def __init__(self, value, timesZero):
""":param value: value to save in descriptor :param timesZero: count of leading zeros"""
<|body_0|>
def length(self):
"""Get count of values in this descriptor"""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ac:
"""Descriptor for AC values"""
def __init__(self, value, timesZero):
""":param value: value to save in descriptor :param timesZero: count of leading zeros"""
self.type = 'ac'
self.value = value
self.timesZero = timesZero
def length(self):
"""Get count of v... | the_stack_v2_python_sparse | Arbeit/src/entropycoder.py | juxbo/Grundlagen-der-Videokompression---Wissenschaftliches-Arbeiten-I | train | 0 |
bc2dfa0aa1f1aa977745b410566de6a4f4166f92 | [
"super().__init__()\nself.constant_attention = constant_attention\nself.w = self.add_weight(name='w', shape=(node_feature_dim, out_node_feature_dim), initializer='glorot_uniform', regularizer='l2', trainable=True)\nself.a = self.add_weight(name='a', shape=(2 * out_node_feature_dim, 1), initializer='glorot_uniform',... | <|body_start_0|>
super().__init__()
self.constant_attention = constant_attention
self.w = self.add_weight(name='w', shape=(node_feature_dim, out_node_feature_dim), initializer='glorot_uniform', regularizer='l2', trainable=True)
self.a = self.add_weight(name='a', shape=(2 * out_node_featu... | A layer that implements graph attention. | GraphAttentionLayer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GraphAttentionLayer:
"""A layer that implements graph attention."""
def __init__(self, node_feature_dim, out_node_feature_dim, constant_attention=False):
"""Construct a graph attention layer. Args: node_feature_dim: dimension (integer) of incoming node level features. An incoming ten... | stack_v2_sparse_classes_36k_train_034184 | 14,737 | permissive | [
{
"docstring": "Construct a graph attention layer. Args: node_feature_dim: dimension (integer) of incoming node level features. An incoming tensor should have dimension of (batch_size, num_nodes, node_feature_dim). out_node_feature_dim: dimension (integer) of outcoming node level features. An outcoming tensor s... | 5 | null | Implement the Python class `GraphAttentionLayer` described below.
Class description:
A layer that implements graph attention.
Method signatures and docstrings:
- def __init__(self, node_feature_dim, out_node_feature_dim, constant_attention=False): Construct a graph attention layer. Args: node_feature_dim: dimension (... | Implement the Python class `GraphAttentionLayer` described below.
Class description:
A layer that implements graph attention.
Method signatures and docstrings:
- def __init__(self, node_feature_dim, out_node_feature_dim, constant_attention=False): Construct a graph attention layer. Args: node_feature_dim: dimension (... | f5f6f50f82bd441339c9d9efbef3f09e72c5fef6 | <|skeleton|>
class GraphAttentionLayer:
"""A layer that implements graph attention."""
def __init__(self, node_feature_dim, out_node_feature_dim, constant_attention=False):
"""Construct a graph attention layer. Args: node_feature_dim: dimension (integer) of incoming node level features. An incoming ten... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GraphAttentionLayer:
"""A layer that implements graph attention."""
def __init__(self, node_feature_dim, out_node_feature_dim, constant_attention=False):
"""Construct a graph attention layer. Args: node_feature_dim: dimension (integer) of incoming node level features. An incoming tensor should ha... | the_stack_v2_python_sparse | uncertainty_baselines/models/gat.py | google/uncertainty-baselines | train | 1,235 |
659214f744b8426f6166be567f1b4614d19fe439 | [
"super().__init__((from_eft, from_basis, to_eft, to_basis))\nself.from_eft = from_eft\nself.from_basis = from_basis\nself.to_eft = to_eft\nself.to_basis = to_basis\nself.function = function",
"dict_out = self.function(WC_in.dict, WC_in.scale, parameters)\ndict_out = {k: v for k, v in dict_out.items() if v != 0}\n... | <|body_start_0|>
super().__init__((from_eft, from_basis, to_eft, to_basis))
self.from_eft = from_eft
self.from_basis = from_basis
self.to_eft = to_eft
self.to_basis = to_basis
self.function = function
<|end_body_0|>
<|body_start_1|>
dict_out = self.function(WC_in... | Class for matching from a UV to an IR EFT. | Matcher | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Matcher:
"""Class for matching from a UV to an IR EFT."""
def __init__(self, from_eft, from_basis, to_eft, to_basis, function):
"""Initialize the Matcher instance."""
<|body_0|>
def match(self, WC_in, parameters=None):
"""Translate a WC object in EFT `from_eft` a... | stack_v2_sparse_classes_36k_train_034185 | 20,357 | permissive | [
{
"docstring": "Initialize the Matcher instance.",
"name": "__init__",
"signature": "def __init__(self, from_eft, from_basis, to_eft, to_basis, function)"
},
{
"docstring": "Translate a WC object in EFT `from_eft` and basis `from_basis` to EFT `to_eft` and basis `to_basis`.",
"name": "match"... | 2 | stack_v2_sparse_classes_30k_train_003839 | Implement the Python class `Matcher` described below.
Class description:
Class for matching from a UV to an IR EFT.
Method signatures and docstrings:
- def __init__(self, from_eft, from_basis, to_eft, to_basis, function): Initialize the Matcher instance.
- def match(self, WC_in, parameters=None): Translate a WC objec... | Implement the Python class `Matcher` described below.
Class description:
Class for matching from a UV to an IR EFT.
Method signatures and docstrings:
- def __init__(self, from_eft, from_basis, to_eft, to_basis, function): Initialize the Matcher instance.
- def match(self, WC_in, parameters=None): Translate a WC objec... | ed6f8ccba2bf267094c4c911ea2e050cbd1f0c74 | <|skeleton|>
class Matcher:
"""Class for matching from a UV to an IR EFT."""
def __init__(self, from_eft, from_basis, to_eft, to_basis, function):
"""Initialize the Matcher instance."""
<|body_0|>
def match(self, WC_in, parameters=None):
"""Translate a WC object in EFT `from_eft` a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Matcher:
"""Class for matching from a UV to an IR EFT."""
def __init__(self, from_eft, from_basis, to_eft, to_basis, function):
"""Initialize the Matcher instance."""
super().__init__((from_eft, from_basis, to_eft, to_basis))
self.from_eft = from_eft
self.from_basis = from... | the_stack_v2_python_sparse | wilson/wcxf/classes.py | wilson-eft/wilson | train | 30 |
2ca8b52e3f9e8f2192f8b33935f2d363cd13fc38 | [
"connection = pymysql.connect(host='31.31.196.245', user='u0981115', password='qwert5656', database='u0981115_itsunrise', charset='utf8mb4')\ncursor = connection.cursor()\ncursor.execute(self)\nOTV = cursor.fetchall()\nreturn OTV",
"connection = pymysql.connect(host='31.31.196.245', user='u0981115', password='qwe... | <|body_start_0|>
connection = pymysql.connect(host='31.31.196.245', user='u0981115', password='qwert5656', database='u0981115_itsunrise', charset='utf8mb4')
cursor = connection.cursor()
cursor.execute(self)
OTV = cursor.fetchall()
return OTV
<|end_body_0|>
<|body_start_1|>
... | Работа с Базой данных получить данные:: DB.GET('Текст запроса SQL') отправить данные:: DB.POST('Текст запроса SQL') | DB | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DB:
"""Работа с Базой данных получить данные:: DB.GET('Текст запроса SQL') отправить данные:: DB.POST('Текст запроса SQL')"""
def GET(self):
"""Получает данные с Базы данных"""
<|body_0|>
def POST(self):
"""Отправляет данные в Базу данных"""
<|body_1|>
<... | stack_v2_sparse_classes_36k_train_034186 | 8,580 | no_license | [
{
"docstring": "Получает данные с Базы данных",
"name": "GET",
"signature": "def GET(self)"
},
{
"docstring": "Отправляет данные в Базу данных",
"name": "POST",
"signature": "def POST(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_018411 | Implement the Python class `DB` described below.
Class description:
Работа с Базой данных получить данные:: DB.GET('Текст запроса SQL') отправить данные:: DB.POST('Текст запроса SQL')
Method signatures and docstrings:
- def GET(self): Получает данные с Базы данных
- def POST(self): Отправляет данные в Базу данных | Implement the Python class `DB` described below.
Class description:
Работа с Базой данных получить данные:: DB.GET('Текст запроса SQL') отправить данные:: DB.POST('Текст запроса SQL')
Method signatures and docstrings:
- def GET(self): Получает данные с Базы данных
- def POST(self): Отправляет данные в Базу данных
<|... | 0b9727d2c7ef8b76d4ed5a3344f17bfb215f9c73 | <|skeleton|>
class DB:
"""Работа с Базой данных получить данные:: DB.GET('Текст запроса SQL') отправить данные:: DB.POST('Текст запроса SQL')"""
def GET(self):
"""Получает данные с Базы данных"""
<|body_0|>
def POST(self):
"""Отправляет данные в Базу данных"""
<|body_1|>
<... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DB:
"""Работа с Базой данных получить данные:: DB.GET('Текст запроса SQL') отправить данные:: DB.POST('Текст запроса SQL')"""
def GET(self):
"""Получает данные с Базы данных"""
connection = pymysql.connect(host='31.31.196.245', user='u0981115', password='qwert5656', database='u0981115_its... | the_stack_v2_python_sparse | site/site.py | WTTeneger/ITSunrise_MCH | train | 0 |
6c0705b20a5361dac2c925d5851bedb4cfab0457 | [
"assert user_id\npayload = json.loads(self.request.body)\nplate = payload.get('plate', False)\nassert plate\nis_valid_plate = (yield _verify_vehicle_belonging(user_id=user_id, plate=plate))\nif is_valid_plate:\n removed = (yield ParkingLotRepository.remove(plate=plate))\n if not removed:\n raise Invali... | <|body_start_0|>
assert user_id
payload = json.loads(self.request.body)
plate = payload.get('plate', False)
assert plate
is_valid_plate = (yield _verify_vehicle_belonging(user_id=user_id, plate=plate))
if is_valid_plate:
removed = (yield ParkingLotRepository.r... | ParkingLotHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParkingLotHandler:
def post(self, user_id):
"""Check out :param user_id: :return:"""
<|body_0|>
def put(self, user_id):
"""Check in request format: { "plate": "123456", "longitude": 123.123, "latitude": 456.123, "level": None } return format: { "parking_space": { "pl... | stack_v2_sparse_classes_36k_train_034187 | 12,835 | no_license | [
{
"docstring": "Check out :param user_id: :return:",
"name": "post",
"signature": "def post(self, user_id)"
},
{
"docstring": "Check in request format: { \"plate\": \"123456\", \"longitude\": 123.123, \"latitude\": 456.123, \"level\": None } return format: { \"parking_space\": { \"plate\": \"123... | 3 | stack_v2_sparse_classes_30k_train_001920 | Implement the Python class `ParkingLotHandler` described below.
Class description:
Implement the ParkingLotHandler class.
Method signatures and docstrings:
- def post(self, user_id): Check out :param user_id: :return:
- def put(self, user_id): Check in request format: { "plate": "123456", "longitude": 123.123, "latit... | Implement the Python class `ParkingLotHandler` described below.
Class description:
Implement the ParkingLotHandler class.
Method signatures and docstrings:
- def post(self, user_id): Check out :param user_id: :return:
- def put(self, user_id): Check in request format: { "plate": "123456", "longitude": 123.123, "latit... | fd759c16b9864f6b1b47b1ba3f1af77f8d08af20 | <|skeleton|>
class ParkingLotHandler:
def post(self, user_id):
"""Check out :param user_id: :return:"""
<|body_0|>
def put(self, user_id):
"""Check in request format: { "plate": "123456", "longitude": 123.123, "latitude": 456.123, "level": None } return format: { "parking_space": { "pl... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ParkingLotHandler:
def post(self, user_id):
"""Check out :param user_id: :return:"""
assert user_id
payload = json.loads(self.request.body)
plate = payload.get('plate', False)
assert plate
is_valid_plate = (yield _verify_vehicle_belonging(user_id=user_id, plate=... | the_stack_v2_python_sparse | ParkingFinder/handlers/parking_space.py | Big-Lemon/ParkingFinder | train | 2 | |
97c8f9bf93a7fb14a83ce34d692cfce38d97cca4 | [
"self.media_markers = media_markers\nself.caption_marker = caption_marker\nself.captions = {}",
"for pair1, pair2 in _bigrams(entry):\n marker1, content1 = pair1\n marker2, content2 = pair2\n if marker1 in self.media_markers and marker2 == self.caption_marker:\n for file_id in re.split('\\\\s*;\\\... | <|body_start_0|>
self.media_markers = media_markers
self.caption_marker = caption_marker
self.captions = {}
<|end_body_0|>
<|body_start_1|>
for pair1, pair2 in _bigrams(entry):
marker1, content1 = pair1
marker2, content2 = pair2
if marker1 in self.med... | Visitor, which links captions to media files. It looks for SFM markers containing file names and checks if the adjacent marker contains a caption. | CaptionFinder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CaptionFinder:
"""Visitor, which links captions to media files. It looks for SFM markers containing file names and checks if the adjacent marker contains a caption."""
def __init__(self, media_markers, caption_marker):
"""Create a caption finder. :args media_markers: markers, which c... | stack_v2_sparse_classes_36k_train_034188 | 44,273 | permissive | [
{
"docstring": "Create a caption finder. :args media_markers: markers, which contain media file names. :args caption_marker: marker, which contains the caption.",
"name": "__init__",
"signature": "def __init__(self, media_markers, caption_marker)"
},
{
"docstring": "Extract captions for media fi... | 2 | stack_v2_sparse_classes_30k_train_014353 | Implement the Python class `CaptionFinder` described below.
Class description:
Visitor, which links captions to media files. It looks for SFM markers containing file names and checks if the adjacent marker contains a caption.
Method signatures and docstrings:
- def __init__(self, media_markers, caption_marker): Creat... | Implement the Python class `CaptionFinder` described below.
Class description:
Visitor, which links captions to media files. It looks for SFM markers containing file names and checks if the adjacent marker contains a caption.
Method signatures and docstrings:
- def __init__(self, media_markers, caption_marker): Creat... | 9fcb35608ab7ce0df3f02a88aba893ce3920e48a | <|skeleton|>
class CaptionFinder:
"""Visitor, which links captions to media files. It looks for SFM markers containing file names and checks if the adjacent marker contains a caption."""
def __init__(self, media_markers, caption_marker):
"""Create a caption finder. :args media_markers: markers, which c... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CaptionFinder:
"""Visitor, which links captions to media files. It looks for SFM markers containing file names and checks if the adjacent marker contains a caption."""
def __init__(self, media_markers, caption_marker):
"""Create a caption finder. :args media_markers: markers, which contain media ... | the_stack_v2_python_sparse | src/pydictionaria/sfm2cldf.py | dictionaria/pydictionaria | train | 1 |
a569d13be0708392f855863b48568f42128abc76 | [
"self.get_compression_type_string(compression_type)\nself.compression_type = compression_type\nself.flush_mode = flush_mode\nself.input_buffer_size = input_buffer_size\nself.output_buffer_size = output_buffer_size\nself.window_bits = window_bits\nself.compression_level = compression_level\nself.compression_method =... | <|body_start_0|>
self.get_compression_type_string(compression_type)
self.compression_type = compression_type
self.flush_mode = flush_mode
self.input_buffer_size = input_buffer_size
self.output_buffer_size = output_buffer_size
self.window_bits = window_bits
self.co... | Options used for manipulating TFRecord files. | TFRecordOptions | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TFRecordOptions:
"""Options used for manipulating TFRecord files."""
def __init__(self, compression_type=None, flush_mode=None, input_buffer_size=None, output_buffer_size=None, window_bits=None, compression_level=None, compression_method=None, mem_level=None, compression_strategy=None):
... | stack_v2_sparse_classes_36k_train_034189 | 11,670 | permissive | [
{
"docstring": "Creates a `TFRecordOptions` instance. Options only effect TFRecordWriter when compression_type is not `None`. Documentation, details, and defaults can be found in [`zlib_compression_options.h`](https://www.tensorflow.org/code/tensorflow/core/lib/io/zlib_compression_options.h) and in the [zlib ma... | 3 | stack_v2_sparse_classes_30k_train_020897 | Implement the Python class `TFRecordOptions` described below.
Class description:
Options used for manipulating TFRecord files.
Method signatures and docstrings:
- def __init__(self, compression_type=None, flush_mode=None, input_buffer_size=None, output_buffer_size=None, window_bits=None, compression_level=None, compr... | Implement the Python class `TFRecordOptions` described below.
Class description:
Options used for manipulating TFRecord files.
Method signatures and docstrings:
- def __init__(self, compression_type=None, flush_mode=None, input_buffer_size=None, output_buffer_size=None, window_bits=None, compression_level=None, compr... | a7f3934a67900720af3d3b15389551483bee50b8 | <|skeleton|>
class TFRecordOptions:
"""Options used for manipulating TFRecord files."""
def __init__(self, compression_type=None, flush_mode=None, input_buffer_size=None, output_buffer_size=None, window_bits=None, compression_level=None, compression_method=None, mem_level=None, compression_strategy=None):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TFRecordOptions:
"""Options used for manipulating TFRecord files."""
def __init__(self, compression_type=None, flush_mode=None, input_buffer_size=None, output_buffer_size=None, window_bits=None, compression_level=None, compression_method=None, mem_level=None, compression_strategy=None):
"""Create... | the_stack_v2_python_sparse | tensorflow/python/lib/io/tf_record.py | tensorflow/tensorflow | train | 208,740 |
9d460bdc48c01f2f96900e06573704b2e8c907dd | [
"if locator:\n self.locator = locator\nelse:\n self.locator = Locator(pattern)\nif label:\n self.label = label",
"data = empty_image()\nfor nc in self.locator._sets:\n if str(datetime.datetime.strptime(nc.nominal_product_time.replace('Z', 'UTC'), '%Y-%m-%dT%H:%M:%S%Z')) == state.valid_time and self.lo... | <|body_start_0|>
if locator:
self.locator = locator
else:
self.locator = Locator(pattern)
if label:
self.label = label
<|end_body_0|>
<|body_start_1|>
data = empty_image()
for nc in self.locator._sets:
if str(datetime.datetime.strp... | saf | [
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class saf:
def __init__(self, pattern, label=None, locator=None):
"""Object to process SAF NetCDF files :pattern: shell-style glob pattern of input file(s)"""
<|body_0|>
def image(self, state):
"""gets actual data. X and Y passed to :meth:`geo.stretch_image` must be 1D arr... | stack_v2_sparse_classes_36k_train_034190 | 6,379 | permissive | [
{
"docstring": "Object to process SAF NetCDF files :pattern: shell-style glob pattern of input file(s)",
"name": "__init__",
"signature": "def __init__(self, pattern, label=None, locator=None)"
},
{
"docstring": "gets actual data. X and Y passed to :meth:`geo.stretch_image` must be 1D arrays. NW... | 2 | stack_v2_sparse_classes_30k_train_001708 | Implement the Python class `saf` described below.
Class description:
Implement the saf class.
Method signatures and docstrings:
- def __init__(self, pattern, label=None, locator=None): Object to process SAF NetCDF files :pattern: shell-style glob pattern of input file(s)
- def image(self, state): gets actual data. X ... | Implement the Python class `saf` described below.
Class description:
Implement the saf class.
Method signatures and docstrings:
- def __init__(self, pattern, label=None, locator=None): Object to process SAF NetCDF files :pattern: shell-style glob pattern of input file(s)
- def image(self, state): gets actual data. X ... | ee119b240be3e0c0f3944dbb94ec7c38aa20191f | <|skeleton|>
class saf:
def __init__(self, pattern, label=None, locator=None):
"""Object to process SAF NetCDF files :pattern: shell-style glob pattern of input file(s)"""
<|body_0|>
def image(self, state):
"""gets actual data. X and Y passed to :meth:`geo.stretch_image` must be 1D arr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class saf:
def __init__(self, pattern, label=None, locator=None):
"""Object to process SAF NetCDF files :pattern: shell-style glob pattern of input file(s)"""
if locator:
self.locator = locator
else:
self.locator = Locator(pattern)
if label:
self.l... | the_stack_v2_python_sparse | forest/saf.py | leecronce/forest | train | 0 | |
a9c1996e7a39eaa82abe2bf8a3aeb370533ea215 | [
"mock_runner = MagicMock(beam_tables.ScanDataBeamPipelineRunner)\nrun_beam_tables.run_parallel_pipelines(mock_runner, 'base', ['echo'], True, datetime.date(2020, 1, 1), datetime.date(2020, 1, 2))\nmock_runner.run_beam_pipeline.assert_called_with('echo', True, 'append-base-echo-scan', 'base.echo_scan', datetime.date... | <|body_start_0|>
mock_runner = MagicMock(beam_tables.ScanDataBeamPipelineRunner)
run_beam_tables.run_parallel_pipelines(mock_runner, 'base', ['echo'], True, datetime.date(2020, 1, 1), datetime.date(2020, 1, 2))
mock_runner.run_beam_pipeline.assert_called_with('echo', True, 'append-base-echo-scan... | Test running beam pipelines. This tests the runner arg parsing and parallelization, not the beam pipelines themselves. | RunBeamTablesTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RunBeamTablesTest:
"""Test running beam pipelines. This tests the runner arg parsing and parallelization, not the beam pipelines themselves."""
def test_run_single_pipelines(self) -> None:
"""Test running a single dated pipeline."""
<|body_0|>
def test_run_parallel_pipel... | stack_v2_sparse_classes_36k_train_034191 | 4,449 | permissive | [
{
"docstring": "Test running a single dated pipeline.",
"name": "test_run_single_pipelines",
"signature": "def test_run_single_pipelines(self) -> None"
},
{
"docstring": "Test running two pipelines in parallel.",
"name": "test_run_parallel_pipelines",
"signature": "def test_run_parallel_... | 5 | stack_v2_sparse_classes_30k_train_011784 | Implement the Python class `RunBeamTablesTest` described below.
Class description:
Test running beam pipelines. This tests the runner arg parsing and parallelization, not the beam pipelines themselves.
Method signatures and docstrings:
- def test_run_single_pipelines(self) -> None: Test running a single dated pipelin... | Implement the Python class `RunBeamTablesTest` described below.
Class description:
Test running beam pipelines. This tests the runner arg parsing and parallelization, not the beam pipelines themselves.
Method signatures and docstrings:
- def test_run_single_pipelines(self) -> None: Test running a single dated pipelin... | 72a500c770bd1f72c33ac9e47197754b9ef16f87 | <|skeleton|>
class RunBeamTablesTest:
"""Test running beam pipelines. This tests the runner arg parsing and parallelization, not the beam pipelines themselves."""
def test_run_single_pipelines(self) -> None:
"""Test running a single dated pipeline."""
<|body_0|>
def test_run_parallel_pipel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RunBeamTablesTest:
"""Test running beam pipelines. This tests the runner arg parsing and parallelization, not the beam pipelines themselves."""
def test_run_single_pipelines(self) -> None:
"""Test running a single dated pipeline."""
mock_runner = MagicMock(beam_tables.ScanDataBeamPipeline... | the_stack_v2_python_sparse | pipeline/test_run_beam_tables.py | RakhithJK/censoredplanet-analysis | train | 0 |
b6a8e257e200396a733d13f07126d94f5fe0db37 | [
"method = 'visit_' + node.__class__.__name__\nvisitor = getattr(self, method, self.generic_visit)\nreturn visitor(node)",
"oldparent = self.current_parent\nself.current_parent = node\nfor c_name, c in node.children():\n self.visit(c)\nself.current_parent = oldparent"
] | <|body_start_0|>
method = 'visit_' + node.__class__.__name__
visitor = getattr(self, method, self.generic_visit)
return visitor(node)
<|end_body_0|>
<|body_start_1|>
oldparent = self.current_parent
self.current_parent = node
for c_name, c in node.children():
... | NodeVisitor | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NodeVisitor:
def visit(self, node):
"""Visit a node."""
<|body_0|>
def generic_visit(self, node):
"""Called if no explicit visitor function exists for a node. Implements preorder visiting of the node."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_034192 | 10,796 | permissive | [
{
"docstring": "Visit a node.",
"name": "visit",
"signature": "def visit(self, node)"
},
{
"docstring": "Called if no explicit visitor function exists for a node. Implements preorder visiting of the node.",
"name": "generic_visit",
"signature": "def generic_visit(self, node)"
}
] | 2 | stack_v2_sparse_classes_30k_train_017723 | Implement the Python class `NodeVisitor` described below.
Class description:
Implement the NodeVisitor class.
Method signatures and docstrings:
- def visit(self, node): Visit a node.
- def generic_visit(self, node): Called if no explicit visitor function exists for a node. Implements preorder visiting of the node. | Implement the Python class `NodeVisitor` described below.
Class description:
Implement the NodeVisitor class.
Method signatures and docstrings:
- def visit(self, node): Visit a node.
- def generic_visit(self, node): Called if no explicit visitor function exists for a node. Implements preorder visiting of the node.
<... | af9654fcf55e394e7bece38e59bbdc3dd343f092 | <|skeleton|>
class NodeVisitor:
def visit(self, node):
"""Visit a node."""
<|body_0|>
def generic_visit(self, node):
"""Called if no explicit visitor function exists for a node. Implements preorder visiting of the node."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NodeVisitor:
def visit(self, node):
"""Visit a node."""
method = 'visit_' + node.__class__.__name__
visitor = getattr(self, method, self.generic_visit)
return visitor(node)
def generic_visit(self, node):
"""Called if no explicit visitor function exists for a node. ... | the_stack_v2_python_sparse | v2.0/framework/old/lan_ast.py | dikujepsen/OpenTran | train | 1 | |
059bc78567a53d132a0850affd650fae82af9d97 | [
"if package:\n if not cls.load_module(package):\n return None\n if not mod_path.startswith('.'):\n mod_path = f'.{mod_path}'\nfull_path = resolve_name(mod_path, package)\nif full_path in sys.modules:\n return sys.modules[full_path]\nif '.' in mod_path:\n parent_mod_path, mod_name = mod_pat... | <|body_start_0|>
if package:
if not cls.load_module(package):
return None
if not mod_path.startswith('.'):
mod_path = f'.{mod_path}'
full_path = resolve_name(mod_path, package)
if full_path in sys.modules:
return sys.modules[ful... | Class used to load classes from modules dynamically. | ClassLoader | [
"LicenseRef-scancode-dco-1.1",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClassLoader:
"""Class used to load classes from modules dynamically."""
def load_module(cls, mod_path: str, package: str=None) -> ModuleType:
"""Load a module by its absolute path. Args: mod_path: the absolute or relative module path package: the parent package to search for the modu... | stack_v2_sparse_classes_36k_train_034193 | 6,454 | permissive | [
{
"docstring": "Load a module by its absolute path. Args: mod_path: the absolute or relative module path package: the parent package to search for the module Returns: The resolved module or `None` if the module cannot be found Raises: ModuleLoadError: If there was an error loading the module",
"name": "load... | 4 | null | Implement the Python class `ClassLoader` described below.
Class description:
Class used to load classes from modules dynamically.
Method signatures and docstrings:
- def load_module(cls, mod_path: str, package: str=None) -> ModuleType: Load a module by its absolute path. Args: mod_path: the absolute or relative modul... | Implement the Python class `ClassLoader` described below.
Class description:
Class used to load classes from modules dynamically.
Method signatures and docstrings:
- def load_module(cls, mod_path: str, package: str=None) -> ModuleType: Load a module by its absolute path. Args: mod_path: the absolute or relative modul... | 39cac36d8937ce84a9307ce100aaefb8bc05ec04 | <|skeleton|>
class ClassLoader:
"""Class used to load classes from modules dynamically."""
def load_module(cls, mod_path: str, package: str=None) -> ModuleType:
"""Load a module by its absolute path. Args: mod_path: the absolute or relative module path package: the parent package to search for the modu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ClassLoader:
"""Class used to load classes from modules dynamically."""
def load_module(cls, mod_path: str, package: str=None) -> ModuleType:
"""Load a module by its absolute path. Args: mod_path: the absolute or relative module path package: the parent package to search for the module Returns: T... | the_stack_v2_python_sparse | aries_cloudagent/utils/classloader.py | hyperledger/aries-cloudagent-python | train | 370 |
0b6a90827291c1b902444e6149a9ddddfef65b2d | [
"self.mRtree = radix.Radix()\nself.mInterface = interface\nself.mAppList = []\nself.mPoisonIsActive = False\nfor app_path in ip_app_files:\n self.mAppList.append(AppStruct(app_path))\nif not addresses_hosts is None:\n if ip_gateway is None:\n \"\\n come specificato nell'help se si richie... | <|body_start_0|>
self.mRtree = radix.Radix()
self.mInterface = interface
self.mAppList = []
self.mPoisonIsActive = False
for app_path in ip_app_files:
self.mAppList.append(AppStruct(app_path))
if not addresses_hosts is None:
if ip_gateway is None:
... | classe che rappresenta il gestore dell'applicazione. Instanzia e manda in esecuzione i thread utilizzati per sniffing (main thread), drawing e spoofing | Manager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Manager:
"""classe che rappresenta il gestore dell'applicazione. Instanzia e manda in esecuzione i thread utilizzati per sniffing (main thread), drawing e spoofing"""
def __init__(self, interface, ip_app_files, addresses_hosts, ip_gateway):
""":param interface: interfaccia su cui cat... | stack_v2_sparse_classes_36k_train_034194 | 3,576 | no_license | [
{
"docstring": ":param interface: interfaccia su cui catturare i pacchetti :param ip_app_files: lista dei files contenenti gli indirizzi ip delle varie applicazioni :param addresses_hosts: lista di indirizzi ip degli host da avvelenare :param ip_gateway: indirizzo ip del gateway :except ValueError: eccezione la... | 2 | stack_v2_sparse_classes_30k_train_021076 | Implement the Python class `Manager` described below.
Class description:
classe che rappresenta il gestore dell'applicazione. Instanzia e manda in esecuzione i thread utilizzati per sniffing (main thread), drawing e spoofing
Method signatures and docstrings:
- def __init__(self, interface, ip_app_files, addresses_hos... | Implement the Python class `Manager` described below.
Class description:
classe che rappresenta il gestore dell'applicazione. Instanzia e manda in esecuzione i thread utilizzati per sniffing (main thread), drawing e spoofing
Method signatures and docstrings:
- def __init__(self, interface, ip_app_files, addresses_hos... | 96128a6efbff5382bf6747d55cbf0da1f9552b45 | <|skeleton|>
class Manager:
"""classe che rappresenta il gestore dell'applicazione. Instanzia e manda in esecuzione i thread utilizzati per sniffing (main thread), drawing e spoofing"""
def __init__(self, interface, ip_app_files, addresses_hosts, ip_gateway):
""":param interface: interfaccia su cui cat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Manager:
"""classe che rappresenta il gestore dell'applicazione. Instanzia e manda in esecuzione i thread utilizzati per sniffing (main thread), drawing e spoofing"""
def __init__(self, interface, ip_app_files, addresses_hosts, ip_gateway):
""":param interface: interfaccia su cui catturare i pacc... | the_stack_v2_python_sparse | 2011-2020/2019/Fabrizi/manager.py | lucaderi/sgr | train | 19 |
f88f22953029509741ab54599432e4b1c62e907e | [
"MyFilter = custom_empty_field_list_filter('my title')\nfilter = MyFilter(field=Mock(), request=Mock(), params={}, model=Mock(), model_admin=Mock(), field_path=Mock())\nassert filter.title == 'my title'",
"MyFilter = custom_empty_field_list_filter('my title', empty_label='nope', non_empty_label='yep')\nfilter = M... | <|body_start_0|>
MyFilter = custom_empty_field_list_filter('my title')
filter = MyFilter(field=Mock(), request=Mock(), params={}, model=Mock(), model_admin=Mock(), field_path=Mock())
assert filter.title == 'my title'
<|end_body_0|>
<|body_start_1|>
MyFilter = custom_empty_field_list_fil... | TestCustomEmptyFieldListFilter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestCustomEmptyFieldListFilter:
def test_title(self):
"""Accepts a custom title for the filter"""
<|body_0|>
def test_options(self):
"""Accepts custom labels for the empty and non-empty filter options"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_034195 | 17,804 | permissive | [
{
"docstring": "Accepts a custom title for the filter",
"name": "test_title",
"signature": "def test_title(self)"
},
{
"docstring": "Accepts custom labels for the empty and non-empty filter options",
"name": "test_options",
"signature": "def test_options(self)"
}
] | 2 | null | Implement the Python class `TestCustomEmptyFieldListFilter` described below.
Class description:
Implement the TestCustomEmptyFieldListFilter class.
Method signatures and docstrings:
- def test_title(self): Accepts a custom title for the filter
- def test_options(self): Accepts custom labels for the empty and non-empt... | Implement the Python class `TestCustomEmptyFieldListFilter` described below.
Class description:
Implement the TestCustomEmptyFieldListFilter class.
Method signatures and docstrings:
- def test_title(self): Accepts a custom title for the filter
- def test_options(self): Accepts custom labels for the empty and non-empt... | 65660de1a07c3bb3390d0161995f7fe305a5079b | <|skeleton|>
class TestCustomEmptyFieldListFilter:
def test_title(self):
"""Accepts a custom title for the filter"""
<|body_0|>
def test_options(self):
"""Accepts custom labels for the empty and non-empty filter options"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestCustomEmptyFieldListFilter:
def test_title(self):
"""Accepts a custom title for the filter"""
MyFilter = custom_empty_field_list_filter('my title')
filter = MyFilter(field=Mock(), request=Mock(), params={}, model=Mock(), model_admin=Mock(), field_path=Mock())
assert filter.... | the_stack_v2_python_sparse | geniza/common/tests.py | Princeton-CDH/geniza | train | 14 | |
eb792235e8bd38f991766625fe5bceb95f9ed8df | [
"def backtrack(i, tmp_sum, tmp):\n if tmp_sum > target or i == n:\n return\n if tmp_sum == target:\n res.append(tmp)\n return\n backtrack(i, tmp_sum + candidates[i], tmp + [candidates[i]])\n backtrack(i + 1, tmp_sum, tmp)\nn = len(candidates)\nres = []\nbacktrack(0, 0, [])\nreturn r... | <|body_start_0|>
def backtrack(i, tmp_sum, tmp):
if tmp_sum > target or i == n:
return
if tmp_sum == target:
res.append(tmp)
return
backtrack(i, tmp_sum + candidates[i], tmp + [candidates[i]])
backtrack(i + 1, tmp_su... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def combinationSum1(self, candidates, target):
""":type candidates: List[int] :type target: int :rtype: List[List[int]]"""
<|body_0|>
def combinationSum(self, candidates, target):
""":param candidates: :param target: :return:"""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_36k_train_034196 | 1,401 | no_license | [
{
"docstring": ":type candidates: List[int] :type target: int :rtype: List[List[int]]",
"name": "combinationSum1",
"signature": "def combinationSum1(self, candidates, target)"
},
{
"docstring": ":param candidates: :param target: :return:",
"name": "combinationSum",
"signature": "def comb... | 2 | stack_v2_sparse_classes_30k_val_000857 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def combinationSum1(self, candidates, target): :type candidates: List[int] :type target: int :rtype: List[List[int]]
- def combinationSum(self, candidates, target): :param candid... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def combinationSum1(self, candidates, target): :type candidates: List[int] :type target: int :rtype: List[List[int]]
- def combinationSum(self, candidates, target): :param candid... | a91a758ab52d8615366a46b168181c04a92a793b | <|skeleton|>
class Solution:
def combinationSum1(self, candidates, target):
""":type candidates: List[int] :type target: int :rtype: List[List[int]]"""
<|body_0|>
def combinationSum(self, candidates, target):
""":param candidates: :param target: :return:"""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def combinationSum1(self, candidates, target):
""":type candidates: List[int] :type target: int :rtype: List[List[int]]"""
def backtrack(i, tmp_sum, tmp):
if tmp_sum > target or i == n:
return
if tmp_sum == target:
res.append(tm... | the_stack_v2_python_sparse | 算法/39. 组合总和.py | Confucius-hui/LeetCode | train | 0 | |
7777b2a9462c2fcaf5dc268bbee9774ce7d24915 | [
"startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client['biel_otis']\nrepo.authenticate('biel_otis', 'biel_otis')\nurl = 'http://datamechanics.io/data/biel_otis/zipcodes.json'\nresponse = urlopen(url).read().decode('utf-8')\nr = json.loads(response)\nmyDict = {}\nmyDict['1'] = []\nmy... | <|body_start_0|>
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client['biel_otis']
repo.authenticate('biel_otis', 'biel_otis')
url = 'http://datamechanics.io/data/biel_otis/zipcodes.json'
response = urlopen(url).read().decode('utf-8')
... | getZipCodeData | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class getZipCodeData:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everythin... | stack_v2_sparse_classes_36k_train_034197 | 5,672 | no_license | [
{
"docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).",
"name": "execute",
"signature": "def execute(trial=False)"
},
{
"docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d... | 2 | null | Implement the Python class `getZipCodeData` described below.
Class description:
Implement the getZipCodeData class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTime=None,... | Implement the Python class `getZipCodeData` described below.
Class description:
Implement the getZipCodeData class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTime=None,... | 97e72731ffadbeae57d7a332decd58706e7c08de | <|skeleton|>
class getZipCodeData:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everythin... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class getZipCodeData:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client['biel_otis']
repo.authenticate('biel_otis', 'biel_otis')
... | the_stack_v2_python_sparse | biel_otis/getZipCodeData.py | ROODAY/course-2017-fal-proj | train | 3 | |
38da1f777e88912da5bf93fb89b3631f97a5fd3e | [
"super().__init__(target, opt_level, use_vm)\nself._log_file = log_file\nself._num_measure_trials = num_measure_trials\nself._early_stopping = early_stopping\nif isinstance(builder, Dict):\n builder = build_auto_scheduler_builder(builder)\nif isinstance(runner, Dict):\n if runner['type'] == 'LocalRunner':\n ... | <|body_start_0|>
super().__init__(target, opt_level, use_vm)
self._log_file = log_file
self._num_measure_trials = num_measure_trials
self._early_stopping = early_stopping
if isinstance(builder, Dict):
builder = build_auto_scheduler_builder(builder)
if isinstan... | AutoScheduleTuner | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AutoScheduleTuner:
def __init__(self, target: Union[str, Target], log_file: str, num_measure_trials: int, opt_level: int=3, use_vm: bool=False, early_stopping: Optional[int]=None, builder: Union[Dict, Any]=dict(type='LocalBuilder', timeout=15), runner: Union[Dict, Any]=dict(type='LocalRunner', r... | stack_v2_sparse_classes_36k_train_034198 | 13,280 | permissive | [
{
"docstring": "The Ansor tuner. Args: target (Union[str, Target]): The target platform to tune. log_file (str): the log file path. num_measure_trials (int): Maximum number of configs to try. opt_level (int, optional): The optimization level. Defaults to 3. use_vm (bool, optional): Enable tvm virtual machine. D... | 3 | null | Implement the Python class `AutoScheduleTuner` described below.
Class description:
Implement the AutoScheduleTuner class.
Method signatures and docstrings:
- def __init__(self, target: Union[str, Target], log_file: str, num_measure_trials: int, opt_level: int=3, use_vm: bool=False, early_stopping: Optional[int]=None,... | Implement the Python class `AutoScheduleTuner` described below.
Class description:
Implement the AutoScheduleTuner class.
Method signatures and docstrings:
- def __init__(self, target: Union[str, Target], log_file: str, num_measure_trials: int, opt_level: int=3, use_vm: bool=False, early_stopping: Optional[int]=None,... | 5479c8774f5b88d7ed9d399d4e305cb42cc2e73a | <|skeleton|>
class AutoScheduleTuner:
def __init__(self, target: Union[str, Target], log_file: str, num_measure_trials: int, opt_level: int=3, use_vm: bool=False, early_stopping: Optional[int]=None, builder: Union[Dict, Any]=dict(type='LocalBuilder', timeout=15), runner: Union[Dict, Any]=dict(type='LocalRunner', r... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AutoScheduleTuner:
def __init__(self, target: Union[str, Target], log_file: str, num_measure_trials: int, opt_level: int=3, use_vm: bool=False, early_stopping: Optional[int]=None, builder: Union[Dict, Any]=dict(type='LocalBuilder', timeout=15), runner: Union[Dict, Any]=dict(type='LocalRunner', repeat=10, enab... | the_stack_v2_python_sparse | mmdeploy/backend/tvm/tuner.py | open-mmlab/mmdeploy | train | 2,164 | |
c4307e8a4a3a965c6ccf731365b01acda2cbe4e8 | [
"try:\n return list(self.normalize(sequence))\nexcept TypeError:\n raise TypeError('`sequence` must be an instance of `str`.')",
"if not isinstance(tokens, Iterable):\n raise TypeError('`tokens` must be an instance of `Iterable[str]`.')\ntokens = list(tokens)\nif not all(map(lambda token: isinstance(toke... | <|body_start_0|>
try:
return list(self.normalize(sequence))
except TypeError:
raise TypeError('`sequence` must be an instance of `str`.')
<|end_body_0|>
<|body_start_1|>
if not isinstance(tokens, Iterable):
raise TypeError('`tokens` must be an instance of `It... | Character tokenizer using `list` structure. Attributes: bos_token: Token represent the begining of a sequence. Sequences will be encoded into following format: [bos] t1 t2 ... tn [eos] [pad] [pad] ... [pad] eos_token: Token represent the end of a sequence. Sequences will be encoded into following format: [bos] t1 t2 ..... | CharListTokenizer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CharListTokenizer:
"""Character tokenizer using `list` structure. Attributes: bos_token: Token represent the begining of a sequence. Sequences will be encoded into following format: [bos] t1 t2 ... tn [eos] [pad] [pad] ... [pad] eos_token: Token represent the end of a sequence. Sequences will be ... | stack_v2_sparse_classes_36k_train_034199 | 4,141 | no_license | [
{
"docstring": "Perform tokenization on input sequence. Input sequence will first be normalized by `lmp.tokenizer.BaseTokenizer.normalize(sequence)`, then be splitted into tokens by `list(sequence)`. See `lmp.tokenizer.BaseTokenizer.normalize` for details on normalization process. Args: sequence: Input sequence... | 2 | stack_v2_sparse_classes_30k_test_000640 | Implement the Python class `CharListTokenizer` described below.
Class description:
Character tokenizer using `list` structure. Attributes: bos_token: Token represent the begining of a sequence. Sequences will be encoded into following format: [bos] t1 t2 ... tn [eos] [pad] [pad] ... [pad] eos_token: Token represent th... | Implement the Python class `CharListTokenizer` described below.
Class description:
Character tokenizer using `list` structure. Attributes: bos_token: Token represent the begining of a sequence. Sequences will be encoded into following format: [bos] t1 t2 ... tn [eos] [pad] [pad] ... [pad] eos_token: Token represent th... | 6bca79baceacf85c5c3683bbfdf586a00484ed19 | <|skeleton|>
class CharListTokenizer:
"""Character tokenizer using `list` structure. Attributes: bos_token: Token represent the begining of a sequence. Sequences will be encoded into following format: [bos] t1 t2 ... tn [eos] [pad] [pad] ... [pad] eos_token: Token represent the end of a sequence. Sequences will be ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CharListTokenizer:
"""Character tokenizer using `list` structure. Attributes: bos_token: Token represent the begining of a sequence. Sequences will be encoded into following format: [bos] t1 t2 ... tn [eos] [pad] [pad] ... [pad] eos_token: Token represent the end of a sequence. Sequences will be encoded into ... | the_stack_v2_python_sparse | lmp/tokenizer/_char_list_tokenizer.py | SiuYingCheng/language-model-playground | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.