Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 13, 2024
1 parent c35ca19 commit 338b8ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions SRT/netfunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ def _wait_until_complete(self, key: str, nwait: str) -> str:

nwait = netfunnel_resp.get("nwait") or "<unknown>"


print(f"대기인원: {nwait}명")

# 1 sec
Expand All @@ -136,7 +135,6 @@ def _wait_until_complete(self, key: str, nwait: str) -> str:
else:
return key


def _set_complete(self, key: str):
"""
NetFunnel 완료 요청을 보냅니다.
Expand All @@ -162,14 +160,17 @@ def _set_complete(self, key: str):

netfunnel_resp = NetFunnelResponse.parse(resp.text)
if netfunnel_resp.get("status") != self.WAIT_STATUS_PASS:
raise SRTNetFunnelError(f"Failed to complete NetFunnel: {netfunnel_resp}")
raise SRTNetFunnelError(
f"Failed to complete NetFunnel: {netfunnel_resp}"
)

except Exception as e:
raise SRTNetFunnelError(e) from e

def _get_timestamp_for_netfunnel(self):
return int(time.time() * 1000)


class NetFunnelResponse:
"""
Represents a NetFunnel response.
Expand Down Expand Up @@ -219,7 +220,9 @@ def parse(cls, response: str) -> "NetFunnelResponse":
results = top_level_key[len(cls.RESULT_KEY) + 1 :].strip("'").split(":")

if len(results) != 3:
raise SRTNetFunnelError(f"Invalid NetFunnel response format: {response}")
raise SRTNetFunnelError(
f"Invalid NetFunnel response format: {response}"
)

code, status, result = results
data["next_code"] = code # dunno what this is...
Expand All @@ -239,5 +242,3 @@ def get(self, key: str) -> None:

def __str__(self):
return self.response


2 changes: 1 addition & 1 deletion tests/test_netfunnel.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from SRT.netfunnel import NetFunnelHelper, SRTNetFunnelError, NetFunnelResponse
from SRT.netfunnel import NetFunnelHelper, NetFunnelResponse, SRTNetFunnelError


@pytest.fixture(scope="module")
Expand Down

0 comments on commit 338b8ff

Please sign in to comment.