base

package
v0.0.0-...-2fe1034 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IntNone   = -int(^uint(0)>>1) - 1
	FloatNone = -math.MaxFloat64
)
View Source
var ArgsNone = Args{}

Functions

func ArgumentError

func ArgumentError(msg string)

func Assert

func Assert(cond bool)

func AssertMsg

func AssertMsg(cond bool, msg string, args ...interface{})

func AssertionError

func AssertionError(msg string, args ...interface{})

func AttributeError

func AttributeError(msg string, args ...interface{})

func IndexError

func IndexError(msg string, args ...interface{})

func IntMax

func IntMax(x int, y int) int

func IntMin

func IntMin(x int, y int) int

func IntsCopy

func IntsCopy(a []int) []int

func IntsEq

func IntsEq(a []int, b []int) bool

func IntsExtend

func IntsExtend(a []int, n int, v int) []int

func IntsFill

func IntsFill(a []int, v int)

func IntsFind

func IntsFind(a []int, v int) int

func IntsMax

func IntsMax(a []int) int

func IntsMin

func IntsMin(a []int) int

func IntsProd

func IntsProd(a []int) int

func IntsReverse

func IntsReverse(a []int) []int

func InvalidArgument

func InvalidArgument(name string)

func MissingArgument

func MissingArgument(name string)

func NotImplementedError

func NotImplementedError()

func ResolveFloat

func ResolveFloat(value float64, defval float64) float64

func ResolveInt

func ResolveInt(value int, defval int) int

func RuntimeError

func RuntimeError(msg string, args ...interface{})

func ToFloatList

func ToFloatList(v interface{}) []float64

func ToIntList

func ToIntList(v interface{}) []int

func TypeError

func TypeError(msg string, args ...interface{})

func ValueError

func ValueError(msg string, args ...interface{})

Types

type AnyArg

type AnyArg struct {
	ArgDefBase
}

func NewAnyArg

func NewAnyArg() *AnyArg

func NewAnyArgOpt

func NewAnyArgOpt(defval interface{}) *AnyArg

func (*AnyArg) Expand

func (a *AnyArg) Expand(v interface{}) (interface{}, bool)

type ArgDef

type ArgDef interface {
	Required() bool
	Default() interface{}
	Expand(v interface{}) (interface{}, bool)
}

type ArgDefBase

type ArgDefBase struct {
	// contains filtered or unexported fields
}

func (*ArgDefBase) Default

func (a *ArgDefBase) Default() interface{}

func (*ArgDefBase) Init

func (a *ArgDefBase) Init(required bool, defval interface{})

func (*ArgDefBase) Required

func (a *ArgDefBase) Required() bool

type ArgMap

type ArgMap map[string]ArgDef

func (ArgMap) Expand

func (m ArgMap) Expand(args Args) Args

type Args

type Args map[string]interface{}

func MakeArgs

func MakeArgs(args []interface{}) Args

func (Args) Filter

func (a Args) Filter(keys []string) Args

type BoolArg

type BoolArg struct {
	ArgDefBase
}

func NewBoolArg

func NewBoolArg() *BoolArg

func NewBoolArgOpt

func NewBoolArgOpt(defval bool) *BoolArg

func (*BoolArg) Expand

func (a *BoolArg) Expand(v interface{}) (interface{}, bool)

type Dtype

type Dtype int
const (
	DtypeNone Dtype = iota
	Float16
	Float32
	Float64
	Int8
	Uint8
	Int16
	Uint16
	Int32
	Uint32
	Int64
	Uint64
)

func ResolveDtype

func ResolveDtype(value Dtype, defval Dtype) Dtype

func (Dtype) IsFloat

func (t Dtype) IsFloat() bool

func (Dtype) IsInt

func (t Dtype) IsInt() bool

func (Dtype) IsUint

func (t Dtype) IsUint() bool

func (Dtype) ItemSize

func (t Dtype) ItemSize() int

func (Dtype) String

func (t Dtype) String() string

type EnumArg

type EnumArg struct {
	ArgDefBase
	// contains filtered or unexported fields
}

func NewEnumArg

func NewEnumArg(enum EnumDef) *EnumArg

func NewEnumArgOpt

func NewEnumArgOpt(enum EnumDef, defval string) *EnumArg

func (*EnumArg) Expand

func (a *EnumArg) Expand(v interface{}) (interface{}, bool)

type EnumDef

type EnumDef map[string]int

type FloatArg

type FloatArg struct {
	ArgDefBase
}

func NewFloatArg

func NewFloatArg() *FloatArg

func NewFloatArgOpt

func NewFloatArgOpt(defval float64) *FloatArg

func (*FloatArg) Expand

func (a *FloatArg) Expand(v interface{}) (interface{}, bool)

type FloatListArg

type FloatListArg struct {
	ArgDefBase
}

func NewFloatListArg

func NewFloatListArg() *FloatListArg

func NewFloatListArgOpt

func NewFloatListArgOpt(defval []float64) *FloatListArg

func (*FloatListArg) Expand

func (a *FloatListArg) Expand(v interface{}) (interface{}, bool)

type Half

type Half uint16

A Half represents a 16-bit floating point number.

func NewHalf

func NewHalf(f float32) Half

NewHalf allocates and returns a new Half set to f.

func (Half) Float32

func (f Half) Float32() float32

Float32 returns the float32 representation of f.

type IntArg

type IntArg struct {
	ArgDefBase
}

func NewIntArg

func NewIntArg() *IntArg

func NewIntArgOpt

func NewIntArgOpt(defval int) *IntArg

func (*IntArg) Expand

func (a *IntArg) Expand(v interface{}) (interface{}, bool)

type IntListArg

type IntListArg struct {
	ArgDefBase
}

func NewIntListArg

func NewIntListArg() *IntListArg

func NewIntListArgOpt

func NewIntListArgOpt(defval []int) *IntListArg

func (*IntListArg) Expand

func (a *IntListArg) Expand(v interface{}) (interface{}, bool)

type Object

type Object interface {
	Self() Object
	Name() string
	ClassName() string
	ShortClassName() string
}

type ObjectBase

type ObjectBase struct {
	// contains filtered or unexported fields
}

func (*ObjectBase) Init

func (o *ObjectBase) Init(self Object, args Args)

func (*ObjectBase) Name

func (o *ObjectBase) Name() string

func (*ObjectBase) Self

func (o *ObjectBase) Self() Object

func (*ObjectBase) ShortClassName

func (o *ObjectBase) ShortClassName() string

type StringArg

type StringArg struct {
	ArgDefBase
}

func NewStringArg

func NewStringArg() *StringArg

func NewStringArgOpt

func NewStringArgOpt(defval string) *StringArg

func (*StringArg) Expand

func (a *StringArg) Expand(v interface{}) (interface{}, bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL