Debian Codegraph @

asdf_astropy/converters/time/time_delta.py

raw
1 from asdf.extension import Converter
2
3
4 class TimeDeltaConverter(Converter):
5 tags = ("tag:astropy.org:astropy/time/timedelta-*",)
6 types = ("astropy.time.core.TimeDelta",)
7
8 def to_yaml_tree(self, obj, tag, ctx):
9 return obj.info._represent_as_dict()
10
11 def from_yaml_tree(self, node, tag, ctx):
12 from astropy.time.core import TimeDelta
13
14 return TimeDelta.info._construct_from_dict(node)