# Path: btcrecover/addressset.py
# def bytes_to_int(bytes_rep):
#     def __init__(self, table_len, bytes_per_addr = 8, max_load = 0.75):
#     def __getstate__(self):
#     def __setstate__(self, state):
#     def  __len__(self):
#     def __contains__(self, address):
#     def add(self, address):
#     def _find(self, addr_to_find):
#     def __iter__(self):
#     def __reversed__(self):
#     def _remove_nonheader_attribs(attrs):
#     def _header(self):
#     def tofile(self, dbfile):
#     def fromfile(cls, dbfile, mmap_access = mmap.ACCESS_READ, preload = True):
#     def close(self, flush = True):
#     def __del__(self):
# def varint(data, offset):
# def create_address_db(dbfilename, blockdir, update = False, progress_bar = True):
# class AddressSet(object):
#     VERSION    = 1
#     MAGIC      = b"seedrecover address database\r\n"  # file magic
#     HEADER_LEN = 65536


from btcrecover import addressset
from os import path
import argparse, sys, atexit
        import argcomplete

    parser.add_argument("--no-progress",action="store_true", default=not sys.stdout.isatty(), help="disable the progress bar (shows cur. blockfile instead)")
    parser.add_argument("--version", "-v", action="version", version="%(prog)s " + addressset.__version__)
    parser.add_argument("dbfilename",   nargs="?", default="addresses.db", help="the name of the database file (default: addresses.db)")

    # Optional bash tab completion support
    try:
        argcomplete.autocomplete(parser)
    except ImportError:
        pass

    args = parser.parse_args()

    if not args.no_pause:
        atexit.register(lambda: raw_input("\nPress Enter to exit ..."))

    if not args.update and not args.force and path.exists(args.dbfilename):
        sys.exit("Address database file already exists (use --update to update or --force to overwrite)")

    if args.datadir:
        blockdir = args.datadir
    elif sys.platform == "win32":
        blockdir = path.expandvars(r"%APPDATA%\Bitcoin")
    elif sys.platform.startswith("linux"):
        blockdir = path.expanduser("~/.bitcoin")
    elif sys.platform == "darwin":
        blockdir = path.expanduser("~/Library/Application Support/Bitcoin")
    else:
        sys.exit("Can't automatically determine Bitcoin data directory (use --datadir)")
    blockdir = path.join(blockdir, "blocks")


# Path: btcrecover/addressset.py
# def bytes_to_int(bytes_rep):
#     def __init__(self, table_len, bytes_per_addr = 8, max_load = 0.75):
#     def __getstate__(self):
#     def __setstate__(self, state):
#     def  __len__(self):
#     def __contains__(self, address):
#     def add(self, address):
#     def _find(self, addr_to_find):
#     def __iter__(self):
#     def __reversed__(self):
#     def _remove_nonheader_attribs(attrs):
#     def _header(self):
#     def tofile(self, dbfile):
#     def fromfile(cls, dbfile, mmap_access = mmap.ACCESS_READ, preload = True):
#     def close(self, flush = True):
#     def __del__(self):
# def varint(data, offset):
# def create_address_db(dbfilename, blockdir, update = False, progress_bar = True):
# class AddressSet(object):
#     VERSION    = 1
#     MAGIC      = b"seedrecover address database\r\n"  # file magic
#     HEADER_LEN = 65536


# Path: create-address-db.py
from btcrecover import addressset
from os import path
import argparse, sys, atexit
        import argcomplete

    parser.add_argument("--no-progress",action="store_true", default=not sys.stdout.isatty(), help="disable the progress bar (shows cur. blockfile instead)")
    parser.add_argument("--version", "-v", action="version", version="%(prog)s " + addressset.__version__)
    parser.add_argument("dbfilename",   nargs="?", default="addresses.db", help="the name of the database file (default: addresses.db)")

    # Optional bash tab completion support
    try:
        argcomplete.autocomplete(parser)
    except ImportError:
        pass

    args = parser.parse_args()

    if not args.no_pause:
        atexit.register(lambda: raw_input("\nPress Enter to exit ..."))

    if not args.update and not args.force and path.exists(args.dbfilename):
        sys.exit("Address database file already exists (use --update to update or --force to overwrite)")

    if args.datadir:
        blockdir = args.datadir
    elif sys.platform == "win32":
        blockdir = path.expandvars(r"%APPDATA%\Bitcoin")
    elif sys.platform.startswith("linux"):
        blockdir = path.expanduser("~/.bitcoin")
    elif sys.platform == "darwin":
        blockdir = path.expanduser("~/Library/Application Support/Bitcoin")
    else:
        sys.exit("Can't automatically determine Bitcoin data directory (use --datadir)")
    blockdir = path.join(blockdir, "blocks")


    addressset.create_address_db(args.dbfilename, blockdir, args.update, progress_bar=not args.no_progress)
