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