text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func Test_Provider(t *testing.T) {
// SetLogLevel("TRACE")
// CheckVersion()
// Start provider API in the background
go InitProvider()
// err := InitProvider()
// if err != nil {
// log.Fatalf("Error initializing Provider %+v", err)
// }
verifier := HTTPVerifier{}
// Authorization middleware
// This is yo... | [
-0.17570044100284576,
-0.06660544127225876,
0.735849916934967,
0.9672609567642212,
0.35351186990737915,
0.6593626141548157,
0.7944082617759705,
-0.33792421221733093,
0.6960774064064026,
-0.003883494297042489,
-0.35618865489959717,
0.3048732578754425,
-0.3454144299030304,
0.2239410877227783... |
func SetVaultConfig(config *config.Vault) Option {
return func(o *Options) {
o.VaultConfig = config
}
} | [
1.1635079383850098,
-0.5006350874900818,
0.42947661876678467,
0.6187936067581177,
-0.44012126326560974,
0.2525145709514618,
-0.036531370133161545,
0.20621690154075623,
0.8489016890525818,
0.2757997214794159,
-1.5304045677185059,
0.3827251195907593,
0.923583447933197,
1.198427677154541,
-... |
func NewVaultInterface() (*Vault, error) {
log.Println("GetConfig|Starting the vault-init service...")
v := &Vault{
HTTPClient: http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
},
},
SignalCh: make(chan os.Signal),
Stop: func() {
log.Pri... | [
0.25666192173957825,
-0.9277381300926208,
0.4306938350200653,
0.18006011843681335,
-0.25926074385643005,
0.10773837566375732,
-0.18041187524795532,
-0.9793674945831299,
0.18495076894760132,
-0.06260541081428528,
-0.881643533706665,
-0.13681389391422272,
-0.6567718982696533,
0.4693633913993... |
func (v *Vault) ProcessInitVault(initRequest *utils.InitRequest) error {
initRequestData, err := json.Marshal(&initRequest)
if err != nil {
return fmt.Errorf("ProcessInitVault|Error marshalling initRequest %w", err)
}
// log.Printf("Initializing vault with %v\n", string(initRequestData))
r := bytes.NewReader(in... | [
-0.40585365891456604,
-1.0336761474609375,
1.0689051151275635,
-0.03154182806611061,
0.36628997325897217,
-0.7783834338188171,
-0.2802901566028595,
-0.7378299832344055,
0.3281400799751282,
0.8991373181343079,
-0.6679072976112366,
0.7818050980567932,
-0.6387117505073547,
0.5069535374641418,... |
func (v *Vault) StoreEncryptedResponse() error {
//Export to session specified in config files
//Export to session specified in config files
var exportTo []cas.ExportTo
if v.Opt.CASConfig.GetExportToSessionName() == nil {
log.Printf("ExportToSession Object null, please check this is provided to export the tokens"... | [
0.15820112824440002,
-0.8330746293067932,
0.6614322066307068,
-0.45435333251953125,
0.6689404249191284,
-0.3808194100856781,
0.00459389528259635,
-0.8218095898628235,
0.8721574544906616,
-0.12608256936073303,
-1.475228190422058,
0.4214669466018677,
-0.47243180871009827,
-0.1943763047456741... |
func (v *Vault) StoreDecryptedResponse() error {
//Export to session specified in config files
var exportTo []cas.ExportTo
if v.Opt.CASConfig.GetExportToSessionName() == nil {
log.Printf("ExportToSession Object null, please check this is provided to export the tokens")
return nil
}
for x := range v.Opt.CASConf... | [
0.31430983543395996,
-0.7156811952590942,
0.618411660194397,
-0.1090044304728508,
0.5897555351257324,
-0.46396970748901367,
0.04670756682753563,
-0.7693352699279785,
0.8564930558204651,
-0.4054952561855316,
-1.4018629789352417,
0.39669063687324524,
-0.3981037437915802,
-0.23103700578212738... |
func (v *Vault) Run() {
go func() {
<-v.SignalCh
v.Stop()
}()
for {
err := v.CheckInitStatus()
if err != nil {
log.Printf("Run|Error checking initStatus %v", err)
os.Exit(1)
}
response, err := v.HTTPClient.Get(v.Opt.VaultConfig.Address() + "/v1/sys/health")
if response != nil && response.Body !=... | [
-0.6215106248855591,
-1.3494328260421753,
0.9750099182128906,
0.24167384207248688,
0.2017546147108078,
0.3434703052043915,
0.7709224224090576,
-0.5597790479660034,
-0.14590251445770264,
-0.2526271641254425,
-0.41201844811439514,
0.34033724665641785,
-0.5996056795120239,
0.7579288482666016,... |
func GetGrades(config map[string]string) map[string]util.Module {
client := new(portalClient)
client.config = config
client.loginPortal()
grades := client.crawlPortal()
client.getPage(config["logout"], false)
return grades
} | [
-0.3230610489845276,
0.5654895901679993,
0.6721984148025513,
-0.03532874211668968,
0.643465518951416,
1.001043677330017,
-0.5490204095840454,
-0.3804164230823517,
-0.16217541694641113,
0.0877334251999855,
-0.1521444171667099,
0.6638526320457458,
-1.0673983097076416,
0.14866986870765686,
... |
func (client *portalClient) loginPortal() {
config := client.config
// retrieve login information from cas login page
xml := client.getPage(config["server"], true)
client.loginTicket = client.getData(xml, loginticketXPath)
client.execution = client.getData(xml, executionXPath)
// post authentication
client.authe... | [
-0.45270031690597534,
-0.42893803119659424,
0.6086459159851074,
-0.10975084453821182,
-0.6627119779586792,
1.00518798828125,
-0.18666721880435944,
0.18419146537780762,
0.27755433320999146,
-0.7651640772819519,
-0.8412650227546692,
0.7943565249443054,
-1.3437973260879517,
-0.496788203716278... |
func (client *portalClient) getPage(url string, cookie bool) (htmlString string) {
req, err := http.NewRequest("GET", url, nil)
if err != nil {
log.Fatal(err)
}
if cookie {
req.Header.Add("Cookie", client.jar.Encode())
}
req.Header.Add("User-Agent", client.config["user-agent"])
page, err := client.http.Do(r... | [
-0.44804030656814575,
0.49229201674461365,
0.8197801113128662,
0.4097033441066742,
-0.39799103140830994,
0.046517129987478256,
-0.26800301671028137,
-0.09941726177930832,
0.017482874915003777,
0.8528861999511719,
1.6173443794250488,
0.44722050428390503,
-1.4245777130126953,
0.0104687511920... |
func (client *portalClient) getData(htmlString string, xpath string) (val string) {
xml, err := xmlpath.ParseHTML(strings.NewReader(htmlString))
if err != nil {
log.Fatal(err)
}
path := xmlpath.MustCompile(xpath)
if value, ok := path.String(xml); ok {
val = value
}
return
} | [
0.18627670407295227,
0.0897139385342598,
0.6525517702102661,
-0.14820553362369537,
0.14979876577854156,
0.7089582681655884,
-0.31400665640830994,
-0.06788714975118637,
0.4081377387046814,
-0.41304072737693787,
0.5384343862533569,
0.6567052602767944,
0.04520096629858017,
-0.9524552822113037... |
func (client *portalClient) getDataNode(htmlString string, xpath string) (val *xmlpath.Iter) {
xml, err := xmlpath.ParseHTML(strings.NewReader(htmlString))
if err != nil {
log.Fatal(err)
}
path := xmlpath.MustCompile(xpath)
val = path.Iter(xml)
return
} | [
-0.11207980662584305,
0.310303270816803,
0.42708268761634827,
-0.7730603814125061,
-0.201371967792511,
0.04720977693796158,
-0.7286658883094788,
0.17400075495243073,
-0.6501760482788086,
-0.29941797256469727,
0.5983694791793823,
1.3746776580810547,
0.24331162869930267,
-0.7900227904319763,... |
func (client *portalClient) authenticate() {
config := client.config
data := url.Values{}
data.Add("username", config["username"])
data.Add("password", config["password"])
data.Add("lt", client.loginTicket)
data.Add("execution", client.execution)
data.Add("_eventId", "submit")
data.Add("submit", "Anmelden")
pa... | [
-0.8361308574676514,
-0.04274771362543106,
0.8339390158653259,
0.49577513337135315,
-0.12261112779378891,
-0.13317815959453583,
-0.07204940915107727,
0.017914915457367897,
-0.3281170725822449,
0.7568947076797485,
-0.32873785495758057,
0.8247228264808655,
-1.1056007146835327,
0.267987549304... |
func (client *portalClient) processTable(table *xmlpath.Iter) (grades map[string]util.Module) {
grades = make(map[string]util.Module)
if table.Next() {
node := table.Node()
path := xmlpath.MustCompile(examTableGradeRowXPath)
iter := path.Iter(node)
grades = client.processRow(iter, grades)
}
return
} | [
-0.7849127054214478,
-0.09230528771877289,
0.7567301988601685,
0.1573036164045334,
-0.5390747785568237,
0.4030556082725525,
0.07556207478046417,
-0.5724934339523315,
-0.07487085461616516,
0.7540528178215027,
0.5503576397895813,
-0.7400128841400146,
0.46609818935394287,
1.107643485069275,
... |
func (client *portalClient) processRow(rows *xmlpath.Iter, grades map[string]util.Module) map[string]util.Module {
if rows.Next() {
rowstring := rows.Node().String()
rowstring = strings.Replace(rowstring, "//-->", "", -1)
rowstring = strings.Replace(rowstring, "<!--", "", -1)
rowstring = strings.Replace(rowstr... | [
-0.2989870011806488,
-0.2899962365627289,
1.0552104711532593,
-0.4566118121147156,
-0.5387279391288757,
-0.11372624337673187,
-0.27118659019470215,
0.0323735810816288,
0.37461820244789124,
0.6742347478866577,
0.41907572746276855,
-0.28523507714271545,
-0.049021974205970764,
0.3797090947628... |
func newFreeClientPool(db ethdb.Database, connectedLimit, totalLimit int, clock mclock.Clock) *freeClientPool {
pool := &freeClientPool{
db: db,
clock: clock,
addressMap: make(map[string]*freeClientPoolEntry),
connPool: prque.New(poolSetIndex),
disconnPool: prque.New(poolSet... | [
-0.011304936371743679,
-0.4213821291923523,
-0.025759318843483925,
-0.9791876077651978,
-1.7816568613052368,
0.15872074663639069,
0.6672606468200684,
-1.187270164489746,
0.40503382682800293,
0.02475900389254093,
-0.4802118241786957,
0.4219586253166199,
-0.6125660538673401,
-0.4704995453357... |
func (f *freeClientPool) connect(address string, disconnectFn func()) bool {
f.lock.Lock()
defer f.lock.Unlock()
if f.closed {
return false
}
e := f.addressMap[address]
now := f.clock.Now()
var recentUsage int64
if e == nil {
e = &freeClientPoolEntry{address: address, index: -1}
f.addressMap[address] = e... | [
-0.2132076919078827,
0.3873648941516876,
0.7859063148498535,
-0.9825775027275085,
-1.1581015586853027,
-0.12234101444482803,
0.2981647551059723,
-0.49641674757003784,
-0.08148633688688278,
0.6861728429794312,
-0.04462059214711189,
0.1511358618736267,
-0.448473185300827,
-0.3106004297733307... |
func (f *freeClientPool) disconnect(address string) {
f.lock.Lock()
defer f.lock.Unlock()
if f.closed {
return
}
e := f.addressMap[address]
now := f.clock.Now()
if !e.connected {
log.Debug("Client already disconnected", "address", address)
return
}
f.connPool.Remove(e.index)
f.calcLogUsage(e, now)
e.... | [
-0.5948320627212524,
0.4761469066143036,
0.5126762390136719,
-1.2558228969573975,
-0.9505771994590759,
0.09537657350301743,
0.7070607542991638,
-0.7206375002861023,
0.2940254211425781,
0.8574199676513672,
-0.3881315588951111,
0.6401611566543579,
-0.739514172077179,
-0.07333041727542877,
... |
func (f *freeClientPool) logOffset(now mclock.AbsTime) int64 {
// Note: fixedPointMultiplier acts as a multiplier here; the reason for dividing the divisor
// is to avoid int64 overflow. We assume that int64(recentUsageExpTC) >> fixedPointMultiplier.
logDecay := int64((time.Duration(now - f.startupTime)) / (recentUs... | [
-0.11979204416275024,
-0.07440884411334991,
0.329775869846344,
-1.0152320861816406,
-1.1899957656860352,
0.012654326856136322,
0.5364965796470642,
-1.0441207885742188,
-0.1568799614906311,
-0.17233626544475555,
0.44690772891044617,
0.7756006717681885,
-0.09073380380868912,
-0.1541137397289... |
func (f *freeClientPool) calcLogUsage(e *freeClientPoolEntry, now mclock.AbsTime) {
dt := e.linUsage + int64(now)
if dt < 1 {
dt = 1
}
e.logUsage = int64(math.Log(float64(dt))*fixedPointMultiplier) + f.logOffset(now)
} | [
-0.3267628252506256,
0.46383136510849,
0.47396400570869446,
-0.679693341255188,
-1.242430329322815,
-0.04489189013838768,
-0.0629952922463417,
-0.5292478799819946,
0.15398555994033813,
0.8011358380317688,
-0.2829386293888092,
0.5348103046417236,
0.3666834235191345,
0.343168169260025,
0.7... |
func (f *freeClientPool) loadFromDb() {
enc, err := f.db.Get([]byte("freeClientPool"))
if err != nil {
return
}
var storage freeClientPoolStorage
err = rlp.DecodeBytes(enc, &storage)
if err != nil {
log.Error("Failed to decode client list", "err", err)
return
}
f.logOffsetAtStartup = int64(storage.LogOffs... | [
0.11503148823976517,
0.188913956284523,
0.2812129259109497,
-0.9206448793411255,
-0.4903169274330139,
0.46709781885147095,
-0.17988108098506927,
-0.8374798893928528,
-0.13344450294971466,
0.20436088740825653,
-0.9063045978546143,
-0.36438611149787903,
-0.8921739459037781,
0.503745317459106... |
func (f *freeClientPool) saveToDb() {
now := f.clock.Now()
storage := freeClientPoolStorage{
LogOffset: uint64(f.logOffset(now)),
List: make([]*freeClientPoolEntry, len(f.addressMap)),
}
i := 0
for _, e := range f.addressMap {
if e.connected {
f.calcLogUsage(e, now)
}
storage.List[i] = e
i++
}... | [
-0.6856502294540405,
0.3806086778640747,
0.5854262709617615,
-0.6417776346206665,
0.1623566597700119,
0.7886532545089722,
0.9998340606689453,
-0.9945555925369263,
-0.2707441747188568,
0.9419209957122803,
-1.2684000730514526,
-0.5408229231834412,
-0.8341737389564514,
0.3966185450553894,
0... |
func poolSetIndex(a interface{}, i int) {
a.(*freeClientPoolEntry).index = i
} | [
-0.42342519760131836,
-0.3822292685508728,
-0.007606686558574438,
-1.0334513187408447,
-0.5295371413230896,
0.9648665189743042,
1.366363525390625,
-0.9303526282310486,
-0.20588624477386475,
0.3984485864639282,
-0.9943600296974182,
1.2236764430999756,
-0.0691056102514267,
-0.631016731262207... |
func RegisterRoutes(clientCtx client.Context, r *mux.Router) {
registerQueryRoutes(clientCtx, r)
registerTxRoutes(clientCtx, r)
} | [
0.12146175652742386,
1.0652180910110474,
0.2928140163421631,
-0.39476531744003296,
-0.0076715233735740185,
0.6412479281425476,
-0.508648693561554,
-0.046839337795972824,
0.29345187544822693,
-0.2781955301761627,
0.06846542656421661,
0.008007277734577656,
-0.3065875172615051,
0.093140266835... |
func (pss *PAKEShareServer) Marshal() ([]byte, error) {
return syntax.Marshal(pss)
} | [
0.2683612108230591,
0.2174176573753357,
0.1926661729812622,
-0.1489323079586029,
0.03982853889465332,
0.08523375540971756,
-1.712551236152649,
-0.19842389225959778,
0.422018438577652,
-1.2326031923294067,
0.15954039990901947,
1.060348629951477,
-0.6259524822235107,
0.8760459423065186,
0.... |
func (pss *PAKEShareServer) Unmarshal(data []byte) (int, error) {
return syntax.Unmarshal(data, pss)
} | [
-0.2982066869735718,
0.7796040773391724,
0.4187442660331726,
-1.211553692817688,
-0.2618410885334015,
-0.6221086382865906,
-0.2742176949977875,
0.6933936476707458,
0.22427695989608765,
-0.7682123780250549,
-0.2838578522205353,
-0.17173747718334198,
-0.9307053089141846,
0.18862931430339813,... |
func (*PAKEShareServer) Type() PAKEShareType {
return PAKEShareTypeServer
} | [
-0.12299682945013046,
0.14497078955173492,
0.4376859962940216,
-0.11301669478416443,
0.6650118231773376,
0.37499165534973145,
-0.40523025393486023,
-1.1115553379058838,
0.9341264963150024,
0.03182757645845413,
-0.016770439222455025,
0.45329153537750244,
-1.5163183212280273,
0.9313938617706... |
func (psc *PAKEShareClient) Marshal() ([]byte, error) {
return syntax.Marshal(psc)
} | [
1.1714518070220947,
0.36892420053482056,
0.10105384886264801,
-0.39429691433906555,
0.15401902794837952,
-0.05048911273479462,
-1.2704495191574097,
-0.3749620318412781,
-0.6442875862121582,
-1.2000868320465088,
0.4718300998210907,
1.393934726715088,
-0.6528890132904053,
0.7742142677307129,... |
func (psc *PAKEShareClient) Unmarshal(data []byte) (int, error) {
return syntax.Unmarshal(data, psc)
} | [
0.37067660689353943,
0.8272824883460999,
0.4142053723335266,
-1.4683879613876343,
-0.40685245394706726,
-0.7742447853088379,
-0.049460649490356445,
0.6071736812591553,
-0.7676595449447632,
-0.8523750305175781,
0.1022382602095604,
0.1431192308664322,
-0.918832540512085,
0.002508871722966432... |
func (*PAKEShareClient) Type() PAKEShareType {
return PAKEShareTypeClient
} | [
0.8223965764045715,
0.3166080415248871,
0.22950616478919983,
-0.34650111198425293,
0.5199806094169617,
0.30218181014060974,
-0.2845778465270996,
-1.2898513078689575,
0.359924852848053,
0.15207664668560028,
0.2941140830516815,
0.33876848220825195,
-1.2719534635543823,
0.41619136929512024,
... |
func (psae *PAKEServerAuthExtension) Type() mint.ExtensionType {
return ExtensionTypeOpaqueServerAuth
} | [
0.24605678021907806,
-0.023181840777397156,
0.29442939162254333,
0.5329961180686951,
-0.5025517344474792,
0.12324550747871399,
-0.6424246430397034,
-0.9058533906936646,
2.494358539581299,
0.2532811760902405,
0.26179084181785583,
0.913946807384491,
-0.9970179796218872,
-0.01253675576299429,... |
func (psae *PAKEServerAuthExtension) Marshal() ([]byte, error) {
var clientShare *PAKEShareClient
var serverShare *PAKEShareServer
switch psae.PAKEShare.Type() {
case PAKEShareTypeClient:
clientShare = psae.PAKEShare.(*PAKEShareClient)
case PAKEShareTypeServer:
serverShare = psae.PAKEShare.(*PAKEShareServer)
... | [
0.13543292880058289,
0.4828243553638458,
0.6299576163291931,
-0.028134968131780624,
-0.6961225867271423,
0.35991525650024414,
-0.760319173336029,
-0.007542390376329422,
0.7407469153404236,
-0.3065369725227356,
0.27237436175346375,
1.3826472759246826,
-0.6073675751686096,
0.5202100872993469... |
func (psae *PAKEServerAuthExtension) Unmarshal(data []byte) (int, error) {
inner := &pakeServerAuthExtensionInner{}
bytesRead, err := syntax.Unmarshal(data, inner)
if err != nil {
return 0, err
}
var share PAKEShare
if inner.ClientShare != nil && inner.ServerShare == nil {
share = inner.ClientShare
} else ... | [
-0.049156710505485535,
0.6211506128311157,
0.8268529772758484,
-0.27395302057266235,
-1.0365395545959473,
-0.21992705762386322,
0.07723080366849899,
0.8351361751556396,
0.6364642977714539,
0.2399769127368927,
-0.3075152337551117,
0.63216632604599,
-0.8363906145095825,
-0.514556884765625,
... |
func (pcae *PAKEClientAuthExtension) Type() mint.ExtensionType {
return ExtensionTypeOpaqueClientAuth
} | [
0.9624055027961731,
-0.30805134773254395,
0.11303035914897919,
-0.1538369059562683,
-0.32349956035614014,
0.3750830590724945,
-0.4797489643096924,
-1.0776190757751465,
1.8172988891601562,
-0.03296501561999321,
0.5947130918502808,
0.6959749460220337,
-0.6933411359786987,
-0.5989524722099304... |
func (pcae *PAKEClientAuthExtension) Marshal() ([]byte, error) {
return syntax.Marshal(pcae)
} | [
0.5141053795814514,
0.3646829426288605,
0.08839768171310425,
-0.1468856781721115,
-0.9811522364616394,
0.4908079206943512,
-1.1363462209701538,
0.056260302662849426,
0.8936694264411926,
-0.588458776473999,
0.5918635129928589,
1.0669313669204712,
-0.22062386572360992,
0.03580249845981598,
... |
func (pcae *PAKEClientAuthExtension) Unmarshal(data []byte) (int, error) {
return syntax.Unmarshal(data, pcae)
} | [
-0.08054385334253311,
0.799273669719696,
0.35375428199768066,
-1.0511207580566406,
-1.4770392179489136,
-0.27721133828163147,
-0.3133879601955414,
0.8744595646858215,
0.6542989015579224,
-0.2226400077342987,
0.03765907511115074,
0.3080808222293854,
-0.44001126289367676,
-0.8051766753196716... |
func NewCertificateOPAQUESign(privKey crypto.Signer) *CertificateOPAQUESign {
_, x509cert, _ := mint.MakeNewSelfSignedCert("dummy", OPAQUESIGNSignatureScheme) // make the cert msg non-empty
return &CertificateOPAQUESign{
Chain: []*x509.Certificate{x509cert},
PrivateKey: privKey,
}
} | [
0.037336088716983795,
-0.06430564820766449,
0.3616379499435425,
-0.05709865316748619,
-1.002455472946167,
-0.9004918336868286,
-0.23088069260120392,
-0.05380960926413536,
-0.4762134552001953,
-0.03994955122470856,
-0.6362696886062622,
-0.380708247423172,
0.005493028089404106,
0.16484871506... |
func (*HttpRule) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _HttpRule_OneofMarshaler, _HttpRule_OneofUnmarshaler, _HttpRule_OneofSizer, []interface{}{
(*HttpRule_Get)... | [
-0.23436953127384186,
0.8949703574180603,
0.5288889408111572,
-1.2094767093658447,
1.0841281414031982,
-0.21103964745998383,
0.48635977506637573,
-0.8933948874473572,
-0.26508596539497375,
-0.3341022729873657,
-0.03992075100541115,
0.5515568256378174,
-0.7662721872329712,
1.118892908096313... |
func (*ServerSubmitOrderRequest) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*ServerSubmitOrderRequest_Ask)(nil),
(*ServerSubmitOrderRequest_Bid)(nil),
}
} | [
-2.067945957183838,
-0.009014167822897434,
0.5153088569641113,
0.1909465789794922,
-0.05930634215474129,
-0.22544905543327332,
-0.36088815331459045,
-0.8150722980499268,
0.6565968990325928,
0.5682225227355957,
-0.42994067072868347,
0.7887855768203735,
-0.4968021512031555,
2.013950347900390... |
func (*ServerSubmitOrderResponse) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*ServerSubmitOrderResponse_InvalidOrder)(nil),
(*ServerSubmitOrderResponse_Accepted)(nil),
}
} | [
-1.4234859943389893,
-0.36189213395118713,
0.47249382734298706,
0.01718848943710327,
-0.20217959582805634,
-0.36380571126937866,
-0.4944542944431305,
-0.34610041975975037,
1.295649528503418,
0.28851187229156494,
-0.6087133288383484,
0.18745645880699158,
-0.4861198365688324,
1.6329004764556... |
func (*ClientAuctionMessage) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*ClientAuctionMessage_Commit)(nil),
(*ClientAuctionMessage_Subscribe)(nil),
(*ClientAuctionMessage_Accept)(nil),
(*ClientAuctionMessage_Reject)(nil),
(*ClientAuctionMessage_Sign)(nil),
(*ClientAuctionMessage_Recover)(ni... | [
-0.5979087948799133,
0.02048783004283905,
0.4103413224220276,
-0.28335484862327576,
0.8148682713508606,
-0.517094075679779,
0.2636552155017853,
-0.6859977841377258,
0.6376007795333862,
-0.1717052310705185,
0.19763000309467316,
0.15681476891040802,
-0.20461741089820862,
0.8292695879936218,
... |
func (*ServerAuctionMessage) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*ServerAuctionMessage_Challenge)(nil),
(*ServerAuctionMessage_Success)(nil),
(*ServerAuctionMessage_Error)(nil),
(*ServerAuctionMessage_Prepare)(nil),
(*ServerAuctionMessage_Sign)(nil),
(*ServerAuctionMessage_Finalize)(... | [
-0.9512472748756409,
-0.13617047667503357,
0.5879985690116882,
0.0641365647315979,
0.5741862654685974,
-0.4674960672855377,
0.24092280864715576,
-0.579871654510498,
0.7825639247894287,
0.2080787718296051,
-0.10880013555288315,
0.48125213384628296,
-0.1487336903810501,
1.149461269378662,
... |
func (m *TermsResponse) GetMaxOrderDurationBlocks() uint32 {
if m != nil {
return m.MaxOrderDurationBlocks
}
return 0
} | [
-0.1247493103146553,
-0.45025935769081116,
0.3347232937812805,
1.194657802581787,
-0.3191079795360565,
-0.037411879748106,
-0.45894351601600647,
-0.6061047911643982,
0.7802165150642395,
0.09959591180086136,
-0.7584823966026306,
-0.290029376745224,
-0.3971097469329834,
0.6655260324478149,
... |
func DisplayPortfolio(ctx context.Context, dataChannel chan api.AssetData, sendData *bool) error {
// Initialise UI
if err := ui.Init(); err != nil {
return fmt.Errorf("failed to initialise termui: %v", err)
}
defer ui.Close()
// Initialise page
page := newPortfolioPage()
selectedTable := page.CoinTable
uti... | [
0.2908362150192261,
0.06973054260015488,
0.7120314836502075,
-0.9942194819450378,
0.12425214052200317,
0.18454141914844513,
0.7594113349914551,
-0.878126859664917,
-0.4248195290565491,
0.8695353865623474,
-0.052048299461603165,
0.3712550103664398,
-0.44349780678749084,
0.3324746787548065,
... |
func NewEndpointAttachment(ctx *pulumi.Context,
name string, args *EndpointAttachmentArgs, opts ...pulumi.ResourceOption) (*EndpointAttachment, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.OrganizationId == nil {
return nil, errors.New("invalid value for ... | [
-0.8637667298316956,
0.10479075461626053,
0.4579352140426636,
0.32403016090393066,
0.04466980695724487,
1.32327139377594,
-0.3692129850387573,
0.14893516898155212,
0.4305916726589203,
0.8435578346252441,
0.19338898360729218,
0.18912099301815033,
-0.9842792749404907,
0.07453995943069458,
... |
func GetEndpointAttachment(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *EndpointAttachmentState, opts ...pulumi.ResourceOption) (*EndpointAttachment, error) {
var resource EndpointAttachment
err := ctx.ReadResource("google-native:apigee/v1:EndpointAttachment", name, id, state, &resource, opts...)
if ... | [
-0.4818387031555176,
-0.34501218795776367,
0.33621859550476074,
0.38816896080970764,
-0.22142423689365387,
1.0183755159378052,
-0.6983086466789246,
-0.5123364925384521,
1.1001272201538086,
0.510247528553009,
0.697803795337677,
0.8885413408279419,
-0.7670694589614868,
-0.9135991334915161,
... |
func (o EndpointAttachmentOutput) ConnectionState() pulumi.StringOutput {
return o.ApplyT(func(v *EndpointAttachment) pulumi.StringOutput { return v.ConnectionState }).(pulumi.StringOutput)
} | [
0.2962883710861206,
-1.3645641803741455,
0.5298774838447571,
0.1893085092306137,
0.12276916950941086,
0.976772665977478,
-0.17642506957054138,
0.0073669892735779285,
0.9239578247070312,
-0.09359652549028397,
0.8680251240730286,
0.49203306436538696,
-0.03811438009142876,
-1.4608927965164185... |
func (o EndpointAttachmentOutput) EndpointAttachmentId() pulumi.StringPtrOutput {
return o.ApplyT(func(v *EndpointAttachment) pulumi.StringPtrOutput { return v.EndpointAttachmentId }).(pulumi.StringPtrOutput)
} | [
0.056311238557100296,
-1.0825749635696411,
0.4895547032356262,
0.36176222562789917,
-0.053575798869132996,
1.7112873792648315,
0.2141391634941101,
0.346226304769516,
1.4476462602615356,
0.18632614612579346,
0.8245711922645569,
0.922466516494751,
-0.31506410241127014,
-1.2554171085357666,
... |
func (o EndpointAttachmentOutput) Host() pulumi.StringOutput {
return o.ApplyT(func(v *EndpointAttachment) pulumi.StringOutput { return v.Host }).(pulumi.StringOutput)
} | [
0.613059937953949,
-0.9435326457023621,
0.513679027557373,
0.346477746963501,
-0.21456512808799744,
1.4322848320007324,
-0.2196091264486313,
0.2065252810716629,
0.33730340003967285,
-0.35066869854927063,
0.8978649377822876,
0.9419005513191223,
0.10366285592317581,
-2.172056198120117,
-0.... |
func (o EndpointAttachmentOutput) Location() pulumi.StringOutput {
return o.ApplyT(func(v *EndpointAttachment) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)
} | [
-0.09763702005147934,
-1.537031888961792,
0.44308358430862427,
-0.1280517429113388,
-0.027444414794445038,
1.2325087785720825,
0.5342034697532654,
0.1732489913702011,
0.7762492299079895,
-0.37076255679130554,
1.0699071884155273,
0.8244394063949585,
0.575506329536438,
-1.9482519626617432,
... |
func (o EndpointAttachmentOutput) State() pulumi.StringOutput {
return o.ApplyT(func(v *EndpointAttachment) pulumi.StringOutput { return v.State }).(pulumi.StringOutput)
} | [
0.309012770652771,
-1.2205322980880737,
0.3987885117530823,
-0.045429762452840805,
-0.21902348101139069,
1.182332158088684,
0.13488881289958954,
-0.14607404172420502,
1.207632064819336,
-0.06117831915616989,
0.7156034111976624,
0.8756606578826904,
0.5802280902862549,
-1.3711491823196411,
... |
func toEntryKind(s string) EntryKind {
if k, ok := identToKind[strings.ToLower(s)]; ok {
return k
} else {
return Other
}
} | [
-0.11654574424028397,
-0.38496488332748413,
0.32006511092185974,
-0.5639537572860718,
-0.2653449773788452,
0.08353789895772934,
0.2122916430234909,
-0.10260920226573944,
0.6455011367797852,
0.11096331477165222,
-0.25208693742752075,
1.1533595323562622,
-0.39465081691741943,
0.1893417984247... |
func NewParser(f io.Reader) *Parser {
lex := lexer.New(f)
p := &Parser{
lex: lex,
errors: make([]*ParserError, 0),
}
p.advanceTokens()
p.advanceTokens()
return p
} | [
0.4096583425998688,
-1.1419681310653687,
0.22527240216732025,
-0.3415217399597168,
-1.021059274673462,
-0.022441277280449867,
-0.566787600517273,
0.45193588733673096,
-0.37706974148750305,
-0.7688404321670532,
0.30666565895080566,
-0.4546656906604767,
0.05269145965576172,
0.405703157186508... |
func (p *Parser) advanceTokens() error {
peekToken, err := p.lex.NextToken(p.bracesAsString)
if err != nil {
// XXX: Add error reporting here
return err
} else {
p.curToken = p.peekToken
p.peekToken = peekToken
}
return nil
} | [
0.024218905717134476,
-0.2453887164592743,
0.7985967397689819,
-0.5815740823745728,
0.043929409235715866,
0.11795377731323242,
-0.46574947237968445,
0.6053417325019836,
-0.2760298252105713,
-0.4374225437641144,
0.4115285575389862,
0.5737122893333435,
0.0251208133995533,
0.4296717941761017,... |
func (p *Parser) curTokenIs(t lexer.TokenType) bool {
return p.curToken.Type == t
} | [
-0.30235326290130615,
-1.0952399969100952,
0.39292266964912415,
-0.21011199057102203,
-0.949944794178009,
0.586394727230072,
-1.639147162437439,
0.06589134782552719,
0.03326030448079109,
0.31637752056121826,
-0.37269729375839233,
0.9792322516441345,
0.4209677577018738,
0.09494433552026749,... |
func (p *Parser) peekTokenIs(t lexer.TokenType) bool {
return p.peekToken.Type == t
} | [
-1.297613501548767,
-0.1131676658987999,
0.4004165530204773,
-0.29294487833976746,
-0.6119938492774963,
-0.25931376218795776,
-1.6874454021453857,
-0.8809286952018738,
-0.2309681475162506,
0.5505226254463196,
-1.2525033950805664,
0.9515062570571899,
0.561138391494751,
0.2542923092842102,
... |
func (p *Parser) expectPeek(t lexer.TokenType) bool {
if p.peekTokenIs(t) {
p.advanceTokens()
return true
} else {
p.peekError(t)
return false
}
} | [
-0.760084331035614,
0.7299918532371521,
0.6057422161102295,
-0.8390761613845825,
-0.1378936767578125,
-0.05723590403795242,
-1.0859392881393433,
-0.2606413960456848,
-0.24073506891727448,
0.22333456575870514,
-0.18578864634037018,
-0.042770374566316605,
-0.04152950271964073,
0.466666907072... |
func (p *Parser) readTagValue(entry *Entry) bool {
var tag string
var v *Value
tag = strings.ToLower(p.curToken.Literal)
if !p.expectPeek(lexer.EQUALS) {
return false
}
if p.peekTokenIs(lexer.IDENT) {
p.advanceTokens()
if i, err := strconv.Atoi(p.curToken.Literal); err == nil {
v = &Value{T: NumberTyp... | [
-0.4085235595703125,
0.0874069333076477,
0.5799485445022583,
-0.9964300394058228,
-0.40908700227737427,
-0.24660934507846832,
-0.36351776123046875,
-0.08882936835289001,
-1.1865990161895752,
0.06270506232976913,
-0.10560140758752823,
-0.17241176962852478,
0.22493982315063477,
0.65579229593... |
func (p *Parser) parseComment() {
p.lex.SkipToNewLine()
} | [
0.9388997554779053,
-0.6701173186302185,
0.2680123448371887,
-0.45237746834754944,
0.7324061989784241,
-0.19573718309402466,
1.2898062467575073,
0.2953522205352783,
-0.5737705826759338,
0.3129492402076721,
0.5606290698051453,
-0.9376453161239624,
-0.42053258419036865,
0.5909464359283447,
... |
func (p *Parser) ParseBibTeX() *Database {
p.bracesAsString = false
// create the database that we will read into
database := NewDatabase()
for !p.curTokenIs(lexer.EOF) {
switch p.curToken.Type {
case lexer.AT:
if entry := p.parseEntry(); entry != nil {
switch entry.Kind {
case String:
if len... | [
-0.0307232066988945,
-0.38180866837501526,
0.4891217350959778,
-0.370932400226593,
-0.03245379403233528,
-0.11311043053865433,
-0.5193859934806824,
0.1693791300058365,
-0.7390103340148926,
-0.3581154942512512,
-0.3539362847805023,
0.5880305767059326,
-0.9151609539985657,
0.4462658762931824... |
func writeTagValue(w io.Writer, tag string, value *Value) {
fmt.Fprintf(w, " %-10s = ", strings.ToLower(tag))
value.write(w)
fmt.Fprintf(w, ",\n")
} | [
0.1371324360370636,
-0.5083596706390381,
0.4695802628993988,
-1.012695074081421,
0.9048181176185608,
-0.14698684215545654,
-0.5912917256355286,
0.3104720115661621,
-0.9240861535072327,
0.06381450593471527,
-0.5564858317375183,
-0.014460020698606968,
0.8153102993965149,
1.171559453010559,
... |
func writeEntry(w io.Writer, e *Entry) {
fmt.Fprintf(w, "\n@%s{%s,\n",
strings.ToLower(e.EntryString),
e.Key)
// if this entry kind has a list of required fields,
// print each of the required fields in order
printed := make(map[string]bool)
if req, ok := required[e.Kind]; ok {
for _, r := range req {
fo... | [
0.4013790786266327,
-0.7773316502571106,
0.7871447205543518,
-0.36854037642478943,
0.6103811860084534,
0.14742179214954376,
-0.16302724182605743,
-0.10121623426675797,
-0.6356128454208374,
0.21026059985160828,
-0.030524134635925293,
0.6086299419403076,
0.5076972246170044,
0.933346390724182... |
func (value *Value) write(w io.Writer) {
switch value.T {
case StringType:
fmt.Fprintf(w, "{%s}", value.S)
case NumberType:
fmt.Fprintf(w, "%d", value.I)
case SymbolType:
fmt.Fprintf(w, "%s", value.S)
default:
panic("unknown field value type")
}
} | [
-0.8725016713142395,
0.17430754005908966,
0.41004347801208496,
-0.732157826423645,
0.8433355689048767,
0.7259067893028259,
-0.02254403941333294,
-0.307874858379364,
-0.5857968926429749,
0.17506344616413116,
-0.12553241848945618,
0.25582996010780334,
0.6990772485733032,
1.00242280960083,
... |
func (db *Database) WriteDatabase(w io.Writer) {
for _, v := range db.Preamble {
writePreamble(w, v)
}
fmt.Fprintln(w)
// write the symbols in sorted order
syms := make([]string, len(db.Symbols))
i := 0
for k := range db.Symbols {
syms[i] = k
i++
}
sort.Strings(syms)
for _, k := range syms {
writeSym... | [
-1.0095571279525757,
0.3560280501842499,
0.2395707666873932,
-0.3363886773586273,
0.651013195514679,
0.16021835803985596,
0.8420503735542297,
0.4823496639728546,
-0.2647286355495453,
-0.19978979229927063,
-0.7815757393836975,
-0.2634238600730896,
-0.34070900082588196,
1.8189669847488403,
... |
func parseVon(last []string) (string, string) {
if len(last) == 1 {
return "", last[0]
}
// find the last word that starts with a lowercase letter, excluding the
// last word
j := len(last) - 2
for ; j >= 0; j-- {
if r, _ := utf8.DecodeRuneInString(last[j]); unicode.IsLower(r) {
break
}
}
// von is t... | [
0.14394500851631165,
-0.9297051429748535,
0.6996306777000427,
-0.5483357906341553,
-0.20114344358444214,
-0.7635278105735779,
-0.3066108226776123,
0.3066803216934204,
0.11164987087249756,
1.2140607833862305,
0.37262511253356934,
0.06700924038887024,
-0.9531497359275818,
-0.0572182014584541... |
func parseNameParts(name string) (string, string, string) {
s := splitOnTopLevel(name)
// first is the longest sequence of words that start with a uppercase
// that is not the entire string
first := ""
space := ""
i := 0
for ; i < len(s)-1; i++ {
r, _ := utf8.DecodeRuneInString(s[i])
if r != utf8.RuneError ... | [
0.04766380414366722,
-0.6914567351341248,
0.5796915292739868,
-0.4134702682495117,
-0.6152850985527039,
-0.41075339913368225,
-1.254096508026123,
-0.5113484263420105,
-0.2987528443336487,
1.0209442377090454,
-0.611005425453186,
-0.4213407039642334,
-1.033983826637268,
0.31414538621902466,
... |
func NormalizeName(name string) *Author {
// if we're given an empty string
name = strings.TrimSpace(name)
if len(name) == 0 {
return nil
}
if strings.ToLower(name) == "others" {
return &Author{Others: true}
}
parts := splitOnTopLevelString(name, ",", false)
for i, p := range parts {
parts[i] = strings.T... | [
0.2299545407295227,
-0.7616124153137207,
0.9026389718055725,
0.14583995938301086,
-0.8243493437767029,
-1.261922001838684,
-0.42655935883522034,
0.42988619208335876,
0.6627019643783569,
0.39194199442863464,
0.14982125163078308,
-0.6479638814926147,
-1.094731092453003,
-0.420623779296875,
... |
func (a *Author) String() string {
if a.Others {
return "others"
}
last := a.Last
if a.Von != "" {
last = a.Von + " " + a.Last
}
last = quoteName(last)
first := quoteName(a.First)
jr := quoteName(a.Jr)
if last == "" {
return a.First
} else if a.First == "" {
return last
} else if a.Jr == "" {
ret... | [
0.12776564061641693,
-0.878070056438446,
0.4205811619758606,
-0.11748906224966049,
-0.2429550737142563,
-0.3388415575027466,
0.5933127403259277,
-0.7949034571647644,
-0.009997203946113586,
0.4789910316467285,
0.7590816617012024,
0.6213341951370239,
-0.29317229986190796,
-0.1096576973795890... |
func MIScrape(phrase string, logger *log.Logger) error {
res, err := scrapers.MarketIntelligence(phrase, logger)
if err != nil {
return err
}
err = dal.MarketIntelSave(res, phrase)
return err
} | [
-1.0524895191192627,
0.1752914935350418,
0.5670381784439087,
0.057127635926008224,
0.360117644071579,
0.008029848337173462,
-0.6368035674095154,
-0.2722777724266052,
1.173507571220398,
1.1344770193099976,
0.11233857274055481,
-0.6319250464439392,
-0.5672425031661987,
0.37978342175483704,
... |
func repeatRune(stream []rune, r rune, n int) []rune {
// reapeat + append
for i := 0; i < n; i++ {
stream = append(stream, r)
}
// result
return stream
} | [
-0.4177413284778595,
-0.15713155269622803,
0.44840818643569946,
0.066314198076725,
0.15038052201271057,
-0.41739577054977417,
-0.44901043176651,
-0.25178954005241394,
-0.8762078881263733,
0.05211777240037918,
-0.17719383537769318,
0.7092815637588501,
-0.9896965026855469,
0.74996417760849,
... |
func toDigit(symbol rune) (int, bool) {
if !unicode.IsDigit(symbol) {
return 0, false
}
digit := int(symbol - '0')
return digit, true
} | [
-0.610288143157959,
0.1061215028166771,
0.6725893020629883,
-0.2553381323814392,
-0.46169745922088623,
-0.14035002887248993,
1.0054066181182861,
0.8596187829971313,
0.08623240888118744,
0.1851736307144165,
-0.590244710445404,
-0.43434208631515503,
-0.22157713770866394,
0.3869609832763672,
... |
func Unpack(input string) (string, error) {
// boundary case
if len(input) == 0 {
return "", nil
}
// represent input as slice of runes (to append terminate symbol)
var stream = []rune(input)
// append terminate symbol in the end to prevent code dupblicate
// without terminate symbol we have to make a repeat... | [
-0.6639146208763123,
0.533823549747467,
1.1582995653152466,
0.27706384658813477,
-0.5412742495536804,
-0.2743299901485443,
1.5388143062591553,
0.1746464967727661,
0.39748069643974304,
0.019577376544475555,
-0.16483770310878754,
0.3193385899066925,
0.08693911135196686,
0.17874541878700256,
... |
func (f *FrameProcessor) ProcessMessage(msg *sarama.ConsumerMessage) {
if f.DecodeJSON != 0 {
var decoded map[string]*json.RawMessage
err := json.Unmarshal(msg.Value, &decoded)
if err != nil {
log.Error("Error occured during decoding", err)
}
}
// Lets record the event
f.Counter.Incr(1)
} | [
-0.6140416860580444,
0.2624638080596924,
0.7728171944618225,
-0.1952914297580719,
0.005099343601614237,
-0.955978274345398,
0.4553939402103424,
0.08647225052118301,
0.19576385617256165,
0.07038752734661102,
0.39566734433174133,
-0.17483647167682648,
-0.7002513408660889,
1.559919834136963,
... |
func LogRate(f *FrameProcessor, frequency time.Duration) {
for {
logRate(f)
time.Sleep(frequency)
}
} | [
0.21047447621822357,
1.0273007154464722,
0.2936193645000458,
0.12493128329515457,
-0.006821220740675926,
-0.7572767734527588,
-1.7529065608978271,
-0.4348134398460388,
-0.8557450771331787,
-0.2195981740951538,
0.1823217123746872,
-0.015176376327872276,
-0.13523371517658234,
0.3366024196147... |
func New(stages ...StageRunner) *Pipeline {
return &Pipeline{
stages: stages,
}
} | [
0.043514352291822433,
-0.40963268280029297,
0.029643064364790916,
0.8533645868301392,
-1.331727147102356,
0.47542428970336914,
0.008412103168666363,
0.1663416624069214,
-1.0692918300628662,
-0.31085675954818726,
-0.6999863386154175,
0.0012757505755871534,
0.8232110738754272,
0.297083437442... |
func (p *Pipeline) Process(ctx context.Context, source Source, sink Sink) error {
var wg sync.WaitGroup
pCtx, ctxCancelFn := context.WithCancel(ctx)
// Allocate channels for wiring together the source, the pipeline stages
// and the output sink. The output of the i_th stage is used as an input
// for the i+1_th s... | [
-0.3664221167564392,
0.20749405026435852,
0.829508364200592,
-0.12347401678562164,
-0.6310413479804993,
-0.1707448959350586,
0.7082859873771667,
-0.5035673975944519,
0.024906951934099197,
0.04439464211463928,
0.11952774226665497,
-0.195206880569458,
0.19474564492702484,
0.3983631432056427,... |
func sourceWorker(ctx context.Context, source Source, outCh chan<- Payload, errCh chan<- error) {
for source.Next(ctx) {
payload := source.Payload()
select {
case outCh <- payload:
case <-ctx.Done():
// Asked to shutdown
return
}
}
// Check for errors
if err := source.Error(); err != nil {
wrappe... | [
-0.7617021203041077,
-0.1413356214761734,
0.5804262161254883,
-0.6381433010101318,
-0.840114951133728,
-0.07521423697471619,
-0.39554837346076965,
-0.668525218963623,
0.4427034854888916,
0.7560980319976807,
-0.1918768286705017,
-0.4909258484840393,
-0.21102002263069153,
0.32232287526130676... |
func sinkWorker(ctx context.Context, sink Sink, inCh <-chan Payload, errCh chan<- error) {
for {
select {
case payload, ok := <-inCh:
if !ok {
return
}
if err := sink.Consume(ctx, payload); err != nil {
wrappedErr := xerrors.Errorf("pipeline sink: %w", err)
maybeEmitError(wrappedErr, errCh)
... | [
-0.8560521006584167,
-0.24126963317394257,
0.6578044891357422,
-0.4214105010032654,
0.16308079659938812,
-0.6520140171051025,
-0.38523176312446594,
-0.8613970279693604,
-0.1375630795955658,
0.42100808024406433,
0.1410973072052002,
-0.2869090139865875,
-0.47270458936691284,
0.13080625236034... |
func Up_20190919115924(txn *gorm.DB) {
txn.CreateTable(&models.Log{})
} | [
1.1769490242004395,
0.4763506352901459,
0.5121256709098816,
0.3058837354183197,
1.1989461183547974,
0.18314015865325928,
0.4719657897949219,
-0.1598517894744873,
-0.9571946263313293,
-0.01758604310452938,
-0.4917367696762085,
-0.09736767411231995,
0.019100423902273178,
-0.829077959060669,
... |
func Down_20190919115924(txn *gorm.DB) {
txn.DropTable(&models.Log{})
} | [
1.11241614818573,
0.1589658409357071,
0.6224562525749207,
0.05455975607037544,
0.8550488948822021,
0.7472266554832458,
0.70633465051651,
-0.08004786819219589,
-0.40149831771850586,
-0.255867600440979,
0.00816159974783659,
0.12052348256111145,
-0.7512205243110657,
-0.45222896337509155,
-0... |
func NewCurrentRecord(name string) (CurrentRecord, error) {
currentUser, err := user.Current()
if err != nil {
return nil, err
}
filePath := path.Join(currentUser.HomeDir, ".gomilk", "current", "current_"+name)
c := ¤tRecord{
Name: name,
Filepath: filePath,
}
if err := mkdirIfNotExists(path.Dir... | [
0.20900698006153107,
-0.5508596897125244,
0.4926355481147766,
0.12714508175849915,
-0.8535346388816833,
0.5964191555976868,
0.7378832697868347,
-0.20333530008792877,
-0.4008939564228058,
0.7106109857559204,
0.06735159456729889,
0.3503267467021942,
-0.8567975759506226,
0.6974014639854431,
... |
func (a *Access) CheckAPI() error {
response := struct {
Message string `json:"message"`
}{}
err := a.httpGet("/api/", &response)
if err != nil {
return err
}
if response.Message == "" {
return errors.New("hass: API is not running")
}
return nil
} | [
-0.15636590123176575,
-0.21869723498821259,
0.5049093961715698,
0.4809489846229553,
0.8805223703384399,
0.48163366317749023,
-0.4874039590358734,
0.17877650260925293,
-0.7820377349853516,
0.3673901855945587,
0.2468019723892212,
0.583645224571228,
-0.766623854637146,
0.5673132538795471,
0... |
func (a *Access) Bootstrap() (Bootstrap, error) {
var bootstrap Bootstrap
err := a.httpGet("/api/bootstrap", &bootstrap)
if err != nil {
return Bootstrap{}, err
}
return bootstrap, nil
} | [
-0.3313795328140259,
-0.36851823329925537,
0.5318486094474792,
0.5889284014701843,
0.17767946422100067,
-0.9385267496109009,
-0.48141977190971375,
-0.47194385528564453,
-0.061229173094034195,
-0.42481619119644165,
0.5952649712562561,
1.0889561176300049,
-0.44576704502105713,
-0.08037176728... |
func (a *Access) FireEvent(eventType string, eventData interface{}) error {
return a.httpPost("/api/events/"+eventType, eventData)
} | [
-0.5083378553390503,
0.11708737909793854,
0.6489080190658569,
0.6260285973548889,
0.25945791602134705,
0.6282070279121399,
-0.5145023465156555,
0.36557453870773315,
0.7755741477012634,
-0.7042233347892761,
-0.6181829571723938,
1.4408496618270874,
-0.20986713469028473,
0.8513284921646118,
... |
func (a *Access) CallService(domain, service string, entityID string) error {
serviceData := struct {
EntityID string `json:"entity_id"`
}{entityID}
return a.httpPost("/api/services/"+domain+"/"+service, serviceData)
} | [
-0.6367635130882263,
-0.13628432154655457,
0.4798809885978699,
-0.10706868767738342,
0.2907419502735138,
0.5309632420539856,
-1.5745490789413452,
-0.9656347632408142,
-0.1884438544511795,
-0.19258281588554382,
0.9096998572349548,
1.870856523513794,
-0.10327788442373276,
1.157458782196045,
... |
func (a *Access) ListStates() (s States, err error) {
var list States
err = a.httpGet("/api/states", &list)
if err != nil {
return States{}, err
}
return list, nil
} | [
-0.6424158811569214,
-0.40890854597091675,
0.05806148797273636,
-0.08927401900291443,
-0.06678823381662369,
-0.49087464809417725,
-0.7182152271270752,
-0.5289441347122192,
1.4740904569625854,
-0.47799375653266907,
0.5635650157928467,
0.28942304849624634,
-0.4868791401386261,
0.116796568036... |
func (a *Access) GetState(id string) (s State, err error) {
var state State
err = a.httpGet("/api/states/"+id, &state)
if err != nil {
return State{}, err
}
return state, nil
} | [
-0.6096791625022888,
0.16934633255004883,
0.3779897093772888,
0.5403841137886047,
0.003387998091056943,
-0.8085393905639648,
-0.35527026653289795,
-0.6666849255561829,
0.980852484703064,
-0.5277170538902283,
0.4207179844379425,
0.5719733834266663,
-0.552364706993103,
0.10383403301239014,
... |
func (a *Access) FilterStates(domains ...string) (s States, err error) {
list, err := a.ListStates()
if err != nil {
return States{}, err
}
for d := range list {
dom := strings.TrimSuffix(strings.SplitAfter(list[d].EntityID, ".")[0], ".")
for _, fdom := range domains {
if fdom == dom {
s = append(s, li... | [
-0.5302417874336243,
-0.11269298940896988,
0.5513124465942383,
-0.2373911291360855,
-0.9411303997039795,
-0.223436176776886,
0.16765858232975006,
-0.3247210681438446,
0.9809635877609253,
0.06339621543884277,
1.2195408344268799,
0.41192635893821716,
0.061599936336278915,
-0.2833115756511688... |
func (a *Access) ChangeState(id, state string) (s State, err error) {
s.EntityID = id
s.State = state
err = a.httpPost("/api/states/"+id, s)
return State{}, err
} | [
-0.8610889315605164,
0.11035426706075668,
0.4048314392566681,
-0.07812806218862534,
0.07637011259794235,
-0.43841567635536194,
-0.6461748480796814,
0.554234504699707,
0.23056595027446747,
0.23123417794704437,
0.06012675166130066,
1.1639091968536377,
-0.14599144458770752,
0.2799622118473053... |
func NewAggregator() *Aggregator {
return &Aggregator{Data: make(map[string]int)}
} | [
-0.852181077003479,
-0.18098773062229156,
0.21922321617603302,
-0.933464527130127,
-1.7810264825820923,
-0.5484741926193237,
-0.5348718166351318,
0.0035691815428435802,
-0.4854087829589844,
-0.9851434230804443,
-0.3795992434024811,
-0.021323898807168007,
-0.19140097498893738,
1.01071822643... |
func (a *Aggregator) Aggregate(statuses chan Status) {
for s := range statuses {
if s.Application != "" && s.Version != "" {
a.Data[s.Application+s.Version] += s.SuccessCount
}
}
} | [
-0.38247767090797424,
-0.3845083713531494,
0.2633397579193115,
-0.4197045862674713,
0.10974832624197006,
0.5646573305130005,
-0.6996694207191467,
1.0013149976730347,
-0.17373253405094147,
0.26862528920173645,
-0.006882592104375362,
0.653957724571228,
0.05192984268069267,
1.289185881614685,... |
func randomInt64(t *testing.T) int64 {
// Create a random big.Int covering the full possible range of values for
// an integer, starting from the value 0.
bigInt, err := rand.Int(rand.Reader, new(big.Int).SetUint64(math.MaxInt64))
if err != nil {
t.Fatal(err)
}
return bigInt.Int64()
} | [
-0.20967449247837067,
0.5055797100067139,
0.11403585970401764,
0.5567227602005005,
0.3238668143749237,
-0.058184750378131866,
0.337759792804718,
-0.3974002003669739,
0.059749849140644073,
-0.48941564559936523,
0.4767134189605713,
-0.2723694443702698,
-1.0069143772125244,
0.5568251013755798... |
func randomUint64(t *testing.T) uint64 {
bigInt, err := rand.Int(rand.Reader, new(big.Int).SetUint64(math.MaxUint64))
if err != nil {
t.Fatal(err)
}
return bigInt.Uint64()
} | [
-0.33095619082450867,
0.41168105602264404,
0.21225866675376892,
0.07155055552721024,
-0.059289999306201935,
-0.027969256043434143,
0.08753959834575653,
0.5854294896125793,
0.43961891531944275,
-0.5196133852005005,
0.5461578369140625,
-0.12645553052425385,
-0.2954089045524597,
0.55815309286... |
func randomHash(t *testing.T) (h crypto.Hash) {
n, err := rand.Read(h[:])
if err != nil {
t.Fatal(n, "::", err)
}
return
} | [
1.509902000427246,
0.049853742122650146,
0.40171322226524353,
0.47819796204566956,
0.2584085464477539,
1.2408902645111084,
0.28415241837501526,
-0.46094176173210144,
0.12090268731117249,
-0.3561069071292877,
-0.10792559385299683,
0.37682679295539856,
-0.8126412034034729,
-0.934949994087219... |
func TestTypeMarshalling(t *testing.T) {
// Create a block full of random values.
originalBlock := Block{
ParentID: BlockID(randomHash(t)),
Timestamp: Timestamp(randomInt64(t)),
Nonce: randomUint64(t),
}
marshalledBlock := encoding.Marshal(originalBlock)
var unmarshalledBlock Block
encoding.Unmarshal(... | [
0.7167820930480957,
0.7176713943481445,
0.7023281455039978,
0.16703501343727112,
0.6563100218772888,
-0.05292205885052681,
0.06881000846624374,
-0.1612539291381836,
0.3520081341266632,
-0.7772865891456604,
-0.49949347972869873,
0.4114122986793518,
0.09250298142433167,
0.5014551281929016,
... |
func BytesToNewFile(fileName string, data []byte) (*os.File, error) {
//Creates File
newFile, err := os.Create(fileName)
if err != nil {
return newFile, err
}
defer newFile.Close()
//Write to file
newFile.Write(data)
newFile.Sync()
return newFile, nil
} | [
0.3211604058742523,
-0.5046530365943909,
0.5895496010780334,
-0.5388346314430237,
0.7457682490348816,
0.36992955207824707,
-0.7193659543991089,
-0.48877397179603577,
-0.4088106155395508,
0.10001544654369354,
-0.7214292883872986,
0.08790747821331024,
-0.3694554567337036,
-0.3280319273471832... |
func BytesFromFile(fileName string) ([]byte, error) {
//Opens file
openedFile, err := os.Open(fileName)
if err != nil {
return make([]byte, 0), err
}
fi, err := openedFile.Stat()
if err != nil {
return make([]byte, 0), err
}
//Reads from file
bytesData := make([]byte, fi.Size())
openedFile.Read(bytesDa... | [
0.3256175220012665,
-0.18455545604228973,
0.17428553104400635,
-0.35849207639694214,
0.0638754814863205,
0.8380067944526672,
-0.15720105171203613,
-0.2863318920135498,
-0.6307345628738403,
-0.5666046142578125,
-0.5378553867340088,
0.27470502257347107,
-0.596083402633667,
0.8673975467681885... |
func loadConfig() (*rest.Config, error) {
if len(os.Getenv("KUBECONFIG")) > 0 {
return clientcmd.BuildConfigFromFlags("", os.Getenv("KUBECONFIG"))
}
if c, err := rest.InClusterConfig(); err == nil {
return c, nil
}
if usr, err := user.Current(); err == nil {
if c, err := clientcmd.BuildConfigFromFlags(
""... | [
0.6961337924003601,
-0.195639967918396,
0.7285478115081787,
1.0272397994995117,
0.16903938353061676,
0.0934421718120575,
-0.017477311193943024,
-0.19984199106693268,
-0.3860009014606476,
0.30850157141685486,
0.554578423500061,
0.3340429663658142,
-1.2162326574325562,
0.6399930715560913,
... |
func getName(base, suffix string, maxLength int) string {
if maxLength <= 0 {
return ""
}
name := fmt.Sprintf("%s-%s", base, suffix)
if len(name) <= maxLength {
return name
}
baseLength := maxLength - 10 /*length of -hash-*/ - len(suffix)
// if the suffix is too long, ignore it
if baseLength < 0 {
prefi... | [
0.9313888549804688,
-0.16369977593421936,
0.8082091212272644,
-0.31359389424324036,
-0.5478988289833069,
-0.37188228964805603,
-1.1817384958267212,
0.35734325647354126,
-0.36012908816337585,
0.3477700650691986,
-0.4726201891899109,
0.6303814649581909,
0.42938941717147827,
-0.34515959024429... |
func max(a, b int) int {
if b > a {
return b
}
return a
} | [
-0.03795672580599785,
0.6545403003692627,
0.2889217436313629,
0.43553367257118225,
-0.30144014954566956,
0.233561173081398,
-1.0435278415679932,
-0.6188642978668213,
-0.5644522309303284,
0.18873381614685059,
0.4789118766784668,
1.3951622247695923,
-0.04730529338121414,
-0.1238899677991867,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.