parameters: (op)
return_statement: return masked_scalar_unary_op_impl
docstring: Make closures that implement unary operations. See register_unary_op for
      details.
docstring_summary: Make closures that implement unary operations. See register_unary_op for
      details.
docstring_tokens: Make closures that implement unary operations . See register_unary_op for details .
function: def make_unary_op(op):
      """
      Make closures that implement unary operations. See register_unary_op for
      details.
      """
  
      def masked_scalar_unary_op_impl(context, builder, sig, args):
          """
          Implement <op> `MaskedType`
          """
          # MaskedType(...)
          masked_type_1 = sig.args[0]
          # MaskedType(...)
          masked_return_type = sig.return_type
  
          m1 = cgutils.create_struct_proxy(masked_type_1)(
              context, builder, value=args[0]
          )
  
          # we will return an output struct
          result = cgutils.create_struct_proxy(masked_return_type)(
              context, builder
          )
  
          # compute output validity
          result.valid = m1.valid
          with builder.if_then(m1.valid):
              # Let numba handle generating the extra IR needed to perform
              # operations on mixed types, by compiling the final core op between
              # the two primitive values as a separate function and calling it
              result.value = context.compile_internal(
                  builder,
                  lambda x: op(x),
                  nb_signature(
                      masked_return_type.value_type, masked_type_1.value_type,
                  ),
                  (m1.value,),
              )
          return result._getvalue()
  
      return masked_scalar_unary_op_impl
function_tokens: def make_unary_op ( op ) : def masked_scalar_unary_op_impl ( context , builder , sig , args ) : """
          Implement <op> `MaskedType`
          """ # MaskedType(...) masked_type_1 = sig . args [ 0 ] # MaskedType(...) masked_return_type = sig . return_type m1 = cgutils . create_struct_proxy ( masked_type_1 ) ( context , builder , value = args [ 0 ] ) # we will return an output struct result = cgutils . create_struct_proxy ( masked_return_type ) ( context , builder ) # compute output validity result . valid = m1 . valid with builder . if_then ( m1 . valid ) : # Let numba handle generating the extra IR needed to perform # operations on mixed types, by compiling the final core op between # the two primitive values as a separate function and calling it result . value = context . compile_internal ( builder , lambda x : op ( x ) , nb_signature ( masked_return_type . value_type , masked_type_1 . value_type , ) , ( m1 . value , ) , ) return result . _getvalue ( ) return masked_scalar_unary_op_impl