How to use the fastavro.io.symbols.Null function in fastavro

To help you get started, we’ve selected a few fastavro examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fastavro / fastavro / fastavro / io / parser.py View on Github external
)
            return Sequence(repeat, MapStart())

        elif record_type == "array":
            repeat = Repeater(
                ArrayEnd(),
                ItemEnd(),
                self._parse(schema["items"]),
            )
            return Sequence(repeat, ArrayStart())

        elif record_type == "enum":
            return Sequence(EnumLabels(schema["symbols"]), Enum())

        elif record_type == "null":
            return Null()
        elif record_type == "boolean":
            return Boolean()
        elif record_type == "string":
            return String()
        elif record_type == "bytes":
            return Bytes()
        elif record_type == "int":
            return Int()
        elif record_type == "long":
            return Long()
        elif record_type == "float":
            return Float()
        elif record_type == "double":
            return Double()
        elif record_type == "fixed":
            return Fixed()
github fastavro / fastavro / fastavro / io / json_decoder.py View on Github external
def read_null(self):
        self._parser.advance(Null())
        return self.read_value()
github fastavro / fastavro / fastavro / io / json_encoder.py View on Github external
def write_null(self):
        self._parser.advance(Null())
        self.write_value(None)
github fastavro / fastavro / fastavro / io / json_encoder.py View on Github external
def write_index(self, index, schema):
        self._parser.advance(Union())
        alternative_symbol = self._parser.pop_symbol()

        symbol = alternative_symbol.get_symbol(index)

        if symbol != Null():
            self.write_object_start()
            self.write_object_key(alternative_symbol.get_label(index))
            # TODO: Do we need this symbol?
            self._parser.push_symbol(UnionEnd())

        self._parser.push_symbol(symbol)