id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
16,000
all-16001
[ "Start", "blocks", "until", "the", "gate", "has", "a", "free", "spot", "or", "the", "context", "is", "done", "." ]
[ "func", "(", "g", "*", "Gate", ")", "Start", "(", "ctx", "context", ".", "Context", ")", "error", "{", "select", "{", "<mask>", "<-", "ctx", ".", "Done", "(", ")", ":", "return", "ctx", ".", "Err", "(", ")", "\n", "case", "g", ".", "ch", "<-", "struct", "{", "}", "{", "}", ":", "return", "nil", "\n", "}", "\n", "}" ]
16,001
all-16002
[ "DeepCopyObject", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "runtime", ".", "Object", "." ]
[ "func", "(", "<mask>", "*", "DNSEndpoint", ")", "DeepCopyObject", "(", ")", "runtime", ".", "Object", "{", "if", "c", ":=", "in", ".", "DeepCopy", "(", ")", ";", "c", "!=", "nil", "{", "return", "c", "\n", "}", "\n", "return", "nil", "\n", "}" ]
16,002
all-16003
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "ClearDeviceMetricsOverrideParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation19", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
16,003
all-16004
[ "Checksum", "returns", "the", "2", "-", "byte", "checksum", "for", "the", "provided", "data" ]
[ "func", "Checksum", "(", "data", "[", "]", "<mask>", ")", "[", "]", "byte", "{", "var", "crc", "uint16", "\n", "var", "out", "bytes", ".", "Buffer", "\n", "for", "_", ",", "b", ":=", "range", "data", "{", "crc", "=", "(", "(", "crc", "<<", "8", ")", "&", "0xffff", ")", "^", "crc16tab", "[", "(", "(", "crc", ">>", "8", ")", "^", "uint16", "(", "b", ")", ")", "&", "0x00FF", "]", "\n", "}", "\n\n", "err", ":=", "binary", ".", "Write", "(", "&", "out", ",", "binary", ".", "LittleEndian", ",", "crc", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n\n", "return", "out", ".", "Bytes", "(", ")", "\n", "}" ]
16,004
all-16005
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetNodeForLocationParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom39", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
16,005
all-16006
[ "LoadString", "takes", "a", "template", "string", "and", "compiles", "it", "into", "vm", ".", "ByteCode" ]
[ "func", "(", "l", "*", "StringByteCodeLoader", ")", "LoadString", "(", "name", "string", ",", "template", "string", ")", "(", "*", "vm", ".", "ByteCode", ",", "error", ")", "{", "ast", ",", "err", ":=", "l", ".", "Parser", ".", "ParseString", "(", "name", ",", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "l", ".", "ShouldDumpAST", "(", ")", "{", "fmt", ".", "Fprintf", "(", "os", ".", "Stderr", ",", "\"", "\\n", "\\n", "\"", ",", "ast", ")", "\n", "}", "\n\n", "bc", ",", "err", ":=", "l", ".", "Compiler", ".", "Compile", "(", "ast", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "l", ".", "ShouldDumpByteCode", "(", ")", "{", "fmt", ".", "Fprintf", "(", "os", ".", "Stderr", ",", "\"", "\\n", "\\n", "\"", ",", "bc", ")", "\n", "}", "\n\n", "return", "bc", ",", "nil", "\n", "}" ]
16,006
all-16007
[ "retrieveOnce", "retrieves", "the", "MAC", "address", "of", "a", "device", "using", "netlink", ".", "LinkByName" ]
[ "func", "(", "retriever", "*", "macAddressRetriever", ")", "retrieveOnce", "(", ")", "error", "{", "dev", ":=", "filepath", ".", "Base", "(", "retriever", ".", "dev", ")", "\n", "<mask>", ",", "err", ":=", "retriever", ".", "netlinkClient", ".", "LinkByName", "(", "dev", ")", "\n", "if", "err", "!=", "nil", "{", "return", "apierrors", ".", "NewRetriableError", "(", "apierrors", ".", "NewRetriable", "(", "false", ")", ",", "err", ")", "\n", "}", "\n", "retriever", ".", "macAddress", "=", "link", ".", "Attrs", "(", ")", ".", "HardwareAddr", ".", "String", "(", ")", "\n", "return", "nil", "\n", "}" ]
16,007
all-16008
[ "native", "returns", "a", "pointer", "to", "the", "underlying", "GtkFontButton", "." ]
[ "func", "(", "v", "*", "FontButton", ")", "native", "(", ")", "*", "C", ".", "GtkFontButton", "{", "if", "v", "==", "nil", "||", "v", ".", "GObject", "==", "nil", "{", "<mask>", "nil", "\n", "}", "\n", "p", ":=", "unsafe", ".", "Pointer", "(", "v", ".", "GObject", ")", "\n", "return", "C", ".", "toGtkFontButton", "(", "p", ")", "\n", "}" ]
16,008
all-16009
[ "RemoveCounterFunc", "removes", "the", "named", "counter", "function" ]
[ "func", "(", "m", "*", "CirconusMetrics", ")", "RemoveCounterFunc", "(", "metric", "string", ")", "{", "m", ".", "cfm", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "cfm", ".", "Unlock", "(", ")", "\n", "<mask>", "(", "m", ".", "counterFuncs", ",", "metric", ")", "\n", "}" ]
16,009
all-16010
[ "sendAll", "sends", "the", "alerts", "to", "all", "configured", "Alertmanagers", "concurrently", ".", "It", "returns", "true", "if", "the", "alerts", "could", "be", "sent", "successfully", "to", "at", "least", "one", "Alertmanager", "." ]
[ "func", "(", "n", "*", "Manager", ")", "sendAll", "(", "alerts", "...", "*", "Alert", ")", "bool", "{", "begin", ":=", "time", ".", "Now", "(", ")", "\n\n", "b", ",", "err", ":=", "json", ".", "Marshal", "(", "alerts", ")", "\n", "if", "err", "!=", "nil", "{", "level", ".", "Error", "(", "n", ".", "logger", ")", ".", "<mask>", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "err", ")", "\n", "return", "false", "\n", "}", "\n\n", "n", ".", "mtx", ".", "RLock", "(", ")", "\n", "amSets", ":=", "n", ".", "alertmanagers", "\n", "n", ".", "mtx", ".", "RUnlock", "(", ")", "\n\n", "var", "(", "wg", "sync", ".", "WaitGroup", "\n", "numSuccess", "uint64", "\n", ")", "\n", "for", "_", ",", "ams", ":=", "range", "amSets", "{", "ams", ".", "mtx", ".", "RLock", "(", ")", "\n\n", "for", "_", ",", "am", ":=", "range", "ams", ".", "ams", "{", "wg", ".", "Add", "(", "1", ")", "\n\n", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "n", ".", "ctx", ",", "time", ".", "Duration", "(", "ams", ".", "cfg", ".", "Timeout", ")", ")", "\n", "defer", "cancel", "(", ")", "\n\n", "go", "func", "(", "ams", "*", "alertmanagerSet", ",", "am", "alertmanager", ")", "{", "u", ":=", "am", ".", "url", "(", ")", ".", "String", "(", ")", "\n\n", "if", "err", ":=", "n", ".", "sendOne", "(", "ctx", ",", "ams", ".", "client", ",", "u", ",", "b", ")", ";", "err", "!=", "nil", "{", "level", ".", "Error", "(", "n", ".", "logger", ")", ".", "Log", "(", "\"", "\"", ",", "u", ",", "\"", "\"", ",", "len", "(", "alerts", ")", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "err", ")", "\n", "n", ".", "metrics", ".", "errors", ".", "WithLabelValues", "(", "u", ")", ".", "Inc", "(", ")", "\n", "}", "else", "{", "atomic", ".", "AddUint64", "(", "&", "numSuccess", ",", "1", ")", "\n", "}", "\n", "n", ".", "metrics", ".", "latency", ".", "WithLabelValues", "(", "u", ")", ".", "Observe", "(", "time", ".", "Since", "(", "begin", ")", ".", "Seconds", "(", ")", ")", "\n", "n", ".", "metrics", ".", "sent", ".", "WithLabelValues", "(", "u", ")", ".", "Add", "(", "float64", "(", "len", "(", "alerts", ")", ")", ")", "\n\n", "wg", ".", "Done", "(", ")", "\n", "}", "(", "ams", ",", "am", ")", "\n", "}", "\n", "ams", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "}", "\n", "wg", ".", "Wait", "(", ")", "\n\n", "return", "numSuccess", ">", "0", "\n", "}" ]
16,010
all-16011
[ "IsNoParentOwners", "checks", "if", "an", "OWNERS", "file", "path", "refers", "to", "an", "OWNERS", "file", "with", "NoParentOwners", "enabled", "." ]
[ "func", "(", "o", "*", "RepoOwners", ")", "IsNoParentOwners", "(", "path", "string", ")", "bool", "{", "return", "o", ".", "options", "[", "<mask>", "]", ".", "NoParentOwners", "\n", "}" ]
16,011
all-16012
[ "FromPath", "returns", "a", "VirtualApp", "via", "its", "supplied", "path", "." ]
[ "func", "FromPath", "(", "client", "*", "govmomi", ".", "Client", ",", "name", "string", ",", "dc", "*", "object", ".", "Datacenter", ")", "(", "*", "object", ".", "VirtualApp", ",", "error", ")", "{", "finder", ":=", "find", ".", "NewFinder", "(", "client", ".", "Client", ",", "<mask>", ")", "\n\n", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "provider", ".", "DefaultAPITimeout", ")", "\n", "defer", "cancel", "(", ")", "\n", "if", "dc", "!=", "nil", "{", "finder", ".", "SetDatacenter", "(", "dc", ")", "\n", "}", "\n", "return", "finder", ".", "VirtualApp", "(", "ctx", ",", "name", ")", "\n", "}" ]
16,012
all-16013
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetSearchResultsParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom33", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
16,013
all-16014
[ "GatherProwJobMetrics", "gathers", "prometheus", "metrics", "for", "prowjobs", "." ]
[ "func", "GatherProwJobMetrics", "(", "pjs", "[", "]", "prowapi", ".", "ProwJob", ")", "{", "// map of job to job type to state to count", "metricMap", ":=", "make", "(", "map", "[", "string", "]", "map", "[", "string", "]", "map", "[", "string", "]", "float64", ")", "\n\n", "for", "_", ",", "pj", ":=", "range", "pjs", "{", "if", "metricMap", "[", "pj", ".", "Spec", ".", "Job", "]", "==", "nil", "{", "metricMap", "[", "pj", ".", "Spec", ".", "Job", "]", "=", "make", "(", "map", "[", "string", "]", "map", "[", "string", "]", "float64", ")", "\n", "}", "\n", "if", "metricMap", "[", "pj", ".", "Spec", ".", "Job", "]", "[", "string", "(", "pj", ".", "Spec", ".", "Type", ")", "]", "==", "nil", "{", "metricMap", "[", "pj", ".", "Spec", ".", "<mask>", "]", "[", "string", "(", "pj", ".", "Spec", ".", "Type", ")", "]", "=", "make", "(", "map", "[", "string", "]", "float64", ")", "\n", "}", "\n", "metricMap", "[", "pj", ".", "Spec", ".", "Job", "]", "[", "string", "(", "pj", ".", "Spec", ".", "Type", ")", "]", "[", "string", "(", "pj", ".", "Status", ".", "State", ")", "]", "++", "\n", "}", "\n\n", "// This may be racing with the prometheus server but we need to remove", "// stale metrics like triggered or pending jobs that are now complete.", "prowJobs", ".", "Reset", "(", ")", "\n\n", "for", "job", ",", "jobMap", ":=", "range", "metricMap", "{", "for", "jobType", ",", "typeMap", ":=", "range", "jobMap", "{", "for", "state", ",", "count", ":=", "range", "typeMap", "{", "prowJobs", ".", "WithLabelValues", "(", "job", ",", "jobType", ",", "state", ")", ".", "Set", "(", "count", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}" ]
16,014
all-16015
[ "addSubscriber", "will", "create", "a", "new", "subscriber", "on", "a", "stream" ]
[ "func", "(", "str", "*", "Stream", ")", "addSubscriber", "(", "eventid", "string", ")", "*", "Subscriber", "{", "sub", ":=", "&", "Subscriber", "{", "eventid", ":", "eventid", ",", "quit", ":", "str", ".", "deregister", ",", "<mask>", ":", "make", "(", "chan", "*", "Event", ",", "64", ")", ",", "}", "\n\n", "str", ".", "register", "<-", "sub", "\n", "return", "sub", "\n", "}" ]
16,015
all-16016
[ "AppendFiles", "appends", "more", "files", "to", "ConfigFile", "and", "reload", "automatically", "." ]
[ "func", "(", "c", "*", "ConfigFile", ")", "AppendFiles", "(", "files", "...", "string", ")", "error", "{", "if", "len", "(", "c", ".", "fileNames", ")", "==", "1", "&&", "c", ".", "fileNames", "[", "0", "]", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "c", ".", "fileNames", "=", "append", "(", "c", ".", "fileNames", ",", "<mask>", "...", ")", "\n", "return", "c", ".", "Reload", "(", ")", "\n", "}" ]
16,016
all-16017
[ "IntersectSetsCase", "runs", "the", "intersection", "between", "to", "sets", ".", "String", "in", "a", "case", "-", "insensitive", "way", ".", "It", "returns", "the", "name", "with", "the", "case", "of", "one", "." ]
[ "func", "IntersectSetsCase", "(", "one", ",", "other", "sets", ".", "String", ")", "sets", ".", "String", "{", "lower", ":=", "sets", ".", "NewString", "(", ")", "\n", "for", "item", ":=", "range", "other", "{", "lower", ".", "Insert", "(", "strings", ".", "ToLower", "(", "item", ")", ")", "\n", "}", "\n\n", "intersection", ":=", "sets", ".", "NewString", "(", ")", "\n", "for", "item", ":=", "range", "<mask>", "{", "if", "lower", ".", "Has", "(", "strings", ".", "ToLower", "(", "item", ")", ")", "{", "intersection", ".", "Insert", "(", "item", ")", "\n", "}", "\n", "}", "\n", "return", "intersection", "\n", "}" ]
16,017
all-16018
[ "At", "returns", "the", "color", "of", "the", "image", "at", "(", "x", "y", ")", ".", "At", "loads", "pixels", "from", "GPU", "to", "system", "memory", "if", "necessary", "which", "means", "that", "At", "can", "be", "slow", ".", "At", "always", "returns", "a", "transparent", "color", "if", "the", "image", "is", "disposed", ".", "Note", "that", "important", "logic", "should", "not", "rely", "on", "values", "returned", "by", "At", "since", "the", "returned", "values", "can", "include", "very", "slight", "differences", "between", "some", "machines", ".", "At", "can", "t", "be", "called", "outside", "the", "main", "loop", "(", "ebiten", ".", "Run", "s", "updating", "function", ")", "starts", "(", "as", "of", "version", "1", ".", "4", ".", "0", "-", "alpha", ")", "." ]
[ "func", "(", "i", "*", "<mask>", ")", "At", "(", "x", ",", "y", "int", ")", "color", ".", "Color", "{", "if", "atomic", ".", "LoadInt32", "(", "&", "isRunning", ")", "==", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "i", ".", "isDisposed", "(", ")", "{", "return", "color", ".", "RGBA", "{", "}", "\n", "}", "\n", "if", "i", ".", "isSubImage", "(", ")", "&&", "!", "image", ".", "Pt", "(", "x", ",", "y", ")", ".", "In", "(", "i", ".", "bounds", ")", "{", "return", "color", ".", "RGBA", "{", "}", "\n", "}", "\n", "i", ".", "resolvePendingPixels", "(", "true", ")", "\n", "r", ",", "g", ",", "b", ",", "a", ":=", "i", ".", "mipmap", ".", "original", "(", ")", ".", "At", "(", "x", ",", "y", ")", "\n", "return", "color", ".", "RGBA", "{", "r", ",", "g", ",", "b", ",", "a", "}", "\n", "}" ]
16,018
all-16019
[ "Returns", "the", "City", "Record", "for", "an", "IP", "address", ".", "Requires", "the", "GeoCity", "(", "Lite", ")", "database", "-", "http", ":", "//", "www", ".", "maxmind", ".", "com", "/", "en", "/", "city" ]
[ "func", "(", "gi", "*", "GeoIP", ")", "GetRecord", "(", "ip", "string", ")", "*", "GeoIPRecord", "{", "if", "gi", ".", "db", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "cip", ":=", "C", ".", "CString", "(", "ip", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cip", ")", ")", "\n\n", "gi", ".", "mu", ".", "Lock", "(", ")", "\n", "record", ":=", "C", ".", "GeoIP_record_by_addr", "(", "gi", ".", "db", ",", "cip", ")", "\n", "gi", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "record", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "// defer C.free(unsafe.Pointer(record))", "defer", "C", ".", "GeoIPRecord_delete", "(", "record", ")", "\n", "rec", ":=", "new", "(", "GeoIPRecord", ")", "\n", "rec", ".", "CountryCode", "=", "C", ".", "GoString", "(", "record", ".", "country_code", ")", "\n", "rec", ".", "CountryCode3", "=", "C", ".", "GoString", "(", "record", ".", "country_code3", ")", "\n", "rec", ".", "CountryName", "=", "C", ".", "GoString", "(", "record", ".", "country_name", ")", "\n", "rec", ".", "Region", "=", "C", ".", "GoString", "(", "record", ".", "region", ")", "\n", "rec", ".", "City", "=", "C", ".", "GoString", "(", "record", ".", "city", ")", "\n", "rec", ".", "PostalCode", "=", "C", ".", "GoString", "(", "<mask>", ".", "postal_code", ")", "\n", "rec", ".", "Latitude", "=", "float32", "(", "record", ".", "latitude", ")", "\n", "rec", ".", "Longitude", "=", "float32", "(", "record", ".", "longitude", ")", "\n", "rec", ".", "CharSet", "=", "int", "(", "record", ".", "charset", ")", "\n", "rec", ".", "ContinentCode", "=", "C", ".", "GoString", "(", "record", ".", "continent_code", ")", "\n\n", "if", "gi", ".", "db", ".", "databaseType", "!=", "C", ".", "GEOIP_CITY_EDITION_REV0", "{", "/* DIRTY HACK BELOW:\n\t\t The GeoIPRecord struct in GeoIPCity.h contains an int32 union of metro_code and dma_code.\n\t\t The union is unnamed, so cgo names it anon0 and assumes it's a 4-byte array.\n\t\t*/", "union_int", ":=", "(", "*", "int32", ")", "(", "unsafe", ".", "Pointer", "(", "&", "record", ".", "anon0", ")", ")", "\n", "rec", ".", "MetroCode", "=", "int", "(", "*", "union_int", ")", "\n", "rec", ".", "AreaCode", "=", "int", "(", "record", ".", "area_code", ")", "\n", "}", "\n\n", "return", "rec", "\n", "}" ]
16,019
all-16020
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetInspectModeParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoOverlay8", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
16,020
all-16021
[ "Apply", "pre", "-", "multiplies", "a", "vector", "(", "r", "g", "b", "a", "1", ")", "by", "the", "matrix", "where", "r", "g", "b", "and", "a", "are", "clr", "s", "values", "in", "straight", "-", "alpha", "format", ".", "In", "other", "words", "Apply", "calculates", "ColorM", "*", "(", "r", "g", "b", "a", "1", ")", "^T", "." ]
[ "func", "(", "c", "*", "ColorM", ")", "Apply", "(", "clr", "color", ".", "Color", ")", "color", ".", "<mask>", "{", "return", "c", ".", "impl", ".", "Apply", "(", "clr", ")", "\n", "}" ]
16,021
all-16022
[ "MustSet", "the", "value", "into", "the", "underlying", "ENV", "as", "well", "as", "envy", ".", "This", "may", "return", "an", "error", "if", "there", "is", "a", "problem", "setting", "the", "underlying", "ENV", "value", "." ]
[ "func", "MustSet", "(", "key", "string", ",", "<mask>", "string", ")", "error", "{", "gil", ".", "Lock", "(", ")", "\n", "defer", "gil", ".", "Unlock", "(", ")", "\n", "err", ":=", "os", ".", "Setenv", "(", "key", ",", "value", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "env", "[", "key", "]", "=", "value", "\n", "return", "nil", "\n", "}" ]
16,022
all-16023
[ "ErrorStack", "returns", "a", "string", "that", "contains", "both", "the", "error", "message", "and", "the", "callstack", "." ]
[ "func", "(", "err", "*", "Error", ")", "ErrorStack", "(", ")", "string", "{", "return", "err", ".", "TypeName", "(", ")", "+", "\"", "\"", "+", "err", ".", "<mask>", "(", ")", "+", "\"", "\\n", "\"", "+", "string", "(", "err", ".", "Stack", "(", ")", ")", "\n", "}" ]
16,023
all-16024
[ "IsTouchJustReleased", "returns", "a", "boolean", "value", "indicating", "whether", "the", "given", "touch", "is", "released", "just", "in", "the", "current", "frame", ".", "IsTouchJustReleased", "is", "concurrent", "safe", "." ]
[ "func", "IsTouchJustReleased", "(", "id", "int", ")", "bool", "{", "theInputState", ".", "m", ".", "RLock", "(", ")", "\n", "r", ":=", "theInputState", ".", "touchDurations", "[", "id", "]", "==", "0", "&&", "theInputState", ".", "prevTouchDurations", "[", "<mask>", "]", ">", "0", "\n", "theInputState", ".", "m", ".", "RUnlock", "(", ")", "\n", "return", "r", "\n", "}" ]
16,024
all-16025
[ "SetVisible", "allows", "to", "temporarily", "remove", "the", "window", "from", "screen", "and", "show", "it", "later", "without", "reconstruction" ]
[ "func", "(", "w", "*", "Window", ")", "SetVisible", "(", "visible", "bool", ")", "{", "if", "w", ".", "<mask>", "==", "visible", "{", "w", ".", "hidden", "=", "!", "visible", "\n", "if", "w", ".", "hidden", "{", "w", ".", "SetModal", "(", "false", ")", "\n", "if", "WindowManager", "(", ")", ".", "topWindow", "(", ")", "==", "w", "{", "WindowManager", "(", ")", ".", "moveActiveWindowToBottom", "(", ")", "\n", "}", "\n", "}", "else", "{", "WindowManager", "(", ")", ".", "activateWindow", "(", "w", ")", "\n", "}", "\n", "}", "\n", "}" ]
16,025
all-16026
[ "Compile", "retrieves", "and", "processes", "the", "specified", "asset", "sources", "and", "compiles", "them", "to", "the", "specified", "variable", "in", "the", "source", "file", "." ]
[ "func", "Compile", "(", "sources", "[", "]", "*", "Source", ",", "filePath", "string", ",", "pkgName", "string", ",", "varName", "string", ",", "opts", "*", "Opts", ")", "error", "{", "fs", ",", "err", ":=", "Retrieve", "(", "sources", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "opts", "==", "nil", "{", "opts", "=", "&", "Opts", "{", "}", "\n", "}", "\n\n", "if", "opts", ".", "VariableComment", "==", "\"", "\"", "{", "opts", ".", "VariableComment", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "varName", ")", "\n", "}", "\n\n", "err", "=", "vfsgen", ".", "Generate", "(", "<mask>", ",", "vfsgen", ".", "Options", "{", "Filename", ":", "filePath", ",", "PackageName", ":", "pkgName", ",", "BuildTags", ":", "opts", ".", "BuildTags", ",", "VariableName", ":", "varName", ",", "VariableComment", ":", "opts", ".", "VariableComment", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
16,026
all-16027
[ "newNS1Changes", "returns", "a", "collection", "of", "Changes", "based", "on", "the", "given", "records", "and", "action", "." ]
[ "func", "newNS1Changes", "(", "action", "string", ",", "endpoints", "[", "]", "*", "endpoint", ".", "Endpoint", ")", "[", "]", "*", "ns1Change", "{", "<mask>", ":=", "make", "(", "[", "]", "*", "ns1Change", ",", "0", ",", "len", "(", "endpoints", ")", ")", "\n\n", "for", "_", ",", "endpoint", ":=", "range", "endpoints", "{", "changes", "=", "append", "(", "changes", ",", "&", "ns1Change", "{", "Action", ":", "action", ",", "Endpoint", ":", "endpoint", ",", "}", ",", ")", "\n", "}", "\n\n", "return", "changes", "\n", "}" ]
16,027
all-16028
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "a", "specified", "program", "object" ]
[ "func", "ProgramUniform2iv", "(", "program", "uint32", ",", "location", "int32", ",", "count", "int32", ",", "value", "*", "int32", ")", "{", "C", ".", "glowProgramUniform2iv", "(", "gpProgramUniform2iv", ",", "(", "C", ".", "GLuint", ")", "(", "program", ")", ",", "(", "C", ".", "GLint", ")", "(", "location", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "count", ")", ",", "(", "*", "C", ".", "GLint", ")", "(", "unsafe", ".", "Pointer", "(", "<mask>", ")", ")", ")", "\n", "}" ]
16,028
all-16029
[ "GetPPDName", "()", "is", "a", "wrapper", "around", "gtk_paper_size_get_ppd_name", "()", "." ]
[ "func", "(", "<mask>", "*", "PaperSize", ")", "GetPPDName", "(", ")", "(", "string", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_paper_size_get_ppd_name", "(", "ps", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "\"", "\"", ",", "nilPtrErr", "\n", "}", "\n", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "char", ")", "(", "c", ")", ")", ",", "nil", "\n", "}" ]
16,029
all-16030
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "BindParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoTethering2", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
16,030
all-16031
[ "FindType", "returns", "a", "proper", "VSphereFolderType", "for", "a", "folder", "object", "by", "checking", "its", "child", "type", "." ]
[ "func", "FindType", "(", "folder", "*", "object", ".", "Folder", ")", "(", "VSphereFolderType", ",", "error", ")", "{", "var", "ft", "VSphereFolderType", "\n\n", "props", ",", "err", ":=", "Properties", "(", "folder", ")", "\n", "if", "err", "!=", "nil", "{", "return", "ft", ",", "err", "\n", "}", "\n\n", "// Depending on the container type, the actual folder type may be contained", "// in either the first or second element, the former for clusters, datastore", "// clusters, or standalone ESXi for VMs, and the latter in the case of actual", "// folders that can contain subfolders.", "var", "<mask>", "string", "\n", "if", "props", ".", "ChildType", "[", "0", "]", "!=", "\"", "\"", "{", "ct", "=", "props", ".", "ChildType", "[", "0", "]", "\n", "}", "else", "{", "ct", "=", "props", ".", "ChildType", "[", "1", "]", "\n", "}", "\n\n", "switch", "ct", "{", "case", "\"", "\"", ":", "ft", "=", "VSphereFolderTypeDatacenter", "\n", "case", "\"", "\"", ":", "ft", "=", "VSphereFolderTypeHost", "\n", "case", "\"", "\"", ":", "ft", "=", "VSphereFolderTypeVM", "\n", "case", "\"", "\"", ":", "ft", "=", "VSphereFolderTypeDatastore", "\n", "case", "\"", "\"", ":", "ft", "=", "VSphereFolderTypeNetwork", "\n", "default", ":", "return", "ft", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "ct", ")", "\n", "}", "\n\n", "return", "ft", ",", "nil", "\n", "}" ]
16,031
all-16032
[ "All", "writes", "out", "all", "the", "differences", "between", "the", "specified", "releases" ]
[ "func", "(", "s", "*", "DiffCmd", ")", "All", "(", "w", "<mask>", ".", "Writer", ")", "error", "{", "differ", ",", "err", ":=", "diff", ".", "New", "(", "s", ".", "releaseRepo", ",", "s", ".", "release1", ",", "s", ".", "release2", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "d", ",", "err", ":=", "differ", ".", "Diff", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "s", ".", "printDiffResult", "(", "w", ",", "d", ")", "\n", "return", "nil", "\n", "}" ]
16,032
all-16033
[ "Copy", "returns", "a", "copy", "of", "the", "hashtree", "." ]
[ "func", "(", "h", "*", "dbHashTree", ")", "Copy", "(", ")", "(", "HashTree", ",", "error", ")", "{", "if", "err", ":=", "h", ".", "Hash", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "r", ",", "w", ":=", "io", ".", "Pipe", "(", ")", "\n", "var", "eg", "errgroup", ".", "Group", "\n", "eg", ".", "Go", "(", "func", "(", ")", "(", "retErr", "error", ")", "{", "defer", "func", "(", ")", "{", "if", "err", ":=", "w", ".", "Close", "(", ")", ";", "err", "!=", "nil", "&&", "retErr", "==", "nil", "{", "retErr", "=", "err", "\n", "}", "\n", "}", "(", ")", "\n", "return", "h", ".", "Serialize", "(", "w", ")", "\n", "}", ")", "\n", "var", "result", "HashTree", "\n", "eg", ".", "Go", "(", "func", "(", ")", "error", "{", "var", "err", "error", "\n", "<mask>", ",", "err", "=", "DeserializeDBHashTree", "(", "pathlib", ".", "Dir", "(", "h", ".", "Path", "(", ")", ")", ",", "r", ")", "\n", "return", "err", "\n", "}", ")", "\n", "if", "err", ":=", "eg", ".", "Wait", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "result", ",", "nil", "\n", "}" ]
16,033
all-16034
[ "NewTrackedBuffer", "creates", "a", "new", "TrackedBuffer", "." ]
[ "func", "NewTrackedBuffer", "(", "nodeFormatter", "NodeFormatter", ")", "*", "TrackedBuffer", "{", "return", "&", "TrackedBuffer", "{", "Buffer", ":", "new", "(", "<mask>", ".", "Buffer", ")", ",", "nodeFormatter", ":", "nodeFormatter", ",", "}", "\n", "}" ]
16,034
all-16035
[ "NewProducer", "configures", "a", "new", "producer", "instance", "." ]
[ "func", "NewProducer", "(", "config", "ProducerConfig", ")", "(", "p", "*", "Producer", ",", "err", "error", ")", "{", "config", ".", "defaults", "(", ")", "\n\n", "p", "=", "&", "Producer", "{", "reqs", ":", "make", "(", "chan", "ProducerRequest", ",", "config", ".", "MaxConcurrency", ")", ",", "done", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "address", ":", "config", ".", "<mask>", ",", "topic", ":", "config", ".", "Topic", ",", "dialTimeout", ":", "config", ".", "DialTimeout", ",", "readTimeout", ":", "config", ".", "ReadTimeout", ",", "writeTimeout", ":", "config", ".", "WriteTimeout", ",", "}", "\n\n", "return", "\n", "}" ]
16,035
all-16036
[ "WithContext", "adds", "the", "context", "to", "the", "add", "Vm", "params" ]
[ "func", "(", "o", "*", "AddVMParams", ")", "WithContext", "(", "ctx", "<mask>", ".", "Context", ")", "*", "AddVMParams", "{", "o", ".", "SetContext", "(", "ctx", ")", "\n", "return", "o", "\n", "}" ]
16,036
all-16037
[ "ReceiveMessage", "receives", "a", "log", "line", "from", "seelog", "and", "emits", "it", "to", "the", "Windows", "event", "log" ]
[ "func", "(", "r", "*", "eventLogReceiver", ")", "ReceiveMessage", "(", "message", "string", ",", "level", "seelog", ".", "LogLevel", ",", "context", "seelog", ".", "LogContextInterface", ")", "error", "{", "switch", "level", "{", "case", "seelog", ".", "DebugLvl", ",", "seelog", ".", "InfoLvl", ":", "return", "eventLog", ".", "Info", "(", "eventLogID", ",", "message", ")", "\n", "case", "seelog", ".", "WarnLvl", ":", "return", "eventLog", ".", "Warning", "(", "eventLogID", ",", "message", ")", "\n", "case", "seelog", ".", "ErrorLvl", ",", "seelog", ".", "CriticalLvl", ":", "return", "eventLog", ".", "<mask>", "(", "eventLogID", ",", "message", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
16,037
all-16038
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "StepOutParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDebugger1", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
16,038
all-16039
[ "Key", "returns", "the", "key", "of", "the", "node", "with", "the", "given", "id", ".", "It", "will", "return", "ErrNoPath", "if", "the", "node", "does", "not", "exist", "." ]
[ "func", "(", "da", "*", "Cedar", ")", "Key", "(", "id", "int", ")", "(", "key", "[", "]", "byte", ",", "err", "error", ")", "{", "for", "id", ">", "0", "{", "from", ":=", "da", ".", "Array", "[", "id", "]", ".", "Check", "\n", "if", "from", "<", "0", "{", "return", "nil", ",", "ErrNoPath", "\n", "}", "\n", "if", "char", ":=", "byte", "(", "da", ".", "Array", "[", "from", "]", ".", "base", "(", ")", "^", "id", ")", ";", "char", "!=", "0", "{", "key", "=", "append", "(", "key", ",", "char", ")", "\n", "}", "\n", "id", "=", "from", "\n", "}", "\n", "if", "id", "!=", "0", "||", "len", "(", "key", ")", "==", "0", "{", "return", "nil", ",", "ErrInvalidKey", "\n", "}", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "key", ")", "/", "2", ";", "i", "++", "{", "key", "[", "i", "]", ",", "<mask>", "[", "len", "(", "key", ")", "-", "i", "-", "1", "]", "=", "key", "[", "len", "(", "key", ")", "-", "i", "-", "1", "]", ",", "key", "[", "i", "]", "\n", "}", "\n", "return", "key", ",", "nil", "\n", "}" ]
16,039
all-16040
[ "Runf", "is", "like", "Run", "but", "formats", "its", "arguments", "according", "to", "the", "format", ".", "Analogous", "to", "Printf", "()", "." ]
[ "func", "Runf", "(", "<mask>", "string", ",", "args", "...", "interface", "{", "}", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "Run", "(", "fmt", ".", "Sprintf", "(", "format", ",", "args", "...", ")", ")", "\n", "}" ]
16,040
all-16041
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventInlineStyleInvalidated", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom60", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
16,041
all-16042
[ "Host", "returns", "a", "host", "in", "the", "cluster", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "Host", "(", ")", "*", "URI", "{", "c", ".", "mutex", ".", "Lock", "(", ")", "\n", "var", "host", "*", "URI", "\n", "for", "i", ":=", "range", "c", ".", "okList", "{", "idx", ":=", "(", "i", "+", "c", ".", "lastHostIdx", ")", "%", "len", "(", "c", ".", "okList", ")", "\n", "<mask>", ":=", "c", ".", "okList", "[", "idx", "]", "\n", "if", "ok", "{", "host", "=", "c", ".", "hosts", "[", "idx", "]", "\n", "break", "\n", "}", "\n", "}", "\n", "c", ".", "lastHostIdx", "++", "\n", "c", ".", "mutex", ".", "Unlock", "(", ")", "\n", "if", "host", "!=", "nil", "{", "return", "host", "\n", "}", "\n", "c", ".", "reset", "(", ")", "\n", "return", "host", "\n", "}" ]
16,042
all-16043
[ "tombstone", "puts", "a", "revision", "pointing", "to", "a", "tombstone", "to", "the", "keyIndex", ".", "It", "also", "creates", "a", "new", "empty", "generation", "in", "the", "keyIndex", ".", "It", "returns", "ErrRevisionNotFound", "when", "tombstone", "on", "an", "empty", "generation", "." ]
[ "func", "(", "ki", "*", "keyIndex", ")", "tombstone", "(", "lg", "*", "zap", ".", "Logger", ",", "main", "int64", ",", "sub", "int64", ")", "error", "{", "if", "ki", ".", "isEmpty", "(", ")", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Panic", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "string", "(", "ki", ".", "<mask>", ")", ")", ",", ")", "\n", "}", "else", "{", "plog", ".", "Panicf", "(", "\"", "\"", ",", "string", "(", "ki", ".", "key", ")", ")", "\n", "}", "\n", "}", "\n", "if", "ki", ".", "generations", "[", "len", "(", "ki", ".", "generations", ")", "-", "1", "]", ".", "isEmpty", "(", ")", "{", "return", "ErrRevisionNotFound", "\n", "}", "\n", "ki", ".", "put", "(", "lg", ",", "main", ",", "sub", ")", "\n", "ki", ".", "generations", "=", "append", "(", "ki", ".", "generations", ",", "generation", "{", "}", ")", "\n", "keysGauge", ".", "Dec", "(", ")", "\n", "return", "nil", "\n", "}" ]
16,043
all-16044
[ "Closes", "the", "tables", "for", "cleanup", "in", "newLevelsController", ".", "(", "We", "Close", "()", "instead", "of", "using", "DecrRef", "()", "because", "that", "would", "delete", "the", "underlying", "files", ".", ")", "We", "ignore", "errors", "which", "is", "OK", "because", "tables", "are", "read", "-", "only", "." ]
[ "func", "closeAllTables", "(", "tables", "[", "]", "[", "]", "*", "table", ".", "Table", ")", "{", "for", "_", ",", "tableSlice", ":=", "range", "tables", "{", "for", "_", ",", "<mask>", ":=", "range", "tableSlice", "{", "_", "=", "table", ".", "Close", "(", ")", "\n", "}", "\n", "}", "\n", "}" ]
16,044
all-16045
[ "AnalyzeAliases", "goes", "through", "the", "aliases", "and", "copies", "the", "details", "from", "original", "actions", "to", "the", "aliased", "actions", ".", "It", "skips", "the", "route", "field", "since", "we", "have", "the", "routes", "hard", "-", "coded", "in", "the", "ParseRoute", "function", "." ]
[ "func", "(", "a", "*", "APIAnalyzer", ")", "AnalyzeAliases", "(", ")", "{", "for", "from", ",", "to", ":=", "range", "aliases", "{", "splits", ":=", "strings", ".", "SplitN", "(", "from", ",", "\"", "\"", ",", "2", ")", "\n", "fromResName", ":=", "splits", "[", "0", "]", "\n", "fromActionName", ":=", "splits", "[", "1", "]", "\n", "splits", "=", "strings", ".", "SplitN", "(", "to", ",", "\"", "\"", ",", "2", ")", "\n", "toResName", ":=", "splits", "[", "0", "]", "\n", "toActionName", ":=", "splits", "[", "1", "]", "\n\n", "fromRes", ":=", "a", ".", "rawResources", "[", "fromResName", "]", "\n", "fromAct", ":=", "fromRes", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "[", "\"", "\"", "]", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "[", "fromActionName", "]", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n\n", "toRes", ":=", "a", ".", "rawResources", "[", "toResName", "]", "\n", "toAct", ":=", "toRes", ".", "(", "<mask>", "[", "string", "]", "interface", "{", "}", ")", "[", "\"", "\"", "]", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "[", "toActionName", "]", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "fromAct", "[", "\"", "\"", "]", "=", "toAct", "[", "\"", "\"", "]", "\n", "fromAct", "[", "\"", "\"", "]", "=", "toAct", "[", "\"", "\"", "]", "\n", "fromAct", "[", "\"", "\"", "]", "=", "toAct", "[", "\"", "\"", "]", "\n", "}", "\n", "}" ]
16,045
all-16046
[ "CutPeer", "drops", "messages", "to", "the", "specified", "peer", "." ]
[ "func", "(", "t", "*", "Transport", ")", "CutPeer", "(", "id", "types", ".", "ID", ")", "{", "t", ".", "mu", ".", "RLock", "(", ")", "\n", "p", ",", "pok", ":=", "t", ".", "peers", "[", "id", "]", "\n", "g", ",", "gok", ":=", "t", ".", "remotes", "[", "<mask>", "]", "\n", "t", ".", "mu", ".", "RUnlock", "(", ")", "\n\n", "if", "pok", "{", "p", ".", "(", "Pausable", ")", ".", "Pause", "(", ")", "\n", "}", "\n", "if", "gok", "{", "g", ".", "Pause", "(", ")", "\n", "}", "\n", "}" ]
16,046
all-16047
[ "NewNetAddressIPPort", "returns", "a", "new", "NetAddress", "using", "the", "provided", "IP", "and", "port", "number", "." ]
[ "func", "NewNetAddressIPPort", "(", "ip", "net", ".", "IP", ",", "<mask>", "uint16", ")", "*", "NetAddress", "{", "na", ":=", "&", "NetAddress", "{", "IP", ":", "ip", ",", "Port", ":", "port", ",", "str", ":", "net", ".", "JoinHostPort", "(", "ip", ".", "String", "(", ")", ",", "strconv", ".", "FormatUint", "(", "uint64", "(", "port", ")", ",", "10", ")", ",", ")", ",", "}", "\n", "return", "na", "\n", "}" ]
16,047
all-16048
[ "UpdateString", "updates", "the", "bytes", "in", "the", "buffer", "from", "a", "string" ]
[ "func", "(", "ref", "BytesRef", ")", "UpdateString", "(", "s", "string", ")", "{", "if", "<mask>", "!=", "nil", "{", "copy", "(", "ref", ",", "s", ")", "\n", "}", "\n", "}" ]
16,048
all-16049
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "MonotonicTime", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "*", "t", "=", "MonotonicTime", "(", "MonotonicTimeEpoch", ".", "Add", "(", "<mask>", ".", "Duration", "(", "in", ".", "Float64", "(", ")", "*", "float64", "(", "time", ".", "Second", ")", ")", ")", ")", "\n", "}" ]
16,049
all-16050
[ "length", "tests", "whether", "a", "variable", "s", "length", "is", "equal", "to", "a", "given", "value", ".", "For", "strings", "it", "tests", "the", "number", "of", "characters", "whereas", "for", "maps", "and", "slices", "it", "tests", "the", "number", "of", "items", "." ]
[ "func", "hasLengthOf", "(", "top", "interface", "{", "}", ",", "current", "interface", "{", "}", ",", "field", "interface", "{", "}", ",", "param", "string", ")", "bool", "{", "st", ":=", "reflect", ".", "ValueOf", "(", "field", ")", "\n\n", "switch", "st", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "String", ":", "p", ":=", "asInt", "(", "param", ")", "\n\n", "return", "int64", "(", "utf8", ".", "RuneCountInString", "(", "st", ".", "String", "(", ")", ")", ")", "==", "p", "\n\n", "<mask>", "reflect", ".", "Slice", ",", "reflect", ".", "Map", ",", "reflect", ".", "Array", ":", "p", ":=", "asInt", "(", "param", ")", "\n\n", "return", "int64", "(", "st", ".", "Len", "(", ")", ")", "==", "p", "\n\n", "case", "reflect", ".", "Int", ",", "reflect", ".", "Int8", ",", "reflect", ".", "Int16", ",", "reflect", ".", "Int32", ",", "reflect", ".", "Int64", ":", "p", ":=", "asInt", "(", "param", ")", "\n\n", "return", "st", ".", "Int", "(", ")", "==", "p", "\n\n", "case", "reflect", ".", "Uint", ",", "reflect", ".", "Uint8", ",", "reflect", ".", "Uint16", ",", "reflect", ".", "Uint32", ",", "reflect", ".", "Uint64", ",", "reflect", ".", "Uintptr", ":", "p", ":=", "asUint", "(", "param", ")", "\n\n", "return", "st", ".", "Uint", "(", ")", "==", "p", "\n\n", "case", "reflect", ".", "Float32", ",", "reflect", ".", "Float64", ":", "p", ":=", "asFloat", "(", "param", ")", "\n\n", "return", "st", ".", "Float", "(", ")", "==", "p", "\n", "}", "\n\n", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "field", ")", ")", "\n", "}" ]
16,050
all-16051
[ "encodeInt", "provides", "a", "Go", "implementation", "of", "integer", "geohash", ".", "This", "is", "the", "default", "implementation", "of", "EncodeInt", "but", "optimized", "versions", "are", "provided", "for", "certain", "architectures", "." ]
[ "func", "encodeInt", "(", "<mask>", ",", "lng", "float64", ")", "uint64", "{", "latInt", ":=", "encodeRange", "(", "lat", ",", "90", ")", "\n", "lngInt", ":=", "encodeRange", "(", "lng", ",", "180", ")", "\n", "return", "interleave", "(", "latInt", ",", "lngInt", ")", "\n", "}" ]
16,051
all-16052
[ "SafeCreateSSH", "creates", "a", "file", "creating", "parent", "directories", "if", "needed", "on", "a", "remote", "machine", "via", "an", "ssh", "client" ]
[ "func", "SafeCreateSSH", "(", "client", "SFTPClient", ",", "name", "...", "string", ")", "(", "<mask>", "*", "sftp", ".", "File", ",", "err", "error", ")", "{", "ssh", ":=", "sshClientBucket", "{", "client", ":", "client", ",", "}", "\n", "fpath", ":=", "path", ".", "Join", "(", "name", "...", ")", "\n", "basepath", ":=", "filepath", ".", "Dir", "(", "fpath", ")", "\n\n", "if", "err", "=", "ssh", ".", "remoteSafeMkdirAll", "(", "basepath", ")", ";", "err", "==", "nil", "{", "file", ",", "err", "=", "client", ".", "Create", "(", "fpath", ")", "\n", "}", "\n", "return", "\n", "}" ]
16,052
all-16053
[ "GetClient", "indicates", "an", "expected", "call", "of", "GetClient" ]
[ "func", "(", "mr", "*", "MockECRFactoryMockRecorder", ")", "GetClient", "(", "arg0", "<mask>", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockECRFactory", ")", "(", "nil", ")", ".", "GetClient", ")", ",", "arg0", ")", "\n", "}" ]
16,053
all-16054
[ "getOneTimePassword", "contains", "the", "implementation", "of", "GetOneTimePassword", "but", "is", "also", "called", "directly", "by", "handleSAMLREsponse", ".", "It", "generates", "a", "short", "-", "lived", "authentication", "code", "for", "username", "writes", "it", "to", "a", ".", "authenticationCodes", "and", "returns", "it" ]
[ "func", "(", "a", "*", "apiServer", ")", "getOneTimePassword", "(", "ctx", "context", ".", "Context", ",", "username", "string", ",", "expiration", "time", ".", "Time", ")", "(", "code", "string", ",", "err", "error", ")", "{", "// Create OTPInfo that will be stored", "otpInfo", ":=", "&", "authclient", ".", "OTPInfo", "{", "Subject", ":", "username", ",", "}", "\n", "if", "!", "expiration", ".", "IsZero", "(", ")", "{", "expirationProto", ",", "err", ":=", "types", ".", "TimestampProto", "(", "expiration", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "expiration", ".", "String", "(", ")", ",", "err", ")", "\n", "}", "\n", "otpInfo", ".", "SessionExpiration", "=", "expirationProto", "\n", "}", "\n\n", "// Generate and store new OTP", "code", "=", "\"", "\"", "+", "uuid", ".", "NewWithoutDashes", "(", ")", "\n", "if", "_", ",", "err", "=", "col", ".", "NewSTM", "(", "ctx", ",", "a", ".", "env", ".", "GetEtcdClient", "(", ")", ",", "func", "(", "stm", "<mask>", ".", "STM", ")", "error", "{", "return", "a", ".", "authenticationCodes", ".", "ReadWrite", "(", "stm", ")", ".", "PutTTL", "(", "hashToken", "(", "code", ")", ",", "otpInfo", ",", "defaultAuthCodeTTLSecs", ")", "\n", "}", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "code", ",", "nil", "\n", "}" ]
16,054
all-16055
[ "newImageDestination", "returns", "an", "ImageDestination", "for", "writing", "to", "a", "directory", "." ]
[ "func", "newImageDestination", "(", "ref", "dirReference", ",", "compress", "bool", ")", "(", "types", ".", "ImageDestination", ",", "error", ")", "{", "d", ":=", "&", "dirImageDestination", "{", "ref", ":", "ref", ",", "compress", ":", "compress", "}", "\n\n", "// If directory exists check if it is empty", "// if not empty, check whether the contents match that of a container image directory and overwrite the contents", "// if the contents don't match throw an error", "dirExists", ",", "err", ":=", "pathExists", "(", "d", ".", "ref", ".", "resolvedPath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "d", ".", "ref", ".", "resolvedPath", ")", "\n", "}", "\n", "if", "dirExists", "{", "isEmpty", ",", "err", ":=", "isDirEmpty", "(", "d", ".", "ref", ".", "resolvedPath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "!", "isEmpty", "{", "versionExists", ",", "err", ":=", "pathExists", "(", "d", ".", "ref", ".", "versionPath", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "d", ".", "ref", ".", "versionPath", "(", ")", ")", "\n", "}", "\n", "if", "versionExists", "{", "contents", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "d", ".", "ref", ".", "versionPath", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "// check if contents of version file is what we expect it to be", "if", "string", "(", "contents", ")", "!=", "version", "{", "return", "nil", ",", "ErrNotContainerImageDir", "\n", "}", "\n", "}", "else", "{", "return", "nil", ",", "ErrNotContainerImageDir", "\n", "}", "\n", "// delete directory contents so that only one image is in the directory at a time", "if", "err", "=", "removeDirContents", "(", "d", ".", "ref", ".", "resolvedPath", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "d", ".", "ref", ".", "resolvedPath", ")", "\n", "}", "\n", "logrus", ".", "Debugf", "(", "\"", "\"", ",", "d", ".", "ref", ".", "resolvedPath", ")", "\n", "}", "\n", "}", "else", "{", "// create directory if it doesn't exist", "if", "err", ":=", "os", ".", "MkdirAll", "(", "d", ".", "ref", ".", "resolvedPath", ",", "0755", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "d", ".", "ref", ".", "resolvedPath", ")", "\n", "}", "\n", "}", "\n", "// create version file", "err", "=", "ioutil", ".", "WriteFile", "(", "d", ".", "ref", ".", "versionPath", "(", ")", ",", "[", "]", "<mask>", "(", "version", ")", ",", "0644", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "d", ".", "ref", ".", "versionPath", "(", ")", ")", "\n", "}", "\n", "return", "d", ",", "nil", "\n", "}" ]
16,055
all-16056
[ "copy", "all", "or", "part", "of", "the", "data", "store", "of", "a", "buffer", "object", "to", "the", "data", "store", "of", "another", "buffer", "object" ]
[ "func", "CopyNamedBufferSubData", "(", "readBuffer", "uint32", ",", "writeBuffer", "uint32", ",", "readOffset", "int", ",", "writeOffset", "int", ",", "<mask>", "int", ")", "{", "syscall", ".", "Syscall6", "(", "gpCopyNamedBufferSubData", ",", "5", ",", "uintptr", "(", "readBuffer", ")", ",", "uintptr", "(", "writeBuffer", ")", ",", "uintptr", "(", "readOffset", ")", ",", "uintptr", "(", "writeOffset", ")", ",", "uintptr", "(", "size", ")", ",", "0", ")", "\n", "}" ]
16,056
all-16057
[ "extendVmfsDatastore", "is", "a", "stop", "-", "gap", "method", "that", "implements", "ExtendVmfsDatastore", ".", "It", "will", "be", "removed", "once", "the", "higher", "level", "HostDatastoreSystem", "object", "supports", "this", "method", "." ]
[ "func", "extendVmfsDatastore", "(", "ctx", "context", ".", "Context", ",", "s", "*", "object", ".", "HostDatastoreSystem", ",", "ds", "*", "object", ".", "Datastore", ",", "spec", "types", ".", "VmfsDatastoreExtendSpec", ")", "(", "*", "<mask>", ".", "Datastore", ",", "error", ")", "{", "req", ":=", "types", ".", "ExtendVmfsDatastore", "{", "This", ":", "s", ".", "Reference", "(", ")", ",", "Datastore", ":", "ds", ".", "Reference", "(", ")", ",", "Spec", ":", "spec", ",", "}", "\n\n", "res", ",", "err", ":=", "methods", ".", "ExtendVmfsDatastore", "(", "ctx", ",", "s", ".", "Client", "(", ")", ",", "&", "req", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "object", ".", "NewDatastore", "(", "s", ".", "Client", "(", ")", ",", "res", ".", "Returnval", ")", ",", "nil", "\n", "}" ]
16,057
all-16058
[ "ServeHTTP", "implement", "http", ".", "Handler", "interface" ]
[ "func", "(", "route", "*", "Route", ")", "ServeHTTP", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "<mask>", ".", "Request", ")", "{", "c", ":=", "&", "Context", "{", "route", ":", "route", "}", "\n", "route", ".", "ServeHTTPContext", "(", "w", ",", "r", ",", "c", ")", "\n", "}" ]
16,058
all-16059
[ "IgnoreNetOpError", "returns", "true", "when", "the", "passed", "error", "is", "a", "net", ".", "OpError", "with", "error", "use", "of", "closed", "network", "connection", "." ]
[ "func", "IgnoreNetOpError", "(", "err", "error", ")", "bool", "{", "if", "opErr", ",", "ok", ":=", "err", ".", "(", "*", "net", ".", "OpError", ")", ";", "<mask>", "{", "return", "opErr", ".", "Err", ".", "Error", "(", ")", "==", "\"", "\"", "\n", "}", "\n", "return", "false", "\n", "}" ]
16,059
all-16060
[ "getSize", "()", "adds", "up", "the", "sizes", "of", "the", "image", "s", "data", "blobs", "(", "which", "includes", "the", "configuration", "blob", ")", "the", "signatures", "and", "the", "uncompressed", "sizes", "of", "all", "of", "the", "image", "s", "layers", "." ]
[ "func", "(", "s", "*", "storageImageSource", ")", "getSize", "(", ")", "(", "int64", ",", "error", ")", "{", "var", "sum", "int64", "\n", "// Size up the data blobs.", "dataNames", ",", "err", ":=", "s", ".", "imageRef", ".", "transport", ".", "store", ".", "ListImageBigData", "(", "s", ".", "image", ".", "ID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "s", ".", "image", ".", "ID", ")", "\n", "}", "\n", "for", "_", ",", "dataName", ":=", "range", "dataNames", "{", "bigSize", ",", "err", ":=", "s", ".", "imageRef", ".", "transport", ".", "store", ".", "ImageBigDataSize", "(", "s", ".", "image", ".", "<mask>", ",", "dataName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "dataName", ",", "s", ".", "image", ".", "ID", ")", "\n", "}", "\n", "sum", "+=", "bigSize", "\n", "}", "\n", "// Add the signature sizes.", "for", "_", ",", "sigSize", ":=", "range", "s", ".", "SignatureSizes", "{", "sum", "+=", "int64", "(", "sigSize", ")", "\n", "}", "\n", "// Walk the layer list.", "layerID", ":=", "s", ".", "image", ".", "TopLayer", "\n", "for", "layerID", "!=", "\"", "\"", "{", "layer", ",", "err", ":=", "s", ".", "imageRef", ".", "transport", ".", "store", ".", "Layer", "(", "layerID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "err", "\n", "}", "\n", "if", "layer", ".", "UncompressedDigest", "==", "\"", "\"", "||", "layer", ".", "UncompressedSize", "<", "0", "{", "return", "-", "1", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "layerID", ")", "\n", "}", "\n", "sum", "+=", "layer", ".", "UncompressedSize", "\n", "if", "layer", ".", "Parent", "==", "\"", "\"", "{", "break", "\n", "}", "\n", "layerID", "=", "layer", ".", "Parent", "\n", "}", "\n", "return", "sum", ",", "nil", "\n", "}" ]
16,060
all-16061
[ "FindByClass", "finds", "exactly", "one", "element", "with", "a", "given", "CSS", "class", "." ]
[ "func", "(", "s", "*", "selectable", ")", "FindByClass", "(", "text", "string", ")", "*", "Selection", "{", "return", "newSelection", "(", "s", ".", "session", ",", "s", ".", "selectors", ".", "Append", "(", "<mask>", ".", "Class", ",", "text", ")", ".", "Single", "(", ")", ")", "\n", "}" ]
16,061
all-16062
[ "LoadRepoAliases", "returns", "an", "up", "-", "to", "-", "date", "RepoAliases", "struct", "for", "the", "specified", "repo", ".", "If", "the", "repo", "does", "not", "have", "an", "aliases", "file", "then", "an", "empty", "alias", "map", "is", "returned", "with", "no", "error", ".", "Note", ":", "The", "returned", "RepoAliases", "should", "be", "treated", "as", "read", "only", "." ]
[ "func", "(", "c", "*", "Client", ")", "LoadRepoAliases", "(", "org", ",", "repo", ",", "base", "string", ")", "(", "RepoAliases", ",", "error", ")", "{", "log", ":=", "c", ".", "logger", ".", "WithFields", "(", "logrus", ".", "Fields", "{", "\"", "\"", ":", "org", ",", "\"", "\"", ":", "repo", ",", "\"", "\"", ":", "base", "}", ")", "\n", "cloneRef", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "repo", ")", "\n", "fullName", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "cloneRef", ",", "base", ")", "\n\n", "sha", ",", "err", ":=", "c", ".", "ghc", ".", "GetRef", "(", "org", ",", "repo", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "base", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "fullName", ",", "err", ")", "\n", "}", "\n\n", "c", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "lock", ".", "Unlock", "(", ")", "\n", "entry", ",", "ok", ":=", "c", ".", "cache", "[", "fullName", "]", "\n", "if", "!", "ok", "||", "entry", ".", "sha", "!=", "sha", "{", "// entry is non-existent or stale.", "gitRepo", ",", "err", ":=", "c", ".", "git", ".", "Clone", "(", "cloneRef", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "cloneRef", ",", "err", ")", "\n", "}", "\n", "defer", "gitRepo", ".", "Clean", "(", ")", "\n", "if", "err", ":=", "gitRepo", ".", "Checkout", "(", "base", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "entry", ".", "aliases", "=", "loadAliasesFrom", "(", "gitRepo", ".", "Dir", ",", "log", ")", "\n", "<mask>", ".", "sha", "=", "sha", "\n", "c", ".", "cache", "[", "fullName", "]", "=", "entry", "\n", "}", "\n\n", "return", "entry", ".", "aliases", ",", "nil", "\n", "}" ]
16,062
all-16063
[ "List", "takes", "label", "and", "field", "selectors", "and", "returns", "the", "list", "of", "Apps", "that", "match", "those", "selectors", "." ]
[ "func", "(", "c", "*", "FakeApps", ")", "List", "(", "opts", "v1", ".", "ListOptions", ")", "(", "result", "*", "tsuru_v1", ".", "AppList", ",", "err", "error", ")", "{", "obj", ",", "err", ":=", "c", ".", "Fake", ".", "Invokes", "(", "testing", ".", "NewListAction", "(", "appsResource", ",", "appsKind", ",", "c", ".", "ns", ",", "opts", ")", ",", "&", "tsuru_v1", ".", "AppList", "{", "}", ")", "\n\n", "if", "obj", "==", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "label", ",", "_", ",", "_", ":=", "testing", ".", "ExtractFromListOptions", "(", "opts", ")", "\n", "if", "label", "==", "nil", "{", "label", "=", "labels", ".", "Everything", "(", ")", "\n", "}", "\n", "list", ":=", "&", "tsuru_v1", ".", "AppList", "{", "}", "\n", "for", "_", ",", "item", ":=", "range", "obj", ".", "(", "*", "tsuru_v1", ".", "AppList", ")", ".", "Items", "{", "if", "label", ".", "Matches", "(", "labels", ".", "<mask>", "(", "item", ".", "Labels", ")", ")", "{", "list", ".", "Items", "=", "append", "(", "list", ".", "Items", ",", "item", ")", "\n", "}", "\n", "}", "\n", "return", "list", ",", "err", "\n", "}" ]
16,063
all-16064
[ "VisitAll", "calls", "f", "for", "each", "header", ".", "f", "must", "not", "retain", "references", "to", "key", "and", "/", "or", "value", "after", "returning", ".", "Copy", "key", "and", "/", "or", "value", "contents", "before", "returning", "if", "you", "need", "retaining", "them", ".", "To", "get", "the", "headers", "in", "order", "they", "were", "received", "use", "VisitAllInOrder", "." ]
[ "func", "(", "h", "*", "RequestHeader", ")", "VisitAll", "(", "f", "func", "(", "key", ",", "value", "[", "]", "byte", ")", ")", "{", "h", ".", "parseRawHeaders", "(", ")", "\n", "host", ":=", "h", ".", "Host", "(", ")", "\n", "if", "len", "(", "host", ")", ">", "0", "{", "f", "(", "strHost", ",", "host", ")", "\n", "}", "\n", "if", "len", "(", "h", ".", "contentLengthBytes", ")", ">", "0", "{", "f", "(", "strContentLength", ",", "h", ".", "contentLengthBytes", ")", "\n", "}", "\n", "contentType", ":=", "h", ".", "ContentType", "(", ")", "\n", "if", "len", "(", "contentType", ")", ">", "0", "{", "f", "(", "strContentType", ",", "contentType", ")", "\n", "}", "\n", "userAgent", ":=", "h", ".", "UserAgent", "(", ")", "\n", "if", "len", "(", "userAgent", ")", ">", "0", "{", "f", "(", "strUserAgent", ",", "userAgent", ")", "\n", "}", "\n\n", "h", ".", "collectCookies", "(", ")", "\n", "if", "len", "(", "h", ".", "cookies", ")", ">", "0", "{", "h", ".", "bufKV", ".", "<mask>", "=", "appendRequestCookieBytes", "(", "h", ".", "bufKV", ".", "value", "[", ":", "0", "]", ",", "h", ".", "cookies", ")", "\n", "f", "(", "strCookie", ",", "h", ".", "bufKV", ".", "value", ")", "\n", "}", "\n", "visitArgs", "(", "h", ".", "h", ",", "f", ")", "\n", "if", "h", ".", "ConnectionClose", "(", ")", "{", "f", "(", "strConnection", ",", "strClose", ")", "\n", "}", "\n", "}" ]
16,064
all-16065
[ "GetNoGroupHosts", "returns", "the", "NoGroupHosts", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "t", "*", "TileDef", ")", "GetNoGroupHosts", "(", ")", "bool", "{", "if", "t", "==", "nil", "||", "t", ".", "NoGroupHosts", "==", "nil", "{", "return", "<mask>", "\n", "}", "\n", "return", "*", "t", ".", "NoGroupHosts", "\n", "}" ]
16,065
all-16066
[ "SaveConfig", "writes", "the", "provided", "configuration", "to", "the", "config", "file", "." ]
[ "func", "(", "c", "*", "Config", ")", "SaveConfig", "(", "<mask>", "string", ")", "error", "{", "// Create a new copy for the config file", "conf", ":=", "Config", "{", "}", "\n", "err", ":=", "shared", ".", "DeepCopy", "(", "c", ",", "&", "conf", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "// Remove the static remotes", "for", "k", ":=", "range", "StaticRemotes", "{", "if", "k", "==", "\"", "\"", "{", "continue", "\n", "}", "\n\n", "delete", "(", "conf", ".", "Remotes", ",", "k", ")", "\n", "}", "\n\n", "// Create the config file (or truncate an existing one)", "f", ",", "err", ":=", "os", ".", "Create", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "defer", "f", ".", "Close", "(", ")", "\n\n", "// Write the new config", "data", ",", "err", ":=", "yaml", ".", "Marshal", "(", "conf", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "_", ",", "err", "=", "f", ".", "Write", "(", "data", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
16,066
all-16067
[ "ListPluginsWithFilters", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockDockerClient", ")", "ListPluginsWithFilters", "(", "arg0", "context", ".", "Context", ",", "arg1", "bool", ",", "arg2", "[", "]", "string", ",", "arg3", "time", ".", "Duration", ")", "(", "[", "]", "string", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ",", "arg1", ",", "arg2", ",", "arg3", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "[", "]", "string", ")", "\n", "ret1", ",", "_", ":=", "<mask>", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
16,067
all-16068
[ "ResourceGroupLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "ResourceGroupLocator", "(", "href", "<mask>", ")", "*", "ResourceGroupLocator", "{", "return", "&", "ResourceGroupLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
16,068
all-16069
[ "Redirect", "sets", "Location", ":", "uri", "response", "header", "and", "sets", "the", "given", "statusCode", ".", "statusCode", "must", "have", "one", "of", "the", "following", "values", ":", "*", "StatusMovedPermanently", "(", "301", ")", "*", "StatusFound", "(", "302", ")", "*", "StatusSeeOther", "(", "303", ")", "*", "StatusTemporaryRedirect", "(", "307", ")", "*", "StatusPermanentRedirect", "(", "308", ")", "All", "other", "statusCode", "values", "are", "replaced", "by", "StatusFound", "(", "302", ")", ".", "The", "redirect", "uri", "may", "be", "either", "absolute", "or", "relative", "to", "the", "current", "request", "uri", ".", "Fasthttp", "will", "always", "send", "an", "absolute", "uri", "back", "to", "the", "client", ".", "To", "send", "a", "relative", "uri", "you", "can", "use", "the", "following", "code", ":", "strLocation", "=", "[]", "byte", "(", "Location", ")", "//", "Put", "this", "with", "your", "top", "level", "var", "()", "declarations", ".", "ctx", ".", "Response", ".", "Header", ".", "SetCanonical", "(", "strLocation", "/", "relative?uri", ")", "ctx", ".", "Response", ".", "SetStatusCode", "(", "fasthttp", ".", "StatusMovedPermanently", ")" ]
[ "func", "(", "ctx", "*", "RequestCtx", ")", "Redirect", "(", "uri", "<mask>", ",", "statusCode", "int", ")", "{", "u", ":=", "AcquireURI", "(", ")", "\n", "ctx", ".", "URI", "(", ")", ".", "CopyTo", "(", "u", ")", "\n", "u", ".", "Update", "(", "uri", ")", "\n", "ctx", ".", "redirect", "(", "u", ".", "FullURI", "(", ")", ",", "statusCode", ")", "\n", "ReleaseURI", "(", "u", ")", "\n", "}" ]
16,069
all-16070
[ "Return", "value", "has", "type", "C", ".", "GLVULKANPROCNV", "." ]
[ "func", "GetVkProcAddrNV", "(", "name", "*", "uint8", ")", "unsafe", ".", "Pointer", "{", "<mask>", ":=", "C", ".", "glowGetVkProcAddrNV", "(", "gpGetVkProcAddrNV", ",", "(", "*", "C", ".", "GLchar", ")", "(", "unsafe", ".", "Pointer", "(", "name", ")", ")", ")", "\n", "return", "(", "unsafe", ".", "Pointer", ")", "(", "ret", ")", "\n", "}" ]
16,070
all-16071
[ "NewVolumesResponse", "creates", "VolumeResponse", "for", "a", "container" ]
[ "func", "NewVolumesResponse", "(", "dockerContainer", "*", "apicontainer", ".", "DockerContainer", ")", "[", "]", "VolumeResponse", "{", "container", ":=", "dockerContainer", ".", "Container", "\n", "var", "resp", "[", "]", "VolumeResponse", "\n\n", "volumes", ":=", "<mask>", ".", "GetVolumes", "(", ")", "\n\n", "for", "_", ",", "volume", ":=", "range", "volumes", "{", "volResp", ":=", "VolumeResponse", "{", "DockerName", ":", "volume", ".", "Name", ",", "Source", ":", "volume", ".", "Source", ",", "Destination", ":", "volume", ".", "Destination", ",", "}", "\n\n", "resp", "=", "append", "(", "resp", ",", "volResp", ")", "\n", "}", "\n", "return", "resp", "\n", "}" ]
16,071
all-16072
[ "NotifyUpgradeCompleted", "sends", "a", "notification", "to", "all", "other", "nodes", "in", "the", "cluster", "that", "any", "possible", "pending", "database", "update", "has", "been", "applied", "and", "any", "nodes", "which", "was", "waiting", "for", "this", "node", "to", "be", "upgraded", "should", "re", "-", "check", "if", "it", "s", "okay", "to", "move", "forward", "." ]
[ "func", "NotifyUpgradeCompleted", "(", "state", "*", "state", ".", "State", ",", "cert", "*", "shared", ".", "CertInfo", ")", "error", "{", "notifier", ",", "err", ":=", "NewNotifier", "(", "state", ",", "cert", ",", "NotifyAll", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "notifier", "(", "func", "(", "client", "lxd", ".", "ContainerServer", ")", "error", "{", "info", ",", "err", ":=", "client", ".", "GetConnectionInfo", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "url", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "info", ".", "Addresses", "[", "0", "]", ",", "databaseEndpoint", ")", "\n", "request", ",", "err", ":=", "http", ".", "NewRequest", "(", "\"", "\"", ",", "url", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "httpClient", ",", "err", ":=", "client", ".", "GetHTTPClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "response", ",", "err", ":=", "httpClient", ".", "Do", "(", "request", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "<mask>", ".", "StatusCode", "!=", "http", ".", "StatusOK", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "response", ".", "Status", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}", ")", "\n", "}" ]
16,072
all-16073
[ "GetTitleAlignOk", "returns", "a", "tuple", "with", "the", "TitleAlign", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "Widget", ")", "GetTitleAlignOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "w", "==", "nil", "||", "w", ".", "TitleAlign", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "w", ".", "TitleAlign", ",", "<mask>", "\n", "}" ]
16,073
all-16074
[ "===", "minute", "(", "v", "Vector", ")", "Scalar", "===" ]
[ "func", "funcMinute", "(", "vals", "[", "]", "Value", ",", "args", "Expressions", ",", "enh", "*", "EvalNodeHelper", ")", "Vector", "{", "return", "dateWrapper", "(", "vals", ",", "enh", ",", "func", "(", "t", "<mask>", ".", "Time", ")", "float64", "{", "return", "float64", "(", "t", ".", "Minute", "(", ")", ")", "\n", "}", ")", "\n", "}" ]
16,074
all-16075
[ "RoutePattern", "builds", "the", "routing", "pattern", "string", "for", "the", "particular", "request", "at", "the", "particular", "point", "during", "routing", ".", "This", "means", "the", "value", "will", "change", "throughout", "the", "execution", "of", "a", "request", "in", "a", "router", ".", "That", "is", "why", "its", "advised", "to", "only", "use", "this", "value", "after", "calling", "the", "next", "handler", ".", "For", "example", "func", "Instrument", "(", "next", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", "r", "*", "http", ".", "Request", ")", "{", "next", ".", "ServeHTTP", "(", "w", "r", ")", "routePattern", ":", "=", "chi", ".", "RouteContext", "(", "r", ".", "Context", "()", ")", ".", "RoutePattern", "()", "measure", "(", "w", "r", "routePattern", ")", "}", ")", "}" ]
[ "func", "(", "x", "*", "<mask>", ")", "RoutePattern", "(", ")", "string", "{", "routePattern", ":=", "strings", ".", "Join", "(", "x", ".", "RoutePatterns", ",", "\"", "\"", ")", "\n", "return", "strings", ".", "Replace", "(", "routePattern", ",", "\"", "\"", ",", "\"", "\"", ",", "-", "1", ")", "\n", "}" ]
16,075
all-16076
[ "DoesHandle", "satisfies", "hookHandler", "." ]
[ "func", "(", "g", "GitlabHook", ")", "DoesHandle", "(", "h", "http", ".", "Header", ")", "bool", "{", "<mask>", ":=", "h", ".", "Get", "(", "\"", "\"", ")", "\n\n", "// for Gitlab you can only use X-Gitlab-Event header to test if you could handle the request", "if", "event", "!=", "\"", "\"", "{", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}" ]
16,076
all-16077
[ "HasPrivateKey", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "i", "*", "IntegrationGCPCreateRequest", ")", "HasPrivateKey", "(", ")", "bool", "{", "if", "i", "!=", "nil", "&&", "i", ".", "PrivateKey", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
16,077
all-16078
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetResourceTreeParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage31", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
16,078
all-16079
[ "List", "takes", "label", "and", "field", "selectors", "and", "returns", "the", "list", "of", "ProwJobs", "that", "match", "those", "selectors", "." ]
[ "func", "(", "c", "*", "prowJobs", ")", "List", "(", "opts", "metav1", ".", "ListOptions", ")", "(", "result", "*", "v1", ".", "ProwJobList", ",", "err", "error", ")", "{", "result", "=", "&", "v1", ".", "ProwJobList", "{", "}", "\n", "err", "=", "c", ".", "client", ".", "Get", "(", ")", ".", "Namespace", "(", "c", ".", "<mask>", ")", ".", "Resource", "(", "\"", "\"", ")", ".", "VersionedParams", "(", "&", "opts", ",", "scheme", ".", "ParameterCodec", ")", ".", "Do", "(", ")", ".", "Into", "(", "result", ")", "\n", "return", "\n", "}" ]
16,079
all-16080
[ "PrettyPrintVersion", "returns", "a", "version", "string", "optionally", "tagged", "with", "metadata", ".", "For", "example", ":", "1", ".", "2", ".", "3", "or", "1", ".", "2", ".", "3rc1", "if", "version", ".", "Additional", "is", "rc1", "." ]
[ "func", "PrettyPrintVersion", "(", "<mask>", "*", "pb", ".", "Version", ")", "string", "{", "result", ":=", "PrettyPrintVersionNoAdditional", "(", "version", ")", "\n", "if", "version", ".", "Additional", "!=", "\"", "\"", "{", "result", "+=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "version", ".", "Additional", ")", "\n", "}", "\n", "return", "result", "\n", "}" ]
16,080
all-16081
[ "CreateProjectCard", "adds", "a", "project", "card", "to", "the", "specified", "project", "column", ".", "See", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "projects", "/", "cards", "/", "#create", "-", "a", "-", "project", "-", "card" ]
[ "func", "(", "c", "*", "Client", ")", "CreateProjectCard", "(", "columnID", "int", ",", "projectCard", "ProjectCard", ")", "(", "*", "ProjectCard", ",", "error", ")", "{", "c", ".", "log", "(", "\"", "\"", ",", "columnID", ",", "projectCard", ")", "\n", "if", "(", "projectCard", ".", "ContentType", "!=", "\"", "\"", ")", "&&", "(", "projectCard", ".", "ContentType", "!=", "\"", "\"", ")", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "c", ".", "dry", "{", "return", "&", "projectCard", ",", "nil", "\n", "}", "\n", "path", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "columnID", ")", "\n", "var", "retProjectCard", "ProjectCard", "\n", "_", ",", "err", ":=", "c", ".", "request", "(", "&", "request", "{", "<mask>", ":", "http", ".", "MethodPost", ",", "path", ":", "path", ",", "accept", ":", "\"", "\"", ",", "requestBody", ":", "&", "projectCard", ",", "exitCodes", ":", "[", "]", "int", "{", "200", "}", ",", "}", ",", "&", "retProjectCard", ")", "\n", "return", "&", "retProjectCard", ",", "err", "\n", "}" ]
16,081
all-16082
[ "AddFlags", "adds", "flags", "to", "the", "FlagSet", "that", "populate", "the", "GCS", "upload", "options", "struct", "given", "." ]
[ "func", "(", "o", "*", "Options", ")", "AddFlags", "(", "fs", "*", "<mask>", ".", "FlagSet", ")", "{", "fs", ".", "StringVar", "(", "&", "o", ".", "SrcRoot", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "fs", ".", "StringVar", "(", "&", "o", ".", "Log", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "fs", ".", "StringVar", "(", "&", "o", ".", "GitUserName", ",", "\"", "\"", ",", "DefaultGitUserName", ",", "\"", "\"", ")", "\n", "fs", ".", "StringVar", "(", "&", "o", ".", "GitUserEmail", ",", "\"", "\"", ",", "DefaultGitUserEmail", ",", "\"", "\"", ")", "\n", "fs", ".", "Var", "(", "&", "o", ".", "refs", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "fs", ".", "Var", "(", "&", "o", ".", "keys", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "fs", ".", "Var", "(", "&", "o", ".", "clonePath", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "fs", ".", "Var", "(", "&", "o", ".", "cloneURI", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "fs", ".", "IntVar", "(", "&", "o", ".", "MaxParallelWorkers", ",", "\"", "\"", ",", "0", ",", "\"", "\"", ")", "\n", "fs", ".", "StringVar", "(", "&", "o", ".", "CookiePath", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "}" ]
16,082
all-16083
[ "CollectActiveObjectsAndTags", "collects", "all", "objects", "/", "tags", "that", "are", "not", "deleted", "or", "eligible", "for", "garbage", "collection" ]
[ "func", "CollectActiveObjectsAndTags", "(", "ctx", "context", ".", "Context", ",", "pachClient", "*", "client", ".", "APIClient", ",", "repoInfos", "[", "]", "*", "pfs", ".", "RepoInfo", ",", "pipelineInfos", "[", "]", "*", "pps", ".", "PipelineInfo", ",", "memoryAllowance", "int", ",", "storageRoot", "string", ")", "(", "*", "ActiveStat", ",", "error", ")", "{", "if", "memoryAllowance", "==", "0", "{", "memoryAllowance", "=", "defaultGCMemory", "\n", "}", "\n", "result", ":=", "&", "ActiveStat", "{", "// Each bloom filter gets half the memory allowance, times 8 to convert", "// from bytes to bits.", "Objects", ":", "bloom", ".", "New", "(", "uint", "(", "memoryAllowance", "*", "8", "/", "2", ")", ",", "10", ")", ",", "Tags", ":", "bloom", ".", "New", "(", "uint", "(", "memoryAllowance", "*", "8", "/", "2", ")", ",", "10", ")", ",", "}", "\n", "var", "activeObjectsMu", "sync", ".", "Mutex", "\n", "// A helper function for adding active objects in a thread-safe way", "addActiveObjects", ":=", "func", "(", "objects", "...", "*", "pfs", ".", "Object", ")", "{", "activeObjectsMu", ".", "Lock", "(", ")", "\n", "defer", "activeObjectsMu", ".", "Unlock", "(", ")", "\n", "for", "_", ",", "object", ":=", "range", "objects", "{", "if", "object", "!=", "nil", "{", "result", ".", "NObjects", "++", "\n", "result", ".", "Objects", ".", "AddString", "(", "object", ".", "Hash", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "// A helper function for adding objects that are actually hash trees,", "// which in turn contain active objects.", "addActiveTree", ":=", "func", "(", "object", "*", "pfs", ".", "Object", ")", "error", "{", "if", "object", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "addActiveObjects", "(", "object", ")", "\n", "tree", ",", "err", ":=", "hashtree", ".", "GetHashTreeObject", "(", "pachClient", ",", "storageRoot", ",", "object", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "tree", ".", "Walk", "(", "\"", "\"", ",", "func", "(", "path", "string", ",", "node", "*", "hashtree", ".", "NodeProto", ")", "error", "{", "if", "node", ".", "FileNode", "!=", "nil", "{", "addActiveObjects", "(", "node", ".", "FileNode", ".", "Objects", "...", ")", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "}", "\n\n", "// Get all commit trees", "limiter", ":=", "limit", ".", "New", "(", "100", ")", "\n", "<mask>", "eg", "errgroup", ".", "Group", "\n", "for", "_", ",", "repo", ":=", "range", "repoInfos", "{", "repo", ":=", "repo", "\n", "client", ",", "err", ":=", "pachClient", ".", "ListCommitStream", "(", "ctx", ",", "&", "pfs", ".", "ListCommitRequest", "{", "Repo", ":", "repo", ".", "Repo", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "for", "{", "ci", ",", "err", ":=", "client", ".", "Recv", "(", ")", "\n", "if", "err", "==", "io", ".", "EOF", "{", "break", "\n", "}", "else", "if", "err", "!=", "nil", "{", "return", "nil", ",", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "limiter", ".", "Acquire", "(", ")", "\n", "eg", ".", "Go", "(", "func", "(", ")", "error", "{", "defer", "limiter", ".", "Release", "(", ")", "\n", "// (bryce) This needs some notion of active blockrefs since these trees do not use objects", "addActiveObjects", "(", "ci", ".", "Trees", "...", ")", "\n", "addActiveObjects", "(", "ci", ".", "Datums", ")", "\n", "return", "addActiveTree", "(", "ci", ".", "Tree", ")", "\n", "}", ")", "\n", "}", "\n", "}", "\n", "if", "err", ":=", "eg", ".", "Wait", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "eg", "=", "errgroup", ".", "Group", "{", "}", "\n", "for", "_", ",", "pipelineInfo", ":=", "range", "pipelineInfos", "{", "tags", ",", "err", ":=", "pachClient", ".", "ObjectAPIClient", ".", "ListTags", "(", "pachClient", ".", "Ctx", "(", ")", ",", "&", "pfs", ".", "ListTagsRequest", "{", "Prefix", ":", "client", ".", "DatumTagPrefix", "(", "pipelineInfo", ".", "Salt", ")", ",", "IncludeObject", ":", "true", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "for", "resp", ",", "err", ":=", "tags", ".", "Recv", "(", ")", ";", "err", "!=", "io", ".", "EOF", ";", "resp", ",", "err", "=", "tags", ".", "Recv", "(", ")", "{", "resp", ":=", "resp", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "result", ".", "Tags", ".", "AddString", "(", "resp", ".", "Tag", ".", "Name", ")", "\n", "result", ".", "NTags", "++", "\n", "limiter", ".", "Acquire", "(", ")", "\n", "eg", ".", "Go", "(", "func", "(", ")", "error", "{", "defer", "limiter", ".", "Release", "(", ")", "\n", "// (bryce) Same as above", "addActiveObjects", "(", "resp", ".", "Object", ")", "\n", "return", "nil", "\n", "}", ")", "\n", "}", "\n", "}", "\n", "if", "err", ":=", "eg", ".", "Wait", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "result", ",", "nil", "\n", "}" ]
16,083
all-16084
[ "NoIssueApprovers", "returns", "the", "list", "of", "people", "who", "have", "no", "-", "issue", "approved", "the", "pull", "-", "request", ".", "They", "are", "included", "in", "the", "list", "iff", "they", "can", "approve", "one", "of", "the", "files", "." ]
[ "func", "(", "ap", "Approvers", ")", "NoIssueApprovers", "(", ")", "<mask>", "[", "string", "]", "Approval", "{", "nia", ":=", "map", "[", "string", "]", "Approval", "{", "}", "\n", "reverseMap", ":=", "ap", ".", "owners", ".", "GetReverseMap", "(", "ap", ".", "owners", ".", "GetApprovers", "(", ")", ")", "\n\n", "for", "login", ",", "approver", ":=", "range", "ap", ".", "approvers", "{", "if", "!", "approver", ".", "NoIssue", "{", "continue", "\n", "}", "\n\n", "if", "len", "(", "reverseMap", "[", "login", "]", ")", "==", "0", "{", "continue", "\n", "}", "\n\n", "nia", "[", "login", "]", "=", "approver", "\n", "}", "\n\n", "return", "nia", "\n", "}" ]
16,084
all-16085
[ "Write", "logs", "an", "Debug", "message", "to", "a", "logger", "." ]
[ "func", "(", "lw", "DebugLogWriter", ")", "Write", "(", "p", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "lw", ".", "Debug", "(", "string", "(", "<mask>", ".", "TrimRightFunc", "(", "p", ",", "unicode", ".", "IsSpace", ")", ")", ")", "\n", "return", "len", "(", "p", ")", ",", "nil", "\n", "}" ]
16,085
all-16086
[ "Parse", "runs", "the", "Go", "parser", "against", "the", "given", "package", "name", "." ]
[ "func", "Parse", "(", "name", "string", ")", "(", "*", "ast", ".", "Package", ",", "error", ")", "{", "base", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "if", "base", "==", "\"", "\"", "{", "base", "=", "\"", "\"", "\n", "}", "\n", "dir", ":=", "filepath", ".", "Join", "(", "base", ",", "\"", "\"", ",", "name", ")", "\n\n", "fset", ":=", "token", ".", "NewFileSet", "(", ")", "\n\n", "paths", ",", "err", ":=", "filepath", ".", "Glob", "(", "filepath", ".", "Join", "(", "dir", ",", "\"", "\"", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "files", ":=", "map", "[", "string", "]", "*", "ast", ".", "File", "{", "}", "\n", "for", "_", ",", "path", ":=", "range", "paths", "{", "// Skip test files.", "if", "strings", ".", "Contains", "(", "path", ",", "\"", "\"", ")", "{", "continue", "\n", "}", "\n\n", "file", ",", "err", ":=", "parser", ".", "ParseFile", "(", "fset", ",", "path", ",", "nil", ",", "parser", ".", "ParseComments", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "path", ")", "\n", "}", "\n\n", "files", "[", "path", "]", "=", "file", "\n", "}", "\n\n", "// Ignore errors because they are typically about unresolved symbols.", "pkg", ",", "_", ":=", "ast", ".", "NewPackage", "(", "fset", ",", "<mask>", ",", "nil", ",", "nil", ")", "\n\n", "return", "pkg", ",", "nil", "\n", "}" ]
16,086
all-16087
[ "flattenDVSNameArrayUplinkPortPolicy", "reads", "various", "fields", "from", "a", "DVSNameArrayUplinkPortPolicy", "into", "the", "passed", "in", "ResourceData", "." ]
[ "func", "flattenDVSNameArrayUplinkPortPolicy", "(", "d", "*", "schema", ".", "ResourceData", ",", "obj", "*", "types", ".", "DVSNameArrayUplinkPortPolicy", ")", "error", "{", "if", "err", ":=", "d", ".", "<mask>", "(", "\"", "\"", ",", "obj", ".", "UplinkPortName", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
16,087
all-16088
[ "Delete", "removes", "a", "key", "-", "value", "pair", "from", "the", "cedar", ".", "It", "will", "return", "ErrNoPath", "if", "the", "key", "has", "not", "been", "added", "." ]
[ "func", "(", "da", "*", "Cedar", ")", "Delete", "(", "key", "[", "]", "byte", ")", "error", "{", "// if the path does not exist, or the end is not a leaf, nothing to delete", "to", ",", "err", ":=", "da", ".", "Jump", "(", "key", ",", "0", ")", "\n", "if", "err", "!=", "nil", "{", "return", "ErrNoPath", "\n", "}", "\n\n", "if", "da", ".", "Array", "[", "to", "]", ".", "Value", "<", "0", "{", "base", ":=", "da", ".", "Array", "[", "to", "]", ".", "base", "(", ")", "\n", "if", "da", ".", "Array", "[", "base", "]", ".", "Check", "==", "to", "{", "to", "=", "base", "\n", "}", "\n", "}", "\n\n", "for", "to", ">", "0", "{", "from", ":=", "da", ".", "Array", "[", "to", "]", ".", "Check", "\n", "base", ":=", "da", ".", "Array", "[", "from", "]", ".", "base", "(", ")", "\n", "label", ":=", "byte", "(", "to", "^", "base", ")", "\n\n", "// if `to` has sibling, remove `to` from the sibling list, then stop", "if", "da", ".", "Ninfos", "[", "to", "]", ".", "Sibling", "!=", "0", "||", "da", ".", "Ninfos", "[", "from", "]", ".", "Child", "!=", "label", "{", "// delete the label from the child ring first", "da", ".", "popSibling", "(", "from", ",", "<mask>", ",", "label", ")", "\n", "// then release the current node `to` to the empty node ring", "da", ".", "pushEnode", "(", "to", ")", "\n", "break", "\n", "}", "\n", "// otherwise, just release the current node `to` to the empty node ring", "da", ".", "pushEnode", "(", "to", ")", "\n", "// then check its parent node", "to", "=", "from", "\n", "}", "\n", "return", "nil", "\n", "}" ]
16,088
all-16089
[ "LoadCert", "reads", "the", "LXD", "server", "certificate", "from", "the", "given", "var", "dir", ".", "If", "a", "cluster", "certificate", "is", "found", "it", "will", "be", "loaded", "instead", "." ]
[ "func", "LoadCert", "(", "dir", "string", ")", "(", "*", "shared", ".", "CertInfo", ",", "error", ")", "{", "<mask>", ":=", "\"", "\"", "\n", "if", "shared", ".", "PathExists", "(", "filepath", ".", "Join", "(", "dir", ",", "\"", "\"", ")", ")", "{", "prefix", "=", "\"", "\"", "\n", "}", "\n", "cert", ",", "err", ":=", "shared", ".", "KeyPairAndCA", "(", "dir", ",", "prefix", ",", "shared", ".", "CertServer", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "cert", ",", "nil", "\n", "}" ]
16,089
all-16090
[ "Draw", "draws", "the", "current", "tile", "to", "the", "given", "boardImage", "." ]
[ "func", "(", "t", "*", "Tile", ")", "Draw", "(", "boardImage", "*", "ebiten", ".", "Image", ")", "{", "i", ",", "j", ":=", "t", ".", "current", ".", "x", ",", "t", ".", "current", ".", "y", "\n", "ni", ",", "nj", ":=", "t", ".", "next", ".", "x", ",", "t", ".", "next", ".", "y", "\n", "v", ":=", "t", ".", "current", ".", "value", "\n", "if", "v", "==", "0", "{", "return", "\n", "}", "\n", "op", ":=", "&", "ebiten", ".", "DrawImageOptions", "{", "}", "\n", "x", ":=", "i", "*", "tileSize", "+", "(", "i", "+", "1", ")", "*", "tileMargin", "\n", "y", ":=", "j", "*", "tileSize", "+", "(", "j", "+", "1", ")", "*", "tileMargin", "\n", "nx", ":=", "ni", "*", "tileSize", "+", "(", "ni", "+", "1", ")", "*", "tileMargin", "\n", "ny", ":=", "nj", "*", "tileSize", "+", "(", "nj", "+", "1", ")", "*", "tileMargin", "\n", "switch", "{", "case", "0", "<", "t", ".", "movingCount", ":", "rate", ":=", "1", "-", "float64", "(", "t", ".", "movingCount", ")", "/", "maxMovingCount", "\n", "x", "=", "mean", "(", "x", ",", "nx", ",", "<mask>", ")", "\n", "y", "=", "mean", "(", "y", ",", "ny", ",", "rate", ")", "\n", "case", "0", "<", "t", ".", "startPoppingCount", ":", "rate", ":=", "1", "-", "float64", "(", "t", ".", "startPoppingCount", ")", "/", "float64", "(", "maxPoppingCount", ")", "\n", "scale", ":=", "meanF", "(", "0.0", ",", "1.0", ",", "rate", ")", "\n", "op", ".", "GeoM", ".", "Translate", "(", "float64", "(", "-", "tileSize", "/", "2", ")", ",", "float64", "(", "-", "tileSize", "/", "2", ")", ")", "\n", "op", ".", "GeoM", ".", "Scale", "(", "scale", ",", "scale", ")", "\n", "op", ".", "GeoM", ".", "Translate", "(", "float64", "(", "tileSize", "/", "2", ")", ",", "float64", "(", "tileSize", "/", "2", ")", ")", "\n", "case", "0", "<", "t", ".", "poppingCount", ":", "const", "maxScale", "=", "1.2", "\n", "rate", ":=", "0.0", "\n", "if", "maxPoppingCount", "*", "2", "/", "3", "<=", "t", ".", "poppingCount", "{", "// 0 to 1", "rate", "=", "1", "-", "float64", "(", "t", ".", "poppingCount", "-", "2", "*", "maxPoppingCount", "/", "3", ")", "/", "float64", "(", "maxPoppingCount", "/", "3", ")", "\n", "}", "else", "{", "// 1 to 0", "rate", "=", "float64", "(", "t", ".", "poppingCount", ")", "/", "float64", "(", "maxPoppingCount", "*", "2", "/", "3", ")", "\n", "}", "\n", "scale", ":=", "meanF", "(", "1.0", ",", "maxScale", ",", "rate", ")", "\n", "op", ".", "GeoM", ".", "Translate", "(", "float64", "(", "-", "tileSize", "/", "2", ")", ",", "float64", "(", "-", "tileSize", "/", "2", ")", ")", "\n", "op", ".", "GeoM", ".", "Scale", "(", "scale", ",", "scale", ")", "\n", "op", ".", "GeoM", ".", "Translate", "(", "float64", "(", "tileSize", "/", "2", ")", ",", "float64", "(", "tileSize", "/", "2", ")", ")", "\n", "}", "\n", "op", ".", "GeoM", ".", "Translate", "(", "float64", "(", "x", ")", ",", "float64", "(", "y", ")", ")", "\n", "r", ",", "g", ",", "b", ",", "a", ":=", "colorToScale", "(", "tileBackgroundColor", "(", "v", ")", ")", "\n", "op", ".", "ColorM", ".", "Scale", "(", "r", ",", "g", ",", "b", ",", "a", ")", "\n", "boardImage", ".", "DrawImage", "(", "tileImage", ",", "op", ")", "\n", "str", ":=", "strconv", ".", "Itoa", "(", "v", ")", "\n\n", "f", ":=", "mplusBigFont", "\n", "switch", "{", "case", "3", "<", "len", "(", "str", ")", ":", "f", "=", "mplusSmallFont", "\n", "case", "2", "<", "len", "(", "str", ")", ":", "f", "=", "mplusNormalFont", "\n", "}", "\n\n", "bound", ",", "_", ":=", "font", ".", "BoundString", "(", "f", ",", "str", ")", "\n", "w", ":=", "(", "bound", ".", "Max", ".", "X", "-", "bound", ".", "Min", ".", "X", ")", ".", "Ceil", "(", ")", "\n", "h", ":=", "(", "bound", ".", "Max", ".", "Y", "-", "bound", ".", "Min", ".", "Y", ")", ".", "Ceil", "(", ")", "\n", "x", "=", "x", "+", "(", "tileSize", "-", "w", ")", "/", "2", "\n", "y", "=", "y", "+", "(", "tileSize", "-", "h", ")", "/", "2", "+", "h", "\n", "text", ".", "Draw", "(", "boardImage", ",", "str", ",", "f", ",", "x", ",", "y", ",", "tileColor", "(", "v", ")", ")", "\n", "}" ]
16,090
all-16091
[ "Associates", "a", "generic", "vertex", "attribute", "index", "with", "a", "named", "attribute", "variable" ]
[ "func", "BindAttribLocation", "(", "program", "uint32", ",", "index", "uint32", ",", "name", "*", "uint8", ")", "{", "C", ".", "glowBindAttribLocation", "(", "gpBindAttribLocation", ",", "(", "C", ".", "GLuint", ")", "(", "program", ")", ",", "(", "C", ".", "GLuint", ")", "(", "index", ")", ",", "(", "*", "C", ".", "GLchar", ")", "(", "unsafe", ".", "Pointer", "(", "<mask>", ")", ")", ")", "\n", "}" ]
16,091
all-16092
[ "withAuthRetry", "sets", "enables", "authentication", "retries", "." ]
[ "func", "withAuthRetry", "(", "retryAuth", "bool", ")", "retryOption", "{", "return", "retryOption", "{", "applyFunc", ":", "func", "(", "o", "*", "<mask>", ")", "{", "o", ".", "retryAuth", "=", "retryAuth", "\n", "}", "}", "\n", "}" ]
16,092
all-16093
[ "UnmarshalYAML", "implements", "the", "yaml", ".", "Unmarshaler", "interface", "." ]
[ "func", "(", "a", "*", "Action", ")", "UnmarshalYAML", "(", "unmarshal", "func", "(", "interface", "{", "}", ")", "error", ")", "error", "{", "var", "s", "string", "\n", "if", "err", ":=", "unmarshal", "(", "&", "s", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "switch", "<mask>", ":=", "Action", "(", "strings", ".", "ToLower", "(", "s", ")", ")", ";", "act", "{", "case", "Replace", ",", "Keep", ",", "Drop", ",", "HashMod", ",", "LabelMap", ",", "LabelDrop", ",", "LabelKeep", ":", "*", "a", "=", "act", "\n", "return", "nil", "\n", "}", "\n", "return", "errors", ".", "Errorf", "(", "\"", "\"", ",", "s", ")", "\n", "}" ]
16,093
all-16094
[ "NewNamedStream", "creates", "a", "new", "named", "stream", "." ]
[ "func", "(", "mp", "*", "Multiplex", ")", "NewNamedStream", "(", "name", "string", ")", "(", "*", "Stream", ",", "error", ")", "{", "mp", ".", "chLock", ".", "Lock", "(", ")", "\n\n", "// We could call IsClosed but this is faster (given that we already have", "// the lock).", "if", "mp", ".", "channels", "==", "nil", "{", "mp", ".", "chLock", ".", "Unlock", "(", ")", "\n", "return", "nil", ",", "ErrShutdown", "\n", "}", "\n\n", "sid", ":=", "mp", ".", "nextChanID", "(", ")", "\n", "<mask>", ":=", "(", "sid", "<<", "3", ")", "|", "newStreamTag", "\n\n", "if", "name", "==", "\"", "\"", "{", "name", "=", "fmt", ".", "Sprint", "(", "sid", ")", "\n", "}", "\n", "s", ":=", "mp", ".", "newStream", "(", "streamID", "{", "id", ":", "sid", ",", "initiator", ":", "true", ",", "}", ",", "name", ")", "\n", "mp", ".", "channels", "[", "s", ".", "id", "]", "=", "s", "\n", "mp", ".", "chLock", ".", "Unlock", "(", ")", "\n\n", "err", ":=", "mp", ".", "sendMsg", "(", "context", ".", "Background", "(", ")", ",", "header", ",", "[", "]", "byte", "(", "name", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "s", ",", "nil", "\n", "}" ]
16,094
all-16095
[ "configuredSignatureStorageBase", "reads", "configuration", "to", "find", "an", "appropriate", "signature", "storage", "URL", "for", "ref", "for", "write", "access", "if", "“write”", "." ]
[ "func", "configuredSignatureStorageBase", "(", "sys", "*", "types", ".", "SystemContext", ",", "ref", "dockerReference", ",", "write", "bool", ")", "(", "signatureStorageBase", ",", "error", ")", "{", "// FIXME? Loading and parsing the config could be cached across calls.", "dirPath", ":=", "registriesDirPath", "(", "sys", ")", "\n", "logrus", ".", "Debugf", "(", "`Using registries.d directory %s for sigstore configuration`", ",", "dirPath", ")", "\n", "config", ",", "err", ":=", "loadAndMergeConfig", "(", "dirPath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "topLevel", ":=", "config", ".", "signatureTopLevel", "(", "<mask>", ",", "write", ")", "\n", "if", "topLevel", "==", "\"", "\"", "{", "return", "nil", ",", "nil", "\n", "}", "\n\n", "url", ",", "err", ":=", "url", ".", "Parse", "(", "topLevel", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "topLevel", ")", "\n", "}", "\n", "// NOTE: Keep this in sync with docs/signature-protocols.md!", "// FIXME? Restrict to explicitly supported schemes?", "repo", ":=", "reference", ".", "Path", "(", "ref", ".", "ref", ")", "// Note that this is without a tag or digest.", "\n", "if", "path", ".", "Clean", "(", "repo", ")", "!=", "repo", "{", "// Coverage: This should not be reachable because /./ and /../ components are not valid in docker references", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "ref", ".", "ref", ".", "String", "(", ")", ")", "\n", "}", "\n", "url", ".", "Path", "=", "url", ".", "Path", "+", "\"", "\"", "+", "repo", "\n", "return", "url", ",", "nil", "\n", "}" ]
16,095
all-16096
[ "resourceVSphereVirtualMachineRollbackCreate", "attempts", "to", "roll", "back", "a", "resource", "due", "to", "an", "error", "that", "happened", "post", "-", "create", "that", "will", "put", "the", "VM", "in", "a", "state", "where", "it", "cannot", "be", "worked", "with", ".", "This", "should", "only", "be", "done", "early", "on", "in", "the", "process", "namely", "on", "clone", "operations", "between", "when", "the", "clone", "actually", "happens", "and", "no", "later", "than", "after", "the", "initial", "post", "-", "clone", "update", "is", "complete", ".", "If", "the", "rollback", "fails", "an", "error", "is", "displayed", "prompting", "the", "user", "to", "manually", "delete", "the", "virtual", "machine", "before", "trying", "again", "." ]
[ "func", "resourceVSphereVirtualMachineRollbackCreate", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "<mask>", "{", "}", ",", "vm", "*", "object", ".", "VirtualMachine", ",", "origErr", "error", ",", ")", "error", "{", "defer", "d", ".", "SetId", "(", "\"", "\"", ")", "\n", "// Updates are largely atomic, so more than likely no disks with", "// keep_on_remove were attached, but just in case, we run this through delete", "// to make sure to safely remove any disk that may have been attached as part", "// of this process if it was flagged as such.", "if", "err", ":=", "resourceVSphereVirtualMachineDelete", "(", "d", ",", "meta", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "formatVirtualMachinePostCloneRollbackError", ",", "vm", ".", "InventoryPath", ",", "origErr", ",", "err", ")", "\n", "}", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "origErr", ")", "\n", "}" ]
16,096
all-16097
[ "ReplaceAtLine", "replaces", "regular", "expressions", "mathed", "in", "r", "if", "the", "line", "is", "matched", "at", "the", "first", ".", "The", "count", "determines", "the", "number", "to", "match", ":", "n", ">", "0", ":", "at", "most", "n", "matches", "n", "==", "0", ":", "the", "result", "is", "none", "n", "<", "0", ":", "all", "matches" ]
[ "func", "(", "e", "*", "edit", ")", "ReplaceAtLineN", "(", "r", "[", "]", "ReplacerAtLine", ",", "n", "int", ")", "<mask>", "{", "return", "e", ".", "genReplaceAtLine", "(", "r", ",", "n", ")", "\n", "}" ]
16,097
all-16098
[ "HandleMetrics", "performs", "a", "GET", "request", "against", "etcd", "endpoint", "and", "returns", "/", "metrics", "." ]
[ "func", "HandleMetrics", "(", "mux", "*", "http", ".", "ServeMux", ",", "c", "*", "http", ".", "Client", ",", "eps", "[", "]", "string", ")", "{", "// random shuffle endpoints", "r", ":=", "rand", ".", "New", "(", "rand", ".", "NewSource", "(", "int64", "(", "time", ".", "Now", "(", ")", ".", "Nanosecond", "(", ")", ")", ")", ")", "\n", "if", "len", "(", "eps", ")", ">", "1", "{", "eps", "=", "shuffleEndpoints", "(", "r", ",", "eps", ")", "\n", "}", "\n\n", "pathMetrics", ":=", "etcdhttp", ".", "PathMetrics", "\n", "mux", ".", "HandleFunc", "(", "pathMetrics", ",", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "target", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "eps", "[", "0", "]", ",", "pathMetrics", ")", "\n", "if", "!", "strings", ".", "HasPrefix", "(", "target", ",", "\"", "\"", ")", "{", "scheme", ":=", "\"", "\"", "\n", "if", "r", ".", "TLS", "!=", "nil", "{", "scheme", "=", "\"", "\"", "\n", "}", "\n", "<mask>", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "scheme", ",", "target", ")", "\n", "}", "\n\n", "resp", ",", "err", ":=", "c", ".", "Get", "(", "target", ")", "\n", "if", "err", "!=", "nil", "{", "http", ".", "Error", "(", "w", ",", "\"", "\"", ",", "http", ".", "StatusInternalServerError", ")", "\n", "}", "\n", "defer", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "body", ",", "_", ":=", "ioutil", ".", "ReadAll", "(", "resp", ".", "Body", ")", "\n", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\"", ",", "body", ")", "\n", "}", ")", "\n", "}" ]
16,098
all-16099
[ "SingleFile", "returns", "a", "handler" ]
[ "func", "SingleFile", "(", "filename", "string", ")", "http", ".", "Handler", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "<mask>", ")", "{", "http", ".", "ServeFile", "(", "w", ",", "r", ",", "filename", ")", "\n", "}", ")", "\n", "}" ]
16,099
all-16100
[ "flipLast", "reverses", "the", "comparison", "order", "for", "the", "last", "sort", "key", "." ]
[ "func", "(", "s", "*", "SortFilter", ")", "flipLast", "(", ")", "*", "SortFilter", "{", "last", ":=", "s", ".", "cmp", "[", "len", "(", "s", ".", "cmp", ")", "-", "1", "]", "\n", "s", ".", "cmp", "[", "len", "(", "s", ".", "cmp", ")", "-", "1", "]", "=", "func", "(", "a", ",", "b", "string", ")", "int", "{", "return", "<mask>", "(", "b", ",", "a", ")", "}", "\n", "return", "s", "\n", "}" ]