id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
2,400
all-2401
[ "NewService", "creates", "a", "new", "VerificationService", "with", "default", "settings", ".", "Arguments", "allowed", ":", "--", "provider", "-", "base", "-", "url", "--", "pact", "-", "urls", "--", "provider", "-", "states", "-", "url", "--", "provider", "-", "states", "-", "setup", "-", "url", "--", "broker", "-", "username", "--", "broker", "-", "password", "--", "publish", "-", "verification", "-", "results", "--", "provider", "-", "app", "-", "version", "--", "custom", "-", "provider", "-", "headers" ]
[ "func", "(", "v", "*", "VerificationService", ")", "NewService", "(", "args", "[", "]", "string", ")", "Service", "{", "<mask>", ".", "Printf", "(", "\"", "\\n", "\"", ",", "args", ")", "\n\n", "v", ".", "Args", "=", "args", "\n", "v", ".", "Cmd", "=", "getVerifierCommandPath", "(", ")", "\n", "v", ".", "Env", "=", "append", "(", "os", ".", "Environ", "(", ")", ",", "`PACT_INTERACTION_RERUN_COMMAND=\"To re-run this specific test, set the following environment variables and run your test again: PACT_DESCRIPTION=\\\"<PACT_DESCRIPTION>\\\" PACT_PROVIDER_STATE=\\\"<PACT_PROVIDER_STATE>\\\"\"`", ")", "\n\n", "return", "v", "\n", "}" ]
2,401
all-2402
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "RGBA", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoCdp", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
2,402
all-2403
[ "Start", "starts", "the", "session", ".", "At", "that", "point", "the", "authentication", "will", "be", "done", "." ]
[ "func", "(", "s", "*", "<mask>", ")", "Start", "(", ")", "*", "Error", "{", "currentSession", "=", "s", "\n\n", "berr", ":=", "s", ".", "FetchEntity", "(", "s", ".", "root", ")", "\n\n", "if", "berr", "!=", "nil", "{", "return", "berr", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
2,403
all-2404
[ "PrepareStmts", "prepares", "all", "registered", "statements", "and", "returns", "an", "index", "from", "statement", "code", "to", "prepared", "statement", "object", "." ]
[ "func", "PrepareStmts", "(", "db", "*", "sql", ".", "DB", ")", "(", "map", "[", "int", "]", "*", "sql", ".", "Stmt", ",", "error", ")", "{", "index", ":=", "map", "[", "int", "]", "*", "sql", ".", "Stmt", "{", "}", "\n\n", "for", "code", ",", "sql", ":=", "range", "stmts", "{", "stmt", ",", "err", ":=", "<mask>", ".", "Prepare", "(", "sql", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "sql", ")", "\n", "}", "\n", "index", "[", "code", "]", "=", "stmt", "\n", "}", "\n\n", "return", "index", ",", "nil", "\n", "}" ]
2,404
all-2405
[ "GetCreateFlags", "registers", "the", "flags", "this", "driver", "adds", "to", "docker", "hosts", "create" ]
[ "func", "(", "d", "*", "Driver", ")", "GetCreateFlags", "(", ")", "[", "]", "mcnflag", ".", "Flag", "{", "return", "[", "]", "mcnflag", ".", "Flag", "{", "mcnflag", ".", "IntFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "Value", ":", "defaultMemory", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "IntFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "Value", ":", "defaultCPU", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "IntFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "Value", ":", "defaultDiskSize", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "StringFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "<mask>", ":", "defaultBoot2DockerURL", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "StringFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "Value", ":", "defaultBoot2DockerImportVM", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "BoolFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "StringFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "Value", ":", "defaultHostOnlyNictype", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "StringFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "Value", ":", "defaultHostOnlyCIDR", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "StringFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "Value", ":", "defaultHostOnlyNictype", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "StringFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "Value", ":", "defaultHostOnlyPromiscMode", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "StringFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "Value", ":", "defaultUIType", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "BoolFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "BoolFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "BoolFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "BoolFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "EnvVar", ":", "\"", "\"", ",", "}", ",", "mcnflag", ".", "StringFlag", "{", "EnvVar", ":", "\"", "\"", ",", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "}", ",", "}", "\n", "}" ]
2,405
all-2406
[ "formatHex", "prints", "u", "as", "a", "hexadecimal", "integer", "in", "Go", "notation", "." ]
[ "func", "formatHex", "(", "u", "uint64", ")", "string", "{", "var", "f", "string", "\n", "switch", "{", "case", "u", "<=", "0xff", ":", "f", "=", "\"", "\"", "\n", "case", "u", "<=", "0xffff", ":", "f", "=", "\"", "\"", "\n", "<mask>", "u", "<=", "0xffffff", ":", "f", "=", "\"", "\"", "\n", "case", "u", "<=", "0xffffffff", ":", "f", "=", "\"", "\"", "\n", "case", "u", "<=", "0xffffffffff", ":", "f", "=", "\"", "\"", "\n", "case", "u", "<=", "0xffffffffffff", ":", "f", "=", "\"", "\"", "\n", "case", "u", "<=", "0xffffffffffffff", ":", "f", "=", "\"", "\"", "\n", "case", "u", "<=", "0xffffffffffffffff", ":", "f", "=", "\"", "\"", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "f", ",", "u", ")", "\n", "}" ]
2,406
all-2407
[ "reversedLabelsToIPv6", "reverses", "the", "provided", "labels", "(", "assumed", "to", "be", "32", "labels", "one", "per", "nibble", "of", "an", "IPv6", "address", ")", "and", "constructs", "an", "IPv6", "address", "returning", "the", "result", "of", "calling", "net", ".", "ParseIP", "for", "the", "constructed", "address", "." ]
[ "func", "reversedLabelsToIPv6", "(", "labels", "[", "]", "string", ")", "<mask>", ".", "IP", "{", "var", "buf", "strings", ".", "Builder", "\n\n", "// If there aren't the right number of labels, it isn't an IPv6 address.", "if", "len", "(", "labels", ")", "!=", "rdnsIPv6Labels", "{", "return", "nil", "\n", "}", "\n\n", "// An IPv6 address is represented as eight groups of two bytes separated", "// by `:` in hex form. Since each label in the rDNS form is one nibble we need", "// four label components per IPv6 address component group.", "for", "i", ":=", "len", "(", "labels", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "-=", "4", "{", "buf", ".", "WriteString", "(", "labels", "[", "i", "]", ")", "\n", "buf", ".", "WriteString", "(", "labels", "[", "i", "-", "1", "]", ")", "\n", "buf", ".", "WriteString", "(", "labels", "[", "i", "-", "2", "]", ")", "\n", "buf", ".", "WriteString", "(", "labels", "[", "i", "-", "3", "]", ")", "\n", "if", "i", ">", "4", "{", "buf", ".", "WriteString", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "return", "net", ".", "ParseIP", "(", "buf", ".", "String", "(", ")", ")", "\n", "}" ]
2,407
all-2408
[ "AbsorbPiece", "absorbs", "the", "piece", "at", "(", "x", "y", ")", "with", "the", "given", "angle", "into", "the", "field", "." ]
[ "func", "(", "f", "*", "<mask>", ")", "AbsorbPiece", "(", "piece", "*", "Piece", ",", "x", ",", "y", "int", ",", "angle", "Angle", ")", "{", "piece", ".", "AbsorbInto", "(", "f", ",", "x", ",", "y", ",", "angle", ")", "\n", "if", "f", ".", "flushable", "(", ")", "{", "f", ".", "flushCount", "=", "maxFlushCount", "\n", "}", "\n", "}" ]
2,408
all-2409
[ "Wrap", "returns", "an", "error", "that", "wraps", "err", "optionally", "annotating", "with", "the", "message", "text", "." ]
[ "func", "Wrap", "(", "err", "error", ",", "text", "...", "string", ")", "Error", "{", "return", "causer", "(", "newError", "(", "nil", ",", "err", ",", "<mask>", "...", ")", ")", "\n", "}" ]
2,409
all-2410
[ "Set", "updates", "the", "value", "stored", "at", "a", "given", "position", "in", "the", "List", "." ]
[ "func", "(", "l", "*", "List", ")", "Set", "(", "pos", "uint", ",", "val", "interface", "{", "}", ")", "bool", "{", "l", ".", "key", ".", "Lock", "(", ")", "\n", "defer", "l", ".", "key", ".", "Unlock", "(", ")", "\n", "var", "retval", "bool", "\n", "count", ":=", "uint", "(", "len", "(", "l", ".", "underlyer", ")", ")", "\n", "if", "pos", ">", "count", "{", "retval", "=", "false", "\n", "}", "else", "{", "l", ".", "underlyer", "[", "<mask>", "]", "=", "val", "\n", "retval", "=", "true", "\n", "}", "\n", "return", "retval", "\n", "}" ]
2,410
all-2411
[ "control", "clip", "coordinate", "to", "window", "coordinate", "behavior" ]
[ "func", "ClipControl", "(", "origin", "uint32", ",", "depth", "uint32", ")", "{", "syscall", ".", "Syscall", "(", "gpClipControl", ",", "2", ",", "uintptr", "(", "origin", ")", ",", "uintptr", "(", "<mask>", ")", ",", "0", ")", "\n", "}" ]
2,411
all-2412
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "CreateBrowserContextReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoTarget24", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
2,412
all-2413
[ "lockPath", "obtains", "the", "pathLock", "for", "path", ".", "The", "caller", "must", "call", "unlockPath", "eventually", "." ]
[ "func", "lockPath", "(", "path", "string", ")", "{", "pl", ":=", "func", "(", ")", "*", "pathLock", "{", "// A scope for defer", "pathLocksMutex", ".", "Lock", "(", ")", "\n", "defer", "pathLocksMutex", ".", "Unlock", "(", ")", "\n", "pl", ",", "<mask>", ":=", "pathLocks", "[", "path", "]", "\n", "if", "ok", "{", "pl", ".", "refCount", "++", "\n", "}", "else", "{", "pl", "=", "&", "pathLock", "{", "refCount", ":", "1", ",", "mutex", ":", "sync", ".", "Mutex", "{", "}", "}", "\n", "pathLocks", "[", "path", "]", "=", "pl", "\n", "}", "\n", "return", "pl", "\n", "}", "(", ")", "\n", "pl", ".", "mutex", ".", "Lock", "(", ")", "\n", "}" ]
2,413
all-2414
[ "AddData", "appends", "a", "new", "bar", "to", "a", "chart" ]
[ "func", "(", "b", "*", "BarChart", ")", "AddData", "(", "val", "BarData", ")", "{", "b", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "b", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "b", ".", "data", "=", "append", "(", "b", ".", "<mask>", ",", "val", ")", "\n", "}" ]
2,414
all-2415
[ "NewStateManager", "indicates", "an", "expected", "call", "of", "NewStateManager" ]
[ "func", "(", "mr", "*", "MockStateManagerMockRecorder", ")", "NewStateManager", "(", "arg0", "<mask>", "{", "}", ",", "arg1", "...", "interface", "{", "}", ")", "*", "gomock", ".", "Call", "{", "varargs", ":=", "append", "(", "[", "]", "interface", "{", "}", "{", "arg0", "}", ",", "arg1", "...", ")", "\n", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockStateManager", ")", "(", "nil", ")", ".", "NewStateManager", ")", ",", "varargs", "...", ")", "\n", "}" ]
2,415
all-2416
[ "CreateRepo", "creates", "a", "new", "Repo", "object", "in", "pfs", "with", "the", "given", "name", ".", "Repos", "are", "the", "top", "level", "data", "object", "in", "pfs", "and", "should", "be", "used", "to", "store", "data", "of", "a", "similar", "type", ".", "For", "example", "rather", "than", "having", "a", "single", "Repo", "for", "an", "entire", "project", "you", "might", "have", "separate", "Repos", "for", "logs", "metrics", "database", "dumps", "etc", "." ]
[ "func", "(", "c", "APIClient", ")", "CreateRepo", "(", "repoName", "<mask>", ")", "error", "{", "_", ",", "err", ":=", "c", ".", "PfsAPIClient", ".", "CreateRepo", "(", "c", ".", "Ctx", "(", ")", ",", "&", "pfs", ".", "CreateRepoRequest", "{", "Repo", ":", "NewRepo", "(", "repoName", ")", ",", "}", ",", ")", "\n", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}" ]
2,416
all-2417
[ "Next", "returns", "the", "next", "page", "of", "resources", ".", "If", "there", "are", "no", "more", "resources", "NoMoreResults", "is", "returned", "." ]
[ "func", "(", "c", "*", "CountryPricePageIterator", ")", "Next", "(", "ctx", "<mask>", ".", "Context", ")", "(", "*", "CountriesPricePage", ",", "error", ")", "{", "cp", ":=", "new", "(", "CountriesPricePage", ")", "\n", "err", ":=", "c", ".", "p", ".", "Next", "(", "ctx", ",", "cp", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "c", ".", "p", ".", "SetNextPageURI", "(", "cp", ".", "Meta", ".", "NextPageURL", ")", "\n", "return", "cp", ",", "nil", "\n", "}" ]
2,417
all-2418
[ "specify", "a", "three", "-", "dimensional", "texture", "image", "in", "a", "compressed", "format" ]
[ "func", "CompressedTexImage3D", "(", "target", "uint32", ",", "level", "int32", ",", "internalformat", "uint32", ",", "width", "int32", ",", "height", "int32", ",", "depth", "int32", ",", "border", "int32", ",", "imageSize", "int32", ",", "data", "unsafe", ".", "Pointer", ")", "{", "syscall", ".", "Syscall9", "(", "gpCompressedTexImage3D", ",", "9", ",", "uintptr", "(", "target", ")", ",", "uintptr", "(", "level", ")", ",", "uintptr", "(", "internalformat", ")", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "height", ")", ",", "uintptr", "(", "depth", ")", ",", "uintptr", "(", "border", ")", ",", "uintptr", "(", "imageSize", ")", ",", "uintptr", "(", "data", ")", ")", "\n", "}" ]
2,418
all-2419
[ "UnapprovedFiles", "returns", "owners", "files", "that", "still", "need", "approval" ]
[ "func", "(", "ap", "Approvers", ")", "UnapprovedFiles", "(", ")", "sets", ".", "<mask>", "{", "unapproved", ":=", "sets", ".", "NewString", "(", ")", "\n", "for", "fn", ",", "approvers", ":=", "range", "ap", ".", "GetFilesApprovers", "(", ")", "{", "if", "len", "(", "approvers", ")", "==", "0", "{", "unapproved", ".", "Insert", "(", "fn", ")", "\n", "}", "\n", "}", "\n", "return", "unapproved", "\n", "}" ]
2,419
all-2420
[ "BuildLeet", "builds", "the", "L33T", "Graph" ]
[ "func", "BuildLeet", "(", ")", "Graph", "{", "data", ",", "err", ":=", "<mask>", ".", "Asset", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "getAdjancencyGraphFromFile", "(", "data", ",", "\"", "\"", ")", "\n", "}" ]
2,420
all-2421
[ "Has", "returns", "true", "if", "the", "label", "with", "the", "given", "name", "is", "present", "." ]
[ "func", "(", "ls", "Labels", ")", "Has", "(", "name", "string", ")", "bool", "{", "for", "_", ",", "l", ":=", "range", "ls", "{", "if", "l", ".", "<mask>", "==", "name", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
2,421
all-2422
[ "getLastActivityTime", "returns", "the", "timestamp", "of", "the", "last", "frame", "read", "or", "written", "excluding", "pings", ".", "If", "no", "frames", "were", "transmitted", "yet", "it", "will", "return", "the", "time", "this", "connection", "was", "created", "." ]
[ "func", "(", "c", "*", "Connection", ")", "getLastActivityTime", "(", ")", "<mask>", ".", "Time", "{", "return", "time", ".", "Unix", "(", "0", ",", "c", ".", "lastActivity", ".", "Load", "(", ")", ")", "\n", "}" ]
2,422
all-2423
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetObjectByHeapObjectIDParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeapprofiler12", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
2,423
all-2424
[ "determine", "if", "textures", "are", "loaded", "in", "texture", "memory" ]
[ "func", "AreTexturesResident", "(", "n", "int32", ",", "textures", "*", "uint32", ",", "residences", "*", "bool", ")", "bool", "{", "ret", ",", "_", ",", "_", ":=", "syscall", ".", "Syscall", "(", "gpAreTexturesResident", ",", "3", ",", "uintptr", "(", "n", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "textures", ")", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "residences", ")", ")", ")", "\n", "return", "<mask>", "!=", "0", "\n", "}" ]
2,424
all-2425
[ "ToInterfaceSlice", "convert", "to", "[]", "interface", "{}", "from", "[]", "string", "." ]
[ "func", "ToInterfaceSlice", "(", "slice", "[", "]", "string", ")", "[", "]", "interface", "{", "}", "{", "result", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "len", "(", "slice", ")", ")", "\n", "for", "i", ",", "v", ":=", "range", "slice", "{", "result", "[", "i", "]", "=", "v", "\n", "}", "\n", "return", "<mask>", "\n", "}" ]
2,425
all-2426
[ "MergeCommitsExistBetween", "runs", "git", "log", "<target", ">", "..", "<head", ">", "--", "merged", "to", "verify", "if", "merge", "commits", "exist", "between", "target", "and", "head", "." ]
[ "func", "(", "r", "*", "Repo", ")", "MergeCommitsExistBetween", "(", "target", ",", "head", "string", ")", "(", "bool", ",", "error", ")", "{", "r", ".", "logger", ".", "Infof", "(", "\"", "\"", ",", "<mask>", ",", "head", ")", "\n", "b", ",", "err", ":=", "r", ".", "gitCommand", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "target", ",", "head", ")", ",", "\"", "\"", ",", "\"", "\"", ")", ".", "CombinedOutput", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "target", ",", "head", ",", "err", ",", "string", "(", "b", ")", ")", "\n", "}", "\n", "return", "len", "(", "b", ")", "!=", "0", ",", "nil", "\n", "}" ]
2,426
all-2427
[ "GetCreatorOk", "returns", "a", "tuple", "with", "the", "Creator", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "a", "*", "Alert", ")", "GetCreatorOk", "(", ")", "(", "int", ",", "bool", ")", "{", "if", "a", "==", "nil", "||", "a", ".", "Creator", "==", "nil", "{", "return", "0", ",", "false", "\n", "}", "\n", "return", "*", "a", ".", "Creator", ",", "<mask>", "\n", "}" ]
2,427
all-2428
[ "UpdateSpeed", "will", "set", "the", "indicator", "delay", "to", "the", "given", "value" ]
[ "func", "(", "s", "*", "Spinner", ")", "UpdateSpeed", "(", "d", "time", ".", "Duration", ")", "{", "s", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "<mask>", ".", "Unlock", "(", ")", "\n", "s", ".", "Delay", "=", "d", "\n", "}" ]
2,428
all-2429
[ "NewNetwork", "returns", "Network", "built", "using", "given", "net", ".", "IPNet", "." ]
[ "func", "NewNetwork", "(", "ipNet", "<mask>", ".", "IPNet", ")", "Network", "{", "return", "Network", "{", "IPNet", ":", "ipNet", ",", "Number", ":", "NewNetworkNumber", "(", "ipNet", ".", "IP", ")", ",", "Mask", ":", "NetworkNumberMask", "(", "NewNetworkNumber", "(", "net", ".", "IP", "(", "ipNet", ".", "Mask", ")", ")", ")", ",", "}", "\n", "}" ]
2,429
all-2430
[ "detectMultipartMessage", "returns", "true", "if", "the", "message", "has", "a", "recognized", "multipart", "Content", "-", "Type", "header" ]
[ "func", "detectMultipartMessage", "(", "root", "*", "Part", ")", "bool", "{", "// Parse top-level multipart", "ctype", ":=", "<mask>", ".", "Header", ".", "Get", "(", "hnContentType", ")", "\n", "mediatype", ",", "_", ",", "_", ",", "err", ":=", "parseMediaType", "(", "ctype", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", "\n", "}", "\n", "// According to rfc2046#section-5.1.7 all other multipart should", "// be treated as multipart/mixed", "return", "strings", ".", "HasPrefix", "(", "mediatype", ",", "ctMultipartPrefix", ")", "\n", "}" ]
2,430
all-2431
[ "NewServer", "returns", "a", "proxy", "implementation", "with", "no", "iptables", "/", "tc", "dependencies", ".", "The", "proxy", "layer", "overhead", "is", "<1ms", "." ]
[ "func", "NewServer", "(", "cfg", "ServerConfig", ")", "Server", "{", "s", ":=", "&", "server", "{", "lg", ":", "cfg", ".", "Logger", ",", "from", ":", "cfg", ".", "From", ",", "to", ":", "cfg", ".", "To", ",", "tlsInfo", ":", "cfg", ".", "TLSInfo", ",", "dialTimeout", ":", "cfg", ".", "DialTimeout", ",", "bufferSize", ":", "cfg", ".", "BufferSize", ",", "retryInterval", ":", "cfg", ".", "RetryInterval", ",", "readyc", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "donec", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "errc", ":", "make", "(", "chan", "error", ",", "16", ")", ",", "pauseAcceptc", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "pauseTxc", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "pauseRxc", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "}", "\n\n", "_", ",", "fromPort", ",", "err", ":=", "<mask>", ".", "SplitHostPort", "(", "cfg", ".", "From", ".", "Host", ")", "\n", "if", "err", "==", "nil", "{", "s", ".", "fromPort", ",", "_", "=", "strconv", ".", "Atoi", "(", "fromPort", ")", "\n", "}", "\n", "var", "toPort", "string", "\n", "_", ",", "toPort", ",", "err", "=", "net", ".", "SplitHostPort", "(", "cfg", ".", "To", ".", "Host", ")", "\n", "if", "err", "==", "nil", "{", "s", ".", "toPort", ",", "_", "=", "strconv", ".", "Atoi", "(", "toPort", ")", "\n", "}", "\n\n", "if", "s", ".", "dialTimeout", "==", "0", "{", "s", ".", "dialTimeout", "=", "defaultDialTimeout", "\n", "}", "\n", "if", "s", ".", "bufferSize", "==", "0", "{", "s", ".", "bufferSize", "=", "defaultBufferSize", "\n", "}", "\n", "if", "s", ".", "retryInterval", "==", "0", "{", "s", ".", "retryInterval", "=", "defaultRetryInterval", "\n", "}", "\n", "if", "s", ".", "lg", "==", "nil", "{", "s", ".", "lg", "=", "defaultLogger", "\n", "}", "\n\n", "close", "(", "s", ".", "pauseAcceptc", ")", "\n", "close", "(", "s", ".", "pauseTxc", ")", "\n", "close", "(", "s", ".", "pauseRxc", ")", "\n\n", "if", "strings", ".", "HasPrefix", "(", "s", ".", "from", ".", "Scheme", ",", "\"", "\"", ")", "{", "s", ".", "from", ".", "Scheme", "=", "\"", "\"", "\n", "}", "\n", "if", "strings", ".", "HasPrefix", "(", "s", ".", "to", ".", "Scheme", ",", "\"", "\"", ")", "{", "s", ".", "to", ".", "Scheme", "=", "\"", "\"", "\n", "}", "\n\n", "addr", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "s", ".", "fromPort", ")", "\n", "if", "s", ".", "fromPort", "==", "0", "{", "// unix", "addr", "=", "s", ".", "from", ".", "Host", "\n", "}", "\n\n", "var", "ln", "net", ".", "Listener", "\n", "if", "!", "s", ".", "tlsInfo", ".", "Empty", "(", ")", "{", "ln", ",", "err", "=", "transport", ".", "NewListener", "(", "addr", ",", "s", ".", "from", ".", "Scheme", ",", "&", "s", ".", "tlsInfo", ")", "\n", "}", "else", "{", "ln", ",", "err", "=", "net", ".", "Listen", "(", "s", ".", "from", ".", "Scheme", ",", "addr", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "s", ".", "errc", "<-", "err", "\n", "s", ".", "Close", "(", ")", "\n", "return", "s", "\n", "}", "\n", "s", ".", "listener", "=", "ln", "\n\n", "s", ".", "closeWg", ".", "Add", "(", "1", ")", "\n", "go", "s", ".", "listenAndServe", "(", ")", "\n\n", "s", ".", "lg", ".", "Info", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "s", ".", "From", "(", ")", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "s", ".", "To", "(", ")", ")", ")", "\n", "return", "s", "\n", "}" ]
2,431
all-2432
[ "HasTitle", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TraceServiceDefinition", ")", "HasTitle", "(", ")", "bool", "{", "if", "t", "!=", "nil", "&&", "t", ".", "Title", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
2,432
all-2433
[ "For", "use", "with", "golang", "/", "crypto", "/", "nacl", "/", "box", "If", "error", "returns", "nil", "." ]
[ "func", "(", "pubKey", "PubKeyEd25519", ")", "ToCurve25519", "(", ")", "*", "[", "32", "]", "byte", "{", "keyCurve25519", ",", "pubKeyBytes", ":=", "<mask>", "(", "[", "32", "]", "byte", ")", ",", "[", "32", "]", "byte", "(", "pubKey", ")", "\n", "ok", ":=", "extra25519", ".", "PublicKeyToCurve25519", "(", "keyCurve25519", ",", "&", "pubKeyBytes", ")", "\n", "if", "!", "ok", "{", "return", "nil", "\n", "}", "\n", "return", "keyCurve25519", "\n", "}" ]
2,433
all-2434
[ "UpdateDesiredStatus", "sets", "the", "known", "status", "of", "the", "task" ]
[ "func", "(", "task", "*", "<mask>", ")", "UpdateDesiredStatus", "(", ")", "{", "task", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "task", ".", "lock", ".", "Unlock", "(", ")", "\n", "task", ".", "updateTaskDesiredStatusUnsafe", "(", ")", "\n", "task", ".", "updateContainerDesiredStatusUnsafe", "(", "task", ".", "DesiredStatusUnsafe", ")", "\n", "task", ".", "updateResourceDesiredStatusUnsafe", "(", "task", ".", "DesiredStatusUnsafe", ")", "\n", "}" ]
2,434
all-2435
[ "LastContact", "returns", "the", "time", "of", "last", "contact", "by", "a", "leader", ".", "This", "only", "makes", "sense", "if", "we", "are", "currently", "a", "follower", "." ]
[ "func", "(", "r", "*", "Raft", ")", "LastContact", "(", ")", "<mask>", ".", "Time", "{", "r", ".", "lastContactLock", ".", "RLock", "(", ")", "\n", "last", ":=", "r", ".", "lastContact", "\n", "r", ".", "lastContactLock", ".", "RUnlock", "(", ")", "\n", "return", "last", "\n", "}" ]
2,435
all-2436
[ "ReadTarget", "returns", "the", "current", "target", "as", "defined", "in", "the", "TSURU_TARGET", "environment", "variable", "or", "in", "the", "target", "file", "." ]
[ "func", "ReadTarget", "(", ")", "(", "string", ",", "error", ")", "{", "if", "target", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", ";", "target", "!=", "\"", "\"", "{", "targets", ",", "err", ":=", "getTargets", "(", ")", "\n", "if", "err", "==", "nil", "{", "if", "val", ",", "ok", ":=", "targets", "[", "target", "]", ";", "ok", "{", "return", "val", ",", "nil", "\n", "}", "\n", "}", "\n", "return", "target", ",", "nil", "\n", "}", "\n", "targetPath", ":=", "JoinWithUserDir", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "target", ",", "err", ":=", "readTarget", "(", "targetPath", ")", "\n", "if", "err", "==", "errUndefinedTarget", "{", "copyTargetFiles", "(", ")", "\n", "<mask>", ",", "err", "=", "readTarget", "(", "JoinWithUserDir", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "return", "target", ",", "err", "\n", "}" ]
2,436
all-2437
[ "<bare", "-", "function", "-", "type", ">", "::", "=", "[", "J", "]", "<type", ">", "+" ]
[ "func", "(", "st", "*", "state", ")", "bareFunctionType", "(", "hasReturnType", "bool", ")", "AST", "{", "if", "len", "(", "st", ".", "str", ")", ">", "0", "&&", "st", ".", "str", "[", "0", "]", "==", "'J'", "{", "hasReturnType", "=", "true", "\n", "st", ".", "advance", "(", "1", ")", "\n", "}", "\n", "var", "returnType", "AST", "\n", "if", "hasReturnType", "{", "returnType", "=", "st", ".", "demangleType", "(", "<mask>", ")", "\n", "}", "\n", "types", ":=", "st", ".", "parmlist", "(", ")", "\n", "return", "&", "FunctionType", "{", "Return", ":", "returnType", ",", "Args", ":", "types", "}", "\n", "}" ]
2,437
all-2438
[ "Get", "returns", "the", "variable", "stored", "in", "slot", "x" ]
[ "func", "(", "v", "Vars", ")", "Get", "(", "k", "interface", "{", "}", ")", "(", "interface", "{", "}", ",", "bool", ")", "{", "key", ",", "<mask>", ":=", "k", ".", "(", "string", ")", "\n", "if", "!", "ok", "{", "key", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "k", ")", "\n", "}", "\n", "x", ",", "ok", ":=", "v", "[", "key", "]", "\n", "return", "x", ",", "ok", "\n", "}" ]
2,438
all-2439
[ "restore", "restores", "the", "images", ".", "Restoring", "means", "to", "make", "all", "*", "graphicscommand", ".", "Image", "objects", "have", "their", "textures", "and", "framebuffers", "." ]
[ "func", "(", "i", "*", "images", ")", "restore", "(", ")", "error", "{", "if", "!", "IsRestoringEnabled", "(", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Dispose image explicitly", "for", "img", ":=", "range", "i", ".", "images", "{", "img", ".", "image", ".", "Dispose", "(", ")", "\n", "// img.image can't be set nil here, or Size() panics when restoring.", "}", "\n\n", "// Let's do topological sort based on dependencies of drawing history.", "// It is assured that there are not loops since cyclic drawing makes images stale.", "type", "edge", "struct", "{", "source", "*", "Image", "\n", "target", "*", "Image", "\n", "}", "\n", "images", ":=", "map", "[", "*", "Image", "]", "struct", "{", "}", "{", "}", "\n", "for", "i", ":=", "range", "i", ".", "images", "{", "if", "!", "i", ".", "priority", "{", "images", "[", "i", "]", "=", "struct", "{", "}", "{", "}", "\n", "}", "\n", "}", "\n", "edges", ":=", "map", "[", "edge", "]", "struct", "{", "}", "{", "}", "\n", "for", "t", ":=", "range", "images", "{", "for", "s", ":=", "range", "t", ".", "dependingImages", "(", ")", "{", "edges", "[", "edge", "{", "source", ":", "s", ",", "target", ":", "t", "}", "]", "=", "struct", "{", "}", "{", "}", "\n", "}", "\n", "}", "\n\n", "sorted", ":=", "[", "]", "*", "Image", "{", "}", "\n", "for", "i", ":=", "range", "i", ".", "images", "{", "if", "i", ".", "priority", "{", "sorted", "=", "append", "(", "sorted", ",", "i", ")", "\n", "}", "\n", "}", "\n", "for", "len", "(", "<mask>", ")", ">", "0", "{", "// current repesents images that have no incoming edges.", "current", ":=", "map", "[", "*", "Image", "]", "struct", "{", "}", "{", "}", "\n", "for", "i", ":=", "range", "images", "{", "current", "[", "i", "]", "=", "struct", "{", "}", "{", "}", "\n", "}", "\n", "for", "e", ":=", "range", "edges", "{", "if", "_", ",", "ok", ":=", "current", "[", "e", ".", "target", "]", ";", "ok", "{", "delete", "(", "current", ",", "e", ".", "target", ")", "\n", "}", "\n", "}", "\n", "for", "i", ":=", "range", "current", "{", "delete", "(", "images", ",", "i", ")", "\n", "sorted", "=", "append", "(", "sorted", ",", "i", ")", "\n", "}", "\n", "removed", ":=", "[", "]", "edge", "{", "}", "\n", "for", "e", ":=", "range", "edges", "{", "if", "_", ",", "ok", ":=", "current", "[", "e", ".", "source", "]", ";", "ok", "{", "removed", "=", "append", "(", "removed", ",", "e", ")", "\n", "}", "\n", "}", "\n", "for", "_", ",", "e", ":=", "range", "removed", "{", "delete", "(", "edges", ",", "e", ")", "\n", "}", "\n", "}", "\n\n", "for", "_", ",", "img", ":=", "range", "sorted", "{", "if", "err", ":=", "img", ".", "restore", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
2,439
all-2440
[ "Equals", "returns", "true", "if", "the", "checked", "URI", "is", "equivalent", "to", "this", "URI", "." ]
[ "func", "(", "u", "URI", ")", "Equals", "(", "other", "*", "URI", ")", "bool", "{", "if", "other", "==", "nil", "{", "return", "false", "\n", "}", "\n", "return", "u", ".", "scheme", "==", "<mask>", ".", "scheme", "&&", "u", ".", "host", "==", "other", ".", "host", "&&", "u", ".", "port", "==", "other", ".", "port", "\n", "}" ]
2,440
all-2441
[ "Top", "returns", "the", "element", "at", "the", "top", "of", "the", "stack", "or", "an", "error", "if", "stack", "is", "empty" ]
[ "func", "(", "s", "*", "Stack", ")", "Top", "(", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "if", "len", "(", "*", "s", ")", "==", "0", "{", "return", "nil", ",", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "(", "*", "s", ")", "[", "len", "(", "*", "s", ")", "-", "1", "]", ",", "nil", "\n", "}" ]
2,441
all-2442
[ "ProjectURIs", "returns", "all", "available", "project", "URIs", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "ProjectURIs", "(", "filter", "ProjectFilter", ")", "(", "[", "]", "string", ",", "error", ")", "{", "// Check which filter criteria are active.", "criteria", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "}", "\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", "{", "stmt", "=", "c", ".", "stmt", "(", "projectNamesByName", ")", "\n", "args", "=", "[", "]", "interface", "{", "}", "{", "filter", ".", "Name", ",", "}", "\n", "}", "else", "{", "stmt", "=", "c", ".", "stmt", "(", "projectNames", ")", "\n", "args", "=", "[", "]", "interface", "{", "}", "{", "}", "\n", "}", "\n\n", "<mask>", ":=", "cluster", ".", "EntityTypes", "[", "\"", "\"", "]", "\n", "formatter", ":=", "cluster", ".", "EntityFormatURIs", "[", "code", "]", "\n\n", "return", "query", ".", "SelectURIs", "(", "stmt", ",", "formatter", ",", "args", "...", ")", "\n", "}" ]
2,442
all-2443
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetPlaybackRateParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoAnimation1", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
2,443
all-2444
[ "FuzzConnAfter", "creates", "a", "new", "FuzzedConnection", ".", "Fuzzing", "starts", "when", "the", "duration", "elapses", "." ]
[ "func", "FuzzConnAfter", "(", "conn", "net", ".", "Conn", ",", "d", "time", ".", "Duration", ")", "<mask>", ".", "Conn", "{", "return", "FuzzConnAfterFromConfig", "(", "conn", ",", "d", ",", "DefaultFuzzConnConfig", "(", ")", ")", "\n", "}" ]
2,444
all-2445
[ "SetLeftMargin", "()", "is", "a", "wrapper", "around", "gtk_page_setup_set_left_margin", "()", "." ]
[ "func", "(", "ps", "*", "PageSetup", ")", "SetLeftMargin", "(", "<mask>", "float64", ",", "unit", "Unit", ")", "{", "C", ".", "gtk_page_setup_set_left_margin", "(", "ps", ".", "native", "(", ")", ",", "C", ".", "gdouble", "(", "margin", ")", ",", "C", ".", "GtkUnit", "(", "unit", ")", ")", "\n", "}" ]
2,445
all-2446
[ "electSelf", "is", "used", "to", "send", "a", "RequestVote", "RPC", "to", "all", "peers", "and", "vote", "for", "ourself", ".", "This", "has", "the", "side", "affecting", "of", "incrementing", "the", "current", "term", ".", "The", "response", "channel", "returned", "is", "used", "to", "wait", "for", "all", "the", "responses", "(", "including", "a", "vote", "for", "ourself", ")", ".", "This", "must", "only", "be", "called", "from", "the", "main", "thread", "." ]
[ "func", "(", "r", "*", "Raft", ")", "electSelf", "(", ")", "<-", "chan", "*", "voteResult", "{", "// Create a response channel", "respCh", ":=", "make", "(", "chan", "*", "voteResult", ",", "len", "(", "r", ".", "configurations", ".", "latest", ".", "Servers", ")", ")", "\n\n", "// Increment the term", "r", ".", "setCurrentTerm", "(", "r", ".", "getCurrentTerm", "(", ")", "+", "1", ")", "\n\n", "// Construct the request", "lastIdx", ",", "lastTerm", ":=", "r", ".", "getLastEntry", "(", ")", "\n", "req", ":=", "&", "RequestVoteRequest", "{", "RPCHeader", ":", "r", ".", "getRPCHeader", "(", ")", ",", "Term", ":", "r", ".", "getCurrentTerm", "(", ")", ",", "Candidate", ":", "r", ".", "trans", ".", "EncodePeer", "(", "r", ".", "localID", ",", "r", ".", "localAddr", ")", ",", "LastLogIndex", ":", "lastIdx", ",", "LastLogTerm", ":", "lastTerm", ",", "}", "\n\n", "// Construct a function to ask for a vote", "askPeer", ":=", "func", "(", "peer", "Server", ")", "{", "r", ".", "goFunc", "(", "func", "(", ")", "{", "defer", "metrics", ".", "MeasureSince", "(", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", ",", "time", ".", "Now", "(", ")", ")", "\n", "resp", ":=", "&", "voteResult", "{", "voterID", ":", "peer", ".", "ID", "}", "\n", "err", ":=", "r", ".", "trans", ".", "RequestVote", "(", "peer", ".", "ID", ",", "<mask>", ".", "Address", ",", "req", ",", "&", "resp", ".", "RequestVoteResponse", ")", "\n", "if", "err", "!=", "nil", "{", "r", ".", "logger", ".", "Error", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "peer", ",", "err", ")", ")", "\n", "resp", ".", "Term", "=", "req", ".", "Term", "\n", "resp", ".", "Granted", "=", "false", "\n", "}", "\n", "respCh", "<-", "resp", "\n", "}", ")", "\n", "}", "\n\n", "// For each peer, request a vote", "for", "_", ",", "server", ":=", "range", "r", ".", "configurations", ".", "latest", ".", "Servers", "{", "if", "server", ".", "Suffrage", "==", "Voter", "{", "if", "server", ".", "ID", "==", "r", ".", "localID", "{", "// Persist a vote for ourselves", "if", "err", ":=", "r", ".", "persistVote", "(", "req", ".", "Term", ",", "req", ".", "Candidate", ")", ";", "err", "!=", "nil", "{", "r", ".", "logger", ".", "Error", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "err", ")", ")", "\n", "return", "nil", "\n", "}", "\n", "// Include our own vote", "respCh", "<-", "&", "voteResult", "{", "RequestVoteResponse", ":", "RequestVoteResponse", "{", "RPCHeader", ":", "r", ".", "getRPCHeader", "(", ")", ",", "Term", ":", "req", ".", "Term", ",", "Granted", ":", "true", ",", "}", ",", "voterID", ":", "r", ".", "localID", ",", "}", "\n", "}", "else", "{", "askPeer", "(", "server", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "respCh", "\n", "}" ]
2,446
all-2447
[ "Patch", "adds", "the", "route", "pattern", "that", "matches", "a", "PATCH", "http", "method", "to", "execute", "the", "handlerFn", "http", ".", "HandlerFunc", "." ]
[ "func", "(", "mx", "*", "Mux", ")", "Patch", "(", "pattern", "string", ",", "handlerFn", "<mask>", ".", "HandlerFunc", ")", "{", "mx", ".", "handle", "(", "mPATCH", ",", "pattern", ",", "handlerFn", ")", "\n", "}" ]
2,447
all-2448
[ "ToBoolOr", "parses", "s", "as", "a", "bool", "or", "returns", "defaultValue", "." ]
[ "func", "ToBoolOr", "(", "s", "string", ",", "defaultValue", "bool", ")", "bool", "{", "b", ",", "<mask>", ":=", "strconv", ".", "ParseBool", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "return", "defaultValue", "\n", "}", "\n", "return", "b", "\n", "}" ]
2,448
all-2449
[ "Lua", "5", ".", "1", "lua_tostring", "function", "only", "supports", "string", "and", "numbers", ".", "Extend", "it", "for", "internal", "purposes", ".", "From", "the", "Lua", "5", ".", "3", "source", "code", "." ]
[ "func", "luaToString", "(", "L", "*", "lua", ".", "State", ",", "idx", "int", ")", "string", "{", "switch", "L", ".", "Type", "(", "idx", ")", "{", "case", "lua", ".", "LUA_TNUMBER", ":", "L", ".", "PushValue", "(", "idx", ")", "\n", "defer", "L", ".", "Pop", "(", "1", ")", "\n", "return", "L", ".", "ToString", "(", "-", "1", ")", "\n", "<mask>", "lua", ".", "LUA_TSTRING", ":", "return", "L", ".", "ToString", "(", "-", "1", ")", "\n", "case", "lua", ".", "LUA_TBOOLEAN", ":", "b", ":=", "L", ".", "ToBoolean", "(", "idx", ")", "\n", "if", "b", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "\"", "\"", "\n", "case", "lua", ".", "LUA_TNIL", ":", "return", "\"", "\"", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "L", ".", "LTypename", "(", "idx", ")", ",", "L", ".", "ToPointer", "(", "idx", ")", ")", "\n", "}" ]
2,449
all-2450
[ "FixedNew", "is", "a", "wrapper", "around", "gtk_fixed_new", "()", "." ]
[ "func", "FixedNew", "(", ")", "(", "*", "Fixed", ",", "<mask>", ")", "{", "c", ":=", "C", ".", "gtk_fixed_new", "(", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "wrapFixed", "(", "obj", ")", ",", "nil", "\n", "}" ]
2,450
all-2451
[ "Endpoint", "returns", "a", "URL", "constructed", "from", "parts", "and", "version", "appended", "e", ".", "g", ".", "c", ".", "Endpoint", "(", "user", "john", ")", "//", "returns", "/", "v1", "/", "users", "/", "john" ]
[ "func", "(", "c", "*", "<mask>", ")", "Endpoint", "(", "params", "...", "string", ")", "string", "{", "if", "c", ".", "v", "!=", "\"", "\"", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "addr", ",", "c", ".", "v", ",", "strings", ".", "Join", "(", "params", ",", "\"", "\"", ")", ")", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "addr", ",", "strings", ".", "Join", "(", "params", ",", "\"", "\"", ")", ")", "\n", "}" ]
2,451
all-2452
[ "UnmarshalJSON", "implements", "JSON", "Unmarshaler", "interface" ]
[ "func", "(", "ud", "*", "UserData", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "tmpMap", ":=", "UserDataMap", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "&", "tmpMap", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "ud", ".", "FromMap", "(", "tmpMap", ")", "\n", "return", "nil", "\n", "}" ]
2,452
all-2453
[ "Release", "marks", "leaving", "of", "an", "accessor", "in", "the", "skiplist" ]
[ "func", "(", "ab", "*", "AccessBarrier", ")", "Release", "(", "bs", "*", "BarrierSession", ")", "{", "if", "ab", ".", "<mask>", "{", "liveCount", ":=", "atomic", ".", "AddInt32", "(", "bs", ".", "liveCount", ",", "-", "1", ")", "\n", "if", "liveCount", "==", "barrierFlushOffset", "{", "buf", ":=", "ab", ".", "freeq", ".", "MakeBuf", "(", ")", "\n", "defer", "ab", ".", "freeq", ".", "FreeBuf", "(", "buf", ")", "\n\n", "// Accessors which entered a closed barrier session steps down automatically", "// But, they may try to close an already closed session.", "if", "atomic", ".", "AddInt32", "(", "&", "bs", ".", "closed", ",", "1", ")", "==", "1", "{", "ab", ".", "freeq", ".", "Insert", "(", "unsafe", ".", "Pointer", "(", "bs", ")", ",", "CompareBS", ",", "buf", ",", "&", "ab", ".", "freeq", ".", "Stats", ")", "\n", "if", "atomic", ".", "CompareAndSwapInt32", "(", "&", "ab", ".", "isDestructorRunning", ",", "0", ",", "1", ")", "{", "ab", ".", "doCleanup", "(", ")", "\n", "atomic", ".", "CompareAndSwapInt32", "(", "&", "ab", ".", "isDestructorRunning", ",", "1", ",", "0", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "}" ]
2,453
all-2454
[ "createHardDisk", "creates", "a", "new", "Hard", "Disk", "." ]
[ "func", "createHardDisk", "(", "client", "*", "govmomi", ".", "Client", ",", "size", "int", ",", "diskPath", "string", ",", "diskType", "string", ",", "adapterType", "string", ",", "dc", "string", ")", "error", "{", "var", "vDiskType", "string", "\n", "switch", "diskType", "{", "case", "\"", "\"", ":", "vDiskType", "=", "\"", "\"", "\n", "case", "\"", "\"", ":", "vDiskType", "=", "\"", "\"", "\n", "case", "\"", "\"", ":", "vDiskType", "=", "\"", "\"", "\n", "}", "\n\n", "virtualDiskManager", ":=", "object", ".", "NewVirtualDiskManager", "(", "client", ".", "Client", ")", "\n", "<mask>", ":=", "&", "types", ".", "FileBackedVirtualDiskSpec", "{", "VirtualDiskSpec", ":", "types", ".", "VirtualDiskSpec", "{", "AdapterType", ":", "adapterType", ",", "DiskType", ":", "vDiskType", ",", "}", ",", "CapacityKb", ":", "int64", "(", "1024", "*", "1024", "*", "size", ")", ",", "}", "\n", "datacenter", ",", "err", ":=", "getDatacenter", "(", "client", ",", "dc", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "spec", ")", "\n\n", "task", ",", "err", ":=", "virtualDiskManager", ".", "CreateVirtualDisk", "(", "context", ".", "TODO", "(", ")", ",", "diskPath", ",", "datacenter", ",", "spec", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "_", ",", "err", "=", "task", ".", "WaitForResult", "(", "context", ".", "TODO", "(", ")", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "err", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ")", "\n\n", "return", "nil", "\n", "}" ]
2,454
all-2455
[ "WithTimeout", "adds", "the", "timeout", "to", "the", "get", "Vm", "by", "cid", "params" ]
[ "func", "(", "o", "*", "GetVMByCidParams", ")", "WithTimeout", "(", "timeout", "<mask>", ".", "Duration", ")", "*", "GetVMByCidParams", "{", "o", ".", "SetTimeout", "(", "timeout", ")", "\n", "return", "o", "\n", "}" ]
2,455
all-2456
[ "logName", "returns", "a", "new", "log", "file", "name", "containing", "tag", "with", "start", "time", "t", "and", "the", "name", "for", "the", "symlink", "for", "tag", "." ]
[ "func", "logName", "(", "logger", ",", "tag", "string", ",", "t", "time", ".", "Time", ")", "(", "name", ",", "link", "string", ")", "{", "name", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "program", ",", "host", ",", "userName", ",", "logger", ",", "tag", ",", "t", ".", "Year", "(", ")", ",", "t", ".", "Month", "(", ")", ",", "t", ".", "Day", "(", ")", ",", "t", ".", "Hour", "(", ")", ",", "t", ".", "Minute", "(", ")", ",", "t", ".", "Second", "(", ")", ",", "pid", ")", "\n", "return", "name", ",", "<mask>", "+", "\"", "\"", "+", "tag", "\n", "}" ]
2,456
all-2457
[ "GetType", "returns", "the", "Type", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "c", "*", "ChangeDefinition", ")", "GetType", "(", ")", "string", "{", "if", "c", "==", "nil", "||", "c", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "c", ".", "Type", "\n", "}" ]
2,457
all-2458
[ "Merge", "implements", "GossipData", "." ]
[ "func", "(", "d", "*", "surrogateGossipData", ")", "Merge", "(", "other", "GossipData", ")", "GossipData", "{", "o", ":=", "other", ".", "(", "*", "surrogateGossipData", ")", "\n", "messages", ":=", "make", "(", "[", "]", "[", "]", "<mask>", ",", "0", ",", "len", "(", "d", ".", "messages", ")", "+", "len", "(", "o", ".", "messages", ")", ")", "\n", "messages", "=", "append", "(", "messages", ",", "d", ".", "messages", "...", ")", "\n", "messages", "=", "append", "(", "messages", ",", "o", ".", "messages", "...", ")", "\n", "return", "&", "surrogateGossipData", "{", "messages", ":", "messages", "}", "\n", "}" ]
2,458
all-2459
[ "Check", "the", "user", "password", ".", "Graphics", "character", "are", "allowed", ".", "See", "unicode", ".", "IsGraphic", "." ]
[ "func", "CheckPassword", "(", "pass", "string", ",", "min", ",", "max", "int", ")", "error", "{", "if", "len", "(", "pass", ")", "<", "min", "||", "len", "(", "pass", ")", ">", "max", "{", "return", "e", ".", "New", "(", "ErrInvalidPassLength", ")", "\n", "}", "\n", "for", "_", ",", "r", ":=", "<mask>", "pass", "{", "if", "!", "unicode", ".", "IsGraphic", "(", "r", ")", "{", "return", "e", ".", "New", "(", "ErrInvalidPassChar", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
2,459
all-2460
[ "RunBoundedArgs", "wraps", "a", "function", "in", "a", "function", "that", "checks", "its", "argument", "count", "is", "within", "a", "range", "." ]
[ "func", "RunBoundedArgs", "(", "min", "int", ",", "max", "int", ",", "run", "func", "(", "[", "]", "string", ")", "error", ")", "func", "(", "*", "cobra", ".", "Command", ",", "[", "]", "string", ")", "{", "return", "func", "(", "cmd", "*", "cobra", ".", "Command", ",", "args", "[", "]", "string", ")", "{", "if", "len", "(", "args", ")", "<", "<mask>", "||", "len", "(", "args", ")", ">", "max", "{", "fmt", ".", "Printf", "(", "\"", "\\n", "\\n", "\"", ",", "min", ",", "max", ",", "len", "(", "args", ")", ")", "\n", "cmd", ".", "Usage", "(", ")", "\n", "}", "else", "{", "if", "err", ":=", "run", "(", "args", ")", ";", "err", "!=", "nil", "{", "ErrorAndExit", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}" ]
2,460
all-2461
[ "NewAPIServer", "returns", "a", "new", "admin", ".", "APIServer" ]
[ "func", "NewAPIServer", "(", "address", "string", ",", "storageRoot", "string", ",", "clusterInfo", "*", "admin", ".", "ClusterInfo", ")", "APIServer", "{", "return", "&", "apiServer", "{", "Logger", ":", "<mask>", ".", "NewLogger", "(", "\"", "\"", ")", ",", "address", ":", "address", ",", "storageRoot", ":", "storageRoot", ",", "clusterInfo", ":", "clusterInfo", ",", "}", "\n", "}" ]
2,461
all-2462
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "StreamCompression", ")", "MarshalEasyJSON", "(", "out", "*", "jwriter", ".", "Writer", ")", "{", "<mask>", ".", "String", "(", "string", "(", "t", ")", ")", "\n", "}" ]
2,462
all-2463
[ "Get", "implements", "storage", "interface", "." ]
[ "func", "(", "s", "*", "Storage", ")", "Get", "(", "ctx", "context", ".", "Context", ",", "accessToken", "string", ")", "(", "*", "mnemosynerpc", ".", "Session", ",", "error", ")", "{", "span", ",", "ctx", ":=", "opentracing", ".", "StartSpanFromContext", "(", "ctx", ",", "\"", "\"", ")", "\n", "defer", "span", ".", "Finish", "(", ")", "\n\n", "var", "entity", "sessionEntity", "\n", "start", ":=", "time", ".", "Now", "(", ")", "\n", "labels", ":=", "prometheus", ".", "Labels", "{", "\"", "\"", ":", "\"", "\"", "}", "\n\n", "err", ":=", "s", ".", "db", ".", "QueryRowContext", "(", "ctx", ",", "s", ".", "queryGet", ",", "accessToken", ")", ".", "Scan", "(", "&", "entity", ".", "RefreshToken", ",", "&", "entity", ".", "SubjectID", ",", "&", "entity", ".", "SubjectClient", ",", "&", "<mask>", ".", "Bag", ",", "&", "entity", ".", "ExpireAt", ",", ")", "\n", "s", ".", "incQueries", "(", "labels", ",", "start", ")", "\n", "if", "err", "!=", "nil", "{", "s", ".", "incError", "(", "labels", ")", "\n", "if", "err", "==", "sql", ".", "ErrNoRows", "{", "return", "nil", ",", "storage", ".", "ErrSessionNotFound", "\n", "}", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "expireAt", ",", "err", ":=", "ptypes", ".", "TimestampProto", "(", "entity", ".", "ExpireAt", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "mnemosynerpc", ".", "Session", "{", "AccessToken", ":", "accessToken", ",", "RefreshToken", ":", "entity", ".", "RefreshToken", ",", "SubjectId", ":", "entity", ".", "SubjectID", ",", "SubjectClient", ":", "entity", ".", "SubjectClient", ",", "Bag", ":", "entity", ".", "Bag", ",", "ExpireAt", ":", "expireAt", ",", "}", ",", "nil", "\n", "}" ]
2,463
all-2464
[ "HasTitleSize", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "d", "*", "DistributionDefinition", ")", "HasTitleSize", "(", ")", "bool", "{", "if", "d", "!=", "nil", "&&", "d", ".", "TitleSize", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
2,464
all-2465
[ "getNextWildcard", "tries", "to", "find", "next", "wildcard", "and", "update", "pattern", "with", "corresponding", "regexp", "." ]
[ "func", "getNextWildcard", "(", "pattern", "string", ")", "(", "wildcard", ",", "_", "string", ")", "{", "pos", ":=", "wildcardPattern", ".", "FindStringIndex", "(", "pattern", ")", "\n", "if", "pos", "==", "nil", "{", "return", "\"", "\"", ",", "pattern", "\n", "}", "\n", "wildcard", "=", "pattern", "[", "pos", "[", "0", "]", ":", "pos", "[", "1", "]", "]", "\n\n", "// Reach last character or no regexp is given.", "if", "len", "(", "pattern", ")", "==", "pos", "[", "1", "]", "{", "return", "wildcard", ",", "strings", ".", "Replace", "(", "pattern", ",", "wildcard", ",", "`(.+)`", ",", "1", ")", "\n", "}", "else", "if", "pattern", "[", "pos", "[", "1", "]", "]", "!=", "'('", "{", "switch", "{", "case", "isSpecialRegexp", "(", "pattern", ",", "\"", "\"", ",", "pos", ")", ":", "pattern", "=", "strings", ".", "Replace", "(", "pattern", ",", "\"", "\"", ",", "\"", "\"", ",", "1", ")", "\n", "case", "isSpecialRegexp", "(", "pattern", ",", "\"", "\"", ",", "pos", ")", ":", "pattern", "=", "strings", ".", "Replace", "(", "pattern", ",", "\"", "\"", ",", "\"", "\\\\", "\"", ",", "1", ")", "\n", "default", ":", "return", "wildcard", ",", "strings", ".", "Replace", "(", "pattern", ",", "wildcard", ",", "`(.+)`", ",", "1", ")", "\n", "}", "\n", "}", "\n\n", "// Cut out placeholder directly.", "return", "wildcard", ",", "pattern", "[", ":", "pos", "[", "0", "]", "]", "+", "<mask>", "[", "pos", "[", "1", "]", ":", "]", "\n", "}" ]
2,465
all-2466
[ "msb32", "returns", "the", "number", "of", "bits", "required", "to", "store", "the", "value", "x" ]
[ "func", "msb32", "(", "x", "uint32", ")", "int", "{", "pos", ":=", "32", "\n", "temp", ":=", "x", ">>", "16", "\n", "if", "temp", "!=", "0", "{", "pos", "-=", "16", "\n", "x", "=", "temp", "\n", "}", "\n", "temp", "=", "x", ">>", "8", "\n", "if", "temp", "!=", "0", "{", "pos", "-=", "8", "\n", "x", "=", "temp", "\n", "}", "\n", "temp", "=", "x", ">>", "4", "\n", "if", "temp", "!=", "0", "{", "pos", "-=", "4", "\n", "x", "=", "temp", "\n", "}", "\n", "temp", "=", "x", ">>", "2", "\n", "if", "temp", "!=", "0", "{", "pos", "-=", "2", "\n", "x", "=", "<mask>", "\n", "}", "\n", "temp", "=", "x", ">>", "1", "\n", "if", "temp", "!=", "0", "{", "return", "pos", "-", "2", "\n", "}", "\n\n", "return", "int", "(", "uint32", "(", "pos", ")", "-", "x", ")", "\n", "}" ]
2,466
all-2467
[ "compactionCommandFunc", "executes", "the", "compaction", "command", "." ]
[ "func", "compactionCommandFunc", "(", "cmd", "*", "cobra", ".", "Command", ",", "args", "[", "]", "string", ")", "{", "if", "len", "(", "args", ")", "!=", "1", "{", "ExitWithError", "(", "ExitBadArgs", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", ")", "\n", "}", "\n\n", "rev", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "args", "[", "0", "]", ",", "10", ",", "64", ")", "\n", "if", "err", "!=", "nil", "{", "ExitWithError", "(", "ExitError", ",", "err", ")", "\n", "}", "\n\n", "var", "opts", "[", "]", "clientv3", ".", "CompactOption", "\n", "if", "compactPhysical", "{", "opts", "=", "<mask>", "(", "opts", ",", "clientv3", ".", "WithCompactPhysical", "(", ")", ")", "\n", "}", "\n\n", "c", ":=", "mustClientFromCmd", "(", "cmd", ")", "\n", "ctx", ",", "cancel", ":=", "commandCtx", "(", "cmd", ")", "\n", "_", ",", "cerr", ":=", "c", ".", "Compact", "(", "ctx", ",", "rev", ",", "opts", "...", ")", "\n", "cancel", "(", ")", "\n", "if", "cerr", "!=", "nil", "{", "ExitWithError", "(", "ExitError", ",", "cerr", ")", "\n", "}", "\n", "fmt", ".", "Println", "(", "\"", "\"", ",", "rev", ")", "\n", "}" ]
2,467
all-2468
[ "Config", "fetches", "all", "LXD", "node", "-", "level", "config", "keys", "." ]
[ "func", "(", "n", "*", "NodeTx", ")", "Config", "(", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "return", "<mask>", ".", "SelectConfig", "(", "n", ".", "tx", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "}" ]
2,468
all-2469
[ "SetMetricTags", "sets", "the", "tags", "for", "the", "named", "metric", "and", "flags", "a", "check", "update", "is", "needed" ]
[ "func", "(", "m", "*", "CirconusMetrics", ")", "SetMetricTags", "(", "name", "string", ",", "tags", "[", "]", "string", ")", "bool", "{", "return", "m", ".", "check", ".", "AddMetricTags", "(", "name", ",", "<mask>", ",", "false", ")", "\n", "}" ]
2,469
all-2470
[ "cephRBDVolumeRename", "renames", "a", "given", "RBD", "storage", "volume", "Note", "that", "this", "usually", "requires", "that", "the", "image", "be", "unmapped", "under", "its", "original", "name", "then", "renamed", "and", "finally", "will", "be", "remapped", "again", ".", "If", "it", "is", "not", "unmapped", "under", "its", "original", "name", "and", "the", "callers", "maps", "it", "under", "its", "new", "name", "the", "image", "will", "be", "mapped", "twice", ".", "This", "will", "prevent", "it", "from", "being", "deleted", "." ]
[ "func", "cephRBDVolumeRename", "(", "clusterName", "string", ",", "poolName", "string", ",", "volumeType", "string", ",", "oldVolumeName", "string", ",", "newVolumeName", "string", ",", "userName", "string", ")", "error", "{", "_", ",", "err", ":=", "<mask>", ".", "RunCommand", "(", "\"", "\"", ",", "\"", "\"", ",", "userName", ",", "\"", "\"", ",", "clusterName", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "poolName", ",", "volumeType", ",", "oldVolumeName", ")", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "poolName", ",", "volumeType", ",", "newVolumeName", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
2,470
all-2471
[ "NextVenues", "returns", "venues", "that", "are", "checked", "into", "after", "the", "given", "one", "https", ":", "//", "developer", ".", "foursquare", ".", "com", "/", "docs", "/", "api", "/", "venues", "/", "nextvenues" ]
[ "func", "(", "s", "*", "VenueService", ")", "NextVenues", "(", "<mask>", "string", ")", "(", "[", "]", "Venue", ",", "*", "http", ".", "Response", ",", "error", ")", "{", "venues", ":=", "new", "(", "venueNextVenuesResp", ")", "\n", "response", ":=", "new", "(", "Response", ")", "\n\n", "resp", ",", "err", ":=", "s", ".", "sling", ".", "New", "(", ")", ".", "Get", "(", "id", "+", "\"", "\"", ")", ".", "Receive", "(", "response", ",", "response", ")", "\n", "if", "err", "==", "nil", "{", "json", ".", "Unmarshal", "(", "response", ".", "Response", ",", "venues", ")", "\n", "}", "\n\n", "return", "venues", ".", "NextVenues", ".", "Items", ",", "resp", ",", "relevantError", "(", "err", ",", "*", "response", ")", "\n", "}" ]
2,471
all-2472
[ "SetLabel", "is", "a", "wrapper", "around", "gtk_expander_set_label", "()", "." ]
[ "func", "(", "v", "*", "Expander", ")", "SetLabel", "(", "label", "string", ")", "{", "var", "cstr", "*", "C", ".", "char", "\n", "if", "label", "!=", "\"", "\"", "{", "cstr", "=", "C", ".", "CString", "(", "label", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "}", "\n", "C", ".", "gtk_expander_set_label", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}" ]
2,472
all-2473
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "Animation", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoAnimation19", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
2,473
all-2474
[ "PutFileOverwrite", "is", "like", "PutFile", "but", "it", "overwrites", "the", "file", "rather", "than", "appending", "to", "it", ".", "overwriteIndex", "allows", "you", "to", "specify", "the", "index", "of", "the", "object", "starting", "from", "which", "you", "d", "like", "to", "overwrite", ".", "If", "you", "want", "to", "overwrite", "the", "entire", "file", "specify", "an", "index", "of", "0", "." ]
[ "func", "(", "c", "*", "putFileClient", ")", "PutFileOverwrite", "(", "repoName", "string", ",", "commitID", "string", ",", "path", "string", ",", "reader", "io", ".", "Reader", ",", "overwriteIndex", "int64", ")", "(", "_", "int", ",", "retErr", "error", ")", "{", "writer", ",", "err", ":=", "c", ".", "newPutFileWriteCloser", "(", "repoName", ",", "commitID", ",", "path", ",", "pfs", ".", "Delimiter_NONE", ",", "0", ",", "0", ",", "0", ",", "&", "pfs", ".", "OverwriteIndex", "{", "Index", ":", "overwriteIndex", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "defer", "func", "(", ")", "{", "if", "err", ":=", "writer", ".", "Close", "(", ")", ";", "err", "!=", "nil", "&&", "retErr", "==", "nil", "{", "retErr", "=", "err", "\n", "}", "\n", "}", "(", ")", "\n", "written", ",", "err", ":=", "io", ".", "Copy", "(", "<mask>", ",", "reader", ")", "\n", "return", "int", "(", "written", ")", ",", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}" ]
2,474
all-2475
[ "reconcileOnce", "is", "used", "to", "reconcile", "the", "state", "of", "ENIs", "attached", "to", "the", "instance" ]
[ "func", "(", "udevWatcher", "*", "UdevWatcher", ")", "reconcileOnce", "(", ")", "error", "{", "links", ",", "err", ":=", "udevWatcher", ".", "netlinkClient", ".", "LinkList", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// Return on empty list", "if", "len", "(", "links", ")", "==", "0", "{", "log", ".", "Info", "(", "\"", "\"", ")", "\n", "return", "nil", "\n", "}", "\n\n", "currentState", ":=", "udevWatcher", ".", "buildState", "(", "links", ")", "\n\n", "// NOTE: For correct semantics, this entire function needs to be locked.", "// As we postulate the netlinkClient.LinkList() call to be expensive, we allow", "// the race here. The state would be corrected during the next reconciliation loop.", "// Add new interfaces next", "for", "mac", ":=", "<mask>", "currentState", "{", "if", "err", ":=", "udevWatcher", ".", "sendENIStateChange", "(", "mac", ")", ";", "err", "!=", "nil", "{", "log", ".", "Warnf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
2,475
all-2476
[ "Alias", "path", "patterns", "to", "the", "this", "route", ".", "This", "is", "not", "the", "same", "as", "a", "redirect", "." ]
[ "func", "(", "ri", "*", "RouteInfo", ")", "Alias", "(", "aliases", "...", "string", ")", "*", "RouteInfo", "{", "ri", ".", "Aliases", "=", "<mask>", "(", "ri", ".", "Aliases", ",", "aliases", "...", ")", "\n", "for", "_", ",", "a", ":=", "range", "aliases", "{", "ri", ".", "App", ".", "router", ".", "Handle", "(", "a", ",", "ri", ")", ".", "Methods", "(", "ri", ".", "Method", ")", "\n", "}", "\n", "return", "ri", "\n", "}" ]
2,476
all-2477
[ "Dump", "returns", "a", "text", "of", "SQL", "commands", "that", "can", "be", "used", "to", "create", "this", "schema", "from", "scratch", "in", "one", "go", "without", "going", "thorugh", "individual", "patches", "(", "essentially", "flattening", "them", ")", ".", "It", "requires", "that", "all", "patches", "in", "this", "schema", "have", "been", "applied", "otherwise", "an", "error", "will", "be", "returned", "." ]
[ "func", "(", "s", "*", "Schema", ")", "Dump", "(", "db", "*", "sql", ".", "DB", ")", "(", "string", ",", "error", ")", "{", "var", "statements", "[", "]", "string", "\n", "err", ":=", "query", ".", "Transaction", "(", "db", ",", "func", "(", "<mask>", "*", "sql", ".", "Tx", ")", "error", "{", "err", ":=", "checkAllUpdatesAreApplied", "(", "tx", ",", "s", ".", "updates", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "statements", ",", "err", "=", "selectTablesSQL", "(", "tx", ")", "\n", "return", "err", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "for", "i", ",", "statement", ":=", "range", "statements", "{", "statements", "[", "i", "]", "=", "formatSQL", "(", "statement", ")", "\n", "}", "\n\n", "// Add a statement for inserting the current schema version row.", "statements", "=", "append", "(", "statements", ",", "fmt", ".", "Sprintf", "(", "`\nINSERT INTO schema (version, updated_at) VALUES (%d, strftime(\"%%s\"))\n`", ",", "len", "(", "s", ".", "updates", ")", ")", ")", "\n", "return", "strings", ".", "Join", "(", "statements", ",", "\"", "\\n", "\"", ")", ",", "nil", "\n", "}" ]
2,477
all-2478
[ "/", "*", "Rendering", "void", "pango_cairo_show_glyph_string", "(", "cairo_t", "*", "cr", "PangoFont", "*", "font", "PangoGlyphString", "*", "glyphs", ")", ";" ]
[ "func", "CairoShowGlyphString", "(", "cr", "*", "cairo", ".", "Context", ",", "font", "*", "Font", ",", "glyphs", "*", "GlyphString", ")", "{", "C", ".", "pango_cairo_show_glyph_string", "(", "cairo_context", "(", "cr", ")", ",", "<mask>", ".", "native", "(", ")", ",", "glyphs", ".", "native", "(", ")", ")", "\n", "}" ]
2,478
all-2479
[ "Refresh", "pulls", "the", "current", "version", "of", "the", "operation", "and", "updates", "the", "struct" ]
[ "func", "(", "op", "*", "operation", ")", "Refresh", "(", ")", "error", "{", "// Get the current version of the operation", "newOp", ",", "_", ",", "err", ":=", "op", ".", "r", ".", "GetOperation", "(", "op", ".", "ID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Update the operation struct", "op", ".", "<mask>", "=", "*", "newOp", "\n\n", "return", "nil", "\n", "}" ]
2,479
all-2480
[ "RegisterAuthHandler", "registers", "the", "http", "handlers", "for", "service", "Auth", "to", "mux", ".", "The", "handlers", "forward", "requests", "to", "the", "grpc", "endpoint", "over", "conn", "." ]
[ "func", "RegisterAuthHandler", "(", "ctx", "<mask>", ".", "Context", ",", "mux", "*", "runtime", ".", "ServeMux", ",", "conn", "*", "grpc", ".", "ClientConn", ")", "error", "{", "return", "RegisterAuthHandlerClient", "(", "ctx", ",", "mux", ",", "etcdserverpb", ".", "NewAuthClient", "(", "conn", ")", ")", "\n", "}" ]
2,480
all-2481
[ "EncodePeer", "is", "used", "to", "serialize", "a", "peer", "name", "." ]
[ "func", "(", "t", "*", "transport", ")", "EncodePeer", "(", "id", "raft", ".", "ServerID", ",", "p", "raft", ".", "ServerAddress", ")", "[", "]", "<mask>", "{", "return", "[", "]", "byte", "(", "p", ")", "\n", "}" ]
2,481
all-2482
[ "ExtractVersion", "extracts", "a", "matching", "version", "from", "the", "version", "number", "string" ]
[ "func", "ExtractVersion", "(", "input", "string", ")", "string", "{", "versionNumberRegex", ":=", "regexp", ".", "MustCompile", "(", "` v(\\d+\\.\\d+\\.\\d+(\\-[\\S\\.\\-]+)?(\\+[\\S\\.\\-]+)?)`", ")", "\n", "versionNumberStr", ":=", "versionNumberRegex", ".", "FindStringSubmatch", "(", "<mask>", ")", "\n", "if", "len", "(", "versionNumberStr", ")", ">=", "2", "{", "return", "string", "(", "versionNumberStr", "[", "1", "]", ")", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
2,482
all-2483
[ "Log", "will", "log", "a", "message", "at", "the", "provided", "level", "to", "all", "added", "loggers", "with", "the", "timestamp", "set", "to", "the", "time", "Log", "was", "called", "." ]
[ "func", "(", "b", "*", "Base", ")", "Log", "(", "level", "LogLevel", ",", "m", "*", "Attrs", ",", "msg", "string", ",", "a", "...", "interface", "{", "}", ")", "error", "{", "return", "b", ".", "LogWithTime", "(", "<mask>", ",", "b", ".", "clock", ".", "Now", "(", ")", ",", "m", ",", "msg", ",", "a", "...", ")", "\n", "}" ]
2,483
all-2484
[ "NewMockStateManager", "creates", "a", "new", "mock", "instance" ]
[ "func", "NewMockStateManager", "(", "ctrl", "*", "gomock", ".", "<mask>", ")", "*", "MockStateManager", "{", "mock", ":=", "&", "MockStateManager", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockStateManagerMockRecorder", "{", "mock", "}", "\n", "return", "mock", "\n", "}" ]
2,484
all-2485
[ "EscapedLen", "returns", "total", "length", "of", "all", "escape", "sequences", "in", "a", "given", "string", "." ]
[ "func", "EscapedLen", "(", "s", "string", ")", "int", "{", "if", "len", "(", "s", ")", "==", "0", "{", "return", "0", "\n", "}", "\n\n", "var", "rw", ",", "total", "int", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "s", ")", ";", "i", "+=", "rw", "{", "v", ",", "width", ":=", "utf8", ".", "DecodeRuneInString", "(", "s", "[", "i", ":", "]", ")", "\n", "if", "v", "==", "'\\x1b'", "{", "_", ",", "skip", ",", "err", ":=", "DecodeColor", "(", "s", "[", "i", ":", "]", ")", "\n", "if", "err", "==", "nil", "{", "rw", "=", "skip", "\n", "total", "+=", "skip", "\n", "continue", "\n\n", "}", "\n", "}", "\n", "rw", "=", "<mask>", "\n", "}", "\n\n", "return", "total", "\n", "}" ]
2,485
all-2486
[ "RegisterKVHandler", "registers", "the", "http", "handlers", "for", "service", "KV", "to", "mux", ".", "The", "handlers", "forward", "requests", "to", "the", "grpc", "endpoint", "over", "conn", "." ]
[ "func", "RegisterKVHandler", "(", "ctx", "<mask>", ".", "Context", ",", "mux", "*", "runtime", ".", "ServeMux", ",", "conn", "*", "grpc", ".", "ClientConn", ")", "error", "{", "return", "RegisterKVHandlerClient", "(", "ctx", ",", "mux", ",", "etcdserverpb", ".", "NewKVClient", "(", "conn", ")", ")", "\n", "}" ]
2,486
all-2487
[ "Versions", "returns", "an", "array", "of", "versions", "contained", "in", "this", "type" ]
[ "func", "(", "t", "*", "TupleType", ")", "Versions", "(", ")", "(", "vers", "[", "]", "Version", ")", "{", "vers", "=", "make", "(", "[", "]", "Version", ",", "t", ".", "NumVersions", "(", ")", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "t", ".", "NumVersions", "(", ")", ";", "i", "++", "{", "vers", "[", "i", "]", "=", "Version", "{", "uint8", "(", "i", "+", "1", ")", ",", "t", ".", "<mask>", "[", "i", "]", "}", "\n", "}", "\n", "return", "\n", "}" ]
2,487
all-2488
[ "CreateUser", "creates", "a", "user" ]
[ "func", "(", "c", "*", "Client", ")", "CreateUser", "(", "usr", "User", ")", "(", "*", "User", ",", "error", ")", "{", "url", ":=", "umUsers", "(", ")", "+", "`?depth=`", "+", "c", ".", "client", ".", "depth", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "ret", ":=", "&", "<mask>", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Post", "(", "url", ",", "usr", ",", "ret", ",", "http", ".", "StatusAccepted", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
2,488
all-2489
[ "==", "Change", "passwd", "ChPasswd", "updates", "passwd", ".", "The", "passwd", "must", "be", "supplied", "in", "clear", "-", "text", "." ]
[ "func", "ChPasswd", "(", "user", "string", ",", "key", "[", "]", "<mask>", ")", "error", "{", "shadow", ",", "err", ":=", "LookupShadow", "(", "user", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "shadow", ".", "Passwd", "(", "key", ")", "\n\n", "return", "edit", "(", "user", ",", "shadow", ")", "\n", "}" ]
2,489
all-2490
[ "StorageProgressReader", "reports", "the", "read", "progress", "." ]
[ "func", "StorageProgressReader", "(", "op", "*", "operation", ",", "key", "string", ",", "description", "string", ")", "func", "(", "io", ".", "ReadCloser", ")", "io", ".", "ReadCloser", "{", "return", "func", "(", "reader", "io", ".", "ReadCloser", ")", "io", ".", "ReadCloser", "{", "if", "op", "==", "nil", "{", "return", "reader", "\n", "}", "\n\n", "progress", ":=", "func", "(", "progressInt", "int64", ",", "speedInt", "int64", ")", "{", "progressWrapperRender", "(", "op", ",", "key", ",", "description", ",", "progressInt", ",", "speedInt", ")", "\n", "}", "\n\n", "readPipe", ":=", "&", "ioprogress", ".", "ProgressReader", "{", "ReadCloser", ":", "<mask>", ",", "Tracker", ":", "&", "ioprogress", ".", "ProgressTracker", "{", "Handler", ":", "progress", ",", "}", ",", "}", "\n\n", "return", "readPipe", "\n", "}", "\n", "}" ]
2,490
all-2491
[ "native", "returns", "a", "pointer", "to", "the", "underlying", "GtkPaperSize", "." ]
[ "func", "(", "<mask>", "*", "PaperSize", ")", "native", "(", ")", "*", "C", ".", "GtkPaperSize", "{", "if", "ps", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "ps", ".", "GtkPaperSize", "\n", "}" ]
2,491
all-2492
[ "expandHostVirtualSwitchBeaconConfig", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "HostVirtualSwitchBeaconConfig", "." ]
[ "func", "expandHostVirtualSwitchBeaconConfig", "(", "d", "*", "schema", ".", "ResourceData", ")", "*", "<mask>", ".", "HostVirtualSwitchBeaconConfig", "{", "obj", ":=", "&", "types", ".", "HostVirtualSwitchBeaconConfig", "{", "Interval", ":", "int32", "(", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", ")", ",", "}", "\n", "return", "obj", "\n", "}" ]
2,492
all-2493
[ "Stability", ":", "***", "EXPERIMENTAL", "***", "Lists", "all", "the", "denylisted", "addresses", ".", "By", "default", "this", "end", "-", "point", "will", "try", "to", "return", "up", "to", "1000", "addresses", "in", "one", "request", ".", "But", "it", "**", "may", "return", "less", "**", "even", "if", "more", "tasks", "are", "available", ".", "It", "may", "also", "return", "a", "continuationToken", "even", "though", "there", "are", "no", "more", "results", ".", "However", "you", "can", "only", "be", "sure", "to", "have", "seen", "all", "results", "if", "you", "keep", "calling", "list", "with", "the", "last", "continuationToken", "until", "you", "get", "a", "result", "without", "a", "continuationToken", ".", "If", "you", "are", "not", "interested", "in", "listing", "all", "the", "members", "at", "once", "you", "may", "use", "the", "query", "-", "string", "option", "limit", "to", "return", "fewer", ".", "Required", "scopes", ":", "notify", ":", "manage", "-", "denylist", "See", "#listDenylist" ]
[ "func", "(", "notify", "*", "Notify", ")", "ListDenylist", "(", "continuationToken", ",", "limit", "string", ")", "(", "*", "ListOfNotificationAdresses", ",", "error", ")", "{", "v", ":=", "url", ".", "Values", "{", "}", "\n", "if", "continuationToken", "!=", "\"", "\"", "{", "v", ".", "Add", "(", "\"", "\"", ",", "continuationToken", ")", "\n", "}", "\n", "if", "limit", "!=", "\"", "\"", "{", "v", ".", "Add", "(", "\"", "\"", ",", "limit", ")", "\n", "}", "\n", "cd", ":=", "tcclient", ".", "Client", "(", "*", "notify", ")", "\n", "responseObject", ",", "_", ",", "err", ":=", "(", "&", "cd", ")", ".", "APICall", "(", "nil", ",", "\"", "\"", ",", "\"", "\"", ",", "<mask>", "(", "ListOfNotificationAdresses", ")", ",", "v", ")", "\n", "return", "responseObject", ".", "(", "*", "ListOfNotificationAdresses", ")", ",", "err", "\n", "}" ]
2,493
all-2494
[ "GetEnvelope", "retrieves", "the", "Envelope", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "StellarMessage", ")", "GetEnvelope", "(", ")", "(", "result", "ScpEnvelope", ",", "<mask>", "bool", ")", "{", "armName", ",", "_", ":=", "u", ".", "ArmForSwitch", "(", "int32", "(", "u", ".", "Type", ")", ")", "\n\n", "if", "armName", "==", "\"", "\"", "{", "result", "=", "*", "u", ".", "Envelope", "\n", "ok", "=", "true", "\n", "}", "\n\n", "return", "\n", "}" ]
2,494
all-2495
[ "Determines", "if", "a", "name", "corresponds", "to", "a", "program", "object" ]
[ "func", "IsProgram", "(", "program", "uint32", ")", "bool", "{", "ret", ",", "_", ",", "_", ":=", "syscall", ".", "Syscall", "(", "gpIsProgram", ",", "1", ",", "uintptr", "(", "program", ")", ",", "0", ",", "0", ")", "\n", "return", "<mask>", "!=", "0", "\n", "}" ]
2,495
all-2496
[ "Sort", "asks", "the", "database", "to", "order", "returned", "documents", "according", "to", "the", "provided", "field", "names", ".", "A", "field", "name", "may", "be", "prefixed", "by", "-", "(", "minus", ")", "for", "it", "to", "be", "sorted", "in", "reverse", "order", ".", "For", "example", ":", "query1", ":", "=", "collection", ".", "Find", "(", "nil", ")", ".", "Sort", "(", "firstname", "lastname", ")", "query2", ":", "=", "collection", ".", "Find", "(", "nil", ")", ".", "Sort", "(", "-", "age", ")", "query3", ":", "=", "collection", ".", "Find", "(", "nil", ")", ".", "Sort", "(", "$natural", ")", "query4", ":", "=", "collection", ".", "Find", "(", "nil", ")", ".", "Select", "(", "bson", ".", "M", "{", "score", ":", "bson", ".", "M", "{", "$meta", ":", "textScore", "}}", ")", ".", "Sort", "(", "$textScore", ":", "score", ")", "Relevant", "documentation", ":", "http", ":", "//", "www", ".", "mongodb", ".", "org", "/", "display", "/", "DOCS", "/", "Sorting", "+", "and", "+", "Natural", "+", "Order" ]
[ "func", "(", "q", "*", "Query", ")", "Sort", "(", "fields", "...", "string", ")", "*", "Query", "{", "q", ".", "m", ".", "Lock", "(", ")", "\n", "var", "<mask>", "bson", ".", "D", "\n", "for", "_", ",", "field", ":=", "range", "fields", "{", "n", ":=", "1", "\n", "var", "kind", "string", "\n", "if", "field", "!=", "\"", "\"", "{", "if", "field", "[", "0", "]", "==", "'$'", "{", "if", "c", ":=", "strings", ".", "Index", "(", "field", ",", "\"", "\"", ")", ";", "c", ">", "1", "&&", "c", "<", "len", "(", "field", ")", "-", "1", "{", "kind", "=", "field", "[", "1", ":", "c", "]", "\n", "field", "=", "field", "[", "c", "+", "1", ":", "]", "\n", "}", "\n", "}", "\n", "switch", "field", "[", "0", "]", "{", "case", "'+'", ":", "field", "=", "field", "[", "1", ":", "]", "\n", "case", "'-'", ":", "n", "=", "-", "1", "\n", "field", "=", "field", "[", "1", ":", "]", "\n", "}", "\n", "}", "\n", "if", "field", "==", "\"", "\"", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "kind", "==", "\"", "\"", "{", "order", "=", "append", "(", "order", ",", "bson", ".", "DocElem", "{", "field", ",", "bson", ".", "M", "{", "\"", "\"", ":", "kind", "}", "}", ")", "\n", "}", "else", "{", "order", "=", "append", "(", "order", ",", "bson", ".", "DocElem", "{", "field", ",", "n", "}", ")", "\n", "}", "\n", "}", "\n", "q", ".", "op", ".", "options", ".", "OrderBy", "=", "order", "\n", "q", ".", "op", ".", "hasOptions", "=", "true", "\n", "q", ".", "m", ".", "Unlock", "(", ")", "\n", "return", "q", "\n", "}" ]
2,496
all-2497
[ "newArchive15", "creates", "a", "new", "fileBlockReader", "for", "a", "Version", "1", ".", "5", "archive" ]
[ "func", "newArchive15", "(", "r", "*", "bufio", ".", "Reader", ",", "password", "string", ")", "fileBlockReader", "{", "a", ":=", "new", "(", "archive15", ")", "\n", "a", ".", "v", "=", "r", "\n", "a", ".", "pass", "=", "utf16", ".", "Encode", "(", "[", "]", "rune", "(", "<mask>", ")", ")", "// convert to UTF-16", "\n", "a", ".", "checksum", ".", "Hash32", "=", "crc32", ".", "NewIEEE", "(", ")", "\n", "a", ".", "buf", "=", "readBuf", "(", "make", "(", "[", "]", "byte", ",", "100", ")", ")", "\n", "return", "a", "\n", "}" ]
2,497
all-2498
[ "WriteTo", "and", "ReadFrom", "avoid", "intermediate", "allocation", "and", "copies", ".", "WriteTo", "avoids", "intermediate", "allocation", "and", "copies", ".", "WriteTo", "writes", "data", "to", "w", "until", "there", "s", "no", "more", "data", "to", "write", "or", "when", "an", "error", "occurs", ".", "The", "return", "value", "n", "is", "the", "number", "of", "bytes", "written", ".", "Any", "error", "encountered", "during", "the", "write", "is", "also", "returned", "." ]
[ "func", "(", "b", "*", "AtomicFixedSizeRingBuf", ")", "WriteTo", "(", "w", "<mask>", ".", "Writer", ")", "(", "n", "int64", ",", "err", "error", ")", "{", "b", ".", "tex", ".", "Lock", "(", ")", "\n", "defer", "b", ".", "tex", ".", "Unlock", "(", ")", "\n\n", "if", "b", ".", "readable", "==", "0", "{", "return", "0", ",", "io", ".", "EOF", "\n", "}", "\n\n", "extent", ":=", "b", ".", "Beg", "+", "b", ".", "readable", "\n", "firstWriteLen", ":=", "intMin2", "(", "extent", ",", "b", ".", "N", ")", "-", "b", ".", "Beg", "\n", "secondWriteLen", ":=", "b", ".", "readable", "-", "firstWriteLen", "\n", "if", "firstWriteLen", ">", "0", "{", "m", ",", "e", ":=", "w", ".", "Write", "(", "b", ".", "A", "[", "b", ".", "Use", "]", "[", "b", ".", "Beg", ":", "(", "b", ".", "Beg", "+", "firstWriteLen", ")", "]", ")", "\n", "n", "+=", "int64", "(", "m", ")", "\n", "b", ".", "unatomic_advance", "(", "m", ")", "\n\n", "if", "e", "!=", "nil", "{", "return", "n", ",", "e", "\n", "}", "\n", "// all bytes should have been written, by definition of", "// Write method in io.Writer", "if", "m", "!=", "firstWriteLen", "{", "return", "n", ",", "io", ".", "ErrShortWrite", "\n", "}", "\n", "}", "\n", "if", "secondWriteLen", ">", "0", "{", "m", ",", "e", ":=", "w", ".", "Write", "(", "b", ".", "A", "[", "b", ".", "Use", "]", "[", "0", ":", "secondWriteLen", "]", ")", "\n", "n", "+=", "int64", "(", "m", ")", "\n", "b", ".", "unatomic_advance", "(", "m", ")", "\n\n", "if", "e", "!=", "nil", "{", "return", "n", ",", "e", "\n", "}", "\n", "// all bytes should have been written, by definition of", "// Write method in io.Writer", "if", "m", "!=", "secondWriteLen", "{", "return", "n", ",", "io", ".", "ErrShortWrite", "\n", "}", "\n", "}", "\n\n", "return", "n", ",", "nil", "\n", "}" ]
2,498
all-2499
[ "UpdateContainerState", "updates", "the", "container", "to", "match", "the", "requested", "state" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "UpdateContainerState", "(", "<mask>", "string", ",", "state", "api", ".", "ContainerStatePut", ",", "ETag", "string", ")", "(", "Operation", ",", "error", ")", "{", "// Send the request", "op", ",", "_", ",", "err", ":=", "r", ".", "queryOperation", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "url", ".", "QueryEscape", "(", "name", ")", ")", ",", "state", ",", "ETag", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "op", ",", "nil", "\n", "}" ]
2,499
all-2500
[ "CreateRecordSet", "creates", "recordset", "in", "the", "given", "DNS", "zone" ]
[ "func", "(", "c", "designateClient", ")", "CreateRecordSet", "(", "zoneID", "string", ",", "opts", "recordsets", ".", "CreateOpts", ")", "(", "string", ",", "error", ")", "{", "r", ",", "err", ":=", "recordsets", ".", "Create", "(", "c", ".", "serviceClient", ",", "zoneID", ",", "opts", ")", ".", "Extract", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "r", ".", "<mask>", ",", "nil", "\n", "}" ]