MCPcopy Create free account
hub / github.com/apache/fory / write

Method write

python/pyfory/_serializer.py:415–422  ·  view source on GitHub ↗
(self, write_context, value: datetime.date)

Source from the content-addressed store, hash-verified

413
414class DateSerializer(Serializer):
415 def write(self, write_context, value: datetime.date):
416 if not isinstance(value, datetime.date):
417 raise TypeError("{} should be {} instead of {}".format(value, datetime.date, type(value)))
418 days = (value - _base_date).days
419 if self.type_resolver.xlang:
420 write_context.write_varint64(days)
421 else:
422 write_context.write_int32(days)
423
424 def read(self, read_context):
425 if self.type_resolver.xlang:

Callers

nothing calls this directly

Calls 3

write_varint64Method · 0.80
formatMethod · 0.45
write_int32Method · 0.45

Tested by

no test coverage detected