Read EMV card with AID
331130
protected void readWithAID() throws CommunicationException {
		if (LOGGER.isDebugEnabled()) {
			LOGGER.debug("Try to read card with AID");
		}
		// Test each card from know EMV AID
		Application app = new Application();
		for (EmvCardScheme type : EmvCardScheme.values()) {
			for (byte[] aid : type.getAidByte()) {
				app.setAid(aid);
				app.setApplicationLabel(type.getName());
				String applicationAid = BytesUtils.bytesToStringNoSpace(aid);
				for (IParser impl : parsers) {
					if (impl.getId() != null && impl.getId().matcher(applicationAid).matches() && impl.parse(app)) {
						// Remove previously added Application template
						card.getApplications().clear();
						// Add Application
						card.getApplications().add(app);
						return;
					}
				}
			}
		}
	}
1318857
def read(self, encoding=None):
        """"""
        encoding = encoding or ENCODING
        try:
            with codecs.open(self.path, encoding=encoding) as fi:
                return fi.read()
        except:
            return None
1306416
def ReadUntil(self, *expected_cmds):
        """"""
        cmd, remote_id, local_id, data = AdbMessage.Read(
            self.usb, expected_cmds, self.timeout_ms)
        if local_id != 0 and self.local_id != local_id:
            raise InterleavedDataError("We don't support multiple streams...")
        if remote_id != 0 and self.remote_id != remote_id:
            raise InvalidResponseError(
                'Incorrect remote id, expected %s got %s' % (
                    self.remote_id, remote_id))
        # Ack write packets.
        if cmd == b'WRTE':
            self.Okay()
        return cmd, data
1017073
def read(self, path, wrap_ttl=None):
        
        try:
            return self._adapter.get('/v1/{0}'.format(path), wrap_ttl=wrap_ttl).json()
        except exceptions.InvalidPath:
            return None
1266852
def _read_packet(self):
        """"""

        status = STATUS_WAITING
        mode = 0
        checksum = 0
        checksum_calculated = 0
        length = 0
        version = 0
        i = 0
        cnt = 0
        packet = bytearray(0)

        while (status != STATUS_PACKET_DONE):

            read = self._read_ord_byte()
            if (status != STATUS_CTRL_CHECKSUM and status != STATUS_SENSE_CHECKSUM):
                checksum_calculated = self._add_to_checksum(checksum_calculated, read)
            self._debug(PROP_LOGLEVEL_TRACE, "R: " + str(read))
            self._debug(PROP_LOGLEVEL_TRACE, "S: " + str(status))

            if (status == STATUS_WAITING):
                if (read == 2):
                    status = STATUS_PRE_1
                    checksum_calculated = read
                else:
                    status = STATUS_WAITING
            elif (status == STATUS_PRE_1):
                checksum = 0
                if (read == 2):
                    status = STATUS_SENSE_PRE_2
                    checksum_calculated = read
                elif (read == 0):
                    status = STATUS_WAITING
                else:
                    status = STATUS_CTRL_PRE_2
            elif (status == STATUS_SENSE_PRE_2):
                length = read
                status = STATUS_SENSE_PRE_LENGTH
            elif (status == STATUS_SENSE_PRE_LENGTH):
                version = read
                status = STATUS_SENSE_PRE_3
            elif (status == STATUS_SENSE_PRE_3):
                cnt = read
                i = 0
                status = STATUS_SENSE_DATA
            elif (status == STATUS_SENSE_DATA):
                packet.append(read)
                i = i + 1
                if (i == length):
                    status = STATUS_SENSE_CHECKSUM
            elif (status == STATUS_SENSE_CHECKSUM):
                checksum = read
                mode = PROP_PACKET_SENSE
                status = STATUS_PACKET_DONE
            elif (status == STATUS_CTRL_PRE_2):
                version = read
                status = STATUS_CTRL_PRE_3
            elif (status == STATUS_CTRL_PRE_3):
                cnt = read
                i = 0
                length = 16
                status = STATUS_CTRL_DATA
            elif (status == STATUS_CTRL_DATA):
                packet.append(read)
                i = i + 1
                if (i == length):
                    status = STATUS_CTRL_CHECKSUM
            elif (status == STATUS_CTRL_CHECKSUM):
                checksum = read
                mode = PROP_PACKET_CTRL
                status = STATUS_PACKET_DONE
            else:
                status = STATUS_WAITING

        self._debug(PROP_LOGLEVEL_DEBUG, "MODE: " + str(mode) + " Version: " + str(version) + " Checksum: " + str(checksum) + " / " + str(checksum_calculated) + " Count: " + str(cnt) + " Length: " + str(len(packet)))
        self._debug(PROP_LOGLEVEL_TRACE, "Packet: " + str(packet))

        return (mode, version, packet)
174045
def checkmagic(self):
        """"""
        #magic is at EOF; if we're embedded, we need to figure where that is
        if self.len:
            self.lib.seek(self.start+self.len, 0)
        else:
            self.lib.seek(0, 2)
        filelen = self.lib.tell()
        if self.len:
            self.lib.seek(self.start+self.len-self.TRLLEN, 0)
        else:
            self.lib.seek(-self.TRLLEN, 2)
        (magic, totallen, tocpos, toclen, pyvers) = struct.unpack(self.TRLSTRUCT,
                            self.lib.read(self.TRLLEN))
        if magic != self.MAGIC:
            raise RuntimeError("%s is not a valid %s archive file"
                               % (self.path, self.__class__.__name__))
        self.pkgstart = filelen - totallen
        if self.len:
            if totallen != self.len or self.pkgstart != self.start:
                raise RuntimeError, "Problem with embedded archive in %s" % self.path
        self.tocpos, self.toclen = tocpos, toclen
369894
def read(self):
        
        data = ''

        try:
            read_ready, _, _ = select.select([self._device.fileno()], [], [], 0.5)

            if len(read_ready) != 0:
                data = self._device.read(1)

        except serial.SerialException as err:
            raise CommError('Error reading from device: {0}'.format(str(err)), err)

        return data.decode('utf-8')
1138845
def getATR(reader):
    """"""
    connection = reader.createConnection()
    atr = ""
    try:
        connection.connect()
        atr = smartcard.util.toHexString(connection.getATR())
        connection.disconnect()
    except smartcard.Exceptions.NoCardException:
        atr = "no card inserted"
    return atr
694056
def _xdr_read_asset(unpacker):
    """"""
    asset = messages.StellarAssetType(type=unpacker.unpack_uint())

    if asset.type == ASSET_TYPE_ALPHA4:
        asset.code = unpacker.unpack_fstring(4)
        asset.issuer = _xdr_read_address(unpacker)

    if asset.type == ASSET_TYPE_ALPHA12:
        asset.code = unpacker.unpack_fstring(12)
        asset.issuer = _xdr_read_address(unpacker)

    return asset
894479
def read_backwards(adapter, start_event_id, count = nil)
      stream = adapter
      unless start_event_id.equal?(:head)
        starting_tx = adapter.with_event(start_event_id).first
        starting = starting_tx.events.before(start_event_id)
        stream = stream.where(:ts.lt => starting_tx.ts)
      end
      stream = stream.limit(count) if count&.> 0

      Array(starting) + stream.desc(:ts).map { |t| build_event_entities(t).reverse }.flatten(1)
    end
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
430569
def read(self, *, level=0, alignment=1) -> bytes:
        '''
            
        '''

        return self.mglo.read(level, alignment)
1301697
def read_md5(self, hex=False):
        
        f = self.open('rb')
        try:
            m = hashlib.md5()
            while True:
                d = f.read(8192)
                if not d:
                    break
                m.update(d)
        finally:
            f.close()
        if hex:
            return m.hexdigest()
        else:
            return m.digest()
27178
def read_enabled(self):
        
        for line in self.conf.splitlines():
            line = line.lstrip()
            if self.tag in line:
                self.tag_line = True
            if (line and self.tag_line and not line.startswith("#") and
                    self.tag not in line):
                self.enabled.append(line)
        self.tag_line = False
1322299
def read(self, num_bytes):
        """"""
        self.check_pyb()
        try:
            return self.pyb.serial.read(num_bytes)
        except (serial.serialutil.SerialException, TypeError):
            # Write failed - assume that we got disconnected
            self.close()
            raise DeviceError('serial port %s closed' % self.dev_name_short)
1078465
def fetch(bank, key):
    '''
    
    '''
    _init_client()
    etcd_key = '{0}/{1}/{2}'.format(path_prefix, bank, key)
    try:
        value = client.read(etcd_key).value
        return __context__['serial'].loads(base64.b64decode(value))
    except etcd.EtcdKeyNotFound:
        return {}
    except Exception as exc:
        raise SaltCacheError(
            'There was an error reading the key, {0}: {1}'.format(
                etcd_key, exc
            )
        )
817484
private void readMbean() {
		if (clazz == null) {
			return;
		}
		try {
			if (isUnixOS) {
				long openFiles = getValue("OpenFileDescriptorCount");
				long maxOpenFiles = getValue("MaxFileDescriptorCount");

				long freePhysicalMemorySize = getValue("FreePhysicalMemorySize");
				long totalPhysicalMemorySize = getValue("TotalPhysicalMemorySize");

				long processTime = getValue("ProcessCpuTime");

				double processCPULoad = getDoubleValue("ProcessCpuLoad");
				double systemCPULoad = getDoubleValue("SystemCpuLoad");

				long processors = getValue("AvailableProcessors");

				stats.update((int) openFiles, (int) maxOpenFiles, freePhysicalMemorySize, totalPhysicalMemorySize, processTime, (int) processors, processCPULoad, systemCPULoad);

			} else if (isWindowsOS) {
				long processors = getValue("AvailableProcessors");
				double systemCPULoad = readWindowsCPULoad();

				long totalPhysicalMemorySize = readWindowsTotalMemory();
				long freePhysicalMemorySize = readWindowsFreeMemory();

				stats.update(-1, -1, freePhysicalMemorySize, totalPhysicalMemorySize, -1, (int) processors, -1, systemCPULoad);

			} else {
				long processors = getValue("AvailableProcessors");

				stats.update(-1, -1, -1, -1, -1, (int) processors, -1, -1);
			}

		} catch (Exception e) {
			log.warn("Couldn't read value due to", e);
		}
	}