Skip to content

Commit d8342a4

Browse files
committed
Adjust for removal of typing.ByteString in Python 3.14
`typing.ByteString` has been removed: https://docs.python.org/3.14/whatsnew/3.14.html The modernizing guide suggests `collections.abc.ByteString` which has also been removed; the recommendation is to use either: - just `bytes` - `collections.abc.Buffer` - a union of `bytes`, `bytesarray`, etc. https://typing.readthedocs.io/en/latest/guides/modernizing.html#modernizing-byte-string Per discussion, using `bytes` should suffice Signed-off-by: Michel Lind <[email protected]>
1 parent 7fda79d commit d8342a4

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

jc/parsers/pyedid/edid.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import struct
66
from collections import namedtuple
7-
from typing import ByteString
87

98
__all__ = ["Edid"]
109

@@ -108,10 +107,10 @@ class Edid:
108107
),
109108
)
110109

111-
def __init__(self, edid: ByteString):
110+
def __init__(self, edid: bytes):
112111
self._parse_edid(edid)
113112

114-
def _parse_edid(self, edid: ByteString):
113+
def _parse_edid(self, edid: bytes):
115114
"""Convert edid byte string to edid object"""
116115
if struct.calcsize(self._STRUCT_FORMAT) != 128:
117116
raise ValueError("Wrong edid size.")

jc/parsers/pyedid/helpers/edid_helper.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44

55
from subprocess import CalledProcessError, check_output
6-
from typing import ByteString, List
6+
from typing import List
77

88
__all__ = ["EdidHelper"]
99

@@ -12,14 +12,14 @@ class EdidHelper:
1212
"""Class for working with EDID data"""
1313

1414
@staticmethod
15-
def hex2bytes(hex_data: str) -> ByteString:
15+
def hex2bytes(hex_data: str) -> bytes:
1616
"""Convert hex EDID string to bytes
1717
1818
Args:
1919
hex_data (str): hex edid string
2020
2121
Returns:
22-
ByteString: edid byte string
22+
bytes: edid byte string
2323
"""
2424
# delete edid 1.3 additional block
2525
if len(hex_data) > 256:
@@ -32,14 +32,14 @@ def hex2bytes(hex_data: str) -> ByteString:
3232
return bytes(numbers)
3333

3434
@classmethod
35-
def get_edids(cls) -> List[ByteString]:
35+
def get_edids(cls) -> List[bytes]:
3636
"""Get edids from xrandr
3737
3838
Raises:
3939
`RuntimeError`: if error with retrieving xrandr util data
4040
4141
Returns:
42-
List[ByteString]: list with edids
42+
List[bytes]: list with edids
4343
"""
4444
try:
4545
output = check_output(["xrandr", "--verbose"])

0 commit comments

Comments
 (0)