mirror of
https://github.com/frappe/gunicorn.git
synced 2026-07-01 18:21:30 +08:00
Fix pylint issues in HTTP/2 module
- Add pylint disable comments for global-statement in lazy import pattern - Remove unnecessary pass statements in error subclasses - Remove useless return None at end of _handle_request_received methods
This commit is contained in:
parent
9306db1d20
commit
ed94da449c
@ -22,7 +22,7 @@ def is_http2_available():
|
||||
Returns:
|
||||
bool: True if the h2 library is installed with minimum required version.
|
||||
"""
|
||||
global _h2_available, _h2_version
|
||||
global _h2_available, _h2_version # pylint: disable=global-statement
|
||||
|
||||
if _h2_available is not None:
|
||||
return _h2_available
|
||||
|
||||
@ -30,7 +30,7 @@ _h2_settings = None
|
||||
|
||||
def _import_h2():
|
||||
"""Lazily import h2 library components."""
|
||||
global _h2, _h2_config, _h2_events, _h2_exceptions, _h2_settings
|
||||
global _h2, _h2_config, _h2_events, _h2_exceptions, _h2_settings # pylint: disable=global-statement
|
||||
|
||||
if _h2 is not None:
|
||||
return
|
||||
@ -215,7 +215,6 @@ class AsyncHTTP2Connection:
|
||||
|
||||
# Process headers
|
||||
stream.receive_headers(headers, end_stream=False)
|
||||
return None
|
||||
|
||||
def _handle_data_received(self, event):
|
||||
"""Handle DataReceived event."""
|
||||
|
||||
@ -29,7 +29,7 @@ _h2_settings = None
|
||||
|
||||
def _import_h2():
|
||||
"""Lazily import h2 library components."""
|
||||
global _h2, _h2_config, _h2_events, _h2_exceptions, _h2_settings
|
||||
global _h2, _h2_config, _h2_events, _h2_exceptions, _h2_settings # pylint: disable=global-statement
|
||||
|
||||
if _h2 is not None:
|
||||
return
|
||||
@ -203,9 +203,6 @@ class HTTP2ServerConnection:
|
||||
|
||||
Args:
|
||||
event: RequestReceived event with headers
|
||||
|
||||
Returns:
|
||||
HTTP2Request if stream ended with headers, None otherwise
|
||||
"""
|
||||
stream_id = event.stream_id
|
||||
headers = event.headers
|
||||
@ -215,12 +212,9 @@ class HTTP2ServerConnection:
|
||||
self.streams[stream_id] = stream
|
||||
|
||||
# Process headers
|
||||
# The StreamEnded event will come separately for GET/HEAD with no body
|
||||
stream.receive_headers(headers, end_stream=False)
|
||||
|
||||
# Check if this was a GET/HEAD with no body
|
||||
# The StreamEnded event will come separately
|
||||
return None
|
||||
|
||||
def _handle_data_received(self, event):
|
||||
"""Handle DataReceived event.
|
||||
|
||||
|
||||
@ -114,14 +114,10 @@ class HTTP2StreamError(HTTP2Error):
|
||||
class HTTP2ConnectionError(HTTP2Error):
|
||||
"""Error affecting the entire connection."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class HTTP2ConfigurationError(HTTP2Error):
|
||||
"""Invalid HTTP/2 configuration."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class HTTP2NotAvailable(HTTP2Error):
|
||||
"""HTTP/2 support is not available (h2 library not installed)."""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user