# Path: statik/deploy/base.py
# class DeploymentMethod(object):
#     """An abstract method for handling deployment."""
# 
#     def __init__(self, config, error_context=None):
#         """Must validate the given configuration for this deployment method and raise an exception
#         if it's invalid."""
#         raise NotImplementedError
# 
#     def execute(self, source_path):
#         """Must actually execute the implemented deployment method."""
#         raise NotImplementedError
# 
# Path: statik/errors.py
# class ProjectConfigurationError(StatikError):
#     """For generic project configuration-related errors."""
#     error_kind = "Project configuration error"
#     exit_code = 2
# 
# class DeploymentError(StatikError):
#     """For errors relating to deployment of built projects."""
#     error_kind = "Deployment-related error"
#     exit_code = 9


import os
import os.path
import getpass
import paramiko
import logging
from .base import DeploymentMethod
from ..errors import ProjectConfigurationError, DeploymentError
    try:
        logger.debug("Attempting to load private key file as DSS key")
        return paramiko.dsskey.DSSKey.from_private_key_file(filename,
            password=password)
    except paramiko.PasswordRequiredException as e:
        raise e
    except Exception as e:
        logger.debug("Cannot load as DSS key: %s" % e)

    try:
        logger.debug("Attempting to load private key file as ECDSA key")
        return paramiko.ecdsakey.ECDSAKey.from_private_key_file(filename,
            password=password)
    except paramiko.PasswordRequiredException as e:
        raise e
    except Exception as e:
        logger.debug("Cannot load as ECDSA key: %s" % e)

    try:
        logger.debug("Attempting to load private key file as Ed25519 key")
        return paramiko.ed25519key.Ed25519Key.from_private_key_file(filename,
            password=password)
    except paramiko.PasswordRequiredException as e:
        raise e
    except Exception as e:
        logger.debug("Cannot load as Ed25519 key: %s" % e)

    raise ProjectConfigurationError(
        message="Failed to load private key for SFTP deployment: %s" % filename,
        context=error_context,

# Path: statik/deploy/base.py
# class DeploymentMethod(object):
#     """An abstract method for handling deployment."""
# 
#     def __init__(self, config, error_context=None):
#         """Must validate the given configuration for this deployment method and raise an exception
#         if it's invalid."""
#         raise NotImplementedError
# 
#     def execute(self, source_path):
#         """Must actually execute the implemented deployment method."""
#         raise NotImplementedError
# 
# Path: statik/errors.py
# class ProjectConfigurationError(StatikError):
#     """For generic project configuration-related errors."""
#     error_kind = "Project configuration error"
#     exit_code = 2
# 
# class DeploymentError(StatikError):
#     """For errors relating to deployment of built projects."""
#     error_kind = "Deployment-related error"
#     exit_code = 9


# Path: statik/deploy/sftp.py
import os
import os.path
import getpass
import paramiko
import logging
from .base import DeploymentMethod
from ..errors import ProjectConfigurationError, DeploymentError

    try:
        logger.debug("Attempting to load private key file as DSS key")
        return paramiko.dsskey.DSSKey.from_private_key_file(filename,
            password=password)
    except paramiko.PasswordRequiredException as e:
        raise e
    except Exception as e:
        logger.debug("Cannot load as DSS key: %s" % e)

    try:
        logger.debug("Attempting to load private key file as ECDSA key")
        return paramiko.ecdsakey.ECDSAKey.from_private_key_file(filename,
            password=password)
    except paramiko.PasswordRequiredException as e:
        raise e
    except Exception as e:
        logger.debug("Cannot load as ECDSA key: %s" % e)

    try:
        logger.debug("Attempting to load private key file as Ed25519 key")
        return paramiko.ed25519key.Ed25519Key.from_private_key_file(filename,
            password=password)
    except paramiko.PasswordRequiredException as e:
        raise e
    except Exception as e:
        logger.debug("Cannot load as Ed25519 key: %s" % e)

    raise ProjectConfigurationError(
        message="Failed to load private key for SFTP deployment: %s" % filename,
        context=error_context,

    )