id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
22,200
all-22201
[ "HasMax", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "WidgetAxis", ")", "HasMax", "(", ")", "bool", "{", "if", "w", "!=", "nil", "&&", "w", ".", "Max", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
22,201
all-22202
[ "WithTimeout", "adds", "the", "timeout", "to", "the", "delete", "apps", "app", "routes", "route", "params" ]
[ "func", "(", "o", "*", "DeleteAppsAppRoutesRouteParams", ")", "WithTimeout", "(", "timeout", "<mask>", ".", "Duration", ")", "*", "DeleteAppsAppRoutesRouteParams", "{", "o", ".", "SetTimeout", "(", "timeout", ")", "\n", "return", "o", "\n", "}" ]
22,202
all-22203
[ "WithTargetID", "devtools", "agent", "host", "id", ".", "If", "called", "as", "a", "part", "of", "the", "session", "associated", "targetId", "is", "used", "." ]
[ "func", "(", "p", "GetWindowForTargetParams", ")", "WithTargetID", "(", "targetID", "target", ".", "<mask>", ")", "*", "GetWindowForTargetParams", "{", "p", ".", "TargetID", "=", "targetID", "\n", "return", "&", "p", "\n", "}" ]
22,203
all-22204
[ "Code", "returns", "the", "error", "code", "of", "err", "if", "it", "was", "returned", "by", "one", "of", "the", "HashTree", "methods", "or", "Unknown", "if", "err", "was", "emitted", "by", "some", "other", "function", "(", "error", "codes", "are", "defined", "in", "interface", ".", "go", ")" ]
[ "func", "Code", "(", "err", "error", ")", "ErrCode", "{", "if", "err", "==", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "hte", ",", "ok", ":=", "err", ".", "(", "*", "hashTreeError", ")", "\n", "if", "!", "ok", "{", "return", "Unknown", "\n", "}", "\n", "return", "hte", ".", "code", "\n", "}" ]
22,204
all-22205
[ "GetJobInfo", "retrieves", "Jenkins", "job", "information" ]
[ "func", "(", "c", "*", "Client", ")", "GetJobInfo", "(", "spec", "*", "prowapi", ".", "ProwJobSpec", ")", "(", "*", "JobInfo", ",", "error", ")", "{", "path", ":=", "getJobInfoPath", "(", "spec", ")", "\n", "c", ".", "logger", ".", "Debugf", "(", "\"", "\"", ",", "path", ")", "\n\n", "data", ",", "err", ":=", "c", ".", "Get", "(", "<mask>", ")", "\n\n", "if", "err", "!=", "nil", "{", "c", ".", "logger", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "var", "jobInfo", "JobInfo", "\n\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "&", "jobInfo", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "c", ".", "logger", ".", "Tracef", "(", "\"", "\"", ",", "jobInfo", ")", "\n\n", "return", "&", "jobInfo", ",", "nil", "\n", "}" ]
22,205
all-22206
[ "GetLegendOk", "returns", "a", "tuple", "with", "the", "Legend", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "Widget", ")", "GetLegendOk", "(", ")", "(", "bool", ",", "bool", ")", "{", "if", "w", "==", "nil", "||", "w", ".", "Legend", "==", "nil", "{", "return", "false", ",", "<mask>", "\n", "}", "\n", "return", "*", "w", ".", "Legend", ",", "true", "\n", "}" ]
22,206
all-22207
[ "export", "FileSequence_FrameSet" ]
[ "func", "FileSequence_FrameSet", "(", "id", "FileSeqId", ")", "(", "fsetId", "FrameSetId", ")", "{", "fsetId", "=", "0", "\n", "fs", ",", "ok", ":=", "sFileSeqs", ".", "Get", "(", "id", ")", "\n", "if", "!", "ok", "{", "return", "fsetId", "\n", "}", "\n\n", "fset", ":=", "<mask>", ".", "FrameSet", "(", ")", "\n", "if", "fset", "==", "nil", "{", "return", "0", "\n", "}", "\n\n", "fsetId", "=", "sFrameSets", ".", "Add", "(", "*", "fset", ")", "\n", "return", "fsetId", "\n", "}" ]
22,207
all-22208
[ "flattenVmwareDistributedVirtualSwitchVlanIDSpec", "reads", "various", "fields", "from", "a", "VmwareDistributedVirtualSwitchVlanIdSpec", "into", "the", "passed", "in", "ResourceData", "." ]
[ "func", "flattenVmwareDistributedVirtualSwitchVlanIDSpec", "(", "d", "*", "schema", ".", "ResourceData", ",", "obj", "*", "types", ".", "VmwareDistributedVirtualSwitchVlanIdSpec", ")", "error", "{", "d", ".", "<mask>", "(", "\"", "\"", ",", "obj", ".", "VlanId", ")", "\n", "return", "nil", "\n", "}" ]
22,208
all-22209
[ "ParseCarbonlinkRequest", "from", "pickle", "encoded", "data" ]
[ "func", "ParseCarbonlinkRequest", "(", "d", "[", "]", "byte", ")", "(", "*", "CarbonlinkRequest", ",", "error", ")", "{", "if", "!", "(", "expectBytes", "(", "&", "d", ",", "[", "]", "byte", "(", "\"", "\\x80", "\\x02", "\"", ")", ")", "&&", "pickleMaybeMemo", "(", "&", "d", ")", "&&", "expectBytes", "(", "&", "d", ",", "[", "]", "byte", "(", "\"", "\"", ")", ")", ")", "{", "return", "nil", ",", "badErr", "\n", "}", "\n\n", "req", ":=", "NewCarbonlinkRequest", "(", ")", "\n\n", "var", "Metric", ",", "<mask>", "string", "\n", "var", "ok", "bool", "\n\n", "if", "expectBytes", "(", "&", "d", ",", "[", "]", "byte", "(", "\"", "\\x06", "\"", ")", ")", "{", "if", "!", "pickleMaybeMemo", "(", "&", "d", ")", "{", "return", "nil", ",", "badErr", "\n", "}", "\n", "if", "Metric", ",", "ok", "=", "pickleGetStr", "(", "&", "d", ")", ";", "!", "ok", "{", "return", "nil", ",", "badErr", "\n", "}", "\n\n", "if", "!", "(", "pickleMaybeMemo", "(", "&", "d", ")", "&&", "expectBytes", "(", "&", "d", ",", "[", "]", "byte", "(", "\"", "\\x04", "\"", ")", ")", "&&", "pickleMaybeMemo", "(", "&", "d", ")", ")", "{", "return", "nil", ",", "badErr", "\n", "}", "\n\n", "if", "Type", ",", "ok", "=", "pickleGetStr", "(", "&", "d", ")", ";", "!", "ok", "{", "return", "nil", ",", "badErr", "\n", "}", "\n\n", "if", "!", "pickleMaybeMemo", "(", "&", "d", ")", "{", "return", "nil", ",", "badErr", "\n", "}", "\n\n", "req", ".", "Metric", "=", "Metric", "\n", "req", ".", "Type", "=", "Type", "\n", "}", "else", "if", "expectBytes", "(", "&", "d", ",", "[", "]", "byte", "(", "\"", "\\x04", "\"", ")", ")", "{", "if", "!", "pickleMaybeMemo", "(", "&", "d", ")", "{", "return", "nil", ",", "badErr", "\n", "}", "\n\n", "if", "Type", ",", "ok", "=", "pickleGetStr", "(", "&", "d", ")", ";", "!", "ok", "{", "return", "nil", ",", "badErr", "\n", "}", "\n\n", "if", "!", "(", "pickleMaybeMemo", "(", "&", "d", ")", "&&", "expectBytes", "(", "&", "d", ",", "[", "]", "byte", "(", "\"", "\\x06", "\"", ")", ")", "&&", "pickleMaybeMemo", "(", "&", "d", ")", ")", "{", "return", "nil", ",", "badErr", "\n", "}", "\n\n", "if", "Metric", ",", "ok", "=", "pickleGetStr", "(", "&", "d", ")", ";", "!", "ok", "{", "return", "nil", ",", "badErr", "\n", "}", "\n\n", "if", "!", "pickleMaybeMemo", "(", "&", "d", ")", "{", "return", "nil", ",", "badErr", "\n", "}", "\n\n", "req", ".", "Metric", "=", "Metric", "\n", "req", ".", "Type", "=", "Type", "\n", "}", "else", "{", "return", "nil", ",", "badErr", "\n", "}", "\n\n", "return", "req", ",", "nil", "\n", "}" ]
22,209
all-22210
[ "SnapshotIDsAndNames", "returns", "a", "map", "of", "snapshot", "IDs", "to", "snapshot", "names", "for", "the", "container", "with", "the", "given", "name", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "SnapshotIDsAndNames", "(", "name", "string", ")", "(", "map", "[", "int", "]", "string", ",", "error", ")", "{", "prefix", ":=", "name", "+", "shared", ".", "SnapshotDelimiter", "\n", "length", ":=", "len", "(", "prefix", ")", "\n", "objects", ":=", "make", "(", "[", "]", "struct", "{", "ID", "int", "\n", "Name", "string", "\n", "}", ",", "0", ")", "\n", "dest", ":=", "func", "(", "i", "int", ")", "[", "]", "interface", "{", "}", "{", "objects", "=", "append", "(", "objects", ",", "struct", "{", "ID", "int", "\n", "Name", "string", "\n", "}", "{", "}", ")", "\n", "return", "[", "]", "interface", "{", "}", "{", "&", "objects", "[", "i", "]", ".", "ID", ",", "&", "objects", "[", "i", "]", ".", "Name", "}", "\n", "}", "\n", "stmt", ",", "err", ":=", "c", ".", "tx", ".", "Prepare", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "stmt", ".", "Close", "(", ")", "\n", "err", "=", "query", ".", "SelectObjects", "(", "stmt", ",", "dest", ",", "<mask>", ",", "prefix", ",", "CTypeSnapshot", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "result", ":=", "make", "(", "map", "[", "int", "]", "string", ")", "\n", "for", "i", ":=", "range", "objects", "{", "result", "[", "objects", "[", "i", "]", ".", "ID", "]", "=", "strings", ".", "Split", "(", "objects", "[", "i", "]", ".", "Name", ",", "shared", ".", "SnapshotDelimiter", ")", "[", "1", "]", "\n", "}", "\n", "return", "result", ",", "nil", "\n", "}" ]
22,210
all-22211
[ "clearASMDockerAuthConfig", "cycles", "through", "the", "collection", "of", "docker", "private", "registry", "auth", "data", "and", "removes", "them", "from", "the", "task" ]
[ "func", "(", "auth", "*", "ASMAuthResource", ")", "clearASMDockerAuthConfig", "(", ")", "{", "auth", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "auth", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "for", "k", ":=", "<mask>", "auth", ".", "dockerAuthData", "{", "delete", "(", "auth", ".", "dockerAuthData", ",", "k", ")", "\n", "}", "\n", "}" ]
22,211
all-22212
[ "PeekBack", "returns", "the", "entry", "logicall", "stored", "at", "the", "back", "of", "the", "list", "without", "removing", "it", "." ]
[ "func", "(", "list", "*", "LinkedList", ")", "PeekBack", "(", ")", "(", "interface", "{", "}", ",", "bool", ")", "{", "list", ".", "key", ".", "RLock", "(", ")", "\n", "defer", "list", ".", "key", ".", "RUnlock", "(", ")", "\n\n", "if", "list", ".", "last", "==", "nil", "{", "return", "nil", ",", "false", "\n", "}", "\n", "return", "<mask>", ".", "last", ".", "payload", ",", "true", "\n", "}" ]
22,212
all-22213
[ "GetHash", "retrieves", "the", "Hash", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "Memo", ")", "GetHash", "(", ")", "(", "<mask>", "Hash", ",", "ok", "bool", ")", "{", "armName", ",", "_", ":=", "u", ".", "ArmForSwitch", "(", "int32", "(", "u", ".", "Type", ")", ")", "\n\n", "if", "armName", "==", "\"", "\"", "{", "result", "=", "*", "u", ".", "Hash", "\n", "ok", "=", "true", "\n", "}", "\n\n", "return", "\n", "}" ]
22,213
all-22214
[ "Dump", "returns", "a", "SQL", "text", "dump", "of", "all", "rows", "across", "all", "tables", "similar", "to", "sqlite3", "s", "dump", "feature" ]
[ "func", "Dump", "(", "tx", "*", "sql", ".", "Tx", ",", "schema", "string", ",", "schemaOnly", "bool", ")", "(", "string", ",", "error", ")", "{", "schemas", ":=", "dumpParseSchema", "(", "schema", ")", "\n\n", "// Begin", "dump", ":=", "`PRAGMA foreign_keys=OFF;\nBEGIN TRANSACTION;\n`", "\n", "// Schema table", "tableDump", ",", "err", ":=", "dumpTable", "(", "tx", ",", "\"", "\"", ",", "dumpSchemaTable", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "dump", "+=", "tableDump", "\n\n", "// All other tables", "tables", ":=", "make", "(", "[", "]", "string", ",", "0", ")", "\n", "for", "table", ":=", "range", "schemas", "{", "tables", "=", "append", "(", "tables", ",", "table", ")", "\n", "}", "\n", "sort", ".", "Strings", "(", "tables", ")", "\n", "for", "_", ",", "table", ":=", "range", "tables", "{", "if", "schemaOnly", "{", "// Dump only the schema.", "dump", "+=", "schemas", "[", "table", "]", "+", "\"", "\\n", "\"", "\n", "continue", "\n", "}", "\n", "tableDump", ",", "err", ":=", "dumpTable", "(", "tx", ",", "table", ",", "schemas", "[", "table", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "table", ")", "\n", "}", "\n", "dump", "+=", "tableDump", "\n", "}", "\n\n", "// Sequences (unless the schemaOnly flag is true)", "if", "!", "schemaOnly", "{", "tableDump", ",", "err", "=", "dumpTable", "(", "tx", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "<mask>", "+=", "tableDump", "\n", "}", "\n\n", "// Commit", "dump", "+=", "\"", "\\n", "\"", "\n\n", "return", "dump", ",", "nil", "\n", "}" ]
22,214
all-22215
[ "title", ":", "assign", "role", "to", "user", "path", ":", "/", "roles", "/", "{", "name", "}", "/", "user", "method", ":", "POST", "consume", ":", "application", "/", "x", "-", "www", "-", "form", "-", "urlencoded", "responses", ":", "200", ":", "Ok", "400", ":", "Invalid", "data", "401", ":", "Unauthorized", "404", ":", "Role", "not", "found" ]
[ "func", "assignRole", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "<mask>", ",", "t", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "if", "!", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermRoleUpdateAssign", ")", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "roleName", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "event", ".", "Target", "{", "Type", ":", "event", ".", "TargetTypeRole", ",", "Value", ":", "roleName", "}", ",", "Kind", ":", "permission", ".", "PermRoleUpdateAssign", ",", "Owner", ":", "t", ",", "CustomData", ":", "event", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermRoleReadEvents", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "email", ":=", "InputValue", "(", "r", ",", "\"", "\"", ")", "\n", "contextValue", ":=", "InputValue", "(", "r", ",", "\"", "\"", ")", "\n", "user", ",", "err", ":=", "auth", ".", "GetUserByEmail", "(", "email", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "err", "=", "canUseRole", "(", "t", ",", "roleName", ",", "contextValue", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "err", "=", "runWithPermSync", "(", "[", "]", "auth", ".", "User", "{", "*", "user", "}", ",", "func", "(", ")", "error", "{", "return", "user", ".", "AddRole", "(", "roleName", ",", "contextValue", ")", "\n", "}", ")", "\n", "return", "err", "\n", "}" ]
22,215
all-22216
[ "expandVmwareDistributedVirtualSwitchVlanIDSpec", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "VmwareDistributedVirtualSwitchVlanIdSpec", "." ]
[ "func", "expandVmwareDistributedVirtualSwitchVlanIDSpec", "(", "d", "*", "schema", ".", "ResourceData", ")", "*", "types", ".", "VmwareDistributedVirtualSwitchVlanIdSpec", "{", "obj", ":=", "&", "<mask>", ".", "VmwareDistributedVirtualSwitchVlanIdSpec", "{", "VlanId", ":", "int32", "(", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", ")", ",", "}", "\n", "return", "obj", "\n", "}" ]
22,216
all-22217
[ "AddAttachment", "returns", "a", "copy", "of", "MailBuilder", "that", "includes", "the", "specified", "attachment", "." ]
[ "func", "(", "p", "MailBuilder", ")", "AddAttachment", "(", "b", "[", "]", "byte", ",", "contentType", "string", ",", "fileName", "string", ")", "MailBuilder", "{", "part", ":=", "NewPart", "(", "contentType", ")", "\n", "part", ".", "Content", "=", "b", "\n", "part", ".", "FileName", "=", "fileName", "\n", "part", ".", "Disposition", "=", "cdAttachment", "\n", "p", ".", "attachments", "=", "<mask>", "(", "p", ".", "attachments", ",", "part", ")", "\n", "return", "p", "\n", "}" ]
22,217
all-22218
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "TakeResponseBodyForInterceptionAsStreamParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork4", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
22,218
all-22219
[ "DiscoverPollEndpoint", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockECSSDK", ")", "DiscoverPollEndpoint", "(", "arg0", "*", "ecs", ".", "DiscoverPollEndpointInput", ")", "(", "*", "ecs", ".", "DiscoverPollEndpointOutput", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "<mask>", "[", "0", "]", ".", "(", "*", "ecs", ".", "DiscoverPollEndpointOutput", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
22,219
all-22220
[ "DeepCopy", "copies", "the", "receiver", "into", "a", "new", "SSN", "." ]
[ "func", "(", "u", "*", "SSN", ")", "DeepCopy", "(", ")", "*", "SSN", "{", "if", "u", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "new", "(", "SSN", ")", "\n", "u", ".", "DeepCopyInto", "(", "<mask>", ")", "\n", "return", "out", "\n", "}" ]
22,220
all-22221
[ "SetValue", "()", "is", "a", "wrapper", "around", "gtk_level_bar_set_value", "()", "." ]
[ "func", "(", "v", "*", "LevelBar", ")", "SetValue", "(", "value", "float64", ")", "{", "C", ".", "gtk_level_bar_set_value", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gdouble", "(", "<mask>", ")", ")", "\n", "}" ]
22,221
all-22222
[ "entriesForFile", "returns", "a", "set", "of", "users", "who", "are", "assignees", "to", "the", "requested", "file", ".", "The", "path", "variable", "should", "be", "a", "full", "path", "to", "a", "filename", "and", "not", "directory", "as", "the", "final", "directory", "will", "be", "discounted", "if", "enableMDYAML", "is", "true", "leafOnly", "indicates", "whether", "only", "the", "OWNERS", "deepest", "in", "the", "tree", "(", "closest", "to", "the", "file", ")", "should", "be", "returned", "or", "if", "all", "OWNERS", "in", "filepath", "should", "be", "returned" ]
[ "func", "(", "o", "*", "RepoOwners", ")", "entriesForFile", "(", "path", "string", ",", "people", "map", "[", "string", "]", "map", "[", "*", "regexp", ".", "Regexp", "]", "sets", ".", "String", ",", "leafOnly", "bool", ")", "sets", ".", "String", "{", "d", ":=", "path", "\n", "if", "!", "o", ".", "enableMDYAML", "||", "!", "strings", ".", "HasSuffix", "(", "path", ",", "\"", "\"", ")", "{", "// if path is a directory, this will remove the leaf directory, and returns \".\" for topmost dir", "d", "=", "filepath", ".", "Dir", "(", "d", ")", "\n", "d", "=", "canonicalize", "(", "path", ")", "\n", "}", "\n\n", "out", ":=", "sets", ".", "NewString", "(", ")", "\n", "for", "{", "relative", ",", "err", ":=", "filepath", ".", "Rel", "(", "d", ",", "path", ")", "\n", "if", "err", "!=", "nil", "{", "o", ".", "log", ".", "WithError", "(", "err", ")", ".", "WithField", "(", "\"", "\"", ",", "path", ")", ".", "Errorf", "(", "\"", "\"", ",", "d", ")", "\n", "return", "nil", "\n", "}", "\n", "for", "re", ",", "s", ":=", "range", "people", "[", "d", "]", "{", "if", "re", "==", "nil", "||", "<mask>", ".", "MatchString", "(", "relative", ")", "{", "out", ".", "Insert", "(", "s", ".", "List", "(", ")", "...", ")", "\n", "}", "\n", "}", "\n", "if", "leafOnly", "&&", "out", ".", "Len", "(", ")", ">", "0", "{", "break", "\n", "}", "\n", "if", "d", "==", "baseDirConvention", "{", "break", "\n", "}", "\n", "if", "o", ".", "options", "[", "d", "]", ".", "NoParentOwners", "{", "break", "\n", "}", "\n", "d", "=", "filepath", ".", "Dir", "(", "d", ")", "\n", "d", "=", "canonicalize", "(", "d", ")", "\n", "}", "\n", "return", "out", "\n", "}" ]
22,222
all-22223
[ "VerifySuspendedChannelsAndTryToUnsuspend", "scans", "all", "supsended", "channels", "and", "checks", "if", "all", "conditions", "are", "met", "to", "unsuspend", "them", ".", "Is", "so", "-", "schedules", "task", "for", "appropriate", "channel", "unsuspending", "." ]
[ "func", "(", "m", "*", "Monitor", ")", "VerifySuspendedChannelsAndTryToUnsuspend", "(", ")", "error", "{", "// All channels, that are suspended,", "// but now seems to be payed - must be unsuspended.", "<mask>", ":=", "`\n SELECT channels.id :: text\n\t\tFROM channels\n LEFT JOIN sessions ses\n ON channels.id = ses.channel\n\n LEFT JOIN offerings offer\n ON channels.offering = offer.id\n\n INNER JOIN accounts acc\n ON channels.agent = acc.eth_addr\n WHERE channels.service_status IN ('suspended')\n AND channels.channel_status NOT IN ('pending')\n AND acc.in_use\n GROUP BY channels.id, offer.billing_interval,\n offer.setup_price, offer.unit_price,\n offer.max_billing_unit_lag\n HAVING COALESCE(SUM(ses.units_used), 0) /\n\t offer.billing_interval - (channels.receipt_balance - offer.setup_price) /\n\t offer.unit_price <= offer.max_billing_unit_lag;`", "\n\n", "return", "m", ".", "processEachChannel", "(", "query", ",", "m", ".", "unsuspendService", ")", "\n", "}" ]
22,223
all-22224
[ "AddAction", "is", "a", "wrapper", "around", "g_action_map_add_action" ]
[ "func", "(", "v", "*", "ActionMap", ")", "AddAction", "(", "<mask>", "IAction", ")", "{", "C", ".", "g_action_map_add_action", "(", "v", ".", "native", "(", ")", ",", "action", ".", "toGAction", "(", ")", ")", "\n", "}" ]
22,224
all-22225
[ "NewAllowTrustResult", "creates", "a", "new", "AllowTrustResult", "." ]
[ "func", "NewAllowTrustResult", "(", "code", "AllowTrustResultCode", ",", "value", "interface", "{", "}", ")", "(", "result", "AllowTrustResult", ",", "err", "error", ")", "{", "result", ".", "Code", "=", "<mask>", "\n", "switch", "AllowTrustResultCode", "(", "code", ")", "{", "case", "AllowTrustResultCodeAllowTrustSuccess", ":", "// void", "default", ":", "// void", "}", "\n", "return", "\n", "}" ]
22,225
all-22226
[ "Text", "sets", "the", "next", "sort", "key", "to", "sort", "by", "column", "n", "in", "lexicographic", "order", ".", "Column", "0", "means", "the", "entire", "string", ".", "Items", "that", "do", "not", "have", "column", "n", "sort", "to", "the", "front", "." ]
[ "func", "(", "s", "*", "SortFilter", ")", "Text", "(", "n", "int", ")", "*", "SortFilter", "{", "s", ".", "add", "(", "func", "(", "a", ",", "b", "string", ")", "int", "{", "a1", ",", "a2", ":=", "column", "(", "a", ",", "n", ")", "\n", "b1", ",", "b2", ":=", "column", "(", "b", ",", "n", ")", "\n", "switch", "{", "case", "a1", "<", "b1", ":", "return", "-", "1", "\n", "<mask>", "a1", ">", "b1", ":", "return", "+", "1", "\n", "case", "a2", "<", "b2", ":", "return", "-", "1", "\n", "case", "a2", ">", "b2", ":", "return", "+", "1", "\n", "}", "\n", "return", "0", "\n", "}", ")", "\n", "return", "s", "\n", "}" ]
22,226
all-22227
[ "cacheConsoleInfo", "ensures", "that", "the", "current", "console", "screen", "information", "has", "been", "queried", "since", "the", "last", "call", "to", "Flush", "()", ".", "It", "must", "be", "called", "before", "accessing", "h", ".", "curInfo", "or", "h", ".", "curPos", "." ]
[ "func", "(", "h", "*", "windowsAnsiEventHandler", ")", "getCurrentInfo", "(", ")", "(", "COORD", ",", "*", "CONSOLE_SCREEN_BUFFER_INFO", ",", "error", ")", "{", "if", "h", ".", "curInfo", "==", "nil", "{", "<mask>", ",", "err", ":=", "GetConsoleScreenBufferInfo", "(", "h", ".", "fd", ")", "\n", "if", "err", "!=", "nil", "{", "return", "COORD", "{", "}", ",", "nil", ",", "err", "\n", "}", "\n", "h", ".", "curInfo", "=", "info", "\n", "h", ".", "curPos", "=", "info", ".", "CursorPosition", "\n", "}", "\n", "return", "h", ".", "curPos", ",", "h", ".", "curInfo", ",", "nil", "\n", "}" ]
22,227
all-22228
[ "GetLogTail", "returns", "the", "last", "n", "bytes", "of", "the", "log", "of", "the", "specified", "container", "in", "the", "specified", "pod", "in", "the", "client", "s", "specified", "namespace", ".", "Analogous", "to", "kubectl", "logs", "pod", "--", "tail", "-", "1", "--", "limit", "-", "bytes", "n", "-", "c", "container", "--", "namespace", "=", "client", ".", "namespace" ]
[ "func", "(", "c", "*", "<mask>", ")", "GetLogTail", "(", "pod", ",", "container", "string", ",", "n", "int64", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "c", ".", "log", "(", "\"", "\"", ",", "pod", ",", "n", ")", "\n", "return", "c", ".", "requestRetry", "(", "&", "request", "{", "path", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "namespace", ",", "pod", ")", ",", "query", ":", "map", "[", "string", "]", "string", "{", "// Because we want last n bytes, we fetch all lines and then limit to n bytes", "\"", "\"", ":", "\"", "\"", ",", "\"", "\"", ":", "container", ",", "\"", "\"", ":", "strconv", ".", "FormatInt", "(", "n", ",", "10", ")", ",", "}", ",", "}", ")", "\n", "}" ]
22,228
all-22229
[ "allowMethod", "verifies", "that", "the", "given", "method", "is", "one", "of", "the", "allowed", "methods", "and", "if", "not", "it", "writes", "an", "error", "to", "w", ".", "A", "boolean", "is", "returned", "indicating", "whether", "or", "not", "the", "method", "is", "allowed", "." ]
[ "func", "allowMethod", "(", "w", "http", ".", "ResponseWriter", ",", "m", "string", ",", "ms", "...", "string", ")", "bool", "{", "for", "_", ",", "meth", ":=", "range", "ms", "{", "if", "m", "==", "meth", "{", "return", "<mask>", "\n", "}", "\n", "}", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "ms", ",", "\"", "\"", ")", ")", "\n", "http", ".", "Error", "(", "w", ",", "\"", "\"", ",", "http", ".", "StatusMethodNotAllowed", ")", "\n", "return", "false", "\n", "}" ]
22,229
all-22230
[ "Body", "returns", "request", "body", ".", "The", "returned", "body", "is", "valid", "until", "the", "request", "modification", "." ]
[ "func", "(", "req", "*", "Request", ")", "Body", "(", ")", "[", "]", "<mask>", "{", "if", "req", ".", "bodyStream", "!=", "nil", "{", "bodyBuf", ":=", "req", ".", "bodyBuffer", "(", ")", "\n", "bodyBuf", ".", "Reset", "(", ")", "\n", "_", ",", "err", ":=", "copyZeroAlloc", "(", "bodyBuf", ",", "req", ".", "bodyStream", ")", "\n", "req", ".", "closeBodyStream", "(", ")", "\n", "if", "err", "!=", "nil", "{", "bodyBuf", ".", "SetString", "(", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "}", "else", "if", "req", ".", "onlyMultipartForm", "(", ")", "{", "body", ",", "err", ":=", "marshalMultipartForm", "(", "req", ".", "multipartForm", ",", "req", ".", "multipartFormBoundary", ")", "\n", "if", "err", "!=", "nil", "{", "return", "[", "]", "byte", "(", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "return", "body", "\n", "}", "\n", "return", "req", ".", "bodyBytes", "(", ")", "\n", "}" ]
22,230
all-22231
[ "New", "creates", "a", "new", "Registry", "with", "a", "flushInterval", "at", "which", "metrics", "are", "reported", "to", "the", "subscribed", "Reporter", "instances", "a", "custom", "prefix", "which", "is", "prepended", "to", "every", "metric", "name", "and", "default", "tags", ".", "Default", ":", "60s", "You", "should", "call", "/", "defer", "Close", "()", "on", "exit", "to", "flush", "all", "accummulated", "data", "and", "release", "all", "resources", "." ]
[ "func", "New", "(", "flushInterval", "time", ".", "Duration", ",", "prefix", "string", ",", "tags", "...", "string", ")", "*", "Registry", "{", "if", "flushInterval", "<", "time", ".", "Second", "{", "flushInterval", "=", "30", "*", "time", ".", "Second", "\n", "}", "\n\n", "r", ":=", "&", "Registry", "{", "Logger", ":", "log", ".", "New", "(", "os", ".", "Stderr", ",", "\"", "\"", ",", "log", ".", "LstdFlags", ")", ",", "instruments", ":", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", ",", "prefix", ":", "prefix", ",", "<mask>", ":", "tags", ",", "closing", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "closed", ":", "make", "(", "chan", "error", ",", "1", ")", ",", "}", "\n", "go", "r", ".", "loop", "(", "flushInterval", ")", "\n", "return", "r", "\n", "}" ]
22,231
all-22232
[ "Subscribe", "registers", "the", "channel", "for", "messages", "on", "config", "reload", ".", "The", "caller", "can", "expect", "a", "copy", "of", "the", "previous", "and", "current", "config", "to", "be", "sent", "down", "the", "subscribed", "channel", "when", "a", "new", "configuration", "is", "loaded", "." ]
[ "func", "(", "ca", "*", "Agent", ")", "Subscribe", "(", "subscription", "DeltaChan", ")", "{", "<mask>", ".", "mut", ".", "Lock", "(", ")", "\n", "defer", "ca", ".", "mut", ".", "Unlock", "(", ")", "\n", "ca", ".", "subscriptions", "=", "append", "(", "ca", ".", "subscriptions", ",", "subscription", ")", "\n", "}" ]
22,232
all-22233
[ "Init", "initalizes", "ElasticSearch", "for", "use", "with", "malice" ]
[ "func", "(", "db", "*", "Database", ")", "Init", "(", ")", "error", "{", "// Create URL from host/port", "db", ".", "getURL", "(", ")", "\n\n", "// Test connection to ElasticSearch", "err", ":=", "db", ".", "TestConnection", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "client", ",", "err", ":=", "elastic", ".", "NewSimpleClient", "(", "elastic", ".", "SetURL", "(", "db", ".", "URL", ")", ",", "elastic", ".", "SetBasicAuth", "(", "utils", ".", "Getopts", "(", "db", ".", "Username", ",", "\"", "\"", ",", "\"", "\"", ")", ",", "utils", ".", "Getopts", "(", "db", ".", "Password", ",", "\"", "\"", ",", "\"", "\"", ")", ",", ")", ",", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "exists", ",", "err", ":=", "client", ".", "IndexExists", "(", "db", ".", "Index", ")", ".", "Do", "(", "context", ".", "Background", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "!", "exists", "{", "// Index does not exist yet.", "createIndex", ",", "err", ":=", "client", ".", "CreateIndex", "(", "db", ".", "Index", ")", ".", "BodyString", "(", "mapping", ")", ".", "Do", "(", "context", ".", "Background", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "db", ".", "Index", ")", "\n", "}", "\n\n", "if", "!", "createIndex", ".", "Acknowledged", "{", "log", ".", "Error", "(", "\"", "\"", ")", "\n", "}", "else", "{", "log", ".", "Debugf", "(", "\"", "\"", ",", "db", ".", "Index", ")", "\n", "}", "\n", "}", "else", "{", "log", ".", "Debugf", "(", "\"", "\"", ",", "<mask>", ".", "Index", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
22,233
all-22234
[ "Returns", "the", "location", "of", "a", "uniform", "variable" ]
[ "func", "GetUniformLocation", "(", "program", "uint32", ",", "name", "*", "uint8", ")", "int32", "{", "ret", ",", "_", ",", "_", ":=", "syscall", ".", "Syscall", "(", "gpGetUniformLocation", ",", "2", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "name", ")", ")", ",", "0", ")", "\n", "return", "(", "int32", ")", "(", "ret", ")", "\n", "}" ]
22,234
all-22235
[ "New", "initializes", "a", "new", "instance", "of", "Server", "." ]
[ "func", "New", "(", "root", ",", "dir", "string", ",", "<mask>", "*", "Options", ")", "*", "Server", "{", "if", "options", "==", "nil", "{", "options", "=", "&", "Options", "{", "}", "\n", "}", "\n", "return", "&", "Server", "{", "Options", ":", "*", "options", ",", "root", ":", "root", ",", "dir", ":", "dir", ",", "hashes", ":", "map", "[", "string", "]", "string", "{", "}", ",", "mu", ":", "&", "sync", ".", "RWMutex", "{", "}", ",", "}", "\n", "}" ]
22,235
all-22236
[ "readFull", "reads", "len", "(", "p", ")", "bytes", "into", "p", ".", "If", "fewer", "bytes", "are", "read", "an", "error", "is", "returned", "." ]
[ "func", "(", "r", "*", "rarBitReader", ")", "readFull", "(", "p", "[", "]", "<mask>", ")", "error", "{", "for", "i", ":=", "range", "p", "{", "c", ",", "err", ":=", "r", ".", "ReadByte", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "p", "[", "i", "]", "=", "c", "\n", "}", "\n", "return", "nil", "\n", "}" ]
22,236
all-22237
[ "AuthHandler", "is", "a", "HTTP", "request", "middleware", "that", "enforces", "authentication", "." ]
[ "func", "(", "self", "HttpBasicAuthenticator", ")", "AuthHandler", "(", "next", "<mask>", ".", "Handler", ")", "http", ".", "Handler", "{", "if", "self", ".", "HttpAuthenticable", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "f", ":=", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "user", ",", "secret", ":=", "self", ".", "parseAuthHeader", "(", "r", ".", "Header", ".", "Get", "(", "\"", "\"", ")", ")", "\n", "if", "len", "(", "user", ")", ">", "0", "&&", "len", "(", "secret", ")", ">", "0", "&&", "self", ".", "TryAuthentication", "(", "r", ",", "user", ",", "secret", ")", "{", "next", ".", "ServeHTTP", "(", "w", ",", "r", ")", "\n", "return", "\n", "}", "\n\n", "HttpHeader_WwwAuthenticate", "(", ")", ".", "SetValue", "(", "BASIC_REALM", ")", ".", "SetWriter", "(", "w", ".", "Header", "(", ")", ")", "\n", "http", ".", "Error", "(", "w", ",", "http", ".", "StatusText", "(", "http", ".", "StatusUnauthorized", ")", ",", "http", ".", "StatusUnauthorized", ")", "\n", "}", "\n\n", "return", "http", ".", "HandlerFunc", "(", "f", ")", "\n", "}" ]
22,237
all-22238
[ "PrintRunPageSetupDialogAsync", "()", "is", "a", "wrapper", "around", "gtk_print_run_page_setup_dialog_async", "()", "." ]
[ "func", "PrintRunPageSetupDialogAsync", "(", "parent", "*", "Window", ",", "setup", "*", "PageSetup", ",", "settings", "*", "PrintSettings", ",", "cb", "PageSetupDoneCallback", ",", "data", "uintptr", ")", "{", "pageSetupDoneCallbackRegistry", ".", "Lock", "(", ")", "\n", "id", ":=", "pageSetupDoneCallbackRegistry", ".", "next", "\n", "pageSetupDoneCallbackRegistry", ".", "next", "++", "\n", "pageSetupDoneCallbackRegistry", ".", "m", "[", "id", "]", "=", "pageSetupDoneCallbackData", "{", "fn", ":", "cb", ",", "data", ":", "data", "}", "\n", "pageSetupDoneCallbackRegistry", ".", "Unlock", "(", ")", "\n\n", "C", ".", "_gtk_print_run_page_setup_dialog_async", "(", "parent", ".", "native", "(", ")", ",", "setup", ".", "native", "(", ")", ",", "<mask>", ".", "native", "(", ")", ",", "C", ".", "gpointer", "(", "uintptr", "(", "id", ")", ")", ")", "\n", "}" ]
22,238
all-22239
[ "Email", "returns", "the", "alias", "email", "on", "the", "primary", "domain", "name" ]
[ "func", "(", "a", "Alias", ")", "Email", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "a", ".", "Name", ",", "a", ".", "account", ".", "Domain", ".", "<mask>", ")", "\n", "}" ]
22,239
all-22240
[ "Images", "retrieves", "a", "list", "of", "all", "images" ]
[ "func", "(", "c", "*", "<mask>", ")", "Images", "(", ")", "(", "[", "]", "Image", ",", "error", ")", "{", "var", "images", "[", "]", "Image", "\n", "_", ",", "err", ":=", "c", ".", "MakeApiRequest", "(", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "&", "images", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "images", ",", "err", "\n", "}" ]
22,240
all-22241
[ "retrieve", "retrives", "the", "mac", "address", "of", "a", "network", "device", ".", "If", "the", "retrieved", "mac", "address", "is", "empty", "it", "retries", "the", "operation", "with", "a", "timeout", "specified", "by", "the", "caller" ]
[ "func", "(", "retriever", "*", "macAddressRetriever", ")", "retrieve", "(", ")", "(", "string", ",", "error", ")", "{", "backoff", ":=", "retry", ".", "NewExponentialBackoff", "(", "macAddressBackoffMin", ",", "macAddressBackoffMax", ",", "macAddressBackoffJitter", ",", "macAddressBackoffMultiple", ")", "\n", "ctx", ",", "cancel", ":=", "<mask>", ".", "WithTimeout", "(", "retriever", ".", "ctx", ",", "retriever", ".", "timeout", ")", "\n", "defer", "cancel", "(", ")", "\n\n", "err", ":=", "retry", ".", "RetryWithBackoffCtx", "(", "ctx", ",", "backoff", ",", "func", "(", ")", "error", "{", "retErr", ":=", "retriever", ".", "retrieveOnce", "(", ")", "\n", "if", "retErr", "!=", "nil", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "retriever", ".", "dev", ",", "retErr", ")", "\n", "return", "retErr", "\n", "}", "\n\n", "if", "retriever", ".", "macAddress", "==", "\"", "\"", "{", "seelog", ".", "Debugf", "(", "\"", "\"", ",", "retriever", ".", "dev", ")", "\n", "// Return a retriable error when mac address is empty. If the error", "// is not wrapped with the RetriableError interface, RetryWithBackoffCtx", "// treats them as retriable by default", "return", "errors", ".", "Errorf", "(", "\"", "\"", ",", "retriever", ".", "dev", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "// RetryWithBackoffCtx returns nil when the context is cancelled. Check if there was", "// a timeout here. TODO: Fix RetryWithBackoffCtx to return ctx.Err() on context Done()", "if", "err", "=", "ctx", ".", "Err", "(", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "retriever", ".", "dev", ")", "\n", "}", "\n\n", "return", "retriever", ".", "macAddress", ",", "nil", "\n", "}" ]
22,241
all-22242
[ "UnmarshalJSON", "decodes", "the", "container", "type", "field", "in", "the", "JSON", "encoded", "string", "into", "the", "ContainerType", "object" ]
[ "func", "(", "containerType", "*", "ContainerType", ")", "UnmarshalJSON", "(", "b", "[", "]", "byte", ")", "error", "{", "strType", ":=", "string", "(", "b", ")", "\n\n", "switch", "strType", "{", "case", "\"", "\"", ":", "*", "containerType", "=", "ContainerNormal", "\n", "seelog", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "nil", "\n", "// 'true' or 'false' for compatibility with state version <= 5", "case", "\"", "\"", ":", "*", "containerType", "=", "ContainerEmptyHostVolume", "\n", "return", "nil", "\n", "<mask>", "\"", "\"", ":", "*", "containerType", "=", "ContainerNormal", "\n", "return", "nil", "\n", "}", "\n\n", "if", "len", "(", "strType", ")", "<", "2", "{", "*", "containerType", "=", "ContainerNormal", "\n", "return", "errors", ".", "New", "(", "\"", "\"", "+", "string", "(", "b", ")", ")", "\n", "}", "\n", "if", "b", "[", "0", "]", "!=", "'\"'", "||", "b", "[", "len", "(", "b", ")", "-", "1", "]", "!=", "'\"'", "{", "*", "containerType", "=", "ContainerNormal", "\n", "return", "errors", ".", "New", "(", "\"", "\"", "+", "string", "(", "b", ")", ")", "\n", "}", "\n", "strType", "=", "string", "(", "b", "[", "1", ":", "len", "(", "b", ")", "-", "1", "]", ")", "\n\n", "contType", ",", "ok", ":=", "stringToContainerType", "[", "strType", "]", "\n", "if", "!", "ok", "{", "*", "containerType", "=", "ContainerNormal", "\n", "return", "errors", ".", "New", "(", "\"", "\"", "+", "strType", ")", "\n", "}", "\n", "*", "containerType", "=", "contType", "\n", "return", "nil", "\n", "}" ]
22,242
all-22243
[ "DeepCopy", "copies", "the", "receiver", "into", "a", "new", "UUID5", "." ]
[ "func", "(", "u", "*", "UUID5", ")", "DeepCopy", "(", ")", "*", "UUID5", "{", "if", "u", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "new", "(", "UUID5", ")", "\n", "u", ".", "DeepCopyInto", "(", "out", ")", "\n", "return", "<mask>", "\n", "}" ]
22,243
all-22244
[ "Returns", "an", "encoder", "where", "the", "line", "-", "endings", "of", "the", "resulting", "stream", "is", "not", "the", "standard", "value", "(", "CRLF", ")", "Standard", "requires", "CRLF", "line", "endings", "but", "there", "are", "some", "variants", "out", "there", "(", "like", "Maildir", ")", "which", "requires", "LF", "line", "endings", "." ]
[ "func", "NewEncoderWithEOL", "(", "eol", "string", ",", "enc", "*", "Encoding", ",", "w", "<mask>", ".", "Writer", ")", "io", ".", "WriteCloser", "{", "return", "&", "encoder", "{", "eol", ":", "eol", ",", "enc", ":", "enc", ",", "w", ":", "w", "}", "\n", "}" ]
22,244
all-22245
[ "Screenshot", "captures", "the", "screen", "of", "the", "guest", "operating", "system", ".", "Remarks", ":", "*", "This", "function", "captures", "the", "current", "screen", "image", "and", "returns", "it", "as", "a", "[]", "byte", "result", ".", "*", "For", "security", "reasons", "this", "function", "requires", "a", "successful", "call", "to", "VM", ".", "LoginInGuest", "()", "must", "be", "made", ".", "Since", "VMware", "Workstation", "6", ".", "5", "Minimum", "Supported", "Guest", "OS", ":", "Microsoft", "Windows", "NT", "Series", "Linux" ]
[ "func", "(", "v", "*", "VM", ")", "Screenshot", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "jobHandle", "C", ".", "VixHandle", "=", "C", ".", "VIX_INVALID_HANDLE", "\n", "var", "err", "C", ".", "VixError", "=", "C", ".", "VIX_OK", "\n", "<mask>", "byteCount", "C", ".", "int", "\n", "var", "screenBits", "C", ".", "char", "\n\n", "jobHandle", "=", "C", ".", "VixVM_CaptureScreenImage", "(", "v", ".", "handle", ",", "C", ".", "VIX_CAPTURESCREENFORMAT_PNG", ",", "C", ".", "VIX_INVALID_HANDLE", ",", "nil", ",", "nil", ")", "\n", "defer", "C", ".", "Vix_ReleaseHandle", "(", "jobHandle", ")", "\n\n", "err", "=", "C", ".", "get_screenshot_bytes", "(", "jobHandle", ",", "&", "byteCount", ",", "&", "screenBits", ")", "\n", "defer", "C", ".", "Vix_FreeBuffer", "(", "unsafe", ".", "Pointer", "(", "&", "screenBits", ")", ")", "\n\n", "if", "C", ".", "VIX_OK", "!=", "err", "{", "return", "nil", ",", "&", "Error", "{", "Operation", ":", "\"", "\"", ",", "Code", ":", "int", "(", "err", "&", "0xFFFF", ")", ",", "Text", ":", "C", ".", "GoString", "(", "C", ".", "Vix_GetErrorText", "(", "err", ",", "nil", ")", ")", ",", "}", "\n", "}", "\n\n", "return", "C", ".", "GoBytes", "(", "unsafe", ".", "Pointer", "(", "&", "screenBits", ")", ",", "byteCount", ")", ",", "nil", "\n", "}" ]
22,245
all-22246
[ "Next", "asks", "for", "the", "next", "page", "of", "resources", "and", "decodes", "the", "results", "into", "v", "." ]
[ "func", "(", "p", "*", "PageIterator", ")", "Next", "(", "ctx", "context", ".", "Context", ",", "v", "interface", "{", "}", ")", "error", "{", "var", "err", "error", "\n", "switch", "{", "case", "p", ".", "nextPageURI", ".", "Valid", ":", "err", "=", "p", ".", "client", ".", "GetNextPage", "(", "ctx", ",", "p", ".", "nextPageURI", ".", "String", ",", "v", ")", "\n", "<mask>", "p", ".", "count", "==", "0", ":", "err", "=", "p", ".", "client", ".", "ListResource", "(", "ctx", ",", "p", ".", "pathPart", ",", "p", ".", "data", ",", "v", ")", "\n", "default", ":", "return", "NoMoreResults", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "p", ".", "count", "++", "\n", "return", "nil", "\n", "}" ]
22,246
all-22247
[ "Save", "saves", "the", "static", "state", "of", "the", "store", "system", ".", "It", "will", "not", "be", "able", "to", "save", "the", "state", "of", "watchers", ".", "It", "will", "not", "save", "the", "parent", "field", "of", "the", "node", ".", "Or", "there", "will", "be", "cyclic", "dependencies", "issue", "for", "the", "json", "package", "." ]
[ "func", "(", "s", "*", "<mask>", ")", "Save", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "b", ",", "err", ":=", "json", ".", "Marshal", "(", "s", ".", "Clone", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "b", ",", "nil", "\n", "}" ]
22,247
all-22248
[ "PackStart", "is", "a", "wrapper", "around", "gtk_header_bar_pack_start", "()", "." ]
[ "func", "(", "v", "*", "HeaderBar", ")", "PackStart", "(", "<mask>", "IWidget", ")", "{", "C", ".", "gtk_header_bar_pack_start", "(", "v", ".", "native", "(", ")", ",", "child", ".", "toWidget", "(", ")", ")", "\n", "}" ]
22,248
all-22249
[ "RespondError", "sends", "a", "response", "with", "a", "given", "error", "." ]
[ "func", "(", "s", "*", "Server", ")", "RespondError", "(", "logger", "log", ".", "Logger", ",", "w", "http", ".", "ResponseWriter", ",", "err", "*", "Error", ")", "{", "s", ".", "respond", "(", "logger", ",", "w", ",", "&", "<mask>", "{", "Error", ":", "err", "}", ")", "\n", "}" ]
22,249
all-22250
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "ServiceName", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "ServiceName", "(", "in", ".", "String", "(", ")", ")", "{", "case", "ServiceNameBackgroundFetch", ":", "*", "t", "=", "ServiceNameBackgroundFetch", "\n", "<mask>", "ServiceNameBackgroundSync", ":", "*", "t", "=", "ServiceNameBackgroundSync", "\n\n", "default", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
22,250
all-22251
[ "Go", "1", ".", "8", "compatible", "GOPATH", "." ]
[ "func", "getGoPath", "(", ")", "string", "{", "path", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "if", "path", "==", "\"", "\"", "{", "user", ",", "err", ":=", "user", ".", "Current", "(", ")", "\n", "kingpin", ".", "FatalIfError", "(", "err", ",", "\"", "\"", ")", "\n", "path", "=", "filepath", ".", "Join", "(", "user", ".", "HomeDir", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "<mask>", "\n", "}" ]
22,251
all-22252
[ "Do", "executes", "Runtime", ".", "queryObjects", "against", "the", "provided", "context", ".", "returns", ":", "objects", "-", "Array", "with", "objects", "." ]
[ "func", "(", "p", "*", "QueryObjectsParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "objects", "*", "RemoteObject", ",", "err", "error", ")", "{", "// execute", "<mask>", "res", "QueryObjectsReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandQueryObjects", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "Objects", ",", "nil", "\n", "}" ]
22,252
all-22253
[ "MustAccountMergeResult", "retrieves", "the", "AccountMergeResult", "value", "from", "the", "union", "panicing", "if", "the", "value", "is", "not", "set", "." ]
[ "func", "(", "u", "OperationResultTr", ")", "MustAccountMergeResult", "(", ")", "AccountMergeResult", "{", "val", ",", "<mask>", ":=", "u", ".", "GetAccountMergeResult", "(", ")", "\n\n", "if", "!", "ok", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "val", "\n", "}" ]
22,253
all-22254
[ "CreateTemplate", "creates", "template", "." ]
[ "func", "(", "h", "*", "Handler", ")", "CreateTemplate", "(", "tkn", "string", ",", "template", "*", "data", ".", "<mask>", ")", "(", "*", "string", ",", "error", ")", "{", "logger", ":=", "h", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "template", ")", "\n\n", "if", "!", "h", ".", "token", ".", "Check", "(", "tkn", ")", "{", "logger", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "nil", ",", "ErrAccessDenied", "\n", "}", "\n\n", "err", ":=", "checkTemplate", "(", "logger", ",", "template", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "template", ".", "ID", "=", "util", ".", "NewUUID", "(", ")", "\n", "template", ".", "Hash", "=", "data", ".", "HexFromBytes", "(", "crypto", ".", "Keccak256", "(", "template", ".", "Raw", ")", ")", "\n\n", "err", "=", "h", ".", "insertObject", "(", "template", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "template", ".", "ID", ",", "nil", "\n", "}" ]
22,254
all-22255
[ "configureInstance", "configures", "an", "existing", "instance", "for", "use", "with", "Docker", "Machine", "." ]
[ "func", "(", "c", "*", "ComputeUtil", ")", "configureInstance", "(", "d", "*", "Driver", ")", "error", "{", "<mask>", ".", "Infof", "(", "\"", "\"", ")", "\n\n", "instance", ",", "err", ":=", "c", ".", "instance", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "err", ":=", "c", ".", "addFirewallTag", "(", "instance", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "c", ".", "uploadSSHKey", "(", "instance", ",", "d", ".", "GetSSHKeyPath", "(", ")", ")", "\n", "}" ]
22,255
all-22256
[ "ListPipeline", "returns", "info", "about", "all", "pipelines", "." ]
[ "func", "(", "c", "APIClient", ")", "ListPipeline", "(", ")", "(", "[", "]", "*", "pps", ".", "PipelineInfo", ",", "<mask>", ")", "{", "pipelineInfos", ",", "err", ":=", "c", ".", "PpsAPIClient", ".", "ListPipeline", "(", "c", ".", "Ctx", "(", ")", ",", "&", "pps", ".", "ListPipelineRequest", "{", "}", ",", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "return", "pipelineInfos", ".", "PipelineInfo", ",", "nil", "\n", "}" ]
22,256
all-22257
[ "Walk", "traverses", "the", "directory", "tree", "rooted", "at", "c", ".", "RepoRoot", ".", "Walk", "visits", "subdirectories", "in", "depth", "-", "first", "post", "-", "order", ".", "When", "Walk", "visits", "a", "directory", "it", "lists", "the", "files", "and", "subdirectories", "within", "that", "directory", ".", "If", "a", "build", "file", "is", "present", "Walk", "reads", "the", "build", "file", "and", "applies", "any", "directives", "to", "the", "configuration", "(", "a", "copy", "of", "the", "parent", "directory", "s", "configuration", "is", "made", "and", "the", "copy", "is", "modified", ")", ".", "After", "visiting", "subdirectories", "the", "callback", "wf", "may", "be", "called", "depending", "on", "the", "mode", ".", "c", "is", "the", "root", "configuration", "to", "start", "with", ".", "This", "includes", "changes", "made", "by", "command", "line", "flags", "but", "not", "by", "the", "root", "build", "file", ".", "This", "configuration", "should", "not", "be", "modified", ".", "cexts", "is", "a", "list", "of", "configuration", "extensions", ".", "When", "visiting", "a", "directory", "before", "visiting", "subdirectories", "Walk", "makes", "a", "copy", "of", "the", "parent", "configuration", "and", "Configure", "for", "each", "extension", "on", "the", "copy", ".", "If", "Walk", "sees", "a", "directive", "that", "is", "not", "listed", "in", "KnownDirectives", "of", "any", "extension", "an", "error", "will", "be", "logged", ".", "dirs", "is", "a", "list", "of", "absolute", "canonical", "file", "system", "paths", "of", "directories", "to", "visit", ".", "mode", "determines", "whether", "subdirectories", "of", "dirs", "should", "be", "visited", "recursively", "when", "the", "wf", "callback", "should", "be", "called", "and", "when", "the", "update", "argument", "to", "the", "wf", "callback", "should", "be", "set", ".", "wf", "is", "a", "function", "that", "may", "be", "called", "in", "each", "directory", "." ]
[ "func", "Walk", "(", "c", "*", "config", ".", "Config", ",", "cexts", "[", "]", "config", ".", "Configurer", ",", "dirs", "[", "]", "string", ",", "mode", "Mode", ",", "wf", "WalkFunc", ")", "{", "knownDirectives", ":=", "make", "(", "map", "[", "string", "]", "bool", ")", "\n", "for", "_", ",", "cext", ":=", "range", "cexts", "{", "for", "_", ",", "d", ":=", "range", "cext", ".", "KnownDirectives", "(", ")", "{", "knownDirectives", "[", "d", "]", "=", "true", "\n", "}", "\n", "}", "\n\n", "symlinks", ":=", "symlinkResolver", "{", "visited", ":", "[", "]", "string", "{", "c", ".", "RepoRoot", "}", "}", "\n\n", "updateRels", ":=", "buildUpdateRelMap", "(", "c", ".", "RepoRoot", ",", "dirs", ")", "\n\n", "var", "visit", "func", "(", "*", "config", ".", "Config", ",", "string", ",", "string", ",", "bool", ")", "\n", "visit", "=", "func", "(", "c", "*", "config", ".", "Config", ",", "dir", ",", "rel", "string", ",", "updateParent", "bool", ")", "{", "haveError", ":=", "<mask>", "\n\n", "// TODO: OPT: ReadDir stats all the files, which is slow. We just care about", "// names and modes, so we should use something like", "// golang.org/x/tools/internal/fastwalk to speed this up.", "files", ",", "err", ":=", "ioutil", ".", "ReadDir", "(", "dir", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Print", "(", "err", ")", "\n", "return", "\n", "}", "\n\n", "f", ",", "err", ":=", "loadBuildFile", "(", "c", ",", "rel", ",", "dir", ",", "files", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Print", "(", "err", ")", "\n", "haveError", "=", "true", "\n", "}", "\n\n", "c", "=", "configure", "(", "cexts", ",", "knownDirectives", ",", "c", ",", "rel", ",", "f", ")", "\n", "wc", ":=", "getWalkConfig", "(", "c", ")", "\n\n", "if", "wc", ".", "isExcluded", "(", "rel", ",", "\"", "\"", ")", "{", "return", "\n", "}", "\n\n", "var", "subdirs", ",", "regularFiles", "[", "]", "string", "\n", "for", "_", ",", "fi", ":=", "range", "files", "{", "base", ":=", "fi", ".", "Name", "(", ")", "\n", "switch", "{", "case", "base", "==", "\"", "\"", "||", "wc", ".", "isExcluded", "(", "rel", ",", "base", ")", ":", "continue", "\n\n", "case", "fi", ".", "IsDir", "(", ")", "||", "fi", ".", "Mode", "(", ")", "&", "os", ".", "ModeSymlink", "!=", "0", "&&", "symlinks", ".", "follow", "(", "c", ",", "dir", ",", "rel", ",", "base", ")", ":", "subdirs", "=", "append", "(", "subdirs", ",", "base", ")", "\n\n", "default", ":", "regularFiles", "=", "append", "(", "regularFiles", ",", "base", ")", "\n", "}", "\n", "}", "\n\n", "shouldUpdate", ":=", "shouldUpdate", "(", "rel", ",", "mode", ",", "updateParent", ",", "updateRels", ")", "\n", "for", "_", ",", "sub", ":=", "range", "subdirs", "{", "if", "subRel", ":=", "path", ".", "Join", "(", "rel", ",", "sub", ")", ";", "shouldVisit", "(", "subRel", ",", "mode", ",", "updateRels", ")", "{", "visit", "(", "c", ",", "filepath", ".", "Join", "(", "dir", ",", "sub", ")", ",", "subRel", ",", "shouldUpdate", ")", "\n", "}", "\n", "}", "\n\n", "update", ":=", "!", "haveError", "&&", "!", "wc", ".", "ignore", "&&", "shouldUpdate", "\n", "if", "shouldCall", "(", "rel", ",", "mode", ",", "updateRels", ")", "{", "genFiles", ":=", "findGenFiles", "(", "wc", ",", "f", ")", "\n", "wf", "(", "dir", ",", "rel", ",", "c", ",", "update", ",", "f", ",", "subdirs", ",", "regularFiles", ",", "genFiles", ")", "\n", "}", "\n", "}", "\n", "visit", "(", "c", ",", "c", ".", "RepoRoot", ",", "\"", "\"", ",", "false", ")", "\n", "}" ]
22,257
all-22258
[ "HasMetricQuery", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TimeseriesRequest", ")", "HasMetricQuery", "(", ")", "bool", "{", "if", "t", "!=", "nil", "&&", "t", ".", "MetricQuery", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
22,258
all-22259
[ "HasName", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "l", "*", "LogSet", ")", "HasName", "(", ")", "bool", "{", "if", "l", "!=", "nil", "&&", "l", ".", "Name", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
22,259
all-22260
[ "Destroy", "closes", "any", "open", "browsers", "by", "ending", "the", "session", "." ]
[ "func", "(", "p", "*", "Page", ")", "Destroy", "(", ")", "error", "{", "if", "err", ":=", "p", ".", "<mask>", ".", "Delete", "(", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
22,260
all-22261
[ "Symbols", "returns", "a", "mapping", "from", "name", "to", "inferior", "address", "along", "with", "any", "error", "encountered", "during", "reading", "the", "symbol", "information", ".", "(", "There", "may", "be", "both", "an", "error", "and", "some", "returned", "symbols", ".", ")", "Symbols", "might", "not", "be", "available", "with", "core", "files", "from", "stripped", "binaries", "." ]
[ "func", "(", "p", "*", "<mask>", ")", "Symbols", "(", ")", "(", "map", "[", "string", "]", "Address", ",", "error", ")", "{", "return", "p", ".", "syms", ",", "p", ".", "symErr", "\n", "}" ]
22,261
all-22262
[ "GetMongo", "returns", "a", "Mongo", "configurations" ]
[ "func", "GetMongo", "(", "source", "interface", "{", "}", ",", "<mask>", "string", ")", "(", "mongo", "Config", ",", "err", "error", ")", "{", "var", "env", "Environment", "\n", "i", ",", "err", ":=", "config", ".", "Get", "(", "source", ",", "environment", ",", "&", "env", ")", "\n", "mongo", "=", "i", ".", "(", "Config", ")", "\n", "return", "\n", "}" ]
22,262
all-22263
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "StopWorkerParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoServiceworker3", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
22,263
all-22264
[ "GetSuggestedApprovers", "solves", "the", "exact", "cover", "problem", "finding", "an", "approver", "capable", "of", "approving", "every", "OWNERS", "file", "in", "the", "PR" ]
[ "func", "(", "o", "Owners", ")", "GetSuggestedApprovers", "(", "reverseMap", "map", "[", "string", "]", "sets", ".", "String", ",", "potentialApprovers", "[", "]", "string", ")", "sets", ".", "String", "{", "ap", ":=", "NewApprovers", "(", "o", ")", "\n", "for", "!", "ap", ".", "RequirementsMet", "(", ")", "{", "newApprover", ":=", "findMostCoveringApprover", "(", "potentialApprovers", ",", "reverseMap", ",", "ap", ".", "UnapprovedFiles", "(", ")", ")", "\n", "if", "newApprover", "==", "\"", "\"", "{", "o", ".", "<mask>", ".", "Warnf", "(", "\"", "\"", ",", "ap", ".", "UnapprovedFiles", "(", ")", ".", "List", "(", ")", ")", "\n", "return", "ap", ".", "GetCurrentApproversSet", "(", ")", "\n", "}", "\n", "ap", ".", "AddApprover", "(", "newApprover", ",", "\"", "\"", ",", "false", ")", "\n", "}", "\n\n", "return", "ap", ".", "GetCurrentApproversSet", "(", ")", "\n", "}" ]
22,264
all-22265
[ "ListCommitByRepo", "lists", "all", "commits", "in", "a", "repo", "." ]
[ "func", "(", "c", "APIClient", ")", "ListCommitByRepo", "(", "repoName", "<mask>", ")", "(", "[", "]", "*", "pfs", ".", "CommitInfo", ",", "error", ")", "{", "return", "c", ".", "ListCommit", "(", "repoName", ",", "\"", "\"", ",", "\"", "\"", ",", "0", ")", "\n", "}" ]
22,265
all-22266
[ "BeginCall", "starts", "a", "new", "call", "to", "a", "remote", "peer", "returning", "an", "OutboundCall", "that", "can", "be", "used", "to", "write", "the", "arguments", "of", "the", "call", "." ]
[ "func", "(", "ch", "*", "<mask>", ")", "BeginCall", "(", "ctx", "context", ".", "Context", ",", "hostPort", ",", "serviceName", ",", "methodName", "string", ",", "callOptions", "*", "CallOptions", ")", "(", "*", "OutboundCall", ",", "error", ")", "{", "p", ":=", "ch", ".", "RootPeers", "(", ")", ".", "GetOrAdd", "(", "hostPort", ")", "\n", "return", "p", ".", "BeginCall", "(", "ctx", ",", "serviceName", ",", "methodName", ",", "callOptions", ")", "\n", "}" ]
22,266
all-22267
[ "Do", "performs", "the", "given", "http", "request", "and", "fills", "the", "given", "http", "response", ".", "Request", "must", "contain", "at", "least", "non", "-", "zero", "RequestURI", "with", "full", "url", "(", "including", "scheme", "and", "host", ")", "or", "non", "-", "zero", "Host", "header", "+", "RequestURI", ".", "Client", "determines", "the", "server", "to", "be", "requested", "in", "the", "following", "order", ":", "-", "from", "RequestURI", "if", "it", "contains", "full", "url", "with", "scheme", "and", "host", ";", "-", "from", "Host", "header", "otherwise", ".", "Response", "is", "ignored", "if", "resp", "is", "nil", ".", "The", "function", "doesn", "t", "follow", "redirects", ".", "Use", "Get", "*", "for", "following", "redirects", ".", "ErrNoFreeConns", "is", "returned", "if", "all", "Client", ".", "MaxConnsPerHost", "connections", "to", "the", "requested", "host", "are", "busy", ".", "It", "is", "recommended", "obtaining", "req", "and", "resp", "via", "AcquireRequest", "and", "AcquireResponse", "in", "performance", "-", "critical", "code", "." ]
[ "func", "(", "c", "*", "Client", ")", "Do", "(", "req", "*", "Request", ",", "resp", "*", "Response", ")", "error", "{", "uri", ":=", "req", ".", "URI", "(", ")", "\n", "host", ":=", "uri", ".", "Host", "(", ")", "\n\n", "isTLS", ":=", "false", "\n", "scheme", ":=", "uri", ".", "Scheme", "(", ")", "\n", "if", "bytes", ".", "Equal", "(", "scheme", ",", "strHTTPS", ")", "{", "isTLS", "=", "true", "\n", "}", "else", "if", "!", "<mask>", ".", "Equal", "(", "scheme", ",", "strHTTP", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "scheme", ")", "\n", "}", "\n\n", "startCleaner", ":=", "false", "\n\n", "c", ".", "mLock", ".", "Lock", "(", ")", "\n", "m", ":=", "c", ".", "m", "\n", "if", "isTLS", "{", "m", "=", "c", ".", "ms", "\n", "}", "\n", "if", "m", "==", "nil", "{", "m", "=", "make", "(", "map", "[", "string", "]", "*", "HostClient", ")", "\n", "if", "isTLS", "{", "c", ".", "ms", "=", "m", "\n", "}", "else", "{", "c", ".", "m", "=", "m", "\n", "}", "\n", "}", "\n", "hc", ":=", "m", "[", "string", "(", "host", ")", "]", "\n", "if", "hc", "==", "nil", "{", "hc", "=", "&", "HostClient", "{", "Addr", ":", "addMissingPort", "(", "string", "(", "host", ")", ",", "isTLS", ")", ",", "Name", ":", "c", ".", "Name", ",", "NoDefaultUserAgentHeader", ":", "c", ".", "NoDefaultUserAgentHeader", ",", "Dial", ":", "c", ".", "Dial", ",", "DialDualStack", ":", "c", ".", "DialDualStack", ",", "IsTLS", ":", "isTLS", ",", "TLSConfig", ":", "c", ".", "TLSConfig", ",", "MaxConns", ":", "c", ".", "MaxConnsPerHost", ",", "MaxIdleConnDuration", ":", "c", ".", "MaxIdleConnDuration", ",", "MaxIdemponentCallAttempts", ":", "c", ".", "MaxIdemponentCallAttempts", ",", "ReadBufferSize", ":", "c", ".", "ReadBufferSize", ",", "WriteBufferSize", ":", "c", ".", "WriteBufferSize", ",", "ReadTimeout", ":", "c", ".", "ReadTimeout", ",", "WriteTimeout", ":", "c", ".", "WriteTimeout", ",", "MaxResponseBodySize", ":", "c", ".", "MaxResponseBodySize", ",", "DisableHeaderNamesNormalizing", ":", "c", ".", "DisableHeaderNamesNormalizing", ",", "}", "\n", "m", "[", "string", "(", "host", ")", "]", "=", "hc", "\n", "if", "len", "(", "m", ")", "==", "1", "{", "startCleaner", "=", "true", "\n", "}", "\n", "}", "\n", "c", ".", "mLock", ".", "Unlock", "(", ")", "\n\n", "if", "startCleaner", "{", "go", "c", ".", "mCleaner", "(", "m", ")", "\n", "}", "\n\n", "return", "hc", ".", "Do", "(", "req", ",", "resp", ")", "\n", "}" ]
22,267
all-22268
[ "Do", "executes", "Emulation", ".", "setScriptExecutionDisabled", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "SetScriptExecutionDisabledParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSetScriptExecutionDisabled", ",", "p", ",", "nil", ")", "\n", "}" ]
22,268
all-22269
[ "addServiceMonitor", "watches", "a", "channel", "to", "add", "services", "into", "operation", "." ]
[ "func", "(", "s", "*", "ServiceManager", ")", "addServiceMonitor", "(", ")", "{", "log", ".", "Println", "(", "\"", "\"", ")", "\n", "for", "{", "select", "{", "case", "p", ":=", "<-", "s", ".", "commandCreatedChan", ":", "if", "p", "!=", "nil", "&&", "p", ".", "Process", "!=", "nil", "{", "s", ".", "processMap", ".", "<mask>", "(", "p", ".", "Process", ".", "Pid", ",", "p", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}" ]
22,269
all-22270
[ "NewRL10", "returns", "a", "API", "client", "that", "uses", "the", "information", "stored", "in", "/", "var", "/", "run", "/", "rightlink", "/", "secret", "to", "do", "auth", "and", "configure", "the", "host", ".", "The", "client", "behaves", "identically", "to", "the", "client", "returned", "by", "New", "in", "all", "other", "regards", "." ]
[ "func", "NewRL10", "(", ")", "(", "*", "API", ",", "error", ")", "{", "client", ":=", "httpclient", ".", "New", "(", ")", "\n", "rllConfig", ",", "err", ":=", "os", ".", "Open", "(", "RllSecret", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "defer", "rllConfig", ".", "Close", "(", ")", "\n", "var", "port", "string", "\n", "var", "secret", "string", "\n", "scanner", ":=", "bufio", ".", "NewScanner", "(", "rllConfig", ")", "\n", "for", "scanner", ".", "Scan", "(", ")", "{", "line", ":=", "scanner", ".", "Text", "(", ")", "\n", "elems", ":=", "strings", ".", "Split", "(", "line", ",", "\"", "\"", ")", "\n", "if", "len", "(", "elems", ")", "!=", "2", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "line", ")", "\n", "}", "\n", "switch", "elems", "[", "0", "]", "{", "case", "\"", "\"", ":", "port", "=", "elems", "[", "1", "]", "\n", "if", "_", ",", "err", ":=", "strconv", ".", "Atoi", "(", "elems", "[", "1", "]", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "port", ")", "\n", "}", "\n", "case", "\"", "\"", ":", "secret", "=", "elems", "[", "1", "]", "\n", "}", "\n", "}", "\n", "if", "err", ":=", "scanner", ".", "Err", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "host", ":=", "\"", "\"", "+", "port", "\n", "auth", ":=", "NewRL10Authenticator", "(", "secret", ")", "\n", "auth", ".", "SetHost", "(", "host", ")", "\n", "api", ":=", "&", "API", "{", "Auth", ":", "auth", ",", "Host", ":", "host", ",", "Client", ":", "<mask>", ",", "}", "\n", "httpclient", ".", "Insecure", "=", "true", "\n", "return", "api", ",", "nil", "\n", "}" ]
22,270
all-22271
[ "NewDecoder", "returns", "a", "decoder", "object", "that", "uses", "p", "will", "panic", "if", "p", "is", "nil", "." ]
[ "func", "NewDecoder", "(", "p", "<mask>", ")", "*", "Decoder", "{", "if", "p", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "&", "Decoder", "{", "Parser", ":", "p", "}", "\n", "}" ]
22,271
all-22272
[ "Value", "converts", "a", "value", "to", "a", "database", "driver", "value" ]
[ "func", "(", "r", "RGBColor", ")", "<mask>", "(", ")", "(", "driver", ".", "Value", ",", "error", ")", "{", "return", "driver", ".", "Value", "(", "string", "(", "r", ")", ")", ",", "nil", "\n", "}" ]
22,272
all-22273
[ "flushFragment", "sends", "a", "fragment", "to", "the", "peer", "over", "the", "connection" ]
[ "func", "(", "w", "*", "reqResWriter", ")", "flushFragment", "(", "fragment", "*", "writableFragment", ")", "error", "{", "if", "w", ".", "err", "!=", "nil", "{", "return", "w", ".", "err", "\n", "}", "\n\n", "frame", ":=", "fragment", ".", "frame", ".", "(", "*", "Frame", ")", "\n", "frame", ".", "Header", ".", "SetPayloadSize", "(", "uint16", "(", "fragment", ".", "contents", ".", "BytesWritten", "(", ")", ")", ")", "\n\n", "if", "err", ":=", "w", ".", "mex", ".", "checkError", "(", ")", ";", "err", "!=", "nil", "{", "return", "w", ".", "failed", "(", "err", ")", "\n", "}", "\n", "select", "{", "case", "<-", "w", ".", "mex", ".", "ctx", ".", "Done", "(", ")", ":", "return", "w", ".", "<mask>", "(", "GetContextError", "(", "w", ".", "mex", ".", "ctx", ".", "Err", "(", ")", ")", ")", "\n", "case", "<-", "w", ".", "mex", ".", "errCh", ".", "c", ":", "return", "w", ".", "failed", "(", "w", ".", "mex", ".", "errCh", ".", "err", ")", "\n", "case", "w", ".", "conn", ".", "sendCh", "<-", "frame", ":", "return", "nil", "\n", "}", "\n", "}" ]
22,273
all-22274
[ "MayContinue", "returns", "true", "if", "the", "request", "contains", "Expect", ":", "100", "-", "continue", "header", ".", "The", "caller", "must", "do", "one", "of", "the", "following", "actions", "if", "MayContinue", "returns", "true", ":", "-", "Either", "send", "StatusExpectationFailed", "response", "if", "request", "headers", "don", "t", "satisfy", "the", "caller", ".", "-", "Or", "send", "StatusContinue", "response", "before", "reading", "request", "body", "with", "ContinueReadBody", ".", "-", "Or", "close", "the", "connection", "." ]
[ "func", "(", "req", "*", "Request", ")", "MayContinue", "(", ")", "bool", "{", "return", "bytes", ".", "Equal", "(", "req", ".", "<mask>", ".", "peek", "(", "strExpect", ")", ",", "str100Continue", ")", "\n", "}" ]
22,274
all-22275
[ "Clone", "clones", "a", "repository", ".", "Pass", "the", "full", "repository", "name", "such", "as", "kubernetes", "/", "test", "-", "infra", "as", "the", "repo", ".", "This", "function", "may", "take", "a", "long", "time", "if", "it", "is", "the", "first", "time", "cloning", "the", "repo", ".", "In", "that", "case", "it", "must", "do", "a", "full", "git", "mirror", "clone", ".", "For", "large", "repos", "this", "can", "take", "a", "while", ".", "Once", "that", "is", "done", "it", "will", "do", "a", "git", "fetch", "instead", "of", "a", "clone", "which", "will", "usually", "take", "at", "most", "a", "few", "seconds", "." ]
[ "func", "(", "c", "*", "Client", ")", "Clone", "(", "repo", "string", ")", "(", "*", "Repo", ",", "error", ")", "{", "c", ".", "lockRepo", "(", "repo", ")", "\n", "defer", "c", ".", "unlockRepo", "(", "repo", ")", "\n\n", "base", ":=", "c", ".", "base", "\n", "user", ",", "pass", ":=", "c", ".", "getCredentials", "(", ")", "\n", "if", "user", "!=", "\"", "\"", "&&", "pass", "!=", "\"", "\"", "{", "base", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "user", ",", "pass", ",", "github", ")", "\n", "}", "\n", "cache", ":=", "filepath", ".", "Join", "(", "c", ".", "dir", ",", "repo", ")", "+", "\"", "\"", "\n", "if", "_", ",", "err", ":=", "os", ".", "Stat", "(", "cache", ")", ";", "os", ".", "IsNotExist", "(", "err", ")", "{", "// Cache miss, clone it now.", "c", ".", "logger", ".", "Infof", "(", "\"", "\"", ",", "repo", ")", "\n", "if", "err", ":=", "os", ".", "MkdirAll", "(", "filepath", ".", "Dir", "(", "cache", ")", ",", "os", ".", "ModePerm", ")", ";", "err", "!=", "nil", "&&", "!", "os", ".", "IsExist", "(", "err", ")", "{", "return", "nil", ",", "err", "\n", "}", "\n", "remote", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ",", "repo", ")", "\n", "if", "b", ",", "err", ":=", "retryCmd", "(", "c", ".", "logger", ",", "\"", "\"", ",", "c", ".", "git", ",", "\"", "\"", ",", "\"", "\"", ",", "remote", ",", "cache", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ",", "string", "(", "b", ")", ")", "\n", "}", "\n", "}", "else", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "else", "{", "// Cache hit. Do a git fetch to keep updated.", "c", ".", "logger", ".", "Infof", "(", "\"", "\"", ",", "repo", ")", "\n", "if", "b", ",", "err", ":=", "retryCmd", "(", "c", ".", "logger", ",", "cache", ",", "c", ".", "git", ",", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ",", "string", "(", "b", ")", ")", "\n", "}", "\n", "}", "\n", "t", ",", "err", ":=", "ioutil", ".", "TempDir", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "b", ",", "err", ":=", "exec", ".", "Command", "(", "c", ".", "git", ",", "\"", "\"", ",", "cache", ",", "t", ")", ".", "CombinedOutput", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ",", "string", "(", "b", ")", ")", "\n", "}", "\n", "return", "&", "Repo", "{", "Dir", ":", "t", ",", "logger", ":", "c", ".", "logger", ",", "git", ":", "c", ".", "git", ",", "base", ":", "base", ",", "repo", ":", "repo", ",", "user", ":", "user", ",", "pass", ":", "pass", ",", "}", ",", "nil", "\n", "}" ]
22,275
all-22276
[ "GetFillMaxOk", "returns", "a", "tuple", "with", "the", "FillMax", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TileDefStyle", ")", "GetFillMaxOk", "(", ")", "(", "json", ".", "Number", ",", "bool", ")", "{", "if", "t", "==", "nil", "||", "t", ".", "FillMax", "==", "nil", "{", "return", "\"", "\"", ",", "<mask>", "\n", "}", "\n", "return", "*", "t", ".", "FillMax", ",", "true", "\n", "}" ]
22,276
all-22277
[ "query", "the", "properties", "of", "a", "sync", "object" ]
[ "func", "GetSynciv", "(", "sync", "uintptr", ",", "pname", "uint32", ",", "bufSize", "int32", ",", "length", "*", "int32", ",", "values", "*", "int32", ")", "{", "C", ".", "glowGetSynciv", "(", "gpGetSynciv", ",", "(", "C", ".", "GLsync", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLenum", ")", "(", "pname", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "bufSize", ")", ",", "(", "*", "C", ".", "GLsizei", ")", "(", "unsafe", ".", "Pointer", "(", "length", ")", ")", ",", "(", "*", "C", ".", "GLint", ")", "(", "unsafe", ".", "Pointer", "(", "values", ")", ")", ")", "\n", "}" ]
22,277
all-22278
[ "Call", "makes", "a", "JSON", "call", "with", "retries", "." ]
[ "func", "(", "c", "*", "Client", ")", "Call", "(", "ctx", "Context", ",", "method", "string", ",", "arg", ",", "resp", "interface", "{", "}", ")", "error", "{", "var", "(", "headers", "=", "ctx", ".", "Headers", "(", ")", "\n\n", "respHeaders", "map", "[", "string", "]", "string", "\n", "respErr", "ErrApplication", "\n", "errAt", "string", "\n", "isOK", "bool", "\n", ")", "\n\n", "err", ":=", "c", ".", "ch", ".", "RunWithRetry", "(", "ctx", ",", "func", "(", "ctx", "context", ".", "<mask>", ",", "rs", "*", "tchannel", ".", "RequestState", ")", "error", "{", "respHeaders", ",", "respErr", ",", "isOK", "=", "nil", ",", "nil", ",", "false", "\n", "errAt", "=", "\"", "\"", "\n\n", "call", ",", "err", ":=", "c", ".", "startCall", "(", "ctx", ",", "method", ",", "&", "tchannel", ".", "CallOptions", "{", "Format", ":", "tchannel", ".", "JSON", ",", "RequestState", ":", "rs", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "isOK", ",", "errAt", ",", "err", "=", "makeCall", "(", "call", ",", "headers", ",", "arg", ",", "&", "respHeaders", ",", "resp", ",", "&", "respErr", ")", "\n", "return", "err", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "// TODO: Don't lose the error type here.", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "errAt", ",", "err", ")", "\n", "}", "\n", "if", "!", "isOK", "{", "return", "respErr", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
22,278
all-22279
[ "Reset", "resets", "the", "session", "meaning", "a", "new", "Ask", "()", "call", "will", "appear", "as", "new", "conversation", "from", "bots", "point", "of", "view", "." ]
[ "func", "(", "s", "*", "<mask>", ")", "Reset", "(", ")", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n", "s", ".", "Values", ".", "Del", "(", "\"", "\"", ")", "\n", "// Clear the json map", "s", ".", "clear", "(", ")", "\n", "}" ]
22,279
all-22280
[ "LayerInfosForCopy", "()", "returns", "updated", "layer", "info", "that", "should", "be", "used", "when", "reading", "in", "preference", "to", "values", "in", "the", "manifest", "if", "specified", "." ]
[ "func", "(", "*", "tarballImageSource", ")", "LayerInfosForCopy", "(", "ctx", "<mask>", ".", "Context", ")", "(", "[", "]", "types", ".", "BlobInfo", ",", "error", ")", "{", "return", "nil", ",", "nil", "\n", "}" ]
22,280
all-22281
[ "TrimBelowName", "returns", "a", "slice", "of", "the", "Trace", "with", "all", "entries", "below", "the", "lowest", "with", "function", "name", "name", "removed", "." ]
[ "func", "(", "pcs", "Trace", ")", "TrimBelowName", "(", "name", "string", ")", "Trace", "{", "for", "len", "(", "pcs", ")", ">", "0", "&&", "pcs", "[", "0", "]", ".", "name", "(", ")", "!=", "<mask>", "{", "pcs", "=", "pcs", "[", "1", ":", "]", "\n", "}", "\n", "return", "pcs", "\n", "}" ]
22,281
all-22282
[ "NewDLock", "attempts", "to", "acquire", "a", "distributed", "lock", "that", "locks", "a", "given", "prefix", "in", "the", "data", "store", "." ]
[ "func", "NewDLock", "(", "<mask>", "*", "etcd", ".", "Client", ",", "prefix", "string", ")", "DLock", "{", "return", "&", "etcdImpl", "{", "client", ":", "client", ",", "prefix", ":", "prefix", ",", "}", "\n", "}" ]
22,282
all-22283
[ "The", "4", "print", "functions", "below", "print", "the", "entry", "format", "based", "on", "there", "types", "printInternalRaftRequest", "is", "used", "to", "print", "entry", "information", "for", "IRRRange", "IRRPut", "IRRDeleteRange", "and", "IRRTxn", "entries" ]
[ "func", "printInternalRaftRequest", "(", "<mask>", "raftpb", ".", "Entry", ")", "{", "var", "rr", "etcdserverpb", ".", "InternalRaftRequest", "\n", "if", "err", ":=", "rr", ".", "Unmarshal", "(", "entry", ".", "Data", ")", ";", "err", "==", "nil", "{", "fmt", ".", "Printf", "(", "\"", "\\t", "\\t", "\\t", "\"", ",", "entry", ".", "Term", ",", "entry", ".", "Index", ",", "rr", ".", "String", "(", ")", ")", "\n", "}", "\n", "}" ]
22,283
all-22284
[ "Register", "registers", "a", "server", "its", "shutdown", "func", "and", "ignore", "error", "funcs", "." ]
[ "func", "(", "s", "*", "Sentinel", ")", "Register", "(", "server", ",", "shutdown", "interface", "{", "}", ",", "ignore", "...", "func", "(", "error", ")", "bool", ")", "error", "{", "// add server and shutdown funcs", "var", "err", "error", "\n", "s", ".", "serverFuncs", ",", "err", "=", "convertAndAppendContextFuncs", "(", "s", ".", "serverFuncs", ",", "server", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "s", ".", "shutdownFuncs", ",", "err", "=", "convertAndAppendContextFuncs", "(", "s", ".", "shutdownFuncs", ",", "shutdown", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n\n", "}", "\n", "s", ".", "ignoreErrors", "=", "<mask>", "(", "s", ".", "ignoreErrors", ",", "ignore", "...", ")", "\n", "return", "nil", "\n", "}" ]
22,284
all-22285
[ "HasOrderBy", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "g", "*", "GraphDefinitionRequest", ")", "HasOrderBy", "(", ")", "bool", "{", "if", "g", "!=", "nil", "&&", "g", ".", "OrderBy", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
22,285
all-22286
[ "UpdateMaintenanceWindow", "updates", "passed", "maintenance", "[", "window", "]", "." ]
[ "func", "(", "a", "*", "API", ")", "UpdateMaintenanceWindow", "(", "cfg", "*", "Maintenance", ")", "(", "*", "Maintenance", ",", "error", ")", "{", "if", "cfg", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "maintenanceCID", ":=", "string", "(", "cfg", ".", "CID", ")", "\n\n", "matched", ",", "err", ":=", "regexp", ".", "MatchString", "(", "config", ".", "MaintenanceCIDRegex", ",", "maintenanceCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "!", "matched", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "maintenanceCID", ")", "\n", "}", "\n\n", "jsonCfg", ",", "err", ":=", "json", ".", "Marshal", "(", "cfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "a", ".", "Debug", "{", "a", ".", "Log", ".", "Printf", "(", "\"", "\"", ",", "string", "(", "jsonCfg", ")", ")", "\n", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "Put", "(", "maintenanceCID", ",", "jsonCfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "window", ":=", "&", "Maintenance", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "<mask>", ",", "window", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "window", ",", "nil", "\n", "}" ]
22,286
all-22287
[ "GetConfigs", "returns", "all", "configs" ]
[ "func", "(", "s", "*", "Storage", ")", "GetConfigs", "(", ")", "(", "[", "]", "common", ".", "ResourcesConfig", ",", "error", ")", "{", "var", "configs", "[", "]", "common", ".", "ResourcesConfig", "\n", "items", ",", "err", ":=", "s", ".", "configs", ".", "List", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "configs", ",", "err", "\n", "}", "\n", "for", "_", ",", "i", ":=", "range", "items", "{", "<mask>", "conf", "common", ".", "ResourcesConfig", "\n", "conf", ",", "err", "=", "common", ".", "ItemToResourcesConfig", "(", "i", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "configs", "=", "append", "(", "configs", ",", "conf", ")", "\n", "}", "\n", "return", "configs", ",", "nil", "\n", "}" ]
22,287
all-22288
[ "Return", "a", "map", "from", "table", "names", "to", "their", "schema", "definition", "taking", "a", "full", "schema", "SQL", "text", "generated", "with", "schema", ".", "Schema", ".", "Dump", "()", "." ]
[ "func", "dumpParseSchema", "(", "schema", "string", ")", "map", "[", "string", "]", "string", "{", "tables", ":=", "map", "[", "string", "]", "string", "{", "}", "\n", "for", "_", ",", "statement", ":=", "range", "strings", ".", "Split", "(", "schema", ",", "\"", "\"", ")", "{", "statement", "=", "strings", ".", "Trim", "(", "<mask>", ",", "\"", "\\n", "\"", ")", "+", "\"", "\"", "\n", "if", "!", "strings", ".", "HasPrefix", "(", "statement", ",", "\"", "\"", ")", "{", "continue", "\n", "}", "\n", "table", ":=", "strings", ".", "Split", "(", "statement", ",", "\"", "\"", ")", "[", "2", "]", "\n", "tables", "[", "table", "]", "=", "statement", "\n", "}", "\n", "return", "tables", "\n", "}" ]
22,288
all-22289
[ "Valid", "returns", "true", "when", "iterator", "reaches", "the", "end" ]
[ "func", "(", "it", "*", "Iterator", ")", "Valid", "(", ")", "bool", "{", "if", "it", ".", "valid", "&&", "<mask>", ".", "curr", "==", "it", ".", "s", ".", "tail", "{", "it", ".", "valid", "=", "false", "\n", "}", "\n\n", "return", "it", ".", "valid", "\n", "}" ]
22,289
all-22290
[ "isCall", "returns", "true", "if", "t", "is", "a", "call", "to", "pkg", ".", "name", "." ]
[ "func", "isCall", "(", "t", "ast", ".", "Expr", ",", "pkg", ",", "name", "string", ")", "bool", "{", "<mask>", ",", "ok", ":=", "t", ".", "(", "*", "ast", ".", "CallExpr", ")", "\n", "return", "ok", "&&", "isPkgDot", "(", "call", ".", "Fun", ",", "pkg", ",", "name", ")", "\n", "}" ]
22,290
all-22291
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetBrowserContextsParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoTarget11", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
22,291
all-22292
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EnableParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoLayertree17", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
22,292
all-22293
[ "valid", "returns", "whether", "the", "key", "is", "valid", "." ]
[ "func", "(", "k", "*", "Key", ")", "valid", "(", ")", "bool", "{", "if", "k", "==", "nil", "{", "return", "false", "\n", "}", "\n", "for", ";", "k", "!=", "nil", ";", "k", "=", "k", ".", "parent", "{", "if", "k", ".", "<mask>", "==", "\"", "\"", "||", "k", ".", "appID", "==", "\"", "\"", "{", "return", "false", "\n", "}", "\n", "if", "k", ".", "stringID", "!=", "\"", "\"", "&&", "k", ".", "intID", "!=", "0", "{", "return", "false", "\n", "}", "\n", "if", "k", ".", "parent", "!=", "nil", "{", "if", "k", ".", "parent", ".", "Incomplete", "(", ")", "{", "return", "false", "\n", "}", "\n", "if", "k", ".", "parent", ".", "appID", "!=", "k", ".", "appID", "||", "k", ".", "parent", ".", "namespace", "!=", "k", ".", "namespace", "{", "return", "false", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "true", "\n", "}" ]
22,293
all-22294
[ "KeyValue", "extracts", "the", "key", "and", "value", "encoded", "in", "the", "given", "string", "and", "separated", "by", "=", "(", "foo", "=", "bar", "-", ">", "foo", "bar", ")", "." ]
[ "func", "KeyValue", "(", "s", "string", ")", "(", "string", ",", "string", ",", "error", ")", "{", "parts", ":=", "strings", ".", "Split", "(", "s", ",", "\"", "\"", ")", "\n\n", "if", "len", "(", "parts", ")", "!=", "2", "{", "return", "\"", "\"", ",", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "s", ")", "\n", "}", "\n\n", "return", "<mask>", "[", "0", "]", ",", "parts", "[", "1", "]", ",", "nil", "\n", "}" ]
22,294
all-22295
[ "NewFileSnapshotStoreWithLogger", "creates", "a", "new", "FileSnapshotStore", "based", "on", "a", "base", "directory", ".", "The", "retain", "parameter", "controls", "how", "many", "snapshots", "are", "retained", ".", "Must", "be", "at", "least", "1", "." ]
[ "func", "NewFileSnapshotStoreWithLogger", "(", "base", "string", ",", "retain", "int", ",", "logger", "*", "log", ".", "Logger", ")", "(", "*", "FileSnapshotStore", ",", "error", ")", "{", "if", "retain", "<", "1", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "logger", "==", "nil", "{", "logger", "=", "log", ".", "New", "(", "os", ".", "Stderr", ",", "\"", "\"", ",", "log", ".", "LstdFlags", ")", "\n", "}", "\n\n", "// Ensure our path exists", "<mask>", ":=", "filepath", ".", "Join", "(", "base", ",", "snapPath", ")", "\n", "if", "err", ":=", "os", ".", "MkdirAll", "(", "path", ",", "0755", ")", ";", "err", "!=", "nil", "&&", "!", "os", ".", "IsExist", "(", "err", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "// Setup the store", "store", ":=", "&", "FileSnapshotStore", "{", "path", ":", "path", ",", "retain", ":", "retain", ",", "logger", ":", "logger", ",", "}", "\n\n", "// Do a permissions test", "if", "err", ":=", "store", ".", "testPermissions", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "store", ",", "nil", "\n", "}" ]
22,295
all-22296
[ "PrintSettingsNewFromFile", "()", "is", "a", "wrapper", "around", "gtk_print_settings_new_from_file", "()", "." ]
[ "func", "PrintSettingsNewFromFile", "(", "name", "string", ")", "(", "*", "PrintSettings", ",", "error", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "name", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "var", "err", "*", "C", ".", "GError", "=", "nil", "\n", "c", ":=", "C", ".", "gtk_print_settings_new_from_file", "(", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ",", "&", "err", ")", "\n", "if", "c", "==", "nil", "{", "defer", "C", ".", "g_error_free", "(", "err", ")", "\n", "return", "nil", ",", "<mask>", ".", "New", "(", "C", ".", "GoString", "(", "(", "*", "C", ".", "char", ")", "(", "err", ".", "message", ")", ")", ")", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "wrapPrintSettings", "(", "obj", ")", ",", "nil", "\n", "}" ]
22,296
all-22297
[ "Cancel", "will", "attempt", "to", "cancel", "all", "ongoing", "operations" ]
[ "func", "(", "c", "*", "Canceler", ")", "Cancel", "(", ")", "error", "{", "if", "!", "c", ".", "Cancelable", "(", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "c", ".", "lock", ".", "Lock", "(", ")", "\n", "for", "req", ",", "ch", ":=", "range", "c", ".", "reqChCancel", "{", "<mask>", "(", "ch", ")", "\n", "delete", "(", "c", ".", "reqChCancel", ",", "req", ")", "\n", "}", "\n", "c", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "return", "nil", "\n", "}" ]
22,297
all-22298
[ "indicate", "modifications", "to", "a", "range", "of", "a", "mapped", "buffer" ]
[ "func", "FlushMappedBufferRange", "(", "<mask>", "uint32", ",", "offset", "int", ",", "length", "int", ")", "{", "syscall", ".", "Syscall", "(", "gpFlushMappedBufferRange", ",", "3", ",", "uintptr", "(", "target", ")", ",", "uintptr", "(", "offset", ")", ",", "uintptr", "(", "length", ")", ")", "\n", "}" ]
22,298
all-22299
[ "Returns", "an", "string", "or", "panics" ]
[ "func", "(", "t", "Typed", ")", "StringMust", "(", "key", "string", ")", "string", "{", "s", ",", "exists", ":=", "t", ".", "StringIf", "(", "key", ")", "\n", "if", "exists", "==", "<mask>", "{", "panic", "(", "\"", "\"", "+", "key", ")", "\n", "}", "\n", "return", "s", "\n", "}" ]
22,299
all-22300
[ "startServer", "starts", "a", "new", "server", "process", ".", "This", "is", "called", "by", "the", "client", "." ]
[ "func", "startServer", "(", ")", "error", "{", "exe", ",", "err", ":=", "<mask>", ".", "Executable", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "args", ":=", "[", "]", "string", "{", "\"", "\"", "}", "\n", "args", "=", "append", "(", "args", ",", "os", ".", "Args", "[", "1", ":", "]", "...", ")", "\n", "cmd", ":=", "exec", ".", "Command", "(", "exe", ",", "args", "...", ")", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "cmd", ".", "Args", ",", "\"", "\"", ")", ")", "\n", "if", "err", ":=", "cmd", ".", "Start", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "cmd", ".", "Process", ".", "Release", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]