text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func Vec3Sub(a, b Vec3) (v Vec3) {
v[0] = a[0] - b[0]
v[1] = a[1] - b[1]
v[2] = a[2] - b[2]
return
} | [
1.3792804479599,
0.04378700256347656,
0.7092157006263733,
-0.4508955478668213,
-0.11764773726463318,
0.7472438216209412,
-0.5166319012641907,
0.11293207854032516,
0.4684329926967621,
0.4881880283355713,
-0.3020942807197571,
0.7872602343559265,
0.27387577295303345,
-1.8592529296875,
0.119... |
func Vec3Lerp(a, b Vec3, t float32) (v Vec3) {
v[0] = (1.0-t)*a[0] + t*b[0]
v[1] = (1.0-t)*a[1] + t*b[1]
v[2] = (1.0-t)*a[2] + t*b[2]
return
} | [
1.9788756370544434,
-0.8795278072357178,
0.8894932270050049,
-1.1818804740905762,
0.6769862771034241,
0.7410404682159424,
-1.2810475826263428,
-0.0778203159570694,
0.563865065574646,
1.366255283355713,
-0.2712978720664978,
-0.527745246887207,
-0.14706461131572723,
-1.3318569660186768,
-0... |
func Vec3Scale(s float32, a Vec3) (v Vec3) {
v[0] = a[0] * s
v[1] = a[1] * s
v[2] = a[2] * s
return
} | [
1.3596121072769165,
-0.3116726577281952,
0.43227988481521606,
-0.8690216541290283,
-0.07744394242763519,
-0.13359542191028595,
-1.0807702541351318,
-0.10724075883626938,
0.5279410481452942,
1.281576156616211,
-0.17352324724197388,
-0.048003535717725754,
0.2735542953014374,
-0.9450273513793... |
func Vec3Cross(a, b Vec3) (v Vec3) {
v[0] = a[1]*b[2] - a[2]*b[1]
v[1] = a[2]*b[0] - a[0]*b[2]
v[2] = a[0]*b[1] - a[1]*b[0]
return
} | [
1.4409700632095337,
-0.1936781108379364,
0.8498281836509705,
0.1919461339712143,
0.3008410632610321,
0.11541987210512161,
-0.4566480815410614,
-0.36631518602371216,
0.7890502214431763,
1.3024427890777588,
-0.02181873843073845,
0.7546969056129456,
-0.14144748449325562,
-1.1293965578079224,
... |
func Vec3Dot(a, b Vec3) float32 {
return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]
} | [
1.3539834022521973,
0.11744324862957001,
0.6374467611312866,
-0.9000633955001831,
0.7409414052963257,
0.4103376269340515,
-0.4204481840133667,
-0.9795520305633545,
0.11914779990911484,
0.6904616355895996,
0.3095247447490692,
0.6004773378372192,
0.15237760543823242,
-1.5795854330062866,
-... |
func Vec3DotClamp(a, b Vec3) float32 {
return Max(0.0, a[0]*b[0]+a[1]*b[1]+a[2]*b[2])
} | [
0.8417730331420898,
-0.2918120324611664,
0.6714974045753479,
-0.13786569237709045,
0.28309357166290283,
0.4928092360496521,
-0.7124770283699036,
-0.8758558630943298,
0.40912386775016785,
0.886407732963562,
0.43948686122894287,
0.5377642512321472,
-0.40793055295944214,
-0.9689244031906128,
... |
func Vec3DotAbs(a, b Vec3) float32 {
return Abs(a[0]*b[0] + a[1]*b[1] + a[2]*b[2])
} | [
0.7411004900932312,
-0.2520957887172699,
0.7701353430747986,
-0.8469350337982178,
0.2354961633682251,
0.671322762966156,
-0.8518738746643066,
-0.8341653347015381,
0.2635100483894348,
0.8786194920539856,
0.05982433259487152,
0.8712111711502075,
0.2536521852016449,
-0.8022759556770325,
-0.... |
func Vec3Normalize(a Vec3) (v Vec3) | [
1.341959834098816,
0.0728892907500267,
0.43334054946899414,
-0.22453923523426056,
-0.37175270915031433,
-0.0028239369858056307,
0.08306501060724258,
0.6645249724388123,
1.308744192123413,
0.9141359329223633,
-0.7114340662956238,
0.17182986438274384,
-0.46803781390190125,
-0.719254434108734... |
func Vec3Length2(a Vec3) float32 {
return a[0]*a[0] + a[1]*a[1] + a[2]*a[2]
} | [
1.3658095598220825,
-0.5844929814338684,
0.41779229044914246,
-0.6884117722511292,
0.2790755033493042,
0.45423588156700134,
-0.15527738630771637,
-0.28410688042640686,
0.4989890456199646,
0.6583364605903625,
-0.7160954475402832,
0.1477261483669281,
0.21001112461090088,
-0.10392079502344131... |
func Vec3Length(a Vec3) float32 | [
1.700465440750122,
0.31255006790161133,
0.18222884833812714,
-0.5463807582855225,
0.4442157745361328,
1.3423198461532593,
0.4463668465614319,
0.194655179977417,
1.223008632659912,
1.0652859210968018,
-0.6936475038528442,
-0.6181350946426392,
0.2570285201072693,
-0.41474825143814087,
-0.6... |
func Vec3Neg(a Vec3) (v Vec3) {
v[0] = -a[0]
v[1] = -a[1]
v[2] = -a[2]
return
} | [
-0.14176297187805176,
-0.0008473052876070142,
0.5879741907119751,
-0.7377394437789917,
0.6418614387512207,
0.886475682258606,
-0.5611303448677063,
0.26675304770469666,
0.5566141605377197,
1.272473931312561,
-0.49446481466293335,
0.2674669027328491,
0.18062558770179749,
-0.41465654969215393... |
func Vec3BasisProject(U, V, W, S Vec3) (o Vec3) {
o[0] = Vec3Dot(U, S)
o[1] = Vec3Dot(V, S)
o[2] = Vec3Dot(W, S)
return
} | [
0.4793964922428131,
0.24201923608779907,
0.47662830352783203,
0.22971177101135254,
0.3600386381149292,
1.132606863975525,
-0.5208020210266113,
-0.2465481460094452,
0.41704061627388,
0.6085846424102783,
0.040851663798093796,
0.2921476364135742,
-0.4187030494213104,
-1.7361469268798828,
-0... |
func Vec3BasisExpand(U, V, W, S Vec3) (o Vec3) {
o[0] = U[0]*S[0] + V[0]*S[1] + W[0]*S[2]
o[1] = U[1]*S[0] + V[1]*S[1] + W[1]*S[2]
o[2] = U[2]*S[0] + V[2]*S[1] + W[2]*S[2]
return
} | [
0.953290581703186,
0.207259401679039,
1.0245678424835205,
-0.025786783546209335,
-0.2379889339208603,
0.24974720180034637,
0.2658890187740326,
0.14216557145118713,
1.3415414094924927,
0.1447070688009262,
-0.22058483958244324,
0.37329456210136414,
-0.5526067018508911,
-1.374092936515808,
... |
func Vec3Abs(V Vec3) (o Vec3) {
o[0] = Abs(V[0])
o[1] = Abs(V[1])
o[2] = Abs(V[2])
return
} | [
-0.22898200154304504,
-0.5729593634605408,
0.7104774713516235,
-0.4962066113948822,
-0.3637952506542206,
0.8201861381530762,
-0.5746026039123535,
-0.2746368646621704,
0.5871226191520691,
1.2234236001968384,
-0.1158294603228569,
0.43150830268859863,
0.7298290729522705,
-0.9817522764205933,
... |
func (v Vec3) MaxDim() int {
if v[0] < v[1] {
if v[1] < v[2] {
return 2
}
return 1
}
if v[0] < v[2] {
return 2
}
return 0
} | [
0.3578696846961975,
-0.10265880823135376,
0.88409423828125,
1.4084715843200684,
0.4380970895290375,
0.8764139413833618,
0.3113967180252075,
-0.13646212220191956,
0.26306480169296265,
-0.49864357709884644,
-0.027271423488855362,
0.1868627667427063,
-0.6660731434822083,
0.6172851920127869,
... |
func LoadFileConfig(fileName string) (Config, error) {
file, err := os.Open(fileName)
if err != nil {
return Config{}, err
}
defer file.Close()
return loadConfig(file)
} | [
0.13754819333553314,
0.30788490176200867,
0.4798777997493744,
0.26949039101600647,
-1.2264875173568726,
-0.2950034737586975,
-0.19528380036354065,
0.7192572355270386,
-0.8507677316665649,
0.5820446014404297,
-0.7301033139228821,
-0.6508349776268005,
-0.4853014051914215,
1.0950074195861816,... |
func SetPath(p string) {
currentPath = ""
beginPath = p
dirsAmount = 0
} | [
0.5754095911979675,
-0.22860251367092133,
0.10780070722103119,
0.41041094064712524,
-0.16670095920562744,
0.9202319979667664,
1.8169670104980469,
0.4823873043060303,
0.2453761100769043,
-0.18102788925170898,
-0.1457296907901764,
-0.04043447598814964,
-1.3707622289657593,
0.6637870073318481... |
func pathBack() {
deleteIndexes := []int{}
for i, v := range visited {
if strings.HasPrefix(v, currentPath) {
deleteIndexes = append(deleteIndexes, i)
}
}
for i := len(deleteIndexes) - 1; i >= 0; i-- {
visited = visited[:deleteIndexes[i]+copy(visited[deleteIndexes[i]:], visited[deleteIndexes[i]+1:])]
}
... | [
-0.23226353526115417,
-0.3510858118534088,
1.1284737586975098,
-0.18961460888385773,
-0.06893370300531387,
0.03221123665571213,
2.0748465061187744,
0.7882465124130249,
0.35354235768318176,
1.0888227224349976,
0.9188128709793091,
0.158126562833786,
-1.2621952295303345,
-0.9147173762321472,
... |
func GetStat() (uint64, uint64) {
return filesAmount, dirsAmount
} | [
0.25596943497657776,
-0.28923845291137695,
0.4777940511703491,
0.14867131412029266,
-0.10460922867059708,
-0.7140969634056091,
1.0338118076324463,
-0.06472852826118469,
0.43190959095954895,
-0.6800744533538818,
-0.241056889295578,
0.5083715319633484,
0.8946752548217773,
1.263871431350708,
... |
func inVisited(path string) bool {
for _, j := range visited {
if path == j {
return true
}
}
return false
} | [
-0.7428498864173889,
0.15072771906852722,
0.7143087387084961,
-0.15545356273651123,
-0.4302712380886078,
-0.07448098063468933,
0.6177186369895935,
0.3012177050113678,
-0.5905853509902954,
0.05673174560070038,
-0.855880856513977,
-0.18575245141983032,
-0.5759606957435608,
-0.283838719129562... |
func Next() (string, bool, error) {
files, err := ioutil.ReadDir(beginPath + "/" + currentPath)
if err != nil {
return "", false, err
}
visitedCount := 0
for _, f := range files {
if !inVisited(currentPath + "/" + f.Name()) {
visited = append(visited, currentPath+"/"+f.Name())
if f.IsDir() {
dirsAmo... | [
-0.5425475239753723,
0.27921757102012634,
0.9954451322555542,
0.4483824670314789,
-0.9326694011688232,
-0.13032594323158264,
1.3641277551651,
0.2726554572582245,
0.2199726104736328,
0.46986153721809387,
0.6060090661048889,
-0.00752918841317296,
-0.860020101070404,
0.4523128569126129,
-0.... |
func (m *GoogleComputeInstanceConfiguration) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateBootDisk(formats); err != nil {
res = append(res, err)
}
if err := m.validateNetworkInterface(formats); err != nil {
res = append(res, err)
}
if err := m.validateServiceAccount(formats... | [
-0.4597724676132202,
0.6012580990791321,
0.3579353392124176,
-0.3696900010108948,
-0.12754902243614197,
0.23391927778720856,
0.8605856895446777,
0.024792365729808807,
-0.992303192615509,
0.6099900603294373,
-0.3827429413795471,
0.2561109960079193,
-1.1046541929244995,
1.3683274984359741,
... |
func checkPrereqs() error {
if err := checkServiceAccount(); err != nil {
return err
}
if err := checkClusterRole(); err != nil {
return err
}
if err := checkClusterRoleBinding(); err != nil {
logrus.Errorf("Error while looking/creating cluster role binding: %v", err)
}
if err := checkConfigMap(); err != n... | [
-0.5836836695671082,
0.27423933148384094,
0.6183192133903503,
0.611305296421051,
0.29727903008461,
0.46901461482048035,
0.6770767569541931,
-0.6601892113685608,
-0.2781865894794464,
-0.43825215101242065,
0.35728177428245544,
0.44217735528945923,
-0.5672796368598938,
1.4572736024856567,
1... |
func checkServiceAccount() error {
// As of now, I am listing before creating, if the size of this list is huge, this may cause problems.
saList := getServiceAccount()
listOptions := &metav1.ListOptions{}
err := sdk.List("kube-system", saList, sdk.WithListOptions(listOptions))
if err != nil {
logrus.Errorf("Erro... | [
0.18885977566242218,
0.0022321059368550777,
0.7305596470832825,
0.8562649488449097,
0.35219335556030273,
-0.21165381371974945,
0.40841731429100037,
-0.12390477955341339,
0.5736793279647827,
0.4824839234352112,
0.2154030054807663,
0.35663679242134094,
-0.30826693773269653,
1.144405841827392... |
func checkClusterRoleBinding() error {
clusterRoleBindingList := getClusterRoleBinding()
listOptions := &metav1.ListOptions{}
err := sdk.List("kube-system", clusterRoleBindingList, sdk.WithListOptions(listOptions))
if err != nil {
logrus.Errorf("Error while listing cluster role binding %v", err)
return err
}
... | [
-0.15537911653518677,
0.33218884468078613,
0.7240262031555176,
0.6318179368972778,
0.2969706654548645,
0.0035352795384824276,
0.33034515380859375,
0.042779192328453064,
0.4206530451774597,
0.9021384119987488,
-0.1480349600315094,
0.2621323764324188,
-0.9094611406326294,
0.858835756778717,
... |
func createConfigMap() *v1.ConfigMap {
return &v1.ConfigMap{
TypeMeta: metav1.TypeMeta{
Kind: "ConfigMap",
APIVersion: "v1",
},
ObjectMeta: metav1.ObjectMeta{
Name: "descheduler-policy-configmap",
Namespace: "kube-system",
},
// strategies:\n \"RemoveDuplicates\":\n enabled: true
... | [
-0.5070884227752686,
-0.7886373400688171,
0.7115411162376404,
0.12901614606380463,
0.8020597100257874,
0.1621597558259964,
-0.931804895401001,
0.5526110529899597,
0.47179099917411804,
0.9618696570396423,
-0.5618796944618225,
-0.3068188726902008,
-0.15676456689834595,
0.587465763092041,
0... |
func getPodList() *v1.PodList {
return &v1.PodList{
TypeMeta: metav1.TypeMeta{
Kind: "Pod",
APIVersion: "v1",
},
}
} | [
-0.5991644263267517,
0.08936911821365356,
0.5171186327934265,
0.333975613117218,
0.6384102702140808,
-0.17827291786670685,
-0.9780194759368896,
-0.06949521601200104,
0.4690595865249634,
0.9615464210510254,
-0.7719241380691528,
0.8937554359436035,
0.3246970772743225,
-0.2917884588241577,
... |
func NewFlow(requests ...*Request) Flow {
flow := Flow{
requests: requests,
requestQueue: make(chan *Request),
addRequest: make(chan *Request),
pollingInterval: minimumPollingInterval(requests),
}
flow.PollRequests()
return flow
} | [
-0.09320976585149765,
-0.19466039538383484,
0.20286791026592255,
0.9692977070808411,
-0.29676294326782227,
0.7466952204704285,
-0.7074220776557922,
-0.7484967112541199,
0.8178314566612244,
-1.1609827280044556,
0.5153740048408508,
-0.2577116787433624,
0.028314748778939247,
0.308334559202194... |
func (f *Flow) PollRequests() {
for _, r := range f.requests {
go func(r *Request) {
r.Poll(f.requestQueue)
}(r)
}
} | [
-0.9595298767089844,
-0.5060781240463257,
0.38589921593666077,
0.37975767254829407,
0.39674365520477295,
0.6801180839538574,
-0.6173884272575378,
-0.37327840924263,
-0.257980078458786,
-0.01961207576096058,
1.0797168016433716,
-0.21776336431503296,
-0.6106186509132385,
1.078694462776184,
... |
func (f *Flow) Go() {
go func() {
for {
select {
case request := <-f.addRequest:
f.requests = append(f.requests, request)
f.pollingInterval = minimumPollingInterval(f.requests)
request.Poll(f.requestQueue)
case request := <-f.requestQueue:
fmt.Println(time.Now().Format(time.StampMilli), re... | [
0.2125132828950882,
0.49655216932296753,
0.5829477906227112,
-0.1003437340259552,
0.5051376819610596,
0.40884625911712646,
-0.15892186760902405,
-0.24185951054096222,
-0.5536776185035706,
0.07071654498577118,
0.10523410141468048,
0.4920192360877991,
-0.07310482114553452,
0.5423547625541687... |
func (f *Flow) AddRequest(r *Request) {
go func() {
f.addRequest <- r
}()
} | [
-0.7319274544715881,
0.43585509061813354,
0.3426550626754761,
1.1372863054275513,
0.5380953550338745,
0.48549842834472656,
-0.14719724655151367,
-0.5642579197883606,
0.31712761521339417,
-0.9547945857048035,
0.5013349056243896,
0.3780907690525055,
-0.3124151825904846,
0.4667999744415283,
... |
func (_m *MockStorage) Add(user string, timeStamp int64, expireTime int64) error {
ret := _m.Called(user, timeStamp, expireTime)
var r0 error
if rf, ok := ret.Get(0).(func(string, int64, int64) error); ok {
r0 = rf(user, timeStamp, expireTime)
} else {
r0 = ret.Error(0)
}
return r0
} | [
-0.8044306635856628,
0.10902789980173111,
0.573836088180542,
0.6663621068000793,
0.571679413318634,
0.08366571366786957,
0.5652267932891846,
0.02178080752491951,
0.5234151482582092,
0.11913108825683594,
0.1066235676407814,
-0.20395472645759583,
0.08857011049985886,
0.129163458943367,
-0.... |
func (_m *MockStorage) GetLastRequestTimeInWindow(user string, timeStamp int64) (int64, error) {
ret := _m.Called(user, timeStamp)
var r0 int64
if rf, ok := ret.Get(0).(func(string, int64) int64); ok {
r0 = rf(user, timeStamp)
} else {
r0 = ret.Get(0).(int64)
}
var r1 error
if rf, ok := ret.Get(1).(func(st... | [
-0.4528060257434845,
-0.1869630664587021,
0.8411902785301208,
0.587760329246521,
-0.5085427165031433,
-0.29600784182548523,
0.6437727808952332,
-0.7626581192016602,
0.3817666471004486,
-0.570904552936554,
0.08427676558494568,
-0.2235991209745407,
-0.8176522254943848,
-0.1848738044500351,
... |
func (_m *MockStorage) GetRequestCountInWindow(user string, timeStamp int64) (int64, error) {
ret := _m.Called(user, timeStamp)
var r0 int64
if rf, ok := ret.Get(0).(func(string, int64) int64); ok {
r0 = rf(user, timeStamp)
} else {
r0 = ret.Get(0).(int64)
}
var r1 error
if rf, ok := ret.Get(1).(func(strin... | [
-0.3829669654369354,
-0.1269315481185913,
0.9183958172798157,
1.0362932682037354,
-0.735779345035553,
-0.3940904140472412,
1.0719926357269287,
-0.42283767461776733,
0.059402745217084885,
-0.9047317504882812,
0.07836618274450302,
0.23229548335075378,
-0.33643585443496704,
0.2597525417804718... |
func FuncOf(fn func(this Value, args []Value) interface{}) Func {
funcsMu.Lock()
id := nextFuncID
nextFuncID++
funcs[id] = fn
funcsMu.Unlock()
return Func{
id: id,
Value: jsGo.Call("_makeFuncWrapper", id),
}
} | [
-0.3955813944339752,
-0.13902385532855988,
0.1905837059020996,
-0.23654797673225403,
0.18285790085792542,
-0.9488855004310608,
0.7228521704673767,
0.0349976047873497,
-0.12590183317661285,
-0.31838497519493103,
-0.5699106454849243,
0.05002911761403084,
0.71234130859375,
-0.0630723237991333... |
func (c Func) Release() {
funcsMu.Lock()
delete(funcs, c.id)
funcsMu.Unlock()
} | [
-0.4280606806278229,
0.24563561379909515,
0.2071804255247116,
-0.13296760618686676,
0.33165863156318665,
-1.1816049814224243,
0.5785543918609619,
-0.18647237122058868,
0.36628809571266174,
-0.3744613528251648,
-0.19593937695026398,
0.9307518005371094,
-0.6198103427886963,
0.044394992291927... |
func setEventHandler(fn func()) | [
0.6246923208236694,
-0.052583836019039154,
0.34786051511764526,
0.5457651615142822,
0.36028754711151123,
0.33682316541671753,
1.0782829523086548,
0.8101083636283875,
0.2605404257774353,
-0.8377048969268799,
-0.9383754134178162,
-0.40164440870285034,
0.7213070392608643,
0.08639368414878845,... |
func ConvertSeconds(s string) float64 {
num, err := strconv.ParseFloat(s, 64)
if err != nil {
log.Fatal(err)
}
return num
} | [
0.07200303673744202,
-0.09971928596496582,
0.5672890543937683,
0.5053614377975464,
-0.37708181142807007,
-0.8212258219718933,
-0.026782844215631485,
-0.3993073105812073,
-0.1866079866886139,
0.1698615849018097,
-0.11401867121458054,
0.08052528649568558,
0.023124385625123978,
0.411573350429... |
func GetUptime() float64 {
out, err := exec.Command("sysctl", "-n", "kern.boottime").Output()
// { sec = 1413585004, usec = 0 } Fri Oct 17 15:30:04 2014
if err != nil {
log.Fatal(err)
}
pieces := strings.Fields(string(out))
return ConvertSeconds(strings.TrimRight(pieces[3], ","))
} | [
0.056458186358213425,
0.40852415561676025,
0.9114236831665039,
1.2964363098144531,
0.12408395111560822,
-1.011445164680481,
-0.277858704328537,
-0.540814995765686,
-0.5521549582481384,
0.682551920413971,
-0.6238034963607788,
-0.29029327630996704,
-0.7792885899543762,
1.2104214429855347,
... |
func CacheControl(expiration time.Duration, version string) func(http.Handler) http.Handler {
etag := func(r *http.Request, version string) string {
s := fmt.Sprintf("%s:%s", version, r.URL.String())
return fmt.Sprintf("%x", sha1.Sum([]byte(s))) //nolint
}
return func(h http.Handler) http.Handler {
fn := fun... | [
-0.27175813913345337,
0.08944451063871384,
0.6991438269615173,
-0.34863346815109253,
-0.5526822209358215,
0.43952035903930664,
-0.6553313732147217,
0.02660846710205078,
0.10159070044755936,
0.5261654853820801,
-0.15517480671405792,
-0.6507779955863953,
0.9492109417915344,
-0.06870045512914... |
func CacheControlDynamic(expiration time.Duration, versionFn func(r *http.Request) string) func(http.Handler) http.Handler {
etag := func(r *http.Request, version string) string {
s := fmt.Sprintf("%s:%s", version, r.URL.String())
return fmt.Sprintf("%x", sha1.Sum([]byte(s))) //nolint
}
return func(h http.Hand... | [
-0.24581411480903625,
-0.08230502158403397,
0.7424314618110657,
-0.25438353419303894,
-0.3140724003314972,
-0.2872815430164337,
-0.7028056383132935,
-0.1871488392353058,
-0.5788391828536987,
0.13830724358558655,
-0.1663239449262619,
-0.6175292730331421,
1.178085207939148,
-0.27785772085189... |
func parseFileContent(s *setup, content []byte) error {
decoder := s.conf.FileDecoder
if decoder == nil {
// Look for the config file extension to determine the encoding.
switch path.Ext(s.configFilePath) {
case "json":
decoder = DecoderJSON
case "toml":
decoder = DecoderTOML
case "yaml", "yml":
de... | [
0.0495263934135437,
-0.011314784176647663,
0.2317243218421936,
-0.43166983127593994,
-0.49885833263397217,
-0.8302664756774902,
0.10766531527042389,
0.29727765917778015,
-0.8041097521781921,
0.4510176479816437,
0.1060953363776207,
-0.9360692501068115,
0.10648724436759949,
0.271643996238708... |
func parseFile(s *setup) error {
if _, err := os.Stat(s.configFilePath); os.IsNotExist(err) {
// Config file is not present. We ignore this when we are using
// the default config file, but we escalate if the user provided
// the config file explicitely.
if s.customConfigFile {
return fmt.Errorf(
"conf... | [
0.09103531390428543,
0.08647104352712631,
0.4812571406364441,
0.4105311334133148,
-0.1543295979499817,
-0.4968527555465698,
0.5296328663825989,
0.26283374428749084,
-0.6537472009658813,
0.487289160490036,
0.5722801089286804,
-0.5433793067932129,
0.42173755168914795,
0.13318170607089996,
... |
func newid() string {
return make_key(6)
} | [
0.683434784412384,
-0.46066218614578247,
0.1993400901556015,
0.12444442510604858,
-0.26231226325035095,
0.5637776255607605,
-0.0052907466888427734,
-0.5754263401031494,
0.6599488258361816,
0.20763924717903137,
-0.37130007147789,
-0.7203115224838257,
-0.38228851556777954,
-0.576093554496765... |
func registerScionPorts() {
// Bind ports to SCION layer
layers.RegisterUDPPortLayerType(layers.UDPPort(30041), tpkt.LayerTypeScion)
for i := 30000; i < 30010; i += 1 {
layers.RegisterUDPPortLayerType(layers.UDPPort(i), tpkt.LayerTypeScion)
}
for i := 50000; i < 50010; i += 1 {
layers.RegisterUDPPortLayerType(... | [
0.21389973163604736,
1.1222758293151855,
0.672134518623352,
-0.15139959752559662,
1.4838744401931763,
0.21114690601825714,
0.4617745280265808,
-0.48364928364753723,
0.5981271266937256,
0.18142905831336975,
-1.2143744230270386,
0.08125302195549011,
-0.7620919346809387,
-0.20428568124771118,... |
func doTest(t *BRTest, cases []reflect.SelectCase) error {
devInfo, ok := devByName[t.In.Dev]
if !ok {
return fmt.Errorf("No device information for: %s\n", t.In.Dev)
}
raw, err := t.In.Pack(devInfo.mac)
if err != nil {
return err
}
err = devInfo.handle.WritePacketData(raw)
if err != nil {
return err
}
r... | [
-0.509430468082428,
0.49647220969200134,
0.7999173998832703,
0.4564781188964844,
0.6533664464950562,
0.3045133054256439,
0.37616991996765137,
-0.8883418440818787,
0.10965241491794586,
-0.3785456717014313,
-0.1048777848482132,
0.037237901240587234,
-0.4466763436794281,
0.07003619521856308,
... |
func checkRecvPkts(t *BRTest, cases []reflect.SelectCase) error {
timerIdx := len(devList)
timerCh := time.After(timeout)
// Add timeout channel as the last select case.
cases[timerIdx] = reflect.SelectCase{Dir: reflect.SelectRecv, Chan: reflect.ValueOf(timerCh)}
expPkts := append([]*tpkt.ExpPkt(nil), t.Out...)
v... | [
-0.3125242590904236,
0.5455048680305481,
0.8213149309158325,
-0.3060513436794281,
-0.493734747171402,
-0.3391418755054474,
0.1020837277173996,
-0.12177067995071411,
0.6376541256904602,
0.47615671157836914,
0.5810160040855408,
0.1704765409231186,
-0.7990121841430664,
0.3974778652191162,
-... |
func checkPkt(expPkts []*tpkt.ExpPkt, devIdx int, pkt gopacket.Packet) (int, error) {
var errStr []string
for i := range expPkts {
if devList[devIdx].contDev != expPkts[i].Dev {
continue
}
if err := expPkts[i].Match(pkt); err != nil {
errStr = append(errStr, fmt.Sprintf("[ERROR] %s\n", err))
continue
... | [
-0.8530754446983337,
0.4637010395526886,
0.7940476536750793,
-0.508192777633667,
-0.1617182046175003,
-0.18861694633960724,
0.499752938747406,
0.6060991883277893,
0.19819939136505127,
-0.23490013182163239,
0.2934879958629608,
-0.42988574504852295,
-0.5445137619972229,
0.4872320294380188,
... |
func (o *GetOrganizationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetOrganizationOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil... | [
-0.17607103288173676,
-0.9713468551635742,
0.7603554129600525,
0.6012715697288513,
0.18430815637111664,
-1.2037333250045776,
0.1210525780916214,
-0.2998647689819336,
0.6166377067565918,
0.14185409247875214,
0.6294604539871216,
-0.43162640929222107,
-0.8199061751365662,
-0.28340521454811096... |
func NewGetOrganizationOK() *GetOrganizationOK {
return &GetOrganizationOK{}
} | [
-0.23900987207889557,
0.013246990740299225,
0.1486632078886032,
1.5933719873428345,
-0.012132556177675724,
-0.37211936712265015,
1.2175817489624023,
0.41205888986587524,
-0.8016039729118347,
0.3318166434764862,
-0.40586426854133606,
-0.7662932872772217,
0.45745497941970825,
-0.135287791490... |
func NewGetOrganizationBadRequest() *GetOrganizationBadRequest {
return &GetOrganizationBadRequest{}
} | [
-0.7893677949905396,
-0.27721959352493286,
0.523520290851593,
1.3509104251861572,
0.3503809869289398,
-0.61021888256073,
-0.49643048644065857,
0.1914009004831314,
-0.8236001133918762,
-0.785164475440979,
0.07373738288879395,
0.47750601172447205,
0.11546726524829865,
0.5538097620010376,
-... |
func NewGetOrganizationNotFound() *GetOrganizationNotFound {
return &GetOrganizationNotFound{}
} | [
-0.2348206639289856,
-0.9109996557235718,
-0.15066580474376678,
0.8895031809806824,
0.6147037148475647,
0.30813857913017273,
0.6551272869110107,
0.144709974527359,
-0.11359752714633942,
-0.3212113678455353,
-0.37906068563461304,
0.40113377571105957,
0.07423479110002518,
-0.2801300287246704... |
func anagrams(s1 string, s2 string) bool {
r1 := []rune(s1)
r2 := []rune(s2)
sort.Sort(sortableRunes(r1))
sort.Sort(sortableRunes(r2))
if string(r1) == string(r2) {
return true
}
return false
} | [
0.14469389617443085,
-0.020822031423449516,
0.5838653445243835,
0.4093453288078308,
-1.3263404369354248,
-0.14545920491218567,
-0.5716941952705383,
-0.5074729323387146,
-0.8743232488632202,
0.7254334688186646,
-0.2800414264202118,
1.1215237379074097,
-0.9745917916297913,
-0.760182499885559... |
func New() *Provider {
return &Provider{
config: &oauth2.Config{
ClientID: os.Getenv("FACEBOOK_KEY"),
ClientSecret: os.Getenv("FACEBOOK_SECRET"),
Endpoint: facebook.Endpoint,
RedirectURL: "http://localhost:3000/auth/facebook/callback",
Scopes: []string{"email"},
},
IdentityURL: "htt... | [
-0.16529417037963867,
-0.035765066742897034,
0.17531469464302063,
0.5241023898124695,
-0.9342778921127319,
-0.1600031554698944,
-0.42930611968040466,
-0.17349880933761597,
0.10688286274671555,
0.2451142519712448,
-0.15943729877471924,
0.8089040517807007,
0.04735762998461723,
0.244468584656... |
func (p *Provider) BuildAuthURL(state string) string {
return p.config.AuthCodeURL(state, oauth2.AccessTypeOffline)
} | [
-1.3081152439117432,
-0.9626868367195129,
0.27742305397987366,
0.9597598314285278,
-0.2750234305858612,
0.6368148326873779,
0.05242118611931801,
0.9395707249641418,
0.545875072479248,
0.5300545692443848,
0.08282575756311417,
0.7982856035232544,
0.7051410675048828,
-0.24983714520931244,
0... |
func (p *Provider) GetCodeURL(r *http.Request) string {
return r.URL.Query().Get("code")
} | [
-0.8391143679618835,
0.6967291831970215,
0.6213074922561646,
0.7480496764183044,
0.8007145524024963,
0.2558441758155823,
-0.4814453721046448,
0.19475769996643066,
0.2746826410293579,
0.655393123626709,
0.7038333415985107,
0.3527885675430298,
-0.16557776927947998,
0.6326291561126709,
-0.6... |
func (p *Provider) GetToken(code string) (*oauth2.Token, error) {
tok, err := p.config.Exchange(oauth2.NoContext, code)
return tok, err
} | [
-1.3185566663742065,
1.1128990650177002,
0.32416823506355286,
0.17972438037395477,
0.09070131927728653,
-0.5937873721122742,
0.5818940997123718,
0.29604649543762207,
1.1788431406021118,
0.04586971551179886,
-0.33502840995788574,
1.4629677534103394,
0.20834000408649445,
0.0385235920548439,
... |
func (p *Provider) GetIdentity(tok *oauth2.Token) (*id.User, error) {
client := p.config.Client(oauth2.NoContext, tok)
resp, err := client.Get(p.IdentityURL)
if err != nil {
return nil, err
}
defer resp.Body.Close()
user := readBody(resp.Body)
return user, nil
} | [
-0.8957284688949585,
-0.28647005558013916,
0.4760328233242035,
0.7474135160446167,
0.9694449305534363,
0.094126857817173,
-0.14650800824165344,
-0.6256168484687805,
0.9542496204376221,
0.12555114924907684,
-0.6135237216949463,
0.7620618939399719,
-0.7884800434112549,
-0.6914845108985901,
... |
func (s *TransactionRows) Next(dst interface{}) (bool, error) {
snap, err := s.iter.Next()
if err != nil {
s.lastError = err
return false, err
}
err = snap.DataTo(&dst)
return true, err
} | [
-1.0487710237503052,
1.382042407989502,
0.5376465916633606,
-0.01574503816664219,
-1.6442902088165283,
-0.11164991557598114,
-0.2552679479122162,
0.2784345746040344,
0.40362808108329773,
0.38401272892951965,
-0.3585287928581238,
0.20993973314762115,
0.5873942375183105,
0.13872210681438446,... |
func (s *TransactionRows) NextRaw() ([]byte, bool) {
snap, err := s.iter.Next()
if err != nil {
s.lastError = err
return nil, false
}
data := snap.Data()
b, err := json.Marshal(data)
if err == nil {
return b, true
}
return nil, false
} | [
-1.1289278268814087,
1.1431223154067993,
1.1954083442687988,
-0.48045188188552856,
-1.8704403638839722,
-0.20504668354988098,
-0.5709019899368286,
-0.3153574466705322,
0.12989214062690735,
0.13086777925491333,
-0.3560675382614136,
-0.4250129461288452,
0.7663618922233582,
0.1487112045288086... |
func (s *TransactionRows) Count() int {
// return s.iter.
return 0
} | [
0.6056745648384094,
-0.05053175985813141,
0.3268398344516754,
-0.18070827424526215,
-0.5633469820022583,
-0.4911358654499054,
0.7409069538116455,
0.350115567445755,
-0.4220481812953949,
0.21701958775520325,
0.17157019674777985,
-0.6960738301277161,
0.25518912076950073,
1.2284563779830933,
... |
func (s *TransactionRows) Close() {
s.iter.Stop()
} | [
0.1207437664270401,
-0.0038760900497436523,
0.22382371127605438,
-0.844640851020813,
-0.7761052250862122,
0.08713216334581375,
0.676459014415741,
0.010364278219640255,
-0.9884899854660034,
0.34482085704803467,
1.0513797998428345,
-0.6773244142532349,
-0.3193463683128357,
1.1034437417984009... |
func New(r image.Rectangle, ft *font.Font, b *image.RGBA, cols Color, flag ...int) *Frame {
fl := getflag(flag)
if fl&FrUTF8 != 0 {
return newRuneFrame(r, ft, b, cols, flag...)
}
mintab := ft.Measure(' ')
maxtab := mintab * 4
elastic := fl&FrElastic != 0
if elastic {
mintab = maxtab
}
f := &Frame{
Font: ... | [
0.036598801612854004,
0.05203442648053169,
0.47950103878974915,
0.21756921708583832,
-0.6625077724456787,
-0.6115981936454773,
0.29030299186706543,
-0.8449876308441162,
-0.4667316675186157,
-0.7835421562194824,
-0.1071138009428978,
0.17848613858222961,
0.5674266815185547,
0.284385561943054... |
func (f *Frame) Dirty() bool {
return f.modified
} | [
-1.5816371440887451,
-0.5307092666625977,
0.5431421995162964,
-0.3399616479873657,
-0.28085091710090637,
0.245464488863945,
-0.3055941164493561,
-0.2010718584060669,
-0.4225197732448578,
-0.42060884833335876,
-0.7021079659461975,
0.6637662053108215,
-0.22650261223316193,
0.9311381578445435... |
func (f *Frame) SetDirty(dirty bool) {
f.modified = dirty
} | [
-0.7268410921096802,
-0.45982688665390015,
0.6328091025352478,
0.2372046411037445,
0.5177181363105774,
0.3162369132041931,
-0.14722128212451935,
-0.10919912904500961,
-0.7974158525466919,
-0.5581281781196594,
-0.43650713562965393,
0.9480645656585693,
0.05705839768052101,
1.4823098182678223... |
func (f *Frame) Close() error {
return nil
} | [
0.30404573678970337,
0.4366800785064697,
0.3392488956451416,
0.68707275390625,
-0.28748613595962524,
0.2055060714483261,
0.4471697211265564,
-0.3118504285812378,
-0.546333909034729,
-1.4645471572875977,
0.10554380714893341,
0.38733792304992676,
-0.5969073176383972,
0.6031025052070618,
0.... |
func (f *Frame) Reset(r image.Rectangle, b *image.RGBA, ft *font.Font) {
f.r = r
f.b = b
f.SetFont(ft)
} | [
-0.5525896549224854,
-0.2647455930709839,
0.2785221338272095,
-0.4086376428604126,
0.24620193243026733,
-0.8761059045791626,
0.30216312408447266,
-0.6520562767982483,
-0.2856692373752594,
-0.014130156487226486,
-0.24677792191505432,
0.7852706909179688,
0.08054594695568085,
-0.2610451877117... |
func (f *Frame) Bounds() image.Rectangle {
return f.r.Bounds()
} | [
-0.04083073139190674,
-0.8892349600791931,
0.3507111072540283,
0.40984317660331726,
0.2727576196193695,
-0.2744382917881012,
-0.05795123428106308,
-0.560417652130127,
0.6657145023345947,
-1.1981838941574097,
0.31690865755081177,
0.46008214354515076,
0.33593320846557617,
1.3623902797698975,... |
func (f *Frame) Full() bool {
return f.full == 1
} | [
-0.4998043179512024,
0.06409356743097305,
0.32254675030708313,
0.7853695154190063,
-0.3087729513645172,
-0.25089702010154724,
-0.26338431239128113,
0.17457251250743866,
-0.2305513173341751,
-0.06693744659423828,
-0.9022262096405029,
0.40720558166503906,
-0.2279127538204193,
0.3498064875602... |
func (f *Frame) MaxLine() int {
return f.maxlines
} | [
0.855255126953125,
0.19006074965000153,
0.38638046383857727,
0.8509911298751831,
0.16041173040866852,
0.09394009411334991,
-1.104414463043213,
0.44550710916519165,
0.30766060948371887,
-1.0939610004425049,
-0.27024707198143005,
-0.7010654807090759,
-0.4876040816307068,
0.7854916453361511,
... |
func (f *Frame) Line() int {
return f.Nlines
} | [
-0.38517841696739197,
0.46989718079566956,
0.14415664970874786,
0.4263087809085846,
0.44432440400123596,
-0.028660781681537628,
0.01842367835342884,
-0.16783420741558075,
-0.20839741826057434,
-1.5804214477539062,
-0.6277989745140076,
-0.9329379200935364,
-0.9057265520095825,
0.70201712846... |
func (f *Frame) Len() int64 {
return f.Nchars
} | [
0.38505586981773376,
0.2764749228954315,
0.16375571489334106,
-0.1523933708667755,
0.06875564903020859,
-1.1922292709350586,
0.48882314562797546,
0.8197891116142273,
-0.2671659290790558,
-1.043365240097046,
-1.0715034008026123,
0.26032331585884094,
0.5384469628334045,
-0.04998481273651123,... |
func (f *Frame) Dot() (p0, p1 int64) {
return f.p0, f.p1
} | [
-0.8021736741065979,
-0.7255386114120483,
0.45527154207229614,
-0.3037152886390686,
0.2849818468093872,
0.5177695751190186,
0.10629098117351532,
-0.15301673114299774,
-0.43078702688217163,
0.04981408268213272,
-0.3725034296512604,
0.5370093584060669,
0.28320741653442383,
0.5907473564147949... |
func GetVersion() string {
cwd, _ := os.Getwd()
currentFolderPathList := strings.Split(cwd, "/")
lenFolder := len(currentFolderPathList)
currFolder := currentFolderPathList[lenFolder-1]
versionInformation := strings.Split(currFolder, "-")
// In case we are not executing in the install directory, return
// the... | [
-0.5814366936683655,
-1.128880262374878,
0.7564712762832642,
0.9190669655799866,
1.0023653507232666,
0.3052808940410614,
1.0134221315383911,
0.8046578168869019,
-1.1722060441970825,
1.171877145767212,
0.21228550374507904,
0.019345879554748535,
-0.40439075231552124,
0.04450247064232826,
0... |
func (com Common) Status() {
outString := "Name" + "\t" + "Version" + "\t" + "Port" + "\t" +
"Config File Locations" + "\t" + "Systemd File Locations" +
"\t" + "Running Status" + "\t"
fmt.Fprintln(statusOutput, outString)
} | [
0.22832688689231873,
-1.510844349861145,
0.6150692105293274,
-0.29386723041534424,
-0.11132096499204636,
0.9383594989776611,
0.20964691042900085,
1.0347498655319214,
-1.1596643924713135,
0.03063149005174637,
-0.30365845561027527,
0.5045912861824036,
-0.044308435171842575,
0.833204388618469... |
func (com Common) SetUpPrereqs() {
LogInfo("You are on version " + version +
" of YBA Installer.")
License()
} | [
-0.16572219133377075,
-0.7695726156234741,
0.5673865675926208,
0.783446729183197,
0.22023621201515198,
-0.04846695810556412,
0.7259979248046875,
0.895298957824707,
0.24344578385353088,
-0.09156645834445953,
-0.4618079364299774,
-0.49298080801963806,
0.06573380529880524,
0.864698052406311,
... |
func (com Common) Install() {
// Hidden file written on first install (.installCompleted) at the end of the install,
// if the file already exists then it means that an installation has already taken place,
// and that future installs are prohibited.
if _, err := os.Stat(INSTALL_ROOT + "/.installCompleted"); err =... | [
-0.02763168327510357,
-0.5942463278770447,
0.5386607050895691,
0.5747360587120056,
0.48840007185935974,
-0.025874989107251167,
1.6274244785308838,
0.30039122700691223,
-0.0667881965637207,
0.43338868021965027,
-1.3484841585159302,
-0.723664402961731,
-0.20761553943157196,
0.971513628959655... |
func (com Common) Uninstall() {
service0 := "yb-platform"
service1 := "prometheus"
service2 := "postgres"
services := []string{service0, service1, service2}
if hasSudoAccess() {
command := "service"
for index := range services {
commandCheck0 := "bash"
subCheck0 := SYSTEMCTL + " list-unit-files --typ... | [
0.7936145663261414,
-0.1271323412656784,
0.9980696439743042,
0.5158759951591492,
0.6293669939041138,
-0.11649133265018463,
0.6369003653526306,
0.49811795353889465,
-0.8539156317710876,
-0.4523642957210541,
0.508110523223877,
0.09627475589513779,
-0.7208157777786255,
0.4045296609401703,
0... |
func RemoveAllExceptDataVolumes(services []string) {
dataVolumesList := []string{}
for _, service := range services {
dataVolumes := getYamlPathData(".dataVolumes." + service)
dataVolumesList = append(dataVolumesList, service+": "+dataVolumes)
}
LogDebug("All directories will be deleted except the following:... | [
0.3271632492542267,
-0.46279531717300415,
0.9553937315940857,
0.13208965957164764,
-0.29552069306373596,
-0.23875197768211365,
0.5241701006889343,
0.45099467039108276,
0.48188063502311707,
-0.12145639210939407,
0.0734507367014885,
0.11093318462371826,
-0.4677317440509796,
0.236335188150405... |
func (com Common) Upgrade() {
RemoveAllExceptDataVolumes([]string{"yb-platform", "prometheus", "postgres"})
copyBits(com.Version)
GenerateTemplatedConfiguration()
com.extractPlatformSupportPackageAndYugabundle(com.Version)
com.renameThirdPartyDependencies()
setupJDK()
setJDKEnvironmentVariable()
} | [
-0.3189134895801544,
-0.20138542354106903,
0.5621646642684937,
0.38125357031822205,
0.33598482608795166,
0.48265352845191956,
0.6867232322692871,
0.08424080163240433,
-0.31176722049713135,
0.2776121497154236,
-0.5419151782989502,
-0.3588431179523468,
-0.40574145317077637,
0.849302172660827... |
func setJDKEnvironmentVariable() {
javaExtractedFolderName, _ := ExecuteBashCommand("bash",
[]string{"-c", "tar -tf " + javaBinaryName + " | head -n 1"})
javaExtractedFolderName = strings.TrimSuffix(strings.ReplaceAll(javaExtractedFolderName,
" ", ""), "/")
javaHome := INSTALL_VERSION_DIR + javaExtractedFolde... | [
0.4256818890571594,
-0.1702890545129776,
0.6401969790458679,
-0.2632256746292114,
0.008575662039220333,
0.382200688123703,
0.940639853477478,
-0.025590911507606506,
-1.1569015979766846,
0.2698456346988678,
-0.656635046005249,
1.0973061323165894,
0.005408641882240772,
0.7564085721969604,
... |
func IpAddressGen(subnet string) []string {
ipAddress, ipNet, err := net.ParseCIDR(subnet)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
var ipAddresses []string
for ipAddress := ipAddress.Mask(ipNet.Mask); ipNet.Contains(ipAddress); inc(ipAddress) {
ipAddresses = append(ipAddresses, ipAddress.String())
... | [
-0.6148815155029297,
0.23722757399082184,
0.9445008039474487,
0.38970324397087097,
0.06625562161207199,
0.5720938444137573,
-0.09787622839212418,
0.4618494510650635,
-0.024912798777222633,
0.8721923828125,
0.2986842393875122,
-0.6805785894393921,
-0.21195311844348907,
-0.1806149035692215,
... |
func newMockServer() *httptest.Server {
return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
hdr := r.Header.Get(RequestIdHeader)
w.Header().Set(RequestIdHeader, hdr)
w.WriteHeader(200)
}))
} | [
-1.269465446472168,
-1.1174118518829346,
0.5302761197090149,
-0.15226635336875916,
0.1484692543745041,
0.04783821105957031,
-0.059076569974422455,
-0.911819577217102,
0.567761242389679,
-0.023420773446559906,
-0.4339917004108429,
0.2347368448972702,
-1.0422890186309814,
0.7142682075500488,... |
func isReleasedTarget(role data.RoleName) bool {
return role == data.CanonicalTargetsRole || role == trust.ReleasesRole
} | [
-1.3971004486083984,
-0.12060798704624176,
0.25525137782096863,
-0.44359320402145386,
-0.43337178230285645,
-0.6808232069015503,
0.09545183181762695,
-0.5594205856323242,
1.1738359928131104,
0.19985882937908173,
0.8074358701705933,
0.5288000702857971,
-0.16269882023334503,
-0.0772421807050... |
func notaryRoleToSigner(tufRole data.RoleName) string {
// don't show a signer for "targets" or "targets/releases"
if isReleasedTarget(data.RoleName(tufRole.String())) {
return releasedRoleName
}
return strings.TrimPrefix(tufRole.String(), "targets/")
} | [
-0.9703382849693298,
-0.7444121837615967,
0.39647015929222107,
-1.7025518417358398,
-0.06638278067111969,
-0.3073515295982361,
-0.14749687910079956,
0.02454773522913456,
0.03741781413555145,
0.4657035171985626,
0.7532089948654175,
-0.4209144711494446,
0.23348015546798706,
0.024871421977877... |
func clearChangeList(notaryRepo client.Repository) error {
cl, err := notaryRepo.GetChangelist()
if err != nil {
return err
}
return cl.Clear("")
} | [
-0.04627375304698944,
0.5496804714202881,
0.2785729765892029,
-0.620900571346283,
-0.06623604893684387,
0.7963134050369263,
-0.9417549967765808,
-0.4003726541996002,
0.17607447504997253,
1.3220375776290894,
-0.35109031200408936,
1.135246753692627,
0.4022934138774872,
1.0013011693954468,
... |
func getOrGenerateRootKeyAndInitRepo(notaryRepo client.Repository) error {
rootKey, err := getOrGenerateNotaryKey(notaryRepo, data.CanonicalRootRole)
if err != nil {
return err
}
return notaryRepo.Initialize([]string{rootKey.ID()}, data.CanonicalSnapshotRole)
} | [
-0.6331295371055603,
0.09767322242259979,
0.4724661111831665,
-0.08357711136341095,
0.036441314965486526,
-0.49379006028175354,
-0.6443142890930176,
0.05336844548583031,
-0.3530350625514984,
-0.11754736304283142,
-0.35051897168159485,
0.40101495385169983,
0.24753394722938538,
0.86878931522... |
func AddDeck(m *Deck) (id int64, err error) {
o := orm.NewOrm()
if m.Title == ""{
return 0, errors.New("名称不能为空")
}
id, err = o.Insert(m)
return
} | [
-0.13234663009643555,
1.4828929901123047,
1.024093508720398,
1.3556931018829346,
-0.8902205228805542,
0.8929039835929871,
-0.30944597721099854,
0.4341490864753723,
-0.09352511167526245,
-0.8605247735977173,
0.6781470775604248,
-0.8618563413619995,
-1.1897060871124268,
1.6447148323059082,
... |
func GetDeckById(id int) (v *Deck, err error) {
o := orm.NewOrm()
v = &Deck{Id: id}
if err = o.Read(v); err == nil {
return v, nil
}
return nil, err
} | [
0.6631494164466858,
0.569760799407959,
0.24782304465770721,
0.4713078737258911,
0.08821404725313187,
-0.6559242606163025,
-0.18273276090621948,
-0.24604861438274384,
-0.1959524005651474,
-0.49083957076072693,
0.4836171567440033,
-0.08859160542488098,
-0.2045762538909912,
0.5913006067276001... |
func GetAllDeck(query map[string]string, fields []string, sortby []string, order []string,
offset int64, limit int64) (ml []interface{}, err error) {
o := orm.NewOrm()
qs := o.QueryTable(new(Deck))
// query k=v
for k, v := range query {
// rewrite dot-notation to Object__Attribute
k = strings.Replace(k, ".", "... | [
-0.18608209490776062,
0.4565938711166382,
1.1091666221618652,
0.6144391894340515,
-0.4648314416408539,
-0.3459444046020508,
-0.5278590321540833,
-0.26323041319847107,
-0.11273140460252762,
-0.15608294308185577,
0.7559295296669006,
-0.06943004578351974,
0.14754721522331238,
0.94685137271881... |
func UpdateDeckById(m *Deck) (err error) {
o := orm.NewOrm()
v := Deck{Id: m.Id}
// ascertain id exists in the database
if err = o.Read(&v); err == nil {
var num int64
o.Begin()
if num, err = o.Update(m); err == nil {
fmt.Println("Number of records updated in database:", num)
}
hasCycle, err := CycleCh... | [
-0.16965916752815247,
0.028357312083244324,
1.0228625535964966,
0.7096343636512756,
-0.37818723917007446,
-0.17799045145511627,
1.0066556930541992,
0.5201637744903564,
-0.016346339136362076,
0.3172371983528137,
-0.11570866405963898,
-0.5616282224655151,
-0.6435930132865906,
1.0319663286209... |
func DeleteDeck(id int) (err error) {
o := orm.NewOrm()
qs := o.QueryTable("deck")
child_count, err := qs.Filter("parent_id", id).Count()
if err != nil{
return err
}
if child_count > 0{
return errors.New("请先将子目录移走")
}
v := Deck{Id: id}
// ascertain id exists in the database
if err = o.Read(&v); err == ni... | [
0.6564589142799377,
1.011556625366211,
1.2366816997528076,
0.8365187644958496,
0.15200680494308472,
0.04192327335476875,
1.160094141960144,
0.7828798890113831,
0.26351046562194824,
-1.2843334674835205,
0.366627037525177,
-0.54813551902771,
0.057616766542196274,
1.6420681476593018,
0.4836... |
func (store *sqlConfiguratorStorage) getEntityLoadPageSize(loadCriteria *EntityLoadCriteria) int {
if loadCriteria.PageSize == 0 {
return int(store.maxEntityLoadSize)
}
return util.MinInt(int(loadCriteria.PageSize), int(store.maxEntityLoadSize))
} | [
-0.21722251176834106,
-0.3140048682689667,
0.7092901468276978,
-0.8798292875289917,
-0.15785488486289978,
0.13753363490104675,
-1.1068708896636963,
-0.042769793421030045,
0.35615989565849304,
-0.0067316824570298195,
0.7694836258888245,
0.24694375693798065,
-0.04320061206817627,
0.963499903... |
func updateEntitiesWithAssocs(entsByTK EntitiesByTK, assocs loadedAssocs) ([]*GraphEdge, error) {
edges := make([]*GraphEdge, 0, len(assocs))
for _, assoc := range assocs {
edges = append(edges, assoc.asGraphEdge())
// Assoc may reference not-loaded ents
fromEnt, ok := entsByTK[assoc.fromTK]
if ok {
fromE... | [
-0.27685266733169556,
-1.3299554586410522,
0.6081762909889221,
-1.2843443155288696,
-0.5447536110877991,
-0.14228367805480957,
-0.21516461670398712,
-0.8149725794792175,
-0.2943766713142395,
0.19362162053585052,
1.2916159629821777,
-0.15685628354549408,
0.6247519850730896,
0.33668255805969... |
func Logger() Handler {
return func(c *Context) {
started := time.Now()
log.Printf("start [%s] %s", c.Method, c.Text)
c.Next()
log.Printf("done for %s [%s] %s", time.Since(started), c.Method, c.Text)
}
} | [
-0.6195768117904663,
-0.6983141899108887,
0.43561846017837524,
-1.0269958972930908,
-0.5960660576820374,
-0.1312190592288971,
0.02417481504380703,
0.06959909200668335,
-0.5338475704193115,
-0.6925681233406067,
-0.2503226399421692,
-0.016525376588106155,
0.3497476279735565,
1.18929386138916... |
func FromContextID(ctx context.Context) (string, bool) {
value, ok := ctx.Value(idContextKey).(string)
if !ok {
return "", false
}
return value, true
} | [
-0.23970986902713776,
-0.5323126912117004,
0.3718967139720917,
-0.5545692443847656,
-0.8735703229904175,
0.42147162556648254,
-1.1250373125076294,
-0.4629586338996887,
1.1569085121154785,
1.476191520690918,
-0.6644535064697266,
-0.5494076609611511,
-0.6921505331993103,
-0.1365024596452713,... |
func NewContext(ctx context.Context, id string) context.Context {
return context.WithValue(ctx, idContextKey, id)
} | [
0.10900818556547165,
-0.4468029737472534,
0.09193646907806396,
0.11561142653226852,
-0.9618399739265442,
0.04082605987787247,
-1.4549696445465088,
-0.7960093021392822,
1.6075316667556763,
0.32760074734687805,
-0.2548291087150574,
0.16136866807937622,
0.007569293957203627,
-1.03178238868713... |
func NewQueryRolesParams() *QueryRolesParams {
return &QueryRolesParams{
timeout: cr.DefaultTimeout,
}
} | [
0.22167667746543884,
0.19207879900932312,
-0.008299196138978004,
-0.30761054158210754,
-0.47082552313804626,
0.09101542085409164,
-0.6309704780578613,
-0.4689629077911377,
-0.1025334969162941,
-0.4361763596534729,
-0.27944809198379517,
0.3266857862472534,
-0.40638095140457153,
0.1063080206... |
func NewQueryRolesParamsWithTimeout(timeout time.Duration) *QueryRolesParams {
return &QueryRolesParams{
timeout: timeout,
}
} | [
0.5154248476028442,
-0.509260892868042,
0.1534707248210907,
-0.5707957744598389,
-0.44943320751190186,
1.2241145372390747,
-1.3355311155319214,
-0.6238164305686951,
-0.14934265613555908,
0.5438096523284912,
0.08985759317874908,
0.46765756607055664,
-0.11161565780639648,
0.20991143584251404... |
func NewQueryRolesParamsWithContext(ctx context.Context) *QueryRolesParams {
return &QueryRolesParams{
Context: ctx,
}
} | [
0.25950583815574646,
-0.34579455852508545,
0.2026207596063614,
-0.8875679969787598,
-0.25129660964012146,
1.1745935678482056,
-1.2213324308395386,
-1.241835594177246,
0.3280276358127594,
-0.06545451283454895,
-0.011285712011158466,
0.41595223546028137,
-0.10818376392126083,
-0.386316329240... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.