Skip to content

Commit

Permalink
[FIX] Fixed use of in SIPMethod to be compatible with Python <3.12
Browse files Browse the repository at this point in the history
[FIX] Fixed flake8 and black issues
  • Loading branch information
tayler6000 committed Jan 27, 2024
1 parent 9def073 commit e5d1d16
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyVoIP/SIP/message/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def from_bytes(data: bytes) -> Union["SIPRequest", "SIPResponse"]:
raise SIPParseError(
f"SIP Version {start_line[2]} not compatible."
)
if start_line[0] not in SIPMethod:
if start_line[0] not in map(lambda x: str(x), list(SIPMethod)):
raise SIPParseError(
f"SIP Method `{start_line[0]}` not supported."
)
Expand Down
2 changes: 1 addition & 1 deletion pyVoIP/VoIP/call.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def receiver(self):
message = SIPMessage.from_bytes(data)
except SIPParseError:
continue
if type(message) is SIPResonse:
if type(message) is SIPResponse:
if message.status is ResponseCode.OK:
if self.state in [
CallState.DIALING,
Expand Down
2 changes: 1 addition & 1 deletion pyVoIP/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def debug(s, e=None):

# noqa because import will fail if debug is not defined
from pyVoIP.RTP import PayloadType # noqa: E402
from pyVoIP.SIP.message.message import SIPMethod
from pyVoIP.SIP.message.message import SIPMethod # noqa: E402

SIPCompatibleVersions = ["SIP/2.0"]
SIPCompatibleMethods = list(map(lambda x: str(x), list(SIPMethod)))
Expand Down
2 changes: 1 addition & 1 deletion pyVoIP/networking/sock.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import TYPE_CHECKING, List, Optional, Tuple, Union
from pyVoIP.types import KEY_PASSWORD, SOCKETS
from pyVoIP.SIP.message.message import SIPMessage, SIPResponse, SIPRequest
from pyVoIP.SIP.message.message import SIPMessage, SIPRequest
from pyVoIP.SIP.error import SIPParseError
from pyVoIP.networking.nat import NAT, AddressType
from pyVoIP.networking.transport import TransportMode
Expand Down
1 change: 1 addition & 0 deletions pyVoIP/regex.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
each search. This module holds all the compiled regex so it can be compiled
once on startup, then used directly later by other modules.
"""

import re


Expand Down

0 comments on commit e5d1d16

Please sign in to comment.