id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
6,800 | all-6801 | [
"New",
"Lexer",
"from",
"the",
"input",
"string"
] | [
"func",
"New",
"(",
"input",
"string",
")",
"*",
"Lexer",
"{",
"l",
":=",
"&",
"Lexer",
"{",
"input",
":",
"<mask>",
",",
"curLine",
":",
"1",
"}",
"\n",
"l",
".",
"readChar",
"(",
")",
"\n",
"return",
"l",
"\n",
"}"
] |
6,801 | all-6802 | [
"SearchDatastore",
"searches",
"a",
"datastore",
"using",
"the",
"supplied",
"HostDatastoreBrowser",
"and",
"a",
"supplied",
"path",
".",
"The",
"current",
"implementation",
"only",
"returns",
"the",
"basic",
"information",
"so",
"all",
"FileQueryFlags",
"set",
"but",
"not",
"any",
"flags",
"for",
"specific",
"types",
"of",
"files",
"."
] | [
"func",
"SearchDatastore",
"(",
"ds",
"*",
"object",
".",
"Datastore",
",",
"name",
"string",
")",
"(",
"[",
"]",
"*",
"types",
".",
"FileInfo",
",",
"error",
")",
"{",
"result",
",",
"err",
":=",
"searchDatastore",
"(",
"ds",
",",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"<mask>",
"files",
"[",
"]",
"*",
"types",
".",
"FileInfo",
"\n",
"for",
"_",
",",
"bfi",
":=",
"range",
"result",
".",
"File",
"{",
"files",
"=",
"append",
"(",
"files",
",",
"bfi",
".",
"GetFileInfo",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"files",
",",
"nil",
"\n",
"}"
] |
6,802 | all-6803 | [
"importSpec",
"returns",
"the",
"import",
"spec",
"if",
"f",
"imports",
"path",
"or",
"nil",
"otherwise",
"."
] | [
"func",
"importSpec",
"(",
"f",
"*",
"ast",
".",
"File",
",",
"path",
"string",
")",
"*",
"ast",
".",
"ImportSpec",
"{",
"for",
"_",
",",
"s",
":=",
"range",
"f",
".",
"Imports",
"{",
"if",
"importPath",
"(",
"s",
")",
"==",
"<mask>",
"{",
"return",
"s",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
6,803 | all-6804 | [
"FromMap",
"feels",
"updates",
"user",
"data",
"from",
"a",
"map"
] | [
"func",
"(",
"ud",
"*",
"UserData",
")",
"FromMap",
"(",
"m",
"UserDataMap",
")",
"{",
"for",
"<mask>",
",",
"value",
":=",
"range",
"m",
"{",
"ud",
".",
"Store",
"(",
"key",
",",
"value",
")",
"\n",
"}",
"\n",
"}"
] |
6,804 | all-6805 | [
"RunRequested",
"executes",
"the",
"config",
".",
"Presubmits",
"that",
"are",
"requested"
] | [
"func",
"RunRequested",
"(",
"c",
"Client",
",",
"pr",
"*",
"github",
".",
"PullRequest",
",",
"requestedJobs",
"[",
"]",
"config",
".",
"Presubmit",
",",
"eventGUID",
"string",
")",
"error",
"{",
"baseSHA",
",",
"err",
":=",
"c",
".",
"GitHubClient",
".",
"GetRef",
"(",
"pr",
".",
"<mask>",
".",
"Repo",
".",
"Owner",
".",
"Login",
",",
"pr",
".",
"Base",
".",
"Repo",
".",
"Name",
",",
"\"",
"\"",
"+",
"pr",
".",
"Base",
".",
"Ref",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"var",
"errors",
"[",
"]",
"error",
"\n",
"for",
"_",
",",
"job",
":=",
"range",
"requestedJobs",
"{",
"c",
".",
"Logger",
".",
"Infof",
"(",
"\"",
"\"",
",",
"job",
".",
"Name",
")",
"\n",
"pj",
":=",
"pjutil",
".",
"NewPresubmit",
"(",
"*",
"pr",
",",
"baseSHA",
",",
"job",
",",
"eventGUID",
")",
"\n",
"c",
".",
"Logger",
".",
"WithFields",
"(",
"pjutil",
".",
"ProwJobFields",
"(",
"&",
"pj",
")",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"if",
"_",
",",
"err",
":=",
"c",
".",
"ProwJobClient",
".",
"Create",
"(",
"&",
"pj",
")",
";",
"err",
"!=",
"nil",
"{",
"c",
".",
"Logger",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"errorutil",
".",
"NewAggregate",
"(",
"errors",
"...",
")",
"\n",
"}"
] |
6,805 | all-6806 | [
"NewRemoteExecutor",
"-",
"This",
"method",
"creates",
"executor",
"based",
"on",
"ssh",
"it",
"has",
"concrete",
"ssh",
"reference"
] | [
"func",
"NewRemoteExecutor",
"(",
"sshCfg",
"SshConfig",
")",
"(",
"executor",
"Executer",
",",
"err",
"error",
")",
"{",
"clientconfig",
":=",
"&",
"ssh",
".",
"ClientConfig",
"{",
"<mask>",
":",
"sshCfg",
".",
"Username",
",",
"Auth",
":",
"sshCfg",
".",
"GetAuthMethod",
"(",
")",
",",
"HostKeyCallback",
":",
"ssh",
".",
"InsecureIgnoreHostKey",
"(",
")",
",",
"}",
"\n",
"remoteExecutor",
":=",
"&",
"DefaultRemoteExecutor",
"{",
"}",
"\n",
"remoteExecutor",
".",
"LazyClientDial",
"=",
"func",
"(",
")",
"{",
"client",
",",
"err",
":=",
"ssh",
".",
"Dial",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"sshCfg",
".",
"Host",
",",
"sshCfg",
".",
"Port",
")",
",",
"clientconfig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"lo",
".",
"G",
".",
"Error",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"remoteExecutor",
".",
"Client",
"=",
"NewClientWrapper",
"(",
"client",
")",
"\n",
"}",
"\n",
"executor",
"=",
"remoteExecutor",
"\n",
"return",
"\n",
"}"
] |
6,806 | all-6807 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"ScrollRectType",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"out",
".",
"<mask>",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
] |
6,807 | all-6808 | [
"ParseString",
"creates",
"a",
"new",
"*",
"Durafmt",
"struct",
"from",
"a",
"string",
".",
"returns",
"an",
"error",
"if",
"input",
"is",
"invalid",
"."
] | [
"func",
"ParseString",
"(",
"input",
"string",
")",
"(",
"*",
"Durafmt",
",",
"error",
")",
"{",
"if",
"input",
"==",
"\"",
"\"",
"||",
"input",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
"+",
"input",
")",
"\n",
"}",
"\n",
"duration",
",",
"err",
":=",
"time",
".",
"ParseDuration",
"(",
"input",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"Durafmt",
"{",
"duration",
",",
"input",
",",
"false",
"}",
",",
"nil",
"\n",
"}"
] |
6,808 | all-6809 | [
"SubnetLocator",
"builds",
"a",
"locator",
"from",
"the",
"given",
"href",
"."
] | [
"func",
"(",
"api",
"*",
"API",
")",
"SubnetLocator",
"(",
"href",
"<mask>",
")",
"*",
"SubnetLocator",
"{",
"return",
"&",
"SubnetLocator",
"{",
"Href",
"(",
"href",
")",
",",
"api",
"}",
"\n",
"}"
] |
6,809 | all-6810 | [
"execEvalStmt",
"evaluates",
"the",
"expression",
"of",
"an",
"evaluation",
"statement",
"for",
"the",
"given",
"time",
"range",
"."
] | [
"func",
"(",
"ng",
"*",
"Engine",
")",
"execEvalStmt",
"(",
"ctx",
"context",
".",
"Context",
",",
"query",
"*",
"query",
",",
"s",
"*",
"EvalStmt",
")",
"(",
"Value",
",",
"storage",
".",
"Warnings",
",",
"error",
")",
"{",
"prepareSpanTimer",
",",
"ctxPrepare",
":=",
"query",
".",
"stats",
".",
"GetSpanTimer",
"(",
"ctx",
",",
"stats",
".",
"QueryPreparationTime",
",",
"ng",
".",
"metrics",
".",
"queryPrepareTime",
")",
"\n",
"querier",
",",
"warnings",
",",
"err",
":=",
"ng",
".",
"populateSeries",
"(",
"ctxPrepare",
",",
"query",
".",
"queryable",
",",
"s",
")",
"\n",
"prepareSpanTimer",
".",
"Finish",
"(",
")",
"\n\n",
"// XXX(fabxc): the querier returned by populateSeries might be instantiated",
"// we must not return without closing irrespective of the error.",
"// TODO: make this semantically saner.",
"if",
"querier",
"!=",
"nil",
"{",
"defer",
"querier",
".",
"Close",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"warnings",
",",
"err",
"\n",
"}",
"\n\n",
"evalSpanTimer",
",",
"ctxInnerEval",
":=",
"query",
".",
"stats",
".",
"GetSpanTimer",
"(",
"ctx",
",",
"stats",
".",
"InnerEvalTime",
",",
"ng",
".",
"metrics",
".",
"queryInnerEval",
")",
"\n",
"// Instant evaluation. This is executed as a range evaluation with one step.",
"if",
"s",
".",
"Start",
"==",
"s",
".",
"End",
"&&",
"s",
".",
"Interval",
"==",
"0",
"{",
"start",
":=",
"timeMilliseconds",
"(",
"s",
".",
"Start",
")",
"\n",
"evaluator",
":=",
"&",
"evaluator",
"{",
"startTimestamp",
":",
"start",
",",
"endTimestamp",
":",
"start",
",",
"interval",
":",
"1",
",",
"ctx",
":",
"ctxInnerEval",
",",
"maxSamples",
":",
"ng",
".",
"maxSamplesPerQuery",
",",
"defaultEvalInterval",
":",
"GetDefaultEvaluationInterval",
"(",
")",
",",
"logger",
":",
"ng",
".",
"logger",
",",
"}",
"\n",
"val",
",",
"err",
":=",
"evaluator",
".",
"Eval",
"(",
"s",
".",
"Expr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"warnings",
",",
"err",
"\n",
"}",
"\n\n",
"evalSpanTimer",
".",
"Finish",
"(",
")",
"\n\n",
"mat",
",",
"ok",
":=",
"val",
".",
"(",
"Matrix",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"<mask>",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"val",
".",
"Type",
"(",
")",
")",
")",
"\n",
"}",
"\n",
"query",
".",
"matrix",
"=",
"mat",
"\n",
"switch",
"s",
".",
"Expr",
".",
"Type",
"(",
")",
"{",
"case",
"ValueTypeVector",
":",
"// Convert matrix with one value per series into vector.",
"vector",
":=",
"make",
"(",
"Vector",
",",
"len",
"(",
"mat",
")",
")",
"\n",
"for",
"i",
",",
"s",
":=",
"range",
"mat",
"{",
"// Point might have a different timestamp, force it to the evaluation",
"// timestamp as that is when we ran the evaluation.",
"vector",
"[",
"i",
"]",
"=",
"Sample",
"{",
"Metric",
":",
"s",
".",
"Metric",
",",
"Point",
":",
"Point",
"{",
"V",
":",
"s",
".",
"Points",
"[",
"0",
"]",
".",
"V",
",",
"T",
":",
"start",
"}",
"}",
"\n",
"}",
"\n",
"return",
"vector",
",",
"warnings",
",",
"nil",
"\n",
"case",
"ValueTypeScalar",
":",
"return",
"Scalar",
"{",
"V",
":",
"mat",
"[",
"0",
"]",
".",
"Points",
"[",
"0",
"]",
".",
"V",
",",
"T",
":",
"start",
"}",
",",
"warnings",
",",
"nil",
"\n",
"case",
"ValueTypeMatrix",
":",
"return",
"mat",
",",
"warnings",
",",
"nil",
"\n",
"default",
":",
"panic",
"(",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
".",
"Expr",
".",
"Type",
"(",
")",
")",
")",
"\n",
"}",
"\n\n",
"}",
"\n\n",
"// Range evaluation.",
"evaluator",
":=",
"&",
"evaluator",
"{",
"startTimestamp",
":",
"timeMilliseconds",
"(",
"s",
".",
"Start",
")",
",",
"endTimestamp",
":",
"timeMilliseconds",
"(",
"s",
".",
"End",
")",
",",
"interval",
":",
"durationMilliseconds",
"(",
"s",
".",
"Interval",
")",
",",
"ctx",
":",
"ctxInnerEval",
",",
"maxSamples",
":",
"ng",
".",
"maxSamplesPerQuery",
",",
"defaultEvalInterval",
":",
"GetDefaultEvaluationInterval",
"(",
")",
",",
"logger",
":",
"ng",
".",
"logger",
",",
"}",
"\n",
"val",
",",
"err",
":=",
"evaluator",
".",
"Eval",
"(",
"s",
".",
"Expr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"warnings",
",",
"err",
"\n",
"}",
"\n",
"evalSpanTimer",
".",
"Finish",
"(",
")",
"\n\n",
"mat",
",",
"ok",
":=",
"val",
".",
"(",
"Matrix",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"val",
".",
"Type",
"(",
")",
")",
")",
"\n",
"}",
"\n",
"query",
".",
"matrix",
"=",
"mat",
"\n\n",
"if",
"err",
":=",
"contextDone",
"(",
"ctx",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"warnings",
",",
"err",
"\n",
"}",
"\n\n",
"// TODO(fabxc): order ensured by storage?",
"// TODO(fabxc): where to ensure metric labels are a copy from the storage internals.",
"sortSpanTimer",
",",
"_",
":=",
"query",
".",
"stats",
".",
"GetSpanTimer",
"(",
"ctx",
",",
"stats",
".",
"ResultSortTime",
",",
"ng",
".",
"metrics",
".",
"queryResultSort",
")",
"\n",
"sort",
".",
"Sort",
"(",
"mat",
")",
"\n",
"sortSpanTimer",
".",
"Finish",
"(",
")",
"\n\n",
"return",
"mat",
",",
"warnings",
",",
"nil",
"\n",
"}"
] |
6,810 | all-6811 | [
"Get",
"Labels",
"from",
"Regexp",
"matches"
] | [
"func",
"getLabelsFromREMatches",
"(",
"matches",
"[",
"]",
"[",
"]",
"string",
")",
"(",
"labels",
"[",
"]",
"string",
")",
"{",
"for",
"_",
",",
"match",
":=",
"range",
"matches",
"{",
"for",
"_",
",",
"label",
":=",
"range",
"strings",
".",
"Split",
"(",
"match",
"[",
"0",
"]",
",",
"\"",
"\"",
")",
"[",
"1",
":",
"]",
"{",
"label",
"=",
"strings",
".",
"ToLower",
"(",
"match",
"[",
"1",
"]",
"+",
"\"",
"\"",
"+",
"strings",
".",
"TrimSpace",
"(",
"label",
")",
")",
"\n",
"labels",
"=",
"append",
"(",
"labels",
",",
"<mask>",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
6,811 | all-6812 | [
"Constructs",
"a",
"new",
"compressedResponseWriter",
"based",
"on",
"client",
"request",
"headers",
"."
] | [
"func",
"newCompressedResponseWriter",
"(",
"writer",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
")",
"*",
"compressedResponseWriter",
"{",
"encodings",
":=",
"strings",
".",
"Split",
"(",
"req",
".",
"Header",
".",
"Get",
"(",
"acceptEncodingHeader",
")",
",",
"\"",
"\"",
")",
"\n",
"for",
"_",
",",
"encoding",
":=",
"<mask>",
"encodings",
"{",
"switch",
"strings",
".",
"TrimSpace",
"(",
"encoding",
")",
"{",
"case",
"gzipEncoding",
":",
"writer",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"contentEncodingHeader",
",",
"gzipEncoding",
")",
"\n",
"return",
"&",
"compressedResponseWriter",
"{",
"ResponseWriter",
":",
"writer",
",",
"writer",
":",
"gzip",
".",
"NewWriter",
"(",
"writer",
")",
",",
"}",
"\n",
"case",
"deflateEncoding",
":",
"writer",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"contentEncodingHeader",
",",
"deflateEncoding",
")",
"\n",
"return",
"&",
"compressedResponseWriter",
"{",
"ResponseWriter",
":",
"writer",
",",
"writer",
":",
"zlib",
".",
"NewWriter",
"(",
"writer",
")",
",",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"&",
"compressedResponseWriter",
"{",
"ResponseWriter",
":",
"writer",
",",
"writer",
":",
"writer",
",",
"}",
"\n",
"}"
] |
6,812 | all-6813 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"ForciblyPurgeJavaScriptMemoryParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoMemory16",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
6,813 | all-6814 | [
"IsNoVaultHandlerDefined",
"asserts",
"a",
"dirty",
"string",
"matching",
"against",
"the",
"error",
"message",
"provided",
"by",
"err",
".",
"This",
"is",
"necessary",
"due",
"to",
"the",
"poor",
"error",
"handling",
"design",
"of",
"the",
"Vault",
"library",
"we",
"are",
"using",
"."
] | [
"func",
"IsNoVaultHandlerDefined",
"(",
"err",
"error",
")",
"bool",
"{",
"cause",
":=",
"microerror",
".",
"Cause",
"(",
"err",
")",
"\n\n",
"if",
"cause",
"!=",
"nil",
"&&",
"strings",
".",
"Contains",
"(",
"cause",
".",
"Error",
"(",
")",
",",
"\"",
"\"",
")",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
6,814 | all-6815 | [
"Clone",
"returns",
"a",
"clone",
"of",
"the",
"current",
"Envelope"
] | [
"func",
"(",
"e",
"*",
"Envelope",
")",
"Clone",
"(",
")",
"*",
"Envelope",
"{",
"if",
"e",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"newEnvelope",
":=",
"&",
"Envelope",
"{",
"e",
".",
"Text",
",",
"e",
".",
"HTML",
",",
"e",
".",
"Root",
".",
"Clone",
"(",
"nil",
")",
",",
"e",
".",
"Attachments",
",",
"e",
".",
"Inlines",
",",
"e",
".",
"OtherParts",
",",
"e",
".",
"Errors",
",",
"e",
".",
"<mask>",
",",
"}",
"\n",
"return",
"newEnvelope",
"\n",
"}"
] |
6,815 | all-6816 | [
"Get",
"returns",
"the",
"value",
"of",
"the",
"cookie",
"with",
"the",
"given",
"name",
".",
"Returns",
"http",
".",
"ErrNoCookie",
"if",
"there",
"s",
"no",
"cookie",
"with",
"that",
"name",
"in",
"the",
"request",
"."
] | [
"func",
"(",
"c",
"*",
"Cookies",
")",
"Get",
"(",
"name",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"ck",
",",
"err",
":=",
"c",
".",
"req",
".",
"Cookie",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"ck",
".",
"Value",
",",
"nil",
"\n",
"}"
] |
6,816 | all-6817 | [
"NewEventLog",
"returns",
"an",
"initialized",
"EventLog",
"with",
"the",
"given",
"family",
"and",
"title",
"."
] | [
"func",
"NewEventLog",
"(",
"family",
",",
"title",
"string",
")",
"xtr",
".",
"EventLog",
"{",
"e",
":=",
"&",
"EventLog",
"{",
"family",
":",
"family",
",",
"title",
":",
"title",
",",
"el",
":",
"xtr",
".",
"NewEventLog",
"(",
"family",
",",
"<mask>",
")",
",",
"}",
"\n",
"return",
"e",
"\n",
"}"
] |
6,817 | all-6818 | [
"RepositoryAssetLocator",
"builds",
"a",
"locator",
"from",
"the",
"given",
"href",
"."
] | [
"func",
"(",
"api",
"*",
"API",
")",
"RepositoryAssetLocator",
"(",
"href",
"<mask>",
")",
"*",
"RepositoryAssetLocator",
"{",
"return",
"&",
"RepositoryAssetLocator",
"{",
"Href",
"(",
"href",
")",
",",
"api",
"}",
"\n",
"}"
] |
6,818 | all-6819 | [
"/",
"*",
"Read",
"implements",
"the",
"io",
".",
"Reader",
"interface",
".",
"It",
"advances",
"the",
"cursor",
"as",
"it",
"reads",
"."
] | [
"func",
"(",
"b",
"*",
"Buffer",
")",
"Read",
"(",
"d",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"b",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"b",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"b",
".",
"closed",
"{",
"return",
"0",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"uint64",
"(",
"len",
"(",
"b",
".",
"contents",
")",
")",
"<=",
"b",
".",
"readCursor",
"{",
"return",
"0",
",",
"io",
".",
"EOF",
"\n",
"}",
"\n\n",
"n",
":=",
"<mask>",
"(",
"d",
",",
"b",
".",
"contents",
"[",
"b",
".",
"readCursor",
":",
"]",
")",
"\n",
"b",
".",
"readCursor",
"+=",
"uint64",
"(",
"n",
")",
"\n\n",
"return",
"n",
",",
"nil",
"\n",
"}"
] |
6,819 | all-6820 | [
"NewPeerAddressIp",
"creates",
"a",
"new",
"PeerAddressIp",
"."
] | [
"func",
"NewPeerAddressIp",
"(",
"aType",
"IpAddrType",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"PeerAddressIp",
",",
"err",
"error",
")",
"{",
"result",
".",
"Type",
"=",
"aType",
"\n",
"switch",
"IpAddrType",
"(",
"aType",
")",
"{",
"case",
"IpAddrTypeIPv4",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"[",
"4",
"]",
"byte",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Ipv4",
"=",
"&",
"tv",
"\n",
"case",
"IpAddrTypeIPv6",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"[",
"16",
"]",
"<mask>",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Ipv6",
"=",
"&",
"tv",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
6,820 | all-6821 | [
"WithHTTPClient",
"adds",
"the",
"HTTPClient",
"to",
"the",
"get",
"apps",
"app",
"routes",
"params"
] | [
"func",
"(",
"o",
"*",
"GetAppsAppRoutesParams",
")",
"WithHTTPClient",
"(",
"client",
"*",
"<mask>",
".",
"Client",
")",
"*",
"GetAppsAppRoutesParams",
"{",
"o",
".",
"SetHTTPClient",
"(",
"client",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
6,821 | all-6822 | [
"SetFontName",
"is",
"a",
"wrapper",
"around",
"gtk_font_button_set_font_name",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"FontButton",
")",
"SetFontName",
"(",
"fontname",
"string",
")",
"bool",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"fontname",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_font_button_set_font_name",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"return",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
6,822 | all-6823 | [
"UpdateComments",
"downloads",
"issue",
"and",
"pull",
"-",
"request",
"comments",
"and",
"save",
"in",
"DB"
] | [
"func",
"UpdateComments",
"(",
"issueID",
"int",
",",
"pullRequest",
"bool",
",",
"db",
"*",
"gorm",
".",
"<mask>",
",",
"client",
"ClientInterface",
")",
"{",
"latest",
":=",
"findLatestCommentUpdate",
"(",
"issueID",
",",
"db",
",",
"client",
".",
"RepositoryName",
"(",
")",
")",
"\n\n",
"updateIssueComments",
"(",
"issueID",
",",
"latest",
",",
"db",
",",
"client",
")",
"\n",
"if",
"pullRequest",
"{",
"updatePullComments",
"(",
"issueID",
",",
"latest",
",",
"db",
",",
"client",
")",
"\n",
"}",
"\n",
"}"
] |
6,823 | all-6824 | [
"export",
"FileSequence_Basename"
] | [
"func",
"FileSequence_Basename",
"(",
"id",
"FileSeqId",
")",
"*",
"C",
".",
"char",
"{",
"fs",
",",
"ok",
":=",
"sFileSeqs",
".",
"Get",
"(",
"<mask>",
")",
"\n",
"// caller must free string",
"if",
"!",
"ok",
"{",
"return",
"C",
".",
"CString",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"C",
".",
"CString",
"(",
"fs",
".",
"Basename",
"(",
")",
")",
"\n",
"}"
] |
6,824 | all-6825 | [
"getAuthInfo",
"is",
"a",
"modified",
"copy",
"of",
"k8s",
".",
"io",
"/",
"kubernetes",
"/",
"pkg",
"/",
"client",
"/",
"unversioned",
"/",
"clientcmd",
".",
"DirectClientConfig",
".",
"getAuthInfo",
"."
] | [
"func",
"(",
"config",
"*",
"directClientConfig",
")",
"getAuthInfo",
"(",
")",
"clientcmdAuthInfo",
"{",
"authInfos",
":=",
"config",
".",
"config",
".",
"AuthInfos",
"\n",
"authInfoName",
":=",
"config",
".",
"getAuthInfoName",
"(",
")",
"\n\n",
"<mask>",
"mergedAuthInfo",
"clientcmdAuthInfo",
"\n",
"if",
"configAuthInfo",
",",
"exists",
":=",
"authInfos",
"[",
"authInfoName",
"]",
";",
"exists",
"{",
"mergo",
".",
"Merge",
"(",
"&",
"mergedAuthInfo",
",",
"configAuthInfo",
")",
"\n",
"}",
"\n",
"// REMOVED: overrides support",
"return",
"mergedAuthInfo",
"\n",
"}"
] |
6,825 | all-6826 | [
"Returns",
"the",
"rants",
"tagged",
"for",
"weekly"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"WeeklyRants",
"(",
")",
"(",
"[",
"]",
"RantModel",
",",
"error",
")",
"{",
"url",
":=",
"fmt",
".",
"Sprintf",
"(",
"WEEKLY_PATH",
",",
"API",
",",
"APP_VERSION",
")",
"\n",
"res",
",",
"err",
":=",
"http",
".",
"Get",
"(",
"url",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"var",
"<mask>",
"RantsResponse",
"\n",
"json",
".",
"NewDecoder",
"(",
"res",
".",
"Body",
")",
".",
"Decode",
"(",
"&",
"data",
")",
"\n",
"if",
"!",
"data",
".",
"Success",
"&&",
"data",
".",
"Error",
"!=",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"data",
".",
"Error",
")",
"\n",
"}",
"\n",
"return",
"data",
".",
"Rants",
",",
"nil",
"\n",
"}"
] |
6,826 | all-6827 | [
"Next",
"gets",
"the",
"next",
"set",
"of",
"updates",
"from",
"the",
"etcd",
"resolver",
".",
"Calls",
"to",
"Next",
"should",
"be",
"serialized",
";",
"concurrent",
"calls",
"are",
"not",
"safe",
"since",
"there",
"is",
"no",
"way",
"to",
"reconcile",
"the",
"update",
"ordering",
"."
] | [
"func",
"(",
"gw",
"*",
"gRPCWatcher",
")",
"Next",
"(",
")",
"(",
"[",
"]",
"*",
"naming",
".",
"Update",
",",
"error",
")",
"{",
"if",
"gw",
".",
"wch",
"==",
"nil",
"{",
"// first Next() returns all addresses",
"return",
"gw",
".",
"firstNext",
"(",
")",
"\n",
"}",
"\n",
"if",
"gw",
".",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"gw",
".",
"err",
"\n",
"}",
"\n\n",
"// process new events on target/*",
"wr",
",",
"ok",
":=",
"<-",
"gw",
".",
"wch",
"\n",
"if",
"!",
"ok",
"{",
"gw",
".",
"err",
"=",
"status",
".",
"<mask>",
"(",
"codes",
".",
"Unavailable",
",",
"ErrWatcherClosed",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"nil",
",",
"gw",
".",
"err",
"\n",
"}",
"\n",
"if",
"gw",
".",
"err",
"=",
"wr",
".",
"Err",
"(",
")",
";",
"gw",
".",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"gw",
".",
"err",
"\n",
"}",
"\n\n",
"updates",
":=",
"make",
"(",
"[",
"]",
"*",
"naming",
".",
"Update",
",",
"0",
",",
"len",
"(",
"wr",
".",
"Events",
")",
")",
"\n",
"for",
"_",
",",
"e",
":=",
"range",
"wr",
".",
"Events",
"{",
"var",
"jupdate",
"naming",
".",
"Update",
"\n",
"var",
"err",
"error",
"\n",
"switch",
"e",
".",
"Type",
"{",
"case",
"etcd",
".",
"EventTypePut",
":",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"e",
".",
"Kv",
".",
"Value",
",",
"&",
"jupdate",
")",
"\n",
"jupdate",
".",
"Op",
"=",
"naming",
".",
"Add",
"\n",
"case",
"etcd",
".",
"EventTypeDelete",
":",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"e",
".",
"PrevKv",
".",
"Value",
",",
"&",
"jupdate",
")",
"\n",
"jupdate",
".",
"Op",
"=",
"naming",
".",
"Delete",
"\n",
"default",
":",
"continue",
"\n",
"}",
"\n",
"if",
"err",
"==",
"nil",
"{",
"updates",
"=",
"append",
"(",
"updates",
",",
"&",
"jupdate",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"updates",
",",
"nil",
"\n",
"}"
] |
6,827 | all-6828 | [
"GetQueryOk",
"returns",
"a",
"tuple",
"with",
"the",
"Query",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"e",
"*",
"EventStreamDefinition",
")",
"GetQueryOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"e",
"==",
"nil",
"||",
"e",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"e",
".",
"Query",
",",
"true",
"\n",
"}"
] |
6,828 | all-6829 | [
"CreateBranch",
"creates",
"a",
"new",
"branch"
] | [
"func",
"(",
"c",
"APIClient",
")",
"CreateBranch",
"(",
"repoName",
"string",
",",
"branch",
"string",
",",
"commit",
"string",
",",
"provenance",
"[",
"]",
"*",
"pfs",
".",
"Branch",
")",
"error",
"{",
"var",
"head",
"*",
"pfs",
".",
"Commit",
"\n",
"if",
"commit",
"!=",
"\"",
"\"",
"{",
"head",
"=",
"NewCommit",
"(",
"repoName",
",",
"commit",
")",
"\n",
"}",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"PfsAPIClient",
".",
"CreateBranch",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"pfs",
".",
"CreateBranchRequest",
"{",
"Branch",
":",
"NewBranch",
"(",
"repoName",
",",
"branch",
")",
",",
"Head",
":",
"<mask>",
",",
"Provenance",
":",
"provenance",
",",
"}",
",",
")",
"\n",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}"
] |
6,829 | all-6830 | [
"InitializeResources",
"initializes",
"the",
"required",
"field",
"in",
"the",
"task",
"on",
"agent",
"restart",
"Some",
"of",
"the",
"fields",
"in",
"task",
"isn",
"t",
"saved",
"in",
"the",
"agent",
"state",
"file",
"agent",
"needs",
"to",
"initialize",
"these",
"fields",
"before",
"processing",
"the",
"task",
"eg",
":",
"docker",
"client",
"in",
"resource"
] | [
"func",
"(",
"task",
"*",
"<mask>",
")",
"InitializeResources",
"(",
"resourceFields",
"*",
"taskresource",
".",
"ResourceFields",
")",
"{",
"task",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"task",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"for",
"_",
",",
"resources",
":=",
"range",
"task",
".",
"ResourcesMapUnsafe",
"{",
"for",
"_",
",",
"resource",
":=",
"range",
"resources",
"{",
"resource",
".",
"Initialize",
"(",
"resourceFields",
",",
"task",
".",
"KnownStatusUnsafe",
",",
"task",
".",
"DesiredStatusUnsafe",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
6,830 | all-6831 | [
"Do",
"executes",
"Profiler",
".",
"takeTypeProfile",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"result",
"-",
"Type",
"profile",
"for",
"all",
"scripts",
"since",
"startTypeProfile",
"()",
"was",
"turned",
"on",
"."
] | [
"func",
"(",
"p",
"*",
"TakeTypeProfileParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"result",
"[",
"]",
"*",
"ScriptTypeProfile",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"TakeTypeProfileReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandTakeTypeProfile",
",",
"nil",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"<mask>",
".",
"Result",
",",
"nil",
"\n",
"}"
] |
6,831 | all-6832 | [
"specify",
"a",
"two",
"-",
"dimensional",
"texture",
"image"
] | [
"func",
"TexImage2D",
"(",
"target",
"uint32",
",",
"level",
"int32",
",",
"internalformat",
"int32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"border",
"int32",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"pixels",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowTexImage2D",
"(",
"gpTexImage2D",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"level",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"internalformat",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"height",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"border",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"format",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"pixels",
")",
"\n",
"}"
] |
6,832 | all-6833 | [
"Delete",
"-",
"handle",
"a",
"delete",
"lease",
"call"
] | [
"func",
"(",
"s",
"*",
"Lease",
")",
"Delete",
"(",
"logger",
"*",
"log",
".",
"Logger",
",",
"req",
"*",
"http",
".",
"Request",
")",
"(",
"statusCode",
"int",
",",
"response",
"interface",
"{",
"}",
")",
"{",
"var",
"(",
"err",
"error",
"\n",
")",
"\n",
"statusCode",
"=",
"http",
".",
"StatusNotFound",
"\n",
"s",
".",
"taskCollection",
".",
"Wake",
"(",
")",
"\n\n",
"if",
"err",
"=",
"s",
".",
"InitFromHTTPRequest",
"(",
"req",
")",
";",
"err",
"==",
"nil",
"{",
"logger",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"s",
".",
"ReStock",
"(",
")",
"\n",
"statusCode",
"=",
"http",
".",
"StatusAccepted",
"\n",
"response",
"=",
"s",
".",
"<mask>",
"\n\n",
"}",
"else",
"{",
"response",
"=",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"err",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
6,833 | all-6834 | [
"NewVHostPathRewriter",
"returns",
"path",
"rewriter",
"which",
"strips",
"slashesCount",
"leading",
"slashes",
"from",
"the",
"path",
"and",
"prepends",
"the",
"path",
"with",
"request",
"s",
"host",
"thus",
"simplifying",
"virtual",
"hosting",
"for",
"static",
"files",
".",
"Examples",
":",
"*",
"host",
"=",
"foobar",
".",
"com",
"slashesCount",
"=",
"0",
"original",
"path",
"=",
"/",
"foo",
"/",
"bar",
".",
"Resulting",
"path",
":",
"/",
"foobar",
".",
"com",
"/",
"foo",
"/",
"bar",
"*",
"host",
"=",
"img",
".",
"aaa",
".",
"com",
"slashesCount",
"=",
"1",
"original",
"path",
"=",
"/",
"images",
"/",
"123",
"/",
"456",
".",
"jpg",
"Resulting",
"path",
":",
"/",
"img",
".",
"aaa",
".",
"com",
"/",
"123",
"/",
"456",
".",
"jpg"
] | [
"func",
"NewVHostPathRewriter",
"(",
"slashesCount",
"int",
")",
"PathRewriteFunc",
"{",
"return",
"func",
"(",
"ctx",
"*",
"RequestCtx",
")",
"[",
"]",
"byte",
"{",
"path",
":=",
"stripLeadingSlashes",
"(",
"ctx",
".",
"Path",
"(",
")",
",",
"slashesCount",
")",
"\n",
"host",
":=",
"ctx",
".",
"Host",
"(",
")",
"\n",
"if",
"n",
":=",
"bytes",
".",
"IndexByte",
"(",
"host",
",",
"'/'",
")",
";",
"n",
">=",
"0",
"{",
"host",
"=",
"nil",
"\n",
"}",
"\n",
"if",
"len",
"(",
"host",
")",
"==",
"0",
"{",
"host",
"=",
"strInvalidHost",
"\n",
"}",
"\n",
"b",
":=",
"bytebufferpool",
".",
"Get",
"(",
")",
"\n",
"b",
".",
"B",
"=",
"append",
"(",
"b",
".",
"B",
",",
"'/'",
")",
"\n",
"b",
".",
"B",
"=",
"append",
"(",
"b",
".",
"B",
",",
"host",
"...",
")",
"\n",
"b",
".",
"B",
"=",
"append",
"(",
"b",
".",
"B",
",",
"<mask>",
"...",
")",
"\n",
"ctx",
".",
"URI",
"(",
")",
".",
"SetPathBytes",
"(",
"b",
".",
"B",
")",
"\n",
"bytebufferpool",
".",
"Put",
"(",
"b",
")",
"\n\n",
"return",
"ctx",
".",
"Path",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
6,834 | all-6835 | [
"/",
"*",
"CancelDetects",
"cancels",
"any",
"pending",
"detects",
"and",
"cleans",
"up",
"their",
"goroutines",
".",
"You",
"should",
"always",
"call",
"this",
"when",
"you",
"re",
"done",
"with",
"a",
"set",
"of",
"Detect",
"channels",
"."
] | [
"func",
"(",
"b",
"*",
"Buffer",
")",
"CancelDetects",
"(",
")",
"{",
"b",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"b",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"<mask>",
"(",
"b",
".",
"detectCloser",
")",
"\n",
"b",
".",
"detectCloser",
"=",
"nil",
"\n",
"}"
] |
6,835 | all-6836 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetComputedStyleForNodeParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss46",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
6,836 | all-6837 | [
"GetOperation",
"returns",
"an",
"Operation",
"entry",
"for",
"the",
"provided",
"uuid"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetOperation",
"(",
"uuid",
"string",
")",
"(",
"*",
"api",
".",
"Operation",
",",
"string",
",",
"error",
")",
"{",
"op",
":=",
"api",
".",
"Operation",
"{",
"}",
"\n\n",
"// Fetch the raw value",
"etag",
",",
"err",
":=",
"r",
".",
"queryStruct",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"QueryEscape",
"(",
"uuid",
")",
")",
",",
"nil",
",",
"\"",
"\"",
",",
"&",
"op",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"op",
",",
"etag",
",",
"nil",
"\n",
"}"
] |
6,837 | all-6838 | [
"simultaneously",
"specify",
"and",
"enable",
"several",
"interleaved",
"arrays"
] | [
"func",
"InterleavedArrays",
"(",
"format",
"uint32",
",",
"stride",
"int32",
",",
"<mask>",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowInterleavedArrays",
"(",
"gpInterleavedArrays",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"format",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"stride",
")",
",",
"pointer",
")",
"\n",
"}"
] |
6,838 | all-6839 | [
"ParseRequestHeaders",
"parses",
"the",
"special",
"HTTP",
"request",
"headers",
"available",
"to",
"push",
"task",
"request",
"handlers",
".",
"This",
"function",
"silently",
"ignores",
"values",
"of",
"the",
"wrong",
"format",
"."
] | [
"func",
"ParseRequestHeaders",
"(",
"h",
"http",
".",
"Header",
")",
"*",
"RequestHeaders",
"{",
"ret",
":=",
"&",
"RequestHeaders",
"{",
"QueueName",
":",
"h",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"TaskName",
":",
"h",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"}",
"\n\n",
"ret",
".",
"TaskRetryCount",
",",
"_",
"=",
"strconv",
".",
"ParseInt",
"(",
"h",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"10",
",",
"64",
")",
"\n",
"<mask>",
".",
"TaskExecutionCount",
",",
"_",
"=",
"strconv",
".",
"ParseInt",
"(",
"h",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"10",
",",
"64",
")",
"\n\n",
"etaSecs",
",",
"_",
":=",
"strconv",
".",
"ParseInt",
"(",
"h",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"10",
",",
"64",
")",
"\n",
"if",
"etaSecs",
"!=",
"0",
"{",
"ret",
".",
"TaskETA",
"=",
"time",
".",
"Unix",
"(",
"etaSecs",
",",
"0",
")",
"\n",
"}",
"\n\n",
"ret",
".",
"TaskPreviousResponse",
",",
"_",
"=",
"strconv",
".",
"Atoi",
"(",
"h",
".",
"Get",
"(",
"\"",
"\"",
")",
")",
"\n",
"ret",
".",
"TaskRetryReason",
"=",
"h",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"h",
".",
"Get",
"(",
"\"",
"\"",
")",
"!=",
"\"",
"\"",
"{",
"ret",
".",
"FailFast",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"ret",
"\n",
"}"
] |
6,839 | all-6840 | [
"Decode",
"uses",
"the",
"length",
"of",
"the",
"slice",
"to",
"infer",
"the",
"length",
"of",
"the",
"Value",
"field",
"."
] | [
"func",
"(",
"v",
"*",
"ValueStruct",
")",
"Decode",
"(",
"b",
"[",
"]",
"byte",
")",
"{",
"v",
".",
"Meta",
"=",
"b",
"[",
"0",
"]",
"\n",
"v",
".",
"UserMeta",
"=",
"b",
"[",
"1",
"]",
"\n",
"<mask>",
"sz",
"int",
"\n",
"v",
".",
"ExpiresAt",
",",
"sz",
"=",
"binary",
".",
"Uvarint",
"(",
"b",
"[",
"2",
":",
"]",
")",
"\n",
"v",
".",
"Value",
"=",
"b",
"[",
"2",
"+",
"sz",
":",
"]",
"\n",
"}"
] |
6,840 | all-6841 | [
"newHelperMethodConditionalComment",
"creates",
"and",
"returns",
"an",
"HTML",
"comment",
"."
] | [
"func",
"newHelperMethodConditionalComment",
"(",
"ln",
"*",
"line",
",",
"rslt",
"*",
"result",
",",
"src",
"*",
"source",
",",
"parent",
"element",
",",
"opts",
"*",
"Options",
")",
"(",
"*",
"helperMethodConditionalComment",
",",
"error",
")",
"{",
"switch",
"len",
"(",
"ln",
".",
"tokens",
")",
"{",
"case",
"2",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ln",
".",
"fileName",
"(",
")",
",",
"ln",
".",
"no",
")",
"\n",
"case",
"3",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ln",
".",
"fileName",
"(",
")",
",",
"ln",
".",
"no",
")",
"\n",
"}",
"\n\n",
"commentType",
":=",
"ln",
".",
"tokens",
"[",
"2",
"]",
"\n\n",
"if",
"commentType",
"!=",
"commentTypeHidden",
"&&",
"commentType",
"!=",
"commentTypeRevealed",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ln",
".",
"fileName",
"(",
")",
",",
"ln",
".",
"no",
")",
"\n",
"}",
"\n\n",
"e",
":=",
"&",
"helperMethodConditionalComment",
"{",
"elementBase",
":",
"newElementBase",
"(",
"ln",
",",
"rslt",
",",
"src",
",",
"parent",
",",
"opts",
")",
",",
"commentType",
":",
"commentType",
",",
"condition",
":",
"strings",
".",
"Join",
"(",
"ln",
".",
"tokens",
"[",
"3",
":",
"]",
",",
"<mask>",
")",
",",
"}",
"\n\n",
"return",
"e",
",",
"nil",
"\n",
"}"
] |
6,841 | all-6842 | [
"GetTitle",
"returns",
"the",
"Title",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"q",
"*",
"QueryValueDefinition",
")",
"GetTitle",
"(",
")",
"<mask>",
"{",
"if",
"q",
"==",
"nil",
"||",
"q",
".",
"Title",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"q",
".",
"Title",
"\n",
"}"
] |
6,842 | all-6843 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetRealtimeDataReturns",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoWebaudio",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
6,843 | all-6844 | [
"OptIndexTrackExistence",
"enables",
"keeping",
"track",
"of",
"existence",
"of",
"columns",
"."
] | [
"func",
"OptIndexTrackExistence",
"(",
"trackExistence",
"bool",
")",
"IndexOption",
"{",
"return",
"func",
"(",
"options",
"*",
"IndexOptions",
")",
"{",
"<mask>",
".",
"trackExistence",
"=",
"trackExistence",
"\n",
"options",
".",
"trackExistenceSet",
"=",
"true",
"\n",
"}",
"\n",
"}"
] |
6,844 | all-6845 | [
"GetRoleName",
"returns",
"the",
"RoleName",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"i",
"*",
"IntegrationAWSAccountDeleteRequest",
")",
"GetRoleName",
"(",
")",
"<mask>",
"{",
"if",
"i",
"==",
"nil",
"||",
"i",
".",
"RoleName",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"i",
".",
"RoleName",
"\n",
"}"
] |
6,845 | all-6846 | [
"Restart",
"starts",
"the",
"member",
"using",
"the",
"preserved",
"data",
"dir",
"."
] | [
"func",
"(",
"m",
"*",
"member",
")",
"Restart",
"(",
"t",
"testing",
".",
"TB",
")",
"error",
"{",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"m",
".",
"<mask>",
")",
",",
"zap",
".",
"Strings",
"(",
"\"",
"\"",
",",
"m",
".",
"PeerURLs",
".",
"StringSlice",
"(",
")",
")",
",",
"zap",
".",
"Strings",
"(",
"\"",
"\"",
",",
"m",
".",
"ClientURLs",
".",
"StringSlice",
"(",
")",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"m",
".",
"grpcAddr",
")",
",",
")",
"\n",
"newPeerListeners",
":=",
"make",
"(",
"[",
"]",
"net",
".",
"Listener",
",",
"0",
")",
"\n",
"for",
"_",
",",
"ln",
":=",
"range",
"m",
".",
"PeerListeners",
"{",
"newPeerListeners",
"=",
"append",
"(",
"newPeerListeners",
",",
"NewListenerWithAddr",
"(",
"t",
",",
"ln",
".",
"Addr",
"(",
")",
".",
"String",
"(",
")",
")",
")",
"\n",
"}",
"\n",
"m",
".",
"PeerListeners",
"=",
"newPeerListeners",
"\n",
"newClientListeners",
":=",
"make",
"(",
"[",
"]",
"net",
".",
"Listener",
",",
"0",
")",
"\n",
"for",
"_",
",",
"ln",
":=",
"range",
"m",
".",
"ClientListeners",
"{",
"newClientListeners",
"=",
"append",
"(",
"newClientListeners",
",",
"NewListenerWithAddr",
"(",
"t",
",",
"ln",
".",
"Addr",
"(",
")",
".",
"String",
"(",
")",
")",
")",
"\n",
"}",
"\n",
"m",
".",
"ClientListeners",
"=",
"newClientListeners",
"\n\n",
"if",
"m",
".",
"grpcListener",
"!=",
"nil",
"{",
"if",
"err",
":=",
"m",
".",
"listenGRPC",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"t",
".",
"Fatal",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"err",
":=",
"m",
".",
"Launch",
"(",
")",
"\n",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"m",
".",
"Name",
")",
",",
"zap",
".",
"Strings",
"(",
"\"",
"\"",
",",
"m",
".",
"PeerURLs",
".",
"StringSlice",
"(",
")",
")",
",",
"zap",
".",
"Strings",
"(",
"\"",
"\"",
",",
"m",
".",
"ClientURLs",
".",
"StringSlice",
"(",
")",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"m",
".",
"grpcAddr",
")",
",",
"zap",
".",
"Error",
"(",
"err",
")",
",",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
6,846 | all-6847 | [
"UnmarshalText",
"implements",
"TextUnMarshaler",
"from",
"encoding"
] | [
"func",
"(",
"r",
"*",
"ToS",
")",
"UnmarshalText",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"v",
",",
"ok",
":=",
"_tosNameToValue",
"[",
"string",
"(",
"data",
")",
"]",
";",
"ok",
"{",
"*",
"r",
"=",
"v",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"string",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
6,847 | all-6848 | [
"Verifies",
"whether",
"the",
"server",
"is",
"ready",
"or",
"not",
"."
] | [
"func",
"(",
"h",
"*",
"Handler",
")",
"isReady",
"(",
")",
"bool",
"{",
"ready",
":=",
"atomic",
".",
"LoadUint32",
"(",
"&",
"h",
".",
"<mask>",
")",
"\n",
"return",
"ready",
">",
"0",
"\n",
"}"
] |
6,848 | all-6849 | [
"Execute",
"-",
"deletes",
"org",
"from",
"config"
] | [
"func",
"(",
"c",
"*",
"DeleteOrgConfigurationCommand",
")",
"Execute",
"(",
"[",
"]",
"<mask>",
")",
"error",
"{",
"if",
"err",
":=",
"config",
".",
"NewManager",
"(",
"c",
".",
"ConfigDirectory",
")",
".",
"DeleteOrgConfig",
"(",
"c",
".",
"OrgName",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"fmt",
".",
"Printf",
"(",
"\"",
"\"",
",",
"c",
".",
"OrgName",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
6,849 | all-6850 | [
"Find",
"the",
"starting",
"point",
"of",
"the",
"regions",
"R1",
"R2",
"&",
"RV"
] | [
"func",
"findRegions",
"(",
"word",
"*",
"snowballword",
".",
"SnowballWord",
")",
"(",
"r1start",
",",
"r2start",
",",
"rvstart",
"int",
")",
"{",
"// R1 & R2 are defined in the standard manner.",
"r1start",
"=",
"romance",
".",
"VnvSuffix",
"(",
"word",
",",
"isLowerVowel",
",",
"0",
")",
"\n",
"r2start",
"=",
"romance",
".",
"VnvSuffix",
"(",
"word",
",",
"isLowerVowel",
",",
"r1start",
")",
"\n\n",
"// Set RV, by default, as empty.",
"rvstart",
"=",
"len",
"(",
"word",
".",
"RS",
")",
"\n\n",
"// RV is the region after the first vowel, or the end of",
"// the word if it contains no vowel.",
"//",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"<mask>",
".",
"RS",
")",
";",
"i",
"++",
"{",
"if",
"isLowerVowel",
"(",
"word",
".",
"RS",
"[",
"i",
"]",
")",
"{",
"rvstart",
"=",
"i",
"+",
"1",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
6,850 | all-6851 | [
"NewSession",
"returns",
"a",
"new",
"*",
"Session",
"You",
"need",
"to",
"provide",
"a",
"Rootable",
"object",
"that",
"will",
"be",
"used",
"to",
"contain",
"the",
"results",
"of",
"the",
"authentication",
"process",
"like",
"the",
"api",
"key",
"for",
"instance",
".",
"Authentication",
"using",
"user",
"+",
"password"
] | [
"func",
"NewSession",
"(",
"username",
",",
"<mask>",
",",
"organization",
",",
"url",
"string",
",",
"root",
"Rootable",
")",
"*",
"Session",
"{",
"tr",
":=",
"&",
"http",
".",
"Transport",
"{",
"Proxy",
":",
"http",
".",
"ProxyFromEnvironment",
",",
"TLSHandshakeTimeout",
":",
"10",
"*",
"time",
".",
"Second",
",",
"TLSClientConfig",
":",
"&",
"tls",
".",
"Config",
"{",
"InsecureSkipVerify",
":",
"true",
",",
"}",
",",
"}",
"\n\n",
"return",
"&",
"Session",
"{",
"Username",
":",
"username",
",",
"Password",
":",
"password",
",",
"Organization",
":",
"organization",
",",
"URL",
":",
"url",
",",
"root",
":",
"root",
",",
"client",
":",
"&",
"http",
".",
"Client",
"{",
"Transport",
":",
"tr",
"}",
",",
"}",
"\n",
"}"
] |
6,851 | all-6852 | [
"Color",
"colors",
"the",
"foreground",
"of",
"the",
"given",
"string",
"(",
"whatever",
"the",
"previous",
"background",
"color",
"was",
"it",
"is",
"left",
"alone",
")",
"."
] | [
"func",
"(",
"c",
"<mask>",
")",
"Color",
"(",
"val",
"string",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
",",
"val",
",",
"ResetColor",
")",
"\n",
"}"
] |
6,852 | all-6853 | [
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"AccountMergeResultCode"
] | [
"func",
"(",
"e",
"AccountMergeResultCode",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"<mask>",
":=",
"accountMergeResultCodeMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
6,853 | all-6854 | [
"Param",
"returns",
"the",
"value",
"of",
"the",
"URL",
"param",
".",
"It",
"is",
"a",
"shortcut",
"for",
"c",
".",
"Params",
".",
"ByName",
"(",
"key",
")",
"router",
".",
"GET",
"(",
"/",
"user",
"/",
":",
"id",
"func",
"(",
"c",
"*",
"gin",
".",
"Context",
")",
"{",
"//",
"a",
"GET",
"request",
"to",
"/",
"user",
"/",
"john",
"id",
":",
"=",
"c",
".",
"Param",
"(",
"id",
")",
"//",
"id",
"==",
"john",
"}",
")"
] | [
"func",
"(",
"ctx",
"*",
"Context",
")",
"Param",
"(",
"<mask>",
"string",
")",
"string",
"{",
"return",
"ctx",
".",
"Params",
".",
"ByName",
"(",
"key",
")",
"\n",
"}"
] |
6,854 | all-6855 | [
"GetFlags",
"is",
"a",
"wrapper",
"around",
"g_settings_get_flags",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Settings",
")",
"GetFlags",
"(",
"name",
"string",
")",
"uint",
"{",
"cstr1",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"name",
")",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr1",
")",
")",
"\n\n",
"return",
"uint",
"(",
"C",
".",
"g_settings_get_flags",
"(",
"v",
".",
"native",
"(",
")",
",",
"cstr1",
")",
")",
"\n",
"}"
] |
6,855 | all-6856 | [
"SyncAll",
"signals",
"update",
"for",
"all",
"resources",
"hold",
"by",
"the",
"client",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"SyncAll",
"(",
")",
"error",
"{",
"c",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"resources",
",",
"err",
":=",
"c",
".",
"storage",
".",
"List",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"resources",
")",
"==",
"0",
"{",
"logrus",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"var",
"allErrors",
"error",
"\n",
"for",
"_",
",",
"i",
":=",
"range",
"resources",
"{",
"r",
",",
"err",
":=",
"common",
".",
"ItemToResource",
"(",
"i",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"allErrors",
"=",
"multierror",
".",
"Append",
"(",
"allErrors",
",",
"err",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"if",
"err",
":=",
"c",
".",
"update",
"(",
"r",
".",
"<mask>",
",",
"r",
".",
"State",
",",
"nil",
")",
";",
"err",
"!=",
"nil",
"{",
"allErrors",
"=",
"multierror",
".",
"Append",
"(",
"allErrors",
",",
"err",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"if",
"err",
":=",
"c",
".",
"storage",
".",
"Update",
"(",
"r",
")",
";",
"err",
"!=",
"nil",
"{",
"allErrors",
"=",
"multierror",
".",
"Append",
"(",
"allErrors",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"allErrors",
"\n",
"}"
] |
6,856 | all-6857 | [
"/",
"*",
"PostAppsAppRoutes",
"creates",
"new",
"route"
] | [
"func",
"(",
"a",
"*",
"Client",
")",
"PostAppsAppRoutes",
"(",
"params",
"*",
"PostAppsAppRoutesParams",
")",
"(",
"*",
"PostAppsAppRoutesOK",
",",
"error",
")",
"{",
"// TODO: Validate the params before sending",
"if",
"params",
"==",
"nil",
"{",
"params",
"=",
"NewPostAppsAppRoutesParams",
"(",
")",
"\n",
"}",
"\n\n",
"<mask>",
",",
"err",
":=",
"a",
".",
"transport",
".",
"Submit",
"(",
"&",
"runtime",
".",
"ClientOperation",
"{",
"ID",
":",
"\"",
"\"",
",",
"Method",
":",
"\"",
"\"",
",",
"PathPattern",
":",
"\"",
"\"",
",",
"ProducesMediaTypes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"ConsumesMediaTypes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"Schemes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
",",
"Params",
":",
"params",
",",
"Reader",
":",
"&",
"PostAppsAppRoutesReader",
"{",
"formats",
":",
"a",
".",
"formats",
"}",
",",
"Context",
":",
"params",
".",
"Context",
",",
"Client",
":",
"params",
".",
"HTTPClient",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
".",
"(",
"*",
"PostAppsAppRoutesOK",
")",
",",
"nil",
"\n\n",
"}"
] |
6,857 | all-6858 | [
"title",
":",
"app",
"log",
"path",
":",
"/",
"apps",
"/",
"{",
"app",
"}",
"/",
"log",
"method",
":",
"POST",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"responses",
":",
"200",
":",
"Ok",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized",
"404",
":",
"App",
"not",
"found"
] | [
"func",
"addLog",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"a",
",",
"err",
":=",
"app",
".",
"GetByName",
"(",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"t",
".",
"GetAppName",
"(",
")",
"!=",
"app",
".",
"InternalAppName",
"{",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermAppUpdateLog",
",",
"contextsForApp",
"(",
"a",
")",
"...",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"}",
"\n",
"logs",
",",
"_",
":=",
"InputValues",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"source",
":=",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"if",
"source",
"==",
"\"",
"\"",
"{",
"source",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"unit",
":=",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"for",
"_",
",",
"log",
":=",
"range",
"logs",
"{",
"err",
":=",
"a",
".",
"Log",
"(",
"log",
",",
"<mask>",
",",
"unit",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
6,858 | all-6859 | [
"PixbufNewFromFileAtScale",
"is",
"a",
"wrapper",
"around",
"gdk_pixbuf_new_from_file_at_scale",
"()",
"."
] | [
"func",
"PixbufNewFromFileAtScale",
"(",
"filename",
"string",
",",
"width",
",",
"height",
"int",
",",
"preserveAspectRatio",
"bool",
")",
"(",
"*",
"Pixbuf",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"filename",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n\n",
"var",
"err",
"*",
"C",
".",
"GError",
"=",
"nil",
"\n",
"c",
":=",
"C",
".",
"gdk_pixbuf_new_from_file_at_scale",
"(",
"cstr",
",",
"C",
".",
"int",
"(",
"<mask>",
")",
",",
"C",
".",
"int",
"(",
"height",
")",
",",
"gbool",
"(",
"preserveAspectRatio",
")",
",",
"&",
"err",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"defer",
"C",
".",
"g_error_free",
"(",
"err",
")",
"\n",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"err",
".",
"message",
")",
")",
")",
"\n",
"}",
"\n\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n\n",
"obj",
":=",
"&",
"glib",
".",
"Object",
"{",
"glib",
".",
"ToGObject",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"}",
"\n",
"p",
":=",
"&",
"Pixbuf",
"{",
"obj",
"}",
"\n",
"//obj.Ref()",
"runtime",
".",
"SetFinalizer",
"(",
"p",
",",
"func",
"(",
"_",
"interface",
"{",
"}",
")",
"{",
"obj",
".",
"Unref",
"(",
")",
"}",
")",
"\n",
"return",
"p",
",",
"nil",
"\n",
"}"
] |
6,859 | all-6860 | [
"platformString",
"returns",
"platform",
"-",
"specific",
"config",
"data",
"that",
"can",
"be",
"serialized",
"to",
"string",
"for",
"debugging"
] | [
"func",
"(",
"cfg",
"*",
"Config",
")",
"platformString",
"(",
")",
"string",
"{",
"// Returns a string if the default image name/tag of the Pause container has",
"// been overridden",
"if",
"cfg",
".",
"PauseContainerImageName",
"==",
"DefaultPauseContainerImageName",
"&&",
"cfg",
".",
"PauseContainerTag",
"==",
"DefaultPauseContainerTag",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"cfg",
".",
"PauseContainerImageName",
",",
"cfg",
".",
"PauseContainerTag",
")",
"\n",
"}",
"\n",
"<mask>",
"\"",
"\"",
"\n",
"}"
] |
6,860 | all-6861 | [
"SeekWithCmp",
"moves",
"iterator",
"to",
"a",
"provided",
"item",
"by",
"using",
"custom",
"comparator"
] | [
"func",
"(",
"<mask>",
"*",
"Iterator",
")",
"SeekWithCmp",
"(",
"itm",
"unsafe",
".",
"Pointer",
",",
"cmp",
"CompareFn",
",",
"eqCmp",
"CompareFn",
")",
"bool",
"{",
"var",
"found",
"bool",
"\n",
"if",
"found",
"=",
"it",
".",
"s",
".",
"findPath",
"(",
"itm",
",",
"cmp",
",",
"it",
".",
"buf",
",",
"&",
"it",
".",
"s",
".",
"Stats",
")",
"!=",
"nil",
";",
"found",
"{",
"it",
".",
"prev",
"=",
"it",
".",
"buf",
".",
"preds",
"[",
"0",
"]",
"\n",
"it",
".",
"curr",
"=",
"it",
".",
"buf",
".",
"succs",
"[",
"0",
"]",
"\n",
"}",
"else",
"{",
"if",
"found",
"=",
"eqCmp",
"!=",
"nil",
"&&",
"compare",
"(",
"eqCmp",
",",
"itm",
",",
"it",
".",
"buf",
".",
"preds",
"[",
"0",
"]",
".",
"Item",
"(",
")",
")",
"==",
"0",
";",
"found",
"{",
"it",
".",
"prev",
"=",
"nil",
"\n",
"it",
".",
"curr",
"=",
"it",
".",
"buf",
".",
"preds",
"[",
"0",
"]",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"found",
"\n",
"}"
] |
6,861 | all-6862 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"QuerySelectorParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom20",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
6,862 | all-6863 | [
"Change",
"the",
"ownership",
"of",
"the",
"given",
"unix",
"socket",
"file"
] | [
"func",
"socketUnixSetOwnership",
"(",
"<mask>",
"string",
",",
"group",
"string",
")",
"error",
"{",
"var",
"gid",
"int",
"\n",
"var",
"err",
"error",
"\n\n",
"if",
"group",
"!=",
"\"",
"\"",
"{",
"gid",
",",
"err",
"=",
"shared",
".",
"GroupId",
"(",
"group",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"group",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"gid",
"=",
"os",
".",
"Getgid",
"(",
")",
"\n",
"}",
"\n\n",
"err",
"=",
"os",
".",
"Chown",
"(",
"path",
",",
"os",
".",
"Getuid",
"(",
")",
",",
"gid",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
6,863 | all-6864 | [
"Scan",
"implements",
"the",
"database",
"/",
"sql",
"Scanner",
"interface",
"."
] | [
"func",
"(",
"rat",
"*",
"Rat",
")",
"Scan",
"(",
"src",
"interface",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"rat",
".",
"Rat",
"=",
"new",
"(",
"big",
".",
"Rat",
")",
"\n",
"<mask>",
"t",
":=",
"src",
".",
"(",
"type",
")",
"{",
"case",
"string",
":",
"_",
",",
"err",
"=",
"fmt",
".",
"Sscan",
"(",
"t",
",",
"rat",
".",
"Rat",
")",
"\n",
"case",
"[",
"]",
"byte",
":",
"_",
",",
"err",
"=",
"fmt",
".",
"Sscan",
"(",
"string",
"(",
"t",
")",
",",
"rat",
".",
"Rat",
")",
"\n",
"case",
"float64",
":",
"rat",
".",
"Rat",
".",
"SetFloat64",
"(",
"t",
")",
"\n",
"default",
":",
"_",
",",
"err",
"=",
"fmt",
".",
"Sscan",
"(",
"fmt",
".",
"Sprint",
"(",
"t",
")",
",",
"rat",
".",
"Rat",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
6,864 | all-6865 | [
"SetTitle",
"is",
"a",
"wrapper",
"around",
"g_notification_set_title",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Notification",
")",
"SetTitle",
"(",
"<mask>",
"string",
")",
"{",
"cstr1",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"title",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr1",
")",
")",
"\n\n",
"C",
".",
"g_notification_set_title",
"(",
"v",
".",
"native",
"(",
")",
",",
"cstr1",
")",
"\n",
"}"
] |
6,865 | all-6866 | [
"Add",
"will",
"add",
"the",
"specified",
"models",
"to",
"the",
"catalog",
"."
] | [
"func",
"(",
"c",
"*",
"Catalog",
")",
"Add",
"(",
"<mask>",
"...",
"Model",
")",
"{",
"for",
"_",
",",
"model",
":=",
"range",
"models",
"{",
"// get name",
"name",
":=",
"Init",
"(",
"model",
")",
".",
"Meta",
"(",
")",
".",
"PluralName",
"\n\n",
"// check existence",
"if",
"c",
".",
"models",
"[",
"name",
"]",
"!=",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"`coal: model with name \"%s\" already exists in catalog`",
",",
"name",
")",
")",
"\n",
"}",
"\n\n",
"// add model",
"c",
".",
"models",
"[",
"name",
"]",
"=",
"model",
"\n",
"}",
"\n",
"}"
] |
6,866 | all-6867 | [
"FindIssues",
"returns",
"f",
".",
"Issues"
] | [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"FindIssues",
"(",
"query",
",",
"<mask>",
"string",
",",
"asc",
"bool",
")",
"(",
"[",
"]",
"github",
".",
"Issue",
",",
"error",
")",
"{",
"return",
"f",
".",
"Issues",
",",
"nil",
"\n",
"}"
] |
6,867 | all-6868 | [
"GetPageIterator",
"returns",
"a",
"OutgoingCallerIDPageIterator",
"with",
"the",
"given",
"page",
"filters",
".",
"Call",
"iterator",
".",
"Next",
"()",
"to",
"get",
"the",
"first",
"page",
"of",
"resources",
"(",
"and",
"again",
"to",
"retrieve",
"subsequent",
"pages",
")",
"."
] | [
"func",
"(",
"o",
"*",
"OutgoingCallerIDService",
")",
"GetPageIterator",
"(",
"data",
"<mask>",
".",
"Values",
")",
"*",
"OutgoingCallerIDPageIterator",
"{",
"iter",
":=",
"NewPageIterator",
"(",
"o",
".",
"client",
",",
"data",
",",
"callerIDPathPart",
")",
"\n",
"return",
"&",
"OutgoingCallerIDPageIterator",
"{",
"p",
":",
"iter",
",",
"}",
"\n",
"}"
] |
6,868 | all-6869 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"InsertTextParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoInput5",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
6,869 | all-6870 | [
"GetClientChannels",
"gets",
"client",
"channel",
"information",
"."
] | [
"func",
"(",
"h",
"*",
"Handler",
")",
"GetClientChannels",
"(",
"tkn",
"string",
",",
"channelStatus",
",",
"serviceStatus",
"[",
"]",
"string",
",",
"offset",
",",
"limit",
"uint",
")",
"(",
"*",
"GetClientChannelsResult",
",",
"error",
")",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"channelStatus",
",",
"\"",
"\"",
",",
"serviceStatus",
")",
"\n\n",
"if",
"!",
"h",
".",
"token",
".",
"Check",
"(",
"tkn",
")",
"{",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
",",
"ErrAccessDenied",
"\n",
"}",
"\n\n",
"chs",
",",
"total",
",",
"err",
":=",
"h",
".",
"getChannels",
"(",
"logger",
",",
"channelStatus",
",",
"serviceStatus",
",",
"clientChannelsCondition",
",",
"offset",
",",
"limit",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"items",
":=",
"make",
"(",
"[",
"]",
"ClientChannelInfo",
",",
"0",
")",
"\n",
"for",
"_",
",",
"channel",
":=",
"<mask>",
"chs",
"{",
"result",
",",
"err",
":=",
"h",
".",
"createClientChannelResult",
"(",
"logger",
",",
"&",
"channel",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"items",
"=",
"append",
"(",
"items",
",",
"*",
"result",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"GetClientChannelsResult",
"{",
"items",
",",
"total",
"}",
",",
"nil",
"\n",
"}"
] |
6,870 | all-6871 | [
"shouldVisit",
"returns",
"true",
"if",
"Walk",
"should",
"visit",
"the",
"subdirectory",
"rel",
"."
] | [
"func",
"shouldVisit",
"(",
"rel",
"string",
",",
"mode",
"Mode",
",",
"updateRels",
"map",
"[",
"string",
"]",
"bool",
")",
"bool",
"{",
"if",
"<mask>",
"!=",
"UpdateDirsMode",
"{",
"return",
"true",
"\n",
"}",
"\n",
"_",
",",
"ok",
":=",
"updateRels",
"[",
"rel",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
6,871 | all-6872 | [
"Write",
"creates",
"new",
"influxdb",
".",
"BatchPoints",
"containing",
"p",
"and",
"delegates",
"that",
"to",
"the",
"writer"
] | [
"func",
"(",
"w",
"*",
"SinglePointWriter",
")",
"Write",
"(",
"bpConf",
"influxdb",
".",
"BatchPointsConfig",
",",
"p",
"*",
"influxdb",
".",
"<mask>",
")",
"error",
"{",
"bp",
":=",
"newBatchPoints",
"(",
"bpConf",
")",
"\n",
"bp",
".",
"AddPoint",
"(",
"p",
")",
"\n",
"return",
"w",
".",
"writer",
".",
"Write",
"(",
"bp",
")",
"\n",
"}"
] |
6,872 | all-6873 | [
"Output",
"returns",
"the",
"output",
"filename",
"for",
"testing",
"."
] | [
"func",
"Output",
"(",
"name",
",",
"ext",
"string",
")",
"string",
"{",
"var",
"root",
"string",
"\n",
"if",
"ext",
"==",
"\"",
"\"",
"||",
"ext",
"==",
"\"",
"\"",
"{",
"root",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
",",
"name",
",",
"ext",
")",
"\n",
"}"
] |
6,873 | all-6874 | [
"totalNetworkAdapters",
"returns",
"the",
"total",
"number",
"of",
"network",
"adapters",
"in",
"the",
"VMX",
"file",
"."
] | [
"func",
"(",
"v",
"*",
"VM",
")",
"totalNetworkAdapters",
"(",
"vmx",
"map",
"[",
"string",
"]",
"string",
")",
"int",
"{",
"var",
"total",
"int",
"\n",
"prefix",
":=",
"\"",
"\"",
"\n\n",
"for",
"key",
":=",
"range",
"vmx",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"key",
",",
"prefix",
")",
"{",
"ethN",
":=",
"strings",
".",
"Split",
"(",
"key",
",",
"\"",
"\"",
")",
"[",
"0",
"]",
"\n",
"<mask>",
",",
"_",
":=",
"strconv",
".",
"Atoi",
"(",
"strings",
".",
"Split",
"(",
"ethN",
",",
"prefix",
")",
"[",
"1",
"]",
")",
"\n\n",
"if",
"number",
">",
"total",
"{",
"total",
"=",
"number",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"total",
"\n",
"}"
] |
6,874 | all-6875 | [
"GetPageTitle",
"is",
"a",
"wrapper",
"around",
"gtk_assistant_get_page_title",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Assistant",
")",
"GetPageTitle",
"(",
"page",
"IWidget",
")",
"string",
"{",
"return",
"goString",
"(",
"C",
".",
"gtk_assistant_get_page_title",
"(",
"v",
".",
"native",
"(",
")",
",",
"<mask>",
".",
"toWidget",
"(",
")",
")",
")",
"\n",
"}"
] |
6,875 | all-6876 | [
"NewWhisper",
"create",
"instance",
"of",
"Whisper"
] | [
"func",
"NewWhisper",
"(",
"rootPath",
"string",
",",
"schemas",
"WhisperSchemas",
",",
"aggregation",
"*",
"WhisperAggregation",
",",
"recv",
"func",
"(",
"chan",
"bool",
")",
"string",
",",
"<mask>",
"func",
"(",
"string",
")",
"(",
"*",
"points",
".",
"Points",
",",
"bool",
")",
",",
"confirm",
"func",
"(",
"*",
"points",
".",
"Points",
")",
")",
"*",
"Whisper",
"{",
"return",
"&",
"Whisper",
"{",
"recv",
":",
"recv",
",",
"pop",
":",
"pop",
",",
"confirm",
":",
"confirm",
",",
"schemas",
":",
"schemas",
",",
"aggregation",
":",
"aggregation",
",",
"workersCount",
":",
"1",
",",
"rootPath",
":",
"rootPath",
",",
"maxUpdatesPerSecond",
":",
"0",
",",
"logger",
":",
"zapwriter",
".",
"Logger",
"(",
"\"",
"\"",
")",
",",
"createLogger",
":",
"zapwriter",
".",
"Logger",
"(",
"\"",
"\"",
")",
",",
"}",
"\n",
"}"
] |
6,876 | all-6877 | [
"String",
"representation",
"suitable",
"for",
"human",
"consumption",
"."
] | [
"func",
"(",
"o",
"*",
"Object",
")",
"String",
"(",
")",
"string",
"{",
"var",
"buf",
"bytes",
".",
"<mask>",
"\n",
"fmt",
".",
"Fprint",
"(",
"&",
"buf",
",",
"o",
".",
"reflectType",
")",
"\n",
"if",
"o",
".",
"Name",
"!=",
"\"",
"\"",
"{",
"fmt",
".",
"Fprintf",
"(",
"&",
"buf",
",",
"\"",
"\"",
",",
"o",
".",
"Name",
")",
"\n",
"}",
"\n",
"return",
"buf",
".",
"String",
"(",
")",
"\n",
"}"
] |
6,877 | all-6878 | [
"SetTitle",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_tree_view_column_set_title",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TreeViewColumn",
")",
"SetTitle",
"(",
"t",
"string",
")",
"{",
"cstr",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"t",
")",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_tree_view_column_set_title",
"(",
"v",
".",
"native",
"(",
")",
",",
"cstr",
")",
"\n",
"}"
] |
6,878 | all-6879 | [
"GetColor",
"is",
"a",
"wrapper",
"around",
"gtk_style_context_get_color",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"StyleContext",
")",
"GetColor",
"(",
"<mask>",
"StateFlags",
")",
"*",
"gdk",
".",
"RGBA",
"{",
"gdkColor",
":=",
"gdk",
".",
"NewRGBA",
"(",
")",
"\n",
"C",
".",
"gtk_style_context_get_color",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkStateFlags",
"(",
"state",
")",
",",
"(",
"*",
"C",
".",
"GdkRGBA",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"gdkColor",
".",
"Native",
"(",
")",
")",
")",
")",
"\n",
"return",
"gdkColor",
"\n",
"}"
] |
6,879 | all-6880 | [
"Parse",
"parses",
"a",
"NAT",
"interface",
"description",
"."
] | [
"func",
"Parse",
"(",
"config",
"*",
"Config",
")",
"(",
"Interface",
",",
"error",
")",
"{",
"switch",
"config",
".",
"Mechanism",
"{",
"case",
"\"",
"\"",
":",
"return",
"any",
"(",
"config",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"uPnP",
"(",
"config",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"pmp",
"(",
")",
",",
"nil",
"\n",
"<mask>",
":",
"return",
"nil",
",",
"ErrBadMechanism",
"\n",
"}",
"\n",
"}"
] |
6,880 | all-6881 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"HighlightRectParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoOverlay9",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
6,881 | all-6882 | [
"Addrs",
"discovers",
"ip",
"addresses",
"of",
"nodes",
"that",
"match",
"the",
"given",
"filter",
"criteria",
".",
"The",
"config",
"string",
"must",
"have",
"the",
"format",
"provider",
"=",
"xxx",
"key",
"=",
"val",
"key",
"=",
"val",
"...",
"where",
"the",
"keys",
"and",
"values",
"are",
"provider",
"specific",
".",
"The",
"values",
"are",
"URL",
"encoded",
"."
] | [
"func",
"(",
"d",
"*",
"Discover",
")",
"Addrs",
"(",
"cfg",
"string",
",",
"l",
"*",
"<mask>",
".",
"Logger",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"d",
".",
"once",
".",
"Do",
"(",
"d",
".",
"initProviders",
")",
"\n\n",
"args",
",",
"err",
":=",
"Parse",
"(",
"cfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"name",
":=",
"args",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"name",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"providers",
":=",
"d",
".",
"Providers",
"\n",
"if",
"providers",
"==",
"nil",
"{",
"providers",
"=",
"Providers",
"\n",
"}",
"\n\n",
"p",
":=",
"providers",
"[",
"name",
"]",
"\n",
"if",
"p",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
"+",
"name",
")",
"\n",
"}",
"\n",
"l",
".",
"Printf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n\n",
"if",
"typ",
",",
"ok",
":=",
"p",
".",
"(",
"ProviderWithUserAgent",
")",
";",
"ok",
"{",
"typ",
".",
"SetUserAgent",
"(",
"d",
".",
"userAgent",
")",
"\n",
"return",
"p",
".",
"Addrs",
"(",
"args",
",",
"l",
")",
"\n",
"}",
"\n\n",
"return",
"p",
".",
"Addrs",
"(",
"args",
",",
"l",
")",
"\n",
"}"
] |
6,882 | all-6883 | [
"Printf",
"outputs",
"formatted",
"Print",
"log"
] | [
"func",
"(",
"g",
"*",
"Glg",
")",
"Printf",
"(",
"<mask>",
"string",
",",
"val",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"g",
".",
"out",
"(",
"PRINT",
",",
"format",
",",
"val",
"...",
")",
"\n",
"}"
] |
6,883 | all-6884 | [
"copyUpdatedConfigAndManifest",
"updates",
"the",
"image",
"per",
"ic",
".",
"manifestUpdates",
"if",
"necessary",
"stores",
"the",
"resulting",
"config",
"and",
"manifest",
"to",
"the",
"destination",
"and",
"returns",
"the",
"stored",
"manifest",
"."
] | [
"func",
"(",
"ic",
"*",
"imageCopier",
")",
"copyUpdatedConfigAndManifest",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"pendingImage",
":=",
"ic",
".",
"src",
"\n",
"if",
"!",
"reflect",
".",
"DeepEqual",
"(",
"*",
"ic",
".",
"manifestUpdates",
",",
"types",
".",
"ManifestUpdateOptions",
"{",
"InformationOnly",
":",
"ic",
".",
"manifestUpdates",
".",
"InformationOnly",
"}",
")",
"{",
"if",
"!",
"ic",
".",
"canModifyManifest",
"{",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"!",
"ic",
".",
"diffIDsAreNeeded",
"&&",
"ic",
".",
"src",
".",
"UpdatedImageNeedsLayerDiffIDs",
"(",
"*",
"<mask>",
".",
"manifestUpdates",
")",
"{",
"// We have set ic.diffIDsAreNeeded based on the preferred MIME type returned by determineManifestConversion.",
"// So, this can only happen if we are trying to upload using one of the other MIME type candidates.",
"// Because UpdatedImageNeedsLayerDiffIDs is true only when converting from s1 to s2, this case should only arise",
"// when ic.c.dest.SupportedManifestMIMETypes() includes both s1 and s2, the upload using s1 failed, and we are now trying s2.",
"// Supposedly s2-only registries do not exist or are extremely rare, so failing with this error message is good enough for now.",
"// If handling such registries turns out to be necessary, we could compute ic.diffIDsAreNeeded based on the full list of manifest MIME type candidates.",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ic",
".",
"manifestUpdates",
".",
"ManifestMIMEType",
")",
"\n",
"}",
"\n",
"pi",
",",
"err",
":=",
"ic",
".",
"src",
".",
"UpdatedImage",
"(",
"ctx",
",",
"*",
"ic",
".",
"manifestUpdates",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"pendingImage",
"=",
"pi",
"\n",
"}",
"\n",
"manifest",
",",
"_",
",",
"err",
":=",
"pendingImage",
".",
"Manifest",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"ic",
".",
"c",
".",
"copyConfig",
"(",
"ctx",
",",
"pendingImage",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"ic",
".",
"c",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
")",
"\n",
"if",
"err",
":=",
"ic",
".",
"c",
".",
"dest",
".",
"PutManifest",
"(",
"ctx",
",",
"manifest",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"manifest",
",",
"nil",
"\n",
"}"
] |
6,884 | all-6885 | [
"NewWriter",
"returns",
"a",
"new",
"Writer",
"it",
"will",
"flush",
"when",
"it",
"gets",
"termHeight",
"many",
"lines",
"including",
"the",
"header",
"line",
".",
"The",
"header",
"line",
"will",
"be",
"reprinted",
"termHeight",
"many",
"lines",
"have",
"been",
"written",
".",
"NewStreamingWriter",
"will",
"panic",
"if",
"it",
"s",
"given",
"a",
"header",
"that",
"doesn",
"t",
"end",
"in",
"\\",
"n",
"."
] | [
"func",
"NewWriter",
"(",
"w",
"io",
".",
"Writer",
",",
"<mask>",
"string",
")",
"*",
"Writer",
"{",
"if",
"header",
"[",
"len",
"(",
"header",
")",
"-",
"1",
"]",
"!=",
"'\\n'",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"tabwriter",
":=",
"ansiterm",
".",
"NewTabWriter",
"(",
"w",
",",
"0",
",",
"1",
",",
"1",
",",
"' '",
",",
"0",
")",
"\n",
"tabwriter",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"header",
")",
")",
"\n",
"return",
"&",
"Writer",
"{",
"w",
":",
"tabwriter",
",",
"lines",
":",
"1",
",",
"// 1 because we just printed the header",
"header",
":",
"[",
"]",
"byte",
"(",
"header",
")",
",",
"}",
"\n",
"}"
] |
6,885 | all-6886 | [
"RenameProject",
"renames",
"an",
"existing",
"project",
"entry"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"RenameProject",
"(",
"name",
"string",
",",
"project",
"api",
".",
"ProjectPost",
")",
"(",
"Operation",
",",
"error",
")",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Send the request",
"op",
",",
"_",
",",
"err",
":=",
"r",
".",
"queryOperation",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"name",
")",
")",
",",
"<mask>",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"op",
",",
"nil",
"\n",
"}"
] |
6,886 | all-6887 | [
"Rename",
"renames",
"a",
"dataset",
"."
] | [
"func",
"(",
"d",
"*",
"Dataset",
")",
"Rename",
"(",
"name",
"string",
",",
"createParent",
"bool",
",",
"recursiveRenameSnapshots",
"bool",
")",
"(",
"*",
"Dataset",
",",
"error",
")",
"{",
"args",
":=",
"<mask>",
"(",
"[",
"]",
"string",
",",
"3",
",",
"5",
")",
"\n",
"args",
"[",
"0",
"]",
"=",
"\"",
"\"",
"\n",
"args",
"[",
"1",
"]",
"=",
"d",
".",
"Name",
"\n",
"args",
"[",
"2",
"]",
"=",
"name",
"\n",
"if",
"createParent",
"{",
"args",
"=",
"append",
"(",
"args",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"recursiveRenameSnapshots",
"{",
"args",
"=",
"append",
"(",
"args",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"_",
",",
"err",
":=",
"zfs",
"(",
"args",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"d",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"GetDataset",
"(",
"name",
")",
"\n",
"}"
] |
6,887 | all-6888 | [
"ClipboardGet",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_clipboard_get",
"()",
"."
] | [
"func",
"ClipboardGet",
"(",
"atom",
"gdk",
".",
"Atom",
")",
"(",
"*",
"Clipboard",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_clipboard_get",
"(",
"C",
".",
"GdkAtom",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
")",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n\n",
"cb",
":=",
"&",
"Clipboard",
"{",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"}",
"\n",
"return",
"cb",
",",
"nil",
"\n",
"}"
] |
6,888 | all-6889 | [
"init",
"intializes",
"the",
"decoder",
"for",
"decoding",
"a",
"new",
"file",
"."
] | [
"func",
"(",
"d",
"*",
"decoder29",
")",
"init",
"(",
"r",
"io",
".",
"ByteReader",
",",
"<mask>",
"bool",
")",
"error",
"{",
"if",
"d",
".",
"br",
"==",
"nil",
"{",
"d",
".",
"br",
"=",
"newRarBitReader",
"(",
"r",
")",
"\n",
"}",
"else",
"{",
"d",
".",
"br",
".",
"reset",
"(",
"r",
")",
"\n",
"}",
"\n",
"d",
".",
"eof",
"=",
"false",
"\n",
"if",
"reset",
"{",
"d",
".",
"initFilters",
"(",
")",
"\n",
"d",
".",
"lz",
".",
"reset",
"(",
")",
"\n",
"d",
".",
"ppm",
".",
"reset",
"(",
")",
"\n",
"d",
".",
"decode",
"=",
"nil",
"\n",
"}",
"\n",
"if",
"d",
".",
"decode",
"==",
"nil",
"{",
"return",
"d",
".",
"readBlockHeader",
"(",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
6,889 | all-6890 | [
"API",
"functions"
] | [
"func",
"operationGet",
"(",
"d",
"*",
"Daemon",
",",
"r",
"*",
"http",
".",
"Request",
")",
"Response",
"{",
"id",
":=",
"mux",
".",
"Vars",
"(",
"r",
")",
"[",
"\"",
"\"",
"]",
"\n\n",
"var",
"body",
"*",
"api",
".",
"Operation",
"\n\n",
"// First check if the query is for a local operation from this node",
"op",
",",
"err",
":=",
"operationGetInternal",
"(",
"id",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"_",
",",
"body",
",",
"err",
"=",
"op",
".",
"Render",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"SyncResponse",
"(",
"true",
",",
"body",
")",
"\n",
"}",
"\n\n",
"// Then check if the query is from an operation on another node, and, if so, forward it",
"var",
"address",
"string",
"\n",
"err",
"=",
"d",
".",
"cluster",
".",
"Transaction",
"(",
"func",
"(",
"<mask>",
"*",
"db",
".",
"ClusterTx",
")",
"error",
"{",
"operation",
",",
"err",
":=",
"tx",
".",
"OperationByUUID",
"(",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"address",
"=",
"operation",
".",
"NodeAddress",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"cert",
":=",
"d",
".",
"endpoints",
".",
"NetworkCert",
"(",
")",
"\n",
"client",
",",
"err",
":=",
"cluster",
".",
"Connect",
"(",
"address",
",",
"cert",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"body",
",",
"_",
",",
"err",
"=",
"client",
".",
"GetOperation",
"(",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"SyncResponse",
"(",
"true",
",",
"body",
")",
"\n",
"}"
] |
6,890 | all-6891 | [
"registerResource",
"sends",
"a",
"request",
"to",
"create",
"CRDs",
"and",
"waits",
"for",
"them",
"to",
"initialize"
] | [
"func",
"registerResource",
"(",
"config",
"*",
"<mask>",
".",
"Config",
",",
"t",
"Type",
")",
"error",
"{",
"c",
",",
"err",
":=",
"apiextensionsclient",
".",
"NewForConfig",
"(",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"crd",
":=",
"&",
"apiextensionsv1beta1",
".",
"CustomResourceDefinition",
"{",
"ObjectMeta",
":",
"v1",
".",
"ObjectMeta",
"{",
"Name",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"t",
".",
"Plural",
",",
"group",
")",
",",
"}",
",",
"Spec",
":",
"apiextensionsv1beta1",
".",
"CustomResourceDefinitionSpec",
"{",
"Group",
":",
"group",
",",
"Version",
":",
"version",
",",
"Scope",
":",
"apiextensionsv1beta1",
".",
"NamespaceScoped",
",",
"Names",
":",
"apiextensionsv1beta1",
".",
"CustomResourceDefinitionNames",
"{",
"Singular",
":",
"t",
".",
"Singular",
",",
"Plural",
":",
"t",
".",
"Plural",
",",
"Kind",
":",
"t",
".",
"Kind",
",",
"ListKind",
":",
"t",
".",
"ListKind",
",",
"}",
",",
"}",
",",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"c",
".",
"ApiextensionsV1beta1",
"(",
")",
".",
"CustomResourceDefinitions",
"(",
")",
".",
"Create",
"(",
"crd",
")",
";",
"err",
"!=",
"nil",
"&&",
"!",
"apierrors",
".",
"IsAlreadyExists",
"(",
"err",
")",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
6,891 | all-6892 | [
"ErrorList",
"implements",
"the",
"error",
"interface",
"."
] | [
"func",
"(",
"l",
"ErrorList",
")",
"Error",
"(",
")",
"string",
"{",
"switch",
"len",
"(",
"l",
")",
"{",
"case",
"0",
":",
"return",
"\"",
"\"",
"\n",
"<mask>",
"1",
":",
"return",
"l",
"[",
"0",
"]",
".",
"Error",
"(",
")",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"l",
"[",
"0",
"]",
",",
"len",
"(",
"l",
")",
"-",
"1",
")",
"\n",
"}"
] |
6,892 | all-6893 | [
"Errorln",
"logging"
] | [
"func",
"(",
"l",
"*",
"StdLevelLogger",
")",
"Errorln",
"(",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"l",
".",
"loglnFunc",
"(",
"ErrorLevel",
",",
"l",
".",
"<mask>",
",",
"args",
"...",
")",
"\n",
"}"
] |
6,893 | all-6894 | [
"PadFrameRange",
"takes",
"a",
"frame",
"range",
"string",
"and",
"returns",
"a",
"new",
"range",
"with",
"each",
"number",
"padded",
"out",
"with",
"zeros",
"to",
"a",
"given",
"width"
] | [
"func",
"PadFrameRange",
"(",
"frange",
"string",
",",
"pad",
"int",
")",
"string",
"{",
"// We don't need to do anything if they gave us",
"// an invalid pad number",
"if",
"pad",
"<",
"2",
"{",
"return",
"frange",
"\n",
"}",
"\n\n",
"size",
":=",
"strings",
".",
"Count",
"(",
"frange",
",",
"\"",
"\"",
")",
"+",
"1",
"\n",
"parts",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"size",
",",
"size",
")",
"\n\n",
"for",
"i",
",",
"part",
":=",
"range",
"strings",
".",
"Split",
"(",
"frange",
",",
"\"",
"\"",
")",
"{",
"didMatch",
":=",
"false",
"\n\n",
"for",
"_",
",",
"rx",
":=",
"range",
"rangePatterns",
"{",
"matched",
":=",
"rx",
".",
"FindStringSubmatch",
"(",
"part",
")",
"\n",
"if",
"len",
"(",
"matched",
")",
"==",
"0",
"{",
"continue",
"\n",
"}",
"\n",
"matched",
"=",
"matched",
"[",
"1",
":",
"]",
"\n",
"size",
"=",
"len",
"(",
"matched",
")",
"\n",
"switch",
"size",
"{",
"case",
"1",
":",
"parts",
"[",
"i",
"]",
"=",
"zfillString",
"(",
"matched",
"[",
"0",
"]",
",",
"pad",
")",
"\n",
"case",
"2",
":",
"parts",
"[",
"i",
"]",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"zfillString",
"(",
"matched",
"[",
"0",
"]",
",",
"pad",
")",
",",
"zfillString",
"(",
"matched",
"[",
"1",
"]",
",",
"pad",
")",
")",
"\n",
"case",
"4",
":",
"parts",
"[",
"i",
"]",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"zfillString",
"(",
"matched",
"[",
"0",
"]",
",",
"pad",
")",
",",
"zfillString",
"(",
"matched",
"[",
"1",
"]",
",",
"pad",
")",
",",
"matched",
"[",
"2",
"]",
",",
"matched",
"[",
"3",
"]",
")",
"\n",
"default",
":",
"// No match. Try the next pattern",
"continue",
"\n",
"}",
"\n",
"// If we got here, we matched a case and can stop",
"// checking the rest of the patterns",
"didMatch",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n",
"// If we didn't match one of our expected patterns",
"// then just take the original part and add it unmodified",
"if",
"!",
"didMatch",
"{",
"<mask>",
"=",
"append",
"(",
"parts",
",",
"part",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"parts",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
6,894 | all-6895 | [
"title",
":",
"service",
"instance",
"proxy",
"path",
":",
"/",
"services",
"/",
"{",
"service",
"}",
"/",
"proxy",
"/",
"{",
"instance",
"}",
"method",
":",
"*",
"responses",
":",
"401",
":",
"Unauthorized",
"404",
":",
"Instance",
"not",
"found"
] | [
"func",
"serviceInstanceProxy",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"serviceName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"instanceName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"serviceInstance",
",",
"err",
":=",
"getServiceInstanceOrError",
"(",
"serviceName",
",",
"instanceName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermServiceInstanceUpdateProxy",
",",
"contextsForServiceInstance",
"(",
"serviceInstance",
",",
"serviceName",
")",
"...",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"path",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"var",
"evt",
"*",
"event",
".",
"Event",
"\n",
"if",
"r",
".",
"Method",
"!=",
"http",
".",
"MethodGet",
"&&",
"r",
".",
"Method",
"!=",
"http",
".",
"MethodHead",
"{",
"evt",
",",
"err",
"=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"serviceInstanceTarget",
"(",
"serviceName",
",",
"instanceName",
")",
",",
"Kind",
":",
"permission",
".",
"PermServiceInstanceUpdateProxy",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"append",
"(",
"<mask>",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"\"",
"\"",
",",
"\"",
"\"",
":",
"r",
".",
"Method",
",",
"}",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermServiceInstanceReadEvents",
",",
"contextsForServiceInstance",
"(",
"serviceInstance",
",",
"serviceName",
")",
"...",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"}",
"\n",
"return",
"service",
".",
"ProxyInstance",
"(",
"serviceInstance",
",",
"path",
",",
"evt",
",",
"requestIDHeader",
"(",
"r",
")",
",",
"w",
",",
"r",
")",
"\n",
"}"
] |
6,895 | all-6896 | [
"Do",
"executes",
"DOM",
".",
"getDocument",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"root",
"-",
"Resulting",
"node",
"."
] | [
"func",
"(",
"p",
"*",
"GetDocumentParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"root",
"*",
"cdp",
".",
"Node",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"GetDocumentReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetDocument",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"<mask>",
",",
"nil",
"\n",
"}"
] |
6,896 | all-6897 | [
"Sum32",
"returns",
"the",
"32",
"bits",
"Hash",
"value",
"."
] | [
"func",
"(",
"xxh",
"*",
"XXHZero",
")",
"Sum32",
"(",
")",
"uint32",
"{",
"h32",
":=",
"uint32",
"(",
"xxh",
".",
"totalLen",
")",
"\n",
"if",
"h32",
">=",
"16",
"{",
"h32",
"+=",
"rol1",
"(",
"xxh",
".",
"v1",
")",
"+",
"rol7",
"(",
"xxh",
".",
"v2",
")",
"+",
"rol12",
"(",
"xxh",
".",
"v3",
")",
"+",
"rol18",
"(",
"xxh",
".",
"v4",
")",
"\n",
"}",
"else",
"{",
"h32",
"+=",
"prime32_5",
"\n",
"}",
"\n\n",
"p",
":=",
"0",
"\n",
"n",
":=",
"xxh",
".",
"bufused",
"\n",
"buf",
":=",
"xxh",
".",
"buf",
"\n",
"for",
"n",
":=",
"n",
"-",
"4",
";",
"p",
"<=",
"n",
";",
"p",
"+=",
"4",
"{",
"h32",
"+=",
"<mask>",
".",
"LittleEndian",
".",
"Uint32",
"(",
"buf",
"[",
"p",
":",
"p",
"+",
"4",
"]",
")",
"*",
"prime32_3",
"\n",
"h32",
"=",
"rol17",
"(",
"h32",
")",
"*",
"prime32_4",
"\n",
"}",
"\n",
"for",
";",
"p",
"<",
"n",
";",
"p",
"++",
"{",
"h32",
"+=",
"uint32",
"(",
"buf",
"[",
"p",
"]",
")",
"*",
"prime32_5",
"\n",
"h32",
"=",
"rol11",
"(",
"h32",
")",
"*",
"prime32_1",
"\n",
"}",
"\n\n",
"h32",
"^=",
"h32",
">>",
"15",
"\n",
"h32",
"*=",
"prime32_2",
"\n",
"h32",
"^=",
"h32",
">>",
"13",
"\n",
"h32",
"*=",
"prime32_3",
"\n",
"h32",
"^=",
"h32",
">>",
"16",
"\n\n",
"return",
"h32",
"\n",
"}"
] |
6,897 | all-6898 | [
"NewSkiplist",
"makes",
"a",
"new",
"empty",
"skiplist",
"with",
"a",
"given",
"arena",
"size"
] | [
"func",
"NewSkiplist",
"(",
"arenaSize",
"int64",
")",
"*",
"Skiplist",
"{",
"arena",
":=",
"newArena",
"(",
"arenaSize",
")",
"\n",
"head",
":=",
"newNode",
"(",
"arena",
",",
"nil",
",",
"y",
".",
"ValueStruct",
"{",
"}",
",",
"maxHeight",
")",
"\n",
"return",
"&",
"Skiplist",
"{",
"<mask>",
":",
"1",
",",
"head",
":",
"head",
",",
"arena",
":",
"arena",
",",
"ref",
":",
"1",
",",
"}",
"\n",
"}"
] |
6,898 | all-6899 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventTargetDestroyed",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoTarget14",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
6,899 | all-6900 | [
"Create",
"creates",
"a",
"role",
"if",
"it",
"doesn",
"t",
"exist",
"yet",
".",
"Creating",
"roles",
"is",
"idempotent",
"in",
"the",
"vault",
"api",
"so",
"no",
"need",
"to",
"check",
"if",
"it",
"already",
"exists",
"."
] | [
"func",
"(",
"s",
"*",
"service",
")",
"Create",
"(",
"params",
"CreateParams",
")",
"error",
"{",
"logicalStore",
":=",
"s",
".",
"vaultClient",
".",
"Logical",
"(",
")",
"\n\n",
"data",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"params",
".",
"AllowedDomains",
",",
"\"",
"\"",
":",
"params",
".",
"AllowSubdomains",
",",
"\"",
"\"",
":",
"params",
".",
"TTL",
",",
"\"",
"\"",
":",
"params",
".",
"AllowBareDomains",
",",
"\"",
"\"",
":",
"params",
".",
"Organizations",
",",
"}",
"\n\n",
"_",
",",
"err",
":=",
"logicalStore",
".",
"Write",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"s",
".",
"pkiMountpoint",
",",
"params",
".",
"Name",
")",
",",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"microerror",
".",
"Mask",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.