[pygccxml-commit] SF.net SVN: pygccxml: [426] pygccxml_dev/pygccxml/utils
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2006-08-20 19:54:09
|
Revision: 426 Author: roman_yakovenko Date: 2006-08-20 12:53:54 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=426&view=rev Log Message: ----------- adding documentation Modified Paths: -------------- pygccxml_dev/pygccxml/declarations/calldef.py pygccxml_dev/pygccxml/declarations/class_declaration.py pygccxml_dev/pygccxml/declarations/declaration.py pygccxml_dev/pygccxml/declarations/enumeration.py pygccxml_dev/pygccxml/declarations/namespace.py pygccxml_dev/pygccxml/declarations/scopedef.py pygccxml_dev/pygccxml/declarations/typedef.py pygccxml_dev/pygccxml/declarations/variable.py pygccxml_dev/pygccxml/utils/__init__.py Modified: pygccxml_dev/pygccxml/declarations/calldef.py =================================================================== --- pygccxml_dev/pygccxml/declarations/calldef.py 2006-08-20 19:15:31 UTC (rev 425) +++ pygccxml_dev/pygccxml/declarations/calldef.py 2006-08-20 19:53:54 UTC (rev 426) @@ -93,12 +93,7 @@ class calldef_t( declaration.declaration_t ): """base class for all "callable" declarations""" - def __init__( self - , name='' - , arguments=None - , exceptions=None - , return_type=None - , has_extern=False ): + def __init__( self, name='', arguments=None, exceptions=None, return_type=None, has_extern=False ): declaration.declaration_t.__init__( self, name ) if not arguments: arguments = [] @@ -111,9 +106,11 @@ self._demangled_name = None def _get__cmp__call_items(self): + """@undocumented _get__cmp__call_items:""" raise NotImplementedError() def _get__cmp__items( self ): + """@undocumented _get__cmp__items:""" items = [ self._sorted_list( self.arguments ) , self.return_type , self.has_extern @@ -183,6 +180,7 @@ """) def __remove_parent_fname( self, demangled ): + """@undocumented __remove_parent_fname:""" demangled = demangled.strip() parent_fname = algorithm.full_name( self.parent ) if parent_fname.startswith( '::' ) and not demangled.startswith( '::' ): @@ -276,6 +274,7 @@ return "%s [%s]"%(res, cls) def _get__cmp__call_items(self): + """@undocumented _get__cmp__call_items:""" return [ self.virtuality, self.has_static, self.has_const ] def __eq__(self, other): @@ -355,6 +354,7 @@ return "%s [%s]"%(res, cls) def _get__cmp__call_items(self): + """@undocumented _get__cmp__call_items:""" return [] def function_type(self): Modified: pygccxml_dev/pygccxml/declarations/class_declaration.py =================================================================== --- pygccxml_dev/pygccxml/declarations/class_declaration.py 2006-08-20 19:15:31 UTC (rev 425) +++ pygccxml_dev/pygccxml/declarations/class_declaration.py 2006-08-20 19:53:54 UTC (rev 426) @@ -81,6 +81,7 @@ declaration.declaration_t.__init__( self, name ) def _get__cmp__items(self): + """@undocumented _get__cmp__items:""" return [] class class_t( scopedef.scopedef_t ): @@ -124,6 +125,7 @@ return "%s [%s]"%(name, self.class_type) def _get__cmp__scope_items(self): + """@undocumented _get__cmp__scope_items:""" return [ self.class_type , self._sorted_list( [ algorithm.declaration_path( base.related_class ) for base in self.bases ] ) , self._sorted_list( [ algorithm.declaration_path( derive.related_class ) for derive in self.derived ] ) Modified: pygccxml_dev/pygccxml/declarations/declaration.py =================================================================== --- pygccxml_dev/pygccxml/declarations/declaration.py 2006-08-20 19:15:31 UTC (rev 425) +++ pygccxml_dev/pygccxml/declarations/declaration.py 2006-08-20 19:53:54 UTC (rev 426) @@ -99,18 +99,20 @@ @staticmethod def _sorted_list( some_list ): + """@undocumented _sorted_list:""" some_list.sort() return some_list def _get__cmp__items( self ): - """ - Every derived class should implement this method. This method should - return a list of items, that should be compared. - """ + """@undocumented _get__cmp__items:""" + #Every derived class should implement this method. This method should + #return a list of items, that should be compared. + print '_get__cmp__items not implemented for class ', self.__class__.__name__ raise NotImplemented() def _get__cmp__data(self): + """@undocumented _get__cmp__data:""" data = [ algorithm.declaration_path( self.parent ), self.name, self.location ] data.extend( self._get__cmp__items() ) return data Modified: pygccxml_dev/pygccxml/declarations/enumeration.py =================================================================== --- pygccxml_dev/pygccxml/declarations/enumeration.py 2006-08-20 19:15:31 UTC (rev 425) +++ pygccxml_dev/pygccxml/declarations/enumeration.py 2006-08-20 19:53:54 UTC (rev 426) @@ -43,6 +43,7 @@ return self.values == other.values def _get__cmp__items( self ): + """@undocumented _get__cmp__items:""" return [self.values] def _get_values(self): Modified: pygccxml_dev/pygccxml/declarations/namespace.py =================================================================== --- pygccxml_dev/pygccxml/declarations/namespace.py 2006-08-20 19:15:31 UTC (rev 425) +++ pygccxml_dev/pygccxml/declarations/namespace.py 2006-08-20 19:53:54 UTC (rev 426) @@ -28,6 +28,7 @@ return "%s [namespace]"%name def _get__cmp__scope_items(self): + """@undocumented _get__cmp__scope_items:""" return [ self._sorted_list( self.declarations ) ] def _get_declarations_impl(self): Modified: pygccxml_dev/pygccxml/declarations/scopedef.py =================================================================== --- pygccxml_dev/pygccxml/declarations/scopedef.py 2006-08-20 19:15:31 UTC (rev 425) +++ pygccxml_dev/pygccxml/declarations/scopedef.py 2006-08-20 19:53:54 UTC (rev 426) @@ -81,9 +81,11 @@ _logger = property( _get_logger ) def _get__cmp__scope_items(self): + """@undocumented _get__cmp__scope_items:""" raise NotImplementedError() def _get__cmp__items(self): + """@undocumented _get__cmp__items:""" items = [ self._sorted_list( self.declarations ) ] items.extend( self._get__cmp__scope_items() ) return items @@ -109,6 +111,7 @@ def __decl_types( self, decl ): + """@undocumented _get__cmp__items:""" types = [] bases = list( decl.__class__.__bases__ ) visited = set() @@ -187,6 +190,7 @@ self._optimized = True def _build_operator_name( self, name, function, symbol ): + """@undocumented _build_operator_name:""" def add_operator( sym ): if 'new' in sym or 'delete' in sym: return 'operator ' + sym @@ -204,24 +208,28 @@ def __normalize_args( self, **keywds ): + """@undocumented __normalize_args:""" if callable( keywds['name'] ) and None is keywds['function']: keywds['function'] = keywds['name'] keywds['name'] = None return keywds def __findout_recursive( self, **keywds ): + """@undocumented __findout_recursive:""" if None is keywds[ 'recursive' ]: return self.RECURSIVE_DEFAULT else: return keywds[ 'recursive' ] def __findout_allow_empty( self, **keywds ): + """@undocumented __findout_allow_empty:""" if None is keywds[ 'allow_empty' ]: return self.ALLOW_EMPTY_MDECL_WRAPPER else: return keywds[ 'allow_empty' ] def __findout_decl_type( self, match_class, **keywds ): + """@undocumented __findout_decl_type:""" if keywds.has_key( 'decl_type' ): return keywds['decl_type'] @@ -238,6 +246,7 @@ return None def __create_matcher( self, match_class, **keywds ): + """@undocumented __create_matcher:""" matcher_args = keywds.copy() del matcher_args['function'] del matcher_args['recursive'] @@ -253,6 +262,7 @@ return matcher def __findout_range( self, name, decl_type, recursive ): + """@undocumented __findout_range:""" if not self._optimized: self._logger.debug( 'running non optimized query - optimization has not been done' ) decls = self.declarations @@ -292,6 +302,7 @@ return self.declarations def _find_single( self, match_class, **keywds ): + """@undocumented _find_single:""" self._logger.debug( 'find single query execution - started' ) start_time = time.clock() norm_keywds = self.__normalize_args( **keywds ) @@ -304,6 +315,7 @@ return found def _find_multiple( self, match_class, **keywds ): + """@undocumented _find_multiple:""" self._logger.debug( 'find all query execution - started' ) start_time = time.clock() norm_keywds = self.__normalize_args( **keywds ) Modified: pygccxml_dev/pygccxml/declarations/typedef.py =================================================================== --- pygccxml_dev/pygccxml/declarations/typedef.py 2006-08-20 19:15:31 UTC (rev 425) +++ pygccxml_dev/pygccxml/declarations/typedef.py 2006-08-20 19:53:54 UTC (rev 426) @@ -17,6 +17,7 @@ self._type = type def _get__cmp__items( self ): + """@undocumented _get__cmp__items:""" return [self.type] def __eq__(self, other): Modified: pygccxml_dev/pygccxml/declarations/variable.py =================================================================== --- pygccxml_dev/pygccxml/declarations/variable.py 2006-08-20 19:15:31 UTC (rev 425) +++ pygccxml_dev/pygccxml/declarations/variable.py 2006-08-20 19:53:54 UTC (rev 426) @@ -13,7 +13,7 @@ """describes C++ global and member variable declaration""" def __init__( self, name='', type=None, type_qualifiers=None, value=None, bits=None): - """@undocumented __init__:""" + """creates class that describes C++ global or member variable""" declaration.declaration_t.__init__( self, name ) self._type = type self._type_qualifiers = type_qualifiers Modified: pygccxml_dev/pygccxml/utils/__init__.py =================================================================== --- pygccxml_dev/pygccxml/utils/__init__.py 2006-08-20 19:15:31 UTC (rev 425) +++ pygccxml_dev/pygccxml/utils/__init__.py 2006-08-20 19:53:54 UTC (rev 426) @@ -3,12 +3,18 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +""" +defines logger classes and few convinience methods, not related to the declarations +tree +""" + import os import sys import logging import tempfile def _create_logger_( name ): + """@undocumented _create_logger:""" logger = logging.getLogger(name) handler = logging.StreamHandler(sys.stdout) handler.setFormatter( logging.Formatter( os.linesep + '%(levelname)s %(message)s' ) ) @@ -17,22 +23,51 @@ return logger class loggers: - gccxml = _create_logger_( 'pygccxml.gccxml' ) + """class-namespace, defines few loggers classes, used in the project""" + + gccxml = _create_logger_( 'pygccxml.gccxml' ) + """logger for gccxml functionality + + If you set this logger level to DEBUG, you will be able to see the exact + command line, used to invoke GCC-XML and errors that occures during XML parsing + """ + queries_engine = _create_logger_( 'pygccxml.queries_engine' ) + """logger for query engine functionality. + + If you set this logger level to DEBUG, you will be able to see what queries + you do against declarations tree, measure performance and may be even to improve it. + Query engine reports queries and whether they are optimized or not. + """ + declarations_cache = _create_logger_( 'pygccxml.declarations_cache' ) - #root logger exists for configuration purpose only + """logger for declarations tree cache functionality + + If you set this logger level to DEBUG, you will be able to see what is exactly + happens, when you read the declarations from cache file. You will be able to + decide, whether it worse for you to use this or that cache strategy. + """ + root = logging.getLogger( 'pygccxml' ) + """root logger exists for your convinience only""" + all = [ root, gccxml, queries_engine, declarations_cache ] + """contains all logger classes, defined by the class""" def remove_file_no_raise(file_name ): + """removes file from disk, if exception is raised, it silently ignores it""" try: if os.path.exists(file_name): os.remove( file_name ) except Exception, error: - logger.error( "Error ocured while removing temprorary created file('%s'): %s" - % ( file_name, str( error ) ) ) + loggers.root.error( "Error ocured while removing temprorary created file('%s'): %s" + % ( file_name, str( error ) ) ) def create_temp_file_name(suffix, prefix=None, dir=None): + """small convinience function that creates temporal file. + + This function is a wrapper aroung Python built-in function - tempfile.mkstemp + """ if not prefix: prefix = tempfile.template fd, name = tempfile.mkstemp( suffix=suffix, prefix=prefix, dir=dir ) @@ -41,4 +76,5 @@ return name def normalize_path( some_path ): + """return os.path.normpath( os.path.normcase( some_path ) )""" return os.path.normpath( os.path.normcase( some_path ) ) \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |