titus.datatype.AvroType

class titus.datatype.AvroType[source]

Bases: titus.datatype.Type

Base class for types of all PFA/Avro values.

Thin wrapper around a avro.schema.Schema, providing a different Python class for each Avro kind.

accepts(other, memo=None, checkRecord=True)

Perform type resolution: would PFA objects of type other be accepted where a PFA object of type self is expected?

If x.accepts(y) and y.accepts(x), then x and y are equal. In general, acceptability is not symmetric.

The memo and checkRecord parameters are only used to avoid infinite recursion.

Parameters:
Return type:

boolean

Returns:

True if other is an acceptable substitute for self (or is exactly the same); False if incompatible

avroType
jsonNode(memo)

Convert the type to a Python-encoded Avro type.

name

Return “name” of this type, which is used as a key in tagged unions.

schema

Return the avro.schema.Schema object.

toJson()

Convert the type to a JSON-encoded string, suitable for an AVSC file.