예제 #1
0
 def create():
     dt235 = datetime.utcfromtimestamp(235)
     dt255 = datetime.utcfromtimestamp(255)
     return xs.pipe(
             ops.take_until_with_time(dt255),
             ops.take_until_with_time(dt235),
             )
예제 #2
0
 def recursive_predict(self):
     if self.is_prediction_mode:
         self.processor.add_data_batch(self.data_to_predict)
         # X = self.processor.pca(self.processor.processed_data.reshape(1, -1))
         self.trainer.predict(self.data_to_predict)
     self.connector.data.pipe(take_until_with_time(1)).subscribe(
         observer=self.loop_data,
         on_error=print,
         on_completed=self.recursive_predict)
예제 #3
0
 def record(self, path='./processor_data', recording_length=10):
     if not self.is_recording:
         self._save_path = os.path.realpath(path)
         self.recorded_data = []
         self.is_recording = True
         self.data.pipe(take_until_with_time(recording_length)).subscribe(
             observer=lambda values: self.recorded_data.append(values),
             on_error=lambda e: print(e),
             on_completed=self._save)
     else:
         print('Already recording...')
예제 #4
0
    def __init__(self, poll: PollModel):
        """
        Initializes the class. If there is no duration for the poll or is inactive, it only will initialize
        with the poll attribute

        Attributes:
            poll(PollModel):    Object with the poll
        """
        # TODO check if is active
        self.poll = poll

        if self.poll.duration == -1:
            return

        # Use for avoid waiting to edit message
        # https://stackoverflow.com/questions/53722398/how-to-send-a-message-with-discord-py-from-outside-the-event-loop-i-e-from-pyt
        self._loop = asyncio.get_event_loop()

        self.sub = rx.interval(REFRESH_RATE).pipe(
            # Seconds that the poll will last
            op.take_until_with_time(self.poll.duration))

        self.subscribe()
예제 #5
0
 def create():
     dt = datetime.utcfromtimestamp(250)
     return xs.pipe(ops.take_until_with_time(dt))
예제 #6
0
 def create():
     return xs.pipe(ops.take_until_with_time(datetime.utcfromtimestamp(0)))