Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def start(self, message = None):
if self._quiet:
return
if message is None:
message = ''
if self._colorize:
text = color(message, 'info')
self._spinner = Halo(spinner='bouncingBall', text = text)
self._spinner.start()
self._current_message = message
else:
msg(message)
def stop(self, message = None):
if self._quiet:
return
if self._colorize:
if self._current_message:
self._spinner.succeed(color(self._current_message, 'info', self._colorize))
self._spinner.stop()
self.start(message)
self._spinner.succeed(color(message, 'info', self._colorize))
self._spinner.stop()
self._current_message = ''
else:
if message:
msg(message)
def warn(self, message = None):
if self._quiet:
return
if self._colorize:
self._spinner.succeed(color(self._current_message, 'info', self._colorize))
self._spinner.stop()
self._spinner.warn(color(message, 'warn', self._colorize))
self._current_message = ''
else:
msg('WARNING: ' + message)
def fail(self, message = None):
if self._colorize:
self._spinner.fail(color(self._current_message, 'error', self._colorize))
self._spinner.stop()
self.start(message)
self._spinner.fail(color(message, 'error', self._colorize))
self._spinner.stop()
else:
msg('ERROR: ' + message)
def update(self, message = None):
if self._quiet:
return
if self._colorize:
if self._current_message:
self._spinner.succeed(color(self._current_message, 'info', self._colorize))
self._spinner.stop()
self.start(message)
else:
msg(message)
def fail(self, message = None):
if self._colorize:
self._spinner.fail(color(self._current_message, 'error', self._colorize))
self._spinner.stop()
self.start(message)
self._spinner.fail(color(message, 'error', self._colorize))
self._spinner.stop()
else:
msg('ERROR: ' + message)
def stop(self, message = None):
if self._quiet:
return
if self._colorize:
if self._current_message:
self._spinner.succeed(color(self._current_message, 'info', self._colorize))
self._spinner.stop()
self.start(message)
self._spinner.succeed(color(message, 'info', self._colorize))
self._spinner.stop()
self._current_message = ''
else:
if message:
msg(message)