pylsl/pylsl.py
def pull_sample(self, timeout=FOREVER, sample=None):
        """Pull a sample from the inlet and return it.
        
        Keyword arguments:
        timeout -- The timeout for this operation, if any. (default FOREVER)
                   If this is passed as 0.0, then the function returns only a 
                   sample if one is buffered for immediate pickup.
        
        Returns a tuple (sample,timestamp) where sample is a list of channel 
        values and timestamp is the capture time of the sample on the remote 
        machine, or (None,None) if no new sample was available. To remap this 
        time stamp to the local clock, add the value returned by 
        .time_correction() to it. 
        
        Throws a LostError if the stream source has been lost. Note that, if 
        the timeout expires, no TimeoutError is thrown (because this case is 
        not considered an error).

        """
        
        # support for the legacy API
        if type(timeout) is list:
            assign_to = timeout
            timeout = sample if type(sample) is float else 0.0
        else:
            assign_to = None
                
        errcode = c_int()
        timestamp = self.do_pull_sample(self.obj, byref(self.sample),
                                        self.channel_count, c_double(timeout),
                                        byref(errcode))
        handle_error(errcode)
        if timestamp:
            sample = [v for v in self.sample]
            if self.channel_format == cf_string:
                sample = [v.decode('utf-8') for v in sample]
            if assign_to is not None:
                assign_to[:] = sample
            return sample, timestamp
        else:
            return None, None
def pull_sample(self, timeout=FOREVER, sample=None):
        """Pull a sample from the inlet and return it.
        
        Keyword arguments:
        timeout -- The timeout for this operation, if any. (default FOREVER)
                   If this is passed as 0.0, then the function returns only a 
                   sample if one is buffered for immediate pickup.
        
        Returns a tuple (sample,timestamp) where sample is a list of channel 
        values and timestamp is the capture time of the sample on the remote 
        machine, or (None,None) if no new sample was available. To remap this 
        time stamp to the local clock, add the value returned by 
        .time_correction() to it. 
        
        Throws a LostError if the stream source has been lost. Note that, if 
        the timeout expires, no TimeoutError is thrown (because this case is 
        not considered an error).

        """
        
        # support for the legacy API
        if type(timeout) is list:
            assign_to = timeout
            timeout = sample if type(sample) is float else 0.0
        else:
            assign_to = None
                
        errcode = c_int()
        timestamp = self.do_pull_sample(self.obj, byref(self.sample),
                                        self.channel_count, c_double(timeout),
                                        byref(errcode))
        handle_error(errcode)
        if timestamp:
            sample = [v for v in self.sample]
            if self.channel_format == cf_string:
                sample = [v.decode('utf-8') for v in sample]
            if assign_to is not None:
                assign_to[:] = sample
            return sample, timestamp
        else:
            return None, None
Pull a sample from the inlet and return it.
        
        Keyword arguments:
        timeout -- The timeout for this operation, if any. (default FOREVER)
                   If this is passed as 0.0, then the function returns only a 
                   sample if one is buffered for immediate pickup.
        
        Returns a tuple (sample,timestamp) where sample is a list of channel 
        values and timestamp is the capture time of the sample on the remote 
        machine, or (None,None) if no new sample was available. To remap this 
        time stamp to the local clock, add the value returned by 
        .time_correction() to it. 
        
        Throws a LostError if the stream source has been lost. Note that, if 
        the timeout expires, no TimeoutError is thrown (because this case is 
        not considered an error).