<s> from . tags import TagPatterns <EOL> class Criticality ( object ) : <EOL> def __init__ ( self , critical_tags = None , non_critical_tags = None ) : <EOL> self . critical_tags = self . _get_tag_patterns ( critical_tags ) <EOL> self . non_critical_tags = self . _get_tag_patterns ( non_critical_tags ) <EOL> def _get_tag_patterns ( self , tags ) : <EOL> return TagPatterns ( tags ) if not isinstance ( tags , TagPatterns ) else tags <EOL> def tag_is_critical ( self , tag ) : <EOL> return self . critical_tags . match ( tag ) <EOL> def tag_is_non_critical ( self , tag ) : <EOL> return self . non_critical_tags . match ( tag ) <EOL> def test_is_critical ( self , test ) : <EOL> if self . critical_tags and not self . critical_tags . match ( test . tags ) : <EOL> return False <EOL> return not self . non_critical_tags . match ( test . tags ) <EOL> def __nonzero__ ( self ) : <EOL> return bool ( self . critical_tags or self . non_critical_tags ) </s>
