MCPcopy
hub / github.com/pimutils/vdirsyncer / storage_instance_from_config

Function storage_instance_from_config

vdirsyncer/cli/utils.py:254–272  ·  view source on GitHub ↗

:param config: A configuration dictionary to pass as kwargs to the class corresponding to config['type']

(config, create=True)

Source from the content-addressed store, hash-verified

252
253
254def storage_instance_from_config(config, create=True):
255 '''
256 :param config: A configuration dictionary to pass as kwargs to the class
257 corresponding to config['type']
258 '''
259
260 cls, new_config = storage_class_from_config(config)
261
262 try:
263 return cls(**new_config)
264 except exceptions.CollectionNotFound as e:
265 if create:
266 config = handle_collection_not_found(
267 config, config.get('collection', None), e=str(e))
268 return storage_instance_from_config(config, create=False)
269 else:
270 raise
271 except Exception:
272 return handle_storage_init_error(cls, new_config)
273
274
275def handle_storage_init_error(cls, config):

Callers 6

_print_collectionsFunction · 0.85
sync_collectionFunction · 0.85
repair_collectionFunction · 0.85
metasync_collectionFunction · 0.85

Calls 4

getMethod · 0.45

Tested by 1