# Path: app.py
# def setup_logging():
# 
# Path: skier/keyinfo.py
# def jsondes(obj):
# def wrap(i):
#     def __init__(self, uid: list = None, keyid: str = None, fingerprint: str = None,
#                  length: int = None, algo: PGPAlgo = None, created: int = None, expires: int = None,
#                  subkeys: list = None,
#                  sigs: dict = None,
#                  expired: bool = False, revoked: bool = False, armored: str = "", oid=None):
#     def expired(self):
#     def __repr__(self):
#     def to_pks(self):
#     def _setup_keybase(self, username):
#     def from_json(self, data: str):
#     def to_json(self):
#     def get_expired_ymd(self):
#     def get_created_ymd(self):
#     def get_algo_name(self):
#     def get_algo_id(self):
#     def get_user_fingerprint(self):
#     def translate(self, sig):
#     def get_length(self):
#     def __eq__(self, other):
#     def pgp_dump(cls, armored: str, packets: list = None):
#     def from_database_object(cls, keyob: db.Key):
# class PGPAlgo(Enum):
# class KeyInfo(object):
#     RSA = 1
#     RSA_E = 2
#     RSA_S = 3
#     ELGAMAL = 16
#     DSA = 17
#     ECC = 18
#     ECDSA = 19
#     DH = 21


from flask.ext.sqlalchemy import Pagination
from app import cache
from skier import keyinfo
import db

    # Put the data into the database.
    # Show me on the doll where redis touched you.
    exists = db.Key.query.filter(db.Key.key_fp_id == newkey.shortid).first()
    if exists:
        if keyinfo.KeyInfo.from_database_object(exists) == newkey:
            return False, -2, None
        else:
            use_id = exists.id
    else:
        use_id = None

    key = db.Key.from_keyinfo(newkey)
    if not newkey.armored:
        key.armored = armored
    if use_id:
        key.id = use_id
    db.db.session.merge(key)
    db.db.session.commit()
    if cache.exists(key.key_fp_id + "-armor"):
        cache.delete(key.key_fp_id + "-armor")

    return True, newkey.shortid, key

def get_pgp_armor_key(keyid: str) -> str:
    """
    Lookup a PGP key.
    :param keyid: The key ID to lookup.
    :return: The armored version of the PGP key, or None if the key does not exist in the DB.
    """

# Path: app.py
# def setup_logging():
# 
# Path: skier/keyinfo.py
# def jsondes(obj):
# def wrap(i):
#     def __init__(self, uid: list = None, keyid: str = None, fingerprint: str = None,
#                  length: int = None, algo: PGPAlgo = None, created: int = None, expires: int = None,
#                  subkeys: list = None,
#                  sigs: dict = None,
#                  expired: bool = False, revoked: bool = False, armored: str = "", oid=None):
#     def expired(self):
#     def __repr__(self):
#     def to_pks(self):
#     def _setup_keybase(self, username):
#     def from_json(self, data: str):
#     def to_json(self):
#     def get_expired_ymd(self):
#     def get_created_ymd(self):
#     def get_algo_name(self):
#     def get_algo_id(self):
#     def get_user_fingerprint(self):
#     def translate(self, sig):
#     def get_length(self):
#     def __eq__(self, other):
#     def pgp_dump(cls, armored: str, packets: list = None):
#     def from_database_object(cls, keyob: db.Key):
# class PGPAlgo(Enum):
# class KeyInfo(object):
#     RSA = 1
#     RSA_E = 2
#     RSA_S = 3
#     ELGAMAL = 16
#     DSA = 17
#     ECC = 18
#     ECDSA = 19
#     DH = 21


# Path: skier/pgp.py
from flask.ext.sqlalchemy import Pagination
from app import cache
from skier import keyinfo
import db


    # Put the data into the database.
    # Show me on the doll where redis touched you.
    exists = db.Key.query.filter(db.Key.key_fp_id == newkey.shortid).first()
    if exists:
        if keyinfo.KeyInfo.from_database_object(exists) == newkey:
            return False, -2, None
        else:
            use_id = exists.id
    else:
        use_id = None

    key = db.Key.from_keyinfo(newkey)
    if not newkey.armored:
        key.armored = armored
    if use_id:
        key.id = use_id
    db.db.session.merge(key)
    db.db.session.commit()
    if cache.exists(key.key_fp_id + "-armor"):
        cache.delete(key.key_fp_id + "-armor")

    return True, newkey.shortid, key

def get_pgp_armor_key(keyid: str) -> str:
    """
    Lookup a PGP key.
    :param keyid: The key ID to lookup.
    :return: The armored version of the PGP key, or None if the key does not exist in the DB.
    """

    if cache.exists(keyid + "-armor"):