id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
12,500 | all-12501 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetPlaybackRateParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoAnimation10",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
12,501 | all-12502 | [
"FetchRuleSetGroup",
"retrieves",
"rule",
"set",
"group",
"with",
"passed",
"cid",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"FetchRuleSetGroup",
"(",
"cid",
"CIDType",
")",
"(",
"*",
"RuleSetGroup",
",",
"error",
")",
"{",
"if",
"cid",
"==",
"nil",
"||",
"*",
"cid",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"groupCID",
":=",
"string",
"(",
"*",
"cid",
")",
"\n\n",
"matched",
",",
"err",
":=",
"regexp",
".",
"MatchString",
"(",
"config",
".",
"RuleSetGroupCIDRegex",
",",
"groupCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"matched",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"groupCID",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"Get",
"(",
"groupCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"Debug",
"{",
"a",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"string",
"(",
"result",
")",
")",
"\n",
"}",
"\n\n",
"rulesetGroup",
":=",
"&",
"RuleSetGroup",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"<mask>",
",",
"rulesetGroup",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"rulesetGroup",
",",
"nil",
"\n",
"}"
] |
12,502 | all-12503 | [
"RemoveOffsetValue",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_level_bar_remove_offset_value",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"LevelBar",
")",
"RemoveOffsetValue",
"(",
"name",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_level_bar_remove_offset_value",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
12,503 | all-12504 | [
"This",
"endpoint",
"will",
"return",
"a",
"list",
"of",
"all",
"the",
"hook",
"definitions",
"within",
"a",
"given",
"hook",
"group",
".",
"See",
"#listHooks"
] | [
"func",
"(",
"hooks",
"*",
"Hooks",
")",
"ListHooks",
"(",
"hookGroupId",
"string",
")",
"(",
"*",
"HookList",
",",
"error",
")",
"{",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"hooks",
")",
"\n",
"responseObject",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"hookGroupId",
")",
",",
"<mask>",
"(",
"HookList",
")",
",",
"nil",
")",
"\n",
"return",
"responseObject",
".",
"(",
"*",
"HookList",
")",
",",
"err",
"\n",
"}"
] |
12,504 | all-12505 | [
"TempFile",
"calls",
"ioutil",
".",
"TempFile",
"."
] | [
"func",
"(",
"g",
"GitOS",
")",
"TempFile",
"(",
"dir",
",",
"prefix",
"string",
")",
"(",
"File",
",",
"error",
")",
"{",
"return",
"ioutil",
".",
"TempFile",
"(",
"dir",
",",
"<mask>",
")",
"\n",
"}"
] |
12,505 | all-12506 | [
"Return",
"the",
"first",
"matching",
"Route",
"and",
"the",
"corresponding",
"parameters",
"for",
"a",
"given",
"URL",
"object",
"."
] | [
"func",
"(",
"rt",
"*",
"router",
")",
"findRouteFromURL",
"(",
"httpMethod",
"string",
",",
"urlObj",
"*",
"url",
".",
"<mask>",
")",
"(",
"*",
"Route",
",",
"map",
"[",
"string",
"]",
"string",
",",
"bool",
")",
"{",
"// lookup the routes in the Trie",
"matches",
",",
"pathMatched",
":=",
"rt",
".",
"trie",
".",
"FindRoutesAndPathMatched",
"(",
"strings",
".",
"ToUpper",
"(",
"httpMethod",
")",
",",
"// work with the httpMethod in uppercase",
"escapedPath",
"(",
"urlObj",
")",
",",
"// work with the path urlencoded",
")",
"\n\n",
"// short cuts",
"if",
"len",
"(",
"matches",
")",
"==",
"0",
"{",
"// no route found",
"return",
"nil",
",",
"nil",
",",
"pathMatched",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"matches",
")",
"==",
"1",
"{",
"// one route found",
"return",
"matches",
"[",
"0",
"]",
".",
"Route",
".",
"(",
"*",
"Route",
")",
",",
"matches",
"[",
"0",
"]",
".",
"Params",
",",
"pathMatched",
"\n",
"}",
"\n\n",
"// multiple routes found, pick the first defined",
"result",
":=",
"rt",
".",
"ofFirstDefinedRoute",
"(",
"matches",
")",
"\n",
"return",
"result",
".",
"Route",
".",
"(",
"*",
"Route",
")",
",",
"result",
".",
"Params",
",",
"pathMatched",
"\n",
"}"
] |
12,506 | all-12507 | [
"Create",
"a",
"lock",
"which",
"when",
"EnableInvariantChecking",
"has",
"been",
"called",
"will",
"call",
"the",
"supplied",
"function",
"at",
"moments",
"when",
"invariants",
"protected",
"by",
"the",
"lock",
"should",
"hold",
"(",
"e",
".",
"g",
".",
"just",
"after",
"acquiring",
"the",
"lock",
")",
".",
"The",
"function",
"should",
"crash",
"if",
"an",
"invariant",
"is",
"violated",
".",
"It",
"should",
"not",
"have",
"side",
"effects",
"as",
"there",
"are",
"no",
"guarantees",
"that",
"it",
"will",
"run",
".",
"The",
"invariants",
"must",
"hold",
"at",
"the",
"time",
"that",
"NewInvariantMutex",
"is",
"called",
"."
] | [
"func",
"NewInvariantMutex",
"(",
"<mask>",
"func",
"(",
")",
")",
"(",
"mu",
"InvariantMutex",
")",
"{",
"if",
"check",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"mu",
".",
"check",
"=",
"check",
"\n",
"mu",
".",
"checkIfEnabled",
"(",
")",
"\n\n",
"return",
"\n",
"}"
] |
12,507 | all-12508 | [
"GetCurrentPage",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_notebook_get_current_page",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Notebook",
")",
"GetCurrentPage",
"(",
")",
"int",
"{",
"c",
":=",
"C",
".",
"gtk_notebook_get_current_page",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"int",
"(",
"c",
")",
"\n",
"}"
] |
12,508 | all-12509 | [
"slice",
"returns",
"a",
"slice",
"of",
"log",
"entries",
"from",
"lo",
"through",
"hi",
"-",
"1",
"inclusive",
"."
] | [
"func",
"(",
"l",
"*",
"raftLog",
")",
"slice",
"(",
"lo",
",",
"hi",
",",
"maxSize",
"uint64",
")",
"(",
"[",
"]",
"pb",
".",
"Entry",
",",
"error",
")",
"{",
"err",
":=",
"l",
".",
"mustCheckOutOfBounds",
"(",
"lo",
",",
"hi",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"lo",
"==",
"hi",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"var",
"ents",
"[",
"]",
"<mask>",
".",
"Entry",
"\n",
"if",
"lo",
"<",
"l",
".",
"unstable",
".",
"offset",
"{",
"storedEnts",
",",
"err",
":=",
"l",
".",
"storage",
".",
"Entries",
"(",
"lo",
",",
"min",
"(",
"hi",
",",
"l",
".",
"unstable",
".",
"offset",
")",
",",
"maxSize",
")",
"\n",
"if",
"err",
"==",
"ErrCompacted",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"else",
"if",
"err",
"==",
"ErrUnavailable",
"{",
"l",
".",
"logger",
".",
"Panicf",
"(",
"\"",
"\"",
",",
"lo",
",",
"min",
"(",
"hi",
",",
"l",
".",
"unstable",
".",
"offset",
")",
")",
"\n",
"}",
"else",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"// TODO(bdarnell)",
"\n",
"}",
"\n\n",
"// check if ents has reached the size limitation",
"if",
"uint64",
"(",
"len",
"(",
"storedEnts",
")",
")",
"<",
"min",
"(",
"hi",
",",
"l",
".",
"unstable",
".",
"offset",
")",
"-",
"lo",
"{",
"return",
"storedEnts",
",",
"nil",
"\n",
"}",
"\n\n",
"ents",
"=",
"storedEnts",
"\n",
"}",
"\n",
"if",
"hi",
">",
"l",
".",
"unstable",
".",
"offset",
"{",
"unstable",
":=",
"l",
".",
"unstable",
".",
"slice",
"(",
"max",
"(",
"lo",
",",
"l",
".",
"unstable",
".",
"offset",
")",
",",
"hi",
")",
"\n",
"if",
"len",
"(",
"ents",
")",
">",
"0",
"{",
"combined",
":=",
"make",
"(",
"[",
"]",
"pb",
".",
"Entry",
",",
"len",
"(",
"ents",
")",
"+",
"len",
"(",
"unstable",
")",
")",
"\n",
"n",
":=",
"copy",
"(",
"combined",
",",
"ents",
")",
"\n",
"copy",
"(",
"combined",
"[",
"n",
":",
"]",
",",
"unstable",
")",
"\n",
"ents",
"=",
"combined",
"\n",
"}",
"else",
"{",
"ents",
"=",
"unstable",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"limitSize",
"(",
"ents",
",",
"maxSize",
")",
",",
"nil",
"\n",
"}"
] |
12,509 | all-12510 | [
"FindByID",
"finds",
"exactly",
"one",
"element",
"that",
"has",
"the",
"given",
"ID",
"."
] | [
"func",
"(",
"s",
"*",
"selectable",
")",
"FindByID",
"(",
"<mask>",
"string",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"ID",
",",
"id",
")",
".",
"Single",
"(",
")",
")",
"\n",
"}"
] |
12,510 | all-12511 | [
"CreateProject",
"defines",
"a",
"new",
"container",
"project"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"CreateProject",
"(",
"<mask>",
"api",
".",
"ProjectsPost",
")",
"error",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Send the request",
"_",
",",
"_",
",",
"err",
":=",
"r",
".",
"query",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"project",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
12,511 | all-12512 | [
"GetBlob",
"returns",
"a",
"stream",
"for",
"the",
"specified",
"blob",
"and",
"the",
"blob’s",
"size",
"(",
"or",
"-",
"1",
"if",
"unknown",
")",
".",
"The",
"Digest",
"field",
"in",
"BlobInfo",
"is",
"guaranteed",
"to",
"be",
"provided",
"Size",
"may",
"be",
"-",
"1",
"and",
"MediaType",
"may",
"be",
"optionally",
"provided",
".",
"May",
"update",
"BlobInfoCache",
"preferably",
"after",
"it",
"knows",
"for",
"certain",
"that",
"a",
"blob",
"truly",
"exists",
"at",
"a",
"specific",
"location",
"."
] | [
"func",
"(",
"s",
"*",
"Source",
")",
"GetBlob",
"(",
"ctx",
"context",
".",
"Context",
",",
"info",
"types",
".",
"BlobInfo",
",",
"cache",
"types",
".",
"BlobInfoCache",
")",
"(",
"io",
".",
"ReadCloser",
",",
"int64",
",",
"error",
")",
"{",
"if",
"err",
":=",
"s",
".",
"ensureCachedDataIsPresent",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"info",
".",
"Digest",
"==",
"s",
".",
"configDigest",
"{",
"// FIXME? Implement a more general algorithm matching instead of assuming sha256.",
"return",
"ioutil",
".",
"NopCloser",
"(",
"bytes",
".",
"NewReader",
"(",
"s",
".",
"configBytes",
")",
")",
",",
"int64",
"(",
"len",
"(",
"s",
".",
"configBytes",
")",
")",
",",
"nil",
"\n",
"}",
"\n\n",
"if",
"li",
",",
"ok",
":=",
"s",
".",
"knownLayers",
"[",
"info",
".",
"Digest",
"]",
";",
"ok",
"{",
"// diffID is a digest of the uncompressed tarball,",
"underlyingStream",
",",
"err",
":=",
"s",
".",
"openTarComponent",
"(",
"li",
".",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"0",
",",
"err",
"\n",
"}",
"\n",
"closeUnderlyingStream",
":=",
"true",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"closeUnderlyingStream",
"{",
"underlyingStream",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"// In order to handle the fact that digests != diffIDs (and thus that a",
"// caller which is trying to verify the blob will run into problems),",
"// we need to decompress blobs. This is a bit ugly, but it's a",
"// consequence of making everything addressable by their DiffID rather",
"// than by their digest...",
"//",
"// In particular, because the v2s2 manifest being generated uses",
"// DiffIDs, any caller of GetBlob is going to be asking for DiffIDs of",
"// layers not their _actual_ digest. The result is that copy/... will",
"// be verifing a \"digest\" which is not the actual layer's digest (but",
"// is instead the DiffID).",
"uncompressedStream",
",",
"_",
",",
"err",
":=",
"compression",
".",
"AutoDecompress",
"(",
"underlyingStream",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"0",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"<mask>",
".",
"Digest",
")",
"\n",
"}",
"\n\n",
"newStream",
":=",
"uncompressedReadCloser",
"{",
"Reader",
":",
"uncompressedStream",
",",
"underlyingCloser",
":",
"underlyingStream",
".",
"Close",
",",
"uncompressedCloser",
":",
"uncompressedStream",
".",
"Close",
",",
"}",
"\n",
"closeUnderlyingStream",
"=",
"false",
"\n\n",
"return",
"newStream",
",",
"li",
".",
"size",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"0",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"info",
".",
"Digest",
")",
"\n",
"}"
] |
12,512 | all-12513 | [
"noCloseTag",
"returns",
"true",
"is",
"the",
"HTML",
"tag",
"has",
"no",
"close",
"tag",
"."
] | [
"func",
"(",
"e",
"*",
"htmlTag",
")",
"noCloseTag",
"(",
")",
"bool",
"{",
"for",
"_",
",",
"name",
":=",
"range",
"e",
".",
"opts",
".",
"NoCloseTagNames",
"{",
"if",
"e",
".",
"tagName",
"==",
"<mask>",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
12,513 | all-12514 | [
"GetName",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_paper_size_get_name",
"()",
"."
] | [
"func",
"(",
"<mask>",
"*",
"PaperSize",
")",
"GetName",
"(",
")",
"string",
"{",
"c",
":=",
"C",
".",
"gtk_paper_size_get_name",
"(",
"ps",
".",
"native",
"(",
")",
")",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"c",
")",
")",
"\n",
"}"
] |
12,514 | all-12515 | [
"ContainingNetworks",
"returns",
"all",
"RangerEntry",
"(",
"s",
")",
"that",
"given",
"ip",
"contained",
"in",
"."
] | [
"func",
"(",
"b",
"*",
"bruteRanger",
")",
"ContainingNetworks",
"(",
"<mask>",
"net",
".",
"IP",
")",
"(",
"[",
"]",
"RangerEntry",
",",
"error",
")",
"{",
"entries",
",",
"err",
":=",
"b",
".",
"getEntriesByVersion",
"(",
"ip",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"results",
":=",
"[",
"]",
"RangerEntry",
"{",
"}",
"\n",
"for",
"_",
",",
"entry",
":=",
"range",
"entries",
"{",
"network",
":=",
"entry",
".",
"Network",
"(",
")",
"\n",
"if",
"network",
".",
"Contains",
"(",
"ip",
")",
"{",
"results",
"=",
"append",
"(",
"results",
",",
"entry",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"results",
",",
"nil",
"\n",
"}"
] |
12,515 | all-12516 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniform4fv",
"(",
"program",
"uint32",
",",
"<mask>",
"int32",
",",
"count",
"int32",
",",
"value",
"*",
"float32",
")",
"{",
"C",
".",
"glowProgramUniform4fv",
"(",
"gpProgramUniform4fv",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"location",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"*",
"C",
".",
"GLfloat",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
] |
12,516 | all-12517 | [
"MergeSchema",
"merges",
"the",
"map",
"[",
"string",
"]",
"*",
"schema",
".",
"Schema",
"from",
"src",
"into",
"dst",
".",
"Safety",
"against",
"conflicts",
"is",
"enforced",
"by",
"panicing",
"."
] | [
"func",
"MergeSchema",
"(",
"dst",
",",
"src",
"map",
"[",
"string",
"]",
"*",
"schema",
".",
"Schema",
")",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"src",
"{",
"if",
"_",
",",
"<mask>",
":=",
"dst",
"[",
"k",
"]",
";",
"ok",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"k",
")",
")",
"\n",
"}",
"\n",
"dst",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"}"
] |
12,517 | all-12518 | [
"reregisterContainerInstance",
"registers",
"a",
"container",
"instance",
"that",
"has",
"already",
"been",
"registered",
"with",
"ECS",
".",
"This",
"is",
"for",
"cases",
"where",
"the",
"ECS",
"Agent",
"is",
"being",
"restored",
"from",
"a",
"check",
"point",
"."
] | [
"func",
"(",
"agent",
"*",
"ecsAgent",
")",
"reregisterContainerInstance",
"(",
"client",
"api",
".",
"ECSClient",
",",
"capabilities",
"[",
"]",
"*",
"ecs",
".",
"Attribute",
",",
"tags",
"[",
"]",
"*",
"ecs",
".",
"Tag",
",",
"registrationToken",
"string",
",",
"platformDevices",
"[",
"]",
"*",
"ecs",
".",
"PlatformDevice",
")",
"error",
"{",
"_",
",",
"availabilityZone",
",",
"err",
":=",
"client",
".",
"RegisterContainerInstance",
"(",
"agent",
".",
"containerInstanceARN",
",",
"capabilities",
",",
"tags",
",",
"registrationToken",
",",
"platformDevices",
")",
"\n",
"//set az to agent",
"agent",
".",
"availabilityZone",
"=",
"availabilityZone",
"\n\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"seelog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"if",
"apierrors",
".",
"IsInstanceTypeChangedError",
"(",
"err",
")",
"{",
"seelog",
".",
"Criticalf",
"(",
"instanceTypeMismatchErrorFormat",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"err",
".",
"(",
"apierrors",
".",
"AttributeError",
")",
";",
"<mask>",
"{",
"seelog",
".",
"Critical",
"(",
"\"",
"\"",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"return",
"transientError",
"{",
"err",
"}",
"\n",
"}"
] |
12,518 | all-12519 | [
"Creates",
"a",
"New",
"Dotter",
".",
"Parameters",
":",
"-",
"isStrict",
":",
"if",
"true",
"multiple",
"edges",
"won",
"t",
"be",
"displayed",
".",
"-",
"writeToFile",
":",
"if",
"true",
"output",
"will",
"be",
"written",
"to",
"fname",
".",
"Otherwise",
"to",
"stdout",
".",
"-",
"fname",
":",
"filename",
".",
"if",
"fname",
"equals",
"dot",
"will",
"make",
"up",
"a",
"filename",
"-",
"usally",
"noname",
".",
"dot",
".",
"*"
] | [
"func",
"NewDotterEx",
"(",
"oType",
"OutputType",
",",
"prog",
"Program",
",",
"gType",
"GraphType",
",",
"isStrict",
",",
"writeToFile",
"bool",
",",
"fname",
"string",
")",
"(",
"*",
"Dotter",
",",
"error",
")",
"{",
"dotPath",
",",
"err",
":=",
"exec",
".",
"LookPath",
"(",
"string",
"(",
"prog",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"otype",
":=",
"\"",
"\"",
"+",
"string",
"(",
"oType",
")",
"\n\n",
"var",
"cmd",
"*",
"exec",
".",
"Cmd",
"\n",
"if",
"writeToFile",
"{",
"ofile",
":=",
"\"",
"\"",
"\n",
"if",
"fname",
"!=",
"\"",
"\"",
"{",
"ofile",
"=",
"\"",
"\"",
"+",
"fname",
"\n",
"}",
"\n",
"cmd",
"=",
"exec",
".",
"Command",
"(",
"dotPath",
",",
"otype",
",",
"ofile",
")",
"\n",
"}",
"else",
"{",
"cmd",
"=",
"exec",
".",
"Command",
"(",
"dotPath",
",",
"otype",
")",
"\n",
"stdout",
",",
"err",
":=",
"cmd",
".",
"StdoutPipe",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"go",
"<mask>",
".",
"Copy",
"(",
"os",
".",
"Stdout",
",",
"stdout",
")",
"\n",
"}",
"\n\n",
"stdin",
",",
"err",
":=",
"cmd",
".",
"StdinPipe",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"dotter",
":=",
"&",
"Dotter",
"{",
"}",
"\n",
"dotter",
".",
"instance",
"=",
"cmd",
"\n",
"dotter",
".",
"stdin",
"=",
"stdin",
"\n",
"dotter",
".",
"graphType",
"=",
"gType",
"\n",
"dotter",
".",
"isFirstCmd",
"=",
"true",
"\n",
"dotter",
".",
"isStrict",
"=",
"isStrict",
"\n\n",
"return",
"dotter",
",",
"cmd",
".",
"Start",
"(",
")",
"\n",
"}"
] |
12,519 | all-12520 | [
"Syntax",
":",
"gopherflakes",
".",
"go",
":",
"234",
"Note",
"that",
"unlike",
"vmodule",
"the",
"file",
"extension",
"is",
"included",
"here",
"."
] | [
"func",
"(",
"t",
"*",
"TraceLocation",
")",
"Set",
"(",
"value",
"string",
")",
"error",
"{",
"if",
"value",
"==",
"\"",
"\"",
"{",
"// Unset.",
"t",
".",
"line",
"=",
"0",
"\n",
"t",
".",
"file",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"fields",
":=",
"strings",
".",
"Split",
"(",
"value",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"fields",
")",
"!=",
"2",
"{",
"return",
"errTraceSyntax",
"\n",
"}",
"\n",
"file",
",",
"line",
":=",
"<mask>",
"[",
"0",
"]",
",",
"fields",
"[",
"1",
"]",
"\n",
"if",
"!",
"strings",
".",
"Contains",
"(",
"file",
",",
"\"",
"\"",
")",
"{",
"return",
"errTraceSyntax",
"\n",
"}",
"\n",
"v",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"line",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errTraceSyntax",
"\n",
"}",
"\n",
"if",
"v",
"<=",
"0",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"t",
".",
"line",
"=",
"v",
"\n",
"t",
".",
"file",
"=",
"file",
"\n",
"return",
"nil",
"\n",
"}"
] |
12,520 | all-12521 | [
"StatusString",
"returns",
"a",
"human",
"readable",
"string",
"representation",
"of",
"this",
"object"
] | [
"func",
"(",
"as",
"ASMAuthStatus",
")",
"<mask>",
"(",
")",
"string",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"asmAuthStatusMap",
"{",
"if",
"v",
"==",
"as",
"{",
"return",
"k",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] |
12,521 | all-12522 | [
"MasterAddr",
"returns",
"an",
"address",
"of",
"current",
"Redis",
"master",
"instance",
"."
] | [
"func",
"(",
"s",
"*",
"Sentinel",
")",
"MasterAddr",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"s",
".",
"doUntilSuccess",
"(",
"func",
"(",
"c",
"redis",
".",
"Conn",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"queryForMaster",
"(",
"c",
",",
"s",
".",
"MasterName",
")",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"(",
"string",
")",
",",
"nil",
"\n",
"}"
] |
12,522 | all-12523 | [
"Do",
"executes",
"CSS",
".",
"stopRuleUsageTracking",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"ruleUsage"
] | [
"func",
"(",
"p",
"*",
"StopRuleUsageTrackingParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"ruleUsage",
"[",
"]",
"*",
"RuleUsage",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"StopRuleUsageTrackingReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandStopRuleUsageTracking",
",",
"nil",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"<mask>",
".",
"RuleUsage",
",",
"nil",
"\n",
"}"
] |
12,523 | all-12524 | [
"New",
"creates",
"a",
"new",
"session",
".",
"Get",
"api",
"key",
"here",
":",
"https",
":",
"//",
"www",
".",
"cleverbot",
".",
"com",
"/",
"api",
"/",
"."
] | [
"func",
"New",
"(",
"yourAPIKey",
"string",
")",
"*",
"<mask>",
"{",
"values",
":=",
"&",
"url",
".",
"Values",
"{",
"}",
"\n",
"values",
".",
"Set",
"(",
"\"",
"\"",
",",
"yourAPIKey",
")",
"\n",
"values",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"return",
"&",
"Session",
"{",
"sync",
".",
"Mutex",
"{",
"}",
",",
"&",
"http",
".",
"Client",
"{",
"}",
",",
"values",
",",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
",",
"}",
"\n",
"}"
] |
12,524 | all-12525 | [
"Error",
"is",
"an",
"error",
"/",
"panic",
"handler",
"middleware",
".",
"Any",
"error",
"/",
"panic",
"is",
"recovered",
"and",
"logged",
"and",
"the",
"error",
"response",
"is",
"returned",
"to",
"the",
"user",
"(",
"auto",
"-",
"generated",
"if",
"none",
"was",
"set",
")",
"."
] | [
"func",
"Error",
"(",
"ctx",
"*",
"neptulon",
".",
"ReqCtx",
")",
"error",
"{",
"errored",
":=",
"false",
"\n\n",
"if",
"err",
":=",
"ctx",
".",
"Next",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"errored",
"=",
"true",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"recover",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"errored",
"=",
"true",
"\n",
"const",
"size",
"=",
"64",
"<<",
"10",
"\n",
"buf",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"size",
")",
"\n",
"buf",
"=",
"buf",
"[",
":",
"runtime",
".",
"Stack",
"(",
"buf",
",",
"false",
")",
"]",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"err",
",",
"buf",
")",
"\n",
"}",
"\n\n",
"if",
"errored",
"{",
"if",
"ctx",
".",
"Err",
"==",
"nil",
"{",
"ctx",
".",
"Err",
"=",
"&",
"neptulon",
".",
"ResError",
"{",
"Code",
":",
"500",
",",
"<mask>",
":",
"\"",
"\"",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"ctx",
".",
"Next",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
12,525 | all-12526 | [
"SetLevelColor",
"sets",
"the",
"color",
"for",
"each",
"level"
] | [
"func",
"(",
"g",
"*",
"Glg",
")",
"SetLevelColor",
"(",
"level",
"LEVEL",
",",
"color",
"func",
"(",
"string",
")",
"string",
")",
"*",
"Glg",
"{",
"lev",
",",
"<mask>",
":=",
"g",
".",
"logger",
".",
"Load",
"(",
"level",
")",
"\n",
"if",
"ok",
"{",
"l",
":=",
"lev",
".",
"(",
"*",
"logger",
")",
"\n",
"l",
".",
"color",
"=",
"color",
"\n",
"g",
".",
"logger",
".",
"Store",
"(",
"level",
",",
"l",
")",
"\n",
"}",
"\n\n",
"return",
"g",
"\n",
"}"
] |
12,526 | all-12527 | [
"resourceVSphereComputeClusterReadTags",
"reads",
"the",
"tags",
"for",
"vsphere_compute_cluster",
"."
] | [
"func",
"resourceVSphereComputeClusterReadTags",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"<mask>",
"{",
"}",
",",
"cluster",
"*",
"object",
".",
"ClusterComputeResource",
")",
"error",
"{",
"if",
"tagsClient",
",",
"_",
":=",
"meta",
".",
"(",
"*",
"VSphereClient",
")",
".",
"TagsClient",
"(",
")",
";",
"tagsClient",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereComputeClusterIDString",
"(",
"d",
")",
")",
"\n",
"if",
"err",
":=",
"readTagsForResource",
"(",
"tagsClient",
",",
"cluster",
",",
"d",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"else",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereComputeClusterIDString",
"(",
"d",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
12,527 | all-12528 | [
"GetSignatures",
"returns",
"the",
"image",
"s",
"signatures",
".",
"It",
"may",
"use",
"a",
"remote",
"(",
"=",
"slow",
")",
"service",
".",
"If",
"instanceDigest",
"is",
"not",
"nil",
"it",
"contains",
"a",
"digest",
"of",
"the",
"specific",
"manifest",
"instance",
"to",
"retrieve",
"signatures",
"for",
"(",
"when",
"the",
"primary",
"manifest",
"is",
"a",
"manifest",
"list",
")",
";",
"this",
"never",
"happens",
"if",
"the",
"primary",
"manifest",
"is",
"not",
"a",
"manifest",
"list",
"(",
"e",
".",
"g",
".",
"if",
"the",
"source",
"never",
"returns",
"manifest",
"lists",
")",
"."
] | [
"func",
"(",
"s",
"*",
"ociArchiveImageSource",
")",
"GetSignatures",
"(",
"ctx",
"context",
".",
"<mask>",
",",
"instanceDigest",
"*",
"digest",
".",
"Digest",
")",
"(",
"[",
"]",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"return",
"s",
".",
"unpackedSrc",
".",
"GetSignatures",
"(",
"ctx",
",",
"instanceDigest",
")",
"\n",
"}"
] |
12,528 | all-12529 | [
"UnmarshalJSON",
"satisfies",
"json",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"StyleSheetOrigin",
")",
"UnmarshalJSON",
"(",
"buf",
"[",
"]",
"<mask>",
")",
"error",
"{",
"return",
"easyjson",
".",
"Unmarshal",
"(",
"buf",
",",
"t",
")",
"\n",
"}"
] |
12,529 | all-12530 | [
"SyncConfigs",
"syncs",
"new",
"configs"
] | [
"func",
"(",
"s",
"*",
"Storage",
")",
"SyncConfigs",
"(",
"newConfigs",
"[",
"]",
"<mask>",
".",
"ResourcesConfig",
")",
"error",
"{",
"s",
".",
"configsLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"configsLock",
".",
"Unlock",
"(",
")",
"\n\n",
"currentConfigs",
",",
"err",
":=",
"s",
".",
"GetConfigs",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"currentSet",
":=",
"mapset",
".",
"NewSet",
"(",
")",
"\n",
"newSet",
":=",
"mapset",
".",
"NewSet",
"(",
")",
"\n",
"toUpdate",
":=",
"mapset",
".",
"NewSet",
"(",
")",
"\n\n",
"configs",
":=",
"map",
"[",
"string",
"]",
"common",
".",
"ResourcesConfig",
"{",
"}",
"\n\n",
"for",
"_",
",",
"c",
":=",
"range",
"currentConfigs",
"{",
"currentSet",
".",
"Add",
"(",
"c",
".",
"Name",
")",
"\n",
"configs",
"[",
"c",
".",
"Name",
"]",
"=",
"c",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"c",
":=",
"range",
"newConfigs",
"{",
"newSet",
".",
"Add",
"(",
"c",
".",
"Name",
")",
"\n",
"if",
"old",
",",
"exists",
":=",
"configs",
"[",
"c",
".",
"Name",
"]",
";",
"exists",
"{",
"if",
"!",
"reflect",
".",
"DeepEqual",
"(",
"old",
",",
"c",
")",
"{",
"toUpdate",
".",
"Add",
"(",
"c",
".",
"Name",
")",
"\n",
"configs",
"[",
"c",
".",
"Name",
"]",
"=",
"c",
"\n",
"}",
"\n",
"}",
"else",
"{",
"configs",
"[",
"c",
".",
"Name",
"]",
"=",
"c",
"\n",
"}",
"\n",
"}",
"\n\n",
"var",
"finalError",
"error",
"\n\n",
"toDelete",
":=",
"currentSet",
".",
"Difference",
"(",
"newSet",
")",
"\n",
"toAdd",
":=",
"newSet",
".",
"Difference",
"(",
"currentSet",
")",
"\n\n",
"for",
"_",
",",
"n",
":=",
"range",
"toDelete",
".",
"ToSlice",
"(",
")",
"{",
"logrus",
".",
"Infof",
"(",
"\"",
"\"",
",",
"n",
".",
"(",
"string",
")",
")",
"\n",
"if",
"err",
":=",
"s",
".",
"DeleteConfig",
"(",
"n",
".",
"(",
"string",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"n",
")",
"\n",
"finalError",
"=",
"multierror",
".",
"Append",
"(",
"finalError",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"n",
":=",
"range",
"toAdd",
".",
"ToSlice",
"(",
")",
"{",
"rc",
":=",
"configs",
"[",
"n",
".",
"(",
"string",
")",
"]",
"\n",
"logrus",
".",
"Infof",
"(",
"\"",
"\"",
",",
"n",
".",
"(",
"string",
")",
")",
"\n",
"if",
"err",
":=",
"s",
".",
"AddConfig",
"(",
"rc",
")",
";",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"n",
")",
"\n",
"finalError",
"=",
"multierror",
".",
"Append",
"(",
"finalError",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"n",
":=",
"range",
"toUpdate",
".",
"ToSlice",
"(",
")",
"{",
"rc",
":=",
"configs",
"[",
"n",
".",
"(",
"string",
")",
"]",
"\n",
"logrus",
".",
"Infof",
"(",
"\"",
"\"",
",",
"n",
".",
"(",
"string",
")",
")",
"\n",
"if",
"err",
":=",
"s",
".",
"UpdateConfig",
"(",
"rc",
")",
";",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"n",
")",
"\n",
"finalError",
"=",
"multierror",
".",
"Append",
"(",
"finalError",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"finalError",
"\n",
"}"
] |
12,530 | all-12531 | [
"RealColor",
"returns",
"attribute",
"that",
"should",
"be",
"applied",
"to",
"an",
"object",
".",
"By",
"default",
"all",
"attributes",
"equal",
"ColorDefault",
"and",
"the",
"real",
"color",
"should",
"be",
"retrieved",
"from",
"the",
"current",
"theme",
".",
"Attribute",
"selection",
"work",
"this",
"way",
":",
"if",
"color",
"is",
"not",
"ColorDefault",
"it",
"is",
"returned",
"as",
"is",
"otherwise",
"the",
"function",
"tries",
"to",
"load",
"color",
"from",
"the",
"theme",
".",
"With",
"the",
"style",
"argument",
"themes",
"may",
"be",
"grouped",
"by",
"control",
"i",
".",
"e",
"an",
"application",
"may",
"have",
"multiple",
"list",
"controls",
"where",
"they",
"all",
"share",
"the",
"same",
"theme",
"attributes",
"however",
"the",
"same",
"application",
"may",
"have",
"one",
"specific",
"list",
"control",
"with",
"some",
"different",
"theme",
"attributes",
"in",
"that",
"case",
"the",
"user",
"may",
"call",
"control",
".",
"SetStyle",
"(",
"custom",
")",
"and",
"define",
"a",
"set",
"of",
"custom",
".",
"*",
"attributes",
"i",
".",
"e",
":",
"custom",
".",
"EditBox",
"=",
"white",
"custom",
".",
"EditText",
"=",
"black",
"bold",
"...",
"clr",
"-",
"current",
"object",
"color",
"style",
"-",
"the",
"theme",
"prefix",
"style",
"set",
"id",
"-",
"color",
"ID",
"in",
"theme"
] | [
"func",
"RealColor",
"(",
"clr",
"term",
".",
"Attribute",
",",
"style",
"string",
",",
"id",
"string",
")",
"term",
".",
"Attribute",
"{",
"<mask>",
"prefix",
"string",
"\n\n",
"if",
"style",
"!=",
"\"",
"\"",
"{",
"prefix",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"style",
")",
"\n",
"}",
"\n\n",
"ccolor",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"prefix",
",",
"id",
")",
"\n\n",
"if",
"clr",
"==",
"ColorDefault",
"{",
"clr",
"=",
"SysColor",
"(",
"ccolor",
")",
"\n",
"}",
"\n\n",
"if",
"clr",
"==",
"ColorDefault",
"{",
"panic",
"(",
"\"",
"\"",
"+",
"ccolor",
")",
"\n",
"}",
"\n\n",
"return",
"clr",
"\n",
"}"
] |
12,531 | all-12532 | [
"newDockerClientFromRef",
"returns",
"a",
"new",
"dockerClient",
"instance",
"for",
"refHostname",
"(",
"a",
"host",
"a",
"specified",
"in",
"the",
"Docker",
"image",
"reference",
"not",
"canonicalized",
"to",
"dockerRegistry",
")",
"“write”",
"specifies",
"whether",
"the",
"client",
"will",
"be",
"used",
"for",
"write",
"access",
"(",
"in",
"particular",
"passed",
"to",
"lookaside",
".",
"go",
":",
"toplevelFromSection",
")"
] | [
"func",
"newDockerClientFromRef",
"(",
"sys",
"*",
"types",
".",
"SystemContext",
",",
"ref",
"dockerReference",
",",
"write",
"bool",
",",
"actions",
"string",
")",
"(",
"*",
"dockerClient",
",",
"error",
")",
"{",
"registry",
":=",
"reference",
".",
"Domain",
"(",
"ref",
".",
"ref",
")",
"\n",
"username",
",",
"password",
",",
"err",
":=",
"config",
".",
"GetAuthentication",
"(",
"sys",
",",
"registry",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"sigBase",
",",
"err",
":=",
"configuredSignatureStorageBase",
"(",
"sys",
",",
"ref",
",",
"write",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"client",
",",
"err",
":=",
"newDockerClient",
"(",
"sys",
",",
"registry",
",",
"<mask>",
".",
"ref",
".",
"Name",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"client",
".",
"username",
"=",
"username",
"\n",
"client",
".",
"password",
"=",
"password",
"\n",
"client",
".",
"signatureBase",
"=",
"sigBase",
"\n",
"client",
".",
"scope",
".",
"actions",
"=",
"actions",
"\n",
"client",
".",
"scope",
".",
"remoteName",
"=",
"reference",
".",
"Path",
"(",
"ref",
".",
"ref",
")",
"\n",
"return",
"client",
",",
"nil",
"\n",
"}"
] |
12,532 | all-12533 | [
"ResolveValue",
"resolves",
"a",
"PlanValue",
"as",
"a",
"single",
"value",
"based",
"on",
"the",
"supplied",
"bindvars",
"."
] | [
"func",
"(",
"pv",
"PlanValue",
")",
"ResolveValue",
"(",
"bindVars",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
")",
"(",
"Value",
",",
"error",
")",
"{",
"switch",
"{",
"case",
"pv",
".",
"Key",
"!=",
"\"",
"\"",
":",
"bv",
",",
"err",
":=",
"pv",
".",
"lookupValue",
"(",
"bindVars",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"NULL",
",",
"err",
"\n",
"}",
"\n",
"return",
"MakeTrusted",
"(",
"bv",
".",
"Type",
",",
"bv",
".",
"Value",
")",
",",
"nil",
"\n",
"case",
"!",
"pv",
".",
"Value",
".",
"IsNull",
"(",
")",
":",
"return",
"pv",
".",
"Value",
",",
"nil",
"\n",
"case",
"pv",
".",
"ListKey",
"!=",
"\"",
"\"",
"||",
"pv",
".",
"Values",
"!=",
"nil",
":",
"// This code is unreachable because the parser does not allow",
"// multi-value constructs where a single value is expected.",
"return",
"NULL",
",",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"NULL",
",",
"nil",
"\n",
"}"
] |
12,533 | all-12534 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"QuerySelectorAllReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom21",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
12,534 | all-12535 | [
"RoundedRectangle",
"draws",
"a",
"rectangle",
"using",
"a",
"path",
"between",
"(",
"x1",
"y1",
")",
"and",
"(",
"x2",
"y2",
")"
] | [
"func",
"RoundedRectangle",
"(",
"path",
"draw2d",
".",
"PathBuilder",
",",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
",",
"arcWidth",
",",
"arcHeight",
"float64",
")",
"{",
"arcWidth",
"=",
"arcWidth",
"/",
"2",
"\n",
"arcHeight",
"=",
"arcHeight",
"/",
"2",
"\n",
"path",
".",
"MoveTo",
"(",
"x1",
",",
"y1",
"+",
"arcHeight",
")",
"\n",
"path",
".",
"QuadCurveTo",
"(",
"x1",
",",
"y1",
",",
"x1",
"+",
"arcWidth",
",",
"y1",
")",
"\n",
"path",
".",
"LineTo",
"(",
"x2",
"-",
"arcWidth",
",",
"y1",
")",
"\n",
"path",
".",
"QuadCurveTo",
"(",
"x2",
",",
"y1",
",",
"x2",
",",
"y1",
"+",
"arcHeight",
")",
"\n",
"<mask>",
".",
"LineTo",
"(",
"x2",
",",
"y2",
"-",
"arcHeight",
")",
"\n",
"path",
".",
"QuadCurveTo",
"(",
"x2",
",",
"y2",
",",
"x2",
"-",
"arcWidth",
",",
"y2",
")",
"\n",
"path",
".",
"LineTo",
"(",
"x1",
"+",
"arcWidth",
",",
"y2",
")",
"\n",
"path",
".",
"QuadCurveTo",
"(",
"x1",
",",
"y2",
",",
"x1",
",",
"y2",
"-",
"arcHeight",
")",
"\n",
"path",
".",
"Close",
"(",
")",
"\n",
"}"
] |
12,535 | all-12536 | [
"WriteTo",
"and",
"ReadFrom",
"avoid",
"intermediate",
"allocation",
"and",
"copies",
".",
"WriteTo",
"avoids",
"intermediate",
"allocation",
"and",
"copies",
".",
"WriteTo",
"writes",
"data",
"to",
"w",
"until",
"there",
"s",
"no",
"more",
"data",
"to",
"write",
"or",
"when",
"an",
"error",
"occurs",
".",
"The",
"return",
"value",
"n",
"is",
"the",
"number",
"of",
"bytes",
"written",
".",
"Any",
"error",
"encountered",
"during",
"the",
"write",
"is",
"also",
"returned",
"."
] | [
"func",
"(",
"b",
"*",
"FixedSizeRingBuf",
")",
"WriteTo",
"(",
"w",
"<mask>",
".",
"Writer",
")",
"(",
"n",
"int64",
",",
"err",
"error",
")",
"{",
"if",
"b",
".",
"Readable",
"==",
"0",
"{",
"return",
"0",
",",
"io",
".",
"EOF",
"\n",
"}",
"\n\n",
"extent",
":=",
"b",
".",
"Beg",
"+",
"b",
".",
"Readable",
"\n",
"firstWriteLen",
":=",
"intMin",
"(",
"extent",
",",
"b",
".",
"N",
")",
"-",
"b",
".",
"Beg",
"\n",
"secondWriteLen",
":=",
"b",
".",
"Readable",
"-",
"firstWriteLen",
"\n",
"if",
"firstWriteLen",
">",
"0",
"{",
"m",
",",
"e",
":=",
"w",
".",
"Write",
"(",
"b",
".",
"A",
"[",
"b",
".",
"Use",
"]",
"[",
"b",
".",
"Beg",
":",
"(",
"b",
".",
"Beg",
"+",
"firstWriteLen",
")",
"]",
")",
"\n",
"n",
"+=",
"int64",
"(",
"m",
")",
"\n",
"b",
".",
"Advance",
"(",
"m",
")",
"\n\n",
"if",
"e",
"!=",
"nil",
"{",
"return",
"n",
",",
"e",
"\n",
"}",
"\n",
"// all bytes should have been written, by definition of",
"// Write method in io.Writer",
"if",
"m",
"!=",
"firstWriteLen",
"{",
"return",
"n",
",",
"io",
".",
"ErrShortWrite",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"secondWriteLen",
">",
"0",
"{",
"m",
",",
"e",
":=",
"w",
".",
"Write",
"(",
"b",
".",
"A",
"[",
"b",
".",
"Use",
"]",
"[",
"0",
":",
"secondWriteLen",
"]",
")",
"\n",
"n",
"+=",
"int64",
"(",
"m",
")",
"\n",
"b",
".",
"Advance",
"(",
"m",
")",
"\n\n",
"if",
"e",
"!=",
"nil",
"{",
"return",
"n",
",",
"e",
"\n",
"}",
"\n",
"// all bytes should have been written, by definition of",
"// Write method in io.Writer",
"if",
"m",
"!=",
"secondWriteLen",
"{",
"return",
"n",
",",
"io",
".",
"ErrShortWrite",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"n",
",",
"nil",
"\n",
"}"
] |
12,536 | all-12537 | [
"Has",
"checks",
"if",
"the",
"given",
"key",
"is",
"set",
"."
] | [
"func",
"(",
"b",
"*",
"Bag",
")",
"Has",
"(",
"key",
"string",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"(",
"*",
"b",
")",
"[",
"<mask>",
"]",
"\n\n",
"return",
"ok",
"\n",
"}"
] |
12,537 | all-12538 | [
"newIssuePathFromAbsPath",
"returns",
"a",
"new",
"issuePath",
"from",
"a",
"path",
"that",
"may",
"be",
"an",
"absolute",
"path",
".",
"root",
"must",
"be",
"an",
"absolute",
"path",
"."
] | [
"func",
"newIssuePathFromAbsPath",
"(",
"root",
",",
"path",
"string",
")",
"(",
"IssuePath",
",",
"error",
")",
"{",
"resolvedRoot",
",",
"err",
":=",
"filepath",
".",
"EvalSymlinks",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"newIssuePath",
"(",
"root",
",",
"path",
")",
",",
"err",
"\n",
"}",
"\n\n",
"resolvedPath",
",",
"err",
":=",
"filepath",
".",
"EvalSymlinks",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"newIssuePath",
"(",
"root",
",",
"path",
")",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"!",
"filepath",
".",
"IsAbs",
"(",
"path",
")",
"{",
"return",
"newIssuePath",
"(",
"resolvedRoot",
",",
"resolvedPath",
")",
",",
"nil",
"\n",
"}",
"\n\n",
"relPath",
",",
"err",
":=",
"filepath",
".",
"Rel",
"(",
"resolvedRoot",
",",
"resolvedPath",
")",
"\n",
"return",
"newIssuePath",
"(",
"resolvedRoot",
",",
"relPath",
")",
",",
"err",
"\n",
"}"
] |
12,538 | all-12539 | [
"Delete",
"an",
"item",
"from",
"the",
"cache",
".",
"Does",
"nothing",
"if",
"the",
"key",
"is",
"not",
"in",
"the",
"cache",
"."
] | [
"func",
"(",
"c",
"*",
"cache",
")",
"Delete",
"(",
"k",
"string",
")",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"v",
",",
"evicted",
":=",
"c",
".",
"<mask>",
"(",
"k",
")",
"\n",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"evicted",
"{",
"c",
".",
"onEvicted",
"(",
"k",
",",
"v",
")",
"\n",
"}",
"\n",
"}"
] |
12,539 | all-12540 | [
"creates",
"new",
"mask",
"attached",
"to",
"svg"
] | [
"func",
"(",
"gc",
"*",
"GraphicContext",
")",
"newMask",
"(",
"x",
",",
"y",
",",
"width",
",",
"height",
"int",
")",
"*",
"Mask",
"{",
"mask",
":=",
"&",
"Mask",
"{",
"}",
"\n",
"mask",
".",
"X",
"=",
"float64",
"(",
"x",
")",
"\n",
"mask",
".",
"Y",
"=",
"float64",
"(",
"y",
")",
"\n",
"mask",
".",
"Width",
"=",
"toSvgLength",
"(",
"float64",
"(",
"<mask>",
")",
")",
"\n",
"mask",
".",
"Height",
"=",
"toSvgLength",
"(",
"float64",
"(",
"height",
")",
")",
"\n\n",
"// attach mask",
"gc",
".",
"svg",
".",
"Masks",
"=",
"append",
"(",
"gc",
".",
"svg",
".",
"Masks",
",",
"mask",
")",
"\n",
"mask",
".",
"Id",
"=",
"\"",
"\"",
"+",
"strconv",
".",
"Itoa",
"(",
"len",
"(",
"gc",
".",
"svg",
".",
"Masks",
")",
")",
"\n",
"return",
"mask",
"\n",
"}"
] |
12,540 | all-12541 | [
"Send",
"sends",
"the",
"unban",
"request",
"."
] | [
"func",
"(",
"ub",
"*",
"OutgoingUnbanChatMember",
")",
"Send",
"(",
")",
"error",
"{",
"resp",
":=",
"&",
"baseResponse",
"{",
"}",
"\n",
"_",
",",
"err",
":=",
"ub",
".",
"api",
".",
"c",
".",
"postJSON",
"(",
"unbanChatMember",
",",
"resp",
",",
"ub",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"(",
"resp",
")",
"\n",
"}"
] |
12,541 | all-12542 | [
"AddedProperty",
"adds",
"a",
"new",
"added",
"job",
"property",
"to",
"the",
"list",
"of",
"differences"
] | [
"func",
"(",
"dj",
"*",
"DeltaJob",
")",
"AddedProperty",
"(",
"<mask>",
"string",
",",
"p",
"*",
"enaml",
".",
"JobManifestProperty",
")",
"{",
"dj",
".",
"AddedProperties",
"[",
"name",
"]",
"=",
"*",
"p",
"\n",
"}"
] |
12,542 | all-12543 | [
"Enable",
"the",
"delivery",
"of",
"debug",
"messages",
"to",
"the",
"logger",
".",
"Only",
"meaningful",
"if",
"a",
"logger",
"is",
"also",
"set",
"."
] | [
"func",
"SetDebug",
"(",
"debug",
"bool",
")",
"{",
"if",
"raceDetector",
"{",
"globalMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"globalMutex",
".",
"Unlock",
"(",
")",
"\n",
"}",
"\n",
"globalDebug",
"=",
"<mask>",
"\n",
"}"
] |
12,543 | all-12544 | [
"LayerInfos",
"returns",
"a",
"list",
"of",
"LayerInfos",
"of",
"layers",
"referenced",
"by",
"this",
"image",
"in",
"order",
"(",
"the",
"root",
"layer",
"first",
"and",
"then",
"successive",
"layered",
"layers",
")",
".",
"The",
"Digest",
"field",
"is",
"guaranteed",
"to",
"be",
"provided",
";",
"Size",
"may",
"be",
"-",
"1",
".",
"WARNING",
":",
"The",
"list",
"may",
"contain",
"duplicates",
"and",
"they",
"are",
"semantically",
"relevant",
"."
] | [
"func",
"(",
"m",
"*",
"OCI1",
")",
"LayerInfos",
"(",
")",
"[",
"]",
"LayerInfo",
"{",
"blobs",
":=",
"[",
"]",
"LayerInfo",
"{",
"}",
"\n",
"for",
"_",
",",
"layer",
":=",
"range",
"m",
".",
"Layers",
"{",
"blobs",
"=",
"append",
"(",
"blobs",
",",
"LayerInfo",
"{",
"BlobInfo",
":",
"BlobInfoFromOCI1Descriptor",
"(",
"layer",
")",
",",
"EmptyLayer",
":",
"<mask>",
",",
"}",
")",
"\n",
"}",
"\n",
"return",
"blobs",
"\n",
"}"
] |
12,544 | all-12545 | [
"ApplyChanges",
"applies",
"a",
"given",
"set",
"of",
"changes"
] | [
"func",
"(",
"p",
"*",
"dnsimpleProvider",
")",
"ApplyChanges",
"(",
"<mask>",
"*",
"plan",
".",
"Changes",
")",
"error",
"{",
"combinedChanges",
":=",
"make",
"(",
"[",
"]",
"*",
"dnsimpleChange",
",",
"0",
",",
"len",
"(",
"changes",
".",
"Create",
")",
"+",
"len",
"(",
"changes",
".",
"UpdateNew",
")",
"+",
"len",
"(",
"changes",
".",
"Delete",
")",
")",
"\n\n",
"combinedChanges",
"=",
"append",
"(",
"combinedChanges",
",",
"newDnsimpleChanges",
"(",
"dnsimpleCreate",
",",
"changes",
".",
"Create",
")",
"...",
")",
"\n",
"combinedChanges",
"=",
"append",
"(",
"combinedChanges",
",",
"newDnsimpleChanges",
"(",
"dnsimpleUpdate",
",",
"changes",
".",
"UpdateNew",
")",
"...",
")",
"\n",
"combinedChanges",
"=",
"append",
"(",
"combinedChanges",
",",
"newDnsimpleChanges",
"(",
"dnsimpleDelete",
",",
"changes",
".",
"Delete",
")",
"...",
")",
"\n\n",
"return",
"p",
".",
"submitChanges",
"(",
"combinedChanges",
")",
"\n",
"}"
] |
12,545 | all-12546 | [
"IntRange",
"param",
"must",
"be",
"a",
"integer",
"and",
"range",
"is",
"[",
"n",
"m",
"]"
] | [
"func",
"(",
"c",
"*",
"Controller",
")",
"IntRange",
"(",
"fieldName",
"string",
",",
"p",
"interface",
"{",
"}",
",",
"n",
"int",
",",
"m",
"int",
")",
"int",
"{",
"if",
"p",
"==",
"nil",
"{",
"p",
"=",
"0",
"\n",
"}",
"\n",
"value",
",",
"ok",
":=",
"c",
".",
"toNumber",
"(",
"p",
")",
"\n\n",
"if",
"<mask>",
"==",
"false",
"{",
"panic",
"(",
"(",
"&",
"ValidationError",
"{",
"}",
")",
".",
"New",
"(",
"fieldName",
"+",
"\"",
"",
"",
"",
"\n",
"}",
"\n",
"b",
":=",
"c",
".",
"Validate",
".",
"Range",
"(",
"value",
",",
"n",
",",
"m",
")",
"\n",
"if",
"b",
"==",
"false",
"{",
"panic",
"(",
"(",
"&",
"ValidationError",
"{",
"}",
")",
".",
"New",
"(",
"fieldName",
"+",
"\"",
"o",
"(",
") + \" 到",
" ",
"\" + ",
"s",
"t",
"r",
"o",
"v",
"(",
")",
")",
"",
"",
"",
"",
"",
"",
"",
"\n",
"}",
"\n",
"return",
"value",
"\n",
"}"
] |
12,546 | all-12547 | [
"Per",
"the",
"spec",
"in",
"BEP",
"5",
"."
] | [
"func",
"(",
"n",
"*",
"node",
")",
"IsGood",
"(",
")",
"bool",
"{",
"if",
"n",
".",
"id",
".",
"IsZero",
"(",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"time",
".",
"Since",
"(",
"n",
".",
"lastGotResponse",
")",
"<",
"15",
"*",
"time",
".",
"Minute",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"!",
"n",
".",
"lastGotResponse",
".",
"IsZero",
"(",
")",
"&&",
"time",
".",
"Since",
"(",
"n",
".",
"lastGotQuery",
")",
"<",
"15",
"*",
"<mask>",
".",
"Minute",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
12,547 | all-12548 | [
"NewLinodeProvider",
"initializes",
"a",
"new",
"Linode",
"DNS",
"based",
"Provider",
"."
] | [
"func",
"NewLinodeProvider",
"(",
"domainFilter",
"DomainFilter",
",",
"dryRun",
"bool",
",",
"appVersion",
"string",
")",
"(",
"*",
"LinodeProvider",
",",
"error",
")",
"{",
"token",
",",
"ok",
":=",
"os",
".",
"LookupEnv",
"(",
"\"",
"\"",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"tokenSource",
":=",
"oauth2",
".",
"StaticTokenSource",
"(",
"&",
"oauth2",
".",
"Token",
"{",
"AccessToken",
":",
"token",
"}",
")",
"\n\n",
"oauth2Client",
":=",
"&",
"http",
".",
"Client",
"{",
"Transport",
":",
"&",
"oauth2",
".",
"Transport",
"{",
"Source",
":",
"tokenSource",
",",
"}",
",",
"}",
"\n\n",
"linodeClient",
":=",
"linodego",
".",
"NewClient",
"(",
"oauth2Client",
")",
"\n",
"linodeClient",
".",
"SetUserAgent",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"appVersion",
",",
"linodego",
".",
"Version",
")",
")",
"\n\n",
"provider",
":=",
"&",
"LinodeProvider",
"{",
"<mask>",
":",
"&",
"linodeClient",
",",
"domainFilter",
":",
"domainFilter",
",",
"DryRun",
":",
"dryRun",
",",
"}",
"\n",
"return",
"provider",
",",
"nil",
"\n",
"}"
] |
12,548 | all-12549 | [
"CreateDatabase",
"for",
"the",
"MySQLConfig"
] | [
"func",
"(",
"config",
"*",
"MySQLConfig",
")",
"CreateDatabase",
"(",
")",
"(",
"*",
"gorm",
".",
"DB",
",",
"error",
")",
"{",
"db",
",",
"err",
":=",
"gorm",
".",
"Open",
"(",
"\"",
"\"",
",",
"config",
".",
"getDSN",
"(",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"db",
".",
"Exec",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"config",
".",
"Db",
")",
")",
"\n",
"<mask>",
".",
"Close",
"(",
")",
"\n\n",
"db",
",",
"err",
"=",
"gorm",
".",
"Open",
"(",
"\"",
"\"",
",",
"config",
".",
"getDSN",
"(",
"config",
".",
"Db",
")",
")",
"\n",
"err",
"=",
"db",
".",
"AutoMigrate",
"(",
"&",
"Assignee",
"{",
"}",
",",
"&",
"Issue",
"{",
"}",
",",
"&",
"IssueEvent",
"{",
"}",
",",
"&",
"Label",
"{",
"}",
",",
"&",
"Comment",
"{",
"}",
")",
".",
"Error",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"db",
",",
"nil",
"\n",
"}"
] |
12,549 | all-12550 | [
"IsMember",
"returns",
"whether",
"or",
"not",
"the",
"user",
"is",
"a",
"member",
"of",
"the",
"org",
".",
"See",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"orgs",
"/",
"members",
"/",
"#check",
"-",
"membership"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"IsMember",
"(",
"org",
",",
"user",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"org",
",",
"user",
")",
"\n",
"if",
"org",
"==",
"user",
"{",
"// Make it possible to run a couple of plugins on personal repos.",
"return",
"<mask>",
",",
"nil",
"\n",
"}",
"\n",
"code",
",",
"err",
":=",
"c",
".",
"request",
"(",
"&",
"request",
"{",
"method",
":",
"http",
".",
"MethodGet",
",",
"path",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"user",
")",
",",
"exitCodes",
":",
"[",
"]",
"int",
"{",
"204",
",",
"404",
",",
"302",
"}",
",",
"}",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n",
"if",
"code",
"==",
"204",
"{",
"return",
"true",
",",
"nil",
"\n",
"}",
"else",
"if",
"code",
"==",
"404",
"{",
"return",
"false",
",",
"nil",
"\n",
"}",
"else",
"if",
"code",
"==",
"302",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"org",
")",
"\n",
"}",
"\n",
"// Should be unreachable.",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"code",
")",
"\n",
"}"
] |
12,550 | all-12551 | [
"Pipe",
"pipes",
"s",
"through",
"one",
"or",
"more",
"string",
"filters",
"."
] | [
"func",
"Pipe",
"(",
"s",
"string",
",",
"funcs",
"...",
"func",
"(",
"string",
")",
"string",
")",
"string",
"{",
"for",
"_",
",",
"fn",
":=",
"<mask>",
"funcs",
"{",
"s",
"=",
"fn",
"(",
"s",
")",
"\n",
"}",
"\n",
"return",
"s",
"\n",
"}"
] |
12,551 | all-12552 | [
"setCursorPosition",
"sets",
"the",
"cursor",
"to",
"the",
"specified",
"position",
"bounded",
"to",
"the",
"screen",
"size"
] | [
"func",
"(",
"h",
"*",
"windowsAnsiEventHandler",
")",
"setCursorPosition",
"(",
"position",
"COORD",
",",
"window",
"SMALL_RECT",
")",
"error",
"{",
"position",
".",
"X",
"=",
"ensureInRange",
"(",
"position",
".",
"X",
",",
"window",
".",
"Left",
",",
"window",
".",
"Right",
")",
"\n",
"position",
".",
"Y",
"=",
"ensureInRange",
"(",
"position",
".",
"Y",
",",
"window",
".",
"Top",
",",
"window",
".",
"Bottom",
")",
"\n",
"err",
":=",
"SetConsoleCursorPosition",
"(",
"h",
".",
"fd",
",",
"position",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"h",
".",
"logf",
"(",
"\"",
"\"",
",",
"position",
".",
"X",
",",
"<mask>",
".",
"Y",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
12,552 | all-12553 | [
"flush",
"copies",
"focused",
"window",
"backing",
"store",
"onto",
"the",
"physical",
"screen",
".",
"flush",
"shall",
"be",
"called",
"from",
"queue",
"context",
"."
] | [
"func",
"flush",
"(",
")",
"{",
"if",
"<mask>",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"for",
"y",
":=",
"0",
";",
"y",
"<",
"focus",
".",
"y",
";",
"y",
"++",
"{",
"for",
"x",
":=",
"0",
";",
"x",
"<",
"focus",
".",
"x",
";",
"x",
"++",
"{",
"c",
":=",
"focus",
".",
"getCell",
"(",
"x",
",",
"y",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"// out of range, should not happen",
"continue",
"\n",
"}",
"\n",
"if",
"!",
"c",
".",
"dirty",
"{",
"// skip unchanged cells",
"continue",
"\n",
"}",
"\n",
"c",
".",
"dirty",
"=",
"false",
"\n\n",
"// this shall be the only spot where",
"// termbox.SetCell is called!",
"termbox",
".",
"SetCell",
"(",
"x",
",",
"y",
",",
"c",
".",
"Ch",
",",
"c",
".",
"Fg",
",",
"c",
".",
"Bg",
")",
"\n",
"}",
"\n",
"}",
"\n",
"_",
"=",
"termbox",
".",
"Flush",
"(",
")",
"\n",
"}"
] |
12,553 | all-12554 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"ExecuteSQLParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase3",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
12,554 | all-12555 | [
"url",
"returns",
"a",
"parsed",
"url",
"to",
"the",
"given",
"path",
".",
"c",
"must",
"not",
"be",
"nil"
] | [
"func",
"(",
"b",
"*",
"Bucket",
")",
"url",
"(",
"bPath",
"string",
",",
"c",
"*",
"Config",
")",
"(",
"*",
"url",
".",
"URL",
",",
"error",
")",
"{",
"// parse versionID parameter from path, if included",
"// See https://github.com/rlmcpherson/s3gof3r/issues/84 for rationale",
"purl",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"bPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"<mask>",
"vals",
"url",
".",
"Values",
"\n",
"if",
"v",
":=",
"purl",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"versionParam",
")",
";",
"v",
"!=",
"\"",
"\"",
"{",
"vals",
"=",
"make",
"(",
"url",
".",
"Values",
")",
"\n",
"vals",
".",
"Add",
"(",
"versionParam",
",",
"v",
")",
"\n",
"bPath",
"=",
"strings",
".",
"Split",
"(",
"bPath",
",",
"\"",
"\"",
")",
"[",
"0",
"]",
"// remove versionID from path",
"\n",
"}",
"\n\n",
"// handling for bucket names containing periods / explicit PathStyle addressing",
"// http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html for details",
"if",
"strings",
".",
"Contains",
"(",
"b",
".",
"Name",
",",
"\"",
"\"",
")",
"||",
"c",
".",
"PathStyle",
"{",
"return",
"&",
"url",
".",
"URL",
"{",
"Host",
":",
"b",
".",
"S3",
".",
"Domain",
",",
"Scheme",
":",
"c",
".",
"Scheme",
",",
"Path",
":",
"path",
".",
"Clean",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"b",
".",
"Name",
",",
"bPath",
")",
")",
",",
"RawQuery",
":",
"vals",
".",
"Encode",
"(",
")",
",",
"}",
",",
"nil",
"\n",
"}",
"else",
"{",
"return",
"&",
"url",
".",
"URL",
"{",
"Scheme",
":",
"c",
".",
"Scheme",
",",
"Path",
":",
"path",
".",
"Clean",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"bPath",
")",
")",
",",
"Host",
":",
"path",
".",
"Clean",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"b",
".",
"Name",
",",
"b",
".",
"S3",
".",
"Domain",
")",
")",
",",
"RawQuery",
":",
"vals",
".",
"Encode",
"(",
")",
",",
"}",
",",
"nil",
"\n",
"}",
"\n",
"}"
] |
12,555 | all-12556 | [
"secretsFunc",
"returns",
"or",
"accumulates",
"a",
"list",
"of",
"secret",
"dependencies",
"from",
"Vault",
"."
] | [
"func",
"secretsFunc",
"(",
"b",
"*",
"Brain",
",",
"used",
",",
"missing",
"*",
"dep",
".",
"Set",
")",
"func",
"(",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"return",
"func",
"(",
"s",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"<mask>",
"result",
"[",
"]",
"string",
"\n\n",
"if",
"len",
"(",
"s",
")",
"==",
"0",
"{",
"return",
"result",
",",
"nil",
"\n",
"}",
"\n\n",
"d",
",",
"err",
":=",
"dep",
".",
"NewVaultListQuery",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"used",
".",
"Add",
"(",
"d",
")",
"\n\n",
"if",
"value",
",",
"ok",
":=",
"b",
".",
"Recall",
"(",
"d",
")",
";",
"ok",
"{",
"result",
"=",
"value",
".",
"(",
"[",
"]",
"string",
")",
"\n",
"return",
"result",
",",
"nil",
"\n",
"}",
"\n\n",
"missing",
".",
"Add",
"(",
"d",
")",
"\n\n",
"return",
"result",
",",
"nil",
"\n",
"}",
"\n",
"}"
] |
12,556 | all-12557 | [
"GetPadding",
"is",
"a",
"wrapper",
"around",
"gtk_misc_get_padding",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Misc",
")",
"GetPadding",
"(",
")",
"(",
"xpad",
",",
"ypad",
"int",
")",
"{",
"<mask>",
"x",
",",
"y",
"C",
".",
"gint",
"\n",
"C",
".",
"gtk_misc_get_padding",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"x",
",",
"&",
"y",
")",
"\n",
"return",
"int",
"(",
"x",
")",
",",
"int",
"(",
"y",
")",
"\n",
"}"
] |
12,557 | all-12558 | [
"Load",
"creates",
"a",
"new",
"configuration",
"Map",
"with",
"the",
"given",
"schema",
"and",
"initial",
"values",
".",
"It",
"is",
"meant",
"to",
"be",
"called",
"with",
"a",
"set",
"of",
"initial",
"values",
"that",
"were",
"set",
"at",
"a",
"previous",
"time",
"and",
"persisted",
"to",
"some",
"storage",
"like",
"a",
"database",
".",
"If",
"one",
"or",
"more",
"keys",
"fail",
"to",
"be",
"loaded",
"return",
"an",
"ErrorList",
"describing",
"what",
"went",
"wrong",
".",
"Non",
"-",
"failing",
"keys",
"are",
"still",
"loaded",
"in",
"the",
"returned",
"Map",
"."
] | [
"func",
"Load",
"(",
"schema",
"Schema",
",",
"values",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"Map",
",",
"error",
")",
"{",
"m",
":=",
"Map",
"{",
"schema",
":",
"schema",
",",
"}",
"\n\n",
"// Populate the initial values.",
"_",
",",
"err",
":=",
"m",
".",
"<mask>",
"(",
"values",
")",
"\n",
"return",
"m",
",",
"err",
"\n",
"}"
] |
12,558 | all-12559 | [
"handleSingleMessage",
"acks",
"the",
"message",
"received"
] | [
"func",
"(",
"handler",
"*",
"attachENIHandler",
")",
"handleSingleMessage",
"(",
"message",
"*",
"ecsacs",
".",
"AttachTaskNetworkInterfacesMessage",
")",
"error",
"{",
"receivedAt",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"// Validate fields in the message",
"if",
"err",
":=",
"validateAttachTaskNetworkInterfacesMessage",
"(",
"message",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Send ACK",
"go",
"func",
"(",
"clusterArn",
"*",
"string",
",",
"containerInstanceArn",
"*",
"string",
",",
"messageID",
"*",
"string",
")",
"{",
"if",
"err",
":=",
"handler",
".",
"acsClient",
".",
"MakeRequest",
"(",
"&",
"ecsacs",
".",
"AckRequest",
"{",
"Cluster",
":",
"clusterArn",
",",
"ContainerInstance",
":",
"containerInstanceArn",
",",
"MessageId",
":",
"messageID",
",",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"aws",
".",
"StringValue",
"(",
"messageID",
")",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"(",
"message",
".",
"ClusterArn",
",",
"message",
".",
"ContainerInstanceArn",
",",
"message",
".",
"MessageId",
")",
"\n\n",
"// Check if this is a duplicate message",
"mac",
":=",
"aws",
".",
"StringValue",
"(",
"message",
".",
"ElasticNetworkInterfaces",
"[",
"0",
"]",
".",
"MacAddress",
")",
"\n",
"if",
"eniAttachment",
",",
"ok",
":=",
"handler",
".",
"state",
".",
"ENIByMac",
"(",
"mac",
")",
";",
"<mask>",
"{",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"mac",
")",
"\n",
"eniAckTimeoutHandler",
":=",
"ackTimeoutHandler",
"{",
"mac",
":",
"mac",
",",
"state",
":",
"handler",
".",
"state",
"}",
"\n",
"return",
"eniAttachment",
".",
"StartTimer",
"(",
"eniAckTimeoutHandler",
".",
"handle",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"handler",
".",
"addENIAttachmentToState",
"(",
"message",
",",
"receivedAt",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"handler",
".",
"saver",
".",
"Save",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
12,559 | all-12560 | [
"GetInt",
"is",
"a",
"wrapper",
"around",
"g_settings_get_int",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Settings",
")",
"GetInt",
"(",
"<mask>",
"string",
")",
"int",
"{",
"cstr1",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"name",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr1",
")",
")",
"\n\n",
"return",
"int",
"(",
"C",
".",
"g_settings_get_int",
"(",
"v",
".",
"native",
"(",
")",
",",
"cstr1",
")",
")",
"\n",
"}"
] |
12,560 | all-12561 | [
"DeleteMaintenanceWindowByCID",
"deletes",
"maintenance",
"[",
"window",
"]",
"with",
"passed",
"cid",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"DeleteMaintenanceWindowByCID",
"(",
"cid",
"CIDType",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"cid",
"==",
"nil",
"||",
"*",
"cid",
"==",
"\"",
"\"",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"maintenanceCID",
":=",
"string",
"(",
"*",
"cid",
")",
"\n\n",
"matched",
",",
"err",
":=",
"regexp",
".",
"MatchString",
"(",
"config",
".",
"MaintenanceCIDRegex",
",",
"maintenanceCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"<mask>",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"maintenanceCID",
")",
"\n",
"}",
"\n\n",
"_",
",",
"err",
"=",
"a",
".",
"Delete",
"(",
"maintenanceCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"true",
",",
"nil",
"\n",
"}"
] |
12,561 | all-12562 | [
"Write",
"serializes",
"the",
"command",
"to",
"the",
"given",
"buffered",
"output",
"satisfies",
"the",
"Command",
"interface",
"."
] | [
"func",
"(",
"c",
"Sub",
")",
"Write",
"(",
"w",
"*",
"bufio",
".",
"Writer",
")",
"(",
"err",
"error",
")",
"{",
"for",
"_",
",",
"s",
":=",
"range",
"[",
"...",
"]",
"string",
"{",
"\"",
"\"",
",",
"c",
".",
"Topic",
",",
"\"",
"\"",
",",
"c",
".",
"Channel",
",",
"\"",
"\\n",
"\"",
",",
"}",
"{",
"if",
"_",
",",
"err",
"=",
"w",
".",
"WriteString",
"(",
"s",
")",
";",
"err",
"!=",
"nil",
"{",
"err",
"=",
"<mask>",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
12,562 | all-12563 | [
"DeleteProjectCard",
"deletes",
"the",
"project",
"card",
"of",
"a",
"specific",
"issue",
"or",
"PR",
"See",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"projects",
"/",
"cards",
"/",
"#delete",
"-",
"a",
"-",
"project",
"-",
"card"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteProjectCard",
"(",
"projectCardID",
"int",
")",
"error",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"projectCardID",
")",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"request",
"(",
"&",
"request",
"{",
"method",
":",
"<mask>",
".",
"MethodDelete",
",",
"accept",
":",
"\"",
"\"",
",",
"// allow the description field -- https://developer.github.com/changes/2018-02-22-label-description-search-preview/",
"path",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"projectCardID",
")",
",",
"exitCodes",
":",
"[",
"]",
"int",
"{",
"204",
"}",
",",
"}",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
12,563 | all-12564 | [
"SetLastError",
"sets",
"the",
"current",
"error",
"seen",
"by",
"the",
"recording",
"rule",
"."
] | [
"func",
"(",
"rule",
"*",
"RecordingRule",
")",
"SetLastError",
"(",
"err",
"error",
")",
"{",
"<mask>",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"rule",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n",
"rule",
".",
"lastError",
"=",
"err",
"\n",
"}"
] |
12,564 | all-12565 | [
"In",
"the",
"0",
".",
"1",
".",
"0",
"=",
">",
"0",
".",
"2",
".",
"0",
"transition",
"the",
"JSON",
"representation",
"of",
"machines",
"changed",
"from",
"a",
"flat",
"to",
"a",
"more",
"nested",
"structure",
"for",
"various",
"options",
"and",
"configuration",
"settings",
".",
"To",
"preserve",
"compatibility",
"with",
"existing",
"machines",
"these",
"migration",
"functions",
"have",
"been",
"introduced",
".",
"They",
"preserve",
"backwards",
"compat",
"at",
"the",
"expense",
"of",
"some",
"duplicated",
"information",
".",
"MigrateHostV0ToHostV1",
"validates",
"host",
"config",
"and",
"modifies",
"if",
"needed",
"this",
"is",
"used",
"for",
"configuration",
"updates"
] | [
"func",
"MigrateHostV0ToHostV1",
"(",
"hostV0",
"*",
"V0",
")",
"*",
"V1",
"{",
"hostV1",
":=",
"&",
"V1",
"{",
"Driver",
":",
"hostV0",
".",
"Driver",
",",
"DriverName",
":",
"hostV0",
".",
"DriverName",
",",
"}",
"\n\n",
"hostV1",
".",
"HostOptions",
"=",
"&",
"OptionsV1",
"{",
"}",
"\n",
"hostV1",
".",
"HostOptions",
".",
"EngineOptions",
"=",
"&",
"engine",
".",
"Options",
"{",
"TLSVerify",
":",
"true",
",",
"InstallURL",
":",
"\"",
"\"",
",",
"}",
"\n",
"hostV1",
".",
"HostOptions",
".",
"SwarmOptions",
"=",
"&",
"swarm",
".",
"Options",
"{",
"<mask>",
":",
"\"",
"\"",
",",
"Discovery",
":",
"hostV0",
".",
"SwarmDiscovery",
",",
"Host",
":",
"hostV0",
".",
"SwarmHost",
",",
"Master",
":",
"hostV0",
".",
"SwarmMaster",
",",
"}",
"\n",
"hostV1",
".",
"HostOptions",
".",
"AuthOptions",
"=",
"&",
"AuthOptionsV1",
"{",
"StorePath",
":",
"hostV0",
".",
"StorePath",
",",
"CaCertPath",
":",
"hostV0",
".",
"CaCertPath",
",",
"CaCertRemotePath",
":",
"\"",
"\"",
",",
"ServerCertPath",
":",
"hostV0",
".",
"ServerCertPath",
",",
"ServerKeyPath",
":",
"hostV0",
".",
"ServerKeyPath",
",",
"ClientKeyPath",
":",
"hostV0",
".",
"ClientKeyPath",
",",
"ServerCertRemotePath",
":",
"\"",
"\"",
",",
"ServerKeyRemotePath",
":",
"\"",
"\"",
",",
"PrivateKeyPath",
":",
"hostV0",
".",
"PrivateKeyPath",
",",
"ClientCertPath",
":",
"hostV0",
".",
"ClientCertPath",
",",
"}",
"\n\n",
"return",
"hostV1",
"\n",
"}"
] |
12,565 | all-12566 | [
"Format",
"constructs",
"string",
"for",
"logging",
".",
"Time",
"of",
"logging",
"is",
"added",
"to",
"log",
"message",
".",
"Also",
"if",
"time",
"of",
"logging",
"is",
"more",
"then",
"100",
"miliseconds",
"in",
"the",
"passt",
"both",
"times",
"will",
"be",
"added",
"to",
"message",
"(",
"time",
"when",
"application",
"sent",
"log",
"and",
"time",
"when",
"message",
"was",
"processed",
")",
".",
"Otherwise",
"only",
"time",
"of",
"processing",
"will",
"be",
"written",
"."
] | [
"func",
"(",
"formatter",
"*",
"StandardFormatter",
")",
"Format",
"(",
"record",
"*",
"Record",
")",
"string",
"{",
"var",
"message",
"string",
"\n",
"now",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"if",
"now",
".",
"Sub",
"(",
"record",
".",
"Time",
")",
"<=",
"tolerance",
"{",
"message",
"=",
"record",
".",
"Message",
"\n",
"}",
"else",
"{",
"message",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"record",
".",
"Time",
".",
"Format",
"(",
"formatter",
".",
"TimeFormat",
")",
",",
"record",
".",
"Message",
")",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"now",
".",
"Format",
"(",
"formatter",
".",
"TimeFormat",
")",
",",
"record",
".",
"Level",
",",
"<mask>",
")",
"\n",
"}"
] |
12,566 | all-12567 | [
"render",
"multiple",
"instances",
"of",
"a",
"set",
"of",
"primitives",
"from",
"array",
"data",
"with",
"a",
"per",
"-",
"element",
"offset"
] | [
"func",
"DrawElementsInstancedBaseVertexBaseInstance",
"(",
"mode",
"uint32",
",",
"<mask>",
"int32",
",",
"xtype",
"uint32",
",",
"indices",
"unsafe",
".",
"Pointer",
",",
"instancecount",
"int32",
",",
"basevertex",
"int32",
",",
"baseinstance",
"uint32",
")",
"{",
"C",
".",
"glowDrawElementsInstancedBaseVertexBaseInstance",
"(",
"gpDrawElementsInstancedBaseVertexBaseInstance",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"mode",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"indices",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"instancecount",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"basevertex",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"baseinstance",
")",
")",
"\n",
"}"
] |
12,567 | all-12568 | [
"MutateAllowTrust",
"for",
"Asset",
"sets",
"the",
"AllowTrustOp",
"s",
"Asset",
"field"
] | [
"func",
"(",
"m",
"AllowTrustAsset",
")",
"MutateAllowTrust",
"(",
"o",
"*",
"xdr",
".",
"AllowTrustOp",
")",
"(",
"err",
"error",
")",
"{",
"length",
":=",
"len",
"(",
"m",
".",
"Code",
")",
"\n\n",
"switch",
"{",
"case",
"length",
">=",
"1",
"&&",
"length",
"<=",
"4",
":",
"var",
"code",
"[",
"4",
"]",
"byte",
"\n",
"byteArray",
":=",
"[",
"]",
"byte",
"(",
"m",
".",
"Code",
")",
"\n",
"copy",
"(",
"code",
"[",
":",
"]",
",",
"byteArray",
"[",
"0",
":",
"length",
"]",
")",
"\n",
"o",
".",
"Asset",
",",
"err",
"=",
"xdr",
".",
"NewAllowTrustOpAsset",
"(",
"xdr",
".",
"AssetTypeAssetTypeCreditAlphanum4",
",",
"code",
")",
"\n",
"case",
"length",
">=",
"5",
"&&",
"length",
"<=",
"12",
":",
"var",
"code",
"[",
"12",
"]",
"byte",
"\n",
"byteArray",
":=",
"[",
"]",
"byte",
"(",
"m",
".",
"Code",
")",
"\n",
"copy",
"(",
"<mask>",
"[",
":",
"]",
",",
"byteArray",
"[",
"0",
":",
"length",
"]",
")",
"\n",
"o",
".",
"Asset",
",",
"err",
"=",
"xdr",
".",
"NewAllowTrustOpAsset",
"(",
"xdr",
".",
"AssetTypeAssetTypeCreditAlphanum12",
",",
"code",
")",
"\n",
"default",
":",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
12,568 | all-12569 | [
"WithSecure",
"true",
"if",
"cookie",
"is",
"secure",
"."
] | [
"func",
"(",
"p",
"SetCookieParams",
")",
"WithSecure",
"(",
"secure",
"bool",
")",
"*",
"SetCookieParams",
"{",
"p",
".",
"Secure",
"=",
"<mask>",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
12,569 | all-12570 | [
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"IpAddrType"
] | [
"func",
"(",
"e",
"IpAddrType",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"<mask>",
":=",
"ipAddrTypeMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
12,570 | all-12571 | [
"handleJobHistory",
"handles",
"requests",
"to",
"get",
"the",
"history",
"of",
"a",
"given",
"job",
"The",
"url",
"must",
"look",
"like",
"this",
"for",
"presubmits",
":",
"/",
"job",
"-",
"history",
"/",
"<gcs",
"-",
"bucket",
"-",
"name",
">",
"/",
"pr",
"-",
"logs",
"/",
"directory",
"/",
"<job",
"-",
"name",
">",
"Example",
":",
"-",
"/",
"job",
"-",
"history",
"/",
"kubernetes",
"-",
"jenkins",
"/",
"pr",
"-",
"logs",
"/",
"directory",
"/",
"pull",
"-",
"test",
"-",
"infra",
"-",
"verify",
"-",
"gofmt",
"For",
"periodics",
"or",
"postsubmits",
"the",
"url",
"must",
"look",
"like",
"this",
":",
"/",
"job",
"-",
"history",
"/",
"<gcs",
"-",
"bucket",
"-",
"name",
">",
"/",
"logs",
"/",
"<job",
"-",
"name",
">",
"Example",
":",
"-",
"/",
"job",
"-",
"history",
"/",
"kubernetes",
"-",
"jenkins",
"/",
"logs",
"/",
"ci",
"-",
"kubernetes",
"-",
"e2e",
"-",
"prow",
"-",
"canary"
] | [
"func",
"handleJobHistory",
"(",
"o",
"options",
",",
"cfg",
"config",
".",
"Getter",
",",
"gcsClient",
"*",
"storage",
".",
"Client",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"setHeadersNoCaching",
"(",
"w",
")",
"\n",
"tmpl",
",",
"err",
":=",
"getJobHistory",
"(",
"r",
".",
"URL",
",",
"cfg",
"(",
")",
",",
"gcsClient",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"msg",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"logrus",
".",
"WithField",
"(",
"\"",
"\"",
",",
"r",
".",
"URL",
")",
".",
"Error",
"(",
"<mask>",
")",
"\n",
"http",
".",
"Error",
"(",
"w",
",",
"msg",
",",
"http",
".",
"StatusInternalServerError",
")",
"\n",
"return",
"\n",
"}",
"\n",
"handleSimpleTemplate",
"(",
"o",
",",
"cfg",
",",
"\"",
"\"",
",",
"tmpl",
")",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"\n",
"}"
] |
12,571 | all-12572 | [
"GetHealthStatus",
"returns",
"the",
"container",
"health",
"information"
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"GetHealthStatus",
"(",
")",
"HealthStatus",
"{",
"c",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"// Copy the pointer to avoid race condition",
"copyHealth",
":=",
"c",
".",
"Health",
"\n\n",
"if",
"c",
".",
"Health",
".",
"Since",
"!=",
"nil",
"{",
"copyHealth",
".",
"Since",
"=",
"aws",
".",
"Time",
"(",
"aws",
".",
"TimeValue",
"(",
"c",
".",
"Health",
".",
"Since",
")",
")",
"\n",
"}",
"\n\n",
"return",
"copyHealth",
"\n",
"}"
] |
12,572 | all-12573 | [
"CompareNitro",
"implements",
"comparator",
"for",
"Nitro",
"instances",
"based",
"on",
"its",
"id"
] | [
"func",
"CompareNitro",
"(",
"this",
"unsafe",
".",
"Pointer",
",",
"that",
"unsafe",
".",
"Pointer",
")",
"int",
"{",
"thisItem",
":=",
"(",
"*",
"Nitro",
")",
"(",
"this",
")",
"\n",
"thatItem",
":=",
"(",
"*",
"Nitro",
")",
"(",
"that",
")",
"\n\n",
"return",
"int",
"(",
"thisItem",
".",
"<mask>",
"-",
"thatItem",
".",
"id",
")",
"\n",
"}"
] |
12,573 | all-12574 | [
"GetManageOfferResult",
"retrieves",
"the",
"ManageOfferResult",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"OperationResultTr",
")",
"GetManageOfferResult",
"(",
")",
"(",
"result",
"ManageOfferResult",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"<mask>",
"=",
"*",
"u",
".",
"ManageOfferResult",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
12,574 | all-12575 | [
"FieldCriteria",
"converts",
"the",
"given",
"fields",
"to",
"AND",
"-",
"separated",
"WHERE",
"criteria",
"."
] | [
"func",
"FieldCriteria",
"(",
"fields",
"[",
"]",
"*",
"Field",
")",
"string",
"{",
"criteria",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"<mask>",
")",
")",
"\n\n",
"for",
"i",
",",
"field",
":=",
"range",
"fields",
"{",
"criteria",
"[",
"i",
"]",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"field",
".",
"Column",
"(",
")",
")",
"\n",
"}",
"\n\n",
"return",
"strings",
".",
"Join",
"(",
"criteria",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
12,575 | all-12576 | [
"String",
"creates",
"a",
"link",
"for",
"the",
"approval",
".",
"Use",
"Login",
"if",
"you",
"just",
"want",
"the",
"name",
"."
] | [
"func",
"(",
"a",
"Approval",
")",
"<mask>",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"`*<a href=\"%s\" title=\"%s\">%s</a>*`",
",",
"a",
".",
"Reference",
",",
"a",
".",
"How",
",",
"a",
".",
"Login",
",",
")",
"\n",
"}"
] |
12,576 | all-12577 | [
"UpdateMetric",
"updates",
"passed",
"metric",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"UpdateMetric",
"(",
"cfg",
"*",
"Metric",
")",
"(",
"*",
"Metric",
",",
"error",
")",
"{",
"if",
"cfg",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"metricCID",
":=",
"string",
"(",
"cfg",
".",
"CID",
")",
"\n\n",
"matched",
",",
"err",
":=",
"regexp",
".",
"MatchString",
"(",
"config",
".",
"MetricCIDRegex",
",",
"metricCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"<mask>",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"metricCID",
")",
"\n",
"}",
"\n\n",
"jsonCfg",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"cfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"Debug",
"{",
"a",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"string",
"(",
"jsonCfg",
")",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"Put",
"(",
"metricCID",
",",
"jsonCfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"metric",
":=",
"&",
"Metric",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"metric",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"metric",
",",
"nil",
"\n",
"}"
] |
12,577 | all-12578 | [
"Quote",
"returns",
"a",
"quoted",
"s",
".",
"It",
"is",
"for",
"a",
"column",
"name",
"not",
"a",
"value",
"."
] | [
"func",
"(",
"<mask>",
"*",
"DB",
")",
"Quote",
"(",
"s",
"string",
")",
"string",
"{",
"return",
"db",
".",
"dialect",
".",
"Quote",
"(",
"s",
")",
"\n",
"}"
] |
12,578 | all-12579 | [
"NewLoggerBase",
"creates",
"a",
"new",
"LoggerBase",
"."
] | [
"func",
"NewLoggerBase",
"(",
"conf",
"*",
"BaseConfig",
",",
"log",
"LoggerFunc",
")",
"(",
"*",
"LoggerBase",
",",
"error",
")",
"{",
"if",
"_",
",",
"ok",
":=",
"levelNums",
"[",
"conf",
".",
"Level",
"]",
";",
"!",
"ok",
"{",
"return",
"nil",
",",
"ErrBadLevel",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"levelNums",
"[",
"conf",
".",
"StackLevel",
"]",
";",
"!",
"ok",
"{",
"return",
"nil",
",",
"ErrBadStackLevel",
"\n",
"}",
"\n\n",
"ctx",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
"\n\n",
"return",
"&",
"LoggerBase",
"{",
"conf",
":",
"conf",
",",
"log",
":",
"<mask>",
",",
"ctx",
":",
"ctx",
"}",
",",
"nil",
"\n",
"}"
] |
12,579 | all-12580 | [
"Remove",
"is",
"a",
"wrapper",
"around",
"gtk_container_remove",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"Remove",
"(",
"w",
"IWidget",
")",
"{",
"C",
".",
"gtk_container_remove",
"(",
"v",
".",
"native",
"(",
")",
",",
"w",
".",
"toWidget",
"(",
")",
")",
"\n",
"}"
] |
12,580 | all-12581 | [
"GetType",
"returns",
"the",
"Type",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinitionMarker",
")",
"GetType",
"(",
")",
"string",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"Type",
"\n",
"}"
] |
12,581 | all-12582 | [
"SetPrinter",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_set_printer",
"()",
"."
] | [
"func",
"(",
"<mask>",
"*",
"PrintSettings",
")",
"SetPrinter",
"(",
"printer",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"printer",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_print_settings_set_printer",
"(",
"ps",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
12,582 | all-12583 | [
"flattenStorageDrsAutomationConfig",
"saves",
"a",
"StorageDrsAutomationConfig",
"into",
"the",
"supplied",
"ResourceData",
"."
] | [
"func",
"flattenStorageDrsAutomationConfig",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"types",
".",
"StorageDrsAutomationConfig",
")",
"error",
"{",
"attrs",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"obj",
".",
"IoLoadBalanceAutomationMode",
",",
"\"",
"\"",
":",
"obj",
".",
"PolicyEnforcementAutomationMode",
",",
"\"",
"\"",
":",
"obj",
".",
"RuleEnforcementAutomationMode",
",",
"\"",
"\"",
":",
"obj",
".",
"SpaceLoadBalanceAutomationMode",
",",
"\"",
"\"",
":",
"obj",
".",
"VmEvacuationAutomationMode",
",",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"<mask>",
"attrs",
"{",
"if",
"err",
":=",
"d",
".",
"Set",
"(",
"k",
",",
"v",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"k",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
12,583 | all-12584 | [
"Transport",
"is",
"a",
"GServiceAccount",
"option",
"to",
"set",
"the",
"client",
"transport",
"used",
"by",
"the",
"token",
"source",
"."
] | [
"func",
"Transport",
"(",
"transport",
"<mask>",
".",
"RoundTripper",
")",
"Option",
"{",
"return",
"func",
"(",
"gsa",
"*",
"GServiceAccount",
")",
"error",
"{",
"gsa",
".",
"transport",
"=",
"transport",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
12,584 | all-12585 | [
"RenewHTTP",
"renews",
"a",
"lease",
"at",
"a",
"given",
"primary",
"server",
".",
"TODO",
":",
"Batch",
"request",
"in",
"future?"
] | [
"func",
"RenewHTTP",
"(",
"ctx",
"<mask>",
".",
"Context",
",",
"id",
"lease",
".",
"LeaseID",
",",
"url",
"string",
",",
"rt",
"http",
".",
"RoundTripper",
")",
"(",
"int64",
",",
"error",
")",
"{",
"// will post lreq protobuf to leader",
"lreq",
",",
"err",
":=",
"(",
"&",
"pb",
".",
"LeaseKeepAliveRequest",
"{",
"ID",
":",
"int64",
"(",
"id",
")",
"}",
")",
".",
"Marshal",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"-",
"1",
",",
"err",
"\n",
"}",
"\n\n",
"cc",
":=",
"&",
"http",
".",
"Client",
"{",
"Transport",
":",
"rt",
"}",
"\n",
"req",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"\"",
"\"",
",",
"url",
",",
"bytes",
".",
"NewReader",
"(",
"lreq",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"-",
"1",
",",
"err",
"\n",
"}",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"req",
".",
"Cancel",
"=",
"ctx",
".",
"Done",
"(",
")",
"\n\n",
"resp",
",",
"err",
":=",
"cc",
".",
"Do",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"-",
"1",
",",
"err",
"\n",
"}",
"\n",
"b",
",",
"err",
":=",
"readResponse",
"(",
"resp",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"-",
"1",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"resp",
".",
"StatusCode",
"==",
"http",
".",
"StatusRequestTimeout",
"{",
"return",
"-",
"1",
",",
"ErrLeaseHTTPTimeout",
"\n",
"}",
"\n\n",
"if",
"resp",
".",
"StatusCode",
"==",
"http",
".",
"StatusNotFound",
"{",
"return",
"-",
"1",
",",
"lease",
".",
"ErrLeaseNotFound",
"\n",
"}",
"\n\n",
"if",
"resp",
".",
"StatusCode",
"!=",
"http",
".",
"StatusOK",
"{",
"return",
"-",
"1",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"string",
"(",
"b",
")",
")",
"\n",
"}",
"\n\n",
"lresp",
":=",
"&",
"pb",
".",
"LeaseKeepAliveResponse",
"{",
"}",
"\n",
"if",
"err",
":=",
"lresp",
".",
"Unmarshal",
"(",
"b",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"-",
"1",
",",
"fmt",
".",
"Errorf",
"(",
"`lease: %v. data = \"%s\"`",
",",
"err",
",",
"string",
"(",
"b",
")",
")",
"\n",
"}",
"\n",
"if",
"lresp",
".",
"ID",
"!=",
"int64",
"(",
"id",
")",
"{",
"return",
"-",
"1",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"lresp",
".",
"TTL",
",",
"nil",
"\n",
"}"
] |
12,585 | all-12586 | [
"DBFilePath",
"returns",
"the",
"file",
"path",
"for",
"the",
"snapshot",
"of",
"the",
"database",
"with",
"given",
"id",
".",
"If",
"the",
"snapshot",
"does",
"not",
"exist",
"it",
"returns",
"error",
"."
] | [
"func",
"(",
"s",
"*",
"Snapshotter",
")",
"DBFilePath",
"(",
"id",
"uint64",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"_",
",",
"err",
":=",
"fileutil",
".",
"ReadDir",
"(",
"s",
".",
"dir",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"fn",
":=",
"s",
".",
"dbFilePath",
"(",
"id",
")",
"\n",
"if",
"fileutil",
".",
"Exist",
"(",
"fn",
")",
"{",
"return",
"fn",
",",
"nil",
"\n",
"}",
"\n",
"if",
"s",
".",
"lg",
"!=",
"nil",
"{",
"s",
".",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"Uint64",
"(",
"\"",
"\"",
",",
"<mask>",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"fn",
")",
",",
"zap",
".",
"Error",
"(",
"ErrNoDBSnapshot",
")",
",",
")",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"ErrNoDBSnapshot",
"\n",
"}"
] |
12,586 | all-12587 | [
"IstioClient",
"generates",
"an",
"istio",
"client",
"if",
"it",
"was",
"not",
"created",
"before"
] | [
"func",
"(",
"p",
"*",
"SingletonClientGenerator",
")",
"IstioClient",
"(",
")",
"(",
"istiomodel",
".",
"ConfigStore",
",",
"error",
")",
"{",
"<mask>",
"err",
"error",
"\n",
"p",
".",
"istioOnce",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"p",
".",
"istioClient",
",",
"err",
"=",
"NewIstioClient",
"(",
"p",
".",
"KubeConfig",
")",
"\n",
"}",
")",
"\n",
"return",
"p",
".",
"istioClient",
",",
"err",
"\n",
"}"
] |
12,587 | all-12588 | [
"AccelMapChangeEntry",
"is",
"a",
"wrapper",
"around",
"gtk_accel_map_change_entry",
"()",
"."
] | [
"func",
"AccelMapChangeEntry",
"(",
"path",
"string",
",",
"key",
"uint",
",",
"mods",
"gdk",
".",
"ModifierType",
",",
"replace",
"bool",
")",
"bool",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"<mask>",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n\n",
"return",
"gobool",
"(",
"C",
".",
"gtk_accel_map_change_entry",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"C",
".",
"guint",
"(",
"key",
")",
",",
"C",
".",
"GdkModifierType",
"(",
"mods",
")",
",",
"gbool",
"(",
"replace",
")",
")",
")",
"\n",
"}"
] |
12,588 | all-12589 | [
"recvNextFragment",
"receives",
"the",
"next",
"fragment",
"from",
"the",
"underlying",
"message",
"exchange",
"."
] | [
"func",
"(",
"r",
"*",
"reqResReader",
")",
"recvNextFragment",
"(",
"initial",
"bool",
")",
"(",
"*",
"readableFragment",
",",
"error",
")",
"{",
"if",
"r",
".",
"initialFragment",
"!=",
"nil",
"{",
"fragment",
":=",
"r",
".",
"initialFragment",
"\n",
"r",
".",
"initialFragment",
"=",
"nil",
"\n",
"r",
".",
"previousFragment",
"=",
"fragment",
"\n",
"return",
"fragment",
",",
"nil",
"\n",
"}",
"\n\n",
"// Wait for the appropriate message from the peer",
"message",
":=",
"r",
".",
"messageForFragment",
"(",
"initial",
")",
"\n",
"frame",
",",
"err",
":=",
"r",
".",
"mex",
".",
"recvPeerFrameOfType",
"(",
"<mask>",
".",
"messageType",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
",",
"ok",
":=",
"err",
".",
"(",
"errorMessage",
")",
";",
"ok",
"{",
"// If we received a serialized error from the other side, then we should go through",
"// the normal doneReading path so stats get updated with this error.",
"r",
".",
"err",
"=",
"err",
".",
"AsSystemError",
"(",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"r",
".",
"failed",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"// Parse the message and setup the fragment",
"fragment",
",",
"err",
":=",
"parseInboundFragment",
"(",
"r",
".",
"mex",
".",
"framePool",
",",
"frame",
",",
"message",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"r",
".",
"failed",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"r",
".",
"previousFragment",
"=",
"fragment",
"\n",
"return",
"fragment",
",",
"nil",
"\n",
"}"
] |
12,589 | all-12590 | [
"GetLegendSizeOk",
"returns",
"a",
"tuple",
"with",
"the",
"LegendSize",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetLegendSizeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"LegendSize",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"LegendSize",
",",
"true",
"\n",
"}"
] |
12,590 | all-12591 | [
"QueryBool",
"returns",
"query",
"result",
"in",
"bool",
"type",
"."
] | [
"func",
"(",
"ctx",
"*",
"Context",
")",
"QueryBool",
"(",
"name",
"string",
")",
"bool",
"{",
"v",
",",
"_",
":=",
"strconv",
".",
"ParseBool",
"(",
"ctx",
".",
"<mask>",
"(",
"name",
")",
")",
"\n",
"return",
"v",
"\n",
"}"
] |
12,591 | all-12592 | [
"Permutation",
"generator"
] | [
"func",
"Permutations",
"(",
"list",
"Replacer",
",",
"select_num",
"int",
",",
"repeatable",
"bool",
",",
"buf",
"int",
")",
"(",
"c",
"chan",
"Replacer",
")",
"{",
"c",
"=",
"make",
"(",
"chan",
"Replacer",
",",
"buf",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"defer",
"close",
"(",
"c",
")",
"\n",
"var",
"perm_generator",
"func",
"(",
"[",
"]",
"int",
",",
"int",
",",
"int",
")",
"chan",
"[",
"]",
"int",
"\n",
"if",
"repeatable",
"{",
"perm_generator",
"=",
"repeated_permutations",
"\n",
"}",
"else",
"{",
"perm_generator",
"=",
"permutations",
"\n",
"}",
"\n",
"indices",
":=",
"make",
"(",
"[",
"]",
"int",
",",
"list",
".",
"Len",
"(",
")",
",",
"list",
".",
"Len",
"(",
")",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"<mask>",
".",
"Len",
"(",
")",
";",
"i",
"++",
"{",
"indices",
"[",
"i",
"]",
"=",
"i",
"\n",
"}",
"\n",
"for",
"perm",
":=",
"range",
"perm_generator",
"(",
"indices",
",",
"select_num",
",",
"buf",
")",
"{",
"c",
"<-",
"list",
".",
"Replace",
"(",
"perm",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"return",
"\n",
"}"
] |
12,592 | all-12593 | [
"NewExoscaleProvider",
"returns",
"ExoscaleProvider",
"DNS",
"provider",
"interface",
"implementation"
] | [
"func",
"NewExoscaleProvider",
"(",
"endpoint",
",",
"apiKey",
",",
"apiSecret",
"string",
",",
"dryRun",
"bool",
",",
"opts",
"...",
"ExoscaleOption",
")",
"*",
"ExoscaleProvider",
"{",
"client",
":=",
"egoscale",
".",
"NewClient",
"(",
"endpoint",
",",
"apiKey",
",",
"apiSecret",
")",
"\n",
"return",
"NewExoscaleProviderWithClient",
"(",
"endpoint",
",",
"apiKey",
",",
"apiSecret",
",",
"<mask>",
",",
"dryRun",
",",
"opts",
"...",
")",
"\n",
"}"
] |
12,593 | all-12594 | [
"DefaultTokenData",
"adds",
"the",
"user",
"s",
"id",
"to",
"the",
"token",
"data",
"claim",
"."
] | [
"func",
"DefaultTokenData",
"(",
"_",
"Client",
",",
"ro",
"ResourceOwner",
",",
"_",
"GenericToken",
")",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"if",
"ro",
"!=",
"nil",
"{",
"return",
"<mask>",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"ro",
".",
"ID",
"(",
")",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
12,594 | all-12595 | [
"ServeHTTP",
"is",
"the",
"primary",
"throttler",
"request",
"handler"
] | [
"func",
"(",
"t",
"*",
"throttler",
")",
"ServeHTTP",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"ctx",
":=",
"r",
".",
"Context",
"(",
")",
"\n",
"select",
"{",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"http",
".",
"Error",
"(",
"w",
",",
"errContextCanceled",
",",
"http",
".",
"StatusServiceUnavailable",
")",
"\n",
"return",
"\n",
"case",
"btok",
":=",
"<-",
"t",
".",
"backlogTokens",
":",
"timer",
":=",
"time",
".",
"NewTimer",
"(",
"t",
".",
"backlogTimeout",
")",
"\n\n",
"defer",
"func",
"(",
")",
"{",
"t",
".",
"backlogTokens",
"<-",
"btok",
"\n",
"}",
"(",
")",
"\n\n",
"select",
"{",
"case",
"<-",
"timer",
".",
"C",
":",
"http",
".",
"Error",
"(",
"w",
",",
"errTimedOut",
",",
"http",
".",
"StatusServiceUnavailable",
")",
"\n",
"return",
"\n",
"<mask>",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"http",
".",
"Error",
"(",
"w",
",",
"errContextCanceled",
",",
"http",
".",
"StatusServiceUnavailable",
")",
"\n",
"return",
"\n",
"case",
"tok",
":=",
"<-",
"t",
".",
"tokens",
":",
"defer",
"func",
"(",
")",
"{",
"t",
".",
"tokens",
"<-",
"tok",
"\n",
"}",
"(",
")",
"\n",
"t",
".",
"h",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"\n",
"return",
"\n",
"default",
":",
"http",
".",
"Error",
"(",
"w",
",",
"errCapacityExceeded",
",",
"http",
".",
"StatusServiceUnavailable",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}"
] |
12,595 | all-12596 | [
"syncVictimsLoop",
"tries",
"to",
"write",
"precomputed",
"watcher",
"responses",
"to",
"watchers",
"that",
"had",
"a",
"blocked",
"watcher",
"channel"
] | [
"func",
"(",
"s",
"*",
"watchableStore",
")",
"syncVictimsLoop",
"(",
")",
"{",
"defer",
"s",
".",
"wg",
".",
"Done",
"(",
")",
"\n\n",
"for",
"{",
"for",
"s",
".",
"moveVictims",
"(",
")",
"!=",
"0",
"{",
"// try to update all victim watchers",
"}",
"\n",
"s",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"isEmpty",
":=",
"len",
"(",
"s",
".",
"victims",
")",
"==",
"0",
"\n",
"s",
".",
"mu",
".",
"RUnlock",
"(",
")",
"\n\n",
"var",
"tickc",
"<-",
"chan",
"<mask>",
".",
"Time",
"\n",
"if",
"!",
"isEmpty",
"{",
"tickc",
"=",
"time",
".",
"After",
"(",
"10",
"*",
"time",
".",
"Millisecond",
")",
"\n",
"}",
"\n\n",
"select",
"{",
"case",
"<-",
"tickc",
":",
"case",
"<-",
"s",
".",
"victimc",
":",
"case",
"<-",
"s",
".",
"stopc",
":",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
12,596 | all-12597 | [
"Start",
"Mason"
] | [
"func",
"(",
"m",
"*",
"Mason",
")",
"Start",
"(",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"context",
".",
"Background",
"(",
")",
")",
"\n",
"m",
".",
"cancel",
"=",
"cancel",
"\n",
"m",
".",
"start",
"(",
"ctx",
",",
"m",
".",
"syncAll",
")",
"\n",
"m",
".",
"start",
"(",
"ctx",
",",
"m",
".",
"recycleAll",
")",
"\n",
"m",
".",
"<mask>",
"(",
"ctx",
",",
"m",
".",
"fulfillAll",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"m",
".",
"cleanerCount",
";",
"i",
"++",
"{",
"m",
".",
"start",
"(",
"ctx",
",",
"m",
".",
"cleanAll",
")",
"\n",
"}",
"\n",
"m",
".",
"start",
"(",
"ctx",
",",
"m",
".",
"freeAll",
")",
"\n",
"logrus",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
12,597 | all-12598 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetTimeDomainParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPerformance",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
12,598 | all-12599 | [
"PostsubmitSpec",
"initializes",
"a",
"ProwJobSpec",
"for",
"a",
"given",
"postsubmit",
"job",
"."
] | [
"func",
"PostsubmitSpec",
"(",
"p",
"config",
".",
"Postsubmit",
",",
"refs",
"prowapi",
".",
"Refs",
")",
"prowapi",
".",
"ProwJobSpec",
"{",
"pjs",
":=",
"specFromJobBase",
"(",
"p",
".",
"JobBase",
")",
"\n",
"pjs",
".",
"Type",
"=",
"prowapi",
".",
"PostsubmitJob",
"\n",
"pjs",
".",
"<mask>",
"=",
"p",
".",
"Context",
"\n",
"pjs",
".",
"Report",
"=",
"!",
"p",
".",
"SkipReport",
"\n",
"pjs",
".",
"Refs",
"=",
"completePrimaryRefs",
"(",
"refs",
",",
"p",
".",
"JobBase",
")",
"\n",
"if",
"p",
".",
"JenkinsSpec",
"!=",
"nil",
"{",
"pjs",
".",
"JenkinsSpec",
"=",
"&",
"prowapi",
".",
"JenkinsSpec",
"{",
"GitHubBranchSourceJob",
":",
"p",
".",
"JenkinsSpec",
".",
"GitHubBranchSourceJob",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"pjs",
"\n",
"}"
] |
12,599 | all-12600 | [
"===",
"delta",
"(",
"Matrix",
"ValueTypeMatrix",
")",
"Vector",
"==="
] | [
"func",
"funcDelta",
"(",
"vals",
"[",
"]",
"Value",
",",
"args",
"Expressions",
",",
"enh",
"*",
"EvalNodeHelper",
")",
"Vector",
"{",
"return",
"extrapolatedRate",
"(",
"vals",
",",
"args",
",",
"enh",
",",
"false",
",",
"<mask>",
")",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.