# Path: duplicity/globals.py

# 
# Path: duplicity/gpg.py
# class GPGError(Exception):
# class GPGProfile:
# class GPGFile:
#     class FileCounted:
#     def __init__(self, passphrase = None, sign_key = None,
#                  recipients = None):
#     def __init__(self, encrypt, encrypt_path, profile):
#     def read(self, length = -1):
#     def write(self, buf):
#     def gpg_failed(self):
#     def close(self):
#     def set_signature(self):
#     def get_signature(self):
# def GPGWriteFile(block_iter, filename, profile,
#                  size = 200 * 1024 * 1024,
#                  max_footer_size = 16 * 1024):
#     def top_off(bytes, file):
#     def get_current_size():
# def GzipWriteFile(block_iter, filename,
#                   size = 200 * 1024 * 1024,
#                   max_footer_size = 16 * 1024):
#         def __init__(self, fileobj):
#         def write(self, buf):
#         def close(self):
# def get_hash(hash, path, hex = 1):


import config
import sys, unittest, os
import duplicity.backend
    import duplicity.backends.giobackend
from duplicity.errors import * #@UnusedWildImport
from duplicity import path, file_naming, dup_time, globals, gpg
        # Test get
        regfilebuf = regpath.open("rb").read()
        backend.get(colonfile, tmpregpath)
        backendbuf = tmpregpath.open("rb").read()
        assert backendbuf == regfilebuf

        # Test delete
        backend.delete([colonfile, normal_file])
        cmp_list([])

    def try_fileobj_filename(self, backend, filename):
        """Use get_fileobj_write and get_fileobj_read on filename around"""
        fout = backend.get_fileobj_write(filename)
        fout.write("hello, world!")
        fout.close()
        assert filename in backend.list()

        fin = backend.get_fileobj_read(filename)
        buf = fin.read()
        fin.close()
        assert buf == "hello, world!", buf

        backend.delete ([filename])

    def try_fileobj_ops(self, backend):
        """Test above try_fileobj_filename with a few filenames"""
        # Must set dup_time strings because they are used by file_naming
        dup_time.setcurtime(2000)
        dup_time.setprevtime(1000)
        # Also set profile for encryption

# Path: duplicity/globals.py

# 
# Path: duplicity/gpg.py
# class GPGError(Exception):
# class GPGProfile:
# class GPGFile:
#     class FileCounted:
#     def __init__(self, passphrase = None, sign_key = None,
#                  recipients = None):
#     def __init__(self, encrypt, encrypt_path, profile):
#     def read(self, length = -1):
#     def write(self, buf):
#     def gpg_failed(self):
#     def close(self):
#     def set_signature(self):
#     def get_signature(self):
# def GPGWriteFile(block_iter, filename, profile,
#                  size = 200 * 1024 * 1024,
#                  max_footer_size = 16 * 1024):
#     def top_off(bytes, file):
#     def get_current_size():
# def GzipWriteFile(block_iter, filename,
#                   size = 200 * 1024 * 1024,
#                   max_footer_size = 16 * 1024):
#         def __init__(self, fileobj):
#         def write(self, buf):
#         def close(self):
# def get_hash(hash, path, hex = 1):


# Path: testing/backendtest.py
import config
import sys, unittest, os
import duplicity.backend
    import duplicity.backends.giobackend
from duplicity.errors import * #@UnusedWildImport
from duplicity import path, file_naming, dup_time, globals, gpg

        # Test get
        regfilebuf = regpath.open("rb").read()
        backend.get(colonfile, tmpregpath)
        backendbuf = tmpregpath.open("rb").read()
        assert backendbuf == regfilebuf

        # Test delete
        backend.delete([colonfile, normal_file])
        cmp_list([])

    def try_fileobj_filename(self, backend, filename):
        """Use get_fileobj_write and get_fileobj_read on filename around"""
        fout = backend.get_fileobj_write(filename)
        fout.write("hello, world!")
        fout.close()
        assert filename in backend.list()

        fin = backend.get_fileobj_read(filename)
        buf = fin.read()
        fin.close()
        assert buf == "hello, world!", buf

        backend.delete ([filename])

    def try_fileobj_ops(self, backend):
        """Test above try_fileobj_filename with a few filenames"""
        # Must set dup_time strings because they are used by file_naming
        dup_time.setcurtime(2000)
        dup_time.setprevtime(1000)
        # Also set profile for encryption

        globals.gpg_profile = gpg.GPGProfile(passphrase = "foobar")