# Path: i3configger/context.py
# def process(item: Iterable[Union[dict, partials.Partial]]) -> dict:
# def merge_all(item: Iterable[Union[dict, partials.Partial]]) -> dict:
# def merge(dst: dict, src: dict) -> dict:
# def prune(dst: dict, src: dict) -> dict:
# def resolve_variables(ctx: dict) -> dict:
# def _resolve_variable(key, ctx, path):
# def remove_variable_markers(ctx: dict) -> dict:
# def substitute(content: str, ctx: dict):
# 
# Path: i3configger/exc.py
# class I3configgerException(Exception):
# class BuildError(I3configgerException):
# class ConfigError(I3configgerException):
# class MessageError(I3configgerException):
# class PartialsError(I3configgerException):
# class ParseError(I3configgerException):
# class ContextError(I3configgerException):
# class UserError(I3configgerException):


import copy
import json
import logging
import os
import pprint
import shutil
from pathlib import Path
from i3configger import context, exc
    },
}
CONFIG_CANDIDATES = [
    Path("~/.i3").expanduser(),
    Path(os.getenv("XDG_CONFIG_HOME", "~/.config/")).expanduser() / "i3",
]


class I3configgerConfig:
    PARTIALS_NAME = "config.d"
    CONFIG_NAME = "i3configger.json"
    MESSAGES_NAME = ".messages.json"

    def __init__(self, load=True):
        i3configBasePath = get_i3wm_config_path()
        self.partialsPath = i3configBasePath / self.PARTIALS_NAME
        self.configPath = self.partialsPath / self.CONFIG_NAME
        self.messagesPath = self.partialsPath / self.MESSAGES_NAME
        if load:
            self.load()

    def __str__(self):
        return f"{self.__class__.__name__}:\n{pprint.pformat(vars(self))}"

    def load(self):
        """Layered overrides `DEFAULTS` -> `i3configger.json`-> `args`"""
        cnfFromDefaults = copy.deepcopy(DEFAULTS)
        cnfFromFile = fetch(self.configPath)
        self.payload = context.merge(cnfFromDefaults, cnfFromFile)
        mainOverrides = dict(main=cliMainOverrideMap)

# Path: i3configger/context.py
# def process(item: Iterable[Union[dict, partials.Partial]]) -> dict:
# def merge_all(item: Iterable[Union[dict, partials.Partial]]) -> dict:
# def merge(dst: dict, src: dict) -> dict:
# def prune(dst: dict, src: dict) -> dict:
# def resolve_variables(ctx: dict) -> dict:
# def _resolve_variable(key, ctx, path):
# def remove_variable_markers(ctx: dict) -> dict:
# def substitute(content: str, ctx: dict):
# 
# Path: i3configger/exc.py
# class I3configgerException(Exception):
# class BuildError(I3configgerException):
# class ConfigError(I3configgerException):
# class MessageError(I3configgerException):
# class PartialsError(I3configgerException):
# class ParseError(I3configgerException):
# class ContextError(I3configgerException):
# class UserError(I3configgerException):


# Path: i3configger/config.py
import copy
import json
import logging
import os
import pprint
import shutil
from pathlib import Path
from i3configger import context, exc

    },
}
CONFIG_CANDIDATES = [
    Path("~/.i3").expanduser(),
    Path(os.getenv("XDG_CONFIG_HOME", "~/.config/")).expanduser() / "i3",
]


class I3configgerConfig:
    PARTIALS_NAME = "config.d"
    CONFIG_NAME = "i3configger.json"
    MESSAGES_NAME = ".messages.json"

    def __init__(self, load=True):
        i3configBasePath = get_i3wm_config_path()
        self.partialsPath = i3configBasePath / self.PARTIALS_NAME
        self.configPath = self.partialsPath / self.CONFIG_NAME
        self.messagesPath = self.partialsPath / self.MESSAGES_NAME
        if load:
            self.load()

    def __str__(self):
        return f"{self.__class__.__name__}:\n{pprint.pformat(vars(self))}"

    def load(self):
        """Layered overrides `DEFAULTS` -> `i3configger.json`-> `args`"""
        cnfFromDefaults = copy.deepcopy(DEFAULTS)
        cnfFromFile = fetch(self.configPath)
        self.payload = context.merge(cnfFromDefaults, cnfFromFile)
        mainOverrides = dict(main=cliMainOverrideMap)

        self.payload = context.merge(self.payload, mainOverrides)