Skip to content

Commit

Permalink
feat: implement avro load schema funcs typings (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
benbenbang authored Aug 20, 2023
1 parent 98717e0 commit 7bdb90a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions confluent_kafka-stubs/avro/load.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,27 @@
types-confluent-kafka: A package providing type hints for the confluent-kafka Python package.
This package is licensed under the Apache 2.0 License.
"""

# standard library
from pathlib import Path
from typing import TYPE_CHECKING

# pypi/conda library
from confluent_kafka.avro.error import ClientError as ClientError

if TYPE_CHECKING:
"""Helping users who installed avro package can get type hints"""
try:
# pypi/conda library
from avro.schema import Schema # pyright: ignore # this cannot be resolved if avro isn't installed
except ImportError:
# standard library
from typing import Any as Schema

def loads(schema_str: str) -> "Schema":
"""Parse a schema given a schema string"""
...

def load(fp: str | Path) -> "Schema":
"""Parse a schema from a file path"""
...

0 comments on commit 7bdb90a

Please sign in to comment.