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

Function register_archive_format

Lib/shutil.py:1160–1179  ·  view source on GitHub ↗

Registers an archive format. name is the name of the format. function is the callable that will be used to create archives. If provided, extra_args is a sequence of (name, value) tuples that will be passed as arguments to the callable. description can be provided to describe the for

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

Source from the content-addressed store, hash-verified

1158 return formats
1159
1160def register_archive_format(name, function, extra_args=None, description=''):
1161 """Registers an archive format.
1162
1163 name is the name of the format. function is the callable that will be
1164 used to create archives. If provided, extra_args is a sequence of
1165 (name, value) tuples that will be passed as arguments to the callable.
1166 description can be provided to describe the format, and will be returned
1167 by the get_archive_formats() function.
1168 """
1169 if extra_args is None:
1170 extra_args = []
1171 if not callable(function):
1172 raise TypeError('The %s object is not callable' % function)
1173 if not isinstance(extra_args, (tuple, list)):
1174 raise TypeError('extra_args needs to be a sequence')
1175 for element in extra_args:
1176 if not isinstance(element, (tuple, list)) or len(element) !=2:
1177 raise TypeError('extra_args elements are : (arg_name, value)')
1178
1179 _ARCHIVE_FORMATS[name] = (function, extra_args, description)
1180
1181def unregister_archive_format(name):
1182 del _ARCHIVE_FORMATS[name]

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…