diff --git a/core/ArchiveExtractor.py b/core/ArchiveExtractor.py index edfced8b868343f0b7911b0a132f52a3cdfabbaa..6e1c1d31ce8d381c818e5c37aaba48c4199415e3 100755 --- a/core/ArchiveExtractor.py +++ b/core/ArchiveExtractor.py @@ -82,6 +82,9 @@ class ArchiveExtractor: self.extractor.set_timeout_millis(3000) self.logger.debug("Archive Extractor %s used."%self.extractor.name()) + # Get the attribute table + self.attr_table = self.extractor.getattnameall() + ##---------------------------------------------------------------------------## @staticmethod def dateparse(datestr): @@ -510,6 +513,29 @@ class ArchiveExtractor: return cdates + def findattr(self, pattern): + """ + Search for an attribute path using the pattern given. + Case insensitive. + + Parameters: + ----------- + pattern: str + Pattern to search, wildchar * accepted. + example "dg*dcct*current" + + Returns: + -------- + results: (str,) + List of string match + """ + keywords=pattern.lower().split('*') + + matches = [attr for attr in self.attr_table if all(k in attr.lower() for k in keywords)] + + return matches + + def infoattr(self, attribute): """ Get informations for an attribute and pack it into a python dict.