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,400
huge-success/sanic
huge-success_sanic/sanic/application/state.py
sanic.application.state.ApplicationState
from typing import TYPE_CHECKING, Any, Optional, Union from ssl import SSLContext from sanic.application.constants import Mode, Server, ServerStage from pathlib import Path from socket import socket from sanic.log import VerbosityFilter, logger from dataclasses import dataclass, field import logging @dataclass class A...
@dataclass class ApplicationState: '''Application state. This class is used to store the state of the application. It is instantiated by the application and is available as `app.state`. ''' def __post_init__(self) -> None: pass def __setattr__(self, name: str, value: Any) -> None: ...
10
4
8
1
5
2
2
0.36
0
9
3
0
6
0
6
6
86
14
53
29
44
19
46
27
39
4
0
1
13
17,401
huge-success/sanic
huge-success_sanic/sanic/asgi.py
sanic.asgi.ASGIApp
from sanic.exceptions import BadRequest, ServerError from sanic.server.websockets.connection import WebSocketConnection from sanic.server import ConnInfo from sanic.http import Stage from sanic.compat import Header from sanic.response import BaseHTTPResponse from typing import TYPE_CHECKING, Optional from sanic.request...
class ASGIApp: @classmethod async def create(cls, sanic_app: Sanic, scope: ASGIScope, receive: ASGIReceive, send: ASGISend) -> ASGIApp: pass async def read(self) -> Optional[bytes]: ''' Read and stream the body in chunks from an incoming ASGI message. ''' pass async def _...
8
2
23
1
21
2
4
0.08
0
9
5
0
5
2
6
6
157
14
135
29
121
11
86
20
79
8
0
2
26
17,402
huge-success/sanic
huge-success_sanic/sanic/asgi.py
sanic.asgi.Lifespan
import warnings from sanic.log import error_logger, logger from sanic.helpers import Default from sanic.models.asgi import ASGIReceive, ASGIScope, ASGISend, MockTransport class Lifespan: def __init__(self, sanic_app, scope: ASGIScope, receive: ASGIReceive, send: ASGISend) -> None: self.sanic_app = sanic_a...
class Lifespan: def __init__(self, sanic_app, scope: ASGIScope, receive: ASGIReceive, send: ASGISend) -> None: pass async def startup(self) -> None: ''' Gather the listeners to fire on server start. Because we are using a third-party server and not Sanic server, we do ...
5
2
20
1
15
4
3
0.26
0
3
1
0
4
4
4
4
82
5
61
13
54
16
38
10
33
6
0
3
12
17,403
huge-success/sanic
huge-success_sanic/sanic/base/meta.py
sanic.base.meta.SanicMeta
class SanicMeta(type): @classmethod def __prepare__(metaclass, name, bases, **kwds): cls = super().__prepare__(metaclass, name, bases, **kwds) cls['__slots__'] = () return cls
class SanicMeta(type): @classmethod def __prepare__(metaclass, name, bases, **kwds): pass
3
0
4
0
4
0
1
0
1
1
0
12
0
0
1
14
6
0
6
4
3
0
5
3
3
1
2
0
1
17,404
huge-success/sanic
huge-success_sanic/sanic/base/root.py
sanic.base.root.BaseSanic
from sanic.exceptions import SanicException from typing import Any, Optional from sanic.mixins.commands import CommandMixin from sanic.mixins.signals import SignalMixin from sanic.mixins.middleware import MiddlewareMixin from sanic.mixins.routes import RouteMixin from sanic.mixins.listeners import ListenerMixin from sa...
class BaseSanic(RouteMixin, StaticMixin, MiddlewareMixin, ListenerMixin, ExceptionMixin, SignalMixin, CommandMixin, metaclass=SanicMeta): def __init__(self, name: Optional[str]=None, *args: Any, **kwargs: Any) -> None: pass def __str__(self) -> str: pass def __repr__(self) -> str: ...
5
0
9
1
8
0
2
0.02
8
5
1
2
4
1
4
76
51
8
43
21
27
1
20
9
15
4
5
1
8
17,405
huge-success/sanic
huge-success_sanic/sanic/blueprints.py
sanic.blueprints.Blueprint
from typing import TYPE_CHECKING, Any, Callable, Optional, Union, overload from copy import deepcopy from sanic.models.handler_types import ListenerType, MiddlewareType, RouteHandler from sanic.helpers import Default, _default from sanic.models.futures import FutureRoute, FutureSignal, FutureStatic from collections imp...
null
22
11
32
3
22
6
4
0.3
1
20
6
1
10
15
14
90
535
70
358
121
303
107
192
82
176
24
6
3
65
17,406
huge-success/sanic
huge-success_sanic/sanic/blueprints.py
sanic.blueprints.BlueprintGroup
from collections.abc import Iterable, Iterator, MutableSequence, Sequence from typing import TYPE_CHECKING, Any, Callable, Optional, Union, overload from functools import partial, wraps class BlueprintGroup(bpg_base): """This class provides a mechanism to implement a Blueprint Group. The `BlueprintGroup` clas...
class BlueprintGroup(bpg_base): '''This class provides a mechanism to implement a Blueprint Group. The `BlueprintGroup` class allows grouping blueprints under a common URL prefix, version, and other shared attributes. It integrates with Sanic's Blueprint system, offering a custom iterator to treat an ...
39
18
10
2
4
5
1
1.66
1
13
1
0
24
6
24
24
373
91
106
62
60
176
76
37
49
5
1
2
35
17,407
huge-success/sanic
huge-success_sanic/sanic/cli/app.py
sanic.cli.app.SanicCLI
from sanic.log import error_logger from argparse import Namespace from functools import partial from sanic.cli.inspector_client import InspectorClient import shutil from typing import Union from sanic.app import Sanic from sanic.cli.executor import Executor, make_executor_parser from sanic.cli.base import SanicArgument...
class SanicCLI: def __init__(self) -> None: pass def attach(self): pass def run(self, parse_args=None): pass def _inspector(self): pass def _executor(self, app: Sanic, kwargs: dict): pass def _repl(self, app: Sanic): pass @app.ma...
12
0
23
2
21
1
5
0.03
0
16
8
0
9
5
9
9
259
32
221
51
209
7
139
48
128
17
0
4
51
17,408
huge-success/sanic
huge-success_sanic/sanic/cli/arguments.py
sanic.cli.arguments.ApplicationGroup
class ApplicationGroup(Group): name = 'Application' def attach(self): group = self.container.add_mutually_exclusive_group() group.add_argument('--factory', action='store_true', help='Treat app as an application factory, i.e. a () -> <Sanic app> callable') group.add_argument('-s', '--sim...
class ApplicationGroup(Group): def attach(self): pass
2
0
24
0
24
0
1
0
1
0
0
0
1
0
1
6
27
1
26
4
24
0
7
4
5
1
1
0
1
17,409
huge-success/sanic
huge-success_sanic/sanic/cli/arguments.py
sanic.cli.arguments.DevelopmentGroup
class DevelopmentGroup(Group): name = 'Development' def attach(self): self.container.add_argument('--debug', dest='debug', action='store_true', help='Run the server in debug mode') self.container.add_argument('-r', '--reload', '--auto-reload', dest='auto_reload', action='store_true', help='Watc...
class DevelopmentGroup(Group): def attach(self): pass
2
0
41
0
41
0
1
0
1
0
0
0
1
0
1
6
44
1
43
3
41
0
8
3
6
1
1
0
1
17,410
huge-success/sanic
huge-success_sanic/sanic/cli/arguments.py
sanic.cli.arguments.GeneralGroup
from sanic_routing import __version__ as __routing_version__ from sanic import __version__ class GeneralGroup(Group): name = None def attach(self): self.container.add_argument('--version', action='version', version=f'Sanic {__version__}; Routing {__routing_version__}') self.container.add_argum...
class GeneralGroup(Group): def attach(self): pass
2
0
34
2
32
0
1
0
1
0
0
0
1
0
1
6
37
3
34
3
32
0
6
3
4
1
1
0
1
17,411
huge-success/sanic
huge-success_sanic/sanic/cli/arguments.py
sanic.cli.arguments.Group
from argparse import ArgumentParser, _ArgumentGroup from typing import Optional, Union class Group: name: Optional[str] container: Union[ArgumentParser, _ArgumentGroup] _registry: list[type[Group]] = [] def __init_subclass__(cls) -> None: Group._registry.append(cls) def __init__(self, par...
class Group: def __init_subclass__(cls) -> None: pass def __init__(self, parser: ArgumentParser, title: Optional[str]): pass @classmethod def create(cls, parser: ArgumentParser): pass def add_bool_arguments(self, *args, nullable=False, **kwargs): pass def pre...
7
0
5
0
5
0
1
0
0
2
0
8
4
1
5
5
34
6
28
12
22
0
25
11
19
2
0
1
7
17,412
huge-success/sanic
huge-success_sanic/sanic/cli/arguments.py
sanic.cli.arguments.HTTPVersionGroup
from sanic.http.constants import HTTP class HTTPVersionGroup(Group): name = 'HTTP version' def attach(self): http_values = [http.value for http in HTTP.__members__.values()] self.container.add_argument('--http', dest='http', action='append', choices=http_values, type=int, help='Which HTTP vers...
class HTTPVersionGroup(Group): def attach(self): pass def prepare(self, args): pass
3
0
16
1
16
0
2
0
1
5
1
0
2
0
2
7
36
3
33
5
30
0
11
5
8
2
1
1
3
17,413
huge-success/sanic
huge-success_sanic/sanic/cli/arguments.py
sanic.cli.arguments.OutputGroup
class OutputGroup(Group): name = 'Output' def attach(self): self.add_bool_arguments('--coffee', dest='coffee', default=False, help='Uhm, coffee?') self.add_bool_arguments('--motd', dest='motd', default=True, help='Show the startup display') self.container.add_argument('-v', '--verbosity...
class OutputGroup(Group): def attach(self): pass
2
0
25
0
25
0
1
0
1
0
0
0
1
0
1
6
28
1
27
3
25
0
7
3
5
1
1
0
1
17,414
huge-success/sanic
huge-success_sanic/sanic/cli/arguments.py
sanic.cli.arguments.SocketGroup
class SocketGroup(Group): name = 'Socket binding' def attach(self): self.container.add_argument('-H', '--host', dest='host', type=str, help='Host address [default 127.0.0.1]') self.container.add_argument('-p', '--port', dest='port', type=int, help='Port to serve on [default 8000]') self...
class SocketGroup(Group): def attach(self): pass
2
0
23
0
23
0
1
0
1
2
0
0
1
0
1
6
26
1
25
3
23
0
6
3
4
1
1
0
1
17,415
huge-success/sanic
huge-success_sanic/sanic/cli/arguments.py
sanic.cli.arguments.TLSGroup
class TLSGroup(Group): name = 'TLS certificate' def attach(self): self.container.add_argument('--cert', dest='cert', type=str, help='Location of fullchain.pem, bundle.crt or equivalent') self.container.add_argument('--key', dest='key', type=str, help='Location of privkey.pem or equivalent .key ...
class TLSGroup(Group): def attach(self): pass
2
0
30
0
30
0
1
0
1
1
0
0
1
0
1
6
33
1
32
3
30
0
7
3
5
1
1
0
1
17,416
huge-success/sanic
huge-success_sanic/sanic/cli/arguments.py
sanic.cli.arguments.WorkerGroup
class WorkerGroup(Group): name = 'Worker' def attach(self): group = self.container.add_mutually_exclusive_group() group.add_argument('-w', '--workers', dest='workers', type=int, default=1, help='Number of worker processes [default 1]') group.add_argument('--fast', dest='fast', action='s...
class WorkerGroup(Group): def attach(self): pass
2
0
28
0
28
0
1
0
1
1
0
0
1
0
1
6
31
1
30
4
28
0
8
4
6
1
1
0
1
17,417
huge-success/sanic
huge-success_sanic/sanic/cli/base.py
sanic.cli.base.SanicArgumentParser
from argparse import SUPPRESS, Action, ArgumentParser, RawTextHelpFormatter, _SubParsersAction from typing import Any class SanicArgumentParser(ArgumentParser): def _check_value(self, action: Action, value: Any) -> None: if isinstance(action, SanicSubParsersAction): return super()._che...
class SanicArgumentParser(ArgumentParser): def _check_value(self, action: Action, value: Any) -> None: pass
2
0
4
0
4
0
2
0
1
4
1
0
1
0
1
51
5
0
5
2
3
0
5
2
3
2
3
1
2
17,418
huge-success/sanic
huge-success_sanic/sanic/cli/base.py
sanic.cli.base.SanicHelpFormatter
from argparse import SUPPRESS, Action, ArgumentParser, RawTextHelpFormatter, _SubParsersAction class SanicHelpFormatter(RawTextHelpFormatter): def add_usage(self, usage, actions, groups, prefix=None): if not usage: usage = SUPPRESS self.add_text('\x1b[1A') super().add_usage...
class SanicHelpFormatter(RawTextHelpFormatter): def add_usage(self, usage, actions, groups, prefix=None): pass
2
0
6
0
5
1
2
0.17
1
1
0
0
1
0
1
29
7
0
6
2
4
1
6
2
4
2
4
1
2
17,419
huge-success/sanic
huge-success_sanic/sanic/cli/base.py
sanic.cli.base.SanicSubParsersAction
from argparse import SUPPRESS, Action, ArgumentParser, RawTextHelpFormatter, _SubParsersAction class SanicSubParsersAction(_SubParsersAction): def __call__(self, parser, namespace, values, option_string=None): self._name_parser_map parser_name = values[0] if parser_name not in self._name_p...
class SanicSubParsersAction(_SubParsersAction): def __call__(self, parser, namespace, values, option_string=None): pass
2
0
8
1
7
0
2
0
1
1
0
0
1
0
1
12
9
1
8
3
6
0
8
3
6
2
4
1
2
17,420
huge-success/sanic
huge-success_sanic/sanic/cli/console.py
sanic.cli.console.REPLProtocol
from sanic.http.constants import Stage from sanic.models.protocol_types import TransportProtocol class REPLProtocol(TransportProtocol): def __init__(self): self.stage = Stage.IDLE self.request_body = True def respond(self, response): global repl_response repl_response = respon...
class REPLProtocol(TransportProtocol): def __init__(self): pass def respond(self, response): pass async def send(self, data, end_stream): pass
4
0
3
0
3
0
1
0
1
1
1
0
3
2
3
9
12
2
10
7
6
0
11
7
6
1
2
0
3
17,421
huge-success/sanic
huge-success_sanic/sanic/cli/console.py
sanic.cli.console.Result
from sanic import Request, Sanic from sanic.response.types import HTTPResponse from typing import Any, NamedTuple, Optional, Union class Result(NamedTuple): request: Request response: HTTPResponse
class Result(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,422
huge-success/sanic
huge-success_sanic/sanic/cli/console.py
sanic.cli.console.SanicREPL
from sanic.helpers import Default import sanic from ast import PyCF_ALLOW_TOP_LEVEL_AWAIT from sanic.log import Colors import traceback from sanic import Request, Sanic import threading from types import FunctionType from typing import Any, NamedTuple, Optional, Union import sys from asyncio import iscoroutine, new_eve...
class SanicREPL(InteractiveConsole): def __init__(self, app: Sanic, start: Optional[Default]=None): pass def pause(self): pass def resume(self): pass def runsource(self, source, filename='<input>', symbol='single'): pass def runcode(self, code): pass ...
12
0
12
0
12
1
2
0.07
1
12
4
0
10
10
10
21
132
13
119
31
106
8
80
31
67
8
2
3
24
17,423
huge-success/sanic
huge-success_sanic/sanic/cli/executor.py
sanic.cli.executor.Executor
from asyncio import run from typing import Callable from sanic.application.logo import get_logo import shutil from sanic import Sanic from sanic.cli.base import SanicArgumentParser, SanicHelpFormatter from argparse import ArgumentParser from inspect import signature class Executor: def __init__(self, app: Sanic, ...
class Executor: def __init__(self, app: Sanic, kwargs: dict) -> None: pass def run(self, command: str, args: list[str]) -> None: pass def _make_commands(self) -> dict[str, Callable]: pass def _make_parser(self) -> SanicArgumentParser: pass def _add_arguments(sel...
6
0
11
0
11
0
2
0
0
9
4
0
5
4
5
5
60
6
54
21
48
0
33
21
27
3
0
2
10
17,424
huge-success/sanic
huge-success_sanic/sanic/cli/executor.py
sanic.cli.executor.ExecutorSubParser
from sanic.application.logo import get_logo from argparse import ArgumentParser class ExecutorSubParser(ArgumentParser): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) if not self.description: self.description = '' self.description = get_logo(True) + sel...
class ExecutorSubParser(ArgumentParser): def __init__(self, *args, **kwargs): pass
2
0
5
0
5
0
2
0
1
1
0
0
1
1
1
51
6
0
6
3
4
0
6
3
4
2
3
1
2
17,425
huge-success/sanic
huge-success_sanic/sanic/cli/inspector.py
sanic.cli.inspector.InspectorSubParser
from sanic.application.logo import get_logo from argparse import ArgumentParser class InspectorSubParser(ArgumentParser): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) _add_shared(self) if not self.description: self.description = '' self.descrip...
class InspectorSubParser(ArgumentParser): def __init__(self, *args, **kwargs): pass
2
0
6
0
6
0
2
0
1
1
0
0
1
1
1
51
7
0
7
3
5
0
7
3
5
2
3
1
2
17,426
huge-success/sanic
huge-success_sanic/sanic/cli/inspector_client.py
sanic.cli.inspector_client.InspectorClient
from textwrap import indent from urllib.request import Request as URequest from urllib.request import urlopen from sanic.application.logo import get_logo from typing import Any, Optional from sanic.application.motd import MOTDTTY from sanic.log import Colors import sys from urllib.error import URLError from http.client...
class InspectorClient: def __init__(self, host: str, port: int, secure: bool, raw: bool, api_key: Optional[str]) -> None: pass def do(self, action: str, **kwargs: Any) -> None: pass def info(self) -> None: pass def request(self, action: str, method: str='POST', **kwargs: Any...
7
0
18
0
18
0
3
0.02
0
10
2
0
5
5
5
5
97
6
91
36
77
2
55
26
49
5
0
3
17
17,427
huge-success/sanic
huge-success_sanic/sanic/compat.py
sanic.compat.Header
from multidict import CIMultiDict class Header(CIMultiDict): """Container used for both request and response headers. It is a subclass of [CIMultiDict](https://multidict.readthedocs.io/en/stable/multidict.html#cimultidictproxy) It allows for multiple values for a single key in keeping with the HTTP s...
class Header(CIMultiDict): '''Container used for both request and response headers. It is a subclass of [CIMultiDict](https://multidict.readthedocs.io/en/stable/multidict.html#cimultidictproxy) It allows for multiple values for a single key in keeping with the HTTP spec. Also, all keys are *case in-se...
3
2
4
0
4
1
2
1.13
1
1
0
0
2
0
2
2
21
4
8
3
5
9
8
3
5
2
1
1
3
17,428
huge-success/sanic
huge-success_sanic/sanic/compat.py
sanic.compat.UpperStrEnum
class UpperStrEnum(StrEnum): """Base class for string enums that are case insensitive.""" def _generate_next_value_(name, start, count, last_values): return name.upper() def __eq__(self, value: object) -> bool: value = str(value).upper() return super().__eq__(value) def __hash...
class UpperStrEnum(StrEnum): '''Base class for string enums that are case insensitive.''' def _generate_next_value_(name, start, count, last_values): pass def __eq__(self, value: object) -> bool: pass def __hash__(self) -> int: pass def __str__(self) -> str: pass
5
1
2
0
2
0
1
0.1
1
3
0
3
4
0
4
119
15
4
10
5
5
1
10
5
5
1
5
0
4
17,429
huge-success/sanic
huge-success_sanic/sanic/config.py
sanic.config.Config
from collections.abc import Sequence from sanic.utils import load_module_from_file_location, str_to_bool from sanic.constants import LocalCertCreator from inspect import getmembers, isclass, isdatadescriptor from pathlib import Path from warnings import filterwarnings from sanic.helpers import Default, _default from sa...
class Config(dict, metaclass=DescriptorMeta): '''Configuration object for Sanic. You can use this object to both: (1) configure how Sanic will operate, and (2) manage your application's custom configuration values. ''' def __init__(self, defaults: Optional[dict[str, Union[str, bool, int, float, No...
17
5
20
3
9
7
3
0.61
2
17
2
7
14
3
14
63
347
63
176
40
150
108
129
27
114
6
4
3
37
17,430
huge-success/sanic
huge-success_sanic/sanic/config.py
sanic.config.DescriptorMeta
from abc import ABCMeta from inspect import getmembers, isclass, isdatadescriptor class DescriptorMeta(ABCMeta): """Metaclass for Config.""" def __init__(cls, *_): cls.__setters__ = {name for name, _ in getmembers(cls, cls._is_setter)} @staticmethod def _is_setter(member: object): ret...
class DescriptorMeta(ABCMeta): '''Metaclass for Config.''' def __init__(cls, *_): pass @staticmethod def _is_setter(member: object): pass
4
1
2
0
2
0
1
0.17
1
0
0
1
1
0
2
22
9
2
6
4
2
1
5
3
2
1
3
0
2
17,431
huge-success/sanic
huge-success_sanic/sanic/constants.py
sanic.constants.HTTPMethod
from enum import auto from sanic.compat import UpperStrEnum class HTTPMethod(UpperStrEnum): """HTTP methods that are commonly used.""" GET = auto() POST = auto() PUT = auto() HEAD = auto() OPTIONS = auto() PATCH = auto() DELETE = auto()
class HTTPMethod(UpperStrEnum): '''HTTP methods that are commonly used.''' pass
1
1
0
0
0
0
0
0.13
1
0
0
0
0
0
0
119
10
1
8
8
7
1
8
8
7
0
6
0
0
17,432
huge-success/sanic
huge-success_sanic/sanic/constants.py
sanic.constants.LocalCertCreator
from enum import auto from sanic.compat import UpperStrEnum class LocalCertCreator(UpperStrEnum): """Local certificate creator.""" AUTO = auto() TRUSTME = auto() MKCERT = auto()
class LocalCertCreator(UpperStrEnum): '''Local certificate creator.''' pass
1
1
0
0
0
0
0
0.25
1
0
0
0
0
0
0
119
6
1
4
4
3
1
4
4
3
0
6
0
0
17,433
huge-success/sanic
huge-success_sanic/sanic/cookies/request.py
sanic.cookies.request.CookieRequestParameters
from typing import Any, Optional from sanic.cookies.response import Cookie from sanic.request.parameters import RequestParameters class CookieRequestParameters(RequestParameters): """A container for accessing single and multiple cookie values. Because the HTTP standard allows for multiple cookies with the sam...
class CookieRequestParameters(RequestParameters): '''A container for accessing single and multiple cookie values. Because the HTTP standard allows for multiple cookies with the same name, a standard dictionary cannot be used to access cookie values. This class provides a way to access cookie values in ...
6
1
6
0
6
0
2
0.67
1
6
1
0
5
0
5
34
59
9
30
10
22
20
28
8
22
2
3
1
10
17,434
huge-success/sanic
huge-success_sanic/sanic/cookies/response.py
sanic.cookies.response.Cookie
from sanic.exceptions import ServerError from datetime import datetime class Cookie: """A representation of a HTTP cookie, providing an interface to manipulate cookie attributes intended for a response. This class is a simplified representation of a cookie, similar to the Morsel SimpleCookie in Python's stand...
class Cookie: '''A representation of a HTTP cookie, providing an interface to manipulate cookie attributes intended for a response. This class is a simplified representation of a cookie, similar to the Morsel SimpleCookie in Python's standard library. It allows the manipulation of various cookie attributes...
41
12
9
0
7
2
2
0.42
0
9
1
0
20
11
21
21
290
37
191
79
132
80
101
42
79
12
0
4
44
17,435
huge-success/sanic
huge-success_sanic/sanic/cookies/response.py
sanic.cookies.response.CookieJar
from sanic.exceptions import ServerError from datetime import datetime class CookieJar: """A container to manipulate cookies. CookieJar dynamically writes headers as cookies are added and removed It gets around the limitation of one header per name by using the MultiHeader class to provide a unique ke...
class CookieJar: '''A container to manipulate cookies. CookieJar dynamically writes headers as cookies are added and removed It gets around the limitation of one header per name by using the MultiHeader class to provide a unique key that encodes to Set-Cookie. Args: headers (Header): The he...
9
6
35
3
18
15
2
0.84
0
8
3
0
7
1
7
7
268
28
131
56
83
110
36
16
28
7
0
2
17
17,436
huge-success/sanic
huge-success_sanic/sanic/errorpages.py
sanic.errorpages.BaseRenderer
import typing as t from sanic.helpers import STATUS_CODES from sanic.exceptions import BadRequest, SanicException class BaseRenderer: """Base class that all renderers must inherit from. This class defines the structure for rendering objects, handling the core functionality that specific renderers may extend. ...
class BaseRenderer: '''Base class that all renderers must inherit from. This class defines the structure for rendering objects, handling the core functionality that specific renderers may extend. Attributes: request (Request): The incoming request object that needs rendering. exception (Exc...
13
8
7
1
4
2
2
0.84
0
5
1
3
8
3
8
8
85
17
38
19
25
32
30
15
21
2
0
1
12
17,437
huge-success/sanic
huge-success_sanic/sanic/errorpages.py
sanic.errorpages.HTMLRenderer
from sanic.response import html, json, text from sanic.pages.error import ErrorPage class HTMLRenderer(BaseRenderer): """Render an exception as HTML. The default fallback type. """ def full(self) -> HTTPResponse: page = ErrorPage(debug=self.debug, title=super().title, text=super().text, reque...
class HTMLRenderer(BaseRenderer): '''Render an exception as HTML. The default fallback type. ''' def full(self) -> HTTPResponse: pass def minimal(self) -> HTTPResponse: pass
3
1
6
0
6
0
1
0.25
1
2
1
0
2
2
2
10
18
3
12
6
9
3
6
4
3
1
1
0
2
17,438
huge-success/sanic
huge-success_sanic/sanic/errorpages.py
sanic.errorpages.JSONRenderer
from sanic.response import html, json, text from traceback import extract_tb import sys from sanic.helpers import STATUS_CODES class JSONRenderer(BaseRenderer): """Render an exception as JSON.""" def full(self) -> HTTPResponse: output = self._generate_output(full=True) return json(output, dump...
class JSONRenderer(BaseRenderer): '''Render an exception as JSON.''' def full(self) -> HTTPResponse: pass def minimal(self) -> HTTPResponse: pass def _generate_output(self, *, full): pass @property def title(self): pass
6
1
12
1
11
0
2
0.02
1
2
0
0
4
0
4
12
54
9
44
13
38
1
25
12
20
5
1
2
8
17,439
huge-success/sanic
huge-success_sanic/sanic/errorpages.py
sanic.errorpages.TextRenderer
import sys from traceback import extract_tb from sanic.response import html, json, text class TextRenderer(BaseRenderer): """Render an exception as plain text.""" OUTPUT_TEXT = '{title}\n{bar}\n{text}\n\n{body}' SPACER = ' ' def full(self) -> HTTPResponse: return text(self.OUTPUT_TEXT.format(...
class TextRenderer(BaseRenderer): '''Render an exception as plain text.''' def full(self) -> HTTPResponse: pass def minimal(self) -> HTTPResponse: pass @property def title(self): pass def _generate_body(self, *, full): pass def _format_exc(self, exc): ...
8
1
10
1
9
0
2
0.02
1
2
0
0
6
1
6
14
73
12
60
20
52
1
33
18
26
5
1
2
11
17,440
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.BadRequest
class BadRequest(HTTPException): """400 Bad Request Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the HTTP status 'Bad Request' will be sent. Defaults to `None`. quiet (Optional[bool], optional): When `True`, the error tr...
class BadRequest(HTTPException): '''400 Bad Request Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the HTTP status 'Bad Request' will be sent. Defaults to `None`. quiet (Optional[bool], optional): When `True`, the error tra...
1
1
0
0
0
0
0
4.33
1
0
0
2
0
0
0
12
18
2
3
3
2
13
3
3
2
0
5
0
0
17,441
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.ExpectationFailed
class ExpectationFailed(HTTPException): """417 Expectation Failed Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the HTTP status 'Bad Request' will be sent. Defaults to `None`. quiet (Optional[bool], optional): When `True`...
class ExpectationFailed(HTTPException): '''417 Expectation Failed Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the HTTP status 'Bad Request' will be sent. Defaults to `None`. quiet (Optional[bool], optional): When `True`,...
1
1
0
0
0
0
0
4.33
1
0
0
0
0
0
0
12
18
2
3
3
2
13
3
3
2
0
5
0
0
17,442
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.FileNotFound
from typing import Any, Optional, Union from os import PathLike class FileNotFound(NotFound): """404 Not Found A specific form of :class:`.NotFound` that is specifically when looking for a file on the file system at a known path. Args: message (Optional[Union[str, bytes]], optional): The mess...
class FileNotFound(NotFound): '''404 Not Found A specific form of :class:`.NotFound` that is specifically when looking for a file on the file system at a known path. Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the HTTP ...
2
1
20
0
20
0
1
0.86
1
7
0
0
1
2
1
13
42
3
21
14
9
18
5
4
3
1
6
0
1
17,443
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.Forbidden
class Forbidden(HTTPException): """403 Forbidden Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the HTTP status 'Bad Request' will be sent. Defaults to `None`. quiet (Optional[bool], optional): When `True`, the error trace...
class Forbidden(HTTPException): '''403 Forbidden Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the HTTP status 'Bad Request' will be sent. Defaults to `None`. quiet (Optional[bool], optional): When `True`, the error traceb...
1
1
0
0
0
0
0
4.33
1
0
0
0
0
0
0
12
18
2
3
3
2
13
3
3
2
0
5
0
0
17,444
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.HTTPException
from typing import Any, Optional, Union class HTTPException(SanicException): """A base class for other exceptions and should not be called directly.""" def __init__(self, message: Optional[Union[str, bytes]]=None, *, quiet: Optional[bool]=None, context: Optional[dict[str, Any]]=None, extra: Optional[dict[str,...
class HTTPException(SanicException): '''A base class for other exceptions and should not be called directly.''' def __init__(self, message: Optional[Union[str, bytes]]=None, *, quiet: Optional[bool]=None, context: Optional[dict[str, Any]]=None, extra: Optional[dict[str, Any]]=None, headers: Optional[dict[str,...
2
1
16
0
16
0
1
0.06
1
6
0
12
1
0
1
12
19
1
17
10
7
1
3
2
1
1
4
0
1
17,445
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.HeaderNotFound
class HeaderNotFound(BadRequest): """400 Bad Request Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the HTTP status 'Bad Request' will be sent. Defaults to `None`. quiet (Optional[bool], optional): When `True`, the error t...
class HeaderNotFound(BadRequest): '''400 Bad Request Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the HTTP status 'Bad Request' will be sent. Defaults to `None`. quiet (Optional[bool], optional): When `True`, the error tr...
1
1
0
0
0
0
0
13
1
0
0
0
0
0
0
12
15
1
1
1
0
13
1
1
0
0
6
0
0
17,446
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.InvalidHeader
class InvalidHeader(BadRequest): """400 Bad Request Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the HTTP status 'Bad Request' will be sent. Defaults to `None`. quiet (Optional[bool], optional): When `True`, the error tr...
class InvalidHeader(BadRequest): '''400 Bad Request Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the HTTP status 'Bad Request' will be sent. Defaults to `None`. quiet (Optional[bool], optional): When `True`, the error tra...
1
1
0
0
0
0
0
13
1
0
0
0
0
0
0
12
15
1
1
1
0
13
1
1
0
0
6
0
0
17,447
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.InvalidRangeType
class InvalidRangeType(RangeNotSatisfiable): """416 Range Not Satisfiable Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the HTTP status 'Bad Request' will be sent. Defaults to `None`. quiet (Optional[bool], optional): Whe...
class InvalidRangeType(RangeNotSatisfiable): '''416 Range Not Satisfiable Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the HTTP status 'Bad Request' will be sent. Defaults to `None`. quiet (Optional[bool], optional): When...
1
1
0
0
0
0
0
4.33
1
0
0
0
0
0
0
13
18
2
3
3
2
13
3
3
2
0
6
0
0
17,448
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.InvalidSignal
class InvalidSignal(SanicException): """Exception raised when an invalid signal is sent."""
class InvalidSignal(SanicException): '''Exception raised when an invalid signal is sent.''' pass
1
1
0
0
0
0
0
1
1
0
0
0
0
0
0
11
2
0
1
1
0
1
1
1
0
0
4
0
0
17,449
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.LoadFileException
class LoadFileException(SanicException): """Exception raised when a file cannot be loaded."""
class LoadFileException(SanicException): '''Exception raised when a file cannot be loaded.''' pass
1
1
0
0
0
0
0
1
1
0
0
0
0
0
0
11
2
0
1
1
0
1
1
1
0
0
4
0
0
17,450
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.MethodNotAllowed
from typing import Any, Optional, Union from collections.abc import Sequence class MethodNotAllowed(HTTPException): """405 Method Not Allowed Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the HTTP status 'Method Not Allowed' wil...
class MethodNotAllowed(HTTPException): '''405 Method Not Allowed Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the HTTP status 'Method Not Allowed' will be sent. Defaults to `None`. method (Optional[str], optional): The H...
2
1
25
0
25
0
2
0.57
1
7
0
0
1
3
1
13
47
3
28
17
16
16
9
7
7
2
5
1
2
17,451
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.NotFound
class NotFound(HTTPException): """A base class for other exceptions and should not be called directly. Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None`, then the appropriate HTTP response status message will be used instead. Defaults to ...
class NotFound(HTTPException): '''A base class for other exceptions and should not be called directly. Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None`, then the appropriate HTTP response status message will be used instead. Defaults to `...
1
1
0
0
0
0
0
4.33
1
0
0
1
0
0
0
12
18
2
3
3
2
13
3
3
2
0
5
0
0
17,452
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.PayloadTooLarge
class PayloadTooLarge(HTTPException): """413 Payload Too Large This is an internal exception thrown by Sanic and should not be used directly. Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the HTTP status 'Bad Request' wi...
class PayloadTooLarge(HTTPException): '''413 Payload Too Large This is an internal exception thrown by Sanic and should not be used directly. Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the HTTP status 'Bad Request' will...
1
1
0
0
0
0
0
5
1
0
0
0
0
0
0
12
21
3
3
3
2
15
3
3
2
0
5
0
0
17,453
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.PyFileError
from typing import Any, Optional, Union class PyFileError(SanicException): def __init__(self, file, status_code: Optional[int]=None, *, quiet: Optional[bool]=None, context: Optional[dict[str, Any]]=None, extra: Optional[dict[str, Any]]=None, headers: Optional[dict[str, Any]]=None): super().__init__('could...
class PyFileError(SanicException): def __init__(self, file, status_code: Optional[int]=None, *, quiet: Optional[bool]=None, context: Optional[dict[str, Any]]=None, extra: Optional[dict[str, Any]]=None, headers: Optional[dict[str, Any]]=None): pass
2
0
18
0
18
0
1
0
1
6
0
0
1
0
1
12
19
0
19
11
8
0
3
2
1
1
4
0
1
17,454
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.RangeNotSatisfiable
from sanic.models.protocol_types import Range from typing import Any, Optional, Union class RangeNotSatisfiable(HTTPException): """416 Range Not Satisfiable Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the HTTP status 'Range No...
class RangeNotSatisfiable(HTTPException): '''416 Range Not Satisfiable Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the HTTP status 'Range Not Satisfiable' will be sent. Defaults to `None`. content_range (Optional[Conten...
2
1
22
0
22
0
2
0.6
1
6
0
1
1
1
1
13
43
3
25
14
14
15
7
5
5
2
5
1
2
17,455
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.RequestCancelled
from asyncio import CancelledError class RequestCancelled(CancelledError): quiet = True
class RequestCancelled(CancelledError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
9
2
0
2
2
1
0
2
2
1
0
3
0
0
17,456
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.RequestTimeout
class RequestTimeout(HTTPException): """408 Request Timeout The Web server (running the Web site) thinks that there has been too long an interval of time between 1) the establishment of an IP connection (socket) between the client and the server and 2) the receipt of any data on that socket, so the...
class RequestTimeout(HTTPException): '''408 Request Timeout The Web server (running the Web site) thinks that there has been too long an interval of time between 1) the establishment of an IP connection (socket) between the client and the server and 2) the receipt of any data on that socket, so the ...
1
1
0
0
0
0
0
7
1
0
0
0
0
0
0
12
28
4
3
3
2
21
3
3
2
0
5
0
0
17,457
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.SanicException
from typing import Any, Optional, Union from sanic.helpers import STATUS_CODES class SanicException(Exception): """Generic exception that will generate an HTTP response when raised in the context of a request lifecycle. Usually, it is best practice to use one of the more specific exceptions than this gene...
class SanicException(Exception): '''Generic exception that will generate an HTTP response when raised in the context of a request lifecycle. Usually, it is best practice to use one of the more specific exceptions than this generic one. Even when trying to raise a 500, it is generally preferable to use ...
2
1
38
2
36
0
6
0.76
1
8
0
12
1
2
1
11
79
7
41
18
30
31
25
9
23
6
3
2
6
17,458
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.ServerError
class ServerError(HTTPException): """500 Internal Server Error A general server-side error has occurred. If no other HTTP exception is appropriate, then this should be used Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then t...
class ServerError(HTTPException): '''500 Internal Server Error A general server-side error has occurred. If no other HTTP exception is appropriate, then this should be used Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the...
1
1
0
0
0
0
0
7.5
1
0
0
3
0
0
0
12
20
3
2
2
1
15
2
2
1
0
5
0
0
17,459
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.ServerKilled
class ServerKilled(Exception): """Exception Sanic server uses when killing a server process for something unexpected happening.""" quiet = True
class ServerKilled(Exception): '''Exception Sanic server uses when killing a server process for something unexpected happening.''' pass
1
1
0
0
0
0
0
0.5
1
0
0
0
0
0
0
10
4
1
2
2
1
1
2
2
1
0
3
0
0
17,460
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.ServiceUnavailable
class ServiceUnavailable(HTTPException): """503 Service Unavailable The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state. Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `Non...
class ServiceUnavailable(HTTPException): '''503 Service Unavailable The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state. Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None`...
1
1
0
0
0
0
0
5
1
0
0
0
0
0
0
12
21
3
3
3
2
15
3
3
2
0
5
0
0
17,461
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.URLBuildError
class URLBuildError(HTTPException): """500 Internal Server Error An exception used by Sanic internals when unable to build a URL. Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the HTTP status 'Bad Request' will be sent. Defa...
class URLBuildError(HTTPException): '''500 Internal Server Error An exception used by Sanic internals when unable to build a URL. Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the HTTP status 'Bad Request' will be sent. Defaul...
1
1
0
0
0
0
0
7
1
0
0
0
0
0
0
12
19
3
2
2
1
14
2
2
1
0
5
0
0
17,462
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.Unauthorized
from typing import Any, Optional, Union class Unauthorized(HTTPException): """ **Status**: 401 Unauthorized When present, additional keyword arguments may be used to complete the WWW-Authentication header. Args: message (Optional[Union[str, bytes]], optional): The message to be sent to th...
class Unauthorized(HTTPException): ''' **Status**: 401 Unauthorized When present, additional keyword arguments may be used to complete the WWW-Authentication header. Args: message (Optional[Union[str, bytes]], optional): The message to be sent to the client. If `None` then the H...
2
1
28
2
25
1
2
1.89
1
6
0
0
1
1
1
13
91
10
28
17
16
53
9
7
7
2
5
1
2
17,463
huge-success/sanic
huge-success_sanic/sanic/exceptions.py
sanic.exceptions.WebsocketClosed
class WebsocketClosed(SanicException): """Exception raised when a websocket is closed.""" quiet = True message = 'Client has closed the websocket connection'
class WebsocketClosed(SanicException): '''Exception raised when a websocket is closed.''' pass
1
1
0
0
0
0
0
0.33
1
0
0
0
0
0
0
11
5
1
3
3
2
1
3
3
2
0
4
0
0
17,464
huge-success/sanic
huge-success_sanic/sanic/handlers/content_range.py
sanic.handlers.content_range.ContentRangeHandler
import os from sanic.models.protocol_types import Range from sanic.exceptions import HeaderNotFound, InvalidRangeType, RangeNotSatisfiable class ContentRangeHandler(Range): """Parse and process the incoming request headers to extract the content range information. Args: request (Request): The incoming...
class ContentRangeHandler(Range): '''Parse and process the incoming request headers to extract the content range information. Args: request (Request): The incoming request object. stats (os.stat_result): The stats of the file being served. ''' def __init__(self, request: Request, stats...
3
1
24
0
23
1
6
0.15
1
9
3
0
2
5
2
26
58
4
47
12
44
7
32
12
29
11
6
2
12
17,465
huge-success/sanic
huge-success_sanic/sanic/handlers/directory.py
sanic.handlers.directory.DirectoryHandler
from typing import Optional, Union, cast from sanic.pages.directory_page import DirectoryPage, FileInfo from collections.abc import Iterable, Sequence from stat import S_ISDIR from sanic.response import file, html, redirect from operator import itemgetter from sanic.exceptions import NotFound from pathlib import Path f...
class DirectoryHandler: '''Serve files from a directory. Args: uri (str): The URI to serve the files at. directory (Path): The directory to serve files from. directory_view (bool): Whether to show a directory listing or not. index (Optional[Union[str, Sequence[str]]]): The index...
6
2
16
1
12
3
3
0.35
0
15
4
0
5
4
5
5
93
13
60
27
48
21
39
21
33
5
0
2
15
17,466
huge-success/sanic
huge-success_sanic/sanic/handlers/error.py
sanic.handlers.error.ErrorHandler
from sanic.errorpages import BaseRenderer, TextRenderer, exception_response from typing import Optional from sanic.exceptions import ServerError from sanic.response import text from sanic.response.types import HTTPResponse from sanic.log import error_logger from sanic.models.handler_types import RouteHandler from sanic...
class ErrorHandler: '''Process and handle all uncaught exceptions. This error handling framework is built into the core that can be extended by the developers to perform a wide range of tasks from recording the error stats to reporting them to an external service that can be used for realtime alert...
10
6
21
3
12
7
3
0.6
0
13
5
3
7
3
8
8
192
34
100
38
83
60
73
30
64
7
0
3
26
17,467
huge-success/sanic
huge-success_sanic/sanic/headers.py
sanic.headers.AcceptList
class AcceptList(list): """A list of media types, as used in the Accept header. The Accept header entries are listed in order of preference, starting with the most preferred. This class is a list of `MediaType` objects, that encapsulate also the q value or any other parameters. Two separate method...
class AcceptList(list): '''A list of media types, as used in the Accept header. The Accept header entries are listed in order of preference, starting with the most preferred. This class is a list of `MediaType` objects, that encapsulate also the q value or any other parameters. Two separate methods ...
3
3
19
3
6
11
2
2.58
1
3
1
0
2
0
2
35
54
11
12
4
9
31
6
4
3
2
2
0
3
17,468
huge-success/sanic
huge-success_sanic/sanic/headers.py
sanic.headers.Matched
from typing import Any, Optional, Union class Matched: """A matching result of a MIME string against a header. This class is a representation of a matching result of a MIME string against a header. It encapsulates the MIME string, the header, and provides methods for matching against other MIME string...
class Matched: '''A matching result of a MIME string against a header. This class is a representation of a matching result of a MIME string against a header. It encapsulates the MIME string, the header, and provides methods for matching against other MIME strings. Args: mime (str): The MIME...
10
2
7
1
5
1
2
0.36
0
6
1
0
7
2
8
8
77
16
45
16
35
16
35
15
26
4
0
2
16
17,469
huge-success/sanic
huge-success_sanic/sanic/headers.py
sanic.headers.MediaType
from typing import Any, Optional, Union class MediaType: """A media type, as used in the Accept header. This class is a representation of a media type, as used in the Accept header. It encapsulates the type, subtype and any parameters, and provides methods for matching against other media types. ...
class MediaType: '''A media type, as used in the Accept header. This class is a representation of a media type, as used in the Accept header. It encapsulates the type, subtype and any parameters, and provides methods for matching against other media types. Two separate methods are provided for sear...
9
4
17
2
11
4
2
0.53
0
4
0
0
5
6
6
6
125
18
70
28
53
37
33
18
26
4
0
2
13
17,470
huge-success/sanic
huge-success_sanic/sanic/helpers.py
sanic.helpers.Default
class Default: """ It is used to replace `None` or `object()` as a sentinel that represents a default value. Sometimes we want to set a value to `None` so we cannot use `None` to represent the default value, and `object()` is hard to be typed. """ def __repr__(self): return '<Defaul...
class Default: ''' It is used to replace `None` or `object()` as a sentinel that represents a default value. Sometimes we want to set a value to `None` so we cannot use `None` to represent the default value, and `object()` is hard to be typed. ''' def __repr__(self): pass d...
3
1
2
0
2
0
1
1.2
0
1
0
0
2
0
2
2
13
2
5
3
2
6
5
3
2
1
0
0
2
17,471
huge-success/sanic
huge-success_sanic/sanic/http/constants.py
sanic.http.constants.HTTP
from enum import Enum, IntEnum class HTTP(IntEnum): """Enum for representing HTTP versions""" VERSION_1 = 1 VERSION_3 = 3 def display(self) -> str: value = 1.1 if self.value == 1 else self.value return f'HTTP/{value}'
class HTTP(IntEnum): '''Enum for representing HTTP versions''' def display(self) -> str: pass
2
1
3
0
3
0
2
0.17
1
1
0
0
1
0
1
56
9
2
6
5
4
1
6
5
4
2
3
0
2
17,472
huge-success/sanic
huge-success_sanic/sanic/http/constants.py
sanic.http.constants.Stage
from enum import Enum, IntEnum class Stage(Enum): """Enum for representing the stage of the request/response cycle | ``IDLE`` Waiting for request | ``REQUEST`` Request headers being received | ``HANDLER`` Headers done, handler running | ``RESPONSE`` Response headers sent, body in progress ...
class Stage(Enum): '''Enum for representing the stage of the request/response cycle | ``IDLE`` Waiting for request | ``REQUEST`` Request headers being received | ``HANDLER`` Headers done, handler running | ``RESPONSE`` Response headers sent, body in progress | ``FAILED`` Unrecoverable stat...
1
1
0
0
0
0
0
2.17
1
0
0
0
0
0
0
49
16
2
6
6
5
13
6
6
5
0
4
0
0
17,473
huge-success/sanic
huge-success_sanic/sanic/http/http1.py
sanic.http.http1.Http
from time import perf_counter from sanic.helpers import has_message_body from asyncio import CancelledError, sleep from sanic.log import access_logger, error_logger, logger from sanic.http.stream import Stream from sanic.headers import format_http1_response from sanic.exceptions import BadRequest, ExpectationFailed, Pa...
class Http(Stream, metaclass=TouchUpMeta): ''' "Internal helper for managing the HTTP/1.1 request/response cycle. Raises: BadRequest: If the request body is malformed. Exception: If the request is malformed. ExpectationFailed: If the request is malformed. PayloadTooLarge: If the...
22
15
29
4
21
4
5
0.21
2
19
10
0
16
22
18
34
584
89
415
90
387
86
290
78
271
18
4
4
97
17,474
huge-success/sanic
huge-success_sanic/sanic/http/http3.py
sanic.http.http3.HTTP3Transport
from typing import TYPE_CHECKING, Any, Callable, Optional, Union, cast from sanic.models.protocol_types import TransportProtocol class HTTP3Transport(TransportProtocol): """HTTP/3 transport implementation.""" __slots__ = ('_protocol',) def __init__(self, protocol: Http3Protocol): self._protocol = ...
class HTTP3Transport(TransportProtocol): '''HTTP/3 transport implementation.''' def __init__(self, protocol: Http3Protocol): pass def get_protocol(self) -> Http3Protocol: pass def get_extra_info(self, info: str, default: Any=None) -> Any: pass
4
1
5
0
5
0
2
0.06
1
3
1
0
3
1
3
3
22
4
17
6
13
1
12
6
8
4
1
1
6
17,475
huge-success/sanic
huge-success_sanic/sanic/http/http3.py
sanic.http.http3.HTTPReceiver
from sanic.helpers import has_message_body from typing import TYPE_CHECKING, Any, Callable, Optional, Union, cast from sanic.http.constants import Stage from sanic.log import Colors, logger from sanic.exceptions import BadRequest, PayloadTooLarge, SanicException, ServerError from sanic.http.stream import Stream class ...
class HTTPReceiver(Receiver, Stream): '''HTTP/3 receiver implementation.''' def __init__(self, *args, **kwargs) -> None: pass async def run(self, exception: Optional[Exception]=None): '''Handle the request and response cycle.''' pass async def error_response(self, exception: ...
10
7
18
2
15
2
3
0.15
2
12
4
0
9
6
9
31
172
25
135
26
123
20
83
23
73
8
5
2
28
17,476
huge-success/sanic
huge-success_sanic/sanic/http/http3.py
sanic.http.http3.Http3
from typing import TYPE_CHECKING, Any, Callable, Optional, Union, cast from sanic.models.server_types import ConnInfo from sanic.log import Colors, logger from sanic.compat import Header from sanic.exceptions import BadRequest, PayloadTooLarge, SanicException, ServerError import asyncio class Http3: """Internal he...
class Http3: '''Internal helper for managing the HTTP/3 request/response cycle''' def __init__(self, protocol: Http3Protocol, transmit: Callable[[], None]) -> None: pass def http_event_received(self, event: H3Event) -> None: pass def get_or_make_receiver(self, event: H3Event) -> tupl...
6
1
17
1
16
1
2
0.04
0
15
7
0
5
3
5
5
102
12
89
27
79
4
52
22
46
4
0
2
12
17,477
huge-success/sanic
huge-success_sanic/sanic/http/http3.py
sanic.http.http3.Receiver
import asyncio from abc import ABC, abstractmethod class Receiver(ABC): """HTTP/3 receiver base class.""" future: asyncio.Future def __init__(self, transmit, protocol, request: Request) -> None: self.transmit = transmit self.protocol = protocol self.request = request @abstract...
class Receiver(ABC): '''HTTP/3 receiver base class.''' def __init__(self, transmit, protocol, request: Request) -> None: pass @abstractmethod async def run(self): pass
4
1
3
0
3
1
1
0.22
1
0
0
3
2
3
2
22
13
3
9
7
5
2
8
6
5
1
4
0
2
17,478
huge-success/sanic
huge-success_sanic/sanic/http/http3.py
sanic.http.http3.SessionTicketStore
from typing import TYPE_CHECKING, Any, Callable, Optional, Union, cast class SessionTicketStore: """ Simple in-memory store for session tickets. """ def __init__(self) -> None: self.tickets: dict[bytes, SessionTicket] = {} def add(self, ticket: SessionTicket) -> None: self.tickets...
class SessionTicketStore: ''' Simple in-memory store for session tickets. ''' def __init__(self) -> None: pass def add(self, ticket: SessionTicket) -> None: pass def pop(self, label: bytes) -> Optional[SessionTicket]: pass
4
1
2
0
2
0
1
0.43
0
2
0
0
3
1
3
3
13
3
7
5
3
3
7
5
3
1
0
0
3
17,479
huge-success/sanic
huge-success_sanic/sanic/http/http3.py
sanic.http.http3.WebTransportReceiver
class WebTransportReceiver(Receiver): """WebTransport receiver implementation.""" async def run(self): ...
class WebTransportReceiver(Receiver): '''WebTransport receiver implementation.''' async def run(self): pass
2
1
1
0
1
0
1
1
1
0
0
0
1
0
1
23
4
1
2
2
1
2
3
2
1
1
5
0
1
17,480
huge-success/sanic
huge-success_sanic/sanic/http/http3.py
sanic.http.http3.WebsocketReceiver
class WebsocketReceiver(Receiver): """Websocket receiver implementation.""" async def run(self): ...
class WebsocketReceiver(Receiver): '''Websocket receiver implementation.''' async def run(self): pass
2
1
1
0
1
0
1
1
1
0
0
0
1
0
1
23
4
1
2
2
1
2
3
2
1
1
5
0
1
17,481
huge-success/sanic
huge-success_sanic/sanic/http/stream.py
sanic.http.stream.Stream
from sanic.http.constants import Stage from typing import TYPE_CHECKING, Optional, Union class Stream: stage: Stage response: Optional[BaseHTTPResponse] protocol: HttpProtocol url: Optional[str] request_body: Optional[bytes] request_max_size: Union[int, float] __touchup__: tuple[str, ...] =...
class Stream: def respond(self, response: BaseHTTPResponse) -> BaseHTTPResponse: pass
2
0
4
0
4
1
1
0.08
0
2
1
1
1
0
1
1
15
2
13
6
9
1
11
4
9
1
0
0
1
17,482
huge-success/sanic
huge-success_sanic/sanic/http/tls/context.py
sanic.http.tls.context.CertSelector
from sanic.log import logger from collections.abc import Iterable import ssl from typing import Any, Optional, Union class CertSelector(ssl.SSLContext): """Automatically select SSL certificate based on the hostname that the client is trying to access, via SSL SNI. Paths to certificate folders with privkey....
class CertSelector(ssl.SSLContext): '''Automatically select SSL certificate based on the hostname that the client is trying to access, via SSL SNI. Paths to certificate folders with privkey.pem and fullchain.pem in them should be provided, and will be matched in the order given whenever there is a new ...
3
1
11
0
11
1
3
0.27
1
5
0
0
2
3
2
27
29
2
22
9
19
6
20
9
17
5
2
2
6
17,483
huge-success/sanic
huge-success_sanic/sanic/http/tls/context.py
sanic.http.tls.context.CertSimple
from typing import Any, Optional, Union import ssl class CertSimple(SanicSSLContext): """A wrapper for creating SSLContext with a sanic attribute.""" sanic: dict[str, Any] def __new__(cls, cert, key, **kw): certfile = kw['cert'] = kw.pop('certificate', None) or cert keyfile = kw['key'] = k...
class CertSimple(SanicSSLContext): '''A wrapper for creating SSLContext with a sanic attribute.''' def __new__(cls, cert, key, **kw): pass def __init__(self, cert, key, **kw): pass
3
1
11
0
11
2
2
0.17
1
1
0
0
2
0
2
28
28
3
23
10
20
4
19
8
16
3
3
1
4
17,484
huge-success/sanic
huge-success_sanic/sanic/http/tls/context.py
sanic.http.tls.context.SanicSSLContext
import ssl import os class SanicSSLContext(ssl.SSLContext): sanic: dict[str, os.PathLike] @classmethod def create_from_ssl_context(cls, context: ssl.SSLContext): context.__class__ = cls return context
class SanicSSLContext(ssl.SSLContext): @classmethod def create_from_ssl_context(cls, context: ssl.SSLContext): pass
3
0
3
0
3
0
1
0
1
0
0
1
0
0
1
26
7
1
6
3
3
0
5
2
3
1
2
0
1
17,485
huge-success/sanic
huge-success_sanic/sanic/http/tls/creators.py
sanic.http.tls.creators.CertCreator
from tempfile import mkdtemp from abc import ABC, abstractmethod import ssl from sanic.constants import DEFAULT_LOCAL_TLS_CERT, DEFAULT_LOCAL_TLS_KEY, LocalCertCreator from pathlib import Path from typing import TYPE_CHECKING, Optional, Union, cast from sanic.helpers import Default from sanic.exceptions import SanicExc...
class CertCreator(ABC): def __init__(self, app, key, cert) -> None: pass @abstractmethod def check_supported(self) -> None: pass @abstractmethod def generate_cert(self, localhost: str) -> ssl.SSLContext: pass @classmethod def select(cls, app: Sanic, cert_creator: Lo...
10
0
18
2
16
1
3
0.04
1
9
5
2
3
6
5
25
97
12
85
34
61
3
37
16
31
4
4
2
14
17,486
huge-success/sanic
huge-success_sanic/sanic/http/tls/creators.py
sanic.http.tls.creators.MkcertCreator
from sanic.exceptions import SanicException from sanic.http.tls.context import CertSimple, SanicSSLContext from contextlib import suppress import sys from sanic.application.spinner import loading import ssl import subprocess class MkcertCreator(CertCreator): def check_supported(self) -> None: try: ...
class MkcertCreator(CertCreator): def check_supported(self) -> None: pass def generate_cert(self, localhost: str) -> ssl.SSLContext: pass @self.app.main_process_stop async def cleanup(*_): pass
5
0
22
1
21
2
2
0.09
1
8
3
1
2
0
2
27
63
4
58
10
53
5
27
8
23
2
5
3
6
17,487
huge-success/sanic
huge-success_sanic/sanic/http/tls/creators.py
sanic.http.tls.creators.TrustmeCreator
import ssl from sanic.exceptions import SanicException from sanic.http.tls.context import CertSimple, SanicSSLContext class TrustmeCreator(CertCreator): def check_supported(self) -> None: if not TRUSTME_INSTALLED: raise SanicException('Sanic is attempting to use trustme to generate local TLS c...
class TrustmeCreator(CertCreator): def check_supported(self) -> None: pass def generate_cert(self, localhost: str) -> ssl.SSLContext: pass
3
0
18
1
17
1
2
0.03
1
4
2
1
2
0
2
27
37
3
34
6
31
1
16
6
13
2
5
1
3
17,488
huge-success/sanic
huge-success_sanic/sanic/logging/color.py
sanic.logging.color.Colors
class Colors(StrEnum): """ Colors for log messages. If the output is not a TTY, the colors will be disabled. Can be used like this: .. code-block:: python from sanic.log import logger, Colors logger.info(f"{Colors.GREEN}This is a green message{Colors.END}") Attributes: ...
class Colors(StrEnum): ''' Colors for log messages. If the output is not a TTY, the colors will be disabled. Can be used like this: .. code-block:: python from sanic.log import logger, Colors logger.info(f"{Colors.GREEN}This is a green message{Colors.END}") Attributes: E...
1
1
0
0
0
0
0
1.73
1
0
0
0
0
0
0
115
36
7
11
11
10
19
11
11
10
0
5
0
0
17,489
huge-success/sanic
huge-success_sanic/sanic/logging/filter.py
sanic.logging.filter.VerbosityFilter
import logging class VerbosityFilter(logging.Filter): """ Filter log records based on verbosity level. """ verbosity: int = 0 def filter(self, record: logging.LogRecord) -> bool: verbosity = getattr(record, 'verbosity', 0) return verbosity <= self.verbosity
class VerbosityFilter(logging.Filter): ''' Filter log records based on verbosity level. ''' def filter(self, record: logging.LogRecord) -> bool: pass
2
1
3
0
3
0
1
0.6
1
2
0
0
1
0
1
3
10
2
5
4
3
3
5
4
3
1
2
0
1
17,490
huge-success/sanic
huge-success_sanic/sanic/logging/formatter.py
sanic.logging.formatter.AutoAccessFormatter
from sanic.logging.color import Colors as c import logging class AutoAccessFormatter(AutoFormatter): MESSAGE_FORMAT = f'{c.PURPLE}%(host)s {c.BLUE + c.BOLD}%(request)s{c.END} %(right)s%(status)s %(byte)s {c.GREY}%(duration)s{c.END}' def format(self, record: logging.LogRecord) -> str: status = len(str(...
class AutoAccessFormatter(AutoFormatter): def format(self, record: logging.LogRecord) -> str: pass def _set_levelname(self, record: logging.LogRecord) -> None: pass
3
0
7
0
7
0
2
0
1
4
1
3
2
0
2
15
21
2
19
7
16
0
11
7
8
2
3
1
4
17,491
huge-success/sanic
huge-success_sanic/sanic/logging/formatter.py
sanic.logging.formatter.AutoFormatter
import os from sanic.logging.color import LEVEL_COLORS from sanic.logging.color import Colors as c from sanic.helpers import is_atty, json_dumps import logging class AutoFormatter(logging.Formatter): """ Automatically sets up the formatter based on the environment. It will switch between the Debug and Pro...
class AutoFormatter(logging.Formatter): ''' Automatically sets up the formatter based on the environment. It will switch between the Debug and Production formatters based upon how the environment is set up. Additionally, it will automatically detect if the output is a TTY and colorize the output ac...
7
1
10
1
10
0
3
0.08
1
7
1
5
6
0
6
13
88
11
71
30
64
6
53
29
46
5
2
2
18
17,492
huge-success/sanic
huge-success_sanic/sanic/logging/formatter.py
sanic.logging.formatter.DebugAccessFormatter
class DebugAccessFormatter(AutoAccessFormatter): IDENT_LIMIT = 5 MESSAGE_START = 23 DATE_FORMAT = '%H:%M:%S' LOG_EXTRA = False
class DebugAccessFormatter(AutoAccessFormatter): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
15
5
0
5
5
4
0
5
5
4
0
4
0
0
17,493
huge-success/sanic
huge-success_sanic/sanic/logging/formatter.py
sanic.logging.formatter.DebugFormatter
from sanic.logging.color import Colors as c import logging class DebugFormatter(AutoFormatter): """ The DebugFormatter is used for development and debugging purposes. It can be used directly, or it will be automatically selected if the environment is set up for development and is using the AutoFormatt...
class DebugFormatter(AutoFormatter): ''' The DebugFormatter is used for development and debugging purposes. It can be used directly, or it will be automatically selected if the environment is set up for development and is using the AutoFormatter. ''' def _set_levelname(self, record: logging.Lo...
6
1
8
0
8
1
3
0.2
1
5
1
0
5
0
5
18
57
7
45
20
39
9
38
20
32
6
3
2
13
17,494
huge-success/sanic
huge-success_sanic/sanic/logging/formatter.py
sanic.logging.formatter.JSONAccessFormatter
import logging class JSONAccessFormatter(JSONFormatter): """ The JSONAccessFormatter is used to output access logs in JSON format. This is useful for logging to a file or to a log aggregator that understands JSON. It will output all the fields from the LogRecord as well as the extra fields that ar...
class JSONAccessFormatter(JSONFormatter): ''' The JSONAccessFormatter is used to output access logs in JSON format. This is useful for logging to a file or to a log aggregator that understands JSON. It will output all the fields from the LogRecord as well as the extra fields that are passed in. ...
2
1
8
0
8
0
1
1.06
1
2
0
0
1
0
1
17
40
7
16
4
14
17
5
4
3
1
4
0
1
17,495
huge-success/sanic
huge-success_sanic/sanic/logging/formatter.py
sanic.logging.formatter.JSONFormatter
from sanic.helpers import is_atty, json_dumps import logging class JSONFormatter(AutoFormatter): """ The JSONFormatter is used to output logs in JSON format. This is useful for logging to a file or to a log aggregator that understands JSON. It will output all the fields from the LogRecord as well ...
class JSONFormatter(AutoFormatter): ''' The JSONFormatter is used to output logs in JSON format. This is useful for logging to a file or to a log aggregator that understands JSON. It will output all the fields from the LogRecord as well as the extra fields that are passed in. You can use it as ...
4
1
8
0
8
0
2
0.47
1
3
0
1
3
0
3
16
63
10
36
11
32
17
18
11
14
3
3
1
5
17,496
huge-success/sanic
huge-success_sanic/sanic/logging/formatter.py
sanic.logging.formatter.LegacyAccessFormatter
class LegacyAccessFormatter(AutoAccessFormatter): """ The LegacyFormatter is used if you want to use the old style of logging. You can use it as follows, typically in conjunction with the LegacyFormatter: .. code-block:: python from sanic.log import LOGGING_CONFIG_DEFAULTS LOGGIN...
class LegacyAccessFormatter(AutoAccessFormatter): ''' The LegacyFormatter is used if you want to use the old style of logging. You can use it as follows, typically in conjunction with the LegacyFormatter: .. code-block:: python from sanic.log import LOGGING_CONFIG_DEFAULTS LOGGING_CO...
1
1
0
0
0
0
0
5
1
0
0
0
0
0
0
15
23
5
3
3
2
15
3
3
2
0
4
0
0
17,497
huge-success/sanic
huge-success_sanic/sanic/logging/formatter.py
sanic.logging.formatter.LegacyFormatter
class LegacyFormatter(AutoFormatter): """ The LegacyFormatter is used if you want to use the old style of logging. You can use it as follows, typically in conjunction with the LegacyAccessFormatter: .. code-block:: python from sanic.log import LOGGING_CONFIG_DEFAULTS LOGGING_CONF...
class LegacyFormatter(AutoFormatter): ''' The LegacyFormatter is used if you want to use the old style of logging. You can use it as follows, typically in conjunction with the LegacyAccessFormatter: .. code-block:: python from sanic.log import LOGGING_CONFIG_DEFAULTS LOGGING_CONFIG_D...
1
1
0
0
0
0
0
5
1
0
0
0
0
0
0
13
23
5
3
3
2
15
3
3
2
0
3
0
0
17,498
huge-success/sanic
huge-success_sanic/sanic/logging/formatter.py
sanic.logging.formatter.ProdAccessFormatter
from sanic.logging.color import Colors as c class ProdAccessFormatter(AutoAccessFormatter): IDENT_LIMIT = 5 MESSAGE_START = 42 PREFIX_FORMAT = f'{c.GREY}%(ident)s{{limit}}|%(asctime)s{c.END} %(levelname)s: {{start}}' MESSAGE_FORMAT = f'{c.PURPLE}%(host)s {c.BLUE + c.BOLD}%(request)s{c.END} %(right)s%(s...
class ProdAccessFormatter(AutoAccessFormatter): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
15
13
0
13
6
12
0
6
6
5
0
4
0
0
17,499
huge-success/sanic
huge-success_sanic/sanic/logging/formatter.py
sanic.logging.formatter.ProdFormatter
class ProdFormatter(AutoFormatter): """ The ProdFormatter is used for production environments. It can be used directly, or it will be automatically selected if the environment is set up for production and is using the AutoFormatter. """
class ProdFormatter(AutoFormatter): ''' The ProdFormatter is used for production environments. It can be used directly, or it will be automatically selected if the environment is set up for production and is using the AutoFormatter. ''' pass
1
1
0
0
0
0
0
5
1
0
0
0
0
0
0
13
7
1
1
1
0
5
1
1
0
0
3
0
0