forked from TrueCloudLab/rclone
vendor: update all dependencies to latest versions
This commit is contained in:
parent
911d121bb9
commit
b017fcfe9a
3048 changed files with 537057 additions and 189681 deletions
2
vendor/github.com/jmespath/go-jmespath/Makefile
generated
vendored
2
vendor/github.com/jmespath/go-jmespath/Makefile
generated
vendored
|
@ -35,7 +35,7 @@ buildfuzz:
|
|||
go-fuzz-build github.com/jmespath/go-jmespath/fuzz
|
||||
|
||||
fuzz: buildfuzz
|
||||
go-fuzz -bin=./jmespath-fuzz.zip -workdir=fuzz/corpus
|
||||
go-fuzz -bin=./jmespath-fuzz.zip -workdir=fuzz/testdata
|
||||
|
||||
bench:
|
||||
go test -bench . -cpuprofile cpu.out
|
||||
|
|
37
vendor/github.com/jmespath/go-jmespath/api.go
generated
vendored
37
vendor/github.com/jmespath/go-jmespath/api.go
generated
vendored
|
@ -1,5 +1,42 @@
|
|||
package jmespath
|
||||
|
||||
import "strconv"
|
||||
|
||||
// JmesPath is the epresentation of a compiled JMES path query. A JmesPath is
|
||||
// safe for concurrent use by multiple goroutines.
|
||||
type JMESPath struct {
|
||||
ast ASTNode
|
||||
intr *treeInterpreter
|
||||
}
|
||||
|
||||
// Compile parses a JMESPath expression and returns, if successful, a JMESPath
|
||||
// object that can be used to match against data.
|
||||
func Compile(expression string) (*JMESPath, error) {
|
||||
parser := NewParser()
|
||||
ast, err := parser.Parse(expression)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
jmespath := &JMESPath{ast: ast, intr: newInterpreter()}
|
||||
return jmespath, nil
|
||||
}
|
||||
|
||||
// MustCompile is like Compile but panics if the expression cannot be parsed.
|
||||
// It simplifies safe initialization of global variables holding compiled
|
||||
// JMESPaths.
|
||||
func MustCompile(expression string) *JMESPath {
|
||||
jmespath, err := Compile(expression)
|
||||
if err != nil {
|
||||
panic(`jmespath: Compile(` + strconv.Quote(expression) + `): ` + err.Error())
|
||||
}
|
||||
return jmespath
|
||||
}
|
||||
|
||||
// Search evaluates a JMESPath expression against input data and returns the result.
|
||||
func (jp *JMESPath) Search(data interface{}) (interface{}, error) {
|
||||
return jp.intr.Execute(jp.ast, data)
|
||||
}
|
||||
|
||||
// Search evaluates a JMESPath expression against input data and returns the result.
|
||||
func Search(expression string, data interface{}) (interface{}, error) {
|
||||
intr := newInterpreter()
|
||||
|
|
32
vendor/github.com/jmespath/go-jmespath/api_test.go
generated
vendored
Normal file
32
vendor/github.com/jmespath/go-jmespath/api_test.go
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
package jmespath
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestValidPrecompiledExpressionSearches(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
data := make(map[string]interface{})
|
||||
data["foo"] = "bar"
|
||||
precompiled, err := Compile("foo")
|
||||
assert.Nil(err)
|
||||
result, err := precompiled.Search(data)
|
||||
assert.Nil(err)
|
||||
assert.Equal("bar", result)
|
||||
}
|
||||
|
||||
func TestInvalidPrecompileErrors(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
_, err := Compile("not a valid expression")
|
||||
assert.NotNil(err)
|
||||
}
|
||||
|
||||
func TestInvalidMustCompilePanics(t *testing.T) {
|
||||
defer func() {
|
||||
r := recover()
|
||||
assert.NotNil(t, r)
|
||||
}()
|
||||
MustCompile("not a valid expression")
|
||||
}
|
128
vendor/github.com/jmespath/go-jmespath/functions.go
generated
vendored
128
vendor/github.com/jmespath/go-jmespath/functions.go
generated
vendored
|
@ -5,6 +5,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -124,197 +125,197 @@ type functionCaller struct {
|
|||
func newFunctionCaller() *functionCaller {
|
||||
caller := &functionCaller{}
|
||||
caller.functionTable = map[string]functionEntry{
|
||||
"length": functionEntry{
|
||||
"length": {
|
||||
name: "length",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpString, jpArray, jpObject}},
|
||||
{types: []jpType{jpString, jpArray, jpObject}},
|
||||
},
|
||||
handler: jpfLength,
|
||||
},
|
||||
"starts_with": functionEntry{
|
||||
"starts_with": {
|
||||
name: "starts_with",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpString}},
|
||||
argSpec{types: []jpType{jpString}},
|
||||
{types: []jpType{jpString}},
|
||||
{types: []jpType{jpString}},
|
||||
},
|
||||
handler: jpfStartsWith,
|
||||
},
|
||||
"abs": functionEntry{
|
||||
"abs": {
|
||||
name: "abs",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpNumber}},
|
||||
{types: []jpType{jpNumber}},
|
||||
},
|
||||
handler: jpfAbs,
|
||||
},
|
||||
"avg": functionEntry{
|
||||
"avg": {
|
||||
name: "avg",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpArrayNumber}},
|
||||
{types: []jpType{jpArrayNumber}},
|
||||
},
|
||||
handler: jpfAvg,
|
||||
},
|
||||
"ceil": functionEntry{
|
||||
"ceil": {
|
||||
name: "ceil",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpNumber}},
|
||||
{types: []jpType{jpNumber}},
|
||||
},
|
||||
handler: jpfCeil,
|
||||
},
|
||||
"contains": functionEntry{
|
||||
"contains": {
|
||||
name: "contains",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpArray, jpString}},
|
||||
argSpec{types: []jpType{jpAny}},
|
||||
{types: []jpType{jpArray, jpString}},
|
||||
{types: []jpType{jpAny}},
|
||||
},
|
||||
handler: jpfContains,
|
||||
},
|
||||
"ends_with": functionEntry{
|
||||
"ends_with": {
|
||||
name: "ends_with",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpString}},
|
||||
argSpec{types: []jpType{jpString}},
|
||||
{types: []jpType{jpString}},
|
||||
{types: []jpType{jpString}},
|
||||
},
|
||||
handler: jpfEndsWith,
|
||||
},
|
||||
"floor": functionEntry{
|
||||
"floor": {
|
||||
name: "floor",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpNumber}},
|
||||
{types: []jpType{jpNumber}},
|
||||
},
|
||||
handler: jpfFloor,
|
||||
},
|
||||
"map": functionEntry{
|
||||
"map": {
|
||||
name: "amp",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpExpref}},
|
||||
argSpec{types: []jpType{jpArray}},
|
||||
{types: []jpType{jpExpref}},
|
||||
{types: []jpType{jpArray}},
|
||||
},
|
||||
handler: jpfMap,
|
||||
hasExpRef: true,
|
||||
},
|
||||
"max": functionEntry{
|
||||
"max": {
|
||||
name: "max",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpArrayNumber, jpArrayString}},
|
||||
{types: []jpType{jpArrayNumber, jpArrayString}},
|
||||
},
|
||||
handler: jpfMax,
|
||||
},
|
||||
"merge": functionEntry{
|
||||
"merge": {
|
||||
name: "merge",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpObject}, variadic: true},
|
||||
{types: []jpType{jpObject}, variadic: true},
|
||||
},
|
||||
handler: jpfMerge,
|
||||
},
|
||||
"max_by": functionEntry{
|
||||
"max_by": {
|
||||
name: "max_by",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpArray}},
|
||||
argSpec{types: []jpType{jpExpref}},
|
||||
{types: []jpType{jpArray}},
|
||||
{types: []jpType{jpExpref}},
|
||||
},
|
||||
handler: jpfMaxBy,
|
||||
hasExpRef: true,
|
||||
},
|
||||
"sum": functionEntry{
|
||||
"sum": {
|
||||
name: "sum",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpArrayNumber}},
|
||||
{types: []jpType{jpArrayNumber}},
|
||||
},
|
||||
handler: jpfSum,
|
||||
},
|
||||
"min": functionEntry{
|
||||
"min": {
|
||||
name: "min",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpArrayNumber, jpArrayString}},
|
||||
{types: []jpType{jpArrayNumber, jpArrayString}},
|
||||
},
|
||||
handler: jpfMin,
|
||||
},
|
||||
"min_by": functionEntry{
|
||||
"min_by": {
|
||||
name: "min_by",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpArray}},
|
||||
argSpec{types: []jpType{jpExpref}},
|
||||
{types: []jpType{jpArray}},
|
||||
{types: []jpType{jpExpref}},
|
||||
},
|
||||
handler: jpfMinBy,
|
||||
hasExpRef: true,
|
||||
},
|
||||
"type": functionEntry{
|
||||
"type": {
|
||||
name: "type",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpAny}},
|
||||
{types: []jpType{jpAny}},
|
||||
},
|
||||
handler: jpfType,
|
||||
},
|
||||
"keys": functionEntry{
|
||||
"keys": {
|
||||
name: "keys",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpObject}},
|
||||
{types: []jpType{jpObject}},
|
||||
},
|
||||
handler: jpfKeys,
|
||||
},
|
||||
"values": functionEntry{
|
||||
"values": {
|
||||
name: "values",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpObject}},
|
||||
{types: []jpType{jpObject}},
|
||||
},
|
||||
handler: jpfValues,
|
||||
},
|
||||
"sort": functionEntry{
|
||||
"sort": {
|
||||
name: "sort",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpArrayString, jpArrayNumber}},
|
||||
{types: []jpType{jpArrayString, jpArrayNumber}},
|
||||
},
|
||||
handler: jpfSort,
|
||||
},
|
||||
"sort_by": functionEntry{
|
||||
"sort_by": {
|
||||
name: "sort_by",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpArray}},
|
||||
argSpec{types: []jpType{jpExpref}},
|
||||
{types: []jpType{jpArray}},
|
||||
{types: []jpType{jpExpref}},
|
||||
},
|
||||
handler: jpfSortBy,
|
||||
hasExpRef: true,
|
||||
},
|
||||
"join": functionEntry{
|
||||
"join": {
|
||||
name: "join",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpString}},
|
||||
argSpec{types: []jpType{jpArrayString}},
|
||||
{types: []jpType{jpString}},
|
||||
{types: []jpType{jpArrayString}},
|
||||
},
|
||||
handler: jpfJoin,
|
||||
},
|
||||
"reverse": functionEntry{
|
||||
"reverse": {
|
||||
name: "reverse",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpArray, jpString}},
|
||||
{types: []jpType{jpArray, jpString}},
|
||||
},
|
||||
handler: jpfReverse,
|
||||
},
|
||||
"to_array": functionEntry{
|
||||
"to_array": {
|
||||
name: "to_array",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpAny}},
|
||||
{types: []jpType{jpAny}},
|
||||
},
|
||||
handler: jpfToArray,
|
||||
},
|
||||
"to_string": functionEntry{
|
||||
"to_string": {
|
||||
name: "to_string",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpAny}},
|
||||
{types: []jpType{jpAny}},
|
||||
},
|
||||
handler: jpfToString,
|
||||
},
|
||||
"to_number": functionEntry{
|
||||
"to_number": {
|
||||
name: "to_number",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpAny}},
|
||||
{types: []jpType{jpAny}},
|
||||
},
|
||||
handler: jpfToNumber,
|
||||
},
|
||||
"not_null": functionEntry{
|
||||
"not_null": {
|
||||
name: "not_null",
|
||||
arguments: []argSpec{
|
||||
argSpec{types: []jpType{jpAny}, variadic: true},
|
||||
{types: []jpType{jpAny}, variadic: true},
|
||||
},
|
||||
handler: jpfNotNull,
|
||||
},
|
||||
|
@ -357,7 +358,7 @@ func (a *argSpec) typeCheck(arg interface{}) error {
|
|||
return nil
|
||||
}
|
||||
case jpArray:
|
||||
if _, ok := arg.([]interface{}); ok {
|
||||
if isSliceType(arg) {
|
||||
return nil
|
||||
}
|
||||
case jpObject:
|
||||
|
@ -409,8 +410,9 @@ func jpfLength(arguments []interface{}) (interface{}, error) {
|
|||
arg := arguments[0]
|
||||
if c, ok := arg.(string); ok {
|
||||
return float64(utf8.RuneCountInString(c)), nil
|
||||
} else if c, ok := arg.([]interface{}); ok {
|
||||
return float64(len(c)), nil
|
||||
} else if isSliceType(arg) {
|
||||
v := reflect.ValueOf(arg)
|
||||
return float64(v.Len()), nil
|
||||
} else if c, ok := arg.(map[string]interface{}); ok {
|
||||
return float64(len(c)), nil
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue