<s> from __future__ import unicode_literals <EOL> from django . db import models <EOL> from django . contrib . contenttypes import generic <EOL> from django . contrib . contenttypes . models import ContentType <EOL> from project . models import Project , ProjectRelease , SourceElement <EOL> DOCUMENT_SOURCE = '<STR_LIT:d>' <EOL> CHANNEL_SOURCE = '<STR_LIT:s>' <EOL> LANGUAGES = [ <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT:p>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT:x>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT:l>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT:r>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT:o>' , '<STR_LIT>' ) , <EOL> ] <EOL> '''<STR_LIT>''' <EOL> SOURCE_TYPE = ( <EOL> ( DOCUMENT_SOURCE , '<STR_LIT>' ) , <EOL> ( CHANNEL_SOURCE , '<STR_LIT>' ) , <EOL> ) <EOL> def add_language ( lang_code , lang_name ) : <EOL> global LANGUAGES <EOL> found = False <EOL> for ( code , _ ) in LANGUAGES : <EOL> if lang_code == code : <EOL> found = True <EOL> break <EOL> if not found : <EOL> LANGUAGES . append ( ( lang_code , lang_name ) ) <EOL> class CodeBase ( models . Model ) : <EOL> '''<STR_LIT>''' <EOL> name = models . CharField ( max_length = <NUM_LIT> , null = True , blank = True ) <EOL> '''<STR_LIT>''' <EOL> project_release = models . ForeignKey ( ProjectRelease ) <EOL> '''<STR_LIT>''' <EOL> def __unicode__ ( self ) : <EOL> return self . name + '<STR_LIT>' + self . project_release . __unicode__ ( ) <EOL> class CodeElementKind ( models . Model ) : <EOL> '''<STR_LIT>''' <EOL> kind = models . CharField ( max_length = <NUM_LIT:255> , null = True , blank = True , unique = True ) <EOL> '''<STR_LIT>''' <EOL> is_type = models . BooleanField ( default = False ) <EOL> '''<STR_LIT>''' <EOL> is_file = models . BooleanField ( default = False ) <EOL> '''<STR_LIT>''' <EOL> is_attribute = models . BooleanField ( default = False ) <EOL> '''<STR_LIT>''' <EOL> is_value = models . BooleanField ( default = False ) <EOL> '''<STR_LIT>''' <EOL> def __unicode__ ( self ) : <EOL> return self . kind <EOL> class CodeElementFilter ( models . Model ) : <EOL> '''<STR_LIT>''' <EOL> codebase = models . ForeignKey ( CodeBase , related_name = '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> fqn = models . CharField ( max_length = <NUM_LIT> , null = True , blank = True ) <EOL> '''<STR_LIT>''' <EOL> include_snippet = models . BooleanField ( default = True ) <EOL> '''<STR_LIT>''' <EOL> one_ref_only = models . BooleanField ( default = False ) <EOL> '''<STR_LIT>''' <EOL> include_member = models . BooleanField ( default = False ) <EOL> '''<STR_LIT>''' <EOL> def __unicode__ ( self ) : <EOL> return self . fqn <EOL> class CodeElement ( models . Model ) : <EOL> '''<STR_LIT>''' <EOL> codebase = models . ForeignKey ( CodeBase , related_name = '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> simple_name = models . CharField ( max_length = <NUM_LIT> , null = True , blank = True , <EOL> db_index = True ) <EOL> '''<STR_LIT>''' <EOL> fqn = models . CharField ( max_length = <NUM_LIT> , null = True , blank = True , <EOL> db_index = True ) <EOL> '''<STR_LIT>''' <EOL> kind = models . ForeignKey ( CodeElementKind , null = True , blank = True ) <EOL> '''<STR_LIT>''' <EOL> deprecated = models . BooleanField ( default = False ) <EOL> '''<STR_LIT>''' <EOL> abstract = models . BooleanField ( default = False ) <EOL> '''<STR_LIT>''' <EOL> eclipse_handle = models . CharField ( max_length = <NUM_LIT> , null = True , blank = True ) <EOL> '''<STR_LIT>''' <EOL> containers = models . ManyToManyField ( '<STR_LIT>' , related_name = '<STR_LIT>' , <EOL> symmetrical = False ) <EOL> '''<STR_LIT>''' <EOL> type_containers = models . ManyToManyField ( '<STR_LIT>' , <EOL> related_name = '<STR_LIT>' , symmetrical = False ) <EOL> '''<STR_LIT>''' <EOL> parents = models . ManyToManyField ( '<STR_LIT>' , related_name = '<STR_LIT>' , <EOL> symmetrical = False ) <EOL> '''<STR_LIT>''' <EOL> attcontainer = models . ForeignKey ( '<STR_LIT>' , related_name = '<STR_LIT>' , <EOL> null = True , blank = True ) <EOL> '''<STR_LIT>''' <EOL> type_attcontainers = models . ManyToManyField ( '<STR_LIT>' , <EOL> related_name = '<STR_LIT>' , null = True , blank = True , <EOL> symmetrical = False ) <EOL> '''<STR_LIT>''' <EOL> index = models . PositiveIntegerField ( default = <NUM_LIT:0> ) <EOL> '''<STR_LIT>''' <EOL> parser = models . CharField ( max_length = <NUM_LIT:100> , null = True , blank = True , <EOL> default = '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> def parameters ( self ) : <EOL> return ParameterElement . objects . filter ( attcontainer = self ) . all ( ) <EOL> def human_string ( self ) : <EOL> human_string = self . fqn <EOL> if self . kind is None : <EOL> return human_string <EOL> if self . kind . kind == '<STR_LIT>' : <EOL> human_string = self . fqn + '<STR_LIT:(>' <EOL> for attribute in self . attributes . all ( ) : <EOL> human_string += attribute . parameterelement . type_simple_name + '<STR_LIT:U+002CU+0020>' <EOL> human_string += '<STR_LIT:)>' <EOL> return human_string <EOL> def __unicode__ ( self ) : <EOL> return self . human_string ( ) <EOL> class Meta : <EOL> ordering = [ '<STR_LIT:index>' ] <EOL> class FieldElement ( CodeElement ) : <EOL> '''<STR_LIT>''' <EOL> type_simple_name = models . CharField ( max_length = <NUM_LIT> , null = True , blank = True ) <EOL> '''<STR_LIT>''' <EOL> type_fqn = models . CharField ( max_length = <NUM_LIT> , null = True , blank = True ) <EOL> '''<STR_LIT>''' <EOL> class MethodElement ( CodeElement ) : <EOL> '''<STR_LIT>''' <EOL> return_simple_name = models . CharField ( max_length = <NUM_LIT> , null = True , <EOL> blank = True ) <EOL> '''<STR_LIT>''' <EOL> return_fqn = models . CharField ( max_length = <NUM_LIT> , null = True , blank = True ) <EOL> '''<STR_LIT>''' <EOL> overloads = models . ManyToManyField ( '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> parameters_length = models . SmallIntegerField ( null = True , blank = True , <EOL> default = <NUM_LIT:0> ) <EOL> '''<STR_LIT>''' <EOL> class ParameterElement ( CodeElement ) : <EOL> '''<STR_LIT>''' <EOL> type_simple_name = models . CharField ( max_length = <NUM_LIT> , null = True , blank = True ) <EOL> '''<STR_LIT>''' <EOL> type_fqn = models . CharField ( max_length = <NUM_LIT> , null = True , blank = True ) <EOL> '''<STR_LIT>''' <EOL> def __unicode__ ( self ) : <EOL> return str ( self . index ) + '<STR_LIT::>' + self . type_fqn <EOL> class Meta : <EOL> ordering = [ '<STR_LIT:index>' ] <EOL> order_with_respect_to = '<STR_LIT>' <EOL> class MethodFamily ( CodeElement ) : <EOL> '''<STR_LIT>''' <EOL> methods = models . ManyToManyField ( MethodElement , null = True , blank = True , <EOL> related_name = '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> references = models . ManyToManyField ( '<STR_LIT>' , null = True , <EOL> blank = True , related_name = '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> class CodeSnippet ( SourceElement ) : <EOL> '''<STR_LIT>''' <EOL> project = models . ForeignKey ( Project , null = True , blank = True ) <EOL> '''<STR_LIT>''' <EOL> project_release = models . ForeignKey ( ProjectRelease , null = True , blank = True ) <EOL> '''<STR_LIT>''' <EOL> language = models . CharField ( max_length = <NUM_LIT:2> , null = True , blank = True , <EOL> choices = LANGUAGES , default = '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> source = models . CharField ( max_length = <NUM_LIT:1> , null = True , blank = True , <EOL> choices = SOURCE_TYPE , default = '<STR_LIT:d>' ) <EOL> '''<STR_LIT>''' <EOL> snippet_text = models . TextField ( null = True , blank = True ) <EOL> '''<STR_LIT>''' <EOL> index = models . IntegerField ( null = True , blank = True , default = <NUM_LIT:0> ) <EOL> '''<STR_LIT>''' <EOL> local_content_type = models . ForeignKey ( ContentType , null = True , blank = True , <EOL> related_name = '<STR_LIT>' ) <EOL> local_object_id = models . PositiveIntegerField ( null = True , blank = True ) <EOL> local_context = generic . GenericForeignKey ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> mid_content_type = models . ForeignKey ( ContentType , null = True , blank = True , <EOL> related_name = '<STR_LIT>' ) <EOL> mid_object_id = models . PositiveIntegerField ( null = True , blank = True ) <EOL> mid_context = generic . GenericForeignKey ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> global_content_type = models . ForeignKey ( ContentType , null = True , blank = True , <EOL> related_name = '<STR_LIT>' ) <EOL> global_object_id = models . PositiveIntegerField ( null = True , blank = True ) <EOL> global_context = generic . GenericForeignKey ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> resource_content_type = models . ForeignKey ( ContentType , null = True , <EOL> blank = True , related_name = '<STR_LIT>' ) <EOL> resource_object_id = models . PositiveIntegerField ( null = True , blank = True ) <EOL> resource = generic . GenericForeignKey ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> def __unicode__ ( self ) : <EOL> return "<STR_LIT>" . format ( self . get_language_display ( ) , self . pk ) <EOL> class Meta : <EOL> ordering = [ '<STR_LIT:index>' ] <EOL> class SingleCodeReference ( SourceElement ) : <EOL> '''<STR_LIT>''' <EOL> project = models . ForeignKey ( Project , null = True , blank = True ) <EOL> '''<STR_LIT>''' <EOL> project_release = models . ForeignKey ( ProjectRelease , null = True , blank = True ) <EOL> '''<STR_LIT>''' <EOL> content = models . TextField ( null = True , blank = True ) <EOL> '''<STR_LIT>''' <EOL> source = models . CharField ( max_length = <NUM_LIT:1> , null = True , blank = True , <EOL> choices = SOURCE_TYPE , default = '<STR_LIT:d>' ) <EOL> '''<STR_LIT>''' <EOL> original_kind_hint = models . ForeignKey ( CodeElementKind , null = True , <EOL> blank = True , related_name = '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> kind_hint = models . ForeignKey ( CodeElementKind , null = True , blank = True ) <EOL> '''<STR_LIT>''' <EOL> snippet = models . ForeignKey ( CodeSnippet , null = True , blank = True , <EOL> related_name = '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> declaration = models . BooleanField ( default = False ) <EOL> '''<STR_LIT>''' <EOL> index = models . IntegerField ( null = True , blank = True , default = <NUM_LIT:0> ) <EOL> '''<STR_LIT>''' <EOL> sentence = models . TextField ( null = True , blank = True ) <EOL> '''<STR_LIT>''' <EOL> paragraph = models . TextField ( null = True , blank = True ) <EOL> '''<STR_LIT>''' <EOL> parent_reference = models . ForeignKey ( '<STR_LIT>' , null = True , blank = True , <EOL> related_name = '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> child_index = models . IntegerField ( null = True , blank = True , default = <NUM_LIT:0> ) <EOL> '''<STR_LIT>''' <EOL> title_content_type = models . ForeignKey ( ContentType , null = True , blank = True , <EOL> related_name = '<STR_LIT>' ) <EOL> title_object_id = models . PositiveIntegerField ( null = True , blank = True ) <EOL> title_context = generic . GenericForeignKey ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> local_content_type = models . ForeignKey ( ContentType , null = True , blank = True , <EOL> related_name = '<STR_LIT>' ) <EOL> local_object_id = models . PositiveIntegerField ( null = True , blank = True ) <EOL> local_context = generic . GenericForeignKey ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> mid_content_type = models . ForeignKey ( ContentType , null = True , blank = True , <EOL> related_name = '<STR_LIT>' ) <EOL> mid_object_id = models . PositiveIntegerField ( null = True , blank = True ) <EOL> mid_context = generic . GenericForeignKey ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> global_content_type = models . ForeignKey ( ContentType , null = True , blank = True , <EOL> related_name = '<STR_LIT>' ) <EOL> global_object_id = models . PositiveIntegerField ( null = True , blank = True ) <EOL> global_context = generic . GenericForeignKey ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> resource_content_type = models . ForeignKey ( ContentType , null = True , <EOL> blank = True , related_name = '<STR_LIT>' ) <EOL> resource_object_id = models . PositiveIntegerField ( null = True , blank = True ) <EOL> resource = generic . GenericForeignKey ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> def first_link ( self ) : <EOL> try : <EOL> link = CodeElementLink . objects . filter ( code_reference = self ) . get ( index = <NUM_LIT:0> ) <EOL> return link <EOL> except Exception : <EOL> return None <EOL> def __unicode__ ( self ) : <EOL> return '<STR_LIT>' . format ( self . content , str ( self . pk ) ) <EOL> class Meta : <EOL> ordering = [ '<STR_LIT:index>' ] <EOL> class CodeBaseDiff ( models . Model ) : <EOL> codebase_from = models . ForeignKey ( CodeBase , null = True , blank = True , <EOL> related_name = '<STR_LIT>' ) <EOL> codebase_to = models . ForeignKey ( CodeBase , null = True , blank = True , <EOL> related_name = '<STR_LIT>' ) <EOL> added_packages = models . ManyToManyField ( CodeElement , null = True , blank = True , <EOL> related_name = '<STR_LIT>' ) <EOL> removed_packages = models . ManyToManyField ( CodeElement , null = True , <EOL> blank = True , related_name = '<STR_LIT>' ) <EOL> packages_size_from = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> packages_size_to = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> added_types = models . ManyToManyField ( CodeElement , null = True , blank = True , <EOL> related_name = '<STR_LIT>' ) <EOL> removed_types = models . ManyToManyField ( CodeElement , null = True , blank = True , <EOL> related_name = '<STR_LIT>' ) <EOL> types_size_from = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> types_size_to = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> added_methods = models . ManyToManyField ( CodeElement , null = True , blank = True , <EOL> related_name = '<STR_LIT>' ) <EOL> removed_methods = models . ManyToManyField ( CodeElement , null = True , <EOL> blank = True , related_name = '<STR_LIT>' ) <EOL> methods_size_from = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> methods_size_to = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> added_fields = models . ManyToManyField ( CodeElement , null = True , blank = True , <EOL> related_name = '<STR_LIT>' ) <EOL> removed_fields = models . ManyToManyField ( CodeElement , null = True , blank = True , <EOL> related_name = '<STR_LIT>' ) <EOL> fields_size_from = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> fields_size_to = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> added_enum_values = models . ManyToManyField ( CodeElement , null = True , <EOL> blank = True , related_name = '<STR_LIT>' ) <EOL> removed_enum_values = models . ManyToManyField ( CodeElement , null = True , <EOL> blank = True , related_name = '<STR_LIT>' ) <EOL> enum_values_size_from = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> enum_values_size_to = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> added_ann_fields = models . ManyToManyField ( CodeElement , null = True , <EOL> blank = True , related_name = '<STR_LIT>' ) <EOL> removed_ann_fields = models . ManyToManyField ( CodeElement , null = True , <EOL> blank = True , related_name = '<STR_LIT>' ) <EOL> ann_fields_size_from = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> ann_fields_size_to = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> added_deprecated_types = models . ManyToManyField ( CodeElement , null = True , <EOL> blank = True , related_name = '<STR_LIT>' ) <EOL> removed_deprecated_types = models . ManyToManyField ( CodeElement , null = True , <EOL> blank = True , related_name = '<STR_LIT>' ) <EOL> dep_types_size_from = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> dep_types_size_to = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> added_deprecated_methods = models . ManyToManyField ( CodeElement , null = True , <EOL> blank = True , related_name = '<STR_LIT>' ) <EOL> removed_deprecated_methods = models . ManyToManyField ( CodeElement , null = True , <EOL> blank = True , related_name = '<STR_LIT>' ) <EOL> dep_methods_size_from = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> dep_methods_size_to = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> def __unicode__ ( self ) : <EOL> return '<STR_LIT>' . format ( self . codebase_from , self . codebase_to ) <EOL> class ReleaseLinkSet ( models . Model ) : <EOL> '''<STR_LIT>''' <EOL> code_reference = models . ForeignKey ( SingleCodeReference , <EOL> related_name = '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> project_release = models . ForeignKey ( ProjectRelease , <EOL> related_name = '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> def __unicode__ ( self ) : <EOL> return '<STR_LIT>' . format ( self . code_reference . content , <EOL> self . project_release ) <EOL> class Filter ( models . Model ) : <EOL> '''<STR_LIT>''' <EOL> filter_name = models . CharField ( max_length = <NUM_LIT> ) <EOL> '''<STR_LIT>''' <EOL> executed = models . BooleanField ( default = True ) <EOL> '''<STR_LIT>''' <EOL> activated = models . BooleanField ( default = True ) <EOL> '''<STR_LIT>''' <EOL> size_before = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> '''<STR_LIT>''' <EOL> size_after = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> '''<STR_LIT>''' <EOL> index = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> '''<STR_LIT>''' <EOL> release_link_set = models . ForeignKey ( ReleaseLinkSet , blank = True , null = True ) <EOL> '''<STR_LIT>''' <EOL> def __unicode__ ( self ) : <EOL> return '<STR_LIT>' . format ( self . filter_name , self . executed , self . activated , <EOL> self . before , self . after ) <EOL> class Meta : <EOL> ordering = [ '<STR_LIT:index>' ] <EOL> class CodeElementLink ( models . Model ) : <EOL> '''<STR_LIT>''' <EOL> code_reference = models . ForeignKey ( SingleCodeReference , <EOL> related_name = '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> code_element = models . ForeignKey ( CodeElement , <EOL> related_name = '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> index = models . IntegerField ( default = <NUM_LIT:0> ) <EOL> '''<STR_LIT>''' <EOL> rationale = models . CharField ( max_length = <NUM_LIT> ) <EOL> '''<STR_LIT>''' <EOL> linker_name = models . CharField ( max_length = <NUM_LIT> ) <EOL> '''<STR_LIT>''' <EOL> release_link_set = models . ForeignKey ( ReleaseLinkSet , blank = True , <EOL> null = True , related_name = "<STR_LIT>" ) <EOL> '''<STR_LIT>''' <EOL> first_link = models . OneToOneField ( ReleaseLinkSet , blank = True , null = True , <EOL> related_name = '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> def __unicode__ ( self ) : <EOL> return '<STR_LIT>' . format ( self . code_reference . content , <EOL> self . code_element . fqn ) <EOL> class Meta : <EOL> ordering = [ '<STR_LIT:index>' ] <EOL> class MethodInfo ( object ) : <EOL> def __init__ ( self , method_name , fqn_container , nb_params , type_params ) : <EOL> self . method_name = method_name <EOL> self . fqn_container = fqn_container <EOL> self . nb_params = nb_params <EOL> self . type_params = type_params </s>
