<s> from django . contrib . auth . models import User <EOL> from django . db import models <EOL> from django . utils . translation import ugettext as _ <EOL> from djblets . db . fields import JSONField , ModificationTimestampField <EOL> from reviewboard . scmtools . models import Repository <EOL> from reviewboard . site . models import LocalSite <EOL> from reviewbotext . managers import AutomaticRunGroupManager <EOL> class Tool ( models . Model ) : <EOL> """<STR_LIT>""" <EOL> name = models . CharField ( max_length = <NUM_LIT> , blank = False ) <EOL> entry_point = models . CharField ( max_length = <NUM_LIT> , blank = False ) <EOL> version = models . CharField ( max_length = <NUM_LIT> , blank = False ) <EOL> description = models . CharField ( max_length = <NUM_LIT> , default = "<STR_LIT>" , blank = True ) <EOL> enabled = models . BooleanField ( default = True ) <EOL> in_last_update = models . BooleanField ( ) <EOL> tool_options = JSONField ( ) <EOL> def __unicode__ ( self ) : <EOL> return "<STR_LIT>" % ( self . name , self . version ) <EOL> class Meta : <EOL> unique_together = ( '<STR_LIT>' , '<STR_LIT:version>' ) <EOL> class Profile ( models . Model ) : <EOL> """<STR_LIT>""" <EOL> tool = models . ForeignKey ( Tool ) <EOL> name = models . CharField ( max_length = <NUM_LIT> , blank = False ) <EOL> description = models . CharField ( max_length = <NUM_LIT> , default = "<STR_LIT>" , blank = True ) <EOL> allow_manual = models . BooleanField ( default = False ) <EOL> allow_manual_submitter = models . BooleanField ( default = False ) <EOL> allow_manual_group = models . BooleanField ( default = False ) <EOL> ship_it = models . BooleanField ( <EOL> default = False , <EOL> help_text = _ ( "<STR_LIT>" ) ) <EOL> open_issues = models . BooleanField ( default = False ) <EOL> comment_unmodified = models . BooleanField ( <EOL> default = False , <EOL> verbose_name = _ ( "<STR_LIT>" ) ) <EOL> tool_settings = JSONField ( ) <EOL> local_site = models . ForeignKey ( LocalSite , blank = True , null = True , <EOL> related_name = '<STR_LIT>' ) <EOL> def __unicode__ ( self ) : <EOL> return self . name <EOL> class ToolExecution ( models . Model ) : <EOL> """<STR_LIT>""" <EOL> QUEUED = '<STR_LIT>' <EOL> RUNNING = '<STR_LIT:R>' <EOL> SUCCEEDED = '<STR_LIT:S>' <EOL> FAILED = '<STR_LIT:F>' <EOL> TIMED_OUT = '<STR_LIT:T>' <EOL> STATUSES = ( <EOL> ( QUEUED , _ ( '<STR_LIT>' ) ) , <EOL> ( RUNNING , _ ( '<STR_LIT>' ) ) , <EOL> ( SUCCEEDED , _ ( '<STR_LIT>' ) ) , <EOL> ( FAILED , _ ( '<STR_LIT>' ) ) , <EOL> ( TIMED_OUT , _ ( '<STR_LIT>' ) ) , <EOL> ) <EOL> profile = models . ForeignKey ( Profile ) <EOL> review_request_id = models . IntegerField ( null = True ) <EOL> diff_revision = models . IntegerField ( null = True ) <EOL> last_updated = ModificationTimestampField ( _ ( "<STR_LIT>" ) ) <EOL> status = models . CharField ( max_length = <NUM_LIT:1> , choices = STATUSES , blank = True ) <EOL> result = JSONField ( ) <EOL> def __unicode__ ( self ) : <EOL> return '<STR_LIT>' % ( self . profile . name , self . status ) <EOL> class Meta : <EOL> ordering = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> class AutomaticRunGroup ( models . Model ) : <EOL> """<STR_LIT>""" <EOL> name = models . CharField ( max_length = <NUM_LIT> , blank = False ) <EOL> file_regex = models . CharField ( <EOL> _ ( '<STR_LIT>' ) , <EOL> max_length = <NUM_LIT> , <EOL> help_text = _ ( '<STR_LIT>' <EOL> '<STR_LIT>' ) ) <EOL> profile = models . ManyToManyField ( Profile , blank = False ) <EOL> repository = models . ManyToManyField ( Repository , blank = True ) <EOL> local_site = models . ForeignKey ( <EOL> LocalSite , <EOL> blank = True , <EOL> null = True , <EOL> related_name = '<STR_LIT>' ) <EOL> objects = AutomaticRunGroupManager ( ) <EOL> def __unicode__ ( self ) : <EOL> return self . name <EOL> class ManualPermission ( models . Model ) : <EOL> """<STR_LIT>""" <EOL> user = models . ForeignKey ( User , unique = True , blank = False ) <EOL> local_site = models . ForeignKey ( LocalSite , blank = True , null = True , <EOL> related_name = '<STR_LIT>' ) <EOL> allow = models . BooleanField ( <EOL> default = False , <EOL> verbose_name = _ ( '<STR_LIT>' ) , <EOL> help_text = _ ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) ) <EOL> def __unicode__ ( self ) : <EOL> return self . user . username <EOL> Repository . _meta . _fill_related_many_to_many_cache ( ) <EOL> Repository . _meta . init_name_map ( ) </s>
