To turn on datastream
        :param datastream: string
778304
def on_datastream(self, datastream):
        
        url = '/datastream/' + str(datastream) + '/on'
        response = self.http.post(url,"")
        return response
342561
private static DatastreamInfo convertGenDatastreamDefToDatastreamInfo(Datastream ds) {
        return new DatastreamInfo(ds.getID(), ds.getMIMEType(), ds
                .getFormatURI());
    }
512437
public void print(PrintStream stream) {
    if (mSeries.isEmpty()) {
      return;
    }
    long start = mSeries.firstKey();
    stream.printf("Time series starts at %d with width %d.%n", start, mWidthNano);
    int bucketIndex = 0;
    Iterator<Map.Entry<Long, Integer>> it = mSeries.entrySet().iterator();

    Map.Entry<Long, Integer> current = it.next();
    while (current != null) {
      int numEvents = 0;
      if (bucketIndex * mWidthNano + start == current.getKey()) {
        numEvents = current.getValue();
        current = null;
        if (it.hasNext()) {
          current = it.next();
        }
      }
      stream.printf("%d %d%n", bucketIndex, numEvents);
      bucketIndex++;
    }
  }
565257
def reset_stream(stream):
    
    try:
        position = stream.tell()
    except Exception:
        position = True
    if position != 0:
        try:
            stream.seek(0)
        except Exception:
            message = 'It\'s not possible to reset this stream'
            raise exceptions.TabulatorException(message)
284840
def start(self):
        
        assert not self._started
        self._listening_stream.on_recv(self._recv_callback)
        self._started = True
882060
def _find_datastream(self, name):
        """"""
        for stream in self.data_streams: #search to see if this is a new datastream or a known one
            if stream.name == name:
                return stream
        return None
119568
def _data_block(stream):
    
    while len(stream) > 0:
        line = stream.popleft()

        if line.startswith('>'):
            yield DataHeader(line[1:].strip())
        else:
            data_item = line.strip()
            if data_item:
                yield DataItem(line)
            else:
                continue
697840
def _open_data_stream(self):
        '''
        '''
        @asyncio.coroutine
        def connection_factory(address: Tuple[int, int]):
            self._data_connection = yield from self._acquire_connection(address[0], address[1])
            return self._data_connection

        self._data_stream = yield from self._commander.setup_data_stream(
            connection_factory
        )

        self._response.data_address = self._data_connection.address

        read_callback = functools.partial(self.event_dispatcher.notify, self.Event.transfer_receive_data)
        self._data_stream.data_event_dispatcher.add_read_listener(read_callback)

        write_callback = functools.partial(self.event_dispatcher.notify, self.Event.transfer_send_data)
        self._data_stream.data_event_dispatcher.add_write_listener(write_callback)
901930
def _activate(self):
        """"""
        if six.callable(self.streamer):
            # If it's a function, create the stream.
            self.stream_ = self.streamer(*(self.args), **(self.kwargs))

        else:
            # If it's iterable, use it directly.
            self.stream_ = iter(self.streamer)
913492
boolean openStream() throws InterruptedException, IOException {
    logger.info("stream START");
    final boolean isOpen;
    final Set<BsonValue> idsToWatch = nsConfig.getSynchronizedDocumentIds();

    if (!networkMonitor.isConnected()) {
      logger.info("stream END - Network disconnected");
      return false;
    }

    if (idsToWatch.isEmpty()) {
      logger.info("stream END - No synchronized documents");
      return false;
    }

    nsLock.writeLock().lockInterruptibly();
    try {
      if (!authMonitor.isLoggedIn()) {
        logger.info("stream END - Logged out");
        return false;
      }

      final Document args = new Document();
      args.put("database", namespace.getDatabaseName());
      args.put("collection", namespace.getCollectionName());
      args.put("ids", idsToWatch);

      currentStream =
        service.streamFunction(
            "watch",
            Collections.singletonList(args),
            ResultDecoders.changeEventDecoder(BSON_DOCUMENT_CODEC));

      if (currentStream != null && currentStream.isOpen()) {
        this.nsConfig.setStale(true);
        isOpen = true;
      } else {
        isOpen = false;
      }
    } finally {
      nsLock.writeLock().unlock();
    }
    return isOpen;
  }
219151
def do_show_logical_switch(self, line):
        

        def f(p, args):
            try:
                (lsw,) = args
            except:
                print("argument error")
                return
            o = p.get()
            for s in o.logical_switches.switch:
                if s.id != lsw:
                    continue
                print(s.id)
                print('datapath-id %s' % s.datapath_id)
                if s.resources.queue:
                    print('queues:')
                    for q in s.resources.queue:
                        print('\t %s' % q)
                if s.resources.port:
                    print('ports:')
                    for p in s.resources.port:
                        print('\t %s' % p)

        self._request(line, f)
586847
def turn_on(self, time):
        """"""
        self._elk.send(cn_encode(self._index, time))
150149
function ReadableUSBStream(endpoint, options)
{
	stream.Readable.call(this, options);

	this.endpoint = endpoint;
	this.endpoint.addListener('data', this.onData.bind(this));
	this.endpoint.addListener('error', this.onError.bind(this));
	this.endpoint.addListener('end', this.onEnd.bind(this));

	this.paused = true;
}
822392
def start_listener(self):
        ''''''
        if self.sock is not None:
            self.sock.close()
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
        self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        self.sock.bind(('', self.asterix_settings.port))
        self.sock.setblocking(False)
        print("Started on port %u" % self.asterix_settings.port)
540442
def _call(self, stream, func):
        
        try:
            func(self)
        except Exception:
            LOG.exception('%r crashed', stream)
            stream.on_disconnect(self)
555481
def turn_on(host, did, token=None):
    """"""
    urllib3.disable_warnings()
    if token:
        scheme = "https"
    if not token:
        scheme = "http"
        token = "1234567890"
    url = (
            scheme + '://' + host + '/gwr/gop.php?cmd=DeviceSendCommand&data=<gip><version>1</version><token>' + token + '</token><did>' + did + '</did><value>1</value></gip>&fmt=xml')
    response = requests.get(url, verify=False)
    if response.status_code == '200':
        return True
    else:
        return False
377122
def get_datastream_data(self, datastream, options):
        

        response_format=None
        if options and 'format' in options and options['format'] is not None:
            response_format = options['format']
            options['format'] = None

        url = '/datastream/' + str(datastream) + '/data'
        response = self.http.downstream(url, response_format)
        return response