[pygccxml-commit] SF.net SVN: pygccxml: [399] pydsc_dev/pydsc
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2006-08-14 07:06:22
|
Revision: 399 Author: roman_yakovenko Date: 2006-08-14 00:05:16 -0700 (Mon, 14 Aug 2006) ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=399&view=rev Log Message: ----------- fixing errors\warnings reported by pychecker Modified Paths: -------------- pydsc_dev/pydsc/pydsc.py pydsc_dev/unittests/to_be_tested.py pygccxml_dev/pygccxml/declarations/algorithm.py pygccxml_dev/pygccxml/declarations/cpptypes.py pygccxml_dev/pygccxml/declarations/declaration.py pygccxml_dev/pygccxml/declarations/filtering.py pygccxml_dev/pygccxml/declarations/matcher.py pygccxml_dev/pygccxml/declarations/pattern_parser.py pygccxml_dev/pygccxml/declarations/scopedef.py pygccxml_dev/pygccxml/declarations/type_traits.py pygccxml_dev/pygccxml/parser/declarations_cache.py pygccxml_dev/pygccxml/parser/project_reader.py pygccxml_dev/unittests/autoconfig.py pygccxml_dev/unittests/core_tester.py pygccxml_dev/unittests/declaration_files_tester.py pygccxml_dev/unittests/file_cache_tester.py pygccxml_dev/unittests/hierarchy_traveling.py pyplusplus_dev/examples/pyeasybmp_dev/pyeasybmp/environment.py pyplusplus_dev/pyplusplus/code_creators/algorithm.py pyplusplus_dev/pyplusplus/code_creators/calldef.py pyplusplus_dev/pyplusplus/code_creators/class_declaration.py pyplusplus_dev/pyplusplus/code_creators/code_creator.py pyplusplus_dev/pyplusplus/code_creators/compound.py pyplusplus_dev/pyplusplus/code_creators/include_directories.py pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py pyplusplus_dev/pyplusplus/code_creators/module.py pyplusplus_dev/pyplusplus/decl_wrappers/algorithm.py pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite1.py pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py pyplusplus_dev/pyplusplus/file_writers/multiple_files.py pyplusplus_dev/pyplusplus/file_writers/writer.py pyplusplus_dev/pyplusplus/gui/ui.py pyplusplus_dev/pyplusplus/module_builder/builder.py pyplusplus_dev/pyplusplus/module_creator/class_organizer.py pyplusplus_dev/pyplusplus/module_creator/creator.py pyplusplus_dev/pyplusplus/module_creator/types_database.py pyplusplus_dev/pyplusplus/utils/__init__.py pyplusplus_dev/unittests/algorithms_tester.py pyplusplus_dev/unittests/autoconfig.py Modified: pydsc_dev/pydsc/pydsc.py =================================================================== --- pydsc_dev/pydsc/pydsc.py 2006-08-13 19:56:30 UTC (rev 398) +++ pydsc_dev/pydsc/pydsc.py 2006-08-14 07:05:16 UTC (rev 399) @@ -73,7 +73,6 @@ import inspect import __builtin__ from enchant import checker -from sets import Set as set #TODO: source code encoding Modified: pydsc_dev/unittests/to_be_tested.py =================================================================== --- pydsc_dev/unittests/to_be_tested.py 2006-08-13 19:56:30 UTC (rev 398) +++ pydsc_dev/unittests/to_be_tested.py 2006-08-14 07:05:16 UTC (rev 399) @@ -74,6 +74,7 @@ assert isinstance( code, types.StringTypes ) return code.strip() + @staticmethod def indent( code, size=1 ): """ function that implements code indent algorithm. @@ -82,8 +83,8 @@ return code_creator_t.__INDENTATION * size\ + code.replace( os.linesep , os.linesep + code_creator_t.__INDENTATION * size ) - indent = staticmethod( indent ) + @staticmethod def unindent( code ): """ function that implements code unindent algorithm. @@ -93,9 +94,8 @@ code = code[ len( code_creator_t.__INDENTATION ):] return code.replace( os.linesep + code_creator_t.__INDENTATION , os.linesep ) - unindent = staticmethod( unindent ) - #xyz + @staticmethod def is_comment( line ): """ function that returns true if content of the line is comment, otherwise @@ -105,4 +105,3 @@ l = line.lstrip() #1q2w3e4r-------------- return l.startswith( '//' ) or l.startswith( '/*' ) - is_comment = staticmethod( is_comment ) \ No newline at end of file Modified: pygccxml_dev/pygccxml/declarations/algorithm.py =================================================================== --- pygccxml_dev/pygccxml/declarations/algorithm.py 2006-08-13 19:56:30 UTC (rev 398) +++ pygccxml_dev/pygccxml/declarations/algorithm.py 2006-08-14 07:05:16 UTC (rev 399) @@ -6,7 +6,6 @@ """defines few unrelated algorithms, that works on declarations""" import types -from sets import Set as set def declaration_path( decl ): """ Modified: pygccxml_dev/pygccxml/declarations/cpptypes.py =================================================================== --- pygccxml_dev/pygccxml/declarations/cpptypes.py 2006-08-13 19:56:30 UTC (rev 398) +++ pygccxml_dev/pygccxml/declarations/cpptypes.py 2006-08-14 07:05:16 UTC (rev 399) @@ -379,6 +379,7 @@ type_t.__init__(self) calldef_type_t.__init__( self, return_type, arguments_types ) + @staticmethod def create_decl_string( return_type, arguments_types ): """ returns free function type @@ -393,8 +394,7 @@ return free_function_type_t.NAME_TEMPLATE % { 'return_type' : return_type.decl_string , 'arguments' : ','.join( map( lambda x: x.decl_string, arguments_types ) ) } - create_decl_string = staticmethod( create_decl_string ) - + def _create_decl_string(self): return self.create_decl_string( self.return_type, self.arguments_types ) @@ -465,6 +465,7 @@ , self.has_const ) + @staticmethod def create_decl_string(return_type, class_decl_string, arguments_types, has_const): has_const_str = '' if has_const: @@ -477,7 +478,6 @@ , 'class' : class_decl_string , 'arguments' : ','.join( map( lambda x: x.decl_string, arguments_types ) ) , 'has_const' : has_const_str } - create_decl_string = staticmethod( create_decl_string ) def _create_decl_string(self): return self.create_decl_string( self.return_type Modified: pygccxml_dev/pygccxml/declarations/declaration.py =================================================================== --- pygccxml_dev/pygccxml/declarations/declaration.py 2006-08-13 19:56:30 UTC (rev 398) +++ pygccxml_dev/pygccxml/declarations/declaration.py 2006-08-14 07:05:16 UTC (rev 399) @@ -99,10 +99,10 @@ cls = cls[:-2] return "%s [%s]"%(name, cls) + @staticmethod def _sorted_list( some_list ): some_list.sort() return some_list - _sorted_list = staticmethod( _sorted_list ) def _get__cmp__items( self ): """ Modified: pygccxml_dev/pygccxml/declarations/filtering.py =================================================================== --- pygccxml_dev/pygccxml/declarations/filtering.py 2006-08-13 19:56:30 UTC (rev 398) +++ pygccxml_dev/pygccxml/declarations/filtering.py 2006-08-14 07:05:16 UTC (rev 399) @@ -15,16 +15,17 @@ defines few algorithms for filtering declarations """ + @staticmethod def normalize_path( some_path ): """return os.path.normcase( os.path.normpath( some_path ) )""" return os.path.normcase( os.path.normpath( some_path ) ) - normalize_path = staticmethod( normalize_path ) - + + @staticmethod def contains_parent_dir( fpath, dirs ): #precondition: dirs and fpath should be normalize_path'ed before calling this function return bool( filter( lambda dir: fpath.startswith( dir ), dirs ) ) - contains_parent_dir = staticmethod( contains_parent_dir ) + @staticmethod def by_location( decls, locations ): """ returns list of declarations that belongs to specified locations. @@ -55,8 +56,8 @@ if filtering.contains_parent_dir( fpath, dirs ) or fpath in files: result.append( decl ) return result - by_location = staticmethod( by_location ) - + + @staticmethod def user_defined( decls, matcher ): """ returns list of declarations that match user specified criteria. @@ -73,5 +74,4 @@ """ #precondition: decls is a list of op level namespaces return filter( matcher, algorithm.make_flatten( decls ) ) - user_defined = staticmethod( user_defined ) Modified: pygccxml_dev/pygccxml/declarations/matcher.py =================================================================== --- pygccxml_dev/pygccxml/declarations/matcher.py 2006-08-13 19:56:30 UTC (rev 398) +++ pygccxml_dev/pygccxml/declarations/matcher.py 2006-08-14 07:05:16 UTC (rev 399) @@ -23,7 +23,8 @@ def __str__( self ): return "Multiple declarations has been found. matcher: [%s]"%str(self.matcher) - + + @staticmethod def find( decl_matcher, decls, recursive=True ): where = [] if isinstance( decls, types.ListType ): @@ -33,14 +34,14 @@ if recursive: where = algorithm.make_flatten( where ) return filter( decl_matcher, where ) - find = staticmethod( find ) - + + @staticmethod def find_single( decl_matcher, decls, recursive=True ): answer = matcher.find( decl_matcher, decls, recursive ) if len(answer) == 1: return answer[0] - find_single = staticmethod( find_single ) - + + @staticmethod def get_single( decl_matcher, decls, recursive=True ): answer = matcher.find( decl_matcher, decls, recursive ) if len(answer) == 1: @@ -49,4 +50,3 @@ raise matcher.declaration_not_found_t( decl_matcher ) else: raise matcher.multiple_declarations_found_t( decl_matcher ) - get_single = staticmethod( get_single ) \ No newline at end of file Modified: pygccxml_dev/pygccxml/declarations/pattern_parser.py =================================================================== --- pygccxml_dev/pygccxml/declarations/pattern_parser.py 2006-08-13 19:56:30 UTC (rev 398) +++ pygccxml_dev/pygccxml/declarations/pattern_parser.py 2006-08-14 07:05:16 UTC (rev 399) @@ -85,10 +85,7 @@ elif text[ found ] == self.__end: return ( first_occurance, found ) else: - pass - previous_found = found + 1 #skip found sep - #TODO: find out what is args and correct the code - return [ arg.strip() for arg in args ] + previous_found = found + 1 #skip found sep def split( self, decl_string ): assert self.has_pattern( decl_string ) Modified: pygccxml_dev/pygccxml/declarations/scopedef.py =================================================================== --- pygccxml_dev/pygccxml/declarations/scopedef.py 2006-08-13 19:56:30 UTC (rev 398) +++ pygccxml_dev/pygccxml/declarations/scopedef.py 2006-08-14 07:05:16 UTC (rev 399) @@ -402,7 +402,7 @@ , recursive=recursive , allow_empty=allow_empty) - def operator( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, decl_type=None, header_dir=None, header_file=None, recursive=None ): + def operator( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): return self._find_single( self._impl_matchers[ scopedef_t.operator ] , name=self._build_operator_name( name, function, symbol ) , symbol=symbol @@ -414,7 +414,7 @@ , header_file=header_file , recursive=recursive ) - def operators( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, decl_type=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): + def operators( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): return self._find_multiple( self._impl_matchers[ scopedef_t.operator ] , name=self._build_operator_name( name, function, symbol ) , symbol=symbol Modified: pygccxml_dev/pygccxml/declarations/type_traits.py =================================================================== --- pygccxml_dev/pygccxml/declarations/type_traits.py 2006-08-13 19:56:30 UTC (rev 398) +++ pygccxml_dev/pygccxml/declarations/type_traits.py 2006-08-14 07:05:16 UTC (rev 399) @@ -26,7 +26,6 @@ import templates import enumeration import class_declaration -from sets import Set as set import types as build_in_types def __remove_alias(tp, tp_is_clone): Modified: pygccxml_dev/pygccxml/parser/declarations_cache.py =================================================================== --- pygccxml_dev/pygccxml/parser/declarations_cache.py 2006-08-13 19:56:30 UTC (rev 398) +++ pygccxml_dev/pygccxml/parser/declarations_cache.py 2006-08-14 07:05:16 UTC (rev 399) @@ -94,28 +94,11 @@ def key(self): return ( self.__source_signature, self.__config_signature) + @staticmethod def create_key( source_file, configuration ): return ( file_signature(source_file) , configuration_signature(configuration)) - create_key = staticmethod( create_key ) - #def value(self): - #return ( self.__source_file_signature - #, self.__included_files - #, self.__included_files_signature - #, self.__declarations ) - - #def create( key, value ): - #return record_t( source_file=key[0] - #, working_directory=key[1] - #, include_paths=list(key[2]) - #, define_symbols=list(key[3]) - #, source_file_signature=value[0] - #, included_files=value[1] - #, included_files_signature=value[2] - #, declarations=value[3] ) - #create = staticmethod(create) - def __source_signature(self): return self.__source_signature source_signature = property( __source_signature ) @@ -155,6 +138,7 @@ for entry in self.__cache.itervalues(): # Clear hit flags entry.was_hit = False + @staticmethod def __load( file_name ): " Load pickled cache from file and return the object. " cache = None @@ -178,7 +162,6 @@ file(file_name, 'w+b').close() # Create empty file cache = {} # Empty cache return cache - __load = staticmethod( __load ) def flush(self): # If not marked as needing flushed, then return immediately Modified: pygccxml_dev/pygccxml/parser/project_reader.py =================================================================== --- pygccxml_dev/pygccxml/parser/project_reader.py 2006-08-13 19:56:30 UTC (rev 398) +++ pygccxml_dev/pygccxml/parser/project_reader.py 2006-08-14 07:05:16 UTC (rev 399) @@ -181,7 +181,8 @@ self.__decl_factory = pygccxml.declarations.decl_factory_t() self.logger = utils.loggers.gccxml - + + @staticmethod def get_os_file_names( files ): """Returns a list of OS file names @@ -200,7 +201,6 @@ else: pass return fnames - get_os_file_names = staticmethod( get_os_file_names ) def read_files( self, files, compilation_mode=COMPILATION_MODE.FILE_BY_FILE): """Parse header files. Modified: pygccxml_dev/unittests/autoconfig.py =================================================================== --- pygccxml_dev/unittests/autoconfig.py 2006-08-13 19:56:30 UTC (rev 398) +++ pygccxml_dev/unittests/autoconfig.py 2006-08-14 07:05:16 UTC (rev 399) @@ -9,7 +9,6 @@ #__pychecker__ = 'limit=1000' #import pychecker.checker - gccxml_path = '' data_directory = os.path.abspath( os.path.join( os.curdir, 'data' ) ) Modified: pygccxml_dev/unittests/core_tester.py =================================================================== --- pygccxml_dev/unittests/core_tester.py 2006-08-13 19:56:30 UTC (rev 398) +++ pygccxml_dev/unittests/core_tester.py 2006-08-14 07:05:16 UTC (rev 399) @@ -10,7 +10,6 @@ import autoconfig import parser_test_case from pprint import pformat -from sets import Set as set import pygccxml from pygccxml.utils import * Modified: pygccxml_dev/unittests/declaration_files_tester.py =================================================================== --- pygccxml_dev/unittests/declaration_files_tester.py 2006-08-13 19:56:30 UTC (rev 398) +++ pygccxml_dev/unittests/declaration_files_tester.py 2006-08-14 07:05:16 UTC (rev 399) @@ -6,7 +6,6 @@ import unittest import autoconfig import parser_test_case -from sets import Set as set import pygccxml from pygccxml.utils import * Modified: pygccxml_dev/unittests/file_cache_tester.py =================================================================== --- pygccxml_dev/unittests/file_cache_tester.py 2006-08-13 19:56:30 UTC (rev 398) +++ pygccxml_dev/unittests/file_cache_tester.py 2006-08-14 07:05:16 UTC (rev 399) @@ -12,7 +12,6 @@ import autoconfig import parser_test_case from pprint import pformat -from sets import Set as set import pygccxml from pygccxml.utils import * Modified: pygccxml_dev/unittests/hierarchy_traveling.py =================================================================== --- pygccxml_dev/unittests/hierarchy_traveling.py 2006-08-13 19:56:30 UTC (rev 398) +++ pygccxml_dev/unittests/hierarchy_traveling.py 2006-08-14 07:05:16 UTC (rev 399) @@ -7,7 +7,6 @@ import unittest import autoconfig import parser_test_case -from sets import Set as set from pygccxml import utils from pygccxml import parser Modified: pyplusplus_dev/examples/pyeasybmp_dev/pyeasybmp/environment.py =================================================================== --- pyplusplus_dev/examples/pyeasybmp_dev/pyeasybmp/environment.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/examples/pyeasybmp_dev/pyeasybmp/environment.py 2006-08-14 07:05:16 UTC (rev 399) @@ -20,10 +20,10 @@ generated_files_dir = '' unittests_dir = '' + @staticmethod def setup_environment(): sys.path.append( settings.pygccxml_path ) sys.path.append( settings.pyplusplus_path ) - setup_environment = staticmethod(setup_environment) if sys.platform == 'linux2': settings.boost_path = '/home/roman/boost_cvs' Modified: pyplusplus_dev/pyplusplus/code_creators/algorithm.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/algorithm.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/pyplusplus/code_creators/algorithm.py 2006-08-14 07:05:16 UTC (rev 399) @@ -12,7 +12,6 @@ import types -import pygccxml import namespace def _make_flatten_list( creator_or_creators ): @@ -69,6 +68,8 @@ This class is used as container for different find algorithms. """ "creator_finder - this class used as namespace" + + @staticmethod def find_by_declaration( declaration_matcher, where, recursive=True ): """Finds code creator by declaration. declaration_matcher should be callable, that takes single argument @@ -83,18 +84,17 @@ return filter( lambda inst: isinstance( inst, declaration_based.declaration_based_t ) \ and declaration_matcher( inst.declaration ) , search_area ) - find_by_declaration = staticmethod( find_by_declaration ) - + + @staticmethod def find_by_declaration_single( declaration_matcher, where, recursive=True ): answer = creator_finder.find_by_declaration( declaration_matcher, where, recursive ) if len( answer ) == 1: return answer[0] return None - find_by_declaration_single = staticmethod( find_by_declaration_single ) + @staticmethod def find_by_class_instance( what, where, recursive=True ): search_area = where if recursive: search_area = make_flatten( where ) return filter( lambda inst: isinstance( inst, what ), search_area ) - find_by_class_instance = staticmethod( find_by_class_instance ) Modified: pyplusplus_dev/pyplusplus/code_creators/calldef.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/calldef.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/pyplusplus/code_creators/calldef.py 2006-08-14 07:05:16 UTC (rev 399) @@ -3,7 +3,7 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -import os +import os import algorithm import declaration_based import class_declaration @@ -96,7 +96,7 @@ def _create_impl( self ): result = [] - if False == self.works_on_instance: + if not self.works_on_instance: exported_class_alias = None if declarations.templates.is_instantiation( self.declaration.parent.name ): exported_class_alias = self.exported_class_alias @@ -1021,7 +1021,7 @@ elif arg0 != arg1 and arg1 == parent_decl_string: return operator_t.SELF_POSITION.SECOND else: - assert 0 #I have bug some where + assert not "Unable to find out boost::python::self position. " + str( self.declaration ) def _create_binary_operator(self): answer = [ None, self.declaration.symbol, None ] Modified: pyplusplus_dev/pyplusplus/code_creators/class_declaration.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/class_declaration.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/pyplusplus/code_creators/class_declaration.py 2006-08-14 07:05:16 UTC (rev 399) @@ -72,7 +72,7 @@ return os.linesep.join( result ) def _create_impl(self): - if self.is_exposed_using_scope: + if self.is_exposed_using_scope(): return self._generate_code_with_scope() else: return self._generate_code_no_scope() Modified: pyplusplus_dev/pyplusplus/code_creators/code_creator.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/code_creator.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/pyplusplus/code_creators/code_creator.py 2006-08-14 07:05:16 UTC (rev 399) @@ -110,7 +110,8 @@ """ assert isinstance( code, types.StringTypes ) return code.strip() - + + @staticmethod def indent( code, size=1 ): """ function that implements code indent algorithm. @@ -126,8 +127,8 @@ return code_creator_t.__INDENTATION * size\ + code.replace( os.linesep , os.linesep + code_creator_t.__INDENTATION * size ) - indent = staticmethod( indent ) - + + @staticmethod def unindent( code ): """ function that implements code unindent algorithm. @@ -141,8 +142,8 @@ code = code[ len( code_creator_t.__INDENTATION ):] return code.replace( os.linesep + code_creator_t.__INDENTATION , os.linesep ) - unindent = staticmethod( unindent ) - + + @staticmethod def is_comment( line ): """ function that returns true if content of the line is comment, otherwise @@ -155,4 +156,3 @@ assert isinstance( line, types.StringTypes ) l = line.lstrip() return l.startswith( '//' ) or l.startswith( '/*' ) - is_comment = staticmethod( is_comment ) Modified: pyplusplus_dev/pyplusplus/code_creators/compound.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/compound.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/pyplusplus/code_creators/compound.py 2006-08-14 07:05:16 UTC (rev 399) @@ -60,6 +60,7 @@ creator.parent = None del self._creators[ self._creators.index( creator ) ] + @staticmethod def create_internal_code( creators ): """Concatenate the code from a list of code creators. @@ -74,4 +75,3 @@ for index in range( len( internals ) - 1): internals[index] = internals[index] + os.linesep return os.linesep.join( internals ) - create_internal_code = staticmethod( create_internal_code ) Modified: pyplusplus_dev/pyplusplus/code_creators/include_directories.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/include_directories.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/pyplusplus/code_creators/include_directories.py 2006-08-14 07:05:16 UTC (rev 399) @@ -18,9 +18,9 @@ self._user_defined = [] self._std = [] + @staticmethod def normalize( path ): return os.path.normpath( os.path.normcase( path ) ) - normalize = staticmethod( normalize ) def _get_user_defined(self): self._user_defined = map( self.normalize, self._user_defined ) Modified: pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py 2006-08-14 07:05:16 UTC (rev 399) @@ -58,7 +58,6 @@ or bool( self.declaration.indexing_suite.disable_methods ) def generate_algorithm_mask( self ): - indexing = algorithm.create_identifier(self, "::boost::python::indexing" ) disable = [] for group in self.declaration.indexing_suite.disabled_methods_groups: group_id = algorithm.create_identifier(self, "::boost::python::indexing::%s_methods" % group ) Modified: pyplusplus_dev/pyplusplus/code_creators/module.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/module.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/pyplusplus/code_creators/module.py 2006-08-14 07:05:16 UTC (rev 399) @@ -173,7 +173,7 @@ self.adopt_include( include.include_t( header=header ) ) def add_namespace_usage( self, namespace_name ): - self.adopt_creator( namespace.namespace_using_t( 'boost' ) + self.adopt_creator( namespace.namespace_using_t( namespace_name ) , self.last_include_index() + 1 ) def add_namespace_alias( self, alias, full_namespace_name ): Modified: pyplusplus_dev/pyplusplus/decl_wrappers/algorithm.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/algorithm.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/pyplusplus/decl_wrappers/algorithm.py 2006-08-14 07:05:16 UTC (rev 399) @@ -9,7 +9,6 @@ """ import re -import pygccxml def creators_affect_on_me( me ): """This algorithm finds all code creators that can influence on code generated Modified: pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/pyplusplus/decl_wrappers/calldef_wrapper.py 2006-08-14 07:05:16 UTC (rev 399) @@ -187,13 +187,14 @@ all = inplace + comparison + non_member + unary + @staticmethod def is_supported( oper ): if oper.symbol == '*' and len( oper.arguments ) == 0: #dereference does not make sense return False return oper.symbol in operators_helper.all - is_supported = staticmethod( is_supported ) - + + @staticmethod def exportable( oper ): if isinstance( oper, declarations.member_operator_t ) and oper.symbol in ( '()', '[]' ): return '' @@ -202,8 +203,7 @@ msg.append( 'See Boost.Python documentation: http://www.boost.org/libs/python/doc/v2/operators.html#introduction.' ) return ' '.join( msg ) return '' - exportable = staticmethod( exportable ) - + class member_operator_t( declarations.member_operator_t, calldef_t ): def __init__(self, *arguments, **keywords): declarations.member_operator_t.__init__( self, *arguments, **keywords ) @@ -226,7 +226,7 @@ class casting_operator_t( declarations.casting_operator_t, calldef_t ): - + def prepare_special_cases(): """ Creates a map of special cases ( aliases ) for casting operator. Modified: pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/pyplusplus/decl_wrappers/decl_wrapper.py 2006-08-14 07:05:16 UTC (rev 399) @@ -3,8 +3,6 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -import os -import sys import algorithm from pyplusplus import _logging_ from pygccxml import declarations Modified: pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite1.py =================================================================== --- pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite1.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite1.py 2006-08-14 07:05:16 UTC (rev 399) @@ -20,7 +20,7 @@ def __init__( self, container_class, container_traits, no_proxy=None, derived_policies=None ): object.__init__( self ) self.__no_proxy = no_proxy - self.__derived_policies = None + self.__derived_policies = derived_policies self.__container_class = container_class self.__container_traits = container_traits Modified: pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py =================================================================== --- pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/pyplusplus/file_writers/class_multiple_files.py 2006-08-14 07:05:16 UTC (rev 399) @@ -6,7 +6,6 @@ import os import writer import multiple_files -from sets import Set as set from pygccxml import declarations from pyplusplus import decl_wrappers from pyplusplus import code_creators @@ -186,8 +185,6 @@ return super( class_multiple_files_t, self ).split_class_impl( class_creator ) class_creator.declaration.always_expose_using_scope = True - extmodule = class_creator.top_parent - function_name = 'register_%s_class' % class_creator.alias file_path = os.path.join( self.directory_path, class_creator.alias ) Modified: pyplusplus_dev/pyplusplus/file_writers/multiple_files.py =================================================================== --- pyplusplus_dev/pyplusplus/file_writers/multiple_files.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/pyplusplus/file_writers/multiple_files.py 2006-08-14 07:05:16 UTC (rev 399) @@ -5,7 +5,6 @@ import os import writer -from sets import Set as set from pygccxml import declarations from pyplusplus import decl_wrappers from pyplusplus import code_creators @@ -19,7 +18,7 @@ HEADER_EXT = '.pypp.hpp' SOURCE_EXT = '.pypp.cpp' - def __init__(self, extmodule, directory_path): + def __init__(self, extmodule, directory_path, write_main=True): """Constructor. @param extmodule: The root of a code creator tree @@ -32,7 +31,8 @@ self.create_dir( directory_path ) self.include_creators = [] # List of include_t creators that contain the generated headers self.split_header_names = [] # List of include file names for split files - self.split_method_names = [] # List of methods from the split files + self.split_method_names = [] # List of methods from the split files + self.write_main = write_main def create_dir( self, directory_path ): @@ -291,7 +291,7 @@ self.split_creators( creators, '_free_functions', 'register_free_functions', -1 ) #TODO: move write_main to __init__ - def write(self, write_main=True): + def write(self): """ Write out the module. Creates a separate source/header combo for each class and for enums, globals, and free functions. @@ -319,7 +319,7 @@ self.split_global_variables() self.split_free_functions() - if write_main: + if self.write_main: self.include_creators.sort( cmp=lambda ic1, ic2: cmp( ic1.header, ic2.header ) ) map( lambda creator: self.extmodule.adopt_include( creator ) , self.include_creators ) Modified: pyplusplus_dev/pyplusplus/file_writers/writer.py =================================================================== --- pyplusplus_dev/pyplusplus/file_writers/writer.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/pyplusplus/file_writers/writer.py 2006-08-14 07:05:16 UTC (rev 399) @@ -34,6 +34,7 @@ """ Main write method. Should be overridden by derived classes. """ raise NotImplementedError() + @staticmethod def create_backup(fpath): if not os.path.exists( fpath ): return @@ -41,13 +42,13 @@ if os.path.exists( backup_fpath ): os.remove( backup_fpath ) os.rename( fpath, backup_fpath ) - create_backup = staticmethod( create_backup ) def write_code_repository(self, dir): for cr in code_repository.all: if self.__extmodule.is_system_header( cr.file_name ): self.write_file( os.path.join( dir, cr.file_name ), cr.code ) + @staticmethod def write_file( fpath, content ): """Write a source file. @@ -87,5 +88,3 @@ f.write( fcontent_new ) f.close() writer_t.logger.info( 'file "%s" - updated( %f seconds )' % ( fname, time.clock() - start_time ) ) - - write_file = staticmethod( write_file ) Modified: pyplusplus_dev/pyplusplus/gui/ui.py =================================================================== --- pyplusplus_dev/pyplusplus/gui/ui.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/pyplusplus/gui/ui.py 2006-08-14 07:05:16 UTC (rev 399) @@ -5,7 +5,6 @@ # http://www.boost.org/LICENSE_1_0.txt) import os -import sys import time import Tkinter import tkFileDialog Modified: pyplusplus_dev/pyplusplus/module_builder/builder.py =================================================================== --- pyplusplus_dev/pyplusplus/module_builder/builder.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/pyplusplus/module_builder/builder.py 2006-08-14 07:05:16 UTC (rev 399) @@ -6,10 +6,7 @@ import os import sys import time -import types -from sets import Set as set - from pygccxml import parser from pygccxml import declarations as decls_package @@ -34,7 +31,6 @@ , define_symbols=None , undefine_symbols=None , start_with_declarations=None - , compilation_verbose=False , compilation_mode=None , cache=None , optimize_queries=True @@ -444,7 +440,7 @@ , header_file=header_file , recursive=recursive) - def member_operator( self, name=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + def member_operator( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): """Please see L{decl_wrappers.scopedef_t} class documentation""" return self.global_ns.member_operator( name=name , symbol=symbol @@ -455,7 +451,7 @@ , header_file=header_file , recursive=recursive ) - def member_operators( self, name=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + def member_operators( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): """Please see L{decl_wrappers.scopedef_t} class documentation""" return self.global_ns.member_operators( name=name , symbol=symbol Modified: pyplusplus_dev/pyplusplus/module_creator/class_organizer.py =================================================================== --- pyplusplus_dev/pyplusplus/module_creator/class_organizer.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/pyplusplus/module_creator/class_organizer.py 2006-08-14 07:05:16 UTC (rev 399) @@ -4,7 +4,6 @@ # http://www.boost.org/LICENSE_1_0.txt) from pygccxml import declarations -from sets import Set as set class COLOR: WHITE = 0 Modified: pyplusplus_dev/pyplusplus/module_creator/creator.py =================================================================== --- pyplusplus_dev/pyplusplus/module_creator/creator.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/pyplusplus/module_creator/creator.py 2006-08-14 07:05:16 UTC (rev 399) @@ -2,9 +2,7 @@ # Distributed under the Boost Software License, Version 1.0. (See # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) - -import os -import time + import types_database import class_organizer import call_policies_resolver @@ -364,7 +362,7 @@ elif not creator: pass else: - assert 0 + assert not "Found %d class code creators" % len(creator) find = code_creators.creator_finder.find_by_declaration if isinstance( operator.parent, declarations.class_t ): found = find( lambda decl: operator.parent is decl @@ -393,7 +391,7 @@ and ( creator.target is registered.target ): return True else: - assert 0 #unknown instace of registrator + assert not "unknown instace of registrator: " % str( registered ) def _treat_smart_pointers( self ): """ Go to all class creators and apply held_type and creator registrators Modified: pyplusplus_dev/pyplusplus/module_creator/types_database.py =================================================================== --- pyplusplus_dev/pyplusplus/module_creator/types_database.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/pyplusplus/module_creator/types_database.py 2006-08-14 07:05:16 UTC (rev 399) @@ -3,7 +3,6 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -import os from pygccxml import declarations from pyplusplus import code_creators from pyplusplus import _logging_ @@ -29,7 +28,7 @@ elif isinstance( decl, declarations.variable_t ): self._update_db( self.__variables, decl.type ) else: - assert 0 + assert not "types_database_t class can not process " + str( decl ) def _is_relevant(self, decl_string): for smart_ptr in self.__smart_ptrs: @@ -49,30 +48,31 @@ answer = answer.replace( ' ' + data, data ) return answer.replace( ' ', ' ' ) - def _update_containers_db( self, type ): + def _update_containers_db( self, type_ ): #will return True is type was treated - type = declarations.remove_alias( type ) - type = declarations.remove_pointer( type ) - type = declarations.remove_reference( type ) - type = declarations.remove_cv( type ) - type = declarations.remove_declarated( type ) + type_ = declarations.remove_alias( type_ ) + type_ = declarations.remove_pointer( type_ ) + type_ = declarations.remove_reference( type_ ) + type_ = declarations.remove_cv( type_ ) + type_ = declarations.remove_declarated( type_ ) class_traits = declarations.class_traits class_declaration_traits = declarations.class_declaration_traits - if not class_traits.is_my_case( type ) and not class_declaration_traits.is_my_case( type ): + if not class_traits.is_my_case( type_ ) and not class_declaration_traits.is_my_case( type_ ): return False - if class_traits.is_my_case( type ): - container_cls = class_traits.get_declaration( type ) + if class_traits.is_my_case( type_ ): + container_cls = class_traits.get_declaration( type_ ) else: - container_cls = class_declaration_traits.get_declaration( type ) + container_cls = class_declaration_traits.get_declaration( type_ ) if None is container_cls.indexing_suite: return False try: - check_extraction = container_cls.indexing_suite.element_type - except RuntimeError, error: + #check extraction of element type from container + container_cls.indexing_suite.element_type + except RuntimeError: msg = "%s;%s" \ % ( str(container_cls) , "pyplusplus can not find out container value_type( mapped_type )." Modified: pyplusplus_dev/pyplusplus/utils/__init__.py =================================================================== --- pyplusplus_dev/pyplusplus/utils/__init__.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/pyplusplus/utils/__init__.py 2006-08-14 07:05:16 UTC (rev 399) @@ -13,6 +13,8 @@ class missing_call_policies: + + @staticmethod def _selector( creator ): if not isinstance( creator, code_creators.declaration_based_t ): return False @@ -21,8 +23,8 @@ if isinstance( creator.declaration, declarations.constructor_t ): return False return hasattr(creator, 'call_policies') and not creator.call_policies - _selector = staticmethod( _selector ) - + + @staticmethod def print_( extmodule ): creators = filter( missing_call_policies._selector , code_creators.make_flatten( extmodule.creators ) ) @@ -30,15 +32,14 @@ print creator.declaration.__class__.__name__, ': ', declarations.full_name( creator.declaration ) print ' *** MISSING CALL POLICY', creator.declaration.function_type().decl_string print - print_ = staticmethod( print_ ) - + + @staticmethod def exclude( extmodule ): creators = filter( missing_call_policies._selector , code_creators.make_flatten( extmodule.creators ) ) for creator in creators: creator.parent.remove_creator( creator ) - exclude = staticmethod( exclude ) - + def split_sequence(seq, bucket_size): #split sequence to buclets, where every will contain maximum bucket_size items Modified: pyplusplus_dev/unittests/algorithms_tester.py =================================================================== --- pyplusplus_dev/unittests/algorithms_tester.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/unittests/algorithms_tester.py 2006-08-14 07:05:16 UTC (rev 399) @@ -7,7 +7,6 @@ import sys import unittest import autoconfig -from sets import Set as set from pygccxml import parser from pygccxml import declarations from pyplusplus import code_creators Modified: pyplusplus_dev/unittests/autoconfig.py =================================================================== --- pyplusplus_dev/unittests/autoconfig.py 2006-08-13 19:56:30 UTC (rev 398) +++ pyplusplus_dev/unittests/autoconfig.py 2006-08-14 07:05:16 UTC (rev 399) @@ -7,11 +7,7 @@ import os import sys import unittest -from sets import Set as set - -#sys.path.append( os.path.join( os.curdir, '..' ) ) - #__pychecker__ = 'limit=1000' #import pychecker.checker @@ -28,6 +24,7 @@ cpppath = [ boost.include, python.include ] include_dirs = cpppath + [data_directory] + @staticmethod def create_sconstruct(): code = [ "SharedLibrary( target=r'%(target)s'" @@ -40,7 +37,6 @@ , " , SHLIBSUFFIX='%s'" % scons.suffix #explicit better then implicit , ")" ] return os.linesep.join( code ) - create_sconstruct = staticmethod(create_sconstruct) #I need this in order to allow Python to load just compiled modules sys.path.append( build_dir ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |