File: constant.py

package info (click to toggle)
python-asdf 4.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 7,032 kB
  • sloc: python: 24,068; makefile: 123
file content (14 lines) | stat: -rw-r--r-- 369 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from asdf.extension import Converter


class ConstantConverter(Converter):
    tags = ["tag:stsci.edu:asdf/core/constant-1.0.0"]
    types = ["asdf.tags.core.constant.Constant"]

    def to_yaml_tree(self, obj, tag, ctx):
        return obj.value

    def from_yaml_tree(self, node, tag, ctx):
        from asdf.tags.core import Constant

        return Constant(node)