diff options
author | Bruce Mitchener <bruce.mitchener@gmail.com> | 2015-11-05 23:57:33 +0000 |
---|---|---|
committer | Bruce Mitchener <bruce.mitchener@gmail.com> | 2015-11-05 23:57:33 +0000 |
commit | a18231a5e9e996528eb22a7ef03852ddce021c20 (patch) | |
tree | e091054527263d0449bde5ae0bd5c0b12543831a /lldb/scripts/utilsDebug.py | |
parent | a1d960ef5456de31266258800ff2649e09bc75a4 (diff) | |
download | bcm5719-llvm-a18231a5e9e996528eb22a7ef03852ddce021c20.tar.gz bcm5719-llvm-a18231a5e9e996528eb22a7ef03852ddce021c20.zip |
[swig] Start of pylint on python build scripts.
Summary:
This does a broad first pass on cleaning up a lot of the noise when
using pylint on these scripts. It mostly addresses issues of:
* Mixed tabs and spaces.
* Trailing whitespace.
* Semicolons where they aren't needed.
* Incorrect whitespace around () and [].
* Superfluous parentheses.
There will be subsequent patches with further changes that build
upon these.
Reviewers: zturner, domipheus
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D14375
llvm-svn: 252244
Diffstat (limited to 'lldb/scripts/utilsDebug.py')
-rw-r--r-- | lldb/scripts/utilsDebug.py | 215 |
1 files changed, 105 insertions, 110 deletions
diff --git a/lldb/scripts/utilsDebug.py b/lldb/scripts/utilsDebug.py index 9aae22e24af..4b5eb7fa3e7 100644 --- a/lldb/scripts/utilsDebug.py +++ b/lldb/scripts/utilsDebug.py @@ -1,19 +1,17 @@ """ Utility module to help debug Python scripts - -------------------------------------------------------------------------- - File: utilsDebug.py + -------------------------------------------------------------------------- + File: utilsDebug.py - Overview: Python module to supply functions to help debug Python - scripts. - - Gotchas: None. - - Copyright: None. - -------------------------------------------------------------------------- - + Overview: Python module to supply functions to help debug Python + scripts. + Gotchas: None. + Copyright: None. + -------------------------------------------------------------------------- """ # Python modules: +import sys # Third party modules: @@ -22,104 +20,101 @@ # Instantiations: #----------------------------------------------------------------------------- -# Details: Class to implement simple stack function trace. Instantiation the -# class as the first function you want to trace. Example: -# obj = utilsDebug.CDebugFnVerbose( "validate_arguments()" ); -# Gotchas: This class will not work in properly in a multi-threaded -# environment. -# Authors: Illya Rudkin 28/11/2013. -# Changes: None. +# Details: Class to implement simple stack function trace. Instantiation the +# class as the first function you want to trace. Example: +# obj = utilsDebug.CDebugFnVerbose("validate_arguments()") +# Gotchas: This class will not work in properly in a multi-threaded +# environment. +# Authors: Illya Rudkin 28/11/2013. +# Changes: None. #-- -class CDebugFnVerbose: - # Public static properties: - bVerboseOn = False; # True = turn on function tracing, False = turn off. - - # Public: - #++------------------------------------------------------------------------ - # Details: CDebugFnVerbose constructor. - # Type: Method. - # Args: vstrFnName - (R) Text description i.e. a function name. - # Return: None. - # Throws: None. - #-- - # CDebugFnVerbose( vstrFnName ) - - #++------------------------------------------------------------------------ - # Details: Print out information on the object specified. - # Type: Method. - # Args: vstrText - (R) Some helper text description. - # vObject - (R) Some Python type object. - # Return: None. - # Throws: None. - #-- - def dump_object( self, vstrText, vObject ): - if CDebugFnVerbose.bVerboseOn == False: - return; - sys.stdout.write("%d%s> Dp: %s" % (CDebugFnVerbose.__nLevel, self.__get_dots(), - vstrText)); - print(vObject); - - #++------------------------------------------------------------------------ - # Details: Print out some progress text given by the client. - # Type: Method. - # Args: vstrText - (R) Some helper text description. - # Return: None. - # Throws: None. - #-- - def dump_text( self, vstrText ): - if CDebugFnVerbose.bVerboseOn == False: - return; - print(("%d%s> Dp: %s" % (CDebugFnVerbose.__nLevel, self.__get_dots(), - vstrText))); - - # Private methods: - def __init__( self, vstrFnName ): - self.__indent_out( vstrFnName ); - - #++------------------------------------------------------------------------ - # Details: Build an indentation string of dots based on the __nLevel. - # Type: Method. - # Args: None. - # Return: Str - variable length string. - # Throws: None. - #-- - def __get_dots( self ): - return "".join( "." for i in range( 0, CDebugFnVerbose.__nLevel ) ); - - #++------------------------------------------------------------------------ - # Details: Build and print out debug verbosity text indicating the function - # just exited from. - # Type: Method. - # Args: None. - # Return: None. - # Throws: None. - #-- - def __indent_back( self ): - if CDebugFnVerbose.bVerboseOn: - print(("%d%s< fn: %s" % (CDebugFnVerbose.__nLevel, self.__get_dots(), - self.__strFnName))); - CDebugFnVerbose.__nLevel -= 1; - - #++------------------------------------------------------------------------ - # Details: Build and print out debug verbosity text indicating the function - # just entered. - # Type: Method. - # Args: vstrFnName - (R) Name of the function entered. - # Return: None. - # Throws: None. - #-- - def __indent_out( self, vstrFnName ): - CDebugFnVerbose.__nLevel += 1; - self.__strFnName = vstrFnName; - if CDebugFnVerbose.bVerboseOn: - print(("%d%s> fn: %s" % ( CDebugFnVerbose.__nLevel, self.__get_dots(), - self.__strFnName))); - - # Private statics attributes: - __nLevel = 0; # Indentation level counter - - # Private attributes: - __strFnName = ""; - - - +class CDebugFnVerbose(object): + # Public static properties: + bVerboseOn = False # True = turn on function tracing, False = turn off. + + # Public: + #++------------------------------------------------------------------------ + # Details: CDebugFnVerbose constructor. + # Type: Method. + # Args: vstrFnName - (R) Text description i.e. a function name. + # Return: None. + # Throws: None. + #-- + # CDebugFnVerbose(vstrFnName) + + #++------------------------------------------------------------------------ + # Details: Print out information on the object specified. + # Type: Method. + # Args: vstrText - (R) Some helper text description. + # vObject - (R) Some Python type object. + # Return: None. + # Throws: None. + #-- + def dump_object(self, vstrText, vObject): + if CDebugFnVerbose.bVerboseOn == False: + return + sys.stdout.write("%d%s> Dp: %s" % (CDebugFnVerbose.__nLevel, self.__get_dots(), + vstrText)) + print(vObject) + + #++------------------------------------------------------------------------ + # Details: Print out some progress text given by the client. + # Type: Method. + # Args: vstrText - (R) Some helper text description. + # Return: None. + # Throws: None. + #-- + def dump_text(self, vstrText): + if CDebugFnVerbose.bVerboseOn == False: + return + print(("%d%s> Dp: %s" % (CDebugFnVerbose.__nLevel, self.__get_dots(), + vstrText))) + + # Private methods: + def __init__(self, vstrFnName): + self.__indent_out(vstrFnName) + + #++------------------------------------------------------------------------ + # Details: Build an indentation string of dots based on the __nLevel. + # Type: Method. + # Args: None. + # Return: Str - variable length string. + # Throws: None. + #-- + def __get_dots(self): + return "".join("." for i in range(0, CDebugFnVerbose.__nLevel)) + + #++------------------------------------------------------------------------ + # Details: Build and print out debug verbosity text indicating the function + # just exited from. + # Type: Method. + # Args: None. + # Return: None. + # Throws: None. + #-- + def __indent_back(self): + if CDebugFnVerbose.bVerboseOn: + print(("%d%s< fn: %s" % (CDebugFnVerbose.__nLevel, self.__get_dots(), + self.__strFnName))) + CDebugFnVerbose.__nLevel -= 1 + + #++------------------------------------------------------------------------ + # Details: Build and print out debug verbosity text indicating the function + # just entered. + # Type: Method. + # Args: vstrFnName - (R) Name of the function entered. + # Return: None. + # Throws: None. + #-- + def __indent_out(self, vstrFnName): + CDebugFnVerbose.__nLevel += 1 + self.__strFnName = vstrFnName + if CDebugFnVerbose.bVerboseOn: + print(("%d%s> fn: %s" % (CDebugFnVerbose.__nLevel, self.__get_dots(), + self.__strFnName))) + + # Private statics attributes: + __nLevel = 0 # Indentation level counter + + # Private attributes: + __strFnName = "" |