id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
11,600
all-11601
[ "New", "returns", "an", "ECS", "httpClient", "with", "a", "roundtrip", "timeout", "of", "the", "given", "duration" ]
[ "func", "New", "(", "timeout", "time", ".", "Duration", ",", "insecureSkipVerify", "bool", ")", "*", "<mask>", ".", "Client", "{", "// Transport is the transport requests will be made over", "// Note, these defaults are taken from the golang http library. We do not", "// explicitly do not use theirs to avoid changing their behavior.", "transport", ":=", "&", "http", ".", "Transport", "{", "Proxy", ":", "http", ".", "ProxyFromEnvironment", ",", "Dial", ":", "(", "&", "net", ".", "Dialer", "{", "Timeout", ":", "defaultDialTimeout", ",", "KeepAlive", ":", "defaultDialKeepalive", ",", "}", ")", ".", "Dial", ",", "TLSHandshakeTimeout", ":", "10", "*", "time", ".", "Second", ",", "}", "\n\n", "transport", ".", "TLSClientConfig", "=", "&", "tls", ".", "Config", "{", "}", "\n", "cipher", ".", "WithSupportedCipherSuites", "(", "transport", ".", "TLSClientConfig", ")", "\n", "transport", ".", "TLSClientConfig", ".", "InsecureSkipVerify", "=", "insecureSkipVerify", "\n\n", "client", ":=", "&", "http", ".", "Client", "{", "Transport", ":", "&", "ecsRoundTripper", "{", "insecureSkipVerify", ",", "transport", "}", ",", "Timeout", ":", "timeout", ",", "}", "\n\n", "return", "client", "\n", "}" ]
11,601
all-11602
[ "Delete", "an", "item", "from", "the", "skiplist" ]
[ "func", "(", "s", "*", "Skiplist", ")", "Delete", "(", "itm", "unsafe", ".", "Pointer", ",", "cmp", "CompareFn", ",", "buf", "*", "ActionBuffer", ",", "sts", "*", "Stats", ")", "bool", "{", "token", ":=", "s", ".", "barrier", ".", "Acquire", "(", ")", "\n", "defer", "s", ".", "barrier", ".", "Release", "(", "token", ")", "\n\n", "<mask>", ":=", "s", ".", "findPath", "(", "itm", ",", "cmp", ",", "buf", ",", "sts", ")", "!=", "nil", "\n", "if", "!", "found", "{", "return", "false", "\n", "}", "\n\n", "delNode", ":=", "buf", ".", "succs", "[", "0", "]", "\n", "return", "s", ".", "deleteNode", "(", "delNode", ",", "cmp", ",", "buf", ",", "sts", ")", "\n", "}" ]
11,602
all-11603
[ "GetDefaultLeftMargin", "()", "is", "a", "wrapper", "around", "gtk_paper_size_get_default_left_margin", "()", "." ]
[ "func", "(", "ps", "*", "PaperSize", ")", "GetDefaultLeftMargin", "(", "<mask>", "Unit", ")", "float64", "{", "c", ":=", "C", ".", "gtk_paper_size_get_default_left_margin", "(", "ps", ".", "native", "(", ")", ",", "C", ".", "GtkUnit", "(", "unit", ")", ")", "\n", "return", "float64", "(", "c", ")", "\n", "}" ]
11,603
all-11604
[ "HasId", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "c", "*", "Comment", ")", "HasId", "(", ")", "bool", "{", "if", "c", "!=", "nil", "&&", "c", ".", "Id", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
11,604
all-11605
[ "/", "*", "polymorph", "TaskWrapper", "task", "false", "Validate", "validates", "this", "task", "wrapper" ]
[ "func", "(", "m", "*", "TaskWrapper", ")", "Validate", "(", "formats", "strfmt", ".", "Registry", ")", "error", "{", "var", "<mask>", "[", "]", "error", "\n\n", "if", "err", ":=", "m", ".", "validateTask", "(", "formats", ")", ";", "err", "!=", "nil", "{", "// prop", "res", "=", "append", "(", "res", ",", "err", ")", "\n", "}", "\n\n", "if", "len", "(", "res", ")", ">", "0", "{", "return", "errors", ".", "CompositeValidationError", "(", "res", "...", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
11,605
all-11606
[ "Template", "is", "a", "string", "template", "which", "replaces", "template", "placeholders", "delimited", "by", "{{", "and", "}}", "with", "values", "from", "map", ".", "The", "global", "delimiters", "may", "be", "set", "with", "SetTemplateDelimiters", "." ]
[ "func", "Template", "(", "s", "string", ",", "values", "map", "[", "string", "]", "<mask>", "{", "}", ")", "string", "{", "return", "TemplateWithDelimiters", "(", "s", ",", "values", ",", "templateOpen", ",", "templateClose", ")", "\n", "}" ]
11,606
all-11607
[ "CVAPI", "(", "void", ")", "cvReleaseStructuringElement", "(", "IplConvKernel", "**", "element", ")", ";", "/", "*", "Dilates", "an", "image", "by", "using", "a", "specific", "structuring", "element", "." ]
[ "func", "Dilate", "(", "src", ",", "dst", "*", "IplImage", ",", "element", "*", "IplConvKernel", ",", "iterations", "int", ")", "{", "C", ".", "cvDilate", "(", "unsafe", ".", "Pointer", "(", "src", ")", ",", "unsafe", ".", "Pointer", "(", "dst", ")", ",", "(", "*", "C", ".", "IplConvKernel", ")", "(", "unsafe", ".", "Pointer", "(", "<mask>", ")", ")", ",", "C", ".", "int", "(", "iterations", ")", ",", ")", "\n", "}" ]
11,607
all-11608
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "UntrackCacheStorageForOriginParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoStorage2", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
11,608
all-11609
[ "GetDisabledOk", "returns", "a", "tuple", "with", "the", "Disabled", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "u", "*", "User", ")", "GetDisabledOk", "(", ")", "(", "bool", ",", "bool", ")", "{", "if", "u", "==", "nil", "||", "u", ".", "Disabled", "==", "nil", "{", "return", "false", ",", "<mask>", "\n", "}", "\n", "return", "*", "u", ".", "Disabled", ",", "true", "\n", "}" ]
11,609
all-11610
[ "CreateSecretRequest", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "CreateSecretRequest", "(", "arg0", "*", "secretsmanager", ".", "CreateSecretInput", ")", "(", "*", "request", ".", "Request", ",", "*", "secretsmanager", ".", "CreateSecretOutput", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "<mask>", "[", "0", "]", ".", "(", "*", "request", ".", "Request", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "*", "secretsmanager", ".", "CreateSecretOutput", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
11,610
all-11611
[ "DeleteCollection", "does", "nothing", "on", "a", "dry", "-", "run", "client" ]
[ "func", "(", "c", "*", "dryRunProwJobClient", ")", "DeleteCollection", "(", "<mask>", "*", "metav1", ".", "DeleteOptions", ",", "listOptions", "metav1", ".", "ListOptions", ")", "error", "{", "return", "nil", "\n", "}" ]
11,611
all-11612
[ "CustomLogFunc", "outputs", "custom", "level", "log", "returned", "from", "the", "function" ]
[ "func", "CustomLogFunc", "(", "level", "string", ",", "f", "func", "(", ")", "string", ")", "error", "{", "lv", ":=", "TagStringToLevel", "(", "<mask>", ")", "\n", "if", "isModeEnable", "(", "lv", ")", "{", "return", "glg", ".", "out", "(", "lv", ",", "\"", "\"", ",", "f", "(", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
11,612
all-11613
[ "GetLogs", "gets", "logs", "from", "a", "job", "(", "logs", "includes", "stdout", "and", "stderr", ")", ".", "pipelineName", "jobID", "data", "and", "datumID", "are", "all", "filters", ".", "To", "forego", "any", "filter", "simply", "pass", "an", "empty", "value", "though", "one", "of", "pipelineName", "and", "jobID", "must", "be", "set", ".", "Responses", "are", "written", "to", "messages" ]
[ "func", "(", "c", "APIClient", ")", "GetLogs", "(", "pipelineName", "string", ",", "jobID", "string", ",", "data", "[", "]", "string", ",", "datumID", "string", ",", "master", "bool", ",", "follow", "bool", ",", "tail", "int64", ",", ")", "*", "LogsIter", "{", "request", ":=", "pps", ".", "GetLogsRequest", "{", "Master", ":", "master", ",", "Follow", ":", "follow", ",", "Tail", ":", "tail", ",", "}", "\n", "resp", ":=", "&", "LogsIter", "{", "}", "\n", "if", "pipelineName", "!=", "\"", "\"", "{", "request", ".", "Pipeline", "=", "NewPipeline", "(", "pipelineName", ")", "\n", "}", "\n", "if", "jobID", "!=", "\"", "\"", "{", "request", ".", "Job", "=", "NewJob", "(", "jobID", ")", "\n", "}", "\n", "request", ".", "DataFilters", "=", "<mask>", "\n", "if", "datumID", "!=", "\"", "\"", "{", "request", ".", "Datum", "=", "&", "pps", ".", "Datum", "{", "Job", ":", "NewJob", "(", "jobID", ")", ",", "ID", ":", "datumID", ",", "}", "\n", "}", "\n", "resp", ".", "logsClient", ",", "resp", ".", "err", "=", "c", ".", "PpsAPIClient", ".", "GetLogs", "(", "c", ".", "Ctx", "(", ")", ",", "&", "request", ")", "\n", "resp", ".", "err", "=", "grpcutil", ".", "ScrubGRPC", "(", "resp", ".", "err", ")", "\n", "return", "resp", "\n", "}" ]
11,613
all-11614
[ "Processes", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockCgroup", ")", "Processes", "(", "arg0", "cgroups", ".", "Name", ",", "arg1", "bool", ")", "(", "[", "]", "cgroups", ".", "Process", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ",", "arg1", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "[", "]", "cgroups", ".", "<mask>", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
11,614
all-11615
[ "Wrap", "builds", "a", "byte", "slice", "from", "strs", "wrapping", "on", "word", "boundaries", "before", "max", "chars" ]
[ "func", "Wrap", "(", "max", "int", ",", "strs", "...", "string", ")", "[", "]", "byte", "{", "input", ":=", "make", "(", "[", "]", "byte", ",", "0", ")", "\n", "output", ":=", "make", "(", "[", "]", "byte", ",", "0", ")", "\n", "for", "_", ",", "s", ":=", "range", "strs", "{", "input", "=", "<mask>", "(", "input", ",", "[", "]", "byte", "(", "s", ")", "...", ")", "\n", "}", "\n", "if", "len", "(", "input", ")", "<", "max", "{", "// Doesn't need to be wrapped", "return", "input", "\n", "}", "\n", "ls", ":=", "-", "1", "// Last seen space index", "\n", "lw", ":=", "-", "1", "// Last written byte index", "\n", "ll", ":=", "0", "// Length of current line", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "input", ")", ";", "i", "++", "{", "ll", "++", "\n", "switch", "input", "[", "i", "]", "{", "case", "' '", ",", "'\\t'", ":", "ls", "=", "i", "\n", "}", "\n", "if", "ll", ">=", "max", "{", "if", "ls", ">=", "0", "{", "output", "=", "append", "(", "output", ",", "input", "[", "lw", "+", "1", ":", "ls", "]", "...", ")", "\n", "output", "=", "append", "(", "output", ",", "'\\r'", ",", "'\\n'", ",", "' '", ")", "\n", "lw", "=", "ls", "// Jump over the space we broke on", "\n", "ll", "=", "1", "// Count leading space above", "\n", "// Rewind", "i", "=", "lw", "+", "1", "\n", "ls", "=", "-", "1", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "append", "(", "output", ",", "input", "[", "lw", "+", "1", ":", "]", "...", ")", "\n", "}" ]
11,615
all-11616
[ "HTTPSAddress", "is", "a", "convenience", "for", "loading", "the", "node", "configuration", "and", "returning", "the", "value", "of", "core", ".", "https_address", "." ]
[ "func", "HTTPSAddress", "(", "node", "*", "<mask>", ".", "Node", ")", "(", "string", ",", "error", ")", "{", "var", "config", "*", "Config", "\n", "err", ":=", "node", ".", "Transaction", "(", "func", "(", "tx", "*", "db", ".", "NodeTx", ")", "error", "{", "var", "err", "error", "\n", "config", ",", "err", "=", "ConfigLoad", "(", "tx", ")", "\n", "return", "err", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "config", ".", "HTTPSAddress", "(", ")", ",", "nil", "\n", "}" ]
11,616
all-11617
[ "Promote", "makes", "a", "LXD", "node", "which", "is", "not", "a", "database", "node", "become", "part", "of", "the", "raft", "cluster", "." ]
[ "func", "Promote", "(", "state", "*", "state", ".", "State", ",", "gateway", "*", "Gateway", ",", "nodes", "[", "]", "db", ".", "RaftNode", ")", "error", "{", "logger", ".", "Info", "(", "\"", "\"", ")", "\n\n", "// Sanity check that this is not already a database node", "if", "gateway", ".", "IsDatabaseNode", "(", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Figure out our own address.", "address", ":=", "\"", "\"", "\n", "err", ":=", "state", ".", "Cluster", ".", "Transaction", "(", "func", "(", "tx", "*", "db", ".", "ClusterTx", ")", "error", "{", "var", "err", "error", "\n", "address", ",", "err", "=", "tx", ".", "NodeAddress", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Sanity check that we actually have an address.", "if", "<mask>", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Figure out our raft node ID, and an existing target raft node that", "// we'll contact to add ourselves as member.", "id", ":=", "\"", "\"", "\n", "target", ":=", "\"", "\"", "\n", "for", "_", ",", "node", ":=", "range", "nodes", "{", "if", "node", ".", "Address", "==", "address", "{", "id", "=", "strconv", ".", "Itoa", "(", "int", "(", "node", ".", "ID", ")", ")", "\n", "}", "else", "{", "target", "=", "node", ".", "Address", "\n", "}", "\n", "}", "\n\n", "// Sanity check that our address was actually included in the given", "// list of raft nodes.", "if", "id", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Replace our local list of raft nodes with the given one (which", "// includes ourselves). This will make the gateway start a raft node", "// when restarted.", "err", "=", "state", ".", "Node", ".", "Transaction", "(", "func", "(", "tx", "*", "db", ".", "NodeTx", ")", "error", "{", "err", "=", "tx", ".", "RaftNodesReplace", "(", "nodes", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Lock regular access to the cluster database since we don't want any", "// other database code to run while we're reconfiguring raft.", "err", "=", "state", ".", "Cluster", ".", "EnterExclusive", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// Wipe all existing raft data, for good measure (perhaps they were", "// somehow leftover).", "err", "=", "os", ".", "RemoveAll", "(", "state", ".", "OS", ".", "GlobalDatabaseDir", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// Re-initialize the gateway. This will create a new raft factory an", "// dqlite driver instance, which will be exposed over gRPC by the", "// gateway handlers.", "err", "=", "gateway", ".", "init", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "logger", ".", "Info", "(", "\"", "\"", ",", "log15", ".", "Ctx", "{", "\"", "\"", ":", "id", ",", "\"", "\"", ":", "address", ",", "\"", "\"", ":", "target", "}", ")", "\n", "changer", ":=", "gateway", ".", "raft", ".", "MembershipChanger", "(", ")", "\n", "err", "=", "changer", ".", "Join", "(", "raft", ".", "ServerID", "(", "id", ")", ",", "raft", ".", "ServerAddress", "(", "target", ")", ",", "5", "*", "time", ".", "Second", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Unlock regular access to our cluster database, and make sure our", "// gateway still works correctly.", "err", "=", "state", ".", "Cluster", ".", "ExitExclusive", "(", "func", "(", "tx", "*", "db", ".", "ClusterTx", ")", "error", "{", "_", ",", "err", ":=", "tx", ".", "Nodes", "(", ")", "\n", "return", "err", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
11,617
all-11618
[ "SetSecondaryColors", "sets", "new", "text", "and", "background", "colors", "for", "empty", "part", "of", "the", "ProgressBar" ]
[ "func", "(", "b", "*", "ProgressBar", ")", "SetSecondaryColors", "(", "fg", ",", "bg", "term", ".", "<mask>", ")", "{", "b", ".", "emptyFg", ",", "b", ".", "emptyBg", "=", "fg", ",", "bg", "\n", "}" ]
11,618
all-11619
[ "GetStateOk", "returns", "a", "tuple", "with", "the", "State", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "a", "*", "Alert", ")", "GetStateOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "a", "==", "nil", "||", "a", ".", "State", "==", "nil", "{", "return", "\"", "\"", ",", "<mask>", "\n", "}", "\n", "return", "*", "a", ".", "State", ",", "true", "\n", "}" ]
11,619
all-11620
[ "UncompressedDigest", "returns", "an", "uncompressed", "digest", "corresponding", "to", "anyDigest", ".", "May", "return", "anyDigest", "if", "it", "is", "known", "to", "be", "uncompressed", ".", "Returns", "if", "nothing", "is", "known", "about", "the", "digest", "(", "it", "may", "be", "compressed", "or", "uncompressed", ")", "." ]
[ "func", "(", "bdc", "*", "cache", ")", "UncompressedDigest", "(", "anyDigest", "digest", ".", "Digest", ")", "digest", ".", "Digest", "{", "var", "res", "digest", ".", "Digest", "\n", "if", "err", ":=", "bdc", ".", "<mask>", "(", "func", "(", "tx", "*", "bolt", ".", "Tx", ")", "error", "{", "res", "=", "bdc", ".", "uncompressedDigest", "(", "tx", ",", "anyDigest", ")", "\n", "return", "nil", "\n", "}", ")", ";", "err", "!=", "nil", "{", "// Including os.IsNotExist(err)", "return", "\"", "\"", "// FIXME? Log err (but throttle the log volume on repeated accesses)?", "\n", "}", "\n", "return", "res", "\n", "}" ]
11,620
all-11621
[ "MarshalText", "converts", "internal", "enum", "-", "like", "representation", "of", "protocol", "to", "a", "text" ]
[ "func", "(", "p", "*", "Protocol", ")", "MarshalText", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "<mask>", "*", "p", "{", "case", "ProtocolPlain", ":", "return", "[", "]", "byte", "(", "\"", "\"", ")", ",", "nil", "\n", "case", "ProtocolProtobuf", ":", "return", "[", "]", "byte", "(", "\"", "\"", ")", ",", "nil", "\n", "case", "ProtocolPickle", ":", "return", "[", "]", "byte", "(", "\"", "\"", ")", ",", "nil", "\n", "}", "\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "p", ",", "supportedProtocols", ")", "\n", "}" ]
11,621
all-11622
[ "HasColorPreference", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "m", "*", "ManageStatusDefinition", ")", "HasColorPreference", "(", ")", "bool", "{", "if", "m", "!=", "nil", "&&", "m", ".", "ColorPreference", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
11,622
all-11623
[ "Patch", "does", "nothing", "on", "a", "dry", "-", "run", "client" ]
[ "func", "(", "c", "*", "dryRunProwJobClient", ")", "Patch", "(", "<mask>", "string", ",", "pt", "types", ".", "PatchType", ",", "data", "[", "]", "byte", ",", "subresources", "...", "string", ")", "(", "result", "*", "prowapi", ".", "ProwJob", ",", "err", "error", ")", "{", "return", "nil", ",", "nil", "\n", "}" ]
11,623
all-11624
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "TerminateExecutionParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
11,624
all-11625
[ "ExternalNodes", "returns", "all", "available", "nodes", "except", "host", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ExternalNodes", "(", ")", "(", "res", "[", "]", "*", "Node", ")", "{", "for", "_", ",", "n", ":=", "range", "c", ".", "nodes", "{", "if", "n", ".", "Addr", "!=", "c", ".", "listen", "{", "<mask>", "=", "append", "(", "res", ",", "n", ")", "\n", "}", "\n", "}", "\n", "return", "\n", "}" ]
11,625
all-11626
[ "Do", "executes", "Debugger", ".", "stepOut", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "StepOutParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandStepOut", ",", "nil", ",", "nil", ")", "\n", "}" ]
11,626
all-11627
[ "Do", "executes", "Network", ".", "setRequestInterception", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "SetRequestInterceptionParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSetRequestInterception", ",", "p", ",", "nil", ")", "\n", "}" ]
11,627
all-11628
[ "GracefulPowerOff", "is", "a", "meta", "-", "operation", "that", "handles", "powering", "down", "of", "virtual", "machines", ".", "A", "graceful", "shutdown", "is", "attempted", "first", "if", "possible", "(", "VMware", "tools", "is", "installed", "and", "the", "guest", "state", "is", "not", "suspended", ")", "and", "then", "if", "allowed", "a", "power", "-", "off", "is", "forced", "if", "that", "fails", "." ]
[ "func", "GracefulPowerOff", "(", "client", "*", "govmomi", ".", "Client", ",", "vm", "*", "object", ".", "VirtualMachine", ",", "timeout", "int", ",", "force", "bool", ")", "error", "{", "vprops", ",", "err", ":=", "Properties", "(", "vm", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "// First we attempt a guest shutdown if we have VMware tools and if the VM is", "// actually powered on (we don't expect that a graceful shutdown would", "// complete on a suspended VM, so there's really no point in trying).", "if", "vprops", ".", "Runtime", ".", "PowerState", "==", "types", ".", "VirtualMachinePowerStatePoweredOn", "&&", "vprops", ".", "Guest", "!=", "nil", "&&", "vprops", ".", "Guest", ".", "ToolsRunningStatus", "==", "string", "(", "types", ".", "VirtualMachineToolsRunningStatusGuestToolsRunning", ")", "{", "if", "err", ":=", "ShutdownGuest", "(", "client", ",", "vm", ",", "timeout", ")", ";", "err", "!=", "nil", "{", "if", "err", "==", "errGuestShutdownTimeout", "&&", "!", "<mask>", "{", "return", "err", "\n", "}", "\n", "}", "else", "{", "return", "nil", "\n", "}", "\n", "}", "\n", "// If the guest shutdown failed (and we were allowed to proceed), or", "// conditions did not satisfy the criteria for a graceful shutdown, do a full", "// power-off of the VM.", "return", "PowerOff", "(", "vm", ")", "\n", "}" ]
11,628
all-11629
[ "Close", "executes", "destructor", "for", "iterator" ]
[ "func", "(", "it", "*", "Iterator", ")", "Close", "(", ")", "{", "it", ".", "snap", ".", "Close", "(", ")", "\n", "it", ".", "snap", ".", "db", ".", "<mask>", ".", "FreeBuf", "(", "it", ".", "buf", ")", "\n", "it", ".", "iter", ".", "Close", "(", ")", "\n", "}" ]
11,629
all-11630
[ "AppendEntries", "implements", "the", "Transport", "interface", "." ]
[ "func", "(", "n", "*", "NetworkTransport", ")", "AppendEntries", "(", "id", "ServerID", ",", "target", "ServerAddress", ",", "args", "*", "AppendEntriesRequest", ",", "resp", "*", "AppendEntriesResponse", ")", "error", "{", "return", "n", ".", "genericRPC", "(", "id", ",", "<mask>", ",", "rpcAppendEntries", ",", "args", ",", "resp", ")", "\n", "}" ]
11,630
all-11631
[ "ListStatuses", "gets", "commit", "statuses", "for", "a", "given", "ref", ".", "See", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "repos", "/", "statuses", "/", "#list", "-", "statuses", "-", "for", "-", "a", "-", "specific", "-", "ref" ]
[ "func", "(", "c", "*", "Client", ")", "ListStatuses", "(", "org", ",", "repo", ",", "ref", "string", ")", "(", "[", "]", "Status", ",", "error", ")", "{", "c", ".", "log", "(", "\"", "\"", ",", "org", ",", "repo", ",", "ref", ")", "\n", "path", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "repo", ",", "ref", ")", "\n", "var", "statuses", "[", "]", "Status", "\n", "err", ":=", "c", ".", "readPaginatedResults", "(", "path", ",", "acceptNone", ",", "func", "(", ")", "interface", "{", "}", "{", "return", "&", "[", "]", "Status", "{", "}", "\n", "}", ",", "func", "(", "obj", "interface", "{", "}", ")", "{", "statuses", "=", "append", "(", "statuses", ",", "*", "(", "obj", ".", "(", "*", "[", "]", "<mask>", ")", ")", "...", ")", "\n", "}", ",", ")", "\n", "return", "statuses", ",", "err", "\n", "}" ]
11,631
all-11632
[ "handleDefault", ":", "Handler", "for", "/", "always", "pass", "with", "200" ]
[ "func", "handleDefault", "(", "r", "*", "ranch", ".", "Ranch", ")", "<mask>", ".", "HandlerFunc", "{", "return", "func", "(", "res", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ")", "{", "logrus", ".", "WithField", "(", "\"", "\"", ",", "\"", "\"", ")", ".", "Infof", "(", "\"", "\"", ",", "req", ".", "RemoteAddr", ")", "\n", "}", "\n", "}" ]
11,632
all-11633
[ "copyLayerFromStream", "is", "an", "implementation", "detail", "of", "copyLayer", ";", "mostly", "providing", "a", "separate", "“defer”", "scope", ".", "it", "copies", "a", "blob", "with", "srcInfo", "(", "with", "known", "Digest", "and", "possibly", "known", "Size", ")", "from", "srcStream", "to", "dest", "perhaps", "compressing", "the", "stream", "if", "canCompress", "and", "returns", "a", "complete", "blobInfo", "of", "the", "copied", "blob", "and", "perhaps", "a", "<", "-", "chan", "diffIDResult", "if", "diffIDIsNeeded", "to", "be", "read", "by", "the", "caller", "." ]
[ "func", "(", "ic", "*", "imageCopier", ")", "copyLayerFromStream", "(", "ctx", "context", ".", "Context", ",", "srcStream", "io", ".", "Reader", ",", "srcInfo", "<mask>", ".", "BlobInfo", ",", "diffIDIsNeeded", "bool", ",", "bar", "*", "mpb", ".", "Bar", ")", "(", "types", ".", "BlobInfo", ",", "<-", "chan", "diffIDResult", ",", "error", ")", "{", "var", "getDiffIDRecorder", "func", "(", "compression", ".", "DecompressorFunc", ")", "io", ".", "Writer", "// = nil", "\n", "var", "diffIDChan", "chan", "diffIDResult", "\n\n", "err", ":=", "errors", ".", "New", "(", "\"", "\"", ")", "// For pipeWriter.CloseWithError below", "\n", "if", "diffIDIsNeeded", "{", "diffIDChan", "=", "make", "(", "chan", "diffIDResult", ",", "1", ")", "// Buffered, so that sending a value after this or our caller has failed and exited does not block.", "\n", "pipeReader", ",", "pipeWriter", ":=", "io", ".", "Pipe", "(", ")", "\n", "defer", "func", "(", ")", "{", "// Note that this is not the same as {defer pipeWriter.CloseWithError(err)}; we need err to be evaluated lazily.", "pipeWriter", ".", "CloseWithError", "(", "err", ")", "// CloseWithError(nil) is equivalent to Close()", "\n", "}", "(", ")", "\n\n", "getDiffIDRecorder", "=", "func", "(", "decompressor", "compression", ".", "DecompressorFunc", ")", "io", ".", "Writer", "{", "// If this fails, e.g. because we have exited and due to pipeWriter.CloseWithError() above further", "// reading from the pipe has failed, we don’t really care.", "// We only read from diffIDChan if the rest of the flow has succeeded, and when we do read from it,", "// the return value includes an error indication, which we do check.", "//", "// If this gets never called, pipeReader will not be used anywhere, but pipeWriter will only be", "// closed above, so we are happy enough with both pipeReader and pipeWriter to just get collected by GC.", "go", "diffIDComputationGoroutine", "(", "diffIDChan", ",", "pipeReader", ",", "decompressor", ")", "// Closes pipeReader", "\n", "return", "pipeWriter", "\n", "}", "\n", "}", "\n", "blobInfo", ",", "err", ":=", "ic", ".", "c", ".", "copyBlobFromStream", "(", "ctx", ",", "srcStream", ",", "srcInfo", ",", "getDiffIDRecorder", ",", "ic", ".", "canModifyManifest", ",", "false", ",", "bar", ")", "// Sets err to nil on success", "\n", "return", "blobInfo", ",", "diffIDChan", ",", "err", "\n", "// We need the defer … pipeWriter.CloseWithError() to happen HERE so that the caller can block on reading from diffIDChan", "}" ]
11,633
all-11634
[ "getConnectionRelay", "gets", "a", "connection", "and", "uses", "the", "given", "timeout", "to", "lazily", "create", "a", "context", "if", "a", "new", "connection", "is", "required", "." ]
[ "func", "(", "p", "*", "Peer", ")", "getConnectionRelay", "(", "timeout", "time", ".", "Duration", ")", "(", "*", "Connection", ",", "error", ")", "{", "if", "conn", ",", "ok", ":=", "p", ".", "getActiveConn", "(", ")", ";", "ok", "{", "return", "conn", ",", "nil", "\n", "}", "\n\n", "// Lock here to restrict new connection creation attempts to one goroutine", "p", ".", "newConnLock", ".", "Lock", "(", ")", "\n", "defer", "p", ".", "newConnLock", ".", "Unlock", "(", ")", "\n\n", "// Check active connections again in case someone else got ahead of us.", "if", "activeConn", ",", "<mask>", ":=", "p", ".", "getActiveConn", "(", ")", ";", "ok", "{", "return", "activeConn", ",", "nil", "\n", "}", "\n\n", "// When the relay creates outbound connections, we don't want those services", "// to ever connect back to us and send us traffic. We hide the host:port", "// so that service instances on remote machines don't try to connect back", "// and don't try to send Hyperbahn traffic on this connection.", "ctx", ",", "cancel", ":=", "NewContextBuilder", "(", "timeout", ")", ".", "HideListeningOnOutbound", "(", ")", ".", "Build", "(", ")", "\n", "defer", "cancel", "(", ")", "\n\n", "return", "p", ".", "Connect", "(", "ctx", ")", "\n", "}" ]
11,634
all-11635
[ "HasTitleAlign", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "a", "*", "AlertValueDefinition", ")", "HasTitleAlign", "(", ")", "bool", "{", "if", "a", "!=", "nil", "&&", "a", ".", "TitleAlign", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
11,635
all-11636
[ "Handle", "registers", "handler", "funcs", "with", "the", "given", "pattern", "." ]
[ "func", "(", "r", "*", "Route", ")", "Handle", "(", "pat", "string", ",", "f", "...", "HandlerFunc", ")", "{", "entry", ":=", "r", ".", "addPattern", "(", "pat", ")", "\n", "batch", ":=", "batchRoute", "(", "f", ")", "\n", "if", "err", ":=", "entry", ".", "SetHandler", "(", "<mask>", ")", ";", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "}" ]
11,636
all-11637
[ "GetLabel", "returns", "the", "Label", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "g", "*", "GraphDefinitionMarker", ")", "GetLabel", "(", ")", "string", "{", "if", "g", "==", "nil", "||", "g", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "g", ".", "Label", "\n", "}" ]
11,637
all-11638
[ "AddWindow", "constucts", "a", "new", "Window", "adds", "it", "to", "the", "composer", "automatically", "and", "makes", "it", "active", "posX", "and", "posY", "are", "top", "left", "coordinates", "of", "the", "Window", "width", "and", "height", "are", "Window", "size", "title", "is", "a", "Window", "title" ]
[ "func", "AddWindow", "(", "posX", ",", "posY", ",", "width", ",", "height", "int", ",", "title", "string", ")", "*", "Window", "{", "window", ":=", "CreateWindow", "(", "posX", ",", "posY", ",", "width", ",", "height", ",", "title", ")", "\n", "window", ".", "SetBorder", "(", "comp", ".", "windowBorder", ")", "\n\n", "<mask>", ".", "BeginUpdate", "(", ")", "\n", "comp", ".", "windows", "=", "append", "(", "comp", ".", "windows", ",", "window", ")", "\n", "comp", ".", "EndUpdate", "(", ")", "\n", "window", ".", "Draw", "(", ")", "\n", "term", ".", "Flush", "(", ")", "\n\n", "comp", ".", "activateWindow", "(", "window", ")", "\n\n", "RefreshScreen", "(", ")", "\n\n", "return", "window", "\n", "}" ]
11,638
all-11639
[ "GetCustomUnit", "returns", "the", "CustomUnit", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "q", "*", "QueryValueDefinition", ")", "GetCustomUnit", "(", ")", "<mask>", "{", "if", "q", "==", "nil", "||", "q", ".", "CustomUnit", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "q", ".", "CustomUnit", "\n", "}" ]
11,639
all-11640
[ "GetHeight", "()", "is", "a", "wrapper", "around", "gtk_print_context_get_height", "()", "." ]
[ "func", "(", "<mask>", "*", "PrintContext", ")", "GetHeight", "(", ")", "float64", "{", "c", ":=", "C", ".", "gtk_print_context_get_height", "(", "pc", ".", "native", "(", ")", ")", "\n", "return", "float64", "(", "c", ")", "\n", "}" ]
11,640
all-11641
[ "SliceContains", "determines", "whether", "val", "is", "an", "element", "in", "slice", "." ]
[ "func", "SliceContains", "(", "slice", "[", "]", "string", ",", "val", "string", ")", "bool", "{", "if", "slice", "==", "nil", "{", "return", "false", "\n", "}", "\n\n", "for", "_", ",", "it", ":=", "range", "slice", "{", "if", "it", "==", "val", "{", "return", "<mask>", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
11,641
all-11642
[ "NewRouter", "return", "a", "new", "Router" ]
[ "func", "NewRouter", "(", ")", "*", "Router", "{", "r", ":=", "&", "Router", "{", "}", "\n", "r", ".", "roots", "=", "<mask>", "(", "map", "[", "string", "]", "*", "rootNode", ")", "\n", "r", ".", "HandleMethodNotAllowed", "=", "true", "\n", "return", "r", "\n", "}" ]
11,642
all-11643
[ "PutResourcePolicyRequest", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "PutResourcePolicyRequest", "(", "arg0", "*", "secretsmanager", ".", "PutResourcePolicyInput", ")", "(", "*", "request", ".", "Request", ",", "*", "secretsmanager", ".", "PutResourcePolicyOutput", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "<mask>", "[", "0", "]", ".", "(", "*", "request", ".", "Request", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "*", "secretsmanager", ".", "PutResourcePolicyOutput", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
11,643
all-11644
[ "GetCgroupRoot", "returns", "cgroup", "root", "of", "the", "resource" ]
[ "func", "(", "cgroup", "*", "CgroupResource", ")", "GetCgroupRoot", "(", ")", "string", "{", "cgroup", ".", "<mask>", ".", "RLock", "(", ")", "\n", "defer", "cgroup", ".", "lock", ".", "RUnlock", "(", ")", "\n", "return", "cgroup", ".", "cgroupRoot", "\n", "}" ]
11,644
all-11645
[ "SetRequest", "injects", "a", "request", "into", "the", "controller" ]
[ "func", "(", "c", "*", "Controller", ")", "SetRequest", "(", "req", "*", "http", ".", "Request", ")", "{", "c", ".", "Request", "=", "&", "Request", "{", "<mask>", ":", "req", "}", "\n", "}" ]
11,645
all-11646
[ "KnownCreated", "returns", "true", "if", "the", "secret", "s", "known", "status", "is", "CREATED" ]
[ "func", "(", "secret", "*", "ASMSecretResource", ")", "KnownCreated", "(", ")", "bool", "{", "secret", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "secret", ".", "<mask>", ".", "RUnlock", "(", ")", "\n\n", "return", "secret", ".", "knownStatusUnsafe", "==", "resourcestatus", ".", "ResourceStatus", "(", "ASMSecretCreated", ")", "\n", "}" ]
11,646
all-11647
[ "Do", "calls", "calculates", "deadline", "using", "LBClient", ".", "Timeout", "and", "calls", "DoDeadline", "on", "the", "least", "loaded", "client", "." ]
[ "func", "(", "cc", "*", "LBClient", ")", "Do", "(", "req", "*", "Request", ",", "resp", "*", "Response", ")", "error", "{", "timeout", ":=", "cc", ".", "Timeout", "\n", "if", "timeout", "<=", "0", "{", "timeout", "=", "DefaultLBClientTimeout", "\n", "}", "\n", "return", "<mask>", ".", "DoTimeout", "(", "req", ",", "resp", ",", "timeout", ")", "\n", "}" ]
11,647
all-11648
[ "seekTotal", "retrives", "the", "total", "of", "all", "accounts", "by", "seeking", "for", "each", "account", "key", "." ]
[ "func", "seekTotal", "(", "txn", "*", "badger", ".", "Txn", ")", "(", "[", "]", "account", ",", "error", ")", "{", "expected", ":=", "uint64", "(", "numAccounts", ")", "*", "uint64", "(", "initialBal", ")", "\n", "var", "accounts", "[", "]", "account", "\n\n", "var", "total", "uint64", "\n", "for", "i", ":=", "0", ";", "i", "<", "numAccounts", ";", "i", "++", "{", "item", ",", "err", ":=", "txn", ".", "Get", "(", "key", "(", "i", ")", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\\n", "\"", ",", "i", ",", "err", ",", "key", "(", "i", ")", ")", "\n", "return", "accounts", ",", "err", "\n", "}", "\n", "val", ",", "err", ":=", "item", ".", "ValueCopy", "(", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "accounts", ",", "err", "\n", "}", "\n", "<mask>", ":=", "account", "{", "Id", ":", "i", ",", "Bal", ":", "toUint64", "(", "val", ")", ",", "}", "\n", "accounts", "=", "append", "(", "accounts", ",", "acc", ")", "\n", "total", "+=", "acc", ".", "Bal", "\n", "}", "\n", "if", "total", "!=", "expected", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "expected", ",", "total", ")", "\n", "atomic", ".", "AddInt32", "(", "&", "stopAll", ",", "1", ")", "\n", "return", "accounts", ",", "errFailure", "\n", "}", "\n", "return", "accounts", ",", "nil", "\n", "}" ]
11,648
all-11649
[ "GetMessageOk", "returns", "a", "tuple", "with", "the", "Message", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "d", "*", "Downtime", ")", "GetMessageOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "d", "==", "nil", "||", "d", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "d", ".", "Message", ",", "true", "\n", "}" ]
11,649
all-11650
[ "readFunc", "parses", "a", "runtime", ".", "_func", "and", "returns", "a", "*", "Func", ".", "r", "must", "have", "type", "runtime", ".", "_func", ".", "pcln", "must", "have", "type", "[]", "byte", "and", "represent", "the", "module", "s", "pcln", "table", "region", "." ]
[ "func", "(", "m", "*", "module", ")", "readFunc", "(", "r", "region", ",", "pcln", "region", ")", "*", "Func", "{", "f", ":=", "&", "Func", "{", "module", ":", "m", ",", "r", ":", "r", "}", "\n", "f", ".", "entry", "=", "core", ".", "Address", "(", "r", ".", "Field", "(", "\"", "\"", ")", ".", "Uintptr", "(", ")", ")", "\n", "f", ".", "name", "=", "r", ".", "p", ".", "proc", ".", "ReadCString", "(", "pcln", ".", "SliceIndex", "(", "int64", "(", "r", ".", "Field", "(", "\"", "\"", ")", ".", "Int32", "(", ")", ")", ")", ".", "a", ")", "\n", "f", ".", "frameSize", ".", "read", "(", "r", ".", "p", ".", "proc", ",", "pcln", ".", "SliceIndex", "(", "int64", "(", "r", ".", "Field", "(", "\"", "\"", ")", ".", "Int32", "(", ")", ")", ")", ".", "a", ")", "\n\n", "// Parse pcdata and funcdata, which are laid out beyond the end of the _func.", "a", ":=", "r", ".", "a", ".", "Add", "(", "int64", "(", "r", ".", "p", ".", "findType", "(", "\"", "\"", ")", ".", "Size", ")", ")", "\n", "n", ":=", "r", ".", "Field", "(", "\"", "\"", ")", ".", "Int32", "(", ")", "\n", "for", "i", ":=", "int32", "(", "0", ")", ";", "i", "<", "n", ";", "i", "++", "{", "f", ".", "pcdata", "=", "append", "(", "f", ".", "pcdata", ",", "r", ".", "p", ".", "proc", ".", "ReadInt32", "(", "a", ")", ")", "\n", "a", "=", "a", ".", "Add", "(", "4", ")", "\n", "}", "\n", "a", "=", "a", ".", "Align", "(", "r", ".", "p", ".", "proc", ".", "PtrSize", "(", ")", ")", "\n", "n", "=", "r", ".", "<mask>", "(", "\"", "\"", ")", ".", "Int32", "(", ")", "\n", "for", "i", ":=", "int32", "(", "0", ")", ";", "i", "<", "n", ";", "i", "++", "{", "f", ".", "funcdata", "=", "append", "(", "f", ".", "funcdata", ",", "r", ".", "p", ".", "proc", ".", "ReadPtr", "(", "a", ")", ")", "\n", "a", "=", "a", ".", "Add", "(", "r", ".", "p", ".", "proc", ".", "PtrSize", "(", ")", ")", "\n", "}", "\n\n", "// Read pcln tables we need.", "if", "stackmap", ":=", "int", "(", "r", ".", "p", ".", "rtConstants", "[", "\"", "\"", "]", ")", ";", "stackmap", "<", "len", "(", "f", ".", "pcdata", ")", "{", "f", ".", "stackMap", ".", "read", "(", "r", ".", "p", ".", "proc", ",", "pcln", ".", "SliceIndex", "(", "int64", "(", "f", ".", "pcdata", "[", "stackmap", "]", ")", ")", ".", "a", ")", "\n", "}", "else", "{", "f", ".", "stackMap", ".", "setEmpty", "(", ")", "\n", "}", "\n\n", "return", "f", "\n", "}" ]
11,650
all-11651
[ "export", "FileSequence_Frame_Fill" ]
[ "func", "FileSequence_Frame_Fill", "(", "id", "FileSeqId", ",", "fill", "*", "C", ".", "char", ")", "*", "C", ".", "<mask>", "{", "fs", ",", "ok", ":=", "sFileSeqs", ".", "Get", "(", "id", ")", "\n", "// caller must free string", "if", "!", "ok", "{", "return", "C", ".", "CString", "(", "\"", "\"", ")", "\n", "}", "\n", "gofill", ":=", "C", ".", "GoString", "(", "fill", ")", "\n", "frameStr", ",", "_", ":=", "fs", ".", "Frame", "(", "gofill", ")", "\n", "return", "C", ".", "CString", "(", "frameStr", ")", "\n", "}" ]
11,651
all-11652
[ "New", "instantiates", "a", "new", "cmdflag", "with", "its", "name", "and", "description", ".", "It", "is", "safe", "to", "be", "called", "from", "multiple", "go", "routines", "(", "typically", "in", "init", "functions", ")", ".", "The", "cmdflag", "initializer", "is", "called", "only", "when", "the", "cmdflag", "is", "present", "on", "the", "command", "line", ".", "The", "handler", "is", "called", "with", "the", "remaining", "arguments", "once", "the", "cmdflag", "flags", "have", "been", "parsed", "successfully", ".", "It", "will", "panic", "if", "the", "cmdflag", "already", "exists", "." ]
[ "func", "New", "(", "name", ",", "argsdesc", ",", "desc", "string", ",", "errh", "flag", ".", "ErrorHandling", ",", "initializer", "func", "(", "*", "flag", ".", "FlagSet", ")", "<mask>", ")", "{", "sub", ":=", "&", "subcmd", "{", "errh", ":", "errh", ",", "name", ":", "name", ",", "argsdesc", ":", "argsdesc", ",", "desc", ":", "desc", ",", "ini", ":", "initializer", ",", "}", "\n\n", "mu", ".", "Lock", "(", ")", "\n", "defer", "mu", ".", "Unlock", "(", ")", "\n", "for", "_", ",", "sub", ":=", "range", "subs", "{", "if", "sub", ".", "name", "==", "name", "{", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ")", ")", "\n", "}", "\n", "}", "\n", "subs", "=", "append", "(", "subs", ",", "sub", ")", "\n", "}" ]
11,652
all-11653
[ "DeepCopy", "copies", "the", "receiver", "into", "a", "new", "URI", "." ]
[ "func", "(", "u", "*", "URI", ")", "DeepCopy", "(", ")", "*", "URI", "{", "if", "u", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "<mask>", ":=", "new", "(", "URI", ")", "\n", "u", ".", "DeepCopyInto", "(", "out", ")", "\n", "return", "out", "\n", "}" ]
11,653
all-11654
[ "EnableDebug", "turns", "on", "govmomi", "API", "operation", "logging", "if", "appropriate", "settings", "are", "set", "on", "the", "provider", "." ]
[ "func", "(", "c", "*", "Config", ")", "EnableDebug", "(", ")", "error", "{", "if", "!", "c", ".", "Debug", "{", "return", "nil", "\n", "}", "\n\n", "// Base path for storing debug logs.", "r", ":=", "c", ".", "DebugPath", "\n", "if", "r", "==", "\"", "\"", "{", "r", "=", "filepath", ".", "Join", "(", "os", ".", "Getenv", "(", "\"", "\"", ")", ",", "\"", "\"", ")", "\n", "}", "\n", "r", "=", "filepath", ".", "Join", "(", "r", ",", "\"", "\"", ")", "\n\n", "// Path for this particular run.", "run", ":=", "c", ".", "DebugPathRun", "\n", "if", "run", "==", "\"", "\"", "{", "now", ":=", "time", ".", "Now", "(", ")", ".", "Format", "(", "\"", "\"", ")", "\n", "r", "=", "filepath", ".", "Join", "(", "r", ",", "now", ")", "\n", "}", "else", "{", "// reuse the same path", "r", "=", "filepath", ".", "Join", "(", "r", ",", "run", ")", "\n", "_", "=", "os", ".", "RemoveAll", "(", "r", ")", "\n", "}", "\n\n", "err", ":=", "<mask>", ".", "MkdirAll", "(", "r", ",", "0700", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "err", "\n", "}", "\n\n", "p", ":=", "debug", ".", "FileProvider", "{", "Path", ":", "r", ",", "}", "\n\n", "debug", ".", "SetProvider", "(", "&", "p", ")", "\n", "return", "nil", "\n", "}" ]
11,654
all-11655
[ "NewImage", "creates", "an", "empty", "image", "with", "the", "given", "size", ".", "The", "returned", "image", "is", "cleared", ".", "Note", "that", "Dispose", "is", "not", "called", "automatically", "." ]
[ "func", "NewImage", "(", "width", ",", "height", "int", ")", "*", "Image", "{", "i", ":=", "&", "Image", "{", "image", ":", "graphicscommand", ".", "NewImage", "(", "<mask>", ",", "height", ")", ",", "}", "\n", "i", ".", "clear", "(", ")", "\n", "theImages", ".", "add", "(", "i", ")", "\n", "return", "i", "\n", "}" ]
11,655
all-11656
[ "Lock", "uses", "pidfiles", "to", "ensure", "that", "only", "one", "port", "forwarder", "is", "running", "across", "one", "or", "more", "pachctl", "instances" ]
[ "func", "(", "f", "*", "PortForwarder", ")", "Lock", "(", ")", "error", "{", "pidfile", ".", "SetPidfilePath", "(", "path", ".", "Join", "(", "<mask>", ".", "Getenv", "(", "\"", "\"", ")", ",", "\"", "\"", ")", ")", "\n", "return", "pidfile", ".", "Write", "(", ")", "\n", "}" ]
11,656
all-11657
[ "WithHTTPClient", "adds", "the", "HTTPClient", "to", "the", "delete", "apps", "app", "routes", "route", "params" ]
[ "func", "(", "o", "*", "DeleteAppsAppRoutesRouteParams", ")", "WithHTTPClient", "(", "client", "*", "<mask>", ".", "Client", ")", "*", "DeleteAppsAppRoutesRouteParams", "{", "o", ".", "SetHTTPClient", "(", "client", ")", "\n", "return", "o", "\n", "}" ]
11,657
all-11658
[ "must", "be", "called", "with", "a", "lock", "held", "on", "pool", ".", "mu" ]
[ "func", "(", "pool", "*", "ReaderPool", ")", "setSharedRates", "(", ")", "{", "if", "len", "(", "pool", ".", "givenOut", ")", "==", "0", "{", "return", "\n", "}", "\n", "perSecPerReader", ":=", "pool", ".", "maxRate", "/", "len", "(", "pool", ".", "givenOut", ")", "\n", "for", "reader", ":=", "range", "pool", ".", "givenOut", "{", "<mask>", ".", "SetRate", "(", "perSecPerReader", ")", "\n", "}", "\n", "}" ]
11,658
all-11659
[ "Close", "orphans", "the", "session", "and", "revokes", "the", "session", "lease", "." ]
[ "func", "(", "s", "*", "Session", ")", "Close", "(", ")", "error", "{", "s", ".", "Orphan", "(", ")", "\n", "// if revoke takes longer than the ttl, lease is expired anyway", "ctx", ",", "cancel", ":=", "<mask>", ".", "WithTimeout", "(", "s", ".", "opts", ".", "ctx", ",", "time", ".", "Duration", "(", "s", ".", "opts", ".", "ttl", ")", "*", "time", ".", "Second", ")", "\n", "_", ",", "err", ":=", "s", ".", "client", ".", "Revoke", "(", "ctx", ",", "s", ".", "id", ")", "\n", "cancel", "(", ")", "\n", "return", "err", "\n", "}" ]
11,659
all-11660
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "RequestChildNodesParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom14", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
11,660
all-11661
[ "GetVersion", "is", "a", "wrapper", "around", "gtk_about_dialog_get_version", "()", "." ]
[ "func", "(", "v", "*", "AboutDialog", ")", "GetVersion", "(", ")", "string", "{", "c", ":=", "C", ".", "gtk_about_dialog_get_version", "(", "v", ".", "native", "(", ")", ")", "\n", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "<mask>", ")", "(", "c", ")", ")", "\n", "}" ]
11,661
all-11662
[ "DeleteImage", "requests", "that", "LXD", "removes", "an", "image", "from", "the", "store" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "DeleteImage", "(", "fingerprint", "string", ")", "(", "Operation", ",", "error", ")", "{", "// Send the request", "op", ",", "_", ",", "err", ":=", "r", ".", "queryOperation", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ".", "QueryEscape", "(", "fingerprint", ")", ")", ",", "nil", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "op", ",", "nil", "\n", "}" ]
11,662
all-11663
[ "StackSwitcherNew", "is", "a", "wrapper", "around", "gtk_stack_switcher_new", "()", "." ]
[ "func", "StackSwitcherNew", "(", ")", "(", "*", "StackSwitcher", ",", "<mask>", ")", "{", "c", ":=", "C", ".", "gtk_stack_switcher_new", "(", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "return", "wrapStackSwitcher", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", ",", "nil", "\n", "}" ]
11,663
all-11664
[ "Clone", "function", "clone", "the", "node", "recursively", "and", "return", "the", "new", "node", ".", "If", "the", "node", "is", "a", "directory", "it", "will", "clone", "all", "the", "content", "under", "this", "directory", ".", "If", "the", "node", "is", "a", "key", "-", "value", "pair", "it", "will", "clone", "the", "pair", "." ]
[ "func", "(", "n", "*", "node", ")", "Clone", "(", ")", "*", "node", "{", "if", "!", "n", ".", "IsDir", "(", ")", "{", "newkv", ":=", "newKV", "(", "n", ".", "store", ",", "n", ".", "Path", ",", "n", ".", "Value", ",", "n", ".", "CreatedIndex", ",", "n", ".", "Parent", ",", "n", ".", "ExpireTime", ")", "\n", "newkv", ".", "ModifiedIndex", "=", "n", ".", "ModifiedIndex", "\n", "return", "newkv", "\n", "}", "\n\n", "clone", ":=", "newDir", "(", "n", ".", "store", ",", "n", ".", "Path", ",", "n", ".", "CreatedIndex", ",", "n", ".", "Parent", ",", "n", ".", "ExpireTime", ")", "\n", "clone", ".", "ModifiedIndex", "=", "n", ".", "ModifiedIndex", "\n\n", "for", "key", ",", "child", ":=", "<mask>", "n", ".", "Children", "{", "clone", ".", "Children", "[", "key", "]", "=", "child", ".", "Clone", "(", ")", "\n", "}", "\n\n", "return", "clone", "\n", "}" ]
11,664
all-11665
[ "Special", "case", "migrating", "a", "container", "backed", "by", "ceph", "across", "two", "cluster", "nodes", "." ]
[ "func", "containerPostClusteringMigrateWithCeph", "(", "d", "*", "Daemon", ",", "c", "container", ",", "project", ",", "oldName", ",", "newName", ",", "newNode", "string", ")", "Response", "{", "run", ":=", "func", "(", "*", "operation", ")", "error", "{", "// If source node is online (i.e. we're serving the request on", "// it, and c != nil), let's unmap the RBD volume locally", "if", "c", "!=", "nil", "{", "logger", ".", "Debugf", "(", "`Renaming RBD storage volume for source container \"%s\" from \"%s\" to \"%s\"`", ",", "c", ".", "Name", "(", ")", ",", "c", ".", "Name", "(", ")", ",", "newName", ")", "\n", "poolName", ",", "err", ":=", "c", ".", "StoragePool", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "_", ",", "pool", ",", "err", ":=", "d", ".", "cluster", ".", "StoragePoolGet", "(", "poolName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "pool", ".", "Driver", "!=", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "si", ",", "err", ":=", "storagePoolVolumeContainerLoadInit", "(", "d", ".", "State", "(", ")", ",", "c", ".", "Project", "(", ")", ",", "c", ".", "<mask>", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "s", ",", "ok", ":=", "si", ".", "(", "*", "storageCeph", ")", "\n", "if", "!", "ok", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "err", "=", "cephRBDVolumeUnmap", "(", "s", ".", "ClusterName", ",", "s", ".", "OSDPoolName", ",", "c", ".", "Name", "(", ")", ",", "storagePoolVolumeTypeNameContainer", ",", "s", ".", "UserName", ",", "true", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "}", "\n\n", "// Re-link the database entries against the new node name.", "var", "poolName", "string", "\n", "err", ":=", "d", ".", "cluster", ".", "Transaction", "(", "func", "(", "tx", "*", "db", ".", "ClusterTx", ")", "error", "{", "err", ":=", "tx", ".", "ContainerNodeMove", "(", "oldName", ",", "newName", ",", "newNode", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "poolName", ",", "err", "=", "tx", ".", "ContainerPool", "(", "project", ",", "newName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// Rename the RBD volume if necessary.", "if", "newName", "!=", "oldName", "{", "s", ":=", "storageCeph", "{", "}", "\n", "_", ",", "s", ".", "pool", ",", "err", "=", "d", ".", "cluster", ".", "StoragePoolGet", "(", "poolName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "err", "=", "s", ".", "StoragePoolInit", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "err", "=", "cephRBDVolumeRename", "(", "s", ".", "ClusterName", ",", "s", ".", "OSDPoolName", ",", "storagePoolVolumeTypeNameContainer", ",", "oldName", ",", "newName", ",", "s", ".", "UserName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "// Create the container mount point on the target node", "cert", ":=", "d", ".", "endpoints", ".", "NetworkCert", "(", ")", "\n", "client", ",", "err", ":=", "cluster", ".", "ConnectIfContainerIsRemote", "(", "d", ".", "cluster", ",", "project", ",", "newName", ",", "cert", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "client", "==", "nil", "{", "err", ":=", "containerPostCreateContainerMountPoint", "(", "d", ",", "project", ",", "newName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "}", "else", "{", "path", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "newName", ")", "\n", "resp", ",", "_", ",", "err", ":=", "client", ".", "RawQuery", "(", "\"", "\"", ",", "path", ",", "nil", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "resp", ".", "StatusCode", "!=", "200", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "resp", ".", "Error", ")", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}", "\n\n", "resources", ":=", "map", "[", "string", "]", "[", "]", "string", "{", "}", "\n", "resources", "[", "\"", "\"", "]", "=", "[", "]", "string", "{", "oldName", "}", "\n", "op", ",", "err", ":=", "operationCreate", "(", "d", ".", "cluster", ",", "project", ",", "operationClassTask", ",", "db", ".", "OperationContainerMigrate", ",", "resources", ",", "nil", ",", "run", ",", "nil", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "InternalError", "(", "err", ")", "\n", "}", "\n\n", "return", "OperationResponse", "(", "op", ")", "\n", "}" ]
11,665
all-11666
[ "Append", "to", "an", "option", "with", "given", "prefix" ]
[ "func", "AppendOptionWithPrefix", "(", "options", "[", "]", "string", ",", "prefix", "string", ",", "v", "string", ")", "[", "]", "string", "{", "for", "i", ",", "opt", ":=", "range", "options", "{", "if", "strings", ".", "HasPrefix", "(", "opt", ",", "prefix", ")", "==", "true", "{", "new_opt", ":=", "opt", "+", "\"", "\"", "+", "v", "\n", "options", "[", "i", "]", "=", "new_opt", "\n", "return", "options", "\n", "}", "\n", "}", "\n", "return", "<mask>", "(", "options", ",", "prefix", "+", "v", ")", "\n", "}" ]
11,666
all-11667
[ "String", "returns", "the", "name", "of", "e" ]
[ "func", "(", "e", "OfferEntryFlags", ")", "<mask>", "(", ")", "string", "{", "name", ",", "_", ":=", "offerEntryFlagsMap", "[", "int32", "(", "e", ")", "]", "\n", "return", "name", "\n", "}" ]
11,667
all-11668
[ "MarshalJSON", "overrides", "the", "logic", "for", "JSON", "-", "encoding", "the", "ResourceStatus", "type" ]
[ "func", "(", "as", "*", "SSMSecretStatus", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "if", "as", "==", "nil", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "[", "]", "byte", "(", "`\"`", "+", "as", ".", "String", "(", ")", "+", "`\"`", ")", ",", "nil", "\n", "}" ]
11,668
all-11669
[ "L", "is", "a", "short", "-", "hand", "function", "to", "lookup", "a", "flagged", "field", "of", "a", "model", ".", "Note", ":", "L", "will", "panic", "if", "multiple", "flagged", "fields", "have", "been", "found", "or", "force", "is", "requested", "and", "no", "flagged", "field", "has", "been", "found", "." ]
[ "func", "L", "(", "m", "Model", ",", "flag", "string", ",", "force", "bool", ")", "string", "{", "// lookup fields", "fields", ",", "_", ":=", "Init", "(", "m", ")", ".", "Meta", "(", ")", ".", "FlaggedFields", "[", "flag", "]", "\n", "if", "len", "(", "fields", ")", ">", "1", "||", "(", "force", "&&", "len", "(", "fields", ")", "==", "0", ")", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "`coal: no or multiple fields flagged as \"%s\" found on \"%s\"`", ",", "flag", ",", "m", ".", "Meta", "(", ")", ".", "Name", ")", ")", "\n", "}", "\n\n", "// return name if found", "if", "len", "(", "<mask>", ")", ">", "0", "{", "return", "fields", "[", "0", "]", ".", "Name", "\n", "}", "\n\n", "return", "\"", "\"", "\n", "}" ]
11,669
all-11670
[ "CreateContainer", "defines", "a", "new", "MAAS", "device", "for", "the", "controller" ]
[ "func", "(", "c", "*", "Controller", ")", "CreateContainer", "(", "name", "string", ",", "interfaces", "[", "]", "ContainerInterface", ")", "error", "{", "// Parse the provided interfaces", "macInterfaces", ",", "err", ":=", "parseInterfaces", "(", "interfaces", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Get all the subnets", "subnets", ",", "err", ":=", "c", ".", "getSubnets", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Create the device and first interface", "<mask>", ",", "err", ":=", "c", ".", "machine", ".", "CreateDevice", "(", "gomaasapi", ".", "CreateMachineDeviceArgs", "{", "Hostname", ":", "name", ",", "InterfaceName", ":", "interfaces", "[", "0", "]", ".", "Name", ",", "MACAddress", ":", "interfaces", "[", "0", "]", ".", "MACAddress", ",", "VLAN", ":", "subnets", "[", "interfaces", "[", "0", "]", ".", "Subnets", "[", "0", "]", ".", "Name", "]", ".", "VLAN", "(", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Wipe the container entry if anything fails", "success", ":=", "false", "\n", "defer", "func", "(", ")", "{", "if", "success", "==", "true", "{", "return", "\n", "}", "\n\n", "c", ".", "DeleteContainer", "(", "name", ")", "\n", "}", "(", ")", "\n\n", "// Create the rest of the interfaces", "for", "_", ",", "iface", ":=", "range", "interfaces", "[", "1", ":", "]", "{", "_", ",", "err", ":=", "device", ".", "CreateInterface", "(", "gomaasapi", ".", "CreateInterfaceArgs", "{", "Name", ":", "iface", ".", "Name", ",", "MACAddress", ":", "iface", ".", "MACAddress", ",", "VLAN", ":", "subnets", "[", "iface", ".", "Subnets", "[", "0", "]", ".", "Name", "]", ".", "VLAN", "(", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "// Get a fresh copy of the device", "device", ",", "err", "=", "c", ".", "getDevice", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Setup the interfaces", "for", "_", ",", "entry", ":=", "range", "device", ".", "InterfaceSet", "(", ")", "{", "// Get our record", "iface", ",", "ok", ":=", "macInterfaces", "[", "entry", ".", "MACAddress", "(", ")", "]", "\n", "if", "!", "ok", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "entry", ".", "MACAddress", "(", ")", ")", "\n", "}", "\n\n", "// Add the subnets", "for", "_", ",", "subnet", ":=", "range", "iface", ".", "Subnets", "{", "err", ":=", "entry", ".", "LinkSubnet", "(", "gomaasapi", ".", "LinkSubnetArgs", "{", "Mode", ":", "gomaasapi", ".", "LinkModeStatic", ",", "Subnet", ":", "subnets", "[", "subnet", ".", "Name", "]", ",", "IPAddress", ":", "subnet", ".", "Address", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "}", "\n\n", "success", "=", "true", "\n", "return", "nil", "\n", "}" ]
11,670
all-11671
[ "ListSecretVersionIdsPages", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "ListSecretVersionIdsPages", "(", "arg0", "*", "secretsmanager", ".", "ListSecretVersionIdsInput", ",", "arg1", "func", "(", "*", "secretsmanager", ".", "ListSecretVersionIdsOutput", ",", "bool", ")", "bool", ")", "error", "{", "<mask>", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ",", "arg1", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "error", ")", "\n", "return", "ret0", "\n", "}" ]
11,671
all-11672
[ "Neighbors", "returns", "a", "slice", "of", "geohash", "strings", "that", "correspond", "to", "the", "provided", "geohash", "s", "neighbors", "." ]
[ "func", "Neighbors", "(", "hash", "string", ")", "[", "]", "string", "{", "box", ":=", "BoundingBox", "(", "hash", ")", "\n", "lat", ",", "lng", ":=", "box", ".", "Center", "(", ")", "\n", "latDelta", ":=", "<mask>", ".", "MaxLat", "-", "box", ".", "MinLat", "\n", "lngDelta", ":=", "box", ".", "MaxLng", "-", "box", ".", "MinLng", "\n", "precision", ":=", "uint", "(", "len", "(", "hash", ")", ")", "\n", "return", "[", "]", "string", "{", "// N", "EncodeWithPrecision", "(", "lat", "+", "latDelta", ",", "lng", ",", "precision", ")", ",", "// NE,", "EncodeWithPrecision", "(", "lat", "+", "latDelta", ",", "lng", "+", "lngDelta", ",", "precision", ")", ",", "// E,", "EncodeWithPrecision", "(", "lat", ",", "lng", "+", "lngDelta", ",", "precision", ")", ",", "// SE,", "EncodeWithPrecision", "(", "lat", "-", "latDelta", ",", "lng", "+", "lngDelta", ",", "precision", ")", ",", "// S,", "EncodeWithPrecision", "(", "lat", "-", "latDelta", ",", "lng", ",", "precision", ")", ",", "// SW,", "EncodeWithPrecision", "(", "lat", "-", "latDelta", ",", "lng", "-", "lngDelta", ",", "precision", ")", ",", "// W,", "EncodeWithPrecision", "(", "lat", ",", "lng", "-", "lngDelta", ",", "precision", ")", ",", "// NW", "EncodeWithPrecision", "(", "lat", "+", "latDelta", ",", "lng", "-", "lngDelta", ",", "precision", ")", ",", "}", "\n", "}" ]
11,672
all-11673
[ "serve", "runs", "the", "listener", "to", "accept", "and", "manage", "new", "incoming", "connections", "blocking", "until", "the", "channel", "is", "closed", "." ]
[ "func", "(", "ch", "*", "Channel", ")", "serve", "(", ")", "{", "acceptBackoff", ":=", "0", "*", "time", ".", "Millisecond", "\n\n", "for", "{", "netConn", ",", "err", ":=", "ch", ".", "mutable", ".", "l", ".", "Accept", "(", ")", "\n", "if", "err", "!=", "nil", "{", "// Backoff from new accepts if this is a temporary error", "if", "ne", ",", "ok", ":=", "err", ".", "(", "net", ".", "Error", ")", ";", "ok", "&&", "ne", ".", "Temporary", "(", ")", "{", "if", "acceptBackoff", "==", "0", "{", "acceptBackoff", "=", "5", "*", "time", ".", "Millisecond", "\n", "}", "else", "{", "acceptBackoff", "*=", "2", "\n", "}", "\n", "if", "max", ":=", "1", "*", "time", ".", "Second", ";", "acceptBackoff", ">", "max", "{", "acceptBackoff", "=", "max", "\n", "}", "\n", "ch", ".", "log", ".", "WithFields", "(", "ErrField", "(", "err", ")", ",", "LogField", "{", "\"", "\"", ",", "acceptBackoff", "}", ",", ")", ".", "Warn", "(", "\"", "\"", ")", "\n", "time", ".", "Sleep", "(", "acceptBackoff", ")", "\n", "continue", "\n", "}", "else", "{", "// Only log an error if this didn't happen due to a Close.", "if", "ch", ".", "State", "(", ")", ">=", "ChannelStartClose", "{", "return", "\n", "}", "\n", "ch", ".", "log", ".", "WithFields", "(", "ErrField", "(", "err", ")", ")", ".", "Fatal", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "}", "\n\n", "acceptBackoff", "=", "0", "\n\n", "// Perform the connection handshake in a background goroutine.", "go", "func", "(", ")", "{", "// Register the connection in the peer once the channel is set up.", "<mask>", ":=", "connectionEvents", "{", "OnActive", ":", "ch", ".", "inboundConnectionActive", ",", "OnCloseStateChange", ":", "ch", ".", "connectionCloseStateChange", ",", "OnExchangeUpdated", ":", "ch", ".", "exchangeUpdated", ",", "}", "\n", "if", "_", ",", "err", ":=", "ch", ".", "inboundHandshake", "(", "context", ".", "Background", "(", ")", ",", "netConn", ",", "events", ")", ";", "err", "!=", "nil", "{", "netConn", ".", "Close", "(", ")", "\n", "}", "\n", "}", "(", ")", "\n", "}", "\n", "}" ]
11,673
all-11674
[ "ListOrgs", ":", "Returns", "all", "orgs", "in", "the", "given", "foundation" ]
[ "func", "(", "m", "*", "DefaultManager", ")", "ListOrgs", "(", ")", "(", "[", "]", "cfclient", ".", "Org", ",", "error", ")", "{", "err", ":=", "m", ".", "init", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "<mask>", "\n", "}", "\n", "lo", ".", "G", ".", "Debug", "(", "\"", "\"", ",", "len", "(", "m", ".", "orgs", ")", ")", "\n", "return", "m", ".", "orgs", ",", "nil", "\n", "}" ]
11,674
all-11675
[ "DeleteEntry", "deletes", "a", "cache", "entry", ".", "See", ":", "https", ":", "//", "chromedevtools", ".", "github", ".", "io", "/", "devtools", "-", "protocol", "/", "tot", "/", "CacheStorage#method", "-", "deleteEntry", "parameters", ":", "cacheID", "-", "Id", "of", "cache", "where", "the", "entry", "will", "be", "deleted", ".", "request", "-", "URL", "spec", "of", "the", "request", "." ]
[ "func", "DeleteEntry", "(", "cacheID", "CacheID", ",", "request", "string", ")", "*", "DeleteEntryParams", "{", "return", "&", "DeleteEntryParams", "{", "CacheID", ":", "cacheID", ",", "<mask>", ":", "request", ",", "}", "\n", "}" ]
11,675
all-11676
[ "LastLogs", "returns", "a", "list", "of", "the", "last", "lines", "log", "of", "the", "app", "matching", "the", "fields", "in", "the", "log", "instance", "received", "as", "an", "example", "." ]
[ "func", "(", "app", "*", "App", ")", "LastLogs", "(", "lines", "int", ",", "filterLog", "Applog", ")", "(", "[", "]", "Applog", ",", "error", ")", "{", "return", "app", ".", "lastLogs", "(", "<mask>", ",", "filterLog", ",", "false", ")", "\n", "}" ]
11,676
all-11677
[ "Retrieve", "a", "list", "of", "all", "Azure", "accounts", "managed", "by", "Taskcluster", "Auth", ".", "Required", "scopes", ":", "auth", ":", "azure", "-", "table", ":", "list", "-", "accounts", "See", "#azureAccounts" ]
[ "func", "(", "auth", "*", "Auth", ")", "AzureAccounts", "(", ")", "(", "*", "AzureListAccountResponse", ",", "error", ")", "{", "cd", ":=", "tcclient", ".", "Client", "(", "*", "auth", ")", "\n", "responseObject", ",", "_", ",", "err", ":=", "(", "&", "cd", ")", ".", "APICall", "(", "nil", ",", "\"", "\"", ",", "\"", "\"", ",", "<mask>", "(", "AzureListAccountResponse", ")", ",", "nil", ")", "\n", "return", "responseObject", ".", "(", "*", "AzureListAccountResponse", ")", ",", "err", "\n", "}" ]
11,677
all-11678
[ "WithHTTPClient", "adds", "the", "HTTPClient", "to", "the", "post", "apps", "params" ]
[ "func", "(", "o", "*", "PostAppsParams", ")", "WithHTTPClient", "(", "client", "*", "http", ".", "Client", ")", "*", "PostAppsParams", "{", "o", ".", "SetHTTPClient", "(", "<mask>", ")", "\n", "return", "o", "\n", "}" ]
11,678
all-11679
[ "UnmarshalJSON", "satisfies", "json", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "ScopeType", ")", "UnmarshalJSON", "(", "buf", "[", "]", "<mask>", ")", "error", "{", "return", "easyjson", ".", "Unmarshal", "(", "buf", ",", "t", ")", "\n", "}" ]
11,679
all-11680
[ "CreateIssueReaction", "adds", "an", "emoji", "to", "an", "issue", "." ]
[ "func", "(", "f", "*", "FakeClient", ")", "CreateIssueReaction", "(", "org", ",", "repo", "string", ",", "ID", "int", ",", "reaction", "string", ")", "error", "{", "f", ".", "IssueReactionsAdded", "=", "append", "(", "f", ".", "IssueReactionsAdded", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "repo", ",", "<mask>", ",", "reaction", ")", ")", "\n", "return", "nil", "\n", "}" ]
11,680
all-11681
[ "DeviceNames", "returns", "the", "name", "of", "all", "devices", "in", "the", "set", "sorted", "properly" ]
[ "func", "(", "list", "Devices", ")", "DeviceNames", "(", ")", "[", "]", "string", "{", "sortable", ":=", "sortableDevices", "{", "}", "\n", "for", "k", ",", "d", ":=", "range", "<mask>", "{", "sortable", "=", "append", "(", "sortable", ",", "namedDevice", "{", "k", ",", "d", "}", ")", "\n", "}", "\n\n", "sort", ".", "Sort", "(", "sortable", ")", "\n", "return", "sortable", ".", "Names", "(", ")", "\n", "}" ]
11,681
all-11682
[ "Contains", "determines", "whether", "a", "space", "is", "present", "in", "a", "list", "of", "spaces", "." ]
[ "func", "(", "s", "*", "Spaces", ")", "Contains", "(", "spaceName", "string", ")", "bool", "{", "spaceNameToUpper", ":=", "strings", ".", "ToUpper", "(", "spaceName", ")", "\n", "for", "_", ",", "v", ":=", "range", "s", ".", "Spaces", "{", "if", "strings", ".", "ToUpper", "(", "v", ")", "==", "spaceNameToUpper", "{", "return", "<mask>", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
11,682
all-11683
[ "ForEachActiveAlert", "runs", "the", "given", "function", "on", "each", "alert", ".", "This", "should", "be", "used", "when", "you", "want", "to", "use", "the", "actual", "alerts", "from", "the", "AlertingRule", "and", "not", "on", "its", "copy", ".", "If", "you", "want", "to", "run", "on", "a", "copy", "of", "alerts", "then", "don", "t", "use", "this", "get", "the", "alerts", "from", "ActiveAlerts", "()", "." ]
[ "func", "(", "r", "*", "AlertingRule", ")", "ForEachActiveAlert", "(", "f", "func", "(", "*", "Alert", ")", ")", "{", "r", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "r", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "for", "_", ",", "a", ":=", "range", "r", ".", "<mask>", "{", "f", "(", "a", ")", "\n", "}", "\n", "}" ]
11,683
all-11684
[ "<call", "-", "offset", ">", "::", "=", "h", "<nv", "-", "offset", ">", "_", "::", "=", "v", "<v", "-", "offset", ">", "_", "<nv", "-", "offset", ">", "::", "=", "<", "(", "offset", ")", "number", ">", "<v", "-", "offset", ">", "::", "=", "<", "(", "offset", ")", "number", ">", "_", "<", "(", "virtual", "offset", ")", "number", ">", "The", "c", "parameter", "if", "not", "0", "is", "a", "character", "we", "just", "read", "which", "is", "the", "start", "of", "the", "<call", "-", "offset", ">", ".", "We", "don", "t", "display", "the", "offset", "information", "anywhere", "." ]
[ "func", "(", "st", "*", "state", ")", "callOffset", "(", "c", "byte", ")", "{", "if", "c", "==", "0", "{", "if", "len", "(", "st", ".", "str", ")", "==", "0", "{", "st", ".", "fail", "(", "\"", "\"", ")", "\n", "}", "\n", "c", "=", "st", ".", "str", "[", "0", "]", "\n", "st", ".", "advance", "(", "1", ")", "\n", "}", "\n", "switch", "c", "{", "case", "'h'", ":", "st", ".", "number", "(", ")", "\n", "case", "'v'", ":", "st", ".", "number", "(", ")", "\n", "if", "len", "(", "st", ".", "str", ")", "==", "0", "||", "st", ".", "str", "[", "0", "]", "!=", "'_'", "{", "st", ".", "fail", "(", "\"", "\"", ")", "\n", "}", "\n", "st", ".", "advance", "(", "1", ")", "\n", "st", ".", "number", "(", ")", "\n", "default", ":", "st", ".", "failEarlier", "(", "\"", "\"", ",", "1", ")", "\n", "}", "\n", "if", "len", "(", "st", ".", "str", ")", "==", "0", "||", "st", ".", "str", "[", "0", "]", "!=", "'_'", "{", "st", ".", "<mask>", "(", "\"", "\"", ")", "\n", "}", "\n", "st", ".", "advance", "(", "1", ")", "\n", "}" ]
11,684
all-11685
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventSinksUpdated", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast3", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
11,685
all-11686
[ "Check", "if", "a", "project", "is", "empty", "." ]
[ "func", "projectIsEmpty", "(", "<mask>", "*", "api", ".", "Project", ")", "bool", "{", "if", "len", "(", "project", ".", "UsedBy", ")", ">", "0", "{", "// Check if the only entity is the default profile.", "if", "len", "(", "project", ".", "UsedBy", ")", "==", "1", "&&", "strings", ".", "Contains", "(", "project", ".", "UsedBy", "[", "0", "]", ",", "\"", "\"", ")", "{", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}", "\n", "return", "true", "\n", "}" ]
11,686
all-11687
[ "UnmarshalJSON", "implements", "the", "json", ".", "Unmarshaler", "interface", "." ]
[ "func", "(", "m", "*", "PolicyRequirements", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "reqJSONs", ":=", "[", "]", "json", ".", "RawMessage", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "&", "reqJSONs", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "len", "(", "reqJSONs", ")", "==", "0", "{", "return", "InvalidPolicyFormatError", "(", "\"", "\"", ")", "\n", "}", "\n", "res", ":=", "make", "(", "[", "]", "PolicyRequirement", ",", "len", "(", "reqJSONs", ")", ")", "\n", "for", "i", ",", "reqJSON", ":=", "<mask>", "reqJSONs", "{", "req", ",", "err", ":=", "newPolicyRequirementFromJSON", "(", "reqJSON", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "res", "[", "i", "]", "=", "req", "\n", "}", "\n", "*", "m", "=", "res", "\n", "return", "nil", "\n", "}" ]
11,687
all-11688
[ "NewImage", "returns", "a", "types", ".", "ImageCloser", "for", "this", "reference", "possibly", "specialized", "for", "this", "ImageTransport", ".", "The", "caller", "must", "call", ".", "Close", "()", "on", "the", "returned", "ImageCloser", ".", "NOTE", ":", "If", "any", "kind", "of", "signature", "verification", "should", "happen", "build", "an", "UnparsedImage", "from", "the", "value", "returned", "by", "NewImageSource", "verify", "that", "UnparsedImage", "and", "convert", "it", "into", "a", "real", "Image", "via", "image", ".", "FromUnparsedImage", ".", "WARNING", ":", "This", "may", "not", "do", "the", "right", "thing", "for", "a", "manifest", "list", "see", "image", ".", "FromSource", "for", "details", "." ]
[ "func", "(", "ref", "ociReference", ")", "NewImage", "(", "ctx", "context", ".", "Context", ",", "sys", "*", "types", ".", "SystemContext", ")", "(", "types", ".", "ImageCloser", ",", "error", ")", "{", "src", ",", "err", ":=", "newImageSource", "(", "sys", ",", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "image", ".", "FromSource", "(", "ctx", ",", "sys", ",", "src", ")", "\n", "}" ]
11,688
all-11689
[ "olderVersion", "checks", "the", "major", "/", "minor", "/", "patch", "part", "of", "the", "version", "to", "see", "it", "s", "older", "than", "the", "version", "supplied", "in", "other", ".", "This", "is", "broken", "off", "from", "the", "main", "test", "so", "that", "it", "can", "be", "checked", "in", "Newer", "before", "the", "build", "number", "is", "compared", "." ]
[ "func", "(", "v", "VSphereVersion", ")", "olderVersion", "(", "other", "VSphereVersion", ")", "bool", "{", "// Assuming here that VMware is a loooong way away from having a", "// major/minor/patch that's bigger than 254.", "vc", ":=", "v", ".", "Major", "<<", "16", "+", "v", ".", "Minor", "<<", "8", "+", "v", ".", "Patch", "\n", "vo", ":=", "other", ".", "Major", "<<", "16", "+", "other", ".", "Minor", "<<", "8", "+", "<mask>", ".", "Patch", "\n", "return", "vc", "<", "vo", "\n", "}" ]
11,689
all-11690
[ "AddUser", "creates", "or", "updates", "the", "authentication", "credentials", "of", "user", "within", "the", "db", "database", ".", "WARNING", ":", "This", "method", "is", "obsolete", "and", "should", "only", "be", "used", "with", "MongoDB", "2", ".", "2", "or", "earlier", ".", "For", "MongoDB", "2", ".", "4", "and", "on", "use", "UpsertUser", "instead", "." ]
[ "func", "(", "db", "*", "Database", ")", "AddUser", "(", "username", ",", "password", "string", ",", "readOnly", "bool", ")", "error", "{", "// Try to emulate the old behavior on 2.6+", "user", ":=", "&", "User", "{", "Username", ":", "username", ",", "Password", ":", "password", "}", "\n", "if", "db", ".", "Name", "==", "\"", "\"", "{", "if", "readOnly", "{", "user", ".", "Roles", "=", "[", "]", "Role", "{", "RoleReadAny", "}", "\n", "}", "else", "{", "user", ".", "Roles", "=", "[", "]", "Role", "{", "RoleReadWriteAny", "}", "\n", "}", "\n", "}", "else", "{", "if", "readOnly", "{", "user", ".", "Roles", "=", "[", "]", "Role", "{", "RoleRead", "}", "\n", "}", "else", "{", "user", ".", "Roles", "=", "[", "]", "<mask>", "{", "RoleReadWrite", "}", "\n", "}", "\n", "}", "\n", "err", ":=", "db", ".", "runUserCmd", "(", "\"", "\"", ",", "user", ")", "\n", "if", "isNotFound", "(", "err", ")", "{", "return", "db", ".", "runUserCmd", "(", "\"", "\"", ",", "user", ")", "\n", "}", "\n", "if", "!", "isNoCmd", "(", "err", ")", "{", "return", "err", "\n", "}", "\n\n", "// Command doesn't exist. Fallback to pre-2.6 behavior.", "psum", ":=", "md5", ".", "New", "(", ")", "\n", "psum", ".", "Write", "(", "[", "]", "byte", "(", "username", "+", "\"", "\"", "+", "password", ")", ")", "\n", "digest", ":=", "hex", ".", "EncodeToString", "(", "psum", ".", "Sum", "(", "nil", ")", ")", "\n", "c", ":=", "db", ".", "C", "(", "\"", "\"", ")", "\n", "_", ",", "err", "=", "c", ".", "Upsert", "(", "bson", ".", "M", "{", "\"", "\"", ":", "username", "}", ",", "bson", ".", "M", "{", "\"", "\"", ":", "bson", ".", "M", "{", "\"", "\"", ":", "username", ",", "\"", "\"", ":", "digest", ",", "\"", "\"", ":", "readOnly", "}", "}", ")", "\n", "return", "err", "\n", "}" ]
11,690
all-11691
[ "newAggregate", "is", "a", "modified", "copy", "of", "k8s", ".", "io", "/", "apimachinery", "/", "pkg", "/", "util", "/", "errors", ".", "NewAggregate", ".", "NewAggregate", "converts", "a", "slice", "of", "errors", "into", "an", "Aggregate", "interface", "which", "is", "itself", "an", "implementation", "of", "the", "error", "interface", ".", "If", "the", "slice", "is", "empty", "this", "returns", "nil", ".", "It", "will", "check", "if", "any", "of", "the", "element", "of", "input", "error", "list", "is", "nil", "to", "avoid", "nil", "pointer", "panic", "when", "call", "Error", "()", "." ]
[ "func", "newAggregate", "(", "errlist", "[", "]", "error", ")", "error", "{", "if", "len", "(", "errlist", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "// In case of input error list contains nil", "var", "errs", "[", "]", "error", "\n", "for", "_", ",", "e", ":=", "range", "errlist", "{", "if", "e", "!=", "nil", "{", "errs", "=", "<mask>", "(", "errs", ",", "e", ")", "\n", "}", "\n", "}", "\n", "if", "len", "(", "errs", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "return", "aggregateErr", "(", "errs", ")", "\n", "}" ]
11,691
all-11692
[ "Lists", "the", "GCS", "directory", "paths", "immediately", "under", "prefix", "." ]
[ "func", "(", "bucket", "gcsBucket", ")", "listSubDirs", "(", "prefix", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "if", "!", "strings", ".", "HasSuffix", "(", "<mask>", ",", "\"", "\"", ")", "{", "prefix", "+=", "\"", "\"", "\n", "}", "\n", "dirs", ":=", "[", "]", "string", "{", "}", "\n", "it", ":=", "bucket", ".", "Objects", "(", "context", ".", "Background", "(", ")", ",", "&", "storage", ".", "Query", "{", "Prefix", ":", "prefix", ",", "Delimiter", ":", "\"", "\"", ",", "}", ")", "\n", "for", "{", "attrs", ",", "err", ":=", "it", ".", "Next", "(", ")", "\n", "if", "err", "==", "iterator", ".", "Done", "{", "break", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "dirs", ",", "err", "\n", "}", "\n", "if", "attrs", ".", "Prefix", "!=", "\"", "\"", "{", "dirs", "=", "append", "(", "dirs", ",", "attrs", ".", "Prefix", ")", "\n", "}", "\n", "}", "\n", "return", "dirs", ",", "nil", "\n", "}" ]
11,692
all-11693
[ "GetRequesterAddress", "does", "a", "best", "effort", "lookup", "for", "the", "real", "IP", "address", "of", "the", "requester", ".", "Many", "load", "balancers", "(", "such", "as", "AWS", "s", "ELB", ")", "set", "a", "X", "-", "Forwarded", "-", "For", "header", "which", "can", "be", "used", "to", "determine", "the", "IP", "address", "of", "the", "client", "when", "the", "server", "is", "behind", "a", "load", "balancer", ".", "It", "is", "possible", "however", "for", "the", "client", "to", "spoof", "this", "header", "if", "the", "load", "balancer", "is", "not", "configured", "to", "remove", "it", "from", "the", "request", "or", "if", "the", "server", "is", "accessed", "directly", ".", "For", "uses", "such", "as", "rate", "limitting", "only", "use", "this", "function", "if", "you", "can", "trust", "that", "the", "load", "balancer", "will", "strip", "the", "header", "from", "the", "client", "and", "that", "the", "server", "will", "not", "be", "directly", "accessible", "by", "the", "public", "(", "only", "though", "the", "load", "balancer", ")", "." ]
[ "func", "GetRequesterAddress", "(", "r", "*", "http", ".", "<mask>", ")", "string", "{", "if", "xff", ":=", "r", ".", "Header", ".", "Get", "(", "\"", "\"", ")", ";", "xff", "!=", "\"", "\"", "{", "return", "ParseForwarded", "(", "xff", ")", "\n", "}", "\n\n", "if", "ip", ",", "_", ",", "err", ":=", "net", ".", "SplitHostPort", "(", "r", ".", "RemoteAddr", ")", ";", "err", "==", "nil", "{", "return", "ip", "\n", "}", "\n\n", "return", "\"", "\"", "\n", "}" ]
11,693
all-11694
[ "NewStatus", "returns", "a", "Status", "object", "taken", "as", "a", "snapshot", "from", "the", "router", "." ]
[ "func", "NewStatus", "(", "router", "*", "Router", ")", "*", "Status", "{", "return", "&", "Status", "{", "Protocol", ":", "Protocol", ",", "ProtocolMinVersion", ":", "int", "(", "router", ".", "ProtocolMinVersion", ")", ",", "ProtocolMaxVersion", ":", "ProtocolMaxVersion", ",", "Encryption", ":", "router", ".", "usingPassword", "(", ")", ",", "PeerDiscovery", ":", "router", ".", "PeerDiscovery", ",", "Name", ":", "router", ".", "Ourself", ".", "Name", ".", "<mask>", "(", ")", ",", "NickName", ":", "router", ".", "Ourself", ".", "NickName", ",", "Port", ":", "router", ".", "Port", ",", "Peers", ":", "makePeerStatusSlice", "(", "router", ".", "Peers", ")", ",", "UnicastRoutes", ":", "makeUnicastRouteStatusSlice", "(", "router", ".", "Routes", ")", ",", "BroadcastRoutes", ":", "makeBroadcastRouteStatusSlice", "(", "router", ".", "Routes", ")", ",", "Connections", ":", "makeLocalConnectionStatusSlice", "(", "router", ".", "ConnectionMaker", ")", ",", "TerminationCount", ":", "router", ".", "ConnectionMaker", ".", "terminationCount", ",", "Targets", ":", "router", ".", "ConnectionMaker", ".", "Targets", "(", "false", ")", ",", "OverlayDiagnostics", ":", "router", ".", "Overlay", ".", "Diagnostics", "(", ")", ",", "TrustedSubnets", ":", "makeTrustedSubnetsSlice", "(", "router", ".", "TrustedSubnets", ")", ",", "}", "\n", "}" ]
11,694
all-11695
[ "Do", "executes", "IndexedDB", ".", "getMetadata", "against", "the", "provided", "context", ".", "returns", ":", "entriesCount", "-", "the", "entries", "count", "keyGeneratorValue", "-", "the", "current", "value", "of", "key", "generator", "to", "become", "the", "next", "inserted", "key", "into", "the", "object", "store", ".", "Valid", "if", "objectStore", ".", "autoIncrement", "is", "true", "." ]
[ "func", "(", "p", "*", "GetMetadataParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "entriesCount", "float64", ",", "keyGeneratorValue", "float64", ",", "err", "error", ")", "{", "// execute", "var", "res", "GetMetadataReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetMetadata", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "0", ",", "err", "\n", "}", "\n\n", "return", "<mask>", ".", "EntriesCount", ",", "res", ".", "KeyGeneratorValue", ",", "nil", "\n", "}" ]
11,695
all-11696
[ "String", "returns", "a", "string", "representing", "the", "direction", "." ]
[ "func", "(", "d", "Dir", ")", "String", "(", ")", "string", "{", "<mask>", "d", "{", "case", "DirUp", ":", "return", "\"", "\"", "\n", "case", "DirRight", ":", "return", "\"", "\"", "\n", "case", "DirDown", ":", "return", "\"", "\"", "\n", "case", "DirLeft", ":", "return", "\"", "\"", "\n", "}", "\n", "panic", "(", "\"", "\"", ")", "\n", "}" ]
11,696
all-11697
[ "Locator", "returns", "a", "locator", "for", "the", "given", "resource" ]
[ "func", "(", "r", "*", "Deployment", ")", "Locator", "(", "api", "*", "API", ")", "*", "DeploymentLocator", "{", "for", "_", ",", "l", ":=", "<mask>", "r", ".", "Links", "{", "if", "l", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "return", "api", ".", "DeploymentLocator", "(", "l", "[", "\"", "\"", "]", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
11,697
all-11698
[ "FlickFinger", "performs", "a", "flick", "touch", "action", "by", "the", "provided", "offset", "and", "at", "the", "provided", "speed", "on", "exactly", "one", "element", "." ]
[ "func", "(", "s", "*", "Selection", ")", "FlickFinger", "(", "xOffset", ",", "yOffset", "int", ",", "speed", "uint", ")", "error", "{", "selectedElement", ",", "err", ":=", "s", ".", "elements", ".", "GetExactlyOne", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "s", ",", "err", ")", "\n", "}", "\n\n", "if", "err", ":=", "s", ".", "<mask>", ".", "TouchFlick", "(", "selectedElement", ".", "(", "*", "api", ".", "Element", ")", ",", "api", ".", "XYOffset", "{", "X", ":", "xOffset", ",", "Y", ":", "yOffset", "}", ",", "api", ".", "ScalarSpeed", "(", "speed", ")", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "s", ",", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
11,698
all-11699
[ "Recovery", "recovers", "the", "store", "system", "from", "a", "static", "state", "It", "needs", "to", "recover", "the", "parent", "field", "of", "the", "nodes", ".", "It", "needs", "to", "delete", "the", "expired", "nodes", "since", "the", "saved", "time", "and", "also", "needs", "to", "create", "monitoring", "go", "routines", "." ]
[ "func", "(", "s", "*", "store", ")", "Recovery", "(", "state", "[", "]", "byte", ")", "error", "{", "s", ".", "worldLock", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "worldLock", ".", "Unlock", "(", ")", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "state", ",", "s", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "s", ".", "ttlKeyHeap", "=", "newTtlKeyHeap", "(", ")", "\n\n", "s", ".", "<mask>", ".", "recoverAndclean", "(", ")", "\n", "return", "nil", "\n", "}" ]
11,699
all-11700
[ "SetMiterLimit", "is", "a", "wrapper", "around", "cairo_set_miter_limit", "()", "." ]
[ "func", "(", "v", "*", "Context", ")", "SetMiterLimit", "(", "limit", "float64", ")", "{", "C", ".", "cairo_set_miter_limit", "(", "v", ".", "native", "(", ")", ",", "C", ".", "double", "(", "<mask>", ")", ")", "\n", "}" ]