Evaluate a single statement.
558372
def eval(self, expr, lineno=0, show_errors=True):
        """"""
        self.lineno = lineno
        self.error = []
        self.start_time = time.time()
        try:
            node = self.parse(expr)
        except:
            errmsg = exc_info()[1]
            if len(self.error) > 0:
                errmsg = "\n".join(self.error[0].get_error())
            if not show_errors:
                try:
                    exc = self.error[0].exc
                except:
                    exc = RuntimeError
                raise exc(errmsg)
            print(errmsg, file=self.err_writer)
            return
        try:
            return self.run(node, expr=expr, lineno=lineno)
        except:
            errmsg = exc_info()[1]
            if len(self.error) > 0:
                errmsg = "\n".join(self.error[0].get_error())
            if not show_errors:
                try:
                    exc = self.error[0].exc
                except:
                    exc = RuntimeError
                raise exc(errmsg)
            print(errmsg, file=self.err_writer)
            return
1171395
def eval_now(self, code):
        """"""
        result = eval(self.reformat(code))
        if result is None or isinstance(result, (bool, int, float, complex)):
            return repr(result)
        elif isinstance(result, bytes):
            return "b" + self.wrap_str_of(result)
        elif isinstance(result, str):
            return self.wrap_str_of(result)
        else:
            return None
1158704
def evaluate(self, data):
        """"""
        return 'PYTHONPATH="{runtime}" python3 -u -m resolwe.process {program} --slug {slug} --inputs {inputs}'.format(
            runtime=PYTHON_RUNTIME_VOLUME,
            program=PYTHON_PROGRAM_VOLUME,
            slug=shlex.quote(data.process.slug),
            inputs=PYTHON_INPUTS_VOLUME,
        )
690314
def evaluate(self, m):
        """"""

        g = m.groupdict()
        if g["strings"]:
            self.line_num += g['strings'].count('\n')
        elif g["code"]:
            self.line_num += g["code"].count('\n')
        else:
            if g['block']:
                self.evaluate_block(g)
            elif self.stylesheets != CSS:
                if g['start'] is None:
                    self.evaluate_inline_tail(g)
                else:
                    self.evaluate_inline(g)
            self.line_num += g['comments'].count('\n')
800812
def _evaluate_one(caller, svtype, size_range, ensemble, truth, data):
    
    def cnv_matches(name):
        return cnv_to_event(name, data) == svtype
    def is_breakend(name):
        return name.startswith("BND")
    def in_size_range(max_buffer=0):
        def _work(feat):
            minf, maxf = size_range
            buffer = min(max_buffer, int(((maxf + minf) / 2.0) / 10.0))
            size = feat.end - feat.start
            return size >= max([0, minf - buffer]) and size < maxf + buffer
        return _work
    def is_caller_svtype(feat):
        for name in feat.name.split(","):
            if ((name.startswith(svtype) or cnv_matches(name) or is_breakend(name))
                  and (caller == "sv-ensemble" or name.endswith(caller))):
                return True
        return False
    minf, maxf = size_range
    efeats = pybedtools.BedTool(ensemble).filter(in_size_range(0)).filter(is_caller_svtype).saveas().sort().merge()
    tfeats = pybedtools.BedTool(truth).filter(in_size_range(0)).sort().merge().saveas()
    etotal = efeats.count()
    ttotal = tfeats.count()
    match = efeats.intersect(tfeats, u=True).sort().merge().saveas().count()
    return {"sensitivity": _stat_str(match, ttotal),
            "precision": _stat_str(match, etotal)}
440486
def p_try_statement_1(self, p):
        """"""
        p[0] = ast.Try(statements=p[2], catch=p[3])
1190192
def statement_after(self, i):
        """"""
        k = i + 1
        o = len(self.body)
        n = o + len(self.else_body)
        if k > 0:
            if k < o:
                return self.body.statement(k)
            if k > o and k < n:
                return self.else_body.statement(k)
        if k < 0:
            if k < o - n and k > -n:
                return self.body.statement(k)
            if k > o - n:
                return self.else_body.statement(k)
        return None
540072
def _evaluate(self):
        """"""
        if self._elements:
            for element in self._elements:
                yield element
        else:
            for page in itertools.count():
                raw_elements = self._retrieve_raw_elements(page)

                for raw_element in raw_elements:
                    element = self._parse_raw_element(raw_element)
                    self._elements.append(element)
                    yield element
                    if self.__limit and len(self._elements) >= self.__limit:
                        break

                if any([
                    len(raw_elements) < self.page_size,
                    (self.__limit and len(self._elements) >= self.__limit)
                ]):
                    break
447584
void executeStatement(String statement) {

		try (Connection conn = getFastConnection(); Statement stm = conn.createStatement()) {
			stm.execute(statement);
		} catch (Exception e) {
			throw new RuntimeException(e);
		}

	}
308325
def evaluate(self, data):
        """"""
        try:
            inputs = copy.deepcopy(data.input)
            hydrate_input_references(inputs, data.process.input_schema)
            hydrate_input_uploads(inputs, data.process.input_schema)

            # Include special 'proc' variable in the context.
            inputs['proc'] = {
                'data_id': data.id,
                'data_dir': self.manager.get_executor().resolve_data_path(),
            }

            # Include special 'requirements' variable in the context.
            inputs['requirements'] = data.process.requirements
            # Inject default values and change resources according to
            # the current Django configuration.
            inputs['requirements']['resources'] = data.process.get_resource_limits()

            script_template = data.process.run.get('program', '')

            # Get the appropriate expression engine. If none is defined, do not evaluate
            # any expressions.
            expression_engine = data.process.requirements.get('expression-engine', None)
            if not expression_engine:
                return script_template

            return self.get_expression_engine(expression_engine).evaluate_block(
                script_template, inputs,
                escape=self._escape,
                safe_wrapper=SafeString,
            )
        except EvaluationError as error:
            raise ExecutionError('{}'.format(error))
1268450
def stats_evaluation(stats):
    """"""
    statement = stats.get('statement')
    error = stats.get('error', 0)
    warning = stats.get('warning', 0)
    refactor = stats.get('refactor', 0)
    convention = stats.get('convention', 0)

    if not statement or statement <= 0:
        return None

    malus = float(5 * error + warning + refactor + convention)
    malus_ratio = malus / statement
    return 10.0 - (malus_ratio * 10)
158102
def eval(self, script, keys=[], args=[]):
        """"""
        return self.execute(b'EVAL', script, len(keys), *(keys + args))
384823
def _one(self, query):
        """"""
        try:
            result = query.one()
            if result.has_expired(self._expirations):
                raise NotFoundError
            return result
        except (NoResultFound, MultipleResultsFound):
            raise NotFoundError
625363
def p_with_statement(self, p):
        """"""
        p[0] = ast.With(expr=p[3], statement=p[5])
1213038
def evaluate(self, truth, predicted):
        
        correct = 0.0
        total = 0.0
        for i in range(len(truth)):
            if(truth[i] == predicted[i]):
                correct += 1
            total += 1
        return 1.0*correct/total
432985
def eval_js(self, expr):
        """"""
        if not self.is_built():
            self._pending_js_eval.append(expr)
            return
        logger.log(5, "Evaluate Javascript: `%s`.", expr)
        out = self.page().mainFrame().evaluateJavaScript(expr)
        return _to_py(out)
583609
def _evaluate_expressions(self, expression_engine, step_id, values, context):
        """"""
        if expression_engine is None:
            return values

        processed = {}
        for name, value in values.items():
            if isinstance(value, str):
                value = value.strip()
                try:
                    expression = expression_engine.get_inline_expression(value)
                    if expression is not None:
                        # Inline expression.
                        value = expression_engine.evaluate_inline(expression, context)
                    else:
                        # Block expression.
                        value = expression_engine.evaluate_block(value, context)
                except EvaluationError as error:
                    raise ExecutionError('Error while evaluating expression for step "{}":\n{}'.format(
                        step_id, error
                    ))
            elif isinstance(value, dict):
                value = self._evaluate_expressions(expression_engine, step_id, value, context)

            processed[name] = value

        return processed