id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
2,000
all-2001
[ "Error", "returns", "the", "code", "and", "message", "conforming", "to", "the", "error", "interface" ]
[ "func", "(", "se", "SystemError", ")", "Error", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "se", ".", "Code", "(", ")", ",", "se", ".", "<mask>", ")", "\n", "}" ]
2,001
all-2002
[ "Proxy", "is", "not", "implemented", "for", "OSB", "API", "implementations" ]
[ "func", "(", "b", "*", "brokerClient", ")", "Proxy", "(", "path", "string", ",", "evt", "*", "event", ".", "Event", ",", "requestID", "string", ",", "w", "<mask>", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "error", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}" ]
2,002
all-2003
[ "expandDVSCreateSpec", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "DVSCreateSpec", "." ]
[ "func", "expandDVSCreateSpec", "(", "d", "*", "schema", ".", "ResourceData", ")", "<mask>", ".", "DVSCreateSpec", "{", "// Since we are only working with the version string from the product spec,", "// we don't have a separate expander/flattener for it. Just do that here.", "obj", ":=", "types", ".", "DVSCreateSpec", "{", "ProductInfo", ":", "&", "types", ".", "DistributedVirtualSwitchProductSpec", "{", "Version", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "}", ",", "ConfigSpec", ":", "expandVMwareDVSConfigSpec", "(", "d", ")", ",", "}", "\n", "return", "obj", "\n", "}" ]
2,003
all-2004
[ "Issues", "is", "the", "main", "work", "function", "of", "the", "TriageFiler", ".", "It", "fetches", "and", "parses", "cluster", "data", "then", "syncs", "the", "top", "issues", "to", "github", "with", "the", "IssueCreator", "." ]
[ "func", "(", "f", "*", "TriageFiler", ")", "Issues", "(", "c", "*", "creator", ".", "IssueCreator", ")", "(", "[", "]", "creator", ".", "Issue", ",", "error", ")", "{", "f", ".", "creator", "=", "c", "\n", "rawjson", ",", "err", ":=", "ReadHTTP", "(", "clusterDataURL", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "clusters", ",", "err", ":=", "f", ".", "loadClusters", "(", "rawjson", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "topclusters", ":=", "topClusters", "(", "clusters", ",", "f", ".", "topClustersCount", ")", "\n", "issues", ":=", "make", "(", "[", "]", "creator", ".", "Issue", ",", "0", ",", "len", "(", "topclusters", ")", ")", "\n", "for", "_", ",", "clust", ":=", "range", "topclusters", "{", "issues", "=", "append", "(", "issues", ",", "clust", ")", "\n", "}", "\n", "return", "<mask>", ",", "nil", "\n", "}" ]
2,004
all-2005
[ "Send", "sends", "the", "request", ".", "On", "success", "the", "photos", "are", "returned", "as", "a", "UserProfilePhotosResponse", "." ]
[ "func", "(", "op", "*", "OutgoingUserProfilePhotosRequest", ")", "Send", "(", ")", "(", "*", "UserProfilePhotosResponse", ",", "error", ")", "{", "resp", ":=", "&", "UserProfilePhotosResponse", "{", "}", "\n", "_", ",", "err", ":=", "op", ".", "api", ".", "c", ".", "postJSON", "(", "getUserProfilePhotos", ",", "resp", ",", "op", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "err", "=", "<mask>", "(", "&", "resp", ".", "baseResponse", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "resp", ",", "nil", "\n", "}" ]
2,005
all-2006
[ "UnmarshalJSON", "satisfies", "json", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "ShadowRootType", ")", "UnmarshalJSON", "(", "buf", "[", "]", "<mask>", ")", "error", "{", "return", "easyjson", ".", "Unmarshal", "(", "buf", ",", "t", ")", "\n", "}" ]
2,006
all-2007
[ "Extract", "username", "from", "the", "request", "url" ]
[ "func", "(", "this", "LogData", ")", "UrlUsername", "(", ")", "string", "{", "if", "this", ".", "Request", ".", "URL", ".", "User", "!=", "nil", "{", "return", "this", ".", "Request", ".", "URL", ".", "<mask>", ".", "Username", "(", ")", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
2,007
all-2008
[ "NewInstanceAuthenticator", "returns", "an", "authenticator", "that", "uses", "the", "instance", "facing", "API", "token", "to", "create", "sessions", ".", "This", "is", "the", "token", "found", "on", "RightLink", "instances", "under", "the", "RS_API_TOKEN", "environment", "variable", ".", "The", "returned", "authenticator", "takes", "care", "of", "refreshing", "the", "RightScale", "session", "as", "needed", ".", "Note", ":", "Use", "of", "rsc", "made", "from", "RightLink10", "instances", "can", "use", "the", "RL10", "authenticator", "instead", "." ]
[ "func", "NewInstanceAuthenticator", "(", "<mask>", "string", ",", "accountID", "int", ")", "Authenticator", "{", "builder", ":=", "instanceLoginRequestBuilder", "{", "token", ":", "token", ",", "accountID", ":", "accountID", "}", "\n", "return", "newCookieSigner", "(", "&", "builder", ",", "accountID", ")", "\n", "}" ]
2,008
all-2009
[ "SetWriter", "sets", "writer", "to", "glg", "std", "writers" ]
[ "func", "(", "g", "*", "Glg", ")", "SetWriter", "(", "<mask>", "io", ".", "Writer", ")", "*", "Glg", "{", "if", "writer", "==", "nil", "{", "return", "g", "\n", "}", "\n\n", "g", ".", "logger", ".", "Range", "(", "func", "(", "key", ",", "val", "interface", "{", "}", ")", "bool", "{", "l", ":=", "val", ".", "(", "*", "logger", ")", "\n", "l", ".", "writer", "=", "writer", "\n", "l", ".", "updateMode", "(", ")", "\n", "g", ".", "logger", ".", "Store", "(", "key", ".", "(", "LEVEL", ")", ",", "l", ")", "\n", "return", "true", "\n", "}", ")", "\n\n", "return", "g", "\n", "}" ]
2,009
all-2010
[ "createDisk", "performs", "all", "of", "the", "logic", "for", "a", "base", "virtual", "disk", "creation", "." ]
[ "func", "(", "r", "*", "DiskSubresource", ")", "createDisk", "(", "l", "object", ".", "VirtualDeviceList", ")", "(", "*", "types", ".", "VirtualDisk", ",", "error", ")", "{", "disk", ":=", "new", "(", "types", ".", "VirtualDisk", ")", "\n", "disk", ".", "Backing", "=", "new", "(", "types", ".", "VirtualDiskFlatVer2BackingInfo", ")", "\n\n", "// Only assign backing info if a datastore cluster is not specified. If one", "// is, skip this step.", "if", "r", ".", "rdd", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", "==", "\"", "\"", "{", "if", "err", ":=", "r", ".", "assignBackingInfo", "(", "disk", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "// Set a new device key for this device", "disk", ".", "<mask>", "=", "l", ".", "NewKey", "(", ")", "\n", "return", "disk", ",", "nil", "\n", "}" ]
2,010
all-2011
[ "IsHostname", "checks", "if", "this", "is", "a", "hostname" ]
[ "func", "IsHostname", "(", "s", "string", ")", "bool", "{", "addrs", ",", "err", ":=", "net", ".", "LookupHost", "(", "s", ")", "\n", "if", "err", "!=", "nil", "||", "len", "(", "addrs", ")", "==", "0", "{", "return", "false", "\n", "}", "\n", "return", "<mask>", "\n", "}" ]
2,011
all-2012
[ "NewRegexp", "creates", "a", "new", "anchored", "Regexp", "and", "returns", "an", "error", "if", "the", "passed", "-", "in", "regular", "expression", "does", "not", "compile", "." ]
[ "func", "NewRegexp", "(", "s", "string", ")", "(", "Regexp", ",", "error", ")", "{", "regex", ",", "err", ":=", "regexp", ".", "Compile", "(", "\"", "\"", "+", "s", "+", "\"", "\"", ")", "\n", "return", "Regexp", "{", "Regexp", ":", "regex", ",", "<mask>", ":", "s", ",", "}", ",", "err", "\n", "}" ]
2,012
all-2013
[ "NewTokenProvider", "creates", "a", "new", "token", "provider", "." ]
[ "func", "NewTokenProvider", "(", "lg", "*", "zap", ".", "Logger", ",", "tokenOpts", "string", ",", "indexWaiter", "func", "(", "uint64", ")", "<-", "chan", "struct", "{", "}", ")", "(", "TokenProvider", ",", "error", ")", "{", "tokenType", ",", "typeSpecificOpts", ",", "err", ":=", "decomposeOpts", "(", "lg", ",", "tokenOpts", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "ErrInvalidAuthOpts", "\n", "}", "\n\n", "switch", "tokenType", "{", "case", "tokenTypeSimple", ":", "if", "lg", "!=", "nil", "{", "lg", ".", "Warn", "(", "\"", "\"", ")", "\n", "}", "else", "{", "plog", ".", "Warningf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "newTokenProviderSimple", "(", "lg", ",", "indexWaiter", ")", ",", "nil", "\n\n", "case", "tokenTypeJWT", ":", "return", "newTokenProviderJWT", "(", "lg", ",", "typeSpecificOpts", ")", "\n\n", "case", "\"", "\"", ":", "return", "newTokenProviderNop", "(", ")", "\n\n", "default", ":", "if", "lg", "!=", "nil", "{", "lg", ".", "Warn", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "tokenType", ")", ",", "zap", ".", "<mask>", "(", "ErrInvalidAuthOpts", ")", ",", ")", "\n", "}", "else", "{", "plog", ".", "Errorf", "(", "\"", "\"", ",", "tokenType", ")", "\n", "}", "\n", "return", "nil", ",", "ErrInvalidAuthOpts", "\n", "}", "\n", "}" ]
2,013
all-2014
[ "RunScript", "runs", "the", "JavaScript", "provided", "in", "the", "body", ".", "Any", "keys", "present", "in", "the", "arguments", "map", "will", "be", "available", "as", "variables", "in", "the", "body", ".", "Values", "provided", "in", "arguments", "are", "converted", "into", "javascript", "objects", ".", "If", "the", "body", "returns", "a", "value", "it", "will", "be", "unmarshalled", "into", "the", "result", "argument", ".", "Simple", "example", ":", "var", "number", "int", "page", ".", "RunScript", "(", "return", "test", ";", "map", "[", "string", "]", "interface", "{}", "{", "test", ":", "100", "}", "&number", ")", "fmt", ".", "Println", "(", "number", ")", "-", ">", "100" ]
[ "func", "(", "p", "*", "Page", ")", "RunScript", "(", "body", "string", ",", "arguments", "map", "[", "string", "]", "interface", "{", "}", ",", "result", "interface", "{", "}", ")", "error", "{", "var", "(", "keys", "[", "]", "string", "\n", "values", "[", "]", "interface", "{", "}", "\n", ")", "\n\n", "for", "key", ",", "value", ":=", "range", "arguments", "{", "keys", "=", "append", "(", "<mask>", ",", "key", ")", "\n", "values", "=", "append", "(", "values", ",", "value", ")", "\n", "}", "\n\n", "argumentList", ":=", "strings", ".", "Join", "(", "keys", ",", "\"", "\"", ")", "\n", "cleanBody", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "argumentList", ",", "body", ")", "\n\n", "if", "err", ":=", "p", ".", "session", ".", "Execute", "(", "cleanBody", ",", "values", ",", "result", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
2,014
all-2015
[ "Zones", "returns", "filtered", "zones", "if", "filter", "is", "set" ]
[ "func", "(", "p", "*", "RcodeZeroProvider", ")", "Zones", "(", ")", "(", "[", "]", "*", "rc0", ".", "Zone", ",", "error", ")", "{", "var", "result", "[", "]", "*", "rc0", ".", "Zone", "\n\n", "zones", ",", "err", ":=", "p", ".", "fetchZones", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "for", "_", ",", "zone", ":=", "<mask>", "zones", "{", "if", "p", ".", "DomainFilter", ".", "Match", "(", "zone", ".", "Domain", ")", "{", "result", "=", "append", "(", "result", ",", "zone", ")", "\n", "}", "\n", "}", "\n\n", "return", "result", ",", "nil", "\n", "}" ]
2,015
all-2016
[ "AddAlternative", "adds", "an", "alternative", "part", "to", "the", "message", ".", "It", "is", "commonly", "used", "to", "send", "HTML", "emails", "that", "default", "to", "the", "plain", "text", "version", "for", "backward", "compatibility", ".", "AddAlternative", "appends", "the", "new", "part", "to", "the", "end", "of", "the", "message", ".", "So", "the", "plain", "text", "part", "should", "be", "added", "before", "the", "HTML", "part", ".", "See", "http", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "MIME#Alternative" ]
[ "func", "(", "m", "*", "Message", ")", "AddAlternative", "(", "contentType", ",", "<mask>", "string", ",", "settings", "...", "PartSetting", ")", "{", "m", ".", "AddAlternativeWriter", "(", "contentType", ",", "newCopier", "(", "body", ")", ",", "settings", "...", ")", "\n", "}" ]
2,016
all-2017
[ "create", "a", "new", "sync", "object", "and", "insert", "it", "into", "the", "GL", "command", "stream" ]
[ "func", "FenceSync", "(", "condition", "uint32", ",", "<mask>", "uint32", ")", "uintptr", "{", "ret", ":=", "C", ".", "glowFenceSync", "(", "gpFenceSync", ",", "(", "C", ".", "GLenum", ")", "(", "condition", ")", ",", "(", "C", ".", "GLbitfield", ")", "(", "flags", ")", ")", "\n", "return", "(", "uintptr", ")", "(", "ret", ")", "\n", "}" ]
2,017
all-2018
[ "HasMin", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "g", "*", "GraphDefinitionMarker", ")", "HasMin", "(", ")", "bool", "{", "if", "g", "!=", "nil", "&&", "g", ".", "Min", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
2,018
all-2019
[ "NewOUWCStatusPolicy", "returns", "a", "status", "policy", "similar", "to", "that", "returned", "by", "NewDefaultStatusPolicy", "with", "one", "difference", ":", "the", "UNKNOWN", "check", "status", "is", "demoted", "in", "severity", "such", "that", "any", "WARNING", "or", "CRITICAL", "check", "status", "will", "take", "priority", "." ]
[ "func", "NewOUWCStatusPolicy", "(", ")", "*", "statusPolicy", "{", "pol", ",", "_", ":=", "NewStatusPolicy", "(", "[", "]", "Status", "{", "<mask>", ",", "UNKNOWN", ",", "WARNING", ",", "CRITICAL", "}", ")", "\n", "return", "pol", "\n", "}" ]
2,019
all-2020
[ "GetAuthorizationToken", "indicates", "an", "expected", "call", "of", "GetAuthorizationToken" ]
[ "func", "(", "mr", "*", "MockECRSDKMockRecorder", ")", "GetAuthorizationToken", "(", "arg0", "<mask>", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockECRSDK", ")", "(", "nil", ")", ".", "GetAuthorizationToken", ")", ",", "arg0", ")", "\n", "}" ]
2,020
all-2021
[ "String", "returns", "a", "human", "-", "readable", "representation", "of", "the", "frame", "type", "." ]
[ "func", "(", "t", "FrameType", ")", "String", "(", ")", "string", "{", "switch", "t", "{", "case", "FrameTypeResponse", ":", "return", "\"", "\"", "\n\n", "case", "FrameTypeError", ":", "return", "\"", "\"", "\n\n", "case", "FrameTypeMessage", ":", "return", "\"", "\"", "\n\n", "<mask>", ":", "return", "\"", "\"", "+", "strconv", ".", "Itoa", "(", "int", "(", "t", ")", ")", "+", "\"", "\"", "\n", "}", "\n", "}" ]
2,021
all-2022
[ "Loader", "functions" ]
[ "func", "containerLXCCreate", "(", "s", "*", "state", ".", "State", ",", "args", "db", ".", "ContainerArgs", ")", "(", "container", ",", "error", ")", "{", "// Create the container struct", "c", ":=", "&", "containerLXC", "{", "<mask>", ":", "s", ",", "id", ":", "args", ".", "ID", ",", "project", ":", "args", ".", "Project", ",", "name", ":", "args", ".", "Name", ",", "node", ":", "args", ".", "Node", ",", "description", ":", "args", ".", "Description", ",", "ephemeral", ":", "args", ".", "Ephemeral", ",", "architecture", ":", "args", ".", "Architecture", ",", "cType", ":", "args", ".", "Ctype", ",", "stateful", ":", "args", ".", "Stateful", ",", "creationDate", ":", "args", ".", "CreationDate", ",", "lastUsedDate", ":", "args", ".", "LastUsedDate", ",", "profiles", ":", "args", ".", "Profiles", ",", "localConfig", ":", "args", ".", "Config", ",", "localDevices", ":", "args", ".", "Devices", ",", "expiryDate", ":", "args", ".", "ExpiryDate", ",", "}", "\n\n", "// Cleanup the zero values", "if", "c", ".", "expiryDate", ".", "IsZero", "(", ")", "{", "c", ".", "expiryDate", "=", "time", ".", "Time", "{", "}", "\n", "}", "\n\n", "if", "c", ".", "creationDate", ".", "IsZero", "(", ")", "{", "c", ".", "creationDate", "=", "time", ".", "Time", "{", "}", "\n", "}", "\n\n", "if", "c", ".", "lastUsedDate", ".", "IsZero", "(", ")", "{", "c", ".", "lastUsedDate", "=", "time", ".", "Time", "{", "}", "\n", "}", "\n\n", "ctxMap", ":=", "log", ".", "Ctx", "{", "\"", "\"", ":", "args", ".", "Project", ",", "\"", "\"", ":", "c", ".", "name", ",", "\"", "\"", ":", "c", ".", "ephemeral", ",", "}", "\n\n", "logger", ".", "Info", "(", "\"", "\"", ",", "ctxMap", ")", "\n\n", "// Load the config", "err", ":=", "c", ".", "init", "(", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "Delete", "(", ")", "\n", "logger", ".", "Error", "(", "\"", "\"", ",", "ctxMap", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Validate expanded config", "err", "=", "containerValidConfig", "(", "s", ".", "OS", ",", "c", ".", "expandedConfig", ",", "false", ",", "true", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "Delete", "(", ")", "\n", "logger", ".", "Error", "(", "\"", "\"", ",", "ctxMap", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "err", "=", "containerValidDevices", "(", "s", ".", "Cluster", ",", "c", ".", "expandedDevices", ",", "false", ",", "true", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "Delete", "(", ")", "\n", "logger", ".", "Error", "(", "\"", "\"", ",", "ctxMap", ")", "\n", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// Retrieve the container's storage pool", "_", ",", "rootDiskDevice", ",", "err", ":=", "shared", ".", "GetRootDiskDevice", "(", "c", ".", "expandedDevices", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "Delete", "(", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "rootDiskDevice", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "c", ".", "Delete", "(", ")", "\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "storagePool", ":=", "rootDiskDevice", "[", "\"", "\"", "]", "\n\n", "// Get the storage pool ID for the container", "poolID", ",", "pool", ",", "err", ":=", "s", ".", "Cluster", ".", "StoragePoolGet", "(", "storagePool", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "Delete", "(", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Fill in any default volume config", "volumeConfig", ":=", "map", "[", "string", "]", "string", "{", "}", "\n", "err", "=", "storageVolumeFillDefault", "(", "storagePool", ",", "volumeConfig", ",", "pool", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "Delete", "(", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Create a new database entry for the container's storage volume", "_", ",", "err", "=", "s", ".", "Cluster", ".", "StoragePoolVolumeCreate", "(", "args", ".", "Project", ",", "args", ".", "Name", ",", "\"", "\"", ",", "storagePoolVolumeTypeContainer", ",", "false", ",", "poolID", ",", "volumeConfig", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "Delete", "(", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Initialize the container storage", "cStorage", ",", "err", ":=", "storagePoolVolumeContainerCreateInit", "(", "s", ",", "args", ".", "Project", ",", "storagePool", ",", "args", ".", "Name", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "Delete", "(", ")", "\n", "s", ".", "Cluster", ".", "StoragePoolVolumeDelete", "(", "args", ".", "Project", ",", "args", ".", "Name", ",", "storagePoolVolumeTypeContainer", ",", "poolID", ")", "\n", "logger", ".", "Error", "(", "\"", "\"", ",", "ctxMap", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "c", ".", "storage", "=", "cStorage", "\n\n", "// Setup initial idmap config", "var", "idmap", "*", "idmap", ".", "IdmapSet", "\n", "base", ":=", "int64", "(", "0", ")", "\n", "if", "!", "c", ".", "IsPrivileged", "(", ")", "{", "idmap", ",", "base", ",", "err", "=", "findIdmap", "(", "s", ",", "args", ".", "Name", ",", "c", ".", "expandedConfig", "[", "\"", "\"", "]", ",", "c", ".", "expandedConfig", "[", "\"", "\"", "]", ",", "c", ".", "expandedConfig", "[", "\"", "\"", "]", ",", "c", ".", "expandedConfig", "[", "\"", "\"", "]", ",", ")", "\n\n", "if", "err", "!=", "nil", "{", "c", ".", "Delete", "(", ")", "\n", "logger", ".", "Error", "(", "\"", "\"", ",", "ctxMap", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "var", "jsonIdmap", "string", "\n", "if", "idmap", "!=", "nil", "{", "idmapBytes", ",", "err", ":=", "json", ".", "Marshal", "(", "idmap", ".", "Idmap", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "Delete", "(", ")", "\n", "logger", ".", "Error", "(", "\"", "\"", ",", "ctxMap", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "jsonIdmap", "=", "string", "(", "idmapBytes", ")", "\n", "}", "else", "{", "jsonIdmap", "=", "\"", "\"", "\n", "}", "\n\n", "err", "=", "c", ".", "ConfigKeySet", "(", "\"", "\"", ",", "jsonIdmap", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "Delete", "(", ")", "\n", "logger", ".", "Error", "(", "\"", "\"", ",", "ctxMap", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "err", "=", "c", ".", "ConfigKeySet", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "base", ")", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "Delete", "(", ")", "\n", "logger", ".", "Error", "(", "\"", "\"", ",", "ctxMap", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Invalid idmap cache", "c", ".", "idmapset", "=", "nil", "\n\n", "// Set last_state if not currently set", "if", "c", ".", "localConfig", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "err", "=", "c", ".", "ConfigKeySet", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "Delete", "(", ")", "\n", "logger", ".", "Error", "(", "\"", "\"", ",", "ctxMap", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "// Re-run init to update the idmap", "err", "=", "c", ".", "init", "(", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "Delete", "(", ")", "\n", "logger", ".", "Error", "(", "\"", "\"", ",", "ctxMap", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Update MAAS", "if", "!", "c", ".", "IsSnapshot", "(", ")", "{", "err", "=", "c", ".", "maasUpdate", "(", "false", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "Delete", "(", ")", "\n", "logger", ".", "Error", "(", "\"", "\"", ",", "ctxMap", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "// Update lease files", "networkUpdateStatic", "(", "s", ",", "\"", "\"", ")", "\n\n", "logger", ".", "Info", "(", "\"", "\"", ",", "ctxMap", ")", "\n", "eventSendLifecycle", "(", "c", ".", "project", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "name", ")", ",", "nil", ")", "\n\n", "return", "c", ",", "nil", "\n", "}" ]
2,022
all-2023
[ "Wait", "waits", "for", "all", "waitgroups", "at", "or", "below", "the", "given", "sequence", "to", "complete", ".", "Please", "note", "that", "this", "is", "*", "INCLUSIVE", "*", "of", "the", "sequence" ]
[ "func", "(", "s", "*", "SequentialWaitGroup", ")", "Wait", "(", "sequence", "int64", ")", "{", "waitOver", ":=", "func", "(", ")", "bool", "{", "s", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mutex", ".", "Unlock", "(", ")", "\n", "for", "storedSequence", ":=", "<mask>", "s", ".", "semaphores", "{", "if", "storedSequence", "<=", "sequence", "{", "// At least one non-empty seqnum greater than ours; wait more", "return", "false", "\n", "}", "\n", "}", "\n", "return", "true", "\n", "}", "\n\n", "s", ".", "change", ".", "L", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "change", ".", "L", ".", "Unlock", "(", ")", "\n", "// Wake up to check if our wait is over after each element being deleted from the map", "for", "!", "waitOver", "(", ")", "{", "s", ".", "change", ".", "Wait", "(", ")", "\n", "}", "\n", "}" ]
2,023
all-2024
[ "export", "FileSequence_Frame_Int" ]
[ "func", "FileSequence_Frame_Int", "(", "<mask>", "FileSeqId", ",", "frame", "int", ")", "*", "C", ".", "char", "{", "fs", ",", "ok", ":=", "sFileSeqs", ".", "Get", "(", "id", ")", "\n", "// caller must free string", "if", "!", "ok", "{", "return", "C", ".", "CString", "(", "\"", "\"", ")", "\n", "}", "\n", "frameStr", ",", "_", ":=", "fs", ".", "Frame", "(", "frame", ")", "\n", "return", "C", ".", "CString", "(", "frameStr", ")", "\n", "}" ]
2,024
all-2025
[ "HasMessage", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "m", "*", "Monitor", ")", "HasMessage", "(", ")", "bool", "{", "if", "m", "!=", "nil", "&&", "m", ".", "Message", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
2,025
all-2026
[ "Get", "returns", "the", "latest", "value", "for", "the", "merge", "operator", "which", "is", "derived", "by", "applying", "the", "merge", "function", "to", "all", "the", "values", "added", "so", "far", ".", "If", "Add", "has", "not", "been", "called", "even", "once", "Get", "will", "return", "ErrKeyNotFound", "." ]
[ "func", "(", "op", "*", "MergeOperator", ")", "Get", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "op", ".", "RLock", "(", ")", "\n", "defer", "op", ".", "RUnlock", "(", ")", "\n", "var", "existing", "[", "]", "byte", "\n", "err", ":=", "op", ".", "db", ".", "<mask>", "(", "func", "(", "txn", "*", "Txn", ")", "(", "err", "error", ")", "{", "existing", ",", "err", "=", "op", ".", "iterateAndMerge", "(", "txn", ")", "\n", "return", "err", "\n", "}", ")", "\n", "if", "err", "==", "errNoMerge", "{", "return", "existing", ",", "nil", "\n", "}", "\n", "return", "existing", ",", "err", "\n", "}" ]
2,026
all-2027
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GenerateTestReportParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage44", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
2,027
all-2028
[ "Int64", "adds", "an", "int64", "-", "valued", "key", ":", "value", "pair", "to", "a", "Span", ".", "LogFields", "()", "record" ]
[ "func", "Int64", "(", "<mask>", "string", ",", "val", "int64", ")", "Field", "{", "return", "Field", "{", "key", ":", "key", ",", "fieldType", ":", "int64Type", ",", "numericVal", ":", "val", ",", "}", "\n", "}" ]
2,028
all-2029
[ "Page", "returns", "the", "page", "for", "the", "given", "page", "number", ".", "Page", "numbers", "are", "indexed", "starting", "at", "1", "not", "0", ".", "If", "the", "page", "is", "not", "found", "Page", "returns", "a", "Page", "with", "p", ".", "V", ".", "IsNull", "()", "." ]
[ "func", "(", "r", "*", "Reader", ")", "Page", "(", "num", "int", ")", "Page", "{", "num", "--", "// now 0-indexed", "\n", "page", ":=", "r", ".", "Trailer", "(", ")", ".", "Key", "(", "\"", "\"", ")", ".", "Key", "(", "\"", "\"", ")", "\n", "Search", ":", "for", "page", ".", "Key", "(", "\"", "\"", ")", ".", "Name", "(", ")", "==", "\"", "\"", "{", "count", ":=", "int", "(", "page", ".", "Key", "(", "\"", "\"", ")", ".", "Int64", "(", ")", ")", "\n", "if", "count", "<", "num", "{", "return", "Page", "{", "}", "\n", "}", "\n", "kids", ":=", "page", ".", "<mask>", "(", "\"", "\"", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "kids", ".", "Len", "(", ")", ";", "i", "++", "{", "kid", ":=", "kids", ".", "Index", "(", "i", ")", "\n", "if", "kid", ".", "Key", "(", "\"", "\"", ")", ".", "Name", "(", ")", "==", "\"", "\"", "{", "c", ":=", "int", "(", "kid", ".", "Key", "(", "\"", "\"", ")", ".", "Int64", "(", ")", ")", "\n", "if", "num", "<", "c", "{", "page", "=", "kid", "\n", "continue", "Search", "\n", "}", "\n", "num", "-=", "c", "\n", "continue", "\n", "}", "\n", "if", "kid", ".", "Key", "(", "\"", "\"", ")", ".", "Name", "(", ")", "==", "\"", "\"", "{", "if", "num", "==", "0", "{", "return", "Page", "{", "kid", "}", "\n", "}", "\n", "num", "--", "\n", "}", "\n", "}", "\n", "break", "\n", "}", "\n", "return", "Page", "{", "}", "\n", "}" ]
2,029
all-2030
[ "String", "returns", "a", "human", "readable", "string", "representation", "of", "this", "object" ]
[ "func", "(", "<mask>", "CgroupStatus", ")", "String", "(", ")", "string", "{", "for", "k", ",", "v", ":=", "range", "cgroupStatusMap", "{", "if", "v", "==", "cs", "{", "return", "k", "\n", "}", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
2,030
all-2031
[ "Encode", "writes", "the", "Image", "m", "to", "w", "in", "PNG", "format", ".", "Any", "Image", "may", "be", "encoded", "but", "images", "that", "are", "not", "image", ".", "NRGBA", "might", "be", "encoded", "lossily", "." ]
[ "func", "Encode", "(", "w", "<mask>", ".", "Writer", ",", "m", "image", ".", "Image", ")", "error", "{", "var", "e", "Encoder", "\n", "return", "e", ".", "Encode", "(", "w", ",", "m", ")", "\n", "}" ]
2,031
all-2032
[ "Postpone", "value", "expiration", "time", "to", "current", "time", "added", "to", "its", "lifetime", "duration", "." ]
[ "func", "(", "i", "*", "cacheItem", ")", "Postpone", "(", ")", "{", "i", ".", "expireAt", "=", "<mask>", ".", "Now", "(", ")", ".", "Add", "(", "i", ".", "lifetime", ")", "\n", "}" ]
2,032
all-2033
[ "Trim", "the", "schema", "updates", "to", "the", "given", "version", "(", "included", ")", ".", "Updates", "with", "higher", "versions", "will", "be", "discarded", ".", "Any", "fresh", "schema", "dump", "previously", "set", "will", "be", "unset", "since", "it", "s", "assumed", "to", "no", "longer", "be", "applicable", ".", "Return", "all", "updates", "that", "have", "been", "trimmed", "." ]
[ "func", "(", "s", "*", "Schema", ")", "Trim", "(", "version", "int", ")", "[", "]", "Update", "{", "trimmed", ":=", "s", ".", "updates", "[", "<mask>", ":", "]", "\n", "s", ".", "updates", "=", "s", ".", "updates", "[", ":", "version", "]", "\n", "s", ".", "fresh", "=", "\"", "\"", "\n", "return", "trimmed", "\n", "}" ]
2,033
all-2034
[ "NewJitteredTicker", "works", "like", "a", "time", ".", "Ticker", "except", "with", "randomly", "distributed", "ticks", "between", "start", "and", "end", "duration", "." ]
[ "func", "NewJitteredTicker", "(", "ctx", "<mask>", ".", "Context", ",", "start", ",", "end", "time", ".", "Duration", ")", "<-", "chan", "time", ".", "Time", "{", "ticker", ":=", "make", "(", "chan", "time", ".", "Time", ",", "1", ")", "\n\n", "go", "func", "(", ")", "{", "defer", "close", "(", "ticker", ")", "\n\n", "for", "{", "select", "{", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "return", "\n", "default", ":", "time", ".", "Sleep", "(", "randomDuration", "(", "start", ",", "end", ")", ")", "\n", "sendNow", "(", "ticker", ")", "\n", "}", "\n", "}", "\n", "}", "(", ")", "\n\n", "return", "ticker", "\n", "}" ]
2,034
all-2035
[ "A", "transformer", "function", "can", "be", "used", "to", "do", "post", "-", "download", "processing", "on", "the", "file", "before", "it", "is", "stored", "in", "the", "cache", "." ]
[ "func", "New", "(", "downloader", "*", "Downloader", ",", "<mask>", "*", "FileCache", ",", "transformer", "CacheTransformer", ",", ")", "*", "cachedDownloader", "{", "os", ".", "MkdirAll", "(", "cache", ".", "CachedPath", ",", "0770", ")", "\n", "return", "&", "cachedDownloader", "{", "cache", ":", "cache", ",", "cacheLocation", ":", "filepath", ".", "Join", "(", "cache", ".", "CachedPath", ",", "\"", "\"", ")", ",", "uncachedPath", ":", "createTempCachedDir", "(", "cache", ".", "CachedPath", ")", ",", "downloader", ":", "downloader", ",", "transformer", ":", "transformer", ",", "lock", ":", "&", "sync", ".", "Mutex", "{", "}", ",", "inProgress", ":", "map", "[", "string", "]", "chan", "struct", "{", "}", "{", "}", ",", "}", "\n", "}" ]
2,035
all-2036
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "Source", ")", "MarshalEasyJSON", "(", "out", "*", "jwriter", ".", "<mask>", ")", "{", "out", ".", "String", "(", "string", "(", "t", ")", ")", "\n", "}" ]
2,036
all-2037
[ "SetMinValue", "()", "is", "a", "wrapper", "around", "gtk_level_bar_set_min_value", "()", "." ]
[ "func", "(", "v", "*", "LevelBar", ")", "SetMinValue", "(", "value", "float64", ")", "{", "C", ".", "gtk_level_bar_set_min_value", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gdouble", "(", "<mask>", ")", ")", "\n", "}" ]
2,037
all-2038
[ "SetDepth", "sets", "depth", "parameter", "for", "api", "calls" ]
[ "func", "(", "c", "*", "Client", ")", "SetDepth", "(", "depth", "int", ")", "{", "c", ".", "client", ".", "<mask>", "=", "strconv", ".", "Itoa", "(", "depth", ")", "\n", "}" ]
2,038
all-2039
[ "NewClient", "creates", "a", "new", "Hyperbahn", "client", "using", "the", "given", "channel", ".", "config", "is", "the", "environment", "-", "specific", "configuration", "for", "Hyperbahn", "such", "as", "the", "list", "of", "initial", "nodes", ".", "opts", "are", "optional", "and", "are", "used", "to", "customize", "the", "client", "." ]
[ "func", "NewClient", "(", "ch", "*", "tchannel", ".", "Channel", ",", "config", "Configuration", ",", "opts", "*", "ClientOptions", ")", "(", "*", "Client", ",", "error", ")", "{", "client", ":=", "&", "Client", "{", "tchan", ":", "ch", ",", "quit", ":", "make", "(", "chan", "struct", "{", "}", ")", "}", "\n", "if", "opts", "!=", "nil", "{", "client", ".", "opts", "=", "*", "opts", "\n", "}", "\n", "if", "client", ".", "opts", ".", "Timeout", "==", "0", "{", "client", ".", "opts", ".", "Timeout", "=", "3", "*", "time", ".", "Second", "\n", "}", "\n", "if", "client", ".", "opts", ".", "TimeoutPerAttempt", "==", "0", "{", "<mask>", ".", "opts", ".", "TimeoutPerAttempt", "=", "time", ".", "Second", "\n", "}", "\n", "if", "client", ".", "opts", ".", "Handler", "==", "nil", "{", "client", ".", "opts", ".", "Handler", "=", "nullHandler", "{", "}", "\n", "}", "\n", "if", "client", ".", "opts", ".", "TimeSleep", "==", "nil", "{", "client", ".", "opts", ".", "TimeSleep", "=", "time", ".", "Sleep", "\n", "}", "\n\n", "if", "err", ":=", "parseConfig", "(", "&", "config", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Add the given initial nodes as peers.", "for", "_", ",", "node", ":=", "range", "config", ".", "InitialNodes", "{", "addPeer", "(", "ch", ",", "node", ")", "\n", "}", "\n\n", "client", ".", "jsonClient", "=", "tjson", ".", "NewClient", "(", "ch", ",", "hyperbahnServiceName", ",", "nil", ")", "\n", "thriftClient", ":=", "tthrift", ".", "NewClient", "(", "ch", ",", "hyperbahnServiceName", ",", "nil", ")", "\n", "client", ".", "hyperbahnClient", "=", "htypes", ".", "NewTChanHyperbahnClient", "(", "thriftClient", ")", "\n\n", "return", "client", ",", "nil", "\n", "}" ]
2,039
all-2040
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "NavigateReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage26", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
2,040
all-2041
[ "UnaryClientInterceptor", "applies", "fn", "to", "errors", "recieved", "by", "client", "." ]
[ "func", "UnaryClientInterceptor", "(", "fn", "ConvertFunc", ")", "grpc", ".", "UnaryClientInterceptor", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "method", "string", ",", "req", ",", "<mask>", "interface", "{", "}", ",", "cc", "*", "grpc", ".", "ClientConn", ",", "invoker", "grpc", ".", "UnaryInvoker", ",", "opts", "...", "grpc", ".", "CallOption", ")", "(", "err", "error", ")", "{", "return", "fn", "(", "invoker", "(", "ctx", ",", "method", ",", "req", ",", "reply", ",", "cc", ",", "opts", "...", ")", ")", "\n", "}", "\n", "}" ]
2,041
all-2042
[ "UCount", "iterates", "over", "a", "list", "and", "keeps", "a", "running", "tally", "of", "the", "number", "of", "elements", "satisfy", "a", "predicate", "." ]
[ "func", "UCount", "(", "iter", "Enumerable", ",", "p", "Predicate", ")", "uint", "{", "<mask>", "iter", ".", "Enumerate", "(", "nil", ")", ".", "UCount", "(", "p", ")", "\n", "}" ]
2,042
all-2043
[ "cubehash56", "calculates", "cubuhash256", ".", "length", "of", "data", "must", "be", "32", "bytes", "." ]
[ "func", "cubehash256", "(", "data", "[", "]", "byte", ")", "[", "]", "byte", "{", "c", ":=", "NewCubeHash", "(", ")", "\n", "buf", ":=", "make", "(", "[", "]", "byte", ",", "32", ")", "\n", "buf", "[", "0", "]", "=", "0x80", "\n", "c", ".", "inputBlock", "(", "data", ")", "\n", "c", ".", "sixteenRounds", "(", ")", "\n", "c", ".", "inputBlock", "(", "buf", ")", "\n", "c", ".", "sixteenRounds", "(", ")", "\n", "c", ".", "xv", "^=", "1", "\n", "for", "j", ":=", "0", ";", "j", "<", "10", ";", "j", "++", "{", "c", ".", "sixteenRounds", "(", ")", "\n", "}", "\n", "out", ":=", "make", "(", "[", "]", "byte", ",", "32", ")", "\n", "<mask>", ".", "LittleEndian", ".", "PutUint32", "(", "out", "[", "0", ":", "]", ",", "c", ".", "x0", ")", "\n", "binary", ".", "LittleEndian", ".", "PutUint32", "(", "out", "[", "4", ":", "]", ",", "c", ".", "x1", ")", "\n", "binary", ".", "LittleEndian", ".", "PutUint32", "(", "out", "[", "8", ":", "]", ",", "c", ".", "x2", ")", "\n", "binary", ".", "LittleEndian", ".", "PutUint32", "(", "out", "[", "12", ":", "]", ",", "c", ".", "x3", ")", "\n", "binary", ".", "LittleEndian", ".", "PutUint32", "(", "out", "[", "16", ":", "]", ",", "c", ".", "x4", ")", "\n", "binary", ".", "LittleEndian", ".", "PutUint32", "(", "out", "[", "20", ":", "]", ",", "c", ".", "x5", ")", "\n", "binary", ".", "LittleEndian", ".", "PutUint32", "(", "out", "[", "24", ":", "]", ",", "c", ".", "x6", ")", "\n", "binary", ".", "LittleEndian", ".", "PutUint32", "(", "out", "[", "28", ":", "]", ",", "c", ".", "x7", ")", "\n", "return", "out", "\n", "}" ]
2,043
all-2044
[ "List", "takes", "label", "and", "field", "selectors", "and", "returns", "the", "list", "of", "Apps", "that", "match", "those", "selectors", "." ]
[ "func", "(", "c", "*", "apps", ")", "List", "(", "opts", "meta_v1", ".", "ListOptions", ")", "(", "result", "*", "v1", ".", "AppList", ",", "err", "error", ")", "{", "result", "=", "&", "v1", ".", "AppList", "{", "}", "\n", "err", "=", "c", ".", "<mask>", ".", "Get", "(", ")", ".", "Namespace", "(", "c", ".", "ns", ")", ".", "Resource", "(", "\"", "\"", ")", ".", "VersionedParams", "(", "&", "opts", ",", "scheme", ".", "ParameterCodec", ")", ".", "Do", "(", ")", ".", "Into", "(", "result", ")", "\n", "return", "\n", "}" ]
2,044
all-2045
[ "OthersHave", "reports", "whether", "the", "others", "have", "all", "given", "permissions", "." ]
[ "func", "(", "i", "*", "info", ")", "OthersHave", "(", "p", "...", "perm", ")", "bool", "{", "mode", ":=", "i", ".", "fi", ".", "Mode", "(", ")", "\n\n", "for", "_", ",", "v", ":=", "range", "p", "{", "switch", "v", "{", "case", "R", ":", "if", "mode", "&", "modeROthers", "==", "0", "{", "return", "false", "\n", "}", "\n", "case", "W", ":", "if", "mode", "&", "modeWOthers", "==", "0", "{", "return", "false", "\n", "}", "\n", "case", "X", ":", "if", "<mask>", "&", "modeXOthers", "==", "0", "{", "return", "false", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "true", "\n", "}" ]
2,045
all-2046
[ "CompareConfigs", "compares", "two", "config", "maps", "and", "returns", "an", "error", "if", "they", "differ", "." ]
[ "func", "CompareConfigs", "(", "config1", ",", "config2", "map", "[", "string", "]", "string", ",", "exclude", "[", "]", "string", ")", "error", "{", "if", "exclude", "==", "nil", "{", "exclude", "=", "[", "]", "string", "{", "}", "\n", "}", "\n\n", "delta", ":=", "[", "]", "string", "{", "}", "\n", "for", "key", ",", "value", ":=", "range", "config1", "{", "if", "shared", ".", "StringInSlice", "(", "key", ",", "exclude", ")", "{", "continue", "\n", "}", "\n", "if", "config2", "[", "key", "]", "!=", "value", "{", "delta", "=", "append", "(", "delta", ",", "key", ")", "\n", "}", "\n", "}", "\n", "for", "key", ",", "value", ":=", "range", "config2", "{", "if", "shared", ".", "StringInSlice", "(", "key", ",", "exclude", ")", "{", "continue", "\n", "}", "\n", "if", "config1", "[", "key", "]", "!=", "value", "{", "present", ":=", "false", "\n", "for", "i", ":=", "range", "delta", "{", "if", "delta", "[", "i", "]", "==", "key", "{", "present", "=", "true", "\n", "}", "\n", "break", "\n", "}", "\n", "if", "!", "present", "{", "delta", "=", "<mask>", "(", "delta", ",", "key", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "sort", ".", "Strings", "(", "delta", ")", "\n", "if", "len", "(", "delta", ")", ">", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "delta", ",", "\"", "\"", ")", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
2,046
all-2047
[ "GetDashCount", "is", "a", "wrapper", "around", "cairo_get_dash_count", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "GetDashCount", "(", ")", "int", "{", "c", ":=", "C", ".", "cairo_get_dash_count", "(", "v", ".", "native", "(", ")", ")", "\n", "return", "int", "(", "c", ")", "\n", "}" ]
2,047
all-2048
[ "ContainerGetSnapshotsFull", "returns", "all", "container", "objects", "for", "snapshots", "of", "a", "given", "container" ]
[ "func", "(", "c", "*", "ClusterTx", ")", "ContainerGetSnapshotsFull", "(", "project", "string", ",", "name", "string", ")", "(", "[", "]", "Container", ",", "error", ")", "{", "filter", ":=", "ContainerFilter", "{", "Parent", ":", "name", ",", "Project", ":", "<mask>", ",", "Type", ":", "int", "(", "CTypeSnapshot", ")", ",", "}", "\n\n", "return", "c", ".", "ContainerList", "(", "filter", ")", "\n", "}" ]
2,048
all-2049
[ "TODO", "export", "FileSequence_Split", "func", "FileSequence_Split", "()", "FileSequences", "{", "/", "*" ]
[ "func", "FramesToFrameRange", "(", "frames", "*", "C", ".", "int", ",", "num", "C", ".", "size_t", ",", "sorted", "bool", ",", "zfill", "int", ")", "*", "C", ".", "char", "{", "// caller must free string", "if", "num", "==", "C", ".", "size_t", "(", "0", ")", "{", "return", "C", ".", "CString", "(", "\"", "\"", ")", "\n", "}", "\n\n", "n", ":=", "int", "(", "num", ")", "\n", "slice", ":=", "(", "*", "[", "1", "<<", "30", "]", "C", ".", "int", ")", "(", "unsafe", ".", "Pointer", "(", "frames", ")", ")", "[", ":", "n", ":", "n", "]", "\n\n", "ints", ":=", "<mask>", "(", "[", "]", "int", ",", "n", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "n", ";", "i", "++", "{", "ints", "[", "i", "]", "=", "int", "(", "slice", "[", "i", "]", ")", "\n", "}", "\n\n", "return", "C", ".", "CString", "(", "fileseq", ".", "FramesToFrameRange", "(", "ints", ",", "sorted", ",", "zfill", ")", ")", "\n", "}" ]
2,049
all-2050
[ "serve", "accepts", "incoming", "connections", "on", "the", "listener", "l", "creating", "a", "new", "service", "goroutine", "for", "each", ".", "The", "service", "goroutines", "read", "requests", "and", "then", "call", "handler", "to", "reply", "to", "them", "." ]
[ "func", "(", "sctx", "*", "serveCtx", ")", "serve", "(", "s", "*", "etcdserver", ".", "EtcdServer", ",", "tlsinfo", "*", "transport", ".", "TLSInfo", ",", "handler", "http", ".", "Handler", ",", "errHandler", "func", "(", "error", ")", ",", "gopts", "...", "grpc", ".", "ServerOption", ")", "(", "err", "error", ")", "{", "logger", ":=", "defaultLog", ".", "New", "(", "ioutil", ".", "Discard", ",", "\"", "\"", ",", "0", ")", "\n", "<-", "s", ".", "ReadyNotify", "(", ")", "\n\n", "if", "sctx", ".", "lg", "==", "nil", "{", "plog", ".", "Info", "(", "\"", "\"", ")", "\n", "}", "\n\n", "m", ":=", "cmux", ".", "New", "(", "sctx", ".", "l", ")", "\n", "v3c", ":=", "v3client", ".", "New", "(", "s", ")", "\n", "servElection", ":=", "v3election", ".", "NewElectionServer", "(", "v3c", ")", "\n", "servLock", ":=", "v3lock", ".", "NewLockServer", "(", "v3c", ")", "\n\n", "var", "gs", "*", "grpc", ".", "Server", "\n", "defer", "func", "(", ")", "{", "if", "err", "!=", "nil", "&&", "gs", "!=", "nil", "{", "gs", ".", "Stop", "(", ")", "\n", "}", "\n", "}", "(", ")", "\n\n", "if", "sctx", ".", "insecure", "{", "gs", "=", "v3rpc", ".", "Server", "(", "s", ",", "nil", ",", "gopts", "...", ")", "\n", "v3electionpb", ".", "RegisterElectionServer", "(", "gs", ",", "servElection", ")", "\n", "v3lockpb", ".", "RegisterLockServer", "(", "gs", ",", "servLock", ")", "\n", "if", "sctx", ".", "serviceRegister", "!=", "nil", "{", "sctx", ".", "serviceRegister", "(", "gs", ")", "\n", "}", "\n", "grpcl", ":=", "m", ".", "Match", "(", "cmux", ".", "HTTP2", "(", ")", ")", "\n", "go", "func", "(", ")", "{", "errHandler", "(", "gs", ".", "Serve", "(", "grpcl", ")", ")", "}", "(", ")", "\n\n", "var", "gwmux", "*", "gw", ".", "ServeMux", "\n", "if", "s", ".", "Cfg", ".", "EnableGRPCGateway", "{", "gwmux", ",", "err", "=", "sctx", ".", "registerGateway", "(", "[", "]", "grpc", ".", "DialOption", "{", "grpc", ".", "WithInsecure", "(", ")", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "httpmux", ":=", "sctx", ".", "createMux", "(", "gwmux", ",", "handler", ")", "\n\n", "srvhttp", ":=", "&", "http", ".", "<mask>", "{", "Handler", ":", "createAccessController", "(", "sctx", ".", "lg", ",", "s", ",", "httpmux", ")", ",", "ErrorLog", ":", "logger", ",", "// do not log user error", "}", "\n", "httpl", ":=", "m", ".", "Match", "(", "cmux", ".", "HTTP1", "(", ")", ")", "\n", "go", "func", "(", ")", "{", "errHandler", "(", "srvhttp", ".", "Serve", "(", "httpl", ")", ")", "}", "(", ")", "\n\n", "sctx", ".", "serversC", "<-", "&", "servers", "{", "grpc", ":", "gs", ",", "http", ":", "srvhttp", "}", "\n", "if", "sctx", ".", "lg", "!=", "nil", "{", "sctx", ".", "lg", ".", "Info", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "sctx", ".", "l", ".", "Addr", "(", ")", ".", "String", "(", ")", ")", ",", ")", "\n", "}", "else", "{", "plog", ".", "Noticef", "(", "\"", "\"", ",", "sctx", ".", "l", ".", "Addr", "(", ")", ".", "String", "(", ")", ")", "\n", "}", "\n", "}", "\n\n", "if", "sctx", ".", "secure", "{", "tlscfg", ",", "tlsErr", ":=", "tlsinfo", ".", "ServerConfig", "(", ")", "\n", "if", "tlsErr", "!=", "nil", "{", "return", "tlsErr", "\n", "}", "\n", "gs", "=", "v3rpc", ".", "Server", "(", "s", ",", "tlscfg", ",", "gopts", "...", ")", "\n", "v3electionpb", ".", "RegisterElectionServer", "(", "gs", ",", "servElection", ")", "\n", "v3lockpb", ".", "RegisterLockServer", "(", "gs", ",", "servLock", ")", "\n", "if", "sctx", ".", "serviceRegister", "!=", "nil", "{", "sctx", ".", "serviceRegister", "(", "gs", ")", "\n", "}", "\n", "handler", "=", "grpcHandlerFunc", "(", "gs", ",", "handler", ")", "\n\n", "var", "gwmux", "*", "gw", ".", "ServeMux", "\n", "if", "s", ".", "Cfg", ".", "EnableGRPCGateway", "{", "dtls", ":=", "tlscfg", ".", "Clone", "(", ")", "\n", "// trust local server", "dtls", ".", "InsecureSkipVerify", "=", "true", "\n", "creds", ":=", "credentials", ".", "NewTLS", "(", "dtls", ")", "\n", "opts", ":=", "[", "]", "grpc", ".", "DialOption", "{", "grpc", ".", "WithTransportCredentials", "(", "creds", ")", "}", "\n", "gwmux", ",", "err", "=", "sctx", ".", "registerGateway", "(", "opts", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "var", "tlsl", "net", ".", "Listener", "\n", "tlsl", ",", "err", "=", "transport", ".", "NewTLSListener", "(", "m", ".", "Match", "(", "cmux", ".", "Any", "(", ")", ")", ",", "tlsinfo", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "// TODO: add debug flag; enable logging when debug flag is set", "httpmux", ":=", "sctx", ".", "createMux", "(", "gwmux", ",", "handler", ")", "\n\n", "srv", ":=", "&", "http", ".", "Server", "{", "Handler", ":", "createAccessController", "(", "sctx", ".", "lg", ",", "s", ",", "httpmux", ")", ",", "TLSConfig", ":", "tlscfg", ",", "ErrorLog", ":", "logger", ",", "// do not log user error", "}", "\n", "go", "func", "(", ")", "{", "errHandler", "(", "srv", ".", "Serve", "(", "tlsl", ")", ")", "}", "(", ")", "\n\n", "sctx", ".", "serversC", "<-", "&", "servers", "{", "secure", ":", "true", ",", "grpc", ":", "gs", ",", "http", ":", "srv", "}", "\n", "if", "sctx", ".", "lg", "!=", "nil", "{", "sctx", ".", "lg", ".", "Info", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "sctx", ".", "l", ".", "Addr", "(", ")", ".", "String", "(", ")", ")", ",", ")", "\n", "}", "else", "{", "plog", ".", "Infof", "(", "\"", "\"", ",", "sctx", ".", "l", ".", "Addr", "(", ")", ".", "String", "(", ")", ")", "\n", "}", "\n", "}", "\n\n", "close", "(", "sctx", ".", "serversC", ")", "\n", "return", "m", ".", "Serve", "(", ")", "\n", "}" ]
2,050
all-2051
[ "shortHostname", "returns", "its", "argument", "truncating", "at", "the", "first", "period", ".", "For", "instance", "given", "www", ".", "google", ".", "com", "it", "returns", "www", "." ]
[ "func", "shortHostname", "(", "hostname", "string", ")", "string", "{", "if", "i", ":=", "strings", ".", "<mask>", "(", "hostname", ",", "\"", "\"", ")", ";", "i", ">=", "0", "{", "return", "hostname", "[", ":", "i", "]", "\n", "}", "\n", "return", "hostname", "\n", "}" ]
2,051
all-2052
[ "Locator", "returns", "a", "locator", "for", "the", "given", "resource" ]
[ "func", "(", "r", "*", "SecurityGroupRule", ")", "Locator", "(", "api", "*", "API", ")", "*", "SecurityGroupRuleLocator", "{", "for", "_", ",", "l", ":=", "<mask>", "r", ".", "Links", "{", "if", "l", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "return", "api", ".", "SecurityGroupRuleLocator", "(", "l", "[", "\"", "\"", "]", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
2,052
all-2053
[ "SetMarginTop", "is", "a", "wrapper", "around", "gtk_widget_set_margin_top", "()", "." ]
[ "func", "(", "v", "*", "Widget", ")", "SetMarginTop", "(", "<mask>", "int", ")", "{", "C", ".", "gtk_widget_set_margin_top", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "margin", ")", ")", "\n", "}" ]
2,053
all-2054
[ "SetMetadata", "gets", "a", "metadata", "value", "from", "the", "object", "." ]
[ "func", "(", "o", "*", "Object", ")", "GetMetadata", "(", "key", "string", ")", "(", "string", ",", "error", ")", "{", "data", ",", "<mask>", ":=", "o", ".", "Metadata", "[", "key", "]", "\n", "if", "!", "ok", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "key", ")", "\n", "}", "\n\n", "return", "data", ".", "value", ",", "nil", "\n", "}" ]
2,054
all-2055
[ "MiddlewareFunc", "makes", "AccessLogJsonMiddleware", "implement", "the", "Middleware", "interface", "." ]
[ "func", "(", "mw", "*", "AccessLogJsonMiddleware", ")", "MiddlewareFunc", "(", "h", "HandlerFunc", ")", "HandlerFunc", "{", "// set the default Logger", "if", "mw", ".", "Logger", "==", "nil", "{", "mw", ".", "Logger", "=", "log", ".", "New", "(", "os", ".", "Stderr", ",", "\"", "\"", ",", "0", ")", "\n", "}", "\n\n", "return", "func", "(", "w", "ResponseWriter", ",", "r", "*", "<mask>", ")", "{", "// call the handler", "h", "(", "w", ",", "r", ")", "\n\n", "mw", ".", "Logger", ".", "Printf", "(", "\"", "\"", ",", "makeAccessLogJsonRecord", "(", "r", ")", ".", "asJson", "(", ")", ")", "\n", "}", "\n", "}" ]
2,055
all-2056
[ "FriendlyPrice", "flips", "the", "sign", "of", "the", "Price", "(", "which", "is", "usually", "reported", "from", "the", "API", "as", "a", "negative", "number", ")", "and", "adds", "an", "appropriate", "currency", "symbol", "in", "front", "of", "it", ".", "For", "example", "a", "PriceUnit", "of", "USD", "and", "a", "Price", "of", "-", "1", ".", "25", "is", "reported", "as", "$1", ".", "25", "." ]
[ "func", "(", "t", "*", "Transcription", ")", "FriendlyPrice", "(", ")", "string", "{", "if", "t", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "<mask>", "(", "t", ".", "PriceUnit", ",", "t", ".", "Price", ")", "\n", "}" ]
2,056
all-2057
[ "Ask", "will", "call", "UI", ".", "Ask", "with", "message", "then", "wait", "for", "UI", ".", "Ask", "to", "return", "a", "response", "and", "/", "or", "error", ".", "It", "will", "clean", "the", "response", "by", "removing", "any", "carriage", "returns", "and", "new", "lines", "that", "if", "finds", ".", "Then", "it", "will", "trim", "the", "message", "using", "the", "trim", "variable", ".", "Use", "and", "empty", "string", "to", "specify", "you", "do", "not", "want", "to", "trim", ".", "If", "a", "message", "is", "not", "used", "(", ")", "then", "it", "will", "not", "prompt", "user", "before", "waiting", "on", "a", "response", ".", "AskPrefix", "is", "used", "to", "prefix", "message", "." ]
[ "func", "(", "ui", "*", "PrefixUI", ")", "Ask", "(", "message", ",", "trim", "string", ")", "(", "string", ",", "error", ")", "{", "if", "ui", ".", "AskPrefix", "==", "\"", "\"", "{", "//Lets keep the space if they want one", "message", "=", "ui", ".", "AskPrefix", "+", "<mask>", "\n", "}", "else", "if", "ui", ".", "AskPrefix", "!=", "\"", "\"", "{", "message", "=", "ui", ".", "AskPrefix", "+", "\"", "\"", "+", "message", "\n", "}", "\n", "res", ",", "err", ":=", "ui", ".", "UI", ".", "Ask", "(", "message", ",", "trim", ")", "\n", "return", "res", ",", "err", "\n", "}" ]
2,057
all-2058
[ "recvAck", "notifies", "the", "readonly", "struct", "that", "the", "raft", "state", "machine", "received", "an", "acknowledgment", "of", "the", "heartbeat", "that", "attached", "with", "the", "read", "only", "request", "context", "." ]
[ "func", "(", "ro", "*", "readOnly", ")", "recvAck", "(", "m", "pb", ".", "Message", ")", "int", "{", "rs", ",", "ok", ":=", "ro", ".", "pendingReadIndex", "[", "string", "(", "m", ".", "<mask>", ")", "]", "\n", "if", "!", "ok", "{", "return", "0", "\n", "}", "\n\n", "rs", ".", "acks", "[", "m", ".", "From", "]", "=", "struct", "{", "}", "{", "}", "\n", "// add one to include an ack from local node", "return", "len", "(", "rs", ".", "acks", ")", "+", "1", "\n", "}" ]
2,058
all-2059
[ "RuneLen", "returns", "the", "number", "of", "bytes", "required", "to", "encode", "the", "rune", "." ]
[ "func", "RuneLen", "(", "r", "rune", ")", "int", "{", "switch", "{", "case", "r", "<", "0", ":", "return", "-", "1", "\n", "case", "r", "<=", "rune1Max", ":", "return", "1", "\n", "<mask>", "r", "<=", "rune2Max", ":", "return", "2", "\n", "case", "r", "<=", "rune3Max", ":", "return", "3", "\n", "case", "r", "<=", "utf8", ".", "MaxRune", ":", "return", "CESUMax", "\n", "}", "\n", "return", "-", "1", "\n", "}" ]
2,059
all-2060
[ "NewKeyPair", "generates", "a", "new", "SSH", "keypair", "This", "will", "return", "a", "private", "&", "public", "key", "encoded", "as", "DER", "." ]
[ "func", "NewKeyPair", "(", ")", "(", "keyPair", "*", "KeyPair", ",", "err", "error", ")", "{", "priv", ",", "err", ":=", "rsa", ".", "GenerateKey", "(", "<mask>", ".", "Reader", ",", "2048", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "ErrKeyGeneration", "\n", "}", "\n\n", "if", "err", ":=", "priv", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "ErrValidation", "\n", "}", "\n\n", "privDer", ":=", "x509", ".", "MarshalPKCS1PrivateKey", "(", "priv", ")", "\n\n", "pubSSH", ",", "err", ":=", "gossh", ".", "NewPublicKey", "(", "&", "priv", ".", "PublicKey", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "ErrPublicKey", "\n", "}", "\n\n", "return", "&", "KeyPair", "{", "PrivateKey", ":", "privDer", ",", "PublicKey", ":", "gossh", ".", "MarshalAuthorizedKey", "(", "pubSSH", ")", ",", "}", ",", "nil", "\n", "}" ]
2,060
all-2061
[ "argReader", "returns", "an", "ArgReader", "that", "can", "be", "used", "to", "read", "an", "argument", ".", "The", "ReadCloser", "must", "be", "closed", "once", "the", "argument", "has", "been", "read", "." ]
[ "func", "(", "r", "*", "reqResReader", ")", "argReader", "(", "last", "bool", ",", "inState", "reqResReaderState", ",", "outState", "reqResReaderState", ")", "(", "ArgReader", ",", "error", ")", "{", "if", "r", ".", "state", "!=", "inState", "{", "return", "nil", ",", "r", ".", "<mask>", "(", "errReqResReaderStateMismatch", "{", "state", ":", "r", ".", "state", ",", "expectedState", ":", "inState", "}", ")", "\n", "}", "\n\n", "argReader", ",", "err", ":=", "r", ".", "contents", ".", "ArgReader", "(", "last", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "r", ".", "failed", "(", "err", ")", "\n", "}", "\n\n", "r", ".", "state", "=", "outState", "\n", "return", "argReader", ",", "nil", "\n", "}" ]
2,061
all-2062
[ "func", "(", "v", "*", "IconView", ")", "SelectedForeach", "()", "{}", "SetSelectionMode", "is", "a", "wrapper", "around", "gtk_icon_view_set_selection_mode", "()", "." ]
[ "func", "(", "v", "*", "IconView", ")", "SetSelectionMode", "(", "mode", "SelectionMode", ")", "{", "C", ".", "gtk_icon_view_set_selection_mode", "(", "v", ".", "native", "(", ")", ",", "C", ".", "GtkSelectionMode", "(", "<mask>", ")", ")", "\n", "}" ]
2,062
all-2063
[ "Fetches", "the", "userId", "given", "a", "valid", "username" ]
[ "func", "getUserId", "(", "username", "string", ")", "(", "int", ",", "error", ")", "{", "url", ":=", "fmt", ".", "Sprintf", "(", "USER_ID_PATH", ",", "API", ",", "username", ",", "APP_VERSION", ")", "\n", "res", ",", "err", ":=", "http", ".", "Get", "(", "url", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n", "var", "data", "GetUserIdResponse", "\n", "json", ".", "NewDecoder", "(", "res", ".", "Body", ")", ".", "Decode", "(", "&", "data", ")", "\n", "if", "!", "data", ".", "Success", "&&", "data", ".", "Error", "!=", "\"", "\"", "{", "return", "0", ",", "<mask>", ".", "New", "(", "data", ".", "Error", ")", "\n", "}", "\n", "return", "data", ".", "UserId", ",", "nil", "\n", "}" ]
2,063
all-2064
[ "post", "POSTs", "a", "data", "payload", "to", "a", "url", ".", "Returns", "nil", "if", "the", "POST", "succeeds", "error", "on", "any", "failure", "." ]
[ "func", "(", "p", "*", "pipeline", ")", "post", "(", "data", "[", "]", "byte", ")", "(", "err", "error", ")", "{", "u", ":=", "p", ".", "picker", ".", "pick", "(", ")", "\n", "req", ":=", "createPostRequest", "(", "u", ",", "RaftPrefix", ",", "bytes", ".", "NewBuffer", "(", "data", ")", ",", "\"", "\"", ",", "p", ".", "tr", ".", "URLs", ",", "p", ".", "tr", ".", "ID", ",", "p", ".", "tr", ".", "ClusterID", ")", "\n\n", "done", ":=", "make", "(", "chan", "struct", "{", "}", ",", "1", ")", "\n", "ctx", ",", "cancel", ":=", "context", ".", "WithCancel", "(", "context", ".", "Background", "(", ")", ")", "\n", "req", "=", "req", ".", "WithContext", "(", "ctx", ")", "\n", "go", "func", "(", ")", "{", "select", "{", "case", "<-", "done", ":", "<mask>", "<-", "p", ".", "stopc", ":", "waitSchedule", "(", ")", "\n", "cancel", "(", ")", "\n", "}", "\n", "}", "(", ")", "\n\n", "resp", ",", "err", ":=", "p", ".", "tr", ".", "pipelineRt", ".", "RoundTrip", "(", "req", ")", "\n", "done", "<-", "struct", "{", "}", "{", "}", "\n", "if", "err", "!=", "nil", "{", "p", ".", "picker", ".", "unreachable", "(", "u", ")", "\n", "return", "err", "\n", "}", "\n", "defer", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "b", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "resp", ".", "Body", ")", "\n", "if", "err", "!=", "nil", "{", "p", ".", "picker", ".", "unreachable", "(", "u", ")", "\n", "return", "err", "\n", "}", "\n\n", "err", "=", "checkPostResponse", "(", "resp", ",", "b", ",", "req", ",", "p", ".", "peerID", ")", "\n", "if", "err", "!=", "nil", "{", "p", ".", "picker", ".", "unreachable", "(", "u", ")", "\n", "// errMemberRemoved is a critical error since a removed member should", "// always be stopped. So we use reportCriticalError to report it to errorc.", "if", "err", "==", "errMemberRemoved", "{", "reportCriticalError", "(", "err", ",", "p", ".", "errorc", ")", "\n", "}", "\n", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
2,064
all-2065
[ "GetTopics", "returns", "the", "topics", "this", "node", "is", "subscribed", "to", "." ]
[ "func", "(", "p", "*", "PubSub", ")", "GetTopics", "(", ")", "[", "]", "string", "{", "out", ":=", "make", "(", "chan", "[", "]", "string", ",", "1", ")", "\n", "p", ".", "getTopics", "<-", "&", "topicReq", "{", "resp", ":", "<mask>", "}", "\n", "return", "<-", "out", "\n", "}" ]
2,065
all-2066
[ "NewLexerString", "creates", "a", "new", "Lexer", "reading", "from", "a", "string", ".", "This", "Lexer", "has", "a", "DefaultTokenizer", "according", "to", "posix", "and", "whitespacesplit", "rules", "." ]
[ "func", "NewLexerString", "(", "s", "<mask>", ",", "posix", ",", "whitespacesplit", "bool", ")", "*", "Lexer", "{", "return", "NewLexer", "(", "strings", ".", "NewReader", "(", "s", ")", ",", "posix", ",", "whitespacesplit", ")", "\n", "}" ]
2,066
all-2067
[ "EmptyFile", "creates", "a", "File", "wrapped", "around", "an", "empty", "syntax", "tree", "." ]
[ "func", "EmptyFile", "(", "path", ",", "pkg", "string", ")", "*", "File", "{", "return", "&", "<mask>", "{", "File", ":", "&", "bzl", ".", "File", "{", "Path", ":", "path", ",", "Type", ":", "bzl", ".", "TypeBuild", "}", ",", "Path", ":", "path", ",", "Pkg", ":", "pkg", ",", "}", "\n", "}" ]
2,067
all-2068
[ "createACSClient", "creates", "the", "ACS", "Client", "using", "the", "specified", "URL" ]
[ "func", "(", "acsResources", "*", "acsSessionResources", ")", "createACSClient", "(", "<mask>", "string", ",", "cfg", "*", "config", ".", "Config", ")", "wsclient", ".", "ClientServer", "{", "return", "acsclient", ".", "New", "(", "url", ",", "cfg", ",", "acsResources", ".", "credentialsProvider", ",", "wsRWTimeout", ")", "\n", "}" ]
2,068
all-2069
[ "flattenClusterFailoverLevelAdmissionControlPolicy", "saves", "a", "ClusterFailoverLevelAdmissionControlPolicy", "into", "the", "supplied", "ResourceData", "." ]
[ "func", "flattenClusterFailoverLevelAdmissionControlPolicy", "(", "d", "*", "schema", ".", "ResourceData", ",", "obj", "*", "types", ".", "ClusterFailoverLevelAdmissionControlPolicy", ",", ")", "error", "{", "if", "err", ":=", "d", ".", "<mask>", "(", "\"", "\"", ",", "obj", ".", "FailoverLevel", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "obj", ".", "SlotPolicy", "!=", "nil", "{", "return", "structure", ".", "SetBatch", "(", "d", ",", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "obj", ".", "SlotPolicy", ".", "(", "*", "types", ".", "ClusterFixedSizeSlotPolicy", ")", ".", "Cpu", ",", "\"", "\"", ":", "obj", ".", "SlotPolicy", ".", "(", "*", "types", ".", "ClusterFixedSizeSlotPolicy", ")", ".", "Memory", ",", "}", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
2,069
all-2070
[ "helper" ]
[ "func", "authFieldSize", "(", "f", "[", "]", "byte", ")", "int", "{", "size", ":=", "len", "(", "f", ")", "\n", "if", "<mask>", ">=", "250", "{", "// - different indicators compared to db field handling", "// - 1-5 bytes? but only 1 resp 3 bytes explained", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "size", "+", "1", "//length indicator size := 1", "\n", "}" ]
2,070
all-2071
[ "define", "an", "array", "of", "generic", "vertex", "attribute", "data" ]
[ "func", "VertexAttribPointer", "(", "index", "uint32", ",", "<mask>", "int32", ",", "xtype", "uint32", ",", "normalized", "bool", ",", "stride", "int32", ",", "pointer", "unsafe", ".", "Pointer", ")", "{", "C", ".", "glowVertexAttribPointer", "(", "gpVertexAttribPointer", ",", "(", "C", ".", "GLuint", ")", "(", "index", ")", ",", "(", "C", ".", "GLint", ")", "(", "size", ")", ",", "(", "C", ".", "GLenum", ")", "(", "xtype", ")", ",", "(", "C", ".", "GLboolean", ")", "(", "boolToInt", "(", "normalized", ")", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "stride", ")", ",", "pointer", ")", "\n", "}" ]
2,071
all-2072
[ "DeepCopyInto", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "writing", "into", "out", ".", "in", "must", "be", "non", "-", "nil", "." ]
[ "func", "(", "in", "*", "DNSEndpointList", ")", "DeepCopyInto", "(", "out", "*", "DNSEndpointList", ")", "{", "*", "out", "=", "*", "in", "\n", "out", ".", "TypeMeta", "=", "in", ".", "TypeMeta", "\n", "<mask>", ".", "ListMeta", "=", "in", ".", "ListMeta", "\n", "if", "in", ".", "Items", "!=", "nil", "{", "in", ",", "out", ":=", "&", "in", ".", "Items", ",", "&", "out", ".", "Items", "\n", "*", "out", "=", "make", "(", "[", "]", "DNSEndpoint", ",", "len", "(", "*", "in", ")", ")", "\n", "for", "i", ":=", "range", "*", "in", "{", "(", "*", "in", ")", "[", "i", "]", ".", "DeepCopyInto", "(", "&", "(", "*", "out", ")", "[", "i", "]", ")", "\n", "}", "\n", "}", "\n", "return", "\n", "}" ]
2,072
all-2073
[ "Gauge", "sets", "a", "gauge", "to", "a", "value" ]
[ "func", "(", "m", "*", "CirconusMetrics", ")", "Gauge", "(", "metric", "string", ",", "val", "<mask>", "{", "}", ")", "{", "m", ".", "SetGauge", "(", "metric", ",", "val", ")", "\n", "}" ]
2,073
all-2074
[ "SetAccelGroup", "is", "a", "wrapper", "around", "gtk_menu_set_accel_group", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "SetAccelGroup", "(", "accelGroup", "*", "AccelGroup", ")", "{", "C", ".", "gtk_menu_set_accel_group", "(", "v", ".", "native", "(", ")", ",", "accelGroup", ".", "native", "(", ")", ")", "\n", "}" ]
2,074
all-2075
[ "PortAt", "returns", "expose", "and", "publish", "port", "information", "at", "especified", "index", "." ]
[ "func", "(", "s", "NetworkSettings", ")", "PortAt", "(", "<mask>", "int", ")", "(", "string", ",", "*", "HostPublish", ")", "{", "counter", ":=", "0", "\n", "for", "k", ",", "v", ":=", "range", "s", ".", "Ports", "{", "if", "counter", "!=", "index", "{", "counter", "++", "\n", "continue", "\n", "}", "\n\n", "return", "k", ",", "v", "\n", "}", "\n\n", "return", "\"", "\"", ",", "nil", "\n", "}" ]
2,075
all-2076
[ "setState", "is", "used", "to", "update", "the", "current", "state", ".", "Any", "state", "transition", "causes", "the", "known", "leader", "to", "be", "cleared", ".", "This", "means", "that", "leader", "should", "be", "set", "only", "after", "updating", "the", "state", "." ]
[ "func", "(", "r", "*", "Raft", ")", "setState", "(", "<mask>", "RaftState", ")", "{", "r", ".", "setLeader", "(", "\"", "\"", ")", "\n", "oldState", ":=", "r", ".", "raftState", ".", "getState", "(", ")", "\n", "r", ".", "raftState", ".", "setState", "(", "state", ")", "\n", "if", "oldState", "!=", "state", "{", "r", ".", "observe", "(", "state", ")", "\n", "}", "\n", "}" ]
2,076
all-2077
[ "Uniq", "squashes", "adjacent", "identical", "items", "in", "arg", ".", "In", "into", "a", "single", "output", "." ]
[ "func", "Uniq", "(", ")", "Filter", "{", "return", "FilterFunc", "(", "func", "(", "arg", "Arg", ")", "error", "{", "first", ":=", "true", "\n", "last", ":=", "\"", "\"", "\n", "for", "s", ":=", "range", "arg", ".", "In", "{", "if", "first", "||", "last", "!=", "s", "{", "arg", ".", "Out", "<-", "s", "\n", "}", "\n", "last", "=", "s", "\n", "first", "=", "<mask>", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "}" ]
2,077
all-2078
[ "Gets", "an", "app", "s", "endpoint", "with", "the", "specified", "path" ]
[ "func", "AppUri", "(", "appName", ",", "path", "string", ",", "config", "helpersinternal", ".", "CurlConfig", ")", "string", "{", "uriCreator", ":=", "&", "helpersinternal", ".", "AppUriCreator", "{", "CurlConfig", ":", "config", "}", "\n\n", "return", "uriCreator", ".", "AppUri", "(", "appName", ",", "<mask>", ")", "\n", "}" ]
2,078
all-2079
[ "addType", "conditionally", "adds", "a", "new", "type", "trying", "its", "best", "to", "avoid", "type", "collisions", ".", "This", "is", "the", "downside", "of", "swagger", "2", "vs", "swagger", "3", ".", "For", "swagger", "2", "if", "you", "the", "same", "type", "like", "User", "returned", "in", "multiple", "places", "each", "have", "to", "create", "their", "own", "definition", "in", "the", "swagger", "definitions", "section", "for", "goa", "v2", ".", "So", "they", "ll", "be", "X", "copies", "of", "identical", "definition", "for", "a", "User", "struct", "lets", "say", ".", "This", "tries", "to", "collapse", "those", "things", "down", "into", "one", "return", "type", "struct", "." ]
[ "func", "(", "a", "*", "APIAnalyzer", ")", "addType", "(", "ec", "EvalCtx", ",", "dt", "*", "gen", ".", "ObjectDataType", ",", "r", "Ref", ")", "{", "a", ".", "api", ".", "NeedJSON", "=", "true", "\n", "if", "a", ".", "refByType", "[", "dt", ".", "TypeName", "]", "==", "r", ".", "ID", "(", ")", "{", "return", "\n", "}", "\n\n", "if", "other", ",", "ok", ":=", "a", ".", "api", ".", "Types", "[", "dt", ".", "TypeName", "]", ";", "ok", "{", "if", "!", "ec", ".", "IsResult", "{", "// If its an input parameter, fix the collision by amending this types name", "dt", ".", "TypeName", "+=", "\"", "\"", "\n", "if", "a", ".", "refByType", "[", "dt", ".", "TypeName", "]", "==", "r", ".", "ID", "(", ")", "{", "return", "\n", "}", "\n", "}", "\n", "oldFields", ":=", "[", "]", "string", "{", "}", "\n", "newFields", ":=", "[", "]", "string", "{", "}", "\n", "for", "_", ",", "f", ":=", "range", "other", ".", "Fields", "{", "oldFields", "=", "append", "(", "oldFields", ",", "f", ".", "Name", ")", "\n", "}", "\n", "for", "_", ",", "f", ":=", "range", "dt", ".", "Fields", "{", "newFields", "=", "append", "(", "newFields", ",", "f", ".", "Name", ")", "\n", "}", "\n", "use", ":=", "\"", "\"", "\n", "if", "len", "(", "newFields", ")", ">", "len", "(", "oldFields", ")", "{", "<mask>", "=", "\"", "\"", "\n", "}", "\n", "if", "strings", ".", "Join", "(", "oldFields", ",", "\"", "\"", ")", "!=", "strings", ".", "Join", "(", "newFields", ",", "\"", "\"", ")", "{", "warn", "(", "\"", "\\n", "\\n", "\\n", "\\n", "\"", ",", "dt", ".", "TypeName", ",", "r", ".", "ID", "(", ")", ",", "newFields", ",", "a", ".", "refByType", "[", "dt", ".", "TypeName", "]", ",", "oldFields", ",", "use", ")", "\n", "}", "\n", "if", "use", "==", "\"", "\"", "{", "return", "\n", "}", "\n", "}", "\n", "dbg", "(", "\"", "\\n", "\"", ",", "prettify", "(", "dt", ")", ")", "\n", "a", ".", "refByType", "[", "dt", ".", "TypeName", "]", "=", "r", ".", "ID", "(", ")", "\n", "a", ".", "api", ".", "Types", "[", "dt", ".", "TypeName", "]", "=", "dt", "\n", "}" ]
2,079
all-2080
[ "Widths", "returns", "the", "widths", "of", "the", "glyphs", "in", "the", "font", ".", "In", "a", "well", "-", "formed", "PDF", "len", "(", "f", ".", "Widths", "()", ")", "==", "f", ".", "LastChar", "()", "+", "1", "-", "f", ".", "FirstChar", "()", "." ]
[ "func", "(", "f", "Font", ")", "Widths", "(", ")", "[", "]", "float64", "{", "x", ":=", "f", ".", "V", ".", "Key", "(", "\"", "\"", ")", "\n", "var", "out", "[", "]", "float64", "\n", "for", "i", ":=", "0", ";", "i", "<", "x", ".", "Len", "(", ")", ";", "i", "++", "{", "out", "=", "append", "(", "<mask>", ",", "x", ".", "Index", "(", "i", ")", ".", "Float64", "(", ")", ")", "\n", "}", "\n", "return", "out", "\n", "}" ]
2,080
all-2081
[ "ParseTag", "parses", "a", "raw", "tag", "obtained", "from", "a", "struct", "field", "returning", "the", "results", "as", "a", "tag", "value", "." ]
[ "func", "ParseTag", "(", "s", "string", ")", "Tag", "{", "var", "name", "string", "\n", "var", "omitzero", "bool", "\n", "var", "omitempty", "bool", "\n\n", "name", ",", "s", "=", "parseNextTagToken", "(", "s", ")", "\n\n", "for", "len", "(", "s", ")", "!=", "0", "{", "var", "token", "string", "\n", "switch", "token", ",", "s", "=", "parseNextTagToken", "(", "s", ")", ";", "token", "{", "case", "\"", "\"", ":", "omitempty", "=", "true", "\n", "case", "\"", "\"", ":", "omitzero", "=", "true", "\n", "}", "\n", "}", "\n\n", "return", "Tag", "{", "<mask>", ":", "name", ",", "Omitempty", ":", "omitempty", ",", "Omitzero", ":", "omitzero", ",", "}", "\n", "}" ]
2,081
all-2082
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetCookiesReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork34", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
2,082
all-2083
[ "New", "creates", "and", "initializes", "a", "new", "ScreenBuf", "." ]
[ "func", "New", "(", "w", "<mask>", ".", "Writer", ")", "*", "ScreenBuf", "{", "return", "&", "ScreenBuf", "{", "buf", ":", "&", "bytes", ".", "Buffer", "{", "}", ",", "w", ":", "w", "}", "\n", "}" ]
2,083
all-2084
[ "fuzzValueFor", "Generates", "random", "values", "for", "the", "following", "types", ":", "string", "bool", "int", "int32", "int64", "float32", "float64" ]
[ "func", "fuzzValueFor", "(", "kind", "reflect", ".", "Kind", ")", "reflect", ".", "Value", "{", "r", ":=", "rand", ".", "New", "(", "rand", ".", "NewSource", "(", "time", ".", "Now", "(", ")", ".", "UnixNano", "(", ")", ")", ")", "\n", "switch", "kind", "{", "case", "reflect", ".", "String", ":", "return", "reflect", ".", "ValueOf", "(", "randomString", "(", "25", ")", ")", "\n", "<mask>", "reflect", ".", "Int", ":", "return", "reflect", ".", "ValueOf", "(", "r", ".", "Int", "(", ")", ")", "\n", "case", "reflect", ".", "Int32", ":", "return", "reflect", ".", "ValueOf", "(", "r", ".", "Int31", "(", ")", ")", "\n", "case", "reflect", ".", "Int64", ":", "return", "reflect", ".", "ValueOf", "(", "r", ".", "Int63", "(", ")", ")", "\n", "case", "reflect", ".", "Float32", ":", "return", "reflect", ".", "ValueOf", "(", "r", ".", "Float32", "(", ")", ")", "\n", "case", "reflect", ".", "Float64", ":", "return", "reflect", ".", "ValueOf", "(", "r", ".", "Float64", "(", ")", ")", "\n", "case", "reflect", ".", "Bool", ":", "val", ":=", "r", ".", "Intn", "(", "2", ")", ">", "0", "\n", "return", "reflect", ".", "ValueOf", "(", "val", ")", "\n", "}", "\n\n", "return", "reflect", ".", "ValueOf", "(", "\"", "\"", ")", "\n", "}" ]
2,084
all-2085
[ "TagObject", "applies", "a", "tag", "to", "an", "existing", "object", "." ]
[ "func", "(", "c", "APIClient", ")", "TagObject", "(", "<mask>", "string", ",", "tags", "...", "string", ")", "error", "{", "var", "_tags", "[", "]", "*", "pfs", ".", "Tag", "\n", "for", "_", ",", "tag", ":=", "range", "tags", "{", "_tags", "=", "append", "(", "_tags", ",", "&", "pfs", ".", "Tag", "{", "Name", ":", "tag", "}", ")", "\n", "}", "\n", "if", "_", ",", "err", ":=", "c", ".", "ObjectAPIClient", ".", "TagObject", "(", "c", ".", "Ctx", "(", ")", ",", "&", "pfs", ".", "TagObjectRequest", "{", "Object", ":", "&", "pfs", ".", "Object", "{", "Hash", ":", "hash", "}", ",", "Tags", ":", "_tags", ",", "}", ",", ")", ";", "err", "!=", "nil", "{", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
2,085
all-2086
[ "MustAllowTrustOp", "retrieves", "the", "AllowTrustOp", "value", "from", "the", "union", "panicing", "if", "the", "value", "is", "not", "set", "." ]
[ "func", "(", "u", "OperationBody", ")", "MustAllowTrustOp", "(", ")", "AllowTrustOp", "{", "val", ",", "<mask>", ":=", "u", ".", "GetAllowTrustOp", "(", ")", "\n\n", "if", "!", "ok", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "val", "\n", "}" ]
2,086
all-2087
[ "Get", "returns", "the", "value", "associated", "with", "the", "key" ]
[ "func", "(", "lru", "*", "lruCache", ")", "Get", "(", "key", "string", ")", "(", "Value", ",", "bool", ")", "{", "lru", ".", "Lock", "(", ")", "\n", "defer", "lru", ".", "Unlock", "(", ")", "\n\n", "entry", ",", "ok", ":=", "lru", ".", "cache", "[", "<mask>", "]", "\n\n", "if", "!", "ok", "{", "return", "nil", ",", "false", "\n", "}", "\n\n", "ok", "=", "lru", ".", "evictStale", "(", "entry", ",", "key", ")", "\n", "if", "!", "ok", "{", "return", "nil", ",", "false", "\n", "}", "\n\n", "lru", ".", "updateAccessed", "(", "key", ")", "\n\n", "return", "entry", ".", "value", ",", "true", "\n", "}" ]
2,087
all-2088
[ "MarshalPrivateKey", "converts", "a", "key", "object", "into", "its", "protobuf", "serialized", "form", "." ]
[ "func", "MarshalPrivateKey", "(", "k", "PrivKey", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "pbmes", ":=", "new", "(", "<mask>", ".", "PrivateKey", ")", "\n", "pbmes", ".", "Type", "=", "k", ".", "Type", "(", ")", "\n", "data", ",", "err", ":=", "k", ".", "Raw", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "pbmes", ".", "Data", "=", "data", "\n", "return", "proto", ".", "Marshal", "(", "pbmes", ")", "\n", "}" ]
2,088
all-2089
[ "Update", "updates", "the", "uint64", "in", "the", "buffer" ]
[ "func", "(", "<mask>", "Uint64Ref", ")", "Update", "(", "n", "uint64", ")", "{", "if", "ref", "!=", "nil", "{", "binary", ".", "BigEndian", ".", "PutUint64", "(", "ref", ",", "n", ")", "\n", "}", "\n", "}" ]
2,089
all-2090
[ "GetPrivateKeyIDOk", "returns", "a", "tuple", "with", "the", "PrivateKeyID", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "i", "*", "IntegrationGCPCreateRequest", ")", "GetPrivateKeyIDOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "i", "==", "nil", "||", "i", ".", "PrivateKeyID", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "i", ".", "PrivateKeyID", ",", "<mask>", "\n", "}" ]
2,090
all-2091
[ "GetIdOk", "returns", "a", "tuple", "with", "the", "Id", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "m", "*", "Monitor", ")", "GetIdOk", "(", ")", "(", "int", ",", "bool", ")", "{", "if", "m", "==", "nil", "||", "m", ".", "Id", "==", "nil", "{", "return", "0", ",", "false", "\n", "}", "\n", "return", "*", "m", ".", "Id", ",", "<mask>", "\n", "}" ]
2,091
all-2092
[ "newVariableDumpClient", "defines", "accessors", "for", "package", "variables", "which", "are", "not", "go", "-", "routine", "safe", "so", "can", "theoretically", "change", "value", "while", "the", "client", "is", "in", "use", ".", "this", "emulates", "the", "legacy", "behavior", "." ]
[ "func", "newVariableDumpClient", "(", "c", "*", "http", ".", "<mask>", ")", "HTTPClient", "{", "dc", ":=", "&", "dumpClient", "{", "Client", ":", "c", "}", "\n", "dc", ".", "isInsecure", "=", "func", "(", ")", "bool", "{", "return", "Insecure", "\n", "}", "\n", "dc", ".", "dumpFormat", "=", "func", "(", ")", "Format", "{", "return", "DumpFormat", "\n", "}", "\n", "dc", ".", "hiddenHeaders", "=", "func", "(", ")", "map", "[", "string", "]", "bool", "{", "return", "HiddenHeaders", "\n", "}", "\n", "return", "dc", "\n", "}" ]
2,092
all-2093
[ "IsEssential", "returns", "whether", "the", "container", "is", "an", "essential", "container", "or", "not" ]
[ "func", "(", "c", "*", "Container", ")", "IsEssential", "(", ")", "bool", "{", "c", ".", "<mask>", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "return", "c", ".", "Essential", "\n", "}" ]
2,093
all-2094
[ "GetTime", "returns", "the", "Time", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "e", "*", "EventTimelineDefinition", ")", "GetTime", "(", ")", "WidgetTime", "{", "if", "e", "==", "nil", "||", "e", ".", "Time", "==", "nil", "{", "<mask>", "WidgetTime", "{", "}", "\n", "}", "\n", "return", "*", "e", ".", "Time", "\n", "}" ]
2,094
all-2095
[ "LoadFromEnv", "iterates", "through", "a", "struct", "s", "fields", "and", "tries", "to", "find", "matching", "environment", "variables", ".", "Returns", "a", "map", "of", "environment", "key", "and", "values", "that", "were", "successfully", "set", "into", "the", "struct" ]
[ "func", "LoadFromEnv", "(", "v", "interface", "{", "}", ",", "prefix", "string", ")", "(", "result", "[", "]", "MarshalledEnvironmentVar", ")", "{", "pointerValue", ":=", "reflect", ".", "ValueOf", "(", "v", ")", "\n", "structValue", ":=", "pointerValue", ".", "Elem", "(", ")", "\n", "structType", ":=", "structValue", ".", "Type", "(", ")", "\n\n", "for", "i", ":=", "0", ";", "i", "<", "structValue", ".", "NumField", "(", ")", ";", "i", "++", "{", "structField", ":=", "structType", ".", "Field", "(", "i", ")", "\n", "fieldValue", ":=", "structValue", ".", "Field", "(", "i", ")", "\n\n", "if", "fieldValue", ".", "CanSet", "(", ")", "{", "envKey", ":=", "strings", ".", "ToUpper", "(", "prefix", ")", "+", "gocase", ".", "ToUpperSnake", "(", "structField", ".", "Name", ")", "\n", "envVal", ":=", "os", ".", "Getenv", "(", "envKey", ")", "\n\n", "if", "envVal", "!=", "\"", "\"", "{", "// create a json blob with the env data", "jsonStr", ":=", "\"", "\"", "\n", "if", "fieldValue", ".", "Kind", "(", ")", "==", "reflect", ".", "String", "{", "jsonStr", "=", "fmt", ".", "Sprintf", "(", "`{\"%s\": \"%s\"}`", ",", "structField", ".", "<mask>", ",", "envVal", ")", "\n", "}", "else", "{", "jsonStr", "=", "fmt", ".", "Sprintf", "(", "`{\"%s\": %s}`", ",", "structField", ".", "Name", ",", "envVal", ")", "\n", "}", "\n\n", "err", ":=", "json", ".", "Unmarshal", "(", "[", "]", "byte", "(", "jsonStr", ")", ",", "v", ")", "\n", "result", "=", "append", "(", "result", ",", "MarshalledEnvironmentVar", "{", "envKey", ",", "envVal", ",", "structField", ".", "Name", ",", "err", "}", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "\n", "}" ]
2,095
all-2096
[ "SearchAnnotations", "returns", "annotations", "matching", "the", "specified", "search", "query", "and", "/", "or", "filter", ".", "If", "nil", "is", "passed", "for", "both", "parameters", "all", "annotations", "will", "be", "returned", "." ]
[ "func", "(", "a", "*", "API", ")", "SearchAnnotations", "(", "searchCriteria", "*", "SearchQueryType", ",", "filterCriteria", "*", "SearchFilterType", ")", "(", "*", "[", "]", "Annotation", ",", "error", ")", "{", "q", ":=", "url", ".", "Values", "{", "}", "\n\n", "if", "searchCriteria", "!=", "nil", "&&", "*", "searchCriteria", "!=", "\"", "\"", "{", "q", ".", "Set", "(", "\"", "\"", ",", "string", "(", "*", "searchCriteria", ")", ")", "\n", "}", "\n\n", "if", "filterCriteria", "!=", "nil", "&&", "len", "(", "*", "filterCriteria", ")", ">", "0", "{", "for", "filter", ",", "criteria", ":=", "range", "*", "filterCriteria", "{", "for", "_", ",", "val", ":=", "range", "criteria", "{", "q", ".", "Add", "(", "filter", ",", "val", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "q", ".", "Encode", "(", ")", "==", "\"", "\"", "{", "return", "a", ".", "FetchAnnotations", "(", ")", "\n", "}", "\n\n", "reqURL", ":=", "url", ".", "URL", "{", "<mask>", ":", "config", ".", "AnnotationPrefix", ",", "RawQuery", ":", "q", ".", "Encode", "(", ")", ",", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "Get", "(", "reqURL", ".", "String", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "var", "annotations", "[", "]", "Annotation", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "&", "annotations", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "annotations", ",", "nil", "\n", "}" ]
2,096
all-2097
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventInspectRequested", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime29", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
2,097
all-2098
[ "updateLastActivity", "marks", "when", "the", "last", "message", "was", "received", "/", "sent", "on", "the", "channel", ".", "This", "is", "used", "for", "monitoring", "idle", "connections", "and", "timing", "them", "out", "." ]
[ "func", "(", "c", "*", "Connection", ")", "updateLastActivity", "(", "frame", "*", "Frame", ")", "{", "// Pings are ignored for last activity.", "switch", "frame", ".", "<mask>", ".", "messageType", "{", "case", "messageTypeCallReq", ",", "messageTypeCallReqContinue", ",", "messageTypeCallRes", ",", "messageTypeCallResContinue", ",", "messageTypeError", ":", "c", ".", "lastActivity", ".", "Store", "(", "c", ".", "timeNow", "(", ")", ".", "UnixNano", "(", ")", ")", "\n", "}", "\n", "}" ]
2,098
all-2099
[ "Firehose", "streams", "all", "data", ".", "All", "clients", "with", "the", "same", "subscriptionId", "will", "receive", "a", "proportionate", "share", "of", "the", "message", "stream", ".", "Each", "pool", "of", "clients", "will", "receive", "the", "entire", "stream", ".", "Messages", "are", "presented", "in", "the", "order", "received", "from", "the", "loggregator", "server", ".", "Chronological", "or", "other", "ordering", "is", "not", "guaranteed", ".", "It", "is", "the", "responsibility", "of", "the", "consumer", "of", "these", "channels", "to", "provide", "any", "desired", "sorting", "mechanism", ".", "Whenever", "an", "error", "is", "encountered", "the", "error", "will", "be", "sent", "down", "the", "error", "channel", "and", "Firehose", "will", "attempt", "to", "reconnect", "indefinitely", "." ]
[ "func", "(", "c", "*", "Consumer", ")", "Firehose", "(", "subscriptionId", "string", ",", "authToken", "string", ",", ")", "(", "<-", "chan", "*", "<mask>", ".", "Envelope", ",", "<-", "chan", "error", ")", "{", "return", "c", ".", "firehose", "(", "newFirehose", "(", "subscriptionId", ",", "authToken", ",", ")", ")", "\n", "}" ]
2,099
all-2100
[ "ReadCString", "reads", "a", "null", "-", "terminated", "string", "starting", "at", "address", "a", "." ]
[ "func", "(", "p", "*", "Process", ")", "ReadCString", "(", "a", "Address", ")", "string", "{", "for", "n", ":=", "int64", "(", "0", ")", ";", ";", "n", "++", "{", "if", "p", ".", "ReadUint8", "(", "a", ".", "Add", "(", "n", ")", ")", "==", "0", "{", "b", ":=", "<mask>", "(", "[", "]", "byte", ",", "n", ")", "\n", "p", ".", "ReadAt", "(", "b", ",", "a", ")", "\n", "return", "string", "(", "b", ")", "\n", "}", "\n", "}", "\n", "}" ]