text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (t *TreeNode) find(d int) *TreeNode {
if t.data == d {
return t
}
if d <= t.data {
if t.left != nil {
return t.left.find(d)
}
return nil
}
if d > t.data {
if t.right != nil {
return t.right.find(d)
}
return nil
}
return nil
} | [
-0.05368143692612648,
0.31333431601524353,
0.8405815362930298,
-0.759517252445221,
-0.6837157011032104,
0.19341686367988586,
-0.3012373447418213,
-1.4430882930755615,
-0.47831711173057556,
0.13083498179912567,
0.1374061107635498,
0.375007688999176,
-0.19127726554870605,
1.5057806968688965,... |
func PathCounter(root *TreeNode, targetSum int) int {
m := make(map[int]int)
return countPathsWithSum(root, targetSum, 0, m)
} | [
0.28475484251976013,
-0.8548771739006042,
0.5860551595687866,
0.7272967100143433,
-0.2941857576370239,
0.054550860077142715,
1.177158236503601,
0.7334408760070801,
0.37385857105255127,
-0.17146891355514526,
0.11823520809412003,
-0.22957338392734528,
0.43626877665519714,
0.6210547685623169,... |
func CountPathsWithSum(root *TreeNode, targetSum int) int {
if root == nil {
return 0
}
// Count paths with sum starting from the root.
pathsFromRoot := countPathsWithSumFromNode(root, targetSum, 0)
// Try the nodes on the left and right
pathsOnLeft := CountPathsWithSum(root.left, targetSum)
pathsOnRight := ... | [
0.48315733671188354,
-0.7997843027114868,
0.7232506275177002,
0.9754928350448608,
0.09675465524196625,
-0.2516467571258545,
0.7008005976676941,
0.1762627512216568,
0.9329105615615845,
0.08885012567043304,
-0.49926671385765076,
0.03298167884349823,
0.47182610630989075,
0.3843321204185486,
... |
func countPathsWithSumFromNode(node *TreeNode, targetSum, currentSum int) int {
if node == nil {
return 0
}
currentSum += node.data
totalPaths := 0
if currentSum == targetSum {
totalPaths++
}
totalPaths += countPathsWithSumFromNode(node.left, targetSum, currentSum)
totalPaths += countPathsWithSumFromNode... | [
0.45813503861427307,
-0.6471621990203857,
0.7285667061805725,
0.40264075994491577,
0.294465035200119,
0.1507357507944107,
0.963837742805481,
0.40064454078674316,
0.7091671228408813,
-0.10142681747674942,
-0.13070718944072723,
0.3531854748725891,
0.3285868167877197,
0.3264157176017761,
0.... |
func DFS(root *Node, i int) *Node {
if root == nil {
return nil
}
if root.Val == i {
return root
}
root.Visit()
for _, n := range root.Children {
if n.Visited {
continue
}
n.Visit()
resNode := DFS(n, i)
if resNode.Val == i {
return resNode
}
}
return root
} | [
-0.229947030544281,
1.333479881286621,
0.6451944708824158,
0.32694172859191895,
-0.6003908514976501,
-0.5952035784721375,
0.6871359348297119,
-0.8195052146911621,
-0.2548847198486328,
-0.18350324034690857,
0.6717376708984375,
0.20606426894664764,
-0.6252444982528687,
-0.25362545251846313,
... |
func BFS(root *Node, i int) *Node {
if root == nil {
return nil
}
if root.Val == i {
return root
}
root.Visit()
q := Queue{}
q.Enqueue(root)
for !q.IsEmpty() {
n := q.Dequeue()
n.Visit()
for _, child := range n.Children {
if child.Visited {
continue
}
if child.Val == i {
retu... | [
0.5029993057250977,
0.017873181030154228,
0.7625256776809692,
0.3610776960849762,
-0.6443281769752502,
-0.5733212828636169,
-0.1426941603422165,
-1.223379373550415,
-0.3381137549877167,
-0.2841947078704834,
0.17454908788204193,
0.7566291093826294,
-0.21305260062217712,
-0.03355129808187485... |
func NewSample(statusCode int, timestamp time.Time) *Sample {
// TODO Should we directly convert the timestamp into a string with the proper format?
return &Sample{
ResponseDuration: time.Since(timestamp),
Status: statusCode,
Timestamp: timestamp,
}
} | [
0.5953817963600159,
-0.2764686942100525,
0.45310476422309875,
-0.1229284331202507,
-1.2119240760803223,
-0.9573696851730347,
-1.3877326250076294,
-0.37031635642051697,
0.6041022539138794,
0.18284262716770172,
0.2557102143764496,
0.43668892979621887,
-0.07428981363773346,
-0.583825409412384... |
func (m *User) Save(fields ...string) (err error) {
o := orm.NewOrm()
if m.ID > 0 {
_, err = o.Update(m, fields...)
} else {
m.ID, err = o.Insert(m)
}
return
} | [
-0.6339784860610962,
0.5166651606559753,
0.4897274076938629,
0.6394080519676208,
0.5142632722854614,
0.42446956038475037,
0.33153632283210754,
-0.204936683177948,
-0.9355417490005493,
-0.05184381082653999,
-1.4015861749649048,
-0.8863444328308105,
-1.0992155075073242,
0.09400629997253418,
... |
func (m *User) Delete() (err error) {
_, err = orm.NewOrm().Delete(m)
return
} | [
0.6279336810112,
0.767108142375946,
0.2918015420436859,
1.2434073686599731,
0.5549753904342651,
0.036634985357522964,
0.4225536584854126,
0.20792481303215027,
-0.4043520987033844,
-0.09236364811658859,
-0.22333867847919464,
-0.4866724908351898,
-0.8933417797088623,
-0.21748627722263336,
... |
func (m *User) Read(fields ...string) error {
o := orm.NewOrm()
return o.Read(m, fields...)
} | [
-0.04807700961828232,
0.2560982406139374,
0.2889683246612549,
0.5187726616859436,
-0.3120347261428833,
0.6353991031646729,
-0.24513432383537292,
-0.4616893529891968,
-1.0034430027008057,
-0.7550050616264343,
-0.13579757511615753,
-0.08796508610248566,
-0.19662539660930634,
-0.9666357040405... |
func (m *User) GetUser(id int64) (interface{}, error) {
m.ID = id
e := m.Read()
return m, e
} | [
-1.1503568887710571,
-0.4453465938568115,
0.47095900774002075,
0.9021520614624023,
-0.3233203589916229,
-0.38724541664123535,
0.38403812050819397,
-0.5434155464172363,
0.4487874507904053,
-0.5808882713317871,
-0.8184386491775513,
-0.16809041798114777,
-0.3091218173503876,
0.306674569845199... |
func TestFile(t *testing.T) {
home, _ := homedir.Dir()
// return filepath.Join(home, "test.secrets")
filePath := filepath.Join(home, "test.secrets")
v := File("test", filePath)
assert.Equal(t, "test", v.encodingKey)
key1 := "key1"
value1 := "value1"
v.SetKey(key1, value1)
answer1, _ := v.GetValu... | [
-0.34084436297416687,
0.006897037848830223,
0.5841999053955078,
0.24137932062149048,
0.6995729207992554,
0.567960798740387,
0.12029338628053665,
0.1292189359664917,
-1.0309418439865112,
-0.40822747349739075,
-0.4246284067630768,
-0.09631488472223282,
0.06906279176473618,
0.6025218963623047... |
func New(host string) *Database {
return &Database{
Host: host,
}
} | [
0.09202662855386734,
0.3218579590320587,
-0.07903068512678146,
0.8788847923278809,
-1.1530332565307617,
0.34706422686576843,
-0.932835042476654,
0.6185048222541809,
-1.1963367462158203,
-0.28681063652038574,
-0.8577863574028015,
0.9306795001029968,
-0.2907232940196991,
0.6027737855911255,
... |
func (d *Database) ReadFullDB() ([]byte, error) {
fileContent, err := ioutil.ReadFile(d.Host)
if err != nil {
return []byte{}, err
}
return fileContent, nil
} | [
0.3595462739467621,
0.4698352515697479,
0.8734636306762695,
0.22133506834506989,
-0.7848613262176514,
1.0985976457595825,
-1.1421120166778564,
-0.09181459248065948,
-0.8805206418037415,
0.6005158424377441,
-0.4921242594718933,
-0.054496441036462784,
-0.8399925827980042,
0.7428312301635742,... |
func DefaultPointInPolygonHierarchyResolverUpdateCallback() PointInPolygonHierarchyResolverUpdateCallback {
fn := func(ctx context.Context, r reader.Reader, parent_spr spr.StandardPlacesResult) (map[string]interface{}, error) {
to_update := make(map[string]interface{})
if parent_spr == nil {
to_update = map... | [
0.27642369270324707,
-0.8962324261665344,
0.5193909406661987,
-0.7721568942070007,
0.2840394973754883,
0.12169716507196426,
-0.04125252738595009,
0.10812252014875412,
-0.13379746675491333,
0.20830292999744415,
-0.2014678716659546,
-0.6303218007087708,
-0.9294927716255188,
-0.34685149788856... |
func NewPointInPolygonHierarchyResolver(ctx context.Context, spatial_db database.SpatialDatabase, ms_client *mapshaper.Client) (*PointInPolygonHierarchyResolver, error) {
t := &PointInPolygonHierarchyResolver{
Database: spatial_db,
Mapshaper: ms_client,
}
return t, nil
} | [
0.5391938090324402,
-1.1465182304382324,
0.09561418741941452,
0.3865910768508911,
0.36752408742904663,
0.28752315044403076,
-0.35032662749290466,
0.4498281478881836,
-0.6926431059837341,
-0.8007843494415283,
-0.7905787825584412,
-0.4052196741104126,
-0.6406765580177307,
-0.1029816716909408... |
func (t *PointInPolygonHierarchyResolver) PointInPolygon(ctx context.Context, inputs *filter.SPRInputs, body []byte) ([]spr.StandardPlacesResult, error) {
pt_rsp := gjson.GetBytes(body, "properties.wof:placetype")
if !pt_rsp.Exists() {
return nil, fmt.Errorf("Missing 'wof:placetype' property")
}
pt_str := pt_r... | [
-0.4746946096420288,
-0.45558980107307434,
0.5521287322044373,
-0.0008602666202932596,
0.35430511832237244,
0.34252089262008667,
0.20320412516593933,
0.7255080342292786,
0.49812188744544983,
0.32277965545654297,
0.004290776327252388,
-0.00995982252061367,
-0.6054064631462097,
0.33969855308... |
func (t *PointInPolygonHierarchyResolver) PointInPolygonCentroid(ctx context.Context, body []byte) (*orb.Point, error) {
f, err := geojson.UnmarshalFeature(body)
if err != nil {
return nil, fmt.Errorf("Failed to unmarshal featur body, %w", err)
}
// First see whether there are exsiting reverse-geocoding proper... | [
0.595786452293396,
-1.3474007844924927,
0.584784746170044,
0.2600856125354767,
0.18603691458702087,
-0.05493701621890068,
-0.10070159286260605,
0.09153209626674652,
0.5418003797531128,
-0.083083875477314,
-0.10654812306165695,
0.16183346509933472,
-0.16732703149318695,
-0.03362595289945602... |
func testResource(t *testing.T, fileName string, fileContent string) func() {
if fileContent == "" {
fileContent = `This is a test file`
}
ioutil.WriteFile(fileName, []byte(fileContent), 0644)
buf := new(bytes.Buffer)
rootCmd.SetOutput(buf)
return func() {
os.Remove(fileName)
}
} | [
1.0509783029556274,
-1.2535009384155273,
0.40137791633605957,
-0.18835511803627014,
-0.19850681722164154,
-0.44114813208580017,
1.1637777090072632,
0.31898024678230286,
-0.13538508117198944,
-0.45055049657821655,
0.6493088006973267,
-0.21630193293094635,
-0.6634750962257385,
-0.08834532648... |
func (t *RandomTokenGenerator) GenerateTokens(requestedTokensCount int, allTakenTokens []uint32) Tokens {
if requestedTokensCount <= 0 {
return []uint32{}
}
r := rand.New(rand.NewSource(time.Now().UnixNano()))
used := make(map[uint32]bool, len(allTakenTokens))
for _, v := range allTakenTokens {
used[v] = tru... | [
-1.2530739307403564,
0.22351035475730896,
0.7364715337753296,
-0.24135980010032654,
-0.09249000996351242,
-0.08626987785100937,
0.015417652204632759,
0.07245159894227982,
0.1554071456193924,
-0.47018924355506897,
-0.6605523824691772,
0.09962069988250732,
-0.24132287502288818,
0.74778223037... |
func GetConnectionURL(c config.Config) string {
return fmt.Sprintf(
"postgres://%s:%s@%s:%d/%s?sslmode=disable",
c.DatabaseUser,
c.DatabasePassword,
c.DatabaseHost,
c.DatabasePort,
c.DatabaseName,
)
} | [
-0.15857364237308502,
0.0047276075929403305,
0.5448357462882996,
0.8738630414009094,
0.3301016688346863,
0.489117294549942,
0.3716791570186615,
0.6320462822914124,
-1.4323629140853882,
1.0744807720184326,
-0.15023982524871826,
-0.20424944162368774,
-0.20630764961242676,
-0.1636027842760086... |
func Connect(connURL string) (*sql.DB, error) {
conn, err := sql.Open("postgres", connURL)
if err != nil {
return nil, fmt.Errorf("failed to connect to database at %q: %v", connURL, err)
}
return conn, nil
} | [
-0.11870743334293365,
0.694861114025116,
0.5369335412979126,
0.3309772312641144,
-0.7944871783256531,
0.38865119218826294,
-0.44754791259765625,
-0.3555603325366974,
-0.9195141196250916,
0.2500411570072174,
-0.02692786231637001,
-0.1644519567489624,
-0.4170379042625427,
0.11447926610708237... |
func (p *Parser) parseVariableDeclaration (isConstant bool, isHoisted bool) astNode {
var nxt = p.parseComponent(false)
if isConstant && isHoisted {
panic("Variable declaration is both constant (const) *and* hoisted (var)? Mistake in parser?")
}
// TODO: Allow an undefined var dec (eg. let x;)
if nxt.ge... | [
0.06309936940670013,
-0.44661977887153625,
0.5943023562431335,
-0.057810984551906586,
-0.6067756414413452,
0.15353995561599731,
-0.15833693742752075,
0.039248816668987274,
0.1773994117975235,
0.8965950608253479,
-0.22854381799697876,
0.09752022475004196,
-0.23101645708084106,
0.34429794549... |
func TestTimeTZRoundTripRobust(t *testing.T) {
// Clear the testing table.
if err := ClearTestingTable(sqlDb); err != nil {
t.Fatalf("Failed to clear the testing table: %v", err)
}
tref := time.Unix(trefUNIX, 0) // time.Time of genesis block.
timedef := &dbtypes.TimeDef{T: tref} // No constructor, locatio... | [
-0.25222086906433105,
0.21989136934280396,
0.7158928513526917,
-0.1129637137055397,
0.46445298194885254,
0.3284626305103302,
0.6345296502113342,
-0.2900214195251465,
-0.038128696382045746,
0.16906076669692993,
-0.5802794694900513,
-0.02342040091753006,
0.3681364357471466,
0.347711086273193... |
func TestTimeTZRoundTripCorrectTimeDef(t *testing.T) {
// Clear the testing table.
if err := ClearTestingTable(sqlDb); err != nil {
t.Fatalf("Failed to clear the testing table: %v", err)
}
// tref := time.Unix(trefUNIX, 0) // time.Time of genesis block.
// timedef := &dbtypes.TimeDef{T: tref} ... | [
-0.3445170819759369,
0.09036212414503098,
0.6876417994499207,
-0.25685423612594604,
0.3948647379875183,
0.43734806776046753,
0.3472200036048889,
-0.10910593718290329,
-0.0021768563892692327,
0.09845782071352005,
-0.5917240977287292,
-0.06291466951370239,
0.26499438285827637,
0.262825548648... |
func TestMultiLedgerHappy(ctx context.Context, t *testing.T, mlt MultiLedgerSetup, challengeDuration uint64) {
require := require.New(t)
alice, bob := mlt.Client1, mlt.Client2
// Define initial and update balances.
initBals := mlt.InitBalances
updateBals1 := mlt.UpdateBalances1
updateBals2 := mlt.UpdateBalances2... | [
0.2607417106628418,
0.22488172352313995,
0.9478716254234314,
-0.7017010450363159,
0.6854961514472961,
0.1974269598722458,
-0.14533381164073944,
-0.5573396682739258,
0.014451568014919758,
0.5779876708984375,
-0.19171372056007385,
0.697715163230896,
-0.2542232871055603,
-0.1469854861497879,
... |
func GetToEatAndUserFunds(c echo.Context) error {
config := config.GetInstance()
token := c.Request().Header.Get("token")
req, err := http.NewRequest("GET", config.GetRemoteURL()+"process-request.php?command-name=get-to-eat-and-user-funds", nil)
if err != nil {
return c.JSON(1, models.Response{
Status: 1,
... | [
-0.8746151924133301,
-0.47001636028289795,
0.9280139803886414,
-0.07369860261678696,
-0.39511388540267944,
-0.07200712710618973,
-0.23576614260673523,
-0.3864334225654602,
0.23131750524044037,
0.5614327788352966,
-0.6828221678733826,
0.8553842902183533,
0.2764410674571991,
0.17840258777141... |
func (p *Program) Start() error {
var err error
// 连接数据库
err = database.OpenMysql(global.ProjectConfig.MysqlCfgs...)
if err != nil {
log.Panic(err)
}
err = wallet.WalletService().LoadWallets()
if err != nil {
log.Panic(err)
}
// 启动http服务
err = p.htpServe.Start(global.ProjectConfig.Servers.Debug, global.... | [
0.03341762721538544,
0.12567685544490814,
0.7686742544174194,
0.20412614941596985,
0.41312044858932495,
1.0053091049194336,
0.33461993932724,
0.547176718711853,
-0.15413221716880798,
0.3150045871734619,
-0.31426844000816345,
0.7682148218154907,
-0.7601556777954102,
0.5326797366142273,
0.... |
func (p *Program) Stop() error {
var err error
p.htpServe.Stop()
// 存储钱包
if err = wallet.WalletService().StoreWallets(); err != nil {
log.Error(err)
}
// 关闭数据库连接
database.CloseMysql()
log.Error("WALLET·服务退出")
return nil
} | [
-0.6364738345146179,
0.02890084497630596,
0.8933664560317993,
0.08341749757528305,
-0.0034486667718738317,
1.0505011081695557,
0.533267080783844,
0.43423324823379517,
0.2987506091594696,
0.5580235123634338,
-0.3332499563694,
0.07551259547472,
-1.2475050687789917,
0.6708334684371948,
0.59... |
func encryption(s string) string {
root := math.Sqrt(float64(len(s)))
n := int32(math.Floor(root))
m := int32(math.Ceil(root))
if n*m < int32(len(s)) {
n++
}
fmt.Println(n)
fmt.Println(m)
input := ""
for i := int32(0); i < n; i++ {
input += s[i*m : int32(math.Min(float64(i*m+m), float64(len(s))))]
... | [
0.04247221723198891,
0.907753050327301,
0.903366208076477,
0.06503380089998245,
-1.3901084661483765,
-0.2883939743041992,
0.9409947991371155,
-1.4964741468429565,
0.6128286123275757,
0.7097802758216858,
-0.26423829793930054,
0.2521853744983673,
-0.6228743195533752,
0.051194723695516586,
... |
func (f *linkFrame) Encode(w io.Writer) (err error) {
i := make(map[string]interface{})
i["m"] = f.method
i["p"] = f.param
if f.response < 0 {
// not set
} else {
i["r"] = f.response
}
return BencodeWriteMap(i, w)
} | [
-0.8353175520896912,
-0.505726158618927,
0.46731749176979065,
0.2955187261104584,
0.4853515625,
-0.7531511783599854,
0.9237767457962036,
-0.3465512990951538,
0.23512452840805054,
-0.9273913502693176,
0.9431682229042053,
-0.14651994407176971,
-0.3569898307323456,
0.3883662819862366,
-0.78... |
func (f *linkFrame) Bytes() (b []byte, err error) {
buff := new(bytes.Buffer)
err = f.Encode(buff)
if err == nil {
b = buff.Bytes()
}
return
} | [
-0.12852755188941956,
0.31663650274276733,
0.294271320104599,
-0.11591663956642151,
0.8678753972053528,
-0.2629559636116028,
-0.7414778470993042,
-0.355314165353775,
0.6199570298194885,
-1.520358920097351,
-0.4086291193962097,
1.3322112560272217,
-0.6707676649093628,
0.6987534761428833,
... |
func (f *linkFrame) Decode(r io.Reader) (err error) {
var m map[string]interface{}
m, err = BencodeReadMap(r)
if err == nil {
v, ok := m["m"]
if ok {
switch v.(type) {
case int64:
f.method = v.(int64)
break
default:
err = errors.New("bad method type")
retu... | [
-0.6260727643966675,
-0.6097404956817627,
0.7869600653648376,
0.5119382739067078,
0.23953408002853394,
-1.0131586790084839,
0.029764557257294655,
0.06678248196840286,
-0.07306072860956192,
-0.752382755279541,
0.7645054459571838,
0.48173800110816956,
-0.9795172214508057,
0.8771189451217651,... |
func (f *linkFrame) GetParamStr(k string) (str []byte, err error) {
v, ok := f.param[k]
if ok {
// we got it
var s []byte
switch v.(type) {
case []byte:
s = v.([]byte)
str = make([]byte, len(s))
copy(str, s)
break
default:
err = errors.New("param value "+k+" not byt... | [
-0.22573870420455933,
-0.22472290694713593,
0.5461170673370361,
0.381767600774765,
0.04044438526034355,
-0.2423010915517807,
-0.40119245648384094,
-0.6856702566146851,
-0.3122889995574951,
0.4373684227466583,
0.696694016456604,
0.5079512596130371,
-0.5214743614196777,
0.7522038817405701,
... |
func (f *linkFrame) GetParamInt(k string) (i int64, err error) {
v, ok := f.param[k]
if ok {
switch v.(type) {
case int64:
i = v.(int64)
break
default:
err = errors.New("param value "+k+" not int")
}
} else {
err = errors.New("params don't have "+k)
}
return
} | [
-0.8619266152381897,
-0.4955100119113922,
0.7508717775344849,
0.011842339299619198,
0.016861815005540848,
-0.12178736180067062,
-0.416230171918869,
-0.8496384620666504,
-0.7193697094917297,
0.47843870520591736,
0.7258418202400208,
0.2696292996406555,
-1.084004282951355,
0.4425060749053955,... |
func (f *linkFrame) HasPackets() (has bool) {
if f.method == RELAY_TUN_DATA {
_, has = f.param[K_PKTS]
}
return
} | [
0.29865026473999023,
0.3655066192150116,
0.5730878114700317,
-0.5776576995849609,
0.17503830790519714,
-0.1422840803861618,
-0.14125560224056244,
0.10527295619249344,
0.47807756066322327,
-1.3186205625534058,
-0.5096542835235596,
-0.11233232170343399,
0.21170483529567719,
0.716546475887298... |
func pktsFromBytes(buff []byte) (pkts []ipPacket) {
if buff[0] == 0x00 {
n := buff[1]
idx := 0
for n > 0 {
plen := binary.BigEndian.Uint16(buff[:2+idx])
if 2 + int(plen) + idx < len(buff) {
pkt := make([]byte, int(plen))
copy(pkt, buff[idx+2:2+len(pkt)+idx])
pkts = appe... | [
-0.25167807936668396,
-0.04655264690518379,
0.5432692766189575,
-0.3821476995944977,
-0.26748162508010864,
-0.36841776967048645,
0.14423590898513794,
-0.3902928829193115,
1.3787232637405396,
-0.6331027150154114,
-0.9246885776519775,
-0.42851778864860535,
-0.5291956067085266,
-0.32061821222... |
func newFrameFromPackets(pkts []ipPacket, tid int64) (f linkFrame) {
f.method = RELAY_TUN_DATA
f.param = map[string]interface{} { K_PKTS : bytesFromPkts(pkts), K_TID: tid}
f.response = -1
return
} | [
-0.1567404866218567,
-0.4783230721950531,
0.31225350499153137,
-0.5951470136642456,
-0.6854161620140076,
-0.21333222091197968,
-0.1646708846092224,
-0.5499085783958435,
0.5210340023040771,
-1.0145087242126465,
-0.19237643480300903,
-0.12839552760124207,
0.010208817198872566,
-0.63488608598... |
func newCreateClientTunnelReply(cidr *net.IPNet, tid int64) (f linkFrame) {
f.method = CLIENT_TUN_NEW
f.param = map[string]interface{} { K_CIDR : cidr.String() }
f.response = tid
return
} | [
0.46702659130096436,
-0.7272791862487793,
0.008440278470516205,
-1.114898920059204,
0.21641023457050323,
-0.18019650876522064,
0.2533739507198334,
-1.1693309545516968,
-0.4407905340194702,
0.00004261893263901584,
-0.20067165791988373,
-0.13148468732833862,
-0.47701698541641235,
-0.33109965... |
func parseLinkMessage(from i2p.I2PAddr, payload []byte) (msg *linkMessage, err error) {
m := new(linkMessage)
buff := bytes.NewBuffer(payload)
err = m.Frame.Decode(buff)
if err == nil {
msg = m
msg.Addr = from
}
buff.Reset()
return
} | [
0.12790749967098236,
-0.04741619899868965,
0.38408318161964417,
-0.865710973739624,
0.1489458829164505,
-0.3865630030632019,
-0.04717053100466728,
-0.35073819756507874,
0.4230054020881653,
-1.060001015663147,
0.3645130693912506,
0.7164636850357056,
-1.2019858360290527,
-0.13654851913452148... |
func (client *Client) CreateTopic(request *CreateTopicRequest) (response *CreateTopicResponse, err error) {
response = CreateCreateTopicResponse()
err = client.DoAction(request, response)
return
} | [
-0.6629165410995483,
0.6281387805938721,
0.2708262503147125,
0.7332375645637512,
0.6153135895729065,
0.47322335839271545,
0.9134101271629333,
-1.047904372215271,
-0.11765111982822418,
-0.8841052055358887,
0.041801050305366516,
0.22344271838665009,
-0.40689617395401,
-0.4725799262523651,
... |
func (client *Client) CreateTopicWithChan(request *CreateTopicRequest) (<-chan *CreateTopicResponse, <-chan error) {
responseChan := make(chan *CreateTopicResponse, 1)
errChan := make(chan error, 1)
err := client.AddAsyncTask(func() {
defer close(responseChan)
defer close(errChan)
response, err := client.Creat... | [
-0.41998717188835144,
-0.2755748927593231,
0.4382416307926178,
-0.6219505667686462,
0.13358421623706818,
0.4598065912723541,
0.0026378794573247433,
-1.5510368347167969,
0.023267945274710655,
0.07408387213945389,
0.2799937129020691,
0.09058091044425964,
-0.3304968774318695,
0.17979344725608... |
func (client *Client) CreateTopicWithCallback(request *CreateTopicRequest, callback func(response *CreateTopicResponse, err error)) <-chan int {
result := make(chan int, 1)
err := client.AddAsyncTask(func() {
var response *CreateTopicResponse
var err error
defer close(result)
response, err = client.CreateTopi... | [
-0.16300150752067566,
0.3379119336605072,
0.5472126007080078,
-0.16872891783714294,
0.09313712269067764,
0.337756484746933,
0.3272669017314911,
-1.3285568952560425,
0.4005051553249359,
-0.199811190366745,
0.5963242053985596,
-0.8307425379753113,
0.16833819448947906,
0.21921034157276154,
... |
func CreateCreateTopicRequest() (request *CreateTopicRequest) {
request = &CreateTopicRequest{
RpcRequest: &requests.RpcRequest{},
}
request.InitWithApiInfo("alikafka", "2019-09-16", "CreateTopic", "alikafka", "openAPI")
request.Method = requests.POST
return
} | [
-0.19840839505195618,
-0.35987693071365356,
0.47616884112358093,
0.18593980371952057,
0.19029901921749115,
0.5256386399269104,
-0.35360610485076904,
-0.7856097221374512,
-0.8020156025886536,
-0.11875957995653152,
0.4306422173976898,
0.5686056017875671,
-0.39153969287872314,
0.3762899935245... |
func CreateCreateTopicResponse() (response *CreateTopicResponse) {
response = &CreateTopicResponse{
BaseResponse: &responses.BaseResponse{},
}
return
} | [
-0.21382878720760345,
-0.9343219995498657,
-0.07068328559398651,
-0.3272395431995392,
0.3166828751564026,
-0.1066412702202797,
0.5182173848152161,
-1.340848445892334,
0.12754112482070923,
0.0807090476155281,
-0.6077253222465515,
-0.5332435965538025,
-0.7941019535064697,
0.12183663249015808... |
func Run(c *cli.Context, o *options) error {
err := verifyFlags(o)
if err != nil {
return fmt.Errorf("unable to verify flags: %v", err)
}
err = initialize()
if err != nil {
return fmt.Errorf("unable to initialize: %v", err)
}
defer shutdown()
err = installToolkit(o)
if err != nil {
return fmt.Errorf("u... | [
0.05093272775411606,
0.21509627997875214,
0.819330632686615,
0.22775456309318542,
0.5966424942016602,
0.22201988101005554,
0.6856886148452759,
-0.4527823328971863,
-0.019585875794291496,
-0.20893436670303345,
-0.6255013346672058,
-0.07724614441394806,
-0.24686230719089508,
0.86262971162796... |
func ParseArgs(args []string) ([]string, string, error) {
log.Infof("Parsing arguments")
if len(args) < 2 {
return args, "", nil
}
var lastPositionalArg int
for i, arg := range args {
if strings.HasPrefix(arg, "-") {
break
}
lastPositionalArg = i
}
if lastPositionalArg == 0 {
return args, "", nil... | [
-0.04139724001288414,
-0.3280208110809326,
0.9904220104217529,
-0.2652429938316345,
0.5165375471115112,
-0.4847898483276367,
-0.673677384853363,
-0.023501932621002197,
-0.35453641414642334,
0.9448819756507874,
-0.043706297874450684,
0.1628791093826294,
-0.512937068939209,
0.460161149501800... |
func (s *MTLSAuthService) Create(ctx context.Context,
consumerUsernameOrID *string, mtlsAuth *MTLSAuth) (*MTLSAuth, error) {
cred, err := s.client.credentials.Create(ctx, "mtls-auth",
consumerUsernameOrID, mtlsAuth)
if err != nil {
return nil, err
}
var createdMTLS MTLSAuth
err = json.Unmarshal(cred, &creat... | [
-0.12453486025333405,
-1.0313881635665894,
0.2165616750717163,
0.7052610516548157,
-1.0801652669906616,
0.26376277208328247,
-1.0205936431884766,
-0.03599146753549576,
-0.18851228058338165,
0.38023126125335693,
0.1133769080042839,
0.047973696142435074,
-0.3280382752418518,
0.30180621147155... |
func (s *MTLSAuthService) Get(ctx context.Context,
consumerUsernameOrID, keyOrID *string) (*MTLSAuth, error) {
cred, err := s.client.credentials.Get(ctx, "mtls-auth",
consumerUsernameOrID, keyOrID)
if err != nil {
return nil, err
}
var mtlsAuth MTLSAuth
err = json.Unmarshal(cred, &mtlsAuth)
if err != nil {... | [
-0.42099711298942566,
-1.0351324081420898,
0.3893758952617645,
0.20334461331367493,
-1.119821310043335,
-0.19994455575942993,
-1.2753952741622925,
0.2978256940841675,
-0.40284276008605957,
0.40683406591415405,
0.5673242211341858,
1.068691611289978,
0.08654754608869553,
-0.36221906542778015... |
func (s *MTLSAuthService) Update(ctx context.Context,
consumerUsernameOrID *string, mtlsAuth *MTLSAuth) (*MTLSAuth, error) {
cred, err := s.client.credentials.Update(ctx, "mtls-auth",
consumerUsernameOrID, mtlsAuth)
if err != nil {
return nil, err
}
var updatedMTLS MTLSAuth
err = json.Unmarshal(cred, &updat... | [
-0.40234145522117615,
-1.6978679895401,
0.2435208410024643,
0.3689045310020447,
-1.7002595663070679,
0.06861098110675812,
-0.9528409242630005,
0.4056690037250519,
0.22770816087722778,
0.6613418459892273,
0.09767274558544159,
0.49482154846191406,
-0.42448118329048157,
-0.0645708292722702,
... |
func (s *MTLSAuthService) Delete(ctx context.Context,
consumerUsernameOrID, keyOrID *string) error {
return s.client.credentials.Delete(ctx, "mtls-auth",
consumerUsernameOrID, keyOrID)
} | [
0.2129906415939331,
-0.7745118141174316,
0.20376946032047272,
0.7453724145889282,
-1.1682223081588745,
-0.1658262461423874,
-0.6777405142784119,
0.4247056841850281,
-0.025205902755260468,
0.6912485361099243,
0.7042555212974548,
0.46498993039131165,
-0.4255211651325226,
-0.00913130026310682... |
func (s *MTLSAuthService) List(ctx context.Context,
opt *ListOpt) ([]*MTLSAuth, *ListOpt, error) {
data, next, err := s.client.list(ctx, "/mtls-auths", opt)
if err != nil {
return nil, nil, err
}
var mtlss []*MTLSAuth
for _, object := range data {
b, err := object.MarshalJSON()
if err != nil {
return nil... | [
-0.4649486541748047,
-0.9579423666000366,
0.4020109176635742,
0.11427612602710724,
-0.764147937297821,
0.061681073158979416,
-0.8480402231216431,
0.3024250566959381,
0.5486584901809692,
0.9635837078094482,
-0.24301718175411224,
0.6104092001914978,
0.04102317616343498,
0.36356526613235474,
... |
func (s *MTLSAuthService) ListAll(ctx context.Context) ([]*MTLSAuth, error) {
var mtlss, data []*MTLSAuth
var err error
opt := &ListOpt{Size: pageSize}
for opt != nil {
data, opt, err = s.List(ctx, opt)
if err != nil {
return nil, err
}
mtlss = append(mtlss, data...)
}
return mtlss, nil
} | [
-0.5901521444320679,
-0.9739564657211304,
0.41369783878326416,
0.6591477394104004,
-0.5038207769393921,
0.6873056888580322,
-1.3243682384490967,
0.28253108263015747,
0.8004408478736877,
0.41173145174980164,
0.7746063470840454,
1.179947018623352,
0.3111881911754608,
0.8537284731864929,
-0... |
func (s *MTLSAuthService) ListForConsumer(ctx context.Context,
consumerUsernameOrID *string, opt *ListOpt) ([]*MTLSAuth, *ListOpt, error) {
data, next, err := s.client.list(ctx,
"/consumers/"+*consumerUsernameOrID+"/mtls-auth", opt)
if err != nil {
return nil, nil, err
}
var mtlss []*MTLSAuth
for _, object :=... | [
-0.6112619042396545,
-1.2577332258224487,
0.2671431303024292,
0.3852962553501129,
-0.6898354291915894,
-0.31907469034194946,
-0.8902097940444946,
-0.038600701838731766,
0.23101858794689178,
0.3740273118019104,
0.34012389183044434,
0.32509535551071167,
0.1843436360359192,
0.8022887110710144... |
func getProgressReader(size int64, reader io.Reader, barLen uint) io.Reader {
// progressReader is an io.Reader, and will write the progress of a read to
// stdout in real time.
//
// Inspired by the documented example on ioprogress.DrawTextFormatBar().
bar := ioprogress.DrawTextFormatBar(int64(barLen))
progressR... | [
0.24094344675540924,
-0.8771690726280212,
0.7635461688041687,
-0.8556172847747803,
-1.0220668315887451,
-0.0327354371547699,
-0.45970210433006287,
-0.8630036115646362,
-0.638637363910675,
-0.9606159329414368,
1.0300642251968384,
-0.12037991732358932,
-0.3779987394809723,
-0.529742181301116... |
func (j *Janitor) Run() {
for {
if err := j.run(); err != nil {
j.Metrics.Errors.Inc()
log15.Error("Failed to run janitor process", "err", err)
}
time.Sleep(j.JanitorInterval)
}
} | [
0.1710492968559265,
-0.4019891321659088,
0.34861448407173157,
-0.03948759660124779,
0.16793249547481537,
0.9948630332946777,
0.6193498969078064,
-0.7702827453613281,
-0.5219083428382874,
-0.5853014588356018,
0.10253604501485825,
-0.07385425269603729,
-0.24357378482818604,
0.934306681156158... |
func AppConfigParse() {
golog.Info("@@@ Init app conf")
appData, err := ioutil.ReadFile("config/app.yaml")
if err != nil {
golog.Fatalf("Error. %s", err)
}
if err = yaml.Unmarshal([]byte(appData), &AppConfig); err != nil {
golog.Fatalf("Error. %s", err)
}
} | [
1.1154563426971436,
-0.8932584524154663,
0.6161289811134338,
-0.14961469173431396,
-0.6521123647689819,
0.6224933862686157,
-0.4897964596748352,
1.0128837823867798,
-1.3200294971466064,
0.6327733993530273,
0.1772886961698532,
0.16410061717033386,
0.18849140405654907,
0.7097044587135315,
... |
func ReverseList(head *ListNode) *ListNode {
if head == nil || head.Next == nil {
return head
}
temp := ReverseList(head.Next)
head.Next.Next = head
head.Next = nil
return temp
} | [
0.29545480012893677,
0.23019804060459137,
0.5450664162635803,
-0.24433951079845428,
0.3446618318557739,
-1.207016110420227,
-0.6154469847679138,
1.2767666578292847,
1.00997793674469,
0.17612458765506744,
-0.7739310264587402,
0.4842855632305145,
-0.883724570274353,
0.6073867082595825,
-0.... |
func GetRow(rowIndex int) []int {
if rowIndex == 0 {
return []int{1}
}
oldRow := GetRow(rowIndex - 1)
nthRow := make([]int, rowIndex+1)
nthRow[0] = 1
for i := 1; i < rowIndex; i++ {
nthRow[i] = oldRow[i] + oldRow[i-1]
}
nthRow[rowIndex] = 1
return nthRow
} | [
-1.041003942489624,
1.7718040943145752,
0.7854521870613098,
0.5714237093925476,
0.5178373456001282,
-0.9324797987937927,
1.0834107398986816,
-0.18319131433963776,
1.56471586227417,
0.007940830662846565,
-0.41495010256767273,
0.6359222531318665,
0.07539485394954681,
1.043799638748169,
0.6... |
func NewDeploymentsRepository(
org *auth.Organization,
cluster api.Cluster,
db *gorm.DB,
logger logrus.FieldLogger,
) *DeploymentsRepository {
return &DeploymentsRepository{
org: org,
cluster: cluster,
db: db,
logger: logger,
}
} | [
-0.27764683961868286,
0.09702972322702408,
-0.0996801108121872,
-0.7701636552810669,
-0.3592889606952667,
-0.7468451261520386,
-0.30834081768989563,
0.25532540678977966,
0.6440611481666565,
0.3359360694885254,
-0.20388182997703552,
-0.641204297542572,
0.4759507477283478,
0.8144980072975159... |
func (s *DeploymentsRepository) FindFirst() (*ClusterBackupDeploymentsModel, error) {
var deployment ClusterBackupDeploymentsModel
err := s.db.Where(&ClusterBackupDeploymentsModel{
ClusterID: s.cluster.GetID(),
OrganizationID: s.org.ID,
}).First(&deployment).Error
if err != nil {
return nil, err
}
ret... | [
0.8485541939735413,
0.04296915605664253,
0.41450753808021545,
0.39350298047065735,
0.7761247754096985,
-0.8679121136665344,
0.03415829688310623,
-0.5439519882202148,
-0.3513263165950775,
1.5055081844329834,
0.06666793674230576,
-0.5604624152183533,
-0.30064675211906433,
0.6547777652740479,... |
func (s *DeploymentsRepository) Persist(req *api.PersistDeploymentRequest) (*ClusterBackupDeploymentsModel, error) {
deployment := &ClusterBackupDeploymentsModel{
BucketID: req.BucketID,
RestoreMode: req.RestoreMode,
Name: req.Name,
Namespace: req.Namespace,
Status: "DEPLOYING",
Organi... | [
-0.4777361750602722,
-0.3355681300163269,
0.501830518245697,
-0.26327866315841675,
0.6213542819023132,
0.3493305742740631,
-0.10524489730596542,
0.6479784846305847,
0.6498385071754456,
0.9766238331794739,
-0.45687633752822876,
-0.9411371350288391,
-0.5364776849746704,
-0.18092767894268036,... |
func (s *DeploymentsRepository) Delete(deployment *ClusterBackupDeploymentsModel) error {
return s.db.Delete(&deployment).Error
} | [
-0.13779981434345245,
0.5755696892738342,
0.1374983787536621,
0.6659031510353088,
0.8674429059028625,
-0.4242335259914398,
0.45681333541870117,
0.7156911492347717,
0.9527224898338318,
1.356428623199463,
0.0277475044131279,
-1.6855127811431885,
-0.33427852392196655,
-0.39332979917526245,
... |
func (s *DeploymentsRepository) UpdateStatus(deployment *ClusterBackupDeploymentsModel, status, message string) error {
deployment.Status = status
deployment.StatusMessage = message
return s.db.Save(&deployment).Error
} | [
-0.8374261260032654,
-0.6964145302772522,
0.05462012439966202,
0.29763561487197876,
0.16587866842746735,
0.12015163898468018,
0.14979642629623413,
1.257033348083496,
0.23729830980300903,
1.6653672456741333,
-0.48186758160591125,
-0.2795945703983307,
-0.03784576430916786,
0.0322372242808342... |
func NewReaderWithProgress(inner io.ReadCloser, sizeInBytes int64, progressIntervalInSeconds time.Duration) *ReaderWithProgress {
r := &ReaderWithProgress{}
r.innerReadCloser = inner
r.progressStatus = NewStatus(0, 0, sizeInBytes, NewComputestateDefaultSize())
r.ProgressChan = r.progressStatus.Run()
return r
} | [
-0.1855497509241104,
-1.644637942314148,
0.4158751666545868,
-0.2384413182735443,
-1.291796088218689,
0.18773314356803894,
-0.3186185956001282,
-0.4182056486606598,
-0.6001608967781067,
-0.7943688035011292,
0.416068434715271,
-0.8457533121109009,
-0.967026948928833,
0.25064516067504883,
... |
func (r *ReaderWithProgress) Read(p []byte) (n int, err error) {
n, err = r.innerReadCloser.Read(p)
if err == nil {
r.progressStatus.ReportBytesProcessedCount(int64(n))
}
return
} | [
-0.6822615265846252,
-0.30466970801353455,
0.6970455050468445,
-0.5699474215507507,
-0.3840987980365753,
0.6522293090820312,
0.7112874984741211,
-0.10313208401203156,
-0.4599117636680603,
-0.638820230960846,
0.6011651754379272,
0.10744877904653549,
-1.8052374124526978,
0.7574784755706787,
... |
func (r *ReaderWithProgress) Close() error {
err := r.innerReadCloser.Close()
r.progressStatus.Close()
return err
} | [
-0.4494151771068573,
-1.3842275142669678,
0.6488338112831116,
-0.7047924995422363,
-0.6208451986312866,
1.1332755088806152,
-0.2775186598300934,
-0.24935683608055115,
-1.118489146232605,
-0.8993609547615051,
1.1256452798843384,
-0.47615668177604675,
-1.5074588060379028,
0.9573115110397339,... |
func Equal(identity1, identity2 IdentityAttrs) error {
if identity1.GetMSPIdentifier() != identity2.GetMSPIdentifier() {
return ErrMSPIdentifierNotEqual
}
return CertEqual(identity1, identity2)
} | [
0.1176639273762703,
-1.6373674869537354,
0.5371977686882019,
0.7772477269172668,
0.3777853846549988,
0.9352181553840637,
-0.6648675799369812,
-0.0897374078631401,
-0.19593140482902527,
0.8059913516044617,
-0.7941833734512329,
0.36427542567253113,
-0.5893532037734985,
-0.30231598019599915,
... |
func CertEqual(cert1, cert2 SubjectIssuer) error {
if cert1 == nil || cert2 == nil {
return errors.New(`certificate empty`)
}
if cert1.GetSubject() != cert2.GetSubject() {
return ErrSubjectNotEqual
}
if cert1.GetIssuer() != cert2.GetIssuer() {
return ErrIssuerNotEqual
}
return nil
} | [
0.8596961498260498,
-1.0431715250015259,
0.6332576274871826,
0.8481332659721375,
-0.3233104646205902,
0.47491535544395447,
-0.824390709400177,
-1.2074130773544312,
-0.4330337941646576,
0.5126745700836182,
-0.5012854337692261,
0.4233032763004303,
-0.18833443522453308,
0.05601901933550835,
... |
func (egw *NsxtEdgeGateway) CreateBgpNeighbor(bgpNeighborConfig *types.EdgeBgpNeighbor) (*EdgeBgpNeighbor, error) {
client := egw.client
endpoint := types.OpenApiPathVersion1_0_0 + types.OpenApiEndpointEdgeBgpNeighbor
apiVersion, err := client.getOpenApiHighestElevatedVersion(endpoint)
if err != nil {
return nil,... | [
-0.037794891744852066,
-0.3996075987815857,
0.9347072839736938,
-0.08338068425655365,
-0.13969817757606506,
0.2602948546409607,
-0.28077244758605957,
-0.6650031208992004,
-0.33436939120292664,
0.9203335046768188,
-0.9834603667259216,
-0.09136514365673065,
-1.0073609352111816,
0.31067696213... |
func (egw *NsxtEdgeGateway) GetAllBgpNeighbors(queryParameters url.Values) ([]*EdgeBgpNeighbor, error) {
queryParams := copyOrNewUrlValues(queryParameters)
client := egw.client
endpoint := types.OpenApiPathVersion1_0_0 + types.OpenApiEndpointEdgeBgpNeighbor
apiVersion, err := client.getOpenApiHighestElevatedVersio... | [
-0.73177170753479,
-0.390874445438385,
0.6690568923950195,
0.09103579819202423,
0.13002337515354156,
0.3559192419052124,
-0.6582717895507812,
-0.5099908709526062,
-0.2695406377315521,
0.6870469450950623,
-0.3491077721118927,
1.5099704265594482,
-1.1968134641647339,
0.7185952663421631,
-0... |
func (egw *NsxtEdgeGateway) GetBgpNeighborById(id string) (*EdgeBgpNeighbor, error) {
if id == "" {
return nil, fmt.Errorf("id is required")
}
client := egw.client
endpoint := types.OpenApiPathVersion1_0_0 + types.OpenApiEndpointEdgeBgpNeighbor
apiVersion, err := client.getOpenApiHighestElevatedVersion(endpoint... | [
-0.032207515090703964,
-0.5259352922439575,
0.6502512693405151,
-0.24824827909469604,
-0.7036325335502625,
0.3808354139328003,
-0.4064193665981293,
-0.7333022356033325,
-0.22094793617725372,
1.2277196645736694,
-0.6659337282180786,
0.8907809853553772,
-1.5077183246612549,
0.273877948522567... |
func (bgpNeighbor *EdgeBgpNeighbor) Update(bgpNeighborConfig *types.EdgeBgpNeighbor) (*EdgeBgpNeighbor, error) {
client := bgpNeighbor.client
endpoint := types.OpenApiPathVersion1_0_0 + types.OpenApiEndpointEdgeBgpNeighbor
apiVersion, err := client.getOpenApiHighestElevatedVersion(endpoint)
if err != nil {
return... | [
-0.2567179203033447,
-0.799174427986145,
0.6814849376678467,
-0.22053654491901398,
-0.7702083587646484,
0.8150914907455444,
-0.7646026015281677,
-0.14867424964904785,
-0.31880223751068115,
1.058756947517395,
-0.7193880081176758,
0.47245359420776367,
-1.9030864238739014,
-0.2440548092126846... |
func (bgpNeighbor *EdgeBgpNeighbor) Delete() error {
client := bgpNeighbor.client
endpoint := types.OpenApiPathVersion1_0_0 + types.OpenApiEndpointEdgeBgpNeighbor
apiVersion, err := client.getOpenApiHighestElevatedVersion(endpoint)
if err != nil {
return err
}
// Insert Edge Gateway ID into endpoint path
urlR... | [
0.5089370608329773,
-0.33776721358299255,
0.823196530342102,
-0.04134513810276985,
0.15935097634792328,
0.9186607599258423,
-0.5411913394927979,
-0.07058507949113846,
-0.3616267442703247,
1.312130093574524,
-0.08622832596302032,
0.4868185222148895,
-1.7597202062606812,
-0.05608226358890533... |
func NewRelayDiscovery(host host.Host, adv *discovery.RoutingDiscovery, opts ...circuit.RelayOpt) *Relay {
r := new(Relay)
r.advertise = adv
var err error
r.crelay, err = newRelay(context.Background(), host, opts...)
if err != nil {
return nil
}
return r
} | [
0.813633918762207,
0.38543638586997986,
0.36024853587150574,
0.05938443914055824,
-0.07987512648105621,
-0.5906467437744141,
0.08669096231460571,
0.10324586182832718,
0.4930326044559479,
-0.19018615782260895,
-0.5197333097457886,
1.0285255908966064,
-0.36521804332733154,
0.5412408709526062... |
func ObserveSchedulerConfig(genericListers configobserver.Listers, recorder events.Recorder, existingConfig map[string]interface{}) (map[string]interface{}, []error) {
listers := genericListers.(configobservation.Listers)
errs := []error{}
prevObservedConfig := map[string]interface{}{}
sourceTargetLocation := reso... | [
-0.2871972322463989,
-1.0802003145217896,
0.6112976670265198,
0.0008276584558188915,
-0.31650763750076294,
-0.3272285759449005,
-0.030087776482105255,
0.7514052987098694,
0.1894940882921219,
1.255274772644043,
-0.42397528886795044,
0.5123775005340576,
0.5452967286109924,
1.0752899646759033... |
func newNodeRegistry(log zerolog.Logger) *nodeRegistry {
return &nodeRegistry{
log: log,
nodes: make(map[string]*nodeEntry),
}
} | [
-0.7416573166847229,
0.4133022725582123,
-0.1559295952320099,
-0.9971902370452881,
0.04818865656852722,
-0.6968265175819397,
-0.04448655992746353,
-0.07865806668996811,
-0.1314248889684677,
-0.31470394134521484,
-0.914325475692749,
1.3976867198944092,
0.033375874161720276,
0.70788168907165... |
func (r *nodeRegistry) RegisterNode(ctx context.Context, req *RegisterNodeRequest) (*empty.Empty, error) {
r.mutex.Lock()
defer r.mutex.Unlock()
nodeName := req.GetName()
nodeAddress := req.GetNodeAddress()
log := r.log.With().
Str("node", nodeName).
Str("address", nodeAddress).
Logger()
if e, found := r.... | [
-0.8785345554351807,
0.5607854127883911,
0.6530454754829407,
-0.783193826675415,
1.188840627670288,
-0.1465640515089035,
-0.3411547541618347,
0.22884708642959595,
0.5255974531173706,
0.5722240209579468,
0.13997051119804382,
1.344936728477478,
-0.6111779808998108,
0.5618097186088562,
0.16... |
func (r *nodeRegistry) GetNodeClient(ctx context.Context, nodeName string) (NodeClient, error) {
r.mutex.Lock()
defer r.mutex.Unlock()
e, found := r.nodes[nodeName]
if !found {
return nil, nil
}
// Create client if needed
if e.Client == nil {
// Create a connection
conn, err := grpc.Dial(e.Address, grpc.... | [
-0.632161021232605,
0.6619184017181396,
0.7351415753364563,
-0.8098520636558533,
0.9756125807762146,
-0.6273249983787537,
0.5386942028999329,
-0.8460520505905151,
0.005007307510823011,
0.33229386806488037,
-0.167410746216774,
1.1713765859603882,
-0.8482328057289124,
-0.6218922734260559,
... |
func (u UpdateWorkflowAttributesInput) Map() map[string]interface{} {
m := make(map[string]interface{})
if u.LastUpdated != nil {
m["last_updated"] = time.Time(*u.LastUpdated).Format(time.RFC3339Nano)
}
if u.Status != nil {
m["status"] = string(*u.Status)
}
if u.StatusReason != nil {
m["status_reason"] = *u... | [
-1.5353022813796997,
-0.9349896907806396,
0.4905558228492737,
-0.6036992073059082,
-0.6175051331520081,
0.47108450531959534,
-0.03434547409415245,
0.47317785024642944,
0.5476842522621155,
0.7744612097740173,
0.10315067321062088,
-0.18244072794914246,
0.5061807036399841,
-0.2485039532184600... |
func (u UpdateWorkflowAttributesInput) ZeroValue() bool {
if u.LastUpdated != nil {
return false
}
if u.Status != nil {
return false
}
if u.StatusReason != nil {
return false
}
if u.StoppedAt != nil {
return false
}
if u.ResolvedByUser != nil {
return false
}
if u.Output != nil {
return false
}
... | [
-0.545955240726471,
-0.6627839803695679,
0.5528004169464111,
-0.021746652200818062,
0.2954109311103821,
0.17990906536579132,
0.1936326026916504,
0.630083441734314,
-0.1622462421655655,
0.17256030440330505,
0.4061584174633026,
-0.028535164892673492,
-1.4007360935211182,
0.4738509953022003,
... |
func TerminalState(state models.WorkflowStatus) bool {
for _, s := range TerminalStates {
if state == s {
return true
}
}
return false
} | [
-0.693950355052948,
-0.6086573600769043,
0.326339989900589,
-0.3317883610725403,
-0.5275832414627075,
0.19771672785282135,
-0.7487506866455078,
0.6060574650764465,
0.780935525894165,
0.27122557163238525,
-0.19027189910411835,
-0.8261120915412903,
-0.17656417191028595,
-0.2429347038269043,
... |
func NewTrmConfig() *TrmConfig {
tc := TrmConfig{}
tc.NoseRadii = make([]float64, 6) // ToDo: don't hard code
tc.RadiusCoefs = make([]float64, 8) // ToDo: don't hard code
return &tc
} | [
0.8192190527915955,
0.1517484486103058,
0.1866704225540161,
-0.670048177242279,
-0.2324233055114746,
-0.39767852425575256,
-0.1548522561788559,
-0.1593208760023117,
-0.1402917504310608,
0.12803345918655396,
-1.1300557851791382,
0.31571346521377563,
-0.6219599843025208,
0.945351779460907,
... |
func (trm *TrmConfig) Load(pathTrm, pathVoice string) {
fmt.Println("trm config load")
trm.OpenJSON(pathTrm)
trm.OpenJSON(pathVoice)
} | [
-0.31894609332084656,
-0.8924683332443237,
0.23520131409168243,
-1.4875694513320923,
-0.32990503311157227,
0.0014889220474287868,
-0.6642598509788513,
0.2674395740032196,
-1.4360129833221436,
1.193487286567688,
-0.12452225387096405,
-0.16875772178173065,
-0.20790013670921326,
-0.7245767712... |
func (trm *TrmConfig) OpenJSON(fn string) error {
b, err := ioutil.ReadFile(string(fn))
if err != nil {
return err
}
rval := json.Unmarshal(b, trm)
return rval
} | [
-1.3312550783157349,
-0.3878856897354126,
0.4101536273956299,
-1.5132521390914917,
-1.0681804418563843,
-0.42158395051956177,
0.4974832832813263,
0.664471447467804,
-0.7446080446243286,
0.47245174646377563,
-0.4399396777153015,
-0.07163120061159134,
-0.054314035922288895,
-0.55772197246551... |
func (o EnforcerReportsList) Identity() elemental.Identity {
return EnforcerReportIdentity
} | [
0.1830187439918518,
-0.14711861312389374,
0.18490956723690033,
0.3148897588253021,
1.8689630031585693,
1.002133846282959,
0.6951481103897095,
0.3427387475967407,
1.4371064901351929,
-0.5973080992698669,
-0.8260883092880249,
-1.3876250982284546,
-1.6937131881713867,
0.44967150688171387,
0... |
func (o EnforcerReportsList) Copy() elemental.Identifiables {
copy := append(EnforcerReportsList{}, o...)
return ©
} | [
-0.3355141580104828,
-0.04446916654706001,
0.3832724094390869,
0.2407807856798172,
0.3389417231082916,
1.6382167339324951,
0.20118236541748047,
-0.459402471780777,
0.6272193789482117,
0.4409959316253662,
-0.41089189052581787,
0.008461927995085716,
-1.1443166732788086,
-0.15955807268619537,... |
func (o EnforcerReportsList) Append(objects ...elemental.Identifiable) elemental.Identifiables {
out := append(EnforcerReportsList{}, o...)
for _, obj := range objects {
out = append(out, obj.(*EnforcerReport))
}
return out
} | [
-0.26765647530555725,
0.06836041063070297,
0.46010589599609375,
0.3538949489593506,
1.3468765020370483,
0.7627888917922974,
0.01408189907670021,
0.059959594160318375,
0.11620701104402542,
-0.0010882196947932243,
-0.5762061476707458,
-0.48588109016418457,
-0.9157228469848633,
0.431207776069... |
func (o EnforcerReportsList) List() elemental.IdentifiablesList {
out := make(elemental.IdentifiablesList, len(o))
for i := 0; i < len(o); i++ {
out[i] = o[i]
}
return out
} | [
0.3629254102706909,
-0.10432060807943344,
0.342013955116272,
0.07828818261623383,
1.6228132247924805,
0.6465426683425903,
0.05429329350590706,
0.42622482776641846,
0.3266107738018036,
0.2251133918762207,
-0.8447719812393188,
-0.3648298978805542,
-1.1080048084259033,
-0.12376837432384491,
... |
func (o EnforcerReportsList) DefaultOrder() []string {
return []string{}
} | [
0.48683783411979675,
0.24692045152187347,
0.3005402386188507,
0.26882824301719666,
1.8271981477737427,
0.4304439425468445,
-0.6606964468955994,
0.1361565887928009,
0.4213367700576782,
-0.9920815825462341,
-0.5525088310241699,
-1.2338651418685913,
-1.784428358078003,
1.3220309019088745,
-... |
func (o EnforcerReportsList) ToSparse(fields ...string) elemental.Identifiables {
out := make(SparseEnforcerReportsList, len(o))
for i := 0; i < len(o); i++ {
out[i] = o[i].ToSparse(fields...).(*SparseEnforcerReport)
}
return out
} | [
0.09784624725580215,
1.0521292686462402,
0.5418134331703186,
0.09696920216083527,
1.698406457901001,
0.3291890621185303,
-0.0571589320898056,
0.21055816113948822,
-0.08705801516771317,
0.789487898349762,
-0.6706646084785461,
-0.43062838912010193,
-1.6803840398788452,
-0.02056230790913105,
... |
func (o EnforcerReportsList) Version() int {
return 1
} | [
0.0938408225774765,
-0.4475035071372986,
0.2492518424987793,
0.030354317277669907,
1.233081579208374,
0.5663034915924072,
1.271959900856018,
0.9309012293815613,
0.31009483337402344,
-0.3250366747379303,
-1.376945972442627,
-1.0401806831359863,
-1.8527861833572388,
0.4931289553642273,
0.3... |
func NewEnforcerReport() *EnforcerReport {
return &EnforcerReport{
ModelVersion: 1,
}
} | [
0.2696564197540283,
-0.024408165365457535,
-0.06936169415712357,
-0.608890175819397,
0.4626798927783966,
-1.1993598937988281,
0.12835684418678284,
-0.03275265544652939,
-0.304165780544281,
-0.6454253196716309,
-0.9442898631095886,
-0.8682228326797485,
-1.7709832191467285,
0.421660751104354... |
func (o *EnforcerReport) Identity() elemental.Identity {
return EnforcerReportIdentity
} | [
0.6137250661849976,
-0.3195599615573883,
0.24292993545532227,
0.22644273936748505,
1.5459035634994507,
0.862372100353241,
1.0240542888641357,
0.009242361411452293,
1.3209471702575684,
-0.8658892512321472,
-0.15933296084403992,
-1.0437803268432617,
-1.2963411808013916,
-0.14656734466552734,... |
func (o *EnforcerReport) Identifier() string {
return ""
} | [
0.9673434495925903,
0.2619808614253998,
0.198713481426239,
-0.8223465085029602,
0.4728890061378479,
0.7221519351005554,
1.393294334411621,
0.9690255522727966,
0.8159133791923523,
-1.1064660549163818,
-0.25996044278144836,
-0.9399978518486023,
-1.0913920402526855,
-0.1946815550327301,
0.9... |
func (o *EnforcerReport) SetIdentifier(id string) {
} | [
-0.27458587288856506,
-0.336394727230072,
0.21914568543434143,
-0.369211345911026,
0.5172763466835022,
0.8193436861038208,
1.1503431797027588,
0.9351679086685181,
0.6794886589050293,
-0.4622829556465149,
-0.9960777163505554,
-0.6724972724914551,
-1.2942980527877808,
0.46223488450050354,
... |
func (o *EnforcerReport) GetBSON() (interface{}, error) {
if o == nil {
return nil, nil
}
s := &mongoAttributesEnforcerReport{}
return s, nil
} | [
0.15297913551330566,
1.290747880935669,
0.5548354983329773,
0.8616026043891907,
1.2765154838562012,
-0.29473641514778137,
0.8084973692893982,
-0.11059660464525223,
1.1484230756759644,
-1.156991720199585,
-0.20161740481853485,
0.4841882288455963,
-1.6584973335266113,
0.5689170360565186,
1... |
func (o *EnforcerReport) SetBSON(raw bson.Raw) error {
if o == nil {
return nil
}
s := &mongoAttributesEnforcerReport{}
if err := raw.Unmarshal(s); err != nil {
return err
}
return nil
} | [
-0.3851856291294098,
1.1218652725219727,
0.44844263792037964,
0.3453133702278137,
0.3088616132736206,
-0.1993124634027481,
0.2726036310195923,
0.670809805393219,
0.9272825717926025,
-0.7687669396400452,
-0.38193580508232117,
0.7178112864494324,
-1.0245448350906372,
0.48166075348854065,
1... |
func (o *EnforcerReport) Version() int {
return 1
} | [
0.3033573031425476,
-0.42424875497817993,
0.3713952898979187,
0.13146959245204926,
1.1283012628555298,
0.14061400294303894,
1.6512260437011719,
0.8684556484222412,
-0.008786264806985855,
-0.527764618396759,
-0.827506959438324,
-0.8587391972541809,
-1.6914318799972534,
0.242436945438385,
... |
func (o *EnforcerReport) BleveType() string {
return "enforcerreport"
} | [
1.3438658714294434,
0.663006603717804,
0.31868118047714233,
0.029892873018980026,
1.5839028358459473,
0.004515369888395071,
0.5094131827354431,
0.4319625794887543,
-0.39795494079589844,
0.5215141773223877,
-0.4410550594329834,
-0.11615993082523346,
-1.7832317352294922,
0.28596246242523193,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.