Get rid of relative imports
This commit is contained in:
parent
c99aa7279b
commit
54b2d74068
|
@ -1,5 +1,5 @@
|
|||
from .app import Sanic
|
||||
from .blueprints import Blueprint
|
||||
from sanic.app import Sanic
|
||||
from sanic.blueprints import Blueprint
|
||||
|
||||
__version__ = '0.3.1'
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from argparse import ArgumentParser
|
||||
from importlib import import_module
|
||||
|
||||
from .log import log
|
||||
from .sanic import Sanic
|
||||
from sanic.log import log
|
||||
from sanic.sanic import Sanic
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = ArgumentParser(prog='sanic')
|
||||
|
|
22
sanic/app.py
22
sanic/app.py
|
@ -8,17 +8,17 @@ from inspect import isawaitable, stack, getmodulename
|
|||
from traceback import format_exc
|
||||
from urllib.parse import urlencode, urlunparse
|
||||
|
||||
from .config import Config
|
||||
from .constants import HTTP_METHODS
|
||||
from .exceptions import ServerError, URLBuildError
|
||||
from .handlers import ErrorHandler
|
||||
from .log import log
|
||||
from .response import HTTPResponse
|
||||
from .router import Router
|
||||
from .server import serve, serve_multiple, HttpProtocol
|
||||
from .static import register as static_register
|
||||
from .testing import TestClient
|
||||
from .views import CompositionView
|
||||
from sanic.config import Config
|
||||
from sanic.constants import HTTP_METHODS
|
||||
from sanic.exceptions import ServerError, URLBuildError
|
||||
from sanic.handlers import ErrorHandler
|
||||
from sanic.log import log
|
||||
from sanic.response import HTTPResponse
|
||||
from sanic.router import Router
|
||||
from sanic.server import serve, serve_multiple, HttpProtocol
|
||||
from sanic.static import register as static_register
|
||||
from sanic.testing import TestClient
|
||||
from sanic.views import CompositionView
|
||||
|
||||
|
||||
class Sanic:
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
import sys
|
||||
from traceback import format_exc, extract_tb
|
||||
|
||||
from .exceptions import ContentRangeError
|
||||
from .exceptions import INTERNAL_SERVER_ERROR_HTML, TRACEBACK_LINE_HTML
|
||||
from .exceptions import SanicException, HeaderNotFound, InvalidRangeType
|
||||
from .exceptions import TRACEBACK_STYLE, TRACEBACK_WRAPPER_HTML
|
||||
from .log import log
|
||||
from .response import text, html
|
||||
from sanic.exceptions import (
|
||||
ContentRangeError,
|
||||
HeaderNotFound,
|
||||
INTERNAL_SERVER_ERROR_HTML,
|
||||
InvalidRangeType,
|
||||
SanicException,
|
||||
TRACEBACK_LINE_HTML,
|
||||
TRACEBACK_STYLE,
|
||||
TRACEBACK_WRAPPER_HTML)
|
||||
from sanic.log import log
|
||||
from sanic.response import text, html
|
||||
|
||||
|
||||
class ErrorHandler:
|
||||
|
|
|
@ -3,10 +3,11 @@ from collections import namedtuple
|
|||
from http.cookies import SimpleCookie
|
||||
from httptools import parse_url
|
||||
from urllib.parse import parse_qs
|
||||
from ujson import loads as json_loads
|
||||
from sanic.exceptions import InvalidUsage
|
||||
|
||||
from .log import log
|
||||
from ujson import loads as json_loads
|
||||
|
||||
from sanic.exceptions import InvalidUsage
|
||||
from sanic.log import log
|
||||
|
||||
|
||||
DEFAULT_HTTP_CONTENT_TYPE = "application/octet-stream"
|
||||
|
|
|
@ -4,7 +4,7 @@ from ujson import dumps as json_dumps
|
|||
|
||||
from aiofiles import open as open_async
|
||||
|
||||
from .cookies import CookieJar
|
||||
from sanic.cookies import CookieJar
|
||||
|
||||
COMMON_STATUS_CODES = {
|
||||
200: b'OK',
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import re
|
||||
from collections import defaultdict, namedtuple
|
||||
from functools import lru_cache
|
||||
from .exceptions import NotFound, InvalidUsage
|
||||
from .views import CompositionView
|
||||
|
||||
from sanic.exceptions import NotFound, InvalidUsage
|
||||
from sanic.views import CompositionView
|
||||
|
||||
Route = namedtuple(
|
||||
'Route',
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import asyncio
|
||||
import os
|
||||
import traceback
|
||||
import warnings
|
||||
from functools import partial
|
||||
from inspect import isawaitable
|
||||
from multiprocessing import Process, Event
|
||||
|
@ -9,21 +10,19 @@ from signal import SIGTERM, SIGINT
|
|||
from signal import signal as signal_func
|
||||
from socket import socket, SOL_SOCKET, SO_REUSEADDR
|
||||
from time import time
|
||||
import warnings
|
||||
|
||||
from httptools import HttpRequestParser
|
||||
from httptools.parser.errors import HttpParserError
|
||||
|
||||
from .exceptions import ServerError
|
||||
|
||||
try:
|
||||
import uvloop as async_loop
|
||||
except ImportError:
|
||||
async_loop = asyncio
|
||||
|
||||
from .log import log
|
||||
from .request import Request
|
||||
from .exceptions import RequestTimeout, PayloadTooLarge, InvalidUsage
|
||||
from sanic.log import log
|
||||
from sanic.request import Request
|
||||
from sanic.exceptions import (
|
||||
RequestTimeout, PayloadTooLarge, InvalidUsage, ServerError)
|
||||
|
||||
current_time = None
|
||||
|
||||
|
|
|
@ -6,10 +6,14 @@ from urllib.parse import unquote
|
|||
|
||||
from aiofiles.os import stat
|
||||
|
||||
from .exceptions import FileNotFound, InvalidUsage, ContentRangeError
|
||||
from .exceptions import HeaderNotFound
|
||||
from .handlers import ContentRangeHandler
|
||||
from .response import file, HTTPResponse
|
||||
from sanic.exceptions import (
|
||||
ContentRangeError,
|
||||
FileNotFound,
|
||||
HeaderNotFound,
|
||||
InvalidUsage,
|
||||
)
|
||||
from sanic.handlers import ContentRangeHandler
|
||||
from sanic.response import file, HTTPResponse
|
||||
|
||||
|
||||
def register(app, uri, file_or_directory, pattern,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import warnings
|
||||
|
||||
from sanic.testing import TestClient
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from .exceptions import InvalidUsage
|
||||
from .constants import HTTP_METHODS
|
||||
from sanic.exceptions import InvalidUsage
|
||||
from sanic.constants import HTTP_METHODS
|
||||
|
||||
|
||||
class HTTPMethodView:
|
||||
|
|
Loading…
Reference in New Issue
Block a user