Skip to content

Commit 5ed63d4

Browse files
committed
fix: replace unknown 're.Pattern' class with typing one
1 parent e15e51b commit 5ed63d4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

schema_salad/rust_codegen.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from io import StringIO
1717
from pathlib import Path
1818
from time import sleep
19-
from typing import IO, Any, ClassVar, Optional, Union, cast
19+
from typing import IO, Any, ClassVar, Optional, Pattern, Union, cast
2020

2121
from . import _logger
2222
from .avro.schema import ArraySchema, EnumSchema
@@ -117,6 +117,7 @@ def to_rust_literal(value: Any) -> str:
117117

118118
def make_avro(items: MutableSequence[JsonDataType]) -> MutableSequence[NamedSchema]:
119119
"""Process a list of dictionaries to generate a list of Avro schemas."""
120+
120121
# Same as `from .utils import convert_to_dict`, which, however, is not public
121122
def convert_to_dict(j4: Any) -> Any:
122123
"""Convert generic Mapping objects to dicts recursively."""
@@ -200,7 +201,9 @@ class RustPathSegment:
200201
ident: RustIdent
201202
generics: RustGenerics = dataclasses.field(default_factory=tuple)
202203

203-
REX: ClassVar[re.Pattern[str]] = re.compile(r"^([a-zA-Z_]\w*)(?:<([ \w\t,'<>]+)>)?$")
204+
REX: ClassVar[Pattern[str]] = re.compile(
205+
r"^([a-zA-Z_]\w*)(?:<([ \w\t,'<>]+)>)?$"
206+
) # Using `re.Pattern[str]` raise CI build errors
204207

205208
def __str__(self) -> str:
206209
if not self.generics:

0 commit comments

Comments
 (0)