Calculate the offset to the Xing header from the start of the
        MPEG header including sync based on the MPEG header's content.
962935
def get_offset(cls, info):
        

        assert info.layer == 3

        if info.version == 1:
            if info.mode != 3:
                return 36
            else:
                return 21
        else:
            if info.mode != 3:
                return 21
            else:
                return 13
1178043
def sync_header_chain(cls, path, bitcoind_server, last_block_id ):
        
        current_block_id = SPVClient.height( path )
        if current_block_id is None:
            assert USE_TESTNET
            current_block_id = -1

        assert (current_block_id >= 0 and USE_MAINNET) or USE_TESTNET

        if current_block_id < last_block_id:
          
            if USE_MAINNET:
                log.debug("Synchronize %s to %s" % (current_block_id, last_block_id))
            else:
                log.debug("Synchronize testnet %s to %s" % (current_block_id + 1, last_block_id ))

            # need to sync
            if current_block_id >= 0:
                prev_block_header = SPVClient.read_header( path, current_block_id )
                prev_block_hash = prev_block_header['hash']

            else:
                # can only happen when in testnet
                prev_block_hash = GENESIS_BLOCK_HASH_TESTNET

            # connect 
            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

            # timeout (10 min)
            sock.settimeout(600)

            bitcoind_port = 8333
            if ":" in bitcoind_server:
                p = bitcoind_server.split(":")
                bitcoind_server = p[0]
                bitcoind_port = int(p[1])

            log.debug("connect to %s:%s" % (bitcoind_server, bitcoind_port))
            sock.connect( (bitcoind_server, bitcoind_port) )

            client = BlockHeaderClient( sock, path, prev_block_hash, last_block_id )

            # get headers
            client.run()

            # verify headers
            if SPVClient.height(path) < last_block_id:
                raise Exception("Did not receive all headers up to %s (only got %s)" % (last_block_id, SPVClient.height(path)))

            # defensive: make sure it's *exactly* that many blocks 

            rc = SPVClient.verify_header_chain( path )
            if not rc:
                raise Exception("Failed to verify headers (stored in '%s')" % path)

        log.debug("synced headers from %s to %s in %s" % (current_block_id, last_block_id, path))
        return True
1024675
def get_offset(self):
    
    if not self._is_open:
      raise IOError('Not opened.')

    if not hasattr(self._file_object, 'get_offset'):
      return self._file_object.tell()
    return self._file_object.get_offset()
952906
private void updateUnderFileSystemInputStream(long offset) throws IOException {
    if ((mUnderFileSystemInputStream != null) && offset != mInStreamPos) {
      mUfsInstreamManager.release(mUnderFileSystemInputStream);
      mUnderFileSystemInputStream = null;
      mInStreamPos = -1;
    }

    if (mUnderFileSystemInputStream == null && offset < mBlockMeta.getBlockSize()) {
      UnderFileSystem ufs = mUfsResource.get();
      mUnderFileSystemInputStream = mUfsInstreamManager.acquire(ufs,
          mBlockMeta.getUnderFileSystemPath(), IdUtils.fileIdFromBlockId(mBlockMeta.getBlockId()),
          OpenOptions.defaults().setOffset(mBlockMeta.getOffset() + offset));
      mInStreamPos = offset;
    }
  }
427524
def check_offset(self):
        """"""

        for d in range(self.dmps):
            if (self.y0[d] == self.goal[d]):
                self.goal[d] += 1e-4
252788
def horz_offset(self, offset):
        
        self.get_or_add_xMode().val = ST_LayoutMode.FACTOR
        self.get_or_add_x().val = offset
280128
def offset(self, offset):
        
        if self._offset != offset:
            self.dirty = True
            self._offset = offset
        return self
691363
def window_to_offset(self, win_x, win_y):
        """"""
        arr_pts = np.asarray((win_x, win_y)).T
        return self.tform['cartesian_to_native'].from_(arr_pts).T[:2]
772079
def PlaceUOffsetT(self, x):
        
        N.enforce_number(x, N.UOffsetTFlags)
        self.head = self.head - N.UOffsetTFlags.bytewidth
        encode.Write(packer.uoffset, self.Bytes, self.Head(), x)
1233750
def _next_offset(self):
    """"""
    if self._filestream:
      offset = self._filestream.tell()
      if offset:
        offset -= 1
    else:
      offset = self._initial_offset

    return offset
889986
def determine_end_offset(block, tokens, source, expected_matcher)
      lines = source.lines
      last_line_number = lines.length
      end_offset = nil
      tokens.reverse_each do |token|
        # Break once we're through with the last line.
        break if token[0][0] != last_line_number

        # Look for expected match to block opener
        next if token[1] != expected_matcher
        next if token[1] == :on_kw && token[2] != END_STR

        # Raise if we've already found something that looks like a block end.
        raise AmbiguousSourceError.from_proc(block) if end_offset
        # Ending offset is the position of the ending token, plus the length of
        # that token.
        end_offset = token[0][1] + token[2].length
      end
      raise AmbiguousSourceError.from_proc(block) unless end_offset
      determine_end_offset_relative_to_source(end_offset, lines.last.length)
    end
644924
def _AlignDecodedDataOffset(self, decoded_data_offset):
    
    self._file_object.seek(0, os.SEEK_SET)

    self._decoder = self._GetDecoder()
    self._decoded_data = b''

    encoded_data_offset = 0
    encoded_data_size = self._file_object.get_size()

    while encoded_data_offset < encoded_data_size:
      read_count = self._ReadEncodedData(self._ENCODED_DATA_BUFFER_SIZE)
      if read_count == 0:
        break

      encoded_data_offset += read_count

      if decoded_data_offset < self._decoded_data_size:
        self._decoded_data_offset = decoded_data_offset
        break

      decoded_data_offset -= self._decoded_data_size
943710
def from_offset(tu, file, offset):
        
        return conf.lib.clang_getLocationForOffset(tu, file, offset)
715670
def contains_offset(self, offset):
        """"""
        
        if self.PointerToRawData is None:
           # bss and other sections containing only uninitialized data must have 0
           # and do not take space in the file
           return False
        return ( adjust_FileAlignment( self.PointerToRawData, 
                self.pe.OPTIONAL_HEADER.FileAlignment ) <= 
                    offset < 
                        adjust_FileAlignment( self.PointerToRawData,
                            self.pe.OPTIONAL_HEADER.FileAlignment ) + 
                                self.SizeOfRawData )
950755
def get_expstart(header,primary_hdr):
    """"""

    if 'expstart' in primary_hdr:
        exphdr = primary_hdr
    else:
        exphdr = header

    if 'EXPSTART' in exphdr:
        expstart = float(exphdr['EXPSTART'])
        expend = float(exphdr['EXPEND'])
    else:
        expstart = 0.
        expend = 0.0

    return (expstart,expend)
1310331
def get_overlay_data_start_offset(self):
        """"""

        largest_offset_and_size = (0, 0)

        def update_if_sum_is_larger_and_within_file(offset_and_size, file_size=len(self.__data__)):
            if sum(offset_and_size) <= file_size and sum(offset_and_size) > sum(largest_offset_and_size):
                return offset_and_size
            return largest_offset_and_size

        if hasattr(self, 'OPTIONAL_HEADER'):
            largest_offset_and_size = update_if_sum_is_larger_and_within_file(
                (self.OPTIONAL_HEADER.get_file_offset(), self.FILE_HEADER.SizeOfOptionalHeader))

        for section in self.sections:
            largest_offset_and_size = update_if_sum_is_larger_and_within_file(
                (section.PointerToRawData, section.SizeOfRawData))

        skip_directories = [DIRECTORY_ENTRY['IMAGE_DIRECTORY_ENTRY_SECURITY']]

        for idx, directory in enumerate(self.OPTIONAL_HEADER.DATA_DIRECTORY):
            if idx in skip_directories:
                continue
            try:
                largest_offset_and_size = update_if_sum_is_larger_and_within_file(
                    (self.get_offset_from_rva(directory.VirtualAddress), directory.Size))
            # Ignore directories with RVA out of file
            except PEFormatError:
                continue

        if len(self.__data__) > sum(largest_offset_and_size):
            return sum(largest_offset_and_size)

        return None
311894
def get_header_index(self, hdrclass, startidx=0):
        '''
        
        '''
        for hdridx in range(startidx, len(self._headers)):
            if isinstance(self._headers[hdridx], hdrclass):
                return hdridx
        return -1