id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c14300 | 0 {
return vs[0]
}
if len(defaultValue) > 0 {
return defaultValue[0]
}
return ""
} | |
c14301 | c.handlers[c.index](c); err != nil {
return err
}
}
return nil
} | |
c14302 |
return reader.Read(c.Request, data)
}
}
return DefaultFormDataReader.Read(c.Request, data)
} | |
c14303 | if spec.Q > bestQ && (spec.Value == "*" || spec.Value == offer) {
bestQ = spec.Q
bestOffer = offer
}
}
}
if bestQ == 0 {
bestOffer = defaultOffer
}
return bestOffer
} | |
c14304 | != reflect.Struct {
return errors.New("data must be a pointer to a struct")
}
return readForm(form, "", rv)
} | |
c14305 |
c.Set("JWT", token)
return nil
} | |
c14306 |
sm = signingMethod[0]
}
return jwt.NewWithClaims(sm, claims).SignedString([]byte(signingKey))
} | |
c14307 | func() interface{} {
return &Context{
pvalues: make([]string, r.maxParams),
router: r,
}
}
return r
} | |
c14308 | }
} else {
c.handlers, c.pnames = r.find(req.Method, r.normalizeRequestPath(req.URL.Path), c.pvalues)
}
if err := c.Next(); err != nil {
r.handleError(c, err)
}
r.pool.Put(c)
} | |
c14309 |
r.notFoundHandlers = combineHandlers(r.handlers, r.notFound)
} | |
c14310 | = combineHandlers(r.handlers, r.notFound)
} | |
c14311 | = make(map[string]string, len(pnames))
for i, n := range pnames {
params[n] = pvalues[i]
}
return handlers, params
} | |
c14312 | return func(c *Context) error {
h(c.Response, c.Request)
return nil
}
} | |
c14313 | children: make([]*node, 256),
pchildren: make([]*node, 0),
pindex: -1,
pnames: []string{},
},
}
} | |
c14314 |
return s.root.add(key, data, s.count)
} | |
c14315 | data, pnames, _ = s.root.get(path, pvalues)
return
} | |
c14316 | {
return pn
}
}
return n.addChild(newKey, data, order)
}
if matched == 0 || !n.static {
// no common prefix, or partial common prefix with a non-static node: should skip this node
return -1
}
// the node key shares a partial prefix with the key: split the node key
n1 := &node{
static: true,... | |
c14317 | p1]
break
}
}
if pattern != "" {
// the param token contains a regular expression
child.regex = regexp.MustCompile("^" + pattern)
}
pnames := make([]string, len(n.pnames)+1)
copy(pnames, n.pnames)
pnames[len(n.pnames)] = pname
child.pnames = pnames
child.pindex = len(pnames) - 1
n.pchildren = append(... | |
c14318 | data, pnames, order = child.get(key, pvalues)
}
} else if n.data != nil {
// do not return yet: a param node may match an empty string with smaller order
data, pnames, order = n.data, n.pnames, n.order
}
// try matching param children
tvalues := pvalues
allocated := false
for _, child := range n.pchildre... | |
c14319 | == nil {
b.set = make([]uint64, wordsNeeded(0))
}
return b.set
} | |
c14320 |
return int((i + (wordSize - 1)) >> log2WordSize)
} | |
c14321 | }
}()
bset = &BitSet{
length,
make([]uint64, wordsNeeded(length)),
}
return bset
} | |
c14322 | } else if cap(b.set) >= nsize {
b.set = b.set[:nsize] // fast resize
} else if len(b.set) < nsize {
newset := make([]uint64, nsize, 2*nsize) // increase capacity 2x
copy(newset, b.set)
b.set = newset
}
b.length = i + 1
}
} | |
c14323 |
b.set[i>>log2WordSize] |= 1 << (i & (wordSize - 1))
return b
} | |
c14324 | &^= 1 << (i & (wordSize - 1))
return b
} | |
c14325 | b.Set(i)
}
return b.Clear(i)
} | |
c14326 |
return b.Set(i)
}
b.set[i>>log2WordSize] ^= 1 << (i & (wordSize - 1))
return b
} | |
c14327 | make([]uint64, idx)
copy(shrunk, b.set[:idx])
b.set = shrunk
b.length = length + 1
b.set[idx-1] &= (allBits >> (uint64(64) - uint64(length&(wordSize-1)) - 1))
return b
} | |
c14328 | mask to extract the data that we need to shift left
// within the element where we insert a bit
dataMask := ^(uint64(1)<<uint64(idx&(wordSize-1)) - 1)
// extract that data that we'll shift
data := b.set[i] & dataMask
// set the positions of the data mask to 0 in the element where we insert
b.set[i] &= ^dataMas... | |
c14329 | range b.set {
b.set[i] = 0
}
}
return b
} | |
c14330 | != nil { // Clone should not modify current object
copy(c.set, b.set)
}
return c
} | |
c14331 | copy(c.set, b.set)
}
count = c.length
if b.length < c.length {
count = b.length
}
return
} | |
c14332 | for equality shoud not transform the bitset (no call to safeSet)
for p, v := range b.set {
if c.set[p] != v {
return false
}
}
return true
} | |
c14333 | cnt += popcntMaskSlice(b.set[:l], compare.set[:l])
cnt += popcntSlice(b.set[l:])
return uint(cnt)
} | |
c14334 | panicIfNull(compare)
b, compare = sortByLength(b, compare)
cnt := popcntAndSlice(b.set, compare.set)
return uint(cnt)
} | |
c14335 | > len(b.set) {
cnt += popcntSlice(compare.set[len(b.set):])
}
return uint(cnt)
} | |
c14336 | if len(compare.set) > len(b.set) {
cnt += popcntSlice(compare.set[len(b.set):])
}
return uint(cnt)
} | |
c14337 | &= allBits >> (wordSize - b.length%wordSize)
}
} | |
c14338 | panicIfNull(b)
return b.Count() == b.length
} | |
c14339 |
return false
}
}
return true
}
return true
} | |
c14340 | if !b.Test(i) {
return false
}
}
return true
} | |
c14341 | b.Count() > other.Count() && b.IsSuperSet(other)
} | |
c14342 | i := len(b.set) - 1
for ; i >= 0; i-- {
fmt.Fprintf(buffer, "%064b.", b.set[i])
}
return buffer.String()
} | |
c14343 | {
return binary.Size(uint64(0)) + binary.Size(b.set)
} | |
c14344 | Write set
err = binary.Write(stream, binaryOrder, b.set)
return int64(b.BinaryStorageSize()), err
} | |
c14345 |
// Read remaining bytes as set
err = binary.Read(stream, binaryOrder, newset.set)
if err != nil {
return 0, err
}
*b = *newset
return int64(b.BinaryStorageSize()), nil
} | |
c14346 | != nil {
return []byte{}, err
}
err = writer.Flush()
return buf.Bytes(), err
} | |
c14347 |
reader := bufio.NewReader(buf)
_, err := b.ReadFrom(reader)
return err
} | |
c14348 |
// URLEncode all bytes
return json.Marshal(base64Encoding.EncodeToString(buffer.Bytes()))
} | |
c14349 | := base64Encoding.DecodeString(s)
if err != nil {
return err
}
_, err = b.ReadFrom(bytes.NewReader(buf))
return err
} | |
c14350 | make([]byte, 0, atomic.LoadUint64(&p.defaultSize)),
}
} | |
c14351 | := int(atomic.LoadUint64(&p.maxSize))
if maxSize == 0 || cap(b.B) <= maxSize {
b.Reset()
p.pool.Put(b)
}
} | |
c14352 |
p = bNew
}
nn, err := r.Read(p[n:])
n += int64(nn)
if err != nil {
b.B = p[:n]
n -= nStart
if err == io.EOF {
return n, nil
}
return n, err
}
}
} | |
c14353 | err := w.Write(b.B)
return int64(n), err
} | |
c14354 | = append(b.B, p...)
return len(p), nil
} | |
c14355 | b.B = append(b.B, c)
return nil
} | |
c14356 | b.B = append(b.B, s...)
return len(s), nil
} | |
c14357 | = append(b.B[:0], p...)
} | |
c14358 | = append(b.B[:0], s...)
} | |
c14359 | {
return fmt.Print(compile(fmt.Sprint(a...)))
} | |
c14360 | {
return fmt.Println(compile(fmt.Sprint(a...)))
} | |
c14361 | fmt.Fprint(w, compile(fmt.Sprint(a...)))
} | |
c14362 | return fmt.Fprint(w, compile(fmt.Sprintf(format, a...)))
} | |
c14363 | compile(fmt.Sprintf(format, a...))
} | |
c14364 | errors.New(compile(Sprintf(format, a...)))
} | |
c14365 |
if g.Config.Linux.Resources.CPU == nil {
g.Config.Linux.Resources.CPU = &rspec.LinuxCPU{}
}
} | |
c14366 | fileName)
if !filepath.IsAbs(cgPath) {
subPath, err := GetSubsystemPath(pid, "pids")
if err != nil {
return nil, err
}
if !strings.Contains(subPath, cgPath) {
return nil, fmt.Errorf("cgroup subsystem %s is not mounted as expected", "pids")
}
filePath = filepath.Join(cg.MountPath, "pids", subPath, fi... | |
c14367 |
sliceOfDeterminedActions = append(sliceOfDeterminedActions, seccompAppend)
}
if neitherHasArgs(newSyscall, &syscall) {
sliceOfDeterminedActions = append(sliceOfDeterminedActions, "overwrite:"+strconv.Itoa(i))
}
}
}
}
if !ruleForSyscallAlreadyExists {
sliceOfDeterminedActions = append(sl... | |
c14368 | nil, fmt.Errorf("unimplemented yet")
} | |
c14369 | has no /proc/sys/kernel/cap_last_cap
if last == capability.Cap(63) {
last = capability.CAP_BLOCK_SUSPEND
}
return last
} | |
c14370 | newSyscallSlice := []rspec.LinuxSyscall{}
config.Syscalls = newSyscallSlice
return nil
} | |
c14371 | if reflect.DeepEqual(syscall.Action, seccompAction) {
RemoveAction(strings.Join(syscall.Names, ","), config)
}
}
return nil
} | |
c14372 | MountPath: filepath.Dir(fields[4]),
}
return cg, nil
} else if postSeparatorFields[0] == "cgroup2" {
cgroupv2 = true
continue
//TODO cgroupv2 unimplemented
}
}
if err := scanner.Err(); err != nil {
return nil, err
}
if cgroupv2 {
return nil, fmt.Errorf("cgroupv2 is not supported yet")
}
... | |
c14373 | for _, part := range parts {
elem := strings.SplitN(part, ":", 3)
if len(elem) < 3 {
continue
}
subelems := strings.Split(elem[1], ",")
for _, subelem := range subelems {
if subelem == subsystem {
return elem[2], nil
}
}
}
return "", fmt.Errorf("subsystem %s not found", subsystem)
} | |
c14374 | %s not found", path)
}
return Generator{}, err
}
defer cf.Close()
return NewFromTemplate(cf)
} | |
c14375 | envCache = createEnvCacheMap(config.Process.Env)
}
return Generator{
Config: &config,
envMap: envCache,
}, nil
} | |
c14376 | make(map[string]int, len(env))
for i, val := range env {
envMap[val] = i
}
return envMap
} | |
c14377 | {
g.Config.Linux = nil
}
}
if exportOpts.Seccomp {
data, err = json.MarshalIndent(g.Config.Linux.Seccomp, "", "\t")
} else {
data, err = json.MarshalIndent(g.Config, "", "\t")
}
if err != nil {
return err
}
_, err = w.Write(data)
if err != nil {
return err
}
return nil
} | |
c14378 |
f, err := os.Create(path)
if err != nil {
return err
}
defer f.Close()
return g.Save(f, exportOpts)
} | |
c14379 |
g.Config.Version = version
} | |
c14380 | {
g.initConfigRoot()
g.Config.Root.Path = path
} | |
c14381 | g.Config.Root.Readonly = b
} | |
c14382 | string) {
g.initConfig()
g.Config.Hostname = s
} | |
c14383 | string) {
g.initConfig()
g.Config.Version = s
} | |
c14384 | g.Config.Annotations = make(map[string]string)
} | |
c14385 | g.Config.Annotations[key] = value
} | |
c14386 | return
}
delete(g.Config.Annotations, key)
} | |
c14387 |
g.Config.Process.ConsoleSize.Width = width
g.Config.Process.ConsoleSize.Height = height
} | |
c14388 | g.Config.Process.User.UID = uid
} | |
c14389 | g.Config.Process.User.Username = username
} | |
c14390 | g.Config.Process.User.GID = gid
} | |
c14391 | {
g.initConfigProcess()
g.Config.Process.Cwd = cwd
} | |
c14392 |
g.Config.Process.NoNewPrivileges = b
} | |
c14393 | g.Config.Process.Terminal = b
} | |
c14394 |
g.Config.Process.ApparmorProfile = prof
} | |
c14395 | {
g.initConfigProcess()
g.Config.Process.Args = args
} | |
c14396 | = []string{}
// Clear out the env cache map as well
g.envMap = map[string]int{}
} | |
c14397 |
g.initConfigProcess()
g.addEnv(fmt.Sprintf("%s=%s", name, value), name)
} | |
c14398 |
split := strings.SplitN(val, "=", 2)
g.addEnv(val, split[0])
}
} | |
c14399 | add it and add it's index to g.envMap
g.Config.Process.Env = append(g.Config.Process.Env, env)
g.envMap[key] = len(g.Config.Process.Env) - 1
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.