# Path: feemodel/appdirs.py
# def user_data_dir(appname=None, appauthor=None, version=None, roaming=False):
#     r"""Return full path to the user-specific data dir for this application.
# 
#         "appname" is the name of application.
#             If None, just the system directory is returned.
#         "appauthor" (only used on Windows) is the name of the
#             appauthor or distributing body for this application. Typically
#             it is the owning company name. This falls back to appname. You may
#             pass False to disable it.
#         "version" is an optional version path element to append to the
#             path. You might want to use this if you want multiple versions
#             of your app to be able to run independently. If used, this
#             would typically be "<major>.<minor>".
#             Only applied when appname is present.
#         "roaming" (boolean, default False) can be set True to use the Windows
#             roaming appdata directory. That means that for users on a Windows
#             network setup for roaming profiles, this user data will be
#             sync'd on login. See
#             <http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx>
#             for a discussion of issues.
# 
#     Typical user data directories are:
#         Mac OS X:               ~/Library/Application Support/<AppName>
#         Unix:                   ~/.local/share/<AppName>    # or in $XDG_DATA_HOME, if defined
#         Win XP (not roaming):   C:\Documents and Settings\<username>\Application Data\<AppAuthor>\<AppName>
#         Win XP (roaming):       C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName>
#         Win 7  (not roaming):   C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName>
#         Win 7  (roaming):       C:\Users\<username>\AppData\Roaming\<AppAuthor>\<AppName>
# 
#     For Unix, we follow the XDG spec and support $XDG_DATA_HOME.
#     That means, by default "~/.local/share/<AppName>".
#     """
#     if system == "win32":
#         if appauthor is None:
#             appauthor = appname
#         const = roaming and "CSIDL_APPDATA" or "CSIDL_LOCAL_APPDATA"
#         path = os.path.normpath(_get_win_folder(const))
#         if appname:
#             if appauthor is not False:
#                 path = os.path.join(path, appauthor, appname)
#             else:
#                 path = os.path.join(path, appname)
#     elif system == 'darwin':
#         path = os.path.expanduser('~/Library/Application Support/')
#         if appname:
#             path = os.path.join(path, appname)
#     else:
#         path = os.getenv('XDG_DATA_HOME', os.path.expanduser("~/.local/share"))
#         if appname:
#             path = os.path.join(path, appname)
#     if appname and version:
#         path = os.path.join(path, version)
#     return path


import os
import json
import ConfigParser
from pkg_resources import resource_stream, get_distribution
from feemodel.appdirs import user_data_dir

pkgname = 'bitcoin-feemodel'
__version__ = get_distribution(pkgname).version

pooltags = json.load(resource_stream(__name__, 'pooltags.json'))

DIFF_RETARGET_INTERVAL = 2016
PRIORITYTHRESH = 57600000
EXPECTED_BLOCK_INTERVAL = 600
MINRELAYTXFEE = 5000

# Create the default data directory.
# TODO: don't create it here, but in app.main.
datadir = os.environ.get("FEEMODEL_DATADIR")
if datadir is None:
    datadir = user_data_dir(pkgname)
if not os.path.exists(datadir):
    try:
        os.makedirs(datadir)
    except Exception as e:
        print("Error: unable to create data directory %s." % datadir)
        raise e



# Path: feemodel/appdirs.py
# def user_data_dir(appname=None, appauthor=None, version=None, roaming=False):
#     r"""Return full path to the user-specific data dir for this application.
# 
#         "appname" is the name of application.
#             If None, just the system directory is returned.
#         "appauthor" (only used on Windows) is the name of the
#             appauthor or distributing body for this application. Typically
#             it is the owning company name. This falls back to appname. You may
#             pass False to disable it.
#         "version" is an optional version path element to append to the
#             path. You might want to use this if you want multiple versions
#             of your app to be able to run independently. If used, this
#             would typically be "<major>.<minor>".
#             Only applied when appname is present.
#         "roaming" (boolean, default False) can be set True to use the Windows
#             roaming appdata directory. That means that for users on a Windows
#             network setup for roaming profiles, this user data will be
#             sync'd on login. See
#             <http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx>
#             for a discussion of issues.
# 
#     Typical user data directories are:
#         Mac OS X:               ~/Library/Application Support/<AppName>
#         Unix:                   ~/.local/share/<AppName>    # or in $XDG_DATA_HOME, if defined
#         Win XP (not roaming):   C:\Documents and Settings\<username>\Application Data\<AppAuthor>\<AppName>
#         Win XP (roaming):       C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName>
#         Win 7  (not roaming):   C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName>
#         Win 7  (roaming):       C:\Users\<username>\AppData\Roaming\<AppAuthor>\<AppName>
# 
#     For Unix, we follow the XDG spec and support $XDG_DATA_HOME.
#     That means, by default "~/.local/share/<AppName>".
#     """
#     if system == "win32":
#         if appauthor is None:
#             appauthor = appname
#         const = roaming and "CSIDL_APPDATA" or "CSIDL_LOCAL_APPDATA"
#         path = os.path.normpath(_get_win_folder(const))
#         if appname:
#             if appauthor is not False:
#                 path = os.path.join(path, appauthor, appname)
#             else:
#                 path = os.path.join(path, appname)
#     elif system == 'darwin':
#         path = os.path.expanduser('~/Library/Application Support/')
#         if appname:
#             path = os.path.join(path, appname)
#     else:
#         path = os.getenv('XDG_DATA_HOME', os.path.expanduser("~/.local/share"))
#         if appname:
#             path = os.path.join(path, appname)
#     if appname and version:
#         path = os.path.join(path, version)
#     return path


# Path: feemodel/config.py
import os
import json
import ConfigParser
from pkg_resources import resource_stream, get_distribution
from feemodel.appdirs import user_data_dir


pkgname = 'bitcoin-feemodel'
__version__ = get_distribution(pkgname).version

pooltags = json.load(resource_stream(__name__, 'pooltags.json'))

DIFF_RETARGET_INTERVAL = 2016
PRIORITYTHRESH = 57600000
EXPECTED_BLOCK_INTERVAL = 600
MINRELAYTXFEE = 5000

# Create the default data directory.
# TODO: don't create it here, but in app.main.
datadir = os.environ.get("FEEMODEL_DATADIR")
if datadir is None:
    datadir = user_data_dir(pkgname)
if not os.path.exists(datadir):
    try:
        os.makedirs(datadir)
    except Exception as e:
        print("Error: unable to create data directory %s." % datadir)
        raise e



def read_default_config():