[pygccxml-commit] SF.net SVN: pygccxml:[1659]
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2009-02-05 14:12:10
|
Revision: 1659 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1659&view=rev Author: roman_yakovenko Date: 2009-02-05 14:12:02 +0000 (Thu, 05 Feb 2009) Log Message: ----------- sphinx Modified Paths: -------------- pydsc_dev/pydsc.py pydsc_dev/unittests/to_be_tested.py pygccxml_dev/pygccxml/declarations/call_invocation.py pygccxml_dev/pygccxml/declarations/container_traits.py pygccxml_dev/pygccxml/declarations/decl_printer.py pygccxml_dev/pygccxml/declarations/declaration.py pygccxml_dev/pygccxml/declarations/enumeration.py pygccxml_dev/pygccxml/declarations/function_traits.py pygccxml_dev/pygccxml/declarations/matchers.py pygccxml_dev/pygccxml/declarations/scopedef.py pygccxml_dev/pygccxml/declarations/type_traits.py pygccxml_dev/pygccxml/parser/__init__.py pygccxml_dev/pygccxml/parser/config.py pygccxml_dev/pygccxml/parser/declarations_cache.py pygccxml_dev/pygccxml/parser/directory_cache.py pygccxml_dev/pygccxml/parser/project_reader.py pygccxml_dev/pygccxml/parser/source_reader.py pygccxml_dev/unittests/data/core_cache.hpp pyplusplus_dev/contrib/pypp_api/pypp_api/argpolicy.py pyplusplus_dev/contrib/pypp_api/pypp_api/declwrapper.py pyplusplus_dev/contrib/pypp_api/pypp_api/filters.py pyplusplus_dev/contrib/pypp_api/pypp_api/modulebuilder.py pyplusplus_dev/contrib/pypp_api/pypp_api/treerange.py pyplusplus_dev/pyplusplus/__init__.py pyplusplus_dev/pyplusplus/_logging_/__init__.py pyplusplus_dev/pyplusplus/_logging_/multi_line_formatter.py pyplusplus_dev/pyplusplus/code_creators/code_creator.py pyplusplus_dev/pyplusplus/code_creators/compound.py pyplusplus_dev/pyplusplus/code_creators/include.py pyplusplus_dev/pyplusplus/code_creators/module.py pyplusplus_dev/pyplusplus/creators_factory/bpcreator.py pyplusplus_dev/pyplusplus/creators_factory/creators_wizard.py pyplusplus_dev/pyplusplus/creators_factory/ctypes_creator.py pyplusplus_dev/pyplusplus/creators_factory/dependencies_manager.py pyplusplus_dev/pyplusplus/creators_factory/sort_algorithms.py pyplusplus_dev/pyplusplus/decl_wrappers/algorithm.py pyplusplus_dev/pyplusplus/decl_wrappers/call_policies.py pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py pyplusplus_dev/pyplusplus/decl_wrappers/class_wrapper.py pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper_printer.py pyplusplus_dev/pyplusplus/decl_wrappers/enumeration_wrapper.py pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite1.py pyplusplus_dev/pyplusplus/decl_wrappers/namespace_wrapper.py pyplusplus_dev/pyplusplus/decl_wrappers/scopedef_wrapper.py pyplusplus_dev/pyplusplus/decl_wrappers/typedef_wrapper.py pyplusplus_dev/pyplusplus/decl_wrappers/variable_wrapper.py pyplusplus_dev/pyplusplus/file_writers/__init__.py pyplusplus_dev/pyplusplus/file_writers/multiple_files.py pyplusplus_dev/pyplusplus/file_writers/writer.py pyplusplus_dev/pyplusplus/function_transformers/controllers.py pyplusplus_dev/pyplusplus/messages/warnings_.py pyplusplus_dev/pyplusplus/module_builder/__init__.py pyplusplus_dev/pyplusplus/module_builder/boost_python_builder.py pyplusplus_dev/pyplusplus/module_builder/ctypes_builder.py pyplusplus_dev/pyplusplus/module_builder/module_builder.py pyplusplus_dev/unittests/autoconfig.py pyplusplus_dev/unittests/unicode_bug.py sphinx/conf.py Added Paths: ----------- pygccxml_dev/unittests/ignore_dictionary.txt pyplusplus_dev/unittests/ignore_dictionary.txt Modified: pydsc_dev/pydsc.py =================================================================== --- pydsc_dev/pydsc.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pydsc_dev/pydsc.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -25,9 +25,11 @@ import re import sys import pprint +import atexit import inspect import __builtin__ -from enchant import checker +import enchant +import enchant.checker def normalize_path( some_path ): """return os.path.normcase( os.path.normpath( some_path ) )""" @@ -48,6 +50,19 @@ #precondition: dirs and fpath should be normalize_path'ed before calling this function return bool( filter( lambda dir: path.startswith( dir ), dirs ) ) + +#~ class DynamicIdentifiersFilter( enchant.tokenize.Filter): + #~ _pattern = re.compile(r"^.+@[^\.].*\.[a-z]{2,}$") + #~ def __init__( self, *args, **keywd ): + #~ super( DynamicIdentifiersFilter, self ).__init__( self, *args, **keywd ) + #~ self.global_identifiers = set() + #~ self.local_identifiers = set() + + #~ def _skip(self,word): + #~ if self._pattern.match(word): + #~ return True + #~ return False + def is_identifier( word ): """ returns `True` is the word represents an identifier, constructed from two or more words, `False` otherwise. @@ -76,9 +91,9 @@ def __init__( self , speller - , writer=None + , writer=sys.stdout , ignore_identifiers=True - , text_preprocessor=None ): + , text_preprocessor=lambda t: t ): """ initialization method @@ -110,17 +125,15 @@ __builtin__.__import__ = self.import_ self.__already_imported = set( sys.modules.keys() ) self.__checked = set() + self.__reported_errors = set() self.speller = speller self.writer = writer - if self.writer is None: - self.writer = sys.stdout self.__include_paths = set() self.ignored_words = set() self.add_include_paths( '.') self.ignore_identifiers = ignore_identifiers self.text_preprocessor = text_preprocessor - if not self.text_preprocessor: - self.text_preprocessor = lambda t: t + atexit.register( self.report_statistics ) def add_include_paths( self, path ): np = lambda p: normalize_path( os.path.abspath( p ) ) @@ -190,8 +203,10 @@ def __check_text_impl( self, obj, text_, text_type ): text = self.text_preprocessor( text_ ) + if not text: return + if self.ignore_identifiers and hasattr( obj, '__name__' ) and obj.__name__: self.ignored_words.add( obj.__name__ ) @@ -204,25 +219,34 @@ continue if is_identifier( error.word ): continue - if not errors.has_key( error.word ): - errors[ error.word ] = [] + fpath = self.getsourcefile( inspect.getmodule( obj ) ) + if fpath: + error_id = "%s:%s:%d" % ( error.word, fpath, inspect.getsourcelines( obj )[1] ) + if error_id in self.__reported_errors: + continue + else: + self.__reported_errors.add( error_id ) errors[ error.word ] = self.speller.suggest() + if not errors: return + write = self.writer.write if self.getsourcefile( inspect.getmodule( obj ) ): write( ' error details: %s' % os.linesep ) - write( ' location : %s:%d%s' % ( self.getsourcefile( inspect.getmodule( obj ) ), 1 + inspect.getsourcelines( obj )[1], os.linesep ) ) - write( ' text type : %s%s' % ( text_type, os.linesep ) ) + write( ' location : %s:%d%s' % ( self.getsourcefile( inspect.getmodule( obj ) ), 1 + inspect.getsourcelines( obj )[1], os.linesep ) ) + write( ' text type : %s%s' % ( text_type, os.linesep ) ) else: write( ' error details: %s' % os.linesep ) - write( ' text type : %s%s' % ( text_type, os.linesep ) ) + write( ' text type : %s%s' % ( text_type, os.linesep ) ) for word, suggestions in errors.items(): - write( ' misspelled word: %s%s' % ( word, os.linesep ) ) - write( ' suggestions : %s%s' % ( `suggestions`, os.linesep ) ) - clean = lambda t: t.replace( '\n', ' ' ).replace( '\r', '' ) - write( ' source file text: %s\n' % clean( text_ ) ) - write( ' checked text : %s\n' % clean( text ) ) + write( ' misspelled word : %s%s' % ( word, os.linesep ) ) + write( ' suggestions : %s%s' % ( `suggestions`, os.linesep ) ) + if 1: #debug code + clean = lambda t: t.replace( '\n', ' ' ).replace( '\r', '' ) + write( ' source file text: %s\n' % clean( text_ ) ) + write( ' checked text : %s\n' % clean( text ) ) + write( ' object : %s\n' % str(obj) ) def __check_text( self, obj): self.__check_text_impl( obj, inspect.getdoc( obj ), 'documentation string' ) @@ -243,13 +267,31 @@ to_be_checked.extend( map( lambda x: x[1], inspect.getmembers( member ) ) ) self.__checked.add( id(member) ) + def report_statistics( self ): + words = {} + print '\n' + print 'pydsc report' + print ' errors found: ', len( self.__reported_errors ) + for error_id in self.__reported_errors: + word = error_id.split( ':' )[0] + if word not in words: + words[ word ] = [] + words[ word ].append( error_id[ len(word) + 1: ] ) + for word, occurs in words.iteritems(): + print ' ', word, ' - ', len( occurs ) + occurs.sort() + for location in occurs: + print ' ', location + print 'pydsc report - end' + + """documentation spell checker instance""" doc_checker = None -if 'PYDSC' in os.environ: - if not 'sphinx' in os.environ['PYDSC']: - doc_checker = checker_t( checker.SpellChecker( "en_US" )) #, filters=[checker.EmailFilter,checker.URLFilter] ) ) -else: - doc_checker = checker_t( checker.SpellChecker( "en_US" ))#, filters=[checker.EmailFilter,checker.URLFilter, checker.WikiWordFilter] ) ) +if not( ('PYDSC' in os.environ) and ('sphinx' in os.environ['PYDSC']) ): + doc_checker = checker_t( enchant.checker.SpellChecker( "en_US" + , filters=[ enchant.tokenize.EmailFilter + , enchant.tokenize.URLFilter + , enchant.tokenize.WikiWordFilter ] ) ) def include_paths( what ): @@ -295,20 +337,37 @@ def set_text_preprocessor( preprocessor ): doc_checker.text_preprocessor = preprocessor -__ref_def = re.compile( r':[_a-zA-Z]+(\s+[_a-zA-Z]+)?:' ) -__ref_no_title = re.compile( r'`(\:\:)?[_a-zA-Z]+[_a-zA-Z0-9\.\:]*`' ) -__ref_with_title = re.compile( r'`(?P<text>.+)?\s(\<.*\>)`' ) +class sphinx_preprocessor_t: + __ref_def = re.compile( r':[_a-zA-Z]+(\s+[_a-zA-Z0-9]+)?:' ) + __ref_no_title = re.compile( r'`(\:\:)?[_a-zA-Z]+[_a-zA-Z0-9\.\:\+]*`' ) + __ref_with_title = re.compile( r'`(?P<text>.+)?\s(\<.*\>)`' ) -def sphinx_preprocessor( text ): - def replace( m ): - if 'text' in m.groupdict(): - return ' ' * ( m.start( 'text' ) - m.start() ) + m.group( 'text' ) + ' ' * ( m.end() - m.end( 'text' ) ) - else: - return ' ' * ( m.end() - m.start() ) - if not text: - return text - result = text - result = __ref_no_title.sub( replace, result ) - result = __ref_def.sub( replace, result ) - result = __ref_with_title.sub( replace, result ) - return result + + def __replace_via_re( self, text ): + def replace( m ): + if 'text' in m.groupdict(): + return ' ' * ( m.start( 'text' ) - m.start() ) + m.group( 'text' ) + ' ' * ( m.end() - m.end( 'text' ) ) + else: + return ' ' * ( m.end() - m.start() ) + if not text: + return text + result = text + result = self.__ref_no_title.sub( replace, result ) + result = self.__ref_def.sub( replace, result ) + result = self.__ref_with_title.sub( replace, result ) + return result + + #~ def __remove_code_block( self, text ): + #~ lines = map( lambda line: line.rstrip(), text.split( '\n' ) ) + + #~ no_code_lines = [] + + #~ index = 0 + #~ within_block = False + #~ indent_level = 0 + #~ while index < len( lines ): + + def __call__( self, text ): + return self.__replace_via_re( text ) + +sphinx_preprocessor = sphinx_preprocessor_t() Modified: pydsc_dev/unittests/to_be_tested.py =================================================================== --- pydsc_dev/unittests/to_be_tested.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pydsc_dev/unittests/to_be_tested.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -10,7 +10,7 @@ """ code_creator_t is the base class for all code creators. This class defines interface that every code creator should implement. - Also it provides few convinience functions. + Also it provides few convenience functions. qeqerqwerqwerqwer Modified: pygccxml_dev/pygccxml/declarations/call_invocation.py =================================================================== --- pygccxml_dev/pygccxml/declarations/call_invocation.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pygccxml_dev/pygccxml/declarations/call_invocation.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -11,10 +11,10 @@ .. code-block:: c++ - do_smth( x1, x2, x3 ) + do_something( x1, x2, x3 ) the parser will extract -- function name - `do_stmh` +- function name - `do_something` - argument names - `[ x1, x2, x3 ]` """ Modified: pygccxml_dev/pygccxml/declarations/container_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/container_traits.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pygccxml_dev/pygccxml/declarations/container_traits.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -243,7 +243,7 @@ class container_traits_impl_t: - """this class implements the functionality needed for convinient work with + """this class implements the functionality needed for convenient work with STD container classes. Implemented functionality: Modified: pygccxml_dev/pygccxml/declarations/decl_printer.py =================================================================== --- pygccxml_dev/pygccxml/declarations/decl_printer.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pygccxml_dev/pygccxml/declarations/decl_printer.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -4,7 +4,7 @@ # http://www.boost.org/LICENSE_1_0.txt) """ -defines class, decl_printer_t that prints declarations tree in a user friendly format +defines class, :class:`decl_printer_t` that prints declarations tree in a user friendly format """ import os @@ -15,14 +15,8 @@ class decl_printer_t( decl_visitor.decl_visitor_t ): - """Helper class for printing decl tree. + """helper class for printing declarations tree""" - This class provides more information than the __str__() methods do. - The class is not just meant to provide a unique "id" for a declaration - but to inspect an entire declaration tree. This is particularly useful - for new users who want to find out how Py++ works and how it - stores its data. - """ JUSTIFY = 20 INDENT_SIZE = 4 @@ -125,7 +119,6 @@ self.writer( ' ' * curr_level * self.INDENT_SIZE + decorated_name + os.linesep) def print_calldef_info(self, decl=None): - """ Returns function signature: [retval, [arg1, ..., argN]]. """ if None is decl: decl = self.__inst @@ -277,9 +270,11 @@ , recursive=True , writer=lambda x: sys.stdout.write( x + os.linesep ) , verbose=True): - """ Print decl tree rooted at each of the included nodes. - decls - either a single decl or a list of decls. """ + print declarations tree rooted at each of the included nodes. + + :param decls: either a single :class:declaration_t object or list of :class:declaration_t objects + """ prn = decl_printer_t(0, detailed, recursive, writer, verbose=verbose) if type(decls) is not list: decls = [decls] Modified: pygccxml_dev/pygccxml/declarations/declaration.py =================================================================== --- pygccxml_dev/pygccxml/declarations/declaration.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pygccxml_dev/pygccxml/declarations/declaration.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -112,7 +112,7 @@ function will return true, if both declarations refers to the same object. This function could be implemented in terms of _get__cmp__data, but in this case it will downgrade performance. self.mangled property is not - compared, because it could be chaned from one compilation time to an + compared, because it could be changed from one compilation time to an other. """ if not isinstance( other, self.__class__ ): Modified: pygccxml_dev/pygccxml/declarations/enumeration.py =================================================================== --- pygccxml_dev/pygccxml/declarations/enumeration.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pygccxml_dev/pygccxml/declarations/enumeration.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -20,7 +20,7 @@ """creates class that describes C++ `enum` declaration The items of the list 'values' may either be strings containing - the enumeration value name or tuples (name, numvalue). + the enumeration value name or tuples (name, numeric value). :param name: `enum` name :type name: str Modified: pygccxml_dev/pygccxml/declarations/function_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/function_traits.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pygccxml_dev/pygccxml/declarations/function_traits.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -69,7 +69,7 @@ Use case: sometimes when user defines some virtual function in base class, it overrides it in a derived one. Sometimes we need to know whether two member - functions is actualy same function. + functions is actually same function. """ if f1 is f2: return True Modified: pygccxml_dev/pygccxml/declarations/matchers.py =================================================================== --- pygccxml_dev/pygccxml/declarations/matchers.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pygccxml_dev/pygccxml/declarations/matchers.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -46,11 +46,14 @@ return "base class for all matchers" class and_matcher_t(matcher_base_t): - """Combine several other matchers with "&". + """ + Combine several other matchers with "&" (and) operator. For example: find all private functions with name XXX - C{ matcher = access_type_matcher_t( 'private' ) & calldef_matcher_t( name='XXX' ) } + .. code-block:: python + + matcher = access_type_matcher_t( 'private' ) & calldef_matcher_t( name='XXX' ) """ def __init__(self, matchers): matcher_base_t.__init__(self) @@ -67,12 +70,14 @@ class or_matcher_t(matcher_base_t): - """Combine several other matchers with "|". + """Combine several other matchers with "|" (or) operator. For example: find all functions and variables with name 'XXX' - C{ matcher = variable_matcher_t( name='XXX' ) | calldef_matcher_t( name='XXX' ) } + .. code-block:: python + matcher = variable_matcher_t( name='XXX' ) | calldef_matcher_t( name='XXX' ) + """ def __init__(self, matchers): matcher_base_t.__init__(self) @@ -325,16 +330,20 @@ :param return_type: callable return type :type return_type: string or instance of :class:`type_t` derived class - :param arg_types: list of function argument types. arg_types can contain. + :param arg_types: list of function argument types. `arg_types` can contain. Any item within the list could be string or instance of :class:`type_t` derived class. If you don't want some argument to participate in match you can put None. For example: - C{ calldef_matcher_t( arg_types=[ 'int &', None ] ) } + .. code-block:: python + calldef_matcher_t( arg_types=[ 'int &', None ] ) + will match all functions that takes 2 arguments, where the first one is reference to integer and second any + :type arg_types: list + """ if None is decl_type: decl_type = calldef.calldef_t @@ -475,7 +484,7 @@ def __init__( self, access_type ): """ :param access_type: declaration access type - :type access_type: :class:ACCESS_TYPES defines few consts for your convinience. + :type access_type: :class:ACCESS_TYPES defines few constants for your convenience. Any way you can pass public, private or protected as argument to this function """ matcher_base_t.__init__( self ) Modified: pygccxml_dev/pygccxml/declarations/scopedef.py =================================================================== --- pygccxml_dev/pygccxml/declarations/scopedef.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pygccxml_dev/pygccxml/declarations/scopedef.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -455,7 +455,7 @@ , recursive=recursive ) def calldefs( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): - """returns a set of calldef declarations, that are matched defined criteria""" + """returns a set of :class:`calldef_t` declarations, that are matched defined criteria""" return self._find_multiple( self._impl_matchers[ scopedef_t.calldef ] , name=name , function=function Modified: pygccxml_dev/pygccxml/declarations/type_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/type_traits.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pygccxml_dev/pygccxml/declarations/type_traits.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -304,7 +304,7 @@ or does_match_definition( type, cpptypes.fundamental_t, (cpptypes.volatile_t, cpptypes.const_t) ) \ class declaration_xxx_traits: - """this class implements the functionality needed for convinient work with + """this class implements the functionality needed for convenient work with declaration classes Implemented functionality: @@ -333,7 +333,7 @@ return self.__apply_sequence( type_ ) enum_traits = declaration_xxx_traits( enumeration.enumeration_t ) -"""implements functionality, needed for convinient work with C++ enums""" +"""implements functionality, needed for convenient work with C++ enums""" is_enum = enum_traits.is_my_case """returns True, if type represents C++ enumeration declaration, False otherwise""" @@ -342,13 +342,13 @@ """returns reference to enum declaration""" class_traits = declaration_xxx_traits( class_declaration.class_t ) -"""implements functionality, needed for convinient work with C++ classes""" +"""implements functionality, needed for convenient work with C++ classes""" is_class = class_traits.is_my_case """returns True, if type represents C++ class definition, False otherwise""" class_declaration_traits = declaration_xxx_traits( class_declaration.class_declaration_t ) -"""implements functionality, needed for convinient work with C++ class declarations""" +"""implements functionality, needed for convenient work with C++ class declarations""" is_class_declaration = class_declaration_traits.is_my_case """returns True, if type represents C++ class declaration, False otherwise""" @@ -1007,11 +1007,11 @@ class smart_pointer_traits: - """implements functionality, needed for convinient work with smart pointers""" + """implements functionality, needed for convenient work with smart pointers""" @staticmethod def is_smart_pointer( type_ ): - """returns True, if type represents instantiation of C{boost::shared_ptr}, False otherwise""" + """returns True, if type represents instantiation of `boost::shared_ptr`, False otherwise""" type_ = remove_alias( type_ ) type_ = remove_cv( type_ ) type_ = remove_declarated( type_ ) @@ -1023,17 +1023,17 @@ @staticmethod def value_type( type_ ): - """returns reference to boost::shared_ptr value type""" + """returns reference to `boost::shared_ptr` value type""" if not smart_pointer_traits.is_smart_pointer( type_ ): raise TypeError( 'Type "%s" is not instantiation of boost::shared_ptr' % type_.decl_string ) return internal_type_traits.get_by_name( type_, "value_type" ) class auto_ptr_traits: - """implements functionality, needed for convinient work with std::auto_ptr pointers""" + """implements functionality, needed for convenient work with `std::auto_ptr` pointers""" @staticmethod def is_smart_pointer( type_ ): - """returns True, if type represents instantiation of C{boost::shared_ptr}, False otherwise""" + """returns True, if type represents instantiation of `boost::shared_ptr`, False otherwise""" type_ = remove_alias( type_ ) type_ = remove_cv( type_ ) type_ = remove_declarated( type_ ) @@ -1045,14 +1045,14 @@ @staticmethod def value_type( type_ ): - """returns reference to boost::shared_ptr value type""" + """returns reference to `boost::shared_ptr` value type""" if not auto_ptr_traits.is_smart_pointer( type_ ): raise TypeError( 'Type "%s" is not instantiation of std::auto_ptr' % type_.decl_string ) return internal_type_traits.get_by_name( type_, "element_type" ) def is_std_string( type_ ): - """returns True, if type represents C++ std::string, False otherwise""" + """returns True, if type represents C++ `std::string`, False otherwise""" decl_strings = [ '::std::basic_string<char,std::char_traits<char>,std::allocator<char> >' , '::std::basic_string<char, std::char_traits<char>, std::allocator<char> >' @@ -1064,7 +1064,7 @@ return remove_cv( type_ ).decl_string in decl_strings def is_std_wstring( type_ ): - """returns True, if type represents C++ std::wstring, False otherwise""" + """returns True, if type represents C++ `std::wstring`, False otherwise""" decl_strings = [ '::std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >' , '::std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >' Modified: pygccxml_dev/pygccxml/parser/__init__.py =================================================================== --- pygccxml_dev/pygccxml/parser/__init__.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pygccxml_dev/pygccxml/parser/__init__.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -45,7 +45,7 @@ :type compilation_mode: L{COMPILATION_MODE} :param cache: Declaration cache (None=no cache) :type cache: L{cache_base_t} or str - @returns: Declarations + :rtype: Declarations """ if not config: config = config_t() Modified: pygccxml_dev/pygccxml/parser/config.py =================================================================== --- pygccxml_dev/pygccxml/parser/config.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pygccxml_dev/pygccxml/parser/config.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -3,8 +3,9 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -"""This module contains the implementation of the L{config_t} class. """ +defines C++ parser configuration classes +""" import os import sys @@ -12,18 +13,19 @@ import types class parser_configuration_t(object): - """Configuration object to collect parameters for invoking C++ parser + """ + C++ parser configuration holder This class serves as a base class for the parameters that can be used - to customize the call to C++ parser. This class also allows users to work with - relative files paths. In this case files are searched in the following order: + to customize the call to a C++ parser. - 1. current directory + This class also allows users to work with relative files paths. In this case + files are searched in the following order: - 2. working directory + 1. current directory + 2. working directory + 3. additional include paths specified by the user - 3. additional include paths specified by the user - """ def __init__( self , working_directory='.' Modified: pygccxml_dev/pygccxml/parser/declarations_cache.py =================================================================== --- pygccxml_dev/pygccxml/parser/declarations_cache.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pygccxml_dev/pygccxml/parser/declarations_cache.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -57,9 +57,11 @@ raise NotImplementedError() def update(self, source_file, configuration, declarations, included_files): - """ Update cache entry. + """ + update cache entry + :param source_file: path to the C++ source file being parsed - :param configuration: configuration used in parsing (config_t) + :param configuration: configuration used in parsing :class:`config_t` :param declarations: declaration tree found when parsing :param included_files: files included by parsing. """ @@ -69,7 +71,7 @@ """ Return declarations, we have cached, for the source_file and the given configuration. :param source_file: path to the C++ source file being parsed. - :param configuration: configuration to use for parsing (config_t) + :param configuration: configuration( :class:`config_t` ) that was used for parsing """ raise NotImplementedError() @@ -199,9 +201,10 @@ self.__needs_flushed = True def cached_value(self, source_file, configuration): - """ Attempt to lookup the cached decls for the given file and configuration. - If not found or signature check fails, returns None. """ + attempt to lookup the cached declarations for the given file and configuration. + If not found or signature check fails, returns None. + """ key = record_t.create_key(source_file, configuration) if not self.__cache.has_key( key ): return None Modified: pygccxml_dev/pygccxml/parser/directory_cache.py =================================================================== --- pygccxml_dev/pygccxml/parser/directory_cache.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pygccxml_dev/pygccxml/parser/directory_cache.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -29,11 +29,10 @@ """ def __init__( self, filesigs, configsig ): - """Constructor. - - filesigs is a list of tuples (fileid, sig)... - configsig is the signature of the configuration object. """ + :param filesigs: a list of tuples( `fileid`, `sig`)... + :param configsig: the signature of the configuration object. + """ self.filesigs = filesigs self.configsig = configsig @@ -45,9 +44,9 @@ class directory_cache_t ( declarations_cache.cache_base_t ): - """Cache class that stores its data as multiple files inside a directory. + """cache class that stores its data as multiple files inside a directory. - The cache stores one index file called "index.dat" which is always + The cache stores one index file called `index.dat` which is always read by the cache when the cache object is created. Each header file will have its corresponding *.cache file that stores the declarations found in the header file. The index file is used to determine whether @@ -57,13 +56,13 @@ """ def __init__( self, dir="cache", compression=False, md5_sigs=True ): - """Constructor. + """ + :param dir: cache directory path, it is created, if it does not exist - dir is the cache directory (it is created if it does not exist). - If compression is set to True the cache files will be compressed - using gzip. - md5_sigs determines whether file modifications is checked by - computing a md5 digest or by checking the modification date. + :param compression: if `True`, the cache files will be compressed using `gzip` + + :param md5_sigs: `md5_sigs` determines whether file modifications is checked + by computing a `md5` digest or by checking the modification date """ declarations_cache.cache_base_t.__init__(self) @@ -102,20 +101,18 @@ def flush(self): """Save the index table to disk.""" - self._save() -# self.__filename_rep._dump() def update(self, source_file, configuration, declarations, included_files): """Replace a cache entry by a new value. - :param source_file: Header file name. + :param source_file: a C++ source file name. :type source_file: str - :param configuration: Configuration object. - :type configuration: L{config_t} - :param declarations: Declarations contained in the header file. + :param configuration: configuration object. + :type configuration: :class:config_t + :param declarations: declarations contained in the `source_file` :type declarations: picklable object - :param included_files: Dependent files + :param included_files: included files :type included_files: list of str """ # Normlize all paths... @@ -224,10 +221,10 @@ self.__modified_flag = False def _save(self): - """Save the cache index if it was modified. + """ + save the cache index, in case it was modified. - Saves the index table and the file name repository in the file - index.dat. + Saves the index table and the file name repository in the file `index.dat` """ if self.__modified_flag: self.__filename_rep.update_id_counter() @@ -236,13 +233,14 @@ self.__modified_flag = False def _read_file(self, filename): - """Read a Python object from a cache file. + """ + read a Python object from a cache file. Reads a pickled object from disk and returns it. :param filename: Name of the file that should be read. :type filename: str - @returns: Unpickled file contents + :rtype: object """ if self.__compression: f = gzip.GzipFile(filename, "rb") @@ -283,7 +281,7 @@ :param source_file: Header file name :type source_file: str :param key: Key value for the specified header file - :type key: hashable object + :type key: hash table object """ entry = self.__index.get(key) @@ -307,29 +305,30 @@ def _create_cache_key(self, source_file): - """Return the cache key for a header file. + """ + return the cache key for a header file. :param source_file: Header file name :type source_file: str - @returns: Key for the given header file - @rtype: str + :rtype: str """ path, name = os.path.split(source_file) return name+str(hash(path)) def _create_cache_filename(self, source_file): - """Return the cache file name for a header file. + """ + return the cache file name for a header file. :param source_file: Header file name :type source_file: str - @returns: Cache file name (*.cache) - @rtype: str + :rtype: str """ res = self._create_cache_key(source_file)+".cache" return os.path.join(self.__dir, res) def _create_config_signature(self, config): - """Return the signature for a config object. + """ + return the signature for a config object. The signature is computed as md5 digest of the contents of working_directory, include_paths, define_symbols and @@ -337,8 +336,7 @@ :param config: Configuration object :type config: L{config_t} - @returns: Signature - @rtype: str + :rtype: str """ m = hashlib.md5() m.update(config.working_directory) Modified: pygccxml_dev/pygccxml/parser/project_reader.py =================================================================== --- pygccxml_dev/pygccxml/parser/project_reader.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pygccxml_dev/pygccxml/parser/project_reader.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -18,35 +18,35 @@ class file_configuration_t( object ): """ - file_configuration_t - a class, that contains some data and description how - to treat the data. file_configuration_t can contain reference to the next types - of data: + source code location configuration. - 1) path to C++ source file + The class instance uses "variant" interface to represent the following data: - 2) path to `GCC-XML`_ generated XML file + 1) path to a C++ source file - 3) path to C++ source file and path to `GCC-XML`_ generated XML file + 2) path to GCC-XML generated XML file + 3) path to a C++ source file and path to GCC-XML generated file + In this case, if XML file does not exists, it will be created. Next time you will ask to parse the source file, the XML file will be used instead. Small tip: you can setup your makefile to delete XML files every time, - the relevant source file has changed. + the relevant source file was changed. 4) Python string, that contains valid C++ code - There are few functions, that will help you to construct file_configuration_t + There are few functions, that will help you to construct :class:`file_configuration_t` object: - * L{create_source_fc} + * :func:`create_source_fc` - * L{create_gccxml_fc} + * :func:`create_gccxml_fc` - * L{create_cached_source_fc} + * :func:`create_cached_source_fc` - * L{create_text_fc} + * :func:`create_text_fc` """ class CONTENT_TYPE: @@ -146,27 +146,18 @@ , content_type=file_configuration_t.CONTENT_TYPE.CACHED_SOURCE_FILE ) class project_reader_t: - """Parses header files and returns the contained declarations. - """ + """parses header files and returns the contained declarations""" + def __init__( self, config, cache=None, decl_factory=None): - """Constructor. + """ + :param config: GCCXML configuration + :type config: :class:config_t - config is a configuration object that contains the parameters - for invoking gccxml. cache specifies the cache to use for - caching declarations between separate runs. By default, no - cache is used. decl_factory is an object that must provide - the same interface than - L{decl_factory_t<declarations.decl_factory_t>}, i.e. there must - be a set of C{create_*} methods that return an instance of an - appropriate declaration class. By default, the declaration - classes defined in the L{declarations} package are used. + :param cache: declaration cache, by default a cache functionality will not be used + :type cache: :class:`cache_base_t` instance or `str` - :param config: Configuration object - :type config: L{config_t} - :param cache: Declaration cache (None=no cache) - :type cache: L{cache_base_t} or str - :param decl_factory: Custom declaration factory object or None - :type decl_factory: decl_factory_t + :param decl_factory: declaration factory + :type decl_factory: :class:`decl_factory_t` """ self.__config = config self.__dcache = None @@ -184,10 +175,10 @@ @staticmethod def get_os_file_names( files ): - """Returns a list of OS file names + """ + returns file names - :param files: list of strings or L{file_configuration_t} instances. - files could contain a mix of them + :param files: list of strings and\\or :class:`file_configuration_t` instances. :type files: list """ fnames = [] @@ -203,14 +194,15 @@ return fnames def read_files( self, files, compilation_mode=COMPILATION_MODE.FILE_BY_FILE): - """Parse header files. + """ + parses a set of files - :param files: list of strings or L{file_configuration_t} instances. - files could contain a mix of them + :param files: list of strings and\\or :class:`file_configuration_t` instances. :type files: list - :param compilation_mode: Determines whether the files are parsed individually or as one single chunk - :type compilation_mode: L{COMPILATION_MODE} - @returns: Declarations + + :param compilation_mode: determines whether the files are parsed individually or as one single chunk + :type compilation_mode: :class:`COMPILATION_MODE` + :rtype: [:class:`declaration_t`] """ if compilation_mode == COMPILATION_MODE.ALL_AT_ONCE \ and len( files ) == len( self.get_os_file_names(files) ): @@ -302,7 +294,7 @@ :param content: C/C++ source code. :type content: str - @returns: Declarations + :rtype: Declarations """ reader = source_reader.source_reader_t( self.__config, None, self.__decl_factory ) return reader.read_string( content ) Modified: pygccxml_dev/pygccxml/parser/source_reader.py =================================================================== --- pygccxml_dev/pygccxml/parser/source_reader.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pygccxml_dev/pygccxml/parser/source_reader.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -50,31 +50,31 @@ """ This class reads C++ source code and returns declarations tree. - This class is the only class that have an intime knowledge about GCC-XML. + This class is the only class that works with GCC-XML directly. + It has only one responsibility: it calls GCC-XML with a source file specified by user and creates declarations tree. The implementation of this class is split - to 2 classes: + to two classes: - 1. L{scanner_t} - this class scans the "XML" file, generated by GCC-XML and - creates `pygccxml`_ declarations and types classes. After the xml file has + 1. `scanner_t` - this class scans the "XML" file, generated by GCC-XML and + creates `pygccxml`_ declarations and types classes. After the XML file has been processed declarations and type class instances keeps references to each other using GCC-XML generated id's. - 2. L{linker_t} - this class contains logic for replacing GCC-XML generated + 2. `linker_t` - this class contains logic for replacing GCC-XML generated ids with references to declarations or type class instances. """ def __init__( self, config, cache=None, decl_factory=None ): """ - :param config: instance of L{config_t} class, that contains GCC-XML + :param config: instance of :class:`config_t` class, that contains GCC-XML configuration - :type config: L{config_t} :param cache: reference to cache object, that will be updated after file has been parsed. - :param cache: instance of class, that derives from {cache_base_t} + :type cache: instance of :class:`cache_base_t` class - :param decl_factory: declarations factory, if not given default - declarations factory L{decl_factory_t} will be used + :param decl_factory: declarations factory, if not given default declarations + factory( :class:`decl_factory_t` ) will be used """ self.logger = utils.loggers.cxx_parser self.__search_directories = [] Modified: pygccxml_dev/unittests/data/core_cache.hpp =================================================================== --- pygccxml_dev/unittests/data/core_cache.hpp 2009-02-04 16:32:04 UTC (rev 1658) +++ pygccxml_dev/unittests/data/core_cache.hpp 2009-02-05 14:12:02 UTC (rev 1659) @@ -22,4 +22,4 @@ #endif//__core_cache_hpp__ -//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch \ No newline at end of file +//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch//touch \ No newline at end of file Added: pygccxml_dev/unittests/ignore_dictionary.txt =================================================================== --- pygccxml_dev/unittests/ignore_dictionary.txt (rev 0) +++ pygccxml_dev/unittests/ignore_dictionary.txt 2009-02-05 14:12:02 UTC (rev 1659) @@ -0,0 +1,29 @@ +Yakovenko +org +www +txt +http +bool +const +JNI +jboolean +jbyte +jchar +jdouble +jfloat +jint +jlong +jshort +GCC +wchar +TODO +namespace +namespaces +str +pygccxml +GCCXML +gccxml +GCC +gcc +noncopyable +Bierbaum Modified: pyplusplus_dev/contrib/pypp_api/pypp_api/argpolicy.py =================================================================== --- pyplusplus_dev/contrib/pypp_api/pypp_api/argpolicy.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pyplusplus_dev/contrib/pypp_api/pypp_api/argpolicy.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -448,7 +448,7 @@ @param idx: Argument index of the original function @type idx: int - @returns: Returns the argument_t object that was removed (or None + :rtype: Returns the argument_t object that was removed (or None if idx is 0 and the function has no return type) """ if idx==0 and self.funcargs[0]==None: Modified: pyplusplus_dev/contrib/pypp_api/pypp_api/declwrapper.py =================================================================== --- pyplusplus_dev/contrib/pypp_api/pypp_api/declwrapper.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pyplusplus_dev/contrib/pypp_api/pypp_api/declwrapper.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -128,7 +128,7 @@ @param flag: Determines whether the declaration is actually exposed or ignored. @type flag: bool - @returns: Returns self + :rtype: Returns self @see: L{ignore()} """ if not flag: @@ -482,7 +482,7 @@ @type allow_empty: bool @param assert_count: Check the number of matched declarations in the resulting Decl object @type assert_count: int - @returns: Returns a Decl object that may reference an arbitrary number of declarations. + :rtype: Returns a Decl object that may reference an arbitrary number of declarations. @rtype: IDecl @see: Namespace(), Class(), Method(), Function(), Enum() """ @@ -602,7 +602,7 @@ See Decl() for a full description of this method. - @returns: Returns a Decl object that may reference an arbitrary number of declarations. + :rtype: Returns a Decl object that may reference an arbitrary number of declarations. @see: L{Decl()} """ return self.Decls(name=name, type=type|NAMESPACE, **args) @@ -692,7 +692,7 @@ def _checkOverloads(self): """Check if all contained declarations are from the same set of overloads. - @returns: True if all contained declarations are from the same set of overloads. + :rtype: True if all contained declarations are from the same set of overloads. @rtype: bool """ if len(self.decl_handles)==0: @@ -712,7 +712,7 @@ def _parseDefArgs(self, args): """Determine which of the args is the doc string, call policies and keywords argument. - @returns: Returns a tuple (doc, policies, keywords). + :rtype: Returns a tuple (doc, policies, keywords). """ if len(args)>3: raise ValueError, "Too many arguments (%d)"%len(args) @@ -802,7 +802,7 @@ describes the source code line that created this instance. funcname is None if the source code is not located inside a function. - @returns: (filename, funcname, linenr, sourceline) + :rtype: (filename, funcname, linenr, sourceline) @rtype: 4-tuple """ frame = inspect.currentframe() Modified: pyplusplus_dev/contrib/pypp_api/pypp_api/filters.py =================================================================== --- pyplusplus_dev/contrib/pypp_api/pypp_api/filters.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pyplusplus_dev/contrib/pypp_api/pypp_api/filters.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -44,7 +44,7 @@ @param txt: The string to match @type txt: str - @returns: True if txt matches the pattern + :rtype: True if txt matches the pattern """ if self.regexp==None: return txt==self.pattern @@ -83,7 +83,7 @@ A return value of None means the filter's range is unlimited. - @returns: Filter range or None + :rtype: Filter range or None @rtype: TreeRange """ return None @@ -109,7 +109,7 @@ always return False so the search algorithm may decide not to visit them at all to speed up the search. - @returns: None, an empty list or a list of tuples (parent, recursive). + :rtype: None, an empty list or a list of tuples (parent, recursive). """ return None Modified: pyplusplus_dev/contrib/pypp_api/pypp_api/modulebuilder.py =================================================================== --- pyplusplus_dev/contrib/pypp_api/pypp_api/modulebuilder.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pyplusplus_dev/contrib/pypp_api/pypp_api/modulebuilder.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -172,7 +172,7 @@ This method can be called anytime after initialization and all Template() calls have been made. - @returns: Returns the root of the declaration tree + :rtype: Returns the root of the declaration tree @rtype: L{IDecl<declwrapper.IDecl>} @postcondition: This class can act as a wrapper for namespace("::") and all declarations are set to be ignored. """ @@ -646,7 +646,7 @@ @param t: Time value in seconds @type t: float - @returns: The time as a string + :rtype: The time as a string @rtype: str """ if t<60: Modified: pyplusplus_dev/contrib/pypp_api/pypp_api/treerange.py =================================================================== --- pyplusplus_dev/contrib/pypp_api/pypp_api/treerange.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pyplusplus_dev/contrib/pypp_api/pypp_api/treerange.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -122,7 +122,7 @@ @param other: A simple range (parent, recursive). @type other: 2-tuple - @returns: The new root node. + :rtype: The new root node. @rtype: TreeRange """ @@ -147,7 +147,7 @@ @param simplerange: A simple range (parent, recursive). @type simplerange: 2-tuple - @returns: The new root node. + :rtype: The new root node. @rtype: TreeRange """ otherparent, otherrecursive = simplerange @@ -215,7 +215,7 @@ @param other: Another TreeRange object @type other: TreeRange - @returns: The new root node. + :rtype: The new root node. @rtype: TreeRange """ res = self @@ -231,7 +231,7 @@ @param simplerange: A simple range (parent, recursive). @type simplerange: 2-tuple - @returns: The new root node. + :rtype: The new root node. @rtype: TreeRange """ otherparent, otherrecursive = simplerange @@ -311,7 +311,7 @@ def _rangeRelationship(self, parent1, parent2): """Determines the relationship between two nodes. - @returns: Returns the relationship as an integer value: + :rtype: Returns the relationship as an integer value: - 0: The sub trees rooted at parent1 and parent2 are disjoint - 1: parent2 is below parent1 - 2: parent1 is below parent2 @@ -331,7 +331,7 @@ """Returns a list with all nodes from node to the root (including node). @precondition: node must have a parent attribute - @returns: Returns a list of nodes + :rtype: Returns a list of nodes @rtype: list """ res = [] Modified: pyplusplus_dev/pyplusplus/__init__.py =================================================================== --- pyplusplus_dev/pyplusplus/__init__.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pyplusplus_dev/pyplusplus/__init__.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -3,7 +3,7 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -"""Py++ - Boost.Python code generator +"""`Py++` - Boost.Python code generator ======================================== This package (together with the accompanying pygccxml package and @@ -19,7 +19,7 @@ finally written into one or more C++ source files, which can then be compiled to generate the final Python module. -If you are just starting with U{Py++<http://www.language-binding.net>}, +If you are just starting with U{`Py++`<http://www.language-binding.net>}, then consider to read documentation of L{module_builder} package. """ @@ -38,14 +38,14 @@ import pygccxml if not hasattr( pygccxml, '__revision__' ) or pygccxml.__revision__ < 1080: - msg = 'This revision of Py++ requieres pygccxml revision to be ' \ + msg = 'This revision of `Py++` requieres pygccxml revision to be ' \ 'greater or equal to %d. ' \ 'Please install right pygccxml version.' raise AssertionError( msg % pygccxml.__revision__ ) #Known issues: #3. -#~ > > 2. An other difference: when Py++ creates bindings for a set of +#~ > > 2. An other difference: when `Py++` creates bindings for a set of #~ > > declarations, it #~ > > should (?) see all declarations that are going to be exported: #~ > > reasons: Modified: pyplusplus_dev/pyplusplus/_logging_/__init__.py =================================================================== --- pyplusplus_dev/pyplusplus/_logging_/__init__.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pyplusplus_dev/pyplusplus/_logging_/__init__.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -46,12 +46,12 @@ module_builder = _create_logger_( 'pyplusplus.module_builder' ) """logger that in use by L{module_builder_t} class. - Just another logger. It exists mostly for Py++ developers. + Just another logger. It exists mostly for `Py++` developers. """ #root logger exists for configuration purpose only root = logging.getLogger( 'pyplusplus' ) - """root logger exists for your convinience only""" + """root logger exists for your convenience only""" all = [ root, file_writer, module_builder, declarations ] """contains all logger classes, defined by the class""" Modified: pyplusplus_dev/pyplusplus/_logging_/multi_line_formatter.py =================================================================== --- pyplusplus_dev/pyplusplus/_logging_/multi_line_formatter.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pyplusplus_dev/pyplusplus/_logging_/multi_line_formatter.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -13,7 +13,7 @@ """Custom log formatter to split long message into several lines. This formatter is used for the default stream handler that outputs - its messages to stdout. + its messages to `stdout`. """ def __init__(self, fmt=None, datefmt=None, width=None): @@ -38,13 +38,13 @@ def format(self, record): """This method overwrites the original one. - The first thing that is done in the original format() method - is the creation of the record.message attribute: + The first thing, that is done in the original format() method, is the + creation of the record.message attribute: record.message = record.getMessage() Now this method temporarily replaces the getMessage() method of - the record by a version that returns a pregenerated message that + the record by a version that returns a pre-generated message that spans several lines. Then the original format() method is called which will invoke the 'fake' method. """ @@ -68,10 +68,10 @@ msgline is a string containing a single message. It can either be a plain message string which is reformatted using the textwrap - module or it can be of the form <decl>;<msg> where <decl> is the - declaration string and <msg> an arbitrary message. Lines of this - form will be separated so that the declaration and the message - appear in individual text blocks, where every line of message will start + module or it can be of the form <declaration>;<message> where <declaration> + is the declaration string and <message> an arbitrary message. Lines of this + form will be separated so that the declaration and the message appear in + individual text blocks, where every line of message will start with '>' character. width is the maximum width of any text blocks (without indendation). @@ -81,13 +81,13 @@ if len( txts ) != 2: #If message is not in format we expected, just return it return os.linesep.join( textwrap.wrap( msgline, width ) ) - + lines = [ txts[0] ] #I don't want to break declaration string to few lines - + # Insert a separator if there are two parts (=decl and msg) # Apply the text wrapper to shorten the maximum line length wrapped_lines = textwrap.wrap( txts[1], width ) lines.extend( map( lambda s: "> " + s.strip(), wrapped_lines ) ) - + return os.linesep.join(lines) Modified: pyplusplus_dev/pyplusplus/code_creators/code_creator.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/code_creator.py 2009-02-04 16:32:04 UTC (rev 1658) +++ pyplusplus_dev/pyplusplus/code_creators/code_creator.py 2009-02-05 14:12:02 UTC (rev 1659) @@ -94,17 +94,15 @@ actually creates code and returns it. Return value of this function is string. - @rtype: str + :rtype: str """ raise NotImplementedError() def create(self): """ - this function should be used in order to get code that should be - generated. - - @returns: Returns a text block of C++ source code. - @rtype: str + generates source code + + :rtype: str """ code = self._create_impl() assert isinstance( code, types.StringTypes ) @@ -153,7 +151,7 @@ :param code: A code block with C++ source code. :type code: str - @rtype: str + :rtype: str """ assert isinstance( code, types.StringTypes ) return code.strip() @@ -167,8 +165,7 @@ :type code: str :param size: The number of indentation levels that the code is shifted :type size: int - @returns: Returns indented source code - @rtype: str + :rtype: str """ assert isinstance( code, types.StringTypes ) return code_creator_t.__INDENTATION * size\ @@ -182,7 +179,7 @@ :param code: C++ code block. :type code: str - @rtype: str + :rtype: str """ assert isinstance( code, types.StringTypes ) if code.startswith(code_creator_t.__INDENTATION): @@ -198,10 +195,10 @@ :param line: C++ source code :type line: str - ... [truncated message content] |