diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b995b7f..674760f 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -25,6 +25,7 @@ jobs: - '3.11' - '3.12' - '3.13' + - '3.14-dev' steps: - name: "🗃 Cache" diff --git a/pure_protobuf/descriptors/record.py b/pure_protobuf/descriptors/record.py index eda3322..245c72f 100644 --- a/pure_protobuf/descriptors/record.py +++ b/pure_protobuf/descriptors/record.py @@ -1,6 +1,5 @@ from __future__ import annotations -from collections.abc import ByteString, Mapping from dataclasses import dataclass from enum import IntEnum from types import GenericAlias @@ -71,7 +70,7 @@ class RecordDescriptor(Generic[RecordT]): merge: Merge[RecordT] = MergeLastOneWins() """Merge two values of the same field from different messages. Only called in a message merger.""" - __PREDEFINED__: ClassVar[Mapping[Any, RecordDescriptor]] + __PREDEFINED__: ClassVar[dict[Any, RecordDescriptor]] """Pre-defined descriptors for primitive types.""" @classmethod @@ -176,7 +175,6 @@ def _from_inner_type_hint( bool: BOOL_DESCRIPTOR, bytes: BYTES_DESCRIPTOR, bytearray: BYTES_DESCRIPTOR, - ByteString: BYTES_DESCRIPTOR, fixed32: UNSIGNED_INT32_DESCRIPTOR, fixed64: UNSIGNED_INT64_DESCRIPTOR, float: FLOAT_DESCRIPTOR, @@ -206,3 +204,10 @@ def _from_inner_type_hint( read=ReadMaybePacked[int](ReadCallback(ReadZigZagVarint()), WireType.VARINT), ), } + +try: + from collections.abc import ByteString +except ImportError: + pass +else: + RecordDescriptor.__PREDEFINED__[ByteString] = BYTES_DESCRIPTOR diff --git a/pyproject.toml b/pyproject.toml index 604e4e1..c0c6fe7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -95,7 +95,7 @@ exclude_lines = [ [tool.black] line-length = 120 -target-version = ["py39", "py310", "py311", "py312", "py313"] +target-version = ["py39", "py310", "py311", "py312", "py313", "py314"] [tool.ruff] line-length = 120 @@ -148,9 +148,7 @@ ignore = [ "PT013", "RET505", "TRY003", - "UP006", # 3.9 "UP007", # 3.10 - "UP033", # 3.9 ] [tool.ruff.lint.per-file-ignores]