File: yamlutil.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 (37 lines) | stat: -rw-r--r-- 1,140 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import asdf

from . import _utils


def build_tree_keys():
    return [f"{tree_size}_{data_size}" for tree_size in _utils.tree_sizes for data_size in _utils.data_sizes]


class YamlUtilSuite:
    params = build_tree_keys()

    def setup(self, key):
        self.af = asdf.AsdfFile()
        self.custom_tree = _utils.build_tree(*key.split("_"))
        self.tagged_tree = asdf.yamlutil.custom_tree_to_tagged_tree(self.custom_tree, self.af)

    def _custom_tree_to_tagged_tree(self, key):
        asdf.yamlutil.custom_tree_to_tagged_tree(self.custom_tree, self.af)

    def _tagged_tree_to_custom_tree(self, key):
        asdf.yamlutil.tagged_tree_to_custom_tree(self.tagged_tree, self.af)

    def time_custom_tree_to_tagged_tree(self, key):
        self._custom_tree_to_tagged_tree(key)

    def time_tagged_tree_to_custom_tree(self, key):
        self._tagged_tree_to_custom_tree(key)

    def peakmem_pass(self, key):
        pass

    def peakmem_custom_tree_to_tagged_tree(self, key):
        self._custom_tree_to_tagged_tree(key)

    def peakmem_tagged_tree_to_custom_tree(self, key):
        self._tagged_tree_to_custom_tree(key)