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 467 8.64k | id stringlengths 40 40 | length_bytes int64 515 49.7k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 160 3.93k | prompted_full_text stringlengths 681 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.09k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 331 8.3k | source stringclasses 1
value | source_path stringlengths 5 177 | source_repo stringlengths 6 88 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b556daaa9806409b7f5fdf06b67a6aaa51fc9782 | [
"\"\"\"\n 1. consider using reduce, really necessary?\n 2. since it's prefix, that is to say, every char must exist in strings\n \"\"\"\nif not strs:\n return ''\nmax_index = 0\nfor i, clist in enumerate(zip(*strs)):\n result = set(clist)\n if len(result) > 1:\n return strs[0][:... | <|body_start_0|>
"""
1. consider using reduce, really necessary?
2. since it's prefix, that is to say, every char must exist in strings
"""
if not strs:
return ''
max_index = 0
for i, clist in enumerate(zip(*strs)):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def longestCommonPrefix(self, strs):
""":type strs: List[str] :rtype: str"""
<|body_0|>
def rewrite(self, strs):
""":type strs: List[str] :rtype: str"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
"""
1. consider using red... | stack_v2_sparse_classes_10k_train_008700 | 2,085 | no_license | [
{
"docstring": ":type strs: List[str] :rtype: str",
"name": "longestCommonPrefix",
"signature": "def longestCommonPrefix(self, strs)"
},
{
"docstring": ":type strs: List[str] :rtype: str",
"name": "rewrite",
"signature": "def rewrite(self, strs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005620 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestCommonPrefix(self, strs): :type strs: List[str] :rtype: str
- def rewrite(self, strs): :type strs: List[str] :rtype: str | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestCommonPrefix(self, strs): :type strs: List[str] :rtype: str
- def rewrite(self, strs): :type strs: List[str] :rtype: str
<|skeleton|>
class Solution:
def longest... | 6350568d16b0f8c49a020f055bb6d72e2705ea56 | <|skeleton|>
class Solution:
def longestCommonPrefix(self, strs):
""":type strs: List[str] :rtype: str"""
<|body_0|>
def rewrite(self, strs):
""":type strs: List[str] :rtype: str"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def longestCommonPrefix(self, strs):
""":type strs: List[str] :rtype: str"""
"""
1. consider using reduce, really necessary?
2. since it's prefix, that is to say, every char must exist in strings
"""
if not strs:
ret... | the_stack_v2_python_sparse | co_ms/14_Longest_Common_Prefix.py | vsdrun/lc_public | train | 6 | |
6544b630174ec46621b87b7fff5e3fddeef21266 | [
"url = self.trimUrlPrefix(urlTrait.url)\nif url and self.isTnsStyle(url):\n EMPTY = OracleTnsRecordParser.EMPTY\n obj = OracleTnsRecordParser().parse(url)\n uniqueHostCount = self._countUniqueHosts(obj)\n description = self._getDescription(obj)\n serviceName = description.connect_data.service_name\n ... | <|body_start_0|>
url = self.trimUrlPrefix(urlTrait.url)
if url and self.isTnsStyle(url):
EMPTY = OracleTnsRecordParser.EMPTY
obj = OracleTnsRecordParser().parse(url)
uniqueHostCount = self._countUniqueHosts(obj)
description = self._getDescription(obj)
... | Parses tns-like record that represents oracle rac The url should contain service name and more then one unique host. | OracleThinRacCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OracleThinRacCase:
"""Parses tns-like record that represents oracle rac The url should contain service name and more then one unique host."""
def isApplicableUrlTrait(self, urlTrait):
"""@types: jdbc_url_parser.Trait -> bool"""
<|body_0|>
def parse(self, url):
""... | stack_v2_sparse_classes_10k_train_008701 | 40,819 | no_license | [
{
"docstring": "@types: jdbc_url_parser.Trait -> bool",
"name": "isApplicableUrlTrait",
"signature": "def isApplicableUrlTrait(self, urlTrait)"
},
{
"docstring": "@types: str -> tuple[db.DatabaseServer]",
"name": "parse",
"signature": "def parse(self, url)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005110 | Implement the Python class `OracleThinRacCase` described below.
Class description:
Parses tns-like record that represents oracle rac The url should contain service name and more then one unique host.
Method signatures and docstrings:
- def isApplicableUrlTrait(self, urlTrait): @types: jdbc_url_parser.Trait -> bool
- ... | Implement the Python class `OracleThinRacCase` described below.
Class description:
Parses tns-like record that represents oracle rac The url should contain service name and more then one unique host.
Method signatures and docstrings:
- def isApplicableUrlTrait(self, urlTrait): @types: jdbc_url_parser.Trait -> bool
- ... | c431e809e8d0f82e1bca7e3429dd0245560b5680 | <|skeleton|>
class OracleThinRacCase:
"""Parses tns-like record that represents oracle rac The url should contain service name and more then one unique host."""
def isApplicableUrlTrait(self, urlTrait):
"""@types: jdbc_url_parser.Trait -> bool"""
<|body_0|>
def parse(self, url):
""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class OracleThinRacCase:
"""Parses tns-like record that represents oracle rac The url should contain service name and more then one unique host."""
def isApplicableUrlTrait(self, urlTrait):
"""@types: jdbc_url_parser.Trait -> bool"""
url = self.trimUrlPrefix(urlTrait.url)
if url and sel... | the_stack_v2_python_sparse | reference/ucmdb/discovery/jdbc_url_parser.py | madmonkyang/cda-record | train | 0 |
3e97f3df502a08a310f38c2e66a9b2485b07fa82 | [
"self.org_number = org_number\nself.prokura = prokura\nself.signature = signature\nself.signatures = signatures\nself.additional_properties = additional_properties",
"if dictionary is None:\n return None\norg_number = dictionary.get('OrgNumber')\nprokura = dictionary.get('Prokura')\nsignature = dictionary.get(... | <|body_start_0|>
self.org_number = org_number
self.prokura = prokura
self.signature = signature
self.signatures = signatures
self.additional_properties = additional_properties
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
org_numb... | Implementation of the 'OrganizationRequest' model. TODO: type model description here. Attributes: org_number (string): TODO: type description here. prokura (bool): TODO: type description here. signature (bool): TODO: type description here. signatures (list of CheckSignature): TODO: type description here. | OrganizationRequest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrganizationRequest:
"""Implementation of the 'OrganizationRequest' model. TODO: type model description here. Attributes: org_number (string): TODO: type description here. prokura (bool): TODO: type description here. signature (bool): TODO: type description here. signatures (list of CheckSignatur... | stack_v2_sparse_classes_10k_train_008702 | 2,864 | permissive | [
{
"docstring": "Constructor for the OrganizationRequest class",
"name": "__init__",
"signature": "def __init__(self, org_number=None, prokura=None, signature=None, signatures=None, additional_properties={})"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary ... | 2 | stack_v2_sparse_classes_30k_train_005707 | Implement the Python class `OrganizationRequest` described below.
Class description:
Implementation of the 'OrganizationRequest' model. TODO: type model description here. Attributes: org_number (string): TODO: type description here. prokura (bool): TODO: type description here. signature (bool): TODO: type description ... | Implement the Python class `OrganizationRequest` described below.
Class description:
Implementation of the 'OrganizationRequest' model. TODO: type model description here. Attributes: org_number (string): TODO: type description here. prokura (bool): TODO: type description here. signature (bool): TODO: type description ... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class OrganizationRequest:
"""Implementation of the 'OrganizationRequest' model. TODO: type model description here. Attributes: org_number (string): TODO: type description here. prokura (bool): TODO: type description here. signature (bool): TODO: type description here. signatures (list of CheckSignatur... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class OrganizationRequest:
"""Implementation of the 'OrganizationRequest' model. TODO: type model description here. Attributes: org_number (string): TODO: type description here. prokura (bool): TODO: type description here. signature (bool): TODO: type description here. signatures (list of CheckSignature): TODO: typ... | the_stack_v2_python_sparse | idfy_rest_client/models/organization_request.py | dealflowteam/Idfy | train | 0 |
5159c412f7c30d9092558bdee9c06cbfcf490bf0 | [
"self.file = file\nself.skip = skip\nself.size = size\nself.dtype = dtype\nself.scale = scale\nself.maxsize = maxsize",
"f = FTFile(self.file, scale=self.scale, dtype=self.dtype)\nif self.skip != 0:\n f.skip(self.skip)\nif self.size is not None and self.size < f.size:\n if self.size < 0:\n f.size += ... | <|body_start_0|>
self.file = file
self.skip = skip
self.size = size
self.dtype = dtype
self.scale = scale
self.maxsize = maxsize
<|end_body_0|>
<|body_start_1|>
f = FTFile(self.file, scale=self.scale, dtype=self.dtype)
if self.skip != 0:
f.ski... | FTSource | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FTSource:
def __init__(self, file, skip=0, size=None, maxsize=None, dtype=None, scale=1):
"""Create a data source from a possible subset of a .ft file. Parameters: `file` -- (string) the filename `skip` -- (int, optional) amount of examples to skip from the start of the file. If negative... | stack_v2_sparse_classes_10k_train_008703 | 9,679 | permissive | [
{
"docstring": "Create a data source from a possible subset of a .ft file. Parameters: `file` -- (string) the filename `skip` -- (int, optional) amount of examples to skip from the start of the file. If negative, skips filesize - skip. `size` -- (int, optional) truncates number of examples read (after skipping)... | 2 | stack_v2_sparse_classes_30k_train_002321 | Implement the Python class `FTSource` described below.
Class description:
Implement the FTSource class.
Method signatures and docstrings:
- def __init__(self, file, skip=0, size=None, maxsize=None, dtype=None, scale=1): Create a data source from a possible subset of a .ft file. Parameters: `file` -- (string) the file... | Implement the Python class `FTSource` described below.
Class description:
Implement the FTSource class.
Method signatures and docstrings:
- def __init__(self, file, skip=0, size=None, maxsize=None, dtype=None, scale=1): Create a data source from a possible subset of a .ft file. Parameters: `file` -- (string) the file... | 7881458caaf2f5ab82b130ee50cb933cf12f6de7 | <|skeleton|>
class FTSource:
def __init__(self, file, skip=0, size=None, maxsize=None, dtype=None, scale=1):
"""Create a data source from a possible subset of a .ft file. Parameters: `file` -- (string) the filename `skip` -- (int, optional) amount of examples to skip from the start of the file. If negative... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FTSource:
def __init__(self, file, skip=0, size=None, maxsize=None, dtype=None, scale=1):
"""Create a data source from a possible subset of a .ft file. Parameters: `file` -- (string) the filename `skip` -- (int, optional) amount of examples to skip from the start of the file. If negative, skips filesi... | the_stack_v2_python_sparse | datasets/ift6266/datasets/ftfile.py | sauravbiswasiupr/image_transformations | train | 0 | |
5b9818a598ab106f3ecb355efacb3e99c5cf1a75 | [
"num_rows = args.get('rows') or 100\nquery = g.db.query(MachineGroup)\nif args.get('name'):\n query = query.filter(MachineGroup.name == args['name'])\nquery = query.order_by(-MachineGroup.machinegroup_id)\nquery = query.limit(num_rows)\nrows = query.all()\nret = []\nfor row in rows:\n record = row.as_dict()\n... | <|body_start_0|>
num_rows = args.get('rows') or 100
query = g.db.query(MachineGroup)
if args.get('name'):
query = query.filter(MachineGroup.name == args['name'])
query = query.order_by(-MachineGroup.machinegroup_id)
query = query.limit(num_rows)
rows = query.a... | MachineGroupsAPI | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MachineGroupsAPI:
def get(self, args):
"""Get a list of machine groups"""
<|body_0|>
def post(self, args):
"""Create machine group"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
num_rows = args.get('rows') or 100
query = g.db.query(MachineG... | stack_v2_sparse_classes_10k_train_008704 | 4,597 | permissive | [
{
"docstring": "Get a list of machine groups",
"name": "get",
"signature": "def get(self, args)"
},
{
"docstring": "Create machine group",
"name": "post",
"signature": "def post(self, args)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001901 | Implement the Python class `MachineGroupsAPI` described below.
Class description:
Implement the MachineGroupsAPI class.
Method signatures and docstrings:
- def get(self, args): Get a list of machine groups
- def post(self, args): Create machine group | Implement the Python class `MachineGroupsAPI` described below.
Class description:
Implement the MachineGroupsAPI class.
Method signatures and docstrings:
- def get(self, args): Get a list of machine groups
- def post(self, args): Create machine group
<|skeleton|>
class MachineGroupsAPI:
def get(self, args):
... | 2771bb46db7fd331448f9db3cfb257fab7f89bcc | <|skeleton|>
class MachineGroupsAPI:
def get(self, args):
"""Get a list of machine groups"""
<|body_0|>
def post(self, args):
"""Create machine group"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MachineGroupsAPI:
def get(self, args):
"""Get a list of machine groups"""
num_rows = args.get('rows') or 100
query = g.db.query(MachineGroup)
if args.get('name'):
query = query.filter(MachineGroup.name == args['name'])
query = query.order_by(-MachineGroup.ma... | the_stack_v2_python_sparse | driftbase/api/machinegroups.py | directivegames/drift-base | train | 1 | |
aa535cf73827caf07d6571a183251aab0b26f916 | [
"Log().info('======开始考前资料核查======')\nsleep(2)\nself.find_element(*self.Editer).click()\nsleep(2)\nself.switch_to_frame(self.find_element(*self.iframe1))\nself.implicity_wait(5)\nLog().info('======审核附件======')\nself.find_element(*self.AdoptOne).click()\nsleep(2)\nself.find_element(*self.AdoptTwo).click()\nsleep(2)\n... | <|body_start_0|>
Log().info('======开始考前资料核查======')
sleep(2)
self.find_element(*self.Editer).click()
sleep(2)
self.switch_to_frame(self.find_element(*self.iframe1))
self.implicity_wait(5)
Log().info('======审核附件======')
self.find_element(*self.AdoptOne).cli... | 考前资料核查页面 | AdultCheck | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdultCheck:
"""考前资料核查页面"""
def type_audit_data(self):
"""考前资料核查通过"""
<|body_0|>
def type_audit_pass(self):
"""审核通过断言"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
Log().info('======开始考前资料核查======')
sleep(2)
self.find_element(*s... | stack_v2_sparse_classes_10k_train_008705 | 1,886 | no_license | [
{
"docstring": "考前资料核查通过",
"name": "type_audit_data",
"signature": "def type_audit_data(self)"
},
{
"docstring": "审核通过断言",
"name": "type_audit_pass",
"signature": "def type_audit_pass(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001406 | Implement the Python class `AdultCheck` described below.
Class description:
考前资料核查页面
Method signatures and docstrings:
- def type_audit_data(self): 考前资料核查通过
- def type_audit_pass(self): 审核通过断言 | Implement the Python class `AdultCheck` described below.
Class description:
考前资料核查页面
Method signatures and docstrings:
- def type_audit_data(self): 考前资料核查通过
- def type_audit_pass(self): 审核通过断言
<|skeleton|>
class AdultCheck:
"""考前资料核查页面"""
def type_audit_data(self):
"""考前资料核查通过"""
<|body_0|>
... | 08d7fab053f6797016d827396fc7b48a3eba9b6e | <|skeleton|>
class AdultCheck:
"""考前资料核查页面"""
def type_audit_data(self):
"""考前资料核查通过"""
<|body_0|>
def type_audit_pass(self):
"""审核通过断言"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AdultCheck:
"""考前资料核查页面"""
def type_audit_data(self):
"""考前资料核查通过"""
Log().info('======开始考前资料核查======')
sleep(2)
self.find_element(*self.Editer).click()
sleep(2)
self.switch_to_frame(self.find_element(*self.iframe1))
self.implicity_wait(5)
L... | the_stack_v2_python_sparse | YZ_AutoTest_Project/Website/test_case/page_object/AdultCheckFilePage.py | MikeDarkCloud/YZ | train | 0 |
c76478b5fe70b86663e7228ce7250319fae61f16 | [
"\"\"\"\n self.arr = []\n for i in xrange(0, len(A), 2):\n num = A[i]\n val = A[i + 1]\n for j in xrange(num):\n self.arr.append(val)\n self.index = -1\n \"\"\"\nself.arr = A\nself.index = 0\nself.pos = 0",
"\"\"\"\n # ans1\n ... | <|body_start_0|>
"""
self.arr = []
for i in xrange(0, len(A), 2):
num = A[i]
val = A[i + 1]
for j in xrange(num):
self.arr.append(val)
self.index = -1
"""
s... | RLEIterator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RLEIterator:
def __init__(self, A):
""":type A: List[int]"""
<|body_0|>
def next(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
"""
self.arr = []
for i in xrange(0, len(A), 2):
... | stack_v2_sparse_classes_10k_train_008706 | 1,159 | no_license | [
{
"docstring": ":type A: List[int]",
"name": "__init__",
"signature": "def __init__(self, A)"
},
{
"docstring": ":type n: int :rtype: int",
"name": "next",
"signature": "def next(self, n)"
}
] | 2 | null | Implement the Python class `RLEIterator` described below.
Class description:
Implement the RLEIterator class.
Method signatures and docstrings:
- def __init__(self, A): :type A: List[int]
- def next(self, n): :type n: int :rtype: int | Implement the Python class `RLEIterator` described below.
Class description:
Implement the RLEIterator class.
Method signatures and docstrings:
- def __init__(self, A): :type A: List[int]
- def next(self, n): :type n: int :rtype: int
<|skeleton|>
class RLEIterator:
def __init__(self, A):
""":type A: Lis... | 992bb618b605c3345318a0eeb2d2df4d11f6a2d5 | <|skeleton|>
class RLEIterator:
def __init__(self, A):
""":type A: List[int]"""
<|body_0|>
def next(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RLEIterator:
def __init__(self, A):
""":type A: List[int]"""
"""
self.arr = []
for i in xrange(0, len(A), 2):
num = A[i]
val = A[i + 1]
for j in xrange(num):
self.arr.append(val)... | the_stack_v2_python_sparse | leetcode/900. RLE Iterator.py | gsrr/leetcode | train | 0 | |
1d52a9d7f4739b88f3d78141512b91bac13b92c4 | [
"tenants = Tenant.find_all()\ntenant_schema = TenantSchema(only=('id', 'tenant_name'))\nreturn tenant_schema.dump(tenants, many=True)",
"tenant = Tenant.find_by_id(tenant_id)\nif tenant:\n tenant_schema = TenantSchema()\n return tenant_schema.dump(tenant)\nraise BusinessException('Invalid tenant', HTTPStatu... | <|body_start_0|>
tenants = Tenant.find_all()
tenant_schema = TenantSchema(only=('id', 'tenant_name'))
return tenant_schema.dump(tenants, many=True)
<|end_body_0|>
<|body_start_1|>
tenant = Tenant.find_by_id(tenant_id)
if tenant:
tenant_schema = TenantSchema()
... | This class manages tenant service. | TenantService | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TenantService:
"""This class manages tenant service."""
def get_all():
"""Get tenants."""
<|body_0|>
def get_by_id(tenant_id):
"""Get tenant by id."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
tenants = Tenant.find_all()
tenant_schema... | stack_v2_sparse_classes_10k_train_008707 | 769 | permissive | [
{
"docstring": "Get tenants.",
"name": "get_all",
"signature": "def get_all()"
},
{
"docstring": "Get tenant by id.",
"name": "get_by_id",
"signature": "def get_by_id(tenant_id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004840 | Implement the Python class `TenantService` described below.
Class description:
This class manages tenant service.
Method signatures and docstrings:
- def get_all(): Get tenants.
- def get_by_id(tenant_id): Get tenant by id. | Implement the Python class `TenantService` described below.
Class description:
This class manages tenant service.
Method signatures and docstrings:
- def get_all(): Get tenants.
- def get_by_id(tenant_id): Get tenant by id.
<|skeleton|>
class TenantService:
"""This class manages tenant service."""
def get_a... | a1a447f364d1e7414ccb073b0749920ec3523e4a | <|skeleton|>
class TenantService:
"""This class manages tenant service."""
def get_all():
"""Get tenants."""
<|body_0|>
def get_by_id(tenant_id):
"""Get tenant by id."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TenantService:
"""This class manages tenant service."""
def get_all():
"""Get tenants."""
tenants = Tenant.find_all()
tenant_schema = TenantSchema(only=('id', 'tenant_name'))
return tenant_schema.dump(tenants, many=True)
def get_by_id(tenant_id):
"""Get tenant... | the_stack_v2_python_sparse | forms-flow-api/src/api/services/tenant.py | sumathi-thirumani-aot/forms-flow-ai | train | 0 |
deb05ec793a2c4a0967862f916fed512abe816ae | [
"ne = self.maxCommonLength(str2)\nn, m = (len(str1), len(str2))\ni, j = (0, 0)\nwhile i < n and j < m:\n if j == -1 or str1[i] == str2[j]:\n i += 1\n j += 1\n else:\n j = ne[j]\nif j == m:\n return i - j\nelse:\n return None",
"l = len(str)\nidx = list()\ni, j = (1, 0)\nm = 0\nidx... | <|body_start_0|>
ne = self.maxCommonLength(str2)
n, m = (len(str1), len(str2))
i, j = (0, 0)
while i < n and j < m:
if j == -1 or str1[i] == str2[j]:
i += 1
j += 1
else:
j = ne[j]
if j == m:
retur... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def longestPalindrome(self, str1, str2):
"""这是求最长公共子串 :param str: :return: rstr"""
<|body_0|>
def maxCommonLength(self, str):
"""返回一个数组,数组包括每段字符串的最大前缀公共串的长度m 没有m时就置变量为-1 :param str: :return:"""
<|body_1|>
def longestPalindrome2(self, s):
... | stack_v2_sparse_classes_10k_train_008708 | 1,606 | no_license | [
{
"docstring": "这是求最长公共子串 :param str: :return: rstr",
"name": "longestPalindrome",
"signature": "def longestPalindrome(self, str1, str2)"
},
{
"docstring": "返回一个数组,数组包括每段字符串的最大前缀公共串的长度m 没有m时就置变量为-1 :param str: :return:",
"name": "maxCommonLength",
"signature": "def maxCommonLength(self, ... | 3 | stack_v2_sparse_classes_30k_train_001712 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestPalindrome(self, str1, str2): 这是求最长公共子串 :param str: :return: rstr
- def maxCommonLength(self, str): 返回一个数组,数组包括每段字符串的最大前缀公共串的长度m 没有m时就置变量为-1 :param str: :return:
- def... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestPalindrome(self, str1, str2): 这是求最长公共子串 :param str: :return: rstr
- def maxCommonLength(self, str): 返回一个数组,数组包括每段字符串的最大前缀公共串的长度m 没有m时就置变量为-1 :param str: :return:
- def... | cd746c37e0a44dc80c5c5177450769908a38fee5 | <|skeleton|>
class Solution:
def longestPalindrome(self, str1, str2):
"""这是求最长公共子串 :param str: :return: rstr"""
<|body_0|>
def maxCommonLength(self, str):
"""返回一个数组,数组包括每段字符串的最大前缀公共串的长度m 没有m时就置变量为-1 :param str: :return:"""
<|body_1|>
def longestPalindrome2(self, s):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def longestPalindrome(self, str1, str2):
"""这是求最长公共子串 :param str: :return: rstr"""
ne = self.maxCommonLength(str2)
n, m = (len(str1), len(str2))
i, j = (0, 0)
while i < n and j < m:
if j == -1 or str1[i] == str2[j]:
i += 1
... | the_stack_v2_python_sparse | leetcode/LongestPalindrome.py | Sparkoor/learning | train | 0 | |
bee011f41b39500698f577c9c2057a317c5f5c45 | [
"if job == 'sheet':\n login_url = self.sheet_url + '/login'\nelse:\n login_url = self.trade_url + '/login'\nlogin_data = {'userName': 'admin', 'password': '123456'}\nlogin_response = requests.post(url=login_url, data=login_data, headers=self.headers)\nresp_code = json.loads(login_response.content)['code']\nif... | <|body_start_0|>
if job == 'sheet':
login_url = self.sheet_url + '/login'
else:
login_url = self.trade_url + '/login'
login_data = {'userName': 'admin', 'password': '123456'}
login_response = requests.post(url=login_url, data=login_data, headers=self.headers)
... | sheet 19 批量定时监控 18 每日红包平台充值优惠券差错对账 17 用户登录统计 12 随机立减数据统计 11 线下清算扣款费用通知回调trade 9 每日订单对账执行器 8 线下扣款清算文件生成 7 联机扣款数据统计 6 线下扣款清算结果文件读取 5 黑名单推送trade 4 未支付订单统计 3 优惠券活动数据统计 2 支付及退款数据统计 1 运营数据统计` trade 20 应用监控数据更新 15 重试清除超时未取消接送机订单 14 退款定时任务 13 查询订单支付状态 12 交易端-强制扣款 11 删除失败及执行成功的任务 10 红包平台优惠券下发 9 下发优惠券 8 查询进行中的活动 6 接送机超时取消 3 网约车-... | XXLJob | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XXLJob:
"""sheet 19 批量定时监控 18 每日红包平台充值优惠券差错对账 17 用户登录统计 12 随机立减数据统计 11 线下清算扣款费用通知回调trade 9 每日订单对账执行器 8 线下扣款清算文件生成 7 联机扣款数据统计 6 线下扣款清算结果文件读取 5 黑名单推送trade 4 未支付订单统计 3 优惠券活动数据统计 2 支付及退款数据统计 1 运营数据统计` trade 20 应用监控数据更新 15 重试清除超时未取消接送机订单 14 退款定时任务 13 查询订单支付状态 12 交易端-强制扣款 11 删除失败及执行成功的任务 10 红包平台优惠券下发 9... | stack_v2_sparse_classes_10k_train_008709 | 4,045 | permissive | [
{
"docstring": "调度平台登录 :param job: :return:",
"name": "login",
"signature": "def login(self, job)"
},
{
"docstring": "修改执行器 :param sheet_ip: :param trade_ip: :param sheet_job: :return:",
"name": "edit_config",
"signature": "def edit_config(self, sheet_ip='192.168.0.48:9003', trade_ip='19... | 3 | stack_v2_sparse_classes_30k_test_000125 | Implement the Python class `XXLJob` described below.
Class description:
sheet 19 批量定时监控 18 每日红包平台充值优惠券差错对账 17 用户登录统计 12 随机立减数据统计 11 线下清算扣款费用通知回调trade 9 每日订单对账执行器 8 线下扣款清算文件生成 7 联机扣款数据统计 6 线下扣款清算结果文件读取 5 黑名单推送trade 4 未支付订单统计 3 优惠券活动数据统计 2 支付及退款数据统计 1 运营数据统计` trade 20 应用监控数据更新 15 重试清除超时未取消接送机订单 14 退款定时任务 13 查询订单支付状态 12 ... | Implement the Python class `XXLJob` described below.
Class description:
sheet 19 批量定时监控 18 每日红包平台充值优惠券差错对账 17 用户登录统计 12 随机立减数据统计 11 线下清算扣款费用通知回调trade 9 每日订单对账执行器 8 线下扣款清算文件生成 7 联机扣款数据统计 6 线下扣款清算结果文件读取 5 黑名单推送trade 4 未支付订单统计 3 优惠券活动数据统计 2 支付及退款数据统计 1 运营数据统计` trade 20 应用监控数据更新 15 重试清除超时未取消接送机订单 14 退款定时任务 13 查询订单支付状态 12 ... | 7e91570fccafa69881be09a1eccb6dfa15ed9039 | <|skeleton|>
class XXLJob:
"""sheet 19 批量定时监控 18 每日红包平台充值优惠券差错对账 17 用户登录统计 12 随机立减数据统计 11 线下清算扣款费用通知回调trade 9 每日订单对账执行器 8 线下扣款清算文件生成 7 联机扣款数据统计 6 线下扣款清算结果文件读取 5 黑名单推送trade 4 未支付订单统计 3 优惠券活动数据统计 2 支付及退款数据统计 1 运营数据统计` trade 20 应用监控数据更新 15 重试清除超时未取消接送机订单 14 退款定时任务 13 查询订单支付状态 12 交易端-强制扣款 11 删除失败及执行成功的任务 10 红包平台优惠券下发 9... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class XXLJob:
"""sheet 19 批量定时监控 18 每日红包平台充值优惠券差错对账 17 用户登录统计 12 随机立减数据统计 11 线下清算扣款费用通知回调trade 9 每日订单对账执行器 8 线下扣款清算文件生成 7 联机扣款数据统计 6 线下扣款清算结果文件读取 5 黑名单推送trade 4 未支付订单统计 3 优惠券活动数据统计 2 支付及退款数据统计 1 运营数据统计` trade 20 应用监控数据更新 15 重试清除超时未取消接送机订单 14 退款定时任务 13 查询订单支付状态 12 交易端-强制扣款 11 删除失败及执行成功的任务 10 红包平台优惠券下发 9 下发优惠券 8 查询进行... | the_stack_v2_python_sparse | httpTest/ApiManager/utils/XXL_job.py | dufuhaoo/httptest | train | 0 |
d7abfe5ff429b3d5fd8ffcbbb3960273d88b767f | [
"form = FormService.get_by_id(form_id)\nif form is None:\n raise BadRequest('No such form')\nform_field = FormFieldService.get_by_id(form_field_id)\nif form_field is None:\n raise BadRequest(\"There's no field with this ID\")\nif form_field.form_id != form.id:\n raise BadRequest('This field does not belong... | <|body_start_0|>
form = FormService.get_by_id(form_id)
if form is None:
raise BadRequest('No such form')
form_field = FormFieldService.get_by_id(form_field_id)
if form_field is None:
raise BadRequest("There's no field with this ID")
if form_field.form_id !... | FormField api url: '/forms/{form_id}/fields/{form_field_id}' methods: get, put, delete | FormFieldAPI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FormFieldAPI:
"""FormField api url: '/forms/{form_id}/fields/{form_field_id}' methods: get, put, delete"""
def get(self, form_id, form_field_id):
"""Get field from a form :param form_id: ID of the form :param form_field_id: ID of the field contained within a form"""
<|body_0|... | stack_v2_sparse_classes_10k_train_008710 | 10,042 | no_license | [
{
"docstring": "Get field from a form :param form_id: ID of the form :param form_field_id: ID of the field contained within a form",
"name": "get",
"signature": "def get(self, form_id, form_field_id)"
},
{
"docstring": "Update field within a form :param form_id: ID of the form :param form_field_... | 3 | stack_v2_sparse_classes_30k_train_000402 | Implement the Python class `FormFieldAPI` described below.
Class description:
FormField api url: '/forms/{form_id}/fields/{form_field_id}' methods: get, put, delete
Method signatures and docstrings:
- def get(self, form_id, form_field_id): Get field from a form :param form_id: ID of the form :param form_field_id: ID ... | Implement the Python class `FormFieldAPI` described below.
Class description:
FormField api url: '/forms/{form_id}/fields/{form_field_id}' methods: get, put, delete
Method signatures and docstrings:
- def get(self, form_id, form_field_id): Get field from a form :param form_id: ID of the form :param form_field_id: ID ... | 7344e4bd1cc977781b35a2ad1b38ff0d270163b7 | <|skeleton|>
class FormFieldAPI:
"""FormField api url: '/forms/{form_id}/fields/{form_field_id}' methods: get, put, delete"""
def get(self, form_id, form_field_id):
"""Get field from a form :param form_id: ID of the form :param form_field_id: ID of the field contained within a form"""
<|body_0|... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FormFieldAPI:
"""FormField api url: '/forms/{form_id}/fields/{form_field_id}' methods: get, put, delete"""
def get(self, form_id, form_field_id):
"""Get field from a form :param form_id: ID of the form :param form_field_id: ID of the field contained within a form"""
form = FormService.get... | the_stack_v2_python_sparse | src/app/routers/form_field.py | Lv-474-Python/ngfg | train | 0 |
fc1d5e2c171ac560e2f0d5529f42fd8d7e1f7a69 | [
"data = super(CFIrQWeb, self)._get_field(record, field_name, expression, tagName, field_options, options, values)\nattributes = data[0]\ncontent = data[1]\nif 'data_type' in field_options:\n if type(field_options['data_type']) == str and field_options['data_type'].lower() == 'raw':\n content = HTMLHelper.... | <|body_start_0|>
data = super(CFIrQWeb, self)._get_field(record, field_name, expression, tagName, field_options, options, values)
attributes = data[0]
content = data[1]
if 'data_type' in field_options:
if type(field_options['data_type']) == str and field_options['data_type'].... | 继承IrQWeb对象,以实现删除字段值中的HTML标签和前后空格 | CFIrQWeb | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CFIrQWeb:
"""继承IrQWeb对象,以实现删除字段值中的HTML标签和前后空格"""
def _get_field(self, record, field_name, expression, tagName, field_options, options, values):
"""判断是否指定了data_type=raw,如果已经指定则移除字段值中的HTML标签、换行和前后空格"""
<|body_0|>
def __is_show_html(self, el, options):
"""根据data_typ... | stack_v2_sparse_classes_10k_train_008711 | 7,553 | no_license | [
{
"docstring": "判断是否指定了data_type=raw,如果已经指定则移除字段值中的HTML标签、换行和前后空格",
"name": "_get_field",
"signature": "def _get_field(self, record, field_name, expression, tagName, field_options, options, values)"
},
{
"docstring": "根据data_type判断是否要显示HTML",
"name": "__is_show_html",
"signature": "def _... | 5 | stack_v2_sparse_classes_30k_train_005651 | Implement the Python class `CFIrQWeb` described below.
Class description:
继承IrQWeb对象,以实现删除字段值中的HTML标签和前后空格
Method signatures and docstrings:
- def _get_field(self, record, field_name, expression, tagName, field_options, options, values): 判断是否指定了data_type=raw,如果已经指定则移除字段值中的HTML标签、换行和前后空格
- def __is_show_html(self, el,... | Implement the Python class `CFIrQWeb` described below.
Class description:
继承IrQWeb对象,以实现删除字段值中的HTML标签和前后空格
Method signatures and docstrings:
- def _get_field(self, record, field_name, expression, tagName, field_options, options, values): 判断是否指定了data_type=raw,如果已经指定则移除字段值中的HTML标签、换行和前后空格
- def __is_show_html(self, el,... | a6f950a4c05c90ac5f53c1602ac2cda33faf41ee | <|skeleton|>
class CFIrQWeb:
"""继承IrQWeb对象,以实现删除字段值中的HTML标签和前后空格"""
def _get_field(self, record, field_name, expression, tagName, field_options, options, values):
"""判断是否指定了data_type=raw,如果已经指定则移除字段值中的HTML标签、换行和前后空格"""
<|body_0|>
def __is_show_html(self, el, options):
"""根据data_typ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CFIrQWeb:
"""继承IrQWeb对象,以实现删除字段值中的HTML标签和前后空格"""
def _get_field(self, record, field_name, expression, tagName, field_options, options, values):
"""判断是否指定了data_type=raw,如果已经指定则移除字段值中的HTML标签、换行和前后空格"""
data = super(CFIrQWeb, self)._get_field(record, field_name, expression, tagName, field_op... | the_stack_v2_python_sparse | uw_custom/cfprint/ir/ir_qweb/ir_qweb.py | kulius/odoo11_uw | train | 1 |
b9e28ccf14b2f6e3eb95428417ffd1946db8fae2 | [
"Whh = np.random.randn(h, h)\nWhx = np.random.randn(i, h)\nself.Wh = np.concatenate((Whh, Whx), axis=0)\nself.Wy = np.random.randn(h, o)\nself.bh = np.zeros((1, h))\nself.by = np.zeros((1, o))",
"x_max = np.max(x, axis=-1, keepdims=True)\ne_x = np.exp(x - x_max)\nreturn e_x / e_x.sum(axis=-1, keepdims=True)",
"... | <|body_start_0|>
Whh = np.random.randn(h, h)
Whx = np.random.randn(i, h)
self.Wh = np.concatenate((Whh, Whx), axis=0)
self.Wy = np.random.randn(h, o)
self.bh = np.zeros((1, h))
self.by = np.zeros((1, o))
<|end_body_0|>
<|body_start_1|>
x_max = np.max(x, axis=-1, ... | RNNCell class, vanila model | RNNCell | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RNNCell:
"""RNNCell class, vanila model"""
def __init__(self, i, h, o):
"""initialized the variables Arg: - i: is the dimensionality of the data - h: is the dimensionality of the hidden state - o: is the dimensionality of the outputs - Public instance attributes Wh, Wy, bh, by that r... | stack_v2_sparse_classes_10k_train_008712 | 1,721 | no_license | [
{
"docstring": "initialized the variables Arg: - i: is the dimensionality of the data - h: is the dimensionality of the hidden state - o: is the dimensionality of the outputs - Public instance attributes Wh, Wy, bh, by that represent the weights and biases of the cell - Wh and bh: for the concat hidden state an... | 3 | stack_v2_sparse_classes_30k_train_002469 | Implement the Python class `RNNCell` described below.
Class description:
RNNCell class, vanila model
Method signatures and docstrings:
- def __init__(self, i, h, o): initialized the variables Arg: - i: is the dimensionality of the data - h: is the dimensionality of the hidden state - o: is the dimensionality of the o... | Implement the Python class `RNNCell` described below.
Class description:
RNNCell class, vanila model
Method signatures and docstrings:
- def __init__(self, i, h, o): initialized the variables Arg: - i: is the dimensionality of the data - h: is the dimensionality of the hidden state - o: is the dimensionality of the o... | 5aff923277cfe9f2b5324a773e4e5c3cac810a0c | <|skeleton|>
class RNNCell:
"""RNNCell class, vanila model"""
def __init__(self, i, h, o):
"""initialized the variables Arg: - i: is the dimensionality of the data - h: is the dimensionality of the hidden state - o: is the dimensionality of the outputs - Public instance attributes Wh, Wy, bh, by that r... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RNNCell:
"""RNNCell class, vanila model"""
def __init__(self, i, h, o):
"""initialized the variables Arg: - i: is the dimensionality of the data - h: is the dimensionality of the hidden state - o: is the dimensionality of the outputs - Public instance attributes Wh, Wy, bh, by that represent the ... | the_stack_v2_python_sparse | supervised_learning/0x0D-RNNs/0-rnn_cell.py | cmmolanos1/holbertonschool-machine_learning | train | 1 |
bccb9f94cd6ab24551ad1aa5b0aebb88c3673991 | [
"self.setMassFrac('NI', 0.325)\nself.setMassFrac('CR', 0.21)\nself.setMassFrac('C', 0.00075)\nself.setMassFrac('MN', 0.015)\nself.setMassFrac('S', 0.00015)\nself.setMassFrac('SI', 0.01)\nself.setMassFrac('CU', 0.0075)\nself.setMassFrac('AL', 0.00375)\nself.setMassFrac('TI', 0.00375)\nself.setMassFrac('FE', 1.0 - su... | <|body_start_0|>
self.setMassFrac('NI', 0.325)
self.setMassFrac('CR', 0.21)
self.setMassFrac('C', 0.00075)
self.setMassFrac('MN', 0.015)
self.setMassFrac('S', 0.00015)
self.setMassFrac('SI', 0.01)
self.setMassFrac('CU', 0.0075)
self.setMassFrac('AL', 0.003... | Incoloy 800/800H (UNS N08800/N08810). .. [SM] Special Metals - Incoloy alloy 800 (https://www.specialmetals.com/assets/smc/documents/alloys/incoloy/incoloy-alloy-800.pdf) | Inconel800 | [
"Apache-2.0",
"GPL-1.0-or-later",
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Inconel800:
"""Incoloy 800/800H (UNS N08800/N08810). .. [SM] Special Metals - Incoloy alloy 800 (https://www.specialmetals.com/assets/smc/documents/alloys/incoloy/incoloy-alloy-800.pdf)"""
def setDefaultMassFracs(self):
"""Incoloy 800H mass fractions. From [SM]_."""
<|body_0|... | stack_v2_sparse_classes_10k_train_008713 | 2,857 | permissive | [
{
"docstring": "Incoloy 800H mass fractions. From [SM]_.",
"name": "setDefaultMassFracs",
"signature": "def setDefaultMassFracs(self)"
},
{
"docstring": "average thermal expansion dL/L. Used for computing hot dimensions. Parameters ---------- Tk : float temperature in (K) Tc : float Temperature ... | 3 | null | Implement the Python class `Inconel800` described below.
Class description:
Incoloy 800/800H (UNS N08800/N08810). .. [SM] Special Metals - Incoloy alloy 800 (https://www.specialmetals.com/assets/smc/documents/alloys/incoloy/incoloy-alloy-800.pdf)
Method signatures and docstrings:
- def setDefaultMassFracs(self): Inco... | Implement the Python class `Inconel800` described below.
Class description:
Incoloy 800/800H (UNS N08800/N08810). .. [SM] Special Metals - Incoloy alloy 800 (https://www.specialmetals.com/assets/smc/documents/alloys/incoloy/incoloy-alloy-800.pdf)
Method signatures and docstrings:
- def setDefaultMassFracs(self): Inco... | 360791847227df3f3a337a996ef561e00f846a09 | <|skeleton|>
class Inconel800:
"""Incoloy 800/800H (UNS N08800/N08810). .. [SM] Special Metals - Incoloy alloy 800 (https://www.specialmetals.com/assets/smc/documents/alloys/incoloy/incoloy-alloy-800.pdf)"""
def setDefaultMassFracs(self):
"""Incoloy 800H mass fractions. From [SM]_."""
<|body_0|... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Inconel800:
"""Incoloy 800/800H (UNS N08800/N08810). .. [SM] Special Metals - Incoloy alloy 800 (https://www.specialmetals.com/assets/smc/documents/alloys/incoloy/incoloy-alloy-800.pdf)"""
def setDefaultMassFracs(self):
"""Incoloy 800H mass fractions. From [SM]_."""
self.setMassFrac('NI',... | the_stack_v2_python_sparse | armi/materials/inconel800.py | terrapower/armi | train | 204 |
221af954ec827e037fdab8c1c32d0d14bcb7daeb | [
"if self == other:\n return self\nelif type(self) == type(other):\n return type(self)(self.vars & other.vars)\nelif isinstance(other, SymbolicSubringAcceptingVarsFunctor):\n if not self.vars & other.vars:\n return self",
"if R is not SR:\n raise NotImplementedError('This functor can only be app... | <|body_start_0|>
if self == other:
return self
elif type(self) == type(other):
return type(self)(self.vars & other.vars)
elif isinstance(other, SymbolicSubringAcceptingVarsFunctor):
if not self.vars & other.vars:
return self
<|end_body_0|>
<|b... | SymbolicSubringRejectingVarsFunctor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SymbolicSubringRejectingVarsFunctor:
def merge(self, other):
"""Merge this functor with ``other`` if possible. INPUT: - ``other`` -- a functor. OUTPUT: A functor or ``None``. EXAMPLES:: sage: from sage.symbolic.subring import SymbolicSubring sage: F = SymbolicSubring(accepting_variables=... | stack_v2_sparse_classes_10k_train_008714 | 31,870 | no_license | [
{
"docstring": "Merge this functor with ``other`` if possible. INPUT: - ``other`` -- a functor. OUTPUT: A functor or ``None``. EXAMPLES:: sage: from sage.symbolic.subring import SymbolicSubring sage: F = SymbolicSubring(accepting_variables=('a',)).construction()[0] sage: G = SymbolicSubring(rejecting_variables=... | 2 | null | Implement the Python class `SymbolicSubringRejectingVarsFunctor` described below.
Class description:
Implement the SymbolicSubringRejectingVarsFunctor class.
Method signatures and docstrings:
- def merge(self, other): Merge this functor with ``other`` if possible. INPUT: - ``other`` -- a functor. OUTPUT: A functor or... | Implement the Python class `SymbolicSubringRejectingVarsFunctor` described below.
Class description:
Implement the SymbolicSubringRejectingVarsFunctor class.
Method signatures and docstrings:
- def merge(self, other): Merge this functor with ``other`` if possible. INPUT: - ``other`` -- a functor. OUTPUT: A functor or... | 0d9eacbf74e2acffefde93e39f8bcbec745cdaba | <|skeleton|>
class SymbolicSubringRejectingVarsFunctor:
def merge(self, other):
"""Merge this functor with ``other`` if possible. INPUT: - ``other`` -- a functor. OUTPUT: A functor or ``None``. EXAMPLES:: sage: from sage.symbolic.subring import SymbolicSubring sage: F = SymbolicSubring(accepting_variables=... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SymbolicSubringRejectingVarsFunctor:
def merge(self, other):
"""Merge this functor with ``other`` if possible. INPUT: - ``other`` -- a functor. OUTPUT: A functor or ``None``. EXAMPLES:: sage: from sage.symbolic.subring import SymbolicSubring sage: F = SymbolicSubring(accepting_variables=('a',)).constr... | the_stack_v2_python_sparse | sage/src/sage/symbolic/subring.py | bopopescu/geosci | train | 0 | |
bc7de1f208e99a5991ed3cfe3933b5909fa0cbbe | [
"self.data = dict()\nself.max = float('-inf')\nself.min = float('inf')",
"self.data[number] = self.data.get(number, 0) + 1\nif number > self.max:\n self.max = number\nif number < self.min:\n self.min = number",
"if value > self.max * 2 or value < self.min * 2:\n return False\ndic = self.data\nfor k in ... | <|body_start_0|>
self.data = dict()
self.max = float('-inf')
self.min = float('inf')
<|end_body_0|>
<|body_start_1|>
self.data[number] = self.data.get(number, 0) + 1
if number > self.max:
self.max = number
if number < self.min:
self.min = number
<... | TwoSum | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TwoSum:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def add(self, number):
"""Add the number to an internal data structure.. :type number: int :rtype: None"""
<|body_1|>
def find(self, value):
"""Find if there exists... | stack_v2_sparse_classes_10k_train_008715 | 1,115 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Add the number to an internal data structure.. :type number: int :rtype: None",
"name": "add",
"signature": "def add(self, number)"
},
{
"docstring": "F... | 3 | stack_v2_sparse_classes_30k_train_006408 | Implement the Python class `TwoSum` described below.
Class description:
Implement the TwoSum class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def add(self, number): Add the number to an internal data structure.. :type number: int :rtype: None
- def find(self, value... | Implement the Python class `TwoSum` described below.
Class description:
Implement the TwoSum class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def add(self, number): Add the number to an internal data structure.. :type number: int :rtype: None
- def find(self, value... | edff905f63ab95cdd40447b27a9c449c9cefec37 | <|skeleton|>
class TwoSum:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def add(self, number):
"""Add the number to an internal data structure.. :type number: int :rtype: None"""
<|body_1|>
def find(self, value):
"""Find if there exists... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TwoSum:
def __init__(self):
"""Initialize your data structure here."""
self.data = dict()
self.max = float('-inf')
self.min = float('inf')
def add(self, number):
"""Add the number to an internal data structure.. :type number: int :rtype: None"""
self.data[n... | the_stack_v2_python_sparse | _0170_Two_Sum III_Data_structure_design.py | mingweihe/leetcode | train | 3 | |
1e9cd7834cc161411638219dec8a3bbb8fab9953 | [
"pos_markers = []\npix_markers = []\nfor box in boxes:\n (pt1_w, pt1_h), (pt2_w, pt2_h) = box\n pix_marker = ((pt1_w + pt2_w) // 2, max(pt1_h, pt2_h))\n pix_markers.append(pix_marker)\n pos_marker = np.array(pix_marker).reshape(1, 1, 2).astype('float32')\n pos_marker = cv2.perspectiveTransform(pos_ma... | <|body_start_0|>
pos_markers = []
pix_markers = []
for box in boxes:
(pt1_w, pt1_h), (pt2_w, pt2_h) = box
pix_marker = ((pt1_w + pt2_w) // 2, max(pt1_h, pt2_h))
pix_markers.append(pix_marker)
pos_marker = np.array(pix_marker).reshape(1, 1, 2).astyp... | A mixin to calculate distances between detected boxes/pedastrians | SocialDistancingMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SocialDistancingMixin:
"""A mixin to calculate distances between detected boxes/pedastrians"""
def _calculate_distances(boxes, homography):
"""Calculate a reference marker for each box and calculate bird eye distances between boxes Args: boxes (list): A list of boxes defined as a tup... | stack_v2_sparse_classes_10k_train_008716 | 9,664 | permissive | [
{
"docstring": "Calculate a reference marker for each box and calculate bird eye distances between boxes Args: boxes (list): A list of boxes defined as a tuple of 2D points. homography (np.array): A 3x3 numpy array. Returns: pix_markers (list): A list of marker coordinates defined as tuples, distances (np.array... | 5 | stack_v2_sparse_classes_30k_train_006129 | Implement the Python class `SocialDistancingMixin` described below.
Class description:
A mixin to calculate distances between detected boxes/pedastrians
Method signatures and docstrings:
- def _calculate_distances(boxes, homography): Calculate a reference marker for each box and calculate bird eye distances between b... | Implement the Python class `SocialDistancingMixin` described below.
Class description:
A mixin to calculate distances between detected boxes/pedastrians
Method signatures and docstrings:
- def _calculate_distances(boxes, homography): Calculate a reference marker for each box and calculate bird eye distances between b... | 2e29ab2d3deb81fd999b74a2f6844c54a836c6d8 | <|skeleton|>
class SocialDistancingMixin:
"""A mixin to calculate distances between detected boxes/pedastrians"""
def _calculate_distances(boxes, homography):
"""Calculate a reference marker for each box and calculate bird eye distances between boxes Args: boxes (list): A list of boxes defined as a tup... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SocialDistancingMixin:
"""A mixin to calculate distances between detected boxes/pedastrians"""
def _calculate_distances(boxes, homography):
"""Calculate a reference marker for each box and calculate bird eye distances between boxes Args: boxes (list): A list of boxes defined as a tuple of 2D poin... | the_stack_v2_python_sparse | service/mixins.py | ai404/esafe-platform | train | 0 |
888f8d30eafb54a3a3b15c30e988ee44c2ead35b | [
"self.inline_class = config.get('inline_class', '')\nself.latex2svg = latex2svg\nInlineProcessor.__init__(self, pattern, md)",
"escapes = m.group(1)\nif not escapes:\n escapes = m.group(4)\nif escapes:\n return (escapes.replace('\\\\\\\\', self.ESCAPED_BSLASH), m.start(0), m.end(0))\nlatex = m.group(3)\nif ... | <|body_start_0|>
self.inline_class = config.get('inline_class', '')
self.latex2svg = latex2svg
InlineProcessor.__init__(self, pattern, md)
<|end_body_0|>
<|body_start_1|>
escapes = m.group(1)
if not escapes:
escapes = m.group(4)
if escapes:
return... | MathSvg inline pattern handler. | InlineMathSvgPattern | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InlineMathSvgPattern:
"""MathSvg inline pattern handler."""
def __init__(self, pattern, config, latex2svg, md):
"""Initialize."""
<|body_0|>
def handleMatch(self, m, data):
"""Handle inline content."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_008717 | 22,334 | permissive | [
{
"docstring": "Initialize.",
"name": "__init__",
"signature": "def __init__(self, pattern, config, latex2svg, md)"
},
{
"docstring": "Handle inline content.",
"name": "handleMatch",
"signature": "def handleMatch(self, m, data)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007303 | Implement the Python class `InlineMathSvgPattern` described below.
Class description:
MathSvg inline pattern handler.
Method signatures and docstrings:
- def __init__(self, pattern, config, latex2svg, md): Initialize.
- def handleMatch(self, m, data): Handle inline content. | Implement the Python class `InlineMathSvgPattern` described below.
Class description:
MathSvg inline pattern handler.
Method signatures and docstrings:
- def __init__(self, pattern, config, latex2svg, md): Initialize.
- def handleMatch(self, m, data): Handle inline content.
<|skeleton|>
class InlineMathSvgPattern:
... | 45c862669d8d4e72c95f6b278819379a1c1e68d4 | <|skeleton|>
class InlineMathSvgPattern:
"""MathSvg inline pattern handler."""
def __init__(self, pattern, config, latex2svg, md):
"""Initialize."""
<|body_0|>
def handleMatch(self, m, data):
"""Handle inline content."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class InlineMathSvgPattern:
"""MathSvg inline pattern handler."""
def __init__(self, pattern, config, latex2svg, md):
"""Initialize."""
self.inline_class = config.get('inline_class', '')
self.latex2svg = latex2svg
InlineProcessor.__init__(self, pattern, md)
def handleMatch(... | the_stack_v2_python_sparse | pylbm_ui/widgets/mdx_math_svg.py | gouarin/pylbm_ui | train | 0 |
bf221a3d3e7ce7eb491cec9c43bdbb43ed36e4f5 | [
"self.timeout = timeout\ntry:\n self.pre_snap = self.mapping.learn_ops(device=uut, abstract=abstract, steps=steps, timeout=timeout)\nexcept Exception as e:\n self.errored(\"Section failed due to: '{e}'\".format(e=e))\nfor stp in steps.details:\n if stp.result.name == 'skipped':\n self.skipped('Canno... | <|body_start_0|>
self.timeout = timeout
try:
self.pre_snap = self.mapping.learn_ops(device=uut, abstract=abstract, steps=steps, timeout=timeout)
except Exception as e:
self.errored("Section failed due to: '{e}'".format(e=e))
for stp in steps.details:
i... | Trigger class for Modify action | TriggerModify | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TriggerModify:
"""Trigger class for Modify action"""
def verify_prerequisite(self, uut, abstract, steps, timeout):
"""Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to the next testcase. Args: uut (`obj`): Device object. abstract (`obj`... | stack_v2_sparse_classes_10k_train_008718 | 5,499 | permissive | [
{
"docstring": "Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to the next testcase. Args: uut (`obj`): Device object. abstract (`obj`): Abstract object. steps (`step obj`): aetest step object timeout (`timeout obj`): Timeout Object Returns: None Raises: pyATS Res... | 6 | null | Implement the Python class `TriggerModify` described below.
Class description:
Trigger class for Modify action
Method signatures and docstrings:
- def verify_prerequisite(self, uut, abstract, steps, timeout): Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to the next te... | Implement the Python class `TriggerModify` described below.
Class description:
Trigger class for Modify action
Method signatures and docstrings:
- def verify_prerequisite(self, uut, abstract, steps, timeout): Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to the next te... | e42e51475cddcb10f5c7814d0fe892ac865742ba | <|skeleton|>
class TriggerModify:
"""Trigger class for Modify action"""
def verify_prerequisite(self, uut, abstract, steps, timeout):
"""Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to the next testcase. Args: uut (`obj`): Device object. abstract (`obj`... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TriggerModify:
"""Trigger class for Modify action"""
def verify_prerequisite(self, uut, abstract, steps, timeout):
"""Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to the next testcase. Args: uut (`obj`): Device object. abstract (`obj`): Abstract o... | the_stack_v2_python_sparse | pkgs/sdk-pkg/src/genie/libs/sdk/triggers/modify/modify.py | CiscoTestAutomation/genielibs | train | 109 |
8918786f098a26e9888ecc5be3afe37bf6bffb34 | [
"self.app_id = 'my-app'\nos.environ['APPLICATION_ID'] = self.app_id\nself.datastore_stub = datastore_file_stub.DatastoreFileStub(self.app_id, None)\nself.ResetApiProxyStubMap()\napiproxy_stub_map.apiproxy.RegisterStub('datastore_v3', self.datastore_stub)",
"if self.__apiproxy_initialized:\n return\nself.__apip... | <|body_start_0|>
self.app_id = 'my-app'
os.environ['APPLICATION_ID'] = self.app_id
self.datastore_stub = datastore_file_stub.DatastoreFileStub(self.app_id, None)
self.ResetApiProxyStubMap()
apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3', self.datastore_stub)
<|end_body_0|... | Base class for tests that require datastore. | DatastoreTest | [
"BSD-3-Clause",
"Apache-2.0",
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DatastoreTest:
"""Base class for tests that require datastore."""
def setUp(self):
"""Set up the datastore."""
<|body_0|>
def ResetApiProxyStubMap(self):
"""Reset the proxy stub-map. Args: force: When True, always reset the stubs regardless of their status. Must ... | stack_v2_sparse_classes_10k_train_008719 | 2,277 | permissive | [
{
"docstring": "Set up the datastore.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Reset the proxy stub-map. Args: force: When True, always reset the stubs regardless of their status. Must be called before stubs can be configured. Every time a new test is created, it is n... | 2 | null | Implement the Python class `DatastoreTest` described below.
Class description:
Base class for tests that require datastore.
Method signatures and docstrings:
- def setUp(self): Set up the datastore.
- def ResetApiProxyStubMap(self): Reset the proxy stub-map. Args: force: When True, always reset the stubs regardless o... | Implement the Python class `DatastoreTest` described below.
Class description:
Base class for tests that require datastore.
Method signatures and docstrings:
- def setUp(self): Set up the datastore.
- def ResetApiProxyStubMap(self): Reset the proxy stub-map. Args: force: When True, always reset the stubs regardless o... | 72a05af97787001756bae2511b7985e61498c965 | <|skeleton|>
class DatastoreTest:
"""Base class for tests that require datastore."""
def setUp(self):
"""Set up the datastore."""
<|body_0|>
def ResetApiProxyStubMap(self):
"""Reset the proxy stub-map. Args: force: When True, always reset the stubs regardless of their status. Must ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DatastoreTest:
"""Base class for tests that require datastore."""
def setUp(self):
"""Set up the datastore."""
self.app_id = 'my-app'
os.environ['APPLICATION_ID'] = self.app_id
self.datastore_stub = datastore_file_stub.DatastoreFileStub(self.app_id, None)
self.Rese... | the_stack_v2_python_sparse | third_party/catapult/third_party/gsutil/third_party/protorpc/demos/tunes_db/server/datastore_test_util.py | metux/chromium-suckless | train | 5 |
e66098fb2b562982364cec65e504aacad82e3ffe | [
"test_node = java_group.JavaGroup(self.TEST_GRP_1)\nself.assertEqual(test_node.name, self.TEST_GRP_1)\nself.assertEqual(test_node.classes, {})",
"test_node = java_group.JavaGroup(self.TEST_GRP_1)\nmock_class_node = create_mock_java_class()\ntest_node.add_class(mock_class_node)\nself.assertEqual(test_node.classes,... | <|body_start_0|>
test_node = java_group.JavaGroup(self.TEST_GRP_1)
self.assertEqual(test_node.name, self.TEST_GRP_1)
self.assertEqual(test_node.classes, {})
<|end_body_0|>
<|body_start_1|>
test_node = java_group.JavaGroup(self.TEST_GRP_1)
mock_class_node = create_mock_java_class... | Unit tests for dependency_analysis.class_dependency.JavaGroup. | TestJavaPackage | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestJavaPackage:
"""Unit tests for dependency_analysis.class_dependency.JavaGroup."""
def test_initialization(self):
"""Tests that JavaGroup is initialized correctly."""
<|body_0|>
def test_add_class(self):
"""Tests adding a single class to this group."""
... | stack_v2_sparse_classes_10k_train_008720 | 4,390 | permissive | [
{
"docstring": "Tests that JavaGroup is initialized correctly.",
"name": "test_initialization",
"signature": "def test_initialization(self)"
},
{
"docstring": "Tests adding a single class to this group.",
"name": "test_add_class",
"signature": "def test_add_class(self)"
},
{
"doc... | 6 | null | Implement the Python class `TestJavaPackage` described below.
Class description:
Unit tests for dependency_analysis.class_dependency.JavaGroup.
Method signatures and docstrings:
- def test_initialization(self): Tests that JavaGroup is initialized correctly.
- def test_add_class(self): Tests adding a single class to t... | Implement the Python class `TestJavaPackage` described below.
Class description:
Unit tests for dependency_analysis.class_dependency.JavaGroup.
Method signatures and docstrings:
- def test_initialization(self): Tests that JavaGroup is initialized correctly.
- def test_add_class(self): Tests adding a single class to t... | a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c | <|skeleton|>
class TestJavaPackage:
"""Unit tests for dependency_analysis.class_dependency.JavaGroup."""
def test_initialization(self):
"""Tests that JavaGroup is initialized correctly."""
<|body_0|>
def test_add_class(self):
"""Tests adding a single class to this group."""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestJavaPackage:
"""Unit tests for dependency_analysis.class_dependency.JavaGroup."""
def test_initialization(self):
"""Tests that JavaGroup is initialized correctly."""
test_node = java_group.JavaGroup(self.TEST_GRP_1)
self.assertEqual(test_node.name, self.TEST_GRP_1)
sel... | the_stack_v2_python_sparse | tools/android/dependency_analysis/java_group_unittest.py | chromium/chromium | train | 17,408 |
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_10k_train_008721 | 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 | null | 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_10k | data/stack_v2_sparse_classes_30k | 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 | |
1c8b61f3590884d15f424bcecbc43bb796b6e659 | [
"init_log = idaeslog.getInitLogger(self.name, outlvl, tag='properties')\ninit_log.info('Initialization Complete.')\nif hold_state is True:\n flags = fix_state_vars(self, state_args)\n return flags\nelse:\n return",
"init_log = idaeslog.getInitLogger(self.name, outlvl, tag='properties')\nif flags is None:... | <|body_start_0|>
init_log = idaeslog.getInitLogger(self.name, outlvl, tag='properties')
init_log.info('Initialization Complete.')
if hold_state is True:
flags = fix_state_vars(self, state_args)
return flags
else:
return
<|end_body_0|>
<|body_start_1|>... | This Class contains methods which should be applied to Property Blocks as a whole, rather than individual elements of indexed Property Blocks. | _WaterStateBlock | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _WaterStateBlock:
"""This Class contains methods which should be applied to Property Blocks as a whole, rather than individual elements of indexed Property Blocks."""
def initialize(self, state_args=None, state_vars_fixed=False, hold_state=False, outlvl=idaeslog.NOTSET, solver=None, optarg=N... | stack_v2_sparse_classes_10k_train_008722 | 12,757 | permissive | [
{
"docstring": "Initialization routine for property package. Keyword Arguments: state_args : Dictionary with initial guesses for the state vars chosen. Note that if this method is triggered through the control volume, and if initial guesses were not provied at the unit model level, the control volume passes the... | 2 | stack_v2_sparse_classes_30k_train_004239 | Implement the Python class `_WaterStateBlock` described below.
Class description:
This Class contains methods which should be applied to Property Blocks as a whole, rather than individual elements of indexed Property Blocks.
Method signatures and docstrings:
- def initialize(self, state_args=None, state_vars_fixed=Fa... | Implement the Python class `_WaterStateBlock` described below.
Class description:
This Class contains methods which should be applied to Property Blocks as a whole, rather than individual elements of indexed Property Blocks.
Method signatures and docstrings:
- def initialize(self, state_args=None, state_vars_fixed=Fa... | 14dc1a8906230747ce8f3edcb88641ac587be968 | <|skeleton|>
class _WaterStateBlock:
"""This Class contains methods which should be applied to Property Blocks as a whole, rather than individual elements of indexed Property Blocks."""
def initialize(self, state_args=None, state_vars_fixed=False, hold_state=False, outlvl=idaeslog.NOTSET, solver=None, optarg=N... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class _WaterStateBlock:
"""This Class contains methods which should be applied to Property Blocks as a whole, rather than individual elements of indexed Property Blocks."""
def initialize(self, state_args=None, state_vars_fixed=False, hold_state=False, outlvl=idaeslog.NOTSET, solver=None, optarg=None):
... | the_stack_v2_python_sparse | watertap/core/zero_order_properties.py | watertap-org/watertap | train | 20 |
c313c90d6589fc0b615c558199a66f4191796ce0 | [
"nums.sort()\nif len(nums) > 2:\n n = 1\n while n < len(nums) - 1:\n nums[n], nums[n + 1] = (nums[n + 1], nums[n])\n n += 2",
"for i in range(1, len(nums), 2):\n if nums[i] < nums[i - 1]:\n nums[i], nums[i - 1] = (nums[i - 1], nums[i])\n if i + 1 < len(nums) and nums[i] < nums[i +... | <|body_start_0|>
nums.sort()
if len(nums) > 2:
n = 1
while n < len(nums) - 1:
nums[n], nums[n + 1] = (nums[n + 1], nums[n])
n += 2
<|end_body_0|>
<|body_start_1|>
for i in range(1, len(nums), 2):
if nums[i] < nums[i - 1]:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def wiggleSort(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
<|body_0|>
def wiggleSort_II(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."... | stack_v2_sparse_classes_10k_train_008723 | 807 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.",
"name": "wiggleSort",
"signature": "def wiggleSort(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.",
"name": "wi... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wiggleSort(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.
- def wiggleSort_II(self, nums): :type nums: List[int] :rtype... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wiggleSort(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.
- def wiggleSort_II(self, nums): :type nums: List[int] :rtype... | 1461b10b8910fa90a311939c6df9082a8526f9b1 | <|skeleton|>
class Solution:
def wiggleSort(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
<|body_0|>
def wiggleSort_II(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def wiggleSort(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
nums.sort()
if len(nums) > 2:
n = 1
while n < len(nums) - 1:
nums[n], nums[n + 1] = (nums[n + 1], nums[n])
... | the_stack_v2_python_sparse | Medium/280_wiggleSort.py | Yucheng7713/CodingPracticeByYuch | train | 0 | |
f3e3c7ee3c40be6de2a4ea5a58a5de658adb59c7 | [
"if not I.PIL_INSTALLED:\n raise Exception('PIL is not installed. Please install with: pip install pillow>=9.0.1')\nsuper().__init__(device=device, quantize=False, min_transformers_version='4.12.3')\nself.model_name = model_name\nfrom transformers import AutoTokenizer, VisionEncoderDecoderModel, ViTFeatureExtrac... | <|body_start_0|>
if not I.PIL_INSTALLED:
raise Exception('PIL is not installed. Please install with: pip install pillow>=9.0.1')
super().__init__(device=device, quantize=False, min_transformers_version='4.12.3')
self.model_name = model_name
from transformers import AutoTokeni... | interface to Image Captioner | ImageCaptioner | [
"Apache-2.0",
"CC-BY-NC-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageCaptioner:
"""interface to Image Captioner"""
def __init__(self, model_name='ydshieh/vit-gpt2-coco-en', device=None):
"""``` ImageCaptioner constructor Args: model_name(str): name of image captioning model device(str): device to use (e.g., 'cuda', 'cpu') ```"""
<|body_0|... | stack_v2_sparse_classes_10k_train_008724 | 2,526 | permissive | [
{
"docstring": "``` ImageCaptioner constructor Args: model_name(str): name of image captioning model device(str): device to use (e.g., 'cuda', 'cpu') ```",
"name": "__init__",
"signature": "def __init__(self, model_name='ydshieh/vit-gpt2-coco-en', device=None)"
},
{
"docstring": "``` Performs im... | 2 | stack_v2_sparse_classes_30k_train_000172 | Implement the Python class `ImageCaptioner` described below.
Class description:
interface to Image Captioner
Method signatures and docstrings:
- def __init__(self, model_name='ydshieh/vit-gpt2-coco-en', device=None): ``` ImageCaptioner constructor Args: model_name(str): name of image captioning model device(str): dev... | Implement the Python class `ImageCaptioner` described below.
Class description:
interface to Image Captioner
Method signatures and docstrings:
- def __init__(self, model_name='ydshieh/vit-gpt2-coco-en', device=None): ``` ImageCaptioner constructor Args: model_name(str): name of image captioning model device(str): dev... | ab03ae68053b727cb8907e08c35f265531d1cb3a | <|skeleton|>
class ImageCaptioner:
"""interface to Image Captioner"""
def __init__(self, model_name='ydshieh/vit-gpt2-coco-en', device=None):
"""``` ImageCaptioner constructor Args: model_name(str): name of image captioning model device(str): device to use (e.g., 'cuda', 'cpu') ```"""
<|body_0|... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ImageCaptioner:
"""interface to Image Captioner"""
def __init__(self, model_name='ydshieh/vit-gpt2-coco-en', device=None):
"""``` ImageCaptioner constructor Args: model_name(str): name of image captioning model device(str): device to use (e.g., 'cuda', 'cpu') ```"""
if not I.PIL_INSTALLED... | the_stack_v2_python_sparse | ktrain/vision/caption/core.py | amaiya/ktrain | train | 1,217 |
91f5a9f906436566e2cc0f844ba731d7ef2ca05d | [
"self._classMapping = OrderedDict()\nself._classMapping['Resource'] = 'http://www.w3.org/2000/01/rdf-schema#Class'\nself._classMapping['SendState'] = 'http://www.imi.kit.edu/abstract-pass-ont#SendState'\nself._classMapping['FunctionState'] = 'http://www.imi.kit.edu/abstract-pass-ont#FunctionState'\nself._classMappi... | <|body_start_0|>
self._classMapping = OrderedDict()
self._classMapping['Resource'] = 'http://www.w3.org/2000/01/rdf-schema#Class'
self._classMapping['SendState'] = 'http://www.imi.kit.edu/abstract-pass-ont#SendState'
self._classMapping['FunctionState'] = 'http://www.imi.kit.edu/abstract-... | The class mapper is responsible for mapping the rdf:type attribute to the python classes and vice versa. :version: 2015-12-04 :author: Lukas Block | ClassMapper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClassMapper:
"""The class mapper is responsible for mapping the rdf:type attribute to the python classes and vice versa. :version: 2015-12-04 :author: Lukas Block"""
def __init__(self):
"""Constructor @return : @author"""
<|body_0|>
def getClassName(self, uris):
... | stack_v2_sparse_classes_10k_train_008725 | 4,695 | no_license | [
{
"docstring": "Constructor @return : @author",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Returns the class name that should be associated with the given rdfs class which is specified by the uri strings. The string with the highest specificy (regarding this class m... | 3 | stack_v2_sparse_classes_30k_train_001735 | Implement the Python class `ClassMapper` described below.
Class description:
The class mapper is responsible for mapping the rdf:type attribute to the python classes and vice versa. :version: 2015-12-04 :author: Lukas Block
Method signatures and docstrings:
- def __init__(self): Constructor @return : @author
- def ge... | Implement the Python class `ClassMapper` described below.
Class description:
The class mapper is responsible for mapping the rdf:type attribute to the python classes and vice versa. :version: 2015-12-04 :author: Lukas Block
Method signatures and docstrings:
- def __init__(self): Constructor @return : @author
- def ge... | f7a0f19c5c697f0050db94e1aca669ea3d2f3d34 | <|skeleton|>
class ClassMapper:
"""The class mapper is responsible for mapping the rdf:type attribute to the python classes and vice versa. :version: 2015-12-04 :author: Lukas Block"""
def __init__(self):
"""Constructor @return : @author"""
<|body_0|>
def getClassName(self, uris):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ClassMapper:
"""The class mapper is responsible for mapping the rdf:type attribute to the python classes and vice versa. :version: 2015-12-04 :author: Lukas Block"""
def __init__(self):
"""Constructor @return : @author"""
self._classMapping = OrderedDict()
self._classMapping['Reso... | the_stack_v2_python_sparse | Model/PASS/ClassMapper.py | uagnd/S-BPM_VR | train | 0 |
64331b86df954f27de3f2e0c292da9430c104986 | [
"self.require_action_permitted('grant')\nq = model.Account.all().filter('requested_actions !=', None)\nrequests = []\nfor account in q.fetch(100):\n for action in account.requested_actions:\n if check_action_permitted(self.account, 'grant'):\n requests.append({'email': account.email, 'requested... | <|body_start_0|>
self.require_action_permitted('grant')
q = model.Account.all().filter('requested_actions !=', None)
requests = []
for account in q.fetch(100):
for action in account.requested_actions:
if check_action_permitted(self.account, 'grant'):
... | GrantAccess | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GrantAccess:
def get(self):
"""Shows all access requests that are waiting for approval."""
<|body_0|>
def post(self):
"""Grants or denies a single request."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.require_action_permitted('grant')
... | stack_v2_sparse_classes_10k_train_008726 | 3,812 | permissive | [
{
"docstring": "Shows all access requests that are waiting for approval.",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Grants or denies a single request.",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007052 | Implement the Python class `GrantAccess` described below.
Class description:
Implement the GrantAccess class.
Method signatures and docstrings:
- def get(self): Shows all access requests that are waiting for approval.
- def post(self): Grants or denies a single request. | Implement the Python class `GrantAccess` described below.
Class description:
Implement the GrantAccess class.
Method signatures and docstrings:
- def get(self): Shows all access requests that are waiting for approval.
- def post(self): Grants or denies a single request.
<|skeleton|>
class GrantAccess:
def get(s... | 7715276b3c588f7c457de04944559052c8170f7e | <|skeleton|>
class GrantAccess:
def get(self):
"""Shows all access requests that are waiting for approval."""
<|body_0|>
def post(self):
"""Grants or denies a single request."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GrantAccess:
def get(self):
"""Shows all access requests that are waiting for approval."""
self.require_action_permitted('grant')
q = model.Account.all().filter('requested_actions !=', None)
requests = []
for account in q.fetch(100):
for action in account.re... | the_stack_v2_python_sparse | app/grant_access.py | Princessgladys/googleresourcefinder | train | 0 | |
9d85404ab72d306bf8bac59c3b89bce3ebf45b0c | [
"tests = [[True, 'civic'], [True, 'ivicc'], [False, 'civil'], [False, 'livci']]\nfor valid, string in tests:\n self.assertEqual(valid, could_be_a_palindrome(string), '%s should be %s' % (string, valid))",
"tests = [[False, 'canal'], [True, 'a man a plan a canal panama'], [True, 'amanaplanacanalpanama'], [False... | <|body_start_0|>
tests = [[True, 'civic'], [True, 'ivicc'], [False, 'civil'], [False, 'livci']]
for valid, string in tests:
self.assertEqual(valid, could_be_a_palindrome(string), '%s should be %s' % (string, valid))
<|end_body_0|>
<|body_start_1|>
tests = [[False, 'canal'], [True, '... | TestPermutationPalindrome | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestPermutationPalindrome:
def test_0givenexample(self):
"""test the given example"""
<|body_0|>
def test_1simpletons(self):
"""some more simple tests"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
tests = [[True, 'civic'], [True, 'ivicc'], [False,... | stack_v2_sparse_classes_10k_train_008727 | 2,805 | no_license | [
{
"docstring": "test the given example",
"name": "test_0givenexample",
"signature": "def test_0givenexample(self)"
},
{
"docstring": "some more simple tests",
"name": "test_1simpletons",
"signature": "def test_1simpletons(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005432 | Implement the Python class `TestPermutationPalindrome` described below.
Class description:
Implement the TestPermutationPalindrome class.
Method signatures and docstrings:
- def test_0givenexample(self): test the given example
- def test_1simpletons(self): some more simple tests | Implement the Python class `TestPermutationPalindrome` described below.
Class description:
Implement the TestPermutationPalindrome class.
Method signatures and docstrings:
- def test_0givenexample(self): test the given example
- def test_1simpletons(self): some more simple tests
<|skeleton|>
class TestPermutationPal... | aaf9b57dd957bc8756c97453dd35c01e8609e276 | <|skeleton|>
class TestPermutationPalindrome:
def test_0givenexample(self):
"""test the given example"""
<|body_0|>
def test_1simpletons(self):
"""some more simple tests"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestPermutationPalindrome:
def test_0givenexample(self):
"""test the given example"""
tests = [[True, 'civic'], [True, 'ivicc'], [False, 'civil'], [False, 'livci']]
for valid, string in tests:
self.assertEqual(valid, could_be_a_palindrome(string), '%s should be %s' % (strin... | the_stack_v2_python_sparse | 30-permutation-palindrome.py | jerryasher-challenges/challenge-interviewcake | train | 11 | |
b91631c717577a551d60e76b68c722eadf34e3d0 | [
"self.__wait_for_modules = wait_for_modules if wait_for_modules is not None else []\nself.__wait_for_states = [s if isinstance(s, MotionStatus) else MotionStatus(s) for s in wait_for_states] if wait_for_states is not None else []\nself.__wait_for_timeout = wait_for_timeout",
"if len(self.__wait_for_modules) == 0:... | <|body_start_0|>
self.__wait_for_modules = wait_for_modules if wait_for_modules is not None else []
self.__wait_for_states = [s if isinstance(s, MotionStatus) else MotionStatus(s) for s in wait_for_states] if wait_for_states is not None else []
self.__wait_for_timeout = wait_for_timeout
<|end_bo... | Mixin for a device that should wait for the motion status of another device. | WaitForMotionMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WaitForMotionMixin:
"""Mixin for a device that should wait for the motion status of another device."""
def __init__(self, wait_for_modules: Optional[List[str]]=None, wait_for_states: Optional[List[Union[MotionStatus, str]]]=None, wait_for_timeout: float=0, **kwargs: Any):
"""Initiali... | stack_v2_sparse_classes_10k_train_008728 | 2,796 | permissive | [
{
"docstring": "Initializes the mixin. Args: wait_for_modules: One or more modules to wait for. wait_for_states: List of states to wait for. wait_for_timeout: Wait timeout in seconds.",
"name": "__init__",
"signature": "def __init__(self, wait_for_modules: Optional[List[str]]=None, wait_for_states: Opti... | 2 | null | Implement the Python class `WaitForMotionMixin` described below.
Class description:
Mixin for a device that should wait for the motion status of another device.
Method signatures and docstrings:
- def __init__(self, wait_for_modules: Optional[List[str]]=None, wait_for_states: Optional[List[Union[MotionStatus, str]]]=... | Implement the Python class `WaitForMotionMixin` described below.
Class description:
Mixin for a device that should wait for the motion status of another device.
Method signatures and docstrings:
- def __init__(self, wait_for_modules: Optional[List[str]]=None, wait_for_states: Optional[List[Union[MotionStatus, str]]]=... | 2d7a06e5485b61b6ca7e51d99b08651ea6021086 | <|skeleton|>
class WaitForMotionMixin:
"""Mixin for a device that should wait for the motion status of another device."""
def __init__(self, wait_for_modules: Optional[List[str]]=None, wait_for_states: Optional[List[Union[MotionStatus, str]]]=None, wait_for_timeout: float=0, **kwargs: Any):
"""Initiali... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WaitForMotionMixin:
"""Mixin for a device that should wait for the motion status of another device."""
def __init__(self, wait_for_modules: Optional[List[str]]=None, wait_for_states: Optional[List[Union[MotionStatus, str]]]=None, wait_for_timeout: float=0, **kwargs: Any):
"""Initializes the mixin... | the_stack_v2_python_sparse | pyobs/mixins/waitformotion.py | pyobs/pyobs-core | train | 9 |
6b2efd05e01c9c458c11ece0a2040ff23fa9a833 | [
"logger.info('Creating root object accessor %s' % name)\nself._name = name\n\nclass AccessorImpl_(clientClass):\n \"\"\"Implementation of an specific L{OsisClient} root object\n accessor\"\"\"\n _ROOTOBJECTTYPE = type_\nself._accessorimpl = AccessorImpl_",
"accessor = obj._accessors.get(self._nam... | <|body_start_0|>
logger.info('Creating root object accessor %s' % name)
self._name = name
class AccessorImpl_(clientClass):
"""Implementation of an specific L{OsisClient} root object
accessor"""
_ROOTOBJECTTYPE = type_
self._accessorimpl = Acc... | Descriptor returning a correct L{OsisClient} instance for every root object exposed on L{OsisConnection} Every L{OsisConnection} instance got an attribute, C{_accessors}, which, for every root object type, can contain an L{OsisClient} instance which will provide the necessary methods to retrieve the corresponding root ... | RootObjectAccessor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RootObjectAccessor:
"""Descriptor returning a correct L{OsisClient} instance for every root object exposed on L{OsisConnection} Every L{OsisConnection} instance got an attribute, C{_accessors}, which, for every root object type, can contain an L{OsisClient} instance which will provide the necessa... | stack_v2_sparse_classes_10k_train_008729 | 9,963 | no_license | [
{
"docstring": "Initialize a new root object accessor @param name: Name of the accessor ('clients' in 'connection.clients') @type name: string @param type_: Root object type to provide access to @type type_: type",
"name": "__init__",
"signature": "def __init__(self, name, type_, clientClass=AccessorImp... | 2 | stack_v2_sparse_classes_30k_train_000725 | Implement the Python class `RootObjectAccessor` described below.
Class description:
Descriptor returning a correct L{OsisClient} instance for every root object exposed on L{OsisConnection} Every L{OsisConnection} instance got an attribute, C{_accessors}, which, for every root object type, can contain an L{OsisClient} ... | Implement the Python class `RootObjectAccessor` described below.
Class description:
Descriptor returning a correct L{OsisClient} instance for every root object exposed on L{OsisConnection} Every L{OsisConnection} instance got an attribute, C{_accessors}, which, for every root object type, can contain an L{OsisClient} ... | 02f1d05fd90386fe2568d7c7fd032abd9061ecb4 | <|skeleton|>
class RootObjectAccessor:
"""Descriptor returning a correct L{OsisClient} instance for every root object exposed on L{OsisConnection} Every L{OsisConnection} instance got an attribute, C{_accessors}, which, for every root object type, can contain an L{OsisClient} instance which will provide the necessa... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RootObjectAccessor:
"""Descriptor returning a correct L{OsisClient} instance for every root object exposed on L{OsisConnection} Every L{OsisConnection} instance got an attribute, C{_accessors}, which, for every root object type, can contain an L{OsisClient} instance which will provide the necessary methods to... | the_stack_v2_python_sparse | code/osis/client/connection.py | racktivity/ext-OSIS | train | 0 |
e33aa5bf9d7ade33b15f8024897bc2855f694c11 | [
"descriptions = descriptions or list(utils.generate_ids(count=count))\nchassis_list = []\n_chassis_descriptions = {}\nfor description in descriptions:\n chassis = self._client.create(description=description)\n _chassis_descriptions[chassis.uuid] = description\n chassis_list.append(chassis)\nif check:\n ... | <|body_start_0|>
descriptions = descriptions or list(utils.generate_ids(count=count))
chassis_list = []
_chassis_descriptions = {}
for description in descriptions:
chassis = self._client.create(description=description)
_chassis_descriptions[chassis.uuid] = descrip... | Chassis steps. | IronicChassisSteps | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IronicChassisSteps:
"""Chassis steps."""
def create_ironic_chassis(self, descriptions=None, count=1, check=True):
"""Step to create a ironic chassis. Args: descriptions (list): descriptions of created chassis, if not specified one chassis description will be generate count (int): cou... | stack_v2_sparse_classes_10k_train_008730 | 4,645 | no_license | [
{
"docstring": "Step to create a ironic chassis. Args: descriptions (list): descriptions of created chassis, if not specified one chassis description will be generate count (int): count of created chassis, it's ignored if chassis_descriptions are specified; one chassis is created if both args are missing check ... | 4 | null | Implement the Python class `IronicChassisSteps` described below.
Class description:
Chassis steps.
Method signatures and docstrings:
- def create_ironic_chassis(self, descriptions=None, count=1, check=True): Step to create a ironic chassis. Args: descriptions (list): descriptions of created chassis, if not specified ... | Implement the Python class `IronicChassisSteps` described below.
Class description:
Chassis steps.
Method signatures and docstrings:
- def create_ironic_chassis(self, descriptions=None, count=1, check=True): Step to create a ironic chassis. Args: descriptions (list): descriptions of created chassis, if not specified ... | e7583444cd24893ec6ae237b47db7c605b99b0c5 | <|skeleton|>
class IronicChassisSteps:
"""Chassis steps."""
def create_ironic_chassis(self, descriptions=None, count=1, check=True):
"""Step to create a ironic chassis. Args: descriptions (list): descriptions of created chassis, if not specified one chassis description will be generate count (int): cou... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class IronicChassisSteps:
"""Chassis steps."""
def create_ironic_chassis(self, descriptions=None, count=1, check=True):
"""Step to create a ironic chassis. Args: descriptions (list): descriptions of created chassis, if not specified one chassis description will be generate count (int): count of created... | the_stack_v2_python_sparse | stepler/baremetal/steps/chassis.py | Mirantis/stepler | train | 16 |
f472aca41daaca12a1715494045c148614208d7f | [
"snap = super(AbstractButton, self).snapshot()\nsnap['text'] = self.text\nsnap['checkable'] = self.checkable\nsnap['checked'] = self.checked\nsnap['icon_size'] = tuple(self.icon_size)\nsnap['icon_source'] = self.icon_source\nreturn snap",
"super(AbstractButton, self).bind()\nattrs = ('text', 'checkable', 'checked... | <|body_start_0|>
snap = super(AbstractButton, self).snapshot()
snap['text'] = self.text
snap['checkable'] = self.checkable
snap['checked'] = self.checked
snap['icon_size'] = tuple(self.icon_size)
snap['icon_source'] = self.icon_source
return snap
<|end_body_0|>
<... | A base class which provides functionality common for several button-like widgets. | AbstractButton | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AbstractButton:
"""A base class which provides functionality common for several button-like widgets."""
def snapshot(self):
"""Returns the snapshot for an abstract button."""
<|body_0|>
def bind(self):
"""Bind the change handlers for an abstract button."""
... | stack_v2_sparse_classes_10k_train_008731 | 3,025 | permissive | [
{
"docstring": "Returns the snapshot for an abstract button.",
"name": "snapshot",
"signature": "def snapshot(self)"
},
{
"docstring": "Bind the change handlers for an abstract button.",
"name": "bind",
"signature": "def bind(self)"
},
{
"docstring": "Handle the 'clicked' action ... | 4 | stack_v2_sparse_classes_30k_train_005816 | Implement the Python class `AbstractButton` described below.
Class description:
A base class which provides functionality common for several button-like widgets.
Method signatures and docstrings:
- def snapshot(self): Returns the snapshot for an abstract button.
- def bind(self): Bind the change handlers for an abstr... | Implement the Python class `AbstractButton` described below.
Class description:
A base class which provides functionality common for several button-like widgets.
Method signatures and docstrings:
- def snapshot(self): Returns the snapshot for an abstract button.
- def bind(self): Bind the change handlers for an abstr... | 424bba29219de58fe9e47196de6763de8b2009f2 | <|skeleton|>
class AbstractButton:
"""A base class which provides functionality common for several button-like widgets."""
def snapshot(self):
"""Returns the snapshot for an abstract button."""
<|body_0|>
def bind(self):
"""Bind the change handlers for an abstract button."""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AbstractButton:
"""A base class which provides functionality common for several button-like widgets."""
def snapshot(self):
"""Returns the snapshot for an abstract button."""
snap = super(AbstractButton, self).snapshot()
snap['text'] = self.text
snap['checkable'] = self.ch... | the_stack_v2_python_sparse | enaml/widgets/abstract_button.py | enthought/enaml | train | 17 |
6bfd1fb98173ed4620edfc9ff4f1c0c88a59c8e1 | [
"if basic_approximations is None:\n basic_approximations = generate_basic_approximations(basis_gates=['h', 't', 'tdg'], depth=10)\nself.basic_approximations = self.load_basic_approximations(basic_approximations)",
"if isinstance(data, list):\n return data\nif isinstance(data, str):\n data = np.load(data,... | <|body_start_0|>
if basic_approximations is None:
basic_approximations = generate_basic_approximations(basis_gates=['h', 't', 'tdg'], depth=10)
self.basic_approximations = self.load_basic_approximations(basic_approximations)
<|end_body_0|>
<|body_start_1|>
if isinstance(data, list):... | The Solovay Kitaev discrete decomposition algorithm. This class is called recursively by the transpiler pass, which is why it is separeted. See :class:`qiskit.transpiler.passes.SolovayKitaev` for more information. | SolovayKitaevDecomposition | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SolovayKitaevDecomposition:
"""The Solovay Kitaev discrete decomposition algorithm. This class is called recursively by the transpiler pass, which is why it is separeted. See :class:`qiskit.transpiler.passes.SolovayKitaev` for more information."""
def __init__(self, basic_approximations: str... | stack_v2_sparse_classes_10k_train_008732 | 8,166 | permissive | [
{
"docstring": "Args: basic_approximations: A specification of the basic SU(2) approximations in terms of discrete gates. At each iteration this algorithm, the remaining error is approximated with the closest sequence of gates in this set. If a ``str``, this specifies a ``.npy`` filename from which to load the ... | 5 | null | Implement the Python class `SolovayKitaevDecomposition` described below.
Class description:
The Solovay Kitaev discrete decomposition algorithm. This class is called recursively by the transpiler pass, which is why it is separeted. See :class:`qiskit.transpiler.passes.SolovayKitaev` for more information.
Method signa... | Implement the Python class `SolovayKitaevDecomposition` described below.
Class description:
The Solovay Kitaev discrete decomposition algorithm. This class is called recursively by the transpiler pass, which is why it is separeted. See :class:`qiskit.transpiler.passes.SolovayKitaev` for more information.
Method signa... | 0b51250e219ca303654fc28a318c21366584ccd3 | <|skeleton|>
class SolovayKitaevDecomposition:
"""The Solovay Kitaev discrete decomposition algorithm. This class is called recursively by the transpiler pass, which is why it is separeted. See :class:`qiskit.transpiler.passes.SolovayKitaev` for more information."""
def __init__(self, basic_approximations: str... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SolovayKitaevDecomposition:
"""The Solovay Kitaev discrete decomposition algorithm. This class is called recursively by the transpiler pass, which is why it is separeted. See :class:`qiskit.transpiler.passes.SolovayKitaev` for more information."""
def __init__(self, basic_approximations: str | dict[str, ... | the_stack_v2_python_sparse | qiskit/synthesis/discrete_basis/solovay_kitaev.py | 1ucian0/qiskit-terra | train | 6 |
02dc41908a73d6059bf7488221c67f328c3f7b15 | [
"if lists == []:\n return None\nresult = lists[0]\nfor index in range(1, len(lists)):\n result = self.mergeTwoLists(result, lists[index])\nreturn result",
"if l1 is None:\n return l2\nif l2 is None:\n return l1\nresult = l1\nif l1.val <= l2.val:\n result = l1\n l1 = l1.next\nelse:\n result = ... | <|body_start_0|>
if lists == []:
return None
result = lists[0]
for index in range(1, len(lists)):
result = self.mergeTwoLists(result, lists[index])
return result
<|end_body_0|>
<|body_start_1|>
if l1 is None:
return l2
if l2 is None:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_0|>
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if lists... | stack_v2_sparse_classes_10k_train_008733 | 1,818 | no_license | [
{
"docstring": ":type lists: List[ListNode] :rtype: ListNode",
"name": "mergeKLists",
"signature": "def mergeKLists(self, lists)"
},
{
"docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode",
"name": "mergeTwoLists",
"signature": "def mergeTwoLists(self, l1, l2)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001791 | 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 mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: 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 mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
<|skeleton|>... | fb695e489606a5e5eba000705caf77e40483c20e | <|skeleton|>
class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_0|>
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
if lists == []:
return None
result = lists[0]
for index in range(1, len(lists)):
result = self.mergeTwoLists(result, lists[index])
return result
def m... | the_stack_v2_python_sparse | 23_merge_k_sorted_lists.py | jjgyy/py_practice | train | 1 | |
5f0aeb7d9f50e5327dc8b797a78e699b363e5e60 | [
"super(SubwordSequencer, self).__init__(maxngrams)\nself.maxngrams = maxngrams\nself.maxwords = maxwords\nself.wordbreaker = CountVectorizer(lowercase=True).build_analyzer()",
"if isinstance(strings, str):\n strings = [strings]\nelse:\n strings = list(strings)\nbuffer = np.zeros((len(strings), self.maxwords... | <|body_start_0|>
super(SubwordSequencer, self).__init__(maxngrams)
self.maxngrams = maxngrams
self.maxwords = maxwords
self.wordbreaker = CountVectorizer(lowercase=True).build_analyzer()
<|end_body_0|>
<|body_start_1|>
if isinstance(strings, str):
strings = [strings]... | To support FastText type encodings, treat text as a series of words, and then break those words into character ngram subwords. Attributes ---------- maxwords: Limit to this number of words. maxngrams: For each word limit to this number of ngrams. features: Total number of unique features, which may allow collisions. wo... | SubwordSequencer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubwordSequencer:
"""To support FastText type encodings, treat text as a series of words, and then break those words into character ngram subwords. Attributes ---------- maxwords: Limit to this number of words. maxngrams: For each word limit to this number of ngrams. features: Total number of uni... | stack_v2_sparse_classes_10k_train_008734 | 6,153 | no_license | [
{
"docstring": "Configure word analysis for character trigrams. Parameters ---------- maxlen : int Limit parsing to this number of words. maxngrams: For each word limit to this number of ngrams.",
"name": "__init__",
"signature": "def __init__(self, maxwords=1024, maxngrams=32)"
},
{
"docstring"... | 2 | stack_v2_sparse_classes_30k_train_001392 | Implement the Python class `SubwordSequencer` described below.
Class description:
To support FastText type encodings, treat text as a series of words, and then break those words into character ngram subwords. Attributes ---------- maxwords: Limit to this number of words. maxngrams: For each word limit to this number o... | Implement the Python class `SubwordSequencer` described below.
Class description:
To support FastText type encodings, treat text as a series of words, and then break those words into character ngram subwords. Attributes ---------- maxwords: Limit to this number of words. maxngrams: For each word limit to this number o... | 6ada50adf63078ba28464c59808234bca3fcc9b7 | <|skeleton|>
class SubwordSequencer:
"""To support FastText type encodings, treat text as a series of words, and then break those words into character ngram subwords. Attributes ---------- maxwords: Limit to this number of words. maxngrams: For each word limit to this number of ngrams. features: Total number of uni... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SubwordSequencer:
"""To support FastText type encodings, treat text as a series of words, and then break those words into character ngram subwords. Attributes ---------- maxwords: Limit to this number of words. maxngrams: For each word limit to this number of ngrams. features: Total number of unique features,... | the_stack_v2_python_sparse | _7_Keras/KerasText/Section 2/vectoria/Sequencers.py | cyrsis/TensorflowPY36CPU | train | 5 |
fc826f3942a48e40b3d6d601724478cb1cdc057e | [
"left, right = (nums[0], nums[nums[0]])\nwhile left != right:\n left = nums[left]\n right = nums[nums[right]]\nstart = 0\nwhile start != left:\n start = nums[start]\n left = nums[left]\nreturn start",
"pre = 0\nwhile nums[0] != pre:\n pre = nums[0]\n nums[0] = nums[pre]\n nums[pre] = pre\nret... | <|body_start_0|>
left, right = (nums[0], nums[nums[0]])
while left != right:
left = nums[left]
right = nums[nums[right]]
start = 0
while start != left:
start = nums[start]
left = nums[left]
return start
<|end_body_0|>
<|body_start_... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findDuplicate(self, nums: List[int]) -> int:
"""思路:快慢指针 1、通过下标获取下一个元素,存在重复的值,相当于链表有环 2、第一次循环找到相遇的点,这个点不一定是链表的入口 3、起点和相遇的点离链表交点的距离相等"""
<|body_0|>
def findDuplicate2(self, nums: List[int]) -> int:
"""如果可以改变nums的话 :param nums: :return:"""
<|body_1... | stack_v2_sparse_classes_10k_train_008735 | 3,490 | no_license | [
{
"docstring": "思路:快慢指针 1、通过下标获取下一个元素,存在重复的值,相当于链表有环 2、第一次循环找到相遇的点,这个点不一定是链表的入口 3、起点和相遇的点离链表交点的距离相等",
"name": "findDuplicate",
"signature": "def findDuplicate(self, nums: List[int]) -> int"
},
{
"docstring": "如果可以改变nums的话 :param nums: :return:",
"name": "findDuplicate2",
"signature": "de... | 4 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findDuplicate(self, nums: List[int]) -> int: 思路:快慢指针 1、通过下标获取下一个元素,存在重复的值,相当于链表有环 2、第一次循环找到相遇的点,这个点不一定是链表的入口 3、起点和相遇的点离链表交点的距离相等
- def findDuplicate2(self, nums: List[int]) -... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findDuplicate(self, nums: List[int]) -> int: 思路:快慢指针 1、通过下标获取下一个元素,存在重复的值,相当于链表有环 2、第一次循环找到相遇的点,这个点不一定是链表的入口 3、起点和相遇的点离链表交点的距离相等
- def findDuplicate2(self, nums: List[int]) -... | e43ee86c5a8cdb808da09b4b6138e10275abadb5 | <|skeleton|>
class Solution:
def findDuplicate(self, nums: List[int]) -> int:
"""思路:快慢指针 1、通过下标获取下一个元素,存在重复的值,相当于链表有环 2、第一次循环找到相遇的点,这个点不一定是链表的入口 3、起点和相遇的点离链表交点的距离相等"""
<|body_0|>
def findDuplicate2(self, nums: List[int]) -> int:
"""如果可以改变nums的话 :param nums: :return:"""
<|body_1... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def findDuplicate(self, nums: List[int]) -> int:
"""思路:快慢指针 1、通过下标获取下一个元素,存在重复的值,相当于链表有环 2、第一次循环找到相遇的点,这个点不一定是链表的入口 3、起点和相遇的点离链表交点的距离相等"""
left, right = (nums[0], nums[nums[0]])
while left != right:
left = nums[left]
right = nums[nums[right]]
s... | the_stack_v2_python_sparse | LeetCode/双指针(two points)/287. Find the Duplicate Number.py | yiming1012/MyLeetCode | train | 2 | |
ec57b1942cf7be4f81fcb36c4482425f3d2c6810 | [
"dataset_ref = URIRef(dataset_uri(dataset_dict))\nfor profile_class in self._profiles:\n profile = profile_class(self.g, self.compatibility_mode)\n profile.graph_from_dataset(dataset_dict, dataset_ref)\nreturn dataset_ref",
"catalog_ref = self.graph_from_catalog(catalog_dict)\nif dataset_dicts:\n for dat... | <|body_start_0|>
dataset_ref = URIRef(dataset_uri(dataset_dict))
for profile_class in self._profiles:
profile = profile_class(self.g, self.compatibility_mode)
profile.graph_from_dataset(dataset_dict, dataset_ref)
return dataset_ref
<|end_body_0|>
<|body_start_1|>
... | A CKAN to RDF serializer based on rdflib Supports different profiles which are the ones that will generate the RDF graph. | AvoindataSerializer | [
"MIT",
"AGPL-3.0-only"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AvoindataSerializer:
"""A CKAN to RDF serializer based on rdflib Supports different profiles which are the ones that will generate the RDF graph."""
def graph_from_dataset(self, dataset_dict):
"""Given a CKAN dataset dict, creates a graph using the loaded profiles The class RDFLib gr... | stack_v2_sparse_classes_10k_train_008736 | 30,860 | permissive | [
{
"docstring": "Given a CKAN dataset dict, creates a graph using the loaded profiles The class RDFLib graph (accessible via `serializer.g`) will be updated by the loaded profiles. Returns the reference to the dataset, which will be an rdflib URIRef.",
"name": "graph_from_dataset",
"signature": "def grap... | 2 | stack_v2_sparse_classes_30k_train_000602 | Implement the Python class `AvoindataSerializer` described below.
Class description:
A CKAN to RDF serializer based on rdflib Supports different profiles which are the ones that will generate the RDF graph.
Method signatures and docstrings:
- def graph_from_dataset(self, dataset_dict): Given a CKAN dataset dict, crea... | Implement the Python class `AvoindataSerializer` described below.
Class description:
A CKAN to RDF serializer based on rdflib Supports different profiles which are the ones that will generate the RDF graph.
Method signatures and docstrings:
- def graph_from_dataset(self, dataset_dict): Given a CKAN dataset dict, crea... | 8be356138044317a4c7e79f96d8ebc12d1d0a834 | <|skeleton|>
class AvoindataSerializer:
"""A CKAN to RDF serializer based on rdflib Supports different profiles which are the ones that will generate the RDF graph."""
def graph_from_dataset(self, dataset_dict):
"""Given a CKAN dataset dict, creates a graph using the loaded profiles The class RDFLib gr... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AvoindataSerializer:
"""A CKAN to RDF serializer based on rdflib Supports different profiles which are the ones that will generate the RDF graph."""
def graph_from_dataset(self, dataset_dict):
"""Given a CKAN dataset dict, creates a graph using the loaded profiles The class RDFLib graph (accessib... | the_stack_v2_python_sparse | ckan/ckanext/ckanext-ytp_main/ckanext/ytp/dcat.py | vrk-kpa/opendata | train | 22 |
e6fcededbfd5e5af9392bc246fc7de3efdcfaff1 | [
"strategy = Strategy.objects.get(pk=pk)\nstrategy = Strategy.describe_strategies([strategy], verbose=Strategy.MAX_VERBOSE)[0]\nreturn Response({'data': {'strategy': strategy}})",
"strategy = Strategy.objects.get(pk=pk)\nserializer = StrategyCreateUpdateSerializer(strategy, data=request.data, partial=True, context... | <|body_start_0|>
strategy = Strategy.objects.get(pk=pk)
strategy = Strategy.describe_strategies([strategy], verbose=Strategy.MAX_VERBOSE)[0]
return Response({'data': {'strategy': strategy}})
<|end_body_0|>
<|body_start_1|>
strategy = Strategy.objects.get(pk=pk)
serializer = Stra... | SingleStrategyAPIView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SingleStrategyAPIView:
def get(request, pk):
"""获取策略详情"""
<|body_0|>
def put(request, pk):
"""修改策略"""
<|body_1|>
def delete(request, pk):
"""删除策略"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
strategy = Strategy.objects.get(pk... | stack_v2_sparse_classes_10k_train_008737 | 9,461 | no_license | [
{
"docstring": "获取策略详情",
"name": "get",
"signature": "def get(request, pk)"
},
{
"docstring": "修改策略",
"name": "put",
"signature": "def put(request, pk)"
},
{
"docstring": "删除策略",
"name": "delete",
"signature": "def delete(request, pk)"
}
] | 3 | stack_v2_sparse_classes_30k_train_006853 | Implement the Python class `SingleStrategyAPIView` described below.
Class description:
Implement the SingleStrategyAPIView class.
Method signatures and docstrings:
- def get(request, pk): 获取策略详情
- def put(request, pk): 修改策略
- def delete(request, pk): 删除策略 | Implement the Python class `SingleStrategyAPIView` described below.
Class description:
Implement the SingleStrategyAPIView class.
Method signatures and docstrings:
- def get(request, pk): 获取策略详情
- def put(request, pk): 修改策略
- def delete(request, pk): 删除策略
<|skeleton|>
class SingleStrategyAPIView:
def get(reques... | bb85b52598d68956bde8756c8321ade7b8479ba7 | <|skeleton|>
class SingleStrategyAPIView:
def get(request, pk):
"""获取策略详情"""
<|body_0|>
def put(request, pk):
"""修改策略"""
<|body_1|>
def delete(request, pk):
"""删除策略"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SingleStrategyAPIView:
def get(request, pk):
"""获取策略详情"""
strategy = Strategy.objects.get(pk=pk)
strategy = Strategy.describe_strategies([strategy], verbose=Strategy.MAX_VERBOSE)[0]
return Response({'data': {'strategy': strategy}})
def put(request, pk):
"""修改策略"""
... | the_stack_v2_python_sparse | curd_test/configure/views.py | huiiiuh/huihuiproject | train | 0 | |
5dcc934bfc5550c210f2c2346843211e739fa1c2 | [
"self._exact = exact\nself._domain = domain\nif glob is None:\n compiled: dict[re.Pattern[str], Any] | None = None\nelse:\n compiled = OrderedDict()\n for key, value in glob.items():\n compiled[re.compile(fnmatch.translate(key))] = value\nself._glob = compiled",
"domain, _ = split_entity_id(entity... | <|body_start_0|>
self._exact = exact
self._domain = domain
if glob is None:
compiled: dict[re.Pattern[str], Any] | None = None
else:
compiled = OrderedDict()
for key, value in glob.items():
compiled[re.compile(fnmatch.translate(key))] =... | Class to store entity id based values. This class is expected to only be used infrequently as it caches all entity ids up to _MAX_EXPECTED_ENTITIES. The cache includes `self` so it is important to only use this in places where usage of `EntityValues` is immortal. | EntityValues | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EntityValues:
"""Class to store entity id based values. This class is expected to only be used infrequently as it caches all entity ids up to _MAX_EXPECTED_ENTITIES. The cache includes `self` so it is important to only use this in places where usage of `EntityValues` is immortal."""
def __in... | stack_v2_sparse_classes_10k_train_008738 | 1,849 | permissive | [
{
"docstring": "Initialize an EntityConfigDict.",
"name": "__init__",
"signature": "def __init__(self, exact: dict[str, dict[str, str]] | None=None, domain: dict[str, dict[str, str]] | None=None, glob: dict[str, dict[str, str]] | None=None) -> None"
},
{
"docstring": "Get config for an entity id... | 2 | null | Implement the Python class `EntityValues` described below.
Class description:
Class to store entity id based values. This class is expected to only be used infrequently as it caches all entity ids up to _MAX_EXPECTED_ENTITIES. The cache includes `self` so it is important to only use this in places where usage of `Enti... | Implement the Python class `EntityValues` described below.
Class description:
Class to store entity id based values. This class is expected to only be used infrequently as it caches all entity ids up to _MAX_EXPECTED_ENTITIES. The cache includes `self` so it is important to only use this in places where usage of `Enti... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class EntityValues:
"""Class to store entity id based values. This class is expected to only be used infrequently as it caches all entity ids up to _MAX_EXPECTED_ENTITIES. The cache includes `self` so it is important to only use this in places where usage of `EntityValues` is immortal."""
def __in... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EntityValues:
"""Class to store entity id based values. This class is expected to only be used infrequently as it caches all entity ids up to _MAX_EXPECTED_ENTITIES. The cache includes `self` so it is important to only use this in places where usage of `EntityValues` is immortal."""
def __init__(self, ex... | the_stack_v2_python_sparse | homeassistant/helpers/entity_values.py | home-assistant/core | train | 35,501 |
f4cf9c45504c6104bd3ee264b91dff8d1f1f1cd7 | [
"\"\"\"\n https: // blog.csdn.net / qq_17550379 / article / details / 85234090\n 判断4个点到中点的距离是否一致即可判断矩形!!\n \"\"\"\nfrom itertools import combinations, permutations\n\ndef isRectangle(p1, p2, p3, p4):\n\n def _dis(p1, p2):\n return (p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2\n x_c =... | <|body_start_0|>
"""
https: // blog.csdn.net / qq_17550379 / article / details / 85234090
判断4个点到中点的距离是否一致即可判断矩形!!
"""
from itertools import combinations, permutations
def isRectangle(p1, p2, p3, p4):
def _dis(p1, p2):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minAreaFreeRect(self, points):
""":type points: List[List[int]] :rtype: float overtime"""
<|body_0|>
def minAreaFreeRect_1(self, points):
""":type points: List[List[int]] :rtype: float 120 ms 13.3 MB"""
<|body_1|>
def minAreaFreeRect_2(self... | stack_v2_sparse_classes_10k_train_008739 | 5,573 | no_license | [
{
"docstring": ":type points: List[List[int]] :rtype: float overtime",
"name": "minAreaFreeRect",
"signature": "def minAreaFreeRect(self, points)"
},
{
"docstring": ":type points: List[List[int]] :rtype: float 120 ms 13.3 MB",
"name": "minAreaFreeRect_1",
"signature": "def minAreaFreeRec... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minAreaFreeRect(self, points): :type points: List[List[int]] :rtype: float overtime
- def minAreaFreeRect_1(self, points): :type points: List[List[int]] :rtype: float 120 ms ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minAreaFreeRect(self, points): :type points: List[List[int]] :rtype: float overtime
- def minAreaFreeRect_1(self, points): :type points: List[List[int]] :rtype: float 120 ms ... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def minAreaFreeRect(self, points):
""":type points: List[List[int]] :rtype: float overtime"""
<|body_0|>
def minAreaFreeRect_1(self, points):
""":type points: List[List[int]] :rtype: float 120 ms 13.3 MB"""
<|body_1|>
def minAreaFreeRect_2(self... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def minAreaFreeRect(self, points):
""":type points: List[List[int]] :rtype: float overtime"""
"""
https: // blog.csdn.net / qq_17550379 / article / details / 85234090
判断4个点到中点的距离是否一致即可判断矩形!!
"""
from itertools import combination... | the_stack_v2_python_sparse | MinimumAreaRectangleII_MID_963.py | 953250587/leetcode-python | train | 2 | |
7d37d5a6af269483d014f0d8198febdf1e2cc4c5 | [
"parser = argparse.ArgumentParser(description='Easy Infer for model benchmark')\ncls.base_arg_parse(parser)\ncls.model_arg_parse(parser)\ncls.task_arg_parse(parser)\nargs = parser.parse_args()\nreturn args",
"parser.add_argument('--task_type', type=int, default=0, help='benchmark task type:0 for framework accurac... | <|body_start_0|>
parser = argparse.ArgumentParser(description='Easy Infer for model benchmark')
cls.base_arg_parse(parser)
cls.model_arg_parse(parser)
cls.task_arg_parse(parser)
args = parser.parse_args()
return args
<|end_body_0|>
<|body_start_1|>
parser.add_arg... | input argument parser functions | ArgParser | [
"Apache-2.0",
"LicenseRef-scancode-proprietary-license",
"MPL-1.0",
"OpenSSL",
"LGPL-3.0-only",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause-Open-MPI",
"MIT",
"MPL-2.0-no-copyleft-exception",
"NTP",
"BSD-3-Clause",
"GPL-1.0-or-later",
"0BSD",
"MPL-2.0",
"LicenseRef-scancode-f... | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArgParser:
"""input argument parser functions"""
def parse_arguments(cls):
"""parse input arguments for mslite bench"""
<|body_0|>
def task_arg_parse(cls, parser):
"""parse task related arguments"""
<|body_1|>
def model_arg_parse(cls, parser):
... | stack_v2_sparse_classes_10k_train_008740 | 8,814 | permissive | [
{
"docstring": "parse input arguments for mslite bench",
"name": "parse_arguments",
"signature": "def parse_arguments(cls)"
},
{
"docstring": "parse task related arguments",
"name": "task_arg_parse",
"signature": "def task_arg_parse(cls, parser)"
},
{
"docstring": "parse model an... | 4 | stack_v2_sparse_classes_30k_test_000067 | Implement the Python class `ArgParser` described below.
Class description:
input argument parser functions
Method signatures and docstrings:
- def parse_arguments(cls): parse input arguments for mslite bench
- def task_arg_parse(cls, parser): parse task related arguments
- def model_arg_parse(cls, parser): parse mode... | Implement the Python class `ArgParser` described below.
Class description:
input argument parser functions
Method signatures and docstrings:
- def parse_arguments(cls): parse input arguments for mslite bench
- def task_arg_parse(cls, parser): parse task related arguments
- def model_arg_parse(cls, parser): parse mode... | 54acb15d435533c815ee1bd9f6dc0b56b4d4cf83 | <|skeleton|>
class ArgParser:
"""input argument parser functions"""
def parse_arguments(cls):
"""parse input arguments for mslite bench"""
<|body_0|>
def task_arg_parse(cls, parser):
"""parse task related arguments"""
<|body_1|>
def model_arg_parse(cls, parser):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ArgParser:
"""input argument parser functions"""
def parse_arguments(cls):
"""parse input arguments for mslite bench"""
parser = argparse.ArgumentParser(description='Easy Infer for model benchmark')
cls.base_arg_parse(parser)
cls.model_arg_parse(parser)
cls.task_ar... | the_stack_v2_python_sparse | mindspore/lite/tools/mslite_bench/mslite_bench/utils/arg_parser.py | mindspore-ai/mindspore | train | 4,178 |
af04b9881c8b6e46a3a8cbedccbbbb0c23cea840 | [
"super(Gtk.Notebook, self).__init__()\nself.workspace_sidebar = workspace_sidebar\nself.hosts_sidebar = hosts_sidebar\nself.set_tab_pos(Gtk.PositionType.BOTTOM)\nself.append_page(self.workspace_sidebar, Gtk.Label('Workspaces'))\nself.append_page(self.hosts_sidebar, Gtk.Label('Hosts'))",
"box = Gtk.Box()\nbox.pack... | <|body_start_0|>
super(Gtk.Notebook, self).__init__()
self.workspace_sidebar = workspace_sidebar
self.hosts_sidebar = hosts_sidebar
self.set_tab_pos(Gtk.PositionType.BOTTOM)
self.append_page(self.workspace_sidebar, Gtk.Label('Workspaces'))
self.append_page(self.hosts_side... | Defines the bigger sidebar in a notebook. One of its tabs will contain the workspace view, listing all the workspaces (WorkspaceSidebar) and the other will contain the information about hosts, services, and vulns (HostsSidebar) | Sidebar | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Sidebar:
"""Defines the bigger sidebar in a notebook. One of its tabs will contain the workspace view, listing all the workspaces (WorkspaceSidebar) and the other will contain the information about hosts, services, and vulns (HostsSidebar)"""
def __init__(self, workspace_sidebar, hosts_sideb... | stack_v2_sparse_classes_10k_train_008741 | 38,992 | no_license | [
{
"docstring": "Attach to the notebok the workspace sidebar and the host_sidebar",
"name": "__init__",
"signature": "def __init__(self, workspace_sidebar, hosts_sidebar)"
},
{
"docstring": "Wraps the notebook inside a little box.",
"name": "box_it",
"signature": "def box_it(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007357 | Implement the Python class `Sidebar` described below.
Class description:
Defines the bigger sidebar in a notebook. One of its tabs will contain the workspace view, listing all the workspaces (WorkspaceSidebar) and the other will contain the information about hosts, services, and vulns (HostsSidebar)
Method signatures... | Implement the Python class `Sidebar` described below.
Class description:
Defines the bigger sidebar in a notebook. One of its tabs will contain the workspace view, listing all the workspaces (WorkspaceSidebar) and the other will contain the information about hosts, services, and vulns (HostsSidebar)
Method signatures... | 8fa21ff67a2e2fd8b92376e5c677d5df474c646e | <|skeleton|>
class Sidebar:
"""Defines the bigger sidebar in a notebook. One of its tabs will contain the workspace view, listing all the workspaces (WorkspaceSidebar) and the other will contain the information about hosts, services, and vulns (HostsSidebar)"""
def __init__(self, workspace_sidebar, hosts_sideb... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Sidebar:
"""Defines the bigger sidebar in a notebook. One of its tabs will contain the workspace view, listing all the workspaces (WorkspaceSidebar) and the other will contain the information about hosts, services, and vulns (HostsSidebar)"""
def __init__(self, workspace_sidebar, hosts_sidebar):
... | the_stack_v2_python_sparse | gui/gtk/mainwidgets.py | ekiojp/faraday | train | 1 |
4a66e9484749703c166d045dc5e99368a6271f40 | [
"self._nucleus = pipeline_nucleus.PipelineNucleus(pipeline_configuration)\nself._pipeline = pipeline_stages_base.PipelineRootStage(self._nucleus).append_stage(pipeline_stages_iothub_http.IoTHubHTTPTranslationStage()).append_stage(pipeline_stages_http.HTTPTransportStage())\ncallback = EventedCallback()\nop = pipelin... | <|body_start_0|>
self._nucleus = pipeline_nucleus.PipelineNucleus(pipeline_configuration)
self._pipeline = pipeline_stages_base.PipelineRootStage(self._nucleus).append_stage(pipeline_stages_iothub_http.IoTHubHTTPTranslationStage()).append_stage(pipeline_stages_http.HTTPTransportStage())
callback... | Pipeline to communicate with Edge. Uses HTTP. | HTTPPipeline | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HTTPPipeline:
"""Pipeline to communicate with Edge. Uses HTTP."""
def __init__(self, pipeline_configuration):
"""Constructor for instantiating a pipeline adapter object. :param auth_provider: The authentication provider :param pipeline_configuration: The configuration generated based... | stack_v2_sparse_classes_10k_train_008742 | 8,115 | permissive | [
{
"docstring": "Constructor for instantiating a pipeline adapter object. :param auth_provider: The authentication provider :param pipeline_configuration: The configuration generated based on user inputs",
"name": "__init__",
"signature": "def __init__(self, pipeline_configuration)"
},
{
"docstri... | 4 | stack_v2_sparse_classes_30k_train_001211 | Implement the Python class `HTTPPipeline` described below.
Class description:
Pipeline to communicate with Edge. Uses HTTP.
Method signatures and docstrings:
- def __init__(self, pipeline_configuration): Constructor for instantiating a pipeline adapter object. :param auth_provider: The authentication provider :param ... | Implement the Python class `HTTPPipeline` described below.
Class description:
Pipeline to communicate with Edge. Uses HTTP.
Method signatures and docstrings:
- def __init__(self, pipeline_configuration): Constructor for instantiating a pipeline adapter object. :param auth_provider: The authentication provider :param ... | 5d343d5904aaa98c6a88101e0dc40263acff4db2 | <|skeleton|>
class HTTPPipeline:
"""Pipeline to communicate with Edge. Uses HTTP."""
def __init__(self, pipeline_configuration):
"""Constructor for instantiating a pipeline adapter object. :param auth_provider: The authentication provider :param pipeline_configuration: The configuration generated based... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HTTPPipeline:
"""Pipeline to communicate with Edge. Uses HTTP."""
def __init__(self, pipeline_configuration):
"""Constructor for instantiating a pipeline adapter object. :param auth_provider: The authentication provider :param pipeline_configuration: The configuration generated based on user inpu... | the_stack_v2_python_sparse | azure-iot-device/azure/iot/device/iothub/pipeline/http_pipeline.py | Azure/azure-iot-sdk-python | train | 441 |
02cb5e2a47f634fb905fc7d9c62d4fee83368cfa | [
"super(Classifier, self).__init__()\nself.fc1 = blk.LinearReLU(in_dim=num_channels, out_dim=128)\nself.fc2 = blk.LinearReLU(in_dim=128, out_dim=64)\nself.fc3 = nn.Linear(in_features=64, out_features=2)",
"y = F.relu(self.fc1(x))\ny = F.relu(self.fc2(y))\ny = self.fc3(y)\nreturn y"
] | <|body_start_0|>
super(Classifier, self).__init__()
self.fc1 = blk.LinearReLU(in_dim=num_channels, out_dim=128)
self.fc2 = blk.LinearReLU(in_dim=128, out_dim=64)
self.fc3 = nn.Linear(in_features=64, out_features=2)
<|end_body_0|>
<|body_start_1|>
y = F.relu(self.fc1(x))
... | Classifier | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Classifier:
def __init__(self, num_channels: int):
"""represents the correlation and concatenation classifying heads. :param num_channels: feature dimension of the merged vector."""
<|body_0|>
def forward(self, x: torch.Tensor) -> torch.Tensor:
"""forward pass implem... | stack_v2_sparse_classes_10k_train_008743 | 965 | permissive | [
{
"docstring": "represents the correlation and concatenation classifying heads. :param num_channels: feature dimension of the merged vector.",
"name": "__init__",
"signature": "def __init__(self, num_channels: int)"
},
{
"docstring": "forward pass implementation. :param x: input tensor. :return:... | 2 | stack_v2_sparse_classes_30k_train_006176 | Implement the Python class `Classifier` described below.
Class description:
Implement the Classifier class.
Method signatures and docstrings:
- def __init__(self, num_channels: int): represents the correlation and concatenation classifying heads. :param num_channels: feature dimension of the merged vector.
- def forw... | Implement the Python class `Classifier` described below.
Class description:
Implement the Classifier class.
Method signatures and docstrings:
- def __init__(self, num_channels: int): represents the correlation and concatenation classifying heads. :param num_channels: feature dimension of the merged vector.
- def forw... | 583e6868864582f081f18689124e74e9ca169f28 | <|skeleton|>
class Classifier:
def __init__(self, num_channels: int):
"""represents the correlation and concatenation classifying heads. :param num_channels: feature dimension of the merged vector."""
<|body_0|>
def forward(self, x: torch.Tensor) -> torch.Tensor:
"""forward pass implem... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Classifier:
def __init__(self, num_channels: int):
"""represents the correlation and concatenation classifying heads. :param num_channels: feature dimension of the merged vector."""
super(Classifier, self).__init__()
self.fc1 = blk.LinearReLU(in_dim=num_channels, out_dim=128)
s... | the_stack_v2_python_sparse | models/classifier.py | beaupreda/domain-networks | train | 1 | |
f58b426f9c59e447a40adec0f60bb25b7d9ceb7a | [
"length = len(msg)\ndata_len = struct.pack('i', length)\nself.request.send(data_len)\nif type(msg) is str:\n self.request.send(msg.encode('utf-8'))\nelse:\n self.request.send(msg)",
"res_dsize = self.request.recv(4)\nres_dsize = struct.unpack('i', res_dsize)[0]\nrev_dsize = 0\nres_data = b''\nwhile rev_dsiz... | <|body_start_0|>
length = len(msg)
data_len = struct.pack('i', length)
self.request.send(data_len)
if type(msg) is str:
self.request.send(msg.encode('utf-8'))
else:
self.request.send(msg)
<|end_body_0|>
<|body_start_1|>
res_dsize = self.request.re... | MySS | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MySS:
def my_send(self, msg):
"""通过该对象建立的TCP连接发送数据的函数 :param msg: :return:"""
<|body_0|>
def my_recv(self, buffer):
"""收取通过TCP连接发送过来的数据,不会黏包 :param buffer: :return: 从客户端接收到的比特格式的内容"""
<|body_1|>
def auth_user(self, buffer):
"""认证登录socket_server的用... | stack_v2_sparse_classes_10k_train_008744 | 4,308 | no_license | [
{
"docstring": "通过该对象建立的TCP连接发送数据的函数 :param msg: :return:",
"name": "my_send",
"signature": "def my_send(self, msg)"
},
{
"docstring": "收取通过TCP连接发送过来的数据,不会黏包 :param buffer: :return: 从客户端接收到的比特格式的内容",
"name": "my_recv",
"signature": "def my_recv(self, buffer)"
},
{
"docstring": "认... | 6 | null | Implement the Python class `MySS` described below.
Class description:
Implement the MySS class.
Method signatures and docstrings:
- def my_send(self, msg): 通过该对象建立的TCP连接发送数据的函数 :param msg: :return:
- def my_recv(self, buffer): 收取通过TCP连接发送过来的数据,不会黏包 :param buffer: :return: 从客户端接收到的比特格式的内容
- def auth_user(self, buffer)... | Implement the Python class `MySS` described below.
Class description:
Implement the MySS class.
Method signatures and docstrings:
- def my_send(self, msg): 通过该对象建立的TCP连接发送数据的函数 :param msg: :return:
- def my_recv(self, buffer): 收取通过TCP连接发送过来的数据,不会黏包 :param buffer: :return: 从客户端接收到的比特格式的内容
- def auth_user(self, buffer)... | 8e4dfaaeae782a37f6baca4c024b1c2a1dc83cba | <|skeleton|>
class MySS:
def my_send(self, msg):
"""通过该对象建立的TCP连接发送数据的函数 :param msg: :return:"""
<|body_0|>
def my_recv(self, buffer):
"""收取通过TCP连接发送过来的数据,不会黏包 :param buffer: :return: 从客户端接收到的比特格式的内容"""
<|body_1|>
def auth_user(self, buffer):
"""认证登录socket_server的用... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MySS:
def my_send(self, msg):
"""通过该对象建立的TCP连接发送数据的函数 :param msg: :return:"""
length = len(msg)
data_len = struct.pack('i', length)
self.request.send(data_len)
if type(msg) is str:
self.request.send(msg.encode('utf-8'))
else:
self.request... | the_stack_v2_python_sparse | socket_test/socketserver_test/new_socketserver_v2.py | PeterZhangxing/codewars | train | 0 | |
68b7e1d666c8e12f2128e3e382243f1bafa60ee0 | [
"super().__init__(dat, frame, box_size, centre, arrow_width=arrow_width, arrow_head_width=arrow_head_width, arrow_head_length=arrow_head_length)\nself.velocities = dat.getVelocities(frame, *self.particles)\nself.vmin, self.vmax = amplogwidth(self.velocities)\ntry:\n self.vmin = np.log10(kwargs['vmin'])\nexcept (... | <|body_start_0|>
super().__init__(dat, frame, box_size, centre, arrow_width=arrow_width, arrow_head_width=arrow_head_width, arrow_head_length=arrow_head_length)
self.velocities = dat.getVelocities(frame, *self.particles)
self.vmin, self.vmax = amplogwidth(self.velocities)
try:
... | Plotting class specific to 'velocity' mode. | Velocity | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Velocity:
"""Plotting class specific to 'velocity' mode."""
def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colormap_label_pad, label=False, **kwargs):
"""Initialises and plots f... | stack_v2_sparse_classes_10k_train_008745 | 24,676 | permissive | [
{
"docstring": "Initialises and plots figure. Parameters ---------- dat : active_work.read.Dat Data object. frame : int Frame to render. box_size : float Length of the square box to render. centre : 2-uple like Centre of the box to render. arrow_width : float Width of the arrows. arrow_head_width : float Width ... | 2 | stack_v2_sparse_classes_30k_train_002525 | Implement the Python class `Velocity` described below.
Class description:
Plotting class specific to 'velocity' mode.
Method signatures and docstrings:
- def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colormap_l... | Implement the Python class `Velocity` described below.
Class description:
Plotting class specific to 'velocity' mode.
Method signatures and docstrings:
- def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colormap_l... | 99107a0d4935296b673f67469c1e2bd258954b9b | <|skeleton|>
class Velocity:
"""Plotting class specific to 'velocity' mode."""
def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colormap_label_pad, label=False, **kwargs):
"""Initialises and plots f... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Velocity:
"""Plotting class specific to 'velocity' mode."""
def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colormap_label_pad, label=False, **kwargs):
"""Initialises and plots figure. Parame... | the_stack_v2_python_sparse | frame.py | yketa/active_work | train | 1 |
0f4ca0ea5e83c4ea764f04cff625d2b01258e88f | [
"self._doc_class = doc_class\nself._cb = cb\nself._count_valid = False\nsuper(BaseQuery, self).__init__()\nself._total_results = 0",
"if self._count_valid:\n return self._total_results\nresult = self._cb.get_object(self._doc_class.urlobject.format(self._cb.credentials.org_key))\nresults = result.get('results',... | <|body_start_0|>
self._doc_class = doc_class
self._cb = cb
self._count_valid = False
super(BaseQuery, self).__init__()
self._total_results = 0
<|end_body_0|>
<|body_start_1|>
if self._count_valid:
return self._total_results
result = self._cb.get_objec... | Represents a query that is used to locate USBDeviceBlock objects. | USBDeviceBlockQuery | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class USBDeviceBlockQuery:
"""Represents a query that is used to locate USBDeviceBlock objects."""
def __init__(self, doc_class, cb):
"""Initialize the USBDeviceBlockQuery. Args: doc_class (class): The model class that will be returned by this query. cb (BaseAPI): Reference to API object u... | stack_v2_sparse_classes_10k_train_008746 | 31,170 | permissive | [
{
"docstring": "Initialize the USBDeviceBlockQuery. Args: doc_class (class): The model class that will be returned by this query. cb (BaseAPI): Reference to API object used to communicate with the server.",
"name": "__init__",
"signature": "def __init__(self, doc_class, cb)"
},
{
"docstring": "R... | 4 | stack_v2_sparse_classes_30k_train_004139 | Implement the Python class `USBDeviceBlockQuery` described below.
Class description:
Represents a query that is used to locate USBDeviceBlock objects.
Method signatures and docstrings:
- def __init__(self, doc_class, cb): Initialize the USBDeviceBlockQuery. Args: doc_class (class): The model class that will be return... | Implement the Python class `USBDeviceBlockQuery` described below.
Class description:
Represents a query that is used to locate USBDeviceBlock objects.
Method signatures and docstrings:
- def __init__(self, doc_class, cb): Initialize the USBDeviceBlockQuery. Args: doc_class (class): The model class that will be return... | a8a2ec8ff6b9985b4fb4700d9d566e8e2a297381 | <|skeleton|>
class USBDeviceBlockQuery:
"""Represents a query that is used to locate USBDeviceBlock objects."""
def __init__(self, doc_class, cb):
"""Initialize the USBDeviceBlockQuery. Args: doc_class (class): The model class that will be returned by this query. cb (BaseAPI): Reference to API object u... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class USBDeviceBlockQuery:
"""Represents a query that is used to locate USBDeviceBlock objects."""
def __init__(self, doc_class, cb):
"""Initialize the USBDeviceBlockQuery. Args: doc_class (class): The model class that will be returned by this query. cb (BaseAPI): Reference to API object used to commun... | the_stack_v2_python_sparse | src/cbc_sdk/endpoint_standard/usb_device_control.py | fslds/carbon-black-cloud-sdk-python | train | 0 |
4b653de11fba1d6aa8bfc0f0e14ea998358939b0 | [
"super(RandomHorizontalFlip, self).__init__()\nself.prob = prob\nif not isinstance(self.prob, float):\n raise TypeError('{}: input type is invalid.'.format(self))",
"samples = sample\nbatch_input = True\nif not isinstance(samples, Sequence):\n batch_input = False\n samples = [samples]\nfor sample in samp... | <|body_start_0|>
super(RandomHorizontalFlip, self).__init__()
self.prob = prob
if not isinstance(self.prob, float):
raise TypeError('{}: input type is invalid.'.format(self))
<|end_body_0|>
<|body_start_1|>
samples = sample
batch_input = True
if not isinstanc... | RandomHorizontalFlip | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomHorizontalFlip:
def __init__(self, prob=0.5):
"""Args: prob (float): the probability of flipping image is_normalized (bool): whether the bbox scale to [0,1] is_mask_flip (bool): whether flip the segmentation"""
<|body_0|>
def __call__(self, sample, context=None):
... | stack_v2_sparse_classes_10k_train_008747 | 19,057 | permissive | [
{
"docstring": "Args: prob (float): the probability of flipping image is_normalized (bool): whether the bbox scale to [0,1] is_mask_flip (bool): whether flip the segmentation",
"name": "__init__",
"signature": "def __init__(self, prob=0.5)"
},
{
"docstring": "Filp the image and bounding box. Ope... | 2 | stack_v2_sparse_classes_30k_train_003965 | Implement the Python class `RandomHorizontalFlip` described below.
Class description:
Implement the RandomHorizontalFlip class.
Method signatures and docstrings:
- def __init__(self, prob=0.5): Args: prob (float): the probability of flipping image is_normalized (bool): whether the bbox scale to [0,1] is_mask_flip (bo... | Implement the Python class `RandomHorizontalFlip` described below.
Class description:
Implement the RandomHorizontalFlip class.
Method signatures and docstrings:
- def __init__(self, prob=0.5): Args: prob (float): the probability of flipping image is_normalized (bool): whether the bbox scale to [0,1] is_mask_flip (bo... | b8ec015fa9e16c0a879c619ee1f2aab8a393c7bd | <|skeleton|>
class RandomHorizontalFlip:
def __init__(self, prob=0.5):
"""Args: prob (float): the probability of flipping image is_normalized (bool): whether the bbox scale to [0,1] is_mask_flip (bool): whether flip the segmentation"""
<|body_0|>
def __call__(self, sample, context=None):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RandomHorizontalFlip:
def __init__(self, prob=0.5):
"""Args: prob (float): the probability of flipping image is_normalized (bool): whether the bbox scale to [0,1] is_mask_flip (bool): whether flip the segmentation"""
super(RandomHorizontalFlip, self).__init__()
self.prob = prob
... | the_stack_v2_python_sparse | CV/PaddleReid/reid/data/transform/operators.py | sserdoubleh/Research | train | 10 | |
bdc4abc0d790ecb0f535d92deb1f8eb639f644d9 | [
"d = {}\nfor propname, _ in self.PROPERTIES:\n if propname in props:\n d[propname] = props[propname]\nself.properties = d",
"try:\n return self.properties == other.properties\nexcept AttributeError:\n return NotImplemented",
"if name == '__setstate__':\n raise AttributeError('__setstate__')\n... | <|body_start_0|>
d = {}
for propname, _ in self.PROPERTIES:
if propname in props:
d[propname] = props[propname]
self.properties = d
<|end_body_0|>
<|body_start_1|>
try:
return self.properties == other.properties
except AttributeError:
... | Abstract base class for AMQP content. Subclasses should override the PROPERTIES attribute. | GenericContent | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GenericContent:
"""Abstract base class for AMQP content. Subclasses should override the PROPERTIES attribute."""
def __init__(self, **props):
"""Save the properties appropriate to this AMQP content type in a 'properties' dictionary."""
<|body_0|>
def __eq__(self, other):... | stack_v2_sparse_classes_10k_train_008748 | 16,315 | permissive | [
{
"docstring": "Save the properties appropriate to this AMQP content type in a 'properties' dictionary.",
"name": "__init__",
"signature": "def __init__(self, **props)"
},
{
"docstring": "Check if this object has the same properties as another content object.",
"name": "__eq__",
"signatu... | 5 | null | Implement the Python class `GenericContent` described below.
Class description:
Abstract base class for AMQP content. Subclasses should override the PROPERTIES attribute.
Method signatures and docstrings:
- def __init__(self, **props): Save the properties appropriate to this AMQP content type in a 'properties' dictio... | Implement the Python class `GenericContent` described below.
Class description:
Abstract base class for AMQP content. Subclasses should override the PROPERTIES attribute.
Method signatures and docstrings:
- def __init__(self, **props): Save the properties appropriate to this AMQP content type in a 'properties' dictio... | 3c3acc55de8ba741e673063378e6cbaf10b64c7a | <|skeleton|>
class GenericContent:
"""Abstract base class for AMQP content. Subclasses should override the PROPERTIES attribute."""
def __init__(self, **props):
"""Save the properties appropriate to this AMQP content type in a 'properties' dictionary."""
<|body_0|>
def __eq__(self, other):... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GenericContent:
"""Abstract base class for AMQP content. Subclasses should override the PROPERTIES attribute."""
def __init__(self, **props):
"""Save the properties appropriate to this AMQP content type in a 'properties' dictionary."""
d = {}
for propname, _ in self.PROPERTIES:
... | the_stack_v2_python_sparse | env/lib/python3.6/site-packages/amqp/serialization.py | Raniac/NEURO-LEARN | train | 9 |
1c327e9905e35673f2886472298d3558e571cffa | [
"self._offset = numpy.ndarray((3, len(cellid_list), 8192, 128), dtype=numpy.int16)\nself._digital_gain = numpy.ndarray((3, len(cellid_list), 8192, 128), dtype=numpy.int16)\nself._relative_gain = numpy.ndarray((3, len(cellid_list), 8192, 128), dtype=numpy.float32)\nfor index, cell in enumerate(cellid_list):\n sel... | <|body_start_0|>
self._offset = numpy.ndarray((3, len(cellid_list), 8192, 128), dtype=numpy.int16)
self._digital_gain = numpy.ndarray((3, len(cellid_list), 8192, 128), dtype=numpy.int16)
self._relative_gain = numpy.ndarray((3, len(cellid_list), 8192, 128), dtype=numpy.float32)
for index,... | See documentation of the '__init__' function. | Agipd1MCalibration | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Agipd1MCalibration:
"""See documentation of the '__init__' function."""
def __init__(self, calibration_filename, cellid_list):
"""Calibration of the AGIPD 1M detector. This algorithm stores the calibration parameters for an AGIPD 1M detector and applies the calibration to a detector ... | stack_v2_sparse_classes_10k_train_008749 | 7,938 | no_license | [
{
"docstring": "Calibration of the AGIPD 1M detector. This algorithm stores the calibration parameters for an AGIPD 1M detector and applies the calibration to a detector data frame upon request. Since the the full set of correction parameters for the AGIPD 1M detector takes up a lot of memory, only the paramete... | 2 | stack_v2_sparse_classes_30k_train_002280 | Implement the Python class `Agipd1MCalibration` described below.
Class description:
See documentation of the '__init__' function.
Method signatures and docstrings:
- def __init__(self, calibration_filename, cellid_list): Calibration of the AGIPD 1M detector. This algorithm stores the calibration parameters for an AGI... | Implement the Python class `Agipd1MCalibration` described below.
Class description:
See documentation of the '__init__' function.
Method signatures and docstrings:
- def __init__(self, calibration_filename, cellid_list): Calibration of the AGIPD 1M detector. This algorithm stores the calibration parameters for an AGI... | 42385522e68116db0e03df19574e904a5d146a9c | <|skeleton|>
class Agipd1MCalibration:
"""See documentation of the '__init__' function."""
def __init__(self, calibration_filename, cellid_list):
"""Calibration of the AGIPD 1M detector. This algorithm stores the calibration parameters for an AGIPD 1M detector and applies the calibration to a detector ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Agipd1MCalibration:
"""See documentation of the '__init__' function."""
def __init__(self, calibration_filename, cellid_list):
"""Calibration of the AGIPD 1M detector. This algorithm stores the calibration parameters for an AGIPD 1M detector and applies the calibration to a detector data frame up... | the_stack_v2_python_sparse | onda/algorithms/calibration_algorithms.py | clydeph/onda | train | 2 |
17180925069fc4ed68eb2ef0415c0286b12ce395 | [
"self.sensor_data = BME680Handler.SensorData()\nself._sensor = sensor\nself._gas_sensor_running = False\nself._hum_baseline = hum_baseline\nself._hum_weighting = hum_weighting\nself._gas_baseline = None\nif gas_measurement:\n threading.Thread(target=self._run_gas_sensor, kwargs={'burn_in_time': burn_in_time}, na... | <|body_start_0|>
self.sensor_data = BME680Handler.SensorData()
self._sensor = sensor
self._gas_sensor_running = False
self._hum_baseline = hum_baseline
self._hum_weighting = hum_weighting
self._gas_baseline = None
if gas_measurement:
threading.Thread(t... | BME680 sensor working in i2C bus. | BME680Handler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BME680Handler:
"""BME680 sensor working in i2C bus."""
def __init__(self, sensor, gas_measurement=False, burn_in_time=300, hum_baseline=40, hum_weighting=25):
"""Initialize the sensor handler."""
<|body_0|>
def _run_gas_sensor(self, burn_in_time):
"""Calibrate th... | stack_v2_sparse_classes_10k_train_008750 | 13,136 | permissive | [
{
"docstring": "Initialize the sensor handler.",
"name": "__init__",
"signature": "def __init__(self, sensor, gas_measurement=False, burn_in_time=300, hum_baseline=40, hum_weighting=25)"
},
{
"docstring": "Calibrate the Air Quality Gas Baseline.",
"name": "_run_gas_sensor",
"signature": ... | 4 | null | Implement the Python class `BME680Handler` described below.
Class description:
BME680 sensor working in i2C bus.
Method signatures and docstrings:
- def __init__(self, sensor, gas_measurement=False, burn_in_time=300, hum_baseline=40, hum_weighting=25): Initialize the sensor handler.
- def _run_gas_sensor(self, burn_i... | Implement the Python class `BME680Handler` described below.
Class description:
BME680 sensor working in i2C bus.
Method signatures and docstrings:
- def __init__(self, sensor, gas_measurement=False, burn_in_time=300, hum_baseline=40, hum_weighting=25): Initialize the sensor handler.
- def _run_gas_sensor(self, burn_i... | 2fee32fce03bc49e86cf2e7b741a15621a97cce5 | <|skeleton|>
class BME680Handler:
"""BME680 sensor working in i2C bus."""
def __init__(self, sensor, gas_measurement=False, burn_in_time=300, hum_baseline=40, hum_weighting=25):
"""Initialize the sensor handler."""
<|body_0|>
def _run_gas_sensor(self, burn_in_time):
"""Calibrate th... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BME680Handler:
"""BME680 sensor working in i2C bus."""
def __init__(self, sensor, gas_measurement=False, burn_in_time=300, hum_baseline=40, hum_weighting=25):
"""Initialize the sensor handler."""
self.sensor_data = BME680Handler.SensorData()
self._sensor = sensor
self._gas... | the_stack_v2_python_sparse | homeassistant/components/bme680/sensor.py | BenWoodford/home-assistant | train | 11 |
8a15c5893c654c2b36786bb85c4c96552f3dd296 | [
"actor = eventContext.event.actor\nif actor.HasField(type_id_field):\n if not (actor.HasField(identifier_field) and actor.HasField(uuid_field)):\n if actor.HasField(uuid_field):\n uuid = getattr(actor, uuid_field, None)\n element = evtProcessorManager.getElementByUuid(uuid)\n ... | <|body_start_0|>
actor = eventContext.event.actor
if actor.HasField(type_id_field):
if not (actor.HasField(identifier_field) and actor.HasField(uuid_field)):
if actor.HasField(uuid_field):
uuid = getattr(actor, uuid_field, None)
element... | BaseEventIdentifierPlugin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseEventIdentifierPlugin:
def _resolveElement(self, evtProcessorManager, catalog, eventContext, type_id_field, identifier_field, uuid_field):
"""Lookup an element by identifier or uuid and make sure both identifier and uuid are set."""
<|body_0|>
def resolveIdentifiers(self... | stack_v2_sparse_classes_10k_train_008751 | 35,633 | no_license | [
{
"docstring": "Lookup an element by identifier or uuid and make sure both identifier and uuid are set.",
"name": "_resolveElement",
"signature": "def _resolveElement(self, evtProcessorManager, catalog, eventContext, type_id_field, identifier_field, uuid_field)"
},
{
"docstring": "Update eventCo... | 2 | stack_v2_sparse_classes_30k_train_006703 | Implement the Python class `BaseEventIdentifierPlugin` described below.
Class description:
Implement the BaseEventIdentifierPlugin class.
Method signatures and docstrings:
- def _resolveElement(self, evtProcessorManager, catalog, eventContext, type_id_field, identifier_field, uuid_field): Lookup an element by identif... | Implement the Python class `BaseEventIdentifierPlugin` described below.
Class description:
Implement the BaseEventIdentifierPlugin class.
Method signatures and docstrings:
- def _resolveElement(self, evtProcessorManager, catalog, eventContext, type_id_field, identifier_field, uuid_field): Lookup an element by identif... | 1ea508c3d2b51742bc3b448c445cd0a3dba9e798 | <|skeleton|>
class BaseEventIdentifierPlugin:
def _resolveElement(self, evtProcessorManager, catalog, eventContext, type_id_field, identifier_field, uuid_field):
"""Lookup an element by identifier or uuid and make sure both identifier and uuid are set."""
<|body_0|>
def resolveIdentifiers(self... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BaseEventIdentifierPlugin:
def _resolveElement(self, evtProcessorManager, catalog, eventContext, type_id_field, identifier_field, uuid_field):
"""Lookup an element by identifier or uuid and make sure both identifier and uuid are set."""
actor = eventContext.event.actor
if actor.HasFiel... | the_stack_v2_python_sparse | Products/ZenEvents/events2/processing.py | zenoss/zenoss-prodbin | train | 27 | |
6727a87e8e7c72b8498e2ef9ed244f7a3c059899 | [
"self.stack = []\nif root:\n if root.right:\n self.stack.append(root.right)\n self.stack.append(root.val)\n if root.left:\n self.stack.append(root.left)",
"if self.stack:\n if isinstance(self.stack[-1], int):\n return self.stack.pop()\n else:\n while self.stack:\n ... | <|body_start_0|>
self.stack = []
if root:
if root.right:
self.stack.append(root.right)
self.stack.append(root.val)
if root.left:
self.stack.append(root.left)
<|end_body_0|>
<|body_start_1|>
if self.stack:
if isinsta... | BSTIterator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BSTIterator:
def __init__(self, root):
""":type root: TreeNode"""
<|body_0|>
def next(self):
"""@return the next smallest number :rtype: int"""
<|body_1|>
def hasNext(self):
"""@return whether we have a next smallest number :rtype: bool"""
... | stack_v2_sparse_classes_10k_train_008752 | 1,641 | no_license | [
{
"docstring": ":type root: TreeNode",
"name": "__init__",
"signature": "def __init__(self, root)"
},
{
"docstring": "@return the next smallest number :rtype: int",
"name": "next",
"signature": "def next(self)"
},
{
"docstring": "@return whether we have a next smallest number :rt... | 3 | null | Implement the Python class `BSTIterator` described below.
Class description:
Implement the BSTIterator class.
Method signatures and docstrings:
- def __init__(self, root): :type root: TreeNode
- def next(self): @return the next smallest number :rtype: int
- def hasNext(self): @return whether we have a next smallest n... | Implement the Python class `BSTIterator` described below.
Class description:
Implement the BSTIterator class.
Method signatures and docstrings:
- def __init__(self, root): :type root: TreeNode
- def next(self): @return the next smallest number :rtype: int
- def hasNext(self): @return whether we have a next smallest n... | 1cb183a326a0612a5cd941778500a8265e1d7255 | <|skeleton|>
class BSTIterator:
def __init__(self, root):
""":type root: TreeNode"""
<|body_0|>
def next(self):
"""@return the next smallest number :rtype: int"""
<|body_1|>
def hasNext(self):
"""@return whether we have a next smallest number :rtype: bool"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BSTIterator:
def __init__(self, root):
""":type root: TreeNode"""
self.stack = []
if root:
if root.right:
self.stack.append(root.right)
self.stack.append(root.val)
if root.left:
self.stack.append(root.left)
def ne... | the_stack_v2_python_sparse | LeetCode/BSTIterator.py | gavinz0228/AlgoPractice | train | 1 | |
210c1f1df88fd0a9dca4f1280da90594e3d6ff93 | [
"Init.__init__(self, *args, **kwargs)\nself._negative = negative\nself._parameter = parameter\nself._scale = scale\nself._obs = EarthLocation.of_site(obs)\nself._kind = kind",
"if not os.path.exists(filename):\n self.log.error('Give file %s for extracting coordinates does not exist, skipping.', filename)\n ... | <|body_start_0|>
Init.__init__(self, *args, **kwargs)
self._negative = negative
self._parameter = parameter
self._scale = scale
self._obs = EarthLocation.of_site(obs)
self._kind = kind
<|end_body_0|>
<|body_start_1|>
if not os.path.exists(filename):
s... | Initializes a component from the heliocentric correction calculated for RA/Dec given in the FITS headers. This class, when called, initializes a single parameter (the radial velocity, default to "v") of the given component with the heliocentric correction calculated from RA/DEC/DATE-OBS in the given file. | InitFromVhelio | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InitFromVhelio:
"""Initializes a component from the heliocentric correction calculated for RA/Dec given in the FITS headers. This class, when called, initializes a single parameter (the radial velocity, default to "v") of the given component with the heliocentric correction calculated from RA/DEC... | stack_v2_sparse_classes_10k_train_008753 | 2,738 | permissive | [
{
"docstring": "Initializes a new Init object. Args: negative: If True, uses the negative of the calculated correction. parameter: Name of the parameter in the component to set. scale: Time scale to use for DATE-OBS. obs: Observatory to use for calculating correction. kind: Either barycentric or heliocentric.",... | 2 | stack_v2_sparse_classes_30k_train_004773 | Implement the Python class `InitFromVhelio` described below.
Class description:
Initializes a component from the heliocentric correction calculated for RA/Dec given in the FITS headers. This class, when called, initializes a single parameter (the radial velocity, default to "v") of the given component with the helioce... | Implement the Python class `InitFromVhelio` described below.
Class description:
Initializes a component from the heliocentric correction calculated for RA/Dec given in the FITS headers. This class, when called, initializes a single parameter (the radial velocity, default to "v") of the given component with the helioce... | 648eb1758e3744d9e3d6669edc4a0c4753559f17 | <|skeleton|>
class InitFromVhelio:
"""Initializes a component from the heliocentric correction calculated for RA/Dec given in the FITS headers. This class, when called, initializes a single parameter (the radial velocity, default to "v") of the given component with the heliocentric correction calculated from RA/DEC... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class InitFromVhelio:
"""Initializes a component from the heliocentric correction calculated for RA/Dec given in the FITS headers. This class, when called, initializes a single parameter (the radial velocity, default to "v") of the given component with the heliocentric correction calculated from RA/DEC/DATE-OBS in ... | the_stack_v2_python_sparse | spexxy/init/fromvhelio.py | thusser/spexxy | train | 4 |
32c1571a62386f6d4fb490056be5dc4bfd9763d7 | [
"super(TfGraphConverter, self).__init__(framework, base_path)\nprint('{} bmodel converter init'.format(model_name))\nself.model_name = model_name\nself.models_path = models_path\nself.shapes = shapes\nself.dyns = dyns\nself.outdirs = outdirs\nself.nets_name = nets_name\nself.input_names = input_names\nself.output_n... | <|body_start_0|>
super(TfGraphConverter, self).__init__(framework, base_path)
print('{} bmodel converter init'.format(model_name))
self.model_name = model_name
self.models_path = models_path
self.shapes = shapes
self.dyns = dyns
self.outdirs = outdirs
self... | tf graph bmodel converter | TfGraphConverter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TfGraphConverter:
"""tf graph bmodel converter"""
def __init__(self, model_name, base_path, models_path, shapes, dyns, outdirs, nets_name, input_names, output_names, framework, target):
"""Init tf graph bmodel converter"""
<|body_0|>
def converter(self):
"""conve... | stack_v2_sparse_classes_10k_train_008754 | 15,723 | permissive | [
{
"docstring": "Init tf graph bmodel converter",
"name": "__init__",
"signature": "def __init__(self, model_name, base_path, models_path, shapes, dyns, outdirs, nets_name, input_names, output_names, framework, target)"
},
{
"docstring": "convert tf graph",
"name": "converter",
"signature... | 2 | stack_v2_sparse_classes_30k_train_007183 | Implement the Python class `TfGraphConverter` described below.
Class description:
tf graph bmodel converter
Method signatures and docstrings:
- def __init__(self, model_name, base_path, models_path, shapes, dyns, outdirs, nets_name, input_names, output_names, framework, target): Init tf graph bmodel converter
- def c... | Implement the Python class `TfGraphConverter` described below.
Class description:
tf graph bmodel converter
Method signatures and docstrings:
- def __init__(self, model_name, base_path, models_path, shapes, dyns, outdirs, nets_name, input_names, output_names, framework, target): Init tf graph bmodel converter
- def c... | c9fa07851da663dda4953dba72e1d3937299a4ea | <|skeleton|>
class TfGraphConverter:
"""tf graph bmodel converter"""
def __init__(self, model_name, base_path, models_path, shapes, dyns, outdirs, nets_name, input_names, output_names, framework, target):
"""Init tf graph bmodel converter"""
<|body_0|>
def converter(self):
"""conve... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TfGraphConverter:
"""tf graph bmodel converter"""
def __init__(self, model_name, base_path, models_path, shapes, dyns, outdirs, nets_name, input_names, output_names, framework, target):
"""Init tf graph bmodel converter"""
super(TfGraphConverter, self).__init__(framework, base_path)
... | the_stack_v2_python_sparse | modules/utils/bmodel_converter.py | sophon-ai-algo/sophon-inference | train | 32 |
f68e8d93df133ee99060ab7960a68a1e4c1364f4 | [
"matches = []\nfirst_key = keys[0]\nsecond_key = keys[1]\nif isinstance(second_key, (six.string_types, int)):\n if isinstance(map_name, six.string_types):\n mapping = mappings.get(map_name)\n if mapping:\n if isinstance(first_key, (six.string_types, int)):\n if isinstance(... | <|body_start_0|>
matches = []
first_key = keys[0]
second_key = keys[1]
if isinstance(second_key, (six.string_types, int)):
if isinstance(map_name, six.string_types):
mapping = mappings.get(map_name)
if mapping:
if isinstance... | Check if FindInMap values are correct | FindInMapKeys | [
"MIT-0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FindInMapKeys:
"""Check if FindInMap values are correct"""
def check_keys(self, map_name, keys, mappings, tree):
"""Check the validity of the first key"""
<|body_0|>
def match(self, cfn):
"""Check CloudFormation GetAtt"""
<|body_1|>
<|end_skeleton|>
<|b... | stack_v2_sparse_classes_10k_train_008755 | 3,107 | permissive | [
{
"docstring": "Check the validity of the first key",
"name": "check_keys",
"signature": "def check_keys(self, map_name, keys, mappings, tree)"
},
{
"docstring": "Check CloudFormation GetAtt",
"name": "match",
"signature": "def match(self, cfn)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003434 | Implement the Python class `FindInMapKeys` described below.
Class description:
Check if FindInMap values are correct
Method signatures and docstrings:
- def check_keys(self, map_name, keys, mappings, tree): Check the validity of the first key
- def match(self, cfn): Check CloudFormation GetAtt | Implement the Python class `FindInMapKeys` described below.
Class description:
Check if FindInMap values are correct
Method signatures and docstrings:
- def check_keys(self, map_name, keys, mappings, tree): Check the validity of the first key
- def match(self, cfn): Check CloudFormation GetAtt
<|skeleton|>
class Fin... | 5176573c2f4cb7313998b4bc0bcb0716b58ea380 | <|skeleton|>
class FindInMapKeys:
"""Check if FindInMap values are correct"""
def check_keys(self, map_name, keys, mappings, tree):
"""Check the validity of the first key"""
<|body_0|>
def match(self, cfn):
"""Check CloudFormation GetAtt"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FindInMapKeys:
"""Check if FindInMap values are correct"""
def check_keys(self, map_name, keys, mappings, tree):
"""Check the validity of the first key"""
matches = []
first_key = keys[0]
second_key = keys[1]
if isinstance(second_key, (six.string_types, int)):
... | the_stack_v2_python_sparse | src/cfnlint/rules/functions/FindInMapKeys.py | rene84/cfn-python-lint | train | 1 |
53de3535157d706e25333065aa5615166e2bd7b9 | [
"if len(nums) <= 1:\n return len(nums)\nvalues = [1] * len(nums)\nmax_value = 1\nfor i in range(0, len(nums)):\n for j in range(0, i):\n if nums[j] < nums[i]:\n values[i] = max(values[i], values[j] + 1)\n max_value = max(max_value, values[i])\nreturn max_value",
"length_tail_min_values ... | <|body_start_0|>
if len(nums) <= 1:
return len(nums)
values = [1] * len(nums)
max_value = 1
for i in range(0, len(nums)):
for j in range(0, i):
if nums[j] < nums[i]:
values[i] = max(values[i], values[j] + 1)
max_valu... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLISDP(self, nums):
"""This O(n^2) approach uses DP. Each index contains the longest increasing subsequence at that index. When evaluating each index, iterate through previous values. If a previous number is less than current number, increment the LIS value at the cu... | stack_v2_sparse_classes_10k_train_008756 | 3,174 | permissive | [
{
"docstring": "This O(n^2) approach uses DP. Each index contains the longest increasing subsequence at that index. When evaluating each index, iterate through previous values. If a previous number is less than current number, increment the LIS value at the current index, if LIS value is greater than existing L... | 2 | stack_v2_sparse_classes_30k_val_000189 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLISDP(self, nums): This O(n^2) approach uses DP. Each index contains the longest increasing subsequence at that index. When evaluating each index, iterate through pre... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLISDP(self, nums): This O(n^2) approach uses DP. Each index contains the longest increasing subsequence at that index. When evaluating each index, iterate through pre... | b37b14f49b4b6ee9304a3956b3b52f30d22fac29 | <|skeleton|>
class Solution:
def lengthOfLISDP(self, nums):
"""This O(n^2) approach uses DP. Each index contains the longest increasing subsequence at that index. When evaluating each index, iterate through previous values. If a previous number is less than current number, increment the LIS value at the cu... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLISDP(self, nums):
"""This O(n^2) approach uses DP. Each index contains the longest increasing subsequence at that index. When evaluating each index, iterate through previous values. If a previous number is less than current number, increment the LIS value at the current index, i... | the_stack_v2_python_sparse | longest_increasing_subsequence.py | jaebradley/leetcode.py | train | 1 | |
046d76758e1b005faef5dcfa3d772c11ab50a958 | [
"if not start_end_points:\n detail = \"Can't create a graph with the empty start line.\"\n raise TableLineEmptyException(detail)\nif columns_width:\n assert len(columns_width) == column_count, 'Columns count and list with they widths must be the same length.'\nself.horizontal_line = [ShapePoint(start_end_p... | <|body_start_0|>
if not start_end_points:
detail = "Can't create a graph with the empty start line."
raise TableLineEmptyException(detail)
if columns_width:
assert len(columns_width) == column_count, 'Columns count and list with they widths must be the same length.'
... | Table class. Built from Lines | Table | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Table:
"""Table class. Built from Lines"""
def __init__(self, start_end_points: Tuple[tuple, tuple], row_count: int=0, row_height: Union[int, float]=0.2, column_count: int=0, visible_row_count: int=0, columns_width: tuple=None, lines_color: Color=BLACK, stroke_width: Union[int, float]=1, *ar... | stack_v2_sparse_classes_10k_train_008757 | 9,066 | no_license | [
{
"docstring": "Class initialization. Args: start_end_points (Tuple[tuple, tuple]): Left top and right top points. ((x1,y1), (x2,y2)). row_count (int, optional): Table row count. Defaults to 0. row_height (Union[int, float], optional): Table row height. Defaults to 0.2. column_count (int, optional): Table colum... | 2 | stack_v2_sparse_classes_30k_train_000440 | Implement the Python class `Table` described below.
Class description:
Table class. Built from Lines
Method signatures and docstrings:
- def __init__(self, start_end_points: Tuple[tuple, tuple], row_count: int=0, row_height: Union[int, float]=0.2, column_count: int=0, visible_row_count: int=0, columns_width: tuple=No... | Implement the Python class `Table` described below.
Class description:
Table class. Built from Lines
Method signatures and docstrings:
- def __init__(self, start_end_points: Tuple[tuple, tuple], row_count: int=0, row_height: Union[int, float]=0.2, column_count: int=0, visible_row_count: int=0, columns_width: tuple=No... | 290bf56ef888283a0225939ed8b1f87445e506d0 | <|skeleton|>
class Table:
"""Table class. Built from Lines"""
def __init__(self, start_end_points: Tuple[tuple, tuple], row_count: int=0, row_height: Union[int, float]=0.2, column_count: int=0, visible_row_count: int=0, columns_width: tuple=None, lines_color: Color=BLACK, stroke_width: Union[int, float]=1, *ar... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Table:
"""Table class. Built from Lines"""
def __init__(self, start_end_points: Tuple[tuple, tuple], row_count: int=0, row_height: Union[int, float]=0.2, column_count: int=0, visible_row_count: int=0, columns_width: tuple=None, lines_color: Color=BLACK, stroke_width: Union[int, float]=1, *args, **kwargs)... | the_stack_v2_python_sparse | classes/table.py | mohovkm/habr_manim | train | 0 |
70437f949a1b790fe0dc879fd379d9dcb00d5444 | [
"self.config = config\nself.add_entities = add_entities\nself.oauth = oauth",
"hass = request.app['hass']\ndata = request.query\nresponse_message = 'Fitbit has been successfully authorized!\\n You can close this window now!'\nresult = None\nif data.get('code') is not None:\n redirect_uri = f'{get_url(ha... | <|body_start_0|>
self.config = config
self.add_entities = add_entities
self.oauth = oauth
<|end_body_0|>
<|body_start_1|>
hass = request.app['hass']
data = request.query
response_message = 'Fitbit has been successfully authorized!\n You can close this window now!'... | Handle OAuth finish callback requests. | FitbitAuthCallbackView | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FitbitAuthCallbackView:
"""Handle OAuth finish callback requests."""
def __init__(self, config, add_entities, oauth):
"""Initialize the OAuth callback view."""
<|body_0|>
def get(self, request):
"""Finish OAuth callback request."""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_10k_train_008758 | 19,565 | permissive | [
{
"docstring": "Initialize the OAuth callback view.",
"name": "__init__",
"signature": "def __init__(self, config, add_entities, oauth)"
},
{
"docstring": "Finish OAuth callback request.",
"name": "get",
"signature": "def get(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002947 | Implement the Python class `FitbitAuthCallbackView` described below.
Class description:
Handle OAuth finish callback requests.
Method signatures and docstrings:
- def __init__(self, config, add_entities, oauth): Initialize the OAuth callback view.
- def get(self, request): Finish OAuth callback request. | Implement the Python class `FitbitAuthCallbackView` described below.
Class description:
Handle OAuth finish callback requests.
Method signatures and docstrings:
- def __init__(self, config, add_entities, oauth): Initialize the OAuth callback view.
- def get(self, request): Finish OAuth callback request.
<|skeleton|>... | ed4ab403deaed9e8c95e0db728477fcb012bf4fa | <|skeleton|>
class FitbitAuthCallbackView:
"""Handle OAuth finish callback requests."""
def __init__(self, config, add_entities, oauth):
"""Initialize the OAuth callback view."""
<|body_0|>
def get(self, request):
"""Finish OAuth callback request."""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FitbitAuthCallbackView:
"""Handle OAuth finish callback requests."""
def __init__(self, config, add_entities, oauth):
"""Initialize the OAuth callback view."""
self.config = config
self.add_entities = add_entities
self.oauth = oauth
def get(self, request):
"""... | the_stack_v2_python_sparse | homeassistant/components/fitbit/sensor.py | tchellomello/home-assistant | train | 8 |
a671e163df21aee3d74330660ba4caea68251629 | [
"enc1, enc2 = ([], [])\ncount1, count2 = (0, 0)\ndict1, dict2 = (dict(), dict())\nfor i in range(len(s1)):\n char1, char2 = (s1[i], s2[i])\n if char1 in dict1:\n enc1.append(dict1[char1])\n else:\n count1 += 1\n dict1[char1] = count1\n enc1.append(dict1[char1])\n if char2 in ... | <|body_start_0|>
enc1, enc2 = ([], [])
count1, count2 = (0, 0)
dict1, dict2 = (dict(), dict())
for i in range(len(s1)):
char1, char2 = (s1[i], s2[i])
if char1 in dict1:
enc1.append(dict1[char1])
else:
count1 += 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def is_isomorphic(self, s1, s2):
"""Algorithm based on encoding two strings and comparing resulted encodings. Encoding is following: each new character receives a unique index, starting from 0. We keep track of already used characters. If we see the character again, we take ind... | stack_v2_sparse_classes_10k_train_008759 | 2,448 | no_license | [
{
"docstring": "Algorithm based on encoding two strings and comparing resulted encodings. Encoding is following: each new character receives a unique index, starting from 0. We keep track of already used characters. If we see the character again, we take index from a dictionary, otherwise we assign a new index.... | 2 | stack_v2_sparse_classes_30k_train_003273 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def is_isomorphic(self, s1, s2): Algorithm based on encoding two strings and comparing resulted encodings. Encoding is following: each new character receives a unique index, star... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def is_isomorphic(self, s1, s2): Algorithm based on encoding two strings and comparing resulted encodings. Encoding is following: each new character receives a unique index, star... | 71b722ddfe8da04572e527b055cf8723d5c87bbf | <|skeleton|>
class Solution:
def is_isomorphic(self, s1, s2):
"""Algorithm based on encoding two strings and comparing resulted encodings. Encoding is following: each new character receives a unique index, starting from 0. We keep track of already used characters. If we see the character again, we take ind... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def is_isomorphic(self, s1, s2):
"""Algorithm based on encoding two strings and comparing resulted encodings. Encoding is following: each new character receives a unique index, starting from 0. We keep track of already used characters. If we see the character again, we take index from a dict... | the_stack_v2_python_sparse | Strings/isomorphic_strings.py | vladn90/Algorithms | train | 0 | |
bba167eab6302db1318c271f291acd6d4cb5e417 | [
"res = []\nfor i in range(0, len(nums) - 1):\n for j in range(i + 1, len(nums)):\n if nums[i] + nums[j] == target:\n res.append(nums[i])\n res.append(nums[j])\nreturn res",
"lookup = {}\nfor i, num in enumerate(nums):\n if target - num in lookup:\n return [lookup[target -... | <|body_start_0|>
res = []
for i in range(0, len(nums) - 1):
for j in range(i + 1, len(nums)):
if nums[i] + nums[j] == target:
res.append(nums[i])
res.append(nums[j])
return res
<|end_body_0|>
<|body_start_1|>
lookup = {... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSum_ugly(self, nums, target):
""":param nums: list[int] :param target: int :return: list[int]"""
<|body_0|>
def twoSum(self, nums, target):
""":param nums: :param target: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
res ... | stack_v2_sparse_classes_10k_train_008760 | 755 | no_license | [
{
"docstring": ":param nums: list[int] :param target: int :return: list[int]",
"name": "twoSum_ugly",
"signature": "def twoSum_ugly(self, nums, target)"
},
{
"docstring": ":param nums: :param target: :return:",
"name": "twoSum",
"signature": "def twoSum(self, nums, target)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001865 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum_ugly(self, nums, target): :param nums: list[int] :param target: int :return: list[int]
- def twoSum(self, nums, target): :param nums: :param target: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum_ugly(self, nums, target): :param nums: list[int] :param target: int :return: list[int]
- def twoSum(self, nums, target): :param nums: :param target: :return:
<|skelet... | 84bd4a00160e6b2a723a57e149474c6bb38bcce2 | <|skeleton|>
class Solution:
def twoSum_ugly(self, nums, target):
""":param nums: list[int] :param target: int :return: list[int]"""
<|body_0|>
def twoSum(self, nums, target):
""":param nums: :param target: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def twoSum_ugly(self, nums, target):
""":param nums: list[int] :param target: int :return: list[int]"""
res = []
for i in range(0, len(nums) - 1):
for j in range(i + 1, len(nums)):
if nums[i] + nums[j] == target:
res.append(nums... | the_stack_v2_python_sparse | 1_num2sum.py | yanghongkai/yhkleetcode | train | 0 | |
0e4170fadaf37e32e407432dd3c19403dd92e9fa | [
"if context:\n extra_flags = context.extra_flags\n for extra_flag in extra_flags:\n if extra_flag.startswith(TEST_DATA_DIR_FLAG) and test_data_dir is None:\n test_data_dir = extra_flag[len(TEST_DATA_DIR_FLAG) + 1:]\n elif extra_flag.startswith(COMPONENT_ID_FLAG) and component_id is No... | <|body_start_0|>
if context:
extra_flags = context.extra_flags
for extra_flag in extra_flags:
if extra_flag.startswith(TEST_DATA_DIR_FLAG) and test_data_dir is None:
test_data_dir = extra_flag[len(TEST_DATA_DIR_FLAG) + 1:]
elif extra_fl... | TFX base stub executor. | BaseStubExecutor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseStubExecutor:
"""TFX base stub executor."""
def __init__(self, component_id: Optional[str]=None, test_data_dir: Optional[str]=None, context: Optional[base_executor.BaseExecutor.Context]=None):
"""Initializes a BaseStubExecutor. Args: component_id: component id of a component asso... | stack_v2_sparse_classes_10k_train_008761 | 3,423 | permissive | [
{
"docstring": "Initializes a BaseStubExecutor. Args: component_id: component id of a component associated with the stub executor. test_data_dir: The directory to test data (pipeline_recorder.py). context: context class for all executors. component_id and test_data_dir can be encoded in the context as well. Rai... | 2 | stack_v2_sparse_classes_30k_train_005980 | Implement the Python class `BaseStubExecutor` described below.
Class description:
TFX base stub executor.
Method signatures and docstrings:
- def __init__(self, component_id: Optional[str]=None, test_data_dir: Optional[str]=None, context: Optional[base_executor.BaseExecutor.Context]=None): Initializes a BaseStubExecu... | Implement the Python class `BaseStubExecutor` described below.
Class description:
TFX base stub executor.
Method signatures and docstrings:
- def __init__(self, component_id: Optional[str]=None, test_data_dir: Optional[str]=None, context: Optional[base_executor.BaseExecutor.Context]=None): Initializes a BaseStubExecu... | 1b328504fa08a70388691e4072df76f143631325 | <|skeleton|>
class BaseStubExecutor:
"""TFX base stub executor."""
def __init__(self, component_id: Optional[str]=None, test_data_dir: Optional[str]=None, context: Optional[base_executor.BaseExecutor.Context]=None):
"""Initializes a BaseStubExecutor. Args: component_id: component id of a component asso... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BaseStubExecutor:
"""TFX base stub executor."""
def __init__(self, component_id: Optional[str]=None, test_data_dir: Optional[str]=None, context: Optional[base_executor.BaseExecutor.Context]=None):
"""Initializes a BaseStubExecutor. Args: component_id: component id of a component associated with t... | the_stack_v2_python_sparse | tfx/experimental/pipeline_testing/base_stub_executor.py | tensorflow/tfx | train | 2,116 |
d2cc412e30fb8ab6432776ebfa83e70e630a5bec | [
"super().__init__(cv)\nself._nextrocket = 0\nself._time = 0\nself._cv = cv\nself._pos = pos",
"super().update(dt)\nself._time = self._time + dt\nif self._time > self._nextrocket:\n r = Rocket(self._cv, self._pos, 1000, ['red', 'blue', 'yellow', 'chartreuse2'], [500, 500], 3, 3)\n entities.append(r)\n sel... | <|body_start_0|>
super().__init__(cv)
self._nextrocket = 0
self._time = 0
self._cv = cv
self._pos = pos
<|end_body_0|>
<|body_start_1|>
super().update(dt)
self._time = self._time + dt
if self._time > self._nextrocket:
r = Rocket(self._cv, self... | RocketLauncher | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RocketLauncher:
def __init__(self, cv, pos):
"""Used to fire rockets into the sky at random intervals. Arguments: cv {idontknow} -- the canvas upon which this wonderful display pos {int} -- the position of the new rocket from the old rocket"""
<|body_0|>
def update(self, dt)... | stack_v2_sparse_classes_10k_train_008762 | 16,427 | permissive | [
{
"docstring": "Used to fire rockets into the sky at random intervals. Arguments: cv {idontknow} -- the canvas upon which this wonderful display pos {int} -- the position of the new rocket from the old rocket",
"name": "__init__",
"signature": "def __init__(self, cv, pos)"
},
{
"docstring": "Add... | 2 | stack_v2_sparse_classes_30k_train_006437 | Implement the Python class `RocketLauncher` described below.
Class description:
Implement the RocketLauncher class.
Method signatures and docstrings:
- def __init__(self, cv, pos): Used to fire rockets into the sky at random intervals. Arguments: cv {idontknow} -- the canvas upon which this wonderful display pos {int... | Implement the Python class `RocketLauncher` described below.
Class description:
Implement the RocketLauncher class.
Method signatures and docstrings:
- def __init__(self, cv, pos): Used to fire rockets into the sky at random intervals. Arguments: cv {idontknow} -- the canvas upon which this wonderful display pos {int... | c6b6d80e9d59f5d115ca8b8fc020fcd6cb030af8 | <|skeleton|>
class RocketLauncher:
def __init__(self, cv, pos):
"""Used to fire rockets into the sky at random intervals. Arguments: cv {idontknow} -- the canvas upon which this wonderful display pos {int} -- the position of the new rocket from the old rocket"""
<|body_0|>
def update(self, dt)... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RocketLauncher:
def __init__(self, cv, pos):
"""Used to fire rockets into the sky at random intervals. Arguments: cv {idontknow} -- the canvas upon which this wonderful display pos {int} -- the position of the new rocket from the old rocket"""
super().__init__(cv)
self._nextrocket = 0
... | the_stack_v2_python_sparse | scripts/sheet9/9.2.py | LennartElbe/PythOnline | train | 0 | |
f3d0e1bb4c192f4a35051562027f0c6b72d4d45d | [
"colors = {'ORG': '#7aecec', 'PRODUCT': '#bfeeb7', 'GPE': '#feca74', 'LOC': '#ff9561', 'PERSON': '#aa9cfc', 'NORP': '#c887fb', 'FACILITY': '#9cc9cc', 'EVENT': '#ffeb80', 'LAW': '#ff8197', 'LANGUAGE': '#ff8197', 'WORK_OF_ART': '#f0d0ff', 'DATE': '#bfe1d9', 'TIME': '#bfe1d9', 'MONEY': '#e4e7d2', 'QUANTITY': '#e4e7d2'... | <|body_start_0|>
colors = {'ORG': '#7aecec', 'PRODUCT': '#bfeeb7', 'GPE': '#feca74', 'LOC': '#ff9561', 'PERSON': '#aa9cfc', 'NORP': '#c887fb', 'FACILITY': '#9cc9cc', 'EVENT': '#ffeb80', 'LAW': '#ff8197', 'LANGUAGE': '#ff8197', 'WORK_OF_ART': '#f0d0ff', 'DATE': '#bfe1d9', 'TIME': '#bfe1d9', 'MONEY': '#e4e7d2', '... | Render named entities as HTML. | EntityRenderer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EntityRenderer:
"""Render named entities as HTML."""
def __init__(self, options={}):
"""Initialise dependency renderer. options (dict): Visualiser-specific options (colors, ents)"""
<|body_0|>
def render(self, parsed, page=False, minify=False):
"""Render complete... | stack_v2_sparse_classes_10k_train_008763 | 9,566 | permissive | [
{
"docstring": "Initialise dependency renderer. options (dict): Visualiser-specific options (colors, ents)",
"name": "__init__",
"signature": "def __init__(self, options={})"
},
{
"docstring": "Render complete markup. parsed (list): Dependency parses to render. page (bool): Render parses wrapped... | 3 | stack_v2_sparse_classes_30k_train_004592 | Implement the Python class `EntityRenderer` described below.
Class description:
Render named entities as HTML.
Method signatures and docstrings:
- def __init__(self, options={}): Initialise dependency renderer. options (dict): Visualiser-specific options (colors, ents)
- def render(self, parsed, page=False, minify=Fa... | Implement the Python class `EntityRenderer` described below.
Class description:
Render named entities as HTML.
Method signatures and docstrings:
- def __init__(self, options={}): Initialise dependency renderer. options (dict): Visualiser-specific options (colors, ents)
- def render(self, parsed, page=False, minify=Fa... | cabf6e4f1970dc14302f87414f170de19944bac2 | <|skeleton|>
class EntityRenderer:
"""Render named entities as HTML."""
def __init__(self, options={}):
"""Initialise dependency renderer. options (dict): Visualiser-specific options (colors, ents)"""
<|body_0|>
def render(self, parsed, page=False, minify=False):
"""Render complete... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EntityRenderer:
"""Render named entities as HTML."""
def __init__(self, options={}):
"""Initialise dependency renderer. options (dict): Visualiser-specific options (colors, ents)"""
colors = {'ORG': '#7aecec', 'PRODUCT': '#bfeeb7', 'GPE': '#feca74', 'LOC': '#ff9561', 'PERSON': '#aa9cfc', ... | the_stack_v2_python_sparse | Spacy/source2.7/spacy/displacy/render.py | ryfeus/lambda-packs | train | 1,283 |
6d765fe6d4147b13003153e363d4405cc4921e16 | [
"try:\n return json.loads(os.environ[key])\nexcept json.decoder.JSONDecodeError:\n return os.environ[key]",
"config_value_json = self.query(ConfigValue).get(key)\nif config_value_json is None:\n raise MissingConfigValue(key)\ntry:\n return json.loads(config_value_json.value)\nexcept json.decoder.JSOND... | <|body_start_0|>
try:
return json.loads(os.environ[key])
except json.decoder.JSONDecodeError:
return os.environ[key]
<|end_body_0|>
<|body_start_1|>
config_value_json = self.query(ConfigValue).get(key)
if config_value_json is None:
raise MissingConfig... | Service for reading and writing configuration values for the Rasa X server. Use this service for storing configuration values that can change during the execution of the Rasa X server, and that therefore should be persisted to the SQL database across server restarts. Any configuration value may be overidden by setting ... | ConfigService | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConfigService:
"""Service for reading and writing configuration values for the Rasa X server. Use this service for storing configuration values that can change during the execution of the Rasa X server, and that therefore should be persisted to the SQL database across server restarts. Any configu... | stack_v2_sparse_classes_10k_train_008764 | 6,853 | no_license | [
{
"docstring": "Read a configuration value from the environment. Args: key: Name of the configuration value. Returns: Configuration value.",
"name": "_get_value_from_env",
"signature": "def _get_value_from_env(self, key: Text) -> Any"
},
{
"docstring": "Read a configuration value from the databa... | 5 | stack_v2_sparse_classes_30k_train_006161 | Implement the Python class `ConfigService` described below.
Class description:
Service for reading and writing configuration values for the Rasa X server. Use this service for storing configuration values that can change during the execution of the Rasa X server, and that therefore should be persisted to the SQL datab... | Implement the Python class `ConfigService` described below.
Class description:
Service for reading and writing configuration values for the Rasa X server. Use this service for storing configuration values that can change during the execution of the Rasa X server, and that therefore should be persisted to the SQL datab... | 4d97e7e66225e526fc47d666351a16b7caea46d5 | <|skeleton|>
class ConfigService:
"""Service for reading and writing configuration values for the Rasa X server. Use this service for storing configuration values that can change during the execution of the Rasa X server, and that therefore should be persisted to the SQL database across server restarts. Any configu... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ConfigService:
"""Service for reading and writing configuration values for the Rasa X server. Use this service for storing configuration values that can change during the execution of the Rasa X server, and that therefore should be persisted to the SQL database across server restarts. Any configuration value ... | the_stack_v2_python_sparse | rasax/community/services/config_service.py | TrellixVulnTeam/Chat-bot-tuy-n-sinh_BZ0M | train | 0 |
bc5f77ef18fe5de788287c53bccb5c650829d303 | [
"if original_price or customer.next_package_original_price != 0:\n if original_price != 0:\n pass\n else:\n original_price = customer.invoice_product_original_price\nelse:\n original_price = customer.invoice_product_original_price\nif package:\n original_price = package.list_price\npackage... | <|body_start_0|>
if original_price or customer.next_package_original_price != 0:
if original_price != 0:
pass
else:
original_price = customer.invoice_product_original_price
else:
original_price = customer.invoice_product_original_price
... | Saves the customer Package history | CustomerPackageHistory | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CustomerPackageHistory:
"""Saves the customer Package history"""
def create_new_package_history(self, customer, package=None, start_date=None, price=None, original_price=None):
"""Returns created package history according to given customer and package info :param customer: customer o... | stack_v2_sparse_classes_10k_train_008765 | 6,032 | no_license | [
{
"docstring": "Returns created package history according to given customer and package info :param customer: customer obj :param package: package obj :param start_date: start date of the package :param price: price of the package :param original_price: original price of the package :return: package history obj... | 2 | stack_v2_sparse_classes_30k_train_005339 | Implement the Python class `CustomerPackageHistory` described below.
Class description:
Saves the customer Package history
Method signatures and docstrings:
- def create_new_package_history(self, customer, package=None, start_date=None, price=None, original_price=None): Returns created package history according to gi... | Implement the Python class `CustomerPackageHistory` described below.
Class description:
Saves the customer Package history
Method signatures and docstrings:
- def create_new_package_history(self, customer, package=None, start_date=None, price=None, original_price=None): Returns created package history according to gi... | ddbc84a20262bbe638862d1b1e63ae76972a9182 | <|skeleton|>
class CustomerPackageHistory:
"""Saves the customer Package history"""
def create_new_package_history(self, customer, package=None, start_date=None, price=None, original_price=None):
"""Returns created package history according to given customer and package info :param customer: customer o... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CustomerPackageHistory:
"""Saves the customer Package history"""
def create_new_package_history(self, customer, package=None, start_date=None, price=None, original_price=None):
"""Returns created package history according to given customer and package info :param customer: customer obj :param pac... | the_stack_v2_python_sparse | isp_crm_module/models/isp_crm_customer_package_history.py | DigiconTelecommunicationLtd/custom-addons | train | 1 |
44d0c477bd158ce335ad3b76288a4cbeaf895e71 | [
"super().__init__()\nself.data_set_loc = conf.config_section_mapper('filePath').get('data_set_loc')\nself.data_extractor = DataExtractor(self.data_set_loc)\nactor_actor_matrix_obj.fetchActorActorSimilarityMatrix()",
"actor_movie_table = self.data_extractor.get_movie_actor_data()\nmovieid = util.get_movie_id(movie... | <|body_start_0|>
super().__init__()
self.data_set_loc = conf.config_section_mapper('filePath').get('data_set_loc')
self.data_extractor = DataExtractor(self.data_set_loc)
actor_actor_matrix_obj.fetchActorActorSimilarityMatrix()
<|end_body_0|>
<|body_start_1|>
actor_movie_table = ... | SimilarActorsFromDiffMovies | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SimilarActorsFromDiffMovies:
def __init__(self):
"""Initialiazing the data extractor object to get data from the csv files"""
<|body_0|>
def get_actors_of_movie(self, moviename):
"""Function to return the actors of a given movie :param moviename: :return: list(actori... | stack_v2_sparse_classes_10k_train_008766 | 13,912 | no_license | [
{
"docstring": "Initialiazing the data extractor object to get data from the csv files",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Function to return the actors of a given movie :param moviename: :return: list(actorids)",
"name": "get_actors_of_movie",
"sig... | 5 | stack_v2_sparse_classes_30k_train_003971 | Implement the Python class `SimilarActorsFromDiffMovies` described below.
Class description:
Implement the SimilarActorsFromDiffMovies class.
Method signatures and docstrings:
- def __init__(self): Initialiazing the data extractor object to get data from the csv files
- def get_actors_of_movie(self, moviename): Funct... | Implement the Python class `SimilarActorsFromDiffMovies` described below.
Class description:
Implement the SimilarActorsFromDiffMovies class.
Method signatures and docstrings:
- def __init__(self): Initialiazing the data extractor object to get data from the csv files
- def get_actors_of_movie(self, moviename): Funct... | 58c4e8fe6674a03d470b3dcada9255f137cbbf0c | <|skeleton|>
class SimilarActorsFromDiffMovies:
def __init__(self):
"""Initialiazing the data extractor object to get data from the csv files"""
<|body_0|>
def get_actors_of_movie(self, moviename):
"""Function to return the actors of a given movie :param moviename: :return: list(actori... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SimilarActorsFromDiffMovies:
def __init__(self):
"""Initialiazing the data extractor object to get data from the csv files"""
super().__init__()
self.data_set_loc = conf.config_section_mapper('filePath').get('data_set_loc')
self.data_extractor = DataExtractor(self.data_set_loc)... | the_stack_v2_python_sparse | phase_2/scripts/phase_2_task_1d.py | abhijithshreesh/MovieRecommenderSystem | train | 0 | |
42410afe32690036d5cf0124bf2b888b150031b9 | [
"auth = secrets.token_hex(64)\nself.server = ServerThread(source=source, auth=auth, bundlesize=bundlesize, bundlewait=bundlewait, in_memory=in_memory, no_confirm=no_confirm, max_retries=max_retries, eager=eager, address=bind, forever_mode=forever_mode, restart_mode=restart_mode, redirect_failures=redirect_failures)... | <|body_start_0|>
auth = secrets.token_hex(64)
self.server = ServerThread(source=source, auth=auth, bundlesize=bundlesize, bundlewait=bundlewait, in_memory=in_memory, no_confirm=no_confirm, max_retries=max_retries, eager=eager, address=bind, forever_mode=forever_mode, restart_mode=restart_mode, redirect_... | Run server with remote clients via external launcher (e.g., MPI). | RemoteCluster | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RemoteCluster:
"""Run server with remote clients via external launcher (e.g., MPI)."""
def __init__(self: RemoteCluster, source: Iterable[str]=None, num_tasks: int=1, template: str=DEFAULT_TEMPLATE, bundlesize: int=DEFAULT_BUNDLESIZE, bundlewait: int=DEFAULT_BUNDLEWAIT, forever_mode: bool=Fa... | stack_v2_sparse_classes_10k_train_008767 | 18,159 | permissive | [
{
"docstring": "Initialize server and client threads with external launcher.",
"name": "__init__",
"signature": "def __init__(self: RemoteCluster, source: Iterable[str]=None, num_tasks: int=1, template: str=DEFAULT_TEMPLATE, bundlesize: int=DEFAULT_BUNDLESIZE, bundlewait: int=DEFAULT_BUNDLEWAIT, forever... | 3 | stack_v2_sparse_classes_30k_test_000260 | Implement the Python class `RemoteCluster` described below.
Class description:
Run server with remote clients via external launcher (e.g., MPI).
Method signatures and docstrings:
- def __init__(self: RemoteCluster, source: Iterable[str]=None, num_tasks: int=1, template: str=DEFAULT_TEMPLATE, bundlesize: int=DEFAULT_B... | Implement the Python class `RemoteCluster` described below.
Class description:
Run server with remote clients via external launcher (e.g., MPI).
Method signatures and docstrings:
- def __init__(self: RemoteCluster, source: Iterable[str]=None, num_tasks: int=1, template: str=DEFAULT_TEMPLATE, bundlesize: int=DEFAULT_B... | e142376249e0fe3de624790600f3c5e99022e047 | <|skeleton|>
class RemoteCluster:
"""Run server with remote clients via external launcher (e.g., MPI)."""
def __init__(self: RemoteCluster, source: Iterable[str]=None, num_tasks: int=1, template: str=DEFAULT_TEMPLATE, bundlesize: int=DEFAULT_BUNDLESIZE, bundlewait: int=DEFAULT_BUNDLEWAIT, forever_mode: bool=Fa... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RemoteCluster:
"""Run server with remote clients via external launcher (e.g., MPI)."""
def __init__(self: RemoteCluster, source: Iterable[str]=None, num_tasks: int=1, template: str=DEFAULT_TEMPLATE, bundlesize: int=DEFAULT_BUNDLESIZE, bundlewait: int=DEFAULT_BUNDLEWAIT, forever_mode: bool=False, restart_... | the_stack_v2_python_sparse | src/hypershell/cluster/remote.py | glentner/hyper-shell | train | 20 |
625a75bdb1290636b856394fe67b01093b214843 | [
"s = db.session()\ntry:\n result = Folder.query.filter(or_(and_(Folder.is_sys == True, Folder.pid == pid), and_(Folder.is_sys == False, Folder.pid == pid, Folder.admin_id == admin_id))).order_by(Folder.id).all()\n return [value.to_json() for value in result]\nexcept Exception as e:\n print(e)\n return s... | <|body_start_0|>
s = db.session()
try:
result = Folder.query.filter(or_(and_(Folder.is_sys == True, Folder.pid == pid), and_(Folder.is_sys == False, Folder.pid == pid, Folder.admin_id == admin_id))).order_by(Folder.id).all()
return [value.to_json() for value in result]
ex... | FolderModel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FolderModel:
def QueryFolderByParamRequest(self, pid, admin_id):
"""文件夹列表"""
<|body_0|>
def CreateFolderRequest(self, params):
"""新建文件夹"""
<|body_1|>
def ModifyFolderRequest(self, folder_id, params):
"""修改文件夹"""
<|body_2|>
def DelFol... | stack_v2_sparse_classes_10k_train_008768 | 2,905 | permissive | [
{
"docstring": "文件夹列表",
"name": "QueryFolderByParamRequest",
"signature": "def QueryFolderByParamRequest(self, pid, admin_id)"
},
{
"docstring": "新建文件夹",
"name": "CreateFolderRequest",
"signature": "def CreateFolderRequest(self, params)"
},
{
"docstring": "修改文件夹",
"name": "Mo... | 4 | stack_v2_sparse_classes_30k_train_004775 | Implement the Python class `FolderModel` described below.
Class description:
Implement the FolderModel class.
Method signatures and docstrings:
- def QueryFolderByParamRequest(self, pid, admin_id): 文件夹列表
- def CreateFolderRequest(self, params): 新建文件夹
- def ModifyFolderRequest(self, folder_id, params): 修改文件夹
- def Del... | Implement the Python class `FolderModel` described below.
Class description:
Implement the FolderModel class.
Method signatures and docstrings:
- def QueryFolderByParamRequest(self, pid, admin_id): 文件夹列表
- def CreateFolderRequest(self, params): 新建文件夹
- def ModifyFolderRequest(self, folder_id, params): 修改文件夹
- def Del... | 62fe4b3e264176bb582a278c81814ed5ec13caec | <|skeleton|>
class FolderModel:
def QueryFolderByParamRequest(self, pid, admin_id):
"""文件夹列表"""
<|body_0|>
def CreateFolderRequest(self, params):
"""新建文件夹"""
<|body_1|>
def ModifyFolderRequest(self, folder_id, params):
"""修改文件夹"""
<|body_2|>
def DelFol... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FolderModel:
def QueryFolderByParamRequest(self, pid, admin_id):
"""文件夹列表"""
s = db.session()
try:
result = Folder.query.filter(or_(and_(Folder.is_sys == True, Folder.pid == pid), and_(Folder.is_sys == False, Folder.pid == pid, Folder.admin_id == admin_id))).order_by(Folder... | the_stack_v2_python_sparse | collection/v1/folder.py | huzidabanzhang/python-admin | train | 32 | |
7518ec57cee1db9011db43c2edee61b1aaee2e03 | [
"super(forms.ModelForm, self).__init__(*args, **kwargs)\nself.helper = FormHelper()\nself.helper.form_tag = False\nself.helper.form_show_errors = True\n\"\\n Create a default 'layout' for this form.\\n Ref: https://django-crispy-forms.readthedocs.io/en/latest/layouts.html\\n This is required to... | <|body_start_0|>
super(forms.ModelForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_tag = False
self.helper.form_show_errors = True
"\n Create a default 'layout' for this form.\n Ref: https://django-crispy-forms.readthedocs.io/en/late... | Provides simple integration of crispy_forms extension. | HelperForm | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HelperForm:
"""Provides simple integration of crispy_forms extension."""
def __init__(self, *args, **kwargs):
"""Setup layout."""
<|body_0|>
def rebuild_layout(self):
"""Build crispy layout out of current fields."""
<|body_1|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_10k_train_008769 | 12,546 | permissive | [
{
"docstring": "Setup layout.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Build crispy layout out of current fields.",
"name": "rebuild_layout",
"signature": "def rebuild_layout(self)"
}
] | 2 | null | Implement the Python class `HelperForm` described below.
Class description:
Provides simple integration of crispy_forms extension.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Setup layout.
- def rebuild_layout(self): Build crispy layout out of current fields. | Implement the Python class `HelperForm` described below.
Class description:
Provides simple integration of crispy_forms extension.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Setup layout.
- def rebuild_layout(self): Build crispy layout out of current fields.
<|skeleton|>
class HelperFor... | e88a8e99a5f0b201c67a95cba097c729f090d5e2 | <|skeleton|>
class HelperForm:
"""Provides simple integration of crispy_forms extension."""
def __init__(self, *args, **kwargs):
"""Setup layout."""
<|body_0|>
def rebuild_layout(self):
"""Build crispy layout out of current fields."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HelperForm:
"""Provides simple integration of crispy_forms extension."""
def __init__(self, *args, **kwargs):
"""Setup layout."""
super(forms.ModelForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_tag = False
self.helper.form_show_er... | the_stack_v2_python_sparse | InvenTree/InvenTree/forms.py | inventree/InvenTree | train | 3,077 |
c1b32fd250783a2cda82b25462eec237db32e35e | [
"self.name = name\nself.defaults_field = defaults_field\nself.set_defaults(defaults)",
"if isinstance(defaults, dict):\n self._defaults = defaults\nelif isinstance(defaults, str):\n self._defaults = None\n self._defaults_location = defaults\nelse:\n ty = type(self).__qualname__\n raise TypeError(f'... | <|body_start_0|>
self.name = name
self.defaults_field = defaults_field
self.set_defaults(defaults)
<|end_body_0|>
<|body_start_1|>
if isinstance(defaults, dict):
self._defaults = defaults
elif isinstance(defaults, str):
self._defaults = None
s... | Object that can return a defaults dictionary. The defaults can be given as a dictionary or as a path to a module. | HasDefaults | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HasDefaults:
"""Object that can return a defaults dictionary. The defaults can be given as a dictionary or as a path to a module."""
def __init__(self, name, defaults, defaults_field):
"""Initialize a HasDefaults."""
<|body_0|>
def set_defaults(self, defaults):
"... | stack_v2_sparse_classes_10k_train_008770 | 15,608 | permissive | [
{
"docstring": "Initialize a HasDefaults.",
"name": "__init__",
"signature": "def __init__(self, name, defaults, defaults_field)"
},
{
"docstring": "Set the defaults.",
"name": "set_defaults",
"signature": "def set_defaults(self, defaults)"
},
{
"docstring": "Return defaults for ... | 3 | null | Implement the Python class `HasDefaults` described below.
Class description:
Object that can return a defaults dictionary. The defaults can be given as a dictionary or as a path to a module.
Method signatures and docstrings:
- def __init__(self, name, defaults, defaults_field): Initialize a HasDefaults.
- def set_def... | Implement the Python class `HasDefaults` described below.
Class description:
Object that can return a defaults dictionary. The defaults can be given as a dictionary or as a path to a module.
Method signatures and docstrings:
- def __init__(self, name, defaults, defaults_field): Initialize a HasDefaults.
- def set_def... | d7b12c15453079e1a2c4fdae611c5f741574363d | <|skeleton|>
class HasDefaults:
"""Object that can return a defaults dictionary. The defaults can be given as a dictionary or as a path to a module."""
def __init__(self, name, defaults, defaults_field):
"""Initialize a HasDefaults."""
<|body_0|>
def set_defaults(self, defaults):
"... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HasDefaults:
"""Object that can return a defaults dictionary. The defaults can be given as a dictionary or as a path to a module."""
def __init__(self, name, defaults, defaults_field):
"""Initialize a HasDefaults."""
self.name = name
self.defaults_field = defaults_field
se... | the_stack_v2_python_sparse | myia/utils/misc.py | breuleux/myia | train | 1 |
0c035d19991b348c7c10d98530763afb4cba642d | [
"self.encap = encap\nself.unidir_mode = unidir_mode\nself.mtu = mtu\nself.rx_bandwidth = rx_bandwidth\nself.tx_bandwidth = tx_bandwidth\nself.snmp_index = snmp_index\nself.islayer2 = islayer2\nself.display_name = display_name\nself.mac_address = mac_address\nself.description = description\nself.iphelper = []\nself.... | <|body_start_0|>
self.encap = encap
self.unidir_mode = unidir_mode
self.mtu = mtu
self.rx_bandwidth = rx_bandwidth
self.tx_bandwidth = tx_bandwidth
self.snmp_index = snmp_index
self.islayer2 = islayer2
self.display_name = display_name
self.mac_addr... | This class represents the configuration (software property) of the network interface. The configuration might be changed during the life of the session. Hence, it is refreshed if the last accessed time has aged out. @ivar islayer2: Indicates if this a Layer-2 Interface @type islayer2: C{bool} @ivar display_name: The na... | InterfaceConfig | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InterfaceConfig:
"""This class represents the configuration (software property) of the network interface. The configuration might be changed during the life of the session. Hence, it is refreshed if the last accessed time has aged out. @ivar islayer2: Indicates if this a Layer-2 Interface @type i... | stack_v2_sparse_classes_10k_train_008771 | 10,222 | no_license | [
{
"docstring": "Constructor of InterfaceConfig class.",
"name": "__init__",
"signature": "def __init__(self, encap, unidir_mode, mtu, rx_bandwidth, tx_bandwidth, snmp_index, islayer2, display_name, mac_address, description, ip_redirect, ip_unreachable, ip_proxy_arp, ip_unicast_reverse_path, vrf, speed=N... | 2 | stack_v2_sparse_classes_30k_train_002910 | Implement the Python class `InterfaceConfig` described below.
Class description:
This class represents the configuration (software property) of the network interface. The configuration might be changed during the life of the session. Hence, it is refreshed if the last accessed time has aged out. @ivar islayer2: Indica... | Implement the Python class `InterfaceConfig` described below.
Class description:
This class represents the configuration (software property) of the network interface. The configuration might be changed during the life of the session. Hence, it is refreshed if the last accessed time has aged out. @ivar islayer2: Indica... | 54bc49eaed14f7832aca45c4f52311a00282d862 | <|skeleton|>
class InterfaceConfig:
"""This class represents the configuration (software property) of the network interface. The configuration might be changed during the life of the session. Hence, it is refreshed if the last accessed time has aged out. @ivar islayer2: Indicates if this a Layer-2 Interface @type i... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class InterfaceConfig:
"""This class represents the configuration (software property) of the network interface. The configuration might be changed during the life of the session. Hence, it is refreshed if the last accessed time has aged out. @ivar islayer2: Indicates if this a Layer-2 Interface @type islayer2: C{bo... | the_stack_v2_python_sparse | onepk_without_pyc/build/lib.linux-x86_64-2.7/onep/interfaces/InterfaceConfig.py | neoyogi/onepk | train | 0 |
c06d014a3bc9f9f22a071586b781764169f178e6 | [
"if not isinstance(permission, Permissions):\n try:\n permission = Permissions(permission)\n except ValueError:\n msg = \"Invalid `permission` value. Available values are: 'View', 'Modify', 'Full Control', 'Denied All', 'Default All'. See: Permissions enum.\"\n exception_handler(msg)\nrig... | <|body_start_0|>
if not isinstance(permission, Permissions):
try:
permission = Permissions(permission)
except ValueError:
msg = "Invalid `permission` value. Available values are: 'View', 'Modify', 'Full Control', 'Denied All', 'Default All'. See: Permissio... | TrusteeACLMixin class adds ACL management for Trustee classes. Objects currently supporting this Mixin are: (`User` and `UserGroup`). | TrusteeACLMixin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TrusteeACLMixin:
"""TrusteeACLMixin class adds ACL management for Trustee classes. Objects currently supporting this Mixin are: (`User` and `UserGroup`)."""
def set_permission(self, permission: Permissions | str, to_objects: str | list[str], object_type: 'ObjectTypes | int', project: 'Option... | stack_v2_sparse_classes_10k_train_008772 | 28,085 | permissive | [
{
"docstring": "Set permission to perform actions on given object(s). Function is used to set permission of the trustee to perform given actions on the provided objects. Within one execution of the function permission will be set in the same manner for each of the provided objects. The only available values of ... | 2 | null | Implement the Python class `TrusteeACLMixin` described below.
Class description:
TrusteeACLMixin class adds ACL management for Trustee classes. Objects currently supporting this Mixin are: (`User` and `UserGroup`).
Method signatures and docstrings:
- def set_permission(self, permission: Permissions | str, to_objects:... | Implement the Python class `TrusteeACLMixin` described below.
Class description:
TrusteeACLMixin class adds ACL management for Trustee classes. Objects currently supporting this Mixin are: (`User` and `UserGroup`).
Method signatures and docstrings:
- def set_permission(self, permission: Permissions | str, to_objects:... | c6cea33b15bcd876ded4de25138b3f5e5165cd6d | <|skeleton|>
class TrusteeACLMixin:
"""TrusteeACLMixin class adds ACL management for Trustee classes. Objects currently supporting this Mixin are: (`User` and `UserGroup`)."""
def set_permission(self, permission: Permissions | str, to_objects: str | list[str], object_type: 'ObjectTypes | int', project: 'Option... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TrusteeACLMixin:
"""TrusteeACLMixin class adds ACL management for Trustee classes. Objects currently supporting this Mixin are: (`User` and `UserGroup`)."""
def set_permission(self, permission: Permissions | str, to_objects: str | list[str], object_type: 'ObjectTypes | int', project: 'Optional[Project | ... | the_stack_v2_python_sparse | mstrio/utils/acl.py | MicroStrategy/mstrio-py | train | 84 |
116ec06fd21aaaa595de1903ead6f7a9c47301f4 | [
"super(PyMongoEvent, self).__init__(start_time)\nself.resource['operation'] = getattr(wrapped, '__name__')\nself.event_id = 'mongo-{}'.format(str(uuid4()))\nself.resource['name'] = instance.name\naddress = list(getattr(instance.database.client, '_topology_settings').seeds)[0]\nself.resource['metadata'] = {'DB URL':... | <|body_start_0|>
super(PyMongoEvent, self).__init__(start_time)
self.resource['operation'] = getattr(wrapped, '__name__')
self.event_id = 'mongo-{}'.format(str(uuid4()))
self.resource['name'] = instance.name
address = list(getattr(instance.database.client, '_topology_settings').s... | Represents base pymongo event. | PyMongoEvent | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PyMongoEvent:
"""Represents base pymongo event."""
def __init__(self, wrapped, instance, args, kwargs, start_time, response, exception):
"""Initialize. :param wrapped: wrapt's wrapped :param instance: wrapt's instance :param args: wrapt's args :param kwargs: wrapt's kwargs :param sta... | stack_v2_sparse_classes_10k_train_008773 | 5,231 | permissive | [
{
"docstring": "Initialize. :param wrapped: wrapt's wrapped :param instance: wrapt's instance :param args: wrapt's args :param kwargs: wrapt's kwargs :param start_time: Start timestamp (epoch) :param response: response data :param exception: Exception (if happened)",
"name": "__init__",
"signature": "de... | 5 | stack_v2_sparse_classes_30k_test_000064 | Implement the Python class `PyMongoEvent` described below.
Class description:
Represents base pymongo event.
Method signatures and docstrings:
- def __init__(self, wrapped, instance, args, kwargs, start_time, response, exception): Initialize. :param wrapped: wrapt's wrapped :param instance: wrapt's instance :param ar... | Implement the Python class `PyMongoEvent` described below.
Class description:
Represents base pymongo event.
Method signatures and docstrings:
- def __init__(self, wrapped, instance, args, kwargs, start_time, response, exception): Initialize. :param wrapped: wrapt's wrapped :param instance: wrapt's instance :param ar... | 91e28fe43bc4f42152fb156145088cb8c9f69b85 | <|skeleton|>
class PyMongoEvent:
"""Represents base pymongo event."""
def __init__(self, wrapped, instance, args, kwargs, start_time, response, exception):
"""Initialize. :param wrapped: wrapt's wrapped :param instance: wrapt's instance :param args: wrapt's args :param kwargs: wrapt's kwargs :param sta... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PyMongoEvent:
"""Represents base pymongo event."""
def __init__(self, wrapped, instance, args, kwargs, start_time, response, exception):
"""Initialize. :param wrapped: wrapt's wrapped :param instance: wrapt's instance :param args: wrapt's args :param kwargs: wrapt's kwargs :param start_time: Star... | the_stack_v2_python_sparse | epsagon/events/pymongo.py | epsagon/epsagon-python | train | 57 |
9084a2d3826675a055b2cc24306d5c2061e26cc3 | [
"super(Tar, self).__init__()\nself.dry_run = dry_run\nself.verbose = verbose",
"path = os.path.dirname(file_path)\nif path == '':\n path = '.'\nfolder_name = os.path.basename(file_path)\ntar_filename = '%s.tar.gz' % folder_name\ntar_filename = os.path.join(path, tar_filename)\nextra_tar_options = ''\nif self.v... | <|body_start_0|>
super(Tar, self).__init__()
self.dry_run = dry_run
self.verbose = verbose
<|end_body_0|>
<|body_start_1|>
path = os.path.dirname(file_path)
if path == '':
path = '.'
folder_name = os.path.basename(file_path)
tar_filename = '%s.tar.gz'... | Tar Class. | Tar | [
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Tar:
"""Tar Class."""
def __init__(self, dry_run=False, verbose=False):
"""Init."""
<|body_0|>
def create(self, file_path):
"""Create TAR file."""
<|body_1|>
def extract(self, file_path):
"""Extract TAR file."""
<|body_2|>
<|end_skel... | stack_v2_sparse_classes_10k_train_008774 | 1,535 | permissive | [
{
"docstring": "Init.",
"name": "__init__",
"signature": "def __init__(self, dry_run=False, verbose=False)"
},
{
"docstring": "Create TAR file.",
"name": "create",
"signature": "def create(self, file_path)"
},
{
"docstring": "Extract TAR file.",
"name": "extract",
"signat... | 3 | stack_v2_sparse_classes_30k_train_003290 | Implement the Python class `Tar` described below.
Class description:
Tar Class.
Method signatures and docstrings:
- def __init__(self, dry_run=False, verbose=False): Init.
- def create(self, file_path): Create TAR file.
- def extract(self, file_path): Extract TAR file. | Implement the Python class `Tar` described below.
Class description:
Tar Class.
Method signatures and docstrings:
- def __init__(self, dry_run=False, verbose=False): Init.
- def create(self, file_path): Create TAR file.
- def extract(self, file_path): Extract TAR file.
<|skeleton|>
class Tar:
"""Tar Class."""
... | 19ab8b09985d8c19f235feea348e3a2b0dae890a | <|skeleton|>
class Tar:
"""Tar Class."""
def __init__(self, dry_run=False, verbose=False):
"""Init."""
<|body_0|>
def create(self, file_path):
"""Create TAR file."""
<|body_1|>
def extract(self, file_path):
"""Extract TAR file."""
<|body_2|>
<|end_skel... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Tar:
"""Tar Class."""
def __init__(self, dry_run=False, verbose=False):
"""Init."""
super(Tar, self).__init__()
self.dry_run = dry_run
self.verbose = verbose
def create(self, file_path):
"""Create TAR file."""
path = os.path.dirname(file_path)
... | the_stack_v2_python_sparse | gerrit_backup_tool/tar/Tar.py | ZhangYaxu/gerrit_backup_tool | train | 0 |
0597a2d0a0628f71426bdb55db6f9bd717e65c30 | [
"if not (filename is None) ^ (maskobject is None):\n raise ValueError('You have to provide either a file name or a Mask object')\nelif not maskobject is None:\n if not isinstance(maskobject, Mask):\n raise ValueError('maskobject must be an instance of Mask')\n base_mask = maskobject.mask\n self._... | <|body_start_0|>
if not (filename is None) ^ (maskobject is None):
raise ValueError('You have to provide either a file name or a Mask object')
elif not maskobject is None:
if not isinstance(maskobject, Mask):
raise ValueError('maskobject must be an instance of Mas... | Defines a submask starting from a ComposedBasin object and a NetCDF file or a Mask object | ComposedSubMask | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ComposedSubMask:
"""Defines a submask starting from a ComposedBasin object and a NetCDF file or a Mask object"""
def __init__(self, basin, filename=None, maskobject=None, maskvarname='tmask', zlevelsvar='nav_lev', ylevelsmatvar='nav_lat', xlevelsmatvar='nav_lon', dzvarname='e3t'):
""... | stack_v2_sparse_classes_10k_train_008775 | 4,524 | no_license | [
{
"docstring": "ComposedSubMask constructor Args: - *basin*: a ComposedBasin object. - *filename*: the path to a NetCDF file. - *maskobject*: a Mask object. Caveats: - *filename* and *maskobject* are mutually exclusive.",
"name": "__init__",
"signature": "def __init__(self, basin, filename=None, maskobj... | 2 | null | Implement the Python class `ComposedSubMask` described below.
Class description:
Defines a submask starting from a ComposedBasin object and a NetCDF file or a Mask object
Method signatures and docstrings:
- def __init__(self, basin, filename=None, maskobject=None, maskvarname='tmask', zlevelsvar='nav_lev', ylevelsmat... | Implement the Python class `ComposedSubMask` described below.
Class description:
Defines a submask starting from a ComposedBasin object and a NetCDF file or a Mask object
Method signatures and docstrings:
- def __init__(self, basin, filename=None, maskobject=None, maskvarname='tmask', zlevelsvar='nav_lev', ylevelsmat... | 985f34c2214ea55cd4d324704847d5a0d2a9de1e | <|skeleton|>
class ComposedSubMask:
"""Defines a submask starting from a ComposedBasin object and a NetCDF file or a Mask object"""
def __init__(self, basin, filename=None, maskobject=None, maskvarname='tmask', zlevelsvar='nav_lev', ylevelsmatvar='nav_lat', xlevelsmatvar='nav_lon', dzvarname='e3t'):
""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ComposedSubMask:
"""Defines a submask starting from a ComposedBasin object and a NetCDF file or a Mask object"""
def __init__(self, basin, filename=None, maskobject=None, maskvarname='tmask', zlevelsvar='nav_lev', ylevelsmatvar='nav_lat', xlevelsmatvar='nav_lon', dzvarname='e3t'):
"""ComposedSubM... | the_stack_v2_python_sparse | commons/composedsubmask.py | inogs/bit.sea | train | 4 |
f5a96a4aa95f78f534e578d094ca6e942af5505c | [
"super(Conformer, self).__init__()\nself.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')\nself.ff_module1 = Residual(module=FFModule(d_model=d_model, h_size=ff1_hsize, dropout=ff1_dropout), half=True)\nself.mha_module = Residual(module=MHAModule(d_model=d_model, n_head=n_head, dropout=mha_drop... | <|body_start_0|>
super(Conformer, self).__init__()
self.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
self.ff_module1 = Residual(module=FFModule(d_model=d_model, h_size=ff1_hsize, dropout=ff1_dropout), half=True)
self.mha_module = Residual(module=MHAModule(d_model... | Conformer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Conformer:
def __init__(self, d_model, ff1_hsize=1024, ff1_dropout=0.2, n_head=4, mha_dropout=0.2, kernel_size=3, conv_dropout=0.2, ff2_hsize=1024, ff2_dropout=0.2):
"""RNN enhanced Transformer Block. Args: d_model (int): Embedded dimension of input. ff1_hsize (int): Hidden size of th fi... | stack_v2_sparse_classes_10k_train_008776 | 2,577 | permissive | [
{
"docstring": "RNN enhanced Transformer Block. Args: d_model (int): Embedded dimension of input. ff1_hsize (int): Hidden size of th first FFN ff1_drop (float): Dropout rate for the first FFN n_head (int): Number of heads for MHA mha_dropout (float): Dropout rate for the first MHA epsilon (float): Epsilon kerne... | 2 | stack_v2_sparse_classes_30k_train_004922 | Implement the Python class `Conformer` described below.
Class description:
Implement the Conformer class.
Method signatures and docstrings:
- def __init__(self, d_model, ff1_hsize=1024, ff1_dropout=0.2, n_head=4, mha_dropout=0.2, kernel_size=3, conv_dropout=0.2, ff2_hsize=1024, ff2_dropout=0.2): RNN enhanced Transfor... | Implement the Python class `Conformer` described below.
Class description:
Implement the Conformer class.
Method signatures and docstrings:
- def __init__(self, d_model, ff1_hsize=1024, ff1_dropout=0.2, n_head=4, mha_dropout=0.2, kernel_size=3, conv_dropout=0.2, ff2_hsize=1024, ff2_dropout=0.2): RNN enhanced Transfor... | bc599a352401a7e135ebaabead4d8e6d8835747e | <|skeleton|>
class Conformer:
def __init__(self, d_model, ff1_hsize=1024, ff1_dropout=0.2, n_head=4, mha_dropout=0.2, kernel_size=3, conv_dropout=0.2, ff2_hsize=1024, ff2_dropout=0.2):
"""RNN enhanced Transformer Block. Args: d_model (int): Embedded dimension of input. ff1_hsize (int): Hidden size of th fi... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Conformer:
def __init__(self, d_model, ff1_hsize=1024, ff1_dropout=0.2, n_head=4, mha_dropout=0.2, kernel_size=3, conv_dropout=0.2, ff2_hsize=1024, ff2_dropout=0.2):
"""RNN enhanced Transformer Block. Args: d_model (int): Embedded dimension of input. ff1_hsize (int): Hidden size of th first FFN ff1_dr... | the_stack_v2_python_sparse | Sensation6/Conformer/CF.py | Geson-anko/JARVIS3 | train | 1 | |
ccdef9faaa1dcc269a110be1e7b50769f4ad1e98 | [
"if target.platform.name == 'android':\n message_handler.warning('using Windows to host Android deployment is untested')\n return True\nreturn super().supported_target(target, message_handler)",
"vs_version = os.environ.get('VisualStudioVersion', '0.0')\nvs_major = vs_version.split('.')[0]\nif vs_major == '... | <|body_start_0|>
if target.platform.name == 'android':
message_handler.warning('using Windows to host Android deployment is untested')
return True
return super().supported_target(target, message_handler)
<|end_body_0|>
<|body_start_1|>
vs_version = os.environ.get('Visual... | Encapsulate any Windows x86 architecture. | WindowsArchitecture | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WindowsArchitecture:
"""Encapsulate any Windows x86 architecture."""
def supported_target(self, target, message_handler):
"""Check that this architecture can host a target architecture."""
<|body_0|>
def msvc_target(optional=False):
"""Return '32' or 64' dependin... | stack_v2_sparse_classes_10k_train_008777 | 23,766 | permissive | [
{
"docstring": "Check that this architecture can host a target architecture.",
"name": "supported_target",
"signature": "def supported_target(self, target, message_handler)"
},
{
"docstring": "Return '32' or 64' depending the architecture being targeted by MSVC and raise an exception if a suppor... | 2 | stack_v2_sparse_classes_30k_train_002230 | Implement the Python class `WindowsArchitecture` described below.
Class description:
Encapsulate any Windows x86 architecture.
Method signatures and docstrings:
- def supported_target(self, target, message_handler): Check that this architecture can host a target architecture.
- def msvc_target(optional=False): Return... | Implement the Python class `WindowsArchitecture` described below.
Class description:
Encapsulate any Windows x86 architecture.
Method signatures and docstrings:
- def supported_target(self, target, message_handler): Check that this architecture can host a target architecture.
- def msvc_target(optional=False): Return... | 4ed2b1b9a2407afcbffdf304020d42b81c4c8cdc | <|skeleton|>
class WindowsArchitecture:
"""Encapsulate any Windows x86 architecture."""
def supported_target(self, target, message_handler):
"""Check that this architecture can host a target architecture."""
<|body_0|>
def msvc_target(optional=False):
"""Return '32' or 64' dependin... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WindowsArchitecture:
"""Encapsulate any Windows x86 architecture."""
def supported_target(self, target, message_handler):
"""Check that this architecture can host a target architecture."""
if target.platform.name == 'android':
message_handler.warning('using Windows to host And... | the_stack_v2_python_sparse | note/demo/pyqt_demo/pyqtdeploy-3.3.0/pyqtdeploy/platforms.py | onsunsl/onsunsl.github.io | train | 1 |
a7b47a5a44788ad09de86c3227d85f8ec52e2ce8 | [
"if value:\n if not self.multivalued:\n value = [value]\n value = [v for v in value if v]\n input_value = ','.join((force_str(v) for v in value))\n existing_users = User.objects.filter(pk__in=value).order_by('first_name', 'last_name', 'username')\nelse:\n input_value = None\n existing_users... | <|body_start_0|>
if value:
if not self.multivalued:
value = [value]
value = [v for v in value if v]
input_value = ','.join((force_str(v) for v in value))
existing_users = User.objects.filter(pk__in=value).order_by('first_name', 'last_name', 'userna... | A form widget to allow people to select one or more User relations. It's not unheard of to have a server with thousands or tens of thousands of registered users. In this case, the existing Django admin widgets fall down hard. The filtered select widgets can actually crash the webserver due to trying to pre-populate an ... | RelatedUserWidget | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RelatedUserWidget:
"""A form widget to allow people to select one or more User relations. It's not unheard of to have a server with thousands or tens of thousands of registered users. In this case, the existing Django admin widgets fall down hard. The filtered select widgets can actually crash th... | stack_v2_sparse_classes_10k_train_008778 | 16,804 | permissive | [
{
"docstring": "Render the widget. Args: name (unicode): The name of the field. value (list): The current value of the field. attrs (dict, optional): Attributes for the HTML element. renderer (django.forms.renderers.BaseRenderer, optional): The form renderer. Returns: django.utils.safestring.SafeText: The rende... | 2 | null | Implement the Python class `RelatedUserWidget` described below.
Class description:
A form widget to allow people to select one or more User relations. It's not unheard of to have a server with thousands or tens of thousands of registered users. In this case, the existing Django admin widgets fall down hard. The filter... | Implement the Python class `RelatedUserWidget` described below.
Class description:
A form widget to allow people to select one or more User relations. It's not unheard of to have a server with thousands or tens of thousands of registered users. In this case, the existing Django admin widgets fall down hard. The filter... | c3a991f1e9d7682239a1ab0e8661cee6da01d537 | <|skeleton|>
class RelatedUserWidget:
"""A form widget to allow people to select one or more User relations. It's not unheard of to have a server with thousands or tens of thousands of registered users. In this case, the existing Django admin widgets fall down hard. The filtered select widgets can actually crash th... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RelatedUserWidget:
"""A form widget to allow people to select one or more User relations. It's not unheard of to have a server with thousands or tens of thousands of registered users. In this case, the existing Django admin widgets fall down hard. The filtered select widgets can actually crash the webserver d... | the_stack_v2_python_sparse | reviewboard/admin/form_widgets.py | reviewboard/reviewboard | train | 1,141 |
4275d3fd05bd9a4a5266bf84d183a1b1426a5e64 | [
"m = len(board)\nif not m:\n return\nn = len(board[0])\nif not n:\n return\ni, j = (0, 0)\nwhile i < m:\n self.check_using_queue(i, 0, board, m, n)\n if n > 1:\n self.check_using_queue(i, n - 1, board, m, n)\n i += 1\nwhile j < n:\n self.check_using_queue(0, j, board, m, n)\n if m > 1:\n... | <|body_start_0|>
m = len(board)
if not m:
return
n = len(board[0])
if not n:
return
i, j = (0, 0)
while i < m:
self.check_using_queue(i, 0, board, m, n)
if n > 1:
self.check_using_queue(i, n - 1, board, m, n)... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def solve(self, board: list) -> None:
"""Using DFS(Recursive traversal). Traverse all the node recursively on the boarder of the board. If the node value is 'O', change all the node within the same region to 'S'. And then change the other node to X. At last change 'S' node back... | stack_v2_sparse_classes_10k_train_008779 | 4,167 | no_license | [
{
"docstring": "Using DFS(Recursive traversal). Traverse all the node recursively on the boarder of the board. If the node value is 'O', change all the node within the same region to 'S'. And then change the other node to X. At last change 'S' node back to 'O'. Args: board: list(list(str)), like GO chessboard. ... | 3 | stack_v2_sparse_classes_30k_train_005484 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def solve(self, board: list) -> None: Using DFS(Recursive traversal). Traverse all the node recursively on the boarder of the board. If the node value is 'O', change all the node... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def solve(self, board: list) -> None: Using DFS(Recursive traversal). Traverse all the node recursively on the boarder of the board. If the node value is 'O', change all the node... | ecbb8fb7f96f644c16dbb0cf7ffb69bc959a5647 | <|skeleton|>
class Solution:
def solve(self, board: list) -> None:
"""Using DFS(Recursive traversal). Traverse all the node recursively on the boarder of the board. If the node value is 'O', change all the node within the same region to 'S'. And then change the other node to X. At last change 'S' node back... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def solve(self, board: list) -> None:
"""Using DFS(Recursive traversal). Traverse all the node recursively on the boarder of the board. If the node value is 'O', change all the node within the same region to 'S'. And then change the other node to X. At last change 'S' node back to 'O'. Args:... | the_stack_v2_python_sparse | source_code/LC130_SurroundedRegions.py | CircleZ3791117/CodingPractice | train | 14 | |
6c905590b4d8407d9a4e1e333c1457eb2a8676df | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn RetentionEvent()",
"from ..entity import Entity\nfrom ..identity_set import IdentitySet\nfrom .event_propagation_result import EventPropagationResult\nfrom .event_query import EventQuery\nfrom .retention_event_status import RetentionEv... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return RetentionEvent()
<|end_body_0|>
<|body_start_1|>
from ..entity import Entity
from ..identity_set import IdentitySet
from .event_propagation_result import EventPropagationResult
... | RetentionEvent | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RetentionEvent:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RetentionEvent:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Retur... | stack_v2_sparse_classes_10k_train_008780 | 6,338 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: RetentionEvent",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_valu... | 3 | stack_v2_sparse_classes_30k_train_007212 | Implement the Python class `RetentionEvent` described below.
Class description:
Implement the RetentionEvent class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RetentionEvent: Creates a new instance of the appropriate class based on discriminator va... | Implement the Python class `RetentionEvent` described below.
Class description:
Implement the RetentionEvent class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RetentionEvent: Creates a new instance of the appropriate class based on discriminator va... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class RetentionEvent:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RetentionEvent:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Retur... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RetentionEvent:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RetentionEvent:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: RetentionE... | the_stack_v2_python_sparse | msgraph/generated/models/security/retention_event.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
e5c30d3d3267b12d93f05eca73199e4c4f578492 | [
"import pycbf\nself.cbf_handle = pycbf.cbf_handle_struct()\nself.cbf_handle.read_file(filename, pycbf.MSG_DIGEST)\nself.cbf_handle.rewind_datablock()",
"from scitbx.array_family import flex\nself.cbf_handle.select_datablock(0)\nself.cbf_handle.select_category(0)\nself.cbf_handle.select_column(2)\nself.cbf_handle.... | <|body_start_0|>
import pycbf
self.cbf_handle = pycbf.cbf_handle_struct()
self.cbf_handle.read_file(filename, pycbf.MSG_DIGEST)
self.cbf_handle.rewind_datablock()
<|end_body_0|>
<|body_start_1|>
from scitbx.array_family import flex
self.cbf_handle.select_datablock(0)
... | A class to read the CBF files used in DIALS | reader | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class reader:
"""A class to read the CBF files used in DIALS"""
def read_file(self, filename):
"""Read the CBF file"""
<|body_0|>
def get_data(self):
"""Get the gain array from the file"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
import pycbf
... | stack_v2_sparse_classes_10k_train_008781 | 1,568 | permissive | [
{
"docstring": "Read the CBF file",
"name": "read_file",
"signature": "def read_file(self, filename)"
},
{
"docstring": "Get the gain array from the file",
"name": "get_data",
"signature": "def get_data(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005399 | Implement the Python class `reader` described below.
Class description:
A class to read the CBF files used in DIALS
Method signatures and docstrings:
- def read_file(self, filename): Read the CBF file
- def get_data(self): Get the gain array from the file | Implement the Python class `reader` described below.
Class description:
A class to read the CBF files used in DIALS
Method signatures and docstrings:
- def read_file(self, filename): Read the CBF file
- def get_data(self): Get the gain array from the file
<|skeleton|>
class reader:
"""A class to read the CBF fil... | 88bf7f7c5ac44defc046ebf0719cde748092cfff | <|skeleton|>
class reader:
"""A class to read the CBF files used in DIALS"""
def read_file(self, filename):
"""Read the CBF file"""
<|body_0|>
def get_data(self):
"""Get the gain array from the file"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class reader:
"""A class to read the CBF files used in DIALS"""
def read_file(self, filename):
"""Read the CBF file"""
import pycbf
self.cbf_handle = pycbf.cbf_handle_struct()
self.cbf_handle.read_file(filename, pycbf.MSG_DIGEST)
self.cbf_handle.rewind_datablock()
d... | the_stack_v2_python_sparse | src/dials/util/image.py | dials/dials | train | 71 |
dfb17ccb6da5654275bbea5390f638f4d8657628 | [
"self.xslt_style = None\nself.xslt_concat = None\nself.html_resources = None\nself.class_logger.info('CurDir %s.', os.path.abspath(os.curdir))\nself.__config_file = config_file\nif not os.path.isfile(self.__config_file):\n self.class_logger.warning('Config file (%s) for HTML report not found.', self.__config_fil... | <|body_start_0|>
self.xslt_style = None
self.xslt_concat = None
self.html_resources = None
self.class_logger.info('CurDir %s.', os.path.abspath(os.curdir))
self.__config_file = config_file
if not os.path.isfile(self.__config_file):
self.class_logger.warning('C... | Class for generating HTML reports from xml files. | HTMLReport | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HTMLReport:
"""Class for generating HTML reports from xml files."""
def __init__(self, config_file):
"""Initialize HTMLReport class."""
<|body_0|>
def dump_html(self, xmlpath, htmlpath):
"""Create the HTML report from an XML. Args: xmlpath(str): Path to input xml... | stack_v2_sparse_classes_10k_train_008782 | 28,936 | permissive | [
{
"docstring": "Initialize HTMLReport class.",
"name": "__init__",
"signature": "def __init__(self, config_file)"
},
{
"docstring": "Create the HTML report from an XML. Args: xmlpath(str): Path to input xml report htmlpath(str): Path to output html report Returns: None",
"name": "dump_html",... | 2 | null | Implement the Python class `HTMLReport` described below.
Class description:
Class for generating HTML reports from xml files.
Method signatures and docstrings:
- def __init__(self, config_file): Initialize HTMLReport class.
- def dump_html(self, xmlpath, htmlpath): Create the HTML report from an XML. Args: xmlpath(st... | Implement the Python class `HTMLReport` described below.
Class description:
Class for generating HTML reports from xml files.
Method signatures and docstrings:
- def __init__(self, config_file): Initialize HTMLReport class.
- def dump_html(self, xmlpath, htmlpath): Create the HTML report from an XML. Args: xmlpath(st... | 2007bf3fe66edfe704e485141c55caed54fe13aa | <|skeleton|>
class HTMLReport:
"""Class for generating HTML reports from xml files."""
def __init__(self, config_file):
"""Initialize HTMLReport class."""
<|body_0|>
def dump_html(self, xmlpath, htmlpath):
"""Create the HTML report from an XML. Args: xmlpath(str): Path to input xml... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HTMLReport:
"""Class for generating HTML reports from xml files."""
def __init__(self, config_file):
"""Initialize HTMLReport class."""
self.xslt_style = None
self.xslt_concat = None
self.html_resources = None
self.class_logger.info('CurDir %s.', os.path.abspath(os... | the_stack_v2_python_sparse | reporting/reports/XML.py | AndriyZabavskyy/taf | train | 0 |
acb3b08a4bcde379f3affcc629e731e68fba24be | [
"review_id = label.review_id\nlast_review_id = label.last_review_id\ntext_id = label.text_id\nlast_text_id = label.last_text_id\nreview = label.review\ntext = label.text\nlabel_attrs = label.attributes\npred_attrs = pred.attributes\nattr_annotation_pairs = zip(label_attrs, pred_attrs)\nfor label_attr_annotation, pr... | <|body_start_0|>
review_id = label.review_id
last_review_id = label.last_review_id
text_id = label.text_id
last_text_id = label.last_text_id
review = label.review
text = label.text
label_attrs = label.attributes
pred_attrs = pred.attributes
attr_an... | 定量評価または、エラー分析に使いやすいようにフォーマットを定めたクラス Attributes: review_id (int): レビュー番号 last_review_id (int): 最後のレビュー番号 text_id (int): レビュー文中の文番号 last_text_id (int): レビュー文中の最後の文番号 review (str): レビュー本文 text (str): 評価対象の文 label (int): 正解ラベル pred (int): 属性抽出結果 label_attrs (Tuple[AttrAnnotation, ...]): 正解アノテーション pred_attrs (Tuple[AttrAnno... | DataForEvaluation | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataForEvaluation:
"""定量評価または、エラー分析に使いやすいようにフォーマットを定めたクラス Attributes: review_id (int): レビュー番号 last_review_id (int): 最後のレビュー番号 text_id (int): レビュー文中の文番号 last_text_id (int): レビュー文中の最後の文番号 review (str): レビュー本文 text (str): 評価対象の文 label (int): 正解ラベル pred (int): 属性抽出結果 label_attrs (Tuple[AttrAnnotation... | stack_v2_sparse_classes_10k_train_008783 | 10,681 | no_license | [
{
"docstring": "正解データと属性抽出結果データからインスタンス化し、属性ごとにインスタンスを返すジェネレータ関数 Args: pred (TextWithAttrAnnotation): 属性抽出結果データ label (TextWithAttrAnnotation): 正解データ Returns: 属性とそれに対応するDataForEvaluationインスタンスのジェネレータ",
"name": "iterator_from_text_with_annotation_pair",
"signature": "def iterator_from_text_with_annotatio... | 2 | stack_v2_sparse_classes_30k_train_005443 | Implement the Python class `DataForEvaluation` described below.
Class description:
定量評価または、エラー分析に使いやすいようにフォーマットを定めたクラス Attributes: review_id (int): レビュー番号 last_review_id (int): 最後のレビュー番号 text_id (int): レビュー文中の文番号 last_text_id (int): レビュー文中の最後の文番号 review (str): レビュー本文 text (str): 評価対象の文 label (int): 正解ラベル pred (int): 属... | Implement the Python class `DataForEvaluation` described below.
Class description:
定量評価または、エラー分析に使いやすいようにフォーマットを定めたクラス Attributes: review_id (int): レビュー番号 last_review_id (int): 最後のレビュー番号 text_id (int): レビュー文中の文番号 last_text_id (int): レビュー文中の最後の文番号 review (str): レビュー本文 text (str): 評価対象の文 label (int): 正解ラベル pred (int): 属... | a4c6334b779a94814b7798a0fbfe9a148bf18d3a | <|skeleton|>
class DataForEvaluation:
"""定量評価または、エラー分析に使いやすいようにフォーマットを定めたクラス Attributes: review_id (int): レビュー番号 last_review_id (int): 最後のレビュー番号 text_id (int): レビュー文中の文番号 last_text_id (int): レビュー文中の最後の文番号 review (str): レビュー本文 text (str): 評価対象の文 label (int): 正解ラベル pred (int): 属性抽出結果 label_attrs (Tuple[AttrAnnotation... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DataForEvaluation:
"""定量評価または、エラー分析に使いやすいようにフォーマットを定めたクラス Attributes: review_id (int): レビュー番号 last_review_id (int): 最後のレビュー番号 text_id (int): レビュー文中の文番号 last_text_id (int): レビュー文中の最後の文番号 review (str): レビュー本文 text (str): 評価対象の文 label (int): 正解ラベル pred (int): 属性抽出結果 label_attrs (Tuple[AttrAnnotation, ...]): 正解アノ... | the_stack_v2_python_sparse | src/review_research/evaluation/attr_extraction_evaluater.py | S38knt-ks/ReviewResearch | train | 0 |
3de740851487bad7f20045c6376c69e9b3072b0d | [
"try:\n return get_user_model().objects.create_user(**validated_data)\nexcept Exception as e:\n print(e)\n error = {'message': ','.join(e.args) if len(e.args) > 0 else 'Unknown Error'}\n raise serializers.ValidationError(error)",
"instance.email = validated_data.get('email', instance.email)\ninstance.... | <|body_start_0|>
try:
return get_user_model().objects.create_user(**validated_data)
except Exception as e:
print(e)
error = {'message': ','.join(e.args) if len(e.args) > 0 else 'Unknown Error'}
raise serializers.ValidationError(error)
<|end_body_0|>
<|bod... | FullUserSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FullUserSerializer:
def create(self, validated_data):
"""Create and return a new user, given the validated data."""
<|body_0|>
def update(self, instance, validated_data):
"""Update and return an existing user object, given the validated data."""
<|body_1|>
<... | stack_v2_sparse_classes_10k_train_008784 | 8,786 | no_license | [
{
"docstring": "Create and return a new user, given the validated data.",
"name": "create",
"signature": "def create(self, validated_data)"
},
{
"docstring": "Update and return an existing user object, given the validated data.",
"name": "update",
"signature": "def update(self, instance,... | 2 | stack_v2_sparse_classes_30k_train_006483 | Implement the Python class `FullUserSerializer` described below.
Class description:
Implement the FullUserSerializer class.
Method signatures and docstrings:
- def create(self, validated_data): Create and return a new user, given the validated data.
- def update(self, instance, validated_data): Update and return an e... | Implement the Python class `FullUserSerializer` described below.
Class description:
Implement the FullUserSerializer class.
Method signatures and docstrings:
- def create(self, validated_data): Create and return a new user, given the validated data.
- def update(self, instance, validated_data): Update and return an e... | f1ae8fdb768710d3e0dea77628fd391a4549dd68 | <|skeleton|>
class FullUserSerializer:
def create(self, validated_data):
"""Create and return a new user, given the validated data."""
<|body_0|>
def update(self, instance, validated_data):
"""Update and return an existing user object, given the validated data."""
<|body_1|>
<... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FullUserSerializer:
def create(self, validated_data):
"""Create and return a new user, given the validated data."""
try:
return get_user_model().objects.create_user(**validated_data)
except Exception as e:
print(e)
error = {'message': ','.join(e.args... | the_stack_v2_python_sparse | backend/api/serializers.py | Evobolics/battlecode21 | train | 0 | |
4aab4d8352387190a113fd53dad85494dfbc10ff | [
"for key, val in original.items():\n if key not in self.fields:\n data[key] = val\nreturn data",
"for key, val in original.items():\n if key not in self.fields:\n data[key] = val\nreturn data"
] | <|body_start_0|>
for key, val in original.items():
if key not in self.fields:
data[key] = val
return data
<|end_body_0|>
<|body_start_1|>
for key, val in original.items():
if key not in self.fields:
data[key] = val
return data
<|en... | UnknownSchemaMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UnknownSchemaMixin:
def _handle_load_unknown(self, data, original):
"""Preserve unknown keys during deserialization."""
<|body_0|>
def _handle_dump_unknown(self, data, original):
"""Preserve unknown keys during deserialization."""
<|body_1|>
<|end_skeleton|>... | stack_v2_sparse_classes_10k_train_008785 | 5,044 | permissive | [
{
"docstring": "Preserve unknown keys during deserialization.",
"name": "_handle_load_unknown",
"signature": "def _handle_load_unknown(self, data, original)"
},
{
"docstring": "Preserve unknown keys during deserialization.",
"name": "_handle_dump_unknown",
"signature": "def _handle_dump_... | 2 | stack_v2_sparse_classes_30k_train_000110 | Implement the Python class `UnknownSchemaMixin` described below.
Class description:
Implement the UnknownSchemaMixin class.
Method signatures and docstrings:
- def _handle_load_unknown(self, data, original): Preserve unknown keys during deserialization.
- def _handle_dump_unknown(self, data, original): Preserve unkno... | Implement the Python class `UnknownSchemaMixin` described below.
Class description:
Implement the UnknownSchemaMixin class.
Method signatures and docstrings:
- def _handle_load_unknown(self, data, original): Preserve unknown keys during deserialization.
- def _handle_dump_unknown(self, data, original): Preserve unkno... | fdda93f1ac4122c24720701a112c608006c184dd | <|skeleton|>
class UnknownSchemaMixin:
def _handle_load_unknown(self, data, original):
"""Preserve unknown keys during deserialization."""
<|body_0|>
def _handle_dump_unknown(self, data, original):
"""Preserve unknown keys during deserialization."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class UnknownSchemaMixin:
def _handle_load_unknown(self, data, original):
"""Preserve unknown keys during deserialization."""
for key, val in original.items():
if key not in self.fields:
data[key] = val
return data
def _handle_dump_unknown(self, data, origina... | the_stack_v2_python_sparse | polyaxon_schemas/utils.py | mmourafiq/polyaxon-schemas | train | 0 | |
f9352067652ee6140c81902a285d6f6912c305eb | [
"assert m > 0\nassert n > 0\nassert y >= 0\nassert y < m\nassert x >= 0\nassert x < n\nif dp[y][x] != -1:\n return dp[y][x]\nhere = -dungeon[y][x]\nif y == m - 1 and x == n - 1:\n dp[y][x] = max(1, here + 1)\nelif y == m - 1:\n right = self._minHp(dungeon, m, n, y, x + 1, dp)\n dp[y][x] = max(1, here + ... | <|body_start_0|>
assert m > 0
assert n > 0
assert y >= 0
assert y < m
assert x >= 0
assert x < n
if dp[y][x] != -1:
return dp[y][x]
here = -dungeon[y][x]
if y == m - 1 and x == n - 1:
dp[y][x] = max(1, here + 1)
elif... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _minHp(self, dungeon, m, n, y, x, dp):
"""Calculates the minimum HP needed to get from (x,y) in the dungeon to the bottom-right without reaching 0 HP by moving only right or down in the grid. :type dungeon: List[List[int]] :type m: int The number of rows in the dungeon grid... | stack_v2_sparse_classes_10k_train_008786 | 2,295 | permissive | [
{
"docstring": "Calculates the minimum HP needed to get from (x,y) in the dungeon to the bottom-right without reaching 0 HP by moving only right or down in the grid. :type dungeon: List[List[int]] :type m: int The number of rows in the dungeon grid :type n: int The number of columns in the dungeon grid :type y:... | 2 | stack_v2_sparse_classes_30k_train_004991 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _minHp(self, dungeon, m, n, y, x, dp): Calculates the minimum HP needed to get from (x,y) in the dungeon to the bottom-right without reaching 0 HP by moving only right or dow... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _minHp(self, dungeon, m, n, y, x, dp): Calculates the minimum HP needed to get from (x,y) in the dungeon to the bottom-right without reaching 0 HP by moving only right or dow... | 363848b7870c8d90f5be0d345204c0bf8eb45daa | <|skeleton|>
class Solution:
def _minHp(self, dungeon, m, n, y, x, dp):
"""Calculates the minimum HP needed to get from (x,y) in the dungeon to the bottom-right without reaching 0 HP by moving only right or down in the grid. :type dungeon: List[List[int]] :type m: int The number of rows in the dungeon grid... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def _minHp(self, dungeon, m, n, y, x, dp):
"""Calculates the minimum HP needed to get from (x,y) in the dungeon to the bottom-right without reaching 0 HP by moving only right or down in the grid. :type dungeon: List[List[int]] :type m: int The number of rows in the dungeon grid :type n: int ... | the_stack_v2_python_sparse | leetcode/algorithms/dungeon-game/solution.py | kgashok/algorithms | train | 1 | |
2b25e47f29bf8b885c0f9f607f263a959cb36501 | [
"matrix = [list(map(int, list(x))) for x in matrix]\nres = 0\nfor i in range(len(matrix)):\n vector = [0] * len(matrix[0])\n for j in range(len(matrix[i])):\n t = i\n while t < len(matrix) and matrix[t][j] == 1:\n vector[j] += 1\n t += 1\n res = max(self.largestRectangle... | <|body_start_0|>
matrix = [list(map(int, list(x))) for x in matrix]
res = 0
for i in range(len(matrix)):
vector = [0] * len(matrix[0])
for j in range(len(matrix[i])):
t = i
while t < len(matrix) and matrix[t][j] == 1:
ve... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maximalRectangle(self, matrix):
""":type matrix: List[List[str]] :rtype: int"""
<|body_0|>
def largestRectangleArea(self, heights):
""":type heights: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
matrix = [list(... | stack_v2_sparse_classes_10k_train_008787 | 1,729 | no_license | [
{
"docstring": ":type matrix: List[List[str]] :rtype: int",
"name": "maximalRectangle",
"signature": "def maximalRectangle(self, matrix)"
},
{
"docstring": ":type heights: List[int] :rtype: int",
"name": "largestRectangleArea",
"signature": "def largestRectangleArea(self, heights)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002219 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximalRectangle(self, matrix): :type matrix: List[List[str]] :rtype: int
- def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximalRectangle(self, matrix): :type matrix: List[List[str]] :rtype: int
- def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int
<|skeleton|>
class ... | d1d49a34b3c2a1ba5c6962923fc74be9a1eff668 | <|skeleton|>
class Solution:
def maximalRectangle(self, matrix):
""":type matrix: List[List[str]] :rtype: int"""
<|body_0|>
def largestRectangleArea(self, heights):
""":type heights: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def maximalRectangle(self, matrix):
""":type matrix: List[List[str]] :rtype: int"""
matrix = [list(map(int, list(x))) for x in matrix]
res = 0
for i in range(len(matrix)):
vector = [0] * len(matrix[0])
for j in range(len(matrix[i])):
... | the_stack_v2_python_sparse | 85.Maximal_Rectangle.py | daquexian/leetcode | train | 0 | |
22eab1ad986beb1fd7a5fdea21e6ee70e044ea06 | [
"for row in range(0, len(board)):\n for col in range(0, len(board[0])):\n board_copy = deepcopy(board)\n if self.existRecu(board_copy, word, row, col):\n return True\nreturn False",
"if len(word) == 0:\n return True\nelif row < 0 or row == len(board):\n return False\nelif col < 0... | <|body_start_0|>
for row in range(0, len(board)):
for col in range(0, len(board[0])):
board_copy = deepcopy(board)
if self.existRecu(board_copy, word, row, col):
return True
return False
<|end_body_0|>
<|body_start_1|>
if len(word)... | Solution_A | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution_A:
def exist(self, board: List[List[str]], word: str) -> bool:
"""Use a recursive finder to recursively find the word in the matrix This is still an brutal force method to check every route until find the correct one. Exceeded max time limit when case is long."""
<|body_... | stack_v2_sparse_classes_10k_train_008788 | 10,401 | permissive | [
{
"docstring": "Use a recursive finder to recursively find the word in the matrix This is still an brutal force method to check every route until find the correct one. Exceeded max time limit when case is long.",
"name": "exist",
"signature": "def exist(self, board: List[List[str]], word: str) -> bool"
... | 2 | stack_v2_sparse_classes_30k_train_001752 | Implement the Python class `Solution_A` described below.
Class description:
Implement the Solution_A class.
Method signatures and docstrings:
- def exist(self, board: List[List[str]], word: str) -> bool: Use a recursive finder to recursively find the word in the matrix This is still an brutal force method to check ev... | Implement the Python class `Solution_A` described below.
Class description:
Implement the Solution_A class.
Method signatures and docstrings:
- def exist(self, board: List[List[str]], word: str) -> bool: Use a recursive finder to recursively find the word in the matrix This is still an brutal force method to check ev... | 143422321cbc3715ca08f6c3af8f960a55887ced | <|skeleton|>
class Solution_A:
def exist(self, board: List[List[str]], word: str) -> bool:
"""Use a recursive finder to recursively find the word in the matrix This is still an brutal force method to check every route until find the correct one. Exceeded max time limit when case is long."""
<|body_... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution_A:
def exist(self, board: List[List[str]], word: str) -> bool:
"""Use a recursive finder to recursively find the word in the matrix This is still an brutal force method to check every route until find the correct one. Exceeded max time limit when case is long."""
for row in range(0, l... | the_stack_v2_python_sparse | LeetCode/LC079_word_search.py | jxie0755/Learning_Python | train | 0 | |
96334f3a232b0bb91b1f4dff25f965c29912bd96 | [
"if model_output_transform is None and transforms is None:\n model_output_transform = SameSize(resize_target=False, interpolation=self.DEFAULT_MASK_INTERPOLATION)\nif transforms is not None:\n transforms_wt_device: Compose = Compose([OnBothSides(ToDevice(device)), transforms])\nelse:\n transforms_wt_device... | <|body_start_0|>
if model_output_transform is None and transforms is None:
model_output_transform = SameSize(resize_target=False, interpolation=self.DEFAULT_MASK_INTERPOLATION)
if transforms is not None:
transforms_wt_device: Compose = Compose([OnBothSides(ToDevice(device)), tran... | Train test handle for concept localization models. Takes the concept data of the concept model's concept, and automatically converts it appropriately for the concept model (see :py:meth:`data_from_concept`). | ConceptDetection2DTrainTestHandle | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConceptDetection2DTrainTestHandle:
"""Train test handle for concept localization models. Takes the concept data of the concept model's concept, and automatically converts it appropriately for the concept model (see :py:meth:`data_from_concept`)."""
def __init__(self, concept_model: ConceptDe... | stack_v2_sparse_classes_10k_train_008789 | 27,601 | permissive | [
{
"docstring": "Init. For further parameter descriptions see ``__init__()`` of :py:class:`~hybrid_learning.concepts.models.base_handles.train_test_handle.TrainEvalHandle`. :param concept_model: the concept localization model to work on with concept. :param act_map_filepath_fns: dictionary of ``{split: func}`` w... | 3 | stack_v2_sparse_classes_30k_val_000127 | Implement the Python class `ConceptDetection2DTrainTestHandle` described below.
Class description:
Train test handle for concept localization models. Takes the concept data of the concept model's concept, and automatically converts it appropriately for the concept model (see :py:meth:`data_from_concept`).
Method sign... | Implement the Python class `ConceptDetection2DTrainTestHandle` described below.
Class description:
Train test handle for concept localization models. Takes the concept data of the concept model's concept, and automatically converts it appropriately for the concept model (see :py:meth:`data_from_concept`).
Method sign... | 37b9fc83d7b14902dfe92e0c45071c150bcf3779 | <|skeleton|>
class ConceptDetection2DTrainTestHandle:
"""Train test handle for concept localization models. Takes the concept data of the concept model's concept, and automatically converts it appropriately for the concept model (see :py:meth:`data_from_concept`)."""
def __init__(self, concept_model: ConceptDe... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ConceptDetection2DTrainTestHandle:
"""Train test handle for concept localization models. Takes the concept data of the concept model's concept, and automatically converts it appropriately for the concept model (see :py:meth:`data_from_concept`)."""
def __init__(self, concept_model: ConceptDetectionModel2... | the_stack_v2_python_sparse | hybrid_learning/concepts/models/concept_detection.py | JohnnyZhang917/hybrid_learning | train | 0 |
7ff8e097472b962a5b4b417aadf93881b30ef9eb | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Missing associated documentation comment in .proto file. | DropboxStorageServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DropboxStorageServiceServicer:
"""Missing associated documentation comment in .proto file."""
def listDropboxStorage(self, request, context):
"""Storage"""
<|body_0|>
def getDropboxStorage(self, request, context):
"""Missing associated documentation comment in .p... | stack_v2_sparse_classes_10k_train_008790 | 10,219 | permissive | [
{
"docstring": "Storage",
"name": "listDropboxStorage",
"signature": "def listDropboxStorage(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "getDropboxStorage",
"signature": "def getDropboxStorage(self, request, context)"
... | 5 | stack_v2_sparse_classes_30k_train_003203 | Implement the Python class `DropboxStorageServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def listDropboxStorage(self, request, context): Storage
- def getDropboxStorage(self, request, context): Missing associated docume... | Implement the Python class `DropboxStorageServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def listDropboxStorage(self, request, context): Storage
- def getDropboxStorage(self, request, context): Missing associated docume... | c69e14b409add099d151434b9add711e41f41b20 | <|skeleton|>
class DropboxStorageServiceServicer:
"""Missing associated documentation comment in .proto file."""
def listDropboxStorage(self, request, context):
"""Storage"""
<|body_0|>
def getDropboxStorage(self, request, context):
"""Missing associated documentation comment in .p... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DropboxStorageServiceServicer:
"""Missing associated documentation comment in .proto file."""
def listDropboxStorage(self, request, context):
"""Storage"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedEr... | the_stack_v2_python_sparse | python-sdk/src/airavata_mft_sdk/dropbox/DropboxStorageService_pb2_grpc.py | apache/airavata-mft | train | 23 |
466d0babc55ba3949ae0ebac5e065a43cdaf27b7 | [
"token = AccessToken(app_id, app_certificate, expire=expire)\nchar_user_id = get_md5(user_uuid)\neducation_service = ServiceEducation(room_uuid, user_uuid, role)\neducation_service.add_privilege(ServiceEducation.kPrivilegeRoomUser, expire)\ntoken.add_service(education_service)\nrtm_service = ServiceRtm(user_uuid)\n... | <|body_start_0|>
token = AccessToken(app_id, app_certificate, expire=expire)
char_user_id = get_md5(user_uuid)
education_service = ServiceEducation(room_uuid, user_uuid, role)
education_service.add_privilege(ServiceEducation.kPrivilegeRoomUser, expire)
token.add_service(education... | EducationTokenBuilder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EducationTokenBuilder:
def build_room_user_token(app_id, app_certificate, room_uuid, user_uuid, role, expire):
"""Build user room token :param app_id: The App ID issued to you by Agora. Apply for a new App ID from Agora Dashboard if it is missing from your kit. See Get an App ID. :param ... | stack_v2_sparse_classes_10k_train_008791 | 3,863 | permissive | [
{
"docstring": "Build user room token :param app_id: The App ID issued to you by Agora. Apply for a new App ID from Agora Dashboard if it is missing from your kit. See Get an App ID. :param app_certificate: Certificate of the application that you registered in the Agora Dashboard. See Get an App Certificate. :p... | 3 | stack_v2_sparse_classes_30k_test_000339 | Implement the Python class `EducationTokenBuilder` described below.
Class description:
Implement the EducationTokenBuilder class.
Method signatures and docstrings:
- def build_room_user_token(app_id, app_certificate, room_uuid, user_uuid, role, expire): Build user room token :param app_id: The App ID issued to you by... | Implement the Python class `EducationTokenBuilder` described below.
Class description:
Implement the EducationTokenBuilder class.
Method signatures and docstrings:
- def build_room_user_token(app_id, app_certificate, room_uuid, user_uuid, role, expire): Build user room token :param app_id: The App ID issued to you by... | 5c800b136f132a92d5f70252aac12e9c32dbf5e7 | <|skeleton|>
class EducationTokenBuilder:
def build_room_user_token(app_id, app_certificate, room_uuid, user_uuid, role, expire):
"""Build user room token :param app_id: The App ID issued to you by Agora. Apply for a new App ID from Agora Dashboard if it is missing from your kit. See Get an App ID. :param ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EducationTokenBuilder:
def build_room_user_token(app_id, app_certificate, room_uuid, user_uuid, role, expire):
"""Build user room token :param app_id: The App ID issued to you by Agora. Apply for a new App ID from Agora Dashboard if it is missing from your kit. See Get an App ID. :param app_certificat... | the_stack_v2_python_sparse | DynamicKey/AgoraDynamicKey/python3/src/education_token_builder.py | AgoraIO/Tools | train | 380 | |
483140f5d0b3338d66a8d055fbab662f812b53d1 | [
"self.confirmed = confirmed\nself.synchronous = synchronous\nself.actions = actions",
"if dictionary is None:\n return None\nactions = None\nif dictionary.get('actions') != None:\n actions = list()\n for structure in dictionary.get('actions'):\n actions.append(meraki_sdk.models.action_model.Action... | <|body_start_0|>
self.confirmed = confirmed
self.synchronous = synchronous
self.actions = actions
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
actions = None
if dictionary.get('actions') != None:
actions = list()
... | Implementation of the 'createOrganizationActionBatch' model. TODO: type model description here. Attributes: confirmed (bool): Set to true for immediate execution. Set to false if the action should be previewed before executing. This property cannot be unset once it is true. Defaults to false. synchronous (bool): Set to... | CreateOrganizationActionBatchModel | [
"MIT",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CreateOrganizationActionBatchModel:
"""Implementation of the 'createOrganizationActionBatch' model. TODO: type model description here. Attributes: confirmed (bool): Set to true for immediate execution. Set to false if the action should be previewed before executing. This property cannot be unset ... | stack_v2_sparse_classes_10k_train_008792 | 2,674 | permissive | [
{
"docstring": "Constructor for the CreateOrganizationActionBatchModel class",
"name": "__init__",
"signature": "def __init__(self, actions=None, confirmed=None, synchronous=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary ... | 2 | null | Implement the Python class `CreateOrganizationActionBatchModel` described below.
Class description:
Implementation of the 'createOrganizationActionBatch' model. TODO: type model description here. Attributes: confirmed (bool): Set to true for immediate execution. Set to false if the action should be previewed before ex... | Implement the Python class `CreateOrganizationActionBatchModel` described below.
Class description:
Implementation of the 'createOrganizationActionBatch' model. TODO: type model description here. Attributes: confirmed (bool): Set to true for immediate execution. Set to false if the action should be previewed before ex... | 9894089eb013318243ae48869cc5130eb37f80c0 | <|skeleton|>
class CreateOrganizationActionBatchModel:
"""Implementation of the 'createOrganizationActionBatch' model. TODO: type model description here. Attributes: confirmed (bool): Set to true for immediate execution. Set to false if the action should be previewed before executing. This property cannot be unset ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CreateOrganizationActionBatchModel:
"""Implementation of the 'createOrganizationActionBatch' model. TODO: type model description here. Attributes: confirmed (bool): Set to true for immediate execution. Set to false if the action should be previewed before executing. This property cannot be unset once it is tr... | the_stack_v2_python_sparse | meraki_sdk/models/create_organization_action_batch_model.py | RaulCatalano/meraki-python-sdk | train | 1 |
5892b812a1567363c1e04a041948d8a1f91997f9 | [
"self.pq = nums\nself.k = k\nheapify(self.pq)\nwhile len(self.pq) > k:\n heappop(self.pq)",
"heappush(self.pq, val)\nwhile len(self.pq) > self.k:\n heappop(self.pq)\nreturn self.pq[0]"
] | <|body_start_0|>
self.pq = nums
self.k = k
heapify(self.pq)
while len(self.pq) > k:
heappop(self.pq)
<|end_body_0|>
<|body_start_1|>
heappush(self.pq, val)
while len(self.pq) > self.k:
heappop(self.pq)
return self.pq[0]
<|end_body_1|>
| 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.pq = nums
self.k = k
heapify(self.pq)... | stack_v2_sparse_classes_10k_train_008793 | 936 | 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_004123 | 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... | 76d767ec001649b2df07aac211ac4b43b415ebdd | <|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_10k | data/stack_v2_sparse_classes_30k | class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
self.pq = nums
self.k = k
heapify(self.pq)
while len(self.pq) > k:
heappop(self.pq)
def add(self, val):
""":type val: int :rtype: int"""
heappush(self.pq, ... | the_stack_v2_python_sparse | leetcode703 Kth Largest Element in a Stream.py | whglamrock/leetcode_series | train | 2 | |
97c48ebc01c91ca0db786bc0fd5d132d3b63ecc4 | [
"Search.__init__(self)\nself.token = token\nif HAS_SOUNDCLOUD:\n self.client = soundcloud.Client(client_id=token)\nelse:\n self.client = None\nself.serviceName = 'SoundCloud'",
"if not HAS_SOUNDCLOUD:\n return {'Library unavailable': \"This search engine cannot function properly, because the soundcloud p... | <|body_start_0|>
Search.__init__(self)
self.token = token
if HAS_SOUNDCLOUD:
self.client = soundcloud.Client(client_id=token)
else:
self.client = None
self.serviceName = 'SoundCloud'
<|end_body_0|>
<|body_start_1|>
if not HAS_SOUNDCLOUD:
... | SoundCloudSearch | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SoundCloudSearch:
def __init__(self, token):
"""Create a new SoundCloudSearch instance. token should be a valid SoundCloud Client ID."""
<|body_0|>
def search(self, query, maxresults=10, lang='en', **opt):
"""Searches SoundCloud for tracks using the given query. Retu... | stack_v2_sparse_classes_10k_train_008794 | 5,488 | no_license | [
{
"docstring": "Create a new SoundCloudSearch instance. token should be a valid SoundCloud Client ID.",
"name": "__init__",
"signature": "def __init__(self, token)"
},
{
"docstring": "Searches SoundCloud for tracks using the given query. Returns a dict of url: title pairs pointing to tracks. If ... | 2 | stack_v2_sparse_classes_30k_train_005916 | Implement the Python class `SoundCloudSearch` described below.
Class description:
Implement the SoundCloudSearch class.
Method signatures and docstrings:
- def __init__(self, token): Create a new SoundCloudSearch instance. token should be a valid SoundCloud Client ID.
- def search(self, query, maxresults=10, lang='en... | Implement the Python class `SoundCloudSearch` described below.
Class description:
Implement the SoundCloudSearch class.
Method signatures and docstrings:
- def __init__(self, token): Create a new SoundCloudSearch instance. token should be a valid SoundCloud Client ID.
- def search(self, query, maxresults=10, lang='en... | 5fbff4606d50a114613edbb1f360aca070be9226 | <|skeleton|>
class SoundCloudSearch:
def __init__(self, token):
"""Create a new SoundCloudSearch instance. token should be a valid SoundCloud Client ID."""
<|body_0|>
def search(self, query, maxresults=10, lang='en', **opt):
"""Searches SoundCloud for tracks using the given query. Retu... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SoundCloudSearch:
def __init__(self, token):
"""Create a new SoundCloudSearch instance. token should be a valid SoundCloud Client ID."""
Search.__init__(self)
self.token = token
if HAS_SOUNDCLOUD:
self.client = soundcloud.Client(client_id=token)
else:
... | the_stack_v2_python_sparse | ytsearch.py | fredi-68/Ram | train | 0 | |
d36379739d21f4870035e081f24802ac947d4e6b | [
"currSum, currMax = (0, float('-inf'))\nbst = BST(TreeNode(currSum))\nfor num in nums:\n currSum += num\n preSum = bst.ceiling(currSum - k)\n currMax = max(currMax, currSum - preSum)\n bst.insert(TreeNode(currSum))\nreturn currMax",
"currMax, currSum = (float('-inf'), 0)\nfor num in nums:\n currSum... | <|body_start_0|>
currSum, currMax = (0, float('-inf'))
bst = BST(TreeNode(currSum))
for num in nums:
currSum += num
preSum = bst.ceiling(currSum - k)
currMax = max(currMax, currSum - preSum)
bst.insert(TreeNode(currSum))
return currMax
<|en... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _get_limit_max_sub_sum(self, nums: List[int], k: int) -> int:
"""Try to find a contiguous sub list from nums whose summary <= k. The search process is accelarated by storing the pre calculated sub summaries to each node of a BST."""
<|body_0|>
def _get_no_limit... | stack_v2_sparse_classes_10k_train_008795 | 3,575 | no_license | [
{
"docstring": "Try to find a contiguous sub list from nums whose summary <= k. The search process is accelarated by storing the pre calculated sub summaries to each node of a BST.",
"name": "_get_limit_max_sub_sum",
"signature": "def _get_limit_max_sub_sum(self, nums: List[int], k: int) -> int"
},
... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _get_limit_max_sub_sum(self, nums: List[int], k: int) -> int: Try to find a contiguous sub list from nums whose summary <= k. The search process is accelarated by storing the... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _get_limit_max_sub_sum(self, nums: List[int], k: int) -> int: Try to find a contiguous sub list from nums whose summary <= k. The search process is accelarated by storing the... | edb870f83f0c4568cce0cacec04ee70cf6b545bf | <|skeleton|>
class Solution:
def _get_limit_max_sub_sum(self, nums: List[int], k: int) -> int:
"""Try to find a contiguous sub list from nums whose summary <= k. The search process is accelarated by storing the pre calculated sub summaries to each node of a BST."""
<|body_0|>
def _get_no_limit... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def _get_limit_max_sub_sum(self, nums: List[int], k: int) -> int:
"""Try to find a contiguous sub list from nums whose summary <= k. The search process is accelarated by storing the pre calculated sub summaries to each node of a BST."""
currSum, currMax = (0, float('-inf'))
b... | the_stack_v2_python_sparse | 2020/max_sum_of_rectangle_no_larger_than_k.py | eronekogin/leetcode | train | 0 | |
33dcf02c9328892eadce8788ca72af83e1b42e0b | [
"config = registry.get_plugin('samplelocate').plugin_config()\nconfig.active = True\nconfig.save()\nurl = reverse('api-locate-plugin')\nself.post(url, {}, expected_code=400)\nself.post(url, {'plugin': 'sampleevent'}, expected_code=400)\nself.post(url, {'plugin': 'samplelocate'}, expected_code=400)\nself.post(url, {... | <|body_start_0|>
config = registry.get_plugin('samplelocate').plugin_config()
config.active = True
config.save()
url = reverse('api-locate-plugin')
self.post(url, {}, expected_code=400)
self.post(url, {'plugin': 'sampleevent'}, expected_code=400)
self.post(url, {'... | Tests for SampleLocatePlugin. | SampleLocatePlugintests | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SampleLocatePlugintests:
"""Tests for SampleLocatePlugin."""
def test_run_locator(self):
"""Check if the event is issued."""
<|body_0|>
def test_mixin(self):
"""Test that MixinNotImplementedError is raised."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_10k_train_008796 | 1,980 | permissive | [
{
"docstring": "Check if the event is issued.",
"name": "test_run_locator",
"signature": "def test_run_locator(self)"
},
{
"docstring": "Test that MixinNotImplementedError is raised.",
"name": "test_mixin",
"signature": "def test_mixin(self)"
}
] | 2 | null | Implement the Python class `SampleLocatePlugintests` described below.
Class description:
Tests for SampleLocatePlugin.
Method signatures and docstrings:
- def test_run_locator(self): Check if the event is issued.
- def test_mixin(self): Test that MixinNotImplementedError is raised. | Implement the Python class `SampleLocatePlugintests` described below.
Class description:
Tests for SampleLocatePlugin.
Method signatures and docstrings:
- def test_run_locator(self): Check if the event is issued.
- def test_mixin(self): Test that MixinNotImplementedError is raised.
<|skeleton|>
class SampleLocatePlu... | e88a8e99a5f0b201c67a95cba097c729f090d5e2 | <|skeleton|>
class SampleLocatePlugintests:
"""Tests for SampleLocatePlugin."""
def test_run_locator(self):
"""Check if the event is issued."""
<|body_0|>
def test_mixin(self):
"""Test that MixinNotImplementedError is raised."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SampleLocatePlugintests:
"""Tests for SampleLocatePlugin."""
def test_run_locator(self):
"""Check if the event is issued."""
config = registry.get_plugin('samplelocate').plugin_config()
config.active = True
config.save()
url = reverse('api-locate-plugin')
s... | the_stack_v2_python_sparse | InvenTree/plugin/samples/locate/test_locate_sample.py | inventree/InvenTree | train | 3,077 |
5e523affff17cc6d8f70ec1003271fe4c666418a | [
"assert self.user_id is not None\nauthor_details = blog_services.get_blog_author_details(self.user_id).to_dict()\nno_of_published_blog_posts = 0\npublished_post_summary_dicts = []\nno_of_draft_blog_posts = 0\ndraft_blog_post_summary_dicts = []\npublished_post_summaries = blog_services.get_blog_post_summary_models_l... | <|body_start_0|>
assert self.user_id is not None
author_details = blog_services.get_blog_author_details(self.user_id).to_dict()
no_of_published_blog_posts = 0
published_post_summary_dicts = []
no_of_draft_blog_posts = 0
draft_blog_post_summary_dicts = []
published... | Provides user data for the blog dashboard. | BlogDashboardDataHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BlogDashboardDataHandler:
"""Provides user data for the blog dashboard."""
def get(self) -> None:
"""Retrieves data for the blog dashboard."""
<|body_0|>
def post(self) -> None:
"""Creates a new blog post draft."""
<|body_1|>
def put(self) -> None:
... | stack_v2_sparse_classes_10k_train_008797 | 15,112 | permissive | [
{
"docstring": "Retrieves data for the blog dashboard.",
"name": "get",
"signature": "def get(self) -> None"
},
{
"docstring": "Creates a new blog post draft.",
"name": "post",
"signature": "def post(self) -> None"
},
{
"docstring": "Updates author details of the user.",
"nam... | 3 | null | Implement the Python class `BlogDashboardDataHandler` described below.
Class description:
Provides user data for the blog dashboard.
Method signatures and docstrings:
- def get(self) -> None: Retrieves data for the blog dashboard.
- def post(self) -> None: Creates a new blog post draft.
- def put(self) -> None: Updat... | Implement the Python class `BlogDashboardDataHandler` described below.
Class description:
Provides user data for the blog dashboard.
Method signatures and docstrings:
- def get(self) -> None: Retrieves data for the blog dashboard.
- def post(self) -> None: Creates a new blog post draft.
- def put(self) -> None: Updat... | d16fdf23d790eafd63812bd7239532256e30a21d | <|skeleton|>
class BlogDashboardDataHandler:
"""Provides user data for the blog dashboard."""
def get(self) -> None:
"""Retrieves data for the blog dashboard."""
<|body_0|>
def post(self) -> None:
"""Creates a new blog post draft."""
<|body_1|>
def put(self) -> None:
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BlogDashboardDataHandler:
"""Provides user data for the blog dashboard."""
def get(self) -> None:
"""Retrieves data for the blog dashboard."""
assert self.user_id is not None
author_details = blog_services.get_blog_author_details(self.user_id).to_dict()
no_of_published_blo... | the_stack_v2_python_sparse | core/controllers/blog_dashboard.py | oppia/oppia | train | 6,172 |
0bf6bdb6674094afc967ed5f99f7d3559e2129e2 | [
"if 'tag' in self.request.GET:\n return self.model.objects.filter(tags__title=self.request.GET['tag']).order_by('date_created')\nreturn self.model.objects.all().order_by('date_created')",
"context = super().get_context_data(**kwargs)\nquery_params = self.request.GET.copy()\nquery_params.pop('page', None)\ncont... | <|body_start_0|>
if 'tag' in self.request.GET:
return self.model.objects.filter(tags__title=self.request.GET['tag']).order_by('date_created')
return self.model.objects.all().order_by('date_created')
<|end_body_0|>
<|body_start_1|>
context = super().get_context_data(**kwargs)
... | Base class for displaying a list of listings :param model: Listing subclass :param paginate_by: pagination limit :param template_name: base template for listviews | ListingList | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ListingList:
"""Base class for displaying a list of listings :param model: Listing subclass :param paginate_by: pagination limit :param template_name: base template for listviews"""
def get_queryset(self) -> QuerySet[Listing]:
"""Filters by tag if "tag" is in query_params. Order by '... | stack_v2_sparse_classes_10k_train_008798 | 4,095 | no_license | [
{
"docstring": "Filters by tag if \"tag\" is in query_params. Order by 'date_created'",
"name": "get_queryset",
"signature": "def get_queryset(self) -> QuerySet[Listing]"
},
{
"docstring": "Cleans 'page' query param between requests for pagination",
"name": "get_context_data",
"signature... | 2 | stack_v2_sparse_classes_30k_train_006899 | Implement the Python class `ListingList` described below.
Class description:
Base class for displaying a list of listings :param model: Listing subclass :param paginate_by: pagination limit :param template_name: base template for listviews
Method signatures and docstrings:
- def get_queryset(self) -> QuerySet[Listing... | Implement the Python class `ListingList` described below.
Class description:
Base class for displaying a list of listings :param model: Listing subclass :param paginate_by: pagination limit :param template_name: base template for listviews
Method signatures and docstrings:
- def get_queryset(self) -> QuerySet[Listing... | c71b81757e4fe2ec58b70e6434ad252032ae55ee | <|skeleton|>
class ListingList:
"""Base class for displaying a list of listings :param model: Listing subclass :param paginate_by: pagination limit :param template_name: base template for listviews"""
def get_queryset(self) -> QuerySet[Listing]:
"""Filters by tag if "tag" is in query_params. Order by '... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ListingList:
"""Base class for displaying a list of listings :param model: Listing subclass :param paginate_by: pagination limit :param template_name: base template for listviews"""
def get_queryset(self) -> QuerySet[Listing]:
"""Filters by tag if "tag" is in query_params. Order by 'date_created'... | the_stack_v2_python_sparse | ecom_website/listings/views/base.py | ivanmclennon/e-commerce | train | 0 |
85093ce0dde3042a1641d214fe093650ef2e44d4 | [
"if not nums:\n return 1\nzeros = [0] * (max(nums) + 2)\nfor num in nums:\n if num > 0:\n zeros[num] = 1\nfor i in range(1, len(zeros)):\n if zeros[i] != 1:\n return i",
"nums = set(nums)\nfor i in range(1, len(nums) + 2):\n if i not in nums:\n return i",
"zeros = [0] * (len(num... | <|body_start_0|>
if not nums:
return 1
zeros = [0] * (max(nums) + 2)
for num in nums:
if num > 0:
zeros[num] = 1
for i in range(1, len(zeros)):
if zeros[i] != 1:
return i
<|end_body_0|>
<|body_start_1|>
nums = s... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _firstMissingPositive(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def __firstMissingPositive(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
def ___firstMissingPositive(self, nums):
""":type nums:... | stack_v2_sparse_classes_10k_train_008799 | 2,642 | permissive | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "_firstMissingPositive",
"signature": "def _firstMissingPositive(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "__firstMissingPositive",
"signature": "def __firstMissingPositive(self, nums)"
},
... | 4 | stack_v2_sparse_classes_30k_train_004521 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _firstMissingPositive(self, nums): :type nums: List[int] :rtype: int
- def __firstMissingPositive(self, nums): :type nums: List[int] :rtype: int
- def ___firstMissingPositive... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _firstMissingPositive(self, nums): :type nums: List[int] :rtype: int
- def __firstMissingPositive(self, nums): :type nums: List[int] :rtype: int
- def ___firstMissingPositive... | 0dd67edca4e0b0323cb5a7239f02ea46383cd15a | <|skeleton|>
class Solution:
def _firstMissingPositive(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def __firstMissingPositive(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
def ___firstMissingPositive(self, nums):
""":type nums:... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def _firstMissingPositive(self, nums):
""":type nums: List[int] :rtype: int"""
if not nums:
return 1
zeros = [0] * (max(nums) + 2)
for num in nums:
if num > 0:
zeros[num] = 1
for i in range(1, len(zeros)):
if... | the_stack_v2_python_sparse | 41.first-missing-positive.py | windard/leeeeee | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.