Skip to content

Commit 5784214

Browse files
committed
chore: cosmetic fixes
1 parent 7995785 commit 5784214

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

src/appier/http.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -935,29 +935,37 @@ def _async_netius(
935935
extra = dict()
936936

937937
def _on_init(protocol):
938-
callback_init and callback_init(protocol)
938+
if callback_init:
939+
callback_init(protocol)
939940

940941
def _on_open(protocol):
941-
callback_open and callback_open(protocol)
942+
if callback_open:
943+
callback_open(protocol)
942944

943945
def _on_close(protocol):
944-
callback and callback(None)
946+
if callback:
947+
callback(None)
945948

946949
def _on_headers(protocol, parser):
947-
callback_headers and callback_headers(parser.headers)
950+
if callback_headers:
951+
callback_headers(parser.headers)
948952

949953
def _on_data(protocol, parser, data):
950954
data = data
951-
data and buffer.append(data)
952-
callback_data and callback_data(data)
955+
if data:
956+
buffer.append(data)
957+
if callback_data:
958+
callback_data(data)
953959

954960
def _on_result(protocol, parser, result):
955-
callback_result and callback_result(result)
961+
if callback_result:
962+
callback_result(result)
956963

957964
def _callback(protocol, parser, message):
958965
result = netius.clients.HTTPProtocol.set_request(parser, buffer)
959966
response = netius.clients.HTTPClient.to_response(result)
960-
callback and callback(response)
967+
if callback:
968+
callback(response)
961969

962970
extra["callback"] = _callback
963971
extra["on_data"] = _on_data

0 commit comments

Comments
 (0)