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
|
|
|
|
|
2022-01-20 10:04:54 +00:00
|
|
|
|
2021-11-13 21:16:07 +00:00
|
|
|
try:
|
|
|
|
# pylint: disable=unused-import
|
2022-01-20 10:04:54 +00:00
|
|
|
from ._scm_version import version as __version__ # noqa: WPS433, WPS436
|
|
|
|
from ._scm_version import version_tuple as _ver_tup # noqa: WPS433, WPS436
|
2022-01-14 09:43:14 +00:00
|
|
|
except ImportError: # pragma: no cover
|
2021-11-13 21:16:07 +00:00
|
|
|
from pkg_resources import get_distribution as _get_dist # noqa: WPS433
|
|
|
|
__version__ = _get_dist('proxy.py').version # noqa: WPS440
|
|
|
|
|
|
|
|
|
2022-01-14 09:43:14 +00:00
|
|
|
def _to_int_or_str(inp: str) -> Union[int, str]: # pragma: no cover
|
2021-11-14 10:12:54 +00:00
|
|
|
try:
|
|
|
|
return int(inp)
|
|
|
|
except ValueError:
|
|
|
|
return inp
|
|
|
|
|
|
|
|
|
2022-01-14 09:43:14 +00:00
|
|
|
def _split_version_parts(inp: str) -> Tuple[str, ...]: # pragma: no cover
|
2021-11-14 10:12:54 +00:00
|
|
|
public_version, _plus, local_version = inp.partition('+')
|
|
|
|
return (*public_version.split('.'), local_version)
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
VERSION = _ver_tup
|
2022-01-14 09:43:14 +00:00
|
|
|
except NameError: # pragma: no cover
|
2021-11-14 10:12:54 +00:00
|
|
|
VERSION = tuple(
|
|
|
|
map(_to_int_or_str, _split_version_parts(__version__)),
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
__all__ = '__version__', 'VERSION'
|