@@ -78,8 +78,8 @@ def success(self, message):
7878
7979 def useColor (self ):
8080 """useColor will determine if color should be added
81- to a print. Will check if being run in a terminal, and
82- if has support for asci
81+ to a print. Will check if being run in a terminal, and
82+ if has support for asci
8383 """
8484 COLORIZE = get_user_color_preference ()
8585 if COLORIZE is not None :
@@ -94,7 +94,7 @@ def useColor(self):
9494
9595 def addColor (self , level , text ):
9696 """addColor to the prompt (usually prefix) if terminal
97- supports, and specified to do so
97+ supports, and specified to do so
9898 """
9999 if self .colorize :
100100 if level in self .colors :
@@ -103,7 +103,7 @@ def addColor(self, level, text):
103103
104104 def emitError (self , level ):
105105 """determine if a level should print to
106- stderr, includes all levels but INFO and QUIET
106+ stderr, includes all levels but INFO and QUIET
107107 """
108108 if level in [
109109 ABORT ,
@@ -126,20 +126,19 @@ def emitOutput(self, level):
126126 return False
127127
128128 def isEnabledFor (self , messageLevel ):
129- """check if a messageLevel is enabled to emit a level
130- """
129+ """check if a messageLevel is enabled to emit a level"""
131130 if messageLevel <= self .level :
132131 return True
133132 return False
134133
135134 def emit (self , level , message , prefix = None , color = None ):
136135 """emit is the main function to print the message
137- optionally with a prefix
136+ optionally with a prefix
138137
139- Arguments:
140- - level (int) : the level of the message
141- - message (str) : the message to print
142- - prefix (str) : a prefix for the message
138+ Arguments:
139+ - level (int) : the level of the message
140+ - message (str) : the message to print
141+ - prefix (str) : a prefix for the message
143142 """
144143 if color is None :
145144 color = level
@@ -172,15 +171,15 @@ def emit(self, level, message, prefix=None, color=None):
172171
173172 def write (self , stream , message ):
174173 """write will write a message to a stream,
175- first checking the encoding
174+ first checking the encoding
176175 """
177176 if isinstance (message , bytes ):
178177 message = message .decode ("utf-8" )
179178 stream .write (message )
180179
181180 def get_logs (self , join_newline = True ):
182181 """'get_logs will return the complete history, joined by newline
183- (default) or as is.
182+ (default) or as is.
184183 """
185184 if join_newline :
186185 return "\n " .join (self .history )
@@ -198,15 +197,14 @@ def show_progress(
198197 symbol = None ,
199198 ):
200199 """create a terminal progress bar, default bar shows for verbose+
201-
202- Parameters
203- ==========
204- iteration: current iteration (Int)
205- total: total iterations (Int)
206- length: character length of bar (Int)
200+
201+ Parameters
202+ ==========
203+ iteration: current iteration (Int)
204+ total: total iterations (Int)
205+ length: character length of bar (Int)
207206 """
208207 if not self .level == QUIET :
209-
210208 percent = 100 * (iteration / float (total ))
211209 progress = int (length * iteration // total )
212210
@@ -289,18 +287,17 @@ def debug(self, message):
289287 self .emit (DEBUG , message , "DEBUG" )
290288
291289 def is_quiet (self ):
292- """is_quiet returns true if the level is under 1
293- """
290+ """is_quiet returns true if the level is under 1"""
294291 if self .level < 1 :
295292 return False
296293 return True
297294
298295 # Terminal ------------------------------------------
299296
300297 def table (self , rows , col_width = 2 ):
301- """table will print a table of entries. If the rows is
302- a dictionary, the keys are interpreted as column names. if
303- not, a numbered list is used.
298+ """table will print a table of entries. If the rows is
299+ a dictionary, the keys are interpreted as column names. if
300+ not, a numbered list is used.
304301 """
305302
306303 labels = [str (x ) for x in range (1 , len (rows ) + 1 )]
@@ -317,9 +314,9 @@ def table(self, rows, col_width=2):
317314
318315def get_logging_level ():
319316 """get_logging_level will configure a logging to standard out based on
320- selected level, which should be in an environment variable called
321- MESSAGELEVEL. if MESSAGELEVEL is not set, the maximum level
322- (5) is assumed (all messages).
317+ selected level, which should be in an environment variable called
318+ MESSAGELEVEL. if MESSAGELEVEL is not set, the maximum level
319+ (5) is assumed (all messages).
323320 """
324321 level = os .environ .get ("CDB_MESSAGELEVEL" , INFO )
325322
@@ -361,7 +358,7 @@ def get_user_color_preference():
361358
362359def convert2boolean (arg ):
363360 """convert2boolean is used for environmental variables that must be
364- returned as boolean
361+ returned as boolean
365362 """
366363 if not isinstance (arg , bool ):
367364 return arg .lower () in ("yes" , "true" , "t" , "1" , "y" )
0 commit comments