Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_color(settings):
settings.no_colors = False
assert logs.color('red') == 'red'
settings.no_colors = True
assert logs.color('red') == ''
def is_match(self, command):
"""Returns `True` if rule matches the command.
:type command: Command
:rtype: bool
"""
if command.output is None and self.requires_output:
return False
try:
with logs.debug_time(u'Trying rule: {};'.format(self.name)):
if self.match(command):
return True
except Exception:
logs.rule_failed(self, sys.exc_info())
def stderr(self):
logs.warn('`stderr` is deprecated, please use `output` instead')
return self.output