Raise exception if any unary transformation block encountered.
761643
def lower_unary_transformations(ir_blocks):
    """"""
    def visitor_fn(expression):
        """Raise error if current expression is a UnaryTransformation."""
        if not isinstance(expression, expressions.UnaryTransformation):
            return expression
        raise NotImplementedError(
            u'UnaryTransformation expression "{}" encountered with IR blocks {} is unsupported by '
            u'the SQL backend.'.format(expression, ir_blocks)
        )

    new_ir_blocks = [
        block.visit_and_update_expressions(visitor_fn)
        for block in ir_blocks
    ]
    return new_ir_blocks
1151962
public static void throwIfUnchecked(Throwable t) {
    Preconditions.checkNotNull(t);
    if (t instanceof RuntimeException) {
      throw (RuntimeException) t;
    }
    if (t instanceof Error) {
      throw (Error) t;
    }
  }
443231
function isDoubleLogicalNegating(node) {
		return node.operator === "!" &&
			node.argument.type === "UnaryExpression" &&
			node.argument.operator === "!";
	}
973990
public void noExceptionThrown() {
    Throwable thrown = getSpecificationContext().getThrownException();
    if (thrown == null) return;
    throw new UnallowedExceptionThrownError(null, thrown);
  }
477948
def check_input(self, token):
        
        if isinstance(token.payload, Instance):
            return
        raise Exception(self.full_name + ": Unhandled data type: " + str(token.payload.__class__.__name__))
1207272
public static TestRule ignoreIfNotUnix() {
        return (base, description) -> new Statement() {
            @Override
            public void evaluate() throws Throwable {
                assumeIsUnix();
                base.evaluate();
            }
        };
    }
1166060
public final void unaryExpressionNotPlusMinus() throws RecognitionException {
		int unaryExpressionNotPlusMinus_StartIndex = input.index();

		try {
			if ( state.backtracking>0 && alreadyParsedRule(input, 125) ) { return; }

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1204:5: ( '~' unaryExpression | '!' unaryExpression | castExpression | primary ( selector )* ( '++' | '--' )? )
			int alt159=4;
			switch ( input.LA(1) ) {
			case 126:
				{
				alt159=1;
				}
				break;
			case 29:
				{
				alt159=2;
				}
				break;
			case 36:
				{
				switch ( input.LA(2) ) {
				case 65:
				case 67:
				case 71:
				case 77:
				case 85:
				case 92:
				case 94:
				case 105:
					{
					int LA159_20 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				case Identifier:
					{
					int LA159_21 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				case 40:
					{
					int LA159_22 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				case 44:
					{
					int LA159_23 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				case 41:
					{
					int LA159_24 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				case 45:
					{
					int LA159_25 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				case 126:
					{
					int LA159_26 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				case 29:
					{
					int LA159_27 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				case 36:
					{
					int LA159_28 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				case 53:
					{
					int LA159_29 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				case 111:
					{
					int LA159_30 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				case 108:
					{
					int LA159_31 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				case 80:
					{
					int LA159_32 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				case 79:
					{
					int LA159_33 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				case 70:
					{
					int LA159_34 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				case DecimalLiteral:
				case HexLiteral:
				case OctalLiteral:
					{
					int LA159_35 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				case FloatingPointLiteral:
					{
					int LA159_36 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				case CharacterLiteral:
					{
					int LA159_37 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				case StringLiteral:
					{
					int LA159_38 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				case 82:
				case 115:
					{
					int LA159_39 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				case 98:
					{
					int LA159_40 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				case 97:
					{
					int LA159_41 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				case 118:
					{
					int LA159_42 = input.LA(3);
					if ( (synpred240_Java()) ) {
						alt159=3;
					}
					else if ( (true) ) {
						alt159=4;
					}

					}
					break;
				default:
					if (state.backtracking>0) {state.failed=true; return;}
					int nvaeMark = input.mark();
					try {
						input.consume();
						NoViableAltException nvae =
							new NoViableAltException("", 159, 3, input);
						throw nvae;
					} finally {
						input.rewind(nvaeMark);
					}
				}
				}
				break;
			case CharacterLiteral:
			case DecimalLiteral:
			case FloatingPointLiteral:
			case HexLiteral:
			case Identifier:
			case OctalLiteral:
			case StringLiteral:
			case 53:
			case 65:
			case 67:
			case 70:
			case 71:
			case 77:
			case 79:
			case 80:
			case 82:
			case 85:
			case 92:
			case 94:
			case 97:
			case 98:
			case 105:
			case 108:
			case 111:
			case 115:
			case 118:
				{
				alt159=4;
				}
				break;
			default:
				if (state.backtracking>0) {state.failed=true; return;}
				NoViableAltException nvae =
					new NoViableAltException("", 159, 0, input);
				throw nvae;
			}
			switch (alt159) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1204:9: '~' unaryExpression
					{
					match(input,126,FOLLOW_126_in_unaryExpressionNotPlusMinus5549); if (state.failed) return;
					pushFollow(FOLLOW_unaryExpression_in_unaryExpressionNotPlusMinus5551);
					unaryExpression();
					state._fsp--;
					if (state.failed) return;
					}
					break;
				case 2 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1205:8: '!' unaryExpression
					{
					match(input,29,FOLLOW_29_in_unaryExpressionNotPlusMinus5560); if (state.failed) return;
					pushFollow(FOLLOW_unaryExpression_in_unaryExpressionNotPlusMinus5562);
					unaryExpression();
					state._fsp--;
					if (state.failed) return;
					}
					break;
				case 3 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1206:9: castExpression
					{
					pushFollow(FOLLOW_castExpression_in_unaryExpressionNotPlusMinus5572);
					castExpression();
					state._fsp--;
					if (state.failed) return;
					}
					break;
				case 4 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1207:9: primary ( selector )* ( '++' | '--' )?
					{
					pushFollow(FOLLOW_primary_in_unaryExpressionNotPlusMinus5582);
					primary();
					state._fsp--;
					if (state.failed) return;
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1207:17: ( selector )*
					loop157:
					while (true) {
						int alt157=2;
						int LA157_0 = input.LA(1);
						if ( (LA157_0==47||LA157_0==59) ) {
							alt157=1;
						}

						switch (alt157) {
						case 1 :
							// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1207:17: selector
							{
							pushFollow(FOLLOW_selector_in_unaryExpressionNotPlusMinus5584);
							selector();
							state._fsp--;
							if (state.failed) return;
							}
							break;

						default :
							break loop157;
						}
					}

					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1207:27: ( '++' | '--' )?
					int alt158=2;
					int LA158_0 = input.LA(1);
					if ( (LA158_0==41||LA158_0==45) ) {
						alt158=1;
					}
					switch (alt158) {
						case 1 :
							// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:
							{
							if ( input.LA(1)==41||input.LA(1)==45 ) {
								input.consume();
								state.errorRecovery=false;
								state.failed=false;
							}
							else {
								if (state.backtracking>0) {state.failed=true; return;}
								MismatchedSetException mse = new MismatchedSetException(null,input);
								throw mse;
							}
							}
							break;

					}

					}
					break;

			}
		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
			if ( state.backtracking>0 ) { memoize(input, 125, unaryExpressionNotPlusMinus_StartIndex); }

		}
	}
953901
private void parseUnaryExpr() throws TTXPathException {

        boolean isUnaryMinus = false;

        // the plus can be ignored since it does not modify the result
        while (is(TokenType.PLUS, true) || mToken.getType() == TokenType.MINUS) {

            if (is(TokenType.MINUS, true)) {
                // two following minuses is a plus and therefore can be ignored,
                // thus only in case of an odd number of minus signs, the unary
                // operation
                // has to be processed
                isUnaryMinus = !isUnaryMinus;
            }
        }

        if (isUnaryMinus) {
            // unary minus has to be processed

            mPipeBuilder.addExpressionSingle();

            parseValueExpr();
            mPipeBuilder.addOperatorExpression(getTransaction(), "unary");

        } else {

            parseValueExpr();
        }
    }
139922
def visit_unaryop(self, node, parent):
        """"""
        newnode = nodes.UnaryOp(
            self._unary_op_classes[node.op.__class__],
            node.lineno,
            node.col_offset,
            parent,
        )
        newnode.postinit(self.visit(node.operand, newnode))
        return newnode
516451
def mutable_block(self, x: int, y: int) -> Block:
        """"""
        if x < 0 or y < 0:
            raise IndexError('x < 0 or y < 0')
        return self._blocks[(x, y)]
1262430
def _maybe_throw(self):
        
        if self._err:
            ex_cls, ex_obj, ex_bt = self._err
            self._err = None
            PyCBC.raise_helper(ex_cls, ex_obj, ex_bt)
553884
function it_throwsErrorIfVertexExists() {
			it("throws an error if a vertex with the given key already exists", function () {
				expectItWhenBoundWith('k1').toThrow();
				expectItWhenBoundWith('k2').toThrow();
				expectItWhenBoundWith('k1').toThrowSpecific(Graph.VertexExistsError, { vertices: {'k1': 'oldValue1'} });
				expectItWhenBoundWith('k2').toThrowSpecific(Graph.VertexExistsError, { vertices: {'k2': undefined} });
			});
		}
979831
def exception(self, timeout=None):
        """"""
        # Check exceptional case: return none if no error
        if not self._poll(timeout).HasField('error'):
            return None

        # Return expected error
        return self._operation.error
1258290
def infer_unaryop(self, context=None):
    """"""
    yield from _filter_operation_errors(
        self, _infer_unaryop, context, util.BadUnaryOperationMessage
    )
    return dict(node=self, context=context)
645373
def unary_operator(op):
    
    # Only negate is currently supported.
    valid_ops = {'-'}
    if op not in valid_ops:
        raise ValueError("Invalid unary operator %s." % op)

    @with_doc("Unary Operator: '%s'" % op)
    @with_name(unary_op_name(op))
    def unary_operator(self):
        if self.dtype != float64_dtype:
            raise TypeError(
                "Can't apply unary operator {op!r} to instance of "
                "{typename!r} with dtype {dtypename!r}.\n"
                "{op!r} is only supported for Factors of dtype "
                "'float64'.".format(
                    op=op,
                    typename=type(self).__name__,
                    dtypename=self.dtype.name,
                )
            )

        # This can't be hoisted up a scope because the types returned by
        # unary_op_return_type aren't defined when the top-level function is
        # invoked.
        if isinstance(self, NumericalExpression):
            return NumExprFactor(
                "{op}({expr})".format(op=op, expr=self._expr),
                self.inputs,
                dtype=float64_dtype,
            )
        else:
            return NumExprFactor(
                "{op}x_0".format(op=op),
                (self,),
                dtype=float64_dtype,
            )
    return unary_operator
841440
def isnamedtuple(obj):
    """"""
    return isinstance(obj, tuple) \
           and hasattr(obj, "_fields") \
           and hasattr(obj, "_asdict") \
           and callable(obj._asdict)
899137
def except_handle(tokens):
    """"""
    if len(tokens) == 1:
        errs, asname = tokens[0], None
    elif len(tokens) == 2:
        errs, asname = tokens
    else:
        raise CoconutInternalException("invalid except tokens", tokens)
    out = "except "
    if "list" in tokens:
        out += "(" + errs + ")"
    else:
        out += errs
    if asname is not None:
        out += " as " + asname
    return out