text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func LoadPlugin(f string) {
mutex.Lock()
defer mutex.Unlock()
plugin := hostPlugin(f)
// We cannot load the same plugin twice!
if IsPluginLoaded(plugin.Manifest.Id) {
log.Printf("Cannot load plugin '%s' as it is already loaded!\n", plugin.Manifest.Id)
plugin.client.Kill()
return
}
loadedPlugins = append(... | [
0.2757986783981323,
-0.48078593611717224,
0.5082415342330933,
0.42354148626327515,
-0.12496212869882584,
0.15546579658985138,
-0.4393731951713562,
0.4491181969642639,
0.1011466383934021,
-0.5234967470169067,
-1.1390509605407715,
0.7796822190284729,
-0.5128055810928345,
-0.10768016427755356... |
func IsPluginLoaded(id string) bool {
for _, pl := range loadedPlugins {
if pl.Plugin != nil && pl.Manifest.Id == id {
return true
}
}
return false
} | [
-0.6189820170402527,
-1.5878149271011353,
0.5635308027267456,
-0.2605821490287781,
0.3642800450325012,
-0.543413519859314,
-1.2047473192214966,
-0.30617883801460266,
1.3437186479568481,
0.05309715121984482,
-1.325216293334961,
0.6567360758781433,
-0.3237452208995819,
0.2895925045013428,
... |
func LoadPlugins() {
log.Println("Loading plugins...")
files, err := ioutil.ReadDir("./plugins")
if err == nil {
for _, f := range files {
LoadPlugin(f.Name())
}
}
log.Printf("%d plugins loaded!\n", len(loadedPlugins))
} | [
0.16836203634738922,
-0.1712920069694519,
0.40053772926330566,
-0.08911746740341187,
0.6225699186325073,
0.0008211623644456267,
0.06203986331820488,
-0.33786559104919434,
0.18255779147148132,
-0.12848873436450958,
-0.4694116413593292,
0.9162660837173462,
-0.4571455419063568,
-0.00915908347... |
func TestRemoveDups(t *testing.T) {
suite.Run(t, new(RemoveDupsTestingSuite))
} | [
-0.36166104674339294,
0.9525814056396484,
0.42480865120887756,
0.2209291309118271,
0.3450188636779785,
0.5763829946517944,
1.352077841758728,
0.6236138939857483,
0.9680221676826477,
-0.16595664620399475,
-0.9819334149360657,
-0.24823451042175293,
0.27495431900024414,
0.10917641967535019,
... |
func NewCryptoReader(ctx *Context, r io.Reader) io.Reader {
// At the beginning of the reader must be the unencrypted IV to use.
iv := make([]byte, aes.BlockSize)
if _, err := io.ReadFull(r, iv); nil != err {
log.Panicf("Failed to read IV from file: %v", err)
}
// Create a new AES block cipher and init the out... | [
0.43351471424102783,
-0.7001751065254211,
0.5087684392929077,
-0.1608686000108719,
-0.952737033367157,
-0.5186516046524048,
0.03264917805790901,
-0.22949136793613434,
0.41260281205177307,
0.17866571247577667,
0.5817586183547974,
0.5236052870750427,
0.21908722817897797,
-0.1242920458316803,... |
func NewCryptoWriter(ctx *Context, w io.Writer) io.Writer {
// Get a new random IV and write it to the writer unencrypted.
iv := getRandomIV()
if _, err := w.Write(iv); nil != err {
log.Panicf("Failed to write IV: %v", err)
}
// Create a new AES block cipher and init the output feedback mode stream, then copy ... | [
0.38011449575424194,
-0.5053920745849609,
0.37709057331085205,
0.2031652331352234,
-0.5330511331558228,
-0.41997790336608887,
0.5793684124946594,
-0.9896687269210815,
0.19243282079696655,
0.019352123141288757,
0.01983010396361351,
0.009600523859262466,
0.2839876711368561,
0.682892560958862... |
func MustSave(path string, f *os.File) {
c, err := New()
if err != nil {
panic(err)
}
err = c.SaveFile(path, f)
if err != nil {
panic(err)
}
} | [
0.5025672316551208,
0.6886957287788391,
0.569378674030304,
0.7656320333480835,
0.280866801738739,
1.1973482370376587,
-1.4919726848602295,
-0.18968135118484497,
-1.1949595212936401,
0.6955288052558899,
-0.3424021601676941,
-0.24284353852272034,
0.25842809677124023,
0.1279919147491455,
-0... |
func New(test ...bool) (*Controller, error) {
var c Controller
c.bucket = "wedgenix-app-storage"
if len(test) > 0 && test[0] {
c.bucket = "wedgenixtestbucket"
}
sess, err := session.NewSession(&aws.Config{Credentials: credentials.NewEnvCredentials()})
if err != nil {
return &c, err
}
c.c3svc = s3.New(ses... | [
0.3600459694862366,
-0.5308010578155518,
0.39736101031303406,
-0.061538077890872955,
-0.212880477309227,
-0.048545777797698975,
-0.2971595823764801,
-0.43041765689849854,
0.08043037354946136,
0.2266395092010498,
-0.3829035758972168,
0.04296097159385681,
0.4361121654510498,
-0.0501323342323... |
func (c Controller) GetVerIDs() map[string]string {
var bin map[string]string
for filename, vID := range c.verIDs {
bin[filename] = *vID
}
return bin
} | [
-0.1907951682806015,
-0.6603777408599854,
0.4640357792377472,
0.37255898118019104,
0.28126344084739685,
0.2013458013534546,
-0.19966813921928406,
-0.08610896021127701,
0.04079054668545723,
0.5438387989997864,
-1.1701834201812744,
1.1633532047271729,
-0.3550390899181366,
1.0094900131225586,... |
func (c *Controller) Read(path string, v interface{}) error {
input := &s3.GetObjectInput{
Bucket: aws.String(c.bucket),
Key: aws.String(path),
}
resp, err := c.c3svc.GetObject(input)
if err == nil {
switch strings.ToLower(path[strings.LastIndex(path, "."):]) {
case ".json":
err = json.NewDecoder(re... | [
-0.03361555561423302,
-0.5675069689750671,
0.9922568798065186,
-0.20501355826854706,
-0.3043566942214966,
0.544859766960144,
-0.8156453371047974,
-0.5314244627952576,
-0.31472960114479065,
0.06332384794950485,
0.388736754655838,
0.7415661215782166,
-0.3250671923160553,
-0.8263671398162842,... |
func (c *Controller) Open(name string, f file.Any) (bool, error) {
input := &s3.GetObjectInput{
Bucket: aws.String(c.bucket),
Key: aws.String(name),
}
resp, err := c.c3svc.GetObject(input)
if err == nil {
json.NewDecoder(resp.Body).Decode(f)
return true, nil
}
if strings.Contains(err.Error(), "NoSuc... | [
-0.9142367243766785,
0.11223791539669037,
0.7735362648963928,
-0.2896066904067993,
-1.1888285875320435,
0.706288754940033,
-0.4994713366031647,
0.6598077416419983,
-0.7610164284706116,
-0.010615128092467785,
-0.7515645623207092,
-0.46086952090263367,
-0.11840162426233292,
-0.33063521981239... |
func (c *Controller) Write(path string, v interface{}) error {
var buf bytes.Buffer
var err error
switch strings.ToLower(path[strings.LastIndex(path, "."):]) {
case ".json":
err = json.NewEncoder(&buf).Encode(v)
case ".gob":
err = gob.NewEncoder(&buf).Encode(v)
default:
return errors.New("invalid file ext... | [
-0.5194516777992249,
-0.34897559881210327,
0.715325653553009,
-0.157197043299675,
0.6702539324760437,
0.9191345572471619,
-0.03627016395330429,
0.09361979365348816,
-0.05854710191488266,
1.2379488945007324,
-1.0182111263275146,
0.46178722381591797,
-0.5078654289245605,
-0.2717161178588867,... |
func (c *Controller) SaveFile(path string, f *os.File) error {
if strings.LastIndex(path, "/") < len(path)-1 {
return errors.New("'" + path + "' is not a directory")
}
input := &s3.PutObjectInput{
Body: aws.ReadSeekCloser(f),
Bucket: aws.String(c.bucket),
Key: ... | [
0.08545462042093277,
0.08914729207754135,
0.6609500646591187,
0.13872534036636353,
-0.06508711725473404,
0.9656413793563843,
0.33573001623153687,
0.11082343012094498,
-0.35790297389030457,
0.5834681391716003,
-0.7150118350982666,
0.04731326177716255,
-0.2833770513534546,
-0.095444850623607... |
func (c *Controller) Save(name string, f file.Any) error {
b, err := json.Marshal(f)
if err != nil {
return err
}
util.Log(string(b))
r := bytes.NewReader(b)
input := &s3.PutObjectInput{
Body: aws.ReadSeekCloser(r),
Bucket: aws.String(c.bucket),
Key: aws.St... | [
-0.17235851287841797,
-0.1708114594221115,
0.7367722392082214,
-0.02057180181145668,
-0.10369445383548737,
0.5325269103050232,
-0.276359885931015,
-0.32045111060142517,
-0.6252483129501343,
1.1848747730255127,
-1.4140986204147339,
-0.0741790309548378,
-0.06392955780029297,
-0.2515241503715... |
func (c *Controller) SaveDir(path dir.Path, d dir.Any) error {
parts := strings.Split(string(path), "*")
if len(parts) < 1 {
return errors.New("no extension provided")
}
folder := parts[0]
if len(parts) < 2 {
return errors.New("no extension provided")
}
ext := parts[1]
switch d := d.(type) {
case dir.Bana... | [
-1.004115104675293,
0.1956513524055481,
0.7777308225631714,
0.8454574942588806,
-0.38523954153060913,
0.2068892866373062,
0.5343987345695496,
-0.3078381419181824,
-0.33855143189430237,
0.22940607368946075,
0.07847956568002701,
-0.03158237040042877,
-0.06945599615573883,
0.9607682228088379,... |
func (c *Controller) OpenDir(path dir.Path, d dir.Any) error {
parts := strings.Split(string(path), "/*")
if len(parts) < 1 {
return errors.New("no extension provided")
}
folder := parts[0]
if len(parts) < 2 {
return errors.New("no extension provided")
}
ext := parts[1]
input := &s3.ListObjectsInput{
Buc... | [
-0.5509306788444519,
-0.251865029335022,
0.8272473812103271,
-0.04483623057603836,
-1.428118348121643,
0.4033503830432892,
0.9016692042350769,
0.10602439939975739,
0.27788060903549194,
0.10529050976037979,
0.013440120965242386,
0.5705398917198181,
0.22852714359760284,
0.5748828053474426,
... |
func BatchUpsert(tableName string, serializeValues []string, serializedColumnNames string, onConflictColumnsNames []string) error {
numOfBatchRequest := int(math.Ceil(float64(len(serializeValues)) / float64(oyster_utils.SQL_BATCH_SIZE)))
var updatedColumns []string
for _, v := range onConflictColumnsNames {
if v ... | [
-0.6829742193222046,
0.3830876052379608,
1.0098713636398315,
-0.053164876997470856,
-0.1974789947271347,
-0.5968784689903259,
-0.09707450866699219,
-0.2678852081298828,
-0.7783130407333374,
0.6573229432106018,
-0.7077499628067017,
0.008882880210876465,
0.01068815216422081,
-0.3798950910568... |
func main() {
board := make([][]byte, 9)
for i := 0; i < 9; i++ {
board[i] = make([]byte, 9)
}
board[0] = []byte{'.', '.', '9', '7', '4', '8', '.', '.', '.'}
board[1] = []byte{'7', '.', '.', '.', '.', '.', '.', '.', '.'}
board[2] = []byte{'.', '2', '.', '1', '.', '9', '.', '.', '.'}
board[3] = []byte{'.', '.',... | [
0.6021577715873718,
-0.7438249588012695,
1.7216143608093262,
0.09360317885875702,
-0.5428742170333862,
-0.04871620610356331,
0.9557311534881592,
0.4588415026664734,
-0.060673996806144714,
0.7165334224700928,
-1.2804501056671143,
0.005280830431729555,
0.24883677065372467,
-0.420690864324569... |
func Download(channelName, channelType, downloadMode string) error {
if downloadMode == "Video And Audio" {
// Download .mp4 with audio and video in one file
return downloadVideoAndAudio(channelName, channelType)
// Extract audio from the .mp4 file and remove the .mp4
} else if downloadMode == "Audio Only" {
... | [
0.5030952095985413,
-0.8958515524864197,
0.7010473608970642,
0.8979335427284241,
-0.12018083035945892,
-0.0717272013425827,
-0.2345317006111145,
-0.04934895038604736,
0.550689697265625,
0.12647272646427155,
0.20676317811012268,
0.9328132271766663,
-0.7384240627288818,
0.8167791366577148,
... |
func DoubleConst(v float64) ConstDouble {
return &constDouble{v}
} | [
0.23660799860954285,
0.012525596655905247,
0.3935672640800476,
-0.3837891221046448,
-1.0523715019226074,
0.6384026408195496,
0.4693234860897064,
-0.1517392098903656,
-0.8850253224372864,
0.28413066267967224,
-1.4010757207870483,
0.24700717628002167,
1.0650429725646973,
0.02331254445016384,... |
func IntConst(v int64) ConstInt {
return &constInt{v}
} | [
1.0422656536102295,
-0.878211259841919,
0.12361139059066772,
-0.8670895099639893,
-1.4605873823165894,
-0.13488203287124634,
-0.25480565428733826,
0.3610580265522003,
-0.19933709502220154,
0.6022400856018066,
-0.7390350699424744,
0.3295845091342926,
0.22364778816699982,
-0.3493377566337585... |
func UintConst(v uint64) ConstUint {
return &constUint{v}
} | [
0.25644055008888245,
-0.5541899800300598,
0.22866912186145782,
-0.4015241861343384,
-0.9280251264572144,
-0.2783791720867157,
-0.4299209713935852,
0.4744899272918701,
0.28526678681373596,
-0.22103416919708252,
-0.13223040103912354,
-0.5183460712432861,
0.7146008610725403,
-0.18201972544193... |
func BoolConst(v bool) ConstBool {
return &constBool{v}
} | [
1.5019078254699707,
-0.5620817542076111,
0.4994487762451172,
-0.3564302623271942,
-0.9526048302650452,
0.1677934229373932,
-0.45148947834968567,
0.017227882519364357,
-0.49612852931022644,
0.9800841808319092,
-0.2917863428592682,
0.23992641270160675,
0.6693480610847473,
-0.3629586696624756... |
func StringConst(v string) ConstString {
return &constString{v}
} | [
0.7596799731254578,
-1.1332752704620361,
0.20948681235313416,
-0.7238985896110535,
-1.1868896484375,
0.4114394783973694,
-0.5428683757781982,
-0.32633963227272034,
-0.16288720071315765,
0.46263381838798523,
-0.40606945753097534,
0.5592145323753357,
0.4886455535888672,
-0.6294779777526855,
... |
func BytesConst(v []byte) ConstBytes {
return &constBytes{v}
} | [
0.4758951663970947,
-0.20474554598331451,
0.2736290395259857,
-0.8538130521774292,
-0.5433764457702637,
0.2658023238182068,
-1.268951416015625,
-0.16240428388118744,
0.20162616670131683,
0.3751791715621948,
-0.9309207201004028,
0.32716429233551025,
0.06754205375909805,
0.28022411465644836,... |
func DoublesConst(v []float64) ConstDoubles {
return &constDoubles{v}
} | [
-0.13925376534461975,
0.34581896662712097,
0.39427927136421204,
-0.3010052740573883,
-0.9312088489532471,
0.14387156069278717,
0.5153080821037292,
-0.11077538132667542,
-0.4038987457752228,
-0.007106470875442028,
-1.5274631977081299,
0.1470727175474167,
1.0403785705566406,
0.11737211793661... |
func IntsConst(v []int64) ConstInts {
return &constInts{v}
} | [
0.19676414132118225,
-1.0674670934677124,
0.2214052528142929,
-0.8034501671791077,
-1.3252841234207153,
-0.7843396067619324,
-0.6979675889015198,
-0.2343675196170807,
0.4390484392642975,
0.7962254285812378,
-0.09774692356586456,
0.5725759267807007,
-0.09539138525724411,
0.13228635489940643... |
func UintsConst(v []uint64) ConstUints {
return &constUints{v}
} | [
-0.46396440267562866,
-0.5168436169624329,
0.25055524706840515,
-0.292323499917984,
-0.5343983769416809,
-0.49768495559692383,
-0.8507028818130493,
0.37764033675193787,
0.6078640222549438,
-0.02221115119755268,
-0.2986542284488678,
-0.4798637926578522,
0.8168625831604004,
-0.23782862722873... |
func BoolsConst(v []bool) ConstBools {
return &constBools{v}
} | [
0.10963389277458191,
-0.3296225666999817,
0.3591615855693817,
-0.5240429639816284,
-0.7249850630760193,
-0.164885476231575,
-1.0022916793823242,
0.12112236022949219,
-0.8887073397636414,
0.19831492006778717,
-0.682350754737854,
-0.17653563618659973,
0.17756637930870056,
-0.9704498052597046... |
func StringsConst(v []string) ConstStrings {
return &constStrings{v}
} | [
0.05635484308004379,
-0.7557809948921204,
0.311832994222641,
-1.1008421182632446,
-0.48809516429901123,
0.14550727605819702,
-0.6930599808692932,
-0.48979389667510986,
0.20779725909233093,
0.16048455238342285,
0.12886880338191986,
0.3000375032424927,
-0.06880746781826019,
-0.23930406570434... |
func ListOfBytesConst(v [][]byte) ConstListOfBytes {
return &constListOfBytes{v}
} | [
0.6884241700172424,
-0.7509148716926575,
0.29168787598609924,
-0.7227709293365479,
-0.052694592624902725,
-0.47484108805656433,
-0.6945523023605347,
0.564392626285553,
0.5923722386360168,
0.8205000758171082,
-0.8552477359771729,
-0.4802592098712921,
0.828117847442627,
0.6698360443115234,
... |
func AskAccountName(
ctx context.Context, config azconfig.AZConfig,
cliAccountName, defaultAccountName string,
) (desiredName string, mustCreate bool) {
if cliAccountName != "" {
logrus.WithField("batchAccountName", cliAccountName).Debug("creating batch account from CLI")
return cliAccountName, true
}
if conf... | [
-0.12242525070905685,
-0.20083729922771454,
0.9004257321357727,
1.0007870197296143,
0.018986517563462257,
0.558010995388031,
0.6005211472511292,
-0.4262649416923523,
-0.31419798731803894,
-0.16603690385818481,
0.09389051049947739,
0.6604479551315308,
-0.09504099935293198,
0.246850207448005... |
func CreateAndSave(ctx context.Context, config *azconfig.AZConfig, accountName string) {
account, ok := CreateAccount(ctx, *config, accountName)
if !ok {
logrus.Fatal("unable to create batch account")
}
config.BatchAccountName = *account.Name
logrus.WithField("batchAccountName", config.BatchAccountName).Info("b... | [
0.3862343728542328,
-0.5883849263191223,
0.20317338407039642,
0.6093704104423523,
0.6469624042510986,
0.6177204251289368,
0.18519340455532074,
0.11090800911188126,
-0.20774391293525696,
0.8003796339035034,
-1.0255019664764404,
0.05099453032016754,
-0.04719256982207298,
0.5680390000343323,
... |
func CreateAccount(ctx context.Context, config azconfig.AZConfig, accountName string) (batchARM.Account, bool) {
accountClient := getBatchAccountClient(config)
logger := logrus.WithFields(logrus.Fields{
"batchAccountName": accountName,
"resourceGroup": config.ResourceGroup,
"location": config.Locati... | [
0.3906738758087158,
-0.3079987168312073,
0.6595197319984436,
0.11398313194513321,
0.5824236273765564,
0.43667975068092346,
0.5522310733795166,
0.008596150204539299,
0.0907234251499176,
0.5325921177864075,
-0.06058105081319809,
0.07590678334236145,
-0.7316324710845947,
0.19294267892837524,
... |
func (s *HstSuite) getTransientContainerByName(name string) *Container {
containerCopy := *s.containers[name]
return &containerCopy
} | [
0.13875412940979004,
-0.4271986186504364,
0.3834572732448578,
-0.38018056750297546,
-0.3982478678226471,
-1.2103906869888306,
-0.04473484307527542,
-1.0920372009277344,
-0.31434306502342224,
1.0683881044387817,
-0.39421454071998596,
-0.017267152667045593,
-0.3206804096698761,
-0.1700829714... |
func NewIamMetadata(pathResp map[string]string) *MockIamServer {
mockPathResp := make(map[string]string)
for k, v := range pathResp {
mockPathResp[k] = v
}
m := &MockIamServer{
ch: make(chan string, 100),
reqCache: make(map[string]int),
}
m.s = httptest.NewServer(http.HandlerFunc(func(w http.Response... | [
-0.588129997253418,
-1.0248686075210571,
0.8274422287940979,
-0.1657075136899948,
0.3713845908641815,
0.600702166557312,
0.5209800004959106,
-0.28472286462783813,
0.6803366541862488,
0.36549481749534607,
-0.20906037092208862,
0.5366848111152649,
-0.36987176537513733,
-0.16250647604465485,
... |
func (m *MockIamServer) GetURL() string {
return m.s.URL
} | [
0.17093278467655182,
0.22981923818588257,
0.15390607714653015,
0.9841243028640747,
0.36931896209716797,
0.8362199068069458,
1.0428855419158936,
0.7878298163414001,
0.9720963835716248,
0.5167142748832703,
-0.17067264020442963,
0.461247980594635,
-0.8524459600448608,
-0.011288325302302837,
... |
func NewMockOnchainDataDaoInterface(ctrl *gomock.Controller) *MockOnchainDataDaoInterface {
mock := &MockOnchainDataDaoInterface{ctrl: ctrl}
mock.recorder = &MockOnchainDataDaoInterfaceMockRecorder{mock}
return mock
} | [
0.30565518140792847,
-0.25688114762306213,
0.16699478030204773,
-0.6854779124259949,
0.10840240120887756,
0.6217915415763855,
-0.02824312075972557,
-0.6868876814842224,
-0.3032039403915405,
-0.5516048669815063,
-0.31782999634742737,
0.45138323307037354,
-0.9680038690567017,
0.7688493728637... |
func (m *MockOnchainDataDaoInterface) EXPECT() *MockOnchainDataDaoInterfaceMockRecorder {
return m.recorder
} | [
0.3808423578739166,
0.16329367458820343,
0.2114264965057373,
-0.3582111895084381,
-0.09456023573875427,
0.256425678730011,
0.10303819179534912,
-0.5632755756378174,
0.12240928411483765,
-0.8732339143753052,
0.8779236078262329,
0.8884891867637634,
-1.2195485830307007,
0.568880558013916,
1... |
func (m *MockOnchainDataDaoInterface) SetLastestTransaction(addr, tx string) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SetLastestTransaction", addr, tx)
ret0, _ := ret[0].(error)
return ret0
} | [
-0.12269573658704758,
-0.5952351689338684,
0.07936709374189377,
-0.814646303653717,
0.9109801054000854,
-0.06089652329683304,
0.6117414832115173,
-0.9950390458106995,
-0.07292307168245316,
-0.17106924951076508,
-0.7240567803382874,
-0.7930070161819458,
-1.0673068761825562,
0.45127281546592... |
func (mr *MockOnchainDataDaoInterfaceMockRecorder) SetLastestTransaction(addr, tx interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetLastestTransaction", reflect.TypeOf((*MockOnchainDataDaoInterface)(nil).SetLastestTransaction), addr, tx)
} | [
0.12595655024051666,
0.07153425365686417,
0.22442622482776642,
-0.8923647403717041,
0.2877084016799927,
0.0490434393286705,
-0.21586452424526215,
-1.4227569103240967,
1.1836799383163452,
0.18483641743659973,
0.15836700797080994,
-0.09340398758649826,
-1.1907987594604492,
0.5495458841323853... |
func (m *MockOnchainDataDaoInterface) GetLastestTransaction(addr string) (string, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetLastestTransaction", addr)
ret0, _ := ret[0].(string)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
-0.0020945610012859106,
-0.3800297677516937,
0.3138303756713867,
-0.42982661724090576,
1.0302454233169556,
-0.3715495765209198,
0.8060134053230286,
-1.2768596410751343,
0.14868097007274628,
-0.38425692915916443,
-0.619348406791687,
-0.5748105049133301,
-1.0022778511047363,
0.44412529468536... |
func (mr *MockOnchainDataDaoInterfaceMockRecorder) GetLastestTransaction(addr interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLastestTransaction", reflect.TypeOf((*MockOnchainDataDaoInterface)(nil).GetLastestTransaction), addr)
} | [
0.31438466906547546,
0.28355973958969116,
0.57498699426651,
-0.9087408185005188,
0.5889029502868652,
-0.08912564069032669,
-0.17098042368888855,
-1.6626965999603271,
1.3866208791732788,
0.3109758496284485,
0.4440957009792328,
0.17812399566173553,
-1.166713833808899,
0.7213605642318726,
-... |
func main() {
node1 := &TreeNode{5, nil, nil}
node2 := &TreeNode{4, nil, nil}
node3 := &TreeNode{8, nil, nil}
node4 := &TreeNode{11, nil, nil}
node5 := &TreeNode{13, nil, nil}
node6 := &TreeNode{4, nil, nil}
node7 := &TreeNode{7, nil, nil}
node8 := &TreeNode{2, nil, nil}
node9 := &TreeNode{1, nil, nil}
node1... | [
0.9170278906822205,
0.05985912308096886,
1.3045374155044556,
0.6509376168251038,
0.5648587942123413,
0.13250114023685455,
1.0367549657821655,
0.5912790894508362,
-0.15067048370838165,
0.49397313594818115,
-0.7263184785842896,
-0.28722578287124634,
-0.24639256298542023,
0.26795610785484314,... |
func NewBuild(sha string) *Build {
return &Build{
sha: sha,
runs: make(map[string]*github.CheckRun),
}
} | [
0.9881610870361328,
-1.1031869649887085,
0.10666201263666153,
0.9774198532104492,
-0.39268097281455994,
0.8984302878379822,
-0.21750448644161224,
-0.017526132985949516,
0.7802010178565979,
-0.7704838514328003,
0.6873754262924194,
0.8642946481704712,
-0.2935144901275635,
0.5824388861656189,... |
func (pipe *slimPipe) Listen() error {
pipe.infoLogger.Println("Listening on Stdin")
return nil
} | [
1.0988407135009766,
-1.1831421852111816,
0.33173903822898865,
-0.44230636954307556,
0.2687797546386719,
1.288299798965454,
0.19599775969982147,
1.0438549518585205,
-0.596161961555481,
-0.2864287495613098,
-0.5410420894622803,
0.20847930014133453,
-0.6634272933006287,
0.17894050478935242,
... |
func (pipe *slimPipe) SendMessage(message string) error {
_, err := io.WriteString(pipe.writer, message)
return err
} | [
-0.5072183012962341,
0.43098798394203186,
0.37248221039772034,
-0.3661324679851532,
0.36328864097595215,
-0.15150509774684906,
0.5876408815383911,
0.44291868805885315,
-0.30167266726493835,
-0.31392890214920044,
0.33757731318473816,
-0.5722777247428894,
-1.330924391746521,
0.63836503028869... |
func (pipe *slimPipe) Read(buffer []byte) (int, error) {
errChannel := make(chan error)
countChannel := make(chan int)
go func() {
readBytes, err := io.ReadAtLeast(pipe.reader, buffer, 1)
if err != nil {
errChannel <- err
} else {
countChannel <- readBytes
}
close(errChannel)
close(countChannel)
}... | [
-0.2530297636985779,
-0.42733234167099,
0.9344694018363953,
-0.8975849747657776,
-0.39053627848625183,
-0.39100462198257446,
0.3125435709953308,
0.12870179116725922,
-0.4991464912891388,
-0.39948174357414246,
0.2515498995780945,
0.14534640312194824,
-1.188838005065918,
0.10545328259468079,... |
func (w Worker) Start() {
go func() {
for {
// register the current worker into the worker queue.
w.WorkerPool <- w.JobChannel
select {
case job := <-w.JobChannel:
// we have r... | [
-0.2215593159198761,
-0.3894737958908081,
0.43261203169822693,
-0.5849493145942688,
0.26260918378829956,
-0.7446478009223938,
0.15435664355754852,
-0.04164962098002434,
-0.7822489738464355,
-0.07736585289239883,
-0.4342237710952759,
1.2930349111557007,
-0.28434857726097107,
0.5276222229003... |
func NewLineStartSplitFunc(re *regexp.Regexp) bufio.SplitFunc {
return func(data []byte, atEOF bool) (advance int, token []byte, err error) {
firstLoc := re.FindIndex(data)
if firstLoc == nil {
return 0, nil, nil // read more data and try again.
}
firstMatchStart := firstLoc[0]
firstMatchEnd := firstLoc[1... | [
0.5452494025230408,
-1.1532598733901978,
0.8531474471092224,
-0.7665444016456604,
-0.5677846670150757,
-0.9894717335700989,
0.647182822227478,
0.20386137068271637,
-0.2678036689758301,
-0.7580763697624207,
-0.3852429687976837,
0.18748067319393158,
0.05628455802798271,
-0.34122154116630554,... |
func NewLineEndSplitFunc(re *regexp.Regexp) bufio.SplitFunc {
return func(data []byte, atEOF bool) (advance int, token []byte, err error) {
loc := re.FindIndex(data)
if loc == nil {
return 0, nil, nil // read more data and try again
}
// If the match goes up to the end of the current buffer, do another
/... | [
0.3090374171733856,
-0.5725840330123901,
0.7581127882003784,
-1.084086298942566,
-0.5203473567962646,
-0.3973853290081024,
0.24082235991954803,
0.49399203062057495,
0.13596239686012268,
-0.08250239491462708,
-0.5266017317771912,
-0.3802063763141632,
-0.09275759011507034,
0.1699586659669876... |
func NewNewlineSplitFunc(encoding encoding.Encoding) (bufio.SplitFunc, error) {
newline, err := encodedNewline(encoding)
if err != nil {
return nil, err
}
carriageReturn, err := encodedCarriageReturn(encoding)
if err != nil {
return nil, err
}
return func(data []byte, atEOF bool) (advance int, token []byte... | [
0.2172846645116806,
-0.637285053730011,
0.5168107748031616,
-0.8138235211372375,
-0.9811756610870361,
-1.0539500713348389,
0.19039523601531982,
0.29338890314102173,
0.25952306389808655,
-0.34307602047920227,
-0.3881799578666687,
-0.38007962703704834,
0.5259511470794678,
0.554189920425415,
... |
func (l ConnectLine) perpendicularDistanceFromPointToLine(pt Point) float64 {
a, b, c := l.Coefficients()
return math.Abs(a*pt.xCoordinate+b*pt.yCoordinate+c) / math.Sqrt(a*a+b*b)
} | [
0.9833710193634033,
-0.9116955399513245,
0.6591364741325378,
-0.7795016765594482,
-0.02733660489320755,
0.8562137484550476,
-0.34286922216415405,
-0.038700252771377563,
0.2685127854347229,
-0.09295095503330231,
0.39801567792892456,
-0.6673517823219299,
-0.596965491771698,
-0.72698569297790... |
func FindFarthestPoint(line ConnectLine, ipdata []Point) (farthestPointIndex int, farthestPointDistanceFromLine float64) {
for i := 0; i < len(ipdata); i++ {
distance := line.perpendicularDistanceFromPointToLine(ipdata[i])
if distance > farthestPointDistanceFromLine {
farthestPointDistanceFromLine = distance
... | [
0.522165060043335,
-0.9258503913879395,
0.7061904668807983,
0.051794473081827164,
-0.1799870729446411,
0.16915787756443024,
-0.7636405229568481,
-0.23167988657951355,
-0.5087368488311768,
-0.16146934032440186,
0.6206834316253662,
-0.201793372631073,
-0.06286737322807312,
0.4656211137771606... |
func (r *Rdp) ToPoints() []Point {
points := make([]Point, 0, r.vs.Len())
for i := 0; i < r.vs.Len(); i++ {
points = append(points, Point{xCoordinate: r.ts.Value(i), yCoordinate: r.vs.Value(i)})
}
return points
} | [
-0.5022614002227783,
-0.004818161949515343,
0.5753036141395569,
-0.7570930123329163,
0.7529035806655884,
0.2657974660396576,
-0.535224437713623,
-0.14362917840480804,
0.35399705171585083,
1.3857930898666382,
-0.35069578886032104,
0.551729679107666,
-0.13378864526748657,
-0.5707402229309082... |
func DownSampleIpdata(ipdata []Point, epsilon float64) []Point {
if len(ipdata) <= 2 {
return ipdata
}
line := ConnectLine{Starting: ipdata[0], Ending: ipdata[len(ipdata)-1]}
farthestPointIndex, farthestPointDistanceFromLine := FindFarthestPoint(line, ipdata)
if farthestPointDistanceFromLine >= epsilon {
lef... | [
-0.3641791045665741,
-0.8346243500709534,
0.8629760146141052,
-0.791584312915802,
-0.09385855495929718,
0.2548120617866516,
-0.44384148716926575,
0.7281460165977478,
0.7559948563575745,
0.17885571718215942,
0.4551481306552887,
-0.2914952039718628,
-0.6590054631233215,
-0.577703595161438,
... |
func DownSampleRetention(ipdata []Point, startIndex int64, endIndex int64, weights []float64) []float64 {
var stack [][]int64
globalStartIndex := startIndex
globalEndIndex := endIndex
stack = append(stack, []int64{startIndex, endIndex})
for len(stack) > 0 {
n := len(stack) - 1
lineOfInterest := stack[n]
stac... | [
0.34743180871009827,
-0.2205674648284912,
0.8590013384819031,
-0.7281188368797302,
0.26399242877960205,
-0.21261610090732574,
0.5950993895530701,
0.4499988555908203,
0.08482860028743744,
0.37370190024375916,
0.42098256945610046,
-0.009173761121928692,
-1.6236822605133057,
-0.44280534982681... |
func DownSampleIpdataAuto(ipdata []Point) []Point {
if len(ipdata) <= 2 {
return ipdata
}
line := ConnectLine{Starting: ipdata[0], Ending: ipdata[len(ipdata)-1]}
farthestPointIndex, farthestPointDistanceFromLine := FindFarthestPoint(line, ipdata)
x1 := ipdata[0].xCoordinate
x2 := ipdata[len(ipdata)-1].xCoordin... | [
0.3625935912132263,
-0.6451277136802673,
1.0114343166351318,
-0.24696674942970276,
-0.20096930861473083,
0.14169901609420776,
0.4270743131637573,
0.8029913902282715,
0.24394209682941437,
-0.4666418731212616,
-0.08601868897676468,
0.6718205213546753,
-0.5978409647941589,
0.05785740911960602... |
func (r *Rdp) SplitCoordinates(sampledPoints []Point) (*array.Int, *array.Float) {
newts := array.NewIntBuilder(r.alloc)
newvs := array.NewFloatBuilder(r.alloc)
for i := range sampledPoints {
newts.Append(int64(sampledPoints[i].xCoordinate))
newvs.Append(sampledPoints[i].yCoordinate)
}
return newts.NewIntArray... | [
-0.9453309178352356,
-0.5767953395843506,
0.44660672545433044,
-0.31099656224250793,
-0.5291574001312256,
-0.03807884454727173,
0.48525628447532654,
-0.450741171836853,
0.7470621466636658,
0.5356483459472656,
-0.4747183918952942,
-0.0034470027312636375,
-0.8415704369544983,
0.1075427830219... |
func (a *AstStream) Find() []*AstInterface {
interfaces := make([]*AstInterface, 0)
for i, nodeArrayInFile := range a.Nodes { // Loop over all file linked nodes
genDecl := make([]*ast.GenDecl, 0)
// This is the file node found in the array. We will only find one because we iterate over nodes of one file
fileN... | [
-0.35634124279022217,
-0.5623035430908203,
0.6744234561920166,
-0.5332889556884766,
0.17624253034591675,
-0.10215339064598083,
0.711432933807373,
-0.4107377231121063,
-0.2852146029472351,
0.5621150732040405,
0.8530305624008179,
0.5469121932983398,
-0.9871649146080017,
1.8287198543548584,
... |
func NewAstStream(fileStream *FileStream) (astStream *AstStream) {
nodes := make([][]ast.Node, 0)
fileSet := token.NewFileSet()
fileMap := make([]*File, 0)
fileStream.ForEach(func(file File) {
parsedFile, _ := parser.ParseFile(fileSet, file.Path, nil, parser.ParseComments)
fileNodeSet := make([]ast.Node, 0)
... | [
0.2311878502368927,
-1.3093312978744507,
0.4722708761692047,
-0.47419583797454834,
-1.1638630628585815,
-0.6437582969665527,
-0.022420424968004227,
0.0008210004307329655,
-0.38014012575149536,
-0.16378532350063324,
0.5816493630409241,
0.13798652589321136,
0.9156833291053772,
1.296141862869... |
func (r *RaftNode) wonElection() bool {
return haveMajority(r.votes, "ELECTION", r.verbose)
} | [
-0.8143826127052307,
0.3932054936885834,
0.3653683066368103,
0.2789391875267029,
0.28309956192970276,
-0.8284709453582764,
1.1114134788513184,
-0.1017257496714592,
-0.22024546563625336,
0.6936917304992676,
-0.14471565186977386,
0.20151914656162262,
-0.4435886740684509,
0.7975850701332092,
... |
func (r *RaftNode) shiftToFollower(t Term, leaderID HostID) {
if r.verbose {
log.Printf("############ SHIFT TO FOLLOWER, Term: %d, LeaderID: %d", t, leaderID)
}
r.state = follower
r.CurrentTerm = t
r.currentLeader = leaderID
r.nextIndex = nil
r.matchIndex = nil
r.VotedFor = -1
} | [
-0.3355852961540222,
-0.11581926047801971,
0.3509773015975952,
-0.4834859073162079,
-0.23631486296653748,
0.4937591552734375,
0.24663595855236053,
-0.041480518877506256,
-0.07007234543561935,
0.29357755184173584,
-0.37787529826164246,
1.36262845993042,
-0.16385841369628906,
0.8105574846267... |
func (r *RaftNode) shiftToLeader() {
defer r.heartbeatAppendEntriesRPC() // We need to confirm leadership with all nodes
if r.verbose {
log.Printf("############ SHIFT TO LEADER. Term: %d", r.CurrentTerm)
}
r.state = leader
r.currentLeader = r.id
// Reset leader volatile state
r.nextIndex = make(map[HostID]Lo... | [
-0.07403793931007385,
-0.433108925819397,
0.45254749059677124,
-0.6317805647850037,
0.7111769914627075,
0.3166647255420685,
0.0882561057806015,
-0.44172418117523193,
0.18630635738372803,
0.15722066164016724,
-0.08107959479093552,
1.0817548036575317,
-0.5983920693397522,
0.08310392498970032... |
func (r *RaftNode) StoreClientData(cd ClientDataStruct, response *ClientResponse) error {
r.Lock()
defer r.Unlock()
if r.verbose {
log.Println("############ StoreClientData()")
}
// NOTE - if we do not yet know leader, client will see response.leader = -1.
// They should wait before recontact, and may recontact... | [
0.7080786824226379,
-0.43418192863464355,
0.6657961010932922,
-1.1978968381881714,
0.0030386499129235744,
0.5270307660102844,
0.40124672651290894,
-1.019961953163147,
0.8036586046218872,
-0.4575136601924896,
-0.4223044514656067,
0.45346900820732117,
-1.1202607154846191,
-0.0579639822244644... |
func (r *RaftNode) updateCommitIndex() {
// If there exists an N such that:
// 1) N > commitIndex,
// 2) a majority of matchIndex[i] >= N, and
// 3) log[N].term == currentTerm
// Then:
// set commitIndex = N
for n := r.commitIndex + 1; n <= r.getLastLogIndex(); n++ {
if r.Log[n].Term != r.CurrentTerm {... | [
-0.9007143378257751,
-0.8120694756507874,
0.6518054008483887,
-0.5361085534095764,
-0.09302470833063126,
-0.04021280258893967,
0.5925441980361938,
-0.2841048836708069,
-0.8906880617141724,
0.6216341257095337,
0.35521769523620605,
0.978679895401001,
-0.9578577280044556,
0.288987934589386,
... |
func (r *RaftNode) executeLog() {
for r.commitIndex > r.lastApplied {
r.lastApplied++
r.StateMachine.apply(r.Log[r.lastApplied])
}
} | [
0.08040054142475128,
0.6939491629600525,
0.4641879200935364,
-0.7053280472755432,
0.5273922681808472,
0.19151926040649414,
0.16805356740951538,
-0.041901055723428726,
-0.5629144310951233,
0.25791800022125244,
0.8633514642715454,
0.18737664818763733,
0.3423754572868347,
0.1595887988805771,
... |
func (r *RaftNode) AppendEntries(ae AppendEntriesStruct, response *RPCResponse) error {
r.Lock()
defer r.Unlock()
if r.verbose {
log.Printf("AppendEntries(). ae: %s", ae.String())
log.Printf("My log: %s", r.Log.String())
}
response.Term = r.CurrentTerm
if ae.LeaderID == r.currentLeader {
if r.verbose {
... | [
0.6162517666816711,
-0.32742831110954285,
0.9171260595321655,
-0.47055158019065857,
0.3725455105304718,
-0.16351744532585144,
0.6449611783027649,
-0.6496831178665161,
1.1143680810928345,
0.2254149168729782,
0.3710196316242218,
-0.22022898495197296,
-1.0378339290618896,
0.1969379484653473,
... |
func (r *RaftNode) CandidateLooksEligible(candLastLogIdx LogIndex, candLastLogTerm Term) bool {
ourLastLogTerm := r.getLastLogTerm()
ourLastLogIdx := r.getLastLogIndex()
if r.verbose {
log.Printf("We have: lastLogTerm=%d, lastLogIdx=%d. They have: lastLogTerm=%d, lastLogIdx=%d", ourLastLogTerm, ourLastLogIdx, cand... | [
0.034753549844026566,
-0.7683014273643494,
0.8228843212127686,
-0.46355941891670227,
-0.8821653723716736,
0.2172885537147522,
-0.6856880784034729,
-0.3518783450126648,
0.006291768979281187,
0.5621806383132935,
0.11652520298957825,
1.5488677024841309,
-0.7045084238052368,
-0.250292003154754... |
func (r *RaftNode) Vote(rv RequestVoteStruct, response *RPCResponse) error {
r.Lock()
defer r.Unlock()
if r.verbose {
log.Println("Vote()")
}
defer r.persistState()
response.Term = r.CurrentTerm
myLastLogTerm := r.getLastLogTerm()
myLastLogIdx := r.getLastLogIndex()
if r.verbose {
log.Printf("RequestVo... | [
0.0672701969742775,
-0.4052872359752655,
0.8003588318824768,
-0.31902506947517395,
-0.1905791461467743,
0.2090831995010376,
0.20101973414421082,
-0.7602508664131165,
0.1316835731267929,
-0.053232405334711075,
0.6186795830726624,
0.7082713842391968,
-1.2410211563110352,
-0.07128646969795227... |
func (r *RaftNode) Start() {
go r.recvDaemon()
go r.protocol()
go r.quitter(duration)
<-r.quitChan
log.Println("FINISH EXPERIMENT...")
r.printResults()
} | [
0.3024887442588806,
0.7390751838684082,
0.2530328631401062,
-0.3565252423286438,
0.49508732557296753,
0.18222853541374207,
0.5887991786003113,
-0.6679279804229736,
-0.8771774768829346,
0.608616828918457,
-0.21120572090148926,
1.7123054265975952,
-0.7379404902458191,
0.9532813429832458,
0... |
func (r *RaftNode) quitter(quitTime int) {
for {
select {
case <-r.quitChan: // the node decided it should quit
return
case <-time.After(time.Duration(quitTime) * time.Second): // we decide the node should quit
r.quitChan <- true
return
}
}
} | [
-0.738838791847229,
0.13156212866306305,
0.35743507742881775,
-0.6293810606002808,
-0.03490438312292099,
0.589897632598877,
0.35571491718292236,
-1.0881984233856201,
-0.40042001008987427,
0.21497464179992676,
0.2951310873031616,
0.6131554841995239,
-0.62973952293396,
1.323334813117981,
0... |
func Raft() {
flag.Parse()
hosts := make(HostMap)
clients := make(ClientMap)
quitChan := make(chan bool)
intID, recvPort := ResolveAllPeers(hosts, clients, hostfile, true)
id := HostID(intID)
r := NewRaftNode(id, recvPort, hosts, clients, quitChan)
log.Printf("RaftNode: %s", r.String())
r.Start()
} | [
0.43076881766319275,
0.7434887290000916,
0.3700380027294159,
-0.052262358367443085,
1.0957677364349365,
0.27339041233062744,
0.6834241151809692,
0.03163713961839676,
-1.400055170059204,
-0.09069159626960754,
-0.6510732173919678,
1.3235194683074951,
-0.3603273630142212,
0.3310742676258087,
... |
func Version() string {
return "1.0.6"
} | [
0.06205488368868828,
-1.3832749128341675,
0.23906198143959045,
0.8911141157150269,
-0.08463500440120697,
0.6079515218734741,
1.004695177078247,
-0.0630895271897316,
-0.2187870442867279,
0.8154820203781128,
-1.056481122970581,
-0.7900664806365967,
-0.21146640181541443,
0.6071937084197998,
... |
func loadEnumWithComment(filename string) ([][]string, error) {
fd, err := os.Open(filename)
if err != nil {
return nil, err
}
defer fd.Close()
rtn := make([][]string, 0)
rd := bufio.NewReader(fd)
for {
line, err := rd.ReadString('\n')
line = strings.TrimSpace(line)
if len(line) != 0 && line[0] != '#' {
... | [
-0.16586588323116302,
-0.9506469368934631,
0.9383388161659241,
-0.7833983302116394,
0.013247684575617313,
-0.4037802815437317,
0.6263030767440796,
-0.08079437166452408,
0.2483609914779663,
1.298671841621399,
-0.2366923689842224,
-0.41059067845344543,
-0.3219855725765228,
0.9739441275596619... |
func saveTo(outdata *bytes.Buffer, buferr error, outfilename string) error {
if buferr != nil {
fmt.Printf("fail %v %v\n", outfilename, buferr)
return buferr
}
src, err := format.Source(outdata.Bytes())
if err != nil {
fmt.Println(outdata)
fmt.Printf("fail %v %v\n", outfilename, err)
return err
}
if wer... | [
-0.04222635179758072,
-0.22403429448604584,
0.7052257657051086,
-0.8837427496910095,
0.3868548274040222,
0.701702356338501,
0.4917418956756592,
0.10994986444711685,
-0.3084440231323242,
0.26983386278152466,
-0.7892866730690002,
0.7167654633522034,
-0.38939374685287476,
0.3169986605644226,
... |
func GetRtLmpPrice(settlementZone string) (float32, string, error) {
// Get the HTML
html, err := getWebpageHTML()
if err != nil {
return float32(0), "", err
}
//fmt.Println(html)
price, asOfTimestampRaw, err := extractPrice(html, settlementZone)
if err != nil {
return float32(0), "", err
}
log.Printf("%f... | [
-0.18364399671554565,
-0.7709789276123047,
0.7348251938819885,
-0.6194959878921509,
-0.7527629137039185,
-0.27915042638778687,
-0.4222526252269745,
-0.06904903799295425,
0.7077687978744507,
1.4729139804840088,
0.08855150640010834,
-0.9825315475463867,
-0.5715441107749939,
0.947276830673217... |
func getWebpageHTML() (string, error) {
response, httpGetError := http.Get(RtLmpPriceWebpageURL)
if httpGetError != nil {
return "", httpGetError
}
htmlBytes, bodyReadError := ioutil.ReadAll(response.Body)
if bodyReadError != nil {
return "", bodyReadError
}
return string(htmlBytes), nil
} | [
0.08085643500089645,
0.2249109148979187,
0.6176056265830994,
0.08932597935199738,
-0.5644229650497437,
0.11284084618091583,
-0.1716463267803192,
-0.0002985949977301061,
-0.13669638335704803,
1.1064400672912598,
0.5766804814338684,
0.36267322301864624,
-1.1025117635726929,
0.221860215067863... |
func extractPrice(
html string,
settlementZone string,
) (float32, string, error) {
// Extract the Last Updated timestamp before we remove spaces
asOfRegExp := regexp.MustCompile(`<div[^>]+>Last Updated: [ ]*([^<]+)</div>`)
asOfHTMLMatches := asOfRegExp.FindAllStringSubmatch(html, -1)
if asOfHTMLMatches == ... | [
0.05479617789387703,
0.43807631731033325,
0.8218574523925781,
0.20580263435840607,
-0.7162776589393616,
-0.7982350587844849,
0.07210417091846466,
0.12111279368400574,
0.34814462065696716,
0.762247622013092,
0.7934986352920532,
-1.0726118087768555,
0.3365554213523865,
0.5379903316497803,
... |
func C_spatial_segment(sted, prov int) int {
switch {
case sted == 0:
return 0
case sted == 1:
return 1
case sted == 2:
return 2
case prov == 4 || prov == 9 || prov == 11 || prov == 12:
return 4
default:
return 3
}
} | [
-1.0360107421875,
-0.49336352944374084,
0.6751410365104675,
0.35047647356987,
-0.03622928261756897,
-0.08450000733137131,
0.172305166721344,
-0.018366217613220215,
-0.29375511407852173,
0.49293968081474304,
0.15902306139469147,
0.9192595481872559,
0.2479998767375946,
-0.32708144187927246,
... |
func ReadSubzones(filename string) <-chan *Subzone {
c := make(chan *Subzone, runtime.NumCPU()*5)
go func() {
defer close(c)
readSubzones(filename, c)
}()
return c
} | [
-0.02282574586570263,
-0.027048323303461075,
0.4663164019584656,
0.7456502318382263,
-1.203986406326294,
0.6552044153213501,
1.5933963060379028,
-0.632708728313446,
-0.517928957939148,
-0.30948546528816223,
-0.5025880336761475,
0.36157846450805664,
-0.8505005240440369,
-0.5418961644172668,... |
func logLevelsExample() {
lDebug := log.New(os.Stdout, "DEBUG: ", log.Lshortfile)
logFile := new(bytes.Buffer)
w := SustainedMultiWriter(logFile, lDebug.Writer())
lError := log.New(w, "ERROR: ", log.Lshortfile)
fmt.Println("standard output:")
lError.Print("cannot communicate with the database")
lDebug.Print("yo... | [
0.6980042457580566,
-0.45468729734420776,
0.6955490112304688,
-0.32681894302368164,
-0.2501721978187561,
0.4058244526386261,
-0.9864988923072815,
0.22050423920154572,
-0.7757413983345032,
-0.3769315183162689,
-0.8584004640579224,
-0.3496687114238739,
0.1274726688861847,
0.6703643798828125,... |
func newTestClient(fn roundTripFunc) *http.Client {
return &http.Client{
Transport: fn,
}
} | [
-0.0746387168765068,
-0.7830079793930054,
0.10884624719619751,
-0.7509371042251587,
-0.6287970542907715,
-0.12196044623851776,
0.500176191329956,
-0.7758633494377136,
-0.5779203772544861,
-0.850287914276123,
0.4129922389984131,
0.1628079116344452,
-0.17084096372127533,
-1.2916111946105957,... |
func New(c *conf.Config) (d *Dao) {
d = &Dao{
conf: c,
DB: sql.NewMySQL(c.Mysql),
client: httpx.NewClient(conf.Conf.HTTPClient),
}
return
} | [
0.34337514638900757,
-0.0443110354244709,
0.4206869900226593,
-0.2752196490764618,
-1.1027507781982422,
0.14128513634204865,
0.047741830348968506,
0.5536878705024719,
-0.12840716540813446,
-0.3265800476074219,
-0.6821430921554565,
0.09224368631839752,
0.8957744240760803,
0.7817775011062622... |
func (v *RawAttribute) xorAddr(transID []byte) *Host {
xorIP := make([]byte, 16)
for i := 0; i < len(v.Value)-4; i++ {
xorIP[i] = v.Value[i+4] ^ transID[i]
}
family := uint16(v.Value[1])
port := bin.Uint16(v.Value[2:4])
// Truncate if IPv4, otherwise net.IP sometimes renders it as an IPv6 address.
if family ==... | [
0.05992501974105835,
-0.23512522876262665,
0.4770660400390625,
-0.8888311386108398,
-1.0130321979522705,
-0.6754334568977356,
-0.4966604709625244,
-0.5479248762130737,
0.6534475088119507,
0.4472675323486328,
0.7024816870689392,
-0.22276492416858673,
0.06362463533878326,
-0.8159912824630737... |
func (v *RawAttribute) rawAddr() *Host {
host := new(Host)
host.family = uint16(v.Value[1])
host.port = bin.Uint16(v.Value[2:4])
// Truncate if IPv4, otherwise net.IP sometimes renders it as an IPv6 address.
if host.family == familyIPv4 {
v.Value = v.Value[:8]
}
host.ip = net.IP(v.Value[4:]).String()
return h... | [
-0.1439223289489746,
-0.45232319831848145,
0.5034512281417847,
-0.7136319279670715,
-0.9625973105430603,
-0.006175321526825428,
0.09200480580329895,
-0.44680896401405334,
0.535729706287384,
-0.17794345319271088,
0.8418287634849548,
0.05751374736428261,
0.8342500925064087,
-0.70282906293869... |
func renderPDF(vb []Visit) gopdf.GoPdf {
doc := gopdf.GoPdf{}
doc.Start(gopdf.Config{ PageSize: *gopdf.PageSizeA4 })
doc.AddPage()
err := doc.AddTTFFont("Roboto", "./assets/Roboto-Regular.ttf")
if err != nil {
logrus.Error(err)
}
doc.SetTextColor(getForegroundColor())
offsetY := 25
for i,v := range vb {
... | [
0.006251559127122164,
0.6176832318305969,
0.8312221765518188,
-0.6404879689216614,
0.3605552911758423,
0.18124207854270935,
0.5682706236839294,
0.030150381848216057,
-0.4657866358757019,
0.8435041308403015,
1.172663688659668,
0.41307172179222107,
-0.0388849675655365,
-0.020680757239460945,... |
func (e *Ethereum) Ping() bool {
_, err := e.GetBalance(BURN_ADDRESS)
if err != nil {
log.Debug(err)
return false
}
return true
} | [
-0.3125021755695343,
0.5781044363975525,
0.8238711953163147,
0.1079893410205841,
0.9018571972846985,
0.4022790491580963,
-0.717053234577179,
0.25924041867256165,
0.6820145845413208,
1.0234078168869019,
0.2526884973049164,
-1.2553761005401611,
-0.6638471484184265,
-0.2034415602684021,
-0.... |
func (size Size) Format(precision int, scale SizeScale) string {
var (
power = 0
value = float64(size)
)
for value >= float64(scale.Divizor) && power+1 < len(scale.Suffixes) {
power += 1
value /= float64(scale.Divizor)
}
return strconv.FormatFloat(value, 'f', precision, 64) +
scale.Suffixes[power]
} | [
0.5386310815811157,
-0.7129856944084167,
0.6217716336250305,
-0.4491454064846039,
-0.7765728831291199,
-0.4381488561630249,
-0.5960881114006042,
-0.33245277404785156,
-0.09043168276548386,
-0.1349584460258484,
1.2153428792953491,
-0.31264495849609375,
0.6505193114280701,
0.768264651298523,... |
func (size *Size) String() string {
return size.Format(1, SizeScaleBinary)
} | [
0.17743538320064545,
-1.0342365503311157,
0.23970240354537964,
0.10563267022371292,
-0.0697229653596878,
0.598421037197113,
0.13125354051589966,
-2.038719654083252,
0.2256491780281067,
0.21018120646476746,
-0.22762852907180786,
-0.20374086499214172,
-0.3364377021789551,
0.3417801558971405,... |
func (size Size) AsInt64() int64 {
return int64(size)
} | [
-0.48234280943870544,
-0.7106234431266785,
0.3188236355781555,
0.2805858850479126,
0.13457797467708588,
-0.8732677698135376,
0.12379300594329834,
-0.6685702204704285,
0.44137561321258545,
-0.11500080674886703,
-0.6359984278678894,
-0.7090159058570862,
-0.7437798976898193,
0.760800302028656... |
func ParseServerConfig(filename string) ServerConfig {
var config ServerConfig
err := gcfg.ReadFileInto(&config, filename)
if err != nil {
glog.Fatalf("Failed to parse gcfg data: %s", err)
}
// checking configuation is sensible
if len(config.Peers.Address) == 0 {
glog.Fatal("At least one server is required")
... | [
0.40795233845710754,
-0.3583601713180542,
0.7808306217193604,
0.20385923981666565,
-0.5706755518913269,
0.5993417501449585,
0.06675474345684052,
-0.4781862795352936,
-0.37442800402641296,
0.9302147030830383,
0.02024691179394722,
0.16872934997081757,
-1.3189398050308228,
1.0930285453796387,... |
func Runner() *CommandRunner {
return &CommandRunner{
ExecCommand: execute,
}
} | [
-0.027986472472548485,
-0.40178078413009644,
-0.011837035417556763,
-0.05326353758573532,
-0.4245382249355316,
0.24874776601791382,
-0.030648430809378624,
0.4876614212989807,
-0.2206660956144333,
-1.3350938558578491,
-0.6768950819969177,
0.17962083220481873,
0.4918127655982971,
-0.09866931... |
func SaveToFile(folderPath, fileName, content string) error {
fileFullPath := path.Join(folderPath, fileName)
log.Infof("Saving content to file %v...", fileFullPath)
fileInfo, err := os.Stat(folderPath)
if os.IsNotExist(err) {
// Config folder does not exist, create one.
if err = os.MkdirAll(folderPath, 0755);... | [
-0.1485382318496704,
-0.0024159441236406565,
0.5103409886360168,
-0.1883043348789215,
1.0869463682174683,
0.13109442591667175,
0.4430408477783203,
-0.1917397379875183,
-1.2226749658584595,
0.9012511372566223,
-0.33211055397987366,
-0.5618821382522583,
-0.3933262228965759,
0.080271281301975... |
func main() {
rand.Seed(time.Now().Unix())
canvas.Decimals=0
canvas.Start(width, height)
canvas.Rect(0, 0, width, height)
w, h, gutter := 24.0, 18.0, 5.0
rows, cols := 16.0, 16.0
top, left := 20.0, 20.0
for r, x := 0.0, left; r < rows; r++ {
for c, y := 0.0, top; c < cols; c++ {
canvas.Rect(x, y, w, h,
... | [
-0.01494554802775383,
0.3254483640193939,
0.9486569762229919,
-0.6335462927818298,
0.3434517979621887,
0.5880687832832336,
0.9042103290557861,
-0.5800926089286804,
0.159192755818367,
-0.42175284028053284,
0.25689828395843506,
0.0523139126598835,
0.13381090760231018,
0.8426135182380676,
-... |
func TestSpecies_reproduce_fail(t *testing.T) {
sp := NewSpecies(1)
sp.ExpectedOffspring = 1
opts := neat.Options{}
babies, err := sp.reproduce(opts.NeatContext(), 1, nil, nil)
assert.Empty(t, babies, "no offsprings expected")
assert.EqualError(t, err, "attempt to reproduce out of empty species")
} | [
-0.1450011283159256,
0.5957840085029602,
0.3978986442089081,
0.06757965683937073,
0.29895448684692383,
1.0461937189102173,
-0.09107017517089844,
-0.07279353588819504,
-0.3304934501647949,
-0.49029937386512756,
-0.7036802768707275,
0.5349481105804443,
-0.5161899924278259,
0.0982380807399749... |
func TestSpecies_reproduce(t *testing.T) {
rand.Seed(42)
in, out, maxHidden, n := 3, 2, 15, 3
linkProb := 0.8
// Configuration
opts := &neat.Options{
DropOffAge: 5,
SurvivalThresh: 0.5,
AgeSignificance: 0.5,
PopSize: 30,
CompatThreshold: 0.6,
MutateAddLinkProb: 0.9,
Mut... | [
0.18913725018501282,
0.3486008048057556,
0.7932214736938477,
0.36776429414749146,
0.5662874579429626,
0.7545123100280762,
0.4822280704975128,
0.17542409896850586,
-0.4005112051963806,
-0.3740358054637909,
-0.4099693298339844,
0.33779627084732056,
-0.2557167112827301,
0.09746275097131729,
... |
func NewNamedDSFetcherMap(dss map[string]rrd.DataSourcer) *namedDsFetcher {
result := make(mapCache)
for name, ds := range dss {
ident := serde.Ident{"name": name}
result[ident.String()] = &mapCacheEntry{
ident: ident,
ds: ds,
}
}
return NewNamedDSFetcher(result, nil, 0)
} | [
-1.3562463521957397,
-0.26265156269073486,
0.20929238200187683,
-0.45934242010116577,
-1.7237324714660645,
-0.1620122790336609,
-0.4605567455291748,
-0.6250287890434265,
-0.05926695466041565,
-0.4773206114768982,
-1.6718966960906982,
0.1545095294713974,
0.8026136755943298,
1.13919568061828... |
func InitDashboardClient(configPath string, checkInterval int) {
dms3libs.LogDebug(filepath.Base((dms3libs.GetFunctionName())))
dashboardConfig = new(tomlTables)
dms3libs.LoadComponentConfig(&dashboardConfig, filepath.Join(configPath, "dms3dashboard", "dms3dashboard.toml"))
dashboardClientMetrics = &DeviceMetric... | [
0.8007252812385559,
0.9009518027305603,
0.7910642027854919,
-0.5712856650352478,
-0.3643503487110138,
0.7892289757728577,
1.411342978477478,
0.0969265028834343,
-1.2312110662460327,
0.011685841716825962,
-0.3551882207393646,
0.20902453362941742,
-0.4900516867637634,
0.13034042716026306,
... |
func ReceiveDashboardRequest(conn net.Conn) {
dms3libs.LogDebug(filepath.Base((dms3libs.GetFunctionName())))
if receiveDashboardEnableState(conn) {
sendDashboardData(conn)
}
} | [
0.1615934520959854,
0.7145172953605652,
0.5754511952400208,
0.3693939745426178,
0.17747968435287476,
-0.2951928973197937,
0.1822478473186493,
0.7260739207267761,
-0.276004433631897,
-0.3682417571544647,
-0.14019393920898438,
0.24538427591323853,
0.040795665234327316,
-0.23142804205417633,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.