id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
11,900
all-11901
[ "mergeTags", "merges", "the", "default", "tags", "with", "the", "exta", "tags", ".", "Default", "will", "be", "overridden", "if", "it", "conflicts", "." ]
[ "func", "mergeTags", "(", "defaultTags", ",", "extraTags", "map", "[", "string", "]", "string", ")", "map", "[", "string", "]", "string", "{", "newTags", ":=", "map", "[", "string", "]", "string", "{", "}", "\n\n", "for", "k", ",", "v", ":=", "range", "defaultTags", "{", "newTags", "[", "k", "]", "=", "v", "\n", "}", "\n", "for", "k", ",", "v", ":=", "<mask>", "extraTags", "{", "newTags", "[", "k", "]", "=", "v", "\n", "}", "\n\n", "return", "newTags", "\n", "}" ]
11,901
all-11902
[ "XXX_OneofFuncs", "is", "for", "the", "internal", "use", "of", "the", "proto", "package", "." ]
[ "func", "(", "*", "Compare", ")", "XXX_OneofFuncs", "(", ")", "(", "func", "(", "msg", "proto", ".", "Message", ",", "b", "*", "proto", ".", "Buffer", ")", "error", ",", "func", "(", "msg", "proto", ".", "Message", ",", "tag", ",", "wire", "int", ",", "b", "*", "proto", ".", "Buffer", ")", "(", "bool", ",", "error", ")", ",", "func", "(", "msg", "proto", ".", "Message", ")", "(", "n", "int", ")", ",", "[", "]", "interface", "{", "}", ")", "{", "return", "_Compare_OneofMarshaler", ",", "_Compare_OneofUnmarshaler", ",", "_Compare_OneofSizer", ",", "[", "]", "<mask>", "{", "}", "{", "(", "*", "Compare_Version", ")", "(", "nil", ")", ",", "(", "*", "Compare_CreateRevision", ")", "(", "nil", ")", ",", "(", "*", "Compare_ModRevision", ")", "(", "nil", ")", ",", "(", "*", "Compare_Value", ")", "(", "nil", ")", ",", "(", "*", "Compare_Lease", ")", "(", "nil", ")", ",", "}", "\n", "}" ]
11,902
all-11903
[ "getMemtables", "returns", "the", "current", "memtables", "and", "get", "references", "." ]
[ "func", "(", "db", "*", "DB", ")", "getMemTables", "(", ")", "(", "[", "]", "*", "skl", ".", "Skiplist", ",", "func", "(", ")", ")", "{", "db", ".", "RLock", "(", ")", "\n", "defer", "db", ".", "RUnlock", "(", ")", "\n\n", "tables", ":=", "make", "(", "[", "]", "*", "skl", ".", "Skiplist", ",", "len", "(", "db", ".", "imm", ")", "+", "1", ")", "\n\n", "// Get mutable memtable.", "tables", "[", "0", "]", "=", "db", ".", "mt", "\n", "tables", "[", "0", "]", ".", "IncrRef", "(", ")", "\n\n", "// Get immutable memtables.", "last", ":=", "len", "(", "db", ".", "imm", ")", "-", "1", "\n", "for", "i", ":=", "range", "db", ".", "imm", "{", "tables", "[", "i", "+", "1", "]", "=", "db", ".", "imm", "[", "<mask>", "-", "i", "]", "\n", "tables", "[", "i", "+", "1", "]", ".", "IncrRef", "(", ")", "\n", "}", "\n", "return", "tables", ",", "func", "(", ")", "{", "for", "_", ",", "tbl", ":=", "range", "tables", "{", "tbl", ".", "DecrRef", "(", ")", "\n", "}", "\n", "}", "\n", "}" ]
11,903
all-11904
[ "HTTPRespondMarshalJSON", "marshals", "response", "as", "JSON", "to", "responseWriter", "sets", "Content", "-", "Type", "to", "application", "/", "json", "and", "compresses", "the", "response", "if", "Content", "-", "Encoding", "from", "the", "request", "allows", "it", "." ]
[ "func", "HTTPRespondMarshalJSON", "(", "response", "<mask>", "{", "}", ",", "responseWriter", "http", ".", "ResponseWriter", ",", "request", "*", "http", ".", "Request", ")", "(", "err", "error", ")", "{", "NewHTTPCompressHandlerFromFunc", "(", "func", "(", "responseWriter", "http", ".", "ResponseWriter", ",", "request", "*", "http", ".", "Request", ")", "{", "var", "data", "[", "]", "byte", "\n", "if", "data", ",", "err", "=", "json", ".", "Marshal", "(", "response", ")", ";", "err", "==", "nil", "{", "responseWriter", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "_", ",", "err", "=", "responseWriter", ".", "Write", "(", "data", ")", "\n", "}", "\n", "}", ")", ".", "ServeHTTP", "(", "responseWriter", ",", "request", ")", "\n", "return", "err", "\n", "}" ]
11,904
all-11905
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetVirtualTimePolicyReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
11,905
all-11906
[ "HasTitleAlign", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "Widget", ")", "HasTitleAlign", "(", ")", "bool", "{", "if", "w", "!=", "nil", "&&", "w", ".", "TitleAlign", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
11,906
all-11907
[ "Next", "provides", "a", "mock", "function", "with", "given", "fields", ":", "_a0" ]
[ "func", "(", "_m", "*", "ObjectRows", ")", "Next", "(", "_a0", "interface", "{", "}", ")", "(", "bool", ",", "error", ")", "{", "ret", ":=", "_m", ".", "Called", "(", "_a0", ")", "\n\n", "var", "r0", "bool", "\n", "if", "rf", ",", "ok", ":=", "ret", ".", "Get", "(", "0", ")", ".", "(", "func", "(", "<mask>", "{", "}", ")", "bool", ")", ";", "ok", "{", "r0", "=", "rf", "(", "_a0", ")", "\n", "}", "else", "{", "r0", "=", "ret", ".", "Get", "(", "0", ")", ".", "(", "bool", ")", "\n", "}", "\n\n", "var", "r1", "error", "\n", "if", "rf", ",", "ok", ":=", "ret", ".", "Get", "(", "1", ")", ".", "(", "func", "(", "interface", "{", "}", ")", "error", ")", ";", "ok", "{", "r1", "=", "rf", "(", "_a0", ")", "\n", "}", "else", "{", "r1", "=", "ret", ".", "Error", "(", "1", ")", "\n", "}", "\n\n", "return", "r0", ",", "r1", "\n", "}" ]
11,907
all-11908
[ "TODO", "(", "spiffxp", ")", ":", "needs", "to", "validate", "labels", "duped", "across", "repos", "are", "identical", "Ensures", "the", "config", "does", "not", "duplicate", "label", "names", "between", "default", "and", "repo" ]
[ "func", "(", "c", "Configuration", ")", "validate", "(", "orgs", "string", ")", "error", "{", "// Check default labels", "seen", ",", "err", ":=", "validate", "(", "c", ".", "Default", ".", "Labels", ",", "\"", "\"", ",", "make", "(", "map", "[", "string", "]", "string", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "// Generate list of orgs", "sortedOrgs", ":=", "strings", ".", "Split", "(", "orgs", ",", "\"", "\"", ")", "\n", "sort", ".", "Strings", "(", "sortedOrgs", ")", "\n", "// Check other repos labels", "for", "repo", ",", "repoconfig", ":=", "range", "c", ".", "Repos", "{", "// Will complain if a label is both in default and repo", "if", "_", ",", "err", ":=", "validate", "(", "repoconfig", ".", "Labels", ",", "repo", ",", "seen", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "// If orgs have been specified, warn if repo isn't under orgs", "if", "len", "(", "orgs", ")", "!=", "0", "{", "<mask>", ":=", "strings", ".", "Split", "(", "repo", ",", "\"", "\"", ")", "\n", "if", "len", "(", "data", ")", "==", "2", "{", "if", "!", "stringInSortedSlice", "(", "data", "[", "0", "]", ",", "sortedOrgs", ")", "{", "logrus", ".", "WithField", "(", "\"", "\"", ",", "orgs", ")", ".", "WithField", "(", "\"", "\"", ",", "data", "[", "0", "]", ")", ".", "WithField", "(", "\"", "\"", ",", "repo", ")", ".", "Warn", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
11,908
all-11909
[ "DeleteAPIKey", "deletes", "API", "key", "given", "by", "key", "returns", "an", "error" ]
[ "func", "(", "client", "*", "Client", ")", "DeleteAPIKey", "(", "key", "string", ")", "error", "{", "return", "<mask>", ".", "doJsonRequest", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "key", ")", ",", "nil", ",", "nil", ")", "\n", "}" ]
11,909
all-11910
[ "New", "returns", "a", "new", "Compactor", "based", "on", "given", "mode", "." ]
[ "func", "New", "(", "lg", "*", "zap", ".", "Logger", ",", "mode", "string", ",", "retention", "time", ".", "Duration", ",", "rg", "RevGetter", ",", "c", "Compactable", ",", ")", "(", "Compactor", ",", "error", ")", "{", "switch", "mode", "{", "case", "ModePeriodic", ":", "return", "newPeriodic", "(", "lg", ",", "clockwork", ".", "NewRealClock", "(", ")", ",", "retention", ",", "rg", ",", "c", ")", ",", "nil", "\n", "case", "ModeRevision", ":", "return", "newRevision", "(", "lg", ",", "clockwork", ".", "NewRealClock", "(", ")", ",", "int64", "(", "retention", ")", ",", "rg", ",", "c", ")", ",", "nil", "\n", "default", ":", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "<mask>", ")", "\n", "}", "\n", "}" ]
11,910
all-11911
[ "union", "returns", "a", "new", "orgRepoConfig", "that", "represents", "the", "set", "union", "of", "the", "repos", "specified", "by", "the", "receiver", "and", "the", "parameter", "orgRepoConfigs" ]
[ "func", "(", "c", "*", "orgRepoConfig", ")", "union", "(", "c2", "*", "orgRepoConfig", ")", "*", "orgRepoConfig", "{", "res", ":=", "&", "orgRepoConfig", "{", "orgExceptions", ":", "make", "(", "map", "[", "string", "]", "sets", ".", "String", ")", ",", "repos", ":", "sets", ".", "NewString", "(", ")", ",", "}", "\n\n", "for", "org", ",", "excepts1", ":=", "range", "c", ".", "orgExceptions", "{", "// keep only items in both blacklists that are not in the", "// explicit repo whitelists for the other configuration;", "// we know from how the orgRepoConfigs are constructed that", "// a org blacklist won't intersect it's own repo whitelist", "pruned", ":=", "excepts1", ".", "Difference", "(", "c2", ".", "repos", ")", "\n", "if", "excepts2", ",", "<mask>", ":=", "c2", ".", "orgExceptions", "[", "org", "]", ";", "ok", "{", "res", ".", "orgExceptions", "[", "org", "]", "=", "pruned", ".", "Intersection", "(", "excepts2", ".", "Difference", "(", "c", ".", "repos", ")", ")", "\n", "}", "else", "{", "res", ".", "orgExceptions", "[", "org", "]", "=", "pruned", "\n", "}", "\n", "}", "\n\n", "for", "org", ",", "excepts2", ":=", "range", "c2", ".", "orgExceptions", "{", "// update any blacklists not previously updated", "if", "_", ",", "exists", ":=", "res", ".", "orgExceptions", "[", "org", "]", ";", "!", "exists", "{", "res", ".", "orgExceptions", "[", "org", "]", "=", "excepts2", ".", "Difference", "(", "c", ".", "repos", ")", "\n", "}", "\n", "}", "\n\n", "// we need to prune out repos in the whitelists which are", "// covered by an org already; we know from above that no", "// org blacklist in the result will contain a repo whitelist", "for", "_", ",", "repo", ":=", "range", "c", ".", "repos", ".", "Union", "(", "c2", ".", "repos", ")", ".", "UnsortedList", "(", ")", "{", "parts", ":=", "strings", ".", "SplitN", "(", "repo", ",", "\"", "\"", ",", "2", ")", "\n", "if", "len", "(", "parts", ")", "!=", "2", "{", "logrus", ".", "Warnf", "(", "\"", "\"", ",", "repo", ")", "\n", "continue", "\n", "}", "\n", "if", "_", ",", "exists", ":=", "res", ".", "orgExceptions", "[", "parts", "[", "0", "]", "]", ";", "!", "exists", "{", "res", ".", "repos", ".", "Insert", "(", "repo", ")", "\n", "}", "\n", "}", "\n", "return", "res", "\n", "}" ]
11,911
all-11912
[ "specToStarted", "translate", "a", "jobspec", "into", "a", "started", "struct", "optionally", "overwrite", "RepoVersion", "with", "provided", "mainRefSHA" ]
[ "func", "specToStarted", "(", "spec", "*", "downwardapi", ".", "JobSpec", ",", "mainRefSHA", "string", ")", "gcs", ".", "Started", "{", "started", ":=", "gcs", ".", "Started", "{", "Timestamp", ":", "time", ".", "Now", "(", ")", ".", "Unix", "(", ")", ",", "RepoVersion", ":", "downwardapi", ".", "GetRevisionFromSpec", "(", "spec", ")", ",", "}", "\n\n", "if", "mainRefSHA", "!=", "\"", "\"", "{", "started", ".", "RepoVersion", "=", "mainRefSHA", "\n", "}", "\n\n", "// TODO(fejta): VM name", "if", "spec", ".", "Refs", "!=", "nil", "&&", "len", "(", "spec", ".", "Refs", ".", "Pulls", ")", ">", "0", "{", "started", ".", "Pull", "=", "strconv", ".", "Itoa", "(", "spec", ".", "Refs", ".", "Pulls", "[", "0", "]", ".", "Number", ")", "\n", "}", "\n\n", "started", ".", "Repos", "=", "map", "[", "string", "]", "string", "{", "}", "\n\n", "if", "spec", ".", "Refs", "!=", "nil", "{", "started", ".", "Repos", "[", "spec", ".", "Refs", ".", "Org", "+", "\"", "\"", "+", "<mask>", ".", "Refs", ".", "Repo", "]", "=", "spec", ".", "Refs", ".", "String", "(", ")", "\n", "}", "\n", "for", "_", ",", "ref", ":=", "range", "spec", ".", "ExtraRefs", "{", "started", ".", "Repos", "[", "ref", ".", "Org", "+", "\"", "\"", "+", "ref", ".", "Repo", "]", "=", "ref", ".", "String", "(", ")", "\n", "}", "\n\n", "return", "started", "\n", "}" ]
11,912
all-11913
[ "sha1Map", "returns", "the", "sha1", "hash", "of", "the", "data", "in", "the", "map", ".", "The", "reason", "this", "data", "is", "hashed", "is", "because", "it", "appears", "in", "the", "output", "and", "could", "contain", "sensitive", "information", "." ]
[ "func", "sha1Map", "(", "m", "map", "[", "string", "]", "interface", "{", "}", ")", "string", "{", "keys", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "m", ")", ")", "\n", "for", "k", ",", "_", ":=", "range", "m", "{", "keys", "=", "append", "(", "keys", ",", "k", ")", "\n", "}", "\n", "sort", ".", "Strings", "(", "keys", ")", "\n\n", "h", ":=", "sha1", ".", "New", "(", ")", "\n", "for", "_", ",", "k", ":=", "range", "<mask>", "{", "io", ".", "WriteString", "(", "h", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "k", ",", "m", "[", "k", "]", ")", ")", "\n", "}", "\n\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "h", ".", "Sum", "(", "nil", ")", ")", "\n", "}" ]
11,913
all-11914
[ "GetText", "is", "a", "wrapper", "around", "gtk_label_get_text", "()", "." ]
[ "func", "(", "v", "*", "Label", ")", "GetText", "(", ")", "(", "string", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_label_get_text", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "\"", "\"", ",", "nilPtrErr", "\n", "}", "\n", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "<mask>", ")", "(", "c", ")", ")", ",", "nil", "\n", "}" ]
11,914
all-11915
[ "Unmarshal", "parses", "the", "JSON", "payload", "from", "the", "command", "arguments", "and", "unmarshal", "into", "a", "value", "pointed", "to", "by", "v", "." ]
[ "func", "(", "p", "ParamSet", ")", "Unmarshal", "(", "v", "interface", "{", "}", ")", "error", "{", "return", "json", ".", "NewDecoder", "(", "p", ".", "<mask>", ")", ".", "Decode", "(", "v", ")", "\n", "}" ]
11,915
all-11916
[ "Reset", "resets", "the", "NewTimeoutDetector", "." ]
[ "func", "(", "td", "*", "TimeoutDetector", ")", "Reset", "(", ")", "{", "td", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "td", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "td", ".", "records", "=", "make", "(", "<mask>", "[", "uint64", "]", "time", ".", "Time", ")", "\n", "}" ]
11,916
all-11917
[ "writeInternal", "contains", "the", "essential", "implementation", "of", "writeProto", "(", "data", "is", "a", "serialized", "proto", ")", "but", "does", "not", "retry" ]
[ "func", "(", "s", "*", "objBlockAPIServer", ")", "writeInternal", "(", "ctx", "context", ".", "Context", ",", "path", "string", ",", "data", "[", "]", "byte", ")", "(", "retErr", "error", ")", "{", "defer", "func", "(", ")", "{", "if", "retErr", "!=", "nil", "{", "return", "\n", "}", "\n", "retErr", "=", "func", "(", ")", "(", "retErr", "error", ")", "{", "if", "!", "s", ".", "objClient", ".", "Exists", "(", "ctx", ",", "<mask>", ")", "{", "logrus", ".", "Errorf", "(", "\"", "\"", ",", "path", ")", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "path", ")", "\n", "}", "\n", "return", "nil", "\n", "}", "(", ")", "\n", "}", "(", ")", "\n", "w", ",", "err", ":=", "s", ".", "objClient", ".", "Writer", "(", "ctx", ",", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "if", "err", ":=", "w", ".", "Close", "(", ")", ";", "err", "!=", "nil", "&&", "retErr", "==", "nil", "{", "retErr", "=", "err", "\n", "}", "\n", "}", "(", ")", "\n", "_", ",", "err", "=", "w", ".", "Write", "(", "data", ")", "\n", "return", "err", "\n", "}" ]
11,917
all-11918
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "QueryObjectsParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime13", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
11,918
all-11919
[ "native", "returns", "a", "pointer", "to", "the", "underlying", "GtkAppChooser", "." ]
[ "func", "(", "v", "*", "AppChooser", ")", "native", "(", ")", "*", "C", ".", "GtkAppChooser", "{", "if", "v", "==", "nil", "||", "v", ".", "GObject", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "p", ":=", "unsafe", ".", "Pointer", "(", "v", ".", "GObject", ")", "\n", "<mask>", "C", ".", "toGtkAppChooser", "(", "p", ")", "\n", "}" ]
11,919
all-11920
[ "SearchMetrics", "returns", "metrics", "matching", "the", "specified", "search", "query", "and", "/", "or", "filter", ".", "If", "nil", "is", "passed", "for", "both", "parameters", "all", "metrics", "will", "be", "returned", "." ]
[ "func", "(", "a", "*", "API", ")", "SearchMetrics", "(", "searchCriteria", "*", "SearchQueryType", ",", "filterCriteria", "*", "SearchFilterType", ")", "(", "*", "[", "]", "Metric", ",", "error", ")", "{", "q", ":=", "url", ".", "Values", "{", "}", "\n\n", "if", "searchCriteria", "!=", "nil", "&&", "*", "searchCriteria", "!=", "\"", "\"", "{", "q", ".", "Set", "(", "\"", "\"", ",", "string", "(", "*", "searchCriteria", ")", ")", "\n", "}", "\n\n", "if", "filterCriteria", "!=", "nil", "&&", "len", "(", "*", "filterCriteria", ")", ">", "0", "{", "for", "filter", ",", "criteria", ":=", "range", "*", "filterCriteria", "{", "for", "_", ",", "val", ":=", "<mask>", "criteria", "{", "q", ".", "Add", "(", "filter", ",", "val", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "q", ".", "Encode", "(", ")", "==", "\"", "\"", "{", "return", "a", ".", "FetchMetrics", "(", ")", "\n", "}", "\n\n", "reqURL", ":=", "url", ".", "URL", "{", "Path", ":", "config", ".", "MetricPrefix", ",", "RawQuery", ":", "q", ".", "Encode", "(", ")", ",", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "Get", "(", "reqURL", ".", "String", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "var", "metrics", "[", "]", "Metric", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "&", "metrics", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "metrics", ",", "nil", "\n", "}" ]
11,920
all-11921
[ "Handle", "allows", "to", "add", "an", "action", "as", "a", "group", "action", ".", "Group", "actions", "will", "be", "run", "when", "no", "controller", "matches", "the", "request", ".", "Note", ":", "The", "passed", "context", "is", "more", "or", "less", "empty", "." ]
[ "func", "(", "g", "*", "Group", ")", "Handle", "(", "name", "string", ",", "a", "*", "GroupAction", ")", "{", "if", "<mask>", "==", "\"", "\"", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "`fire: invalid group action \"%s\"`", ",", "name", ")", ")", "\n", "}", "\n\n", "// set default body limit", "if", "a", ".", "Action", ".", "BodyLimit", "==", "0", "{", "a", ".", "Action", ".", "BodyLimit", "=", "DataSize", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// check existence", "if", "g", ".", "actions", "[", "name", "]", "!=", "nil", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "`fire: action with name \"%s\" already exists`", ",", "name", ")", ")", "\n", "}", "\n\n", "// add action", "g", ".", "actions", "[", "name", "]", "=", "a", "\n", "}" ]
11,921
all-11922
[ "ProwJobFields", "extracts", "logrus", "fields", "from", "a", "prowjob", "useful", "for", "logging", "." ]
[ "func", "ProwJobFields", "(", "pj", "*", "prowapi", ".", "ProwJob", ")", "logrus", ".", "Fields", "{", "fields", ":=", "make", "(", "logrus", ".", "Fields", ")", "\n", "fields", "[", "\"", "\"", "]", "=", "pj", ".", "ObjectMeta", ".", "Name", "\n", "fields", "[", "\"", "\"", "]", "=", "pj", ".", "Spec", ".", "Job", "\n", "<mask>", "[", "\"", "\"", "]", "=", "pj", ".", "Spec", ".", "Type", "\n", "if", "len", "(", "pj", ".", "ObjectMeta", ".", "Labels", "[", "github", ".", "EventGUID", "]", ")", ">", "0", "{", "fields", "[", "github", ".", "EventGUID", "]", "=", "pj", ".", "ObjectMeta", ".", "Labels", "[", "github", ".", "EventGUID", "]", "\n", "}", "\n", "if", "pj", ".", "Spec", ".", "Refs", "!=", "nil", "&&", "len", "(", "pj", ".", "Spec", ".", "Refs", ".", "Pulls", ")", "==", "1", "{", "fields", "[", "github", ".", "PrLogField", "]", "=", "pj", ".", "Spec", ".", "Refs", ".", "Pulls", "[", "0", "]", ".", "Number", "\n", "fields", "[", "github", ".", "RepoLogField", "]", "=", "pj", ".", "Spec", ".", "Refs", ".", "Repo", "\n", "fields", "[", "github", ".", "OrgLogField", "]", "=", "pj", ".", "Spec", ".", "Refs", ".", "Org", "\n", "}", "\n", "if", "pj", ".", "Spec", ".", "JenkinsSpec", "!=", "nil", "{", "fields", "[", "\"", "\"", "]", "=", "pj", ".", "Spec", ".", "JenkinsSpec", ".", "GitHubBranchSourceJob", "\n", "}", "\n\n", "return", "fields", "\n", "}" ]
11,922
all-11923
[ "Join", "accepts", "the", "room", "id", "and", "the", "name", "used", "to", "display", "the", "client", "in", "the", "room", "." ]
[ "func", "(", "c", "*", "Client", ")", "Join", "(", "roomId", ",", "resource", "string", ")", "{", "c", ".", "connection", ".", "MUCPresence", "(", "roomId", "+", "\"", "\"", "+", "resource", ",", "c", ".", "<mask>", ")", "\n", "}" ]
11,923
all-11924
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventEventSourceMessageReceived", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork55", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
11,924
all-11925
[ "GetCancelLabel", "()", "is", "a", "wrapper", "around", "gtk_file_chooser_native_get_cancel_label", "()", "." ]
[ "func", "(", "v", "*", "FileChooserNativeDialog", ")", "GetCancelLabel", "(", ")", "(", "string", ",", "<mask>", ")", "{", "return", "stringReturn", "(", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "gtk_file_chooser_native_get_cancel_label", "(", "v", ".", "native", "(", ")", ")", ")", ")", "\n", "}" ]
11,925
all-11926
[ "HasTime", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TimeseriesDefinition", ")", "HasTime", "(", ")", "bool", "{", "if", "t", "!=", "nil", "&&", "t", ".", "Time", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
11,926
all-11927
[ "Given", "a", "reflected", "Go", "type", "getUniversalType", "returns", "the", "default", "tag", "number", "and", "expected", "compound", "flag", "." ]
[ "func", "getUniversalType", "(", "t", "reflect", ".", "Type", ")", "(", "tagNumber", "int", ",", "isCompound", ",", "ok", "bool", ")", "{", "switch", "t", "{", "case", "objectIdentifierType", ":", "return", "tagOID", ",", "false", ",", "true", "\n", "case", "bitStringType", ":", "return", "tagBitString", ",", "false", ",", "true", "\n", "case", "timeType", ":", "return", "tagUTCTime", ",", "false", ",", "true", "\n", "case", "enumeratedType", ":", "return", "tagEnum", ",", "false", ",", "true", "\n", "case", "bigIntType", ":", "return", "tagInteger", ",", "false", ",", "<mask>", "\n", "}", "\n", "switch", "t", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Bool", ":", "return", "tagBoolean", ",", "false", ",", "true", "\n", "case", "reflect", ".", "Int", ",", "reflect", ".", "Int8", ",", "reflect", ".", "Int16", ",", "reflect", ".", "Int32", ",", "reflect", ".", "Int64", ":", "return", "tagInteger", ",", "false", ",", "true", "\n", "case", "reflect", ".", "Struct", ":", "return", "tagSequence", ",", "true", ",", "true", "\n", "case", "reflect", ".", "Slice", ":", "if", "t", ".", "Elem", "(", ")", ".", "Kind", "(", ")", "==", "reflect", ".", "Uint8", "{", "return", "tagOctetString", ",", "false", ",", "true", "\n", "}", "\n", "if", "strings", ".", "HasSuffix", "(", "t", ".", "Name", "(", ")", ",", "\"", "\"", ")", "{", "return", "tagSet", ",", "true", ",", "true", "\n", "}", "\n", "return", "tagSequence", ",", "true", ",", "true", "\n", "case", "reflect", ".", "String", ":", "return", "tagPrintableString", ",", "false", ",", "true", "\n", "}", "\n", "return", "0", ",", "false", ",", "false", "\n", "}" ]
11,927
all-11928
[ "ShouldCreateWithASMSecret", "returns", "true", "if", "this", "container", "needs", "to", "get", "secret", "value", "from", "AWS", "Secrets", "Manager" ]
[ "func", "(", "c", "*", "Container", ")", "ShouldCreateWithASMSecret", "(", ")", "bool", "{", "c", ".", "<mask>", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "// Secrets field will be nil if there is no secrets for container", "if", "c", ".", "Secrets", "==", "nil", "{", "return", "false", "\n", "}", "\n\n", "for", "_", ",", "secret", ":=", "range", "c", ".", "Secrets", "{", "if", "secret", ".", "Provider", "==", "SecretProviderASM", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
11,928
all-11929
[ "ValidateHost", "checks", "to", "see", "if", "a", "HostSystem", "is", "a", "member", "of", "a", "ResourcePool", "through", "cluster", "membership", "or", "if", "the", "HostSystem", "ID", "matches", "the", "ID", "of", "a", "standalone", "host", "ComputeResource", ".", "An", "error", "is", "returned", "if", "it", "is", "not", "a", "member", "of", "the", "cluster", "to", "which", "the", "resource", "pool", "belongs", "or", "if", "there", "was", "some", "sort", "of", "other", "error", "with", "checking", ".", "This", "is", "used", "as", "an", "extra", "validation", "before", "a", "VM", "creation", "happens", "or", "vMotion", "to", "a", "specific", "host", "is", "attempted", "." ]
[ "func", "ValidateHost", "(", "client", "*", "govmomi", ".", "Client", ",", "pool", "*", "object", ".", "ResourcePool", ",", "host", "*", "object", ".", "HostSystem", ")", "error", "{", "if", "host", "==", "nil", "{", "// Nothing to validate here, move along", "log", ".", "Printf", "(", "\"", "\"", ")", "\n", "return", "nil", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "host", ".", "Reference", "(", ")", ".", "Value", ",", "pool", ".", "Reference", "(", ")", ".", "Value", ")", "\n", "pprops", ",", "err", ":=", "Properties", "(", "pool", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "cprops", ",", "err", ":=", "computeresource", ".", "BasePropertiesFromReference", "(", "client", ",", "pprops", ".", "Owner", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "for", "_", ",", "href", ":=", "range", "cprops", ".", "Host", "{", "if", "href", ".", "Value", "==", "host", ".", "Reference", "(", ")", ".", "Value", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "host", ".", "Reference", "(", ")", ".", "<mask>", ",", "pool", ".", "Reference", "(", ")", ".", "Value", ")", "\n", "return", "nil", "\n", "}", "\n", "}", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "host", ".", "Reference", "(", ")", ".", "Value", ",", "pool", ".", "Reference", "(", ")", ".", "Value", ")", "\n", "}" ]
11,929
all-11930
[ "NewRequestHandler", "returns", "new", "request", "handler", "with", "the", "given", "FS", "settings", ".", "The", "returned", "handler", "caches", "requested", "file", "handles", "for", "FS", ".", "CacheDuration", ".", "Make", "sure", "your", "program", "has", "enough", "max", "open", "files", "limit", "aka", "ulimit", "-", "n", "if", "FS", ".", "Root", "folder", "contains", "many", "files", ".", "Do", "not", "create", "multiple", "request", "handlers", "from", "a", "single", "FS", "instance", "-", "just", "reuse", "a", "single", "request", "handler", "." ]
[ "func", "(", "fs", "*", "FS", ")", "NewRequestHandler", "(", ")", "RequestHandler", "{", "fs", ".", "<mask>", ".", "Do", "(", "fs", ".", "initRequestHandler", ")", "\n", "return", "fs", ".", "h", "\n", "}" ]
11,930
all-11931
[ "FinalSave", "should", "be", "called", "immediately", "before", "exiting", "and", "only", "before", "exiting", "in", "order", "to", "flush", "tasks", "to", "disk", ".", "It", "waits", "a", "short", "timeout", "for", "state", "to", "settle", "if", "necessary", ".", "If", "unable", "to", "reach", "a", "steady", "-", "state", "and", "save", "within", "this", "short", "timeout", "it", "returns", "an", "error" ]
[ "func", "FinalSave", "(", "saver", "statemanager", ".", "Saver", ",", "taskEngine", "engine", ".", "TaskEngine", ")", "error", "{", "engineDisabled", ":=", "make", "(", "chan", "error", ")", "\n\n", "disableTimer", ":=", "time", ".", "AfterFunc", "(", "engineDisableTimeout", ",", "func", "(", ")", "{", "engineDisabled", "<-", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", ")", "\n\n", "go", "func", "(", ")", "{", "seelog", ".", "Debug", "(", "\"", "\"", ")", "\n", "taskEngine", ".", "Disable", "(", ")", "\n", "disableTimer", ".", "Stop", "(", ")", "\n", "engineDisabled", "<-", "nil", "\n", "}", "(", ")", "\n\n", "disableErr", ":=", "<-", "engineDisabled", "\n\n", "stateSaved", ":=", "<mask>", "(", "chan", "error", ")", "\n", "saveTimer", ":=", "time", ".", "AfterFunc", "(", "finalSaveTimeout", ",", "func", "(", ")", "{", "stateSaved", "<-", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", ")", "\n", "go", "func", "(", ")", "{", "seelog", ".", "Debug", "(", "\"", "\"", ")", "\n", "stateSaved", "<-", "saver", ".", "ForceSave", "(", ")", "\n", "saveTimer", ".", "Stop", "(", ")", "\n", "}", "(", ")", "\n\n", "saveErr", ":=", "<-", "stateSaved", "\n\n", "if", "disableErr", "!=", "nil", "||", "saveErr", "!=", "nil", "{", "return", "apierrors", ".", "NewMultiError", "(", "disableErr", ",", "saveErr", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
11,931
all-11932
[ "RemoveImageState", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockTaskEngineState", ")", "RemoveImageState", "(", "arg0", "*", "<mask>", ".", "ImageState", ")", "{", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "}" ]
11,932
all-11933
[ "NewClient", "makes", "a", "new", "Client", "with", "the", "specified", "token", "and", "dry", "-", "run", "status", "." ]
[ "func", "NewClient", "(", "token", "string", ",", "dryRun", "bool", ")", "*", "Client", "{", "httpClient", ":=", "&", "http", ".", "Client", "{", "Transport", ":", "&", "oauth2", ".", "Transport", "{", "Base", ":", "http", ".", "DefaultTransport", ",", "Source", ":", "oauth2", ".", "ReuseTokenSource", "(", "nil", ",", "oauth2", ".", "StaticTokenSource", "(", "&", "oauth2", ".", "Token", "{", "AccessToken", ":", "token", "}", ")", ")", ",", "}", ",", "}", "\n", "<mask>", ":=", "github", ".", "NewClient", "(", "httpClient", ")", "\n", "return", "&", "Client", "{", "issueService", ":", "client", ".", "Issues", ",", "prService", ":", "client", ".", "PullRequests", ",", "repoService", ":", "client", ".", "Repositories", ",", "userService", ":", "client", ".", "Users", ",", "retries", ":", "5", ",", "retryInitialBackoff", ":", "time", ".", "Second", ",", "tokenReserve", ":", "50", ",", "dryRun", ":", "dryRun", ",", "}", "\n", "}" ]
11,933
all-11934
[ "NewExoscaleProviderWithClient", "returns", "ExoscaleProvider", "DNS", "provider", "interface", "implementation", "(", "Client", "provided", ")" ]
[ "func", "NewExoscaleProviderWithClient", "(", "endpoint", ",", "apiKey", ",", "apiSecret", "string", ",", "client", "EgoscaleClientI", ",", "dryRun", "bool", ",", "opts", "...", "ExoscaleOption", ")", "*", "ExoscaleProvider", "{", "ep", ":=", "&", "ExoscaleProvider", "{", "filter", ":", "&", "zoneFilter", "{", "}", ",", "OnApplyChanges", ":", "func", "(", "changes", "*", "<mask>", ".", "Changes", ")", "{", "}", ",", "domain", ":", "NewDomainFilter", "(", "[", "]", "string", "{", "\"", "\"", "}", ")", ",", "client", ":", "client", ",", "dryRun", ":", "dryRun", ",", "}", "\n", "for", "_", ",", "opt", ":=", "range", "opts", "{", "opt", "(", "ep", ")", "\n", "}", "\n", "return", "ep", "\n", "}" ]
11,934
all-11935
[ "File", "returns", "an", "uploaded", "file", "by", "name", "or", "an", "error" ]
[ "func", "(", "d", "*", "DefaultContext", ")", "File", "(", "name", "string", ")", "(", "binding", ".", "File", ",", "error", ")", "{", "req", ":=", "d", ".", "Request", "(", ")", "\n", "if", "err", ":=", "req", ".", "ParseMultipartForm", "(", "5", "*", "1024", "*", "1024", ")", ";", "err", "!=", "nil", "{", "return", "binding", ".", "<mask>", "{", "}", ",", "err", "\n", "}", "\n", "f", ",", "h", ",", "err", ":=", "req", ".", "FormFile", "(", "name", ")", "\n", "bf", ":=", "binding", ".", "File", "{", "File", ":", "f", ",", "FileHeader", ":", "h", ",", "}", "\n", "if", "err", "!=", "nil", "{", "return", "bf", ",", "err", "\n", "}", "\n", "return", "bf", ",", "nil", "\n", "}" ]
11,935
all-11936
[ "RemoveHost", "black", "lists", "the", "host", "with", "the", "given", "URI", "from", "the", "cluster", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "RemoveHost", "(", "address", "*", "URI", ")", "{", "c", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mutex", ".", "Unlock", "(", ")", "\n", "for", "i", ",", "uri", ":=", "range", "c", ".", "hosts", "{", "if", "uri", ".", "Equals", "(", "address", ")", "{", "c", ".", "okList", "[", "i", "]", "=", "<mask>", "\n", "break", "\n", "}", "\n", "}", "\n", "}" ]
11,936
all-11937
[ "SetPaperHeight", "()", "is", "a", "wrapper", "around", "gtk_print_settings_set_paper_height", "()", "." ]
[ "func", "(", "ps", "*", "PrintSettings", ")", "SetPaperHeight", "(", "<mask>", "float64", ",", "unit", "Unit", ")", "{", "C", ".", "gtk_print_settings_set_paper_height", "(", "ps", ".", "native", "(", ")", ",", "C", ".", "gdouble", "(", "width", ")", ",", "C", ".", "GtkUnit", "(", "unit", ")", ")", "\n", "}" ]
11,937
all-11938
[ "GetTxSetHash", "retrieves", "the", "TxSetHash", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "StellarMessage", ")", "GetTxSetHash", "(", ")", "(", "result", "Uint256", ",", "ok", "bool", ")", "{", "armName", ",", "_", ":=", "u", ".", "ArmForSwitch", "(", "int32", "(", "u", ".", "<mask>", ")", ")", "\n\n", "if", "armName", "==", "\"", "\"", "{", "result", "=", "*", "u", ".", "TxSetHash", "\n", "ok", "=", "true", "\n", "}", "\n\n", "return", "\n", "}" ]
11,938
all-11939
[ "GetIsAdmin", "returns", "the", "IsAdmin", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "c", "*", "CreatedBy", ")", "GetIsAdmin", "(", ")", "bool", "{", "if", "c", "==", "nil", "||", "c", ".", "IsAdmin", "==", "nil", "{", "return", "<mask>", "\n", "}", "\n", "return", "*", "c", ".", "IsAdmin", "\n", "}" ]
11,939
all-11940
[ "MDYAMLEnabled", "returns", "a", "boolean", "denoting", "if", "the", "passed", "repo", "supports", "YAML", "OWNERS", "config", "headers", "at", "the", "top", "of", "markdown", "(", "*", ".", "md", ")", "files", ".", "These", "function", "like", "OWNERS", "files", "but", "only", "apply", "to", "the", "file", "itself", "." ]
[ "func", "(", "c", "*", "Configuration", ")", "MDYAMLEnabled", "(", "org", ",", "repo", "string", ")", "bool", "{", "<mask>", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "repo", ")", "\n", "for", "_", ",", "elem", ":=", "range", "c", ".", "Owners", ".", "MDYAMLRepos", "{", "if", "elem", "==", "org", "||", "elem", "==", "full", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
11,940
all-11941
[ "Locator", "returns", "a", "locator", "for", "the", "given", "resource" ]
[ "func", "(", "r", "*", "MultiCloudImageMatcher", ")", "Locator", "(", "api", "*", "API", ")", "*", "MultiCloudImageMatcherLocator", "{", "for", "_", ",", "l", ":=", "<mask>", "r", ".", "Links", "{", "if", "l", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "return", "api", ".", "MultiCloudImageMatcherLocator", "(", "l", "[", "\"", "\"", "]", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
11,941
all-11942
[ "PushLink", "pushes", "a", "link", "with", "a", "title", "and", "url", "to", "a", "specific", "PushBullet", "device", "." ]
[ "func", "(", "c", "*", "Client", ")", "PushLink", "(", "iden", ",", "title", ",", "u", ",", "body", "string", ")", "error", "{", "data", ":=", "Link", "{", "Iden", ":", "iden", ",", "Type", ":", "\"", "\"", ",", "Title", ":", "<mask>", ",", "URL", ":", "u", ",", "Body", ":", "body", ",", "}", "\n", "return", "c", ".", "Push", "(", "\"", "\"", ",", "data", ")", "\n", "}" ]
11,942
all-11943
[ "Send", "sends", "the", "inline", "query", "answer", ".", "On", "success", "nil", "is", "returned", "." ]
[ "func", "(", "ia", "*", "InlineQueryAnswer", ")", "Send", "(", ")", "error", "{", "resp", ":=", "&", "baseResponse", "{", "}", "\n", "_", ",", "err", ":=", "ia", ".", "api", ".", "c", ".", "postJSON", "(", "answerInlineQuery", ",", "resp", ",", "ia", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "<mask>", "(", "resp", ")", "\n", "}" ]
11,943
all-11944
[ "/", "*", "FromImageUnsafe", "create", "an", "opencv", ".", "IplImage", "that", "shares", "the", "buffer", "with", "the", "go", "image", ".", "RGBA", "image", ".", "All", "changes", "made", "from", "opencv", "might", "affect", "go!" ]
[ "func", "FromImageUnsafe", "(", "img", "*", "<mask>", ".", "RGBA", ")", "*", "IplImage", "{", "b", ":=", "img", ".", "Bounds", "(", ")", "\n", "buf", ":=", "CreateImageHeader", "(", "b", ".", "Max", ".", "X", "-", "b", ".", "Min", ".", "X", ",", "b", ".", "Max", ".", "Y", "-", "b", ".", "Min", ".", "Y", ",", "IPL_DEPTH_8U", ",", "4", ")", "\n", "dst", ":=", "CreateImage", "(", "b", ".", "Max", ".", "X", "-", "b", ".", "Min", ".", "X", ",", "b", ".", "Max", ".", "Y", "-", "b", ".", "Min", ".", "Y", ",", "IPL_DEPTH_8U", ",", "4", ")", "\n\n", "buf", ".", "SetData", "(", "unsafe", ".", "Pointer", "(", "&", "img", ".", "Pix", "[", "0", "]", ")", ",", "CV_AUTOSTEP", ")", "\n", "CvtColor", "(", "buf", ",", "dst", ",", "CV_RGBA2BGRA", ")", "\n", "buf", ".", "Release", "(", ")", "\n\n", "return", "dst", "\n", "}" ]
11,944
all-11945
[ "ClientAfterUncooperativeClose", "changed", "channel", "status", "to", "closed", "uncooperative", "." ]
[ "func", "(", "w", "*", "Worker", ")", "ClientAfterUncooperativeClose", "(", "job", "*", "<mask>", ".", "Job", ")", "error", "{", "logger", ":=", "w", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "job", ")", "\n", "ch", ",", "err", ":=", "w", ".", "relatedChannel", "(", "logger", ",", "job", ",", "data", ".", "JobClientAfterUncooperativeClose", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "logger", "=", "logger", ".", "Add", "(", "\"", "\"", ",", "ch", ")", "\n\n", "ch", ".", "ChannelStatus", "=", "data", ".", "ChannelClosedUncoop", "\n", "if", "err", ":=", "w", ".", "saveRecord", "(", "logger", ",", "w", ".", "db", ".", "Querier", ",", "ch", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "client", ",", "err", ":=", "w", ".", "account", "(", "logger", ",", "ch", ".", "Client", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "w", ".", "addJob", "(", "logger", ",", "nil", ",", "data", ".", "JobAccountUpdateBalances", ",", "data", ".", "JobAccount", ",", "client", ".", "ID", ")", "\n", "}" ]
11,945
all-11946
[ "resolveDir", "resolves", "a", "directory", "with", "a", ":", "port", "list", ".", "Used", "for", "PostgreSQL", "DSNs", "." ]
[ "func", "resolveDir", "(", "path", "string", ")", "(", "string", ",", "string", ",", "string", ")", "{", "dir", ":=", "path", "\n", "for", "dir", "!=", "\"", "\"", "&&", "dir", "!=", "\"", "\"", "&&", "dir", "!=", "\"", "\"", "{", "port", ":=", "\"", "\"", "\n", "i", ",", "j", ":=", "strings", ".", "LastIndex", "(", "dir", ",", "\"", "\"", ")", ",", "strings", ".", "LastIndex", "(", "dir", ",", "\"", "\"", ")", "\n", "if", "i", "!=", "-", "1", "&&", "i", ">", "j", "{", "port", "=", "dir", "[", "i", "+", "1", ":", "]", "\n", "dir", "=", "dir", "[", ":", "i", "]", "\n", "}", "\n\n", "if", "mode", "(", "dir", ")", "&", "os", ".", "ModeDir", "!=", "0", "{", "rest", ":=", "strings", ".", "TrimPrefix", "(", "strings", ".", "TrimPrefix", "(", "strings", ".", "TrimPrefix", "(", "path", ",", "dir", ")", ",", "\"", "\"", "+", "port", ")", ",", "\"", "\"", ")", "\n", "return", "dir", ",", "port", ",", "<mask>", "\n", "}", "\n\n", "if", "j", "!=", "-", "1", "{", "dir", "=", "dir", "[", ":", "j", "]", "\n", "}", "else", "{", "dir", "=", "\"", "\"", "\n", "}", "\n", "}", "\n\n", "return", "path", ",", "\"", "\"", ",", "\"", "\"", "\n", "}" ]
11,946
all-11947
[ "GetHideZeroCounts", "returns", "the", "HideZeroCounts", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "w", "*", "Widget", ")", "GetHideZeroCounts", "(", ")", "bool", "{", "if", "w", "==", "nil", "||", "w", ".", "HideZeroCounts", "==", "nil", "{", "return", "<mask>", "\n", "}", "\n", "return", "*", "w", ".", "HideZeroCounts", "\n", "}" ]
11,947
all-11948
[ "Create", "a", "new", "check", "to", "receive", "metrics" ]
[ "func", "(", "cm", "*", "CheckManager", ")", "createNewCheck", "(", ")", "(", "*", "api", ".", "CheckBundle", ",", "*", "api", ".", "Broker", ",", "error", ")", "{", "checkSecret", ":=", "string", "(", "cm", ".", "checkSecret", ")", "\n", "if", "checkSecret", "==", "\"", "\"", "{", "secret", ",", "err", ":=", "cm", ".", "makeSecret", "(", ")", "\n", "if", "err", "!=", "nil", "{", "secret", "=", "\"", "\"", "\n", "}", "\n", "checkSecret", "=", "secret", "\n", "}", "\n\n", "broker", ",", "err", ":=", "cm", ".", "getBroker", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "chkcfg", ":=", "&", "api", ".", "CheckBundle", "{", "Brokers", ":", "[", "]", "string", "{", "broker", ".", "CID", "}", ",", "Config", ":", "make", "(", "map", "[", "config", ".", "Key", "]", "string", ")", ",", "DisplayName", ":", "string", "(", "cm", ".", "checkDisplayName", ")", ",", "Metrics", ":", "[", "]", "api", ".", "CheckBundleMetric", "{", "}", ",", "MetricLimit", ":", "config", ".", "DefaultCheckBundleMetricLimit", ",", "Notes", ":", "cm", ".", "getNotes", "(", ")", ",", "Period", ":", "60", ",", "Status", ":", "statusActive", ",", "Tags", ":", "<mask>", "(", "cm", ".", "checkSearchTag", ",", "cm", ".", "checkTags", "...", ")", ",", "Target", ":", "string", "(", "cm", ".", "checkTarget", ")", ",", "Timeout", ":", "10", ",", "Type", ":", "string", "(", "cm", ".", "checkType", ")", ",", "}", "\n\n", "if", "len", "(", "cm", ".", "customConfigFields", ")", ">", "0", "{", "for", "fld", ",", "val", ":=", "range", "cm", ".", "customConfigFields", "{", "chkcfg", ".", "Config", "[", "config", ".", "Key", "(", "fld", ")", "]", "=", "val", "\n", "}", "\n", "}", "\n\n", "//", "// use the default config settings if these are NOT set by user configuration", "//", "if", "val", ",", "ok", ":=", "chkcfg", ".", "Config", "[", "config", ".", "AsyncMetrics", "]", ";", "!", "ok", "||", "val", "==", "\"", "\"", "{", "chkcfg", ".", "Config", "[", "config", ".", "AsyncMetrics", "]", "=", "\"", "\"", "\n", "}", "\n\n", "if", "val", ",", "ok", ":=", "chkcfg", ".", "Config", "[", "config", ".", "Secret", "]", ";", "!", "ok", "||", "val", "==", "\"", "\"", "{", "chkcfg", ".", "Config", "[", "config", ".", "Secret", "]", "=", "checkSecret", "\n", "}", "\n\n", "checkBundle", ",", "err", ":=", "cm", ".", "apih", ".", "CreateCheckBundle", "(", "chkcfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "return", "checkBundle", ",", "broker", ",", "nil", "\n", "}" ]
11,948
all-11949
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetInfoReturns", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoSysteminfo3", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
11,949
all-11950
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "RunIfWaitingForDebuggerParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime7", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
11,950
all-11951
[ "AddPortRange", "adds", "a", "list", "of", "ports", "where", "the", "first", "argument", "is", "the", "low", "bound", "(", "inclusive", ")", "on", "the", "range", "and", "the", "second", "argument", "is", "the", "upper", "bound", "(", "exclusive", ")", "E", ".", "x", ".", "AddPortRange", "(", "0", "1025", ")", "adds", "ports", "1", "-", "1024", "to", "the", "list", "TODO", "(", "t94j0", ")", ":", "Make", "into", "actual", "nmap", "ranges", ".", "(", "-", "p1", "-", "1024", ")" ]
[ "func", "(", "s", "Scan", ")", "AddPortRange", "(", "lPort", ",", "hPort", "uint16", ")", "Scan", "{", "for", "i", ":=", "lPort", ";", "i", "<", "hPort", ";", "i", "++", "{", "s", ".", "configPorts", "=", "<mask>", "(", "s", ".", "configPorts", ",", "i", ")", "\n", "}", "\n", "return", "s", "\n", "}" ]
11,951
all-11952
[ "PreCreateCheck", "checks", "that", "the", "machine", "creation", "process", "can", "be", "started", "safely", "." ]
[ "func", "(", "d", "*", "Driver", ")", "PreCreateCheck", "(", ")", "error", "{", "// Check that powershell was found", "if", "powershell", "==", "\"", "\"", "{", "return", "ErrPowerShellNotFound", "\n", "}", "\n\n", "// Check that hyperv is installed", "if", "err", ":=", "hypervAvailable", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Check that the user is an Administrator", "isAdmin", ",", "err", ":=", "isAdministrator", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "!", "isAdmin", "{", "return", "ErrNotAdministrator", "\n", "}", "\n\n", "// Check that there is a virtual switch already configured", "if", "_", ",", "err", ":=", "d", ".", "chooseVirtualSwitch", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Downloading boot2docker to cache should be done here to make sure", "// that a download failure will not leave a machine half created.", "b2dutils", ":=", "mcnutils", ".", "NewB2dUtils", "(", "d", ".", "StorePath", ")", "\n", "err", "=", "b2dutils", ".", "UpdateISOCache", "(", "d", ".", "Boot2DockerURL", ")", "\n", "return", "<mask>", "\n", "}" ]
11,952
all-11953
[ "PrintOperationNew", "()", "is", "a", "wrapper", "around", "gtk_print_operation_new", "()", "." ]
[ "func", "PrintOperationNew", "(", ")", "(", "*", "PrintOperation", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_print_operation_new", "(", ")", "\n", "if", "c", "==", "nil", "{", "<mask>", "nil", ",", "nilPtrErr", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "wrapPrintOperation", "(", "obj", ")", ",", "nil", "\n", "}" ]
11,953
all-11954
[ "KeepAlive", "keeps", "the", "connection", "open", "to", "reuse", "for", "additional", "requests", "." ]
[ "func", "(", "q", "*", "Query", ")", "KeepAlive", "(", ")", "*", "Query", "{", "q", ".", "headers", "=", "append", "(", "q", ".", "<mask>", ",", "\"", "\"", ")", "\n", "q", ".", "keepalive", "=", "true", "\n", "return", "q", "\n", "}" ]
11,954
all-11955
[ "Do", "executes", "LayerTree", ".", "makeSnapshot", "against", "the", "provided", "context", ".", "returns", ":", "snapshotID", "-", "The", "id", "of", "the", "layer", "snapshot", "." ]
[ "func", "(", "p", "*", "MakeSnapshotParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "snapshotID", "SnapshotID", ",", "err", "error", ")", "{", "// execute", "var", "res", "MakeSnapshotReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandMakeSnapshot", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "<mask>", ".", "SnapshotID", ",", "nil", "\n", "}" ]
11,955
all-11956
[ "Return", "an", "index", "type", "of", "the", "form", "map", "[", "string", "]", "map", "[", "string", "]", "...", "<typ", ">", "with", "one", "level", "of", "indexing", "for", "each", "given", "field", "." ]
[ "func", "indexType", "(", "fields", "[", "]", "*", "Field", ",", "typ", "string", ")", "string", "{", "index", ":=", "\"", "\"", "\n", "for", "range", "<mask>", "{", "index", "+=", "\"", "\"", "\n", "}", "\n", "index", "+=", "typ", "\n", "return", "index", "\n", "}" ]
11,956
all-11957
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "DataEntry", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCachestorage9", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
11,957
all-11958
[ "UpdateNodeStatus", "updates", "the", "status", "of", "the", "given", "node", "and", "its", "units", "returning", "a", "map", "which", "units", "were", "found", "during", "the", "update", "." ]
[ "func", "UpdateNodeStatus", "(", "nodeData", "provision", ".", "NodeStatusData", ")", "(", "[", "]", "UpdateUnitsResult", ",", "error", ")", "{", "node", ",", "findNodeErr", ":=", "findNodeForNodeData", "(", "nodeData", ")", "\n", "var", "nodeAddresses", "[", "]", "string", "\n", "if", "findNodeErr", "==", "nil", "{", "nodeAddresses", "=", "[", "]", "string", "{", "node", ".", "Address", "(", ")", "}", "\n", "}", "else", "{", "nodeAddresses", "=", "nodeData", ".", "Addrs", "\n", "}", "\n", "if", "healer", ".", "HealerInstance", "!=", "nil", "{", "err", ":=", "healer", ".", "HealerInstance", ".", "UpdateNodeData", "(", "nodeAddresses", ",", "nodeData", ".", "Checks", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "if", "findNodeErr", "==", "provision", ".", "ErrNodeNotFound", "{", "counterNodesNotFound", ".", "Inc", "(", ")", "\n", "log", ".", "Errorf", "(", "\"", "\"", ",", "nodeData", ")", "\n", "result", ":=", "<mask>", "(", "[", "]", "UpdateUnitsResult", ",", "len", "(", "nodeData", ".", "Units", ")", ")", "\n", "for", "i", ",", "unitData", ":=", "range", "nodeData", ".", "Units", "{", "result", "[", "i", "]", "=", "UpdateUnitsResult", "{", "ID", ":", "unitData", ".", "ID", ",", "Found", ":", "false", "}", "\n", "}", "\n", "return", "result", ",", "nil", "\n", "}", "\n", "if", "findNodeErr", "!=", "nil", "{", "return", "nil", ",", "findNodeErr", "\n", "}", "\n", "unitProv", ",", "ok", ":=", "node", ".", "Provisioner", "(", ")", ".", "(", "provision", ".", "UnitStatusProvisioner", ")", "\n", "if", "!", "ok", "{", "return", "[", "]", "UpdateUnitsResult", "{", "}", ",", "nil", "\n", "}", "\n", "result", ":=", "make", "(", "[", "]", "UpdateUnitsResult", ",", "len", "(", "nodeData", ".", "Units", ")", ")", "\n", "for", "i", ",", "unitData", ":=", "range", "nodeData", ".", "Units", "{", "unit", ":=", "provision", ".", "Unit", "{", "ID", ":", "unitData", ".", "ID", ",", "Name", ":", "unitData", ".", "Name", "}", "\n", "err", ":=", "unitProv", ".", "SetUnitStatus", "(", "unit", ",", "unitData", ".", "Status", ")", "\n", "_", ",", "isNotFound", ":=", "err", ".", "(", "*", "provision", ".", "UnitNotFoundError", ")", "\n", "if", "err", "!=", "nil", "&&", "!", "isNotFound", "{", "return", "nil", ",", "err", "\n", "}", "\n", "result", "[", "i", "]", "=", "UpdateUnitsResult", "{", "ID", ":", "unitData", ".", "ID", ",", "Found", ":", "!", "isNotFound", "}", "\n", "}", "\n", "return", "result", ",", "nil", "\n", "}" ]
11,958
all-11959
[ "Register", "registers", "an", "item", "as", "shutdownable" ]
[ "func", "Register", "(", "s", "Shutdownable", ")", "{", "lock", ".", "Lock", "(", ")", "\n", "defer", "lock", ".", "Unlock", "(", ")", "\n", "registered", "=", "<mask>", "(", "registered", ",", "s", ")", "\n", "}" ]
11,959
all-11960
[ "StoreRecordsForSerial", "associates", "a", "result", "set", "with", "a", "(", "zone", "serial", ")" ]
[ "func", "(", "snap", "*", "ZoneSnapshot", ")", "StoreRecordsForSerial", "(", "zone", "string", ",", "serial", "int", ",", "records", "[", "]", "*", "endpoint", ".", "Endpoint", ")", "{", "snap", ".", "serials", "[", "zone", "]", "=", "<mask>", "\n", "snap", ".", "endpoints", "[", "zone", "]", "=", "records", "\n", "}" ]
11,960
all-11961
[ "LoadConfig", "loads", "the", "client", "configuration", "from", "disk" ]
[ "func", "LoadConfig", "(", "path", "string", ")", "(", "*", "ClientConfig", ",", "error", ")", "{", "content", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "var", "config", "ClientConfig", "\n", "err", "=", "json", ".", "Unmarshal", "(", "<mask>", ",", "&", "config", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "config", ".", "Password", ",", "err", "=", "Decrypt", "(", "config", ".", "Password", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "config", ".", "RefreshToken", ",", "err", "=", "Decrypt", "(", "config", ".", "RefreshToken", ")", "\n", "return", "&", "config", ",", "err", "\n", "}" ]
11,961
all-11962
[ "PublishTo", "sends", "a", "message", "to", "a", "specific", "topic", "using", "the", "producer", "p", "returning", "an", "error", "if", "it", "was", "already", "closed", "or", "if", "an", "error", "occurred", "while", "publishing", "the", "message", ".", "Note", "that", "no", "retry", "is", "done", "internally", "the", "producer", "will", "fail", "after", "the", "first", "unsuccessful", "attempt", "to", "publish", "the", "message", ".", "It", "is", "the", "responsibility", "of", "the", "caller", "to", "retry", "if", "necessary", "." ]
[ "func", "(", "p", "*", "Producer", ")", "PublishTo", "(", "topic", "string", ",", "<mask>", "[", "]", "byte", ")", "(", "err", "error", ")", "{", "defer", "func", "(", ")", "{", "if", "recover", "(", ")", "!=", "nil", "{", "err", "=", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "(", ")", "\n\n", "if", "len", "(", "topic", ")", "==", "0", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "response", ":=", "make", "(", "chan", "error", ",", "1", ")", "\n", "deadline", ":=", "time", ".", "Now", "(", ")", ".", "Add", "(", "p", ".", "dialTimeout", "+", "p", ".", "readTimeout", "+", "p", ".", "writeTimeout", ")", "\n\n", "// Attempts to queue the request so one of the active connections can pick", "// it up.", "p", ".", "reqs", "<-", "ProducerRequest", "{", "Topic", ":", "topic", ",", "Message", ":", "message", ",", "Response", ":", "response", ",", "Deadline", ":", "deadline", ",", "}", "\n\n", "// This will always trigger, either if the connection was lost or if a", "// response was successfully sent.", "err", "=", "<-", "response", "\n", "return", "\n", "}" ]
11,962
all-11963
[ "OperationNodes", "returns", "a", "list", "of", "nodes", "that", "have", "running", "operations" ]
[ "func", "(", "c", "*", "ClusterTx", ")", "OperationNodes", "(", "project", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "stmt", ":=", "`\nSELECT DISTINCT nodes.address\n FROM operations\n LEFT OUTER JOIN projects ON projects.id = operations.project_id\n JOIN nodes ON nodes.id = operations.node_id\n WHERE projects.name = ? OR operations.project_id IS NULL\n`", "\n", "return", "query", ".", "SelectStrings", "(", "c", ".", "tx", ",", "stmt", ",", "<mask>", ")", "\n", "}" ]
11,963
all-11964
[ "Peek", "returns", "the", "entry", "at", "the", "top", "of", "the", "Stack", "without", "removing", "it", "." ]
[ "func", "(", "stack", "*", "Stack", ")", "Peek", "(", ")", "(", "<mask>", "{", "}", ",", "bool", ")", "{", "stack", ".", "key", ".", "RLock", "(", ")", "\n", "defer", "stack", ".", "key", ".", "RUnlock", "(", ")", "\n", "return", "stack", ".", "underlyer", ".", "PeekFront", "(", ")", "\n", "}" ]
11,964
all-11965
[ "String", "returns", "the", "name", "of", "e" ]
[ "func", "(", "e", "AssetType", ")", "String", "(", ")", "string", "{", "name", ",", "_", ":=", "assetTypeMap", "[", "int32", "(", "e", ")", "]", "\n", "return", "<mask>", "\n", "}" ]
11,965
all-11966
[ "NewProwJob", "initializes", "a", "ProwJob", "out", "of", "a", "ProwJobSpec", "." ]
[ "func", "NewProwJob", "(", "spec", "prowapi", ".", "ProwJobSpec", ",", "labels", "<mask>", "[", "string", "]", "string", ")", "prowapi", ".", "ProwJob", "{", "return", "newProwJob", "(", "spec", ",", "labels", ",", "nil", ")", "\n", "}" ]
11,966
all-11967
[ "define", "an", "array", "of", "colors" ]
[ "func", "ColorPointer", "(", "size", "int32", ",", "xtype", "uint32", ",", "stride", "int32", ",", "pointer", "unsafe", ".", "Pointer", ")", "{", "syscall", ".", "Syscall6", "(", "gpColorPointer", ",", "4", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "xtype", ")", ",", "uintptr", "(", "stride", ")", ",", "uintptr", "(", "pointer", ")", ",", "0", ",", "0", ")", "\n", "}" ]
11,967
all-11968
[ "Returns", "the", "terminal", "size" ]
[ "func", "Size", "(", ")", "(", "w", ",", "h", "int", ",", "err", "error", ")", "{", "if", "!", "IsInit", "{", "err", "=", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n\n", "return", "get_size", "(", ")", "\n", "}" ]
11,968
all-11969
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SearchInResponseBodyParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork21", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
11,969
all-11970
[ "validateVirtualMachineFolder", "checks", "to", "make", "sure", "the", "folder", "is", "a", "VM", "folder", "and", "returns", "it", "if", "it", "is", "or", "an", "error", "if", "it", "isn", "t", "." ]
[ "func", "validateVirtualMachineFolder", "(", "folder", "*", "object", ".", "Folder", ")", "(", "*", "object", ".", "Folder", ",", "error", ")", "{", "ft", ",", "err", ":=", "FindType", "(", "folder", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "ft", "!=", "VSphereFolderTypeVM", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "folder", ".", "InventoryPath", ")", "\n", "}", "\n", "<mask>", ".", "Printf", "(", "\"", "\"", ",", "folder", ".", "InventoryPath", ")", "\n", "return", "folder", ",", "nil", "\n", "}" ]
11,970
all-11971
[ "NewStringCmdSetForRunners", "creates", "a", "new", "StringCmdSet", "from", "the", "provided", "cmds", "(", "all", "of", "which", "must", "be", "non", "-", "nil", ")", ".", "Returns", "an", "error", "if", "any", "of", "the", "provided", "commands", "have", "the", "same", "name", "." ]
[ "func", "NewStringCmdSetForRunners", "(", "cmds", "...", "*", "CmdWithRunner", ")", "(", "StringCmdSet", ",", "error", ")", "{", "seenCmdNames", ":=", "make", "(", "map", "[", "string", "]", "bool", ")", "\n", "var", "duplicates", "[", "]", "string", "\n", "duplicatesSet", ":=", "make", "(", "map", "[", "string", "]", "bool", ")", "\n", "for", "_", ",", "cmd", ":=", "<mask>", "cmds", "{", "cmdName", ":=", "cmd", ".", "cmdName", "\n", "if", "seenCmdNames", "[", "cmdName", "]", "{", "if", "!", "duplicatesSet", "[", "cmdName", "]", "{", "duplicates", "=", "append", "(", "duplicates", ",", "cmdName", ")", "\n", "}", "\n", "duplicatesSet", "[", "cmdName", "]", "=", "true", "\n", "}", "\n", "seenCmdNames", "[", "cmdName", "]", "=", "true", "\n", "}", "\n", "if", "len", "(", "duplicates", ")", ">", "0", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "duplicates", ")", "\n", "}", "\n", "return", "cmdWithRunnerCmdSet", "(", "cmds", ")", ",", "nil", "\n", "}" ]
11,971
all-11972
[ "GetHashType", "returns", "the", "hash", "type", "(", "md5", "sha1", "sha256", "sha512", ")" ]
[ "func", "GetHashType", "(", "hash", "string", ")", "(", "string", ",", "error", ")", "{", "var", "validMD5", "=", "regexp", ".", "MustCompile", "(", "`^[a-fA-F\\d]{32}$`", ")", "\n", "var", "validSHA1", "=", "regexp", ".", "MustCompile", "(", "`^[a-fA-F\\d]{40}$`", ")", "\n", "var", "validSHA256", "=", "regexp", ".", "MustCompile", "(", "`^[a-fA-F\\d]{64}$`", ")", "\n", "var", "validSHA512", "=", "regexp", ".", "MustCompile", "(", "`^[a-fA-F\\d]{128}$`", ")", "\n\n", "switch", "{", "case", "validMD5", ".", "MatchString", "(", "hash", ")", ":", "return", "\"", "\"", ",", "nil", "\n", "case", "validSHA1", ".", "MatchString", "(", "hash", ")", ":", "return", "\"", "\"", ",", "nil", "\n", "case", "validSHA256", ".", "MatchString", "(", "hash", ")", ":", "return", "\"", "\"", ",", "nil", "\n", "case", "validSHA512", ".", "MatchString", "(", "hash", ")", ":", "return", "\"", "\"", ",", "nil", "\n", "<mask>", ":", "return", "\"", "\"", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}" ]
11,972
all-11973
[ "Leave", "waits", "for", "count", "processes", "to", "leave", "the", "barrier", "then", "returns" ]
[ "func", "(", "b", "*", "DoubleBarrier", ")", "Leave", "(", ")", "error", "{", "client", ":=", "b", ".", "s", ".", "Client", "(", ")", "\n", "resp", ",", "err", ":=", "client", ".", "Get", "(", "b", ".", "ctx", ",", "b", ".", "key", "+", "\"", "\"", ",", "clientv3", ".", "WithPrefix", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "len", "(", "resp", ".", "Kvs", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "lowest", ",", "highest", ":=", "resp", ".", "Kvs", "[", "0", "]", ",", "resp", ".", "Kvs", "[", "0", "]", "\n", "for", "_", ",", "k", ":=", "range", "resp", ".", "Kvs", "{", "if", "k", ".", "ModRevision", "<", "lowest", ".", "ModRevision", "{", "lowest", "=", "k", "\n", "}", "\n", "if", "k", ".", "ModRevision", ">", "highest", ".", "ModRevision", "{", "highest", "=", "k", "\n", "}", "\n", "}", "\n", "isLowest", ":=", "string", "(", "lowest", ".", "<mask>", ")", "==", "b", ".", "myKey", ".", "Key", "(", ")", "\n\n", "if", "len", "(", "resp", ".", "Kvs", ")", "==", "1", "{", "// this is the only node in the barrier; finish up", "if", "_", ",", "err", "=", "client", ".", "Delete", "(", "b", ".", "ctx", ",", "b", ".", "key", "+", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "b", ".", "myKey", ".", "Delete", "(", ")", "\n", "}", "\n\n", "// this ensures that if a process fails, the ephemeral lease will be", "// revoked, its barrier key is removed, and the barrier can resume", "// lowest process in node => wait on highest process", "if", "isLowest", "{", "_", ",", "err", "=", "WaitEvents", "(", "client", ",", "string", "(", "highest", ".", "Key", ")", ",", "highest", ".", "ModRevision", ",", "[", "]", "mvccpb", ".", "Event_EventType", "{", "mvccpb", ".", "DELETE", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "b", ".", "Leave", "(", ")", "\n", "}", "\n\n", "// delete self and wait on lowest process", "if", "err", "=", "b", ".", "myKey", ".", "Delete", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "key", ":=", "string", "(", "lowest", ".", "Key", ")", "\n", "_", ",", "err", "=", "WaitEvents", "(", "client", ",", "key", ",", "lowest", ".", "ModRevision", ",", "[", "]", "mvccpb", ".", "Event_EventType", "{", "mvccpb", ".", "DELETE", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "b", ".", "Leave", "(", ")", "\n", "}" ]
11,973
all-11974
[ "Make", "a", "request", "with", "retries", ".", "If", "ret", "is", "not", "nil", "unmarshal", "the", "response", "body", "into", "it", ".", "Returns", "an", "error", "if", "the", "exit", "code", "is", "not", "one", "of", "the", "provided", "codes", "." ]
[ "func", "(", "c", "*", "Client", ")", "request", "(", "r", "*", "request", ",", "ret", "interface", "{", "}", ")", "(", "int", ",", "error", ")", "{", "statusCode", ",", "b", ",", "err", ":=", "c", ".", "requestRaw", "(", "r", ")", "\n", "if", "err", "!=", "nil", "{", "return", "statusCode", ",", "err", "\n", "}", "\n", "if", "<mask>", "!=", "nil", "{", "if", "err", ":=", "json", ".", "Unmarshal", "(", "b", ",", "ret", ")", ";", "err", "!=", "nil", "{", "return", "statusCode", ",", "err", "\n", "}", "\n", "}", "\n", "return", "statusCode", ",", "nil", "\n", "}" ]
11,974
all-11975
[ "SlaveAddrs", "returns", "a", "slice", "with", "known", "slave", "addresses", "of", "current", "master", "instance", "." ]
[ "func", "(", "s", "*", "Sentinel", ")", "SlaveAddrs", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "res", ",", "err", ":=", "s", ".", "doUntilSuccess", "(", "func", "(", "c", "redis", ".", "Conn", ")", "(", "<mask>", "{", "}", ",", "error", ")", "{", "return", "queryForSlaveAddrs", "(", "c", ",", "s", ".", "MasterName", ")", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "res", ".", "(", "[", "]", "string", ")", ",", "nil", "\n", "}" ]
11,975
all-11976
[ "Unsubscribe", "removes", "callback", "defined", "for", "a", "topic", ".", "Returns", "error", "if", "there", "are", "no", "callbacks", "subscribed", "to", "the", "topic", "." ]
[ "func", "(", "bus", "*", "EventBus", ")", "Unsubscribe", "(", "topic", "string", ",", "handler", "interface", "{", "}", ")", "error", "{", "bus", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "bus", ".", "lock", ".", "Unlock", "(", ")", "\n", "if", "_", ",", "ok", ":=", "bus", ".", "handlers", "[", "topic", "]", ";", "ok", "&&", "len", "(", "bus", ".", "handlers", "[", "<mask>", "]", ")", ">", "0", "{", "bus", ".", "removeHandler", "(", "topic", ",", "bus", ".", "findHandlerIdx", "(", "topic", ",", "reflect", ".", "ValueOf", "(", "handler", ")", ")", ")", "\n", "return", "nil", "\n", "}", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "topic", ")", "\n", "}" ]
11,976
all-11977
[ "SetDomain", "sets", "cookie", "domain", "." ]
[ "func", "(", "c", "*", "Cookie", ")", "SetDomain", "(", "domain", "string", ")", "{", "c", ".", "domain", "=", "<mask>", "(", "c", ".", "domain", "[", ":", "0", "]", ",", "domain", "...", ")", "\n", "}" ]
11,977
all-11978
[ "Insert", "a", "new", "version", "into", "the", "schema", "table", "." ]
[ "func", "insertSchemaVersion", "(", "tx", "*", "sql", ".", "Tx", ",", "new", "int", ")", "error", "{", "<mask>", ":=", "`\nINSERT INTO schema (version, updated_at) VALUES (?, strftime(\"%s\"))\n`", "\n", "_", ",", "err", ":=", "tx", ".", "Exec", "(", "statement", ",", "new", ")", "\n", "return", "err", "\n", "}" ]
11,978
all-11979
[ "ProjectRename", "renames", "the", "project", "matching", "the", "given", "key", "parameters", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "ProjectRename", "(", "name", "string", ",", "to", "string", ")", "error", "{", "stmt", ":=", "c", ".", "stmt", "(", "projectRename", ")", "\n", "result", ",", "err", ":=", "stmt", ".", "Exec", "(", "to", ",", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "<mask>", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "n", ",", "err", ":=", "result", ".", "RowsAffected", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "n", "!=", "1", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "n", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
11,979
all-11980
[ "Helper", "function" ]
[ "func", "(", "p", "*", "RcodeZeroProvider", ")", "fetchRecords", "(", "zoneName", "string", ")", "(", "[", "]", "*", "rc0", ".", "RRType", ",", "error", ")", "{", "var", "allRecords", "[", "]", "*", "rc0", ".", "RRType", "\n\n", "listOptions", ":=", "rc0", ".", "NewListOptions", "(", ")", "\n\n", "for", "{", "records", ",", "<mask>", ",", "err", ":=", "p", ".", "Client", ".", "RRSet", ".", "List", "(", "zoneName", ",", "listOptions", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "allRecords", "=", "append", "(", "allRecords", ",", "records", "...", ")", "\n\n", "if", "page", "==", "nil", "||", "(", "page", ".", "CurrentPage", "==", "page", ".", "LastPage", ")", "{", "break", "\n", "}", "\n\n", "listOptions", ".", "SetPageNumber", "(", "page", ".", "CurrentPage", "+", "1", ")", "\n", "}", "\n\n", "return", "allRecords", ",", "nil", "\n", "}" ]
11,980
all-11981
[ "Copy", "returns", "a", "deep", "copy", "of", "this", "configuration", "." ]
[ "func", "(", "c", "*", "TransportConfig", ")", "Copy", "(", ")", "*", "TransportConfig", "{", "if", "c", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "<mask>", "o", "TransportConfig", "\n\n", "o", ".", "DialKeepAlive", "=", "c", ".", "DialKeepAlive", "\n", "o", ".", "DialTimeout", "=", "c", ".", "DialTimeout", "\n", "o", ".", "DisableKeepAlives", "=", "c", ".", "DisableKeepAlives", "\n", "o", ".", "IdleConnTimeout", "=", "c", ".", "IdleConnTimeout", "\n", "o", ".", "MaxIdleConns", "=", "c", ".", "MaxIdleConns", "\n", "o", ".", "MaxIdleConnsPerHost", "=", "c", ".", "MaxIdleConnsPerHost", "\n", "o", ".", "TLSHandshakeTimeout", "=", "c", ".", "TLSHandshakeTimeout", "\n\n", "return", "&", "o", "\n", "}" ]
11,981
all-11982
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventCompilationCacheProduced", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage69", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
11,982
all-11983
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetIgnoreInputEventsParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoInput4", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
11,983
all-11984
[ "Resize", "allows", "dynamic", "resizing", "of", "the", "semaphore", "it", "can", "be", "used", "if", "it", "desired", "to", "increase", "the", "current", "number", "of", "allowable", "concurent", "processes", "." ]
[ "func", "(", "t", "*", "Semaphore", ")", "Resize", "(", "capacity", "int", ")", "{", "// only allow one resize to be called from one thread", "t", ".", "resizeMutex", ".", "Lock", "(", ")", "\n\n", "if", "capacity", "==", "cap", "(", "t", ".", "s", ")", "{", "t", ".", "resizeMutex", ".", "Unlock", "(", ")", "\n", "return", "\n", "}", "\n\n", "// lock the locks", "t", ".", "resizeLock", "(", ")", "\n", "t", ".", "readMutex", ".", "Lock", "(", ")", "\n", "defer", "t", ".", "resizeUnlock", "(", ")", "\n", "defer", "t", ".", "resizeMutex", ".", "Unlock", "(", ")", "\n", "defer", "t", ".", "readMutex", ".", "Unlock", "(", ")", "\n\n", "new", ":=", "make", "(", "chan", "struct", "{", "}", ",", "<mask>", ")", "// create the new semaphore with the new capcity", "\n\n", "// copy the old values", "for", "n", ":=", "len", "(", "t", ".", "s", ")", ";", "n", "!=", "0", ";", "n", "=", "len", "(", "t", ".", "s", ")", "{", "new", "<-", "<-", "t", ".", "s", "// copy elements to the new channel", "\n", "}", "\n\n", "t", ".", "s", "=", "new", "\n", "}" ]
11,984
all-11985
[ "StorageVolumeNextSnapshot", "returns", "the", "index", "the", "next", "snapshot", "of", "the", "storage", "volume", "with", "the", "given", "name", "should", "have", ".", "Note", "the", "code", "below", "doesn", "t", "deal", "with", "snapshots", "of", "snapshots", ".", "To", "do", "that", "we", "ll", "need", "to", "weed", "out", "based", "on", "#", "slashes", "in", "names" ]
[ "func", "(", "c", "*", "Cluster", ")", "StorageVolumeNextSnapshot", "(", "name", "string", ",", "typ", "int", ")", "int", "{", "base", ":=", "name", "+", "shared", ".", "SnapshotDelimiter", "+", "\"", "\"", "\n", "length", ":=", "len", "(", "base", ")", "\n", "q", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ")", "\n", "var", "numstr", "string", "\n", "inargs", ":=", "[", "]", "interface", "{", "}", "{", "typ", ",", "true", ",", "length", ",", "base", "}", "\n", "outfmt", ":=", "[", "]", "interface", "{", "}", "{", "numstr", "}", "\n", "results", ",", "err", ":=", "queryScan", "(", "c", ".", "<mask>", ",", "q", ",", "inargs", ",", "outfmt", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", "\n", "}", "\n", "max", ":=", "0", "\n\n", "for", "_", ",", "r", ":=", "range", "results", "{", "numstr", "=", "r", "[", "0", "]", ".", "(", "string", ")", "\n", "if", "len", "(", "numstr", ")", "<=", "length", "{", "continue", "\n", "}", "\n", "substr", ":=", "numstr", "[", "length", ":", "]", "\n", "var", "num", "int", "\n", "count", ",", "err", ":=", "fmt", ".", "Sscanf", "(", "substr", ",", "\"", "\"", ",", "&", "num", ")", "\n", "if", "err", "!=", "nil", "||", "count", "!=", "1", "{", "continue", "\n", "}", "\n", "if", "num", ">=", "max", "{", "max", "=", "num", "+", "1", "\n", "}", "\n", "}", "\n\n", "return", "max", "\n", "}" ]
11,985
all-11986
[ "Markdown", "converts", "the", "string", "into", "HTML", "using", "GitHub", "flavored", "markdown", "." ]
[ "func", "MarkdownHelper", "(", "body", "string", ",", "help", "HelperContext", ")", "(", "template", ".", "HTML", ",", "error", ")", "{", "var", "err", "error", "\n", "if", "help", ".", "HasBlock", "(", ")", "{", "body", ",", "err", "=", "help", ".", "Block", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "}", "\n", "b", ":=", "github_flavored_markdown", ".", "Markdown", "(", "[", "]", "byte", "(", "<mask>", ")", ")", "\n", "return", "template", ".", "HTML", "(", "b", ")", ",", "err", "\n", "}" ]
11,986
all-11987
[ "Execute", "-", "deletes", "spaces" ]
[ "func", "(", "c", "*", "DeleteSpacesCommand", ")", "Execute", "(", "[", "]", "string", ")", "error", "{", "<mask>", "cfMgmt", "*", "CFMgmt", "\n", "var", "err", "error", "\n", "if", "cfMgmt", ",", "err", "=", "InitializePeekManagers", "(", "c", ".", "BaseCFConfigCommand", ",", "c", ".", "Peek", ")", ";", "err", "==", "nil", "{", "err", "=", "cfMgmt", ".", "SpaceManager", ".", "DeleteSpaces", "(", ")", "\n", "}", "\n", "return", "err", "\n", "}" ]
11,987
all-11988
[ "===", "idelta", "(", "node", "model", ".", "ValMatric", ")", "Vector", "===" ]
[ "func", "funcIdelta", "(", "vals", "[", "]", "Value", ",", "args", "Expressions", ",", "enh", "*", "EvalNodeHelper", ")", "Vector", "{", "return", "instantValue", "(", "vals", ",", "enh", ".", "out", ",", "<mask>", ")", "\n", "}" ]
11,988
all-11989
[ "GetMetadataAll", "gets", "a", "map", "that", "contains", "all", "metadata", "of", "the", "object", "." ]
[ "func", "(", "o", "*", "Object", ")", "GetMetadataAll", "(", "attr", "bool", ")", "map", "[", "string", "]", "string", "{", "metadataAll", ":=", "<mask>", "(", "map", "[", "string", "]", "string", ")", "\n", "for", "k", ",", "v", ":=", "range", "o", ".", "Metadata", "{", "metadataAll", "[", "k", "]", "=", "v", ".", "value", "\n", "}", "\n", "return", "metadataAll", "\n", "}" ]
11,989
all-11990
[ "DiskApplyOperation", "processes", "an", "apply", "operation", "for", "all", "disks", "in", "the", "resource", ".", "The", "function", "takes", "the", "root", "resource", "s", "ResourceData", "the", "provider", "connection", "and", "the", "device", "list", "as", "known", "to", "vSphere", "at", "the", "start", "of", "this", "operation", ".", "All", "disk", "operations", "are", "carried", "out", "with", "both", "the", "complete", "updated", "VirtualDeviceList", "and", "the", "complete", "list", "of", "changes", "returned", "as", "a", "slice", "of", "BaseVirtualDeviceConfigSpec", "." ]
[ "func", "DiskApplyOperation", "(", "d", "*", "schema", ".", "ResourceData", ",", "c", "*", "govmomi", ".", "Client", ",", "l", "object", ".", "VirtualDeviceList", ")", "(", "object", ".", "VirtualDeviceList", ",", "[", "]", "types", ".", "BaseVirtualDeviceConfigSpec", ",", "error", ")", "{", "log", ".", "Printf", "(", "\"", "\"", ")", "\n", "o", ",", "n", ":=", "d", ".", "GetChange", "(", "subresourceTypeDisk", ")", "\n", "ods", ":=", "o", ".", "(", "[", "]", "interface", "{", "}", ")", "\n", "nds", ":=", "n", ".", "(", "[", "]", "interface", "{", "}", ")", "\n\n", "var", "spec", "[", "]", "types", ".", "BaseVirtualDeviceConfigSpec", "\n\n", "// Our old and new sets now have an accurate description of devices that may", "// have been added, removed, or changed. Look for removed devices first.", "log", ".", "Printf", "(", "\"", "\"", ")", "\n", "for", "oi", ",", "oe", ":=", "range", "ods", "{", "om", ":=", "oe", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "if", "err", ":=", "diskApplyOperationDelete", "(", "oi", ",", "om", ",", "nds", ",", "c", ",", "d", ",", "&", "l", ",", "&", "spec", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "// Now check for creates and updates. The results of this operation are", "// committed to state after the operation completes, on top of the items that", "// have not changed.", "var", "updates", "[", "]", "interface", "{", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ")", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "subresourceListString", "(", "updates", ")", ")", "\n", "for", "ni", ",", "ne", ":=", "<mask>", "nds", "{", "nm", ":=", "ne", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "if", "err", ":=", "diskApplyOperationCreateUpdate", "(", "ni", ",", "nm", ",", "ods", ",", "c", ",", "d", ",", "&", "l", ",", "&", "spec", ",", "&", "updates", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "log", ".", "Printf", "(", "\"", "\"", ",", "subresourceListString", "(", "updates", ")", ")", "\n", "// We are now done! Return the updated device list and config spec. Save updates as well.", "if", "err", ":=", "d", ".", "Set", "(", "subresourceTypeDisk", ",", "updates", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "DeviceListString", "(", "l", ")", ")", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "DeviceChangeString", "(", "spec", ")", ")", "\n", "log", ".", "Printf", "(", "\"", "\"", ")", "\n", "return", "l", ",", "spec", ",", "nil", "\n", "}" ]
11,990
all-11991
[ "NewServer", "returns", "a", "new", "RBAC", "server", "instance", "." ]
[ "func", "NewServer", "(", "apiURL", "string", ",", "apiKey", "string", ",", "agentAuthURL", "string", ",", "agentUsername", "string", ",", "agentPrivateKey", "string", ",", "agentPublicKey", "string", ")", "(", "*", "Server", ",", "error", ")", "{", "r", ":=", "Server", "{", "apiURL", ":", "apiURL", ",", "apiKey", ":", "apiKey", ",", "lastSyncID", ":", "\"", "\"", ",", "lastChange", ":", "time", ".", "Time", "{", "}", ",", "resources", ":", "make", "(", "map", "[", "string", "]", "string", ")", ",", "permissions", ":", "make", "(", "map", "[", "string", "]", "map", "[", "string", "]", "[", "]", "string", ")", ",", "permissionsLock", ":", "&", "sync", ".", "Mutex", "{", "}", ",", "}", "\n\n", "//", "var", "keyPair", "bakery", ".", "KeyPair", "\n", "keyPair", ".", "Private", ".", "UnmarshalText", "(", "[", "]", "byte", "(", "agentPrivateKey", ")", ")", "\n", "keyPair", ".", "Public", ".", "UnmarshalText", "(", "[", "]", "byte", "(", "agentPublicKey", ")", ")", "\n\n", "r", ".", "<mask>", "=", "httpbakery", ".", "NewClient", "(", ")", "\n", "authInfo", ":=", "agent", ".", "AuthInfo", "{", "Key", ":", "&", "keyPair", ",", "Agents", ":", "[", "]", "agent", ".", "Agent", "{", "{", "URL", ":", "agentAuthURL", ",", "Username", ":", "agentUsername", ",", "}", ",", "}", ",", "}", "\n\n", "err", ":=", "agent", ".", "SetUpAuth", "(", "r", ".", "client", ",", "&", "authInfo", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "r", ".", "client", ".", "Client", ".", "Jar", ",", "err", "=", "cookiejar", ".", "New", "(", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "r", ",", "nil", "\n", "}" ]
11,991
all-11992
[ "UpdateTouchesOnIOS", "updates", "the", "touch", "state", "on", "iOS", ".", "This", "should", "be", "called", "with", "touch", "handlers", "of", "UIViewController", "like", "this", ":", "-", "(", "GLKView", "*", ")", "glkView", "{", "return", "(", "GLKView", "*", ")", "[", "self", ".", "view", "viewWithTag", ":", "100", "]", ";", "}", "-", "(", "void", ")", "updateTouches", ":", "(", "NSSet", "*", ")", "touches", "{", "for", "(", "UITouch", "*", "touch", "in", "touches", ")", "{", "if", "(", "touch", ".", "view", "!", "=", "[", "self", "glkView", "]", ")", "{", "continue", ";", "}", "CGPoint", "location", "=", "[", "touch", "locationInView", ":", "[", "self", "glkView", "]]", ";", "//", "Exported", "function", "for", "UpdateTouchesOnIOS", "YourGameUpdateTouchesOnIOS", "(", "touch", ".", "phase", "(", "int64_t", ")", "touch", "location", ".", "x", "location", ".", "y", ")", ";", "}", "}", "-", "(", "void", ")", "touchesBegan", ":", "(", "NSSet", "*", ")", "touches", "withEvent", ":", "(", "UIEvent", "*", ")", "event", "{", "[", "self", "updateTouches", ":", "touches", "]", ";", "}", "-", "(", "void", ")", "touchesMoved", ":", "(", "NSSet", "*", ")", "touches", "withEvent", ":", "(", "UIEvent", "*", ")", "event", "{", "[", "self", "updateTouches", ":", "touches", "]", ";", "}", "-", "(", "void", ")", "touchesEnded", ":", "(", "NSSet", "*", ")", "touches", "withEvent", ":", "(", "UIEvent", "*", ")", "event", "{", "[", "self", "updateTouches", ":", "touches", "]", ";", "}", "-", "(", "void", ")", "touchesCancelled", ":", "(", "NSSet", "*", ")", "touches", "withEvent", ":", "(", "UIEvent", "*", ")", "event", "{", "[", "self", "updateTouches", ":", "touches", "]", ";", "}", "The", "coodinate", "x", "/", "y", "is", "in", "point", ".", "UpdateTouchesOnIOS", "can", "be", "called", "even", "before", "Start", "is", "called", ".", "UpdateTouchesOnIOS", "is", "concurrent", "-", "safe", ".", "For", "more", "details", "see", "https", ":", "//", "github", ".", "com", "/", "hajimehoshi", "/", "ebiten", "/", "wiki", "/", "iOS", "." ]
[ "func", "UpdateTouchesOnIOS", "(", "<mask>", "int", ",", "ptr", "int64", ",", "x", ",", "y", "int", ")", "{", "mobileMutex", ".", "Lock", "(", ")", "\n", "defer", "mobileMutex", ".", "Unlock", "(", ")", "\n\n", "updateTouchesOnIOSImpl", "(", "phase", ",", "ptr", ",", "x", ",", "y", ")", "\n", "}" ]
11,992
all-11993
[ "rangeIndexed", "emits", "to", "fn", "the", "header", "for", "an", "integer", "-", "indexed", "loop", "over", "array", "*", "array", "or", "slice", "value", "x", ".", "The", "v", "result", "is", "defined", "only", "if", "tv", "is", "non", "-", "nil", ".", "forPos", "is", "the", "position", "of", "the", "for", "token", "." ]
[ "func", "(", "b", "*", "builder", ")", "rangeIndexed", "(", "fn", "*", "Function", ",", "x", "Value", ",", "tv", "types", ".", "Type", ",", "pos", "token", ".", "Pos", ")", "(", "k", ",", "v", "Value", ",", "loop", ",", "done", "*", "BasicBlock", ")", "{", "//", "// length = len(x)", "// index = -1", "// loop: (target of continue)", "// index++", "// \tif index < length goto body else done", "// body:", "// k = index", "// v = x[index]", "// ...body...", "// \tjump loop", "// done: (target of break)", "// Determine number of iterations.", "var", "length", "Value", "\n", "if", "arr", ",", "ok", ":=", "deref", "(", "x", ".", "Type", "(", ")", ")", ".", "Underlying", "(", ")", ".", "(", "*", "types", ".", "<mask>", ")", ";", "ok", "{", "// For array or *array, the number of iterations is", "// known statically thanks to the type. We avoid a", "// data dependence upon x, permitting later dead-code", "// elimination if x is pure, static unrolling, etc.", "// Ranging over a nil *array may have >0 iterations.", "// We still generate code for x, in case it has effects.", "length", "=", "intConst", "(", "arr", ".", "Len", "(", ")", ")", "\n", "}", "else", "{", "// length = len(x).", "var", "c", "Call", "\n", "c", ".", "Call", ".", "Value", "=", "makeLen", "(", "x", ".", "Type", "(", ")", ")", "\n", "c", ".", "Call", ".", "Args", "=", "[", "]", "Value", "{", "x", "}", "\n", "c", ".", "setType", "(", "tInt", ")", "\n", "length", "=", "fn", ".", "emit", "(", "&", "c", ")", "\n", "}", "\n\n", "index", ":=", "fn", ".", "addLocal", "(", "tInt", ",", "token", ".", "NoPos", ")", "\n", "emitStore", "(", "fn", ",", "index", ",", "intConst", "(", "-", "1", ")", ",", "pos", ")", "\n\n", "loop", "=", "fn", ".", "newBasicBlock", "(", "\"", "\"", ")", "\n", "emitJump", "(", "fn", ",", "loop", ")", "\n", "fn", ".", "currentBlock", "=", "loop", "\n\n", "incr", ":=", "&", "BinOp", "{", "Op", ":", "token", ".", "ADD", ",", "X", ":", "emitLoad", "(", "fn", ",", "index", ")", ",", "Y", ":", "vOne", ",", "}", "\n", "incr", ".", "setType", "(", "tInt", ")", "\n", "emitStore", "(", "fn", ",", "index", ",", "fn", ".", "emit", "(", "incr", ")", ",", "pos", ")", "\n\n", "body", ":=", "fn", ".", "newBasicBlock", "(", "\"", "\"", ")", "\n", "done", "=", "fn", ".", "newBasicBlock", "(", "\"", "\"", ")", "\n", "emitIf", "(", "fn", ",", "emitCompare", "(", "fn", ",", "token", ".", "LSS", ",", "incr", ",", "length", ",", "token", ".", "NoPos", ")", ",", "body", ",", "done", ")", "\n", "fn", ".", "currentBlock", "=", "body", "\n\n", "k", "=", "emitLoad", "(", "fn", ",", "index", ")", "\n", "if", "tv", "!=", "nil", "{", "switch", "t", ":=", "x", ".", "Type", "(", ")", ".", "Underlying", "(", ")", ".", "(", "type", ")", "{", "case", "*", "types", ".", "Array", ":", "instr", ":=", "&", "Index", "{", "X", ":", "x", ",", "Index", ":", "k", ",", "}", "\n", "instr", ".", "setType", "(", "t", ".", "Elem", "(", ")", ")", "\n", "v", "=", "fn", ".", "emit", "(", "instr", ")", "\n\n", "case", "*", "types", ".", "Pointer", ":", "// *array", "instr", ":=", "&", "IndexAddr", "{", "X", ":", "x", ",", "Index", ":", "k", ",", "}", "\n", "instr", ".", "setType", "(", "types", ".", "NewPointer", "(", "t", ".", "Elem", "(", ")", ".", "Underlying", "(", ")", ".", "(", "*", "types", ".", "Array", ")", ".", "Elem", "(", ")", ")", ")", "\n", "v", "=", "emitLoad", "(", "fn", ",", "fn", ".", "emit", "(", "instr", ")", ")", "\n\n", "case", "*", "types", ".", "Slice", ":", "instr", ":=", "&", "IndexAddr", "{", "X", ":", "x", ",", "Index", ":", "k", ",", "}", "\n", "instr", ".", "setType", "(", "types", ".", "NewPointer", "(", "t", ".", "Elem", "(", ")", ")", ")", "\n", "v", "=", "emitLoad", "(", "fn", ",", "fn", ".", "emit", "(", "instr", ")", ")", "\n\n", "default", ":", "panic", "(", "\"", "\"", "+", "t", ".", "String", "(", ")", ")", "\n", "}", "\n", "}", "\n", "return", "\n", "}" ]
11,993
all-11994
[ "CalculateAvgDegree", "calclates", "the", "average", "degree", "between", "nodes", "in", "the", "graph", "on", "qwerty", "g", "has", "degree", "6", "being", "adjacent", "to", "ftyhbv", ".", "\\", "has", "degree", "1", ".", "this", "calculates", "the", "average", "over", "all", "keys", ".", "TODO", "double", "check", "that", "i", "ported", "this", "correctly", "scoring", ".", "coffee", "ln", "5" ]
[ "func", "(", "adjGrp", "Graph", ")", "CalculateAvgDegree", "(", ")", "float64", "{", "if", "adjGrp", ".", "averageDegree", "!=", "float64", "(", "0", ")", "{", "return", "adjGrp", ".", "averageDegree", "\n", "}", "\n", "var", "avg", "float64", "\n", "var", "count", "float64", "\n", "for", "_", ",", "<mask>", ":=", "range", "adjGrp", ".", "Graph", "{", "for", "_", ",", "char", ":=", "range", "value", "{", "if", "len", "(", "char", ")", "!=", "0", "||", "char", "!=", "\"", "\"", "{", "avg", "+=", "float64", "(", "len", "(", "char", ")", ")", "\n", "count", "++", "\n", "}", "\n", "}", "\n\n", "}", "\n\n", "adjGrp", ".", "averageDegree", "=", "avg", "/", "count", "\n\n", "return", "adjGrp", ".", "averageDegree", "\n", "}" ]
11,994
all-11995
[ "AddNoCloseTagName", "appends", "name", "to", ".", "NoCloseTagNames", "set", "." ]
[ "func", "(", "opts", "*", "<mask>", ")", "AddNoCloseTagName", "(", "name", "string", ")", "{", "opts", ".", "NoCloseTagNames", "=", "append", "(", "opts", ".", "NoCloseTagNames", ",", "name", ")", "\n", "}" ]
11,995
all-11996
[ "Calculates", "the", "per", "-", "element", "bit", "-", "wise", "disjunction", "of", "two", "arrays", "with", "a", "mask", "." ]
[ "func", "OrWithMask", "(", "src1", ",", "src2", ",", "dst", ",", "mask", "*", "IplImage", ")", "{", "C", ".", "cvOr", "(", "unsafe", ".", "Pointer", "(", "src1", ")", ",", "unsafe", ".", "Pointer", "(", "src2", ")", ",", "unsafe", ".", "Pointer", "(", "dst", ")", ",", "unsafe", ".", "Pointer", "(", "<mask>", ")", ",", ")", "\n", "}" ]
11,996
all-11997
[ "This", "will", "take", "a", "hash", "(", "or", "multi", "-", "level", "hash", ")", "of", "APIParams", "and", "extract", "out", "all", "the", "multipart", "file", "uploads", "and", "put", "them", "in", "an", "array", ".", "The", "recursion", "is", "needed", "as", "CM", "API", "1", ".", "5", "and", "SS", "both", "use", "this", "but", "SS", "has", "all", "its", "params", "on", "the", "top", "level", "while", "CM", "API", "1", ".", "5", "has", "the", "resource", "name", "on", "the", "top", "level", "with", "the", "params", "being", "one", "level", "down", "the", "tree", "." ]
[ "func", "extractUploads", "(", "payload", "*", "APIParams", ")", "(", "uploads", "[", "]", "*", "FileUpload", ")", "{", "for", "k", ",", "v", ":=", "<mask>", "*", "payload", "{", "if", "mpart", ",", "ok", ":=", "v", ".", "(", "*", "FileUpload", ")", ";", "ok", "{", "uploads", "=", "append", "(", "uploads", ",", "mpart", ")", "\n", "delete", "(", "*", "payload", ",", "k", ")", "\n", "}", "else", "if", "child_params", ",", "ok", ":=", "v", ".", "(", "APIParams", ")", ";", "ok", "{", "child_uploads", ":=", "extractUploads", "(", "&", "child_params", ")", "\n", "uploads", "=", "append", "(", "uploads", ",", "child_uploads", "...", ")", "\n", "}", "\n", "}", "\n", "return", "uploads", "\n", "}" ]
11,997
all-11998
[ "Find", "all", "conflicting", "prefixes", "for", "concrete", "types", "that", "implement", "the", "interface", ".", "Implement", "in", "quotes", "because", "we", "only", "consider", "the", "pointer", "for", "extra", "safety", "." ]
[ "func", "(", "cdc", "*", "Codec", ")", "collectImplementers_nolock", "(", "info", "*", "TypeInfo", ")", "{", "for", "_", ",", "cinfo", ":=", "range", "cdc", ".", "concreteInfos", "{", "if", "cinfo", ".", "PtrToType", ".", "Implements", "(", "info", ".", "<mask>", ")", "{", "info", ".", "Implementers", "[", "cinfo", ".", "Prefix", "]", "=", "append", "(", "info", ".", "Implementers", "[", "cinfo", ".", "Prefix", "]", ",", "cinfo", ")", "\n", "}", "\n", "}", "\n", "}" ]
11,998
all-11999
[ "validateNew", "checks", "app", "name", "format", "pool", "and", "plan" ]
[ "func", "(", "app", "*", "App", ")", "validateNew", "(", ")", "error", "{", "if", "app", ".", "Name", "==", "InternalAppName", "||", "!", "validation", ".", "ValidateName", "(", "app", ".", "Name", ")", "{", "<mask>", ":=", "\"", "\"", "+", "\"", "\"", "+", "\"", "\"", "\n", "return", "&", "tsuruErrors", ".", "ValidationError", "{", "Message", ":", "msg", "}", "\n", "}", "\n", "return", "app", ".", "validate", "(", ")", "\n", "}" ]
11,999
all-12000
[ "UnmarshalJSON", "implements", "json", ".", "Unmarshaler", ".", "It", "supports", "string", "object", "(", "e", ".", "g", ".", "pq", ".", "NullTime", "and", "friends", ")", "and", "null", "input", "." ]
[ "func", "(", "t", "*", "Time", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "var", "err", "error", "\n", "var", "v", "interface", "{", "}", "\n", "if", "err", "=", "json", ".", "Unmarshal", "(", "data", ",", "&", "v", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "switch", "x", ":=", "v", ".", "(", "type", ")", "{", "<mask>", "string", ":", "err", "=", "t", ".", "Time", ".", "UnmarshalJSON", "(", "data", ")", "\n", "case", "map", "[", "string", "]", "interface", "{", "}", ":", "ti", ",", "tiOK", ":=", "x", "[", "\"", "\"", "]", ".", "(", "string", ")", "\n", "valid", ",", "validOK", ":=", "x", "[", "\"", "\"", "]", ".", "(", "bool", ")", "\n", "if", "!", "tiOK", "||", "!", "validOK", "{", "return", "fmt", ".", "Errorf", "(", "`json: unmarshalling object into Go value of type null.Time requires key \"Time\" to be of type string and key \"Valid\" to be of type bool; found %T and %T, respectively`", ",", "x", "[", "\"", "\"", "]", ",", "x", "[", "\"", "\"", "]", ")", "\n", "}", "\n", "err", "=", "t", ".", "Time", ".", "UnmarshalText", "(", "[", "]", "byte", "(", "ti", ")", ")", "\n", "t", ".", "Valid", "=", "valid", "\n", "return", "err", "\n", "case", "nil", ":", "t", ".", "Valid", "=", "false", "\n", "return", "nil", "\n", "default", ":", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "v", ")", ".", "Name", "(", ")", ")", "\n", "}", "\n", "t", ".", "Valid", "=", "err", "==", "nil", "\n", "return", "err", "\n", "}" ]