Pull directives out of the specified entry stream.

    :param entrystream: a stream of entries
    :param type: retrieve only directives of the specified type; set to
                 :code:`None` to retrieve all directives
555065
def directives(entrystream, type=None):
    
    for directive in entry_type_filter(entrystream, tag.Directive):
        if not type or type == directive.type:
            yield directive
798655
public static <T> List<T> readValues(InputStream inputStream, Class<T> type) throws IOException {
        return DataModelSerializer.deserializeList(inputStream, type);
    }
508302
def from_bytes(cls, bitstream):
        '''
        
        '''
        from pylisp.packet.lisp.control import type_registry

        # Convert to ConstBitStream (if not already provided)
        if not isinstance(bitstream, ConstBitStream):
            if isinstance(bitstream, Bits):
                bitstream = ConstBitStream(auto=bitstream)
            else:
                bitstream = ConstBitStream(bytes=bitstream)

        # Peek at the bitstream to see which type it is
        type_nr = bitstream.peek('uint:4')

        # Look for the right class
        type_class = type_registry.get_type_class(type_nr)
        if not type_class:
            raise ValueError("Can't handle message type {0}".format(type_nr))

        # Let the specific class handle it from now on
        return type_class.from_bytes(bitstream)
1312031
static IntStream stream(
        IntTuple tuple, int startInclusive, int endExclusive) 
    {
        IntTupleSpliterator intTupleSpliterator = 
            new IntTupleSpliterator(
                tuple, startInclusive, endExclusive);
        return StreamSupport.intStream(intTupleSpliterator, false);
    }
600925
public static StreamSpecifier stream(StreamSpecifierType type, int index) {
    checkNotNull(type);
    return new StreamSpecifier(type.toString() + ":" + index);
  }
959536
public static boolean viewerIsEditor(String type) {
        Object viewer = s_viewers.get(type);
        if (viewer != null) {
            return viewer instanceof ContentEditor;
        } else {
            return false;
        }
    }
1206209
def _make_stream_reader(cls, stream):
        
        endian = cls._detect_endian(stream)
        return StreamReader(stream, endian)
233024
public static <T extends Serializable> T deserializeFromStream(InputStream in, Class<T> type) throws ClassNotFoundException, IOException
	{
		ObjectInputStream objIn;
		T obj;

		if(in instanceof ObjectInputStream)
			objIn = (ObjectInputStream)in;
		else
			objIn = new ObjectInputStream(in);

		obj = type.cast(objIn.readObject());
		// to close or not to close... That is the question...
		// we close... It doesn't make too much sense to have a stream with more afterwards...There would be two
		// stream headers...
		objIn.close();
		return obj;
	}
738378
def open(self, path, mode='r'):
        """"""

        entry = self.find(path)
        if entry is None:
            if mode == 'r':
                raise ValueError("stream does not exists: %s" % path)
            entry = self.create_dir_entry(path, 'stream', None)

        else:
            if not entry.isfile():
                raise ValueError("can only open stream type DirEntry's")

            if mode == 'w':
                logging.debug("stream: %s exists, overwriting" % path)
                self.free_fat_chain(entry.sector_id, entry.byte_size < self.min_stream_max_size)
                entry.sector_id = None
                entry.byte_size = 0
                entry.class_id = None
            elif mode == 'rw':
                pass

        s = Stream(self, entry, mode)
        return s
999786
def entrypoint(cls):
    
    if not isinstance(cls, type) or not issubclass(cls, Command):
        raise TypeError(f"inappropriate entrypoint instance of type {cls.__class__}")
    cls._argcmdr_entrypoint_ = True
    return cls
1078366
function createReadStream(wofConfig, types, wofAdminRecords) {
  const wofRoot = wofConfig.datapath;
  const metaFilePaths = getMetaFilePaths(wofRoot, types);

  // Select correct stream between meta and SQLite based on config and do specialized stuff
  const stream = wofConfig.sqlite === true ?
    createSQLiteRecordStream(getSqliteFilePaths(wofRoot, types), wofConfig.importPlace)
      .pipe(toJSONStream.create()) :
    createMetaRecordStream(metaFilePaths, types)
      .pipe(isNotNullIslandRelated.create())
      .pipe(loadJSON.create(wofRoot, wofConfig.missingFilesAreFatal));

  // All the pipeline is the same for both meta and SQLite streams
  return stream
  .pipe(recordHasIdAndProperties.create())
  .pipe(isActiveRecord.create())
  .pipe(extractFields.create())
  .pipe(recordHasName.create())
  .pipe(through2.obj(function(wofRecord, enc, callback) {
    // store admin records in memory to traverse the heirarchy
    if (wofRecord.place_type !== 'venue' && wofRecord.place_type !== 'postalcode') {
      wofAdminRecords[wofRecord.id] = wofRecord;
    }

    callback(null, wofRecord);
  }));
}
255396
def get_content_type (headers):
    
    ptype = headers.get('Content-Type', 'application/octet-stream')
    if ";" in ptype:
        # split off not needed extension info
        ptype = ptype.split(';')[0]
    return ptype.strip().lower()
1334028
protected function extractStream()
    {
        while (true) {
            $buffer = $this->reader->getBuffer(false);
            $length = \strpos($buffer, 'endstream');
            if ($length === false) {
                if (!$this->reader->increaseLength(100000)) {
                    throw new PdfTypeException('Cannot extract stream.');
                }
                continue;
            }
            break;
        }

        $buffer = \substr($buffer, 0, $length);
        $lastByte = \substr($buffer, -1);

        /* Check for EOL marker =
         *   CARRIAGE RETURN (\r) and a LINE FEED (\n) or just a LINE FEED (\n},
         *   and not by a CARRIAGE RETURN (\r) alone
         */
        if ($lastByte === "\n") {
            $buffer = \substr($buffer, 0, -1);

            $lastByte = \substr($buffer, -1);
            if ($lastByte === "\r") {
                $buffer = \substr($buffer, 0, -1);
            }
        }

        return $buffer;
    }
1374008
def as_stream(self):
        

        if not self.singular:
            raise ArgumentError("Attempted to convert a non-singular selector to a data stream, it matches multiple", selector=self)

        return DataStream(self.match_type, self.match_id, self.match_spec == DataStreamSelector.MatchSystemOnly)
1067154
function getProductsStream (types) {
  var stream = JSONStream.stringify(false);
  this.getProductsLists().then(function (lists) {
    this.getProductsDetails(selectProducts(types, lists), true)
        .pipe(JSONStream.parse())
        .pipe(stream);
  }.bind(this));
  return stream;
}
204074
def from_stream(cls, stream):
        
        chunk_parser = _ChunkParser.from_stream(stream)
        chunks = [chunk for chunk in chunk_parser.iter_chunks()]
        return cls(chunks)
820718
synchronized public boolean selectInputStreams(
      Collection<EditLogInputStream> streams, long fromTxId,
      boolean inProgressOk, boolean validateInProgressSegments,
      int minRedundancy) throws IOException {
    final PriorityQueue<EditLogInputStream> allStreams = 
        new PriorityQueue<EditLogInputStream>(64,
            EDIT_LOG_INPUT_STREAM_COMPARATOR);
    for (JournalAndStream jas : journals) {
      if (jas.isDisabled()) {
        LOG.info("Skipping jas " + jas + " since it's disabled");
        continue;
      }
      try {
        jas.getManager().selectInputStreams(allStreams, fromTxId, inProgressOk,
            validateInProgressSegments);
      } catch (IOException ioe) {
        LOG.warn("Unable to determine input streams from " + jas.getManager()
            + ". Skipping.", ioe);
      }
    }
    return chainAndMakeRedundantStreams(streams, allStreams, fromTxId,
        inProgressOk, minRedundancy);
  }