id int64 0 328k | repository_name stringlengths 7 58 | file_path stringlengths 9 302 | class_name stringlengths 5 256 | human_written_code stringlengths 16 2.16M | class_skeleton stringlengths 18 1.49M ⌀ | total_program_units int64 1 1.76k | total_doc_str int64 0 771 | AvgCountLine float64 0 7.89k | AvgCountLineBlank float64 0 297 | AvgCountLineCode float64 0 7.89k | AvgCountLineComment float64 0 7.89k | AvgCyclomatic float64 0 130 | CommentToCodeRatio float64 0 168 | CountClassBase float64 0 40 | CountClassCoupled float64 0 583 | CountClassCoupledModified float64 0 575 | CountClassDerived float64 0 5.35k | CountDeclInstanceMethod float64 0 529 | CountDeclInstanceVariable float64 0 296 | CountDeclMethod float64 0 599 | CountDeclMethodAll float64 0 1.12k | CountLine float64 1 40.4k | CountLineBlank float64 0 8.16k | CountLineCode float64 1 25.7k | CountLineCodeDecl float64 1 8.15k | CountLineCodeExe float64 0 24.2k | CountLineComment float64 0 16.5k | CountStmt float64 1 9.71k | CountStmtDecl float64 1 8.15k | CountStmtExe float64 0 9.69k | MaxCyclomatic float64 0 759 | MaxInheritanceTree float64 0 16 | MaxNesting float64 0 34 | SumCyclomatic float64 0 2.9k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
17,500 | huge-success/sanic | huge-success_sanic/sanic/middleware.py | sanic.middleware.Middleware | from itertools import count
from collections import deque
from collections.abc import Sequence
from typing import Deque, Union
from sanic.models.handler_types import MiddlewareType
class Middleware:
"""Middleware object that is used to encapsulate middleware functions.
This should generally not be instantiate... |
class Middleware:
'''Middleware object that is used to encapsulate middleware functions.
This should generally not be instantiated directly, but rather through
the `sanic.Sanic.middleware` decorator and its variants.
Args:
func (MiddlewareType): The middleware function to be called.
loc... | 11 | 4 | 9 | 1 | 6 | 3 | 1 | 0.55 | 0 | 6 | 1 | 0 | 5 | 4 | 7 | 7 | 90 | 17 | 47 | 27 | 27 | 26 | 22 | 14 | 14 | 2 | 0 | 0 | 8 |
17,501 | huge-success/sanic | huge-success_sanic/sanic/middleware.py | sanic.middleware.MiddlewareLocation | from enum import IntEnum, auto
class MiddlewareLocation(IntEnum):
REQUEST = auto()
RESPONSE = auto() |
class MiddlewareLocation(IntEnum):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 55 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 3 | 0 | 0 |
17,502 | huge-success/sanic | huge-success_sanic/sanic/mixins/base.py | sanic.mixins.base.BaseMixin | from typing import Optional, Protocol, Union
from sanic.base.meta import SanicMeta
class BaseMixin(metaclass=SanicMeta):
"""Base class for various mixins."""
name: str
strict_slashes: Optional[bool]
def _generate_name(self, *objects: Union[NameProtocol, DunderNameProtocol, str]) -> str:
name: ... |
class BaseMixin(metaclass=SanicMeta):
'''Base class for various mixins.'''
def _generate_name(self, *objects: Union[NameProtocol, DunderNameProtocol, str]) -> str:
pass
def generate_name(self, *objects) -> str:
pass | 3 | 1 | 12 | 2 | 10 | 0 | 4 | 0.04 | 1 | 4 | 2 | 2 | 2 | 0 | 2 | 16 | 30 | 6 | 23 | 7 | 18 | 1 | 20 | 5 | 17 | 7 | 3 | 2 | 8 |
17,503 | huge-success/sanic | huge-success_sanic/sanic/mixins/base.py | sanic.mixins.base.DunderNameProtocol | from typing import Optional, Protocol, Union
class DunderNameProtocol(Protocol):
__name__: str |
class DunderNameProtocol(Protocol):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 24 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 5 | 0 | 0 |
17,504 | huge-success/sanic | huge-success_sanic/sanic/mixins/base.py | sanic.mixins.base.NameProtocol | from typing import Optional, Protocol, Union
class NameProtocol(Protocol):
name: str |
class NameProtocol(Protocol):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 24 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 5 | 0 | 0 |
17,505 | huge-success/sanic | huge-success_sanic/sanic/mixins/commands.py | sanic.mixins.commands.CommandMixin | from sanic.models.futures import FutureCommand
from typing import Callable, Optional, Union
from sanic.base.meta import SanicMeta
from inspect import isawaitable
from functools import wraps
class CommandMixin(metaclass=SanicMeta):
def __init__(self, *args, **kwargs) -> None:
self._future_commands: set[Fut... |
class CommandMixin(metaclass=SanicMeta):
def __init__(self, *args, **kwargs) -> None:
pass
def command(self, maybe_func: Optional[Callable]=None, *, name: str='') -> Union[Callable, Callable[[Callable], Callable]]:
pass
def decorator(f):
pass
@wraps(f)
... | 6 | 0 | 9 | 1 | 8 | 0 | 2 | 0 | 1 | 3 | 1 | 2 | 2 | 1 | 2 | 16 | 21 | 3 | 18 | 10 | 10 | 0 | 13 | 7 | 8 | 2 | 3 | 1 | 6 |
17,506 | huge-success/sanic | huge-success_sanic/sanic/mixins/exceptions.py | sanic.mixins.exceptions.ExceptionMixin | from sanic.models.futures import FutureException
from typing import Any, Callable, Union
from sanic.base.meta import SanicMeta
class ExceptionMixin(metaclass=SanicMeta):
def __init__(self, *args, **kwargs) -> None:
self._future_exceptions: set[FutureException] = set()
def _apply_exception_handler(sel... |
class ExceptionMixin(metaclass=SanicMeta):
def __init__(self, *args, **kwargs) -> None:
pass
def _apply_exception_handler(self, handler: FutureException):
pass
def exception(self, *exceptions: Union[type[Exception], list[type[Exception]]], apply: bool=True) -> Callable:
'''Decora... | 6 | 2 | 22 | 5 | 7 | 11 | 1 | 2.16 | 1 | 8 | 1 | 1 | 4 | 1 | 4 | 18 | 102 | 24 | 25 | 16 | 11 | 54 | 19 | 10 | 11 | 3 | 3 | 1 | 7 |
17,507 | huge-success/sanic | huge-success_sanic/sanic/mixins/listeners.py | sanic.mixins.listeners.ListenerEvent | from enum import Enum, auto
class ListenerEvent(str, Enum):
def _generate_next_value_(name: str, *args) -> str:
return name.lower()
BEFORE_SERVER_START = 'server.init.before'
AFTER_SERVER_START = 'server.init.after'
BEFORE_SERVER_STOP = 'server.shutdown.before'
AFTER_SERVER_STOP = 'server.... |
class ListenerEvent(str, Enum):
def _generate_next_value_(name: str, *args) -> str:
pass | 2 | 0 | 2 | 0 | 2 | 1 | 1 | 0.07 | 2 | 0 | 0 | 0 | 1 | 0 | 1 | 116 | 15 | 1 | 14 | 13 | 12 | 1 | 14 | 13 | 12 | 1 | 4 | 0 | 1 |
17,508 | huge-success/sanic | huge-success_sanic/sanic/mixins/listeners.py | sanic.mixins.listeners.ListenerMixin | from sanic.exceptions import BadRequest
from functools import partial
from sanic.models.handler_types import ListenerType, Sanic
from sanic.base.meta import SanicMeta
from sanic.models.futures import FutureListener
from typing import Callable, Optional, Union, cast, overload
class ListenerMixin(metaclass=SanicMeta):
... |
class ListenerMixin(metaclass=SanicMeta):
def __init__(self, *args, **kwargs) -> None:
pass
def _apply_listener(self, listener: FutureListener):
pass
@overload
def listener(self, listener_or_event: ListenerType[Sanic], event_or_none: str, apply: bool=..., *, priority: int=0) -> Listen... | 21 | 13 | 23 | 4 | 7 | 12 | 1 | 1.81 | 1 | 8 | 2 | 1 | 17 | 1 | 17 | 31 | 404 | 79 | 116 | 80 | 40 | 210 | 48 | 22 | 28 | 3 | 3 | 2 | 22 |
17,509 | huge-success/sanic | huge-success_sanic/sanic/mixins/middleware.py | sanic.mixins.middleware.MiddlewareMixin | from collections import deque
from typing import Callable, Union, overload
from sanic.middleware import Middleware, MiddlewareLocation
from sanic.models.futures import FutureMiddleware, MiddlewareType
from functools import partial
from sanic.router import Router
from sanic.base.meta import SanicMeta
from operator impor... |
class MiddlewareMixin(metaclass=SanicMeta):
def __init__(self, *args, **kwargs) -> None:
pass
def _apply_middleware(self, middleware: FutureMiddleware):
pass
@overload
def middleware(self, middleware_or_request: MiddlewareType, attach_to: str='request', apply: bool=True, *, priority: ... | 12 | 4 | 25 | 2 | 14 | 9 | 2 | 0.73 | 1 | 10 | 3 | 1 | 8 | 3 | 8 | 22 | 219 | 28 | 115 | 42 | 83 | 84 | 41 | 17 | 30 | 3 | 3 | 1 | 15 |
17,510 | huge-success/sanic | huge-success_sanic/sanic/mixins/routes.py | sanic.mixins.routes.RouteMixin | from contextlib import suppress
from typing import Any, Callable, Optional, Union, cast
from sanic.constants import HTTP_METHODS
from sanic.mixins.base import BaseMixin
from sanic_routing.route import Route
from sanic.models.futures import FutureRoute, FutureStatic
from sanic.models.handler_types import RouteHandler
fr... |
class RouteMixin(BaseMixin, metaclass=SanicMeta):
def __init__(self, *args, **kwargs) -> None:
pass
def _apply_route(self, route: FutureRoute) -> list[Route]:
pass
def route(self, uri: str, methods: Optional[Iterable[str]]=None, host: Optional[Union[str, list[str]]]=None, strict_slashes:... | 20 | 11 | 49 | 4 | 29 | 16 | 3 | 0.67 | 2 | 21 | 4 | 1 | 16 | 2 | 16 | 32 | 788 | 78 | 428 | 186 | 261 | 286 | 121 | 53 | 87 | 15 | 4 | 4 | 45 |
17,511 | huge-success/sanic | huge-success_sanic/sanic/mixins/signals.py | sanic.mixins.signals.SignalMixin | from sanic.signals import Event, Signal
from sanic.models.futures import FutureSignal
from sanic.base.meta import SanicMeta
from sanic.models.handler_types import SignalHandler
from sanic.types import HashableDict
from typing import Any, Callable, Optional, Union
from enum import Enum
from collections.abc import Corout... |
class SignalMixin(metaclass=SanicMeta):
def __init__(self, *args, **kwargs) -> None:
pass
def _apply_signal(self, signal: FutureSignal) -> Signal:
pass
def signal(self, event: Union[str, Enum], *, apply: bool=True, condition: Optional[dict[str, Any]]=None, exclusive: bool=True, priority:... | 10 | 3 | 16 | 2 | 7 | 6 | 1 | 1.12 | 1 | 14 | 4 | 1 | 6 | 1 | 6 | 20 | 131 | 24 | 51 | 30 | 25 | 57 | 27 | 13 | 17 | 2 | 3 | 1 | 12 |
17,512 | huge-success/sanic | huge-success_sanic/sanic/mixins/startup.py | sanic.mixins.startup.StartupMixin | from sanic.server.loop import try_windows_loop
from sanic.exceptions import ServerKilled
from sanic.application.ext import setup_ext
import os
from importlib import import_module
from sanic.worker.manager import WorkerManager
from contextlib import suppress
from asyncio import AbstractEventLoop, CancelledError, Protoco... |
class StartupMixin(metaclass=SanicMeta):
def setup_loop(self) -> None:
'''Set up the event loop.
An internal method that sets up the event loop to uvloop if
possible, or a Windows selector loop if on Windows.
Returns:
None
'''
pass
@property
def ... | 38 | 16 | 54 | 6 | 35 | 14 | 6 | 0.38 | 1 | 43 | 16 | 1 | 13 | 0 | 24 | 38 | 1,343 | 165 | 870 | 232 | 721 | 331 | 439 | 106 | 414 | 25 | 3 | 5 | 148 |
17,513 | huge-success/sanic | huge-success_sanic/sanic/mixins/static.py | sanic.mixins.static.StaticHandleMixin | from sanic.request import Request
from os import PathLike, path
from sanic.response import HTTPResponse, file, file_stream, validate_file
from pathlib import Path, PurePath
from sanic.constants import DEFAULT_HTTP_CONTENT_TYPE
from sanic.log import error_logger
from mimetypes import guess_type
from sanic.base.meta impo... |
class StaticHandleMixin(metaclass=SanicMeta):
def _apply_static(self, static: FutureStatic) -> Route:
pass
def _register_static(self, static: FutureStatic):
'''
Register a static directory handler with Sanic by adding a route to the
router and registering a handler.
''... | 5 | 1 | 51 | 4 | 43 | 5 | 9 | 0.11 | 1 | 22 | 8 | 1 | 4 | 0 | 4 | 18 | 209 | 18 | 173 | 34 | 154 | 19 | 95 | 20 | 90 | 18 | 3 | 4 | 34 |
17,514 | huge-success/sanic | huge-success_sanic/sanic/mixins/static.py | sanic.mixins.static.StaticMixin | from sanic.mixins.base import BaseMixin
from typing import Optional, Union
from os import PathLike, path
from sanic.handlers.directory import DirectoryHandler
from sanic.base.meta import SanicMeta
from sanic_routing.route import Route
from sanic.models.futures import FutureStatic
from collections.abc import Sequence
fr... |
class StaticMixin(BaseMixin, metaclass=SanicMeta):
def __init__(self, *args, **kwargs) -> None:
pass
def _apply_static(self, static: FutureStatic) -> Route:
pass
def static(self, uri: str, file_or_directory: Union[PathLike, str], pattern: str='/?.+', use_modified_since: bool=True, use_co... | 4 | 1 | 46 | 5 | 22 | 20 | 3 | 0.91 | 2 | 14 | 2 | 1 | 3 | 1 | 3 | 19 | 141 | 16 | 66 | 23 | 45 | 60 | 23 | 6 | 19 | 7 | 4 | 1 | 9 |
17,515 | huge-success/sanic | huge-success_sanic/sanic/models/asgi.py | sanic.models.asgi.MockProtocol | import asyncio
class MockProtocol:
def __init__(self, transport: 'MockTransport', loop):
self.transport = transport
self._not_paused = asyncio.Event()
self._not_paused.set()
self._complete = asyncio.Event()
def pause_writing(self) -> None:
self._not_paused.clear()
... |
class MockProtocol:
def __init__(self, transport: 'MockTransport', loop):
pass
def pause_writing(self) -> None:
pass
def resume_writing(self) -> None:
pass
async def complete(self) -> None:
pass
@property
def is_complete(self) -> bool:
pass
async... | 9 | 0 | 3 | 0 | 3 | 0 | 1 | 0.04 | 0 | 2 | 0 | 0 | 7 | 3 | 7 | 7 | 31 | 6 | 25 | 12 | 16 | 1 | 20 | 11 | 12 | 2 | 0 | 1 | 8 |
17,516 | huge-success/sanic | huge-success_sanic/sanic/models/asgi.py | sanic.models.asgi.MockTransport | from typing import Any, Callable, Optional, Union
from sanic.exceptions import BadRequest
from sanic.models.protocol_types import TransportProtocol
from sanic.server.websockets.connection import WebSocketConnection
import asyncio
class MockTransport(TransportProtocol):
_protocol: Optional[MockProtocol]
def __... |
class MockTransport(TransportProtocol):
def __init__(self, scope: ASGIScope, receive: ASGIReceive, send: ASGISend) -> None:
pass
def get_protocol(self) -> MockProtocol:
pass
def get_extra_info(self, info: str, default=None) -> Optional[Union[str, bool]]:
pass
def get_websock... | 9 | 0 | 5 | 0 | 5 | 0 | 2 | 0.1 | 1 | 7 | 3 | 0 | 8 | 5 | 8 | 8 | 50 | 8 | 40 | 20 | 25 | 4 | 31 | 14 | 22 | 3 | 1 | 1 | 12 |
17,517 | huge-success/sanic | huge-success_sanic/sanic/models/futures.py | sanic.models.futures.FutureCommand | from typing import Callable, NamedTuple, Optional, Union
class FutureCommand(NamedTuple):
name: str
func: Callable |
class FutureCommand(NamedTuple):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 1 | 2 | 0 | 3 | 1 | 2 | 0 | 1 | 0 | 0 |
17,518 | huge-success/sanic | huge-success_sanic/sanic/models/futures.py | sanic.models.futures.FutureException | from typing import Callable, NamedTuple, Optional, Union
from sanic.models.handler_types import ErrorMiddlewareType, ListenerType, MiddlewareType, SignalHandler
class FutureException(NamedTuple):
handler: ErrorMiddlewareType
exceptions: list[BaseException] |
class FutureException(NamedTuple):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 1 | 2 | 0 | 3 | 1 | 2 | 0 | 1 | 0 | 0 |
17,519 | huge-success/sanic | huge-success_sanic/sanic/models/futures.py | sanic.models.futures.FutureListener | from sanic.models.handler_types import ErrorMiddlewareType, ListenerType, MiddlewareType, SignalHandler
from typing import Callable, NamedTuple, Optional, Union
class FutureListener(NamedTuple):
listener: ListenerType
event: str
priority: int |
class FutureListener(NamedTuple):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 4 | 1 | 3 | 0 | 4 | 1 | 3 | 0 | 1 | 0 | 0 |
17,520 | huge-success/sanic | huge-success_sanic/sanic/models/futures.py | sanic.models.futures.FutureMiddleware | from sanic.models.handler_types import ErrorMiddlewareType, ListenerType, MiddlewareType, SignalHandler
from typing import Callable, NamedTuple, Optional, Union
class FutureMiddleware(NamedTuple):
middleware: MiddlewareType
attach_to: str |
class FutureMiddleware(NamedTuple):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 1 | 2 | 0 | 3 | 1 | 2 | 0 | 1 | 0 | 0 |
17,521 | huge-success/sanic | huge-success_sanic/sanic/models/futures.py | sanic.models.futures.FutureRegistry | class FutureRegistry(set):
... | class FutureRegistry(set):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 43 | 1 | 0 | 1 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
17,522 | huge-success/sanic | huge-success_sanic/sanic/models/futures.py | sanic.models.futures.FutureRoute | from collections.abc import Iterable
from sanic.types import HashableDict
from typing import Callable, NamedTuple, Optional, Union
class FutureRoute(NamedTuple):
handler: str
uri: str
methods: Optional[Iterable[str]]
host: Union[str, list[str]]
strict_slashes: bool
stream: bool
version: Opt... |
class FutureRoute(NamedTuple):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 17 | 0 | 17 | 1 | 16 | 0 | 17 | 1 | 16 | 0 | 1 | 0 | 0 |
17,523 | huge-success/sanic | huge-success_sanic/sanic/models/futures.py | sanic.models.futures.FutureSignal | from typing import Callable, NamedTuple, Optional, Union
from sanic.models.handler_types import ErrorMiddlewareType, ListenerType, MiddlewareType, SignalHandler
class FutureSignal(NamedTuple):
handler: SignalHandler
event: str
condition: Optional[dict[str, str]]
exclusive: bool
priority: int |
class FutureSignal(NamedTuple):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 0 | 6 | 1 | 5 | 0 | 6 | 1 | 5 | 0 | 1 | 0 | 0 |
17,524 | huge-success/sanic | huge-success_sanic/sanic/models/futures.py | sanic.models.futures.FutureStatic | from typing import Callable, NamedTuple, Optional, Union
from sanic.handlers.directory import DirectoryHandler
from pathlib import Path
class FutureStatic(NamedTuple):
uri: str
file_or_directory: Path
pattern: str
use_modified_since: bool
use_content_range: bool
stream_large_files: Union[bool, ... |
class FutureStatic(NamedTuple):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 13 | 0 | 13 | 1 | 12 | 0 | 13 | 1 | 12 | 0 | 1 | 0 | 0 |
17,525 | huge-success/sanic | huge-success_sanic/sanic/models/http_types.py | sanic.models.http_types.Credentials | from dataclasses import dataclass, field
from typing import Optional
from base64 import b64decode
@dataclass()
class Credentials:
auth_type: Optional[str]
token: Optional[str]
_username: Optional[str] = field(default=None)
_password: Optional[str] = field(default=None)
def __post_init__(self):
... | null | 9 | 0 | 4 | 0 | 4 | 0 | 2 | 0 | 0 | 2 | 0 | 0 | 4 | 0 | 4 | 4 | 27 | 4 | 23 | 10 | 15 | 0 | 18 | 7 | 13 | 2 | 0 | 1 | 7 |
17,526 | huge-success/sanic | huge-success_sanic/sanic/models/protocol_types.py | sanic.models.protocol_types.HTMLProtocol | from typing import TYPE_CHECKING, Optional, Union
from typing import Protocol
class HTMLProtocol(Protocol):
def __html__(self) -> Union[str, bytes]:
...
def _repr_html_(self) -> Union[str, bytes]:
... |
class HTMLProtocol(Protocol):
def __html__(self) -> Union[str, bytes]:
pass
def _repr_html_(self) -> Union[str, bytes]:
pass | 3 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 0 | 2 | 26 | 4 | 1 | 3 | 3 | 2 | 0 | 5 | 3 | 2 | 1 | 5 | 0 | 2 |
17,527 | huge-success/sanic | huge-success_sanic/sanic/models/protocol_types.py | sanic.models.protocol_types.Range | from typing import Protocol
from typing import TYPE_CHECKING, Optional, Union
class Range(Protocol):
start: Optional[int]
end: Optional[int]
size: Optional[int]
total: Optional[int]
__slots__ = () |
class Range(Protocol):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 24 | 6 | 0 | 6 | 2 | 5 | 0 | 6 | 2 | 5 | 0 | 5 | 0 | 0 |
17,528 | huge-success/sanic | huge-success_sanic/sanic/models/protocol_types.py | sanic.models.protocol_types.TransportProtocol | from asyncio import BaseTransport
class TransportProtocol(BaseTransport):
scope: ASGIScope
version: HTTP
__slots__ = () |
class TransportProtocol(BaseTransport):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 6 | 4 | 0 | 4 | 2 | 3 | 0 | 4 | 2 | 3 | 0 | 1 | 0 | 0 |
17,529 | huge-success/sanic | huge-success_sanic/sanic/models/server_types.py | sanic.models.server_types.ConnInfo | from ssl import SSLContext, SSLObject
from sanic.models.protocol_types import TransportProtocol
from typing import Any, Optional
from types import SimpleNamespace
class ConnInfo:
"""
Local and remote addresses and SSL status info.
"""
__slots__ = ('client_port', 'client', 'client_ip', 'ctx', 'lost', 'p... |
class ConnInfo:
'''
Local and remote addresses and SSL status info.
'''
def __init__(self, transport: TransportProtocol, unix=None):
pass | 2 | 1 | 37 | 1 | 34 | 6 | 10 | 0.18 | 0 | 9 | 1 | 0 | 1 | 13 | 1 | 1 | 58 | 3 | 50 | 16 | 48 | 9 | 36 | 16 | 34 | 10 | 0 | 2 | 10 |
17,530 | huge-success/sanic | huge-success_sanic/sanic/models/server_types.py | sanic.models.server_types.Signal | class Signal:
stopped = False | class Signal:
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 0 | 0 | 0 |
17,531 | huge-success/sanic | huge-success_sanic/sanic/pages/base.py | sanic.pages.base.BasePage | from sanic.application.logo import SVG_LOGO_SIMPLE
from sanic import __version__ as VERSION
from abc import ABC, abstractmethod
from sanic.pages.css import CSS
from html5tagger import HTML, Builder, Document
class BasePage(ABC, metaclass=CSS):
"""Base page for Sanic pages."""
TITLE = 'Sanic'
HEADING = None... |
class BasePage(ABC, metaclass=CSS):
'''Base page for Sanic pages.'''
def __init__(self, debug: bool=True) -> None:
pass
@property
def style(self) -> str:
'''Returns the CSS for the page.
Returns:
str: The CSS for the page.
'''
pass
def render(se... | 10 | 3 | 8 | 0 | 7 | 1 | 1 | 0.19 | 2 | 3 | 0 | 2 | 7 | 1 | 7 | 28 | 72 | 10 | 53 | 14 | 44 | 10 | 36 | 12 | 28 | 4 | 4 | 5 | 10 |
17,532 | huge-success/sanic | huge-success_sanic/sanic/pages/css.py | sanic.pages.css.CSS | from abc import ABCMeta
class CSS(ABCMeta):
"""Cascade stylesheets, i.e. combine all ancestor styles"""
def __new__(cls, name, bases, attrs):
Page = super().__new__(cls, name, bases, attrs)
Page.STYLE = _extract_style(attrs.get('STYLE_FILE'), name)
Page.STYLE += attrs.get('STYLE_APPEND... |
class CSS(ABCMeta):
'''Cascade stylesheets, i.e. combine all ancestor styles'''
def __new__(cls, name, bases, attrs):
pass | 2 | 1 | 12 | 0 | 10 | 2 | 1 | 0.27 | 1 | 2 | 0 | 1 | 1 | 0 | 1 | 21 | 15 | 1 | 11 | 3 | 9 | 3 | 7 | 3 | 5 | 1 | 3 | 0 | 1 |
17,533 | huge-success/sanic | huge-success_sanic/sanic/pages/directory_page.py | sanic.pages.directory_page.DirectoryPage | from collections.abc import Iterable
from html5tagger import E
from .base import BasePage
class DirectoryPage(BasePage):
"""Page for viewing a directory."""
TITLE = 'Directory Viewer'
def __init__(self, files: Iterable[FileInfo], url: str, debug: bool) -> None:
super().__init__(debug)
self... |
class DirectoryPage(BasePage):
'''Page for viewing a directory.'''
def __init__(self, files: Iterable[FileInfo], url: str, debug: bool) -> None:
pass
def _body(self) -> None:
pass
def _headline(self):
'''Implement a heading with the current path, combined with
breadcr... | 6 | 2 | 7 | 0 | 7 | 0 | 2 | 0.11 | 1 | 7 | 1 | 0 | 5 | 2 | 5 | 33 | 46 | 7 | 36 | 23 | 22 | 4 | 27 | 15 | 21 | 2 | 5 | 3 | 8 |
17,534 | huge-success/sanic | huge-success_sanic/sanic/pages/directory_page.py | sanic.pages.directory_page.FileInfo | from typing import TypedDict
class FileInfo(TypedDict):
"""Type for file info."""
icon: str
file_name: str
file_access: str
file_size: str |
class FileInfo(TypedDict):
'''Type for file info.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | 1 | 5 | 1 | 4 | 1 | 5 | 1 | 4 | 0 | 1 | 0 | 0 |
17,535 | huge-success/sanic | huge-success_sanic/sanic/pages/error.py | sanic.pages.error.ErrorPage | from typing import Any
from sanic.request import Request
from html5tagger import E
from collections.abc import Mapping
from tracerite import html_traceback, inspector
import tracerite.html
from .base import BasePage
class ErrorPage(BasePage):
"""Page for displaying an error."""
STYLE_APPEND = tracerite.html.st... |
class ErrorPage(BasePage):
'''Page for displaying an error.'''
def __init__(self, debug: bool, title: str, text: str, request: Request, exc: Exception) -> None:
pass
def _head(self) -> None:
pass
def _body(self) -> None:
pass
def _key_value_table(self, title: str, table_... | 5 | 1 | 20 | 1 | 18 | 1 | 3 | 0.08 | 1 | 6 | 0 | 0 | 4 | 7 | 4 | 32 | 88 | 8 | 74 | 28 | 60 | 6 | 49 | 19 | 44 | 5 | 5 | 4 | 11 |
17,536 | huge-success/sanic | huge-success_sanic/sanic/request/form.py | sanic.request.form.File | from typing import NamedTuple
class File(NamedTuple):
"""Model for defining a file.
It is a `namedtuple`, therefore you can iterate over the object, or
access the parameters by name.
Args:
type (str, optional): The mimetype, defaults to "text/plain".
body (bytes): Bytes of the file.
... |
class File(NamedTuple):
'''Model for defining a file.
It is a `namedtuple`, therefore you can iterate over the object, or
access the parameters by name.
Args:
type (str, optional): The mimetype, defaults to "text/plain".
body (bytes): Bytes of the file.
name (str): The filename.... | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 15 | 3 | 4 | 1 | 3 | 8 | 4 | 1 | 3 | 0 | 1 | 0 | 0 |
17,537 | huge-success/sanic | huge-success_sanic/sanic/request/parameters.py | sanic.request.parameters.RequestParameters | from typing import Any, Optional
class RequestParameters(dict):
"""Hosts a dict with lists as values where get returns the first value of the list and getlist returns the whole shebang"""
def get(self, name: str, default: Optional[Any]=None) -> Optional[Any]:
"""Return the first value, either the defa... |
class RequestParameters(dict):
'''Hosts a dict with lists as values where get returns the first value of the list and getlist returns the whole shebang'''
def get(self, name: str, default: Optional[Any]=None) -> Optional[Any]:
'''Return the first value, either the default or actual
Args:
... | 3 | 3 | 12 | 2 | 3 | 7 | 1 | 2.14 | 1 | 4 | 0 | 1 | 2 | 0 | 2 | 29 | 28 | 6 | 7 | 5 | 2 | 15 | 5 | 3 | 2 | 1 | 2 | 0 | 2 |
17,538 | huge-success/sanic | huge-success_sanic/sanic/request/types.py | sanic.request.types.Request | from types import SimpleNamespace
from inspect import isawaitable
from sanic.headers import AcceptList, Options, parse_accept, parse_content_header, parse_credentials, parse_forwarded, parse_host, parse_xforwarded
from sanic_routing.route import Route
import uuid
from sanic.models.asgi import ASGIScope
from sanic.excep... |
class Request(Generic[sanic_type, ctx_type]):
'''State of HTTP request.
Args:
url_bytes (bytes): Raw URL bytes.
headers (Header): Request headers.
version (str): HTTP version.
method (str): HTTP method.
transport (TransportProtocol): Transport protocol.
app (Sani... | 94 | 49 | 17 | 2 | 8 | 7 | 2 | 0.79 | 1 | 26 | 12 | 4 | 49 | 33 | 52 | 54 | 1,060 | 175 | 500 | 186 | 375 | 395 | 287 | 114 | 234 | 9 | 1 | 4 | 113 |
17,539 | huge-success/sanic | huge-success_sanic/sanic/response/types.py | sanic.response.types.BaseHTTPResponse | from sanic.compat import Header
from sanic.exceptions import SanicException, ServerError
from sanic.cookies.response import Cookie, SameSite
from sanic.cookies import CookieJar
from sanic.helpers import Default, _default, has_message_body, json_dumps
from datetime import datetime
from collections.abc import Coroutine, ... |
class BaseHTTPResponse:
'''The base class for all HTTP Responses'''
def __init__(self):
pass
def __repr__(self):
pass
def _encode_body(self, data: Optional[str | bytes]):
pass
@property
def cookies(self) -> CookieJar:
'''The response cookies.
See [Cook... | 11 | 6 | 20 | 2 | 12 | 6 | 2 | 0.47 | 0 | 14 | 7 | 1 | 8 | 7 | 8 | 8 | 181 | 22 | 110 | 49 | 71 | 52 | 41 | 19 | 32 | 6 | 0 | 2 | 17 |
17,540 | huge-success/sanic | huge-success_sanic/sanic/response/types.py | sanic.response.types.HTTPResponse | from typing import TYPE_CHECKING, Any, AnyStr, Callable, Optional, TypeVar, Union
from sanic.compat import Header
class HTTPResponse(BaseHTTPResponse):
"""HTTP response to be sent back to the client.
Args:
body (Optional[Any], optional): The body content to be returned. Defaults to `None`.
sta... |
class HTTPResponse(BaseHTTPResponse):
'''HTTP response to be sent back to the client.
Args:
body (Optional[Any], optional): The body content to be returned. Defaults to `None`.
status (int, optional): HTTP response number. Defaults to `200`.
headers (Optional[Union[Header, Dict[str, str... | 5 | 2 | 5 | 0 | 5 | 0 | 1 | 0.38 | 1 | 6 | 1 | 1 | 4 | 5 | 4 | 12 | 36 | 7 | 21 | 17 | 10 | 8 | 15 | 11 | 10 | 1 | 1 | 0 | 4 |
17,541 | huge-success/sanic | huge-success_sanic/sanic/response/types.py | sanic.response.types.JSONResponse | from sanic.helpers import Default, _default, has_message_body, json_dumps
from sanic.compat import Header
from typing import TYPE_CHECKING, Any, AnyStr, Callable, Optional, TypeVar, Union
from sanic.exceptions import SanicException, ServerError
class JSONResponse(HTTPResponse):
"""Convenience class for JSON respon... |
class JSONResponse(HTTPResponse):
'''Convenience class for JSON responses
HTTP response to be sent back to the client, when the response
is of json type. Offers several utilities to manipulate common
json data types.
Args:
body (Optional[Any], optional): The body content to be returned. Def... | 16 | 8 | 17 | 4 | 8 | 6 | 2 | 0.75 | 1 | 11 | 3 | 0 | 11 | 6 | 11 | 23 | 226 | 53 | 100 | 39 | 71 | 75 | 61 | 22 | 49 | 4 | 2 | 1 | 20 |
17,542 | huge-success/sanic | huge-success_sanic/sanic/response/types.py | sanic.response.types.ResponseStream | from collections.abc import Coroutine, Iterator
from sanic.cookies import CookieJar
from sanic.compat import Header
from typing import TYPE_CHECKING, Any, AnyStr, Callable, Optional, TypeVar, Union
from sanic.exceptions import SanicException, ServerError
class ResponseStream:
"""A compat layer to bridge the gap af... |
class ResponseStream:
'''A compat layer to bridge the gap after the deprecation of StreamingHTTPResponse.
It will be removed when:
- file_stream is moved to new style streaming
- file and file_stream are combined into a single API
'''
def __init__(self, streaming_fn: Callable[[Union[BaseHTTPRe... | 13 | 1 | 5 | 0 | 5 | 0 | 1 | 0.08 | 0 | 10 | 5 | 0 | 9 | 7 | 9 | 9 | 76 | 11 | 60 | 30 | 38 | 5 | 35 | 18 | 25 | 3 | 0 | 1 | 13 |
17,543 | huge-success/sanic | huge-success_sanic/sanic/router.py | sanic.router.Router | from sanic.constants import HTTP_METHODS
from sanic_routing.exceptions import NoMethod
from sanic.errorpages import check_error_format
from sanic_routing import BaseRouter
from sanic.models.handler_types import RouteHandler
from sanic_routing.exceptions import NotFound as RoutingNotFound
from inspect import signature
f... |
class Router(BaseRouter):
'''The router implementation responsible for routing a `Request` object to the appropriate handler.'''
def _get(self, path: str, method: str, host: Optional[str]) -> tuple[Route, RouteHandler, dict[str, Any]]:
pass
@lru_cache(maxsize=ROUTER_CACHE_SIZE)
def get(self, p... | 17 | 9 | 23 | 3 | 13 | 7 | 3 | 0.5 | 1 | 15 | 2 | 0 | 10 | 0 | 10 | 10 | 249 | 44 | 139 | 57 | 100 | 70 | 79 | 28 | 68 | 10 | 1 | 3 | 32 |
17,544 | huge-success/sanic | huge-success_sanic/sanic/server/async_server.py | sanic.server.async_server.AsyncioServer | from sanic.exceptions import SanicException
import asyncio
class AsyncioServer:
"""Wraps an asyncio server with functionality that might be useful to a user who needs to manage the server lifecycle manually."""
__slots__ = ('app', 'connections', 'loop', 'serve_coro', 'server')
def __init__(self, app: Sani... |
class AsyncioServer:
'''Wraps an asyncio server with functionality that might be useful to a user who needs to manage the server lifecycle manually.'''
def __init__(self, app: Sanic, loop, serve_coro, connections):
pass
def startup(self):
'''Trigger "startup" operations on the app'''
... | 15 | 12 | 6 | 0 | 5 | 1 | 2 | 0.23 | 0 | 5 | 1 | 0 | 14 | 5 | 14 | 14 | 101 | 16 | 69 | 31 | 48 | 16 | 54 | 25 | 39 | 4 | 0 | 2 | 22 |
17,545 | huge-success/sanic | huge-success_sanic/sanic/server/protocols/base_protocol.py | sanic.server.protocols.base_protocol.SanicProtocol | from sanic.exceptions import RequestCancelled
from asyncio.transports import Transport
from time import monotonic as current_time
from sanic.log import error_logger
from sanic.models.server_types import ConnInfo, Signal
import asyncio
from typing import TYPE_CHECKING, Optional
class SanicProtocol(asyncio.Protocol):
... |
class SanicProtocol(asyncio.Protocol):
def __init__(self, *, loop, app: Sanic, signal=None, connections=None, unix=None, **kwargs):
pass
@property
def ctx(self):
pass
async def send(self, data):
'''
Generic data write implementation with backpressure control.
'... | 13 | 6 | 13 | 0 | 8 | 5 | 2 | 0.49 | 1 | 9 | 1 | 1 | 11 | 11 | 11 | 11 | 174 | 15 | 108 | 36 | 86 | 53 | 79 | 26 | 67 | 6 | 1 | 2 | 26 |
17,546 | huge-success/sanic | huge-success_sanic/sanic/server/protocols/http_protocol.py | sanic.server.protocols.http_protocol.Http3Protocol | from typing import TYPE_CHECKING, Optional
from sanic.http.constants import HTTP
from sanic.http.http3 import Http3
from sanic.log import Colors, access_logger, error_logger, logger, websockets_logger
class Http3Protocol(HttpProtocolMixin, ConnectionProtocol):
HTTP_CLASS = Http3
__version__ = HTTP.VERSION_3
... |
class Http3Protocol(HttpProtocolMixin, ConnectionProtocol):
def __init__(self, *args, app: Sanic, **kwargs) -> None:
pass
def quic_event_received(self, event: QuicEvent) -> None:
pass
@property
def connection(self) -> Optional[H3Connection]:
pass | 5 | 0 | 9 | 0 | 8 | 0 | 3 | 0.07 | 2 | 2 | 1 | 0 | 3 | 3 | 3 | 7 | 34 | 4 | 29 | 11 | 24 | 2 | 21 | 9 | 17 | 7 | 1 | 2 | 9 |
17,547 | huge-success/sanic | huge-success_sanic/sanic/server/protocols/http_protocol.py | sanic.server.protocols.http_protocol.HttpProtocol | from time import monotonic as current_time
from sanic.http.constants import HTTP
from typing import TYPE_CHECKING, Optional
from sanic.log import Colors, access_logger, error_logger, logger, websockets_logger
from sanic.models.server_types import ConnInfo
from asyncio import CancelledError
from sanic.server.protocols.b... |
class HttpProtocol(HttpProtocolMixin, SanicProtocol, metaclass=TouchUpMeta):
'''
This class provides implements the HTTP 1.1 protocol on top of our
Sanic Server transport
'''
def __init__(self, *, loop, app: Sanic, signal=None, connections=None, state=None, unix=None, **kwargs):
pass
... | 10 | 7 | 21 | 1 | 18 | 3 | 4 | 0.19 | 3 | 13 | 4 | 2 | 9 | 10 | 9 | 39 | 238 | 18 | 186 | 43 | 166 | 36 | 104 | 33 | 94 | 7 | 4 | 2 | 32 |
17,548 | huge-success/sanic | huge-success_sanic/sanic/server/protocols/http_protocol.py | sanic.server.protocols.http_protocol.HttpProtocolMixin | from time import monotonic as current_time
from typing import TYPE_CHECKING, Optional
from sanic.request import Request
from sanic.http.constants import HTTP
class HttpProtocolMixin:
__slots__ = ()
__version__: HTTP
def _setup_connection(self, *args, **kwargs):
self._http = self.HTTP_CLASS(self, *... |
class HttpProtocolMixin:
def _setup_connection(self, *args, **kwargs):
pass
def _setup_connection(self, *args, **kwargs):
pass
@property
def http(self):
pass
@property
def version(self):
pass | 7 | 0 | 6 | 0 | 6 | 0 | 2 | 0 | 0 | 1 | 0 | 2 | 4 | 11 | 4 | 4 | 32 | 4 | 28 | 19 | 21 | 0 | 26 | 17 | 21 | 2 | 0 | 1 | 6 |
17,549 | huge-success/sanic | huge-success_sanic/sanic/server/protocols/websocket_protocol.py | sanic.server.protocols.websocket_protocol.WebSocketProtocol | from websockets import http11
from websockets.datastructures import Headers as WSHeaders
from sanic.log import access_logger, websockets_logger
from typing import Optional, cast
from sanic.request import Request
from sanic.exceptions import SanicException
from ..websockets.impl import WebsocketImplProtocol
from sanic.s... |
class WebSocketProtocol(HttpProtocol):
def __init__(self, *args, websocket_timeout: float=10.0, websocket_max_size: Optional[int]=None, websocket_ping_interval: Optional[float]=20.0, websocket_ping_timeout: Optional[float]=20.0, **kwargs):
pass
def connection_lost(self, exc):
pass
def da... | 11 | 0 | 20 | 0 | 19 | 2 | 4 | 0.08 | 1 | 13 | 3 | 0 | 8 | 7 | 9 | 48 | 202 | 10 | 178 | 44 | 157 | 15 | 98 | 32 | 88 | 12 | 5 | 3 | 33 |
17,550 | huge-success/sanic | huge-success_sanic/sanic/server/websockets/connection.py | sanic.server.websockets.connection.WebSocketConnection | from sanic.exceptions import InvalidUsage
from collections.abc import Awaitable, MutableMapping
from typing import Any, Callable, Optional, Union
class WebSocketConnection:
"""
This is for ASGI Connections.
It provides an interface similar to WebsocketProtocol, but
sends/receives over an ASGI connectio... |
class WebSocketConnection:
'''
This is for ASGI Connections.
It provides an interface similar to WebsocketProtocol, but
sends/receives over an ASGI connection.
'''
def __init__(self, send: Callable[[ASGIMessage], Awaitable[None]], receive: Callable[[], Awaitable[ASGIMessage]], subprotocols: Op... | 10 | 1 | 8 | 1 | 7 | 0 | 2 | 0.13 | 0 | 7 | 0 | 0 | 7 | 3 | 7 | 7 | 73 | 14 | 52 | 23 | 37 | 7 | 38 | 16 | 30 | 5 | 0 | 3 | 15 |
17,551 | huge-success/sanic | huge-success_sanic/sanic/server/websockets/frame.py | sanic.server.websockets.frame.WebsocketFrameAssembler | from collections.abc import AsyncIterator
from sanic.exceptions import ServerError
from websockets.frames import Frame, Opcode
import codecs
import asyncio
from websockets.typing import Data
from typing import TYPE_CHECKING, Optional
class WebsocketFrameAssembler:
"""
Assemble a message from frames.
Code b... |
class WebsocketFrameAssembler:
'''
Assemble a message from frames.
Code borrowed from aaugustin/websockets project:
https://github.com/aaugustin/websockets/blob/6eb98dd8fa5b2c896b9f6be7e8d117708da82a39/src/websockets/sync/messages.py
'''
def __init__(self, protocol) -> None:
pass
... | 5 | 4 | 59 | 6 | 36 | 19 | 9 | 0.48 | 0 | 5 | 1 | 0 | 4 | 0 | 4 | 4 | 275 | 28 | 172 | 11 | 167 | 82 | 121 | 11 | 116 | 13 | 0 | 3 | 35 |
17,552 | huge-success/sanic | huge-success_sanic/sanic/server/websockets/impl.py | sanic.server.websockets.impl.WebsocketImplProtocol | from .frame import WebsocketFrameAssembler
import struct
from ...exceptions import ServerError, WebsocketClosed
from websockets.frames import Frame, Opcode
from websockets.typing import Data
import asyncio
from websockets.exceptions import ConnectionClosed, ConnectionClosedError, ConnectionClosedOK
from typing import O... |
class WebsocketImplProtocol:
def __init__(self, ws_proto, max_queue=None, ping_interval: Optional[float]=20, ping_timeout: Optional[float]=20, close_timeout: float=10, loop=None):
pass
@property
def subprotocol(self):
pass
def pause_frames(self):
pass
def resume_frames(se... | 30 | 15 | 28 | 1 | 19 | 8 | 5 | 0.41 | 0 | 21 | 4 | 0 | 28 | 0 | 28 | 28 | 835 | 56 | 552 | 73 | 510 | 228 | 418 | 59 | 389 | 16 | 0 | 4 | 146 |
17,553 | huge-success/sanic | huge-success_sanic/sanic/signals.py | sanic.signals.Event | from enum import Enum
class Event(Enum):
"""Event names for the SignalRouter"""
SERVER_EXCEPTION_REPORT = 'server.exception.report'
SERVER_INIT_AFTER = 'server.init.after'
SERVER_INIT_BEFORE = 'server.init.before'
SERVER_SHUTDOWN_AFTER = 'server.shutdown.after'
SERVER_SHUTDOWN_BEFORE = 'server.... |
class Event(Enum):
'''Event names for the SignalRouter'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.04 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 49 | 26 | 1 | 24 | 24 | 23 | 1 | 24 | 24 | 23 | 0 | 4 | 0 | 0 |
17,554 | huge-success/sanic | huge-success_sanic/sanic/signals.py | sanic.signals.Signal | from sanic_routing import BaseRouter, Route, RouteGroup
class Signal(Route):
"""A `Route` that is used to dispatch signals to handlers""" |
class Signal(Route):
'''A `Route` that is used to dispatch signals to handlers'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 |
17,555 | huge-success/sanic | huge-success_sanic/sanic/signals.py | sanic.signals.SignalGroup | from sanic_routing import BaseRouter, Route, RouteGroup
class SignalGroup(RouteGroup):
"""A `RouteGroup` that is used to dispatch signals to handlers""" |
class SignalGroup(RouteGroup):
'''A `RouteGroup` that is used to dispatch signals to handlers'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 |
17,556 | huge-success/sanic | huge-success_sanic/sanic/signals.py | sanic.signals.SignalRouter | from typing import Any, Optional, Union, cast
from enum import Enum
from sanic_routing.exceptions import NotFound
from collections import deque
import asyncio
from inspect import isawaitable
from sanic_routing.utils import path_to_parts
from sanic.models.handler_types import SignalHandler
from sanic.log import error_lo... |
class SignalRouter(BaseRouter):
'''A `BaseRouter` that is used to dispatch signals to handlers'''
def __init__(self) -> None:
pass
@staticmethod
def format_event(event: Union[str, Enum]) -> str:
'''Ensure event strings in proper format
Args:
event (str): event strin... | 13 | 5 | 25 | 3 | 19 | 4 | 4 | 0.22 | 1 | 16 | 5 | 0 | 10 | 2 | 11 | 11 | 294 | 41 | 210 | 76 | 164 | 46 | 124 | 40 | 112 | 17 | 1 | 5 | 42 |
17,557 | huge-success/sanic | huge-success_sanic/sanic/signals.py | sanic.signals.SignalWaiter | import asyncio
from typing import Any, Optional, Union, cast
from dataclasses import dataclass
@dataclass
class SignalWaiter:
"""A record representing a future waiting for a signal"""
signal: Signal
event_definition: str
trigger: str = ''
requirements: Optional[dict[str, str]] = None
exclusive:... | @dataclass
class SignalWaiter:
'''A record representing a future waiting for a signal'''
async def wait(self):
'''Block until the signal is next dispatched.
Return the context of the signal dispatch, if any.
'''
pass
def matches(self, event, condition):
pass | 4 | 2 | 9 | 1 | 7 | 2 | 1 | 0.19 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 30 | 5 | 21 | 8 | 18 | 4 | 16 | 8 | 13 | 1 | 0 | 1 | 2 |
17,558 | huge-success/sanic | huge-success_sanic/sanic/touchup/meta.py | sanic.touchup.meta.TouchUpMeta | from .service import TouchUp
from sanic.exceptions import SanicException
from sanic.base.meta import SanicMeta
class TouchUpMeta(SanicMeta):
def __new__(cls, name, bases, attrs, **kwargs):
gen_class = super().__new__(cls, name, bases, attrs, **kwargs)
methods = attrs.get('__touchup__')
att... |
class TouchUpMeta(SanicMeta):
def __new__(cls, name, bases, attrs, **kwargs):
pass | 2 | 0 | 15 | 2 | 13 | 0 | 4 | 0 | 1 | 3 | 2 | 3 | 1 | 0 | 1 | 15 | 16 | 2 | 14 | 5 | 12 | 0 | 11 | 5 | 9 | 4 | 3 | 3 | 4 |
17,559 | huge-success/sanic | huge-success_sanic/sanic/touchup/schemes/altsvc.py | sanic.touchup.schemes.altsvc.RemoveAltSvc | from sanic.http.constants import HTTP
from ast import Assign, Constant, NodeTransformer, Subscript
from typing import TYPE_CHECKING, Any
class RemoveAltSvc(NodeTransformer):
def __init__(self, app: Sanic, verbosity: int=0) -> None:
self._app = app
self._verbosity = verbosity
self._versions... |
class RemoveAltSvc(NodeTransformer):
def __init__(self, app: Sanic, verbosity: int=0) -> None:
pass
def visit_Assign(self, node: Assign) -> Any:
pass
def _should_remove(self) -> bool:
pass
@staticmethod
def _matches(node) -> bool:
pass
def value(self):
... | 7 | 0 | 6 | 0 | 6 | 0 | 2 | 0 | 1 | 4 | 1 | 0 | 4 | 3 | 5 | 9 | 35 | 4 | 31 | 14 | 24 | 0 | 24 | 13 | 18 | 3 | 3 | 2 | 9 |
17,560 | huge-success/sanic | huge-success_sanic/sanic/touchup/schemes/base.py | sanic.touchup.schemes.base.BaseScheme | from abc import ABC, abstractmethod
from typing import Any
from inspect import getsource
from textwrap import dedent
from ast import NodeTransformer, parse
class BaseScheme(ABC):
ident: str
_registry: set[type] = set()
def __init__(self, app) -> None:
self.app = app
@abstractmethod
def vi... |
class BaseScheme(ABC):
def __init__(self, app) -> None:
pass
@abstractmethod
def visitors(self) -> list[NodeTransformer]:
pass
def __init_subclass__(cls):
pass
def __call__(self):
pass
@classmethod
def build(cls, method, module_globals, app):
pass | 8 | 0 | 4 | 0 | 4 | 0 | 1 | 0.04 | 1 | 5 | 0 | 2 | 4 | 1 | 5 | 25 | 30 | 7 | 23 | 17 | 16 | 1 | 22 | 15 | 16 | 3 | 4 | 2 | 7 |
17,561 | huge-success/sanic | huge-success_sanic/sanic/touchup/schemes/ode.py | sanic.touchup.schemes.ode.OptionalDispatchEvent | from ast import Attribute, Await, Expr, NodeTransformer
from .base import BaseScheme
class OptionalDispatchEvent(BaseScheme):
ident = 'ODE'
SYNC_SIGNAL_NAMESPACES = 'http.'
def __init__(self, app) -> None:
super().__init__(app)
self._sync_events()
self._registered_events = [signal.... |
class OptionalDispatchEvent(BaseScheme):
def __init__(self, app) -> None:
pass
def visitors(self) -> list[NodeTransformer]:
pass
def _sync_events(self):
pass
@staticmethod
async def noop(**_):
pass | 6 | 0 | 9 | 1 | 8 | 1 | 3 | 0.08 | 1 | 5 | 1 | 0 | 3 | 1 | 4 | 29 | 43 | 6 | 37 | 16 | 31 | 3 | 28 | 15 | 23 | 8 | 5 | 3 | 11 |
17,562 | huge-success/sanic | huge-success_sanic/sanic/touchup/schemes/ode.py | sanic.touchup.schemes.ode.RemoveDispatch | from sanic.log import logger
from typing import Any
from ast import Attribute, Await, Expr, NodeTransformer
class RemoveDispatch(NodeTransformer):
def __init__(self, registered_events) -> None:
self._registered_events = registered_events
def visit_Expr(self, node: Expr) -> Any:
call = node.va... |
class RemoveDispatch(NodeTransformer):
def __init__(self, registered_events) -> None:
pass
def visit_Expr(self, node: Expr) -> Any:
pass
def _not_registered(self, event_name):
pass | 4 | 0 | 11 | 1 | 10 | 0 | 3 | 0 | 1 | 1 | 0 | 0 | 3 | 1 | 3 | 7 | 37 | 5 | 32 | 13 | 28 | 0 | 26 | 12 | 22 | 6 | 3 | 3 | 10 |
17,563 | huge-success/sanic | huge-success_sanic/sanic/touchup/service.py | sanic.touchup.service.TouchUp | from .schemes import BaseScheme
from inspect import getmembers, getmodule
class TouchUp:
_registry: set[tuple[type, str]] = set()
@classmethod
def run(cls, app):
for target, method_name in cls._registry:
method = getattr(target, method_name)
if app.test_mode:
... |
class TouchUp:
@classmethod
def run(cls, app):
pass
@classmethod
def register(cls, target, method_name):
pass | 5 | 0 | 10 | 2 | 8 | 0 | 3 | 0 | 0 | 2 | 1 | 0 | 0 | 0 | 2 | 2 | 25 | 5 | 20 | 12 | 15 | 0 | 17 | 10 | 14 | 4 | 0 | 3 | 5 |
17,564 | huge-success/sanic | huge-success_sanic/sanic/types/hashable_dict.py | sanic.types.hashable_dict.HashableDict | class HashableDict(dict):
def __hash__(self):
return hash(tuple(sorted(self.items()))) | class HashableDict(dict):
def __hash__(self):
pass | 2 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 28 | 3 | 0 | 3 | 2 | 1 | 0 | 3 | 2 | 1 | 1 | 2 | 0 | 1 |
17,565 | huge-success/sanic | huge-success_sanic/sanic/types/shared_ctx.py | sanic.types.shared_ctx.SharedContext | import os
from collections.abc import Iterable
from typing import Any
from sanic.log import Colors, error_logger
from types import SimpleNamespace
class SharedContext(SimpleNamespace):
SAFE = ('_lock',)
def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)
self._lock = False
... |
class SharedContext(SimpleNamespace):
def __init__(self, **kwargs: Any) -> None:
pass
def __setattr__(self, name: str, value: Any) -> None:
pass
def _check(self, name: str, value: Any) -> None:
pass
@property
def is_locked(self) -> bool:
pass
def lock(self) -... | 7 | 0 | 8 | 0 | 8 | 0 | 2 | 0.02 | 1 | 11 | 1 | 0 | 5 | 1 | 5 | 5 | 49 | 5 | 44 | 11 | 37 | 1 | 29 | 10 | 23 | 5 | 1 | 2 | 12 |
17,566 | huge-success/sanic | huge-success_sanic/sanic/views.py | sanic.views.HTTPMethodView | from sanic.models.handler_types import RouteHandler
from typing import TYPE_CHECKING, Any, Callable, Optional, Union
from collections.abc import Iterable
from sanic.request.types import Request
class HTTPMethodView:
"""Class based implementation for creating and grouping handlers
Class-based views (CBVs) are ... | null | 8 | 4 | 24 | 2 | 15 | 7 | 2 | 1.46 | 0 | 10 | 3 | 21 | 2 | 0 | 4 | 4 | 219 | 38 | 74 | 35 | 44 | 108 | 28 | 11 | 22 | 3 | 0 | 2 | 10 |
17,567 | huge-success/sanic | huge-success_sanic/sanic/worker/constants.py | sanic.worker.constants.ProcessState | from enum import IntEnum, auto
class ProcessState(IntEnum):
"""Process states."""
NONE = auto()
IDLE = auto()
RESTARTING = auto()
STARTING = auto()
STARTED = auto()
ACKED = auto()
JOINED = auto()
TERMINATED = auto()
FAILED = auto()
COMPLETED = auto() |
class ProcessState(IntEnum):
'''Process states.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.09 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 55 | 13 | 1 | 11 | 11 | 10 | 1 | 11 | 11 | 10 | 0 | 3 | 0 | 0 |
17,568 | huge-success/sanic | huge-success_sanic/sanic/worker/constants.py | sanic.worker.constants.RestartOrder | from sanic.compat import UpperStrEnum
from enum import IntEnum, auto
class RestartOrder(UpperStrEnum):
"""Available restart orders."""
SHUTDOWN_FIRST = auto()
STARTUP_FIRST = auto() |
class RestartOrder(UpperStrEnum):
'''Available restart orders.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 119 | 5 | 1 | 3 | 3 | 2 | 1 | 3 | 3 | 2 | 0 | 6 | 0 | 0 |
17,569 | huge-success/sanic | huge-success_sanic/sanic/worker/inspector.py | sanic.worker.inspector.Inspector | from datetime import datetime
from inspect import isawaitable
from os import environ
from pathlib import Path
from sanic.response import json
from multiprocessing.connection import Connection
from sanic.request import Request
from sanic.log import logger
from collections.abc import Mapping
from sanic.exceptions import ... |
class Inspector:
'''Inspector for Sanic workers.
This class is used to create an inspector for Sanic workers. It is
instantiated by the worker class and is used to create a Sanic app
that can be used to inspect and control the workers and the server.
It is not intended to be used directly by the us... | 14 | 4 | 9 | 0 | 7 | 1 | 2 | 0.31 | 0 | 13 | 4 | 1 | 11 | 9 | 12 | 12 | 140 | 21 | 91 | 46 | 66 | 28 | 71 | 35 | 57 | 4 | 0 | 2 | 24 |
17,570 | huge-success/sanic | huge-success_sanic/sanic/worker/loader.py | sanic.worker.loader.AppLoader | from inspect import isfunction
import os
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, Optional, Union, cast
import sys
from contextlib import suppress
from importlib import import_module
class AppLoader:
"""A helper to load application instances.
Generally used by the worker to lo... |
class AppLoader:
'''A helper to load application instances.
Generally used by the worker to load the application instance.
See [Dynamic Applications](/en/guide/deployment/app-loader) for information on when you may need to use this.
Args:
module_input (str): The module to load the application f... | 3 | 1 | 44 | 3 | 42 | 0 | 8 | 0.12 | 0 | 9 | 1 | 0 | 2 | 8 | 2 | 2 | 104 | 10 | 84 | 30 | 72 | 10 | 53 | 23 | 48 | 10 | 0 | 4 | 15 |
17,571 | huge-success/sanic | huge-success_sanic/sanic/worker/loader.py | sanic.worker.loader.CertLoader | from typing import TYPE_CHECKING, Any, Callable, Optional, Union, cast
from sanic.http.tls.context import process_to_context
import os
from ssl import SSLContext
from sanic.http.tls.creators import MkcertCreator, TrustmeCreator
class CertLoader:
_creators = {'mkcert': MkcertCreator, 'trustme': TrustmeCreator}
... |
class CertLoader:
def __init__(self, ssl_data: Optional[Union[SSLContext, dict[str, Union[str, os.PathLike]]]]):
pass
def load(self, app: SanicApp):
pass | 3 | 0 | 15 | 3 | 12 | 0 | 3 | 0 | 0 | 5 | 0 | 1 | 2 | 5 | 2 | 2 | 36 | 7 | 29 | 16 | 21 | 0 | 21 | 11 | 18 | 4 | 0 | 1 | 6 |
17,572 | huge-success/sanic | huge-success_sanic/sanic/worker/manager.py | sanic.worker.manager.MonitorCycle | from enum import IntEnum, auto
class MonitorCycle(IntEnum):
BREAK = auto()
CONTINUE = auto() |
class MonitorCycle(IntEnum):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 55 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 3 | 0 | 0 |
17,573 | huge-success/sanic | huge-success_sanic/sanic/worker/manager.py | sanic.worker.manager.WorkerManager | from sanic.worker.process import ProcessState, Worker, WorkerProcess
from sanic.worker.restarter import Restarter
from typing import Any, Callable, Optional
from collections.abc import Iterable
from sanic.log import error_logger, logger
from signal import SIGINT, SIGTERM, Signals
import os
from sanic.exceptions import ... |
class WorkerManager:
'''Manage all of the processes.
This class is used to manage all of the processes. It is instantiated
by Sanic when in multiprocess mode (which is OOTB default) and is used
to start, stop, and restart the worker processes.
You can access it to interact with it **ONLY** when on ... | 37 | 19 | 15 | 1 | 12 | 2 | 3 | 0.21 | 0 | 27 | 7 | 0 | 30 | 12 | 30 | 30 | 507 | 57 | 376 | 123 | 305 | 78 | 236 | 83 | 205 | 7 | 0 | 3 | 94 |
17,574 | huge-success/sanic | huge-success_sanic/sanic/worker/multiplexer.py | sanic.worker.multiplexer.WorkerMultiplexer | from sanic.log import Colors, logger
from sanic.worker.state import WorkerState
from typing import Any, Callable, Optional
from sanic.worker.process import ProcessState
from os import environ, getpid
from multiprocessing.connection import Connection
class WorkerMultiplexer:
"""Multiplexer for Sanic workers.
T... |
class WorkerMultiplexer:
'''Multiplexer for Sanic workers.
This is instantiated inside of worker porocesses only. It is used to
communicate with the monitor process.
Args:
monitor_publisher (Connection): The connection to the monitor.
worker_state (Dict[str, Any]): The state of the work... | 17 | 12 | 11 | 1 | 7 | 3 | 2 | 0.57 | 0 | 11 | 3 | 0 | 12 | 2 | 12 | 12 | 158 | 21 | 88 | 42 | 52 | 50 | 42 | 19 | 29 | 6 | 0 | 1 | 19 |
17,575 | huge-success/sanic | huge-success_sanic/sanic/worker/process.py | sanic.worker.process.Worker | from typing import Any
from multiprocessing.context import BaseContext
class Worker:
WORKER_PREFIX = 'Sanic'
def __init__(self, ident: str, name: str, serve, server_settings, context: BaseContext, worker_state: dict[str, Any], num: int=1, restartable: bool=False, tracked: bool=True, auto_start: bool=True):
... |
class Worker:
def __init__(self, ident: str, name: str, serve, server_settings, context: BaseContext, worker_state: dict[str, Any], num: int=1, restartable: bool=False, tracked: bool=True, auto_start: bool=True):
pass
def create_process(self) -> WorkerProcess:
pass
def has_alive_processe... | 4 | 0 | 15 | 0 | 14 | 2 | 1 | 0.11 | 0 | 9 | 1 | 0 | 3 | 11 | 3 | 3 | 51 | 3 | 44 | 30 | 28 | 5 | 22 | 18 | 18 | 2 | 0 | 1 | 4 |
17,576 | huge-success/sanic | huge-success_sanic/sanic/worker/process.py | sanic.worker.process.WorkerProcess | from sanic.log import Colors, logger
from threading import Thread
import os
from sanic.worker.constants import ProcessState, RestartOrder
from time import sleep
from signal import SIGINT
from inspect import signature
class WorkerProcess:
"""A worker process."""
THRESHOLD = 300
SERVER_LABEL = 'Server'
S... |
class WorkerProcess:
'''A worker process.'''
def __init__(self, factory, name, ident, target, kwargs, worker_state, restartable: bool=False):
pass
def set_state(self, state: ProcessState, force=False):
pass
def start(self):
pass
def join(self):
pass
def exit... | 18 | 1 | 12 | 0 | 12 | 0 | 2 | 0.01 | 0 | 13 | 3 | 0 | 15 | 10 | 15 | 15 | 209 | 19 | 189 | 44 | 162 | 2 | 110 | 33 | 94 | 5 | 0 | 2 | 34 |
17,577 | huge-success/sanic | huge-success_sanic/sanic/worker/reloader.py | sanic.worker.reloader.Reloader | from signal import SIGINT, SIGTERM
from sanic.worker.loader import AppLoader
from multiprocessing.connection import Connection
from time import sleep
from asyncio import new_event_loop
from signal import signal as signal_func
from sanic.server.events import trigger_events
import os
import sys
from itertools import chai... |
class Reloader:
def __init__(self, publisher: Connection, interval: float, reload_dirs: set[Path], app_loader: AppLoader):
pass
def __call__(self) -> None:
pass
def stop(self, *_):
pass
def reload(self, reloaded_files):
pass
def files(self):
pass
de... | 9 | 1 | 14 | 1 | 12 | 1 | 4 | 0.1 | 0 | 11 | 1 | 0 | 6 | 5 | 7 | 7 | 105 | 12 | 86 | 38 | 71 | 9 | 71 | 31 | 63 | 12 | 0 | 4 | 26 |
17,578 | huge-success/sanic | huge-success_sanic/sanic/worker/restarter.py | sanic.worker.restarter.Restarter | from typing import Optional
from sanic.log import error_logger
from sanic.worker.process import ProcessState, WorkerProcess
from sanic.worker.constants import RestartOrder
class Restarter:
def restart(self, transient_processes: list[WorkerProcess], durable_processes: list[WorkerProcess], process_names: Optional[l... |
class Restarter:
def restart(self, transient_processes: list[WorkerProcess], durable_processes: list[WorkerProcess], process_names: Optional[list[str]]=None, restart_order=RestartOrder.SHUTDOWN_FIRST, **kwargs) -> None:
'''Restart the worker processes.
Args:
process_names (Optional[Lis... | 5 | 1 | 20 | 1 | 17 | 2 | 3 | 0.1 | 0 | 6 | 3 | 0 | 4 | 0 | 4 | 4 | 83 | 6 | 70 | 29 | 46 | 7 | 29 | 10 | 24 | 5 | 0 | 2 | 11 |
17,579 | huge-success/sanic | huge-success_sanic/sanic/worker/state.py | sanic.worker.state.WorkerState | from collections.abc import ItemsView, Iterator, KeysView, Mapping, ValuesView
from typing import Any
from collections.abc import Mapping as MappingType
class WorkerState(Mapping):
RESTRICTED = ('health', 'pid', 'requests', 'restart_at', 'server', 'start_at', 'starts', 'state')
def __init__(self, state: dict[... |
class WorkerState(Mapping):
def __init__(self, state: dict[str, Any], current: str) -> None:
pass
def __getitem__(self, key: str) -> Any:
pass
def __setitem__(self, key: str, value: Any) -> None:
pass
def __delitem__(self, key: str) -> None:
pass
def __iter__(se... | 16 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 12 | 0 | 0 | 15 | 2 | 15 | 49 | 76 | 15 | 61 | 19 | 45 | 0 | 39 | 19 | 23 | 2 | 6 | 1 | 19 |
17,580 | huge-success/sanic | huge-success_sanic/examples/request_stream/server.py | server.SimpleView | from sanic.views import stream as stream_decorator
from sanic.response import stream, text
from sanic.views import HTTPMethodView
class SimpleView(HTTPMethodView):
@stream_decorator
async def post(self, request):
result = ''
while True:
body = await request.stream.get()
... |
class SimpleView(HTTPMethodView):
@stream_decorator
async def post(self, request):
pass | 3 | 0 | 8 | 0 | 8 | 0 | 3 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 5 | 10 | 0 | 10 | 5 | 7 | 0 | 9 | 4 | 7 | 3 | 1 | 2 | 3 |
17,581 | huge-success/sanic | huge-success_sanic/examples/simple_async_view.py | simple_async_view.SimpleAsyncView | from sanic.views import HTTPMethodView
from sanic.response import text
class SimpleAsyncView(HTTPMethodView):
async def get(self, request):
return text('I am async get method')
async def post(self, request):
return text('I am async post method')
async def put(self, request):
retu... |
class SimpleAsyncView(HTTPMethodView):
async def get(self, request):
pass
async def post(self, request):
pass
async def put(self, request):
pass | 4 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 3 | 0 | 3 | 7 | 9 | 2 | 7 | 4 | 3 | 0 | 7 | 4 | 3 | 1 | 1 | 0 | 3 |
17,582 | huge-success/sanic | huge-success_sanic/examples/simple_async_view.py | simple_async_view.SimpleView | from sanic.response import text
from sanic.views import HTTPMethodView
class SimpleView(HTTPMethodView):
def get(self, request):
return text('I am get method')
def post(self, request):
return text('I am post method')
def put(self, request):
return text('I am put method')
def... |
class SimpleView(HTTPMethodView):
def get(self, request):
pass
def post(self, request):
pass
def put(self, request):
pass
def patch(self, request):
pass
def delete(self, request):
pass | 6 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 5 | 0 | 5 | 9 | 15 | 4 | 11 | 6 | 5 | 0 | 11 | 6 | 5 | 1 | 1 | 0 | 5 |
17,583 | huge-success/sanic | huge-success_sanic/guide/webapp/display/base.py | webapp.display.base.BaseRenderer | from html5tagger import Builder, Document, E
from os import environ
class BaseRenderer:
def __init__(self, base_title: str):
self.base_title = base_title
def get_builder(self, full: bool, language: str) -> Builder:
if full:
urls = ['/assets/code.css', '/assets/style.css', '/assets... |
class BaseRenderer:
def __init__(self, base_title: str):
pass
def get_builder(self, full: bool, language: str) -> Builder:
pass
def title(self) -> str:
pass
def _head(self) -> list[Builder]:
pass | 5 | 0 | 18 | 0 | 18 | 1 | 2 | 0.05 | 0 | 3 | 0 | 2 | 4 | 1 | 4 | 4 | 76 | 3 | 73 | 10 | 68 | 4 | 20 | 10 | 15 | 2 | 0 | 1 | 6 |
17,584 | huge-success/sanic | huge-success_sanic/guide/webapp/display/code_style.py | webapp.display.code_style.SanicCodeStyle | from pygments.token import Comment, Keyword, Name, String, Token
from pygments.style import Style
class SanicCodeStyle(Style):
styles = {Token: '#777', Comment: 'italic #a2a2a2', Keyword: '#ff0d68', Name: '#333', Name.Class: 'bold #37ae6f', Name.Function: '#0092FF', String: 'bg:#eee #833FE3'} |
class SanicCodeStyle(Style):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0.7 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 19 | 10 | 0 | 10 | 2 | 9 | 7 | 2 | 2 | 1 | 0 | 4 | 0 | 0 |
17,585 | huge-success/sanic | huge-success_sanic/guide/webapp/display/layouts/base.py | webapp.display.layouts.base.BaseLayout | from sanic import Request
from collections.abc import Generator
from html5tagger import Builder
from contextlib import contextmanager
class BaseLayout:
def __init__(self, builder: Builder):
self.builder = builder
@contextmanager
def __call__(self, request: Request, full: bool=True) -> Generator[B... |
class BaseLayout:
def __init__(self, builder: Builder):
pass
@contextmanager
def __call__(self, request: Request, full: bool=True) -> Generator[BaseLayout, None, None]:
pass
@contextmanager
def layout(self, request: Request, full: bool=True) -> Generator[None, None, None]:
... | 6 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 0 | 2 | 0 | 2 | 3 | 1 | 3 | 3 | 16 | 2 | 14 | 11 | 4 | 0 | 8 | 5 | 4 | 1 | 0 | 1 | 3 |
17,586 | huge-success/sanic | huge-success_sanic/guide/webapp/display/layouts/home.py | webapp.display.layouts.home.HomeLayout | from collections.abc import Generator
from html5tagger import Builder, E
from contextlib import contextmanager
from webapp.display.layouts.elements.footer import do_footer
from sanic import Request
from .base import BaseLayout
class HomeLayout(BaseLayout):
@contextmanager
def layout(self, request: Request, fu... |
class HomeLayout(BaseLayout):
@contextmanager
def layout(self, request: Request, full: bool=True) -> Generator[None, None, None]:
pass
def _hero(self, language: str) -> None:
pass
def _do_buttons(self, language: str) -> Builder:
pass
def _sponsors(self) -> None:
... | 7 | 0 | 11 | 0 | 11 | 0 | 1 | 0 | 1 | 3 | 0 | 0 | 5 | 1 | 5 | 8 | 62 | 4 | 58 | 11 | 49 | 0 | 22 | 7 | 16 | 1 | 1 | 1 | 5 |
17,587 | huge-success/sanic | huge-success_sanic/guide/webapp/display/layouts/main.py | webapp.display.layouts.main.MainLayout | from .base import BaseLayout
from collections.abc import Generator
from sanic import Request
from webapp.display.layouts.elements.navbar import do_navbar
from webapp.display.layouts.elements.footer import do_footer
from contextlib import contextmanager
from webapp.display.layouts.elements.sidebar import do_sidebar
cla... |
class MainLayout(BaseLayout):
@contextmanager
def layout(self, request: Request, full: bool=True) -> Generator[None, None, None]:
pass
@contextmanager
def _content_wrapper(self, request: Request) -> Generator[None, None, None]:
pass
def _navbar(self, request: Request) -> None:
... | 8 | 0 | 7 | 0 | 7 | 0 | 2 | 0 | 1 | 2 | 0 | 0 | 5 | 0 | 5 | 8 | 44 | 4 | 40 | 14 | 28 | 0 | 29 | 8 | 23 | 3 | 1 | 5 | 8 |
17,588 | huge-success/sanic | huge-success_sanic/guide/webapp/display/layouts/models.py | webapp.display.layouts.models.GeneralConfig | from msgspec import Struct, field
class GeneralConfig(Struct, kw_only=False):
current_version: str |
class GeneralConfig(Struct, kw_only=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
17,589 | huge-success/sanic | huge-success_sanic/guide/webapp/display/layouts/models.py | webapp.display.layouts.models.MenuItem | from msgspec import Struct, field
class MenuItem(Struct, kw_only=False, omit_defaults=True):
label: str
path: str | None = None
href: str | None = None
items: list[MenuItem] = field(default_factory=list) |
class MenuItem(Struct, kw_only=False, omit_defaults=True):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | 5 | 4 | 4 | 0 | 5 | 4 | 4 | 0 | 1 | 0 | 0 |
17,590 | huge-success/sanic | huge-success_sanic/guide/webapp/display/markdown.py | webapp.display.markdown.DocsRenderer | from html5tagger import HTML, Builder, E
from mistune import HTMLRenderer, create_markdown, escape
from .code_style import SanicCodeStyle
from pygments import highlight
from mistune.util import safe_entity
from .text import slugify
from pygments.formatters import html
from pygments.lexers import get_lexer_by_name
clas... |
class DocsRenderer(HTMLRenderer):
def block_code(self, code: str, info: str | None=None):
pass
def heading(self, text: str, level: int, **attrs) -> str:
pass
def link(self, text: str, url: str, title: str | None=None) -> str:
pass
def span(self, text, classes, **attrs) -> st... | 10 | 0 | 11 | 0 | 11 | 0 | 2 | 0.04 | 1 | 6 | 1 | 0 | 9 | 0 | 9 | 35 | 106 | 10 | 96 | 24 | 84 | 4 | 62 | 22 | 52 | 6 | 3 | 3 | 20 |
17,591 | huge-success/sanic | huge-success_sanic/guide/webapp/display/markdown.py | webapp.display.markdown.SanicTableOfContents | from .text import slugify
from mistune.directives import RSTDirective, TableOfContents
class SanicTableOfContents(TableOfContents):
def generate_heading_id(self, token, index):
return slugify(token['text']) |
class SanicTableOfContents(TableOfContents):
def generate_heading_id(self, token, index):
pass | 2 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 3 | 0 | 3 | 2 | 1 | 0 | 3 | 2 | 1 | 1 | 1 | 0 | 1 |
17,592 | huge-success/sanic | huge-success_sanic/guide/webapp/display/page/Page.py | webapp.display.page.Page.Page | from frontmatter import parse
from dataclasses import dataclass, field
from ..layouts.base import BaseLayout
from pathlib import Path
from ..markdown import render_markdown
from .docobject import organize_docobjects
@dataclass
class Page:
path: Path
content: str
meta: PageMeta = field(default_factory=PageM... | @dataclass
class Page:
def get_layout(self) -> type[BaseLayout]:
pass
@property
def relative_path(self) -> Path:
pass
@classmethod
def get_layout(self) -> type[BaseLayout]:
pass
@classmethod
def load_pages(cls, base_path: Path, page_order: list[str]) -> list[Page]:
... | 13 | 0 | 18 | 1 | 17 | 0 | 5 | 0.02 | 0 | 12 | 2 | 0 | 2 | 0 | 6 | 6 | 130 | 13 | 117 | 45 | 103 | 2 | 94 | 38 | 87 | 14 | 0 | 4 | 27 |
17,593 | huge-success/sanic | huge-success_sanic/guide/webapp/display/page/docobject.py | webapp.display.page.docobject.DocObject | import inspect
from dataclasses import dataclass, field
from docstring_parser import Docstring, DocstringParam, DocstringRaises
@dataclass
class DocObject:
name: str
module_name: str
full_name: str
signature: inspect.Signature | None
docstring: Docstring
object_type: str = ''
methods: list[... | @dataclass
class DocObject:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 9 | 0 | 9 | 4 | 8 | 0 | 9 | 4 | 8 | 0 | 0 | 0 | 0 |
17,594 | huge-success/sanic | huge-success_sanic/guide/webapp/display/page/page.py | webapp.display.page.page.Page | from dataclasses import dataclass, field
from frontmatter import parse
from ..markdown import render_markdown
from pathlib import Path
from ..layouts.base import BaseLayout
from .docobject import organize_docobjects
@dataclass
class Page:
path: Path
content: str
meta: PageMeta = field(default_factory=PageM... | @dataclass
class Page:
def get_layout(self) -> type[BaseLayout]:
pass
@property
def relative_path(self) -> Path:
pass
@classmethod
def get_layout(self) -> type[BaseLayout]:
pass
@classmethod
def load_pages(cls, base_path: Path, page_order: list[str]) -> list[Page]:
... | 13 | 0 | 18 | 1 | 17 | 0 | 5 | 0.02 | 0 | 12 | 2 | 0 | 2 | 0 | 6 | 6 | 130 | 13 | 117 | 45 | 103 | 2 | 94 | 38 | 87 | 14 | 0 | 4 | 27 |
17,595 | huge-success/sanic | huge-success_sanic/guide/webapp/display/page/page.py | webapp.display.page.page.PageMeta | from dataclasses import dataclass, field
@dataclass
class PageMeta:
language: str = _DEFAULT
title: str = ''
description: str = ''
layout: str = 'main'
features: list[dict[str, str]] = field(default_factory=list)
content_class: str = '' | @dataclass
class PageMeta:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | 0 | 7 | 7 | 6 | 0 | 7 | 7 | 6 | 0 | 0 | 0 | 0 |
17,596 | huge-success/sanic | huge-success_sanic/guide/webapp/display/page/renderer.py | webapp.display.page.renderer.PageRenderer | from .page import Page
from html5tagger import HTML, Builder
from contextlib import contextmanager
from webapp.display.base import BaseRenderer
from ..layouts.base import BaseLayout
from sanic import Request
class PageRenderer(BaseRenderer):
def render(self, request: Request, language: str, path: str) -> Builder:... |
class PageRenderer(BaseRenderer):
def render(self, request: Request, language: str, path: str) -> Builder:
pass
def title(self) -> str:
pass
def _setup_request(self, request: Request, language: str, path: str):
pass
def _body(self, request: Request, builder: Builder, languag... | 7 | 0 | 8 | 0 | 8 | 0 | 2 | 0 | 1 | 4 | 2 | 0 | 5 | 0 | 5 | 9 | 46 | 4 | 42 | 17 | 33 | 0 | 30 | 13 | 24 | 2 | 1 | 2 | 9 |
17,597 | huge-success/sanic | huge-success_sanic/guide/webapp/display/plugins/attrs.py | webapp.display.plugins.attrs.Attributes | from mistune.block_parser import BlockParser
from typing import Any
from re import Match
from html5tagger import HTML, E
from mistune.directives import DirectivePlugin
from mistune.core import BlockState
from textwrap import dedent
class Attributes(DirectivePlugin):
def __call__(self, directive, md):
dire... |
class Attributes(DirectivePlugin):
def __call__(self, directive, md):
pass
def parse(self, block: BlockParser, m: Match, state: BlockState) -> dict[str, Any]:
pass
def _render(self, _, text: str, **attrs) -> str:
pass | 4 | 0 | 9 | 1 | 8 | 0 | 2 | 0 | 1 | 4 | 0 | 0 | 3 | 0 | 3 | 3 | 29 | 4 | 25 | 10 | 19 | 0 | 18 | 8 | 14 | 2 | 1 | 1 | 5 |
17,598 | huge-success/sanic | huge-success_sanic/guide/webapp/display/plugins/columns.py | webapp.display.plugins.columns.Column | from mistune.core import BlockState
from mistune.block_parser import BlockParser
from typing import Any
from re import Match
from mistune.markdown import Markdown
from mistune.directives import DirectivePlugin, RSTDirective
from mistune import HTMLRenderer
from textwrap import dedent
class Column(DirectivePlugin):
... |
class Column(DirectivePlugin):
def parse(self, block: BlockParser, m: Match, state: BlockState) -> dict[str, Any]:
pass
def __call__(self, directive: RSTDirective, md: Markdown) -> None:
pass
def _render_column(self, renderer: HTMLRenderer, text: str, **attrs):
pass | 4 | 0 | 10 | 1 | 9 | 0 | 2 | 0.03 | 1 | 6 | 0 | 0 | 3 | 0 | 3 | 3 | 34 | 5 | 29 | 13 | 21 | 1 | 16 | 9 | 12 | 3 | 1 | 1 | 6 |
17,599 | huge-success/sanic | huge-success_sanic/guide/webapp/display/plugins/hook.py | webapp.display.plugins.hook.Hook | from mistune.core import BlockState
from mistune.markdown import Markdown
from mistune.directives import DirectivePlugin, RSTDirective
class Hook(DirectivePlugin):
def __call__(self, directive: RSTDirective, md: Markdown) -> None:
if md.renderer.NAME == 'html':
md.before_render_hooks.append(se... |
class Hook(DirectivePlugin):
def __call__(self, directive: RSTDirective, md: Markdown) -> None:
pass
def _hook(self, md: Markdown, state: BlockState) -> None:
pass | 3 | 0 | 12 | 1 | 12 | 1 | 5 | 0.04 | 1 | 2 | 0 | 0 | 2 | 0 | 2 | 2 | 26 | 2 | 24 | 9 | 19 | 1 | 16 | 7 | 13 | 7 | 1 | 4 | 9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.