text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (s StringTable) Size() int { return binary.Size(s) } | [
0.13611774146556854,
0.38454514741897583,
0.3088013827800751,
-0.4683138430118561,
-0.8258489966392517,
-0.31363746523857117,
0.5213377475738525,
0.03910685330629349,
-0.8614944815635681,
0.2634754478931427,
-0.6025964617729187,
0.49797841906547546,
-0.947795569896698,
0.000420312600908800... |
func (s String) Size() int { return binary.Size(s) } | [
0.009994077496230602,
0.013235951773822308,
0.2293892353773117,
-0.9616259336471558,
-0.5212909579277039,
-0.2092873454093933,
0.7824731469154358,
0.08937991410493851,
-0.2039952278137207,
-0.21003933250904083,
-0.6034267544746399,
0.7159332036972046,
-0.8897260427474976,
-0.57574194669723... |
func FormatCommas(num int) string {
numString := strconv.Itoa(num)
for {
formatted := commaRegEx.ReplaceAllString(numString, "$1,$2")
if formatted == numString {
return formatted
}
numString = formatted
}
} | [
-0.09756775945425034,
-0.6666020154953003,
0.590840220451355,
-0.6516553163528442,
0.015763917937874794,
-0.17479978501796722,
-0.3288373351097107,
-0.3885837197303772,
1.192859411239624,
-0.004867677576839924,
1.4660004377365112,
0.29988282918930054,
-0.3417515754699707,
0.403924971818923... |
func ConvertSatsToBSV(sats int) float64 {
return float64(sats) * 0.00000001
} | [
-0.32853537797927856,
-0.03876131400465965,
0.30480489134788513,
0.10959193855524063,
-0.6358801126480103,
0.14862729609012604,
-0.8650551438331604,
-0.711979866027832,
0.766753613948822,
-0.03537173941731453,
0.5895154476165771,
0.9082757830619812,
0.9782547950744629,
1.057995319366455,
... |
func ConvertPriceToSatoshis(currentRate float64, amount float64) (int64, error) {
// Cannot use 0 (division by zero?!)
if amount == 0 {
return 0, fmt.Errorf("an amount must be set")
} else if currentRate <= 0 {
return 0, fmt.Errorf("current rate must be a positive value")
}
// Do conversion to satos... | [
-0.6091146469116211,
-0.4627296030521393,
0.6071134209632874,
-0.07036520540714264,
-0.055161576718091965,
-0.17674025893211365,
-0.2781391739845276,
-0.21390019357204437,
-0.41521960496902466,
1.0166723728179932,
0.6101163029670715,
-0.09522847831249237,
-0.5140078067779541,
-0.3863375782... |
func GetDollarsFromSatoshis(currentBSVRate float64, sats int64) (dollars float64) {
dollars, _ = decimal.NewFromFloat(currentBSVRate).Div(
decimal.NewFromInt(SatoshisPerBitcoin),
).Mul(decimal.NewFromInt(sats)).Float64()
return
} | [
0.4511180520057678,
0.22895726561546326,
0.28793516755104065,
-0.07981741428375244,
-0.474143922328949,
-0.3153028190135956,
-0.6988285779953003,
-0.21728169918060303,
-0.12817592918872833,
-0.49973514676094055,
0.6112176775932312,
0.21657545864582062,
0.4847908616065979,
0.394174337387084... |
func GetCentsFromSatoshis(currentBSVRate float64, sats int64) int64 {
return decimal.NewFromFloat(
GetDollarsFromSatoshis(currentBSVRate, sats),
).Mul(decimal.NewFromInt(100)).Round(1).IntPart()
} | [
0.46943289041519165,
-0.35277560353279114,
0.4185403287410736,
-0.21198895573616028,
-0.5302733778953552,
-0.5601142644882202,
-0.498439759016037,
-0.10702995210886002,
0.2096175253391266,
0.04399289935827255,
0.8638879656791687,
0.17734865844249725,
0.7437346577644348,
-0.0448238030076026... |
func FormatCentsToDollars(cents int) string {
return strconv.FormatFloat(float64(cents)/100.0, 'f', 2, 64)
} | [
-0.100922130048275,
-0.04375183954834938,
0.19272549450397491,
-1.2986795902252197,
-0.11565633118152618,
0.16059795022010803,
-0.9671475291252136,
-1.0074098110198975,
-0.14010006189346313,
0.006908843759447336,
1.4187363386154175,
-0.8235150575637817,
0.4655182361602783,
0.64897334575653... |
func ConvertFloatToIntUSD(floatValue float64) int64 {
return int64(floatValue*100 + 0.5)
} | [
-0.42947131395339966,
0.24627351760864258,
0.4717239439487457,
-0.36430880427360535,
-0.5917401909828186,
0.5145285129547119,
0.5939948558807373,
-0.17392180860042572,
-0.6906307935714722,
-0.36856982111930847,
0.3445836305618286,
0.0015102222096174955,
-0.7281931638717651,
0.2119013220071... |
func TransformCurrencyToInt(decimalValue float64, currency Currency) (int64, error) {
if currency == CurrencyDollars {
return ConvertFloatToIntUSD(decimalValue), nil
} else if currency == CurrencyBitcoin {
return ConvertFloatToIntBSV(decimalValue), nil
}
return 0, fmt.Errorf("currency %s cannot be transfo... | [
-0.19570603966712952,
0.36611872911453247,
0.4553454518318176,
-0.14925146102905273,
-0.03514288365840912,
-0.43818631768226624,
0.4843791425228119,
0.33682817220687866,
-0.47558924555778503,
-0.13764451444149017,
-0.2429361343383789,
0.09038959443569183,
-1.4323186874389648,
0.03574059158... |
func TransformIntToCurrency(intValue int, currency Currency) (string, error) {
if currency == CurrencyDollars {
return FormatCentsToDollars(intValue), nil
} else if currency == CurrencyBitcoin {
return fmt.Sprintf("%8.8f", ConvertSatsToBSV(intValue)), nil
}
return "", fmt.Errorf("currency %s cannot be tra... | [
-0.1841346174478531,
-0.3733762204647064,
0.1904446929693222,
-0.8607871532440186,
-0.05838227644562721,
-0.6431463956832886,
-0.22157248854637146,
-1.001928448677063,
0.35103774070739746,
1.049567461013794,
0.20300288498401642,
0.3986336290836334,
-0.12775976955890656,
0.5165515542030334,... |
func ConvertFloatToIntBSV(floatValue float64) int64 {
// Do conversion to satoshis (percentage) using decimal package to avoid float issues
// => 1e8 * amount / currentRate
// (use 1e8 since rate is in Bitcoin not Satoshis)
satoshisDecimal := decimal.NewFromInt(SatoshisPerBitcoin).Mul(decimal.NewFromFloat(flo... | [
0.5143948197364807,
0.6485588550567627,
0.9196605086326599,
0.2550378143787384,
-0.4246162474155426,
-0.40923309326171875,
0.04713776335120201,
-0.5330703854560852,
-0.7680699825286865,
-0.15213946998119354,
0.5764750242233276,
0.39585503935813904,
-0.7311307787895203,
0.6133216619491577,
... |
func ConvertIntToFloatUSD(cents uint64) float64 {
// Convert integer price to decimal price without float math
if cents == 0 {
return 0.0
}
// Create the cents string
centsString := strconv.FormatUint(cents, 10)
if cents < 100 {
centsString = "00" + centsString
centsString = centsString[len(cen... | [
-0.44503456354141235,
0.11515683680772781,
0.7073361277580261,
-1.2345675230026245,
-0.0911799892783165,
0.07661772519350052,
-0.6841375231742859,
-0.4521152079105377,
0.2443574070930481,
-0.4165232181549072,
0.9393569827079773,
0.3175354599952698,
-0.22134146094322205,
0.14854073524475098... |
func (AddressPropertyType) EnumDescriptor() ([]byte, []int) {
return file_address_proto_rawDescGZIP(), []int{0}
} | [
0.07609567046165466,
-0.7467625737190247,
0.5653218030929565,
-0.01657266542315483,
0.1291504055261612,
0.045501064509153366,
0.09536277502775192,
0.2378307580947876,
0.26651203632354736,
0.48595431447029114,
0.09798160940408707,
-0.3196238577365875,
-0.16154775023460388,
0.796717703342437... |
func (AddressDeliverability) EnumDescriptor() ([]byte, []int) {
return file_address_proto_rawDescGZIP(), []int{1}
} | [
-0.7798110842704773,
0.07832504063844681,
0.6834816336631775,
-0.03832283243536949,
-0.3483765125274658,
-0.2601347863674164,
0.17693249881267548,
0.5581148862838745,
0.5426181554794312,
0.33261165022850037,
-0.4253666400909424,
-0.5757147669792175,
0.346738338470459,
0.997271716594696,
... |
func (*AddressRequest) Descriptor() ([]byte, []int) {
return file_address_proto_rawDescGZIP(), []int{0}
} | [
-1.2280162572860718,
0.15327568352222443,
0.5344201326370239,
-0.28351330757141113,
-0.5866707563400269,
-0.13156694173812866,
0.14501824975013733,
0.5301451086997986,
-0.08360396325588226,
-0.6013941764831543,
0.3422556519508362,
0.36637136340141296,
0.08857151120901108,
0.993023753166198... |
func (*Address) Descriptor() ([]byte, []int) {
return file_address_proto_rawDescGZIP(), []int{1}
} | [
-0.6108331680297852,
-0.23764270544052124,
0.5465301275253296,
0.1544191539287567,
-0.41204527020454407,
0.11786898970603943,
0.4090886116027832,
1.0116255283355713,
0.5947757959365845,
-0.6349096894264221,
-0.06245727092027664,
0.5790032744407654,
-0.0049379849806427956,
0.978657603263855... |
func (m *Message) MarshalLogObject(enc zapcore.ObjectEncoder) error {
enc.AddString("s", m.s)
enc.AddInt64("index", m.i)
return nil
} | [
0.5418397188186646,
0.5111862421035767,
0.29007160663604736,
-0.34874266386032104,
0.3019634783267975,
0.19846662878990173,
0.12231194972991943,
-0.47237899899482727,
-0.3876422047615051,
-0.32029420137405396,
-0.5892692804336548,
0.7985339164733887,
-0.1275898963212967,
-0.153020694851875... |
func (e *mirEngine) Register(entries []*mir.TagMir) error {
for _, entry := range entries {
for _, field := range entry.Fields {
if handlerFunc, ok := field.Handler.(func(http.ResponseWriter, *http.Request, httprouter.Params)); ok {
if field.Method == mir.MethodAny {
e.engine.Handle(mir.MethodGet, field.... | [
-0.6267346143722534,
-0.22095172107219696,
0.6252825260162354,
0.5716257095336914,
0.7740094065666199,
-0.4165680706501007,
0.29181745648384094,
0.4347827434539795,
-0.9880838990211487,
-0.4692898094654083,
-0.049286358058452606,
-0.6333093047142029,
0.23378820717334747,
0.6343327760696411... |
func (o *GetHardwareReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetHardwareOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
defa... | [
0.14255957305431366,
-0.2203620821237564,
0.7623924612998962,
1.0864968299865723,
0.35308587551116943,
-0.961687445640564,
0.6330967545509338,
-0.4339323341846466,
0.3858281672000885,
0.6972367167472839,
0.42918482422828674,
-0.4391908049583435,
-1.2762856483459473,
0.08363906294107437,
... |
func NewGetHardwareOK() *GetHardwareOK {
return &GetHardwareOK{}
} | [
0.03265697509050369,
0.31953391432762146,
0.243230938911438,
1.612182378768921,
-0.13446584343910217,
-0.48793309926986694,
0.820305347442627,
1.0698649883270264,
-0.7326027750968933,
0.5806252360343933,
-0.5655608177185059,
0.14637833833694458,
-0.3321789503097534,
0.28824323415756226,
... |
func NewGetHardwareDefault(code int) *GetHardwareDefault {
return &GetHardwareDefault{
_statusCode: code,
}
} | [
0.09761903434991837,
1.1177268028259277,
-0.017789244651794434,
1.454425573348999,
1.3159003257751465,
-0.5135979056358337,
0.3088701665401459,
0.6101546883583069,
0.1589593142271042,
0.410053014755249,
-1.1378968954086304,
0.4876808524131775,
-1.1888880729675293,
0.2819213569164276,
0.3... |
func (o *GetHardwareDefault) Code() int {
return o._statusCode
} | [
0.48768293857574463,
1.3922383785247803,
0.07539196312427521,
2.001375913619995,
1.0063811540603638,
-0.10908220708370209,
0.37563276290893555,
0.8267507553100586,
-0.17606794834136963,
0.26752084493637085,
-0.22172808647155762,
0.09860655665397644,
-0.7771700620651245,
0.5884868502616882,... |
func (md manifestDefault) GetView() []string {
return md.Files
} | [
0.3662501275539398,
-0.24624840915203094,
0.4023062288761139,
0.22122934460639954,
0.3986879885196686,
-0.011907344684004784,
-0.5284696817398071,
0.13673275709152222,
-0.0722070261836052,
-1.269104242324829,
0.28179529309272766,
0.027144938707351685,
-0.4123152494430542,
0.131332829594612... |
func ChainMiddleware(mw ...Middleware) Middleware {
return func(final Handler) Handler {
return func(ctx context.Context, req Request) Response {
last := final
for i := len(mw) - 1; i >= 0; i-- {
last = mw[i](last)
}
// last middleware
return last(ctx, req)
}
}
} | [
-0.23335622251033783,
-1.0771024227142334,
0.6341192722320557,
0.7700632810592651,
-0.18837033212184906,
0.48611918091773987,
-0.1628219187259674,
-0.012223080731928349,
-0.006301871966570616,
0.001591136329807341,
-0.171311616897583,
0.15843689441680908,
-1.4190038442611694,
0.48969748616... |
func RootCmd(version string) *cobra.Command {
cmd := &cobra.Command{
Use: "manala",
Short: "Let your project's plumbing up to date",
Long: `Manala synchronize some boring parts of your projects,
such as makefile targets, virtualization and provisioning files...
Recipes are pulled from a git repository, or a l... | [
0.991096556186676,
-0.8531311750411987,
0.7550716996192932,
0.3680044412612915,
-0.35292255878448486,
0.7302771210670471,
0.2577497363090515,
0.2484397143125534,
0.5816264152526855,
-0.5922049283981323,
0.20839528739452362,
0.5777342319488525,
0.09574440121650696,
0.8109365701675415,
0.4... |
func TestBackshift(t *testing.T) {
funnyData := [1e3]int{1: -1}
funny := IntSlice(funnyData[:])
if GuessIntShift(funny, len(funny)) > 0 {
panic("guessIntShift got smarter")
}
forceRadix(func() { multiSort(funnyData[:]) })
if !sort.IsSorted(funny) {
t.Errorf("backshift data didn't sort")
}
} | [
0.029339047148823738,
0.9327642321586609,
0.602605402469635,
0.3587583601474762,
0.770891547203064,
0.10427600145339966,
0.01797911897301674,
-0.8613520264625549,
0.39262884855270386,
-0.690234363079071,
-0.5658684372901917,
1.1832280158996582,
-1.2374314069747925,
0.14669357240200043,
0... |
func TestFwdShift(t *testing.T) {
// an upper bit varies, lower byte varies, but bytes in between don't
funnyData := []int{0x40000000, 23, 59, 38, 38, 6, 12, 9, 3, 4, 1, 49, 9, 63}
funny := IntSlice(funnyData)
forceRadix(func() { multiSort(funnyData) })
if !sort.IsSorted(funny) {
t.Errorf("forward-shift data did... | [
-0.11929503828287125,
1.0433237552642822,
0.5478147864341736,
-0.10559222847223282,
-0.08272130787372589,
0.4631255865097046,
0.2780594229698181,
-0.946528971195221,
0.7134774923324585,
-1.4584293365478516,
-0.3572564125061035,
0.35449379682540894,
-0.5096091628074646,
1.0453346967697144,
... |
func TestBrokenPrefix(t *testing.T) {
src := [128]byte{}
src[64] = 1
data := [10000][]byte{}
for i := range data {
data[i] = src[:]
}
// last 64 entries have a 1 in a pseudorandom position, breaking the
// pattern
for i := 10000 - 64; i < 10000; i++ {
data[i] = src[64-((i*11)%64):]
}
forceRadix(BytesSlice... | [
-0.2542482614517212,
0.5663456916809082,
0.5902941226959229,
-0.6260839700698853,
0.010901923291385174,
-0.30992943048477173,
0.023558903485536575,
-0.1423972249031067,
0.8226569890975952,
-0.16176989674568176,
-0.33207574486732483,
0.6304104328155518,
-0.45765984058380127,
0.3145517408847... |
func TestShifts(t *testing.T) {
data := make([]uint64, 10000)
for i := range data {
data[i] = 1 << uint((i*19)%64)
}
forceRadix(Uint64Slice(data).Sort)
if !Uint64sAreSorted(data) {
t.Errorf("shifts data didn't sort")
}
} | [
-0.23300744593143463,
0.9955055713653564,
0.48108914494514465,
-0.005532455630600452,
0.5354809761047363,
0.33397766947746277,
-0.23984083533287048,
-0.8585201501846313,
0.9339025616645813,
-1.0330860614776611,
-0.19476579129695892,
0.41808563470840454,
-0.7546294927597046,
0.4977553784847... |
func TestMaxProcs(t *testing.T) {
defer func(old int) { MaxProcs = old }(MaxProcs)
MaxProcs = 1
// this is TestLarge_Random
n := 1000000
if testing.Short() {
n /= 100
}
data := make([]int, n)
for i := 0; i < len(data); i++ {
data[i] = rand.Intn(100)
}
manySort(data)
if !IntsAreSorted(data) {
t.Errorf(... | [
0.143290176987648,
0.9945113062858582,
0.7776883840560913,
-0.3293960392475128,
0.10121822357177734,
-0.28522077202796936,
-0.16708919405937195,
-0.9823133945465088,
1.171684741973877,
-0.41775742173194885,
-0.3025655150413513,
0.3777216672897339,
-0.4567274749279022,
0.3472757041454315,
... |
func TestSortByLength(t *testing.T) {
src := [128]byte{}
data := [10000][]byte{}
for i := range data {
data[i] = src[:(i*19)%128]
}
forceRadix(BytesSlice(data[:]).Sort)
if !BytesAreSorted(data[:]) {
t.Errorf("sort-by-length data didn't sort")
}
srcStr := string(src[:])
dataStr := [10000]string{}
for i :=... | [
0.7889110445976257,
0.5838118195533752,
0.35525059700012207,
-1.172463059425354,
0.22649669647216797,
-0.06210187077522278,
-0.40604451298713684,
-0.6636856198310852,
0.7930018305778503,
-0.3394486606121063,
-1.0923633575439453,
0.6857220530509949,
-1.04753839969635,
0.3814423978328705,
... |
func waitForConnectionReady(logger *zap.Logger) *grpc.ClientConn {
var opts []grpc.DialOption
opts = append(opts, grpc.WithInsecure(), grpc.WithConnectParams(grpc.ConnectParams{
Backoff: backoff.Config{
BaseDelay: time.Second * 2,
Multiplier: 1.2,
Jitter: 0.4,
MaxDelay: time.Second * 5,
},
Mi... | [
0.13497692346572876,
-0.5440690517425537,
0.6451765298843384,
-0.2450333833694458,
-0.06648223847150803,
-0.7016729116439819,
-0.14446498453617096,
-0.607050895690918,
-0.010373820550739765,
0.5630629658699036,
0.4687492251396179,
-0.29648613929748535,
-0.30363017320632935,
-0.153498902916... |
func CollectMetadataFromUser(videoInfo *ytdl.VideoInfo) *Metadata {
reader := bufio.NewReader(os.Stdin)
fmt.Print("title (\"" + videoInfo.Title + "\"): ")
mp3Title, _ := reader.ReadString('\n')
mp3Title = strings.TrimSpace(mp3Title)
if mp3Title == "" {
mp3Title = videoInfo.Title
}
fmt.Print("artist (\"" + v... | [
0.4693513512611389,
-1.5100483894348145,
0.7207323908805847,
0.27347034215927124,
-0.3909476697444916,
1.0469416379928589,
-0.4724937081336975,
-1.0691676139831543,
-0.6098110675811768,
-0.35826557874679565,
-0.39009758830070496,
0.9895339608192444,
-0.08980022370815277,
0.0640511214733123... |
func SetMetadata(mp3Location string, metadata *Metadata) {
tag, err := id3v2.Open(mp3Location, id3v2.Options{Parse: true})
if err != nil {
log.Fatal("Error while initializing a tag: ", err)
}
tag.SetTitle(metadata.Title)
tag.SetArtist(metadata.Artist)
tag.SetAlbum(metadata.Album)
if err = tag.Save(); err !=... | [
-0.22765523195266724,
-0.7781433463096619,
0.44562333822250366,
-0.08033622056245804,
1.048986554145813,
0.8489031791687012,
-0.9266799092292786,
0.694198489189148,
-0.19756446778774261,
0.6526119709014893,
-1.2756859064102173,
0.5677808523178101,
-0.15042276680469513,
-0.5166640877723694,... |
func NewDb() *Db {
return &Db{
make(map[string]*TitleInfo),
make(map[string]*EpisodeInfo),
make(map[string][]string),
}
} | [
-0.5993660092353821,
-0.5758610367774963,
0.2594343423843384,
-0.14679759740829468,
-0.914982259273529,
1.0045157670974731,
-0.9077484607696533,
-0.4964941442012787,
-0.029275046661496162,
-0.5657378435134888,
0.5942480564117432,
0.1639373004436493,
-0.3627828061580658,
-0.1138085126876831... |
func NewDbFromFiles(basics io.Reader, episodes io.Reader, ratings io.Reader) (*Db, error) {
searcher := &Db{
make(map[string]*TitleInfo),
make(map[string]*EpisodeInfo),
make(map[string][]string),
}
err := readFile(basics, func(record []string) {
id := record[0]
titleType := filterNil(record[1])
primary :... | [
-0.600726842880249,
-0.4570598304271698,
0.7766532897949219,
-0.03794671967625618,
-0.506250262260437,
0.7945506572723389,
-0.9417096376419067,
-0.26638004183769226,
-1.05803382396698,
-0.23710308969020844,
0.7374708652496338,
-0.5294125080108643,
-0.9067351818084717,
0.3444475531578064,
... |
func (s *Db) Search(phrase string) SearchTitles {
var superset map[string]bool
init := false
for _, word := range strings.FieldsFunc(strings.ToLower(phrase), onlyLettersPredicate) {
searchSet := make(map[string]bool)
for _, id := range s.lookup[word] {
searchSet[id] = true
}
//fmt.Println("SearchSet: ", s... | [
-0.5213516354560852,
0.34283247590065,
0.6344016790390015,
-0.7954813241958618,
-1.0073161125183105,
0.6843537092208862,
-0.3763446807861328,
-0.06045927479863167,
-0.5477607250213623,
-0.19326016306877136,
0.15479667484760284,
-0.2893068790435791,
-1.0166716575622559,
0.4934845566749573,
... |
func (s *Db) Get(id string) (*TitleInfo, error) {
title, ok := s.titles[id]
if !ok {
return nil, errors.New("nothing found")
}
return title, nil
} | [
-0.5015360713005066,
-0.06836099922657013,
0.3846232295036316,
-0.8553289771080017,
-0.07198962569236755,
-0.19258448481559753,
-1.4425978660583496,
-1.143412470817566,
-0.33667629957199097,
-0.09776962548494339,
-0.36595645546913147,
-0.03431021422147751,
-0.4649728536605835,
0.0437754243... |
func SetEnv() {
var error error
if error = godotenv.Load(); error != nil {
log.Fatal(error)
}
Port, error = strconv.Atoi(os.Getenv("APP_PORT"))
if error != nil {
log.Fatal(error)
}
APIURL = os.Getenv("API_URL")
HashKey = []byte(os.Getenv("HASH_KEY"))
BlockKey = []byte(os.Getenv("BLOCK_KEY"... | [
-0.2943010628223419,
-0.18688078224658966,
0.5588443279266357,
0.6852208971977234,
0.7672209739685059,
0.565061092376709,
-0.15629975497722626,
-0.2781708538532257,
-1.3952951431274414,
0.7708198428153992,
-0.8506917953491211,
1.054936170578003,
0.03644326329231262,
0.9611150026321411,
1... |
func NewRegionUrlMap(ctx *pulumi.Context,
name string, args *RegionUrlMapArgs, opts ...pulumi.ResourceOption) (*RegionUrlMap, error) {
if args == nil {
args = &RegionUrlMapArgs{}
}
var resource RegionUrlMap
err := ctx.RegisterResource("gcp:compute/regionUrlMap:RegionUrlMap", name, args, &resource, opts...)
if e... | [
-0.3370095193386078,
-0.022141896188259125,
0.589940071105957,
0.021940775215625763,
-0.09718261659145355,
0.7303717732429504,
-0.25347158312797546,
0.20242708921432495,
0.0722547397017479,
0.2530098259449005,
-0.15825620293617249,
0.3112810552120209,
-0.17845241725444794,
-0.9052768349647... |
func GetRegionUrlMap(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *RegionUrlMapState, opts ...pulumi.ResourceOption) (*RegionUrlMap, error) {
var resource RegionUrlMap
err := ctx.ReadResource("gcp:compute/regionUrlMap:RegionUrlMap", name, id, state, &resource, opts...)
if err != nil {
return nil, er... | [
-0.08898419141769409,
-0.34814709424972534,
0.4306420087814331,
-0.06845202296972275,
0.046888962388038635,
0.4074973464012146,
-0.3707810640335083,
0.025967802852392197,
0.841243326663971,
-0.10783100873231888,
0.391212522983551,
0.9856165647506714,
-0.04254522547125816,
-1.43039143085479... |
func HTTPServiceGet(urlPath string) ([]byte, error) {
return CheckHTTPResponse(HTTPQuery(CreateServiceHTTPRequest("GET", urlPath)))
} | [
-0.537129282951355,
0.5013781785964966,
0.6387261152267456,
-0.03643017262220383,
0.10084033757448196,
0.023257775232195854,
-0.14739656448364258,
-0.6023521423339844,
-1.3360356092453003,
-0.5263984799385071,
-0.1396692991256714,
1.3397715091705322,
-1.0534541606903076,
0.6571775674819946... |
func HTTPServiceGetQuery(urlPath, urlQuery string) ([]byte, error) {
return CheckHTTPResponse(HTTPQuery(CreateServiceHTTPQueryRequest("GET", urlPath, urlQuery)))
} | [
-0.2598235011100769,
0.04486160725355148,
0.703672468662262,
0.20745082199573517,
0.01152237318456173,
-0.4484548270702362,
-1.0583730936050415,
-0.0686524361371994,
-0.5330921411514282,
-0.1704375445842743,
0.2666128873825073,
1.6365538835525513,
-0.4093552231788635,
0.20061488449573517,
... |
func HTTPServiceGetData(urlPath, payload, contentType string) ([]byte, error) {
return CheckHTTPResponse(HTTPQuery(CreateServiceHTTPDataRequest("GET", urlPath, payload, contentType)))
} | [
-0.47721776366233826,
0.3077971935272217,
0.6348088979721069,
0.017082439735531807,
0.06827487796545029,
0.25261956453323364,
-0.733482301235199,
-0.33009010553359985,
-1.0121092796325684,
-0.7970026135444641,
-0.17258068919181824,
1.6089792251586914,
-0.5734268426895142,
0.198955014348030... |
func HTTPServiceGetJSON(urlPath, jsonPayload string) ([]byte, error) {
return CheckHTTPResponse(HTTPQuery(CreateServiceHTTPJSONRequest("GET", urlPath, jsonPayload)))
} | [
-1.1063673496246338,
0.012925660237669945,
0.6358412504196167,
-0.24648354947566986,
-0.4077148735523224,
-0.6507760882377625,
-0.3319239318370819,
-0.3958069086074829,
-0.6351884007453918,
-0.0985301062464714,
-0.3440193235874176,
1.2768404483795166,
-0.5808019042015076,
0.176245406270027... |
func HTTPServiceDelete(urlPath string) ([]byte, error) {
return CheckHTTPResponse(HTTPQuery(CreateServiceHTTPRequest("DELETE", urlPath)))
} | [
0.11962703615427017,
-0.2832376956939697,
0.6019007563591003,
0.9274981617927551,
0.2055349498987198,
0.4106407165527344,
0.017784900963306427,
-0.12597863376140594,
-0.3362770974636078,
-0.37409812211990356,
-0.5515813231468201,
0.9970354437828064,
-1.2132033109664917,
0.4869217276573181,... |
func HTTPServiceDeleteQuery(urlPath, urlQuery string) ([]byte, error) {
return CheckHTTPResponse(HTTPQuery(CreateServiceHTTPQueryRequest("DELETE", urlPath, urlQuery)))
} | [
0.040682293474674225,
-0.38372382521629333,
0.6446532011032104,
0.5173161029815674,
-0.40934062004089355,
0.13131274282932281,
-0.9610509276390076,
0.3164878487586975,
0.2753460705280304,
-0.36763179302215576,
0.32383909821510315,
1.30338454246521,
-0.48107630014419556,
0.6323134303092957,... |
func HTTPServiceDeleteData(urlPath, payload, contentType string) ([]byte, error) {
return CheckHTTPResponse(HTTPQuery(CreateServiceHTTPDataRequest("DELETE", urlPath, payload, contentType)))
} | [
-0.3736652433872223,
-0.2286200076341629,
0.6469968557357788,
0.27384868264198303,
0.0033777409698814154,
0.9010224938392639,
-0.7923779487609863,
0.021206770092248917,
-0.2931535840034485,
-0.9211394786834717,
-0.3339157700538635,
1.3012630939483643,
-0.5838038921356201,
0.420158922672271... |
func HTTPServiceDeleteJSON(urlPath, jsonPayload string) ([]byte, error) {
return CheckHTTPResponse(HTTPQuery(CreateServiceHTTPJSONRequest("DELETE", urlPath, jsonPayload)))
} | [
-0.7565755844116211,
-0.6619859337806702,
0.5859648585319519,
-0.015677882358431816,
-0.5456868410110474,
0.09768310934305191,
-0.2535649538040161,
0.05192534253001213,
0.026143908500671387,
-0.12196677178144455,
-0.5037641525268555,
0.9383392333984375,
-0.6376461386680603,
0.6876190900802... |
func HTTPServicePost(urlPath string) ([]byte, error) {
return CheckHTTPResponse(HTTPQuery(CreateServiceHTTPRequest("POST", urlPath)))
} | [
-0.5675811171531677,
-0.055209070444107056,
0.5459853410720825,
0.785020112991333,
-0.1386972963809967,
0.049774304032325745,
-0.1626299023628235,
-0.26856255531311035,
-0.6231911182403564,
-0.2595629096031189,
-1.2385151386260986,
0.05408349633216858,
-1.2467535734176636,
0.47163620591163... |
func HTTPServicePostQuery(urlPath, urlQuery string) ([]byte, error) {
return CheckHTTPResponse(HTTPQuery(CreateServiceHTTPQueryRequest("POST", urlPath, urlQuery)))
} | [
-0.42165201902389526,
-0.21088947355747223,
0.7451471090316772,
0.44901812076568604,
-0.9193891882896423,
0.2238587886095047,
-0.8289422392845154,
0.18037541210651398,
-0.5051779747009277,
-0.383271723985672,
-0.3988511860370636,
0.8372767567634583,
-0.8078698515892029,
0.6670156121253967,... |
func HTTPServicePostData(urlPath, payload, contentType string) ([]byte, error) {
return CheckHTTPResponse(HTTPQuery(CreateServiceHTTPDataRequest("POST", urlPath, payload, contentType)))
} | [
-0.6107297539710999,
-0.0564282052218914,
0.6414438486099243,
0.3123825192451477,
-0.3815174698829651,
0.7664002180099487,
-0.6309101581573486,
-0.052673958241939545,
-1.1152220964431763,
-0.6579049229621887,
-0.9302716255187988,
0.7763839364051819,
-0.9740369915962219,
0.538529098033905,
... |
func HTTPServicePostJSON(urlPath, jsonPayload string) ([]byte, error) {
return CheckHTTPResponse(HTTPQuery(CreateServiceHTTPJSONRequest("POST", urlPath, jsonPayload)))
} | [
-1.063490629196167,
-0.45262694358825684,
0.6996228694915771,
-0.01459366176277399,
-1.1281163692474365,
0.035854607820510864,
-0.05014022812247276,
-0.06594488769769669,
-0.6316024661064148,
-0.01344603206962347,
-1.1034729480743408,
0.4388951361179352,
-0.9199621677398682,
0.606522262096... |
func HTTPServicePut(urlPath string) ([]byte, error) {
return CheckHTTPResponse(HTTPQuery(CreateServiceHTTPRequest("PUT", urlPath)))
} | [
-0.6479620933532715,
0.14447060227394104,
0.48827803134918213,
-0.039259232580661774,
-0.23652391135692596,
0.19163639843463898,
0.7078839540481567,
-0.29275643825531006,
-0.6308972239494324,
-0.0709959864616394,
-0.833146333694458,
0.7365355491638184,
-1.2910701036453247,
0.33129295706748... |
func HTTPServicePutQuery(urlPath, urlQuery string) ([]byte, error) {
return CheckHTTPResponse(HTTPQuery(CreateServiceHTTPQueryRequest("PUT", urlPath, urlQuery)))
} | [
-0.7799479365348816,
-0.24799250066280365,
0.6645001173019409,
-0.3616340756416321,
-0.7187426686286926,
0.15268747508525848,
-0.34410715103149414,
0.19599345326423645,
-0.18554913997650146,
0.18387019634246826,
-0.06814148277044296,
0.8016706705093384,
-0.683799684047699,
-0.1984802335500... |
func HTTPServicePutData(urlPath, payload, contentType string) ([]byte, error) {
return CheckHTTPResponse(HTTPQuery(CreateServiceHTTPDataRequest("PUT", urlPath, payload, contentType)))
} | [
-0.8865576982498169,
-0.36147236824035645,
0.6028241515159607,
-0.306307852268219,
-0.5721938014030457,
0.5120363235473633,
-0.05041186884045601,
-0.06023120507597923,
-0.7974305748939514,
-0.24745503067970276,
-0.5607235431671143,
0.836411714553833,
-0.8902227878570557,
-0.116810888051986... |
func HTTPServicePutJSON(urlPath, jsonPayload string) ([]byte, error) {
return CheckHTTPResponse(HTTPQuery(CreateServiceHTTPJSONRequest("PUT", urlPath, jsonPayload)))
} | [
-1.383208155632019,
-0.5988584160804749,
0.6476467251777649,
-0.6163457036018372,
-0.9692956209182739,
-0.2236483246088028,
0.44642373919487,
-0.07431557029485703,
-0.28729963302612305,
0.5232313275337219,
-0.8527748584747314,
0.4457244277000427,
-0.8390127420425415,
-0.25896358489990234,
... |
func HTTPQuery(request *http.Request) *http.Response {
client := &http.Client{
Transport: &http.Transport {
// Support for 'HTTP[S]_PROXY'/'NO_PROXY' envvars
Proxy: http.ProxyFromEnvironment,
// Support main CLI's 'core.ssl_verify' setting
TLSClientConfig: buildTLSConfig(),
},
}
var err int... | [
-0.3726571798324585,
-0.008877375163137913,
0.4825049340724945,
0.003878427669405937,
0.30264848470687866,
-0.3575749099254608,
-0.0684746727347374,
-0.8502313494682312,
0.16716723144054413,
0.24920488893985748,
0.7005306482315063,
0.6149643063545227,
-0.1699572056531906,
-0.01335145998746... |
func CreateServiceHTTPJSONRequest(method, urlPath, jsonPayload string) *http.Request {
return CreateServiceHTTPDataRequest(method, urlPath, jsonPayload, "application/json")
} | [
-0.33824700117111206,
-0.5755974054336548,
0.7963293194770813,
-0.67994624376297,
-0.9632834196090698,
0.03296772018074989,
-0.981940507888794,
0.25303003191947937,
-0.2968478500843048,
-0.33029890060424805,
-0.23429694771766663,
1.208903431892395,
0.3781180679798126,
0.3672562539577484,
... |
func CreateServiceHTTPDataRequest(method, urlPath, jsonPayload, contentType string) *http.Request {
return CreateHTTPRawRequest(method, CreateServiceURL(urlPath, ""), jsonPayload, "", contentType)
} | [
-0.38867926597595215,
-0.36730262637138367,
0.825213611125946,
-0.5841093063354492,
-0.6618829369544983,
0.2189335972070694,
-1.0040704011917114,
0.02292546071112156,
-0.6988055109977722,
-0.6967228651046753,
-0.299081027507782,
1.0793187618255615,
0.15421728789806366,
0.6475970149040222,
... |
func CreateServiceHTTPQueryRequest(method, urlPath, urlQuery string) *http.Request {
return CreateHTTPRawRequest(method, CreateServiceURL(urlPath, urlQuery), "", "", "")
} | [
-0.026323745027184486,
-0.36176174879074097,
0.4659786522388458,
-0.2956559658050537,
-0.5491014122962952,
0.2843676805496216,
-0.9202643632888794,
0.24106135964393616,
-0.002554247621446848,
-0.5456408262252808,
0.12573489546775818,
1.3242048025131226,
0.22156298160552979,
0.5447146296501... |
func CreateServiceHTTPRequest(method, urlPath string) *http.Request {
return CreateHTTPRawRequest(method, CreateServiceURL(urlPath, ""), "", "", "")
} | [
0.18446621298789978,
-0.1656326949596405,
0.6140847206115723,
0.12918713688850403,
-0.1550620049238205,
0.2612115442752838,
-0.40917736291885376,
0.13731984794139862,
-0.20639967918395996,
-0.2240608185529709,
-0.5087687969207764,
0.5606576800346375,
0.25235310196876526,
0.5458860397338867... |
func CreateHTTPRawRequest(method string, url *url.URL, payload, accept, contentType string) *http.Request {
return CreateHTTPURLRequest(method, url, payload, accept, contentType)
} | [
-0.5335460901260376,
0.29399436712265015,
0.8395832777023315,
-0.40051719546318054,
-0.7218784093856812,
0.03493378311395645,
-0.9722352623939514,
-0.27335357666015625,
-0.7030749320983887,
-0.35531696677207947,
0.052786558866500854,
0.5175477862358093,
0.894509494304657,
0.366968601942062... |
func GetDCOSURL() string {
// get data from CLI or from envar, and trim e.g. "/" or "/#/" from copy-pasted Dashboard URLs:
return strings.TrimRight(RequiredCLIConfigValue(
"core.dcos_url",
"DC/OS Cluster URL",
"Run 'dcos config set core.dcos_url http://your-cluster.com' to configure"),
"#/")
} | [
-0.8108031153678894,
1.191693663597107,
0.4744657874107361,
0.212793231010437,
0.08790463954210281,
0.21896743774414062,
0.5910730957984924,
0.055359430611133575,
-0.455502986907959,
0.1327599734067917,
-0.38931211829185486,
-0.14745786786079407,
0.6998694539070129,
0.08988731354475021,
... |
func CreateServiceURL(urlPath, urlQuery string) *url.URL {
joinedURLPath := path.Join("service", config.ServiceName, urlPath)
return CreateURL(GetDCOSURL(), joinedURLPath, urlQuery)
} | [
0.5346192121505737,
0.2871588170528412,
0.42294958233833313,
0.3184269368648529,
-0.6398677825927734,
0.5928261280059814,
-0.2683609426021576,
0.0994519293308258,
0.008721825666725636,
-0.16699139773845673,
-0.0503094457089901,
-0.12521840631961823,
0.02815403789281845,
0.24724729359149933... |
func CreateURL(baseURL, urlPath, urlQuery string) *url.URL {
parsedURL, err := url.Parse(baseURL)
if err != nil {
PrintMessageAndExit("Unable to parse DC/OS Cluster URL '%s': %s", baseURL, err)
}
parsedURL.Path = urlPath
parsedURL.RawQuery = urlQuery
return parsedURL
} | [
0.3588648736476898,
-0.07247782498598099,
0.23140673339366913,
0.1083267331123352,
-0.05641309171915054,
0.20235325396060944,
-0.8510981202125549,
0.5213099718093872,
0.2829127609729767,
-0.24134908616542816,
0.6350048184394836,
-0.6237978935241699,
-0.022031592205166817,
-0.37242388725280... |
func CreateHTTPURLRequest(method string, url *url.URL, payload, accept, contentType string) *http.Request {
request, err := http.NewRequest(method, url.String(), bytes.NewReader([]byte(payload)))
if err != nil {
PrintMessageAndExit("Failed to create HTTP %s request for %s: %s", method, url, err)
}
// This value i... | [
0.10249396413564682,
0.03569742664694786,
0.6141960024833679,
-0.6068023443222046,
-0.17361804842948914,
0.4458353519439697,
-1.3567734956741333,
-0.9763908982276917,
-0.5638628005981445,
0.06466802209615707,
0.9594937562942505,
0.5966017842292786,
-0.094035305082798,
0.024241890758275986,... |
func buildTLSConfig() *tls.Config {
rawTLSSetting := OptionalCLIConfigValue("core.ssl_verify")
if strings.EqualFold(rawTLSSetting, "false") {
// 'false' (case insensitive): disable cert validation
return &tls.Config{InsecureSkipVerify: true}
} else if strings.EqualFold(rawTLSSetting, "true") {
// 'true' (case ... | [
0.03445436432957649,
0.16333144903182983,
0.4741823673248291,
0.1552295684814453,
-0.9365109205245972,
0.06386891007423401,
-0.04255254194140434,
0.2634809911251068,
0.30499106645584106,
0.2000684291124344,
-0.3767009973526001,
-0.3044094145298004,
0.17375923693180084,
0.480975866317749,
... |
func (wt *WaterTower) PostDocument(uniqueKey string, document *Document) (uint32, error) {
retryCount := 50
var lastError error
var docID uint32
newTags, newDocTokens, wordCount, titleWordCount, err := wt.analyzeDocument("new", document)
if err != nil {
return 0, err
}
for i := 0; i < retryCount; i++ {
docID... | [
-0.48659712076187134,
0.8953447341918945,
0.8748549222946167,
-0.5821178555488586,
-0.6018293499946594,
-0.22537188231945038,
0.8574075698852539,
0.058706652373075485,
-0.3304678499698639,
0.0754840299487114,
-0.4748534858226776,
0.23639015853405,
-1.4479587078094482,
0.7449654936790466,
... |
func (wt *WaterTower) RemoveDocumentByKey(uniqueKey string) error {
docID, existingDocKey, oldDoc, err := wt.findDocumentByKey(uniqueKey)
if err != nil {
return err
}
err = wt.collection.Delete(wt.ctx, existingDocKey)
if err != nil {
return err
}
err = wt.collection.Delete(wt.ctx, oldDoc)
if err != nil {
... | [
-0.19324763119220734,
0.05314664542675018,
0.492002010345459,
-0.6752360463142395,
-1.0848928689956665,
-0.6310733556747437,
1.1445119380950928,
0.4147554934024811,
0.20148994028568268,
0.8806564807891846,
-0.47292792797088623,
-0.5835946798324585,
-1.0395011901855469,
0.866577684879303,
... |
func (wt *WaterTower) RemoveDocumentByID(docID uint32) error {
docs, err := wt.FindDocuments(docID)
if err != nil {
return err
}
existingDocKey := documentKey{
ID: "k" + docs[0].UniqueKey,
}
err = wt.collection.Delete(wt.ctx, existingDocKey)
if err != nil {
return err
}
err = wt.collection.Delete(wt.ctx,... | [
0.13421939313411713,
-0.23966215550899506,
0.32440128922462463,
-0.5502359867095947,
-1.0701851844787598,
-0.4881937503814697,
0.9594311714172363,
-0.48671165108680725,
0.4260890483856201,
0.7526271939277649,
-0.7491028904914856,
-0.3900100886821747,
-0.9787412285804749,
0.9283340573310852... |
func (wt *WaterTower) AddTagToDocument(tag, uniqueKey string) error {
return nil
} | [
-0.5108019709587097,
0.15841767191886902,
0.3454207479953766,
-0.7230625748634338,
0.32060280442237854,
0.7383536100387573,
0.3937773108482361,
0.5623880624771118,
0.056820761412382126,
0.2954040765762329,
0.010686781257390976,
-0.22334273159503937,
-0.8703808784484863,
0.19432732462882996... |
func (wt *WaterTower) FindDocuments(ids ...uint32) ([]*Document, error) {
if len(ids) == 0 {
return nil, nil
}
result := make([]*Document, len(ids))
actions := wt.collection.Actions()
for i, id := range ids {
result[i] = &Document{
ID: "d" + strconv.FormatUint(uint64(id), 16),
}
actions = actions.Get(re... | [
-0.9403992295265198,
0.00837307795882225,
0.4154324233531952,
0.14233335852622986,
0.651529848575592,
-0.09072203934192657,
0.6607475280761719,
-1.1708787679672241,
-0.0033228613901883364,
0.28585681319236755,
-0.04402339458465576,
-0.343422532081604,
-1.4503352642059326,
1.076909661293029... |
func (wt *WaterTower) FindDocumentByKey(uniqueKey string) (*Document, error) {
_, _, doc, err := wt.findDocumentByKey(uniqueKey)
return doc, err
} | [
-0.0150159802287817,
0.4121573865413666,
0.031010422855615616,
-0.23807883262634277,
-0.9736788272857666,
-0.38582122325897217,
0.9549596309661865,
0.002549209864810109,
0.08670766651630402,
0.762561023235321,
-0.07404985278844833,
-0.419685035943985,
-1.528377652168274,
0.7507321238517761... |
func Test_DocumentJsonRoundTrip(t *testing.T) {
jsonified, err := json.Marshal(example_doc)
if err != nil {
t.Fatalf("Error marshaling json: %s", err.Error())
}
var doc_copy *Document
err = json.Unmarshal(jsonified, &doc_copy)
if err != nil {
t.Fatalf("Error unmarshaling json: %s", err.Error())
}
if doc_c... | [
-0.2140890210866928,
-0.11812001466751099,
0.6397972702980042,
-1.3484644889831543,
-0.9117048382759094,
0.9338149428367615,
0.3397369682788849,
-0.1510142683982849,
0.13855919241905212,
0.09917056560516357,
-0.010102626867592335,
0.12691502273082733,
0.48722273111343384,
0.061345987021923... |
func (c *Client) Init() (err error) {
c.initOnce.Do(func() {
err = c.init()
})
return
} | [
-0.6329678297042847,
-0.036655765026807785,
0.39546912908554077,
0.1244782954454422,
0.42796263098716736,
0.1800459325313568,
0.3657233417034149,
-0.028243571519851685,
-1.0481815338134766,
-0.4819536507129669,
-0.29361069202423096,
1.1652541160583496,
-0.6639834046363831,
0.18966560065746... |
func (c Client) Identify(ctx context.Context) (identifier []byte, err error) {
crd, err := smartcard.EstablishContext()
defer crd.Release() // if an error occurs
if err != nil {
return
}
reader, err := crd.WaitForCardPresent()
if err != nil {
return
}
card, err := reader.Connect()
defer card.Disconnect()... | [
-0.5062317848205566,
-0.25979405641555786,
1.029147982597351,
-0.0824907049536705,
-0.09014942497015,
-0.027616141363978386,
-0.18468962609767914,
-0.28159746527671814,
1.214392066001892,
0.5305685997009277,
-0.5844045877456665,
0.18787476420402527,
-0.6724391579627991,
-0.1933617740869522... |
func (i *image) imageToDraw(bit img.Rectangle, rect img.Rectangle) img.Rectangle {
center := i.center(bit)
ret := img.ZR
ret.Min.X, ret.Max.X = i.converMapCoord(rect.Min.X, center.X)
ret.Min.Y, ret.Max.Y = i.converMapCoord(rect.Min.Y, center.Y)
return ret
} | [
-1.0841690301895142,
-0.4471685290336609,
0.6462239623069763,
-0.8749157190322876,
0.2999054789543152,
0.35793766379356384,
-0.21434779465198517,
-0.6311533451080322,
0.420542448759079,
-0.4758922755718231,
0.49746379256248474,
0.05040100961923599,
0.21479742228984833,
-0.5003209710121155,... |
func (i *image) converMapCoord(coord, center int) (int, int) {
retx, rety := 0, 0
coord *= Size
max := center * 2
if coord < 0 {
retx = center + coord
} else {
retx = center + coord
}
if retx < 0 {
rety = retx + Size
retx = 0
} else if retx > max {
rety = max
} else {
rety = retx + Size
}
return... | [
-0.23312819004058838,
-1.2373932600021362,
0.7279608845710754,
-0.2948071360588074,
-0.49575939774513245,
-0.689299464225769,
-0.7515241503715515,
-0.07721865177154541,
0.5210751295089722,
0.3167235553264618,
-0.26594898104667664,
-0.27093037962913513,
-0.017681794241070747,
0.064714029431... |
func Job(emailService EmailService, config config.SchedulerConfig) {
job := gocron.Every(config.Every)
executeVar = emailService
switch config.Term {
case "Second":
if config.Every > 1 {
job = job.Seconds()
} else {
job = job.Second()
}
case "Minute":
if config.Every > 1 {
job = job.Minutes()
} ... | [
-0.18183419108390808,
-0.15591345727443695,
0.7362968921661377,
0.3263721466064453,
-0.17125606536865234,
-0.0721932053565979,
-0.7911004424095154,
0.3763750195503235,
-0.8308688998222351,
0.004871758632361889,
-0.19848398864269257,
0.6405496001243591,
-0.4224269688129425,
0.05569110810756... |
func (opts ListOpts) ToOrderListQuery() (string, error) {
q, err := gophercloud.BuildQueryString(opts)
return q.String(), err
} | [
-0.42014607787132263,
-0.4232374131679535,
0.5404029488563538,
-0.37175384163856506,
0.051361773163080215,
-0.35905876755714417,
-0.5036904215812683,
-0.012346494942903519,
1.0268959999084473,
0.860988438129425,
0.30809348821640015,
0.3475021719932556,
-0.22163815796375275,
0.1353930979967... |
func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager {
url := listURL(client)
if opts != nil {
query, err := opts.ToOrderListQuery()
if err != nil {
return pagination.Pager{Err: err}
}
url += query
}
return pagination.NewPager(client, url, func(r pagination.PageResult) pagi... | [
-0.025096120312809944,
0.18836188316345215,
0.7430393099784851,
-0.2514857351779938,
0.5227451920509338,
-0.6632807850837708,
-0.5378748774528503,
0.12327393144369125,
0.5278588533401489,
0.7388144731521606,
0.4379484951496124,
0.1000673696398735,
-0.1885436624288559,
0.9819422960281372,
... |
func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {
resp, err := client.Get(getURL(client, id), &r.Body, nil)
_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)
return
} | [
-0.6620185971260071,
0.6222478151321411,
0.3346424698829651,
-1.0018670558929443,
0.7106531858444214,
-0.31169208884239197,
-1.2605154514312744,
-0.5183815360069275,
-0.6826717853546143,
0.05016482248902321,
-0.21022064983844757,
1.4086731672286987,
-1.1388421058654785,
-0.4050226509571075... |
func (opts CreateOpts) ToOrderCreateMap() (map[string]interface{}, error) {
b, err := gophercloud.BuildRequestBody(opts, "")
if err != nil {
return nil, err
}
if opts.Meta.Expiration != nil {
meta := b["meta"].(map[string]interface{})
meta["expiration"] = opts.Meta.Expiration.Format(gophercloud.RFC3339NoZ)
... | [
-1.005339503288269,
-0.04058056324720383,
0.5068495869636536,
-0.7997167706489563,
1.1702730655670166,
-0.12682823836803436,
-0.28089144825935364,
-0.7880336046218872,
0.19456793367862701,
0.9251892566680908,
-0.019734585657715797,
0.3790692687034607,
0.1138080507516861,
0.2382873147726059... |
func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToOrderCreateMap()
if err != nil {
r.Err = err
return
}
resp, err := client.Post(createURL(client), &b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{202},
})
_, r.Header, r.Err = gophercloud.ParseRe... | [
-1.1382269859313965,
0.899170458316803,
0.5561318397521973,
0.5462157726287842,
0.5632726550102234,
-0.012599878013134003,
-0.2512420415878296,
-1.4540672302246094,
-0.5072873830795288,
0.5332606434822083,
-0.17921759188175201,
0.08483995497226715,
-0.714332640171051,
0.19776126742362976,
... |
func Delete(client *gophercloud.ServiceClient, id string) (r DeleteResult) {
resp, err := client.Delete(deleteURL(client, id), nil)
_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)
return
} | [
0.08737812936306,
0.3984791338443756,
0.4098380208015442,
-0.49178433418273926,
0.6082881093025208,
0.008305642753839493,
-0.44875046610832214,
-0.3835083246231079,
0.10817087441682816,
0.6240555047988892,
-0.2994254529476166,
0.8247613310813904,
-1.5658888816833496,
-0.3840654790401459,
... |
func New() *Client {
return &Client{*http.DefaultClient, MaxSendAttempts}
} | [
0.7187649607658386,
-0.5846503376960754,
-0.008290032856166363,
-0.03537116199731827,
-0.5617578625679016,
-0.2547939419746399,
-0.43660879135131836,
-0.04995124787092209,
-0.8452392816543579,
-0.4528442621231079,
-0.5424824953079224,
0.08821229636669159,
0.38947221636772156,
-0.0106965610... |
func (c *Client) JsonRequest(method, url, token string, reqData *RequestData, logger logging.CompatLogger) error {
var body io.Reader
var length int64
if reqData.Params != nil {
url += "?" + reqData.Params.Encode()
}
if reqData.ReqValue != nil {
data, err := json.Marshal(reqData.ReqValue)
if err != nil {
... | [
-0.6018598675727844,
-0.45631909370422363,
1.0741969347000122,
-0.38083615899086,
-0.3529951870441437,
-0.8273801207542419,
-0.6982597708702087,
-0.38765427470207214,
-0.06382898986339569,
-0.051525142043828964,
0.3456842601299286,
0.984490692615509,
-0.06176324188709259,
0.145283386111259... |
func (c *Client) BinaryRequest(method, url, token string, reqData *RequestData, logger logging.CompatLogger) (err error) {
err = nil
if reqData.Params != nil {
url += "?" + reqData.Params.Encode()
}
headers := createHeaders(reqData.ReqHeaders, contentTypeOctetStream, token, reqData.ReqLength != 0)
resp, err := ... | [
-0.40797868371009827,
-0.7453873753547668,
1.031984567642212,
-0.3189728558063507,
0.10846102237701416,
-0.4732933044433594,
-0.8704709410667419,
-0.6697745323181152,
-0.1451178640127182,
-0.2511032819747925,
0.09994199872016907,
0.7801575064659119,
-0.4612204134464264,
0.190575510263443,
... |
func (c *Client) sendRequest(
method, URL string,
reqReader0 io.Reader,
length int64,
headers http.Header,
expectedStatus []int,
logger logging.Logger,
) (*http.Response, error) {
reqReader, err := seekable(reqReader0, length)
if err != nil {
return nil, err
}
rawResp, err := c.sendRateLimitedRequest(method... | [
-0.5204553604125977,
-0.2776642441749573,
0.8071664571762085,
0.3183712959289551,
-0.3079030513763428,
-0.19385845959186554,
-0.4317997395992279,
0.1256721466779709,
0.5689038634300232,
0.20549803972244263,
0.5799962282180786,
0.019441666081547737,
-0.19360794126987457,
-0.0443245731294155... |
func handleError(URL string, resp *http.Response) error {
errBytes, _ := ioutil.ReadAll(resp.Body)
errInfo := string(errBytes)
// Check if we have a JSON representation of the failure, if so decode it.
if resp.Header.Get("Content-Type") == contentTypeJSON {
errorResponse, err := unmarshallError(errBytes)
//TODO... | [
-0.30062657594680786,
-0.4815681576728821,
0.558122456073761,
0.31634753942489624,
0.16174718737602234,
-0.4083242416381836,
-0.4783158004283905,
0.39162662625312805,
0.33631154894828796,
-0.3289909064769745,
0.07746080309152603,
-0.4895220100879669,
0.2009139060974121,
-0.6924492716789246... |
func NewFileCompiler(
compilerConf *Config,
pkg *packages.Package,
ast *ast.File,
fullPath string,
) (*FileCompiler, error) {
return &FileCompiler{
compilerConfig: compilerConf,
pkg: pkg,
ast: ast,
fullPath: fullPath,
imports: make(map[string]fileImport),
}, nil
} | [
0.10715261846780777,
-0.2230059951543808,
0.4393203854560852,
-0.1981799453496933,
-1.1480365991592407,
-0.6727699041366577,
0.1439661681652069,
1.2348413467407227,
-0.8049726486206055,
-0.3241475522518158,
-0.6554465293884277,
-0.4062199592590332,
0.28376504778862,
1.379497766494751,
-0... |
func (c *FileCompiler) Compile(ctx context.Context) error {
f := c.ast
pkgPath := c.pkg.PkgPath
outputFilePath := translateGoFilePathToTypescriptFilePath(pkgPath, filepath.Base(c.fullPath))
outputFilePathAbs := filepath.Join(c.compilerConfig.OutputPathRoot, outputFilePath)
if err := os.MkdirAll(filepath.Dir(outp... | [
-0.25569701194763184,
-0.2945263683795929,
0.5833719968795776,
-0.06293831765651703,
0.7941482067108154,
-0.09090183675289154,
0.8110401630401611,
0.39212173223495483,
-1.2409303188323975,
0.05245380103588104,
-0.04379168897867203,
-0.4250527024269104,
0.6273119449615479,
0.514780521392822... |
func Basename(path string) string {
return filepath.Base(path)
} | [
1.0761407613754272,
-1.1878414154052734,
0.24960362911224365,
0.18948926031589508,
-0.665460467338562,
0.7013922929763794,
0.22875018417835236,
0.5250514149665833,
-0.6340213418006897,
0.7676539421081543,
0.4801909923553467,
-0.6655716896057129,
0.2958204448223114,
-0.7685130834579468,
-... |
func Dirname(path string) string {
return filepath.Dir(path)
} | [
-0.5211949348449707,
-0.4300895929336548,
0.19154390692710876,
0.013824362307786942,
-1.1280728578567505,
-0.1375177502632141,
0.3260279595851898,
0.3197453022003174,
-0.6490845084190369,
-0.14521142840385437,
0.22025446593761444,
-0.22182776033878326,
0.609596848487854,
-0.963663637638092... |
func DirnameWithLevels(path string, levels int) string {
for i := 0; i < levels; i++ {
path = Dirname(path)
}
return path
} | [
-0.6314025521278381,
-0.06228082627058029,
0.39452365040779114,
0.24925754964351654,
-1.4101355075836182,
-0.46374082565307617,
-0.21852454543113708,
-0.8367288708686829,
-0.3548678159713745,
-0.3785427212715149,
0.2470003068447113,
-0.821803092956543,
-0.45212414860725403,
-0.000178658374... |
func Realpath(path string) string {
p, _ := filepath.Abs(path)
return p
} | [
0.7342199683189392,
-0.9111581444740295,
0.2711181044578552,
-0.25108566880226135,
-0.7663417458534241,
0.8102467656135559,
0.018091941252350807,
-0.12331787496805191,
0.14423751831054688,
0.9425565600395203,
0.5361823439598083,
-0.912209153175354,
0.10874994844198227,
-0.28723374009132385... |
func Touch(filename string) error {
f, err := os.OpenFile(filename, os.O_RDONLY|os.O_CREATE, 0666)
if f != nil {
f.Close()
}
return err
} | [
0.5789287090301514,
-0.2845633327960968,
0.7420953512191772,
-0.7542210221290588,
0.541287362575531,
1.3043735027313232,
1.3302990198135376,
0.3827916085720062,
-0.4903113543987274,
0.030225079506635666,
0.6129517555236816,
-0.7547540068626404,
-0.49641379714012146,
0.215849369764328,
-0... |
func Unlink(filename string) error {
return syscall.Unlink(filename)
} | [
1.175132155418396,
0.5366834998130798,
0.24716080725193024,
0.6536832451820374,
0.9296888709068298,
0.2119390070438385,
1.7698932886123657,
0.6544678807258606,
-0.014477802440524101,
-0.8321481943130493,
-0.10178623348474503,
0.3331373631954193,
0.2741498649120331,
0.07796861231327057,
0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.