示例#1
0
文件: main.py 项目: threathive/sflock
def unpack(filepath=None,
           contents=None,
           password=None,
           filename=None,
           duplicates=None):
    """Unpacks the file or contents provided."""
    if duplicates is None:
        duplicates = []

    if six.PY3:
        if isinstance(filepath, str) or isinstance(contents, str):
            raise IncorrectUsageException

        if isinstance(filename, str):
            raise IncorrectUsageException

    if contents:
        f = File(filepath, contents, filename=filename)
    else:
        f = File.from_path(filepath, filename=filename)

    Unpacker.single(f, password, duplicates)

    ident(f)
    return f
示例#2
0
def unpack(filepath=None,
           contents=None,
           password=None,
           filename=None,
           duplicates=None):
    """Unpacks the file or contents provided."""
    if duplicates is None:
        duplicates = []

    if contents:
        f = File(filepath, contents, filename=filename)
    else:
        f = File.from_path(filepath, filename=filename)

    Unpacker.single(f, password, duplicates)

    ident(f)
    return f