id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c13700
string set := []string{p(-1)} for { next := p(-1) if next == set[0] { break } set = append(set, next) } return set }
c13701
*c = make(map[string]interface{}) } (*c)[key] = value }
c13702
keys = append(keys, key) } return }
c13703
return s.multiPrompt } return s.prompt } return "" }
c13704
:= 0; i < l-his.maxHist; i++ { his.list.Remove(his.list.Back()) } } } return his.list.Len() }
c13705
return his.list.Remove(his.list.Front()).(*State) } return nil }
c13706
return his.list.Front().Value.(*State) }
c13707
ok := b.bookmarks[name] return ok }
c13708
defer func() { err = fout.Close() }() _, err = fout.Write(j) if err != nil { return err } return err }
c13709
return DownloadAsset(at, out) }
c13710
{ DownloadAssetAsync(at, out, ch) }
c13711
return 0, err } defer resp.Body.Close() return io.Copy(out, resp.Body) }
c13712
out) if err != nil { results.Error = err } else { results.Size = size } c <- results }() }
c13713
return Error{ error: errors.New(msg), } }
c13714
msg = fmt.Sprintf("Not Found: "+msg, a...) return PageNotFound{ error: errors.New(msg), } }
c13715
msg = fmt.Sprintf("Link Not Found: "+msg, a...) return LinkNotFound{ error: errors.New(msg), } }
c13716
{ msg = fmt.Sprintf(msg, a...) return AttributeNotFound{ error: errors.New(msg), } }
c13717
{ msg = fmt.Sprintf(msg, a...) return Location{ error: errors.New(msg), } }
c13718
msg = fmt.Sprintf("Page Not Loaded: "+msg, a...) return PageNotLoaded{ error: errors.New(msg), } }
c13719
{ msg = fmt.Sprintf(msg, a...) return ElementNotFound{ error: errors.New(msg), } }
c13720
{ msg = fmt.Sprintf(msg, a...) return InvalidFormValue{ error: errors.New(msg), } }
c13721
} return errors.NewElementNotFound("No input found with name '%s'.", name) }
c13722
f.files[name] = &File{fileName: fileName, data: data} return nil } return errors.NewElementNotFound( "No input type 'file' found with name '%s'.", name) }
c13723
f.files[name] = &File{fileName: fileName, data: data} }
c13724
errors.NewElementNotFound("No checkbox found with name '%s'.", name) }
c13725
} return errors.NewElementNotFound("No checkbox found with name '%s'.", name) }
c13726
_, found := f.fields[name] return found, nil } return false, errors.NewElementNotFound("No checkbox found with name '%s'.", name) }
c13727
return "", errors.NewElementNotFound("No input found with name '%s'.", name) }
c13728
if v != val { save = append(save, v) } } if len(save) == 0 { f.fields.Del(name) } else { f.fields[name] = save } return nil }
c13729
select element with name '%s' is not a select miltiple.", name) } f.fields.Del(name) for _, l := range optionLabel { if _, ok := s.labels[l]; !ok { return errors.NewElementNotFound("The select element with name %q does not have an option with label %q", name, l) } f.fields.Add(name, s.labels.Get(l)) } re...
c13730
return errors.NewElementNotFound("The select element with name '%s' is not a select miltiple.", name) } f.fields.Del(name) for _, v := range optionValue { if _, ok := s.values[v]; !ok { return errors.NewElementNotFound("The select element with name %q does not have an option with value %q", name, v) } f.f...
c13731
return nil, errors.NewElementNotFound("No input found with name '%s'.", name) }
c13732
element found with name '%s'.", name) } var labels []string for _, v := range f.fields[name] { labels = append(labels, s.values.Get(v)) } return labels, nil }
c13733
return errors.NewInvalidFormValue( "Form does not contain a button with the name '%s' and value '%s'.", name, value) } return f.send(name, value) }
c13734
return err } return bow.httpGET(ur, nil) }
c13735
return err } return bow.httpHEAD(ur, nil) }
c13736
return err } ul.RawQuery = data.Encode() return bow.Open(ul.String()) }
c13737
ur, err := url.Parse(u) if err != nil { return err } return bow.httpPOST(ur, bow.Url(), contentType, body) }
c13738
return bow.Post(u, "application/x-www-form-urlencoded", strings.NewReader(data.Encode())) }
c13739
> 1 { bow.state = bow.history.Pop() return true } return false }
c13740
errors.NewPageNotLoaded("Cannot reload, the previous request failed.") }
c13741
return bow.bookmarks.Save(name, bow.ResolveUrl(bow.Url()).String()) }
c13742
match an anchor tag.", expr) } href, err := bow.attrToResolvedUrl("href", sel) if err != nil { return err } return bow.httpGET(href, bow.Url()) }
c13743
return nil, errors.NewElementNotFound( "Expr '%s' does not match a form tag.", expr) } return NewForm(bow, sel), nil }
c13744
return nil } forms := make([]Submittable, len) sel.Each(func(_ int, s *goquery.Selection) { forms = append(forms, NewForm(bow, s)) }) return forms }
c13745
links = append(links, NewLinkAsset( href, bow.attrOrDefault("id", "", s), s.Text(), )) } }) return links }
c13746
src, bow.attrOrDefault("id", "", s), bow.attrOrDefault("alt", "", s), bow.attrOrDefault("title", "", s), )) } }) return images }
c13747
bow.attrOrDefault("id", "", s), bow.attrOrDefault("media", "all", s), bow.attrOrDefault("type", "text/css", s), )) } } }) return stylesheets }
c13748
append(scripts, NewScriptAsset( src, bow.attrOrDefault("id", "", s), bow.attrOrDefault("type", "text/javascript", s), )) } }) return scripts }
c13749
== nil { bow.client = bow.buildClient() } return bow.client.Jar.Cookies(bow.Url()) }
c13750
bow.buildClient() } bow.client.Jar = cj }
c13751
bow.attributes[a] = v }
c13752
== nil { bow.client = bow.buildClient() } bow.client.Timeout = t }
c13753
bow.client == nil { bow.client = bow.buildClient() } bow.client.Transport = rt }
c13754
bow.headers.Set(name, value) }
c13755
bow.Url().ResolveReference(u) }
c13756
if err != nil { return "", err } pu = bow.Url().ResolveReference(pu) return pu.String(), nil }
c13757
:= bytes.NewBuffer(bow.body) return io.Copy(o, buff) }
c13758
return bow.state.Request.URL } return nil } return bow.state.Response.Request.URL }
c13759
bow.state.Dom.Find("body").Html() return body }
c13760
*goquery.Selection { return bow.state.Dom.Find(expr) }
c13761
bow.buildRequest("GET", u.String(), ref, nil) if err != nil { return err } return bow.httpRequest(req) }
c13762
nil { return err } req.Header.Set("Content-Type", contentType) return bow.httpRequest(req) }
c13763
{ attr, ok := sel.Attr("content") if ok { dur, err := time.ParseDuration(attr + "s") if err == nil { bow.refresh = time.NewTimer(dur) go func() { <-bow.refresh.C bow.Reload() }() } } } } }
c13764
} return errors.NewLocation( "Redirects are disabled. Cannot follow '%s'.", req.URL.String()) }
c13765
err := url.Parse(src) if err != nil { return nil, err } return bow.ResolveUrl(ur), nil }
c13766
ok := sel.Attr(name) if ok { return a } return def }
c13767
if padding < 0 { padding = 0 } padtext := bytes.Repeat([]byte{byte(padding)}, padding) return append(ciphertext, padtext...) }
c13768
if length-unpadding < 0 { return nil } return plaintext[:(length - unpadding)] }
c13769
std.Errorf(level, format, args...) }
c13770
map[string]interface{}) { std.ErrorWithExtras(level, err, extras) }
c13771
std.ErrorWithExtrasAndContext(ctx, level, err, extras) }
c13772
std.RequestError(level, r, err) }
c13773
std.RequestErrorWithExtras(level, r, err, extras) }
c13774
{ std.RequestErrorWithExtrasAndContext(ctx, level, r, err, extras) }
c13775
std.ErrorWithStackSkip(level, err, skip) }
c13776
std.ErrorWithStackSkipWithExtras(level, err, skip, extras) }
c13777
{ std.ErrorWithStackSkipWithExtrasAndContext(ctx, level, err, skip, extras) }
c13778
{ std.RequestErrorWithStackSkip(level, r, err, skip) }
c13779
{ std.RequestErrorWithStackSkipWithExtras(level, r, err, skip, extras) }
c13780
err error, skip int, extras map[string]interface{}) { std.RequestErrorWithStackSkipWithExtrasAndContext(ctx, level, r, err, skip, extras) }
c13781
map[string]interface{}) { std.MessageWithExtras(level, msg, extras) }
c13782
std.MessageWithExtrasAndContext(ctx, level, msg, extras) }
c13783
std.RequestMessage(level, r, msg) }
c13784
std.RequestMessageWithExtras(level, r, msg, extras) }
c13785
{ std.RequestMessageWithExtrasAndContext(ctx, level, r, msg, extras) }
c13786
!= "" { ips := strings.Split(forwardedIPs, ", ") return ips[0] } return req.RemoteAddr }
c13787
case pattern.Match([]byte(k)): result[k] = FILTERED case special || len(v) == 1: result[k] = v[0] default: result[k] = v } } return result }
c13788
result[k] = v[0] } else { result[k] = v } } return result }
c13789
= parts[0:3] parts = append(parts, "0000:0000:0000:0000:0000") return strings.Join(parts, ":") } return ip } return ip case CaptureIpNone: return "" default: return "" } }
c13790
if configuration.fingerprint { fingerprint = fingerprint + stack.Fingerprint() } parent = err err = getCause(err) if err == nil { break } } errBody := map[string]interface{}{"trace_chain": traceChain} return errBody, fingerprint }
c13791
"frames": stack, "exception": map[string]interface{}{ "class": errorClass(err), "message": message, }, } }
c13792
if _, ok := parent.(CauseStacker); !ok { return getCallersFrames(1 + skip) } return nil }
c13793
token, Endpoint: endpoint, RetryAttempts: DefaultRetryAttempts, PrintPayloadOnError: true, } }
c13794
t.doSend(body, t.RetryAttempts) }
c13795
return NewAsync(token, environment, codeVersion, serverHost, serverRoot) }
c13796
environment, codeVersion, serverHost, serverRoot) transport := NewTransport(token, configuration.endpoint) return &Client{ Transport: transport, configuration: configuration, } }
c13797
environment, codeVersion, serverHost, serverRoot) transport := NewSyncTransport(token, configuration.endpoint) return &Client{ Transport: transport, configuration: configuration, } }
c13798
c.Transport.SetToken(token) }
c13799
c.configuration.endpoint = endpoint c.Transport.SetEndpoint(endpoint) }