id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
7,900 | all-7901 | [
"GetLan",
"pulls",
"data",
"for",
"the",
"lan",
"where",
"id",
"=",
"lanid",
"returns",
"an",
"Instance",
"struct"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetLan",
"(",
"dcid",
",",
"lanid",
"string",
")",
"(",
"*",
"Lan",
",",
"error",
")",
"{",
"url",
":=",
"lanPath",
"(",
"dcid",
",",
"lanid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"Lan",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Get",
"(",
"url",
",",
"<mask>",
",",
"http",
".",
"StatusOK",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
7,901 | all-7902 | [
"AddJitter",
"adds",
"an",
"amount",
"of",
"jitter",
"between",
"0",
"and",
"the",
"given",
"jitter",
"to",
"the",
"given",
"duration"
] | [
"func",
"AddJitter",
"(",
"duration",
"time",
".",
"Duration",
",",
"jitter",
"time",
".",
"Duration",
")",
"time",
".",
"Duration",
"{",
"var",
"randJitter",
"int64",
"\n",
"if",
"jitter",
".",
"Nanoseconds",
"(",
")",
"==",
"0",
"{",
"randJitter",
"=",
"0",
"\n",
"}",
"else",
"{",
"randJitter",
"=",
"rand",
".",
"Int63n",
"(",
"jitter",
".",
"Nanoseconds",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"time",
".",
"Duration",
"(",
"<mask>",
".",
"Nanoseconds",
"(",
")",
"+",
"randJitter",
")",
"\n",
"}"
] |
7,902 | all-7903 | [
"GetRecoveryWindowOk",
"returns",
"a",
"tuple",
"with",
"the",
"RecoveryWindow",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"ThresholdWindows",
")",
"GetRecoveryWindowOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"RecoveryWindow",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"RecoveryWindow",
",",
"true",
"\n",
"}"
] |
7,903 | all-7904 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"PropertyPreview",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime14",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
7,904 | all-7905 | [
"UpdateFirewallRule",
"updates",
"a",
"firewall",
"rule"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateFirewallRule",
"(",
"dcID",
"string",
",",
"serverID",
"string",
",",
"nicID",
"string",
",",
"fwID",
"string",
",",
"obj",
"FirewallruleProperties",
")",
"(",
"*",
"FirewallRule",
",",
"error",
")",
"{",
"url",
":=",
"fwrulePath",
"(",
"dcID",
",",
"serverID",
",",
"nicID",
",",
"fwID",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"FirewallRule",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Patch",
"(",
"url",
",",
"obj",
",",
"ret",
",",
"http",
".",
"StatusAccepted",
")",
"\n",
"return",
"<mask>",
",",
"err",
"\n",
"}"
] |
7,905 | all-7906 | [
"GetTitleAlignOk",
"returns",
"a",
"tuple",
"with",
"the",
"TitleAlign",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"q",
"*",
"QueryValueDefinition",
")",
"GetTitleAlignOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"q",
"==",
"nil",
"||",
"q",
".",
"TitleAlign",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"q",
".",
"TitleAlign",
",",
"<mask>",
"\n",
"}"
] |
7,906 | all-7907 | [
"vimSessionFile",
"is",
"takes",
"the",
"session",
"file",
"name",
"generated",
"by",
"sessionFile",
"and",
"then",
"prefixes",
"the",
"SOAP",
"client",
"session",
"path",
"to",
"it",
"."
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"vimSessionFile",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"p",
",",
"err",
":=",
"c",
".",
"sessionFile",
"(",
")",
"\n",
"if",
"<mask>",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"filepath",
".",
"Join",
"(",
"c",
".",
"VimSessionPath",
",",
"p",
")",
",",
"nil",
"\n",
"}"
] |
7,907 | all-7908 | [
"AppMeshFromACS",
"validates",
"proxy",
"config",
"if",
"it",
"is",
"app",
"mesh",
"type",
"and",
"creates",
"AppMesh",
"object"
] | [
"func",
"AppMeshFromACS",
"(",
"proxyConfig",
"*",
"ecsacs",
".",
"ProxyConfiguration",
")",
"(",
"*",
"AppMesh",
",",
"error",
")",
"{",
"if",
"*",
"proxyConfig",
".",
"<mask>",
"!=",
"appMesh",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"AppMesh",
"{",
"ContainerName",
":",
"aws",
".",
"StringValue",
"(",
"proxyConfig",
".",
"ContainerName",
")",
",",
"IgnoredUID",
":",
"aws",
".",
"StringValue",
"(",
"proxyConfig",
".",
"Properties",
"[",
"ignoredUID",
"]",
")",
",",
"IgnoredGID",
":",
"aws",
".",
"StringValue",
"(",
"proxyConfig",
".",
"Properties",
"[",
"ignoredGID",
"]",
")",
",",
"ProxyIngressPort",
":",
"aws",
".",
"StringValue",
"(",
"proxyConfig",
".",
"Properties",
"[",
"proxyIngressPort",
"]",
")",
",",
"ProxyEgressPort",
":",
"aws",
".",
"StringValue",
"(",
"proxyConfig",
".",
"Properties",
"[",
"proxyEgressPort",
"]",
")",
",",
"AppPorts",
":",
"buildAppPorts",
"(",
"proxyConfig",
")",
",",
"EgressIgnoredIPs",
":",
"buildEgressIgnoredIPs",
"(",
"proxyConfig",
")",
",",
"EgressIgnoredPorts",
":",
"buildEgressIgnoredPorts",
"(",
"proxyConfig",
")",
",",
"}",
",",
"nil",
"\n",
"}"
] |
7,908 | all-7909 | [
"GenerateHOTP",
"will",
"generate",
"a",
"randomised",
"HOTP",
"source",
";",
"if",
"the",
"randCounter",
"parameter",
"is",
"true",
"the",
"counter",
"will",
"be",
"randomised",
"."
] | [
"func",
"GenerateHOTP",
"(",
"digits",
"int",
",",
"randCounter",
"bool",
")",
"(",
"*",
"HOTP",
",",
"error",
")",
"{",
"key",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"sha1",
".",
"Size",
")",
"\n",
"_",
",",
"err",
":=",
"io",
".",
"ReadFull",
"(",
"PRNG",
",",
"key",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"counter",
"uint64",
"\n",
"if",
"randCounter",
"{",
"ctr",
",",
"err",
":=",
"<mask>",
".",
"Int",
"(",
"PRNG",
",",
"big",
".",
"NewInt",
"(",
"int64",
"(",
"math",
".",
"MaxInt64",
")",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"counter",
"=",
"ctr",
".",
"Uint64",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"NewHOTP",
"(",
"key",
",",
"counter",
",",
"digits",
")",
",",
"nil",
"\n",
"}"
] |
7,909 | all-7910 | [
"MustOffer",
"retrieves",
"the",
"Offer",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"ManageOfferSuccessResultOffer",
")",
"MustOffer",
"(",
")",
"OfferEntry",
"{",
"val",
",",
"<mask>",
":=",
"u",
".",
"GetOffer",
"(",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
7,910 | all-7911 | [
"GetOrg",
"returns",
"current",
"metadata",
"for",
"the",
"org",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"orgs",
"/",
"#get",
"-",
"an",
"-",
"organization"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetOrg",
"(",
"<mask>",
"string",
")",
"(",
"*",
"Organization",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"var",
"retOrg",
"Organization",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"request",
"(",
"&",
"request",
"{",
"method",
":",
"http",
".",
"MethodGet",
",",
"path",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"name",
")",
",",
"exitCodes",
":",
"[",
"]",
"int",
"{",
"200",
"}",
",",
"}",
",",
"&",
"retOrg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"retOrg",
",",
"nil",
"\n",
"}"
] |
7,911 | all-7912 | [
"FetchAnnotation",
"retrieves",
"annotation",
"with",
"passed",
"cid",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"FetchAnnotation",
"(",
"cid",
"CIDType",
")",
"(",
"*",
"Annotation",
",",
"error",
")",
"{",
"if",
"cid",
"==",
"nil",
"||",
"*",
"cid",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"annotationCID",
":=",
"string",
"(",
"*",
"cid",
")",
"\n\n",
"matched",
",",
"err",
":=",
"regexp",
".",
"MatchString",
"(",
"config",
".",
"AnnotationCIDRegex",
",",
"annotationCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"matched",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"annotationCID",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"Get",
"(",
"annotationCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"Debug",
"{",
"a",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"string",
"(",
"<mask>",
")",
")",
"\n",
"}",
"\n\n",
"annotation",
":=",
"&",
"Annotation",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"annotation",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"annotation",
",",
"nil",
"\n",
"}"
] |
7,912 | all-7913 | [
"SetLabel",
"is",
"a",
"wrapper",
"around",
"gtk_tool_button_set_label",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"ToolButton",
")",
"SetLabel",
"(",
"<mask>",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"label",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_tool_button_set_label",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
7,913 | all-7914 | [
"NOTE",
":",
"UNSAFE"
] | [
"func",
"DecodeFloat64",
"(",
"bz",
"[",
"]",
"byte",
")",
"(",
"f",
"float64",
",",
"n",
"int",
",",
"err",
"error",
")",
"{",
"const",
"size",
"int",
"=",
"8",
"\n",
"if",
"len",
"(",
"bz",
")",
"<",
"size",
"{",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"i",
":=",
"<mask>",
".",
"LittleEndian",
".",
"Uint64",
"(",
"bz",
"[",
":",
"size",
"]",
")",
"\n",
"f",
"=",
"math",
".",
"Float64frombits",
"(",
"i",
")",
"\n",
"n",
"=",
"size",
"\n",
"return",
"\n",
"}"
] |
7,914 | all-7915 | [
"Return",
"a",
"string",
"representation",
"of",
"the",
"Timer",
"."
] | [
"func",
"(",
"t",
"*",
"Timer",
")",
"<mask>",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"t",
".",
"name",
",",
"t",
".",
"duration",
")",
"\n",
"}"
] |
7,915 | all-7916 | [
"===",
"time",
"()",
"float64",
"==="
] | [
"func",
"funcTime",
"(",
"vals",
"[",
"]",
"Value",
",",
"args",
"Expressions",
",",
"enh",
"*",
"EvalNodeHelper",
")",
"Vector",
"{",
"return",
"Vector",
"{",
"Sample",
"{",
"Point",
":",
"<mask>",
"{",
"V",
":",
"float64",
"(",
"enh",
".",
"ts",
")",
"/",
"1000",
",",
"}",
"}",
"}",
"\n",
"}"
] |
7,916 | all-7917 | [
"flattenOptions",
"copies",
"all",
"options",
"in",
"src",
"to",
"dst",
"as",
"a",
"flat",
"list",
".",
"Only",
"coreOptions",
"and",
"Options",
"containing",
"coreOptions",
"are",
"allowed",
"."
] | [
"func",
"flattenOptions",
"(",
"dst",
",",
"src",
"Options",
")",
"Options",
"{",
"for",
"_",
",",
"opt",
":=",
"range",
"src",
"{",
"switch",
"opt",
":=",
"opt",
".",
"(",
"type",
")",
"{",
"case",
"nil",
":",
"continue",
"\n",
"case",
"<mask>",
":",
"dst",
"=",
"flattenOptions",
"(",
"dst",
",",
"opt",
")",
"\n",
"case",
"coreOption",
":",
"dst",
"=",
"append",
"(",
"dst",
",",
"opt",
")",
"\n",
"default",
":",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"opt",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"dst",
"\n",
"}"
] |
7,917 | all-7918 | [
"/",
"*",
"Get2D",
"return",
"a",
"specific",
"element",
"from",
"a",
"2",
"-",
"dimensional",
"matrix",
"."
] | [
"func",
"(",
"m",
"*",
"Mat",
")",
"Get2D",
"(",
"x",
",",
"y",
"int",
")",
"Scalar",
"{",
"<mask>",
":=",
"C",
".",
"cvGet2D",
"(",
"unsafe",
".",
"Pointer",
"(",
"m",
")",
",",
"C",
".",
"int",
"(",
"x",
")",
",",
"C",
".",
"int",
"(",
"y",
")",
")",
"\n",
"return",
"Scalar",
"(",
"ret",
")",
"\n",
"}"
] |
7,918 | all-7919 | [
"UpdateSnapshot",
"updates",
"a",
"snapshot"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateSnapshot",
"(",
"snapshotID",
"string",
",",
"request",
"SnapshotProperties",
")",
"(",
"*",
"Snapshot",
",",
"error",
")",
"{",
"url",
":=",
"snapshotColPath",
"(",
")",
"+",
"slash",
"(",
"snapshotID",
")",
"\n",
"ret",
":=",
"&",
"Snapshot",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Patch",
"(",
"url",
",",
"request",
",",
"<mask>",
",",
"http",
".",
"StatusAccepted",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
7,919 | all-7920 | [
"Before",
"applys",
"any",
"http",
".",
"HandlerFunc",
"to",
"the",
"request",
"before",
"sending",
"it",
"on",
"to",
"the",
"controller",
"/",
"processor",
".",
"Note",
"that",
"if",
"a",
"handler",
"incecepts",
"the",
"body",
"of",
"the",
"request",
"via",
"request",
".",
"Body",
"they",
"must",
"ensure",
"it",
"s",
"contents",
"are",
"added",
"back",
"to",
"request",
"or",
"signature",
"verification",
"will",
"fail!"
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"Before",
"(",
"handlers",
"...",
"http",
".",
"HandlerFunc",
")",
"{",
"original",
":=",
"s",
".",
"handlerFn",
"\n",
"s",
".",
"handlerFn",
"=",
"func",
"(",
"w",
"<mask>",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"for",
"_",
",",
"handler",
":=",
"range",
"handlers",
"{",
"handler",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"\n",
"original",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"\n",
"}"
] |
7,920 | all-7921 | [
"SetUDPPort",
"sets",
"which",
"TCP",
"-",
"only",
"ports",
"are",
"used",
"to",
"scan"
] | [
"func",
"(",
"s",
"Scan",
")",
"SetUDPPorts",
"(",
"<mask>",
"...",
"uint16",
")",
"Scan",
"{",
"s",
".",
"configUDPPorts",
"=",
"ports",
"\n",
"return",
"s",
"\n",
"}"
] |
7,921 | all-7922 | [
"Close",
"implements",
"y",
".",
"Iterator"
] | [
"func",
"(",
"s",
"*",
"MergeIterator",
")",
"Close",
"(",
")",
"error",
"{",
"for",
"_",
",",
"itr",
":=",
"<mask>",
"s",
".",
"all",
"{",
"if",
"err",
":=",
"itr",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,922 | all-7923 | [
"restoreVimClient",
"loads",
"the",
"saved",
"session",
"from",
"disk",
".",
"Note",
"that",
"this",
"is",
"a",
"helper",
"function",
"to",
"LoadVimClient",
"and",
"should",
"not",
"be",
"called",
"directly",
"."
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"restoreVimClient",
"(",
"client",
"*",
"vim25",
".",
"Client",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"!",
"c",
".",
"Persist",
"{",
"return",
"false",
",",
"nil",
"\n",
"}",
"\n\n",
"p",
",",
"err",
":=",
"c",
".",
"vimSessionFile",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"p",
")",
"\n",
"f",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"p",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"p",
")",
"\n",
"return",
"false",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
"=",
"f",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"<mask>",
".",
"Printf",
"(",
"\"",
"\"",
",",
"p",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"dec",
":=",
"json",
".",
"NewDecoder",
"(",
"f",
")",
"\n",
"err",
"=",
"dec",
".",
"Decode",
"(",
"client",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"true",
",",
"nil",
"\n",
"}"
] |
7,923 | all-7924 | [
"Records",
"gets",
"the",
"current",
"records",
".",
"Returns",
"the",
"current",
"records",
"or",
"an",
"error",
"if",
"the",
"operation",
"failed",
"."
] | [
"func",
"(",
"p",
"*",
"AzureProvider",
")",
"Records",
"(",
")",
"(",
"endpoints",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
",",
"_",
"error",
")",
"{",
"zones",
",",
"err",
":=",
"p",
".",
"zones",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"zone",
":=",
"range",
"zones",
"{",
"err",
":=",
"p",
".",
"iterateRecords",
"(",
"*",
"zone",
".",
"Name",
",",
"func",
"(",
"recordSet",
"dns",
".",
"RecordSet",
")",
"bool",
"{",
"if",
"recordSet",
".",
"Name",
"==",
"nil",
"||",
"recordSet",
".",
"Type",
"==",
"nil",
"{",
"log",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"recordType",
":=",
"strings",
".",
"TrimLeft",
"(",
"*",
"recordSet",
".",
"Type",
",",
"\"",
"\"",
")",
"\n",
"if",
"!",
"supportedRecordType",
"(",
"recordType",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"name",
":=",
"formatAzureDNSName",
"(",
"*",
"recordSet",
".",
"Name",
",",
"*",
"zone",
".",
"Name",
")",
"\n",
"targets",
":=",
"extractAzureTargets",
"(",
"&",
"recordSet",
")",
"\n",
"if",
"len",
"(",
"targets",
")",
"==",
"0",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
",",
"recordType",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"var",
"ttl",
"endpoint",
".",
"TTL",
"\n",
"if",
"recordSet",
".",
"TTL",
"!=",
"nil",
"{",
"ttl",
"=",
"endpoint",
".",
"TTL",
"(",
"*",
"recordSet",
".",
"TTL",
")",
"\n",
"}",
"\n\n",
"ep",
":=",
"endpoint",
".",
"NewEndpointWithTTL",
"(",
"name",
",",
"recordType",
",",
"endpoint",
".",
"TTL",
"(",
"ttl",
")",
",",
"targets",
"...",
")",
"\n",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"ep",
".",
"RecordType",
",",
"ep",
".",
"DNSName",
",",
"ep",
".",
"Targets",
",",
")",
"\n",
"endpoints",
"=",
"append",
"(",
"endpoints",
",",
"ep",
")",
"\n",
"return",
"<mask>",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"endpoints",
",",
"nil",
"\n",
"}"
] |
7,924 | all-7925 | [
"TODO",
":",
"Dry",
"this",
"out"
] | [
"func",
"syncProwJobs",
"(",
"l",
"*",
"logrus",
".",
"Entry",
",",
"syncFn",
"syncFn",
",",
"maxSyncRoutines",
"int",
",",
"jobs",
"<-",
"chan",
"prowapi",
".",
"ProwJob",
",",
"reports",
"chan",
"<-",
"prowapi",
".",
"ProwJob",
",",
"syncErrors",
"chan",
"<-",
"error",
",",
"pm",
"map",
"[",
"string",
"]",
"coreapi",
".",
"Pod",
",",
")",
"{",
"goroutines",
":=",
"maxSyncRoutines",
"\n",
"if",
"goroutines",
">",
"len",
"(",
"<mask>",
")",
"{",
"goroutines",
"=",
"len",
"(",
"jobs",
")",
"\n",
"}",
"\n",
"wg",
":=",
"&",
"sync",
".",
"WaitGroup",
"{",
"}",
"\n",
"wg",
".",
"Add",
"(",
"goroutines",
")",
"\n",
"l",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"goroutines",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"goroutines",
";",
"i",
"++",
"{",
"go",
"func",
"(",
")",
"{",
"defer",
"wg",
".",
"Done",
"(",
")",
"\n",
"for",
"pj",
":=",
"range",
"jobs",
"{",
"if",
"err",
":=",
"syncFn",
"(",
"pj",
",",
"pm",
",",
"reports",
")",
";",
"err",
"!=",
"nil",
"{",
"syncErrors",
"<-",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"}",
"\n",
"wg",
".",
"Wait",
"(",
")",
"\n",
"}"
] |
7,925 | all-7926 | [
"GetMessage",
"returns",
"the",
"comment",
"body",
"that",
"we",
"want",
"the",
"approve",
"plugin",
"to",
"display",
"on",
"PRs",
"The",
"comment",
"shows",
":",
"-",
"a",
"list",
"of",
"approvers",
"files",
"(",
"and",
"links",
")",
"needed",
"to",
"get",
"the",
"PR",
"approved",
"-",
"a",
"list",
"of",
"approvers",
"files",
"with",
"strikethroughs",
"that",
"already",
"have",
"an",
"approver",
"s",
"approval",
"-",
"a",
"suggested",
"list",
"of",
"people",
"from",
"each",
"OWNERS",
"files",
"that",
"can",
"fully",
"approve",
"the",
"PR",
"-",
"how",
"an",
"approver",
"can",
"indicate",
"their",
"approval",
"-",
"how",
"an",
"approver",
"can",
"cancel",
"their",
"approval"
] | [
"func",
"GetMessage",
"(",
"ap",
"Approvers",
",",
"linkURL",
"*",
"url",
".",
"<mask>",
",",
"org",
",",
"repo",
",",
"branch",
"string",
")",
"*",
"string",
"{",
"linkURL",
".",
"Path",
"=",
"org",
"+",
"\"",
"\"",
"+",
"repo",
"\n",
"message",
",",
"err",
":=",
"GenerateTemplate",
"(",
"`{{if (and (not .ap.RequirementsMet) (call .ap.ManuallyApproved )) }}\nApproval requirements bypassed by manually added approval.\n\n{{end -}}\nThis pull-request has been approved by:{{range $index, $approval := .ap.ListApprovals}}{{if $index}}, {{else}} {{end}}{{$approval}}{{end}}\n\n{{- if (and (not .ap.AreFilesApproved) (not (call .ap.ManuallyApproved))) }}\nTo fully approve this pull request, please assign additional approvers.\nWe suggest the following additional approver{{if ne 1 (len .ap.GetCCs)}}s{{end}}: {{range $index, $cc := .ap.GetCCs}}{{if $index}}, {{end}}**{{$cc}}**{{end}}\n\nIf they are not already assigned, you can assign the PR to them by writing `",
"+",
"\"",
"\"",
"+",
"` in a comment when ready.\n{{- end}}\n\n{{if not .ap.RequireIssue -}}\n{{else if .ap.AssociatedIssue -}}\nAssociated issue: *#{{.ap.AssociatedIssue}}*\n\n{{ else if len .ap.NoIssueApprovers -}}\nAssociated issue requirement bypassed by:{{range $index, $approval := .ap.ListNoIssueApprovals}}{{if $index}}, {{else}} {{end}}{{$approval}}{{end}}\n\n{{ else if call .ap.ManuallyApproved -}}\n*No associated issue*. Requirement bypassed by manually added approval.\n\n{{ else -}}\n*No associated issue*. Update pull-request body to add a reference to an issue, or get approval with `",
"+",
"\"",
"\"",
"+",
"`\n\n{{ end -}}\n\nThe full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo={{ .org }}%2F{{ .repo }}).\n\nThe pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)\n\n<details {{if (and (not .ap.AreFilesApproved) (not (call .ap.ManuallyApproved))) }}open{{end}}>\nNeeds approval from an approver in each of these files:\n\n{{range .ap.GetFiles .baseURL .branch}}{{.}}{{end}}\nApprovers can indicate their approval by writing `",
"+",
"\"",
"\"",
"+",
"` in a comment\nApprovers can cancel approval by writing `",
"+",
"\"",
"\"",
"+",
"` in a comment\n</details>`",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"ap",
",",
"\"",
"\"",
":",
"linkURL",
",",
"\"",
"\"",
":",
"org",
",",
"\"",
"\"",
":",
"repo",
",",
"\"",
"\"",
":",
"branch",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"ap",
".",
"owners",
".",
"log",
".",
"WithError",
"(",
"err",
")",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"message",
"+=",
"getGubernatorMetadata",
"(",
"ap",
".",
"GetCCs",
"(",
")",
")",
"\n\n",
"title",
",",
"err",
":=",
"GenerateTemplate",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"ap",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"ap",
".",
"owners",
".",
"log",
".",
"WithError",
"(",
"err",
")",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"notification",
"(",
"ApprovalNotificationName",
",",
"title",
",",
"message",
")",
"\n",
"}"
] |
7,926 | all-7927 | [
"GetResourcePolicyRequest",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockSecretsManagerAPI",
")",
"GetResourcePolicyRequest",
"(",
"arg0",
"*",
"secretsmanager",
".",
"GetResourcePolicyInput",
")",
"(",
"*",
"<mask>",
".",
"Request",
",",
"*",
"secretsmanager",
".",
"GetResourcePolicyOutput",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"request",
".",
"Request",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"*",
"secretsmanager",
".",
"GetResourcePolicyOutput",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
7,927 | all-7928 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetHeapObjectIDReturns",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeapprofiler13",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
7,928 | all-7929 | [
"/",
"*",
"UpdateVM",
"updates",
"an",
"existing",
"vm"
] | [
"func",
"(",
"a",
"*",
"Client",
")",
"UpdateVM",
"(",
"params",
"*",
"UpdateVMParams",
")",
"(",
"*",
"UpdateVMOK",
",",
"error",
")",
"{",
"// TODO: Validate the params before sending",
"if",
"params",
"==",
"nil",
"{",
"params",
"=",
"NewUpdateVMParams",
"(",
")",
"\n",
"}",
"\n\n",
"<mask>",
",",
"err",
":=",
"a",
".",
"transport",
".",
"Submit",
"(",
"&",
"runtime",
".",
"ClientOperation",
"{",
"ID",
":",
"\"",
"\"",
",",
"Method",
":",
"\"",
"\"",
",",
"PathPattern",
":",
"\"",
"\"",
",",
"ProducesMediaTypes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"ConsumesMediaTypes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"Schemes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"Params",
":",
"params",
",",
"Reader",
":",
"&",
"UpdateVMReader",
"{",
"formats",
":",
"a",
".",
"formats",
"}",
",",
"Context",
":",
"params",
".",
"Context",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
".",
"(",
"*",
"UpdateVMOK",
")",
",",
"nil",
"\n\n",
"}"
] |
7,929 | all-7930 | [
"GetNextCallsInRange",
"retrieves",
"the",
"page",
"at",
"the",
"nextPageURI",
"and",
"continues",
"retrieving",
"pages",
"until",
"any",
"results",
"are",
"found",
"in",
"the",
"range",
"given",
"by",
"start",
"or",
"end",
"or",
"we",
"determine",
"there",
"are",
"no",
"more",
"records",
"to",
"be",
"found",
"in",
"that",
"range",
".",
"If",
"CallPage",
"is",
"non",
"-",
"nil",
"it",
"will",
"have",
"at",
"least",
"one",
"result",
"."
] | [
"func",
"(",
"c",
"*",
"CallService",
")",
"GetNextCallsInRange",
"(",
"start",
"time",
".",
"Time",
",",
"end",
"time",
".",
"Time",
",",
"nextPageURI",
"string",
")",
"CallPageIterator",
"{",
"if",
"nextPageURI",
"==",
"\"",
"\"",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"iter",
":=",
"NewNextPageIterator",
"(",
"c",
".",
"<mask>",
",",
"callsPathPart",
")",
"\n",
"iter",
".",
"SetNextPageURI",
"(",
"types",
".",
"NullString",
"{",
"Valid",
":",
"true",
",",
"String",
":",
"nextPageURI",
"}",
")",
"\n",
"return",
"&",
"callDateIterator",
"{",
"start",
":",
"start",
",",
"end",
":",
"end",
",",
"p",
":",
"iter",
",",
"}",
"\n",
"}"
] |
7,930 | all-7931 | [
"read",
"parses",
"a",
"pctab",
"from",
"the",
"core",
"file",
"at",
"address",
"data",
"."
] | [
"func",
"(",
"t",
"*",
"pcTab",
")",
"read",
"(",
"core",
"*",
"core",
".",
"Process",
",",
"data",
"core",
".",
"Address",
")",
"{",
"<mask>",
"pcQuantum",
"int64",
"\n",
"switch",
"core",
".",
"Arch",
"(",
")",
"{",
"case",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
":",
"pcQuantum",
"=",
"1",
"\n",
"case",
"\"",
"\"",
":",
"pcQuantum",
"=",
"2",
"\n",
"case",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
":",
"pcQuantum",
"=",
"4",
"\n",
"default",
":",
"panic",
"(",
"\"",
"\"",
"+",
"core",
".",
"Arch",
"(",
")",
")",
"\n",
"}",
"\n",
"val",
":=",
"int64",
"(",
"-",
"1",
")",
"\n",
"first",
":=",
"true",
"\n",
"for",
"{",
"// Advance value.",
"v",
",",
"n",
":=",
"readVarint",
"(",
"core",
",",
"data",
")",
"\n",
"if",
"v",
"==",
"0",
"&&",
"!",
"first",
"{",
"return",
"\n",
"}",
"\n",
"data",
"=",
"data",
".",
"Add",
"(",
"n",
")",
"\n",
"if",
"v",
"&",
"1",
"!=",
"0",
"{",
"val",
"+=",
"^",
"(",
"v",
">>",
"1",
")",
"\n",
"}",
"else",
"{",
"val",
"+=",
"v",
">>",
"1",
"\n",
"}",
"\n\n",
"// Advance pc.",
"v",
",",
"n",
"=",
"readVarint",
"(",
"core",
",",
"data",
")",
"\n",
"data",
"=",
"data",
".",
"Add",
"(",
"n",
")",
"\n",
"t",
".",
"entries",
"=",
"append",
"(",
"t",
".",
"entries",
",",
"pcTabEntry",
"{",
"bytes",
":",
"v",
"*",
"pcQuantum",
",",
"val",
":",
"val",
"}",
")",
"\n",
"first",
"=",
"false",
"\n",
"}",
"\n",
"}"
] |
7,931 | all-7932 | [
"Set",
"the",
"name",
"/",
"value",
"pair",
"as",
"a",
"label",
"."
] | [
"func",
"(",
"b",
"*",
"Builder",
")",
"<mask>",
"(",
"n",
",",
"v",
"string",
")",
"*",
"Builder",
"{",
"for",
"i",
",",
"a",
":=",
"range",
"b",
".",
"add",
"{",
"if",
"a",
".",
"Name",
"==",
"n",
"{",
"b",
".",
"add",
"[",
"i",
"]",
".",
"Value",
"=",
"v",
"\n",
"return",
"b",
"\n",
"}",
"\n",
"}",
"\n",
"b",
".",
"add",
"=",
"append",
"(",
"b",
".",
"add",
",",
"Label",
"{",
"Name",
":",
"n",
",",
"Value",
":",
"v",
"}",
")",
"\n\n",
"return",
"b",
"\n",
"}"
] |
7,932 | all-7933 | [
"SetKeepAbove",
"is",
"a",
"wrapper",
"around",
"gtk_window_set_keep_above",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Window",
")",
"SetKeepAbove",
"(",
"setting",
"bool",
")",
"{",
"C",
".",
"gtk_window_set_keep_above",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
7,933 | all-7934 | [
"Add",
"adds",
"a",
"member",
"to",
"the",
"group",
"for",
"the",
"provided",
"interface",
"channel",
"."
] | [
"func",
"(",
"g",
"*",
"Group",
")",
"Add",
"(",
"memberChannel",
"chan",
"interface",
"{",
"}",
")",
"*",
"Member",
"{",
"g",
".",
"memberLock",
".",
"Lock",
"(",
")",
"\n",
"g",
".",
"clockLock",
".",
"Lock",
"(",
")",
"\n",
"member",
":=",
"&",
"Member",
"{",
"group",
":",
"g",
",",
"Read",
":",
"memberChannel",
",",
"clock",
":",
"g",
".",
"clock",
",",
"messageQueue",
":",
"PriorityQueue",
"{",
"}",
",",
"<mask>",
":",
"make",
"(",
"chan",
"Message",
")",
",",
"close",
":",
"make",
"(",
"chan",
"bool",
")",
",",
"}",
"\n",
"go",
"member",
".",
"listen",
"(",
")",
"\n",
"g",
".",
"members",
"=",
"append",
"(",
"g",
".",
"members",
",",
"member",
")",
"\n",
"g",
".",
"clockLock",
".",
"Unlock",
"(",
")",
"\n",
"g",
".",
"memberLock",
".",
"Unlock",
"(",
")",
"\n",
"return",
"member",
"\n",
"}"
] |
7,934 | all-7935 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"CompileScriptReturns",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime44",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
7,935 | all-7936 | [
"append",
"adds",
"s",
"to",
"the",
"end",
"of",
"os",
"only",
"if",
"it",
"is",
"not",
"included",
"already",
"."
] | [
"func",
"(",
"os",
"*",
"orderedSet",
")",
"append",
"(",
"s",
"string",
")",
"{",
"if",
"_",
",",
"ok",
":=",
"os",
".",
"included",
"[",
"s",
"]",
";",
"!",
"ok",
"{",
"os",
".",
"list",
"=",
"append",
"(",
"os",
".",
"<mask>",
",",
"s",
")",
"\n",
"os",
".",
"included",
"[",
"s",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"}"
] |
7,936 | all-7937 | [
"AddArgs",
"appends",
"arguments",
"to",
"Docker",
"container",
"."
] | [
"func",
"(",
"s",
"*",
"RunConfig",
")",
"AddArgs",
"(",
"args",
"...",
"string",
")",
"{",
"s",
".",
"Args",
"=",
"<mask>",
"(",
"s",
".",
"Args",
",",
"args",
"...",
")",
"\n",
"}"
] |
7,937 | all-7938 | [
"AddStdLevel",
"adds",
"std",
"log",
"level",
"and",
"returns",
"LEVEL"
] | [
"func",
"(",
"g",
"*",
"Glg",
")",
"AddStdLevel",
"(",
"tag",
"string",
",",
"mode",
"MODE",
",",
"isColor",
"bool",
")",
"*",
"Glg",
"{",
"atomic",
".",
"AddUint32",
"(",
"g",
".",
"levelCounter",
",",
"1",
")",
"\n",
"lev",
":=",
"LEVEL",
"(",
"atomic",
".",
"LoadUint32",
"(",
"g",
".",
"levelCounter",
")",
")",
"\n",
"g",
".",
"levelMap",
".",
"Store",
"(",
"tag",
",",
"lev",
")",
"\n",
"l",
":=",
"&",
"logger",
"{",
"writer",
":",
"nil",
",",
"std",
":",
"os",
".",
"Stdout",
",",
"color",
":",
"Colorless",
",",
"isColor",
":",
"isColor",
",",
"mode",
":",
"mode",
",",
"tag",
":",
"<mask>",
",",
"}",
"\n",
"l",
".",
"updateMode",
"(",
")",
"\n",
"g",
".",
"logger",
".",
"Store",
"(",
"lev",
",",
"l",
")",
"\n",
"return",
"g",
"\n",
"}"
] |
7,938 | all-7939 | [
"AppendChild",
"appends",
"the",
"child",
"element",
"to",
"the",
"element",
"."
] | [
"func",
"(",
"e",
"*",
"elementBase",
")",
"AppendChild",
"(",
"<mask>",
"element",
")",
"{",
"e",
".",
"children",
"=",
"append",
"(",
"e",
".",
"children",
",",
"child",
")",
"\n",
"}"
] |
7,939 | all-7940 | [
"GenerateAvatar",
"generates",
"an",
"avatar",
"(",
"image",
".",
"RGBA",
")",
"using",
"the",
"given",
"string",
"as",
"a",
"random",
"seed",
"."
] | [
"func",
"GenerateAvatar",
"(",
"input",
"string",
",",
"blockSize",
"int",
",",
"borderSize",
"int",
")",
"*",
"image",
".",
"RGBA",
"{",
"hash",
":=",
"hashMd5",
"(",
"input",
")",
"\n\n",
"pic",
":=",
"[",
"size",
"]",
"[",
"size",
"]",
"bool",
"{",
"}",
"\n\n",
"for",
"i",
":=",
"size",
"-",
"4",
";",
"i",
">=",
"0",
";",
"i",
"--",
"{",
"for",
"j",
":=",
"size",
"-",
"1",
";",
"j",
">=",
"0",
";",
"j",
"--",
"{",
"if",
"strings",
".",
"Contains",
"(",
"low",
",",
"string",
"(",
"hash",
"[",
"size",
"-",
"1",
"*",
"i",
"+",
"j",
"]",
")",
")",
"{",
"pic",
"[",
"j",
"]",
"[",
"i",
"]",
"=",
"true",
"\n",
"pic",
"[",
"j",
"]",
"[",
"size",
"-",
"1",
"-",
"i",
"]",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"i",
":=",
"size",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
"{",
"if",
"strings",
".",
"Contains",
"(",
"low",
",",
"string",
"(",
"<mask>",
"[",
"i",
"]",
")",
")",
"{",
"pic",
"[",
"i",
"]",
"[",
"int",
"(",
"math",
".",
"Ceil",
"(",
"size",
"/",
"2",
")",
")",
"]",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"avatar",
":=",
"image",
".",
"NewRGBA",
"(",
"image",
".",
"Rect",
"(",
"0",
",",
"0",
",",
"blockSize",
"*",
"size",
"+",
"borderSize",
"*",
"2",
",",
"blockSize",
"*",
"size",
"+",
"borderSize",
"*",
"2",
")",
")",
"\n",
"bgColor",
":=",
"calcBgColor",
"(",
")",
"\n\n",
"for",
"x",
":=",
"0",
";",
"x",
"<",
"avatar",
".",
"Bounds",
"(",
")",
".",
"Dx",
"(",
")",
";",
"x",
"++",
"{",
"for",
"y",
":=",
"0",
";",
"y",
"<",
"avatar",
".",
"Bounds",
"(",
")",
".",
"Dy",
"(",
")",
";",
"y",
"++",
"{",
"avatar",
".",
"SetRGBA",
"(",
"x",
",",
"y",
",",
"bgColor",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"color",
":=",
"calcPixelColor",
"(",
"input",
")",
"\n\n",
"for",
"x",
":=",
"0",
";",
"x",
"<",
"len",
"(",
"pic",
")",
";",
"x",
"++",
"{",
"for",
"y",
":=",
"0",
";",
"y",
"<",
"len",
"(",
"pic",
"[",
"x",
"]",
")",
";",
"y",
"++",
"{",
"if",
"pic",
"[",
"x",
"]",
"[",
"y",
"]",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"blockSize",
";",
"i",
"++",
"{",
"for",
"j",
":=",
"0",
";",
"j",
"<",
"blockSize",
";",
"j",
"++",
"{",
"avatar",
".",
"SetRGBA",
"(",
"borderSize",
"+",
"x",
"*",
"blockSize",
"+",
"i",
",",
"borderSize",
"+",
"y",
"*",
"blockSize",
"+",
"j",
",",
"color",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"avatar",
"\n",
"}"
] |
7,940 | all-7941 | [
"RepositoryName",
"returns",
"github",
"s",
"repository",
"name",
"in",
"the",
"form",
"of",
"org",
"/",
"project"
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"RepositoryName",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"Org",
",",
"client",
".",
"Project",
")",
"\n",
"}"
] |
7,941 | all-7942 | [
"ConfigValueSet",
"is",
"a",
"convenience",
"to",
"set",
"a",
"cluster",
"-",
"level",
"key",
"/",
"value",
"config",
"pair",
"in",
"a",
"single",
"transaction",
"."
] | [
"func",
"ConfigValueSet",
"(",
"c",
"*",
"Cluster",
",",
"key",
"string",
",",
"value",
"string",
")",
"error",
"{",
"err",
":=",
"c",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"ClusterTx",
")",
"error",
"{",
"_",
",",
"err",
":=",
"tx",
".",
"tx",
".",
"Exec",
"(",
"\"",
"\"",
",",
"key",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"value",
"!=",
"\"",
"\"",
"{",
"str",
":=",
"`INSERT INTO config (key, value) VALUES (?, ?);`",
"\n",
"stmt",
",",
"err",
":=",
"tx",
".",
"tx",
".",
"Prepare",
"(",
"str",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"stmt",
".",
"Close",
"(",
")",
"\n",
"_",
",",
"err",
"=",
"stmt",
".",
"Exec",
"(",
"key",
",",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
7,942 | all-7943 | [
"NewHTTPServer",
"returns",
"a",
"Pachyderm",
"HTTP",
"server",
"."
] | [
"func",
"NewHTTPServer",
"(",
"address",
"string",
")",
"(",
"http",
".",
"<mask>",
",",
"error",
")",
"{",
"router",
":=",
"httprouter",
".",
"New",
"(",
")",
"\n",
"s",
":=",
"&",
"server",
"{",
"router",
":",
"router",
",",
"address",
":",
"address",
",",
"httpClient",
":",
"&",
"http",
".",
"Client",
"{",
"}",
",",
"}",
"\n\n",
"router",
".",
"GET",
"(",
"getFilePath",
",",
"s",
".",
"getFileHandler",
")",
"\n",
"router",
".",
"GET",
"(",
"servicePath",
",",
"s",
".",
"serviceHandler",
")",
"\n\n",
"router",
".",
"POST",
"(",
"loginPath",
",",
"s",
".",
"authLoginHandler",
")",
"\n",
"router",
".",
"POST",
"(",
"logoutPath",
",",
"s",
".",
"authLogoutHandler",
")",
"\n",
"router",
".",
"POST",
"(",
"servicePath",
",",
"s",
".",
"serviceHandler",
")",
"\n\n",
"router",
".",
"NotFound",
"=",
"http",
".",
"HandlerFunc",
"(",
"notFound",
")",
"\n",
"return",
"s",
",",
"nil",
"\n",
"}"
] |
7,943 | all-7944 | [
"Spawn",
"the",
"editor",
"with",
"a",
"temporary",
"YAML",
"file",
"for",
"editing",
"configs"
] | [
"func",
"TextEditor",
"(",
"inPath",
"string",
",",
"inContent",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"var",
"f",
"*",
"os",
".",
"File",
"\n",
"var",
"err",
"error",
"\n",
"var",
"path",
"string",
"\n\n",
"// Detect the text editor to use",
"editor",
":=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"\n",
"if",
"editor",
"==",
"\"",
"\"",
"{",
"editor",
"=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"\n",
"if",
"editor",
"==",
"\"",
"\"",
"{",
"for",
"_",
",",
"p",
":=",
"range",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"{",
"_",
",",
"err",
":=",
"<mask>",
".",
"LookPath",
"(",
"p",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"editor",
"=",
"p",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"editor",
"==",
"\"",
"\"",
"{",
"return",
"[",
"]",
"byte",
"{",
"}",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"inPath",
"==",
"\"",
"\"",
"{",
"// If provided input, create a new file",
"f",
",",
"err",
"=",
"ioutil",
".",
"TempFile",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"byte",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"os",
".",
"Chmod",
"(",
"f",
".",
"Name",
"(",
")",
",",
"0600",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"f",
".",
"Close",
"(",
")",
"\n",
"os",
".",
"Remove",
"(",
"f",
".",
"Name",
"(",
")",
")",
"\n",
"return",
"[",
"]",
"byte",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"f",
".",
"Write",
"(",
"inContent",
")",
"\n",
"f",
".",
"Close",
"(",
")",
"\n\n",
"path",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"f",
".",
"Name",
"(",
")",
")",
"\n",
"os",
".",
"Rename",
"(",
"f",
".",
"Name",
"(",
")",
",",
"path",
")",
"\n",
"defer",
"os",
".",
"Remove",
"(",
"path",
")",
"\n",
"}",
"else",
"{",
"path",
"=",
"inPath",
"\n",
"}",
"\n\n",
"cmdParts",
":=",
"strings",
".",
"Fields",
"(",
"editor",
")",
"\n",
"cmd",
":=",
"exec",
".",
"Command",
"(",
"cmdParts",
"[",
"0",
"]",
",",
"append",
"(",
"cmdParts",
"[",
"1",
":",
"]",
",",
"path",
")",
"...",
")",
"\n",
"cmd",
".",
"Stdin",
"=",
"os",
".",
"Stdin",
"\n",
"cmd",
".",
"Stdout",
"=",
"os",
".",
"Stdout",
"\n",
"cmd",
".",
"Stderr",
"=",
"os",
".",
"Stderr",
"\n",
"err",
"=",
"cmd",
".",
"Run",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"byte",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"content",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"byte",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"content",
",",
"nil",
"\n",
"}"
] |
7,944 | all-7945 | [
"isSafeRetryImmutableRPC",
"returns",
"true",
"when",
"an",
"immutable",
"request",
"is",
"safe",
"for",
"retry",
".",
"immutable",
"requests",
"(",
"e",
".",
"g",
".",
"Get",
")",
"should",
"be",
"retried",
"unless",
"it",
"s",
"an",
"obvious",
"server",
"-",
"side",
"error",
"(",
"e",
".",
"g",
".",
"rpctypes",
".",
"ErrRequestTooLarge",
")",
".",
"Returning",
"false",
"means",
"retry",
"should",
"stop",
"since",
"client",
"cannot",
"handle",
"itself",
"even",
"with",
"retries",
"."
] | [
"func",
"isSafeRetryImmutableRPC",
"(",
"err",
"error",
")",
"bool",
"{",
"eErr",
":=",
"rpctypes",
".",
"Error",
"(",
"err",
")",
"\n",
"if",
"serverErr",
",",
"ok",
":=",
"eErr",
".",
"(",
"rpctypes",
".",
"EtcdError",
")",
";",
"ok",
"&&",
"serverErr",
".",
"Code",
"(",
")",
"!=",
"codes",
".",
"Unavailable",
"{",
"// interrupted by non-transient server-side or gRPC-side error",
"// client cannot handle itself (e.g. rpctypes.ErrCompacted)",
"return",
"false",
"\n",
"}",
"\n",
"// only retry if unavailable",
"ev",
",",
"ok",
":=",
"status",
".",
"FromError",
"(",
"err",
")",
"\n",
"if",
"!",
"<mask>",
"{",
"// all errors from RPC is typed \"grpc/status.(*statusError)\"",
"// (ref. https://github.com/grpc/grpc-go/pull/1782)",
"//",
"// if the error type is not \"grpc/status.(*statusError)\",",
"// it could be from \"Dial\"",
"// TODO: do not retry for now",
"// ref. https://github.com/grpc/grpc-go/issues/1581",
"return",
"false",
"\n",
"}",
"\n",
"return",
"ev",
".",
"Code",
"(",
")",
"==",
"codes",
".",
"Unavailable",
"\n",
"}"
] |
7,945 | all-7946 | [
"GetInt64PtrEmptyZero",
"reads",
"a",
"ResourceData",
"and",
"returns",
"an",
"appropriate",
"*",
"int64",
"for",
"the",
"state",
"of",
"the",
"definition",
".",
"0",
"is",
"returned",
"if",
"it",
"does",
"not",
"exist",
"."
] | [
"func",
"GetInt64PtrEmptyZero",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"key",
"string",
")",
"*",
"int64",
"{",
"i",
":=",
"GetInt64Ptr",
"(",
"d",
",",
"<mask>",
")",
"\n",
"if",
"i",
"!=",
"nil",
"{",
"return",
"i",
"\n",
"}",
"\n",
"return",
"Int64Ptr",
"(",
"int64",
"(",
"0",
")",
")",
"\n",
"}"
] |
7,946 | all-7947 | [
"Value",
"returns",
"the",
"value",
"associated",
"with",
"this",
"context",
"for",
"key",
"or",
"nil",
"if",
"no",
"value",
"is",
"associated",
"with",
"key",
".",
"Successive",
"calls",
"to",
"Value",
"with",
"the",
"same",
"key",
"returns",
"the",
"same",
"result",
".",
"This",
"method",
"is",
"present",
"to",
"make",
"RequestCtx",
"implement",
"the",
"context",
"interface",
".",
"This",
"method",
"is",
"the",
"same",
"as",
"calling",
"ctx",
".",
"UserValue",
"(",
"key",
")"
] | [
"func",
"(",
"ctx",
"*",
"RequestCtx",
")",
"Value",
"(",
"key",
"interface",
"{",
"}",
")",
"interface",
"{",
"}",
"{",
"if",
"keyString",
",",
"ok",
":=",
"<mask>",
".",
"(",
"string",
")",
";",
"ok",
"{",
"return",
"ctx",
".",
"UserValue",
"(",
"keyString",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,947 | all-7948 | [
"updateVMX",
"updates",
"VMX",
"file",
"for",
"the",
"VM",
"."
] | [
"func",
"(",
"v",
"*",
"VM",
")",
"updateVMX",
"(",
"updateFunc",
"func",
"(",
"model",
"*",
"vmx",
".",
"VirtualMachine",
")",
"error",
")",
"error",
"{",
"isVMRunning",
",",
"err",
":=",
"v",
".",
"IsRunning",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"isVMRunning",
"{",
"return",
"&",
"Error",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"100000",
",",
"<mask>",
":",
"\"",
"\"",
",",
"}",
"\n",
"}",
"\n\n",
"err",
"=",
"v",
".",
"vmxfile",
".",
"Read",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"&",
"Error",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"300001",
",",
"Text",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
",",
"}",
"\n",
"}",
"\n\n",
"err",
"=",
"updateFunc",
"(",
"v",
".",
"vmxfile",
".",
"model",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"&",
"Error",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"300002",
",",
"Text",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
",",
"}",
"\n",
"}",
"\n\n",
"err",
"=",
"v",
".",
"vmxfile",
".",
"Write",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"&",
"Error",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"300003",
",",
"Text",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
7,948 | all-7949 | [
"SetRequestURI",
"sets",
"RequestURI",
"for",
"the",
"first",
"HTTP",
"request",
"line",
".",
"RequestURI",
"must",
"be",
"properly",
"encoded",
".",
"Use",
"URI",
".",
"RequestURI",
"for",
"constructing",
"proper",
"RequestURI",
"if",
"unsure",
"."
] | [
"func",
"(",
"h",
"*",
"RequestHeader",
")",
"SetRequestURI",
"(",
"requestURI",
"string",
")",
"{",
"h",
".",
"requestURI",
"=",
"<mask>",
"(",
"h",
".",
"requestURI",
"[",
":",
"0",
"]",
",",
"requestURI",
"...",
")",
"\n",
"}"
] |
7,949 | all-7950 | [
"SetIcon",
"is",
"a",
"wrapper",
"around",
"gtk_window_set_icon",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Window",
")",
"SetIcon",
"(",
"icon",
"*",
"gdk",
".",
"Pixbuf",
")",
"{",
"iconPtr",
":=",
"(",
"*",
"C",
".",
"GdkPixbuf",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
".",
"Native",
"(",
")",
")",
")",
"\n",
"C",
".",
"gtk_window_set_icon",
"(",
"v",
".",
"native",
"(",
")",
",",
"iconPtr",
")",
"\n",
"}"
] |
7,950 | all-7951 | [
"IdentityProviderLocator",
"builds",
"a",
"locator",
"from",
"the",
"given",
"href",
"."
] | [
"func",
"(",
"api",
"*",
"API",
")",
"IdentityProviderLocator",
"(",
"href",
"string",
")",
"*",
"IdentityProviderLocator",
"{",
"<mask>",
"&",
"IdentityProviderLocator",
"{",
"Href",
"(",
"href",
")",
",",
"api",
"}",
"\n",
"}"
] |
7,951 | all-7952 | [
"CompareAndSwapMulti",
"is",
"a",
"batch",
"version",
"of",
"CompareAndSwap",
".",
"appengine",
".",
"MultiError",
"may",
"be",
"returned",
"."
] | [
"func",
"(",
"cd",
"Codec",
")",
"CompareAndSwapMulti",
"(",
"c",
"context",
".",
"Context",
",",
"items",
"[",
"]",
"*",
"Item",
")",
"error",
"{",
"return",
"cd",
".",
"<mask>",
"(",
"c",
",",
"items",
",",
"pb",
".",
"MemcacheSetRequest_CAS",
")",
"\n",
"}"
] |
7,952 | all-7953 | [
"NewAPIAnalyzer",
"is",
"the",
"factory",
"method",
"for",
"the",
"API",
"analyzer"
] | [
"func",
"NewAPIAnalyzer",
"(",
"resources",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"attributeTypes",
"<mask>",
"[",
"string",
"]",
"string",
")",
"*",
"APIAnalyzer",
"{",
"return",
"&",
"APIAnalyzer",
"{",
"rawResources",
":",
"resources",
",",
"attributeTypes",
":",
"attributeTypes",
",",
"rawTypes",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"gen",
".",
"ObjectDataType",
")",
",",
"}",
"\n",
"}"
] |
7,953 | all-7954 | [
"MustQSetHash",
"retrieves",
"the",
"QSetHash",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"StellarMessage",
")",
"MustQSetHash",
"(",
")",
"Uint256",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetQSetHash",
"(",
")",
"\n\n",
"if",
"!",
"<mask>",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
7,954 | all-7955 | [
"Generate",
"a",
"Random",
"secret",
"encoded",
"as",
"a",
"b32",
"string",
"If",
"the",
"length",
"is",
"<",
"=",
"0",
"a",
"default",
"length",
"of",
"10",
"bytes",
"will",
"be",
"used",
"which",
"will",
"generate",
"a",
"secret",
"of",
"length",
"16",
"."
] | [
"func",
"RandomSecret",
"(",
"length",
"int",
",",
"rnd",
"*",
"rand",
".",
"Rand",
")",
"string",
"{",
"if",
"0",
"<=",
"length",
"{",
"length",
"=",
"10",
"\n",
"}",
"\n",
"secret",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"length",
")",
"\n",
"for",
"i",
",",
"_",
":=",
"range",
"<mask>",
"{",
"secret",
"[",
"i",
"]",
"=",
"byte",
"(",
"rnd",
".",
"Int31",
"(",
")",
"%",
"256",
")",
"\n",
"}",
"\n",
"return",
"base32",
".",
"StdEncoding",
".",
"EncodeToString",
"(",
"secret",
")",
"\n",
"}"
] |
7,955 | all-7956 | [
"Accept",
"waits",
"for",
"and",
"returns",
"the",
"next",
"incoming",
"TLS",
"connection",
".",
"The",
"returned",
"connection",
"c",
"is",
"a",
"*",
"tls",
".",
"Conn",
"."
] | [
"func",
"(",
"l",
"*",
"tlsKeepaliveListener",
")",
"Accept",
"(",
")",
"(",
"c",
"net",
".",
"Conn",
",",
"err",
"error",
")",
"{",
"c",
",",
"err",
"=",
"l",
".",
"Listener",
".",
"Accept",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"kac",
":=",
"c",
".",
"(",
"keepAliveConn",
")",
"\n",
"// detection time: tcp_keepalive_time + tcp_keepalive_probes + tcp_keepalive_intvl",
"// default on linux: 30 + 8 * 30",
"// default on osx: 30 + 8 * 75",
"kac",
".",
"SetKeepAlive",
"(",
"true",
")",
"\n",
"kac",
".",
"SetKeepAlivePeriod",
"(",
"30",
"*",
"<mask>",
".",
"Second",
")",
"\n",
"c",
"=",
"tls",
".",
"Server",
"(",
"c",
",",
"l",
".",
"config",
")",
"\n",
"return",
"c",
",",
"nil",
"\n",
"}"
] |
7,956 | all-7957 | [
"RemoveAllServers",
"stops",
"all",
"remote",
"Pact",
"Mock",
"Servers",
"."
] | [
"func",
"(",
"p",
"*",
"mockClient",
")",
"RemoveAllServers",
"(",
"<mask>",
"*",
"types",
".",
"MockServer",
")",
"[",
"]",
"*",
"types",
".",
"MockServer",
"{",
"return",
"p",
".",
"RemoveAllServersResponse",
"\n",
"}"
] |
7,957 | all-7958 | [
"StoragePoolNodeVolumeGetTypeByProject",
"gets",
"a",
"single",
"storage",
"volume",
"attached",
"to",
"a",
"given",
"storage",
"pool",
"of",
"a",
"given",
"type",
"on",
"the",
"current",
"node",
"in",
"the",
"given",
"project",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"StoragePoolNodeVolumeGetTypeByProject",
"(",
"project",
",",
"volumeName",
"string",
",",
"volumeType",
"int",
",",
"poolID",
"int64",
")",
"(",
"int64",
",",
"*",
"api",
".",
"StorageVolume",
",",
"error",
")",
"{",
"return",
"c",
".",
"StoragePoolVolumeGetType",
"(",
"<mask>",
",",
"volumeName",
",",
"volumeType",
",",
"poolID",
",",
"c",
".",
"nodeID",
")",
"\n",
"}"
] |
7,958 | all-7959 | [
"MarshalString",
"appends",
"the",
"uint32",
"to",
"the",
"buffer",
"."
] | [
"func",
"(",
"m",
"*",
"Marshaller",
")",
"MarshalUint32",
"(",
"v",
"uint32",
")",
"{",
"if",
"m",
".",
"Error",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"if",
"len",
"(",
"m",
".",
"Data",
")",
"<",
"m",
".",
"offset",
"+",
"4",
"{",
"m",
".",
"Error",
"=",
"io",
".",
"ErrShortBuffer",
"\n",
"return",
"\n",
"}",
"\n\n",
"m",
".",
"Data",
"[",
"m",
".",
"offset",
"+",
"0",
"]",
"=",
"byte",
"(",
"v",
">>",
"24",
")",
"\n",
"m",
".",
"Data",
"[",
"m",
".",
"<mask>",
"+",
"1",
"]",
"=",
"byte",
"(",
"v",
">>",
"16",
")",
"\n",
"m",
".",
"Data",
"[",
"m",
".",
"offset",
"+",
"2",
"]",
"=",
"byte",
"(",
"v",
">>",
"8",
")",
"\n",
"m",
".",
"Data",
"[",
"m",
".",
"offset",
"+",
"3",
"]",
"=",
"byte",
"(",
"v",
")",
"\n",
"m",
".",
"offset",
"+=",
"4",
"\n",
"}"
] |
7,959 | all-7960 | [
"Client",
"returns",
"an",
"*",
"http",
".",
"Client",
"using",
"a",
"default",
"urlfetch",
"Transport",
".",
"This",
"client",
"will",
"have",
"the",
"default",
"deadline",
"of",
"5",
"seconds",
"and",
"will",
"check",
"the",
"validity",
"of",
"SSL",
"certificates",
".",
"Any",
"deadline",
"of",
"the",
"provided",
"context",
"will",
"be",
"used",
"for",
"requests",
"through",
"this",
"client",
";",
"if",
"the",
"client",
"does",
"not",
"have",
"a",
"deadline",
"then",
"a",
"5",
"second",
"default",
"is",
"used",
"."
] | [
"func",
"Client",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"*",
"http",
".",
"Client",
"{",
"return",
"&",
"http",
".",
"Client",
"{",
"Transport",
":",
"&",
"Transport",
"{",
"Context",
":",
"ctx",
",",
"}",
",",
"}",
"\n",
"}"
] |
7,960 | all-7961 | [
"routeHTTP",
"routes",
"a",
"http",
".",
"Request",
"through",
"the",
"Mux",
"routing",
"tree",
"to",
"serve",
"the",
"matching",
"handler",
"for",
"a",
"particular",
"http",
"method",
"."
] | [
"func",
"(",
"mx",
"*",
"Mux",
")",
"routeHTTP",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"// Grab the route context object",
"rctx",
":=",
"r",
".",
"Context",
"(",
")",
".",
"Value",
"(",
"RouteCtxKey",
")",
".",
"(",
"*",
"Context",
")",
"\n\n",
"// The request routing path",
"routePath",
":=",
"rctx",
".",
"RoutePath",
"\n",
"if",
"routePath",
"==",
"\"",
"\"",
"{",
"if",
"r",
".",
"URL",
".",
"RawPath",
"!=",
"\"",
"\"",
"{",
"routePath",
"=",
"r",
".",
"URL",
".",
"RawPath",
"\n",
"}",
"else",
"{",
"routePath",
"=",
"r",
".",
"URL",
".",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Check if method is supported by chi",
"if",
"rctx",
".",
"RouteMethod",
"==",
"\"",
"\"",
"{",
"rctx",
".",
"RouteMethod",
"=",
"r",
".",
"Method",
"\n",
"}",
"\n",
"method",
",",
"ok",
":=",
"methodMap",
"[",
"rctx",
".",
"RouteMethod",
"]",
"\n",
"if",
"!",
"ok",
"{",
"mx",
".",
"MethodNotAllowedHandler",
"(",
")",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// Find the route",
"if",
"_",
",",
"_",
",",
"h",
":=",
"mx",
".",
"tree",
".",
"FindRoute",
"(",
"rctx",
",",
"method",
",",
"routePath",
")",
";",
"h",
"!=",
"nil",
"{",
"h",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"rctx",
".",
"methodNotAllowed",
"{",
"mx",
".",
"MethodNotAllowedHandler",
"(",
")",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"else",
"{",
"mx",
".",
"NotFoundHandler",
"(",
")",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"\n",
"}"
] |
7,961 | all-7962 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetNavigationHistoryReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage34",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
7,962 | all-7963 | [
"Name",
"sets",
"name",
"of",
"ComboRouter",
"route",
"."
] | [
"func",
"(",
"cr",
"*",
"ComboRouter",
")",
"Name",
"(",
"<mask>",
"string",
")",
"{",
"if",
"cr",
".",
"lastRoute",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"cr",
".",
"lastRoute",
".",
"Name",
"(",
"name",
")",
"\n",
"}"
] |
7,963 | all-7964 | [
"establish",
"data",
"storage",
"format",
"dimensions",
"and",
"sample",
"count",
"of",
"a",
"renderbuffer",
"object",
"s",
"image"
] | [
"func",
"RenderbufferStorageMultisample",
"(",
"target",
"uint32",
",",
"samples",
"int32",
",",
"internalformat",
"uint32",
",",
"width",
"int32",
",",
"height",
"int32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpRenderbufferStorageMultisample",
",",
"5",
",",
"uintptr",
"(",
"target",
")",
",",
"uintptr",
"(",
"samples",
")",
",",
"uintptr",
"(",
"internalformat",
")",
",",
"uintptr",
"(",
"width",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"0",
")",
"\n",
"}"
] |
7,964 | all-7965 | [
"Serialize",
"returns",
"the",
"manifest",
"in",
"a",
"blob",
"format",
".",
"NOTE",
":",
"Serialize",
"()",
"does",
"not",
"in",
"general",
"reproduce",
"the",
"original",
"blob",
"if",
"this",
"object",
"was",
"loaded",
"from",
"one",
"even",
"if",
"no",
"modifications",
"were",
"made!"
] | [
"func",
"(",
"m",
"*",
"Schema1",
")",
"Serialize",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"// docker/distribution requires a signature even if the incoming data uses the nominally unsigned DockerV2Schema1MediaType.",
"unsigned",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"*",
"m",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"AddDummyV2S1Signature",
"(",
"unsigned",
")",
"\n",
"}"
] |
7,965 | all-7966 | [
"Log",
"calls",
"UI",
".",
"Log",
"to",
"write",
".",
"LogPrefix",
"is",
"used",
"to",
"prefix",
"the",
"message",
"."
] | [
"func",
"(",
"ui",
"*",
"PrefixUI",
")",
"Log",
"(",
"message",
"string",
")",
"{",
"if",
"ui",
".",
"LogPrefix",
"==",
"\"",
"\"",
"{",
"//Lets keep the space if they want one",
"message",
"=",
"ui",
".",
"LogPrefix",
"+",
"message",
"\n",
"}",
"else",
"if",
"ui",
".",
"LogPrefix",
"!=",
"\"",
"\"",
"{",
"message",
"=",
"ui",
".",
"LogPrefix",
"+",
"\"",
"\"",
"+",
"<mask>",
"\n",
"}",
"\n",
"ui",
".",
"UI",
".",
"Log",
"(",
"message",
")",
"\n",
"}"
] |
7,966 | all-7967 | [
"AddMulti",
"is",
"a",
"batch",
"version",
"of",
"Add",
".",
"appengine",
".",
"MultiError",
"may",
"be",
"returned",
"."
] | [
"func",
"AddMulti",
"(",
"c",
"context",
".",
"Context",
",",
"item",
"[",
"]",
"*",
"Item",
")",
"error",
"{",
"return",
"<mask>",
"(",
"c",
",",
"item",
",",
"nil",
",",
"pb",
".",
"MemcacheSetRequest_ADD",
")",
"\n",
"}"
] |
7,967 | all-7968 | [
"authEnableCommandFunc",
"executes",
"the",
"auth",
"enable",
"command",
"."
] | [
"func",
"authEnableCommandFunc",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"if",
"len",
"(",
"args",
")",
"!=",
"0",
"{",
"ExitWithError",
"(",
"ExitBadArgs",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"ctx",
",",
"cancel",
":=",
"commandCtx",
"(",
"cmd",
")",
"\n",
"cli",
":=",
"mustClientFromCmd",
"(",
"cmd",
")",
"\n",
"var",
"err",
"error",
"\n",
"for",
"err",
"==",
"nil",
"{",
"if",
"_",
",",
"err",
"=",
"cli",
".",
"AuthEnable",
"(",
"ctx",
")",
";",
"err",
"==",
"nil",
"{",
"break",
"\n",
"}",
"\n",
"if",
"err",
"==",
"rpctypes",
".",
"ErrRootRoleNotExist",
"{",
"if",
"_",
",",
"err",
"=",
"cli",
".",
"RoleAdd",
"(",
"ctx",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"break",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
"=",
"cli",
".",
"UserGrantRole",
"(",
"ctx",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"cancel",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"ExitWithError",
"(",
"ExitError",
",",
"err",
")",
"\n",
"}",
"\n\n",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
7,968 | all-7969 | [
"SplitPortProto",
"splits",
"a",
"string",
"in",
"the",
"format",
"port",
"/",
"protocol",
"defaulting",
"protocol",
"to",
"tcp",
"if",
"not",
"provided",
"."
] | [
"func",
"SplitPortProto",
"(",
"raw",
"string",
")",
"(",
"port",
"string",
",",
"protocol",
"string",
")",
"{",
"parts",
":=",
"strings",
".",
"SplitN",
"(",
"raw",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"parts",
")",
"==",
"1",
"{",
"return",
"parts",
"[",
"0",
"]",
",",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"parts",
"[",
"0",
"]",
",",
"<mask>",
"[",
"1",
"]",
"\n",
"}"
] |
7,969 | all-7970 | [
"Facilities",
"returns",
"the",
"currently",
"known",
"set",
"of",
"facilities",
"both",
"those",
"for",
"which",
"debug",
"is",
"enabled",
"and",
"those",
"for",
"which",
"it",
"is",
"disabled",
"."
] | [
"func",
"(",
"l",
"*",
"logger",
")",
"Facilities",
"(",
")",
"(",
"enabled",
",",
"disabled",
"[",
"]",
"string",
")",
"{",
"l",
".",
"mut",
".",
"Lock",
"(",
")",
"\n",
"for",
"facility",
",",
"isEnabled",
":=",
"range",
"l",
".",
"debug",
"{",
"if",
"isEnabled",
"{",
"enabled",
"=",
"<mask>",
"(",
"enabled",
",",
"facility",
")",
"\n",
"}",
"else",
"{",
"disabled",
"=",
"append",
"(",
"disabled",
",",
"facility",
")",
"\n",
"}",
"\n",
"}",
"\n",
"l",
".",
"mut",
".",
"Unlock",
"(",
")",
"\n",
"return",
"\n",
"}"
] |
7,970 | all-7971 | [
"Tracef",
"formats",
"message",
"according",
"to",
"format",
"specifier",
"prepends",
"the",
"prefix",
"as",
"necessary",
"and",
"writes",
"to",
"log",
"with",
"LevelTrace",
".",
"This",
"is",
"part",
"of",
"the",
"Logger",
"interface",
"implementation",
"."
] | [
"func",
"(",
"l",
"*",
"slog",
")",
"Tracef",
"(",
"format",
"string",
",",
"args",
"...",
"<mask>",
"{",
"}",
")",
"{",
"lvl",
":=",
"l",
".",
"Level",
"(",
")",
"\n",
"if",
"lvl",
"<=",
"LevelTrace",
"{",
"l",
".",
"b",
".",
"printf",
"(",
"\"",
"\"",
",",
"l",
".",
"tag",
",",
"format",
",",
"args",
"...",
")",
"\n",
"}",
"\n",
"}"
] |
7,971 | all-7972 | [
"SetSingleLineMode",
"is",
"a",
"wrapper",
"around",
"gtk_label_set_single_line_mode",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetSingleLineMode",
"(",
"mode",
"bool",
")",
"{",
"C",
".",
"gtk_label_set_single_line_mode",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"mode",
")",
")",
"\n",
"}"
] |
7,972 | all-7973 | [
"v2HandlersSetup",
"adds",
"all",
"handlers",
"in",
"v2",
"package",
"to",
"the",
"mux",
"router",
"."
] | [
"func",
"v2HandlersSetup",
"(",
"muxRouter",
"*",
"mux",
".",
"Router",
",",
"state",
"dockerstate",
".",
"TaskEngineState",
",",
"ecsClient",
"api",
".",
"ECSClient",
",",
"statsEngine",
"stats",
".",
"Engine",
",",
"cluster",
"string",
",",
"credentialsManager",
"credentials",
".",
"Manager",
",",
"auditLogger",
"audit",
".",
"AuditLogger",
",",
"availabilityZone",
"string",
",",
"containerInstanceArn",
"string",
")",
"{",
"muxRouter",
".",
"HandleFunc",
"(",
"v2",
".",
"CredentialsPath",
",",
"v2",
".",
"CredentialsHandler",
"(",
"credentialsManager",
",",
"auditLogger",
")",
")",
"\n",
"muxRouter",
".",
"HandleFunc",
"(",
"v2",
".",
"ContainerMetadataPath",
",",
"v2",
".",
"TaskContainerMetadataHandler",
"(",
"state",
",",
"ecsClient",
",",
"cluster",
",",
"availabilityZone",
",",
"containerInstanceArn",
",",
"false",
")",
")",
"\n",
"muxRouter",
".",
"HandleFunc",
"(",
"v2",
".",
"TaskMetadataPath",
",",
"v2",
".",
"TaskContainerMetadataHandler",
"(",
"state",
",",
"ecsClient",
",",
"cluster",
",",
"availabilityZone",
",",
"containerInstanceArn",
",",
"false",
")",
")",
"\n",
"muxRouter",
".",
"HandleFunc",
"(",
"v2",
".",
"TaskWithTagsMetadataPath",
",",
"v2",
".",
"TaskContainerMetadataHandler",
"(",
"state",
",",
"ecsClient",
",",
"cluster",
",",
"availabilityZone",
",",
"containerInstanceArn",
",",
"true",
")",
")",
"\n",
"muxRouter",
".",
"HandleFunc",
"(",
"v2",
".",
"TaskMetadataPathWithSlash",
",",
"v2",
".",
"TaskContainerMetadataHandler",
"(",
"state",
",",
"ecsClient",
",",
"cluster",
",",
"availabilityZone",
",",
"containerInstanceArn",
",",
"false",
")",
")",
"\n",
"muxRouter",
".",
"HandleFunc",
"(",
"v2",
".",
"TaskWithTagsMetadataPathWithSlash",
",",
"v2",
".",
"TaskContainerMetadataHandler",
"(",
"state",
",",
"ecsClient",
",",
"cluster",
",",
"availabilityZone",
",",
"containerInstanceArn",
",",
"true",
")",
")",
"\n",
"muxRouter",
".",
"HandleFunc",
"(",
"v2",
".",
"ContainerStatsPath",
",",
"v2",
".",
"TaskContainerStatsHandler",
"(",
"state",
",",
"statsEngine",
")",
")",
"\n",
"muxRouter",
".",
"HandleFunc",
"(",
"v2",
".",
"TaskStatsPath",
",",
"v2",
".",
"TaskContainerStatsHandler",
"(",
"<mask>",
",",
"statsEngine",
")",
")",
"\n",
"muxRouter",
".",
"HandleFunc",
"(",
"v2",
".",
"TaskStatsPathWithSlash",
",",
"v2",
".",
"TaskContainerStatsHandler",
"(",
"state",
",",
"statsEngine",
")",
")",
"\n",
"}"
] |
7,973 | all-7974 | [
"PopupAtWidget",
"()",
"is",
"a",
"wrapper",
"for",
"gtk_menu_popup_at_widget",
"()"
] | [
"func",
"(",
"v",
"*",
"Menu",
")",
"PopupAtWidget",
"(",
"widget",
"IWidget",
",",
"widgetAnchor",
"gdk",
".",
"GdkGravity",
",",
"menuAnchor",
"gdk",
".",
"GdkGravity",
",",
"triggerEvent",
"*",
"gdk",
".",
"<mask>",
")",
"{",
"e",
":=",
"(",
"*",
"C",
".",
"GdkEvent",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"triggerEvent",
".",
"Native",
"(",
")",
")",
")",
"\n",
"C",
".",
"gtk_menu_popup_at_widget",
"(",
"v",
".",
"native",
"(",
")",
",",
"widget",
".",
"toWidget",
"(",
")",
",",
"C",
".",
"GdkGravity",
"(",
"widgetAnchor",
")",
",",
"C",
".",
"GdkGravity",
"(",
"menuAnchor",
")",
",",
"e",
")",
"\n",
"}"
] |
7,974 | all-7975 | [
"KnownCreated",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockTaskResource",
")",
"KnownCreated",
"(",
")",
"bool",
"{",
"<mask>",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"bool",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
7,975 | all-7976 | [
"WithGroup",
"specifies",
"the",
"endpoint",
"group",
"to",
"deliver",
"the",
"report",
"to",
"."
] | [
"func",
"(",
"p",
"GenerateTestReportParams",
")",
"WithGroup",
"(",
"<mask>",
"string",
")",
"*",
"GenerateTestReportParams",
"{",
"p",
".",
"Group",
"=",
"group",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
7,976 | all-7977 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetAutoAttachParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoTarget2",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
7,977 | all-7978 | [
"In",
"the",
"V1",
"protocol",
"the",
"intro",
"fields",
"are",
"sent",
"unencrypted",
".",
"So",
"we",
"restrict",
"them",
"to",
"an",
"established",
"subset",
"of",
"fields",
"that",
"are",
"assumed",
"to",
"be",
"safe",
"."
] | [
"func",
"filterV1Features",
"(",
"intro",
"<mask>",
"[",
"string",
"]",
"string",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"safe",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"_",
",",
"k",
":=",
"range",
"protocolV1Features",
"{",
"if",
"val",
",",
"ok",
":=",
"intro",
"[",
"k",
"]",
";",
"ok",
"{",
"safe",
"[",
"k",
"]",
"=",
"val",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"safe",
"\n",
"}"
] |
7,978 | all-7979 | [
"getUint64",
"extracts",
"a",
"uint64",
"by",
"the",
"given",
"key",
"from",
"a",
"Form",
".",
"If",
"the",
"key",
"does",
"not",
"exist",
"in",
"the",
"form",
"0",
"is",
"returned",
".",
"If",
"the",
"key",
"exists",
"but",
"the",
"value",
"is",
"badly",
"formed",
"an",
"error",
"is",
"returned",
".",
"If",
"multiple",
"values",
"are",
"present",
"only",
"the",
"first",
"is",
"considered",
"."
] | [
"func",
"getUint64",
"(",
"<mask>",
"url",
".",
"Values",
",",
"key",
"string",
")",
"(",
"i",
"uint64",
",",
"err",
"error",
")",
"{",
"if",
"vals",
",",
"ok",
":=",
"form",
"[",
"key",
"]",
";",
"ok",
"{",
"i",
",",
"err",
"=",
"strconv",
".",
"ParseUint",
"(",
"vals",
"[",
"0",
"]",
",",
"10",
",",
"64",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
7,979 | all-7980 | [
"Return",
"an",
"expression",
"evaluating",
"if",
"a",
"filter",
"should",
"be",
"used",
"(",
"based",
"on",
"active",
"criteria",
")",
"."
] | [
"func",
"activeCriteria",
"(",
"<mask>",
"[",
"]",
"string",
")",
"string",
"{",
"expr",
":=",
"\"",
"\"",
"\n",
"for",
"i",
",",
"name",
":=",
"range",
"filter",
"{",
"if",
"i",
">",
"0",
"{",
"expr",
"+=",
"\"",
"\"",
"\n",
"}",
"\n",
"expr",
"+=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n\n",
"return",
"expr",
"\n",
"}"
] |
7,980 | all-7981 | [
"PangoLayout",
"*",
"pango_layout_copy",
"(",
"PangoLayout",
"*",
"src",
")",
";"
] | [
"func",
"(",
"v",
"*",
"Layout",
")",
"Copy",
"(",
")",
"*",
"Layout",
"{",
"c",
":=",
"C",
".",
"pango_layout_copy",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n\n",
"layout",
":=",
"new",
"(",
"Layout",
")",
"\n",
"layout",
".",
"pangoLayout",
"=",
"(",
"*",
"C",
".",
"PangoLayout",
")",
"(",
"c",
")",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
7,981 | all-7982 | [
"updateDVSConfiguration",
"contains",
"the",
"atomic",
"update",
"/",
"wait",
"operation",
"for",
"a",
"DVS",
"."
] | [
"func",
"updateDVSConfiguration",
"(",
"client",
"*",
"govmomi",
".",
"Client",
",",
"dvs",
"*",
"object",
".",
"VmwareDistributedVirtualSwitch",
",",
"spec",
"*",
"types",
".",
"VMwareDVSConfigSpec",
")",
"error",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"<mask>",
".",
"Background",
"(",
")",
",",
"defaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"task",
",",
"err",
":=",
"dvs",
".",
"Reconfigure",
"(",
"ctx",
",",
"spec",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"tctx",
",",
"tcancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"defaultAPITimeout",
")",
"\n",
"defer",
"tcancel",
"(",
")",
"\n",
"if",
"err",
":=",
"task",
".",
"Wait",
"(",
"tctx",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,982 | all-7983 | [
"Call",
"SOAP",
"client",
"API",
"call"
] | [
"func",
"(",
"s",
"*",
"Client",
")",
"Call",
"(",
"soapAction",
"string",
",",
"request",
",",
"<mask>",
",",
"header",
"interface",
"{",
"}",
")",
"error",
"{",
"var",
"envelope",
"Envelope",
"\n",
"if",
"s",
".",
"header",
"!=",
"nil",
"{",
"envelope",
"=",
"Envelope",
"{",
"Header",
":",
"&",
"Header",
"{",
"Content",
":",
"s",
".",
"header",
",",
"}",
",",
"Body",
":",
"Body",
"{",
"Content",
":",
"request",
",",
"}",
",",
"}",
"\n",
"}",
"else",
"{",
"envelope",
"=",
"Envelope",
"{",
"Body",
":",
"Body",
"{",
"Content",
":",
"request",
",",
"}",
",",
"}",
"\n",
"}",
"\n",
"buffer",
":=",
"new",
"(",
"bytes",
".",
"Buffer",
")",
"\n",
"encoder",
":=",
"xml",
".",
"NewEncoder",
"(",
"buffer",
")",
"\n",
"encoder",
".",
"Indent",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
":=",
"encoder",
".",
"Encode",
"(",
"envelope",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"encoder",
".",
"Flush",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"req",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"\"",
"\"",
",",
"s",
".",
"url",
",",
"buffer",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"req",
".",
"Header",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"soapAction",
")",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"s",
".",
"userAgent",
")",
"\n",
"req",
".",
"Close",
"=",
"true",
"\n\n",
"tr",
":=",
"&",
"http",
".",
"Transport",
"{",
"TLSClientConfig",
":",
"&",
"tls",
".",
"Config",
"{",
"InsecureSkipVerify",
":",
"s",
".",
"tls",
",",
"}",
",",
"Dial",
":",
"dialTimeout",
",",
"}",
"\n\n",
"client",
":=",
"&",
"http",
".",
"Client",
"{",
"Transport",
":",
"tr",
"}",
"\n",
"res",
",",
"err",
":=",
"client",
".",
"Do",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"defer",
"res",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"if",
"res",
".",
"StatusCode",
"!=",
"http",
".",
"StatusOK",
"{",
"soapFault",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"res",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"msg",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\"",
",",
"res",
".",
"StatusCode",
",",
"string",
"(",
"soapFault",
")",
")",
"\n",
"return",
"errors",
".",
"New",
"(",
"msg",
")",
"\n",
"}",
"\n\n",
"rawbody",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"res",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"rawbody",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"respEnvelope",
":=",
"Envelope",
"{",
"}",
"\n",
"respEnvelope",
".",
"Body",
"=",
"Body",
"{",
"Content",
":",
"response",
"}",
"\n",
"if",
"header",
"!=",
"nil",
"{",
"respEnvelope",
".",
"Header",
"=",
"&",
"Header",
"{",
"Content",
":",
"header",
"}",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"xml",
".",
"Unmarshal",
"(",
"rawbody",
",",
"&",
"respEnvelope",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,983 | all-7984 | [
"GenCert",
"will",
"create",
"and",
"populate",
"a",
"certificate",
"file",
"and",
"a",
"key",
"file"
] | [
"func",
"GenCert",
"(",
"certf",
"string",
",",
"keyf",
"string",
",",
"certtype",
"bool",
")",
"error",
"{",
"/* Create the basenames if needed */",
"dir",
":=",
"path",
".",
"Dir",
"(",
"certf",
")",
"\n",
"err",
":=",
"os",
".",
"MkdirAll",
"(",
"dir",
",",
"0750",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"dir",
"=",
"path",
".",
"Dir",
"(",
"keyf",
")",
"\n",
"err",
"=",
"<mask>",
".",
"MkdirAll",
"(",
"dir",
",",
"0750",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"certBytes",
",",
"keyBytes",
",",
"err",
":=",
"GenerateMemCert",
"(",
"certtype",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"certOut",
",",
"err",
":=",
"os",
".",
"Create",
"(",
"certf",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"certf",
",",
"err",
")",
"\n",
"}",
"\n",
"certOut",
".",
"Write",
"(",
"certBytes",
")",
"\n",
"certOut",
".",
"Close",
"(",
")",
"\n\n",
"keyOut",
",",
"err",
":=",
"os",
".",
"OpenFile",
"(",
"keyf",
",",
"os",
".",
"O_WRONLY",
"|",
"os",
".",
"O_CREATE",
"|",
"os",
".",
"O_TRUNC",
",",
"0600",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"keyf",
",",
"err",
")",
"\n",
"}",
"\n",
"keyOut",
".",
"Write",
"(",
"keyBytes",
")",
"\n",
"keyOut",
".",
"Close",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,984 | all-7985 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetSamplingIntervalParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoProfiler13",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
7,985 | all-7986 | [
"Write",
"writes",
"val",
"to",
"r",
"."
] | [
"func",
"(",
"r",
"*",
"readWriter",
")",
"Write",
"(",
"val",
"proto",
".",
"<mask>",
")",
"(",
"int64",
",",
"error",
")",
"{",
"bytes",
",",
"err",
":=",
"proto",
".",
"Marshal",
"(",
"val",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"return",
"r",
".",
"WriteBytes",
"(",
"bytes",
")",
"\n",
"}"
] |
7,986 | all-7987 | [
"StoragePoolConfigGet",
"returns",
"the",
"config",
"of",
"a",
"storage",
"pool",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"StoragePoolConfigGet",
"(",
"poolID",
"int64",
")",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"error",
")",
"{",
"var",
"key",
",",
"value",
"string",
"\n",
"query",
":=",
"\"",
"\"",
"\n",
"inargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"poolID",
",",
"c",
".",
"nodeID",
"}",
"\n",
"outargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"key",
",",
"value",
"}",
"\n\n",
"results",
",",
"err",
":=",
"queryScan",
"(",
"c",
".",
"db",
",",
"query",
",",
"inargs",
",",
"outargs",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"config",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"}",
"\n\n",
"for",
"_",
",",
"r",
":=",
"range",
"results",
"{",
"key",
"=",
"r",
"[",
"0",
"]",
".",
"(",
"string",
")",
"\n",
"<mask>",
"=",
"r",
"[",
"1",
"]",
".",
"(",
"string",
")",
"\n\n",
"config",
"[",
"key",
"]",
"=",
"value",
"\n",
"}",
"\n\n",
"return",
"config",
",",
"nil",
"\n",
"}"
] |
7,987 | all-7988 | [
"WaitForStdin",
"blocks",
"until",
"input",
"is",
"available",
"from",
"os",
".",
"Stdin",
".",
"The",
"first",
"byte",
"from",
"os",
".",
"Stdin",
"is",
"returned",
"as",
"result",
".",
"If",
"there",
"are",
"println",
"arguments",
"then",
"fmt",
".",
"Println",
"will",
"be",
"called",
"with",
"those",
"before",
"reading",
"from",
"os",
".",
"Stdin",
"."
] | [
"func",
"WaitForStdin",
"(",
"println",
"...",
"interface",
"{",
"}",
")",
"byte",
"{",
"if",
"len",
"(",
"println",
")",
">",
"0",
"{",
"fmt",
".",
"Println",
"(",
"println",
"...",
")",
"\n",
"}",
"\n",
"buffer",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"1",
")",
"\n",
"os",
".",
"Stdin",
".",
"Read",
"(",
"<mask>",
")",
"\n",
"return",
"buffer",
"[",
"0",
"]",
"\n",
"}"
] |
7,988 | all-7989 | [
"removeExchange",
"removes",
"a",
"message",
"exchange",
"from",
"the",
"set",
"if",
"it",
"exists",
"."
] | [
"func",
"(",
"mexset",
"*",
"messageExchangeSet",
")",
"removeExchange",
"(",
"msgID",
"uint32",
")",
"{",
"if",
"mexset",
".",
"log",
".",
"Enabled",
"(",
"LogLevelDebug",
")",
"{",
"mexset",
".",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"mexset",
".",
"name",
",",
"msgID",
")",
"\n",
"}",
"\n\n",
"mexset",
".",
"Lock",
"(",
")",
"\n",
"found",
",",
"expired",
":=",
"mexset",
".",
"deleteExchange",
"(",
"msgID",
")",
"\n",
"mexset",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"!",
"found",
"&&",
"!",
"expired",
"{",
"mexset",
".",
"log",
".",
"WithFields",
"(",
"LogField",
"{",
"\"",
"\"",
",",
"msgID",
"}",
",",
")",
".",
"<mask>",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// If the message exchange was found, then we perform clean up actions.",
"// These clean up actions can only be run once per exchange.",
"mexset",
".",
"onRemoved",
"(",
")",
"\n",
"}"
] |
7,989 | all-7990 | [
"SelectMany",
"allows",
"for",
"flattening",
"of",
"data",
"structures",
"."
] | [
"func",
"(",
"iter",
"Enumerator",
")",
"SelectMany",
"(",
"lister",
"Unfolder",
")",
"Enumerator",
"{",
"retval",
":=",
"<mask>",
"(",
"chan",
"interface",
"{",
"}",
")",
"\n\n",
"go",
"func",
"(",
")",
"{",
"for",
"parent",
":=",
"range",
"iter",
"{",
"for",
"child",
":=",
"range",
"lister",
"(",
"parent",
")",
"{",
"retval",
"<-",
"child",
"\n",
"}",
"\n",
"}",
"\n",
"close",
"(",
"retval",
")",
"\n",
"}",
"(",
")",
"\n\n",
"return",
"retval",
"\n",
"}"
] |
7,990 | all-7991 | [
"ServeFile",
"returns",
"HTTP",
"response",
"containing",
"compressed",
"file",
"contents",
"from",
"the",
"given",
"path",
".",
"HTTP",
"response",
"may",
"contain",
"uncompressed",
"file",
"contents",
"in",
"the",
"following",
"cases",
":",
"*",
"Missing",
"Accept",
"-",
"Encoding",
":",
"gzip",
"request",
"header",
".",
"*",
"No",
"write",
"access",
"to",
"directory",
"containing",
"the",
"file",
".",
"Directory",
"contents",
"is",
"returned",
"if",
"path",
"points",
"to",
"directory",
".",
"Use",
"ServeFileUncompressed",
"is",
"you",
"don",
"t",
"need",
"serving",
"compressed",
"file",
"contents",
".",
"See",
"also",
"RequestCtx",
".",
"SendFile",
"."
] | [
"func",
"ServeFile",
"(",
"ctx",
"*",
"RequestCtx",
",",
"path",
"string",
")",
"{",
"rootFSOnce",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"rootFSHandler",
"=",
"rootFS",
".",
"NewRequestHandler",
"(",
")",
"\n",
"}",
")",
"\n",
"if",
"len",
"(",
"path",
")",
"==",
"0",
"||",
"path",
"[",
"0",
"]",
"!=",
"'/'",
"{",
"// extend relative path to absolute path",
"var",
"err",
"error",
"\n",
"if",
"path",
",",
"err",
"=",
"filepath",
".",
"Abs",
"(",
"path",
")",
";",
"err",
"!=",
"nil",
"{",
"ctx",
".",
"Logger",
"(",
")",
".",
"Printf",
"(",
"\"",
"\"",
",",
"path",
",",
"err",
")",
"\n",
"ctx",
".",
"Error",
"(",
"\"",
"\"",
",",
"StatusInternalServerError",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"ctx",
".",
"Request",
".",
"SetRequestURI",
"(",
"<mask>",
")",
"\n",
"rootFSHandler",
"(",
"ctx",
")",
"\n",
"}"
] |
7,991 | all-7992 | [
"Expect",
"a",
"node",
"."
] | [
"func",
"yaml_emitter_emit_node",
"(",
"emitter",
"*",
"yaml_emitter_t",
",",
"event",
"*",
"yaml_event_t",
",",
"root",
"bool",
",",
"sequence",
"bool",
",",
"mapping",
"bool",
",",
"simple_key",
"bool",
")",
"bool",
"{",
"emitter",
".",
"root_context",
"=",
"root",
"\n",
"emitter",
".",
"sequence_context",
"=",
"sequence",
"\n",
"emitter",
".",
"mapping_context",
"=",
"mapping",
"\n",
"emitter",
".",
"simple_key_context",
"=",
"simple_key",
"\n\n",
"switch",
"event",
".",
"typ",
"{",
"case",
"yaml_ALIAS_EVENT",
":",
"return",
"yaml_emitter_emit_alias",
"(",
"emitter",
",",
"event",
")",
"\n",
"case",
"yaml_SCALAR_EVENT",
":",
"return",
"yaml_emitter_emit_scalar",
"(",
"emitter",
",",
"event",
")",
"\n",
"case",
"yaml_SEQUENCE_START_EVENT",
":",
"return",
"yaml_emitter_emit_sequence_start",
"(",
"emitter",
",",
"<mask>",
")",
"\n",
"case",
"yaml_MAPPING_START_EVENT",
":",
"return",
"yaml_emitter_emit_mapping_start",
"(",
"emitter",
",",
"event",
")",
"\n",
"default",
":",
"return",
"yaml_emitter_set_emitter_error",
"(",
"emitter",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"event",
".",
"typ",
")",
")",
"\n",
"}",
"\n",
"}"
] |
7,992 | all-7993 | [
"NewPresubmit",
"converts",
"a",
"config",
".",
"Presubmit",
"into",
"a",
"prowapi",
".",
"ProwJob",
".",
"The",
"prowapi",
".",
"Refs",
"are",
"configured",
"correctly",
"per",
"the",
"pr",
"baseSHA",
".",
"The",
"eventGUID",
"becomes",
"a",
"github",
".",
"EventGUID",
"label",
"."
] | [
"func",
"NewPresubmit",
"(",
"pr",
"github",
".",
"PullRequest",
",",
"baseSHA",
"string",
",",
"job",
"config",
".",
"Presubmit",
",",
"eventGUID",
"string",
")",
"prowapi",
".",
"ProwJob",
"{",
"refs",
":=",
"createRefs",
"(",
"pr",
",",
"baseSHA",
")",
"\n",
"labels",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"<mask>",
"job",
".",
"Labels",
"{",
"labels",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"labels",
"[",
"github",
".",
"EventGUID",
"]",
"=",
"eventGUID",
"\n",
"return",
"NewProwJob",
"(",
"PresubmitSpec",
"(",
"job",
",",
"refs",
")",
",",
"labels",
")",
"\n",
"}"
] |
7,993 | all-7994 | [
"RunFile",
"parses",
"and",
"runs",
"the",
"specified",
"file",
"(",
"s",
")",
"."
] | [
"func",
"(",
"r",
"*",
"<mask>",
")",
"RunFile",
"(",
"filenames",
"...",
"string",
")",
"{",
"groups",
",",
"err",
":=",
"parse",
".",
"ParseFile",
"(",
"filenames",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"r",
".",
"log",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"r",
".",
"RunGroup",
"(",
"groups",
"...",
")",
"\n",
"}"
] |
7,994 | all-7995 | [
"WritePluginResultsToDatabase",
"upserts",
"plugin",
"results",
"into",
"Database"
] | [
"func",
"WritePluginResultsToDatabase",
"(",
"results",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"{",
"// connect to RethinkDB",
"session",
",",
"err",
":=",
"r",
".",
"Connect",
"(",
"r",
".",
"ConnectOpts",
"{",
"Address",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"utils",
".",
"Getopt",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
")",
",",
"Timeout",
":",
"5",
"*",
"time",
".",
"Second",
",",
"Database",
":",
"\"",
"\"",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"<mask>",
".",
"Debug",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"defer",
"session",
".",
"Close",
"(",
")",
"\n\n",
"res",
",",
"err",
":=",
"r",
".",
"Table",
"(",
"\"",
"\"",
")",
".",
"Get",
"(",
"results",
"[",
"\"",
"\"",
"]",
")",
".",
"Run",
"(",
"session",
")",
"\n",
"utils",
".",
"Assert",
"(",
"err",
")",
"\n",
"defer",
"res",
".",
"Close",
"(",
")",
"\n\n",
"if",
"res",
".",
"IsNil",
"(",
")",
"{",
"// upsert into RethinkDB",
"resp",
",",
"err",
":=",
"r",
".",
"Table",
"(",
"\"",
"\"",
")",
".",
"Insert",
"(",
"results",
",",
"r",
".",
"InsertOpts",
"{",
"Conflict",
":",
"\"",
"\"",
"}",
")",
".",
"RunWrite",
"(",
"session",
")",
"\n",
"utils",
".",
"Assert",
"(",
"err",
")",
"\n",
"log",
".",
"Debug",
"(",
"resp",
")",
"\n",
"}",
"else",
"{",
"resp",
",",
"err",
":=",
"r",
".",
"Table",
"(",
"\"",
"\"",
")",
".",
"Get",
"(",
"results",
"[",
"\"",
"\"",
"]",
")",
".",
"Update",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"category",
":",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"name",
":",
"results",
"[",
"\"",
"\"",
"]",
",",
"}",
",",
"}",
",",
"}",
")",
".",
"RunWrite",
"(",
"session",
")",
"\n",
"utils",
".",
"Assert",
"(",
"err",
")",
"\n\n",
"log",
".",
"Debug",
"(",
"resp",
")",
"\n",
"}",
"\n",
"}"
] |
7,995 | all-7996 | [
"SendResponse",
"sends",
"resp",
"to",
"the",
"peer",
".",
"It",
"is",
"lower",
"level",
"than",
"(",
"*",
"Conn",
")",
".",
"Reply",
"."
] | [
"func",
"(",
"c",
"*",
"Conn",
")",
"SendResponse",
"(",
"ctx",
"context",
".",
"Context",
",",
"resp",
"*",
"<mask>",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"send",
"(",
"ctx",
",",
"&",
"anyMessage",
"{",
"response",
":",
"resp",
"}",
",",
"false",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
7,996 | all-7997 | [
"PolicyConfigurationNamespaces",
"returns",
"a",
"list",
"of",
"other",
"policy",
"configuration",
"namespaces",
"to",
"search",
"for",
"if",
"explicit",
"configuration",
"for",
"PolicyConfigurationIdentity",
"()",
"is",
"not",
"set",
".",
"The",
"list",
"will",
"be",
"processed",
"in",
"order",
"terminating",
"on",
"first",
"match",
"and",
"an",
"implicit",
"is",
"always",
"checked",
"at",
"the",
"end",
".",
"It",
"is",
"STRONGLY",
"recommended",
"for",
"the",
"first",
"element",
"if",
"any",
"to",
"be",
"a",
"prefix",
"of",
"PolicyConfigurationIdentity",
"()",
"and",
"each",
"following",
"element",
"to",
"be",
"a",
"prefix",
"of",
"the",
"element",
"preceding",
"it",
"."
] | [
"func",
"(",
"ref",
"daemonReference",
")",
"PolicyConfigurationNamespaces",
"(",
")",
"[",
"]",
"string",
"{",
"// See the explanation in daemonReference.PolicyConfigurationIdentity.",
"switch",
"{",
"case",
"ref",
".",
"id",
"!=",
"\"",
"\"",
":",
"return",
"[",
"]",
"string",
"{",
"}",
"\n",
"case",
"ref",
".",
"<mask>",
"!=",
"nil",
":",
"return",
"policyconfiguration",
".",
"DockerReferenceNamespaces",
"(",
"ref",
".",
"ref",
")",
"\n",
"default",
":",
"// Coverage: Should never happen, NewReference above should refuse such values.",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
7,997 | all-7998 | [
"The",
"handler",
"for",
"the",
"post",
"operation",
"."
] | [
"func",
"profilePost",
"(",
"d",
"*",
"Daemon",
",",
"r",
"*",
"http",
".",
"Request",
")",
"Response",
"{",
"project",
":=",
"projectParam",
"(",
"r",
")",
"\n",
"name",
":=",
"mux",
".",
"Vars",
"(",
"r",
")",
"[",
"\"",
"\"",
"]",
"\n\n",
"if",
"name",
"==",
"\"",
"\"",
"{",
"return",
"Forbidden",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"req",
":=",
"api",
".",
"ProfilePost",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"NewDecoder",
"(",
"r",
".",
"Body",
")",
".",
"Decode",
"(",
"&",
"req",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"BadRequest",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"// Sanity checks",
"if",
"req",
".",
"Name",
"==",
"\"",
"\"",
"{",
"return",
"BadRequest",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"if",
"strings",
".",
"Contains",
"(",
"req",
".",
"Name",
",",
"\"",
"\"",
")",
"{",
"return",
"BadRequest",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"if",
"shared",
".",
"StringInSlice",
"(",
"req",
".",
"Name",
",",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
")",
"{",
"return",
"BadRequest",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"req",
".",
"Name",
")",
")",
"\n",
"}",
"\n\n",
"err",
":=",
"d",
".",
"cluster",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"db",
".",
"ClusterTx",
")",
"error",
"{",
"hasProfiles",
",",
"err",
":=",
"tx",
".",
"ProjectHasProfiles",
"(",
"project",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"!",
"hasProfiles",
"{",
"project",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"// Check that the name isn't already in use",
"_",
",",
"err",
"=",
"tx",
".",
"ProfileGet",
"(",
"project",
",",
"req",
".",
"Name",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"req",
".",
"<mask>",
")",
"\n",
"}",
"\n\n",
"return",
"tx",
".",
"ProfileRename",
"(",
"project",
",",
"name",
",",
"req",
".",
"Name",
")",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"SyncResponseLocation",
"(",
"true",
",",
"nil",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"version",
".",
"APIVersion",
",",
"req",
".",
"Name",
")",
")",
"\n",
"}"
] |
7,998 | all-7999 | [
"CreatePullRequest",
"creates",
"a",
"new",
"pull",
"request",
"and",
"returns",
"its",
"number",
"if",
"the",
"creation",
"is",
"successful",
"otherwise",
"any",
"error",
"that",
"is",
"encountered",
".",
"See",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"pulls",
"/",
"#create",
"-",
"a",
"-",
"pull",
"-",
"request"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreatePullRequest",
"(",
"org",
",",
"repo",
",",
"<mask>",
",",
"body",
",",
"head",
",",
"base",
"string",
",",
"canModify",
"bool",
")",
"(",
"int",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"title",
")",
"\n",
"data",
":=",
"struct",
"{",
"Title",
"string",
"`json:\"title\"`",
"\n",
"Body",
"string",
"`json:\"body\"`",
"\n",
"Head",
"string",
"`json:\"head\"`",
"\n",
"Base",
"string",
"`json:\"base\"`",
"\n",
"// MaintainerCanModify allows maintainers of the repo to modify this",
"// pull request, eg. push changes to it before merging.",
"MaintainerCanModify",
"bool",
"`json:\"maintainer_can_modify\"`",
"\n",
"}",
"{",
"Title",
":",
"title",
",",
"Body",
":",
"body",
",",
"Head",
":",
"head",
",",
"Base",
":",
"base",
",",
"MaintainerCanModify",
":",
"canModify",
",",
"}",
"\n",
"var",
"resp",
"struct",
"{",
"Num",
"int",
"`json:\"number\"`",
"\n",
"}",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"request",
"(",
"&",
"request",
"{",
"// allow the description and draft fields",
"// https://developer.github.com/changes/2018-02-22-label-description-search-preview/",
"// https://developer.github.com/changes/2019-02-14-draft-pull-requests/",
"accept",
":",
"\"",
"\"",
",",
"method",
":",
"http",
".",
"MethodPost",
",",
"path",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
")",
",",
"requestBody",
":",
"&",
"data",
",",
"exitCodes",
":",
"[",
"]",
"int",
"{",
"201",
"}",
",",
"}",
",",
"&",
"resp",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"return",
"resp",
".",
"Num",
",",
"nil",
"\n",
"}"
] |
7,999 | all-8000 | [
"Encode",
"writes",
"the",
"Image",
"m",
"to",
"w",
"in",
"PNG",
"format",
"."
] | [
"func",
"(",
"enc",
"*",
"Encoder",
")",
"Encode",
"(",
"w",
"io",
".",
"Writer",
",",
"m",
"image",
".",
"Image",
")",
"error",
"{",
"// Obviously, negative widths and heights are invalid. Furthermore, the PNG",
"// spec section 11.2.2 says that zero is invalid. Excessively large images are",
"// also rejected.",
"mw",
",",
"mh",
":=",
"int64",
"(",
"m",
".",
"Bounds",
"(",
")",
".",
"Dx",
"(",
")",
")",
",",
"int64",
"(",
"m",
".",
"Bounds",
"(",
")",
".",
"Dy",
"(",
")",
")",
"\n",
"if",
"mw",
"<=",
"0",
"||",
"mh",
"<=",
"0",
"||",
"mw",
">=",
"1",
"<<",
"32",
"||",
"mh",
">=",
"1",
"<<",
"32",
"{",
"return",
"FormatError",
"(",
"\"",
"\"",
"+",
"strconv",
".",
"FormatInt",
"(",
"mw",
",",
"10",
")",
"+",
"\"",
"\"",
"+",
"strconv",
".",
"FormatInt",
"(",
"mh",
",",
"10",
")",
")",
"\n",
"}",
"\n\n",
"var",
"e",
"*",
"encoder",
"\n",
"if",
"enc",
".",
"BufferPool",
"!=",
"nil",
"{",
"buffer",
":=",
"enc",
".",
"BufferPool",
".",
"Get",
"(",
")",
"\n",
"e",
"=",
"(",
"*",
"encoder",
")",
"(",
"buffer",
")",
"\n\n",
"}",
"\n",
"if",
"e",
"==",
"nil",
"{",
"e",
"=",
"&",
"encoder",
"{",
"}",
"\n",
"}",
"\n",
"if",
"enc",
".",
"BufferPool",
"!=",
"nil",
"{",
"defer",
"enc",
".",
"BufferPool",
".",
"Put",
"(",
"(",
"*",
"EncoderBuffer",
")",
"(",
"e",
")",
")",
"\n",
"}",
"\n\n",
"e",
".",
"enc",
"=",
"enc",
"\n",
"e",
".",
"w",
"=",
"w",
"\n",
"e",
".",
"m",
"=",
"m",
"\n\n",
"var",
"pal",
"color",
".",
"Palette",
"\n",
"// cbP8 encoding needs PalettedImage's ColorIndexAt method.",
"if",
"_",
",",
"ok",
":=",
"m",
".",
"(",
"<mask>",
".",
"PalettedImage",
")",
";",
"ok",
"{",
"pal",
",",
"_",
"=",
"m",
".",
"ColorModel",
"(",
")",
".",
"(",
"color",
".",
"Palette",
")",
"\n",
"}",
"\n",
"if",
"pal",
"!=",
"nil",
"{",
"if",
"len",
"(",
"pal",
")",
"<=",
"2",
"{",
"e",
".",
"cb",
"=",
"cbP1",
"\n",
"}",
"else",
"if",
"len",
"(",
"pal",
")",
"<=",
"4",
"{",
"e",
".",
"cb",
"=",
"cbP2",
"\n",
"}",
"else",
"if",
"len",
"(",
"pal",
")",
"<=",
"16",
"{",
"e",
".",
"cb",
"=",
"cbP4",
"\n",
"}",
"else",
"{",
"e",
".",
"cb",
"=",
"cbP8",
"\n",
"}",
"\n",
"}",
"else",
"{",
"switch",
"m",
".",
"ColorModel",
"(",
")",
"{",
"case",
"color",
".",
"GrayModel",
":",
"e",
".",
"cb",
"=",
"cbG8",
"\n",
"case",
"color",
".",
"Gray16Model",
":",
"e",
".",
"cb",
"=",
"cbG16",
"\n",
"case",
"color",
".",
"RGBAModel",
",",
"color",
".",
"NRGBAModel",
",",
"color",
".",
"AlphaModel",
":",
"if",
"opaque",
"(",
"m",
")",
"{",
"e",
".",
"cb",
"=",
"cbTC8",
"\n",
"}",
"else",
"{",
"e",
".",
"cb",
"=",
"cbTCA8",
"\n",
"}",
"\n",
"default",
":",
"if",
"opaque",
"(",
"m",
")",
"{",
"e",
".",
"cb",
"=",
"cbTC16",
"\n",
"}",
"else",
"{",
"e",
".",
"cb",
"=",
"cbTCA16",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"_",
",",
"e",
".",
"err",
"=",
"io",
".",
"WriteString",
"(",
"w",
",",
"pngHeader",
")",
"\n",
"e",
".",
"writeIHDR",
"(",
")",
"\n",
"if",
"pal",
"!=",
"nil",
"{",
"e",
".",
"writePLTEAndTRNS",
"(",
"pal",
")",
"\n",
"}",
"\n",
"e",
".",
"writeIDATs",
"(",
")",
"\n",
"e",
".",
"writeIEND",
"(",
")",
"\n",
"return",
"e",
".",
"err",
"\n",
"}"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.