id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c27200 | just saved for querying
rwt.ImmutableTree, err = rwt.tree.GetImmutable(version)
if err != nil {
return nil, 0, fmt.Errorf("RWTree.Save() could not obtain ImmutableTree read tree: %v", err)
}
rwt.updated = false
return hash, version, nil
} | |
c27201 | 32 {
panic("Invalid bytes size: expected 32")
}
st.Push(LeftPadWord256(bz))
} | |
c27202 | LeftPadWord256(U256(bigInt).Bytes())
st.Push(word)
return word
} | |
c27203 | return Zero256
}
return st.slice[st.ptr-1]
} | |
c27204 | for _, option := range options {
option(cache)
}
return cache
} | |
c27205 | early exit
cache.RLock()
for _, info := range cache.accounts {
if consumer(info.account) {
cache.RUnlock()
return true, nil
}
}
cache.RUnlock()
return false, nil
} | |
c27206 | exit
for key, value := range accInfo.storage {
if err := consumer(key, value); err != nil {
accInfo.RUnlock()
return err
}
}
accInfo.RUnlock()
return err
} | |
c27207 |
}
// Sort keys
var keys binary.Words256
for key := range accInfo.storage {
keys = append(keys, key)
}
sort.Sort(keys)
// Update account's storage
for _, key := range keys {
value := accInfo.storage[key]
err := st.SetStorage(address, key, value)
if err != nil {
return err
... | |
c27208 | length; i++ {
matched := findMatchInLogLine(keyvals, keyRegexes[i], valueRegexes[i])
if matchAll {
all = all && matched
} else if matched {
return true
}
}
return all
} | |
c27209 |
genesisDoc.GenesisTime = genesisDoc.GenesisTime.UTC()
return json.MarshalIndent(genesisDoc, "", "\t")
} | |
c27210 | Address: genesisAccount.Address,
Amount: genesisAccount.Amount,
},
Name: genesisAccount.Name,
Permissions: genesisAccount.Permissions.Clone(),
}
} | |
c27211 | PublicKey: gv.PublicKey,
Amount: gv.Amount,
},
Name: gv.Name,
UnbondTo: unbondToClone,
NodeAddress: gv.NodeAddress,
}
} | |
c27212 | BasicAccount{
Address: *val.Address,
PublicKey: val.PublicKey,
Amount: val.Power,
},
// Simpler to just do this by convention
UnbondTo: []BasicAccount{
{
Amount: val.Power,
Address: *val.Address,
},
},
})
}
return &GenesisDoc{
ChainName: chainName,
Salt: ... | |
c27213 | pushes := op.Pushes()
tokens = append(tokens, op.Name())
if pushes > 0 {
// This is a PUSH<N> OpCode so consume N bytes from the input, render them as hex, and skip to next OpCode
if i+pushes >= len(bc) {
return tokens, fmt.Errorf("token %v of input is %s but not enough input remains to push %v: %s",
... | |
c27214 | qb.and(stringIterator(queries...))
return qb
} | |
c27215 | {
return NewBuilder(qb.and(queryBuilderIterator(queryBuilders...)))
} | |
c27216 |
qb.condition.Op = equalString
qb.condition.Operand = operandString(operand)
return NewBuilder(qb.and(stringIterator(qb.conditionString())))
} | |
c27217 | for _, s := range strs {
callback(s)
}
}
} | |
c27218 | opt := range options {
opt(p)
}
return p
} | |
c27219 | after heredoc word so no newline to
// trigger it
p.doHeredocs()
}
return p.f, p.err
} | |
c27220 | p.next()
p.stmts(fn)
if p.err == nil {
// EOF immediately after heredoc word so no newline to
// trigger it
p.doHeredocs()
}
return p.err
} | |
c27221 | if p.tok != _EOF {
p.curErr("%s is not a valid word", p.tok)
}
return p.err
}
if !fn(w) {
return nil
}
}
} | |
c27222 |
p.quote = hdocBody
p.hdocStop = []byte("MVDAN_CC_SH_SYNTAX_EOF")
p.parsingDoc = true
p.next()
w := p.getWord()
return w, p.err
} | |
c27223 | constructing a literal, we need to finish it.
return p.quote != noState || p.openStmts > 0 || p.litBs != nil
} | |
c27224 | return ok && perr.Incomplete
} | |
c27225 | case r == '_':
case i > 0 && '0' <= r && r <= '9':
default:
return false
}
}
return true
} | |
c27226 | {
return v.List[0]
}
case Associative:
// nothing to do
}
return ""
} | |
c27227 |
name = v.Str // keep name for the next iteration
v = env.Get(name)
}
return name, Variable{}
} | |
c27228 | list[i]
sep := strings.IndexByte(s, '=')
if sep <= 0 {
// invalid element; remove it
list = append(list[:i], list[i+1:]...)
continue
}
name := s[:sep]
if last == name {
// duplicate; the last one wins
list = append(list[:i-1], list[i:]...)
continue
}
last = name
i++
}
return listEnv... | |
c27229 | in group (g)
if perm&0010 != 0 && st.Uid != uint32(uid) && st.Gid == uint32(gid) {
return true
}
// remaining users (o)
if perm&0001 != 0 && st.Uid != uint32(uid) && st.Gid != uint32(gid) {
return true
}
return false
} | |
c27230 | not open: %v", err)
}
defer f.Close()
file, err := syntax.NewParser().Parse(f, path)
if err != nil {
return nil, fmt.Errorf("could not parse: %v", err)
}
return SourceNode(ctx, file)
} | |
c27231 | }
}
if r.Exec == nil {
Module(ModuleExec(nil))(r)
}
if r.Open == nil {
Module(ModuleOpen(nil))(r)
}
if r.Stdout == nil || r.Stderr == nil {
StdIO(r.Stdin, r.Stdout, r.Stderr)(r)
}
return r, nil
} | |
c27232 |
env = expand.ListEnviron(os.Environ()...)
}
r.Env = env
return nil
}
} | |
c27233 | os.Stat(path)
if err != nil {
return fmt.Errorf("could not stat: %v", err)
}
if !info.IsDir() {
return fmt.Errorf("%s is not a directory", path)
}
r.Dir = path
return nil
}
} | |
c27234 | DefaultOpen
}
r.Open = mod
default:
return fmt.Errorf("unknown module type: %T", mod)
}
return nil
}
} | |
c27235 |
r.Stdout = out
if err == nil {
err = ioutil.Discard
}
r.Stderr = err
return nil
}
} | |
c27236 | quoteNone)
if err != nil {
return "", err
}
return cfg.fieldJoin(field), nil
} | |
c27237 | quoteDouble)
if err != nil {
return "", err
}
return cfg.fieldJoin(field), nil
} | |
c27238 | field {
if part.quote > quoteNone {
buf.WriteString(syntax.QuotePattern(part.val))
} else {
buf.WriteString(part.val)
}
}
return buf.String(), nil
} | |
c27239 | wfields, err := cfg.wordFields(word2.Parts)
if err != nil {
return nil, err
}
for _, field := range wfields {
path, doGlob := cfg.escapedGlobField(field)
var matches []string
if doGlob && cfg.ReadDir != nil {
matches, err = cfg.glob(dir, path)
if err != nil {
return nil, err
... | |
c27240 | return elem1 + elem2
}
return elem1 + string(filepath.Separator) + elem2
} | |
c27241 | strings.Split(path, string(filepath.Separator))
} | |
c27242 | different extension
case info.Size() < int64(len("#/bin/sh\n")):
return ConfNotScript // cannot possibly hold valid shebang
default:
return ConfIfShebang
}
} | |
c27243 | strconv.Atoi(s)
return n
} | |
c27244 | {
words = append(words, w)
return true
})
if err != nil {
return nil, err
}
if env == nil {
env = os.Getenv
}
cfg := &expand.Config{Env: expand.FuncEnviron(env)}
return expand.Fields(cfg, words...)
} | |
c27245 |
p.cols.Writer = p.bufWriter.(*bufio.Writer)
p.bufWriter = &p.cols
} | |
c27246 | new(tabwriter.Writer),
}
for _, opt := range options {
opt(p)
}
return p
} | |
c27247 | ok := ctx.Value(moduleCtxKey{}).(ModuleCtx)
return mc, ok
} | |
c27248 |
p.print(reflect.ValueOf(node))
return p.err
} | |
c27249 | don't want to overwrite p.tok
if err != io.EOF {
p.err = err
}
if left > 0 {
p.bs = p.readBuf[:left]
} else {
p.bs = nil
}
} else {
p.bs = p.readBuf[:left+n]
}
p.bsp = 0
} | |
c27250 | self.files = append(self.files, file)
self.last = file
return base
} | |
c27251 | self.defineProperty("prototype", toValue_object(prototype), 0100, false)
prototype.defineProperty("constructor", toValue_object(self), 0100, false)
return self
} | |
c27252 | script := &Script{
version: scriptVersion,
program: cmpl_program,
filename: filename,
src: program.File.Source(),
}
return script, nil
} | |
c27253 | err
}
err = encoder.Encode(self.filename)
if err != nil {
return nil, err
}
err = encoder.Encode(self.src)
if err != nil {
return nil, err
}
return bfr.Bytes(), nil
} | |
c27254 |
}
err = decoder.Decode(&self.src)
if err != nil {
goto error
}
return nil
error:
self.version = ""
self.program = nil
self.filename = ""
self.src = ""
return err
} | |
c27255 |
value := of._object().prototype
for value != nil {
if value == prototypeObject {
return true
}
value = value.prototype
}
return false
} | |
c27256 | valueOfArrayIndex(self.ArgumentList, index)
} | |
c27257 | < 0 {
index += length
if index < 0 {
index = 0
}
} else {
if index > length {
index = length
}
}
return index
} | |
c27258 | %s",
filename,
self.Position.Line,
self.Position.Column,
self.Message,
)
} | |
c27259 | *self = append(*self, &Error{position, msg})
} | |
c27260 | self.objectClass.getOwnProperty(self, name)
} | |
c27261 | hint == defaultValueHintString {
methodSequence = []string{"toString", "valueOf"}
}
for _, methodName := range methodSequence {
method := self.get(methodName)
// FIXME This is redundant...
if method.isCallable() {
result := method._object().call(toValue_object(self), nil, false, nativeFrame)
if result.... | |
c27262 | ", file, line)
lines := strings.Split(s, "\n")
if l := len(lines); l > 1 && lines[l-1] == "" {
lines = lines[:l-1]
}
for i, line := range lines {
if i > 0 {
// Second and subsequent lines are indented an extra tab.
buf.WriteString("\n\t\t")
}
buf.WriteString(line)
}
buf.WriteByte('\n')
return buf.... | |
c27263 | }
return &Call{
scope: scope,
entry: entry,
}
} | |
c27264 | cl.scope.log(cl.entry, fmt.Sprintln(arguments...))
} | |
c27265 | cl.scope.log(cl.entry, fmt.Sprintf(format, arguments...))
} | |
c27266 | fmt.Sprintln(arguments...))
cl.scope.t.Fail()
} | |
c27267 | {
cl.scope.log(cl.entry, fmt.Sprintf(format, arguments...))
cl.scope.t.Fail()
} | |
c27268 | cl.scope.log(cl.entry, fmt.Sprintln(arguments...))
cl.scope.t.SkipNow()
} | |
c27269 | {
cl.scope.log(cl.entry, fmt.Sprintf(format, arguments...))
cl.scope.t.SkipNow()
} | |
c27270 | return value.value.(*_object).class == "Function"
} | |
c27271 | ""
catchPanic(func() {
result = value.string()
})
return result
} | |
c27272 |
return _newObject(object, value)
}
return nil
} | |
c27273 | // consumer to define an equivalent function that _does_ panic if desired.
_ = RunWithPrompt(vm, fmt.Sprintf("DEBUGGER[%d]> ", i))
} | |
c27274 | RunWithOptions(vm, Options{
Prompt: prompt,
})
} | |
c27275 | RunWithOptions(vm, Options{
Prelude: prelude,
})
} | |
c27276 | RunWithOptions(vm, Options{
Prompt: prompt,
Prelude: prelude,
})
} | |
c27277 | err
}
if l == "" {
continue
}
d = append(d, l)
s, err := vm.Compile("repl", strings.Join(d, "\n"))
if err != nil {
rl.SetPrompt(strings.Repeat(" ", len(prompt)))
} else {
rl.SetPrompt(prompt)
d = nil
v, err := vm.Eval(s)
if err != nil {
if oerr, ok := err.(*otto.Error); ok {
... | |
c27278 | '\u2028', '\u2029':
return false
case '\u0085':
return false
}
return unicode.IsSpace(chr)
} | |
c27279 | self.error(self.chrOffset, "Invalid UTF-8 character")
}
}
self.offset += width
self.chr = chr
} else {
self.chrOffset = self.length
self.chr = -1 // EOF
}
} | |
c27280 | self._read(name)
if !exists {
return nil
}
return &property
} | |
c27281 | {
return nil, err
}
return program.Body[0].(*ast.ExpressionStatement).Expression.(*ast.FunctionLiteral), nil
} | |
c27282 |
case SHIFT_LEFT, SHIFT_RIGHT, UNSIGNED_SHIFT_RIGHT:
fallthrough
case SHIFT_LEFT_ASSIGN, SHIFT_RIGHT_ASSIGN, UNSIGNED_SHIFT_RIGHT_ASSIGN:
return 8
case PLUS, MINUS, ADD_ASSIGN, SUBTRACT_ASSIGN:
return 9
case MULTIPLY, SLASH, REMAINDER, MULTIPLY_ASSIGN, QUOTIENT_ASSIGN, REMAINDER_ASSIGN:
return 11
}
retu... | |
c27283 | &Comment{
Begin: idx,
Text: text,
Position: TBD,
}
return comment
} | |
c27284 | return "If"
case WHILE:
return "While"
case DO:
return "Do"
case FOR:
return "For"
case WITH:
return "With"
default:
return "???"
}
} | |
c27285 | = nil
}()
return append(c.Comments, c.future...)
} | |
c27286 | == nil && !c.afterBlock) {
c.Comments = append(c.Comments, comment)
} else {
c.future = append(c.future, comment)
}
}
} | |
c27287 | c := range c.future {
if c.Position == TBD {
c.Position = position
}
}
} | |
c27288 |
c.wasLineBreak = false
c.primary = false
c.afterBlock = false
} | |
c27289 | c.Current = node
// Apply the found comments and futures to the node and the previous.
c.applyComments(node, previous, TRAILING)
} | |
c27290 | Node) {
c.applyComments(node, nil, TRAILING)
} | |
c27291 |
c.Comments = nil
}
// Only apply the future comments to the node if the previous is set.
// This is for detecting end of line comments and which node comments on the following lines belongs to
if previous != nil {
c.CommentMap.AddComments(node, c.future, position)
c.future = nil
}
} | |
c27292 | {
list := cm[node]
list = append(list, comment)
cm[node] = list
} | |
c27293 | for _, comment := range comments {
if comment.Position == TBD {
comment.Position = position
}
cm.AddComment(node, comment)
}
} | |
c27294 | += len(comments)
}
return size
} | |
c27295 |
cm[from][i] = cm[from][len(cm[from])-1]
cm[from][len(cm[from])-1] = nil
cm[from] = cm[from][:len(cm[from])-1]
}
}
} | |
c27296 | = 10
self.Set("console", self.runtime.newConsole())
registry.Apply(func(entry registry.Entry) {
self.Run(entry.Source())
})
return self
} | |
c27297 | err := self.runtime.cmpl_eval(src, nil)
if !value.safe() {
value = Value{}
}
return value, err
} | |
c27298 | self.runtime.toValue(self.runtime.newError(name, self.runtime.toValue(message), 0))
} | |
c27299 | self.runtime.toValue(self.runtime.newRangeError(self.runtime.toValue(message)))
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.