id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
12,700
all-12701
[ "Split", "splits", "a", "string", "according", "to", "posix", "or", "non", "-", "posix", "rules", "." ]
[ "func", "Split", "(", "s", "string", ",", "posix", "bool", ")", "(", "[", "]", "string", ",", "error", ")", "{", "return", "NewLexerString", "(", "s", ",", "posix", ",", "<mask>", ")", ".", "Split", "(", ")", "\n", "}" ]
12,701
all-12702
[ "MustId", "retrieves", "the", "Id", "value", "from", "the", "union", "panicing", "if", "the", "value", "is", "not", "set", "." ]
[ "func", "(", "u", "Memo", ")", "MustId", "(", ")", "Uint64", "{", "val", ",", "<mask>", ":=", "u", ".", "GetId", "(", ")", "\n\n", "if", "!", "ok", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "val", "\n", "}" ]
12,702
all-12703
[ "ParseReference", "converts", "a", "string", "which", "should", "not", "start", "with", "the", "ImageTransport", ".", "Name", "prefix", "into", "an", "ImageReference", "." ]
[ "func", "(", "t", "dockerTransport", ")", "ParseReference", "(", "reference", "string", ")", "(", "<mask>", ".", "ImageReference", ",", "error", ")", "{", "return", "ParseReference", "(", "reference", ")", "\n", "}" ]
12,703
all-12704
[ "Write", "writes", "the", "given", "bytes", "to", "the", "underlying", "writer", "." ]
[ "func", "(", "w", "ArgWriteHelper", ")", "Write", "(", "bs", "[", "]", "byte", ")", "error", "{", "return", "w", ".", "<mask>", "(", "func", "(", ")", "error", "{", "_", ",", "err", ":=", "w", ".", "writer", ".", "Write", "(", "bs", ")", "\n", "return", "err", "\n", "}", ")", "\n", "}" ]
12,704
all-12705
[ "Snapshot", "creates", "an", "image", "from", "a", "graph", "and", "returns", "the", "URL", "of", "the", "image", "." ]
[ "func", "(", "client", "*", "Client", ")", "Snapshot", "(", "query", "string", ",", "start", ",", "end", "time", ".", "Time", ",", "eventQuery", "string", ")", "(", "string", ",", "error", ")", "{", "options", ":=", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "query", ",", "\"", "\"", ":", "eventQuery", "}", "\n\n", "return", "client", ".", "SnapshotGeneric", "(", "options", ",", "start", ",", "<mask>", ")", "\n", "}" ]
12,705
all-12706
[ "FormatResponse", "nicely", "formats", "a", "response", "to", "a", "generic", "reason", "." ]
[ "func", "FormatResponse", "(", "to", ",", "<mask>", ",", "reason", "string", ")", "string", "{", "format", ":=", "`@%s: %s\n\n<details>\n\n%s\n\n%s\n</details>`", "\n\n", "return", "fmt", ".", "Sprintf", "(", "format", ",", "to", ",", "message", ",", "reason", ",", "AboutThisBotWithoutCommands", ")", "\n", "}" ]
12,706
all-12707
[ "GetMockServer", "returns", "a", "mock", "websocket", "server", "that", "can", "be", "started", "up", "as", "TLS", "or", "not", ".", "TODO", "replace", "with", "gomock" ]
[ "func", "GetMockServer", "(", "closeWS", "<-", "chan", "[", "]", "byte", ")", "(", "*", "httptest", ".", "Server", ",", "chan", "<-", "string", ",", "<-", "chan", "string", ",", "<-", "chan", "error", ",", "error", ")", "{", "serverChan", ":=", "make", "(", "chan", "string", ")", "\n", "requestsChan", ":=", "make", "(", "chan", "string", ")", "\n", "errChan", ":=", "make", "(", "chan", "error", ")", "\n", "stopListen", ":=", "make", "(", "chan", "bool", ")", "\n\n", "upgrader", ":=", "websocket", ".", "Upgrader", "{", "ReadBufferSize", ":", "1024", ",", "WriteBufferSize", ":", "1024", "}", "\n", "handler", ":=", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "ws", ",", "err", ":=", "upgrader", ".", "Upgrade", "(", "w", ",", "r", ",", "nil", ")", "\n", "go", "func", "(", ")", "{", "ws", ".", "WriteControl", "(", "websocket", ".", "CloseMessage", ",", "<-", "closeWS", ",", "time", ".", "Now", "(", ")", ".", "Add", "(", "time", ".", "Second", ")", ")", "\n", "close", "(", "stopListen", ")", "\n", "}", "(", ")", "\n", "if", "err", "!=", "nil", "{", "errChan", "<-", "err", "\n", "}", "\n", "go", "func", "(", ")", "{", "for", "{", "<mask>", "{", "case", "<-", "stopListen", ":", "return", "\n", "default", ":", "_", ",", "msg", ",", "err", ":=", "ws", ".", "ReadMessage", "(", ")", "\n", "if", "err", "!=", "nil", "{", "errChan", "<-", "err", "\n", "}", "else", "{", "requestsChan", "<-", "string", "(", "msg", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "(", ")", "\n", "for", "str", ":=", "range", "serverChan", "{", "err", ":=", "ws", ".", "WriteMessage", "(", "websocket", ".", "TextMessage", ",", "[", "]", "byte", "(", "str", ")", ")", "\n", "if", "err", "!=", "nil", "{", "errChan", "<-", "err", "\n", "}", "\n", "}", "\n", "}", ")", "\n\n", "server", ":=", "httptest", ".", "NewUnstartedServer", "(", "handler", ")", "\n", "return", "server", ",", "serverChan", ",", "requestsChan", ",", "errChan", ",", "nil", "\n", "}" ]
12,707
all-12708
[ "New", "will", "create", "a", "server", "and", "setup", "defaults" ]
[ "func", "New", "(", ")", "*", "Server", "{", "return", "&", "Server", "{", "BufferSize", ":", "DefaultBufferSize", ",", "AutoStream", ":", "false", ",", "AutoReplay", ":", "true", ",", "Streams", ":", "<mask>", "(", "map", "[", "string", "]", "*", "Stream", ")", ",", "}", "\n", "}" ]
12,708
all-12709
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "DescribeNodeReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom72", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
12,709
all-12710
[ "GetEllipsize", "is", "a", "wrapper", "around", "gtk_label_get_ellipsize", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "GetEllipsize", "(", ")", "pango", ".", "EllipsizeMode", "{", "c", ":=", "C", ".", "gtk_label_get_ellipsize", "(", "v", ".", "native", "(", ")", ")", "\n", "return", "pango", ".", "EllipsizeMode", "(", "c", ")", "\n", "}" ]
12,710
all-12711
[ "TSSLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "TSSLocator", "(", "href", "<mask>", ")", "*", "TSSLocator", "{", "return", "&", "TSSLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
12,711
all-12712
[ "Do", "executes", "LayerTree", ".", "replaySnapshot", "against", "the", "provided", "context", ".", "returns", ":", "dataURL", "-", "A", "data", ":", "URL", "for", "resulting", "image", "." ]
[ "func", "(", "p", "*", "ReplaySnapshotParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "dataURL", "string", ",", "err", "error", ")", "{", "// execute", "var", "<mask>", "ReplaySnapshotReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandReplaySnapshot", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "DataURL", ",", "nil", "\n", "}" ]
12,712
all-12713
[ "Builds", "the", "aliases", "string", "based", "on", "the", "SSH", "configuration", "of", "all", "servers", "and", "server", "arrays", "in", "all", "environments", "." ]
[ "func", "buildAliases", "(", "sshConfig", "[", "]", "SSHConfig", ",", "sshOptions", ",", "sshUser", "string", ")", "string", "{", "var", "aliases", "string", "\n", "for", "_", ",", "conf", ":=", "range", "sshConfig", "{", "aliases", "=", "aliases", "+", "fmt", ".", "Sprintf", "(", "\"", "\\n", "\"", ",", "conf", ".", "<mask>", ",", "sshOptions", ",", "sshUser", ",", "conf", ".", "IPAddress", ")", "\n", "}", "\n", "return", "aliases", "\n", "}" ]
12,713
all-12714
[ "To", "check", "this", "line", "is", "a", "whole", "line", "comment", "or", "not", "." ]
[ "func", "checkComment", "(", "line", "string", ")", "bool", "{", "line", "=", "strings", ".", "TrimSpace", "(", "line", ")", "\n", "for", "p", ":=", "range", "commentPrefix", "{", "if", "strings", ".", "HasPrefix", "(", "<mask>", ",", "commentPrefix", "[", "p", "]", ")", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
12,714
all-12715
[ "export", "FileSequence_SetFrameRange" ]
[ "func", "FileSequence_SetFrameRange", "(", "id", "FileSeqId", ",", "frameRange", "*", "C", ".", "char", ")", "Error", "{", "if", "fs", ",", "<mask>", ":=", "sFileSeqs", ".", "Get", "(", "id", ")", ";", "ok", "{", "str", ":=", "C", ".", "GoString", "(", "frameRange", ")", "\n", "if", "err", ":=", "fs", ".", "SetFrameRange", "(", "str", ")", ";", "err", "!=", "nil", "{", "return", "C", ".", "CString", "(", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
12,715
all-12716
[ "MultipartForm", "works", "much", "like", "Form", "except", "it", "can", "parse", "multipart", "forms", "and", "handle", "file", "uploads", ".", "Like", "the", "other", "deserialization", "middleware", "handlers", "you", "can", "pass", "in", "an", "interface", "to", "make", "the", "interface", "available", "for", "injection", "into", "other", "handlers", "later", "." ]
[ "func", "MultipartForm", "(", "formStruct", "interface", "{", "}", ",", "ifacePtr", "...", "interface", "{", "}", ")", "martini", ".", "Handler", "{", "return", "func", "(", "<mask>", "martini", ".", "Context", ",", "req", "*", "http", ".", "Request", ")", "{", "var", "errors", "Errors", "\n\n", "ensureNotPointer", "(", "formStruct", ")", "\n", "formStruct", ":=", "reflect", ".", "New", "(", "reflect", ".", "TypeOf", "(", "formStruct", ")", ")", "\n\n", "// This if check is necessary due to https://github.com/martini-contrib/csrf/issues/6", "if", "req", ".", "MultipartForm", "==", "nil", "{", "// Workaround for multipart forms returning nil instead of an error", "// when content is not multipart; see https://code.google.com/p/go/issues/detail?id=6334", "if", "multipartReader", ",", "err", ":=", "req", ".", "MultipartReader", "(", ")", ";", "err", "!=", "nil", "{", "// TODO: Cover this and the next error check with tests", "errors", ".", "Add", "(", "[", "]", "string", "{", "}", ",", "DeserializationError", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "else", "{", "form", ",", "parseErr", ":=", "multipartReader", ".", "ReadForm", "(", "MaxMemory", ")", "\n", "if", "parseErr", "!=", "nil", "{", "errors", ".", "Add", "(", "[", "]", "string", "{", "}", ",", "DeserializationError", ",", "parseErr", ".", "Error", "(", ")", ")", "\n", "}", "\n", "req", ".", "MultipartForm", "=", "form", "\n", "}", "\n", "}", "\n\n", "mapForm", "(", "formStruct", ",", "req", ".", "MultipartForm", ".", "Value", ",", "req", ".", "MultipartForm", ".", "File", ",", "errors", ")", "\n", "validateAndMap", "(", "formStruct", ",", "context", ",", "errors", ",", "ifacePtr", "...", ")", "\n", "}", "\n\n", "}" ]
12,716
all-12717
[ "IsErrNotActivated", "checks", "if", "an", "error", "is", "a", "ErrNotActivated" ]
[ "func", "IsErrNotActivated", "(", "err", "error", ")", "bool", "{", "if", "err", "==", "nil", "{", "return", "false", "\n", "}", "\n", "// TODO(msteffen) This is unstructured because we have no way to propagate", "// structured errors across GRPC boundaries. Fix", "return", "strings", ".", "Contains", "(", "err", ".", "Error", "(", ")", ",", "<mask>", ".", "Convert", "(", "ErrNotActivated", ")", ".", "Message", "(", ")", ")", "\n", "}" ]
12,717
all-12718
[ "Accept", "implements", "the", "net", ".", "Listener", "interface", "." ]
[ "func", "(", "t", "*", "TCPStreamLayer", ")", "Accept", "(", ")", "(", "c", "<mask>", ".", "Conn", ",", "err", "error", ")", "{", "return", "t", ".", "listener", ".", "Accept", "(", ")", "\n", "}" ]
12,718
all-12719
[ "UnmarshalYAML", "implements", "the", "yaml", ".", "Unmarshaler", "interface", "." ]
[ "func", "(", "c", "*", "SDConfig", ")", "UnmarshalYAML", "(", "unmarshal", "func", "(", "interface", "{", "}", ")", "error", ")", "error", "{", "*", "c", "=", "DefaultSDConfig", "\n", "type", "<mask>", "SDConfig", "\n", "err", ":=", "unmarshal", "(", "(", "*", "plain", ")", "(", "c", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "err", "=", "validateAuthParam", "(", "c", ".", "SubscriptionID", ",", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "c", ".", "AuthenticationMethod", "==", "authMethodOAuth", "{", "if", "err", "=", "validateAuthParam", "(", "c", ".", "TenantID", ",", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", "=", "validateAuthParam", "(", "c", ".", "ClientID", ",", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", "=", "validateAuthParam", "(", "string", "(", "c", ".", "ClientSecret", ")", ",", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "if", "c", ".", "AuthenticationMethod", "!=", "authMethodOAuth", "&&", "c", ".", "AuthenticationMethod", "!=", "authMethodManagedIdentity", "{", "return", "errors", ".", "Errorf", "(", "\"", "\"", ",", "c", ".", "AuthenticationMethod", ",", "authMethodOAuth", ",", "authMethodManagedIdentity", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
12,719
all-12720
[ "WithHTTPClient", "adds", "the", "HTTPClient", "to", "the", "delete", "apps", "app", "params" ]
[ "func", "(", "o", "*", "DeleteAppsAppParams", ")", "WithHTTPClient", "(", "<mask>", "*", "http", ".", "Client", ")", "*", "DeleteAppsAppParams", "{", "o", ".", "SetHTTPClient", "(", "client", ")", "\n", "return", "o", "\n", "}" ]
12,720
all-12721
[ "substituteRule", "replaces", "local", "labels", "(", "those", "beginning", "with", ":", "referring", "to", "targets", "in", "the", "same", "package", ")", "according", "to", "a", "substitution", "map", ".", "This", "is", "used", "to", "update", "generated", "rules", "before", "merging", "when", "the", "corresponding", "existing", "rules", "have", "different", "names", ".", "If", "substituteRule", "replaces", "a", "string", "it", "returns", "a", "new", "expression", ";", "it", "will", "not", "modify", "the", "original", "expression", "." ]
[ "func", "substituteRule", "(", "r", "*", "rule", ".", "Rule", ",", "substitutions", "map", "[", "string", "]", "string", ",", "info", "rule", ".", "KindInfo", ")", "{", "for", "attr", ":=", "<mask>", "info", ".", "SubstituteAttrs", "{", "if", "expr", ":=", "r", ".", "Attr", "(", "attr", ")", ";", "expr", "!=", "nil", "{", "expr", "=", "rule", ".", "MapExprStrings", "(", "expr", ",", "func", "(", "s", "string", ")", "string", "{", "if", "rename", ",", "ok", ":=", "substitutions", "[", "strings", ".", "TrimPrefix", "(", "s", ",", "\"", "\"", ")", "]", ";", "ok", "{", "return", "\"", "\"", "+", "rename", "\n", "}", "else", "{", "return", "s", "\n", "}", "\n", "}", ")", "\n", "r", ".", "SetAttr", "(", "attr", ",", "expr", ")", "\n", "}", "\n", "}", "\n", "}" ]
12,721
all-12722
[ "DeletePrefix", "is", "used", "to", "delete", "the", "subtree", "under", "a", "prefix", "Returns", "how", "many", "nodes", "were", "deleted", "Use", "this", "to", "delete", "large", "subtrees", "efficiently" ]
[ "func", "(", "t", "*", "Tree", ")", "DeletePrefix", "(", "s", "string", ")", "int", "{", "return", "t", ".", "deletePrefix", "(", "nil", ",", "t", ".", "<mask>", ",", "s", ")", "\n", "}" ]
12,722
all-12723
[ "create", "query", "objects" ]
[ "func", "CreateQueries", "(", "target", "uint32", ",", "n", "int32", ",", "ids", "*", "uint32", ")", "{", "C", ".", "glowCreateQueries", "(", "gpCreateQueries", ",", "(", "C", ".", "GLenum", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "n", ")", ",", "(", "*", "C", ".", "GLuint", ")", "(", "unsafe", ".", "Pointer", "(", "ids", ")", ")", ")", "\n", "}" ]
12,723
all-12724
[ "HasVal", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "g", "*", "GraphDefinitionMarker", ")", "HasVal", "(", ")", "bool", "{", "if", "g", "!=", "nil", "&&", "g", ".", "Val", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
12,724
all-12725
[ "CreateLedger", "creates", "a", "new", "locally", "-", "stored", "reference", "to", "a", "Ledger", "keypair", "It", "returns", "the", "created", "key", "info", "and", "an", "error", "if", "the", "Ledger", "could", "not", "be", "queried" ]
[ "func", "(", "kb", "dbKeybase", ")", "CreateLedger", "(", "name", "string", ",", "path", "crypto", ".", "DerivationPath", ",", "algo", "SignAlgo", ")", "(", "Info", ",", "error", ")", "{", "if", "algo", "!=", "AlgoSecp256k1", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "priv", ",", "err", ":=", "crypto", ".", "NewPrivKeyLedgerSecp256k1", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "pub", ":=", "priv", ".", "PubKey", "(", ")", "\n", "return", "kb", ".", "writeLedgerKey", "(", "pub", ",", "<mask>", ",", "name", ")", ",", "nil", "\n", "}" ]
12,725
all-12726
[ "MutateTransaction", "for", "SetOptionsBuilder", "causes", "the", "underylying", "SetOptionsOp", "to", "be", "added", "to", "the", "operation", "list", "for", "the", "provided", "transaction" ]
[ "func", "(", "m", "SetOptionsBuilder", ")", "MutateTransaction", "(", "o", "*", "TransactionBuilder", ")", "error", "{", "if", "m", ".", "Err", "!=", "nil", "{", "return", "m", ".", "Err", "\n", "}", "\n\n", "m", ".", "O", ".", "Body", ",", "m", ".", "Err", "=", "xdr", ".", "NewOperationBody", "(", "xdr", ".", "OperationTypeSetOptions", ",", "m", ".", "SO", ")", "\n", "o", ".", "TX", ".", "Operations", "=", "<mask>", "(", "o", ".", "TX", ".", "Operations", ",", "m", ".", "O", ")", "\n", "return", "m", ".", "Err", "\n", "}" ]
12,726
all-12727
[ "New", "creates", "a", "new", "reporter", "." ]
[ "func", "New", "(", "apiKey", "string", ")", "*", "Reporter", "{", "hostname", ",", "_", ":=", "os", ".", "Hostname", "(", ")", "\n\n", "return", "&", "Reporter", "{", "Client", ":", "NewClient", "(", "apiKey", ")", ",", "Hostname", ":", "hostname", ",", "refs", ":", "<mask>", "(", "map", "[", "string", "]", "int8", ")", ",", "}", "\n", "}" ]
12,727
all-12728
[ "DialDualStack", "dials", "the", "given", "TCP", "addr", "using", "both", "tcp4", "and", "tcp6", ".", "This", "function", "has", "the", "following", "additional", "features", "comparing", "to", "net", ".", "Dial", ":", "*", "It", "reduces", "load", "on", "DNS", "resolver", "by", "caching", "resolved", "TCP", "addressed", "for", "DefaultDNSCacheDuration", ".", "*", "It", "dials", "all", "the", "resolved", "TCP", "addresses", "in", "round", "-", "robin", "manner", "until", "connection", "is", "established", ".", "This", "may", "be", "useful", "if", "certain", "addresses", "are", "temporarily", "unreachable", ".", "*", "It", "returns", "ErrDialTimeout", "if", "connection", "cannot", "be", "established", "during", "DefaultDialTimeout", "seconds", ".", "Use", "DialDualStackTimeout", "for", "custom", "dial", "timeout", ".", "This", "dialer", "is", "intended", "for", "custom", "code", "wrapping", "before", "passing", "to", "Client", ".", "Dial", "or", "HostClient", ".", "Dial", ".", "For", "instance", "per", "-", "host", "counters", "and", "/", "or", "limits", "may", "be", "implemented", "by", "such", "wrappers", ".", "The", "addr", "passed", "to", "the", "function", "must", "contain", "port", ".", "Example", "addr", "values", ":", "*", "foobar", ".", "baz", ":", "443", "*", "foo", ".", "bar", ":", "80", "*", "aaa", ".", "com", ":", "8080" ]
[ "func", "(", "d", "*", "TCPDialer", ")", "DialDualStack", "(", "addr", "string", ")", "(", "<mask>", ".", "Conn", ",", "error", ")", "{", "return", "d", ".", "dial", "(", "addr", ",", "true", ",", "DefaultDialTimeout", ")", "\n", "}" ]
12,728
all-12729
[ "PutInt8", "sets", "an", "8", "-", "bit", "signed", "value", "for", "the", "given", "string", "name", ".", "The", "field", "name", "must", "be", "an", "Int8Field", "otherwise", "an", "error", "will", "be", "returned", ".", "If", "the", "type", "buffer", "no", "longer", "has", "enough", "space", "to", "write", "this", "value", "an", "xbinary", ".", "ErrOutOfRange", "error", "will", "be", "returned", ".", "Upon", "success", "2", "bytes", "should", "be", "written", "into", "the", "buffer", "and", "the", "returned", "error", "should", "be", "nil", ".", "The", "type", "code", "is", "written", "first", "then", "the", "byte", "value", "." ]
[ "func", "(", "b", "*", "TupleBuilder", ")", "PutInt8", "(", "field", "string", ",", "<mask>", "int8", ")", "(", "wrote", "uint64", ",", "err", "error", ")", "{", "// field type should be", "if", "err", "=", "b", ".", "typeCheck", "(", "field", ",", "Int8Field", ")", ";", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "// minimum bytes is 2 (type code + value)", "if", "b", ".", "available", "(", ")", "<", "2", "{", "return", "0", ",", "xbinary", ".", "ErrOutOfRange", "\n", "}", "\n\n", "// write type code", "b", ".", "buffer", "[", "b", ".", "pos", "]", "=", "byte", "(", "Int8Code", ".", "OpCode", ")", "\n\n", "// write value", "b", ".", "buffer", "[", "b", ".", "pos", "+", "1", "]", "=", "byte", "(", "value", ")", "\n\n", "// set field offset", "b", ".", "offsets", "[", "field", "]", "=", "b", ".", "pos", "\n\n", "// incr pos", "b", ".", "pos", "+=", "2", "\n\n", "return", "2", ",", "nil", "\n", "}" ]
12,729
all-12730
[ "HashPassword", "will", "hash", "Password", "and", "set", "PasswordHash", "." ]
[ "func", "(", "u", "*", "User", ")", "HashPassword", "(", ")", "error", "{", "// check length", "if", "len", "(", "u", ".", "Password", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "// generate hash from password", "hash", ",", "err", ":=", "bcrypt", ".", "GenerateFromPassword", "(", "[", "]", "<mask>", "(", "u", ".", "Password", ")", ",", "bcrypt", ".", "DefaultCost", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// save hash", "u", ".", "PasswordHash", "=", "hash", "\n\n", "// clear password", "u", ".", "Password", "=", "\"", "\"", "\n\n", "return", "nil", "\n", "}" ]
12,730
all-12731
[ "expandHostNicTeamingPolicy", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "HostNicTeamingPolicy", "." ]
[ "func", "expandHostNicTeamingPolicy", "(", "d", "*", "schema", ".", "ResourceData", ")", "*", "types", ".", "HostNicTeamingPolicy", "{", "obj", ":=", "&", "types", ".", "HostNicTeamingPolicy", "{", "Policy", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "}", "\n", "if", "v", ",", "ok", ":=", "d", ".", "GetOkExists", "(", "\"", "\"", ")", ";", "ok", "{", "obj", ".", "RollingOrder", "=", "structure", ".", "BoolPtr", "(", "!", "v", ".", "(", "bool", ")", ")", "\n", "}", "\n", "if", "v", ",", "<mask>", ":=", "d", ".", "GetOkExists", "(", "\"", "\"", ")", ";", "ok", "{", "obj", ".", "NotifySwitches", "=", "structure", ".", "BoolPtr", "(", "v", ".", "(", "bool", ")", ")", "\n", "}", "\n", "obj", ".", "FailureCriteria", "=", "expandHostNicFailureCriteria", "(", "d", ")", "\n", "obj", ".", "NicOrder", "=", "expandHostNicOrderPolicy", "(", "d", ")", "\n\n", "// These fields are deprecated and are set only to make things work. They are", "// not exposed to Terraform.", "obj", ".", "ReversePolicy", "=", "structure", ".", "BoolPtr", "(", "true", ")", "\n\n", "return", "obj", "\n", "}" ]
12,731
all-12732
[ "Generate", "random", "number", "in", "[", "0", "n", ")" ]
[ "func", "GenerateRandomInt64", "(", "min", ",", "max", "int64", ")", "int64", "{", "upper", ":=", "<mask>", "-", "min", "\n\n", "nBig", ",", "err", ":=", "rand", ".", "Int", "(", "rand", ".", "Reader", ",", "big", ".", "NewInt", "(", "upper", ")", ")", "\n\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n\n", "return", "nBig", ".", "Int64", "(", ")", "+", "min", "\n", "}" ]
12,732
all-12733
[ "assignDisk", "takes", "a", "unit", "number", "and", "assigns", "it", "correctly", "to", "a", "controller", "on", "the", "SCSI", "bus", ".", "An", "error", "is", "returned", "if", "the", "assigned", "unit", "number", "is", "taken", "." ]
[ "func", "(", "r", "*", "DiskSubresource", ")", "assignDisk", "(", "l", "object", ".", "VirtualDeviceList", ",", "disk", "*", "types", ".", "VirtualDisk", ")", "(", "types", ".", "BaseVirtualController", ",", "error", ")", "{", "number", ":=", "r", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", "\n", "// Figure out the bus number, and look up the SCSI controller that matches", "// that. You can attach 15 disks to a SCSI controller, and we allow a maximum", "// of 30 devices.", "bus", ":=", "number", "/", "15", "\n", "// Also determine the unit number on that controller.", "unit", ":=", "int32", "(", "math", ".", "Mod", "(", "float64", "(", "number", ")", ",", "15", ")", ")", "\n\n", "// Find the controller.", "ctlr", ",", "err", ":=", "r", ".", "ControllerForCreateUpdate", "(", "l", ",", "SubresourceControllerTypeSCSI", ",", "bus", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Build the unit list.", "units", ":=", "<mask>", "(", "[", "]", "bool", ",", "16", ")", "\n", "// Reserve the SCSI unit number", "scsiUnit", ":=", "ctlr", ".", "(", "types", ".", "BaseVirtualSCSIController", ")", ".", "GetVirtualSCSIController", "(", ")", ".", "ScsiCtlrUnitNumber", "\n", "units", "[", "scsiUnit", "]", "=", "true", "\n\n", "ckey", ":=", "ctlr", ".", "GetVirtualController", "(", ")", ".", "Key", "\n\n", "for", "_", ",", "device", ":=", "range", "l", "{", "d", ":=", "device", ".", "GetVirtualDevice", "(", ")", "\n", "if", "d", ".", "ControllerKey", "!=", "ckey", "||", "d", ".", "UnitNumber", "==", "nil", "{", "continue", "\n", "}", "\n", "units", "[", "*", "d", ".", "UnitNumber", "]", "=", "true", "\n", "}", "\n\n", "// We now have a valid list of units. If we need to, shift up the desired", "// unit number so it's not taking the unit of the controller itself.", "if", "unit", ">=", "scsiUnit", "{", "unit", "++", "\n", "}", "\n\n", "if", "units", "[", "unit", "]", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "unit", ",", "bus", ")", "\n", "}", "\n\n", "// If we made it this far, we are good to go!", "disk", ".", "ControllerKey", "=", "ctlr", ".", "GetVirtualController", "(", ")", ".", "Key", "\n", "disk", ".", "UnitNumber", "=", "&", "unit", "\n", "return", "ctlr", ",", "nil", "\n", "}" ]
12,733
all-12734
[ "RegisterContainerInstance", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockECSSDK", ")", "RegisterContainerInstance", "(", "arg0", "*", "ecs", ".", "RegisterContainerInstanceInput", ")", "(", "*", "ecs", ".", "RegisterContainerInstanceOutput", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "<mask>", "[", "0", "]", ".", "(", "*", "ecs", ".", "RegisterContainerInstanceOutput", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
12,734
all-12735
[ "Hold", "creates", "the", "barrier", "key", "causing", "processes", "to", "block", "on", "Wait", "." ]
[ "func", "(", "b", "*", "Barrier", ")", "Hold", "(", ")", "error", "{", "_", ",", "err", ":=", "newKey", "(", "b", ".", "<mask>", ",", "b", ".", "key", ",", "v3", ".", "NoLease", ")", "\n", "return", "err", "\n", "}" ]
12,735
all-12736
[ "RegisterIssueHandler", "registers", "a", "plugin", "s", "github", ".", "IssueEvent", "handler", "." ]
[ "func", "RegisterIssueHandler", "(", "name", "string", ",", "fn", "IssueHandler", ",", "help", "HelpProvider", ")", "{", "pluginHelp", "[", "name", "]", "=", "help", "\n", "issueHandlers", "[", "<mask>", "]", "=", "fn", "\n", "}" ]
12,736
all-12737
[ "GetShowArrow", "is", "a", "wrapper", "around", "gtk_toolbar_get_show_arrow", "()", "." ]
[ "func", "(", "v", "*", "Toolbar", ")", "GetShowArrow", "(", ")", "bool", "{", "c", ":=", "C", ".", "gtk_toolbar_get_show_arrow", "(", "v", ".", "native", "(", ")", ")", "\n", "<mask>", "gobool", "(", "c", ")", "\n", "}" ]
12,737
all-12738
[ "Check", "takes", "an", "input", "code", "and", "verifies", "it", "against", "the", "OTP", ".", "If", "successful", "the", "counter", "is", "incremented", "." ]
[ "func", "(", "otp", "*", "HOTP", ")", "Check", "(", "code", "string", ")", "bool", "{", "codeBytes", ":=", "[", "]", "byte", "(", "code", ")", "\n", "genCode", ":=", "[", "]", "byte", "(", "otp", ".", "OTP", "(", ")", ")", "\n", "if", "subtle", ".", "ConstantTimeCompare", "(", "codeBytes", ",", "genCode", ")", "!=", "1", "{", "otp", ".", "setCounter", "(", "otp", ".", "Counter", "(", ")", "-", "1", ")", "\n", "return", "false", "\n", "}", "\n", "return", "<mask>", "\n", "}" ]
12,738
all-12739
[ "Branches", "returns", "a", "collection", "of", "branches" ]
[ "func", "Branches", "(", "etcdClient", "*", "etcd", ".", "Client", ",", "etcdPrefix", "string", ",", "repo", "string", ")", "col", ".", "<mask>", "{", "return", "col", ".", "NewCollection", "(", "etcdClient", ",", "path", ".", "Join", "(", "etcdPrefix", ",", "branchesPrefix", ",", "repo", ")", ",", "nil", ",", "&", "pfs", ".", "BranchInfo", "{", "}", ",", "func", "(", "key", "string", ")", "error", "{", "if", "uuid", ".", "IsUUIDWithoutDashes", "(", "key", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}", ",", "nil", ",", ")", "\n", "}" ]
12,739
all-12740
[ "GetLabel", "returns", "the", "Label", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "w", "*", "WidgetAxis", ")", "GetLabel", "(", ")", "string", "{", "if", "w", "==", "nil", "||", "w", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "w", ".", "Label", "\n", "}" ]
12,740
all-12741
[ "GetAccount", "retrieves", "the", "Account", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "LedgerKey", ")", "GetAccount", "(", ")", "(", "result", "LedgerKeyAccount", ",", "ok", "bool", ")", "{", "armName", ",", "_", ":=", "u", ".", "ArmForSwitch", "(", "int32", "(", "u", ".", "Type", ")", ")", "\n\n", "if", "armName", "==", "\"", "\"", "{", "result", "=", "*", "u", ".", "Account", "\n", "<mask>", "=", "true", "\n", "}", "\n\n", "return", "\n", "}" ]
12,741
all-12742
[ "HasTitleAlign", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "m", "*", "ManageStatusDefinition", ")", "HasTitleAlign", "(", ")", "bool", "{", "if", "m", "!=", "nil", "&&", "m", ".", "TitleAlign", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
12,742
all-12743
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventShadowRootPushed", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom55", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
12,743
all-12744
[ "StartServer", "starts", "a", "server" ]
[ "func", "(", "c", "*", "Client", ")", "StartServer", "(", "dcid", ",", "srvid", "string", ")", "(", "*", "http", ".", "Header", ",", "error", ")", "{", "url", ":=", "serverPath", "(", "dcid", ",", "srvid", ")", "+", "\"", "\"", "\n", "ret", ":=", "&", "http", ".", "Header", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Post", "(", "url", ",", "nil", ",", "ret", ",", "<mask>", ".", "StatusAccepted", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
12,744
all-12745
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "BackendNode", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCdp3", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
12,745
all-12746
[ "AtomicWrite", "accepts", "a", "destination", "path", "and", "the", "template", "contents", ".", "It", "writes", "the", "template", "contents", "to", "a", "TempFile", "on", "disk", "returning", "if", "any", "errors", "occur", ".", "If", "the", "parent", "destination", "directory", "does", "not", "exist", "it", "will", "be", "created", "automatically", "with", "permissions", "0755", ".", "To", "use", "a", "different", "permission", "create", "the", "directory", "first", "or", "use", "chmod", "in", "a", "Command", ".", "If", "the", "destination", "path", "exists", "all", "attempts", "will", "be", "made", "to", "preserve", "the", "existing", "file", "permissions", ".", "If", "those", "permissions", "cannot", "be", "read", "an", "error", "is", "returned", ".", "If", "the", "file", "does", "not", "exist", "it", "will", "be", "created", "automatically", "with", "permissions", "0644", ".", "To", "use", "a", "different", "permission", "create", "the", "destination", "file", "first", "or", "use", "chmod", "in", "a", "Command", ".", "If", "no", "errors", "occur", "the", "Tempfile", "is", "renamed", "(", "moved", ")", "to", "the", "destination", "path", "." ]
[ "func", "AtomicWrite", "(", "path", "string", ",", "createDestDirs", "bool", ",", "contents", "[", "]", "byte", ",", "perms", "os", ".", "FileMode", ",", "backup", "bool", ")", "error", "{", "if", "path", "==", "\"", "\"", "{", "return", "ErrMissingDest", "\n", "}", "\n\n", "parent", ":=", "filepath", ".", "Dir", "(", "path", ")", "\n", "if", "_", ",", "err", ":=", "os", ".", "Stat", "(", "parent", ")", ";", "<mask>", ".", "IsNotExist", "(", "err", ")", "{", "if", "createDestDirs", "{", "if", "err", ":=", "os", ".", "MkdirAll", "(", "parent", ",", "0755", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "else", "{", "return", "ErrNoParentDir", "\n", "}", "\n", "}", "\n\n", "f", ",", "err", ":=", "ioutil", ".", "TempFile", "(", "parent", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "os", ".", "Remove", "(", "f", ".", "Name", "(", ")", ")", "\n\n", "if", "_", ",", "err", ":=", "f", ".", "Write", "(", "contents", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "err", ":=", "f", ".", "Sync", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "err", ":=", "f", ".", "Close", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// If the user did not explicitly set permissions, attempt to lookup the", "// current permissions on the file. If the file does not exist, fall back to", "// the default. Otherwise, inherit the current permissions.", "if", "perms", "==", "0", "{", "currentInfo", ",", "err", ":=", "os", ".", "Stat", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "if", "os", ".", "IsNotExist", "(", "err", ")", "{", "perms", "=", "DefaultFilePerms", "\n", "}", "else", "{", "return", "err", "\n", "}", "\n", "}", "else", "{", "perms", "=", "currentInfo", ".", "Mode", "(", ")", "\n\n", "// The file exists, so try to preserve the ownership as well.", "if", "err", ":=", "preserveFilePermissions", "(", "f", ".", "Name", "(", ")", ",", "currentInfo", ")", ";", "err", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "f", ".", "Name", "(", ")", ",", "err", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "err", ":=", "os", ".", "Chmod", "(", "f", ".", "Name", "(", ")", ",", "perms", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// If we got this far, it means we are about to save the file. Copy the", "// current contents of the file onto disk (if it exists) so we have a backup.", "if", "backup", "{", "if", "_", ",", "err", ":=", "os", ".", "Stat", "(", "path", ")", ";", "!", "os", ".", "IsNotExist", "(", "err", ")", "{", "if", "err", ":=", "copyFile", "(", "path", ",", "path", "+", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "err", ":=", "os", ".", "Rename", "(", "f", ".", "Name", "(", ")", ",", "path", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
12,746
all-12747
[ "FindObject", "finds", "the", "object", "containing", "a", ".", "Returns", "that", "object", "and", "the", "offset", "within", "that", "object", "to", "which", "a", "points", ".", "Returns", "0", "0", "if", "a", "doesn", "t", "point", "to", "a", "live", "heap", "object", "." ]
[ "func", "(", "p", "*", "Process", ")", "FindObject", "(", "a", "core", ".", "Address", ")", "(", "Object", ",", "int64", ")", "{", "// Round down to the start of an object.", "h", ":=", "p", ".", "findHeapInfo", "(", "a", ")", "\n", "if", "h", "==", "nil", "{", "// Not in Go heap, or in a span", "// that doesn't hold Go objects (freed, stacks, ...)", "return", "0", ",", "0", "\n", "}", "\n", "x", ":=", "h", ".", "base", ".", "Add", "(", "a", ".", "Sub", "(", "h", ".", "<mask>", ")", "/", "h", ".", "size", "*", "h", ".", "size", ")", "\n", "// Check if object is marked.", "h", "=", "p", ".", "findHeapInfo", "(", "x", ")", "\n", "if", "h", ".", "mark", ">>", "(", "uint64", "(", "x", ")", "%", "heapInfoSize", "/", "8", ")", "&", "1", "==", "0", "{", "// free or garbage", "return", "0", ",", "0", "\n", "}", "\n", "return", "Object", "(", "x", ")", ",", "a", ".", "Sub", "(", "x", ")", "\n", "}" ]
12,747
all-12748
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetSinkToUseParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast2", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
12,748
all-12749
[ "Merge", "the", "gossiped", "data", "represented", "by", "buf", "into", "our", "state", ".", "Return", "the", "state", "information", "that", "was", "modified", "." ]
[ "func", "(", "p", "*", "peer", ")", "OnGossipBroadcast", "(", "src", "mesh", ".", "PeerName", ",", "buf", "[", "]", "byte", ")", "(", "received", "mesh", ".", "GossipData", ",", "err", "error", ")", "{", "<mask>", "set", "map", "[", "mesh", ".", "PeerName", "]", "int", "\n", "if", "err", ":=", "gob", ".", "NewDecoder", "(", "bytes", ".", "NewReader", "(", "buf", ")", ")", ".", "Decode", "(", "&", "set", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "received", "=", "p", ".", "st", ".", "mergeReceived", "(", "set", ")", "\n", "if", "received", "==", "nil", "{", "p", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "src", ",", "set", ",", "received", ")", "\n", "}", "else", "{", "p", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "src", ",", "set", ",", "received", ".", "(", "*", "state", ")", ".", "set", ")", "\n", "}", "\n", "return", "received", ",", "nil", "\n", "}" ]
12,749
all-12750
[ "Offset", "returns", "a", "derivative", "query", "that", "has", "an", "offset", "of", "how", "many", "keys", "to", "skip", "over", "before", "returning", "results", ".", "A", "negative", "value", "is", "invalid", "." ]
[ "func", "(", "q", "*", "Query", ")", "Offset", "(", "offset", "int", ")", "*", "Query", "{", "q", "=", "q", ".", "clone", "(", ")", "\n", "if", "<mask>", "<", "0", "{", "q", ".", "err", "=", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "return", "q", "\n", "}", "\n", "if", "offset", ">", "math", ".", "MaxInt32", "{", "q", ".", "err", "=", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "return", "q", "\n", "}", "\n", "q", ".", "offset", "=", "int32", "(", "offset", ")", "\n", "return", "q", "\n", "}" ]
12,750
all-12751
[ "GetValue", "is", "a", "wrapper", "around", "gtk_range_get_value", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "GetValue", "(", ")", "float64", "{", "c", ":=", "C", ".", "gtk_range_get_value", "(", "v", ".", "native", "(", ")", ")", "\n", "return", "float64", "(", "c", ")", "\n", "}" ]
12,751
all-12752
[ "SetIconTooltipMarkup", "()", "is", "a", "wrapper", "around", "gtk_entry_set_icon_tooltip_markup", "()", "." ]
[ "func", "(", "v", "*", "Entry", ")", "SetIconTooltipMarkup", "(", "iconPos", "EntryIconPosition", ",", "tooltip", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "tooltip", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_entry_set_icon_tooltip_markup", "(", "v", ".", "native", "(", ")", ",", "C", ".", "GtkEntryIconPosition", "(", "iconPos", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}" ]
12,752
all-12753
[ "GetMark", "()", "is", "a", "wrapper", "around", "gtk_text_buffer_get_mark", "()", "." ]
[ "func", "(", "v", "*", "TextBuffer", ")", "GetMark", "(", "mark_name", "string", ")", "*", "TextMark", "{", "cstr", ":=", "C", ".", "CString", "(", "mark_name", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "<mask>", ":=", "C", ".", "gtk_text_buffer_get_mark", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "return", "(", "*", "TextMark", ")", "(", "ret", ")", "\n", "}" ]
12,753
all-12754
[ "Not", "goroutine", "safe", "." ]
[ "func", "(", "sw", "*", "Switch", ")", "AddReactor", "(", "name", "string", ",", "reactor", "Reactor", ")", "Reactor", "{", "// Validate the reactor.", "// No two reactors can share the same channel.", "reactorChannels", ":=", "reactor", ".", "GetChannels", "(", ")", "\n", "for", "_", ",", "chDesc", ":=", "<mask>", "reactorChannels", "{", "chID", ":=", "chDesc", ".", "ID", "\n", "if", "sw", ".", "reactorsByCh", "[", "chID", "]", "!=", "nil", "{", "PanicSanity", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "chID", ",", "sw", ".", "reactorsByCh", "[", "chID", "]", ",", "reactor", ")", ")", "\n", "}", "\n", "sw", ".", "chDescs", "=", "append", "(", "sw", ".", "chDescs", ",", "chDesc", ")", "\n", "sw", ".", "reactorsByCh", "[", "chID", "]", "=", "reactor", "\n", "}", "\n", "sw", ".", "reactors", "[", "name", "]", "=", "reactor", "\n", "reactor", ".", "SetSwitch", "(", "sw", ")", "\n", "return", "reactor", "\n", "}" ]
12,754
all-12755
[ "ErrInvalidRequestSignature", "indicates", "the", "payload", "could", "not", "be", "verified", "with", "the", "given", "signature", "." ]
[ "func", "ErrInvalidRequestSignature", "(", "signature", "string", ",", "err", "error", ")", "error", "{", "return", "ErrorResponse", "{", "Code", ":", "<mask>", ".", "StatusForbidden", ",", "Message", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "signature", ")", ",", "Errors", ":", "[", "]", "Error", "{", "Error", "{", "Message", ":", "err", ".", "Error", "(", ")", "}", "}", ",", "}", "\n", "}" ]
12,755
all-12756
[ "GetAgentOfferings", "returns", "active", "offerings", "available", "for", "a", "agent", "." ]
[ "func", "(", "h", "*", "Handler", ")", "GetAgentOfferings", "(", "tkn", ",", "product", "string", ",", "statuses", "[", "]", "string", ",", "offset", ",", "limit", "uint", ")", "(", "*", "GetAgentOfferingsResult", ",", "error", ")", "{", "logger", ":=", "h", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "product", ",", "\"", "\"", ",", "statuses", ")", "\n\n", "if", "!", "h", ".", "token", ".", "Check", "(", "tkn", ")", "{", "logger", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "nil", ",", "ErrAccessDenied", "\n", "}", "\n\n", "conditions", ",", "args", ":=", "h", ".", "getAgentOfferingsConditions", "(", "product", ",", "statuses", ")", "\n\n", "count", ",", "err", ":=", "h", ".", "numberOfObjects", "(", "logger", ",", "data", ".", "OfferingTable", ".", "Name", "(", ")", ",", "conditions", ",", "args", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "offsetLimit", ":=", "h", ".", "offsetLimit", "(", "offset", ",", "limit", ")", "\n\n", "sorting", ":=", "`ORDER BY block_number_updated DESC`", "\n\n", "tail", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "conditions", ",", "sorting", ",", "offsetLimit", ")", "\n\n", "<mask>", ",", "err", ":=", "h", ".", "selectAllFrom", "(", "logger", ",", "data", ".", "OfferingTable", ",", "tail", ",", "args", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "offerings", ":=", "make", "(", "[", "]", "data", ".", "Offering", ",", "len", "(", "result", ")", ")", "\n\n", "for", "k", ",", "v", ":=", "range", "result", "{", "offerings", "[", "k", "]", "=", "*", "v", ".", "(", "*", "data", ".", "Offering", ")", "\n", "}", "\n\n", "return", "&", "GetAgentOfferingsResult", "{", "offerings", ",", "count", "}", ",", "nil", "\n", "}" ]
12,756
all-12757
[ "Criticalf", "logs", "provided", "message", "with", "formatting", "in", "CRITICAL", "level", "." ]
[ "func", "(", "logger", "*", "Logger", ")", "Criticalf", "(", "format", "string", ",", "a", "...", "interface", "{", "}", ")", "{", "logger", ".", "<mask>", "(", "CRITICAL", ",", "format", ",", "a", "...", ")", "\n", "}" ]
12,757
all-12758
[ "scanNumber", "scans", "numbers", "of", "different", "formats", ".", "The", "scanned", "item", "is", "not", "necessarily", "a", "valid", "number", ".", "This", "case", "is", "caught", "by", "the", "parser", "." ]
[ "func", "(", "l", "*", "lexer", ")", "scanNumber", "(", ")", "bool", "{", "digits", ":=", "\"", "\"", "\n", "// Disallow hexadecimal in series descriptions as the syntax is ambiguous.", "if", "!", "l", ".", "seriesDesc", "&&", "l", ".", "<mask>", "(", "\"", "\"", ")", "&&", "l", ".", "accept", "(", "\"", "\"", ")", "{", "digits", "=", "\"", "\"", "\n", "}", "\n", "l", ".", "acceptRun", "(", "digits", ")", "\n", "if", "l", ".", "accept", "(", "\"", "\"", ")", "{", "l", ".", "acceptRun", "(", "digits", ")", "\n", "}", "\n", "if", "l", ".", "accept", "(", "\"", "\"", ")", "{", "l", ".", "accept", "(", "\"", "\"", ")", "\n", "l", ".", "acceptRun", "(", "\"", "\"", ")", "\n", "}", "\n", "// Next thing must not be alphanumeric unless it's the times token", "// for series repetitions.", "if", "r", ":=", "l", ".", "peek", "(", ")", ";", "(", "l", ".", "seriesDesc", "&&", "r", "==", "'x'", ")", "||", "!", "isAlphaNumeric", "(", "r", ")", "{", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}" ]
12,758
all-12759
[ "Run", "runs", "the", "game", ".", "f", "is", "a", "function", "which", "is", "called", "at", "every", "frame", ".", "The", "argument", "(", "*", "Image", ")", "is", "the", "render", "target", "that", "represents", "the", "screen", ".", "The", "screen", "size", "is", "based", "on", "the", "given", "values", "(", "width", "and", "height", ")", ".", "A", "window", "size", "is", "based", "on", "the", "given", "values", "(", "width", "height", "and", "scale", ")", ".", "scale", "is", "used", "to", "enlarge", "the", "screen", ".", "Note", "that", "the", "actual", "screen", "is", "multiplied", "not", "only", "by", "the", "given", "scale", "but", "also", "by", "the", "device", "scale", "on", "high", "-", "DPI", "display", ".", "If", "you", "pass", "inverse", "of", "the", "device", "scale", "you", "can", "disable", "this", "automatical", "device", "scaling", "as", "a", "result", ".", "You", "can", "get", "the", "device", "scale", "by", "DeviceScaleFactor", "function", ".", "Run", "must", "be", "called", "on", "the", "main", "thread", ".", "Note", "that", "Ebiten", "bounds", "the", "main", "goroutine", "to", "the", "main", "OS", "thread", "by", "runtime", ".", "LockOSThread", ".", "Ebiten", "tries", "to", "call", "f", "60", "times", "a", "second", "by", "default", ".", "In", "other", "words", "TPS", "(", "ticks", "per", "second", ")", "is", "60", "by", "default", ".", "This", "is", "not", "related", "to", "framerate", "(", "display", "s", "refresh", "rate", ")", ".", "f", "is", "not", "called", "when", "the", "window", "is", "in", "background", "by", "default", ".", "This", "setting", "is", "configurable", "with", "SetRunnableInBackground", ".", "The", "given", "scale", "is", "ignored", "on", "fullscreen", "mode", "or", "gomobile", "-", "build", "mode", ".", "On", "non", "-", "GopherJS", "environments", "Run", "returns", "error", "when", "1", ")", "OpenGL", "error", "happens", "2", ")", "audio", "error", "happens", "or", "3", ")", "f", "returns", "error", ".", "In", "the", "case", "of", "3", ")", "Run", "returns", "the", "same", "error", ".", "On", "GopherJS", "Run", "returns", "immediately", ".", "It", "is", "because", "the", "main", "goroutine", "cannot", "be", "blocked", "on", "GopherJS", "due", "to", "the", "bug", "(", "gopherjs", "/", "gopherjs#826", ")", ".", "When", "an", "error", "happens", "this", "is", "shown", "as", "an", "error", "on", "the", "console", ".", "The", "size", "unit", "is", "device", "-", "independent", "pixel", ".", "Don", "t", "call", "Run", "twice", "or", "more", "in", "one", "process", "." ]
[ "func", "Run", "(", "f", "func", "(", "*", "Image", ")", "error", ",", "width", ",", "height", "int", ",", "scale", "float64", ",", "title", "string", ")", "error", "{", "f", "=", "(", "&", "imageDumper", "{", "f", ":", "f", "}", ")", ".", "update", "\n\n", "c", ":=", "newUIContext", "(", "f", ")", "\n", "theUIContext", ".", "Store", "(", "c", ")", "\n\n", "atomic", ".", "StoreInt32", "(", "&", "isRunning", ",", "1", ")", "\n", "// On GopherJS, run returns immediately.", "if", "!", "web", ".", "IsGopherJS", "(", ")", "{", "defer", "atomic", ".", "StoreInt32", "(", "&", "isRunning", ",", "0", ")", "\n", "}", "\n\n", "if", "err", ":=", "uiDriver", "(", ")", ".", "Run", "(", "width", ",", "<mask>", ",", "scale", ",", "title", ",", "c", ",", "graphicsDriver", "(", ")", ")", ";", "err", "!=", "nil", "{", "if", "err", "==", "driver", ".", "RegularTermination", "{", "return", "nil", "\n", "}", "\n", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
12,759
all-12760
[ "AddSvcComment", "creates", "a", "new", "ADD_SVC_COMMENT", "Nagios", "command", ".", "Adds", "a", "comment", "to", "a", "particular", "service", ".", "If", "the", "persistent", "field", "is", "set", "to", "zero", "(", "0", ")", "the", "comment", "will", "be", "deleted", "the", "next", "time", "Nagios", "is", "restarted", ".", "Otherwise", "the", "comment", "will", "persist", "across", "program", "restarts", "until", "it", "is", "deleted", "manually", "." ]
[ "func", "AddSvcComment", "(", "host_name", "string", ",", "service_description", "string", ",", "persistent", "bool", ",", "<mask>", "string", ",", "comment", "string", ",", ")", "*", "livestatus", ".", "Command", "{", "return", "livestatus", ".", "NewCommand", "(", "\"", "\"", ",", "stringifyArg", "(", "\"", "\"", ",", "\"", "\"", ",", "host_name", ")", ",", "stringifyArg", "(", "\"", "\"", ",", "\"", "\"", ",", "service_description", ")", ",", "stringifyArg", "(", "\"", "\"", ",", "\"", "\"", ",", "persistent", ")", ",", "stringifyArg", "(", "\"", "\"", ",", "\"", "\"", ",", "author", ")", ",", "stringifyArg", "(", "\"", "\"", ",", "\"", "\"", ",", "comment", ")", ",", ")", "\n", "}" ]
12,760
all-12761
[ "Params", "store", "the", "mapping", "of", "ParamName", "-", ">", "Parameter", "for", "the", "given", "structure", ".", "Since", "multiple", "names", "can", "be", "affected", "to", "a", "single", "parameter", "multiple", "keys", "can", "be", "associated", "with", "a", "single", "parameter", "." ]
[ "func", "MakeParams", "(", "fieldCount", "int", ")", "*", "Params", "{", "return", "&", "Params", "{", "<mask>", "(", "map", "[", "string", "]", "*", "Parameter", ")", ",", "make", "(", "[", "]", "*", "Parameter", ",", "0", ",", "fieldCount", ")", ",", "}", "\n", "}" ]
12,761
all-12762
[ "Push", "pushes", "this", "LuaObject", "on", "the", "stack", "." ]
[ "func", "(", "lo", "*", "LuaObject", ")", "Push", "(", ")", "{", "lo", ".", "l", ".", "RawGeti", "(", "lua", ".", "LUA_REGISTRYINDEX", ",", "lo", ".", "<mask>", ")", "\n", "}" ]
12,762
all-12763
[ "Update", "executes", "a", "function", "creating", "and", "managing", "a", "read", "-", "write", "transaction", "for", "the", "user", ".", "Error", "returned", "by", "the", "function", "is", "relayed", "by", "the", "Update", "method", ".", "Update", "cannot", "be", "used", "with", "managed", "transactions", "." ]
[ "func", "(", "db", "*", "DB", ")", "Update", "(", "fn", "func", "(", "txn", "*", "Txn", ")", "error", ")", "error", "{", "if", "db", ".", "<mask>", ".", "managedTxns", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "txn", ":=", "db", ".", "NewTransaction", "(", "true", ")", "\n", "defer", "txn", ".", "Discard", "(", ")", "\n\n", "if", "err", ":=", "fn", "(", "txn", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "txn", ".", "Commit", "(", ")", "\n", "}" ]
12,763
all-12764
[ "Do", "should", "be", "called", "by", "workers", "before", "they", "start", "working", ".", "It", "blocks", "if", "there", "are", "already", "maximum", "number", "of", "workers", "working", ".", "If", "it", "detects", "an", "error", "from", "previously", "Done", "workers", "it", "would", "return", "it", "." ]
[ "func", "(", "t", "*", "Throttle", ")", "Do", "(", ")", "error", "{", "for", "{", "select", "{", "<mask>", "t", ".", "ch", "<-", "struct", "{", "}", "{", "}", ":", "t", ".", "wg", ".", "Add", "(", "1", ")", "\n", "return", "nil", "\n", "case", "err", ":=", "<-", "t", ".", "errCh", ":", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "}", "\n", "}" ]
12,764
all-12765
[ "Append", "the", "new", "entries", "to", "storage", ".", "TODO", "(", "xiangli", ")", ":", "ensure", "the", "entries", "are", "continuous", "and", "entries", "[", "0", "]", ".", "Index", ">", "ms", ".", "entries", "[", "0", "]", ".", "Index" ]
[ "func", "(", "ms", "*", "MemoryStorage", ")", "Append", "(", "entries", "[", "]", "pb", ".", "Entry", ")", "error", "{", "if", "len", "(", "entries", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "ms", ".", "Lock", "(", ")", "\n", "defer", "ms", ".", "Unlock", "(", ")", "\n\n", "first", ":=", "ms", ".", "firstIndex", "(", ")", "\n", "last", ":=", "entries", "[", "0", "]", ".", "Index", "+", "uint64", "(", "len", "(", "entries", ")", ")", "-", "1", "\n\n", "// shortcut if there is no new entry.", "if", "last", "<", "first", "{", "return", "nil", "\n", "}", "\n", "// truncate compacted entries", "if", "first", ">", "entries", "[", "0", "]", ".", "Index", "{", "entries", "=", "entries", "[", "first", "-", "entries", "[", "0", "]", ".", "Index", ":", "]", "\n", "}", "\n\n", "offset", ":=", "entries", "[", "0", "]", ".", "Index", "-", "ms", ".", "ents", "[", "0", "]", ".", "Index", "\n", "switch", "{", "case", "uint64", "(", "len", "(", "ms", ".", "ents", ")", ")", ">", "offset", ":", "ms", ".", "ents", "=", "append", "(", "[", "]", "pb", ".", "Entry", "{", "}", ",", "ms", ".", "ents", "[", ":", "offset", "]", "...", ")", "\n", "<mask>", ".", "ents", "=", "append", "(", "ms", ".", "ents", ",", "entries", "...", ")", "\n", "case", "uint64", "(", "len", "(", "ms", ".", "ents", ")", ")", "==", "offset", ":", "ms", ".", "ents", "=", "append", "(", "ms", ".", "ents", ",", "entries", "...", ")", "\n", "default", ":", "raftLogger", ".", "Panicf", "(", "\"", "\"", ",", "ms", ".", "lastIndex", "(", ")", ",", "entries", "[", "0", "]", ".", "Index", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
12,765
all-12766
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "RecordClockSyncMarkerParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoTracing4", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
12,766
all-12767
[ "Check", "that", "cluster", "-", "related", "preconditions", "are", "met", "for", "leaving", "a", "cluster", "." ]
[ "func", "membershipCheckClusterStateForLeave", "(", "tx", "*", "db", ".", "ClusterTx", ",", "nodeID", "int64", ")", "error", "{", "// Check that it has no containers or images.", "message", ",", "err", ":=", "<mask>", ".", "NodeIsEmpty", "(", "nodeID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "message", "!=", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "message", ")", "\n", "}", "\n\n", "// Check that it's not the last node.", "nodes", ",", "err", ":=", "tx", ".", "Nodes", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "len", "(", "nodes", ")", "==", "1", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
12,767
all-12768
[ "Next", "implements", "storage", ".", "SeriesIterator", "." ]
[ "func", "(", "c", "*", "concreteSeriesIterator", ")", "Next", "(", ")", "bool", "{", "c", ".", "cur", "++", "\n", "return", "c", ".", "cur", "<", "len", "(", "c", ".", "<mask>", ".", "samples", ")", "\n", "}" ]
12,768
all-12769
[ "ArmForSwitch", "returns", "which", "field", "name", "should", "be", "used", "for", "storing", "the", "value", "for", "an", "instance", "of", "ManageOfferSuccessResultOffer" ]
[ "func", "(", "u", "ManageOfferSuccessResultOffer", ")", "ArmForSwitch", "(", "sw", "int32", ")", "(", "string", ",", "bool", ")", "{", "switch", "ManageOfferEffect", "(", "sw", ")", "{", "case", "ManageOfferEffectManageOfferCreated", ":", "return", "\"", "\"", ",", "true", "\n", "case", "ManageOfferEffectManageOfferUpdated", ":", "return", "\"", "\"", ",", "true", "\n", "default", ":", "return", "\"", "\"", ",", "<mask>", "\n", "}", "\n", "}" ]
12,769
all-12770
[ "UnmarshalJSON", "for", "TransportProtocol", "determines", "whether", "to", "use", "TCP", "or", "UDP", "setting", "TCP", "as", "the", "zero", "-", "value", "but", "treating", "other", "unrecognized", "values", "as", "errors" ]
[ "func", "(", "tp", "*", "TransportProtocol", ")", "UnmarshalJSON", "(", "b", "[", "]", "byte", ")", "error", "{", "if", "strings", ".", "ToLower", "(", "string", "(", "b", ")", ")", "==", "\"", "\"", "{", "*", "tp", "=", "TransportProtocolTCP", "\n", "seelog", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "nil", "\n", "}", "\n", "switch", "string", "(", "b", ")", "{", "case", "`\"tcp\"`", ":", "*", "tp", "=", "TransportProtocolTCP", "\n", "case", "`\"udp\"`", ":", "*", "tp", "=", "TransportProtocolUDP", "\n", "<mask>", ":", "*", "tp", "=", "TransportProtocolTCP", "\n", "return", "errors", ".", "New", "(", "\"", "\\\"", "\\\"", "\\\"", "\\\"", "\"", "+", "string", "(", "b", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
12,770
all-12771
[ "Post", "-" ]
[ "func", "(", "gateway", "*", "DefaultHttpGateway", ")", "Post", "(", "entity", "HttpRequestEntity", ",", "body", "io", ".", "Reader", ")", "RequestAdaptor", "{", "return", "func", "(", ")", "(", "*", "http", ".", "Response", ",", "error", ")", "{", "return", "<mask>", "(", "entity", ",", "\"", "\"", ",", "body", ")", "\n", "}", "\n", "}" ]
12,771
all-12772
[ "QueryDiskType", "queries", "the", "disk", "type", "of", "the", "specified", "virtual", "disk", "." ]
[ "func", "QueryDiskType", "(", "client", "*", "govmomi", ".", "Client", ",", "name", "string", ",", "dc", "*", "<mask>", ".", "Datacenter", ")", "(", "types", ".", "VirtualDiskType", ",", "error", ")", "{", "vdm", ":=", "object", ".", "NewVirtualDiskManager", "(", "client", ".", "Client", ")", "\n", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "provider", ".", "DefaultAPITimeout", ")", "\n", "defer", "cancel", "(", ")", "\n", "di", ",", "err", ":=", "vdm", ".", "QueryVirtualDiskInfo", "(", "ctx", ",", "name", ",", "dc", ",", "false", ")", "\n", "if", "err", "!=", "nil", "{", "return", "types", ".", "VirtualDiskType", "(", "\"", "\"", ")", ",", "err", "\n", "}", "\n", "t", ":=", "di", "[", "0", "]", ".", "DiskType", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "name", ",", "t", ")", "\n", "return", "types", ".", "VirtualDiskType", "(", "t", ")", ",", "nil", "\n", "}" ]
12,772
all-12773
[ "GetApmQuery", "returns", "the", "ApmQuery", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "q", "*", "QueryValueRequest", ")", "GetApmQuery", "(", ")", "WidgetApmOrLogQuery", "{", "if", "q", "==", "nil", "||", "q", ".", "ApmQuery", "==", "nil", "{", "return", "WidgetApmOrLogQuery", "{", "}", "\n", "}", "\n", "<mask>", "*", "q", ".", "ApmQuery", "\n", "}" ]
12,773
all-12774
[ "SetMarginBottom", "is", "a", "wrapper", "around", "gtk_widget_set_margin_bottom", "()", "." ]
[ "func", "(", "v", "*", "Widget", ")", "SetMarginBottom", "(", "margin", "int", ")", "{", "C", ".", "gtk_widget_set_margin_bottom", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "<mask>", ")", ")", "\n", "}" ]
12,774
all-12775
[ "options", "transforms", "package", "-", "relative", "paths", "in", "cgo", "options", "into", "repository", "-", "root", "-", "relative", "paths", "that", "Bazel", "can", "understand", ".", "For", "example", "if", "a", "cgo", "file", "in", "//", "foo", "declares", "an", "include", "flag", "in", "its", "copts", ":", "-", "Ibar", "this", "method", "will", "transform", "that", "flag", "into", "-", "Ifoo", "/", "bar", "." ]
[ "func", "(", "g", "*", "generator", ")", "options", "(", "opts", "rule", ".", "PlatformStrings", ",", "pkgRel", "string", ")", "rule", ".", "PlatformStrings", "{", "fixPath", ":=", "func", "(", "opt", "string", ")", "string", "{", "if", "strings", ".", "HasPrefix", "(", "opt", ",", "\"", "\"", ")", "{", "return", "opt", "\n", "}", "\n", "return", "path", ".", "Clean", "(", "path", ".", "Join", "(", "pkgRel", ",", "opt", ")", ")", "\n", "}", "\n\n", "fixGroups", ":=", "func", "(", "groups", "[", "]", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "fixedGroups", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "groups", ")", ")", "\n", "for", "i", ",", "group", ":=", "range", "groups", "{", "opts", ":=", "strings", ".", "Split", "(", "group", ",", "optSeparator", ")", "\n", "fixedOpts", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "opts", ")", ")", "\n", "isPath", ":=", "false", "\n", "for", "j", ",", "opt", ":=", "range", "opts", "{", "if", "isPath", "{", "<mask>", "=", "fixPath", "(", "opt", ")", "\n", "isPath", "=", "false", "\n", "goto", "next", "\n", "}", "\n\n", "for", "_", ",", "short", ":=", "range", "shortOptPrefixes", "{", "if", "strings", ".", "HasPrefix", "(", "opt", ",", "short", ")", "&&", "len", "(", "opt", ")", ">", "len", "(", "short", ")", "{", "opt", "=", "short", "+", "fixPath", "(", "opt", "[", "len", "(", "short", ")", ":", "]", ")", "\n", "goto", "next", "\n", "}", "\n", "}", "\n\n", "for", "_", ",", "long", ":=", "range", "longOptPrefixes", "{", "if", "opt", "==", "long", "{", "isPath", "=", "true", "\n", "goto", "next", "\n", "}", "\n", "}", "\n\n", "next", ":", "fixedOpts", "[", "j", "]", "=", "escapeOption", "(", "opt", ")", "\n", "}", "\n", "fixedGroups", "[", "i", "]", "=", "strings", ".", "Join", "(", "fixedOpts", ",", "\"", "\"", ")", "\n", "}", "\n\n", "return", "fixedGroups", ",", "nil", "\n", "}", "\n\n", "opts", ",", "errs", ":=", "opts", ".", "MapSlice", "(", "fixGroups", ")", "\n", "if", "errs", "!=", "nil", "{", "log", ".", "Panicf", "(", "\"", "\"", ",", "pkgRel", ",", "errs", ")", "\n", "}", "\n", "return", "opts", "\n", "}" ]
12,775
all-12776
[ "DetectCompression", "returns", "a", "DecompressorFunc", "if", "the", "input", "is", "recognized", "as", "a", "compressed", "format", "nil", "otherwise", ".", "Because", "it", "consumes", "the", "start", "of", "input", "other", "consumers", "must", "use", "the", "returned", "io", ".", "Reader", "instead", "to", "also", "read", "from", "the", "beginning", "." ]
[ "func", "DetectCompression", "(", "input", "io", ".", "Reader", ")", "(", "DecompressorFunc", ",", "io", ".", "Reader", ",", "error", ")", "{", "buffer", ":=", "[", "8", "]", "byte", "{", "}", "\n\n", "n", ",", "err", ":=", "io", ".", "ReadAtLeast", "(", "input", ",", "buffer", "[", ":", "]", ",", "len", "(", "buffer", ")", ")", "\n", "if", "err", "!=", "nil", "&&", "err", "!=", "io", ".", "EOF", "&&", "err", "!=", "io", ".", "ErrUnexpectedEOF", "{", "// This is a “real” error. We could just ignore it this time, process the data we have, and hope that the source will report the same error again.", "// Instead, fail immediately with the original error cause instead of a possibly secondary/misleading error returned later.", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "var", "decompressor", "DecompressorFunc", "\n", "for", "name", ",", "algo", ":=", "range", "compressionAlgos", "{", "if", "bytes", ".", "HasPrefix", "(", "buffer", "[", ":", "n", "]", ",", "algo", ".", "prefix", ")", "{", "logrus", ".", "Debugf", "(", "\"", "\"", ",", "name", ")", "\n", "decompressor", "=", "algo", ".", "decompressor", "\n", "break", "\n", "}", "\n", "}", "\n", "if", "decompressor", "==", "nil", "{", "logrus", ".", "Debugf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "decompressor", ",", "io", ".", "MultiReader", "(", "<mask>", ".", "NewReader", "(", "buffer", "[", ":", "n", "]", ")", ",", "input", ")", ",", "nil", "\n", "}" ]
12,776
all-12777
[ "RemoveId", "is", "a", "convenience", "helper", "equivalent", "to", ":", "err", ":", "=", "collection", ".", "Remove", "(", "bson", ".", "M", "{", "_id", ":", "id", "}", ")", "See", "the", "Remove", "method", "for", "more", "details", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "RemoveId", "(", "id", "interface", "{", "}", ")", "error", "{", "return", "c", ".", "Remove", "(", "bson", ".", "D", "{", "{", "\"", "\"", ",", "id", "}", "}", ")", "\n", "}" ]
12,777
all-12778
[ "AddLGTMer", "adds", "a", "new", "LGTM", "Approver" ]
[ "func", "(", "ap", "*", "Approvers", ")", "AddLGTMer", "(", "login", ",", "reference", "string", ",", "noIssue", "bool", ")", "{", "if", "ap", ".", "shouldNotOverrideApproval", "(", "login", ",", "noIssue", ")", "{", "return", "\n", "}", "\n", "ap", ".", "approvers", "[", "strings", ".", "ToLower", "(", "login", ")", "]", "=", "Approval", "{", "Login", ":", "login", ",", "How", ":", "\"", "\"", ",", "Reference", ":", "<mask>", ",", "NoIssue", ":", "noIssue", ",", "}", "\n", "}" ]
12,778
all-12779
[ "EngineQueryFunc", "returns", "a", "new", "query", "function", "that", "executes", "instant", "queries", "against", "the", "given", "engine", ".", "It", "converts", "scalar", "into", "vector", "results", "." ]
[ "func", "EngineQueryFunc", "(", "engine", "*", "promql", ".", "Engine", ",", "q", "storage", ".", "Queryable", ")", "QueryFunc", "{", "return", "func", "(", "ctx", "<mask>", ".", "Context", ",", "qs", "string", ",", "t", "time", ".", "Time", ")", "(", "promql", ".", "Vector", ",", "error", ")", "{", "q", ",", "err", ":=", "engine", ".", "NewInstantQuery", "(", "q", ",", "qs", ",", "t", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "res", ":=", "q", ".", "Exec", "(", "ctx", ")", "\n", "if", "res", ".", "Err", "!=", "nil", "{", "return", "nil", ",", "res", ".", "Err", "\n", "}", "\n", "switch", "v", ":=", "res", ".", "Value", ".", "(", "type", ")", "{", "case", "promql", ".", "Vector", ":", "return", "v", ",", "nil", "\n", "case", "promql", ".", "Scalar", ":", "return", "promql", ".", "Vector", "{", "promql", ".", "Sample", "{", "Point", ":", "promql", ".", "Point", "(", "v", ")", ",", "Metric", ":", "labels", ".", "Labels", "{", "}", ",", "}", "}", ",", "nil", "\n", "default", ":", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "}" ]
12,779
all-12780
[ "Execute", "-", "updates", "spaces", "metadata" ]
[ "func", "(", "c", "*", "UpdateSpacesMetadataCommand", ")", "Execute", "(", "[", "]", "string", ")", "error", "{", "<mask>", "cfMgmt", "*", "CFMgmt", "\n", "var", "err", "error", "\n", "if", "cfMgmt", ",", "err", "=", "InitializePeekManagers", "(", "c", ".", "BaseCFConfigCommand", ",", "c", ".", "Peek", ")", ";", "err", "==", "nil", "{", "err", "=", "cfMgmt", ".", "SpaceManager", ".", "UpdateSpacesMetadata", "(", ")", "\n", "}", "\n", "return", "err", "\n", "}" ]
12,780
all-12781
[ "Populate", "the", "incomplete", "Objects", "." ]
[ "func", "(", "g", "*", "Graph", ")", "Populate", "(", ")", "error", "{", "for", "_", ",", "o", ":=", "range", "g", ".", "named", "{", "if", "o", ".", "Complete", "{", "continue", "\n", "}", "\n\n", "if", "err", ":=", "g", ".", "populateExplicit", "(", "o", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "// We append and modify our slice as we go along, so we don't use a standard", "// range loop, and do a single pass thru each object in our graph.", "i", ":=", "0", "\n", "for", "{", "if", "i", "==", "len", "(", "g", ".", "unnamed", ")", "{", "break", "\n", "}", "\n\n", "o", ":=", "g", ".", "unnamed", "[", "i", "]", "\n", "i", "++", "\n\n", "if", "o", ".", "Complete", "{", "continue", "\n", "}", "\n\n", "if", "err", ":=", "g", ".", "populateExplicit", "(", "o", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "// A Second pass handles injecting Interface values to ensure we have created", "// all concrete types first.", "for", "_", ",", "o", ":=", "range", "g", ".", "unnamed", "{", "if", "o", ".", "Complete", "{", "<mask>", "\n", "}", "\n\n", "if", "err", ":=", "g", ".", "populateUnnamedInterface", "(", "o", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "for", "_", ",", "o", ":=", "range", "g", ".", "named", "{", "if", "o", ".", "Complete", "{", "continue", "\n", "}", "\n\n", "if", "err", ":=", "g", ".", "populateUnnamedInterface", "(", "o", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
12,781
all-12782
[ "SetMnemonicWidget", "is", "a", "wrapper", "around", "gtk_label_set_mnemonic_widget", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "SetMnemonicWidget", "(", "widget", "IWidget", ")", "{", "C", ".", "gtk_label_set_mnemonic_widget", "(", "v", ".", "native", "(", ")", ",", "widget", ".", "toWidget", "(", ")", ")", "\n", "}" ]
12,782
all-12783
[ "UntrustedSignatureContents", "returns", "UNTRUSTED", "contents", "of", "the", "signature", "WITHOUT", "ANY", "VERIFICATION", "along", "with", "a", "short", "identifier", "of", "the", "key", "used", "for", "signing", ".", "WARNING", ":", "The", "short", "key", "identifier", "(", "which", "correponds", "to", "Key", "ID", "for", "OpenPGP", "keys", ")", "is", "NOT", "the", "same", "as", "a", "key", "identity", "used", "in", "other", "calls", "ot", "this", "interface", "and", "the", "values", "may", "have", "no", "recognizable", "relationship", "if", "the", "public", "key", "is", "not", "available", "." ]
[ "func", "(", "m", "openpgpSigningMechanism", ")", "UntrustedSignatureContents", "(", "untrustedSignature", "[", "]", "byte", ")", "(", "untrustedContents", "[", "]", "<mask>", ",", "shortKeyIdentifier", "string", ",", "err", "error", ")", "{", "return", "gpgUntrustedSignatureContents", "(", "untrustedSignature", ")", "\n", "}" ]
12,783
all-12784
[ "MarshalYAML", "implements", "the", "yaml", ".", "Marshaler", "interface", "." ]
[ "func", "(", "<mask>", "Regexp", ")", "MarshalYAML", "(", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "if", "re", ".", "original", "!=", "\"", "\"", "{", "return", "re", ".", "original", ",", "nil", "\n", "}", "\n", "return", "nil", ",", "nil", "\n", "}" ]
12,784
all-12785
[ "/", "*", "GetAppsApp", "gets", "information", "for", "a", "app" ]
[ "func", "(", "a", "*", "Client", ")", "GetAppsApp", "(", "params", "*", "GetAppsAppParams", ")", "(", "*", "GetAppsAppOK", ",", "error", ")", "{", "// TODO: Validate the params before sending", "if", "params", "==", "nil", "{", "params", "=", "NewGetAppsAppParams", "(", ")", "\n", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "transport", ".", "Submit", "(", "&", "runtime", ".", "ClientOperation", "{", "ID", ":", "\"", "\"", ",", "Method", ":", "\"", "\"", ",", "PathPattern", ":", "\"", "\"", ",", "ProducesMediaTypes", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "ConsumesMediaTypes", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "Schemes", ":", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", ",", "Params", ":", "params", ",", "Reader", ":", "&", "GetAppsAppReader", "{", "formats", ":", "a", ".", "formats", "}", ",", "Context", ":", "params", ".", "<mask>", ",", "Client", ":", "params", ".", "HTTPClient", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "result", ".", "(", "*", "GetAppsAppOK", ")", ",", "nil", "\n\n", "}" ]
12,785
all-12786
[ "GetImage", "returns", "an", "Image", "struct", "for", "the", "provided", "fingerprint" ]
[ "func", "(", "r", "*", "ProtocolSimpleStreams", ")", "GetImage", "(", "fingerprint", "string", ")", "(", "*", "api", ".", "<mask>", ",", "string", ",", "error", ")", "{", "image", ",", "err", ":=", "r", ".", "ssClient", ".", "GetImage", "(", "fingerprint", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "image", ",", "\"", "\"", ",", "err", "\n", "}" ]
12,786
all-12787
[ "NewHTTPRequest", "creates", "a", "new", "HTTP", "request", "from", "a", "given", "server", "request", "." ]
[ "func", "NewHTTPRequest", "(", "conf", "*", "Config", ",", "method", ",", "path", "string", ",", "req", "*", "Request", ")", "(", "*", "<mask>", ".", "Request", ",", "error", ")", "{", "return", "NewHTTPRequestWithURL", "(", "method", ",", "GetURL", "(", "conf", ",", "path", ")", ",", "req", ")", "\n", "}" ]
12,787
all-12788
[ "Bind", "to", "the", "given", "unix", "socket", "path", "." ]
[ "func", "socketUnixListen", "(", "<mask>", "string", ")", "(", "net", ".", "Listener", ",", "error", ")", "{", "addr", ",", "err", ":=", "net", ".", "ResolveUnixAddr", "(", "\"", "\"", ",", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "listener", ",", "err", ":=", "net", ".", "ListenUnix", "(", "\"", "\"", ",", "addr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "return", "listener", ",", "err", "\n\n", "}" ]
12,788
all-12789
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "FontSizes", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage48", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
12,789
all-12790
[ "ApiClients", "retrieves", "a", "list", "of", "all", "API", "clients" ]
[ "func", "(", "c", "*", "<mask>", ")", "ApiClients", "(", ")", "(", "[", "]", "ApiClient", ",", "error", ")", "{", "var", "apiClients", "[", "]", "ApiClient", "\n", "_", ",", "err", ":=", "c", ".", "MakeApiRequest", "(", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "&", "apiClients", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "apiClients", ",", "err", "\n", "}" ]
12,790
all-12791
[ "addExternalLabels", "adds", "matchers", "for", "each", "external", "label", ".", "External", "labels", "that", "already", "have", "a", "corresponding", "user", "-", "supplied", "matcher", "are", "skipped", "as", "we", "assume", "that", "the", "user", "explicitly", "wants", "to", "select", "a", "different", "value", "for", "them", ".", "We", "return", "the", "new", "set", "of", "matchers", "along", "with", "a", "map", "of", "labels", "for", "which", "matchers", "were", "added", "so", "that", "these", "can", "later", "be", "removed", "from", "the", "result", "time", "series", "again", "." ]
[ "func", "(", "q", "externalLabelsQuerier", ")", "addExternalLabels", "(", "ms", "[", "]", "*", "labels", ".", "Matcher", ")", "(", "[", "]", "*", "labels", ".", "Matcher", ",", "labels", ".", "Labels", ")", "{", "el", ":=", "make", "(", "labels", ".", "Labels", ",", "len", "(", "q", ".", "externalLabels", ")", ")", "\n", "copy", "(", "el", ",", "q", ".", "externalLabels", ")", "\n\n", "// ms won't be sorted, so have to O(n^2) the search.", "for", "_", ",", "m", ":=", "range", "ms", "{", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "el", ")", ";", "{", "if", "el", "[", "i", "]", ".", "Name", "==", "m", ".", "Name", "{", "el", "=", "el", "[", ":", "i", "+", "copy", "(", "<mask>", "[", "i", ":", "]", ",", "el", "[", "i", "+", "1", ":", "]", ")", "]", "\n", "continue", "\n", "}", "\n", "i", "++", "\n", "}", "\n", "}", "\n\n", "for", "_", ",", "l", ":=", "range", "el", "{", "m", ",", "err", ":=", "labels", ".", "NewMatcher", "(", "labels", ".", "MatchEqual", ",", "l", ".", "Name", ",", "l", ".", "Value", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "ms", "=", "append", "(", "ms", ",", "m", ")", "\n", "}", "\n", "return", "ms", ",", "el", "\n", "}" ]
12,791
all-12792
[ "SetUsePopover", "is", "a", "wrapper", "around", "gtk_menu_button_set_use_popover", "()", "." ]
[ "func", "(", "v", "*", "MenuButton", ")", "SetUsePopover", "(", "<mask>", "bool", ")", "{", "C", ".", "gtk_menu_button_set_use_popover", "(", "v", ".", "native", "(", ")", ",", "gbool", "(", "setting", ")", ")", "\n", "}" ]
12,792
all-12793
[ "title", ":", "app", "update", "path", ":", "/", "apps", "/", "{", "name", "}", "method", ":", "PUT", "consume", ":", "application", "/", "x", "-", "www", "-", "form", "-", "urlencoded", "produce", ":", "application", "/", "x", "-", "json", "-", "stream", "responses", ":", "200", ":", "App", "updated", "400", ":", "Invalid", "new", "pool", "401", ":", "Unauthorized", "404", ":", "Not", "found" ]
[ "func", "updateApp", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "var", "ia", "inputApp", "\n", "err", "=", "ParseInput", "(", "r", ",", "&", "ia", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "imageReset", ",", "_", ":=", "strconv", ".", "ParseBool", "(", "InputValue", "(", "r", ",", "\"", "\"", ")", ")", "\n", "updateData", ":=", "app", ".", "App", "{", "TeamOwner", ":", "ia", ".", "TeamOwner", ",", "Plan", ":", "appTypes", ".", "Plan", "{", "Name", ":", "ia", ".", "Plan", "}", ",", "Pool", ":", "ia", ".", "Pool", ",", "Description", ":", "ia", ".", "Description", ",", "Router", ":", "ia", ".", "Router", ",", "Tags", ":", "ia", ".", "Tags", ",", "Platform", ":", "InputValue", "(", "r", ",", "\"", "\"", ")", ",", "UpdatePlatform", ":", "imageReset", ",", "RouterOpts", ":", "ia", ".", "RouterOpts", ",", "}", "\n", "tags", ",", "_", ":=", "InputValues", "(", "r", ",", "\"", "\"", ")", "\n", "updateData", ".", "Tags", "=", "append", "(", "updateData", ".", "Tags", ",", "tags", "...", ")", "// for compatibility", "\n", "appName", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "a", ",", "err", ":=", "getAppFromContext", "(", "appName", ",", "r", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "var", "wantedPerms", "[", "]", "*", "permission", ".", "PermissionScheme", "\n", "if", "updateData", ".", "Router", "!=", "\"", "\"", "||", "len", "(", "updateData", ".", "RouterOpts", ")", ">", "0", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "\"", "\"", "}", "\n", "}", "\n", "if", "updateData", ".", "Description", "!=", "\"", "\"", "{", "wantedPerms", "=", "append", "(", "wantedPerms", ",", "permission", ".", "PermAppUpdateDescription", ")", "\n", "}", "\n", "if", "len", "(", "updateData", ".", "Tags", ")", ">", "0", "{", "wantedPerms", "=", "append", "(", "wantedPerms", ",", "permission", ".", "PermAppUpdateTags", ")", "\n", "}", "\n", "if", "updateData", ".", "Plan", ".", "Name", "!=", "\"", "\"", "{", "wantedPerms", "=", "append", "(", "wantedPerms", ",", "permission", ".", "PermAppUpdatePlan", ")", "\n", "}", "\n", "if", "updateData", ".", "Pool", "!=", "\"", "\"", "{", "wantedPerms", "=", "<mask>", "(", "wantedPerms", ",", "permission", ".", "PermAppUpdatePool", ")", "\n", "}", "\n", "if", "updateData", ".", "TeamOwner", "!=", "\"", "\"", "{", "wantedPerms", "=", "append", "(", "wantedPerms", ",", "permission", ".", "PermAppUpdateTeamowner", ")", "\n", "}", "\n", "if", "updateData", ".", "Platform", "!=", "\"", "\"", "{", "repo", ",", "_", ":=", "image", ".", "SplitImageName", "(", "updateData", ".", "Platform", ")", "\n", "platform", ",", "errPlat", ":=", "servicemanager", ".", "Platform", ".", "FindByName", "(", "repo", ")", "\n", "if", "errPlat", "!=", "nil", "{", "return", "errPlat", "\n", "}", "\n", "if", "platform", ".", "Disabled", "{", "canUsePlat", ":=", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermPlatformUpdate", ")", "||", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermPlatformCreate", ")", "\n", "if", "!", "canUsePlat", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "appTypes", ".", "ErrInvalidPlatform", ".", "Error", "(", ")", "}", "\n", "}", "\n", "}", "\n", "wantedPerms", "=", "append", "(", "wantedPerms", ",", "permission", ".", "PermAppUpdatePlatform", ")", "\n", "updateData", ".", "UpdatePlatform", "=", "true", "\n", "}", "\n", "if", "updateData", ".", "UpdatePlatform", "{", "wantedPerms", "=", "append", "(", "wantedPerms", ",", "permission", ".", "PermAppUpdateImageReset", ")", "\n", "}", "\n", "if", "len", "(", "wantedPerms", ")", "==", "0", "{", "msg", ":=", "\"", "\"", "\n", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "msg", "}", "\n", "}", "\n", "for", "_", ",", "perm", ":=", "range", "wantedPerms", "{", "allowed", ":=", "permission", ".", "Check", "(", "t", ",", "perm", ",", "contextsForApp", "(", "&", "a", ")", "...", ",", ")", "\n", "if", "!", "allowed", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "}", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "appTarget", "(", "appName", ")", ",", "Kind", ":", "permission", ".", "PermAppUpdate", ",", "Owner", ":", "t", ",", "CustomData", ":", "event", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermAppReadEvents", ",", "contextsForApp", "(", "&", "a", ")", "...", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "keepAliveWriter", ":=", "tsuruIo", ".", "NewKeepAliveWriter", "(", "w", ",", "30", "*", "time", ".", "Second", ",", "\"", "\"", ")", "\n", "defer", "keepAliveWriter", ".", "Stop", "(", ")", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "writer", ":=", "&", "tsuruIo", ".", "SimpleJsonMessageEncoderWriter", "{", "Encoder", ":", "json", ".", "NewEncoder", "(", "keepAliveWriter", ")", "}", "\n", "evt", ".", "SetLogWriter", "(", "writer", ")", "\n", "err", "=", "a", ".", "Update", "(", "updateData", ",", "evt", ")", "\n", "if", "err", "==", "appTypes", ".", "ErrPlanNotFound", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "err", ".", "Error", "(", ")", "}", "\n", "}", "\n", "if", "_", ",", "ok", ":=", "err", ".", "(", "*", "router", ".", "ErrRouterNotFound", ")", ";", "ok", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "err", ".", "Error", "(", ")", "}", "\n", "}", "\n", "return", "err", "\n", "}" ]
12,793
all-12794
[ "Do", "executes", "Page", ".", "getResourceContent", "against", "the", "provided", "context", ".", "returns", ":", "content", "-", "Resource", "content", "." ]
[ "func", "(", "p", "*", "GetResourceContentParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "<mask>", "[", "]", "byte", ",", "err", "error", ")", "{", "// execute", "var", "res", "GetResourceContentReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetResourceContent", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// decode", "var", "dec", "[", "]", "byte", "\n", "if", "res", ".", "Base64encoded", "{", "dec", ",", "err", "=", "base64", ".", "StdEncoding", ".", "DecodeString", "(", "res", ".", "Content", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "else", "{", "dec", "=", "[", "]", "byte", "(", "res", ".", "Content", ")", "\n", "}", "\n", "return", "dec", ",", "nil", "\n", "}" ]
12,794
all-12795
[ "PanicIfErr", "panics", "with", "a", "stack", "trace", "if", "any", "of", "the", "passed", "args", "is", "a", "non", "nil", "error" ]
[ "func", "PanicIfErr", "(", "args", "...", "interface", "{", "}", ")", "{", "for", "_", ",", "v", ":=", "<mask>", "args", "{", "if", "err", ",", "_", ":=", "v", ".", "(", "error", ")", ";", "err", "!=", "nil", "{", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\\n", "\\n", "\\n", "\"", ",", "err", ",", "StackTrace", "(", "2", ")", ")", ")", "\n", "}", "\n", "}", "\n", "}" ]
12,795
all-12796
[ "GetValueOk", "returns", "a", "tuple", "with", "the", "Value", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "c", "*", "ConditionalFormat", ")", "GetValueOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "c", "==", "nil", "||", "c", ".", "Value", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "c", ".", "<mask>", ",", "true", "\n", "}" ]
12,796
all-12797
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "ResolveAnimationParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoAnimation5", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
12,797
all-12798
[ "Run", "executes", "the", "command", "in", "app", "units", "sourcing", "apprc", "before", "running", "the", "command", "." ]
[ "func", "(", "app", "*", "App", ")", "Run", "(", "cmd", "string", ",", "w", "io", ".", "Writer", ",", "args", "provision", ".", "RunArgs", ")", "error", "{", "if", "!", "args", ".", "Isolated", "&&", "!", "app", ".", "available", "(", ")", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "app", ".", "Log", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "cmd", ")", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "logWriter", ":=", "LogWriter", "{", "App", ":", "app", ",", "Source", ":", "\"", "\"", "}", "\n", "logWriter", ".", "Async", "(", ")", "\n", "defer", "logWriter", ".", "Close", "(", ")", "\n", "return", "app", ".", "run", "(", "cmd", ",", "<mask>", ".", "MultiWriter", "(", "w", ",", "&", "logWriter", ")", ",", "args", ")", "\n", "}" ]
12,798
all-12799
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetDocumentContentParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage12", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
12,799
all-12800
[ "RemoveMnemonic", "is", "a", "wrapper", "around", "gtk_window_remove_mnemonic", "()", "." ]
[ "func", "(", "v", "*", "Window", ")", "RemoveMnemonic", "(", "keyval", "uint", ",", "<mask>", "*", "Widget", ")", "{", "C", ".", "gtk_window_remove_mnemonic", "(", "v", ".", "native", "(", ")", ",", "C", ".", "guint", "(", "keyval", ")", ",", "target", ".", "native", "(", ")", ")", "\n", "}" ]