text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (s *Shader) setUniformMatrix(name string, value *mgl32.Mat4) {
location:=gl.GetUniformLocation(s.idPrograma, gl.Str(name + "\x00"))
if location != -1 { // Si existe ese nombre de variable
bb := new([16]float32) // Creamos un buffer de floats
for i:=0; i<4; i++{
for j:=0; j<4; j... | [
-0.016913525760173798,
0.10329505056142807,
0.6671436429023743,
-0.43023863434791565,
0.024146733805537224,
0.3886553943157196,
0.06734158098697662,
-0.42576587200164795,
-0.0665469840168953,
0.4572458565235138,
-0.8628968000411987,
0.2489313930273056,
-0.31998011469841003,
0.3663298785686... |
func (i Info) FreeFrac(k string) float64 {
return float64(i[k+"Free"]) / float64(i[k+"Total"])
} | [
0.644743800163269,
0.12365877628326416,
0.381631463766098,
-0.8110722303390503,
-1.4224025011062622,
-0.23915548622608185,
0.7092310190200806,
-1.3017996549606323,
-0.51125168800354,
-0.11947879940271378,
0.43029606342315674,
-1.0856183767318726,
0.329369455575943,
-0.31753093004226685,
... |
func (i Info) Available() unit.Datasize {
// MemAvailable, if present, is a more accurate indication of
// available memory.
if avail, ok := i["MemAvailable"]; ok {
return avail
}
return i["MemFree"] + i["Cached"] + i["Buffers"]
} | [
-0.45090430974960327,
-0.3059418797492981,
0.5765019059181213,
-0.48262742161750793,
-0.3375645875930786,
1.0760586261749268,
0.15463410317897797,
0.40516936779022217,
0.2511492669582367,
0.36047670245170593,
-0.06884463876485825,
0.7694869041442871,
0.30210012197494507,
0.9660903215408325... |
func (i Info) AvailFrac() float64 {
return float64(i.Available()) / float64(i["MemTotal"])
} | [
0.5649508237838745,
0.3863891661167145,
0.4484829008579254,
-1.1936275959014893,
-0.7560954689979553,
0.20923468470573425,
0.5148782134056091,
-0.3609224855899811,
-0.6887795925140381,
-0.2827224135398865,
0.5641055703163147,
-0.1121479943394661,
0.2525792717933655,
0.43773841857910156,
... |
func construct() {
once.Do(func() {
updater = timing.NewScheduler()
l.Attach(nil, ¤tInfo, "meminfo.currentInfo")
l.Attach(nil, updater, "meminfo.updater")
updater.Every(3 * time.Second)
update()
go func(updater *timing.Scheduler) {
for range updater.C {
update()
}
}(updater)
})
} | [
-0.04717317223548889,
-0.3922215700149536,
0.42899009585380554,
-0.22292600572109222,
-0.2626051902770996,
0.31337887048721313,
-0.27604517340660095,
0.0024670036509633064,
-0.8909897208213806,
-0.14523416757583618,
0.06744436919689178,
-0.6316733360290527,
0.14638495445251465,
1.139511227... |
func RefreshInterval(interval time.Duration) {
construct()
updater.Every(interval)
} | [
-0.16787299513816833,
-0.5087921619415283,
0.13484476506710052,
1.0747092962265015,
-0.6412615776062012,
1.1130083799362183,
-1.009170651435852,
-1.068953037261963,
-0.09393588453531265,
0.3280393183231354,
0.4124390184879303,
-0.18411937355995178,
-0.4827825725078583,
0.9897757768630981,
... |
func New() *Module {
construct()
m := new(Module)
l.Register(m, "outputFunc")
m.Output(defaultOutput)
return m
} | [
0.09239707887172699,
0.03508985415101051,
0.04202568158507347,
-0.11848334968090057,
0.1473112404346466,
-0.5630831718444824,
0.4825992286205292,
-0.22936101257801056,
-0.6519518494606018,
-0.6106356978416443,
-0.2271498590707779,
0.1979997605085373,
0.5038301944732666,
0.720855712890625,
... |
func (m *Module) Output(outputFunc func(Info) bar.Output) *Module {
m.outputFunc.Set(outputFunc)
return m
} | [
-0.43218764662742615,
-0.039260026067495346,
0.15145157277584076,
0.340401828289032,
-0.39346784353256226,
0.5288529396057129,
1.2834819555282593,
-0.10367366671562195,
-0.4413684010505676,
-0.14758650958538055,
-0.31315696239471436,
0.4940641522407532,
0.2859337031841278,
0.27497512102127... |
func (m *Module) Stream(s bar.Sink) {
i, err := currentInfo.Get()
nextInfo, done := currentInfo.Subscribe()
defer done()
outputFunc := m.outputFunc.Get().(func(Info) bar.Output)
nextOutputFunc, done := m.outputFunc.Subscribe()
defer done()
for {
if err != nil {
s.Error(err)
} else if info, ok := i.(Info);... | [
-0.7028763890266418,
-0.17704224586486816,
0.3730342984199524,
0.5808526873588562,
-0.3094452917575836,
0.11569631844758987,
1.201766014099121,
-1.0229477882385254,
-0.485331654548645,
-0.7984504103660583,
0.5853731632232666,
0.7358899712562561,
0.21971815824508667,
1.0555042028427124,
-... |
func TestDial(network, address string) (*Client, error) {
conn, err := net.Dial(network, address)
if err != nil {
return nil, err
}
return NewTestClient(conn), nil
} | [
0.5469652414321899,
-0.16981326043605804,
0.4046863913536072,
-0.39495548605918884,
-0.22929167747497559,
0.41907843947410583,
-0.04159824177622795,
-1.0541348457336426,
1.1186714172363281,
-0.7787397503852844,
0.38249671459198,
0.19825226068496704,
-0.8151633143424988,
-0.5162206888198853... |
func NewTestClient(conn io.ReadWriteCloser) *Client {
encBuf := bufio.NewWriter(conn)
client := &Client{
codec: &gobClientCodec{conn, gob.NewDecoder(conn), gob.NewEncoder(encBuf), encBuf},
pending: make(map[uint64]*Call),
discallback: make([]func(err error), 0),
}
retur... | [
0.38774147629737854,
-0.6153565645217896,
0.44701701402664185,
-0.5646604895591736,
-0.3100174367427826,
-0.21152019500732422,
0.046165935695171356,
-0.675968587398529,
-0.7344611287117004,
-0.5192407369613647,
-0.05281154811382294,
0.40967127680778503,
-1.1277942657470703,
-0.103780046105... |
func Register(s mime.Type, d newDecoder) {
decoders[s] = d
} | [
-0.8592450022697449,
-0.072788305580616,
0.20705002546310425,
-0.5218399167060852,
-0.7024058103561401,
-0.702963650226593,
-1.125914454460144,
-0.12120628356933594,
-0.5452796816825867,
-0.6994251012802124,
-1.2849295139312744,
1.257096529006958,
0.22645629942417145,
0.8486217856407166,
... |
func ResponseDecoder(r *http.Response) (Decoder, error) {
serverSent := mime.NewTypes(r.Header.Get("Content-Type"))
var dec Decoder
err := serverSent.Walk(func(x mime.Type) error {
if decoderFunc, ok := decoders[x]; ok {
dec = decoderFunc(r.Body)
return nil
}
return fmt.Errorf("%s isn't a registered deco... | [
0.13733068108558655,
-0.9218963384628296,
0.33919766545295715,
0.6072039604187012,
-0.6311003565788269,
-1.2414554357528687,
0.3289259970188141,
-0.5561967492103577,
0.6080980896949768,
-0.5510732531547546,
-0.6365783214569092,
-0.038485217839479446,
-0.811404824256897,
1.2016236782073975,... |
func RequestDecoder(r *http.Request, accepts []mime.Type) (Decoder, error) {
serverAccepts := mime.Aggregate(accepts)
clientSent := mime.NewTypes(r.Header.Get("Content-Type"))
available := mime.Intersect(serverAccepts, clientSent)
if len(available) < 0 {
available = serverAccepts
}
var dec Decoder
err := avai... | [
-1.2573500871658325,
-0.4753296673297882,
0.7390922904014587,
0.1753917932510376,
-0.659476637840271,
-0.3391207754611969,
-0.324572890996933,
-0.18997566401958466,
-0.320011705160141,
-0.23268869519233704,
0.8110047578811646,
0.8447564244270325,
-1.1576310396194458,
1.217644453048706,
0... |
func decorate(s string, color string) string {
switch color {
case "green":
s = "\x1b[0;32m" + s
case "red":
s = "\x1b[0;31m" + s
default:
return s
}
return s + "\x1b[0m"
} | [
0.3783436119556427,
0.5105489492416382,
0.6203724145889282,
0.12460816651582718,
0.16890719532966614,
-0.061065707355737686,
-2.077575445175171,
0.12866425514221191,
-0.15015628933906555,
0.41728439927101135,
0.6579564213752747,
0.48065394163131714,
0.4565260410308838,
-0.1089881882071495,... |
func (ui *UI) log(message string, isError bool) error {
if isError {
message = decorate(message, "red")
} else {
message = decorate(message, "green")
}
return ui.writeContent(LOG_PANEL, message)
} | [
-0.5993180274963379,
1.3515236377716064,
0.5122915506362915,
0.00878983922302723,
-0.22498536109924316,
0.14610691368579865,
-0.4746589660644531,
0.1919364631175995,
0.1388631910085678,
0.0775163322687149,
0.27942991256713867,
0.5507214069366455,
-0.6439719200134277,
0.35044053196907043,
... |
func (ui *UI) clearLog() error {
return ui.writeContent(LOG_PANEL, "")
} | [
0.6298027038574219,
1.0280073881149292,
0.2275794893503189,
0.021010054275393486,
-0.5135388374328613,
0.9179171919822693,
-0.10347634553909302,
-0.20796585083007812,
-0.6488066911697388,
0.41722771525382996,
0.4705919027328491,
0.7707601189613342,
-0.31797707080841064,
-0.2323289960622787... |
func CreateArray(m map[string]struct{}) []string {
array := []string{}
for k := range m {
array = append(array, k)
}
return array
} | [
-0.4024069607257843,
-1.0804184675216675,
0.3923834562301636,
-0.046800170093774796,
0.2811686396598816,
0.3846418857574463,
-0.9941241145133972,
-0.16600756347179413,
-0.9372087121009827,
1.1182425022125244,
0.746566891670227,
-0.4587998688220978,
-0.6268286108970642,
1.4196406602859497,
... |
func CreateMap(a ...[]string) (m map[string]struct{}) {
m = make(map[string]struct{})
for _, aa := range a {
for _, val := range aa {
m[val] = struct{}{}
}
}
return m
} | [
0.054959554225206375,
-0.046649765223264694,
0.8162562847137451,
-0.5743507742881775,
0.12487070262432098,
0.5118294954299927,
-0.16761887073516846,
-0.1288471668958664,
-0.31178414821624756,
0.05397083982825279,
0.5319787859916687,
-1.0566424131393433,
0.5517586469650269,
0.31958851218223... |
func Min(x, y int) int {
if x < y {
return x
}
return y
} | [
-0.12842689454555511,
-0.128791943192482,
0.3314765989780426,
-0.5757017135620117,
-1.173579216003418,
0.6196678876876831,
-1.524638295173645,
-2.035526990890503,
-0.6642971038818359,
-0.2046993523836136,
0.4156489074230194,
0.9760453104972839,
0.25288230180740356,
-0.1524578481912613,
1... |
func updateVC(senderVC []int, replicaVC []int, view []string) []int {
newVC := make([]int, len(view))
for i := 0; i < len(view); i++ {
fmt.Printf("SENDERVC: %v\n", senderVC)
fmt.Printf("REPLICAVC: %v\n", replicaVC)
newVC[i] = max(senderVC[i], replicaVC[i])
}
return newVC
} | [
-0.46901071071624756,
-0.8495548367500305,
0.6381438374519348,
-0.48746198415756226,
-0.6959607601165771,
-0.43918052315711975,
0.14445050060749054,
-0.27161136269569397,
0.330872505903244,
0.24108897149562836,
0.10399362444877625,
0.9759157299995422,
0.03830987960100174,
0.473179101943969... |
func compareVC(leftVC []int, rightVC []int, view []string) []int {
leftSum := 0
rightSum := 0
for i := 0; i < len(view); i++ {
leftSum += leftVC[i]
rightSum += rightVC[i]
}
if leftSum > rightSum {
return leftVC
}
return rightVC
} | [
0.6964253187179565,
-0.6233260631561279,
1.0129259824752808,
-0.21891412138938904,
-0.6577131748199463,
-0.3011055886745453,
0.26130929589271545,
-1.2754266262054443,
0.623505711555481,
-0.1518949568271637,
0.4112362861633301,
0.45004719495773315,
-0.35354867577552795,
0.6900945901870728,
... |
func ShardPutStore(s *SharedShardInfo, view *View, store map[string]StoreVal, localAddr int, currVC []int) {
var (
d StoreVal
fn fromNode
)
s.Router.PUT("/key-value-store/:key", func(c *gin.Context) {
key := c.Param("key")
// body := c.Request.Body
data, _ := ioutil.ReadAll(c.Request.Body)
st... | [
0.0734013244509697,
-0.43356284499168396,
0.7132208943367004,
-0.40867769718170166,
-0.7648260593414307,
0.1491987109184265,
0.22858522832393646,
-0.08876947313547134,
-0.09131944179534912,
0.256084680557251,
0.7352497577667236,
0.8723095059394836,
-0.2538396716117859,
0.1251746416091919,
... |
func ReplicatePut(r *gin.Engine, dict map[string]StoreVal, localAddr int, view []string, currVC []int, s *SharedShardInfo) {
var d StoreVal
r.PUT("/key-value-store-r/:key", func(c *gin.Context) {
key := c.Param("key")
body, _ := ioutil.ReadAll(c.Request.Body)
strBody := string(body[:])
fmt.Printf("STRBO... | [
-0.4620729386806488,
-0.06718596071004868,
0.8660832643508911,
-0.5222354531288147,
-1.2128815650939941,
0.3784972131252289,
-0.22515808045864105,
0.7988371253013611,
0.2641702890396118,
0.7951323390007019,
0.13790471851825714,
0.4249521791934967,
-0.4189470708370209,
-0.268083393573761,
... |
func RuneToChar(n rune) string {
if 0 <= n && 25 >= n {
return string('A' + n)
} else if 26 <= n && 51 >= n {
return string('a' + n - 26)
} else if 52 <= n && 61 >= n {
return string('0' + n - 52)
} else if n == 62 {
return "+"
} else if n == 63 {
return "/"
}
panic("some error int IntToChar")
} | [
-0.6699691414833069,
-1.0090816020965576,
0.7865455746650696,
-1.101601243019104,
-0.6963194012641907,
0.5485523343086243,
0.5198154449462891,
-1.5521847009658813,
0.19912108778953552,
-0.006888780277222395,
0.42388585209846497,
0.6175869703292847,
-0.022825611755251884,
-0.108562134206295... |
func GenerateSignature( resourceURL, method, consumerKey, consumerSecret string, params map[string]string ) ( signature string ){
EscapeParamValues( params )
params[ "oauth_nonce" ] = GenerateNonce( 10 )
params[ "oauth_timestamp" ] = GetTimestamp()
params[ "oauth_signature_method" ] = "HMAC-SHA1"
params[ "oauth... | [
-0.7069233655929565,
-0.6329644918441772,
0.5522075891494751,
0.06640183925628662,
0.8053166270256042,
-0.5717921853065491,
-0.5950020551681519,
0.556847095489502,
-0.2853904962539673,
0.8199419379234314,
-0.14875493943691254,
-0.24066641926765442,
-0.6789093613624573,
0.31349292397499084,... |
func (client *Client) DeleteDomainRecord(args *DeleteDomainRecordArgs) (response *DeleteDomainRecordResponse, err error) {
action := "DeleteDomainRecord"
response = &DeleteDomainRecordResponse{}
err = client.Invoke(action, args, response)
if err == nil {
return response, nil
} else {
return nil, err
}
} | [
-0.2188652902841568,
-0.19863644242286682,
0.5226443409919739,
0.9424144625663757,
-0.10948193073272705,
0.29908162355422974,
0.7670449018478394,
-0.29784825444221497,
0.6085758805274963,
-0.6960079073905945,
-0.29932305216789246,
1.1309332847595215,
-0.8207820653915405,
1.0206965208053589... |
func PostInitSlackMessage(webhook string) {
msg := &slack.WebhookMessage{
Username: Username,
IconEmoji: IconEmoji,
Text: "DocNoc has started scanning",
}
if err := slack.PostWebhook(webhook, msg); err != nil {
fmt.Println("🔥: Can't post init message to slack. Operating in headless state", err)
}
} | [
0.05216166004538536,
0.15011459589004517,
0.4323616027832031,
0.13871468603610992,
0.4221525192260742,
0.008269884623587132,
-0.19447092711925507,
-0.7770172953605652,
-0.6253657937049866,
-1.060709834098816,
-1.0191001892089844,
1.1662527322769165,
-1.1151775121688843,
1.1726360321044922,... |
func PostActionMessage(webhook, cN, cID, action string, errType bool) {
if errType {
IO.Println(fmt.Sprintf("\t🔥 Failed to %s container with ID: %s", action, cID))
} else {
IO.Println(fmt.Sprintf("\t🚒 %s container with ID: %s", action, cID))
}
if webhook != "" {
var text, color string
if errType {
tex... | [
0.24487939476966858,
-0.7859825491905212,
0.6037673950195312,
-0.11196665465831757,
0.8785844445228577,
0.057870831340551376,
0.216706320643425,
-0.18347010016441345,
0.2168208509683609,
-0.029316311702132225,
-0.29813748598098755,
1.0875941514968872,
-0.49337702989578247,
1.18675768375396... |
func Add(mgr manager.Manager) error {
return add(mgr, newReconciler(mgr))
} | [
-0.24057555198669434,
0.12229465693235397,
0.46777674555778503,
-0.6655282378196716,
0.4479011595249176,
-0.17455056309700012,
-0.48020607233047485,
0.6828829646110535,
0.19666412472724915,
-0.7739230394363403,
0.224630668759346,
0.617239773273468,
-1.010264277458191,
1.3228338956832886,
... |
func newReconciler(mgr manager.Manager) reconcile.Reconciler {
return &ReconcileSqlDB{Client: mgr.GetClient(), scheme: mgr.GetScheme()}
} | [
0.36012911796569824,
-0.24202460050582886,
0.4810052812099457,
-0.5798569321632385,
-0.7350094318389893,
-0.02463439106941223,
-0.7297342419624329,
0.8844231367111206,
-0.09541576355695724,
-0.12771138548851013,
0.20692937076091766,
-0.16059228777885437,
-0.6445798873901367,
0.841107308864... |
func add(mgr manager.Manager, r reconcile.Reconciler) error {
// Create a new controller
c, err := controller.New("sqldb-controller", mgr, controller.Options{Reconciler: r})
if err != nil {
return err
}
// Watch for changes to SqlDB
err = c.Watch(&source.Kind{Type: &infrav1alpha1.SqlDB{}}, &handler.EnqueueRequ... | [
0.13894091546535492,
0.3742724359035492,
0.9228370785713196,
-0.16424502432346344,
0.31492453813552856,
0.035070620477199554,
-0.5698540210723877,
-0.01669980026781559,
0.36007288098335266,
-0.13344711065292358,
0.39105603098869324,
0.17378877103328705,
-0.4451005458831787,
1.2017549276351... |
func getSVCTemplate(instanceName string) *corev1.Service {
return &corev1.Service{
TypeMeta: metav1.TypeMeta{
APIVersion: "v1",
Kind: "Service",
},
ObjectMeta: metav1.ObjectMeta{
Name: "sqldb-" + instanceName + "-svc",
Namespace: "default",
},
Spec: corev1.ServiceSpec{
Selector: map... | [
-0.260508269071579,
0.8058370351791382,
0.6710119247436523,
-0.7463330030441284,
-0.24293410778045654,
-0.059044186025857925,
-0.6698549389839172,
0.2631831765174866,
-0.4454786777496338,
0.7248181104660034,
-0.700020968914032,
1.0302866697311401,
-1.0422929525375366,
-0.18254354596138,
... |
func (r *ReconcileSqlDB) Reconcile(request reconcile.Request) (reconcile.Result, error) {
// Fetch the SqlDB instance.
instance := &infrav1alpha1.SqlDB{}
err := r.Get(context.TODO(), request.NamespacedName, instance)
if err != nil {
if errors.IsNotFound(err) {
// Object not found, return. Created objects are ... | [
-0.8999236822128296,
0.21195144951343536,
0.9066233038902283,
0.10329665243625641,
0.14516501128673553,
-0.3797045052051544,
-0.6501787304878235,
-0.677524745464325,
-0.010470321401953697,
0.13993597030639648,
0.4113810956478119,
-0.12457079440355301,
-0.526050329208374,
0.555780827999115,... |
func (o operation) MarshalLogObject(enc zapcore.ObjectEncoder) error {
enc.AddString("id", o.id.String())
enc.AddBool("first", o.first)
enc.AddBool("last", o.last)
if o.producer != "" {
enc.AddString("producer", o.producer)
}
return nil
} | [
0.052846603095531464,
0.12706856429576874,
0.6603290438652039,
-0.23951514065265656,
-0.11921604722738266,
-0.0070425099693238735,
-0.02446865104138851,
-0.1726420521736145,
-0.4044206142425537,
0.39435693621635437,
-0.561799168586731,
0.31186091899871826,
0.6012555956840515,
-0.6593604683... |
func WithContext(ctx context.Context) context.Context {
return context.WithValue(ctx, contextKey, uuid.New())
} | [
-0.29593199491500854,
0.19127915799617767,
0.38294750452041626,
0.15763990581035614,
-0.976207435131073,
0.15476340055465698,
-0.6400786638259888,
-0.4360027313232422,
1.104707956314087,
0.33403220772743225,
-0.2116577923297882,
-0.5619761943817139,
0.2990242838859558,
-1.0297075510025024,... |
func FindSessionCookie(cookies []*http.Cookie) *http.Cookie {
for _, c := range cookies {
if c.Name == "clsession" {
return c
}
}
return nil
} | [
0.17095880210399628,
-0.7948575019836426,
0.6469165682792664,
0.3622596859931946,
-0.06326775252819061,
-0.5664205551147461,
0.2754812240600586,
-1.5175868272781372,
-0.016612932085990906,
0.6599471569061279,
0.6799361705780029,
0.36308446526527405,
-0.19139571487903595,
0.3725556135177612... |
func New(sess *session.Session, svc ec2stateservice.Ec2StateSvc, logger log.Logger) Set {
var powerOnEndpoint endpoint.Endpoint
{
powerOnEndpoint = MakePowerOnEndpoint(sess, svc)
powerOnEndpoint = LoggingMiddleware(log.With(logger, "method", "poweron"))(powerOnEndpoint)
}
var powerOffEndpoint endpoint.E... | [
-0.18110880255699158,
-0.6561868190765381,
0.3141326904296875,
-0.6649162173271179,
0.1102738082408905,
-0.26603397727012634,
-0.5389916300773621,
-0.5972617268562317,
0.03327575698494911,
-0.14369989931583405,
0.43393152952194214,
0.5143744945526123,
0.7961798310279846,
0.3847483992576599... |
func MakePowerOnEndpoint(sess *session.Session, svc ec2stateservice.Ec2StateSvc) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (response interface{}, err error) {
req := request.(PowerOnRequest)
res, err := svc.PowerOn(ctx, sess, req.InstanceId)
return PowerOnResponse{Status: r... | [
-0.5417361259460449,
-0.6721915602684021,
0.7855768799781799,
-0.30574703216552734,
-0.0829165056347847,
0.22622732818126678,
-0.25976571440696716,
0.35016265511512756,
-0.045174479484558105,
0.12702415883541107,
-0.3027183413505554,
0.05950605869293213,
-0.28570234775543213,
-0.5566927194... |
func (t *tunnelIF) Enable() error {
t.lock.Lock()
defer t.lock.Unlock()
if t.iface == nil {
if t.state != freed {
t.state = enabled
}
} else {
return t.iface.Enable()
}
return nil
} | [
-0.295917809009552,
0.6252413392066956,
0.5061770081520081,
0.31244391202926636,
0.052635692059993744,
0.10285763442516327,
0.27727457880973816,
-0.5174790620803833,
-0.3256989121437073,
0.22849628329277039,
-0.13235357403755188,
-0.9494851231575012,
-0.7734055519104004,
-0.117891997098922... |
func (t *tunnelIF) Disable() {
t.lock.Lock()
defer t.lock.Unlock()
if t.iface == nil {
if t.state != freed {
t.state = disabled
}
} else {
t.iface.Disable()
}
} | [
-0.11445292085409164,
0.5643778443336487,
0.35673534870147705,
0.19272497296333313,
0.2388046830892563,
0.16012778878211975,
0.7940652966499329,
0.03675669804215431,
-0.048179395496845245,
0.05019528791308403,
-0.16161812841892242,
-0.9917253851890564,
-0.7573521137237549,
0.18609890341758... |
func (t *tunnelIF) Free() {
t.lock.Lock()
defer t.lock.Unlock()
if t.iface == nil {
t.state = freed
} else {
t.iface.Free()
}
} | [
-0.4341188371181488,
1.0144636631011963,
0.3007560670375824,
-0.24440371990203857,
-0.09926130622625351,
-0.46382060647010803,
0.5701472759246826,
-1.2043194770812988,
-0.09236138314008713,
0.12586510181427002,
0.14611855149269104,
-0.2932793200016022,
-0.4507293105125427,
0.66390776634216... |
func (t *tunnelIF) NewVIF(vif *vswitch.VIF) (vswitch.VIFInstance, error) {
t.lock.Lock()
defer t.lock.Unlock()
log.Logger.Info("[%s][%s] new Tunnel VIF: index=%d", t.base.Name(), vif.Name(), vif.Index())
if vif == nil {
return nil, fmt.Errorf("VIF is nil")
}
if t.iface == nil {
var err error
var proto P... | [
-0.18780659139156342,
-0.6294878125190735,
0.3780685067176819,
0.004103750456124544,
0.2222958207130432,
-0.29799866676330566,
0.477643758058548,
-0.3145864009857178,
-0.061066146939992905,
0.7236735820770264,
-0.5909943580627441,
-0.18204841017723083,
-0.3574012517929077,
0.40488970279693... |
func (t *tunnelIF) AddressTypeUpdated(addressType vswitch.AddressFamily) {
t.lock.Lock()
defer t.lock.Unlock()
if t.iface != nil {
t.iface.setAddressType(addressType)
}
} | [
-0.40493693947792053,
-0.2967921495437622,
0.2620186507701874,
0.1029670462012291,
-0.13667811453342438,
-0.20837172865867615,
0.04047909751534462,
-0.6233633756637573,
0.8390136361122131,
1.0509215593338013,
-0.19211305677890778,
-0.24624766409397125,
-0.036882344633340836,
0.215858429670... |
func (t *tunnelIF) LocalAddressUpdated(localAddr net.IP) {
t.lock.Lock()
defer t.lock.Unlock()
if t.iface != nil {
t.iface.setLocalAddress(localAddr)
}
} | [
0.6386055946350098,
-1.0064189434051514,
0.1431725025177002,
-0.9174888730049133,
-0.5132296085357666,
-0.6595492959022522,
0.020076382905244827,
0.6659290790557861,
1.1168338060379028,
0.5895825028419495,
-0.17962875962257385,
-0.03859122470021248,
-0.45310473442077637,
-0.196620136499404... |
func (t *tunnelIF) RemoteAddressesUpdated(remoteAddrs []net.IP) {
t.lock.Lock()
defer t.lock.Unlock()
if t.iface != nil {
t.iface.setRemoteAddresses(remoteAddrs)
}
} | [
-0.4278097450733185,
-0.6617704629898071,
0.364660382270813,
-1.0436018705368042,
-0.4134175479412079,
0.5979302525520325,
0.21246197819709778,
0.34005528688430786,
0.8688784241676331,
0.9143214821815491,
-0.9782107472419739,
0.03289343789219856,
-1.195826768875122,
-0.5967450141906738,
... |
func NewAutoRestReportServiceForAzureServerTransport(srv *AutoRestReportServiceForAzureServer) *AutoRestReportServiceForAzureServerTransport {
return &AutoRestReportServiceForAzureServerTransport{srv: srv}
} | [
0.14929576218128204,
-0.42204850912094116,
0.31424447894096375,
-0.04387223720550537,
0.42217475175857544,
-1.3397136926651,
1.0339452028274536,
-0.0006096967263147235,
-0.001642281305976212,
-0.7962898015975952,
-0.55143141746521,
1.068583607673645,
-0.8875284194946289,
-0.385855257511138... |
func (a *AutoRestReportServiceForAzureServerTransport) Do(req *http.Request) (*http.Response, error) {
rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
method, ok := rawMethod.(string)
if !ok {
return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
}
va... | [
0.08361360430717468,
0.29301366209983826,
0.9473790526390076,
0.2979600727558136,
0.8769142627716064,
-0.5458946824073792,
0.4491185247898102,
-0.6226849555969238,
-0.041517097502946854,
0.5701891779899597,
0.004960510414093733,
0.07234828919172287,
-0.7828945517539978,
0.03954398632049560... |
func (e *Card) Index(index bleve.Index) error {
err := index.Index(string(e.Id), e)
return err
} | [
-0.6401870250701904,
-0.2509468197822571,
-0.05668362230062485,
-0.09342500567436218,
0.6733257174491882,
-0.00810533482581377,
-0.12433265149593353,
1.0107207298278809,
0.24223636090755463,
0.8228272795677185,
-0.30981558561325073,
0.5620139837265015,
-0.14162352681159973,
-0.266947567462... |
func IntExist(needle int, haystack []int) (int, bool) {
var (
exist bool
index int
)
for i, n := range haystack {
if n == needle {
exist = true
index = i
break
}
}
return index, exist
} | [
-0.16211874783039093,
-0.3713827133178711,
0.5949759483337402,
-0.02517164871096611,
0.7137135863304138,
-0.12268798053264618,
0.27413034439086914,
0.1420232355594635,
-0.5482722520828247,
1.5496349334716797,
-0.6706530451774597,
-0.15888117253780365,
-0.5112609267234802,
0.247087076306343... |
func StringExist(needle string, haystack []string) (int, bool) {
var (
exist bool
index int
)
for i, n := range haystack {
if n == needle {
exist = true
index = i
break
}
}
return index, exist
} | [
-0.16684335470199585,
-0.7859799265861511,
0.6304061412811279,
0.010770278051495552,
0.734183669090271,
-0.3281448781490326,
0.4258575439453125,
0.03218291327357292,
-0.5453159809112549,
1.7310290336608887,
-0.38482561707496643,
0.20985832810401917,
-0.2414695918560028,
-0.0793079510331153... |
func IsSlice(v interface{}) bool {
if reflect.ValueOf(v).Kind() == reflect.Slice {
return true
}
return false
} | [
-0.9275282025337219,
-0.35825657844543457,
0.4485304653644562,
1.1141546964645386,
-0.19352371990680695,
-0.3470577895641327,
0.03730148822069168,
-0.20105212926864624,
1.3516234159469604,
0.6648205518722534,
-0.22527460753917694,
0.5843140482902527,
-0.8407269716262817,
0.5689469575881958... |
func InterfaceToSliceString(v interface{}) []string {
var stringSlice []string
if IsSlice(v) {
switch reflect.TypeOf(stringSlice).Elem().Kind() {
case reflect.String:
stringSlice = v.([]string)
case reflect.Int:
stringSlice = SliceIntToSliceString(v.([]int))
//default:
//TODO we need to handle this ... | [
-0.8721341490745544,
-0.6169191598892212,
0.6215283870697021,
-0.4132269620895386,
0.3517874479293823,
-0.8000850081443787,
-0.4819224774837494,
-1.1558480262756348,
0.7748781442642212,
1.417280912399292,
0.4286942481994629,
0.6097701191902161,
-0.09993784129619598,
0.8913165926933289,
0... |
func SliceIntToSliceString(slice []int) []string {
var stringSlice []string
for _, n := range slice {
stringSlice = append(stringSlice, strconv.Itoa(n))
}
return stringSlice
} | [
-0.926038384437561,
-1.135869026184082,
0.4304566979408264,
-0.9950111508369446,
0.17309987545013428,
-0.24378876388072968,
-1.1969785690307617,
-1.2740000486373901,
0.5431430339813232,
1.7044200897216797,
0.4491450786590576,
0.06049644574522972,
0.26556965708732605,
0.6187151670455933,
... |
func SliceIntToString(slice []int, delimiter string) string {
if delimiter == "" {
delimiter = ","
}
stringSlice := SliceIntToSliceString(slice)
return strings.Join(stringSlice, delimiter)
} | [
-0.5246619582176208,
-0.17492489516735077,
0.35790544748306274,
-0.6488955616950989,
-0.28031033277511597,
-0.20861439406871796,
-1.0700660943984985,
-0.46262305974960327,
0.9335877895355225,
1.6073994636535645,
0.4887871742248535,
-0.22830195724964142,
-0.16002888977527618,
-0.09473080933... |
func StringToSliceByte(something string) []byte {
sliceByte := make([]byte, len(something))
copy(sliceByte, something)
return sliceByte
} | [
-0.05935288593173027,
-1.1970771551132202,
0.47236356139183044,
0.03375566750764847,
0.11641814559698105,
-0.23395083844661713,
-0.6512045860290527,
-0.9853994250297546,
0.831757128238678,
1.0864753723144531,
-1.2385531663894653,
1.1001678705215454,
-0.4236488938331604,
-0.723564088344574,... |
func NewRecordRef(recID Local) Global {
if recID.getScope() != 0 {
panic("illegal value")
}
return Global{addressLocal: recID}
} | [
0.47520023584365845,
-0.2744884490966797,
0.20729735493659973,
-0.5900141000747681,
-0.5190916657447815,
0.02124638855457306,
0.4256841838359833,
0.47416916489601135,
0.009211068972945213,
0.44898250699043274,
0.2337988168001175,
1.1920534372329712,
-0.9959679841995239,
0.8124231100082397,... |
func (v Global) IsEmpty() bool {
return v.addressLocal.IsEmpty() && v.addressBase.IsEmpty()
} | [
-1.0577681064605713,
-0.22174054384231567,
0.60125333070755,
-0.33304306864738464,
0.8850709199905396,
0.6733256578445435,
-0.12235187739133835,
0.08412569016218185,
-0.19899441301822662,
0.6153632402420044,
-0.6472311019897461,
1.3507766723632812,
-0.5666702389717102,
0.16055932641029358,... |
func (v *Global) tryConvertToSelf() bool {
if !v.addressBase.IsEmpty() {
return false
}
v.addressBase = v.addressLocal
return true
} | [
-0.3265266418457031,
0.46942561864852905,
0.6532567143440247,
-0.9277371168136597,
0.4423755407333374,
0.10162434726953506,
-0.5017894506454468,
-0.8891492486000061,
-0.23441444337368011,
0.3047867715358734,
-0.4601522982120514,
-0.047008927911520004,
-0.7833166718482971,
0.639393210411071... |
func (v *Global) tryApplyBase(base *Global) bool {
if !v.addressBase.IsEmpty() {
return false
}
if !base.IsSelfScope() {
switch base.GetScope() {
case LocalDomainMember, GlobalDomainMember:
break
default:
return false
}
}
v.addressBase = base.addressLocal
return true
} | [
-0.26457977294921875,
-0.004081569146364927,
0.8144465684890747,
-0.47910812497138977,
-0.07108888775110245,
0.3991529941558838,
-0.08608599007129669,
-0.6903526782989502,
0.5646103024482727,
0.18796388804912567,
-0.391450971364975,
0.5369077324867249,
-1.41404390335083,
1.253774642944336,... |
func (v Global) GetBase() *Local {
return &v.addressBase
} | [
-0.04577993229031563,
-0.37345728278160095,
0.475424200296402,
0.24882547557353973,
0.4234751760959625,
0.24226999282836914,
0.6750068664550781,
-0.48265621066093445,
0.06201974302530289,
0.23574189841747284,
-0.37258121371269226,
0.964876651763916,
-0.9420258402824402,
0.2197461873292923,... |
func (v Global) GetLocal() *Local {
return &v.addressLocal
} | [
0.5293706059455872,
-0.5887975096702576,
0.5677345991134644,
-0.08961481600999832,
-0.5109819173812866,
0.07112164795398712,
1.3713880777359009,
0.16693662106990814,
0.27998217940330505,
-0.028767816722393036,
-0.2783215641975403,
1.4113352298736572,
-0.7922613024711609,
-0.563641190528869... |
func (v Global) String() string {
repr, err := DefaultEncoder().Encode(&v)
if err != nil {
return NilRef
}
return repr
} | [
0.5354987382888794,
-0.0931035727262497,
-0.03704946115612984,
-0.5428178310394287,
-0.17079481482505798,
0.3924250602722168,
0.5995888710021973,
-0.9808723330497742,
-0.4202394485473633,
0.6248931288719177,
-0.13233038783073425,
1.2839200496673584,
-1.3128477334976196,
0.00913638155907392... |
func (v Global) Bytes() []byte {
return v.AsBytes()
} | [
-0.548054039478302,
0.5529536604881287,
0.18595290184020996,
-0.6619580388069153,
0.5231402516365051,
1.2575515508651733,
-0.9747951030731201,
-0.8300576210021973,
0.434216171503067,
0.011310314759612083,
-0.3446420133113861,
1.4412810802459717,
-0.6554393172264099,
0.6859637498855591,
-... |
func (v Global) Equal(other Global) bool {
return v.addressLocal.Equal(other.addressLocal) && v.addressBase.Equal(other.addressBase)
} | [
-0.7820726037025452,
-0.3648208677768707,
0.507134199142456,
-0.4402380585670471,
0.10480620712041855,
1.1560417413711548,
-0.007536035031080246,
-0.07464918494224548,
-0.4218652546405792,
0.7807081341743469,
-1.1591637134552002,
0.8041722178459167,
-0.8517217040061951,
0.5063044428825378,... |
func (v Global) Compare(other Global) int {
if cmp := v.addressBase.Compare(other.addressBase); cmp != 0 {
return cmp
}
return v.addressLocal.Compare(other.addressLocal)
} | [
-1.0799386501312256,
0.22561916708946228,
0.5559388995170593,
-0.5997925400733948,
-0.39716580510139465,
0.40705007314682007,
0.3157091736793518,
-0.2717207968235016,
-0.32654431462287903,
0.2725580632686615,
-0.27239513397216797,
0.15996932983398438,
-1.139302134513855,
1.3895959854125977... |
func (v *Global) MarshalJSON() ([]byte, error) {
if v == nil {
return json.Marshal(nil)
}
return json.Marshal(v.String())
} | [
-0.01936929114162922,
0.15776361525058746,
0.2252984195947647,
-0.25419294834136963,
-0.37893080711364746,
-0.3229982554912567,
0.03827672824263573,
0.7498881220817566,
0.6427913308143616,
0.7720264792442322,
-0.46560487151145935,
1.6593258380889893,
-0.7212598919868469,
1.1510282754898071... |
func (sc *SolrConnector) AddDocuments(container interface{}, opt *SolrAddOption) <-chan []byte {
recvChan := make(chan []byte)
var err error
// todo: size constrain should be placed here
defer func() {
if err != nil {
log.Printf("Error occured, uploading document failed")
}
}()
go func(rC chan []byte) {
... | [
-0.6995024681091309,
0.09049352258443832,
0.9501637816429138,
-0.7877764701843262,
0.057017069309949875,
0.029731670394539833,
0.12543050944805145,
-1.300640344619751,
1.1511911153793335,
0.11388207226991653,
0.28963544964790344,
-0.09768691658973694,
-1.3844674825668335,
0.661106526851654... |
func (sc *ESConnector) AddDocuments(container interface{}, opt *SolrAddOption) <-chan []byte {
recvChan := make(chan []byte)
var err error
// todo: size constrain should be placed here
defer func() {
if err != nil {
log.Printf("Error occured, uploading document failed")
}
}()
go func(rC chan []byte) {
b... | [
-0.8795457482337952,
0.10355302691459656,
0.9127674698829651,
-0.7079861760139465,
0.11688371747732162,
0.031309425830841064,
-0.018844863399863243,
-1.2856998443603516,
1.0136507749557495,
0.19236987829208374,
0.4042121469974518,
-0.20860980451107025,
-1.2333942651748657,
0.59382253885269... |
func (s scanner) Bind() error {
if s.binder == nil {
return binder(s.rows, s.target)
}
return s.binder(s.rows, s.target)
} | [
-0.3883708119392395,
-1.2664434909820557,
0.41282588243484497,
0.5561758279800415,
-0.461053729057312,
-0.5108218789100647,
-0.40592604875564575,
-0.04427386820316315,
0.9541020393371582,
-1.4680088758468628,
0.9341891407966614,
0.8660039901733398,
0.097805917263031,
1.0229160785675049,
... |
func New(
addr string,
d discovery.DiscoveryInterface,
dynC dynamic.Interface,
c *http.Client,
dryRun, force, diff bool,
diffFilters []string,
) starlark.HasAttrs {
return &kubePackage{
dClient: d,
dynClient: dynC,
httpClient: c,
Master: addr,
dryRun: dryRun,
force: force,
d... | [
0.023391084745526314,
-0.14701531827449799,
0.5338931679725647,
-0.48954418301582336,
-0.31243160367012024,
-0.10795818269252777,
0.005459582898765802,
0.15981778502464294,
0.1320638358592987,
-0.5505427718162537,
0.5144594311714172,
1.4731335639953613,
0.6085624098777771,
1.12771153450012... |
func (m *kubePackage) Truth() starlark.Bool { return starlark.True } | [
-0.1783473789691925,
0.01471367385238409,
0.4292360842227936,
0.21408407390117645,
1.342393398284912,
1.0757519006729126,
-0.8290302753448486,
0.46649524569511414,
0.17092713713645935,
-0.2903288006782532,
-0.955860435962677,
0.24306756258010864,
-0.7862656712532043,
0.8774576783180237,
... |
func (m *kubePackage) setMetadata(tCtx *addon.SkyCtx, name, namespace string, obj runtime.Object) error {
a := meta.NewAccessor()
objName, err := a.Name(obj)
if err != nil {
return err
}
if objName != "" && objName != name {
return fmt.Errorf("name=`%s' argument does not match object's .metadata.name=`%s'", n... | [
-1.0681707859039307,
-0.5541386008262634,
0.7968819737434387,
-0.35888051986694336,
0.061454035341739655,
0.5184469223022461,
-0.73739093542099,
-0.7877613306045532,
0.49428772926330566,
1.0699299573898315,
-0.10403423756361008,
0.9825679659843445,
0.48305678367614746,
0.6931184530258179,
... |
func (m *kubePackage) kubePutFn(t *starlark.Thread, b *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
var name, namespace, apiGroup, subresource string
data := &starlark.List{}
unpacked := []interface{}{
"name", &name,
"data", &data,
"namespace?", &namespace,
// TOD... | [
-0.5918660759925842,
-0.05317549780011177,
0.6513049006462097,
-0.5062034130096436,
0.4202507734298706,
-0.4249235987663269,
-0.010488945990800858,
0.16057632863521576,
-0.03997687250375748,
0.32210418581962585,
-0.9621511697769165,
0.3643042743206024,
-0.4721730351448059,
-0.0225350148975... |
func (m *kubePackage) kubeDeleteFn(t *starlark.Thread, b *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
if len(args) != 0 {
return nil, fmt.Errorf("<%v>: positional args not supported by `kube.delete': %v", b.Name(), args)
}
if len(kwargs) < 1 {
return nil, fmt.Errorf... | [
-0.3347433805465698,
-0.29281771183013916,
0.611290454864502,
-0.4106326997280121,
-0.06512711942195892,
-0.6162639856338501,
0.04579417034983635,
-0.308269739151001,
-0.1869439035654068,
0.45454511046409607,
0.20075438916683197,
0.07655833661556244,
-0.3733339309692383,
0.3118521869182586... |
func (m *kubePackage) kubeGetFn(t *starlark.Thread, b *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
if len(args) != 0 {
return nil, fmt.Errorf("<%v>: positional args not supported: %v", b.Name(), args)
}
if len(kwargs) < 1 {
return nil, fmt.Errorf("<%v>: expected <re... | [
-0.6038915514945984,
-0.21834051609039307,
0.6917261481285095,
-0.3579709231853485,
0.0058716777712106705,
-0.6701695322990417,
-0.1348719745874405,
-0.4941788911819458,
-0.5705225467681885,
0.21784475445747375,
-0.03187796473503113,
0.36966028809547424,
-0.13445064425468445,
-0.0088725732... |
func (m *kubePackage) kubeExistsFn(t *starlark.Thread, b *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
if len(args) != 0 {
return starlark.False, fmt.Errorf("<%v>: positional args not supported: %v", b.Name(), args)
}
if len(kwargs) < 1 {
return starlark.False, fmt.E... | [
-0.7830088138580322,
-0.38272857666015625,
0.8093005418777466,
-0.05602298304438591,
0.407340407371521,
-0.11171054095029831,
-0.20068664848804474,
-0.1869465708732605,
-0.4634450674057007,
0.7258573174476624,
0.02603796124458313,
-0.249941885471344,
-0.23701928555965424,
0.144617289304733... |
func marshal(msg proto.Message, gvk schema.GroupVersionKind) ([]byte, error) {
msgBytes, err := proto.Marshal(msg)
if err != nil {
return nil, err
}
v, k := gvk.ToAPIVersionAndKind()
unknownBytes, err := proto.Marshal(&runtime.Unknown{
TypeMeta: runtime.TypeMeta{
APIVersion: v,
Kind: k,
},
Raw... | [
0.13466355204582214,
0.028094254434108734,
0.5411261916160583,
0.009578686207532883,
-0.18537861108779907,
1.005772590637207,
-1.2537859678268433,
-0.029655756428837776,
-0.41261380910873413,
0.2543891668319702,
0.13006262481212616,
1.7831251621246338,
-0.7971478700637817,
0.56484609842300... |
func parseHTTPResponse(r *http.Response) (obj runtime.Object, details string, err error) {
raw, err := ioutil.ReadAll(r.Body)
if err != nil {
return nil, "", fmt.Errorf("failed to read body (response code: %d): %v", r.StatusCode, err)
}
log.V(2).Infof("Response raw data: %s", raw)
obj, gvk, err := decode(raw)
... | [
-0.06423446536064148,
-0.7957398891448975,
0.817412793636322,
-0.39937976002693176,
-0.5365585088729858,
-0.11279933899641037,
0.2653743326663971,
-0.7448115348815918,
0.09572985768318176,
0.6998644471168518,
-0.5523456931114197,
0.07623384892940521,
0.1540176123380661,
0.15791837871074677... |
func (m *kubePackage) kubePeek(ctx context.Context, url string) (obj runtime.Object, found bool, err error) {
req, err := http.NewRequest(http.MethodGet, url, nil)
if err != nil {
return nil, false, err
}
log.V(1).Infof("GET to %s", url)
resp, err := m.httpClient.Do(req.WithContext(ctx))
if err != nil {
ret... | [
-0.9078540802001953,
-0.017297694459557533,
0.9963990449905396,
-0.20024146139621735,
0.19578750431537628,
0.531023383140564,
-0.8306179046630859,
-0.4920162558555603,
0.1970437616109848,
0.6348370313644409,
-0.5449988842010498,
0.08311723172664642,
-0.926007866859436,
-0.3212503492832184,... |
func mergeObjects(live, obj runtime.Object) error {
// Service's clusterIP needs to be re-set to the value provided
// by controller or mutation will be denied.
if liveSvc, ok := live.(*corev1.Service); ok {
svc := obj.(*corev1.Service)
svc.Spec.ClusterIP = liveSvc.Spec.ClusterIP
gotPort := liveSvc.Spec.Healt... | [
-0.29497554898262024,
-0.9464983940124512,
0.7033916711807251,
0.10516149550676346,
0.5737374424934387,
0.4317420423030853,
0.388896644115448,
-0.18666906654834747,
0.4208936095237732,
0.39283043146133423,
-0.3240390717983246,
-0.17978790402412415,
-0.1889892816543579,
0.04009726643562317,... |
func maybeRecreate(ctx context.Context, live, obj runtime.Object, m *kubePackage, r *apiResource) error {
err := mergeObjects(live, obj)
if errors.Is(errors.Unwrap(err), ErrUpdateImmutable) && m.force {
if m.dryRun {
fmt.Fprintf(os.Stdout, "\n\n**WARNING** %s %s is immutable and will be deleted and recreated.\n"... | [
-0.08496631681919098,
0.28408464789390564,
0.8022109866142273,
0.10025186091661453,
0.651501476764679,
-0.2856491804122925,
-0.6688608527183533,
-0.377610445022583,
0.3759934902191162,
0.2991475462913513,
0.3708079755306244,
-0.11582504212856293,
-0.41850587725639343,
0.34429019689559937,
... |
func (m *kubePackage) kubeUpdate(ctx context.Context, r *apiResource, msg proto.Message) error {
uri := r.PathWithName()
live, found, err := m.kubePeek(ctx, m.Master+uri)
if err != nil {
return err
}
method := http.MethodPut
if found {
// Reset uri in case subresource update is requested.
uri = r.PathWithS... | [
-0.6396678686141968,
-0.45789241790771484,
0.9070911407470703,
0.00864794384688139,
-0.30104580521583557,
-0.15982747077941895,
-0.11990048736333847,
-0.6698572635650635,
0.4184465706348419,
0.8534719944000244,
-0.25259721279144287,
0.027128098532557487,
-0.7652667164802551,
0.481981694698... |
func (m *kubePackage) kubeDelete(_ context.Context, r *apiResource, foreground bool) error {
var c dynamic.ResourceInterface = m.dynClient.Resource(r.GroupVersionResource())
if r.Namespace != "" {
c = c.(dynamic.NamespaceableResourceInterface).Namespace(r.Namespace)
}
delPolicy := metav1.DeletePropagationBackgro... | [
-0.1146530956029892,
-0.056527383625507355,
0.7614452242851257,
0.34311771392822266,
0.11503267288208008,
-0.010645775124430656,
0.22371412813663483,
-0.1701570302248001,
0.34824758768081665,
1.0448907613754272,
0.6456416845321655,
0.02853337675333023,
-1.3021352291107178,
0.39001229405403... |
func (m *kubePackage) kubeGet(ctx context.Context, r *apiResource, wait time.Duration) (runtime.Object, error) {
url := m.Master + r.PathWithName()
var waitDone <-chan time.Time
if wait != 0 {
waitDone = time.After(wait)
}
// retryInterval is zero so no delay before the first poll.
var retryInterval time.Durat... | [
-0.5003762245178223,
-0.8173111081123352,
0.8874014019966125,
-0.2634793817996979,
0.15659067034721375,
0.23122724890708923,
-0.6752385497093201,
-0.8487205505371094,
-0.2640177309513092,
0.18301545083522797,
0.5458171963691711,
-0.09981002658605576,
-0.7755799293518066,
-0.486361443996429... |
func (self *AccountHandler) ListHandler(c *gin.Context) {
currentUser := self.contextService.MustGetCurrentUser(c)
listParams := self.params.forAdmin(c.Request.URL.RawQuery)
if ok, paramsErrors := listParams.Validate(); !ok {
errcodes.AddErrorMeta(c, errcodes.CodeInvalidQueryParameters, paramsErrors)
return
}
... | [
-0.4785238206386566,
-0.4729476869106293,
0.7838790416717529,
0.20676378905773163,
0.1918250322341919,
-0.21411645412445068,
0.8529304265975952,
0.42141517996788025,
0.7927309274673462,
0.2642989158630371,
0.2001979798078537,
0.27970823645591736,
0.057353805750608444,
0.6846626996994019,
... |
func (self *AccountHandler) ListForUserHandler(c *gin.Context) {
uid := c.Params.ByName("uid")
listParams := self.params.forUser(c.Request.URL.RawQuery)
if ok, paramsErrors := listParams.Validate(); !ok {
errcodes.AddErrorMeta(c, errcodes.CodeInvalidQueryParameters, paramsErrors)
return
}
listParams.AddFilte... | [
-0.4247739911079407,
-0.6272293329238892,
0.4908502697944641,
0.06652534753084183,
-0.3869484066963196,
0.3429291546344757,
0.741972804069519,
0.17074155807495117,
0.07187093794345856,
0.02927190251648426,
0.20713716745376587,
0.11826775223016739,
0.12195704132318497,
0.8876932859420776,
... |
func (h *AccountHandler) AdminListHandler(c *gin.Context) {
listParams := h.params.forAdmin(c.Request.URL.RawQuery)
if ok, paramsErrors := listParams.Validate(); !ok {
errcodes.AddErrorMeta(c, errcodes.CodeInvalidQueryParameters, paramsErrors)
return
}
accounts, err := h.service.GetList(listParams)
if err != ... | [
-0.37031054496765137,
-0.2520316243171692,
0.6305714845657349,
-0.4483756124973297,
0.034927379339933395,
-0.20434530079364777,
0.1229841560125351,
-0.013862859457731247,
0.8088337779045105,
0.39353063702583313,
-0.1711280643939972,
0.5647985935211182,
-0.3334238529205322,
1.00461506843566... |
func (h *AccountHandler) GetHandler(c *gin.Context) {
account := h.contextService.GetRequestedAccount(c)
if account == nil {
errcodes.AddError(c, errcodes.CodeAccountNotFound)
return
}
h.repo.FillUser(account)
c.JSON(http.StatusOK, response.New().SetData(account))
} | [
-0.34886398911476135,
0.497444748878479,
0.6319476366043091,
0.2978830933570862,
0.9312434792518616,
0.1586185097694397,
0.618331253528595,
-0.039615046232938766,
0.5951954126358032,
-0.475536048412323,
0.08358532935380936,
0.7535211443901062,
0.031295400112867355,
0.28564226627349854,
0... |
func (h *AccountHandler) CreateHandler(c *gin.Context) {
currentUser := h.contextService.MustGetCurrentUser(c)
action := authService.ActionHas
resource := authService.ResourcePermission
var f form.Account
err := c.ShouldBindJSON(&f)
if err != nil {
errors.AddShouldBindError(c, err)
return
}
if !f.Initial... | [
0.19281305372714996,
-0.3243282735347748,
0.5732967257499695,
1.1072709560394287,
0.3672782778739929,
0.34662970900535583,
0.9471755623817444,
-0.21132683753967285,
-0.13952897489070892,
-0.11708129942417145,
0.5290881991386414,
-0.14954853057861328,
0.08002577722072601,
0.792043924331665,... |
func (h *AccountHandler) UpdateHandler(c *gin.Context) {
account := h.contextService.GetRequestedAccount(c)
if account == nil {
errcodes.AddError(c, errcodes.CodeAccountNotFound)
return
}
currentUser := h.contextService.MustGetCurrentUser(c)
var editable model.AccountEditable
err := c.ShouldBindJSON(&editab... | [
-0.9142014980316162,
-0.9206979870796204,
0.6365184187889099,
0.7331151366233826,
-0.5723717212677002,
0.57352614402771,
1.0654749870300293,
0.02804373763501644,
0.21814905107021332,
0.23105010390281677,
0.23485338687896729,
0.576758861541748,
-0.3811393678188324,
0.04644538462162018,
1.... |
func (h *AccountHandler) GenerateNumberHandler(c *gin.Context) {
f := form.GenerateNumber{}
_ = c.ShouldBindJSON(&f)
number := h.service.GenerateAccountNumberWithPrefix(f.Prefix)
c.JSON(http.StatusOK, response.New().SetData(number))
} | [
-1.0371661186218262,
-0.12953191995620728,
0.482028603553772,
0.3763408660888672,
-0.23643797636032104,
0.32285061478614807,
0.9208491444587708,
0.593173086643219,
0.6679653525352478,
-0.3801979720592499,
-0.9256429672241211,
0.11229372769594193,
0.48980018496513367,
0.3269164264202118,
... |
func (h *AccountHandler) DeleteHandler(c *gin.Context) {
errcodes.AddError(c, errcodes.CodeForbidden)
} | [
0.5043654441833496,
0.7130611538887024,
0.33726590871810913,
0.6215412020683289,
0.19240643084049225,
1.091979742050171,
0.988010823726654,
0.5363447666168213,
0.5465749502182007,
-0.7470811009407043,
0.9003066420555115,
0.9600812792778015,
-0.22477363049983978,
0.9567848443984985,
0.932... |
func (h *AccountHandler) ImportCsvHandler(c *gin.Context) {
logger := h.logger.New("action", "ImportCsvHandler")
currentUser := h.contextService.MustGetCurrentUser(c)
action := authService.ActionHas
resource := authService.ResourcePermission
file, _, err := c.Request.FormFile("file")
if nil != err {
logger.E... | [
0.1683921068906784,
-0.3610669672489166,
0.9690661430358887,
0.941185474395752,
0.46098965406417847,
0.4543934762477875,
1.1283823251724243,
-0.5742912292480469,
0.14524154365062714,
0.039970602840185165,
0.1152903139591217,
0.550102174282074,
-0.13524891436100006,
-0.03071545623242855,
... |
func mergeMessages(src, dst []*translation.Message) []*translation.Message {
merged := make(map[string]*translation.Message)
for idx := range dst {
merged[dst[idx].ID] = dst[idx]
}
for idx := range src {
merged[src[idx].ID] = src[idx]
}
var out []*translation.Message
for _, message := range merged {
out = ... | [
-1.049017310142517,
0.4238230884075165,
0.5987825989723206,
-0.6942384839057922,
0.1441383808851242,
-0.13673284649848938,
-1.2375236749649048,
-0.7690581679344177,
-0.42792853713035583,
0.5434505343437195,
-0.4491589665412903,
0.2407371997833252,
0.19749164581298828,
0.3395722806453705,
... |
func TestFullFilePassParse(t *testing.T) {
// the test case are the files in this directory. The expected file is located in the expected
// directory.
for _, name := range glob("sqlparser_test/full_file/pass/*.sql") {
sql, err := ioutil.ReadFile(name)
if err != nil {
t.Errorf("Skipping test %v, got error try... | [
0.49220651388168335,
-0.32651767134666443,
0.8192153573036194,
-0.1498691290616989,
0.06651224195957184,
0.42370057106018066,
0.08190616220235825,
0.3146460950374603,
-0.2187352478504181,
0.16867190599441528,
-0.08533667773008347,
-0.12875929474830627,
-0.04111833870410919,
0.1481896340847... |
func TestFullFileFailParse(t *testing.T) {
// the test case are the files in this directory. The expected file is located in the expected
// directory.
for _, name := range glob("sqlparser_test/full_file/fail/*.sql") {
sql, err := ioutil.ReadFile(name)
if err != nil {
t.Errorf("Skipping test %v, got error try... | [
0.70920330286026,
0.1760053038597107,
0.7186936140060425,
-0.4653853178024292,
0.08637604117393494,
0.09152793884277344,
-0.0579814612865448,
0.3302477300167084,
-0.3378552198410034,
-0.21609334647655487,
-0.4607783854007721,
-0.15736135840415955,
-0.23861287534236908,
0.40409916639328003,... |
func Sizeof(objs ...interface{}) (sz uint64) {
for i := range objs {
sz += sizeofInternal(reflect.ValueOf(objs[i]), false, 0)
}
return
} | [
-0.3979114592075348,
0.7192169427871704,
0.5068487524986267,
0.6534559726715088,
-0.35308563709259033,
0.024244137108325958,
0.9161915183067322,
-0.319191038608551,
0.4381784498691559,
0.1900489628314972,
-0.11517997831106186,
-1.3320657014846802,
-0.0773831382393837,
0.7064603567123413,
... |
func NewProcessor(kubeconfig string) (*Processor, error) {
gen, err := generator.NewGenerator()
if err != nil {
return nil, fmt.Errorf("Could not create generator: %v", err)
}
config, err := clientcmd.BuildConfigFromFlags("", kubeconfig)
if err != nil {
return nil, err
}
clientset, err := kubernetes.NewFor... | [
-0.36091771721839905,
-0.7563167810440063,
0.11197598278522491,
-0.7161555886268616,
-1.2602949142456055,
0.2591763734817505,
-0.1593962460756302,
-0.012399869039654732,
-0.46606284379959106,
0.7544306516647339,
-0.08184647560119629,
0.0045747216790914536,
-1.1060328483581543,
0.8324869871... |
func (p *Processor) GeneratePSP(cssList []types.ContainerSecuritySpec, pssList []types.PodSecuritySpec) *v1beta1.PodSecurityPolicy {
return p.gen.GeneratePSP(cssList, pssList, p.namespace, p.serverGitVersion)
} | [
-0.5773437023162842,
0.31794801354408264,
0.46877357363700867,
0.4362974762916565,
0.18829546868801117,
0.8651862740516663,
-0.9039953947067261,
-0.2663145363330841,
0.341386616230011,
0.33282986283302307,
-0.9594670534133911,
-0.3946342170238495,
-0.5066830515861511,
0.4376271963119507,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.