Skip to content

Commit

Permalink
AVRO-2921: Add Type Hints to avro.io
Browse files Browse the repository at this point in the history
  • Loading branch information
kojiromike committed Jun 1, 2021
1 parent f51e859 commit 5aca8e2
Show file tree
Hide file tree
Showing 4 changed files with 231 additions and 189 deletions.
2 changes: 2 additions & 0 deletions lang/py/avro/datafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@ def __next__(self) -> Any:
raise StopIteration
self._read_block_header()

if self.datum_decoder is None:
raise avro.errors.UninitializedDataFileException
datum = self.datum_reader.read(self.datum_decoder)
self.block_count -= 1
return datum
Expand Down
8 changes: 8 additions & 0 deletions lang/py/avro/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,11 @@ class UsageError(RuntimeError, AvroException):

class AvroRuntimeException(RuntimeError, AvroException):
"""Raised when compatibility parsing encounters an unknown type"""


class UninitializedDataFileException(AvroException):
"""Raised when attempting to use a DataFile without a datum decoder."""


class UninitializedDatumIOException(AvroException):
"""Raised when attempting to use a DatumReader or DatumWriter without a schema."""
Loading

0 comments on commit 5aca8e2

Please sign in to comment.