# Path: pyjob/exception.py
# class DictLockedError(Exception):
#     pass


import logging
import os
import sys
import yaml
from collections import UserDict
from functools import wraps
from pyjob.exception import DictLockedError

    def lock(self):
        self._locked = True

    def unlock(self):
        self._locked = False

    @staticmethod
    def assert_lock(fn):
        @wraps(fn)
        def wrapper(self, *args, **kwargs):
            if self._locked:
                raise DictLockedError("Dictionary locked, cannot override value")
            return fn(self, *args, **kwargs)

        return wrapper


class PyJobConfig(UserDict, ImmutableDictMixin):

    _directory = os.path.expanduser("~/.pyjob")
    if not os.path.isdir(_directory):
        try:
            os.makedirs(_directory)
        except OSError as e:
            if e.errno == errno.EEXIST and os.path.isdir(_directory):
                pass
            else:
                raise RuntimeError("Cannot create configuration directory")


# Path: pyjob/exception.py
# class DictLockedError(Exception):
#     pass


# Path: pyjob/config.py
import logging
import os
import sys
import yaml
from collections import UserDict
from functools import wraps
from pyjob.exception import DictLockedError


    def lock(self):
        self._locked = True

    def unlock(self):
        self._locked = False

    @staticmethod
    def assert_lock(fn):
        @wraps(fn)
        def wrapper(self, *args, **kwargs):
            if self._locked:
                raise DictLockedError("Dictionary locked, cannot override value")
            return fn(self, *args, **kwargs)

        return wrapper


class PyJobConfig(UserDict, ImmutableDictMixin):

    _directory = os.path.expanduser("~/.pyjob")
    if not os.path.isdir(_directory):
        try:
            os.makedirs(_directory)
        except OSError as e:
            if e.errno == errno.EEXIST and os.path.isdir(_directory):
                pass
            else:
                raise RuntimeError("Cannot create configuration directory")


    file = os.path.join(_directory, "pyjob.yml")