id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c20300 | := parseExpr(f[1], "replacement")
return func(p *ast.File) *ast.File { return rewriteFile(pattern, replace, p) }
} | |
c20301 | "parsing %s %s at %s\n", what, s, err)
os.Exit(2)
}
return x
} | |
c20302 | reflect.New(p.Type()).Elem()
for i := 0; i < p.NumField(); i++ {
v.Field(i).Set(subst(m, p.Field(i), pos))
}
return v
case reflect.Ptr:
v := reflect.New(p.Type()).Elem()
if elem := p.Elem(); elem.IsValid() {
v.Set(subst(m, elem, pos).Addr())
}
return v
case reflect.Interface:
v := reflect.New... | |
c20303 | &opt{
theOne: o,
index: index,
}
} | |
c20304 | Opts: map[*container.Container][]string{},
ExcludedOpts: map[*container.Container]struct{}{},
RejectOptions: false,
}
} | |
c20305 | vs := range o.Opts {
pc.Opts[k] = append(pc.Opts[k], vs...)
}
} | |
c20306 | &Transition{Matcher: matcher, Next: next})
return next
} | |
c20307 | sortTransitions(s, map[*State]bool{})
} | |
c20308 | if !ok {
return fmt.Errorf("incorrect usage")
}
if err := fillContainers(pc.Opts); err != nil {
return err
}
return fillContainers(pc.Args)
} | |
c20309 | return bf.IsBoolFlag()
}
return false
} | |
c20310 | return true
}
continue
}
vs := strings.Split(v, ",")
if err := setMultivalued(multiValued, vs); err == nil {
return true
}
}
}
return false
} | |
c20311 | params.Args,
argsIdx: params.ArgsIdx,
tokens: tokens,
}
return p.parse()
} | |
c20312 | {\n\trankdir=LR\n%s\n}\n", strings.Join(trs, "\n"))
} | |
c20313 | v
return (*BoolValue)(into)
} | |
c20314 | *StringValue {
*into = v
return (*StringValue)(into)
} | |
c20315 | v
return (*IntValue)(into)
} | |
c20316 | *Float64Value {
*into = v
return (*Float64Value)(into)
} | |
c20317 | *StringsValue {
*into = v
return (*StringsValue)(into)
} | |
c20318 | *IntsValue {
*into = v
return (*IntsValue)(into)
} | |
c20319 | = v
return (*Floats64Value)(into)
} | |
c20320 | &options{
options: opts,
index: index,
}
} | |
c20321 | newDir {
return true
}
}
return false
} | |
c20322 | dirList += list[i+1] + "/"
}
if !d.Exists(dirList) {
if strings.HasSuffix(dirList, "//") {
dirList = dirList[:len(dirList)-1]
}
dirWalk = append(dirWalk, dirList)
d.Blacklist = append(d.Blacklist, dirList)
}
}
return dirWalk
} | |
c20323 |
d.Blacklist = append(d.Blacklist, newDir)
d.List = append(d.List, d.Parse(newDir))
}
} | |
c20324 |
log.Println("Parsing hash list response's body...")
ri := &ResponseInit{}
err = json.Unmarshal(buf.Bytes(), &ri)
if err != nil {
log.Println("Body is", buf.Bytes())
return err
}
resp.Body.Close()
// copy hash list
if ri.Success {
log.Println("Copying hash list...")
up.RemoteHashes = ri.Hashes
up.Lo... | |
c20325 | log.Println("-----------------------")
log.Println("-- Nothing to update --")
log.Println("-----------------------")
}
return hasUpdates, nil
} | |
c20326 | }
sha := sha256.New()
if _, err := sha.Write(f.Bytes); err != nil {
panic(err)
return false
}
up.LocalHashes[f.Path] = hex.EncodeToString(sha.Sum(nil))
}
// check if there is any file to update
update := false
for k := range up.LocalHashes {
if !up.EqualHash(k) {
up.ToUpdate = append(up.ToUpd... | |
c20327 | >= total {
break
}
termui.Render(upp.ui...)
}
}(up, &doneTotal)
for i := 0; i < up.Workers; i++ {
// creates a progress bar
g := termui.NewGauge()
g.Width = termui.TermWidth()
g.Height = height
g.BarColor = termui.ColorBlue
g.Y = len(up.ui) * height
up.ui = append(up.ui, g)
go up.worke... | |
c20328 | = filesTemplate
} else if name == "file" {
t.template = fileTemplate
}
return nil
} | |
c20329 |
err = tmpl.Execute(buff, t.Variables)
if err != nil {
return nil, err
}
return buff.Bytes(), nil
} | |
c20330 | !strings.HasPrefix(cfg.Output, "a") {
cfg.Output = "a" + cfg.Output
}
// default package
if cfg.Pkg == "" {
cfg.Pkg = "main"
}
if cfg.Compression == nil {
cfg.Compression = &compression.Options{
Compress: false,
Method: "DefaultCompression",
Keep: false,
}
}
return nil
} | |
c20331 | json.Unmarshal(f.Data, to)
case "yaml", "yml":
return to, yaml.Unmarshal(f.Data, to)
case "toml":
return to, toml.Unmarshal(f.Data, to)
default:
return nil, fmt.Errorf("unknown mode '%s'", f.Mode)
}
} | |
c20332 | remove inline comments
f.Data = []byte(regexComments.ReplaceAllString(string(f.Data), ""))
}
} | |
c20333 |
gz.Options = new(Options)
return gz
} | |
c20334 | if err != nil {
return nil, err
}
// insert content
_, err = w.Write(content)
if err != nil {
return nil, err
}
err = w.Close()
if err != nil {
return nil, err
}
// compressed content
return b.Bytes(), nil
} | |
c20335 | filepath.Abs(filepath.Dir(os.Args[0]))
return d, err
} | |
c20336 | weekEndsAt: time.Sunday,
weekendDays: wds,
stringFormat: DefaultFormat,
Translator: translator(),
}
} | |
c20337 |
c <- currentFrozenTime
return c
}
return time.After(d)
} | |
c20338 | = currentFrozenTime.Add(d)
return
}
time.Sleep(d)
} | |
c20339 | return NewCarbon(time.Date(y, mon, d, h, m, s, ns, l))
} | |
c20340 | != nil {
return nil, err
}
return create(y, mon, d, h, m, s, ns, l), nil
} | |
c20341 |
return Create(y, mon, d, h, m, s, ns, location)
} | |
c20342 | if err != nil {
return nil, err
}
t, err := time.ParseInLocation(layout, value, l)
if err != nil {
return nil, err
}
return NewCarbon(t), nil
} | |
c20343 | if err != nil {
return nil, err
}
t := NewCarbon(Now().In(l))
t.SetTimestamp(timestamp)
return t, nil
} | |
c20344 | _, _, d := Now().Date()
h, m, s := Now().Clock()
ns := Now().Nanosecond()
return Create(y, mon, d, h, m, s, ns, location)
} | |
c20345 | nil, err
}
return NewCarbon(Now().In(l)), err
} | |
c20346 | return nil, err
}
return c.AddDay(), nil
} | |
c20347 | return nil, err
}
return c.SubDay(), nil
} | |
c20348 | c.Second(), c.Nanosecond(), c.Location())
} | |
c20349 |
case month >= 7 && month < 10:
return 3
}
return 4
} | |
c20350 | daysPerWeek))
return int(w + 1)
} | |
c20351 | NewCarbon(c.AddDate(y, 0, 0))
} | |
c20352 | {
return NewCarbon(c.AddDate(0, monthsPerQuarter*q, 0))
} | |
c20353 | {
return NewCarbon(c.AddDate(yearsPerCenturies*cent, 0, 0))
} | |
c20354 | NewCarbon(c.AddDate(0, m, 0))
} | |
c20355 | * time.Second
return NewCarbon(c.Add(d))
} | |
c20356 | {
return NewCarbon(c.AddDate(0, 0, d))
} | |
c20357 | = t.AddDays(d)
if t.IsWeekday() {
wd--
}
}
return t
} | |
c20358 | {
return NewCarbon(c.AddDate(0, 0, daysPerWeek*w))
} | |
c20359 | time.Hour
return NewCarbon(c.Add(d))
} | |
c20360 | return addedDate.PreviousMonthLastDay()
}
return addedDate
} | |
c20361 | * time.Minute
return NewCarbon(c.Add(d))
} | |
c20362 | c.Second(), c.Nanosecond(), c.Location())
} | |
c20363 | m, c.Day(), c.Hour(), c.Minute(), c.Second(), c.Nanosecond(), c.Location())
} | |
c20364 | c.Second(), c.Nanosecond(), c.Location())
} | |
c20365 | c.Second(), c.Nanosecond(), c.Location())
} | |
c20366 | c.Second(), c.Nanosecond(), c.Location())
} | |
c20367 | c.Month(), c.Day(), c.Hour(), c.Minute(), s, c.Nanosecond(), c.Location())
} | |
c20368 | c.Hour(), c.Minute(), c.Second(), c.Nanosecond(), c.Location())
} | |
c20369 | d, h, m, s, c.Nanosecond(), c.Location())
} | |
c20370 | time.Unix(sec, 0).In(c.Location())
} | |
c20371 | c.Time = time.Date(c.Year(), c.Month(), c.Day(), c.Hour(), c.Minute(), c.Second(), c.Nanosecond(), loc)
return nil
} | |
c20372 | d == wd {
return true
}
}
return false
} | |
c20373 | Now().SubDay()
return c.IsSameDay(n)
} | |
c20374 | Now().AddDay()
return c.IsSameDay(n)
} | |
c20375 | y%400 == 0 {
return true
}
return false
} | |
c20376 | := carb.WeekOfYear()
return w == weeksPerLongYear
} | |
c20377 | }
return c.Format(DefaultFormat) == carb.Format(DefaultFormat)
} | |
c20378 | nil {
return c.Year() == nowIn(c.Location()).Year()
}
return c.Year() == carb.Year()
} | |
c20379 | return c.IsSameYear(carb) && c.Month() == m
}
return c.Month() == m
} | |
c20380 | carb != nil {
n = carb
}
return c.Year() == n.Year() && c.Month() == n.Month() && c.Day() == n.Day()
} | |
c20381 | := Now().Sub(c.Time)
if difference.Seconds() > 0 && difference.Seconds() < secondsInWeek {
return true
}
return false
} | |
c20382 | }
if now.UnixNano() > c.UnixNano() && monthDifference == 1 {
return true
}
return false
} | |
c20383 | c.Equal(carb.Time)
} | |
c20384 | c.DiffInSeconds(b, true) {
return a
}
return b
} | |
c20385 | c.DiffInSeconds(a, true) > c.DiffInSeconds(b, true) {
return a
}
return b
} | |
c20386 |
if c.Lt(carb) {
return c
}
return carb
} | |
c20387 |
if c.Gt(carb) {
return c
}
return carb
} | |
c20388 | end = aux
}
yearsAmmount := int64(end.Year()-start.Year()) - 1
start.SetYear(end.Year())
if start.UnixNano() <= end.UnixNano() {
yearsAmmount++
}
return absValue(abs, yearsAmmount)
} | |
c20389 | cAux = NewCarbon(cAux.In(time.UTC))
carbAux = NewCarbon(carbAux.In(time.UTC))
}
return calculateDiffInMonths(cAux, carbAux, abs)
} | |
c20390 |
return strings.Replace(carb.Sub(c.Time).String(), "-", "", 1)
} | |
c20391 |
}
return c.DiffInDays(carb, abs) / daysPerWeek
} | |
c20392 |
}
return c.DiffInHours(carb, abs) / hoursPerDay
} | |
c20393 | carb = nowIn(c.Location())
}
return c.DiffInDays(carb, abs)
} | |
c20394 |
return c.DiffFiltered(dayDuration, f, carb, abs)
} | |
c20395 | *Carbon, abs bool) int64 {
return c.DiffFiltered(time.Hour, f, carb, abs)
} | |
c20396 | }
return c.DiffFiltered(dayDuration, f, carb, abs)
} | |
c20397 |
}
return c.DiffFiltered(dayDuration, f, carb, abs)
} | |
c20398 | = swap(start, end)
inverse = true
}
for start.DiffInSeconds(end, true)/s > 0 {
if f(end) {
counter++
}
end = NewCarbon(end.Add(-duration))
}
if inverse {
counter = -counter
}
return absValue(abs, counter)
} | |
c20399 | return c.DiffInMinutes(d, abs) / minutesPerHour
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.