id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
7,300
all-7301
[ "RestoreSecretRequest", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "RestoreSecretRequest", "(", "arg0", "*", "secretsmanager", ".", "RestoreSecretInput", ")", "(", "*", "<mask>", ".", "Request", ",", "*", "secretsmanager", ".", "RestoreSecretOutput", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "*", "request", ".", "Request", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "*", "secretsmanager", ".", "RestoreSecretOutput", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
7,301
all-7302
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "ResolveBlobReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoIo", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
7,302
all-7303
[ "ConvertWidgetToBinWindowCoords", "is", "a", "wrapper", "around", "gtk_icon_view_convert_widget_to_bin_window_coords", "()", "." ]
[ "func", "(", "v", "*", "IconView", ")", "ConvertWidgetToBinWindowCoords", "(", "x", ",", "y", "int", ")", "(", "int", ",", "int", ")", "{", "<mask>", "bx", ",", "by", "C", ".", "gint", "\n\n", "C", ".", "gtk_icon_view_convert_widget_to_bin_window_coords", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "x", ")", ",", "C", ".", "gint", "(", "y", ")", ",", "&", "bx", ",", "&", "by", ")", "\n\n", "return", "int", "(", "bx", ")", ",", "int", "(", "by", ")", "\n", "}" ]
7,303
all-7304
[ "DeregisterInstance", "removes", "an", "instance", "from", "given", "service", "." ]
[ "func", "(", "p", "*", "AWSSDProvider", ")", "DeregisterInstance", "(", "service", "*", "sd", ".", "Service", ",", "ep", "*", "endpoint", ".", "Endpoint", ")", "error", "{", "for", "_", ",", "target", ":=", "<mask>", "ep", ".", "Targets", "{", "log", ".", "Infof", "(", "\"", "\\\"", "\\\"", "\\\"", "\\\"", "\"", ",", "target", ",", "*", "service", ".", "Name", ",", "*", "service", ".", "Id", ")", "\n\n", "if", "!", "p", ".", "dryRun", "{", "_", ",", "err", ":=", "p", ".", "client", ".", "DeregisterInstance", "(", "&", "sd", ".", "DeregisterInstanceInput", "{", "InstanceId", ":", "aws", ".", "String", "(", "p", ".", "targetToInstanceID", "(", "target", ")", ")", ",", "ServiceId", ":", "service", ".", "Id", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
7,304
all-7305
[ "Add", "adds", "a", "point", "to", "the", "index", ".", "If", "a", "point", "with", "the", "same", "Id", "already", "exists", "it", "gets", "replaced", "." ]
[ "func", "(", "<mask>", "*", "PointsIndex", ")", "Add", "(", "point", "Point", ")", "{", "points", ".", "Remove", "(", "point", ".", "Id", "(", ")", ")", "\n", "newSet", ":=", "points", ".", "index", ".", "AddEntryAt", "(", "point", ")", ".", "(", "set", ")", "\n", "newSet", ".", "Add", "(", "point", ".", "Id", "(", ")", ",", "point", ")", "\n", "points", ".", "currentPosition", "[", "point", ".", "Id", "(", ")", "]", "=", "point", "\n", "}" ]
7,305
all-7306
[ "ID", "gets", "information", "about", "a", "given", "peer", ".", "Arguments", ":", "peer", ":", "peer", ".", "ID", "of", "the", "node", "to", "look", "up", ".", "If", "no", "peer", "is", "specified", "return", "information", "about", "the", "local", "peer", "." ]
[ "func", "(", "s", "*", "Shell", ")", "ID", "(", "peer", "...", "string", ")", "(", "*", "IdOutput", ",", "error", ")", "{", "if", "len", "(", "peer", ")", ">", "1", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "var", "out", "IdOutput", "\n", "if", "err", ":=", "s", ".", "Request", "(", "\"", "\"", ",", "peer", "...", ")", ".", "Exec", "(", "context", ".", "Background", "(", ")", ",", "&", "<mask>", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "out", ",", "nil", "\n", "}" ]
7,306
all-7307
[ "ProfileConfigRef", "returns", "entities", "used", "by", "profiles", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "ProfileConfigRef", "(", "filter", "ProfileFilter", ")", "(", "map", "[", "string", "]", "map", "[", "string", "]", "map", "[", "string", "]", "string", ",", "error", ")", "{", "// Result slice.", "objects", ":=", "make", "(", "[", "]", "struct", "{", "Project", "string", "\n", "Name", "string", "\n", "Key", "string", "\n", "Value", "string", "\n", "}", ",", "0", ")", "\n\n", "// Check which filter criteria are active.", "criteria", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "}", "\n", "if", "filter", ".", "Project", "!=", "\"", "\"", "{", "criteria", "[", "\"", "\"", "]", "=", "filter", ".", "Project", "\n", "}", "\n", "if", "filter", ".", "Name", "!=", "\"", "\"", "{", "criteria", "[", "\"", "\"", "]", "=", "filter", ".", "Name", "\n", "}", "\n\n", "// Pick the prepared statement and arguments to use based on active criteria.", "var", "stmt", "*", "sql", ".", "Stmt", "\n", "var", "args", "[", "]", "interface", "{", "}", "\n\n", "if", "criteria", "[", "\"", "\"", "]", "!=", "nil", "&&", "criteria", "[", "\"", "\"", "]", "!=", "nil", "{", "stmt", "=", "c", ".", "stmt", "(", "profileConfigRefByProjectAndName", ")", "\n", "args", "=", "[", "]", "interface", "{", "}", "{", "filter", ".", "Project", ",", "filter", ".", "Name", ",", "}", "\n", "}", "else", "if", "criteria", "[", "\"", "\"", "]", "!=", "nil", "{", "stmt", "=", "c", ".", "stmt", "(", "profileConfigRefByProject", ")", "\n", "args", "=", "[", "]", "interface", "{", "}", "{", "filter", ".", "<mask>", ",", "}", "\n", "}", "else", "{", "stmt", "=", "c", ".", "stmt", "(", "profileConfigRef", ")", "\n", "args", "=", "[", "]", "interface", "{", "}", "{", "}", "\n", "}", "\n\n", "// Dest function for scanning a row.", "dest", ":=", "func", "(", "i", "int", ")", "[", "]", "interface", "{", "}", "{", "objects", "=", "append", "(", "objects", ",", "struct", "{", "Project", "string", "\n", "Name", "string", "\n", "Key", "string", "\n", "Value", "string", "\n", "}", "{", "}", ")", "\n", "return", "[", "]", "interface", "{", "}", "{", "&", "objects", "[", "i", "]", ".", "Project", ",", "&", "objects", "[", "i", "]", ".", "Name", ",", "&", "objects", "[", "i", "]", ".", "Key", ",", "&", "objects", "[", "i", "]", ".", "Value", ",", "}", "\n", "}", "\n\n", "// Select.", "err", ":=", "query", ".", "SelectObjects", "(", "stmt", ",", "dest", ",", "args", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// Build index by primary name.", "index", ":=", "map", "[", "string", "]", "map", "[", "string", "]", "map", "[", "string", "]", "string", "{", "}", "\n\n", "for", "_", ",", "object", ":=", "range", "objects", "{", "_", ",", "ok", ":=", "index", "[", "object", ".", "Project", "]", "\n", "if", "!", "ok", "{", "subIndex", ":=", "map", "[", "string", "]", "map", "[", "string", "]", "string", "{", "}", "\n", "index", "[", "object", ".", "Project", "]", "=", "subIndex", "\n", "}", "\n\n", "item", ",", "ok", ":=", "index", "[", "object", ".", "Project", "]", "[", "object", ".", "Name", "]", "\n", "if", "!", "ok", "{", "item", "=", "map", "[", "string", "]", "string", "{", "}", "\n", "}", "\n\n", "index", "[", "object", ".", "Project", "]", "[", "object", ".", "Name", "]", "=", "item", "\n", "item", "[", "object", ".", "Key", "]", "=", "object", ".", "Value", "\n", "}", "\n\n", "return", "index", ",", "nil", "\n", "}" ]
7,307
all-7308
[ "Returns", "whether", "or", "not", "the", "image", "is", "fully", "opaque", "." ]
[ "func", "opaque", "(", "m", "image", ".", "<mask>", ")", "bool", "{", "if", "o", ",", "ok", ":=", "m", ".", "(", "opaquer", ")", ";", "ok", "{", "return", "o", ".", "Opaque", "(", ")", "\n", "}", "\n", "b", ":=", "m", ".", "Bounds", "(", ")", "\n", "for", "y", ":=", "b", ".", "Min", ".", "Y", ";", "y", "<", "b", ".", "Max", ".", "Y", ";", "y", "++", "{", "for", "x", ":=", "b", ".", "Min", ".", "X", ";", "x", "<", "b", ".", "Max", ".", "X", ";", "x", "++", "{", "_", ",", "_", ",", "_", ",", "a", ":=", "m", ".", "At", "(", "x", ",", "y", ")", ".", "RGBA", "(", ")", "\n", "if", "a", "!=", "0xffff", "{", "return", "false", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "true", "\n", "}" ]
7,308
all-7309
[ "Do", "executes", "Memory", ".", "getDOMCounters", "against", "the", "provided", "context", ".", "returns", ":", "documents", "nodes", "jsEventListeners" ]
[ "func", "(", "p", "*", "GetDOMCountersParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "documents", "int64", ",", "nodes", "int64", ",", "jsEventListeners", "int64", ",", "err", "error", ")", "{", "// execute", "var", "res", "GetDOMCountersReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetDOMCounters", ",", "nil", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "0", ",", "0", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "Documents", ",", "res", ".", "Nodes", ",", "res", ".", "JsEventListeners", ",", "nil", "\n", "}" ]
7,309
all-7310
[ "/", "*", "Errorm", "uses", "msg", "as", "a", "format", "string", "with", "subsequent", "parameters", "as", "values", "and", "logs", "the", "resulting", "message", "to", "all", "added", "loggers", "at", "LogLevel", ".", "LevelError", ".", "It", "will", "also", "merge", "all", "attributes", "passed", "in", "m", "with", "any", "attributes", "added", "to", "Base", "and", "include", "them", "with", "the", "message", "if", "the", "Logger", "supports", "it", "." ]
[ "func", "(", "b", "*", "Base", ")", "Errorm", "(", "m", "*", "Attrs", ",", "msg", "string", ",", "a", "...", "<mask>", "{", "}", ")", "error", "{", "return", "b", ".", "Log", "(", "LevelError", ",", "m", ",", "msg", ",", "a", "...", ")", "\n", "}" ]
7,310
all-7311
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "PushNodeByPathToFrontendReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom25", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
7,311
all-7312
[ "MoveIntoResourcePool", "moves", "a", "virtual", "machine", "resource", "pool", "or", "vApp", "into", "the", "specified", "ResourcePool", "." ]
[ "func", "MoveIntoResourcePool", "(", "p", "*", "object", ".", "ResourcePool", ",", "c", "types", ".", "ManagedObjectReference", ")", "error", "{", "req", ":=", "types", ".", "MoveIntoResourcePool", "{", "This", ":", "p", ".", "Reference", "(", ")", ",", "List", ":", "[", "]", "types", ".", "ManagedObjectReference", "{", "c", "}", ",", "}", "\n", "ctx", ",", "cancel", ":=", "<mask>", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "provider", ".", "DefaultAPITimeout", ")", "\n", "defer", "cancel", "(", ")", "\n", "_", ",", "err", ":=", "methods", ".", "MoveIntoResourcePool", "(", "ctx", ",", "p", ".", "Client", "(", ")", ",", "&", "req", ")", "\n", "return", "err", "\n", "}" ]
7,312
all-7313
[ "SetASMDockerAuthConfig", "add", "the", "docker", "auth", "config", "data", "to", "the", "RegistryAuthentication", "struct", "held", "by", "the", "container", "this", "is", "then", "passed", "down", "to", "the", "docker", "client", "to", "pull", "the", "image" ]
[ "func", "(", "c", "*", "Container", ")", "SetASMDockerAuthConfig", "(", "dac", "<mask>", ".", "AuthConfig", ")", "{", "c", ".", "RegistryAuthentication", ".", "ASMAuthData", ".", "SetDockerAuthConfig", "(", "dac", ")", "\n", "}" ]
7,313
all-7314
[ "GetManageStatusTitleSize", "returns", "the", "ManageStatusTitleSize", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "w", "*", "Widget", ")", "GetManageStatusTitleSize", "(", ")", "<mask>", "{", "if", "w", "==", "nil", "||", "w", ".", "ManageStatusTitleSize", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "w", ".", "ManageStatusTitleSize", "\n", "}" ]
7,314
all-7315
[ "Forward", "to", "the", "local", "events", "dispatcher", "an", "event", "received", "from", "another", "node", "." ]
[ "func", "eventForward", "(", "id", "int64", ",", "<mask>", "api", ".", "Event", ")", "{", "if", "event", ".", "Type", "==", "\"", "\"", "{", "// Parse the message", "logEntry", ":=", "api", ".", "EventLogging", "{", "}", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "event", ".", "Metadata", ",", "&", "logEntry", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "if", "!", "debug", "&&", "logEntry", ".", "Level", "==", "\"", "\"", "{", "return", "\n", "}", "\n\n", "if", "!", "debug", "&&", "!", "verbose", "&&", "logEntry", ".", "Level", "==", "\"", "\"", "{", "return", "\n", "}", "\n", "}", "\n\n", "err", ":=", "eventBroadcast", "(", "\"", "\"", ",", "event", ",", "true", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Warnf", "(", "\"", "\"", ",", "id", ",", "err", ")", "\n", "}", "\n", "}" ]
7,315
all-7316
[ "Seek", "moves", "iterator", "to", "a", "provided", "item" ]
[ "func", "(", "it", "*", "Iterator", ")", "Seek", "(", "itm", "unsafe", ".", "Pointer", ")", "bool", "{", "<mask>", ".", "valid", "=", "true", "\n", "found", ":=", "it", ".", "s", ".", "findPath", "(", "itm", ",", "it", ".", "cmp", ",", "it", ".", "buf", ",", "&", "it", ".", "s", ".", "Stats", ")", "!=", "nil", "\n", "it", ".", "prev", "=", "it", ".", "buf", ".", "preds", "[", "0", "]", "\n", "it", ".", "curr", "=", "it", ".", "buf", ".", "succs", "[", "0", "]", "\n", "return", "found", "\n", "}" ]
7,316
all-7317
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "StopObservingParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
7,317
all-7318
[ "ImageAliasesGet", "returns", "the", "names", "of", "the", "aliases", "of", "all", "images", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ImageAliasesGet", "(", "<mask>", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "err", ":=", "c", ".", "Transaction", "(", "func", "(", "tx", "*", "ClusterTx", ")", "error", "{", "enabled", ",", "err", ":=", "tx", ".", "ProjectHasImages", "(", "project", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "!", "enabled", "{", "project", "=", "\"", "\"", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "q", ":=", "`\nSELECT images_aliases.name\n FROM images_aliases\n JOIN projects ON projects.id=images_aliases.project_id\n WHERE projects.name=?\n`", "\n", "var", "name", "string", "\n", "inargs", ":=", "[", "]", "interface", "{", "}", "{", "project", "}", "\n", "outfmt", ":=", "[", "]", "interface", "{", "}", "{", "name", "}", "\n", "results", ",", "err", ":=", "queryScan", "(", "c", ".", "db", ",", "q", ",", "inargs", ",", "outfmt", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "names", ":=", "[", "]", "string", "{", "}", "\n", "for", "_", ",", "res", ":=", "range", "results", "{", "names", "=", "append", "(", "names", ",", "res", "[", "0", "]", ".", "(", "string", ")", ")", "\n", "}", "\n", "return", "names", ",", "nil", "\n", "}" ]
7,318
all-7319
[ "SetAccelPath", "is", "a", "wrapper", "around", "gtk_menu_item_set_accel_path", "()", "." ]
[ "func", "(", "v", "*", "MenuItem", ")", "SetAccelPath", "(", "path", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "path", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n\n", "C", ".", "gtk_menu_item_set_accel_path", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}" ]
7,319
all-7320
[ "SetString", "records", "IP", "v4", "host", "address", "of", "the", "peer", "as", "a", ".", "-", "separated", "tuple", "to", "the", "span", ".", "E", ".", "g", ".", "127", ".", "0", ".", "0", ".", "1" ]
[ "func", "(", "tag", "ipv4Tag", ")", "SetString", "(", "span", "opentracing", ".", "Span", ",", "value", "string", ")", "{", "span", ".", "SetTag", "(", "string", "(", "tag", ")", ",", "<mask>", ")", "\n", "}" ]
7,320
all-7321
[ "Shutdown", "calls", "all", "registered", "shutdown", "funcs", "." ]
[ "func", "(", "s", "*", "Sentinel", ")", "Shutdown", "(", ")", "error", "{", "<mask>", "firstErr", "error", "\n", "for", "i", ",", "f", ":=", "range", "s", ".", "shutdownFuncs", "{", "ctxt", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "s", ".", "shutdownDuration", ")", "\n", "defer", "cancel", "(", ")", "\n", "if", "err", ":=", "f", "(", "ctxt", ")", ";", "err", "!=", "nil", "{", "s", ".", "errf", "(", "\"", "\"", ",", "i", ",", "err", ")", "\n", "if", "firstErr", "==", "nil", "{", "firstErr", "=", "err", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "firstErr", "\n", "}" ]
7,321
all-7322
[ "/", "*", "DeleteAppsAppRoutesRoute", "deletes", "the", "route" ]
[ "func", "(", "a", "*", "Client", ")", "DeleteAppsAppRoutesRoute", "(", "params", "*", "DeleteAppsAppRoutesRouteParams", ")", "(", "*", "DeleteAppsAppRoutesRouteOK", ",", "error", ")", "{", "// TODO: Validate the params before sending", "if", "params", "==", "nil", "{", "params", "=", "NewDeleteAppsAppRoutesRouteParams", "(", ")", "\n", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "transport", ".", "Submit", "(", "&", "runtime", ".", "ClientOperation", "{", "<mask>", ":", "\"", "\"", ",", "Method", ":", "\"", "\"", ",", "PathPattern", ":", "\"", "\"", ",", "ProducesMediaTypes", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "ConsumesMediaTypes", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "Schemes", ":", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", ",", "Params", ":", "params", ",", "Reader", ":", "&", "DeleteAppsAppRoutesRouteReader", "{", "formats", ":", "a", ".", "formats", "}", ",", "Context", ":", "params", ".", "Context", ",", "Client", ":", "params", ".", "HTTPClient", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "result", ".", "(", "*", "DeleteAppsAppRoutesRouteOK", ")", ",", "nil", "\n\n", "}" ]
7,322
all-7323
[ "New", "generator", "for", "creating", "webpack", "asset", "files" ]
[ "func", "New", "(", "opts", "*", "Options", ")", "(", "*", "genny", ".", "Generator", ",", "error", ")", "{", "g", ":=", "genny", ".", "New", "(", ")", "\n\n", "if", "err", ":=", "opts", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "g", ",", "err", "\n", "}", "\n\n", "g", ".", "RunFn", "(", "func", "(", "r", "*", "genny", ".", "Runner", ")", "error", "{", "if", "_", ",", "err", ":=", "r", ".", "LookPath", "(", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n\n", "g", ".", "Box", "(", "Templates", ")", "\n\n", "data", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "opts", ",", "}", "\n", "t", ":=", "gogen", ".", "TemplateTransformer", "(", "data", ",", "gogen", ".", "TemplateHelpers", ")", "\n", "g", ".", "Transformer", "(", "t", ")", "\n", "g", ".", "Transformer", "(", "genny", ".", "Dot", "(", ")", ")", "\n\n", "g", ".", "RunFn", "(", "func", "(", "r", "*", "genny", ".", "Runner", ")", "error", "{", "return", "installPkgs", "(", "r", ",", "opts", ")", "\n", "}", ")", "\n\n", "return", "g", ",", "nil", "\n", "}" ]
7,323
all-7324
[ "StoragePoolVolumeGetTypeID", "returns", "the", "ID", "of", "a", "storage", "volume", "on", "a", "given", "storage", "pool", "of", "a", "given", "storage", "volume", "type", "on", "the", "given", "node", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "StoragePoolVolumeGetTypeID", "(", "project", "string", ",", "volumeName", "string", ",", "volumeType", "int", ",", "poolID", ",", "nodeID", "int64", ")", "(", "int64", ",", "error", ")", "{", "volumeID", ":=", "int64", "(", "-", "1", ")", "\n", "<mask>", ":=", "`SELECT storage_volumes.id\nFROM storage_volumes\nJOIN storage_pools ON storage_volumes.storage_pool_id = storage_pools.id\nJOIN projects ON storage_volumes.project_id = projects.id\nWHERE projects.name=? AND storage_volumes.storage_pool_id=? AND storage_volumes.node_id=?\nAND storage_volumes.name=? AND storage_volumes.type=?`", "\n", "inargs", ":=", "[", "]", "interface", "{", "}", "{", "project", ",", "poolID", ",", "nodeID", ",", "volumeName", ",", "volumeType", "}", "\n", "outargs", ":=", "[", "]", "interface", "{", "}", "{", "&", "volumeID", "}", "\n\n", "err", ":=", "dbQueryRowScan", "(", "c", ".", "db", ",", "query", ",", "inargs", ",", "outargs", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "sql", ".", "ErrNoRows", "{", "return", "-", "1", ",", "ErrNoSuchObject", "\n", "}", "\n", "return", "-", "1", ",", "err", "\n", "}", "\n\n", "return", "volumeID", ",", "nil", "\n", "}" ]
7,324
all-7325
[ "Signatures", "is", "like", "ImageSource", ".", "GetSignatures", "but", "the", "result", "is", "cached", ";", "it", "is", "OK", "to", "call", "this", "however", "often", "you", "need", "." ]
[ "func", "(", "i", "*", "UnparsedImage", ")", "Signatures", "(", "ctx", "context", ".", "<mask>", ")", "(", "[", "]", "[", "]", "byte", ",", "error", ")", "{", "if", "i", ".", "cachedSignatures", "==", "nil", "{", "sigs", ",", "err", ":=", "i", ".", "src", ".", "GetSignatures", "(", "ctx", ",", "i", ".", "instanceDigest", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "i", ".", "cachedSignatures", "=", "sigs", "\n", "}", "\n", "return", "i", ".", "cachedSignatures", ",", "nil", "\n", "}" ]
7,325
all-7326
[ "saveDB", "copies", "the", "database", "snapshot", "to", "the", "snapshot", "directory" ]
[ "func", "(", "s", "*", "v3Manager", ")", "saveDB", "(", ")", "error", "{", "f", ",", "ferr", ":=", "os", ".", "OpenFile", "(", "s", ".", "dbPath", ",", "os", ".", "O_RDONLY", ",", "0600", ")", "\n", "if", "ferr", "!=", "nil", "{", "return", "ferr", "\n", "}", "\n", "defer", "f", ".", "Close", "(", ")", "\n\n", "// get snapshot integrity hash", "if", "_", ",", "err", ":=", "f", ".", "Seek", "(", "-", "sha256", ".", "Size", ",", "io", ".", "SeekEnd", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "sha", ":=", "<mask>", "(", "[", "]", "byte", ",", "sha256", ".", "Size", ")", "\n", "if", "_", ",", "err", ":=", "f", ".", "Read", "(", "sha", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "_", ",", "err", ":=", "f", ".", "Seek", "(", "0", ",", "io", ".", "SeekStart", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "err", ":=", "fileutil", ".", "CreateDirAll", "(", "s", ".", "snapDir", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "dbpath", ":=", "filepath", ".", "Join", "(", "s", ".", "snapDir", ",", "\"", "\"", ")", "\n", "db", ",", "dberr", ":=", "os", ".", "OpenFile", "(", "dbpath", ",", "os", ".", "O_RDWR", "|", "os", ".", "O_CREATE", ",", "0600", ")", "\n", "if", "dberr", "!=", "nil", "{", "return", "dberr", "\n", "}", "\n", "if", "_", ",", "err", ":=", "io", ".", "Copy", "(", "db", ",", "f", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// truncate away integrity hash, if any.", "off", ",", "serr", ":=", "db", ".", "Seek", "(", "0", ",", "io", ".", "SeekEnd", ")", "\n", "if", "serr", "!=", "nil", "{", "return", "serr", "\n", "}", "\n", "hasHash", ":=", "(", "off", "%", "512", ")", "==", "sha256", ".", "Size", "\n", "if", "hasHash", "{", "if", "err", ":=", "db", ".", "Truncate", "(", "off", "-", "sha256", ".", "Size", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "if", "!", "hasHash", "&&", "!", "s", ".", "skipHashCheck", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "hasHash", "&&", "!", "s", ".", "skipHashCheck", "{", "// check for match", "if", "_", ",", "err", ":=", "db", ".", "Seek", "(", "0", ",", "io", ".", "SeekStart", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "h", ":=", "sha256", ".", "New", "(", ")", "\n", "if", "_", ",", "err", ":=", "io", ".", "Copy", "(", "h", ",", "db", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "dbsha", ":=", "h", ".", "Sum", "(", "nil", ")", "\n", "if", "!", "reflect", ".", "DeepEqual", "(", "sha", ",", "dbsha", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "sha", ",", "dbsha", ")", "\n", "}", "\n", "}", "\n\n", "// db hash is OK, can now modify DB so it can be part of a new cluster", "db", ".", "Close", "(", ")", "\n\n", "commit", ":=", "len", "(", "s", ".", "cl", ".", "Members", "(", ")", ")", "\n\n", "// update consistentIndex so applies go through on etcdserver despite", "// having a new raft instance", "be", ":=", "backend", ".", "NewDefaultBackend", "(", "dbpath", ")", "\n\n", "// a lessor never timeouts leases", "lessor", ":=", "lease", ".", "NewLessor", "(", "s", ".", "lg", ",", "be", ",", "lease", ".", "LessorConfig", "{", "MinLeaseTTL", ":", "math", ".", "MaxInt64", "}", ")", "\n\n", "mvs", ":=", "mvcc", ".", "NewStore", "(", "s", ".", "lg", ",", "be", ",", "lessor", ",", "(", "*", "initIndex", ")", "(", "&", "commit", ")", ")", "\n", "txn", ":=", "mvs", ".", "Write", "(", ")", "\n", "btx", ":=", "be", ".", "BatchTx", "(", ")", "\n", "del", ":=", "func", "(", "k", ",", "v", "[", "]", "byte", ")", "error", "{", "txn", ".", "DeleteRange", "(", "k", ",", "nil", ")", "\n", "return", "nil", "\n", "}", "\n\n", "// delete stored members from old cluster since using new members", "btx", ".", "UnsafeForEach", "(", "[", "]", "byte", "(", "\"", "\"", ")", ",", "del", ")", "\n\n", "// todo: add back new members when we start to deprecate old snap file.", "btx", ".", "UnsafeForEach", "(", "[", "]", "byte", "(", "\"", "\"", ")", ",", "del", ")", "\n\n", "// trigger write-out of new consistent index", "txn", ".", "End", "(", ")", "\n\n", "mvs", ".", "Commit", "(", ")", "\n", "mvs", ".", "Close", "(", ")", "\n", "be", ".", "Close", "(", ")", "\n\n", "return", "nil", "\n", "}" ]
7,326
all-7327
[ "bytes", "encodes", "PeerName", "as", "a", "byte", "slice", "." ]
[ "func", "(", "name", "PeerName", ")", "bytes", "(", ")", "[", "]", "byte", "{", "res", ",", "err", ":=", "hex", ".", "DecodeString", "(", "string", "(", "<mask>", ")", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "\"", "\"", "+", "name", ")", "\n", "}", "\n", "return", "res", "\n", "}" ]
7,327
all-7328
[ "ComputeBTCAddressForPrivKey", "returns", "the", "Bitcoin", "address", "for", "the", "given", "privKey", "." ]
[ "func", "ComputeBTCAddressForPrivKey", "(", "privKey", "string", ")", "string", "{", "pubKeyBytes", ":=", "PubKeyBytesFromPrivKeyBytes", "(", "HexDecode", "(", "privKey", ")", ",", "<mask>", ")", "\n", "return", "BTCAddrFromPubKeyBytes", "(", "pubKeyBytes", ")", "\n", "}" ]
7,328
all-7329
[ "DecodeTime", "decodes", "seconds", "(", "int64", ")", "and", "nanoseconds", "(", "int32", ")", "since", "January", "1", "1970", "UTC", "and", "returns", "the", "corresponding", "time", ".", "If", "nanoseconds", "is", "not", "in", "the", "range", "[", "0", "999999999", "]", "or", "if", "seconds", "is", "too", "large", "the", "behavior", "is", "undefined", ".", "TODO", "return", "error", "if", "behavior", "is", "undefined", "." ]
[ "func", "DecodeTime", "(", "bz", "[", "]", "byte", ")", "(", "t", "<mask>", ".", "Time", ",", "n", "int", ",", "err", "error", ")", "{", "// Defensively set default to to zeroTime (1970, not 0001)", "t", "=", "zeroTime", "\n\n", "// Read sec and nanosec.", "var", "sec", "int64", "\n", "var", "nsec", "int32", "\n", "if", "len", "(", "bz", ")", ">", "0", "{", "sec", ",", "n", ",", "err", "=", "decodeSeconds", "(", "&", "bz", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "}", "\n", "if", "len", "(", "bz", ")", ">", "0", "{", "nsec", ",", "err", "=", "decodeNanos", "(", "&", "bz", ",", "&", "n", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "}", "\n\n", "// Construct time.", "t", "=", "time", ".", "Unix", "(", "sec", ",", "int64", "(", "nsec", ")", ")", "\n", "// Strip timezone and monotonic for deep equality.", "t", "=", "t", ".", "UTC", "(", ")", ".", "Truncate", "(", "0", ")", "\n", "return", "\n", "}" ]
7,329
all-7330
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "a", "specified", "program", "object" ]
[ "func", "ProgramUniform1iv", "(", "program", "uint32", ",", "location", "int32", ",", "count", "int32", ",", "<mask>", "*", "int32", ")", "{", "syscall", ".", "Syscall6", "(", "gpProgramUniform1iv", ",", "4", ",", "uintptr", "(", "program", ")", ",", "uintptr", "(", "location", ")", ",", "uintptr", "(", "count", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "value", ")", ")", ",", "0", ",", "0", ")", "\n", "}" ]
7,330
all-7331
[ "buildInfoHandler", "-", "This", "is", "a", "stop", "gap", "and", "will", "be", "added", "to", "when", "we", "can", "define", "what", "we", "should", "display", "here" ]
[ "func", "buildInfoHandler", "(", "w", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "<mask>", ")", "{", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\"", ")", "\n", "}" ]
7,331
all-7332
[ "SetBoolPolicy", "sets", "a", "ResourceData", "field", "depending", "on", "if", "a", "BoolPolicy", "exists", "or", "not", ".", "The", "field", "is", "not", "set", "if", "it", "s", "nil", "." ]
[ "func", "SetBoolPolicy", "(", "d", "*", "schema", ".", "ResourceData", ",", "key", "string", ",", "val", "*", "types", ".", "BoolPolicy", ")", "error", "{", "if", "val", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "err", ":=", "d", ".", "Set", "(", "key", ",", "val", ".", "<mask>", ")", "\n", "return", "err", "\n", "}" ]
7,332
all-7333
[ "ArmForSwitch", "returns", "which", "field", "name", "should", "be", "used", "for", "storing", "the", "value", "for", "an", "instance", "of", "PublicKey" ]
[ "func", "(", "u", "PublicKey", ")", "ArmForSwitch", "(", "sw", "int32", ")", "(", "string", ",", "bool", ")", "{", "switch", "CryptoKeyType", "(", "sw", ")", "{", "case", "CryptoKeyTypeKeyTypeEd25519", ":", "return", "\"", "\"", ",", "<mask>", "\n", "}", "\n", "return", "\"", "\"", ",", "false", "\n", "}" ]
7,333
all-7334
[ "Returns", "false", "if", "file", "does", "not", "exist", ".", "Panics", "if", "file", "is", "corrupt", "." ]
[ "func", "(", "a", "*", "AddrBook", ")", "loadFromFile", "(", "filePath", "string", ")", "bool", "{", "// If doesn't exist, do nothing.", "_", ",", "err", ":=", "os", ".", "Stat", "(", "filePath", ")", "\n", "if", "os", ".", "IsNotExist", "(", "err", ")", "{", "return", "false", "\n", "}", "\n\n", "// Load addrBookJSON{}", "r", ",", "err", ":=", "os", ".", "Open", "(", "filePath", ")", "\n", "if", "err", "!=", "nil", "{", "PanicCrisis", "(", "Fmt", "(", "\"", "\"", ",", "filePath", ",", "err", ")", ")", "\n", "}", "\n", "defer", "r", ".", "Close", "(", ")", "\n", "aJSON", ":=", "&", "addrBookJSON", "{", "}", "\n", "dec", ":=", "json", ".", "NewDecoder", "(", "r", ")", "\n", "err", "=", "dec", ".", "Decode", "(", "aJSON", ")", "\n", "if", "err", "!=", "nil", "{", "PanicCrisis", "(", "Fmt", "(", "\"", "\"", ",", "filePath", ",", "err", ")", ")", "\n", "}", "\n\n", "// Restore all the fields...", "// Restore the key", "a", ".", "key", "=", "aJSON", ".", "Key", "\n", "// Restore .addrNew & .addrOld", "for", "_", ",", "ka", ":=", "range", "aJSON", ".", "Addrs", "{", "for", "_", ",", "bucketIndex", ":=", "range", "ka", ".", "Buckets", "{", "bucket", ":=", "a", ".", "getBucket", "(", "ka", ".", "BucketType", ",", "bucketIndex", ")", "\n", "bucket", "[", "ka", ".", "Addr", ".", "String", "(", ")", "]", "=", "ka", "\n", "}", "\n", "a", ".", "addrLookup", "[", "ka", ".", "Addr", ".", "String", "(", ")", "]", "=", "ka", "\n", "if", "ka", ".", "BucketType", "==", "bucketTypeNew", "{", "a", ".", "nNew", "++", "\n", "}", "else", "{", "a", ".", "nOld", "++", "\n", "}", "\n", "}", "\n", "return", "<mask>", "\n", "}" ]
7,334
all-7335
[ "GetStatus", "computes", "and", "returns", "a", "Status", "object", "based", "on", "the", "request", "informations", "accumulated", "since", "the", "start", "of", "the", "process", "." ]
[ "func", "(", "mw", "*", "StatusMiddleware", ")", "GetStatus", "(", ")", "*", "Status", "{", "mw", ".", "lock", ".", "RLock", "(", ")", "\n\n", "now", ":=", "time", ".", "Now", "(", ")", "\n\n", "uptime", ":=", "now", ".", "Sub", "(", "mw", ".", "start", ")", "\n\n", "totalCount", ":=", "0", "\n", "for", "_", ",", "count", ":=", "range", "mw", ".", "responseCounts", "{", "totalCount", "+=", "count", "\n", "}", "\n\n", "totalResponseTime", ":=", "mw", ".", "totalResponseTime", ".", "Sub", "(", "time", ".", "Time", "{", "}", ")", "\n\n", "averageResponseTime", ":=", "time", ".", "Duration", "(", "0", ")", "\n", "if", "totalCount", ">", "0", "{", "avgNs", ":=", "int64", "(", "totalResponseTime", ")", "/", "int64", "(", "totalCount", ")", "\n", "averageResponseTime", "=", "time", ".", "Duration", "(", "avgNs", ")", "\n", "}", "\n\n", "status", ":=", "&", "Status", "{", "Pid", ":", "mw", ".", "<mask>", ",", "UpTime", ":", "uptime", ".", "String", "(", ")", ",", "UpTimeSec", ":", "uptime", ".", "Seconds", "(", ")", ",", "Time", ":", "now", ".", "String", "(", ")", ",", "TimeUnix", ":", "now", ".", "Unix", "(", ")", ",", "StatusCodeCount", ":", "mw", ".", "responseCounts", ",", "TotalCount", ":", "totalCount", ",", "TotalResponseTime", ":", "totalResponseTime", ".", "String", "(", ")", ",", "TotalResponseTimeSec", ":", "totalResponseTime", ".", "Seconds", "(", ")", ",", "AverageResponseTime", ":", "averageResponseTime", ".", "String", "(", ")", ",", "AverageResponseTimeSec", ":", "averageResponseTime", ".", "Seconds", "(", ")", ",", "}", "\n\n", "mw", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "return", "status", "\n", "}" ]
7,335
all-7336
[ "WriteTo", "sends", "the", "binary", "representation", "of", "the", "Tuple", "to", "the", "given", "io", ".", "Writer", "." ]
[ "func", "(", "t", "Tuple", ")", "WriteTo", "(", "w", "io", ".", "<mask>", ")", "(", "n", "int", ",", "err", "error", ")", "{", "// write header", "wrote", ",", "err", ":=", "t", ".", "Header", ".", "WriteTo", "(", "w", ")", "\n", "if", "err", "!=", "nil", "{", "return", "int", "(", "wrote", ")", ",", "nil", "\n", "}", "\n\n", "n", ",", "err", "=", "w", ".", "Write", "(", "t", ".", "data", ")", "\n", "if", "err", "!=", "nil", "{", "return", "int", "(", "n", ")", ",", "err", "\n", "}", "\n", "return", "int", "(", "wrote", ")", "+", "n", ",", "nil", "\n", "}" ]
7,336
all-7337
[ "Text", "implements", "the", "driver", ".", "Error", "interface", "." ]
[ "func", "(", "e", "*", "hdbErrors", ")", "Text", "(", ")", "string", "{", "return", "string", "(", "e", ".", "<mask>", "[", "e", ".", "idx", "]", ".", "errorText", ")", "\n", "}" ]
7,337
all-7338
[ "GetExtraCol", "returns", "the", "ExtraCol", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "g", "*", "GraphDefinitionRequest", ")", "GetExtraCol", "(", ")", "string", "{", "if", "g", "==", "nil", "||", "g", ".", "ExtraCol", "==", "nil", "{", "<mask>", "\"", "\"", "\n", "}", "\n", "return", "*", "g", ".", "ExtraCol", "\n", "}" ]
7,338
all-7339
[ "Read", "is", "implementation", "of", "io", ".", "Reader", "s", "Read", "." ]
[ "func", "(", "s", "*", "Stream", ")", "Read", "(", "buf", "[", "]", "<mask>", ")", "(", "int", ",", "error", ")", "{", "if", "s", ".", "resampling", "!=", "nil", "{", "return", "s", ".", "resampling", ".", "Read", "(", "buf", ")", "\n", "}", "\n", "return", "s", ".", "orig", ".", "Read", "(", "buf", ")", "\n", "}" ]
7,339
all-7340
[ "Status", "returns", "the", "snapshot", "file", "information", "." ]
[ "func", "(", "s", "*", "v3Manager", ")", "Status", "(", "dbPath", "string", ")", "(", "ds", "Status", ",", "err", "error", ")", "{", "if", "_", ",", "err", "=", "os", ".", "Stat", "(", "dbPath", ")", ";", "err", "!=", "nil", "{", "return", "ds", ",", "err", "\n", "}", "\n\n", "db", ",", "err", ":=", "bolt", ".", "Open", "(", "dbPath", ",", "0400", ",", "&", "bolt", ".", "Options", "{", "ReadOnly", ":", "true", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "ds", ",", "err", "\n", "}", "\n", "defer", "db", ".", "Close", "(", ")", "\n\n", "h", ":=", "crc32", ".", "New", "(", "crc32", ".", "MakeTable", "(", "crc32", ".", "Castagnoli", ")", ")", "\n\n", "if", "err", "=", "<mask>", ".", "View", "(", "func", "(", "tx", "*", "bolt", ".", "Tx", ")", "error", "{", "// check snapshot file integrity first", "var", "dbErrStrings", "[", "]", "string", "\n", "for", "dbErr", ":=", "range", "tx", ".", "Check", "(", ")", "{", "dbErrStrings", "=", "append", "(", "dbErrStrings", ",", "dbErr", ".", "Error", "(", ")", ")", "\n", "}", "\n", "if", "len", "(", "dbErrStrings", ")", ">", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\n", "\"", "+", "strings", ".", "Join", "(", "dbErrStrings", ",", "\"", "\\n", "\"", ")", ",", "len", "(", "dbErrStrings", ")", ")", "\n", "}", "\n", "ds", ".", "TotalSize", "=", "tx", ".", "Size", "(", ")", "\n", "c", ":=", "tx", ".", "Cursor", "(", ")", "\n", "for", "next", ",", "_", ":=", "c", ".", "First", "(", ")", ";", "next", "!=", "nil", ";", "next", ",", "_", "=", "c", ".", "Next", "(", ")", "{", "b", ":=", "tx", ".", "Bucket", "(", "next", ")", "\n", "if", "b", "==", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "string", "(", "next", ")", ")", "\n", "}", "\n", "h", ".", "Write", "(", "next", ")", "\n", "iskeyb", ":=", "(", "string", "(", "next", ")", "==", "\"", "\"", ")", "\n", "b", ".", "ForEach", "(", "func", "(", "k", ",", "v", "[", "]", "byte", ")", "error", "{", "h", ".", "Write", "(", "k", ")", "\n", "h", ".", "Write", "(", "v", ")", "\n", "if", "iskeyb", "{", "rev", ":=", "bytesToRev", "(", "k", ")", "\n", "ds", ".", "Revision", "=", "rev", ".", "main", "\n", "}", "\n", "ds", ".", "TotalKey", "++", "\n", "return", "nil", "\n", "}", ")", "\n", "}", "\n", "return", "nil", "\n", "}", ")", ";", "err", "!=", "nil", "{", "return", "ds", ",", "err", "\n", "}", "\n\n", "ds", ".", "Hash", "=", "h", ".", "Sum32", "(", ")", "\n", "return", "ds", ",", "nil", "\n", "}" ]
7,340
all-7341
[ "New", "returns", "a", "memcache", "client", "using", "the", "provided", "server", "(", "s", ")", "with", "equal", "weight", ".", "If", "a", "server", "is", "listed", "multiple", "times", "it", "gets", "a", "proportional", "amount", "of", "weight", "." ]
[ "func", "New", "(", "server", "...", "string", ")", "(", "*", "<mask>", ",", "error", ")", "{", "servers", ",", "err", ":=", "NewServerList", "(", "server", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "NewFromServers", "(", "servers", ")", ",", "nil", "\n", "}" ]
7,341
all-7342
[ "SetWantsLayer", "sets", "v", ".", "wantsLayer", "to", "wantsLayer", ".", "Reference", ":", "https", ":", "//", "developer", ".", "apple", ".", "com", "/", "documentation", "/", "appkit", "/", "nsview", "/", "1483695", "-", "wantslayer", "." ]
[ "func", "(", "v", "View", ")", "SetWantsLayer", "(", "wantsLayer", "bool", ")", "{", "if", "wantsLayer", "{", "C", ".", "View_SetWantsLayer", "(", "v", ".", "view", ",", "1", ")", "\n", "}", "else", "{", "C", ".", "View_SetWantsLayer", "(", "v", ".", "<mask>", ",", "0", ")", "\n", "}", "\n", "}" ]
7,342
all-7343
[ "getScale", "must", "be", "called", "from", "the", "main", "thread", "." ]
[ "func", "(", "u", "*", "UserInterface", ")", "getScale", "(", ")", "float64", "{", "if", "!", "u", ".", "isFullscreen", "(", ")", "{", "return", "u", ".", "<mask>", "\n", "}", "\n", "if", "u", ".", "fullscreenScale", "==", "0", "{", "v", ":=", "u", ".", "window", ".", "GetMonitor", "(", ")", ".", "GetVideoMode", "(", ")", "\n", "sw", ":=", "float64", "(", "v", ".", "Width", ")", "/", "u", ".", "glfwScale", "(", ")", "/", "float64", "(", "u", ".", "width", ")", "\n", "sh", ":=", "float64", "(", "v", ".", "Height", ")", "/", "u", ".", "glfwScale", "(", ")", "/", "float64", "(", "u", ".", "height", ")", "\n", "s", ":=", "sw", "\n", "if", "s", ">", "sh", "{", "s", "=", "sh", "\n", "}", "\n", "u", ".", "fullscreenScale", "=", "s", "\n", "}", "\n", "return", "u", ".", "fullscreenScale", "\n", "}" ]
7,343
all-7344
[ "GetRequestIPs", "returns", "all", "possible", "IPs", "found", "in", "HTTP", "request", "." ]
[ "func", "GetRequestIPs", "(", "r", "*", "http", ".", "Request", ")", "string", "{", "ip", ",", "_", ",", "err", ":=", "net", ".", "SplitHostPort", "(", "r", ".", "RemoteAddr", ")", "\n", "if", "err", "!=", "nil", "{", "ip", "=", "r", ".", "RemoteAddr", "\n", "}", "\n", "ips", ":=", "[", "]", "string", "{", "ip", "}", "\n", "xfr", ":=", "r", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "xfr", "!=", "\"", "\"", "{", "ips", "=", "<mask>", "(", "ips", ",", "xfr", ")", "\n", "}", "\n", "xri", ":=", "r", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "xri", "!=", "\"", "\"", "{", "ips", "=", "append", "(", "ips", ",", "xri", ")", "\n", "}", "\n", "return", "strings", ".", "Join", "(", "ips", ",", "\"", "\"", ")", "\n", "}" ]
7,344
all-7345
[ "TODO", ":", "server", "NOSPACE", "etcdserver", ".", "ErrNoLeader", "in", "health", "API" ]
[ "func", "checkHealth", "(", "srv", "etcdserver", ".", "ServerV2", ")", "Health", "{", "h", ":=", "Health", "{", "Health", ":", "\"", "\"", "}", "\n\n", "as", ":=", "srv", ".", "Alarms", "(", ")", "\n", "if", "len", "(", "as", ")", ">", "0", "{", "h", ".", "Health", "=", "\"", "\"", "\n", "}", "\n\n", "if", "h", ".", "Health", "==", "\"", "\"", "{", "if", "uint64", "(", "srv", ".", "Leader", "(", ")", ")", "==", "raft", ".", "None", "{", "h", ".", "Health", "=", "\"", "\"", "\n", "}", "\n", "}", "\n\n", "if", "h", ".", "Health", "==", "\"", "\"", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "time", ".", "Second", ")", "\n", "_", ",", "err", ":=", "srv", ".", "Do", "(", "ctx", ",", "etcdserverpb", ".", "<mask>", "{", "Method", ":", "\"", "\"", "}", ")", "\n", "cancel", "(", ")", "\n", "if", "err", "!=", "nil", "{", "h", ".", "Health", "=", "\"", "\"", "\n", "}", "\n", "}", "\n\n", "if", "h", ".", "Health", "==", "\"", "\"", "{", "healthSuccess", ".", "Inc", "(", ")", "\n", "}", "else", "{", "healthFailed", ".", "Inc", "(", ")", "\n", "}", "\n", "return", "h", "\n", "}" ]
7,345
all-7346
[ "HasUrl", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "SyntheticsRequest", ")", "HasUrl", "(", ")", "bool", "{", "if", "s", "!=", "nil", "&&", "s", ".", "Url", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
7,346
all-7347
[ "SSM", "Client", "will", "automatically", "retry", "3", "times", "when", "has", "throttling", "error" ]
[ "func", "(", "*", "ssmClientCreator", ")", "NewSSMClient", "(", "region", "string", ",", "creds", "credentials", ".", "IAMRoleCredentials", ")", "ssmclient", ".", "SSMClient", "{", "cfg", ":=", "aws", ".", "NewConfig", "(", ")", ".", "WithHTTPClient", "(", "httpclient", ".", "New", "(", "roundtripTimeout", ",", "<mask>", ")", ")", ".", "WithRegion", "(", "region", ")", ".", "WithCredentials", "(", "awscreds", ".", "NewStaticCredentials", "(", "creds", ".", "AccessKeyID", ",", "creds", ".", "SecretAccessKey", ",", "creds", ".", "SessionToken", ")", ")", "\n", "sess", ":=", "session", ".", "Must", "(", "session", ".", "NewSession", "(", "cfg", ")", ")", "\n", "return", "ssm", ".", "New", "(", "sess", ")", "\n", "}" ]
7,347
all-7348
[ "ProcessTimed", "will", "use", "the", "Pool", "to", "process", "a", "payload", "and", "synchronously", "return", "the", "result", ".", "If", "the", "timeout", "occurs", "before", "the", "job", "has", "finished", "the", "worker", "will", "be", "interrupted", "and", "ErrJobTimedOut", "will", "be", "returned", ".", "ProcessTimed", "can", "be", "called", "safely", "by", "any", "goroutines", "." ]
[ "func", "(", "p", "*", "Pool", ")", "ProcessTimed", "(", "payload", "interface", "{", "}", ",", "timeout", "time", ".", "Duration", ",", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "atomic", ".", "AddInt64", "(", "&", "p", ".", "queuedJobs", ",", "1", ")", "\n", "defer", "atomic", ".", "AddInt64", "(", "&", "p", ".", "queuedJobs", ",", "-", "1", ")", "\n\n", "tout", ":=", "time", ".", "NewTimer", "(", "timeout", ")", "\n\n", "var", "request", "workRequest", "\n", "var", "open", "bool", "\n\n", "select", "{", "<mask>", "request", ",", "open", "=", "<-", "p", ".", "reqChan", ":", "if", "!", "open", "{", "return", "nil", ",", "ErrPoolNotRunning", "\n", "}", "\n", "case", "<-", "tout", ".", "C", ":", "return", "nil", ",", "ErrJobTimedOut", "\n", "}", "\n\n", "select", "{", "case", "request", ".", "jobChan", "<-", "payload", ":", "case", "<-", "tout", ".", "C", ":", "request", ".", "interruptFunc", "(", ")", "\n", "return", "nil", ",", "ErrJobTimedOut", "\n", "}", "\n\n", "select", "{", "case", "payload", ",", "open", "=", "<-", "request", ".", "retChan", ":", "if", "!", "open", "{", "return", "nil", ",", "ErrWorkerClosed", "\n", "}", "\n", "case", "<-", "tout", ".", "C", ":", "request", ".", "interruptFunc", "(", ")", "\n", "return", "nil", ",", "ErrJobTimedOut", "\n", "}", "\n\n", "tout", ".", "Stop", "(", ")", "\n", "return", "payload", ",", "nil", "\n", "}" ]
7,348
all-7349
[ "WithQuality", "compression", "quality", "from", "range", "[", "0", "..", "100", "]", "(", "jpeg", "only", ")", "." ]
[ "func", "(", "p", "CaptureScreenshotParams", ")", "WithQuality", "(", "<mask>", "int64", ")", "*", "CaptureScreenshotParams", "{", "p", ".", "Quality", "=", "quality", "\n", "return", "&", "p", "\n", "}" ]
7,349
all-7350
[ "addWarning", "builds", "a", "severe", "Error", "and", "appends", "to", "the", "Part", "error", "slice", "." ]
[ "func", "(", "p", "*", "Part", ")", "addError", "(", "name", "string", ",", "detailFmt", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "p", ".", "Errors", "=", "append", "(", "p", ".", "Errors", ",", "&", "Error", "{", "<mask>", ",", "fmt", ".", "Sprintf", "(", "detailFmt", ",", "args", "...", ")", ",", "true", ",", "}", ")", "\n", "}" ]
7,350
all-7351
[ "Menu", "returns", "menu", "information", "for", "a", "venue", ".", "https", ":", "//", "developer", ".", "foursquare", ".", "com", "/", "docs", "/", "api", "/", "venues", "/", "menu" ]
[ "func", "(", "s", "*", "VenueService", ")", "Menu", "(", "id", "string", ")", "(", "*", "MenuResp", ",", "*", "http", ".", "Response", ",", "error", ")", "{", "menuResp", ":=", "new", "(", "venueMenuResp", ")", "\n", "<mask>", ":=", "new", "(", "Response", ")", "\n\n", "resp", ",", "err", ":=", "s", ".", "sling", ".", "New", "(", ")", ".", "Get", "(", "id", "+", "\"", "\"", ")", ".", "Receive", "(", "response", ",", "response", ")", "\n", "if", "err", "==", "nil", "{", "json", ".", "Unmarshal", "(", "response", ".", "Response", ",", "menuResp", ")", "\n", "}", "\n\n", "return", "&", "menuResp", ".", "Menu", ",", "resp", ",", "relevantError", "(", "err", ",", "*", "response", ")", "\n", "}" ]
7,351
all-7352
[ "This", "method", "takes", "map", "[", "string", "]", "map", "[", "string", "]", "string", "==", ">", "map", "[", "metric", "/", "table", "name", "]", "map", "[", "timestamp", "]", "value" ]
[ "func", "(", "tsdbm", "GraphiteManager", ")", "PushToDb", "(", "metrics", "map", "[", "string", "]", "map", "[", "string", "]", "string", ",", "hostName", "string", ",", "port", "int", ")", "error", "{", "data", ":=", "make", "(", "[", "]", "graphite", ".", "Metric", ",", "1", ")", "\n", "for", "tableName", ",", "valueMap", ":=", "range", "metrics", "{", "for", "timestamp", ",", "value", ":=", "range", "valueMap", "{", "timeInt", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "timestamp", ",", "10", ",", "64", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "timestamp", ",", "tableName", ",", "err", ".", "<mask>", "(", ")", ")", "\n", "}", "\n", "data", "=", "append", "(", "data", ",", "graphite", ".", "Metric", "{", "Name", ":", "tableName", ",", "Value", ":", "value", ",", "Timestamp", ":", "timeInt", "}", ")", "\n", "}", "\n", "}", "\n", "Graphite", ",", "err", ":=", "graphite", ".", "NewGraphite", "(", "hostName", ",", "port", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "Graphite", ".", "SendMetrics", "(", "data", ")", "\n", "if", "err", ":=", "Graphite", ".", "Disconnect", "(", ")", ";", "err", "!=", "nil", "{", "logger", ".", "Get", "(", ")", ".", "Warning", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
7,352
all-7353
[ "ListArtifacts", "gets", "the", "names", "of", "all", "artifacts", "available", "from", "the", "given", "source" ]
[ "func", "(", "s", "*", "Spyglass", ")", "ListArtifacts", "(", "src", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "keyType", ",", "key", ",", "err", ":=", "splitSrc", "(", "src", ")", "\n", "if", "err", "!=", "nil", "{", "return", "[", "]", "string", "{", "}", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "gcsKey", ":=", "\"", "\"", "\n", "switch", "keyType", "{", "case", "gcsKeyType", ":", "gcsKey", "=", "key", "\n", "case", "prowKeyType", ":", "if", "gcsKey", ",", "err", "=", "s", ".", "prowToGCS", "(", "key", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "Warningf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "default", ":", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "src", ")", "\n", "}", "\n\n", "artifactNames", ",", "err", ":=", "s", ".", "GCSArtifactFetcher", ".", "artifacts", "(", "gcsKey", ")", "\n", "logFound", ":=", "false", "\n", "for", "_", ",", "name", ":=", "range", "artifactNames", "{", "if", "name", "==", "\"", "\"", "{", "logFound", "=", "true", "\n", "break", "\n", "}", "\n", "}", "\n", "if", "err", "!=", "nil", "||", "!", "logFound", "{", "artifactNames", "=", "<mask>", "(", "artifactNames", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "artifactNames", ",", "nil", "\n", "}" ]
7,353
all-7354
[ "Run", "calls", "f", "on", "the", "main", "thread", ".", "Do", "not", "call", "this", "from", "the", "main", "thread", ".", "This", "would", "block", "forever", "." ]
[ "func", "Run", "(", "f", "func", "(", ")", "error", ")", "error", "{", "if", "atomic", ".", "LoadInt32", "(", "&", "started", ")", "==", "0", "{", "// TODO: This can reach from other goroutine before Loop is called (#809).", "// panic(\"mainthread: the mainthread loop is not started yet\")", "}", "\n\n", "ch", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "var", "err", "error", "\n", "funcs", "<-", "func", "(", ")", "{", "err", "=", "f", "(", ")", "\n", "<mask>", "(", "ch", ")", "\n", "}", "\n", "<-", "ch", "\n", "return", "err", "\n", "}" ]
7,354
all-7355
[ "WithPresentationURL", "[", "no", "description", "]", "." ]
[ "func", "(", "p", "EnableParams", ")", "WithPresentationURL", "(", "presentationURL", "<mask>", ")", "*", "EnableParams", "{", "p", ".", "PresentationURL", "=", "presentationURL", "\n", "return", "&", "p", "\n", "}" ]
7,355
all-7356
[ "MetadataFromIncomingContext", "gets", "the", "metadata", "from", "the", "given", "context" ]
[ "func", "MetadataFromIncomingContext", "(", "ctx", "<mask>", ".", "Context", ")", "metadata", ".", "MD", "{", "md", ",", "_", ":=", "metadata", ".", "FromIncomingContext", "(", "ctx", ")", "\n", "return", "md", "\n", "}" ]
7,356
all-7357
[ "firstGoFile", "returns", "the", "name", "of", "a", ".", "go", "file", "if", "the", "package", "contains", "at", "least", "one", ".", "go", "file", "or", "otherwise", "." ]
[ "func", "(", "pkg", "*", "goPackage", ")", "firstGoFile", "(", ")", "string", "{", "goSrcs", ":=", "[", "]", "platformStringsBuilder", "{", "pkg", ".", "<mask>", ".", "sources", ",", "pkg", ".", "binary", ".", "sources", ",", "pkg", ".", "test", ".", "sources", ",", "}", "\n", "for", "_", ",", "sb", ":=", "range", "goSrcs", "{", "if", "sb", ".", "strs", "!=", "nil", "{", "for", "s", ":=", "range", "sb", ".", "strs", "{", "if", "strings", ".", "HasSuffix", "(", "s", ",", "\"", "\"", ")", "{", "return", "s", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
7,357
all-7358
[ "NewEncoder", "returns", "a", "new", "encoder", "that", "outputs", "values", "to", "e", ".", "Encoders", "created", "by", "this", "function", "use", "the", "default", "encoder", "configuration", "which", "is", "equivalent", "to", "using", "a", "zero", "-", "value", "EncoderConfig", "with", "only", "the", "Emitter", "field", "set", ".", "The", "function", "panics", "if", "e", "is", "nil", "." ]
[ "func", "NewEncoder", "(", "e", "Emitter", ")", "*", "Encoder", "{", "if", "e", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "<mask>", "&", "Encoder", "{", "Emitter", ":", "e", "}", "\n", "}" ]
7,358
all-7359
[ "AddBytesKNoValue", "adds", "only", "key", "as", "argument", "without", "the", "=", ".", "Multiple", "values", "for", "the", "same", "key", "may", "be", "added", "." ]
[ "func", "(", "a", "*", "Args", ")", "AddBytesKNoValue", "(", "key", "[", "]", "byte", ")", "{", "a", ".", "args", "=", "appendArg", "(", "a", ".", "args", ",", "b2s", "(", "<mask>", ")", ",", "\"", "\"", ",", "argsNoValue", ")", "\n", "}" ]
7,359
all-7360
[ "Merge", "the", "set", "into", "our", "state", "abiding", "increment", "-", "only", "semantics", ".", "Return", "a", "non", "-", "nil", "mesh", ".", "GossipData", "representation", "of", "the", "received", "set", "." ]
[ "func", "(", "st", "*", "state", ")", "mergeReceived", "(", "set", "map", "[", "mesh", ".", "PeerName", "]", "int", ")", "(", "received", "mesh", ".", "GossipData", ")", "{", "st", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "st", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "for", "peer", ",", "v", ":=", "range", "set", "{", "if", "v", "<=", "st", ".", "set", "[", "peer", "]", "{", "delete", "(", "<mask>", ",", "peer", ")", "// optimization: make the forwarded data smaller", "\n", "continue", "\n", "}", "\n", "st", ".", "set", "[", "peer", "]", "=", "v", "\n", "}", "\n\n", "return", "&", "state", "{", "set", ":", "set", ",", "// all remaining elements were novel to us", "}", "\n", "}" ]
7,360
all-7361
[ "Random", "creates", "a", "random", "full", "keypair" ]
[ "func", "Random", "(", ")", "(", "*", "Full", ",", "error", ")", "{", "var", "rawSeed", "[", "32", "]", "byte", "\n\n", "_", ",", "err", ":=", "<mask>", ".", "ReadFull", "(", "rand", ".", "Reader", ",", "rawSeed", "[", ":", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "kp", ",", "err", ":=", "FromRawSeed", "(", "rawSeed", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "kp", ",", "nil", "\n", "}" ]
7,361
all-7362
[ "WithIgnoreCache", "if", "true", "browser", "cache", "is", "ignored", "(", "as", "if", "the", "user", "pressed", "Shift", "+", "refresh", ")", "." ]
[ "func", "(", "p", "ReloadParams", ")", "WithIgnoreCache", "(", "ignoreCache", "bool", ")", "*", "ReloadParams", "{", "p", ".", "IgnoreCache", "=", "ignoreCache", "\n", "<mask>", "&", "p", "\n", "}" ]
7,362
all-7363
[ "Write", "sends", "a", "batch", "of", "samples", "to", "InfluxDB", "via", "its", "HTTP", "API", "." ]
[ "func", "(", "c", "*", "Client", ")", "Write", "(", "samples", "model", ".", "Samples", ")", "error", "{", "points", ":=", "make", "(", "[", "]", "*", "influx", ".", "<mask>", ",", "0", ",", "len", "(", "samples", ")", ")", "\n", "for", "_", ",", "s", ":=", "range", "samples", "{", "v", ":=", "float64", "(", "s", ".", "Value", ")", "\n", "if", "math", ".", "IsNaN", "(", "v", ")", "||", "math", ".", "IsInf", "(", "v", ",", "0", ")", "{", "level", ".", "Debug", "(", "c", ".", "logger", ")", ".", "Log", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "v", ",", "\"", "\"", ",", "s", ")", "\n", "c", ".", "ignoredSamples", ".", "Inc", "(", ")", "\n", "continue", "\n", "}", "\n", "p", ",", "err", ":=", "influx", ".", "NewPoint", "(", "string", "(", "s", ".", "Metric", "[", "model", ".", "MetricNameLabel", "]", ")", ",", "tagsFromMetric", "(", "s", ".", "Metric", ")", ",", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "v", "}", ",", "s", ".", "Timestamp", ".", "Time", "(", ")", ",", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "points", "=", "append", "(", "points", ",", "p", ")", "\n", "}", "\n\n", "bps", ",", "err", ":=", "influx", ".", "NewBatchPoints", "(", "influx", ".", "BatchPointsConfig", "{", "Precision", ":", "\"", "\"", ",", "Database", ":", "c", ".", "database", ",", "RetentionPolicy", ":", "c", ".", "retentionPolicy", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "bps", ".", "AddPoints", "(", "points", ")", "\n", "return", "c", ".", "client", ".", "Write", "(", "bps", ")", "\n", "}" ]
7,363
all-7364
[ "title", ":", "list", "nodes", "path", ":", "/", "{", "provisioner", "}", "/", "node", "method", ":", "GET", "produce", ":", "application", "/", "json", "responses", ":", "200", ":", "Ok", "204", ":", "No", "content" ]
[ "func", "listNodesHandler", "(", "w", "<mask>", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "error", "{", "pools", ",", "err", ":=", "permission", ".", "ListContextValues", "(", "t", ",", "permission", ".", "PermNodeRead", ",", "false", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "provs", ",", "err", ":=", "provision", ".", "Registry", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "provNameMap", ":=", "map", "[", "string", "]", "string", "{", "}", "\n", "var", "allNodes", "[", "]", "provision", ".", "NodeSpec", "\n", "for", "_", ",", "prov", ":=", "range", "provs", "{", "nodeProv", ",", "ok", ":=", "prov", ".", "(", "provision", ".", "NodeProvisioner", ")", "\n", "if", "!", "ok", "{", "continue", "\n", "}", "\n", "var", "nodes", "[", "]", "provision", ".", "Node", "\n", "nodes", ",", "err", "=", "nodeProv", ".", "ListNodes", "(", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "allNodes", "=", "append", "(", "allNodes", ",", "provision", ".", "NodeSpec", "{", "Address", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "prov", ".", "GetName", "(", ")", ")", ",", "Status", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "err", ")", ",", "}", ")", "\n", "continue", "\n", "}", "\n", "for", "_", ",", "n", ":=", "range", "nodes", "{", "provNameMap", "[", "n", ".", "Address", "(", ")", "]", "=", "prov", ".", "GetName", "(", ")", "\n", "allNodes", "=", "append", "(", "allNodes", ",", "provision", ".", "NodeToSpec", "(", "n", ")", ")", "\n", "}", "\n", "}", "\n", "if", "pools", "!=", "nil", "{", "filteredNodes", ":=", "make", "(", "[", "]", "provision", ".", "NodeSpec", ",", "0", ",", "len", "(", "allNodes", ")", ")", "\n", "for", "_", ",", "node", ":=", "range", "allNodes", "{", "for", "_", ",", "pool", ":=", "range", "pools", "{", "if", "node", ".", "Pool", "==", "pool", "{", "filteredNodes", "=", "append", "(", "filteredNodes", ",", "node", ")", "\n", "break", "\n", "}", "\n", "}", "\n", "}", "\n", "allNodes", "=", "filteredNodes", "\n", "}", "\n", "iaases", ",", "err", ":=", "permission", ".", "ListContextValues", "(", "t", ",", "permission", ".", "PermMachineRead", ",", "false", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "machines", ",", "err", ":=", "iaas", ".", "ListMachines", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "iaases", "!=", "nil", "{", "filteredMachines", ":=", "make", "(", "[", "]", "iaas", ".", "Machine", ",", "0", ",", "len", "(", "machines", ")", ")", "\n", "for", "_", ",", "machine", ":=", "range", "machines", "{", "for", "_", ",", "iaas", ":=", "range", "iaases", "{", "if", "machine", ".", "Iaas", "==", "iaas", "{", "filteredMachines", "=", "append", "(", "filteredMachines", ",", "machine", ")", "\n", "break", "\n", "}", "\n", "}", "\n", "}", "\n", "machines", "=", "filteredMachines", "\n", "}", "\n", "if", "len", "(", "allNodes", ")", "==", "0", "&&", "len", "(", "machines", ")", "==", "0", "{", "w", ".", "WriteHeader", "(", "http", ".", "StatusNoContent", ")", "\n", "return", "nil", "\n", "}", "\n", "result", ":=", "apiTypes", ".", "ListNodeResponse", "{", "Nodes", ":", "allNodes", ",", "Machines", ":", "machines", ",", "}", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "result", ")", "\n", "}" ]
7,364
all-7365
[ "GetMaxLength", "()", "is", "a", "wrapper", "around", "gtk_entry_buffer_get_max_length", "()", "." ]
[ "func", "(", "v", "*", "EntryBuffer", ")", "GetMaxLength", "(", ")", "int", "{", "c", ":=", "C", ".", "gtk_entry_buffer_get_max_length", "(", "v", ".", "native", "(", ")", ")", "\n", "<mask>", "int", "(", "c", ")", "\n", "}" ]
7,365
all-7366
[ "PathPrefix", "-----------------------------------------------------------------", "NewPathPrefix", "returns", "a", "static", "URL", "path", "prefix", "matcher", "." ]
[ "func", "NewPathPrefix", "(", "prefix", "string", ")", "PathPrefix", "{", "if", "!", "strings", ".", "HasPrefix", "(", "prefix", ",", "\"", "\"", ")", "{", "prefix", "=", "\"", "\"", "+", "<mask>", "\n", "}", "\n", "return", "PathPrefix", "(", "prefix", ")", "\n", "}" ]
7,366
all-7367
[ "New", "creates", "a", "new", "error", "based", "on", "the", "error", "descriptor" ]
[ "func", "(", "err", "*", "ErrDescriptor", ")", "New", "(", "attributes", "Attributes", ")", "Error", "{", "if", "err", ".", "Code", "!=", "NoCode", "&&", "!", "err", ".", "registered", "{", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ".", "Code", ")", ")", "\n", "}", "\n\n", "return", "&", "impl", "{", "message", ":", "Format", "(", "err", ".", "MessageFormat", ",", "attributes", ")", ",", "code", ":", "err", ".", "Code", ",", "typ", ":", "err", ".", "<mask>", ",", "attributes", ":", "attributes", ",", "}", "\n", "}" ]
7,367
all-7368
[ "NewMockPlugins", "creates", "a", "new", "mock", "instance" ]
[ "func", "NewMockPlugins", "(", "ctrl", "*", "gomock", ".", "<mask>", ")", "*", "MockPlugins", "{", "mock", ":=", "&", "MockPlugins", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockPluginsMockRecorder", "{", "mock", "}", "\n", "return", "mock", "\n", "}" ]
7,368
all-7369
[ "Set", "creates", "and", "sets", "a", "new", "LexItem", "to", "name" ]
[ "func", "(", "l", "*", "LexSymbolSet", ")", "Set", "(", "name", "string", ",", "typ", "lex", ".", "ItemType", ",", "prio", "...", "float32", ")", "{", "var", "x", "float32", "\n", "if", "len", "(", "prio", ")", "<", "1", "{", "x", "=", "1.0", "\n", "}", "else", "{", "x", "=", "prio", "[", "0", "]", "\n", "}", "\n", "l", ".", "<mask>", "[", "name", "]", "=", "LexSymbol", "{", "name", ",", "typ", ",", "x", "}", "\n", "l", ".", "SortedList", "=", "nil", "// reset", "\n", "}" ]
7,369
all-7370
[ "createStatsTags", "creates", "the", "common", "stats", "tags", "if", "they", "are", "not", "already", "created", "." ]
[ "func", "(", "call", "*", "OutboundCall", ")", "createStatsTags", "(", "connectionTags", "map", "[", "string", "]", "string", ",", "callOptions", "*", "CallOptions", ",", "method", "string", ")", "{", "call", ".", "commonStatsTags", "=", "<mask>", "[", "string", "]", "string", "{", "\"", "\"", ":", "call", ".", "callReq", ".", "Service", ",", "}", "\n", "for", "k", ",", "v", ":=", "range", "connectionTags", "{", "call", ".", "commonStatsTags", "[", "k", "]", "=", "v", "\n", "}", "\n", "if", "callOptions", ".", "Format", "!=", "HTTP", "{", "call", ".", "commonStatsTags", "[", "\"", "\"", "]", "=", "string", "(", "method", ")", "\n", "}", "\n", "}" ]
7,370
all-7371
[ "NewCronInput", "returns", "an", "input", "which", "will", "trigger", "based", "on", "a", "timed", "schedule", ".", "It", "uses", "cron", "syntax", "to", "specify", "the", "schedule", ".", "The", "input", "will", "be", "exposed", "to", "jobs", "as", "/", "pfs", "/", "<name", ">", "/", "<timestamp", ">", ".", "The", "timestamp", "uses", "the", "RFC", "3339", "format", "e", ".", "g", ".", "2006", "-", "01", "-", "02T15", ":", "04", ":", "05Z07", ":", "00", "." ]
[ "func", "NewCronInput", "(", "name", "string", ",", "spec", "string", ")", "*", "pps", ".", "<mask>", "{", "return", "&", "pps", ".", "Input", "{", "Cron", ":", "&", "pps", ".", "CronInput", "{", "Name", ":", "name", ",", "Spec", ":", "spec", ",", "}", ",", "}", "\n", "}" ]
7,371
all-7372
[ "Do", "executes", "Debugger", ".", "continueToLocation", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "ContinueToLocationParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandContinueToLocation", ",", "p", ",", "nil", ")", "\n", "}" ]
7,372
all-7373
[ "----------------------------------------", "Unsigned" ]
[ "func", "DecodeByte", "(", "bz", "[", "]", "<mask>", ")", "(", "b", "byte", ",", "n", "int", ",", "err", "error", ")", "{", "return", "DecodeUint8", "(", "bz", ")", "\n", "}" ]
7,373
all-7374
[ "GetEndpoint", "returns", "an", "endpoint", "for", "a", "given", "client", "key", "." ]
[ "func", "(", "h", "*", "Handler", ")", "GetEndpoint", "(", "product", ",", "productPassword", ",", "clientKey", "string", ")", "(", "*", "data", ".", "Endpoint", ",", "error", ")", "{", "logger", ":=", "h", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "product", ",", "\"", "\"", ",", "clientKey", ")", "\n\n", "logger", ".", "Info", "(", "\"", "\"", ")", "\n\n", "prod", ",", "err", ":=", "h", ".", "checkProductPassword", "(", "logger", ",", "<mask>", ",", "productPassword", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "ch", ",", "err", ":=", "h", ".", "findClientChannel", "(", "logger", ",", "prod", ",", "clientKey", ",", "true", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "var", "ept", "data", ".", "Endpoint", "\n", "if", "err", ":=", "h", ".", "db", ".", "FindOneTo", "(", "&", "ept", ",", "\"", "\"", ",", "ch", ".", "ID", ")", ";", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "nil", ",", "ErrEndpointNotFound", "\n", "}", "\n\n", "return", "&", "ept", ",", "nil", "\n", "}" ]
7,374
all-7375
[ "GetSnapshot", "gets", "a", "specific", "snapshot" ]
[ "func", "(", "c", "*", "Client", ")", "GetSnapshot", "(", "snapshotID", "string", ")", "(", "*", "Snapshot", ",", "error", ")", "{", "url", ":=", "snapshotColPath", "(", ")", "+", "slash", "(", "snapshotID", ")", "+", "`?depth=`", "+", "c", ".", "client", ".", "depth", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "ret", ":=", "&", "Snapshot", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Get", "(", "url", ",", "ret", ",", "http", ".", "StatusOK", ")", "\n", "return", "<mask>", ",", "err", "\n", "}" ]
7,375
all-7376
[ "PreCreateCheck", "checks", "that", "VBoxManage", "exists", "and", "works" ]
[ "func", "(", "d", "*", "Driver", ")", "PreCreateCheck", "(", ")", "error", "{", "// Check that VBoxManage exists and works", "version", ",", "err", ":=", "d", ".", "vbmOut", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Check that VBoxManage is of a supported version", "if", "err", "=", "checkVBoxManageVersion", "(", "strings", ".", "TrimSpace", "(", "<mask>", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "!", "d", ".", "NoVTXCheck", "{", "if", "isHyperVInstalled", "(", ")", "{", "return", "ErrNotCompatibleWithHyperV", "\n", "}", "\n\n", "if", "d", ".", "IsVTXDisabled", "(", ")", "{", "return", "ErrMustEnableVTX", "\n", "}", "\n", "}", "\n\n", "// Downloading boot2docker to cache should be done here to make sure", "// that a download failure will not leave a machine half created.", "if", "err", ":=", "d", ".", "b2dUpdater", ".", "UpdateISOCache", "(", "d", ".", "StorePath", ",", "d", ".", "Boot2DockerURL", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Check that Host-only interfaces are ok", "if", "_", ",", "err", "=", "listHostOnlyAdapters", "(", "d", ".", "VBoxManager", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
7,376
all-7377
[ "stringTableDash", "-", "output", "table", "dash", ".", "Markdown", "or", "not", "depending", "on", "settings", "." ]
[ "func", "(", "t", "*", "<mask>", ")", "stringTableDash", "(", ")", "string", "{", "if", "t", ".", "Markdown", "{", "return", "t", ".", "stringMarkdownDash", "(", ")", "\n", "}", "\n", "return", "t", ".", "stringDash", "(", ")", "\n", "}" ]
7,377
all-7378
[ "Check", "the", "virtual", "server", "instance", "is", "ready", "for", "use" ]
[ "func", "(", "c", "*", "ClientManager", ")", "WaitInstanceUntilReady", "(", "id", "int", ",", "until", "time", ".", "Time", ")", "error", "{", "for", "{", "virtualGuest", ",", "found", ",", "err", ":=", "c", ".", "GetInstance", "(", "id", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "!", "found", "{", "return", "bosherr", ".", "WrapErrorf", "(", "err", ",", "\"", "\"", ",", "id", ")", "\n", "}", "\n\n", "lastReload", ":=", "virtualGuest", ".", "LastOperatingSystemReload", "\n", "activeTxn", ":=", "virtualGuest", ".", "ActiveTransaction", "\n", "provisionDate", ":=", "virtualGuest", ".", "ProvisionDate", "\n\n", "// if lastReload != nil && lastReload.ModifyDate != nil {", "// \tfmt.Println(\"lastReload: \", (*lastReload.ModifyDate).Format(time.RFC3339))", "// }", "// if activeTxn != nil && activeTxn.TransactionStatus != nil && activeTxn.TransactionStatus.Name != nil {", "// \tfmt.Println(\"activeTxn: \", *activeTxn.TransactionStatus.Name)", "// }", "// if provisionDate != nil {", "// \tfmt.Println(\"provisionDate: \", (*provisionDate).Format(time.RFC3339))", "// }", "reloading", ":=", "activeTxn", "!=", "nil", "&&", "lastReload", "!=", "nil", "&&", "*", "activeTxn", ".", "Id", "==", "*", "lastReload", ".", "Id", "\n", "if", "provisionDate", "!=", "nil", "&&", "!", "reloading", "{", "// fmt.Println(\"power state:\", *virtualGuest.PowerState.KeyName)", "if", "*", "virtualGuest", ".", "PowerState", ".", "KeyName", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n", "}", "\n\n", "now", ":=", "time", ".", "Now", "(", ")", "\n", "if", "now", ".", "After", "(", "until", ")", "{", "return", "bosherr", ".", "Errorf", "(", "\"", "\"", ",", "*", "virtualGuest", ".", "Id", ")", "\n", "}", "\n\n", "min", ":=", "math", ".", "Min", "(", "float64", "(", "10.0", ")", ",", "float64", "(", "until", ".", "Sub", "(", "now", ")", ")", ")", "\n", "<mask>", ".", "Sleep", "(", "time", ".", "Duration", "(", "min", ")", "*", "time", ".", "Second", ")", "\n", "}", "\n", "}" ]
7,378
all-7379
[ "DeepCopy", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "Endpoint", "." ]
[ "func", "(", "in", "*", "Endpoint", ")", "DeepCopy", "(", ")", "*", "Endpoint", "{", "if", "in", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "<mask>", "(", "Endpoint", ")", "\n", "in", ".", "DeepCopyInto", "(", "out", ")", "\n", "return", "out", "\n", "}" ]
7,379
all-7380
[ "IDFromString", "attempts", "to", "create", "an", "ID", "from", "a", "base", "-", "16", "string", "." ]
[ "func", "IDFromString", "(", "s", "string", ")", "(", "ID", ",", "error", ")", "{", "i", ",", "err", ":=", "strconv", ".", "ParseUint", "(", "s", ",", "16", ",", "64", ")", "\n", "return", "<mask>", "(", "i", ")", ",", "err", "\n", "}" ]
7,380
all-7381
[ "ataRead", "performs", "an", "ATA", "28", "-", "bit", "or", "48", "-", "bit", "read", "request", "on", "rs", "using", "the", "argument", "values", "in", "r", "." ]
[ "func", "ataRead", "(", "r", "*", "ATAArg", ",", "<mask>", "io", ".", "ReadSeeker", ")", "(", "*", "ATAArg", ",", "error", ")", "{", "// Only ATA reads allowed here", "if", "r", ".", "CmdStatus", "!=", "ATACmdStatusRead28Bit", "&&", "r", ".", "CmdStatus", "!=", "ATACmdStatusRead48Bit", "{", "return", "nil", ",", "errATAAbort", "\n", "}", "\n\n", "// Read must not be flagged as a write", "if", "r", ".", "FlagWrite", "{", "return", "nil", ",", "errATAAbort", "\n", "}", "\n\n", "// Convert LBA to byte offset and seek to correct location", "offset", ":=", "calculateLBA", "(", "r", ".", "LBA", ",", "r", ".", "FlagLBA48Extended", ")", "*", "sectorSize", "\n", "if", "_", ",", "err", ":=", "rs", ".", "Seek", "(", "offset", ",", "os", ".", "SEEK_SET", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Allocate buffer and read exact (sector count * sector size) bytes from", "// stream", "//", "// TODO(mdlayher): use r.Data instead of allocating?", "b", ":=", "make", "(", "[", "]", "byte", ",", "int", "(", "r", ".", "SectorCount", ")", "*", "sectorSize", ")", "\n", "n", ",", "err", ":=", "rs", ".", "Read", "(", "b", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Verify sector count", "if", "sectors", ":=", "n", "/", "sectorSize", ";", "sectors", "!=", "int", "(", "r", ".", "SectorCount", ")", "{", "return", "nil", ",", "errATAAbort", "\n", "}", "\n\n", "return", "&", "ATAArg", "{", "CmdStatus", ":", "ATACmdStatusReadyStatus", ",", "Data", ":", "b", ",", "}", ",", "nil", "\n", "}" ]
7,381
all-7382
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetTimingParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoAnimation", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
7,382
all-7383
[ "AppChooserButtonNew", "()", "is", "a", "wrapper", "around", "gtk_app_chooser_button_new", "()", "." ]
[ "func", "AppChooserButtonNew", "(", "content_type", "string", ")", "(", "*", "AppChooserButton", ",", "error", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "content_type", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "c", ":=", "C", ".", "gtk_app_chooser_button_new", "(", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "return", "wrapAppChooserButton", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", ",", "nil", "\n", "}" ]
7,383
all-7384
[ "RenderString", "takes", "a", "string", "argument", "and", "treats", "it", "as", "the", "template", "content", ".", "Like", "Render", "()", "this", "template", "is", "parsed", "and", "compiled", ".", "Because", "there", "s", "no", "way", "to", "establish", "template", "freshness", "the", "resulting", "bytecode", "from", "RenderString", "()", "is", "not", "cached", "for", "reuse", ".", "If", "you", "*", "really", "*", "want", "to", "change", "this", "behavior", "it", "s", "not", "impossible", "to", "bend", "Xslate", "s", "Loader", "mechanism", "to", "cache", "strings", "as", "well", "but", "the", "main", "Xslate", "library", "will", "probably", "not", "adopt", "this", "feature", "." ]
[ "func", "(", "tx", "*", "Xslate", ")", "RenderString", "(", "template", "string", ",", "vars", "Vars", ")", "(", "string", ",", "error", ")", "{", "_", ",", "file", ",", "line", ",", "_", ":=", "runtime", ".", "Caller", "(", "1", ")", "\n", "bc", ",", "err", ":=", "tx", ".", "Loader", ".", "LoadString", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "file", ",", "line", ")", ",", "template", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "buf", ":=", "rbpool", ".", "Get", "(", ")", "\n", "defer", "rbpool", ".", "Release", "(", "buf", ")", "\n\n", "<mask>", ".", "VM", ".", "Run", "(", "bc", ",", "vm", ".", "Vars", "(", "vars", ")", ",", "buf", ")", "\n", "return", "buf", ".", "String", "(", ")", ",", "nil", "\n", "}" ]
7,384
all-7385
[ "Original", "will", "return", "the", "stored", "version", "of", "the", "model", ".", "This", "method", "is", "intended", "to", "be", "used", "to", "calculate", "the", "changed", "fields", "during", "an", "Update", "operation", ".", "Any", "returned", "error", "is", "already", "marked", "as", "fatal", ".", "This", "function", "will", "cache", "and", "reuse", "loaded", "models", "between", "multiple", "callbacks", ".", "Note", ":", "The", "method", "will", "panic", "if", "being", "used", "during", "any", "other", "operation", "than", "Update", "." ]
[ "func", "(", "c", "*", "Context", ")", "Original", "(", ")", "(", "coal", ".", "Model", ",", "error", ")", "{", "// begin trace", "c", ".", "Tracer", ".", "Push", "(", "\"", "\"", ")", "\n\n", "// check operation", "if", "c", ".", "Operation", "!=", "Update", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// return cached model", "if", "c", ".", "original", "!=", "nil", "{", "c", ".", "Tracer", ".", "Pop", "(", ")", "\n", "return", "c", ".", "original", ",", "nil", "\n", "}", "\n\n", "// create a new model", "m", ":=", "c", ".", "Model", ".", "Meta", "(", ")", ".", "Make", "(", ")", "\n\n", "// read original document", "c", ".", "Tracer", ".", "Push", "(", "\"", "\"", ")", "\n", "c", ".", "Tracer", ".", "Tag", "(", "\"", "\"", ",", "c", ".", "Model", ".", "ID", "(", ")", ")", "\n", "err", ":=", "c", ".", "<mask>", ".", "C", "(", "c", ".", "Model", ")", ".", "FindId", "(", "c", ".", "Model", ".", "ID", "(", ")", ")", ".", "One", "(", "m", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "c", ".", "Tracer", ".", "Pop", "(", ")", "\n\n", "// cache model", "c", ".", "original", "=", "coal", ".", "Init", "(", "m", ")", "\n\n", "// finish trace", "c", ".", "Tracer", ".", "Pop", "(", ")", "\n\n", "return", "c", ".", "original", ",", "nil", "\n", "}" ]
7,385
all-7386
[ "ErrUnsupportedRequestType", "indicates", "the", "processor", "cannot", "fullfil", "a", "request", "for", "the", "given", "RequestType", "." ]
[ "func", "ErrUnsupportedRequestType", "(", "st", "SubjectType", ")", "error", "{", "return", "ErrorResponse", "{", "Code", ":", "<mask>", ".", "StatusNotImplemented", ",", "Message", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "st", ")", ",", "}", "\n", "}" ]
7,386
all-7387
[ "SetDoubleClickDistance", "()", "is", "a", "wrapper", "around", "gdk_display_set_double_click_distance", "()", "." ]
[ "func", "(", "v", "*", "Display", ")", "SetDoubleClickDistance", "(", "distance", "uint", ")", "{", "C", ".", "gdk_display_set_double_click_distance", "(", "v", ".", "native", "(", ")", ",", "C", ".", "guint", "(", "<mask>", ")", ")", "\n", "}" ]
7,387
all-7388
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetFileInfoParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom45", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
7,388
all-7389
[ "GetName", "returns", "the", "Name", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "s", "*", "SyntheticsUser", ")", "GetName", "(", ")", "string", "{", "if", "s", "==", "nil", "||", "s", ".", "Name", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "s", ".", "<mask>", "\n", "}" ]
7,389
all-7390
[ "WriteTo", "implements", "io", ".", "WriterTo", ".", "It", "dumps", "the", "whole", "message", "into", "w", "." ]
[ "func", "(", "m", "*", "Message", ")", "WriteTo", "(", "w", "<mask>", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "mw", ":=", "&", "messageWriter", "{", "w", ":", "w", "}", "\n", "mw", ".", "writeMessage", "(", "m", ")", "\n", "return", "mw", ".", "n", ",", "mw", ".", "err", "\n", "}" ]
7,390
all-7391
[ "GoTemplateValidator", "validates", "the", "file", "is", "a", "valid", "Go", "text", "/", "template", "file", "if", "the", "extension", "is", ".", "tmpl" ]
[ "func", "GoTemplateValidator", "(", "f", "genny", ".", "<mask>", ")", "error", "{", "if", "!", "genny", ".", "HasExt", "(", "f", ",", "\"", "\"", ")", "{", "return", "nil", "\n", "}", "\n", "t", ":=", "template", ".", "New", "(", "f", ".", "Name", "(", ")", ")", "\n", "_", ",", "err", ":=", "t", ".", "Parse", "(", "f", ".", "String", "(", ")", ")", "\n", "return", "err", "\n", "}" ]
7,391
all-7392
[ "List", "default", "implementation", ".", "Returns", "a", "404" ]
[ "func", "(", "v", "BaseResource", ")", "<mask>", "(", "c", "Context", ")", "error", "{", "return", "c", ".", "Error", "(", "404", ",", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}" ]
7,392
all-7393
[ "Success", "outputs", "Success", "level", "log" ]
[ "func", "(", "g", "*", "Glg", ")", "Success", "(", "val", "...", "interface", "{", "}", ")", "error", "{", "return", "g", ".", "<mask>", "(", "OK", ",", "blankFormat", "(", "len", "(", "val", ")", ")", ",", "val", "...", ")", "\n", "}" ]
7,393
all-7394
[ "Try", "to", "abort", "multipart", "upload", ".", "Do", "not", "error", "on", "failure", "." ]
[ "func", "(", "p", "*", "putter", ")", "abort", "(", ")", "{", "v", ":=", "url", ".", "Values", "{", "}", "\n", "v", ".", "Set", "(", "\"", "\"", ",", "p", ".", "UploadID", ")", "\n", "s", ":=", "p", ".", "<mask>", ".", "String", "(", ")", "+", "\"", "\"", "+", "v", ".", "Encode", "(", ")", "\n", "resp", ",", "err", ":=", "p", ".", "retryRequest", "(", "\"", "\"", ",", "s", ",", "nil", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Printf", "(", "\"", "\\n", "\"", ",", "err", ")", "\n", "return", "\n", "}", "\n", "defer", "checkClose", "(", "resp", ".", "Body", ",", "err", ")", "\n", "if", "resp", ".", "StatusCode", "!=", "204", "{", "logger", ".", "Printf", "(", "\"", "\"", ",", "newRespError", "(", "resp", ")", ")", "\n", "}", "\n", "return", "\n", "}" ]
7,394
all-7395
[ "NewPublicKey", "creates", "a", "new", "PublicKey", "." ]
[ "func", "NewPublicKey", "(", "aType", "CryptoKeyType", ",", "value", "interface", "{", "}", ")", "(", "result", "PublicKey", ",", "err", "error", ")", "{", "<mask>", ".", "Type", "=", "aType", "\n", "switch", "CryptoKeyType", "(", "aType", ")", "{", "case", "CryptoKeyTypeKeyTypeEd25519", ":", "tv", ",", "ok", ":=", "value", ".", "(", "Uint256", ")", "\n", "if", "!", "ok", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "result", ".", "Ed25519", "=", "&", "tv", "\n", "}", "\n", "return", "\n", "}" ]
7,395
all-7396
[ "NewTaskHandler", "returns", "a", "pointer", "to", "TaskHandler" ]
[ "func", "NewTaskHandler", "(", "ctx", "context", ".", "Context", ",", "stateManager", "statemanager", ".", "Saver", ",", "state", "dockerstate", ".", "TaskEngineState", ",", "client", "api", ".", "ECSClient", ")", "*", "TaskHandler", "{", "// Create a handler and start the periodic event drain loop", "taskHandler", ":=", "&", "TaskHandler", "{", "ctx", ":", "ctx", ",", "tasksToEvents", ":", "make", "(", "<mask>", "[", "string", "]", "*", "taskSendableEvents", ")", ",", "submitSemaphore", ":", "utils", ".", "NewSemaphore", "(", "concurrentEventCalls", ")", ",", "tasksToContainerStates", ":", "make", "(", "map", "[", "string", "]", "[", "]", "api", ".", "ContainerStateChange", ")", ",", "stateSaver", ":", "stateManager", ",", "state", ":", "state", ",", "client", ":", "client", ",", "minDrainEventsFrequency", ":", "minDrainEventsFrequency", ",", "maxDrainEventsFrequency", ":", "maxDrainEventsFrequency", ",", "}", "\n", "go", "taskHandler", ".", "startDrainEventsTicker", "(", ")", "\n\n", "return", "taskHandler", "\n", "}" ]
7,396
all-7397
[ "NewMapErrorRegistry", "creates", "a", "new", "instance", "of", "MapErrorRegistry", "." ]
[ "func", "NewMapErrorRegistry", "(", "<mask>", "map", "[", "int", "]", "error", ",", "handlers", "map", "[", "int", "]", "func", "(", "body", "[", "]", "byte", ")", "error", ")", "*", "MapErrorRegistry", "{", "if", "errors", "==", "nil", "{", "errors", "=", "map", "[", "int", "]", "error", "{", "}", "\n", "}", "\n", "if", "handlers", "==", "nil", "{", "handlers", "=", "map", "[", "int", "]", "func", "(", "body", "[", "]", "byte", ")", "error", "{", "}", "\n", "}", "\n", "return", "&", "MapErrorRegistry", "{", "errors", ":", "errors", ",", "handlers", ":", "handlers", ",", "}", "\n", "}" ]
7,397
all-7398
[ "InitPath", "returns", "an", "options", "func", "to", "configure", "a", "LinuxFactory", "with", "the", "provided", "absolute", "path", "to", "the", "init", "binary", "and", "arguements", "." ]
[ "func", "InitPath", "(", "<mask>", "string", ",", "args", "...", "string", ")", "func", "(", "*", "LinuxFactory", ")", "error", "{", "return", "func", "(", "l", "*", "LinuxFactory", ")", "error", "{", "l", ".", "InitPath", "=", "path", "\n", "l", ".", "InitArgs", "=", "args", "\n", "return", "nil", "\n", "}", "\n", "}" ]
7,398
all-7399
[ "CurrentCall", "returns", "the", "current", "incoming", "call", "or", "nil", "if", "this", "is", "not", "an", "incoming", "call", "context", "." ]
[ "func", "CurrentCall", "(", "ctx", "context", ".", "<mask>", ")", "IncomingCall", "{", "if", "params", ":=", "getTChannelParams", "(", "ctx", ")", ";", "params", "!=", "nil", "{", "return", "params", ".", "call", "\n", "}", "\n", "return", "nil", "\n", "}" ]
7,399
all-7400
[ "handleSingleMessage", "processes", "a", "single", "payload", "message", ".", "It", "adds", "tasks", "in", "the", "message", "to", "the", "task", "engine", "An", "error", "is", "returned", "if", "the", "message", "was", "not", "handled", "correctly", ".", "The", "error", "is", "being", "used", "only", "for", "testing", "today", ".", "In", "the", "future", "it", "could", "be", "used", "for", "doing", "more", "interesting", "things", "." ]
[ "func", "(", "payloadHandler", "*", "payloadRequestHandler", ")", "handleSingleMessage", "(", "payload", "*", "ecsacs", ".", "PayloadMessage", ")", "error", "{", "if", "aws", ".", "StringValue", "(", "payload", ".", "MessageId", ")", "==", "\"", "\"", "{", "seelog", ".", "Criticalf", "(", "\"", "\"", ")", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "seelog", ".", "Debugf", "(", "\"", "\"", ",", "aws", ".", "StringValue", "(", "payload", ".", "MessageId", ")", ")", "\n", "credentialsAcks", ",", "allTasksHandled", ":=", "payloadHandler", ".", "addPayloadTasks", "(", "payload", ")", "\n", "// save the state of tasks we know about after passing them to the task engine", "err", ":=", "payloadHandler", ".", "saver", ".", "Save", "(", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Errorf", "(", "\"", "\"", ",", "err", ",", "aws", ".", "StringValue", "(", "payload", ".", "MessageId", ")", ")", "\n", "// Don't ack; maybe we can save it in the future.", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "aws", ".", "StringValue", "(", "payload", ".", "MessageId", ")", ")", "\n", "}", "\n", "if", "!", "allTasksHandled", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "go", "func", "(", ")", "{", "// Throw the ack in async; it doesn't really matter all that much and this is blocking handling more tasks.", "for", "_", ",", "credentialsAck", ":=", "<mask>", "credentialsAcks", "{", "payloadHandler", ".", "refreshHandler", ".", "ackMessage", "(", "credentialsAck", ")", "\n", "}", "\n", "payloadHandler", ".", "ackRequest", "<-", "*", "payload", ".", "MessageId", "\n", "}", "(", ")", "\n\n", "return", "nil", "\n", "}" ]