# Path: forsun/utils.py
#     def ensure_bytes(s):
#     def ensure_unicode(s):
#     def ensure_bytes(s):
#     def ensure_unicode(s):
# def load_extensions(name):
# def parse_cmd(command, parse_kwargs = True, split_cmd = True):
# class ExtensionsNotFound(Exception): pass


import os
import configparser
from .utils import unicode_type, string_type, number_type, ensure_unicode

update(DEFAULT_CONFIG)
for key, value in DEFAULT_CONFIG.items():
    env_value = os.environ.get(key)
    if env_value is not None:
        try:
            if isinstance(value, number_type):
                set(key, int(env_value))
            elif isinstance(value, float):
                set(key, float(env_value))
            elif isinstance(value, string_type):
                set(key, str(env_value))
        except:pass

def load_conf(filename):
    try:
        with open(filename, "r") as fp:
            conf_content = unicode_type("[global]\n") + ensure_unicode(fp.read())
            cf = configparser.ConfigParser(allow_no_value=True)
            cf.read_string(conf_content)

            for key, value in DEFAULT_CONFIG.items():
                try:
                    if key.startswith("STORE_"):
                        conf_value = cf.get("store", key[6:].lower())
                    elif key.startswith("ACTION_"):
                        conf_value = cf.get("action", key[7:].lower())
                    elif key.startswith("EXTENSION"):
                        if key == "EXTENSIONS":
                            conf_value = cf.get("extension", "extensions")

# Path: forsun/utils.py
#     def ensure_bytes(s):
#     def ensure_unicode(s):
#     def ensure_bytes(s):
#     def ensure_unicode(s):
# def load_extensions(name):
# def parse_cmd(command, parse_kwargs = True, split_cmd = True):
# class ExtensionsNotFound(Exception): pass


# Path: forsun/config.py
import os
import configparser
from .utils import unicode_type, string_type, number_type, ensure_unicode


update(DEFAULT_CONFIG)
for key, value in DEFAULT_CONFIG.items():
    env_value = os.environ.get(key)
    if env_value is not None:
        try:
            if isinstance(value, number_type):
                set(key, int(env_value))
            elif isinstance(value, float):
                set(key, float(env_value))
            elif isinstance(value, string_type):
                set(key, str(env_value))
        except:pass

def load_conf(filename):
    try:
        with open(filename, "r") as fp:
            conf_content = unicode_type("[global]\n") + ensure_unicode(fp.read())
            cf = configparser.ConfigParser(allow_no_value=True)
            cf.read_string(conf_content)

            for key, value in DEFAULT_CONFIG.items():
                try:
                    if key.startswith("STORE_"):
                        conf_value = cf.get("store", key[6:].lower())
                    elif key.startswith("ACTION_"):
                        conf_value = cf.get("action", key[7:].lower())
                    elif key.startswith("EXTENSION"):
                        if key == "EXTENSIONS":
                            conf_value = cf.get("extension", "extensions")

                            if isinstance(conf_value, string_type):