def split_internal_calldefs( self, class_creator, calldef_types, pattern ): creators = filter( lambda x: isinstance(x, calldef_types ), class_creator.creators ) grouped_creators = pypp_utils.split_sequence( creators, self.num_of_functions_per_file ) if len( grouped_creators ) == 1: for creator in creators: creator.works_on_instance = False self.split_internal_creators( class_creator, creators, pattern ) return pattern else: patterns = [] for index, group in enumerate( grouped_creators ): pattern_tmp = pattern + str( index ) patterns.append( pattern_tmp ) for creator in group: creator.works_on_instance = False self.split_internal_creators( class_creator, group, pattern_tmp ) return patterns
def split_classes( self ): class_creators = filter( lambda x: isinstance(x, ( code_creators.class_t, code_creators.class_declaration_t ) ) , self.extmodule.body.creators ) class_creators = filter( lambda cc: not cc.declaration.already_exposed , class_creators ) buckets = split_sequence(class_creators, len(class_creators)/self.number_of_buckets ) if len(buckets) > self.number_of_buckets: buckets[len(buckets)-2] += buckets[len(buckets)-1] buckets = buckets[:len(buckets)-1] for index, bucket in enumerate( buckets ): self.split_creators( bucket , '_classes_%d' % (index+1) , 'register_classes_%d' % (index+1) , -1 )
def split_classes(self): class_creators = filter( lambda x: isinstance(x, (code_creators.class_t, code_creators. class_declaration_t)), self.extmodule.body.creators) class_creators = filter(lambda cc: not cc.declaration.already_exposed, class_creators) buckets = split_sequence(class_creators, len(class_creators) / self.number_of_buckets) if len(buckets) > self.number_of_buckets: buckets[len(buckets) - 2] += buckets[len(buckets) - 1] buckets = buckets[:len(buckets) - 1] for index, bucket in enumerate(buckets): self.split_creators(bucket, '_classes_%d' % (index + 1), 'register_classes_%d' % (index + 1), -1)