コード例 #1
0
ファイル: stats.py プロジェクト: rmistry/luci-py
    def accumulate(self, rhs):
        """Accumulates data from rhs into self."""
        stats_framework.accumulate(
            self, rhs, ['bot_ids', 'bot_ids_bad', 'buckets', 'users'])
        self.bot_ids = sorted(set(self.bot_ids) | set(rhs.bot_ids))
        self.bot_ids_bad = sorted(set(self.bot_ids_bad) | set(rhs.bot_ids_bad))
        lhs_dimensions = dict((i.dimensions, i) for i in self.buckets)
        rhs_dimensions = dict((i.dimensions, i) for i in rhs.buckets)
        for key in set(rhs_dimensions):
            if key not in lhs_dimensions:
                # Make a copy of the right hand side so no aliasing occurs.
                lhs_dimensions[key] = rhs_dimensions[key].__class__()
                # Call the root method directly so 'enhancements' do not get in the way.
                lhs_dimensions[key].populate(
                    **ndb.Model.to_dict(rhs_dimensions[key]))
            else:
                lhs_dimensions[key].accumulate(rhs_dimensions[key])
        self.buckets = sorted(lhs_dimensions.itervalues(),
                              key=lambda i: i.dimensions)

        lhs_users = dict((i.user, i) for i in self.users)
        rhs_users = dict((i.user, i) for i in rhs.users)
        for key in set(rhs_users):
            if key not in lhs_users:
                # Make a copy of the right hand side so no aliasing occurs.
                lhs_users[key] = rhs_users[key].__class__()
                # Call the root method directly so 'enhancements' do not get in the way.
                lhs_users[key].populate(**ndb.Model.to_dict(lhs_users[key]))
            else:
                lhs_users[key].accumulate(rhs_users[key])
        self.users = sorted(lhs_users.itervalues(), key=lambda i: i.user)
コード例 #2
0
ファイル: stats.py プロジェクト: misscache/luci-py
  def accumulate(self, rhs):
    """Accumulates data from rhs into self."""
    stats_framework.accumulate(
        self, rhs, ['bot_ids', 'bot_ids_bad', 'buckets', 'users'])
    self.bot_ids = sorted(set(self.bot_ids) | set(rhs.bot_ids))
    self.bot_ids_bad = sorted(set(self.bot_ids_bad) | set(rhs.bot_ids_bad))
    lhs_dimensions = dict((i.dimensions, i) for i in self.buckets)
    rhs_dimensions = dict((i.dimensions, i) for i in rhs.buckets)
    for key in set(rhs_dimensions):
      if key not in lhs_dimensions:
        # Make a copy of the right hand side so no aliasing occurs.
        lhs_dimensions[key] = rhs_dimensions[key].__class__()
        # Call the root method directly so 'enhancements' do not get in the way.
        lhs_dimensions[key].populate(**ndb.Model.to_dict(rhs_dimensions[key]))
      else:
        lhs_dimensions[key].accumulate(rhs_dimensions[key])
    self.buckets = sorted(
        lhs_dimensions.itervalues(), key=lambda i: i.dimensions)

    lhs_users = dict((i.user, i) for i in self.users)
    rhs_users = dict((i.user, i) for i in rhs.users)
    for key in set(rhs_users):
      if key not in lhs_users:
        # Make a copy of the right hand side so no aliasing occurs.
        lhs_users[key] = rhs_users[key].__class__()
        # Call the root method directly so 'enhancements' do not get in the way.
        lhs_users[key].populate(**ndb.Model.to_dict(lhs_users[key]))
      else:
        lhs_users[key].accumulate(rhs_users[key])
    self.users = sorted(lhs_users.itervalues(), key=lambda i: i.user)
コード例 #3
0
ファイル: stats.py プロジェクト: misscache/luci-py
 def accumulate(self, rhs):
   assert self.user == rhs.user
   stats_framework.accumulate(self, rhs, ['user'])
コード例 #4
0
ファイル: stats.py プロジェクト: misscache/luci-py
 def accumulate(self, rhs):
   assert self.dimensions == rhs.dimensions
   stats_framework.accumulate(
       self, rhs, ['bot_ids', 'bot_ids_bad', 'dimensions'])
   self.bot_ids = sorted(set(self.bot_ids) | set(rhs.bot_ids))
   self.bot_ids_bad = sorted(set(self.bot_ids_bad) | set(rhs.bot_ids_bad))
コード例 #5
0
 def accumulate(self, rhs):
     # accumulate() specifically handles where default value is a class instance.
     return stats_framework.accumulate(self, rhs, ['d'])
コード例 #6
0
 def accumulate(self, rhs):
     return stats_framework.accumulate(self, rhs, [])
コード例 #7
0
 def accumulate(self, rhs):
   # accumulate() specifically handles where default value is a class instance.
   return stats_framework.accumulate(self, rhs, ['d'])
コード例 #8
0
 def accumulate(self, rhs):
   return stats_framework.accumulate(self, rhs, [])
コード例 #9
0
ファイル: stats.py プロジェクト: rmistry/luci-py
 def accumulate(self, rhs):
     assert self.user == rhs.user
     stats_framework.accumulate(self, rhs, ['user'])
コード例 #10
0
ファイル: stats.py プロジェクト: rmistry/luci-py
 def accumulate(self, rhs):
     assert self.dimensions == rhs.dimensions
     stats_framework.accumulate(self, rhs,
                                ['bot_ids', 'bot_ids_bad', 'dimensions'])
     self.bot_ids = sorted(set(self.bot_ids) | set(rhs.bot_ids))
     self.bot_ids_bad = sorted(set(self.bot_ids_bad) | set(rhs.bot_ids_bad))