Skip to content

Commit 2f97a49

Browse files
committed
Enable isort in the pre-commit tool settings
1 parent 2b3f0cb commit 2f97a49

File tree

131 files changed

+461
-503
lines changed

Some content is hidden

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

131 files changed

+461
-503
lines changed

.flake8

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ extend-exclude =
2828
# IMPORTANT: avoid using ignore option, always use extend-ignore instead
2929
# Completely and unconditionally ignore the following errors:
3030
extend-ignore =
31-
I # flake8-isort is drunk + we have isort integrated into pre-commit
3231
B009 # FIXME: `getattr()` called with a constant arg
3332
C812 # FIXME: missing trailing comma
3433
C819 # FIXME: inline trailing comma

.isort.cfg

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
line_length = 127
16+
lines_after_imports = 2
17+
# https://pycqa.github.io/isort/docs/configuration/multi_line_output_modes.html
18+
# NOTE: Another mode could be "5" for grouping multiple "import from" under
19+
# NOTE: a single instruction.
20+
multi_line_output = 9
21+
no_lines_before = LOCALFOLDER
22+
sections=FUTURE,STDLIB,TESTING,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
23+
# skip=file3.py,file4.py
24+
use_parentheses = true
25+
verbose = true

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ repos:
77
args:
88
- --py36-plus
99

10-
# - repo: https://github.com/timothycrosley/isort.git
11-
# rev: 5.4.2
12-
# hooks:
13-
# - id: isort
14-
# args:
15-
# - --honor-noqa
10+
- repo: https://github.com/timothycrosley/isort.git
11+
rev: 5.10.0
12+
hooks:
13+
- id: isort
14+
args:
15+
- --honor-noqa
1616

1717
- repo: https://github.com/Lucas-C/pre-commit-hooks.git
1818
rev: v1.1.7

check.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
:copyright: (c) 2013-present by Abhinav Singh and contributors.
99
:license: BSD, see LICENSE for more details.
1010
"""
11-
import sys
1211
import subprocess
13-
12+
import sys
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: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@
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
1615
from proxy.common.utils import build_http_response
16+
from proxy.core.base import BaseTcpTunnelHandler
1717
from proxy.http import httpStatusCodes
1818
from proxy.http.parser import httpParserStates
19-
from proxy.core.base import BaseTcpTunnelHandler
2019

2120

2221
class HttpsConnectTunnelHandler(BaseTcpTunnelHandler):

examples/pubsub_eventing.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
:copyright: (c) 2013-present by Abhinav Singh and contributors.
99
:license: BSD, see LICENSE for more details.
1010
"""
11-
import time
12-
import multiprocessing
1311
import logging
14-
15-
from typing import Dict, Any, Optional
12+
import multiprocessing
13+
import time
14+
from typing import Any, Dict, Optional
1615

1716
from proxy.common.constants import DEFAULT_LOG_FORMAT
1817
from proxy.core.event import EventManager, EventQueue, EventSubscriber, eventNames
1918

19+
2020
logging.basicConfig(level=logging.DEBUG, format=DEFAULT_LOG_FORMAT)
2121

2222
logger = logging.getLogger(__name__)

examples/ssl_echo_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
"""
1111
import logging
1212

13-
from proxy.core.connection import TcpServerConnection
1413
from proxy.common.constants import DEFAULT_BUFFER_SIZE
14+
from proxy.core.connection import TcpServerConnection
15+
1516

1617
logger = logging.getLogger(__name__)
1718

examples/ssl_echo_server.py

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

1414
from proxy import Proxy
1515
from proxy.common.utils import wrap_socket
16-
from proxy.core.connection import TcpClientConnection
17-
1816
from proxy.core.base import BaseTcpServerHandler
17+
from proxy.core.connection import TcpClientConnection
1918

2019

2120
class EchoSSLServerHandler(BaseTcpServerHandler):

examples/tcp_echo_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
"""
1111
import logging
1212

13-
from proxy.common.utils import socket_connection
1413
from proxy.common.constants import DEFAULT_BUFFER_SIZE
14+
from proxy.common.utils import socket_connection
15+
1516

1617
logger = logging.getLogger(__name__)
1718

examples/web_scraper.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88
:copyright: (c) 2013-present by Abhinav Singh and contributors.
99
:license: BSD, see LICENSE for more details.
1010
"""
11-
import time
1211
import socket
13-
12+
import time
1413
from typing import Dict
1514

1615
from proxy import Proxy
17-
from proxy.core.acceptor import Work
1816
from proxy.common.types import Readables, Writables
17+
from proxy.core.acceptor import Work
1918

2019

2120
class WebScraper(Work):

0 commit comments

Comments
 (0)