コード例 #1
0
 def __init__(self, timestamp, element=None, existing_windows=None):
   self.timestamp = Timestamp.of(timestamp)
   self.element = element
   self.existing_windows = existing_windows
コード例 #2
0
 def __init__(self, size, period, offset=0):
   if size <= 0:
     raise ValueError('The size parameter must be strictly positive.')
   self.size = Duration.of(size)
   self.period = Duration.of(period)
   self.offset = Timestamp.of(offset) % size
コード例 #3
0
 def assign(self, context):
   timestamp = context.timestamp
   start = timestamp - (timestamp - self.offset) % self.period
   return [IntervalWindow(Timestamp.of(s), Timestamp.of(s) + self.size)
           for s in range(start, start - self.size, -self.period)]
コード例 #4
0
 def __init__(self, value, timestamp):
   self.value = value
   self.timestamp = Timestamp.of(timestamp)
コード例 #5
0
 def __init__(self, value, timestamp, windows):
   self.value = value
   self.timestamp = Timestamp.of(timestamp)
   self.windows = windows
コード例 #6
0
 def __init__(self, start, end):
   super(IntervalWindow, self).__init__(end)
   self.start = Timestamp.of(start)
コード例 #7
0
 def __init__(self, end):
   self.end = Timestamp.of(end)
コード例 #8
0
 def test_of(self):
   interval = Timestamp(123)
   self.assertEqual(id(interval), id(Timestamp.of(interval)))
   self.assertEqual(interval, Timestamp.of(123.0))
   with self.assertRaises(TypeError):
     Timestamp.of(Duration(10))