Skip to content

Commit 0b130d2

Browse files
committed
Fix some misplaced parenthesis and spacing
1 parent 7375c2c commit 0b130d2

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

cheroot/server.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"""
6262

6363
from __future__ import absolute_import, division, print_function
64+
6465
__metaclass__ = type
6566

6667
import os
@@ -91,19 +92,16 @@
9192
from .workers import threadpool
9293
from .makefile import MakeFile, StreamWriter
9394

94-
9595
__all__ = (
9696
'HTTPRequest', 'HTTPConnection', 'HTTPServer',
9797
'HeaderReader', 'DropUnderscoreHeaderReader',
9898
'SizeCheckWrapper', 'KnownLengthRFile', 'ChunkedRFile',
9999
'Gateway', 'get_ssl_adapter_class',
100100
)
101101

102-
103102
IS_WINDOWS = platform.system() == 'Windows'
104103
"""Flag indicating whether the app is running under Windows."""
105104

106-
107105
IS_GAE = os.getenv('SERVER_SOFTWARE', '').startswith('Google App Engine/')
108106
"""Flag indicating whether the app is running in GAE env.
109107
@@ -112,11 +110,9 @@
112110
/using-local-server#detecting_application_runtime_environment
113111
"""
114112

115-
116113
IS_UID_GID_RESOLVABLE = not IS_WINDOWS and not IS_GAE
117114
"""Indicates whether UID/GID resolution's available under current platform."""
118115

119-
120116
if IS_UID_GID_RESOLVABLE:
121117
try:
122118
import grp
@@ -131,14 +127,12 @@
131127
grp, pwd = None, None
132128
import struct
133129

134-
135130
if IS_WINDOWS and hasattr(socket, 'AF_INET6'):
136131
if not hasattr(socket, 'IPPROTO_IPV6'):
137132
socket.IPPROTO_IPV6 = 41
138133
if not hasattr(socket, 'IPV6_V6ONLY'):
139134
socket.IPV6_V6ONLY = 27
140135

141-
142136
if not hasattr(socket, 'SO_PEERCRED'):
143137
"""
144138
NOTE: the value for SO_PEERCRED can be architecture specific, in
@@ -147,7 +141,6 @@
147141
"""
148142
socket.SO_PEERCRED = 21 if IS_PPC else 17
149143

150-
151144
LF = b'\n'
152145
CRLF = b'\r\n'
153146
TAB = b'\t'
@@ -160,7 +153,6 @@
160153
QUOTED_SLASH = b'%2F'
161154
QUOTED_SLASH_REGEX = re.compile(b''.join((b'(?i)', QUOTED_SLASH)))
162155

163-
164156
comma_separated_headers = [
165157
b'Accept', b'Accept-Charset', b'Accept-Encoding',
166158
b'Accept-Language', b'Accept-Ranges', b'Allow', b'Cache-Control',
@@ -170,7 +162,6 @@
170162
b'WWW-Authenticate',
171163
]
172164

173-
174165
if not hasattr(logging, 'statistics'):
175166
logging.statistics = {}
176167

@@ -533,7 +524,7 @@ def _fetch(self):
533524
raise ValueError(
534525
'Bad chunked transfer size: {chunk_size!r}'.
535526
format(chunk_size=chunk_size),
536-
)
527+
)
537528

538529
if chunk_size <= 0:
539530
self._read_trailers()
@@ -555,7 +546,7 @@ def _fetch(self):
555546
raise ValueError(
556547
"Bad chunked transfer coding (expected '\\r\\n', "
557548
'got ' + repr(crlf) + ')',
558-
)
549+
)
559550

560551
def read(self, size=None):
561552
"""Read a chunk from ``rfile`` buffer and return it.
@@ -793,7 +784,7 @@ def parse_request(self):
793784
self.inheaders[header[0]] = header[1]
794785

795786
if (b'transfer-encoding' in self.inheaders and
796-
self.inheaders[b'transfer-encoding'].lower() == b"chunked"):
787+
self.inheaders[b'transfer-encoding'].lower() == b"chunked"):
797788
self.chunked_read = True
798789

799790
uri_is_absolute_form = scheme or authority
@@ -1020,7 +1011,6 @@ def send_headers(self):
10201011
self.conn.wfile.write(res_bytes)
10211012

10221013

1023-
10241014
class HTTPConnection:
10251015
"""An HTTP connection (active socket)."""
10261016

@@ -1101,7 +1091,7 @@ def communicate(self):
11011091
self.server.error_log(
11021092
'socket.error %s' % repr(errnum),
11031093
level=logging.WARNING, traceback=True,
1104-
)
1094+
)
11051095
self._conditional_error(req, '500 Internal Server Error')
11061096
except (KeyboardInterrupt, SystemExit):
11071097
raise

0 commit comments

Comments
 (0)