Read and interpret ova file into this Appliance object.
436445
def read(self, ova_path):
        ""
        p = super(IAppliance, self).read(ova_path)
        p.wait_for_completion()
        self.interpret()
        warnings = self.get_warnings()
        if warnings:
            warning = Warning("\n".join(warnings))
            warning.warnings = warnings
            raise warning
136749
def read
      serialized = File.read(path)
      extract_links(JSON.parse(serialized)).flatten.each_slice(4).to_a
    end
1289118
def read(*parts):
    
    with codecs.open(os.path.join(HERE, *parts), "rb", "utf-8") as f:
        return f.read()
826871
def read_plain(file_obj, type_, count):
    """"""
    if count == 0:
        return []
    conv = DECODE_PLAIN[type_]
    return conv(file_obj, count)
253265
def get_vcf_handle(fsock=None, infile=None):
    """"""

    vcf = None
    if (fsock or infile):
    
        if fsock:
            # if not infile and hasattr(fsock, 'name'):
            logger.info("Reading vcf form stdin")
            if sys.version_info < (3, 0):
                logger.info("Using codecs to read stdin")
                sys.stdin = getreader('utf-8')(fsock)
            
            vcf = sys.stdin
        
        else:
            logger.info("Reading vcf from file {0}".format(infile))
            file_name, file_extension = os.path.splitext(infile)
            if file_extension == '.gz':
                logger.debug("Vcf is zipped")
                vcf = getreader('utf-8')(gzip.open(infile), errors='replace')
            elif file_extension == '.vcf':
                vcf = open(infile, mode='r', encoding='utf-8', errors='replace')
            else:
                raise IOError("File is not in a supported format!\n"
                                " Or use correct ending(.vcf or .vcf.gz)")
    else:
        raise IOError("Please provide a fsock or infile")
    
    return vcf
685395
def file_reader(self):
        """"""
        self.update_config()
        path = self.config['path']
        # open file to get dimensions
        with self.subprocess(
                ['ffmpeg', '-v', 'info', '-y', '-an', '-vn', '-i', path, '-'],
                stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                stdin=open(os.devnull), universal_newlines=True) as sp:
            for line in sp.stderr.read().splitlines():
                match = re.search('(\d{2,})x(\d{2,})', line)
                if match:
                    xlen, ylen = map(int, match.groups())
                    break
            else:
                self.logger.critical('Failed to open %s', path)
                return
        # read file repeatedly to allow looping
        while True:
            # can change config once per outer loop
            self.update_config()
            bit16 = self.config['16bit']
            self.frame_type = self.config['type']
            self.metadata = Metadata().from_file(path)
            audit = self.metadata.get('audit')
            audit += 'data = %s\n' % path
            audit += '    type: %s, 16bit: %s\n' % (self.frame_type, bit16)
            self.metadata.set('audit', audit)
            bps = {'RGB': 3, 'Y': 1}[self.frame_type]
            pix_fmt = {'RGB': ('rgb24', 'rgb48le'),
                       'Y':   ('gray', 'gray16le')}[self.frame_type][bit16]
            bytes_per_line = xlen * ylen * bps
            if bit16:
                bytes_per_line *= 2
            # open file to read data
            with self.subprocess(
                    ['ffmpeg', '-v', 'warning', '-an', '-i', path,
                     '-f', 'image2pipe', '-pix_fmt', pix_fmt,
                     '-c:v', 'rawvideo', '-'],
                    stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                    stdin=open(os.devnull), bufsize=bytes_per_line) as sp:
                while True:
                    try:
                        raw_data = sp.stdout.read(bytes_per_line)
                    except Exception as ex:
                        self.logger.exception(ex)
                        return
                    if len(raw_data) < bytes_per_line:
                        break
                    if bit16:
                        image = numpy.fromstring(raw_data, dtype=numpy.uint16)
                        image = image.astype(pt_float) / pt_float(256.0)
                    else:
                        image = numpy.fromstring(raw_data, dtype=numpy.uint8)
                    yield image.reshape((ylen, xlen, bps))
            self.update_config()
            if self.frame_no == 0 or self.config['looping'] == 'off':
                return
121712
def vofile(filename, **kwargs):
    
    basename = os.path.basename(filename)
    if os.access(basename, os.R_OK):
        return open(basename, 'r')
    kwargs['view'] = kwargs.get('view', 'data')
    return client.open(filename, **kwargs)
288025
def _Parse(self):
    """"""
    vshadow_store = self._file_entry.GetVShadowStore()

    self._AddAttribute(volume_system.VolumeAttribute(
        'identifier', vshadow_store.identifier))
    self._AddAttribute(volume_system.VolumeAttribute(
        'copy_identifier', vshadow_store.copy_identifier))
    self._AddAttribute(volume_system.VolumeAttribute(
        'copy_set_identifier', vshadow_store.copy_set_identifier))
    self._AddAttribute(volume_system.VolumeAttribute(
        'creation_time', vshadow_store.get_creation_time_as_integer()))

    volume_extent = volume_system.VolumeExtent(0, vshadow_store.volume_size)
    self._extents.append(volume_extent)
1354457
def read(cls, origin, relpath, **kwargs):
        
        path = origin / relpath
        with path.open('rb') as f:
            return cls.from_file(f, origin, relpath, **kwargs)
62858
def _read_data(file_obj, fo_encoding, value_count, bit_width):
    
    vals = []
    if fo_encoding == parquet_thrift.Encoding.RLE:
        seen = 0
        while seen < value_count:
            values = encoding.read_rle_bit_packed_hybrid(file_obj, bit_width)
            if values is None:
                break  # EOF was reached.
            vals += values
            seen += len(values)
    elif fo_encoding == parquet_thrift.Encoding.BIT_PACKED:
        raise NotImplementedError("Bit packing not yet supported")

    return vals
1189010
def _read_fam(self):
        """"""
        # Reading the FAM file and setting the values
        fam = pd.read_csv(self.fam_filename, delim_whitespace=True,
                          names=["fid", "iid", "father", "mother", "gender",
                                 "status"],
                          dtype=dict(fid=str, iid=str, father=str, mother=str))

        # Getting the byte and bit location of each samples
        fam["byte"] = [
            int(np.ceil((1 + 1) / 4.0)) - 1 for i in range(len(fam))
        ]
        fam["bit"] = [(i % 4) * 2 for i in range(len(fam))]

        # Saving the data in the object
        self._fam = fam
        self._nb_samples = self._fam.shape[0]
659788
def read(file, system):
    """"""
    func = re.compile('function\\s')
    mva = re.compile('\\s*mpc.baseMVA\\s*=\\s*')
    bus = re.compile('\\s*mpc.bus\\s*=\\s*\\[')
    gen = re.compile('\\s*mpc.gen\\s*=\\s*\\[')
    branch = re.compile('\\s*mpc.branch\\s*=\\s*\\[')
    area = re.compile('\\s*mpc.areas\\s*=\\s*\\[')
    gencost = re.compile('\\s*mpc.gencost\\s*=\\s*\\[')
    bus_name = re.compile('\\s*mpc.bus_name\\s*=\\s*\\{')
    end = re.compile('\\s*\\];?')
    hasdigit = re.compile('.*\\d+\\s*]?;?')
    comment = re.compile('\\s*%.*')

    retval = True
    field = None
    info = True

    basemva = 100
    mpc = {
        'bus': [],
        'gen': [],
        'branch': [],
        'area': [],
        'gencost': [],
        'bus_name': [],
    }

    fid = open(file, 'r')

    for line in fid:
        line = line.strip().rstrip(';')
        if not line:
            continue
        elif func.search(line):  # skip function declaration
            continue
        elif comment.search(line):  # for comment lines
            if info:
                logger.info(line[1:72])
                info = False
            else:
                continue
        elif mva.search(line):
            basemva = float(line.split('=')[1])

        if not field:
            if bus.search(line):
                field = 'bus'
            elif gen.search(line):
                field = 'gen'
            elif branch.search(line):
                field = 'branch'
            elif area.search(line):
                field = 'area'
            elif gencost.search(line):
                field = 'gencost'
            elif bus_name.search(line):
                field = 'bus_name'
            else:
                continue
        elif end.search(line):
            field = None
            continue

        # parse mpc sections
        if field:
            if line.find('=') >= 0:
                line = line.split('=')[1]
            if line.find('[') >= 0:
                line = re.sub(r'\[', '', line)
            elif line.find('{') >= 0:
                line = re.sub(r'{', '', line)

            if line.find('\'') >= 0:  # bus_name
                line = line.split(';')
                data = [i.strip('\'').strip() for i in line]
                mpc['bus_name'].extend(data)
            else:
                if not hasdigit.search(line):
                    continue
                line = line.split(';')
                for item in line:
                    data = [float(val) for val in item.split()]
                    mpc[field].append(data)

    fid.close()

    # add model elements to system
    sw = []

    system.mva = basemva

    for data in mpc['bus']:
        # idx  ty   pd   qd  gs  bs  area  vmag  vang  baseKV  zone  vmax  vmin
        # 0    1    2   3   4   5    6      7     8     9      10    11    12
        idx = int(data[0])
        ty = data[1]
        if ty == 3:
            sw.append(idx)
        pd = data[2] / basemva
        qd = data[3] / basemva
        gs = data[4] / basemva
        bs = data[5] / basemva
        area = data[6]
        vmag = data[7]
        vang = data[8] * deg2rad
        baseKV = data[9]
        zone = data[10]
        vmax = data[11]
        vmin = data[12]

        try:
            system.Bus.elem_add(
                idx=idx,
                name='Bus ' + str(idx),
                Vn=baseKV,
                voltage=vmag,
                angle=vang,
                vmax=vmax,
                vmin=vmin,
                area=area,
                region=zone)
            if pd or qd:
                system.PQ.elem_add(
                    bus=idx, name='PQ ' + str(idx), Vn=baseKV, p=pd, q=qd)
            if gs or bs:
                system.Shunt.elem_add(
                    bus=idx, name='Shunt ' + str(idx), Vn=baseKV, g=gs, b=bs)
        except KeyError:
            logger.error('Error adding <Bus> to powersystem object.')
            retval = False

    gen_idx = 0
    for data in mpc['gen']:
        # bus  pg  qg  qmax  qmin  vg  mbase  status  pmax  pmin  pc1  pc2
        #  0   1   2    3     4     5    6      7       8    9    10    11
        # qc1min  qc1max  qc2min  qc2max  ramp_agc  ramp_10  ramp_30  ramp_q
        #  12      13       14      15      16        17       18      19
        # apf
        #  20

        bus_idx = int(data[0])
        gen_idx += 1
        vg = data[5]
        status = int(data[7])
        mbase = basemva
        pg = data[1] / mbase
        qg = data[2] / mbase
        qmax = data[3] / mbase
        qmin = data[4] / mbase
        pmax = data[8] / mbase
        pmin = data[9] / mbase

        try:
            vn = system.Bus.Vn[system.Bus.uid[bus_idx]]
            if bus_idx in sw:
                system.SW.elem_add(
                    idx=gen_idx,
                    bus=bus_idx,
                    busr=bus_idx,
                    name='SW ' + str(bus_idx),
                    u=status,
                    Vn=vn,
                    v0=vg,
                    pg=pg,
                    qg=qg,
                    pmax=pmax,
                    pmin=pmin,
                    qmax=qmax,
                    qmin=qmin,
                    a0=0.0)
            else:
                system.PV.elem_add(
                    idx=gen_idx,
                    bus=bus_idx,
                    busr=bus_idx,
                    name='PV ' + str(bus_idx),
                    u=status,
                    Vn=vn,
                    v0=vg,
                    pg=pg,
                    qg=qg,
                    pmax=pmax,
                    pmin=pmin,
                    qmax=qmax,
                    qmin=qmin)
        except KeyError:
            logger.error(
                'Error adding <SW> or <PV> to powersystem object.')
            retval = False

    for data in mpc['branch']:
        # fbus	tbus	r	x	b	rateA	rateB	rateC	ratio	angle
        #  0     1      2   3   4     5       6       7       8      9
        # status	angmin	angmax	Pf	Qf	Pt	Qt
        #   10       11       12    13  14  15  16
        fbus = data[0]
        tbus = data[1]
        r = data[2]
        x = data[3]
        b = data[4]
        status = int(data[10])

        if data[8] == 0.0:  # not a transformer
            tf = False
            ratio = 1
            angle = 0
        elif data[8] == 1.0 and data[9] == 0.0:  # not a transformer
            tf = False
            ratio = 1
            angle = 0
        else:
            tf = True
            ratio = data[8]
            angle = data[9]
        try:
            vf = system.Bus.Vn[system.Bus.uid[fbus]]
            vt = system.Bus.Vn[system.Bus.uid[tbus]]
            system.Line.elem_add(
                Vn=vf,
                Vn2=vt,
                bus1=fbus,
                bus2=tbus,
                r=r,
                x=x,
                b=b,
                u=status,
                trasf=tf,
                tap=ratio,
                phi=angle)
        except KeyError:
            logger.error('Error adding <Line> to powersystem object.')
            retval = False
    if len(mpc['bus_name']) == len(system.Bus.name):
        system.Bus.name[:] = mpc['bus_name']

    return retval
139337
def read(cls, file):
        """"""
        parser = WebVTTParser().read(file)
        return cls(file=file, captions=parser.captions, styles=parser.styles)
608934
function(input_filename, cb_read_file_done) {

    // ------------ read wav file -------------------- //

    // console.log("read_wav_file with input_filename ", input_filename);

    // bbb

    var wav_file_input_obj = {};  // create stub object to which we attach .buffer

    var property_buffer_raw_input_file = "buffer_raw_input_file";

    wav_file_input_obj.filename = input_filename;

    wav_file_input_obj[property_buffer_raw_input_file] = new Buffer(0);

    // console.log("abouttttt to read wav_file_input_obj.filename ", wav_file_input_obj.filename);

    var spec = {};

    read_16_bit_wav_file_into_32_bit_float_buffer(
                                    wav_file_input_obj,
                                    wav_file_input_obj.filename, 
                                    spec,
                                    cb_read_file_done);
}
510631
def read_file(cls, filepath):
        
        with open(filepath, mode='rb') as f:
            contents = f.read()
        return cls.decode(contents)
1208192
def _read_vmx_file(self):
        

        try:
            self._vmx_pairs = self.manager.parse_vmware_file(self._vmx_path)
        except OSError as e:
            raise VMwareError('Could not read VMware VMX file "{}": {}'.format(self._vmx_path, e))
766476
def reads(s, filename, loader, implicit_tuple, allow_errors):
  """"""
  try:
    the_context.filename = filename
    the_context.loader = loader

    grammar = make_grammar(allow_errors=allow_errors)
    root = grammar.start_tuple if implicit_tuple else grammar.start

    return root.parseWithTabs().parseString(s, parseAll=True)[0]
  except (p.ParseException, p.ParseSyntaxException) as e:
    loc = SourceLocation(s, find_offset(s, e.lineno, e.col))
    raise exceptions.ParseError(the_context.filename, loc, e.msg)