blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 6.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 438 7.52k | id stringlengths 40 40 | length_bytes int64 506 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.25k | prompted_full_text stringlengths 645 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.34k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 302 7.33k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b05c9d4f1e8179bfa73d19700f2d1e80a0efd297 | [
"if not head:\n return None\nif not head.next and n > 0:\n return None\ncur = head\nsize = 0\nwhile cur:\n size += 1\n cur = cur.next\ndel_index = size - n\nif del_index == 0:\n return head.next\nelse:\n cur = head\n for i in range(1, del_index):\n cur = cur.next\n cur.next = cur.next... | <|body_start_0|>
if not head:
return None
if not head.next and n > 0:
return None
cur = head
size = 0
while cur:
size += 1
cur = cur.next
del_index = size - n
if del_index == 0:
return head.next
e... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def removeNthFromEnd0(self, head, n):
""":type head: ListNode :type n: int :rtype: ListNode"""
<|body_0|>
def removeNthFromEnd(self, head, n):
""":type head: ListNode :type n: int :rtype: ListNode 双指针,fast先走n步"""
<|body_1|>
<|end_skeleton|>
<|body... | stack_v2_sparse_classes_36k_train_025200 | 1,647 | no_license | [
{
"docstring": ":type head: ListNode :type n: int :rtype: ListNode",
"name": "removeNthFromEnd0",
"signature": "def removeNthFromEnd0(self, head, n)"
},
{
"docstring": ":type head: ListNode :type n: int :rtype: ListNode 双指针,fast先走n步",
"name": "removeNthFromEnd",
"signature": "def removeN... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeNthFromEnd0(self, head, n): :type head: ListNode :type n: int :rtype: ListNode
- def removeNthFromEnd(self, head, n): :type head: ListNode :type n: int :rtype: ListNode... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeNthFromEnd0(self, head, n): :type head: ListNode :type n: int :rtype: ListNode
- def removeNthFromEnd(self, head, n): :type head: ListNode :type n: int :rtype: ListNode... | 6e18c5d257840489cc3fb1079ae3804c743982a4 | <|skeleton|>
class Solution:
def removeNthFromEnd0(self, head, n):
""":type head: ListNode :type n: int :rtype: ListNode"""
<|body_0|>
def removeNthFromEnd(self, head, n):
""":type head: ListNode :type n: int :rtype: ListNode 双指针,fast先走n步"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def removeNthFromEnd0(self, head, n):
""":type head: ListNode :type n: int :rtype: ListNode"""
if not head:
return None
if not head.next and n > 0:
return None
cur = head
size = 0
while cur:
size += 1
cur... | the_stack_v2_python_sparse | 19.删除链表的倒数第-n-个结点.py | yangyuxiang1996/leetcode | train | 0 | |
ee22fd4747cea910ac65c3cb7bcdd02e4066f275 | [
"self.comms = comms\nself.logger = logger\nself.verbose = verbose\nself.name = 'POM1_CommonML_Master'\nself.platform = comms.name\nself.all_workers_addresses = comms.workers_ids\nself.workers_addresses = comms.workers_ids\nself.Nworkers = len(self.workers_addresses)\nself.reset()\nself.state_dict = {}\nfor worker i... | <|body_start_0|>
self.comms = comms
self.logger = logger
self.verbose = verbose
self.name = 'POM1_CommonML_Master'
self.platform = comms.name
self.all_workers_addresses = comms.workers_ids
self.workers_addresses = comms.workers_ids
self.Nworkers = len(self... | This class implements the Common ML operations, run at Master node. It inherits from :class:`Common_to_POMs_123_Master`. | POM1_CommonML_Master | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class POM1_CommonML_Master:
"""This class implements the Common ML operations, run at Master node. It inherits from :class:`Common_to_POMs_123_Master`."""
def __init__(self, comms, logger, verbose=False):
"""Create a :class:`POM1_CommonML_Master` instance. Parameters ---------- comms: :cla... | stack_v2_sparse_classes_36k_train_025201 | 7,104 | permissive | [
{
"docstring": "Create a :class:`POM1_CommonML_Master` instance. Parameters ---------- comms: :class:`Comms_master` Object providing communications functionalities. logger: :class:`mylogging.Logger` Logging object instance. verbose: boolean Indicates whether to print messages on screen nor not.",
"name": "_... | 2 | stack_v2_sparse_classes_30k_train_014119 | Implement the Python class `POM1_CommonML_Master` described below.
Class description:
This class implements the Common ML operations, run at Master node. It inherits from :class:`Common_to_POMs_123_Master`.
Method signatures and docstrings:
- def __init__(self, comms, logger, verbose=False): Create a :class:`POM1_Com... | Implement the Python class `POM1_CommonML_Master` described below.
Class description:
This class implements the Common ML operations, run at Master node. It inherits from :class:`Common_to_POMs_123_Master`.
Method signatures and docstrings:
- def __init__(self, comms, logger, verbose=False): Create a :class:`POM1_Com... | ccc0a7674a04ae0d00bedc38893b33184c5f68c6 | <|skeleton|>
class POM1_CommonML_Master:
"""This class implements the Common ML operations, run at Master node. It inherits from :class:`Common_to_POMs_123_Master`."""
def __init__(self, comms, logger, verbose=False):
"""Create a :class:`POM1_CommonML_Master` instance. Parameters ---------- comms: :cla... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class POM1_CommonML_Master:
"""This class implements the Common ML operations, run at Master node. It inherits from :class:`Common_to_POMs_123_Master`."""
def __init__(self, comms, logger, verbose=False):
"""Create a :class:`POM1_CommonML_Master` instance. Parameters ---------- comms: :class:`Comms_mas... | the_stack_v2_python_sparse | MMLL/models/POM1/CommonML/POM1_CommonML.py | Musketeer-H2020/MMLL-Robust | train | 0 |
d4d0081531fe0da503738abd16ff13fff8f9bc23 | [
"if self == InfoPageActionControl.UNKNOWN:\n return False\nif self == InfoPageActionControl.DETACH:\n return target_uid is not None\nif self == InfoPageActionControl.DELETE:\n return True\nraise NotImplementedError()",
"if s == 'detach':\n return InfoPageActionControl.DETACH\nif s == 'delete':\n re... | <|body_start_0|>
if self == InfoPageActionControl.UNKNOWN:
return False
if self == InfoPageActionControl.DETACH:
return target_uid is not None
if self == InfoPageActionControl.DELETE:
return True
raise NotImplementedError()
<|end_body_0|>
<|body_start... | Enum to represent the type of action to be performed. | InfoPageActionControl | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InfoPageActionControl:
"""Enum to represent the type of action to be performed."""
def is_argument_valid(self, target_uid) -> bool:
"""Check if the argument for the action is valid. :param target_uid: UID of the profile action target :return: if the argument for the action is valid :... | stack_v2_sparse_classes_36k_train_025202 | 7,451 | permissive | [
{
"docstring": "Check if the argument for the action is valid. :param target_uid: UID of the profile action target :return: if the argument for the action is valid :raises NotImplementedError: if the validating action is not yet implemented",
"name": "is_argument_valid",
"signature": "def is_argument_va... | 4 | stack_v2_sparse_classes_30k_train_003301 | Implement the Python class `InfoPageActionControl` described below.
Class description:
Enum to represent the type of action to be performed.
Method signatures and docstrings:
- def is_argument_valid(self, target_uid) -> bool: Check if the argument for the action is valid. :param target_uid: UID of the profile action ... | Implement the Python class `InfoPageActionControl` described below.
Class description:
Enum to represent the type of action to be performed.
Method signatures and docstrings:
- def is_argument_valid(self, target_uid) -> bool: Check if the argument for the action is valid. :param target_uid: UID of the profile action ... | c7da1e91783dce3a2b71b955b3a22b68db9056cf | <|skeleton|>
class InfoPageActionControl:
"""Enum to represent the type of action to be performed."""
def is_argument_valid(self, target_uid) -> bool:
"""Check if the argument for the action is valid. :param target_uid: UID of the profile action target :return: if the argument for the action is valid :... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InfoPageActionControl:
"""Enum to represent the type of action to be performed."""
def is_argument_valid(self, target_uid) -> bool:
"""Check if the argument for the action is valid. :param target_uid: UID of the profile action target :return: if the argument for the action is valid :raises NotImp... | the_stack_v2_python_sparse | JellyBot/views/info/profile.py | RxJellyBot/Jelly-Bot | train | 5 |
f57b61b82780781424d32051edf350d73efe22dd | [
"QTreeWidget.__init__(self, parent)\nself.setDragDropMode(QAbstractItemView.DragDrop)\nself.setDragEnabled(True)",
"if self.itemCurrent.type() == QTreeWidgetItem.UserType + 0:\n pathFile = self.itemCurrent.getPath(withFileName=False)\n if len(pathFile) > 1:\n meta = {}\n meta['repotype'] = UCI... | <|body_start_0|>
QTreeWidget.__init__(self, parent)
self.setDragDropMode(QAbstractItemView.DragDrop)
self.setDragEnabled(True)
<|end_body_0|>
<|body_start_1|>
if self.itemCurrent.type() == QTreeWidgetItem.UserType + 0:
pathFile = self.itemCurrent.getPath(withFileName=False)
... | Tree widget | TreeWidgetRepository | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TreeWidgetRepository:
"""Tree widget"""
def __init__(self, parent):
"""Treewidget constructor"""
<|body_0|>
def startDrag(self, dropAction):
"""Start drag"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
QTreeWidget.__init__(self, parent)
... | stack_v2_sparse_classes_36k_train_025203 | 37,396 | permissive | [
{
"docstring": "Treewidget constructor",
"name": "__init__",
"signature": "def __init__(self, parent)"
},
{
"docstring": "Start drag",
"name": "startDrag",
"signature": "def startDrag(self, dropAction)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019874 | Implement the Python class `TreeWidgetRepository` described below.
Class description:
Tree widget
Method signatures and docstrings:
- def __init__(self, parent): Treewidget constructor
- def startDrag(self, dropAction): Start drag | Implement the Python class `TreeWidgetRepository` described below.
Class description:
Tree widget
Method signatures and docstrings:
- def __init__(self, parent): Treewidget constructor
- def startDrag(self, dropAction): Start drag
<|skeleton|>
class TreeWidgetRepository:
"""Tree widget"""
def __init__(self,... | 66f65dd6e4a48909120f63239f630147c733df3f | <|skeleton|>
class TreeWidgetRepository:
"""Tree widget"""
def __init__(self, parent):
"""Treewidget constructor"""
<|body_0|>
def startDrag(self, dropAction):
"""Start drag"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TreeWidgetRepository:
"""Tree widget"""
def __init__(self, parent):
"""Treewidget constructor"""
QTreeWidget.__init__(self, parent)
self.setDragDropMode(QAbstractItemView.DragDrop)
self.setDragEnabled(True)
def startDrag(self, dropAction):
"""Start drag"""
... | the_stack_v2_python_sparse | Workspace/Repositories/LocalRepository.py | ExtensiveAutomation/extensiveautomation-appclient | train | 2 |
80abdd2f18db5880eb9ab97fe1bca6e48d66ef34 | [
"print()\nprint('-+- ' * 40)\nlog.debug('ROUTE class : %s', self.__class__.__name__)\nlog.debug('payload : \\n{}'.format(pformat(ns.payload)))\nclaims = get_jwt_claims()\nlog.debug('claims : \\n %s', pformat(claims))\nupdated_doc, response_code = Query_db_update(ns, models, document_type, usr_id, claims, roles_for_... | <|body_start_0|>
print()
print('-+- ' * 40)
log.debug('ROUTE class : %s', self.__class__.__name__)
log.debug('payload : \n{}'.format(pformat(ns.payload)))
claims = get_jwt_claims()
log.debug('claims : \n %s', pformat(claims))
updated_doc, response_code = Query_db_... | usr edition : PUT - Updates usr infos DELETE - Let you delete document | Usr_edit | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Usr_edit:
"""usr edition : PUT - Updates usr infos DELETE - Let you delete document"""
def put(self, usr_id):
"""Update a usr in db > --- needs : a valid access_token in the header, field_to_update, field_value >>> returns : msg, doc data"""
<|body_0|>
def delete(self, u... | stack_v2_sparse_classes_36k_train_025204 | 8,902 | permissive | [
{
"docstring": "Update a usr in db > --- needs : a valid access_token in the header, field_to_update, field_value >>> returns : msg, doc data",
"name": "put",
"signature": "def put(self, usr_id)"
},
{
"docstring": "Delete an user given its _id / only doable by admin or current_user > --- needs :... | 2 | stack_v2_sparse_classes_30k_train_009180 | Implement the Python class `Usr_edit` described below.
Class description:
usr edition : PUT - Updates usr infos DELETE - Let you delete document
Method signatures and docstrings:
- def put(self, usr_id): Update a usr in db > --- needs : a valid access_token in the header, field_to_update, field_value >>> returns : ms... | Implement the Python class `Usr_edit` described below.
Class description:
usr edition : PUT - Updates usr infos DELETE - Let you delete document
Method signatures and docstrings:
- def put(self, usr_id): Update a usr in db > --- needs : a valid access_token in the header, field_to_update, field_value >>> returns : ms... | 08ba9151069f2f633461f5166b1954fdeac7854a | <|skeleton|>
class Usr_edit:
"""usr edition : PUT - Updates usr infos DELETE - Let you delete document"""
def put(self, usr_id):
"""Update a usr in db > --- needs : a valid access_token in the header, field_to_update, field_value >>> returns : msg, doc data"""
<|body_0|>
def delete(self, u... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Usr_edit:
"""usr edition : PUT - Updates usr infos DELETE - Let you delete document"""
def put(self, usr_id):
"""Update a usr in db > --- needs : a valid access_token in the header, field_to_update, field_value >>> returns : msg, doc data"""
print()
print('-+- ' * 40)
log.... | the_stack_v2_python_sparse | solidata_api/api/api_users/endpoint_usr_edit.py | entrepreneur-interet-general/solidata_backend | train | 9 |
ee969d6a31168481b702b244abde113f7fd48c99 | [
"dict = {'id': self.id, 'uuid': self.uuid, 'senderNumber': self.senderNumber, 'processed': bool(self.processed), 'contact': self.contact.to_dict() if self.contact else None, 'application': self.application.to_dict() if self.application else None, 'text': self.text, 'received': self.received.isoformat(sep=' ') if se... | <|body_start_0|>
dict = {'id': self.id, 'uuid': self.uuid, 'senderNumber': self.senderNumber, 'processed': bool(self.processed), 'contact': self.contact.to_dict() if self.contact else None, 'application': self.application.to_dict() if self.application else None, 'text': self.text, 'received': self.received.isof... | Inbox model | Inbox | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Inbox:
"""Inbox model"""
def to_dict(self, properties=None):
"""To dictionary :param properties: {list} of required properties :return: {dict}"""
<|body_0|>
def convert_multipart_messages(cls):
"""Converting multipart messages to single row in table"""
<|... | stack_v2_sparse_classes_36k_train_025205 | 4,449 | permissive | [
{
"docstring": "To dictionary :param properties: {list} of required properties :return: {dict}",
"name": "to_dict",
"signature": "def to_dict(self, properties=None)"
},
{
"docstring": "Converting multipart messages to single row in table",
"name": "convert_multipart_messages",
"signature... | 2 | stack_v2_sparse_classes_30k_train_015468 | Implement the Python class `Inbox` described below.
Class description:
Inbox model
Method signatures and docstrings:
- def to_dict(self, properties=None): To dictionary :param properties: {list} of required properties :return: {dict}
- def convert_multipart_messages(cls): Converting multipart messages to single row i... | Implement the Python class `Inbox` described below.
Class description:
Inbox model
Method signatures and docstrings:
- def to_dict(self, properties=None): To dictionary :param properties: {list} of required properties :return: {dict}
- def convert_multipart_messages(cls): Converting multipart messages to single row i... | 37a3be814fc32ad87eb2a0ecfd93aa46ef46e68d | <|skeleton|>
class Inbox:
"""Inbox model"""
def to_dict(self, properties=None):
"""To dictionary :param properties: {list} of required properties :return: {dict}"""
<|body_0|>
def convert_multipart_messages(cls):
"""Converting multipart messages to single row in table"""
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Inbox:
"""Inbox model"""
def to_dict(self, properties=None):
"""To dictionary :param properties: {list} of required properties :return: {dict}"""
dict = {'id': self.id, 'uuid': self.uuid, 'senderNumber': self.senderNumber, 'processed': bool(self.processed), 'contact': self.contact.to_dict... | the_stack_v2_python_sparse | smsgw/models/inbox.py | jajonsraviation/smsgw | train | 0 |
fd94796047c557b42d455180121d18b4c96ee72f | [
"from scoop.content.models.album import Album\nuuid = self.value\ncss_class = '{0}{1}'.format(' ' if 'class' in self.kwargs else '', self.kwargs.get('class', ''))\nalbum = Album.objects.get_by_uuid(uuid=uuid)\nreturn {'album': album, 'class': css_class}",
"base = super(AlbumInline, self).get_template_name()[0]\np... | <|body_start_0|>
from scoop.content.models.album import Album
uuid = self.value
css_class = '{0}{1}'.format(' ' if 'class' in self.kwargs else '', self.kwargs.get('class', ''))
album = Album.objects.get_by_uuid(uuid=uuid)
return {'album': album, 'class': css_class}
<|end_body_0|>... | Inline d'insertion d'album Format : {{album uuid [class=css]}} Exemple : {{album dF4y5P class="bordered"}} | AlbumInline | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlbumInline:
"""Inline d'insertion d'album Format : {{album uuid [class=css]}} Exemple : {{album dF4y5P class="bordered"}}"""
def get_context(self):
"""Renvoyer le contexte de rendu de l'inline"""
<|body_0|>
def get_template_name(self):
"""Renvoyer les chemin du ... | stack_v2_sparse_classes_36k_train_025206 | 6,816 | no_license | [
{
"docstring": "Renvoyer le contexte de rendu de l'inline",
"name": "get_context",
"signature": "def get_context(self)"
},
{
"docstring": "Renvoyer les chemin du template",
"name": "get_template_name",
"signature": "def get_template_name(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009349 | Implement the Python class `AlbumInline` described below.
Class description:
Inline d'insertion d'album Format : {{album uuid [class=css]}} Exemple : {{album dF4y5P class="bordered"}}
Method signatures and docstrings:
- def get_context(self): Renvoyer le contexte de rendu de l'inline
- def get_template_name(self): Re... | Implement the Python class `AlbumInline` described below.
Class description:
Inline d'insertion d'album Format : {{album uuid [class=css]}} Exemple : {{album dF4y5P class="bordered"}}
Method signatures and docstrings:
- def get_context(self): Renvoyer le contexte de rendu de l'inline
- def get_template_name(self): Re... | 8cef6f6e89c1990e2b25f83e54e0c3481d83b6d7 | <|skeleton|>
class AlbumInline:
"""Inline d'insertion d'album Format : {{album uuid [class=css]}} Exemple : {{album dF4y5P class="bordered"}}"""
def get_context(self):
"""Renvoyer le contexte de rendu de l'inline"""
<|body_0|>
def get_template_name(self):
"""Renvoyer les chemin du ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AlbumInline:
"""Inline d'insertion d'album Format : {{album uuid [class=css]}} Exemple : {{album dF4y5P class="bordered"}}"""
def get_context(self):
"""Renvoyer le contexte de rendu de l'inline"""
from scoop.content.models.album import Album
uuid = self.value
css_class = '... | the_stack_v2_python_sparse | scoop/content/util/inlines.py | artscoop/scoop | train | 0 |
5005814530be9ba2733a4cdea4499a2a09ee6907 | [
"self.stdout = sys.stdout\nself.cache = FileCacher()\nset_arguments(arguments)\nself.locals = {'__name__': '__console__', '__doc__': None}",
"try:\n sys.stdout = self.cache\n try:\n exec(script, self.locals)\n except SystemExit:\n raise\n except SyntaxError:\n formatted_lines = tr... | <|body_start_0|>
self.stdout = sys.stdout
self.cache = FileCacher()
set_arguments(arguments)
self.locals = {'__name__': '__console__', '__doc__': None}
<|end_body_0|>
<|body_start_1|>
try:
sys.stdout = self.cache
try:
exec(script, self.loc... | Class for running a Python script as interactive interpreter. | Shell | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Shell:
"""Class for running a Python script as interactive interpreter."""
def __init__(self, arguments):
"""Constructor."""
<|body_0|>
def run_code(self, script):
"""Function to run code."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.std... | stack_v2_sparse_classes_36k_train_025207 | 7,287 | no_license | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self, arguments)"
},
{
"docstring": "Function to run code.",
"name": "run_code",
"signature": "def run_code(self, script)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006946 | Implement the Python class `Shell` described below.
Class description:
Class for running a Python script as interactive interpreter.
Method signatures and docstrings:
- def __init__(self, arguments): Constructor.
- def run_code(self, script): Function to run code. | Implement the Python class `Shell` described below.
Class description:
Class for running a Python script as interactive interpreter.
Method signatures and docstrings:
- def __init__(self, arguments): Constructor.
- def run_code(self, script): Function to run code.
<|skeleton|>
class Shell:
"""Class for running a... | 4648e48f4e290e5a1e5558acaf05431982acb81a | <|skeleton|>
class Shell:
"""Class for running a Python script as interactive interpreter."""
def __init__(self, arguments):
"""Constructor."""
<|body_0|>
def run_code(self, script):
"""Function to run code."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Shell:
"""Class for running a Python script as interactive interpreter."""
def __init__(self, arguments):
"""Constructor."""
self.stdout = sys.stdout
self.cache = FileCacher()
set_arguments(arguments)
self.locals = {'__name__': '__console__', '__doc__': None}
... | the_stack_v2_python_sparse | activities_python/actions/action_run_script.py | mikhail-rozhkov/cicso_lab | train | 0 |
a3791a17b18ff05cb6db872be03e904578063431 | [
"self.minValue = minValue\nself.maxValue = maxValue\nself.__inRangeValidator = IsInRange()",
"self.__inRangeValidator.minValue = _toDecimal(self.minValue)\nself.__inRangeValidator.maxValue = _toDecimal(self.maxValue)\nself.__inRangeValidator(_toDecimal(value))"
] | <|body_start_0|>
self.minValue = minValue
self.maxValue = maxValue
self.__inRangeValidator = IsInRange()
<|end_body_0|>
<|body_start_1|>
self.__inRangeValidator.minValue = _toDecimal(self.minValue)
self.__inRangeValidator.maxValue = _toDecimal(self.maxValue)
self.__inRan... | Class for checking boundaries of decimal values. | IsDecimalInRange | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IsDecimalInRange:
"""Class for checking boundaries of decimal values."""
def __init__(self, minValue, maxValue):
"""@param minValue: The lower bound. @type minValue: C{decimal.Decimal}, C{int}, C{long}, C{float} @param maxValue: The upper bound. @type maxValue: C{decimal.Decimal}, C{... | stack_v2_sparse_classes_36k_train_025208 | 13,874 | no_license | [
{
"docstring": "@param minValue: The lower bound. @type minValue: C{decimal.Decimal}, C{int}, C{long}, C{float} @param maxValue: The upper bound. @type maxValue: C{decimal.Decimal}, C{int}, C{long}, C{float}",
"name": "__init__",
"signature": "def __init__(self, minValue, maxValue)"
},
{
"docstr... | 2 | null | Implement the Python class `IsDecimalInRange` described below.
Class description:
Class for checking boundaries of decimal values.
Method signatures and docstrings:
- def __init__(self, minValue, maxValue): @param minValue: The lower bound. @type minValue: C{decimal.Decimal}, C{int}, C{long}, C{float} @param maxValue... | Implement the Python class `IsDecimalInRange` described below.
Class description:
Class for checking boundaries of decimal values.
Method signatures and docstrings:
- def __init__(self, minValue, maxValue): @param minValue: The lower bound. @type minValue: C{decimal.Decimal}, C{int}, C{long}, C{float} @param maxValue... | 958fda4f3064f9f6b2034da396a20ac9d9abd52f | <|skeleton|>
class IsDecimalInRange:
"""Class for checking boundaries of decimal values."""
def __init__(self, minValue, maxValue):
"""@param minValue: The lower bound. @type minValue: C{decimal.Decimal}, C{int}, C{long}, C{float} @param maxValue: The upper bound. @type maxValue: C{decimal.Decimal}, C{... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IsDecimalInRange:
"""Class for checking boundaries of decimal values."""
def __init__(self, minValue, maxValue):
"""@param minValue: The lower bound. @type minValue: C{decimal.Decimal}, C{int}, C{long}, C{float} @param maxValue: The upper bound. @type maxValue: C{decimal.Decimal}, C{int}, C{long}... | the_stack_v2_python_sparse | src/datafinder/core/configuration/properties/validators/base_validators.py | DLR-SC/DataFinder | train | 9 |
af76bd56c70a5114c2653097226efa9b0f2f7067 | [
"n = len(stones)\nmemo = [[[-1] * 2 for _ in range(n)] for j in range(n)]\nsm = sum(stones)\n\ndef helper(l, r, ID, left):\n if r < l:\n return 0\n if memo[l][r][ID] != -1:\n return memo[l][r][ID]\n ne = 1 if ID == 0 else 0\n if ID == 1:\n memo[l][r][ID] = max(left - stones[l] + hel... | <|body_start_0|>
n = len(stones)
memo = [[[-1] * 2 for _ in range(n)] for j in range(n)]
sm = sum(stones)
def helper(l, r, ID, left):
if r < l:
return 0
if memo[l][r][ID] != -1:
return memo[l][r][ID]
ne = 1 if ID == 0 e... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def stoneGameVIITLE(self, stones):
""":type stones: List[int] :rtype: int"""
<|body_0|>
def stoneGameVII(self, stones):
""":type stones: List[int] :rtype: int"""
<|body_1|>
def stoneGameVIIDP(self, stones):
""":type stones: List[int] :r... | stack_v2_sparse_classes_36k_train_025209 | 4,232 | no_license | [
{
"docstring": ":type stones: List[int] :rtype: int",
"name": "stoneGameVIITLE",
"signature": "def stoneGameVIITLE(self, stones)"
},
{
"docstring": ":type stones: List[int] :rtype: int",
"name": "stoneGameVII",
"signature": "def stoneGameVII(self, stones)"
},
{
"docstring": ":typ... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def stoneGameVIITLE(self, stones): :type stones: List[int] :rtype: int
- def stoneGameVII(self, stones): :type stones: List[int] :rtype: int
- def stoneGameVIIDP(self, stones): :... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def stoneGameVIITLE(self, stones): :type stones: List[int] :rtype: int
- def stoneGameVII(self, stones): :type stones: List[int] :rtype: int
- def stoneGameVIIDP(self, stones): :... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def stoneGameVIITLE(self, stones):
""":type stones: List[int] :rtype: int"""
<|body_0|>
def stoneGameVII(self, stones):
""":type stones: List[int] :rtype: int"""
<|body_1|>
def stoneGameVIIDP(self, stones):
""":type stones: List[int] :r... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def stoneGameVIITLE(self, stones):
""":type stones: List[int] :rtype: int"""
n = len(stones)
memo = [[[-1] * 2 for _ in range(n)] for j in range(n)]
sm = sum(stones)
def helper(l, r, ID, left):
if r < l:
return 0
if mem... | the_stack_v2_python_sparse | S/StoneGameVII.py | bssrdf/pyleet | train | 2 | |
63720050e77782b857fd001ea0985f1da416b840 | [
"self.numIslands = 0\nif not grid:\n return 0\nnumRows = len(grid)\nnumCols = len(grid[0])\n\ndef isValid(grid, row, col):\n return row >= 0 and col >= 0 and (row < numRows) and (col < numCols) and (grid[row][col] == '1')\n\ndef bfs(grid, row, col):\n self.numIslands += 1\n stack = [(row, col)]\n whi... | <|body_start_0|>
self.numIslands = 0
if not grid:
return 0
numRows = len(grid)
numCols = len(grid[0])
def isValid(grid, row, col):
return row >= 0 and col >= 0 and (row < numRows) and (col < numCols) and (grid[row][col] == '1')
def bfs(grid, row,... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numIslands(self, grid):
""":type grid: List[List[str]] :rtype: int"""
<|body_0|>
def numIslandsDFS(self, grid):
""":type grid: List[List[str]] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.numIslands = 0
if n... | stack_v2_sparse_classes_36k_train_025210 | 4,234 | no_license | [
{
"docstring": ":type grid: List[List[str]] :rtype: int",
"name": "numIslands",
"signature": "def numIslands(self, grid)"
},
{
"docstring": ":type grid: List[List[str]] :rtype: int",
"name": "numIslandsDFS",
"signature": "def numIslandsDFS(self, grid)"
}
] | 2 | stack_v2_sparse_classes_30k_train_021640 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numIslands(self, grid): :type grid: List[List[str]] :rtype: int
- def numIslandsDFS(self, grid): :type grid: List[List[str]] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numIslands(self, grid): :type grid: List[List[str]] :rtype: int
- def numIslandsDFS(self, grid): :type grid: List[List[str]] :rtype: int
<|skeleton|>
class Solution:
de... | 28219fbc5e2e96f59e9d2b9d1da18f05187898c8 | <|skeleton|>
class Solution:
def numIslands(self, grid):
""":type grid: List[List[str]] :rtype: int"""
<|body_0|>
def numIslandsDFS(self, grid):
""":type grid: List[List[str]] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def numIslands(self, grid):
""":type grid: List[List[str]] :rtype: int"""
self.numIslands = 0
if not grid:
return 0
numRows = len(grid)
numCols = len(grid[0])
def isValid(grid, row, col):
return row >= 0 and col >= 0 and (row <... | the_stack_v2_python_sparse | 2018/200-number-of-islands.py | the-potato-man/lc | train | 0 | |
1aedacd65b28e892af82b6d63e0cc404b2b67712 | [
"context = super()._get_context(*args, **kwargs)\nprogram_pk = context['program_pk']\nraw_indicator_types = list(IndicatorType.objects.select_related(None).prefetch_related(None).filter(indicator__program_id=program_pk).distinct().values('pk', name=models.F('indicator_type')))\nfor indicator_type in raw_indicator_t... | <|body_start_0|>
context = super()._get_context(*args, **kwargs)
program_pk = context['program_pk']
raw_indicator_types = list(IndicatorType.objects.select_related(None).prefetch_related(None).filter(indicator__program_id=program_pk).distinct().values('pk', name=models.F('indicator_type')))
... | Program Serializer component which loads JSON data consumed by filter portion of IPTT React App | IPTTProgramFilterItemsMixin | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IPTTProgramFilterItemsMixin:
"""Program Serializer component which loads JSON data consumed by filter portion of IPTT React App"""
def _get_context(cls, *args, **kwargs):
"""Extends parent context for initializing data, includes all related objects for populating filter lists"""
... | stack_v2_sparse_classes_36k_train_025211 | 10,971 | permissive | [
{
"docstring": "Extends parent context for initializing data, includes all related objects for populating filter lists",
"name": "_get_context",
"signature": "def _get_context(cls, *args, **kwargs)"
},
{
"docstring": "returns \"Outcome Chain\" or \"Chaîne Résultat\" for labeling the ordering fil... | 3 | null | Implement the Python class `IPTTProgramFilterItemsMixin` described below.
Class description:
Program Serializer component which loads JSON data consumed by filter portion of IPTT React App
Method signatures and docstrings:
- def _get_context(cls, *args, **kwargs): Extends parent context for initializing data, include... | Implement the Python class `IPTTProgramFilterItemsMixin` described below.
Class description:
Program Serializer component which loads JSON data consumed by filter portion of IPTT React App
Method signatures and docstrings:
- def _get_context(cls, *args, **kwargs): Extends parent context for initializing data, include... | 7ca89ab1e5f55cbe4577d16d7281c6cf0936fc3d | <|skeleton|>
class IPTTProgramFilterItemsMixin:
"""Program Serializer component which loads JSON data consumed by filter portion of IPTT React App"""
def _get_context(cls, *args, **kwargs):
"""Extends parent context for initializing data, includes all related objects for populating filter lists"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IPTTProgramFilterItemsMixin:
"""Program Serializer component which loads JSON data consumed by filter portion of IPTT React App"""
def _get_context(cls, *args, **kwargs):
"""Extends parent context for initializing data, includes all related objects for populating filter lists"""
context =... | the_stack_v2_python_sparse | workflow/serializers_new/iptt_program_serializers.py | mercycorps/toladata | train | 0 |
66c4ccf98064ab0ce30d4bc2dcc48515c1e4d270 | [
"if not root:\n return ''\nstack = [root]\nres = []\nwhile stack:\n node = stack.pop()\n res.append(str(node.val))\n if node.right:\n stack.append(node.right)\n if node.left:\n stack.append(node.left)\nreturn ' '.join(res)",
"def insert(root, val):\n if not root:\n return Tr... | <|body_start_0|>
if not root:
return ''
stack = [root]
res = []
while stack:
node = stack.pop()
res.append(str(node.val))
if node.right:
stack.append(node.right)
if node.left:
stack.append(node.le... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_025212 | 1,615 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | 4509f4b2b83e172e6ccc21ff89fc1204e0c6b3f3 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
if not root:
return ''
stack = [root]
res = []
while stack:
node = stack.pop()
res.append(str(node.val))
if node.r... | the_stack_v2_python_sparse | Problems/449. Serialize and Deserialize BST.py | aidardarmesh/leetcode | train | 6 | |
77e76addd3928f0121f333fcca306eea7ce8cec2 | [
"agent = request.user\ncur_device_mbs = request.data.get('megabytes', False)\nmac = request.data.get('mac', '')\nif not cur_device_mbs:\n return Response({'detail': 'Value not provided!'}, status=400)\nusage_qs = DataUsage.objects.filter(Q(agent=agent))\nif usage_qs.exists() > 0:\n usage = usage_qs.order_by('... | <|body_start_0|>
agent = request.user
cur_device_mbs = request.data.get('megabytes', False)
mac = request.data.get('mac', '')
if not cur_device_mbs:
return Response({'detail': 'Value not provided!'}, status=400)
usage_qs = DataUsage.objects.filter(Q(agent=agent))
... | DataUsageViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataUsageViewSet:
def create(self, request, format=None):
"""Sample Submit: --- { 'megabytes': 12.0, }"""
<|body_0|>
def retrieve(self, request, pk, format=None):
"""Sample response: --- { 'megabytes': 12.0, }"""
<|body_1|>
def list(self, request, format... | stack_v2_sparse_classes_36k_train_025213 | 27,493 | no_license | [
{
"docstring": "Sample Submit: --- { 'megabytes': 12.0, }",
"name": "create",
"signature": "def create(self, request, format=None)"
},
{
"docstring": "Sample response: --- { 'megabytes': 12.0, }",
"name": "retrieve",
"signature": "def retrieve(self, request, pk, format=None)"
},
{
... | 3 | null | Implement the Python class `DataUsageViewSet` described below.
Class description:
Implement the DataUsageViewSet class.
Method signatures and docstrings:
- def create(self, request, format=None): Sample Submit: --- { 'megabytes': 12.0, }
- def retrieve(self, request, pk, format=None): Sample response: --- { 'megabyte... | Implement the Python class `DataUsageViewSet` described below.
Class description:
Implement the DataUsageViewSet class.
Method signatures and docstrings:
- def create(self, request, format=None): Sample Submit: --- { 'megabytes': 12.0, }
- def retrieve(self, request, pk, format=None): Sample response: --- { 'megabyte... | 11be165f85cda0ffe7a237d011de562d3dc64135 | <|skeleton|>
class DataUsageViewSet:
def create(self, request, format=None):
"""Sample Submit: --- { 'megabytes': 12.0, }"""
<|body_0|>
def retrieve(self, request, pk, format=None):
"""Sample response: --- { 'megabytes': 12.0, }"""
<|body_1|>
def list(self, request, format... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataUsageViewSet:
def create(self, request, format=None):
"""Sample Submit: --- { 'megabytes': 12.0, }"""
agent = request.user
cur_device_mbs = request.data.get('megabytes', False)
mac = request.data.get('mac', '')
if not cur_device_mbs:
return Response({'de... | the_stack_v2_python_sparse | apps/user/views.py | ash018/FFTracker | train | 0 | |
66cdf4af3e7fe7f49638d6c970c8fa00ef35feed | [
"self.__screen = screen\nself.__msg = TextboxReflowed(40, WINDOW_MSG)\nself.__buttonsBar = ButtonBar(self.__screen, [(BUTTON_OK, 'ok'), ('Back', 'back')])\nself.__passwd = Entry(24, '', password=1)\nself.__passwdConfirm = Entry(24, '', password=1)\nself.__passwdLabel = Label(PASSWD_LABEL)\nself.__passwdConfirmLabel... | <|body_start_0|>
self.__screen = screen
self.__msg = TextboxReflowed(40, WINDOW_MSG)
self.__buttonsBar = ButtonBar(self.__screen, [(BUTTON_OK, 'ok'), ('Back', 'back')])
self.__passwd = Entry(24, '', password=1)
self.__passwdConfirm = Entry(24, '', password=1)
self.__passw... | Represents the root password screen | RootPasswordWindow | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RootPasswordWindow:
"""Represents the root password screen"""
def __init__(self, screen):
"""Constructor @type screen: SnackScreen @param screen: SnackScreen instance"""
<|body_0|>
def __show(self):
"""Shows screen once @rtype: integer @returns: status of operati... | stack_v2_sparse_classes_36k_train_025214 | 3,275 | no_license | [
{
"docstring": "Constructor @type screen: SnackScreen @param screen: SnackScreen instance",
"name": "__init__",
"signature": "def __init__(self, screen)"
},
{
"docstring": "Shows screen once @rtype: integer @returns: status of operation",
"name": "__show",
"signature": "def __show(self)"... | 3 | stack_v2_sparse_classes_30k_train_005955 | Implement the Python class `RootPasswordWindow` described below.
Class description:
Represents the root password screen
Method signatures and docstrings:
- def __init__(self, screen): Constructor @type screen: SnackScreen @param screen: SnackScreen instance
- def __show(self): Shows screen once @rtype: integer @retur... | Implement the Python class `RootPasswordWindow` described below.
Class description:
Represents the root password screen
Method signatures and docstrings:
- def __init__(self, screen): Constructor @type screen: SnackScreen @param screen: SnackScreen instance
- def __show(self): Shows screen once @rtype: integer @retur... | 1c738fd5e6ee3f8fd4f47acf2207038f20868212 | <|skeleton|>
class RootPasswordWindow:
"""Represents the root password screen"""
def __init__(self, screen):
"""Constructor @type screen: SnackScreen @param screen: SnackScreen instance"""
<|body_0|>
def __show(self):
"""Shows screen once @rtype: integer @returns: status of operati... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RootPasswordWindow:
"""Represents the root password screen"""
def __init__(self, screen):
"""Constructor @type screen: SnackScreen @param screen: SnackScreen instance"""
self.__screen = screen
self.__msg = TextboxReflowed(40, WINDOW_MSG)
self.__buttonsBar = ButtonBar(self.... | the_stack_v2_python_sparse | zfrobisher-installer/src/ui/rootpasswordcfg/rootpasswordwindow.py | fedosu85nce/work | train | 2 |
c6a89f14f95b00f4923eac9b31d5efc959457afd | [
"if len(initial_counter_block) == prefix_len + counter_len:\n self.nonce = _copy_bytes(None, prefix_len, initial_counter_block)\n 'Nonce; not available if there is a fixed suffix'\nself._state = VoidPointer()\nresult = raw_ctr_lib.CTR_start_operation(block_cipher.get(), c_uint8_ptr(initial_counter_block), c_s... | <|body_start_0|>
if len(initial_counter_block) == prefix_len + counter_len:
self.nonce = _copy_bytes(None, prefix_len, initial_counter_block)
'Nonce; not available if there is a fixed suffix'
self._state = VoidPointer()
result = raw_ctr_lib.CTR_start_operation(block_ciphe... | *CounTeR (CTR)* mode. This mode is very similar to ECB, in that encryption of one block is done independently of all other blocks. Unlike ECB, the block *position* contributes to the encryption and no information leaks about symbol frequency. Each message block is associated to a *counter* which must be unique across a... | CtrMode | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CtrMode:
"""*CounTeR (CTR)* mode. This mode is very similar to ECB, in that encryption of one block is done independently of all other blocks. Unlike ECB, the block *position* contributes to the encryption and no information leaks about symbol frequency. Each message block is associated to a *cou... | stack_v2_sparse_classes_36k_train_025215 | 15,880 | permissive | [
{
"docstring": "Create a new block cipher, configured in CTR mode. :Parameters: block_cipher : C pointer A smart pointer to the low-level block cipher instance. initial_counter_block : bytes/bytearray/memoryview The initial plaintext to use to generate the key stream. It is as large as the cipher block, and it ... | 3 | stack_v2_sparse_classes_30k_train_001558 | Implement the Python class `CtrMode` described below.
Class description:
*CounTeR (CTR)* mode. This mode is very similar to ECB, in that encryption of one block is done independently of all other blocks. Unlike ECB, the block *position* contributes to the encryption and no information leaks about symbol frequency. Eac... | Implement the Python class `CtrMode` described below.
Class description:
*CounTeR (CTR)* mode. This mode is very similar to ECB, in that encryption of one block is done independently of all other blocks. Unlike ECB, the block *position* contributes to the encryption and no information leaks about symbol frequency. Eac... | fa82044a2dc2f0f1f7454f5394e6d68fa923c289 | <|skeleton|>
class CtrMode:
"""*CounTeR (CTR)* mode. This mode is very similar to ECB, in that encryption of one block is done independently of all other blocks. Unlike ECB, the block *position* contributes to the encryption and no information leaks about symbol frequency. Each message block is associated to a *cou... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CtrMode:
"""*CounTeR (CTR)* mode. This mode is very similar to ECB, in that encryption of one block is done independently of all other blocks. Unlike ECB, the block *position* contributes to the encryption and no information leaks about symbol frequency. Each message block is associated to a *counter* which m... | the_stack_v2_python_sparse | venv/lib/python3.6/site-packages/Crypto/Cipher/_mode_ctr.py | masora1030/eigoyurusan | train | 11 |
4dd6533dc0634bca5c0166663869350d57b79e9b | [
"self._arr = arr\nself._n = len(arr)\nself._row = 0\nself._col = 0",
"while self._row < self._n and (not self._arr[self._row]):\n self._row += 1\n self._col = 0\nif self._row >= self._n:\n raise ValueError('No element left')\nanswer = self._arr[self._row][self._col]\nif self._col == len(self._arr[self._r... | <|body_start_0|>
self._arr = arr
self._n = len(arr)
self._row = 0
self._col = 0
<|end_body_0|>
<|body_start_1|>
while self._row < self._n and (not self._arr[self._row]):
self._row += 1
self._col = 0
if self._row >= self._n:
raise Value... | Iterator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Iterator:
def __init__(self, arr):
"""initialize Iterator object with an array of arrays"""
<|body_0|>
def next(self):
"""returns the next element in the array of arrays"""
<|body_1|>
def has_next(self):
"""returns whether or not the iterator sti... | stack_v2_sparse_classes_36k_train_025216 | 2,888 | no_license | [
{
"docstring": "initialize Iterator object with an array of arrays",
"name": "__init__",
"signature": "def __init__(self, arr)"
},
{
"docstring": "returns the next element in the array of arrays",
"name": "next",
"signature": "def next(self)"
},
{
"docstring": "returns whether or... | 3 | stack_v2_sparse_classes_30k_train_010480 | Implement the Python class `Iterator` described below.
Class description:
Implement the Iterator class.
Method signatures and docstrings:
- def __init__(self, arr): initialize Iterator object with an array of arrays
- def next(self): returns the next element in the array of arrays
- def has_next(self): returns whethe... | Implement the Python class `Iterator` described below.
Class description:
Implement the Iterator class.
Method signatures and docstrings:
- def __init__(self, arr): initialize Iterator object with an array of arrays
- def next(self): returns the next element in the array of arrays
- def has_next(self): returns whethe... | 4ad9063188e07e27a539d42140dabfdcaca608af | <|skeleton|>
class Iterator:
def __init__(self, arr):
"""initialize Iterator object with an array of arrays"""
<|body_0|>
def next(self):
"""returns the next element in the array of arrays"""
<|body_1|>
def has_next(self):
"""returns whether or not the iterator sti... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Iterator:
def __init__(self, arr):
"""initialize Iterator object with an array of arrays"""
self._arr = arr
self._n = len(arr)
self._row = 0
self._col = 0
def next(self):
"""returns the next element in the array of arrays"""
while self._row < self._... | the_stack_v2_python_sparse | python/166.py | lakshyatyagi24/daily-coding-problems | train | 1 | |
011ed98a200c3421844ba9d0e14bad46542d203a | [
"import Intelligence\nres = Intelligence.Intelligence.startprint(self)\nexp = 'Welcome to the Dice Game of life. We will play using the rules of Pig. One dice.' + '\\nYour rolled numbers will add together.' + '\\nYou may also hold at anytime, which will add your numbers together and give the turn to the other playe... | <|body_start_0|>
import Intelligence
res = Intelligence.Intelligence.startprint(self)
exp = 'Welcome to the Dice Game of life. We will play using the rules of Pig. One dice.' + '\nYour rolled numbers will add together.' + '\nYou may also hold at anytime, which will add your numbers together and ... | This is the unittest for the class Intelligence | intelligencetest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class intelligencetest:
"""This is the unittest for the class Intelligence"""
def teststartprint(self):
"""Tests if the starting print is correct"""
<|body_0|>
def testAImode(self):
"""Tests if the AI setting is correct, if hardcoded to 20"""
<|body_1|>
de... | stack_v2_sparse_classes_36k_train_025217 | 1,576 | permissive | [
{
"docstring": "Tests if the starting print is correct",
"name": "teststartprint",
"signature": "def teststartprint(self)"
},
{
"docstring": "Tests if the AI setting is correct, if hardcoded to 20",
"name": "testAImode",
"signature": "def testAImode(self)"
},
{
"docstring": "Test... | 3 | stack_v2_sparse_classes_30k_train_008092 | Implement the Python class `intelligencetest` described below.
Class description:
This is the unittest for the class Intelligence
Method signatures and docstrings:
- def teststartprint(self): Tests if the starting print is correct
- def testAImode(self): Tests if the AI setting is correct, if hardcoded to 20
- def te... | Implement the Python class `intelligencetest` described below.
Class description:
This is the unittest for the class Intelligence
Method signatures and docstrings:
- def teststartprint(self): Tests if the starting print is correct
- def testAImode(self): Tests if the AI setting is correct, if hardcoded to 20
- def te... | 73a8962c762ff48da331c9212f10676f066ed940 | <|skeleton|>
class intelligencetest:
"""This is the unittest for the class Intelligence"""
def teststartprint(self):
"""Tests if the starting print is correct"""
<|body_0|>
def testAImode(self):
"""Tests if the AI setting is correct, if hardcoded to 20"""
<|body_1|>
de... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class intelligencetest:
"""This is the unittest for the class Intelligence"""
def teststartprint(self):
"""Tests if the starting print is correct"""
import Intelligence
res = Intelligence.Intelligence.startprint(self)
exp = 'Welcome to the Dice Game of life. We will play using t... | the_stack_v2_python_sparse | methoddice/testintelligence.py | JohanK91/MethodDice | train | 0 |
2de5036a7a089c7c99425d83c4510d2e8881f2cb | [
"try:\n queryset = self.get_all_objects(User)\n print(queryset)\n serializer = serializers.UserSerializer(queryset, many=True)\n return Utils.dispatch_success(request, serializer.data)\nexcept Exception as e:\n return self.internal_server_error(request, e)",
"try:\n serializer = serializers.Crea... | <|body_start_0|>
try:
queryset = self.get_all_objects(User)
print(queryset)
serializer = serializers.UserSerializer(queryset, many=True)
return Utils.dispatch_success(request, serializer.data)
except Exception as e:
return self.internal_server_... | Lists all users | UserList | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserList:
"""Lists all users"""
def get(self, request, *args, **kwargs):
"""Get the List of users :param request: :param args: :param kwargs: :return:"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Create New User :param request: { "username" : "98765... | stack_v2_sparse_classes_36k_train_025218 | 4,727 | permissive | [
{
"docstring": "Get the List of users :param request: :param args: :param kwargs: :return:",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "Create New User :param request: { \"username\" : \"9876543210\", \"first_name\":\"Team 1\", \"email\" : \"team1@gm... | 2 | stack_v2_sparse_classes_30k_train_013699 | Implement the Python class `UserList` described below.
Class description:
Lists all users
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Get the List of users :param request: :param args: :param kwargs: :return:
- def post(self, request, *args, **kwargs): Create New User :param request: ... | Implement the Python class `UserList` described below.
Class description:
Lists all users
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Get the List of users :param request: :param args: :param kwargs: :return:
- def post(self, request, *args, **kwargs): Create New User :param request: ... | 1e31affddf60d2de72445a85dd2055bdeba6f670 | <|skeleton|>
class UserList:
"""Lists all users"""
def get(self, request, *args, **kwargs):
"""Get the List of users :param request: :param args: :param kwargs: :return:"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Create New User :param request: { "username" : "98765... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserList:
"""Lists all users"""
def get(self, request, *args, **kwargs):
"""Get the List of users :param request: :param args: :param kwargs: :return:"""
try:
queryset = self.get_all_objects(User)
print(queryset)
serializer = serializers.UserSerializer(... | the_stack_v2_python_sparse | the_mechanic_backend/v0/accounts/views.py | muthukumar4999/the-mechanic-backend | train | 0 |
a477f460616fa41da37d52cf32d83cd7026acf2c | [
"q = taskqueue.Queue('tasks')\npayload = {'name': name, 'channel': channel, 'content': content}\ntask = q.add(taskqueue.Task(payload=json.dumps(payload), tag=channel, method='PULL'))\nLogger.log(op='add', channel=channel, name=name, id=task.name, status='OK')\nreturn task.name",
"q = taskqueue.Queue('tasks')\nif ... | <|body_start_0|>
q = taskqueue.Queue('tasks')
payload = {'name': name, 'channel': channel, 'content': content}
task = q.add(taskqueue.Task(payload=json.dumps(payload), tag=channel, method='PULL'))
Logger.log(op='add', channel=channel, name=name, id=task.name, status='OK')
return ... | TaskQueue | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TaskQueue:
def add(channel, name, content):
"""Add a task to the queue Args: channel name of the channel that the task will be added to name name of the task - this is only used for logging purposes content a json-serializable object with additional task-specific data. Can be None Return... | stack_v2_sparse_classes_36k_train_025219 | 4,421 | permissive | [
{
"docstring": "Add a task to the queue Args: channel name of the channel that the task will be added to name name of the task - this is only used for logging purposes content a json-serializable object with additional task-specific data. Can be None Returns: the task id of the newly added task",
"name": "a... | 3 | stack_v2_sparse_classes_30k_test_000423 | Implement the Python class `TaskQueue` described below.
Class description:
Implement the TaskQueue class.
Method signatures and docstrings:
- def add(channel, name, content): Add a task to the queue Args: channel name of the channel that the task will be added to name name of the task - this is only used for logging ... | Implement the Python class `TaskQueue` described below.
Class description:
Implement the TaskQueue class.
Method signatures and docstrings:
- def add(channel, name, content): Add a task to the queue Args: channel name of the channel that the task will be added to name name of the task - this is only used for logging ... | 21ca1e95f672b99c296eb3cbbc3c6b6b25402455 | <|skeleton|>
class TaskQueue:
def add(channel, name, content):
"""Add a task to the queue Args: channel name of the channel that the task will be added to name name of the task - this is only used for logging purposes content a json-serializable object with additional task-specific data. Can be None Return... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TaskQueue:
def add(channel, name, content):
"""Add a task to the queue Args: channel name of the channel that the task will be added to name name of the task - this is only used for logging purposes content a json-serializable object with additional task-specific data. Can be None Returns: the task id... | the_stack_v2_python_sparse | gae/taskqueue.py | SkyTruth/skytruth-automation-hub | train | 0 | |
31f5a45e28ccb77adff1f5f3761e9297a121f0cd | [
"if not root:\n return -1\nret = 1 + max((self.findLeavesHelper(child, results) for child in (root.left, root.right)))\nif ret >= len(results):\n results.append([])\nresults[ret].append(root.val)\nreturn ret",
"ret = []\nself.findLeavesHelper(root, ret)\nreturn ret"
] | <|body_start_0|>
if not root:
return -1
ret = 1 + max((self.findLeavesHelper(child, results) for child in (root.left, root.right)))
if ret >= len(results):
results.append([])
results[ret].append(root.val)
return ret
<|end_body_0|>
<|body_start_1|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findLeavesHelper(self, root, results):
"""push root and all descendants to results return the distance from root to farthest leaf"""
<|body_0|>
def findLeaves(self, root: TreeNode) -> List[List[int]]:
""":type root: TreeNode :rtype: List[List[int]]"""
... | stack_v2_sparse_classes_36k_train_025220 | 2,449 | no_license | [
{
"docstring": "push root and all descendants to results return the distance from root to farthest leaf",
"name": "findLeavesHelper",
"signature": "def findLeavesHelper(self, root, results)"
},
{
"docstring": ":type root: TreeNode :rtype: List[List[int]]",
"name": "findLeaves",
"signatur... | 2 | stack_v2_sparse_classes_30k_train_011502 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findLeavesHelper(self, root, results): push root and all descendants to results return the distance from root to farthest leaf
- def findLeaves(self, root: TreeNode) -> List[... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findLeavesHelper(self, root, results): push root and all descendants to results return the distance from root to farthest leaf
- def findLeaves(self, root: TreeNode) -> List[... | f2621cd76822a922c49b60f32931f26cce1c571d | <|skeleton|>
class Solution:
def findLeavesHelper(self, root, results):
"""push root and all descendants to results return the distance from root to farthest leaf"""
<|body_0|>
def findLeaves(self, root: TreeNode) -> List[List[int]]:
""":type root: TreeNode :rtype: List[List[int]]"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findLeavesHelper(self, root, results):
"""push root and all descendants to results return the distance from root to farthest leaf"""
if not root:
return -1
ret = 1 + max((self.findLeavesHelper(child, results) for child in (root.left, root.right)))
if r... | the_stack_v2_python_sparse | Tree_and_BST/021_leetcode_P_366_FindLeavesOfBinaryTree/Solution.py | Keshav1506/competitive_programming | train | 0 | |
57b30d95131db21294181d1dd891fdfd2850560c | [
"self.flowComputer = flowComputer\nallZeros = np.zeros((0, 2), dtype=np.uint8)\nself.previousStartP, self.previousEndP, self.previousGoodI = (allZeros.copy(), allZeros.copy(), allZeros.copy())\nself.currentStartP, self.currentEndP, self.currentGoodI = (allZeros.copy(), allZeros.copy(), allZeros.copy())",
"self.pr... | <|body_start_0|>
self.flowComputer = flowComputer
allZeros = np.zeros((0, 2), dtype=np.uint8)
self.previousStartP, self.previousEndP, self.previousGoodI = (allZeros.copy(), allZeros.copy(), allZeros.copy())
self.currentStartP, self.currentEndP, self.currentGoodI = (allZeros.copy(), allZe... | FlowDiffComputer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FlowDiffComputer:
def __init__(self, flowComputer):
"""Flow computer must have all the information required to compute flow. I leave to you correctly initializing this. From the flowComputer Object expects it to: *provide a apply method with the returnIndexes=True option available *provi... | stack_v2_sparse_classes_36k_train_025221 | 5,388 | no_license | [
{
"docstring": "Flow computer must have all the information required to compute flow. I leave to you correctly initializing this. From the flowComputer Object expects it to: *provide a apply method with the returnIndexes=True option available *provide a public grid field",
"name": "__init__",
"signature... | 2 | stack_v2_sparse_classes_30k_train_009193 | Implement the Python class `FlowDiffComputer` described below.
Class description:
Implement the FlowDiffComputer class.
Method signatures and docstrings:
- def __init__(self, flowComputer): Flow computer must have all the information required to compute flow. I leave to you correctly initializing this. From the flowC... | Implement the Python class `FlowDiffComputer` described below.
Class description:
Implement the FlowDiffComputer class.
Method signatures and docstrings:
- def __init__(self, flowComputer): Flow computer must have all the information required to compute flow. I leave to you correctly initializing this. From the flowC... | 68258959dc735f39a3079cd95997d77c996a8786 | <|skeleton|>
class FlowDiffComputer:
def __init__(self, flowComputer):
"""Flow computer must have all the information required to compute flow. I leave to you correctly initializing this. From the flowComputer Object expects it to: *provide a apply method with the returnIndexes=True option available *provi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FlowDiffComputer:
def __init__(self, flowComputer):
"""Flow computer must have all the information required to compute flow. I leave to you correctly initializing this. From the flowComputer Object expects it to: *provide a apply method with the returnIndexes=True option available *provide a public gr... | the_stack_v2_python_sparse | python/flowSubtractionExperiment/flowSubtraction.py | jzsampaio/SummerProject2015 | train | 0 | |
f3a956b2141053b8acb3a7d0271923fc3f9e103a | [
"assert issubclass(splitter.__class__, wx.SplitterWindow), u'SplitterWindow manager type error'\nsetattr(self, '_last_sash_position_%s' % splitter.GetId(), splitter.GetSashPosition())\nif resize_panel == 0:\n splitter.SetSashPosition(1, redraw=redraw)\nelif resize_panel == 1:\n split_mode = splitter.GetSplitM... | <|body_start_0|>
assert issubclass(splitter.__class__, wx.SplitterWindow), u'SplitterWindow manager type error'
setattr(self, '_last_sash_position_%s' % splitter.GetId(), splitter.GetSashPosition())
if resize_panel == 0:
splitter.SetSashPosition(1, redraw=redraw)
elif resize_... | Splitter window manager. | iqSplitterWindowManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class iqSplitterWindowManager:
"""Splitter window manager."""
def collapseSplitterWindowPanel(self, splitter, toolbar=None, collapse_tool=None, expand_tool=None, resize_panel=0, redraw=True):
"""Collapse the splitter panel. :param splitter: wx.SplitterWindow object. :param toolbar: ToolBar... | stack_v2_sparse_classes_36k_train_025222 | 3,572 | no_license | [
{
"docstring": "Collapse the splitter panel. :param splitter: wx.SplitterWindow object. :param toolbar: ToolBar object. :param collapse_tool: Collapse tool. :param expand_tool: Expand tool. :param resize_panel: Resizable panel index. :param redraw: Redrawing object? :return: True/False.",
"name": "collapseS... | 2 | null | Implement the Python class `iqSplitterWindowManager` described below.
Class description:
Splitter window manager.
Method signatures and docstrings:
- def collapseSplitterWindowPanel(self, splitter, toolbar=None, collapse_tool=None, expand_tool=None, resize_panel=0, redraw=True): Collapse the splitter panel. :param sp... | Implement the Python class `iqSplitterWindowManager` described below.
Class description:
Splitter window manager.
Method signatures and docstrings:
- def collapseSplitterWindowPanel(self, splitter, toolbar=None, collapse_tool=None, expand_tool=None, resize_panel=0, redraw=True): Collapse the splitter panel. :param sp... | 7550e242746cb2fb1219474463f8db21f8e3e114 | <|skeleton|>
class iqSplitterWindowManager:
"""Splitter window manager."""
def collapseSplitterWindowPanel(self, splitter, toolbar=None, collapse_tool=None, expand_tool=None, resize_panel=0, redraw=True):
"""Collapse the splitter panel. :param splitter: wx.SplitterWindow object. :param toolbar: ToolBar... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class iqSplitterWindowManager:
"""Splitter window manager."""
def collapseSplitterWindowPanel(self, splitter, toolbar=None, collapse_tool=None, expand_tool=None, resize_panel=0, redraw=True):
"""Collapse the splitter panel. :param splitter: wx.SplitterWindow object. :param toolbar: ToolBar object. :par... | the_stack_v2_python_sparse | iq/engine/wx/splitter_manager.py | XHermitOne/iq_framework | train | 1 |
b756604d267a19ea6b386f7d8b889b9a131ef5d2 | [
"user = request.user\ndata = request.GET\ntry:\n page_offset = int(data.get('page', 1))\n row_per_page = int(data.get('num', self.__DEFAULT_ROW_PER_PAGE))\n if row_per_page < 1 or page_offset < 1:\n raise ValueError\nexcept (KeyError, ValueError):\n return Response(err_result(ERROR_PARAM, u'参数错误'... | <|body_start_0|>
user = request.user
data = request.GET
try:
page_offset = int(data.get('page', 1))
row_per_page = int(data.get('num', self.__DEFAULT_ROW_PER_PAGE))
if row_per_page < 1 or page_offset < 1:
raise ValueError
except (KeyErr... | AppMyFavListView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AppMyFavListView:
def get(self, request, *args, **kwargs):
"""获取我的关注列表 :param request: :param args: :param kwargs: :return:"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""添加商品到我的关注 :param request: :param args: :param kwargs: :return:"""
<|body_1|>... | stack_v2_sparse_classes_36k_train_025223 | 4,827 | no_license | [
{
"docstring": "获取我的关注列表 :param request: :param args: :param kwargs: :return:",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "添加商品到我的关注 :param request: :param args: :param kwargs: :return:",
"name": "post",
"signature": "def post(self, request, ... | 2 | null | Implement the Python class `AppMyFavListView` described below.
Class description:
Implement the AppMyFavListView class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): 获取我的关注列表 :param request: :param args: :param kwargs: :return:
- def post(self, request, *args, **kwargs): 添加商品到我的关注 :para... | Implement the Python class `AppMyFavListView` described below.
Class description:
Implement the AppMyFavListView class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): 获取我的关注列表 :param request: :param args: :param kwargs: :return:
- def post(self, request, *args, **kwargs): 添加商品到我的关注 :para... | 3d6198c2a1abc97fa9286408f52c1f5153883b7a | <|skeleton|>
class AppMyFavListView:
def get(self, request, *args, **kwargs):
"""获取我的关注列表 :param request: :param args: :param kwargs: :return:"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""添加商品到我的关注 :param request: :param args: :param kwargs: :return:"""
<|body_1|>... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AppMyFavListView:
def get(self, request, *args, **kwargs):
"""获取我的关注列表 :param request: :param args: :param kwargs: :return:"""
user = request.user
data = request.GET
try:
page_offset = int(data.get('page', 1))
row_per_page = int(data.get('num', self.__DE... | the_stack_v2_python_sparse | stars/apps/api/wishlists/views.py | lisongwei15931/stars | train | 0 | |
d7444fac16ab4819ab6d3b09d864b1318cb022b5 | [
"last_page_number_css = '#paginacao > ul > li:nth-child(7) > button::attr(value)'\nlast_page_number = int(response.css(last_page_number_css).extract_first())\nfor page_number in range(1, last_page_number + 1):\n yield Request(f'https://gravatai.atende.net/?pg=diariooficial&pagina={page_number}', callback=self.pa... | <|body_start_0|>
last_page_number_css = '#paginacao > ul > li:nth-child(7) > button::attr(value)'
last_page_number = int(response.css(last_page_number_css).extract_first())
for page_number in range(1, last_page_number + 1):
yield Request(f'https://gravatai.atende.net/?pg=diariooficia... | RsGravataiSpider | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RsGravataiSpider:
def parse(self, response):
"""@url https://gravatai.atende.net/?pg=diariooficial @returns requests 1"""
<|body_0|>
def parse_gazette(self, response):
"""@url https://gravatai.atende.net/?pg=diariooficial&pagina=1 @returns items 1 @scrapes date file_... | stack_v2_sparse_classes_36k_train_025224 | 1,976 | permissive | [
{
"docstring": "@url https://gravatai.atende.net/?pg=diariooficial @returns requests 1",
"name": "parse",
"signature": "def parse(self, response)"
},
{
"docstring": "@url https://gravatai.atende.net/?pg=diariooficial&pagina=1 @returns items 1 @scrapes date file_urls is_extra_edition power",
... | 2 | null | Implement the Python class `RsGravataiSpider` described below.
Class description:
Implement the RsGravataiSpider class.
Method signatures and docstrings:
- def parse(self, response): @url https://gravatai.atende.net/?pg=diariooficial @returns requests 1
- def parse_gazette(self, response): @url https://gravatai.atend... | Implement the Python class `RsGravataiSpider` described below.
Class description:
Implement the RsGravataiSpider class.
Method signatures and docstrings:
- def parse(self, response): @url https://gravatai.atende.net/?pg=diariooficial @returns requests 1
- def parse_gazette(self, response): @url https://gravatai.atend... | 548a9b1b2718dc78ba8ccb06b36cf337543ad71d | <|skeleton|>
class RsGravataiSpider:
def parse(self, response):
"""@url https://gravatai.atende.net/?pg=diariooficial @returns requests 1"""
<|body_0|>
def parse_gazette(self, response):
"""@url https://gravatai.atende.net/?pg=diariooficial&pagina=1 @returns items 1 @scrapes date file_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RsGravataiSpider:
def parse(self, response):
"""@url https://gravatai.atende.net/?pg=diariooficial @returns requests 1"""
last_page_number_css = '#paginacao > ul > li:nth-child(7) > button::attr(value)'
last_page_number = int(response.css(last_page_number_css).extract_first())
... | the_stack_v2_python_sparse | data_collection/gazette/spiders/rs_gravatai.py | okfn-brasil/querido-diario | train | 402 | |
61dee8bbdd3e224d3d43d1c325a9de341ffd7bcf | [
"self.base_url = 'http://api.yundama.com/api.php'\nself.base_headers = {'User-Agent': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Maxthon 2.0)', 'Host': 'api.yundama.com', 'Referer': 'http://www.yundama.com/download/YDMHttp.html', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*... | <|body_start_0|>
self.base_url = 'http://api.yundama.com/api.php'
self.base_headers = {'User-Agent': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Maxthon 2.0)', 'Host': 'api.yundama.com', 'Referer': 'http://www.yundama.com/download/YDMHttp.html', 'Accept': 'text/html,application/xhtml+xml,applica... | class of YunDaMa, to identify captcha by yundama.com | YunDaMa | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class YunDaMa:
"""class of YunDaMa, to identify captcha by yundama.com"""
def __init__(self, user_name, pass_word, appid=None, appkey=None):
"""constructor"""
<|body_0|>
def get_captcha(self, file_name, file_bytes, file_type='image/jpeg', codetype='1000', repeat=10):
"... | stack_v2_sparse_classes_36k_train_025225 | 3,324 | permissive | [
{
"docstring": "constructor",
"name": "__init__",
"signature": "def __init__(self, user_name, pass_word, appid=None, appkey=None)"
},
{
"docstring": "get captcha result(cid, code), based on file_name, file_bytes, file_type :key: http://www.yundama.com/apidoc/YDM_ErrorCode.html :param codetype: h... | 4 | stack_v2_sparse_classes_30k_train_009970 | Implement the Python class `YunDaMa` described below.
Class description:
class of YunDaMa, to identify captcha by yundama.com
Method signatures and docstrings:
- def __init__(self, user_name, pass_word, appid=None, appkey=None): constructor
- def get_captcha(self, file_name, file_bytes, file_type='image/jpeg', codety... | Implement the Python class `YunDaMa` described below.
Class description:
class of YunDaMa, to identify captcha by yundama.com
Method signatures and docstrings:
- def __init__(self, user_name, pass_word, appid=None, appkey=None): constructor
- def get_captcha(self, file_name, file_bytes, file_type='image/jpeg', codety... | d7981ba9806cf89200ce249f727aabf96918b67d | <|skeleton|>
class YunDaMa:
"""class of YunDaMa, to identify captcha by yundama.com"""
def __init__(self, user_name, pass_word, appid=None, appkey=None):
"""constructor"""
<|body_0|>
def get_captcha(self, file_name, file_bytes, file_type='image/jpeg', codetype='1000', repeat=10):
"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class YunDaMa:
"""class of YunDaMa, to identify captcha by yundama.com"""
def __init__(self, user_name, pass_word, appid=None, appkey=None):
"""constructor"""
self.base_url = 'http://api.yundama.com/api.php'
self.base_headers = {'User-Agent': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows ... | the_stack_v2_python_sparse | cola/utilities/yundama.py | brightgems/cola | train | 1 |
af1dade54e8aa2d4cc19216a1896cb7dd9184dfd | [
"version = pcs.Field('version', 4, default=4)\nhlen = pcs.Field('hlen', 4)\ntos = pcs.Field('tos', 8)\nlength = pcs.Field('length', 16)\nid = pcs.Field('id', 16)\nflags = pcs.Field('flags', 3)\noffset = pcs.Field('offset', 13)\nttl = pcs.Field('ttl', 8, default=64)\nprotocol = pcs.Field('protocol', 8)\nchecksum = p... | <|body_start_0|>
version = pcs.Field('version', 4, default=4)
hlen = pcs.Field('hlen', 4)
tos = pcs.Field('tos', 8)
length = pcs.Field('length', 16)
id = pcs.Field('id', 16)
flags = pcs.Field('flags', 3)
offset = pcs.Field('offset', 13)
ttl = pcs.Field('tt... | ipv4 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ipv4:
def __init__(self, bytes=None):
"""define the fields of an IPv4 packet, from RFC 791 This version does not include options."""
<|body_0|>
def __str__(self):
"""Walk the entire packet and pretty print the values of the fields."""
<|body_1|>
def next... | stack_v2_sparse_classes_36k_train_025226 | 5,722 | no_license | [
{
"docstring": "define the fields of an IPv4 packet, from RFC 791 This version does not include options.",
"name": "__init__",
"signature": "def __init__(self, bytes=None)"
},
{
"docstring": "Walk the entire packet and pretty print the values of the fields.",
"name": "__str__",
"signatur... | 4 | stack_v2_sparse_classes_30k_train_001692 | Implement the Python class `ipv4` described below.
Class description:
Implement the ipv4 class.
Method signatures and docstrings:
- def __init__(self, bytes=None): define the fields of an IPv4 packet, from RFC 791 This version does not include options.
- def __str__(self): Walk the entire packet and pretty print the ... | Implement the Python class `ipv4` described below.
Class description:
Implement the ipv4 class.
Method signatures and docstrings:
- def __init__(self, bytes=None): define the fields of an IPv4 packet, from RFC 791 This version does not include options.
- def __str__(self): Walk the entire packet and pretty print the ... | a070a39586b582fbeea72abf12bbfd812955ad81 | <|skeleton|>
class ipv4:
def __init__(self, bytes=None):
"""define the fields of an IPv4 packet, from RFC 791 This version does not include options."""
<|body_0|>
def __str__(self):
"""Walk the entire packet and pretty print the values of the fields."""
<|body_1|>
def next... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ipv4:
def __init__(self, bytes=None):
"""define the fields of an IPv4 packet, from RFC 791 This version does not include options."""
version = pcs.Field('version', 4, default=4)
hlen = pcs.Field('hlen', 4)
tos = pcs.Field('tos', 8)
length = pcs.Field('length', 16)
... | the_stack_v2_python_sparse | src/pcs/packets/ipv4.py | bilouro/tcptest | train | 0 | |
d1a502f7e30589013315fbd4e60a1380f5463cc2 | [
"if len(matrix) is 0:\n return\nif len(matrix[0]) is 0:\n return\nself.__myRegion = matrix\nself.__rows = len(matrix)\nself.__cols = len(matrix[0])",
"result = 0\nfor i in range(row1, row2 + 1):\n for j in range(col1, col2 + 1):\n result += self.__myRegion[i][j]\nreturn result"
] | <|body_start_0|>
if len(matrix) is 0:
return
if len(matrix[0]) is 0:
return
self.__myRegion = matrix
self.__rows = len(matrix)
self.__cols = len(matrix[0])
<|end_body_0|>
<|body_start_1|>
result = 0
for i in range(row1, row2 + 1):
... | NumMatrix | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
<|body_0|>
def sumRegion(self, row1, col1, row2, col2):
""":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_36k_train_025227 | 826 | no_license | [
{
"docstring": ":type matrix: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, matrix)"
},
{
"docstring": ":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int",
"name": "sumRegion",
"signature": "def sumRegion(self, row1, col1, row2, col2)"
... | 2 | null | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): :type matrix: List[List[int]]
- def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:... | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): :type matrix: List[List[int]]
- def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:... | 79ca9fdc471a1c84fce188cb05d2ef7b2469eb69 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
<|body_0|>
def sumRegion(self, row1, col1, row2, col2):
""":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
if len(matrix) is 0:
return
if len(matrix[0]) is 0:
return
self.__myRegion = matrix
self.__rows = len(matrix)
self.__cols = len(matrix[0])
def sumRegion(self,... | the_stack_v2_python_sparse | sumRegion.py | athmey/MyLeetCode | train | 0 | |
36c30d786db70cfa6b033b9983b57b5b0ab9fae7 | [
"try:\n orgs_dto = OrganisationService.get_organisations_managed_by_user_as_dto(token_auth.current_user())\n if len(orgs_dto.organisations) < 1:\n raise ValueError('User not a Org Manager')\nexcept ValueError as e:\n error_msg = f'InterestsRestAPI GET: {str(e)}'\n return ({'Error': error_msg, 'Su... | <|body_start_0|>
try:
orgs_dto = OrganisationService.get_organisations_managed_by_user_as_dto(token_auth.current_user())
if len(orgs_dto.organisations) < 1:
raise ValueError('User not a Org Manager')
except ValueError as e:
error_msg = f'InterestsRestA... | InterestsRestAPI | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InterestsRestAPI:
def get(self, interest_id):
"""Get an existing interest --- tags: - interests produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - name: intere... | stack_v2_sparse_classes_36k_train_025228 | 8,447 | permissive | [
{
"docstring": "Get an existing interest --- tags: - interests produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - name: interest_id in: path description: Interest ID required: true ty... | 3 | null | Implement the Python class `InterestsRestAPI` described below.
Class description:
Implement the InterestsRestAPI class.
Method signatures and docstrings:
- def get(self, interest_id): Get an existing interest --- tags: - interests produces: - application/json parameters: - in: header name: Authorization description: ... | Implement the Python class `InterestsRestAPI` described below.
Class description:
Implement the InterestsRestAPI class.
Method signatures and docstrings:
- def get(self, interest_id): Get an existing interest --- tags: - interests produces: - application/json parameters: - in: header name: Authorization description: ... | 45bf3937c74902226096aee5b49e7abea62df524 | <|skeleton|>
class InterestsRestAPI:
def get(self, interest_id):
"""Get an existing interest --- tags: - interests produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - name: intere... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InterestsRestAPI:
def get(self, interest_id):
"""Get an existing interest --- tags: - interests produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - name: interest_id in: path... | the_stack_v2_python_sparse | backend/api/interests/resources.py | hotosm/tasking-manager | train | 526 | |
eea546c9627f70698af4bd5c1b753adcd3e5a8c0 | [
"for form in self.forms:\n status = form.cleaned_data.get('status')\n if not status:\n raise ValidationError('Keinen Status', 'error')",
"super(CustomStatusFormset, self).__init__(*args, **kwargs)\nfor form in self.forms:\n for field in form.fields:\n form.fields[field].widget.attrs.update(... | <|body_start_0|>
for form in self.forms:
status = form.cleaned_data.get('status')
if not status:
raise ValidationError('Keinen Status', 'error')
<|end_body_0|>
<|body_start_1|>
super(CustomStatusFormset, self).__init__(*args, **kwargs)
for form in self.fo... | Django BaseInlineFormset used to create SchadensmeldungStatus objects on Schadensmeldung creation | CustomStatusFormset | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CustomStatusFormset:
"""Django BaseInlineFormset used to create SchadensmeldungStatus objects on Schadensmeldung creation"""
def clean(self):
"""Custom clean method that raises ValidationError if a status is not selected"""
<|body_0|>
def __init__(self, *args, **kwargs):... | stack_v2_sparse_classes_36k_train_025229 | 9,202 | no_license | [
{
"docstring": "Custom clean method that raises ValidationError if a status is not selected",
"name": "clean",
"signature": "def clean(self)"
},
{
"docstring": "Custom __init__ method that adds Bootstrap styling to all fields",
"name": "__init__",
"signature": "def __init__(self, *args, ... | 2 | stack_v2_sparse_classes_30k_train_016707 | Implement the Python class `CustomStatusFormset` described below.
Class description:
Django BaseInlineFormset used to create SchadensmeldungStatus objects on Schadensmeldung creation
Method signatures and docstrings:
- def clean(self): Custom clean method that raises ValidationError if a status is not selected
- def ... | Implement the Python class `CustomStatusFormset` described below.
Class description:
Django BaseInlineFormset used to create SchadensmeldungStatus objects on Schadensmeldung creation
Method signatures and docstrings:
- def clean(self): Custom clean method that raises ValidationError if a status is not selected
- def ... | 2493b8d5c865452f75290566ba43cab548d573bd | <|skeleton|>
class CustomStatusFormset:
"""Django BaseInlineFormset used to create SchadensmeldungStatus objects on Schadensmeldung creation"""
def clean(self):
"""Custom clean method that raises ValidationError if a status is not selected"""
<|body_0|>
def __init__(self, *args, **kwargs):... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CustomStatusFormset:
"""Django BaseInlineFormset used to create SchadensmeldungStatus objects on Schadensmeldung creation"""
def clean(self):
"""Custom clean method that raises ValidationError if a status is not selected"""
for form in self.forms:
status = form.cleaned_data.ge... | the_stack_v2_python_sparse | apps/insurance/forms.py | ryanpdaly/megabike_crm_django | train | 0 |
c68de06d47812fbb0a7400d69feeb05d565dabe5 | [
"self.choices = []\nself.tot = 0\nlast = 0\nfor i in range(len(w)):\n self.tot += w[i]\n self.choices.append((last + 1, w[i] + last))\n last += w[i]",
"t = random.randrange(1, self.tot + 1)\nlo, hi = (0, len(self.choices) - 1)\nwhile lo < hi:\n mid = (lo + hi) // 2\n r = self.choices[mid]\n if t... | <|body_start_0|>
self.choices = []
self.tot = 0
last = 0
for i in range(len(w)):
self.tot += w[i]
self.choices.append((last + 1, w[i] + last))
last += w[i]
<|end_body_0|>
<|body_start_1|>
t = random.randrange(1, self.tot + 1)
lo, hi = ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def __init__(self, w):
""":type w: List[int]"""
<|body_0|>
def pickIndex(self):
""":rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.choices = []
self.tot = 0
last = 0
for i in range(len(w)):
... | stack_v2_sparse_classes_36k_train_025230 | 20,256 | no_license | [
{
"docstring": ":type w: List[int]",
"name": "__init__",
"signature": "def __init__(self, w)"
},
{
"docstring": ":rtype: int",
"name": "pickIndex",
"signature": "def pickIndex(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002010 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, w): :type w: List[int]
- def pickIndex(self): :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, w): :type w: List[int]
- def pickIndex(self): :rtype: int
<|skeleton|>
class Solution:
def __init__(self, w):
""":type w: List[int]"""
<|... | 289a447eee1ae45f990bf62eaeba03890f570a1a | <|skeleton|>
class Solution:
def __init__(self, w):
""":type w: List[int]"""
<|body_0|>
def pickIndex(self):
""":rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def __init__(self, w):
""":type w: List[int]"""
self.choices = []
self.tot = 0
last = 0
for i in range(len(w)):
self.tot += w[i]
self.choices.append((last + 1, w[i] + last))
last += w[i]
def pickIndex(self):
"""... | the_stack_v2_python_sparse | Sorting and Searching/Medium/Solutions.py | maxthecabbie/LeetCode | train | 0 | |
44f41e3e839b55150b22276b164efbab1993629d | [
"name = 'test name'\nblock = Block(name)\nself.assertIsNotNone(block)\nself.assertEqual(block.get_name(), name)",
"name = 'test_name'\ndata = ['gamma', 'alpha', 'beta']\ndata_repr = '\\n\\t'.join([str(item) for item in data])\ntarget = 'block {0}:\\n\\t{1}'.format(name, data_repr)\nblock = Block(name)\nfor item i... | <|body_start_0|>
name = 'test name'
block = Block(name)
self.assertIsNotNone(block)
self.assertEqual(block.get_name(), name)
<|end_body_0|>
<|body_start_1|>
name = 'test_name'
data = ['gamma', 'alpha', 'beta']
data_repr = '\n\t'.join([str(item) for item in data])... | Tests for the block class | BlockTest | [
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BlockTest:
"""Tests for the block class"""
def test_constructor(self):
"""create an object, tests its name"""
<|body_0|>
def test_repr(self):
"""create a Block object, add some data, check its representation"""
<|body_1|>
def test_str(self):
... | stack_v2_sparse_classes_36k_train_025231 | 8,702 | permissive | [
{
"docstring": "create an object, tests its name",
"name": "test_constructor",
"signature": "def test_constructor(self)"
},
{
"docstring": "create a Block object, add some data, check its representation",
"name": "test_repr",
"signature": "def test_repr(self)"
},
{
"docstring": "... | 4 | stack_v2_sparse_classes_30k_train_015702 | Implement the Python class `BlockTest` described below.
Class description:
Tests for the block class
Method signatures and docstrings:
- def test_constructor(self): create an object, tests its name
- def test_repr(self): create a Block object, add some data, check its representation
- def test_str(self): create a Blo... | Implement the Python class `BlockTest` described below.
Class description:
Tests for the block class
Method signatures and docstrings:
- def test_constructor(self): create an object, tests its name
- def test_repr(self): create a Block object, add some data, check its representation
- def test_str(self): create a Blo... | e748466a2af9f3388a8b0ed091aa061dbfc752d6 | <|skeleton|>
class BlockTest:
"""Tests for the block class"""
def test_constructor(self):
"""create an object, tests its name"""
<|body_0|>
def test_repr(self):
"""create a Block object, add some data, check its representation"""
<|body_1|>
def test_str(self):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BlockTest:
"""Tests for the block class"""
def test_constructor(self):
"""create an object, tests its name"""
name = 'test name'
block = Block(name)
self.assertIsNotNone(block)
self.assertEqual(block.get_name(), name)
def test_repr(self):
"""create a B... | the_stack_v2_python_sparse | Python/FiniteStateParser/block.py | gjbex/training-material | train | 130 |
c8dfc5144e3bb19019cb030d2d710365675f19ce | [
"cur_dir = os.path.dirname(os.path.realpath(__file__))\nmeta_file = os.path.join(cur_dir, 'testdata/meta.json')\ngraph_file = os.path.join(cur_dir, 'testdata/graph.json')\noutput_file = os.path.join(cur_dir, 'testdata/graph.dat')\nbuilder = os.path.join(cur_dir, '../../../tools/bin/json2dat.py')\ncommand = 'python ... | <|body_start_0|>
cur_dir = os.path.dirname(os.path.realpath(__file__))
meta_file = os.path.join(cur_dir, 'testdata/meta.json')
graph_file = os.path.join(cur_dir, 'testdata/graph.json')
output_file = os.path.join(cur_dir, 'testdata/graph.dat')
builder = os.path.join(cur_dir, '../.... | Neighbor Ops Test. Test get neighbors ops for nodes | NeighborOpsTest | [
"BSD-3-Clause",
"Zlib",
"BSD-2-Clause-Views",
"Apache-2.0",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NeighborOpsTest:
"""Neighbor Ops Test. Test get neighbors ops for nodes"""
def setUpClass(cls):
"""Build Graph data for test"""
<|body_0|>
def testGetFullNeighbor(self):
"""Test get full neighbors for nodes"""
<|body_1|>
def testGetSortedFullNeighbor... | stack_v2_sparse_classes_36k_train_025232 | 4,248 | permissive | [
{
"docstring": "Build Graph data for test",
"name": "setUpClass",
"signature": "def setUpClass(cls)"
},
{
"docstring": "Test get full neighbors for nodes",
"name": "testGetFullNeighbor",
"signature": "def testGetFullNeighbor(self)"
},
{
"docstring": "Test get sorted full neighbor... | 5 | stack_v2_sparse_classes_30k_train_013961 | Implement the Python class `NeighborOpsTest` described below.
Class description:
Neighbor Ops Test. Test get neighbors ops for nodes
Method signatures and docstrings:
- def setUpClass(cls): Build Graph data for test
- def testGetFullNeighbor(self): Test get full neighbors for nodes
- def testGetSortedFullNeighbor(sel... | Implement the Python class `NeighborOpsTest` described below.
Class description:
Neighbor Ops Test. Test get neighbors ops for nodes
Method signatures and docstrings:
- def setUpClass(cls): Build Graph data for test
- def testGetFullNeighbor(self): Test get full neighbors for nodes
- def testGetSortedFullNeighbor(sel... | 3e4b7507552a71b58251241c96959a5b55d121d3 | <|skeleton|>
class NeighborOpsTest:
"""Neighbor Ops Test. Test get neighbors ops for nodes"""
def setUpClass(cls):
"""Build Graph data for test"""
<|body_0|>
def testGetFullNeighbor(self):
"""Test get full neighbors for nodes"""
<|body_1|>
def testGetSortedFullNeighbor... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NeighborOpsTest:
"""Neighbor Ops Test. Test get neighbors ops for nodes"""
def setUpClass(cls):
"""Build Graph data for test"""
cur_dir = os.path.dirname(os.path.realpath(__file__))
meta_file = os.path.join(cur_dir, 'testdata/meta.json')
graph_file = os.path.join(cur_dir, ... | the_stack_v2_python_sparse | tf_euler/python/euler_ops/neighbor_ops_test.py | algoworker/euler | train | 0 |
2260e33e2798ca0570715e345b4b0e56987b6e0f | [
"self.one_time_use = one_time_use\nself.ip_white_list = ip_white_list\nself.additional_properties = additional_properties",
"if dictionary is None:\n return None\none_time_use = dictionary.get('oneTimeUse')\nip_white_list = dictionary.get('ipWhiteList')\nfor key in cls._names.values():\n if key in dictionar... | <|body_start_0|>
self.one_time_use = one_time_use
self.ip_white_list = ip_white_list
self.additional_properties = additional_properties
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
one_time_use = dictionary.get('oneTimeUse')
ip_white_lis... | Implementation of the 'Security' model. TODO: type model description here. Attributes: one_time_use (bool): (Coming soon) The link can only be used one time ip_white_list (list of string): (Coming soon) Define a list of IP's that are allowed to see / sign the document | Security | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Security:
"""Implementation of the 'Security' model. TODO: type model description here. Attributes: one_time_use (bool): (Coming soon) The link can only be used one time ip_white_list (list of string): (Coming soon) Define a list of IP's that are allowed to see / sign the document"""
def __i... | stack_v2_sparse_classes_36k_train_025233 | 2,187 | permissive | [
{
"docstring": "Constructor for the Security class",
"name": "__init__",
"signature": "def __init__(self, one_time_use=None, ip_white_list=None, additional_properties={})"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary represent... | 2 | null | Implement the Python class `Security` described below.
Class description:
Implementation of the 'Security' model. TODO: type model description here. Attributes: one_time_use (bool): (Coming soon) The link can only be used one time ip_white_list (list of string): (Coming soon) Define a list of IP's that are allowed to ... | Implement the Python class `Security` described below.
Class description:
Implementation of the 'Security' model. TODO: type model description here. Attributes: one_time_use (bool): (Coming soon) The link can only be used one time ip_white_list (list of string): (Coming soon) Define a list of IP's that are allowed to ... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class Security:
"""Implementation of the 'Security' model. TODO: type model description here. Attributes: one_time_use (bool): (Coming soon) The link can only be used one time ip_white_list (list of string): (Coming soon) Define a list of IP's that are allowed to see / sign the document"""
def __i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Security:
"""Implementation of the 'Security' model. TODO: type model description here. Attributes: one_time_use (bool): (Coming soon) The link can only be used one time ip_white_list (list of string): (Coming soon) Define a list of IP's that are allowed to see / sign the document"""
def __init__(self, o... | the_stack_v2_python_sparse | idfy_rest_client/models/security.py | dealflowteam/Idfy | train | 0 |
a639412340c7c976da22e0ae2f1cb875ddf94df8 | [
"r = Round.query.get(round_id)\nif r is not None:\n data = {'round': r.json()}\n if r.is_general_look():\n data.update({'data': {'mapping': {}, 'couples': []}})\n else:\n data.update({'data': r.adjudication_data(r.first_dance().dance_id)})\n return data\nabort(404, 'Unknown round_id')",
... | <|body_start_0|>
r = Round.query.get(round_id)
if r is not None:
data = {'round': r.json()}
if r.is_general_look():
data.update({'data': {'mapping': {}, 'couples': []}})
else:
data.update({'data': r.adjudication_data(r.first_dance().dan... | RoundAPIAdjudication | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RoundAPIAdjudication:
def get(self, round_id):
"""Get adjudication data for the first dance of the round"""
<|body_0|>
def patch(self, round_id):
"""Update the target marks for the round"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
r = Round.quer... | stack_v2_sparse_classes_36k_train_025234 | 25,303 | no_license | [
{
"docstring": "Get adjudication data for the first dance of the round",
"name": "get",
"signature": "def get(self, round_id)"
},
{
"docstring": "Update the target marks for the round",
"name": "patch",
"signature": "def patch(self, round_id)"
}
] | 2 | null | Implement the Python class `RoundAPIAdjudication` described below.
Class description:
Implement the RoundAPIAdjudication class.
Method signatures and docstrings:
- def get(self, round_id): Get adjudication data for the first dance of the round
- def patch(self, round_id): Update the target marks for the round | Implement the Python class `RoundAPIAdjudication` described below.
Class description:
Implement the RoundAPIAdjudication class.
Method signatures and docstrings:
- def get(self, round_id): Get adjudication data for the first dance of the round
- def patch(self, round_id): Update the target marks for the round
<|skel... | 079b109fd13683a31d1d632faa5ab72cf0e78ddf | <|skeleton|>
class RoundAPIAdjudication:
def get(self, round_id):
"""Get adjudication data for the first dance of the round"""
<|body_0|>
def patch(self, round_id):
"""Update the target marks for the round"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RoundAPIAdjudication:
def get(self, round_id):
"""Get adjudication data for the first dance of the round"""
r = Round.query.get(round_id)
if r is not None:
data = {'round': r.json()}
if r.is_general_look():
data.update({'data': {'mapping': {}, 'c... | the_stack_v2_python_sparse | backend/apis/round/apis.py | AlenAlic/DANCE | train | 0 | |
02ba3b99885175c2e89eab414410dd35a59f65fa | [
"SimpleJSONRPCDispatcher.__init__(self, encoding=encoding)\nself.register_introspection_functions()\nself._dispatch_method = dispatch_method",
"try:\n return self.funcs[name](*params)\nexcept KeyError:\n return self._dispatch_method(name, params)",
"try:\n data = to_str(request.read_data())\n result... | <|body_start_0|>
SimpleJSONRPCDispatcher.__init__(self, encoding=encoding)
self.register_introspection_functions()
self._dispatch_method = dispatch_method
<|end_body_0|>
<|body_start_1|>
try:
return self.funcs[name](*params)
except KeyError:
return self._... | A JSON-RPC servlet that can be registered in the Pelix HTTP service Calls the dispatch method given in the constructor | _JsonRpcServlet | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _JsonRpcServlet:
"""A JSON-RPC servlet that can be registered in the Pelix HTTP service Calls the dispatch method given in the constructor"""
def __init__(self, dispatch_method, encoding=None):
"""Sets up the servlet"""
<|body_0|>
def _simple_dispatch(self, name, params)... | stack_v2_sparse_classes_36k_train_025235 | 14,755 | permissive | [
{
"docstring": "Sets up the servlet",
"name": "__init__",
"signature": "def __init__(self, dispatch_method, encoding=None)"
},
{
"docstring": "Dispatch method",
"name": "_simple_dispatch",
"signature": "def _simple_dispatch(self, name, params)"
},
{
"docstring": "Handles a HTTP P... | 3 | stack_v2_sparse_classes_30k_train_007583 | Implement the Python class `_JsonRpcServlet` described below.
Class description:
A JSON-RPC servlet that can be registered in the Pelix HTTP service Calls the dispatch method given in the constructor
Method signatures and docstrings:
- def __init__(self, dispatch_method, encoding=None): Sets up the servlet
- def _sim... | Implement the Python class `_JsonRpcServlet` described below.
Class description:
A JSON-RPC servlet that can be registered in the Pelix HTTP service Calls the dispatch method given in the constructor
Method signatures and docstrings:
- def __init__(self, dispatch_method, encoding=None): Sets up the servlet
- def _sim... | ceabdf9bbea716c1ae8e2536eb6944d030fe3e37 | <|skeleton|>
class _JsonRpcServlet:
"""A JSON-RPC servlet that can be registered in the Pelix HTTP service Calls the dispatch method given in the constructor"""
def __init__(self, dispatch_method, encoding=None):
"""Sets up the servlet"""
<|body_0|>
def _simple_dispatch(self, name, params)... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _JsonRpcServlet:
"""A JSON-RPC servlet that can be registered in the Pelix HTTP service Calls the dispatch method given in the constructor"""
def __init__(self, dispatch_method, encoding=None):
"""Sets up the servlet"""
SimpleJSONRPCDispatcher.__init__(self, encoding=encoding)
sel... | the_stack_v2_python_sparse | pelix/remote/json_rpc.py | schevalier/ipopo | train | 0 |
167b6964103764fc96837e45d1c40a42a97de704 | [
"Frame.__init__(self)\nself.pack()\nself.createWidgets()",
"top_frame = Frame(self)\nself.label = Label(top_frame, text='Sum of input')\nself.label.pack()\nself.input1 = Entry(top_frame)\nself.input2 = Entry(top_frame)\nself.input1.pack(side=LEFT)\nself.input2.pack(side=RIGHT)\ntop_frame.pack(side=TOP)\nbottom_fr... | <|body_start_0|>
Frame.__init__(self)
self.pack()
self.createWidgets()
<|end_body_0|>
<|body_start_1|>
top_frame = Frame(self)
self.label = Label(top_frame, text='Sum of input')
self.label.pack()
self.input1 = Entry(top_frame)
self.input2 = Entry(top_fram... | Application main window class | Application | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Application:
"""Application main window class"""
def __init__(self, master=None):
"""Main frame initialization"""
<|body_0|>
def createWidgets(self):
"""Add all widgets to the main frame"""
<|body_1|>
def handle(self):
"""Handle a click of th... | stack_v2_sparse_classes_36k_train_025236 | 1,305 | no_license | [
{
"docstring": "Main frame initialization",
"name": "__init__",
"signature": "def __init__(self, master=None)"
},
{
"docstring": "Add all widgets to the main frame",
"name": "createWidgets",
"signature": "def createWidgets(self)"
},
{
"docstring": "Handle a click of the button by... | 3 | null | Implement the Python class `Application` described below.
Class description:
Application main window class
Method signatures and docstrings:
- def __init__(self, master=None): Main frame initialization
- def createWidgets(self): Add all widgets to the main frame
- def handle(self): Handle a click of the button by con... | Implement the Python class `Application` described below.
Class description:
Application main window class
Method signatures and docstrings:
- def __init__(self, master=None): Main frame initialization
- def createWidgets(self): Add all widgets to the main frame
- def handle(self): Handle a click of the button by con... | b5041e71badd1ca2c013828e3b2910fb02e9728f | <|skeleton|>
class Application:
"""Application main window class"""
def __init__(self, master=None):
"""Main frame initialization"""
<|body_0|>
def createWidgets(self):
"""Add all widgets to the main frame"""
<|body_1|>
def handle(self):
"""Handle a click of th... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Application:
"""Application main window class"""
def __init__(self, master=None):
"""Main frame initialization"""
Frame.__init__(self)
self.pack()
self.createWidgets()
def createWidgets(self):
"""Add all widgets to the main frame"""
top_frame = Frame(s... | the_stack_v2_python_sparse | python_2/homework/IntroGUI_homework/src/intro_gui.py | patrickbeeson/python-classes | train | 0 |
ed41bfc5515008d62eee2b4e11ec55f39c8710c4 | [
"query = request.GET.get('q')\nsort = request.GET.get('sort', 'name')\nform = AsignacionClienteForm()\nlist_assignC = None\nif query:\n list_assignC = AsignacionCliente.objects.filter(Q(server__name__icontains=query) | Q(client__name__icontains=query))\nelse:\n list_assignC = AsignacionCliente.objects.all()\n... | <|body_start_0|>
query = request.GET.get('q')
sort = request.GET.get('sort', 'name')
form = AsignacionClienteForm()
list_assignC = None
if query:
list_assignC = AsignacionCliente.objects.filter(Q(server__name__icontains=query) | Q(client__name__icontains=query))
... | Clase para crear una asignacion de los clientes | NewAssignClientView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NewAssignClientView:
"""Clase para crear una asignacion de los clientes"""
def get(self, request, *args, **kwargs):
"""Método get"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Método post"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_025237 | 22,221 | no_license | [
{
"docstring": "Método get",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "Método post",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000048 | Implement the Python class `NewAssignClientView` described below.
Class description:
Clase para crear una asignacion de los clientes
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Método get
- def post(self, request, *args, **kwargs): Método post | Implement the Python class `NewAssignClientView` described below.
Class description:
Clase para crear una asignacion de los clientes
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Método get
- def post(self, request, *args, **kwargs): Método post
<|skeleton|>
class NewAssignClientView:
... | e28e2d968372609ad396c42fb572a00c2410a117 | <|skeleton|>
class NewAssignClientView:
"""Clase para crear una asignacion de los clientes"""
def get(self, request, *args, **kwargs):
"""Método get"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Método post"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NewAssignClientView:
"""Clase para crear una asignacion de los clientes"""
def get(self, request, *args, **kwargs):
"""Método get"""
query = request.GET.get('q')
sort = request.GET.get('sort', 'name')
form = AsignacionClienteForm()
list_assignC = None
if qu... | the_stack_v2_python_sparse | list/views.py | damaos/server_list2 | train | 0 |
de859d29920751f60693d33d27c764ef6a1a3a94 | [
"import sys\nmax_area = 0\nn = len(heights)\nif n == 1:\n max_area = heights[0]\nfor i in range(n):\n min_height = sys.maxsize\n for j in range(i, n):\n min_height = min(heights[j], min_height)\n x = j - i + 1\n area = x * min_height\n max_area = max(max_area, area)\nprint(max_a... | <|body_start_0|>
import sys
max_area = 0
n = len(heights)
if n == 1:
max_area = heights[0]
for i in range(n):
min_height = sys.maxsize
for j in range(i, n):
min_height = min(heights[j], min_height)
x = j - i + 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def largestRectangleArea(self, heights):
""":type heights: List[int] :rtype: int"""
<|body_0|>
def largestRectangleArea2(self, heights):
""":type heights: List[int] :rtype: int"""
<|body_1|>
def largestRectangleArea3(self, heights):
"""... | stack_v2_sparse_classes_36k_train_025238 | 2,560 | no_license | [
{
"docstring": ":type heights: List[int] :rtype: int",
"name": "largestRectangleArea",
"signature": "def largestRectangleArea(self, heights)"
},
{
"docstring": ":type heights: List[int] :rtype: int",
"name": "largestRectangleArea2",
"signature": "def largestRectangleArea2(self, heights)"... | 3 | stack_v2_sparse_classes_30k_train_010041 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int
- def largestRectangleArea2(self, heights): :type heights: List[int] :rtype: int
- def largestRectan... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int
- def largestRectangleArea2(self, heights): :type heights: List[int] :rtype: int
- def largestRectan... | 3b13b36f37eb364410b3b5b4f10a1808d8b1111e | <|skeleton|>
class Solution:
def largestRectangleArea(self, heights):
""":type heights: List[int] :rtype: int"""
<|body_0|>
def largestRectangleArea2(self, heights):
""":type heights: List[int] :rtype: int"""
<|body_1|>
def largestRectangleArea3(self, heights):
"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def largestRectangleArea(self, heights):
""":type heights: List[int] :rtype: int"""
import sys
max_area = 0
n = len(heights)
if n == 1:
max_area = heights[0]
for i in range(n):
min_height = sys.maxsize
for j in range... | the_stack_v2_python_sparse | leetcode/84.py | yanggelinux/algorithm-data-structure | train | 0 | |
7a4fd2dad2aee7ee19844d35f283550ac2d5326a | [
"if N == 1:\n s = '0'\nelse:\n s = '01'\n for i in range(N - 2):\n l = len(s) // 2\n half_1 = s[0:l]\n half_2 = s[l:]\n a = half_2 + half_1\n s += a\nreturn int(s[K - 1])",
"if N == 1:\n return 0\nwhere = [K]\nwhile K != 1:\n next_k = (where[-1] + 1) // 2\n whe... | <|body_start_0|>
if N == 1:
s = '0'
else:
s = '01'
for i in range(N - 2):
l = len(s) // 2
half_1 = s[0:l]
half_2 = s[l:]
a = half_2 + half_1
s += a
return int(s[K - 1])
<|end_body_... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def kthGrammar(self, N, K):
""":type N: int :type K: int :rtype: int"""
<|body_0|>
def kthGrammar_1(self, N, K):
""":type N: int :type K: int :rtype: int 31ms"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if N == 1:
s = '0'
... | stack_v2_sparse_classes_36k_train_025239 | 1,984 | no_license | [
{
"docstring": ":type N: int :type K: int :rtype: int",
"name": "kthGrammar",
"signature": "def kthGrammar(self, N, K)"
},
{
"docstring": ":type N: int :type K: int :rtype: int 31ms",
"name": "kthGrammar_1",
"signature": "def kthGrammar_1(self, N, K)"
}
] | 2 | stack_v2_sparse_classes_30k_train_017202 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def kthGrammar(self, N, K): :type N: int :type K: int :rtype: int
- def kthGrammar_1(self, N, K): :type N: int :type K: int :rtype: int 31ms | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def kthGrammar(self, N, K): :type N: int :type K: int :rtype: int
- def kthGrammar_1(self, N, K): :type N: int :type K: int :rtype: int 31ms
<|skeleton|>
class Solution:
de... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def kthGrammar(self, N, K):
""":type N: int :type K: int :rtype: int"""
<|body_0|>
def kthGrammar_1(self, N, K):
""":type N: int :type K: int :rtype: int 31ms"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def kthGrammar(self, N, K):
""":type N: int :type K: int :rtype: int"""
if N == 1:
s = '0'
else:
s = '01'
for i in range(N - 2):
l = len(s) // 2
half_1 = s[0:l]
half_2 = s[l:]
... | the_stack_v2_python_sparse | KthSymbolInGrammar_MID_779.py | 953250587/leetcode-python | train | 2 | |
843a80c37dc2dbd3884aada3d734dc44195c82d9 | [
"super(ForgetfulGrudger, self).__init__()\nself.history = []\nself.score = 0\nself.mem_length = 10\nself.grudged = False\nself.grudge_memory = 0",
"if self.grudge_memory >= self.mem_length:\n self.grudge_memory = 0\n self.grudged = False\nif self.grudged:\n self.grudge_memory += 1\n return 'D'\nelif '... | <|body_start_0|>
super(ForgetfulGrudger, self).__init__()
self.history = []
self.score = 0
self.mem_length = 10
self.grudged = False
self.grudge_memory = 0
<|end_body_0|>
<|body_start_1|>
if self.grudge_memory >= self.mem_length:
self.grudge_memory = ... | A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches. | ForgetfulGrudger | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ForgetfulGrudger:
"""A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches."""
def __init__(self):
"""Initialised the player."""
<|body_0|>
def strategy(self, opponent):
"""Begins by pl... | stack_v2_sparse_classes_36k_train_025240 | 1,841 | permissive | [
{
"docstring": "Initialised the player.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Begins by playing C, then plays D for mem_length rounds if the opponent ever plays D.",
"name": "strategy",
"signature": "def strategy(self, opponent)"
},
{
"docstri... | 3 | stack_v2_sparse_classes_30k_train_013346 | Implement the Python class `ForgetfulGrudger` described below.
Class description:
A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches.
Method signatures and docstrings:
- def __init__(self): Initialised the player.
- def strategy(self, op... | Implement the Python class `ForgetfulGrudger` described below.
Class description:
A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches.
Method signatures and docstrings:
- def __init__(self): Initialised the player.
- def strategy(self, op... | e59fc40ebb705afe05cea6f30e282d1e9c621259 | <|skeleton|>
class ForgetfulGrudger:
"""A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches."""
def __init__(self):
"""Initialised the player."""
<|body_0|>
def strategy(self, opponent):
"""Begins by pl... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ForgetfulGrudger:
"""A player starts by cooperating however will defect if at any point the opponent has defected, but forgets after meme_length matches."""
def __init__(self):
"""Initialised the player."""
super(ForgetfulGrudger, self).__init__()
self.history = []
self.sc... | the_stack_v2_python_sparse | axelrod/strategies/grudger.py | DEFALT303/Axelrod | train | 0 |
7bce3d21a9d284913b4e45a47526e1b3afa30dc9 | [
"item = QStandardItem(item_name)\nitem.setCheckable(True)\nif checked:\n item.setCheckState(Qt.Checked)\nelse:\n item.setCheckState(Qt.Unchecked)\nself.appendRow(item)",
"checked = list()\nfor i in range(self.rowCount()):\n if bool(self.item(i, 0).checkState()):\n checked.append(i)\nreturn checked... | <|body_start_0|>
item = QStandardItem(item_name)
item.setCheckable(True)
if checked:
item.setCheckState(Qt.Checked)
else:
item.setCheckState(Qt.Unchecked)
self.appendRow(item)
<|end_body_0|>
<|body_start_1|>
checked = list()
for i in range... | Builds list view with checkable items. References ---------- https://stackoverflow.com/questions/846684/a-listview-of-checkboxes-in-pyqt | CheckableListModel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CheckableListModel:
"""Builds list view with checkable items. References ---------- https://stackoverflow.com/questions/846684/a-listview-of-checkboxes-in-pyqt"""
def add(self, item_name: str, checked: Optional[bool]=False):
"""Add one row to checkabel list. Paremeters ---------- ite... | stack_v2_sparse_classes_36k_train_025241 | 1,448 | permissive | [
{
"docstring": "Add one row to checkabel list. Paremeters ---------- item_name: str name of the list item checked: Optional[bool] control if item will be in checked state upon insertion",
"name": "add",
"signature": "def add(self, item_name: str, checked: Optional[bool]=False)"
},
{
"docstring":... | 2 | stack_v2_sparse_classes_30k_train_012463 | Implement the Python class `CheckableListModel` described below.
Class description:
Builds list view with checkable items. References ---------- https://stackoverflow.com/questions/846684/a-listview-of-checkboxes-in-pyqt
Method signatures and docstrings:
- def add(self, item_name: str, checked: Optional[bool]=False):... | Implement the Python class `CheckableListModel` described below.
Class description:
Builds list view with checkable items. References ---------- https://stackoverflow.com/questions/846684/a-listview-of-checkboxes-in-pyqt
Method signatures and docstrings:
- def add(self, item_name: str, checked: Optional[bool]=False):... | e8836c23b7b7e43661b59afd1bfc18d381b95d4a | <|skeleton|>
class CheckableListModel:
"""Builds list view with checkable items. References ---------- https://stackoverflow.com/questions/846684/a-listview-of-checkboxes-in-pyqt"""
def add(self, item_name: str, checked: Optional[bool]=False):
"""Add one row to checkabel list. Paremeters ---------- ite... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CheckableListModel:
"""Builds list view with checkable items. References ---------- https://stackoverflow.com/questions/846684/a-listview-of-checkboxes-in-pyqt"""
def add(self, item_name: str, checked: Optional[bool]=False):
"""Add one row to checkabel list. Paremeters ---------- item_name: str n... | the_stack_v2_python_sparse | wiki_music/gui_lib/custom_classes/lists.py | marian-code/wikipedia-music-tags | train | 13 |
71831eecd77d756deea680897f41eca739677182 | [
"super(DjangoThread, self).__init__()\nself.options = {'host': 'localhost', 'port': 8888, 'threads': 10, 'request_queue_size': 15}\nself.options.update(**kwargs)\nself.setDaemon(True)",
"server = CherryPyWSGIServer((self.options['host'], int(self.options['port'])), WSGIPathInfoDispatcher({'/': WSGIHandler(), sett... | <|body_start_0|>
super(DjangoThread, self).__init__()
self.options = {'host': 'localhost', 'port': 8888, 'threads': 10, 'request_queue_size': 15}
self.options.update(**kwargs)
self.setDaemon(True)
<|end_body_0|>
<|body_start_1|>
server = CherryPyWSGIServer((self.options['host'],... | Django server control thread. | DjangoThread | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DjangoThread:
"""Django server control thread."""
def __init__(self, **kwargs):
"""Initialize CherryPy Django web server."""
<|body_0|>
def run(self):
"""Launch CherryPy Django web server."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(Dj... | stack_v2_sparse_classes_36k_train_025242 | 1,311 | permissive | [
{
"docstring": "Initialize CherryPy Django web server.",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
{
"docstring": "Launch CherryPy Django web server.",
"name": "run",
"signature": "def run(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001669 | Implement the Python class `DjangoThread` described below.
Class description:
Django server control thread.
Method signatures and docstrings:
- def __init__(self, **kwargs): Initialize CherryPy Django web server.
- def run(self): Launch CherryPy Django web server. | Implement the Python class `DjangoThread` described below.
Class description:
Django server control thread.
Method signatures and docstrings:
- def __init__(self, **kwargs): Initialize CherryPy Django web server.
- def run(self): Launch CherryPy Django web server.
<|skeleton|>
class DjangoThread:
"""Django serve... | 7461d5eadc5fbaa0fa5a4121597bf9a7c20453a4 | <|skeleton|>
class DjangoThread:
"""Django server control thread."""
def __init__(self, **kwargs):
"""Initialize CherryPy Django web server."""
<|body_0|>
def run(self):
"""Launch CherryPy Django web server."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DjangoThread:
"""Django server control thread."""
def __init__(self, **kwargs):
"""Initialize CherryPy Django web server."""
super(DjangoThread, self).__init__()
self.options = {'host': 'localhost', 'port': 8888, 'threads': 10, 'request_queue_size': 15}
self.options.update... | the_stack_v2_python_sparse | djangodevtools/wsgitest/djangoserver.py | adamhaney/djangodevtools | train | 0 |
d5437992b585d43a742d81cb6664978cd4f0a297 | [
"def helper(number):\n for i in range(10 - number % 10):\n num = number + i\n if num <= n:\n ans.append(num)\n helper(num * 10)\n else:\n break\nans = []\nhelper(1)\nreturn ans",
"chard = {}\nfor i in range(len(s)):\n if s[i] in chard:\n chard[s[i... | <|body_start_0|>
def helper(number):
for i in range(10 - number % 10):
num = number + i
if num <= n:
ans.append(num)
helper(num * 10)
else:
break
ans = []
helper(1)
ret... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lexicalOrder(self, n):
""":type n: int :rtype: List[int]"""
<|body_0|>
def firstUniqChar(self, s):
""":type s: str :rtype: int"""
<|body_1|>
def lengthLongestPath(self, input):
""":type input: str :rtype: int"""
<|body_2|>
... | stack_v2_sparse_classes_36k_train_025243 | 1,635 | no_license | [
{
"docstring": ":type n: int :rtype: List[int]",
"name": "lexicalOrder",
"signature": "def lexicalOrder(self, n)"
},
{
"docstring": ":type s: str :rtype: int",
"name": "firstUniqChar",
"signature": "def firstUniqChar(self, s)"
},
{
"docstring": ":type input: str :rtype: int",
... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lexicalOrder(self, n): :type n: int :rtype: List[int]
- def firstUniqChar(self, s): :type s: str :rtype: int
- def lengthLongestPath(self, input): :type input: str :rtype: in... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lexicalOrder(self, n): :type n: int :rtype: List[int]
- def firstUniqChar(self, s): :type s: str :rtype: int
- def lengthLongestPath(self, input): :type input: str :rtype: in... | 8790abadd5289024794cd95529187c96111c2bd6 | <|skeleton|>
class Solution:
def lexicalOrder(self, n):
""":type n: int :rtype: List[int]"""
<|body_0|>
def firstUniqChar(self, s):
""":type s: str :rtype: int"""
<|body_1|>
def lengthLongestPath(self, input):
""":type input: str :rtype: int"""
<|body_2|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lexicalOrder(self, n):
""":type n: int :rtype: List[int]"""
def helper(number):
for i in range(10 - number % 10):
num = number + i
if num <= n:
ans.append(num)
helper(num * 10)
els... | the_stack_v2_python_sparse | contests/mycontest.py | minging234/LeetCode_ming | train | 0 | |
39a6deca0281677456bbc6e5efd276eb3d8a4b66 | [
"self.debug = debug\nself.logger = DefaceLogger(__name__, debug=self.debug)\nif path is None and server_name is None or (path == '' and server_name == ''):\n msg = 'Please specify either the path of web server files ' + 'or the name of the web server, exiting.'\n self.logger.log(msg, logtype='error')\n sys... | <|body_start_0|>
self.debug = debug
self.logger = DefaceLogger(__name__, debug=self.debug)
if path is None and server_name is None or (path == '' and server_name == ''):
msg = 'Please specify either the path of web server files ' + 'or the name of the web server, exiting.'
... | Web Deface Detection Engine class. | Engine | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Engine:
"""Web Deface Detection Engine class."""
def __init__(self, debug=False, path=None, server_name=None):
"""Initialize Engine. Args: debug (bool): Log on terminal or not path (str): Path of the directory to monitor server_name (str): Name of the server (apache/nginx/etc.) Raise... | stack_v2_sparse_classes_36k_train_025244 | 5,009 | permissive | [
{
"docstring": "Initialize Engine. Args: debug (bool): Log on terminal or not path (str): Path of the directory to monitor server_name (str): Name of the server (apache/nginx/etc.) Raises: None Returns: None",
"name": "__init__",
"signature": "def __init__(self, debug=False, path=None, server_name=None)... | 2 | null | Implement the Python class `Engine` described below.
Class description:
Web Deface Detection Engine class.
Method signatures and docstrings:
- def __init__(self, debug=False, path=None, server_name=None): Initialize Engine. Args: debug (bool): Log on terminal or not path (str): Path of the directory to monitor server... | Implement the Python class `Engine` described below.
Class description:
Web Deface Detection Engine class.
Method signatures and docstrings:
- def __init__(self, debug=False, path=None, server_name=None): Initialize Engine. Args: debug (bool): Log on terminal or not path (str): Path of the directory to monitor server... | 43dec187e5848b9ced8a6b4957b6e9028d4d43cd | <|skeleton|>
class Engine:
"""Web Deface Detection Engine class."""
def __init__(self, debug=False, path=None, server_name=None):
"""Initialize Engine. Args: debug (bool): Log on terminal or not path (str): Path of the directory to monitor server_name (str): Name of the server (apache/nginx/etc.) Raise... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Engine:
"""Web Deface Detection Engine class."""
def __init__(self, debug=False, path=None, server_name=None):
"""Initialize Engine. Args: debug (bool): Log on terminal or not path (str): Path of the directory to monitor server_name (str): Name of the server (apache/nginx/etc.) Raises: None Retur... | the_stack_v2_python_sparse | securetea/lib/web_deface/web_deface_engine.py | rejahrehim/SecureTea-Project | train | 1 |
e04f35e4a654a5741f9ebe8602631595a2226b59 | [
"token = kwargs['token']\nuser_id = token['user_id']\nuser = UserDetail.objects.filter(user_id=user_id)\nif not user:\n result = False\n data = ''\n error = '未查询到用户'\n return JsonResponse({'result': result, 'data': data, 'error': error})\nuser_se = StaffSerializer(user[0], many=False)\nresult = True\nda... | <|body_start_0|>
token = kwargs['token']
user_id = token['user_id']
user = UserDetail.objects.filter(user_id=user_id)
if not user:
result = False
data = ''
error = '未查询到用户'
return JsonResponse({'result': result, 'data': data, 'error': error... | desc: 个人信息管理模块 | StaffInfo | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StaffInfo:
"""desc: 个人信息管理模块"""
def get(self, request, **kwargs):
"""desc:个人账户查看 :param request: :return:"""
<|body_0|>
def put(self, request, **kwargs):
"""desc:修改密码 :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
token = kwargs['token... | stack_v2_sparse_classes_36k_train_025245 | 8,165 | no_license | [
{
"docstring": "desc:个人账户查看 :param request: :return:",
"name": "get",
"signature": "def get(self, request, **kwargs)"
},
{
"docstring": "desc:修改密码 :return:",
"name": "put",
"signature": "def put(self, request, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020200 | Implement the Python class `StaffInfo` described below.
Class description:
desc: 个人信息管理模块
Method signatures and docstrings:
- def get(self, request, **kwargs): desc:个人账户查看 :param request: :return:
- def put(self, request, **kwargs): desc:修改密码 :return: | Implement the Python class `StaffInfo` described below.
Class description:
desc: 个人信息管理模块
Method signatures and docstrings:
- def get(self, request, **kwargs): desc:个人账户查看 :param request: :return:
- def put(self, request, **kwargs): desc:修改密码 :return:
<|skeleton|>
class StaffInfo:
"""desc: 个人信息管理模块"""
def g... | 22159c3f827f6defe96c4586fb8b4629c238b6c4 | <|skeleton|>
class StaffInfo:
"""desc: 个人信息管理模块"""
def get(self, request, **kwargs):
"""desc:个人账户查看 :param request: :return:"""
<|body_0|>
def put(self, request, **kwargs):
"""desc:修改密码 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StaffInfo:
"""desc: 个人信息管理模块"""
def get(self, request, **kwargs):
"""desc:个人账户查看 :param request: :return:"""
token = kwargs['token']
user_id = token['user_id']
user = UserDetail.objects.filter(user_id=user_id)
if not user:
result = False
dat... | the_stack_v2_python_sparse | staff/views.py | haominqu/excenter | train | 0 |
ac40930d70944527f55785758c3ba66805f03c83 | [
"from __builtin__ import xrange\nfor i in xrange(len(s) / 2):\n s[i], s[~i] = (s[~i], s[i])\ni = j = 0\nwhile j < len(s) + 1:\n if j == len(s) or s[j] == ' ':\n jj = j - 1\n while i < jj:\n s[i], s[jj] = (s[jj], s[i])\n i += 1\n jj -= 1\n i = j + 1\n j ... | <|body_start_0|>
from __builtin__ import xrange
for i in xrange(len(s) / 2):
s[i], s[~i] = (s[~i], s[i])
i = j = 0
while j < len(s) + 1:
if j == len(s) or s[j] == ' ':
jj = j - 1
while i < jj:
s[i], s[jj] = (s[jj... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reverseWords(self, s):
""":type str: List[str] :rtype: void Do not return anything, modify str in-place instead."""
<|body_0|>
def rewrite(self, s):
""":type str: List[str] :rtype: void Do not return anything, modify str in-place instead."""
<|b... | stack_v2_sparse_classes_36k_train_025246 | 2,037 | no_license | [
{
"docstring": ":type str: List[str] :rtype: void Do not return anything, modify str in-place instead.",
"name": "reverseWords",
"signature": "def reverseWords(self, s)"
},
{
"docstring": ":type str: List[str] :rtype: void Do not return anything, modify str in-place instead.",
"name": "rewri... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseWords(self, s): :type str: List[str] :rtype: void Do not return anything, modify str in-place instead.
- def rewrite(self, s): :type str: List[str] :rtype: void Do not... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseWords(self, s): :type str: List[str] :rtype: void Do not return anything, modify str in-place instead.
- def rewrite(self, s): :type str: List[str] :rtype: void Do not... | 6350568d16b0f8c49a020f055bb6d72e2705ea56 | <|skeleton|>
class Solution:
def reverseWords(self, s):
""":type str: List[str] :rtype: void Do not return anything, modify str in-place instead."""
<|body_0|>
def rewrite(self, s):
""":type str: List[str] :rtype: void Do not return anything, modify str in-place instead."""
<|b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def reverseWords(self, s):
""":type str: List[str] :rtype: void Do not return anything, modify str in-place instead."""
from __builtin__ import xrange
for i in xrange(len(s) / 2):
s[i], s[~i] = (s[~i], s[i])
i = j = 0
while j < len(s) + 1:
... | the_stack_v2_python_sparse | co_ms/186_Reverse_Words_in_a_String_II.py | vsdrun/lc_public | train | 6 | |
3c80990e7dbc600825dc47a90df281b36566007f | [
"super(SimpleThemeDecoration, self).configure()\nself.set_default_btn_icon()\ntranslate = self.resource.translate\nself.pushButton_6.setToolTip(translate('Bar', '最大化'))\nself.pushButton_7.setToolTip(translate('Bar', '最小化'))\nself.pushButton_5.setToolTip(translate('Bar', '关闭'))\nself.pushButton_6.setObjectName('btn_... | <|body_start_0|>
super(SimpleThemeDecoration, self).configure()
self.set_default_btn_icon()
translate = self.resource.translate
self.pushButton_6.setToolTip(translate('Bar', '最大化'))
self.pushButton_7.setToolTip(translate('Bar', '最小化'))
self.pushButton_5.setToolTip(transla... | SimpleThemeDecoration | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SimpleThemeDecoration:
def configure(self):
"""配置页面及控件属性, 要分清哪些是需要在重写之前,哪些是在重写之后哦"""
<|body_0|>
def set_default_btn_icon(self):
"""设置默认按钮图标"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(SimpleThemeDecoration, self).configure()
self.s... | stack_v2_sparse_classes_36k_train_025247 | 2,531 | permissive | [
{
"docstring": "配置页面及控件属性, 要分清哪些是需要在重写之前,哪些是在重写之后哦",
"name": "configure",
"signature": "def configure(self)"
},
{
"docstring": "设置默认按钮图标",
"name": "set_default_btn_icon",
"signature": "def set_default_btn_icon(self)"
}
] | 2 | null | Implement the Python class `SimpleThemeDecoration` described below.
Class description:
Implement the SimpleThemeDecoration class.
Method signatures and docstrings:
- def configure(self): 配置页面及控件属性, 要分清哪些是需要在重写之前,哪些是在重写之后哦
- def set_default_btn_icon(self): 设置默认按钮图标 | Implement the Python class `SimpleThemeDecoration` described below.
Class description:
Implement the SimpleThemeDecoration class.
Method signatures and docstrings:
- def configure(self): 配置页面及控件属性, 要分清哪些是需要在重写之前,哪些是在重写之后哦
- def set_default_btn_icon(self): 设置默认按钮图标
<|skeleton|>
class SimpleThemeDecoration:
def c... | edaa6398260d5f8c7a90cdf2a9669f0a02ca5102 | <|skeleton|>
class SimpleThemeDecoration:
def configure(self):
"""配置页面及控件属性, 要分清哪些是需要在重写之前,哪些是在重写之后哦"""
<|body_0|>
def set_default_btn_icon(self):
"""设置默认按钮图标"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SimpleThemeDecoration:
def configure(self):
"""配置页面及控件属性, 要分清哪些是需要在重写之前,哪些是在重写之后哦"""
super(SimpleThemeDecoration, self).configure()
self.set_default_btn_icon()
translate = self.resource.translate
self.pushButton_6.setToolTip(translate('Bar', '最大化'))
self.pushBut... | the_stack_v2_python_sparse | sherry/view/decoration/decoration_activity_simple_theme.py | wumaoland/sherry | train | 0 | |
ffc28a2908f4ed09bc85be261ee0a873cace018b | [
"nums = list(set(nums))\nnums.sort()\nif len(nums) == 0:\n return 0\nprev, max_len, tmp_len = (nums[0], 1, 1)\nfor i in xrange(1, len(nums)):\n if nums[i] == prev + 1:\n tmp_len += 1\n prev = nums[i]\n else:\n tmp_len = 1\n prev = nums[i]\n max_len = max(max_len, tmp_len)\nre... | <|body_start_0|>
nums = list(set(nums))
nums.sort()
if len(nums) == 0:
return 0
prev, max_len, tmp_len = (nums[0], 1, 1)
for i in xrange(1, len(nums)):
if nums[i] == prev + 1:
tmp_len += 1
prev = nums[i]
else:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def longestConsecutive_2(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def longestConsecutive(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
nums = list(set(nums))
... | stack_v2_sparse_classes_36k_train_025248 | 1,552 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "longestConsecutive_2",
"signature": "def longestConsecutive_2(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "longestConsecutive",
"signature": "def longestConsecutive(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004790 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestConsecutive_2(self, nums): :type nums: List[int] :rtype: int
- def longestConsecutive(self, nums): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestConsecutive_2(self, nums): :type nums: List[int] :rtype: int
- def longestConsecutive(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
... | 0ca8983505ef5f694b68198742aaf50fc0b80e6b | <|skeleton|>
class Solution:
def longestConsecutive_2(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def longestConsecutive(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def longestConsecutive_2(self, nums):
""":type nums: List[int] :rtype: int"""
nums = list(set(nums))
nums.sort()
if len(nums) == 0:
return 0
prev, max_len, tmp_len = (nums[0], 1, 1)
for i in xrange(1, len(nums)):
if nums[i] == p... | the_stack_v2_python_sparse | leetcode 101-150/128. Longest Consecutive Sequence.py | raxxar1024/code_snippet | train | 0 | |
0972a45998520985071827f09f8eafd8583c7a44 | [
"self.d = matrix\nfor row in matrix:\n for i in xrange(1, len(row)):\n row[i] += row[i - 1]",
"row = self.d[row]\norig = row[col] - (row[col - 1] if col else 0)\nfor i in xrange(col, len(row)):\n row[i] += val - orig",
"res = 0\nfor i in xrange(row1, row2 + 1):\n res += self.d[i][col2] - (self.d... | <|body_start_0|>
self.d = matrix
for row in matrix:
for i in xrange(1, len(row)):
row[i] += row[i - 1]
<|end_body_0|>
<|body_start_1|>
row = self.d[row]
orig = row[col] - (row[col - 1] if col else 0)
for i in xrange(col, len(row)):
row[i] ... | NumMatrix | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
<|body_0|>
def update(self, row, col, val):
""":type row: int :type col: int :type val: int :rtype: void"""
<|body_1|>
def sumRegion(self, row1, col1, row2, col2):
""":typ... | stack_v2_sparse_classes_36k_train_025249 | 2,073 | no_license | [
{
"docstring": ":type matrix: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, matrix)"
},
{
"docstring": ":type row: int :type col: int :type val: int :rtype: void",
"name": "update",
"signature": "def update(self, row, col, val)"
},
{
"docstring": ":type r... | 3 | null | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): :type matrix: List[List[int]]
- def update(self, row, col, val): :type row: int :type col: int :type val: int :rtype: void
- def sumRegion(self, row... | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): :type matrix: List[List[int]]
- def update(self, row, col, val): :type row: int :type col: int :type val: int :rtype: void
- def sumRegion(self, row... | 1177272c898db9632eec704a56ba8be38281aaef | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
<|body_0|>
def update(self, row, col, val):
""":type row: int :type col: int :type val: int :rtype: void"""
<|body_1|>
def sumRegion(self, row1, col1, row2, col2):
""":typ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
self.d = matrix
for row in matrix:
for i in xrange(1, len(row)):
row[i] += row[i - 1]
def update(self, row, col, val):
""":type row: int :type col: int :type val: int :rt... | the_stack_v2_python_sparse | G/4#308RangeSumQuery2DMutable.py | fwangboulder/DataStructureAndAlgorithms | train | 0 | |
f88e2aa034f036743d61603dd9a2101d95c4c49d | [
"if self.shift >= 12 and (not isinstance(self, OffsetVariable)):\n return OffsetVariable(rank=self.rank, name=self.name, shift=self.shift, units=self.units, parent=self.parent)\nreturn self",
"if self.shift >= 12 and isinstance(self, OffsetVariable):\n return StandardVariable(rank=self.rank, name=self.name,... | <|body_start_0|>
if self.shift >= 12 and (not isinstance(self, OffsetVariable)):
return OffsetVariable(rank=self.rank, name=self.name, shift=self.shift, units=self.units, parent=self.parent)
return self
<|end_body_0|>
<|body_start_1|>
if self.shift >= 12 and isinstance(self, OffsetV... | A variable with its associated name, shift (in months), and units. | Variable | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Variable:
"""A variable with its associated name, shift (in months), and units."""
def get_offset(self):
"""Return a transformed Variable if there is a large (>12) shift."""
<|body_0|>
def get_standard(self):
"""The inverse of `get_offset()`."""
<|body_1|... | stack_v2_sparse_classes_36k_train_025250 | 9,986 | permissive | [
{
"docstring": "Return a transformed Variable if there is a large (>12) shift.",
"name": "get_offset",
"signature": "def get_offset(self)"
},
{
"docstring": "The inverse of `get_offset()`.",
"name": "get_standard",
"signature": "def get_standard(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008973 | Implement the Python class `Variable` described below.
Class description:
A variable with its associated name, shift (in months), and units.
Method signatures and docstrings:
- def get_offset(self): Return a transformed Variable if there is a large (>12) shift.
- def get_standard(self): The inverse of `get_offset()`. | Implement the Python class `Variable` described below.
Class description:
A variable with its associated name, shift (in months), and units.
Method signatures and docstrings:
- def get_offset(self): Return a transformed Variable if there is a large (>12) shift.
- def get_standard(self): The inverse of `get_offset()`.... | 4187f5bfce0595d98361a9264793c25607043047 | <|skeleton|>
class Variable:
"""A variable with its associated name, shift (in months), and units."""
def get_offset(self):
"""Return a transformed Variable if there is a large (>12) shift."""
<|body_0|>
def get_standard(self):
"""The inverse of `get_offset()`."""
<|body_1|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Variable:
"""A variable with its associated name, shift (in months), and units."""
def get_offset(self):
"""Return a transformed Variable if there is a large (>12) shift."""
if self.shift >= 12 and (not isinstance(self, OffsetVariable)):
return OffsetVariable(rank=self.rank, n... | the_stack_v2_python_sparse | src/empirical_fire_modelling/variable.py | akuhnregnier/empirical-fire-modelling | train | 0 |
987d42df036be470f2e3fad417894d620094dcb2 | [
"passwd = data['password']\npasswd_conf = data['password_confirmation']\nif passwd != passwd_conf:\n raise serializers.ValidationError('Password don´t match')\npassword_validation.validate_password(passwd)\nreturn data",
"data.pop('password_confirmation')\nuser = User.objects.create_user(**data)\nProfile.objec... | <|body_start_0|>
passwd = data['password']
passwd_conf = data['password_confirmation']
if passwd != passwd_conf:
raise serializers.ValidationError('Password don´t match')
password_validation.validate_password(passwd)
return data
<|end_body_0|>
<|body_start_1|>
... | User signup serializer. Handle sign up data validation and user & profile creation. | UserSignUpSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserSignUpSerializer:
"""User signup serializer. Handle sign up data validation and user & profile creation."""
def validate(self, data):
"""Verify password match and type identification."""
<|body_0|>
def create(self, data):
"""Handle user and profile creation""... | stack_v2_sparse_classes_36k_train_025251 | 8,178 | no_license | [
{
"docstring": "Verify password match and type identification.",
"name": "validate",
"signature": "def validate(self, data)"
},
{
"docstring": "Handle user and profile creation",
"name": "create",
"signature": "def create(self, data)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001257 | Implement the Python class `UserSignUpSerializer` described below.
Class description:
User signup serializer. Handle sign up data validation and user & profile creation.
Method signatures and docstrings:
- def validate(self, data): Verify password match and type identification.
- def create(self, data): Handle user a... | Implement the Python class `UserSignUpSerializer` described below.
Class description:
User signup serializer. Handle sign up data validation and user & profile creation.
Method signatures and docstrings:
- def validate(self, data): Verify password match and type identification.
- def create(self, data): Handle user a... | fae5c0b2e388239e2e32a3fbf52aa7cfd48a7cbb | <|skeleton|>
class UserSignUpSerializer:
"""User signup serializer. Handle sign up data validation and user & profile creation."""
def validate(self, data):
"""Verify password match and type identification."""
<|body_0|>
def create(self, data):
"""Handle user and profile creation""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserSignUpSerializer:
"""User signup serializer. Handle sign up data validation and user & profile creation."""
def validate(self, data):
"""Verify password match and type identification."""
passwd = data['password']
passwd_conf = data['password_confirmation']
if passwd !=... | the_stack_v2_python_sparse | facebook/app/users/serializers/users.py | ricagome/Api-Facebook-Clone | train | 0 |
d518b7be9373ab378c0dcc743d06ffaa1b2f9320 | [
"for i in range(1, len(strs)):\n if not strs[i].startswith(sub_str):\n return False\nreturn True",
"if strs == None or len(strs) < 1:\n return ''\nif len(strs) < 2:\n return strs[0]\nlongest_str = ''\nfor i in range(1, len(strs[0]) + 1):\n sub_str = strs[0][0:i]\n flag = self.is_all_match(su... | <|body_start_0|>
for i in range(1, len(strs)):
if not strs[i].startswith(sub_str):
return False
return True
<|end_body_0|>
<|body_start_1|>
if strs == None or len(strs) < 1:
return ''
if len(strs) < 2:
return strs[0]
longest_st... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def is_all_match(self, sub_str: str, strs: List[str]) -> bool:
"""字符串匹配问题 Args: sub_str: 子字符串 strs: 字符数组 Returns: 布尔值"""
<|body_0|>
def longest_common_prefix(self, strs: List[str]) -> str:
"""找出最长前串 Args: strs: 字符串数组 Returns: 最长相同前串"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_025252 | 2,730 | permissive | [
{
"docstring": "字符串匹配问题 Args: sub_str: 子字符串 strs: 字符数组 Returns: 布尔值",
"name": "is_all_match",
"signature": "def is_all_match(self, sub_str: str, strs: List[str]) -> bool"
},
{
"docstring": "找出最长前串 Args: strs: 字符串数组 Returns: 最长相同前串",
"name": "longest_common_prefix",
"signature": "def long... | 3 | stack_v2_sparse_classes_30k_train_013149 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def is_all_match(self, sub_str: str, strs: List[str]) -> bool: 字符串匹配问题 Args: sub_str: 子字符串 strs: 字符数组 Returns: 布尔值
- def longest_common_prefix(self, strs: List[str]) -> str: 找出最长... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def is_all_match(self, sub_str: str, strs: List[str]) -> bool: 字符串匹配问题 Args: sub_str: 子字符串 strs: 字符数组 Returns: 布尔值
- def longest_common_prefix(self, strs: List[str]) -> str: 找出最长... | 50f35eef6a0ad63173efed10df3c835b1dceaa3f | <|skeleton|>
class Solution:
def is_all_match(self, sub_str: str, strs: List[str]) -> bool:
"""字符串匹配问题 Args: sub_str: 子字符串 strs: 字符数组 Returns: 布尔值"""
<|body_0|>
def longest_common_prefix(self, strs: List[str]) -> str:
"""找出最长前串 Args: strs: 字符串数组 Returns: 最长相同前串"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def is_all_match(self, sub_str: str, strs: List[str]) -> bool:
"""字符串匹配问题 Args: sub_str: 子字符串 strs: 字符数组 Returns: 布尔值"""
for i in range(1, len(strs)):
if not strs[i].startswith(sub_str):
return False
return True
def longest_common_prefix(self,... | the_stack_v2_python_sparse | src/leetcodepython/string/longest_common_14.py | zhangyu345293721/leetcode | train | 101 | |
08a3ce112185fb41cd867609aec96e31002b6355 | [
"super().__init__(*args, **kwargs)\ndb = model.SqlSession()\nurls, domains = get_start_urls(db)\nrandom.shuffle(urls)\nself.start_urls = urls\nself.extractor = LinkExtractor(allow_domains=domains, deny_domains=DENY_DOMAINS)\ndb.close()",
"for link in self.extractor.extract_links(response):\n yield scrapy.Reque... | <|body_start_0|>
super().__init__(*args, **kwargs)
db = model.SqlSession()
urls, domains = get_start_urls(db)
random.shuffle(urls)
self.start_urls = urls
self.extractor = LinkExtractor(allow_domains=domains, deny_domains=DENY_DOMAINS)
db.close()
<|end_body_0|>
<|... | searches our developer domains for emails | EmailSpider | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EmailSpider:
"""searches our developer domains for emails"""
def __init__(self, *args, **kwargs):
"""conencts to db"""
<|body_0|>
def parse(self, response):
"""finds emails in a rudimentary but effective way using regular expressions"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_36k_train_025253 | 1,536 | permissive | [
{
"docstring": "conencts to db",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "finds emails in a rudimentary but effective way using regular expressions",
"name": "parse",
"signature": "def parse(self, response)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004335 | Implement the Python class `EmailSpider` described below.
Class description:
searches our developer domains for emails
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): conencts to db
- def parse(self, response): finds emails in a rudimentary but effective way using regular expressions | Implement the Python class `EmailSpider` described below.
Class description:
searches our developer domains for emails
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): conencts to db
- def parse(self, response): finds emails in a rudimentary but effective way using regular expressions
<|skele... | c0c38c7b02f41f482b01f145b0348ecbb82952a9 | <|skeleton|>
class EmailSpider:
"""searches our developer domains for emails"""
def __init__(self, *args, **kwargs):
"""conencts to db"""
<|body_0|>
def parse(self, response):
"""finds emails in a rudimentary but effective way using regular expressions"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EmailSpider:
"""searches our developer domains for emails"""
def __init__(self, *args, **kwargs):
"""conencts to db"""
super().__init__(*args, **kwargs)
db = model.SqlSession()
urls, domains = get_start_urls(db)
random.shuffle(urls)
self.start_urls = urls
... | the_stack_v2_python_sparse | steam/spiders/email.py | underscorenygren/slick | train | 1 |
edc9cd0a5e7420f36d3244a802e84151589982e9 | [
"try:\n sku = SKU.objects.filter(id=value)\nexcept:\n raise serializers.ValidationError('商品不存在!')\nreturn value",
"\"\"\"\n 获取用户id\n 读取验证后的sku_id\n 连接redis对象\n 去重\n 保存\n 截取前五个浏览记录\n 返回\n \"\"\"\nuser_id = self.context['request'].user.id\nsku_id = valid... | <|body_start_0|>
try:
sku = SKU.objects.filter(id=value)
except:
raise serializers.ValidationError('商品不存在!')
return value
<|end_body_0|>
<|body_start_1|>
"""
获取用户id
读取验证后的sku_id
连接redis对象
去重
... | 添加用户浏览记录校验 | UserBrowseHistorySerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserBrowseHistorySerializer:
"""添加用户浏览记录校验"""
def validate_sku_id(self, value):
"""校验"""
<|body_0|>
def create(self, validated_data):
"""存储浏览记录行为"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
sku = SKU.objects.filter(id=value)... | stack_v2_sparse_classes_36k_train_025254 | 8,286 | no_license | [
{
"docstring": "校验",
"name": "validate_sku_id",
"signature": "def validate_sku_id(self, value)"
},
{
"docstring": "存储浏览记录行为",
"name": "create",
"signature": "def create(self, validated_data)"
}
] | 2 | null | Implement the Python class `UserBrowseHistorySerializer` described below.
Class description:
添加用户浏览记录校验
Method signatures and docstrings:
- def validate_sku_id(self, value): 校验
- def create(self, validated_data): 存储浏览记录行为 | Implement the Python class `UserBrowseHistorySerializer` described below.
Class description:
添加用户浏览记录校验
Method signatures and docstrings:
- def validate_sku_id(self, value): 校验
- def create(self, validated_data): 存储浏览记录行为
<|skeleton|>
class UserBrowseHistorySerializer:
"""添加用户浏览记录校验"""
def validate_sku_id(s... | 61798f2c3624bfde540cfb7469d42564ffe674a6 | <|skeleton|>
class UserBrowseHistorySerializer:
"""添加用户浏览记录校验"""
def validate_sku_id(self, value):
"""校验"""
<|body_0|>
def create(self, validated_data):
"""存储浏览记录行为"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserBrowseHistorySerializer:
"""添加用户浏览记录校验"""
def validate_sku_id(self, value):
"""校验"""
try:
sku = SKU.objects.filter(id=value)
except:
raise serializers.ValidationError('商品不存在!')
return value
def create(self, validated_data):
"""存储浏览记... | the_stack_v2_python_sparse | meiduo_mall/meiduo_mall/apps/users/serializers.py | MEGALO-JOE/meiduo | train | 0 |
cffb471ddf853185f296bd72e85f2fa44d538f81 | [
"Fonts._font_map['MessageAuthor'] = Font(family='Ariel', size=10, weight='bold')\nFonts._font_map['MessageTimestamp'] = Font(family='Ariel', size=7, slant='italic')\nFonts._font_map['MessageText'] = Font(family='Ariel', size=12)\nFonts._font_map['EntryText'] = Font(family='Ariel', size=12)\nFonts._font_map['EmptyAr... | <|body_start_0|>
Fonts._font_map['MessageAuthor'] = Font(family='Ariel', size=10, weight='bold')
Fonts._font_map['MessageTimestamp'] = Font(family='Ariel', size=7, slant='italic')
Fonts._font_map['MessageText'] = Font(family='Ariel', size=12)
Fonts._font_map['EntryText'] = Font(family='A... | Class holding fonts available to UI | Fonts | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Fonts:
"""Class holding fonts available to UI"""
def init():
"""Initialize all fonts"""
<|body_0|>
def get(font_name):
"""Retrieves font with given identifier"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
Fonts._font_map['MessageAuthor'] = Fon... | stack_v2_sparse_classes_36k_train_025255 | 1,088 | no_license | [
{
"docstring": "Initialize all fonts",
"name": "init",
"signature": "def init()"
},
{
"docstring": "Retrieves font with given identifier",
"name": "get",
"signature": "def get(font_name)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007516 | Implement the Python class `Fonts` described below.
Class description:
Class holding fonts available to UI
Method signatures and docstrings:
- def init(): Initialize all fonts
- def get(font_name): Retrieves font with given identifier | Implement the Python class `Fonts` described below.
Class description:
Class holding fonts available to UI
Method signatures and docstrings:
- def init(): Initialize all fonts
- def get(font_name): Retrieves font with given identifier
<|skeleton|>
class Fonts:
"""Class holding fonts available to UI"""
def i... | 812d9fded6492655cb1af729dae915784b74f642 | <|skeleton|>
class Fonts:
"""Class holding fonts available to UI"""
def init():
"""Initialize all fonts"""
<|body_0|>
def get(font_name):
"""Retrieves font with given identifier"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Fonts:
"""Class holding fonts available to UI"""
def init():
"""Initialize all fonts"""
Fonts._font_map['MessageAuthor'] = Font(family='Ariel', size=10, weight='bold')
Fonts._font_map['MessageTimestamp'] = Font(family='Ariel', size=7, slant='italic')
Fonts._font_map['Messa... | the_stack_v2_python_sparse | src/ui/fonts.py | B3W/Endpoints | train | 0 |
be526d189d75c5c7b2352215b2348f3c49e6d51e | [
"result = []\nif root != None:\n if root.left:\n result += self.inorderTraversal(root.left)\n result += [root.val]\n if root.right:\n result += self.inorderTraversal(root.right)\nelse:\n return []\nreturn result",
"result = []\nif root == None:\n return []\nif root == []:\n return ... | <|body_start_0|>
result = []
if root != None:
if root.left:
result += self.inorderTraversal(root.left)
result += [root.val]
if root.right:
result += self.inorderTraversal(root.right)
else:
return []
return re... | recusion | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class recusion:
def inorderTraversal(self, root):
"""中序遍历 :type root: TreeNode :rtype: List[int]"""
<|body_0|>
def preorderTraversal(self, root):
"""前序遍历 :type root: TreeNode :rtype: List[int]"""
<|body_1|>
def postorderTraversal(self, root):
"""后序遍历 :... | stack_v2_sparse_classes_36k_train_025256 | 3,316 | no_license | [
{
"docstring": "中序遍历 :type root: TreeNode :rtype: List[int]",
"name": "inorderTraversal",
"signature": "def inorderTraversal(self, root)"
},
{
"docstring": "前序遍历 :type root: TreeNode :rtype: List[int]",
"name": "preorderTraversal",
"signature": "def preorderTraversal(self, root)"
},
... | 3 | stack_v2_sparse_classes_30k_train_004873 | Implement the Python class `recusion` described below.
Class description:
Implement the recusion class.
Method signatures and docstrings:
- def inorderTraversal(self, root): 中序遍历 :type root: TreeNode :rtype: List[int]
- def preorderTraversal(self, root): 前序遍历 :type root: TreeNode :rtype: List[int]
- def postorderTrav... | Implement the Python class `recusion` described below.
Class description:
Implement the recusion class.
Method signatures and docstrings:
- def inorderTraversal(self, root): 中序遍历 :type root: TreeNode :rtype: List[int]
- def preorderTraversal(self, root): 前序遍历 :type root: TreeNode :rtype: List[int]
- def postorderTrav... | 4105e18050b15fc0409c75353ad31be17187dd34 | <|skeleton|>
class recusion:
def inorderTraversal(self, root):
"""中序遍历 :type root: TreeNode :rtype: List[int]"""
<|body_0|>
def preorderTraversal(self, root):
"""前序遍历 :type root: TreeNode :rtype: List[int]"""
<|body_1|>
def postorderTraversal(self, root):
"""后序遍历 :... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class recusion:
def inorderTraversal(self, root):
"""中序遍历 :type root: TreeNode :rtype: List[int]"""
result = []
if root != None:
if root.left:
result += self.inorderTraversal(root.left)
result += [root.val]
if root.right:
re... | the_stack_v2_python_sparse | BinaryTree_not_recusion.py | NeilWangziyu/Leetcode_py | train | 2 | |
407e13d5eb146718602c7770072a8b089208c608 | [
"kwargs = {'content': ctx.prefix + command_string.lstrip('/')}\nfor override in overrides:\n if isinstance(override, hashcord.User):\n if ctx.guild:\n target_member = None\n with contextlib.suppress(hashcord.HTTPException):\n target_member = ctx.guild.get_member(overri... | <|body_start_0|>
kwargs = {'content': ctx.prefix + command_string.lstrip('/')}
for override in overrides:
if isinstance(override, hashcord.User):
if ctx.guild:
target_member = None
with contextlib.suppress(hashcord.HTTPException):
... | Feature containing the command invocation related commands | InvocationFeature | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InvocationFeature:
"""Feature containing the command invocation related commands"""
async def jsk_override(self, ctx: commands.Context, overrides: commands.Greedy[OVERRIDE_SIGNATURE], *, command_string: str):
"""Run a command with a different user, channel, or thread, optionally bypa... | stack_v2_sparse_classes_36k_train_025257 | 6,899 | permissive | [
{
"docstring": "Run a command with a different user, channel, or thread, optionally bypassing checks and cooldowns. Users will try to resolve to a Member, but will use a User if it can't find one.",
"name": "jsk_override",
"signature": "async def jsk_override(self, ctx: commands.Context, overrides: comm... | 4 | stack_v2_sparse_classes_30k_train_020790 | Implement the Python class `InvocationFeature` described below.
Class description:
Feature containing the command invocation related commands
Method signatures and docstrings:
- async def jsk_override(self, ctx: commands.Context, overrides: commands.Greedy[OVERRIDE_SIGNATURE], *, command_string: str): Run a command w... | Implement the Python class `InvocationFeature` described below.
Class description:
Feature containing the command invocation related commands
Method signatures and docstrings:
- async def jsk_override(self, ctx: commands.Context, overrides: commands.Greedy[OVERRIDE_SIGNATURE], *, command_string: str): Run a command w... | fcdcd677cde0b580b41fe50b9df549e23eb0edc3 | <|skeleton|>
class InvocationFeature:
"""Feature containing the command invocation related commands"""
async def jsk_override(self, ctx: commands.Context, overrides: commands.Greedy[OVERRIDE_SIGNATURE], *, command_string: str):
"""Run a command with a different user, channel, or thread, optionally bypa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InvocationFeature:
"""Feature containing the command invocation related commands"""
async def jsk_override(self, ctx: commands.Context, overrides: commands.Greedy[OVERRIDE_SIGNATURE], *, command_string: str):
"""Run a command with a different user, channel, or thread, optionally bypassing checks ... | the_stack_v2_python_sparse | jishaku/features/invocation.py | ExpertTutorials/Hishaku | train | 0 |
8b58eb312bf776e0baeaadcf56fc80e37b211a90 | [
"if key not in DatasetRegistry._CONSTRUCTORS:\n raise ValueError('key {} is not in the model registry; available: {}'.format(key, DatasetRegistry._CONSTRUCTORS.keys()))\nreturn DatasetRegistry._CONSTRUCTORS[key](*args, **kwargs)",
"if key not in DatasetRegistry._CONSTRUCTORS:\n raise ValueError('key {} is n... | <|body_start_0|>
if key not in DatasetRegistry._CONSTRUCTORS:
raise ValueError('key {} is not in the model registry; available: {}'.format(key, DatasetRegistry._CONSTRUCTORS.keys()))
return DatasetRegistry._CONSTRUCTORS[key](*args, **kwargs)
<|end_body_0|>
<|body_start_1|>
if key no... | Registry class for creating datasets | DatasetRegistry | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DatasetRegistry:
"""Registry class for creating datasets"""
def create(key: str, *args, **kwargs):
"""Create a new dataset for the given key :param key: the dataset key (name) to create :return: the instantiated model"""
<|body_0|>
def attributes(key: str) -> Dict[str, A... | stack_v2_sparse_classes_36k_train_025258 | 2,768 | permissive | [
{
"docstring": "Create a new dataset for the given key :param key: the dataset key (name) to create :return: the instantiated model",
"name": "create",
"signature": "def create(key: str, *args, **kwargs)"
},
{
"docstring": ":param key: the dataset key (name) to create :return: the specified attr... | 3 | stack_v2_sparse_classes_30k_train_020608 | Implement the Python class `DatasetRegistry` described below.
Class description:
Registry class for creating datasets
Method signatures and docstrings:
- def create(key: str, *args, **kwargs): Create a new dataset for the given key :param key: the dataset key (name) to create :return: the instantiated model
- def att... | Implement the Python class `DatasetRegistry` described below.
Class description:
Registry class for creating datasets
Method signatures and docstrings:
- def create(key: str, *args, **kwargs): Create a new dataset for the given key :param key: the dataset key (name) to create :return: the instantiated model
- def att... | b43dc3edc9f7e6cd32368937b7ed3352180abe52 | <|skeleton|>
class DatasetRegistry:
"""Registry class for creating datasets"""
def create(key: str, *args, **kwargs):
"""Create a new dataset for the given key :param key: the dataset key (name) to create :return: the instantiated model"""
<|body_0|>
def attributes(key: str) -> Dict[str, A... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DatasetRegistry:
"""Registry class for creating datasets"""
def create(key: str, *args, **kwargs):
"""Create a new dataset for the given key :param key: the dataset key (name) to create :return: the instantiated model"""
if key not in DatasetRegistry._CONSTRUCTORS:
raise Value... | the_stack_v2_python_sparse | src/sparseml/tensorflow_v1/datasets/registry.py | bharadwaj1098/sparseml | train | 1 |
dffe2bfc596e45295204f107b2f5d66556bec308 | [
"hashset = {}\nres = []\nfor i, m in enumerate(nums):\n if target - m not in hashset:\n hashset[m] = i\n else:\n res.append([hashset[target - m], i])\nreturn res",
"if len(nums) < 3:\n return nums\nresult = []\nfor i in range(len(nums) - 1):\n target = k - nums[i]\n s = self.call(nums... | <|body_start_0|>
hashset = {}
res = []
for i, m in enumerate(nums):
if target - m not in hashset:
hashset[m] = i
else:
res.append([hashset[target - m], i])
return res
<|end_body_0|>
<|body_start_1|>
if len(nums) < 3:
... | Solution | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def call(self, nums, target):
"""在nums中找到两个数,满足和为target :param nums: :param target: :return:"""
<|body_0|>
def call2(self, nums, k):
"""在nums中找到3个数,满足和为k :param nums: :param k: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
hashs... | stack_v2_sparse_classes_36k_train_025259 | 1,506 | permissive | [
{
"docstring": "在nums中找到两个数,满足和为target :param nums: :param target: :return:",
"name": "call",
"signature": "def call(self, nums, target)"
},
{
"docstring": "在nums中找到3个数,满足和为k :param nums: :param k: :return:",
"name": "call2",
"signature": "def call2(self, nums, k)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def call(self, nums, target): 在nums中找到两个数,满足和为target :param nums: :param target: :return:
- def call2(self, nums, k): 在nums中找到3个数,满足和为k :param nums: :param k: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def call(self, nums, target): 在nums中找到两个数,满足和为target :param nums: :param target: :return:
- def call2(self, nums, k): 在nums中找到3个数,满足和为k :param nums: :param k: :return:
<|skeleto... | d2b8eb5d2cafc71ee1ca633ce489c1a52bcc39ce | <|skeleton|>
class Solution:
def call(self, nums, target):
"""在nums中找到两个数,满足和为target :param nums: :param target: :return:"""
<|body_0|>
def call2(self, nums, k):
"""在nums中找到3个数,满足和为k :param nums: :param k: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def call(self, nums, target):
"""在nums中找到两个数,满足和为target :param nums: :param target: :return:"""
hashset = {}
res = []
for i, m in enumerate(nums):
if target - m not in hashset:
hashset[m] = i
else:
res.append([ha... | the_stack_v2_python_sparse | easyleetcode/leetcodes/Leetcode_015_3Sum.py | gongtian1234/easy_leetcode | train | 0 | |
b625beed16b51ac3534311b236bf985db6b7aa7f | [
"if data and data.content_type not in settings.IMAGE_ALLOWED_MIME_TYPES:\n raise forms.ValidationError(self.error_messages['invalid_image'])\nif hasattr(data, 'name') and mimetypes.guess_type(data.name)[0] not in settings.IMAGE_ALLOWED_MIME_TYPES:\n raise forms.ValidationError(self.error_messages['invalid_ima... | <|body_start_0|>
if data and data.content_type not in settings.IMAGE_ALLOWED_MIME_TYPES:
raise forms.ValidationError(self.error_messages['invalid_image'])
if hasattr(data, 'name') and mimetypes.guess_type(data.name)[0] not in settings.IMAGE_ALLOWED_MIME_TYPES:
raise forms.Validat... | Actual FormField that does the validation of the mime-types. | RestrictedImageFormField | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RestrictedImageFormField:
"""Actual FormField that does the validation of the mime-types."""
def to_python(self, data):
"""Checks that the file-upload field data contains a valid image (GIF, JPG, PNG, possibly others -- whatever the engine supports). If the item cannot be converted t... | stack_v2_sparse_classes_36k_train_025260 | 9,634 | permissive | [
{
"docstring": "Checks that the file-upload field data contains a valid image (GIF, JPG, PNG, possibly others -- whatever the engine supports). If the item cannot be converted to an image, check if the file is and svg",
"name": "to_python",
"signature": "def to_python(self, data)"
},
{
"docstrin... | 2 | stack_v2_sparse_classes_30k_train_006182 | Implement the Python class `RestrictedImageFormField` described below.
Class description:
Actual FormField that does the validation of the mime-types.
Method signatures and docstrings:
- def to_python(self, data): Checks that the file-upload field data contains a valid image (GIF, JPG, PNG, possibly others -- whateve... | Implement the Python class `RestrictedImageFormField` described below.
Class description:
Actual FormField that does the validation of the mime-types.
Method signatures and docstrings:
- def to_python(self, data): Checks that the file-upload field data contains a valid image (GIF, JPG, PNG, possibly others -- whateve... | 2b5f3562584137c8c9f5392265db1ab8ee8acf75 | <|skeleton|>
class RestrictedImageFormField:
"""Actual FormField that does the validation of the mime-types."""
def to_python(self, data):
"""Checks that the file-upload field data contains a valid image (GIF, JPG, PNG, possibly others -- whatever the engine supports). If the item cannot be converted t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RestrictedImageFormField:
"""Actual FormField that does the validation of the mime-types."""
def to_python(self, data):
"""Checks that the file-upload field data contains a valid image (GIF, JPG, PNG, possibly others -- whatever the engine supports). If the item cannot be converted to an image, c... | the_stack_v2_python_sparse | bluebottle/utils/fields.py | onepercentclub/bluebottle | train | 15 |
06054eac6355f83806d5f06d5a5287a5724efae8 | [
"if not heights:\n return 0\nstack = []\nmax_area, index = (0, 0)\nlength = len(heights)\nwhile index <= length:\n if not stack or (index < length and heights[index] >= heights[stack[-1]]):\n stack.append(index)\n index += 1\n else:\n old_index = stack.pop()\n width = index if l... | <|body_start_0|>
if not heights:
return 0
stack = []
max_area, index = (0, 0)
length = len(heights)
while index <= length:
if not stack or (index < length and heights[index] >= heights[stack[-1]]):
stack.append(index)
index ... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def largest_rectangle_histogram(self, heights: List[int]) -> int:
"""计算最大矩形长度 Args: heights: 数组长度 Returns: 矩形最大面积"""
<|body_0|>
def largest_rectangle_histogram2(self, heights: List[int]) -> int:
"""计算最大矩形长度 Args: heights: 数组长度 Returns: 矩形最大面积"""
<|b... | stack_v2_sparse_classes_36k_train_025261 | 2,962 | permissive | [
{
"docstring": "计算最大矩形长度 Args: heights: 数组长度 Returns: 矩形最大面积",
"name": "largest_rectangle_histogram",
"signature": "def largest_rectangle_histogram(self, heights: List[int]) -> int"
},
{
"docstring": "计算最大矩形长度 Args: heights: 数组长度 Returns: 矩形最大面积",
"name": "largest_rectangle_histogram2",
... | 2 | stack_v2_sparse_classes_30k_train_005937 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largest_rectangle_histogram(self, heights: List[int]) -> int: 计算最大矩形长度 Args: heights: 数组长度 Returns: 矩形最大面积
- def largest_rectangle_histogram2(self, heights: List[int]) -> int... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largest_rectangle_histogram(self, heights: List[int]) -> int: 计算最大矩形长度 Args: heights: 数组长度 Returns: 矩形最大面积
- def largest_rectangle_histogram2(self, heights: List[int]) -> int... | 50f35eef6a0ad63173efed10df3c835b1dceaa3f | <|skeleton|>
class Solution:
def largest_rectangle_histogram(self, heights: List[int]) -> int:
"""计算最大矩形长度 Args: heights: 数组长度 Returns: 矩形最大面积"""
<|body_0|>
def largest_rectangle_histogram2(self, heights: List[int]) -> int:
"""计算最大矩形长度 Args: heights: 数组长度 Returns: 矩形最大面积"""
<|b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def largest_rectangle_histogram(self, heights: List[int]) -> int:
"""计算最大矩形长度 Args: heights: 数组长度 Returns: 矩形最大面积"""
if not heights:
return 0
stack = []
max_area, index = (0, 0)
length = len(heights)
while index <= length:
if no... | the_stack_v2_python_sparse | src/leetcodepython/array/largest_rectangle_histogram_84.py | zhangyu345293721/leetcode | train | 101 | |
41176375dd1708078131fa94c2441a1dd3701664 | [
"self.platform = 'timesketch'\nself.analyzer_identifier = analyzer_identifier\nself.analyzer_name = analyzer_name\nself.result_status = ''\nself.result_priority = 'NOTE'\nself.result_summary = ''\nself.result_markdown = ''\nself.references = []\nself.result_attributes = {}\nself.platform_meta_data = {'timesketch_in... | <|body_start_0|>
self.platform = 'timesketch'
self.analyzer_identifier = analyzer_identifier
self.analyzer_name = analyzer_name
self.result_status = ''
self.result_priority = 'NOTE'
self.result_summary = ''
self.result_markdown = ''
self.references = []
... | A class to record timesketch analyzer output. Attributes: platform (str): [Required] Analyzer platform. analyzer_identifier (str): [Required] Unique analyzer identifier. analyzer_name (str): [Required] Analyzer display name. result_status (str): [Required] Analyzer result status. Valid values are success or error. resu... | AnalyzerOutput | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnalyzerOutput:
"""A class to record timesketch analyzer output. Attributes: platform (str): [Required] Analyzer platform. analyzer_identifier (str): [Required] Unique analyzer identifier. analyzer_name (str): [Required] Analyzer display name. result_status (str): [Required] Analyzer result statu... | stack_v2_sparse_classes_36k_train_025262 | 47,958 | permissive | [
{
"docstring": "Initialize analyzer output.",
"name": "__init__",
"signature": "def __init__(self, analyzer_identifier, analyzer_name, timesketch_instance, sketch_id, timeline_id)"
},
{
"docstring": "Validates the analyzer output and raises exception.",
"name": "validate",
"signature": "... | 4 | null | Implement the Python class `AnalyzerOutput` described below.
Class description:
A class to record timesketch analyzer output. Attributes: platform (str): [Required] Analyzer platform. analyzer_identifier (str): [Required] Unique analyzer identifier. analyzer_name (str): [Required] Analyzer display name. result_status ... | Implement the Python class `AnalyzerOutput` described below.
Class description:
A class to record timesketch analyzer output. Attributes: platform (str): [Required] Analyzer platform. analyzer_identifier (str): [Required] Unique analyzer identifier. analyzer_name (str): [Required] Analyzer display name. result_status ... | 24f471b58ca4a87cb053961b5f05c07a544ca7b8 | <|skeleton|>
class AnalyzerOutput:
"""A class to record timesketch analyzer output. Attributes: platform (str): [Required] Analyzer platform. analyzer_identifier (str): [Required] Unique analyzer identifier. analyzer_name (str): [Required] Analyzer display name. result_status (str): [Required] Analyzer result statu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AnalyzerOutput:
"""A class to record timesketch analyzer output. Attributes: platform (str): [Required] Analyzer platform. analyzer_identifier (str): [Required] Unique analyzer identifier. analyzer_name (str): [Required] Analyzer display name. result_status (str): [Required] Analyzer result status. Valid valu... | the_stack_v2_python_sparse | timesketch/lib/analyzers/interface.py | google/timesketch | train | 2,263 |
0bfa9e260fe1a7195e425bbce2f3ff8cf9aadf8d | [
"if avd_spec.oxygen:\n return self._LeaseOxygenAVD(avd_spec)\ndevice_factory = remote_instance_cf_device_factory.RemoteInstanceDeviceFactory(avd_spec)\ncreate_report = common_operations.CreateDevices('create_cf', avd_spec.cfg, device_factory, avd_spec.num, report_internal_ip=avd_spec.report_internal_ip, autoconn... | <|body_start_0|>
if avd_spec.oxygen:
return self._LeaseOxygenAVD(avd_spec)
device_factory = remote_instance_cf_device_factory.RemoteInstanceDeviceFactory(avd_spec)
create_report = common_operations.CreateDevices('create_cf', avd_spec.cfg, device_factory, avd_spec.num, report_internal... | Create class for a remote image remote instance AVD. | RemoteImageRemoteInstance | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RemoteImageRemoteInstance:
"""Create class for a remote image remote instance AVD."""
def _CreateAVD(self, avd_spec, no_prompts):
"""Create the AVD. Args: avd_spec: AVDSpec object that tells us what we're going to create. no_prompts: Boolean, True to skip all prompts. Returns: A Repo... | stack_v2_sparse_classes_36k_train_025263 | 4,582 | permissive | [
{
"docstring": "Create the AVD. Args: avd_spec: AVDSpec object that tells us what we're going to create. no_prompts: Boolean, True to skip all prompts. Returns: A Report instance.",
"name": "_CreateAVD",
"signature": "def _CreateAVD(self, avd_spec, no_prompts)"
},
{
"docstring": "Lease the AVD f... | 3 | null | Implement the Python class `RemoteImageRemoteInstance` described below.
Class description:
Create class for a remote image remote instance AVD.
Method signatures and docstrings:
- def _CreateAVD(self, avd_spec, no_prompts): Create the AVD. Args: avd_spec: AVDSpec object that tells us what we're going to create. no_pr... | Implement the Python class `RemoteImageRemoteInstance` described below.
Class description:
Create class for a remote image remote instance AVD.
Method signatures and docstrings:
- def _CreateAVD(self, avd_spec, no_prompts): Create the AVD. Args: avd_spec: AVDSpec object that tells us what we're going to create. no_pr... | 78a61ca023cbf1a0cecfef8b97df2b274ac3a988 | <|skeleton|>
class RemoteImageRemoteInstance:
"""Create class for a remote image remote instance AVD."""
def _CreateAVD(self, avd_spec, no_prompts):
"""Create the AVD. Args: avd_spec: AVDSpec object that tells us what we're going to create. no_prompts: Boolean, True to skip all prompts. Returns: A Repo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RemoteImageRemoteInstance:
"""Create class for a remote image remote instance AVD."""
def _CreateAVD(self, avd_spec, no_prompts):
"""Create the AVD. Args: avd_spec: AVDSpec object that tells us what we're going to create. no_prompts: Boolean, True to skip all prompts. Returns: A Report instance."... | the_stack_v2_python_sparse | tools/acloud/create/remote_image_remote_instance.py | ZYHGOD-1/Aosp11 | train | 0 |
047b64bbd85c3f5606e3b1ae0bf1fa95257faada | [
"def build_prefix(words):\n tree = SuffixTree()\n for i, word in enumerate(words):\n tree.add(word, i)\n return tree\nself.prefix_tree = build_prefix(words)\nself.suffix_tree = build_prefix([word[::-1] for word in words])",
"p = self.prefix_tree.find(prefix)\ns = self.suffix_tree.find(suffix[::-1]... | <|body_start_0|>
def build_prefix(words):
tree = SuffixTree()
for i, word in enumerate(words):
tree.add(word, i)
return tree
self.prefix_tree = build_prefix(words)
self.suffix_tree = build_prefix([word[::-1] for word in words])
<|end_body_0|>
... | WordFilter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordFilter:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def f(self, prefix, suffix):
""":type prefix: str :type suffix: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def build_prefix(words):
tree ... | stack_v2_sparse_classes_36k_train_025264 | 3,233 | no_license | [
{
"docstring": ":type words: List[str]",
"name": "__init__",
"signature": "def __init__(self, words)"
},
{
"docstring": ":type prefix: str :type suffix: str :rtype: int",
"name": "f",
"signature": "def f(self, prefix, suffix)"
}
] | 2 | stack_v2_sparse_classes_30k_test_001041 | Implement the Python class `WordFilter` described below.
Class description:
Implement the WordFilter class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int | Implement the Python class `WordFilter` described below.
Class description:
Implement the WordFilter class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int
<|skeleton|>
class WordFilter:
def __in... | e5dd213411b5c82b07171c3adf4556dcf9c44207 | <|skeleton|>
class WordFilter:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def f(self, prefix, suffix):
""":type prefix: str :type suffix: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WordFilter:
def __init__(self, words):
""":type words: List[str]"""
def build_prefix(words):
tree = SuffixTree()
for i, word in enumerate(words):
tree.add(word, i)
return tree
self.prefix_tree = build_prefix(words)
self.suffix... | the_stack_v2_python_sparse | python/745.prefix-and-suffix-search.py | songzy12/LeetCode | train | 4 | |
585a4d6d52098f9d0570a0a72042a5a95108d28d | [
"if len(height) < 2:\n return 0\nn = len(height)\nmax_area = 0\nfor i in range(n - 1):\n for j in range(i + 1, n):\n area = (j - i) * min(height[i], height[j])\n max_area = max(area, max_area)\nreturn max_area",
"n = len(height)\ni, j = (0, n - 1)\nmax_area = 0\nwhile i < j:\n max_area = ma... | <|body_start_0|>
if len(height) < 2:
return 0
n = len(height)
max_area = 0
for i in range(n - 1):
for j in range(i + 1, n):
area = (j - i) * min(height[i], height[j])
max_area = max(area, max_area)
return max_area
<|end_body... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxArea(self, height):
""":type height: List[int] :rtype: int"""
<|body_0|>
def maxArea1(self, height):
"""用左右两个指针,求最大面积, 即 max((i-j)*min(height[i],height[j])),"""
<|body_1|>
def maxArea2(self, height):
"""除了两端的指针,中间的, 长度都变短了,因此只有当中... | stack_v2_sparse_classes_36k_train_025265 | 1,656 | no_license | [
{
"docstring": ":type height: List[int] :rtype: int",
"name": "maxArea",
"signature": "def maxArea(self, height)"
},
{
"docstring": "用左右两个指针,求最大面积, 即 max((i-j)*min(height[i],height[j])),",
"name": "maxArea1",
"signature": "def maxArea1(self, height)"
},
{
"docstring": "除了两端的指针,中间... | 3 | stack_v2_sparse_classes_30k_test_000081 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxArea(self, height): :type height: List[int] :rtype: int
- def maxArea1(self, height): 用左右两个指针,求最大面积, 即 max((i-j)*min(height[i],height[j])),
- def maxArea2(self, height): 除... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxArea(self, height): :type height: List[int] :rtype: int
- def maxArea1(self, height): 用左右两个指针,求最大面积, 即 max((i-j)*min(height[i],height[j])),
- def maxArea2(self, height): 除... | 11ad9d3841de09c0b4dc3a667e7e63c3558656a5 | <|skeleton|>
class Solution:
def maxArea(self, height):
""":type height: List[int] :rtype: int"""
<|body_0|>
def maxArea1(self, height):
"""用左右两个指针,求最大面积, 即 max((i-j)*min(height[i],height[j])),"""
<|body_1|>
def maxArea2(self, height):
"""除了两端的指针,中间的, 长度都变短了,因此只有当中... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxArea(self, height):
""":type height: List[int] :rtype: int"""
if len(height) < 2:
return 0
n = len(height)
max_area = 0
for i in range(n - 1):
for j in range(i + 1, n):
area = (j - i) * min(height[i], height[j])
... | the_stack_v2_python_sparse | container-with-most-water.py | ganlanshu/leetcode | train | 0 | |
3d1055f97edfdb3e8ec35a889b44d53c290d835b | [
"p_path = self.traverse_node(p)\nq_path = self.traverse_node(q)\nreturn p_path == q_path",
"if not isinstance(node, TreeNode):\n return [node]\ncur_path = [node.val]\nif isinstance(node.left, TreeNode):\n cur_path.extend(self.traverse_node(node.left))\nelse:\n cur_path.append(node.left)\nif isinstance(no... | <|body_start_0|>
p_path = self.traverse_node(p)
q_path = self.traverse_node(q)
return p_path == q_path
<|end_body_0|>
<|body_start_1|>
if not isinstance(node, TreeNode):
return [node]
cur_path = [node.val]
if isinstance(node.left, TreeNode):
cur_p... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isSameTree(self, p, q):
""":type p: TreeNode :type q: TreeNode :rtype: bool"""
<|body_0|>
def traverse_node(self, node):
""":paramn node: obj of TreeNode :returns: list"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
p_path = self.trav... | stack_v2_sparse_classes_36k_train_025266 | 4,919 | no_license | [
{
"docstring": ":type p: TreeNode :type q: TreeNode :rtype: bool",
"name": "isSameTree",
"signature": "def isSameTree(self, p, q)"
},
{
"docstring": ":paramn node: obj of TreeNode :returns: list",
"name": "traverse_node",
"signature": "def traverse_node(self, node)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSameTree(self, p, q): :type p: TreeNode :type q: TreeNode :rtype: bool
- def traverse_node(self, node): :paramn node: obj of TreeNode :returns: list | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSameTree(self, p, q): :type p: TreeNode :type q: TreeNode :rtype: bool
- def traverse_node(self, node): :paramn node: obj of TreeNode :returns: list
<|skeleton|>
class Sol... | 2a7401c6e407db533877de6e20a2b523f7964fdb | <|skeleton|>
class Solution:
def isSameTree(self, p, q):
""":type p: TreeNode :type q: TreeNode :rtype: bool"""
<|body_0|>
def traverse_node(self, node):
""":paramn node: obj of TreeNode :returns: list"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isSameTree(self, p, q):
""":type p: TreeNode :type q: TreeNode :rtype: bool"""
p_path = self.traverse_node(p)
q_path = self.traverse_node(q)
return p_path == q_path
def traverse_node(self, node):
""":paramn node: obj of TreeNode :returns: list"""
... | the_stack_v2_python_sparse | THEORIES/algorithm/leetcode/N100_Same_Tree.py | bb2qqq/tech_notes | train | 0 | |
53566f9a46522ec2a63a822bcef9f07dd1ae9976 | [
"if filter_name == 'Naive':\n filter_0, filter_1, filter_2 = Naive_Filter()\nelif filter_name == 'Sharpness_Center':\n filter_0, filter_1, filter_2 = Sharpness_Center_Filter()\nelif filter_name == 'Sharpness_Edge':\n filter_0, filter_1, filter_2 = Sharpness_Edge_Filter()\nelif filter_name == 'Edge_Detectio... | <|body_start_0|>
if filter_name == 'Naive':
filter_0, filter_1, filter_2 = Naive_Filter()
elif filter_name == 'Sharpness_Center':
filter_0, filter_1, filter_2 = Sharpness_Center_Filter()
elif filter_name == 'Sharpness_Edge':
filter_0, filter_1, filter_2 = Shar... | Filter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Filter:
def __init__(self, filter_name):
"""Choose which filter to be returned 根据用户指定的 滤波器名称,挑选对应的 滤波器配置"""
<|body_0|>
def do_filter(self, im_bgr):
"""执行滤镜 :param im_bgr 要处理的BGR图片 :return 处理后的BGR图片"""
<|body_1|>
def conv(self, image, filter, image_center... | stack_v2_sparse_classes_36k_train_025267 | 14,709 | no_license | [
{
"docstring": "Choose which filter to be returned 根据用户指定的 滤波器名称,挑选对应的 滤波器配置",
"name": "__init__",
"signature": "def __init__(self, filter_name)"
},
{
"docstring": "执行滤镜 :param im_bgr 要处理的BGR图片 :return 处理后的BGR图片",
"name": "do_filter",
"signature": "def do_filter(self, im_bgr)"
},
{
... | 3 | stack_v2_sparse_classes_30k_test_000255 | Implement the Python class `Filter` described below.
Class description:
Implement the Filter class.
Method signatures and docstrings:
- def __init__(self, filter_name): Choose which filter to be returned 根据用户指定的 滤波器名称,挑选对应的 滤波器配置
- def do_filter(self, im_bgr): 执行滤镜 :param im_bgr 要处理的BGR图片 :return 处理后的BGR图片
- def conv... | Implement the Python class `Filter` described below.
Class description:
Implement the Filter class.
Method signatures and docstrings:
- def __init__(self, filter_name): Choose which filter to be returned 根据用户指定的 滤波器名称,挑选对应的 滤波器配置
- def do_filter(self, im_bgr): 执行滤镜 :param im_bgr 要处理的BGR图片 :return 处理后的BGR图片
- def conv... | e5887ccf0a241b757dc4f9aa12bcb89456321a24 | <|skeleton|>
class Filter:
def __init__(self, filter_name):
"""Choose which filter to be returned 根据用户指定的 滤波器名称,挑选对应的 滤波器配置"""
<|body_0|>
def do_filter(self, im_bgr):
"""执行滤镜 :param im_bgr 要处理的BGR图片 :return 处理后的BGR图片"""
<|body_1|>
def conv(self, image, filter, image_center... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Filter:
def __init__(self, filter_name):
"""Choose which filter to be returned 根据用户指定的 滤波器名称,挑选对应的 滤波器配置"""
if filter_name == 'Naive':
filter_0, filter_1, filter_2 = Naive_Filter()
elif filter_name == 'Sharpness_Center':
filter_0, filter_1, filter_2 = Sharpness_... | the_stack_v2_python_sparse | common/imfiltercm.py | elthe/LearnPythonStats | train | 3 | |
8e214d0165f3d290af2fbdd275a4d997fa6d71c1 | [
"hashmap = db_api.get_instance()\ntry:\n group_db = hashmap.get_group_from_mapping(uuid=mapping_id)\n return group_models.Group(**group_db.export_model())\nexcept db_api.MappingHasNoGroup as e:\n pecan.abort(404, e.args[0])",
"hashmap = db_api.get_instance()\nmapping_list = []\nsearch_opts = dict()\nif f... | <|body_start_0|>
hashmap = db_api.get_instance()
try:
group_db = hashmap.get_group_from_mapping(uuid=mapping_id)
return group_models.Group(**group_db.export_model())
except db_api.MappingHasNoGroup as e:
pecan.abort(404, e.args[0])
<|end_body_0|>
<|body_start... | Controller responsible of mappings management. | HashMapMappingsController | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HashMapMappingsController:
"""Controller responsible of mappings management."""
def group(self, mapping_id):
"""Get the group attached to the mapping. :param mapping_id: UUID of the mapping to filter on."""
<|body_0|>
def get_all(self, service_id=None, field_id=None, gro... | stack_v2_sparse_classes_36k_train_025268 | 6,704 | permissive | [
{
"docstring": "Get the group attached to the mapping. :param mapping_id: UUID of the mapping to filter on.",
"name": "group",
"signature": "def group(self, mapping_id)"
},
{
"docstring": "Get the mapping list :param service_id: Service UUID to filter on. :param field_id: Field UUID to filter on... | 6 | null | Implement the Python class `HashMapMappingsController` described below.
Class description:
Controller responsible of mappings management.
Method signatures and docstrings:
- def group(self, mapping_id): Get the group attached to the mapping. :param mapping_id: UUID of the mapping to filter on.
- def get_all(self, ser... | Implement the Python class `HashMapMappingsController` described below.
Class description:
Controller responsible of mappings management.
Method signatures and docstrings:
- def group(self, mapping_id): Get the group attached to the mapping. :param mapping_id: UUID of the mapping to filter on.
- def get_all(self, ser... | 94630b97cd1fb4bdd9a638070ffbbe3625de8aa2 | <|skeleton|>
class HashMapMappingsController:
"""Controller responsible of mappings management."""
def group(self, mapping_id):
"""Get the group attached to the mapping. :param mapping_id: UUID of the mapping to filter on."""
<|body_0|>
def get_all(self, service_id=None, field_id=None, gro... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HashMapMappingsController:
"""Controller responsible of mappings management."""
def group(self, mapping_id):
"""Get the group attached to the mapping. :param mapping_id: UUID of the mapping to filter on."""
hashmap = db_api.get_instance()
try:
group_db = hashmap.get_gr... | the_stack_v2_python_sparse | cloudkitty/rating/hash/controllers/mapping.py | openstack/cloudkitty | train | 103 |
0885954fe9fdf1e8326c860ea50ae4150914aadf | [
"def dfs(node):\n if node is None:\n return ['null']\n res = []\n res.append(str(node.val))\n res.extend(dfs(node.left))\n res.extend(dfs(node.right))\n return res\nreturn ','.join(dfs(root))",
"nodes = deque(data.split(','))\n\ndef dfs():\n s = nodes.popleft()\n if s == 'null':\n ... | <|body_start_0|>
def dfs(node):
if node is None:
return ['null']
res = []
res.append(str(node.val))
res.extend(dfs(node.left))
res.extend(dfs(node.right))
return res
return ','.join(dfs(root))
<|end_body_0|>
<|body_... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_025269 | 1,512 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_train_006501 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | 84b35ec9a4e4319b29eb5f0f226543c9f3f47630 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
def dfs(node):
if node is None:
return ['null']
res = []
res.append(str(node.val))
res.extend(dfs(node.left))
... | the_stack_v2_python_sparse | serialize-and-deserialize-binary-tree.py | maomao905/algo | train | 0 | |
b5128df92e50f6c44c562ea1f21d955df952237b | [
"result = []\nfor ele in nested_list:\n if isinstance(ele, int):\n result.append(ele)\n else:\n result.extend(self._convertor(ele))\nreturn result",
"self.original_data = self._convertor(tmp_tuple)\nself.original_data = sorted(self.original_data)\nself.target = target"
] | <|body_start_0|>
result = []
for ele in nested_list:
if isinstance(ele, int):
result.append(ele)
else:
result.extend(self._convertor(ele))
return result
<|end_body_0|>
<|body_start_1|>
self.original_data = self._convertor(tmp_tuple... | Inherited from the database class | another_database | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class another_database:
"""Inherited from the database class"""
def _convertor(self, nested_list):
"""(number or Iterable thing) -> list Effect: To convert the nested list or tuple into flat list Input: Number or Iterable object Output: Flat list containg all the elements of nested list >>... | stack_v2_sparse_classes_36k_train_025270 | 6,575 | no_license | [
{
"docstring": "(number or Iterable thing) -> list Effect: To convert the nested list or tuple into flat list Input: Number or Iterable object Output: Flat list containg all the elements of nested list >>> print(self._convertor((1, (2,(3),4), (5, 6)), 3)) [1, 2, 3, 4, 5, 6]",
"name": "_convertor",
"sign... | 2 | null | Implement the Python class `another_database` described below.
Class description:
Inherited from the database class
Method signatures and docstrings:
- def _convertor(self, nested_list): (number or Iterable thing) -> list Effect: To convert the nested list or tuple into flat list Input: Number or Iterable object Outp... | Implement the Python class `another_database` described below.
Class description:
Inherited from the database class
Method signatures and docstrings:
- def _convertor(self, nested_list): (number or Iterable thing) -> list Effect: To convert the nested list or tuple into flat list Input: Number or Iterable object Outp... | 8dcc64c2746c908c4121b550ae839a5b75a3edaa | <|skeleton|>
class another_database:
"""Inherited from the database class"""
def _convertor(self, nested_list):
"""(number or Iterable thing) -> list Effect: To convert the nested list or tuple into flat list Input: Number or Iterable object Output: Flat list containg all the elements of nested list >>... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class another_database:
"""Inherited from the database class"""
def _convertor(self, nested_list):
"""(number or Iterable thing) -> list Effect: To convert the nested list or tuple into flat list Input: Number or Iterable object Output: Flat list containg all the elements of nested list >>> print(self.... | the_stack_v2_python_sparse | python/is_member.py | xzpjerry/learning | train | 1 |
d45662f4dd4be5a127e11579b8d510877b610a82 | [
"self.ss = ss\nself.n_step = n_step\nself.interval = step_interval\nself.step_time = step_time",
"lB = self.interval[0]\nuB = self.interval[1]\nstep_vector = [round(uniform(lB, uB), 1) for _ in range(self.n_step)]\nu = np.zeros(shape=dim)\nj = 0\nfor i in range(len(t)):\n if t[i] % self.step_time == 0 and t[i]... | <|body_start_0|>
self.ss = ss
self.n_step = n_step
self.interval = step_interval
self.step_time = step_time
<|end_body_0|>
<|body_start_1|>
lB = self.interval[0]
uB = self.interval[1]
step_vector = [round(uniform(lB, uB), 1) for _ in range(self.n_step)]
u... | RandStep | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandStep:
def __init__(self, step_time, step_interval=None, n_step=None, ss=None):
"""Settings for a random step sequence Args: step_interval (list): Probability interval <a, b> step_time: Time to perform step change n_step (int): Number of steps"""
<|body_0|>
def out(self, ... | stack_v2_sparse_classes_36k_train_025271 | 8,036 | no_license | [
{
"docstring": "Settings for a random step sequence Args: step_interval (list): Probability interval <a, b> step_time: Time to perform step change n_step (int): Number of steps",
"name": "__init__",
"signature": "def __init__(self, step_time, step_interval=None, n_step=None, ss=None)"
},
{
"docs... | 2 | stack_v2_sparse_classes_30k_val_000145 | Implement the Python class `RandStep` described below.
Class description:
Implement the RandStep class.
Method signatures and docstrings:
- def __init__(self, step_time, step_interval=None, n_step=None, ss=None): Settings for a random step sequence Args: step_interval (list): Probability interval <a, b> step_time: Ti... | Implement the Python class `RandStep` described below.
Class description:
Implement the RandStep class.
Method signatures and docstrings:
- def __init__(self, step_time, step_interval=None, n_step=None, ss=None): Settings for a random step sequence Args: step_interval (list): Probability interval <a, b> step_time: Ti... | cf548475295f25407ba968546c2fc85c26f9343c | <|skeleton|>
class RandStep:
def __init__(self, step_time, step_interval=None, n_step=None, ss=None):
"""Settings for a random step sequence Args: step_interval (list): Probability interval <a, b> step_time: Time to perform step change n_step (int): Number of steps"""
<|body_0|>
def out(self, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RandStep:
def __init__(self, step_time, step_interval=None, n_step=None, ss=None):
"""Settings for a random step sequence Args: step_interval (list): Probability interval <a, b> step_time: Time to perform step change n_step (int): Number of steps"""
self.ss = ss
self.n_step = n_step
... | the_stack_v2_python_sparse | SourceCode/simulation/signal.py | martin-bachorik/Master-Thesis-Project | train | 0 | |
72e4de783f782350e41167f8b9566a4da1a6ede5 | [
"query = self.db.query(HomeRecommend).filter(HomeRecommend.Fdeleted == 0)\nif kwargs.get('code', ''):\n query = query.filter(HomeRecommend.Frecommend_type == kwargs.get('code'))\nif kwargs.get('Fproduct_id', ''):\n query = query.filter(HomeRecommend.Fproduct_id == kwargs.get('Fproduct_id'))\nif kwargs.get('Fr... | <|body_start_0|>
query = self.db.query(HomeRecommend).filter(HomeRecommend.Fdeleted == 0)
if kwargs.get('code', ''):
query = query.filter(HomeRecommend.Frecommend_type == kwargs.get('code'))
if kwargs.get('Fproduct_id', ''):
query = query.filter(HomeRecommend.Fproduct_id ... | HomeService | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HomeService:
def query_recommend(self, **kwargs):
"""todo:查询展示信息 :param kwargs: :return:"""
<|body_0|>
def create_recommend(self, **kwargs):
"""todo:创建首页展示信息 :param kwargs: :return:"""
<|body_1|>
def update_recommend(self, re_id, **kwargs):
"""to... | stack_v2_sparse_classes_36k_train_025272 | 2,378 | no_license | [
{
"docstring": "todo:查询展示信息 :param kwargs: :return:",
"name": "query_recommend",
"signature": "def query_recommend(self, **kwargs)"
},
{
"docstring": "todo:创建首页展示信息 :param kwargs: :return:",
"name": "create_recommend",
"signature": "def create_recommend(self, **kwargs)"
},
{
"doc... | 4 | stack_v2_sparse_classes_30k_train_008105 | Implement the Python class `HomeService` described below.
Class description:
Implement the HomeService class.
Method signatures and docstrings:
- def query_recommend(self, **kwargs): todo:查询展示信息 :param kwargs: :return:
- def create_recommend(self, **kwargs): todo:创建首页展示信息 :param kwargs: :return:
- def update_recommen... | Implement the Python class `HomeService` described below.
Class description:
Implement the HomeService class.
Method signatures and docstrings:
- def query_recommend(self, **kwargs): todo:查询展示信息 :param kwargs: :return:
- def create_recommend(self, **kwargs): todo:创建首页展示信息 :param kwargs: :return:
- def update_recommen... | 0596bcb429674b75243d343c73e0f022b6d86820 | <|skeleton|>
class HomeService:
def query_recommend(self, **kwargs):
"""todo:查询展示信息 :param kwargs: :return:"""
<|body_0|>
def create_recommend(self, **kwargs):
"""todo:创建首页展示信息 :param kwargs: :return:"""
<|body_1|>
def update_recommend(self, re_id, **kwargs):
"""to... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HomeService:
def query_recommend(self, **kwargs):
"""todo:查询展示信息 :param kwargs: :return:"""
query = self.db.query(HomeRecommend).filter(HomeRecommend.Fdeleted == 0)
if kwargs.get('code', ''):
query = query.filter(HomeRecommend.Frecommend_type == kwargs.get('code'))
... | the_stack_v2_python_sparse | source/services/home/home_service.py | cash2one/gongzhuhao | train | 0 | |
4e8f8abfffccb64810bf83e43cec1a2e3ddfbe1c | [
"data = base_importData()\ndata.read_csv(filename)\ndata.format_data()\nself.add_standards(data.data)\ndata.clear_data()",
"data = base_importData()\ndata.read_csv(filename)\ndata.format_data()\nself.update_standards(data.data)\ndata.clear_data()",
"data = base_importData()\ndata.read_csv(filename)\ndata.format... | <|body_start_0|>
data = base_importData()
data.read_csv(filename)
data.format_data()
self.add_standards(data.data)
data.clear_data()
<|end_body_0|>
<|body_start_1|>
data = base_importData()
data.read_csv(filename)
data.format_data()
self.update_st... | lims_standards_io | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class lims_standards_io:
def import_standards_add(self, filename):
"""table adds"""
<|body_0|>
def import_standards_update(self, filename):
"""table adds"""
<|body_1|>
def import_standardsOrdering_add(self, filename):
"""table adds"""
<|body_2|... | stack_v2_sparse_classes_36k_train_025273 | 1,277 | permissive | [
{
"docstring": "table adds",
"name": "import_standards_add",
"signature": "def import_standards_add(self, filename)"
},
{
"docstring": "table adds",
"name": "import_standards_update",
"signature": "def import_standards_update(self, filename)"
},
{
"docstring": "table adds",
"... | 4 | stack_v2_sparse_classes_30k_test_000074 | Implement the Python class `lims_standards_io` described below.
Class description:
Implement the lims_standards_io class.
Method signatures and docstrings:
- def import_standards_add(self, filename): table adds
- def import_standards_update(self, filename): table adds
- def import_standardsOrdering_add(self, filename... | Implement the Python class `lims_standards_io` described below.
Class description:
Implement the lims_standards_io class.
Method signatures and docstrings:
- def import_standards_add(self, filename): table adds
- def import_standards_update(self, filename): table adds
- def import_standardsOrdering_add(self, filename... | 5dfd73689674953345d523178a67b8dda10e6d47 | <|skeleton|>
class lims_standards_io:
def import_standards_add(self, filename):
"""table adds"""
<|body_0|>
def import_standards_update(self, filename):
"""table adds"""
<|body_1|>
def import_standardsOrdering_add(self, filename):
"""table adds"""
<|body_2|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class lims_standards_io:
def import_standards_add(self, filename):
"""table adds"""
data = base_importData()
data.read_csv(filename)
data.format_data()
self.add_standards(data.data)
data.clear_data()
def import_standards_update(self, filename):
"""table a... | the_stack_v2_python_sparse | SBaaS_LIMS/lims_standards_io.py | dmccloskey/SBaaS_LIMS | train | 0 | |
587fcc5493081aa26787413f58e6f8e5d8782256 | [
"adm = ProjektAdministration()\nstudenten = adm.get_alle_studenten()\nreturn studenten",
"userId = request.args.get('id')\nname = request.args.get('name')\nmatrNr = request.args.get('matrNr')\nadm = ProjektAdministration()\nstudent = adm.get_student_by_id(userId)\nstudent.set_name(name)\nstudent.set_mat_nr(matrNr... | <|body_start_0|>
adm = ProjektAdministration()
studenten = adm.get_alle_studenten()
return studenten
<|end_body_0|>
<|body_start_1|>
userId = request.args.get('id')
name = request.args.get('name')
matrNr = request.args.get('matrNr')
adm = ProjektAdministration()
... | StudentenOperationen | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StudentenOperationen:
def get(self):
"""Auslesen aller Studenten-Objekte. Sollten keine Studenten-Objekte verfügbar sein, so wird eine leere Sequenz zurückgegeben."""
<|body_0|>
def put(self):
"""Update des Studenten-Objekts."""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_36k_train_025274 | 29,521 | no_license | [
{
"docstring": "Auslesen aller Studenten-Objekte. Sollten keine Studenten-Objekte verfügbar sein, so wird eine leere Sequenz zurückgegeben.",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Update des Studenten-Objekts.",
"name": "put",
"signature": "def put(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008635 | Implement the Python class `StudentenOperationen` described below.
Class description:
Implement the StudentenOperationen class.
Method signatures and docstrings:
- def get(self): Auslesen aller Studenten-Objekte. Sollten keine Studenten-Objekte verfügbar sein, so wird eine leere Sequenz zurückgegeben.
- def put(self)... | Implement the Python class `StudentenOperationen` described below.
Class description:
Implement the StudentenOperationen class.
Method signatures and docstrings:
- def get(self): Auslesen aller Studenten-Objekte. Sollten keine Studenten-Objekte verfügbar sein, so wird eine leere Sequenz zurückgegeben.
- def put(self)... | 9014f16fed08956bd28216e1373b60139e5caea1 | <|skeleton|>
class StudentenOperationen:
def get(self):
"""Auslesen aller Studenten-Objekte. Sollten keine Studenten-Objekte verfügbar sein, so wird eine leere Sequenz zurückgegeben."""
<|body_0|>
def put(self):
"""Update des Studenten-Objekts."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StudentenOperationen:
def get(self):
"""Auslesen aller Studenten-Objekte. Sollten keine Studenten-Objekte verfügbar sein, so wird eine leere Sequenz zurückgegeben."""
adm = ProjektAdministration()
studenten = adm.get_alle_studenten()
return studenten
def put(self):
... | the_stack_v2_python_sparse | src/main.py | leanderpeter/university_project_selector | train | 3 | |
b261e33a15f7278b65224b276db641b5b3647a31 | [
"self._name = name\nself._aws_profile = aws_profile\nself._client = boto3.Session(profile_name=aws_profile, region_name=aws_region).client('autoscaling')",
"config_name = config.get('LaunchConfigurationName', self._name)\nassert config_name == self._name, 'Config name mismatch {} {}'.format(config_name, self._nam... | <|body_start_0|>
self._name = name
self._aws_profile = aws_profile
self._client = boto3.Session(profile_name=aws_profile, region_name=aws_region).client('autoscaling')
<|end_body_0|>
<|body_start_1|>
config_name = config.get('LaunchConfigurationName', self._name)
assert config_n... | LaunchConfig | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LaunchConfig:
def __init__(self, name, aws_profile=None, aws_region=None):
"""Init method. Will create AWS clients."""
<|body_0|>
def create(self, config):
"""Create a new launch config using config dict passed in. Config name in __init__ and create must match."""
... | stack_v2_sparse_classes_36k_train_025275 | 3,497 | permissive | [
{
"docstring": "Init method. Will create AWS clients.",
"name": "__init__",
"signature": "def __init__(self, name, aws_profile=None, aws_region=None)"
},
{
"docstring": "Create a new launch config using config dict passed in. Config name in __init__ and create must match.",
"name": "create",... | 5 | stack_v2_sparse_classes_30k_train_003768 | Implement the Python class `LaunchConfig` described below.
Class description:
Implement the LaunchConfig class.
Method signatures and docstrings:
- def __init__(self, name, aws_profile=None, aws_region=None): Init method. Will create AWS clients.
- def create(self, config): Create a new launch config using config dic... | Implement the Python class `LaunchConfig` described below.
Class description:
Implement the LaunchConfig class.
Method signatures and docstrings:
- def __init__(self, name, aws_profile=None, aws_region=None): Init method. Will create AWS clients.
- def create(self, config): Create a new launch config using config dic... | 8601d652476cd30457961aaf9feac143fd437606 | <|skeleton|>
class LaunchConfig:
def __init__(self, name, aws_profile=None, aws_region=None):
"""Init method. Will create AWS clients."""
<|body_0|>
def create(self, config):
"""Create a new launch config using config dict passed in. Config name in __init__ and create must match."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LaunchConfig:
def __init__(self, name, aws_profile=None, aws_region=None):
"""Init method. Will create AWS clients."""
self._name = name
self._aws_profile = aws_profile
self._client = boto3.Session(profile_name=aws_profile, region_name=aws_region).client('autoscaling')
def... | the_stack_v2_python_sparse | common/python/ax/cloud/aws/launch_config.py | durgeshsanagaram/argo | train | 1 | |
0f7bb7ee20db089e5e517ad21f1e80d0c1afd130 | [
"ans = []\nfor ridx in range(numRows):\n line = [None] * (ridx + 1)\n line[0], line[-1] = (1, 1)\n for cidx in range(1, ridx):\n line[cidx] = ans[ridx - 1][cidx - 1] + ans[ridx - 1][cidx]\n ans.append(line)\nreturn ans",
"if numRows <= 0:\n return []\nans = [[1]]\nfor ridx in range(1, numRow... | <|body_start_0|>
ans = []
for ridx in range(numRows):
line = [None] * (ridx + 1)
line[0], line[-1] = (1, 1)
for cidx in range(1, ridx):
line[cidx] = ans[ridx - 1][cidx - 1] + ans[ridx - 1][cidx]
ans.append(line)
return ans
<|end_bod... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def generate(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
<|body_0|>
def generate_v0(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ans = []
for rid... | stack_v2_sparse_classes_36k_train_025276 | 2,083 | no_license | [
{
"docstring": ":type numRows: int :rtype: List[List[int]]",
"name": "generate",
"signature": "def generate(self, numRows)"
},
{
"docstring": ":type numRows: int :rtype: List[List[int]]",
"name": "generate_v0",
"signature": "def generate_v0(self, numRows)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def generate(self, numRows): :type numRows: int :rtype: List[List[int]]
- def generate_v0(self, numRows): :type numRows: int :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def generate(self, numRows): :type numRows: int :rtype: List[List[int]]
- def generate_v0(self, numRows): :type numRows: int :rtype: List[List[int]]
<|skeleton|>
class Solution:... | b5e09f24e8e96454dc99e20281e853fb9fcc85ed | <|skeleton|>
class Solution:
def generate(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
<|body_0|>
def generate_v0(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def generate(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
ans = []
for ridx in range(numRows):
line = [None] * (ridx + 1)
line[0], line[-1] = (1, 1)
for cidx in range(1, ridx):
line[cidx] = ans[ridx - 1][... | the_stack_v2_python_sparse | python/118_Pascals_Triangle.py | Moby5/myleetcode | train | 2 | |
9aa67eebd904f7a639e5ea3f0c9717466fd6a7aa | [
"body_dict = super(RelatedEntity, self).to_body_dict()\nbody_dict['_relatedFields'] = []\nfor attrname, field in six.iteritems(self._meta._related_fields):\n body_dict['_relatedFields'].append(attrname)\nreturn body_dict",
"attributes = {}\nauthors = [author for author in getattr(self, 'authors', []) if author... | <|body_start_0|>
body_dict = super(RelatedEntity, self).to_body_dict()
body_dict['_relatedFields'] = []
for attrname, field in six.iteritems(self._meta._related_fields):
body_dict['_relatedFields'].append(attrname)
return body_dict
<|end_body_0|>
<|body_start_1|>
att... | Model for entities related to projects. | RelatedEntity | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RelatedEntity:
"""Model for entities related to projects."""
def to_body_dict(self):
"""Serialize to Agave's REST API payload JSON."""
<|body_0|>
def to_datacite_json(self):
"""Serialize object to datacite JSON. Every entity subclassing this class should add a `a... | stack_v2_sparse_classes_36k_train_025277 | 27,672 | no_license | [
{
"docstring": "Serialize to Agave's REST API payload JSON.",
"name": "to_body_dict",
"signature": "def to_body_dict(self)"
},
{
"docstring": "Serialize object to datacite JSON. Every entity subclassing this class should add a `attributes['types']['resourceType']` e.g. ``attributes['types']['res... | 2 | null | Implement the Python class `RelatedEntity` described below.
Class description:
Model for entities related to projects.
Method signatures and docstrings:
- def to_body_dict(self): Serialize to Agave's REST API payload JSON.
- def to_datacite_json(self): Serialize object to datacite JSON. Every entity subclassing this ... | Implement the Python class `RelatedEntity` described below.
Class description:
Model for entities related to projects.
Method signatures and docstrings:
- def to_body_dict(self): Serialize to Agave's REST API payload JSON.
- def to_datacite_json(self): Serialize object to datacite JSON. Every entity subclassing this ... | 040e0d88eac6037703a6128d6f4644b5a99ea11b | <|skeleton|>
class RelatedEntity:
"""Model for entities related to projects."""
def to_body_dict(self):
"""Serialize to Agave's REST API payload JSON."""
<|body_0|>
def to_datacite_json(self):
"""Serialize object to datacite JSON. Every entity subclassing this class should add a `a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RelatedEntity:
"""Model for entities related to projects."""
def to_body_dict(self):
"""Serialize to Agave's REST API payload JSON."""
body_dict = super(RelatedEntity, self).to_body_dict()
body_dict['_relatedFields'] = []
for attrname, field in six.iteritems(self._meta._re... | the_stack_v2_python_sparse | designsafe/apps/projects/models/agave/base.py | DesignSafe-CI/portal | train | 12 |
25e04c350a7670151c579819175feabf2f1ddda0 | [
"self.capacity = capacity\nself.stacks = defaultdict(list)\nself.left = 0\nself.right = -1",
"while self.left in self.stacks and len(self.stacks[self.left]) == self.capacity:\n self.left += 1\nif self.left > self.right:\n self.right = self.left\nself.stacks[self.left].append(val)",
"if self.right == -1:\n... | <|body_start_0|>
self.capacity = capacity
self.stacks = defaultdict(list)
self.left = 0
self.right = -1
<|end_body_0|>
<|body_start_1|>
while self.left in self.stacks and len(self.stacks[self.left]) == self.capacity:
self.left += 1
if self.left > self.right:
... | DinnerPlates | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DinnerPlates:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def push(self, val):
""":type val: int :rtype: None"""
<|body_1|>
def pop(self):
""":rtype: int"""
<|body_2|>
def popAtStack(self, index):
""":t... | stack_v2_sparse_classes_36k_train_025278 | 1,509 | no_license | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":type val: int :rtype: None",
"name": "push",
"signature": "def push(self, val)"
},
{
"docstring": ":rtype: int",
"name": "pop",
"signature": "def pop(... | 4 | stack_v2_sparse_classes_30k_train_008174 | Implement the Python class `DinnerPlates` described below.
Class description:
Implement the DinnerPlates class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def push(self, val): :type val: int :rtype: None
- def pop(self): :rtype: int
- def popAtStack(self, index): :type ind... | Implement the Python class `DinnerPlates` described below.
Class description:
Implement the DinnerPlates class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def push(self, val): :type val: int :rtype: None
- def pop(self): :rtype: int
- def popAtStack(self, index): :type ind... | c82d375f8d9d4feeaba243eb5c990c1ba3ec73d2 | <|skeleton|>
class DinnerPlates:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def push(self, val):
""":type val: int :rtype: None"""
<|body_1|>
def pop(self):
""":rtype: int"""
<|body_2|>
def popAtStack(self, index):
""":t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DinnerPlates:
def __init__(self, capacity):
""":type capacity: int"""
self.capacity = capacity
self.stacks = defaultdict(list)
self.left = 0
self.right = -1
def push(self, val):
""":type val: int :rtype: None"""
while self.left in self.stacks and le... | the_stack_v2_python_sparse | 1172_dinner_plate_stacks.py | 0as1s/leetcode | train | 0 | |
e1775016c11651ce950d038615e399e3ad5e0df3 | [
"self.width = width\nself.height = height\nself.food = food\nself.food_index = 0\nself.shape = [(0, 0)]\nself.positions = set([(0, 0)])",
"curr = self.shape[-1]\nmapping = {'U': (-1, 0), 'L': (0, -1), 'R': (0, 1), 'D': (1, 0)}\ndelta = mapping[direction]\nnext_pos = (curr[0] + delta[0], curr[1] + delta[1])\nif ne... | <|body_start_0|>
self.width = width
self.height = height
self.food = food
self.food_index = 0
self.shape = [(0, 0)]
self.positions = set([(0, 0)])
<|end_body_0|>
<|body_start_1|>
curr = self.shape[-1]
mapping = {'U': (-1, 0), 'L': (0, -1), 'R': (0, 1), 'D... | SnakeGame | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SnakeGame:
def __init__(self, width: int, height: int, food: List[List[int]]):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t... | stack_v2_sparse_classes_36k_train_025279 | 1,921 | permissive | [
{
"docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0].",
"name": "__init__",
"signature": "def __init__(self, widt... | 2 | stack_v2_sparse_classes_30k_train_006123 | Implement the Python class `SnakeGame` described below.
Class description:
Implement the SnakeGame class.
Method signatures and docstrings:
- def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -... | Implement the Python class `SnakeGame` described below.
Class description:
Implement the SnakeGame class.
Method signatures and docstrings:
- def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -... | 7ad7e5c1c040510b7b7bd225ed4297054464dbc6 | <|skeleton|>
class SnakeGame:
def __init__(self, width: int, height: int, food: List[List[int]]):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SnakeGame:
def __init__(self, width: int, height: int, food: List[List[int]]):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is a... | the_stack_v2_python_sparse | questions/design-snake-game/Solution.py | franklingu/leetcode-solutions | train | 155 | |
0a4c44bc77a83a91c5079107c61f2c69314a8142 | [
"app = kwargs.pop('app', self.instance)\ntype = kwargs.pop('type', None)\nif type is None:\n raise NotImplementedError()\nif type == Material.Type.NEWS:\n return self.create_news(app=app, **kwargs)\nelse:\n media_id = kwargs['media_id']\n if type == Material.Type.VIDEO and 'url' not in kwargs:\n ... | <|body_start_0|>
app = kwargs.pop('app', self.instance)
type = kwargs.pop('type', None)
if type is None:
raise NotImplementedError()
if type == Material.Type.NEWS:
return self.create_news(app=app, **kwargs)
else:
media_id = kwargs['media_id']
... | MaterialManager | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MaterialManager:
def create_material(self, **kwargs):
"""创建永久素材"""
<|body_0|>
def create_news(self, **kwargs):
"""创建永久图文素材"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
app = kwargs.pop('app', self.instance)
type = kwargs.pop('type', None)... | stack_v2_sparse_classes_36k_train_025280 | 10,590 | permissive | [
{
"docstring": "创建永久素材",
"name": "create_material",
"signature": "def create_material(self, **kwargs)"
},
{
"docstring": "创建永久图文素材",
"name": "create_news",
"signature": "def create_news(self, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016752 | Implement the Python class `MaterialManager` described below.
Class description:
Implement the MaterialManager class.
Method signatures and docstrings:
- def create_material(self, **kwargs): 创建永久素材
- def create_news(self, **kwargs): 创建永久图文素材 | Implement the Python class `MaterialManager` described below.
Class description:
Implement the MaterialManager class.
Method signatures and docstrings:
- def create_material(self, **kwargs): 创建永久素材
- def create_news(self, **kwargs): 创建永久图文素材
<|skeleton|>
class MaterialManager:
def create_material(self, **kwargs... | 526e2d9d261fde8279314cf30fb70dbeb439d943 | <|skeleton|>
class MaterialManager:
def create_material(self, **kwargs):
"""创建永久素材"""
<|body_0|>
def create_news(self, **kwargs):
"""创建永久图文素材"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MaterialManager:
def create_material(self, **kwargs):
"""创建永久素材"""
app = kwargs.pop('app', self.instance)
type = kwargs.pop('type', None)
if type is None:
raise NotImplementedError()
if type == Material.Type.NEWS:
return self.create_news(app=app,... | the_stack_v2_python_sparse | wechat_django/models/material.py | Xavier-Lam/wechat-django | train | 185 | |
41a1bdbd796044cf61ec21f143fe14c9f3d292b6 | [
"self._PCA = None\nself._mean_x = np.mean(X, axis=0)\nmean_removed = X\ncov = np.cov(mean_removed, rowvar=False)\nif np.linalg.det(cov) == 0.0:\n print('PCA ing')\n eig_val, eig_vec = np.linalg.eig(cov)\n e_val_index = np.argsort(-eig_val)\n e_val_index = e_val_index[e_val_index > 0.001]\n self._PCA ... | <|body_start_0|>
self._PCA = None
self._mean_x = np.mean(X, axis=0)
mean_removed = X
cov = np.cov(mean_removed, rowvar=False)
if np.linalg.det(cov) == 0.0:
print('PCA ing')
eig_val, eig_vec = np.linalg.eig(cov)
e_val_index = np.argsort(-eig_val... | MahalanobisDistance | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MahalanobisDistance:
def __init__(self, X):
"""构造函数 :param X:m * n维的np数据矩阵 每一行是一个sample 列是特征"""
<|body_0|>
def __call__(self, X, y=None):
"""计算x与y的马氏距离 如果不传入y则计算x到样本中心的距离 :param X:行向量/矩阵 样本点特征维数必须和原始数据一样 y:行向量 样本点特征维数必须和原始数据一样 :return distance 马氏距离 如果出错则返回-1"""
... | stack_v2_sparse_classes_36k_train_025281 | 5,802 | no_license | [
{
"docstring": "构造函数 :param X:m * n维的np数据矩阵 每一行是一个sample 列是特征",
"name": "__init__",
"signature": "def __init__(self, X)"
},
{
"docstring": "计算x与y的马氏距离 如果不传入y则计算x到样本中心的距离 :param X:行向量/矩阵 样本点特征维数必须和原始数据一样 y:行向量 样本点特征维数必须和原始数据一样 :return distance 马氏距离 如果出错则返回-1",
"name": "__call__",
"signatu... | 2 | stack_v2_sparse_classes_30k_test_001002 | Implement the Python class `MahalanobisDistance` described below.
Class description:
Implement the MahalanobisDistance class.
Method signatures and docstrings:
- def __init__(self, X): 构造函数 :param X:m * n维的np数据矩阵 每一行是一个sample 列是特征
- def __call__(self, X, y=None): 计算x与y的马氏距离 如果不传入y则计算x到样本中心的距离 :param X:行向量/矩阵 样本点特征维数必... | Implement the Python class `MahalanobisDistance` described below.
Class description:
Implement the MahalanobisDistance class.
Method signatures and docstrings:
- def __init__(self, X): 构造函数 :param X:m * n维的np数据矩阵 每一行是一个sample 列是特征
- def __call__(self, X, y=None): 计算x与y的马氏距离 如果不传入y则计算x到样本中心的距离 :param X:行向量/矩阵 样本点特征维数必... | 900e4368b2b0cb4c7804ba56d35f433a5e3a21cf | <|skeleton|>
class MahalanobisDistance:
def __init__(self, X):
"""构造函数 :param X:m * n维的np数据矩阵 每一行是一个sample 列是特征"""
<|body_0|>
def __call__(self, X, y=None):
"""计算x与y的马氏距离 如果不传入y则计算x到样本中心的距离 :param X:行向量/矩阵 样本点特征维数必须和原始数据一样 y:行向量 样本点特征维数必须和原始数据一样 :return distance 马氏距离 如果出错则返回-1"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MahalanobisDistance:
def __init__(self, X):
"""构造函数 :param X:m * n维的np数据矩阵 每一行是一个sample 列是特征"""
self._PCA = None
self._mean_x = np.mean(X, axis=0)
mean_removed = X
cov = np.cov(mean_removed, rowvar=False)
if np.linalg.det(cov) == 0.0:
print('PCA ing'... | the_stack_v2_python_sparse | proj/mashi_distance.py | zz10001/wama_medic | train | 1 | |
bac021f94f2e11735c86c690c60800a8c16a2fd2 | [
"if pull_target and app_engine_http_target:\n raise CreatingPullAndAppEngineQueueError('Attempting to send PullTarget and AppEngineHttpTarget simultaneously')\nqueue = self.messages.Queue(name=queue_ref.RelativeName(), retryConfig=retry_config, rateLimits=rate_limits, pullTarget=pull_target, appEngineHttpTarget=... | <|body_start_0|>
if pull_target and app_engine_http_target:
raise CreatingPullAndAppEngineQueueError('Attempting to send PullTarget and AppEngineHttpTarget simultaneously')
queue = self.messages.Queue(name=queue_ref.RelativeName(), retryConfig=retry_config, rateLimits=rate_limits, pullTarget... | Client for queues service in the Cloud Tasks API. | AlphaQueues | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlphaQueues:
"""Client for queues service in the Cloud Tasks API."""
def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, pull_target=None, app_engine_http_target=None):
"""Prepares and sends a Create request for creating a queue."""
<|body_0|>
de... | stack_v2_sparse_classes_36k_train_025282 | 9,305 | permissive | [
{
"docstring": "Prepares and sends a Create request for creating a queue.",
"name": "Create",
"signature": "def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, pull_target=None, app_engine_http_target=None)"
},
{
"docstring": "Prepares and sends a Patch request for modif... | 2 | stack_v2_sparse_classes_30k_train_004996 | Implement the Python class `AlphaQueues` described below.
Class description:
Client for queues service in the Cloud Tasks API.
Method signatures and docstrings:
- def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, pull_target=None, app_engine_http_target=None): Prepares and sends a Create re... | Implement the Python class `AlphaQueues` described below.
Class description:
Client for queues service in the Cloud Tasks API.
Method signatures and docstrings:
- def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, pull_target=None, app_engine_http_target=None): Prepares and sends a Create re... | 85bb264e273568b5a0408f733b403c56373e2508 | <|skeleton|>
class AlphaQueues:
"""Client for queues service in the Cloud Tasks API."""
def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, pull_target=None, app_engine_http_target=None):
"""Prepares and sends a Create request for creating a queue."""
<|body_0|>
de... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AlphaQueues:
"""Client for queues service in the Cloud Tasks API."""
def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, pull_target=None, app_engine_http_target=None):
"""Prepares and sends a Create request for creating a queue."""
if pull_target and app_engine_h... | the_stack_v2_python_sparse | google-cloud-sdk/lib/googlecloudsdk/api_lib/tasks/queues.py | bopopescu/socialliteapp | train | 0 |
b9ff1d46ae3c554191dbefca37085bd0d8db7ccd | [
"self.input_directory = Path(input_directory)\nself.output_directory = Path(output_directory)\nself.output_directory.mkdir(parents=True, exist_ok=False)",
"dataset_gdf = pd.concat(dataset)\ndataset_gdf['original_file'] = dataset_gdf['original_file'].astype(str)\ndataset_gdf.to_file(str(self.output_directory / f'f... | <|body_start_0|>
self.input_directory = Path(input_directory)
self.output_directory = Path(output_directory)
self.output_directory.mkdir(parents=True, exist_ok=False)
<|end_body_0|>
<|body_start_1|>
dataset_gdf = pd.concat(dataset)
dataset_gdf['original_file'] = dataset_gdf['ori... | The GeoDataFrame generator class that turns txt files into geojson. | GeoDataGenerator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GeoDataGenerator:
"""The GeoDataFrame generator class that turns txt files into geojson."""
def __init__(self, input_directory, output_directory):
"""Initialize the GeoDataGenerator. Args: input_directory (str): Directory with images. output_directory (str): Target directory for geoj... | stack_v2_sparse_classes_36k_train_025283 | 5,325 | no_license | [
{
"docstring": "Initialize the GeoDataGenerator. Args: input_directory (str): Directory with images. output_directory (str): Target directory for geojson files.",
"name": "__init__",
"signature": "def __init__(self, input_directory, output_directory)"
},
{
"docstring": "Save a block of images. A... | 5 | stack_v2_sparse_classes_30k_train_020237 | Implement the Python class `GeoDataGenerator` described below.
Class description:
The GeoDataFrame generator class that turns txt files into geojson.
Method signatures and docstrings:
- def __init__(self, input_directory, output_directory): Initialize the GeoDataGenerator. Args: input_directory (str): Directory with ... | Implement the Python class `GeoDataGenerator` described below.
Class description:
The GeoDataFrame generator class that turns txt files into geojson.
Method signatures and docstrings:
- def __init__(self, input_directory, output_directory): Initialize the GeoDataGenerator. Args: input_directory (str): Directory with ... | 1b953d87968dac46ebbc9b1d5c254ea9493ee328 | <|skeleton|>
class GeoDataGenerator:
"""The GeoDataFrame generator class that turns txt files into geojson."""
def __init__(self, input_directory, output_directory):
"""Initialize the GeoDataGenerator. Args: input_directory (str): Directory with images. output_directory (str): Target directory for geoj... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GeoDataGenerator:
"""The GeoDataFrame generator class that turns txt files into geojson."""
def __init__(self, input_directory, output_directory):
"""Initialize the GeoDataGenerator. Args: input_directory (str): Directory with images. output_directory (str): Target directory for geojson files."""... | the_stack_v2_python_sparse | fmlwright/dataset_builder/GeoDataGenerator.py | rgresia-umd/fml-wright | train | 0 |
3f6a89e3a8b61a11ad47be8f814ae3719b0c214c | [
"self.addy = oaddy\nself.type = otype\nself.ref_count = 'unknown'\nself.events = []",
"if txt in self.events:\n return True\nreturn False",
"self.events.append(txt)\nrc_str = 'ReferenceCount ='\nrc_idx = txt.find(rc_str)\nif rc_idx > 0:\n rc = txt[rc_idx + len(rc_str) + 1:]\n self.ref_count = int(rc)",... | <|body_start_0|>
self.addy = oaddy
self.type = otype
self.ref_count = 'unknown'
self.events = []
<|end_body_0|>
<|body_start_1|>
if txt in self.events:
return True
return False
<|end_body_1|>
<|body_start_2|>
self.events.append(txt)
rc_str = ... | Holds debug messages for a unique vtk object. | trace_object | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class trace_object:
"""Holds debug messages for a unique vtk object."""
def __init__(self, oaddy, otype):
"""Creates a trace object"""
<|body_0|>
def check_event(self, txt):
"""Checks if this object contains this event"""
<|body_1|>
def add_event(self, txt... | stack_v2_sparse_classes_36k_train_025284 | 6,532 | permissive | [
{
"docstring": "Creates a trace object",
"name": "__init__",
"signature": "def __init__(self, oaddy, otype)"
},
{
"docstring": "Checks if this object contains this event",
"name": "check_event",
"signature": "def check_event(self, txt)"
},
{
"docstring": "Adds a new event",
"... | 5 | null | Implement the Python class `trace_object` described below.
Class description:
Holds debug messages for a unique vtk object.
Method signatures and docstrings:
- def __init__(self, oaddy, otype): Creates a trace object
- def check_event(self, txt): Checks if this object contains this event
- def add_event(self, txt): A... | Implement the Python class `trace_object` described below.
Class description:
Holds debug messages for a unique vtk object.
Method signatures and docstrings:
- def __init__(self, oaddy, otype): Creates a trace object
- def check_event(self, txt): Checks if this object contains this event
- def add_event(self, txt): A... | 601ae46e0bef2e18425b482a755d03490ade0493 | <|skeleton|>
class trace_object:
"""Holds debug messages for a unique vtk object."""
def __init__(self, oaddy, otype):
"""Creates a trace object"""
<|body_0|>
def check_event(self, txt):
"""Checks if this object contains this event"""
<|body_1|>
def add_event(self, txt... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class trace_object:
"""Holds debug messages for a unique vtk object."""
def __init__(self, oaddy, otype):
"""Creates a trace object"""
self.addy = oaddy
self.type = otype
self.ref_count = 'unknown'
self.events = []
def check_event(self, txt):
"""Checks if th... | the_stack_v2_python_sparse | src/tools/dev/vtk_debug_parser/vtk_debug_trace_parser.py | visit-dav/visit | train | 335 |
32deaced353c44932cd31cf6ee85ba507ab554eb | [
"agent_keys = list(self._agents.keys())\nif shuffled:\n self.model.random.shuffle(agent_keys)\nfor key in agent_keys:\n if key in self._agents:\n yield (key, self._agents[key])",
"for key, agent in self.agent_buffer():\n try:\n shape = gdf.at[key, 'geometry']\n except KeyError:\n ... | <|body_start_0|>
agent_keys = list(self._agents.keys())
if shuffled:
self.model.random.shuffle(agent_keys)
for key in agent_keys:
if key in self._agents:
yield (key, self._agents[key])
<|end_body_0|>
<|body_start_1|>
for key, agent in self.agent_b... | Scheduler with data consumption on each step. | DataScheduler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataScheduler:
"""Scheduler with data consumption on each step."""
def agent_buffer(self, shuffled: bool=False) -> Iterator[Tuple]:
"""Simple generator that yields the agents while letting the user remove and/or add agents during stepping."""
<|body_0|>
def step(self, gd... | stack_v2_sparse_classes_36k_train_025285 | 1,166 | no_license | [
{
"docstring": "Simple generator that yields the agents while letting the user remove and/or add agents during stepping.",
"name": "agent_buffer",
"signature": "def agent_buffer(self, shuffled: bool=False) -> Iterator[Tuple]"
},
{
"docstring": "Execute the step of all agents, one at a time, in r... | 2 | stack_v2_sparse_classes_30k_train_014055 | Implement the Python class `DataScheduler` described below.
Class description:
Scheduler with data consumption on each step.
Method signatures and docstrings:
- def agent_buffer(self, shuffled: bool=False) -> Iterator[Tuple]: Simple generator that yields the agents while letting the user remove and/or add agents duri... | Implement the Python class `DataScheduler` described below.
Class description:
Scheduler with data consumption on each step.
Method signatures and docstrings:
- def agent_buffer(self, shuffled: bool=False) -> Iterator[Tuple]: Simple generator that yields the agents while letting the user remove and/or add agents duri... | 26f5fe15be93fd277f3086a2fabddca4228bf963 | <|skeleton|>
class DataScheduler:
"""Scheduler with data consumption on each step."""
def agent_buffer(self, shuffled: bool=False) -> Iterator[Tuple]:
"""Simple generator that yields the agents while letting the user remove and/or add agents during stepping."""
<|body_0|>
def step(self, gd... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataScheduler:
"""Scheduler with data consumption on each step."""
def agent_buffer(self, shuffled: bool=False) -> Iterator[Tuple]:
"""Simple generator that yields the agents while letting the user remove and/or add agents during stepping."""
agent_keys = list(self._agents.keys())
... | the_stack_v2_python_sparse | geocovid/scheduler.py | awolfmann/geocovid | train | 0 |
60081737771f9ae9e07b46c4a49b29da261fd360 | [
"cuts = [0] + cuts + [n]\ncuts.sort()\n\n@functools.lru_cache(None)\ndef dp(l, r):\n if l >= r - 1:\n return 0\n ans = math.inf\n for k in range(l + 1, r):\n new_v = dp(l, k) + dp(k, r) + cuts[r] - cuts[l]\n ans = min(ans, new_v)\n return ans if ans != math.inf else 0\nreturn dp(0, ... | <|body_start_0|>
cuts = [0] + cuts + [n]
cuts.sort()
@functools.lru_cache(None)
def dp(l, r):
if l >= r - 1:
return 0
ans = math.inf
for k in range(l + 1, r):
new_v = dp(l, k) + dp(k, r) + cuts[r] - cuts[l]
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minCost1(self, n: int, cuts: List[int]) -> int:
"""思路:递归 @param n: @param cuts: @return:"""
<|body_0|>
def minCost2(self, n: int, cuts: List[int]) -> int:
"""思路:记忆化递归 @param n: @param cuts: @return:"""
<|body_1|>
def minCost3(self, n: int, ... | stack_v2_sparse_classes_36k_train_025286 | 3,880 | no_license | [
{
"docstring": "思路:递归 @param n: @param cuts: @return:",
"name": "minCost1",
"signature": "def minCost1(self, n: int, cuts: List[int]) -> int"
},
{
"docstring": "思路:记忆化递归 @param n: @param cuts: @return:",
"name": "minCost2",
"signature": "def minCost2(self, n: int, cuts: List[int]) -> int... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minCost1(self, n: int, cuts: List[int]) -> int: 思路:递归 @param n: @param cuts: @return:
- def minCost2(self, n: int, cuts: List[int]) -> int: 思路:记忆化递归 @param n: @param cuts: @r... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minCost1(self, n: int, cuts: List[int]) -> int: 思路:递归 @param n: @param cuts: @return:
- def minCost2(self, n: int, cuts: List[int]) -> int: 思路:记忆化递归 @param n: @param cuts: @r... | e43ee86c5a8cdb808da09b4b6138e10275abadb5 | <|skeleton|>
class Solution:
def minCost1(self, n: int, cuts: List[int]) -> int:
"""思路:递归 @param n: @param cuts: @return:"""
<|body_0|>
def minCost2(self, n: int, cuts: List[int]) -> int:
"""思路:记忆化递归 @param n: @param cuts: @return:"""
<|body_1|>
def minCost3(self, n: int, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def minCost1(self, n: int, cuts: List[int]) -> int:
"""思路:递归 @param n: @param cuts: @return:"""
cuts = [0] + cuts + [n]
cuts.sort()
@functools.lru_cache(None)
def dp(l, r):
if l >= r - 1:
return 0
ans = math.inf
... | the_stack_v2_python_sparse | LeetCode/动态规划法(dp)/区间DP/5486. 切棍子的最小成本.py | yiming1012/MyLeetCode | train | 2 | |
a7b6afcc8d7fbbc80b68188bd5ac15fbcbd9dfa3 | [
"X = atleast_1d(X)\nY = atleast_1d(Y)\nZ = atleast_1d(Z)\nox = X[0]\noy = Y[0]\noz = Z[0]\nrx = ox % self.dx / self.dx\nry = oy % self.dy / self.dy\nrz = oz % self.dz / self.dz\nfx = floor(len(self.IntXVals) / 2) + floor(ox / self.dx)\nfy = floor(len(self.IntYVals) / 2) + floor(oy / self.dy)\nfz = floor(len(self.In... | <|body_start_0|>
X = atleast_1d(X)
Y = atleast_1d(Y)
Z = atleast_1d(Z)
ox = X[0]
oy = Y[0]
oz = Z[0]
rx = ox % self.dx / self.dx
ry = oy % self.dy / self.dy
rz = oz % self.dz / self.dz
fx = floor(len(self.IntXVals) / 2) + floor(ox / self.dx... | LinearInterpolator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinearInterpolator:
def interp(self, X, Y, Z):
"""do actual interpolation at values given"""
<|body_0|>
def getCoords(self, metadata, xslice, yslice, zslice):
"""placeholder to be overrriden to return coordinates needed for interpolation"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_36k_train_025287 | 3,476 | no_license | [
{
"docstring": "do actual interpolation at values given",
"name": "interp",
"signature": "def interp(self, X, Y, Z)"
},
{
"docstring": "placeholder to be overrriden to return coordinates needed for interpolation",
"name": "getCoords",
"signature": "def getCoords(self, metadata, xslice, y... | 2 | null | Implement the Python class `LinearInterpolator` described below.
Class description:
Implement the LinearInterpolator class.
Method signatures and docstrings:
- def interp(self, X, Y, Z): do actual interpolation at values given
- def getCoords(self, metadata, xslice, yslice, zslice): placeholder to be overrriden to re... | Implement the Python class `LinearInterpolator` described below.
Class description:
Implement the LinearInterpolator class.
Method signatures and docstrings:
- def interp(self, X, Y, Z): do actual interpolation at values given
- def getCoords(self, metadata, xslice, yslice, zslice): placeholder to be overrriden to re... | 6596167034c727ad7dad0a741dd59e0e48f6852a | <|skeleton|>
class LinearInterpolator:
def interp(self, X, Y, Z):
"""do actual interpolation at values given"""
<|body_0|>
def getCoords(self, metadata, xslice, yslice, zslice):
"""placeholder to be overrriden to return coordinates needed for interpolation"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LinearInterpolator:
def interp(self, X, Y, Z):
"""do actual interpolation at values given"""
X = atleast_1d(X)
Y = atleast_1d(Y)
Z = atleast_1d(Z)
ox = X[0]
oy = Y[0]
oz = Z[0]
rx = ox % self.dx / self.dx
ry = oy % self.dy / self.dy
... | the_stack_v2_python_sparse | PYME/Analysis/FitFactories/Interpolators/LinearPInterpolatorP.py | WilliamRo/CLipPYME | train | 3 | |
47a2534059de1c77819c1d744896274f16c4c203 | [
"if self.type == RAR_BLOCK_FILE:\n return self.flags & RAR_FILE_DIRECTORY == RAR_FILE_DIRECTORY\nreturn False",
"if self.type == RAR_BLOCK_FILE:\n return self.flags & RAR_FILE_PASSWORD > 0\nreturn False"
] | <|body_start_0|>
if self.type == RAR_BLOCK_FILE:
return self.flags & RAR_FILE_DIRECTORY == RAR_FILE_DIRECTORY
return False
<|end_body_0|>
<|body_start_1|>
if self.type == RAR_BLOCK_FILE:
return self.flags & RAR_FILE_PASSWORD > 0
return False
<|end_body_1|>
| RarInfo | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RarInfo:
def isdir(self):
"""Returns True if entry is a directory."""
<|body_0|>
def needs_password(self):
"""Returns True if data is stored password-protected."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if self.type == RAR_BLOCK_FILE:
... | stack_v2_sparse_classes_36k_train_025288 | 48,927 | permissive | [
{
"docstring": "Returns True if entry is a directory.",
"name": "isdir",
"signature": "def isdir(self)"
},
{
"docstring": "Returns True if data is stored password-protected.",
"name": "needs_password",
"signature": "def needs_password(self)"
}
] | 2 | null | Implement the Python class `RarInfo` described below.
Class description:
Implement the RarInfo class.
Method signatures and docstrings:
- def isdir(self): Returns True if entry is a directory.
- def needs_password(self): Returns True if data is stored password-protected. | Implement the Python class `RarInfo` described below.
Class description:
Implement the RarInfo class.
Method signatures and docstrings:
- def isdir(self): Returns True if entry is a directory.
- def needs_password(self): Returns True if data is stored password-protected.
<|skeleton|>
class RarInfo:
def isdir(se... | f9299b8ad0cb2a6bbbd5e65f01d2ba06406c70ac | <|skeleton|>
class RarInfo:
def isdir(self):
"""Returns True if entry is a directory."""
<|body_0|>
def needs_password(self):
"""Returns True if data is stored password-protected."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RarInfo:
def isdir(self):
"""Returns True if entry is a directory."""
if self.type == RAR_BLOCK_FILE:
return self.flags & RAR_FILE_DIRECTORY == RAR_FILE_DIRECTORY
return False
def needs_password(self):
"""Returns True if data is stored password-protected."""
... | the_stack_v2_python_sparse | modules/FICA/FiCALight/Code/rar_define.py | dfrc-korea/carpe | train | 75 | |
827127fc8772d978fea86256eb996dd12fb091bf | [
"cache_key = (model_year, market_class_id, age)\nif cache_key not in Reregistration._data:\n start_years = Reregistration._data['start_model_year'][market_class_id].values\n max_age = int(max(Reregistration._data['age'][market_class_id].values))\n if age > max_age:\n Reregistration._data[cache_key] ... | <|body_start_0|>
cache_key = (model_year, market_class_id, age)
if cache_key not in Reregistration._data:
start_years = Reregistration._data['start_model_year'][market_class_id].values
max_age = int(max(Reregistration._data['age'][market_class_id].values))
if age > ma... | **Load and provide access to vehicle re-registration data by model year, market class ID and age.** | Reregistration | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Reregistration:
"""**Load and provide access to vehicle re-registration data by model year, market class ID and age.**"""
def get_reregistered_proportion(model_year, market_class_id, age):
"""Get vehicle re-registered proportion [0..1] by market class and age. Args: model_year (int):... | stack_v2_sparse_classes_36k_train_025289 | 6,699 | no_license | [
{
"docstring": "Get vehicle re-registered proportion [0..1] by market class and age. Args: model_year (int): the model year of the re-registration data market_class_id (str): market class id, e.g. 'hauling.ICE' age (int): vehicle age in years Returns: Re-registered proportion [0..1]",
"name": "get_reregiste... | 2 | null | Implement the Python class `Reregistration` described below.
Class description:
**Load and provide access to vehicle re-registration data by model year, market class ID and age.**
Method signatures and docstrings:
- def get_reregistered_proportion(model_year, market_class_id, age): Get vehicle re-registered proportio... | Implement the Python class `Reregistration` described below.
Class description:
**Load and provide access to vehicle re-registration data by model year, market class ID and age.**
Method signatures and docstrings:
- def get_reregistered_proportion(model_year, market_class_id, age): Get vehicle re-registered proportio... | afe912c57383b9de90ef30820f7977c3367a30c4 | <|skeleton|>
class Reregistration:
"""**Load and provide access to vehicle re-registration data by model year, market class ID and age.**"""
def get_reregistered_proportion(model_year, market_class_id, age):
"""Get vehicle re-registered proportion [0..1] by market class and age. Args: model_year (int):... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Reregistration:
"""**Load and provide access to vehicle re-registration data by model year, market class ID and age.**"""
def get_reregistered_proportion(model_year, market_class_id, age):
"""Get vehicle re-registered proportion [0..1] by market class and age. Args: model_year (int): the model ye... | the_stack_v2_python_sparse | omega_model/consumer/reregistration_fixed_by_age.py | USEPA/EPA_OMEGA_Model | train | 17 |
5ca99a8b67a790edca346773a1e378784166f571 | [
"ObjectManager.__init__(self)\nself.setters.update({'name': 'set_general', 'resource_types': 'set_many', 'session_resource_type_requirements': 'set_many'})\nself.getters.update({'name': 'get_general', 'resource_types': 'get_many_to_many', 'session_resource_type_requirements': 'get_many_to_one'})\nself.my_django_mod... | <|body_start_0|>
ObjectManager.__init__(self)
self.setters.update({'name': 'set_general', 'resource_types': 'set_many', 'session_resource_type_requirements': 'set_many'})
self.getters.update({'name': 'get_general', 'resource_types': 'get_many_to_many', 'session_resource_type_requirements': 'get_... | Manage Resources in the Power Reg system | ResourceManager | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResourceManager:
"""Manage Resources in the Power Reg system"""
def __init__(self):
"""constructor"""
<|body_0|>
def create(self, auth_token, name):
"""Create a new Resource @param name name of the Resource @return instance of Resource"""
<|body_1|>
<|en... | stack_v2_sparse_classes_36k_train_025290 | 1,339 | permissive | [
{
"docstring": "constructor",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Create a new Resource @param name name of the Resource @return instance of Resource",
"name": "create",
"signature": "def create(self, auth_token, name)"
}
] | 2 | null | Implement the Python class `ResourceManager` described below.
Class description:
Manage Resources in the Power Reg system
Method signatures and docstrings:
- def __init__(self): constructor
- def create(self, auth_token, name): Create a new Resource @param name name of the Resource @return instance of Resource | Implement the Python class `ResourceManager` described below.
Class description:
Manage Resources in the Power Reg system
Method signatures and docstrings:
- def __init__(self): constructor
- def create(self, auth_token, name): Create a new Resource @param name name of the Resource @return instance of Resource
<|ske... | a59457bc37f0501aea1f54d006a6de94ff80511c | <|skeleton|>
class ResourceManager:
"""Manage Resources in the Power Reg system"""
def __init__(self):
"""constructor"""
<|body_0|>
def create(self, auth_token, name):
"""Create a new Resource @param name name of the Resource @return instance of Resource"""
<|body_1|>
<|en... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResourceManager:
"""Manage Resources in the Power Reg system"""
def __init__(self):
"""constructor"""
ObjectManager.__init__(self)
self.setters.update({'name': 'set_general', 'resource_types': 'set_many', 'session_resource_type_requirements': 'set_many'})
self.getters.upda... | the_stack_v2_python_sparse | pr_services/resource_system/resource_manager.py | ninemoreminutes/openassign-server | train | 0 |
d5b807a3a7122fb54658b4a180be703ef8b52f96 | [
"self._feature_columns = feature_columns\nself._optimizer_fn = optimizer_fn\nself._checkpoint_dir = checkpoint_dir\nself._hparams = hparams\nself._aux_head_weight = hparams.aux_head_weight\nself._learn_mixture_weights = hparams.learn_mixture_weights\nself._initial_learning_rate = hparams.initial_learning_rate\nself... | <|body_start_0|>
self._feature_columns = feature_columns
self._optimizer_fn = optimizer_fn
self._checkpoint_dir = checkpoint_dir
self._hparams = hparams
self._aux_head_weight = hparams.aux_head_weight
self._learn_mixture_weights = hparams.learn_mixture_weights
sel... | Builds a NASNet subnetwork for AdaNet. | Builder | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Builder:
"""Builds a NASNet subnetwork for AdaNet."""
def __init__(self, feature_columns, optimizer_fn, checkpoint_dir, hparams, seed):
"""Initializes a `Builder`. Args: feature_columns: The input feature columns of the problem. optimizer_fn: Function that accepts a float 'learning_r... | stack_v2_sparse_classes_36k_train_025291 | 11,982 | permissive | [
{
"docstring": "Initializes a `Builder`. Args: feature_columns: The input feature columns of the problem. optimizer_fn: Function that accepts a float 'learning_rate' argument and returns an `Optimizer` instance and learning rate `Tensor` which may have a custom learning rate schedule applied. checkpoint_dir: Ch... | 5 | stack_v2_sparse_classes_30k_train_015734 | Implement the Python class `Builder` described below.
Class description:
Builds a NASNet subnetwork for AdaNet.
Method signatures and docstrings:
- def __init__(self, feature_columns, optimizer_fn, checkpoint_dir, hparams, seed): Initializes a `Builder`. Args: feature_columns: The input feature columns of the problem... | Implement the Python class `Builder` described below.
Class description:
Builds a NASNet subnetwork for AdaNet.
Method signatures and docstrings:
- def __init__(self, feature_columns, optimizer_fn, checkpoint_dir, hparams, seed): Initializes a `Builder`. Args: feature_columns: The input feature columns of the problem... | 74106c51e0602bdd62b643f4d6c42a00142947bc | <|skeleton|>
class Builder:
"""Builds a NASNet subnetwork for AdaNet."""
def __init__(self, feature_columns, optimizer_fn, checkpoint_dir, hparams, seed):
"""Initializes a `Builder`. Args: feature_columns: The input feature columns of the problem. optimizer_fn: Function that accepts a float 'learning_r... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Builder:
"""Builds a NASNet subnetwork for AdaNet."""
def __init__(self, feature_columns, optimizer_fn, checkpoint_dir, hparams, seed):
"""Initializes a `Builder`. Args: feature_columns: The input feature columns of the problem. optimizer_fn: Function that accepts a float 'learning_rate' argument... | the_stack_v2_python_sparse | research/improve_nas/trainer/improve_nas.py | todun/adanet | train | 1 |
2a10f57ed56afdc6547a2676766c68e3f2b2e074 | [
"query = query.strip().lower().replace(' ', '+')\nsoup = self.get_soup(search_url % query)\nresults = []\nfor div in soup.select('#list-page .archive .list-truyen > .row'):\n a = div.select_one('.truyen-title a')\n info = div.select_one('.text-info a .chapter-text')\n results.append({'title': a.text.strip(... | <|body_start_0|>
query = query.strip().lower().replace(' ', '+')
soup = self.get_soup(search_url % query)
results = []
for div in soup.select('#list-page .archive .list-truyen > .row'):
a = div.select_one('.truyen-title a')
info = div.select_one('.text-info a .cha... | NovelFullCrawler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NovelFullCrawler:
def search_novel(self, query):
"""Gets a list of (title, url) matching the given query"""
<|body_0|>
def read_novel_info(self):
"""Get novel title, autor, cover etc"""
<|body_1|>
def download_chapter_list(self, page):
"""Downloa... | stack_v2_sparse_classes_36k_train_025292 | 4,420 | permissive | [
{
"docstring": "Gets a list of (title, url) matching the given query",
"name": "search_novel",
"signature": "def search_novel(self, query)"
},
{
"docstring": "Get novel title, autor, cover etc",
"name": "read_novel_info",
"signature": "def read_novel_info(self)"
},
{
"docstring":... | 4 | stack_v2_sparse_classes_30k_train_014232 | Implement the Python class `NovelFullCrawler` described below.
Class description:
Implement the NovelFullCrawler class.
Method signatures and docstrings:
- def search_novel(self, query): Gets a list of (title, url) matching the given query
- def read_novel_info(self): Get novel title, autor, cover etc
- def download_... | Implement the Python class `NovelFullCrawler` described below.
Class description:
Implement the NovelFullCrawler class.
Method signatures and docstrings:
- def search_novel(self, query): Gets a list of (title, url) matching the given query
- def read_novel_info(self): Get novel title, autor, cover etc
- def download_... | 451e816ab03c8466be90f6f0b3eaa52d799140ce | <|skeleton|>
class NovelFullCrawler:
def search_novel(self, query):
"""Gets a list of (title, url) matching the given query"""
<|body_0|>
def read_novel_info(self):
"""Get novel title, autor, cover etc"""
<|body_1|>
def download_chapter_list(self, page):
"""Downloa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NovelFullCrawler:
def search_novel(self, query):
"""Gets a list of (title, url) matching the given query"""
query = query.strip().lower().replace(' ', '+')
soup = self.get_soup(search_url % query)
results = []
for div in soup.select('#list-page .archive .list-truyen > .... | the_stack_v2_python_sparse | lncrawl/sources/novelfull.py | NNTin/lightnovel-crawler | train | 2 | |
4b9c29adb6938c8716f728b8c4242a1d471a0e4b | [
"if head is None:\n return None\nprev, curr = (None, head)\nwhile curr:\n next_node = curr.next\n curr.next = prev\n prev = curr\n curr = next_node\nreturn prev",
"if head is None:\n return None\nif head.next is None:\n return head\nrest = self.reverseList(head.next)\nhead.next.next = head\nh... | <|body_start_0|>
if head is None:
return None
prev, curr = (None, head)
while curr:
next_node = curr.next
curr.next = prev
prev = curr
curr = next_node
return prev
<|end_body_0|>
<|body_start_1|>
if head is None:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reverseList(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def reverse_list_recursive(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if head is None:
... | stack_v2_sparse_classes_36k_train_025293 | 1,137 | no_license | [
{
"docstring": ":type head: ListNode :rtype: ListNode",
"name": "reverseList",
"signature": "def reverseList(self, head)"
},
{
"docstring": ":type head: ListNode :rtype: ListNode",
"name": "reverse_list_recursive",
"signature": "def reverse_list_recursive(self, head)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000263 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseList(self, head): :type head: ListNode :rtype: ListNode
- def reverse_list_recursive(self, head): :type head: ListNode :rtype: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseList(self, head): :type head: ListNode :rtype: ListNode
- def reverse_list_recursive(self, head): :type head: ListNode :rtype: ListNode
<|skeleton|>
class Solution:
... | 9d0ff0f8705451947a6605ab5ef92bb3e27a7147 | <|skeleton|>
class Solution:
def reverseList(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def reverse_list_recursive(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def reverseList(self, head):
""":type head: ListNode :rtype: ListNode"""
if head is None:
return None
prev, curr = (None, head)
while curr:
next_node = curr.next
curr.next = prev
prev = curr
curr = next_node
... | the_stack_v2_python_sparse | linkedlist/reverse_linkedlist.py | rayt579/leetcode | train | 0 | |
7b490fe333441faa9d2b213600f9cdc7fd474540 | [
"self.height_lo = config.height_lo\nself.height_hi = config.height_hi\nself.num_slices = config.num_slices\nself.kitti_utils = kitti_utils\nself.height_per_division = (self.height_hi - self.height_lo) / self.num_slices",
"all_points = np.transpose(point_cloud)\nheight_maps = []\nfor slice_idx in range(self.num_sl... | <|body_start_0|>
self.height_lo = config.height_lo
self.height_hi = config.height_hi
self.num_slices = config.num_slices
self.kitti_utils = kitti_utils
self.height_per_division = (self.height_hi - self.height_lo) / self.num_slices
<|end_body_0|>
<|body_start_1|>
all_poin... | BevSlices | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BevSlices:
def __init__(self, config, kitti_utils):
"""BEV maps created using slices of the point cloud. Args: config: bev_generator protobuf config kitti_utils: KittiUtils object"""
<|body_0|>
def generate_bev(self, source, point_cloud, ground_plane, area_extents, voxel_siz... | stack_v2_sparse_classes_36k_train_025294 | 4,530 | permissive | [
{
"docstring": "BEV maps created using slices of the point cloud. Args: config: bev_generator protobuf config kitti_utils: KittiUtils object",
"name": "__init__",
"signature": "def __init__(self, config, kitti_utils)"
},
{
"docstring": "Generates the BEV maps dictionary. One height map is create... | 2 | null | Implement the Python class `BevSlices` described below.
Class description:
Implement the BevSlices class.
Method signatures and docstrings:
- def __init__(self, config, kitti_utils): BEV maps created using slices of the point cloud. Args: config: bev_generator protobuf config kitti_utils: KittiUtils object
- def gene... | Implement the Python class `BevSlices` described below.
Class description:
Implement the BevSlices class.
Method signatures and docstrings:
- def __init__(self, config, kitti_utils): BEV maps created using slices of the point cloud. Args: config: bev_generator protobuf config kitti_utils: KittiUtils object
- def gene... | 69804f1f7c2edf505f27e46d477e0936a9591b0d | <|skeleton|>
class BevSlices:
def __init__(self, config, kitti_utils):
"""BEV maps created using slices of the point cloud. Args: config: bev_generator protobuf config kitti_utils: KittiUtils object"""
<|body_0|>
def generate_bev(self, source, point_cloud, ground_plane, area_extents, voxel_siz... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BevSlices:
def __init__(self, config, kitti_utils):
"""BEV maps created using slices of the point cloud. Args: config: bev_generator protobuf config kitti_utils: KittiUtils object"""
self.height_lo = config.height_lo
self.height_hi = config.height_hi
self.num_slices = config.nu... | the_stack_v2_python_sparse | avod/core/bev_generators/bev_slices.py | melfm/avod-ssd | train | 104 | |
3dcef12e7ff7ad572a62204681954e14957390f0 | [
"username = request.user.username\ntry:\n owner = Wiki.objects.get(slug=slug).username\nexcept Wiki.DoesNotExist:\n error_msg = 'Wiki not found.'\n return api_error(status.HTTP_404_NOT_FOUND, error_msg)\nif owner != username:\n error_msg = 'Permission denied.'\n return api_error(status.HTTP_403_FORBI... | <|body_start_0|>
username = request.user.username
try:
owner = Wiki.objects.get(slug=slug).username
except Wiki.DoesNotExist:
error_msg = 'Wiki not found.'
return api_error(status.HTTP_404_NOT_FOUND, error_msg)
if owner != username:
error_m... | WikiView | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WikiView:
def delete(self, request, slug):
"""Delete a wiki."""
<|body_0|>
def put(self, request, slug):
"""Edit a wiki permission"""
<|body_1|>
def post(self, request, slug):
"""Rename a Wiki"""
<|body_2|>
<|end_skeleton|>
<|body_start... | stack_v2_sparse_classes_36k_train_025295 | 9,376 | permissive | [
{
"docstring": "Delete a wiki.",
"name": "delete",
"signature": "def delete(self, request, slug)"
},
{
"docstring": "Edit a wiki permission",
"name": "put",
"signature": "def put(self, request, slug)"
},
{
"docstring": "Rename a Wiki",
"name": "post",
"signature": "def po... | 3 | null | Implement the Python class `WikiView` described below.
Class description:
Implement the WikiView class.
Method signatures and docstrings:
- def delete(self, request, slug): Delete a wiki.
- def put(self, request, slug): Edit a wiki permission
- def post(self, request, slug): Rename a Wiki | Implement the Python class `WikiView` described below.
Class description:
Implement the WikiView class.
Method signatures and docstrings:
- def delete(self, request, slug): Delete a wiki.
- def put(self, request, slug): Edit a wiki permission
- def post(self, request, slug): Rename a Wiki
<|skeleton|>
class WikiView... | 13b3ed26a04248211ef91ca70dccc617be27a3c3 | <|skeleton|>
class WikiView:
def delete(self, request, slug):
"""Delete a wiki."""
<|body_0|>
def put(self, request, slug):
"""Edit a wiki permission"""
<|body_1|>
def post(self, request, slug):
"""Rename a Wiki"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WikiView:
def delete(self, request, slug):
"""Delete a wiki."""
username = request.user.username
try:
owner = Wiki.objects.get(slug=slug).username
except Wiki.DoesNotExist:
error_msg = 'Wiki not found.'
return api_error(status.HTTP_404_NOT_FO... | the_stack_v2_python_sparse | fhs/usr/share/python/syncwerk/restapi/restapi/api2/endpoints/wikis.py | syncwerk/syncwerk-server-restapi | train | 0 | |
e8a4c18dea01d6bc736d11eaab7c49bb3d381a3c | [
"l = ListNode(0)\nwhile l1:\n l.next = ListNode(0)\n if l1.value + l2.value >= 10:\n l.value = l1.value + l2.value - 10\n l.next.value = 1\n else:\n l.value = l.value + l1.value + l2.value\n print('l.value:{0}'.format(l.value))\n l1 = l1.next\n l2 = l2.next\nreturn l",
"i, s... | <|body_start_0|>
l = ListNode(0)
while l1:
l.next = ListNode(0)
if l1.value + l2.value >= 10:
l.value = l1.value + l2.value - 10
l.next.value = 1
else:
l.value = l.value + l1.value + l2.value
print('l.value:{... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def addTwoNumbers(self, l1, l2):
""":param l1: ListNode :param l2: ListNode :return: ListNode"""
<|body_0|>
def addTwoNumbers2(self, l1, l2):
""":param l1: ListNode :param l2: ListNode :return: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_36k_train_025296 | 2,007 | no_license | [
{
"docstring": ":param l1: ListNode :param l2: ListNode :return: ListNode",
"name": "addTwoNumbers",
"signature": "def addTwoNumbers(self, l1, l2)"
},
{
"docstring": ":param l1: ListNode :param l2: ListNode :return: ListNode",
"name": "addTwoNumbers2",
"signature": "def addTwoNumbers2(se... | 2 | stack_v2_sparse_classes_30k_train_014079 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def addTwoNumbers(self, l1, l2): :param l1: ListNode :param l2: ListNode :return: ListNode
- def addTwoNumbers2(self, l1, l2): :param l1: ListNode :param l2: ListNode :return: Li... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def addTwoNumbers(self, l1, l2): :param l1: ListNode :param l2: ListNode :return: ListNode
- def addTwoNumbers2(self, l1, l2): :param l1: ListNode :param l2: ListNode :return: Li... | 4f2802d4773eddd2a2e06e61c51463056886b730 | <|skeleton|>
class Solution:
def addTwoNumbers(self, l1, l2):
""":param l1: ListNode :param l2: ListNode :return: ListNode"""
<|body_0|>
def addTwoNumbers2(self, l1, l2):
""":param l1: ListNode :param l2: ListNode :return: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def addTwoNumbers(self, l1, l2):
""":param l1: ListNode :param l2: ListNode :return: ListNode"""
l = ListNode(0)
while l1:
l.next = ListNode(0)
if l1.value + l2.value >= 10:
l.value = l1.value + l2.value - 10
l.next.valu... | the_stack_v2_python_sparse | leetcode2/57_addTwoNumbers(unk).py | Yara7L/python_algorithm | train | 0 | |
7ac523f9bdaf166d52b283394f60a78bc912ef30 | [
"visited = set()\nwhile p:\n visited.add(p)\n p = p.parent\nwhile q:\n if q in visited:\n return q\n q = q.parent\nreturn None",
"n1, n2 = (p, q)\nwhile n1 != n2:\n n1 = n1.parent if n1.parent else p\n n2 = n2.parent if n2.parent else q\nreturn n1"
] | <|body_start_0|>
visited = set()
while p:
visited.add(p)
p = p.parent
while q:
if q in visited:
return q
q = q.parent
return None
<|end_body_0|>
<|body_start_1|>
n1, n2 = (p, q)
while n1 != n2:
n... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lowestCommonAncestor_1(self, p: 'Node', q: 'Node') -> 'Node':
"""방문한 노드를 기록 O(H) / O(H)"""
<|body_0|>
def lowestCommonAncestor(self, p: 'Node', q: 'Node') -> 'Node':
"""Cycle 찾듯이 반복하면, LCA에서 겹치게됨. LCA보다 위에서 겹치는 경우는 없다. O(H) / O(1)"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_025297 | 952 | no_license | [
{
"docstring": "방문한 노드를 기록 O(H) / O(H)",
"name": "lowestCommonAncestor_1",
"signature": "def lowestCommonAncestor_1(self, p: 'Node', q: 'Node') -> 'Node'"
},
{
"docstring": "Cycle 찾듯이 반복하면, LCA에서 겹치게됨. LCA보다 위에서 겹치는 경우는 없다. O(H) / O(1)",
"name": "lowestCommonAncestor",
"signature": "def ... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lowestCommonAncestor_1(self, p: 'Node', q: 'Node') -> 'Node': 방문한 노드를 기록 O(H) / O(H)
- def lowestCommonAncestor(self, p: 'Node', q: 'Node') -> 'Node': Cycle 찾듯이 반복하면, LCA에서 겹... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lowestCommonAncestor_1(self, p: 'Node', q: 'Node') -> 'Node': 방문한 노드를 기록 O(H) / O(H)
- def lowestCommonAncestor(self, p: 'Node', q: 'Node') -> 'Node': Cycle 찾듯이 반복하면, LCA에서 겹... | c26aef2a59e5cc2d9b0658b9c7386a43267ff8a1 | <|skeleton|>
class Solution:
def lowestCommonAncestor_1(self, p: 'Node', q: 'Node') -> 'Node':
"""방문한 노드를 기록 O(H) / O(H)"""
<|body_0|>
def lowestCommonAncestor(self, p: 'Node', q: 'Node') -> 'Node':
"""Cycle 찾듯이 반복하면, LCA에서 겹치게됨. LCA보다 위에서 겹치는 경우는 없다. O(H) / O(1)"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lowestCommonAncestor_1(self, p: 'Node', q: 'Node') -> 'Node':
"""방문한 노드를 기록 O(H) / O(H)"""
visited = set()
while p:
visited.add(p)
p = p.parent
while q:
if q in visited:
return q
q = q.parent
... | the_stack_v2_python_sparse | Leetcode/1650.py | hanwgyu/algorithm_problem_solving | train | 5 | |
e91046afd7362c2a75232c702cb226dbc661d236 | [
"response = self.client.get(reverse('polls:index'))\nself.assertEqual(response.status_code, 200)\nself.assertContains(response, 'No polls are available right now.')\nself.assertQuerysetEqual(response.context['latest_question_list'], [])",
"create_question(question_text='Past question?', days=-30)\nresponse = self... | <|body_start_0|>
response = self.client.get(reverse('polls:index'))
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'No polls are available right now.')
self.assertQuerysetEqual(response.context['latest_question_list'], [])
<|end_body_0|>
<|body_start_1|>
... | no questions > display error message past question > display on page future question > display error message (no questions to show) one of each > display only past question two past question > display both | QuestionIndexViewTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuestionIndexViewTest:
"""no questions > display error message past question > display on page future question > display error message (no questions to show) one of each > display only past question two past question > display both"""
def test_no_questions(self):
"""if no questions, ... | stack_v2_sparse_classes_36k_train_025298 | 5,109 | no_license | [
{
"docstring": "if no questions, display message",
"name": "test_no_questions",
"signature": "def test_no_questions(self)"
},
{
"docstring": "if past question, display on index page",
"name": "test_past_question",
"signature": "def test_past_question(self)"
},
{
"docstring": "if ... | 5 | null | Implement the Python class `QuestionIndexViewTest` described below.
Class description:
no questions > display error message past question > display on page future question > display error message (no questions to show) one of each > display only past question two past question > display both
Method signatures and doc... | Implement the Python class `QuestionIndexViewTest` described below.
Class description:
no questions > display error message past question > display on page future question > display error message (no questions to show) one of each > display only past question two past question > display both
Method signatures and doc... | 7be49bb366ec6bb8b4f97575e54e007cd4317938 | <|skeleton|>
class QuestionIndexViewTest:
"""no questions > display error message past question > display on page future question > display error message (no questions to show) one of each > display only past question two past question > display both"""
def test_no_questions(self):
"""if no questions, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QuestionIndexViewTest:
"""no questions > display error message past question > display on page future question > display error message (no questions to show) one of each > display only past question two past question > display both"""
def test_no_questions(self):
"""if no questions, display messa... | the_stack_v2_python_sparse | code/cory/Django/polls-tutorial/polls/tests.py | PdxCodeGuild/class_redmage | train | 0 |
7e685921c2e253937bc65b36df89bedde1284b08 | [
"TokenizerContainer.init()\ntokens, input_ids = cls.get_ids(f'[CLS] {HL.GetSentWithoutEdit()} [SEP]')\nsegments = cls.get_segments(tokens)\nmasks = cls.get_masks(tokens)\ninput_ids.extend(segments)\ninput_ids.extend(masks)\nreturn np.array(input_ids)",
"if len(tokens) > cls.MAX_LEN:\n raise IndexError('Token l... | <|body_start_0|>
TokenizerContainer.init()
tokens, input_ids = cls.get_ids(f'[CLS] {HL.GetSentWithoutEdit()} [SEP]')
segments = cls.get_segments(tokens)
masks = cls.get_masks(tokens)
input_ids.extend(segments)
input_ids.extend(masks)
return np.array(input_ids)
<|e... | AlbertTokenizer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlbertTokenizer:
def compute_feature(cls, HL: Headline) -> np.ndarray:
"""Computes the feature. Implemented by the concrete classes, this method is called by Headline when building feature vectors. Args: HL (Headline): A headline object, that the feature should be computed for Returns: n... | stack_v2_sparse_classes_36k_train_025299 | 2,082 | no_license | [
{
"docstring": "Computes the feature. Implemented by the concrete classes, this method is called by Headline when building feature vectors. Args: HL (Headline): A headline object, that the feature should be computed for Returns: np.ndarray: The computed feature vector",
"name": "compute_feature",
"signa... | 4 | stack_v2_sparse_classes_30k_train_001705 | Implement the Python class `AlbertTokenizer` described below.
Class description:
Implement the AlbertTokenizer class.
Method signatures and docstrings:
- def compute_feature(cls, HL: Headline) -> np.ndarray: Computes the feature. Implemented by the concrete classes, this method is called by Headline when building fea... | Implement the Python class `AlbertTokenizer` described below.
Class description:
Implement the AlbertTokenizer class.
Method signatures and docstrings:
- def compute_feature(cls, HL: Headline) -> np.ndarray: Computes the feature. Implemented by the concrete classes, this method is called by Headline when building fea... | 90ffd178a930bb80eb99e4f7f51fdd5cb2ff0710 | <|skeleton|>
class AlbertTokenizer:
def compute_feature(cls, HL: Headline) -> np.ndarray:
"""Computes the feature. Implemented by the concrete classes, this method is called by Headline when building feature vectors. Args: HL (Headline): A headline object, that the feature should be computed for Returns: n... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AlbertTokenizer:
def compute_feature(cls, HL: Headline) -> np.ndarray:
"""Computes the feature. Implemented by the concrete classes, this method is called by Headline when building feature vectors. Args: HL (Headline): A headline object, that the feature should be computed for Returns: np.ndarray: The... | the_stack_v2_python_sparse | src/lib/features/albert_token.py | bachelorbois/HumorHeadlines | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.