Skip to content

Commit

Permalink
refactor!: enhance avro mod typings (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
benbenbang authored Aug 27, 2023
1 parent 6a8a801 commit 08f99cd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
12 changes: 6 additions & 6 deletions confluent_kafka-stubs/avro/cached_schema_registry_client.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ from __future__ import annotations
# standard library
from logging import Logger
from pathlib import Path
from typing import TYPE_CHECKING, DefaultDict, Literal
from typing import TYPE_CHECKING, ClassVar, DefaultDict, Literal

from .error import ClientError as ClientError
from .load import loads as loads
Expand All @@ -28,11 +28,11 @@ ACCEPT_HDR: str
log: Logger

class CachedSchemaRegistryClient:
url: str | dict
subject_to_schema_ids: DefaultDict[str, dict]
id_to_schema: DefaultDict[str, dict]
subject_to_schema_versions: DefaultDict[str, dict]
auto_register_schemas: bool
url: ClassVar[str | dict]
subject_to_schema_ids: ClassVar[DefaultDict[str, dict]]
id_to_schema: ClassVar[DefaultDict[str, dict]]
subject_to_schema_versions: ClassVar[DefaultDict[str, dict]]
auto_register_schemas: ClassVar[bool]

def __init__(
self,
Expand Down
2 changes: 0 additions & 2 deletions confluent_kafka-stubs/avro/error.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ from typing import ClassVar
from ..cimpl import Message

class ClientError(Exception):
"""Error thrown by Schema Registry clients"""

message: ClassVar[Message]
http_code: ClassVar[int]

Expand Down
12 changes: 6 additions & 6 deletions confluent_kafka-stubs/avro/serializer/message_serializer.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ from __future__ import annotations
# standard library
from io import BytesIO
from logging import Logger
from typing import TYPE_CHECKING, Any, Callable
from typing import TYPE_CHECKING, Any, Callable, ClassVar

from ...schema_registry.schema_registry_client import SchemaRegistryClient
from .. import ClientError as ClientError
Expand All @@ -33,11 +33,11 @@ class ContextStringIO(BytesIO):
def __exit__(self, *args): ...

class MessageSerializer:
registry_client: SchemaRegistryClient
id_to_decoder_func: dict[int, Callable]
id_to_writers: dict[int, bytes]
reader_key_schema: str | bytes | None = None
reader_value_schema: str | bytes | None = None
registry_client: ClassVar[SchemaRegistryClient]
id_to_decoder_func: ClassVar[dict[int, Callable]]
id_to_writers: ClassVar[dict[int, bytes]]
reader_key_schema: ClassVar[str | bytes | None]
reader_value_schema: ClassVar[str | bytes | None]

def __init__(
self,
Expand Down

0 comments on commit 08f99cd

Please sign in to comment.