On this page
  1. shutil.register_unpack_format
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

shutil.register_unpack_format

Prev: shutil.register_archive_format | Up: shutil | Next: shutil.rmtree
Rel: shutil.chown, shutil.copy, shutil.copy2, shutil.copyfile
Ref: docs.python.org — shutil.register_unpack_format
Tags: #public #python3 #stdlib #shutil


Import

import shutil
from shutil import register_unpack_format

Signature & Overview

shutil.register_unpack_format(name, extensions, function, extra_args=None, description='')

Registers an unpack format.

Usage

import shutil

def dummy_unpack(filename, extract_dir, **kwargs):
    pass

shutil.register_unpack_format("custom_demo", [".cdemo"], dummy_unpack)
try:
    names = [n for n, _, _ in shutil.get_unpack_formats()]
    assert "custom_demo" in names
finally:
    shutil.unregister_unpack_format("custom_demo")

Gotchas

REPL Inspect

from shutil import register_unpack_format
help(register_unpack_format)

Linked from

Related notes