# Path: uchroma/util.py
# class ArgsDict(OrderedDict):
#     """
#     Extension of OrderedDict which does not allow empty keys
# 
#     FIXME: Get rid of this
#     """
#     def __init__(self, *args, **kwargs):
#         super(ArgsDict, self).__init__(*args, **kwargs)
#         empty_keys = []
#         for k, v in self.items():
#             if v is None:
#                 empty_keys.append(k)
#         for empty_key in empty_keys:
#             self.pop(empty_key)


import os
import sys
import tempfile
import ruamel.yaml as yaml
from collections import Iterable, OrderedDict
from contextlib import contextmanager
from itertools import chain
from enum import Enum
from uchroma.util import ArgsDict
            for field in self.__slots__:
                if field not in ['parent', '_children']:
                    tmp[field] = self.get(field)
            return self.__class__(**tmp)
        return tuple(flat)


    def _asdict(self) -> OrderedDict:
        od = OrderedDict()
        for slot in self.__slots__:
            if slot in ('parent', '_children'):
                continue
            value = getattr(self, slot)
            if value is None:
                continue
            od[slot] = value
        return od


    def sparsedict(self, deep=True) -> OrderedDict:
        """
        Returns a "sparse" ordereddict with the parent->child relationships
        represented. This is used for serialization.

        :return: The sparse dict representation
        """
        self.__class__._traverse = False

        fields = tuple([x for x in self.__slots__ if x not in ['parent', '_children']])


# Path: uchroma/util.py
# class ArgsDict(OrderedDict):
#     """
#     Extension of OrderedDict which does not allow empty keys
# 
#     FIXME: Get rid of this
#     """
#     def __init__(self, *args, **kwargs):
#         super(ArgsDict, self).__init__(*args, **kwargs)
#         empty_keys = []
#         for k, v in self.items():
#             if v is None:
#                 empty_keys.append(k)
#         for empty_key in empty_keys:
#             self.pop(empty_key)


# Path: uchroma/server/config.py
import os
import sys
import tempfile
import ruamel.yaml as yaml
from collections import Iterable, OrderedDict
from contextlib import contextmanager
from itertools import chain
from enum import Enum
from uchroma.util import ArgsDict

            for field in self.__slots__:
                if field not in ['parent', '_children']:
                    tmp[field] = self.get(field)
            return self.__class__(**tmp)
        return tuple(flat)


    def _asdict(self) -> OrderedDict:
        od = OrderedDict()
        for slot in self.__slots__:
            if slot in ('parent', '_children'):
                continue
            value = getattr(self, slot)
            if value is None:
                continue
            od[slot] = value
        return od


    def sparsedict(self, deep=True) -> OrderedDict:
        """
        Returns a "sparse" ordereddict with the parent->child relationships
        represented. This is used for serialization.

        :return: The sparse dict representation
        """
        self.__class__._traverse = False

        fields = tuple([x for x in self.__slots__ if x not in ['parent', '_children']])


        odict = ArgsDict({x: getattr(self, x) for x in fields})