Skip to content

Commit f3979ee

Browse files
committed
Remove _compat.py
1 parent 6425eef commit f3979ee

File tree

11 files changed

+19
-39
lines changed

11 files changed

+19
-39
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ You must see log lines like this:
914914

915915
Notice `curl` in-place of `::1` or `127.0.0.1` as client IP.
916916

917-
[![WARNING](https://img.shields.io/static/v1?label=Compatability&message=warning&color=red)](#programnameplugin) If `ProgramNamePlugin` doesn't work reliably on your operating system, kindly contribute by sending a pull request and/or open an issue. Thank you!!!
917+
[![WARNING](https://img.shields.io/static/v1?label=Compatibility&message=warning&color=red)](#programnameplugin) If `ProgramNamePlugin` does not work reliably on your operating system, kindly contribute by sending a pull request and/or open an issue. Thank you!!!
918918

919919
## HTTP Web Server Plugins
920920

proxy/common/_compat.py

Lines changed: 0 additions & 23 deletions
This file was deleted.

proxy/common/constants.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,17 @@
1313
import time
1414
import secrets
1515
import pathlib
16+
import platform
1617
import sysconfig
1718
import ipaddress
1819

1920
from typing import Any, List
2021

21-
from ._compat import IS_WINDOWS # noqa: WPS436
2222
from .version import __version__
2323

24+
SYS_PLATFORM = platform.system()
25+
IS_WINDOWS = SYS_PLATFORM == 'Windows'
26+
2427

2528
def _env_threadless_compliant() -> bool:
2629
"""Returns true for Python 3.8+ across all platforms

proxy/common/flag.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@
1919

2020
from typing import Optional, List, Any, cast
2121

22-
from ._compat import IS_WINDOWS # noqa: WPS436
2322
from .plugins import Plugins
2423
from .types import IpAddress
2524
from .utils import bytes_, is_py2, is_threadless, set_open_file_limit
2625
from .constants import COMMA, DEFAULT_DATA_DIRECTORY_PATH, DEFAULT_NUM_ACCEPTORS, DEFAULT_NUM_WORKERS
2726
from .constants import DEFAULT_DEVTOOLS_WS_PATH, DEFAULT_DISABLE_HEADERS, PY2_DEPRECATION_MESSAGE
2827
from .constants import PLUGIN_DASHBOARD, PLUGIN_DEVTOOLS_PROTOCOL, DEFAULT_MIN_COMPRESSION_LIMIT
2928
from .constants import PLUGIN_HTTP_PROXY, PLUGIN_INSPECT_TRAFFIC, PLUGIN_PAC_FILE
30-
from .constants import PLUGIN_WEB_SERVER, PLUGIN_PROXY_AUTH
29+
from .constants import PLUGIN_WEB_SERVER, PLUGIN_PROXY_AUTH, IS_WINDOWS
3130
from .logger import Logger
3231

3332
from .version import __version__

proxy/common/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323
from types import TracebackType
2424
from typing import Optional, Dict, Any, List, Tuple, Type, Callable
2525

26-
from ._compat import IS_WINDOWS # noqa: WPS436
27-
from .constants import HTTP_1_1, COLON, WHITESPACE, CRLF, DEFAULT_TIMEOUT, DEFAULT_THREADLESS
26+
from .constants import (
27+
HTTP_1_1, COLON, WHITESPACE, CRLF,
28+
DEFAULT_TIMEOUT, DEFAULT_THREADLESS, IS_WINDOWS,
29+
)
2830

2931
if not IS_WINDOWS:
3032
import resource

proxy/plugin/program_name.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
from typing import Any, Dict, Optional
1515

16-
from ..common._compat import IS_WINDOWS
1716
from ..common.utils import text_
17+
from ..common.constants import IS_WINDOWS
1818

1919
from ..http.parser import HttpParser
2020
from ..http.proxy import HttpProxyBasePlugin

tests/core/test_listener.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import pytest
1919

2020
from proxy.core.acceptor import Listener
21-
from proxy.common._compat import IS_WINDOWS # noqa: WPS436
21+
from proxy.common.constants import IS_WINDOWS
2222
from proxy.common.flag import FlagParser
2323

2424

tests/http/test_http2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
:copyright: (c) 2013-present by Abhinav Singh and contributors.
99
:license: BSD, see LICENSE for more details.
1010
"""
11-
import pytest
1211
import httpx
12+
import pytest
1313

14-
from proxy.common._compat import IS_WINDOWS # noqa: WPS436
14+
from proxy.common.constants import IS_WINDOWS
1515
from proxy import TestCase
1616

1717

tests/integration/test_integration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
1111
Test the simplest proxy use scenario for smoke.
1212
"""
13+
import pytest
14+
1315
from pathlib import Path
1416
from subprocess import check_output, Popen
1517
from typing import Generator, Any
1618

17-
import pytest
18-
19+
from proxy.common.constants import IS_WINDOWS
1920
from proxy.common.utils import get_available_port
20-
from proxy.common._compat import IS_WINDOWS # noqa: WPS436
2121

2222

2323
# FIXME: Ignore is necessary for as long as pytest hasn't figured out

tests/test_set_open_file_limit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import pytest
1515

16-
from proxy.common._compat import IS_WINDOWS # noqa: WPS436
16+
from proxy.common.constants import IS_WINDOWS
1717
from proxy.common.utils import set_open_file_limit
1818

1919
if not IS_WINDOWS:

0 commit comments

Comments
 (0)