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='')
| 1278 | |
| 1279 | |
| 1280 | def 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 | |
| 1302 | def unregister_unpack_format(name): |
| 1303 | """Removes the pack format from the registry.""" |
searching dependent graphs…