Documentation
¶
Index ¶
- func ASCII(v any) string
- func BuiltinExceptionMRO(class string) []string
- func BytesRepr(p []byte) string
- func Equal(a, b any) bool
- func EscapeNonASCII(s string) string
- func ExceptionMROFrom(class string, parents map[string]string) []string
- func ExceptionMessage(err error) string
- func ExceptionName(err error) string
- func ExceptionRepr(err error) string
- func Float(f float64) string
- func Format(value any, spec string) (string, error)
- func FormatFieldNames(template string) ([]string, error)
- func FormatMap(template string, values map[string]any) (string, error)
- func Int(v any) (*big.Int, bool)
- func Is(a, b any) bool
- func Or(v, def any) any
- func PercentMap(format string, lookup func(key string) (any, bool)) (string, error)
- func Repr(v any) string
- func Str(v any) string
- func StrRepr(s string) string
- func Truthy(v any) bool
- func TypeName(v any) string
- type Booler
- type FormatError
- type Mapping
- type PercentError
- type PyReprer
- type PyTypeNamed
- type Reprer
- type Strer
- type Tuple
- type TypeNamer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuiltinExceptionMRO ¶
Class names from a builtin exception class through BaseException as type(exc).__mro__ lists them, nil for any other class
func EscapeNonASCII ¶
Escapes non ASCII code points of WTF-8 text as backslash x, u or U sequences
func ExceptionMROFrom ¶
Class names from class up its base chain in parents then the builtin chain, an unknown root deriving from Exception
func ExceptionMessage ¶
Python str of the exception, the message without the class prefix the Go text carries
func ExceptionName ¶
Python class name of err, a leading class prefix in the text naming it and plain errors standing for Exception
func ExceptionRepr ¶
Python repr of the exception, the class name around the repr of its message or empty parentheses
func Float ¶
float.__repr__, shortest round trip digits in fixed form between 1e-4 and 1e16 and exponent form outside
func Format ¶
Python format(value, spec) for str, int, bool, float and objects that only accept an empty spec
func FormatFieldNames ¶
Field names of a str.format template in order like string.Formatter().parse, with its ValueError messages
func FormatMap ¶
Python str.format_map over values, with item lookup, conversions, nested specs and doubled braces
func Is ¶
Python is operator, pointer identity for reference kinds, both nil alike and equality for plain values
func PercentMap ¶
Python printf style interpolation of a mapping format, the %(key)s form logging formatters render
func Repr ¶
Python repr of a Go value modelling None, bool, int, float, str, bytes, list, tuple and dict
Types ¶
type FormatError ¶
Python format failure tagged with the Python exception class it raises
func (*FormatError) Error ¶
func (e *FormatError) Error() string
type PercentError ¶
Python exception class and message a printf style interpolation raised
func (*PercentError) Error ¶
func (e *PercentError) Error() string
type PyReprer ¶
type PyReprer interface{ PyRepr() string }
Error whose Python class defines its own repr, like urllib's HTTPError
type PyTypeNamed ¶
type PyTypeNamed interface{ PyTypeName() string }
Error declaring the Python exception class it stands for