text
stringlengths
0
828
lazy_mfcollection_parsing: bool = False)\
-> Dict[str, T]:
""""""
Utility method to create a RootParser() with default configuration and call its parse_collection() method
:param location:
:param base_item_type:
:param item_name_for_log:
:param file_mapping_conf:
:param logger:
:param lazy_mfcollection_parsing:
:return:
""""""
rp = _create_parser_from_default(logger)
opts = create_parser_options(lazy_mfcollection_parsing=lazy_mfcollection_parsing)
return rp.parse_collection(location, base_item_type, item_name_for_log=item_name_for_log,
file_mapping_conf=file_mapping_conf, options=opts)"
752,"def install_basic_multifile_support(self):
""""""
Utility method for users who created a RootParser with register_default_plugins=False, in order to register only
the multifile support
:return:
""""""
if not self.multifile_installed:
self.register_parser(MultifileCollectionParser(self))
self.register_parser(MultifileObjectParser(self, self))
self.multifile_installed = True
else:
raise Exception('Multifile support has already been installed')"
753,"def parse_collection(self, item_file_prefix: str, base_item_type: Type[T], item_name_for_log: str = None,
file_mapping_conf: FileMappingConfiguration = None,
options: Dict[str, Dict[str, Any]] = None) -> Dict[str, T]:
""""""
Main method to parse a collection of items of type 'base_item_type'.
:param item_file_prefix:
:param base_item_type:
:param item_name_for_log:
:param file_mapping_conf:
:param options:
:return:
""""""
# -- item_name_for_log
item_name_for_log = item_name_for_log or ''
check_var(item_name_for_log, var_types=str, var_name='item_name_for_log')
# creating the wrapping dictionary type
collection_type = Dict[str, base_item_type]
if len(item_name_for_log) > 0:
item_name_for_log = item_name_for_log + ' '
self.logger.debug('**** Starting to parse ' + item_name_for_log + 'collection of <'
+ get_pretty_type_str(base_item_type) + '> at location ' + item_file_prefix +' ****')
# common steps
return self._parse__item(collection_type, item_file_prefix, file_mapping_conf, options=options)"
754,"def parse_item(self, location: str, item_type: Type[T], item_name_for_log: str = None,
file_mapping_conf: FileMappingConfiguration = None, options: Dict[str, Dict[str, Any]] = None) -> T:
""""""
Main method to parse an item of type item_type
:param location:
:param item_type:
:param item_name_for_log:
:param file_mapping_conf:
:param options:
:return:
""""""
# -- item_name_for_log
item_name_for_log = item_name_for_log or ''
check_var(item_name_for_log, var_types=str, var_name='item_name_for_log')
if len(item_name_for_log) > 0:
item_name_for_log = item_name_for_log + ' '
self.logger.debug('**** Starting to parse single object ' + item_name_for_log + 'of type <'
+ get_pretty_type_str(item_type) + '> at location ' + location + ' ****')
# common steps
return self._parse__item(item_type, location, file_mapping_conf, options=options)"
755,"def _parse__item(self, item_type: Type[T], item_file_prefix: str,
file_mapping_conf: FileMappingConfiguration = None,
options: Dict[str, Dict[str, Any]] = None) -> T:
""""""
Common parsing steps to parse an item
:param item_type:
:param item_file_prefix:
:param file_mapping_conf:
:param options:
:return:
""""""
# for consistency : if options is None, default to the default values of create_parser_options
options = options or create_parser_options()
# creating the persisted object (this performs required checks)
file_mapping_conf = file_mapping_conf or WrappedFileMappingConfiguration()
obj = file_mapping_conf.create_persisted_object(item_file_prefix, logger=self.logger)
# print('')
self.logger.debug('')