# Path: static_aid/config.py
# ROOT = realpath(curdir)
# CONFIG_DEFAULTS_FILE_PATH = join(ROOT, 'local_settings.default')
#     ROOT = realpath(join(dirname(__file__), '..'))
#     CONFIG_DEFAULTS_FILE_PATH = join(ROOT, 'local_settings.default')
# CONFIG_FILE_PATH = join(ROOT, 'local_settings.cfg')
# SAMPLE_DATA_DIR = join(ROOT, 'data')
# SITE_SRC_DIR = join(ROOT, 'site')
# BUILD_DIR = join(ROOT, 'build')
# DATA_DIR = join(BUILD_DIR, 'data')
# STAGING_DIR = join(BUILD_DIR, 'staging')
# RAW_DATA_DIR = join(BUILD_DIR, 'raw')
# SITE_BUILD_DIR = join(BUILD_DIR, 'site')  # must match 'dest' settings in Gruntfile.js
# TEMP_DIR = join(BUILD_DIR, 'tmp')
# PID_FILE_PATH = join(TEMP_DIR, 'daemon.pid')
# OBJECT_CACHE_DIR = join(TEMP_DIR, 'object_cache')
# ROW_FETCH_LIMIT = 100
# def _configSection(section):
# def _stringToBoolean(string):
# def _stringToList(string):
# 
# Path: static_aid/utils.py
# def bytes_label(size):
# def create_directory(path):
# def load_json(path):
# def remove_file_or_dir(path):


import logging
import pickle
from os.path import join, exists, isfile, dirname
from os import getpid, makedirs
from psutil import pid_exists
from sys import exit
from time import time
from json import dump
from static_aid import config, utils
        self.set_last_export_time(start_time)

        logging.info('*** Export completed ***')
        utils.remove_file_or_dir(config.PID_FILE_PATH)

    def _run(self):
        """Override this method in each extractor subclass."""
        raise Exception('override this method for each DataExtractor subclass')

    def is_running(self):
        """Determines whether or not the staticAid process is running."""
        if isfile(config.PID_FILE_PATH):
            pidfile = open(config.PID_FILE_PATH, "r")
            for line in pidfile:
                pid = int(line.strip())
                if pid_exists(pid):
                    return True
        return False

    def register_pid(self):
        """Registers the PID of the current process."""
        if not exists(dirname(config.PID_FILE_PATH)):
            makedirs(dirname(config.PID_FILE_PATH))
        currentPid = str(getpid())
        with open(config.PID_FILE_PATH, 'w') as pf:
            pf.write(currentPid)

    def make_destinations(self):
        """Creates destination directories for data files."""
        for k in config.destinations:

# Path: static_aid/config.py
# ROOT = realpath(curdir)
# CONFIG_DEFAULTS_FILE_PATH = join(ROOT, 'local_settings.default')
#     ROOT = realpath(join(dirname(__file__), '..'))
#     CONFIG_DEFAULTS_FILE_PATH = join(ROOT, 'local_settings.default')
# CONFIG_FILE_PATH = join(ROOT, 'local_settings.cfg')
# SAMPLE_DATA_DIR = join(ROOT, 'data')
# SITE_SRC_DIR = join(ROOT, 'site')
# BUILD_DIR = join(ROOT, 'build')
# DATA_DIR = join(BUILD_DIR, 'data')
# STAGING_DIR = join(BUILD_DIR, 'staging')
# RAW_DATA_DIR = join(BUILD_DIR, 'raw')
# SITE_BUILD_DIR = join(BUILD_DIR, 'site')  # must match 'dest' settings in Gruntfile.js
# TEMP_DIR = join(BUILD_DIR, 'tmp')
# PID_FILE_PATH = join(TEMP_DIR, 'daemon.pid')
# OBJECT_CACHE_DIR = join(TEMP_DIR, 'object_cache')
# ROW_FETCH_LIMIT = 100
# def _configSection(section):
# def _stringToBoolean(string):
# def _stringToList(string):
# 
# Path: static_aid/utils.py
# def bytes_label(size):
# def create_directory(path):
# def load_json(path):
# def remove_file_or_dir(path):


# Path: static_aid/DataExtractor.py
import logging
import pickle
from os.path import join, exists, isfile, dirname
from os import getpid, makedirs
from psutil import pid_exists
from sys import exit
from time import time
from json import dump
from static_aid import config, utils

        self.set_last_export_time(start_time)

        logging.info('*** Export completed ***')
        utils.remove_file_or_dir(config.PID_FILE_PATH)

    def _run(self):
        """Override this method in each extractor subclass."""
        raise Exception('override this method for each DataExtractor subclass')

    def is_running(self):
        """Determines whether or not the staticAid process is running."""
        if isfile(config.PID_FILE_PATH):
            pidfile = open(config.PID_FILE_PATH, "r")
            for line in pidfile:
                pid = int(line.strip())
                if pid_exists(pid):
                    return True
        return False

    def register_pid(self):
        """Registers the PID of the current process."""
        if not exists(dirname(config.PID_FILE_PATH)):
            makedirs(dirname(config.PID_FILE_PATH))
        currentPid = str(getpid())
        with open(config.PID_FILE_PATH, 'w') as pf:
            pf.write(currentPid)

    def make_destinations(self):
        """Creates destination directories for data files."""
        for k in config.destinations:

            path = join(config.DATA_DIR, config.destinations[k])