Ignore flake8 errors that are introduced deliberately by black
MODIFY
setup.cfg
setup.cfg
[flake8]
+ignore = E501, E203, W503, W504
exclude=./docs/conf.py,./src/urllib3/packages/*
max-line-length=99

MODIFY
src/urllib3/connection.py
src/urllib3/connection.py
@@ -412,9 +412,9 @@ class VerifiedHTTPSConnection(HTTPSConnection):
if not cert.get("subjectAltName", ()):
warnings.warn(
(
- "Certificate for {0} has no `subjectAltName`, falling back to check for a " # noqa
- "`commonName` for now. This feature is being removed by major browsers and " # noqa
- "deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 " # noqa
+ "Certificate for {0} has no `subjectAltName`, falling back to check for a "
+ "`commonName` for now. This feature is being removed by major browsers and "
+ "deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 "
"for details.)".format(hostname)
),
SubjectAltNameWarning,

MODIFY
src/urllib3/contrib/pyopenssl.py
src/urllib3/contrib/pyopenssl.py
@@ -187,7 +187,7 @@ def _dnsname_to_stdlib(name):
try:
for prefix in [u"*.", u"."]:
if name.startswith(prefix):
- name = name[len(prefix) :] # noqa
+ name = name[len(prefix) :]
return prefix.encode("ascii") + idna.encode(name)
return idna.encode(name)
except idna.core.IDNAError:
@@ -349,7 +349,7 @@ class WrappedSocket(object):
total_sent = 0
while total_sent < len(data):
sent = self._send_until_done(
- data[total_sent : total_sent + SSL_WRITE_BLOCKSIZE] # noqa
+ data[total_sent : total_sent + SSL_WRITE_BLOCKSIZE]
)
total_sent += sent

MODIFY
src/urllib3/contrib/securetransport.py
src/urllib3/contrib/securetransport.py
@@ -616,9 +616,7 @@ class WrappedSocket(object):
def sendall(self, data):
total_sent = 0
while total_sent < len(data):
- sent = self.send(
- data[total_sent : total_sent + SSL_WRITE_BLOCKSIZE] # noqa
- )
+ sent = self.send(data[total_sent : total_sent + SSL_WRITE_BLOCKSIZE])
total_sent += sent
def shutdown(self):

MODIFY
src/urllib3/util/url.py
src/urllib3/util/url.py
@@ -149,7 +149,7 @@ def split_first(s, delims):
if min_idx is None or min_idx < 0:
return s, "", None
- return s[:min_idx], s[min_idx + 1 :], min_delim # noqa
+ return s[:min_idx], s[min_idx + 1 :], min_delim
def _encode_invalid_chars(component, allowed_chars, encoding="utf-8"):
@@ -173,7 +173,7 @@ def _encode_invalid_chars(component, allowed_chars, encoding="utf-8"):
for i in range(0, len(uri_bytes)):
# Will return a single character bytestring on both Python 2 & 3
- byte = uri_bytes[i : i + 1] # noqa
+ byte = uri_bytes[i : i + 1]
byte_ord = ord(byte)
if (is_percent_encoded and byte == b"%") or (
byte_ord < 128 and byte.decode() in allowed_chars

MODIFY
test/test_response.py
test/test_response.py
@@ -440,7 +440,7 @@ class TestResponse(object):
def __init__(self, payload, payload_part_size):
self.payloads = [
- payload[i * payload_part_size : (i + 1) * payload_part_size] # noqa
+ payload[i * payload_part_size : (i + 1) * payload_part_size]
for i in range(NUMBER_OF_READS + 1)
]
@@ -633,7 +633,7 @@ class TestResponse(object):
data = compress.compress(b"foobar")
data += compress.flush()
for i in range(0, len(data), 2):
- yield data[i : i + 2] # noqa
+ yield data[i : i + 2]
fp = MockChunkedEncodingResponse(list(stream()))
r = httplib.HTTPResponse(MockSock)
@@ -801,7 +801,7 @@ class TestResponse(object):
data = compress.compress(b"foo\nbar")
data += compress.flush()
for i in range(0, len(data), 2):
- yield data[i : i + 2] # noqa
+ yield data[i : i + 2]
fp = MockChunkedEncodingResponse(list(stream()))
r = httplib.HTTPResponse(MockSock)
@@ -862,7 +862,7 @@ class MockChunkedEncodingResponse(object):
return b""
else:
chunk_part = self.cur_chunk[: i + 2]
- self.cur_chunk = self.cur_chunk[i + 2 :] # noqa
+ self.cur_chunk = self.cur_chunk[i + 2 :]
return chunk_part
elif amt <= -1:
chunk_part = self.cur_chunk

Ignore flake8 errors that are introduced deliberately by black (#1631)