blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0db15ce4ea9da92967f64d8f4f74573dc85e40b4 | [
"super(NonAdaptiveDSSDataLoader, self).__init__(train_loader.dataset, dss_args, logger, *args, **kwargs)\nassert 'device' in dss_args.keys(), \"'device' is a compulsory argument. Include it as a key in dss_args\"\nassert 'num_iters' in dss_args.keys(), \"'num_iters' is a compulsory argument. Include it as a key in ... | <|body_start_0|>
super(NonAdaptiveDSSDataLoader, self).__init__(train_loader.dataset, dss_args, logger, *args, **kwargs)
assert 'device' in dss_args.keys(), "'device' is a compulsory argument. Include it as a key in dss_args"
assert 'num_iters' in dss_args.keys(), "'num_iters' is a compulsory ar... | Implementation of NonAdaptiveDSSDataLoader class which serves as base class for dataloaders of other nonadaptive subset selection strategies for semi-supervised learning setting. Parameters ----------- train_loader: torch.utils.data.DataLoader class Dataloader of the training dataset val_loader: torch.utils.data.DataLo... | NonAdaptiveDSSDataLoader | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NonAdaptiveDSSDataLoader:
"""Implementation of NonAdaptiveDSSDataLoader class which serves as base class for dataloaders of other nonadaptive subset selection strategies for semi-supervised learning setting. Parameters ----------- train_loader: torch.utils.data.DataLoader class Dataloader of the ... | stack_v2_sparse_classes_75kplus_train_000500 | 2,147 | permissive | [
{
"docstring": "Constructor function",
"name": "__init__",
"signature": "def __init__(self, train_loader, val_loader, dss_args, logger, *args, **kwargs)"
},
{
"docstring": "Iter function that returns the iterator of the data subset loader.",
"name": "__iter__",
"signature": "def __iter__... | 2 | null | Implement the Python class `NonAdaptiveDSSDataLoader` described below.
Class description:
Implementation of NonAdaptiveDSSDataLoader class which serves as base class for dataloaders of other nonadaptive subset selection strategies for semi-supervised learning setting. Parameters ----------- train_loader: torch.utils.d... | Implement the Python class `NonAdaptiveDSSDataLoader` described below.
Class description:
Implementation of NonAdaptiveDSSDataLoader class which serves as base class for dataloaders of other nonadaptive subset selection strategies for semi-supervised learning setting. Parameters ----------- train_loader: torch.utils.d... | 8d10c7f5d96e071f98c20e4e9ff4c41c2c4ea2af | <|skeleton|>
class NonAdaptiveDSSDataLoader:
"""Implementation of NonAdaptiveDSSDataLoader class which serves as base class for dataloaders of other nonadaptive subset selection strategies for semi-supervised learning setting. Parameters ----------- train_loader: torch.utils.data.DataLoader class Dataloader of the ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NonAdaptiveDSSDataLoader:
"""Implementation of NonAdaptiveDSSDataLoader class which serves as base class for dataloaders of other nonadaptive subset selection strategies for semi-supervised learning setting. Parameters ----------- train_loader: torch.utils.data.DataLoader class Dataloader of the training data... | the_stack_v2_python_sparse | cords/utils/data/dataloader/SSL/nonadaptive/nonadaptivedataloader.py | decile-team/cords | train | 289 |
f4993869f710f3dba6a7d9316f24bbad6bedacad | [
"if len(password) < 9:\n return False\nreturn True",
"pattern = '\\\\d'\nif not re.search(pattern, password):\n return False\nreturn True",
"pattern = '\\\\w'\nif not re.search(pattern, password):\n return False\nreturn True",
"pattern = '\\\\W'\nif not re.search(pattern, password):\n return False... | <|body_start_0|>
if len(password) < 9:
return False
return True
<|end_body_0|>
<|body_start_1|>
pattern = '\\d'
if not re.search(pattern, password):
return False
return True
<|end_body_1|>
<|body_start_2|>
pattern = '\\w'
if not re.search... | 密码复杂度检查 | CheckPass | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CheckPass:
"""密码复杂度检查"""
def check_length(password):
"""长度"""
<|body_0|>
def check_number_exists(password):
"""数字"""
<|body_1|>
def check_letter_exists(password):
"""大小写字母"""
<|body_2|>
def check_special_exists(password):
... | stack_v2_sparse_classes_75kplus_train_000501 | 1,276 | no_license | [
{
"docstring": "长度",
"name": "check_length",
"signature": "def check_length(password)"
},
{
"docstring": "数字",
"name": "check_number_exists",
"signature": "def check_number_exists(password)"
},
{
"docstring": "大小写字母",
"name": "check_letter_exists",
"signature": "def check... | 4 | stack_v2_sparse_classes_30k_train_049635 | Implement the Python class `CheckPass` described below.
Class description:
密码复杂度检查
Method signatures and docstrings:
- def check_length(password): 长度
- def check_number_exists(password): 数字
- def check_letter_exists(password): 大小写字母
- def check_special_exists(password): 特殊字符 | Implement the Python class `CheckPass` described below.
Class description:
密码复杂度检查
Method signatures and docstrings:
- def check_length(password): 长度
- def check_number_exists(password): 数字
- def check_letter_exists(password): 大小写字母
- def check_special_exists(password): 特殊字符
<|skeleton|>
class CheckPass:
"""密码复杂... | 04bb7f387633ba8af81148dc73a95c2a6d56a8d1 | <|skeleton|>
class CheckPass:
"""密码复杂度检查"""
def check_length(password):
"""长度"""
<|body_0|>
def check_number_exists(password):
"""数字"""
<|body_1|>
def check_letter_exists(password):
"""大小写字母"""
<|body_2|>
def check_special_exists(password):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CheckPass:
"""密码复杂度检查"""
def check_length(password):
"""长度"""
if len(password) < 9:
return False
return True
def check_number_exists(password):
"""数字"""
pattern = '\\d'
if not re.search(pattern, password):
return False
r... | the_stack_v2_python_sparse | app/utils/check_pass.py | Rabbit-st/rabbit | train | 0 |
82d637938fde19d093000d16ef9ad4d81058597d | [
"order_id = request.GET.get('order_id')\ntry:\n order = OrderInfo.objects.get(order_id=order_id, user=request.user, status=OrderInfo.ORDER_STATUS_ENUM['UNCOMMENT'])\nexcept OrderInfo.DoesNotExist:\n return HttpResponseForbidden('订单有误')\norder_goods_qs = OrderGoods.objects.filter(order=order, is_commented=Fals... | <|body_start_0|>
order_id = request.GET.get('order_id')
try:
order = OrderInfo.objects.get(order_id=order_id, user=request.user, status=OrderInfo.ORDER_STATUS_ENUM['UNCOMMENT'])
except OrderInfo.DoesNotExist:
return HttpResponseForbidden('订单有误')
order_goods_qs = O... | 订单评价 | OrderCommentView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrderCommentView:
"""订单评价"""
def get(self, request):
"""展示订单评价界面"""
<|body_0|>
def post(self, request):
"""提交评价信息"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
order_id = request.GET.get('order_id')
try:
order = OrderInfo.o... | stack_v2_sparse_classes_75kplus_train_000502 | 11,122 | permissive | [
{
"docstring": "展示订单评价界面",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "提交评价信息",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002996 | Implement the Python class `OrderCommentView` described below.
Class description:
订单评价
Method signatures and docstrings:
- def get(self, request): 展示订单评价界面
- def post(self, request): 提交评价信息 | Implement the Python class `OrderCommentView` described below.
Class description:
订单评价
Method signatures and docstrings:
- def get(self, request): 展示订单评价界面
- def post(self, request): 提交评价信息
<|skeleton|>
class OrderCommentView:
"""订单评价"""
def get(self, request):
"""展示订单评价界面"""
<|body_0|>
... | 58468fd619a8d9f022df442a10a56b1b12ed1dd8 | <|skeleton|>
class OrderCommentView:
"""订单评价"""
def get(self, request):
"""展示订单评价界面"""
<|body_0|>
def post(self, request):
"""提交评价信息"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OrderCommentView:
"""订单评价"""
def get(self, request):
"""展示订单评价界面"""
order_id = request.GET.get('order_id')
try:
order = OrderInfo.objects.get(order_id=order_id, user=request.user, status=OrderInfo.ORDER_STATUS_ENUM['UNCOMMENT'])
except OrderInfo.DoesNotExist:
... | the_stack_v2_python_sparse | meiduo/apps/order/views.py | libin-c/Meiduo | train | 0 |
740b465b6ac9e75c9d5812b173476c924de4255e | [
"self.pa1_is_control = pa1_is_control\nself.flipped_by_0 = flipped_by_0\nassert pa1.size == 2 & pa2.size == 2, \"The parent nodes of the CNot don't both have size 2\"\nassert pa1.state_names == ['0', '1'], 'parent1 states not 0,1'\nassert pa2.state_names == ['0', '1'], 'parent2 states not 0,1'\nBayesNode.__init__(s... | <|body_start_0|>
self.pa1_is_control = pa1_is_control
self.flipped_by_0 = flipped_by_0
assert pa1.size == 2 & pa2.size == 2, "The parent nodes of the CNot don't both have size 2"
assert pa1.state_names == ['0', '1'], 'parent1 states not 0,1'
assert pa2.state_names == ['0', '1'], ... | The Constructor of this class builds a BayesNode that has a transition matrix appropriate for a CNot (Controlled Not) The following is expected: * the focus node has exactly two parent nodes, * the parent nodes each has 2 states named, 0 and 1, in that order. Suppose M1, M2, N1, N2 are elements of {0,1}. Say M1 is the ... | CNot | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CNot:
"""The Constructor of this class builds a BayesNode that has a transition matrix appropriate for a CNot (Controlled Not) The following is expected: * the focus node has exactly two parent nodes, * the parent nodes each has 2 states named, 0 and 1, in that order. Suppose M1, M2, N1, N2 are e... | stack_v2_sparse_classes_75kplus_train_000503 | 4,466 | permissive | [
{
"docstring": "Constructor Parameters ---------- id_num : int id number of self (focus node) name : str name of self (focus node) is_quantum : bool pa1 : BayesNode parent 1 pa2 : BayesNode parent 2 pa1_is_control : bool True (False) when parent 1 (parent 2) is control flipped_by_0 : bool True (False) when targ... | 2 | stack_v2_sparse_classes_30k_train_043356 | Implement the Python class `CNot` described below.
Class description:
The Constructor of this class builds a BayesNode that has a transition matrix appropriate for a CNot (Controlled Not) The following is expected: * the focus node has exactly two parent nodes, * the parent nodes each has 2 states named, 0 and 1, in t... | Implement the Python class `CNot` described below.
Class description:
The Constructor of this class builds a BayesNode that has a transition matrix appropriate for a CNot (Controlled Not) The following is expected: * the focus node has exactly two parent nodes, * the parent nodes each has 2 states named, 0 and 1, in t... | 5b4a3055ea14c2ee9c80c339f759fe2b9c8c51e2 | <|skeleton|>
class CNot:
"""The Constructor of this class builds a BayesNode that has a transition matrix appropriate for a CNot (Controlled Not) The following is expected: * the focus node has exactly two parent nodes, * the parent nodes each has 2 states named, 0 and 1, in that order. Suppose M1, M2, N1, N2 are e... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CNot:
"""The Constructor of this class builds a BayesNode that has a transition matrix appropriate for a CNot (Controlled Not) The following is expected: * the focus node has exactly two parent nodes, * the parent nodes each has 2 states named, 0 and 1, in that order. Suppose M1, M2, N1, N2 are elements of {0... | the_stack_v2_python_sparse | prefabricated_nodes/CNot.py | artiste-qb-net/quantum-fog | train | 95 |
2a326b40b46601046e0c9c336edbeb110d2259ef | [
"touxi_config.alter_default_setting(87, 'whether_dialysis', '是否透析', is_use, value)\nzy.send.send('ipt', 'audit757_1', 1)\ntime.sleep(1)\nengineid = zy.get_engineid(1)\nactual = zy.get_patient(engineid, 0)['data']['dialysis']\nprint(actual)\nprint(expected)\nassert actual == expected",
"touxi_config.alter_default_... | <|body_start_0|>
touxi_config.alter_default_setting(87, 'whether_dialysis', '是否透析', is_use, value)
zy.send.send('ipt', 'audit757_1', 1)
time.sleep(1)
engineid = zy.get_engineid(1)
actual = zy.get_patient(engineid, 0)['data']['dialysis']
print(actual)
print(expecte... | AUDIT-757 是否透析 | TestIptTouXi | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestIptTouXi:
"""AUDIT-757 是否透析"""
def test_touxi_null(self, zy, touxi_config, is_use, value, expected):
"""审方透析值传空"""
<|body_0|>
def test_touxi_zero(self, zy, touxi_config, is_use, value, expected):
"""审方透析值传0"""
<|body_1|>
def test_touxi_one(self, ... | stack_v2_sparse_classes_75kplus_train_000504 | 2,320 | no_license | [
{
"docstring": "审方透析值传空",
"name": "test_touxi_null",
"signature": "def test_touxi_null(self, zy, touxi_config, is_use, value, expected)"
},
{
"docstring": "审方透析值传0",
"name": "test_touxi_zero",
"signature": "def test_touxi_zero(self, zy, touxi_config, is_use, value, expected)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_031464 | Implement the Python class `TestIptTouXi` described below.
Class description:
AUDIT-757 是否透析
Method signatures and docstrings:
- def test_touxi_null(self, zy, touxi_config, is_use, value, expected): 审方透析值传空
- def test_touxi_zero(self, zy, touxi_config, is_use, value, expected): 审方透析值传0
- def test_touxi_one(self, zy, ... | Implement the Python class `TestIptTouXi` described below.
Class description:
AUDIT-757 是否透析
Method signatures and docstrings:
- def test_touxi_null(self, zy, touxi_config, is_use, value, expected): 审方透析值传空
- def test_touxi_zero(self, zy, touxi_config, is_use, value, expected): 审方透析值传0
- def test_touxi_one(self, zy, ... | f9b61f0b4a3ca8609986f2708f70074740730fc7 | <|skeleton|>
class TestIptTouXi:
"""AUDIT-757 是否透析"""
def test_touxi_null(self, zy, touxi_config, is_use, value, expected):
"""审方透析值传空"""
<|body_0|>
def test_touxi_zero(self, zy, touxi_config, is_use, value, expected):
"""审方透析值传0"""
<|body_1|>
def test_touxi_one(self, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestIptTouXi:
"""AUDIT-757 是否透析"""
def test_touxi_null(self, zy, touxi_config, is_use, value, expected):
"""审方透析值传空"""
touxi_config.alter_default_setting(87, 'whether_dialysis', '是否透析', is_use, value)
zy.send.send('ipt', 'audit757_1', 1)
time.sleep(1)
engineid = zy... | the_stack_v2_python_sparse | test_ipt_group/test_audit_757_1.py | wmm0165/auditcenter_3.X | train | 0 |
ed7b0b9e14418a4cf83d91b1cd44a4ad3018d8df | [
"super().__init__(title, group_name)\nself.compound = compound\nrt_ref: metob.RtReference = compound['identification'].rt_references[0]\nself.rt_range: Tuple[float, float] = (rt_ref.rt_min, rt_ref.rt_max)\nself.rt_peak: float = rt_ref.rt_peak\nself.rt_buffer = rt_buffer",
"super().plot(ax, back_color)\nself._draw... | <|body_start_0|>
super().__init__(title, group_name)
self.compound = compound
rt_ref: metob.RtReference = compound['identification'].rt_references[0]
self.rt_range: Tuple[float, float] = (rt_ref.rt_min, rt_ref.rt_max)
self.rt_peak: float = rt_ref.rt_peak
self.rt_buffer = ... | EIC for one compound within a single sample | CompoundEic | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CompoundEic:
"""EIC for one compound within a single sample"""
def __init__(self, title: str, group_name: str, compound: Dict[str, Any], rt_buffer: float=0.5):
"""compound: Compound instance rt_buffer: amount of time in minutes to show to each side of rt_min/rt_max/rt_peak"""
... | stack_v2_sparse_classes_75kplus_train_000505 | 3,948 | permissive | [
{
"docstring": "compound: Compound instance rt_buffer: amount of time in minutes to show to each side of rt_min/rt_max/rt_peak",
"name": "__init__",
"signature": "def __init__(self, title: str, group_name: str, compound: Dict[str, Any], rt_buffer: float=0.5)"
},
{
"docstring": "Draw plot of EIC ... | 4 | stack_v2_sparse_classes_30k_train_009671 | Implement the Python class `CompoundEic` described below.
Class description:
EIC for one compound within a single sample
Method signatures and docstrings:
- def __init__(self, title: str, group_name: str, compound: Dict[str, Any], rt_buffer: float=0.5): compound: Compound instance rt_buffer: amount of time in minutes... | Implement the Python class `CompoundEic` described below.
Class description:
EIC for one compound within a single sample
Method signatures and docstrings:
- def __init__(self, title: str, group_name: str, compound: Dict[str, Any], rt_buffer: float=0.5): compound: Compound instance rt_buffer: amount of time in minutes... | 909ede3d1fe75fa5d64c6ff1b4c6016dc3df6746 | <|skeleton|>
class CompoundEic:
"""EIC for one compound within a single sample"""
def __init__(self, title: str, group_name: str, compound: Dict[str, Any], rt_buffer: float=0.5):
"""compound: Compound instance rt_buffer: amount of time in minutes to show to each side of rt_min/rt_max/rt_peak"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CompoundEic:
"""EIC for one compound within a single sample"""
def __init__(self, title: str, group_name: str, compound: Dict[str, Any], rt_buffer: float=0.5):
"""compound: Compound instance rt_buffer: amount of time in minutes to show to each side of rt_min/rt_max/rt_peak"""
super().__in... | the_stack_v2_python_sparse | metatlas/plots/compound_eic.py | biorack/metatlas | train | 10 |
f76383172df6a097b474bbc0ba83fbe7101dbc45 | [
"for flow, args in [('ListDirectory', {'pathspec': rdfvalue.PathSpec(pathtype=rdfvalue.PathSpec.PathType.REGISTRY, path=self.reg_path)}), ('FindFiles', {'findspec': rdfvalue.FindSpec(pathspec=rdfvalue.PathSpec(path=self.reg_path, pathtype=rdfvalue.PathSpec.PathType.REGISTRY), path_regex='ProfileImagePath'), 'output... | <|body_start_0|>
for flow, args in [('ListDirectory', {'pathspec': rdfvalue.PathSpec(pathtype=rdfvalue.PathSpec.PathType.REGISTRY, path=self.reg_path)}), ('FindFiles', {'findspec': rdfvalue.FindSpec(pathspec=rdfvalue.PathSpec(path=self.reg_path, pathtype=rdfvalue.PathSpec.PathType.REGISTRY), path_regex='Profile... | Test that user listing from the registry works. We basically list the registry and then run Find on the same place, we expect a single ProfileImagePath value for each user. TODO(user): this is excluded from automated tests for now because it needs to run two flows and defines its own runTest to do so. We should support... | TestFindWindowsRegistry | [
"Apache-2.0",
"DOC"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestFindWindowsRegistry:
"""Test that user listing from the registry works. We basically list the registry and then run Find on the same place, we expect a single ProfileImagePath value for each user. TODO(user): this is excluded from automated tests for now because it needs to run two flows and ... | stack_v2_sparse_classes_75kplus_train_000506 | 3,412 | permissive | [
{
"docstring": "Launch our flows.",
"name": "runTest",
"signature": "def runTest(self)"
},
{
"docstring": "Check that all profiles listed have an ProfileImagePath.",
"name": "CheckFlow",
"signature": "def CheckFlow(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_023382 | Implement the Python class `TestFindWindowsRegistry` described below.
Class description:
Test that user listing from the registry works. We basically list the registry and then run Find on the same place, we expect a single ProfileImagePath value for each user. TODO(user): this is excluded from automated tests for now... | Implement the Python class `TestFindWindowsRegistry` described below.
Class description:
Test that user listing from the registry works. We basically list the registry and then run Find on the same place, we expect a single ProfileImagePath value for each user. TODO(user): this is excluded from automated tests for now... | ba1648b97a76f844ffb8e1891cc9e2680f9b1c6e | <|skeleton|>
class TestFindWindowsRegistry:
"""Test that user listing from the registry works. We basically list the registry and then run Find on the same place, we expect a single ProfileImagePath value for each user. TODO(user): this is excluded from automated tests for now because it needs to run two flows and ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestFindWindowsRegistry:
"""Test that user listing from the registry works. We basically list the registry and then run Find on the same place, we expect a single ProfileImagePath value for each user. TODO(user): this is excluded from automated tests for now because it needs to run two flows and defines its o... | the_stack_v2_python_sparse | endtoend_tests/registry.py | defaultnamehere/grr | train | 3 |
29f4b2b37183e9e51a4da1039c9af32a3d5df67f | [
"schedule_list = []\nschedules = self.manager.config.get('schedules', [])\nif schedules is True:\n schedules = DEFAULT_SCHEDULES\nelif schedules is False:\n raise Conflict('Schedules are disables in config')\nfor schedule in schedules:\n schedule_id = id(schedule)\n schedule = schedule.copy()\n sched... | <|body_start_0|>
schedule_list = []
schedules = self.manager.config.get('schedules', [])
if schedules is True:
schedules = DEFAULT_SCHEDULES
elif schedules is False:
raise Conflict('Schedules are disables in config')
for schedule in schedules:
... | SchedulesAPI | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SchedulesAPI:
def get(self, session=None):
"""List schedules"""
<|body_0|>
def post(self, session=None):
"""Add new schedule"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
schedule_list = []
schedules = self.manager.config.get('schedules', ... | stack_v2_sparse_classes_75kplus_train_000507 | 6,652 | permissive | [
{
"docstring": "List schedules",
"name": "get",
"signature": "def get(self, session=None)"
},
{
"docstring": "Add new schedule",
"name": "post",
"signature": "def post(self, session=None)"
}
] | 2 | null | Implement the Python class `SchedulesAPI` described below.
Class description:
Implement the SchedulesAPI class.
Method signatures and docstrings:
- def get(self, session=None): List schedules
- def post(self, session=None): Add new schedule | Implement the Python class `SchedulesAPI` described below.
Class description:
Implement the SchedulesAPI class.
Method signatures and docstrings:
- def get(self, session=None): List schedules
- def post(self, session=None): Add new schedule
<|skeleton|>
class SchedulesAPI:
def get(self, session=None):
"... | ea95ff60041beaea9aacbc2d93549e3a6b981dc5 | <|skeleton|>
class SchedulesAPI:
def get(self, session=None):
"""List schedules"""
<|body_0|>
def post(self, session=None):
"""Add new schedule"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SchedulesAPI:
def get(self, session=None):
"""List schedules"""
schedule_list = []
schedules = self.manager.config.get('schedules', [])
if schedules is True:
schedules = DEFAULT_SCHEDULES
elif schedules is False:
raise Conflict('Schedules are dis... | the_stack_v2_python_sparse | flexget/components/scheduler/api.py | BrutuZ/Flexget | train | 1 | |
f36a8a49f0c1c25e9e5c263f1fcbf28f6711849d | [
"order = Order.objects.filter(owner__language='en', reminder_email_sent=False, date_paid__isnull=False).order_by('?')[0]\nself.assertEqual(abandoned_basket(order.pk), True)\nself.assertEquals(len(mail.outbox), 1)\nemail_subject_line = _('Do you want to finish your order on %s?') % settings.SITE_NAME\nself.assertEqu... | <|body_start_0|>
order = Order.objects.filter(owner__language='en', reminder_email_sent=False, date_paid__isnull=False).order_by('?')[0]
self.assertEqual(abandoned_basket(order.pk), True)
self.assertEquals(len(mail.outbox), 1)
email_subject_line = _('Do you want to finish your order on %... | EmailsTestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EmailsTestCase:
def test_abandoned_basket_email(self):
"""Make sure the abandoned basket email is being sent correctly"""
<|body_0|>
def test_product_review_email(self):
"""Check the review email sent after an order is placed"""
<|body_1|>
def test_payme... | stack_v2_sparse_classes_75kplus_train_000508 | 3,069 | no_license | [
{
"docstring": "Make sure the abandoned basket email is being sent correctly",
"name": "test_abandoned_basket_email",
"signature": "def test_abandoned_basket_email(self)"
},
{
"docstring": "Check the review email sent after an order is placed",
"name": "test_product_review_email",
"signa... | 3 | null | Implement the Python class `EmailsTestCase` described below.
Class description:
Implement the EmailsTestCase class.
Method signatures and docstrings:
- def test_abandoned_basket_email(self): Make sure the abandoned basket email is being sent correctly
- def test_product_review_email(self): Check the review email sent... | Implement the Python class `EmailsTestCase` described below.
Class description:
Implement the EmailsTestCase class.
Method signatures and docstrings:
- def test_abandoned_basket_email(self): Make sure the abandoned basket email is being sent correctly
- def test_product_review_email(self): Check the review email sent... | a616e4fa340b63e69ba16d681a377ac598f115bd | <|skeleton|>
class EmailsTestCase:
def test_abandoned_basket_email(self):
"""Make sure the abandoned basket email is being sent correctly"""
<|body_0|>
def test_product_review_email(self):
"""Check the review email sent after an order is placed"""
<|body_1|>
def test_payme... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EmailsTestCase:
def test_abandoned_basket_email(self):
"""Make sure the abandoned basket email is being sent correctly"""
order = Order.objects.filter(owner__language='en', reminder_email_sent=False, date_paid__isnull=False).order_by('?')[0]
self.assertEqual(abandoned_basket(order.pk),... | the_stack_v2_python_sparse | emailer/tests.py | minrivertea/minrivertea | train | 0 | |
fc5e63542998adba97a67f2a5990f3fa429a44f8 | [
"self.cmd = cmd\nself.rsp = rsp\nself.dev = dev\nself.timeout = timeout\nself.re = re\nself.rpc_error = None\nself.xml = rsp\nif isinstance(errs, RPCError) and hasattr(errs, 'errors'):\n self.errs = [JXML.rpc_error(error.xml) for error in errs.errors]\n for error in errs.errors:\n if error.severity == ... | <|body_start_0|>
self.cmd = cmd
self.rsp = rsp
self.dev = dev
self.timeout = timeout
self.re = re
self.rpc_error = None
self.xml = rsp
if isinstance(errs, RPCError) and hasattr(errs, 'errors'):
self.errs = [JXML.rpc_error(error.xml) for error i... | Parent class for all junos-pyez RPC Exceptions | RpcError | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RpcError:
"""Parent class for all junos-pyez RPC Exceptions"""
def __init__(self, cmd=None, rsp=None, errs=None, dev=None, timeout=None, re=None):
""":cmd: is the rpc command :rsp: is the rpc response (after <rpc-reply>) :errs: is a list of dictionaries of extracted <rpc-error> eleme... | stack_v2_sparse_classes_75kplus_train_000509 | 9,037 | permissive | [
{
"docstring": ":cmd: is the rpc command :rsp: is the rpc response (after <rpc-reply>) :errs: is a list of dictionaries of extracted <rpc-error> elements. :dev: is the device rpc was executed on :timeout: is the timeout value of the device :re: is the RE or member exception occured on",
"name": "__init__",
... | 2 | stack_v2_sparse_classes_30k_train_040017 | Implement the Python class `RpcError` described below.
Class description:
Parent class for all junos-pyez RPC Exceptions
Method signatures and docstrings:
- def __init__(self, cmd=None, rsp=None, errs=None, dev=None, timeout=None, re=None): :cmd: is the rpc command :rsp: is the rpc response (after <rpc-reply>) :errs:... | Implement the Python class `RpcError` described below.
Class description:
Parent class for all junos-pyez RPC Exceptions
Method signatures and docstrings:
- def __init__(self, cmd=None, rsp=None, errs=None, dev=None, timeout=None, re=None): :cmd: is the rpc command :rsp: is the rpc response (after <rpc-reply>) :errs:... | e19a7683be1da67140798987ac42e8c82041c393 | <|skeleton|>
class RpcError:
"""Parent class for all junos-pyez RPC Exceptions"""
def __init__(self, cmd=None, rsp=None, errs=None, dev=None, timeout=None, re=None):
""":cmd: is the rpc command :rsp: is the rpc response (after <rpc-reply>) :errs: is a list of dictionaries of extracted <rpc-error> eleme... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RpcError:
"""Parent class for all junos-pyez RPC Exceptions"""
def __init__(self, cmd=None, rsp=None, errs=None, dev=None, timeout=None, re=None):
""":cmd: is the rpc command :rsp: is the rpc response (after <rpc-reply>) :errs: is a list of dictionaries of extracted <rpc-error> elements. :dev: is... | the_stack_v2_python_sparse | lib/jnpr/junos/exception.py | Juniper/py-junos-eznc | train | 628 |
a69af1f706f6e8301109c76a16d9a1321c17d722 | [
"self.v = x\nself.cl = None\nself.cr = None\nreturn None",
"if not a or not isinstance(a, list):\n return Node(None)\no = Node(a[0])\nq = deque([o])\ni = 0\nn = len(a)\nwhile q:\n p = q.popleft()\n if 2 * i + 1 < n:\n p.cl = Node(a[2 * i + 1])\n q.append(p.cl)\n if 2 * i + 2 < n:\n ... | <|body_start_0|>
self.v = x
self.cl = None
self.cr = None
return None
<|end_body_0|>
<|body_start_1|>
if not a or not isinstance(a, list):
return Node(None)
o = Node(a[0])
q = deque([o])
i = 0
n = len(a)
while q:
p ... | Manage Node objects for binary search trees. | Node | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Node:
"""Manage Node objects for binary search trees."""
def __init__(self, x=None):
"""Constructor for Node objects. :param (int or None) v: integer value for node :param Node cl: pointer to left-side child Node :param Node cr: pointer to right-side child Node :return: None :rtype: ... | stack_v2_sparse_classes_75kplus_train_000510 | 2,255 | permissive | [
{
"docstring": "Constructor for Node objects. :param (int or None) v: integer value for node :param Node cl: pointer to left-side child Node :param Node cr: pointer to right-side child Node :return: None :rtype: None",
"name": "__init__",
"signature": "def __init__(self, x=None)"
},
{
"docstring... | 3 | null | Implement the Python class `Node` described below.
Class description:
Manage Node objects for binary search trees.
Method signatures and docstrings:
- def __init__(self, x=None): Constructor for Node objects. :param (int or None) v: integer value for node :param Node cl: pointer to left-side child Node :param Node cr... | Implement the Python class `Node` described below.
Class description:
Manage Node objects for binary search trees.
Method signatures and docstrings:
- def __init__(self, x=None): Constructor for Node objects. :param (int or None) v: integer value for node :param Node cl: pointer to left-side child Node :param Node cr... | 69f90877c5466927e8b081c4268cbcda074813ec | <|skeleton|>
class Node:
"""Manage Node objects for binary search trees."""
def __init__(self, x=None):
"""Constructor for Node objects. :param (int or None) v: integer value for node :param Node cl: pointer to left-side child Node :param Node cr: pointer to right-side child Node :return: None :rtype: ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Node:
"""Manage Node objects for binary search trees."""
def __init__(self, x=None):
"""Constructor for Node objects. :param (int or None) v: integer value for node :param Node cl: pointer to left-side child Node :param Node cr: pointer to right-side child Node :return: None :rtype: None"""
... | the_stack_v2_python_sparse | 0938_range_sum_bst/python_util.py | arthurdysart/LeetCode | train | 0 |
b5b628d826d6f1faee45406f2df7b77603a4fdfd | [
"user = get_user_from_username(request.user, username)\nyear = int(year)\ngoal = models.AnnualGoal.objects.filter(year=year, user=user).first()\nif not goal and user != request.user:\n return HttpResponseNotFound()\ncurrent_year = timezone.now().year\nif not goal and year != timezone.now().year:\n return redi... | <|body_start_0|>
user = get_user_from_username(request.user, username)
year = int(year)
goal = models.AnnualGoal.objects.filter(year=year, user=user).first()
if not goal and user != request.user:
return HttpResponseNotFound()
current_year = timezone.now().year
... | track books for the year | Goal | [
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Goal:
"""track books for the year"""
def get(self, request, username, year):
"""reading goal page"""
<|body_0|>
def post(self, request, username, year):
"""update or create an annual goal"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
user = ge... | stack_v2_sparse_classes_75kplus_train_000511 | 2,782 | no_license | [
{
"docstring": "reading goal page",
"name": "get",
"signature": "def get(self, request, username, year)"
},
{
"docstring": "update or create an annual goal",
"name": "post",
"signature": "def post(self, request, username, year)"
}
] | 2 | stack_v2_sparse_classes_30k_train_049383 | Implement the Python class `Goal` described below.
Class description:
track books for the year
Method signatures and docstrings:
- def get(self, request, username, year): reading goal page
- def post(self, request, username, year): update or create an annual goal | Implement the Python class `Goal` described below.
Class description:
track books for the year
Method signatures and docstrings:
- def get(self, request, username, year): reading goal page
- def post(self, request, username, year): update or create an annual goal
<|skeleton|>
class Goal:
"""track books for the y... | 0f8da5b738047f3c34d60d93f59bdedd8f797224 | <|skeleton|>
class Goal:
"""track books for the year"""
def get(self, request, username, year):
"""reading goal page"""
<|body_0|>
def post(self, request, username, year):
"""update or create an annual goal"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Goal:
"""track books for the year"""
def get(self, request, username, year):
"""reading goal page"""
user = get_user_from_username(request.user, username)
year = int(year)
goal = models.AnnualGoal.objects.filter(year=year, user=user).first()
if not goal and user !=... | the_stack_v2_python_sparse | bookwyrm/views/goal.py | bookwyrm-social/bookwyrm | train | 1,398 |
3c83ab4713119336ab3daa4880399cc30acf5f05 | [
"fd_mock = mock.mock_open()\nargs = ['script_name', 'gtest', '--test-exe=out_eve/Release/base_unittests', '--board=eve', '--path-to-outdir=out_eve/Release', '--use-vm' if use_vm else '--device=localhost:2222']\nif stop_ui:\n args.append('--stop-ui')\nwith mock.patch.object(sys, 'argv', args), mock.patch.object(t... | <|body_start_0|>
fd_mock = mock.mock_open()
args = ['script_name', 'gtest', '--test-exe=out_eve/Release/base_unittests', '--board=eve', '--path-to-outdir=out_eve/Release', '--use-vm' if use_vm else '--device=localhost:2222']
if stop_ui:
args.append('--stop-ui')
with mock.patc... | GTestTest | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GTestTest:
def test_gtest(self, use_vm, stop_ui):
"""Tests running a gtest."""
<|body_0|>
def test_gtest_with_vpython(self):
"""Tests building a gtest with --vpython-dir."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
fd_mock = mock.mock_open()
... | stack_v2_sparse_classes_75kplus_train_000512 | 12,985 | permissive | [
{
"docstring": "Tests running a gtest.",
"name": "test_gtest",
"signature": "def test_gtest(self, use_vm, stop_ui)"
},
{
"docstring": "Tests building a gtest with --vpython-dir.",
"name": "test_gtest_with_vpython",
"signature": "def test_gtest_with_vpython(self)"
}
] | 2 | stack_v2_sparse_classes_30k_test_002324 | Implement the Python class `GTestTest` described below.
Class description:
Implement the GTestTest class.
Method signatures and docstrings:
- def test_gtest(self, use_vm, stop_ui): Tests running a gtest.
- def test_gtest_with_vpython(self): Tests building a gtest with --vpython-dir. | Implement the Python class `GTestTest` described below.
Class description:
Implement the GTestTest class.
Method signatures and docstrings:
- def test_gtest(self, use_vm, stop_ui): Tests running a gtest.
- def test_gtest_with_vpython(self): Tests building a gtest with --vpython-dir.
<|skeleton|>
class GTestTest:
... | a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c | <|skeleton|>
class GTestTest:
def test_gtest(self, use_vm, stop_ui):
"""Tests running a gtest."""
<|body_0|>
def test_gtest_with_vpython(self):
"""Tests building a gtest with --vpython-dir."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GTestTest:
def test_gtest(self, use_vm, stop_ui):
"""Tests running a gtest."""
fd_mock = mock.mock_open()
args = ['script_name', 'gtest', '--test-exe=out_eve/Release/base_unittests', '--board=eve', '--path-to-outdir=out_eve/Release', '--use-vm' if use_vm else '--device=localhost:2222']... | the_stack_v2_python_sparse | build/chromeos/test_runner_test.py | chromium/chromium | train | 17,408 | |
9e68a5f8d37cf8608b5dce569eafef6dd86496ad | [
"super().__init__()\nself.embedding_dim = embedding_dim\nself.num_distributions = num_distributions\nassert not num_distributions or embedding_dim % num_distributions == 0\ninputs = tf.keras.Input(shape=input_dim)\noutputs = tf.keras.layers.LSTM(embedding_dim, return_sequences=return_sequences)(inputs)\nself.embedd... | <|body_start_0|>
super().__init__()
self.embedding_dim = embedding_dim
self.num_distributions = num_distributions
assert not num_distributions or embedding_dim % num_distributions == 0
inputs = tf.keras.Input(shape=input_dim)
outputs = tf.keras.layers.LSTM(embedding_dim, ... | An RNN embed network. | RNNEmbedNet | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RNNEmbedNet:
"""An RNN embed network."""
def __init__(self, input_dim, embedding_dim, num_distributions=None, return_sequences=False):
"""Creates a neural net. Args: input_dim: Size of inputs embedding_dim: Embedding size. num_distributions: Number of categorical distributions for di... | stack_v2_sparse_classes_75kplus_train_000513 | 26,038 | permissive | [
{
"docstring": "Creates a neural net. Args: input_dim: Size of inputs embedding_dim: Embedding size. num_distributions: Number of categorical distributions for discrete embedding. return_sequences: Whether to return the entire sequence embedding.",
"name": "__init__",
"signature": "def __init__(self, in... | 2 | null | Implement the Python class `RNNEmbedNet` described below.
Class description:
An RNN embed network.
Method signatures and docstrings:
- def __init__(self, input_dim, embedding_dim, num_distributions=None, return_sequences=False): Creates a neural net. Args: input_dim: Size of inputs embedding_dim: Embedding size. num_... | Implement the Python class `RNNEmbedNet` described below.
Class description:
An RNN embed network.
Method signatures and docstrings:
- def __init__(self, input_dim, embedding_dim, num_distributions=None, return_sequences=False): Creates a neural net. Args: input_dim: Size of inputs embedding_dim: Embedding size. num_... | 5573d9c5822f4e866b6692769963ae819cb3f10d | <|skeleton|>
class RNNEmbedNet:
"""An RNN embed network."""
def __init__(self, input_dim, embedding_dim, num_distributions=None, return_sequences=False):
"""Creates a neural net. Args: input_dim: Size of inputs embedding_dim: Embedding size. num_distributions: Number of categorical distributions for di... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RNNEmbedNet:
"""An RNN embed network."""
def __init__(self, input_dim, embedding_dim, num_distributions=None, return_sequences=False):
"""Creates a neural net. Args: input_dim: Size of inputs embedding_dim: Embedding size. num_distributions: Number of categorical distributions for discrete embedd... | the_stack_v2_python_sparse | representation_batch_rl/representation_batch_rl/tf_utils.py | Jimmy-INL/google-research | train | 1 |
cba4696bc488650a83a6f7a0a0c4c33f1770df5e | [
"assert type(data) is list\nif len(data) > 1:\n self.images = torch.cat(tuple([data_set_data['images'] for data_set_data in data]), 0).to(device)\n self.ltr_targets = torch.cat(tuple([data_set_data['ltr_targets'] for data_set_data in data]), 0)[:, :-1].to(device)\n self.rtl_targets = torch.cat(tuple([data_... | <|body_start_0|>
assert type(data) is list
if len(data) > 1:
self.images = torch.cat(tuple([data_set_data['images'] for data_set_data in data]), 0).to(device)
self.ltr_targets = torch.cat(tuple([data_set_data['ltr_targets'] for data_set_data in data]), 0)[:, :-1].to(device)
... | Batch class, Contains all the attributes for one training iteration | Batch | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Batch:
"""Batch class, Contains all the attributes for one training iteration"""
def __init__(self, data, device, pad_id=0, bidirectional=False):
""":param data: list with dictionaries with all the data attributes for one training pass, each dict is from one dataset :param device: re... | stack_v2_sparse_classes_75kplus_train_000514 | 2,534 | no_license | [
{
"docstring": ":param data: list with dictionaries with all the data attributes for one training pass, each dict is from one dataset :param device: reference to GPU or CPU depending on the configurations :param: bidirectional: if True, decode sequence bidirectional :param pad_id: padding symbol id",
"name"... | 2 | stack_v2_sparse_classes_30k_train_023635 | Implement the Python class `Batch` described below.
Class description:
Batch class, Contains all the attributes for one training iteration
Method signatures and docstrings:
- def __init__(self, data, device, pad_id=0, bidirectional=False): :param data: list with dictionaries with all the data attributes for one train... | Implement the Python class `Batch` described below.
Class description:
Batch class, Contains all the attributes for one training iteration
Method signatures and docstrings:
- def __init__(self, data, device, pad_id=0, bidirectional=False): :param data: list with dictionaries with all the data attributes for one train... | ab83a47ef2e107dd7160ea0ca1832fa0531926b7 | <|skeleton|>
class Batch:
"""Batch class, Contains all the attributes for one training iteration"""
def __init__(self, data, device, pad_id=0, bidirectional=False):
""":param data: list with dictionaries with all the data attributes for one training pass, each dict is from one dataset :param device: re... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Batch:
"""Batch class, Contains all the attributes for one training iteration"""
def __init__(self, data, device, pad_id=0, bidirectional=False):
""":param data: list with dictionaries with all the data attributes for one training pass, each dict is from one dataset :param device: reference to GP... | the_stack_v2_python_sparse | src/Batch.py | MauritsBleeker/Bi-STET | train | 72 |
1cc6c3523ea81a79b4891fc77d4aaf639a93943a | [
"super().__init__()\nself.resnet = models.__dict__[arch](pretrained=pretrained)\nencoder_channels = get_channels(arch)\nself.center = DecoderBlock(encoder_channels[0], num_channels * 8)\nself.dec0 = DecoderBlock(num_in=encoder_channels[0] + num_channels * 8, num_out=num_channels * 8)\nself.dec1 = DecoderBlock(num_i... | <|body_start_0|>
super().__init__()
self.resnet = models.__dict__[arch](pretrained=pretrained)
encoder_channels = get_channels(arch)
self.center = DecoderBlock(encoder_channels[0], num_channels * 8)
self.dec0 = DecoderBlock(num_in=encoder_channels[0] + num_channels * 8, num_out=n... | U-Net inspired encoder-decoder architecture for semantic segmentation, with a ResNet encoder as proposed by Alexander Buslaev. Also known as AlbuNet | ResNetUnet | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResNetUnet:
"""U-Net inspired encoder-decoder architecture for semantic segmentation, with a ResNet encoder as proposed by Alexander Buslaev. Also known as AlbuNet"""
def __init__(self, num_classes=1, num_channels=32, arch='resnet18', pretrained=True):
"""Creates an `UNet` instance f... | stack_v2_sparse_classes_75kplus_train_000515 | 4,795 | permissive | [
{
"docstring": "Creates an `UNet` instance for semantic segmentation. Args: num_classes: number of classes to predict. pretrained: use ImageNet pre-trained backbone feature extractor",
"name": "__init__",
"signature": "def __init__(self, num_classes=1, num_channels=32, arch='resnet18', pretrained=True)"... | 2 | null | Implement the Python class `ResNetUnet` described below.
Class description:
U-Net inspired encoder-decoder architecture for semantic segmentation, with a ResNet encoder as proposed by Alexander Buslaev. Also known as AlbuNet
Method signatures and docstrings:
- def __init__(self, num_classes=1, num_channels=32, arch='... | Implement the Python class `ResNetUnet` described below.
Class description:
U-Net inspired encoder-decoder architecture for semantic segmentation, with a ResNet encoder as proposed by Alexander Buslaev. Also known as AlbuNet
Method signatures and docstrings:
- def __init__(self, num_classes=1, num_channels=32, arch='... | 5b989549942e6f03bda4c379b921a2b63a3c3805 | <|skeleton|>
class ResNetUnet:
"""U-Net inspired encoder-decoder architecture for semantic segmentation, with a ResNet encoder as proposed by Alexander Buslaev. Also known as AlbuNet"""
def __init__(self, num_classes=1, num_channels=32, arch='resnet18', pretrained=True):
"""Creates an `UNet` instance f... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ResNetUnet:
"""U-Net inspired encoder-decoder architecture for semantic segmentation, with a ResNet encoder as proposed by Alexander Buslaev. Also known as AlbuNet"""
def __init__(self, num_classes=1, num_channels=32, arch='resnet18', pretrained=True):
"""Creates an `UNet` instance for semantic s... | the_stack_v2_python_sparse | catalyst/contrib/models/segmentation/models/resnetunet.py | ternaus/catalyst | train | 3 |
801eff9a5b6ec3a64e28bec2504b0a0104b4e3cb | [
"flag = 0\nfor i in range(len(digits) - 1, -1, -1):\n if i == len(digits) - 1:\n flag, mod = divmod(digits[i] + 1 + flag, 10)\n digits[i] = mod\n elif flag == 0:\n return digits\n else:\n flag, mod = divmod(digits[i] + flag, 10)\n digits[i] = mod\nif flag == 1:\n digit... | <|body_start_0|>
flag = 0
for i in range(len(digits) - 1, -1, -1):
if i == len(digits) - 1:
flag, mod = divmod(digits[i] + 1 + flag, 10)
digits[i] = mod
elif flag == 0:
return digits
else:
flag, mod = div... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def plusOne(self, digits: List[int]) -> List[int]:
"""执行用时 :40 ms, 在所有 Python3 提交中击败了42.83%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了23.56%的用户 :param digits: :return:"""
<|body_0|>
def plusOne2(self, digits: List[int]) -> List[int]:
"""执行用时 :28 ms, 在所有 Python3 提... | stack_v2_sparse_classes_75kplus_train_000516 | 2,167 | no_license | [
{
"docstring": "执行用时 :40 ms, 在所有 Python3 提交中击败了42.83%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了23.56%的用户 :param digits: :return:",
"name": "plusOne",
"signature": "def plusOne(self, digits: List[int]) -> List[int]"
},
{
"docstring": "执行用时 :28 ms, 在所有 Python3 提交中击败了96.08%的用户 内存消耗 :13.5 MB, 在所有 Python3... | 2 | stack_v2_sparse_classes_30k_train_039201 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def plusOne(self, digits: List[int]) -> List[int]: 执行用时 :40 ms, 在所有 Python3 提交中击败了42.83%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了23.56%的用户 :param digits: :return:
- def plusOne2(self... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def plusOne(self, digits: List[int]) -> List[int]: 执行用时 :40 ms, 在所有 Python3 提交中击败了42.83%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了23.56%的用户 :param digits: :return:
- def plusOne2(self... | e43ee86c5a8cdb808da09b4b6138e10275abadb5 | <|skeleton|>
class Solution:
def plusOne(self, digits: List[int]) -> List[int]:
"""执行用时 :40 ms, 在所有 Python3 提交中击败了42.83%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了23.56%的用户 :param digits: :return:"""
<|body_0|>
def plusOne2(self, digits: List[int]) -> List[int]:
"""执行用时 :28 ms, 在所有 Python3 提... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def plusOne(self, digits: List[int]) -> List[int]:
"""执行用时 :40 ms, 在所有 Python3 提交中击败了42.83%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了23.56%的用户 :param digits: :return:"""
flag = 0
for i in range(len(digits) - 1, -1, -1):
if i == len(digits) - 1:
flag, mo... | the_stack_v2_python_sparse | LeetCode/数组/66. Plus One.py | yiming1012/MyLeetCode | train | 2 | |
8822bbcf1facb80731cc9c3f5bf5605c995ba5e4 | [
"self._implementations = []\nmisc.log(3, 'Start loading document reference resolver entry points ...')\nfor ep in pkg_resources.iter_entry_points(group=self.ADAPTER_ENTRY_POINT_GROUP):\n impl_cls = ep.load()\n regexp = re.compile(impl_cls.match_expression)\n misc.log(3, \" Loaded '%s' with priority %d\" %... | <|body_start_0|>
self._implementations = []
misc.log(3, 'Start loading document reference resolver entry points ...')
for ep in pkg_resources.iter_entry_points(group=self.ADAPTER_ENTRY_POINT_GROUP):
impl_cls = ep.load()
regexp = re.compile(impl_cls.match_expression)
... | _RegistryClass | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _RegistryClass:
def __init__(self):
"""Load all the defined entry points for resolver implementations, and store them in a list of pairs. The entry point names are interpreted as regular expressions, and matched against a documents 'erzeug_system' attribute. Implementation classes are ex... | stack_v2_sparse_classes_75kplus_train_000517 | 3,532 | no_license | [
{
"docstring": "Load all the defined entry points for resolver implementations, and store them in a list of pairs. The entry point names are interpreted as regular expressions, and matched against a documents 'erzeug_system' attribute. Implementation classes are expected to have a class attribute 'priority', th... | 2 | stack_v2_sparse_classes_30k_val_001332 | Implement the Python class `_RegistryClass` described below.
Class description:
Implement the _RegistryClass class.
Method signatures and docstrings:
- def __init__(self): Load all the defined entry points for resolver implementations, and store them in a list of pairs. The entry point names are interpreted as regula... | Implement the Python class `_RegistryClass` described below.
Class description:
Implement the _RegistryClass class.
Method signatures and docstrings:
- def __init__(self): Load all the defined entry points for resolver implementations, and store them in a list of pairs. The entry point names are interpreted as regula... | 6bc932c67bc8d93b873838ae6d9fb8d33c72234d | <|skeleton|>
class _RegistryClass:
def __init__(self):
"""Load all the defined entry points for resolver implementations, and store them in a list of pairs. The entry point names are interpreted as regular expressions, and matched against a documents 'erzeug_system' attribute. Implementation classes are ex... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _RegistryClass:
def __init__(self):
"""Load all the defined entry points for resolver implementations, and store them in a list of pairs. The entry point names are interpreted as regular expressions, and matched against a documents 'erzeug_system' attribute. Implementation classes are expected to have... | the_stack_v2_python_sparse | site-packages/cs.documents-15.2.3.7-py2.7.egg/cs/documents/docref_resolver_registry.py | prachipainuly-rbei/devops-poc | train | 0 | |
d96da2272bf09122951c566ed4b921391d2c1901 | [
"super(ZipEncFile, self).__init__(pathname, 'rb')\nself.compressor = bz2.BZ2Compressor()\nself.encryptor = Encryptor.new(key)\nself.buffer = buffer_size",
"if read_length is None:\n read_length = self.buffer_size\ndata = super(ZipEncFile, self).read(read_length)\ngot_length = len(data)\ndata = self.compressor.... | <|body_start_0|>
super(ZipEncFile, self).__init__(pathname, 'rb')
self.compressor = bz2.BZ2Compressor()
self.encryptor = Encryptor.new(key)
self.buffer = buffer_size
<|end_body_0|>
<|body_start_1|>
if read_length is None:
read_length = self.buffer_size
data =... | A generator for the zipped encrypted file | ZipEncFile | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZipEncFile:
"""A generator for the zipped encrypted file"""
def __init__(self, pathname, key, buffer_size=DEFAULT_BUFFER_LENGTH):
"""Initalizes the file object"""
<|body_0|>
def read(read_length=None):
"""Gets the next chunk of zipped, encrypted data."""
... | stack_v2_sparse_classes_75kplus_train_000518 | 1,879 | no_license | [
{
"docstring": "Initalizes the file object",
"name": "__init__",
"signature": "def __init__(self, pathname, key, buffer_size=DEFAULT_BUFFER_LENGTH)"
},
{
"docstring": "Gets the next chunk of zipped, encrypted data.",
"name": "read",
"signature": "def read(read_length=None)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003692 | Implement the Python class `ZipEncFile` described below.
Class description:
A generator for the zipped encrypted file
Method signatures and docstrings:
- def __init__(self, pathname, key, buffer_size=DEFAULT_BUFFER_LENGTH): Initalizes the file object
- def read(read_length=None): Gets the next chunk of zipped, encryp... | Implement the Python class `ZipEncFile` described below.
Class description:
A generator for the zipped encrypted file
Method signatures and docstrings:
- def __init__(self, pathname, key, buffer_size=DEFAULT_BUFFER_LENGTH): Initalizes the file object
- def read(read_length=None): Gets the next chunk of zipped, encryp... | a3da159883f205eec6e1af586ecbcc75187250f6 | <|skeleton|>
class ZipEncFile:
"""A generator for the zipped encrypted file"""
def __init__(self, pathname, key, buffer_size=DEFAULT_BUFFER_LENGTH):
"""Initalizes the file object"""
<|body_0|>
def read(read_length=None):
"""Gets the next chunk of zipped, encrypted data."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ZipEncFile:
"""A generator for the zipped encrypted file"""
def __init__(self, pathname, key, buffer_size=DEFAULT_BUFFER_LENGTH):
"""Initalizes the file object"""
super(ZipEncFile, self).__init__(pathname, 'rb')
self.compressor = bz2.BZ2Compressor()
self.encryptor = Encryp... | the_stack_v2_python_sparse | python/rdes.py | DanielCasner/scripts | train | 1 |
abccc51c178ec1f9a5e8af8e5c085c6faa882866 | [
"self.aoi = aoi\nself.ds = ds\nself.mask_value = mask_value\nself.fill_value = fill_value",
"import geopandas as gpd\nfrom downscale import utils\ngdf = gpd.read_file(self.aoi)\nshapes = [(geom, self.mask_value) for geom in gdf.geometry]\nds = self.ds.ds\ncoords = ds.coords\nreturn utils.rasterize(shapes, coords=... | <|body_start_0|>
self.aoi = aoi
self.ds = ds
self.mask_value = mask_value
self.fill_value = fill_value
<|end_body_0|>
<|body_start_1|>
import geopandas as gpd
from downscale import utils
gdf = gpd.read_file(self.aoi)
shapes = [(geom, self.mask_value) for ... | Mask | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Mask:
def __init__(self, aoi, ds, mask_value=1, fill_value=0, *args, **kwargs):
"""make a mask from a shapefile which is already in the CRS and domain of the input ds. ARGUMENTS: --------- aoi = [str] full read path of a shapefile with .shp extension ds = [downscale.Dataset] instance of ... | stack_v2_sparse_classes_75kplus_train_000519 | 6,957 | permissive | [
{
"docstring": "make a mask from a shapefile which is already in the CRS and domain of the input ds. ARGUMENTS: --------- aoi = [str] full read path of a shapefile with .shp extension ds = [downscale.Dataset] instance of file in a downscale.Dataset object mask_value = [int] value to use for masked areas. defaul... | 4 | stack_v2_sparse_classes_30k_train_001532 | Implement the Python class `Mask` described below.
Class description:
Implement the Mask class.
Method signatures and docstrings:
- def __init__(self, aoi, ds, mask_value=1, fill_value=0, *args, **kwargs): make a mask from a shapefile which is already in the CRS and domain of the input ds. ARGUMENTS: --------- aoi = ... | Implement the Python class `Mask` described below.
Class description:
Implement the Mask class.
Method signatures and docstrings:
- def __init__(self, aoi, ds, mask_value=1, fill_value=0, *args, **kwargs): make a mask from a shapefile which is already in the CRS and domain of the input ds. ARGUMENTS: --------- aoi = ... | 3fe8ea1774cf82149d19561ce5f19b25e6cba6fb | <|skeleton|>
class Mask:
def __init__(self, aoi, ds, mask_value=1, fill_value=0, *args, **kwargs):
"""make a mask from a shapefile which is already in the CRS and domain of the input ds. ARGUMENTS: --------- aoi = [str] full read path of a shapefile with .shp extension ds = [downscale.Dataset] instance of ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Mask:
def __init__(self, aoi, ds, mask_value=1, fill_value=0, *args, **kwargs):
"""make a mask from a shapefile which is already in the CRS and domain of the input ds. ARGUMENTS: --------- aoi = [str] full read path of a shapefile with .shp extension ds = [downscale.Dataset] instance of file in a down... | the_stack_v2_python_sparse | downscale/dataset.py | yusheng-wang/downscale | train | 0 | |
71e9d07b91e88bf355373d4e7c57a1f00d1666e0 | [
"super(GMM, self).setUp()\ndata_file = self.get_file('gmm_data.csv')\nself.frame = self.context.frame.import_csv(data_file, schema=[('x1', float), ('x2', float)])",
"model = self.context.models.clustering.gmm.train(self.frame, ['x1', 'x2'], column_scalings=[1.0, 1.0], k=5, max_iterations=500, seed=20, convergence... | <|body_start_0|>
super(GMM, self).setUp()
data_file = self.get_file('gmm_data.csv')
self.frame = self.context.frame.import_csv(data_file, schema=[('x1', float), ('x2', float)])
<|end_body_0|>
<|body_start_1|>
model = self.context.models.clustering.gmm.train(self.frame, ['x1', 'x2'], col... | GMM | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GMM:
def setUp(self):
"""Build test frame"""
<|body_0|>
def test_model_scoring(self):
"""Test publishing a gmm model"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(GMM, self).setUp()
data_file = self.get_file('gmm_data.csv')
s... | stack_v2_sparse_classes_75kplus_train_000520 | 2,125 | permissive | [
{
"docstring": "Build test frame",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test publishing a gmm model",
"name": "test_model_scoring",
"signature": "def test_model_scoring(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004343 | Implement the Python class `GMM` described below.
Class description:
Implement the GMM class.
Method signatures and docstrings:
- def setUp(self): Build test frame
- def test_model_scoring(self): Test publishing a gmm model | Implement the Python class `GMM` described below.
Class description:
Implement the GMM class.
Method signatures and docstrings:
- def setUp(self): Build test frame
- def test_model_scoring(self): Test publishing a gmm model
<|skeleton|>
class GMM:
def setUp(self):
"""Build test frame"""
<|body_0... | 5548fc925b5c278263cbdebbd9e8c7593320c2f4 | <|skeleton|>
class GMM:
def setUp(self):
"""Build test frame"""
<|body_0|>
def test_model_scoring(self):
"""Test publishing a gmm model"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GMM:
def setUp(self):
"""Build test frame"""
super(GMM, self).setUp()
data_file = self.get_file('gmm_data.csv')
self.frame = self.context.frame.import_csv(data_file, schema=[('x1', float), ('x2', float)])
def test_model_scoring(self):
"""Test publishing a gmm model... | the_stack_v2_python_sparse | regression-tests/sparktkregtests/testcases/scoretests/gmm_test.py | trustedanalytics/spark-tk | train | 35 | |
e23eeac4de68359f23c818f2a679502d36fc411d | [
"ch = unicode(ch)\nif ch in u'aAáÁàÀảẢãÃạẠăĂắẮằẰẳẲẵẴặẶâÂấẤầẦẩẨẫẪậẬ':\n return 'a'\nelif ch in u'eEéÉèÈẻẺẽẼẹẸêÊếẾềỀểỂễỄệỆ':\n return 'e'\nelif ch in u'iIíÍìÌỉỈĩĨịỊ':\n return 'i'\nelif ch in u'oOóÓòÒỏỎõÕọỌôÔốỐồỒổỔỗỖộỘơƠớỚờỜởỞỡỠợỢ':\n return 'o'\nelif ch in u'uUúÚùÙủỦũŨụỤưƯứỨừỪửỬữỮựỰ':\n return 'u'\nel... | <|body_start_0|>
ch = unicode(ch)
if ch in u'aAáÁàÀảẢãÃạẠăĂắẮằẰẳẲẵẴặẶâÂấẤầẦẩẨẫẪậẬ':
return 'a'
elif ch in u'eEéÉèÈẻẺẽẼẹẸêÊếẾềỀểỂễỄệỆ':
return 'e'
elif ch in u'iIíÍìÌỉỈĩĨịỊ':
return 'i'
elif ch in u'oOóÓòÒỏỎõÕọỌôÔốỐồỒổỔỗỖộỘơƠớỚờỜởỞỡỠợỢ':
... | VietnameseStemmer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VietnameseStemmer:
def _char_to_ascii(self, ch):
"""Convert a Vietnamese character into an ASCII character. Ignore all punctuation mark. The rest is converted to lower case character."""
<|body_0|>
def _lower(self, ch):
"""Convert a Vietnamese character into an ASCII... | stack_v2_sparse_classes_75kplus_train_000521 | 2,676 | no_license | [
{
"docstring": "Convert a Vietnamese character into an ASCII character. Ignore all punctuation mark. The rest is converted to lower case character.",
"name": "_char_to_ascii",
"signature": "def _char_to_ascii(self, ch)"
},
{
"docstring": "Convert a Vietnamese character into an ASCII character. I... | 3 | stack_v2_sparse_classes_30k_train_042623 | Implement the Python class `VietnameseStemmer` described below.
Class description:
Implement the VietnameseStemmer class.
Method signatures and docstrings:
- def _char_to_ascii(self, ch): Convert a Vietnamese character into an ASCII character. Ignore all punctuation mark. The rest is converted to lower case character... | Implement the Python class `VietnameseStemmer` described below.
Class description:
Implement the VietnameseStemmer class.
Method signatures and docstrings:
- def _char_to_ascii(self, ch): Convert a Vietnamese character into an ASCII character. Ignore all punctuation mark. The rest is converted to lower case character... | 0b47a435fbe5ab17a0e13a469c0957dd82272555 | <|skeleton|>
class VietnameseStemmer:
def _char_to_ascii(self, ch):
"""Convert a Vietnamese character into an ASCII character. Ignore all punctuation mark. The rest is converted to lower case character."""
<|body_0|>
def _lower(self, ch):
"""Convert a Vietnamese character into an ASCII... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VietnameseStemmer:
def _char_to_ascii(self, ch):
"""Convert a Vietnamese character into an ASCII character. Ignore all punctuation mark. The rest is converted to lower case character."""
ch = unicode(ch)
if ch in u'aAáÁàÀảẢãÃạẠăĂắẮằẰẳẲẵẴặẶâÂấẤầẦẩẨẫẪậẬ':
return 'a'
e... | the_stack_v2_python_sparse | app/recommender/vnstemmer.py | phamtm/feedreader | train | 1 | |
f8939f1f43a970a2f9b40f534e1a699429963c03 | [
"nc = []\nfor m in ObjectModel.objects.all():\n for c in m.connections:\n nc += [{'type': c.type.id, 'gender': c.gender, 'model': m.id, 'name': c.name}]\ncollection = ModelConnectionsCache._get_collection()\ncollection.drop()\nif nc:\n collection.insert(nc)",
"cache = {}\ncollection = ModelConnection... | <|body_start_0|>
nc = []
for m in ObjectModel.objects.all():
for c in m.connections:
nc += [{'type': c.type.id, 'gender': c.gender, 'model': m.id, 'name': c.name}]
collection = ModelConnectionsCache._get_collection()
collection.drop()
if nc:
... | ModelConnectionsCache | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelConnectionsCache:
def rebuild(cls):
"""Rebuild cache"""
<|body_0|>
def update_for_model(cls, model):
"""Update connection cache for object model :param model: ObjectModel instance :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
nc = []... | stack_v2_sparse_classes_75kplus_train_000522 | 11,129 | permissive | [
{
"docstring": "Rebuild cache",
"name": "rebuild",
"signature": "def rebuild(cls)"
},
{
"docstring": "Update connection cache for object model :param model: ObjectModel instance :return:",
"name": "update_for_model",
"signature": "def update_for_model(cls, model)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007437 | Implement the Python class `ModelConnectionsCache` described below.
Class description:
Implement the ModelConnectionsCache class.
Method signatures and docstrings:
- def rebuild(cls): Rebuild cache
- def update_for_model(cls, model): Update connection cache for object model :param model: ObjectModel instance :return: | Implement the Python class `ModelConnectionsCache` described below.
Class description:
Implement the ModelConnectionsCache class.
Method signatures and docstrings:
- def rebuild(cls): Rebuild cache
- def update_for_model(cls, model): Update connection cache for object model :param model: ObjectModel instance :return:... | aba08dc328296bb0e8e181c2ac9a766e1ec2a0bb | <|skeleton|>
class ModelConnectionsCache:
def rebuild(cls):
"""Rebuild cache"""
<|body_0|>
def update_for_model(cls, model):
"""Update connection cache for object model :param model: ObjectModel instance :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ModelConnectionsCache:
def rebuild(cls):
"""Rebuild cache"""
nc = []
for m in ObjectModel.objects.all():
for c in m.connections:
nc += [{'type': c.type.id, 'gender': c.gender, 'model': m.id, 'name': c.name}]
collection = ModelConnectionsCache._get_co... | the_stack_v2_python_sparse | inv/models/objectmodel.py | ewwwcha/noc | train | 1 | |
84adf396ea4c1347416bd2e09b75443cf0a09ee9 | [
"self.add_class('equation', 1, 'equation')\ncsv_path = os.path.join(dataset_dir, '{}.csv'.format(subset))\ndataset_dir = os.path.join(dataset_dir, subset)\nannotations = pd.read_csv(csv_path)\nfor filename in annotations['filename'].unique():\n image_path = os.path.join(dataset_dir, filename)\n img_annotation... | <|body_start_0|>
self.add_class('equation', 1, 'equation')
csv_path = os.path.join(dataset_dir, '{}.csv'.format(subset))
dataset_dir = os.path.join(dataset_dir, subset)
annotations = pd.read_csv(csv_path)
for filename in annotations['filename'].unique():
image_path = ... | EquationDataset | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EquationDataset:
def load_equation(self, dataset_dir, subset):
"""Load a subset of the equation dataset. dataset_dir: Root directory of the dataset. subset: Subset to load: train or val"""
<|body_0|>
def load_mask(self, image_id):
"""Generate instance masks for an im... | stack_v2_sparse_classes_75kplus_train_000523 | 12,723 | permissive | [
{
"docstring": "Load a subset of the equation dataset. dataset_dir: Root directory of the dataset. subset: Subset to load: train or val",
"name": "load_equation",
"signature": "def load_equation(self, dataset_dir, subset)"
},
{
"docstring": "Generate instance masks for an image. Returns: masks: ... | 3 | stack_v2_sparse_classes_30k_train_002388 | Implement the Python class `EquationDataset` described below.
Class description:
Implement the EquationDataset class.
Method signatures and docstrings:
- def load_equation(self, dataset_dir, subset): Load a subset of the equation dataset. dataset_dir: Root directory of the dataset. subset: Subset to load: train or va... | Implement the Python class `EquationDataset` described below.
Class description:
Implement the EquationDataset class.
Method signatures and docstrings:
- def load_equation(self, dataset_dir, subset): Load a subset of the equation dataset. dataset_dir: Root directory of the dataset. subset: Subset to load: train or va... | 62b65689ce39f6a3a89310a8d3c8c0e1eb5feb11 | <|skeleton|>
class EquationDataset:
def load_equation(self, dataset_dir, subset):
"""Load a subset of the equation dataset. dataset_dir: Root directory of the dataset. subset: Subset to load: train or val"""
<|body_0|>
def load_mask(self, image_id):
"""Generate instance masks for an im... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EquationDataset:
def load_equation(self, dataset_dir, subset):
"""Load a subset of the equation dataset. dataset_dir: Root directory of the dataset. subset: Subset to load: train or val"""
self.add_class('equation', 1, 'equation')
csv_path = os.path.join(dataset_dir, '{}.csv'.format(su... | the_stack_v2_python_sparse | equation_extraction/detection/equation.py | gaybro8777/automates | train | 0 | |
52199d5344bb74983cb53ee0493b9ae79490b3d4 | [
"username = request.user.get_username()\nserializer = RepoSerializer(username, repo_base, request)\nreturn Response(serializer.describe_repo(repo_name), status=status.HTTP_200_OK)",
"username = request.user.get_username()\nserializer = RepoSerializer(username, repo_base, request)\nserializer.delete_repo(repo_name... | <|body_start_0|>
username = request.user.get_username()
serializer = RepoSerializer(username, repo_base, request)
return Response(serializer.describe_repo(repo_name), status=status.HTTP_200_OK)
<|end_body_0|>
<|body_start_1|>
username = request.user.get_username()
serializer = R... | A specific repo of a specific user | Repo | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Repo:
"""A specific repo of a specific user"""
def get(self, request, repo_base, repo_name, format=None):
"""Views, tables, collaborators, and files in a repo"""
<|body_0|>
def delete(self, request, repo_base, repo_name, format=None):
"""Delete a repo"""
... | stack_v2_sparse_classes_75kplus_train_000524 | 31,465 | permissive | [
{
"docstring": "Views, tables, collaborators, and files in a repo",
"name": "get",
"signature": "def get(self, request, repo_base, repo_name, format=None)"
},
{
"docstring": "Delete a repo",
"name": "delete",
"signature": "def delete(self, request, repo_base, repo_name, format=None)"
}... | 3 | stack_v2_sparse_classes_30k_train_024072 | Implement the Python class `Repo` described below.
Class description:
A specific repo of a specific user
Method signatures and docstrings:
- def get(self, request, repo_base, repo_name, format=None): Views, tables, collaborators, and files in a repo
- def delete(self, request, repo_base, repo_name, format=None): Dele... | Implement the Python class `Repo` described below.
Class description:
A specific repo of a specific user
Method signatures and docstrings:
- def get(self, request, repo_base, repo_name, format=None): Views, tables, collaborators, and files in a repo
- def delete(self, request, repo_base, repo_name, format=None): Dele... | f066b472c2b66cc3b868bbe433aed2d4557aea32 | <|skeleton|>
class Repo:
"""A specific repo of a specific user"""
def get(self, request, repo_base, repo_name, format=None):
"""Views, tables, collaborators, and files in a repo"""
<|body_0|>
def delete(self, request, repo_base, repo_name, format=None):
"""Delete a repo"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Repo:
"""A specific repo of a specific user"""
def get(self, request, repo_base, repo_name, format=None):
"""Views, tables, collaborators, and files in a repo"""
username = request.user.get_username()
serializer = RepoSerializer(username, repo_base, request)
return Respons... | the_stack_v2_python_sparse | src/api/views.py | datahuborg/datahub | train | 199 |
242ddadff2462cae0287198508f13aa79ad3fef5 | [
"min_x = max_x = x\nmin_y = max_y = y\nfor x, row in enumerate(image):\n for y, pixel in enumerate(row):\n if pixel == '1':\n min_x = min(min_x, x)\n max_x = max(max_x, x)\n min_y = min(min_y, y)\n max_y = max(max_y, y)\nreturn (max_x - min_x + 1) * (max_y - min... | <|body_start_0|>
min_x = max_x = x
min_y = max_y = y
for x, row in enumerate(image):
for y, pixel in enumerate(row):
if pixel == '1':
min_x = min(min_x, x)
max_x = max(max_x, x)
min_y = min(min_y, y)
... | @param image: a binary matrix with '0' and '1' @param x: the location of one of the black pixels @param y: the location of one of the black pixels @return: an integer | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""@param image: a binary matrix with '0' and '1' @param x: the location of one of the black pixels @param y: the location of one of the black pixels @return: an integer"""
def minArea(self, image, x, y):
"""Naive -- scan entire matrix. This passes Lintcode, but is slower b... | stack_v2_sparse_classes_75kplus_train_000525 | 1,864 | no_license | [
{
"docstring": "Naive -- scan entire matrix. This passes Lintcode, but is slower because it will always search the entire matrix. O(N*M) runtime O(1) space",
"name": "minArea",
"signature": "def minArea(self, image, x, y)"
},
{
"docstring": "Here we do a DFS which uses more memory. However, we d... | 2 | stack_v2_sparse_classes_30k_train_025659 | Implement the Python class `Solution` described below.
Class description:
@param image: a binary matrix with '0' and '1' @param x: the location of one of the black pixels @param y: the location of one of the black pixels @return: an integer
Method signatures and docstrings:
- def minArea(self, image, x, y): Naive -- ... | Implement the Python class `Solution` described below.
Class description:
@param image: a binary matrix with '0' and '1' @param x: the location of one of the black pixels @param y: the location of one of the black pixels @return: an integer
Method signatures and docstrings:
- def minArea(self, image, x, y): Naive -- ... | f4cd43f082b58d4410008af49325770bc84d3aba | <|skeleton|>
class Solution:
"""@param image: a binary matrix with '0' and '1' @param x: the location of one of the black pixels @param y: the location of one of the black pixels @return: an integer"""
def minArea(self, image, x, y):
"""Naive -- scan entire matrix. This passes Lintcode, but is slower b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
"""@param image: a binary matrix with '0' and '1' @param x: the location of one of the black pixels @param y: the location of one of the black pixels @return: an integer"""
def minArea(self, image, x, y):
"""Naive -- scan entire matrix. This passes Lintcode, but is slower because it wil... | the_stack_v2_python_sparse | 302.Smallest_Rectangle_Enclosing_Black_Pixels.py | welsny/solutions | train | 1 |
ff2b93b3321e71baeffcc4c8d7604b882554c461 | [
"key = urllib.unquote(key or 'foobar')\ntry:\n f = files.open('/blobstore/%s' % key, 'r')\n text = f.read(100)\n f.close()\nexcept (files.InvalidFileNameError, files.FinalizationError):\n text = 'Not found'\noutput = webapp.template.render('files.html', {'text': text})\nself.response.out.write(output)",... | <|body_start_0|>
key = urllib.unquote(key or 'foobar')
try:
f = files.open('/blobstore/%s' % key, 'r')
text = f.read(100)
f.close()
except (files.InvalidFileNameError, files.FinalizationError):
text = 'Not found'
output = webapp.template.re... | Provides a tiny UI for reading or creating a file. | MainHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MainHandler:
"""Provides a tiny UI for reading or creating a file."""
def get(self, key):
"""Reads a stored file."""
<|body_0|>
def post(self, unused_key):
"""Creates a file from the posted data."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
k... | stack_v2_sparse_classes_75kplus_train_000526 | 1,862 | permissive | [
{
"docstring": "Reads a stored file.",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": "Creates a file from the posted data.",
"name": "post",
"signature": "def post(self, unused_key)"
}
] | 2 | null | Implement the Python class `MainHandler` described below.
Class description:
Provides a tiny UI for reading or creating a file.
Method signatures and docstrings:
- def get(self, key): Reads a stored file.
- def post(self, unused_key): Creates a file from the posted data. | Implement the Python class `MainHandler` described below.
Class description:
Provides a tiny UI for reading or creating a file.
Method signatures and docstrings:
- def get(self, key): Reads a stored file.
- def post(self, unused_key): Creates a file from the posted data.
<|skeleton|>
class MainHandler:
"""Provid... | fe31bcc7b21fc14f8aa97b36d66cd7671974543b | <|skeleton|>
class MainHandler:
"""Provides a tiny UI for reading or creating a file."""
def get(self, key):
"""Reads a stored file."""
<|body_0|>
def post(self, unused_key):
"""Creates a file from the posted data."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MainHandler:
"""Provides a tiny UI for reading or creating a file."""
def get(self, key):
"""Reads a stored file."""
key = urllib.unquote(key or 'foobar')
try:
f = files.open('/blobstore/%s' % key, 'r')
text = f.read(100)
f.close()
excep... | the_stack_v2_python_sparse | src/demo/src/demo/files.py | yejunzhou/typhoonae | train | 0 |
4b657313643cb3301f409c88dc9dac0586e25c3a | [
"uptime_str = uptime.split('uptime is ')[1]\nuptime_dict = process_uptime_string(uptime_str)\nself.years = uptime_dict['years']\nself.weeks = uptime_dict['weeks']\nself.days = uptime_dict['days']\nself.hours = uptime_dict['hours']\nself.minutes = uptime_dict['minutes']",
"s_in_minute = 60\ns_in_hour = 60 * s_in_m... | <|body_start_0|>
uptime_str = uptime.split('uptime is ')[1]
uptime_dict = process_uptime_string(uptime_str)
self.years = uptime_dict['years']
self.weeks = uptime_dict['weeks']
self.days = uptime_dict['days']
self.hours = uptime_dict['hours']
self.minutes = uptime_... | Uptime class | Uptime | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Uptime:
"""Uptime class"""
def __init__(self, uptime):
"""Creates Uptime object, takes uptime String as input"""
<|body_0|>
def uptime_in_seconds(self):
"""Return uptime in seconds"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
uptime_str = upt... | stack_v2_sparse_classes_75kplus_train_000527 | 2,111 | permissive | [
{
"docstring": "Creates Uptime object, takes uptime String as input",
"name": "__init__",
"signature": "def __init__(self, uptime)"
},
{
"docstring": "Return uptime in seconds",
"name": "uptime_in_seconds",
"signature": "def uptime_in_seconds(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007360 | Implement the Python class `Uptime` described below.
Class description:
Uptime class
Method signatures and docstrings:
- def __init__(self, uptime): Creates Uptime object, takes uptime String as input
- def uptime_in_seconds(self): Return uptime in seconds | Implement the Python class `Uptime` described below.
Class description:
Uptime class
Method signatures and docstrings:
- def __init__(self, uptime): Creates Uptime object, takes uptime String as input
- def uptime_in_seconds(self): Return uptime in seconds
<|skeleton|>
class Uptime:
"""Uptime class"""
def _... | eaa52cd58cd2f49e0d5e8ccec3795a1098b08f20 | <|skeleton|>
class Uptime:
"""Uptime class"""
def __init__(self, uptime):
"""Creates Uptime object, takes uptime String as input"""
<|body_0|>
def uptime_in_seconds(self):
"""Return uptime in seconds"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Uptime:
"""Uptime class"""
def __init__(self, uptime):
"""Creates Uptime object, takes uptime String as input"""
uptime_str = uptime.split('uptime is ')[1]
uptime_dict = process_uptime_string(uptime_str)
self.years = uptime_dict['years']
self.weeks = uptime_dict['w... | the_stack_v2_python_sparse | week9/Uptime.py | gerards/pynet_learning_python | train | 0 |
cbfa6916630fd9892a1d7e851b577c4e135d9678 | [
"if sample.forwardFq == None:\n raise ValueError('The sample has no forward fastq file!')\nif sample.forwardFq.hq == False:\n self._doQualityControlOnFile(sample.forwardFq)\nif sample.reversedFq != None and sample.reversedFq.hq == False:\n self._doQualityControlOnFile(sample.reversedFq)",
"inFile = file.... | <|body_start_0|>
if sample.forwardFq == None:
raise ValueError('The sample has no forward fastq file!')
if sample.forwardFq.hq == False:
self._doQualityControlOnFile(sample.forwardFq)
if sample.reversedFq != None and sample.reversedFq.hq == False:
self._doQual... | The class qualityControl regulates all processes which have to do with the quality control. | QualityControl | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QualityControl:
"""The class qualityControl regulates all processes which have to do with the quality control."""
def doQualityControl(self, sample):
"""The method doQualityControl executes the quality control on the raw data of the forward and reversed reads of the sample :param sam... | stack_v2_sparse_classes_75kplus_train_000528 | 1,649 | no_license | [
{
"docstring": "The method doQualityControl executes the quality control on the raw data of the forward and reversed reads of the sample :param sample: The sample where to do a quality control on :type sample: :py:class:`Sample.Sample` :raises: ValueError when the sample has no forward fastq file",
"name": ... | 2 | stack_v2_sparse_classes_30k_train_010066 | Implement the Python class `QualityControl` described below.
Class description:
The class qualityControl regulates all processes which have to do with the quality control.
Method signatures and docstrings:
- def doQualityControl(self, sample): The method doQualityControl executes the quality control on the raw data o... | Implement the Python class `QualityControl` described below.
Class description:
The class qualityControl regulates all processes which have to do with the quality control.
Method signatures and docstrings:
- def doQualityControl(self, sample): The method doQualityControl executes the quality control on the raw data o... | 2543f2bdb61fb07e2ee8ab76ffc930c13f0a4dbb | <|skeleton|>
class QualityControl:
"""The class qualityControl regulates all processes which have to do with the quality control."""
def doQualityControl(self, sample):
"""The method doQualityControl executes the quality control on the raw data of the forward and reversed reads of the sample :param sam... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class QualityControl:
"""The class qualityControl regulates all processes which have to do with the quality control."""
def doQualityControl(self, sample):
"""The method doQualityControl executes the quality control on the raw data of the forward and reversed reads of the sample :param sample: The samp... | the_stack_v2_python_sparse | pythonCodeBase/src/programs/QualityControl.py | VLPB/VLPB | train | 0 |
dee7f9da6b89c42093c87f9084e435cad8e42cac | [
"inv_sqrt_diagonal = gs.power(Matrices.diagonal(base_point), -2)\ntangent_vec_a_diagonal = Matrices.diagonal(tangent_vec_a)\ntangent_vec_b_diagonal = Matrices.diagonal(tangent_vec_b)\nprod = tangent_vec_a_diagonal * tangent_vec_b_diagonal * inv_sqrt_diagonal\nreturn gs.sum(prod, axis=-1)",
"sl_tagnet_vec_a = gs.t... | <|body_start_0|>
inv_sqrt_diagonal = gs.power(Matrices.diagonal(base_point), -2)
tangent_vec_a_diagonal = Matrices.diagonal(tangent_vec_a)
tangent_vec_b_diagonal = Matrices.diagonal(tangent_vec_b)
prod = tangent_vec_a_diagonal * tangent_vec_b_diagonal * inv_sqrt_diagonal
return g... | Class for Cholesky metric on Cholesky space. References ---------- .. [TP2019] . "Riemannian Geometry of Symmetric Positive Definite Matrices Via Cholesky Decomposition" SIAM journal on Matrix Analysis and Applications , 2019. https://arxiv.org/abs/1908.09326 | CholeskyMetric | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CholeskyMetric:
"""Class for Cholesky metric on Cholesky space. References ---------- .. [TP2019] . "Riemannian Geometry of Symmetric Positive Definite Matrices Via Cholesky Decomposition" SIAM journal on Matrix Analysis and Applications , 2019. https://arxiv.org/abs/1908.09326"""
def diag_i... | stack_v2_sparse_classes_75kplus_train_000529 | 11,271 | permissive | [
{
"docstring": "Compute the inner product using only diagonal elements. Parameters ---------- tangent_vec_a : array-like, shape=[..., n, n] Tangent vector at base point. tangent_vec_b : array-like, shape=[..., n, n] Tangent vector at base point. base_point : array-like, shape=[..., n, n] Base point. Returns ---... | 6 | stack_v2_sparse_classes_30k_train_042444 | Implement the Python class `CholeskyMetric` described below.
Class description:
Class for Cholesky metric on Cholesky space. References ---------- .. [TP2019] . "Riemannian Geometry of Symmetric Positive Definite Matrices Via Cholesky Decomposition" SIAM journal on Matrix Analysis and Applications , 2019. https://arxi... | Implement the Python class `CholeskyMetric` described below.
Class description:
Class for Cholesky metric on Cholesky space. References ---------- .. [TP2019] . "Riemannian Geometry of Symmetric Positive Definite Matrices Via Cholesky Decomposition" SIAM journal on Matrix Analysis and Applications , 2019. https://arxi... | 78a5778b5d5ce85225fd97e765d43047fb4526d1 | <|skeleton|>
class CholeskyMetric:
"""Class for Cholesky metric on Cholesky space. References ---------- .. [TP2019] . "Riemannian Geometry of Symmetric Positive Definite Matrices Via Cholesky Decomposition" SIAM journal on Matrix Analysis and Applications , 2019. https://arxiv.org/abs/1908.09326"""
def diag_i... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CholeskyMetric:
"""Class for Cholesky metric on Cholesky space. References ---------- .. [TP2019] . "Riemannian Geometry of Symmetric Positive Definite Matrices Via Cholesky Decomposition" SIAM journal on Matrix Analysis and Applications , 2019. https://arxiv.org/abs/1908.09326"""
def diag_inner_product(... | the_stack_v2_python_sparse | geomstats/geometry/positive_lower_triangular_matrices.py | geomstats/geomstats | train | 1,017 |
c2416feb1b79bd45f532ced59d9de7554f9e3b20 | [
"try:\n return_data = AutoMlCommon().update_conf_obj(nnid, request.data)\n return Response(json.dumps(return_data))\nexcept Exception as e:\n return_data = {'status': '404', 'result': str(e)}\n return Response(json.dumps(return_data))",
"try:\n return_data = AutoMlCommon().get_conf_obj(nnid)\n r... | <|body_start_0|>
try:
return_data = AutoMlCommon().update_conf_obj(nnid, request.data)
return Response(json.dumps(return_data))
except Exception as e:
return_data = {'status': '404', 'result': str(e)}
return Response(json.dumps(return_data))
<|end_body_0|>... | RunManagerAutoConf | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RunManagerAutoConf:
def post(self, request, nnid):
"""Manage hyperparameter for GA algorithm like eval, population, survive etc Structure : AutoML - NetID - NetVer(Auto Generated by GA) - NetBatch (auto generated on every batch) (1) Define AutoML Graph definition (2) Select Type of Data ... | stack_v2_sparse_classes_75kplus_train_000530 | 5,033 | permissive | [
{
"docstring": "Manage hyperparameter for GA algorithm like eval, population, survive etc Structure : AutoML - NetID - NetVer(Auto Generated by GA) - NetBatch (auto generated on every batch) (1) Define AutoML Graph definition (2) Select Type of Data (3) Select Type of Anal algorithm (4) Select range of hyper pa... | 4 | stack_v2_sparse_classes_30k_train_008708 | Implement the Python class `RunManagerAutoConf` described below.
Class description:
Implement the RunManagerAutoConf class.
Method signatures and docstrings:
- def post(self, request, nnid): Manage hyperparameter for GA algorithm like eval, population, survive etc Structure : AutoML - NetID - NetVer(Auto Generated by... | Implement the Python class `RunManagerAutoConf` described below.
Class description:
Implement the RunManagerAutoConf class.
Method signatures and docstrings:
- def post(self, request, nnid): Manage hyperparameter for GA algorithm like eval, population, survive etc Structure : AutoML - NetID - NetVer(Auto Generated by... | 6ad2fbc7384e4dbe7e3e63bdb44c8ce0387f4b7f | <|skeleton|>
class RunManagerAutoConf:
def post(self, request, nnid):
"""Manage hyperparameter for GA algorithm like eval, population, survive etc Structure : AutoML - NetID - NetVer(Auto Generated by GA) - NetBatch (auto generated on every batch) (1) Define AutoML Graph definition (2) Select Type of Data ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RunManagerAutoConf:
def post(self, request, nnid):
"""Manage hyperparameter for GA algorithm like eval, population, survive etc Structure : AutoML - NetID - NetVer(Auto Generated by GA) - NetBatch (auto generated on every batch) (1) Define AutoML Graph definition (2) Select Type of Data (3) Select Typ... | the_stack_v2_python_sparse | api/views/runmanager_auto_conf.py | yurimkoo/tensormsa | train | 1 | |
055975ecb12f592a556b0d36954bd4635e508b77 | [
"if len(points) >= 2 and points[0] != points[len(points) - 1]:\n raise Exception('start and end points different')\ntemp_xy = ()\nfor point in points:\n if len(point) != 2:\n raise Exception('error for point: ' + str(point))\n temp_xy += point\nself.layer = [layer]\nself.dataType = [dataType]\nself.... | <|body_start_0|>
if len(points) >= 2 and points[0] != points[len(points) - 1]:
raise Exception('start and end points different')
temp_xy = ()
for point in points:
if len(point) != 2:
raise Exception('error for point: ' + str(point))
temp_xy += ... | Boundary | [
"BSD-3-Clause",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Boundary:
def __init__(self, layer, dataType, points):
"""initialize Boundary object Parameters ---------- layer : int Layer id dataType : int Layer purpose points : array <- to be updated to numpy.array xy coordinates for Boundary object"""
<|body_0|>
def export(self, strea... | stack_v2_sparse_classes_75kplus_train_000531 | 9,146 | permissive | [
{
"docstring": "initialize Boundary object Parameters ---------- layer : int Layer id dataType : int Layer purpose points : array <- to be updated to numpy.array xy coordinates for Boundary object",
"name": "__init__",
"signature": "def __init__(self, layer, dataType, points)"
},
{
"docstring": ... | 2 | null | Implement the Python class `Boundary` described below.
Class description:
Implement the Boundary class.
Method signatures and docstrings:
- def __init__(self, layer, dataType, points): initialize Boundary object Parameters ---------- layer : int Layer id dataType : int Layer purpose points : array <- to be updated to... | Implement the Python class `Boundary` described below.
Class description:
Implement the Boundary class.
Method signatures and docstrings:
- def __init__(self, layer, dataType, points): initialize Boundary object Parameters ---------- layer : int Layer id dataType : int Layer purpose points : array <- to be updated to... | 86d795fd8e9c95b54dc80309a31bb1ad89e5c261 | <|skeleton|>
class Boundary:
def __init__(self, layer, dataType, points):
"""initialize Boundary object Parameters ---------- layer : int Layer id dataType : int Layer purpose points : array <- to be updated to numpy.array xy coordinates for Boundary object"""
<|body_0|>
def export(self, strea... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Boundary:
def __init__(self, layer, dataType, points):
"""initialize Boundary object Parameters ---------- layer : int Layer id dataType : int Layer purpose points : array <- to be updated to numpy.array xy coordinates for Boundary object"""
if len(points) >= 2 and points[0] != points[len(poin... | the_stack_v2_python_sparse | GDSIO.py | xyabc/laygo_obsolete | train | 0 | |
3fb5405ddb60ba27c48e8855d63b07ed7159714e | [
"windows = self.windows(conformer)\nif windows is None or len(windows) < self.topology.n_windows:\n return None\nwindows = np.array(windows)\ndiffs = list(abs(np.ediff1d(windows)))\nsorted_diffs = sorted(diffs, reverse=True)\nsplit = []\nfor x in range(self.topology.n_window_types - 1):\n i = diffs.index(sort... | <|body_start_0|>
windows = self.windows(conformer)
if windows is None or len(windows) < self.topology.n_windows:
return None
windows = np.array(windows)
diffs = list(abs(np.ediff1d(windows)))
sorted_diffs = sorted(diffs, reverse=True)
split = []
for x ... | Represents molecular cages constructed by ``stk``. | Cage | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Cage:
"""Represents molecular cages constructed by ``stk``."""
def window_difference(self, conformer=-1):
"""The average difference across window sizes. First take the average window difference between all windows of the same type. Then take the average of window differences across w... | stack_v2_sparse_classes_75kplus_train_000532 | 9,548 | permissive | [
{
"docstring": "The average difference across window sizes. First take the average window difference between all windows of the same type. Then take the average of window differences across window types. Consider a triangular-based prism cage topology. Such a cage will have triangular windows and square windows... | 3 | null | Implement the Python class `Cage` described below.
Class description:
Represents molecular cages constructed by ``stk``.
Method signatures and docstrings:
- def window_difference(self, conformer=-1): The average difference across window sizes. First take the average window difference between all windows of the same t... | Implement the Python class `Cage` described below.
Class description:
Represents molecular cages constructed by ``stk``.
Method signatures and docstrings:
- def window_difference(self, conformer=-1): The average difference across window sizes. First take the average window difference between all windows of the same t... | c85ce1f1874cf4bacf00bec7f77ceb7793600911 | <|skeleton|>
class Cage:
"""Represents molecular cages constructed by ``stk``."""
def window_difference(self, conformer=-1):
"""The average difference across window sizes. First take the average window difference between all windows of the same type. Then take the average of window differences across w... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Cage:
"""Represents molecular cages constructed by ``stk``."""
def window_difference(self, conformer=-1):
"""The average difference across window sizes. First take the average window difference between all windows of the same type. Then take the average of window differences across window types. ... | the_stack_v2_python_sparse | stk/molecular/molecules/cage.py | lucaspedroni/stk | train | 0 |
e462dafbe46b48d7a648886a7b36b339b194c53c | [
"super(HypergraphConv, self).__init__()\nself.filters = filters\nself.edges = edges\nself.lambda_conv = nn.Conv2d(in_channels=in_channels, out_channels=filters, kernel_size=[1, 1], stride=[1, 1])\nself.psi_conv = nn.Conv2d(in_channels=in_channels, out_channels=filters, kernel_size=[1, 1], stride=[1, 1])\nself.omega... | <|body_start_0|>
super(HypergraphConv, self).__init__()
self.filters = filters
self.edges = edges
self.lambda_conv = nn.Conv2d(in_channels=in_channels, out_channels=filters, kernel_size=[1, 1], stride=[1, 1])
self.psi_conv = nn.Conv2d(in_channels=in_channels, out_channels=filters... | HypergraphConv | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HypergraphConv:
def __init__(self, in_channels, out_channels, filters, edges, height, width):
""":param in_channels: :param out_channels: :param filters: Intermeditate channels for phi and lambda matrices - A Hyperparameter :param edges: hypergraph edges :param height: height of input te... | stack_v2_sparse_classes_75kplus_train_000533 | 4,208 | no_license | [
{
"docstring": ":param in_channels: :param out_channels: :param filters: Intermeditate channels for phi and lambda matrices - A Hyperparameter :param edges: hypergraph edges :param height: height of input tensor :param width: width of input tensor",
"name": "__init__",
"signature": "def __init__(self, i... | 2 | null | Implement the Python class `HypergraphConv` described below.
Class description:
Implement the HypergraphConv class.
Method signatures and docstrings:
- def __init__(self, in_channels, out_channels, filters, edges, height, width): :param in_channels: :param out_channels: :param filters: Intermeditate channels for phi ... | Implement the Python class `HypergraphConv` described below.
Class description:
Implement the HypergraphConv class.
Method signatures and docstrings:
- def __init__(self, in_channels, out_channels, filters, edges, height, width): :param in_channels: :param out_channels: :param filters: Intermeditate channels for phi ... | eb9325edb73208ea992eda4be2a92119be867d10 | <|skeleton|>
class HypergraphConv:
def __init__(self, in_channels, out_channels, filters, edges, height, width):
""":param in_channels: :param out_channels: :param filters: Intermeditate channels for phi and lambda matrices - A Hyperparameter :param edges: hypergraph edges :param height: height of input te... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HypergraphConv:
def __init__(self, in_channels, out_channels, filters, edges, height, width):
""":param in_channels: :param out_channels: :param filters: Intermeditate channels for phi and lambda matrices - A Hyperparameter :param edges: hypergraph edges :param height: height of input tensor :param wi... | the_stack_v2_python_sparse | base_model/base_blocks/hypergraph.py | Oorgien/Scene-Inpainting | train | 1 | |
d66dbd91c97592efce573d96bda173a64633dd57 | [
"super().__init__(canvas, tag, coords)\nself.canv = canvas\nself.wall_obj = self.canv.create_rectangle(0, 0, 0, 0, fill='saddle brown', outline='black')\nself.lines_of_walls_endings = []\nfor i in range(30, 150, 10):\n self.lines_of_walls_endings.append(self.canv.create_line(0, 0, 0, 0))\nself.roof_endings = sel... | <|body_start_0|>
super().__init__(canvas, tag, coords)
self.canv = canvas
self.wall_obj = self.canv.create_rectangle(0, 0, 0, 0, fill='saddle brown', outline='black')
self.lines_of_walls_endings = []
for i in range(30, 150, 10):
self.lines_of_walls_endings.append(self... | House | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class House:
def __init__(self, canvas, tag, coords):
"""Это класс дома. :param canvas: Холст, на котором рисуется игра. :param coords: координаты опроной точки. :param tag: тэг для обрщения."""
<|body_0|>
def image_self(self):
"""Рисует обьект. :return: None"""
<|... | stack_v2_sparse_classes_75kplus_train_000534 | 9,233 | no_license | [
{
"docstring": "Это класс дома. :param canvas: Холст, на котором рисуется игра. :param coords: координаты опроной точки. :param tag: тэг для обрщения.",
"name": "__init__",
"signature": "def __init__(self, canvas, tag, coords)"
},
{
"docstring": "Рисует обьект. :return: None",
"name": "image... | 5 | stack_v2_sparse_classes_30k_train_046400 | Implement the Python class `House` described below.
Class description:
Implement the House class.
Method signatures and docstrings:
- def __init__(self, canvas, tag, coords): Это класс дома. :param canvas: Холст, на котором рисуется игра. :param coords: координаты опроной точки. :param tag: тэг для обрщения.
- def im... | Implement the Python class `House` described below.
Class description:
Implement the House class.
Method signatures and docstrings:
- def __init__(self, canvas, tag, coords): Это класс дома. :param canvas: Холст, на котором рисуется игра. :param coords: координаты опроной точки. :param tag: тэг для обрщения.
- def im... | 87bba7e74f8e14b3c5ab12ea8879e0ae4599d059 | <|skeleton|>
class House:
def __init__(self, canvas, tag, coords):
"""Это класс дома. :param canvas: Холст, на котором рисуется игра. :param coords: координаты опроной точки. :param tag: тэг для обрщения."""
<|body_0|>
def image_self(self):
"""Рисует обьект. :return: None"""
<|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class House:
def __init__(self, canvas, tag, coords):
"""Это класс дома. :param canvas: Холст, на котором рисуется игра. :param coords: координаты опроной точки. :param tag: тэг для обрщения."""
super().__init__(canvas, tag, coords)
self.canv = canvas
self.wall_obj = self.canv.create... | the_stack_v2_python_sparse | Project/gameobjects.py | Ponamarev/Infa_2020_Ponamarev | train | 1 | |
023292b9fd8e567eb781900ff1ec017b0542fc97 | [
"logger.info('load trainset from %s' % path)\nmode = TaskMode.create_train()\nreturn self._parse_creator(path, mode)",
"logger.info('load testset from %s' % path)\nmode = TaskMode.create_test()\nreturn self._parse_creator(path, mode)",
"logger.info('load inferset from %s' % path)\nmode = TaskMode.create_infer()... | <|body_start_0|>
logger.info('load trainset from %s' % path)
mode = TaskMode.create_train()
return self._parse_creator(path, mode)
<|end_body_0|>
<|body_start_1|>
logger.info('load testset from %s' % path)
mode = TaskMode.create_test()
return self._parse_creator(path, mo... | Dataset | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dataset:
def train(self, path):
"""Load trainset."""
<|body_0|>
def test(self, path):
"""Load testset."""
<|body_1|>
def infer(self, path):
"""Load infer set."""
<|body_2|>
def _parse_creator(self, path, mode):
"""Parse datas... | stack_v2_sparse_classes_75kplus_train_000535 | 1,947 | permissive | [
{
"docstring": "Load trainset.",
"name": "train",
"signature": "def train(self, path)"
},
{
"docstring": "Load testset.",
"name": "test",
"signature": "def test(self, path)"
},
{
"docstring": "Load infer set.",
"name": "infer",
"signature": "def infer(self, path)"
},
... | 4 | stack_v2_sparse_classes_30k_train_029592 | Implement the Python class `Dataset` described below.
Class description:
Implement the Dataset class.
Method signatures and docstrings:
- def train(self, path): Load trainset.
- def test(self, path): Load testset.
- def infer(self, path): Load infer set.
- def _parse_creator(self, path, mode): Parse dataset. | Implement the Python class `Dataset` described below.
Class description:
Implement the Dataset class.
Method signatures and docstrings:
- def train(self, path): Load trainset.
- def test(self, path): Load testset.
- def infer(self, path): Load infer set.
- def _parse_creator(self, path, mode): Parse dataset.
<|skele... | 420527996b6da60ca401717a734329f126ed0680 | <|skeleton|>
class Dataset:
def train(self, path):
"""Load trainset."""
<|body_0|>
def test(self, path):
"""Load testset."""
<|body_1|>
def infer(self, path):
"""Load infer set."""
<|body_2|>
def _parse_creator(self, path, mode):
"""Parse datas... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Dataset:
def train(self, path):
"""Load trainset."""
logger.info('load trainset from %s' % path)
mode = TaskMode.create_train()
return self._parse_creator(path, mode)
def test(self, path):
"""Load testset."""
logger.info('load testset from %s' % path)
... | the_stack_v2_python_sparse | legacy/ctr/reader.py | chenbjin/models | train | 3 | |
70cd9a30802ceaed6a9d86439751e47dc6e6595a | [
"print('正在执行->>>用例:1.正确的用户名与密码')\npo = LoginPage(self.driver)\npo.Login_action('z87254091', 'z87254091')\nsleep(2)\nself.assertEqual(po.type_loginPass_hine(), '退出登录')\nfunction.insert_img(self.driver, '登陆成功.jpg')\nprint('用例:1.正确的用户名与密码->>>执行完毕')",
"print('正在执行->>>用例:2.错误的密码')\npo = LoginPage(self.driver)\npo.Logi... | <|body_start_0|>
print('正在执行->>>用例:1.正确的用户名与密码')
po = LoginPage(self.driver)
po.Login_action('z87254091', 'z87254091')
sleep(2)
self.assertEqual(po.type_loginPass_hine(), '退出登录')
function.insert_img(self.driver, '登陆成功.jpg')
print('用例:1.正确的用户名与密码->>>执行完毕')
<|end_bo... | LoginTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoginTest:
def test_login1_normal(self):
"""1.正确的用户名与密码"""
<|body_0|>
def test_login2_passwError(self):
"""2.错误的密码"""
<|body_1|>
def test_login3_empty(self):
"""3.帐号/密码为空"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
print('正在... | stack_v2_sparse_classes_75kplus_train_000536 | 1,580 | no_license | [
{
"docstring": "1.正确的用户名与密码",
"name": "test_login1_normal",
"signature": "def test_login1_normal(self)"
},
{
"docstring": "2.错误的密码",
"name": "test_login2_passwError",
"signature": "def test_login2_passwError(self)"
},
{
"docstring": "3.帐号/密码为空",
"name": "test_login3_empty",
... | 3 | stack_v2_sparse_classes_30k_train_046510 | Implement the Python class `LoginTest` described below.
Class description:
Implement the LoginTest class.
Method signatures and docstrings:
- def test_login1_normal(self): 1.正确的用户名与密码
- def test_login2_passwError(self): 2.错误的密码
- def test_login3_empty(self): 3.帐号/密码为空 | Implement the Python class `LoginTest` described below.
Class description:
Implement the LoginTest class.
Method signatures and docstrings:
- def test_login1_normal(self): 1.正确的用户名与密码
- def test_login2_passwError(self): 2.错误的密码
- def test_login3_empty(self): 3.帐号/密码为空
<|skeleton|>
class LoginTest:
def test_logi... | aa6e44838843e4e812094d33d94f4a4c4c7d8312 | <|skeleton|>
class LoginTest:
def test_login1_normal(self):
"""1.正确的用户名与密码"""
<|body_0|>
def test_login2_passwError(self):
"""2.错误的密码"""
<|body_1|>
def test_login3_empty(self):
"""3.帐号/密码为空"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LoginTest:
def test_login1_normal(self):
"""1.正确的用户名与密码"""
print('正在执行->>>用例:1.正确的用户名与密码')
po = LoginPage(self.driver)
po.Login_action('z87254091', 'z87254091')
sleep(2)
self.assertEqual(po.type_loginPass_hine(), '退出登录')
function.insert_img(self.driver, ... | the_stack_v2_python_sparse | MyTestProjects/Test_project/Website/test_case/test_login.py | chengzizhen/Airmcl_Test | train | 0 | |
1ad53a3561b9646ebf0821e18bf5bc24a4e09c10 | [
"process_dict = dict()\nfor key, value in request.GET.items():\n process_dict[key] = value\nali_sign = process_dict.pop('sign')\nalipay = AliPay(appid='2016091500518447', app_notify_url='http://47.106.173.70:8000/alipay/return/', app_private_key_path=PRIVATE_KEY_PATH, alipay_public_key_path=ALIPAY_KEY_PATH, debu... | <|body_start_0|>
process_dict = dict()
for key, value in request.GET.items():
process_dict[key] = value
ali_sign = process_dict.pop('sign')
alipay = AliPay(appid='2016091500518447', app_notify_url='http://47.106.173.70:8000/alipay/return/', app_private_key_path=PRIVATE_KEY_PA... | 处理支付宝返回信息 | AlipayView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlipayView:
"""处理支付宝返回信息"""
def get(self, request):
"""处理return_url"""
<|body_0|>
def post(self, request):
"""处理notify_url"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
process_dict = dict()
for key, value in request.GET.items():
... | stack_v2_sparse_classes_75kplus_train_000537 | 6,197 | no_license | [
{
"docstring": "处理return_url",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "处理notify_url",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | null | Implement the Python class `AlipayView` described below.
Class description:
处理支付宝返回信息
Method signatures and docstrings:
- def get(self, request): 处理return_url
- def post(self, request): 处理notify_url | Implement the Python class `AlipayView` described below.
Class description:
处理支付宝返回信息
Method signatures and docstrings:
- def get(self, request): 处理return_url
- def post(self, request): 处理notify_url
<|skeleton|>
class AlipayView:
"""处理支付宝返回信息"""
def get(self, request):
"""处理return_url"""
<|b... | faec1454cd5acb330eec827e6bf06c5f5f2fde73 | <|skeleton|>
class AlipayView:
"""处理支付宝返回信息"""
def get(self, request):
"""处理return_url"""
<|body_0|>
def post(self, request):
"""处理notify_url"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AlipayView:
"""处理支付宝返回信息"""
def get(self, request):
"""处理return_url"""
process_dict = dict()
for key, value in request.GET.items():
process_dict[key] = value
ali_sign = process_dict.pop('sign')
alipay = AliPay(appid='2016091500518447', app_notify_url='h... | the_stack_v2_python_sparse | apps/trade/views.py | zhangjihua1987/online-shop | train | 0 |
6ddbd4602c931287341eadd785150a27876a2091 | [
"url = '/v1/user/'\nresponse = APIClient().post(url, {'name': 'testuser1'})\nself.assertEqual(response.status_code, 201)",
"url = '/v1/user/'\nAPIClient().post(url, {'name': 'testuser1'})\nresponse = APIClient().post(url, {'name': 'testuser1'})\nself.assertEqual(response.status_code, 200)"
] | <|body_start_0|>
url = '/v1/user/'
response = APIClient().post(url, {'name': 'testuser1'})
self.assertEqual(response.status_code, 201)
<|end_body_0|>
<|body_start_1|>
url = '/v1/user/'
APIClient().post(url, {'name': 'testuser1'})
response = APIClient().post(url, {'name':... | PostUserTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PostUserTest:
def test_newuser_login(self):
"""Tests that a new user logs the application"""
<|body_0|>
def test_user_logsin_uniquely(self):
"""Tests whether who a user is uniquely created"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
url = '/v1/u... | stack_v2_sparse_classes_75kplus_train_000538 | 932 | no_license | [
{
"docstring": "Tests that a new user logs the application",
"name": "test_newuser_login",
"signature": "def test_newuser_login(self)"
},
{
"docstring": "Tests whether who a user is uniquely created",
"name": "test_user_logsin_uniquely",
"signature": "def test_user_logsin_uniquely(self)"... | 2 | stack_v2_sparse_classes_30k_train_053002 | Implement the Python class `PostUserTest` described below.
Class description:
Implement the PostUserTest class.
Method signatures and docstrings:
- def test_newuser_login(self): Tests that a new user logs the application
- def test_user_logsin_uniquely(self): Tests whether who a user is uniquely created | Implement the Python class `PostUserTest` described below.
Class description:
Implement the PostUserTest class.
Method signatures and docstrings:
- def test_newuser_login(self): Tests that a new user logs the application
- def test_user_logsin_uniquely(self): Tests whether who a user is uniquely created
<|skeleton|>... | 9fa8f3de1f353bcfd35b59eae3fac1cf4143fba7 | <|skeleton|>
class PostUserTest:
def test_newuser_login(self):
"""Tests that a new user logs the application"""
<|body_0|>
def test_user_logsin_uniquely(self):
"""Tests whether who a user is uniquely created"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PostUserTest:
def test_newuser_login(self):
"""Tests that a new user logs the application"""
url = '/v1/user/'
response = APIClient().post(url, {'name': 'testuser1'})
self.assertEqual(response.status_code, 201)
def test_user_logsin_uniquely(self):
"""Tests whether ... | the_stack_v2_python_sparse | api/users/tests.py | matthewacha/favorite-things | train | 0 | |
d570670ef3438853fd027c6afed722d616758858 | [
"if not pysnmp_installed:\n raise Exception(\"pysnmp is not installed. Please run 'pip install pysnmp' to use this feature\")\nself.host = host\nself.port = port\nself.read_community = read_community\nself.write_community = write_community\nif version == '1' or version == 1:\n self.mp_model = 0\nelse:\n se... | <|body_start_0|>
if not pysnmp_installed:
raise Exception("pysnmp is not installed. Please run 'pip install pysnmp' to use this feature")
self.host = host
self.port = port
self.read_community = read_community
self.write_community = write_community
if version =... | Implements SNMP client using pysnmp package provides two API's snmpget and snmpset Usage: cl = SNMPClient(host='10.104.233.42', port=161) cl = SNMPClient(host='10.104.233.42', read_community='public', write_community='private', version='2c', port=161, log=logging.getLogger(__name__)) # Get value cl.snmp_get(oid='1.3.6.... | SNMPClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SNMPClient:
"""Implements SNMP client using pysnmp package provides two API's snmpget and snmpset Usage: cl = SNMPClient(host='10.104.233.42', port=161) cl = SNMPClient(host='10.104.233.42', read_community='public', write_community='private', version='2c', port=161, log=logging.getLogger(__name__... | stack_v2_sparse_classes_75kplus_train_000539 | 10,886 | permissive | [
{
"docstring": "Instantiates snmp client",
"name": "__init__",
"signature": "def __init__(self, host, read_community='public', write_community='private', version='2c', port=161, log=log)"
},
{
"docstring": "Performs a SNMP get operation Usage: cl.snmp_get(oid='1.3.6.1.4.1.13742.6.4.1.2.1.2.1.16'... | 3 | null | Implement the Python class `SNMPClient` described below.
Class description:
Implements SNMP client using pysnmp package provides two API's snmpget and snmpset Usage: cl = SNMPClient(host='10.104.233.42', port=161) cl = SNMPClient(host='10.104.233.42', read_community='public', write_community='private', version='2c', p... | Implement the Python class `SNMPClient` described below.
Class description:
Implements SNMP client using pysnmp package provides two API's snmpget and snmpset Usage: cl = SNMPClient(host='10.104.233.42', port=161) cl = SNMPClient(host='10.104.233.42', read_community='public', write_community='private', version='2c', p... | e42e51475cddcb10f5c7814d0fe892ac865742ba | <|skeleton|>
class SNMPClient:
"""Implements SNMP client using pysnmp package provides two API's snmpget and snmpset Usage: cl = SNMPClient(host='10.104.233.42', port=161) cl = SNMPClient(host='10.104.233.42', read_community='public', write_community='private', version='2c', port=161, log=logging.getLogger(__name__... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SNMPClient:
"""Implements SNMP client using pysnmp package provides two API's snmpget and snmpset Usage: cl = SNMPClient(host='10.104.233.42', port=161) cl = SNMPClient(host='10.104.233.42', read_community='public', write_community='private', version='2c', port=161, log=logging.getLogger(__name__)) # Get valu... | the_stack_v2_python_sparse | pkgs/sdk-pkg/src/genie/libs/sdk/powercycler/snmp_client.py | CiscoTestAutomation/genielibs | train | 109 |
7432bb2d6f8bb21b90ee7612d0f056559147efa2 | [
"c = collections.Counter(nums)\nfirst, last = ({}, {})\nfor i, v in enumerate(nums):\n first.setdefault(v, i)\n last[v] = i\ndegree = max(c.values())\nreturn min((last[v] - first[v] + 1 for v in c if c[v] == degree))",
"nums_map, deg, min_len = (collections.defaultdict(list), 0, float('inf'))\nfor index, nu... | <|body_start_0|>
c = collections.Counter(nums)
first, last = ({}, {})
for i, v in enumerate(nums):
first.setdefault(v, i)
last[v] = i
degree = max(c.values())
return min((last[v] - first[v] + 1 for v in c if c[v] == degree))
<|end_body_0|>
<|body_start_1|... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findShortestSubArray(self, nums):
""":type nums: List[int] :rtype: int https://leetcode.com/problems/degree-of-an-array/discuss/108666/Python-easy-and-concise-solution beats 36.06%"""
<|body_0|>
def findShortestSubArray1(self, nums):
""":type nums: List... | stack_v2_sparse_classes_75kplus_train_000540 | 3,000 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int https://leetcode.com/problems/degree-of-an-array/discuss/108666/Python-easy-and-concise-solution beats 36.06%",
"name": "findShortestSubArray",
"signature": "def findShortestSubArray(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: i... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findShortestSubArray(self, nums): :type nums: List[int] :rtype: int https://leetcode.com/problems/degree-of-an-array/discuss/108666/Python-easy-and-concise-solution beats 36.... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findShortestSubArray(self, nums): :type nums: List[int] :rtype: int https://leetcode.com/problems/degree-of-an-array/discuss/108666/Python-easy-and-concise-solution beats 36.... | 7e0e917c15d3e35f49da3a00ef395bd5ff180d79 | <|skeleton|>
class Solution:
def findShortestSubArray(self, nums):
""":type nums: List[int] :rtype: int https://leetcode.com/problems/degree-of-an-array/discuss/108666/Python-easy-and-concise-solution beats 36.06%"""
<|body_0|>
def findShortestSubArray1(self, nums):
""":type nums: List... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def findShortestSubArray(self, nums):
""":type nums: List[int] :rtype: int https://leetcode.com/problems/degree-of-an-array/discuss/108666/Python-easy-and-concise-solution beats 36.06%"""
c = collections.Counter(nums)
first, last = ({}, {})
for i, v in enumerate(nums)... | the_stack_v2_python_sparse | LeetCode/697_degree_of_an_array.py | yao23/Machine_Learning_Playground | train | 12 | |
dd1d400cbdb513ee606c056056849027cd72d90f | [
"print(validated_data.keys())\nn_1 = np.sin(validated_data['angle_1']) / validated_data['length_1']\nn_2 = np.sin(validated_data['angle_2']) / validated_data['length_2']\nn_3 = np.sin(validated_data['angle_3']) / validated_data['length_3']\nprint(n_1, n_2, n_3)\nif (validated_data['angle_1'] + validated_data['angle... | <|body_start_0|>
print(validated_data.keys())
n_1 = np.sin(validated_data['angle_1']) / validated_data['length_1']
n_2 = np.sin(validated_data['angle_2']) / validated_data['length_2']
n_3 = np.sin(validated_data['angle_3']) / validated_data['length_3']
print(n_1, n_2, n_3)
... | TriangleSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TriangleSerializer:
def create(self, validated_data):
"""Create and return a new `Triangle` instance, given the validated data."""
<|body_0|>
def update(self, instance, validated_data):
"""Update and return an existing `Snippet` instance, given the validated data."""... | stack_v2_sparse_classes_75kplus_train_000541 | 4,642 | no_license | [
{
"docstring": "Create and return a new `Triangle` instance, given the validated data.",
"name": "create",
"signature": "def create(self, validated_data)"
},
{
"docstring": "Update and return an existing `Snippet` instance, given the validated data.",
"name": "update",
"signature": "def ... | 2 | stack_v2_sparse_classes_30k_train_003739 | Implement the Python class `TriangleSerializer` described below.
Class description:
Implement the TriangleSerializer class.
Method signatures and docstrings:
- def create(self, validated_data): Create and return a new `Triangle` instance, given the validated data.
- def update(self, instance, validated_data): Update ... | Implement the Python class `TriangleSerializer` described below.
Class description:
Implement the TriangleSerializer class.
Method signatures and docstrings:
- def create(self, validated_data): Create and return a new `Triangle` instance, given the validated data.
- def update(self, instance, validated_data): Update ... | c81c2450a2e37206dc24c9afd5f2c09dee0a8829 | <|skeleton|>
class TriangleSerializer:
def create(self, validated_data):
"""Create and return a new `Triangle` instance, given the validated data."""
<|body_0|>
def update(self, instance, validated_data):
"""Update and return an existing `Snippet` instance, given the validated data."""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TriangleSerializer:
def create(self, validated_data):
"""Create and return a new `Triangle` instance, given the validated data."""
print(validated_data.keys())
n_1 = np.sin(validated_data['angle_1']) / validated_data['length_1']
n_2 = np.sin(validated_data['angle_2']) / validat... | the_stack_v2_python_sparse | myAPIsite/shapeCRUD/serializers.py | tynlong/shapesAPI | train | 0 | |
331f7416945d6b97a1324bb0ba1a0fd076c18677 | [
"lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field\nlookup = self.kwargs.get(lookup_url_kwarg, None)\nif lookup is not None:\n return VideoUsers.objects.filter(video__hash_key=lookup).select_related('user', 'video').order_by('created_at')\nreturn VideoUsers.objects.none()",
"if self.request.method ... | <|body_start_0|>
lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field
lookup = self.kwargs.get(lookup_url_kwarg, None)
if lookup is not None:
return VideoUsers.objects.filter(video__hash_key=lookup).select_related('user', 'video').order_by('created_at')
return VideoU... | List all users of a video and add/invite new users. ## Reading ### Permissions * Only authenticated users can read this endpoint. * Only associated users can read this endpoint for a given video. ### Fields Reading this endpoint returns a list of VideoUser objects Name | Description | Type ----------------- | ---------... | VideoUserList | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VideoUserList:
"""List all users of a video and add/invite new users. ## Reading ### Permissions * Only authenticated users can read this endpoint. * Only associated users can read this endpoint for a given video. ### Fields Reading this endpoint returns a list of VideoUser objects Name | Descrip... | stack_v2_sparse_classes_75kplus_train_000542 | 40,640 | no_license | [
{
"docstring": "This view should return a list of all associated users of a video as determined by the lookup parameters of the view.",
"name": "get_queryset",
"signature": "def get_queryset(self)"
},
{
"docstring": "a POST request implies video user creation so return the serializer for video u... | 2 | stack_v2_sparse_classes_30k_test_000284 | Implement the Python class `VideoUserList` described below.
Class description:
List all users of a video and add/invite new users. ## Reading ### Permissions * Only authenticated users can read this endpoint. * Only associated users can read this endpoint for a given video. ### Fields Reading this endpoint returns a l... | Implement the Python class `VideoUserList` described below.
Class description:
List all users of a video and add/invite new users. ## Reading ### Permissions * Only authenticated users can read this endpoint. * Only associated users can read this endpoint for a given video. ### Fields Reading this endpoint returns a l... | 1f4b4cd74c9b4280437f73bdfef4491536194eeb | <|skeleton|>
class VideoUserList:
"""List all users of a video and add/invite new users. ## Reading ### Permissions * Only authenticated users can read this endpoint. * Only associated users can read this endpoint for a given video. ### Fields Reading this endpoint returns a list of VideoUser objects Name | Descrip... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VideoUserList:
"""List all users of a video and add/invite new users. ## Reading ### Permissions * Only authenticated users can read this endpoint. * Only associated users can read this endpoint for a given video. ### Fields Reading this endpoint returns a list of VideoUser objects Name | Description | Type -... | the_stack_v2_python_sparse | gravvy/apps/video/views.py | nceruchalu/gravvy-server | train | 1 |
5abe3ea4b8896ca7082c89be224152eec67140fb | [
"self.attempt_number = attempt_number\nself.delta_size_bytes = delta_size_bytes\nself.indexing_status = indexing_status\nself.is_app_consistent = is_app_consistent\nself.is_full_backup = is_full_backup\nself.job_run_id = job_run_id\nself.local_mount_path = local_mount_path\nself.logical_size_bytes = logical_size_by... | <|body_start_0|>
self.attempt_number = attempt_number
self.delta_size_bytes = delta_size_bytes
self.indexing_status = indexing_status
self.is_app_consistent = is_app_consistent
self.is_full_backup = is_full_backup
self.job_run_id = job_run_id
self.local_mount_path... | Implementation of the 'SnapshotVersion' model. Specifies information about snapshots of a backup object. Attributes: attempt_number (long|int): Specifies the number of the attempts made by the Job Run to capture a snapshot of the object. For example, if an snapshot is successfully captured after three attempts, this fi... | SnapshotVersion | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SnapshotVersion:
"""Implementation of the 'SnapshotVersion' model. Specifies information about snapshots of a backup object. Attributes: attempt_number (long|int): Specifies the number of the attempts made by the Job Run to capture a snapshot of the object. For example, if an snapshot is successf... | stack_v2_sparse_classes_75kplus_train_000543 | 7,459 | permissive | [
{
"docstring": "Constructor for the SnapshotVersion class",
"name": "__init__",
"signature": "def __init__(self, attempt_number=None, delta_size_bytes=None, indexing_status=None, is_app_consistent=None, is_full_backup=None, job_run_id=None, local_mount_path=None, logical_size_bytes=None, physical_size_b... | 2 | stack_v2_sparse_classes_30k_train_052259 | Implement the Python class `SnapshotVersion` described below.
Class description:
Implementation of the 'SnapshotVersion' model. Specifies information about snapshots of a backup object. Attributes: attempt_number (long|int): Specifies the number of the attempts made by the Job Run to capture a snapshot of the object. ... | Implement the Python class `SnapshotVersion` described below.
Class description:
Implementation of the 'SnapshotVersion' model. Specifies information about snapshots of a backup object. Attributes: attempt_number (long|int): Specifies the number of the attempts made by the Job Run to capture a snapshot of the object. ... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class SnapshotVersion:
"""Implementation of the 'SnapshotVersion' model. Specifies information about snapshots of a backup object. Attributes: attempt_number (long|int): Specifies the number of the attempts made by the Job Run to capture a snapshot of the object. For example, if an snapshot is successf... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SnapshotVersion:
"""Implementation of the 'SnapshotVersion' model. Specifies information about snapshots of a backup object. Attributes: attempt_number (long|int): Specifies the number of the attempts made by the Job Run to capture a snapshot of the object. For example, if an snapshot is successfully captured... | the_stack_v2_python_sparse | cohesity_management_sdk/models/snapshot_version.py | cohesity/management-sdk-python | train | 24 |
cecd1d3885345eaaa5338945449e39ab49cdf41e | [
"for entry in cls:\n if entry.value.name == category_name:\n return entry\nraise KeyError(category_name)",
"for entry in cls:\n if entry.value.code_prefix == prefix:\n return entry\nraise KeyError(prefix)"
] | <|body_start_0|>
for entry in cls:
if entry.value.name == category_name:
return entry
raise KeyError(category_name)
<|end_body_0|>
<|body_start_1|>
for entry in cls:
if entry.value.code_prefix == prefix:
return entry
raise KeyError... | All enuemrated error categories. | ErrorCategories | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ErrorCategories:
"""All enuemrated error categories."""
def by_category_name(cls, category_name: str) -> 'ErrorCategories':
"""Get a subsystem by its category name."""
<|body_0|>
def by_code_prefix(cls, prefix: str) -> 'ErrorCategories':
"""Get an error category ... | stack_v2_sparse_classes_75kplus_train_000544 | 1,687 | permissive | [
{
"docstring": "Get a subsystem by its category name.",
"name": "by_category_name",
"signature": "def by_category_name(cls, category_name: str) -> 'ErrorCategories'"
},
{
"docstring": "Get an error category by its code prefix.",
"name": "by_code_prefix",
"signature": "def by_code_prefix(... | 2 | stack_v2_sparse_classes_30k_train_011638 | Implement the Python class `ErrorCategories` described below.
Class description:
All enuemrated error categories.
Method signatures and docstrings:
- def by_category_name(cls, category_name: str) -> 'ErrorCategories': Get a subsystem by its category name.
- def by_code_prefix(cls, prefix: str) -> 'ErrorCategories': G... | Implement the Python class `ErrorCategories` described below.
Class description:
All enuemrated error categories.
Method signatures and docstrings:
- def by_category_name(cls, category_name: str) -> 'ErrorCategories': Get a subsystem by its category name.
- def by_code_prefix(cls, prefix: str) -> 'ErrorCategories': G... | 026b523c8c9e5d45910c490efb89194d72595be9 | <|skeleton|>
class ErrorCategories:
"""All enuemrated error categories."""
def by_category_name(cls, category_name: str) -> 'ErrorCategories':
"""Get a subsystem by its category name."""
<|body_0|>
def by_code_prefix(cls, prefix: str) -> 'ErrorCategories':
"""Get an error category ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ErrorCategories:
"""All enuemrated error categories."""
def by_category_name(cls, category_name: str) -> 'ErrorCategories':
"""Get a subsystem by its category name."""
for entry in cls:
if entry.value.name == category_name:
return entry
raise KeyError(c... | the_stack_v2_python_sparse | shared-data/python/opentrons_shared_data/errors/categories.py | Opentrons/opentrons | train | 326 |
bfebad2687654c768bd1efe34e8b52876bf1dda5 | [
"Algorithm.__init__(self)\nself.name = 'Adaptive Threshold'\nself.parent = 'Segmentation'\nself.blocksize = IntegerSlider('Threshold Blocksize', 1, 20, 1, 5)\nself.constant = IntegerSlider('Threshold Constant', -10, 10, 1, 2)\nself.integer_sliders.append(self.blocksize)\nself.integer_sliders.append(self.constant)",... | <|body_start_0|>
Algorithm.__init__(self)
self.name = 'Adaptive Threshold'
self.parent = 'Segmentation'
self.blocksize = IntegerSlider('Threshold Blocksize', 1, 20, 1, 5)
self.constant = IntegerSlider('Threshold Constant', -10, 10, 1, 2)
self.integer_sliders.append(self.b... | Adaptive threshold implementation. | AlgBody | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlgBody:
"""Adaptive threshold implementation."""
def __init__(self):
"""Instance vars: | *name* : name of the algorithm | *parent* : name of the appropriate category | *constant* : threshold constant [-10-10] | *blocksize* : threshold blocksize [3-23]"""
<|body_0|>
def ... | stack_v2_sparse_classes_75kplus_train_000545 | 2,316 | permissive | [
{
"docstring": "Instance vars: | *name* : name of the algorithm | *parent* : name of the appropriate category | *constant* : threshold constant [-10-10] | *blocksize* : threshold blocksize [3-23]",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Adaptive thresholding as ... | 2 | stack_v2_sparse_classes_30k_train_045522 | Implement the Python class `AlgBody` described below.
Class description:
Adaptive threshold implementation.
Method signatures and docstrings:
- def __init__(self): Instance vars: | *name* : name of the algorithm | *parent* : name of the appropriate category | *constant* : threshold constant [-10-10] | *blocksize* : t... | Implement the Python class `AlgBody` described below.
Class description:
Adaptive threshold implementation.
Method signatures and docstrings:
- def __init__(self): Instance vars: | *name* : name of the algorithm | *parent* : name of the appropriate category | *constant* : threshold constant [-10-10] | *blocksize* : t... | 0dc9becc09da22af3edac90b81b1dd9b1f44fd5b | <|skeleton|>
class AlgBody:
"""Adaptive threshold implementation."""
def __init__(self):
"""Instance vars: | *name* : name of the algorithm | *parent* : name of the appropriate category | *constant* : threshold constant [-10-10] | *blocksize* : threshold blocksize [3-23]"""
<|body_0|>
def ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AlgBody:
"""Adaptive threshold implementation."""
def __init__(self):
"""Instance vars: | *name* : name of the algorithm | *parent* : name of the appropriate category | *constant* : threshold constant [-10-10] | *blocksize* : threshold blocksize [3-23]"""
Algorithm.__init__(self)
... | the_stack_v2_python_sparse | nefi2/model/algorithms/adaptive.py | andreasfirczynski/NetworkExtractionFromImages | train | 0 |
25ad54205403765addf9fb4712a5b14539e39736 | [
"self.k = k\nself.heap = nums\nheapq.heapify(self.heap)\nwhile len(self.heap) > k:\n heapq.heappop(self.heap)",
"if len(self.heap) < self.k:\n heapq.heappush(self.heap, val)\nelif self.heap[0] < val:\n heapq.heapreplace(self.heap, val)\nreturn self.heap[0]"
] | <|body_start_0|>
self.k = k
self.heap = nums
heapq.heapify(self.heap)
while len(self.heap) > k:
heapq.heappop(self.heap)
<|end_body_0|>
<|body_start_1|>
if len(self.heap) < self.k:
heapq.heappush(self.heap, val)
elif self.heap[0] < val:
... | KthLargest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.k = k
self.heap = nums
heapq.heapify(... | stack_v2_sparse_classes_75kplus_train_000546 | 1,999 | no_license | [
{
"docstring": ":type k: int :type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, k, nums)"
},
{
"docstring": ":type val: int :rtype: int",
"name": "add",
"signature": "def add(self, val)"
}
] | 2 | stack_v2_sparse_classes_30k_train_023144 | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int
<|skeleton|>
class KthLargest:
def __init__(self, k, nu... | 1d1876620a55ff88af7bc390cf1a4fd4350d8d16 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
self.k = k
self.heap = nums
heapq.heapify(self.heap)
while len(self.heap) > k:
heapq.heappop(self.heap)
def add(self, val):
""":type val: int :rtype: int"""
... | the_stack_v2_python_sparse | 02-算法思想/设计/703.数据流中的第K大元素.py | jh-lau/leetcode_in_python | train | 0 | |
c658d481c662de00f32755621a63a882576e8b29 | [
"self.__vocab_list = []\nwith open(corpus_path, 'r', encoding='utf-8') as f:\n for line in f:\n self.__vocab_list.append(line.lower())",
"for foul_word in self.__vocab_list:\n foul_word = ''.join(foul_word.split())\n if foul_word in word:\n return True\nreturn False"
] | <|body_start_0|>
self.__vocab_list = []
with open(corpus_path, 'r', encoding='utf-8') as f:
for line in f:
self.__vocab_list.append(line.lower())
<|end_body_0|>
<|body_start_1|>
for foul_word in self.__vocab_list:
foul_word = ''.join(foul_word.split())
... | This class is dedicated to the loading and tracking of bad vocab, during the graph writing procedure. The class constructor loads the bad corpus from disk into main memory, and employs a 'check' method which returns True/False depending if an input word is considered Foul/NotFoul | BadVocab | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BadVocab:
"""This class is dedicated to the loading and tracking of bad vocab, during the graph writing procedure. The class constructor loads the bad corpus from disk into main memory, and employs a 'check' method which returns True/False depending if an input word is considered Foul/NotFoul"""
... | stack_v2_sparse_classes_75kplus_train_000547 | 6,830 | no_license | [
{
"docstring": "Constructor :param corpus_path: Foul language corpus file path",
"name": "__init__",
"signature": "def __init__(self, corpus_path)"
},
{
"docstring": "Check if a given word is contained in the foul language corpus :param word: Word for foul language check :return: True if input w... | 2 | stack_v2_sparse_classes_30k_train_047326 | Implement the Python class `BadVocab` described below.
Class description:
This class is dedicated to the loading and tracking of bad vocab, during the graph writing procedure. The class constructor loads the bad corpus from disk into main memory, and employs a 'check' method which returns True/False depending if an in... | Implement the Python class `BadVocab` described below.
Class description:
This class is dedicated to the loading and tracking of bad vocab, during the graph writing procedure. The class constructor loads the bad corpus from disk into main memory, and employs a 'check' method which returns True/False depending if an in... | 2177d43c75939a0c4906aa3761772365d4bf79e2 | <|skeleton|>
class BadVocab:
"""This class is dedicated to the loading and tracking of bad vocab, during the graph writing procedure. The class constructor loads the bad corpus from disk into main memory, and employs a 'check' method which returns True/False depending if an input word is considered Foul/NotFoul"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BadVocab:
"""This class is dedicated to the loading and tracking of bad vocab, during the graph writing procedure. The class constructor loads the bad corpus from disk into main memory, and employs a 'check' method which returns True/False depending if an input word is considered Foul/NotFoul"""
def __in... | the_stack_v2_python_sparse | streaming/src/graph/create_interface.py | eldrad294/ICS5114_Practical_Assignment | train | 0 |
013b6165b9870fd51b03f42109baa36b9e875e62 | [
"result = [0]\n\ndef find(nums, i, MIN, MAX, target):\n if i >= len(nums):\n return\n if min(MIN, nums[i]) + max(MAX, nums[i]) <= target:\n result[0] += 1\n find(nums, i + 1, min(MIN, nums[i]), max(MAX, nums[i]), target)\n find(nums, i + 1, MIN, MAX, target)\nMIN = target\nMAX = 0\nfind(nu... | <|body_start_0|>
result = [0]
def find(nums, i, MIN, MAX, target):
if i >= len(nums):
return
if min(MIN, nums[i]) + max(MAX, nums[i]) <= target:
result[0] += 1
find(nums, i + 1, min(MIN, nums[i]), max(MAX, nums[i]), target)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numSubseq(self, nums, target):
"""递归 :type nums: List[int] :type target: int :rtype: int"""
<|body_0|>
def numSubseq2(self, nums, target):
"""排序+递归+记忆化"""
<|body_1|>
def numSubseq3(self, nums, target):
"""排序+双指针"""
<|body_2|... | stack_v2_sparse_classes_75kplus_train_000548 | 2,560 | no_license | [
{
"docstring": "递归 :type nums: List[int] :type target: int :rtype: int",
"name": "numSubseq",
"signature": "def numSubseq(self, nums, target)"
},
{
"docstring": "排序+递归+记忆化",
"name": "numSubseq2",
"signature": "def numSubseq2(self, nums, target)"
},
{
"docstring": "排序+双指针",
"n... | 3 | stack_v2_sparse_classes_30k_train_006042 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSubseq(self, nums, target): 递归 :type nums: List[int] :type target: int :rtype: int
- def numSubseq2(self, nums, target): 排序+递归+记忆化
- def numSubseq3(self, nums, target): 排序... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSubseq(self, nums, target): 递归 :type nums: List[int] :type target: int :rtype: int
- def numSubseq2(self, nums, target): 排序+递归+记忆化
- def numSubseq3(self, nums, target): 排序... | 837957ea22aa07ce28a6c23ea0419bd2011e1f88 | <|skeleton|>
class Solution:
def numSubseq(self, nums, target):
"""递归 :type nums: List[int] :type target: int :rtype: int"""
<|body_0|>
def numSubseq2(self, nums, target):
"""排序+递归+记忆化"""
<|body_1|>
def numSubseq3(self, nums, target):
"""排序+双指针"""
<|body_2|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def numSubseq(self, nums, target):
"""递归 :type nums: List[int] :type target: int :rtype: int"""
result = [0]
def find(nums, i, MIN, MAX, target):
if i >= len(nums):
return
if min(MIN, nums[i]) + max(MAX, nums[i]) <= target:
... | the_stack_v2_python_sparse | 竞赛/195场/满足条件的子序列数目_M.py | 2226171237/Algorithmpractice | train | 0 | |
fbd3ec057eb4368497bda594cba1231aad6061ee | [
"spreadsheet_id = get_spreadsheet_id(config['spreadsheet_id'])\ntry:\n client = GoogleSheetsClient(config).authorize()\n spreadsheet = GoogleSheets(client, spreadsheet_id)\n check_result = ConnectionTest(spreadsheet).perform_connection_test()\n if check_result:\n return AirbyteConnectionStatus(st... | <|body_start_0|>
spreadsheet_id = get_spreadsheet_id(config['spreadsheet_id'])
try:
client = GoogleSheetsClient(config).authorize()
spreadsheet = GoogleSheets(client, spreadsheet_id)
check_result = ConnectionTest(spreadsheet).perform_connection_test()
if c... | DestinationGoogleSheets | [
"Apache-2.0",
"BSD-3-Clause",
"MIT",
"Elastic-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DestinationGoogleSheets:
def check(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> AirbyteConnectionStatus:
"""Connection check method for Google Spreadsheets. Info: Checks whether target spreadsheet_id is available using provided credentials. Returns: :: Status.SUCCEEDED - if... | stack_v2_sparse_classes_75kplus_train_000549 | 3,918 | permissive | [
{
"docstring": "Connection check method for Google Spreadsheets. Info: Checks whether target spreadsheet_id is available using provided credentials. Returns: :: Status.SUCCEEDED - if creadentials are valid, token is refreshed, target spreadsheet is available. :: Status.FAILED - if could not obtain new token, ta... | 2 | null | Implement the Python class `DestinationGoogleSheets` described below.
Class description:
Implement the DestinationGoogleSheets class.
Method signatures and docstrings:
- def check(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> AirbyteConnectionStatus: Connection check method for Google Spreadsheets. Info:... | Implement the Python class `DestinationGoogleSheets` described below.
Class description:
Implement the DestinationGoogleSheets class.
Method signatures and docstrings:
- def check(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> AirbyteConnectionStatus: Connection check method for Google Spreadsheets. Info:... | 8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6 | <|skeleton|>
class DestinationGoogleSheets:
def check(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> AirbyteConnectionStatus:
"""Connection check method for Google Spreadsheets. Info: Checks whether target spreadsheet_id is available using provided credentials. Returns: :: Status.SUCCEEDED - if... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DestinationGoogleSheets:
def check(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> AirbyteConnectionStatus:
"""Connection check method for Google Spreadsheets. Info: Checks whether target spreadsheet_id is available using provided credentials. Returns: :: Status.SUCCEEDED - if creadentials ... | the_stack_v2_python_sparse | dts/airbyte/airbyte-integrations/connectors/destination-google-sheets/destination_google_sheets/destination.py | alldatacenter/alldata | train | 774 | |
9acb35d05731e0efe0a60525ca61a257d982fb56 | [
"self.__client = Client(verify_ssl_cert=False)\nself.bearer_token = token\nOSM_COMPONENTS = os.environ.get('OSM_COMPONENTS')\nif OSM_COMPONENTS is None:\n print('NO OSM_COMPONENTS in ENV')\nelse:\n self.OSM_COMPONENTS = json.loads(OSM_COMPONENTS)",
"endpoint = '{}/osm/vnfpkgm/v1/vnf_packages'.format(self.OS... | <|body_start_0|>
self.__client = Client(verify_ssl_cert=False)
self.bearer_token = token
OSM_COMPONENTS = os.environ.get('OSM_COMPONENTS')
if OSM_COMPONENTS is None:
print('NO OSM_COMPONENTS in ENV')
else:
self.OSM_COMPONENTS = json.loads(OSM_COMPONENTS)
<... | VNF Descriptor Class. This class serves as a wrapper for the Virtual Network Function Descriptor (VNFD) part of the Northbound Interface (NBI) offered by OSM. The methods defined in this class help retrieve the VNFDs of OSM. Attributes: bearer_token (str): The OSM Authorization Token. Args: token (str): The OSM Authori... | Vnfd | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Vnfd:
"""VNF Descriptor Class. This class serves as a wrapper for the Virtual Network Function Descriptor (VNFD) part of the Northbound Interface (NBI) offered by OSM. The methods defined in this class help retrieve the VNFDs of OSM. Attributes: bearer_token (str): The OSM Authorization Token. Ar... | stack_v2_sparse_classes_75kplus_train_000550 | 3,322 | permissive | [
{
"docstring": "VNF Descriptor Class Constructor.",
"name": "__init__",
"signature": "def __init__(self, token)"
},
{
"docstring": "Fetch a list of the VNF descriptors. Returns: object: A requests object that includes the list of VNFDs Examples: >>> from nbiapi.identity import bearer_token >>> f... | 3 | null | Implement the Python class `Vnfd` described below.
Class description:
VNF Descriptor Class. This class serves as a wrapper for the Virtual Network Function Descriptor (VNFD) part of the Northbound Interface (NBI) offered by OSM. The methods defined in this class help retrieve the VNFDs of OSM. Attributes: bearer_token... | Implement the Python class `Vnfd` described below.
Class description:
VNF Descriptor Class. This class serves as a wrapper for the Virtual Network Function Descriptor (VNFD) part of the Northbound Interface (NBI) offered by OSM. The methods defined in this class help retrieve the VNFDs of OSM. Attributes: bearer_token... | a48a15d0190f20913cf313ca28e3daabb3753285 | <|skeleton|>
class Vnfd:
"""VNF Descriptor Class. This class serves as a wrapper for the Virtual Network Function Descriptor (VNFD) part of the Northbound Interface (NBI) offered by OSM. The methods defined in this class help retrieve the VNFDs of OSM. Attributes: bearer_token (str): The OSM Authorization Token. Ar... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Vnfd:
"""VNF Descriptor Class. This class serves as a wrapper for the Virtual Network Function Descriptor (VNFD) part of the Northbound Interface (NBI) offered by OSM. The methods defined in this class help retrieve the VNFDs of OSM. Attributes: bearer_token (str): The OSM Authorization Token. Args: token (st... | the_stack_v2_python_sparse | vnv_manager/app/api/management/commands/osm/nbiapi/vnfd.py | sonata-nfv/son-monitor | train | 5 |
2d9ea30849c73f779073d3bbf02547187151091d | [
"examples, metadata = tfds.load('ted_hrlr_translate/pt_to_en', with_info=True, as_supervised=True)\nself.data_train = examples['train']\nself.data_valid = examples['validation']\nself.tokenizer_pt, self.tokenizer_en = self.tokenize_dataset(self.data_train)\n\ndef filter_max_length(x, y, max_len=max_len):\n \"\"\... | <|body_start_0|>
examples, metadata = tfds.load('ted_hrlr_translate/pt_to_en', with_info=True, as_supervised=True)
self.data_train = examples['train']
self.data_valid = examples['validation']
self.tokenizer_pt, self.tokenizer_en = self.tokenize_dataset(self.data_train)
def filte... | Class that loads and preps a dataset for machine translation | Dataset | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dataset:
"""Class that loads and preps a dataset for machine translation"""
def __init__(self, batch_size, max_len):
"""Class constructor creates the instance attributes: data_train, which contains the ted_hrlr_translate/pt_to_en tf.data. Dataset train split, loaded as_supervided dat... | stack_v2_sparse_classes_75kplus_train_000551 | 4,978 | no_license | [
{
"docstring": "Class constructor creates the instance attributes: data_train, which contains the ted_hrlr_translate/pt_to_en tf.data. Dataset train split, loaded as_supervided data_valid, which contains the ted_hrlr_translate/pt_to_en tf.data. Dataset validate split, loaded as_supervided tokenizer_pt is the Po... | 4 | stack_v2_sparse_classes_30k_train_047211 | Implement the Python class `Dataset` described below.
Class description:
Class that loads and preps a dataset for machine translation
Method signatures and docstrings:
- def __init__(self, batch_size, max_len): Class constructor creates the instance attributes: data_train, which contains the ted_hrlr_translate/pt_to_... | Implement the Python class `Dataset` described below.
Class description:
Class that loads and preps a dataset for machine translation
Method signatures and docstrings:
- def __init__(self, batch_size, max_len): Class constructor creates the instance attributes: data_train, which contains the ted_hrlr_translate/pt_to_... | e8a98d85b3bfd5665cb04bec9ee8c3eb23d6bd58 | <|skeleton|>
class Dataset:
"""Class that loads and preps a dataset for machine translation"""
def __init__(self, batch_size, max_len):
"""Class constructor creates the instance attributes: data_train, which contains the ted_hrlr_translate/pt_to_en tf.data. Dataset train split, loaded as_supervided dat... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Dataset:
"""Class that loads and preps a dataset for machine translation"""
def __init__(self, batch_size, max_len):
"""Class constructor creates the instance attributes: data_train, which contains the ted_hrlr_translate/pt_to_en tf.data. Dataset train split, loaded as_supervided data_valid, whic... | the_stack_v2_python_sparse | supervised_learning/0x12-transformer_apps/3-dataset.py | AndrewMiranda/holbertonschool-machine_learning-1 | train | 0 |
1f456ac1610c398b48d1fa74d4dcfe20b0b1f539 | [
"if a < b:\n a, b = (b, a)\nwhile True:\n c = a % b\n if c != 0:\n a, b = (b, c)\n else:\n break\nreturn b",
"if a < b:\n a, b = (b, a)\nif a % b == 0:\n return b\nelse:\n return self.divisor2(b, a % b)",
"if a < b:\n a, b = (b, a)\nif a - b == 0:\n return b\nelse:\n ... | <|body_start_0|>
if a < b:
a, b = (b, a)
while True:
c = a % b
if c != 0:
a, b = (b, c)
else:
break
return b
<|end_body_0|>
<|body_start_1|>
if a < b:
a, b = (b, a)
if a % b == 0:
... | 求最大公约数 1、辗转相除法(欧几里得算法)基于一个定理。两个正整数a和b(a>b),它们的最大公约数等于a和b的余数c 与b之间的最大公约数 时间复杂度:近似为O(log(max(a, b))) 问题:当a和b过大时,取模运算性能变差 2、更相减损术 两个正整数a和b(a>b),它们的最大公约数等于a和b的差c 与b之间的最大公约数 时间复杂度:最差O(max(a,b)) 问题:当a和b相差太大,运算次数过多 3、辗转相除法与更相减损术结合 时间复杂度O(log(max(a,b))) | GreatestCommonDivisor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GreatestCommonDivisor:
"""求最大公约数 1、辗转相除法(欧几里得算法)基于一个定理。两个正整数a和b(a>b),它们的最大公约数等于a和b的余数c 与b之间的最大公约数 时间复杂度:近似为O(log(max(a, b))) 问题:当a和b过大时,取模运算性能变差 2、更相减损术 两个正整数a和b(a>b),它们的最大公约数等于a和b的差c 与b之间的最大公约数 时间复杂度:最差O(max(a,b)) 问题:当a和b相差太大,运算次数过多 3、辗转相除法与更相减损术结合 时间复杂度O(log(max(a,b)))"""
def divisor(a, b)... | stack_v2_sparse_classes_75kplus_train_000552 | 4,308 | no_license | [
{
"docstring": "辗转相除法(欧几里得算法)",
"name": "divisor",
"signature": "def divisor(a, b)"
},
{
"docstring": "辗转相除法(欧几里得算法)基于一个定理。两个正整数a和b(a>b),它们的最大公约数等于a和b的余数c 与b之间的最大公约数",
"name": "divisor2",
"signature": "def divisor2(self, a, b)"
},
{
"docstring": "更相减损术 两个正整数a和b(a>b),它们的最大公约数等于a和b... | 4 | stack_v2_sparse_classes_30k_train_026139 | Implement the Python class `GreatestCommonDivisor` described below.
Class description:
求最大公约数 1、辗转相除法(欧几里得算法)基于一个定理。两个正整数a和b(a>b),它们的最大公约数等于a和b的余数c 与b之间的最大公约数 时间复杂度:近似为O(log(max(a, b))) 问题:当a和b过大时,取模运算性能变差 2、更相减损术 两个正整数a和b(a>b),它们的最大公约数等于a和b的差c 与b之间的最大公约数 时间复杂度:最差O(max(a,b)) 问题:当a和b相差太大,运算次数过多 3、辗转相除法与更相减损术结合 时间复杂度O(l... | Implement the Python class `GreatestCommonDivisor` described below.
Class description:
求最大公约数 1、辗转相除法(欧几里得算法)基于一个定理。两个正整数a和b(a>b),它们的最大公约数等于a和b的余数c 与b之间的最大公约数 时间复杂度:近似为O(log(max(a, b))) 问题:当a和b过大时,取模运算性能变差 2、更相减损术 两个正整数a和b(a>b),它们的最大公约数等于a和b的差c 与b之间的最大公约数 时间复杂度:最差O(max(a,b)) 问题:当a和b相差太大,运算次数过多 3、辗转相除法与更相减损术结合 时间复杂度O(l... | 0779cdbe3a8a7b828e47cfb8a830c56f72e015c7 | <|skeleton|>
class GreatestCommonDivisor:
"""求最大公约数 1、辗转相除法(欧几里得算法)基于一个定理。两个正整数a和b(a>b),它们的最大公约数等于a和b的余数c 与b之间的最大公约数 时间复杂度:近似为O(log(max(a, b))) 问题:当a和b过大时,取模运算性能变差 2、更相减损术 两个正整数a和b(a>b),它们的最大公约数等于a和b的差c 与b之间的最大公约数 时间复杂度:最差O(max(a,b)) 问题:当a和b相差太大,运算次数过多 3、辗转相除法与更相减损术结合 时间复杂度O(log(max(a,b)))"""
def divisor(a, b)... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GreatestCommonDivisor:
"""求最大公约数 1、辗转相除法(欧几里得算法)基于一个定理。两个正整数a和b(a>b),它们的最大公约数等于a和b的余数c 与b之间的最大公约数 时间复杂度:近似为O(log(max(a, b))) 问题:当a和b过大时,取模运算性能变差 2、更相减损术 两个正整数a和b(a>b),它们的最大公约数等于a和b的差c 与b之间的最大公约数 时间复杂度:最差O(max(a,b)) 问题:当a和b相差太大,运算次数过多 3、辗转相除法与更相减损术结合 时间复杂度O(log(max(a,b)))"""
def divisor(a, b):
"""... | the_stack_v2_python_sparse | base_test/sort/exercise.py | huanmengmie/python_study | train | 0 |
9bb59affcaf8b62f0459e74e07a828cac9e0da3a | [
"try:\n import puremagic\n clazz._log.log_d(f'\"import puremagic\" succeeds')\n return True\nexcept ModuleNotFoundError as ex:\n clazz._log.log_d(f'puremagic module not found')\n pass\nreturn False",
"filename = bf_check.check_file(filename)\nimport puremagic\ntry:\n rv = puremagic.magic_file(fi... | <|body_start_0|>
try:
import puremagic
clazz._log.log_d(f'"import puremagic" succeeds')
return True
except ModuleNotFoundError as ex:
clazz._log.log_d(f'puremagic module not found')
pass
return False
<|end_body_0|>
<|body_start_1|>
... | _bf_mime_type_detector_puremagic | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _bf_mime_type_detector_puremagic:
def is_supported(clazz):
"""Return True if this class is supported on the current platform."""
<|body_0|>
def detect_mime_type(clazz, filename):
"""Detect the mime type for file."""
<|body_1|>
def _find_mime_type(clazz, ... | stack_v2_sparse_classes_75kplus_train_000553 | 1,494 | permissive | [
{
"docstring": "Return True if this class is supported on the current platform.",
"name": "is_supported",
"signature": "def is_supported(clazz)"
},
{
"docstring": "Detect the mime type for file.",
"name": "detect_mime_type",
"signature": "def detect_mime_type(clazz, filename)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_030030 | Implement the Python class `_bf_mime_type_detector_puremagic` described below.
Class description:
Implement the _bf_mime_type_detector_puremagic class.
Method signatures and docstrings:
- def is_supported(clazz): Return True if this class is supported on the current platform.
- def detect_mime_type(clazz, filename): ... | Implement the Python class `_bf_mime_type_detector_puremagic` described below.
Class description:
Implement the _bf_mime_type_detector_puremagic class.
Method signatures and docstrings:
- def is_supported(clazz): Return True if this class is supported on the current platform.
- def detect_mime_type(clazz, filename): ... | b9dd35b518848cea82e43d5016e425cc7dac32e5 | <|skeleton|>
class _bf_mime_type_detector_puremagic:
def is_supported(clazz):
"""Return True if this class is supported on the current platform."""
<|body_0|>
def detect_mime_type(clazz, filename):
"""Detect the mime type for file."""
<|body_1|>
def _find_mime_type(clazz, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _bf_mime_type_detector_puremagic:
def is_supported(clazz):
"""Return True if this class is supported on the current platform."""
try:
import puremagic
clazz._log.log_d(f'"import puremagic" succeeds')
return True
except ModuleNotFoundError as ex:
... | the_stack_v2_python_sparse | lib/bes/files/mime/_detail/_bf_mime_type_detector_puremagic.py | reconstruir/bes | train | 0 | |
07bb56677c0d05ef476e9fd344774bcc54542634 | [
"if self.account_sid == '':\n self.error_message = 'VoiceVerify(RongLian) Error: account_sid is empty'\nelif self.auth_token == '':\n self.error_message = 'VoiceVerify(RongLian) Error: auth_token is empty'\nelif self.app_id == '':\n self.error_message = 'VoiceVerify(RongLian) Error: app_id is empty'\nelif ... | <|body_start_0|>
if self.account_sid == '':
self.error_message = 'VoiceVerify(RongLian) Error: account_sid is empty'
elif self.auth_token == '':
self.error_message = 'VoiceVerify(RongLian) Error: auth_token is empty'
elif self.app_id == '':
self.error_message ... | RonglianVoiceVerify | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RonglianVoiceVerify:
def __init__(self):
"""check voice-verify service parameters from config.py"""
<|body_0|>
def send_voice_verify(self, receiver, content):
"""Send voice_verify through RongLian_YunTongXun service Example: XXX.send_voice_verify_by_RongLian("1821751... | stack_v2_sparse_classes_75kplus_train_000554 | 22,148 | permissive | [
{
"docstring": "check voice-verify service parameters from config.py",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Send voice_verify through RongLian_YunTongXun service Example: XXX.send_voice_verify_by_RongLian(\"18217511111\", \"1849\") :type receiver: str|unicode ... | 3 | stack_v2_sparse_classes_30k_train_026496 | Implement the Python class `RonglianVoiceVerify` described below.
Class description:
Implement the RonglianVoiceVerify class.
Method signatures and docstrings:
- def __init__(self): check voice-verify service parameters from config.py
- def send_voice_verify(self, receiver, content): Send voice_verify through RongLia... | Implement the Python class `RonglianVoiceVerify` described below.
Class description:
Implement the RonglianVoiceVerify class.
Method signatures and docstrings:
- def __init__(self): check voice-verify service parameters from config.py
- def send_voice_verify(self, receiver, content): Send voice_verify through RongLia... | 945c4fd2755f5b0dea11e54eb649eeb37ec93d01 | <|skeleton|>
class RonglianVoiceVerify:
def __init__(self):
"""check voice-verify service parameters from config.py"""
<|body_0|>
def send_voice_verify(self, receiver, content):
"""Send voice_verify through RongLian_YunTongXun service Example: XXX.send_voice_verify_by_RongLian("1821751... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RonglianVoiceVerify:
def __init__(self):
"""check voice-verify service parameters from config.py"""
if self.account_sid == '':
self.error_message = 'VoiceVerify(RongLian) Error: account_sid is empty'
elif self.auth_token == '':
self.error_message = 'VoiceVerify(... | the_stack_v2_python_sparse | open-hackathon-server/src/hackathon/util.py | kaiyuanshe/open-hackathon | train | 46 | |
6153c97677bfd623b439f3de6e68e3af01962ac3 | [
"errors = []\nif not HAS_TTP:\n errors.append(missing_required_lib('ttp'))\nreturn {'errors': errors}",
"cli_output = to_native(self._task_args.get('text'), errors='surrogate_then_replace')\nres = self._check_reqs()\nif res.get('errors'):\n return {'errors': res.get('errors')}\ntemplate_path = to_native(sel... | <|body_start_0|>
errors = []
if not HAS_TTP:
errors.append(missing_required_lib('ttp'))
return {'errors': errors}
<|end_body_0|>
<|body_start_1|>
cli_output = to_native(self._task_args.get('text'), errors='surrogate_then_replace')
res = self._check_reqs()
if ... | The ttp parser class Convert raw text to structured data using ttp | CliParser | [
"GPL-3.0-only",
"LicenseRef-scancode-unknown-license-reference",
"GPL-3.0-or-later",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CliParser:
"""The ttp parser class Convert raw text to structured data using ttp"""
def _check_reqs():
"""Check the prerequisites for the ttp parser :return dict: A dict with errors or a template_path"""
<|body_0|>
def parse(self, *_args, **_kwargs):
"""Std entry... | stack_v2_sparse_classes_75kplus_train_000555 | 3,930 | permissive | [
{
"docstring": "Check the prerequisites for the ttp parser :return dict: A dict with errors or a template_path",
"name": "_check_reqs",
"signature": "def _check_reqs()"
},
{
"docstring": "Std entry point for a cli_parse parse execution :return: Errors or parsed text as structured data :rtype: di... | 2 | stack_v2_sparse_classes_30k_train_014285 | Implement the Python class `CliParser` described below.
Class description:
The ttp parser class Convert raw text to structured data using ttp
Method signatures and docstrings:
- def _check_reqs(): Check the prerequisites for the ttp parser :return dict: A dict with errors or a template_path
- def parse(self, *_args, ... | Implement the Python class `CliParser` described below.
Class description:
The ttp parser class Convert raw text to structured data using ttp
Method signatures and docstrings:
- def _check_reqs(): Check the prerequisites for the ttp parser :return dict: A dict with errors or a template_path
- def parse(self, *_args, ... | 2ea7d4f00212f502bc684ac257371ada73da1ca9 | <|skeleton|>
class CliParser:
"""The ttp parser class Convert raw text to structured data using ttp"""
def _check_reqs():
"""Check the prerequisites for the ttp parser :return dict: A dict with errors or a template_path"""
<|body_0|>
def parse(self, *_args, **_kwargs):
"""Std entry... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CliParser:
"""The ttp parser class Convert raw text to structured data using ttp"""
def _check_reqs():
"""Check the prerequisites for the ttp parser :return dict: A dict with errors or a template_path"""
errors = []
if not HAS_TTP:
errors.append(missing_required_lib('t... | the_stack_v2_python_sparse | intro-ansible/venv3/lib/python3.8/site-packages/ansible_collections/ansible/utils/plugins/sub_plugins/cli_parser/ttp_parser.py | SimonFangCisco/dne-dna-code | train | 0 |
aa7d5a9ed75cd67ceb0449e7ba15b5592f61ec03 | [
"ret = s[-1]\nfor j in range(len(s) - 2, -1, -1):\n if ord(s[j]) < ord(ret[0]):\n pass\n elif ord(s[j]) > ord(ret[0]):\n ret = s[j:]\n else:\n update = False\n for i in range(1, len(ret)):\n if ord(s[j + i]) > ord(ret[i]):\n ret = s[j:]\n ... | <|body_start_0|>
ret = s[-1]
for j in range(len(s) - 2, -1, -1):
if ord(s[j]) < ord(ret[0]):
pass
elif ord(s[j]) > ord(ret[0]):
ret = s[j:]
else:
update = False
for i in range(1, len(ret)):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lastSubstring_timeout(self, s: str) -> str:
"""Time-out."""
<|body_0|>
def lastSubstring_timeout2(self, s: str) -> str:
"""Time-out."""
<|body_1|>
def lastSubstring(self, s: str) -> str:
"""official solution."""
<|body_2|>
... | stack_v2_sparse_classes_75kplus_train_000556 | 2,949 | no_license | [
{
"docstring": "Time-out.",
"name": "lastSubstring_timeout",
"signature": "def lastSubstring_timeout(self, s: str) -> str"
},
{
"docstring": "Time-out.",
"name": "lastSubstring_timeout2",
"signature": "def lastSubstring_timeout2(self, s: str) -> str"
},
{
"docstring": "official s... | 3 | stack_v2_sparse_classes_30k_train_027918 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lastSubstring_timeout(self, s: str) -> str: Time-out.
- def lastSubstring_timeout2(self, s: str) -> str: Time-out.
- def lastSubstring(self, s: str) -> str: official solution... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lastSubstring_timeout(self, s: str) -> str: Time-out.
- def lastSubstring_timeout2(self, s: str) -> str: Time-out.
- def lastSubstring(self, s: str) -> str: official solution... | 1007197ff0feda35001c0aaf13382af6869869b2 | <|skeleton|>
class Solution:
def lastSubstring_timeout(self, s: str) -> str:
"""Time-out."""
<|body_0|>
def lastSubstring_timeout2(self, s: str) -> str:
"""Time-out."""
<|body_1|>
def lastSubstring(self, s: str) -> str:
"""official solution."""
<|body_2|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def lastSubstring_timeout(self, s: str) -> str:
"""Time-out."""
ret = s[-1]
for j in range(len(s) - 2, -1, -1):
if ord(s[j]) < ord(ret[0]):
pass
elif ord(s[j]) > ord(ret[0]):
ret = s[j:]
else:
... | the_stack_v2_python_sparse | No1163. Last Substring in Lexicographical Order.py | chenxy3791/leetcode | train | 0 | |
de16b5d3e4695e00c3c38680f1151f0318ba91a5 | [
"if not nums:\n return 0\nif val not in nums:\n return len(nums)\npos = 0\nwhile True:\n if pos == len(nums) or not len(nums):\n break\n if nums[pos] == val:\n del nums[pos]\n else:\n pos += 1\nreturn len(nums)",
"if not nums:\n return 0\ni = 0\nwhile i < len(nums):\n if ... | <|body_start_0|>
if not nums:
return 0
if val not in nums:
return len(nums)
pos = 0
while True:
if pos == len(nums) or not len(nums):
break
if nums[pos] == val:
del nums[pos]
else:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def removeElement_old(self, nums: List[int], val: int) -> int:
"""老方法 48 ms 13.9 MB Python3"""
<|body_0|>
def removeElement(self, nums: List[int], val: int) -> int:
"""20191021 40 ms 13.6 MB Python3"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_000557 | 1,167 | no_license | [
{
"docstring": "老方法 48 ms 13.9 MB Python3",
"name": "removeElement_old",
"signature": "def removeElement_old(self, nums: List[int], val: int) -> int"
},
{
"docstring": "20191021 40 ms 13.6 MB Python3",
"name": "removeElement",
"signature": "def removeElement(self, nums: List[int], val: i... | 2 | stack_v2_sparse_classes_30k_train_027866 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeElement_old(self, nums: List[int], val: int) -> int: 老方法 48 ms 13.9 MB Python3
- def removeElement(self, nums: List[int], val: int) -> int: 20191021 40 ms 13.6 MB Pytho... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeElement_old(self, nums: List[int], val: int) -> int: 老方法 48 ms 13.9 MB Python3
- def removeElement(self, nums: List[int], val: int) -> int: 20191021 40 ms 13.6 MB Pytho... | 99a3abf1774933af73a8405f9b59e5e64906bca4 | <|skeleton|>
class Solution:
def removeElement_old(self, nums: List[int], val: int) -> int:
"""老方法 48 ms 13.9 MB Python3"""
<|body_0|>
def removeElement(self, nums: List[int], val: int) -> int:
"""20191021 40 ms 13.6 MB Python3"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def removeElement_old(self, nums: List[int], val: int) -> int:
"""老方法 48 ms 13.9 MB Python3"""
if not nums:
return 0
if val not in nums:
return len(nums)
pos = 0
while True:
if pos == len(nums) or not len(nums):
... | the_stack_v2_python_sparse | leetcode/27.remove_element.py | iamkissg/leetcode | train | 0 | |
6f8f3fafedd4d67f38afac40fd5f50399532339a | [
"if overlays is None:\n raise ValueError('Must specify overlays.')\nself._toolchains = []\nself._require_explicit_default_toolchain = True\nself._require_explicit_default_toolchain = False\nfor overlay_path in overlays:\n self._AddToolchainsFromOverlayDir(overlay_path)",
"config_path = os.path.join(overlay_... | <|body_start_0|>
if overlays is None:
raise ValueError('Must specify overlays.')
self._toolchains = []
self._require_explicit_default_toolchain = True
self._require_explicit_default_toolchain = False
for overlay_path in overlays:
self._AddToolchainsFromOve... | Represents a list of toolchains. | ToolchainList | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ToolchainList:
"""Represents a list of toolchains."""
def __init__(self, overlays):
"""Construct an instance. Args: overlays: list of overlay directories to add toolchains from."""
<|body_0|>
def _AddToolchainsFromOverlayDir(self, overlay_dir):
"""Add toolchains ... | stack_v2_sparse_classes_75kplus_train_000558 | 4,300 | permissive | [
{
"docstring": "Construct an instance. Args: overlays: list of overlay directories to add toolchains from.",
"name": "__init__",
"signature": "def __init__(self, overlays)"
},
{
"docstring": "Add toolchains to |self| from the given overlay. Does not include overlays that this overlay depends on.... | 4 | stack_v2_sparse_classes_30k_train_048069 | Implement the Python class `ToolchainList` described below.
Class description:
Represents a list of toolchains.
Method signatures and docstrings:
- def __init__(self, overlays): Construct an instance. Args: overlays: list of overlay directories to add toolchains from.
- def _AddToolchainsFromOverlayDir(self, overlay_... | Implement the Python class `ToolchainList` described below.
Class description:
Represents a list of toolchains.
Method signatures and docstrings:
- def __init__(self, overlays): Construct an instance. Args: overlays: list of overlay directories to add toolchains from.
- def _AddToolchainsFromOverlayDir(self, overlay_... | 72a05af97787001756bae2511b7985e61498c965 | <|skeleton|>
class ToolchainList:
"""Represents a list of toolchains."""
def __init__(self, overlays):
"""Construct an instance. Args: overlays: list of overlay directories to add toolchains from."""
<|body_0|>
def _AddToolchainsFromOverlayDir(self, overlay_dir):
"""Add toolchains ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ToolchainList:
"""Represents a list of toolchains."""
def __init__(self, overlays):
"""Construct an instance. Args: overlays: list of overlay directories to add toolchains from."""
if overlays is None:
raise ValueError('Must specify overlays.')
self._toolchains = []
... | the_stack_v2_python_sparse | third_party/chromite/lib/toolchain_list.py | metux/chromium-suckless | train | 5 |
3f9c3d089e30ecbfba478d002524ff13e0b4f56e | [
"\"\"\"\n 设置四个变量,分别表示:\n 在该天第一次买入的最大收益,为max(第一次买的最大收益,这一次的价格负值);\n 在该天第一次卖出的最大收益,为max(第一次卖的最大收益,这一次价格加上第一次买的最大收益);\n 在该天第二次买入的最大收益,为max(第二次买的最大收益,第一次卖的最大收益减去这一次的价格);\n 在该天第二次卖出的最大收益,为max(第二次卖的最大收益,这一次价格加上第二次买的最大收益).\n 注意:买入时要算收益的话为负值\n \"\"\"\nimport sys\nfirst_buy, ... | <|body_start_0|>
"""
设置四个变量,分别表示:
在该天第一次买入的最大收益,为max(第一次买的最大收益,这一次的价格负值);
在该天第一次卖出的最大收益,为max(第一次卖的最大收益,这一次价格加上第一次买的最大收益);
在该天第二次买入的最大收益,为max(第二次买的最大收益,第一次卖的最大收益减去这一次的价格);
在该天第二次卖出的最大收益,为max(第二次卖的最大收益,这一次价格加上第二次买的最大收益).
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProfit(self, prices):
""":type prices: List[int] :rtype: int"""
<|body_0|>
def maxProfit1(self, prices):
""":type prices: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
"""
设置四个变量,分别表示:
... | stack_v2_sparse_classes_75kplus_train_000559 | 2,194 | no_license | [
{
"docstring": ":type prices: List[int] :rtype: int",
"name": "maxProfit",
"signature": "def maxProfit(self, prices)"
},
{
"docstring": ":type prices: List[int] :rtype: int",
"name": "maxProfit1",
"signature": "def maxProfit1(self, prices)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007891 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, prices): :type prices: List[int] :rtype: int
- def maxProfit1(self, prices): :type prices: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, prices): :type prices: List[int] :rtype: int
- def maxProfit1(self, prices): :type prices: List[int] :rtype: int
<|skeleton|>
class Solution:
def maxPro... | b8ec1350e904665f1375c29a53f443ecf262d723 | <|skeleton|>
class Solution:
def maxProfit(self, prices):
""":type prices: List[int] :rtype: int"""
<|body_0|>
def maxProfit1(self, prices):
""":type prices: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maxProfit(self, prices):
""":type prices: List[int] :rtype: int"""
"""
设置四个变量,分别表示:
在该天第一次买入的最大收益,为max(第一次买的最大收益,这一次的价格负值);
在该天第一次卖出的最大收益,为max(第一次卖的最大收益,这一次价格加上第一次买的最大收益);
在该天第二次买入的最大收益,为max(第二次买的最大收益,第一次卖的最大收益减去这一次的... | the_stack_v2_python_sparse | leetcode/123买卖股票的最佳时机III.py | ShawDa/Coding | train | 0 | |
a932f168c15c66a0f962d4ba038f0eff69ce787b | [
"self.logger = logger\nself.get_config(config)\nself.config_is_valid = self._verify_config()",
"with open(config, 'r') as fp:\n self.config_str = fp.read()\n self.config_name = config\n self.config_hash = hashlib.md5(self.config_str).hexdigest()\n self.config_time = time.time()\n self.config_time_s... | <|body_start_0|>
self.logger = logger
self.get_config(config)
self.config_is_valid = self._verify_config()
<|end_body_0|>
<|body_start_1|>
with open(config, 'r') as fp:
self.config_str = fp.read()
self.config_name = config
self.config_hash = hashlib.m... | HeraCorrelator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HeraCorrelator:
def __init__(self, config=None, logger=LOGGER):
"""Instantiate a HeraCorrelator instance. optional inputs: config (str): Path to configuration file. If None, config will be grabbed from redis. logger (logging.Logger): Logging object this class will use."""
<|body_... | stack_v2_sparse_classes_75kplus_train_000560 | 2,291 | no_license | [
{
"docstring": "Instantiate a HeraCorrelator instance. optional inputs: config (str): Path to configuration file. If None, config will be grabbed from redis. logger (logging.Logger): Logging object this class will use.",
"name": "__init__",
"signature": "def __init__(self, config=None, logger=LOGGER)"
... | 3 | stack_v2_sparse_classes_30k_train_050767 | Implement the Python class `HeraCorrelator` described below.
Class description:
Implement the HeraCorrelator class.
Method signatures and docstrings:
- def __init__(self, config=None, logger=LOGGER): Instantiate a HeraCorrelator instance. optional inputs: config (str): Path to configuration file. If None, config will... | Implement the Python class `HeraCorrelator` described below.
Class description:
Implement the HeraCorrelator class.
Method signatures and docstrings:
- def __init__(self, config=None, logger=LOGGER): Instantiate a HeraCorrelator instance. optional inputs: config (str): Path to configuration file. If None, config will... | 9e6b0d9da9ff7d14d45d33d0c7aef62f6edaa614 | <|skeleton|>
class HeraCorrelator:
def __init__(self, config=None, logger=LOGGER):
"""Instantiate a HeraCorrelator instance. optional inputs: config (str): Path to configuration file. If None, config will be grabbed from redis. logger (logging.Logger): Logging object this class will use."""
<|body_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HeraCorrelator:
def __init__(self, config=None, logger=LOGGER):
"""Instantiate a HeraCorrelator instance. optional inputs: config (str): Path to configuration file. If None, config will be grabbed from redis. logger (logging.Logger): Logging object this class will use."""
self.logger = logger
... | the_stack_v2_python_sparse | SNAP_control/hera_corr.py | dsa110/SNAP_control | train | 1 | |
57006a9ec42652e809c18253b9f536199d61398e | [
"super(EncoderCNN, self).__init__()\nself.feature = nn.Sequential(*list(model.children())[:-1])\nself.classifier = nn.Sequential(*list(model.classifier.children())[:-1])\nself.Linear_layer = nn.Sequential(nn.Linear(4096, 2048), nn.ReLU(True), nn.Dropout(), nn.Linear(2048, 1024), nn.ReLU(True), nn.Dropout(), nn.Line... | <|body_start_0|>
super(EncoderCNN, self).__init__()
self.feature = nn.Sequential(*list(model.children())[:-1])
self.classifier = nn.Sequential(*list(model.classifier.children())[:-1])
self.Linear_layer = nn.Sequential(nn.Linear(4096, 2048), nn.ReLU(True), nn.Dropout(), nn.Linear(2048, 10... | Alexnet pre-training model call, network structure adaptation modification. | EncoderCNN | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EncoderCNN:
"""Alexnet pre-training model call, network structure adaptation modification."""
def __init__(self, model):
"""Initialize the model, deconstruct it. Args: model: Alexnet pre-training model."""
<|body_0|>
def forward(self, x):
"""Forward calculation t... | stack_v2_sparse_classes_75kplus_train_000561 | 1,324 | permissive | [
{
"docstring": "Initialize the model, deconstruct it. Args: model: Alexnet pre-training model.",
"name": "__init__",
"signature": "def __init__(self, model)"
},
{
"docstring": "Forward calculation to extract the required features. Args: x: The gray image data. Returns: The SIR feature.",
"na... | 2 | stack_v2_sparse_classes_30k_train_029386 | Implement the Python class `EncoderCNN` described below.
Class description:
Alexnet pre-training model call, network structure adaptation modification.
Method signatures and docstrings:
- def __init__(self, model): Initialize the model, deconstruct it. Args: model: Alexnet pre-training model.
- def forward(self, x): ... | Implement the Python class `EncoderCNN` described below.
Class description:
Alexnet pre-training model call, network structure adaptation modification.
Method signatures and docstrings:
- def __init__(self, model): Initialize the model, deconstruct it. Args: model: Alexnet pre-training model.
- def forward(self, x): ... | 5dc584f0722b90b99614616c9b210d9e086f8ff3 | <|skeleton|>
class EncoderCNN:
"""Alexnet pre-training model call, network structure adaptation modification."""
def __init__(self, model):
"""Initialize the model, deconstruct it. Args: model: Alexnet pre-training model."""
<|body_0|>
def forward(self, x):
"""Forward calculation t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EncoderCNN:
"""Alexnet pre-training model call, network structure adaptation modification."""
def __init__(self, model):
"""Initialize the model, deconstruct it. Args: model: Alexnet pre-training model."""
super(EncoderCNN, self).__init__()
self.feature = nn.Sequential(*list(model... | the_stack_v2_python_sparse | scripts/WK_NetArch/alexnet_features.py | ML-Lab-Jilin-University/GCFM | train | 0 |
ea46ad16a3451a9a60ce0d237dd551f2d4e11aef | [
"try:\n from thread import allocate_lock, start_new_thread\nexcept ImportError:\n from _thread import allocate_lock, start_new_thread\nself.func = None\nself.nthread = nthread\nself.__threadids = [None] * nthread\nself.__threads = [None] * nthread\nself.__returns = [None] * nthread\nfor it in range(nthread):\... | <|body_start_0|>
try:
from thread import allocate_lock, start_new_thread
except ImportError:
from _thread import allocate_lock, start_new_thread
self.func = None
self.nthread = nthread
self.__threadids = [None] * nthread
self.__threads = [None] * n... | A synchronized thread pool. The number of pre-created threads is not changeable. @ivar nthread: number of threads in the pool. @itype nthread: int | ThreadPool | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ThreadPool:
"""A synchronized thread pool. The number of pre-created threads is not changeable. @ivar nthread: number of threads in the pool. @itype nthread: int"""
def __init__(self, nthread):
"""@param nthread: number of threads for the pool. @type nthread: int"""
<|body_0|... | stack_v2_sparse_classes_75kplus_train_000562 | 3,910 | permissive | [
{
"docstring": "@param nthread: number of threads for the pool. @type nthread: int",
"name": "__init__",
"signature": "def __init__(self, nthread)"
},
{
"docstring": "Event loop for the pre-created threads.",
"name": "eventloop",
"signature": "def eventloop(self, tdata)"
},
{
"do... | 3 | stack_v2_sparse_classes_30k_train_026463 | Implement the Python class `ThreadPool` described below.
Class description:
A synchronized thread pool. The number of pre-created threads is not changeable. @ivar nthread: number of threads in the pool. @itype nthread: int
Method signatures and docstrings:
- def __init__(self, nthread): @param nthread: number of thre... | Implement the Python class `ThreadPool` described below.
Class description:
A synchronized thread pool. The number of pre-created threads is not changeable. @ivar nthread: number of threads in the pool. @itype nthread: int
Method signatures and docstrings:
- def __init__(self, nthread): @param nthread: number of thre... | ff0c71c5081dc67522d42bc65719e16c8365ab47 | <|skeleton|>
class ThreadPool:
"""A synchronized thread pool. The number of pre-created threads is not changeable. @ivar nthread: number of threads in the pool. @itype nthread: int"""
def __init__(self, nthread):
"""@param nthread: number of threads for the pool. @type nthread: int"""
<|body_0|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ThreadPool:
"""A synchronized thread pool. The number of pre-created threads is not changeable. @ivar nthread: number of threads in the pool. @itype nthread: int"""
def __init__(self, nthread):
"""@param nthread: number of threads for the pool. @type nthread: int"""
try:
from ... | the_stack_v2_python_sparse | solvcon/mthread.py | gitter-badger/solvcon | train | 1 |
4706cc9ef9f467b66ed99b8d9e4972df0f5840fd | [
"self.source_file = 'Phone_book.json'\nself.data = open(self.source_file, mode='w')\nself.new = {}\nself.data_dict = {}\nself.secondary_dict = {}\nself.contact_quantity = contact_quantity",
"for i in range(1, self.contact_quantity + 1):\n print('\\tPerson № {}'.format(i))\n self.secondary_dict['name'] = inp... | <|body_start_0|>
self.source_file = 'Phone_book.json'
self.data = open(self.source_file, mode='w')
self.new = {}
self.data_dict = {}
self.secondary_dict = {}
self.contact_quantity = contact_quantity
<|end_body_0|>
<|body_start_1|>
for i in range(1, self.contact_q... | Клас для контанків (ім'я, фамілія, номер телефона, місто') | Contact_book | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Contact_book:
"""Клас для контанків (ім'я, фамілія, номер телефона, місто')"""
def __init__(self, contact_quantity):
"""Ініціалізуємо змінні"""
<|body_0|>
def Add_new_contact(self):
"""Доавляємо новий контакт"""
<|body_1|>
def Find_in_book(self):
... | stack_v2_sparse_classes_75kplus_train_000563 | 3,361 | no_license | [
{
"docstring": "Ініціалізуємо змінні",
"name": "__init__",
"signature": "def __init__(self, contact_quantity)"
},
{
"docstring": "Доавляємо новий контакт",
"name": "Add_new_contact",
"signature": "def Add_new_contact(self)"
},
{
"docstring": "Пошук по файлові (не можливий якщо за... | 4 | stack_v2_sparse_classes_30k_train_013286 | Implement the Python class `Contact_book` described below.
Class description:
Клас для контанків (ім'я, фамілія, номер телефона, місто')
Method signatures and docstrings:
- def __init__(self, contact_quantity): Ініціалізуємо змінні
- def Add_new_contact(self): Доавляємо новий контакт
- def Find_in_book(self): Пошук п... | Implement the Python class `Contact_book` described below.
Class description:
Клас для контанків (ім'я, фамілія, номер телефона, місто')
Method signatures and docstrings:
- def __init__(self, contact_quantity): Ініціалізуємо змінні
- def Add_new_contact(self): Доавляємо новий контакт
- def Find_in_book(self): Пошук п... | 9fd87c237370228d66c510520e17f11c8556f3d0 | <|skeleton|>
class Contact_book:
"""Клас для контанків (ім'я, фамілія, номер телефона, місто')"""
def __init__(self, contact_quantity):
"""Ініціалізуємо змінні"""
<|body_0|>
def Add_new_contact(self):
"""Доавляємо новий контакт"""
<|body_1|>
def Find_in_book(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Contact_book:
"""Клас для контанків (ім'я, фамілія, номер телефона, місто')"""
def __init__(self, contact_quantity):
"""Ініціалізуємо змінні"""
self.source_file = 'Phone_book.json'
self.data = open(self.source_file, mode='w')
self.new = {}
self.data_dict = {}
... | the_stack_v2_python_sparse | contact_book_class.py | dkoval-py/Simple_Projects | train | 0 |
b96937635cf96f6a7ac975bd9d0ce72647d5c854 | [
"if x < 0:\n return False\ns = str(x)\nn = len(s)\ni, j = (0, n - 1)\nwhile i <= j:\n if s[i] == s[j]:\n i += 1\n j -= 1\n else:\n return False\nreturn True",
"if x < 0:\n return False\ns = str(x)\nn = len(s)\nif n % 2 == 0:\n i, j = (n // 2 - 1, n // 2)\nelse:\n i, j = (n /... | <|body_start_0|>
if x < 0:
return False
s = str(x)
n = len(s)
i, j = (0, n - 1)
while i <= j:
if s[i] == s[j]:
i += 1
j -= 1
else:
return False
return True
<|end_body_0|>
<|body_start_1|>... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isPalindrome(self, x):
""":type x: int :rtype: bool"""
<|body_0|>
def isPalindrome2(self, x):
""":type x: int :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if x < 0:
return False
s = str(x)
n ... | stack_v2_sparse_classes_75kplus_train_000564 | 1,233 | no_license | [
{
"docstring": ":type x: int :rtype: bool",
"name": "isPalindrome",
"signature": "def isPalindrome(self, x)"
},
{
"docstring": ":type x: int :rtype: bool",
"name": "isPalindrome2",
"signature": "def isPalindrome2(self, x)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015949 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, x): :type x: int :rtype: bool
- def isPalindrome2(self, x): :type x: int :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, x): :type x: int :rtype: bool
- def isPalindrome2(self, x): :type x: int :rtype: bool
<|skeleton|>
class Solution:
def isPalindrome(self, x):
... | f2c4f727689567e00ee06560132fca55a6fd9286 | <|skeleton|>
class Solution:
def isPalindrome(self, x):
""":type x: int :rtype: bool"""
<|body_0|>
def isPalindrome2(self, x):
""":type x: int :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isPalindrome(self, x):
""":type x: int :rtype: bool"""
if x < 0:
return False
s = str(x)
n = len(s)
i, j = (0, n - 1)
while i <= j:
if s[i] == s[j]:
i += 1
j -= 1
else:
... | the_stack_v2_python_sparse | leetcode/9_Palindrome_Number.py | JianxiangWang/python-journey | train | 1 | |
8bedbd8fbd1e5f541bd9298c3bd73908cf8f6cae | [
"default_params = super().setup(controller, params, description)\nnon_mpi_defaults = {'no_storage': False}\nreturn {**non_mpi_defaults, **default_params}",
"super().setup_status_variables(controller, **kwargs)\nself.prev.t = np.array([None] * self.params.n)\nself.prev.dt = np.array([None] * self.params.n)\nself.p... | <|body_start_0|>
default_params = super().setup(controller, params, description)
non_mpi_defaults = {'no_storage': False}
return {**non_mpi_defaults, **default_params}
<|end_body_0|>
<|body_start_1|>
super().setup_status_variables(controller, **kwargs)
self.prev.t = np.array([No... | Implementation of the extrapolation error estimate for the non-MPI controller. | EstimateExtrapolationErrorNonMPI | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EstimateExtrapolationErrorNonMPI:
"""Implementation of the extrapolation error estimate for the non-MPI controller."""
def setup(self, controller, params, description, **kwargs):
"""Add a no parameter 'no_storage' which decides whether the standard or the no-memory-overhead version i... | stack_v2_sparse_classes_75kplus_train_000565 | 21,547 | permissive | [
{
"docstring": "Add a no parameter 'no_storage' which decides whether the standard or the no-memory-overhead version is run, where only values are used for extrapolation which are in memory of other processes Args: controller (pySDC.Controller): The controller params (dict): The params passed for this specific ... | 6 | stack_v2_sparse_classes_30k_train_043354 | Implement the Python class `EstimateExtrapolationErrorNonMPI` described below.
Class description:
Implementation of the extrapolation error estimate for the non-MPI controller.
Method signatures and docstrings:
- def setup(self, controller, params, description, **kwargs): Add a no parameter 'no_storage' which decides... | Implement the Python class `EstimateExtrapolationErrorNonMPI` described below.
Class description:
Implementation of the extrapolation error estimate for the non-MPI controller.
Method signatures and docstrings:
- def setup(self, controller, params, description, **kwargs): Add a no parameter 'no_storage' which decides... | 1a51834bedffd4472e344bed28f4d766614b1537 | <|skeleton|>
class EstimateExtrapolationErrorNonMPI:
"""Implementation of the extrapolation error estimate for the non-MPI controller."""
def setup(self, controller, params, description, **kwargs):
"""Add a no parameter 'no_storage' which decides whether the standard or the no-memory-overhead version i... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EstimateExtrapolationErrorNonMPI:
"""Implementation of the extrapolation error estimate for the non-MPI controller."""
def setup(self, controller, params, description, **kwargs):
"""Add a no parameter 'no_storage' which decides whether the standard or the no-memory-overhead version is run, where ... | the_stack_v2_python_sparse | pySDC/implementations/convergence_controller_classes/estimate_extrapolation_error.py | Parallel-in-Time/pySDC | train | 30 |
2a5f8a4fafcf5d84a22301894af1ae23b6b9347c | [
"self.sum = 0\ns = [root]\nwhile s:\n l = len(s)\n curLevelSum = 0\n for i in range(l):\n curNode = s.pop(0)\n curLevelSum += curNode.val\n if curNode.left:\n s.append(curNode.left)\n if curNode.right:\n s.append(curNode.right)\nreturn curLevelSum",
"q = ... | <|body_start_0|>
self.sum = 0
s = [root]
while s:
l = len(s)
curLevelSum = 0
for i in range(l):
curNode = s.pop(0)
curLevelSum += curNode.val
if curNode.left:
s.append(curNode.left)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def deepestLeavesSum(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def deepestLeavesSumB(self, root):
"""大神写法 pre are nodes in the previous level. q are node in the current level. When current level are empty, the previous level are the dee... | stack_v2_sparse_classes_75kplus_train_000566 | 1,145 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "deepestLeavesSum",
"signature": "def deepestLeavesSum(self, root)"
},
{
"docstring": "大神写法 pre are nodes in the previous level. q are node in the current level. When current level are empty, the previous level are the deepest leaves.",
... | 2 | stack_v2_sparse_classes_30k_train_031826 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def deepestLeavesSum(self, root): :type root: TreeNode :rtype: int
- def deepestLeavesSumB(self, root): 大神写法 pre are nodes in the previous level. q are node in the current level.... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def deepestLeavesSum(self, root): :type root: TreeNode :rtype: int
- def deepestLeavesSumB(self, root): 大神写法 pre are nodes in the previous level. q are node in the current level.... | 813235789ce422a3bab198317aafc46fbc61625e | <|skeleton|>
class Solution:
def deepestLeavesSum(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def deepestLeavesSumB(self, root):
"""大神写法 pre are nodes in the previous level. q are node in the current level. When current level are empty, the previous level are the dee... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def deepestLeavesSum(self, root):
""":type root: TreeNode :rtype: int"""
self.sum = 0
s = [root]
while s:
l = len(s)
curLevelSum = 0
for i in range(l):
curNode = s.pop(0)
curLevelSum += curNode.val
... | the_stack_v2_python_sparse | 7.BINARY TREE and BST/1302_deepest_leaves_sum_MED/solution.py | kimmyoo/python_leetcode | train | 1 | |
b6966398474dd863ba9fcb3b465bfc99e456b6a8 | [
"i = 0\nfor n in nums:\n if i < 2 or n > nums[i - 2]:\n nums[i] = n\n i += 1\nreturn i",
"i = 0\nfor n in nums:\n if i < k or n > nums[i - k]:\n nums[i] = n\n i += 1\nreturn i"
] | <|body_start_0|>
i = 0
for n in nums:
if i < 2 or n > nums[i - 2]:
nums[i] = n
i += 1
return i
<|end_body_0|>
<|body_start_1|>
i = 0
for n in nums:
if i < k or n > nums[i - k]:
nums[i] = n
i ... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def removeDuplicates(self, nums):
"""O(n) :type nums: List[int] :rtype: int"""
<|body_0|>
def removeDuplicates(self, nums, k):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
i = 0
for n in nums... | stack_v2_sparse_classes_75kplus_train_000567 | 929 | permissive | [
{
"docstring": "O(n) :type nums: List[int] :rtype: int",
"name": "removeDuplicates",
"signature": "def removeDuplicates(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "removeDuplicates",
"signature": "def removeDuplicates(self, nums, k)"
}
] | 2 | stack_v2_sparse_classes_30k_train_021136 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeDuplicates(self, nums): O(n) :type nums: List[int] :rtype: int
- def removeDuplicates(self, nums, k): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeDuplicates(self, nums): O(n) :type nums: List[int] :rtype: int
- def removeDuplicates(self, nums, k): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
... | 4045bcb652537711b3680b2aa17204ae73c6bde8 | <|skeleton|>
class Solution:
def removeDuplicates(self, nums):
"""O(n) :type nums: List[int] :rtype: int"""
<|body_0|>
def removeDuplicates(self, nums, k):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def removeDuplicates(self, nums):
"""O(n) :type nums: List[int] :rtype: int"""
i = 0
for n in nums:
if i < 2 or n > nums[i - 2]:
nums[i] = n
i += 1
return i
def removeDuplicates(self, nums, k):
""":type nums: Li... | the_stack_v2_python_sparse | 080. Remove Duplicates from Sorted Array II.py | youhusky/Facebook_Prepare | train | 6 | |
2a22bd6a49c9a3be956d1ebdbc54ee73840c14f8 | [
"self.dataset = dataset\nself.kwargs = kwargs\nself.logger = logger",
"if batch_sampler:\n self.logger.get_log().info('this case sets the batch_sampler')\nelse:\n self.logger.get_log().info('this case has no batch_sampler')\ndataloader = paddle.io.DataLoader(self.dataset, batch_sampler=batch_sampler, **self... | <|body_start_0|>
self.dataset = dataset
self.kwargs = kwargs
self.logger = logger
<|end_body_0|>
<|body_start_1|>
if batch_sampler:
self.logger.get_log().info('this case sets the batch_sampler')
else:
self.logger.get_log().info('this case has no batch_sam... | generate DataLoader class | GenDataLoader | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GenDataLoader:
"""generate DataLoader class"""
def __init__(self, dataset, **kwargs):
"""init"""
<|body_0|>
def exec(self, batch_sampler):
"""execute"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.dataset = dataset
self.kwargs = kw... | stack_v2_sparse_classes_75kplus_train_000568 | 765 | no_license | [
{
"docstring": "init",
"name": "__init__",
"signature": "def __init__(self, dataset, **kwargs)"
},
{
"docstring": "execute",
"name": "exec",
"signature": "def exec(self, batch_sampler)"
}
] | 2 | stack_v2_sparse_classes_30k_train_041181 | Implement the Python class `GenDataLoader` described below.
Class description:
generate DataLoader class
Method signatures and docstrings:
- def __init__(self, dataset, **kwargs): init
- def exec(self, batch_sampler): execute | Implement the Python class `GenDataLoader` described below.
Class description:
generate DataLoader class
Method signatures and docstrings:
- def __init__(self, dataset, **kwargs): init
- def exec(self, batch_sampler): execute
<|skeleton|>
class GenDataLoader:
"""generate DataLoader class"""
def __init__(sel... | bd3790ce72a2a26611b5eda3901651b5a809348f | <|skeleton|>
class GenDataLoader:
"""generate DataLoader class"""
def __init__(self, dataset, **kwargs):
"""init"""
<|body_0|>
def exec(self, batch_sampler):
"""execute"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GenDataLoader:
"""generate DataLoader class"""
def __init__(self, dataset, **kwargs):
"""init"""
self.dataset = dataset
self.kwargs = kwargs
self.logger = logger
def exec(self, batch_sampler):
"""execute"""
if batch_sampler:
self.logger.get... | the_stack_v2_python_sparse | framework/e2e/io/io_loader.py | PaddlePaddle/PaddleTest | train | 42 |
ddfcdbbae2bba740e3a6a672ae49a8b91c42132d | [
"self.__xy = xydict\nxkey = list(xydict.keys())\nxkey.sort()\nself.__xkey = xkey",
"idx = bisect.bisect_left(self.__xkey, x)\nif idx >= len(self.__xkey):\n y1, y2 = (self.__xy[self.__xkey[idx - 2]], self.__xy[self.__xkey[idx - 1]])\n x1, x2 = (self.__xkey[idx - 2], self.__xkey[idx - 1])\nelif idx == 0:\n ... | <|body_start_0|>
self.__xy = xydict
xkey = list(xydict.keys())
xkey.sort()
self.__xkey = xkey
<|end_body_0|>
<|body_start_1|>
idx = bisect.bisect_left(self.__xkey, x)
if idx >= len(self.__xkey):
y1, y2 = (self.__xy[self.__xkey[idx - 2]], self.__xy[self.__xkey... | Table lookup class. Linear inter- or extrapolation for a given set of tabulated (x,y) data. Stores (x,y) values and uses linear inter- or extrapolation, if needed, to return y based on a given x. Sorts the data based on x values in an ascending order. # METHODS val: Given x, return its corresponding y for a list of (x,... | AFGen | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AFGen:
"""Table lookup class. Linear inter- or extrapolation for a given set of tabulated (x,y) data. Stores (x,y) values and uses linear inter- or extrapolation, if needed, to return y based on a given x. Sorts the data based on x values in an ascending order. # METHODS val: Given x, return its ... | stack_v2_sparse_classes_75kplus_train_000569 | 7,277 | no_license | [
{
"docstring": "Create and initialize the AFGen object. # Arguments xydict (dict): dictionary holding the (x,y) pairs of values",
"name": "__init__",
"signature": "def __init__(self, xydict)"
},
{
"docstring": "Given x, return y, using linear extra- or interpolation if needed. # Arguments x (int... | 2 | stack_v2_sparse_classes_30k_train_009174 | Implement the Python class `AFGen` described below.
Class description:
Table lookup class. Linear inter- or extrapolation for a given set of tabulated (x,y) data. Stores (x,y) values and uses linear inter- or extrapolation, if needed, to return y based on a given x. Sorts the data based on x values in an ascending ord... | Implement the Python class `AFGen` described below.
Class description:
Table lookup class. Linear inter- or extrapolation for a given set of tabulated (x,y) data. Stores (x,y) values and uses linear inter- or extrapolation, if needed, to return y based on a given x. Sorts the data based on x values in an ascending ord... | 8f98c3bfe4bcd694bcaf80f9dfec12da749c1046 | <|skeleton|>
class AFGen:
"""Table lookup class. Linear inter- or extrapolation for a given set of tabulated (x,y) data. Stores (x,y) values and uses linear inter- or extrapolation, if needed, to return y based on a given x. Sorts the data based on x values in an ascending order. # METHODS val: Given x, return its ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AFGen:
"""Table lookup class. Linear inter- or extrapolation for a given set of tabulated (x,y) data. Stores (x,y) values and uses linear inter- or extrapolation, if needed, to return y based on a given x. Sorts the data based on x values in an ascending order. # METHODS val: Given x, return its corresponding... | the_stack_v2_python_sparse | venv/Lib/site-packages/pysawit/utils.py | jirawatd/pysawitv1 | train | 0 |
450568a6811c1147f91d6decfeab191a3c5a537e | [
"if not matrix:\n return\nself.m, self.n = (len(matrix), len(matrix[0]))\nself.sums = [[0] * (1 + self.n) for _ in range(1 + self.m)]\nfor i in range(self.m):\n tempSum = 0\n for j in range(self.n):\n tempSum += matrix[i][j]\n self.sums[i + 1][j + 1] = tempSum + self.sums[i][j + 1]",
"if ro... | <|body_start_0|>
if not matrix:
return
self.m, self.n = (len(matrix), len(matrix[0]))
self.sums = [[0] * (1 + self.n) for _ in range(1 + self.m)]
for i in range(self.m):
tempSum = 0
for j in range(self.n):
tempSum += matrix[i][j]
... | 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_75kplus_train_000570 | 981 | 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:... | 7c443f85217ab96ceac717ece7fc472271e1d3ab | <|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_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
if not matrix:
return
self.m, self.n = (len(matrix), len(matrix[0]))
self.sums = [[0] * (1 + self.n) for _ in range(1 + self.m)]
for i in range(self.m):
tempSum = 0
... | the_stack_v2_python_sparse | zemiao/304.py | Zichuanyun/go-shuati | train | 9 | |
51047de4bb061f94f360c0e127819877493995dc | [
"if not order:\n raise ValueError('GroupBy requires at least one grouping variable')\nif isinstance(order, list):\n order = {k: None for k in order}\nself.order = order",
"levels = {}\nfor var, order in self.order.items():\n if var in data:\n if order is None:\n order = categorical_orde... | <|body_start_0|>
if not order:
raise ValueError('GroupBy requires at least one grouping variable')
if isinstance(order, list):
order = {k: None for k in order}
self.order = order
<|end_body_0|>
<|body_start_1|>
levels = {}
for var, order in self.order.ite... | Interface for Pandas GroupBy operations allowing specified group order. Writing our own class to do this has a few advantages: - It constrains the interface between Plot and Stat/Move objects - It allows control over the row order of the GroupBy result, which is important when using in the context of some Move operatio... | GroupBy | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupBy:
"""Interface for Pandas GroupBy operations allowing specified group order. Writing our own class to do this has a few advantages: - It constrains the interface between Plot and Stat/Move objects - It allows control over the row order of the GroupBy result, which is important when using i... | stack_v2_sparse_classes_75kplus_train_000571 | 4,710 | permissive | [
{
"docstring": "Initialize the GroupBy from grouping variables and optional level orders. Parameters ---------- order List of variable names or dict mapping names to desired level orders. Level order values can be None to use default ordering rules. The variables can include names that are not expected to appea... | 5 | stack_v2_sparse_classes_30k_train_033124 | Implement the Python class `GroupBy` described below.
Class description:
Interface for Pandas GroupBy operations allowing specified group order. Writing our own class to do this has a few advantages: - It constrains the interface between Plot and Stat/Move objects - It allows control over the row order of the GroupBy ... | Implement the Python class `GroupBy` described below.
Class description:
Interface for Pandas GroupBy operations allowing specified group order. Writing our own class to do this has a few advantages: - It constrains the interface between Plot and Stat/Move objects - It allows control over the row order of the GroupBy ... | 67a777a54dd1064c3f9038733b1ed71c6d50a6af | <|skeleton|>
class GroupBy:
"""Interface for Pandas GroupBy operations allowing specified group order. Writing our own class to do this has a few advantages: - It constrains the interface between Plot and Stat/Move objects - It allows control over the row order of the GroupBy result, which is important when using i... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GroupBy:
"""Interface for Pandas GroupBy operations allowing specified group order. Writing our own class to do this has a few advantages: - It constrains the interface between Plot and Stat/Move objects - It allows control over the row order of the GroupBy result, which is important when using in the context... | the_stack_v2_python_sparse | seaborn/_core/groupby.py | mwaskom/seaborn | train | 10,793 |
b6d445191d7963672b9c6ab04f0f5aa88cd60b29 | [
"try:\n attachment_data = request.json\n existing_attachment = AttachmentDao.get_by_id(id)\n if 'attachment_id' in attachment_data:\n existing_attachment.attachment_id = attachment_data['attachment_id']\n if 'attachment_type_id' in attachment_data:\n existing_attachment.attachment_type_id ... | <|body_start_0|>
try:
attachment_data = request.json
existing_attachment = AttachmentDao.get_by_id(id)
if 'attachment_id' in attachment_data:
existing_attachment.attachment_id = attachment_data['attachment_id']
if 'attachment_type_id' in attachment... | Attachment | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Attachment:
def put(self, id):
"""Update a attachment"""
<|body_0|>
def get(self, id):
"""Get an attachment given its identifier"""
<|body_1|>
def delete(self, id):
"""Delete an attachment given its identifier"""
<|body_2|>
<|end_skeleto... | stack_v2_sparse_classes_75kplus_train_000572 | 6,409 | no_license | [
{
"docstring": "Update a attachment",
"name": "put",
"signature": "def put(self, id)"
},
{
"docstring": "Get an attachment given its identifier",
"name": "get",
"signature": "def get(self, id)"
},
{
"docstring": "Delete an attachment given its identifier",
"name": "delete",
... | 3 | stack_v2_sparse_classes_30k_train_044580 | Implement the Python class `Attachment` described below.
Class description:
Implement the Attachment class.
Method signatures and docstrings:
- def put(self, id): Update a attachment
- def get(self, id): Get an attachment given its identifier
- def delete(self, id): Delete an attachment given its identifier | Implement the Python class `Attachment` described below.
Class description:
Implement the Attachment class.
Method signatures and docstrings:
- def put(self, id): Update a attachment
- def get(self, id): Get an attachment given its identifier
- def delete(self, id): Delete an attachment given its identifier
<|skelet... | 1440e352de0ba32024c96a0e7886c34979496eb0 | <|skeleton|>
class Attachment:
def put(self, id):
"""Update a attachment"""
<|body_0|>
def get(self, id):
"""Get an attachment given its identifier"""
<|body_1|>
def delete(self, id):
"""Delete an attachment given its identifier"""
<|body_2|>
<|end_skeleto... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Attachment:
def put(self, id):
"""Update a attachment"""
try:
attachment_data = request.json
existing_attachment = AttachmentDao.get_by_id(id)
if 'attachment_id' in attachment_data:
existing_attachment.attachment_id = attachment_data['attachm... | the_stack_v2_python_sparse | app/attachment/api/attachment.py | kimwonjin97/vendor-management | train | 0 | |
ba3b1dbe2bade3fa8b036169389243f1e909a952 | [
"import green\ngrb, gr = green.green_renormalization(self.intra, self.inter, error=error, energy=energy, delta=delta)\nreturn gr",
"gr = self.get_green(energy, error=error, delta=delta)\nt = self.coupling\nselfenergy = t.H * gr * t\nreturn selfenergy"
] | <|body_start_0|>
import green
grb, gr = green.green_renormalization(self.intra, self.inter, error=error, energy=energy, delta=delta)
return gr
<|end_body_0|>
<|body_start_1|>
gr = self.get_green(energy, error=error, delta=delta)
t = self.coupling
selfenergy = t.H * gr * ... | Class for a lead | Lead | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Lead:
"""Class for a lead"""
def get_green(self, energy, error=1e-05, delta=1e-05):
"""Get surface green function"""
<|body_0|>
def get_selfenergy(self, energy, error=0.0001, delta=0.0001):
"""Get selfenergy"""
<|body_1|>
<|end_skeleton|>
<|body_start_0... | stack_v2_sparse_classes_75kplus_train_000573 | 4,419 | no_license | [
{
"docstring": "Get surface green function",
"name": "get_green",
"signature": "def get_green(self, energy, error=1e-05, delta=1e-05)"
},
{
"docstring": "Get selfenergy",
"name": "get_selfenergy",
"signature": "def get_selfenergy(self, energy, error=0.0001, delta=0.0001)"
}
] | 2 | stack_v2_sparse_classes_30k_train_029813 | Implement the Python class `Lead` described below.
Class description:
Class for a lead
Method signatures and docstrings:
- def get_green(self, energy, error=1e-05, delta=1e-05): Get surface green function
- def get_selfenergy(self, energy, error=0.0001, delta=0.0001): Get selfenergy | Implement the Python class `Lead` described below.
Class description:
Class for a lead
Method signatures and docstrings:
- def get_green(self, energy, error=1e-05, delta=1e-05): Get surface green function
- def get_selfenergy(self, energy, error=0.0001, delta=0.0001): Get selfenergy
<|skeleton|>
class Lead:
"""C... | 50deb0e59fffe4031f05094572552ca5be59e741 | <|skeleton|>
class Lead:
"""Class for a lead"""
def get_green(self, energy, error=1e-05, delta=1e-05):
"""Get surface green function"""
<|body_0|>
def get_selfenergy(self, energy, error=0.0001, delta=0.0001):
"""Get selfenergy"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Lead:
"""Class for a lead"""
def get_green(self, energy, error=1e-05, delta=1e-05):
"""Get surface green function"""
import green
grb, gr = green.green_renormalization(self.intra, self.inter, error=error, energy=energy, delta=delta)
return gr
def get_selfenergy(self, ... | the_stack_v2_python_sparse | development/pysrc/multiterminal.py | Huaguiyuan/quantum-honeycomp | train | 1 |
b4bc405f8756ee65852568d491bb5f0d4dd64758 | [
"self.inlet_pa = inlet_pa\nself.dest_pa = dest_pa\nself.ghost_pa = ghost_pa\nself.callback = callback\nself.dim = dim\nself.kernel = kernel\nself.inletinfo = inletinfo\nself.x = self.y = self.z = 0.0\nself.xn = self.yn = self.zn = 0.0\nself.length = 0.0\nself.dx = 0.0\nself.active_stages = active_stages\nself.io_ev... | <|body_start_0|>
self.inlet_pa = inlet_pa
self.dest_pa = dest_pa
self.ghost_pa = ghost_pa
self.callback = callback
self.dim = dim
self.kernel = kernel
self.inletinfo = inletinfo
self.x = self.y = self.z = 0.0
self.xn = self.yn = self.zn = 0.0
... | InletBase | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InletBase:
def __init__(self, inlet_pa, dest_pa, inletinfo, kernel, dim, active_stages=[1], callback=None, ghost_pa=None):
"""An API to add/delete particle when moving between inlet-fluid Parameters ---------- inlet_pa : particle_array particle array for inlet dest_pa : particle_array pa... | stack_v2_sparse_classes_75kplus_train_000574 | 24,083 | permissive | [
{
"docstring": "An API to add/delete particle when moving between inlet-fluid Parameters ---------- inlet_pa : particle_array particle array for inlet dest_pa : particle_array particle_array of the fluid inletinfo : InletInfo instance contains information fo inlet kernel : Kernel instance Kernel to be used for ... | 4 | null | Implement the Python class `InletBase` described below.
Class description:
Implement the InletBase class.
Method signatures and docstrings:
- def __init__(self, inlet_pa, dest_pa, inletinfo, kernel, dim, active_stages=[1], callback=None, ghost_pa=None): An API to add/delete particle when moving between inlet-fluid Pa... | Implement the Python class `InletBase` described below.
Class description:
Implement the InletBase class.
Method signatures and docstrings:
- def __init__(self, inlet_pa, dest_pa, inletinfo, kernel, dim, active_stages=[1], callback=None, ghost_pa=None): An API to add/delete particle when moving between inlet-fluid Pa... | 9bfa8d65cee39fbd470b8231e38e972df199a4da | <|skeleton|>
class InletBase:
def __init__(self, inlet_pa, dest_pa, inletinfo, kernel, dim, active_stages=[1], callback=None, ghost_pa=None):
"""An API to add/delete particle when moving between inlet-fluid Parameters ---------- inlet_pa : particle_array particle array for inlet dest_pa : particle_array pa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class InletBase:
def __init__(self, inlet_pa, dest_pa, inletinfo, kernel, dim, active_stages=[1], callback=None, ghost_pa=None):
"""An API to add/delete particle when moving between inlet-fluid Parameters ---------- inlet_pa : particle_array particle array for inlet dest_pa : particle_array particle_array o... | the_stack_v2_python_sparse | pysph/sph/bc/inlet_outlet_manager.py | fight1314/pysph | train | 3 | |
e3972c50452dfb4c9cd4e35861947da5f0523fcd | [
"try:\n api_key = APIKey.query.filter(APIKey.id == uuid.UUID(api_key_id)).one()\nexcept NoResultFound:\n raise NotFound(\"API key doesn't exist\")\nif not g.auth_user.has_rights(Capabilities.manage_users) and g.auth_user.id != api_key.user_id:\n raise NotFound(\"API key doesn't exist\")\nreturn APIKeyToken... | <|body_start_0|>
try:
api_key = APIKey.query.filter(APIKey.id == uuid.UUID(api_key_id)).one()
except NoResultFound:
raise NotFound("API key doesn't exist")
if not g.auth_user.has_rights(Capabilities.manage_users) and g.auth_user.id != api_key.user_id:
raise No... | APIKeyResource | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class APIKeyResource:
def get(self, api_key_id):
"""--- summary: Get token for API key description: | Returns token for provided API key identifier. Requires `manage_users` capability if current user doesn't own the key. security: - bearerAuth: [] tags: - api_key parameters: - in: path name: a... | stack_v2_sparse_classes_75kplus_train_000575 | 4,871 | no_license | [
{
"docstring": "--- summary: Get token for API key description: | Returns token for provided API key identifier. Requires `manage_users` capability if current user doesn't own the key. security: - bearerAuth: [] tags: - api_key parameters: - in: path name: api_key_id schema: type: string description: API key id... | 2 | stack_v2_sparse_classes_30k_train_045822 | Implement the Python class `APIKeyResource` described below.
Class description:
Implement the APIKeyResource class.
Method signatures and docstrings:
- def get(self, api_key_id): --- summary: Get token for API key description: | Returns token for provided API key identifier. Requires `manage_users` capability if curr... | Implement the Python class `APIKeyResource` described below.
Class description:
Implement the APIKeyResource class.
Method signatures and docstrings:
- def get(self, api_key_id): --- summary: Get token for API key description: | Returns token for provided API key identifier. Requires `manage_users` capability if curr... | f18f56789d2b7db8fdb7e172113a9918b4b72658 | <|skeleton|>
class APIKeyResource:
def get(self, api_key_id):
"""--- summary: Get token for API key description: | Returns token for provided API key identifier. Requires `manage_users` capability if current user doesn't own the key. security: - bearerAuth: [] tags: - api_key parameters: - in: path name: a... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class APIKeyResource:
def get(self, api_key_id):
"""--- summary: Get token for API key description: | Returns token for provided API key identifier. Requires `manage_users` capability if current user doesn't own the key. security: - bearerAuth: [] tags: - api_key parameters: - in: path name: api_key_id sche... | the_stack_v2_python_sparse | resources/api_key.py | dskwhitehat/malwarecage | train | 0 | |
0a2849d5c7cc1a68e097a950290030fe9e92da6b | [
"output = getattr(GridPriorsTRTOp, 'output', None)\nif output is not None:\n return output\ndevice = base_anchors.device\ndtype = base_anchors.dtype\nshift_x = torch.arange(0, feat_w, device=device).to(dtype) * stride_w\nshift_y = torch.arange(0, feat_h, device=device).to(dtype) * stride_h\n\ndef _meshgrid(x, y,... | <|body_start_0|>
output = getattr(GridPriorsTRTOp, 'output', None)
if output is not None:
return output
device = base_anchors.device
dtype = base_anchors.dtype
shift_x = torch.arange(0, feat_w, device=device).to(dtype) * stride_w
shift_y = torch.arange(0, feat... | GridPriorsTRTOp | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GridPriorsTRTOp:
def forward(ctx, base_anchors, feat_h, feat_w, stride_h: int, stride_w: int):
"""Generate grid priors by base anchors."""
<|body_0|>
def symbolic(g, base_anchors, feat_h, feat_w, stride_h: int, stride_w: int):
"""Map ops to onnx symbolics."""
... | stack_v2_sparse_classes_75kplus_train_000576 | 4,157 | permissive | [
{
"docstring": "Generate grid priors by base anchors.",
"name": "forward",
"signature": "def forward(ctx, base_anchors, feat_h, feat_w, stride_h: int, stride_w: int)"
},
{
"docstring": "Map ops to onnx symbolics.",
"name": "symbolic",
"signature": "def symbolic(g, base_anchors, feat_h, f... | 2 | stack_v2_sparse_classes_30k_test_001080 | Implement the Python class `GridPriorsTRTOp` described below.
Class description:
Implement the GridPriorsTRTOp class.
Method signatures and docstrings:
- def forward(ctx, base_anchors, feat_h, feat_w, stride_h: int, stride_w: int): Generate grid priors by base anchors.
- def symbolic(g, base_anchors, feat_h, feat_w, ... | Implement the Python class `GridPriorsTRTOp` described below.
Class description:
Implement the GridPriorsTRTOp class.
Method signatures and docstrings:
- def forward(ctx, base_anchors, feat_h, feat_w, stride_h: int, stride_w: int): Generate grid priors by base anchors.
- def symbolic(g, base_anchors, feat_h, feat_w, ... | 5479c8774f5b88d7ed9d399d4e305cb42cc2e73a | <|skeleton|>
class GridPriorsTRTOp:
def forward(ctx, base_anchors, feat_h, feat_w, stride_h: int, stride_w: int):
"""Generate grid priors by base anchors."""
<|body_0|>
def symbolic(g, base_anchors, feat_h, feat_w, stride_h: int, stride_w: int):
"""Map ops to onnx symbolics."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GridPriorsTRTOp:
def forward(ctx, base_anchors, feat_h, feat_w, stride_h: int, stride_w: int):
"""Generate grid priors by base anchors."""
output = getattr(GridPriorsTRTOp, 'output', None)
if output is not None:
return output
device = base_anchors.device
dty... | the_stack_v2_python_sparse | mmdeploy/codebase/mmdet/models/task_modules/prior_generators/anchor.py | open-mmlab/mmdeploy | train | 2,164 | |
1043faeb1cd06e368b240630a68a24833e0c7233 | [
"self.screen_width = 1200\nself.screen_height = 900\nself.bg_color = (255, 255, 255)\nself.ship_limit = 3\nself.bullet_width = 40\nself.bullet_height = 20\nself.bullet_color = (255, 158, 53)\nself.fleet_drop_speed = 10\nself.speedup_scale = 1.1\nself.score_scale = 1.5\nself.initialize_dynamic_settings()",
"self.s... | <|body_start_0|>
self.screen_width = 1200
self.screen_height = 900
self.bg_color = (255, 255, 255)
self.ship_limit = 3
self.bullet_width = 40
self.bullet_height = 20
self.bullet_color = (255, 158, 53)
self.fleet_drop_speed = 10
self.speedup_scale =... | 初始化游戏设置 | Settings | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Settings:
"""初始化游戏设置"""
def __init__(self):
"""静态设置"""
<|body_0|>
def initialize_dynamic_settings(self):
"""动态设置"""
<|body_1|>
def increase_speed(self):
"""提高速度设置"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
self.screen_w... | stack_v2_sparse_classes_75kplus_train_000577 | 1,677 | no_license | [
{
"docstring": "静态设置",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "动态设置",
"name": "initialize_dynamic_settings",
"signature": "def initialize_dynamic_settings(self)"
},
{
"docstring": "提高速度设置",
"name": "increase_speed",
"signature": "def incre... | 3 | stack_v2_sparse_classes_30k_train_047399 | Implement the Python class `Settings` described below.
Class description:
初始化游戏设置
Method signatures and docstrings:
- def __init__(self): 静态设置
- def initialize_dynamic_settings(self): 动态设置
- def increase_speed(self): 提高速度设置 | Implement the Python class `Settings` described below.
Class description:
初始化游戏设置
Method signatures and docstrings:
- def __init__(self): 静态设置
- def initialize_dynamic_settings(self): 动态设置
- def increase_speed(self): 提高速度设置
<|skeleton|>
class Settings:
"""初始化游戏设置"""
def __init__(self):
"""静态设置"""
... | 6fb41d41e1f55cba46412375e4a947849cadb548 | <|skeleton|>
class Settings:
"""初始化游戏设置"""
def __init__(self):
"""静态设置"""
<|body_0|>
def initialize_dynamic_settings(self):
"""动态设置"""
<|body_1|>
def increase_speed(self):
"""提高速度设置"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Settings:
"""初始化游戏设置"""
def __init__(self):
"""静态设置"""
self.screen_width = 1200
self.screen_height = 900
self.bg_color = (255, 255, 255)
self.ship_limit = 3
self.bullet_width = 40
self.bullet_height = 20
self.bullet_color = (255, 158, 53)
... | the_stack_v2_python_sparse | 飞机大战/setting.py | Daguodong/python-me | train | 1 |
70b0d471aa06e4ca53cee7ddf69dac3f8b21b44c | [
"user = request.user\nif not order_id:\n return redirect(reverse('user:order'))\ntry:\n order = OrderInfo.objects.get(order_id=order_id, user=user)\nexcept OrderInfo.DoesNotExist:\n return redirect(reverse('user:order'))\norder.status_name = OrderInfo.ORDER_STATUS[order.order_status]\norder_skus = OrderGoo... | <|body_start_0|>
user = request.user
if not order_id:
return redirect(reverse('user:order'))
try:
order = OrderInfo.objects.get(order_id=order_id, user=user)
except OrderInfo.DoesNotExist:
return redirect(reverse('user:order'))
order.status_nam... | 订单评论页面 | CommentViews | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommentViews:
"""订单评论页面"""
def get(self, request, order_id):
"""提交评论页面"""
<|body_0|>
def post(self, request, order_id):
"""处理评论内容"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
user = request.user
if not order_id:
return red... | stack_v2_sparse_classes_75kplus_train_000578 | 21,816 | no_license | [
{
"docstring": "提交评论页面",
"name": "get",
"signature": "def get(self, request, order_id)"
},
{
"docstring": "处理评论内容",
"name": "post",
"signature": "def post(self, request, order_id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_023189 | Implement the Python class `CommentViews` described below.
Class description:
订单评论页面
Method signatures and docstrings:
- def get(self, request, order_id): 提交评论页面
- def post(self, request, order_id): 处理评论内容 | Implement the Python class `CommentViews` described below.
Class description:
订单评论页面
Method signatures and docstrings:
- def get(self, request, order_id): 提交评论页面
- def post(self, request, order_id): 处理评论内容
<|skeleton|>
class CommentViews:
"""订单评论页面"""
def get(self, request, order_id):
"""提交评论页面"""
... | ae2b067da0394470269de97e1df52b33465d0de4 | <|skeleton|>
class CommentViews:
"""订单评论页面"""
def get(self, request, order_id):
"""提交评论页面"""
<|body_0|>
def post(self, request, order_id):
"""处理评论内容"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CommentViews:
"""订单评论页面"""
def get(self, request, order_id):
"""提交评论页面"""
user = request.user
if not order_id:
return redirect(reverse('user:order'))
try:
order = OrderInfo.objects.get(order_id=order_id, user=user)
except OrderInfo.DoesNotEx... | the_stack_v2_python_sparse | untitled/6.0-全栈开发阶段/Django框架/dailyfresh/apps/order/views.py | giant-xf/python | train | 0 |
e4e134af1fc2cc25a64983c1c94a2ed4c44d1373 | [
"self.n_bins = n_bins\nself.bins = np.linspace(0, 255, n_bins + 1)\nself.alpha = alpha",
"rgb_image = image.convert('RGB').resize((50, 50), resample=Image.NEAREST)\npixel_array = np.array(rgb_image).reshape(-1, 3)\nrepeated_pixel_array = np.repeat(pixel_array, 10, axis=0)\nnoise = np.random.normal(0, self.alpha, ... | <|body_start_0|>
self.n_bins = n_bins
self.bins = np.linspace(0, 255, n_bins + 1)
self.alpha = alpha
<|end_body_0|>
<|body_start_1|>
rgb_image = image.convert('RGB').resize((50, 50), resample=Image.NEAREST)
pixel_array = np.array(rgb_image).reshape(-1, 3)
repeated_pixel_... | A class for embedding color information from an image. | ColorEmbedder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ColorEmbedder:
"""A class for embedding color information from an image."""
def __init__(self, n_bins: int=8, alpha: float=5):
"""Initialize the ColorEmbedder object. Args: n_bins (int): Number of color bins to use. alpha (float): Standard deviation of the noise added to each pixel."... | stack_v2_sparse_classes_75kplus_train_000579 | 2,172 | permissive | [
{
"docstring": "Initialize the ColorEmbedder object. Args: n_bins (int): Number of color bins to use. alpha (float): Standard deviation of the noise added to each pixel.",
"name": "__init__",
"signature": "def __init__(self, n_bins: int=8, alpha: float=5)"
},
{
"docstring": "Embed color informat... | 2 | stack_v2_sparse_classes_30k_train_021360 | Implement the Python class `ColorEmbedder` described below.
Class description:
A class for embedding color information from an image.
Method signatures and docstrings:
- def __init__(self, n_bins: int=8, alpha: float=5): Initialize the ColorEmbedder object. Args: n_bins (int): Number of color bins to use. alpha (floa... | Implement the Python class `ColorEmbedder` described below.
Class description:
A class for embedding color information from an image.
Method signatures and docstrings:
- def __init__(self, n_bins: int=8, alpha: float=5): Initialize the ColorEmbedder object. Args: n_bins (int): Number of color bins to use. alpha (floa... | f5d158de6d4d652e7264093c64420288ecb6a85b | <|skeleton|>
class ColorEmbedder:
"""A class for embedding color information from an image."""
def __init__(self, n_bins: int=8, alpha: float=5):
"""Initialize the ColorEmbedder object. Args: n_bins (int): Number of color bins to use. alpha (float): Standard deviation of the noise added to each pixel."... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ColorEmbedder:
"""A class for embedding color information from an image."""
def __init__(self, n_bins: int=8, alpha: float=5):
"""Initialize the ColorEmbedder object. Args: n_bins (int): Number of color bins to use. alpha (float): Standard deviation of the noise added to each pixel."""
se... | the_stack_v2_python_sparse | knn-colours/pipeline/src/embedder.py | wellcomecollection/data-science | train | 7 |
081bbd7386bcafd573a7aa2e7b714512ab97c73b | [
"super().__init__(self.PROBLEM_NAME)\nself.input_string = input_string\nself.needle = needle",
"print('Solving {} problem ...'.format(self.PROBLEM_NAME))\nif len(self.input_string) == 0 or len(self.needle) == 0:\n return 0\nif len(self.needle) > len(self.input_string):\n return self.NOT_FOUND\ninput_len = l... | <|body_start_0|>
super().__init__(self.PROBLEM_NAME)
self.input_string = input_string
self.needle = needle
<|end_body_0|>
<|body_start_1|>
print('Solving {} problem ...'.format(self.PROBLEM_NAME))
if len(self.input_string) == 0 or len(self.needle) == 0:
return 0
... | StrStr | StrStr | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StrStr:
"""StrStr"""
def __init__(self, input_string, needle):
"""StrStr Args: input_string: haystack needle: to be searched in the haystack Returns: None Raises: None"""
<|body_0|>
def solve(self):
"""Solve the problem Note: O(nm) runtime solution works by itera... | stack_v2_sparse_classes_75kplus_train_000580 | 2,678 | no_license | [
{
"docstring": "StrStr Args: input_string: haystack needle: to be searched in the haystack Returns: None Raises: None",
"name": "__init__",
"signature": "def __init__(self, input_string, needle)"
},
{
"docstring": "Solve the problem Note: O(nm) runtime solution works by iterating the input_strin... | 2 | stack_v2_sparse_classes_30k_train_052856 | Implement the Python class `StrStr` described below.
Class description:
StrStr
Method signatures and docstrings:
- def __init__(self, input_string, needle): StrStr Args: input_string: haystack needle: to be searched in the haystack Returns: None Raises: None
- def solve(self): Solve the problem Note: O(nm) runtime so... | Implement the Python class `StrStr` described below.
Class description:
StrStr
Method signatures and docstrings:
- def __init__(self, input_string, needle): StrStr Args: input_string: haystack needle: to be searched in the haystack Returns: None Raises: None
- def solve(self): Solve the problem Note: O(nm) runtime so... | 11f4d25cb211740514c119a60962d075a0817abd | <|skeleton|>
class StrStr:
"""StrStr"""
def __init__(self, input_string, needle):
"""StrStr Args: input_string: haystack needle: to be searched in the haystack Returns: None Raises: None"""
<|body_0|>
def solve(self):
"""Solve the problem Note: O(nm) runtime solution works by itera... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StrStr:
"""StrStr"""
def __init__(self, input_string, needle):
"""StrStr Args: input_string: haystack needle: to be searched in the haystack Returns: None Raises: None"""
super().__init__(self.PROBLEM_NAME)
self.input_string = input_string
self.needle = needle
def sol... | the_stack_v2_python_sparse | python/problems/string/strstr.py | santhosh-kumar/AlgorithmsAndDataStructures | train | 2 |
e3eae854e9f84efcaf06bf64ba15bddc09275ad3 | [
"self.glasses = glasses\nself.matrix_bitmap = self.ring_bitmap = None\nself.rings_on_top = rings_on_top\nif matrix_filename:\n self.matrix_bitmap, self.matrix_palette = adafruit_imageload.load(matrix_filename, bitmap=displayio.Bitmap, palette=displayio.Palette)\n if self.matrix_bitmap.width < glasses.width or... | <|body_start_0|>
self.glasses = glasses
self.matrix_bitmap = self.ring_bitmap = None
self.rings_on_top = rings_on_top
if matrix_filename:
self.matrix_bitmap, self.matrix_palette = adafruit_imageload.load(matrix_filename, bitmap=displayio.Bitmap, palette=displayio.Palette)
... | Class encapsulating BMP image-based frame animation for the matrix and rings of an LED_Glasses object. | EyeLightsAnim | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EyeLightsAnim:
"""Class encapsulating BMP image-based frame animation for the matrix and rings of an LED_Glasses object."""
def __init__(self, glasses, matrix_filename, ring_filename, rings_on_top=True):
"""Constructor for EyeLightsAnim. Accepts an LED_Glasses object and filenames fo... | stack_v2_sparse_classes_75kplus_train_000581 | 6,892 | permissive | [
{
"docstring": "Constructor for EyeLightsAnim. Accepts an LED_Glasses object and filenames for two indexed-color BMP images: first is a \"sprite sheet\" for animating on the matrix portion of the glasses, second is a pixels-over-time graph for the rings portion. Either filename may be None if not used. Because ... | 4 | stack_v2_sparse_classes_30k_train_002713 | Implement the Python class `EyeLightsAnim` described below.
Class description:
Class encapsulating BMP image-based frame animation for the matrix and rings of an LED_Glasses object.
Method signatures and docstrings:
- def __init__(self, glasses, matrix_filename, ring_filename, rings_on_top=True): Constructor for EyeL... | Implement the Python class `EyeLightsAnim` described below.
Class description:
Class encapsulating BMP image-based frame animation for the matrix and rings of an LED_Glasses object.
Method signatures and docstrings:
- def __init__(self, glasses, matrix_filename, ring_filename, rings_on_top=True): Constructor for EyeL... | 5eaa7a15a437c533b89f359a25983e24bb6b5438 | <|skeleton|>
class EyeLightsAnim:
"""Class encapsulating BMP image-based frame animation for the matrix and rings of an LED_Glasses object."""
def __init__(self, glasses, matrix_filename, ring_filename, rings_on_top=True):
"""Constructor for EyeLightsAnim. Accepts an LED_Glasses object and filenames fo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EyeLightsAnim:
"""Class encapsulating BMP image-based frame animation for the matrix and rings of an LED_Glasses object."""
def __init__(self, glasses, matrix_filename, ring_filename, rings_on_top=True):
"""Constructor for EyeLightsAnim. Accepts an LED_Glasses object and filenames for two indexed... | the_stack_v2_python_sparse | EyeLights_BMP_Animation/eyelights_anim.py | adafruit/Adafruit_Learning_System_Guides | train | 937 |
45a2b73b5b66b0059ee6dcbfeac393737c946a39 | [
"super().__init__(pos_enc_class)\nself.conv = nn.Sequential(Conv2D(1, odim, 3, 2), nn.ReLU(), Conv2D(odim, odim, 3, 2), nn.ReLU(), Conv2D(odim, odim, 3, 2), nn.ReLU())\nself.linear = Linear(odim * ((((idim - 1) // 2 - 1) // 2 - 1) // 2), odim)\nself.subsampling_rate = 8\nself.right_context = 14",
"x = x.unsqueeze... | <|body_start_0|>
super().__init__(pos_enc_class)
self.conv = nn.Sequential(Conv2D(1, odim, 3, 2), nn.ReLU(), Conv2D(odim, odim, 3, 2), nn.ReLU(), Conv2D(odim, odim, 3, 2), nn.ReLU())
self.linear = Linear(odim * ((((idim - 1) // 2 - 1) // 2 - 1) // 2), odim)
self.subsampling_rate = 8
... | Convolutional 2D subsampling (to 1/8 length). | Conv2dSubsampling8 | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Conv2dSubsampling8:
"""Convolutional 2D subsampling (to 1/8 length)."""
def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding):
"""Construct an Conv2dSubsampling8 object. Args: idim (int): Input dimension. odim (int): Output dimensio... | stack_v2_sparse_classes_75kplus_train_000582 | 11,942 | permissive | [
{
"docstring": "Construct an Conv2dSubsampling8 object. Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate.",
"name": "__init__",
"signature": "def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding)"
},... | 2 | stack_v2_sparse_classes_30k_train_011455 | Implement the Python class `Conv2dSubsampling8` described below.
Class description:
Convolutional 2D subsampling (to 1/8 length).
Method signatures and docstrings:
- def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding): Construct an Conv2dSubsampling8 object. Args:... | Implement the Python class `Conv2dSubsampling8` described below.
Class description:
Convolutional 2D subsampling (to 1/8 length).
Method signatures and docstrings:
- def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding): Construct an Conv2dSubsampling8 object. Args:... | 17854a04d43c231eff66bfed9d6aa55e94a29e79 | <|skeleton|>
class Conv2dSubsampling8:
"""Convolutional 2D subsampling (to 1/8 length)."""
def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding):
"""Construct an Conv2dSubsampling8 object. Args: idim (int): Input dimension. odim (int): Output dimensio... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Conv2dSubsampling8:
"""Convolutional 2D subsampling (to 1/8 length)."""
def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding):
"""Construct an Conv2dSubsampling8 object. Args: idim (int): Input dimension. odim (int): Output dimension. dropout_ra... | the_stack_v2_python_sparse | paddlespeech/s2t/modules/subsampling.py | anniyanvr/DeepSpeech-1 | train | 0 |
0c21b6384b213aa1857f1fc126afe7dc6d635180 | [
"if site_meters is ElecMeter:\n self._check_meter(site_meters)\n if not site_meters.metadata['site_meter']:\n raise RuntimeError('Only site meters can be disaggregated')\nelse:\n for meter in site_meters.all_elecmeters():\n self._check_meter(meter)\n if not ('site_meter' in meter.metad... | <|body_start_0|>
if site_meters is ElecMeter:
self._check_meter(site_meters)
if not site_meters.metadata['site_meter']:
raise RuntimeError('Only site meters can be disaggregated')
else:
for meter in site_meters.all_elecmeters():
self._c... | This is the baseclass for all predictors which process ElecMeters. At the moment disaggregator, clustering and forecasting inherits from this class. Do not confuse it with the node system which is only used for calculating the stats. | Processing | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Processing:
"""This is the baseclass for all predictors which process ElecMeters. At the moment disaggregator, clustering and forecasting inherits from this class. Do not confuse it with the node system which is only used for calculating the stats."""
def _pre_disaggregation_checks(self, sit... | stack_v2_sparse_classes_75kplus_train_000583 | 2,789 | permissive | [
{
"docstring": "This is the basic check, which is called before disaggregation is performed. It takes care. site_meters: A Group of site meters or a single site-meter",
"name": "_pre_disaggregation_checks",
"signature": "def _pre_disaggregation_checks(self, site_meters, load_kwargs)"
},
{
"docst... | 2 | stack_v2_sparse_classes_30k_test_001469 | Implement the Python class `Processing` described below.
Class description:
This is the baseclass for all predictors which process ElecMeters. At the moment disaggregator, clustering and forecasting inherits from this class. Do not confuse it with the node system which is only used for calculating the stats.
Method s... | Implement the Python class `Processing` described below.
Class description:
This is the baseclass for all predictors which process ElecMeters. At the moment disaggregator, clustering and forecasting inherits from this class. Do not confuse it with the node system which is only used for calculating the stats.
Method s... | e9b06bcb43a40010ccc40a534a7067ee520fb3a7 | <|skeleton|>
class Processing:
"""This is the baseclass for all predictors which process ElecMeters. At the moment disaggregator, clustering and forecasting inherits from this class. Do not confuse it with the node system which is only used for calculating the stats."""
def _pre_disaggregation_checks(self, sit... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Processing:
"""This is the baseclass for all predictors which process ElecMeters. At the moment disaggregator, clustering and forecasting inherits from this class. Do not confuse it with the node system which is only used for calculating the stats."""
def _pre_disaggregation_checks(self, site_meters, loa... | the_stack_v2_python_sparse | nilmtk/processing.py | BaluJr/energytk | train | 3 |
49ba12575e52a72c8c6b54a780c26eb1d0c2627d | [
"self.mobile_screen_width = mobile_screen_width\nself.mobile_brand = mobile_brand\nself.mobile_model = mobile_model\nself.producer = producer\nself.browser_name = browser_name\nself.mobile_screen_height = mobile_screen_height\nself.is_mobile = is_mobile\nself.mtype = mtype\nself.version = version\nself.operating_sy... | <|body_start_0|>
self.mobile_screen_width = mobile_screen_width
self.mobile_brand = mobile_brand
self.mobile_model = mobile_model
self.producer = producer
self.browser_name = browser_name
self.mobile_screen_height = mobile_screen_height
self.is_mobile = is_mobile
... | Implementation of the 'User Agent Info Response' model. TODO: type model description here. Attributes: mobile_screen_width (int): The estimated mobile device screen width in CSS 'px' mobile_brand (string): The mobile device brand mobile_model (string): The mobile device model producer (string): The producer or manufact... | UserAgentInfoResponse | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserAgentInfoResponse:
"""Implementation of the 'User Agent Info Response' model. TODO: type model description here. Attributes: mobile_screen_width (int): The estimated mobile device screen width in CSS 'px' mobile_brand (string): The mobile device brand mobile_model (string): The mobile device ... | stack_v2_sparse_classes_75kplus_train_000584 | 6,503 | permissive | [
{
"docstring": "Constructor for the UserAgentInfoResponse class",
"name": "__init__",
"signature": "def __init__(self, mobile_screen_width=None, mobile_brand=None, mobile_model=None, producer=None, browser_name=None, mobile_screen_height=None, is_mobile=None, mtype=None, version=None, operating_system=N... | 2 | stack_v2_sparse_classes_30k_train_029205 | Implement the Python class `UserAgentInfoResponse` described below.
Class description:
Implementation of the 'User Agent Info Response' model. TODO: type model description here. Attributes: mobile_screen_width (int): The estimated mobile device screen width in CSS 'px' mobile_brand (string): The mobile device brand mo... | Implement the Python class `UserAgentInfoResponse` described below.
Class description:
Implementation of the 'User Agent Info Response' model. TODO: type model description here. Attributes: mobile_screen_width (int): The estimated mobile device screen width in CSS 'px' mobile_brand (string): The mobile device brand mo... | cc00933eefef0f40710f606e9fbf2dfb97a4f063 | <|skeleton|>
class UserAgentInfoResponse:
"""Implementation of the 'User Agent Info Response' model. TODO: type model description here. Attributes: mobile_screen_width (int): The estimated mobile device screen width in CSS 'px' mobile_brand (string): The mobile device brand mobile_model (string): The mobile device ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UserAgentInfoResponse:
"""Implementation of the 'User Agent Info Response' model. TODO: type model description here. Attributes: mobile_screen_width (int): The estimated mobile device screen width in CSS 'px' mobile_brand (string): The mobile device brand mobile_model (string): The mobile device model produce... | the_stack_v2_python_sparse | neutrino_api/models/user_agent_info_response.py | NeutrinoAPI/NeutrinoAPI-Python | train | 3 |
5d174308acc7b76624688f52b6a6eb2f1dde29a1 | [
"deps = []\nif value is None:\n value = self.value\nif isinstance(value, str):\n for jinja_blk in REGEX_JINJA2.findall(value):\n for var_name in REGEX_VAR.findall(value):\n dep_name = REGEX_VAR_STRIP.sub('', var_name)\n deps.append(dep_name)\nelif isinstance(value, dict):\n for... | <|body_start_0|>
deps = []
if value is None:
value = self.value
if isinstance(value, str):
for jinja_blk in REGEX_JINJA2.findall(value):
for var_name in REGEX_VAR.findall(value):
dep_name = REGEX_VAR_STRIP.sub('', var_name)
... | Variable node implementation | VarNode | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VarNode:
"""Variable node implementation"""
def calc_deps(self, value=None):
"""Calculate dependencies for this node :param value: value to be evaluated for dependencies"""
<|body_0|>
def _render(value, deps):
"""Render a string through jinja2 :param value: value... | stack_v2_sparse_classes_75kplus_train_000585 | 8,989 | permissive | [
{
"docstring": "Calculate dependencies for this node :param value: value to be evaluated for dependencies",
"name": "calc_deps",
"signature": "def calc_deps(self, value=None)"
},
{
"docstring": "Render a string through jinja2 :param value: value to be rendered :param deps: a list of variables to... | 3 | null | Implement the Python class `VarNode` described below.
Class description:
Variable node implementation
Method signatures and docstrings:
- def calc_deps(self, value=None): Calculate dependencies for this node :param value: value to be evaluated for dependencies
- def _render(value, deps): Render a string through jinja... | Implement the Python class `VarNode` described below.
Class description:
Variable node implementation
Method signatures and docstrings:
- def calc_deps(self, value=None): Calculate dependencies for this node :param value: value to be evaluated for dependencies
- def _render(value, deps): Render a string through jinja... | 55af63f3250823b8a400234b75887e69a5f1eeae | <|skeleton|>
class VarNode:
"""Variable node implementation"""
def calc_deps(self, value=None):
"""Calculate dependencies for this node :param value: value to be evaluated for dependencies"""
<|body_0|>
def _render(value, deps):
"""Render a string through jinja2 :param value: value... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VarNode:
"""Variable node implementation"""
def calc_deps(self, value=None):
"""Calculate dependencies for this node :param value: value to be evaluated for dependencies"""
deps = []
if value is None:
value = self.value
if isinstance(value, str):
fo... | the_stack_v2_python_sparse | zenfig/renderer.py | axltxl/zenfig | train | 0 |
4e2ed3a6116697bba605177a0604edffdd610b56 | [
"loc = [(i - 1, j - 1), (i - 1, j), (i - 1, j + 1), (i, j - 1), (i, j), (i, j + 1), (i + 1, j - 1), (i + 1, j), (i + 1, j + 1)]\nsum_i = 0\ncnt_i = 0\nfor k in loc:\n if new_arr[k[0]][k[1]] != add_i:\n cnt_i += 1\n sum_i += new_arr[k[0]][k[1]]\nM[i - 1][j - 1] = math.floor(sum_i / cnt_i)",
"new_a... | <|body_start_0|>
loc = [(i - 1, j - 1), (i - 1, j), (i - 1, j + 1), (i, j - 1), (i, j), (i, j + 1), (i + 1, j - 1), (i + 1, j), (i + 1, j + 1)]
sum_i = 0
cnt_i = 0
for k in loc:
if new_arr[k[0]][k[1]] != add_i:
cnt_i += 1
sum_i += new_arr[k[0]]... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def add_square(self, i, j, new_arr, M):
"""遍历 new_arr 元素,将对应的 M 中元素 M[i-1][j-1] 修改为平均值"""
<|body_0|>
def imageSmoother(self, M):
""":type M: List[List[int]] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
loc = [(i ... | stack_v2_sparse_classes_75kplus_train_000586 | 1,288 | no_license | [
{
"docstring": "遍历 new_arr 元素,将对应的 M 中元素 M[i-1][j-1] 修改为平均值",
"name": "add_square",
"signature": "def add_square(self, i, j, new_arr, M)"
},
{
"docstring": ":type M: List[List[int]] :rtype: List[List[int]]",
"name": "imageSmoother",
"signature": "def imageSmoother(self, M)"
}
] | 2 | stack_v2_sparse_classes_30k_train_028800 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def add_square(self, i, j, new_arr, M): 遍历 new_arr 元素,将对应的 M 中元素 M[i-1][j-1] 修改为平均值
- def imageSmoother(self, M): :type M: List[List[int]] :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def add_square(self, i, j, new_arr, M): 遍历 new_arr 元素,将对应的 M 中元素 M[i-1][j-1] 修改为平均值
- def imageSmoother(self, M): :type M: List[List[int]] :rtype: List[List[int]]
<|skeleton|>
c... | c37f44f71a0e266aa8078c95506e6aa54ce4660c | <|skeleton|>
class Solution:
def add_square(self, i, j, new_arr, M):
"""遍历 new_arr 元素,将对应的 M 中元素 M[i-1][j-1] 修改为平均值"""
<|body_0|>
def imageSmoother(self, M):
""":type M: List[List[int]] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def add_square(self, i, j, new_arr, M):
"""遍历 new_arr 元素,将对应的 M 中元素 M[i-1][j-1] 修改为平均值"""
loc = [(i - 1, j - 1), (i - 1, j), (i - 1, j + 1), (i, j - 1), (i, j), (i, j + 1), (i + 1, j - 1), (i + 1, j), (i + 1, j + 1)]
sum_i = 0
cnt_i = 0
for k in loc:
... | the_stack_v2_python_sparse | 661. Image Smoother/661.py | hotheat/LeetCode | train | 2 | |
dd5e067bdd138e92ad3cb25a5410c843c1b94202 | [
"self.scanner_name = 'container-capabilities-scanner'\nself.full_scanner_name = 'registry.centos.org/pipeline-images/container-capabilities-scanner'\nself.scan_types = ['check-capabilities']",
"logs = []\nsuper(ContainerCapabilities, self).__init__(image_under_test=image_under_test, scanner_name=self.scanner_name... | <|body_start_0|>
self.scanner_name = 'container-capabilities-scanner'
self.full_scanner_name = 'registry.centos.org/pipeline-images/container-capabilities-scanner'
self.scan_types = ['check-capabilities']
<|end_body_0|>
<|body_start_1|>
logs = []
super(ContainerCapabilities, sel... | Container Capabilities scan. | ContainerCapabilities | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContainerCapabilities:
"""Container Capabilities scan."""
def __init__(self):
"""Scanner name and types."""
<|body_0|>
def scan(self, image_under_test):
"""Run the scanner on image under test."""
<|body_1|>
def process_output(self, logs):
"""... | stack_v2_sparse_classes_75kplus_train_000587 | 2,140 | no_license | [
{
"docstring": "Scanner name and types.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Run the scanner on image under test.",
"name": "scan",
"signature": "def scan(self, image_under_test)"
},
{
"docstring": "Process the output logs to send to other wo... | 3 | stack_v2_sparse_classes_30k_train_044770 | Implement the Python class `ContainerCapabilities` described below.
Class description:
Container Capabilities scan.
Method signatures and docstrings:
- def __init__(self): Scanner name and types.
- def scan(self, image_under_test): Run the scanner on image under test.
- def process_output(self, logs): Process the out... | Implement the Python class `ContainerCapabilities` described below.
Class description:
Container Capabilities scan.
Method signatures and docstrings:
- def __init__(self): Scanner name and types.
- def scan(self, image_under_test): Run the scanner on image under test.
- def process_output(self, logs): Process the out... | 4b59184c3453ae706d5e352306fe9e551c90dc41 | <|skeleton|>
class ContainerCapabilities:
"""Container Capabilities scan."""
def __init__(self):
"""Scanner name and types."""
<|body_0|>
def scan(self, image_under_test):
"""Run the scanner on image under test."""
<|body_1|>
def process_output(self, logs):
"""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ContainerCapabilities:
"""Container Capabilities scan."""
def __init__(self):
"""Scanner name and types."""
self.scanner_name = 'container-capabilities-scanner'
self.full_scanner_name = 'registry.centos.org/pipeline-images/container-capabilities-scanner'
self.scan_types = ... | the_stack_v2_python_sparse | container_pipeline/scanners/container_capabilities.py | eupraxialabs/container-pipeline-service | train | 0 |
671c000f0bb9de65ab4752a58280c50d26a0670b | [
"self.status = status\nself.destination_address = destination_address\nself.sender_address = sender_address\nself.message = message\nself.message_id = message_id\nself.sent_timestamp = sent_timestamp",
"if dictionary is None:\n return None\nstatus = dictionary.get('status')\ndestination_address = dictionary.ge... | <|body_start_0|>
self.status = status
self.destination_address = destination_address
self.sender_address = sender_address
self.message = message
self.message_id = message_id
self.sent_timestamp = sent_timestamp
<|end_body_0|>
<|body_start_1|>
if dictionary is Non... | Implementation of the 'InboundPollResponse' model. Poll for incoming messages returning the latest. Only works if no callback url was specified when provisioning a number. Attributes: status (string): message status destination_address (string): The phone number (recipient) that the message was sent to(in E.164 format)... | InboundPollResponse | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InboundPollResponse:
"""Implementation of the 'InboundPollResponse' model. Poll for incoming messages returning the latest. Only works if no callback url was specified when provisioning a number. Attributes: status (string): message status destination_address (string): The phone number (recipient... | stack_v2_sparse_classes_75kplus_train_000588 | 2,948 | no_license | [
{
"docstring": "Constructor for the InboundPollResponse class",
"name": "__init__",
"signature": "def __init__(self, status=None, destination_address=None, sender_address=None, message=None, message_id=None, sent_timestamp=None)"
},
{
"docstring": "Creates an instance of this model from a dictio... | 2 | stack_v2_sparse_classes_30k_train_009729 | Implement the Python class `InboundPollResponse` described below.
Class description:
Implementation of the 'InboundPollResponse' model. Poll for incoming messages returning the latest. Only works if no callback url was specified when provisioning a number. Attributes: status (string): message status destination_addres... | Implement the Python class `InboundPollResponse` described below.
Class description:
Implementation of the 'InboundPollResponse' model. Poll for incoming messages returning the latest. Only works if no callback url was specified when provisioning a number. Attributes: status (string): message status destination_addres... | c5d8eefa4f7fa20adad9380a19ba1bec55bf7ab2 | <|skeleton|>
class InboundPollResponse:
"""Implementation of the 'InboundPollResponse' model. Poll for incoming messages returning the latest. Only works if no callback url was specified when provisioning a number. Attributes: status (string): message status destination_address (string): The phone number (recipient... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class InboundPollResponse:
"""Implementation of the 'InboundPollResponse' model. Poll for incoming messages returning the latest. Only works if no callback url was specified when provisioning a number. Attributes: status (string): message status destination_address (string): The phone number (recipient) that the me... | the_stack_v2_python_sparse | venv/Lib/site-packages/pythonwithgittest/models/inbound_poll_response.py | OT-seven/HKCostPlatformTest | train | 0 |
bfccd9849121a0bf238fa5fbf81486481742c25e | [
"model_filters = {'is_expired': False}\njobs = paginate(request=request, model=Job, model_filters=model_filters)\njob_fields = ['title', 'company', 'company_slug', 'pk', ('short_description', lambda obj: obj.get_short_description()), ('date_created', lambda obj: obj.date_created.ctime()), ('company_url', lambda obj... | <|body_start_0|>
model_filters = {'is_expired': False}
jobs = paginate(request=request, model=Job, model_filters=model_filters)
job_fields = ['title', 'company', 'company_slug', 'pk', ('short_description', lambda obj: obj.get_short_description()), ('date_created', lambda obj: obj.date_created.ct... | API endpoint for getting a list of current job postings, and creating new jobs posts. | JobList | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JobList:
"""API endpoint for getting a list of current job postings, and creating new jobs posts."""
def get(self, request, *args, **kwargs):
"""Endpoint for getting jobs"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Endpoint for creating a new job o... | stack_v2_sparse_classes_75kplus_train_000589 | 6,218 | no_license | [
{
"docstring": "Endpoint for getting jobs",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "Endpoint for creating a new job or updating an existing job.",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_041419 | Implement the Python class `JobList` described below.
Class description:
API endpoint for getting a list of current job postings, and creating new jobs posts.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Endpoint for getting jobs
- def post(self, request, *args, **kwargs): Endpoint for... | Implement the Python class `JobList` described below.
Class description:
API endpoint for getting a list of current job postings, and creating new jobs posts.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Endpoint for getting jobs
- def post(self, request, *args, **kwargs): Endpoint for... | b219178697242e5ac1b0a210c67d599febaa0763 | <|skeleton|>
class JobList:
"""API endpoint for getting a list of current job postings, and creating new jobs posts."""
def get(self, request, *args, **kwargs):
"""Endpoint for getting jobs"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Endpoint for creating a new job o... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class JobList:
"""API endpoint for getting a list of current job postings, and creating new jobs posts."""
def get(self, request, *args, **kwargs):
"""Endpoint for getting jobs"""
model_filters = {'is_expired': False}
jobs = paginate(request=request, model=Job, model_filters=model_filte... | the_stack_v2_python_sparse | BoulderDjangoDev/jobs/views.py | pydeveloper94/BoulderDjangoDev | train | 0 |
31cdd1c0889a85e97e568dd24d8b79e3b42a017d | [
"if not hasattr(self, 'title_written'):\n self.write(title_string.strip() + os.linesep)\n self.title_written = True",
"self.natom = natom\nif not hasattr(self, 'header_written'):\n self.write('%5d%15.7E' % (natom, time) + os.linesep)\n self.header_written = True",
"if not hasattr(self, 'title_writte... | <|body_start_0|>
if not hasattr(self, 'title_written'):
self.write(title_string.strip() + os.linesep)
self.title_written = True
<|end_body_0|>
<|body_start_1|>
self.natom = natom
if not hasattr(self, 'header_written'):
self.write('%5d%15.7E' % (natom, time) +... | Amber Restart file has a fixed format | AmberRestart | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AmberRestart:
"""Amber Restart file has a fixed format"""
def write_title(self, title_string='Restart generated by %s' % os.path.split(sys.argv[0])[1]):
"""Writes the title of the restart file"""
<|body_0|>
def write_header(self, natom, time=0.0):
"""Writes the h... | stack_v2_sparse_classes_75kplus_train_000590 | 12,306 | no_license | [
{
"docstring": "Writes the title of the restart file",
"name": "write_title",
"signature": "def write_title(self, title_string='Restart generated by %s' % os.path.split(sys.argv[0])[1])"
},
{
"docstring": "Writes the header of the file with natom, time",
"name": "write_header",
"signatur... | 5 | stack_v2_sparse_classes_30k_train_016812 | Implement the Python class `AmberRestart` described below.
Class description:
Amber Restart file has a fixed format
Method signatures and docstrings:
- def write_title(self, title_string='Restart generated by %s' % os.path.split(sys.argv[0])[1]): Writes the title of the restart file
- def write_header(self, natom, ti... | Implement the Python class `AmberRestart` described below.
Class description:
Amber Restart file has a fixed format
Method signatures and docstrings:
- def write_title(self, title_string='Restart generated by %s' % os.path.split(sys.argv[0])[1]): Writes the title of the restart file
- def write_header(self, natom, ti... | 0b51032582a2ee55b06a150009bb898e2b976606 | <|skeleton|>
class AmberRestart:
"""Amber Restart file has a fixed format"""
def write_title(self, title_string='Restart generated by %s' % os.path.split(sys.argv[0])[1]):
"""Writes the title of the restart file"""
<|body_0|>
def write_header(self, natom, time=0.0):
"""Writes the h... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AmberRestart:
"""Amber Restart file has a fixed format"""
def write_title(self, title_string='Restart generated by %s' % os.path.split(sys.argv[0])[1]):
"""Writes the title of the restart file"""
if not hasattr(self, 'title_written'):
self.write(title_string.strip() + os.lines... | the_stack_v2_python_sparse | clusters/frank/get_restarts.py | Computational-Chemistry-Research/personal_scripts | train | 0 |
f8bc0a3499add21413fe1b476454e413a99de115 | [
"super().__init__(grid)\nif grid.at_node['flow__receiver_node'].size != grid.size('node'):\n raise NotImplementedError('A route-to-multiple flow director has been run on this grid. The landlab development team has not verified that TransportLengthHillslopeDiffuser is compatible with route-to-multiple methods. Pl... | <|body_start_0|>
super().__init__(grid)
if grid.at_node['flow__receiver_node'].size != grid.size('node'):
raise NotImplementedError('A route-to-multiple flow director has been run on this grid. The landlab development team has not verified that TransportLengthHillslopeDiffuser is compatible ... | Transport length hillslope diffusion. Hillslope diffusion component in the style of Carretier et al. (2016, ESurf), and Davy and Lague (2009) .. math:: \\frac{dz}{dt} = -E + D (+ U) D = \\frac{q_s}{L} E = k S L = \\frac{dx}{(1 - (S / S_c)^2} Works on regular raster-type grid (RasterModelGrid, dx=dy). To be coupled with... | TransportLengthHillslopeDiffuser | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TransportLengthHillslopeDiffuser:
"""Transport length hillslope diffusion. Hillslope diffusion component in the style of Carretier et al. (2016, ESurf), and Davy and Lague (2009) .. math:: \\frac{dz}{dt} = -E + D (+ U) D = \\frac{q_s}{L} E = k S L = \\frac{dx}{(1 - (S / S_c)^2} Works on regular r... | stack_v2_sparse_classes_75kplus_train_000591 | 10,760 | permissive | [
{
"docstring": "Initialize Diffuser. Parameters ---------- grid : ModelGrid Landlab ModelGrid object erodibility: float Erodibility coefficient [L/T] slope_crit: float (default=1.) Critical slope [L/L]",
"name": "__init__",
"signature": "def __init__(self, grid, erodibility=0.001, slope_crit=1.0)"
},
... | 3 | stack_v2_sparse_classes_30k_train_003759 | Implement the Python class `TransportLengthHillslopeDiffuser` described below.
Class description:
Transport length hillslope diffusion. Hillslope diffusion component in the style of Carretier et al. (2016, ESurf), and Davy and Lague (2009) .. math:: \\frac{dz}{dt} = -E + D (+ U) D = \\frac{q_s}{L} E = k S L = \\frac{d... | Implement the Python class `TransportLengthHillslopeDiffuser` described below.
Class description:
Transport length hillslope diffusion. Hillslope diffusion component in the style of Carretier et al. (2016, ESurf), and Davy and Lague (2009) .. math:: \\frac{dz}{dt} = -E + D (+ U) D = \\frac{q_s}{L} E = k S L = \\frac{d... | 1cd72e5832ece1aa922cd1b239e2e94ed0f11f8b | <|skeleton|>
class TransportLengthHillslopeDiffuser:
"""Transport length hillslope diffusion. Hillslope diffusion component in the style of Carretier et al. (2016, ESurf), and Davy and Lague (2009) .. math:: \\frac{dz}{dt} = -E + D (+ U) D = \\frac{q_s}{L} E = k S L = \\frac{dx}{(1 - (S / S_c)^2} Works on regular r... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TransportLengthHillslopeDiffuser:
"""Transport length hillslope diffusion. Hillslope diffusion component in the style of Carretier et al. (2016, ESurf), and Davy and Lague (2009) .. math:: \\frac{dz}{dt} = -E + D (+ U) D = \\frac{q_s}{L} E = k S L = \\frac{dx}{(1 - (S / S_c)^2} Works on regular raster-type gr... | the_stack_v2_python_sparse | landlab/components/transport_length_diffusion/transport_length_hillslope_diffusion.py | landlab/landlab | train | 326 |
2d2be295ae22ec7be495e9bebc28f5283928e949 | [
"self.significance = None\nself._decimalSeparator = decimalSeparator\nif decimalSeparator not in ['.', ',']:\n raise ValueError('invalid decimalSeparator: {}'.format(decimalSeparator))\nval = ''\nif default is not None and default != '':\n if not isinstance(default, (int, str, Decimal)):\n raise ValueE... | <|body_start_0|>
self.significance = None
self._decimalSeparator = decimalSeparator
if decimalSeparator not in ['.', ',']:
raise ValueError('invalid decimalSeparator: {}'.format(decimalSeparator))
val = ''
if default is not None and default != '':
if not i... | Edit widget for float values. | FloatEdit | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FloatEdit:
"""Edit widget for float values."""
def __init__(self, caption='', default=None, preserveSignificance=True, decimalSeparator='.'):
"""caption -- caption markup default -- default edit value preserveSignificance -- return value has the same signif. as default decimalSeparat... | stack_v2_sparse_classes_75kplus_train_000592 | 10,901 | permissive | [
{
"docstring": "caption -- caption markup default -- default edit value preserveSignificance -- return value has the same signif. as default decimalSeparator -- use '.' as separator by default, optionally a ',' >>> FloatEdit(u\"\", \"1.065434\") <FloatEdit selectable flow widget '1.065434' edit_pos=8> >>> e, si... | 2 | stack_v2_sparse_classes_30k_train_010050 | Implement the Python class `FloatEdit` described below.
Class description:
Edit widget for float values.
Method signatures and docstrings:
- def __init__(self, caption='', default=None, preserveSignificance=True, decimalSeparator='.'): caption -- caption markup default -- default edit value preserveSignificance -- re... | Implement the Python class `FloatEdit` described below.
Class description:
Edit widget for float values.
Method signatures and docstrings:
- def __init__(self, caption='', default=None, preserveSignificance=True, decimalSeparator='.'): caption -- caption markup default -- default edit value preserveSignificance -- re... | 95b7a061eabd6f2b607fba79e007186030f02720 | <|skeleton|>
class FloatEdit:
"""Edit widget for float values."""
def __init__(self, caption='', default=None, preserveSignificance=True, decimalSeparator='.'):
"""caption -- caption markup default -- default edit value preserveSignificance -- return value has the same signif. as default decimalSeparat... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FloatEdit:
"""Edit widget for float values."""
def __init__(self, caption='', default=None, preserveSignificance=True, decimalSeparator='.'):
"""caption -- caption markup default -- default edit value preserveSignificance -- return value has the same signif. as default decimalSeparator -- use '.'... | the_stack_v2_python_sparse | Ricardo_OS/Python_backend/venv/lib/python3.8/site-packages/urwid/numedit.py | icl-rocketry/Avionics | train | 9 |
0d42667f4d2cd5edb24a91692164f1c4f3332675 | [
"msg = f'Looking up used quota for Rucio account: {account}'\nself.logger.info(msg)\nmyconfig = copy.deepcopy(config)\nmyconfig.Services.Rucio_account = account\nrucioClient = getNativeRucioClient(config=myconfig, logger=self.logger)\nusageGenerator = rucioClient.get_local_account_usage(account=account)\ntotalBytes... | <|body_start_0|>
msg = f'Looking up used quota for Rucio account: {account}'
self.logger.info(msg)
myconfig = copy.deepcopy(config)
myconfig.Services.Rucio_account = account
rucioClient = getNativeRucioClient(config=myconfig, logger=self.logger)
usageGenerator = rucioClie... | Recurring action to get every hour the used disk quota for crab_tape_recall and crab_input accounts then save it to `logsDir/tape_recall_quota.json` | ReportRecallQuota | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReportRecallQuota:
"""Recurring action to get every hour the used disk quota for crab_tape_recall and crab_input accounts then save it to `logsDir/tape_recall_quota.json`"""
def createQuotaReport(self, config=None, account=None):
"""create a dictionary with the quota report to be sen... | stack_v2_sparse_classes_75kplus_train_000593 | 3,697 | no_license | [
{
"docstring": "create a dictionary with the quota report to be sent to MONIT even if we do not report usage at single RSE's now, let's collect that info as well returns {'rse1':bytes, 'rse':bytes,..., 'totalTB':TBypte}",
"name": "createQuotaReport",
"signature": "def createQuotaReport(self, config=None... | 2 | null | Implement the Python class `ReportRecallQuota` described below.
Class description:
Recurring action to get every hour the used disk quota for crab_tape_recall and crab_input accounts then save it to `logsDir/tape_recall_quota.json`
Method signatures and docstrings:
- def createQuotaReport(self, config=None, account=N... | Implement the Python class `ReportRecallQuota` described below.
Class description:
Recurring action to get every hour the used disk quota for crab_tape_recall and crab_input accounts then save it to `logsDir/tape_recall_quota.json`
Method signatures and docstrings:
- def createQuotaReport(self, config=None, account=N... | 608a79f53fad7a2c60f1193e967dbf38506fec83 | <|skeleton|>
class ReportRecallQuota:
"""Recurring action to get every hour the used disk quota for crab_tape_recall and crab_input accounts then save it to `logsDir/tape_recall_quota.json`"""
def createQuotaReport(self, config=None, account=None):
"""create a dictionary with the quota report to be sen... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ReportRecallQuota:
"""Recurring action to get every hour the used disk quota for crab_tape_recall and crab_input accounts then save it to `logsDir/tape_recall_quota.json`"""
def createQuotaReport(self, config=None, account=None):
"""create a dictionary with the quota report to be sent to MONIT ev... | the_stack_v2_python_sparse | src/python/TaskWorker/Actions/Recurring/ReportRecallQuota.py | dmwm/CRABServer | train | 18 |
696671acf1ae3b613457e05ab4124171105fde6f | [
"print('\\n//////////////////////////////////////////////////')\nprint('♪♪ CountGraphController Initialized ♪♪')\nprint('//////////////////////////////////////////////////\\n')\nself.controller: ElevatorController = ElevatorController(dir, start_at, end_at)",
"value_list: list[int] = []\ncreated_list: list[dateti... | <|body_start_0|>
print('\n//////////////////////////////////////////////////')
print('♪♪ CountGraphController Initialized ♪♪')
print('//////////////////////////////////////////////////\n')
self.controller: ElevatorController = ElevatorController(dir, start_at, end_at)
<|end_body_0|>
<|b... | CountGraphController | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CountGraphController:
def __init__(self, dir: str, start_at: datetime=None, end_at: datetime=None):
"""カウントのグラフを表示するためのコントローラー @params str dir エレベーター向き(left or right)"""
<|body_0|>
def show_graph(self):
"""グラフを生成・表示"""
<|body_1|>
<|end_skeleton|>
<|body_sta... | stack_v2_sparse_classes_75kplus_train_000594 | 2,180 | no_license | [
{
"docstring": "カウントのグラフを表示するためのコントローラー @params str dir エレベーター向き(left or right)",
"name": "__init__",
"signature": "def __init__(self, dir: str, start_at: datetime=None, end_at: datetime=None)"
},
{
"docstring": "グラフを生成・表示",
"name": "show_graph",
"signature": "def show_graph(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007783 | Implement the Python class `CountGraphController` described below.
Class description:
Implement the CountGraphController class.
Method signatures and docstrings:
- def __init__(self, dir: str, start_at: datetime=None, end_at: datetime=None): カウントのグラフを表示するためのコントローラー @params str dir エレベーター向き(left or right)
- def show_g... | Implement the Python class `CountGraphController` described below.
Class description:
Implement the CountGraphController class.
Method signatures and docstrings:
- def __init__(self, dir: str, start_at: datetime=None, end_at: datetime=None): カウントのグラフを表示するためのコントローラー @params str dir エレベーター向き(left or right)
- def show_g... | 0de2ee9c5af2e39f15952adf3df55c227d9a3bd0 | <|skeleton|>
class CountGraphController:
def __init__(self, dir: str, start_at: datetime=None, end_at: datetime=None):
"""カウントのグラフを表示するためのコントローラー @params str dir エレベーター向き(left or right)"""
<|body_0|>
def show_graph(self):
"""グラフを生成・表示"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CountGraphController:
def __init__(self, dir: str, start_at: datetime=None, end_at: datetime=None):
"""カウントのグラフを表示するためのコントローラー @params str dir エレベーター向き(left or right)"""
print('\n//////////////////////////////////////////////////')
print('♪♪ CountGraphController Initialized ♪♪')
... | the_stack_v2_python_sparse | src/controllers/graph/count.py | Alesion30/elecon-py | train | 0 | |
5a888214d751de293e46fee6c50986420e97b6ab | [
"query = 'SELECT details, UNIX_TIMESTAMP(timestamp)\\n FROM api_audit_entry\\n FORCE INDEX (api_audit_entry_by_username_timestamp)\\n {WHERE_PLACEHOLDER}\\n ORDER BY timestamp ASC\\n '\nconditions = []\nvalues = []\nwhere = ''\nif username is not None:\n conditions.append('username... | <|body_start_0|>
query = 'SELECT details, UNIX_TIMESTAMP(timestamp)\n FROM api_audit_entry\n FORCE INDEX (api_audit_entry_by_username_timestamp)\n {WHERE_PLACEHOLDER}\n ORDER BY timestamp ASC\n '
conditions = []
values = []
where = ''
if username is... | MySQLDB mixin for event handling. | MySQLDBEventMixin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MySQLDBEventMixin:
"""MySQLDB mixin for event handling."""
def ReadAPIAuditEntries(self, username=None, router_method_names=None, min_timestamp=None, max_timestamp=None, cursor=None):
"""Returns audit entries stored in the database."""
<|body_0|>
def CountAPIAuditEntries... | stack_v2_sparse_classes_75kplus_train_000595 | 4,374 | permissive | [
{
"docstring": "Returns audit entries stored in the database.",
"name": "ReadAPIAuditEntries",
"signature": "def ReadAPIAuditEntries(self, username=None, router_method_names=None, min_timestamp=None, max_timestamp=None, cursor=None)"
},
{
"docstring": "Returns audit entry counts grouped by user ... | 3 | stack_v2_sparse_classes_30k_test_001679 | Implement the Python class `MySQLDBEventMixin` described below.
Class description:
MySQLDB mixin for event handling.
Method signatures and docstrings:
- def ReadAPIAuditEntries(self, username=None, router_method_names=None, min_timestamp=None, max_timestamp=None, cursor=None): Returns audit entries stored in the data... | Implement the Python class `MySQLDBEventMixin` described below.
Class description:
MySQLDB mixin for event handling.
Method signatures and docstrings:
- def ReadAPIAuditEntries(self, username=None, router_method_names=None, min_timestamp=None, max_timestamp=None, cursor=None): Returns audit entries stored in the data... | 44c0eb8c938302098ef7efae8cfd6b90bcfbb2d6 | <|skeleton|>
class MySQLDBEventMixin:
"""MySQLDB mixin for event handling."""
def ReadAPIAuditEntries(self, username=None, router_method_names=None, min_timestamp=None, max_timestamp=None, cursor=None):
"""Returns audit entries stored in the database."""
<|body_0|>
def CountAPIAuditEntries... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MySQLDBEventMixin:
"""MySQLDB mixin for event handling."""
def ReadAPIAuditEntries(self, username=None, router_method_names=None, min_timestamp=None, max_timestamp=None, cursor=None):
"""Returns audit entries stored in the database."""
query = 'SELECT details, UNIX_TIMESTAMP(timestamp)\n ... | the_stack_v2_python_sparse | grr/server/grr_response_server/databases/mysql_events.py | google/grr | train | 4,683 |
1cae5684310a75ec67a9bf2b97ae557b2055d111 | [
"content = '\\n\\n Dear {{ pro_first_name }},\\n\\n Your host, {{ party.host.first_name }}, finished setting up the party below on <a href=\"http://{{ host_name }}\">Vinely.com</a>.\\n\\n If they haven\\'t yet, please make sure they order a Party Pack and track the RSVPs to ensure they have eno... | <|body_start_0|>
content = '\n\n Dear {{ pro_first_name }},\n\n Your host, {{ party.host.first_name }}, finished setting up the party below on <a href="http://{{ host_name }}">Vinely.com</a>.\n\n If they haven\'t yet, please make sure they order a Party Pack and track the RSVPs to ensure th... | Migration | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Migration:
def forwards(self, orm):
"""Write your forwards methods here."""
<|body_0|>
def backwards(self, orm):
"""Write your backwards methods here."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
content = '\n\n Dear {{ pro_first_name }},\... | stack_v2_sparse_classes_75kplus_train_000596 | 4,471 | no_license | [
{
"docstring": "Write your forwards methods here.",
"name": "forwards",
"signature": "def forwards(self, orm)"
},
{
"docstring": "Write your backwards methods here.",
"name": "backwards",
"signature": "def backwards(self, orm)"
}
] | 2 | stack_v2_sparse_classes_30k_train_042472 | Implement the Python class `Migration` described below.
Class description:
Implement the Migration class.
Method signatures and docstrings:
- def forwards(self, orm): Write your forwards methods here.
- def backwards(self, orm): Write your backwards methods here. | Implement the Python class `Migration` described below.
Class description:
Implement the Migration class.
Method signatures and docstrings:
- def forwards(self, orm): Write your forwards methods here.
- def backwards(self, orm): Write your backwards methods here.
<|skeleton|>
class Migration:
def forwards(self,... | c5c7d8a0b1a297e07302870017d3fb03c5dbb009 | <|skeleton|>
class Migration:
def forwards(self, orm):
"""Write your forwards methods here."""
<|body_0|>
def backwards(self, orm):
"""Write your backwards methods here."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Migration:
def forwards(self, orm):
"""Write your forwards methods here."""
content = '\n\n Dear {{ pro_first_name }},\n\n Your host, {{ party.host.first_name }}, finished setting up the party below on <a href="http://{{ host_name }}">Vinely.com</a>.\n\n If they haven\'t y... | the_stack_v2_python_sparse | cms/migrations/0017_party_setup_complete_email.py | RSV3/nuvine | train | 0 | |
6440e43eeb24e41f882ccb95d12ebfb8d7b5b3b5 | [
"proj = pk and self.get_object(request.user, pk) or None\ncontext = {'project': proj, 'forms': self.formset(instance=proj)}\nreturn render(request, self.edit_template, context)",
"proj = pk and self.get_object(request.user, pk) or None\ncontext = {'project': proj}\nfs = self.formset(request.POST, instance=proj)\n... | <|body_start_0|>
proj = pk and self.get_object(request.user, pk) or None
context = {'project': proj, 'forms': self.formset(instance=proj)}
return render(request, self.edit_template, context)
<|end_body_0|>
<|body_start_1|>
proj = pk and self.get_object(request.user, pk) or None
... | Experimental WBS edit view. | ProjectWBSView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectWBSView:
"""Experimental WBS edit view."""
def show_forms(self, request, pk):
"""Render the formset for the given project."""
<|body_0|>
def upsert_instance(self, request, pk, **kwargs):
"""Save the main form (and subform is the instance is not new) and re... | stack_v2_sparse_classes_75kplus_train_000597 | 4,052 | no_license | [
{
"docstring": "Render the formset for the given project.",
"name": "show_forms",
"signature": "def show_forms(self, request, pk)"
},
{
"docstring": "Save the main form (and subform is the instance is not new) and redirect to the collection view.",
"name": "upsert_instance",
"signature":... | 2 | stack_v2_sparse_classes_30k_train_036318 | Implement the Python class `ProjectWBSView` described below.
Class description:
Experimental WBS edit view.
Method signatures and docstrings:
- def show_forms(self, request, pk): Render the formset for the given project.
- def upsert_instance(self, request, pk, **kwargs): Save the main form (and subform is the instan... | Implement the Python class `ProjectWBSView` described below.
Class description:
Experimental WBS edit view.
Method signatures and docstrings:
- def show_forms(self, request, pk): Render the formset for the given project.
- def upsert_instance(self, request, pk, **kwargs): Save the main form (and subform is the instan... | 4dcf0e6a37e8753ae9d69d663c0c280fcca0a26c | <|skeleton|>
class ProjectWBSView:
"""Experimental WBS edit view."""
def show_forms(self, request, pk):
"""Render the formset for the given project."""
<|body_0|>
def upsert_instance(self, request, pk, **kwargs):
"""Save the main form (and subform is the instance is not new) and re... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProjectWBSView:
"""Experimental WBS edit view."""
def show_forms(self, request, pk):
"""Render the formset for the given project."""
proj = pk and self.get_object(request.user, pk) or None
context = {'project': proj, 'forms': self.formset(instance=proj)}
return render(requ... | the_stack_v2_python_sparse | apps/work/views.py | ESCL/pjtracker | train | 1 |
1d4a4692290ae2973a9faf921e3734afa19edb97 | [
"def mergeTwoLists(l1, l2):\n head = return_list = ListNode(0)\n point1, point2 = (l1, l2)\n while point1 and point2:\n if point1.val >= point2.val:\n head.next = point2\n head = head.next\n point2 = point2.next\n elif point1.val < point2.val:\n hea... | <|body_start_0|>
def mergeTwoLists(l1, l2):
head = return_list = ListNode(0)
point1, point2 = (l1, l2)
while point1 and point2:
if point1.val >= point2.val:
head.next = point2
head = head.next
point2 ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_0|>
def mergeKLists2(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def mergeTwoLists(l1... | stack_v2_sparse_classes_75kplus_train_000598 | 2,036 | no_license | [
{
"docstring": ":type lists: List[ListNode] :rtype: ListNode",
"name": "mergeKLists",
"signature": "def mergeKLists(self, lists)"
},
{
"docstring": ":type lists: List[ListNode] :rtype: ListNode",
"name": "mergeKLists2",
"signature": "def mergeKLists2(self, lists)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005841 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
- def mergeKLists2(self, lists): :type lists: List[ListNode] :rtype: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
- def mergeKLists2(self, lists): :type lists: List[ListNode] :rtype: ListNode
<|skeleton|>
class Solut... | 29cb49a166a1dfd19c39613a0e9895c545a6bfe9 | <|skeleton|>
class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_0|>
def mergeKLists2(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
def mergeTwoLists(l1, l2):
head = return_list = ListNode(0)
point1, point2 = (l1, l2)
while point1 and point2:
if point1.val >= point2.val:
... | the_stack_v2_python_sparse | 04.Heap&Hash/mergeKLists.py | mjmingd/study_algorithm | train | 0 | |
7bd252821c6dcf345e9cf96c3f1234f176459b00 | [
"\"\"\"价格排序测试\"\"\"\nprice = PaixuPage(self.driver)\nprice.going_fenlei()\nprice.click_price()",
"\"\"\"销量排序测试\"\"\"\nsales = PaixuPage(self.driver)\nsales.going_fenlei()\nsales.click_sales()"
] | <|body_start_0|>
"""价格排序测试"""
price = PaixuPage(self.driver)
price.going_fenlei()
price.click_price()
<|end_body_0|>
<|body_start_1|>
"""销量排序测试"""
sales = PaixuPage(self.driver)
sales.going_fenlei()
sales.click_sales()
<|end_body_1|>
| PaixuTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PaixuTest:
def test_price(self):
"""MRYX_ST_classification_002"""
<|body_0|>
def test_sales(self):
"""MRYX_ST_classification_002"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
"""价格排序测试"""
price = PaixuPage(self.driver)
price.going_... | stack_v2_sparse_classes_75kplus_train_000599 | 824 | no_license | [
{
"docstring": "MRYX_ST_classification_002",
"name": "test_price",
"signature": "def test_price(self)"
},
{
"docstring": "MRYX_ST_classification_002",
"name": "test_sales",
"signature": "def test_sales(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_044168 | Implement the Python class `PaixuTest` described below.
Class description:
Implement the PaixuTest class.
Method signatures and docstrings:
- def test_price(self): MRYX_ST_classification_002
- def test_sales(self): MRYX_ST_classification_002 | Implement the Python class `PaixuTest` described below.
Class description:
Implement the PaixuTest class.
Method signatures and docstrings:
- def test_price(self): MRYX_ST_classification_002
- def test_sales(self): MRYX_ST_classification_002
<|skeleton|>
class PaixuTest:
def test_price(self):
"""MRYX_ST... | 2325c7854c5625babdb51b5c5e40fa860813a400 | <|skeleton|>
class PaixuTest:
def test_price(self):
"""MRYX_ST_classification_002"""
<|body_0|>
def test_sales(self):
"""MRYX_ST_classification_002"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PaixuTest:
def test_price(self):
"""MRYX_ST_classification_002"""
"""价格排序测试"""
price = PaixuPage(self.driver)
price.going_fenlei()
price.click_price()
def test_sales(self):
"""MRYX_ST_classification_002"""
"""销量排序测试"""
sales = PaixuPage(self... | the_stack_v2_python_sparse | testcase/test_paixu.py | danyubiao/mryx | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.