Skip to content

Commit 35e9c57

Browse files
authored
isort everything except lib (for now) (#952)
* isort the tests folder * Carry over changes from #672 * Disable pre-commit * Revert flake8 config change * isort examples too
1 parent 9344a54 commit 35e9c57

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+209
-160
lines changed

.isort.cfg

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# https://github.com/timothycrosley/isort/wiki/isort-Settings
2+
[settings]
3+
default_section = THIRDPARTY
4+
# force_to_top=file1.py,file2.py
5+
# forced_separate = django.contrib,django.utils
6+
include_trailing_comma = true
7+
indent = 4
8+
known_first_party = proxy
9+
# known_future_library = future,pies
10+
# known_standard_library = std,std2
11+
known_testing = pytest,unittest
12+
length_sort = 1
13+
# Should be: 80 - 1
14+
line_length = 79
15+
lines_after_imports = 2
16+
# https://pycqa.github.io/isort/docs/configuration/multi_line_output_modes.html
17+
# NOTE: Another mode could be "5" for grouping multiple "import from" under
18+
# NOTE: a single instruction.
19+
multi_line_output = 5
20+
no_lines_before = LOCALFOLDER
21+
sections=FUTURE,STDLIB,TESTING,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
22+
# skip=file3.py,file4.py
23+
use_parentheses = true
24+
verbose = true

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repos:
88
- --py36-plus
99

1010
# - repo: https://github.com/timothycrosley/isort.git
11-
# rev: 5.4.2
11+
# rev: 5.10.0
1212
# hooks:
1313
# - id: isort
1414
# args:

check.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
"""
1111
import sys
1212
import subprocess
13-
1413
from pathlib import Path
14+
1515
from proxy.common.version import __version__ as lib_version
1616

17+
1718
# This script ensures our versions never run out of sync.
1819
#
1920
# 1. TODO: Version is hardcoded in homebrew stable package

examples/https_connect_tunnel.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,14 @@
99
:license: BSD, see LICENSE for more details.
1010
"""
1111
import time
12-
1312
from typing import Any, Optional
1413

1514
from proxy import Proxy
16-
15+
from proxy.core.base import BaseTcpTunnelHandler
1716
from proxy.http.responses import (
18-
PROXY_TUNNEL_ESTABLISHED_RESPONSE_PKT,
19-
PROXY_TUNNEL_UNSUPPORTED_SCHEME,
17+
PROXY_TUNNEL_UNSUPPORTED_SCHEME, PROXY_TUNNEL_ESTABLISHED_RESPONSE_PKT,
2018
)
2119

22-
from proxy.core.base import BaseTcpTunnelHandler
23-
2420

2521
class HttpsConnectTunnelHandler(BaseTcpTunnelHandler):
2622
"""A https CONNECT tunnel."""

examples/pubsub_eventing.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
:license: BSD, see LICENSE for more details.
1010
"""
1111
import time
12-
import multiprocessing
1312
import logging
13+
import multiprocessing
14+
from typing import Any, Dict, Optional
1415

15-
from typing import Dict, Any, Optional
16-
16+
from proxy.core.event import (
17+
EventQueue, EventManager, EventSubscriber, eventNames,
18+
)
1719
from proxy.common.constants import DEFAULT_LOG_FORMAT
18-
from proxy.core.event import EventManager, EventQueue, EventSubscriber, eventNames
20+
1921

2022
logging.basicConfig(level=logging.DEBUG, format=DEFAULT_LOG_FORMAT)
2123

examples/ssl_echo_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from proxy.core.connection import TcpServerConnection
1414
from proxy.common.constants import DEFAULT_BUFFER_SIZE
1515

16+
1617
logger = logging.getLogger(__name__)
1718

1819
if __name__ == '__main__':

examples/ssl_echo_server.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
from typing import Optional
1313

1414
from proxy import Proxy
15+
from proxy.core.base import BaseTcpServerHandler
1516
from proxy.common.utils import wrap_socket
1617
from proxy.core.connection import TcpClientConnection
1718

18-
from proxy.core.base import BaseTcpServerHandler
19-
2019

2120
class EchoSSLServerHandler(BaseTcpServerHandler):
2221
"""Wraps client socket during initialization."""

examples/tcp_echo_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from proxy.common.utils import socket_connection
1414
from proxy.common.constants import DEFAULT_BUFFER_SIZE
1515

16+
1617
logger = logging.getLogger(__name__)
1718

1819
if __name__ == '__main__':

examples/web_scraper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
import time
1212

1313
from proxy import Proxy
14+
from proxy.common.types import Readables, Writables, SelectableEvents
1415
from proxy.core.acceptor import Work
1516
from proxy.core.connection import TcpClientConnection
16-
from proxy.common.types import Readables, SelectableEvents, Writables
1717

1818

1919
class WebScraper(Work[TcpClientConnection]):

examples/websocket_client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
import time
1212
import logging
1313

14-
from proxy.http.websocket import WebsocketClient, WebsocketFrame, websocketOpcodes
14+
from proxy.http.websocket import (
15+
WebsocketFrame, WebsocketClient, websocketOpcodes,
16+
)
17+
1518

1619
# globals
1720
client: WebsocketClient

0 commit comments

Comments
 (0)