Skip to content
Snippets Groups Projects
Commit c7036db2 authored by BRONES Romain's avatar BRONES Romain
Browse files

Add a find attribute feature

parent e8860782
No related branches found
No related tags found
No related merge requests found
...@@ -82,6 +82,9 @@ class ArchiveExtractor: ...@@ -82,6 +82,9 @@ class ArchiveExtractor:
self.extractor.set_timeout_millis(3000) self.extractor.set_timeout_millis(3000)
self.logger.debug("Archive Extractor %s used."%self.extractor.name()) self.logger.debug("Archive Extractor %s used."%self.extractor.name())
# Get the attribute table
self.attr_table = self.extractor.getattnameall()
##---------------------------------------------------------------------------## ##---------------------------------------------------------------------------##
@staticmethod @staticmethod
def dateparse(datestr): def dateparse(datestr):
...@@ -510,6 +513,29 @@ class ArchiveExtractor: ...@@ -510,6 +513,29 @@ class ArchiveExtractor:
return cdates 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): def infoattr(self, attribute):
""" """
Get informations for an attribute and pack it into a python dict. Get informations for an attribute and pack it into a python dict.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment