text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func ReadStrings(prompt string) []string {
str := ReadString(prompt)
if str == "" {
return []string{}
}
res := strings.Split(str, ",")
for i := range res {
res[i] = strings.TrimSpace(res[i])
}
return res
} | [
-0.5096986889839172,
-0.07143997400999069,
0.4999585747718811,
0.02482806146144867,
-0.43480992317199707,
-0.17162589728832245,
-0.5097911953926086,
0.10767673701047897,
0.8833762407302856,
0.2629155218601227,
0.8142341375350952,
0.5124520659446716,
-1.076507329940796,
-0.997424304485321,
... |
func ReadBool(prompt string) bool {
str := strings.ToLower(ReadString(prompt))
return str == "t" || str == "true"
} | [
-0.6736952662467957,
-0.33754056692123413,
0.4443359375,
0.2580731511116028,
-0.2259937822818756,
0.9411989450454712,
-0.8563711047172546,
0.1637994945049286,
-0.3769356310367584,
0.46200910210609436,
0.7774467468261719,
-0.32550328969955444,
-0.19000068306922913,
-1.2379595041275024,
-0... |
func Scenes(ff ffmpeg.Runner, vid string, probabilty float64) ([]float64, error) {
stderr, err := ff.ExecFFmpeg("-i", vid,
"-vf", fmt.Sprintf("select='gt(scene,%f)',showinfo", probabilty),
"-f", "null", "-")
if err != nil {
log.Print(streams.ReadString(stderr))
return nil, err
}
return ParseScenes(stderr)
} | [
-0.06377570331096649,
0.0035120199900120497,
0.4434557557106018,
0.41030266880989075,
-0.24712581932544708,
-0.5628257989883423,
-0.7400864958763123,
-0.7453989386558533,
-0.19862248003482819,
0.35665255784988403,
0.23597267270088196,
0.4070752263069153,
-0.3923889398574829,
0.773322343826... |
func ParseScenes(r io.Reader) ([]float64, error) {
scanner := bufio.NewScanner(r)
var result []float64
for scanner.Scan() {
line := scanner.Text()
match := sceneRE.FindStringSubmatch(line)
if len(match) == 2 {
f, err := strconv.ParseFloat(match[1], 64)
if err != nil {
return nil, err
}
result ... | [
-0.20014025270938873,
-0.5580666065216064,
0.37125831842422485,
-0.1232345700263977,
-0.11892668902873993,
-0.9147303700447083,
-0.2531231641769409,
-0.27363255620002747,
-0.8733130693435669,
0.2546814978122711,
-0.15993663668632507,
-0.430072158575058,
-0.72270268201828,
0.833846330642700... |
func SceneIntervals(ff ffmpeg.Runner, vid string, probabilty float64, minDuration float64, duration float64) ([]*interval.Interval, error) {
seconds, err := Scenes(ff, vid, probabilty)
if err != nil {
return nil, err
}
return Intervals(seconds, minDuration, duration), nil
} | [
-0.4289265275001526,
-0.9278272390365601,
0.3247421085834503,
1.197568416595459,
-0.23761236667633057,
-0.053935497999191284,
-0.6952905058860779,
-0.35804271697998047,
-0.06572020053863525,
0.44188863039016724,
-0.2509748935699463,
0.45241090655326843,
-1.1570196151733398,
0.6154042482376... |
func Intervals(seconds []float64, minDuration float64, duration float64) []*interval.Interval {
var result []*interval.Interval
prev := 0.0
for _, sec := range seconds {
if sec > duration {
// end of video.
break
}
if sec-prev >= minDuration {
result = append(result, interval.New(prev, prev+minDuratio... | [
-0.8117932677268982,
-0.18808671832084656,
0.5998891592025757,
1.0566335916519165,
-0.333925724029541,
-0.212983638048172,
-0.5442596673965454,
-0.7151167392730713,
0.0860847681760788,
0.20746570825576782,
-0.20062024891376495,
1.6101301908493042,
-0.6043713688850403,
0.33299925923347473,
... |
func NewDefaultResourceCmd() *cobra.Command {
defaultResourceCmd := &cobra.Command{
Use: "defaultresource",
Short: "This is a manageable command for default resources",
Long: "This is a manageable command for default resources",
}
// Adds the commands for application.
defaultResourceCmd.AddCommand(NewDe... | [
0.4084564745426178,
-0.6675375699996948,
0.2028663456439972,
0.4012455642223358,
0.6768932938575745,
-0.2500159740447998,
0.35945531725883484,
0.22933490574359894,
0.5246168375015259,
-0.6021721363067627,
0.15381479263305664,
-0.39247801899909973,
-0.9428325295448303,
1.2443221807479858,
... |
func NewDefaultResourceLoadCmd() *cobra.Command {
loadCmd := &cobra.Command{
Use: "load",
Short: "Load default resources into the namespace 'default'.",
Long: "Load default resources into the namespace 'default'.",
Run: func(cmd *cobra.Command, args []string) {
logger := logger.NewLogger()
if nameSpa... | [
0.3379109501838684,
-0.5875794291496277,
0.6380933523178101,
-0.5695703625679016,
0.13972805440425873,
-0.02089189551770687,
-0.34697046875953674,
-0.4300236403942108,
0.349281907081604,
-0.11623217165470123,
0.2160532921552658,
-0.16269978880882263,
-0.444191575050354,
1.3184412717819214,... |
func Unmarshal(data []byte) Flag {
return Flag(binary.LittleEndian.Uint16(data[0:2]))
} | [
0.977660059928894,
0.6480886340141296,
0.4177837669849396,
-0.6721315383911133,
-0.017291605472564697,
0.5850443243980408,
-0.15285004675388336,
0.7135605216026306,
-0.028284259140491486,
-0.8627015352249146,
-0.2415836602449417,
0.24016965925693512,
-0.4696201682090759,
-0.473383277654647... |
func (f Flag) String() string {
var flags []string
// Report known flags
if f&Dirty != 0 {
flags = append(flags, "Dirty")
}
if f&ResizeLogFile != 0 {
flags = append(flags, "ResizeLogFile")
}
if f&UpgradeOnMount != 0 {
flags = append(flags, "UpgradeOnMount")
}
if f&MountedOnNT4 != 0 {
flags = append(fl... | [
0.5100784301757812,
-0.43343600630760193,
0.47947654128074646,
-0.17379866540431976,
0.30620139837265015,
0.2905784845352173,
0.1626862734556198,
-0.6755185723304749,
-0.43073567748069763,
0.06840145587921143,
0.12615031003952026,
0.3298800587654114,
-0.41046765446662903,
0.190210074186325... |
func RPC(r string) Option {
return func(o *Options) {
o.RPC = r
}
} | [
0.6093884110450745,
0.10038308799266815,
0.3553331196308136,
-0.9805426597595215,
0.41124165058135986,
1.1184515953063965,
0.22279375791549683,
-1.3490346670150757,
1.0771329402923584,
0.30259817838668823,
0.08737289160490036,
-0.4821794629096985,
0.01933383382856846,
-0.8122269511222839,
... |
func Context(ctx context.Context) Option {
return func(o *Options) {
o.Context = ctx
}
} | [
0.49885091185569763,
0.31035152077674866,
0.3282459080219269,
-0.18282915651798248,
0.8006842732429504,
0.6664218306541443,
0.4303184151649475,
-0.6079848408699036,
2.0159249305725098,
-0.7578306794166565,
-0.6657838225364685,
0.5117596387863159,
0.6380040645599365,
-0.9215937852859497,
... |
func HandleSignal(b bool) Option {
return func(o *Options) {
o.Signal = b
}
} | [
0.2857447564601898,
0.7852749228477478,
0.3620132505893707,
1.0521693229675293,
0.16800442337989807,
0.6766167283058167,
-0.03376791626214981,
0.3898368775844574,
0.7576466202735901,
-0.37739619612693787,
-0.7487725019454956,
-0.8457667827606201,
-0.2753159999847412,
0.023831870406866074,
... |
func Registry(r registry.Registry) Option {
return func(o *Options) {
o.Registry = r
}
} | [
0.3151167333126068,
1.0293844938278198,
0.12056830525398254,
0.23783166706562042,
0.8798278570175171,
-0.15393058955669403,
0.9409889578819275,
-0.2089582085609436,
1.6590179204940796,
-0.695517361164093,
-0.08281677961349487,
0.053784552961587906,
0.7674472332000732,
-0.41869720816612244,... |
func Selector(s selector.Selector) Option {
return func(o *Options) {
o.Selector = s
}
} | [
0.486133873462677,
-0.434955894947052,
-0.045972540974617004,
0.09230060130357742,
-0.4728121757507324,
-0.798174262046814,
0.46561121940612793,
-0.1073155403137207,
1.48581862449646,
-1.2895623445510864,
-0.2969664931297302,
0.2134254276752472,
1.1232388019561768,
-0.6848015785217285,
-... |
func Transport(t transport.Transport) Option {
return func(o *Options) {
o.Transport = t
}
} | [
0.25832483172416687,
0.2880183756351471,
0.24695606529712677,
-0.2959304749965668,
0.43585720658302307,
0.6943104863166809,
0.7474859952926636,
-0.8442443013191223,
1.0567599534988403,
-0.9036303162574768,
-1.0672670602798462,
0.08766856044530869,
0.6484583020210266,
-0.695354163646698,
... |
func Address(addr string) Option {
return func(o *Options) {
o.ServerOptions = append(o.ServerOptions, server.Address(addr))
}
} | [
-0.13384594023227692,
-0.30980634689331055,
0.5510112047195435,
-0.25884944200515747,
-0.11931973695755005,
1.0290321111679077,
0.19330966472625732,
0.5037107467651367,
2.0384559631347656,
-0.3080563247203827,
-0.36685580015182495,
1.1443119049072266,
-0.11622719466686249,
0.88800048828125... |
func Name(n string) Option {
return func(o *Options) {
o.Name = n
o.ServerOptions = append(o.ServerOptions, server.Name(n))
}
} | [
-0.5233944654464722,
0.12441283464431763,
0.5648606419563293,
-0.5857419371604919,
-0.6683578491210938,
-0.0907360389828682,
0.15131346881389618,
-0.7444034218788147,
0.8637121915817261,
0.6478439569473267,
-1.6103432178497314,
-0.18681490421295166,
0.46667855978012085,
0.19047869741916656... |
func Version(v string) Option {
return func(o *Options) {
o.ServerOptions = append(o.ServerOptions, server.Version(v))
}
} | [
-0.016018828377127647,
-0.2677064836025238,
0.3269520699977875,
-0.22563312947750092,
0.24230393767356873,
0.8276349306106567,
0.4305213689804077,
0.16823071241378784,
1.1532775163650513,
0.4027908444404602,
-1.6447157859802246,
0.11229506134986877,
-0.14794810116291046,
0.3240409195423126... |
func Metadata(md map[string]string) Option {
return func(o *Options) {
o.ServerOptions = append(o.ServerOptions, server.Metadata(md))
}
} | [
-0.21636417508125305,
0.40875017642974854,
0.41947489976882935,
-0.00928567722439766,
0.9232156276702881,
0.5211383104324341,
-0.6248112916946411,
-0.3169293999671936,
0.8412394523620605,
0.4007337987422943,
0.11264145374298096,
0.7419317364692688,
0.07168827950954437,
0.5152206420898438,
... |
func Profile(p profile.Profile) Option {
return func(o *Options) {
o.Profile = p
}
} | [
0.649122953414917,
0.5084800124168396,
0.31650763750076294,
0.5866259932518005,
1.0697484016418457,
0.3514231741428375,
0.6774138808250427,
-0.7633708715438843,
1.379813313484192,
-0.4550628662109375,
-0.7521690130233765,
-0.4599982798099518,
-0.21797630190849304,
-0.5813145637512207,
-0... |
func RegisterTTL(t time.Duration) Option {
return func(o *Options) {
o.ServerOptions = append(o.ServerOptions, server.RegisterTTL(t))
}
} | [
-0.16704979538917542,
1.2243543863296509,
0.5493776202201843,
-0.1064542829990387,
0.6287423968315125,
0.24326908588409424,
-0.25278612971305847,
-0.6584409475326538,
0.6887412071228027,
-0.03200656175613403,
-1.5663378238677979,
-0.08565958589315414,
0.6550721526145935,
0.2029313296079635... |
func RegisterInterval(t time.Duration) Option {
return func(o *Options) {
o.ServerOptions = append(o.ServerOptions, server.RegisterInterval(t))
}
} | [
-0.7559062242507935,
0.6405428647994995,
0.40042129158973694,
0.08107650279998779,
0.8970298767089844,
0.655523419380188,
-0.21917369961738586,
-0.1355675756931305,
0.36422979831695557,
-0.37114033102989197,
-1.1147083044052124,
0.11962520331144333,
-0.5823598504066467,
0.5078003406524658,... |
func WrapClient(w ...client.Wrapper) Option {
return func(o *Options) {
o.ClientWrapper = w
}
} | [
-0.6624848246574402,
-0.13766451179981232,
0.3493206202983856,
-0.3694114685058594,
0.14215117692947388,
1.169236421585083,
0.28443264961242676,
-0.7521575093269348,
0.08300421386957169,
-0.24481911957263947,
-0.135817289352417,
0.3138945996761322,
0.0579887218773365,
-0.18884733319282532,... |
func WrapCall(w ...client.CallWrapper) Option {
return func(o *Options) {
o.CallWrapper = w
}
} | [
-0.01118429284542799,
0.5812048316001892,
0.48235708475112915,
0.26568010449409485,
-0.21214844286441803,
1.6344163417816162,
-0.6081355214118958,
-0.8007498383522034,
0.6064209938049316,
0.17255477607250214,
0.5003422498703003,
0.06688192486763,
0.04398630931973457,
0.13135965168476105,
... |
func WrapHandler(w ...server.HandlerWrapper) Option {
return func(o *Options) {
o.HandlerWrapper = w
}
} | [
-0.7240508198738098,
-0.4045872986316681,
0.3807879686355591,
0.25419196486473083,
-0.02669244073331356,
1.4650641679763794,
0.2189062237739563,
0.13064362108707428,
0.23028378188610077,
-0.762624204158783,
0.10772015899419785,
-0.26547008752822876,
0.00037938434979878366,
0.88145005702972... |
func WrapSubscriber(w ...server.SubscriberWrapper) Option {
return func(o *Options) {
o.SubscriberWrapper = w
}
} | [
-0.37350738048553467,
-0.6109346151351929,
0.5332116484642029,
0.4433319568634033,
-0.2689264118671417,
0.3821525573730469,
-0.5810930132865906,
-0.3737527132034302,
0.5330418944358826,
-0.06423083692789078,
0.13066506385803223,
0.4036729037761688,
0.4531369209289551,
0.933842658996582,
... |
func Process(tmpl string, data *CheckVATPost, w io.Writer) error {
t := template.Must(template.New("check-vat-request").Parse(tmpl))
// send the template to whatever writer is provided.
return t.Execute(w, data)
} | [
0.20372654497623444,
-0.03783085569739342,
0.4303632080554962,
0.08900214731693268,
0.11800657212734222,
-0.3594507575035095,
-0.5230831503868103,
-0.15999296307563782,
0.00966970156878233,
0.3049846291542053,
0.5279148817062378,
-0.5925642251968384,
0.08731110394001007,
-0.257684975862503... |
func TestCalcTxID2(t *testing.T) {
hex, _ := hex.DecodeString("0200000001ab7eb14cb93b3fe7912ca748c2d3ed8fd46f8f89d07de74501a1b2e52cccf865010000006a47304402204b29409ce1fa7e3f833bcf8a6a67e263f3f0c5a266e70431063f52e751673856022009dcc5251da1cebead16771f7b31c5583df63aea948764ca80e02027b2aac1a0412102f798925328c78e8bc55ea911... | [
0.9891987442970276,
-0.4441452920436859,
0.3015652000904083,
-0.43815916776657104,
-0.2166297733783722,
0.027171913534402847,
-1.0514988899230957,
-0.06551528722047806,
0.18646396696567535,
-0.5401321649551392,
-0.9874122142791748,
0.08541969209909439,
-0.20015119016170502,
-0.398561000823... |
func Test(t *testing.T) {
txid, _ := hex.DecodeString("db1fa15cb0239a0b2afa88a77e6ce8929abafd99ce5e7c6ef2225bab6500fa6f")
index := uint32(0)
// address : = "19dCWu1pvak7cgw5b1nFQn9LapFSQLqahC"
amount := toSatoshi(0.00019803)
script, _ := hex.DecodeString("76a9145e9997f0cfc486fb8bb137a018ad70b1ebd8da8d88ac")
tx :... | [
0.9375569820404053,
0.33767467737197876,
0.8118155598640442,
-0.711989164352417,
-0.002389707835391164,
-0.16159501671791077,
0.21482159197330475,
-0.2842813730239868,
0.5073412656784058,
-0.5853938460350037,
-0.6384977102279663,
0.04725443571805954,
-0.3608512580394745,
-0.449265003204345... |
func newConfigFromString(t *testing.T, configString string) (Config, func(), error) {
testFs, testFsTeardown := setupTestFs()
err := afero.WriteFile(testFs, "config.properties", []byte(configString), 0644)
if err != nil {
// Fatal stops the goroutine before the caller can defer the teardown function
// run it ... | [
0.6592563986778259,
-1.1897612810134888,
0.26882171630859375,
0.4719277322292328,
-0.47457513213157654,
-1.1323741674423218,
0.5852137207984924,
0.46063944697380066,
-0.15062683820724487,
0.13037730753421783,
-0.1948237121105194,
-0.620990514755249,
0.3298279345035553,
0.0930473655462265,
... |
func (f *FileAttr) MarshalOscriptBuf(buf oscript.Buffer) error {
buf.WriteString("A<1,?,'CreatedDate'=")
buf.WriteEncode(f.Created)
buf.WriteString(",'FileName'=")
buf.WriteStringValue(f.Name)
buf.WriteString(",'FileSize'=" + strconv.FormatInt(f.Size, 10))
buf.WriteString(",'ModifiedDate'=")
buf.WriteEncode(f.Mo... | [
0.4682465195655823,
-0.8658949136734009,
0.6056787967681885,
-1.066261887550354,
-0.020727982744574547,
-0.3817601799964905,
-0.21770034730434418,
-0.07624891400337219,
-0.16199840605258942,
-0.11366146802902222,
-0.44764167070388794,
1.2202787399291992,
0.5965548753738403,
1.2857851982116... |
func OpenFile(name string) (*os.File, *FileAttr, error) {
f, err := os.Open(name)
if err != nil {
return nil, nil, err
}
s, err := f.Stat()
if err != nil {
return nil, nil, err
}
return f, &FileAttr{
Name: s.Name(),
Size: s.Size(),
Created: time.Now(),
Modified: s.ModTime(),
}, nil
} | [
-0.4450787603855133,
-0.2912239134311676,
0.6074978113174438,
-1.1696698665618896,
-0.9449809789657593,
-0.34129148721694946,
0.482074111700058,
-0.011339977383613586,
-0.4246845841407776,
-0.4396401047706604,
0.29222023487091064,
-0.16259364783763885,
0.5028747320175171,
0.584769129753112... |
func (s *Session) CreateFile(ctx context.Context, parent int64, name string, file *FileAttr, r io.Reader) error {
c, err := s.connect(ctx)
if err != nil {
return err
}
defer c.Close()
if err := c.Write(docmanService, "CreateSimpleDocument", s.auth,
oscript.M{
"parentID": parent,
"name": name,
"fi... | [
-0.013406976126134396,
-0.24139392375946045,
0.4500679671764374,
-0.8403668403625488,
-0.25326213240623474,
0.2649071514606476,
0.3051329255104065,
-0.5731549263000488,
-0.4327152371406555,
-0.0714806616306305,
0.49071893095970154,
-0.7156124711036682,
-0.497526079416275,
0.051177352666854... |
func (s *Session) AddVersionFile(ctx context.Context, file *FileAttr, r io.Reader) error {
c, err := s.connect(ctx)
if err != nil {
return err
}
defer c.Close()
if err := c.Write(docmanService, "AddVersion", s.auth,
oscript.M{
"ID": file.NodeID,
"Metadata": nil,
"fileAtts": file,
}); err != n... | [
-0.257999986410141,
-0.3882986605167389,
0.6133787035942078,
-0.44521045684814453,
-0.1620396226644516,
0.9290550351142883,
0.3561027944087982,
0.17855781316757202,
-0.8343306183815002,
0.5492571592330933,
0.024754878133535385,
0.20596528053283691,
-0.30658668279647827,
0.4921507239341736,... |
func (s *Session) ReadFile(ctx context.Context, id, version int64, w io.Writer) (*FileAttr, error) {
c, err := s.connect(ctx)
if err != nil {
return nil, err
}
defer c.Close()
if err := c.Write(docmanService, "GetVersionContents", s.auth,
oscript.M{
"ID": id,
"versionNum": version,
}); err != ... | [
-0.39989057183265686,
-0.49979400634765625,
0.5284112691879272,
-0.29303231835365295,
-0.5641664266586304,
-0.3952066898345947,
0.3377443552017212,
-0.11052759736776352,
-0.6957457065582275,
-0.18147405982017517,
0.6234315633773804,
0.17895515263080597,
-0.14888329803943634,
-0.15963524580... |
func isGoFile(dir *os.Dir) bool {
return dir.IsRegular() &&
!strings.HasPrefix(dir.Name, ".") && // ignore .files
pathutil.Ext(dir.Name) == ".go"
} | [
-0.13630521297454834,
1.175233244895935,
0.7642724514007568,
0.06205424293875694,
0.3807513117790222,
0.49142271280288696,
0.41428232192993164,
0.2601063847541809,
-0.3193425238132477,
0.7893633842468262,
-0.46988818049430847,
0.14209537208080292,
-0.4228843152523041,
0.36126142740249634,
... |
func newDirectory(root string, maxDepth int) *Directory {
d, err := os.Lstat(root);
if err != nil || !isPkgDir(d) {
return nil
}
return newDirTree(root, d.Name, 0, maxDepth);
} | [
-0.030505066737532616,
0.18258875608444214,
0.32063886523246765,
0.6967501044273376,
-1.0495445728302002,
-0.8444148898124695,
-0.09487979114055634,
-0.27915504574775696,
0.7108161449432373,
-0.568608283996582,
0.040309496223926544,
0.480025976896286,
0.2807287275791168,
1.4959328174591064... |
func (dir *Directory) lookup(path string) *Directory {
path = pathutil.Clean(path); // no trailing '/'
if dir == nil || path == "" || path == "." {
return dir
}
dpath, dname := pathutil.Split(path);
if dpath == "" {
// directory-local name
for _, d := range dir.Dirs {
if dname == d.Name {
return d
... | [
-0.37815746665000916,
0.32186999917030334,
0.5944547653198242,
-0.11998322606086731,
-0.9722824692726135,
-0.8059549331665039,
0.7355871200561523,
-0.19633477926254272,
1.1429951190948486,
-0.17118579149246216,
0.47373104095458984,
0.3729412257671356,
0.3309052884578705,
-0.183713003993034... |
func (root *Directory) listing(skipRoot bool) *DirList {
if root == nil {
return nil
}
// determine number of entries n and maximum height
n := 0;
minDepth := 1 << 30; // infinity
maxDepth := 0;
for d := range root.iter(skipRoot) {
n++;
if minDepth > d.Depth {
minDepth = d.Depth
}
if maxDepth < d.D... | [
-0.6163735389709473,
-0.03465970605611801,
0.8446105718612671,
-0.11298370361328125,
-0.8599664568901062,
-0.36269402503967285,
0.3545621633529663,
0.6037843227386475,
0.7090796232223511,
0.41466814279556274,
0.0953076034784317,
0.20055869221687317,
0.4222556948661804,
0.03067394159734249,... |
func parse(path string, mode uint) (*ast.File, *parseErrors) {
src, err := io.ReadFile(path);
if err != nil {
log.Stderrf("%v", err);
errs := []parseError{parseError{nil, 0, err.String()}};
return nil, &parseErrors{path, errs, nil};
}
prog, err := parser.ParseFile(path, src, mode);
if err != nil {
var err... | [
-0.2943390905857086,
-0.5115904211997986,
0.7156592607498169,
-0.7322835326194763,
-1.0551940202713013,
-0.34636038541793823,
0.2729906737804413,
-0.23448115587234497,
0.12564219534397125,
0.4860455095767975,
0.1717633754014969,
0.15340089797973633,
-0.022418271750211716,
-0.29121941328048... |
func writeNode(w io.Writer, node interface{}, html bool, styler printer.Styler) {
mode := printer.UseSpaces;
if html {
mode |= printer.GenHTML
}
(&printer.Config{mode, *tabwidth, styler}).Fprint(w, node);
} | [
-0.9343662858009338,
0.341567724943161,
0.3765050768852234,
-0.195521280169487,
0.0016681846464052796,
0.1741928905248642,
-0.43078285455703735,
0.5482650995254517,
-0.01894655078649521,
0.10372112691402435,
1.2300938367843628,
0.09806343168020248,
0.30260583758354187,
1.168548822402954,
... |
func writeText(w io.Writer, text []byte, html bool) {
if html {
template.HTMLEscape(w, text);
return;
}
w.Write(text);
} | [
-0.34391653537750244,
1.2548432350158691,
0.29083529114723206,
0.4297529458999634,
0.06578969210386276,
0.11464997380971909,
-0.559457004070282,
0.8981606364250183,
0.4044150114059448,
0.4284793436527252,
-0.6704906821250916,
-0.6331520676612854,
-0.583662748336792,
0.6574417948722839,
-... |
func writeAny(w io.Writer, x interface{}, html bool) {
switch v := x.(type) {
case []byte:
writeText(w, v, html)
case string:
writeText(w, strings.Bytes(v), html)
case ast.Decl:
writeNode(w, v, html, &defaultStyler)
case ast.Expr:
writeNode(w, v, html, &defaultStyler)
default:
if html {
var buf bytes... | [
-0.9595697522163391,
0.06909020245075226,
0.8769781589508057,
0.06990699470043182,
0.1198134794831276,
-0.3222019076347351,
-0.6402646899223328,
-0.09937947988510132,
-0.1280658096075058,
-0.5650405287742615,
-0.003037387505173683,
0.09171923995018005,
-0.030156441032886505,
1.280173420906... |
func htmlFmt(w io.Writer, x interface{}, format string) {
writeAny(w, x, true)
} | [
-0.13603100180625916,
-0.16462846100330353,
0.45298710465431213,
-0.18072213232517242,
-0.5817095041275024,
0.2908972203731537,
-0.9976577162742615,
-0.39869987964630127,
0.3956930935382843,
-0.9415760040283203,
0.21676842868328094,
-0.053813137114048004,
0.11108343303203583,
1.00165367126... |
func htmlCommentFmt(w io.Writer, x interface{}, format string) {
var buf bytes.Buffer;
writeAny(&buf, x, false);
doc.ToHTML(w, buf.Bytes()); // does html-escaping
} | [
0.22462011873722076,
-0.4128934144973755,
0.6471812725067139,
-0.8659536242485046,
-0.07349968701601028,
0.25243738293647766,
-0.24353229999542236,
-0.2764246165752411,
0.31723448634147644,
-0.32802772521972656,
0.73000568151474,
-0.04437106475234032,
0.42340147495269775,
0.796211838722229... |
func textFmt(w io.Writer, x interface{}, format string) {
writeAny(w, x, false)
} | [
0.13120882213115692,
-1.0198335647583008,
0.4378148019313812,
-0.6380573511123657,
-0.5798265337944031,
-0.3178895115852356,
-1.4614367485046387,
-0.11264609545469284,
0.15270186960697174,
-0.1699756681919098,
-0.001327395555563271,
-0.5479540228843689,
-0.4144650399684906,
0.7326444387435... |
func pathFmt(w io.Writer, x interface{}, format string) {
// TODO(gri): Need to find a better solution for this.
// This will not work correctly if *cmdroot
// or *pkgroot change.
writeAny(w, removePrefix(x.(string), "src"), true)
} | [
0.03282232582569122,
-1.053989052772522,
0.4897342622280121,
-0.355804979801178,
-0.5735422372817993,
-0.110747329890728,
-0.06013995036482811,
-0.40565311908721924,
0.39883658289909363,
0.2651234269142151,
0.8495747447013855,
-0.1291360855102539,
-0.11363887041807175,
1.1508679389953613,
... |
func linkFmt(w io.Writer, x interface{}, format string) {
type Positioner interface {
Pos() token.Position;
}
if node, ok := x.(Positioner); ok {
pos := node.Pos();
if pos.IsValid() {
// line id's in html-printed source are of the
// form "L%d" where %d stands for the line number
fmt.Fprintf(w, "/%s#L... | [
0.24335452914237976,
-1.013756513595581,
0.45772987604141235,
-1.2772700786590576,
0.3092682361602783,
-0.22273966670036316,
-0.3282816410064697,
-0.19886146485805511,
0.605133593082428,
-1.0008560419082642,
1.011230707168579,
0.4009786546230316,
0.7909523248672485,
0.9160436987876892,
-... |
func infoKindFmt(w io.Writer, x interface{}, format string) {
fmt.Fprintf(w, infoKinds[x.(SpotKind)]) // infoKind entries are html-escaped
} | [
-0.08681763708591461,
-1.4002689123153687,
0.38365307450294495,
-0.7693474292755127,
-0.30958491563796997,
0.20984071493148804,
-1.081616997718811,
-0.7831365466117859,
0.3106425404548645,
0.11067960411310196,
0.5529810190200806,
0.8284093141555786,
0.41149964928627014,
0.7051063179969788,... |
func infoLineFmt(w io.Writer, x interface{}, format string) {
info := x.(SpotInfo);
line := info.Lori();
if info.IsIndex() {
index, _ := searchIndex.get();
line = index.(*Index).Snippet(line).Line;
}
fmt.Fprintf(w, "%d", line);
} | [
-0.07265163958072662,
-1.361436128616333,
0.5510416030883789,
-0.9281201958656311,
0.574612021446228,
0.00784563459455967,
-0.7654568552970886,
-0.02974671497941017,
0.5208566784858704,
-0.09026230871677399,
0.20155425369739532,
-0.3400913178920746,
0.5615205764770508,
0.09355359524488449,... |
func infoSnippetFmt(w io.Writer, x interface{}, format string) {
info := x.(SpotInfo);
text := `<span class="alert">no snippet text available</span>`;
if info.IsIndex() {
index, _ := searchIndex.get();
// no escaping of snippet text needed;
// snippet text is escaped when generated
text = index.(*Index).Snip... | [
-0.5391049981117249,
-0.4605276584625244,
0.29566556215286255,
-0.7905411720275879,
-0.5663538575172424,
0.01436511892825365,
-0.6131867170333862,
-0.12753446400165558,
0.32969939708709717,
0.15702997148036957,
0.3858293294906616,
-0.46255701780319214,
0.5161179900169373,
0.321562081575393... |
func paddingFmt(w io.Writer, x interface{}, format string) {
for i := x.(int); i > 0; i-- {
fmt.Fprint(w, `<td width="25"></td>`)
}
} | [
-0.20495253801345825,
0.7242445945739746,
0.7449039220809937,
-0.07303072512149811,
-0.2647130489349365,
0.29954177141189575,
-0.2417500764131546,
-0.8496478796005249,
-0.3312057852745056,
-0.08346252143383026,
0.7668774127960205,
-0.4147377610206604,
0.4747636318206787,
1.216268539428711,... |
func timeFmt(w io.Writer, x interface{}, format string) {
// note: os.Dir.Mtime_ns is in uint64 in ns!
template.HTMLEscape(w, strings.Bytes(time.SecondsToLocalTime(int64(x.(uint64)/1e9)).String()))
} | [
0.6875457763671875,
-0.4278983771800995,
0.5565142035484314,
-0.8301851153373718,
-0.48060542345046997,
-0.06605193018913269,
-0.5381706953048706,
-0.41931039094924927,
0.7734448313713074,
0.2840372920036316,
0.07332354784011841,
-0.5265734195709229,
0.7136214375495911,
1.564558744430542,
... |
func commentText(src []byte) (text string) {
i := bytes.Index(src, tagBegin);
j := bytes.Index(src, tagEnd);
if i >= 0 && j >= i+len(tagBegin) {
text = string(bytes.TrimSpace(src[i+len(tagBegin) : j]))
}
return;
} | [
0.18130254745483398,
-0.7663949728012085,
0.5541657209396362,
-0.8001463413238525,
-0.834408164024353,
-0.1132223904132843,
0.5894550681114197,
-0.19371332228183746,
0.6292209625244141,
1.1529027223587036,
-0.6343052983283997,
-0.5257633328437805,
-1.3913283348083496,
-0.39740869402885437,... |
func (h *httpHandler) getPageInfo(path string) PageInfo {
// the path is relative to h.fsroot
dirname := pathutil.Join(h.fsRoot, path);
// the package name is the directory name within its parent
// (use dirname instead of path because dirname is clean; i.e. has no trailing '/')
_, pkgname := pathutil.Split(dirna... | [
-0.1902378797531128,
0.17987558245658875,
0.7955315709114075,
0.0394313745200634,
-0.06752724945545197,
-0.9006591439247131,
0.6916624903678894,
-0.11528962850570679,
-0.053905047476291656,
-0.021741509437561035,
0.6218444108963013,
-0.5711286067962646,
0.4748739004135132,
0.79554486274719... |
func NewMongoClient(ctx context.Context, user string, pass string, host string, opts *mongo.ClientOptions) (Client, error) {
var creds string
if user != "" {
creds = user
if pass != "" {
creds += ":" + pass
}
creds += "@"
}
client, err := mongo.NewClientWithOptions("mongodb://"+creds+host, opts)
if e... | [
-0.27626076340675354,
-0.24698755145072937,
0.5073477625846863,
1.2167001962661743,
-0.613868772983551,
0.47176411747932434,
-0.5617517828941345,
0.008093862794339657,
-0.4720925986766815,
0.25147825479507446,
-0.2300049364566803,
1.4820419549942017,
-0.47015130519866943,
-0.65081226825714... |
func (mc Wrapper) Database(name string) DataLayer {
return &WrapperDatabase{Database: mc.Client.Database(name)}
} | [
-0.6545496582984924,
0.00467992527410388,
0.044700730592012405,
-0.1395076960325241,
-0.3150756359100342,
0.050234366208314896,
-0.5091089606285095,
-0.7377806305885315,
-0.02108263224363327,
-0.31410157680511475,
-0.27742627263069153,
0.24770638346672058,
-0.18649379909038544,
0.746246993... |
func (mc Wrapper) Close() error {
return mc.Client.Disconnect(mc.ctx)
} | [
-0.9079647660255432,
-0.46615326404571533,
0.3859582245349884,
-0.01601332053542137,
-0.810723602771759,
0.25339776277542114,
-0.48993590474128723,
-0.7815752029418945,
-0.2791626453399658,
0.047367777675390244,
0.9055719375610352,
0.11534291505813599,
-0.9112851023674011,
0.43787908554077... |
func (d WrapperDatabase) Collection(name string) CollectionLayer {
return &WrapperCollection{Collection: d.Database.Collection(name)}
} | [
-0.5097762942314148,
-0.3135232925415039,
0.34637200832366943,
-0.6570432782173157,
-0.4965500831604004,
0.4061124622821808,
-0.19343611598014832,
-0.7456437349319458,
-0.35169070959091187,
0.2005191147327423,
-0.2956685721874237,
0.2577527165412903,
0.5796767473220825,
0.9772245287895203,... |
func (c WrapperCollection) InsertOne(ctx context.Context, document interface{}, opts ...option.InsertOneOptioner) (InsertOneResultLayer, error) {
var insertResult *WrapperInsertOneResult
var err error
// Recover on panic() from mongo driver.
defer func() {
if r := recover(); r != nil {
insertResult = nil
e... | [
-1.6978641748428345,
0.6763777136802673,
0.7181480526924133,
0.7279467582702637,
0.3527925908565521,
0.27308809757232666,
1.015819787979126,
-0.3321036398410797,
0.26420876383781433,
-0.11685299873352051,
-0.5439988970756531,
-0.036538444459438324,
-1.5300949811935425,
-0.01566541008651256... |
func (c WrapperCollection) FindOne(ctx context.Context, filter interface{}, opts ...option.FindOneOptioner) DocumentResultLayer {
var docResult *WrapperDocumentResult
// Recover on panic() from mongo driver.
defer func() {
if r := recover(); r != nil {
docResult = nil
}
}()
docResult = &WrapperDocumentRes... | [
-1.0358566045761108,
0.2880982458591461,
0.5843944549560547,
0.5299043655395508,
-0.047733891755342484,
0.22881275415420532,
0.5990567207336426,
-0.85112065076828,
0.13572853803634644,
-0.08301927149295807,
0.04719170928001404,
0.004611165262758732,
-1.3132182359695435,
0.16707675158977509... |
func (c WrapperCollection) FindOneAndUpdate(ctx context.Context, filter interface{}, update interface{}, opts ...option.FindOneAndUpdateOptioner) DocumentResultLayer {
// No need to panic check. Fails gracefully.
return &WrapperDocumentResult{c.Collection.FindOneAndUpdate(ctx, filter, update, opts...)}
} | [
-1.0268263816833496,
-0.7903339266777039,
0.4723886549472809,
-0.2613559663295746,
-0.6243378520011902,
-0.17970259487628937,
0.09341295063495636,
-1.0525211095809937,
0.6642206907272339,
-0.22686319053173065,
0.31724420189857483,
-0.012038157321512699,
-1.5302553176879883,
0.5838598608970... |
func (c WrapperCollection) FindOneAndDelete(ctx context.Context, filter interface{}, opts ...option.FindOneAndDeleteOptioner) DocumentResultLayer {
var docResult *WrapperDocumentResult
// Recover on panic() from mongo driver.
defer func() {
if r := recover(); r != nil {
docResult = nil
}
}()
docResult = &... | [
-0.7852134704589844,
-0.11278484016656876,
0.5150866508483887,
0.07924074679613113,
-0.3009328246116638,
-0.4270729720592499,
0.659576416015625,
-0.6167950630187988,
1.1496286392211914,
0.33191776275634766,
0.5604459047317505,
-0.0912335216999054,
-1.4094505310058594,
0.7716176509857178,
... |
func (d WrapperDocumentResult) Decode() (*bson.Document, error) {
elem := bson.NewDocument()
err := d.DocumentResult.Decode(elem)
return elem, err
} | [
-0.6318292617797852,
0.3525123596191406,
0.10073915868997574,
0.5863453149795532,
-0.6910157203674316,
-0.5062882900238037,
-0.21612314879894257,
-0.474220871925354,
0.11043248325586319,
-0.32967624068260193,
-0.29629239439964294,
-0.14294996857643127,
-1.279552698135376,
-0.53673422336578... |
func GetEligibleCustomer(ipFile io.Reader) ([]model.Customer, error) {
// Initialize the eligibleCustomersList
var eligibleCustomersList []model.Customer
customer := model.Customer{}
// Create new scanner to read from input file
scanner := bufio.NewScanner(ipFile)
// Read the line
for scanner.Scan() {
line :=... | [
0.30079832673072815,
-0.6263009309768677,
0.546627402305603,
0.17991763353347778,
-0.6340303421020508,
0.2892996370792389,
-1.0959646701812744,
1.2346086502075195,
-0.7371010184288025,
0.7741787433624268,
-0.25935012102127075,
0.2836754620075226,
-0.6750155091285706,
0.02622837759554386,
... |
func isCustomerEligible(customer model.Customer) bool {
// Call the function that will calculate the difference
distance := calculateDistance(*customer.Latitude, *customer.Longitude)
// If the distance is within the distance limit return true
if distance <= model.DistanceLimit {
return true
}
return false
} | [
0.26508432626724243,
0.030510008335113525,
0.9280593991279602,
0.45777320861816406,
-1.0343029499053955,
0.5402649641036987,
-0.732204258441925,
0.8352413177490234,
-0.3940744698047638,
0.36692073941230774,
-0.5407186150550842,
-0.7181892991065979,
-1.0495234727859497,
-0.29809483885765076... |
func calculateDistance(customerLatitude float64, customerLongitude float64) float64 {
// Convert customer and office latitudes to radians
phi1 := customerLatitude * math.Pi / 180
phi2 := model.OfficeLatitude * math.Pi / 180
// Take absolute difference of customer and office longitudes in radians
deltaLambda := mat... | [
0.9261541962623596,
-1.0130912065505981,
0.781724214553833,
-0.3894144296646118,
-0.7635293006896973,
0.9114386439323425,
0.06146559864282608,
0.8575374484062195,
-0.0867421105504036,
0.7456924915313721,
-0.7122921943664551,
0.3463008999824524,
-0.6193011403083801,
0.16915786266326904,
-... |
func GenerateOutputFile(customers []model.Customer, opFilePath string) {
// Sort eligible customers by their User ID (ascending)
sort.Slice(customers, func(i, j int) bool { return customers[i].UserID < customers[j].UserID })
// Generate a JSON with all eligible customers
output, err := json.MarshalIndent(customers,... | [
0.3250422775745392,
-0.4383595287799835,
0.8333947658538818,
0.1290920227766037,
-0.16136343777179718,
0.4450603425502777,
0.7683006525039673,
0.3420616388320923,
-1.1768234968185425,
0.577363908290863,
-0.06544340401887894,
-0.2760757803916931,
-0.00009478491847403347,
0.04280589893460274... |
func mapServerConf(conf Config) server.Config {
var c server.Config
var err error
if conf.Webserver.LogFile != "" {
if c.LogFile, err = os.OpenFile(logFile, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0666); err != nil {
log.Printf("Unable to open logfile (%v) for writing: %v", logFile, err)
os.Exit(2)
}
}
if... | [
-0.32232895493507385,
-0.9083877205848694,
0.6343128085136414,
-0.7737201452255249,
-0.46080830693244934,
0.3305942118167877,
-0.09635953605175018,
0.5350514650344849,
0.1579216867685318,
0.1098356768488884,
-0.8130828142166138,
0.263594388961792,
0.1849810779094696,
0.9421135783195496,
... |
func WithoutAll() Option {
return func(d *Decoder) {
d.proto = false
d.byteDec = false
d.hex = false
d.base64 = false
}
} | [
0.37254390120506287,
-0.2280675172805786,
0.31422239542007446,
-0.1632794588804245,
-0.908797025680542,
0.7525083422660828,
0.12439695745706558,
0.264483243227005,
-0.27884554862976074,
-0.5434751510620117,
-1.1055158376693726,
-0.23365402221679688,
-0.24667875468730927,
0.9129330515861511... |
func New(opts ...Option) Decoder {
d := defaultDecoder
for _, o := range opts {
o(&d)
}
return d
} | [
-0.7494581341743469,
-0.4550153911113739,
0.39301663637161255,
0.10253266245126724,
-0.2174101322889328,
-0.8912745714187622,
-0.7407318353652954,
-0.057716287672519684,
-0.650679886341095,
-1.0091280937194824,
-0.012303613126277924,
0.2703825533390045,
0.5026460886001587,
0.76632189750671... |
func DecodeAll(input []byte, opts ...Option) []byte {
if len(input) == 0 {
return []byte{}
}
var (
decoder = New(opts...)
result = input
enc Encoding
)
for result, enc = decoder.Decode(result); enc != None; result, enc = decoder.Decode(result) {
// continue decoding as long a a decoder was applied... | [
0.4043341875076294,
-0.24687424302101135,
0.5866058468818665,
0.8473095297813416,
-0.22710469365119934,
-0.5739001631736755,
-0.6047263145446777,
-0.07506368309259415,
0.8904116153717041,
-1.0060324668884277,
-0.34117311239242554,
0.5011537671089172,
-0.9427996873855591,
1.4140350818634033... |
func (d *Decoder) Decode(input []byte) ([]byte, Encoding) {
if len(input) == 0 {
return []byte{}, None
}
unmarshalled := &protodec.Empty{}
if d.proto {
if err := proto.Unmarshal(input, unmarshalled); err == nil {
// TODO: remove control characters (unfortunately, they are all valid strings here)
return ... | [
-0.035871971398591995,
-0.32591238617897034,
0.7859801650047302,
0.41888970136642456,
-0.2328038364648819,
-0.6807333827018738,
0.002656684722751379,
0.4660242199897766,
0.1511514037847519,
-0.5311315655708313,
0.07201141864061356,
0.1251446008682251,
-0.4083440601825714,
0.918670237064361... |
func (*Singleton) 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 _Singleton_OneofMarshaler, _Singleton_OneofUnmarshaler, _Singleton_OneofSizer, []interface{}{
(*Singleton... | [
-0.5487493872642517,
0.8025925755500793,
0.7565345168113708,
-0.9086347818374634,
0.6849966049194336,
-0.9166419506072998,
0.8926520943641663,
-0.44071370363235474,
0.673267662525177,
-0.7186219692230225,
-0.5832105278968811,
0.13374143838882446,
-0.31777724623680115,
0.8912960290908813,
... |
func LazyCreateDynamicClient(client dynamic.Interface) (dynamic.Interface, error) {
if client != nil {
return client, nil
}
if IsNoKubernetes() {
scheme := runtime.NewScheme()
return fakedyn.NewSimpleDynamicClient(scheme), nil
}
f := kubeclient.NewFactory()
cfg, err := f.CreateKubeConfig()
if err != nil {
... | [
-0.15000225603580475,
-0.17570483684539795,
0.5922113060951233,
-0.3869175314903259,
0.26408055424690247,
-0.6022670865058899,
0.4367099702358246,
-1.6482570171356201,
-0.11350160837173462,
-0.8727288246154785,
-0.33534756302833557,
0.6676021814346313,
-0.23345176875591278,
0.5704774260520... |
func LazyCreateKubeClient(client kubernetes.Interface) (kubernetes.Interface, error) {
return LazyCreateKubeClientWithMandatory(client, false)
} | [
-0.5657392144203186,
0.30414879322052,
0.28880777955055237,
-0.2094651162624359,
-0.1631847470998764,
0.17383185029029846,
-0.015278526581823826,
-1.186984658241272,
0.031071146950125694,
-0.4297497272491455,
-0.4419960677623749,
0.32363882660865784,
-0.7053452134132385,
0.9638826847076416... |
func LazyCreateKubeClientWithMandatory(client kubernetes.Interface, mandatory bool) (kubernetes.Interface, error) {
if client != nil {
return client, nil
}
if !mandatory && IsNoKubernetes() {
return NewFakeKubernetesClient("default"), nil
}
f := kubeclient.NewFactory()
cfg, err := f.CreateKubeConfig()
if err... | [
-0.2627986669540405,
0.04914310574531555,
0.46760690212249756,
-0.4543946385383606,
-0.30086275935173035,
-0.048364266753196716,
-0.7151899337768555,
-0.7494333982467651,
0.31443268060684204,
0.5336711406707764,
0.08566050976514816,
0.39840373396873474,
-0.4981423616409302,
0.4559485614299... |
func LazyCreateKubeClientAndNamespace(client kubernetes.Interface, ns string) (kubernetes.Interface, string, error) {
if client != nil && ns != "" {
return client, ns, nil
}
if IsNoKubernetes() {
if ns == "" {
ns = "default"
}
if client == nil {
client = NewFakeKubernetesClient(ns)
}
return client,... | [
-0.21303561329841614,
-0.2587457299232483,
0.40404370427131653,
-0.6446559429168701,
-0.4695311188697815,
-0.35926562547683716,
-0.10595398396253586,
-1.3231357336044312,
1.0090545415878296,
-0.09421089291572571,
0.26566147804260254,
0.6780706644058228,
-0.26604241132736206,
1.125687122344... |
func IsInCluster() bool {
_, err := rest.InClusterConfig()
return err == nil
} | [
0.38902363181114197,
-0.03270788490772247,
0.4995080232620239,
0.12758225202560425,
0.060459282249212265,
-0.34283533692359924,
-0.1798383742570877,
0.8034182190895081,
0.17343534529209137,
-0.02191099151968956,
-0.4191349446773529,
1.1146634817123413,
-1.2366482019424438,
0.16855975985527... |
func IsNoKubernetes() bool {
// disable k8s by default if inside a github action
if strings.ToLower(os.Getenv("GITHUB_ACTIONS")) == "true" {
return strings.ToLower(os.Getenv("JX_KUBERNETES")) != "true"
}
return strings.ToLower(os.Getenv("JX_NO_KUBERNETES")) == "true"
} | [
-0.6386324167251587,
0.28972703218460083,
0.5085843801498413,
0.5772722959518433,
-0.593827486038208,
0.2205095738172531,
-0.3353588283061981,
-0.5015963912010193,
0.6096874475479126,
0.5389747023582458,
0.05017019435763359,
-0.020695261657238007,
-0.20394790172576904,
1.1987030506134033,
... |
func NewFakeKubernetesClient(ns string) *fake.Clientset {
return fake.NewSimpleClientset(&corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: ns,
},
})
} | [
-0.17501942813396454,
-0.5085879564285278,
0.3491375744342804,
0.30383357405662537,
-1.1850999593734741,
-0.17865118384361267,
-0.5284707546234131,
-1.6633143424987793,
0.3152874708175659,
0.08880385011434555,
-0.36247149109840393,
0.45414766669273376,
-0.22663359344005585,
0.0420916527509... |
func New(conn *driver.Conn, args, env []string) (sys *Sysdb, err error) {
for _, s := range [...]string{attach, createEnv, createArg} {
if err = exec(conn, s); err != nil {
return nil, err
}
}
err = load(conn, insArg, args, func(arg string) ([]*string, error) {
return []*string{&arg}, nil
})
if err != ni... | [
-0.7693665623664856,
-0.495386004447937,
0.8677457571029663,
0.19844631850719452,
-0.08502873033285141,
-0.07461918890476227,
-0.06264201551675797,
0.13909845054149628,
-0.9421192407608032,
-0.2186395525932312,
-0.1730595976114273,
0.05970359221100807,
0.10642203688621521,
1.21615445613861... |
func (s *Sysdb) Close() error {
return errint.Wrap(s.readAllEnv.Close())
} | [
-0.16291899979114532,
-0.4320259988307953,
0.4633680582046509,
1.049607515335083,
-0.20401997864246368,
0.7561855316162109,
-0.4084818959236145,
0.17693974077701569,
-0.02731027454137802,
-0.9908174872398376,
0.7189266681671143,
-0.029959022998809814,
-0.15495942533016205,
1.45579218864440... |
func (s *Sysdb) Environ() ([]string, error) {
i, err := s.readAllEnv.Iter()
if err != nil {
return nil, errint.Wrap(err)
}
var env []string
for i.Next() {
r := i.Row()[0]
env = append(env, *r)
}
if err := i.Err(); err != nil {
return nil, errint.Wrap(err)
}
return env, nil
} | [
-0.3803184926509857,
-1.009305477142334,
0.8164377212524414,
0.6514813303947449,
0.2847761809825897,
0.12653328478336334,
-0.4373200535774231,
1.256804347038269,
0.27975624799728394,
0.8694102168083191,
-0.2604036033153534,
0.3932368755340576,
-0.21077996492385864,
0.992461621761322,
0.6... |
func (s *scaleDecider) needScale() bool {
lastUpdated := s.lastProviderUpdated
if lastUpdated.Before(s.lastSchedulerUpdated) {
lastUpdated = s.lastSchedulerUpdated
}
now := time.Now()
if now.After(s.lastProvision.Add(minRetryInterval)) ||
s.lastProvision.Before(lastUpdated.Add(s.maxStartingPeriod)) ||
s.las... | [
-1.4120841026306152,
-0.11694934964179993,
0.8001760244369507,
-0.5349004864692688,
-0.5383321642875671,
0.09391386061906815,
-0.9603203535079956,
-0.01068042777478695,
-0.2923967242240906,
0.7764876484870911,
-0.0647306889295578,
-0.2578549087047577,
-0.7446333765983582,
0.982526540756225... |
func (rf *Raft) sendRequestVote(server int, args *RequestVoteArgs, reply *RequestVoteReply) bool {
ok := rf.peers[server].Call("Raft.RequestVote", args, reply)
return ok
} | [
-1.7217257022857666,
0.6659510135650635,
0.8312348127365112,
0.7307031750679016,
0.17303933203220367,
0.21706810593605042,
-0.9719288349151611,
-0.5586418509483337,
-0.4343738853931427,
0.06299328804016113,
-0.05966845154762268,
0.571821928024292,
-1.641867995262146,
0.05286068469285965,
... |
func Catch(cb func(p *Panic)) {
if reason := recover(); reason != nil && cb != nil {
stack := make([]byte, maxStackBufferSize)
count := runtime.Stack(stack, true)
cb(&Panic{
Reason: reason,
Stack: string(stack[:count]),
})
}
} | [
1.0632069110870361,
0.8397040963172913,
0.5005127191543579,
0.49871888756752014,
-0.06983756273984909,
0.046267565339803696,
0.25632014870643616,
-0.8405137658119202,
0.7657940983772278,
0.4971284866333008,
-0.0977357029914856,
-0.13871175050735474,
-0.06447934359312057,
0.3775811791419983... |
func Do(f func(), cb func(p *Panic)) {
defer Catch(cb)
f()
} | [
0.7929072380065918,
0.6797526478767395,
0.42587751150131226,
1.0152852535247803,
0.4305444061756134,
1.415858507156372,
-0.7514612078666687,
-0.7390448451042175,
-0.24684526026248932,
0.41345998644828796,
-0.14458249509334564,
0.42093050479888916,
1.1375906467437744,
-0.33171573281288147,
... |
func Hypot(z, p, q *decimal.Big) *decimal.Big {
switch {
case p.IsInf(0), q.IsInf(0):
return z.SetInf(true)
case p.IsNaN(true), p.IsNaN(false), q.IsNaN(true), q.IsNaN(false):
return z.SetNaN(true)
}
p0 := new(decimal.Big).Mul(p, p)
q0 := new(decimal.Big).Mul(q, q)
x := alias(z, alias(z, p))
return Sqrt(z, ... | [
0.47967517375946045,
0.3194381594657898,
0.41798385977745056,
-0.3834172785282135,
0.1587684005498886,
0.48840436339378357,
-0.3119613528251648,
0.09143401682376862,
-0.37505245208740234,
0.2804999351501465,
0.30716872215270996,
0.004443032667040825,
-0.20765216648578644,
-0.23497706651687... |
func Sqrt(z, x *decimal.Big) *decimal.Big {
if xs := x.Sign(); xs <= 0 {
if xs == 0 {
return z.SetMantScale(0, 0)
}
z.SetNaN(false)
return signal(z,
decimal.InvalidOperation,
errors.New("math.Sqrt: cannot take square root of negative number"),
)
}
if snan := x.IsNaN(true); snan || x.IsNaN(false) {... | [
0.23433080315589905,
-0.13023772835731506,
0.5858923196792603,
0.3255354166030884,
-1.031912088394165,
-0.7266255021095276,
-0.28552061319351196,
-0.9103376269340515,
0.7453257441520691,
-0.4380786716938019,
0.026005573570728302,
0.27354133129119873,
0.024494072422385216,
1.062594056129455... |
func perfectSquare(x *decimal.Big) (square int64, ok bool) {
if x.IsBig() || !x.IsInt() {
return 0, false
}
switch xc := x.Int64(); xc & 0xF {
case 0, 1, 4, 9:
// "Show that floating point sqrt(x*x) >= x for all long x."
// https://math.stackexchange.com/a/238885/153292
tst := int64(math.Sqrt(float64(xc)))
... | [
-0.7451345920562744,
0.3733763098716736,
0.6267571449279785,
0.2083948403596878,
-0.4024336040019989,
-0.6897578835487366,
-0.49138420820236206,
-0.11457246541976929,
0.13168558478355408,
0.7269655466079712,
-0.8627882599830627,
-0.1718939244747162,
-0.39091822504997253,
0.5974241495132446... |
func makeHandler(c *http.Client, timeout time.Duration, upstreamURL string) func(w http.ResponseWriter, r *http.Request) {
if strings.HasSuffix(upstreamURL, "/") == false {
upstreamURL = upstreamURL + "/"
}
return func(w http.ResponseWriter, r *http.Request) {
var host string
tldSepCount := 1
tldSep := "... | [
-0.7300618886947632,
-0.0606074184179306,
1.0363413095474243,
-0.18084828555583954,
-1.1119447946548462,
0.8405681848526001,
0.6830987930297852,
0.27777132391929626,
-0.13699613511562347,
0.11107121407985687,
0.08408015966415405,
0.4027572572231293,
0.43967464566230774,
-0.1413673609495163... |
func (ms Migrations) Len() int { return len(ms) } | [
0.016795065253973007,
0.5932754874229431,
0.07218154519796371,
-0.18851982057094574,
0.13894255459308624,
0.04656502977013588,
0.8256405591964722,
0.49396419525146484,
0.12873154878616333,
-0.11860258132219315,
-1.0854600667953491,
0.4426898956298828,
0.435206800699234,
0.36171844601631165... |
func (c *Client) AddMigration(up func(*sql.Tx) error, down func(*sql.Tx) error) {
_, filename, _, _ := runtime.Caller(1)
v, _ := NumericComponent(filename)
migration := &Migration{Version: v, Next: -1, Previous: -1, UpFn: up, DownFn: down, Source: filename}
c.Migrations = append(c.Migrations, migration)
} | [
-0.8815869092941284,
0.8056817650794983,
0.574966549873352,
0.3701583445072174,
-0.004278849810361862,
0.3945818841457367,
0.03807210922241211,
-0.13913260400295258,
-0.36437109112739563,
-0.15624375641345978,
-0.5426742434501648,
-0.5723110437393188,
-0.4626545011997223,
0.340130925178527... |
func AddMigration(up func(*sql.Tx) error, down func(*sql.Tx) error) {
// We can't just use globalGoose.AddMigration here because we need to
// correctly record the caller.
_, filename, _, _ := runtime.Caller(1)
v, _ := NumericComponent(filename)
migration := &Migration{Version: v, Next: -1, Previous: -1, UpFn: up,... | [
-0.607524037361145,
1.0096160173416138,
0.616597056388855,
0.3047010898590088,
0.1758435070514679,
0.167978897690773,
0.15932117402553558,
-0.020671650767326355,
-0.21114309132099152,
0.24195364117622375,
-0.5447187423706055,
-0.21489113569259644,
-0.13360846042633057,
0.4243321418762207,
... |
func (c *Client) collectMigrations(dirpath string, current, target int64) (Migrations, error) {
var migrations Migrations
// only load migrations from file if a path is explicitly provided
if dirpath != "" {
// extract the numeric component of each migration,
// filter out any uninteresting files,
// and ensu... | [
-0.6535005569458008,
0.11653060466051102,
0.5724726915359497,
0.07560008019208908,
-0.4626368284225464,
-0.3042186498641968,
-0.12264445424079895,
-0.8555958867073059,
-0.6132288575172424,
0.9951653480529785,
0.1787654608488083,
0.3392384648323059,
0.3940694034099579,
1.1064941883087158,
... |
func (c *Client) GetDBVersion(db *sql.DB) (int64, error) {
rows, err := c.Dialect.dbVersionQuery(db, c.TableName)
if err != nil {
return 0, c.createVersionTable(db)
}
defer rows.Close()
// The most recent record for each migration specifies
// whether it has been applied or rolled back.
// The first version ... | [
-0.06747028976678848,
0.6760035753250122,
0.845108151435852,
0.44451314210891724,
-0.37342604994773865,
0.29123347997665405,
0.8415354490280151,
0.07767488807439804,
0.033807892352342606,
0.49338874220848083,
0.07767142355442047,
-0.11791500449180603,
-0.31248003244400024,
1.11329841613769... |
func (c *Client) createVersionTable(db *sql.DB) error {
txn, err := db.Begin()
if err != nil {
return err
}
d := c.Dialect
if _, err := txn.Exec(d.createVersionTableSql(c.TableName)); err != nil {
txn.Rollback()
return err
}
version := 0
applied := true
if _, err := txn.Exec(d.insertVersionSql(c.Table... | [
0.5447337031364441,
0.5250036120414734,
0.925283670425415,
0.16491706669330597,
-0.2667640745639801,
0.27499106526374817,
0.037373047322034836,
0.3124411702156067,
-0.5955954790115356,
1.2767953872680664,
-0.5128829479217529,
-0.3180611729621887,
-0.47304803133010864,
0.5035046935081482,
... |
func ListenAndServeHTTP() {
router := setupRouter()
addr := os.Getenv("SERVING_ADDR")
if addr == "" {
addr = ":8080"
}
log.Printf("[INFO ] Serving on %s", addr)
log.Fatal(http.ListenAndServe(addr, router))
} | [
0.5072306394577026,
-0.6782786250114441,
0.4987514615058899,
0.30051398277282715,
0.26572883129119873,
-0.007704629097133875,
-0.4372538626194,
0.9942610263824463,
-0.6684696078300476,
0.24589888751506805,
0.19201897084712982,
0.4183529019355774,
0.16332413256168365,
1.1938289403915405,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.