def __report_illegal_property(self, property_): logger = _logging_.loggers.declarations if not messages.filter_disabled_msgs( [messages.W1041], property_.fget.parent.disabled_messages): return #user disabled property warning logger.warn("%s;%s" % (property_.fget.parent, messages.W1041 % property_))
def find_out_value_traits_header( self, code_creator ): if not isinstance( code_creator, ( code_creators.class_t, code_creators.class_declaration_t ) ): return None if None is code_creator.declaration.indexing_suite: return None if not isinstance( code_creator.declaration.indexing_suite, decl_wrappers.indexing_suite2_t ): return None #sometimes, for some reason I expose containers as regular classes ( hash_map ) #and in this case I do generate include to classes = ( code_creators.indexing_suite1_t, code_creators.indexing_suite2_t ) for cont_code_creator in code_creator.creators: if isinstance( cont_code_creator, classes ): break else: return None try: element_type = code_creator.declaration.indexing_suite.element_type class_traits = declarations.class_traits if not class_traits.is_my_case( element_type ): return None value_class = class_traits.get_declaration( element_type ) if value_class.less_than_comparable and value_class.equality_comparable: return None #`Py++` doesn't create value traits for class that has # = and < operators available return self.create_value_traits_header_name( value_class ) except RuntimeError, error: decls_logger = _logging_.loggers.declarations if not messages.filter_disabled_msgs([messages.W1042], code_creator.declaration.disabled_messages ): return #user disabled property warning decls_logger.warn( "%s;%s" % ( code_creator.declaration, messages.W1042 ) )
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_) 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_): return False if class_traits.is_my_case(type_): container_cls = class_traits.get_declaration(type_) else: container_cls = class_declaration_traits.get_declaration(type_) if None is container_cls.indexing_suite: return False try: #check extraction of element type from container container_cls.indexing_suite.element_type except RuntimeError: decls_logger = _logging_.loggers.declarations if not messages.filter_disabled_msgs( [messages.W1042], container_cls.disabled_messages): return #user disabled property warning decls_logger.warn("%s;%s" % (container_cls, messages.W1042)) self.__containers.add(container_cls) return True
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_ ) 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_ ): return False if class_traits.is_my_case( type_ ): container_cls = class_traits.get_declaration( type_ ) else: container_cls = class_declaration_traits.get_declaration( type_ ) if None is container_cls.indexing_suite: return False try: #check extraction of element type from container container_cls.indexing_suite.element_type except RuntimeError: decls_logger = _logging_.loggers.declarations if not messages.filter_disabled_msgs([messages.W1042], container_cls.disabled_messages ): return #user disabled property warning decls_logger.warn( "%s;%s" % ( container_cls, messages.W1042 ) ) self.__containers.add( container_cls ) return True
def __find_out_used_but_not_exported( self ): used_not_exported = [] exported_ids = set( map( lambda d: id( d ), self.__exported_decls ) ) for decl in self.__exported_decls: for dependency in self.__build_dependencies( decl ): for depend_on_decl in dependency.find_out_depend_on_it_declarations(): if self.__has_unexposed_dependency( exported_ids, depend_on_decl, dependency ): if messages.filter_disabled_msgs([messages.W1040], depend_on_decl.disabled_messages ): #need to report dependency errors used_not_exported.append(dependency) return used_not_exported
def find_out_value_traits_header(self, code_creator): if not isinstance( code_creator, (code_creators.class_t, code_creators.class_declaration_t)): return None if None is code_creator.declaration.indexing_suite: return None if not isinstance(code_creator.declaration.indexing_suite, decl_wrappers.indexing_suite2_t): return None #sometimes, for some reason I expose containers as regular classes ( hash_map ) #and in this case I do generate include to classes = (code_creators.indexing_suite1_t, code_creators.indexing_suite2_t) for cont_code_creator in code_creator.creators: if isinstance(cont_code_creator, classes): break else: return None try: element_type = code_creator.declaration.indexing_suite.element_type class_traits = declarations.class_traits if not class_traits.is_my_case(element_type): return None value_class = class_traits.get_declaration(element_type) if value_class.less_than_comparable and value_class.equality_comparable: return None #`Py++` doesn't create value traits for class that has # = and < operators available return self.create_value_traits_header_name(value_class) except RuntimeError, error: decls_logger = _logging_.loggers.declarations if not messages.filter_disabled_msgs( [messages.W1042], code_creator.declaration.disabled_messages): return #user disabled property warning decls_logger.warn("%s;%s" % (code_creator.declaration, messages.W1042))
def readme( self, skip_ignored=True ): """return important information( hints/tips/warning message ) `Py++` has about this declaration. skip_ignored argument allows you to control the information reported to you. For more information please read: http://www.language-binding.net/pyplusplus/documentation/warnings.html """ msgs = [] if not self.exportable: msgs.append( self.why_not_exportable() ) if declarations.templates.is_instantiation( self.name ) \ and self.alias == self._generate_valid_name(): msgs.append( messages.W1043 % self.alias ) directives = self.__select_alias_directives(be_smart=False) if 1 < len( directives ): msgs.append( messages.W1048 % ( self.alias, ', '.join( map( lambda typedef: typedef.name, directives ) ) ) ) msgs.extend( self._readme_impl() ) return messages.filter_disabled_msgs( msgs, self.__msgs_to_ignore )
def readme(self, skip_ignored=True): """return important information( hints/tips/warning message ) `Py++` has about this declaration. skip_ignored argument allows you to control the information reported to you. For more information please read: http://www.language-binding.net/pyplusplus/documentation/warnings.html """ msgs = [] if not self.exportable: msgs.append(self.why_not_exportable()) if declarations.templates.is_instantiation( self.name ) \ and self.alias == self._generate_valid_name(): msgs.append(messages.W1043 % self.alias) directives = self.__select_alias_directives(be_smart=False) if 1 < len(directives): msgs.append(messages.W1048 % (self.alias, ', '.join( map(lambda typedef: typedef.name, directives)))) msgs.extend(self._readme_impl()) return messages.filter_disabled_msgs(msgs, self.__msgs_to_ignore)
def __report_illegal_property( self, property_ ): logger = _logging_.loggers.declarations if not messages.filter_disabled_msgs([messages.W1041], property_.fget.parent.disabled_messages ): return #user disabled property warning logger.warn( "%s;%s" % ( property_.fget.parent, messages.W1041 % property_ ) )