Skip to content

Commit

Permalink
Ignore flake8 errors that are introduced deliberately by black (urlli…
Browse files Browse the repository at this point in the history
  • Loading branch information
RatanShreshtha authored and sethmlarson committed Jun 4, 2019
1 parent 5af3728 commit 663f82c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 14 deletions.
1 change: 1 addition & 0 deletions setup.cfg
@@ -1,4 +1,5 @@
[flake8]
ignore = E501, E203, W503, W504
exclude=./docs/conf.py,./src/urllib3/packages/*
max-line-length=99

Expand Down
6 changes: 3 additions & 3 deletions src/urllib3/connection.py
Expand Up @@ -412,9 +412,9 @@ def connect(self):
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,
Expand Down
4 changes: 2 additions & 2 deletions src/urllib3/contrib/pyopenssl.py
Expand Up @@ -187,7 +187,7 @@ def idna_encode(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:
Expand Down Expand Up @@ -349,7 +349,7 @@ def sendall(self, data):
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

Expand Down
4 changes: 1 addition & 3 deletions src/urllib3/contrib/securetransport.py
Expand Up @@ -616,9 +616,7 @@ def send(self, data):
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):
Expand Down
4 changes: 2 additions & 2 deletions src/urllib3/util/url.py
Expand Up @@ -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"):
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions test/test_response.py
Expand Up @@ -440,7 +440,7 @@ class MockCompressedDataReading(BytesIO):

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)
]

Expand Down Expand Up @@ -633,7 +633,7 @@ def stream():
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)
Expand Down Expand Up @@ -801,7 +801,7 @@ def stream():
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)
Expand Down Expand Up @@ -862,7 +862,7 @@ def pop_current_chunk(self, amt=-1, till_crlf=False):
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
Expand Down

0 comments on commit 663f82c

Please sign in to comment.