mirror of
https://github.com/ansible/awx.git
synced 2026-06-26 08:58:03 -02:30
move code linting to a stricter pep8-esque auto-formatting tool, black
This commit is contained in:
@@ -56,8 +56,7 @@ class SpecialInventoryHandler(logging.Handler):
|
||||
as opposed to ansible-runner
|
||||
"""
|
||||
|
||||
def __init__(self, event_handler, cancel_callback, job_timeout, verbosity,
|
||||
start_time=None, counter=0, initial_line=0, **kwargs):
|
||||
def __init__(self, event_handler, cancel_callback, job_timeout, verbosity, start_time=None, counter=0, initial_line=0, **kwargs):
|
||||
self.event_handler = event_handler
|
||||
self.cancel_callback = cancel_callback
|
||||
self.job_timeout = job_timeout
|
||||
@@ -89,12 +88,7 @@ class SpecialInventoryHandler(logging.Handler):
|
||||
msg = self.format(record)
|
||||
n_lines = len(msg.strip().split('\n')) # don't count line breaks at boundry of text
|
||||
dispatch_data = dict(
|
||||
created=now().isoformat(),
|
||||
event='verbose',
|
||||
counter=self.counter,
|
||||
stdout=msg,
|
||||
start_line=self._current_line,
|
||||
end_line=self._current_line + n_lines
|
||||
created=now().isoformat(), event='verbose', counter=self.counter, stdout=msg, start_line=self._current_line, end_line=self._current_line + n_lines
|
||||
)
|
||||
self._current_line += n_lines
|
||||
|
||||
@@ -120,10 +114,7 @@ if settings.COLOR_LOGS is True:
|
||||
|
||||
def format(self, record):
|
||||
message = logging.StreamHandler.format(self, record)
|
||||
return '\n'.join([
|
||||
self.colorize(line, record)
|
||||
for line in message.splitlines()
|
||||
])
|
||||
return '\n'.join([self.colorize(line, record) for line in message.splitlines()])
|
||||
|
||||
level_map = {
|
||||
logging.DEBUG: (None, 'green', True),
|
||||
@@ -132,6 +123,7 @@ if settings.COLOR_LOGS is True:
|
||||
logging.ERROR: (None, 'red', True),
|
||||
logging.CRITICAL: (None, 'red', True),
|
||||
}
|
||||
|
||||
except ImportError:
|
||||
# logutils is only used for colored logs in the dev environment
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user