示例#1
0
        return result

    def tell(self):
        """Returns the position of the stream.

        .. versionadded:: 0.9
        """
        return self._pos

    def __next__(self):
        line = self.readline()
        if not line:
            raise StopIteration()
        return line

    def readable(self):
        return True


from werkzeug import _DeprecatedImportModule

_DeprecatedImportModule(
    __name__,
    {
        ".middleware.dispatcher": ["DispatcherMiddleware"],
        ".middleware.http_proxy": ["ProxyMiddleware"],
        ".middleware.shared_data": ["SharedDataMiddleware"],
    },
    "Werkzeug 1.0",
)
示例#2
0
                    str(exception),
                )
                break

        ImportError.__init__(self, msg)

    def __repr__(self):
        return "<%s(%r, %r)>" % (
            self.__class__.__name__,
            self.import_name,
            self.exception,
        )


from werkzeug import _DeprecatedImportModule

_DeprecatedImportModule(
    __name__,
    {
        ".datastructures": [
            "CombinedMultiDict",
            "EnvironHeaders",
            "Headers",
            "MultiDict",
        ],
        ".http": ["dump_cookie", "parse_cookie"],
    },
    "Werkzeug 1.0",
)
del _DeprecatedImportModule
示例#3
0
    elif length is None:
        return 0 <= start < stop
    elif start >= stop:
        return False
    return 0 <= start < length


# circular dependencies
from .datastructures import Accept
from .datastructures import Authorization
from .datastructures import ContentRange
from .datastructures import ETags
from .datastructures import HeaderSet
from .datastructures import IfRange
from .datastructures import Range
from .datastructures import RequestCacheControl
from .datastructures import TypeConversionDict
from .datastructures import WWWAuthenticate

from werkzeug import _DeprecatedImportModule

_DeprecatedImportModule(
    __name__,
    {
        ".datastructures":
        ["CharsetAccept", "Headers", "LanguageAccept", "MIMEAccept"]
    },
    "Werkzeug 1.0",
)
del _DeprecatedImportModule
    def __init__(self, environ_or_string):
        if isinstance(environ_or_string, dict):
            environ_or_string = environ_or_string.get("HTTP_USER_AGENT", "")
        self.string = environ_or_string
        self.platform, self.browser, self.version, self.language = self._parser(
            environ_or_string
        )

    def to_header(self):
        return self.string

    def __str__(self):
        return self.string

    def __nonzero__(self):
        return bool(self.browser)

    __bool__ = __nonzero__

    def __repr__(self):
        return "<%s %r/%s>" % (self.__class__.__name__, self.browser, self.version)


from werkzeug import _DeprecatedImportModule

_DeprecatedImportModule(
    __name__, {".wrappers.user_agent": ["UserAgentMixin"]}, "Werkzeug 1.0"
)
del _DeprecatedImportModule