Skip to content

Commit

Permalink
Remove Python 2.x compatibility from socket client (#801)
Browse files Browse the repository at this point in the history
* Remove Python 2.x compatibility from socket client

* Update socket_client.py
  • Loading branch information
emontnemery authored Jan 26, 2024
1 parent fe94dc5 commit 1db02c4
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions pychromecast/socket_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import select
import socket
import ssl
import sys
import threading
import time
from collections import defaultdict
Expand Down Expand Up @@ -106,17 +105,9 @@ def _message_to_string(message, data=None):
)


if sys.version_info >= (3, 0):

def _json_to_payload(data):
"""Encodes a python value into JSON format."""
return json.dumps(data, ensure_ascii=False).encode("utf8")

else:

def _json_to_payload(data):
"""Encodes a python value into JSON format."""
return json.dumps(data, ensure_ascii=False)
def _json_to_payload(data: dict) -> bytes:
"""Encodes a python value into JSON format."""
return json.dumps(data, ensure_ascii=False).encode("utf8")


@dataclass(frozen=True)
Expand Down

0 comments on commit 1db02c4

Please sign in to comment.