# Path: baleen/config.py
# class MongoConfiguration(confire.Configuration):
# class ServerConfiguration(confire.Configuration):
# class BaleenConfiguration(confire.Configuration):
#     CONF_PATHS = [
#         "/etc/baleen.yaml",                      # System configuration
#         os.path.expanduser("~/.baleen.yaml"),    # User specific config
#         os.path.abspath("conf/baleen.yaml"),     # Local configuration
#     ]
# 
# Path: baleen/utils/timez.py
# def humanizedelta(*args, **kwargs):
#     """
#     Wrapper around dateutil.relativedelta (same construtor args) and returns
#     a humanized string representing the detla in a meaningful way.
#     """
#     if 'milliseconds' in kwargs:
#         sec  = kwargs.get('seconds', 0)
#         msec = kwargs.pop('milliseconds')
#         kwargs['seconds'] = sec + (float(msec) / 1000.0)
# 
#     delta = relativedelta(*args, **kwargs)
#     attrs = ('years', 'months', 'days', 'hours', 'minutes', 'seconds')
#     parts = [
#         '%d %s' % (getattr(delta, attr), getattr(delta, attr) > 1 and attr or attr[:-1])
#         for attr in attrs if getattr(delta, attr)
#     ]
# 
#     return " ".join(parts)


import baleen
import hashlib
import mongoengine as me
from datetime import datetime,timedelta
from baleen.config import settings
from baleen.utils.timez import humanizedelta
## Module Constants
##########################################################################

FEEDTYPES = (
    'atom',
    'atom01',
    'atom02',
    'atom03',
    'atom10',
    'cdf',
    'rss',
    'rss090',
    'rss091n',
    'rss092',
    'rss093',
    'rss094',
    'rss10',
    'rss20',
)

##########################################################################
## Helper Functions
##########################################################################

def connect(**kwargs):
    """
    Wrapper for mongoengine connect - connects with configuration details.
    """
    name = kwargs.pop('name', settings.database.name)
    host = kwargs.pop('host', settings.database.host)

# Path: baleen/config.py
# class MongoConfiguration(confire.Configuration):
# class ServerConfiguration(confire.Configuration):
# class BaleenConfiguration(confire.Configuration):
#     CONF_PATHS = [
#         "/etc/baleen.yaml",                      # System configuration
#         os.path.expanduser("~/.baleen.yaml"),    # User specific config
#         os.path.abspath("conf/baleen.yaml"),     # Local configuration
#     ]
# 
# Path: baleen/utils/timez.py
# def humanizedelta(*args, **kwargs):
#     """
#     Wrapper around dateutil.relativedelta (same construtor args) and returns
#     a humanized string representing the detla in a meaningful way.
#     """
#     if 'milliseconds' in kwargs:
#         sec  = kwargs.get('seconds', 0)
#         msec = kwargs.pop('milliseconds')
#         kwargs['seconds'] = sec + (float(msec) / 1000.0)
# 
#     delta = relativedelta(*args, **kwargs)
#     attrs = ('years', 'months', 'days', 'hours', 'minutes', 'seconds')
#     parts = [
#         '%d %s' % (getattr(delta, attr), getattr(delta, attr) > 1 and attr or attr[:-1])
#         for attr in attrs if getattr(delta, attr)
#     ]
# 
#     return " ".join(parts)


# Path: baleen/models.py
import baleen
import hashlib
import mongoengine as me
from datetime import datetime,timedelta
from baleen.config import settings
from baleen.utils.timez import humanizedelta

## Module Constants
##########################################################################

FEEDTYPES = (
    'atom',
    'atom01',
    'atom02',
    'atom03',
    'atom10',
    'cdf',
    'rss',
    'rss090',
    'rss091n',
    'rss092',
    'rss093',
    'rss094',
    'rss10',
    'rss20',
)

##########################################################################
## Helper Functions
##########################################################################

def connect(**kwargs):
    """
    Wrapper for mongoengine connect - connects with configuration details.
    """
    name = kwargs.pop('name', settings.database.name)
    host = kwargs.pop('host', settings.database.host)

    port = kwargs.pop('port', settings.database.port)