id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
24,300
all-24301
[ "unicastResponse", "sends", "a", "watch", "response", "to", "a", "specific", "watch", "substream", "." ]
[ "func", "(", "w", "*", "watchGrpcStream", ")", "unicastResponse", "(", "wr", "*", "WatchResponse", ",", "watchId", "int64", ")", "bool", "{", "<mask>", ",", "ok", ":=", "w", ".", "substreams", "[", "watchId", "]", "\n", "if", "!", "ok", "{", "return", "false", "\n", "}", "\n", "select", "{", "case", "ws", ".", "recvc", "<-", "wr", ":", "case", "<-", "ws", ".", "donec", ":", "return", "false", "\n", "}", "\n", "return", "true", "\n", "}" ]
24,301
all-24302
[ "Start", "is", "called", "on", "start", "of", "a", "request" ]
[ "func", "(", "t", "*", "WriterTracer", ")", "Start", "(", "r", "*", "http", ".", "Request", ")", "{", "t", ".", "StartTime", "=", "time", ".", "Now", "(", ")", ".", "UTC", "(", ")", "\n", "t", ".", "<mask>", ".", "URL", "=", "r", ".", "URL", ".", "String", "(", ")", "\n", "t", ".", "Request", ".", "Method", "=", "r", ".", "Method", "\n", "}" ]
24,302
all-24303
[ "Skip", "a", "specified", "piece", "of", "middleware", "the", "specified", "Handlers", ".", "This", "is", "useful", "for", "things", "like", "wrapping", "your", "application", "in", "an", "authorization", "middleware", "but", "skipping", "it", "for", "things", "the", "home", "page", "the", "login", "page", "etc", "...", "/", "*", "a", ".", "Middleware", ".", "Skip", "(", "Authorization", "HomeHandler", "LoginHandler", "RegistrationHandler", ")" ]
[ "func", "(", "ms", "*", "MiddlewareStack", ")", "Skip", "(", "mw", "MiddlewareFunc", ",", "handlers", "...", "Handler", ")", "{", "for", "_", ",", "h", ":=", "range", "handlers", "{", "key", ":=", "funcKey", "(", "mw", ",", "h", ")", "\n", "<mask>", ".", "skips", "[", "key", "]", "=", "true", "\n", "}", "\n", "}" ]
24,303
all-24304
[ "EnvForSpec", "returns", "a", "mapping", "of", "environment", "variables", "to", "their", "values", "that", "should", "be", "available", "for", "a", "job", "spec" ]
[ "func", "EnvForSpec", "(", "spec", "JobSpec", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "env", ":=", "map", "[", "string", "]", "string", "{", "jobNameEnv", ":", "spec", ".", "Job", ",", "buildIDEnv", ":", "spec", ".", "BuildID", ",", "prowJobIDEnv", ":", "spec", ".", "ProwJobID", ",", "jobTypeEnv", ":", "string", "(", "spec", ".", "Type", ")", ",", "}", "\n\n", "// for backwards compatibility, we provide the build ID", "// in both $BUILD_ID and $BUILD_NUMBER for Prow agents", "// and in both $buildId and $BUILD_NUMBER for Jenkins", "if", "spec", ".", "agent", "==", "prowapi", ".", "KubernetesAgent", "{", "env", "[", "prowBuildIDEnv", "]", "=", "spec", ".", "BuildID", "\n", "}", "\n\n", "raw", ",", "err", ":=", "json", ".", "Marshal", "(", "spec", ")", "\n", "if", "err", "!=", "nil", "{", "return", "env", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "env", "[", "JobSpecEnv", "]", "=", "string", "(", "raw", ")", "\n\n", "if", "<mask>", ".", "Type", "==", "prowapi", ".", "PeriodicJob", "{", "return", "env", ",", "nil", "\n", "}", "\n\n", "env", "[", "repoOwnerEnv", "]", "=", "spec", ".", "Refs", ".", "Org", "\n", "env", "[", "repoNameEnv", "]", "=", "spec", ".", "Refs", ".", "Repo", "\n", "env", "[", "pullBaseRefEnv", "]", "=", "spec", ".", "Refs", ".", "BaseRef", "\n", "env", "[", "pullBaseShaEnv", "]", "=", "spec", ".", "Refs", ".", "BaseSHA", "\n", "env", "[", "pullRefsEnv", "]", "=", "spec", ".", "Refs", ".", "String", "(", ")", "\n\n", "if", "spec", ".", "Type", "==", "prowapi", ".", "PostsubmitJob", "||", "spec", ".", "Type", "==", "prowapi", ".", "BatchJob", "{", "return", "env", ",", "nil", "\n", "}", "\n\n", "env", "[", "pullNumberEnv", "]", "=", "strconv", ".", "Itoa", "(", "spec", ".", "Refs", ".", "Pulls", "[", "0", "]", ".", "Number", ")", "\n", "env", "[", "pullPullShaEnv", "]", "=", "spec", ".", "Refs", ".", "Pulls", "[", "0", "]", ".", "SHA", "\n", "return", "env", ",", "nil", "\n", "}" ]
24,304
all-24305
[ "validateRepoName", "determines", "if", "a", "repo", "name", "is", "valid" ]
[ "func", "validateRepoName", "(", "name", "string", ")", "error", "{", "match", ",", "_", ":=", "regexp", ".", "MatchString", "(", "\"", "\"", ",", "name", ")", "\n", "if", "!", "match", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "<mask>", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
24,305
all-24306
[ "SplitPathAndImage", "tries", "to", "split", "the", "provided", "OCI", "reference", "into", "the", "OCI", "path", "and", "image", ".", "Neither", "path", "nor", "image", "parts", "are", "validated", "at", "this", "stage", "." ]
[ "func", "SplitPathAndImage", "(", "<mask>", "string", ")", "(", "string", ",", "string", ")", "{", "if", "runtime", ".", "GOOS", "==", "\"", "\"", "{", "return", "splitPathAndImageWindows", "(", "reference", ")", "\n", "}", "\n", "return", "splitPathAndImageNonWindows", "(", "reference", ")", "\n", "}" ]
24,306
all-24307
[ "Union", "returns", "the", "smallest", "rectangle", "that", "contains", "both", "r", "and", "s", "." ]
[ "func", "(", "r", "Rectangle", ")", "Union", "(", "s", "Rectangle", ")", "Rectangle", "{", "if", "r", ".", "Empty", "(", ")", "{", "return", "s", "\n", "}", "\n", "if", "s", ".", "Empty", "(", ")", "{", "<mask>", "r", "\n", "}", "\n", "if", "r", ".", "Min", "[", "0", "]", ">", "s", ".", "Min", "[", "0", "]", "{", "r", ".", "Min", "[", "0", "]", "=", "s", ".", "Min", "[", "0", "]", "\n", "}", "\n", "if", "r", ".", "Min", "[", "1", "]", ">", "s", ".", "Min", "[", "1", "]", "{", "r", ".", "Min", "[", "1", "]", "=", "s", ".", "Min", "[", "1", "]", "\n", "}", "\n", "if", "r", ".", "Max", "[", "0", "]", "<", "s", ".", "Max", "[", "0", "]", "{", "r", ".", "Max", "[", "0", "]", "=", "s", ".", "Max", "[", "0", "]", "\n", "}", "\n", "if", "r", ".", "Max", "[", "1", "]", "<", "s", ".", "Max", "[", "1", "]", "{", "r", ".", "Max", "[", "1", "]", "=", "s", ".", "Max", "[", "1", "]", "\n", "}", "\n", "return", "r", "\n", "}" ]
24,307
all-24308
[ "AddWidget", "is", "the", "generic", "function", "to", "add", "a", "widget", "to", "a", "window", ".", "This", "function", "should", "only", "be", "called", "by", "widgets", ".", "Application", "code", "by", "convention", "should", "call", "the", "non", "-", "generic", "type", "asserted", "call", "(", "i", ".", "e", ".", "AddLabel", ")", ".", "AddWidget", "shall", "be", "called", "from", "queue", "context", "." ]
[ "func", "(", "w", "*", "Window", ")", "AddWidget", "(", "<mask>", "string", ",", "x", ",", "y", "int", ")", "(", "Widgeter", ",", "error", ")", "{", "rw", ",", "found", ":=", "registeredWidgets", "[", "id", "]", "\n", "if", "!", "found", "{", "return", "nil", ",", "ErrWidgetNotRegistered", "\n", "}", "\n", "widget", ",", "err", ":=", "rw", "(", "w", ",", "x", ",", "y", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "w", ".", "widgets", "=", "append", "(", "w", ".", "widgets", ",", "widget", ")", "\n", "return", "widget", ",", "err", "\n", "}" ]
24,308
all-24309
[ "GetCreated", "retrieves", "the", "Created", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "LedgerEntryChange", ")", "GetCreated", "(", ")", "(", "result", "LedgerEntry", ",", "ok", "bool", ")", "{", "armName", ",", "_", ":=", "u", ".", "ArmForSwitch", "(", "int32", "(", "u", ".", "Type", ")", ")", "\n\n", "if", "armName", "==", "\"", "\"", "{", "result", "=", "*", "u", ".", "Created", "\n", "<mask>", "=", "true", "\n", "}", "\n\n", "return", "\n", "}" ]
24,309
all-24310
[ "FriendlyPrice", "flips", "the", "sign", "of", "the", "Price", "(", "which", "is", "usually", "reported", "from", "the", "API", "as", "a", "negative", "number", ")", "and", "adds", "an", "appropriate", "currency", "symbol", "in", "front", "of", "it", ".", "For", "example", "a", "PriceUnit", "of", "USD", "and", "a", "Price", "of", "-", "1", ".", "25", "is", "reported", "as", "$1", ".", "25", "." ]
[ "func", "(", "c", "*", "Call", ")", "FriendlyPrice", "(", ")", "string", "{", "if", "c", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "<mask>", "(", "c", ".", "PriceUnit", ",", "c", ".", "Price", ")", "\n", "}" ]
24,310
all-24311
[ "OptClientConnectTimeout", "is", "the", "maximum", "time", "to", "connect", "in", "nanoseconds", "." ]
[ "func", "OptClientConnectTimeout", "(", "timeout", "time", ".", "Duration", ")", "ClientOption", "{", "return", "func", "(", "options", "*", "ClientOptions", ")", "error", "{", "<mask>", ".", "ConnectTimeout", "=", "timeout", "\n", "return", "nil", "\n", "}", "\n", "}" ]
24,311
all-24312
[ "expandClusterFailoverResourcesAdmissionControlPolicy", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "ClusterFailoverResourcesAdmissionControlPolicy", "." ]
[ "func", "expandClusterFailoverResourcesAdmissionControlPolicy", "(", "d", "*", "schema", ".", "ResourceData", ",", "version", "viapi", ".", "VSphereVersion", ",", ")", "*", "types", ".", "ClusterFailoverResourcesAdmissionControlPolicy", "{", "obj", ":=", "&", "<mask>", ".", "ClusterFailoverResourcesAdmissionControlPolicy", "{", "CpuFailoverResourcesPercent", ":", "int32", "(", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", ")", ",", "MemoryFailoverResourcesPercent", ":", "int32", "(", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", ")", ",", "}", "\n\n", "if", "version", ".", "Newer", "(", "viapi", ".", "VSphereVersion", "{", "Product", ":", "version", ".", "Product", ",", "Major", ":", "6", ",", "Minor", ":", "5", "}", ")", "{", "obj", ".", "AutoComputePercentages", "=", "structure", ".", "GetBool", "(", "d", ",", "\"", "\"", ")", "\n", "obj", ".", "FailoverLevel", "=", "int32", "(", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", ")", "\n", "}", "\n\n", "return", "obj", "\n", "}" ]
24,312
all-24313
[ "GetText", "returns", "the", "Text", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "e", "*", "Event", ")", "GetText", "(", ")", "string", "{", "if", "e", "==", "nil", "||", "e", ".", "Text", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "e", ".", "<mask>", "\n", "}" ]
24,313
all-24314
[ "PutUint8", "sets", "an", "8", "-", "bit", "unsigned", "value", "for", "the", "given", "string", "name", ".", "The", "field", "name", "must", "be", "a", "Uint8Field", "otherwise", "an", "error", "will", "be", "returned", ".", "If", "the", "type", "buffer", "no", "longer", "has", "enough", "space", "to", "write", "this", "value", "an", "xbinary", ".", "ErrOutOfRange", "error", "will", "be", "returned", ".", "Upon", "success", "2", "bytes", "should", "be", "written", "into", "the", "buffer", "and", "the", "returned", "error", "should", "be", "nil", ".", "The", "type", "code", "is", "written", "first", "then", "the", "byte", "value", "." ]
[ "func", "(", "b", "*", "TupleBuilder", ")", "PutUint8", "(", "field", "string", ",", "value", "uint8", ")", "(", "wrote", "uint64", ",", "err", "error", ")", "{", "// field type should be a Uint8Field", "if", "err", "=", "b", ".", "typeCheck", "(", "field", ",", "Uint8Field", ")", ";", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "// minimum bytes is 2 (type code + value)", "if", "b", ".", "available", "(", ")", "<", "2", "{", "return", "0", ",", "xbinary", ".", "ErrOutOfRange", "\n", "}", "\n\n", "// write type code", "b", ".", "buffer", "[", "b", ".", "pos", "]", "=", "<mask>", "(", "UnsignedInt8Code", ".", "OpCode", ")", "\n\n", "// write value", "b", ".", "buffer", "[", "b", ".", "pos", "+", "1", "]", "=", "byte", "(", "value", ")", "\n\n", "// set field offset", "b", ".", "offsets", "[", "field", "]", "=", "b", ".", "pos", "\n\n", "// incr pos", "b", ".", "pos", "+=", "2", "\n\n", "return", "2", ",", "nil", "\n", "}" ]
24,314
all-24315
[ "GetTitle", "is", "a", "wrapper", "around", "gtk_window_get_title", "()", "." ]
[ "func", "(", "v", "*", "Window", ")", "GetTitle", "(", ")", "(", "string", ",", "<mask>", ")", "{", "return", "stringReturn", "(", "C", ".", "gtk_window_get_title", "(", "v", ".", "native", "(", ")", ")", ")", "\n", "}" ]
24,315
all-24316
[ "SetURLPrefix", "sets", "URL", "prefix", "of", "router", "layer", "so", "that", "it", "support", "suburl", "." ]
[ "func", "(", "m", "*", "Macaron", ")", "SetURLPrefix", "(", "<mask>", "string", ")", "{", "m", ".", "urlPrefix", "=", "prefix", "\n", "m", ".", "hasURLPrefix", "=", "len", "(", "m", ".", "urlPrefix", ")", ">", "0", "\n", "}" ]
24,316
all-24317
[ "Getfloat", "returns", "the", "float", "value", "for", "a", "given", "key", "." ]
[ "func", "(", "c", "*", "Config", ")", "Getfloat", "(", "<mask>", "string", ")", "(", "float64", ",", "error", ")", "{", "if", "value", ",", "found", ":=", "c", ".", "data", "[", "key", "]", ";", "found", "{", "return", "strconv", ".", "ParseFloat", "(", "value", ",", "64", ")", "\n", "}", "\n", "return", "0", ",", "ErrKey", "\n", "}" ]
24,317
all-24318
[ "Namespaces", "returns", "all", "the", "datastore", "namespaces", "." ]
[ "func", "Namespaces", "(", "ctx", "context", ".", "<mask>", ")", "(", "[", "]", "string", ",", "error", ")", "{", "// TODO(djd): Support range queries.", "q", ":=", "NewQuery", "(", "namespaceKind", ")", ".", "KeysOnly", "(", ")", "\n", "keys", ",", "err", ":=", "q", ".", "GetAll", "(", "ctx", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "// The empty namespace key uses a numeric ID (==1), but luckily", "// the string ID defaults to \"\" for numeric IDs anyway.", "return", "keyNames", "(", "keys", ")", ",", "nil", "\n", "}" ]
24,318
all-24319
[ "AddRelayTransport", "constructs", "a", "relay", "and", "adds", "it", "as", "a", "transport", "to", "the", "host", "network", "." ]
[ "func", "AddRelayTransport", "(", "ctx", "<mask>", ".", "Context", ",", "h", "host", ".", "Host", ",", "upgrader", "*", "tptu", ".", "Upgrader", ",", "opts", "...", "RelayOpt", ")", "error", "{", "n", ",", "ok", ":=", "h", ".", "Network", "(", ")", ".", "(", "tpt", ".", "Network", ")", "\n", "if", "!", "ok", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "h", ".", "Network", "(", ")", ")", "\n", "}", "\n\n", "r", ",", "err", ":=", "NewRelay", "(", "ctx", ",", "h", ",", "upgrader", ",", "opts", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// There's no nice way to handle these errors as we have no way to tear", "// down the relay.", "// TODO", "if", "err", ":=", "n", ".", "AddTransport", "(", "r", ".", "Transport", "(", ")", ")", ";", "err", "!=", "nil", "{", "log", ".", "Error", "(", "\"", "\"", ",", "err", ")", "\n", "}", "else", "if", "err", ":=", "n", ".", "Listen", "(", "r", ".", "Listener", "(", ")", ".", "Multiaddr", "(", ")", ")", ";", "err", "!=", "nil", "{", "log", ".", "Error", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
24,319
all-24320
[ "determineSkippedPresubmits", "identifies", "the", "largest", "set", "of", "contexts", "we", "can", "actually", "post", "skipped", "contexts", "for", "given", "a", "set", "of", "presubmits", "we", "re", "triggering", ".", "We", "don", "t", "want", "to", "skip", "a", "job", "that", "posts", "a", "context", "that", "will", "be", "written", "to", "by", "a", "job", "we", "just", "identified", "for", "triggering", "or", "the", "skipped", "context", "will", "override", "the", "triggered", "one" ]
[ "func", "determineSkippedPresubmits", "(", "toTrigger", ",", "toSkipSuperset", "[", "]", "config", ".", "Presubmit", ",", "logger", "*", "logrus", ".", "Entry", ")", "[", "]", "config", ".", "Presubmit", "{", "triggeredContexts", ":=", "sets", ".", "NewString", "(", ")", "\n", "for", "_", ",", "presubmit", ":=", "range", "toTrigger", "{", "triggeredContexts", ".", "Insert", "(", "presubmit", ".", "Context", ")", "\n", "}", "\n", "var", "toSkip", "[", "]", "config", ".", "Presubmit", "\n", "for", "_", ",", "presubmit", ":=", "range", "toSkipSuperset", "{", "if", "triggeredContexts", ".", "Has", "(", "presubmit", ".", "Context", ")", "{", "logger", ".", "WithFields", "(", "logrus", ".", "Fields", "{", "\"", "\"", ":", "presubmit", ".", "<mask>", ",", "\"", "\"", ":", "presubmit", ".", "Name", "}", ")", ".", "Debug", "(", "\"", "\"", ")", "\n", "continue", "\n", "}", "\n", "toSkip", "=", "append", "(", "toSkip", ",", "presubmit", ")", "\n", "}", "\n", "return", "toSkip", "\n", "}" ]
24,320
all-24321
[ "schemaVMwareDVSConfigSpec", "returns", "schema", "items", "for", "resources", "that", "need", "to", "work", "with", "a", "VMwareDVSConfigSpec", "." ]
[ "func", "schemaVMwareDVSConfigSpec", "(", ")", "map", "[", "string", "]", "*", "schema", ".", "Schema", "{", "s", ":=", "map", "[", "string", "]", "*", "schema", ".", "Schema", "{", "// DVSContactInfo", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeString", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeString", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "}", ",", "// DistributedVirtualSwitchHostMemberConfigSpec", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeSet", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "Elem", ":", "&", "schema", ".", "Resource", "{", "Schema", ":", "map", "[", "string", "]", "*", "schema", ".", "Schema", "{", "// DistributedVirtualSwitchHostMemberPnicSpec", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeList", ",", "Description", ":", "\"", "\"", ",", "Required", ":", "true", ",", "MinItems", ":", "1", ",", "Elem", ":", "&", "schema", ".", "Schema", "{", "Type", ":", "schema", ".", "TypeString", "}", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeString", ",", "Required", ":", "true", ",", "Description", ":", "\"", "\"", ",", "ValidateFunc", ":", "validation", ".", "NoZeroValues", ",", "}", ",", "}", ",", "}", ",", "}", ",", "// VMwareIpfixConfig (Netflow)", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeInt", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "<mask>", ":", "60", ",", "ValidateFunc", ":", "validation", ".", "IntBetween", "(", "60", ",", "3600", ")", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeString", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeInt", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "ValidateFunc", ":", "validation", ".", "IntBetween", "(", "0", ",", "65535", ")", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeInt", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "Default", ":", "15", ",", "ValidateFunc", ":", "validation", ".", "IntBetween", "(", "10", ",", "600", ")", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeBool", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeInt", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "ValidateFunc", ":", "validation", ".", "IntAtLeast", "(", "0", ")", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeInt", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "ValidateFunc", ":", "validation", ".", "IntAtLeast", "(", "0", ")", ",", "}", ",", "// LinkDiscoveryProtocolConfig", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeString", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "Default", ":", "string", "(", "types", ".", "LinkDiscoveryProtocolConfigOperationTypeListen", ")", ",", "ValidateFunc", ":", "validation", ".", "StringInSlice", "(", "linkDiscoveryProtocolConfigOperationAllowedValues", ",", "false", ")", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeString", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "Default", ":", "string", "(", "types", ".", "LinkDiscoveryProtocolConfigProtocolTypeCdp", ")", ",", "ValidateFunc", ":", "validation", ".", "StringInSlice", "(", "linkDiscoveryProtocolConfigProtocolAllowedValues", ",", "false", ")", ",", "}", ",", "// DVSNameArrayUplinkPortPolicy", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeList", ",", "Optional", ":", "true", ",", "Computed", ":", "true", ",", "Description", ":", "\"", "\"", ",", "Elem", ":", "&", "schema", ".", "Schema", "{", "Type", ":", "schema", ".", "TypeString", "}", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeString", ",", "Required", ":", "true", ",", "Description", ":", "\"", "\"", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeString", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeString", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeString", ",", "Optional", ":", "true", ",", "Computed", ":", "true", ",", "Description", ":", "\"", "\"", ",", "ValidateFunc", ":", "validation", ".", "StringInSlice", "(", "lacpAPIVersionAllowedValues", ",", "false", ")", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeInt", ",", "Optional", ":", "true", ",", "Computed", ":", "true", ",", "Description", ":", "\"", "\"", ",", "ValidateFunc", ":", "validation", ".", "IntBetween", "(", "1", ",", "9000", ")", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeString", ",", "Optional", ":", "true", ",", "Computed", ":", "true", ",", "Description", ":", "\"", "\"", ",", "ValidateFunc", ":", "validation", ".", "StringInSlice", "(", "multicastFilteringModeAllowedValues", ",", "false", ")", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeString", ",", "Optional", ":", "true", ",", "Computed", ":", "true", ",", "Description", ":", "\"", "\"", ",", "ValidateFunc", ":", "validation", ".", "StringInSlice", "(", "networkResourceControlAllowedValues", ",", "false", ")", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeString", ",", "Computed", ":", "true", ",", "Description", ":", "\"", "\"", ",", "}", ",", "}", "\n\n", "structure", ".", "MergeSchema", "(", "s", ",", "schemaVMwareDVSPortSetting", "(", ")", ")", "\n", "structure", ".", "MergeSchema", "(", "s", ",", "schemaDvsHostInfrastructureTrafficResource", "(", ")", ")", "\n", "return", "s", "\n", "}" ]
24,321
all-24322
[ "Delete", "a", "container", "template" ]
[ "func", "containerMetadataTemplatesDelete", "(", "d", "*", "Daemon", ",", "r", "*", "http", ".", "Request", ")", "<mask>", "{", "project", ":=", "projectParam", "(", "r", ")", "\n\n", "name", ":=", "mux", ".", "Vars", "(", "r", ")", "[", "\"", "\"", "]", "\n\n", "// Handle requests targeted to a container on a different node", "response", ",", "err", ":=", "ForwardedResponseIfContainerIsRemote", "(", "d", ",", "r", ",", "project", ",", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n", "if", "response", "!=", "nil", "{", "return", "response", "\n", "}", "\n\n", "// Load the container", "c", ",", "err", ":=", "containerLoadByProjectAndName", "(", "d", ".", "State", "(", ")", ",", "project", ",", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n\n", "// Start the storage if needed", "ourStart", ",", "err", ":=", "c", ".", "StorageStart", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n", "if", "ourStart", "{", "defer", "c", ".", "StorageStop", "(", ")", "\n", "}", "\n\n", "// Look at the request", "templateName", ":=", "r", ".", "FormValue", "(", "\"", "\"", ")", "\n", "if", "templateName", "==", "\"", "\"", "{", "return", "BadRequest", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ")", ")", "\n", "}", "\n\n", "templatePath", ",", "err", ":=", "getContainerTemplatePath", "(", "c", ",", "templateName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n\n", "if", "!", "shared", ".", "PathExists", "(", "templatePath", ")", "{", "return", "NotFound", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "templatePath", ")", ")", "\n", "}", "\n\n", "// Delete the template", "err", "=", "os", ".", "Remove", "(", "templatePath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "InternalError", "(", "err", ")", "\n", "}", "\n\n", "return", "EmptySyncResponse", "\n", "}" ]
24,322
all-24323
[ "StoragePoolCreatePending", "creates", "a", "new", "pending", "storage", "pool", "on", "the", "node", "with", "the", "given", "name", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "StoragePoolCreatePending", "(", "node", ",", "name", ",", "driver", "string", ",", "conf", "map", "[", "string", "]", "string", ")", "error", "{", "// First check if a storage pool with the given name exists, and, if", "// so, that it has a matching driver and it's in the pending state.", "pool", ":=", "struct", "{", "<mask>", "int64", "\n", "driver", "string", "\n", "state", "int", "\n", "}", "{", "}", "\n\n", "var", "errConsistency", "error", "\n", "dest", ":=", "func", "(", "i", "int", ")", "[", "]", "interface", "{", "}", "{", "// Sanity check that there is at most one pool with the given name.", "if", "i", "!=", "0", "{", "errConsistency", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "[", "]", "interface", "{", "}", "{", "&", "pool", ".", "id", ",", "&", "pool", ".", "driver", ",", "&", "pool", ".", "state", "}", "\n", "}", "\n", "stmt", ",", "err", ":=", "c", ".", "tx", ".", "Prepare", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "stmt", ".", "Close", "(", ")", "\n", "err", "=", "query", ".", "SelectObjects", "(", "stmt", ",", "dest", ",", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "errConsistency", "!=", "nil", "{", "return", "errConsistency", "\n", "}", "\n\n", "var", "poolID", "=", "pool", ".", "id", "\n", "if", "poolID", "==", "0", "{", "// No existing pool with the given name was found, let's create", "// one.", "columns", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", "\n", "values", ":=", "[", "]", "interface", "{", "}", "{", "name", ",", "driver", "}", "\n", "poolID", ",", "err", "=", "query", ".", "UpsertObject", "(", "c", ".", "tx", ",", "\"", "\"", ",", "columns", ",", "values", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "else", "{", "// Check that the existing pools matches the given driver and", "// is in the pending state.", "if", "pool", ".", "driver", "!=", "driver", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "pool", ".", "state", "!=", "storagePoolPending", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "// Get the ID of the node with the given name.", "nodeInfo", ",", "err", ":=", "c", ".", "NodeByName", "(", "node", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Check that no storage_pool entry of this node and pool exists yet.", "count", ",", "err", ":=", "query", ".", "Count", "(", "c", ".", "tx", ",", "\"", "\"", ",", "\"", "\"", ",", "poolID", ",", "nodeInfo", ".", "ID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "count", "!=", "0", "{", "return", "ErrAlreadyDefined", "\n", "}", "\n\n", "// Insert the node-specific configuration.", "columns", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", "\n", "values", ":=", "[", "]", "interface", "{", "}", "{", "poolID", ",", "nodeInfo", ".", "ID", "}", "\n", "_", ",", "err", "=", "query", ".", "UpsertObject", "(", "c", ".", "tx", ",", "\"", "\"", ",", "columns", ",", "values", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "err", "=", "c", ".", "StoragePoolConfigAdd", "(", "poolID", ",", "nodeInfo", ".", "ID", ",", "conf", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
24,323
all-24324
[ "This", "helper", "deletes", "any", "node", "-", "specific", "values", "from", "the", "config", "object", "since", "they", "should", "not", "be", "part", "of", "the", "calculated", "etag", "." ]
[ "func", "storagePoolClusterConfigForEtag", "(", "dbConfig", "map", "[", "string", "]", "string", ")", "map", "[", "string", "]", "string", "{", "config", ":=", "util", ".", "CopyConfig", "(", "dbConfig", ")", "\n", "for", "_", ",", "key", ":=", "range", "db", ".", "StoragePoolNodeConfigKeys", "{", "delete", "(", "config", ",", "<mask>", ")", "\n", "}", "\n", "return", "config", "\n", "}" ]
24,324
all-24325
[ "SetUseES", "is", "a", "wrapper", "around", "gdk_gl_context_set_use_es", "()", "." ]
[ "func", "(", "v", "*", "GLContext", ")", "SetUseES", "(", "<mask>", "int", ")", "{", "C", ".", "gdk_gl_context_set_use_es", "(", "v", ".", "native", "(", ")", ",", "(", "C", ".", "int", ")", "(", "es", ")", ")", "\n", "}" ]
24,325
all-24326
[ "GetOffer", "retrieves", "the", "Offer", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "LedgerEntryData", ")", "GetOffer", "(", ")", "(", "result", "OfferEntry", ",", "ok", "bool", ")", "{", "armName", ",", "_", ":=", "u", ".", "ArmForSwitch", "(", "int32", "(", "u", ".", "Type", ")", ")", "\n\n", "if", "armName", "==", "\"", "\"", "{", "result", "=", "*", "u", ".", "Offer", "\n", "<mask>", "=", "true", "\n", "}", "\n\n", "return", "\n", "}" ]
24,326
all-24327
[ "/", "*", "display", "image", "within", "window", "(", "highgui", "windows", "remember", "their", "content", ")" ]
[ "func", "(", "win", "*", "Window", ")", "ShowImage", "(", "image", "*", "IplImage", ")", "{", "win", ".", "image", "=", "<mask>", "\n", "C", ".", "cvShowImage", "(", "win", ".", "name_c", ",", "unsafe", ".", "Pointer", "(", "image", ")", ")", "\n", "}" ]
24,327
all-24328
[ "FillString", "draws", "the", "text", "at", "point", "(", "0", "0", ")" ]
[ "func", "(", "gc", "*", "GraphicContext", ")", "FillString", "(", "text", "string", ")", "(", "cursor", "float64", ")", "{", "return", "gc", ".", "FillStringAt", "(", "<mask>", ",", "0", ",", "0", ")", "\n", "}" ]
24,328
all-24329
[ "ComboBoxNewWithModel", "()", "is", "a", "wrapper", "around", "gtk_combo_box_new_with_model", "()", "." ]
[ "func", "ComboBoxNewWithModel", "(", "model", "ITreeModel", ")", "(", "*", "ComboBox", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_combo_box_new_with_model", "(", "<mask>", ".", "toTreeModel", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "wrapComboBox", "(", "obj", ")", ",", "nil", "\n", "}" ]
24,329
all-24330
[ "ListTasks", "returns", "the", "tasks", "currently", "managed", "by", "the", "DockerTaskEngine" ]
[ "func", "(", "engine", "*", "DockerTaskEngine", ")", "ListTasks", "(", ")", "(", "[", "]", "*", "apitask", ".", "Task", ",", "error", ")", "{", "return", "<mask>", ".", "state", ".", "AllTasks", "(", ")", ",", "nil", "\n", "}" ]
24,330
all-24331
[ "ApplyChanges", "applies", "Kubernetes", "changes", "in", "endpoints", "to", "AWS", "API" ]
[ "func", "(", "p", "*", "AWSSDProvider", ")", "ApplyChanges", "(", "changes", "*", "plan", ".", "Changes", ")", "error", "{", "// return early if there is nothing to change", "if", "len", "(", "changes", ".", "Create", ")", "==", "0", "&&", "len", "(", "changes", ".", "Delete", ")", "==", "0", "&&", "len", "(", "changes", ".", "UpdateNew", ")", "==", "0", "{", "log", ".", "Info", "(", "\"", "\"", ")", "\n", "return", "nil", "\n", "}", "\n\n", "// convert updates to delete and create operation if applicable (updates not supported)", "creates", ",", "deletes", ":=", "p", ".", "updatesToCreates", "(", "changes", ")", "\n", "changes", ".", "Delete", "=", "append", "(", "changes", ".", "Delete", ",", "deletes", "...", ")", "\n", "changes", ".", "Create", "=", "append", "(", "changes", ".", "Create", ",", "creates", "...", ")", "\n\n", "namespaces", ",", "err", ":=", "p", ".", "ListNamespaces", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Deletes must be executed first to support update case.", "// When just list of targets is updated `[1.2.3.4] -> [1.2.3.4, 1.2.3.5]` it is translated to:", "// ```", "// deletes = [1.2.3.4]", "// creates = [1.2.3.4, 1.2.3.5]", "// ```", "// then when deletes are executed after creates it will miss the `1.2.3.4` instance.", "err", "=", "p", ".", "submitDeletes", "(", "namespaces", ",", "<mask>", ".", "Delete", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "err", "=", "p", ".", "submitCreates", "(", "namespaces", ",", "changes", ".", "Create", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
24,331
all-24332
[ "NewBasics", "creates", "an", "amount", "of", "new", "entities", "with", "a", "new", "unique", "identifiers", ".", "It", "is", "safe", "for", "concurrent", "use", "and", "performs", "better", "than", "NewBasic", "for", "large", "numbers", "of", "entities", "." ]
[ "func", "NewBasics", "(", "amount", "int", ")", "[", "]", "BasicEntity", "{", "entities", ":=", "make", "(", "[", "]", "BasicEntity", ",", "amount", ")", "\n\n", "lastID", ":=", "atomic", ".", "AddUint64", "(", "&", "idInc", ",", "uint64", "(", "amount", ")", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "amount", ";", "i", "++", "{", "entities", "[", "i", "]", ".", "<mask>", "=", "lastID", "-", "uint64", "(", "amount", ")", "+", "uint64", "(", "i", ")", "+", "1", "\n", "}", "\n\n", "return", "entities", "\n", "}" ]
24,332
all-24333
[ "PageSetupNewFromFile", "()", "is", "a", "wrapper", "around", "gtk_page_setup_new_from_file", "()", "." ]
[ "func", "PageSetupNewFromFile", "(", "fileName", "string", ")", "(", "*", "PageSetup", ",", "error", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "fileName", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "var", "err", "*", "C", ".", "GError", "=", "nil", "\n", "c", ":=", "C", ".", "gtk_page_setup_new_from_file", "(", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ",", "&", "err", ")", "\n", "if", "c", "==", "nil", "{", "defer", "C", ".", "g_error_free", "(", "err", ")", "\n", "return", "nil", ",", "errors", ".", "New", "(", "C", ".", "GoString", "(", "(", "*", "C", ".", "char", ")", "(", "err", ".", "<mask>", ")", ")", ")", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "&", "PageSetup", "{", "obj", "}", ",", "nil", "\n\n", "}" ]
24,333
all-24334
[ "Renderer", "is", "a", "Middleware", "that", "maps", "a", "render", ".", "Render", "service", "into", "the", "Martini", "handler", "chain", ".", "An", "single", "variadic", "render", ".", "RenderOptions", "struct", "can", "be", "optionally", "provided", "to", "configure", "HTML", "rendering", ".", "The", "default", "directory", "for", "templates", "is", "templates", "and", "the", "default", "file", "extension", "is", ".", "tmpl", ".", "If", "MARTINI_ENV", "is", "set", "to", "or", "development", "then", "templates", "will", "be", "recompiled", "on", "every", "request", ".", "For", "more", "performance", "set", "the", "MARTINI_ENV", "environment", "variable", "to", "production" ]
[ "func", "Renderer", "(", "<mask>", "...", "RenderOptions", ")", "Handler", "{", "opt", ":=", "prepareRenderOptions", "(", "options", ")", "\n", "cs", ":=", "prepareCharset", "(", "opt", ".", "Charset", ")", "\n", "t", ":=", "compile", "(", "opt", ")", "\n", "return", "func", "(", "res", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ",", "c", "Context", ")", "{", "var", "tc", "*", "template", ".", "Template", "\n", "if", "Env", "==", "Dev", "{", "// recompile for easy development", "tc", "=", "compile", "(", "opt", ")", "\n", "}", "else", "{", "// use a clone of the initial template", "tc", ",", "_", "=", "t", ".", "Clone", "(", ")", "\n", "}", "\n", "//c.MapTo(&Render{res, req, tc, opt, cs, Data}, (*Render)(nil))", "c", ".", "Map", "(", "&", "Render", "{", "res", ",", "req", ",", "tc", ",", "opt", ",", "cs", ",", "Data", "}", ")", "\n", "}", "\n", "}" ]
24,334
all-24335
[ "WithStreamCompression", "compression", "format", "to", "use", ".", "This", "only", "applies", "when", "using", "ReturnAsStream", "transfer", "mode", "(", "defaults", "to", "none", ")", "." ]
[ "func", "(", "p", "StartParams", ")", "WithStreamCompression", "(", "streamCompression", "StreamCompression", ")", "*", "StartParams", "{", "p", ".", "StreamCompression", "=", "streamCompression", "\n", "<mask>", "&", "p", "\n", "}" ]
24,335
all-24336
[ "WithBody", "adds", "the", "body", "to", "the", "post", "apps", "params" ]
[ "func", "(", "o", "*", "PostAppsParams", ")", "WithBody", "(", "body", "*", "models", ".", "AppWrapper", ")", "*", "PostAppsParams", "{", "o", ".", "SetBody", "(", "<mask>", ")", "\n", "return", "o", "\n", "}" ]
24,336
all-24337
[ "Restore", "cluster", "state", "from", "an", "extract", "series", "of", "operations", "." ]
[ "func", "(", "c", "APIClient", ")", "Restore", "(", "ops", "[", "]", "*", "admin", ".", "Op", ")", "(", "retErr", "error", ")", "{", "restoreClient", ",", "err", ":=", "c", ".", "AdminAPIClient", ".", "Restore", "(", "c", ".", "Ctx", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "defer", "func", "(", ")", "{", "if", "_", ",", "err", ":=", "restoreClient", ".", "CloseAndRecv", "(", ")", ";", "err", "!=", "nil", "&&", "retErr", "==", "nil", "{", "retErr", "=", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "}", "(", ")", "\n", "for", "_", ",", "op", ":=", "<mask>", "ops", "{", "if", "err", ":=", "restoreClient", ".", "Send", "(", "&", "admin", ".", "RestoreRequest", "{", "Op", ":", "op", "}", ")", ";", "err", "!=", "nil", "{", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
24,337
all-24338
[ "connectionError", "handles", "a", "connection", "level", "error" ]
[ "func", "(", "c", "*", "Connection", ")", "connectionError", "(", "site", "string", ",", "err", "error", ")", "error", "{", "var", "closeLogFields", "LogFields", "\n", "if", "err", "==", "io", ".", "EOF", "{", "closeLogFields", "=", "LogFields", "{", "{", "\"", "\"", ",", "\"", "\"", "}", "}", "\n", "}", "else", "{", "closeLogFields", "=", "LogFields", "{", "{", "\"", "\"", ",", "\"", "\"", "}", ",", "ErrField", "(", "err", ")", ",", "}", "\n", "}", "\n\n", "c", ".", "stopHealthCheck", "(", ")", "\n", "err", "=", "c", ".", "logConnectionError", "(", "site", ",", "err", ")", "\n", "c", ".", "<mask>", "(", "closeLogFields", "...", ")", "\n\n", "// On any connection error, notify the exchanges of this error.", "if", "c", ".", "stoppedExchanges", ".", "CAS", "(", "false", ",", "true", ")", "{", "c", ".", "outbound", ".", "stopExchanges", "(", "err", ")", "\n", "c", ".", "inbound", ".", "stopExchanges", "(", "err", ")", "\n", "}", "\n\n", "// checkExchanges will close the connection due to stoppedExchanges.", "c", ".", "checkExchanges", "(", ")", "\n", "return", "err", "\n", "}" ]
24,338
all-24339
[ "ApplyConfig", "updates", "the", "state", "as", "the", "new", "config", "requires", "." ]
[ "func", "(", "s", "*", "Storage", ")", "ApplyConfig", "(", "conf", "*", "config", ".", "Config", ")", "error", "{", "s", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "cfgBytes", ",", "err", ":=", "json", ".", "Marshal", "(", "conf", ".", "RemoteWriteConfigs", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "hash", ":=", "md5", ".", "Sum", "(", "cfgBytes", ")", "\n", "if", "<mask>", "==", "s", ".", "configHash", "{", "level", ".", "Debug", "(", "s", ".", "logger", ")", ".", "Log", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "nil", "\n", "}", "\n\n", "s", ".", "configHash", "=", "hash", "\n\n", "// Update write queues", "newQueues", ":=", "[", "]", "*", "QueueManager", "{", "}", "\n", "// TODO: we should only stop & recreate queues which have changes,", "// as this can be quite disruptive.", "for", "i", ",", "rwConf", ":=", "range", "conf", ".", "RemoteWriteConfigs", "{", "c", ",", "err", ":=", "NewClient", "(", "i", ",", "&", "ClientConfig", "{", "URL", ":", "rwConf", ".", "URL", ",", "Timeout", ":", "rwConf", ".", "RemoteTimeout", ",", "HTTPClientConfig", ":", "rwConf", ".", "HTTPClientConfig", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "newQueues", "=", "append", "(", "newQueues", ",", "NewQueueManager", "(", "s", ".", "logger", ",", "s", ".", "walDir", ",", "s", ".", "samplesIn", ",", "rwConf", ".", "QueueConfig", ",", "conf", ".", "GlobalConfig", ".", "ExternalLabels", ",", "rwConf", ".", "WriteRelabelConfigs", ",", "c", ",", "s", ".", "flushDeadline", ",", ")", ")", "\n", "}", "\n\n", "for", "_", ",", "q", ":=", "range", "s", ".", "queues", "{", "q", ".", "Stop", "(", ")", "\n", "}", "\n\n", "s", ".", "queues", "=", "newQueues", "\n", "for", "_", ",", "q", ":=", "range", "s", ".", "queues", "{", "q", ".", "Start", "(", ")", "\n", "}", "\n\n", "// Update read clients", "queryables", ":=", "make", "(", "[", "]", "storage", ".", "Queryable", ",", "0", ",", "len", "(", "conf", ".", "RemoteReadConfigs", ")", ")", "\n", "for", "i", ",", "rrConf", ":=", "range", "conf", ".", "RemoteReadConfigs", "{", "c", ",", "err", ":=", "NewClient", "(", "i", ",", "&", "ClientConfig", "{", "URL", ":", "rrConf", ".", "URL", ",", "Timeout", ":", "rrConf", ".", "RemoteTimeout", ",", "HTTPClientConfig", ":", "rrConf", ".", "HTTPClientConfig", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "q", ":=", "QueryableClient", "(", "c", ")", "\n", "q", "=", "ExternalLabelsHandler", "(", "q", ",", "conf", ".", "GlobalConfig", ".", "ExternalLabels", ")", "\n", "if", "len", "(", "rrConf", ".", "RequiredMatchers", ")", ">", "0", "{", "q", "=", "RequiredMatchersFilter", "(", "q", ",", "labelsToEqualityMatchers", "(", "rrConf", ".", "RequiredMatchers", ")", ")", "\n", "}", "\n", "if", "!", "rrConf", ".", "ReadRecent", "{", "q", "=", "PreferLocalStorageFilter", "(", "q", ",", "s", ".", "localStartTimeCallback", ")", "\n", "}", "\n", "queryables", "=", "append", "(", "queryables", ",", "q", ")", "\n", "}", "\n", "s", ".", "queryables", "=", "queryables", "\n\n", "return", "nil", "\n", "}" ]
24,339
all-24340
[ "commandsForBaseRef", "returns", "the", "list", "of", "commands", "needed", "to", "initialize", "and", "configure", "a", "local", "git", "directory", "as", "well", "as", "fetch", "and", "check", "out", "the", "provided", "base", "ref", "." ]
[ "func", "(", "g", "*", "gitCtx", ")", "commandsForBaseRef", "(", "refs", "prowapi", ".", "Refs", ",", "gitUserName", ",", "gitUserEmail", ",", "cookiePath", "string", ")", "[", "]", "cloneCommand", "{", "commands", ":=", "[", "]", "cloneCommand", "{", "{", "dir", ":", "\"", "\"", ",", "env", ":", "g", ".", "env", ",", "command", ":", "\"", "\"", ",", "args", ":", "[", "]", "string", "{", "\"", "\"", ",", "g", ".", "cloneDir", "}", "}", "}", "\n\n", "commands", "=", "append", "(", "commands", ",", "g", ".", "gitCommand", "(", "\"", "\"", ")", ")", "\n", "if", "gitUserName", "!=", "\"", "\"", "{", "commands", "=", "<mask>", "(", "commands", ",", "g", ".", "gitCommand", "(", "\"", "\"", ",", "\"", "\"", ",", "gitUserName", ")", ")", "\n", "}", "\n", "if", "gitUserEmail", "!=", "\"", "\"", "{", "commands", "=", "append", "(", "commands", ",", "g", ".", "gitCommand", "(", "\"", "\"", ",", "\"", "\"", ",", "gitUserEmail", ")", ")", "\n", "}", "\n", "if", "cookiePath", "!=", "\"", "\"", "{", "commands", "=", "append", "(", "commands", ",", "g", ".", "gitCommand", "(", "\"", "\"", ",", "\"", "\"", ",", "cookiePath", ")", ")", "\n", "}", "\n", "commands", "=", "append", "(", "commands", ",", "g", ".", "gitCommand", "(", "\"", "\"", ",", "g", ".", "repositoryURI", ",", "\"", "\"", ",", "\"", "\"", ")", ")", "\n", "commands", "=", "append", "(", "commands", ",", "g", ".", "gitCommand", "(", "\"", "\"", ",", "g", ".", "repositoryURI", ",", "refs", ".", "BaseRef", ")", ")", "\n\n", "var", "target", "string", "\n", "if", "refs", ".", "BaseSHA", "!=", "\"", "\"", "{", "target", "=", "refs", ".", "BaseSHA", "\n", "}", "else", "{", "target", "=", "\"", "\"", "\n", "}", "\n", "// we need to be \"on\" the target branch after the sync", "// so we need to set the branch to point to the base ref,", "// but we cannot update a branch we are on, so in case we", "// are on the branch we are syncing, we check out the SHA", "// first and reset the branch second, then check out the", "// branch we just reset to be in the correct final state", "commands", "=", "append", "(", "commands", ",", "g", ".", "gitCommand", "(", "\"", "\"", ",", "target", ")", ")", "\n", "commands", "=", "append", "(", "commands", ",", "g", ".", "gitCommand", "(", "\"", "\"", ",", "\"", "\"", ",", "refs", ".", "BaseRef", ",", "target", ")", ")", "\n", "commands", "=", "append", "(", "commands", ",", "g", ".", "gitCommand", "(", "\"", "\"", ",", "refs", ".", "BaseRef", ")", ")", "\n\n", "return", "commands", "\n", "}" ]
24,340
all-24341
[ "MustParse", "must", "parse", "string", "to", "time", "or", "it", "will", "panic" ]
[ "func", "(", "now", "*", "Now", ")", "MustParse", "(", "strs", "...", "string", ")", "(", "t", "<mask>", ".", "Time", ")", "{", "t", ",", "err", ":=", "now", ".", "Parse", "(", "strs", "...", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "return", "t", "\n", "}" ]
24,341
all-24342
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "SetTimeDomainTimeDomain", ")", "UnmarshalEasyJSON", "(", "<mask>", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "SetTimeDomainTimeDomain", "(", "in", ".", "String", "(", ")", ")", "{", "case", "SetTimeDomainTimeDomainTimeTicks", ":", "*", "t", "=", "SetTimeDomainTimeDomainTimeTicks", "\n", "case", "SetTimeDomainTimeDomainThreadTicks", ":", "*", "t", "=", "SetTimeDomainTimeDomainThreadTicks", "\n\n", "default", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
24,342
all-24343
[ "Scan", "scans", "a", "DateTime", "value", "from", "database", "driver", "type", "." ]
[ "func", "(", "t", "*", "DateTime", ")", "Scan", "(", "raw", "interface", "{", "}", ")", "error", "{", "// TODO: case int64: and case float64: ?", "switch", "v", ":=", "raw", ".", "(", "type", ")", "{", "case", "[", "]", "byte", ":", "return", "t", ".", "UnmarshalText", "(", "v", ")", "\n", "case", "string", ":", "return", "t", ".", "UnmarshalText", "(", "[", "]", "byte", "(", "v", ")", ")", "\n", "case", "time", ".", "Time", ":", "*", "t", "=", "DateTime", "(", "v", ")", "\n", "<mask>", "nil", ":", "*", "t", "=", "DateTime", "{", "}", "\n", "default", ":", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "v", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
24,343
all-24344
[ "WriteTempFile", "creates", "a", "temp", "file", "with", "the", "specified", "content" ]
[ "func", "WriteTempFile", "(", "dir", "string", ",", "<mask>", "string", ",", "content", "string", ")", "(", "string", ",", "error", ")", "{", "f", ",", "err", ":=", "ioutil", ".", "TempFile", "(", "dir", ",", "prefix", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "defer", "f", ".", "Close", "(", ")", "\n\n", "_", ",", "err", "=", "f", ".", "WriteString", "(", "content", ")", "\n", "return", "f", ".", "Name", "(", ")", ",", "err", "\n", "}" ]
24,344
all-24345
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "PseudoElementMatches", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss26", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
24,345
all-24346
[ "OptImportClear", "sets", "clear", "import", "which", "clears", "bits", "instead", "of", "setting", "them", "." ]
[ "func", "OptImportClear", "(", "clear", "bool", ")", "ImportOption", "{", "return", "func", "(", "<mask>", "*", "ImportOptions", ")", "error", "{", "options", ".", "clear", "=", "clear", "\n", "return", "nil", "\n", "}", "\n", "}" ]
24,346
all-24347
[ "SetHasSelection", "()", "is", "a", "wrapper", "around", "gtk_print_operation_set_has_selection", "()", "." ]
[ "func", "(", "<mask>", "*", "PrintOperation", ")", "SetHasSelection", "(", "selection", "bool", ")", "{", "C", ".", "gtk_print_operation_set_has_selection", "(", "po", ".", "native", "(", ")", ",", "gbool", "(", "selection", ")", ")", "\n", "}" ]
24,347
all-24348
[ "ReadDir", "returns", "the", "filenames", "in", "the", "given", "directory", "in", "sorted", "order", "." ]
[ "func", "ReadDir", "(", "d", "string", ",", "opts", "...", "ReadDirOption", ")", "(", "[", "]", "string", ",", "error", ")", "{", "op", ":=", "&", "ReadDirOp", "{", "}", "\n", "op", ".", "applyOpts", "(", "opts", ")", "\n\n", "dir", ",", "err", ":=", "os", ".", "Open", "(", "d", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "dir", ".", "Close", "(", ")", "\n\n", "names", ",", "err", ":=", "dir", ".", "Readdirnames", "(", "-", "1", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "<mask>", ".", "Strings", "(", "names", ")", "\n\n", "if", "op", ".", "ext", "!=", "\"", "\"", "{", "tss", ":=", "make", "(", "[", "]", "string", ",", "0", ")", "\n", "for", "_", ",", "v", ":=", "range", "names", "{", "if", "filepath", ".", "Ext", "(", "v", ")", "==", "op", ".", "ext", "{", "tss", "=", "append", "(", "tss", ",", "v", ")", "\n", "}", "\n", "}", "\n", "names", "=", "tss", "\n", "}", "\n", "return", "names", ",", "nil", "\n", "}" ]
24,348
all-24349
[ "Equals", "-", "you", "probably", "don", "t", "need", "to", "use", "this", ".", "Runs", "in", "constant", "time", "based", "on", "length", "of", "the", "keys", "." ]
[ "func", "(", "privKey", "PrivKeyEd25519", ")", "Equals", "(", "other", "PrivKey", ")", "bool", "{", "if", "otherEd", ",", "ok", ":=", "other", ".", "(", "PrivKeyEd25519", ")", ";", "<mask>", "{", "return", "subtle", ".", "ConstantTimeCompare", "(", "privKey", "[", ":", "]", ",", "otherEd", "[", ":", "]", ")", "==", "1", "\n", "}", "else", "{", "return", "false", "\n", "}", "\n", "}" ]
24,349
all-24350
[ "find", "the", "exact", "node", "for", "a", "given", "interval" ]
[ "func", "(", "ivt", "*", "IntervalTree", ")", "find", "(", "ivl", "Interval", ")", "(", "ret", "*", "intervalNode", ")", "{", "f", ":=", "func", "(", "n", "*", "intervalNode", ")", "bool", "{", "if", "n", ".", "iv", ".", "Ivl", "!=", "ivl", "{", "return", "true", "\n", "}", "\n", "ret", "=", "n", "\n", "return", "false", "\n", "}", "\n", "ivt", ".", "<mask>", ".", "visit", "(", "&", "ivl", ",", "f", ")", "\n", "return", "ret", "\n", "}" ]
24,350
all-24351
[ "BumpMinor", "increments", "the", "Minor", "field", "by", "1", "and", "resets", "all", "other", "fields", "to", "their", "default", "values" ]
[ "func", "(", "v", "*", "<mask>", ")", "BumpMinor", "(", ")", "{", "v", ".", "Minor", "+=", "1", "\n", "v", ".", "Patch", "=", "0", "\n", "v", ".", "PreRelease", "=", "PreRelease", "(", "\"", "\"", ")", "\n", "v", ".", "Metadata", "=", "\"", "\"", "\n", "}" ]
24,351
all-24352
[ "Usagef", "writes", "usage", "information", "to", "the", "specified", "io", ".", "Writer", "using", "the", "specifed", "template", "specification" ]
[ "func", "Usagef", "(", "prefix", "string", ",", "spec", "interface", "{", "}", ",", "out", "io", ".", "Writer", ",", "format", "string", ")", "error", "{", "// Specify the default usage template functions", "functions", ":=", "template", ".", "FuncMap", "{", "\"", "\"", ":", "func", "(", "v", "varInfo", ")", "string", "{", "return", "v", ".", "<mask>", "}", ",", "\"", "\"", ":", "func", "(", "v", "varInfo", ")", "string", "{", "return", "v", ".", "Tags", ".", "Get", "(", "\"", "\"", ")", "}", ",", "\"", "\"", ":", "func", "(", "v", "varInfo", ")", "string", "{", "return", "toTypeDescription", "(", "v", ".", "Field", ".", "Type", "(", ")", ")", "}", ",", "\"", "\"", ":", "func", "(", "v", "varInfo", ")", "string", "{", "return", "v", ".", "Tags", ".", "Get", "(", "\"", "\"", ")", "}", ",", "\"", "\"", ":", "func", "(", "v", "varInfo", ")", "(", "string", ",", "error", ")", "{", "req", ":=", "v", ".", "Tags", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "req", "!=", "\"", "\"", "{", "reqB", ",", "err", ":=", "strconv", ".", "ParseBool", "(", "req", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "if", "reqB", "{", "req", "=", "\"", "\"", "\n", "}", "\n", "}", "\n", "return", "req", ",", "nil", "\n", "}", ",", "}", "\n\n", "tmpl", ",", "err", ":=", "template", ".", "New", "(", "\"", "\"", ")", ".", "Funcs", "(", "functions", ")", ".", "Parse", "(", "format", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "Usaget", "(", "prefix", ",", "spec", ",", "out", ",", "tmpl", ")", "\n", "}" ]
24,352
all-24353
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetStyleSheetTextParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss14", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
24,353
all-24354
[ "Run", "implements", "the", "Discoverer", "interface", "." ]
[ "func", "(", "i", "*", "Ingress", ")", "Run", "(", "ctx", "context", ".", "Context", ",", "ch", "chan", "<-", "[", "]", "*", "targetgroup", ".", "Group", ")", "{", "defer", "i", ".", "<mask>", ".", "ShutDown", "(", ")", "\n\n", "if", "!", "cache", ".", "WaitForCacheSync", "(", "ctx", ".", "Done", "(", ")", ",", "i", ".", "informer", ".", "HasSynced", ")", "{", "level", ".", "Error", "(", "i", ".", "logger", ")", ".", "Log", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "\n", "}", "\n\n", "go", "func", "(", ")", "{", "for", "i", ".", "process", "(", "ctx", ",", "ch", ")", "{", "}", "\n", "}", "(", ")", "\n\n", "// Block until the target provider is explicitly canceled.", "<-", "ctx", ".", "Done", "(", ")", "\n", "}" ]
24,354
all-24355
[ "Update", "updates", "existing", "UserData", "with", "new", "UserData", ".", "If", "a", "key", "as", "an", "empty", "string", "the", "key", "will", "be", "deleted" ]
[ "func", "(", "ud", "*", "UserData", ")", "Update", "(", "new", "*", "UserData", ")", "{", "if", "new", "==", "nil", "{", "return", "\n", "}", "\n", "new", ".", "Range", "(", "func", "(", "key", ",", "value", "interface", "{", "}", ")", "bool", "{", "if", "value", ".", "(", "string", ")", "!=", "\"", "\"", "{", "ud", ".", "<mask>", "(", "key", ",", "value", ")", "\n", "}", "else", "{", "ud", ".", "Delete", "(", "key", ")", "\n", "}", "\n", "return", "true", "\n", "}", ")", "\n", "}" ]
24,355
all-24356
[ "IsAdmin", "returns", "true", "if", "the", "current", "user", "is", "signed", "in", "and", "is", "currently", "registered", "as", "an", "administrator", "of", "the", "application", "." ]
[ "func", "IsAdmin", "(", "c", "context", ".", "<mask>", ")", "bool", "{", "h", ":=", "internal", ".", "IncomingHeaders", "(", "c", ")", "\n", "return", "h", ".", "Get", "(", "\"", "\"", ")", "==", "\"", "\"", "\n", "}" ]
24,356
all-24357
[ "TokenGenerator", "returns", "a", "handler", "that", "will", "read", "a", "username", "and", "password", "from", "a", "request", "form", "create", "a", "jwt", "token", "if", "they", "are", "valid", "and", "store", "the", "signed", "token", "in", "the", "request", "context", "for", "later", "consumption", ".", "If", "handler", "h", "is", "nil", "the", "generated", "token", "will", "be", "written", "verbatim", "in", "the", "response", "." ]
[ "func", "TokenGenerator", "(", "h", "http", ".", "Handler", ",", "auth", "Authenticator", ",", "secret", "[", "]", "byte", ",", "opts", "...", "TokenOpt", ")", "http", ".", "Handler", "{", "o", ":=", "options", "{", "logger", ":", "handler", ".", "NopLogger", "(", ")", ",", "claimer", ":", "func", "(", "c", "*", "jwt", ".", "StandardClaims", ")", "jwt", ".", "Claims", "{", "return", "c", "}", ",", "expiration", ":", "time", ".", "Hour", "*", "24", "*", "15", ",", "user", ":", "\"", "\"", ",", "password", ":", "\"", "\"", ",", "}", "\n\n", "o", ".", "apply", "(", "opts", ")", "\n\n", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "var", "err", "error", "\n", "if", "strings", ".", "HasPrefix", "(", "r", ".", "Header", ".", "Get", "(", "\"", "\"", ")", ",", "\"", "\"", ")", "{", "err", "=", "r", ".", "ParseMultipartForm", "(", "0", ")", "\n", "}", "else", "{", "err", "=", "r", ".", "ParseForm", "(", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "o", ".", "logger", ".", "Print", "(", "\"", "\"", ",", "err", ")", "\n\n", "http", ".", "Error", "(", "w", ",", "err", ".", "Error", "(", ")", ",", "http", ".", "StatusBadRequest", ")", "\n", "return", "\n", "}", "\n\n", "user", ":=", "r", ".", "FormValue", "(", "o", ".", "user", ")", "\n", "<mask>", ":=", "r", ".", "FormValue", "(", "o", ".", "password", ")", "\n", "if", "user", "==", "\"", "\"", "||", "password", "==", "\"", "\"", "||", "!", "auth", ".", "Authenticate", "(", "user", ",", "password", ")", "{", "w", ".", "WriteHeader", "(", "http", ".", "StatusUnauthorized", ")", "\n", "return", "\n", "}", "\n\n", "expiration", ":=", "time", ".", "Now", "(", ")", ".", "Add", "(", "o", ".", "expiration", ")", "\n", "t", ":=", "jwt", ".", "NewWithClaims", "(", "jwt", ".", "SigningMethodHS512", ",", "o", ".", "claimer", "(", "&", "jwt", ".", "StandardClaims", "{", "Subject", ":", "user", ",", "ExpiresAt", ":", "expiration", ".", "Unix", "(", ")", ",", "Issuer", ":", "o", ".", "issuer", ",", "}", ")", ")", "\n\n", "if", "token", ",", "err", ":=", "t", ".", "SignedString", "(", "secret", ")", ";", "err", "==", "nil", "{", "if", "h", "==", "nil", "{", "w", ".", "Header", "(", ")", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", "+", "token", ")", "\n", "w", ".", "Write", "(", "[", "]", "byte", "(", "token", ")", ")", "\n\n", "return", "\n", "}", "\n\n", "r", "=", "r", ".", "WithContext", "(", "context", ".", "WithValue", "(", "r", ".", "Context", "(", ")", ",", "TokenKey", ",", "token", ")", ")", "\n\n", "h", ".", "ServeHTTP", "(", "w", ",", "r", ")", "\n", "}", "else", "{", "o", ".", "logger", ".", "Print", "(", "\"", "\"", ",", "err", ")", "\n\n", "w", ".", "WriteHeader", "(", "http", ".", "StatusInternalServerError", ")", "\n", "return", "\n", "}", "\n", "}", ")", "\n", "}" ]
24,357
all-24358
[ "List", "returns", "objects", "sorted", "based", "on", "the", "options", "passed", "in", ".", "f", "will", "be", "called", "with", "each", "key", "val", "will", "contain", "the", "corresponding", "value", ".", "Val", "is", "not", "an", "argument", "to", "f", "because", "that", "would", "require", "f", "to", "perform", "a", "cast", "before", "it", "could", "be", "used", ".", "You", "can", "break", "out", "of", "iteration", "by", "returning", "errutil", ".", "ErrBreak", "." ]
[ "func", "(", "c", "*", "readonlyCollection", ")", "List", "(", "val", "proto", ".", "Message", ",", "opts", "*", "Options", ",", "f", "func", "(", "string", ")", "error", ")", "error", "{", "if", "err", ":=", "watch", ".", "CheckType", "(", "c", ".", "template", ",", "val", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "c", ".", "list", "(", "c", ".", "prefix", ",", "&", "c", ".", "limit", ",", "opts", ",", "func", "(", "kv", "*", "mvccpb", ".", "KeyValue", ")", "error", "{", "if", "err", ":=", "proto", ".", "Unmarshal", "(", "kv", ".", "<mask>", ",", "val", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "f", "(", "strings", ".", "TrimPrefix", "(", "string", "(", "kv", ".", "Key", ")", ",", "c", ".", "prefix", ")", ")", "\n", "}", ")", "\n", "}" ]
24,358
all-24359
[ "ProxyIpairs", "implements", "Lua", "5", ".", "2", "ipairs", "functions", ".", "It", "respects", "the", "__ipairs", "metamethod", ".", "It", "is", "only", "useful", "for", "compatibility", "with", "Lua", "5", ".", "1", ".", "Because", "it", "cannot", "call", "ipairs", "for", "it", "might", "recurse", "infinitely", "ProxyIpairs", "reimplements", "ipairsAux", "in", "Go", "which", "can", "be", "a", "performance", "issue", "in", "tight", "loops", ".", "You", "should", "call", "RegProxyIpairs", "instead", "." ]
[ "func", "ProxyIpairs", "(", "L", "*", "lua", ".", "State", ")", "int", "{", "// See Lua >=5.2 source code.", "if", "L", ".", "GetMetaField", "(", "1", ",", "\"", "\"", ")", "{", "L", ".", "PushValue", "(", "1", ")", "\n", "L", ".", "Call", "(", "1", ",", "3", ")", "\n", "<mask>", "3", "\n", "}", "\n\n", "L", ".", "CheckType", "(", "1", ",", "lua", ".", "LUA_TTABLE", ")", "\n", "L", ".", "PushGoFunction", "(", "ipairsAux", ")", "\n", "L", ".", "PushValue", "(", "1", ")", "\n", "L", ".", "PushInteger", "(", "0", ")", "\n", "return", "3", "\n", "}" ]
24,359
all-24360
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "ReleaseAnimationsParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoAnimation6", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
24,360
all-24361
[ "Errorf", "calls", "Logger", ".", "Errorf", "method", "with", "provided", "arguments", "." ]
[ "func", "(", "g", "GRPCLoggerV2", ")", "Errorf", "(", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "g", ".", "l", ".", "Errorf", "(", "<mask>", ",", "args", "...", ")", "\n", "}" ]
24,361
all-24362
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "CreateBrowserContextParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoTarget25", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
24,362
all-24363
[ "NewMonitor", "creates", "a", "new", "client", "billing", "monitor", "." ]
[ "func", "NewMonitor", "(", "conf", "*", "Config", ",", "logger", "log", ".", "Logger", ",", "db", "*", "reform", ".", "<mask>", ",", "pr", "*", "proc", ".", "Processor", ",", "pscAddr", "string", ",", "pw", "data", ".", "PWDGetter", ")", "*", "Monitor", "{", "return", "&", "Monitor", "{", "conf", ":", "conf", ",", "logger", ":", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ")", ",", "db", ":", "db", ",", "pr", ":", "pr", ",", "psc", ":", "pscAddr", ",", "pw", ":", "pw", ",", "post", ":", "pay", ".", "PostCheque", ",", "}", "\n", "}" ]
24,363
all-24364
[ "ClientAfterOfferingMsgBCPublish", "creates", "offering", "." ]
[ "func", "(", "w", "*", "Worker", ")", "ClientAfterOfferingMsgBCPublish", "(", "job", "*", "data", ".", "Job", ")", "error", "{", "logger", ":=", "w", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "<mask>", ")", "\n\n", "ethLog", ",", "err", ":=", "w", ".", "ethLog", "(", "logger", ",", "job", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "logOfferingCreated", ",", "err", ":=", "extractLogOfferingCreated", "(", "logger", ",", "ethLog", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "w", ".", "clientRetrieveAndSaveOffering", "(", "logger", ",", "job", ",", "ethLog", ".", "Block", ",", "logOfferingCreated", ".", "somcType", ",", "logOfferingCreated", ".", "somcData", ",", "logOfferingCreated", ".", "agentAddr", ",", "logOfferingCreated", ".", "offeringHash", ",", "logOfferingCreated", ".", "currentSupply", ")", "\n", "}" ]
24,364
all-24365
[ "FetchDashboards", "retrieves", "all", "dashboards", "available", "to", "the", "API", "Token", "." ]
[ "func", "(", "a", "*", "API", ")", "FetchDashboards", "(", ")", "(", "*", "[", "]", "Dashboard", ",", "error", ")", "{", "result", ",", "err", ":=", "a", ".", "Get", "(", "config", ".", "DashboardPrefix", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "<mask>", "dashboards", "[", "]", "Dashboard", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "&", "dashboards", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "dashboards", ",", "nil", "\n", "}" ]
24,365
all-24366
[ "Object", "adds", "an", "object", "-", "valued", "key", ":", "value", "pair", "to", "a", "Span", ".", "LogFields", "()", "record" ]
[ "func", "Object", "(", "key", "string", ",", "obj", "interface", "{", "}", ")", "Field", "{", "return", "Field", "{", "<mask>", ":", "key", ",", "fieldType", ":", "objectType", ",", "interfaceVal", ":", "obj", ",", "}", "\n", "}" ]
24,366
all-24367
[ "GetWidth", "returns", "the", "Width", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "t", "*", "TileDefRequestStyle", ")", "GetWidth", "(", ")", "<mask>", "{", "if", "t", "==", "nil", "||", "t", ".", "Width", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "t", ".", "Width", "\n", "}" ]
24,367
all-24368
[ "Delete", "deletes", "a", "task", "from", "a", "named", "queue", "." ]
[ "func", "Delete", "(", "c", "context", ".", "Context", ",", "task", "*", "Task", ",", "queueName", "string", ")", "error", "{", "err", ":=", "DeleteMulti", "(", "c", ",", "[", "]", "*", "Task", "{", "<mask>", "}", ",", "queueName", ")", "\n", "if", "me", ",", "ok", ":=", "err", ".", "(", "appengine", ".", "MultiError", ")", ";", "ok", "{", "return", "me", "[", "0", "]", "\n", "}", "\n", "return", "err", "\n", "}" ]
24,368
all-24369
[ "GetIncludeUnits", "returns", "the", "IncludeUnits", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "y", "*", "Yaxis", ")", "GetIncludeUnits", "(", ")", "bool", "{", "if", "y", "==", "nil", "||", "y", ".", "IncludeUnits", "==", "nil", "{", "return", "<mask>", "\n", "}", "\n", "return", "*", "y", ".", "IncludeUnits", "\n", "}" ]
24,369
all-24370
[ "flattenKeys", "is", "a", "function", "that", "takes", "a", "map", "[", "string", "]", "interface", "{}", "and", "recursively", "flattens", "any", "keys", "that", "are", "a", "[]", "map", "[", "string", "]", "interface", "{}", "where", "the", "key", "is", "in", "the", "given", "list", "of", "keys", "." ]
[ "func", "flattenKeys", "(", "m", "map", "[", "string", "]", "interface", "{", "}", ",", "keys", "[", "]", "string", ")", "{", "keyMap", ":=", "make", "(", "map", "[", "string", "]", "struct", "{", "}", ")", "\n", "for", "_", ",", "key", ":=", "range", "keys", "{", "keyMap", "[", "key", "]", "=", "struct", "{", "}", "{", "}", "\n", "}", "\n\n", "var", "flatten", "func", "(", "map", "[", "string", "]", "interface", "{", "}", ",", "string", ")", "\n", "flatten", "=", "func", "(", "m", "map", "[", "string", "]", "interface", "{", "}", ",", "parent", "string", ")", "{", "for", "k", ",", "v", ":=", "range", "m", "{", "// Calculate the map key, since it could include a parent.", "mapKey", ":=", "k", "\n", "if", "parent", "!=", "\"", "\"", "{", "mapKey", "=", "parent", "+", "\"", "\"", "+", "k", "\n", "}", "\n\n", "if", "_", ",", "ok", ":=", "keyMap", "[", "mapKey", "]", ";", "!", "ok", "{", "continue", "\n", "}", "\n\n", "switch", "typed", ":=", "v", ".", "(", "type", ")", "{", "case", "[", "]", "map", "[", "string", "]", "interface", "{", "}", ":", "if", "len", "(", "typed", ")", ">", "0", "{", "last", ":=", "typed", "[", "len", "(", "typed", ")", "-", "1", "]", "\n", "flatten", "(", "<mask>", ",", "mapKey", ")", "\n", "m", "[", "k", "]", "=", "last", "\n", "}", "else", "{", "m", "[", "k", "]", "=", "nil", "\n", "}", "\n", "case", "map", "[", "string", "]", "interface", "{", "}", ":", "flatten", "(", "typed", ",", "mapKey", ")", "\n", "m", "[", "k", "]", "=", "typed", "\n", "default", ":", "m", "[", "k", "]", "=", "v", "\n", "}", "\n", "}", "\n", "}", "\n\n", "flatten", "(", "m", ",", "\"", "\"", ")", "\n", "}" ]
24,370
all-24371
[ "creates", "and", "initializes", "a", "buffer", "object", "s", "immutable", "data", "store" ]
[ "func", "BufferStorage", "(", "target", "uint32", ",", "size", "int", ",", "data", "unsafe", ".", "Pointer", ",", "<mask>", "uint32", ")", "{", "syscall", ".", "Syscall6", "(", "gpBufferStorage", ",", "4", ",", "uintptr", "(", "target", ")", ",", "uintptr", "(", "size", ")", ",", "uintptr", "(", "data", ")", ",", "uintptr", "(", "flags", ")", ",", "0", ",", "0", ")", "\n", "}" ]
24,371
all-24372
[ "Link", "returns", "the", "URL", "to", "the", "repository", "that", "is", "intended", "for", "access", "by", "humans", "using", "a", "Web", "browser", "(", "i", ".", "e", ".", "not", "the", "URL", "to", "the", "API", "resource", ")", "." ]
[ "func", "(", "r", "*", "RepoInfo", ")", "Link", "(", ")", "string", "{", "switch", "r", ".", "RepoHost", "{", "case", "GoogleCode", ":", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "r", ".", "FullName", ")", "\n", "default", ":", "return", "(", "&", "url", ".", "URL", "{", "Scheme", ":", "\"", "\"", ",", "Host", ":", "string", "(", "r", ".", "RepoHost", ")", ",", "<mask>", ":", "\"", "\"", "+", "r", ".", "FullName", "}", ")", ".", "String", "(", ")", "\n", "}", "\n", "}" ]
24,372
all-24373
[ "Add", "MAC", "VLAN", "network", "interface", "with", "masterDev", "as", "its", "upper", "device", "This", "is", "identical", "to", "running", ":", "ip", "link", "add", "name", "$name", "link", "$masterdev", "type", "macvlan", "mode", "$mode" ]
[ "func", "networkLinkMacVlan", "(", "dev_type", "string", ",", "mcvln", "*", "MacVlanLink", ")", "error", "{", "s", ",", "err", ":=", "getNetlinkSocket", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "s", ".", "Close", "(", ")", "\n\n", "wb", ":=", "newNetlinkRequest", "(", "syscall", ".", "RTM_NEWLINK", ",", "syscall", ".", "NLM_F_CREATE", "|", "syscall", ".", "NLM_F_EXCL", "|", "syscall", ".", "NLM_F_ACK", ")", "\n\n", "masterDevIfc", ",", "err", ":=", "<mask>", ".", "InterfaceByName", "(", "mcvln", ".", "MasterDev", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "msg", ":=", "newIfInfomsg", "(", "syscall", ".", "AF_UNSPEC", ")", "\n", "wb", ".", "AddData", "(", "msg", ")", "\n\n", "nest1", ":=", "newRtAttr", "(", "syscall", ".", "IFLA_LINKINFO", ",", "nil", ")", "\n", "newRtAttrChild", "(", "nest1", ",", "IFLA_INFO_KIND", ",", "nonZeroTerminated", "(", "dev_type", ")", ")", "\n\n", "nest2", ":=", "newRtAttrChild", "(", "nest1", ",", "IFLA_INFO_DATA", ",", "nil", ")", "\n", "macVlanData", ":=", "make", "(", "[", "]", "byte", ",", "4", ")", "\n", "native", ".", "PutUint32", "(", "macVlanData", ",", "mcvln", ".", "Mode", "(", ")", ")", "\n", "newRtAttrChild", "(", "nest2", ",", "IFLA_MACVLAN_MODE", ",", "macVlanData", ")", "\n", "wb", ".", "AddData", "(", "nest1", ")", "\n\n", "wb", ".", "AddData", "(", "uint32Attr", "(", "syscall", ".", "IFLA_LINK", ",", "uint32", "(", "masterDevIfc", ".", "Index", ")", ")", ")", "\n", "wb", ".", "AddData", "(", "newRtAttr", "(", "syscall", ".", "IFLA_IFNAME", ",", "zeroTerminated", "(", "mcvln", ".", "SlaveDev", ")", ")", ")", "\n\n", "if", "err", ":=", "s", ".", "Send", "(", "wb", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "s", ".", "HandleAck", "(", "wb", ".", "Seq", ")", "\n", "}" ]
24,373
all-24374
[ "XXX_OneofFuncs", "is", "for", "the", "internal", "use", "of", "the", "proto", "package", "." ]
[ "func", "(", "*", "RequestOp", ")", "XXX_OneofFuncs", "(", ")", "(", "func", "(", "msg", "proto", ".", "Message", ",", "b", "*", "proto", ".", "Buffer", ")", "error", ",", "func", "(", "msg", "proto", ".", "Message", ",", "tag", ",", "wire", "int", ",", "b", "*", "proto", ".", "Buffer", ")", "(", "bool", ",", "error", ")", ",", "func", "(", "<mask>", "proto", ".", "Message", ")", "(", "n", "int", ")", ",", "[", "]", "interface", "{", "}", ")", "{", "return", "_RequestOp_OneofMarshaler", ",", "_RequestOp_OneofUnmarshaler", ",", "_RequestOp_OneofSizer", ",", "[", "]", "interface", "{", "}", "{", "(", "*", "RequestOp_RequestRange", ")", "(", "nil", ")", ",", "(", "*", "RequestOp_RequestPut", ")", "(", "nil", ")", ",", "(", "*", "RequestOp_RequestDeleteRange", ")", "(", "nil", ")", ",", "(", "*", "RequestOp_RequestTxn", ")", "(", "nil", ")", ",", "}", "\n", "}" ]
24,374
all-24375
[ "String", "returns", "a", "string", "representation", "of", "the", "Livestatus", "command", "." ]
[ "func", "(", "c", "Command", ")", "String", "(", ")", "string", "{", "s", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ".", "Now", "(", ")", ".", "Unix", "(", ")", ",", "c", ".", "name", ")", "\n", "if", "len", "(", "c", ".", "args", ")", ">", "0", "{", "s", "+=", "\"", "\"", "+", "strings", ".", "Join", "(", "c", ".", "args", ",", "\"", "\"", ")", "\n", "}", "\n", "s", "+=", "\"", "\\n", "\\n", "\"", "\n\n", "return", "s", "\n", "}" ]
24,375
all-24376
[ "builtin", "emits", "to", "fn", "SSA", "instructions", "to", "implement", "a", "call", "to", "the", "built", "-", "in", "function", "obj", "with", "the", "specified", "arguments", "and", "return", "type", ".", "It", "returns", "the", "value", "defined", "by", "the", "result", ".", "The", "result", "is", "nil", "if", "no", "special", "handling", "was", "required", ";", "in", "this", "case", "the", "caller", "should", "treat", "this", "like", "an", "ordinary", "library", "function", "call", "." ]
[ "func", "(", "b", "*", "builder", ")", "builtin", "(", "fn", "*", "Function", ",", "obj", "*", "types", ".", "Builtin", ",", "args", "[", "]", "ast", ".", "Expr", ",", "typ", "types", ".", "Type", ",", "pos", "token", ".", "Pos", ")", "Value", "{", "switch", "obj", ".", "Name", "(", ")", "{", "case", "\"", "\"", ":", "switch", "typ", ".", "Underlying", "(", ")", ".", "(", "type", ")", "{", "case", "*", "types", ".", "Slice", ":", "n", ":=", "b", ".", "expr", "(", "fn", ",", "args", "[", "1", "]", ")", "\n", "m", ":=", "n", "\n", "if", "len", "(", "args", ")", "==", "3", "{", "m", "=", "b", ".", "expr", "(", "fn", ",", "args", "[", "2", "]", ")", "\n", "}", "\n", "if", "m", ",", "ok", ":=", "m", ".", "(", "*", "Const", ")", ";", "ok", "{", "// treat make([]T, n, m) as new([m]T)[:n]", "cap", ":=", "m", ".", "Int64", "(", ")", "\n", "at", ":=", "types", ".", "NewArray", "(", "typ", ".", "Underlying", "(", ")", ".", "(", "*", "types", ".", "Slice", ")", ".", "Elem", "(", ")", ",", "cap", ")", "\n", "alloc", ":=", "emitNew", "(", "fn", ",", "at", ",", "pos", ")", "\n", "alloc", ".", "Comment", "=", "\"", "\"", "\n", "v", ":=", "&", "Slice", "{", "X", ":", "alloc", ",", "High", ":", "n", ",", "}", "\n", "v", ".", "setPos", "(", "pos", ")", "\n", "v", ".", "setType", "(", "typ", ")", "\n", "return", "fn", ".", "emit", "(", "v", ")", "\n", "}", "\n", "v", ":=", "&", "MakeSlice", "{", "Len", ":", "n", ",", "Cap", ":", "m", ",", "}", "\n", "v", ".", "setPos", "(", "pos", ")", "\n", "v", ".", "setType", "(", "typ", ")", "\n", "return", "fn", ".", "emit", "(", "v", ")", "\n\n", "case", "*", "types", ".", "Map", ":", "var", "res", "Value", "\n", "if", "len", "(", "args", ")", "==", "2", "{", "res", "=", "b", ".", "expr", "(", "fn", ",", "args", "[", "1", "]", ")", "\n", "}", "\n", "v", ":=", "&", "MakeMap", "{", "Reserve", ":", "res", "}", "\n", "v", ".", "setPos", "(", "pos", ")", "\n", "v", ".", "setType", "(", "typ", ")", "\n", "return", "fn", ".", "emit", "(", "v", ")", "\n\n", "case", "*", "types", ".", "Chan", ":", "var", "sz", "<mask>", "=", "vZero", "\n", "if", "len", "(", "args", ")", "==", "2", "{", "sz", "=", "b", ".", "expr", "(", "fn", ",", "args", "[", "1", "]", ")", "\n", "}", "\n", "v", ":=", "&", "MakeChan", "{", "Size", ":", "sz", "}", "\n", "v", ".", "setPos", "(", "pos", ")", "\n", "v", ".", "setType", "(", "typ", ")", "\n", "return", "fn", ".", "emit", "(", "v", ")", "\n", "}", "\n\n", "case", "\"", "\"", ":", "alloc", ":=", "emitNew", "(", "fn", ",", "deref", "(", "typ", ")", ",", "pos", ")", "\n", "alloc", ".", "Comment", "=", "\"", "\"", "\n", "return", "alloc", "\n\n", "case", "\"", "\"", ",", "\"", "\"", ":", "// Special case: len or cap of an array or *array is", "// based on the type, not the value which may be nil.", "// We must still evaluate the value, though. (If it", "// was side-effect free, the whole call would have", "// been constant-folded.)", "t", ":=", "deref", "(", "fn", ".", "Pkg", ".", "typeOf", "(", "args", "[", "0", "]", ")", ")", ".", "Underlying", "(", ")", "\n", "if", "at", ",", "ok", ":=", "t", ".", "(", "*", "types", ".", "Array", ")", ";", "ok", "{", "b", ".", "expr", "(", "fn", ",", "args", "[", "0", "]", ")", "// for effects only", "\n", "return", "intConst", "(", "at", ".", "Len", "(", ")", ")", "\n", "}", "\n", "// Otherwise treat as normal.", "case", "\"", "\"", ":", "fn", ".", "emit", "(", "&", "Panic", "{", "X", ":", "emitConv", "(", "fn", ",", "b", ".", "expr", "(", "fn", ",", "args", "[", "0", "]", ")", ",", "tEface", ")", ",", "pos", ":", "pos", ",", "}", ")", "\n", "fn", ".", "currentBlock", "=", "fn", ".", "newBasicBlock", "(", "\"", "\"", ")", "\n", "return", "vTrue", "// any non-nil Value will do", "\n", "}", "\n", "return", "nil", "// treat all others as a regular function call", "\n", "}" ]
24,376
all-24377
[ "Queues", "a", "message", "to", "be", "sent", "to", "channel", "." ]
[ "func", "(", "c", "*", "MConnection", ")", "Send", "(", "chID", "byte", ",", "msg", "interface", "{", "}", ")", "bool", "{", "if", "!", "c", ".", "IsRunning", "(", ")", "{", "return", "false", "\n", "}", "\n\n", "<mask>", ".", "Debug", "(", "\"", "\"", ",", "\"", "\"", ",", "chID", ",", "\"", "\"", ",", "c", ",", "\"", "\"", ",", "msg", ")", "//, \"bytes\", wire.BinaryBytes(msg))", "\n\n", "// Send message to channel.", "channel", ",", "ok", ":=", "c", ".", "channelsIdx", "[", "chID", "]", "\n", "if", "!", "ok", "{", "log", ".", "Error", "(", "cmn", ".", "Fmt", "(", "\"", "\"", ",", "chID", ")", ")", "\n", "return", "false", "\n", "}", "\n\n", "success", ":=", "channel", ".", "sendBytes", "(", "wire", ".", "BinaryBytes", "(", "msg", ")", ")", "\n", "if", "success", "{", "// Wake up sendRoutine if necessary", "select", "{", "case", "c", ".", "send", "<-", "struct", "{", "}", "{", "}", ":", "default", ":", "}", "\n", "}", "else", "{", "log", ".", "Warn", "(", "\"", "\"", ",", "\"", "\"", ",", "chID", ",", "\"", "\"", ",", "c", ",", "\"", "\"", ",", "msg", ")", "\n", "}", "\n", "return", "success", "\n", "}" ]
24,377
all-24378
[ "Value", "tries", "to", "get", "a", "value", "from", "the", "transaction", ".", "If", "the", "key", "does", "not", "exist", "the", "f", "is", "not", "called", "and", "nil", "is", "return", "." ]
[ "func", "(", "tx", "Tx", ")", "<mask>", "(", "k", "[", "]", "[", "]", "byte", ",", "f", "func", "(", "v", "bytesp", ".", "Slice", ")", "error", ")", "error", "{", "return", "tx", ".", "Bucket", "(", "k", "[", ":", "len", "(", "k", ")", "-", "1", "]", ",", "func", "(", "b", "Bucket", ")", "error", "{", "v", ":=", "b", ".", "Bucket", ".", "Get", "(", "k", "[", "len", "(", "k", ")", "-", "1", "]", ")", "\n", "if", "v", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "errorsp", ".", "WithStacks", "(", "f", "(", "bytesp", ".", "Slice", "(", "v", ")", ")", ")", "\n", "}", ")", "\n", "}" ]
24,378
all-24379
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "ReadReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoIo2", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
24,379
all-24380
[ "nolint", ":", "deadcode", "used", "from", "unit", "test" ]
[ "func", "serviceToServiceSummary", "(", "service", "*", "sd", ".", "Service", ")", "*", "sd", ".", "ServiceSummary", "{", "if", "service", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "return", "&", "sd", ".", "ServiceSummary", "{", "Name", ":", "<mask>", ".", "Name", ",", "Id", ":", "service", ".", "Id", ",", "Arn", ":", "service", ".", "Arn", ",", "Description", ":", "service", ".", "Description", ",", "InstanceCount", ":", "service", ".", "InstanceCount", ",", "}", "\n", "}" ]
24,380
all-24381
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetPlatformFontsForNodeReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss37", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
24,381
all-24382
[ "Disconnect", "is", "used", "to", "remove", "the", "ability", "to", "route", "to", "a", "given", "peer", "." ]
[ "func", "(", "i", "*", "InmemTransport", ")", "Disconnect", "(", "peer", "ServerAddress", ")", "{", "i", ".", "Lock", "(", ")", "\n", "defer", "i", ".", "Unlock", "(", ")", "\n", "delete", "(", "i", ".", "peers", ",", "<mask>", ")", "\n\n", "// Disconnect any pipelines", "n", ":=", "len", "(", "i", ".", "pipelines", ")", "\n", "for", "idx", ":=", "0", ";", "idx", "<", "n", ";", "idx", "++", "{", "if", "i", ".", "pipelines", "[", "idx", "]", ".", "peerAddr", "==", "peer", "{", "i", ".", "pipelines", "[", "idx", "]", ".", "Close", "(", ")", "\n", "i", ".", "pipelines", "[", "idx", "]", ",", "i", ".", "pipelines", "[", "n", "-", "1", "]", "=", "i", ".", "pipelines", "[", "n", "-", "1", "]", ",", "nil", "\n", "idx", "--", "\n", "n", "--", "\n", "}", "\n", "}", "\n", "i", ".", "pipelines", "=", "i", ".", "pipelines", "[", ":", "n", "]", "\n", "}" ]
24,382
all-24383
[ "NewDockerClient", "initializes", "a", "new", "API", "client", "based", "on", "the", "passed", "SystemContext", "." ]
[ "func", "newDockerClient", "(", "sys", "*", "types", ".", "SystemContext", ")", "(", "*", "dockerclient", ".", "Client", ",", "error", ")", "{", "host", ":=", "dockerclient", ".", "DefaultDockerHost", "\n", "if", "sys", "!=", "nil", "&&", "sys", ".", "DockerDaemonHost", "!=", "\"", "\"", "{", "host", "=", "sys", ".", "DockerDaemonHost", "\n", "}", "\n\n", "// Sadly, unix:// sockets don't work transparently with dockerclient.NewClient.", "// They work fine with a nil httpClient; with a non-nil httpClient, the transport’s", "// TLSClientConfig must be nil (or the client will try using HTTPS over the PF_UNIX socket", "// regardless of the values in the *tls.Config), and we would have to call sockets.ConfigureTransport.", "//", "// We don't really want to configure anything for unix:// sockets, so just pass a nil *http.Client.", "//", "// Similarly, if we want to communicate over plain HTTP on a TCP socket, we also need to set", "// TLSClientConfig to nil. This can be achieved by using the form `http://`", "url", ",", "err", ":=", "dockerclient", ".", "ParseHostURL", "(", "host", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "var", "httpClient", "*", "http", ".", "Client", "\n", "if", "url", ".", "Scheme", "!=", "\"", "\"", "{", "if", "url", ".", "Scheme", "==", "\"", "\"", "{", "httpClient", "=", "httpConfig", "(", ")", "\n", "}", "else", "{", "hc", ",", "err", ":=", "tlsConfig", "(", "sys", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "httpClient", "=", "hc", "\n", "}", "\n", "}", "\n\n", "return", "dockerclient", ".", "NewClient", "(", "<mask>", ",", "defaultAPIVersion", ",", "httpClient", ",", "nil", ")", "\n", "}" ]
24,383
all-24384
[ "parseItem", "is", "a", "complex", "function", "because", "it", "needs", "to", "handle", "both", "forward", "and", "reverse", "iteration", "implementation", ".", "We", "store", "keys", "such", "that", "their", "versions", "are", "sorted", "in", "descending", "order", ".", "This", "makes", "forward", "iteration", "efficient", "but", "revese", "iteration", "complicated", ".", "This", "tradeoff", "is", "better", "because", "forward", "iteration", "is", "more", "common", "than", "reverse", ".", "This", "function", "advances", "the", "iterator", "." ]
[ "func", "(", "it", "*", "Iterator", ")", "parseItem", "(", ")", "bool", "{", "mi", ":=", "it", ".", "iitr", "\n", "key", ":=", "mi", ".", "Key", "(", ")", "\n\n", "setItem", ":=", "func", "(", "item", "*", "Item", ")", "{", "if", "it", ".", "item", "==", "nil", "{", "it", ".", "item", "=", "item", "\n", "}", "else", "{", "it", ".", "data", ".", "push", "(", "item", ")", "\n", "}", "\n", "}", "\n\n", "// Skip badger keys.", "if", "!", "it", ".", "opt", ".", "internalAccess", "&&", "bytes", ".", "HasPrefix", "(", "key", ",", "badgerPrefix", ")", "{", "mi", ".", "Next", "(", ")", "\n", "return", "false", "\n", "}", "\n\n", "// Skip any versions which are beyond the readTs.", "version", ":=", "y", ".", "ParseTs", "(", "key", ")", "\n", "if", "version", ">", "it", ".", "readTs", "{", "mi", ".", "Next", "(", ")", "\n", "return", "false", "\n", "}", "\n\n", "if", "it", ".", "opt", ".", "AllVersions", "{", "// Return deleted or expired values also, otherwise user can't figure out", "// whether the key was deleted.", "item", ":=", "it", ".", "newItem", "(", ")", "\n", "it", ".", "fill", "(", "item", ")", "\n", "setItem", "(", "item", ")", "\n", "mi", ".", "Next", "(", ")", "\n", "return", "true", "\n", "}", "\n\n", "// If iterating in forward direction, then just checking the last key against current key would", "// be sufficient.", "if", "!", "it", ".", "opt", ".", "Reverse", "{", "if", "y", ".", "SameKey", "(", "<mask>", ".", "lastKey", ",", "key", ")", "{", "mi", ".", "Next", "(", ")", "\n", "return", "false", "\n", "}", "\n", "// Only track in forward direction.", "// We should update lastKey as soon as we find a different key in our snapshot.", "// Consider keys: a 5, b 7 (del), b 5. When iterating, lastKey = a.", "// Then we see b 7, which is deleted. If we don't store lastKey = b, we'll then return b 5,", "// which is wrong. Therefore, update lastKey here.", "it", ".", "lastKey", "=", "y", ".", "SafeCopy", "(", "it", ".", "lastKey", ",", "mi", ".", "Key", "(", ")", ")", "\n", "}", "\n\n", "FILL", ":", "// If deleted, advance and return.", "vs", ":=", "mi", ".", "Value", "(", ")", "\n", "if", "isDeletedOrExpired", "(", "vs", ".", "Meta", ",", "vs", ".", "ExpiresAt", ")", "{", "mi", ".", "Next", "(", ")", "\n", "return", "false", "\n", "}", "\n\n", "item", ":=", "it", ".", "newItem", "(", ")", "\n", "it", ".", "fill", "(", "item", ")", "\n", "// fill item based on current cursor position. All Next calls have returned, so reaching here", "// means no Next was called.", "mi", ".", "Next", "(", ")", "// Advance but no fill item yet.", "\n", "if", "!", "it", ".", "opt", ".", "Reverse", "||", "!", "mi", ".", "Valid", "(", ")", "{", "// Forward direction, or invalid.", "setItem", "(", "item", ")", "\n", "return", "true", "\n", "}", "\n\n", "// Reverse direction.", "nextTs", ":=", "y", ".", "ParseTs", "(", "mi", ".", "Key", "(", ")", ")", "\n", "mik", ":=", "y", ".", "ParseKey", "(", "mi", ".", "Key", "(", ")", ")", "\n", "if", "nextTs", "<=", "it", ".", "readTs", "&&", "bytes", ".", "Equal", "(", "mik", ",", "item", ".", "key", ")", "{", "// This is a valid potential candidate.", "goto", "FILL", "\n", "}", "\n", "// Ignore the next candidate. Return the current one.", "setItem", "(", "item", ")", "\n", "return", "true", "\n", "}" ]
24,384
all-24385
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "RareIntegerData", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomsnapshot2", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
24,385
all-24386
[ "LayoutNew", "is", "a", "wrapper", "around", "gtk_layout_new", "()", "." ]
[ "func", "LayoutNew", "(", "hadjustment", ",", "vadjustment", "*", "Adjustment", ")", "(", "*", "Layout", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_layout_new", "(", "hadjustment", ".", "native", "(", ")", ",", "vadjustment", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "<mask>", "wrapLayout", "(", "obj", ")", ",", "nil", "\n", "}" ]
24,386
all-24387
[ "Create", "a", "new", "raftFactory", "instantiating", "all", "needed", "raft", "dependencies", "." ]
[ "func", "raftInstanceInit", "(", "db", "*", "db", ".", "Node", ",", "node", "*", "db", ".", "RaftNode", ",", "cert", "*", "shared", ".", "CertInfo", ",", "latency", "float64", ")", "(", "*", "raftInstance", ",", "error", ")", "{", "// FIXME: should be a parameter", "timeout", ":=", "5", "*", "time", ".", "Second", "\n\n", "raftLogger", ":=", "raftLogger", "(", ")", "\n\n", "// Raft config.", "config", ":=", "raftConfig", "(", "latency", ")", "\n", "config", ".", "Logger", "=", "raftLogger", "\n", "config", ".", "LocalID", "=", "raft", ".", "ServerID", "(", "strconv", ".", "Itoa", "(", "int", "(", "node", ".", "ID", ")", ")", ")", "\n\n", "// Raft transport", "var", "<mask>", "*", "rafthttp", ".", "Handler", "\n", "var", "membershipChanger", "func", "(", "*", "raft", ".", "Raft", ")", "\n", "var", "layer", "*", "rafthttp", ".", "Layer", "\n", "var", "transport", "raft", ".", "Transport", "\n", "addr", ":=", "node", ".", "Address", "\n", "if", "addr", "==", "\"", "\"", "{", "// This should normally be used only for testing as it can", "// cause split-brian, but since we are not exposing raft to the", "// network at all it's safe to do so. When this node gets", "// exposed to the network and assigned an address, we need to", "// restart raft anyways.", "config", ".", "StartAsLeader", "=", "true", "\n", "transport", "=", "raftMemoryTransport", "(", ")", "\n", "}", "else", "{", "dial", ",", "err", ":=", "raftDial", "(", "cert", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "transport", ",", "handler", ",", "layer", ",", "err", "=", "raftNetworkTransport", "(", "db", ",", "addr", ",", "log", ".", "New", "(", "&", "raftLogWriter", "{", "}", ",", "\"", "\"", ",", "0", ")", ",", "timeout", ",", "dial", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "membershipChanger", "=", "func", "(", "raft", "*", "raft", ".", "Raft", ")", "{", "raftmembership", ".", "HandleChangeRequests", "(", "raft", ",", "handler", ".", "Requests", "(", ")", ")", "\n", "}", "\n", "}", "\n\n", "err", ":=", "raft", ".", "ValidateConfig", "(", "config", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// Rename legacy data directory if needed.", "dir", ":=", "filepath", ".", "Join", "(", "db", ".", "Dir", "(", ")", ",", "\"", "\"", ")", "\n", "legacyDir", ":=", "filepath", ".", "Join", "(", "db", ".", "Dir", "(", ")", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "shared", ".", "PathExists", "(", "legacyDir", ")", "{", "if", "shared", ".", "PathExists", "(", "dir", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "logger", ".", "Info", "(", "\"", "\"", ")", "\n", "err", ":=", "os", ".", "Rename", "(", "legacyDir", ",", "dir", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "// Data directory", "if", "!", "shared", ".", "PathExists", "(", "dir", ")", "{", "err", ":=", "os", ".", "Mkdir", "(", "dir", ",", "0750", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "// Raft logs store", "logs", ",", "err", ":=", "raftboltdb", ".", "New", "(", "raftboltdb", ".", "Options", "{", "Path", ":", "filepath", ".", "Join", "(", "dir", ",", "\"", "\"", ")", ",", "BoltOptions", ":", "&", "bolt", ".", "Options", "{", "Timeout", ":", "timeout", "}", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// Raft snapshot store (don't log snapshots since we take them frequently)", "snaps", ",", "err", ":=", "raft", ".", "NewFileSnapshotStoreWithLogger", "(", "dir", ",", "2", ",", "log", ".", "New", "(", "ioutil", ".", "Discard", ",", "\"", "\"", ",", "0", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// If we are the initial node, we use the last index persisted in the", "// logs store and other checks to determine if we have ever", "// bootstrapped the cluster, and if not we do so (see raft.HasExistingState).", "if", "node", ".", "ID", "==", "1", "{", "err", ":=", "raftMaybeBootstrap", "(", "config", ",", "logs", ",", "snaps", ",", "transport", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "// The dqlite registry and FSM.", "registry", ":=", "dqlite", ".", "NewRegistry", "(", "strconv", ".", "Itoa", "(", "serial", ")", ")", "\n", "serial", "++", "\n", "fsm", ":=", "dqlite", ".", "NewFSM", "(", "registry", ")", "\n\n", "// The actual raft instance.", "raft", ",", "err", ":=", "raft", ".", "NewRaft", "(", "config", ",", "fsm", ",", "logs", ",", "logs", ",", "snaps", ",", "transport", ")", "\n", "if", "err", "!=", "nil", "{", "logs", ".", "Close", "(", ")", "\n", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "membershipChanger", "!=", "nil", "{", "// Process Raft connections over HTTP. This goroutine will", "// terminate when instance.handler.Close() is called, which", "// happens indirectly when the raft instance is shutdown in", "// instance.Shutdown(), and the associated transport is closed.", "go", "membershipChanger", "(", "raft", ")", "\n", "}", "\n\n", "instance", ":=", "&", "raftInstance", "{", "layer", ":", "layer", ",", "handler", ":", "raftHandler", "(", "cert", ",", "handler", ")", ",", "membershipChanger", ":", "membershipChanger", ",", "logs", ":", "logs", ",", "registry", ":", "registry", ",", "fsm", ":", "fsm", ",", "raft", ":", "raft", ",", "}", "\n\n", "return", "instance", ",", "nil", "\n", "}" ]
24,387
all-24388
[ "SetConnectTimeout", "sets", "the", "ConnectionTimeout", "for", "this", "context", ".", "The", "context", "timeout", "applies", "to", "the", "whole", "call", "while", "the", "connect", "timeout", "only", "applies", "to", "creating", "a", "new", "connection", "." ]
[ "func", "(", "cb", "*", "ContextBuilder", ")", "SetConnectTimeout", "(", "d", "<mask>", ".", "Duration", ")", "*", "ContextBuilder", "{", "cb", ".", "ConnectTimeout", "=", "d", "\n", "return", "cb", "\n", "}" ]
24,388
all-24389
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetReturnValueParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger7", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
24,389
all-24390
[ "SendRequest", "sends", "a", "JSON", "-", "RPC", "request", "through", "the", "connection", "denoted", "by", "the", "connection", "ID", "with", "an", "auto", "generated", "request", "ID", ".", "resHandler", "is", "called", "when", "a", "response", "is", "returned", "." ]
[ "func", "(", "s", "*", "Server", ")", "SendRequest", "(", "connID", "string", ",", "method", "string", ",", "params", "interface", "{", "}", ",", "resHandler", "func", "(", "ctx", "*", "ResCtx", ")", "error", ")", "(", "reqID", "string", ",", "err", "error", ")", "{", "if", "!", "s", ".", "running", ".", "Load", "(", ")", ".", "(", "bool", ")", "{", "return", "\"", "\"", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "conn", ",", "<mask>", ":=", "s", ".", "conns", ".", "GetOk", "(", "connID", ")", ";", "ok", "{", "reqID", ",", "err", "=", "conn", ".", "(", "*", "Conn", ")", ".", "SendRequest", "(", "method", ",", "params", ",", "resHandler", ")", "\n", "// todo: only log in debug mode?", "log", ".", "Printf", "(", "\"", "\"", ",", "connID", ",", "reqID", ",", "method", ",", "params", ",", "err", ")", "\n", "return", "\n", "}", "\n\n", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "connID", ")", "\n", "}" ]
24,390
all-24391
[ "appendOrMergeKindMapping", "adds", "LoadInfo", "for", "the", "given", "replacement", "." ]
[ "func", "appendOrMergeKindMapping", "(", "mappedLoads", "[", "]", "rule", ".", "LoadInfo", ",", "mappedKind", "config", ".", "MappedKind", ")", "[", "]", "rule", ".", "LoadInfo", "{", "// If mappedKind.KindLoad already exists in the list, create a merged copy.", "for", "_", ",", "load", ":=", "range", "mappedLoads", "{", "if", "load", ".", "Name", "==", "mappedKind", ".", "KindLoad", "{", "<mask>", ".", "Symbols", "=", "append", "(", "load", ".", "Symbols", ",", "mappedKind", ".", "KindName", ")", "\n", "return", "mappedLoads", "\n", "}", "\n", "}", "\n\n", "// Add a new LoadInfo.", "return", "append", "(", "mappedLoads", ",", "rule", ".", "LoadInfo", "{", "Name", ":", "mappedKind", ".", "KindLoad", ",", "Symbols", ":", "[", "]", "string", "{", "mappedKind", ".", "KindName", "}", ",", "}", ")", "\n", "}" ]
24,391
all-24392
[ "unlinkGRs", "unlinks", "two", "goroutines" ]
[ "func", "unlinkGRs", "(", ")", "{", "childID", ":=", "curGoroutineID", "(", ")", "\n", "dataLock", ".", "Lock", "(", ")", "\n", "<mask>", "(", "data", ",", "childID", ")", "\n", "dataLock", ".", "Unlock", "(", ")", "\n", "}" ]
24,392
all-24393
[ "UniqueStringsMapFromFlag", "returns", "a", "map", "of", "strings", "from", "the", "flag", "." ]
[ "func", "UniqueStringsMapFromFlag", "(", "fs", "*", "flag", ".", "FlagSet", ",", "flagName", "string", ")", "map", "[", "string", "]", "struct", "{", "}", "{", "return", "(", "*", "<mask>", ".", "Lookup", "(", "flagName", ")", ".", "Value", ".", "(", "*", "UniqueStringsValue", ")", ")", ".", "Values", "\n", "}" ]
24,393
all-24394
[ "SetFormat", "sets", "the", "format", "for", "logging", "." ]
[ "func", "(", "l", "*", "templateLogger", ")", "SetFormat", "(", "format", "string", ")", "error", "{", "l", ".", "m", ".", "Lock", "(", ")", "\n", "defer", "l", ".", "m", ".", "Unlock", "(", ")", "\n", "t", ",", "err", ":=", "template", ".", "New", "(", "\"", "\"", ")", ".", "Parse", "(", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "l", ".", "t", "=", "t", "\n", "return", "nil", "\n", "}" ]
24,394
all-24395
[ "UnmarshalJSON", "satisfies", "json", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "DetachReason", ")", "UnmarshalJSON", "(", "buf", "[", "]", "<mask>", ")", "error", "{", "return", "easyjson", ".", "Unmarshal", "(", "buf", ",", "t", ")", "\n", "}" ]
24,395
all-24396
[ "Typecheck1", "is", "the", "recursive", "form", "of", "typecheck", ".", "It", "is", "like", "typecheck", "but", "adds", "to", "the", "information", "in", "typeof", "instead", "of", "allocating", "a", "new", "map", "." ]
[ "func", "typecheck1", "(", "cfg", "*", "TypeConfig", ",", "f", "interface", "{", "}", ",", "typeof", "map", "[", "interface", "{", "}", "]", "string", ",", "assign", "map", "[", "string", "]", "[", "]", "interface", "{", "}", ")", "{", "// set sets the type of n to typ.", "// If isDecl is true, n is being declared.", "set", ":=", "func", "(", "n", "ast", ".", "Expr", ",", "typ", "string", ",", "isDecl", "bool", ")", "{", "if", "typeof", "[", "n", "]", "!=", "\"", "\"", "||", "typ", "==", "\"", "\"", "{", "if", "typeof", "[", "n", "]", "!=", "typ", "{", "assign", "[", "typ", "]", "=", "append", "(", "assign", "[", "typ", "]", ",", "n", ")", "\n", "}", "\n", "return", "\n", "}", "\n", "typeof", "[", "n", "]", "=", "typ", "\n\n", "// If we obtained typ from the declaration of x", "// propagate the type to all the uses.", "// The !isDecl case is a cheat here, but it makes", "// up in some cases for not paying attention to", "// struct fields. The real type checker will be", "// more accurate so we won't need the cheat.", "if", "id", ",", "ok", ":=", "n", ".", "(", "*", "ast", ".", "Ident", ")", ";", "ok", "&&", "id", ".", "Obj", "!=", "nil", "&&", "(", "isDecl", "||", "typeof", "[", "<mask>", ".", "Obj", "]", "==", "\"", "\"", ")", "{", "typeof", "[", "id", ".", "Obj", "]", "=", "typ", "\n", "}", "\n", "}", "\n\n", "// Type-check an assignment lhs = rhs.", "// If isDecl is true, this is := so we can update", "// the types of the objects that lhs refers to.", "typecheckAssign", ":=", "func", "(", "lhs", ",", "rhs", "[", "]", "ast", ".", "Expr", ",", "isDecl", "bool", ")", "{", "if", "len", "(", "lhs", ")", ">", "1", "&&", "len", "(", "rhs", ")", "==", "1", "{", "if", "_", ",", "ok", ":=", "rhs", "[", "0", "]", ".", "(", "*", "ast", ".", "CallExpr", ")", ";", "ok", "{", "t", ":=", "split", "(", "typeof", "[", "rhs", "[", "0", "]", "]", ")", "\n", "// Lists should have same length but may not; pair what can be paired.", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "lhs", ")", "&&", "i", "<", "len", "(", "t", ")", ";", "i", "++", "{", "set", "(", "lhs", "[", "i", "]", ",", "t", "[", "i", "]", ",", "isDecl", ")", "\n", "}", "\n", "return", "\n", "}", "\n", "}", "\n", "if", "len", "(", "lhs", ")", "==", "1", "&&", "len", "(", "rhs", ")", "==", "2", "{", "// x = y, ok", "rhs", "=", "rhs", "[", ":", "1", "]", "\n", "}", "else", "if", "len", "(", "lhs", ")", "==", "2", "&&", "len", "(", "rhs", ")", "==", "1", "{", "// x, ok = y", "lhs", "=", "lhs", "[", ":", "1", "]", "\n", "}", "\n\n", "// Match as much as we can.", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "lhs", ")", "&&", "i", "<", "len", "(", "rhs", ")", ";", "i", "++", "{", "x", ",", "y", ":=", "lhs", "[", "i", "]", ",", "rhs", "[", "i", "]", "\n", "if", "typeof", "[", "y", "]", "!=", "\"", "\"", "{", "set", "(", "x", ",", "typeof", "[", "y", "]", ",", "isDecl", ")", "\n", "}", "else", "{", "set", "(", "y", ",", "typeof", "[", "x", "]", ",", "false", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "expand", ":=", "func", "(", "s", "string", ")", "string", "{", "typ", ":=", "cfg", ".", "Type", "[", "s", "]", "\n", "if", "typ", "!=", "nil", "&&", "typ", ".", "Def", "!=", "\"", "\"", "{", "return", "typ", ".", "Def", "\n", "}", "\n", "return", "s", "\n", "}", "\n\n", "// The main type check is a recursive algorithm implemented", "// by walkBeforeAfter(n, before, after).", "// Most of it is bottom-up, but in a few places we need", "// to know the type of the function we are checking.", "// The before function records that information on", "// the curfn stack.", "var", "curfn", "[", "]", "*", "ast", ".", "FuncType", "\n\n", "before", ":=", "func", "(", "n", "interface", "{", "}", ")", "{", "// push function type on stack", "switch", "n", ":=", "n", ".", "(", "type", ")", "{", "case", "*", "ast", ".", "FuncDecl", ":", "curfn", "=", "append", "(", "curfn", ",", "n", ".", "Type", ")", "\n", "case", "*", "ast", ".", "FuncLit", ":", "curfn", "=", "append", "(", "curfn", ",", "n", ".", "Type", ")", "\n", "}", "\n", "}", "\n\n", "// After is the real type checker.", "after", ":=", "func", "(", "n", "interface", "{", "}", ")", "{", "if", "n", "==", "nil", "{", "return", "\n", "}", "\n", "if", "false", "&&", "reflect", ".", "TypeOf", "(", "n", ")", ".", "Kind", "(", ")", "==", "reflect", ".", "Ptr", "{", "// debugging trace", "defer", "func", "(", ")", "{", "if", "t", ":=", "typeof", "[", "n", "]", ";", "t", "!=", "\"", "\"", "{", "pos", ":=", "fset", ".", "Position", "(", "n", ".", "(", "ast", ".", "Node", ")", ".", "Pos", "(", ")", ")", "\n", "fmt", ".", "Fprintf", "(", "os", ".", "Stderr", ",", "\"", "\\n", "\"", ",", "pos", ",", "gofmt", "(", "n", ")", ",", "t", ")", "\n", "}", "\n", "}", "(", ")", "\n", "}", "\n\n", "switch", "n", ":=", "n", ".", "(", "type", ")", "{", "case", "*", "ast", ".", "FuncDecl", ",", "*", "ast", ".", "FuncLit", ":", "// pop function type off stack", "curfn", "=", "curfn", "[", ":", "len", "(", "curfn", ")", "-", "1", "]", "\n\n", "case", "*", "ast", ".", "FuncType", ":", "typeof", "[", "n", "]", "=", "mkType", "(", "joinFunc", "(", "split", "(", "typeof", "[", "n", ".", "Params", "]", ")", ",", "split", "(", "typeof", "[", "n", ".", "Results", "]", ")", ")", ")", "\n\n", "case", "*", "ast", ".", "FieldList", ":", "// Field list is concatenation of sub-lists.", "t", ":=", "\"", "\"", "\n", "for", "_", ",", "field", ":=", "range", "n", ".", "List", "{", "if", "t", "!=", "\"", "\"", "{", "t", "+=", "\"", "\"", "\n", "}", "\n", "t", "+=", "typeof", "[", "field", "]", "\n", "}", "\n", "typeof", "[", "n", "]", "=", "t", "\n\n", "case", "*", "ast", ".", "Field", ":", "// Field is one instance of the type per name.", "all", ":=", "\"", "\"", "\n", "t", ":=", "typeof", "[", "n", ".", "Type", "]", "\n", "if", "!", "isType", "(", "t", ")", "{", "// Create a type, because it is typically *T or *p.T", "// and we might care about that type.", "t", "=", "mkType", "(", "gofmt", "(", "n", ".", "Type", ")", ")", "\n", "typeof", "[", "n", ".", "Type", "]", "=", "t", "\n", "}", "\n", "t", "=", "getType", "(", "t", ")", "\n", "if", "len", "(", "n", ".", "Names", ")", "==", "0", "{", "all", "=", "t", "\n", "}", "else", "{", "for", "_", ",", "id", ":=", "range", "n", ".", "Names", "{", "if", "all", "!=", "\"", "\"", "{", "all", "+=", "\"", "\"", "\n", "}", "\n", "all", "+=", "t", "\n", "typeof", "[", "id", ".", "Obj", "]", "=", "t", "\n", "typeof", "[", "id", "]", "=", "t", "\n", "}", "\n", "}", "\n", "typeof", "[", "n", "]", "=", "all", "\n\n", "case", "*", "ast", ".", "ValueSpec", ":", "// var declaration. Use type if present.", "if", "n", ".", "Type", "!=", "nil", "{", "t", ":=", "typeof", "[", "n", ".", "Type", "]", "\n", "if", "!", "isType", "(", "t", ")", "{", "t", "=", "mkType", "(", "gofmt", "(", "n", ".", "Type", ")", ")", "\n", "typeof", "[", "n", ".", "Type", "]", "=", "t", "\n", "}", "\n", "t", "=", "getType", "(", "t", ")", "\n", "for", "_", ",", "id", ":=", "range", "n", ".", "Names", "{", "set", "(", "id", ",", "t", ",", "true", ")", "\n", "}", "\n", "}", "\n", "// Now treat same as assignment.", "typecheckAssign", "(", "makeExprList", "(", "n", ".", "Names", ")", ",", "n", ".", "Values", ",", "true", ")", "\n\n", "case", "*", "ast", ".", "AssignStmt", ":", "typecheckAssign", "(", "n", ".", "Lhs", ",", "n", ".", "Rhs", ",", "n", ".", "Tok", "==", "token", ".", "DEFINE", ")", "\n\n", "case", "*", "ast", ".", "Ident", ":", "// Identifier can take its type from underlying object.", "if", "t", ":=", "typeof", "[", "n", ".", "Obj", "]", ";", "t", "!=", "\"", "\"", "{", "typeof", "[", "n", "]", "=", "t", "\n", "}", "\n\n", "case", "*", "ast", ".", "SelectorExpr", ":", "// Field or method.", "name", ":=", "n", ".", "Sel", ".", "Name", "\n", "if", "t", ":=", "typeof", "[", "n", ".", "X", "]", ";", "t", "!=", "\"", "\"", "{", "if", "strings", ".", "HasPrefix", "(", "t", ",", "\"", "\"", ")", "{", "t", "=", "t", "[", "1", ":", "]", "// implicit *", "\n", "}", "\n", "if", "typ", ":=", "cfg", ".", "Type", "[", "t", "]", ";", "typ", "!=", "nil", "{", "if", "t", ":=", "typ", ".", "dot", "(", "cfg", ",", "name", ")", ";", "t", "!=", "\"", "\"", "{", "typeof", "[", "n", "]", "=", "t", "\n", "return", "\n", "}", "\n", "}", "\n", "tt", ":=", "typeof", "[", "t", "+", "\"", "\"", "+", "name", "]", "\n", "if", "isType", "(", "tt", ")", "{", "typeof", "[", "n", "]", "=", "getType", "(", "tt", ")", "\n", "return", "\n", "}", "\n", "}", "\n", "// Package selector.", "if", "x", ",", "ok", ":=", "n", ".", "X", ".", "(", "*", "ast", ".", "Ident", ")", ";", "ok", "&&", "x", ".", "Obj", "==", "nil", "{", "str", ":=", "x", ".", "Name", "+", "\"", "\"", "+", "name", "\n", "if", "cfg", ".", "Type", "[", "str", "]", "!=", "nil", "{", "typeof", "[", "n", "]", "=", "mkType", "(", "str", ")", "\n", "return", "\n", "}", "\n", "if", "t", ":=", "cfg", ".", "typeof", "(", "x", ".", "Name", "+", "\"", "\"", "+", "name", ")", ";", "t", "!=", "\"", "\"", "{", "typeof", "[", "n", "]", "=", "t", "\n", "return", "\n", "}", "\n", "}", "\n\n", "case", "*", "ast", ".", "CallExpr", ":", "// make(T) has type T.", "if", "isTopName", "(", "n", ".", "Fun", ",", "\"", "\"", ")", "&&", "len", "(", "n", ".", "Args", ")", ">=", "1", "{", "typeof", "[", "n", "]", "=", "gofmt", "(", "n", ".", "Args", "[", "0", "]", ")", "\n", "return", "\n", "}", "\n", "// new(T) has type *T", "if", "isTopName", "(", "n", ".", "Fun", ",", "\"", "\"", ")", "&&", "len", "(", "n", ".", "Args", ")", "==", "1", "{", "typeof", "[", "n", "]", "=", "\"", "\"", "+", "gofmt", "(", "n", ".", "Args", "[", "0", "]", ")", "\n", "return", "\n", "}", "\n", "// Otherwise, use type of function to determine arguments.", "t", ":=", "typeof", "[", "n", ".", "Fun", "]", "\n", "in", ",", "out", ":=", "splitFunc", "(", "t", ")", "\n", "if", "in", "==", "nil", "&&", "out", "==", "nil", "{", "return", "\n", "}", "\n", "typeof", "[", "n", "]", "=", "join", "(", "out", ")", "\n", "for", "i", ",", "arg", ":=", "range", "n", ".", "Args", "{", "if", "i", ">=", "len", "(", "in", ")", "{", "break", "\n", "}", "\n", "if", "typeof", "[", "arg", "]", "==", "\"", "\"", "{", "typeof", "[", "arg", "]", "=", "in", "[", "i", "]", "\n", "}", "\n", "}", "\n\n", "case", "*", "ast", ".", "TypeAssertExpr", ":", "// x.(type) has type of x.", "if", "n", ".", "Type", "==", "nil", "{", "typeof", "[", "n", "]", "=", "typeof", "[", "n", ".", "X", "]", "\n", "return", "\n", "}", "\n", "// x.(T) has type T.", "if", "t", ":=", "typeof", "[", "n", ".", "Type", "]", ";", "isType", "(", "t", ")", "{", "typeof", "[", "n", "]", "=", "getType", "(", "t", ")", "\n", "}", "else", "{", "typeof", "[", "n", "]", "=", "gofmt", "(", "n", ".", "Type", ")", "\n", "}", "\n\n", "case", "*", "ast", ".", "SliceExpr", ":", "// x[i:j] has type of x.", "typeof", "[", "n", "]", "=", "typeof", "[", "n", ".", "X", "]", "\n\n", "case", "*", "ast", ".", "IndexExpr", ":", "// x[i] has key type of x's type.", "t", ":=", "expand", "(", "typeof", "[", "n", ".", "X", "]", ")", "\n", "if", "strings", ".", "HasPrefix", "(", "t", ",", "\"", "\"", ")", "||", "strings", ".", "HasPrefix", "(", "t", ",", "\"", "\"", ")", "{", "// Lazy: assume there are no nested [] in the array", "// length or map key type.", "if", "i", ":=", "strings", ".", "Index", "(", "t", ",", "\"", "\"", ")", ";", "i", ">=", "0", "{", "typeof", "[", "n", "]", "=", "t", "[", "i", "+", "1", ":", "]", "\n", "}", "\n", "}", "\n\n", "case", "*", "ast", ".", "StarExpr", ":", "// *x for x of type *T has type T when x is an expr.", "// We don't use the result when *x is a type, but", "// compute it anyway.", "t", ":=", "expand", "(", "typeof", "[", "n", ".", "X", "]", ")", "\n", "if", "isType", "(", "t", ")", "{", "typeof", "[", "n", "]", "=", "\"", "\"", "+", "getType", "(", "t", ")", "\n", "}", "else", "if", "strings", ".", "HasPrefix", "(", "t", ",", "\"", "\"", ")", "{", "typeof", "[", "n", "]", "=", "t", "[", "len", "(", "\"", "\"", ")", ":", "]", "\n", "}", "\n\n", "case", "*", "ast", ".", "UnaryExpr", ":", "// &x for x of type T has type *T.", "t", ":=", "typeof", "[", "n", ".", "X", "]", "\n", "if", "t", "!=", "\"", "\"", "&&", "n", ".", "Op", "==", "token", ".", "AND", "{", "typeof", "[", "n", "]", "=", "\"", "\"", "+", "t", "\n", "}", "\n\n", "case", "*", "ast", ".", "CompositeLit", ":", "// T{...} has type T.", "typeof", "[", "n", "]", "=", "gofmt", "(", "n", ".", "Type", ")", "\n\n", "case", "*", "ast", ".", "ParenExpr", ":", "// (x) has type of x.", "typeof", "[", "n", "]", "=", "typeof", "[", "n", ".", "X", "]", "\n\n", "case", "*", "ast", ".", "RangeStmt", ":", "t", ":=", "expand", "(", "typeof", "[", "n", ".", "X", "]", ")", "\n", "if", "t", "==", "\"", "\"", "{", "return", "\n", "}", "\n", "var", "key", ",", "value", "string", "\n", "if", "t", "==", "\"", "\"", "{", "key", ",", "value", "=", "\"", "\"", ",", "\"", "\"", "\n", "}", "else", "if", "strings", ".", "HasPrefix", "(", "t", ",", "\"", "\"", ")", "{", "key", "=", "\"", "\"", "\n", "if", "i", ":=", "strings", ".", "Index", "(", "t", ",", "\"", "\"", ")", ";", "i", ">=", "0", "{", "value", "=", "t", "[", "i", "+", "1", ":", "]", "\n", "}", "\n", "}", "else", "if", "strings", ".", "HasPrefix", "(", "t", ",", "\"", "\"", ")", "{", "if", "i", ":=", "strings", ".", "Index", "(", "t", ",", "\"", "\"", ")", ";", "i", ">=", "0", "{", "key", ",", "value", "=", "t", "[", "4", ":", "i", "]", ",", "t", "[", "i", "+", "1", ":", "]", "\n", "}", "\n", "}", "\n", "changed", ":=", "false", "\n", "if", "n", ".", "Key", "!=", "nil", "&&", "key", "!=", "\"", "\"", "{", "changed", "=", "true", "\n", "set", "(", "n", ".", "Key", ",", "key", ",", "n", ".", "Tok", "==", "token", ".", "DEFINE", ")", "\n", "}", "\n", "if", "n", ".", "Value", "!=", "nil", "&&", "value", "!=", "\"", "\"", "{", "changed", "=", "true", "\n", "set", "(", "n", ".", "Value", ",", "value", ",", "n", ".", "Tok", "==", "token", ".", "DEFINE", ")", "\n", "}", "\n", "// Ugly failure of vision: already type-checked body.", "// Do it again now that we have that type info.", "if", "changed", "{", "typecheck1", "(", "cfg", ",", "n", ".", "Body", ",", "typeof", ",", "assign", ")", "\n", "}", "\n\n", "case", "*", "ast", ".", "TypeSwitchStmt", ":", "// Type of variable changes for each case in type switch,", "// but go/parser generates just one variable.", "// Repeat type check for each case with more precise", "// type information.", "as", ",", "ok", ":=", "n", ".", "Assign", ".", "(", "*", "ast", ".", "AssignStmt", ")", "\n", "if", "!", "ok", "{", "return", "\n", "}", "\n", "varx", ",", "ok", ":=", "as", ".", "Lhs", "[", "0", "]", ".", "(", "*", "ast", ".", "Ident", ")", "\n", "if", "!", "ok", "{", "return", "\n", "}", "\n", "t", ":=", "typeof", "[", "varx", "]", "\n", "for", "_", ",", "cas", ":=", "range", "n", ".", "Body", ".", "List", "{", "cas", ":=", "cas", ".", "(", "*", "ast", ".", "CaseClause", ")", "\n", "if", "len", "(", "cas", ".", "List", ")", "==", "1", "{", "// Variable has specific type only when there is", "// exactly one type in the case list.", "if", "tt", ":=", "typeof", "[", "cas", ".", "List", "[", "0", "]", "]", ";", "isType", "(", "tt", ")", "{", "tt", "=", "getType", "(", "tt", ")", "\n", "typeof", "[", "varx", "]", "=", "tt", "\n", "typeof", "[", "varx", ".", "Obj", "]", "=", "tt", "\n", "typecheck1", "(", "cfg", ",", "cas", ".", "Body", ",", "typeof", ",", "assign", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "// Restore t.", "typeof", "[", "varx", "]", "=", "t", "\n", "typeof", "[", "varx", ".", "Obj", "]", "=", "t", "\n\n", "case", "*", "ast", ".", "ReturnStmt", ":", "if", "len", "(", "curfn", ")", "==", "0", "{", "// Probably can't happen.", "return", "\n", "}", "\n", "f", ":=", "curfn", "[", "len", "(", "curfn", ")", "-", "1", "]", "\n", "res", ":=", "n", ".", "Results", "\n", "if", "f", ".", "Results", "!=", "nil", "{", "t", ":=", "split", "(", "typeof", "[", "f", ".", "Results", "]", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "res", ")", "&&", "i", "<", "len", "(", "t", ")", ";", "i", "++", "{", "set", "(", "res", "[", "i", "]", ",", "t", "[", "i", "]", ",", "false", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "walkBeforeAfter", "(", "f", ",", "before", ",", "after", ")", "\n", "}" ]
24,396
all-24397
[ "Run", "executes", "the", "test", "process", "then", "writes", "the", "exit", "code", "to", "the", "marker", "file", ".", "This", "function", "returns", "the", "status", "code", "that", "should", "be", "passed", "to", "os", ".", "Exit", "()", "." ]
[ "func", "(", "o", "Options", ")", "Run", "(", ")", "int", "{", "code", ",", "err", ":=", "o", ".", "ExecuteProcess", "(", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Error", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "err", ":=", "o", ".", "mark", "(", "code", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "<mask>", "(", "\"", "\"", ")", "\n", "return", "InternalErrorCode", "// we need to mark the real error code to safely return AlwaysZero", "\n", "}", "\n", "if", "o", ".", "AlwaysZero", "{", "return", "0", "\n", "}", "\n", "return", "code", "\n", "}" ]
24,397
all-24398
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "ExposeDevToolsProtocolParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoTarget12", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
24,398
all-24399
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetNavigationHistoryReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage34", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
24,399
all-24400
[ "Signatures", "is", "like", "ImageSource", ".", "GetSignatures", "but", "the", "result", "is", "cached", ";", "it", "is", "OK", "to", "call", "this", "however", "often", "you", "need", "." ]
[ "func", "(", "i", "*", "memoryImage", ")", "Signatures", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "[", "]", "byte", ",", "error", ")", "{", "// Modifying an image invalidates signatures; a caller asking the updated image for signatures", "// is probably confused.", "return", "nil", ",", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}" ]