def __init__(self, **kwargs): """Constructor :param use_additional_data: if set to True additional data which does not have equivalent in new HEPData format will be appended to comment section of the output document :type use_additional_data: bool :param strict: if set to True, any additional keywords (not specified by documentation) will raise BadFormat exception during parsing :type strict: bool """ # mapping of OLD HepData format's keywords to proper parsing functions # all possible keywords are specified here, the ones which aren't used # by new data format are either mapped to _pass method which does nothing, # or bound to _add_to_comment which adds the specified data to comment section of the # output # functions are specified by states in which parser may be, it may either be parsing table or document # for those two states different sets of directives are permitted self.mapping = { 'document': { 'reference': self._parse_reference, 'dataset': self._set_table, # additional data which have no one to one mapping to new YAML format 'author': self._bind_parse_additional_data('author'), 'doi': self._bind_parse_additional_data('doi'), 'status': self._bind_parse_additional_data('status'), 'experiment': self._bind_parse_additional_data('experiment'), 'detector': self._bind_parse_additional_data('detector'), 'title': self._bind_parse_additional_data('title'), # add it to record_ids 'spiresId': self._bind_parse_record_ids('spires'), 'inspireId': self._bind_parse_record_ids('inspire'), 'cdsId': self._bind_parse_record_ids('cds'), 'durhamId': self._bind_parse_record_ids('durham'), 'comment': self._parse_document_comment, 'E': self._pass }, 'table': { 'dataend': self._set_document, 'location': self._bind_set_table_metadata('location'), 'dscomment': self._bind_set_table_metadata('description', True), 'dserror': self._parse_dserror, 'reackey': self._parse_reackey, 'qual': self._parse_qual, 'data': self._parse_table_data, 'xheader': self._parse_xheaders, 'yheader': self._parse_yheaders, 'obskey': self._parse_obskey, 'phrase': self._parse_phrase, 'E': self._pass } } OptionInitMixin.__init__(self, options=kwargs)
def __init__(self, *args, **kwargs): OptionInitMixin.__init__(self, options=kwargs)
def __init__(self, single_file_output, *args, **kwargs): OptionInitMixin.__init__(self, options=kwargs) self.single_file_output = single_file_output self.hepdata_doi = kwargs[ 'hepdata_doi'] if 'hepdata_doi' in kwargs else ''
def __init__(self, single_file_output, *args, **kwargs): OptionInitMixin.__init__(self, options=kwargs) self.single_file_output = single_file_output self.hepdata_doi = kwargs["hepdata_doi"] if "hepdata_doi" in kwargs else ""
def __init__(self, single_file_output, *args, **kwargs): OptionInitMixin.__init__(self, options=kwargs) self.single_file_output = single_file_output self.hepdata_doi = kwargs['hepdata_doi'].encode( 'utf8', 'replace') if 'hepdata_doi' in kwargs else ''