Last stored proc result
554930
def get_proc_return_status(self):
        
        if self._session is None:
            return None
        if not self._session.has_status:
            self._session.find_return_status()
        return self._session.ret_status if self._session.has_status else None
607505
def contents(self):
        
        code = "proc contents data=" + self.libref + '.' + self.table + self._dsopts() + ";run;"

        if self.sas.nosub:
            print(code)
            return

        ll = self._is_valid()
        if self.results.upper() == 'PANDAS':
            code  = "proc contents data=%s.%s %s ;" % (self.libref, self.table, self._dsopts())
            code += "ods output Attributes=work._attributes;"
            code += "ods output EngineHost=work._EngineHost;"
            code += "ods output Variables=work._Variables;"
            code += "ods output Sortedby=work._Sortedby;"
            code += "run;"
            return self._returnPD(code, ['_attributes', '_EngineHost', '_Variables', '_Sortedby'])

        else:
            if self.HTML:
                if not ll:
                    ll = self.sas._io.submit(code)
                if not self.sas.batch:
                    self.sas.DISPLAY(self.sas.HTML(ll['LST']))
                else:
                    return ll
            else:
                if not ll:
                    ll = self.sas._io.submit(code, "text")
                if not self.sas.batch:
                    print(ll['LST'])
                else:
                    return ll
1183425
def _terminate_procs(procs):
    
    logging.warn("Stopping all remaining processes")
    for proc, g in procs.values():
        logging.debug("[%s] SIGTERM", proc.pid)
        try:
            proc.terminate()
        except OSError as e:
            # we don't care if the process we tried to kill didn't exist.
            if e.errno != errno.ESRCH:
                raise
    sys.exit(1)
862262
def get_last_row(dbconn, tablename, n=1, uuid=None):
    
    return fetch(dbconn, tablename, n, uuid, end=True)
747125
def last(self):
        
        start = max(self.number - 1, 0) * self.size
        return Batch(start, self.size, self.total_size)
621461
private Status executeStatement(Stmt stmt, CallStack frame, EnclosingScope scope) {
		switch (stmt.getOpcode()) {
		case WyilFile.STMT_assert:
			return executeAssert((Stmt.Assert) stmt, frame, scope);
		case WyilFile.STMT_assume:
			return executeAssume((Stmt.Assume) stmt, frame, scope);
		case WyilFile.STMT_assign:
			return executeAssign((Stmt.Assign) stmt, frame, scope);
		case WyilFile.STMT_break:
			return executeBreak((Stmt.Break) stmt, frame, scope);
		case WyilFile.STMT_continue:
			return executeContinue((Stmt.Continue) stmt, frame, scope);
		case WyilFile.STMT_debug:
			return executeDebug((Stmt.Debug) stmt, frame, scope);
		case WyilFile.STMT_dowhile:
			return executeDoWhile((Stmt.DoWhile) stmt, frame, scope);
		case WyilFile.STMT_fail:
			return executeFail((Stmt.Fail) stmt, frame, scope);
		case WyilFile.STMT_if:
		case WyilFile.STMT_ifelse:
			return executeIf((Stmt.IfElse) stmt, frame, scope);
		case WyilFile.EXPR_indirectinvoke:
			executeIndirectInvoke((Expr.IndirectInvoke) stmt, frame);
			return Status.NEXT;
		case WyilFile.EXPR_invoke:
			executeInvoke((Expr.Invoke) stmt, frame);
			return Status.NEXT;
		case WyilFile.STMT_namedblock:
			return executeNamedBlock((Stmt.NamedBlock) stmt, frame, scope);
		case WyilFile.STMT_while:
			return executeWhile((Stmt.While) stmt, frame, scope);
		case WyilFile.STMT_return:
			return executeReturn((Stmt.Return) stmt, frame, scope);
		case WyilFile.STMT_skip:
			return executeSkip((Stmt.Skip) stmt, frame, scope);
		case WyilFile.STMT_switch:
			return executeSwitch((Stmt.Switch) stmt, frame, scope);
		case WyilFile.DECL_variableinitialiser:
		case WyilFile.DECL_variable:
			return executeVariableDeclaration((Decl.Variable) stmt, frame);
		}

		deadCode(stmt);
		return null; // deadcode
	}
352621
def last(args, dbtype=None):
    
    p = OptionParser(last.__doc__)
    p.add_option("--dbtype", default="nucl",
                 choices=("nucl", "prot"),
                 help="Molecule type of subject database")
    p.add_option("--path", help="Specify LAST path")
    p.add_option("--mask", default=False, action="store_true", help="Invoke -c in lastdb")
    p.add_option("--format", default="BlastTab",
                 choices=("TAB", "MAF", "BlastTab", "BlastTab+"),
                 help="Output format")
    p.add_option("--minlen", default=0, type="int",
                 help="Filter alignments by how many bases match")
    p.add_option("--minid", default=0, type="int", help="Minimum sequence identity")
    p.set_cpus()
    p.set_params()

    opts, args = p.parse_args(args)

    if len(args) != 2:
        sys.exit(not p.print_help())

    subject, query = args
    path = opts.path
    cpus = opts.cpus
    if not dbtype:
        dbtype = opts.dbtype
    getpath = lambda x: op.join(path, x) if path else x
    lastdb_bin = getpath("lastdb")
    lastal_bin = getpath("lastal")

    subjectdb = subject.rsplit(".", 1)[0]
    run_lastdb(infile=subject, outfile=subjectdb + ".prj", mask=opts.mask, \
              lastdb_bin=lastdb_bin, dbtype=dbtype)

    u = 2 if opts.mask else 0
    cmd = "{0} -u {1}".format(lastal_bin, u)
    cmd += " -P {0} -i3G".format(cpus)
    cmd += " -f {0}".format(opts.format)
    cmd += " {0} {1}".format(subjectdb, query)

    minlen = opts.minlen
    minid = opts.minid
    extra = opts.extra
    assert minid != 100, "Perfect match not yet supported"
    mm = minid / (100 - minid)

    if minlen:
        extra += " -e{0}".format(minlen)
    if minid:
        extra += " -r1 -q{0} -a{0} -b{0}".format(mm)
    if extra:
        cmd += " " + extra.strip()

    lastfile = get_outfile(subject, query, suffix="last")
    sh(cmd, outfile=lastfile)
457595
private void readProcStatFile() {
    // Read "/proc/stat" file
    BufferedReader in = null;
    FileReader fReader = null;
    try {
      fReader = new FileReader(procfsStatFile);
      in = new BufferedReader(fReader);
    } catch (FileNotFoundException f) {
      // shouldn't happen....
      return;
    }

    Matcher mat = null;
    try {
      String str = in.readLine();
      while (str != null) {
        mat = CPU_TIME_FORMAT.matcher(str);
        if (mat.find()) {
          long uTime = Long.parseLong(mat.group(1));
          long nTime = Long.parseLong(mat.group(2));
          long sTime = Long.parseLong(mat.group(3));
          cumulativeCpuTime = uTime + nTime + sTime; // milliseconds
          break;
        }
        str = in.readLine();
      }
      cumulativeCpuTime *= jiffyLengthInMillis;
    } catch (IOException io) {
      LOG.warn("Error reading the stream " + io);
    } finally {
      // Close the streams
      try {
        fReader.close();
        try {
          in.close();
        } catch (IOException i) {
          LOG.warn("Error closing the stream " + in);
        }
      } catch (IOException i) {
        LOG.warn("Error closing the stream " + fReader);
      }
    }
  }
47088
def last_values(self):
        """"""
        last_dict = {
            'date': self.last_session_date,
            'score': self.last_sleep_score,
            'breakdown': self.last_sleep_breakdown,
            'tnt': self.last_tnt,
            'bed_temp': self.last_bed_temp,
            'room_temp': self.last_room_temp,
            'resp_rate': self.last_resp_rate,
            'heart_rate': self.last_heart_rate,
            'processing': self.last_session_processing,
        }
        return last_dict
964860
Any get_last_cmd_result() throws DevFailed
	{
		RingElt	record = get_last_element();
		if (record.except == null)
			return record.cmd_result;//.extract_any();
		else
			throw record.except;
	}
738511
private static long getRSSFromProcFS() {
        try {
            File statFile = new File(String.format("/proc/%d/stat", pid));
            FileInputStream fis = new FileInputStream(statFile);
            try {
                BufferedReader r = new BufferedReader(new InputStreamReader(fis));
                String stats = r.readLine();
                String[] parts = stats.split(" ");
                return Long.parseLong(parts[23]) * 4 * 1024;
            } finally {
                fis.close();
            }
        }
        catch (Exception e) {
            return -1;
        }
    }
648526
private static boolean isLongOp(String procName) {
        if (procName.startsWith("@")) {
            if (procName.equals("@UpdateApplicationCatalog") || procName.equals("@SnapshotSave")) {
                return true;
            }
        }
        return false;
    }
1073744
public function &LastRow($DatasetType = FALSE) {
      $Result = &$this->Result($DatasetType);
      if (count($Result) == 0)
         return $this->_EOF;

      return $Result[count($Result) - 1];
   }
1306424
def query_proc_row(procname, args=(), factory=None):
    
    for row in query_proc(procname, args, factory):
        return row
    return None
221448
def _get_proc_cmdline(proc):
    '''
    
    '''
    try:
        return salt.utils.data.decode(proc.cmdline() if PSUTIL2 else proc.cmdline)
    except (psutil.NoSuchProcess, psutil.AccessDenied):
        return []
911620
boolean getMoreResults(int current) throws SQLException {
        checkClosed();

        if (resultIn == null || !resultIn.isData()) {
            return false;
        }

        if (resultSetCounter == 0) {
            resultSetCounter++;
            return true;
        }

        if (currentResultSet != null && current != KEEP_CURRENT_RESULT) {
            currentResultSet.close();
        }

        resultIn = null;

        return false;
    }
827436
def last(self):
        """"""
        # End of file
        self.__file.seek(0, 2)

        # Get the last struct
        data = self.get(self.length - 1)

        return data