id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1 value |
|---|---|---|
c171200 | anchor,
tag: tag,
implicit: implicit,
style: yaml_style_t(style),
}
} | |
c171201 | 0 {
return true
}
if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil {
return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error())
}
emitter.buffer_pos = 0
return true
} | |
c171202 | as otherwise the
// conversion would fail.
//
// We mark t2's fields as used by t1's fields, and vice
// versa. That way, if no code actually refers to a field
// in either type, it's still correctly marked as unused.
// If a field is used in either struct, it's implicitly
// relevant in the other one, too.
//
// It works in a similar way for conversions between types
// of two packages, only that the extra information in the
// graph is redundant unless we're in whole program mode.
n := typDst.NumFields()
for i := 0; i < n; i++ {
fDst := typDst.Field(i)
fSrc := typSrc.Field(i)
c.graph.markUsedBy(fDst, fSrc)
c.graph.markUsedBy(fSrc, fDst)
}
}
} | |
c171203 | typ = typ.Underlying()
}
if _, ok := typ.(*types.Struct); !ok {
return
}
if isBasicStruct(node.Elts) {
c.markFields(typ)
}
}
} | |
c171204 | return
}
obj := pkg.TypesInfo.ObjectOf(node.Name)
c.graph.roots = append(c.graph.roots, c.graph.getNode(obj))
}
}
} | |
c171205 | fmt.Fprintf(buf, " type %-*s %s\n",
maxname, name, relType(mem.Type().Underlying(), from))
for _, meth := range typeutil.IntuitiveMethodSet(mem.Type(), &p.Prog.MethodSets) {
fmt.Fprintf(buf, " %s\n", types.SelectionString(meth, types.RelativeTo(from)))
}
case *Global:
fmt.Fprintf(buf, " var %-*s %s\n",
maxname, name, relType(mem.Type().(*types.Pointer).Elem(), from))
}
}
fmt.Fprintf(buf, "\n")
} | |
c171206 | if config.PartitionStrategy == nil {
config.PartitionStrategy = partitionPathsAsDirectories
}
return &Linter{
LinterConfig: config,
Name: name,
regex: regex,
}, nil
} | |
c171207 | value. This does not, unfortunately, cover zero
// initialised structs, as these cause additional
// instructions.
return true
case *ssa.Panic:
return true
default:
return false
}
} | |
c171208 | named, ok := DereferenceR(res.At(i).Type()).(*types.Named); ok &&
!ast.IsExported(named.Obj().Name()) &&
named != types.Universe.Lookup("error").Type() {
j.Errorf(fn, "should not return unexported type")
}
}
}
} | |
c171209 |
for _, info := range lprog.AllPackages {
if info.TransitivelyErrorFree {
prog.CreatePackage(info.Pkg, info.Files, &info.Info, info.Importable)
}
}
return prog
} | |
c171210 | ranges {
if r.matches(issue) {
debug("nolint: matched %s to issue %s", r, issue)
r.matched = true
return true
}
}
return false
} | |
c171211 | !ignore.matched {
unmatched[path] = append(unmatched[path], ignore)
}
}
}
return unmatched
} | |
c171212 | filenames {
ranges := d.parseFile(filename)
sort.Sort(ranges)
d.files[filename] = ranges
}
return nil
} | |
c171213 |
case "386", "arm":
wordSize, maxAlign = 4, 4
case "amd64p32":
wordSize = 4
}
return &Sizes{WordSize: wordSize, MaxAlign: maxAlign}
} | |
c171214 | return ok && IsType(change.X.Type(), typ)
} | |
c171215 | return yaml_emitter_emit_sequence_start(emitter, event)
case yaml_MAPPING_START_EVENT:
return yaml_emitter_emit_mapping_start(emitter, event)
default:
return yaml_emitter_set_emitter_error(emitter,
fmt.Sprintf("expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS, but got %v", event.typ))
}
} | |
c171216 | ident != nil && ident.Name == "_"
} | |
c171217 | T.Underlying().(*types.Pointer); ok {
return p.Elem()
}
return T
} | |
c171218 |
if err != nil {
return err
}
return conn.Close()
}
} | |
c171219 |
return http.ErrUseLastResponse
},
}
return func() error {
resp, err := client.Get(url)
if err != nil {
return err
}
resp.Body.Close()
if resp.StatusCode != 200 {
return fmt.Errorf("returned status %d", resp.StatusCode)
}
return nil
}
} | |
c171220 |
defer cancel()
addrs, err := resolver.LookupHost(ctx, host)
if err != nil {
return err
}
if len(addrs) < 1 {
return fmt.Errorf("could not resolve host")
}
return nil
}
} | |
c171221 | h.Handle("/live", http.HandlerFunc(h.LiveEndpoint))
h.Handle("/ready", http.HandlerFunc(h.ReadyEndpoint))
return h
} | |
c171222 | NewHandler(),
registry: registry,
namespace: namespace,
}
} | |
c171223 | := <-c:
return err
case <-time.After(timeout):
return timeoutError(timeout)
}
}
} | |
c171224 | false,
hasIPv6: false,
Size: TimeSliceLength,
MaxRTT: time.Second,
OnRecv: nil,
OnIdle: nil,
Debug: false,
}
} | |
c171225 | fallthrough
case "udp":
p.network = network
default:
return origNet, errors.New(network + " can't be used as ICMP endpoint")
}
return origNet, nil
} | |
c171226 | an IP address", ipaddr)
}
p.mu.Lock()
p.addrs[addr.String()] = &net.IPAddr{IP: addr}
if isIPv4(addr) {
p.hasIPv4 = true
} else if isIPv6(addr) {
p.hasIPv6 = true
}
p.mu.Unlock()
return nil
} | |
c171227 | = true
} else if isIPv6(ip.IP) {
p.hasIPv6 = true
}
p.mu.Unlock()
} | |
c171228 | IP address", ipaddr)
}
p.mu.Lock()
delete(p.addrs, addr.String())
p.mu.Unlock()
return nil
} | |
c171229 | delete(p.addrs, ip.String())
p.mu.Unlock()
} | |
c171230 | SubstituteRune(slug, fiSub)
case "gr":
slug = SubstituteRune(slug, grSub)
case "nl":
slug = SubstituteRune(slug, nlSub)
case "pl":
slug = SubstituteRune(slug, plSub)
case "tr":
slug = SubstituteRune(slug, trSub)
default: // fallback to "en" if lang not found
slug = SubstituteRune(slug, enSub)
}
// Process all non ASCII symbols
slug = unidecode.Unidecode(slug)
slug = strings.ToLower(slug)
// Process all remaining symbols
slug = regexpNonAuthorizedChars.ReplaceAllString(slug, "-")
slug = regexpMultipleDashes.ReplaceAllString(slug, "-")
slug = strings.Trim(slug, "-_")
if MaxLength > 0 {
slug = smartTruncate(slug)
}
return slug
} | |
c171231 | := range keys {
buf = strings.Replace(buf, key, sub[key], -1)
}
return
} | |
c171232 | buf.WriteString(d)
} else {
buf.WriteRune(c)
}
}
return buf.String()
} | |
c171233 |
if fset.NArg() == 0 {
return nil
}
// Subcommand.
idx := len(args) - fset.NArg()
s := args[idx]
args = args[idx+1:]
for _, sub := range subs {
if sub.name != s {
continue
}
fs, handler := sub.init(out)
if err := fs.Parse(args); err != nil {
return err
}
return handler(args[len(args)-fs.NArg():]...)
}
return fmt.Errorf("%s is not a valid cmdflag", s)
} | |
c171234 | byte(h32>>8), byte(h32>>16), byte(h32>>24))
} | |
c171235 | prime32_minus1
xxh.totalLen = 0
xxh.bufused = 0
} | |
c171236 | rol13(v1+binary.LittleEndian.Uint32(buf[:])*prime32_2) * prime32_1
v2 = rol13(v2+binary.LittleEndian.Uint32(buf[4:])*prime32_2) * prime32_1
v3 = rol13(v3+binary.LittleEndian.Uint32(buf[8:])*prime32_2) * prime32_1
v4 = rol13(v4+binary.LittleEndian.Uint32(buf[12:])*prime32_2) * prime32_1
p = r
xxh.bufused = 0
}
for n := n - 16; p <= n; p += 16 {
sub := input[p:][:16] //BCE hint for compiler
v1 = rol13(v1+binary.LittleEndian.Uint32(sub[:])*prime32_2) * prime32_1
v2 = rol13(v2+binary.LittleEndian.Uint32(sub[4:])*prime32_2) * prime32_1
v3 = rol13(v3+binary.LittleEndian.Uint32(sub[8:])*prime32_2) * prime32_1
v4 = rol13(v4+binary.LittleEndian.Uint32(sub[12:])*prime32_2) * prime32_1
}
xxh.v1, xxh.v2, xxh.v3, xxh.v4 = v1, v2, v3, v4
copy(xxh.buf[xxh.bufused:], input[p:])
xxh.bufused += len(input) - p
return n, nil
} | |
c171237 | p++ {
h32 += uint32(buf[p]) * prime32_5
h32 = rol11(h32) * prime32_1
}
h32 ^= h32 >> 15
h32 *= prime32_2
h32 ^= h32 >> 13
h32 *= prime32_3
h32 ^= h32 >> 16
return h32
} | |
c171238 | + rol7(v2) + rol12(v3) + rol18(v4)
}
p := 0
for n := n - 4; p <= n; p += 4 {
h32 += binary.LittleEndian.Uint32(input[p:p+4]) * prime32_3
h32 = rol17(h32) * prime32_4
}
for p < n {
h32 += uint32(input[p]) * prime32_5
h32 = rol11(h32) * prime32_1
p++
}
h32 ^= h32 >> 15
h32 *= prime32_2
h32 ^= h32 >> 13
h32 *= prime32_3
h32 ^= h32 >> 16
return h32
} | |
c171239 |
h *= prime32_2
h ^= h >> 13
h *= prime32_3
h ^= h >> 16
return h
} | |
c171240 | < 0 {
return 0, ErrInvalidSourceShortBuffer
}
return di, nil
} | |
c171241 | &Reader{src: src}
return r
} | |
c171242 | z.zdata[:0]
z.data = z.data[:0]
z.idx = 0
z.checksum.Reset()
} | |
c171243 | binary.LittleEndian.Uint32(buf)
return x, err
} | |
c171244 | bytes copied to buf, current index %d", n, z.idx)
}
if z.idx < len(z.data) {
// Buffer not filled.
if debugFlag {
debug("need more data for compression")
}
return n, nil
}
// Buffer full.
if err := z.compressBlock(z.data); err != nil {
return n, err
}
z.idx = 0
}
return n, nil
} | |
c171245 |
return err
}
written, err := z.dst.Write(zdata)
if err != nil {
return err
}
if h := z.OnBlockDone; h != nil {
h(written)
}
if z.BlockChecksum {
checksum := xxh32.ChecksumZero(zdata)
if debugFlag {
debug("block checksum %x", checksum)
}
if err := z.writeUint32(checksum); err != nil {
return err
}
}
if debugFlag {
debug("current frame checksum %x", z.checksum.Sum32())
}
return nil
} | |
c171246 | if z.idx == 0 {
return nil
}
if err := z.compressBlock(z.data[:z.idx]); err != nil {
return err
}
z.idx = 0
return nil
} | |
c171247 | block")
}
if err := z.writeUint32(0); err != nil {
return err
}
if !z.NoChecksum {
checksum := z.checksum.Sum32()
if debugFlag {
debug("stream checksum %x", checksum)
}
if err := z.writeUint32(checksum); err != nil {
return err
}
}
return nil
} | |
c171248 | z.zdata[:0]
z.data = z.data[:0]
z.idx = 0
} | |
c171249 | x)
_, err := z.dst.Write(buf)
return err
} | |
c171250 | Display the filename.
progressbar.OptionSetDescription(filename),
progressbar.OptionClearOnFinish(),
)
out = io.MultiWriter(out, bar)
zr.OnBlockDone = func(n int) {
size += n
}
}
// Uncompress.
_, err = io.Copy(out, zr)
if err != nil {
return err
}
for _, c := range []io.Closer{zfile, file} {
err := c.Close()
if err != nil {
return err
}
}
if bar != nil {
_ = bar.Clear()
fmt.Printf("%s %d\n", zfilename, size)
}
}
return nil
}
} | |
c171251 | // File transfers are usually slow, make sure we display the bar at 0%.
progressbar.OptionSetRenderBlankState(true),
// Display the filename.
progressbar.OptionSetDescription(filename),
progressbar.OptionClearOnFinish(),
)
zw.OnBlockDone = func(n int) {
_ = bar.Add(1)
zsize += n
}
}
// Output file.
zfilename := fmt.Sprintf("%s%s", filename, lz4.Extension)
zfile, err := os.OpenFile(zfilename, os.O_CREATE|os.O_WRONLY, mode)
if err != nil {
return err
}
zw.Reset(zfile)
// Compress.
_, err = io.Copy(zw, file)
if err != nil {
return err
}
for _, c := range []io.Closer{zw, zfile} {
err := c.Close()
if err != nil {
return err
}
}
if size > 0 {
fmt.Printf("%s %.02f%%\n", zfilename, float64(zsize)*100/float64(size))
}
}
return nil
}
} | |
c171252 | zw.Close()
if err != nil {
panic(err)
}
// uncompress the newly compressed data
ud, err := ioutil.ReadAll(lz4.NewReader(buf))
if err != nil {
panic(err)
}
if bytes.Compare(d, ud) != 0 {
panic("not equal")
}
return 1
} | |
c171253 | path
client.service = &ClientService{client, &sync.WaitGroup{}, false}
return client
} | |
c171254 | client.doSubscribe(topic, fn, serverAddr, serverPath, Subscribe)
} | |
c171255 | service.wg.Add(1)
service.started = true
go http.Serve(l, nil)
}
} else {
err = errors.New("Client service already started")
}
return err
} | |
c171256 | error {
service.client.eventBus.Publish(arg.Topic, arg.Args...)
*reply = true
return nil
} | |
c171257 | sync.WaitGroup{},
}
return Bus(b)
} | |
c171258 | not of type reflect.Func", reflect.TypeOf(fn).Kind())
}
bus.handlers[topic] = append(bus.handlers[topic], handler)
return nil
} | |
c171259 | reflect.ValueOf(fn), false, false, false, sync.Mutex{},
})
} | |
c171260 | {
return len(bus.handlers[topic]) > 0
}
return false
} | |
c171261 | bus.findHandlerIdx(topic, reflect.ValueOf(handler)))
return nil
}
return fmt.Errorf("topic %s doesn't exist", topic)
} | |
c171262 | if handler.flagOnce {
bus.removeHandler(topic, i)
}
if !handler.async {
bus.doPublish(handler, topic, args...)
} else {
bus.wg.Add(1)
if handler.transactional {
handler.Lock()
}
go bus.doPublishAsync(handler, topic, args...)
}
}
}
} | |
c171263 | bus.service = &NetworkBusService{&sync.WaitGroup{}, false}
bus.address = address
bus.path = path
return bus
} | |
c171264 |
server.RegisterName("ClientService", clientService)
server.HandleHTTP(networkBus.path, "/debug"+networkBus.path)
l, e := net.Listen("tcp", networkBus.address)
if e != nil {
err = fmt.Errorf("listen error: %v", e)
}
service.wg.Add(1)
go http.Serve(l, nil)
} else {
err = errors.New("Server bus already started")
}
return err
} | |
c171265 | make(map[string][]*SubscribeArg)
server.service = &ServerService{server, &sync.WaitGroup{}, false}
return server
} | |
c171266 | topicSubscribers {
if *topicSubscriber == *arg {
return true
}
}
}
return false
} | |
c171267 | l, e := net.Listen("tcp", server.address)
if e != nil {
err = e
fmt.Errorf("listen error: %v", e)
}
service.started = true
service.wg.Add(1)
go http.Serve(l, nil)
} else {
err = errors.New("Server bus already started")
}
return err
} | |
c171268 |
if _, ok := subscribers[arg.Topic]; ok {
topicSubscribers = []*SubscribeArg{arg}
} else {
topicSubscribers = subscribers[arg.Topic]
topicSubscribers = append(topicSubscribers, arg)
}
subscribers[arg.Topic] = topicSubscribers
}
*success = true
return nil
} | |
c171269 | against the
// removal when it isn't empty
if p.RemovalDate != "" {
notAfter, _ := time.Parse(GTLDPeriodDateFormat, p.RemovalDate)
if when.After(notAfter) {
return fmt.Errorf(`gTLD ".%s" is not valid after %s`,
p.GTLD, p.RemovalDate)
}
}
return nil
} | |
c171270 | tldMap[rightLabel]; !present {
return false
} else if tldPeriod.Valid(when) != nil {
// If the TLD exists but the date is outside of the gTLD's validity period
// then it is not a valid TLD.
return false
}
// Otherwise the TLD exists, and was a valid TLD delegated in the root DNS
// at the time of the given date.
return true
} | |
c171271 |
if _, ok := tldMap[label]; ok {
return true
} else {
return false
}
} | |
c171272 | DNS name.
err = lintReversedIPAddressLabels(name, true)
}
// Return the first error as a negative lint result
if err != nil {
return &LintResult{
Status: Warn,
Details: err.Error(),
}
}
}
return &LintResult{
Status: Pass,
}
} | |
c171273 | else {
ip = reversedLabelsToIPv4(ipLabels)
}
// If the result isn't an IP then a warning should be generated
if ip == nil {
return fmt.Errorf(
"the first %d labels of name %q did not parse as a reversed IP address",
numRequiredLabels, name)
}
// Otherwise return no error - checking the actual value of the IP is left to
// `lint_subject_contains_reserved_arpa_ip.go`.
return nil
} | |
c171274 | leftStrip := strings.TrimLeftFunc(value, unicode.IsSpace); leftStrip != value {
leading = true
}
if rightStrip := strings.TrimRightFunc(value, unicode.IsSpace); rightStrip != value {
trailing = true
}
}
}
return
} | |
c171275 | {
i := int(b)
if i > 127 || i < 0 {
return false
}
}
return true
} | |
c171276 | tagged with tag
rest := seq.Bytes
for len(rest) > 0 {
var v asn1.RawValue
rest, err = asn1.Unmarshal(rest, &v)
if err != nil {
return false, err
}
if v.Tag == tag {
if !IsIA5String(v.Bytes) {
return false, nil
}
}
}
return true, nil
} | |
c171277 | evoids[oid.String()]; ok {
return true
}
}
return false
} | |
c171278 | field unless such Certificate was
* issued in accordance with Appendix F of the EV Guidelines.
*/
if !util.IsEV(c.PolicyIdentifiers) {
return &LintResult{
Status: Error,
Details: fmt.Sprintf(
"certificate contains one or more %s subject domains but is not an EV certificate",
onionTLD),
}
}
return &LintResult{Status: Pass}
} | |
c171279 | return nil, fmt.Errorf("unexpected status code fetching data "+
"from %q : expected status %d got %d",
url, http.StatusOK, resp.StatusCode)
}
respBody, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("unexpected error reading response "+
"body from %q : %s",
url, err)
}
return respBody, nil
} | |
c171280 | {
return nil, fmt.Errorf("unexpected error unmarshaling ICANN gTLD JSON response "+
"body from %q : %s",
ICANN_GTLD_JSON, err)
}
return results.GTLDs, nil
} | |
c171281 | for _, gTLD := range entries {
if gTLD.DelegationDate == "" {
continue
}
results = append(results, gTLD)
}
return results
} | |
c171282 | != nil {
return err
}
// a gTLD that has not been removed has an empty RemovalDate and that's OK
if _, err := time.Parse(util.GTLDPeriodDateFormat, gTLD.RemovalDate); gTLD.RemovalDate != "" && err != nil {
return err
}
}
return nil
} | |
c171283 | flag.PrintDefaults()
}
flag.Parse()
log.SetLevel(log.InfoLevel)
} | |
c171284 | return false
}
_, ok := nameAttributeLeaves[oid[3]]
return ok
} | |
c171285 | := e.String()
return json.Marshal(s)
} | |
c171286 |
case Error:
return "error"
case Fatal:
return "fatal"
default:
return ""
}
} | |
c171287 | _, lint := range lints.Lints {
enc.Encode(lint)
}
} | |
c171288 | }
// Run all tests
res := new(ResultSet)
res.execute(c)
res.Version = Version
res.Timestamp = time.Now().Unix()
return res
} | |
c171289 | util.IsSubscriberCert(c) && util.CertificateSubjInTLD(c, onionTLD)
} | |
c171290 |
Details: fmt.Sprintf(format, args...),
}
} | |
c171291 | || !l.EffectiveDate.After(c.NotBefore) {
return true
}
return false
} | |
c171292 | if oid.Equal(cert.Extensions[i].Id) {
return &(cert.Extensions[i])
}
}
return nil
} | |
c171293 |
if oid.Equal(v.Type) {
return true
}
}
return false
} | |
c171294 | var restIn asn1.RawContent
restIn, err = asn1.Unmarshal(inSeq.Bytes, &oidIssue) //extract first inner CertPolicyId (issuer domain)
if err != nil || len(restIn) == 0 {
err = errors.New("policyMap: Could not unmarshal inner sequence.")
return
}
empty, err = asn1.Unmarshal(restIn, &oidSubject) //extract second inner CertPolicyId (subject domain)
if err != nil || len(empty) != 0 {
err = errors.New("policyMap: Could not unmarshal inner sequence.")
return
}
//append found OIDs
out = append(out, [2]asn1.ObjectIdentifier{oidIssue, oidSubject})
}
return
} | |
c171295 | err := w.Encode(v)
if err != nil {
panic(err)
}
} | |
c171296 | "null" {
return nil
}
var s string
err := json.Unmarshal(data, &s)
if err != nil {
return err
}
u.URL, err = url.Parse(s)
return err
} | |
c171297 |
client: graphql.NewClient("https://api.github.com/graphql", httpClient),
}
} | |
c171298 | *Client {
return &Client{
client: graphql.NewClient(url, httpClient),
}
} | |
c171299 |
return c.client.Query(ctx, q, variables)
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.