text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (l *Logger) extractLevel(line string) (level, msg string) {
for _, lv := range levels {
if strings.HasPrefix(line, lv) {
return lv, strings.TrimSpace(line[len(lv):])
}
if strings.HasPrefix(line, "["+lv+"]") {
return lv, strings.TrimSpace(line[len("["+lv+"]"):])
}
}
return "INFO", line
} | [
0.4407312870025635,
-0.729188084602356,
0.6615480184555054,
-0.07282198965549469,
-0.03254878148436546,
-0.5894720554351807,
0.06695377826690674,
-0.14412394165992737,
-0.3361900746822357,
0.5483834743499756,
-0.407159686088562,
0.12815222144126892,
-0.15256156027317047,
0.7955104112625122... |
func getDump() []byte {
maxSize := 5 * 1024 * 1024
stacktrace := make([]byte, maxSize)
length := runtime.Stack(stacktrace, true)
if length > maxSize {
length = maxSize
}
return stacktrace[:length]
} | [
0.7475125193595886,
1.7128859758377075,
0.7338641881942749,
0.635616660118103,
0.19726017117500305,
-0.7779484391212463,
0.43233951926231384,
-0.6459740996360779,
0.7704529166221619,
-0.5354140400886536,
-0.3806213140487671,
0.8722758889198303,
-0.8116027116775513,
0.6491476893424988,
1.... |
func isStreamsSame(s1, s2 io.Writer) bool {
s1File, outOk := s1.(*os.File)
s2File, errOk := s2.(*os.File)
if outOk && errOk {
outStat, err := s1File.Stat()
if err != nil {
return false
}
errStat, err := s2File.Stat()
if err != nil {
return false
}
return os.SameFile(outStat, errStat)
}
return s... | [
0.27746230363845825,
-0.9437348246574402,
0.9925710558891296,
0.05877966806292534,
0.09161142259836197,
-0.8506481051445007,
0.6684527397155762,
-0.8121285438537598,
-0.03823621943593025,
0.8568709492683411,
0.26216110587120056,
0.5085514783859253,
-0.4931540787220001,
-0.00005754678568337... |
func TestDecodeGenericRegion(t *testing.T) {
if testing.Verbose() {
common.SetLogger(common.NewConsoleLogger(common.LogLevelDebug))
}
t.Run("AnnexH", func(t *testing.T) {
t.Run("S-12th", func(t *testing.T) {
data := []byte{
// header
0x00, 0x00, 0x00, 0x0B, 0x27, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23,
... | [
-0.03349432349205017,
-0.47081369161605835,
0.9999337196350098,
-0.8292731046676636,
0.5645993947982788,
0.15966126322746277,
0.36128708720207214,
-0.2708519399166107,
-0.39958417415618896,
-0.9424260854721069,
-0.33781081438064575,
0.1870722621679306,
-0.4469503164291382,
0.05767785385251... |
func TestEncodeGenericRegion(t *testing.T) {
t.Run("NoDuplicateRemoval", func(t *testing.T) {
common.SetLogger(common.NewConsoleLogger(common.LogLevelDebug))
genericRegion := &GenericRegion{}
h := &Header{SegmentNumber: 11, PageAssociation: 2, Type: TImmediateGenericRegion, SegmentData: genericRegion}
// prepa... | [
-0.261706680059433,
-0.33735746145248413,
0.6097198128700256,
-0.14940215647220612,
1.0078424215316772,
0.08306505531072617,
0.5975077748298645,
-0.40636852383613586,
-0.17873141169548035,
-0.27544042468070984,
-0.3949698507785797,
-0.05466374009847641,
-0.3591454327106476,
0.0819097980856... |
func dirNonClean(path string) string {
vol := filepath.VolumeName(path)
i := len(path) - 1
for i >= len(vol) && !os.IsPathSeparator(path[i]) {
i--
}
return path[len(vol) : i+1]
} | [
-0.9088320732116699,
-0.49429723620414734,
0.74604731798172,
0.07910611480474472,
-0.16979096829891205,
0.7803913354873657,
0.6539965867996216,
-0.7163009643554688,
0.2158518135547638,
0.012371925637125969,
0.46221694350242615,
-0.09268668293952942,
-0.6907321214675903,
0.05395327508449554... |
func TestFindAllAnagramsinaString(t *testing.T) {
var cases = []struct {
s string
p string
output []int
}{
{
s: "cbaebabacd",
p: "abc",
output: []int{0, 6},
},
{
s: "abab",
p: "ab",
output: []int{0, 1, 2},
},
}
for _, c := range cases {
x := findAnagra... | [
0.2984457015991211,
-0.11596769094467163,
0.5657927989959717,
-0.46302443742752075,
-0.4687207043170929,
0.13256993889808655,
0.4048269987106323,
-0.8851685523986816,
-0.038703788071870804,
0.40391960740089417,
-0.47933176159858704,
-0.46196210384368896,
-0.2875341475009918,
-0.18339377641... |
func findAnagrams(s string, p string) []int {
ls := len(s)
lp := len(p)
ms := [26]int{}
mp := [26]int{}
res := []int{}
for _, v := range p {
mp[v-'a'] += 1
}
for i := 0; i < ls; i++ {
if i >= lp {
ms[s[i-lp]-'a'] -= 1
}
ms[s[i]-'a']+=1
if ms == mp {
res = append(res, i-lp+1)
}
}
return res
} | [
-0.06190386041998863,
-0.4148988723754883,
0.6852704882621765,
-0.22411097586154938,
-0.5610299110412598,
-0.3249354660511017,
0.5338542461395264,
-0.018518345430493355,
0.6067248582839966,
0.981463611125946,
-0.44885510206222534,
0.3433036506175995,
-1.0103505849838257,
0.1350896209478378... |
func (s *javaTokenizer) Init(src []byte) {
s.scanner = &scanner.Scanner{}
s.scanner.Init(bytes.NewReader(src))
s.errors = make([]string, 0)
s.scanner.Error = func(scanner *scanner.Scanner, msg string) {
s.errors = append(s.errors, msg)
}
} | [
-0.5639224648475647,
-0.6485733389854431,
0.5084823966026306,
-0.8293715715408325,
-1.2944146394729614,
-0.21788965165615082,
-0.08447599411010742,
0.8440930247306824,
0.01982148177921772,
-0.6975080370903015,
-0.9264850616455078,
1.0286099910736084,
0.18294869363307953,
1.5531507730484009... |
func (s *javaTokenizer) Next() *Token {
for {
ch := s.scanner.Peek()
if ch >= '0' && ch <= '9' {
s.consumeNumericLiteral()
continue
} else if unicode.IsSpace(ch) {
// consuming spaces
for unicode.IsSpace(ch) {
s.scanner.Next()
ch = s.scanner.Peek()
}
continue
} else if ch == '"' || ch... | [
0.3706399202346802,
-0.8654428124427795,
0.7558128833770752,
0.29960131645202637,
-1.7140161991119385,
-0.08287546038627625,
-0.7122675776481628,
0.637814462184906,
0.22413590550422668,
-0.4874335527420044,
0.14536426961421967,
0.5723796486854553,
-0.07950659841299057,
0.4440697729587555,
... |
func (s *javaTokenizer) isKeyword(ident string) bool {
_, ok := javaKeywords[ident]
return ok
} | [
-0.9538137912750244,
-0.49125638604164124,
0.19182805716991425,
0.5296635031700134,
-0.7673457264900208,
-0.11273854225873947,
-0.33292022347450256,
0.06027292087674141,
0.7406144738197327,
1.0238661766052246,
-1.1157692670822144,
0.20744368433952332,
-0.2695610225200653,
1.051309108734130... |
func (s *javaTokenizer) consumeStringLiteral(quote rune) {
s.scanner.Next()
ch := s.scanner.Next()
for ch != quote {
switch {
case ch < 0 || ch == '\n':
return
case ch == '\\':
{
// skip backslash and the following rune
s.scanner.Next()
}
}
ch = s.scanner.Next()
}
} | [
1.0524797439575195,
-1.3084516525268555,
0.6843156218528748,
-0.054183926433324814,
-0.9631100296974182,
-0.6188177466392517,
-0.0831717699766159,
-0.39849117398262024,
-0.49953198432922363,
0.34627464413642883,
0.8777968883514404,
0.22973841428756714,
0.13670316338539124,
0.59145414829254... |
func splitSecondaryArrayKey(key []byte, arrayPos int, tmpBuf []byte) ([][][]byte, error) {
var arrayLen int
var arrayItem [][]byte
codec := collatejson.NewCodec(16)
secKeyObject, err := codec.ExplodeArray4(key, tmpBuf)
if err != nil {
if err == collatejson.ErrorOutputLen {
newBuf1 := make([]byte, 0, len(key)... | [
-0.023711003363132477,
-0.791963517665863,
1.149240493774414,
0.4254339635372162,
-0.47975629568099976,
-0.8612784147262573,
0.23365090787410736,
-0.3655875623226166,
0.3095741868019104,
0.8793432116508484,
-1.238884449005127,
0.3011185824871063,
-0.4630107581615448,
0.5403652191162109,
... |
func CompareArrayEntriesWithCount(newKey, oldKey [][]byte, newKeyCount, oldKeyCount []int) ([][]byte, [][]byte) {
// Convert newKey into map[string]int
// key to this map -> byte slice converted to string
// value of this map -> index of entry in newKey
newKeyMap := make(map[string]int)
for newItemIndex, newItem :... | [
0.44062164425849915,
-1.6825313568115234,
0.8077679872512817,
-0.11711953580379486,
0.041614070534706116,
-0.8539956212043762,
0.15435944497585297,
0.27999135851860046,
-0.12836682796478271,
1.422398328781128,
-0.2384374737739563,
0.4344033896923065,
-0.429845929145813,
0.8692989349365234,... |
func (hook *WriterHook) Fire(entry *logrus.Entry) error {
line, err := entry.String()
if err != nil {
return err
}
_, err = hook.Writer.Write([]byte(line))
return err
} | [
0.16431239247322083,
-0.4392789900302887,
0.354280024766922,
-0.04627936705946922,
0.7855390906333923,
-0.17256243526935577,
0.13588488101959229,
0.6392804384231567,
-0.6687788367271423,
-0.4856114685535431,
-0.2977256178855896,
1.0622037649154663,
0.008137422613799572,
0.3887723386287689,... |
func (hook *WriterHook) Levels() []logrus.Level {
return hook.LogLevels
} | [
-0.4008868336677551,
-0.8840861916542053,
0.14612387120723724,
-0.1592124104499817,
1.2225115299224854,
0.47551414370536804,
-0.06668337434530258,
-0.23705273866653442,
-0.7309606671333313,
-0.37048232555389404,
0.041773416101932526,
0.15358486771583557,
-0.3305605351924896,
0.611085891723... |
func NewSession() *Session {
poker := Session{
SessionSate: SessionSate{
Players: make(map[PlayerId]Player),
Items: make(map[ItemId]Item),
CurrentRun: Run{
Votes: make(map[PlayerId]string),
},
},
}
return &poker
} | [
-0.7726059556007385,
-1.4096696376800537,
0.41351786255836487,
-0.026990367099642754,
-1.5296396017074585,
-0.19275341928005219,
-0.4326545298099518,
-0.8653891086578369,
0.47710320353507996,
0.3530054986476898,
-0.33407264947891235,
0.46167701482772827,
-0.14473029971122742,
-0.5661377906... |
func (poker *Session) NewPlayer(id PlayerId) Player {
poker.mutex.Lock()
defer poker.mutex.Unlock()
p, ok := poker.Players[id]
if !ok {
log.Printf("NewPlayer: player %d does not exist", id)
p = Player{
Id: id,
Name: "default",
}
poker.Players[p.Id] = p
if poker.CurrentRun.Votes[p.Id] == "" {
p... | [
-0.8583908081054688,
-0.9445257186889648,
0.37988778948783875,
-0.03433474153280258,
-0.06515976786613464,
-0.1770179718732834,
-0.9335977435112,
-0.5080834627151489,
0.6979780197143555,
0.8997848033905029,
0.2766602039337158,
0.16869553923606873,
-1.1386648416519165,
0.16366754472255707,
... |
func NewUserRouter(br fiber.Router, conn *config.DBConn) {
router := br.Group("/users")
userRepo := repository.NewUserRepository(conn)
postRepo := repository.NewPostRepository(conn)
topicRepo := repository.NewTopicRepository(conn)
spaceRepo := repository.NewSpaceRepository(conn)
sharedPostRepo := repository.NewSh... | [
-0.12026789039373398,
-0.013030469417572021,
0.5352171659469604,
0.7978792190551758,
-0.4312109053134918,
0.13215425610542297,
0.6112095713615417,
0.22452817857265472,
-0.1659456193447113,
-0.450657457113266,
-0.34764909744262695,
-0.48973190784454346,
-0.14825859665870667,
1.5766047239303... |
func New(httpClient *http.Client) *CPTEC {
if httpClient == nil {
cookieJar, _ := cookiejar.New(nil)
httpClient = http.DefaultClient
httpClient.Jar = cookieJar
httpClient.Timeout = time.Duration(10 * time.Second)
}
baseURL, _ := url.Parse(defaultBaseURL)
c := &CPTEC{
Client: httpClient,
BaseURL: ... | [
0.30587324500083923,
-0.3409305512905121,
0.33932000398635864,
0.03536267951130867,
-0.43065619468688965,
0.23842591047286987,
0.1603824496269226,
-0.23194152116775513,
-0.39387479424476624,
0.004125585779547691,
0.33775192499160767,
0.21823324263095856,
-0.2568528950214386,
0.703968167304... |
func (this *Client) GetCandidates(opts ...RequestOpt) ([]*schema.Candidate, error) {
var response struct {
Candidates []*schema.Candidate `json:"candidates"`
Paging *schema.Paging `json:"paging"`
}
payload := NewGetPayload(ContentTypeJson)
if err := this.Do(payload, &response, append(opts, OptPath("can... | [
-1.1413120031356812,
-0.03497404232621193,
0.4537734389305115,
0.8308594822883606,
0.9004201889038086,
-0.14941535890102386,
-0.475570410490036,
-0.07465755939483643,
0.5147438645362854,
-0.1509220004081726,
0.20700639486312866,
1.1636955738067627,
-0.8489897847175598,
0.3307510316371918,
... |
func (this *Client) GetCandidate(value string, opts ...RequestOpt) (*schema.Candidate, error) {
var response struct {
Candidate *schema.Candidate `json:"candidate"`
}
payload := NewGetPayload(ContentTypeJson)
if err := this.Do(payload, &response, append(opts, OptPath("candidates", value))...); err != nil {
retu... | [
-0.6191328167915344,
-0.33582478761672974,
0.48906636238098145,
0.9931577444076538,
-0.07129775732755661,
-0.08007422089576721,
-0.21700726449489594,
-0.48369723558425903,
0.2857462465763092,
-0.16621918976306915,
0.7079770565032959,
1.1286253929138184,
-0.9532486796379089,
-0.534841895103... |
func (this *Client) CreateCandidate(shortcode string, candidate *schema.Candidate, opts ...RequestOpt) (*schema.Candidate, error) {
var response struct {
Status string `json:"status"`
Candidate *schema.Candidate `json:"candidate"`
}
payload := NewCreateCandidatePayload(candidate)
if err := this.Do... | [
-0.23240680992603302,
-0.7101231813430786,
0.6320584416389465,
0.7711381316184998,
0.16632214188575745,
0.3290390372276306,
-0.45433396100997925,
-0.16072700917720795,
0.4495801627635956,
-0.10196979343891144,
0.18554656207561493,
0.58310866355896,
-1.2304692268371582,
-0.10087528079748154... |
func streamServerInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
err := handler(srv, ss)
return err
} | [
-0.3584386110305786,
-0.6388946771621704,
0.5211490988731384,
-0.624132513999939,
-1.0068187713623047,
0.9400098919868469,
0.2355497181415558,
-0.06634914129972458,
-0.18488648533821106,
-0.06242894381284714,
-0.5150817632675171,
0.8169270157814026,
-0.3238891065120697,
1.0848743915557861,... |
func GetSingletonInstance() *singleton {
once.Do(func() {
singletonInstance = &singleton{
id: time.Now().UnixNano(),
}
})
return singletonInstance
} | [
-0.5709719061851501,
0.36485111713409424,
0.4776320457458496,
-0.28630200028419495,
-0.2104598581790924,
0.03407053276896477,
-0.12764139473438263,
0.5360009074211121,
0.8587573170661926,
-1.2285901308059692,
-0.550379753112793,
0.08613529801368713,
-1.1430166959762573,
0.23837584257125854... |
func (s *singleton) GetInstanceId() int64 {
return s.id
} | [
0.514055073261261,
0.15122148394584656,
0.4305327236652374,
-0.31516462564468384,
0.042330533266067505,
0.7003889679908752,
0.8977884650230408,
1.3516541719436646,
0.9875037670135498,
-0.06630751490592957,
-0.06363718211650848,
1.2616264820098877,
-1.7045307159423828,
0.5805941224098206,
... |
func startSyncDispatcher() {
if syncRequired() && !syncDispatcherRunning {
sync := newSyncDispatcher(varnamdConfig.syncIntervalInSecs * time.Second)
sync.start()
sync.runNow() // run one round of sync immediatly rather than waiting for the next interval to occur
syncDispatcherRunning = true
}
} | [
0.555950403213501,
-0.6508468389511108,
0.6281756162643433,
0.9269112348556519,
-0.8099396228790283,
0.39292439818382263,
0.430433064699173,
0.6042534112930298,
-0.2637770473957062,
-0.20289994776248932,
-0.7494032382965088,
0.7866567373275757,
0.26433780789375305,
1.4893956184387207,
0.... |
func ParsePath(data []byte, options ParserOptions) ([]Path, error) {
// unmarshalling the xml data
svg := svg{}
if err := xml.Unmarshal(data, &svg); err != nil {
return nil, err
}
// validates the tolerance value
// it can never be less than zero
options.SlopeTolerance = mathf.Max(0, options.SlopeTolerance)
... | [
0.7056288123130798,
0.5029492974281311,
0.5358918309211731,
0.472811758518219,
-0.39048126339912415,
0.3950652778148651,
0.04892311617732048,
-0.23544779419898987,
0.3748776912689209,
0.4602431356906891,
0.380986750125885,
-0.8193604350090027,
-0.8467715382575989,
0.017323926091194153,
-... |
func parseElements(elements []element, options ParserOptions) ([]Path, error) {
var paths []Path
for _, e := range elements {
var err error
var newPaths []Path
switch e.XMLName.Local {
case groupElementTag:
newPaths, err = parseGroup(e.Value, options)
case pathElementTag:
path := path{
ID: stri... | [
-0.6336405873298645,
-0.33294031023979187,
0.45736709237098694,
0.4748772084712982,
0.12228080630302429,
0.4966430366039276,
0.3947443664073944,
-0.3716626465320587,
0.1452842801809311,
0.08078984171152115,
0.5092670321464539,
-0.6119823455810547,
-0.7206294536590576,
1.007820725440979,
... |
func parseGroup(group []byte, options ParserOptions) ([]Path, error) {
group = append([]byte("<g>"), group...)
group = append(group, []byte("</g>")...)
g := groupElement{}
if err := xml.Unmarshal(group, &g); err != nil {
return nil, err
}
return parseElements(g.Elements, options)
} | [
-0.5955921411514282,
0.7332245111465454,
0.6281547546386719,
0.385759562253952,
-0.39696601033210754,
-0.011523795314133167,
0.7479342818260193,
-0.3445051908493042,
0.13053685426712036,
-0.05470506101846695,
0.23084820806980133,
-0.3281601071357727,
-0.7215484380722046,
0.8250507712364197... |
func Asset(name string) ([]byte, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
}
return a.bytes, nil
}
return nil, fmt.Errorf("Asset %s not foun... | [
-0.7961483001708984,
-1.2313168048858643,
0.633165180683136,
-0.6093899011611938,
-1.546921730041504,
-0.11101024597883224,
0.12971386313438416,
-1.3390334844589233,
-1.1358720064163208,
0.4855233430862427,
0.3090141713619232,
0.32495471835136414,
-0.6009681224822998,
-0.44264674186706543,... |
func MustAsset(name string) []byte {
a, err := Asset(name)
if err != nil {
panic("asset: Asset(" + name + "): " + err.Error())
}
return a
} | [
-0.012778956443071365,
0.11985661834478378,
0.4091298282146454,
-0.5268413424491882,
-0.8276715278625488,
0.4719155430793762,
-0.8186293840408325,
-1.5736604928970337,
0.16388541460037231,
0.6357062458992004,
-0.5354578495025635,
0.35693347454071045,
0.0057142809964716434,
-0.0248885955661... |
func AssetInfo(name string) (os.FileInfo, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
}
return a.info, nil
}
return nil, fmt.Errorf("Asset... | [
0.371969997882843,
-1.1052993535995483,
0.5630446076393127,
-0.922572672367096,
-1.356387734413147,
0.0033556853886693716,
0.6777529716491699,
-0.8006685972213745,
-1.2748286724090576,
0.3115358352661133,
0.2636086046695709,
0.26388120651245117,
0.0635773167014122,
-0.3988074064254761,
0... |
func AssetNames() []string {
names := make([]string, 0, len(_bindata))
for name := range _bindata {
names = append(names, name)
}
return names
} | [
-0.7293784618377686,
-0.8460342288017273,
0.7321816682815552,
-0.39323121309280396,
-0.48951536417007446,
0.7661203145980835,
-0.5028699636459351,
-0.8655748963356018,
-0.4145073890686035,
0.8099913597106934,
0.16903363168239594,
1.163049578666687,
-0.028152840211987495,
0.0342608317732811... |
func RestoreAsset(dir, name string) error {
data, err := Asset(name)
if err != nil {
return err
}
info, err := AssetInfo(name)
if err != nil {
return err
}
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
if err != nil {
return err
}
err = ioutil.WriteFile(_filePath(dir, name), d... | [
0.3437124192714691,
-0.3622540235519409,
0.6770355701446533,
-1.2592030763626099,
-0.006139514967799187,
-0.04453148692846298,
-0.0072639440186321735,
-0.43950510025024414,
-0.20619122684001923,
-0.2510169744491577,
0.1784360408782959,
0.13568510115146637,
-0.23627112805843353,
-0.56985116... |
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
// File
if err != nil {
return RestoreAsset(dir, name)
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, filepath.Join(name, child))
if err != nil {
return err
}
}
return nil
} | [
0.42261892557144165,
0.30020031332969666,
0.5813396573066711,
-0.20641657710075378,
-0.23828908801078796,
-0.24414615333080292,
0.5739709138870239,
-0.029911456629633904,
0.06188219040632248,
-0.43923482298851013,
0.5113736987113953,
0.3275970220565796,
-0.6125145554542542,
0.0351656526327... |
func (Handler) CaddyModule() caddy.ModuleInfo {
return caddy.ModuleInfo{
ID: "http.handlers.acme_server",
New: func() caddy.Module { return new(Handler) },
}
} | [
-0.2018490880727768,
-0.07037802040576935,
0.25421634316444397,
-0.7793905735015869,
0.5659098625183105,
1.0397710800170898,
0.40921223163604736,
-0.79737788438797,
-0.3522885739803314,
-0.6817721128463745,
-0.7878599166870117,
0.984517514705658,
0.6605628132820129,
0.33706000447273254,
... |
func (ash *Handler) Provision(ctx caddy.Context) error {
ash.ctx = ctx
ash.logger = ctx.Logger()
// set some defaults
if ash.CA == "" {
ash.CA = caddypki.DefaultCAID
}
if ash.PathPrefix == "" {
ash.PathPrefix = defaultPathPrefix
}
if ash.Lifetime == 0 {
ash.Lifetime = caddy.Duration(12 * time.Hour)
}
... | [
0.12147431075572968,
-0.2683725357055664,
0.7506230473518372,
0.36128443479537964,
0.006475006230175495,
0.30689680576324463,
-0.23106801509857178,
-0.030691547319293022,
0.6274946928024292,
0.3664608299732208,
-0.02512362040579319,
-0.09821292012929916,
0.229524627327919,
0.77172201871871... |
func (ash Handler) Cleanup() error {
key := ash.getDatabaseKey()
deleted, err := databasePool.Delete(key)
if deleted {
ash.logger.Debug("unloading unused CA database", zap.String("db_key", key))
}
if err != nil {
ash.logger.Error("closing CA database", zap.String("db_key", key), zap.Error(err))
}
return err
... | [
0.02892654947936535,
0.07423370331525803,
0.6745814681053162,
-0.4782930612564087,
0.06045956537127495,
0.08458656072616577,
1.004197120666504,
-0.026860997080802917,
0.7824411392211914,
-0.22712700068950653,
-0.4183077812194824,
0.11074234545230865,
0.008369583636522293,
0.994968831539154... |
func (ash Handler) makeClient() (acme.Client, error) {
for _, v := range ash.Resolvers {
addr, err := caddy.ParseNetworkAddressWithDefaults(v, "udp", 53)
if err != nil {
return nil, err
}
if addr.PortRangeSize() != 1 {
return nil, fmt.Errorf("resolver address must have exactly one address; cannot call %v... | [
-0.21121101081371307,
0.18515963852405548,
0.5520504713058472,
-0.6418308019638062,
0.16143929958343506,
-0.07876884937286377,
0.6732125878334045,
-0.20255954563617706,
0.13306500017642975,
-0.5184061527252197,
0.29661431908607483,
-0.5007693767547607,
-0.41559991240501404,
-0.945051550865... |
func Connect() (contract.DataManager, error) {
repo := new(data)
return &data{
mysqlRepo: repo.MySQL(),
}, nil
} | [
-0.2672446072101593,
0.5843007564544678,
0.2720288634300232,
-0.5024163722991943,
-0.8285553455352783,
-0.3151438236236572,
-1.6280688047409058,
0.03680755943059921,
-0.2817801535129547,
-0.36532557010650635,
-0.6250967979431152,
0.11948783695697784,
0.5379155874252319,
0.49307724833488464... |
func (thisSerializer *Serializer) ToJson(username string, password string, attributes map[string]map[string]string) error {
thisSerializer.Factory.Log.Info().Msg("Serializing credential and profile to json file.")
credentialErr := thisSerializer.saveCredentialJson(username, password)
if credentialErr != nil {
ret... | [
-0.44672614336013794,
-1.2629963159561157,
0.5236532092094421,
-0.27492499351501465,
0.16889594495296478,
-0.0739138200879097,
0.8070432543754578,
0.494117796421051,
0.08588598668575287,
0.4499686360359192,
-1.0467767715454102,
0.280476838350296,
-0.084565170109272,
0.02426372654736042,
... |
func (thisSerializer *Serializer) FromJson() (string, string, map[string]map[string]string, error) {
thisSerializer.Factory.Log.Info().Msg("Deserializing credentials and profile from json file.")
username, password, credentialErr := thisSerializer.loadCredentialJson()
if credentialErr != nil {
return "", "", make... | [
-0.2442413717508316,
-1.475492000579834,
0.4554285705089569,
-0.6270906329154968,
-1.1426445245742798,
-0.005555108189582825,
-0.03630714491009712,
0.18337905406951904,
-0.28590884804725647,
-0.11872672289609909,
-1.0090227127075195,
0.007490431424230337,
0.16333302855491638,
0.32999795675... |
func New(log pslog.Logger) Git {
return Git{
PreviousTagGetter: Exec,
CommitGetter: Exec,
log: log,
}
} | [
0.7355340123176575,
-0.5914912223815918,
0.17823924124240875,
-0.268749862909317,
-0.7179286479949951,
-0.6473243832588196,
-0.572913646697998,
-0.1580090969800949,
-1.0096532106399536,
-0.48379644751548767,
0.25987905263900757,
0.2727523148059845,
0.3625487983226776,
0.37146759033203125,
... |
func (c Git) GetCommits(currentTag, previousTag, gitPath string) ([]Commit, error) {
var commits []Commit
r := fmt.Sprintf("%s...%s", currentTag, previousTag)
c.log.Infof("[GIT] found tags: %s", r)
format := fmt.Sprintf(`--pretty=format:%%H;%%s %%b%s`, endOfCommit)
out, err := c.CommitGetter("git", "-C", gitPath,... | [
0.34264475107192993,
-0.545725405216217,
0.6597282290458679,
0.11274173110723495,
0.3909119665622711,
-0.7381669282913208,
-1.0351356267929077,
-0.827400803565979,
-1.1451985836029053,
0.3935643434524536,
-0.03227526322007179,
0.8446424007415771,
-1.2159188985824585,
0.7595915794372559,
... |
func (c Git) GetPreviousTag(tag, gitPath string) (string, error) {
out, err := c.PreviousTagGetter("git", "-C", gitPath, "describe", "--tags", "--abbrev=0", tag+"^")
if err != nil {
return "", err
}
return strings.TrimSpace(out), nil
} | [
1.2563865184783936,
0.834158182144165,
0.3735012114048004,
-0.21096980571746826,
0.0031461212784051895,
-0.5049654245376587,
-0.4858463704586029,
-0.8439496755599976,
-0.6134900450706482,
0.02805284410715103,
-0.06263620406389236,
0.9272204041481018,
-1.0281293392181396,
1.004282832145691,... |
func GetConfig(configPath string) (Configuration, error) {
c := Configuration{}
return loadConfigFromFile(c, configPath)
} | [
0.4453572928905487,
0.010206520557403564,
0.1666802018880844,
0.8366851806640625,
-0.16085585951805115,
-0.07258117944002151,
0.7657663226127625,
0.3424740433692932,
-0.33406051993370056,
0.4852343499660492,
-0.8332566618919373,
0.14058616757392883,
-0.2075474113225937,
0.30502602458000183... |
func loadConfigFromFile(c Configuration, configPath string) (Configuration, error) {
file, err := os.Open(configPath)
if err != nil {
fmt.Printf("error opening config file: %v", err)
return c, err
}
defer file.Close()
err = json.NewDecoder(file).Decode(&c)
if err != nil {
log.Printf("Error decoding config ... | [
0.6651755571365356,
-0.5542086958885193,
0.38664713501930237,
-0.25194838643074036,
-0.712476909160614,
0.21269407868385315,
-0.3659931421279907,
0.27120232582092285,
-1.348556399345398,
0.83925461769104,
-0.8270207047462463,
-0.2925969064235687,
-0.8017228245735168,
0.12545959651470184,
... |
func Pack(ctx context.Context, source string, w io.Writer) error {
inodeTable := map[uint64]string{}
tw := tar.NewWriter(w)
defer tw.Close()
err := filepath.Walk(source, func(p string, fi os.FileInfo, err error) error {
if p == source {
return nil
}
if err != nil {
return err
}
rel, err := filep... | [
-0.4176216125488281,
0.554324209690094,
0.9689410328865051,
-0.20467981696128845,
-0.7046332359313965,
0.41368117928504944,
0.9824159741401672,
0.17973874509334564,
0.26328709721565247,
-0.24877718091011047,
0.3112826645374298,
-0.4247768819332123,
0.47101858258247375,
0.33587783575057983,... |
func (c *DeleteCommand) Help() string {
helpText := `
Usage: sloppy delete [OPTIONS] PROJECT[/SERVICE[/APP]]
Deletes the given project, service or application
Options:
-f, --force=false Force the deletion of a given project, service or an app
Examples:
sloppy delete letschat
sloppy delete -f letschat/fr... | [
0.7288283705711365,
0.06105072796344757,
0.5550876259803772,
-0.04041978344321251,
0.6622568368911743,
1.0446614027023315,
0.04997364059090614,
0.4710542857646942,
0.4237493574619293,
0.046149179339408875,
0.09772970527410507,
1.5680317878723145,
0.0035172542557120323,
0.19252780079841614,... |
func (c *DeleteCommand) Run(args []string) int {
var force bool
cmdFlags := newFlagSet("delete", flag.ContinueOnError)
cmdFlags.BoolVar(&force, "f", false, "")
cmdFlags.BoolVar(&force, "force", false, "")
if err := cmdFlags.Parse(args); err != nil {
c.UI.Error(err.Error())
c.UI.Output("See 'sloppy delete --he... | [
-0.9455098509788513,
0.36253228783607483,
0.9926533102989197,
0.18779204785823822,
0.3604366183280945,
0.23297274112701416,
1.3161981105804443,
0.2560611665248871,
-0.20436258614063263,
-0.2207091897726059,
0.2687762379646301,
-0.04633721709251404,
-0.8190628290176392,
0.7514783143997192,
... |
func (c *DeleteCommand) Synopsis() string {
return "Delete a project, a service or an application"
} | [
0.4511278569698334,
0.21019352972507477,
0.3516944646835327,
0.8060765266418457,
0.3833391070365906,
-0.41410741209983826,
-0.7987930178642273,
0.8847284317016602,
-0.09022272378206253,
0.20307737588882446,
0.9245268106460571,
0.6502811908721924,
-0.14728319644927979,
0.25957417488098145,
... |
func (h *KeychainHelper) Flags() *flag.FlagSet {
flags := flag.NewFlagSet("terraform-credentials-keychain", flag.ContinueOnError)
flags.StringVar(&h.Keychain, "keychain", "login", "Name of the macOS keychain where credentials will be stored")
return flags
} | [
0.26326701045036316,
0.12454516440629959,
0.14847171306610107,
-0.7276952862739563,
0.7258641719818115,
0.6014901399612427,
-1.0859522819519043,
-0.5355700254440308,
-0.5863515734672546,
-1.399523138999939,
-0.008435352705419064,
0.4481063485145569,
-0.8243371248245239,
0.16210804879665375... |
func (h *KeychainHelper) Open() (keyring.Keyring, error) {
h.keyring.ServiceName = "terraform"
h.keyring.KeychainName = h.Keychain
return keyring.Open(h.keyring)
} | [
-0.43600398302078247,
0.35718104243278503,
0.2302415817975998,
-0.5920685529708862,
-0.36522170901298523,
0.6650888323783875,
-0.7216786742210388,
-0.19784194231033325,
-0.6035546660423279,
0.07122696191072464,
-0.13179129362106323,
0.708658754825592,
-0.2135910838842392,
0.244682028889656... |
func (h *KeychainHelper) Get(hostname string) ([]byte, error) {
ring, err := h.Open()
if err != nil {
return nil, err
}
item, err := ring.Get(hostname)
if err != nil {
if errors.Is(err, keyring.ErrKeyNotFound) {
return []byte("{}"), nil
}
return nil, err
}
return item.Data, nil
} | [
-0.8820652365684509,
0.23100055754184723,
0.8338440656661987,
-0.05683274567127228,
0.34482789039611816,
0.3759216368198395,
-1.0631386041641235,
-0.6359199285507202,
-1.0598760843276978,
0.2164299190044403,
-0.7621227502822876,
0.6927217245101929,
-0.5991359949111938,
-0.3030036389827728,... |
func (h *KeychainHelper) Store(hostname string, credentials []byte) error {
ring, err := h.Open()
if err != nil {
return err
}
return ring.Set(keyring.Item{
Key: hostname,
Label: hostname,
Data: credentials,
Description: "application password",
})
} | [
-0.4494467079639435,
-0.0996631607413292,
0.22893504798412323,
-0.15141315758228302,
0.23224253952503204,
1.6017400026321411,
-0.6996440291404724,
0.014884413219988346,
-0.7134595513343811,
-0.4371432960033417,
-0.9645557999610901,
0.0935368612408638,
-1.1255052089691162,
-0.19250184297561... |
func (h *KeychainHelper) Forget(hostname string) error {
ring, err := h.Open()
if err != nil {
return err
}
return ring.Remove(hostname)
} | [
-0.040876179933547974,
0.419655978679657,
0.5381191372871399,
-0.4936605393886566,
0.23498204350471497,
0.4864847958087921,
-0.08553356677293777,
-0.8598407506942749,
-1.3614012002944946,
0.13556428253650665,
-0.20957867801189423,
0.14076963067054749,
-1.2002601623535156,
-0.03741667047142... |
func TestRandomizedGenState(t *testing.T) {
interfaceRegistry := codectypes.NewInterfaceRegistry()
cdc := codec.NewProtoCodec(interfaceRegistry)
s := rand.NewSource(1)
r := rand.New(s)
simState := module.SimulationState{
AppParams: make(simtypes.AppParams),
Cdc: cdc,
Rand: r,
NumBonded... | [
0.32189542055130005,
0.49020490050315857,
0.626720666885376,
-0.4378119111061096,
0.3182635009288788,
0.7504560351371765,
0.5882692933082581,
-0.1817924827337265,
0.4752148687839508,
-1.1455695629119873,
-0.6992788910865784,
0.014541134238243103,
-0.15440267324447632,
0.5498791933059692,
... |
func TestRandomizedGenState1(t *testing.T) {
interfaceRegistry := codectypes.NewInterfaceRegistry()
cdc := codec.NewProtoCodec(interfaceRegistry)
s := rand.NewSource(1)
r := rand.New(s)
// all these tests will panic
tests := []struct {
simState module.SimulationState
panicMsg string
}{
{ // panic => reas... | [
0.22063720226287842,
0.6276206970214844,
0.6088190078735352,
0.1716027408838272,
0.5671073794364929,
0.7317629456520081,
1.3078546524047852,
-0.31111589074134827,
1.045837163925171,
-0.9882822632789612,
-0.7666972279548645,
0.3614483177661896,
-0.5344406962394714,
0.8989214301109314,
0.0... |
func newFileStream(ctx context.Context, wg *sync.WaitGroup, waker waker.Waker, pathname string, fi os.FileInfo, lines chan<- *logline.LogLine, streamFromStart bool) (LogStream, error) {
fs := &fileStream{ctx: ctx, pathname: pathname, lastReadTime: time.Now(), lines: lines, stopChan: make(chan struct{})}
if err := fs.... | [
0.875568687915802,
-1.3210119009017944,
0.4243334233760834,
0.39859339594841003,
-0.7016077041625977,
-0.6384133100509644,
-0.5564078688621521,
-0.2487293928861618,
-0.5525395274162292,
-1.2354834079742432,
0.6474852561950684,
0.14372627437114716,
-0.050855446606874466,
0.5445387363433838,... |
func (fs *fileStream) Stop() {
fs.stopOnce.Do(func() {
glog.Info("signalling stop at next EOF")
close(fs.stopChan)
})
} | [
-0.9518881440162659,
-0.8258784413337708,
0.3253996968269348,
-0.2526583969593048,
0.24208882451057434,
-0.2205469310283661,
0.36070552468299866,
-0.04480653628706932,
-1.247649908065796,
-0.4082580804824829,
-0.790691614151001,
-0.42375242710113525,
0.2250392735004425,
1.2274017333984375,... |
func InverseCaptchaPartOne(input string) int64 {
var sum int64
firstRune, firstRuneSize := utf8.DecodeRuneInString(input)
prevRune := firstRune
var w int
for i := firstRuneSize; i < len(input); i += w {
currRune, width := utf8.DecodeRuneInString(input[i:])
if prevRune == currRune {
sum += int64(currRune) ... | [
-0.5616422891616821,
-0.7692816257476807,
0.8746145963668823,
-0.48353347182273865,
-1.059725046157837,
-0.9326437711715698,
0.5624949932098389,
0.5460067987442017,
-0.06392332166433334,
0.20278748869895935,
-0.5564054846763611,
-0.36808985471725464,
-1.138271450996399,
0.363069623708725,
... |
func InverseCaptchaPartTwo(input string) int64 {
var sum int64
runes := []rune(input)
length := utf8.RuneCountInString(input)
for i, r := range runes {
j := (i + length/2) % length
if r == runes[j] {
sum += int64(r) - '0'
}
}
return sum
} | [
-0.5060902833938599,
-1.26522958278656,
0.5785452127456665,
-0.4614229202270508,
-0.9807082414627075,
-0.5263462066650391,
0.13646692037582397,
-0.23735560476779938,
-0.19454212486743927,
0.07438092678785324,
-0.7826936841011047,
0.42087042331695557,
-0.7615067362785339,
0.0787834823131561... |
func (r *FlowTestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
logger := log.FromContext(ctx)
logger.Info("Reconciling")
var flowTest loggingpipelineplumberv1beta1.FlowTest
if err := r.Get(ctx, req.NamespacedName, &flowTest); err != nil {
// all the resources are already del... | [
-0.0702052190899849,
-0.446787029504776,
0.8476992845535278,
-0.24295859038829803,
-0.06737876683473587,
-0.7246305346488953,
-0.19328738749027252,
0.4304398000240326,
0.10273043066263199,
-0.3455713093280792,
0.5801528692245483,
-0.6326063275337219,
-1.0208348035812378,
0.8732542991638184... |
func (r *FlowTestReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
For(&loggingpipelineplumberv1beta1.FlowTest{}).
WithEventFilter(eventFilter()).
Complete(r)
} | [
0.2667708992958069,
-0.1821739673614502,
0.6707109808921814,
-0.8216927647590637,
-0.37299424409866333,
-0.9053327441215515,
0.8984476923942566,
-0.2940925061702728,
0.3309837579727173,
-0.41705361008644104,
0.15888957679271698,
-0.5924383997917175,
-0.42277035117149353,
1.0359017848968506... |
func DefaultConfig() *config.Config {
return &config.Config{
Debug: config.Debug{
Addr: "127.0.0.1:9174",
},
Service: config.Service{
Name: "notifications",
},
Notifications: config.Notifications{
SMTP: config.SMTP{
Host: "127.0.0.1",
Port: "1025",
Sender: "noreply@example.com",
}... | [
0.9956978559494019,
0.959009051322937,
0.5926133394241333,
-0.14239221811294556,
0.2464766651391983,
0.0450478158891201,
-0.27609729766845703,
0.4834212064743042,
0.14857544004917145,
0.1884167343378067,
-0.34615710377693176,
0.4683991074562073,
0.031080404296517372,
0.2557666003704071,
... |
func (s *Service) GetCertificates(parameters connection.APIRequestParameters) ([]Certificate, error) {
return connection.InvokeRequestAll(s.GetCertificatesPaginated, parameters)
} | [
-0.8943303227424622,
0.8572785258293152,
0.3560759723186493,
1.146189570426941,
0.978743851184845,
-0.8323519229888916,
-0.010938973166048527,
-0.8876214027404785,
-0.2921140193939209,
-0.11293674260377884,
-0.01935780979692936,
0.7539631128311157,
-1.5101455450057983,
0.9556258320808411,
... |
func (s *Service) GetCertificatesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Certificate], error) {
body, err := s.getCertificatesPaginatedResponseBody(parameters)
return connection.NewPaginated(body, parameters, s.GetCertificatesPaginated), err
} | [
-0.23518221080303192,
0.03570978343486786,
0.7154600620269775,
0.5683364868164062,
0.11666804552078247,
-0.6104095578193665,
0.08503630012273788,
-0.3502494990825653,
0.10076010227203369,
0.4058886170387268,
-0.44744402170181274,
-0.1790429949760437,
-0.6801720857620239,
0.4791113138198852... |
func (s *Service) GetCertificate(certificateID int) (Certificate, error) {
body, err := s.getCertificateResponseBody(certificateID)
return body.Data, err
} | [
-0.05773473531007767,
0.582431972026825,
0.360989511013031,
0.6852257251739502,
0.293795108795166,
-0.8797016739845276,
-0.4876803159713745,
-1.0086407661437988,
0.5501201748847961,
-0.24724620580673218,
-0.3187117576599121,
0.5994905233383179,
-1.4206875562667847,
0.11468092352151871,
0... |
func (s *Service) GetCertificateContent(certificateID int) (CertificateContent, error) {
body, err := s.getCertificateContentResponseBody(certificateID)
return body.Data, err
} | [
-0.19453872740268707,
0.2773880064487457,
0.37295979261398315,
0.8020978569984436,
-1.0374277830123901,
-0.3795613944530487,
-0.2888796925544739,
-1.3209598064422607,
0.001775084063410759,
0.5219065546989441,
-0.19827377796173096,
0.2057497352361679,
-0.9735473990440369,
-0.152505174279212... |
func (s *Service) GetCertificatePrivateKey(certificateID int) (CertificatePrivateKey, error) {
body, err := s.getCertificatePrivateKeyResponseBody(certificateID)
return body.Data, err
} | [
-0.7589450478553772,
0.8218657970428467,
0.16574659943580627,
0.6856895685195923,
-0.19036801159381866,
-0.42563483119010925,
-0.27690547704696655,
-1.3798102140426636,
0.41641607880592346,
0.5603513121604919,
-0.5268585085868835,
0.3519069254398346,
-0.9812175035476685,
0.2233045846223831... |
func (s *InboundNatSpec) ResourceName() string {
return s.Name
} | [
-0.10592144727706909,
-0.5641482472419739,
0.17593897879123688,
-0.613834023475647,
0.013133629225194454,
0.43901973962783813,
-0.28846341371536255,
0.10973941534757614,
-0.11464142799377441,
0.5502080917358398,
0.4242933690547943,
0.3465551733970642,
0.22237615287303925,
-0.01579774543642... |
func (s *InboundNatSpec) ResourceGroupName() string {
return s.ResourceGroup
} | [
-0.0964396744966507,
0.40610289573669434,
-0.024716563522815704,
-0.9326485395431519,
-0.6931681036949158,
-0.04957626760005951,
-0.5368046760559082,
-0.07648158073425293,
-0.9130308032035828,
0.015489228069782257,
0.8868554830551147,
0.27825310826301575,
0.04447263479232788,
0.63607847690... |
func (s *InboundNatSpec) OwnerResourceName() string {
return s.LoadBalancerName
} | [
0.14567190408706665,
-1.4615185260772705,
0.4919804036617279,
0.17300747334957123,
-0.656154990196228,
0.6786710619926453,
0.2863476872444153,
-0.6503512859344482,
0.28344273567199707,
0.14376121759414673,
0.387732595205307,
-0.051672644913196564,
0.30179381370544434,
0.03364403918385506,
... |
func (s *InboundNatSpec) Parameters(existing interface{}) (parameters interface{}, err error) {
if existing != nil {
if _, ok := existing.(network.InboundNatRule); !ok {
return nil, errors.Errorf("%T is not a network.InboundNatRule", existing)
}
return nil, nil
}
if s.FrontendIPConfigurationID == nil {
... | [
-0.5714711546897888,
-0.4546581208705902,
0.5219581127166748,
-1.685468077659607,
0.8796248435974121,
0.5157395005226135,
-0.7842583060264587,
-0.6090337634086609,
-0.5295854210853577,
0.6040652394294739,
1.1434409618377686,
0.5651938319206238,
-0.13730119168758392,
0.5366072058677673,
0... |
func NewFanOut(inChannel <-chan interface{}, lag int) *FanOut {
fanOut := &FanOut{
lag: lag,
outChannels: make(map[<-chan interface{}]chan interface{}),
mutex: &sync.Mutex{},
}
go func() {
for value := range inChannel {
fanOut.mutex.Lock()
for _, c := range fanOut.outChannels {
c <- v... | [
0.6501100659370422,
-0.4223400354385376,
0.34533947706222534,
-0.1647857427597046,
-1.1255766153335571,
-0.7993767261505127,
-0.019890831783413887,
-0.29512226581573486,
-0.33255821466445923,
-0.09770672768354416,
-0.37044358253479004,
-0.005282634869217873,
-0.3695474863052368,
0.34431099... |
func (f *FanOut) Listen() (<-chan interface{}, error) {
f.mutex.Lock()
defer f.mutex.Unlock()
if f.closed {
return nil, errors.New("input channel already closed")
}
newChan := make(chan interface{}, f.lag)
f.outChannels[newChan] = newChan
return newChan, nil
} | [
0.3652741312980652,
-0.45935505628585815,
0.392966091632843,
-0.6133034825325012,
-0.1165115237236023,
0.16738109290599823,
0.42773088812828064,
-0.21204769611358643,
-0.3373400568962097,
-0.8061118125915527,
0.5171217322349548,
0.13059595227241516,
-0.5219100713729858,
-0.2081081569194793... |
func (f *FanOut) StopListening(c <-chan interface{}) error {
f.mutex.Lock()
defer f.mutex.Unlock()
if f.closed {
return errors.New("input channel already closed")
}
if _, ok := f.outChannels[c]; ok {
delete(f.outChannels, c)
return nil
}
return errors.New("channel not found")
} | [
0.04054635018110275,
-0.4669700860977173,
0.3901403844356537,
-0.654674768447876,
-0.47777992486953735,
-0.05125425383448601,
0.5911253690719604,
-0.04665117710828781,
-0.3701126277446747,
-0.32175326347351074,
0.04142545536160469,
-0.5471157431602478,
-0.7233172059059143,
-0.4851738512516... |
func (suite *TestAgentSuite) TestConformOfAgentForAdding(c *C) {
testedAgent := &AgentForAdding {
Name: " name-1 ",
ConnectionId: " conn-id-1 ",
Comment: " comment-1 ",
Hostname: " hostname-1 ",
NameTagValue: " name-tag-1 ",
GroupTags: []string{ " gt-1 ", " gt-2 " },
}
conform.Strings(testedAgent)
c.A... | [
0.12685087323188782,
-0.8086237907409668,
0.3675408363342285,
-0.26819995045661926,
0.18482621014118195,
-0.08766789734363556,
-0.18130891025066376,
-0.3054763376712799,
-0.38127124309539795,
-0.3928268253803253,
-0.04113719239830971,
-0.3209711015224457,
0.053514834493398666,
0.6771582961... |
func (suite *TestAgentSuite) TestValidateOfAgentForAdding(c *C) {
testCases := []struct {
fieldName string
fieldValue interface{}
} {
{ "ConnectionId", "" },
{ "Hostname", "" },
{ "IspId", int16(0) },
{ "ProvinceId", int16(0) },
{ "CityId", int16(0) },
}
for _, testCase := range testCases {
sample... | [
0.16755332052707672,
-0.20927391946315765,
0.4221965968608856,
-0.06257229298353195,
0.1279112845659256,
0.21279536187648773,
-0.007822059094905853,
-0.4081920087337494,
0.27497726678848267,
-0.16975519061088562,
0.13335619866847992,
-0.12622639536857605,
-0.31606486439704895,
0.4775833785... |
func (o *GetBatchReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetBatchOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 404:
... | [
0.21848148107528687,
-1.2274651527404785,
0.6674075722694397,
0.6584513783454895,
0.44265297055244446,
-0.8731156587600708,
-0.21382379531860352,
-0.13859042525291443,
0.037398625165224075,
0.12856562435626984,
0.3488069474697113,
-0.2673990726470947,
-0.7023627758026123,
-0.26943266391754... |
func NewGetBatchOK() *GetBatchOK {
return &GetBatchOK{}
} | [
0.7975220680236816,
-0.06037391349673271,
0.382058709859848,
1.240179419517517,
0.24968132376670837,
-0.8735718727111816,
0.2607767581939697,
0.1769690364599228,
-1.0901296138763428,
-0.9659188985824585,
-0.33242377638816833,
0.8567444086074829,
0.9415603876113892,
-0.487834632396698,
0.... |
func NewGetBatchNotFound() *GetBatchNotFound {
return &GetBatchNotFound{}
} | [
0.6396301984786987,
-1.4726901054382324,
0.19305646419525146,
0.4361889958381653,
0.32771411538124084,
0.7521473169326782,
-0.06603515148162842,
0.39003485441207886,
-0.4350799024105072,
-1.121139407157898,
-0.8271268606185913,
1.318819284439087,
-0.04399196431040764,
-0.14856962859630585,... |
func less(data []Result) func(i, j int) bool {
return func(i, j int) bool {
if data[i].Status == data[j].Status {
return data[i].Name < data[j].Name
}
return data[i].Status > data[j].Status
}
} | [
0.032015834003686905,
-0.49686896800994873,
0.6010092496871948,
-0.9597069621086121,
-1.5061578750610352,
0.24860890209674835,
-0.24828983843326569,
-0.804018497467041,
-0.08361072093248367,
-0.8104512691497803,
-0.6782635450363159,
-0.12466369569301605,
0.12012303620576859,
0.151384621858... |
func ConvertStatusString(color string) int {
switch strings.ToLower(color) {
case "green":
return StatusGreen
case "yellow":
return StatusYellow
case "red":
return StatusRed
default:
return StatusUnknown
}
} | [
-0.7149006724357605,
-0.8285099864006042,
0.5831542015075684,
-0.8045232892036438,
-0.06210443377494812,
0.046530820429325104,
-0.9607383608818054,
-0.05376042053103447,
0.24542036652565002,
0.13088351488113403,
-0.47279730439186096,
0.08050719648599625,
0.9982151389122009,
0.5598794817924... |
func NewCustomResolver(hosts map[string][]string) Resolver {
return &resolver{
hosts: hosts,
}
} | [
-0.04729989916086197,
-0.7821685075759888,
0.0026045460253953934,
-0.3737459182739258,
-0.8739365339279175,
-0.8485093116760254,
-1.1105115413665771,
0.8411439061164856,
-0.32312077283859253,
-0.5583499073982239,
-0.6344918608665466,
0.39906230568885803,
-0.23844733834266663,
0.64406239986... |
func OneOf(acceptableValues ...attr.Value) tfsdk.AttributeValidator {
return &acceptablePrimitiveValuesAttributeValidator{
acceptableValues: acceptableValues,
shouldMatch: true,
}
} | [
0.045416682958602905,
0.22658473253250122,
0.2304553985595703,
-0.5700010061264038,
-1.1689196825027466,
0.15654776990413666,
-0.0203035119920969,
0.3766937553882599,
-0.3630400002002716,
-0.4755523204803467,
1.1657648086547852,
-0.3126121461391449,
0.9002381563186646,
0.620662271976471,
... |
func ValidateEmail(email string) bool {
return emailRegexp.MatchString(email)
} | [
-0.6472160220146179,
0.02044176124036312,
0.1850612461566925,
0.4302941560745239,
-0.5713004469871521,
0.8831202387809753,
-0.12199636548757553,
0.5936680436134338,
-0.41397708654403687,
0.19402030110359192,
0.3574790954589844,
-0.07921753078699112,
-0.9972813725471497,
-0.8859363198280334... |
func (i I4) Overlaps(i2 I4) bool {
l1 := i.Base().Number()
u1 := i.Last().Number()
l2 := i2.Base().Number()
u2 := i2.Last().Number()
if l1 > u2 || l2 > u1 {
return false
}
return true
} | [
-2.0722992420196533,
-0.3770039975643158,
0.6500924825668335,
0.07073856145143509,
-0.8325141072273254,
0.46794867515563965,
-0.40104585886001587,
-0.39724206924438477,
-0.579354465007782,
-0.4333643615245819,
-0.6701522469520569,
0.1138496845960617,
-0.8332300186157227,
-1.027594089508056... |
func (i I4) NumIPs() int {
return 1 << uint32(32-i.maskBits)
} | [
-0.3115861117839813,
0.35684269666671753,
0.5181092023849487,
0.29466331005096436,
-0.6081193089485168,
-0.025222688913345337,
0.7286196351051331,
-0.5814833045005798,
0.6672897338867188,
-0.6896132230758667,
-0.5292491912841797,
-1.4423985481262207,
-0.9726556539535522,
-1.088748335838317... |
func (i I4) NumHosts() int {
switch i.maskBits {
case 32:
return 1
case 31:
return 2
case 30:
return 2
}
return i.NumIPs() - 2
} | [
-0.684765100479126,
0.7247326970100403,
0.604433536529541,
0.9306569695472717,
-0.8622933626174927,
-0.07883335649967194,
1.2821589708328247,
-0.43087711930274963,
0.1969013512134552,
-0.796432614326477,
-0.5175489187240601,
-0.862503170967102,
-0.822158932685852,
-0.6784489750862122,
0.... |
func (i I4) SubnetOffset(o int) I4 {
return I4{ip: i.ip + uint32(o*i.NumIPs()), maskBits: i.maskBits}
} | [
0.663714587688446,
0.11282516270875931,
0.2546617090702057,
0.046031154692173004,
-0.8335718512535095,
0.45343315601348877,
0.47779810428619385,
-0.7142128944396973,
0.6037039160728455,
0.11498552560806274,
-0.7153412103652954,
-0.415030300617218,
0.42635804414749146,
-1.5413107872009277,
... |
func (etcd *EtcdProcess) Setup() (err error) {
etcd.proc = exec.Command(
etcd.Binary,
"--name", etcd.Name,
"--data-dir", etcd.DataDirectory,
"--listen-client-urls", etcd.ListenClientURL,
"--advertise-client-urls", etcd.AdvertiseClientURL,
"--initial-advertise-peer-urls", etcd.PeerURL,
"--listen-peer-urls... | [
0.27247974276542664,
-0.4867602586746216,
0.8329274654388428,
-1.1962698698043823,
0.06208190694451332,
0.2372535914182663,
-0.4525708556175232,
-0.1879822164773941,
-0.49422508478164673,
0.5067446827888489,
0.6167059540748596,
0.5177965760231018,
0.13539041578769684,
0.23734816908836365,
... |
func (etcd *EtcdProcess) TearDown(Cell string, originalVtRoot string, currentRoot string, keepdata bool) error {
if etcd.proc == nil || etcd.exit == nil {
return nil
}
etcd.removeTopoDirectories(Cell)
// Attempt graceful shutdown with SIGTERM first
_ = etcd.proc.Process.Signal(syscall.SIGTERM)
if !*keepData {... | [
0.7300891876220703,
-0.12545304000377655,
0.7966254353523254,
0.019411379471421242,
-0.30499738454818726,
0.5550368428230286,
-0.05398404598236084,
0.3855282962322235,
-0.06428223848342896,
0.7964653968811035,
0.7908244729042053,
0.3843250274658203,
-0.06283726543188095,
0.0424659214913845... |
func (etcd *EtcdProcess) IsHealthy() bool {
resp, err := http.Get(etcd.VerifyURL)
if err != nil {
return false
}
if resp.StatusCode == 200 {
return true
}
return false
} | [
-0.2552199065685272,
-0.14542967081069946,
0.730908989906311,
-0.25120308995246887,
0.3085916340351105,
-0.12360791116952896,
-1.7404667139053345,
-0.2893727421760559,
0.10907159000635147,
-0.4139328598976135,
-0.05230075865983963,
0.20530100166797638,
0.3605460524559021,
0.213645711541175... |
func (etcd *EtcdProcess) ManageTopoDir(command string, directory string) (err error) {
url := etcd.VerifyURL + directory
payload := strings.NewReader(`{"dir":"true"}`)
if command == "mkdir" {
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
_, err = http.Default... | [
-0.8085712790489197,
0.1545291543006897,
0.8099420070648193,
-0.622728705406189,
0.2896214723587036,
0.13526947796344757,
-0.4962770640850067,
-0.2805097997188568,
0.523677408695221,
0.4322825074195862,
0.3591407835483551,
0.4384014904499054,
0.16064392030239105,
0.6655184030532837,
0.91... |
func EtcdProcessInstance(port int, peerPort int, hostname string, name string) *EtcdProcess {
etcd := &EtcdProcess{
Name: name,
Binary: "etcd",
Port: port,
Host: hostname,
PeerPort: peerPort,
}
etcd.AdvertiseClientURL = fmt.Sprintf("http://%s:%d", etcd.Host, etcd.Port)
etcd.ListenClientURL ... | [
0.11293388158082962,
-0.7933253049850464,
0.632671594619751,
-1.7490386962890625,
-1.049612283706665,
0.827622652053833,
-0.8466266989707947,
0.807275116443634,
-0.4859418272972107,
0.23512187600135803,
0.16392618417739868,
0.6806918978691101,
-0.17477405071258545,
-0.28714820742607117,
... |
func (b *PolicyRequestBuilder) AppliesTo() *PolicyAppliesToCollectionRequestBuilder {
bb := &PolicyAppliesToCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/appliesTo"
return bb
} | [
-0.009146997705101967,
0.33661121129989624,
0.5572842359542847,
-0.06790032982826233,
0.07486040890216827,
0.006169802509248257,
-0.4771057963371277,
0.7723398208618164,
0.23477484285831451,
-1.6224417686462402,
0.12699753046035767,
0.7304207682609558,
-0.3072229027748108,
0.74904310703277... |
func (b *PolicyAppliesToCollectionRequestBuilder) Request() *PolicyAppliesToCollectionRequest {
return &PolicyAppliesToCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
} | [
0.01884082518517971,
0.10097692161798477,
0.35880959033966064,
0.08823307603597641,
0.27409058809280396,
-0.0313057042658329,
-0.5743908882141113,
0.16059334576129913,
0.3633703291416168,
-0.6567516922950745,
0.6777284145355225,
0.5068593621253967,
-0.0511290617287159,
0.4769632816314697,
... |
func (b *PolicyAppliesToCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder {
bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
} | [
-0.2936752736568451,
-0.506465494632721,
0.3835706412792206,
0.583092987537384,
-0.4925480782985687,
0.745003879070282,
-0.3732227087020874,
0.8618947267532349,
1.4934747219085693,
-1.3762810230255127,
0.22864000499248505,
0.592792809009552,
-0.2567553222179413,
0.8862559795379639,
-0.39... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.