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

Function _check_unpack_options

Lib/shutil.py:1259–1274  ·  view source on GitHub ↗

Checks what gets registered as an unpacker.

(extensions, function, extra_args)

Source from the content-addressed store, hash-verified

1257 return formats
1258
1259def _check_unpack_options(extensions, function, extra_args):
1260 """Checks what gets registered as an unpacker."""
1261 # first make sure no other unpacker is registered for this extension
1262 existing_extensions = {}
1263 for name, info in _UNPACK_FORMATS.items():
1264 for ext in info[0]:
1265 existing_extensions[ext] = name
1266
1267 for extension in extensions:
1268 if extension in existing_extensions:
1269 msg = '%s is already registered for "%s"'
1270 raise RegistryError(msg % (extension,
1271 existing_extensions[extension]))
1272
1273 if not callable(function):
1274 raise TypeError('The registered function must be a callable')
1275
1276
1277def register_unpack_format(name, extensions, function, extra_args=None,

Callers 1

register_unpack_formatFunction · 0.85

Calls 3

RegistryErrorClass · 0.85
callableFunction · 0.85
itemsMethod · 0.45

Tested by

no test coverage detected