# Path: partycrasher/pc_exceptions.py
# class PartyCrasherError(Exception):
#     """An error occured within PartyCrasher."""
#     http_code = 500
#     
#     def __init__(self, message=None, **kwargs):
#         self.__dict__.update(kwargs)
#         if message is None:
#             super(PartyCrasherError, self).__init__()
#         else:
#             super(PartyCrasherError, self).__init__(message)
#     
#     def get_extra(self):
#         extra = dict(self.__dict__)
#         #del extra['args']
#         extra['description'] = self.__class__.__doc__
#         return extra
# 
# Path: partycrasher/project.py
# class Project(object):
#     def __init__(self, project):
#     def __str__(self):
#     def __copy__(self):
#     def __hash__(self):
#     def __eq__(self, other):
#     def __repr__(self):
#     def jsonify(self):


from six import string_types, text_type
from flask import json, jsonify, request, redirect, make_response, url_for
from partycrasher.pc_encoder import pretty
from partycrasher.pc_exceptions import PartyCrasherError
from partycrasher.pc_type import maybe_date, maybe_int
from partycrasher.project import multi_project
from partycrasher.crash_type import multi_crash_type
import weakref
import re
import distutils
import sys
import traceback
import logging
                                   value_a=d[k],
                                   value_b=v)
    else:
        d[k] = v
    return d

def merge(d, dest, src):
    if dest in d:
        if src in d:
            raise KeyConflictError(key=dest,
                                   value_a=d[dest],
                                   value_b=d[src])
        else:
            pass
    else:
        if src in d:
            d[dest]=d[src]
            del d[src]
        else:
            pass

def make_search(args, **kwargs):
    s = kwargs
    merge(args, 'from', 'from_')
    maybe_set(s, 'from', maybe_int(args.get('from', None)))
    maybe_set(s, 'size', maybe_int(args.get('size', None)))
    maybe_set(s, 'query_string', args.get('q', None))
    maybe_set(s, 'since', maybe_date(args.get('since', None)))
    maybe_set(s, 'until', maybe_date(args.get('until', None)))
    merge(args, 'project', 'projects')

# Path: partycrasher/pc_exceptions.py
# class PartyCrasherError(Exception):
#     """An error occured within PartyCrasher."""
#     http_code = 500
#     
#     def __init__(self, message=None, **kwargs):
#         self.__dict__.update(kwargs)
#         if message is None:
#             super(PartyCrasherError, self).__init__()
#         else:
#             super(PartyCrasherError, self).__init__(message)
#     
#     def get_extra(self):
#         extra = dict(self.__dict__)
#         #del extra['args']
#         extra['description'] = self.__class__.__doc__
#         return extra
# 
# Path: partycrasher/project.py
# class Project(object):
#     def __init__(self, project):
#     def __str__(self):
#     def __copy__(self):
#     def __hash__(self):
#     def __eq__(self, other):
#     def __repr__(self):
#     def jsonify(self):


# Path: partycrasher/rest/api_utils.py
from six import string_types, text_type
from flask import json, jsonify, request, redirect, make_response, url_for
from partycrasher.pc_encoder import pretty
from partycrasher.pc_exceptions import PartyCrasherError
from partycrasher.pc_type import maybe_date, maybe_int
from partycrasher.project import multi_project
from partycrasher.crash_type import multi_crash_type
import weakref
import re
import distutils
import sys
import traceback
import logging

                                   value_a=d[k],
                                   value_b=v)
    else:
        d[k] = v
    return d

def merge(d, dest, src):
    if dest in d:
        if src in d:
            raise KeyConflictError(key=dest,
                                   value_a=d[dest],
                                   value_b=d[src])
        else:
            pass
    else:
        if src in d:
            d[dest]=d[src]
            del d[src]
        else:
            pass

def make_search(args, **kwargs):
    s = kwargs
    merge(args, 'from', 'from_')
    maybe_set(s, 'from', maybe_int(args.get('from', None)))
    maybe_set(s, 'size', maybe_int(args.get('size', None)))
    maybe_set(s, 'query_string', args.get('q', None))
    maybe_set(s, 'since', maybe_date(args.get('since', None)))
    maybe_set(s, 'until', maybe_date(args.get('until', None)))
    merge(args, 'project', 'projects')

    maybe_set(s, 'project', multi_project(args.get('project', None)))