MCPcopy Index your code
hub / github.com/RustPython/RustPython / register_unpack_format

Function register_unpack_format

Lib/shutil.py:1277–1297  ·  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

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