id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequence
pl_tokens
sequence
0
all-1
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "ContextRealtimeData", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoWebaudio7", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
1
all-2
[ "HasActive", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "d", "*", "Downtime", ")", "HasActive", "(", ")", "bool", "{", "if", "d", "!=", "nil", "&&", "d", ".", "Active", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
2
all-3
[ "FindUnqualifiedSearchRegistries", "returns", "all", "registries", "that", "are", "configured", "for", "unqualified", "image", "search", "(", "i", ".", "e", ".", "with", "Registry", ".", "Search", "==", "true", ")", "." ]
[ "func", "FindUnqualifiedSearchRegistries", "(", "ctx", "*", "types", ".", "SystemContext", ")", "(", "[", "]", "Registry", ",", "error", ")", "{", "registries", ",", "err", ":=", "GetRegistries", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "unqualified", ":=", "[", "]", "Registry", "{", "}", "\n", "for", "_", ",", "reg", ":=", "<mask>", "registries", "{", "if", "reg", ".", "Search", "{", "unqualified", "=", "append", "(", "unqualified", ",", "reg", ")", "\n", "}", "\n", "}", "\n", "return", "unqualified", ",", "nil", "\n", "}" ]
3
all-4
[ "Int", "returns", "the", "int", "value", "stored", "in", "r", "." ]
[ "func", "(", "r", "<mask>", ")", "Int", "(", ")", "int64", "{", "if", "r", ".", "typ", ".", "Kind", "!=", "KindInt", "||", "r", ".", "typ", ".", "Size", "!=", "r", ".", "p", ".", "proc", ".", "PtrSize", "(", ")", "{", "panic", "(", "\"", "\"", "+", "r", ".", "typ", ".", "Name", ")", "\n", "}", "\n", "return", "r", ".", "p", ".", "proc", ".", "ReadInt", "(", "r", ".", "a", ")", "\n", "}" ]
4
all-5
[ "Set", "is", "required", "for", "kingpin", "interfaces", "to", "allow", "command", "line", "params", "to", "be", "set", "to", "our", "map", "datatype" ]
[ "func", "(", "o", "*", "MapInt8Option", ")", "Set", "(", "value", "string", ")", "error", "{", "parts", ":=", "stringMapRegex", ".", "Split", "(", "value", ",", "2", ")", "\n", "if", "len", "(", "parts", ")", "!=", "2", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "<mask>", ")", "\n", "}", "\n", "val", ":=", "Int8Option", "{", "}", "\n", "val", ".", "Set", "(", "parts", "[", "1", "]", ")", "\n", "(", "*", "o", ")", "[", "parts", "[", "0", "]", "]", "=", "val", "\n", "return", "nil", "\n", "}" ]
5
all-6
[ "Do", "executes", "Page", ".", "getResourceTree", "against", "the", "provided", "context", ".", "returns", ":", "frameTree", "-", "Present", "frame", "/", "resource", "tree", "structure", "." ]
[ "func", "(", "p", "*", "GetResourceTreeParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "frameTree", "*", "FrameResourceTree", ",", "err", "error", ")", "{", "// execute", "var", "<mask>", "GetResourceTreeReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetResourceTree", ",", "nil", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "FrameTree", ",", "nil", "\n", "}" ]
6
all-7
[ "NewGraphicContextWithPainter", "creates", "a", "new", "Graphic", "context", "from", "an", "image", "and", "a", "Painter", "(", "see", "Freetype", "-", "go", ")" ]
[ "func", "NewGraphicContextWithPainter", "(", "img", "draw", ".", "Image", ",", "painter", "Painter", ")", "*", "GraphicContext", "{", "width", ",", "height", ":=", "img", ".", "Bounds", "(", ")", ".", "Dx", "(", ")", ",", "img", ".", "Bounds", "(", ")", ".", "Dy", "(", ")", "\n", "dpi", ":=", "92", "\n", "gc", ":=", "&", "GraphicContext", "{", "draw2dbase", ".", "NewStackGraphicContext", "(", ")", ",", "img", ",", "painter", ",", "raster", ".", "NewRasterizer", "(", "width", ",", "<mask>", ")", ",", "raster", ".", "NewRasterizer", "(", "width", ",", "height", ")", ",", "draw2d", ".", "GetGlobalFontCache", "(", ")", ",", "draw2dbase", ".", "NewGlyphCache", "(", ")", ",", "&", "truetype", ".", "GlyphBuf", "{", "}", ",", "dpi", ",", "}", "\n", "return", "gc", "\n", "}" ]
7
all-8
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "RecordMode", ")", "MarshalEasyJSON", "(", "out", "*", "jwriter", ".", "Writer", ")", "{", "<mask>", ".", "String", "(", "string", "(", "t", ")", ")", "\n", "}" ]
8
all-9
[ "compact", "compacts", "a", "keyIndex", "by", "removing", "the", "versions", "with", "smaller", "or", "equal", "revision", "than", "the", "given", "atRev", "except", "the", "largest", "one", "(", "If", "the", "largest", "one", "is", "a", "tombstone", "it", "will", "not", "be", "kept", ")", ".", "If", "a", "generation", "becomes", "empty", "during", "compaction", "it", "will", "be", "removed", "." ]
[ "func", "(", "ki", "*", "keyIndex", ")", "compact", "(", "lg", "*", "zap", ".", "Logger", ",", "atRev", "int64", ",", "available", "<mask>", "[", "revision", "]", "struct", "{", "}", ")", "{", "if", "ki", ".", "isEmpty", "(", ")", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Panic", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "string", "(", "ki", ".", "key", ")", ")", ",", ")", "\n", "}", "else", "{", "plog", ".", "Panicf", "(", "\"", "\"", ",", "string", "(", "ki", ".", "key", ")", ")", "\n", "}", "\n", "}", "\n\n", "genIdx", ",", "revIndex", ":=", "ki", ".", "doCompact", "(", "atRev", ",", "available", ")", "\n\n", "g", ":=", "&", "ki", ".", "generations", "[", "genIdx", "]", "\n", "if", "!", "g", ".", "isEmpty", "(", ")", "{", "// remove the previous contents.", "if", "revIndex", "!=", "-", "1", "{", "g", ".", "revs", "=", "g", ".", "revs", "[", "revIndex", ":", "]", "\n", "}", "\n", "// remove any tombstone", "if", "len", "(", "g", ".", "revs", ")", "==", "1", "&&", "genIdx", "!=", "len", "(", "ki", ".", "generations", ")", "-", "1", "{", "delete", "(", "available", ",", "g", ".", "revs", "[", "0", "]", ")", "\n", "genIdx", "++", "\n", "}", "\n", "}", "\n\n", "// remove the previous generations.", "ki", ".", "generations", "=", "ki", ".", "generations", "[", "genIdx", ":", "]", "\n", "}" ]
9
all-10
[ "encodeHeader", "writes", "out", "a", "sorted", "list", "of", "headers", "." ]
[ "func", "(", "p", "*", "Part", ")", "encodeHeader", "(", "b", "*", "bufio", ".", "Writer", ")", "{", "keys", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "p", ".", "Header", ")", ")", "\n", "for", "k", ":=", "range", "p", ".", "Header", "{", "keys", "=", "<mask>", "(", "keys", ",", "k", ")", "\n", "}", "\n", "sort", ".", "Strings", "(", "keys", ")", "\n", "for", "_", ",", "k", ":=", "range", "keys", "{", "for", "_", ",", "v", ":=", "range", "p", ".", "Header", "[", "k", "]", "{", "encv", ":=", "v", "\n", "switch", "selectTransferEncoding", "(", "[", "]", "byte", "(", "v", ")", ",", "true", ")", "{", "case", "teBase64", ":", "encv", "=", "mime", ".", "BEncoding", ".", "Encode", "(", "utf8", ",", "v", ")", "\n", "case", "teQuoted", ":", "encv", "=", "mime", ".", "QEncoding", ".", "Encode", "(", "utf8", ",", "v", ")", "\n", "}", "\n", "// _ used to prevent early wrapping", "wb", ":=", "stringutil", ".", "Wrap", "(", "76", ",", "k", ",", "\"", "\"", ",", "encv", ",", "\"", "\\r", "\\n", "\"", ")", "\n", "wb", "[", "len", "(", "k", ")", "+", "1", "]", "=", "' '", "\n", "b", ".", "Write", "(", "wb", ")", "\n", "}", "\n", "}", "\n", "}" ]
10
all-11
[ "setAttributes", "parses", "the", "tokens", "and", "set", "attributes", "to", "the", "element", "." ]
[ "func", "(", "e", "*", "htmlTag", ")", "setAttributes", "(", ")", "error", "{", "parsedTokens", ":=", "e", ".", "parseTokens", "(", ")", "\n\n", "var", "i", "int", "\n", "var", "token", "string", "\n", "var", "setTextValue", "bool", "\n\n", "// Set attributes to the element.", "for", "i", ",", "token", "=", "range", "parsedTokens", "{", "kv", ":=", "strings", ".", "Split", "(", "token", ",", "equal", ")", "\n\n", "if", "len", "(", "kv", ")", "<", "2", "{", "setTextValue", "=", "true", "\n", "break", "\n", "}", "\n\n", "k", ":=", "kv", "[", "0", "]", "\n", "v", ":=", "strings", ".", "Join", "(", "kv", "[", "1", ":", "]", ",", "equal", ")", "\n\n", "// Remove the prefix and suffix of the double quotes.", "if", "len", "(", "v", ")", ">", "1", "&&", "strings", ".", "HasPrefix", "(", "v", ",", "doubleQuote", ")", "&&", "strings", ".", "HasSuffix", "(", "v", ",", "doubleQuote", ")", "{", "v", "=", "v", "[", "1", ":", "len", "(", "v", ")", "-", "1", "]", "\n", "}", "\n\n", "switch", "k", "{", "case", "attributeNameID", ":", "if", "e", ".", "id", "!=", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "e", ".", "ln", ".", "fileName", "(", ")", ",", "e", ".", "ln", ".", "no", ")", "\n", "}", "\n", "e", ".", "id", "=", "v", "\n", "case", "e", ".", "opts", ".", "AttributeNameClass", ":", "e", ".", "classes", "=", "append", "(", "e", ".", "<mask>", ",", "strings", ".", "Split", "(", "v", ",", "space", ")", "...", ")", "\n", "default", ":", "e", ".", "attributes", "=", "append", "(", "e", ".", "attributes", ",", "htmlAttribute", "{", "k", ",", "v", "}", ")", "\n", "}", "\n", "}", "\n\n", "// Set a text value to the element.", "if", "setTextValue", "{", "e", ".", "textValue", "=", "strings", ".", "Join", "(", "parsedTokens", "[", "i", ":", "]", ",", "space", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
11
all-12
[ "NewContainerResponse", "creates", "a", "new", "container", "response", "based", "on", "container", "id" ]
[ "func", "NewContainerResponse", "(", "containerID", "string", ",", "<mask>", "dockerstate", ".", "TaskEngineState", ")", "(", "*", "ContainerResponse", ",", "error", ")", "{", "dockerContainer", ",", "ok", ":=", "state", ".", "ContainerByID", "(", "containerID", ")", "\n", "if", "!", "ok", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "containerID", ")", "\n", "}", "\n", "task", ",", "ok", ":=", "state", ".", "TaskByID", "(", "containerID", ")", "\n", "if", "!", "ok", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "containerID", ")", "\n", "}", "\n\n", "resp", ":=", "newContainerResponse", "(", "dockerContainer", ",", "task", ".", "GetTaskENI", "(", ")", ",", "state", ")", "\n", "return", "&", "resp", ",", "nil", "\n", "}" ]
12
all-13
[ "SnapshotSize", "returns", "the", "memory", "used", "by", "Nitro", "snapshot", "metadata" ]
[ "func", "SnapshotSize", "(", "p", "unsafe", ".", "Pointer", ")", "int", "{", "s", ":=", "(", "*", "Snapshot", ")", "(", "p", ")", "\n", "return", "int", "(", "unsafe", ".", "Sizeof", "(", "s", ".", "sn", ")", "+", "unsafe", ".", "Sizeof", "(", "s", ".", "refCount", ")", "+", "unsafe", ".", "Sizeof", "(", "s", ".", "<mask>", ")", "+", "unsafe", ".", "Sizeof", "(", "s", ".", "count", ")", "+", "unsafe", ".", "Sizeof", "(", "s", ".", "gclist", ")", ")", "\n", "}" ]
13
all-14
[ "Push", "puts", "files", "under", "root", "into", "an", "open", "commit", "." ]
[ "func", "Push", "(", "client", "*", "pachclient", ".", "APIClient", ",", "root", "string", ",", "commit", "*", "pfs", ".", "Commit", ",", "overwrite", "bool", ")", "error", "{", "var", "g", "errgroup", ".", "Group", "\n", "if", "err", ":=", "filepath", ".", "Walk", "(", "root", ",", "func", "(", "path", "string", ",", "info", "os", ".", "FileInfo", ",", "err", "error", ")", "error", "{", "g", ".", "Go", "(", "func", "(", ")", "(", "retErr", "error", ")", "{", "if", "path", "==", "root", "||", "info", ".", "IsDir", "(", ")", "{", "return", "nil", "\n", "}", "\n\n", "f", ",", "err", ":=", "os", ".", "Open", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "if", "err", ":=", "f", ".", "Close", "(", ")", ";", "err", "!=", "nil", "&&", "retErr", "==", "nil", "{", "retErr", "=", "err", "\n", "}", "\n", "}", "(", ")", "\n\n", "relPath", ",", "err", ":=", "filepath", ".", "Rel", "(", "root", ",", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "overwrite", "{", "if", "err", ":=", "client", ".", "DeleteFile", "(", "commit", ".", "Repo", ".", "Name", ",", "commit", ".", "ID", ",", "relPath", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "_", ",", "err", "=", "client", ".", "PutFile", "(", "commit", ".", "Repo", ".", "Name", ",", "<mask>", ".", "ID", ",", "relPath", ",", "f", ")", "\n", "return", "err", "\n", "}", ")", "\n", "return", "nil", "\n", "}", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "g", ".", "Wait", "(", ")", "\n", "}" ]
14
all-15
[ "updateLocations", "initializes", "LocalSrcPath", "and", "IsStdlib", "." ]
[ "func", "(", "c", "*", "Call", ")", "updateLocations", "(", "goroot", ",", "localgoroot", "string", ",", "gopaths", "map", "[", "string", "]", "string", ")", "{", "if", "c", ".", "SrcPath", "!=", "\"", "\"", "{", "// Always check GOROOT first, then GOPATH.", "if", "strings", ".", "HasPrefix", "(", "c", ".", "SrcPath", ",", "goroot", ")", "{", "// Replace remote GOROOT with local GOROOT.", "c", ".", "LocalSrcPath", "=", "filepath", ".", "Join", "(", "localgoroot", ",", "c", ".", "SrcPath", "[", "len", "(", "goroot", ")", ":", "]", ")", "\n", "}", "else", "{", "// Replace remote GOPATH with local GOPATH.", "c", ".", "LocalSrcPath", "=", "c", ".", "SrcPath", "\n", "// TODO(maruel): Sort for deterministic behavior?", "for", "prefix", ",", "dest", ":=", "range", "gopaths", "{", "if", "strings", ".", "HasPrefix", "(", "c", ".", "SrcPath", ",", "prefix", ")", "{", "c", ".", "LocalSrcPath", "=", "filepath", ".", "Join", "(", "dest", ",", "c", ".", "SrcPath", "[", "len", "(", "prefix", ")", ":", "]", ")", "\n", "<mask>", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "// Consider _test/_testmain.go as stdlib since it's injected by \"go test\".", "c", ".", "IsStdlib", "=", "(", "goroot", "!=", "\"", "\"", "&&", "strings", ".", "HasPrefix", "(", "c", ".", "SrcPath", ",", "goroot", ")", ")", "||", "c", ".", "PkgSrc", "(", ")", "==", "testMainSrc", "\n", "}" ]
15
all-16
[ "Run", "runs", "all", "registered", "non", "optional", "migrations", "if", "no", ".", "Name", "is", "informed", ".", "Migrations", "are", "executed", "in", "the", "order", "that", "they", "were", "registered", ".", "If", ".", "Name", "is", "informed", "an", "optional", "migration", "with", "the", "given", "name", "is", "executed", "." ]
[ "func", "Run", "(", "args", "RunArgs", ")", "error", "{", "if", "args", ".", "<mask>", "!=", "\"", "\"", "{", "return", "runOptional", "(", "args", ")", "\n", "}", "\n", "if", "args", ".", "Force", "{", "return", "ErrCannotForceMandatory", "\n", "}", "\n", "return", "run", "(", "args", ")", "\n", "}" ]
16
all-17
[ "BlobInfoFromOCI1Descriptor", "returns", "a", "types", ".", "BlobInfo", "based", "on", "the", "input", "OCI1", "descriptor", "." ]
[ "func", "BlobInfoFromOCI1Descriptor", "(", "desc", "imgspecv1", ".", "Descriptor", ")", "<mask>", ".", "BlobInfo", "{", "return", "types", ".", "BlobInfo", "{", "Digest", ":", "desc", ".", "Digest", ",", "Size", ":", "desc", ".", "Size", ",", "URLs", ":", "desc", ".", "URLs", ",", "Annotations", ":", "desc", ".", "Annotations", ",", "MediaType", ":", "desc", ".", "MediaType", ",", "}", "\n", "}" ]
17
all-18
[ "Wrap", "logrus", ".", "Logger" ]
[ "func", "Wrap", "(", "logger", "*", "logrus", ".", "Logger", ")", "<mask>", ".", "Interface", "{", "return", "&", "logrusEntryWrapper", "{", "logrus", ".", "NewEntry", "(", "logger", ")", "}", "\n", "}" ]
18
all-19
[ "SetMeta", "changes", "the", "optional", "metadata", "field", "associated", "with", "the", "file", ".", "The", "meaning", "of", "keys", "under", "that", "field", "is", "user", "-", "defined", ".", "For", "example", ":", "file", ".", "SetMeta", "(", "bson", ".", "M", "{", "inode", ":", "inode", "}", ")", "It", "is", "a", "runtime", "error", "to", "call", "this", "function", "when", "the", "file", "is", "not", "open", "for", "writing", "." ]
[ "func", "(", "file", "*", "GridFile", ")", "SetMeta", "(", "metadata", "interface", "{", "}", ")", "{", "file", ".", "assertMode", "(", "gfsWriting", ")", "\n", "data", ",", "err", ":=", "bson", ".", "Marshal", "(", "metadata", ")", "\n", "<mask>", ".", "m", ".", "Lock", "(", ")", "\n", "if", "err", "!=", "nil", "&&", "file", ".", "err", "==", "nil", "{", "file", ".", "err", "=", "err", "\n", "}", "else", "{", "file", ".", "doc", ".", "Metadata", "=", "&", "bson", ".", "Raw", "{", "Data", ":", "data", "}", "\n", "}", "\n", "file", ".", "m", ".", "Unlock", "(", ")", "\n", "}" ]
19
all-20
[ "Seek", "is", "implementation", "of", "io", ".", "Seeker", "s", "Seek", ".", "Note", "that", "Seek", "can", "take", "long", "since", "decoding", "is", "a", "relatively", "heavy", "task", "." ]
[ "func", "(", "s", "*", "Stream", ")", "Seek", "(", "offset", "int64", ",", "whence", "int", ")", "(", "int64", ",", "error", ")", "{", "return", "s", ".", "decoded", ".", "Seek", "(", "<mask>", ",", "whence", ")", "\n", "}" ]
20
all-21
[ "Check", "if", "a", "simple", "key", "may", "start", "at", "the", "current", "position", "and", "add", "it", "if", "needed", "." ]
[ "func", "yaml_parser_save_simple_key", "(", "parser", "*", "yaml_parser_t", ")", "bool", "{", "// A simple key is required at the current position if the scanner is in", "// the block context and the current column coincides with the indentation", "// level.", "required", ":=", "parser", ".", "flow_level", "==", "0", "&&", "parser", ".", "indent", "==", "parser", ".", "mark", ".", "column", "\n\n", "//", "// If the current position may start a simple key, save it.", "//", "if", "parser", ".", "simple_key_allowed", "{", "simple_key", ":=", "yaml_simple_key_t", "{", "possible", ":", "true", ",", "required", ":", "required", ",", "token_number", ":", "parser", ".", "tokens_parsed", "+", "(", "len", "(", "parser", ".", "tokens", ")", "-", "parser", ".", "tokens_head", ")", ",", "}", "\n", "simple_key", ".", "mark", "=", "parser", ".", "mark", "\n\n", "if", "!", "yaml_parser_remove_simple_key", "(", "parser", ")", "{", "return", "false", "\n", "}", "\n", "<mask>", ".", "simple_keys", "[", "len", "(", "parser", ".", "simple_keys", ")", "-", "1", "]", "=", "simple_key", "\n", "}", "\n", "return", "true", "\n", "}" ]
21
all-22
[ "Set", "populates", "ProjectsFlag", "upon", "flag", ".", "Parse", "()" ]
[ "func", "(", "p", "ProjectsFlag", ")", "Set", "(", "value", "string", ")", "error", "{", "parts", ":=", "strings", ".", "SplitN", "(", "<mask>", ",", "\"", "\"", ",", "2", ")", "\n", "if", "len", "(", "parts", ")", "!=", "2", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "value", ")", "\n", "}", "\n", "host", ":=", "parts", "[", "0", "]", "\n", "if", "_", ",", "ok", ":=", "p", "[", "host", "]", ";", "ok", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "host", ")", "\n", "}", "\n", "repos", ":=", "strings", ".", "Split", "(", "parts", "[", "1", "]", ",", "\"", "\"", ")", "\n", "p", "[", "host", "]", "=", "repos", "\n", "return", "nil", "\n", "}" ]
22
all-23
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "StartSamplingParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoMemory1", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
23
all-24
[ "AgentAfterCooperativeClose", "marks", "channel", "as", "closed", "coop", "." ]
[ "func", "(", "w", "*", "Worker", ")", "AgentAfterCooperativeClose", "(", "job", "*", "data", ".", "Job", ")", "error", "{", "logger", ":=", "w", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "job", ")", "\n", "channel", ",", "err", ":=", "w", ".", "relatedChannel", "(", "logger", ",", "job", ",", "data", ".", "JobAgentAfterCooperativeClose", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "w", ".", "db", ".", "InTransaction", "(", "func", "(", "<mask>", "*", "reform", ".", "TX", ")", "error", "{", "channel", ".", "ChannelStatus", "=", "data", ".", "ChannelClosedCoop", "\n", "if", "err", ":=", "tx", ".", "Update", "(", "channel", ")", ";", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrInternal", "\n", "}", "\n\n", "if", "err", ":=", "w", ".", "incrementCurrentSupply", "(", "logger", ",", "tx", ".", "Querier", ",", "channel", ".", "Offering", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "agent", ",", "err", ":=", "w", ".", "account", "(", "logger", ",", "channel", ".", "Agent", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "w", ".", "addJob", "(", "logger", ",", "tx", ",", "data", ".", "JobAccountUpdateBalances", ",", "data", ".", "JobAccount", ",", "agent", ".", "ID", ")", "\n", "}", ")", "\n", "}" ]
24
all-25
[ "lexInsideBraces", "scans", "the", "inside", "of", "a", "vector", "selector", ".", "Keywords", "are", "ignored", "and", "scanned", "as", "identifiers", "." ]
[ "func", "lexInsideBraces", "(", "l", "*", "lexer", ")", "stateFn", "{", "if", "strings", ".", "HasPrefix", "(", "l", ".", "input", "[", "l", ".", "<mask>", ":", "]", ",", "lineComment", ")", "{", "return", "lexLineComment", "\n", "}", "\n\n", "switch", "r", ":=", "l", ".", "next", "(", ")", ";", "{", "case", "r", "==", "eof", ":", "return", "l", ".", "errorf", "(", "\"", "\"", ")", "\n", "case", "isSpace", "(", "r", ")", ":", "return", "lexSpace", "\n", "case", "isAlpha", "(", "r", ")", ":", "l", ".", "backup", "(", ")", "\n", "return", "lexIdentifier", "\n", "case", "r", "==", "','", ":", "l", ".", "emit", "(", "ItemComma", ")", "\n", "case", "r", "==", "'\"'", "||", "r", "==", "'\\''", ":", "l", ".", "stringOpen", "=", "r", "\n", "return", "lexString", "\n", "case", "r", "==", "'`'", ":", "l", ".", "stringOpen", "=", "r", "\n", "return", "lexRawString", "\n", "case", "r", "==", "'='", ":", "if", "l", ".", "next", "(", ")", "==", "'~'", "{", "l", ".", "emit", "(", "ItemEQLRegex", ")", "\n", "break", "\n", "}", "\n", "l", ".", "backup", "(", ")", "\n", "l", ".", "emit", "(", "ItemEQL", ")", "\n", "case", "r", "==", "'!'", ":", "switch", "nr", ":=", "l", ".", "next", "(", ")", ";", "{", "case", "nr", "==", "'~'", ":", "l", ".", "emit", "(", "ItemNEQRegex", ")", "\n", "case", "nr", "==", "'='", ":", "l", ".", "emit", "(", "ItemNEQ", ")", "\n", "default", ":", "return", "l", ".", "errorf", "(", "\"", "\"", ",", "nr", ")", "\n", "}", "\n", "case", "r", "==", "'{'", ":", "return", "l", ".", "errorf", "(", "\"", "\"", ",", "r", ")", "\n", "case", "r", "==", "'}'", ":", "l", ".", "emit", "(", "ItemRightBrace", ")", "\n", "l", ".", "braceOpen", "=", "false", "\n\n", "if", "l", ".", "seriesDesc", "{", "return", "lexValueSequence", "\n", "}", "\n", "return", "lexStatements", "\n", "default", ":", "return", "l", ".", "errorf", "(", "\"", "\"", ",", "r", ")", "\n", "}", "\n", "return", "lexInsideBraces", "\n", "}" ]
25
all-26
[ "Init", "validates", "the", "provided", "config" ]
[ "func", "(", "s", "*", "S3", ")", "Init", "(", ")", "error", "{", "if", "s", ".", "Bucket", "==", "\"", "\"", "{", "return", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "else", "if", "s", ".", "Key", "==", "\"", "\"", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "s", ".", "Region", "==", "\"", "\"", "{", "s", ".", "Region", "=", "\"", "\"", "\n", "}", "\n", "creds", ":=", "credentials", ".", "AnonymousCredentials", "\n", "if", "s", ".", "Access", "!=", "\"", "\"", "{", "creds", "=", "credentials", ".", "NewStaticCredentials", "(", "s", ".", "Access", ",", "s", ".", "Secret", ",", "\"", "\"", ")", "\n", "}", "else", "if", "os", ".", "Getenv", "(", "\"", "\"", ")", "!=", "\"", "\"", "{", "creds", "=", "credentials", ".", "NewEnvCredentials", "(", ")", "\n", "}", "\n", "config", ":=", "&", "aws", ".", "Config", "{", "Credentials", ":", "creds", ",", "Region", ":", "&", "s", ".", "Region", ",", "}", "\n", "s", ".", "client", "=", "s3", ".", "New", "(", "session", ".", "New", "(", "config", ")", ")", "\n", "//apply defaults", "if", "s", ".", "Interval", "==", "0", "{", "s", ".", "Interval", "=", "5", "*", "time", ".", "Minute", "\n", "}", "\n", "return", "nil", "\n", "}" ]
26
all-27
[ "ProjectList", "returns", "all", "available", "projects", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "ProjectList", "(", "filter", "ProjectFilter", ")", "(", "[", "]", "api", ".", "Project", ",", "error", ")", "{", "// Result slice.", "objects", ":=", "make", "(", "[", "]", "api", ".", "Project", ",", "0", ")", "\n\n", "// Check which filter criteria are active.", "criteria", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "}", "\n", "if", "filter", ".", "Name", "!=", "\"", "\"", "{", "criteria", "[", "\"", "\"", "]", "=", "filter", ".", "Name", "\n", "}", "\n\n", "// Pick the prepared statement and arguments to use based on active criteria.", "var", "stmt", "*", "sql", ".", "Stmt", "\n", "var", "args", "[", "]", "interface", "{", "}", "\n\n", "if", "criteria", "[", "\"", "\"", "]", "!=", "nil", "{", "stmt", "=", "c", ".", "stmt", "(", "projectObjectsByName", ")", "\n", "args", "=", "[", "]", "interface", "{", "}", "{", "filter", ".", "Name", ",", "}", "\n", "}", "else", "{", "stmt", "=", "c", ".", "stmt", "(", "projectObjects", ")", "\n", "args", "=", "[", "]", "interface", "{", "}", "{", "}", "\n", "}", "\n\n", "// Dest function for scanning a row.", "dest", ":=", "func", "(", "i", "int", ")", "[", "]", "<mask>", "{", "}", "{", "objects", "=", "append", "(", "objects", ",", "api", ".", "Project", "{", "}", ")", "\n", "return", "[", "]", "interface", "{", "}", "{", "&", "objects", "[", "i", "]", ".", "Description", ",", "&", "objects", "[", "i", "]", ".", "Name", ",", "}", "\n", "}", "\n\n", "// Select.", "err", ":=", "query", ".", "SelectObjects", "(", "stmt", ",", "dest", ",", "args", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// Fill field Config.", "configObjects", ",", "err", ":=", "c", ".", "ProjectConfigRef", "(", "filter", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "for", "i", ":=", "range", "objects", "{", "value", ":=", "configObjects", "[", "objects", "[", "i", "]", ".", "Name", "]", "\n", "if", "value", "==", "nil", "{", "value", "=", "map", "[", "string", "]", "string", "{", "}", "\n", "}", "\n", "objects", "[", "i", "]", ".", "Config", "=", "value", "\n", "}", "\n\n", "// Fill field UsedBy.", "usedByObjects", ",", "err", ":=", "c", ".", "ProjectUsedByRef", "(", "filter", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "for", "i", ":=", "range", "objects", "{", "value", ":=", "usedByObjects", "[", "objects", "[", "i", "]", ".", "Name", "]", "\n", "if", "value", "==", "nil", "{", "value", "=", "[", "]", "string", "{", "}", "\n", "}", "\n", "objects", "[", "i", "]", ".", "UsedBy", "=", "value", "\n", "}", "\n\n", "return", "objects", ",", "nil", "\n", "}" ]
27
all-28
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "StorageID", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomstorage", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
28
all-29
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "PictureTile", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoLayertree9", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
29
all-30
[ "Friendly", "prints", "out", "a", "friendly", "version", "of", "the", "Direction", "following", "the", "example", "shown", "in", "the", "Twilio", "Dashboard", "." ]
[ "func", "(", "d", "Direction", ")", "Friendly", "(", ")", "string", "{", "switch", "d", "{", "case", "DirectionOutboundReply", ":", "return", "\"", "\"", "\n", "case", "DirectionOutboundCall", ":", "return", "\"", "\"", "\n", "case", "DirectionOutboundAPI", ":", "return", "\"", "\"", "\n", "<mask>", "DirectionInbound", ":", "return", "\"", "\"", "\n", "case", "DirectionOutboundDial", ":", "return", "\"", "\"", "\n", "case", "DirectionTrunkingTerminating", ":", "return", "\"", "\"", "\n", "case", "DirectionTrunkingOriginating", ":", "return", "\"", "\"", "\n", "default", ":", "return", "string", "(", "d", ")", "\n", "}", "\n", "}" ]
30
all-31
[ "Start", "starts", "polling", "path", "for", "plugin", "config", ".", "If", "the", "first", "attempt", "fails", "then", "start", "returns", "the", "error", ".", "Future", "errors", "will", "halt", "updates", "but", "not", "stop", "." ]
[ "func", "(", "pa", "*", "ConfigAgent", ")", "Start", "(", "path", "string", ")", "error", "{", "if", "err", ":=", "pa", ".", "Load", "(", "<mask>", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "ticker", ":=", "time", ".", "Tick", "(", "1", "*", "time", ".", "Minute", ")", "\n", "go", "func", "(", ")", "{", "for", "range", "ticker", "{", "if", "err", ":=", "pa", ".", "Load", "(", "path", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "WithField", "(", "\"", "\"", ",", "path", ")", ".", "WithError", "(", "err", ")", ".", "Error", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "}", "(", ")", "\n", "return", "nil", "\n", "}" ]
31
all-32
[ "diskApplyOperationCreateUpdate", "is", "an", "inner", "-", "loop", "helper", "for", "disk", "creation", "and", "update", "operations", "." ]
[ "func", "diskApplyOperationCreateUpdate", "(", "index", "int", ",", "newData", "map", "[", "string", "]", "interface", "{", "}", ",", "oldDataSet", "[", "]", "interface", "{", "}", ",", "c", "*", "govmomi", ".", "Client", ",", "d", "*", "schema", ".", "ResourceData", ",", "l", "*", "object", ".", "VirtualDeviceList", ",", "spec", "*", "[", "]", "types", ".", "BaseVirtualDeviceConfigSpec", ",", "updates", "*", "[", "]", "interface", "{", "}", ",", ")", "error", "{", "<mask>", "name", "string", "\n", "var", "err", "error", "\n", "if", "name", ",", "err", "=", "diskLabelOrName", "(", "newData", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "name", "==", "diskDeletedName", "||", "name", "==", "diskDetachedName", "{", "// This is a \"dummy\" deleted resource and should be skipped over", "return", "nil", "\n", "}", "\n", "for", "_", ",", "oe", ":=", "range", "oldDataSet", "{", "oldData", ":=", "oe", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "if", "newData", "[", "\"", "\"", "]", "==", "oldData", "[", "\"", "\"", "]", "{", "// This is an update", "r", ":=", "NewDiskSubresource", "(", "c", ",", "d", ",", "newData", ",", "oldData", ",", "index", ")", "\n", "// If the only thing changing here is the datastore, or keep_on_remove,", "// this is a no-op as far as a device change is concerned. Datastore", "// changes are handled during storage vMotion later on during the", "// update phase. keep_on_remove is a Terraform-only attribute and only", "// needs to be committed to state.", "omc", ",", "err", ":=", "copystructure", ".", "Copy", "(", "oldData", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "r", ".", "Addr", "(", ")", ",", "err", ")", "\n", "}", "\n", "oldCopy", ":=", "omc", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "oldCopy", "[", "\"", "\"", "]", "=", "newData", "[", "\"", "\"", "]", "\n", "oldCopy", "[", "\"", "\"", "]", "=", "newData", "[", "\"", "\"", "]", "\n", "// TODO: Remove these in 2.0, when all attributes should bear a label and", "// name is gone, and we won't need to exempt transitions.", "oldCopy", "[", "\"", "\"", "]", "=", "newData", "[", "\"", "\"", "]", "\n", "oldCopy", "[", "\"", "\"", "]", "=", "newData", "[", "\"", "\"", "]", "\n", "if", "reflect", ".", "DeepEqual", "(", "oldCopy", ",", "newData", ")", "{", "*", "updates", "=", "append", "(", "*", "updates", ",", "r", ".", "Data", "(", ")", ")", "\n", "return", "nil", "\n", "}", "\n", "uspec", ",", "err", ":=", "r", ".", "Update", "(", "*", "l", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "r", ".", "Addr", "(", ")", ",", "err", ")", "\n", "}", "\n", "*", "l", "=", "applyDeviceChange", "(", "*", "l", ",", "uspec", ")", "\n", "*", "spec", "=", "append", "(", "*", "spec", ",", "uspec", "...", ")", "\n", "*", "updates", "=", "append", "(", "*", "updates", ",", "r", ".", "Data", "(", ")", ")", "\n", "return", "nil", "\n", "}", "\n", "}", "\n", "// New data was not found - this is a create operation", "r", ":=", "NewDiskSubresource", "(", "c", ",", "d", ",", "newData", ",", "nil", ",", "index", ")", "\n", "cspec", ",", "err", ":=", "r", ".", "Create", "(", "*", "l", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "r", ".", "Addr", "(", ")", ",", "err", ")", "\n", "}", "\n", "*", "l", "=", "applyDeviceChange", "(", "*", "l", ",", "cspec", ")", "\n", "*", "spec", "=", "append", "(", "*", "spec", ",", "cspec", "...", ")", "\n", "*", "updates", "=", "append", "(", "*", "updates", ",", "r", ".", "Data", "(", ")", ")", "\n", "return", "nil", "\n", "}" ]
32
all-33
[ "Setfilecon", "sets", "the", "SELinux", "label", "for", "this", "path", "or", "returns", "an", "error", "." ]
[ "func", "Setfilecon", "(", "path", "string", ",", "scon", "string", ")", "error", "{", "return", "system", ".", "Lsetxattr", "(", "<mask>", ",", "xattrNameSelinux", ",", "[", "]", "byte", "(", "scon", ")", ",", "0", ")", "\n", "}" ]
33
all-34
[ "Print", "the", "array", "dimension", "." ]
[ "func", "(", "at", "*", "ArrayType", ")", "printDimension", "(", "ps", "*", "printState", ")", "{", "space", ":=", "\"", "\"", "\n", "for", "len", "(", "ps", ".", "inner", ")", ">", "0", "{", "// We haven't gotten to the real type yet. Use", "// parentheses around that type, except that if it is", "// an array type we print it as a multi-dimensional", "// array", "in", ":=", "ps", ".", "inner", "[", "len", "(", "ps", ".", "inner", ")", "-", "1", "]", "\n", "if", "twq", ",", "ok", ":=", "in", ".", "(", "*", "TypeWithQualifiers", ")", ";", "ok", "{", "in", "=", "twq", ".", "Base", "\n", "}", "\n", "if", "_", ",", "ok", ":=", "in", ".", "(", "*", "ArrayType", ")", ";", "ok", "{", "if", "in", "==", "ps", ".", "inner", "[", "len", "(", "ps", ".", "inner", ")", "-", "1", "]", "{", "space", "=", "\"", "\"", "\n", "}", "\n", "<mask>", ".", "printOneInner", "(", "nil", ")", "\n", "}", "else", "{", "ps", ".", "writeString", "(", "\"", "\"", ")", "\n", "ps", ".", "printInner", "(", "false", ")", "\n", "ps", ".", "writeByte", "(", "')'", ")", "\n", "}", "\n", "}", "\n", "ps", ".", "writeString", "(", "space", ")", "\n", "ps", ".", "writeByte", "(", "'['", ")", "\n", "ps", ".", "print", "(", "at", ".", "Dimension", ")", "\n", "ps", ".", "writeByte", "(", "']'", ")", "\n", "}" ]
34
all-35
[ "Begin", "wraps", "bolt", ".", "DB", ".", "Begin", "." ]
[ "func", "(", "db", "DB", ")", "Begin", "(", "writable", "bool", ")", "(", "Tx", ",", "error", ")", "{", "tx", ",", "err", ":=", "db", ".", "DB", ".", "Begin", "(", "writable", ")", "\n", "return", "Tx", "{", "<mask>", "}", ",", "errorsp", ".", "WithStacks", "(", "err", ")", "\n", "}" ]
35
all-36
[ "discovery" ]
[ "func", "getDiscovery", "(", "opts", "*", "ServerOptions", ")", "Handler", "{", "return", "func", "(", "w", "<mask>", ".", "Writer", ",", "_", "io", ".", "Reader", ",", "_", "httprouter", ".", "Params", ")", "error", "{", "resp", ":=", "DiscoveryResponse", "{", "ApiVersion", ":", "ApiVersion", ",", "SupportedSubjectRequestTypes", ":", "opts", ".", "SubjectTypes", ",", "SupportedIdentities", ":", "opts", ".", "Identities", ",", "ProcessorCertificate", ":", "opts", ".", "ProcessorCertificateUrl", ",", "}", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "resp", ")", "\n", "}", "\n", "}" ]
36
all-37
[ "Setup", "check", "if", "Docker", "binary", "is", "available", "and", "pull", "current", "image", "from", "Docker", "repository", "in", "case", "it", "is", "not", "already", "available", "." ]
[ "func", "(", "s", "*", "<mask>", ")", "Setup", "(", ")", "error", "{", "if", "!", "s", ".", "docker", ".", "HasBin", "(", ")", "{", "return", "DockerBinNotFound", "(", "s", ".", "docker", ".", "binCmd", ")", "\n", "}", "\n\n", "if", "!", "s", ".", "Exists", "(", ")", "{", "if", "err", ":=", "s", ".", "Pull", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
37
all-38
[ "run", "takes", "the", "query", "Result", "produced", "by", "a", "call", "to", "Run", "and", "updates", "it", "with", "more", "Records", ".", "The", "updated", "Result", "contains", "a", "new", "set", "of", "logs", "as", "well", "as", "an", "offset", "to", "where", "more", "logs", "can", "be", "found", ".", "We", "also", "convert", "the", "items", "in", "the", "response", "from", "their", "internal", "representations", "to", "external", "versions", "of", "the", "same", "structs", "." ]
[ "func", "(", "r", "*", "Result", ")", "run", "(", ")", "error", "{", "res", ":=", "&", "pb", ".", "LogReadResponse", "{", "}", "\n", "if", "err", ":=", "internal", ".", "Call", "(", "r", ".", "context", ",", "\"", "\"", ",", "\"", "\"", ",", "r", ".", "request", ",", "res", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "r", ".", "logs", "=", "make", "(", "[", "]", "*", "Record", ",", "len", "(", "res", ".", "<mask>", ")", ")", "\n", "r", ".", "request", ".", "Offset", "=", "res", ".", "Offset", "\n", "r", ".", "resultsSeen", "=", "true", "\n\n", "for", "i", ",", "log", ":=", "range", "res", ".", "Log", "{", "r", ".", "logs", "[", "i", "]", "=", "protoToRecord", "(", "log", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
38
all-39
[ "checkPrefix", "checks", "that", "a", "string", "may", "be", "used", "as", "a", "prefix", ".", "We", "forbid", "local", "(", "relative", ")", "imports", "and", "those", "beginning", "with", "/", ".", "We", "allow", "the", "empty", "string", "but", "generated", "rules", "must", "not", "have", "an", "empty", "importpath", "." ]
[ "func", "checkPrefix", "(", "prefix", "string", ")", "error", "{", "if", "strings", ".", "HasPrefix", "(", "prefix", ",", "\"", "\"", ")", "||", "<mask>", ".", "IsLocalImport", "(", "prefix", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "prefix", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
39
all-40
[ "Width", "returns", "the", "width", "of", "the", "given", "code", "point", "." ]
[ "func", "(", "f", "Font", ")", "Width", "(", "code", "int", ")", "float64", "{", "first", ":=", "f", ".", "FirstChar", "(", ")", "\n", "last", ":=", "f", ".", "LastChar", "(", ")", "\n", "if", "code", "<", "first", "||", "last", "<", "code", "{", "return", "0", "\n", "}", "\n", "return", "f", ".", "V", ".", "Key", "(", "\"", "\"", ")", ".", "Index", "(", "code", "-", "<mask>", ")", ".", "Float64", "(", ")", "\n", "}" ]
40
all-41
[ "Add", "writes", "the", "given", "item", "if", "no", "value", "already", "exists", "for", "its", "key", ".", "ErrNotStored", "is", "returned", "if", "that", "condition", "is", "not", "met", "." ]
[ "func", "(", "c", "*", "Client", ")", "Add", "(", "item", "*", "Item", ")", "error", "{", "return", "c", ".", "populateOne", "(", "cmdAdd", ",", "<mask>", ",", "0", ")", "\n", "}" ]
41
all-42
[ "NewInstantQuery", "returns", "an", "evaluation", "query", "for", "the", "given", "expression", "at", "the", "given", "time", "." ]
[ "func", "(", "ng", "*", "Engine", ")", "NewInstantQuery", "(", "q", "storage", ".", "Queryable", ",", "qs", "string", ",", "ts", "time", ".", "Time", ")", "(", "<mask>", ",", "error", ")", "{", "expr", ",", "err", ":=", "ParseExpr", "(", "qs", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "qry", ":=", "ng", ".", "newQuery", "(", "q", ",", "expr", ",", "ts", ",", "ts", ",", "0", ")", "\n", "qry", ".", "q", "=", "qs", "\n\n", "return", "qry", ",", "nil", "\n", "}" ]
42
all-43
[ "Make", "sure", "the", "local", "WriteHeader", "is", "called", "and", "call", "the", "parent", "Write", ".", "Provided", "in", "order", "to", "implement", "the", "http", ".", "ResponseWriter", "interface", "." ]
[ "func", "(", "w", "*", "recorderResponseWriter", ")", "Write", "(", "b", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "if", "!", "w", ".", "wroteHeader", "{", "w", ".", "WriteHeader", "(", "http", ".", "StatusOK", ")", "\n", "}", "\n", "writer", ":=", "w", ".", "ResponseWriter", ".", "(", "http", ".", "ResponseWriter", ")", "\n", "written", ",", "err", ":=", "<mask>", ".", "Write", "(", "b", ")", "\n", "w", ".", "bytesWritten", "+=", "int64", "(", "written", ")", "\n", "return", "written", ",", "err", "\n", "}" ]
43
all-44
[ "/", "*", "You", "should", "call", "CleanupBuildArtifacts", "before", "your", "test", "ends", "to", "clean", "up", "any", "temporary", "artifacts", "generated", "by", "gexec", ".", "In", "Ginkgo", "this", "is", "typically", "done", "in", "an", "AfterSuite", "callback", "." ]
[ "func", "CleanupBuildArtifacts", "(", ")", "{", "mu", ".", "Lock", "(", ")", "\n", "defer", "mu", ".", "Unlock", "(", ")", "\n", "if", "tmpDir", "!=", "\"", "\"", "{", "<mask>", ".", "RemoveAll", "(", "tmpDir", ")", "\n", "tmpDir", "=", "\"", "\"", "\n", "}", "\n", "}" ]
44
all-45
[ "DebugFunc", "outputs", "Debug", "level", "log", "returned", "from", "the", "function" ]
[ "func", "DebugFunc", "(", "f", "func", "(", ")", "string", ")", "error", "{", "if", "isModeEnable", "(", "DEBG", ")", "{", "return", "glg", ".", "<mask>", "(", "DEBG", ",", "\"", "\"", ",", "f", "(", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
45
all-46
[ "GetMetricQuery", "returns", "the", "MetricQuery", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "c", "*", "ChangeRequest", ")", "GetMetricQuery", "(", ")", "<mask>", "{", "if", "c", "==", "nil", "||", "c", ".", "MetricQuery", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "c", ".", "MetricQuery", "\n", "}" ]
46
all-47
[ "UpdateSecretVersionStageRequest", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "UpdateSecretVersionStageRequest", "(", "arg0", "*", "secretsmanager", ".", "UpdateSecretVersionStageInput", ")", "(", "*", "request", ".", "Request", ",", "*", "secretsmanager", ".", "UpdateSecretVersionStageOutput", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "*", "request", ".", "Request", ")", "\n", "ret1", ",", "_", ":=", "<mask>", "[", "1", "]", ".", "(", "*", "secretsmanager", ".", "UpdateSecretVersionStageOutput", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
47
all-48
[ "getAllASMSecretRequirements", "stores", "secrets", "in", "a", "task", "in", "a", "map" ]
[ "func", "(", "task", "*", "Task", ")", "getAllASMSecretRequirements", "(", ")", "map", "[", "string", "]", "apicontainer", ".", "Secret", "{", "reqs", ":=", "make", "(", "map", "[", "string", "]", "apicontainer", ".", "Secret", ")", "\n\n", "for", "_", ",", "container", ":=", "range", "task", ".", "Containers", "{", "for", "_", ",", "secret", ":=", "range", "<mask>", ".", "Secrets", "{", "if", "secret", ".", "Provider", "==", "apicontainer", ".", "SecretProviderASM", "{", "secretKey", ":=", "secret", ".", "GetSecretResourceCacheKey", "(", ")", "\n", "if", "_", ",", "ok", ":=", "reqs", "[", "secretKey", "]", ";", "!", "ok", "{", "reqs", "[", "secretKey", "]", "=", "secret", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "reqs", "\n", "}" ]
48
all-49
[ "Merge", "the", "set", "into", "our", "state", "abiding", "increment", "-", "only", "semantics", ".", "Return", "our", "resulting", "complete", "state", "." ]
[ "func", "(", "st", "*", "state", ")", "mergeComplete", "(", "set", "map", "[", "mesh", ".", "PeerName", "]", "int", ")", "(", "complete", "mesh", ".", "GossipData", ")", "{", "st", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "st", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "for", "peer", ",", "v", ":=", "range", "set", "{", "if", "v", ">", "st", ".", "<mask>", "[", "peer", "]", "{", "st", ".", "set", "[", "peer", "]", "=", "v", "\n", "}", "\n", "}", "\n\n", "return", "&", "state", "{", "set", ":", "st", ".", "set", ",", "// n.b. can't .copy() due to lock contention", "}", "\n", "}" ]
49
all-50
[ "Load", "loads", "TOML", "files", "from", "configPaths", ".", "and", "assigns", "decoded", "values", "into", "the", "conf", "value", "." ]
[ "func", "LoadTOML", "(", "conf", "<mask>", "{", "}", ",", "configPaths", "...", "string", ")", "error", "{", "return", "loadWithFunc", "(", "conf", ",", "configPaths", ",", "nil", ",", "toml", ".", "Unmarshal", ")", "\n", "}" ]
50
all-51
[ "GetTarget", "is", "a", "wrapper", "around", "cairo_get_target", "()", "." ]
[ "func", "(", "v", "*", "Context", ")", "GetTarget", "(", ")", "*", "Surface", "{", "c", ":=", "C", ".", "cairo_get_target", "(", "v", ".", "native", "(", ")", ")", "\n", "s", ":=", "wrapSurface", "(", "c", ")", "\n", "s", ".", "reference", "(", ")", "\n", "runtime", ".", "SetFinalizer", "(", "s", ",", "(", "*", "Surface", ")", ".", "<mask>", ")", "\n", "return", "s", "\n", "}" ]
51
all-52
[ "NewRandomSourceListSecure", "returns", "system", "provided", "source", "of", "random", "data", "besides", "of", "Raiqub", "Random", "source", "." ]
[ "func", "NewRandomSourceListSecure", "(", ")", "RandomSourceList", "{", "return", "RandomSourceList", "{", "RandomSource", "{", "Reader", ":", "<mask>", ".", "Reader", ",", "Weight", ":", "DEFAULT_SYS_RAND_SIZE", ",", "}", ",", "RandomSource", "{", "Reader", ":", "NewRandom", "(", ")", ",", "Weight", ":", "DEFAULT_RAIQUB_RAND_SIZE", ",", "}", ",", "}", "\n", "}" ]
52
all-53
[ "NewStateManager", "constructs", "a", "new", "StateManager", "which", "saves", "data", "at", "the", "location", "specified", "in", "cfg", "and", "operates", "under", "the", "given", "options", ".", "The", "returned", "StateManager", "will", "not", "save", "more", "often", "than", "every", "10", "seconds", "and", "will", "not", "reliably", "return", "errors", "with", "Save", "but", "will", "log", "them", "appropriately", "." ]
[ "func", "NewStateManager", "(", "cfg", "*", "config", ".", "Config", ",", "options", "...", "Option", ")", "(", "StateManager", ",", "error", ")", "{", "fi", ",", "err", ":=", "os", ".", "Stat", "(", "cfg", ".", "DataDir", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "!", "fi", ".", "IsDir", "(", ")", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "state", ":=", "&", "state", "{", "Data", ":", "make", "(", "saveableState", ")", ",", "Version", ":", "ECSDataVersion", ",", "}", "\n", "manager", ":=", "&", "basicStateManager", "{", "statePath", ":", "cfg", ".", "DataDir", ",", "state", ":", "state", ",", "}", "\n\n", "for", "_", ",", "option", ":=", "range", "<mask>", "{", "option", "(", "manager", ")", "\n", "}", "\n\n", "manager", ".", "platformDependencies", "=", "newPlatformDependencies", "(", ")", "\n\n", "return", "manager", ",", "nil", "\n", "}" ]
53
all-54
[ "IsLeader", "returns", "true", "if", "this", "member", "is", "the", "current", "cluster", "leader", "." ]
[ "func", "(", "m", "*", "Member", ")", "IsLeader", "(", ")", "(", "bool", ",", "error", ")", "{", "cli", ",", "err", ":=", "m", ".", "CreateEtcdClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ",", "m", ".", "EtcdClientEndpoint", ")", "\n", "}", "\n", "defer", "cli", ".", "Close", "(", ")", "\n\n", "resp", ",", "err", ":=", "<mask>", ".", "Status", "(", "context", ".", "Background", "(", ")", ",", "m", ".", "EtcdClientEndpoint", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "return", "resp", ".", "Header", ".", "MemberId", "==", "resp", ".", "Leader", ",", "nil", "\n", "}" ]
54
all-55
[ "SetCredentials", "sets", "credentials", "in", "the", "client", "to", "be", "used", "for", "pushing", "to", "or", "pulling", "from", "remote", "repositories", "." ]
[ "func", "(", "c", "*", "Client", ")", "SetCredentials", "(", "user", "string", ",", "tokenGenerator", "func", "(", ")", "[", "]", "byte", ")", "{", "c", ".", "credLock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "credLock", ".", "Unlock", "(", ")", "\n", "c", ".", "user", "=", "<mask>", "\n", "c", ".", "tokenGenerator", "=", "tokenGenerator", "\n", "}" ]
55
all-56
[ "v3HandlersSetup", "adds", "all", "handlers", "in", "v3", "package", "to", "the", "mux", "router", "." ]
[ "func", "v3HandlersSetup", "(", "muxRouter", "*", "mux", ".", "Router", ",", "state", "dockerstate", ".", "TaskEngineState", ",", "ecsClient", "api", ".", "ECSClient", ",", "statsEngine", "stats", ".", "Engine", ",", "cluster", "string", ",", "availabilityZone", "string", ",", "containerInstanceArn", "string", ")", "{", "muxRouter", ".", "HandleFunc", "(", "v3", ".", "ContainerMetadataPath", ",", "v3", ".", "ContainerMetadataHandler", "(", "state", ")", ")", "\n", "muxRouter", ".", "HandleFunc", "(", "v3", ".", "TaskMetadataPath", ",", "v3", ".", "TaskMetadataHandler", "(", "state", ",", "ecsClient", ",", "cluster", ",", "availabilityZone", ",", "containerInstanceArn", ",", "false", ")", ")", "\n", "muxRouter", ".", "HandleFunc", "(", "v3", ".", "TaskWithTagsMetadataPath", ",", "v3", ".", "TaskMetadataHandler", "(", "<mask>", ",", "ecsClient", ",", "cluster", ",", "availabilityZone", ",", "containerInstanceArn", ",", "true", ")", ")", "\n", "muxRouter", ".", "HandleFunc", "(", "v3", ".", "ContainerStatsPath", ",", "v3", ".", "ContainerStatsHandler", "(", "state", ",", "statsEngine", ")", ")", "\n", "muxRouter", ".", "HandleFunc", "(", "v3", ".", "TaskStatsPath", ",", "v3", ".", "TaskStatsHandler", "(", "state", ",", "statsEngine", ")", ")", "\n", "muxRouter", ".", "HandleFunc", "(", "v3", ".", "ContainerAssociationsPath", ",", "v3", ".", "ContainerAssociationsHandler", "(", "state", ")", ")", "\n", "muxRouter", ".", "HandleFunc", "(", "v3", ".", "ContainerAssociationPathWithSlash", ",", "v3", ".", "ContainerAssociationHandler", "(", "state", ")", ")", "\n", "muxRouter", ".", "HandleFunc", "(", "v3", ".", "ContainerAssociationPath", ",", "v3", ".", "ContainerAssociationHandler", "(", "state", ")", ")", "\n", "}" ]
56
all-57
[ "GetTooltipText", "is", "a", "wrapper", "around", "gtk_widget_get_tooltip_text", "()", ".", "A", "non", "-", "nil", "error", "is", "returned", "in", "the", "case", "that", "gtk_widget_get_tooltip_text", "returns", "NULL", "to", "differentiate", "between", "NULL", "and", "an", "empty", "string", "." ]
[ "func", "(", "v", "*", "Widget", ")", "GetTooltipText", "(", ")", "(", "string", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_widget_get_tooltip_text", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "\"", "\"", ",", "nilPtrErr", "\n", "}", "\n", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "<mask>", ")", "(", "c", ")", ")", ",", "nil", "\n", "}" ]
57
all-58
[ "isWaitingForACSExecutionCredentials", "checks", "if", "the", "container", "that", "can", "t", "be", "transitioned", "was", "caused", "by", "waiting", "for", "credentials", "and", "start", "waiting" ]
[ "func", "(", "mtask", "*", "managedTask", ")", "isWaitingForACSExecutionCredentials", "(", "reasons", "[", "]", "error", ")", "bool", "{", "for", "_", ",", "<mask>", ":=", "range", "reasons", "{", "if", "reason", "==", "dependencygraph", ".", "CredentialsNotResolvedErr", "{", "seelog", ".", "Debugf", "(", "\"", "\"", ",", "mtask", ".", "Arn", ")", "\n\n", "timeoutCtx", ",", "timeoutCancel", ":=", "context", ".", "WithTimeout", "(", "mtask", ".", "ctx", ",", "waitForPullCredentialsTimeout", ")", "\n", "defer", "timeoutCancel", "(", ")", "\n\n", "timedOut", ":=", "mtask", ".", "waitEvent", "(", "timeoutCtx", ".", "Done", "(", ")", ")", "\n", "if", "timedOut", "{", "seelog", ".", "Debugf", "(", "\"", "\"", ",", "mtask", ".", "Arn", ")", "\n", "}", "\n", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
58
all-59
[ "New", "creates", "and", "initializes", "a", "list", "of", "searchable", "items", ".", "The", "items", "attribute", "must", "be", "a", "slice", "type", "with", "a", "size", "greater", "than", "0", ".", "Error", "will", "be", "returned", "if", "those", "two", "conditions", "are", "not", "met", "." ]
[ "func", "New", "(", "items", "interface", "{", "}", ",", "size", "int", ")", "(", "*", "List", ",", "error", ")", "{", "if", "size", "<", "1", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "<mask>", ")", "\n", "}", "\n\n", "if", "items", "==", "nil", "||", "reflect", ".", "TypeOf", "(", "items", ")", ".", "Kind", "(", ")", "!=", "reflect", ".", "Slice", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "items", ")", "\n", "}", "\n\n", "slice", ":=", "reflect", ".", "ValueOf", "(", "items", ")", "\n", "values", ":=", "make", "(", "[", "]", "*", "interface", "{", "}", ",", "slice", ".", "Len", "(", ")", ")", "\n\n", "for", "i", ":=", "range", "values", "{", "item", ":=", "slice", ".", "Index", "(", "i", ")", ".", "Interface", "(", ")", "\n", "values", "[", "i", "]", "=", "&", "item", "\n", "}", "\n\n", "return", "&", "List", "{", "size", ":", "size", ",", "items", ":", "values", ",", "scope", ":", "values", "}", ",", "nil", "\n", "}" ]
59
all-60
[ "waitForIP", "waits", "until", "the", "host", "has", "a", "valid", "IP" ]
[ "func", "(", "d", "*", "Driver", ")", "waitForIP", "(", ")", "(", "string", ",", "error", ")", "{", "log", ".", "Infof", "(", "\"", "\"", ")", "\n\n", "for", "{", "ip", ",", "_", ":=", "d", ".", "GetIP", "(", ")", "\n", "if", "ip", "!=", "\"", "\"", "{", "return", "<mask>", ",", "nil", "\n", "}", "\n\n", "time", ".", "Sleep", "(", "1", "*", "time", ".", "Second", ")", "\n", "}", "\n", "}" ]
60
all-61
[ "isHelperMethodOf", "returns", "true", "if", "the", "line", "is", "a", "specified", "helper", "method", "." ]
[ "func", "(", "l", "*", "<mask>", ")", "isHelperMethodOf", "(", "name", "string", ")", "bool", "{", "return", "l", ".", "isHelperMethod", "(", ")", "&&", "l", ".", "tokens", "[", "1", "]", "==", "name", "\n", "}" ]
61
all-62
[ "ContainString", "returns", "whether", "the", "named", "file", "contains", "the", "string", "s", ".", "The", "return", "value", "is", "a", "boolean", "." ]
[ "func", "ContainString", "(", "filename", ",", "s", "string", ")", "(", "bool", ",", "error", ")", "{", "f", ",", "err", ":=", "os", ".", "Open", "(", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "defer", "f", ".", "Close", "(", ")", "\n\n", "buf", ":=", "bufio", ".", "NewReader", "(", "f", ")", "\n\n", "for", "{", "line", ",", "err", ":=", "buf", ".", "ReadString", "(", "'\\n'", ")", "\n", "if", "err", "==", "io", ".", "EOF", "{", "break", "\n", "}", "\n", "if", "strings", ".", "Contains", "(", "line", ",", "s", ")", "{", "return", "true", ",", "nil", "\n", "}", "\n", "}", "\n", "return", "false", ",", "nil", "\n", "}" ]
62
all-63
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetOuterHTMLParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom2", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
63
all-64
[ "Return", "a", "generic", "vertex", "attribute", "parameter" ]
[ "func", "GetVertexAttribdv", "(", "index", "uint32", ",", "pname", "uint32", ",", "params", "*", "float64", ")", "{", "syscall", ".", "Syscall", "(", "gpGetVertexAttribdv", ",", "3", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "pname", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "params", ")", ")", ")", "\n", "}" ]
64
all-65
[ "MDTemplateEngine", "runs", "the", "input", "through", "github", "flavored", "markdown", "before", "sending", "it", "to", "the", "Plush", "engine", "." ]
[ "func", "MDTemplateEngine", "(", "input", "string", ",", "data", "map", "[", "string", "]", "interface", "{", "}", ",", "helpers", "map", "[", "string", "]", "<mask>", "{", "}", ")", "(", "string", ",", "error", ")", "{", "if", "ct", ",", "ok", ":=", "data", "[", "\"", "\"", "]", ".", "(", "string", ")", ";", "ok", "&&", "ct", "==", "\"", "\"", "{", "return", "plush", ".", "BuffaloRenderer", "(", "input", ",", "data", ",", "helpers", ")", "\n", "}", "\n", "source", ":=", "github_flavored_markdown", ".", "Markdown", "(", "[", "]", "byte", "(", "input", ")", ")", "\n", "source", "=", "[", "]", "byte", "(", "html", ".", "UnescapeString", "(", "string", "(", "source", ")", ")", ")", "\n", "return", "plush", ".", "BuffaloRenderer", "(", "string", "(", "source", ")", ",", "data", ",", "helpers", ")", "\n", "}" ]
65
all-66
[ "Do", "executes", "Page", ".", "setWebLifecycleState", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "SetWebLifecycleStateParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSetWebLifecycleState", ",", "p", ",", "nil", ")", "\n", "}" ]
66
all-67
[ "withDeadline", "is", "like", "context", ".", "WithDeadline", "except", "it", "ignores", "the", "zero", "deadline", "." ]
[ "func", "withDeadline", "(", "parent", "context", ".", "Context", ",", "deadline", "time", ".", "Time", ")", "(", "context", ".", "Context", ",", "context", ".", "CancelFunc", ")", "{", "if", "deadline", ".", "IsZero", "(", ")", "{", "return", "<mask>", ",", "func", "(", ")", "{", "}", "\n", "}", "\n", "return", "context", ".", "WithDeadline", "(", "parent", ",", "deadline", ")", "\n", "}" ]
67
all-68
[ "NewTasksResponse", "creates", "TasksResponse", "for", "all", "the", "tasks", "." ]
[ "func", "NewTasksResponse", "(", "state", "dockerstate", ".", "TaskEngineState", ")", "*", "TasksResponse", "{", "allTasks", ":=", "state", ".", "AllTasks", "(", ")", "\n", "taskResponses", ":=", "make", "(", "[", "]", "*", "TaskResponse", ",", "len", "(", "allTasks", ")", ")", "\n", "for", "ndx", ",", "task", ":=", "range", "allTasks", "{", "containerMap", ",", "_", ":=", "state", ".", "ContainerMapByArn", "(", "task", ".", "Arn", ")", "\n", "taskResponses", "[", "ndx", "]", "=", "NewTaskResponse", "(", "<mask>", ",", "containerMap", ")", "\n", "}", "\n\n", "return", "&", "TasksResponse", "{", "Tasks", ":", "taskResponses", "}", "\n", "}" ]
68
all-69
[ "Get", "information", "about", "a", "single", "client", ".", "See", "#client" ]
[ "func", "(", "auth", "*", "Auth", ")", "Client", "(", "clientId", "string", ")", "(", "*", "GetClientResponse", ",", "error", ")", "{", "cd", ":=", "tcclient", ".", "<mask>", "(", "*", "auth", ")", "\n", "responseObject", ",", "_", ",", "err", ":=", "(", "&", "cd", ")", ".", "APICall", "(", "nil", ",", "\"", "\"", ",", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "clientId", ")", ",", "new", "(", "GetClientResponse", ")", ",", "nil", ")", "\n", "return", "responseObject", ".", "(", "*", "GetClientResponse", ")", ",", "err", "\n", "}" ]
69
all-70
[ "General", "wrappers", "around", "Logger", "interface", "functions", "." ]
[ "func", "Debug", "(", "msg", "string", ",", "ctx", "...", "interface", "{", "}", ")", "{", "if", "Log", "!=", "nil", "{", "pc", ",", "fn", ",", "line", ",", "_", ":=", "runtime", ".", "Caller", "(", "1", ")", "\n", "<mask>", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "fn", ",", "line", ",", "runtime", ".", "FuncForPC", "(", "pc", ")", ".", "Name", "(", ")", ",", "msg", ")", "\n", "Log", ".", "Debug", "(", "msg", ",", "ctx", "...", ")", "\n", "}", "\n", "}" ]
70
all-71
[ "Helper", "function", "(", "shared", "with", "text", "code", ")" ]
[ "func", "extractAzureTargets", "(", "recordSet", "*", "dns", ".", "RecordSet", ")", "[", "]", "string", "{", "properties", ":=", "recordSet", ".", "RecordSetProperties", "\n", "if", "properties", "==", "nil", "{", "return", "[", "]", "string", "{", "}", "\n", "}", "\n\n", "// Check for A records", "aRecords", ":=", "properties", ".", "ARecords", "\n", "if", "aRecords", "!=", "nil", "&&", "len", "(", "*", "aRecords", ")", ">", "0", "&&", "(", "*", "aRecords", ")", "[", "0", "]", ".", "Ipv4Address", "!=", "nil", "{", "targets", ":=", "<mask>", "(", "[", "]", "string", ",", "len", "(", "*", "aRecords", ")", ")", "\n", "for", "i", ",", "aRecord", ":=", "range", "*", "aRecords", "{", "targets", "[", "i", "]", "=", "*", "aRecord", ".", "Ipv4Address", "\n", "}", "\n", "return", "targets", "\n", "}", "\n\n", "// Check for CNAME records", "cnameRecord", ":=", "properties", ".", "CnameRecord", "\n", "if", "cnameRecord", "!=", "nil", "&&", "cnameRecord", ".", "Cname", "!=", "nil", "{", "return", "[", "]", "string", "{", "*", "cnameRecord", ".", "Cname", "}", "\n", "}", "\n\n", "// Check for TXT records", "txtRecords", ":=", "properties", ".", "TxtRecords", "\n", "if", "txtRecords", "!=", "nil", "&&", "len", "(", "*", "txtRecords", ")", ">", "0", "&&", "(", "*", "txtRecords", ")", "[", "0", "]", ".", "Value", "!=", "nil", "{", "values", ":=", "(", "*", "txtRecords", ")", "[", "0", "]", ".", "Value", "\n", "if", "values", "!=", "nil", "&&", "len", "(", "*", "values", ")", ">", "0", "{", "return", "[", "]", "string", "{", "(", "*", "values", ")", "[", "0", "]", "}", "\n", "}", "\n", "}", "\n", "return", "[", "]", "string", "{", "}", "\n", "}" ]
71
all-72
[ "skipIPAddr", "defines", "the", "set", "of", "criteria", "that", "buildAndSelectGuestIPs", "uses", "to", "check", "to", "see", "if", "it", "needs", "to", "skip", "an", "IP", "address", "." ]
[ "func", "skipIPAddr", "(", "ip", "<mask>", ".", "IP", ")", "bool", "{", "switch", "{", "case", "ip", ".", "IsLinkLocalMulticast", "(", ")", ":", "fallthrough", "\n", "case", "ip", ".", "IsLinkLocalUnicast", "(", ")", ":", "fallthrough", "\n", "case", "ip", ".", "IsLoopback", "(", ")", ":", "fallthrough", "\n", "case", "ip", ".", "IsMulticast", "(", ")", ":", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}" ]
72
all-73
[ "SetDesiredStatus", "sets", "the", "desired", "status", "of", "the", "container" ]
[ "func", "(", "c", "*", "Container", ")", "SetDesiredStatus", "(", "<mask>", "apicontainerstatus", ".", "ContainerStatus", ")", "{", "c", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "c", ".", "DesiredStatusUnsafe", "=", "status", "\n", "}" ]
73
all-74
[ "GetTransaction", "retrieves", "the", "Transaction", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "StellarMessage", ")", "GetTransaction", "(", ")", "(", "result", "TransactionEnvelope", ",", "ok", "bool", ")", "{", "armName", ",", "_", ":=", "u", ".", "ArmForSwitch", "(", "int32", "(", "u", ".", "Type", ")", ")", "\n\n", "if", "armName", "==", "\"", "\"", "{", "result", "=", "*", "u", ".", "<mask>", "\n", "ok", "=", "true", "\n", "}", "\n\n", "return", "\n", "}" ]
74
all-75
[ "WithCondition", "expression", "to", "use", "as", "a", "breakpoint", "condition", ".", "When", "specified", "debugger", "will", "stop", "on", "the", "breakpoint", "if", "this", "expression", "evaluates", "to", "true", "." ]
[ "func", "(", "p", "SetBreakpointOnFunctionCallParams", ")", "WithCondition", "(", "<mask>", "string", ")", "*", "SetBreakpointOnFunctionCallParams", "{", "p", ".", "Condition", "=", "condition", "\n", "return", "&", "p", "\n", "}" ]
75
all-76
[ "return", "the", "address", "of", "the", "specified", "generic", "vertex", "attribute", "pointer" ]
[ "func", "GetVertexAttribPointerv", "(", "index", "uint32", ",", "pname", "uint32", ",", "<mask>", "*", "unsafe", ".", "Pointer", ")", "{", "C", ".", "glowGetVertexAttribPointerv", "(", "gpGetVertexAttribPointerv", ",", "(", "C", ".", "GLuint", ")", "(", "index", ")", ",", "(", "C", ".", "GLenum", ")", "(", "pname", ")", ",", "pointer", ")", "\n", "}" ]
76
all-77
[ "maybeFirstIndex", "returns", "the", "index", "of", "the", "first", "possible", "entry", "in", "entries", "if", "it", "has", "a", "snapshot", "." ]
[ "func", "(", "u", "*", "unstable", ")", "maybeFirstIndex", "(", ")", "(", "uint64", ",", "bool", ")", "{", "if", "u", ".", "snapshot", "!=", "nil", "{", "return", "u", ".", "snapshot", ".", "Metadata", ".", "<mask>", "+", "1", ",", "true", "\n", "}", "\n", "return", "0", ",", "false", "\n", "}" ]
77
all-78
[ "similar", "returns", "true", "if", "the", "two", "Call", "are", "equal", "or", "almost", "but", "not", "quite", "equal", "." ]
[ "func", "(", "c", "*", "Call", ")", "similar", "(", "r", "*", "Call", ",", "similar", "Similarity", ")", "bool", "{", "<mask>", "c", ".", "SrcPath", "==", "r", ".", "SrcPath", "&&", "c", ".", "Line", "==", "r", ".", "Line", "&&", "c", ".", "Func", "==", "r", ".", "Func", "&&", "c", ".", "Args", ".", "similar", "(", "&", "r", ".", "Args", ",", "similar", ")", "\n", "}" ]
78
all-79
[ "OnCheck", "sets", "the", "callback", "that", "is", "called", "when", "the", "button", "OK", "is", "clicked", ".", "The", "dialog", "sends", "to", "the", "callback", "two", "arguments", ":", "username", "and", "password", ".", "The", "callback", "validates", "the", "arguments", "and", "if", "the", "credentials", "are", "valid", "it", "returns", "true", ".", "That", "means", "the", "dialog", "can", "be", "closed", ".", "If", "the", "callback", "returns", "false", "then", "the", "dialog", "remains", "on", "the", "screen", "." ]
[ "func", "(", "d", "*", "LoginDialog", ")", "OnCheck", "(", "fn", "func", "(", "string", ",", "<mask>", ")", "bool", ")", "{", "WindowManager", "(", ")", ".", "BeginUpdate", "(", ")", "\n", "defer", "WindowManager", "(", ")", ".", "EndUpdate", "(", ")", "\n", "d", ".", "onCheck", "=", "fn", "\n", "}" ]
79
all-80
[ "isMemberBootstrapped", "tries", "to", "check", "if", "the", "given", "member", "has", "been", "bootstrapped", "in", "the", "given", "cluster", "." ]
[ "func", "isMemberBootstrapped", "(", "lg", "*", "zap", ".", "Logger", ",", "cl", "*", "membership", ".", "RaftCluster", ",", "member", "string", ",", "rt", "http", ".", "RoundTripper", ",", "timeout", "time", ".", "Duration", ")", "bool", "{", "rcl", ",", "err", ":=", "getClusterFromRemotePeers", "(", "lg", ",", "getRemotePeerURLs", "(", "cl", ",", "<mask>", ")", ",", "timeout", ",", "false", ",", "rt", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", "\n", "}", "\n", "id", ":=", "cl", ".", "MemberByName", "(", "member", ")", ".", "ID", "\n", "m", ":=", "rcl", ".", "Member", "(", "id", ")", "\n", "if", "m", "==", "nil", "{", "return", "false", "\n", "}", "\n", "if", "len", "(", "m", ".", "ClientURLs", ")", ">", "0", "{", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}" ]
80
all-81
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "the", "current", "program", "object" ]
[ "func", "Uniform3i", "(", "location", "int32", ",", "v0", "int32", ",", "v1", "int32", ",", "v2", "int32", ")", "{", "syscall", ".", "Syscall6", "(", "gpUniform3i", ",", "4", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "v0", ")", ",", "uintptr", "(", "v1", ")", ",", "uintptr", "(", "v2", ")", ",", "0", ",", "0", ")", "\n", "}" ]
81
all-82
[ "RegisterAction", "register", "global", "action" ]
[ "func", "(", "bar", "*", "ActionBar", ")", "RegisterAction", "(", "action", "ActionInterface", ")", "{", "bar", ".", "GlobalActions", "=", "append", "(", "<mask>", ".", "GlobalActions", ",", "action", ")", "\n", "bar", ".", "actions", "=", "bar", ".", "GlobalActions", "\n", "}" ]
82
all-83
[ "HasPrecision", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "q", "*", "QueryValueDefinition", ")", "HasPrecision", "(", ")", "bool", "{", "if", "q", "!=", "nil", "&&", "q", ".", "Precision", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
83
all-84
[ "writeToMetadata", "puts", "the", "metadata", "into", "JSON", "format", "and", "writes", "into", "the", "metadata", "file" ]
[ "func", "writeToMetadataFile", "(", "osWrap", "oswrapper", ".", "OS", ",", "ioutilWrap", "ioutilwrapper", ".", "IOUtil", ",", "data", "[", "]", "byte", ",", "taskARN", "string", ",", "containerName", "string", ",", "dataDir", "string", ")", "error", "{", "metadataFileDir", ",", "err", ":=", "getMetadataFilePath", "(", "taskARN", ",", "containerName", ",", "dataDir", ")", "\n", "// Boundary case if file path is bad (Such as if task arn is incorrectly formatted)", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "taskARN", ",", "containerName", ",", "err", ")", "\n", "}", "\n", "metadataFileName", ":=", "filepath", ".", "Join", "(", "metadataFileDir", ",", "metadataFile", ")", "\n\n", "temp", ",", "err", ":=", "ioutilWrap", ".", "TempFile", "(", "metadataFileDir", ",", "tempFile", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "temp", ".", "Close", "(", ")", "\n", "_", ",", "err", "=", "temp", ".", "Write", "(", "data", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "err", "=", "temp", ".", "Chmod", "(", "metadataPerm", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "osWrap", ".", "Rename", "(", "<mask>", ".", "Name", "(", ")", ",", "metadataFileName", ")", "\n", "}" ]
84
all-85
[ "NewServiceSource", "creates", "a", "new", "serviceSource", "with", "the", "given", "config", "." ]
[ "func", "NewServiceSource", "(", "kubeClient", "kubernetes", ".", "Interface", ",", "namespace", ",", "annotationFilter", "string", ",", "fqdnTemplate", "string", ",", "combineFqdnAnnotation", "bool", ",", "compatibility", "string", ",", "publishInternal", "bool", ",", "publishHostIP", "bool", ",", "serviceTypeFilter", "[", "]", "string", ",", "ignoreHostnameAnnotation", "bool", ")", "(", "Source", ",", "error", ")", "{", "var", "(", "tmpl", "*", "template", ".", "Template", "\n", "err", "error", "\n", ")", "\n", "if", "fqdnTemplate", "!=", "\"", "\"", "{", "tmpl", ",", "err", "=", "template", ".", "New", "(", "\"", "\"", ")", ".", "Funcs", "(", "template", ".", "FuncMap", "{", "\"", "\"", ":", "strings", ".", "TrimPrefix", ",", "}", ")", ".", "Parse", "(", "fqdnTemplate", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "// Use shared informers to listen for add/update/delete of services/pods/nodes in the specified namespace.", "// Set resync period to 0, to prevent processing when nothing has changed", "informerFactory", ":=", "kubeinformers", ".", "NewSharedInformerFactoryWithOptions", "(", "kubeClient", ",", "0", ",", "kubeinformers", ".", "WithNamespace", "(", "namespace", ")", ")", "\n", "serviceInformer", ":=", "informerFactory", ".", "Core", "(", ")", ".", "V1", "(", ")", ".", "Services", "(", ")", "\n", "podInformer", ":=", "informerFactory", ".", "Core", "(", ")", ".", "V1", "(", ")", ".", "Pods", "(", ")", "\n", "nodeInformer", ":=", "informerFactory", ".", "Core", "(", ")", ".", "V1", "(", ")", ".", "Nodes", "(", ")", "\n\n", "// Add default resource event handlers to properly initialize informer.", "serviceInformer", ".", "Informer", "(", ")", ".", "AddEventHandler", "(", "cache", ".", "ResourceEventHandlerFuncs", "{", "AddFunc", ":", "func", "(", "obj", "interface", "{", "}", ")", "{", "log", ".", "Debug", "(", "\"", "\"", ")", "\n", "}", ",", "}", ",", ")", "\n", "podInformer", ".", "Informer", "(", ")", ".", "AddEventHandler", "(", "cache", ".", "ResourceEventHandlerFuncs", "{", "AddFunc", ":", "func", "(", "obj", "<mask>", "{", "}", ")", "{", "log", ".", "Debug", "(", "\"", "\"", ")", "\n", "}", ",", "}", ",", ")", "\n", "nodeInformer", ".", "Informer", "(", ")", ".", "AddEventHandler", "(", "cache", ".", "ResourceEventHandlerFuncs", "{", "AddFunc", ":", "func", "(", "obj", "interface", "{", "}", ")", "{", "log", ".", "Debug", "(", "\"", "\"", ")", "\n", "}", ",", "}", ",", ")", "\n\n", "// TODO informer is not explicitly stopped since controller is not passing in its channel.", "informerFactory", ".", "Start", "(", "wait", ".", "NeverStop", ")", "\n\n", "// wait for the local cache to be populated.", "err", "=", "wait", ".", "Poll", "(", "time", ".", "Second", ",", "60", "*", "time", ".", "Second", ",", "func", "(", ")", "(", "bool", ",", "error", ")", "{", "return", "serviceInformer", ".", "Informer", "(", ")", ".", "HasSynced", "(", ")", "==", "true", ",", "nil", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "// Transform the slice into a map so it will", "// be way much easier and fast to filter later", "serviceTypes", ":=", "make", "(", "map", "[", "string", "]", "struct", "{", "}", ")", "\n", "for", "_", ",", "serviceType", ":=", "range", "serviceTypeFilter", "{", "serviceTypes", "[", "serviceType", "]", "=", "struct", "{", "}", "{", "}", "\n", "}", "\n\n", "return", "&", "serviceSource", "{", "client", ":", "kubeClient", ",", "namespace", ":", "namespace", ",", "annotationFilter", ":", "annotationFilter", ",", "compatibility", ":", "compatibility", ",", "fqdnTemplate", ":", "tmpl", ",", "combineFQDNAnnotation", ":", "combineFqdnAnnotation", ",", "ignoreHostnameAnnotation", ":", "ignoreHostnameAnnotation", ",", "publishInternal", ":", "publishInternal", ",", "publishHostIP", ":", "publishHostIP", ",", "serviceInformer", ":", "serviceInformer", ",", "podInformer", ":", "podInformer", ",", "nodeInformer", ":", "nodeInformer", ",", "serviceTypeFilter", ":", "serviceTypes", ",", "}", ",", "nil", "\n", "}" ]
85
all-86
[ "portGroupIDsFromResourceID", "passes", "a", "resource", "s", "ID", "through", "splitHostPortGroupID", "." ]
[ "func", "portGroupIDsFromResourceID", "(", "d", "*", "schema", ".", "ResourceData", ")", "(", "string", ",", "string", ",", "error", ")", "{", "return", "splitHostPortGroupID", "(", "d", ".", "<mask>", "(", ")", ")", "\n", "}" ]
86
all-87
[ "vaultRenewDuration", "accepts", "a", "secret", "and", "returns", "the", "recommended", "amount", "of", "time", "to", "sleep", "." ]
[ "func", "vaultRenewDuration", "(", "s", "*", "Secret", ")", "time", ".", "Duration", "{", "// Handle whether this is an auth or a regular secret.", "base", ":=", "s", ".", "LeaseDuration", "\n", "if", "s", ".", "Auth", "!=", "nil", "&&", "s", ".", "Auth", ".", "LeaseDuration", ">", "0", "{", "base", "=", "s", ".", "Auth", ".", "LeaseDuration", "\n", "}", "\n\n", "// Ensure we have a lease duration, since sometimes this can be zero.", "if", "base", "<=", "0", "{", "base", "=", "int", "(", "VaultDefaultLeaseDuration", ".", "Seconds", "(", ")", ")", "\n", "}", "\n\n", "// Convert to float seconds.", "sleep", ":=", "float64", "(", "time", ".", "Duration", "(", "base", ")", "*", "time", ".", "Second", ")", "\n\n", "if", "vaultSecretRenewable", "(", "s", ")", "{", "// Renew at 1/3 the remaining lease. This will give us an opportunity to retry", "// at least one more time should the first renewal fail.", "sleep", "=", "sleep", "/", "3.0", "\n\n", "// Use some randomness so many clients do not hit Vault simultaneously.", "sleep", "=", "sleep", "*", "(", "rand", ".", "Float64", "(", ")", "+", "1", ")", "/", "2.0", "\n", "}", "else", "{", "// For non-renewable leases set the renew duration to use much of the secret", "// lease as possible. Use a stagger over 85%-95% of the lease duration so that", "// many clients do not hit Vault simultaneously.", "sleep", "=", "sleep", "*", "(", ".85", "+", "rand", ".", "Float64", "(", ")", "*", "0.1", ")", "\n", "}", "\n\n", "return", "<mask>", ".", "Duration", "(", "sleep", ")", "\n", "}" ]
87
all-88
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "TrackCacheStorageForOriginParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoStorage4", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
88
all-89
[ "newImageDestination", "returns", "an", "ImageDestination", "for", "writing", "to", "an", "existing", "directory", "." ]
[ "func", "newImageDestination", "(", "ctx", "context", ".", "Context", ",", "sys", "*", "types", ".", "SystemContext", ",", "ref", "ociArchiveReference", ")", "(", "types", ".", "ImageDestination", ",", "error", ")", "{", "tempDirRef", ",", "err", ":=", "createOCIRef", "(", "ref", ".", "image", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "<mask>", ".", "Wrapf", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "unpackedDest", ",", "err", ":=", "tempDirRef", ".", "ociRefExtracted", ".", "NewImageDestination", "(", "ctx", ",", "sys", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", ":=", "tempDirRef", ".", "deleteTempDir", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "tempDirRef", ".", "tempDirectory", ")", "\n", "}", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "ociArchiveImageDestination", "{", "ref", ":", "ref", ",", "unpackedDest", ":", "unpackedDest", ",", "tempDirRef", ":", "tempDirRef", "}", ",", "nil", "\n", "}" ]
89
all-90
[ "Size", "returns", "memory", "used", "by", "the", "node" ]
[ "func", "(", "n", "<mask>", ")", "Size", "(", ")", "int", "{", "return", "int", "(", "nodeHdrSize", "+", "uintptr", "(", "n", ".", "level", "+", "1", ")", "*", "nodeRefSize", ")", "\n", "}" ]
90
all-91
[ "CopyImage", "copies", "img", "to", "a", "new", "RGBA", "image", ".", "Basically", "CopyImage", "just", "calls", "draw", ".", "Draw", ".", "If", "img", "is", "a", "paletted", "image", "an", "optimized", "copying", "method", "is", "used", ".", "CopyImage", "is", "used", "only", "internally", "but", "it", "is", "exposed", "for", "testing", "." ]
[ "func", "CopyImage", "(", "img", "<mask>", ".", "Image", ")", "[", "]", "byte", "{", "size", ":=", "img", ".", "Bounds", "(", ")", ".", "Size", "(", ")", "\n", "w", ",", "h", ":=", "size", ".", "X", ",", "size", ".", "Y", "\n", "bs", ":=", "make", "(", "[", "]", "byte", ",", "4", "*", "w", "*", "h", ")", "\n\n", "switch", "img", ":=", "img", ".", "(", "type", ")", "{", "case", "*", "image", ".", "Paletted", ":", "b", ":=", "img", ".", "Bounds", "(", ")", "\n", "x0", ":=", "b", ".", "Min", ".", "X", "\n", "y0", ":=", "b", ".", "Min", ".", "Y", "\n", "x1", ":=", "b", ".", "Max", ".", "X", "\n", "y1", ":=", "b", ".", "Max", ".", "Y", "\n\n", "palette", ":=", "make", "(", "[", "]", "uint8", ",", "len", "(", "img", ".", "Palette", ")", "*", "4", ")", "\n", "for", "i", ",", "c", ":=", "range", "img", ".", "Palette", "{", "rgba", ":=", "color", ".", "RGBAModel", ".", "Convert", "(", "c", ")", ".", "(", "color", ".", "RGBA", ")", "\n", "palette", "[", "4", "*", "i", "]", "=", "rgba", ".", "R", "\n", "palette", "[", "4", "*", "i", "+", "1", "]", "=", "rgba", ".", "G", "\n", "palette", "[", "4", "*", "i", "+", "2", "]", "=", "rgba", ".", "B", "\n", "palette", "[", "4", "*", "i", "+", "3", "]", "=", "rgba", ".", "A", "\n", "}", "\n", "// Even img is a subimage of another image, Pix starts with 0-th index.", "idx0", ":=", "0", "\n", "idx1", ":=", "0", "\n", "d", ":=", "img", ".", "Stride", "-", "(", "x1", "-", "x0", ")", "\n", "for", "j", ":=", "0", ";", "j", "<", "y1", "-", "y0", ";", "j", "++", "{", "for", "i", ":=", "0", ";", "i", "<", "x1", "-", "x0", ";", "i", "++", "{", "p", ":=", "int", "(", "img", ".", "Pix", "[", "idx0", "]", ")", "\n", "bs", "[", "idx1", "]", "=", "palette", "[", "4", "*", "p", "]", "\n", "bs", "[", "idx1", "+", "1", "]", "=", "palette", "[", "4", "*", "p", "+", "1", "]", "\n", "bs", "[", "idx1", "+", "2", "]", "=", "palette", "[", "4", "*", "p", "+", "2", "]", "\n", "bs", "[", "idx1", "+", "3", "]", "=", "palette", "[", "4", "*", "p", "+", "3", "]", "\n", "idx0", "++", "\n", "idx1", "+=", "4", "\n", "}", "\n", "idx0", "+=", "d", "\n", "}", "\n", "default", ":", "dstImg", ":=", "&", "image", ".", "RGBA", "{", "Pix", ":", "bs", ",", "Stride", ":", "4", "*", "w", ",", "Rect", ":", "image", ".", "Rect", "(", "0", ",", "0", ",", "w", ",", "h", ")", ",", "}", "\n", "draw", ".", "Draw", "(", "dstImg", ",", "image", ".", "Rect", "(", "0", ",", "0", ",", "w", ",", "h", ")", ",", "img", ",", "img", ".", "Bounds", "(", ")", ".", "Min", ",", "draw", ".", "Src", ")", "\n", "}", "\n", "return", "bs", "\n", "}" ]
91
all-92
[ "AnalyzeAttribute", "analyzes", "an", "attribute", "creating", "a", "corresponding", "ActionParam", "." ]
[ "func", "(", "a", "*", "APIAnalyzer", ")", "AnalyzeAttribute", "(", "name", ",", "query", "string", ",", "attr", "map", "[", "string", "]", "interface", "{", "}", ")", "(", "*", "gen", ".", "ActionParam", ",", "error", ")", "{", "param", ":=", "gen", ".", "ActionParam", "{", "Name", ":", "name", ",", "QueryName", ":", "query", ",", "VarName", ":", "toVarName", "(", "<mask>", ")", "}", "\n", "if", "d", ",", "ok", ":=", "attr", "[", "\"", "\"", "]", ";", "ok", "{", "param", ".", "Description", "=", "removeBlankLines", "(", "d", ".", "(", "string", ")", ")", "\n", "}", "\n", "if", "r", ",", "ok", ":=", "attr", "[", "\"", "\"", "]", ";", "ok", "{", "if", "r", ".", "(", "bool", ")", "{", "param", ".", "Mandatory", "=", "true", "\n", "}", "\n", "}", "\n", "if", "options", ",", "ok", ":=", "attr", "[", "\"", "\"", "]", ";", "ok", "{", "opts", ",", "ok", ":=", "options", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "if", "ok", "{", "for", "n", ",", "o", ":=", "range", "opts", "{", "switch", "n", "{", "case", "\"", "\"", ":", "param", ".", "Max", "=", "int", "(", "o", ".", "(", "float64", ")", ")", "\n", "case", "\"", "\"", ":", "param", ".", "Min", "=", "int", "(", "o", ".", "(", "float64", ")", ")", "\n", "case", "\"", "\"", ":", "param", ".", "Regexp", "=", "o", ".", "(", "string", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "if", "values", ",", "ok", ":=", "attr", "[", "\"", "\"", "]", ";", "ok", "{", "param", ".", "ValidValues", "=", "values", ".", "(", "[", "]", "interface", "{", "}", ")", "\n", "}", "\n", "t", ":=", "attr", "[", "\"", "\"", "]", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "dataType", ",", "err", ":=", "a", ".", "AnalyzeType", "(", "t", ",", "query", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "param", ".", "Type", "=", "dataType", "\n", "switch", "dataType", ".", "(", "type", ")", "{", "case", "*", "gen", ".", "ArrayDataType", ":", "param", ".", "QueryName", "+=", "\"", "\"", "\n", "}", "\n\n", "return", "&", "param", ",", "nil", "\n", "}" ]
92
all-93
[ "Data", "returns", "the", "language", "data", "stored", "in", "the", "request", "." ]
[ "func", "Data", "(", "r", "*", "http", ".", "Request", ")", "ContextValue", "{", "if", "v", ",", "ok", ":=", "r", ".", "<mask>", "(", ")", ".", "Value", "(", "ContextKey", ")", ".", "(", "ContextValue", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n\n", "return", "ContextValue", "{", "}", "\n", "}" ]
93
all-94
[ "Stability", ":", "***", "EXPERIMENTAL", "***", "Return", "a", "list", "of", "possible", "prices", "for", "EC2", "See", "https", ":", "//", "docs", ".", "taskcluster", ".", "net", "/", "reference", "/", "core", "/", "ec2", "-", "manager", "/", "api", "-", "docs#getSpecificPrices" ]
[ "func", "(", "eC2Manager", "*", "EC2Manager", ")", "GetSpecificPrices", "(", "payload", "*", "ListOfRestrictionsForPrices", ")", "(", "*", "ListOfPrices", ",", "error", ")", "{", "cd", ":=", "tcclient", ".", "<mask>", "(", "*", "eC2Manager", ")", "\n", "responseObject", ",", "_", ",", "err", ":=", "(", "&", "cd", ")", ".", "APICall", "(", "payload", ",", "\"", "\"", ",", "\"", "\"", ",", "new", "(", "ListOfPrices", ")", ",", "nil", ")", "\n", "return", "responseObject", ".", "(", "*", "ListOfPrices", ")", ",", "err", "\n", "}" ]
94
all-95
[ "ProvisionHost", "--", "given", "info", "provision", "a", "host", "in", "inkeeper", "http", ":", "//", "pez", "-", "app", ".", "core", ".", "pao", ".", "pez", ".", "pivotal", ".", "io", ":", "5555", "/", "api", "/", "v1", "/", "ProvisionHost?geo_loc", "=", "PAO&sku", "=", "4D", ".", "lowmem", ".", "R7&os", "=", "esxi60u2&count", "=", "1&feature", "=", "&tenantid", "=", "pez", "-", "stage" ]
[ "func", "(", "s", "*", "IkClient", ")", "ProvisionHost", "(", "sku", "string", ",", "tenantid", "string", ")", "(", "info", "*", "ProvisionHostResponse", ",", "err", "error", ")", "{", "info", "=", "<mask>", "(", "ProvisionHostResponse", ")", "\n", "qp", ":=", "url", ".", "Values", "{", "}", "\n", "qp", ".", "Add", "(", "\"", "\"", ",", "sku", ")", "\n", "qp", ".", "Add", "(", "\"", "\"", ",", "tenantid", ")", "\n", "err", "=", "s", ".", "Call", "(", "RouteProvisionHost", ",", "qp", ",", "info", ")", "\n", "return", "\n", "}" ]
95
all-96
[ "ArcTo", "adds", "an", "arc", "to", "the", "path" ]
[ "func", "(", "p", "*", "Path", ")", "ArcTo", "(", "cx", ",", "cy", ",", "rx", ",", "ry", ",", "startAngle", ",", "angle", "float64", ")", "{", "endAngle", ":=", "startAngle", "+", "angle", "\n", "clockWise", ":=", "<mask>", "\n", "if", "angle", "<", "0", "{", "clockWise", "=", "false", "\n", "}", "\n", "// normalize", "if", "clockWise", "{", "for", "endAngle", "<", "startAngle", "{", "endAngle", "+=", "math", ".", "Pi", "*", "2.0", "\n", "}", "\n", "}", "else", "{", "for", "startAngle", "<", "endAngle", "{", "startAngle", "+=", "math", ".", "Pi", "*", "2.0", "\n", "}", "\n", "}", "\n", "startX", ":=", "cx", "+", "math", ".", "Cos", "(", "startAngle", ")", "*", "rx", "\n", "startY", ":=", "cy", "+", "math", ".", "Sin", "(", "startAngle", ")", "*", "ry", "\n", "if", "len", "(", "p", ".", "Components", ")", ">", "0", "{", "p", ".", "LineTo", "(", "startX", ",", "startY", ")", "\n", "}", "else", "{", "p", ".", "MoveTo", "(", "startX", ",", "startY", ")", "\n", "}", "\n", "p", ".", "appendToPath", "(", "ArcToCmp", ",", "cx", ",", "cy", ",", "rx", ",", "ry", ",", "startAngle", ",", "angle", ")", "\n", "p", ".", "x", "=", "cx", "+", "math", ".", "Cos", "(", "endAngle", ")", "*", "rx", "\n", "p", ".", "y", "=", "cy", "+", "math", ".", "Sin", "(", "endAngle", ")", "*", "ry", "\n", "}" ]
96
all-97
[ "defaultServerURLFor", "is", "a", "modified", "copy", "of", "k8s", ".", "io", "/", "kubernets", "/", "pkg", "/", "client", "/", "restclient", ".", "defaultServerURLFor", ".", "defaultServerUrlFor", "is", "shared", "between", "IsConfigTransportTLS", "and", "RESTClientFor", ".", "It", "requires", "Host", "and", "Version", "to", "be", "set", "prior", "to", "being", "called", "." ]
[ "func", "defaultServerURLFor", "(", "config", "*", "restConfig", ")", "(", "*", "url", ".", "URL", ",", "error", ")", "{", "// TODO: move the default to secure when the apiserver supports TLS by default", "// config.Insecure is taken to mean \"I want HTTPS but don't bother checking the certs against a CA.\"", "hasCA", ":=", "len", "(", "config", ".", "CAFile", ")", "!=", "0", "||", "len", "(", "config", ".", "CAData", ")", "!=", "0", "\n", "hasCert", ":=", "len", "(", "config", ".", "CertFile", ")", "!=", "0", "||", "len", "(", "config", ".", "CertData", ")", "!=", "0", "\n", "defaultTLS", ":=", "hasCA", "||", "hasCert", "||", "config", ".", "Insecure", "\n", "host", ":=", "config", ".", "Host", "\n", "if", "<mask>", "==", "\"", "\"", "{", "host", "=", "\"", "\"", "\n", "}", "\n\n", "// REMOVED: Configurable APIPath, GroupVersion", "return", "defaultServerURL", "(", "host", ",", "defaultTLS", ")", "\n", "}" ]
97
all-98
[ "forceSSL", "will", "return", "a", "middleware", "that", "will", "redirect", "an", "incoming", "request", "if", "it", "is", "not", "HTTPS", ".", "http", ":", "//", "example", ".", "com", "=", ">", "https", ":", "//", "example", ".", "com", ".", "This", "middleware", "does", "**", "not", "**", "enable", "SSL", ".", "for", "your", "application", ".", "To", "do", "that", "we", "recommend", "using", "a", "proxy", ":", "https", ":", "//", "gobuffalo", ".", "io", "/", "en", "/", "docs", "/", "proxy", "for", "more", "information", ":", "https", ":", "//", "github", ".", "com", "/", "unrolled", "/", "secure", "/" ]
[ "func", "forceSSL", "(", ")", "buffalo", ".", "MiddlewareFunc", "{", "return", "forcessl", ".", "Middleware", "(", "secure", ".", "Options", "{", "SSLRedirect", ":", "ENV", "==", "\"", "\"", ",", "SSLProxyHeaders", ":", "<mask>", "[", "string", "]", "string", "{", "\"", "\"", ":", "\"", "\"", "}", ",", "}", ")", "\n", "}" ]
98
all-99
[ "String", "returns", "the", "human", "-", "friendly", "version", "of", "this", "dependency", "." ]
[ "func", "(", "d", "*", "CatalogNodesQuery", ")", "String", "(", ")", "string", "{", "name", ":=", "\"", "\"", "\n", "if", "d", ".", "dc", "!=", "\"", "\"", "{", "<mask>", "=", "name", "+", "\"", "\"", "+", "d", ".", "dc", "\n", "}", "\n", "if", "d", ".", "near", "!=", "\"", "\"", "{", "name", "=", "name", "+", "\"", "\"", "+", "d", ".", "near", "\n", "}", "\n\n", "if", "name", "==", "\"", "\"", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", "\n", "}" ]
99
all-100
[ "Locator", "returns", "a", "locator", "for", "the", "given", "resource" ]
[ "func", "(", "r", "*", "PublicationLineage", ")", "Locator", "(", "api", "*", "API", ")", "*", "PublicationLineageLocator", "{", "for", "_", ",", "l", ":=", "<mask>", "r", ".", "Links", "{", "if", "l", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "return", "api", ".", "PublicationLineageLocator", "(", "l", "[", "\"", "\"", "]", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]