2021-11-14 05:13:20 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
proxy.py
|
|
|
|
~~~~~~~~
|
|
|
|
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on
|
|
|
|
Network monitoring, controls & Application development, testing, debugging.
|
2021-11-13 21:16:07 +00:00
|
|
|
|
2021-11-14 05:13:20 +00:00
|
|
|
:copyright: (c) 2013-present by Abhinav Singh and contributors.
|
|
|
|
:license: BSD, see LICENSE for more details.
|
|
|
|
|
|
|
|
Version definition.
|
|
|
|
"""
|
2021-11-14 10:12:54 +00:00
|
|
|
from typing import Tuple, Union
|
|
|
|
|
2021-11-13 21:16:07 +00:00
|
|
|
try:
|
|
|
|
# pylint: disable=unused-import
|
2021-11-14 10:12:54 +00:00
|
|
|
from ._scm_version import version as __version__, version_tuple as _ver_tup # noqa: WPS433, WPS436
|
2021-11-13 21:16:07 +00:00
|
|
|
except ImportError:
|
|
|
|
from pkg_resources import get_distribution as _get_dist # noqa: WPS433
|
|
|
|
__version__ = _get_dist('proxy.py').version # noqa: WPS440
|
|
|
|
|
|
|
|
|
2021-11-14 10:12:54 +00:00
|
|
|
def _to_int_or_str(inp: str) -> Union[int, str]:
|
|
|
|
try:
|
|
|
|
return int(inp)
|
|
|
|
except ValueError:
|
|
|
|
return inp
|
|
|
|
|
|
|
|
|
|
|
|
def _split_version_parts(inp: str) -> Tuple[str, ...]:
|
|
|
|
public_version, _plus, local_version = inp.partition('+')
|
|
|
|
return (*public_version.split('.'), local_version)
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
VERSION = _ver_tup
|
|
|
|
except NameError:
|
|
|
|
VERSION = tuple(
|
|
|
|
map(_to_int_or_str, _split_version_parts(__version__)),
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
__all__ = '__version__', 'VERSION'
|