class_docstr: Provides an easy-to-use python object for abstracting Thrift "unions",
  allowing a python obj to be automatically mapped to the correct union
  field.
class_docstr_tok: ["Provides","an","easy-to-use","python","object","for","abstracting","Thrift","``","unions","''",",","allowing","a","python","obj","to","be","automatically","mapped","to","the","correct","union","field","."]
docstr: Construct with a value supported by the Value "union". See
  cugraph_service_thrift.py
  
  val_name is used for better error messages only, and can be passed for
  including in the exception thrown if an invalid type is passed here.
docstr_tok: ["Construct","with","a","value","supported","by","the","Value","``","union","''",".","See","cugraph_service_thrift.py","val_name","is","used","for","better","error","messages","only",",","and","can","be","passed","for","including","in","the","exception","thrown","if","an","invalid","type","is","passed","here","."]
code: def __init__(self, val, val_name="value"):
      """
      Construct with a value supported by the Value "union". See
      cugraph_service_thrift.py
  
      val_name is used for better error messages only, and can be passed for
      including in the exception thrown if an invalid type is passed here.
      """
      if isinstance(val, Value):
          self.union = val
      elif isinstance(val, int):
          if val < 4294967296:
              self.union = Value(int32_value=val)
          else:
              self.union = Value(int64_value=val)
      elif isinstance(val, float):
          self.union = Value(double_value=val)
      elif (numpy and isinstance(val, (numpy.int8, numpy.int32))) or (
          cupy and isinstance(val, (cupy.int8, cupy.int32))
      ):
          self.union = Value(int32_value=int(val))
      elif (numpy and isinstance(val, numpy.int64)) or (
          cupy and isinstance(val, cupy.int64)
      ):
          self.union = Value(int64_value=int(val))
      elif (
          (numpy and isinstance(val, numpy.float32))
          or (cupy and isinstance(val, cupy.float32))
          or (numpy and isinstance(val, numpy.float64))
          or (cupy and isinstance(val, cupy.float64))
      ):
          self.union = Value(double_value=float(val))
      elif isinstance(val, str):
          self.union = Value(string_value=val)
      elif isinstance(val, bool):
          self.union = Value(bool_value=val)
      elif isinstance(val, (list, tuple)):
          self.union = Value(list_value=[ValueWrapper(i) for i in val])
      # FIXME: Assume ndarrays contain values Thrift can accept! Otherwise,
      # check and possibly convert ndarray dtypes.
      elif (numpy and isinstance(val, numpy.ndarray)) or (
          cupy and isinstance(val, cupy.ndarray)
      ):
          # self.union = Value(list_value=val.tolist())
          self.union = Value(
              list_value=[ValueWrapper(i) for i in val.tolist()]
          )
      elif val is None:
          self.union = Value()
      else:
          raise TypeError(
              f"{val_name} must be one of the "
              f"following types: {self.valid_types}, got "
              f"{type(val)}"
          )
  
file_path: cugraph/python/cugraph-service/client/cugraph_service_client/types.py
imports: from cugraph_service_client.cugraph_service_thrift import spec
label_desc: Use image node_id 1 to create a new ValueWrapper object from inherited base classes: UnionWrapper with example: obj = ValueWrapper(val, val_name)