id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1 value |
|---|---|---|
c177800 | != nil {
if err == io.EOF {
break
}
return err
}
if err := restoreClient.Send(&admin.RestoreRequest{Op: op}); err != nil {
return grpcutil.ScrubGRPC(err)
}
}
return nil
} | |
c177801 | == nil {
retErr = grpcutil.ScrubGRPC(err)
}
}()
return otherC.Extract(objects, func(op *admin.Op) error {
return restoreClient.Send(&admin.RestoreRequest{Op: op})
})
} | |
c177802 | == nil {
retErr = grpcutil.ScrubGRPC(err)
}
}()
return grpcutil.ScrubGRPC(restoreClient.Send(&admin.RestoreRequest{URL: url}))
} | |
c177803 | cmp.FilterPath(tf.filter, cmp.Ignore())
} | |
c177804 | *s = append(*s, textRecord{Value: textEllipsis})
}
return
}
if hasStats {
(*s)[len(*s)-1].Comment = (*s)[len(*s)-1].Comment.(diffStats).Append(ds)
}
} | |
c177805 |
if ni == 2 && no == 1 && t.Out(0) == boolType {
return true
}
case tibFunc: // func(T, I) bool
if ni == 2 && no == 1 && t.In(0).AssignableTo(t.In(1)) && t.Out(0) == boolType {
return true
}
case trFunc: // func(T) R
if ni == 1 && no == 1 {
return true
}
}
return false
} | |
c177806 |
break
}
name = s + "." + name
fullName = strings.TrimSuffix(fullName, s)
if i := strings.LastIndexByte(fullName, '('); inParen && i >= 0 {
fullName = fullName[:i]
}
fullName = strings.TrimSuffix(fullName, ".")
}
return strings.TrimSuffix(name, ".")
} | |
c177807 | uses a moving collector.
return Pointer{unsafe.Pointer(v.Pointer()), v.Type()}
} | |
c177808 | case UniqueY:
b[i] = 'Y'
case Modified:
b[i] = 'M'
default:
panic("invalid edit-type")
}
}
return string(b)
} | |
c177809 | s.NY++
case Modified:
s.NM++
default:
panic("invalid edit-type")
}
}
return
} | |
c177810 | p.append(Identity)
case r.Similar():
p.append(Modified)
case p.Y-dst.Y >= p.X-dst.X:
p.append(UniqueY)
default:
p.append(UniqueX)
}
}
for p.X > dst.X {
p.append(UniqueX)
}
for p.Y > dst.Y {
p.append(UniqueY)
}
}
} | |
c177811 | cmp.Comparer(equateAlways)),
cmp.FilterValues(areNaNsF32s, cmp.Comparer(equateAlways)),
}
} | |
c177812 | 0 || i >= len(pa) {
return pathStep{}
}
return pa[i]
} | |
c177813 |
return -1
}
return si.xkey
} | |
c177814 | return ""
}
return formatOptions{}.FormatDiff(r.root).String()
} | |
c177815 | symbols that
// do not strongly bind to the next lexicographical token (e.g., *T).
switch t.Kind() {
case reflect.Chan, reflect.Func, reflect.Ptr:
typeName = "(" + typeName + ")"
}
typeName = strings.Replace(typeName, "struct {", "struct{", -1)
typeName = strings.Replace(typeName, "interface {", "interface{", -1)
}
// Avoid wrap the value in parenthesis if unnecessary.
if s, ok := s.(textWrap); ok {
hasParens := strings.HasPrefix(s.Prefix, "(") && strings.HasSuffix(s.Suffix, ")")
hasBraces := strings.HasPrefix(s.Prefix, "{") && strings.HasSuffix(s.Suffix, "}")
if hasParens || hasBraces {
return textWrap{typeName, s, ""}
}
}
return textWrap{typeName + "(", s, ")"}
} | |
c177816 | s := opts.FormatValue(v, visitedPointers{}).String()
return strings.TrimSpace(s)
} | |
c177817 | Only allow printable runes for readability purposes.
rawInvalid := func(r rune) bool {
return r == '`' || r == '\n' || !(unicode.IsPrint(r) || r == '\t')
}
if strings.IndexFunc(s, rawInvalid) < 0 {
return "`" + s + "`"
}
return qs
} | |
c177818 |
case u <= 0xffffffffffff:
f = "0x%012x"
case u <= 0xffffffffffffff:
f = "0x%014x"
case u <= 0xffffffffffffffff:
f = "0x%016x"
}
return fmt.Sprintf(f, u)
} | |
c177819 | for stable testing purposes
}
return fmt.Sprintf("⟪0x%x⟫", p)
} | |
c177820 |
p := value.PointerOf(v)
_, visited := m[p]
m[p] = struct{}{}
return visited
} | |
c177821 | reflect.NewAt(f.Type, unsafe.Pointer(v.UnsafeAddr()+f.Offset)).Elem()
} | |
c177822 |
sub := ft.sub[cname[0]]
sub.insert(cname[1:])
ft.sub[cname[0]] = sub
} | |
c177823 | ft = ft.sub[ps.Name()]
if ft.ok {
return true
}
if len(ft.sub) == 0 {
return false
}
case cmp.Indirect:
default:
return false
}
}
return false
} | |
c177824 |
// Find the canonical name for this current field name.
// If the field exists in an embedded struct, then it will be expanded.
if !isExported(name) {
// Disallow unexported fields:
// * To discourage people from actually touching unexported fields
// * FieldByName is buggy (https://golang.org/issue/4876)
return []string{name}, fmt.Errorf("name must be exported")
}
sf, ok := t.FieldByName(name)
if !ok {
return []string{name}, fmt.Errorf("does not exist")
}
var ss []string
for i := range sf.Index {
ss = append(ss, t.FieldByIndex(sf.Index[:i+1]).Name)
}
if sel == "" {
return ss, nil
}
ssPost, err := canonicalName(sf.Type, sel)
return append(ss, ssPost...), err
} | |
c177825 | normalizeOption(opt); opt != nil {
return &pathFilter{fnc: f, opt: opt}
}
return nil
} | |
c177826 | nil
case 1:
return opts[0]
default:
return opts
}
} | |
c177827 | dst = append(dst, opt)
default:
panic(fmt.Sprintf("invalid option type: %T", opt))
}
}
return dst
} | |
c177828 | reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr,
reflect.Bool, reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128:
default:
return false
}
// If a sufficient number of elements already differ,
// use specialized formatting even if length requirement is not met.
if v.NumDiff > v.NumSame {
return true
}
default:
return false
}
// Use specialized string diffing for longer slices or strings.
const minLength = 64
return v.ValueX.Len() >= minLength && v.ValueY.Len() >= minLength
} | |
c177829 | s[i] <= '~' {
b[i] = s[i]
}
}
return string(b)
} | |
c177830 | lastStats(1).NumIdentical++
case diff.UniqueX:
lastStats(2).NumRemoved++
case diff.UniqueY:
lastStats(2).NumInserted++
case diff.Modified:
lastStats(2).NumModified++
}
}
return groups
} | |
c177831 |
for _, v := range vs[1:] {
if isLess(vs2[len(vs2)-1], v) {
vs2 = append(vs2, v)
}
}
return vs2
} | |
c177832 | return opts.FormatValue(v.ValueX, visitedPointers{})
case diffInserted:
return opts.FormatValue(v.ValueY, visitedPointers{})
default:
panic("invalid diff mode")
}
}
// Descend into the child value node.
if v.TransformerName != "" {
out := opts.WithTypeMode(emitType).FormatDiff(v.Value)
out = textWrap{"Inverse(" + v.TransformerName + ", ", out, ")"}
return opts.FormatType(v.Type, out)
} else {
switch k := v.Type.Kind(); k {
case reflect.Struct, reflect.Array, reflect.Slice, reflect.Map:
return opts.FormatType(v.Type, opts.formatDiffList(v.Records, k))
case reflect.Ptr:
return textWrap{"&", opts.FormatDiff(v.Value), ""}
case reflect.Interface:
return opts.WithTypeMode(emitType).FormatDiff(v.Value)
default:
panic(fmt.Sprintf("%v cannot have children", k))
}
}
} | |
c177833 | == 0:
lastStats(1).NumIdentical++
case rv.NumDiff > 0 && !rv.ValueY.IsValid():
lastStats(2).NumRemoved++
case rv.NumDiff > 0 && !rv.ValueX.IsValid():
lastStats(2).NumInserted++
default:
lastStats(2).NumModified++
}
}
return groups
} | |
c177834 | Options(opts), Reporter(r))
d := r.String()
if (d == "") != eq {
panic("inconsistent difference and equality results")
}
return d
} | |
c177835 | oldReporters := s.result, s.reporters
s.result = diff.Result{} // Reset result
s.reporters = nil // Remove reporters to avoid spurious printouts
s.compareAny(step)
res := s.result
s.result, s.reporters = oldResult, oldReporters
return res
} | |
c177836 | reflect.Interface && v.IsNil() && v.Type() != t {
return reflect.New(t).Elem()
}
}
return v
} | |
c177837 | append(ss, fmt.Sprintf("%v: %v => %v", t, tf.In(0), tf.Out(0)))
}
m[t]++
}
}
if len(ss) > 0 {
const warning = "recursive set of Transformers detected"
const help = "consider using cmpopts.AcyclicTransformer"
set := strings.Join(ss, "\n\t")
panic(fmt.Sprintf("%s:\n\t%s\n%s", warning, set, help))
}
} | |
c177838 | := reflect.New(v.Type()).Elem()
vc.Set(v)
return vc
} | |
c177839 |
visitor.EmitFloat64(lf.key, math.Float64frombits(uint64(lf.numericVal)))
case errorType:
if err, ok := lf.interfaceVal.(error); ok {
visitor.EmitString(lf.key, err.Error())
} else {
visitor.EmitString(lf.key, "<nil>")
}
case objectType:
visitor.EmitObject(lf.key, lf.interfaceVal)
case lazyLoggerType:
visitor.EmitLazyLogger(lf.interfaceVal.(LazyLogger))
case noopType:
// intentionally left blank
}
} | |
c177840 | {
return fmt.Sprint(lf.key, ":", lf.Value())
} | |
c177841 | s.SetTag(t.Key, t.Value)
} | |
c177842 |
for baggageKey, baggageVal := range spanContext.Baggage {
safeVal := baggageVal
if t.HTTPHeaders {
safeVal = url.QueryEscape(baggageVal)
}
writer.Set(mockTextMapBaggagePrefix+baggageKey, safeVal)
}
return nil
} | |
c177843 |
// Baggage:
if rval.Baggage == nil {
rval.Baggage = make(map[string]string)
}
safeVal := val
if t.HTTPHeaders {
// unescape errors are ignored, nothing can be done
if rawVal, err := url.QueryUnescape(val); err == nil {
safeVal = rawVal
}
}
rval.Baggage[lowerKey[len(mockTextMapBaggagePrefix):]] = safeVal
}
return nil
})
if rval.TraceID == 0 || rval.SpanID == 0 {
return emptyContext, opentracing.ErrSpanContextNotFound
}
if err != nil {
return emptyContext, err
}
return rval, nil
} | |
c177844 | = []log.Field{
log.String("event", ld.Event),
}
} else {
rval.Fields = []log.Field{
log.String("event", ld.Event),
log.Object("payload", ld.Payload),
}
}
return rval
} | |
c177845 |
httpPropagator := &TextMapPropagator{HTTPHeaders: true}
t.RegisterInjector(opentracing.HTTPHeaders, httpPropagator)
t.RegisterExtractor(opentracing.HTTPHeaders, httpPropagator)
return t
} | |
c177846 | := range opts {
o.Apply(&sso)
}
return newMockSpan(t, operationName, sso)
} | |
c177847 |
t.injectors[format] = injector
} | |
c177848 | extractor Extractor) {
t.extractors[format] = extractor
} | |
c177849 | if !ok {
return opentracing.ErrInvalidCarrier
}
injector, ok := t.injectors[format]
if !ok {
return opentracing.ErrUnsupportedFormat
}
return injector.Inject(spanContext, carrier)
} | |
c177850 | {
return nil, opentracing.ErrUnsupportedFormat
}
return extractor.Extract(carrier)
} | |
c177851 | context.WithValue(ctx, activeSpanKey, span)
} | |
c177852 | span.SetTag(string(tag), value)
} | |
c177853 | span.SetTag(string(tag), value)
} | |
c177854 | span.SetTag(string(tag), value)
} | |
c177855 | span.SetTag(string(tag), value)
} | |
c177856 | = reflect.TypeOf(value).Kind()
m.ValueString = fmt.Sprint(value)
} | |
c177857 |
value(&meta)
m.Key = meta.Key
m.ValueKind = meta.ValueKind
m.ValueString = meta.ValueString
} | |
c177858 | newTracer}
for _, opt := range opts {
opt(s)
}
suite.Run(t, s)
} | |
c177859 | {
return func(s *APICheckSuite) {
s.opts.CheckBaggageValues = val
}
} | |
c177860 | {
s.opts.CheckExtract = val
}
} | |
c177861 | {
s.opts.CheckInject = val
}
} | |
c177862 | {
s.opts.CheckBaggageValues = true
s.opts.CheckExtract = true
s.opts.CheckInject = true
}
} | |
c177863 | *APICheckSuite) {
s.opts.Probe = probe
}
} | |
c177864 | = make(map[string]string, len(c.Baggage)+1)
for k, v := range c.Baggage {
newBaggage[k] = v
}
newBaggage[key] = value
}
// Use positional parameters so the compiler will help catch new fields.
return MockSpanContext{c.TraceID, c.SpanID, c.Sampled, newBaggage}
} | |
c177865 |
for k, v := range s.tags {
tags[k] = v
}
return tags
} | |
c177866 | defer s.RUnlock()
return s.tags[k]
} | |
c177867 | make([]MockLogRecord, len(s.logs))
copy(logs, s.logs)
return logs
} | |
c177868 | defer s.Unlock()
return s.SpanContext
} | |
c177869 | if v, ok := value.(uint16); ok {
s.SpanContext.Sampled = v > 0
return s
}
if v, ok := value.(int); ok {
s.SpanContext.Sampled = v > 0
return s
}
}
s.tags[key] = value
return s
} | |
c177870 | s.SpanContext.WithBaggageItem(key, val)
return s
} | |
c177871 | {
s.RLock()
defer s.RUnlock()
return s.SpanContext.Baggage[key]
} | |
c177872 | = time.Now()
s.Unlock()
s.tracer.recordSpan(s)
} | |
c177873 |
// Handle (deprecated) BulkLogData.
for _, ld := range opts.BulkLogData {
if ld.Payload != nil {
s.logFieldsWithTimestamp(
ld.Timestamp,
log.String("event", ld.Event),
log.Object("payload", ld.Payload))
} else {
s.logFieldsWithTimestamp(
ld.Timestamp,
log.String("event", ld.Event))
}
}
s.tracer.recordSpan(s)
} | |
c177874 | s.SpanContext.TraceID, s.SpanContext.SpanID, s.ParentID,
s.SpanContext.Sampled, s.OperationName)
} | |
c177875 | s.logFieldsWithTimestamp(time.Now(), fields...)
} | |
c177876 | := &(lr.Fields[i])
f.Marshal(outField)
}
s.Lock()
defer s.Unlock()
s.logs = append(s.logs, lr)
} | |
c177877 | len(keyValues))))
return
}
fields, err := log.InterleavedKVToFields(keyValues...)
if err != nil {
s.LogFields(log.Error(err), log.String("function", "LogKV"))
return
}
s.LogFields(fields...)
} | |
c177878 | s.LogFields(log.String("event", event))
} | |
c177879 | interface{}) {
s.LogFields(log.String("event", event), log.Object("payload", payload))
} | |
c177880 | defer s.Unlock()
s.OperationName = operationName
return s
} | |
c177881 | {
return filepath.Join(sys.RootForImplicitAbsolutePaths, systemRegistriesDirPath)
}
}
return systemRegistriesDirPath
} | |
c177882 | "%s" and "%s"`,
dockerDefaultMergedFrom, configPath)
}
mergedConfig.DefaultDocker = config.DefaultDocker
dockerDefaultMergedFrom = configPath
}
for nsName, nsConfig := range config.Docker { // includes config.Docker == nil
if _, ok := mergedConfig.Docker[nsName]; ok {
return nil, errors.Errorf(`Error parsing signature storage configuration: "docker" namespace "%s" defined both in "%s" and "%s"`,
nsName, nsMergedFrom[nsName], configPath)
}
mergedConfig.Docker[nsName] = nsConfig
nsMergedFrom[nsName] = configPath
}
}
return &mergedConfig, nil
} | |
c177883 | return nil, errors.Errorf("invalid image reference %s, expected format: 'hostname/namespace/stream:tag'", ref)
}
return NewReference(tagged)
} | |
c177884 | reference.FamiliarString(dockerRef))
}
return openshiftReference{
namespace: r[0],
stream: r[1],
dockerReference: dockerRef,
}, nil
} | |
c177885 | http.StatusOK:
return nil
case http.StatusUnauthorized:
return ErrUnauthorizedForCredentials
default:
return errors.Errorf("error occured with status code %d (%s)", resp.StatusCode, http.StatusText(resp.StatusCode))
}
} | |
c177886 |
httpClient := &http.Client{Transport: tr}
return httpClient.Do(req)
} | |
c177887 | docker registry returned")
if c.sys != nil && c.sys.DockerDisableV1Ping {
return err
}
// best effort to understand if we're talking to a V1 registry
pingV1 := func(scheme string) bool {
url := fmt.Sprintf(resolvedPingV1URL, scheme, c.registry)
resp, err := c.makeRequestToResolvedURL(ctx, "GET", url, nil, nil, -1, noAuth, nil)
if err != nil {
logrus.Debugf("Ping %s err %s (%#v)", url, err.Error(), err)
return false
}
defer resp.Body.Close()
logrus.Debugf("Ping %s status %d", url, resp.StatusCode)
if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusUnauthorized {
return false
}
return true
}
isV1 := pingV1("https")
if !isV1 && c.tlsClientConfig.InsecureSkipVerify {
isV1 = pingV1("http")
}
if isV1 {
err = ErrV1NotSupported
}
}
return err
} | |
c177888 | { c.detectPropertiesError = c.detectPropertiesHelper(ctx) })
return c.detectPropertiesError
} | |
c177889 | err
}
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
return nil, errors.Wrapf(client.HandleErrorResponse(res), "Error downloading signatures for %s in %s", manifestDigest, ref.ref.Name())
}
body, err := ioutil.ReadAll(res.Body)
if err != nil {
return nil, err
}
var parsedBody extensionSignatureList
if err := json.Unmarshal(body, &parsedBody); err != nil {
return nil, errors.Wrapf(err, "Error decoding signature list")
}
return &parsedBody, nil
} | |
c177890 | use keep alive
DisableKeepAlives: true,
}
proxyDialer, err := sockets.DialerFromEnvironment(direct)
if err == nil {
tr.Dial = proxyDialer.Dial
}
return tr
} | |
c177891 | return ioutil.ReadFile(RegistriesConfPath(sys))
} | |
c177892 | return nil, err
}
return config.Registries.Search.Registries, nil
} | |
c177893 |
return nil, err
}
return config.Registries.Insecure.Registries, nil
} | |
c177894 |
path = filepath.Join(ctx.RootForImplicitAbsolutePaths, systemRegistriesConfPath)
}
}
return path
} | |
c177895 | OptionalBoolFalse
if b == true {
o = OptionalBoolTrue
}
return o
} | |
c177896 | {
return errors.Errorf(`"Invalid PolicyContext state, expected "%s", found "%s"`, expected, pc.state)
}
pc.state = new
return nil
} | |
c177897 |
}
// FIXME: destroy
return pc.changeState(pcDestroying, pcDestroyed)
} | |
c177898 | + ":" + ref.PolicyConfigurationIdentity()
} | |
c177899 |
if req, ok := transportScopes[name]; ok {
logrus.Debugf(` Using transport "%s" specific policy section %s`, transportName, name)
return req
}
}
// Look for a default match for the transport.
if req, ok := transportScopes[""]; ok {
logrus.Debugf(` Using transport "%s" policy section ""`, transportName)
return req
}
}
logrus.Debugf(" Using default policy section")
return pc.Policy.Default
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.