home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / python2.6 / dist-packages / launchpadbugs / bugbase.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  18.1 KB  |  354 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. from utils import valid_lp_url, bugnumber_to_url
  5. from lphelper import LateBindingProperty
  6. from lpconstants import BASEURL
  7.  
  8. class LPBugInfo(object):
  9.     
  10.     def __init__(self, nr, url, status, importance, summary, package = None, all_tasks = False):
  11.         if not nr:
  12.             raise AssertionError, "'LPBugInfo' needs at least the bugnumber as an argument"
  13.         self._LPBugInfo__bugnumber = int(nr)
  14.         self._LPBugInfo__url = url
  15.         self._LPBugInfo__status = status
  16.         self._LPBugInfo__importance = importance
  17.         self._LPBugInfo__summary = summary
  18.         self._LPBugInfo__sourcepackage = package
  19.         self._LPBugInfo__all_tasks = all_tasks
  20.  
  21.     
  22.     def bugnumber(self):
  23.         return int(self._LPBugInfo__bugnumber)
  24.  
  25.     bugnumber = property(bugnumber)
  26.     
  27.     def url(self):
  28.         if not self._LPBugInfo__url:
  29.             pass
  30.         return bugnumber_to_url(self.bugnumber)
  31.  
  32.     url = property(url)
  33.     
  34.     def status(self):
  35.         if not self._LPBugInfo__status:
  36.             pass
  37.         return 'unknown'
  38.  
  39.     status = property(status)
  40.     
  41.     def importance(self):
  42.         if not self._LPBugInfo__importance:
  43.             pass
  44.         return 'unknown'
  45.  
  46.     importance = property(importance)
  47.     
  48.     def summary(self):
  49.         if not self._LPBugInfo__summary:
  50.             pass
  51.         return 'unknown'
  52.  
  53.     summary = property(summary)
  54.     
  55.     def sourcepackage(self):
  56.         if not self._LPBugInfo__sourcepackage:
  57.             pass
  58.         return ''
  59.  
  60.     sourcepackage = property(sourcepackage)
  61.     
  62.     def __int__(self):
  63.         return self.bugnumber
  64.  
  65.     
  66.     def __repr__(self):
  67.         return '<BugInfo %s>' % self.bugnumber
  68.  
  69.     
  70.     def __str__(self):
  71.         return '[Bug %s %s: %s/%s]' % (self.bugnumber, self.sourcepackage, self.status, self.importance)
  72.  
  73.     
  74.     def __hash__(self):
  75.         if not self._LPBugInfo__all_tasks:
  76.             return self.bugnumber
  77.         return super(LPBugInfo, self).__hash__()
  78.  
  79.     
  80.     def __eq__(self, other):
  81.         return hash(self) == hash(other)
  82.  
  83.  
  84.  
  85. class Bug(object):
  86.     
  87.     def __init__(self, bug = None, url = None, connection = None):
  88.         if not [](_[1]) == 1:
  89.             raise AssertionError, 'Bug needs one argument, either <bug> or <url>'
  90.         if not connection:
  91.             raise AssertionError, 'Connection object needed'
  92.         (self._Bug__bugnumber, self._Bug__url, self._Bug__status, self._Bug__importance, self._Bug__sourcepackage, self._Bug__summary) = [
  93.             None] * 6
  94.         self._Bug__connection = connection
  95.         self._Bug__saved_hash = None
  96.         if bug:
  97.             if isinstance(bug, int):
  98.                 self._Bug__bugnumber = bug
  99.                 self._Bug__url = bugnumber_to_url(self._Bug__bugnumber)
  100.             elif isinstance(bug, LPBugInfo):
  101.                 self._Bug__bugnumber = int(bug)
  102.                 self._Bug__url = bug.url
  103.                 self._Bug__status = bug.status
  104.                 self._Bug__importance = bug.importance
  105.                 self._Bug__sourcepackage = bug.sourcepackage
  106.                 self._Bug__summary = bug.summary
  107.                 self._Bug__saved_hash = hash(bug)
  108.             elif not None:
  109.                 raise AssertionError, 'type of bugnumber must be INT or STRING or bugnumber must be an instance of BugInfo, %s' % bug
  110.             [] if isinstance(bug, str) else [](_[1]) == 1
  111.         elif url:
  112.             self._Bug__url = valid_lp_url(url, BASEURL.BUG)
  113.             if not self._Bug__url:
  114.                 raise AssertionError, 'Invalid launchpad url %s' % url
  115.             self._Bug__bugnumber = int(self._Bug__url.split('/')[-1])
  116.         
  117.  
  118.     
  119.     def __int__(self):
  120.         return int(self.bugnumber)
  121.  
  122.     
  123.     def __repr__(self):
  124.         return '<Bug %s>' % self.bugnumber
  125.  
  126.     
  127.     def __str__(self):
  128.         if not self.sourcepackage:
  129.             pass
  130.         return '[Bug %s %s: %s/%s]' % (self.bugnumber, '', self.status, self.importance)
  131.  
  132.     
  133.     def __hash__(self):
  134.         if self._Bug__saved_hash is not None:
  135.             return self._Bug__saved_hash
  136.         return super(Bug, self).__hash__()
  137.  
  138.     
  139.     def __eq__(self, other):
  140.         return hash(self) == hash(other)
  141.  
  142.     
  143.     def get_url(self):
  144.         return self._Bug__url
  145.  
  146.     url = property(get_url, doc = 'returns url of a bug report')
  147.     
  148.     def get_bugnumber(self):
  149.         return self._Bug__bugnumber
  150.  
  151.     bugnumber = property(get_bugnumber, doc = 'returns bugnumber of a bug report')
  152.     
  153.     def get_reporter(self):
  154.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  155.  
  156.     reporter = LateBindingProperty(get_reporter, doc = 'returns reporter of a bugreport')
  157.     
  158.     def get_date(self):
  159.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  160.  
  161.     date_reported = date = LateBindingProperty(get_date, doc = 'returns date of a bugreport')
  162.     
  163.     def get_text(self):
  164.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  165.  
  166.     text = LateBindingProperty(get_text, doc = 'returns raw text of a bugreport (.description & .comments.text)')
  167.     
  168.     def get_activity(self):
  169.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  170.  
  171.     activity = LateBindingProperty(get_activity, doc = 'parses the activity log')
  172.     
  173.     def get_duplicates(self):
  174.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  175.  
  176.     duplicates = LateBindingProperty(get_duplicates, doc = 'returns a set of duplicates')
  177.     
  178.     def get_description_raw(self):
  179.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  180.  
  181.     description_raw = LateBindingProperty(get_description_raw, doc = 'returns description in raw format')
  182.     
  183.     def get_title(self):
  184.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  185.  
  186.     
  187.     def set_title(self, title):
  188.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  189.  
  190.     summary = title = LateBindingProperty(get_title, set_title, doc = 'returns title of a bugreport')
  191.     
  192.     def get_description(self):
  193.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  194.  
  195.     
  196.     def set_description(self, description):
  197.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  198.  
  199.     description = LateBindingProperty(get_description, set_description, doc = 'description of a bugreport')
  200.     
  201.     def get_tags(self):
  202.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  203.  
  204.     tags = LateBindingProperty(get_tags, doc = 'tags of a bugreport')
  205.     
  206.     def get_nickname(self):
  207.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  208.  
  209.     
  210.     def set_nickname(self, nickname):
  211.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  212.  
  213.     nickname = LateBindingProperty(get_nickname, set_nickname, doc = 'nickname of a bugreport')
  214.     
  215.     def get_infotable(self):
  216.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  217.  
  218.     infotable = LateBindingProperty(get_infotable, doc = 'returns the infotable of a bugreport')
  219.     
  220.     def get_info(self):
  221.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  222.  
  223.     info = LateBindingProperty(get_info, doc = 'returns the infotable of a bugreport')
  224.     
  225.     def get_target(self):
  226.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  227.  
  228.     
  229.     def set_target(self, target):
  230.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  231.  
  232.     target = LateBindingProperty(get_target, set_target, doc = 'returns target of a bugreport')
  233.     
  234.     def get_importance(self):
  235.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  236.  
  237.     
  238.     def set_importance(self, importance):
  239.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  240.  
  241.     importance = LateBindingProperty(get_importance, set_importance, doc = 'returns importance of a bugreport')
  242.     
  243.     def get_status(self):
  244.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  245.  
  246.     
  247.     def set_status(self, status):
  248.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  249.  
  250.     status = LateBindingProperty(get_status, set_status, doc = 'returns status of a bugreport')
  251.     
  252.     def get_milestone(self):
  253.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  254.  
  255.     
  256.     def set_milestone(self, milestone):
  257.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  258.  
  259.     milestone = LateBindingProperty(get_milestone, set_milestone, doc = 'returns milestone of a bugreport')
  260.     
  261.     def get_assignee(self):
  262.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  263.  
  264.     
  265.     def set_assignee(self, lplogin):
  266.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  267.  
  268.     assignee = LateBindingProperty(get_assignee, set_assignee, doc = 'returns assignee of a bugreport')
  269.     
  270.     def get_sourcepackage(self):
  271.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  272.  
  273.     
  274.     def set_sourcepackage(self, target):
  275.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  276.  
  277.     sourcepackage = LateBindingProperty(get_sourcepackage, set_sourcepackage, doc = 'sourcepackage of a bugreport')
  278.     
  279.     def get_affects(self):
  280.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  281.  
  282.     affects = LateBindingProperty(get_affects, doc = 'affected product of a bugreport')
  283.     
  284.     def get_duplicates(self):
  285.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  286.  
  287.     duplicates = LateBindingProperty(get_duplicates, doc = 'returns duplicates of a bugreport')
  288.     
  289.     def get_duplicate(self):
  290.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  291.  
  292.     
  293.     def set_duplicate(self, bugnumber):
  294.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  295.  
  296.     duplicate_of = LateBindingProperty(get_duplicate, set_duplicate, doc = 'mark this bug as duplicate of another')
  297.     
  298.     def get_security(self):
  299.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  300.  
  301.     
  302.     def set_security(self, value):
  303.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  304.  
  305.     security = LateBindingProperty(get_security, set_security, doc = 'returns security of a bugreport')
  306.     
  307.     def get_private(self):
  308.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  309.  
  310.     
  311.     def set_private(self, value):
  312.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  313.  
  314.     private = LateBindingProperty(get_private, set_private, doc = 'returns private of a bugreport')
  315.     
  316.     def get_subscriptions(self):
  317.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  318.  
  319.     
  320.     def set_subscriptions(self, lplogin):
  321.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  322.  
  323.     subscribtions = subscriptions = subscribers = LateBindingProperty(get_subscriptions, set_subscriptions, doc = 'returns subscriptions to a bugreport')
  324.     
  325.     def get_subscriptions_category(self, type):
  326.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  327.  
  328.     
  329.     def get_comments(self):
  330.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  331.  
  332.     comments = LateBindingProperty(get_comments, doc = 'returns a list of comments of a bugreport')
  333.     
  334.     def get_attachments(self):
  335.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  336.  
  337.     attachments = LateBindingProperty(get_attachments, doc = 'returns a list of attachments of a bugreport')
  338.     
  339.     def get_mentors(self):
  340.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  341.  
  342.     mentors = LateBindingProperty(get_mentors, doc = 'returns mentoring information')
  343.     
  344.     def get_date_updated(self):
  345.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  346.  
  347.     date_updated = LateBindingProperty(get_date_updated, doc = 'returns date when bugreport was updated')
  348.     
  349.     def get_branches(self):
  350.         raise NotImplementedError, 'this method must be implemented by a concrete subclass'
  351.  
  352.     branches = LateBindingProperty(get_branches, doc = 'returns list of attached bzr branches')
  353.  
  354.