MCPcopy Index your code
hub / github.com/python/cpython / register_unpack_format

Function register_unpack_format

Lib/shutil.py:1280–1300  ·  view source on GitHub ↗

Registers an unpack format. `name` is the name of the format. `extensions` is a list of extensions corresponding to the format. `function` is the callable that will be used to unpack archives. The callable will receive archives to unpack. If it's unable to handle an archive, it

(name, extensions, function, extra_args=None,
                           description='')

Source from the content-addressed store, hash-verified

1278
1279
1280def register_unpack_format(name, extensions, function, extra_args=None,
1281 description=''):
1282 """Registers an unpack format.
1283
1284 `name` is the name of the format. `extensions` is a list of extensions
1285 corresponding to the format.
1286
1287 `function` is the callable that will be
1288 used to unpack archives. The callable will receive archives to unpack.
1289 If it's unable to handle an archive, it needs to raise a ReadError
1290 exception.
1291
1292 If provided, `extra_args` is a sequence of
1293 (name, value) tuples that will be passed as arguments to the callable.
1294 description can be provided to describe the format, and will be returned
1295 by the get_unpack_formats() function.
1296 """
1297 if extra_args is None:
1298 extra_args = []
1299 _check_unpack_options(extensions, function, extra_args)
1300 _UNPACK_FORMATS[name] = extensions, function, extra_args, description
1301
1302def unregister_unpack_format(name):
1303 """Removes the pack format from the registry."""

Callers 1

test_unpack_registryMethod · 0.90

Calls 1

_check_unpack_optionsFunction · 0.85

Tested by 1

test_unpack_registryMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…