# Path: hypergolix/exceptions.py
# class ConfigError(HypergolixException, RuntimeError):
#     ''' This exception (or a subclass thereof) is raised for all failed
#     operations with configuration.
#     '''
#     pass
# 
# Path: hypergolix/exceptions.py
# class ConfigIncomplete(ConfigError):
#     ''' This exception is raised when attempting to load an incomplete
#     configuration.
#     '''
#     pass
# 
# Path: hypergolix/exceptions.py
# class ConfigMissing(ConfigError, FileNotFoundError):
#     ''' This exception is raised when attempting to load an incomplete
#     configuration.
#     '''
#     pass


import pathlib
import collections
import copy
import webbrowser
import yaml
import inspect
import os
import warnings
import logging
from golix import Ghid
from golix import Secret
from .exceptions import ConfigError
from .exceptions import ConfigIncomplete
from .exceptions import ConfigMissing
        transcoded = collections.OrderedDict()
        
        cls = type(self)
        for field in self.fields:
            descriptor = getattr(cls, field)
            value = self._fields[field]
            # Note that the descriptor handles nested fields and Nones
            transcoded[field] = descriptor.encode(value)
            
        return transcoded
        
    def detranscode(self, data):
        ''' Apply the natively deserialized ordereddict into
        self._fields.
        '''
        cls = type(self)
        
        for field in self.fields:
            descriptor = getattr(cls, field)
            
            # Make sure we can optionally support configs with incomplete data
            if data is None or field not in data:
                logger.warning('Healed config w/ missing field: ' + field)
                
            else:
                try:
                    # Note that the descriptor handles nested fields
                    self._fields[field] = descriptor.decode(data[field])
                    
                except Exception as exc:

# Path: hypergolix/exceptions.py
# class ConfigError(HypergolixException, RuntimeError):
#     ''' This exception (or a subclass thereof) is raised for all failed
#     operations with configuration.
#     '''
#     pass
# 
# Path: hypergolix/exceptions.py
# class ConfigIncomplete(ConfigError):
#     ''' This exception is raised when attempting to load an incomplete
#     configuration.
#     '''
#     pass
# 
# Path: hypergolix/exceptions.py
# class ConfigMissing(ConfigError, FileNotFoundError):
#     ''' This exception is raised when attempting to load an incomplete
#     configuration.
#     '''
#     pass


# Path: hypergolix/config.py
import pathlib
import collections
import copy
import webbrowser
import yaml
import inspect
import os
import warnings
import logging
from golix import Ghid
from golix import Secret
from .exceptions import ConfigError
from .exceptions import ConfigIncomplete
from .exceptions import ConfigMissing

        transcoded = collections.OrderedDict()
        
        cls = type(self)
        for field in self.fields:
            descriptor = getattr(cls, field)
            value = self._fields[field]
            # Note that the descriptor handles nested fields and Nones
            transcoded[field] = descriptor.encode(value)
            
        return transcoded
        
    def detranscode(self, data):
        ''' Apply the natively deserialized ordereddict into
        self._fields.
        '''
        cls = type(self)
        
        for field in self.fields:
            descriptor = getattr(cls, field)
            
            # Make sure we can optionally support configs with incomplete data
            if data is None or field not in data:
                logger.warning('Healed config w/ missing field: ' + field)
                
            else:
                try:
                    # Note that the descriptor handles nested fields
                    self._fields[field] = descriptor.decode(data[field])
                    
                except Exception as exc:

                    raise ConfigError('Failed to decode field: ' +