Read SHEETPROTECTION record (FEATHEADR)
191173
private function _readSheetProtection()
	{
		$length = self::_GetInt2d($this->_data, $this->_pos + 2);
		$recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length);

		// move stream pointer to next record
		$this->_pos += 4 + $length;

		if ($this->_readDataOnly) {
			return;
		}

		// offset: 0; size: 2; repeated record header

		// offset: 2; size: 2; FRT cell reference flag (=0 currently)

		// offset: 4; size: 8; Currently not used and set to 0

		// offset: 12; size: 2; Shared feature type index (2=Enhanced Protetion, 4=SmartTag)
		$isf = self::_GetInt2d($recordData, 12);
		if ($isf != 2) {
			return;
		}

		// offset: 14; size: 1; =1 since this is a feat header

		// offset: 15; size: 4; size of rgbHdrSData

		// rgbHdrSData, assume "Enhanced Protection"
		// offset: 19; size: 2; option flags
		$options = self::_GetInt2d($recordData, 19);

		// bit: 0; mask 0x0001; 1 = user may edit objects, 0 = users must not edit objects
		$bool = (0x0001 & $options) >> 0;
		$this->_phpSheet->getProtection()->setObjects(!$bool);

		// bit: 1; mask 0x0002; edit scenarios
		$bool = (0x0002 & $options) >> 1;
		$this->_phpSheet->getProtection()->setScenarios(!$bool);

		// bit: 2; mask 0x0004; format cells
		$bool = (0x0004 & $options) >> 2;
		$this->_phpSheet->getProtection()->setFormatCells(!$bool);

		// bit: 3; mask 0x0008; format columns
		$bool = (0x0008 & $options) >> 3;
		$this->_phpSheet->getProtection()->setFormatColumns(!$bool);

		// bit: 4; mask 0x0010; format rows
		$bool = (0x0010 & $options) >> 4;
		$this->_phpSheet->getProtection()->setFormatRows(!$bool);

		// bit: 5; mask 0x0020; insert columns
		$bool = (0x0020 & $options) >> 5;
		$this->_phpSheet->getProtection()->setInsertColumns(!$bool);

		// bit: 6; mask 0x0040; insert rows
		$bool = (0x0040 & $options) >> 6;
		$this->_phpSheet->getProtection()->setInsertRows(!$bool);

		// bit: 7; mask 0x0080; insert hyperlinks
		$bool = (0x0080 & $options) >> 7;
		$this->_phpSheet->getProtection()->setInsertHyperlinks(!$bool);

		// bit: 8; mask 0x0100; delete columns
		$bool = (0x0100 & $options) >> 8;
		$this->_phpSheet->getProtection()->setDeleteColumns(!$bool);

		// bit: 9; mask 0x0200; delete rows
		$bool = (0x0200 & $options) >> 9;
		$this->_phpSheet->getProtection()->setDeleteRows(!$bool);

		// bit: 10; mask 0x0400; select locked cells
		$bool = (0x0400 & $options) >> 10;
		$this->_phpSheet->getProtection()->setSelectLockedCells(!$bool);

		// bit: 11; mask 0x0800; sort cell range
		$bool = (0x0800 & $options) >> 11;
		$this->_phpSheet->getProtection()->setSort(!$bool);

		// bit: 12; mask 0x1000; auto filter
		$bool = (0x1000 & $options) >> 12;
		$this->_phpSheet->getProtection()->setAutoFilter(!$bool);

		// bit: 13; mask 0x2000; pivot tables
		$bool = (0x2000 & $options) >> 13;
		$this->_phpSheet->getProtection()->setPivotTables(!$bool);

		// bit: 14; mask 0x4000; select unlocked cells
		$bool = (0x4000 & $options) >> 14;
		$this->_phpSheet->getProtection()->setSelectUnlockedCells(!$bool);

		// offset: 21; size: 2; not used
	}
486650
private function _readRangeProtection()
	{
		$length = self::_GetInt2d($this->_data, $this->_pos + 2);
		$recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length);

		// move stream pointer to next record
		$this->_pos += 4 + $length;

		// local pointer in record data
		$offset = 0;

		if (!$this->_readDataOnly) {
			$offset += 12;

			// offset: 12; size: 2; shared feature type, 2 = enhanced protection, 4 = smart tag
			$isf = self::_GetInt2d($recordData, 12);
			if ($isf != 2) {
				// we only read FEAT records of type 2
				return;
			}
			$offset += 2;

			$offset += 5;

			// offset: 19; size: 2; count of ref ranges this feature is on
			$cref = self::_GetInt2d($recordData, 19);
			$offset += 2;

			$offset += 6;

			// offset: 27; size: 8 * $cref; list of cell ranges (like in hyperlink record)
			$cellRanges = array();
			for ($i = 0; $i < $cref; ++$i) {
				try {
					$cellRange = $this->_readBIFF8CellRangeAddressFixed(substr($recordData, 27 + 8 * $i, 8));
				} catch (PHPExcel_Exception $e) {
					return;
				}
				$cellRanges[] = $cellRange;
				$offset += 8;
			}

			// offset: var; size: var; variable length of feature specific data
			$rgbFeat = substr($recordData, $offset);
			$offset += 4;

			// offset: var; size: 4; the encrypted password (only 16-bit although field is 32-bit)
			$wPassword = self::_GetInt4d($recordData, $offset);
			$offset += 4;

			// Apply range protection to sheet
			if ($cellRanges) {
				$this->_phpSheet->protectCells(implode(' ', $cellRanges), strtoupper(dechex($wPassword)), true);
			}
		}
	}
614166
def read_header(header_labels, options, ensemble_list=None):
    

    # set input variables
    filename = os.path.basename(options.inputpath)
    if ensemble_list:
        score_field = ensemble_list[0]
        ensemble_size = len(ensemble_list)
    else:
        score_field = options.score_field
        ensemble_size = options.ensemble_size


    status_field = options.status_field

    # check on score field values
    if ensemble_list:
        query_list = ensemble_list
        # verify that the input queries are in the inputfille
        if not [x for x in query_list if x in header_labels]:
            out = ' '.join(query_list)
            print("\n '{q}' are not in '{e}'\n".format(q=out, e=os.path.basename(filename)))
            sys.exit(1)
    else:
        score_field_matcher = re.compile(score_field)
        query_list = [x for x in header_labels if score_field_matcher.match(x)]

        if not query_list:
            print("\n There are no '{s}' columns in '{c}'\n".format(s=score_field, c=os.path.basename(filename)))
            sys.exit(1)

        # confirm that there are a sufficient no. of queries to generate
        # the requested ensemble size
        if len(query_list) < ensemble_size:
            print("\n '{s}' will support a maximum ensemble size of '{d}'\n".format(s=os.path.basename(filename),
                                                                              d=len(query_list)))
            sys.exit(1)

    # confirm that status field exists
    status_field_matcher = re.compile(status_field)
    if not any(x for x in header_labels if status_field_matcher.match(x)):
        print("\n The status_field column '{s}' doesn't exist\n".format(s=status_field))
        sys.exit(1)

    # initiate prop_column dictionary and csv column index
    prop_indices = {}
    index = 0

    for label in header_labels:
        prop_indices[label] = index
        index += 1

    return prop_indices
630067
def get_feats(self, doc):
		'''
		
		'''
		ngram_counter = Counter()
		for sent in doc.sents:
			ngram_counter += _phrase_counts(sent)
		return ngram_counter
406476
public List<String> getHeaderRowContents(String sheetName, int size) {
        return excelReader.getHeaderRowContents(sheetName, size);
    }
3891
def find_resistance(record):
    
    for feature in record.features:
        labels = set(feature.qualifiers.get("label", []))
        cassettes = labels.intersection(_ANTIBIOTICS)
        if len(cassettes) > 1:
            raise RuntimeError("multiple resistance cassettes detected")
        elif len(cassettes) == 1:
            return _ANTIBIOTICS.get(cassettes.pop())
    raise RuntimeError("could not find the resistance of '{}'".format(record.id))
87071
private function _writeScenProtect()
	{
		// Exit if sheet protection is not active
		if (!$this->_phpSheet->getProtection()->getSheet()) {
			return;
		}

		// Exit if scenarios are not protected
		if (!$this->_phpSheet->getProtection()->getScenarios()) {
			return;
		}

		$record = 0x00DD; // Record identifier
		$length = 0x0002; // Bytes to follow

		$header = pack('vv', $record, $length);
		$data = pack('v', 1);

		$this->_append($header . $data);
	}
1252815
private function _readHcenter()
	{
		$length = self::_GetInt2d($this->_data, $this->_pos + 2);
		$recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length);

		// move stream pointer to next record
		$this->_pos += 4 + $length;

		if (!$this->_readDataOnly) {
			// offset: 0; size: 2; 0 = print sheet left aligned, 1 = print sheet centered horizontally
			$isHorizontalCentered = (bool) self::_GetInt2d($recordData, 0);

			$this->_phpSheet->getPageSetup()->setHorizontalCentered($isHorizontalCentered);
		}
	}
444487
private function readVerticalPageBreaks()
    {
        $length = self::getInt2d($this->data, $this->pos + 2);
        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);

        // move stream pointer to next record
        $this->pos += 4 + $length;

        if ($this->version == self::XLS_BIFF8 && !$this->readDataOnly) {
            // offset: 0; size: 2; number of the following column index structures
            $nm = self::getInt2d($recordData, 0);

            // offset: 2; size: 6 * $nm; list of $nm row index structures
            for ($i = 0; $i < $nm; ++$i) {
                $c = self::getInt2d($recordData, 2 + 6 * $i);
                $rf = self::getInt2d($recordData, 2 + 6 * $i + 2);
                $rl = self::getInt2d($recordData, 2 + 6 * $i + 4);

                // not sure why two row indexes are necessary?
                $this->phpSheet->setBreakByColumnAndRow($c, $rf, PHPExcel_Worksheet::BREAK_COLUMN);
            }
        }
    }
6062
private function _readSheetPr()
	{
		$length = self::_GetInt2d($this->_data, $this->_pos + 2);
		$recordData = substr($this->_data, $this->_pos + 4, $length);

		// move stream pointer to next record
		$this->_pos += 4 + $length;

		// offset: 0; size: 2

		// bit: 6; mask: 0x0040; 0 = outline buttons above outline group
		$isSummaryBelow = (0x0040 & self::_GetInt2d($recordData, 0)) >> 6;
		$this->_phpSheet->setShowSummaryBelow($isSummaryBelow);

		// bit: 7; mask: 0x0080; 0 = outline buttons left of outline group
		$isSummaryRight = (0x0080 & self::_GetInt2d($recordData, 0)) >> 7;
		$this->_phpSheet->setShowSummaryRight($isSummaryRight);

		// bit: 8; mask: 0x100; 0 = scale printout in percent, 1 = fit printout to number of pages
		// this corresponds to radio button setting in page setup dialog in Excel
		$this->_isFitToPages = (bool) ((0x0100 & self::_GetInt2d($recordData, 0)) >> 8);
	}
204053
public Optional<SheetBindingErrors<P>> getBySheetIndex(final int sheetIndex) {
        return list.stream()
                .filter(b -> b.getSheetIndex() == sheetIndex)
                .findFirst();
    }
1310379
function _storeBoundsheet($sheetname,$offset)
    {
        $record    = 0x0085;                    // Record identifier
        if ($this->_BIFF_version == 0x0600) {
            $length    = 0x08 + strlen($sheetname); // Number of bytes to follow
        } else {
            $length = 0x07 + strlen($sheetname); // Number of bytes to follow
        }

        $grbit     = 0x0000;                    // Visibility and sheet type
        $cch       = strlen($sheetname);        // Length of sheet name

        $header    = pack("vv",  $record, $length);
        if ($this->_BIFF_version == 0x0600) {
            $data      = pack("Vvv", $offset, $grbit, $cch);
        } else {
            $data      = pack("VvC", $offset, $grbit, $cch);
        }
        $this->_append($header.$data.$sheetname);
    }
345514
def _read_arc_record(self):
        ""
        #XXX:Noufal Stream payload here rather than just read it
        # r = self.fileobj.readline() # Drop the initial newline
        # if r == "":
        #     return None
        # header = self.fileobj.readline()

        # Strip the initial new lines and read first line
        header = self.fileobj.readline()
        while header and header.strip() == "":
            header = self.fileobj.readline()

        if header == "":
            return None

        if int(self.version) == 1:
            arc_header_re = ARC1_HEADER_RE
        elif int(self.version) == 2:
            arc_header_re = ARC2_HEADER_RE

        matches = arc_header_re.search(header)
        headers = matches.groupdict()
        arc_header = ARCHeader(**headers)

        payload = self.fileobj.read(int(headers['length']))

        self.fileobj.readline() # Munge the separator newline.

        return ARCRecord(header = arc_header, payload = payload)
213900
def readall(cls, member, size):
        '''
        
        '''
        fp = member.library.fp
        LINE = member.library.LINE

        n = cls.header_match(fp.read(LINE))
        namestrs = [fp.read(size) for i in range(n)]

        # Each namestr field is 140 bytes long, but the fields are
        # streamed together and broken in 80-byte pieces. If the last
        # byte of the last namestr field does not fall in the last byte
        # of the 80-byte record, the record is padded with ASCII blanks
        # to 80 bytes.

        remainder = n * size % LINE
        if remainder:
            padding = 80 - remainder
            fp.read(padding)

        info = [cls.unpack(s) for s in namestrs]
        for d in info:
            d['format'] = Format(**d['format'])
            d['iformat'] = InputFormat(**d['iformat'])
        return [Variable(**d) for d in info]
407416
private function _readVerticalPageBreaks()
	{
		$length = self::_GetInt2d($this->_data, $this->_pos + 2);
		$recordData = substr($this->_data, $this->_pos + 4, $length);

		// move stream pointer to next record
		$this->_pos += 4 + $length;

		if ($this->_version == self::XLS_BIFF8 && !$this->_readDataOnly) {
			// offset: 0; size: 2; number of the following column index structures
			$nm = self::_GetInt2d($recordData, 0);

			// offset: 2; size: 6 * $nm; list of $nm row index structures
			for ($i = 0; $i < $nm; ++$i) {
				$c = self::_GetInt2d($recordData, 2 + 6 * $i);
				$rf = self::_GetInt2d($recordData, 2 + 6 * $i + 2);
				$rl = self::_GetInt2d($recordData, 2 + 6 * $i + 4);

				// not sure why two row indexes are necessary?
				$this->_phpSheet->setBreakByColumnAndRow($c, $rf, PHPExcel_Worksheet::BREAK_COLUMN);
			}
		}
	}
56009
private function readHorizontalPageBreaks()
    {
        $length = self::getInt2d($this->data, $this->pos + 2);
        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);

        // move stream pointer to next record
        $this->pos += 4 + $length;

        if ($this->version == self::XLS_BIFF8 && !$this->readDataOnly) {
            // offset: 0; size: 2; number of the following row index structures
            $nm = self::getInt2d($recordData, 0);

            // offset: 2; size: 6 * $nm; list of $nm row index structures
            for ($i = 0; $i < $nm; ++$i) {
                $r = self::getInt2d($recordData, 2 + 6 * $i);
                $cf = self::getInt2d($recordData, 2 + 6 * $i + 2);
                $cl = self::getInt2d($recordData, 2 + 6 * $i + 4);

                // not sure why two column indexes are necessary?
                $this->phpSheet->setBreakByColumnAndRow($cf, $r, PHPExcel_Worksheet::BREAK_ROW);
            }
        }
    }
238779
private function _readSpContainer()
	{
		$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
		$recordData = substr($this->_data, $this->_pos + 8, $length);

		// add spContainer to spgrContainer
		$spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer();
		$this->_object->addChild($spContainer);

		// move stream pointer to next record
		$this->_pos += 8 + $length;

		// record is a container, read contents
		$reader = new PHPExcel_Reader_Excel5_Escher($spContainer);
		$escher = $reader->load($recordData);
	}