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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d6991f0c2e7e8beedf0459088feac249c8f1967e | [
"if not isinstance(nums, list) or len(nums) == 0 or k > len(nums) or (k <= 0):\n return\nnums_k = nums[:k]\nfor i in range(k // 2 - 1, -1, -1):\n nums_k = self.max_heap(nums_k, i, k - 1)\nprint('initialize heap: ', nums_k)\nfor i in range(k, len(nums)):\n if nums[i] < nums_k[0]:\n nums_k[0] = nums[i... | <|body_start_0|>
if not isinstance(nums, list) or len(nums) == 0 or k > len(nums) or (k <= 0):
return
nums_k = nums[:k]
for i in range(k // 2 - 1, -1, -1):
nums_k = self.max_heap(nums_k, i, k - 1)
print('initialize heap: ', nums_k)
for i in range(k, len(nu... | Solution2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution2:
def get_least_k(self, nums, k):
"""利用堆解决取最大/最小k个数的问题: 时间复杂度:O(nlog(k)) :param nums: 数组 :param k: 最小数字个数 :return: 最小k个数字"""
<|body_0|>
def max_heap(self, nums, start, end):
"""初始化堆 :param nums: 数组 :param start: 起始位置 :param end: 终止位置 :return: 初始化后的堆"""
... | stack_v2_sparse_classes_36k_train_030400 | 4,146 | no_license | [
{
"docstring": "利用堆解决取最大/最小k个数的问题: 时间复杂度:O(nlog(k)) :param nums: 数组 :param k: 最小数字个数 :return: 最小k个数字",
"name": "get_least_k",
"signature": "def get_least_k(self, nums, k)"
},
{
"docstring": "初始化堆 :param nums: 数组 :param start: 起始位置 :param end: 终止位置 :return: 初始化后的堆",
"name": "max_heap",
"s... | 2 | null | Implement the Python class `Solution2` described below.
Class description:
Implement the Solution2 class.
Method signatures and docstrings:
- def get_least_k(self, nums, k): 利用堆解决取最大/最小k个数的问题: 时间复杂度:O(nlog(k)) :param nums: 数组 :param k: 最小数字个数 :return: 最小k个数字
- def max_heap(self, nums, start, end): 初始化堆 :param nums: 数... | Implement the Python class `Solution2` described below.
Class description:
Implement the Solution2 class.
Method signatures and docstrings:
- def get_least_k(self, nums, k): 利用堆解决取最大/最小k个数的问题: 时间复杂度:O(nlog(k)) :param nums: 数组 :param k: 最小数字个数 :return: 最小k个数字
- def max_heap(self, nums, start, end): 初始化堆 :param nums: 数... | 9fdc4b1a2b59b7aed22ddfe92aade487b4c19b71 | <|skeleton|>
class Solution2:
def get_least_k(self, nums, k):
"""利用堆解决取最大/最小k个数的问题: 时间复杂度:O(nlog(k)) :param nums: 数组 :param k: 最小数字个数 :return: 最小k个数字"""
<|body_0|>
def max_heap(self, nums, start, end):
"""初始化堆 :param nums: 数组 :param start: 起始位置 :param end: 终止位置 :return: 初始化后的堆"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution2:
def get_least_k(self, nums, k):
"""利用堆解决取最大/最小k个数的问题: 时间复杂度:O(nlog(k)) :param nums: 数组 :param k: 最小数字个数 :return: 最小k个数字"""
if not isinstance(nums, list) or len(nums) == 0 or k > len(nums) or (k <= 0):
return
nums_k = nums[:k]
for i in range(k // 2 - 1, -1... | the_stack_v2_python_sparse | my_target_offer/40_k_least_numbers.py | MemoryForSky/Data-Structures-and-Algorithms | train | 0 | |
4978fb5a079afb2dd6b06393d85195e21b6e5159 | [
"app_id_list = get_cc_app_id_by_user()\nstart = self.request.query_params.get('start_time', None)\nstop = self.request.query_params.get('stop_time', None)\nif start and stop:\n return TaskRecord.objects.filter(app_id__in=app_id_list).filter(create_time__range=[start, stop]).order_by('-create_time')\nreturn TaskR... | <|body_start_0|>
app_id_list = get_cc_app_id_by_user()
start = self.request.query_params.get('start_time', None)
stop = self.request.query_params.get('stop_time', None)
if start and stop:
return TaskRecord.objects.filter(app_id__in=app_id_list).filter(create_time__range=[star... | 执行记录RDF视图类,用户可根据集群名称,任务创建时间过滤执行记录数据 | TaskRecordViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TaskRecordViewSet:
"""执行记录RDF视图类,用户可根据集群名称,任务创建时间过滤执行记录数据"""
def get_queryset(self):
"""重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离"""
<|body_0|>
def get_task_sum_group_by_db(self, request, *args, **kwargs):
"""输出各db组件的的执行记录数"""
<|body_1|>
def get_task(se... | stack_v2_sparse_classes_36k_train_030401 | 4,384 | no_license | [
{
"docstring": "重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离",
"name": "get_queryset",
"signature": "def get_queryset(self)"
},
{
"docstring": "输出各db组件的的执行记录数",
"name": "get_task_sum_group_by_db",
"signature": "def get_task_sum_group_by_db(self, request, *args, **kwargs)"
},
{
"docstri... | 4 | stack_v2_sparse_classes_30k_train_017582 | Implement the Python class `TaskRecordViewSet` described below.
Class description:
执行记录RDF视图类,用户可根据集群名称,任务创建时间过滤执行记录数据
Method signatures and docstrings:
- def get_queryset(self): 重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离
- def get_task_sum_group_by_db(self, request, *args, **kwargs): 输出各db组件的的执行记录数
- def get_task(self, ... | Implement the Python class `TaskRecordViewSet` described below.
Class description:
执行记录RDF视图类,用户可根据集群名称,任务创建时间过滤执行记录数据
Method signatures and docstrings:
- def get_queryset(self): 重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离
- def get_task_sum_group_by_db(self, request, *args, **kwargs): 输出各db组件的的执行记录数
- def get_task(self, ... | 97cfac2ba94d67980d837f0b541caae70b68a595 | <|skeleton|>
class TaskRecordViewSet:
"""执行记录RDF视图类,用户可根据集群名称,任务创建时间过滤执行记录数据"""
def get_queryset(self):
"""重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离"""
<|body_0|>
def get_task_sum_group_by_db(self, request, *args, **kwargs):
"""输出各db组件的的执行记录数"""
<|body_1|>
def get_task(se... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TaskRecordViewSet:
"""执行记录RDF视图类,用户可根据集群名称,任务创建时间过滤执行记录数据"""
def get_queryset(self):
"""重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离"""
app_id_list = get_cc_app_id_by_user()
start = self.request.query_params.get('start_time', None)
stop = self.request.query_params.get('stop_time... | the_stack_v2_python_sparse | apps/globalview/views.py | sdgdsffdsfff/bk-dop | train | 0 |
23f0019d77b7bdea3a5866dff25ec46405247f69 | [
"self.mwh_capacity = mwh_capacity\nself.mw_limit = mw_limit\nself.efficiency = efficiency\nself.mwh_level = 0\nself.aud_profit = 0",
"mwh = self.mwh_capacity - self.mwh_level\npc_rate = min(max(pc_rate, 0), 1)\nmwh_max = self.mw_limit * pc_rate * self.efficiency * duration_minutes / 60\nmwh = min(max(mwh, 0), mwh... | <|body_start_0|>
self.mwh_capacity = mwh_capacity
self.mw_limit = mw_limit
self.efficiency = efficiency
self.mwh_level = 0
self.aud_profit = 0
<|end_body_0|>
<|body_start_1|>
mwh = self.mwh_capacity - self.mwh_level
pc_rate = min(max(pc_rate, 0), 1)
mwh_m... | A Battery object represents a battery/operator combination. For the battery it knows the size of battery storage in MWh, the efficiency of storing energy, the maximum charge/discharge rate in MW, and how much energy is currently in the battery. For the operator it knows how the operator makes decisions on when to charg... | Battery | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Battery:
"""A Battery object represents a battery/operator combination. For the battery it knows the size of battery storage in MWh, the efficiency of storing energy, the maximum charge/discharge rate in MW, and how much energy is currently in the battery. For the operator it knows how the operat... | stack_v2_sparse_classes_36k_train_030402 | 22,567 | no_license | [
{
"docstring": "Constructor of Battery objects :param mwh_capacity: Full number of MWh battery can store after all charging and discharging losses :param mw_limit: Maximum rate MW battery can send power to/from the grid :param efficiency: Round trip efficiency of charging and discharging battery. 0.9 = 90%",
... | 4 | null | Implement the Python class `Battery` described below.
Class description:
A Battery object represents a battery/operator combination. For the battery it knows the size of battery storage in MWh, the efficiency of storing energy, the maximum charge/discharge rate in MW, and how much energy is currently in the battery. F... | Implement the Python class `Battery` described below.
Class description:
A Battery object represents a battery/operator combination. For the battery it knows the size of battery storage in MWh, the efficiency of storing energy, the maximum charge/discharge rate in MW, and how much energy is currently in the battery. F... | acc17b640e1a737e70b310cb2c8ce21aac35c6da | <|skeleton|>
class Battery:
"""A Battery object represents a battery/operator combination. For the battery it knows the size of battery storage in MWh, the efficiency of storing energy, the maximum charge/discharge rate in MW, and how much energy is currently in the battery. For the operator it knows how the operat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Battery:
"""A Battery object represents a battery/operator combination. For the battery it knows the size of battery storage in MWh, the efficiency of storing energy, the maximum charge/discharge rate in MW, and how much energy is currently in the battery. For the operator it knows how the operator makes deci... | the_stack_v2_python_sparse | online/meetup092_tim_tesla_battery_optimisation.py | anniequasar/session-summaries | train | 17 |
9e9712d9e02f1fb3b394f2fa5e75f0e8c3f0c1fe | [
"if len(prices) <= 1 or k < 1:\n return 0\nif k >= len(prices) // 2:\n return sum((x - y for x, y in zip(prices[1:], prices[:-1]) if x > y))\nbuys = [prices[0]] * k\nsells = [0] * k\nfor price in prices:\n buys[0] = min(buys[0], price)\n sells[0] = max(sells[0], price - buys[0])\n for i in range(1, k... | <|body_start_0|>
if len(prices) <= 1 or k < 1:
return 0
if k >= len(prices) // 2:
return sum((x - y for x, y in zip(prices[1:], prices[:-1]) if x > y))
buys = [prices[0]] * k
sells = [0] * k
for price in prices:
buys[0] = min(buys[0], price)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProfit1(self, k, prices):
""":type k: int :type prices: List[int] :rtype: int"""
<|body_0|>
def maxProfit2(self, k, prices):
""":type k: int :type prices: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(... | stack_v2_sparse_classes_36k_train_030403 | 1,496 | no_license | [
{
"docstring": ":type k: int :type prices: List[int] :rtype: int",
"name": "maxProfit1",
"signature": "def maxProfit1(self, k, prices)"
},
{
"docstring": ":type k: int :type prices: List[int] :rtype: int",
"name": "maxProfit2",
"signature": "def maxProfit2(self, k, prices)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit1(self, k, prices): :type k: int :type prices: List[int] :rtype: int
- def maxProfit2(self, k, prices): :type k: int :type prices: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit1(self, k, prices): :type k: int :type prices: List[int] :rtype: int
- def maxProfit2(self, k, prices): :type k: int :type prices: List[int] :rtype: int
<|skeleton|... | 8fb6c1d947046dabd58ff8482b2c0b41f39aa988 | <|skeleton|>
class Solution:
def maxProfit1(self, k, prices):
""":type k: int :type prices: List[int] :rtype: int"""
<|body_0|>
def maxProfit2(self, k, prices):
""":type k: int :type prices: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxProfit1(self, k, prices):
""":type k: int :type prices: List[int] :rtype: int"""
if len(prices) <= 1 or k < 1:
return 0
if k >= len(prices) // 2:
return sum((x - y for x, y in zip(prices[1:], prices[:-1]) if x > y))
buys = [prices[0]] * ... | the_stack_v2_python_sparse | Python/LeetCode/188.py | czx94/Algorithms-Collection | train | 2 | |
4bf267e1ce03320d8442efe3d8cd8f9541a71257 | [
"self.nums = nums\nself.d = {}\nfor i in xrange(len(nums)):\n if nums[i] in self.d:\n self.d[nums[i]] += 1\n else:\n self.d[nums[i]] = 1",
"import random\nx = random.randint(1, self.d[target])\nfor i in xrange(len(self.nums)):\n if self.nums[i] == target:\n if x == 1:\n re... | <|body_start_0|>
self.nums = nums
self.d = {}
for i in xrange(len(nums)):
if nums[i] in self.d:
self.d[nums[i]] += 1
else:
self.d[nums[i]] = 1
<|end_body_0|>
<|body_start_1|>
import random
x = random.randint(1, self.d[targe... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def __init__(self, nums):
""":type nums: List[int] :type numsSize: int"""
<|body_0|>
def pick(self, target):
""":type target: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.nums = nums
self.d = {}
for ... | stack_v2_sparse_classes_36k_train_030404 | 843 | no_license | [
{
"docstring": ":type nums: List[int] :type numsSize: int",
"name": "__init__",
"signature": "def __init__(self, nums)"
},
{
"docstring": ":type target: int :rtype: int",
"name": "pick",
"signature": "def pick(self, target)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int] :type numsSize: int
- def pick(self, target): :type target: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int] :type numsSize: int
- def pick(self, target): :type target: int :rtype: int
<|skeleton|>
class Solution:
def __init__(self, ... | 0c89fb5b95a33f866ffa881e0fa164c6ed8fc2d3 | <|skeleton|>
class Solution:
def __init__(self, nums):
""":type nums: List[int] :type numsSize: int"""
<|body_0|>
def pick(self, target):
""":type target: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def __init__(self, nums):
""":type nums: List[int] :type numsSize: int"""
self.nums = nums
self.d = {}
for i in xrange(len(nums)):
if nums[i] in self.d:
self.d[nums[i]] += 1
else:
self.d[nums[i]] = 1
def pic... | the_stack_v2_python_sparse | Random Pick Index.py | KiwiFlow/Algorithms | train | 1 | |
c35aed4336c97968db93f2828a1e2cf02ef9234c | [
"privilege_id_list = attrs.get('privilege_id_list')\nif privilege_id_list:\n db_privilege_cnt = Privilege.objects.filter(id__in=privilege_id_list).count()\n if db_privilege_cnt != len(privilege_id_list):\n raise SystemGlobalException(StatusCodeMessage.ROLE_PRIVILEGE_NOT_MATCH)\nreturn attrs",
"now_ti... | <|body_start_0|>
privilege_id_list = attrs.get('privilege_id_list')
if privilege_id_list:
db_privilege_cnt = Privilege.objects.filter(id__in=privilege_id_list).count()
if db_privilege_cnt != len(privilege_id_list):
raise SystemGlobalException(StatusCodeMessage.ROL... | 用户角色创建 修改序列化器 | RoleCreateUpdateSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RoleCreateUpdateSerializer:
"""用户角色创建 修改序列化器"""
def validate(self, attrs):
"""多字段验证方法 :param attrs: 请求体转换后的OrderedDict :return: attrs"""
<|body_0|>
def create(self, validated_data):
"""添加数据 :param validated_data: 字段验证通过后的数据 :return: validated_data"""
<|bo... | stack_v2_sparse_classes_36k_train_030405 | 4,727 | no_license | [
{
"docstring": "多字段验证方法 :param attrs: 请求体转换后的OrderedDict :return: attrs",
"name": "validate",
"signature": "def validate(self, attrs)"
},
{
"docstring": "添加数据 :param validated_data: 字段验证通过后的数据 :return: validated_data",
"name": "create",
"signature": "def create(self, validated_data)"
}... | 4 | stack_v2_sparse_classes_30k_train_015019 | Implement the Python class `RoleCreateUpdateSerializer` described below.
Class description:
用户角色创建 修改序列化器
Method signatures and docstrings:
- def validate(self, attrs): 多字段验证方法 :param attrs: 请求体转换后的OrderedDict :return: attrs
- def create(self, validated_data): 添加数据 :param validated_data: 字段验证通过后的数据 :return: validated... | Implement the Python class `RoleCreateUpdateSerializer` described below.
Class description:
用户角色创建 修改序列化器
Method signatures and docstrings:
- def validate(self, attrs): 多字段验证方法 :param attrs: 请求体转换后的OrderedDict :return: attrs
- def create(self, validated_data): 添加数据 :param validated_data: 字段验证通过后的数据 :return: validated... | bb85b52598d68956bde8756c8321ade7b8479ba7 | <|skeleton|>
class RoleCreateUpdateSerializer:
"""用户角色创建 修改序列化器"""
def validate(self, attrs):
"""多字段验证方法 :param attrs: 请求体转换后的OrderedDict :return: attrs"""
<|body_0|>
def create(self, validated_data):
"""添加数据 :param validated_data: 字段验证通过后的数据 :return: validated_data"""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RoleCreateUpdateSerializer:
"""用户角色创建 修改序列化器"""
def validate(self, attrs):
"""多字段验证方法 :param attrs: 请求体转换后的OrderedDict :return: attrs"""
privilege_id_list = attrs.get('privilege_id_list')
if privilege_id_list:
db_privilege_cnt = Privilege.objects.filter(id__in=privileg... | the_stack_v2_python_sparse | rbac_v1/v1/rbac_app/serializers/role_serializers.py | huiiiuh/huihuiproject | train | 0 |
b8567b9a89b79055688cd8461af3949d6a9dc843 | [
"result = []\nfor email in emails:\n result.append(self.newEmail(email))\nreturn len(set(result))",
"a = email.index('+')\nb = email.index('@')\nList = email[:a].split('.')\nres_s = ''\nfor s in List:\n res_s += s\nreturn res_s + email[b:]"
] | <|body_start_0|>
result = []
for email in emails:
result.append(self.newEmail(email))
return len(set(result))
<|end_body_0|>
<|body_start_1|>
a = email.index('+')
b = email.index('@')
List = email[:a].split('.')
res_s = ''
for s in List:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numUniqueEmails(self, emails):
""":type emails: List[str] :rtype: int"""
<|body_0|>
def newEmail(self, email):
"""按规则转换之后的emali"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = []
for email in emails:
result... | stack_v2_sparse_classes_36k_train_030406 | 615 | no_license | [
{
"docstring": ":type emails: List[str] :rtype: int",
"name": "numUniqueEmails",
"signature": "def numUniqueEmails(self, emails)"
},
{
"docstring": "按规则转换之后的emali",
"name": "newEmail",
"signature": "def newEmail(self, email)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numUniqueEmails(self, emails): :type emails: List[str] :rtype: int
- def newEmail(self, email): 按规则转换之后的emali | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numUniqueEmails(self, emails): :type emails: List[str] :rtype: int
- def newEmail(self, email): 按规则转换之后的emali
<|skeleton|>
class Solution:
def numUniqueEmails(self, ema... | 2df5d3b361bc7d25cd3d2afd5ac1c64fbc303920 | <|skeleton|>
class Solution:
def numUniqueEmails(self, emails):
""":type emails: List[str] :rtype: int"""
<|body_0|>
def newEmail(self, email):
"""按规则转换之后的emali"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def numUniqueEmails(self, emails):
""":type emails: List[str] :rtype: int"""
result = []
for email in emails:
result.append(self.newEmail(email))
return len(set(result))
def newEmail(self, email):
"""按规则转换之后的emali"""
a = email.index('+... | the_stack_v2_python_sparse | leetcode_929.py | SongJialiJiali/test | train | 0 | |
4d2f236e01d15de1940ea12c64551c74448a6743 | [
"self.d = dict()\nself.begin = Trie('')\nfor i, v in enumerate(sentences):\n self.begin.insert(v, v, times[i])\n self.d[v] = times[i]\nself.t = self.begin\nself.input_s = ''",
"ans = []\nif c == '#':\n self.d[self.input_s] = self.d.get(self.input_s, 0) + 1\n self.begin.insert(self.input_s, self.input_... | <|body_start_0|>
self.d = dict()
self.begin = Trie('')
for i, v in enumerate(sentences):
self.begin.insert(v, v, times[i])
self.d[v] = times[i]
self.t = self.begin
self.input_s = ''
<|end_body_0|>
<|body_start_1|>
ans = []
if c == '#':
... | AutocompleteSystem | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AutocompleteSystem:
def __init__(self, sentences, times):
""":type sentences: List[str] :type times: List[int]"""
<|body_0|>
def input(self, c):
""":type c: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.d = dict()
... | stack_v2_sparse_classes_36k_train_030407 | 1,816 | no_license | [
{
"docstring": ":type sentences: List[str] :type times: List[int]",
"name": "__init__",
"signature": "def __init__(self, sentences, times)"
},
{
"docstring": ":type c: str :rtype: List[str]",
"name": "input",
"signature": "def input(self, c)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000177 | Implement the Python class `AutocompleteSystem` described below.
Class description:
Implement the AutocompleteSystem class.
Method signatures and docstrings:
- def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int]
- def input(self, c): :type c: str :rtype: List[str] | Implement the Python class `AutocompleteSystem` described below.
Class description:
Implement the AutocompleteSystem class.
Method signatures and docstrings:
- def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int]
- def input(self, c): :type c: str :rtype: List[str]
<|skeleton|>
cla... | 9eb44afa4233fdedc2e5c72be0fdf54b25d1c45c | <|skeleton|>
class AutocompleteSystem:
def __init__(self, sentences, times):
""":type sentences: List[str] :type times: List[int]"""
<|body_0|>
def input(self, c):
""":type c: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AutocompleteSystem:
def __init__(self, sentences, times):
""":type sentences: List[str] :type times: List[int]"""
self.d = dict()
self.begin = Trie('')
for i, v in enumerate(sentences):
self.begin.insert(v, v, times[i])
self.d[v] = times[i]
self.... | the_stack_v2_python_sparse | Facebook/Pro642. Design Search Autocomplete System.py | YoyinZyc/Leetcode_Python | train | 0 | |
b8411536625d17745cb8eefb753dcc0a74aaedb0 | [
"try:\n verify_token(request.headers)\nexcept Exception as err:\n ns.abort(401, message=err)\ntry:\n aud = audits.read(id)\nexcept psycopg2.Error as err:\n ns.abort(400, message=get_msg_pgerror(err))\nexcept EmptySetError:\n ns.abort(404, message=Audit.audit_not_found)\nexcept Exception as err:\n ... | <|body_start_0|>
try:
verify_token(request.headers)
except Exception as err:
ns.abort(401, message=err)
try:
aud = audits.read(id)
except psycopg2.Error as err:
ns.abort(400, message=get_msg_pgerror(err))
except EmptySetError:
... | Audit | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Audit:
def get(self, id):
"""To fetch an audit"""
<|body_0|>
def put(self, id):
"""To update an audit"""
<|body_1|>
def delete(self, id):
"""To delete an audit"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
try:
ver... | stack_v2_sparse_classes_36k_train_030408 | 7,183 | no_license | [
{
"docstring": "To fetch an audit",
"name": "get",
"signature": "def get(self, id)"
},
{
"docstring": "To update an audit",
"name": "put",
"signature": "def put(self, id)"
},
{
"docstring": "To delete an audit",
"name": "delete",
"signature": "def delete(self, id)"
}
] | 3 | stack_v2_sparse_classes_30k_train_021425 | Implement the Python class `Audit` described below.
Class description:
Implement the Audit class.
Method signatures and docstrings:
- def get(self, id): To fetch an audit
- def put(self, id): To update an audit
- def delete(self, id): To delete an audit | Implement the Python class `Audit` described below.
Class description:
Implement the Audit class.
Method signatures and docstrings:
- def get(self, id): To fetch an audit
- def put(self, id): To update an audit
- def delete(self, id): To delete an audit
<|skeleton|>
class Audit:
def get(self, id):
"""To... | e00610fac26ef3ca078fd037c0649b70fa0e9a09 | <|skeleton|>
class Audit:
def get(self, id):
"""To fetch an audit"""
<|body_0|>
def put(self, id):
"""To update an audit"""
<|body_1|>
def delete(self, id):
"""To delete an audit"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Audit:
def get(self, id):
"""To fetch an audit"""
try:
verify_token(request.headers)
except Exception as err:
ns.abort(401, message=err)
try:
aud = audits.read(id)
except psycopg2.Error as err:
ns.abort(400, message=get_ms... | the_stack_v2_python_sparse | DOS/soa/service/genl/endpoints/audits.py | Telematica/knight-rider | train | 1 | |
7e4bd363b8077f23db0743f36447ea44644a88c7 | [
"length = len(digits)\ncarry = 1\nfor i in range(length - 1, -1, -1):\n if carry > 0:\n if digits[i] == 9:\n digits[i] = 0\n else:\n digits[i] += 1\n carry = 0\nif carry == 1:\n digits.insert(0, 1)\nreturn digits",
"length = len(digits)\nfor i in range(length -... | <|body_start_0|>
length = len(digits)
carry = 1
for i in range(length - 1, -1, -1):
if carry > 0:
if digits[i] == 9:
digits[i] = 0
else:
digits[i] += 1
carry = 0
if carry == 1:
... | PlusOne | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PlusOne:
def plus_one(self, digits):
""":type digits: List[int] :rtype: List[int]"""
<|body_0|>
def plus_one_nice(self, digits):
""":type digits: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
length = len(digits)
... | stack_v2_sparse_classes_36k_train_030409 | 1,121 | no_license | [
{
"docstring": ":type digits: List[int] :rtype: List[int]",
"name": "plus_one",
"signature": "def plus_one(self, digits)"
},
{
"docstring": ":type digits: List[int] :rtype: List[int]",
"name": "plus_one_nice",
"signature": "def plus_one_nice(self, digits)"
}
] | 2 | null | Implement the Python class `PlusOne` described below.
Class description:
Implement the PlusOne class.
Method signatures and docstrings:
- def plus_one(self, digits): :type digits: List[int] :rtype: List[int]
- def plus_one_nice(self, digits): :type digits: List[int] :rtype: List[int] | Implement the Python class `PlusOne` described below.
Class description:
Implement the PlusOne class.
Method signatures and docstrings:
- def plus_one(self, digits): :type digits: List[int] :rtype: List[int]
- def plus_one_nice(self, digits): :type digits: List[int] :rtype: List[int]
<|skeleton|>
class PlusOne:
... | e41f4ac9e99b9272ed4718680f4d12fd7443db03 | <|skeleton|>
class PlusOne:
def plus_one(self, digits):
""":type digits: List[int] :rtype: List[int]"""
<|body_0|>
def plus_one_nice(self, digits):
""":type digits: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PlusOne:
def plus_one(self, digits):
""":type digits: List[int] :rtype: List[int]"""
length = len(digits)
carry = 1
for i in range(length - 1, -1, -1):
if carry > 0:
if digits[i] == 9:
digits[i] = 0
else:
... | the_stack_v2_python_sparse | 1-Python/Easy/plus_one.py | jied314/IQs | train | 0 | |
79205759e44904843ef5999daeaeaf4fb8e02563 | [
"s = sum(nums)\nif s % k != 0:\n return False\ntarget = s // k\nvisited = [False for _ in nums]\nreturn self.dfs(nums, None, target, visited, k)",
"if k == 0:\n return True\nif cur_sum and cur_sum == target_sum:\n return self.dfs(nums, None, target_sum, visited, k - 1)\nfor i in range(len(nums)):\n if... | <|body_start_0|>
s = sum(nums)
if s % k != 0:
return False
target = s // k
visited = [False for _ in nums]
return self.dfs(nums, None, target, visited, k)
<|end_body_0|>
<|body_start_1|>
if k == 0:
return True
if cur_sum and cur_sum == tar... | Solution_TLE | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution_TLE:
def canPartitionKSubsets(self, nums: List[int], k: int) -> bool:
"""resurive search"""
<|body_0|>
def dfs(self, nums, cur_sum, target_sum, visited, k):
"""some corner cases: 1. target_sum default at 0: sum or empty array is 0? 2. nxt_sum = (cur_sum or 0... | stack_v2_sparse_classes_36k_train_030410 | 3,307 | no_license | [
{
"docstring": "resurive search",
"name": "canPartitionKSubsets",
"signature": "def canPartitionKSubsets(self, nums: List[int], k: int) -> bool"
},
{
"docstring": "some corner cases: 1. target_sum default at 0: sum or empty array is 0? 2. nxt_sum = (cur_sum or 0) + nums[i] rather than cur_sum or... | 2 | stack_v2_sparse_classes_30k_train_006936 | Implement the Python class `Solution_TLE` described below.
Class description:
Implement the Solution_TLE class.
Method signatures and docstrings:
- def canPartitionKSubsets(self, nums: List[int], k: int) -> bool: resurive search
- def dfs(self, nums, cur_sum, target_sum, visited, k): some corner cases: 1. target_sum ... | Implement the Python class `Solution_TLE` described below.
Class description:
Implement the Solution_TLE class.
Method signatures and docstrings:
- def canPartitionKSubsets(self, nums: List[int], k: int) -> bool: resurive search
- def dfs(self, nums, cur_sum, target_sum, visited, k): some corner cases: 1. target_sum ... | 929dde1723fb2f54870c8a9badc80fc23e8400d3 | <|skeleton|>
class Solution_TLE:
def canPartitionKSubsets(self, nums: List[int], k: int) -> bool:
"""resurive search"""
<|body_0|>
def dfs(self, nums, cur_sum, target_sum, visited, k):
"""some corner cases: 1. target_sum default at 0: sum or empty array is 0? 2. nxt_sum = (cur_sum or 0... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution_TLE:
def canPartitionKSubsets(self, nums: List[int], k: int) -> bool:
"""resurive search"""
s = sum(nums)
if s % k != 0:
return False
target = s // k
visited = [False for _ in nums]
return self.dfs(nums, None, target, visited, k)
def df... | the_stack_v2_python_sparse | _algorithms_challenges/leetcode/LeetCode/698 Partition to K Equal Sum Subsets.py | syurskyi/Algorithms_and_Data_Structure | train | 4 | |
138eb3ab5e261f8bc5ec13406a1c5a1a472aa0a6 | [
"self.application_id_local = kwargs.pop('id')\nself.adult = kwargs.pop('adult')\nself._all_emails = kwargs.pop('email_list')\nsuper(OtherPeopleAdultDetailsForm, self).__init__(*args, **kwargs)\nfull_stop_stripper(self)\nif AdultInHome.objects.filter(application_id=self.application_id_local, adult=self.adult).count(... | <|body_start_0|>
self.application_id_local = kwargs.pop('id')
self.adult = kwargs.pop('adult')
self._all_emails = kwargs.pop('email_list')
super(OtherPeopleAdultDetailsForm, self).__init__(*args, **kwargs)
full_stop_stripper(self)
if AdultInHome.objects.filter(application... | GOV.UK form for the People in your home: adult details page | OtherPeopleAdultDetailsForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OtherPeopleAdultDetailsForm:
"""GOV.UK form for the People in your home: adult details page"""
def __init__(self, *args, **kwargs):
"""Method to configure the initialisation of the People in your home: adult details form :param args: arguments passed to the form :param kwargs: keywor... | stack_v2_sparse_classes_36k_train_030411 | 20,631 | no_license | [
{
"docstring": "Method to configure the initialisation of the People in your home: adult details form :param args: arguments passed to the form :param kwargs: keyword arguments passed to the form, e.g. application ID",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"... | 6 | stack_v2_sparse_classes_30k_train_003872 | Implement the Python class `OtherPeopleAdultDetailsForm` described below.
Class description:
GOV.UK form for the People in your home: adult details page
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Method to configure the initialisation of the People in your home: adult details form :param... | Implement the Python class `OtherPeopleAdultDetailsForm` described below.
Class description:
GOV.UK form for the People in your home: adult details page
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Method to configure the initialisation of the People in your home: adult details form :param... | fa6ca6a8164763e1dfe1581702ca5d36e44859de | <|skeleton|>
class OtherPeopleAdultDetailsForm:
"""GOV.UK form for the People in your home: adult details page"""
def __init__(self, *args, **kwargs):
"""Method to configure the initialisation of the People in your home: adult details form :param args: arguments passed to the form :param kwargs: keywor... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OtherPeopleAdultDetailsForm:
"""GOV.UK form for the People in your home: adult details page"""
def __init__(self, *args, **kwargs):
"""Method to configure the initialisation of the People in your home: adult details form :param args: arguments passed to the form :param kwargs: keyword arguments p... | the_stack_v2_python_sparse | application/forms/other_people.py | IS-JAQU-CAZ/OFS-MORE-Childminder-Website | train | 0 |
9d487c31226a517a782b5d5fd6ada974984e5d90 | [
"self._pokemon = pokemon\nwith open(join('jsons', 'pokemon_lookup_s.json'), 'r') as pokemon_lookup_json:\n pokemon_lookup = json.load(pokemon_lookup_json)\n _lookup = pokemon_lookup[self._pokemon.name]\n_offset = (0, _lookup)\nsuper().__init__(join('pokemon', 'pokemon_small.png'), position, offset=_offset)\ns... | <|body_start_0|>
self._pokemon = pokemon
with open(join('jsons', 'pokemon_lookup_s.json'), 'r') as pokemon_lookup_json:
pokemon_lookup = json.load(pokemon_lookup_json)
_lookup = pokemon_lookup[self._pokemon.name]
_offset = (0, _lookup)
super().__init__(join('pokem... | BouncingPokemon | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BouncingPokemon:
def __init__(self, pokemon, position, item=True):
"""Creates a simple bouncing pokemon object. This appear on the left of the pokemon cards/objects"""
<|body_0|>
def draw(self, draw_surface):
"""Overwrite parent draw method to possibly draw the item ... | stack_v2_sparse_classes_36k_train_030412 | 23,080 | no_license | [
{
"docstring": "Creates a simple bouncing pokemon object. This appear on the left of the pokemon cards/objects",
"name": "__init__",
"signature": "def __init__(self, pokemon, position, item=True)"
},
{
"docstring": "Overwrite parent draw method to possibly draw the item surface.",
"name": "d... | 3 | stack_v2_sparse_classes_30k_train_013287 | Implement the Python class `BouncingPokemon` described below.
Class description:
Implement the BouncingPokemon class.
Method signatures and docstrings:
- def __init__(self, pokemon, position, item=True): Creates a simple bouncing pokemon object. This appear on the left of the pokemon cards/objects
- def draw(self, dr... | Implement the Python class `BouncingPokemon` described below.
Class description:
Implement the BouncingPokemon class.
Method signatures and docstrings:
- def __init__(self, pokemon, position, item=True): Creates a simple bouncing pokemon object. This appear on the left of the pokemon cards/objects
- def draw(self, dr... | 6718fdb6555d87f0b7b331c10d64a604431f8e81 | <|skeleton|>
class BouncingPokemon:
def __init__(self, pokemon, position, item=True):
"""Creates a simple bouncing pokemon object. This appear on the left of the pokemon cards/objects"""
<|body_0|>
def draw(self, draw_surface):
"""Overwrite parent draw method to possibly draw the item ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BouncingPokemon:
def __init__(self, pokemon, position, item=True):
"""Creates a simple bouncing pokemon object. This appear on the left of the pokemon cards/objects"""
self._pokemon = pokemon
with open(join('jsons', 'pokemon_lookup_s.json'), 'r') as pokemon_lookup_json:
pok... | the_stack_v2_python_sparse | pokered/modules/battle/battle_menus/poke_party.py | surranc20/pokered | train | 44 | |
410ea051f098f7cd66b248d469763845ca04585c | [
"assert isinstance(k, numbers.Number)\nself.net = net\nself.learners = {}\nself.inverse_map = inverse_map\nif learner_class is None:\n learner_class = learn.CountLearner\nfor inverse_net in inverse_map.values():\n for node in inverse_net.nodes_by_index:\n parents = node.parents\n parent_indices ... | <|body_start_0|>
assert isinstance(k, numbers.Number)
self.net = net
self.learners = {}
self.inverse_map = inverse_map
if learner_class is None:
learner_class = learn.CountLearner
for inverse_net in inverse_map.values():
for node in inverse_net.nod... | Learn distributions for all conditionals in a BayesNetMap. | Trainer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Trainer:
"""Learn distributions for all conditionals in a BayesNetMap."""
def __init__(self, net, inverse_map, precompute_gibbs, k=50, learner_class=None):
"""Extracting all distinct conditionals from inverse map. Args: net: a BayesNet inverse_map: a BayesNetMap with inverses for the... | stack_v2_sparse_classes_36k_train_030413 | 2,140 | no_license | [
{
"docstring": "Extracting all distinct conditionals from inverse map. Args: net: a BayesNet inverse_map: a BayesNetMap with inverses for the Bayes net precompute_gibbs: a Boolean indicating whether to do exact computation of Gibbs conditinoals during initialization. learner_class: a learnable distribution as d... | 3 | stack_v2_sparse_classes_30k_train_001402 | Implement the Python class `Trainer` described below.
Class description:
Learn distributions for all conditionals in a BayesNetMap.
Method signatures and docstrings:
- def __init__(self, net, inverse_map, precompute_gibbs, k=50, learner_class=None): Extracting all distinct conditionals from inverse map. Args: net: a ... | Implement the Python class `Trainer` described below.
Class description:
Learn distributions for all conditionals in a BayesNetMap.
Method signatures and docstrings:
- def __init__(self, net, inverse_map, precompute_gibbs, k=50, learner_class=None): Extracting all distinct conditionals from inverse map. Args: net: a ... | 49630b731bd5b1c43eb015075cbd794428569f53 | <|skeleton|>
class Trainer:
"""Learn distributions for all conditionals in a BayesNetMap."""
def __init__(self, net, inverse_map, precompute_gibbs, k=50, learner_class=None):
"""Extracting all distinct conditionals from inverse map. Args: net: a BayesNet inverse_map: a BayesNetMap with inverses for the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Trainer:
"""Learn distributions for all conditionals in a BayesNetMap."""
def __init__(self, net, inverse_map, precompute_gibbs, k=50, learner_class=None):
"""Extracting all distinct conditionals from inverse map. Args: net: a BayesNet inverse_map: a BayesNetMap with inverses for the Bayes net pr... | the_stack_v2_python_sparse | i3/train.py | stuhlmueller/i3 | train | 5 |
1dbea07d24a3dd4cd802ad9c72a117c351f0eb12 | [
"self.template_path = template_path\nfrom qmxgraph.configuration import GraphStyles\nfrom qmxgraph.configuration import GraphOptions\nif options is None:\n options = GraphOptions()\nif styles is None:\n styles = GraphStyles()\nself.options = options\nself.styles = styles\nself.stencils = stencils",
"from qm... | <|body_start_0|>
self.template_path = template_path
from qmxgraph.configuration import GraphStyles
from qmxgraph.configuration import GraphOptions
if options is None:
options = GraphOptions()
if styles is None:
styles = GraphStyles()
self.options =... | A simple page showing a graph drawing widget using mxGraph as its backend. | GraphPage | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GraphPage:
"""A simple page showing a graph drawing widget using mxGraph as its backend."""
def __init__(self, template_path, options=None, styles=None, stencils=tuple()):
""":param str template_path: Path where graph HTML templates are located. :param GraphOptions options: Options o... | stack_v2_sparse_classes_36k_train_030414 | 7,800 | permissive | [
{
"docstring": ":param str template_path: Path where graph HTML templates are located. :param GraphOptions options: Options of graph drawing widget, uses default if not given. :param GraphStyles styles: Styles available in graph drawing widget, uses default if not given. :param iterable[str] stencils: Stencils ... | 2 | stack_v2_sparse_classes_30k_test_000732 | Implement the Python class `GraphPage` described below.
Class description:
A simple page showing a graph drawing widget using mxGraph as its backend.
Method signatures and docstrings:
- def __init__(self, template_path, options=None, styles=None, stencils=tuple()): :param str template_path: Path where graph HTML temp... | Implement the Python class `GraphPage` described below.
Class description:
A simple page showing a graph drawing widget using mxGraph as its backend.
Method signatures and docstrings:
- def __init__(self, template_path, options=None, styles=None, stencils=tuple()): :param str template_path: Path where graph HTML temp... | e5dcf6294bd06ed08e61be5ac18a5aaa13613923 | <|skeleton|>
class GraphPage:
"""A simple page showing a graph drawing widget using mxGraph as its backend."""
def __init__(self, template_path, options=None, styles=None, stencils=tuple()):
""":param str template_path: Path where graph HTML templates are located. :param GraphOptions options: Options o... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GraphPage:
"""A simple page showing a graph drawing widget using mxGraph as its backend."""
def __init__(self, template_path, options=None, styles=None, stencils=tuple()):
""":param str template_path: Path where graph HTML templates are located. :param GraphOptions options: Options of graph drawi... | the_stack_v2_python_sparse | src/qmxgraph/server.py | ESSS/qmxgraph | train | 27 |
76e2684a8407f0e14a6b7f056d8e84d1e2f17515 | [
"if not experiments:\n raise Sorry('BEST exporter requires an experiment list')\nif not reflections:\n raise Sorry('BEST exporter require a reflection table')\nself.params = params\nself.experiments = experiments\nself.reflections = reflections",
"from dials.util import best\nexperiment = self.experiments[0... | <|body_start_0|>
if not experiments:
raise Sorry('BEST exporter requires an experiment list')
if not reflections:
raise Sorry('BEST exporter require a reflection table')
self.params = params
self.experiments = experiments
self.reflections = reflections
<|e... | BestExporter | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BestExporter:
def __init__(self, params, experiments, reflections):
"""Initialise the exporter :param params: The phil parameters :param experiments: The experiment list :param reflections: The reflection tables"""
<|body_0|>
def export(self):
"""Export the files"""
... | stack_v2_sparse_classes_36k_train_030415 | 3,812 | permissive | [
{
"docstring": "Initialise the exporter :param params: The phil parameters :param experiments: The experiment list :param reflections: The reflection tables",
"name": "__init__",
"signature": "def __init__(self, params, experiments, reflections)"
},
{
"docstring": "Export the files",
"name":... | 2 | null | Implement the Python class `BestExporter` described below.
Class description:
Implement the BestExporter class.
Method signatures and docstrings:
- def __init__(self, params, experiments, reflections): Initialise the exporter :param params: The phil parameters :param experiments: The experiment list :param reflection... | Implement the Python class `BestExporter` described below.
Class description:
Implement the BestExporter class.
Method signatures and docstrings:
- def __init__(self, params, experiments, reflections): Initialise the exporter :param params: The phil parameters :param experiments: The experiment list :param reflection... | 88bf7f7c5ac44defc046ebf0719cde748092cfff | <|skeleton|>
class BestExporter:
def __init__(self, params, experiments, reflections):
"""Initialise the exporter :param params: The phil parameters :param experiments: The experiment list :param reflections: The reflection tables"""
<|body_0|>
def export(self):
"""Export the files"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BestExporter:
def __init__(self, params, experiments, reflections):
"""Initialise the exporter :param params: The phil parameters :param experiments: The experiment list :param reflections: The reflection tables"""
if not experiments:
raise Sorry('BEST exporter requires an experime... | the_stack_v2_python_sparse | src/dials/command_line/export_best.py | dials/dials | train | 71 | |
1bc695ef067e4c1b9174d79b3382c084aab0f8a5 | [
"post = create_post(title='motley smells bad')\npost_comment = create_post_comment(post=post)\nself.assertEqual(post_comment.post_title(), 'motley smells bad')",
"anonymous_user = create_anonymous_user(is_blocked=True)\npost_comment = create_post_comment(anonymous_user=anonymous_user)\nself.assertTrue(post_commen... | <|body_start_0|>
post = create_post(title='motley smells bad')
post_comment = create_post_comment(post=post)
self.assertEqual(post_comment.post_title(), 'motley smells bad')
<|end_body_0|>
<|body_start_1|>
anonymous_user = create_anonymous_user(is_blocked=True)
post_comment = cr... | Test cases for post comments | PostCommentCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PostCommentCase:
"""Test cases for post comments"""
def test_post_title(self):
"""Tests the comment post title"""
<|body_0|>
def test_is_user_blocked(self):
"""Tests the commented user is blocked and not blocked"""
<|body_1|>
<|end_skeleton|>
<|body_sta... | stack_v2_sparse_classes_36k_train_030416 | 3,246 | no_license | [
{
"docstring": "Tests the comment post title",
"name": "test_post_title",
"signature": "def test_post_title(self)"
},
{
"docstring": "Tests the commented user is blocked and not blocked",
"name": "test_is_user_blocked",
"signature": "def test_is_user_blocked(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011066 | Implement the Python class `PostCommentCase` described below.
Class description:
Test cases for post comments
Method signatures and docstrings:
- def test_post_title(self): Tests the comment post title
- def test_is_user_blocked(self): Tests the commented user is blocked and not blocked | Implement the Python class `PostCommentCase` described below.
Class description:
Test cases for post comments
Method signatures and docstrings:
- def test_post_title(self): Tests the comment post title
- def test_is_user_blocked(self): Tests the commented user is blocked and not blocked
<|skeleton|>
class PostCommen... | eecfaf03287fdb0ee590d7ee61c0c041c0eb819a | <|skeleton|>
class PostCommentCase:
"""Test cases for post comments"""
def test_post_title(self):
"""Tests the comment post title"""
<|body_0|>
def test_is_user_blocked(self):
"""Tests the commented user is blocked and not blocked"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PostCommentCase:
"""Test cases for post comments"""
def test_post_title(self):
"""Tests the comment post title"""
post = create_post(title='motley smells bad')
post_comment = create_post_comment(post=post)
self.assertEqual(post_comment.post_title(), 'motley smells bad')
... | the_stack_v2_python_sparse | blog/tests.py | jwdepetro/avocadoist | train | 0 |
60600f4d6ee9336677c3685648a85bb380c11fe6 | [
"self._vad = webrtcvad.Vad(self.vad_mode)\nself._bytes_per_chunk = self.vad_frames * 2\nself._seconds_per_chunk = self.vad_frames / _SAMPLE_RATE\nself.reset()",
"self._audio_buffer = b''\nself._speech_seconds_left = self.speech_seconds\nself._silence_seconds_left = self.silence_seconds\nself._timeout_seconds_left... | <|body_start_0|>
self._vad = webrtcvad.Vad(self.vad_mode)
self._bytes_per_chunk = self.vad_frames * 2
self._seconds_per_chunk = self.vad_frames / _SAMPLE_RATE
self.reset()
<|end_body_0|>
<|body_start_1|>
self._audio_buffer = b''
self._speech_seconds_left = self.speech_se... | Segments an audio stream into voice commands using webrtcvad. | VoiceCommandSegmenter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VoiceCommandSegmenter:
"""Segments an audio stream into voice commands using webrtcvad."""
def __post_init__(self) -> None:
"""Initialize VAD."""
<|body_0|>
def reset(self) -> None:
"""Reset all counters and state."""
<|body_1|>
def process(self, sam... | stack_v2_sparse_classes_36k_train_030417 | 4,414 | permissive | [
{
"docstring": "Initialize VAD.",
"name": "__post_init__",
"signature": "def __post_init__(self) -> None"
},
{
"docstring": "Reset all counters and state.",
"name": "reset",
"signature": "def reset(self) -> None"
},
{
"docstring": "Process a 16-bit 16Khz mono audio samples. Retur... | 4 | null | Implement the Python class `VoiceCommandSegmenter` described below.
Class description:
Segments an audio stream into voice commands using webrtcvad.
Method signatures and docstrings:
- def __post_init__(self) -> None: Initialize VAD.
- def reset(self) -> None: Reset all counters and state.
- def process(self, samples... | Implement the Python class `VoiceCommandSegmenter` described below.
Class description:
Segments an audio stream into voice commands using webrtcvad.
Method signatures and docstrings:
- def __post_init__(self) -> None: Initialize VAD.
- def reset(self) -> None: Reset all counters and state.
- def process(self, samples... | 2e65b77b2b5c17919939481f327963abdfdc53f0 | <|skeleton|>
class VoiceCommandSegmenter:
"""Segments an audio stream into voice commands using webrtcvad."""
def __post_init__(self) -> None:
"""Initialize VAD."""
<|body_0|>
def reset(self) -> None:
"""Reset all counters and state."""
<|body_1|>
def process(self, sam... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VoiceCommandSegmenter:
"""Segments an audio stream into voice commands using webrtcvad."""
def __post_init__(self) -> None:
"""Initialize VAD."""
self._vad = webrtcvad.Vad(self.vad_mode)
self._bytes_per_chunk = self.vad_frames * 2
self._seconds_per_chunk = self.vad_frames ... | the_stack_v2_python_sparse | homeassistant/components/assist_pipeline/vad.py | konnected-io/home-assistant | train | 24 |
0f84e8179613d47030241216090797ac9c97cac3 | [
"ping_instances, half_connection_instances = ([], [])\nresult = MonitorInstancesService.get_all_used_check_instances()\nfor instance in result:\n if '半连接' == instance['type']:\n half_connection_instances.append(instance)\n if 'ping' == instance['type']:\n ping_instances.append(instance)\nping_it... | <|body_start_0|>
ping_instances, half_connection_instances = ([], [])
result = MonitorInstancesService.get_all_used_check_instances()
for instance in result:
if '半连接' == instance['type']:
half_connection_instances.append(instance)
if 'ping' == instance['ty... | check instances class | CheckInstances | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CheckInstances:
"""check instances class"""
def get_check_instances():
"""get check instances :return:"""
<|body_0|>
def save_check_instances_to_redis(ping_instances, half_connection_instances):
"""save check instances to redis :param ping_instances: :param half_... | stack_v2_sparse_classes_36k_train_030418 | 4,953 | no_license | [
{
"docstring": "get check instances :return:",
"name": "get_check_instances",
"signature": "def get_check_instances()"
},
{
"docstring": "save check instances to redis :param ping_instances: :param half_connection_instances: :return:",
"name": "save_check_instances_to_redis",
"signature"... | 6 | stack_v2_sparse_classes_30k_train_011117 | Implement the Python class `CheckInstances` described below.
Class description:
check instances class
Method signatures and docstrings:
- def get_check_instances(): get check instances :return:
- def save_check_instances_to_redis(ping_instances, half_connection_instances): save check instances to redis :param ping_in... | Implement the Python class `CheckInstances` described below.
Class description:
check instances class
Method signatures and docstrings:
- def get_check_instances(): get check instances :return:
- def save_check_instances_to_redis(ping_instances, half_connection_instances): save check instances to redis :param ping_in... | 649d1a61ac15182b55c17e47c126d98d9b956b44 | <|skeleton|>
class CheckInstances:
"""check instances class"""
def get_check_instances():
"""get check instances :return:"""
<|body_0|>
def save_check_instances_to_redis(ping_instances, half_connection_instances):
"""save check instances to redis :param ping_instances: :param half_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CheckInstances:
"""check instances class"""
def get_check_instances():
"""get check instances :return:"""
ping_instances, half_connection_instances = ([], [])
result = MonitorInstancesService.get_all_used_check_instances()
for instance in result:
if '半连接' == in... | the_stack_v2_python_sparse | server/network_monitor_web_server/check_network/monitor/check_instances.py | JasonBourne-sxy/host-web | train | 1 |
d1487352d1b5d9da15317b5073d460be7332f047 | [
"self.data_path = data_path\nself.to_deprovision = 0\nself.prov_events = self.parse_provisioning_events()\nScale.__init__(self, sim=sim, scale_rate=0, startup_delay_func=startup_delay_func, shutdown_delay=shutdown_delay)",
"events = []\ndataReader = csv.reader(open(self.data_path, 'rb'), delimiter=',')\nfor row i... | <|body_start_0|>
self.data_path = data_path
self.to_deprovision = 0
self.prov_events = self.parse_provisioning_events()
Scale.__init__(self, sim=sim, scale_rate=0, startup_delay_func=startup_delay_func, shutdown_delay=shutdown_delay)
<|end_body_0|>
<|body_start_1|>
events = []
... | Wake up periodically and Scale the cluster This scaler policy attempts to provision based on a schedule defined in a data file. This object will loop the scaling events in a period whose length is specified in the constructor. | GenericDataFileScaler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GenericDataFileScaler:
"""Wake up periodically and Scale the cluster This scaler policy attempts to provision based on a schedule defined in a data file. This object will loop the scaling events in a period whose length is specified in the constructor."""
def __init__(self, sim, startup_dela... | stack_v2_sparse_classes_36k_train_030419 | 2,939 | no_license | [
{
"docstring": "Initializes a GenericDataFileScaler object parameters: sim -- The Simulation containing a cluster cluster object this scale function is managing startup_delay_func -- A callable that returns the time a server spends in the booting state shutdown_delay -- the time a server spends in the shutting_... | 5 | stack_v2_sparse_classes_30k_train_001213 | Implement the Python class `GenericDataFileScaler` described below.
Class description:
Wake up periodically and Scale the cluster This scaler policy attempts to provision based on a schedule defined in a data file. This object will loop the scaling events in a period whose length is specified in the constructor.
Meth... | Implement the Python class `GenericDataFileScaler` described below.
Class description:
Wake up periodically and Scale the cluster This scaler policy attempts to provision based on a schedule defined in a data file. This object will loop the scaling events in a period whose length is specified in the constructor.
Meth... | 30dc0702f6189307ff776525a2f3006ec471de47 | <|skeleton|>
class GenericDataFileScaler:
"""Wake up periodically and Scale the cluster This scaler policy attempts to provision based on a schedule defined in a data file. This object will loop the scaling events in a period whose length is specified in the constructor."""
def __init__(self, sim, startup_dela... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GenericDataFileScaler:
"""Wake up periodically and Scale the cluster This scaler policy attempts to provision based on a schedule defined in a data file. This object will loop the scaling events in a period whose length is specified in the constructor."""
def __init__(self, sim, startup_delay_func, shutd... | the_stack_v2_python_sparse | appsim/scaler/data_file_policy.py | bmbouter/vcl_simulation | train | 0 |
d325c16d437c6cc947837358fb59a52650f5ff9e | [
"assert hidden_blocks == len(filters) == len(kernel_sizes) == len(paddings) == len(activations) == len(batchnorms) == len(pool_sizes) == len(dropouts)\nself.input_size = input_size\nself.hidden_blocks = hidden_blocks\nself.filters = filters\nself.kernel_sizes = kernel_sizes\nself.paddings = paddings\nself.activatio... | <|body_start_0|>
assert hidden_blocks == len(filters) == len(kernel_sizes) == len(paddings) == len(activations) == len(batchnorms) == len(pool_sizes) == len(dropouts)
self.input_size = input_size
self.hidden_blocks = hidden_blocks
self.filters = filters
self.kernel_sizes = kernel... | Used to generate our multi-output model. This CNN has three branches: COVID-19 severity, pleural line regularity, consolidation appearance.S Each branch contains a sequence of Convolutional Layers that is defined in the make_default_hidden_layers method. | CovidMultiOutputModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CovidMultiOutputModel:
"""Used to generate our multi-output model. This CNN has three branches: COVID-19 severity, pleural line regularity, consolidation appearance.S Each branch contains a sequence of Convolutional Layers that is defined in the make_default_hidden_layers method."""
def __in... | stack_v2_sparse_classes_36k_train_030420 | 8,414 | no_license | [
{
"docstring": ":param input_size: Size of input images, e.g. (C,H,W).",
"name": "__init__",
"signature": "def __init__(self, input_size, hidden_blocks: int, filters: list, kernel_sizes, paddings: list, activations: list, batchnorms: list, pool_sizes, dropouts: list, covid_params: dict, pleural_params: ... | 6 | stack_v2_sparse_classes_30k_train_000537 | Implement the Python class `CovidMultiOutputModel` described below.
Class description:
Used to generate our multi-output model. This CNN has three branches: COVID-19 severity, pleural line regularity, consolidation appearance.S Each branch contains a sequence of Convolutional Layers that is defined in the make_default... | Implement the Python class `CovidMultiOutputModel` described below.
Class description:
Used to generate our multi-output model. This CNN has three branches: COVID-19 severity, pleural line regularity, consolidation appearance.S Each branch contains a sequence of Convolutional Layers that is defined in the make_default... | 5f02ed591085e358ead41d718bb995e6799aad47 | <|skeleton|>
class CovidMultiOutputModel:
"""Used to generate our multi-output model. This CNN has three branches: COVID-19 severity, pleural line regularity, consolidation appearance.S Each branch contains a sequence of Convolutional Layers that is defined in the make_default_hidden_layers method."""
def __in... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CovidMultiOutputModel:
"""Used to generate our multi-output model. This CNN has three branches: COVID-19 severity, pleural line regularity, consolidation appearance.S Each branch contains a sequence of Convolutional Layers that is defined in the make_default_hidden_layers method."""
def __init__(self, in... | the_stack_v2_python_sparse | Automatic classification of COVID-19 based on Lung/Model_project.py | Triple-BAM/Final-Project-Automatic-detection-of-Lung-Ultrasound-characteristics-and-classification-of-COVID-19 | train | 1 |
30ff358cdba387a38bcc36d0415dcff5005f6ec9 | [
"self.set_author('MPA')\nself.set_name('SinWaves')\nself.add_stream('1hz', unit='unit')\nself.add_stream('2hz', unit='unit')\nself.set_version(12)",
"last_end_date = self.unpersist('end_timestamp', None)\ntarget_end_date = self.date('2014-09-18T00:30:00')\nif last_end_date is None:\n last_end_date = self.date(... | <|body_start_0|>
self.set_author('MPA')
self.set_name('SinWaves')
self.add_stream('1hz', unit='unit')
self.add_stream('2hz', unit='unit')
self.set_version(12)
<|end_body_0|>
<|body_start_1|>
last_end_date = self.unpersist('end_timestamp', None)
target_end_date = ... | Example1HZ | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Example1HZ:
def setup(self, opts):
"""This constructs your distillate algorithm"""
<|body_0|>
def compute(self):
"""This is called to compute your algorithm. This example generates some sin waves at different frequencies. It also ensures that this sin wave extends fr... | stack_v2_sparse_classes_36k_train_030421 | 3,194 | no_license | [
{
"docstring": "This constructs your distillate algorithm",
"name": "setup",
"signature": "def setup(self, opts)"
},
{
"docstring": "This is called to compute your algorithm. This example generates some sin waves at different frequencies. It also ensures that this sin wave extends from Sep 17th ... | 2 | null | Implement the Python class `Example1HZ` described below.
Class description:
Implement the Example1HZ class.
Method signatures and docstrings:
- def setup(self, opts): This constructs your distillate algorithm
- def compute(self): This is called to compute your algorithm. This example generates some sin waves at diffe... | Implement the Python class `Example1HZ` described below.
Class description:
Implement the Example1HZ class.
Method signatures and docstrings:
- def setup(self, opts): This constructs your distillate algorithm
- def compute(self): This is called to compute your algorithm. This example generates some sin waves at diffe... | 9db4446f29c86776ecc24e07ee4024466fdf7c77 | <|skeleton|>
class Example1HZ:
def setup(self, opts):
"""This constructs your distillate algorithm"""
<|body_0|>
def compute(self):
"""This is called to compute your algorithm. This example generates some sin waves at different frequencies. It also ensures that this sin wave extends fr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Example1HZ:
def setup(self, opts):
"""This constructs your distillate algorithm"""
self.set_author('MPA')
self.set_name('SinWaves')
self.add_stream('1hz', unit='unit')
self.add_stream('2hz', unit='unit')
self.set_version(12)
def compute(self):
"""Th... | the_stack_v2_python_sparse | legacy/MPA/example_sin.py | mindis/upmu_algorithms | train | 0 | |
5848d7e327481d518f3a0b0e71e18ede93227c19 | [
"l_dow = p_schedule_obj.DOW\nreturn 0\nl_now_day = p_now.weekday()\nl_day = 2 ** l_now_day\nl_is_in_dow = l_dow & l_day != 0\nif l_is_in_dow:\n return 0\nl_days = 1\nfor _l_ix in range(0, 7):\n l_now_day = (l_now_day + 1) % 7\n l_day = 2 ** l_now_day\n l_is_in_dow = l_dow & l_day != 0\n if l_is_in_do... | <|body_start_0|>
l_dow = p_schedule_obj.DOW
return 0
l_now_day = p_now.weekday()
l_day = 2 ** l_now_day
l_is_in_dow = l_dow & l_day != 0
if l_is_in_dow:
return 0
l_days = 1
for _l_ix in range(0, 7):
l_now_day = (l_now_day + 1) % 7
... | Get the when scheduled time. It may be from about a minute to about 1 week. If the schedule is not active return a None. The config file caries DOW as a seven charicter string 'SMTWTFS' where the DOW letter is replaced by a dash '-' if inactive. Therefore wednesday only will be represented by '---W---' This class deals... | TimeCalcs | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TimeCalcs:
"""Get the when scheduled time. It may be from about a minute to about 1 week. If the schedule is not active return a None. The config file caries DOW as a seven charicter string 'SMTWTFS' where the DOW letter is replaced by a dash '-' if inactive. Therefore wednesday only will be repr... | stack_v2_sparse_classes_36k_train_030422 | 25,512 | permissive | [
{
"docstring": "Get the number of days until the next DayOfWeek in the schedule. DayOfWeek mon=1, tue=2, wed=4, thu=8, fri=16, sat=32, sun=64 weekday() mon=0, tue=1, wed=2, thu=3, fri=4, sat=5, sun=6 @param p_schedule_obj: is the schedule object we are working on @param p_now: is a datetime.datetime.now() @retu... | 2 | null | Implement the Python class `TimeCalcs` described below.
Class description:
Get the when scheduled time. It may be from about a minute to about 1 week. If the schedule is not active return a None. The config file caries DOW as a seven charicter string 'SMTWTFS' where the DOW letter is replaced by a dash '-' if inactive... | Implement the Python class `TimeCalcs` described below.
Class description:
Get the when scheduled time. It may be from about a minute to about 1 week. If the schedule is not active return a None. The config file caries DOW as a seven charicter string 'SMTWTFS' where the DOW letter is replaced by a dash '-' if inactive... | a100fc67761a22ae47ed6f21f3c9464e2de5d54f | <|skeleton|>
class TimeCalcs:
"""Get the when scheduled time. It may be from about a minute to about 1 week. If the schedule is not active return a None. The config file caries DOW as a seven charicter string 'SMTWTFS' where the DOW letter is replaced by a dash '-' if inactive. Therefore wednesday only will be repr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TimeCalcs:
"""Get the when scheduled time. It may be from about a minute to about 1 week. If the schedule is not active return a None. The config file caries DOW as a seven charicter string 'SMTWTFS' where the DOW letter is replaced by a dash '-' if inactive. Therefore wednesday only will be represented by '-... | the_stack_v2_python_sparse | Project/src/Modules/House/Schedule/schedule.py | DBrianKimmel/PyHouse | train | 3 |
09a2d359f04031cc78eda7858801deed0e42e5e1 | [
"self.org_nr = org_nr\nself.org_name = org_name\nself.address = address\nself.postal_code = postal_code\nself.city = city\nself.website = website\nself.country = country\nself.additional_properties = additional_properties",
"if dictionary is None:\n return None\norg_nr = dictionary.get('OrgNr')\norg_name = dic... | <|body_start_0|>
self.org_nr = org_nr
self.org_name = org_name
self.address = address
self.postal_code = postal_code
self.city = city
self.website = website
self.country = country
self.additional_properties = additional_properties
<|end_body_0|>
<|body_st... | Implementation of the 'CompanyInfoDifiResponse' model. TODO: type model description here. Attributes: org_nr (string): TODO: type description here. org_name (string): TODO: type description here. address (string): TODO: type description here. postal_code (string): TODO: type description here. city (string): TODO: type ... | CompanyInfoDifiResponse | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CompanyInfoDifiResponse:
"""Implementation of the 'CompanyInfoDifiResponse' model. TODO: type model description here. Attributes: org_nr (string): TODO: type description here. org_name (string): TODO: type description here. address (string): TODO: type description here. postal_code (string): TODO... | stack_v2_sparse_classes_36k_train_030423 | 3,192 | permissive | [
{
"docstring": "Constructor for the CompanyInfoDifiResponse class",
"name": "__init__",
"signature": "def __init__(self, org_nr=None, org_name=None, address=None, postal_code=None, city=None, website=None, country=None, additional_properties={})"
},
{
"docstring": "Creates an instance of this mo... | 2 | null | Implement the Python class `CompanyInfoDifiResponse` described below.
Class description:
Implementation of the 'CompanyInfoDifiResponse' model. TODO: type model description here. Attributes: org_nr (string): TODO: type description here. org_name (string): TODO: type description here. address (string): TODO: type descr... | Implement the Python class `CompanyInfoDifiResponse` described below.
Class description:
Implementation of the 'CompanyInfoDifiResponse' model. TODO: type model description here. Attributes: org_nr (string): TODO: type description here. org_name (string): TODO: type description here. address (string): TODO: type descr... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class CompanyInfoDifiResponse:
"""Implementation of the 'CompanyInfoDifiResponse' model. TODO: type model description here. Attributes: org_nr (string): TODO: type description here. org_name (string): TODO: type description here. address (string): TODO: type description here. postal_code (string): TODO... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CompanyInfoDifiResponse:
"""Implementation of the 'CompanyInfoDifiResponse' model. TODO: type model description here. Attributes: org_nr (string): TODO: type description here. org_name (string): TODO: type description here. address (string): TODO: type description here. postal_code (string): TODO: type descri... | the_stack_v2_python_sparse | idfy_rest_client/models/company_info_difi_response.py | dealflowteam/Idfy | train | 0 |
de95eec0ae35b75fbe292041588de360373e7944 | [
"current = parent * 10 + root.val\nif not root.left and (not root.right):\n ans[0] += current\n return\nif root.left:\n self.sumNumbersHelper(root.left, current, ans)\nif root.right:\n self.sumNumbersHelper(root.right, current, ans)\nreturn",
"if not root:\n return 0\nans = [0]\nself.sumNumbersHelp... | <|body_start_0|>
current = parent * 10 + root.val
if not root.left and (not root.right):
ans[0] += current
return
if root.left:
self.sumNumbersHelper(root.left, current, ans)
if root.right:
self.sumNumbersHelper(root.right, current, ans)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def sumNumbersHelper(self, root, parent, ans):
""":type root: TreeNode :rtype: (int, int)"""
<|body_0|>
def sumNumbers(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
current = parent * 10 +... | stack_v2_sparse_classes_36k_train_030424 | 945 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: (int, int)",
"name": "sumNumbersHelper",
"signature": "def sumNumbersHelper(self, root, parent, ans)"
},
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "sumNumbers",
"signature": "def sumNumbers(self, root)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sumNumbersHelper(self, root, parent, ans): :type root: TreeNode :rtype: (int, int)
- def sumNumbers(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 sumNumbersHelper(self, root, parent, ans): :type root: TreeNode :rtype: (int, int)
- def sumNumbers(self, root): :type root: TreeNode :rtype: int
<|skeleton|>
class Solution... | 414af3b0c1a02cb08128b4a6246ee612b3458a62 | <|skeleton|>
class Solution:
def sumNumbersHelper(self, root, parent, ans):
""":type root: TreeNode :rtype: (int, int)"""
<|body_0|>
def sumNumbers(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 sumNumbersHelper(self, root, parent, ans):
""":type root: TreeNode :rtype: (int, int)"""
current = parent * 10 + root.val
if not root.left and (not root.right):
ans[0] += current
return
if root.left:
self.sumNumbersHelper(root.l... | the_stack_v2_python_sparse | 129.sum-root-to-leaf-numbers/solution.py | binshengliu/leetcode | train | 0 | |
c7fd2822d044a839a815846260a5bdbe9be1eabd | [
"self.dim = dim\nself.parts = parts\nself.surface = pygame.Surface(dim)\nself.width, self.height = dim\nself.parts = self._initialize_parts(parts)\nself.radius = self.height // 2\nself.center = pygame.Vector2(self.width // 4, self.height // 2)\nself.timeseries_x = self.width // 2\nself.timeseries = [0.0] * 512\nsel... | <|body_start_0|>
self.dim = dim
self.parts = parts
self.surface = pygame.Surface(dim)
self.width, self.height = dim
self.parts = self._initialize_parts(parts)
self.radius = self.height // 2
self.center = pygame.Vector2(self.width // 4, self.height // 2)
se... | Fourier Animation, left side showing some oscillating vector, right side timelines of x,y,radius,phi | Fourier | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Fourier:
"""Fourier Animation, left side showing some oscillating vector, right side timelines of x,y,radius,phi"""
def __init__(self, dim: tuple, parts=1):
""":param surface: surface to draw on :param center: center of calculations in (x, y) :param amplitude: maximum amplitude of si... | stack_v2_sparse_classes_36k_train_030425 | 5,878 | no_license | [
{
"docstring": ":param surface: surface to draw on :param center: center of calculations in (x, y) :param amplitude: maximum amplitude of single part :param pats: number of parts to generate",
"name": "__init__",
"signature": "def __init__(self, dim: tuple, parts=1)"
},
{
"docstring": "initializ... | 3 | stack_v2_sparse_classes_30k_train_016373 | Implement the Python class `Fourier` described below.
Class description:
Fourier Animation, left side showing some oscillating vector, right side timelines of x,y,radius,phi
Method signatures and docstrings:
- def __init__(self, dim: tuple, parts=1): :param surface: surface to draw on :param center: center of calcula... | Implement the Python class `Fourier` described below.
Class description:
Fourier Animation, left side showing some oscillating vector, right side timelines of x,y,radius,phi
Method signatures and docstrings:
- def __init__(self, dim: tuple, parts=1): :param surface: surface to draw on :param center: center of calcula... | 1fd421195a2888c0588a49f5a043a1110eedcdbf | <|skeleton|>
class Fourier:
"""Fourier Animation, left side showing some oscillating vector, right side timelines of x,y,radius,phi"""
def __init__(self, dim: tuple, parts=1):
""":param surface: surface to draw on :param center: center of calculations in (x, y) :param amplitude: maximum amplitude of si... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Fourier:
"""Fourier Animation, left side showing some oscillating vector, right side timelines of x,y,radius,phi"""
def __init__(self, dim: tuple, parts=1):
""":param surface: surface to draw on :param center: center of calculations in (x, y) :param amplitude: maximum amplitude of single part :pa... | the_stack_v2_python_sparse | effects/Fourier.py | gunny26/pygame | train | 5 |
ae53ce51b67ccea4836c1ec7ad4421123c9336ed | [
"if not root:\n return '# '\nans = str(root.val) + ' '\nans += self.serialize(root.left)\nans += self.serialize(root.right)\nreturn ans",
"def helper(data):\n if not data:\n return None\n cur = data.pop(0)\n if cur == '#':\n return None\n root = TreeNode(int(cur))\n root.left = hel... | <|body_start_0|>
if not root:
return '# '
ans = str(root.val) + ' '
ans += self.serialize(root.left)
ans += self.serialize(root.right)
return ans
<|end_body_0|>
<|body_start_1|>
def helper(data):
if not data:
return None
... | Codec | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> TreeNode:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root:
... | stack_v2_sparse_classes_36k_train_030426 | 834 | permissive | [
{
"docstring": "Encodes a tree to a single string.",
"name": "serialize",
"signature": "def serialize(self, root: TreeNode) -> str"
},
{
"docstring": "Decodes your encoded data to tree.",
"name": "deserialize",
"signature": "def deserialize(self, data: str) -> TreeNode"
}
] | 2 | stack_v2_sparse_classes_30k_train_010083 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
<|skeleton|>
class Co... | 64018a9ead8731ef98d48ab3bbd9d1dd6410c6e7 | <|skeleton|>
class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> TreeNode:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
if not root:
return '# '
ans = str(root.val) + ' '
ans += self.serialize(root.left)
ans += self.serialize(root.right)
return ans
def deserialize(self, da... | the_stack_v2_python_sparse | 449_SerializeandDeserializeBST/Codec.py | excaliburnan/SolutionsOnLeetcodeForZZW | train | 0 | |
7e60399ac0ee75fbbbd27e7ef442eaaed5ef7a20 | [
"video_uuid = uuid.uuid1()\nsession_uuid = uuid.uuid1()\ntry:\n serializer = VideoSerializer(data=request.data, partial=True)\n serializer.is_valid(raise_exception=True)\n serializer.save(video_id=video_uuid, session_id=session_uuid)\n return Response({'status': 'success', 'code': 1}, status.HTTP_200_OK... | <|body_start_0|>
video_uuid = uuid.uuid1()
session_uuid = uuid.uuid1()
try:
serializer = VideoSerializer(data=request.data, partial=True)
serializer.is_valid(raise_exception=True)
serializer.save(video_id=video_uuid, session_id=session_uuid)
return... | Add notifications details and save in DB | Videos | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Videos:
"""Add notifications details and save in DB"""
def post(request):
"""Add appointment to DB"""
<|body_0|>
def put(request):
"""This has been used for ratings"""
<|body_1|>
def notify_staff(all_tokens, message):
"""Send notification to ... | stack_v2_sparse_classes_36k_train_030427 | 20,501 | no_license | [
{
"docstring": "Add appointment to DB",
"name": "post",
"signature": "def post(request)"
},
{
"docstring": "This has been used for ratings",
"name": "put",
"signature": "def put(request)"
},
{
"docstring": "Send notification to the doctor",
"name": "notify_staff",
"signat... | 3 | stack_v2_sparse_classes_30k_train_021083 | Implement the Python class `Videos` described below.
Class description:
Add notifications details and save in DB
Method signatures and docstrings:
- def post(request): Add appointment to DB
- def put(request): This has been used for ratings
- def notify_staff(all_tokens, message): Send notification to the doctor | Implement the Python class `Videos` described below.
Class description:
Add notifications details and save in DB
Method signatures and docstrings:
- def post(request): Add appointment to DB
- def put(request): This has been used for ratings
- def notify_staff(all_tokens, message): Send notification to the doctor
<|s... | cb811523f0867a2824a39f1e70e30ed63c57f857 | <|skeleton|>
class Videos:
"""Add notifications details and save in DB"""
def post(request):
"""Add appointment to DB"""
<|body_0|>
def put(request):
"""This has been used for ratings"""
<|body_1|>
def notify_staff(all_tokens, message):
"""Send notification to ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Videos:
"""Add notifications details and save in DB"""
def post(request):
"""Add appointment to DB"""
video_uuid = uuid.uuid1()
session_uuid = uuid.uuid1()
try:
serializer = VideoSerializer(data=request.data, partial=True)
serializer.is_valid(raise_... | the_stack_v2_python_sparse | south_fitness_server/apps/videos/views.py | GransonO/south-fitness | train | 1 |
184aee640aa2202bafc215080635ceb4d5e7a02d | [
"choices = []\nfor update in ContentUpdate.objects.all():\n choice = (update.member.id, update.member.get_full_name())\n choices.append(choice)\nreturn choices",
"if self.value():\n member = Member.objects.get(pk=self.value())\n return queryset.filter(member=member)\nreturn queryset"
] | <|body_start_0|>
choices = []
for update in ContentUpdate.objects.all():
choice = (update.member.id, update.member.get_full_name())
choices.append(choice)
return choices
<|end_body_0|>
<|body_start_1|>
if self.value():
member = Member.objects.get(pk=s... | Implements the filtering of ContentUpdate by member on Content Vendor website | ClientListFilter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClientListFilter:
"""Implements the filtering of ContentUpdate by member on Content Vendor website"""
def lookups(self, request, model_admin):
"""Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second ... | stack_v2_sparse_classes_36k_train_030428 | 11,702 | no_license | [
{
"docstring": "Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar.",
"name": "lookups",
"signature": "def lookups(self, request,... | 2 | stack_v2_sparse_classes_30k_train_017712 | Implement the Python class `ClientListFilter` described below.
Class description:
Implements the filtering of ContentUpdate by member on Content Vendor website
Method signatures and docstrings:
- def lookups(self, request, model_admin): Returns a list of tuples. The first element in each tuple is the coded value for ... | Implement the Python class `ClientListFilter` described below.
Class description:
Implements the filtering of ContentUpdate by member on Content Vendor website
Method signatures and docstrings:
- def lookups(self, request, model_admin): Returns a list of tuples. The first element in each tuple is the coded value for ... | d9dcb05d25046d6e849c9ce7764af9b46c22a813 | <|skeleton|>
class ClientListFilter:
"""Implements the filtering of ContentUpdate by member on Content Vendor website"""
def lookups(self, request, model_admin):
"""Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ClientListFilter:
"""Implements the filtering of ContentUpdate by member on Content Vendor website"""
def lookups(self, request, model_admin):
"""Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is th... | the_stack_v2_python_sparse | sales/admin.py | komsihon/Project8 | train | 0 |
ebdd2684e96d0a151a5f39902f8b3b87c2a8cabc | [
"super(DeactivateReactivateBFV, cls).setUpClass()\ncls.server = cls.compute.servers.behaviors.create_active_server().entity\ncls.image = cls.compute.images.behaviors.create_active_image(cls.server.id).entity\ncls.resources.add(cls.server.id, cls.compute.servers.client.delete_server)\ncls.resources.add(cls.image.id,... | <|body_start_0|>
super(DeactivateReactivateBFV, cls).setUpClass()
cls.server = cls.compute.servers.behaviors.create_active_server().entity
cls.image = cls.compute.images.behaviors.create_active_image(cls.server.id).entity
cls.resources.add(cls.server.id, cls.compute.servers.client.delete... | DeactivateReactivateBFV | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeactivateReactivateBFV:
def setUpClass(cls):
"""Perform actions that setup the necessary resources for testing The following resources are created during this setup: - A server with defaults defined in server behaviors - An image from the newly created server The following data is gener... | stack_v2_sparse_classes_36k_train_030429 | 5,125 | permissive | [
{
"docstring": "Perform actions that setup the necessary resources for testing The following resources are created during this setup: - A server with defaults defined in server behaviors - An image from the newly created server The following data is generated during this set up: - Get compute integration compos... | 3 | null | Implement the Python class `DeactivateReactivateBFV` described below.
Class description:
Implement the DeactivateReactivateBFV class.
Method signatures and docstrings:
- def setUpClass(cls): Perform actions that setup the necessary resources for testing The following resources are created during this setup: - A serve... | Implement the Python class `DeactivateReactivateBFV` described below.
Class description:
Implement the DeactivateReactivateBFV class.
Method signatures and docstrings:
- def setUpClass(cls): Perform actions that setup the necessary resources for testing The following resources are created during this setup: - A serve... | 30f0e64672676c3f90b4a582fe90fac6621475b3 | <|skeleton|>
class DeactivateReactivateBFV:
def setUpClass(cls):
"""Perform actions that setup the necessary resources for testing The following resources are created during this setup: - A server with defaults defined in server behaviors - An image from the newly created server The following data is gener... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DeactivateReactivateBFV:
def setUpClass(cls):
"""Perform actions that setup the necessary resources for testing The following resources are created during this setup: - A server with defaults defined in server behaviors - An image from the newly created server The following data is generated during th... | the_stack_v2_python_sparse | cloudroast/glance/integration/compute/bfv/deactivate_reactivate_bfv_test.py | RULCSoft/cloudroast | train | 1 | |
5dcb144d969c42513703b600c0d2259a0b8e175e | [
"self.state_list = state_list\nself.action_list = action_list\nself.value_function = dict([(s, 0) for s in state_list])\nself.dynamics_model = dynamics_model\nself.reward_function = reward_function\nself.policy = dict([(s, 0) for s in state_list])\nself.fitted = False",
"for t in range(horizon):\n self._one_st... | <|body_start_0|>
self.state_list = state_list
self.action_list = action_list
self.value_function = dict([(s, 0) for s in state_list])
self.dynamics_model = dynamics_model
self.reward_function = reward_function
self.policy = dict([(s, 0) for s in state_list])
self.... | ValueIteration | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ValueIteration:
def __init__(self, state_list, action_list, dynamics_model, reward_function):
"""Pass in an iterable of states, actions, dynamics_model, reward_function Positional arguments: state_list -- list of all feasible states action_list -- list of all feasible actions dynamics_mo... | stack_v2_sparse_classes_36k_train_030430 | 3,542 | no_license | [
{
"docstring": "Pass in an iterable of states, actions, dynamics_model, reward_function Positional arguments: state_list -- list of all feasible states action_list -- list of all feasible actions dynamics_model -- map from (state,action) to a list of (state, prob) tuples",
"name": "__init__",
"signature... | 5 | stack_v2_sparse_classes_30k_train_002064 | Implement the Python class `ValueIteration` described below.
Class description:
Implement the ValueIteration class.
Method signatures and docstrings:
- def __init__(self, state_list, action_list, dynamics_model, reward_function): Pass in an iterable of states, actions, dynamics_model, reward_function Positional argum... | Implement the Python class `ValueIteration` described below.
Class description:
Implement the ValueIteration class.
Method signatures and docstrings:
- def __init__(self, state_list, action_list, dynamics_model, reward_function): Pass in an iterable of states, actions, dynamics_model, reward_function Positional argum... | 468d2dab6fbf8f4135d52d5e670815008cb8d56d | <|skeleton|>
class ValueIteration:
def __init__(self, state_list, action_list, dynamics_model, reward_function):
"""Pass in an iterable of states, actions, dynamics_model, reward_function Positional arguments: state_list -- list of all feasible states action_list -- list of all feasible actions dynamics_mo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ValueIteration:
def __init__(self, state_list, action_list, dynamics_model, reward_function):
"""Pass in an iterable of states, actions, dynamics_model, reward_function Positional arguments: state_list -- list of all feasible states action_list -- list of all feasible actions dynamics_model -- map fro... | the_stack_v2_python_sparse | segmentcentroid/planner/value_iteration.py | royf/ddo | train | 2 | |
56bc677ffe39cbc3975bf7387e04f0fca921c637 | [
"if not isinstance(product_repository, ProductRepository):\n raise Exception(f'Error product_repository: {product_repository} is not instance ProductRepository')\nif not isinstance(store_repository, StoreRepository):\n raise Exception(f'Error store_repository: {store_repository} is not instance StoreRepositor... | <|body_start_0|>
if not isinstance(product_repository, ProductRepository):
raise Exception(f'Error product_repository: {product_repository} is not instance ProductRepository')
if not isinstance(store_repository, StoreRepository):
raise Exception(f'Error store_repository: {store_r... | Product Creator | ProductUpdater | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProductUpdater:
"""Product Creator"""
def __init__(self, product_repository: ProductRepository, store_repository: StoreRepository):
"""Constructor Product creator @param product_repository: Product repository @type product_repository: ProductRepository @param store_repository: Store ... | stack_v2_sparse_classes_36k_train_030431 | 2,266 | no_license | [
{
"docstring": "Constructor Product creator @param product_repository: Product repository @type product_repository: ProductRepository @param store_repository: Store repository @type store_repository: StoreRepository",
"name": "__init__",
"signature": "def __init__(self, product_repository: ProductReposi... | 2 | stack_v2_sparse_classes_30k_train_012739 | Implement the Python class `ProductUpdater` described below.
Class description:
Product Creator
Method signatures and docstrings:
- def __init__(self, product_repository: ProductRepository, store_repository: StoreRepository): Constructor Product creator @param product_repository: Product repository @type product_repo... | Implement the Python class `ProductUpdater` described below.
Class description:
Product Creator
Method signatures and docstrings:
- def __init__(self, product_repository: ProductRepository, store_repository: StoreRepository): Constructor Product creator @param product_repository: Product repository @type product_repo... | 0bfe0059ab0d59243794b03f70ceffe3a1a263be | <|skeleton|>
class ProductUpdater:
"""Product Creator"""
def __init__(self, product_repository: ProductRepository, store_repository: StoreRepository):
"""Constructor Product creator @param product_repository: Product repository @type product_repository: ProductRepository @param store_repository: Store ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProductUpdater:
"""Product Creator"""
def __init__(self, product_repository: ProductRepository, store_repository: StoreRepository):
"""Constructor Product creator @param product_repository: Product repository @type product_repository: ProductRepository @param store_repository: Store repository @t... | the_stack_v2_python_sparse | modules/store/application/update/product_updater.py | eduardolujan/product_hub | train | 0 |
61eb98f72306a5956921d213ffe3f60528d29617 | [
"if isinstance(distrib, dict):\n total_prob = sum(distrib.values())\n if total_prob <= 0.0:\n InferenceUtils.log.warning('all assignments in the distribution have a zero probability, cannot be normalised')\n return distrib\n for key, value in distrib.items():\n distrib[key] = distrib[k... | <|body_start_0|>
if isinstance(distrib, dict):
total_prob = sum(distrib.values())
if total_prob <= 0.0:
InferenceUtils.log.warning('all assignments in the distribution have a zero probability, cannot be normalised')
return distrib
for key, valu... | Utility functions for inference operations. | InferenceUtils | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InferenceUtils:
"""Utility functions for inference operations."""
def normalize(distrib):
"""Normalise the given probability distribution (assuming no conditional variables). :param distrib: the distribution to normalise :return: the normalised distribution"""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_030432 | 5,313 | permissive | [
{
"docstring": "Normalise the given probability distribution (assuming no conditional variables). :param distrib: the distribution to normalise :return: the normalised distribution",
"name": "normalize",
"signature": "def normalize(distrib)"
},
{
"docstring": "Normalises the double array (ensuri... | 5 | stack_v2_sparse_classes_30k_train_016031 | Implement the Python class `InferenceUtils` described below.
Class description:
Utility functions for inference operations.
Method signatures and docstrings:
- def normalize(distrib): Normalise the given probability distribution (assuming no conditional variables). :param distrib: the distribution to normalise :retur... | Implement the Python class `InferenceUtils` described below.
Class description:
Utility functions for inference operations.
Method signatures and docstrings:
- def normalize(distrib): Normalise the given probability distribution (assuming no conditional variables). :param distrib: the distribution to normalise :retur... | c9bca653c18ccc082dc8b86b4a8feee9ed00a75b | <|skeleton|>
class InferenceUtils:
"""Utility functions for inference operations."""
def normalize(distrib):
"""Normalise the given probability distribution (assuming no conditional variables). :param distrib: the distribution to normalise :return: the normalised distribution"""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InferenceUtils:
"""Utility functions for inference operations."""
def normalize(distrib):
"""Normalise the given probability distribution (assuming no conditional variables). :param distrib: the distribution to normalise :return: the normalised distribution"""
if isinstance(distrib, dict)... | the_stack_v2_python_sparse | utils/inference_utils.py | ppijbb/PyOpenDial | train | 0 |
4d4b826f155f28da5233188d67c7b483046ce082 | [
"self.preprocesamiento = preprocesamiento\nself.dir_temporal = dir_temporal\nself.lenguaje = lenguaje_tesseract(lenguaje)\nself.oem = oem\nself.psm = psm\nself.enderezar = enderezar",
"imagen = cv2.imread(ubicacion_imagen)\nif 0 < self.preprocesamiento < 6:\n imagen = eval(f'procesar_img_{self.preprocesamiento... | <|body_start_0|>
self.preprocesamiento = preprocesamiento
self.dir_temporal = dir_temporal
self.lenguaje = lenguaje_tesseract(lenguaje)
self.oem = oem
self.psm = psm
self.enderezar = enderezar
<|end_body_0|>
<|body_start_1|>
imagen = cv2.imread(ubicacion_imagen)
... | OCR | [
"X11",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OCR:
def __init__(self, preprocesamiento, lenguaje, oem, psm, dir_temporal='temp_pags/', enderezar=False):
"""Constructor por defecto de la clase OCR. Esta clase se encarga de extraer con la metodología de reconocimiento óptico de caracteres (OCR, en inglés) :param preprocesamiento: (int... | stack_v2_sparse_classes_36k_train_030433 | 8,702 | permissive | [
{
"docstring": "Constructor por defecto de la clase OCR. Esta clase se encarga de extraer con la metodología de reconocimiento óptico de caracteres (OCR, en inglés) :param preprocesamiento: (int) {1,2,3,4,5}. Especifica el nivel de preprocesamiento que se lleva a cabo antes de extraer el texto del archivo. Apli... | 4 | stack_v2_sparse_classes_30k_train_007814 | Implement the Python class `OCR` described below.
Class description:
Implement the OCR class.
Method signatures and docstrings:
- def __init__(self, preprocesamiento, lenguaje, oem, psm, dir_temporal='temp_pags/', enderezar=False): Constructor por defecto de la clase OCR. Esta clase se encarga de extraer con la metod... | Implement the Python class `OCR` described below.
Class description:
Implement the OCR class.
Method signatures and docstrings:
- def __init__(self, preprocesamiento, lenguaje, oem, psm, dir_temporal='temp_pags/', enderezar=False): Constructor por defecto de la clase OCR. Esta clase se encarga de extraer con la metod... | b6f7b22e4423769d6cc12d04049f3efa28593897 | <|skeleton|>
class OCR:
def __init__(self, preprocesamiento, lenguaje, oem, psm, dir_temporal='temp_pags/', enderezar=False):
"""Constructor por defecto de la clase OCR. Esta clase se encarga de extraer con la metodología de reconocimiento óptico de caracteres (OCR, en inglés) :param preprocesamiento: (int... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OCR:
def __init__(self, preprocesamiento, lenguaje, oem, psm, dir_temporal='temp_pags/', enderezar=False):
"""Constructor por defecto de la clase OCR. Esta clase se encarga de extraer con la metodología de reconocimiento óptico de caracteres (OCR, en inglés) :param preprocesamiento: (int) {1,2,3,4,5}.... | the_stack_v2_python_sparse | contexto/utils/ocr.py | Erik93sanches/ConTexto | train | 0 | |
5e7b52ecb441c4972fd4855ac4edcc1747d8f79f | [
"super(U_Net, self).__init__()\nself.layer_0 = UNet_Encoder_Particular(in_channels, 64)\nself.layer_1 = UNet_Encoder(64, 128)\nself.layer_2 = UNet_Encoder(128, 256)\nself.layer_3 = UNet_Encoder(256, 512)\nself.layer_4 = UNet_Encoder(512, 512)\nself.layer_7 = UNet_Decoder(1024, 256)\nself.layer_8 = UNet_Decoder(512,... | <|body_start_0|>
super(U_Net, self).__init__()
self.layer_0 = UNet_Encoder_Particular(in_channels, 64)
self.layer_1 = UNet_Encoder(64, 128)
self.layer_2 = UNet_Encoder(128, 256)
self.layer_3 = UNet_Encoder(256, 512)
self.layer_4 = UNet_Encoder(512, 512)
self.layer... | Derived Class to define a UNet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- U-Net: Convolutional Networks for Biomedical Image Segmentation | U_Net | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class U_Net:
"""Derived Class to define a UNet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- U-Net: Convolutional Networks for Biomedical Image Segmentation"""
def __init__(self, in_ch... | stack_v2_sparse_classes_36k_train_030434 | 20,094 | no_license | [
{
"docstring": "Sequential Instanciation of the different Layers",
"name": "__init__",
"signature": "def __init__(self, in_channels=3, n_classes=21)"
},
{
"docstring": "Sequential Computation, see nn.Module.forward methods PyTorch",
"name": "forward",
"signature": "def forward(self, inpu... | 2 | stack_v2_sparse_classes_30k_train_019429 | Implement the Python class `U_Net` described below.
Class description:
Derived Class to define a UNet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- U-Net: Convolutional Networks for Biomedical Image Segmen... | Implement the Python class `U_Net` described below.
Class description:
Derived Class to define a UNet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- U-Net: Convolutional Networks for Biomedical Image Segmen... | 3b63f360e67013d5962082e57fb36ebfb37d8920 | <|skeleton|>
class U_Net:
"""Derived Class to define a UNet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- U-Net: Convolutional Networks for Biomedical Image Segmentation"""
def __init__(self, in_ch... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class U_Net:
"""Derived Class to define a UNet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- U-Net: Convolutional Networks for Biomedical Image Segmentation"""
def __init__(self, in_channels=3, n_c... | the_stack_v2_python_sparse | segmentation/models/nn.py | Kivo0/vibotorch | train | 0 |
4d3a3937740594a9cd826d828ee7331adc0a3e49 | [
"self.cancelled = cancelled\nself.failed = failed\nself.running = running\nself.successful = successful\nself.total = total\nself.trend_name = trend_name\nself.trend_start_time_usecs = trend_start_time_usecs",
"if dictionary is None:\n return None\ncancelled = dictionary.get('cancelled')\nfailed = dictionary.g... | <|body_start_0|>
self.cancelled = cancelled
self.failed = failed
self.running = running
self.successful = successful
self.total = total
self.trend_name = trend_name
self.trend_start_time_usecs = trend_start_time_usecs
<|end_body_0|>
<|body_start_1|>
if di... | Implementation of the 'TrendingData' model. Specifies protection runs information per object, aggregated over a period of time. Attributes: cancelled (long|int): Specifies number of cancelled runs. failed (long|int): Specifies number of failed runs. running (long|int): Specifies number of in-progress runs. successful (... | TrendingData | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TrendingData:
"""Implementation of the 'TrendingData' model. Specifies protection runs information per object, aggregated over a period of time. Attributes: cancelled (long|int): Specifies number of cancelled runs. failed (long|int): Specifies number of failed runs. running (long|int): Specifies ... | stack_v2_sparse_classes_36k_train_030435 | 2,898 | permissive | [
{
"docstring": "Constructor for the TrendingData class",
"name": "__init__",
"signature": "def __init__(self, cancelled=None, failed=None, running=None, successful=None, total=None, trend_name=None, trend_start_time_usecs=None)"
},
{
"docstring": "Creates an instance of this model from a diction... | 2 | stack_v2_sparse_classes_30k_test_000690 | Implement the Python class `TrendingData` described below.
Class description:
Implementation of the 'TrendingData' model. Specifies protection runs information per object, aggregated over a period of time. Attributes: cancelled (long|int): Specifies number of cancelled runs. failed (long|int): Specifies number of fail... | Implement the Python class `TrendingData` described below.
Class description:
Implementation of the 'TrendingData' model. Specifies protection runs information per object, aggregated over a period of time. Attributes: cancelled (long|int): Specifies number of cancelled runs. failed (long|int): Specifies number of fail... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class TrendingData:
"""Implementation of the 'TrendingData' model. Specifies protection runs information per object, aggregated over a period of time. Attributes: cancelled (long|int): Specifies number of cancelled runs. failed (long|int): Specifies number of failed runs. running (long|int): Specifies ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TrendingData:
"""Implementation of the 'TrendingData' model. Specifies protection runs information per object, aggregated over a period of time. Attributes: cancelled (long|int): Specifies number of cancelled runs. failed (long|int): Specifies number of failed runs. running (long|int): Specifies number of in-... | the_stack_v2_python_sparse | cohesity_management_sdk/models/trending_data.py | cohesity/management-sdk-python | train | 24 |
16146d589499af271b9badc3cdb6c481c9b7e9bc | [
"if obj.credit_trade.type.id in [1, 3, 5]:\n fuel_supplier = obj.credit_trade.initiator\nelse:\n fuel_supplier = obj.credit_trade.respondent\nserializer = OrganizationMinSerializer(fuel_supplier, read_only=True)\nreturn serializer.data",
"if obj.is_rescinded is True:\n return None\nreturn obj.status_id"
... | <|body_start_0|>
if obj.credit_trade.type.id in [1, 3, 5]:
fuel_supplier = obj.credit_trade.initiator
else:
fuel_supplier = obj.credit_trade.respondent
serializer = OrganizationMinSerializer(fuel_supplier, read_only=True)
return serializer.data
<|end_body_0|>
<|b... | Credit History Serializer in perspective of the User - What was the Credit Trade associated with the entry - Which fuel supplier involved - Was it rescinded - What type of Credit Trade was it | CreditTradeHistoryMinSerializer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CreditTradeHistoryMinSerializer:
"""Credit History Serializer in perspective of the User - What was the Credit Trade associated with the entry - Which fuel supplier involved - Was it rescinded - What type of Credit Trade was it"""
def get_fuel_supplier(self, obj):
"""Returns the fuel... | stack_v2_sparse_classes_36k_train_030436 | 4,656 | permissive | [
{
"docstring": "Returns the fuel supplier of the opposite end to give more context for the credit trade",
"name": "get_fuel_supplier",
"signature": "def get_fuel_supplier(self, obj)"
},
{
"docstring": "Returns the status_id unless it's rescinded. This is to hide the review information from non-g... | 2 | stack_v2_sparse_classes_30k_train_000831 | Implement the Python class `CreditTradeHistoryMinSerializer` described below.
Class description:
Credit History Serializer in perspective of the User - What was the Credit Trade associated with the entry - Which fuel supplier involved - Was it rescinded - What type of Credit Trade was it
Method signatures and docstri... | Implement the Python class `CreditTradeHistoryMinSerializer` described below.
Class description:
Credit History Serializer in perspective of the User - What was the Credit Trade associated with the entry - Which fuel supplier involved - Was it rescinded - What type of Credit Trade was it
Method signatures and docstri... | 80ae1ef5938ef5e580128ed0c622071b307fc7e1 | <|skeleton|>
class CreditTradeHistoryMinSerializer:
"""Credit History Serializer in perspective of the User - What was the Credit Trade associated with the entry - Which fuel supplier involved - Was it rescinded - What type of Credit Trade was it"""
def get_fuel_supplier(self, obj):
"""Returns the fuel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CreditTradeHistoryMinSerializer:
"""Credit History Serializer in perspective of the User - What was the Credit Trade associated with the entry - Which fuel supplier involved - Was it rescinded - What type of Credit Trade was it"""
def get_fuel_supplier(self, obj):
"""Returns the fuel supplier of ... | the_stack_v2_python_sparse | backend/api/serializers/CreditTradeHistory.py | kuanfandevops/tfrs | train | 0 |
f1d81d0b6b61f0b5b2b9584be6a857792286e76c | [
"super(LayerNorm, self).__init__()\nself.gamma = nn.Parameter(torch.ones(features))\nself.beta = nn.Parameter(torch.zeros(features))\nself.epsilon = epsilon",
"mean = x.mean(-1, keepdim=True)\nstd = x.std(-1, keepdim=True)\nreturn self.gamma * (x - mean) / (std + self.epsilon) + self.beta"
] | <|body_start_0|>
super(LayerNorm, self).__init__()
self.gamma = nn.Parameter(torch.ones(features))
self.beta = nn.Parameter(torch.zeros(features))
self.epsilon = epsilon
<|end_body_0|>
<|body_start_1|>
mean = x.mean(-1, keepdim=True)
std = x.std(-1, keepdim=True)
... | 实现LayerNorm。其实PyTorch已经实现啦,见nn.LayerNorm。 | LayerNorm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LayerNorm:
"""实现LayerNorm。其实PyTorch已经实现啦,见nn.LayerNorm。"""
def __init__(self, features, epsilon=1e-06):
"""Init. Args: features: 就是模型的维度。论文默认512 epsilon: 一个很小的数,防止数值计算的除0错误"""
<|body_0|>
def forward(self, x):
"""前向传播. Args: x: 输入序列张量,形状为[B, L, D]"""
<|bod... | stack_v2_sparse_classes_36k_train_030437 | 15,500 | no_license | [
{
"docstring": "Init. Args: features: 就是模型的维度。论文默认512 epsilon: 一个很小的数,防止数值计算的除0错误",
"name": "__init__",
"signature": "def __init__(self, features, epsilon=1e-06)"
},
{
"docstring": "前向传播. Args: x: 输入序列张量,形状为[B, L, D]",
"name": "forward",
"signature": "def forward(self, x)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006327 | Implement the Python class `LayerNorm` described below.
Class description:
实现LayerNorm。其实PyTorch已经实现啦,见nn.LayerNorm。
Method signatures and docstrings:
- def __init__(self, features, epsilon=1e-06): Init. Args: features: 就是模型的维度。论文默认512 epsilon: 一个很小的数,防止数值计算的除0错误
- def forward(self, x): 前向传播. Args: x: 输入序列张量,形状为[B, L... | Implement the Python class `LayerNorm` described below.
Class description:
实现LayerNorm。其实PyTorch已经实现啦,见nn.LayerNorm。
Method signatures and docstrings:
- def __init__(self, features, epsilon=1e-06): Init. Args: features: 就是模型的维度。论文默认512 epsilon: 一个很小的数,防止数值计算的除0错误
- def forward(self, x): 前向传播. Args: x: 输入序列张量,形状为[B, L... | 6dd9eb4b2c65c346debbaa4cfc6b6a3cbdaf8047 | <|skeleton|>
class LayerNorm:
"""实现LayerNorm。其实PyTorch已经实现啦,见nn.LayerNorm。"""
def __init__(self, features, epsilon=1e-06):
"""Init. Args: features: 就是模型的维度。论文默认512 epsilon: 一个很小的数,防止数值计算的除0错误"""
<|body_0|>
def forward(self, x):
"""前向传播. Args: x: 输入序列张量,形状为[B, L, D]"""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LayerNorm:
"""实现LayerNorm。其实PyTorch已经实现啦,见nn.LayerNorm。"""
def __init__(self, features, epsilon=1e-06):
"""Init. Args: features: 就是模型的维度。论文默认512 epsilon: 一个很小的数,防止数值计算的除0错误"""
super(LayerNorm, self).__init__()
self.gamma = nn.Parameter(torch.ones(features))
self.beta = nn.... | the_stack_v2_python_sparse | models/transformer.py | wkk-nlp/SGAN | train | 0 |
afae6124e99d4b818c49dcaaf5dce1bce48a530a | [
"self.lang_collection = {}\nself.country_collection = {}\nself.peple_count = 0\nself.read_data(file)",
"try:\n with open(file_name) as f:\n lines = f.readlines()\nexcept FileNotFoundError:\n print(\"Can't open\", file_name)\n return\nfor line in lines[1:]:\n line_list = re.split('[,\\\\n]', lin... | <|body_start_0|>
self.lang_collection = {}
self.country_collection = {}
self.peple_count = 0
self.read_data(file)
<|end_body_0|>
<|body_start_1|>
try:
with open(file_name) as f:
lines = f.readlines()
except FileNotFoundError:
print... | DataAnalysis | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataAnalysis:
def __init__(self, file):
"""Given file name, set up some instance variables string -> Nnoe"""
<|body_0|>
def read_data(self, file_name):
"""Given file name, assign values to lists and integer of the class. string -> None"""
<|body_1|>
def ... | stack_v2_sparse_classes_36k_train_030438 | 3,283 | no_license | [
{
"docstring": "Given file name, set up some instance variables string -> Nnoe",
"name": "__init__",
"signature": "def __init__(self, file)"
},
{
"docstring": "Given file name, assign values to lists and integer of the class. string -> None",
"name": "read_data",
"signature": "def read_d... | 6 | stack_v2_sparse_classes_30k_train_001169 | Implement the Python class `DataAnalysis` described below.
Class description:
Implement the DataAnalysis class.
Method signatures and docstrings:
- def __init__(self, file): Given file name, set up some instance variables string -> Nnoe
- def read_data(self, file_name): Given file name, assign values to lists and int... | Implement the Python class `DataAnalysis` described below.
Class description:
Implement the DataAnalysis class.
Method signatures and docstrings:
- def __init__(self, file): Given file name, set up some instance variables string -> Nnoe
- def read_data(self, file_name): Given file name, assign values to lists and int... | 51698ba8bfc2201639e6f4d358e0fc531780d2fc | <|skeleton|>
class DataAnalysis:
def __init__(self, file):
"""Given file name, set up some instance variables string -> Nnoe"""
<|body_0|>
def read_data(self, file_name):
"""Given file name, assign values to lists and integer of the class. string -> None"""
<|body_1|>
def ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataAnalysis:
def __init__(self, file):
"""Given file name, set up some instance variables string -> Nnoe"""
self.lang_collection = {}
self.country_collection = {}
self.peple_count = 0
self.read_data(file)
def read_data(self, file_name):
"""Given file name,... | the_stack_v2_python_sparse | lab08_Chenxi_Cai/user_data_starter/data_analysis.py | xiaohaiguicc/CS5001 | train | 0 | |
4fab96b9292a35b2ea87f9b2395723953c4aaeb1 | [
"super().__init__(hyper_parameters)\nself.num_rnn_layers = hyper_parameters['graph'].get('num_rnn_layers', 2)\nself.crf_lr_multiplier = hyper_parameters.get('train', {}).get('crf_lr_multiplier', 1 if self.embed_type in ['WARD', 'RANDOM'] else 3200)",
"if self.rnn_type == 'LSTM':\n rnn_cell = L.LSTM\nelif self.... | <|body_start_0|>
super().__init__(hyper_parameters)
self.num_rnn_layers = hyper_parameters['graph'].get('num_rnn_layers', 2)
self.crf_lr_multiplier = hyper_parameters.get('train', {}).get('crf_lr_multiplier', 1 if self.embed_type in ['WARD', 'RANDOM'] else 3200)
<|end_body_0|>
<|body_start_1|>
... | BiLstmLANGraph | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BiLstmLANGraph:
def __init__(self, hyper_parameters):
"""Init of hyper_parameters and build_embed. Args: hyper_parameters: hyper_parameters of all, which contains "sharing", "embed", "graph", "train", "save" and "data". Returns: None"""
<|body_0|>
def build_model(self, input... | stack_v2_sparse_classes_36k_train_030439 | 2,833 | permissive | [
{
"docstring": "Init of hyper_parameters and build_embed. Args: hyper_parameters: hyper_parameters of all, which contains \"sharing\", \"embed\", \"graph\", \"train\", \"save\" and \"data\". Returns: None",
"name": "__init__",
"signature": "def __init__(self, hyper_parameters)"
},
{
"docstring":... | 2 | null | Implement the Python class `BiLstmLANGraph` described below.
Class description:
Implement the BiLstmLANGraph class.
Method signatures and docstrings:
- def __init__(self, hyper_parameters): Init of hyper_parameters and build_embed. Args: hyper_parameters: hyper_parameters of all, which contains "sharing", "embed", "g... | Implement the Python class `BiLstmLANGraph` described below.
Class description:
Implement the BiLstmLANGraph class.
Method signatures and docstrings:
- def __init__(self, hyper_parameters): Init of hyper_parameters and build_embed. Args: hyper_parameters: hyper_parameters of all, which contains "sharing", "embed", "g... | 5237381459db5909f392737e33618a16c1e0452a | <|skeleton|>
class BiLstmLANGraph:
def __init__(self, hyper_parameters):
"""Init of hyper_parameters and build_embed. Args: hyper_parameters: hyper_parameters of all, which contains "sharing", "embed", "graph", "train", "save" and "data". Returns: None"""
<|body_0|>
def build_model(self, input... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BiLstmLANGraph:
def __init__(self, hyper_parameters):
"""Init of hyper_parameters and build_embed. Args: hyper_parameters: hyper_parameters of all, which contains "sharing", "embed", "graph", "train", "save" and "data". Returns: None"""
super().__init__(hyper_parameters)
self.num_rnn_l... | the_stack_v2_python_sparse | macadam/sl/s05_bilstm_lan.py | payiz-asj/Macadam | train | 1 | |
4ae013d5deff13b720fd472e1b66ef4d32828489 | [
"_path = _path + [start_index]\nif start_index == end_index:\n return [_path]\nif start_index > self.get_nodes_len():\n return []\npaths = []\nedges = self.get_edges(True)\nfor edge in edges[start_index]:\n newpaths = self.find_all_paths(edge[1], end_index, _path)\n for newpath in newpaths:\n pat... | <|body_start_0|>
_path = _path + [start_index]
if start_index == end_index:
return [_path]
if start_index > self.get_nodes_len():
return []
paths = []
edges = self.get_edges(True)
for edge in edges[start_index]:
newpaths = self.find_all... | FindPathGraph | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FindPathGraph:
def find_all_paths(self, start_index, end_index, _path=[]):
"""Finds all possible ways between vertexes of graph :Parameters: start_index: *number* start index of path end_index: *number* end index of path _path: *list* current building path :Returns: *list* all possible p... | stack_v2_sparse_classes_36k_train_030440 | 1,692 | no_license | [
{
"docstring": "Finds all possible ways between vertexes of graph :Parameters: start_index: *number* start index of path end_index: *number* end index of path _path: *list* current building path :Returns: *list* all possible paths",
"name": "find_all_paths",
"signature": "def find_all_paths(self, start_... | 2 | null | Implement the Python class `FindPathGraph` described below.
Class description:
Implement the FindPathGraph class.
Method signatures and docstrings:
- def find_all_paths(self, start_index, end_index, _path=[]): Finds all possible ways between vertexes of graph :Parameters: start_index: *number* start index of path end... | Implement the Python class `FindPathGraph` described below.
Class description:
Implement the FindPathGraph class.
Method signatures and docstrings:
- def find_all_paths(self, start_index, end_index, _path=[]): Finds all possible ways between vertexes of graph :Parameters: start_index: *number* start index of path end... | 8b3b1f146b7eac5dc15b16aaf837441069cf5989 | <|skeleton|>
class FindPathGraph:
def find_all_paths(self, start_index, end_index, _path=[]):
"""Finds all possible ways between vertexes of graph :Parameters: start_index: *number* start index of path end_index: *number* end index of path _path: *list* current building path :Returns: *list* all possible p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FindPathGraph:
def find_all_paths(self, start_index, end_index, _path=[]):
"""Finds all possible ways between vertexes of graph :Parameters: start_index: *number* start index of path end_index: *number* end index of path _path: *list* current building path :Returns: *list* all possible paths"""
... | the_stack_v2_python_sparse | graph/find_path.py | shuvava/python_algorithms | train | 2 | |
0fbcce9623e79c0682c81294499fd408ebac7900 | [
"if len(nums) < 2 or sum(nums) % 2:\n return False\nnums.sort()\ndp = [[0] * (sum(nums) // 2 + 1) for _ in range(len(nums) + 1)]\nfor i in range(1, len(nums) + 1):\n for j in range(1, sum(nums) // 2 + 1):\n if nums[i - 1] == j:\n dp[i][j] = 1\n continue\n if j - nums[i - 1]... | <|body_start_0|>
if len(nums) < 2 or sum(nums) % 2:
return False
nums.sort()
dp = [[0] * (sum(nums) // 2 + 1) for _ in range(len(nums) + 1)]
for i in range(1, len(nums) + 1):
for j in range(1, sum(nums) // 2 + 1):
if nums[i - 1] == j:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def canPartition(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def canPartition_refer(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(nums) < 2 or sum(nums) % 2:
... | stack_v2_sparse_classes_36k_train_030441 | 2,101 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "canPartition",
"signature": "def canPartition(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "canPartition_refer",
"signature": "def canPartition_refer(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canPartition(self, nums): :type nums: List[int] :rtype: bool
- def canPartition_refer(self, nums): :type nums: List[int] :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canPartition(self, nums): :type nums: List[int] :rtype: bool
- def canPartition_refer(self, nums): :type nums: List[int] :rtype: bool
<|skeleton|>
class Solution:
def c... | f3fc71f344cd758cfce77f16ab72992c99ab288e | <|skeleton|>
class Solution:
def canPartition(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def canPartition_refer(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def canPartition(self, nums):
""":type nums: List[int] :rtype: bool"""
if len(nums) < 2 or sum(nums) % 2:
return False
nums.sort()
dp = [[0] * (sum(nums) // 2 + 1) for _ in range(len(nums) + 1)]
for i in range(1, len(nums) + 1):
for j i... | the_stack_v2_python_sparse | 416_canPartition.py | jennyChing/leetCode | train | 2 | |
1a78ab721be7adabb9212886a3225b6d6ff9a979 | [
"self.host = host\nself.port = port\nself.username = username\nself.password = password\nself.private_key = private_key\nself.private_key_passphrase = private_key_passphrase\nself.private_key_algorithm = private_key_algorithm\nself.sftp_handler = None\nself.ssh_connection = None",
"try:\n self.ssh_connection =... | <|body_start_0|>
self.host = host
self.port = port
self.username = username
self.password = password
self.private_key = private_key
self.private_key_passphrase = private_key_passphrase
self.private_key_algorithm = private_key_algorithm
self.sftp_handler = ... | SFTP Connection object. | SftpConnection | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SftpConnection:
"""SFTP Connection object."""
def __init__(self, host: str, port: int, username: str, password: str=None, private_key: str=None, private_key_passphrase: str=None, private_key_algorithm: str=PublicKeyAlgorithms.ED25519.value):
"""Initialize the SFTP Connection object. ... | stack_v2_sparse_classes_36k_train_030442 | 5,271 | permissive | [
{
"docstring": "Initialize the SFTP Connection object. Args: host (str): The hostname of the SFTP server. port (int): The port of the SFTP server. username (str): The username to use for the SFTP connection. password (str): The password to use for the SFTP connection. private_key (str): The private key to use f... | 5 | stack_v2_sparse_classes_30k_train_014351 | Implement the Python class `SftpConnection` described below.
Class description:
SFTP Connection object.
Method signatures and docstrings:
- def __init__(self, host: str, port: int, username: str, password: str=None, private_key: str=None, private_key_passphrase: str=None, private_key_algorithm: str=PublicKeyAlgorithm... | Implement the Python class `SftpConnection` described below.
Class description:
SFTP Connection object.
Method signatures and docstrings:
- def __init__(self, host: str, port: int, username: str, password: str=None, private_key: str=None, private_key_passphrase: str=None, private_key_algorithm: str=PublicKeyAlgorithm... | af1a4458bb78c16ecca484514d4bd0d1d8c24b5d | <|skeleton|>
class SftpConnection:
"""SFTP Connection object."""
def __init__(self, host: str, port: int, username: str, password: str=None, private_key: str=None, private_key_passphrase: str=None, private_key_algorithm: str=PublicKeyAlgorithms.ED25519.value):
"""Initialize the SFTP Connection object. ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SftpConnection:
"""SFTP Connection object."""
def __init__(self, host: str, port: int, username: str, password: str=None, private_key: str=None, private_key_passphrase: str=None, private_key_algorithm: str=PublicKeyAlgorithms.ED25519.value):
"""Initialize the SFTP Connection object. Args: host (s... | the_stack_v2_python_sparse | services/document-delivery-service/src/document_delivery_service/services/sftp.py | bcgov/ppr | train | 4 |
a288b5290a984b96b89412e8793110670ada3c53 | [
"serial = []\n\ndef dfs(node):\n if not node:\n return\n serial.append(str(node.val))\n for child in node.children:\n dfs(child)\n serial.append('#')\ndfs(root)\nreturn ' '.join(serial)",
"if not data:\n return None\nnodes = data.split()\nroot = Node(int(nodes.pop(0)), [])\n\ndef reco... | <|body_start_0|>
serial = []
def dfs(node):
if not node:
return
serial.append(str(node.val))
for child in node.children:
dfs(child)
serial.append('#')
dfs(root)
return ' '.join(serial)
<|end_body_0|>
<|body... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root: 'Node') -> str:
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data: str) -> 'Node':
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|e... | stack_v2_sparse_classes_36k_train_030443 | 3,640 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: Node :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root: 'Node') -> str"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node",
"name": "deserialize",
"signature": "def des... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str
- def deserialize(self, data: str) -> 'Node': Decodes your encoded data to tre... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str
- def deserialize(self, data: str) -> 'Node': Decodes your encoded data to tre... | 815f0cbf54f9ab2ae5f957e417fcc486c4e7146a | <|skeleton|>
class Codec:
def serialize(self, root: 'Node') -> str:
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data: str) -> 'Node':
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|e... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root: 'Node') -> str:
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
serial = []
def dfs(node):
if not node:
return
serial.append(str(node.val))
for child in node.children:
... | the_stack_v2_python_sparse | Python/Serialize_and_Deserialize_N-ary_Tree.py | jadewu/Practices | train | 0 | |
02bdac4dfd818825e6568305e30102bb9ed918f6 | [
"self.sum_list = []\nfor i, num in enumerate(nums):\n if i == 0:\n self.sum_list.append(num)\n else:\n self.sum_list.append(self.sum_list[i - 1] + num)",
"if left == 0:\n return self.sum_list[right]\nreturn self.sum_list[right] - self.sum_list[left - 1]"
] | <|body_start_0|>
self.sum_list = []
for i, num in enumerate(nums):
if i == 0:
self.sum_list.append(num)
else:
self.sum_list.append(self.sum_list[i - 1] + num)
<|end_body_0|>
<|body_start_1|>
if left == 0:
return self.sum_list[r... | NumArray | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def sumRange(self, left, right):
""":type left: int :type right: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.sum_list = []
for i, num in enum... | stack_v2_sparse_classes_36k_train_030444 | 578 | no_license | [
{
"docstring": ":type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, nums)"
},
{
"docstring": ":type left: int :type right: int :rtype: int",
"name": "sumRange",
"signature": "def sumRange(self, left, right)"
}
] | 2 | null | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def sumRange(self, left, right): :type left: int :type right: int :rtype: int | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def sumRange(self, left, right): :type left: int :type right: int :rtype: int
<|skeleton|>
class NumArray:
def __init__(se... | d34d4b592d05e9e0e724d8834eaf9587a64c5034 | <|skeleton|>
class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def sumRange(self, left, right):
""":type left: int :type right: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
self.sum_list = []
for i, num in enumerate(nums):
if i == 0:
self.sum_list.append(num)
else:
self.sum_list.append(self.sum_list[i - 1] + num)
def sumRange(self, ... | the_stack_v2_python_sparse | LeetCode算法题/0303_区域和检索-数组不可变/0303_区域和检索_数组不可变.py | exueyuanAlgorithm/AlgorithmDemo | train | 0 | |
72986cb210f4bd98b0ccbc5360309eef8bb27b8d | [
"self._num_hard_examples = num_hard_examples\nself._iou_threshold = iou_threshold\nself._loss_type = loss_type\nself._cls_loss_weight = cls_loss_weight\nself._loc_loss_weight = loc_loss_weight\nself._max_negatives_per_positive = float(max_negatives_per_positive) if max_negatives_per_positive is not None else max_ne... | <|body_start_0|>
self._num_hard_examples = num_hard_examples
self._iou_threshold = iou_threshold
self._loss_type = loss_type
self._cls_loss_weight = cls_loss_weight
self._loc_loss_weight = loc_loss_weight
self._max_negatives_per_positive = float(max_negatives_per_positive... | Hard example mining for regions in a list of images. | HardExampleMiner | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HardExampleMiner:
"""Hard example mining for regions in a list of images."""
def __init__(self, num_hard_examples=64, iou_threshold=0.7, loss_type='both', cls_loss_weight=0.05, loc_loss_weight=0.06, max_negatives_per_positive=None, min_negatives_per_image=0):
"""Constructor. Args: nu... | stack_v2_sparse_classes_36k_train_030445 | 14,833 | no_license | [
{
"docstring": "Constructor. Args: num_hard_examples: int scalar, max num of hard examples to be selected per image used in NMS. iou_threshold: float scalar, min IOU for a box to be considered as being overlapped with a previously selected box during NMS. loss_type: string scalar 'cls', 'loc', 'both', hard-mini... | 3 | stack_v2_sparse_classes_30k_train_002780 | Implement the Python class `HardExampleMiner` described below.
Class description:
Hard example mining for regions in a list of images.
Method signatures and docstrings:
- def __init__(self, num_hard_examples=64, iou_threshold=0.7, loss_type='both', cls_loss_weight=0.05, loc_loss_weight=0.06, max_negatives_per_positiv... | Implement the Python class `HardExampleMiner` described below.
Class description:
Hard example mining for regions in a list of images.
Method signatures and docstrings:
- def __init__(self, num_hard_examples=64, iou_threshold=0.7, loss_type='both', cls_loss_weight=0.05, loc_loss_weight=0.06, max_negatives_per_positiv... | 5a53e02c690632bcf140d1b17327959609aab395 | <|skeleton|>
class HardExampleMiner:
"""Hard example mining for regions in a list of images."""
def __init__(self, num_hard_examples=64, iou_threshold=0.7, loss_type='both', cls_loss_weight=0.05, loc_loss_weight=0.06, max_negatives_per_positive=None, min_negatives_per_image=0):
"""Constructor. Args: nu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HardExampleMiner:
"""Hard example mining for regions in a list of images."""
def __init__(self, num_hard_examples=64, iou_threshold=0.7, loss_type='both', cls_loss_weight=0.05, loc_loss_weight=0.06, max_negatives_per_positive=None, min_negatives_per_image=0):
"""Constructor. Args: num_hard_exampl... | the_stack_v2_python_sparse | core/losses.py | chao-ji/tf-detection | train | 2 |
7fd83ee6c3e489d73a224e09e00cd92c0be79640 | [
"article = get_object_or_404(Articles, slug=article_slug)\ncomments = get_object_or_404(Comments, id=id, article=article)\ncomment = Comments.objects.get(id=id)\nif comment.user != request.user:\n data = {'error': 'You are not allowed to edit this comment'}\n return Response(data, status=status.HTTP_403_FORB... | <|body_start_0|>
article = get_object_or_404(Articles, slug=article_slug)
comments = get_object_or_404(Comments, id=id, article=article)
comment = Comments.objects.get(id=id)
if comment.user != request.user:
data = {'error': 'You are not allowed to edit this comment'}
... | Handles all requests for updating and deleting requests | UpdateDeleteCommentView | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpdateDeleteCommentView:
"""Handles all requests for updating and deleting requests"""
def put(self, request, article_slug, id):
"""Handles all requests by user to update their comments"""
<|body_0|>
def delete(self, request, article_slug, id):
"""handles all req... | stack_v2_sparse_classes_36k_train_030446 | 8,741 | permissive | [
{
"docstring": "Handles all requests by user to update their comments",
"name": "put",
"signature": "def put(self, request, article_slug, id)"
},
{
"docstring": "handles all requests for uses to delete their comments",
"name": "delete",
"signature": "def delete(self, request, article_slu... | 2 | stack_v2_sparse_classes_30k_train_015941 | Implement the Python class `UpdateDeleteCommentView` described below.
Class description:
Handles all requests for updating and deleting requests
Method signatures and docstrings:
- def put(self, request, article_slug, id): Handles all requests by user to update their comments
- def delete(self, request, article_slug,... | Implement the Python class `UpdateDeleteCommentView` described below.
Class description:
Handles all requests for updating and deleting requests
Method signatures and docstrings:
- def put(self, request, article_slug, id): Handles all requests by user to update their comments
- def delete(self, request, article_slug,... | ff4f1ba34d074e68e49f7896848f81b729542e1f | <|skeleton|>
class UpdateDeleteCommentView:
"""Handles all requests for updating and deleting requests"""
def put(self, request, article_slug, id):
"""Handles all requests by user to update their comments"""
<|body_0|>
def delete(self, request, article_slug, id):
"""handles all req... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UpdateDeleteCommentView:
"""Handles all requests for updating and deleting requests"""
def put(self, request, article_slug, id):
"""Handles all requests by user to update their comments"""
article = get_object_or_404(Articles, slug=article_slug)
comments = get_object_or_404(Commen... | the_stack_v2_python_sparse | authors/apps/comments/views.py | rfpremier/ah-django | train | 0 |
56e3c4ebd40551c2f4eefa687e6f2c651d81bf38 | [
"if not points:\n return 0\nmax_cnt = 0\nfor idx, p1 in enumerate(points[:-1]):\n slopes_cnt = defaultdict(int)\n cnt_overlap = 0\n for p2 in points[idx + 1:]:\n delta_x = p2.x - p1.x\n delta_y = p2.y - p1.y\n if delta_x == 0 and delta_y == 0:\n cnt_overlap += 1\n ... | <|body_start_0|>
if not points:
return 0
max_cnt = 0
for idx, p1 in enumerate(points[:-1]):
slopes_cnt = defaultdict(int)
cnt_overlap = 0
for p2 in points[idx + 1:]:
delta_x = p2.x - p1.x
delta_y = p2.y - p1.y
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxPoints(self, points):
""":type points: List[Point] :rtype: int"""
<|body_0|>
def maxPoints2(self, points):
""":type points: List[Point] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not points:
return 0
... | stack_v2_sparse_classes_36k_train_030447 | 1,931 | no_license | [
{
"docstring": ":type points: List[Point] :rtype: int",
"name": "maxPoints",
"signature": "def maxPoints(self, points)"
},
{
"docstring": ":type points: List[Point] :rtype: int",
"name": "maxPoints2",
"signature": "def maxPoints2(self, points)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxPoints(self, points): :type points: List[Point] :rtype: int
- def maxPoints2(self, points): :type points: List[Point] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxPoints(self, points): :type points: List[Point] :rtype: int
- def maxPoints2(self, points): :type points: List[Point] :rtype: int
<|skeleton|>
class Solution:
def ma... | 11d6bf2ba7b50c07e048df37c4e05c8f46b92241 | <|skeleton|>
class Solution:
def maxPoints(self, points):
""":type points: List[Point] :rtype: int"""
<|body_0|>
def maxPoints2(self, points):
""":type points: List[Point] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxPoints(self, points):
""":type points: List[Point] :rtype: int"""
if not points:
return 0
max_cnt = 0
for idx, p1 in enumerate(points[:-1]):
slopes_cnt = defaultdict(int)
cnt_overlap = 0
for p2 in points[idx + 1:]... | the_stack_v2_python_sparse | LeetCodes/Linkedin/Max Points on a Line.py | chutianwen/LeetCodes | train | 0 | |
457a7ad01e7521d08f8acf40eca8bf7249f926f2 | [
"self.title = 'Dynamic Labels'\nself.root = Builder.load_file('dynamic_labels.kv')\nself.create_widgets()\nreturn self.root",
"for name in NAMES:\n temp_label = Label(text=name)\n self.root.ids.entries_label.add_widget(temp_label)"
] | <|body_start_0|>
self.title = 'Dynamic Labels'
self.root = Builder.load_file('dynamic_labels.kv')
self.create_widgets()
return self.root
<|end_body_0|>
<|body_start_1|>
for name in NAMES:
temp_label = Label(text=name)
self.root.ids.entries_label.add_widge... | Dynamic creation of widget layout. | DynamicLabelsApp | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DynamicLabelsApp:
"""Dynamic creation of widget layout."""
def build(self):
"""Build the Kivy app from the kv file."""
<|body_0|>
def create_widgets(self):
"""Create labels from the names list and add them to the GUI."""
<|body_1|>
<|end_skeleton|>
<|bo... | stack_v2_sparse_classes_36k_train_030448 | 772 | no_license | [
{
"docstring": "Build the Kivy app from the kv file.",
"name": "build",
"signature": "def build(self)"
},
{
"docstring": "Create labels from the names list and add them to the GUI.",
"name": "create_widgets",
"signature": "def create_widgets(self)"
}
] | 2 | null | Implement the Python class `DynamicLabelsApp` described below.
Class description:
Dynamic creation of widget layout.
Method signatures and docstrings:
- def build(self): Build the Kivy app from the kv file.
- def create_widgets(self): Create labels from the names list and add them to the GUI. | Implement the Python class `DynamicLabelsApp` described below.
Class description:
Dynamic creation of widget layout.
Method signatures and docstrings:
- def build(self): Build the Kivy app from the kv file.
- def create_widgets(self): Create labels from the names list and add them to the GUI.
<|skeleton|>
class Dyna... | 7c9c5d11e8e6eb52d7b4b52bc547521b7133adf4 | <|skeleton|>
class DynamicLabelsApp:
"""Dynamic creation of widget layout."""
def build(self):
"""Build the Kivy app from the kv file."""
<|body_0|>
def create_widgets(self):
"""Create labels from the names list and add them to the GUI."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DynamicLabelsApp:
"""Dynamic creation of widget layout."""
def build(self):
"""Build the Kivy app from the kv file."""
self.title = 'Dynamic Labels'
self.root = Builder.load_file('dynamic_labels.kv')
self.create_widgets()
return self.root
def create_widgets(se... | the_stack_v2_python_sparse | prac_07/dynamic_labels.py | SamuelHealion/cp1404practicals | train | 0 |
cf7a4273583df3faebee4441d5f5223309f38c69 | [
"while b != 0:\n temp = a\n a ^= b\n b &= temp\n b <<= 1\nreturn a | b",
"while b != 0:\n if b > 0:\n b -= 1\n a += 1\n else:\n b += 1\n a -= 1\nreturn a"
] | <|body_start_0|>
while b != 0:
temp = a
a ^= b
b &= temp
b <<= 1
return a | b
<|end_body_0|>
<|body_start_1|>
while b != 0:
if b > 0:
b -= 1
a += 1
else:
b += 1
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def get_sum(self, a: int, b: int) -> int:
"""计算两个数的和 Args: a: 数字a b: 数字b Returns: 总和"""
<|body_0|>
def get_sum2(self, a: int, b: int) -> int:
"""计算两个数的和 Args: a: 数字a b: 数字b Returns: 总和"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
while ... | stack_v2_sparse_classes_36k_train_030449 | 1,846 | permissive | [
{
"docstring": "计算两个数的和 Args: a: 数字a b: 数字b Returns: 总和",
"name": "get_sum",
"signature": "def get_sum(self, a: int, b: int) -> int"
},
{
"docstring": "计算两个数的和 Args: a: 数字a b: 数字b Returns: 总和",
"name": "get_sum2",
"signature": "def get_sum2(self, a: int, b: int) -> int"
}
] | 2 | stack_v2_sparse_classes_30k_train_020664 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def get_sum(self, a: int, b: int) -> int: 计算两个数的和 Args: a: 数字a b: 数字b Returns: 总和
- def get_sum2(self, a: int, b: int) -> int: 计算两个数的和 Args: a: 数字a b: 数字b Returns: 总和 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def get_sum(self, a: int, b: int) -> int: 计算两个数的和 Args: a: 数字a b: 数字b Returns: 总和
- def get_sum2(self, a: int, b: int) -> int: 计算两个数的和 Args: a: 数字a b: 数字b Returns: 总和
<|skeleton... | 50f35eef6a0ad63173efed10df3c835b1dceaa3f | <|skeleton|>
class Solution:
def get_sum(self, a: int, b: int) -> int:
"""计算两个数的和 Args: a: 数字a b: 数字b Returns: 总和"""
<|body_0|>
def get_sum2(self, a: int, b: int) -> int:
"""计算两个数的和 Args: a: 数字a b: 数字b Returns: 总和"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def get_sum(self, a: int, b: int) -> int:
"""计算两个数的和 Args: a: 数字a b: 数字b Returns: 总和"""
while b != 0:
temp = a
a ^= b
b &= temp
b <<= 1
return a | b
def get_sum2(self, a: int, b: int) -> int:
"""计算两个数的和 Args: a: 数字a... | the_stack_v2_python_sparse | src/leetcodepython/math/sum_two_integers_371.py | zhangyu345293721/leetcode | train | 101 | |
76a1cfc531162321bfea2d2dcf6aa63b7dbc76fc | [
"if isinstance(stmt, _expr.Call):\n stmt = _make.Evaluate(stmt)\nassert isinstance(stmt, _stmt.Stmt) or callable(stmt)\ntik_inst._seq_stack[-1].append(stmt)",
"self.block_id = block_id\nself.block_num = block_num\nself.int32_byte_size = 4\nself.tik_instance = tik_instance\nself.gm_workspace = workspace\nself.s... | <|body_start_0|>
if isinstance(stmt, _expr.Call):
stmt = _make.Evaluate(stmt)
assert isinstance(stmt, _stmt.Stmt) or callable(stmt)
tik_inst._seq_stack[-1].append(stmt)
<|end_body_0|>
<|body_start_1|>
self.block_id = block_id
self.block_num = block_num
self.i... | this class should be part of tik. | Barrier | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Barrier:
"""this class should be part of tik."""
def emit(self, tik_inst, stmt):
"""Emit a statement to the end of current scope. Parameters ---------- stmt : Stmt or callable. The statement to be emitted or callable that build stmt given body."""
<|body_0|>
def __init__... | stack_v2_sparse_classes_36k_train_030450 | 40,896 | no_license | [
{
"docstring": "Emit a statement to the end of current scope. Parameters ---------- stmt : Stmt or callable. The statement to be emitted or callable that build stmt given body.",
"name": "emit",
"signature": "def emit(self, tik_inst, stmt)"
},
{
"docstring": "soft synchronization initialize",
... | 3 | null | Implement the Python class `Barrier` described below.
Class description:
this class should be part of tik.
Method signatures and docstrings:
- def emit(self, tik_inst, stmt): Emit a statement to the end of current scope. Parameters ---------- stmt : Stmt or callable. The statement to be emitted or callable that build... | Implement the Python class `Barrier` described below.
Class description:
this class should be part of tik.
Method signatures and docstrings:
- def emit(self, tik_inst, stmt): Emit a statement to the end of current scope. Parameters ---------- stmt : Stmt or callable. The statement to be emitted or callable that build... | 5c28a2faf9d2a117ea6f0923efe35fcd53904dd2 | <|skeleton|>
class Barrier:
"""this class should be part of tik."""
def emit(self, tik_inst, stmt):
"""Emit a statement to the end of current scope. Parameters ---------- stmt : Stmt or callable. The statement to be emitted or callable that build stmt given body."""
<|body_0|>
def __init__... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Barrier:
"""this class should be part of tik."""
def emit(self, tik_inst, stmt):
"""Emit a statement to the end of current scope. Parameters ---------- stmt : Stmt or callable. The statement to be emitted or callable that build stmt given body."""
if isinstance(stmt, _expr.Call):
... | the_stack_v2_python_sparse | op_impl/built-in/ai_core/tbe/impl/ifmr.py | gekowa/ascend-opp | train | 2 |
f5f7eacb720d20b1c48c8905d5c4f3f16125de62 | [
"def get_list_element(nlis):\n res = []\n for elem in nlis:\n if elem.isInteger():\n res.append(elem.getInteger())\n else:\n res.extend(get_list_element(elem.getList()))\n return res\nself.iterator = get_list_element(nestedList)",
"if self.hasNext:\n res = self.iter... | <|body_start_0|>
def get_list_element(nlis):
res = []
for elem in nlis:
if elem.isInteger():
res.append(elem.getInteger())
else:
res.extend(get_list_element(elem.getList()))
return res
self.iterat... | NestedIterator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NestedIterator:
def __init__(self, nestedList):
"""Initialize your data structure here. :type nestedList: List[NestedInteger]"""
<|body_0|>
def next(self):
""":rtype: int"""
<|body_1|>
def hasNext(self):
""":rtype: bool"""
<|body_2|>
<|e... | stack_v2_sparse_classes_36k_train_030451 | 2,774 | no_license | [
{
"docstring": "Initialize your data structure here. :type nestedList: List[NestedInteger]",
"name": "__init__",
"signature": "def __init__(self, nestedList)"
},
{
"docstring": ":rtype: int",
"name": "next",
"signature": "def next(self)"
},
{
"docstring": ":rtype: bool",
"nam... | 3 | null | Implement the Python class `NestedIterator` described below.
Class description:
Implement the NestedIterator class.
Method signatures and docstrings:
- def __init__(self, nestedList): Initialize your data structure here. :type nestedList: List[NestedInteger]
- def next(self): :rtype: int
- def hasNext(self): :rtype: ... | Implement the Python class `NestedIterator` described below.
Class description:
Implement the NestedIterator class.
Method signatures and docstrings:
- def __init__(self, nestedList): Initialize your data structure here. :type nestedList: List[NestedInteger]
- def next(self): :rtype: int
- def hasNext(self): :rtype: ... | ee59b82125f100970c842d5e1245287c484d6649 | <|skeleton|>
class NestedIterator:
def __init__(self, nestedList):
"""Initialize your data structure here. :type nestedList: List[NestedInteger]"""
<|body_0|>
def next(self):
""":rtype: int"""
<|body_1|>
def hasNext(self):
""":rtype: bool"""
<|body_2|>
<|e... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NestedIterator:
def __init__(self, nestedList):
"""Initialize your data structure here. :type nestedList: List[NestedInteger]"""
def get_list_element(nlis):
res = []
for elem in nlis:
if elem.isInteger():
res.append(elem.getInteger())... | the_stack_v2_python_sparse | _CodeTopics/LeetCode/201-400/000341/000341.py | BIAOXYZ/variousCodes | train | 0 | |
c1523587f90bc9a42b5173aea128d555c4bb7912 | [
"super().__init__(**kwargs)\nself.probability_transformation = probability_transformation\nself.max_angle = max_angle\nself.max_x_shift = max_x_shift\nself.max_y_shift = max_y_shift\nself.max_constrast = max_contrast\nself.min_constrast = min_constrast\nself.min_brightness = min_brightness\nself.max_brightness = ma... | <|body_start_0|>
super().__init__(**kwargs)
self.probability_transformation = probability_transformation
self.max_angle = max_angle
self.max_x_shift = max_x_shift
self.max_y_shift = max_y_shift
self.max_constrast = max_contrast
self.min_constrast = min_constrast
... | Class to apply a random set of 2D affine transformations to all slices of a 3D volume separately along the z-dimension. | RandomSliceTransformation | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomSliceTransformation:
"""Class to apply a random set of 2D affine transformations to all slices of a 3D volume separately along the z-dimension."""
def __init__(self, probability_transformation: float=0.8, max_angle: int=10, max_x_shift: float=0.05, max_y_shift: float=0.1, max_contrast:... | stack_v2_sparse_classes_36k_train_030452 | 19,979 | permissive | [
{
"docstring": ":param probability_transformation: probability of applying the transformation pipeline. :param max_angle: maximum allowed angle for rotation. For each transformation the angle is drawn uniformly between -max_angle and max_angle. :param min_constrast: Minimum contrast factor to apply. 1 means no ... | 2 | stack_v2_sparse_classes_30k_train_012782 | Implement the Python class `RandomSliceTransformation` described below.
Class description:
Class to apply a random set of 2D affine transformations to all slices of a 3D volume separately along the z-dimension.
Method signatures and docstrings:
- def __init__(self, probability_transformation: float=0.8, max_angle: in... | Implement the Python class `RandomSliceTransformation` described below.
Class description:
Class to apply a random set of 2D affine transformations to all slices of a 3D volume separately along the z-dimension.
Method signatures and docstrings:
- def __init__(self, probability_transformation: float=0.8, max_angle: in... | 12b496093097ef48d5ac8880985c04918d7f76fe | <|skeleton|>
class RandomSliceTransformation:
"""Class to apply a random set of 2D affine transformations to all slices of a 3D volume separately along the z-dimension."""
def __init__(self, probability_transformation: float=0.8, max_angle: int=10, max_x_shift: float=0.05, max_y_shift: float=0.1, max_contrast:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RandomSliceTransformation:
"""Class to apply a random set of 2D affine transformations to all slices of a 3D volume separately along the z-dimension."""
def __init__(self, probability_transformation: float=0.8, max_angle: int=10, max_x_shift: float=0.05, max_y_shift: float=0.1, max_contrast: float=2, min... | the_stack_v2_python_sparse | InnerEye/ML/utils/augmentation.py | MaxCodeXTC/InnerEye-DeepLearning | train | 1 |
3680180c2f9d28eebc97adff1839225e53860b88 | [
"self.backup_all_existing_snapshot = backup_all_existing_snapshot\nself.blacklisted_ip_addrs = blacklisted_ip_addrs\nself.continue_on_error = continue_on_error\nself.encryption_enabled = encryption_enabled\nself.filtering_policy = filtering_policy\nself.fld_config = fld_config\nself.full_backup_snapshot_label = ful... | <|body_start_0|>
self.backup_all_existing_snapshot = backup_all_existing_snapshot
self.blacklisted_ip_addrs = blacklisted_ip_addrs
self.continue_on_error = continue_on_error
self.encryption_enabled = encryption_enabled
self.filtering_policy = filtering_policy
self.fld_con... | Implementation of the 'NasBackupParams' model. Message to capture any additional backup params for a NAS environment. Attributes: backup_all_existing_snapshot (bool): This bool parameter will be set only for DP volumes when customer doesn't select the full_backup_snapshot_label and incremental_backup_snapshot_label. Wh... | NasBackupParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NasBackupParams:
"""Implementation of the 'NasBackupParams' model. Message to capture any additional backup params for a NAS environment. Attributes: backup_all_existing_snapshot (bool): This bool parameter will be set only for DP volumes when customer doesn't select the full_backup_snapshot_labe... | stack_v2_sparse_classes_36k_train_030453 | 10,003 | permissive | [
{
"docstring": "Constructor for the NasBackupParams class",
"name": "__init__",
"signature": "def __init__(self, backup_all_existing_snapshot=None, blacklisted_ip_addrs=None, continue_on_error=None, encryption_enabled=None, filtering_policy=None, fld_config=None, full_backup_snapshot_label=None, increme... | 2 | stack_v2_sparse_classes_30k_val_001113 | Implement the Python class `NasBackupParams` described below.
Class description:
Implementation of the 'NasBackupParams' model. Message to capture any additional backup params for a NAS environment. Attributes: backup_all_existing_snapshot (bool): This bool parameter will be set only for DP volumes when customer doesn... | Implement the Python class `NasBackupParams` described below.
Class description:
Implementation of the 'NasBackupParams' model. Message to capture any additional backup params for a NAS environment. Attributes: backup_all_existing_snapshot (bool): This bool parameter will be set only for DP volumes when customer doesn... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class NasBackupParams:
"""Implementation of the 'NasBackupParams' model. Message to capture any additional backup params for a NAS environment. Attributes: backup_all_existing_snapshot (bool): This bool parameter will be set only for DP volumes when customer doesn't select the full_backup_snapshot_labe... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NasBackupParams:
"""Implementation of the 'NasBackupParams' model. Message to capture any additional backup params for a NAS environment. Attributes: backup_all_existing_snapshot (bool): This bool parameter will be set only for DP volumes when customer doesn't select the full_backup_snapshot_label and increme... | the_stack_v2_python_sparse | cohesity_management_sdk/models/nas_backup_params.py | cohesity/management-sdk-python | train | 24 |
db4cc6e0b0b73a8322049990eed24a3f0439f549 | [
"usuario_actual = LoginControlador.token_requerido_grpc(token)\nif usuario_actual is None:\n error = ManejadorDeArchivos_pb2.Error.TOKEN_INVALIDO\n ValidacionServiciosGrpc.logger.info(ip + ' -- Error autenticacion: TOKEN_INVALIDO')\n return error",
"if token is None or token == '':\n error = Manejador... | <|body_start_0|>
usuario_actual = LoginControlador.token_requerido_grpc(token)
if usuario_actual is None:
error = ManejadorDeArchivos_pb2.Error.TOKEN_INVALIDO
ValidacionServiciosGrpc.logger.info(ip + ' -- Error autenticacion: TOKEN_INVALIDO')
return error
<|end_body_0... | ValidacionServiciosGrpc | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ValidacionServiciosGrpc:
def validar_token_valido(token, ip):
"""Valida que el token es un token valido :param token: El token a validar :param ip: El ip del cliente del cual se le realizara la validación de su solicitud :return: None si el token es valido o un ManejadorDeArchivos_pb2.Er... | stack_v2_sparse_classes_36k_train_030454 | 3,065 | no_license | [
{
"docstring": "Valida que el token es un token valido :param token: El token a validar :param ip: El ip del cliente del cual se le realizara la validación de su solicitud :return: None si el token es valido o un ManejadorDeArchivos_pb2.Error.TOKEN_INVALIDO",
"name": "validar_token_valido",
"signature":... | 4 | stack_v2_sparse_classes_30k_train_009793 | Implement the Python class `ValidacionServiciosGrpc` described below.
Class description:
Implement the ValidacionServiciosGrpc class.
Method signatures and docstrings:
- def validar_token_valido(token, ip): Valida que el token es un token valido :param token: El token a validar :param ip: El ip del cliente del cual s... | Implement the Python class `ValidacionServiciosGrpc` described below.
Class description:
Implement the ValidacionServiciosGrpc class.
Method signatures and docstrings:
- def validar_token_valido(token, ip): Valida que el token es un token valido :param token: El token a validar :param ip: El ip del cliente del cual s... | 49bbaaf0bd4d1bec2d81eb35882e5f073b1c149f | <|skeleton|>
class ValidacionServiciosGrpc:
def validar_token_valido(token, ip):
"""Valida que el token es un token valido :param token: El token a validar :param ip: El ip del cliente del cual se le realizara la validación de su solicitud :return: None si el token es valido o un ManejadorDeArchivos_pb2.Er... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ValidacionServiciosGrpc:
def validar_token_valido(token, ip):
"""Valida que el token es un token valido :param token: El token a validar :param ip: El ip del cliente del cual se le realizara la validación de su solicitud :return: None si el token es valido o un ManejadorDeArchivos_pb2.Error.TOKEN_INVA... | the_stack_v2_python_sparse | app/util/validaciones/servicios_grpc/ValidacionServiciosGrpc.py | codeChinoUV/EspotifeiAPI | train | 0 | |
1914a53659bf5260d1c9d60f099bf00f9bea775c | [
"result = []\nfor i in range(n):\n result.append(nums[i])\n result.append(nums[n + i])\nreturn result",
"length = 2 * n\ncount = 0\npointer = 0\nprev_index, prev_val = (1, nums[1])\nnew_index, new_val = (0, 0)\nwhile count < length - 2:\n if prev_index < n:\n new_index = prev_index * 2\n else:\... | <|body_start_0|>
result = []
for i in range(n):
result.append(nums[i])
result.append(nums[n + i])
return result
<|end_body_0|>
<|body_start_1|>
length = 2 * n
count = 0
pointer = 0
prev_index, prev_val = (1, nums[1])
new_index, new... | O(n) time, O(n) space Runtime: 48 ms, faster than 81.20% of Python online submissions for Shuffle the Array. Memory Usage: 12.8 MB, less than 100.00% of Python online submissions for Shuffle the Array. | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""O(n) time, O(n) space Runtime: 48 ms, faster than 81.20% of Python online submissions for Shuffle the Array. Memory Usage: 12.8 MB, less than 100.00% of Python online submissions for Shuffle the Array."""
def shuffle(self, nums, n):
""":type nums: List[int] :type n: int ... | stack_v2_sparse_classes_36k_train_030455 | 3,791 | no_license | [
{
"docstring": ":type nums: List[int] :type n: int :rtype: List[int]",
"name": "shuffle",
"signature": "def shuffle(self, nums, n)"
},
{
"docstring": ":type nums: List[int] :type n: int :rtype: List[int]",
"name": "shuffle",
"signature": "def shuffle(self, nums, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006258 | Implement the Python class `Solution` described below.
Class description:
O(n) time, O(n) space Runtime: 48 ms, faster than 81.20% of Python online submissions for Shuffle the Array. Memory Usage: 12.8 MB, less than 100.00% of Python online submissions for Shuffle the Array.
Method signatures and docstrings:
- def sh... | Implement the Python class `Solution` described below.
Class description:
O(n) time, O(n) space Runtime: 48 ms, faster than 81.20% of Python online submissions for Shuffle the Array. Memory Usage: 12.8 MB, less than 100.00% of Python online submissions for Shuffle the Array.
Method signatures and docstrings:
- def sh... | 844f502da4d6fb9cd69cf0a1ef71da3385a4d2b4 | <|skeleton|>
class Solution:
"""O(n) time, O(n) space Runtime: 48 ms, faster than 81.20% of Python online submissions for Shuffle the Array. Memory Usage: 12.8 MB, less than 100.00% of Python online submissions for Shuffle the Array."""
def shuffle(self, nums, n):
""":type nums: List[int] :type n: int ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
"""O(n) time, O(n) space Runtime: 48 ms, faster than 81.20% of Python online submissions for Shuffle the Array. Memory Usage: 12.8 MB, less than 100.00% of Python online submissions for Shuffle the Array."""
def shuffle(self, nums, n):
""":type nums: List[int] :type n: int :rtype: List[... | the_stack_v2_python_sparse | 1470-shuffle_the_array.py | stevestar888/leetcode-problems | train | 2 |
d135553b1196dd21eaa087ab07ce8472dba61499 | [
"value = super().__getattribute__(name)\nif name == 'uid' and value is None and self.id:\n return perfect_hash.encode(self.id)\nreturn value",
"defer_uid = False\nif not self.id:\n defer_uid = True\nsuper().save(*args, **kwargs)\nif defer_uid:\n self.uid = perfect_hash.encode(self.id)\n super().save(f... | <|body_start_0|>
value = super().__getattribute__(name)
if name == 'uid' and value is None and self.id:
return perfect_hash.encode(self.id)
return value
<|end_body_0|>
<|body_start_1|>
defer_uid = False
if not self.id:
defer_uid = True
super().sav... | Add user-friendly UID to any model. Note that database value will be NULL upon first saving. | UidMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UidMixin:
"""Add user-friendly UID to any model. Note that database value will be NULL upon first saving."""
def __getattribute__(self, name):
"""Add UID value to the model when we have ID available."""
<|body_0|>
def save(self, *args, **kwargs):
"""Add UID right... | stack_v2_sparse_classes_36k_train_030456 | 4,079 | permissive | [
{
"docstring": "Add UID value to the model when we have ID available.",
"name": "__getattribute__",
"signature": "def __getattribute__(self, name)"
},
{
"docstring": "Add UID right after we obtain ID from the database.",
"name": "save",
"signature": "def save(self, *args, **kwargs)"
}
... | 2 | stack_v2_sparse_classes_30k_train_021650 | Implement the Python class `UidMixin` described below.
Class description:
Add user-friendly UID to any model. Note that database value will be NULL upon first saving.
Method signatures and docstrings:
- def __getattribute__(self, name): Add UID value to the model when we have ID available.
- def save(self, *args, **k... | Implement the Python class `UidMixin` described below.
Class description:
Add user-friendly UID to any model. Note that database value will be NULL upon first saving.
Method signatures and docstrings:
- def __getattribute__(self, name): Add UID value to the model when we have ID available.
- def save(self, *args, **k... | 84c4fa10aefbd792a956cef3d727623ca78cb5fd | <|skeleton|>
class UidMixin:
"""Add user-friendly UID to any model. Note that database value will be NULL upon first saving."""
def __getattribute__(self, name):
"""Add UID value to the model when we have ID available."""
<|body_0|>
def save(self, *args, **kwargs):
"""Add UID right... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UidMixin:
"""Add user-friendly UID to any model. Note that database value will be NULL upon first saving."""
def __getattribute__(self, name):
"""Add UID value to the model when we have ID available."""
value = super().__getattribute__(name)
if name == 'uid' and value is None and ... | the_stack_v2_python_sparse | market/utils/models.py | katomaso/django-market | train | 0 |
09a1b6c560f856e1d686ae30b19f01eb21edce10 | [
"painter = QPainter(self.outPixmap())\npainter.drawPixmap(QPoint(0, 0), self.startPixmap())\nreturn (-1.0, 1.0)",
"out = self.outPixmap()\npainter = QPainter(out)\npainter.eraseRect(0, 0, out.width(), out.height())\nif alpha < 0.0:\n alpha = -1.0 * alpha\n source = self.startPixmap()\nelse:\n source = se... | <|body_start_0|>
painter = QPainter(self.outPixmap())
painter.drawPixmap(QPoint(0, 0), self.startPixmap())
return (-1.0, 1.0)
<|end_body_0|>
<|body_start_1|>
out = self.outPixmap()
painter = QPainter(out)
painter.eraseRect(0, 0, out.width(), out.height())
if alph... | A QPixmapTransition which animates using a fade effect. | QFadeTransition | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QFadeTransition:
"""A QPixmapTransition which animates using a fade effect."""
def preparePixmap(self):
"""Prepare the pixmap(s) for the transition. This method draws the starting pixmap into the output pixmap. The transition updates then draw the relevant pixmaps into the output usi... | stack_v2_sparse_classes_36k_train_030457 | 14,565 | permissive | [
{
"docstring": "Prepare the pixmap(s) for the transition. This method draws the starting pixmap into the output pixmap. The transition updates then draw the relevant pixmaps into the output using an appropriate alpha.",
"name": "preparePixmap",
"signature": "def preparePixmap(self)"
},
{
"docstr... | 2 | stack_v2_sparse_classes_30k_train_012588 | Implement the Python class `QFadeTransition` described below.
Class description:
A QPixmapTransition which animates using a fade effect.
Method signatures and docstrings:
- def preparePixmap(self): Prepare the pixmap(s) for the transition. This method draws the starting pixmap into the output pixmap. The transition u... | Implement the Python class `QFadeTransition` described below.
Class description:
A QPixmapTransition which animates using a fade effect.
Method signatures and docstrings:
- def preparePixmap(self): Prepare the pixmap(s) for the transition. This method draws the starting pixmap into the output pixmap. The transition u... | 1544e7fb371b8f941cfa2fde682795e479380284 | <|skeleton|>
class QFadeTransition:
"""A QPixmapTransition which animates using a fade effect."""
def preparePixmap(self):
"""Prepare the pixmap(s) for the transition. This method draws the starting pixmap into the output pixmap. The transition updates then draw the relevant pixmaps into the output usi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QFadeTransition:
"""A QPixmapTransition which animates using a fade effect."""
def preparePixmap(self):
"""Prepare the pixmap(s) for the transition. This method draws the starting pixmap into the output pixmap. The transition updates then draw the relevant pixmaps into the output using an appropr... | the_stack_v2_python_sparse | enaml/qt/q_pixmap_transition.py | MatthieuDartiailh/enaml | train | 26 |
014549a9cf37f92895863d462c60f88784629401 | [
"print(f'Alpha: {self.alpha}')\nprint(f'Beta: {self.beta}')\nprint(f'Host name: {self.host_name}')\nself.next(self.end)",
"print(f'Alpha: {self.alpha}')\nprint(f'Beta: {self.beta}')\nprint(f'Host name: {self.host_name}')"
] | <|body_start_0|>
print(f'Alpha: {self.alpha}')
print(f'Beta: {self.beta}')
print(f'Host name: {self.host_name}')
self.next(self.end)
<|end_body_0|>
<|body_start_1|>
print(f'Alpha: {self.alpha}')
print(f'Beta: {self.beta}')
print(f'Host name: {self.host_name}')
<|... | A flow where Metaflow prints 'Hi'. The hello step uses @resource decorator that only works when kfp plug-in is used. | ParameterFlow | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParameterFlow:
"""A flow where Metaflow prints 'Hi'. The hello step uses @resource decorator that only works when kfp plug-in is used."""
def start(self):
"""All flows must have a step named 'start' that is the first step in the flow."""
<|body_0|>
def end(self):
... | stack_v2_sparse_classes_36k_train_030458 | 1,304 | permissive | [
{
"docstring": "All flows must have a step named 'start' that is the first step in the flow.",
"name": "start",
"signature": "def start(self)"
},
{
"docstring": "All flows must have an 'end' step, which is the last step in the flow.",
"name": "end",
"signature": "def end(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001288 | Implement the Python class `ParameterFlow` described below.
Class description:
A flow where Metaflow prints 'Hi'. The hello step uses @resource decorator that only works when kfp plug-in is used.
Method signatures and docstrings:
- def start(self): All flows must have a step named 'start' that is the first step in th... | Implement the Python class `ParameterFlow` described below.
Class description:
A flow where Metaflow prints 'Hi'. The hello step uses @resource decorator that only works when kfp plug-in is used.
Method signatures and docstrings:
- def start(self): All flows must have a step named 'start' that is the first step in th... | 37d38d0ee73ac7c1088a6feedaffaeb5561efa2f | <|skeleton|>
class ParameterFlow:
"""A flow where Metaflow prints 'Hi'. The hello step uses @resource decorator that only works when kfp plug-in is used."""
def start(self):
"""All flows must have a step named 'start' that is the first step in the flow."""
<|body_0|>
def end(self):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ParameterFlow:
"""A flow where Metaflow prints 'Hi'. The hello step uses @resource decorator that only works when kfp plug-in is used."""
def start(self):
"""All flows must have a step named 'start' that is the first step in the flow."""
print(f'Alpha: {self.alpha}')
print(f'Beta:... | the_stack_v2_python_sparse | metaflow/tutorials/09-hellokfp/parameter_flow.py | jtimberlake/metaflow | train | 0 |
8614f6c3c28f4f35ae86fd6b151814cd353ae817 | [
"def get(root, items):\n if root is None:\n items.append('null')\n return\n items.append(str(root.val))\n get(root.left, items)\n get(root.right, items)\nitems = []\nget(root, items)\nreturn ','.join(items)",
"def get_root(data):\n if not data:\n return\n curr = data.popleft... | <|body_start_0|>
def get(root, items):
if root is None:
items.append('null')
return
items.append(str(root.val))
get(root.left, items)
get(root.right, items)
items = []
get(root, items)
return ','.join(items)
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_030459 | 1,352 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_train_018169 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | 8e87b10bd77289b891591b770a6f7adc2c00fdf0 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
def get(root, items):
if root is None:
items.append('null')
return
items.append(str(root.val))
get(root.left, items)
... | the_stack_v2_python_sparse | Temp/serialize_and_deserialize_bst.py | karthik4636/practice_problems | train | 0 | |
33f01f6a41f63f4a22c9c3457d71ed2d44853e5e | [
"super(SteerVehicle, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._control = carla.VehicleControl()\nself._actor = actor\nself._steer_value = steer_value",
"self._control = self._actor.get_control()\nself._control.steer = self._steer_value\nnew_status = py_trees.common.... | <|body_start_0|>
super(SteerVehicle, self).__init__(name)
self.logger.debug('%s.__init__()' % self.__class__.__name__)
self._control = carla.VehicleControl()
self._actor = actor
self._steer_value = steer_value
<|end_body_0|>
<|body_start_1|>
self._control = self._actor.g... | This class contains an atomic steer behavior. To set the steer value of the actor. | SteerVehicle | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SteerVehicle:
"""This class contains an atomic steer behavior. To set the steer value of the actor."""
def __init__(self, actor, steer_value, name='Steering'):
"""Setup actor and maximum steer value"""
<|body_0|>
def update(self):
"""Set steer to steer_value unti... | stack_v2_sparse_classes_36k_train_030460 | 25,380 | permissive | [
{
"docstring": "Setup actor and maximum steer value",
"name": "__init__",
"signature": "def __init__(self, actor, steer_value, name='Steering')"
},
{
"docstring": "Set steer to steer_value until reaching full stop",
"name": "update",
"signature": "def update(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005787 | Implement the Python class `SteerVehicle` described below.
Class description:
This class contains an atomic steer behavior. To set the steer value of the actor.
Method signatures and docstrings:
- def __init__(self, actor, steer_value, name='Steering'): Setup actor and maximum steer value
- def update(self): Set stee... | Implement the Python class `SteerVehicle` described below.
Class description:
This class contains an atomic steer behavior. To set the steer value of the actor.
Method signatures and docstrings:
- def __init__(self, actor, steer_value, name='Steering'): Setup actor and maximum steer value
- def update(self): Set stee... | 1d3e8339f8e60f7bdcaefeff49ec238b1746b047 | <|skeleton|>
class SteerVehicle:
"""This class contains an atomic steer behavior. To set the steer value of the actor."""
def __init__(self, actor, steer_value, name='Steering'):
"""Setup actor and maximum steer value"""
<|body_0|>
def update(self):
"""Set steer to steer_value unti... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SteerVehicle:
"""This class contains an atomic steer behavior. To set the steer value of the actor."""
def __init__(self, actor, steer_value, name='Steering'):
"""Setup actor and maximum steer value"""
super(SteerVehicle, self).__init__(name)
self.logger.debug('%s.__init__()' % se... | the_stack_v2_python_sparse | srunner/scenariomanager/atomic_scenario_behavior.py | chauvinSimon/scenario_runner | train | 2 |
09f752e069ef17491d8c03316db1bc01555285f7 | [
"super().__init__()\nself.conv = nn.Conv2d(c_in, c_out, kernel_size=K, padding=K // 2, stride=1)\nself.dims = (c_out, b)\nM = np.prod(self.dims)\nself.out_layer = nn.Linear(M, n_neurons)\nif filters is not None:\n self.conv.weight = nn.Parameter(filters)\n self.conv.bias = nn.Parameter(torch.zeros((c_out,), d... | <|body_start_0|>
super().__init__()
self.conv = nn.Conv2d(c_in, c_out, kernel_size=K, padding=K // 2, stride=1)
self.dims = (c_out, b)
M = np.prod(self.dims)
self.out_layer = nn.Linear(M, n_neurons)
if filters is not None:
self.conv.weight = nn.Parameter(filte... | Deep network with one convolutional layer + one fully connected layer Attributes: conv (nn.Conv1d): convolutional layer dims (tuple): shape of convolutional layer output out_layer (nn.Linear): linear layer | ConvFC | [
"CC-BY-4.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConvFC:
"""Deep network with one convolutional layer + one fully connected layer Attributes: conv (nn.Conv1d): convolutional layer dims (tuple): shape of convolutional layer output out_layer (nn.Linear): linear layer"""
def __init__(self, n_neurons, c_in=1, c_out=6, K=7, b=12 * 16, filters=N... | stack_v2_sparse_classes_36k_train_030461 | 2,340 | permissive | [
{
"docstring": "initialize layer Args: c_in: number of input stimulus channels c_out: number of convolutional channels K: size of each convolutional filter h: number of stimulus bins, n_bins",
"name": "__init__",
"signature": "def __init__(self, n_neurons, c_in=1, c_out=6, K=7, b=12 * 16, filters=None)"... | 2 | stack_v2_sparse_classes_30k_train_006655 | Implement the Python class `ConvFC` described below.
Class description:
Deep network with one convolutional layer + one fully connected layer Attributes: conv (nn.Conv1d): convolutional layer dims (tuple): shape of convolutional layer output out_layer (nn.Linear): linear layer
Method signatures and docstrings:
- def ... | Implement the Python class `ConvFC` described below.
Class description:
Deep network with one convolutional layer + one fully connected layer Attributes: conv (nn.Conv1d): convolutional layer dims (tuple): shape of convolutional layer output out_layer (nn.Linear): linear layer
Method signatures and docstrings:
- def ... | 3d638d00f02d9fd269fa2aff7d062558afdcb126 | <|skeleton|>
class ConvFC:
"""Deep network with one convolutional layer + one fully connected layer Attributes: conv (nn.Conv1d): convolutional layer dims (tuple): shape of convolutional layer output out_layer (nn.Linear): linear layer"""
def __init__(self, n_neurons, c_in=1, c_out=6, K=7, b=12 * 16, filters=N... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConvFC:
"""Deep network with one convolutional layer + one fully connected layer Attributes: conv (nn.Conv1d): convolutional layer dims (tuple): shape of convolutional layer output out_layer (nn.Linear): linear layer"""
def __init__(self, n_neurons, c_in=1, c_out=6, K=7, b=12 * 16, filters=None):
... | the_stack_v2_python_sparse | tutorials/W1D5_DeepLearning/solutions/W1D5_Tutorial4_Solution_5dffefa9.py | NeuromatchAcademy/course-content | train | 2,678 |
aa938fa99e8b11fc478817c6c7ae6d6a70ca2182 | [
"ans, self.target = ([], target)\nfor i in range(1, len(num) + 1):\n if i == 1 or (i > 1 and num[0] != '0'):\n self.helper(num[i:], num[:i], int(num[:i]), int(num[:i]), ans)\nreturn ans",
"if not num and self.target == cur:\n res.append(tmp)\n return\nfor i in range(1, len(num) + 1):\n if i == ... | <|body_start_0|>
ans, self.target = ([], target)
for i in range(1, len(num) + 1):
if i == 1 or (i > 1 and num[0] != '0'):
self.helper(num[i:], num[:i], int(num[:i]), int(num[:i]), ans)
return ans
<|end_body_0|>
<|body_start_1|>
if not num and self.target == c... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def addOperators(self, num, target):
""":type num: str :type target: int :rtype: List[str]"""
<|body_0|>
def helper(self, num, tmp, cur, last, res):
""":type tmp: str, current string"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ans, sel... | stack_v2_sparse_classes_36k_train_030462 | 1,048 | no_license | [
{
"docstring": ":type num: str :type target: int :rtype: List[str]",
"name": "addOperators",
"signature": "def addOperators(self, num, target)"
},
{
"docstring": ":type tmp: str, current string",
"name": "helper",
"signature": "def helper(self, num, tmp, cur, last, res)"
}
] | 2 | stack_v2_sparse_classes_30k_train_021226 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def addOperators(self, num, target): :type num: str :type target: int :rtype: List[str]
- def helper(self, num, tmp, cur, last, res): :type tmp: str, current string | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def addOperators(self, num, target): :type num: str :type target: int :rtype: List[str]
- def helper(self, num, tmp, cur, last, res): :type tmp: str, current string
<|skeleton|>... | cc6245c9519d2a249aa469eefc003e340bdbfa7c | <|skeleton|>
class Solution:
def addOperators(self, num, target):
""":type num: str :type target: int :rtype: List[str]"""
<|body_0|>
def helper(self, num, tmp, cur, last, res):
""":type tmp: str, current string"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def addOperators(self, num, target):
""":type num: str :type target: int :rtype: List[str]"""
ans, self.target = ([], target)
for i in range(1, len(num) + 1):
if i == 1 or (i > 1 and num[0] != '0'):
self.helper(num[i:], num[:i], int(num[:i]), int(n... | the_stack_v2_python_sparse | search/hardOnes/add_operators.py | LQXshane/leetcode | train | 0 | |
447a2628a8fd2f102efa973d12b8218c4926567d | [
"zk_client = KazooClient(hosts=','.join(zk_locations), connection_retry=ZK_PERSISTENT_RECONNECTS)\nzk_client.start()\nself.ioloop = io_loop\nself.source = source\nself.start_time = None\nself.status = 'Not started'\nself.finish_time = None\nself.api_methods = api_methods.APIMethods(zk_client)\nself.scheduled_indexe... | <|body_start_0|>
zk_client = KazooClient(hosts=','.join(zk_locations), connection_retry=ZK_PERSISTENT_RECONNECTS)
zk_client.start()
self.ioloop = io_loop
self.source = source
self.start_time = None
self.status = 'Not started'
self.finish_time = None
self.a... | Importer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Importer:
def __init__(self, io_loop, source, zk_locations, max_concurrency):
"""Args: io_loop: an instance of tornado IOLoop. source: an instance of import Source (e.g.: S3Source). zk_locations: a list - Zookeeper locations. max_concurrency: an int - maximum number of concurrent jobs.""... | stack_v2_sparse_classes_36k_train_030463 | 6,138 | permissive | [
{
"docstring": "Args: io_loop: an instance of tornado IOLoop. source: an instance of import Source (e.g.: S3Source). zk_locations: a list - Zookeeper locations. max_concurrency: an int - maximum number of concurrent jobs.",
"name": "__init__",
"signature": "def __init__(self, io_loop, source, zk_locatio... | 4 | stack_v2_sparse_classes_30k_train_009501 | Implement the Python class `Importer` described below.
Class description:
Implement the Importer class.
Method signatures and docstrings:
- def __init__(self, io_loop, source, zk_locations, max_concurrency): Args: io_loop: an instance of tornado IOLoop. source: an instance of import Source (e.g.: S3Source). zk_locati... | Implement the Python class `Importer` described below.
Class description:
Implement the Importer class.
Method signatures and docstrings:
- def __init__(self, io_loop, source, zk_locations, max_concurrency): Args: io_loop: an instance of tornado IOLoop. source: an instance of import Source (e.g.: S3Source). zk_locati... | be17e5f658d7b42b5aa7eeb7a5ddd4962f3ea82f | <|skeleton|>
class Importer:
def __init__(self, io_loop, source, zk_locations, max_concurrency):
"""Args: io_loop: an instance of tornado IOLoop. source: an instance of import Source (e.g.: S3Source). zk_locations: a list - Zookeeper locations. max_concurrency: an int - maximum number of concurrent jobs.""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Importer:
def __init__(self, io_loop, source, zk_locations, max_concurrency):
"""Args: io_loop: an instance of tornado IOLoop. source: an instance of import Source (e.g.: S3Source). zk_locations: a list - Zookeeper locations. max_concurrency: an int - maximum number of concurrent jobs."""
zk_c... | the_stack_v2_python_sparse | SearchService2/appscale/search/backup_restore/restore_to_v2.py | obino/appscale | train | 1 | |
93785cc6ceb94f426051f3195e42dfe537a93606 | [
"def foo(num):\n if num == 0:\n return [1]\n prev = foo(num - 1)\n return [1] + [prev[i] + prev[i + 1] for i in range(num - 1)] + [1]\nres = []\nfor i in range(numRows):\n res.append(foo(i))\nreturn res",
"triangle = []\nfor row_num in range(numRows):\n row = [None for _ in range(row_num + 1... | <|body_start_0|>
def foo(num):
if num == 0:
return [1]
prev = foo(num - 1)
return [1] + [prev[i] + prev[i + 1] for i in range(num - 1)] + [1]
res = []
for i in range(numRows):
res.append(foo(i))
return res
<|end_body_0|>
<|... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def generate(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
<|body_0|>
def generate(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def foo(num):
i... | stack_v2_sparse_classes_36k_train_030464 | 1,234 | no_license | [
{
"docstring": ":type numRows: int :rtype: List[List[int]]",
"name": "generate",
"signature": "def generate(self, numRows)"
},
{
"docstring": ":type numRows: int :rtype: List[List[int]]",
"name": "generate",
"signature": "def generate(self, numRows)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def generate(self, numRows): :type numRows: int :rtype: List[List[int]]
- def generate(self, numRows): :type numRows: int :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def generate(self, numRows): :type numRows: int :rtype: List[List[int]]
- def generate(self, numRows): :type numRows: int :rtype: List[List[int]]
<|skeleton|>
class Solution:
... | a509b383a42f54313970168d9faa11f088f18708 | <|skeleton|>
class Solution:
def generate(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
<|body_0|>
def generate(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def generate(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
def foo(num):
if num == 0:
return [1]
prev = foo(num - 1)
return [1] + [prev[i] + prev[i + 1] for i in range(num - 1)] + [1]
res = []
for ... | the_stack_v2_python_sparse | 0118_Pascal's_Triangle.py | bingli8802/leetcode | train | 0 | |
9ff3a0f235974e76233aa3adf06d9b5dddac55ac | [
"if 'name' not in schema:\n raise AssertionError('Yaml must specify the name of the VTEP to acquire')\nname = None\nresponse_data = {'status_code': 404}\nret = {'response_data': response_data}\nparsed_data = cls.get_adapter_info(client_object)\npylogger.debug('Parsed vmknic data:\\n%s' % pprint.pformat(parsed_da... | <|body_start_0|>
if 'name' not in schema:
raise AssertionError('Yaml must specify the name of the VTEP to acquire')
name = None
response_data = {'status_code': 404}
ret = {'response_data': response_data}
parsed_data = cls.get_adapter_info(client_object)
pylogg... | NSX70CRUDImpl | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NSX70CRUDImpl:
def get_id_from_schema(cls, client_object, schema=None):
"""Returns the name of the vmknic after ascertaining the existence of passed in vtep name (as part of schema object) on the host. @type schema: dict @param schema: Dictionary containing the specifications of the adap... | stack_v2_sparse_classes_36k_train_030465 | 4,673 | no_license | [
{
"docstring": "Returns the name of the vmknic after ascertaining the existence of passed in vtep name (as part of schema object) on the host. @type schema: dict @param schema: Dictionary containing the specifications of the adapter.",
"name": "get_id_from_schema",
"signature": "def get_id_from_schema(c... | 4 | null | Implement the Python class `NSX70CRUDImpl` described below.
Class description:
Implement the NSX70CRUDImpl class.
Method signatures and docstrings:
- def get_id_from_schema(cls, client_object, schema=None): Returns the name of the vmknic after ascertaining the existence of passed in vtep name (as part of schema objec... | Implement the Python class `NSX70CRUDImpl` described below.
Class description:
Implement the NSX70CRUDImpl class.
Method signatures and docstrings:
- def get_id_from_schema(cls, client_object, schema=None): Returns the name of the vmknic after ascertaining the existence of passed in vtep name (as part of schema objec... | 5b55817c050b637e2747084290f6206d2e622938 | <|skeleton|>
class NSX70CRUDImpl:
def get_id_from_schema(cls, client_object, schema=None):
"""Returns the name of the vmknic after ascertaining the existence of passed in vtep name (as part of schema object) on the host. @type schema: dict @param schema: Dictionary containing the specifications of the adap... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NSX70CRUDImpl:
def get_id_from_schema(cls, client_object, schema=None):
"""Returns the name of the vmknic after ascertaining the existence of passed in vtep name (as part of schema object) on the host. @type schema: dict @param schema: Dictionary containing the specifications of the adapter."""
... | the_stack_v2_python_sparse | SystemTesting/pylib/vmware/vsphere/esx/vtep/cli/nsx70_crud_impl.py | Cloudxtreme/MyProject | train | 0 | |
8fb5a43d62a71f37897c85d06fbbac499f1cc59d | [
"yield\nif call.when == 'call':\n item.excinfo = call.excinfo",
"case_logger = CaseLoggerExecutor(env_main)\nrequest.addfinalizer(case_logger.suite_teardown)\nreturn case_logger",
"suitelogger.node = request.node\nsuitelogger.suite_name = request.node.module.__name__\nrequest.addfinalizer(suitelogger.case_te... | <|body_start_0|>
yield
if call.when == 'call':
item.excinfo = call.excinfo
<|end_body_0|>
<|body_start_1|>
case_logger = CaseLoggerExecutor(env_main)
request.addfinalizer(case_logger.suite_teardown)
return case_logger
<|end_body_1|>
<|body_start_2|>
suitelog... | Base class for caselogger plugin functionality. | CaseLoggerPlugin | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CaseLoggerPlugin:
"""Base class for caselogger plugin functionality."""
def pytest_runtest_makereport(self, item, call):
"""Add information about test case execution results."""
<|body_0|>
def suitelogger(self, request, env_main):
"""Call caselogger on test suite... | stack_v2_sparse_classes_36k_train_030466 | 6,681 | permissive | [
{
"docstring": "Add information about test case execution results.",
"name": "pytest_runtest_makereport",
"signature": "def pytest_runtest_makereport(self, item, call)"
},
{
"docstring": "Call caselogger on test suite teardown. Args: request(pytest.request): pytest request instance env_main (tes... | 3 | null | Implement the Python class `CaseLoggerPlugin` described below.
Class description:
Base class for caselogger plugin functionality.
Method signatures and docstrings:
- def pytest_runtest_makereport(self, item, call): Add information about test case execution results.
- def suitelogger(self, request, env_main): Call cas... | Implement the Python class `CaseLoggerPlugin` described below.
Class description:
Base class for caselogger plugin functionality.
Method signatures and docstrings:
- def pytest_runtest_makereport(self, item, call): Add information about test case execution results.
- def suitelogger(self, request, env_main): Call cas... | 2007bf3fe66edfe704e485141c55caed54fe13aa | <|skeleton|>
class CaseLoggerPlugin:
"""Base class for caselogger plugin functionality."""
def pytest_runtest_makereport(self, item, call):
"""Add information about test case execution results."""
<|body_0|>
def suitelogger(self, request, env_main):
"""Call caselogger on test suite... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CaseLoggerPlugin:
"""Base class for caselogger plugin functionality."""
def pytest_runtest_makereport(self, item, call):
"""Add information about test case execution results."""
yield
if call.when == 'call':
item.excinfo = call.excinfo
def suitelogger(self, reques... | the_stack_v2_python_sparse | taf/plugins/pytest_caselogger.py | AndriyZabavskyy/taf | train | 0 |
bfc230b5207d3104b266d316b8952cd9cf822e4d | [
"if not matrix:\n self.accumulate = [0]\nelse:\n self.accumulate = [[0 for _ in range(len(matrix[0]))] for _ in range(len(matrix))]\n for i in range(len(matrix)):\n for j in range(len(matrix[0])):\n if i == 0 and j == 0:\n self.accumulate[0][0] = matrix[0][0]\n e... | <|body_start_0|>
if not matrix:
self.accumulate = [0]
else:
self.accumulate = [[0 for _ in range(len(matrix[0]))] for _ in range(len(matrix))]
for i in range(len(matrix)):
for j in range(len(matrix[0])):
if i == 0 and j == 0:
... | NumMatrix | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
<|body_0|>
def sumRegion(self, row1, col1, row2, col2):
""":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_36k_train_030467 | 1,603 | no_license | [
{
"docstring": ":type matrix: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, matrix)"
},
{
"docstring": ":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int",
"name": "sumRegion",
"signature": "def sumRegion(self, row1, col1, row2, col2)"
... | 2 | null | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): :type matrix: List[List[int]]
- def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:... | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): :type matrix: List[List[int]]
- def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:... | fc5f0d70ca35789600a7e1d7ec356f648d09a7bf | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
<|body_0|>
def sumRegion(self, row1, col1, row2, col2):
""":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
if not matrix:
self.accumulate = [0]
else:
self.accumulate = [[0 for _ in range(len(matrix[0]))] for _ in range(len(matrix))]
for i in range(len(matrix)):
for ... | the_stack_v2_python_sparse | Range Sum Query 2D- Immutable.py | zpyao1996/leetcode | train | 0 | |
718e26f8efb5f9662813653aeed4d0824ec32f3b | [
"for item in list_target:\n if func_condition(item):\n yield item",
"count = 0\nfor item in list_target:\n if func_condition(item):\n count += 1\nreturn count"
] | <|body_start_0|>
for item in list_target:
if func_condition(item):
yield item
<|end_body_0|>
<|body_start_1|>
count = 0
for item in list_target:
if func_condition(item):
count += 1
return count
<|end_body_1|>
| list helper | List_helper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class List_helper:
"""list helper"""
def find_number(list_target, func_condition):
""":param list_target: :param func_condition: :return:"""
<|body_0|>
def count_number(list_target, func_condition):
""":param list_target: :param func_condition: :return:"""
<|bo... | stack_v2_sparse_classes_36k_train_030468 | 632 | no_license | [
{
"docstring": ":param list_target: :param func_condition: :return:",
"name": "find_number",
"signature": "def find_number(list_target, func_condition)"
},
{
"docstring": ":param list_target: :param func_condition: :return:",
"name": "count_number",
"signature": "def count_number(list_ta... | 2 | null | Implement the Python class `List_helper` described below.
Class description:
list helper
Method signatures and docstrings:
- def find_number(list_target, func_condition): :param list_target: :param func_condition: :return:
- def count_number(list_target, func_condition): :param list_target: :param func_condition: :re... | Implement the Python class `List_helper` described below.
Class description:
list helper
Method signatures and docstrings:
- def find_number(list_target, func_condition): :param list_target: :param func_condition: :return:
- def count_number(list_target, func_condition): :param list_target: :param func_condition: :re... | ac197a70f4744505e392bd1fda342d680c6aa6fe | <|skeleton|>
class List_helper:
"""list helper"""
def find_number(list_target, func_condition):
""":param list_target: :param func_condition: :return:"""
<|body_0|>
def count_number(list_target, func_condition):
""":param list_target: :param func_condition: :return:"""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class List_helper:
"""list helper"""
def find_number(list_target, func_condition):
""":param list_target: :param func_condition: :return:"""
for item in list_target:
if func_condition(item):
yield item
def count_number(list_target, func_condition):
""":p... | the_stack_v2_python_sparse | moth1/day17/common/list_helper.py | BruceLHH/tedu_month2 | train | 0 |
951d03847e11ef5a80a9a7becd95a904fac31a6f | [
"try:\n self.wait(5).until(EC.presence_of_element_located(self.login_locator))\n user_is_loggedin = False\nexcept:\n user_is_loggedin = True\nreturn user_is_loggedin",
"if self.is_user_loggedin() != True:\n user_name_element = self.wait().until(EC.visibility_of_element_located(self.user_name_locator),... | <|body_start_0|>
try:
self.wait(5).until(EC.presence_of_element_located(self.login_locator))
user_is_loggedin = False
except:
user_is_loggedin = True
return user_is_loggedin
<|end_body_0|>
<|body_start_1|>
if self.is_user_loggedin() != True:
... | Contains Login UI page locators Login function | LoginPage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoginPage:
"""Contains Login UI page locators Login function"""
def is_user_loggedin(self):
"""Check if the user is already logged in or not :return: True/False"""
<|body_0|>
def perform_login(self, user_name, password):
"""Implementing Login functionality :param... | stack_v2_sparse_classes_36k_train_030469 | 1,890 | no_license | [
{
"docstring": "Check if the user is already logged in or not :return: True/False",
"name": "is_user_loggedin",
"signature": "def is_user_loggedin(self)"
},
{
"docstring": "Implementing Login functionality :param user_name: :param password: :return:",
"name": "perform_login",
"signature"... | 2 | stack_v2_sparse_classes_30k_train_011143 | Implement the Python class `LoginPage` described below.
Class description:
Contains Login UI page locators Login function
Method signatures and docstrings:
- def is_user_loggedin(self): Check if the user is already logged in or not :return: True/False
- def perform_login(self, user_name, password): Implementing Login... | Implement the Python class `LoginPage` described below.
Class description:
Contains Login UI page locators Login function
Method signatures and docstrings:
- def is_user_loggedin(self): Check if the user is already logged in or not :return: True/False
- def perform_login(self, user_name, password): Implementing Login... | 6b8830b702e41b73d3b55b9db957635890453414 | <|skeleton|>
class LoginPage:
"""Contains Login UI page locators Login function"""
def is_user_loggedin(self):
"""Check if the user is already logged in or not :return: True/False"""
<|body_0|>
def perform_login(self, user_name, password):
"""Implementing Login functionality :param... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LoginPage:
"""Contains Login UI page locators Login function"""
def is_user_loggedin(self):
"""Check if the user is already logged in or not :return: True/False"""
try:
self.wait(5).until(EC.presence_of_element_located(self.login_locator))
user_is_loggedin = False
... | the_stack_v2_python_sparse | Test_Automation/TestFramework/Libraries/Pages/login_page.py | praveenreddynarala/RobotFramework | train | 0 |
ed1cc6ed08c71c3e53a2f4db02af8879453cf4d1 | [
"self.driver.find_element_by_id('kw').send_keys('python')\nself.driver.find_element_by_id('su').click()\ntime.sleep(3)\nself.assertIn('python', self.driver.title)",
"self.driver.find_element_by_id('kw').send_keys('python??')\nself.driver.find_element_by_id('su').click()\ntime.sleep(3)\nself.assertIn('python', sel... | <|body_start_0|>
self.driver.find_element_by_id('kw').send_keys('python')
self.driver.find_element_by_id('su').click()
time.sleep(3)
self.assertIn('python', self.driver.title)
<|end_body_0|>
<|body_start_1|>
self.driver.find_element_by_id('kw').send_keys('python??')
self... | 百度搜索测试用例 | TestBaidu | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestBaidu:
"""百度搜索测试用例"""
def test_serch1(self):
"""测试正常关键字的用例"""
<|body_0|>
def test_serch2(self):
"""测试包含特殊符号的用例"""
<|body_1|>
def test_serch3(self):
"""测试不输入关键字的测试例"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
self.dri... | stack_v2_sparse_classes_36k_train_030470 | 4,122 | no_license | [
{
"docstring": "测试正常关键字的用例",
"name": "test_serch1",
"signature": "def test_serch1(self)"
},
{
"docstring": "测试包含特殊符号的用例",
"name": "test_serch2",
"signature": "def test_serch2(self)"
},
{
"docstring": "测试不输入关键字的测试例",
"name": "test_serch3",
"signature": "def test_serch3(sel... | 3 | null | Implement the Python class `TestBaidu` described below.
Class description:
百度搜索测试用例
Method signatures and docstrings:
- def test_serch1(self): 测试正常关键字的用例
- def test_serch2(self): 测试包含特殊符号的用例
- def test_serch3(self): 测试不输入关键字的测试例 | Implement the Python class `TestBaidu` described below.
Class description:
百度搜索测试用例
Method signatures and docstrings:
- def test_serch1(self): 测试正常关键字的用例
- def test_serch2(self): 测试包含特殊符号的用例
- def test_serch3(self): 测试不输入关键字的测试例
<|skeleton|>
class TestBaidu:
"""百度搜索测试用例"""
def test_serch1(self):
"""... | 7b790f675419224bfdbe1542eddc5a638982e68a | <|skeleton|>
class TestBaidu:
"""百度搜索测试用例"""
def test_serch1(self):
"""测试正常关键字的用例"""
<|body_0|>
def test_serch2(self):
"""测试包含特殊符号的用例"""
<|body_1|>
def test_serch3(self):
"""测试不输入关键字的测试例"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestBaidu:
"""百度搜索测试用例"""
def test_serch1(self):
"""测试正常关键字的用例"""
self.driver.find_element_by_id('kw').send_keys('python')
self.driver.find_element_by_id('su').click()
time.sleep(3)
self.assertIn('python', self.driver.title)
def test_serch2(self):
"""测... | the_stack_v2_python_sparse | 老师の课堂代码/day12/testcase/day12_selenium8.py | liousAlready/NewDream_learning | train | 0 |
b345a1dcc97a3f503fb4caee618f96f2578beac1 | [
"sigma = 1.0\nsize = 5\nreal_values = 0.3678 * np.array([0.1357, 0.565, 1.266, 0.565, 0.1357])\nfor real, computed in zip(real_values, utils.discrete_gaussian(size, sigma)):\n self.assertAlmostEqual(real, computed, 3)",
"sigma = 1.0\nsize = 6\nwith self.assertRaisesRegex(ValueError, '`size` must be odd.'):\n ... | <|body_start_0|>
sigma = 1.0
size = 5
real_values = 0.3678 * np.array([0.1357, 0.565, 1.266, 0.565, 0.1357])
for real, computed in zip(real_values, utils.discrete_gaussian(size, sigma)):
self.assertAlmostEqual(real, computed, 3)
<|end_body_0|>
<|body_start_1|>
sigma ... | utilsTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class utilsTest:
def testDiscreteGaussian(self):
"""Tests versus values computed using `https://keisan.casio.com/exec/system/1180573473`"""
<|body_0|>
def testDiscreteGaussianBadSize(self):
"""Tests versus values computed using `https://keisan.casio.com/exec/system/1180573... | stack_v2_sparse_classes_36k_train_030471 | 833 | no_license | [
{
"docstring": "Tests versus values computed using `https://keisan.casio.com/exec/system/1180573473`",
"name": "testDiscreteGaussian",
"signature": "def testDiscreteGaussian(self)"
},
{
"docstring": "Tests versus values computed using `https://keisan.casio.com/exec/system/1180573473`",
"name... | 2 | stack_v2_sparse_classes_30k_train_017518 | Implement the Python class `utilsTest` described below.
Class description:
Implement the utilsTest class.
Method signatures and docstrings:
- def testDiscreteGaussian(self): Tests versus values computed using `https://keisan.casio.com/exec/system/1180573473`
- def testDiscreteGaussianBadSize(self): Tests versus value... | Implement the Python class `utilsTest` described below.
Class description:
Implement the utilsTest class.
Method signatures and docstrings:
- def testDiscreteGaussian(self): Tests versus values computed using `https://keisan.casio.com/exec/system/1180573473`
- def testDiscreteGaussianBadSize(self): Tests versus value... | 39598b528fec061e828f64a3ded35aebeacb442e | <|skeleton|>
class utilsTest:
def testDiscreteGaussian(self):
"""Tests versus values computed using `https://keisan.casio.com/exec/system/1180573473`"""
<|body_0|>
def testDiscreteGaussianBadSize(self):
"""Tests versus values computed using `https://keisan.casio.com/exec/system/1180573... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class utilsTest:
def testDiscreteGaussian(self):
"""Tests versus values computed using `https://keisan.casio.com/exec/system/1180573473`"""
sigma = 1.0
size = 5
real_values = 0.3678 * np.array([0.1357, 0.565, 1.266, 0.565, 0.1357])
for real, computed in zip(real_values, utils... | the_stack_v2_python_sparse | simulation/utils_test.py | chulab/super_resolution | train | 3 | |
aa99c930579ca7f638c89e522b860159be785208 | [
"MOD = int(1000000000.0 + 7)\n\n@lru_cache(None)\ndef rec(i):\n if i >= len(s):\n return 1\n if s[i] == '0':\n return 0\n if s[i] == '*':\n sub1 = 9 * rec(i + 1)\n else:\n sub1 = rec(i + 1)\n sub2 = 0\n if i < len(s) - 1:\n if s[i] == '1':\n sub2 = (9 ... | <|body_start_0|>
MOD = int(1000000000.0 + 7)
@lru_cache(None)
def rec(i):
if i >= len(s):
return 1
if s[i] == '0':
return 0
if s[i] == '*':
sub1 = 9 * rec(i + 1)
else:
sub1 = rec(i + ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numDecodings(self, s: str) -> int:
"""Recursion Time complexity: O(n) Space complexity: O(n)"""
<|body_0|>
def numDecodings(self, s: str) -> int:
"""Bottom up Time complexity: O(n) Space complexity: O(1)"""
<|body_1|>
<|end_skeleton|>
<|body_s... | stack_v2_sparse_classes_36k_train_030472 | 4,978 | no_license | [
{
"docstring": "Recursion Time complexity: O(n) Space complexity: O(n)",
"name": "numDecodings",
"signature": "def numDecodings(self, s: str) -> int"
},
{
"docstring": "Bottom up Time complexity: O(n) Space complexity: O(1)",
"name": "numDecodings",
"signature": "def numDecodings(self, s... | 2 | stack_v2_sparse_classes_30k_train_011971 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numDecodings(self, s: str) -> int: Recursion Time complexity: O(n) Space complexity: O(n)
- def numDecodings(self, s: str) -> int: Bottom up Time complexity: O(n) Space compl... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numDecodings(self, s: str) -> int: Recursion Time complexity: O(n) Space complexity: O(n)
- def numDecodings(self, s: str) -> int: Bottom up Time complexity: O(n) Space compl... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def numDecodings(self, s: str) -> int:
"""Recursion Time complexity: O(n) Space complexity: O(n)"""
<|body_0|>
def numDecodings(self, s: str) -> int:
"""Bottom up Time complexity: O(n) Space complexity: O(1)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def numDecodings(self, s: str) -> int:
"""Recursion Time complexity: O(n) Space complexity: O(n)"""
MOD = int(1000000000.0 + 7)
@lru_cache(None)
def rec(i):
if i >= len(s):
return 1
if s[i] == '0':
return 0
... | the_stack_v2_python_sparse | leetcode/solved/639_Decode_Ways_II/solution.py | sungminoh/algorithms | train | 0 | |
07e2da94704646ac1328a6ad17e5dded1f02556c | [
"R1 = array([[1, 4, 5], [-4, 2, 6], [-5, -6, 3]], float64)\nR2 = array([[0, 1, 0], [0, 0, 0], [0, 0, 0]], float64)\neR1 = array([[-1.242955024379687, -3.178944439554645, 6.804083368075889], [-6.545353831891249, -2.604941866769356, 1.228233941393001], [0.975355249080821, -7.711099455690256, -3.318642157729292]], flo... | <|body_start_0|>
R1 = array([[1, 4, 5], [-4, 2, 6], [-5, -6, 3]], float64)
R2 = array([[0, 1, 0], [0, 0, 0], [0, 0, 0]], float64)
eR1 = array([[-1.242955024379687, -3.178944439554645, 6.804083368075889], [-6.545353831891249, -2.604941866769356, 1.228233941393001], [0.975355249080821, -7.71109945... | Unit tests for the lib.linear_algebra.matrix_exponential relax module. | Test_matrix_exponential | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test_matrix_exponential:
"""Unit tests for the lib.linear_algebra.matrix_exponential relax module."""
def test_matrix_exponential(self):
"""Test the matrix exponential function matrix_exponential() with real matrices."""
<|body_0|>
def test_matrix_exponential2(self):
... | stack_v2_sparse_classes_36k_train_030473 | 4,601 | no_license | [
{
"docstring": "Test the matrix exponential function matrix_exponential() with real matrices.",
"name": "test_matrix_exponential",
"signature": "def test_matrix_exponential(self)"
},
{
"docstring": "Test the matrix exponential function matrix_exponential() with complex matrices.",
"name": "t... | 2 | stack_v2_sparse_classes_30k_train_002970 | Implement the Python class `Test_matrix_exponential` described below.
Class description:
Unit tests for the lib.linear_algebra.matrix_exponential relax module.
Method signatures and docstrings:
- def test_matrix_exponential(self): Test the matrix exponential function matrix_exponential() with real matrices.
- def tes... | Implement the Python class `Test_matrix_exponential` described below.
Class description:
Unit tests for the lib.linear_algebra.matrix_exponential relax module.
Method signatures and docstrings:
- def test_matrix_exponential(self): Test the matrix exponential function matrix_exponential() with real matrices.
- def tes... | c317326ddeacd1a1c608128769676899daeae531 | <|skeleton|>
class Test_matrix_exponential:
"""Unit tests for the lib.linear_algebra.matrix_exponential relax module."""
def test_matrix_exponential(self):
"""Test the matrix exponential function matrix_exponential() with real matrices."""
<|body_0|>
def test_matrix_exponential2(self):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test_matrix_exponential:
"""Unit tests for the lib.linear_algebra.matrix_exponential relax module."""
def test_matrix_exponential(self):
"""Test the matrix exponential function matrix_exponential() with real matrices."""
R1 = array([[1, 4, 5], [-4, 2, 6], [-5, -6, 3]], float64)
R2... | the_stack_v2_python_sparse | test_suite/unit_tests/_lib/_linear_algebra/test_matrix_exponential.py | jlec/relax | train | 4 |
4b81bd9f9dc2e747950e2663fade96025672eb8c | [
"send_key(KEY_MENU)\nlog_test_case(self.name, 'sometime cant find the ui,so wait for 1 s.')\nsleep(1)\nstr_menu_import_export = contact.get_value('menu_import_export')\nlog_test_case(self.name, str_menu_import_export)\nclick_in_list_by_index(2)\nstr_import_from_sdcard = contact.get_value('import_from_sdcard')\nlog_... | <|body_start_0|>
send_key(KEY_MENU)
log_test_case(self.name, 'sometime cant find the ui,so wait for 1 s.')
sleep(1)
str_menu_import_export = contact.get_value('menu_import_export')
log_test_case(self.name, str_menu_import_export)
click_in_list_by_index(2)
str_impo... | test_suit_contacts_case3 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class test_suit_contacts_case3:
def import_from_storage(self):
"""This function import from storage. @return: none"""
<|body_0|>
def import_from_simcard(self):
"""This function import from simcard. @return: none"""
<|body_1|>
def export_to_storage(self):
... | stack_v2_sparse_classes_36k_train_030474 | 5,639 | no_license | [
{
"docstring": "This function import from storage. @return: none",
"name": "import_from_storage",
"signature": "def import_from_storage(self)"
},
{
"docstring": "This function import from simcard. @return: none",
"name": "import_from_simcard",
"signature": "def import_from_simcard(self)"... | 5 | stack_v2_sparse_classes_30k_train_021203 | Implement the Python class `test_suit_contacts_case3` described below.
Class description:
Implement the test_suit_contacts_case3 class.
Method signatures and docstrings:
- def import_from_storage(self): This function import from storage. @return: none
- def import_from_simcard(self): This function import from simcard... | Implement the Python class `test_suit_contacts_case3` described below.
Class description:
Implement the test_suit_contacts_case3 class.
Method signatures and docstrings:
- def import_from_storage(self): This function import from storage. @return: none
- def import_from_simcard(self): This function import from simcard... | a04b717ae437511abae1e7e9e399373c161a7b65 | <|skeleton|>
class test_suit_contacts_case3:
def import_from_storage(self):
"""This function import from storage. @return: none"""
<|body_0|>
def import_from_simcard(self):
"""This function import from simcard. @return: none"""
<|body_1|>
def export_to_storage(self):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class test_suit_contacts_case3:
def import_from_storage(self):
"""This function import from storage. @return: none"""
send_key(KEY_MENU)
log_test_case(self.name, 'sometime cant find the ui,so wait for 1 s.')
sleep(1)
str_menu_import_export = contact.get_value('menu_import_exp... | the_stack_v2_python_sparse | test_env/test_suit_contacts/test_suit_contacts_case3.py | wwlwwlqaz/Qualcomm | train | 1 | |
60a1ad2e36a83e0f5995929704b546265c445937 | [
"note = note or ''\nnotes = _('Added Notes on RMA Line: %s : \\n') % name + note\nreturn notes\n\" \\n Over ridden create method to create a message in the history when a user enteres notes in RMA Order Line.\\n @param self: The object pointer.\\n @param cr: A database cursor\\n @par... | <|body_start_0|>
note = note or ''
notes = _('Added Notes on RMA Line: %s : \n') % name + note
return notes
" \n Over ridden create method to create a message in the history when a user enteres notes in RMA Order Line.\n @param self: The object pointer.\n @param c... | crm_rma_line | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class crm_rma_line:
def get_str(self, note, name):
"""Update the note to differentiate whether it was edited from RMA Order or RMA Line. @param self: The object pointer. @param note: Note entered by the user @return: Updated notes"""
<|body_0|>
def write(self, cr, uid, ids, vals, ... | stack_v2_sparse_classes_36k_train_030475 | 8,931 | no_license | [
{
"docstring": "Update the note to differentiate whether it was edited from RMA Order or RMA Line. @param self: The object pointer. @param note: Note entered by the user @return: Updated notes",
"name": "get_str",
"signature": "def get_str(self, note, name)"
},
{
"docstring": "Over ridden write ... | 2 | null | Implement the Python class `crm_rma_line` described below.
Class description:
Implement the crm_rma_line class.
Method signatures and docstrings:
- def get_str(self, note, name): Update the note to differentiate whether it was edited from RMA Order or RMA Line. @param self: The object pointer. @param note: Note enter... | Implement the Python class `crm_rma_line` described below.
Class description:
Implement the crm_rma_line class.
Method signatures and docstrings:
- def get_str(self, note, name): Update the note to differentiate whether it was edited from RMA Order or RMA Line. @param self: The object pointer. @param note: Note enter... | 85611a86a0e1522fd88b5e6fbb217f425c4ae12d | <|skeleton|>
class crm_rma_line:
def get_str(self, note, name):
"""Update the note to differentiate whether it was edited from RMA Order or RMA Line. @param self: The object pointer. @param note: Note entered by the user @return: Updated notes"""
<|body_0|>
def write(self, cr, uid, ids, vals, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class crm_rma_line:
def get_str(self, note, name):
"""Update the note to differentiate whether it was edited from RMA Order or RMA Line. @param self: The object pointer. @param note: Note entered by the user @return: Updated notes"""
note = note or ''
notes = _('Added Notes on RMA Line: %s :... | the_stack_v2_python_sparse | addons-extra-crm/npg_rma_additions/rma.py | slevenhagen/addons-extra7.0 | train | 0 | |
1a581b52bf62195ede40636d35f4a4ce02620d05 | [
"self.name = None\nself.family = None\nself.version = None\nself.code_value = None\nself.description = None\nself.language = None\nif key_xml is not None:\n self.parse_xml(key_xml)",
"key = None\nif self.language is not None:\n lang = {}\n lang['{http://www.w3.org/XML/1998/namespace}lang'] = self.languag... | <|body_start_0|>
self.name = None
self.family = None
self.version = None
self.code_value = None
self.description = None
self.language = None
if key_xml is not None:
self.parse_xml(key_xml)
<|end_body_0|>
<|body_start_1|>
key = None
if ... | VocabularyKey is a key to a set of vocabularies. Atrributes: name Vocabulary name. This attribute is mandatory when is used in GetVocabulary method. family Vocabulary family version Vocabulary version code_value Vocabulary coded value description Vocabulary decription language Vocabulary language | VocabularyKey | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VocabularyKey:
"""VocabularyKey is a key to a set of vocabularies. Atrributes: name Vocabulary name. This attribute is mandatory when is used in GetVocabulary method. family Vocabulary family version Vocabulary version code_value Vocabulary coded value description Vocabulary decription language V... | stack_v2_sparse_classes_36k_train_030476 | 2,598 | permissive | [
{
"docstring": ":param key_xml: lxml.etree.Element representing a single VocabularyKey",
"name": "__init__",
"signature": "def __init__(self, key_xml=None)"
},
{
"docstring": "Writes a VocabularyKey Xml as per Healthvault schema. :returns: lxml.etree.Element representing a single VocabularyKey",... | 3 | null | Implement the Python class `VocabularyKey` described below.
Class description:
VocabularyKey is a key to a set of vocabularies. Atrributes: name Vocabulary name. This attribute is mandatory when is used in GetVocabulary method. family Vocabulary family version Vocabulary version code_value Vocabulary coded value descr... | Implement the Python class `VocabularyKey` described below.
Class description:
VocabularyKey is a key to a set of vocabularies. Atrributes: name Vocabulary name. This attribute is mandatory when is used in GetVocabulary method. family Vocabulary family version Vocabulary version code_value Vocabulary coded value descr... | 2b6fa7c1687300bcc2e501368883fbb13dc80495 | <|skeleton|>
class VocabularyKey:
"""VocabularyKey is a key to a set of vocabularies. Atrributes: name Vocabulary name. This attribute is mandatory when is used in GetVocabulary method. family Vocabulary family version Vocabulary version code_value Vocabulary coded value description Vocabulary decription language V... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VocabularyKey:
"""VocabularyKey is a key to a set of vocabularies. Atrributes: name Vocabulary name. This attribute is mandatory when is used in GetVocabulary method. family Vocabulary family version Vocabulary version code_value Vocabulary coded value description Vocabulary decription language Vocabulary lan... | the_stack_v2_python_sparse | src/healthvaultlib/objects/vocabularykey.py | rajeevs1992/pyhealthvault | train | 1 |
4ec9886737d68501e3e564ab9206e1972298e234 | [
"project = kwargs.pop('project', None)\nsuper(self.__class__, self).__init__(*args, **kwargs)\nself.fields['parent'].queryset = Task.tree.root_nodes().filter(project=project)\nself.fields['type'].queryset = Type.objects.filter(is_project_type=True)\nself.fields['owner'].queryset = User.objects.filter(is_active=True... | <|body_start_0|>
project = kwargs.pop('project', None)
super(self.__class__, self).__init__(*args, **kwargs)
self.fields['parent'].queryset = Task.tree.root_nodes().filter(project=project)
self.fields['type'].queryset = Type.objects.filter(is_project_type=True)
self.fields['owner... | Form representing task model | TaskForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TaskForm:
"""Form representing task model"""
def __init__(self, *args, **kwargs):
"""Overriden init method to have add project related data to fields"""
<|body_0|>
def save(self, user, project, commit=True):
"""Overriden save method to save virtual field which ar... | stack_v2_sparse_classes_36k_train_030477 | 5,050 | no_license | [
{
"docstring": "Overriden init method to have add project related data to fields",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Overriden save method to save virtual field which are not displayed to user",
"name": "save",
"signature": "def sav... | 2 | null | Implement the Python class `TaskForm` described below.
Class description:
Form representing task model
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Overriden init method to have add project related data to fields
- def save(self, user, project, commit=True): Overriden save method to save v... | Implement the Python class `TaskForm` described below.
Class description:
Form representing task model
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Overriden init method to have add project related data to fields
- def save(self, user, project, commit=True): Overriden save method to save v... | 7a337e0e3a20180b9564de68ab22620dc9aa1a36 | <|skeleton|>
class TaskForm:
"""Form representing task model"""
def __init__(self, *args, **kwargs):
"""Overriden init method to have add project related data to fields"""
<|body_0|>
def save(self, user, project, commit=True):
"""Overriden save method to save virtual field which ar... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TaskForm:
"""Form representing task model"""
def __init__(self, *args, **kwargs):
"""Overriden init method to have add project related data to fields"""
project = kwargs.pop('project', None)
super(self.__class__, self).__init__(*args, **kwargs)
self.fields['parent'].querys... | the_stack_v2_python_sparse | project_management/tasks/.svn/text-base/forms.py.svn-base | raveena17/ILASM | train | 0 |
dcb1047b845632e2f76e67ba0c74330b6254c00b | [
"if base_driver is None:\n opt = webdriver.ChromeOptions()\n opt.debugger_address = '127.0.0.1:9222'\n self.driver = webdriver.Chrome(options=opt)\n self.driver.implicitly_wait(10)\n cookies = self.driver.get_cookies()\n with open(yamlpath, 'w', encoding='utf-8') as f:\n yaml.dump(cookies, ... | <|body_start_0|>
if base_driver is None:
opt = webdriver.ChromeOptions()
opt.debugger_address = '127.0.0.1:9222'
self.driver = webdriver.Chrome(options=opt)
self.driver.implicitly_wait(10)
cookies = self.driver.get_cookies()
with open(yamlp... | 将重复的步骤抽离出来,封装 | BasePage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasePage:
"""将重复的步骤抽离出来,封装"""
def __init__(self, base_driver=None):
"""driver 重复实列化,会导致页面多次启动 解决driver重复实列化 @param base_driver:"""
<|body_0|>
def find(self, by, ele=None):
"""@param by: 定位方式css,xpath,id @param ele: 元素定位信息 @return:"""
<|body_1|>
def f... | stack_v2_sparse_classes_36k_train_030478 | 3,361 | no_license | [
{
"docstring": "driver 重复实列化,会导致页面多次启动 解决driver重复实列化 @param base_driver:",
"name": "__init__",
"signature": "def __init__(self, base_driver=None)"
},
{
"docstring": "@param by: 定位方式css,xpath,id @param ele: 元素定位信息 @return:",
"name": "find",
"signature": "def find(self, by, ele=None)"
},... | 3 | stack_v2_sparse_classes_30k_train_009923 | Implement the Python class `BasePage` described below.
Class description:
将重复的步骤抽离出来,封装
Method signatures and docstrings:
- def __init__(self, base_driver=None): driver 重复实列化,会导致页面多次启动 解决driver重复实列化 @param base_driver:
- def find(self, by, ele=None): @param by: 定位方式css,xpath,id @param ele: 元素定位信息 @return:
- def finds... | Implement the Python class `BasePage` described below.
Class description:
将重复的步骤抽离出来,封装
Method signatures and docstrings:
- def __init__(self, base_driver=None): driver 重复实列化,会导致页面多次启动 解决driver重复实列化 @param base_driver:
- def find(self, by, ele=None): @param by: 定位方式css,xpath,id @param ele: 元素定位信息 @return:
- def finds... | dd1f21390aa491652d92cb0cb0dd4ddb898afe51 | <|skeleton|>
class BasePage:
"""将重复的步骤抽离出来,封装"""
def __init__(self, base_driver=None):
"""driver 重复实列化,会导致页面多次启动 解决driver重复实列化 @param base_driver:"""
<|body_0|>
def find(self, by, ele=None):
"""@param by: 定位方式css,xpath,id @param ele: 元素定位信息 @return:"""
<|body_1|>
def f... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BasePage:
"""将重复的步骤抽离出来,封装"""
def __init__(self, base_driver=None):
"""driver 重复实列化,会导致页面多次启动 解决driver重复实列化 @param base_driver:"""
if base_driver is None:
opt = webdriver.ChromeOptions()
opt.debugger_address = '127.0.0.1:9222'
self.driver = webdriver.Ch... | the_stack_v2_python_sparse | page/base_page.py | whqhrh/test_web_wechat | train | 0 |
3b48ea9592b0dbbec16092364032cfa22d4503c3 | [
"try:\n if type(file_name) == str and type(data) == list:\n with open(file_name, 'wb') as f:\n pickle.dump(data, f)\n print(f'The TRAIN_DATA has been pickled as file: {file_name}')\n else:\n raise ValueError('Please ensure that two arguments are string and list')\nexcept ValueE... | <|body_start_0|>
try:
if type(file_name) == str and type(data) == list:
with open(file_name, 'wb') as f:
pickle.dump(data, f)
print(f'The TRAIN_DATA has been pickled as file: {file_name}')
else:
raise ValueError('Please ... | NerStats | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NerStats:
def save_labelled_data(file_name: str, data: list):
"""Pickle or save labelled dataset ------- print the name of the file to the console. :param file_name: :param data: :return:"""
<|body_0|>
def load_labelled_data(file_name: str) -> list:
"""load labelled ... | stack_v2_sparse_classes_36k_train_030479 | 2,647 | permissive | [
{
"docstring": "Pickle or save labelled dataset ------- print the name of the file to the console. :param file_name: :param data: :return:",
"name": "save_labelled_data",
"signature": "def save_labelled_data(file_name: str, data: list)"
},
{
"docstring": "load labelled data for use Parameters: -... | 4 | stack_v2_sparse_classes_30k_val_000653 | Implement the Python class `NerStats` described below.
Class description:
Implement the NerStats class.
Method signatures and docstrings:
- def save_labelled_data(file_name: str, data: list): Pickle or save labelled dataset ------- print the name of the file to the console. :param file_name: :param data: :return:
- d... | Implement the Python class `NerStats` described below.
Class description:
Implement the NerStats class.
Method signatures and docstrings:
- def save_labelled_data(file_name: str, data: list): Pickle or save labelled dataset ------- print the name of the file to the console. :param file_name: :param data: :return:
- d... | e2c8fe5f68e92d70249d37cd6eb13a3ab046a891 | <|skeleton|>
class NerStats:
def save_labelled_data(file_name: str, data: list):
"""Pickle or save labelled dataset ------- print the name of the file to the console. :param file_name: :param data: :return:"""
<|body_0|>
def load_labelled_data(file_name: str) -> list:
"""load labelled ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NerStats:
def save_labelled_data(file_name: str, data: list):
"""Pickle or save labelled dataset ------- print the name of the file to the console. :param file_name: :param data: :return:"""
try:
if type(file_name) == str and type(data) == list:
with open(file_name,... | the_stack_v2_python_sparse | src/textlabelling/nerstats.py | aakinlalu/textlabelling | train | 2 | |
8b085fff21261152e2cd43b3d0704ed56eb23550 | [
"visitorTypeDict = self.getDictBykey(self.__getVisitorConfigList().json(), 'name', visitorType)\nself.url = '/mgr/park/parkVisitorlist/save.do'\ndata = {'specialCarTypeConfigId': visitorTypeDict['id'], 'carLicenseNumber': carNum, 'owner': 'apipytest', 'ownerPhone': '135' + SA().create_randomNum(val=8), 'visitReason... | <|body_start_0|>
visitorTypeDict = self.getDictBykey(self.__getVisitorConfigList().json(), 'name', visitorType)
self.url = '/mgr/park/parkVisitorlist/save.do'
data = {'specialCarTypeConfigId': visitorTypeDict['id'], 'carLicenseNumber': carNum, 'owner': 'apipytest', 'ownerPhone': '135' + SA().cre... | 访客车录入 | ParkVisitor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParkVisitor:
"""访客车录入"""
def addVisitor(self, visitorType, carNum):
"""新建访客车辆"""
<|body_0|>
def delVisitor(self, parkName, carNum):
"""删除访客车辆"""
<|body_1|>
def __getVisitorConfigList(self):
"""查看访客配置列表"""
<|body_2|>
def getParkVi... | stack_v2_sparse_classes_36k_train_030480 | 13,467 | no_license | [
{
"docstring": "新建访客车辆",
"name": "addVisitor",
"signature": "def addVisitor(self, visitorType, carNum)"
},
{
"docstring": "删除访客车辆",
"name": "delVisitor",
"signature": "def delVisitor(self, parkName, carNum)"
},
{
"docstring": "查看访客配置列表",
"name": "__getVisitorConfigList",
... | 4 | stack_v2_sparse_classes_30k_train_010926 | Implement the Python class `ParkVisitor` described below.
Class description:
访客车录入
Method signatures and docstrings:
- def addVisitor(self, visitorType, carNum): 新建访客车辆
- def delVisitor(self, parkName, carNum): 删除访客车辆
- def __getVisitorConfigList(self): 查看访客配置列表
- def getParkVisitorList(self, parkName): 获取访客录入车辆 | Implement the Python class `ParkVisitor` described below.
Class description:
访客车录入
Method signatures and docstrings:
- def addVisitor(self, visitorType, carNum): 新建访客车辆
- def delVisitor(self, parkName, carNum): 删除访客车辆
- def __getVisitorConfigList(self): 查看访客配置列表
- def getParkVisitorList(self, parkName): 获取访客录入车辆
<|s... | 34c368c109867da26d9256bca85f872b0fac2ea7 | <|skeleton|>
class ParkVisitor:
"""访客车录入"""
def addVisitor(self, visitorType, carNum):
"""新建访客车辆"""
<|body_0|>
def delVisitor(self, parkName, carNum):
"""删除访客车辆"""
<|body_1|>
def __getVisitorConfigList(self):
"""查看访客配置列表"""
<|body_2|>
def getParkVi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ParkVisitor:
"""访客车录入"""
def addVisitor(self, visitorType, carNum):
"""新建访客车辆"""
visitorTypeDict = self.getDictBykey(self.__getVisitorConfigList().json(), 'name', visitorType)
self.url = '/mgr/park/parkVisitorlist/save.do'
data = {'specialCarTypeConfigId': visitorTypeDict[... | the_stack_v2_python_sparse | Api/parkingManage_service/carTypeManage_service/carTypeConfig.py | oyebino/pomp_api | train | 1 |
54e71937ce218b74e17bcc84e203b6a331299a29 | [
"self.pad_indx = pad_indx\nself.device = device\nself.max_length = max_length",
"inputs: List[torch.Tensor] = [b[0] for b in batch]\ntargets: List[Label] = [b[1] for b in batch]\nlengths = torch.tensor([s.size(0) for s in inputs], device=self.device)\nif self.max_length > 0:\n lengths = torch.clamp(lengths, mi... | <|body_start_0|>
self.pad_indx = pad_indx
self.device = device
self.max_length = max_length
<|end_body_0|>
<|body_start_1|>
inputs: List[torch.Tensor] = [b[0] for b in batch]
targets: List[Label] = [b[1] for b in batch]
lengths = torch.tensor([s.size(0) for s in inputs],... | SequenceClassificationCollator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SequenceClassificationCollator:
def __init__(self, pad_indx=0, max_length=-1, device='cpu'):
"""Collate function for sequence classification tasks * Perform padding * Calculate sequence lengths Args: pad_indx (int): Pad token index. Defaults to 0. max_length (int): Pad sequences to a fix... | stack_v2_sparse_classes_36k_train_030481 | 7,167 | permissive | [
{
"docstring": "Collate function for sequence classification tasks * Perform padding * Calculate sequence lengths Args: pad_indx (int): Pad token index. Defaults to 0. max_length (int): Pad sequences to a fixed maximum length device (str): device of returned tensors. Leave this as \"cpu\". The LightningModule w... | 2 | stack_v2_sparse_classes_30k_train_011761 | Implement the Python class `SequenceClassificationCollator` described below.
Class description:
Implement the SequenceClassificationCollator class.
Method signatures and docstrings:
- def __init__(self, pad_indx=0, max_length=-1, device='cpu'): Collate function for sequence classification tasks * Perform padding * Ca... | Implement the Python class `SequenceClassificationCollator` described below.
Class description:
Implement the SequenceClassificationCollator class.
Method signatures and docstrings:
- def __init__(self, pad_indx=0, max_length=-1, device='cpu'): Collate function for sequence classification tasks * Perform padding * Ca... | e4987310ed277abdec19462bdd749e2e7a000bec | <|skeleton|>
class SequenceClassificationCollator:
def __init__(self, pad_indx=0, max_length=-1, device='cpu'):
"""Collate function for sequence classification tasks * Perform padding * Calculate sequence lengths Args: pad_indx (int): Pad token index. Defaults to 0. max_length (int): Pad sequences to a fix... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SequenceClassificationCollator:
def __init__(self, pad_indx=0, max_length=-1, device='cpu'):
"""Collate function for sequence classification tasks * Perform padding * Calculate sequence lengths Args: pad_indx (int): Pad token index. Defaults to 0. max_length (int): Pad sequences to a fixed maximum len... | the_stack_v2_python_sparse | slp/data/collators.py | georgepar/slp | train | 26 | |
cdffdb6d8daa7dfcd99d078c0525ce41aeb678ac | [
"playlist_model = Playlist.get_by_id(int(playlist_id))\njson = []\nfor key in playlist_model.followers:\n youtify_user_model = db.get(key)\n json.append(get_youtify_user_struct(youtify_user_model))\nself.response.headers['Content-Type'] = 'application/json'\nself.response.out.write(simplejson.dumps(json))",
... | <|body_start_0|>
playlist_model = Playlist.get_by_id(int(playlist_id))
json = []
for key in playlist_model.followers:
youtify_user_model = db.get(key)
json.append(get_youtify_user_struct(youtify_user_model))
self.response.headers['Content-Type'] = 'application/jso... | PlaylistFollowersHandler | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PlaylistFollowersHandler:
def get(self, playlist_id):
"""Gets the list of users that follow a playlist"""
<|body_0|>
def post(self, playlist_id):
"""Follows a playlist"""
<|body_1|>
def delete(self, playlist_id):
"""Unfollows a playlist"""
... | stack_v2_sparse_classes_36k_train_030482 | 6,976 | permissive | [
{
"docstring": "Gets the list of users that follow a playlist",
"name": "get",
"signature": "def get(self, playlist_id)"
},
{
"docstring": "Follows a playlist",
"name": "post",
"signature": "def post(self, playlist_id)"
},
{
"docstring": "Unfollows a playlist",
"name": "delet... | 3 | stack_v2_sparse_classes_30k_train_017540 | Implement the Python class `PlaylistFollowersHandler` described below.
Class description:
Implement the PlaylistFollowersHandler class.
Method signatures and docstrings:
- def get(self, playlist_id): Gets the list of users that follow a playlist
- def post(self, playlist_id): Follows a playlist
- def delete(self, pla... | Implement the Python class `PlaylistFollowersHandler` described below.
Class description:
Implement the PlaylistFollowersHandler class.
Method signatures and docstrings:
- def get(self, playlist_id): Gets the list of users that follow a playlist
- def post(self, playlist_id): Follows a playlist
- def delete(self, pla... | 1855f242f15a9a66a8868ced849ddd77385426e7 | <|skeleton|>
class PlaylistFollowersHandler:
def get(self, playlist_id):
"""Gets the list of users that follow a playlist"""
<|body_0|>
def post(self, playlist_id):
"""Follows a playlist"""
<|body_1|>
def delete(self, playlist_id):
"""Unfollows a playlist"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PlaylistFollowersHandler:
def get(self, playlist_id):
"""Gets the list of users that follow a playlist"""
playlist_model = Playlist.get_by_id(int(playlist_id))
json = []
for key in playlist_model.followers:
youtify_user_model = db.get(key)
json.append(ge... | the_stack_v2_python_sparse | playlists.py | blen2r/youtify | train | 0 | |
5e01368734d75e145c89d7234eb112a95433cc38 | [
"if type(rdata) == list:\n rdata = np.array(rdata)\nself.rdata = rdata\nself.nfeat = rdata.shape[1]\nself.rsize = rdata.shape[0]\nself.scount = 0\nself.wsize = wsize\nself.wpsize = wpsize\nself.vcount = 0\nself.cdata = list()",
"assertGreaterEqual(self.wsize, 50, 'minimum window size is 50')\nself.scount += 1\... | <|body_start_0|>
if type(rdata) == list:
rdata = np.array(rdata)
self.rdata = rdata
self.nfeat = rdata.shape[1]
self.rsize = rdata.shape[0]
self.scount = 0
self.wsize = wsize
self.wpsize = wpsize
self.vcount = 0
self.cdata = list()
<|en... | drift detection without label feedback | UnSupConceptDrift | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UnSupConceptDrift:
"""drift detection without label feedback"""
def __init__(self, rdata, wsize, wpsize):
"""initializer Parameters rdata : reference data wsize : window size wpsize : window processing step size"""
<|body_0|>
def add(self, flist):
"""detects drif... | stack_v2_sparse_classes_36k_train_030483 | 4,219 | permissive | [
{
"docstring": "initializer Parameters rdata : reference data wsize : window size wpsize : window processing step size",
"name": "__init__",
"signature": "def __init__(self, rdata, wsize, wpsize)"
},
{
"docstring": "detects drift online Parameters flist : feature value list",
"name": "add",
... | 3 | stack_v2_sparse_classes_30k_train_018587 | Implement the Python class `UnSupConceptDrift` described below.
Class description:
drift detection without label feedback
Method signatures and docstrings:
- def __init__(self, rdata, wsize, wpsize): initializer Parameters rdata : reference data wsize : window size wpsize : window processing step size
- def add(self,... | Implement the Python class `UnSupConceptDrift` described below.
Class description:
drift detection without label feedback
Method signatures and docstrings:
- def __init__(self, rdata, wsize, wpsize): initializer Parameters rdata : reference data wsize : window size wpsize : window processing step size
- def add(self,... | 861fd06b6b7abaffe5e8ca795136ab0fbb2234b5 | <|skeleton|>
class UnSupConceptDrift:
"""drift detection without label feedback"""
def __init__(self, rdata, wsize, wpsize):
"""initializer Parameters rdata : reference data wsize : window size wpsize : window processing step size"""
<|body_0|>
def add(self, flist):
"""detects drif... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UnSupConceptDrift:
"""drift detection without label feedback"""
def __init__(self, rdata, wsize, wpsize):
"""initializer Parameters rdata : reference data wsize : window size wpsize : window processing step size"""
if type(rdata) == list:
rdata = np.array(rdata)
self.r... | the_stack_v2_python_sparse | matumizi/matumizi/udrift.py | pranab/whakapai | train | 18 |
bb0e4a9572b41f66038410fbc7dfa6c7f2c1a779 | [
"super(LikelihoodWeighting, self).__init__()\nself.model = LWCopoutine(model)\nself.current_score = 0.0\nself.samples = []",
"samples = []\nfor i in range(num_samples):\n rv = self.model(*args, **kwargs)\n samples.append([i, rv, self.model.current_score])\nreturn samples"
] | <|body_start_0|>
super(LikelihoodWeighting, self).__init__()
self.model = LWCopoutine(model)
self.current_score = 0.0
self.samples = []
<|end_body_0|>
<|body_start_1|>
samples = []
for i in range(num_samples):
rv = self.model(*args, **kwargs)
samp... | LikelihoodWeighting | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LikelihoodWeighting:
def __init__(self, model, *args, **kwargs):
"""Call parent class initially, then setup the couroutines to run"""
<|body_0|>
def runner(self, num_samples, *args, **kwargs):
"""Main function of an Infer object, automatically switches context with c... | stack_v2_sparse_classes_36k_train_030484 | 2,758 | permissive | [
{
"docstring": "Call parent class initially, then setup the couroutines to run",
"name": "__init__",
"signature": "def __init__(self, model, *args, **kwargs)"
},
{
"docstring": "Main function of an Infer object, automatically switches context with copoutine",
"name": "runner",
"signature... | 2 | stack_v2_sparse_classes_30k_train_003971 | Implement the Python class `LikelihoodWeighting` described below.
Class description:
Implement the LikelihoodWeighting class.
Method signatures and docstrings:
- def __init__(self, model, *args, **kwargs): Call parent class initially, then setup the couroutines to run
- def runner(self, num_samples, *args, **kwargs):... | Implement the Python class `LikelihoodWeighting` described below.
Class description:
Implement the LikelihoodWeighting class.
Method signatures and docstrings:
- def __init__(self, model, *args, **kwargs): Call parent class initially, then setup the couroutines to run
- def runner(self, num_samples, *args, **kwargs):... | 35b26902d30cb642cf9048c6a997ed741d951879 | <|skeleton|>
class LikelihoodWeighting:
def __init__(self, model, *args, **kwargs):
"""Call parent class initially, then setup the couroutines to run"""
<|body_0|>
def runner(self, num_samples, *args, **kwargs):
"""Main function of an Infer object, automatically switches context with c... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LikelihoodWeighting:
def __init__(self, model, *args, **kwargs):
"""Call parent class initially, then setup the couroutines to run"""
super(LikelihoodWeighting, self).__init__()
self.model = LWCopoutine(model)
self.current_score = 0.0
self.samples = []
def runner(s... | the_stack_v2_python_sparse | pyro/infer/abstract_infer.py | hoangcuong2011/pyro | train | 0 | |
54c4f3520d5d633aec41806b924b17ff1faf61a8 | [
"QtWidgets.QDialog.__init__(self)\nself.df = pandaTable\nself.layout = QtWidgets.QGridLayout(self)\nself.rankSelect = QtWidgets.QComboBox()\nself.rankSelect.addItems(self.df.columns.values)\nself.programSelect = QtWidgets.QComboBox()\nself.programSelect.addItems(self.df.columns.values)\nself.layout.addWidget(self.p... | <|body_start_0|>
QtWidgets.QDialog.__init__(self)
self.df = pandaTable
self.layout = QtWidgets.QGridLayout(self)
self.rankSelect = QtWidgets.QComboBox()
self.rankSelect.addItems(self.df.columns.values)
self.programSelect = QtWidgets.QComboBox()
self.programSelect.... | A dialog box to get the information required by the ranksbyPrograms function. | RanksByProgramsDialogBox | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RanksByProgramsDialogBox:
"""A dialog box to get the information required by the ranksbyPrograms function."""
def __init__(self, pandaTable, parent):
"""Initializes the UI and sets the two dropdowns to display column names of the active Panda."""
<|body_0|>
def getResult... | stack_v2_sparse_classes_36k_train_030485 | 29,548 | no_license | [
{
"docstring": "Initializes the UI and sets the two dropdowns to display column names of the active Panda.",
"name": "__init__",
"signature": "def __init__(self, pandaTable, parent)"
},
{
"docstring": "Returns the user's input",
"name": "getResults",
"signature": "def getResults(self, pa... | 2 | stack_v2_sparse_classes_30k_train_015796 | Implement the Python class `RanksByProgramsDialogBox` described below.
Class description:
A dialog box to get the information required by the ranksbyPrograms function.
Method signatures and docstrings:
- def __init__(self, pandaTable, parent): Initializes the UI and sets the two dropdowns to display column names of t... | Implement the Python class `RanksByProgramsDialogBox` described below.
Class description:
A dialog box to get the information required by the ranksbyPrograms function.
Method signatures and docstrings:
- def __init__(self, pandaTable, parent): Initializes the UI and sets the two dropdowns to display column names of t... | 1a3c5ad967472faf66236a311cc07a5128f5f911 | <|skeleton|>
class RanksByProgramsDialogBox:
"""A dialog box to get the information required by the ranksbyPrograms function."""
def __init__(self, pandaTable, parent):
"""Initializes the UI and sets the two dropdowns to display column names of the active Panda."""
<|body_0|>
def getResult... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RanksByProgramsDialogBox:
"""A dialog box to get the information required by the ranksbyPrograms function."""
def __init__(self, pandaTable, parent):
"""Initializes the UI and sets the two dropdowns to display column names of the active Panda."""
QtWidgets.QDialog.__init__(self)
s... | the_stack_v2_python_sparse | datatool/gui/Model.py | scottawalton/datatool | train | 0 |
bd60bf203b3cd424fe9b0f7bb0357fef3d8822d1 | [
"detail = test_mapping.TestDetail(uc.TEST_MAPPING_TEST)\nself.assertEqual(uc.TEST_MAPPING_TEST['name'], detail.name)\nself.assertTrue(detail.host)\nself.assertEqual([], detail.options)",
"detail = test_mapping.TestDetail(uc.TEST_MAPPING_TEST_WITH_OPTION)\nself.assertEqual(uc.TEST_MAPPING_TEST_WITH_OPTION['name'],... | <|body_start_0|>
detail = test_mapping.TestDetail(uc.TEST_MAPPING_TEST)
self.assertEqual(uc.TEST_MAPPING_TEST['name'], detail.name)
self.assertTrue(detail.host)
self.assertEqual([], detail.options)
<|end_body_0|>
<|body_start_1|>
detail = test_mapping.TestDetail(uc.TEST_MAPPING_... | Unit tests for test_mapping.py | TestMappingUnittests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestMappingUnittests:
"""Unit tests for test_mapping.py"""
def test_parsing(self):
"""Test creating TestDetail object"""
<|body_0|>
def test_parsing_with_option(self):
"""Test creating TestDetail object with option configured"""
<|body_1|>
def test_p... | stack_v2_sparse_classes_36k_train_030486 | 3,630 | no_license | [
{
"docstring": "Test creating TestDetail object",
"name": "test_parsing",
"signature": "def test_parsing(self)"
},
{
"docstring": "Test creating TestDetail object with option configured",
"name": "test_parsing_with_option",
"signature": "def test_parsing_with_option(self)"
},
{
"... | 5 | null | Implement the Python class `TestMappingUnittests` described below.
Class description:
Unit tests for test_mapping.py
Method signatures and docstrings:
- def test_parsing(self): Test creating TestDetail object
- def test_parsing_with_option(self): Test creating TestDetail object with option configured
- def test_parsi... | Implement the Python class `TestMappingUnittests` described below.
Class description:
Unit tests for test_mapping.py
Method signatures and docstrings:
- def test_parsing(self): Test creating TestDetail object
- def test_parsing_with_option(self): Test creating TestDetail object with option configured
- def test_parsi... | 78a61ca023cbf1a0cecfef8b97df2b274ac3a988 | <|skeleton|>
class TestMappingUnittests:
"""Unit tests for test_mapping.py"""
def test_parsing(self):
"""Test creating TestDetail object"""
<|body_0|>
def test_parsing_with_option(self):
"""Test creating TestDetail object with option configured"""
<|body_1|>
def test_p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestMappingUnittests:
"""Unit tests for test_mapping.py"""
def test_parsing(self):
"""Test creating TestDetail object"""
detail = test_mapping.TestDetail(uc.TEST_MAPPING_TEST)
self.assertEqual(uc.TEST_MAPPING_TEST['name'], detail.name)
self.assertTrue(detail.host)
... | the_stack_v2_python_sparse | tools/asuite/atest-py2/test_mapping_unittest.py | ZYHGOD-1/Aosp11 | train | 0 |
95ccbca9ab4511ef0d7eb02966dfdef1d11030fb | [
"if not root:\n return 'N'\nleft = self.serialize(root.left)\nright = self.serialize(root.right)\nreturn str(root.val) + ',' + left + ',' + right",
"def build_tree(l):\n root_val = l.pop(0)\n if root_val == 'N':\n return None\n root = TreeNode(root_val)\n root.left = build_tree(l)\n root.... | <|body_start_0|>
if not root:
return 'N'
left = self.serialize(root.left)
right = self.serialize(root.right)
return str(root.val) + ',' + left + ',' + right
<|end_body_0|>
<|body_start_1|>
def build_tree(l):
root_val = l.pop(0)
if root_val == ... | dfs / preorder traversal / 选择前序遍历,是因为 根|左|右根∣左∣右 的打印顺序,在反序列化时更容易定位出根节点的值。 https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/solution/shou-hui-tu-jie-gei-chu-dfshe-bfsliang-chong-jie-f/ 复杂度:https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/solution/er-cha-shu-de-xu-lie-hua-yu-fa... | Codec2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec2:
"""dfs / preorder traversal / 选择前序遍历,是因为 根|左|右根∣左∣右 的打印顺序,在反序列化时更容易定位出根节点的值。 https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/solution/shou-hui-tu-jie-gei-chu-dfshe-bfsliang-chong-jie-f/ 复杂度:https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/solut... | stack_v2_sparse_classes_36k_train_030487 | 7,655 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | null | Implement the Python class `Codec2` described below.
Class description:
dfs / preorder traversal / 选择前序遍历,是因为 根|左|右根∣左∣右 的打印顺序,在反序列化时更容易定位出根节点的值。 https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/solution/shou-hui-tu-jie-gei-chu-dfshe-bfsliang-chong-jie-f/ 复杂度:https://leetcode-cn.com/problems/seri... | Implement the Python class `Codec2` described below.
Class description:
dfs / preorder traversal / 选择前序遍历,是因为 根|左|右根∣左∣右 的打印顺序,在反序列化时更容易定位出根节点的值。 https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/solution/shou-hui-tu-jie-gei-chu-dfshe-bfsliang-chong-jie-f/ 复杂度:https://leetcode-cn.com/problems/seri... | 3ea03cd8b1fa507553ebee4fd765c4cc4b5814b6 | <|skeleton|>
class Codec2:
"""dfs / preorder traversal / 选择前序遍历,是因为 根|左|右根∣左∣右 的打印顺序,在反序列化时更容易定位出根节点的值。 https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/solution/shou-hui-tu-jie-gei-chu-dfshe-bfsliang-chong-jie-f/ 复杂度:https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/solut... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec2:
"""dfs / preorder traversal / 选择前序遍历,是因为 根|左|右根∣左∣右 的打印顺序,在反序列化时更容易定位出根节点的值。 https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/solution/shou-hui-tu-jie-gei-chu-dfshe-bfsliang-chong-jie-f/ 复杂度:https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/solution/er-cha-sh... | the_stack_v2_python_sparse | Serialize_and_Deserialize_Binary_Tree_297.py | jay6413682/Leetcode | train | 0 |
7b2a5821931ede8e7c99cb2296d51b227e841be1 | [
"knight_graph = self.buildKnightGraph(board_size)\npath = []\nself.dfs(1, path, knight_graph.getVertex((0, 0)), board_size * board_size - 1)\npath_len = len(path)\nwhile len(path) > 0:\n vertex = path.pop()\n print(vertex.getId())\nreturn path_len",
"knight_graph = Graph()\nfor row in range(boardSize):\n ... | <|body_start_0|>
knight_graph = self.buildKnightGraph(board_size)
path = []
self.dfs(1, path, knight_graph.getVertex((0, 0)), board_size * board_size - 1)
path_len = len(path)
while len(path) > 0:
vertex = path.pop()
print(vertex.getId())
return pa... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def knightTour(self, board_size=5):
"""骑士周游问题 :return:"""
<|body_0|>
def buildKnightGraph(self, boardSize):
"""创建骑士周游图 :param boardSize: :return:"""
<|body_1|>
def dfs(self, n, path, u, limit):
"""深度优先搜索 :param n: 当前层次 :param path: 存放路径... | stack_v2_sparse_classes_36k_train_030488 | 3,594 | no_license | [
{
"docstring": "骑士周游问题 :return:",
"name": "knightTour",
"signature": "def knightTour(self, board_size=5)"
},
{
"docstring": "创建骑士周游图 :param boardSize: :return:",
"name": "buildKnightGraph",
"signature": "def buildKnightGraph(self, boardSize)"
},
{
"docstring": "深度优先搜索 :param n: 当... | 5 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def knightTour(self, board_size=5): 骑士周游问题 :return:
- def buildKnightGraph(self, boardSize): 创建骑士周游图 :param boardSize: :return:
- def dfs(self, n, path, u, limit): 深度优先搜索 :param ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def knightTour(self, board_size=5): 骑士周游问题 :return:
- def buildKnightGraph(self, boardSize): 创建骑士周游图 :param boardSize: :return:
- def dfs(self, n, path, u, limit): 深度优先搜索 :param ... | 97cc61fefe0bedf5161687aab92fb09b0df990e2 | <|skeleton|>
class Solution:
def knightTour(self, board_size=5):
"""骑士周游问题 :return:"""
<|body_0|>
def buildKnightGraph(self, boardSize):
"""创建骑士周游图 :param boardSize: :return:"""
<|body_1|>
def dfs(self, n, path, u, limit):
"""深度优先搜索 :param n: 当前层次 :param path: 存放路径... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def knightTour(self, board_size=5):
"""骑士周游问题 :return:"""
knight_graph = self.buildKnightGraph(board_size)
path = []
self.dfs(1, path, knight_graph.getVertex((0, 0)), board_size * board_size - 1)
path_len = len(path)
while len(path) > 0:
ve... | the_stack_v2_python_sparse | code/graph/knight_tour.py | JiaXingBinggan/For_work | train | 0 | |
efbd44374e86a5714d25f204b205e7efa7d013d9 | [
"problemDir = os.path.realpath(os.path.abspath(problemDir))\nif problemDir not in sys.path:\n sys.path.insert(0, problemDir)\nprint('Index: reading from {}'.format(problemDir))\nprint('Found problems:')\nself.problemDir = problemDir\nself.problems = self.read_problems(problemDir)",
"problem_list = []\nfor dirn... | <|body_start_0|>
problemDir = os.path.realpath(os.path.abspath(problemDir))
if problemDir not in sys.path:
sys.path.insert(0, problemDir)
print('Index: reading from {}'.format(problemDir))
print('Found problems:')
self.problemDir = problemDir
self.problems = s... | An index that catalogues the problems currently ready to be processed. Can write itself to a file to give the user useful information about the relative size and complexity of the problems and help them to pick the ones to test their solvers on. Attributes ---------- problems : pandas.DataFrame problemDir : string The ... | Index | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Index:
"""An index that catalogues the problems currently ready to be processed. Can write itself to a file to give the user useful information about the relative size and complexity of the problems and help them to pick the ones to test their solvers on. Attributes ---------- problems : pandas.D... | stack_v2_sparse_classes_36k_train_030489 | 4,638 | no_license | [
{
"docstring": "Initialize the index by reading in all the problems in problemDir. problemDir defaults to 'problems'",
"name": "__init__",
"signature": "def __init__(self, problemDir='problems')"
},
{
"docstring": "Reads the python files in problemDir, extracts the problems, and appends them to ... | 3 | stack_v2_sparse_classes_30k_train_012596 | Implement the Python class `Index` described below.
Class description:
An index that catalogues the problems currently ready to be processed. Can write itself to a file to give the user useful information about the relative size and complexity of the problems and help them to pick the ones to test their solvers on. At... | Implement the Python class `Index` described below.
Class description:
An index that catalogues the problems currently ready to be processed. Can write itself to a file to give the user useful information about the relative size and complexity of the problems and help them to pick the ones to test their solvers on. At... | 932141d8e4e929860011bf25c41e941e2f8fbd76 | <|skeleton|>
class Index:
"""An index that catalogues the problems currently ready to be processed. Can write itself to a file to give the user useful information about the relative size and complexity of the problems and help them to pick the ones to test their solvers on. Attributes ---------- problems : pandas.D... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Index:
"""An index that catalogues the problems currently ready to be processed. Can write itself to a file to give the user useful information about the relative size and complexity of the problems and help them to pick the ones to test their solvers on. Attributes ---------- problems : pandas.DataFrame prob... | the_stack_v2_python_sparse | cvxbenchmarks/database/index.py | nishi951/cvxbenchmarks | train | 1 |
27f86189331b160ed2b8bfb9d432829da929f026 | [
"super(SentimentClassifierMLPWithEmbeddings, self).__init__()\nif pretrained_embedding_matrix is None:\n self.embeddings = nn.Embedding(embedding_dim=embedding_size, num_embeddings=num_embeddings, padding_idx=padding_idx)\nelse:\n pretrained_embedding_matrix = torch.from_numpy(pretrained_embedding_matrix).flo... | <|body_start_0|>
super(SentimentClassifierMLPWithEmbeddings, self).__init__()
if pretrained_embedding_matrix is None:
self.embeddings = nn.Embedding(embedding_dim=embedding_size, num_embeddings=num_embeddings, padding_idx=padding_idx)
else:
pretrained_embedding_matrix = t... | A 2-layer multilayer perceptron based classifier that uses word embeddings as an input sequence representation | SentimentClassifierMLPWithEmbeddings | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SentimentClassifierMLPWithEmbeddings:
"""A 2-layer multilayer perceptron based classifier that uses word embeddings as an input sequence representation"""
def __init__(self, embedding_size, num_embeddings, hidden_dim, output_dim, pretrained_embedding_matrix=None, padding_idx=0):
"""A... | stack_v2_sparse_classes_36k_train_030490 | 4,072 | no_license | [
{
"docstring": "Args: embedding_size (int): the size of the embedding vector num_embeddings (int): the number of words to embed hidden_dim (int): the size of the hidden layer output_dim (int): the size of the prediction vector pretrained_embedding_matrix (numpy.array): previously trained word embeddings padding... | 2 | stack_v2_sparse_classes_30k_train_000108 | Implement the Python class `SentimentClassifierMLPWithEmbeddings` described below.
Class description:
A 2-layer multilayer perceptron based classifier that uses word embeddings as an input sequence representation
Method signatures and docstrings:
- def __init__(self, embedding_size, num_embeddings, hidden_dim, output... | Implement the Python class `SentimentClassifierMLPWithEmbeddings` described below.
Class description:
A 2-layer multilayer perceptron based classifier that uses word embeddings as an input sequence representation
Method signatures and docstrings:
- def __init__(self, embedding_size, num_embeddings, hidden_dim, output... | 43a453a03060c2adf6bf16302d5138cfa77a30d1 | <|skeleton|>
class SentimentClassifierMLPWithEmbeddings:
"""A 2-layer multilayer perceptron based classifier that uses word embeddings as an input sequence representation"""
def __init__(self, embedding_size, num_embeddings, hidden_dim, output_dim, pretrained_embedding_matrix=None, padding_idx=0):
"""A... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SentimentClassifierMLPWithEmbeddings:
"""A 2-layer multilayer perceptron based classifier that uses word embeddings as an input sequence representation"""
def __init__(self, embedding_size, num_embeddings, hidden_dim, output_dim, pretrained_embedding_matrix=None, padding_idx=0):
"""Args: embeddin... | the_stack_v2_python_sparse | workshops/sentiment2020/Solution/ModelMLPWithEmbeddings.py | Petlja/PSIML | train | 17 |
4f96ebe1153606b4055c1341678bfa892afd5ebd | [
"if x > 2 ** 31 - 1 or x < -2 ** 31 or x == 0:\n return 0\nsign = ''\nif x < 0:\n sign = '-'\nout = str(abs(x))[::-1]\ni = 0\nwhile i < len(out) and out[i] == '0':\n i += 1\nout = sign + out[i:]\nreturn int(out)",
"Neg = False\nif x < 0:\n Neg = True\nout = int(str(abs(x))[::-1])\nif Neg:\n out *= ... | <|body_start_0|>
if x > 2 ** 31 - 1 or x < -2 ** 31 or x == 0:
return 0
sign = ''
if x < 0:
sign = '-'
out = str(abs(x))[::-1]
i = 0
while i < len(out) and out[i] == '0':
i += 1
out = sign + out[i:]
return int(out)
<|end... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reverse1(self, x):
""":type x: int :rtype: int deappreciated."""
<|body_0|>
def reverse(self, x):
""":type x: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if x > 2 ** 31 - 1 or x < -2 ** 31 or x == 0:
ret... | stack_v2_sparse_classes_36k_train_030491 | 1,184 | no_license | [
{
"docstring": ":type x: int :rtype: int deappreciated.",
"name": "reverse1",
"signature": "def reverse1(self, x)"
},
{
"docstring": ":type x: int :rtype: int",
"name": "reverse",
"signature": "def reverse(self, x)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007400 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverse1(self, x): :type x: int :rtype: int deappreciated.
- def reverse(self, x): :type x: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverse1(self, x): :type x: int :rtype: int deappreciated.
- def reverse(self, x): :type x: int :rtype: int
<|skeleton|>
class Solution:
def reverse1(self, x):
... | ea6e8e4ffc13465539ad5388b74ad514aa535cf6 | <|skeleton|>
class Solution:
def reverse1(self, x):
""":type x: int :rtype: int deappreciated."""
<|body_0|>
def reverse(self, x):
""":type x: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def reverse1(self, x):
""":type x: int :rtype: int deappreciated."""
if x > 2 ** 31 - 1 or x < -2 ** 31 or x == 0:
return 0
sign = ''
if x < 0:
sign = '-'
out = str(abs(x))[::-1]
i = 0
while i < len(out) and out[i] == '0... | the_stack_v2_python_sparse | 7. Reverse_integer/Reverse_Integer.py | tobyatgithub/LeetCode | train | 0 | |
e6602052269bdd92f96557a43e1c99604ef6f471 | [
"self.measures = measures\nself.key = None\nself.attributes = {}\nself.rhythm_ref = None\nself.write_key()\nself.write_attributes(intensity)\nself.melody = {'rhythm': Frame(measures), 'ints': Frame(measures), 'notes': Frame(measures), 'final': Frame(measures)}\nself.bass = {'rhythm': Frame(measures), 'ints': Frame(... | <|body_start_0|>
self.measures = measures
self.key = None
self.attributes = {}
self.rhythm_ref = None
self.write_key()
self.write_attributes(intensity)
self.melody = {'rhythm': Frame(measures), 'ints': Frame(measures), 'notes': Frame(measures), 'final': Frame(meas... | Represents one loop, which is comprised of a shitload of Frame objects ~ === Attributes === @type melody: dict{str: Frame} contains keys: 'rhythm', 'ints', 'notes', 'final' @type bass: dict{str: Frame} contains keys: 'rhythm', 'ints', 'notes', 'final' @type perc: dict{str: Frame} contains keys: 'kick', 'snare', 'closed... | Loop | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Loop:
"""Represents one loop, which is comprised of a shitload of Frame objects ~ === Attributes === @type melody: dict{str: Frame} contains keys: 'rhythm', 'ints', 'notes', 'final' @type bass: dict{str: Frame} contains keys: 'rhythm', 'ints', 'notes', 'final' @type perc: dict{str: Frame} contain... | stack_v2_sparse_classes_36k_train_030492 | 5,815 | no_license | [
{
"docstring": "Constructs an empty Loop ~ @type self: Loop @type measures: int @rtype: None",
"name": "__init__",
"signature": "def __init__(self, measures, intensity)"
},
{
"docstring": "Chooses a random key for a Loop (self) ~ @type self: Loop @rtype: None",
"name": "write_key",
"sign... | 5 | stack_v2_sparse_classes_30k_train_017698 | Implement the Python class `Loop` described below.
Class description:
Represents one loop, which is comprised of a shitload of Frame objects ~ === Attributes === @type melody: dict{str: Frame} contains keys: 'rhythm', 'ints', 'notes', 'final' @type bass: dict{str: Frame} contains keys: 'rhythm', 'ints', 'notes', 'fina... | Implement the Python class `Loop` described below.
Class description:
Represents one loop, which is comprised of a shitload of Frame objects ~ === Attributes === @type melody: dict{str: Frame} contains keys: 'rhythm', 'ints', 'notes', 'final' @type bass: dict{str: Frame} contains keys: 'rhythm', 'ints', 'notes', 'fina... | 8397cbe41797ad8d0501bb6510ee1ea974a8259b | <|skeleton|>
class Loop:
"""Represents one loop, which is comprised of a shitload of Frame objects ~ === Attributes === @type melody: dict{str: Frame} contains keys: 'rhythm', 'ints', 'notes', 'final' @type bass: dict{str: Frame} contains keys: 'rhythm', 'ints', 'notes', 'final' @type perc: dict{str: Frame} contain... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Loop:
"""Represents one loop, which is comprised of a shitload of Frame objects ~ === Attributes === @type melody: dict{str: Frame} contains keys: 'rhythm', 'ints', 'notes', 'final' @type bass: dict{str: Frame} contains keys: 'rhythm', 'ints', 'notes', 'final' @type perc: dict{str: Frame} contains keys: 'kick... | the_stack_v2_python_sparse | AMG/class_loop.py | metchel/Amadeus | train | 0 |
77217af41415218715d3a4235c16182dfa11b8a1 | [
"for query in KEYWORDS:\n url = 'https://maimai.cn/search/contacts?count=20000&query=' + query + self.json_url\n yield scrapy.Request(url, cookies=self.cookies, callback=self.parse, meta={'query': query})",
"content = json.loads(response.body)\ncontacts = content['data']['contacts']\nfor contact in contacts... | <|body_start_0|>
for query in KEYWORDS:
url = 'https://maimai.cn/search/contacts?count=20000&query=' + query + self.json_url
yield scrapy.Request(url, cookies=self.cookies, callback=self.parse, meta={'query': query})
<|end_body_0|>
<|body_start_1|>
content = json.loads(response.... | GetUrlSpider | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetUrlSpider:
def start_requests(self):
"""搜索关键字"""
<|body_0|>
def parse(self, response):
"""解析个人url"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
for query in KEYWORDS:
url = 'https://maimai.cn/search/contacts?count=20000&query=' + qu... | stack_v2_sparse_classes_36k_train_030493 | 2,009 | no_license | [
{
"docstring": "搜索关键字",
"name": "start_requests",
"signature": "def start_requests(self)"
},
{
"docstring": "解析个人url",
"name": "parse",
"signature": "def parse(self, response)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002297 | Implement the Python class `GetUrlSpider` described below.
Class description:
Implement the GetUrlSpider class.
Method signatures and docstrings:
- def start_requests(self): 搜索关键字
- def parse(self, response): 解析个人url | Implement the Python class `GetUrlSpider` described below.
Class description:
Implement the GetUrlSpider class.
Method signatures and docstrings:
- def start_requests(self): 搜索关键字
- def parse(self, response): 解析个人url
<|skeleton|>
class GetUrlSpider:
def start_requests(self):
"""搜索关键字"""
<|body_0... | 4c167182a8785e41680f233f7d82eebc4429a1a4 | <|skeleton|>
class GetUrlSpider:
def start_requests(self):
"""搜索关键字"""
<|body_0|>
def parse(self, response):
"""解析个人url"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GetUrlSpider:
def start_requests(self):
"""搜索关键字"""
for query in KEYWORDS:
url = 'https://maimai.cn/search/contacts?count=20000&query=' + query + self.json_url
yield scrapy.Request(url, cookies=self.cookies, callback=self.parse, meta={'query': query})
def parse(sel... | the_stack_v2_python_sparse | Maimai/Maimai/spiders/get_url.py | Gihihi/maimaiSpider | train | 3 | |
2099630d9b204a440bf96ebe84c346f0e65c7c84 | [
"self.s1 = s1\nself.s2 = s2\nself.s3 = s3\nself.l1 = len(s1)\nself.l2 = len(s2)\nself.l3 = len(s3)\nself.dict_s3 = {}\nif self.l1 + self.l2 != self.l3:\n return False\n\ndef dfs(i, j, count):\n if (i, j) in self.dict_s3:\n return False\n print(i, j)\n if i + j >= self.l3:\n return True\n ... | <|body_start_0|>
self.s1 = s1
self.s2 = s2
self.s3 = s3
self.l1 = len(s1)
self.l2 = len(s2)
self.l3 = len(s3)
self.dict_s3 = {}
if self.l1 + self.l2 != self.l3:
return False
def dfs(i, j, count):
if (i, j) in self.dict_s3:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isInterleave(self, s1, s2, s3):
""":type s1: str :type s2: str :type s3: str :rtype: bool 32ms"""
<|body_0|>
def isInterleave_1(self, s1, s2, s3):
""":type s1: str :type s2: str :type s3: str :rtype: bool 36ms"""
<|body_1|>
<|end_skeleton|>
<|... | stack_v2_sparse_classes_36k_train_030494 | 2,848 | no_license | [
{
"docstring": ":type s1: str :type s2: str :type s3: str :rtype: bool 32ms",
"name": "isInterleave",
"signature": "def isInterleave(self, s1, s2, s3)"
},
{
"docstring": ":type s1: str :type s2: str :type s3: str :rtype: bool 36ms",
"name": "isInterleave_1",
"signature": "def isInterleav... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isInterleave(self, s1, s2, s3): :type s1: str :type s2: str :type s3: str :rtype: bool 32ms
- def isInterleave_1(self, s1, s2, s3): :type s1: str :type s2: str :type s3: str ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isInterleave(self, s1, s2, s3): :type s1: str :type s2: str :type s3: str :rtype: bool 32ms
- def isInterleave_1(self, s1, s2, s3): :type s1: str :type s2: str :type s3: str ... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def isInterleave(self, s1, s2, s3):
""":type s1: str :type s2: str :type s3: str :rtype: bool 32ms"""
<|body_0|>
def isInterleave_1(self, s1, s2, s3):
""":type s1: str :type s2: str :type s3: str :rtype: bool 36ms"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isInterleave(self, s1, s2, s3):
""":type s1: str :type s2: str :type s3: str :rtype: bool 32ms"""
self.s1 = s1
self.s2 = s2
self.s3 = s3
self.l1 = len(s1)
self.l2 = len(s2)
self.l3 = len(s3)
self.dict_s3 = {}
if self.l1 + se... | the_stack_v2_python_sparse | InterleavingString_HARD_97.py | 953250587/leetcode-python | train | 2 | |
2e6e2c2d41038ed9d1bcde668a87653c0293b837 | [
"shuzi = Test(7, 3)\nself.assertEqual(shuzi.add(), 10)\nself.assertEqual(shuzi.dele(), 4)",
"liangshuzi = Test(6, 5)\nt = liangshuzi.add() * 2 + liangshuzi.dele() * 2\nself.assertEqual(t, 24)"
] | <|body_start_0|>
shuzi = Test(7, 3)
self.assertEqual(shuzi.add(), 10)
self.assertEqual(shuzi.dele(), 4)
<|end_body_0|>
<|body_start_1|>
liangshuzi = Test(6, 5)
t = liangshuzi.add() * 2 + liangshuzi.dele() * 2
self.assertEqual(t, 24)
<|end_body_1|>
| 数字计算 | Test_test | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test_test:
"""数字计算"""
def test_shuzi(self):
"""两个数字相加以及两个数字相减"""
<|body_0|>
def test_liangmethod(self):
"""两数字相加的2倍 加上 两个数字相减的2倍"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
shuzi = Test(7, 3)
self.assertEqual(shuzi.add(), 10)
... | stack_v2_sparse_classes_36k_train_030495 | 888 | no_license | [
{
"docstring": "两个数字相加以及两个数字相减",
"name": "test_shuzi",
"signature": "def test_shuzi(self)"
},
{
"docstring": "两数字相加的2倍 加上 两个数字相减的2倍",
"name": "test_liangmethod",
"signature": "def test_liangmethod(self)"
}
] | 2 | null | Implement the Python class `Test_test` described below.
Class description:
数字计算
Method signatures and docstrings:
- def test_shuzi(self): 两个数字相加以及两个数字相减
- def test_liangmethod(self): 两数字相加的2倍 加上 两个数字相减的2倍 | Implement the Python class `Test_test` described below.
Class description:
数字计算
Method signatures and docstrings:
- def test_shuzi(self): 两个数字相加以及两个数字相减
- def test_liangmethod(self): 两数字相加的2倍 加上 两个数字相减的2倍
<|skeleton|>
class Test_test:
"""数字计算"""
def test_shuzi(self):
"""两个数字相加以及两个数字相减"""
<|b... | 98882c3599d0eb9ac84e74193c584ba7b78ecfab | <|skeleton|>
class Test_test:
"""数字计算"""
def test_shuzi(self):
"""两个数字相加以及两个数字相减"""
<|body_0|>
def test_liangmethod(self):
"""两数字相加的2倍 加上 两个数字相减的2倍"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test_test:
"""数字计算"""
def test_shuzi(self):
"""两个数字相加以及两个数字相减"""
shuzi = Test(7, 3)
self.assertEqual(shuzi.add(), 10)
self.assertEqual(shuzi.dele(), 4)
def test_liangmethod(self):
"""两数字相加的2倍 加上 两个数字相减的2倍"""
liangshuzi = Test(6, 5)
t = liangshu... | the_stack_v2_python_sparse | Course0823/Week05/test_demo/add_dele.py | chenbaoshun/AutomationTesting | train | 0 |
f05aef34099bf3aeff061f6b91b198083cf154ab | [
"if not root:\n return ''\nleft = self.serialize(root.left)\nright = self.serialize(root.right)\nreturn f'{root.val},{len(left)},{len(right)},{left}{right}'",
"if not data:\n return None\n\ndef get_val(index):\n while index < len(data):\n if data[index] == ',':\n return index\n i... | <|body_start_0|>
if not root:
return ''
left = self.serialize(root.left)
right = self.serialize(root.right)
return f'{root.val},{len(left)},{len(right)},{left}{right}'
<|end_body_0|>
<|body_start_1|>
if not data:
return None
def get_val(index):
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> TreeNode:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root:
... | stack_v2_sparse_classes_36k_train_030496 | 1,525 | no_license | [
{
"docstring": "Encodes a tree to a single string.",
"name": "serialize",
"signature": "def serialize(self, root: TreeNode) -> str"
},
{
"docstring": "Decodes your encoded data to tree.",
"name": "deserialize",
"signature": "def deserialize(self, data: str) -> TreeNode"
}
] | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
<|skeleton|>
class Co... | afc5a08cd538c45e075fc6c479c255b3596d7ac5 | <|skeleton|>
class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> TreeNode:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
if not root:
return ''
left = self.serialize(root.left)
right = self.serialize(root.right)
return f'{root.val},{len(left)},{len(right)},{left}{right}'
def deseri... | the_stack_v2_python_sparse | serialise_deserialise_binary_tree_again.py | gauravaror/programming | train | 0 | |
ad78bdac015a6aa2730a68e7b334251b9148a625 | [
"object_type, payload = self._get_type_and_payload(api_objects)\nif object_type.endswith('s'):\n return self._do(self.post, dict(create_many=True, sideload=False), payload=payload)\nelse:\n return self._do(self.post, dict(sideload=False), payload=payload)",
"object_type, payload = self._get_type_and_payload... | <|body_start_0|>
object_type, payload = self._get_type_and_payload(api_objects)
if object_type.endswith('s'):
return self._do(self.post, dict(create_many=True, sideload=False), payload=payload)
else:
return self._do(self.post, dict(sideload=False), payload=payload)
<|end_... | CRUDApi supports create/update/delete operations | CRUDApi | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CRUDApi:
"""CRUDApi supports create/update/delete operations"""
def create(self, api_objects):
"""Create (POST) one or more API objects. Before being submitted to Zendesk the object or objects will be serialized to JSON. :param api_objects: object or objects to create"""
<|bo... | stack_v2_sparse_classes_36k_train_030497 | 35,554 | no_license | [
{
"docstring": "Create (POST) one or more API objects. Before being submitted to Zendesk the object or objects will be serialized to JSON. :param api_objects: object or objects to create",
"name": "create",
"signature": "def create(self, api_objects)"
},
{
"docstring": "Update (PUT) one or more ... | 3 | stack_v2_sparse_classes_30k_test_000953 | Implement the Python class `CRUDApi` described below.
Class description:
CRUDApi supports create/update/delete operations
Method signatures and docstrings:
- def create(self, api_objects): Create (POST) one or more API objects. Before being submitted to Zendesk the object or objects will be serialized to JSON. :param... | Implement the Python class `CRUDApi` described below.
Class description:
CRUDApi supports create/update/delete operations
Method signatures and docstrings:
- def create(self, api_objects): Create (POST) one or more API objects. Before being submitted to Zendesk the object or objects will be serialized to JSON. :param... | a7aef6d1af57a890056032a7991e41214e0e97bf | <|skeleton|>
class CRUDApi:
"""CRUDApi supports create/update/delete operations"""
def create(self, api_objects):
"""Create (POST) one or more API objects. Before being submitted to Zendesk the object or objects will be serialized to JSON. :param api_objects: object or objects to create"""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CRUDApi:
"""CRUDApi supports create/update/delete operations"""
def create(self, api_objects):
"""Create (POST) one or more API objects. Before being submitted to Zendesk the object or objects will be serialized to JSON. :param api_objects: object or objects to create"""
object_type, payl... | the_stack_v2_python_sparse | lib/python3.6/site-packages/zenpy/lib/api.py | onlymytho/curious-python | train | 0 |
3454ec9d2fdd0f63e8761eec2e147e4e2ebffd17 | [
"self.cap = capacity\nself.freq = {}\nself.data = {}\nself.op = deque([])\nself.total = 0",
"if key not in self.data:\n return -1\nelse:\n self.op.append(key)\n self.freq[key] += 1\n return self.data[key]",
"if key in self.data:\n self.freq[key] += 1\nelse:\n self.freq[key] = 1\n self.total... | <|body_start_0|>
self.cap = capacity
self.freq = {}
self.data = {}
self.op = deque([])
self.total = 0
<|end_body_0|>
<|body_start_1|>
if key not in self.data:
return -1
else:
self.op.append(key)
self.freq[key] += 1
... | LRUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":rtype: int"""
<|body_1|>
def set(self, key, value):
""":type key: int :type value: int :rtype: nothing"""
<|body_2|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_36k_train_030498 | 800 | no_license | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":rtype: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":type key: int :type value: int :rtype: nothing",
"name": "set",
"sig... | 3 | null | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :rtype: int
- def set(self, key, value): :type key: int :type value: int :rtype: nothing | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :rtype: int
- def set(self, key, value): :type key: int :type value: int :rtype: nothing
<|skeleton|>
cla... | 616a868bfa7bdd00195067b0477b0236a72d23e0 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":rtype: int"""
<|body_1|>
def set(self, key, value):
""":type key: int :type value: int :rtype: nothing"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
self.cap = capacity
self.freq = {}
self.data = {}
self.op = deque([])
self.total = 0
def get(self, key):
""":rtype: int"""
if key not in self.data:
return -1
... | the_stack_v2_python_sparse | 101-200/146.py | yanbinbi/leetcode | train | 0 | |
eab34f8ac29168d50aca50b6ac8c9332437525b9 | [
"res = super(ManageCusomerBadge, self).default_get(fields)\ncustomer_id = self.env.context.get('default_customer_id')\nif customer_id:\n customer = self.env['res.partner'].browse(customer_id)\nif customer.exists():\n if 'flsp_cb_id' in fields:\n res['flsp_cb_id'] = customer.flsp_cb_id\nres = self._conv... | <|body_start_0|>
res = super(ManageCusomerBadge, self).default_get(fields)
customer_id = self.env.context.get('default_customer_id')
if customer_id:
customer = self.env['res.partner'].browse(customer_id)
if customer.exists():
if 'flsp_cb_id' in fields:
... | Class_Name: ManageCusomerBadge Model_Name: flsp.manage.customer.badge Purpose: To create a model used in the wizard to manage customer badge Date: April/09th/2021 Author: Perry He | ManageCusomerBadge | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ManageCusomerBadge:
"""Class_Name: ManageCusomerBadge Model_Name: flsp.manage.customer.badge Purpose: To create a model used in the wizard to manage customer badge Date: April/09th/2021 Author: Perry He"""
def default_get(self, fields):
"""Purpose: to get the default values from the ... | stack_v2_sparse_classes_36k_train_030499 | 3,247 | no_license | [
{
"docstring": "Purpose: to get the default values from the customer model and load in the wizard",
"name": "default_get",
"signature": "def default_get(self, fields)"
},
{
"docstring": "Purpose: 1) Button used in wizard to add/update the badge 2) send the email only when it is done",
"name"... | 3 | stack_v2_sparse_classes_30k_train_013235 | Implement the Python class `ManageCusomerBadge` described below.
Class description:
Class_Name: ManageCusomerBadge Model_Name: flsp.manage.customer.badge Purpose: To create a model used in the wizard to manage customer badge Date: April/09th/2021 Author: Perry He
Method signatures and docstrings:
- def default_get(se... | Implement the Python class `ManageCusomerBadge` described below.
Class description:
Class_Name: ManageCusomerBadge Model_Name: flsp.manage.customer.badge Purpose: To create a model used in the wizard to manage customer badge Date: April/09th/2021 Author: Perry He
Method signatures and docstrings:
- def default_get(se... | 4a82cd5cfd1898c6da860cb68dff3a14e037bbad | <|skeleton|>
class ManageCusomerBadge:
"""Class_Name: ManageCusomerBadge Model_Name: flsp.manage.customer.badge Purpose: To create a model used in the wizard to manage customer badge Date: April/09th/2021 Author: Perry He"""
def default_get(self, fields):
"""Purpose: to get the default values from the ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ManageCusomerBadge:
"""Class_Name: ManageCusomerBadge Model_Name: flsp.manage.customer.badge Purpose: To create a model used in the wizard to manage customer badge Date: April/09th/2021 Author: Perry He"""
def default_get(self, fields):
"""Purpose: to get the default values from the customer mode... | the_stack_v2_python_sparse | flsp-salesorder/models/manage_customer_badge_wizard.py | odoo-smg/firstlight | train | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.