Example #1
0
    def __init__(self, regexstring, *args, **kwargs):
        """Initialize the attribute with a glob filter
		:param regexstring: i.e. .*\..* or .*\.py or ^base_.*\.pyo"""
        import re

        self.regex = re.compile(regexstring)
        Attribute.__init__(self, *args, **kwargs)
Example #2
0
    def compatabilityRate(self, value):
        """:return: rate of base class provided that the regex matches, 0 otherwise"""
        rate = Attribute.compatabilityRate(self, value)  # get default rate
        if not rate:
            return rate

        if self.regex.match(str(value)):  # apply regex
            return rate

        return 0
Example #3
0
    def compatabilityRate(self, value):
        """:return: rate of base class provided that the regex matches, 0 otherwise"""
        rate = Attribute.compatabilityRate(self, value)  # get default rate
        if not rate:
            return rate

        if self.regex.match(str(value)):  # apply regex
            return rate

        return 0
Example #4
0
    def __init__(self, regexstring, *args, **kwargs):
        """Initialize the attribute with a glob filter
		:param regexstring: i.e. .*\..* or .*\.py or ^base_.*\.pyo"""
        import re
        self.regex = re.compile(regexstring)
        Attribute.__init__(self, *args, **kwargs)