id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
6,100 | all-6101 | [
"define",
"an",
"array",
"of",
"texture",
"coordinates"
] | [
"func",
"TexCoordPointer",
"(",
"size",
"int32",
",",
"xtype",
"uint32",
",",
"stride",
"int32",
",",
"pointer",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowTexCoordPointer",
"(",
"gpTexCoordPointer",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"stride",
")",
",",
"pointer",
")",
"\n",
"}"
] |
6,101 | all-6102 | [
"printPlainResults",
"prints",
"plain",
"-",
"text",
"output",
"for",
"results"
] | [
"func",
"printPlainResults",
"(",
"results",
"Results",
")",
"error",
"{",
"for",
"_",
",",
"res",
":=",
"range",
"results",
"{",
"// Explicitely start with the string and error output",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"res",
".",
"origString",
")",
"\n",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"res",
".",
"<mask>",
")",
"\n\n",
"if",
"res",
".",
"Error",
"!=",
"\"",
"\"",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"res",
".",
"Error",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"// Dynamically loop over the rest of the fields",
"typ",
":=",
"reflect",
".",
"TypeOf",
"(",
"*",
"res",
")",
"\n",
"val",
":=",
"reflect",
".",
"ValueOf",
"(",
"*",
"res",
")",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"typ",
".",
"NumField",
"(",
")",
";",
"i",
"++",
"{",
"field",
":=",
"typ",
".",
"Field",
"(",
"i",
")",
"\n",
"if",
"field",
".",
"Name",
"==",
"\"",
"\"",
"||",
"field",
".",
"Name",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"field",
".",
"PkgPath",
"!=",
"\"",
"\"",
"{",
"// ignore unexported fields",
"continue",
"\n",
"}",
"\n",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"field",
".",
"Name",
",",
"val",
".",
"Field",
"(",
"i",
")",
".",
"Interface",
"(",
")",
")",
"\n",
"}",
"\n\n",
"fmt",
".",
"Print",
"(",
"\"",
"\\n",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
6,102 | all-6103 | [
"GetTitle",
"returns",
"the",
"Title",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"e",
"*",
"<mask>",
")",
"GetTitle",
"(",
")",
"string",
"{",
"if",
"e",
"==",
"nil",
"||",
"e",
".",
"Title",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"e",
".",
"Title",
"\n",
"}"
] |
6,103 | all-6104 | [
"GetCurrentApproversSetCased",
"returns",
"the",
"set",
"of",
"approvers",
"logins",
"with",
"the",
"original",
"cases",
"."
] | [
"func",
"(",
"ap",
"Approvers",
")",
"GetCurrentApproversSetCased",
"(",
")",
"sets",
".",
"String",
"{",
"currentApprovers",
":=",
"sets",
".",
"NewString",
"(",
")",
"\n\n",
"for",
"_",
",",
"approval",
":=",
"<mask>",
"ap",
".",
"approvers",
"{",
"currentApprovers",
".",
"Insert",
"(",
"approval",
".",
"Login",
")",
"\n",
"}",
"\n\n",
"return",
"currentApprovers",
"\n",
"}"
] |
6,104 | all-6105 | [
"Helper",
"function",
"used",
"to",
"log",
"requests",
"and",
"responses",
"from",
"our",
"GRPC",
"method",
"implementations"
] | [
"func",
"(",
"l",
"*",
"logger",
")",
"Log",
"(",
"request",
"<mask>",
"{",
"}",
",",
"response",
"interface",
"{",
"}",
",",
"err",
"error",
",",
"duration",
"time",
".",
"Duration",
")",
"{",
"if",
"err",
"!=",
"nil",
"{",
"l",
".",
"LogAtLevelFromDepth",
"(",
"request",
",",
"response",
",",
"err",
",",
"duration",
",",
"logrus",
".",
"ErrorLevel",
",",
"4",
")",
"\n",
"}",
"else",
"{",
"l",
".",
"LogAtLevelFromDepth",
"(",
"request",
",",
"response",
",",
"err",
",",
"duration",
",",
"logrus",
".",
"InfoLevel",
",",
"4",
")",
"\n",
"}",
"\n",
"// We have to grab the method's name here before we",
"// enter the goro's stack",
"go",
"l",
".",
"ReportMetric",
"(",
"getMethodName",
"(",
")",
",",
"duration",
",",
"err",
")",
"\n",
"}"
] |
6,105 | all-6106 | [
"cvArcLength",
"(",
"const",
"void",
"*",
"curve",
"CvSlice",
"slice",
"=",
"CV_WHOLE_SEQ",
"int",
"is_closed",
"=",
"-",
"1",
")"
] | [
"func",
"ArcLength",
"(",
"curve",
"*",
"Seq",
",",
"<mask>",
"Slice",
",",
"is_closed",
"bool",
")",
"float64",
"{",
"is_closed_int",
":=",
"0",
"\n",
"if",
"is_closed",
"{",
"is_closed_int",
"=",
"1",
"\n",
"}",
"\n",
"return",
"float64",
"(",
"C",
".",
"cvArcLength",
"(",
"unsafe",
".",
"Pointer",
"(",
"curve",
")",
",",
"(",
"C",
".",
"CvSlice",
")",
"(",
"slice",
")",
",",
"C",
".",
"int",
"(",
"is_closed_int",
")",
")",
")",
"\n",
"}"
] |
6,106 | all-6107 | [
"<expr",
"-",
"primary",
">",
"::",
"=",
"L",
"<type",
">",
"<",
"(",
"value",
")",
"number",
">",
"E",
"::",
"=",
"L",
"<type",
">",
"<",
"(",
"value",
")",
"float",
">",
"E",
"::",
"=",
"L",
"<mangled",
"-",
"name",
">",
"E"
] | [
"func",
"(",
"st",
"*",
"state",
")",
"exprPrimary",
"(",
")",
"AST",
"{",
"st",
".",
"checkChar",
"(",
"'L'",
")",
"\n",
"if",
"len",
"(",
"st",
".",
"str",
")",
"==",
"0",
"{",
"st",
".",
"fail",
"(",
"\"",
"\"",
")",
"\n\n",
"}",
"\n\n",
"// Check for 'Z' here because g++ incorrectly omitted the",
"// underscore until -fabi-version=3.",
"<mask>",
"ret",
"AST",
"\n",
"if",
"st",
".",
"str",
"[",
"0",
"]",
"==",
"'_'",
"||",
"st",
".",
"str",
"[",
"0",
"]",
"==",
"'Z'",
"{",
"if",
"st",
".",
"str",
"[",
"0",
"]",
"==",
"'_'",
"{",
"st",
".",
"advance",
"(",
"1",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"st",
".",
"str",
")",
"==",
"0",
"||",
"st",
".",
"str",
"[",
"0",
"]",
"!=",
"'Z'",
"{",
"st",
".",
"fail",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"st",
".",
"advance",
"(",
"1",
")",
"\n",
"ret",
"=",
"st",
".",
"encoding",
"(",
"true",
",",
"notForLocalName",
")",
"\n",
"}",
"else",
"{",
"t",
":=",
"st",
".",
"demangleType",
"(",
"false",
")",
"\n\n",
"neg",
":=",
"false",
"\n",
"if",
"len",
"(",
"st",
".",
"str",
")",
">",
"0",
"&&",
"st",
".",
"str",
"[",
"0",
"]",
"==",
"'n'",
"{",
"neg",
"=",
"true",
"\n",
"st",
".",
"advance",
"(",
"1",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"st",
".",
"str",
")",
">",
"0",
"&&",
"st",
".",
"str",
"[",
"0",
"]",
"==",
"'E'",
"{",
"st",
".",
"fail",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"i",
":=",
"0",
"\n",
"for",
"len",
"(",
"st",
".",
"str",
")",
">",
"i",
"&&",
"st",
".",
"str",
"[",
"i",
"]",
"!=",
"'E'",
"{",
"i",
"++",
"\n",
"}",
"\n",
"val",
":=",
"st",
".",
"str",
"[",
":",
"i",
"]",
"\n",
"st",
".",
"advance",
"(",
"i",
")",
"\n",
"ret",
"=",
"&",
"Literal",
"{",
"Type",
":",
"t",
",",
"Val",
":",
"val",
",",
"Neg",
":",
"neg",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"st",
".",
"str",
")",
"==",
"0",
"||",
"st",
".",
"str",
"[",
"0",
"]",
"!=",
"'E'",
"{",
"st",
".",
"fail",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"st",
".",
"advance",
"(",
"1",
")",
"\n",
"return",
"ret",
"\n",
"}"
] |
6,107 | all-6108 | [
"Value",
"converts",
"a",
"value",
"to",
"a",
"database",
"driver",
"value"
] | [
"func",
"(",
"u",
"UUID",
")",
"Value",
"(",
")",
"(",
"driver",
".",
"Value",
",",
"error",
")",
"{",
"return",
"<mask>",
".",
"Value",
"(",
"string",
"(",
"u",
")",
")",
",",
"nil",
"\n",
"}"
] |
6,108 | all-6109 | [
"NewMockClientSDK",
"creates",
"a",
"new",
"mock",
"instance"
] | [
"func",
"NewMockClientSDK",
"(",
"ctrl",
"*",
"gomock",
".",
"<mask>",
")",
"*",
"MockClientSDK",
"{",
"mock",
":=",
"&",
"MockClientSDK",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockClientSDKMockRecorder",
"{",
"mock",
"}",
"\n",
"return",
"mock",
"\n",
"}"
] |
6,109 | all-6110 | [
"HasId",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"ScreenboardMonitor",
")",
"HasId",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"Id",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
6,110 | all-6111 | [
"similar",
"returns",
"true",
"if",
"the",
"two",
"Args",
"are",
"equal",
"or",
"almost",
"but",
"not",
"quite",
"equal",
"."
] | [
"func",
"(",
"a",
"*",
"Args",
")",
"similar",
"(",
"r",
"*",
"Args",
",",
"similar",
"Similarity",
")",
"bool",
"{",
"if",
"a",
".",
"Elided",
"!=",
"r",
".",
"Elided",
"||",
"len",
"(",
"a",
".",
"Values",
")",
"!=",
"len",
"(",
"r",
".",
"Values",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"similar",
"==",
"AnyValue",
"{",
"return",
"true",
"\n",
"}",
"\n",
"for",
"i",
",",
"l",
":=",
"range",
"a",
".",
"Values",
"{",
"switch",
"similar",
"{",
"<mask>",
"ExactFlags",
",",
"ExactLines",
":",
"if",
"l",
"!=",
"r",
".",
"Values",
"[",
"i",
"]",
"{",
"return",
"false",
"\n",
"}",
"\n",
"default",
":",
"if",
"l",
".",
"IsPtr",
"(",
")",
"!=",
"r",
".",
"Values",
"[",
"i",
"]",
".",
"IsPtr",
"(",
")",
"||",
"(",
"!",
"l",
".",
"IsPtr",
"(",
")",
"&&",
"l",
"!=",
"r",
".",
"Values",
"[",
"i",
"]",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] |
6,111 | all-6112 | [
"UnmarshalYAML",
"implements",
"yaml",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"ls",
"*",
"Labels",
")",
"UnmarshalYAML",
"(",
"unmarshal",
"func",
"(",
"interface",
"{",
"}",
")",
"error",
")",
"error",
"{",
"var",
"m",
"map",
"[",
"string",
"]",
"string",
"\n\n",
"if",
"err",
":=",
"unmarshal",
"(",
"&",
"m",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"*",
"<mask>",
"=",
"FromMap",
"(",
"m",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
6,112 | all-6113 | [
"Error",
"formats",
"message",
"using",
"the",
"default",
"formats",
"for",
"its",
"operands",
"prepends",
"the",
"prefix",
"as",
"necessary",
"and",
"writes",
"to",
"log",
"with",
"LevelError",
".",
"This",
"is",
"part",
"of",
"the",
"Logger",
"interface",
"implementation",
"."
] | [
"func",
"(",
"l",
"*",
"slog",
")",
"Error",
"(",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"lvl",
":=",
"l",
".",
"Level",
"(",
")",
"\n",
"if",
"lvl",
"<=",
"LevelError",
"{",
"l",
".",
"b",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"l",
".",
"tag",
",",
"args",
"...",
")",
"\n",
"}",
"\n",
"}"
] |
6,113 | all-6114 | [
"UnmarshalJSON",
"implements",
"json",
".",
"Unmarshaler",
".",
"It",
"supports",
"number",
"and",
"null",
"input",
".",
"0",
"will",
"not",
"be",
"considered",
"a",
"null",
"Bool",
".",
"It",
"also",
"supports",
"unmarshalling",
"a",
"sql",
".",
"NullBool",
"."
] | [
"func",
"(",
"b",
"*",
"Bool",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"var",
"v",
"interface",
"{",
"}",
"\n",
"if",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"v",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"switch",
"x",
":=",
"v",
".",
"(",
"type",
")",
"{",
"case",
"bool",
":",
"b",
".",
"Bool",
"=",
"x",
"\n",
"case",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
":",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"b",
".",
"NullBool",
")",
"\n",
"case",
"nil",
":",
"b",
".",
"Valid",
"=",
"false",
"\n",
"return",
"nil",
"\n",
"default",
":",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"v",
")",
".",
"<mask>",
"(",
")",
")",
"\n",
"}",
"\n",
"b",
".",
"Valid",
"=",
"err",
"==",
"nil",
"\n",
"return",
"err",
"\n",
"}"
] |
6,114 | all-6115 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetStyleSheetTextReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss35",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
6,115 | all-6116 | [
"AddDummyV2S1Signature",
"adds",
"an",
"JWS",
"signature",
"with",
"a",
"temporary",
"key",
"(",
"i",
".",
"e",
".",
"useless",
")",
"to",
"a",
"v2s1",
"manifest",
".",
"This",
"is",
"useful",
"to",
"make",
"the",
"manifest",
"acceptable",
"to",
"a",
"Docker",
"Registry",
"(",
"even",
"though",
"nothing",
"needs",
"or",
"wants",
"the",
"JWS",
"signature",
")",
"."
] | [
"func",
"AddDummyV2S1Signature",
"(",
"manifest",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"<mask>",
",",
"err",
":=",
"libtrust",
".",
"GenerateECP256PrivateKey",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"// Coverage: This can fail only if rand.Reader fails.",
"\n",
"}",
"\n\n",
"js",
",",
"err",
":=",
"libtrust",
".",
"NewJSONSignature",
"(",
"manifest",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"js",
".",
"Sign",
"(",
"key",
")",
";",
"err",
"!=",
"nil",
"{",
"// Coverage: This can fail basically only if rand.Reader fails.",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"js",
".",
"PrettySignature",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
6,116 | all-6117 | [
"GetMountPoint",
"gets",
"the",
"mountpoint",
"of",
"the",
"created",
"volume",
"."
] | [
"func",
"(",
"vol",
"*",
"VolumeResource",
")",
"GetMountPoint",
"(",
")",
"string",
"{",
"vol",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"vol",
".",
"<mask>",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"vol",
".",
"VolumeConfig",
".",
"Mountpoint",
"\n",
"}"
] |
6,117 | all-6118 | [
"Read",
"a",
"serialized",
"CHD",
"."
] | [
"func",
"Read",
"(",
"r",
"<mask>",
".",
"Reader",
")",
"(",
"*",
"CHD",
",",
"error",
")",
"{",
"b",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"Mmap",
"(",
"b",
")",
"\n",
"}"
] |
6,118 | all-6119 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"Source",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"Source",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"SourceXML",
":",
"*",
"t",
"=",
"SourceXML",
"\n",
"case",
"SourceJavascript",
":",
"*",
"t",
"=",
"SourceJavascript",
"\n",
"case",
"SourceNetwork",
":",
"*",
"t",
"=",
"SourceNetwork",
"\n",
"case",
"SourceStorage",
":",
"*",
"t",
"=",
"SourceStorage",
"\n",
"case",
"SourceAppcache",
":",
"*",
"t",
"=",
"SourceAppcache",
"\n",
"case",
"SourceRendering",
":",
"*",
"t",
"=",
"SourceRendering",
"\n",
"<mask>",
"SourceSecurity",
":",
"*",
"t",
"=",
"SourceSecurity",
"\n",
"case",
"SourceDeprecation",
":",
"*",
"t",
"=",
"SourceDeprecation",
"\n",
"case",
"SourceWorker",
":",
"*",
"t",
"=",
"SourceWorker",
"\n",
"case",
"SourceViolation",
":",
"*",
"t",
"=",
"SourceViolation",
"\n",
"case",
"SourceIntervention",
":",
"*",
"t",
"=",
"SourceIntervention",
"\n",
"case",
"SourceRecommendation",
":",
"*",
"t",
"=",
"SourceRecommendation",
"\n",
"case",
"SourceOther",
":",
"*",
"t",
"=",
"SourceOther",
"\n\n",
"default",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
] |
6,119 | all-6120 | [
"Copy",
"returns",
"a",
"deep",
"copy",
"of",
"this",
"configuration",
"."
] | [
"func",
"(",
"c",
"*",
"TemplateConfigs",
")",
"Copy",
"(",
")",
"*",
"TemplateConfigs",
"{",
"o",
":=",
"<mask>",
"(",
"TemplateConfigs",
",",
"len",
"(",
"*",
"c",
")",
")",
"\n",
"for",
"i",
",",
"t",
":=",
"range",
"*",
"c",
"{",
"o",
"[",
"i",
"]",
"=",
"t",
".",
"Copy",
"(",
")",
"\n",
"}",
"\n",
"return",
"&",
"o",
"\n",
"}"
] |
6,120 | all-6121 | [
"ASTToString",
"returns",
"the",
"demangled",
"name",
"of",
"the",
"AST",
"."
] | [
"func",
"ASTToString",
"(",
"a",
"AST",
",",
"<mask>",
"...",
"Option",
")",
"string",
"{",
"tparams",
":=",
"true",
"\n",
"for",
"_",
",",
"o",
":=",
"range",
"options",
"{",
"switch",
"o",
"{",
"case",
"NoTemplateParams",
":",
"tparams",
"=",
"false",
"\n",
"}",
"\n",
"}",
"\n\n",
"ps",
":=",
"printState",
"{",
"tparams",
":",
"tparams",
"}",
"\n",
"a",
".",
"print",
"(",
"&",
"ps",
")",
"\n",
"return",
"ps",
".",
"buf",
".",
"String",
"(",
")",
"\n",
"}"
] |
6,121 | all-6122 | [
"/",
"*",
"FindVmsByDeployment",
"finds",
"vms",
"by",
"deployment",
"name"
] | [
"func",
"(",
"a",
"*",
"Client",
")",
"FindVmsByDeployment",
"(",
"params",
"*",
"FindVmsByDeploymentParams",
")",
"(",
"*",
"FindVmsByDeploymentOK",
",",
"error",
")",
"{",
"// TODO: Validate the params before sending",
"if",
"params",
"==",
"nil",
"{",
"params",
"=",
"NewFindVmsByDeploymentParams",
"(",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"transport",
".",
"Submit",
"(",
"&",
"runtime",
".",
"ClientOperation",
"{",
"ID",
":",
"\"",
"\"",
",",
"Method",
":",
"\"",
"\"",
",",
"PathPattern",
":",
"\"",
"\"",
",",
"ProducesMediaTypes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"ConsumesMediaTypes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"Schemes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"Params",
":",
"params",
",",
"Reader",
":",
"&",
"FindVmsByDeploymentReader",
"{",
"formats",
":",
"a",
".",
"formats",
"}",
",",
"<mask>",
":",
"params",
".",
"Context",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
".",
"(",
"*",
"FindVmsByDeploymentOK",
")",
",",
"nil",
"\n\n",
"}"
] |
6,122 | all-6123 | [
"NewError",
"initializes",
"FormErrors",
"with",
"one",
"general",
"error",
"."
] | [
"func",
"NewError",
"(",
"e",
"string",
")",
"FormErrors",
"{",
"<mask>",
":=",
"FormErrors",
"{",
"}",
"\n",
"errors",
".",
"AddError",
"(",
"e",
")",
"\n",
"return",
"errors",
"\n",
"}"
] |
6,123 | all-6124 | [
"BindResponseWriter",
"catches",
"a",
"downstream",
"response",
"writing",
"and",
"transfer",
"its",
"content",
"to",
"the",
"writer",
"w",
"(",
"that",
"will",
"normally",
"take",
"care",
"to",
"use",
"the",
"original",
"ResponseWriter",
")",
".",
"The",
"before",
"variadic",
"is",
"a",
"set",
"of",
"functions",
"that",
"will",
"be",
"triggered",
"just",
"before",
"writing",
"the",
"response",
"."
] | [
"func",
"BindResponseWriter",
"(",
"w",
"io",
".",
"Writer",
",",
"c",
"*",
"core",
".",
"Context",
",",
"before",
"...",
"func",
"(",
"[",
"]",
"byte",
")",
")",
"{",
"c",
".",
"ResponseWriter",
"=",
"responseWriterBinder",
"{",
"w",
",",
"c",
".",
"ResponseWriter",
",",
"<mask>",
"}",
"\n",
"}"
] |
6,124 | all-6125 | [
"SetupNS",
"will",
"set",
"up",
"the",
"namespace",
"of",
"container",
"including",
"create",
"the",
"bridge",
"and",
"the",
"veth",
"pair",
"move",
"the",
"eni",
"to",
"container",
"namespace",
"setup",
"the",
"routes"
] | [
"func",
"(",
"client",
"*",
"cniClient",
")",
"SetupNS",
"(",
"ctx",
"context",
".",
"Context",
",",
"cfg",
"*",
"Config",
",",
"timeout",
"time",
".",
"Duration",
")",
"(",
"*",
"current",
".",
"Result",
",",
"error",
")",
"{",
"derivedCtx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"ctx",
",",
"timeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"type",
"output",
"struct",
"{",
"result",
"*",
"current",
".",
"Result",
"\n",
"err",
"error",
"\n",
"}",
"\n",
"<mask>",
":=",
"make",
"(",
"chan",
"output",
")",
"\n",
"go",
"func",
"(",
"response",
"chan",
"output",
")",
"{",
"result",
",",
"err",
":=",
"client",
".",
"setupNS",
"(",
"cfg",
")",
"\n",
"response",
"<-",
"output",
"{",
"result",
":",
"result",
",",
"err",
":",
"err",
",",
"}",
"\n",
"}",
"(",
"response",
")",
"\n\n",
"select",
"{",
"case",
"<-",
"derivedCtx",
".",
"Done",
"(",
")",
":",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"derivedCtx",
".",
"Err",
"(",
")",
",",
"\"",
"\"",
")",
"\n",
"case",
"result",
":=",
"<-",
"response",
":",
"return",
"result",
".",
"result",
",",
"result",
".",
"err",
"\n",
"}",
"\n",
"}"
] |
6,125 | all-6126 | [
"Shutdown",
"gracefully",
"stops",
"all",
"servers",
"by",
"calling",
"Shutdown",
"method",
"on",
"each",
"of",
"them",
"."
] | [
"func",
"(",
"s",
"*",
"Servers",
")",
"Shutdown",
"(",
"ctx",
"context",
".",
"Context",
")",
"{",
"wg",
":=",
"&",
"sync",
".",
"WaitGroup",
"{",
"}",
"\n",
"for",
"_",
",",
"srv",
":=",
"range",
"s",
".",
"servers",
"{",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"go",
"func",
"(",
"srv",
"*",
"<mask>",
")",
"{",
"defer",
"s",
".",
"recover",
"(",
")",
"\n",
"defer",
"wg",
".",
"Done",
"(",
")",
"\n\n",
"s",
".",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
",",
"srv",
".",
"label",
"(",
")",
")",
"\n",
"if",
"err",
":=",
"srv",
".",
"Shutdown",
"(",
"ctx",
")",
";",
"err",
"!=",
"nil",
"{",
"s",
".",
"logger",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"srv",
".",
"label",
"(",
")",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"(",
"srv",
")",
"\n",
"}",
"\n",
"wg",
".",
"Wait",
"(",
")",
"\n",
"return",
"\n",
"}"
] |
6,126 | all-6127 | [
"SetDash",
"is",
"a",
"wrapper",
"around",
"cairo_set_dash",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetDash",
"(",
"dashes",
"[",
"]",
"float64",
",",
"offset",
"float64",
")",
"{",
"header",
":=",
"(",
"*",
"reflect",
".",
"SliceHeader",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"dashes",
")",
")",
"\n",
"cdashes",
":=",
"(",
"*",
"C",
".",
"double",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"header",
".",
"Data",
")",
")",
"\n",
"C",
".",
"cairo_set_dash",
"(",
"v",
".",
"native",
"(",
")",
",",
"cdashes",
",",
"C",
".",
"int",
"(",
"header",
".",
"Len",
")",
",",
"C",
".",
"double",
"(",
"offset",
")",
")",
"\n",
"}"
] |
6,127 | all-6128 | [
"MarkPartitionOffset",
"marks",
"an",
"offset",
"of",
"the",
"provided",
"topic",
"/",
"partition",
"as",
"processed",
".",
"See",
"MarkOffset",
"for",
"additional",
"explanation",
"."
] | [
"func",
"(",
"c",
"*",
"Consumer",
")",
"MarkPartitionOffset",
"(",
"topic",
"string",
",",
"partition",
"int32",
",",
"offset",
"int64",
",",
"<mask>",
"string",
")",
"{",
"if",
"sub",
":=",
"c",
".",
"subs",
".",
"Fetch",
"(",
"topic",
",",
"partition",
")",
";",
"sub",
"!=",
"nil",
"{",
"sub",
".",
"MarkOffset",
"(",
"offset",
",",
"metadata",
")",
"\n",
"}",
"\n",
"}"
] |
6,128 | all-6129 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"BreakLocation",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger49",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
6,129 | all-6130 | [
"native",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GdkEvent",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"native",
"(",
")",
"*",
"C",
".",
"GdkEvent",
"{",
"if",
"v",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"v",
".",
"GdkEvent",
"\n",
"}"
] |
6,130 | all-6131 | [
"Cluster",
"only",
"keeps",
"the",
"major",
".",
"minor",
"."
] | [
"func",
"Cluster",
"(",
"v",
"string",
")",
"string",
"{",
"vs",
":=",
"strings",
".",
"Split",
"(",
"v",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"vs",
")",
"<=",
"2",
"{",
"return",
"v",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
"[",
"0",
"]",
",",
"vs",
"[",
"1",
"]",
")",
"\n",
"}"
] |
6,131 | all-6132 | [
"Load",
"will",
"apply",
"the",
"Context",
"to",
"the",
"calling",
"process",
"makeing",
"any",
"secccomp",
"process",
"changes",
"apply",
"after",
"the",
"context",
"is",
"loaded",
"."
] | [
"func",
"(",
"c",
"*",
"Context",
")",
"Load",
"(",
")",
"error",
"{",
"<mask>",
",",
"err",
":=",
"c",
".",
"newFilter",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"prctl",
"(",
"prSetNoNewPrivileges",
",",
"1",
",",
"0",
",",
"0",
",",
"0",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"prog",
":=",
"newSockFprog",
"(",
"filter",
")",
"\n",
"return",
"prog",
".",
"set",
"(",
")",
"\n",
"}"
] |
6,132 | all-6133 | [
"error",
"terminates",
"processing",
"."
] | [
"func",
"(",
"p",
"*",
"<mask>",
")",
"error",
"(",
"err",
"error",
")",
"{",
"perr",
":=",
"&",
"ParseErr",
"{",
"Line",
":",
"p",
".",
"lex",
".",
"lineNumber",
"(",
")",
",",
"Pos",
":",
"p",
".",
"lex",
".",
"linePosition",
"(",
")",
",",
"Err",
":",
"err",
",",
"}",
"\n",
"if",
"strings",
".",
"Count",
"(",
"strings",
".",
"TrimSpace",
"(",
"p",
".",
"lex",
".",
"input",
")",
",",
"\"",
"\\n",
"\"",
")",
"==",
"0",
"{",
"perr",
".",
"Line",
"=",
"0",
"\n",
"}",
"\n",
"panic",
"(",
"perr",
")",
"\n",
"}"
] |
6,133 | all-6134 | [
"Opens",
"a",
"GeoIP",
"database",
"by",
"filename",
"with",
"specified",
"GeoIPOptions",
"flag",
".",
"All",
"formats",
"supported",
"by",
"libgeoip",
"are",
"supported",
"though",
"there",
"are",
"only",
"functions",
"to",
"access",
"some",
"of",
"the",
"databases",
"in",
"this",
"API",
".",
"If",
"you",
"don",
"t",
"pass",
"a",
"filename",
"it",
"will",
"try",
"opening",
"the",
"database",
"from",
"a",
"list",
"of",
"common",
"paths",
"."
] | [
"func",
"OpenDb",
"(",
"<mask>",
"[",
"]",
"string",
",",
"flag",
"int",
")",
"(",
"*",
"GeoIP",
",",
"error",
")",
"{",
"if",
"len",
"(",
"files",
")",
"==",
"0",
"{",
"files",
"=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"// Linux default",
"\"",
"\"",
",",
"// source install?",
"\"",
"\"",
",",
"// FreeBSD",
"\"",
"\"",
",",
"// MacPorts",
"\"",
"\"",
",",
"// ArchLinux",
"}",
"\n",
"}",
"\n\n",
"g",
":=",
"&",
"GeoIP",
"{",
"}",
"\n",
"runtime",
".",
"SetFinalizer",
"(",
"g",
",",
"(",
"*",
"GeoIP",
")",
".",
"free",
")",
"\n\n",
"var",
"err",
"error",
"\n\n",
"for",
"_",
",",
"file",
":=",
"range",
"files",
"{",
"// libgeoip prints errors if it can't open the file, so check first",
"if",
"_",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"file",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"os",
".",
"IsExist",
"(",
"err",
")",
"{",
"log",
".",
"Println",
"(",
"err",
")",
"\n",
"}",
"\n",
"continue",
"\n",
"}",
"\n\n",
"cbase",
":=",
"C",
".",
"CString",
"(",
"file",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cbase",
")",
")",
"\n\n",
"g",
".",
"db",
",",
"err",
"=",
"C",
".",
"GeoIP_open",
"(",
"cbase",
",",
"C",
".",
"int",
"(",
"flag",
")",
")",
"\n",
"if",
"g",
".",
"db",
"!=",
"nil",
"&&",
"err",
"!=",
"nil",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"files",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"g",
".",
"db",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"files",
")",
"\n",
"}",
"\n\n",
"C",
".",
"GeoIP_set_charset",
"(",
"g",
".",
"db",
",",
"C",
".",
"GEOIP_CHARSET_UTF8",
")",
"\n",
"return",
"g",
",",
"nil",
"\n",
"}"
] |
6,134 | all-6135 | [
"querystring",
"implements",
"querystringer",
"to",
"represent",
"the",
"outgoing",
"video",
"file",
"."
] | [
"func",
"(",
"ov",
"*",
"OutgoingVideo",
")",
"querystring",
"(",
")",
"querystring",
"{",
"toReturn",
":=",
"<mask>",
"[",
"string",
"]",
"string",
"(",
"ov",
".",
"getBaseQueryString",
"(",
")",
")",
"\n\n",
"if",
"ov",
".",
"Caption",
"!=",
"\"",
"\"",
"{",
"toReturn",
"[",
"\"",
"\"",
"]",
"=",
"ov",
".",
"Caption",
"\n",
"}",
"\n\n",
"if",
"ov",
".",
"Duration",
"!=",
"0",
"{",
"toReturn",
"[",
"\"",
"\"",
"]",
"=",
"fmt",
".",
"Sprint",
"(",
"ov",
".",
"Duration",
")",
"\n",
"}",
"\n\n",
"return",
"querystring",
"(",
"toReturn",
")",
"\n",
"}"
] |
6,135 | all-6136 | [
"Next",
"returns",
"the",
"next",
"page",
"of",
"resources",
".",
"If",
"there",
"are",
"no",
"more",
"resources",
"NoMoreResults",
"is",
"returned",
"."
] | [
"func",
"(",
"c",
"*",
"conferencePageIterator",
")",
"Next",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"ConferencePage",
",",
"error",
")",
"{",
"cp",
":=",
"<mask>",
"(",
"ConferencePage",
")",
"\n",
"err",
":=",
"c",
".",
"p",
".",
"Next",
"(",
"ctx",
",",
"cp",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"c",
".",
"p",
".",
"SetNextPageURI",
"(",
"cp",
".",
"NextPageURI",
")",
"\n",
"return",
"cp",
",",
"nil",
"\n",
"}"
] |
6,136 | all-6137 | [
"RemoveOldest",
"removes",
"the",
"oldest",
"item",
"from",
"the",
"cache",
"."
] | [
"func",
"(",
"c",
"*",
"LRU",
")",
"RemoveOldest",
"(",
")",
"(",
"key",
"string",
",",
"value",
"uint64",
",",
"<mask>",
"bool",
")",
"{",
"ent",
":=",
"c",
".",
"evictList",
".",
"Back",
"(",
")",
"\n",
"if",
"ent",
"!=",
"nil",
"{",
"c",
".",
"removeElement",
"(",
"ent",
")",
"\n",
"kv",
":=",
"ent",
".",
"Value",
".",
"(",
"*",
"entry",
")",
"\n",
"return",
"kv",
".",
"key",
",",
"kv",
".",
"value",
",",
"true",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"0",
",",
"false",
"\n",
"}"
] |
6,137 | all-6138 | [
"AmazonRequest",
"is",
"an",
"example",
"to",
"benchmark",
"a",
"call",
"to",
"googles",
"homepage"
] | [
"func",
"AmazonRequest",
"(",
")",
"error",
"{",
"resp",
",",
"err",
":=",
"http",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"defer",
"func",
"(",
"response",
"*",
"http",
".",
"Response",
")",
"{",
"if",
"response",
"!=",
"nil",
"&&",
"<mask>",
".",
"Body",
"!=",
"nil",
"{",
"response",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"}",
"(",
"resp",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"||",
"resp",
".",
"StatusCode",
"!=",
"200",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
6,138 | all-6139 | [
"rawPayload",
"is",
"a",
"helper",
"function",
"that",
"creates",
"a",
"ActionParam",
"for",
"a",
"raw",
"(",
"non",
"object",
")",
"payload"
] | [
"func",
"rawPayload",
"(",
"typ",
"gen",
".",
"DataType",
",",
"p",
"interface",
"{",
"}",
")",
"*",
"<mask>",
".",
"ActionParam",
"{",
"var",
"required",
"bool",
"\n",
"if",
"req",
",",
"ok",
":=",
"p",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"[",
"\"",
"\"",
"]",
";",
"ok",
"{",
"required",
"=",
"req",
".",
"(",
"bool",
")",
"\n",
"}",
"\n",
"return",
"&",
"gen",
".",
"ActionParam",
"{",
"Name",
":",
"\"",
"\"",
",",
"QueryName",
":",
"\"",
"\"",
",",
"VarName",
":",
"\"",
"\"",
",",
"Type",
":",
"typ",
",",
"Location",
":",
"gen",
".",
"PayloadParam",
",",
"Mandatory",
":",
"required",
",",
"}",
"\n",
"}"
] |
6,139 | all-6140 | [
"GetId",
"returns",
"the",
"Id",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"e",
"*",
"Event",
")",
"GetId",
"(",
")",
"int",
"{",
"if",
"e",
"==",
"nil",
"||",
"e",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"*",
"e",
".",
"Id",
"\n",
"}"
] |
6,140 | all-6141 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"KeyframeStyle",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoAnimation8",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
6,141 | all-6142 | [
"/",
"*",
"//",
"Insert",
"writes",
"len",
"(",
"b",
")",
"bytes",
"at",
"the",
"start",
"of",
"the",
"named",
"file",
".",
"It",
"returns",
"an",
"error",
"if",
"any",
".",
"The",
"file",
"is",
"backed",
"up",
".",
"func",
"Insert",
"(",
"filename",
"string",
"b",
"[]",
"byte",
")",
"error",
"{",
"e",
"err",
":",
"=",
"NewEdit",
"(",
"filename",
")",
"if",
"err",
"!",
"=",
"nil",
"{",
"return",
"err",
"}"
] | [
"func",
"Replace",
"(",
"<mask>",
"string",
",",
"r",
"[",
"]",
"Replacer",
")",
"error",
"{",
"e",
",",
"err",
":=",
"NewEdit",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"e",
".",
"genReplace",
"(",
"r",
",",
"-",
"1",
")",
"\n",
"err2",
":=",
"e",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"err2",
"\n",
"}"
] |
6,142 | all-6143 | [
"fromKey",
"converts",
"toKey",
"back",
"into",
"its",
"parts"
] | [
"func",
"fromKey",
"(",
"key",
"string",
")",
"(",
"string",
",",
"string",
",",
"string",
",",
"error",
")",
"{",
"<mask>",
":=",
"strings",
".",
"Split",
"(",
"key",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"parts",
")",
"!=",
"3",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"key",
")",
"\n",
"}",
"\n",
"return",
"parts",
"[",
"0",
"]",
",",
"parts",
"[",
"1",
"]",
",",
"parts",
"[",
"2",
"]",
",",
"nil",
"\n",
"}"
] |
6,143 | all-6144 | [
"Actions",
"register",
"actions"
] | [
"func",
"(",
"bar",
"*",
"ActionBar",
")",
"Actions",
"(",
"<mask>",
"...",
"ActionInterface",
")",
"*",
"ActionBar",
"{",
"newBar",
":=",
"&",
"ActionBar",
"{",
"Admin",
":",
"bar",
".",
"Admin",
",",
"actions",
":",
"bar",
".",
"GlobalActions",
"}",
"\n",
"newBar",
".",
"actions",
"=",
"append",
"(",
"newBar",
".",
"actions",
",",
"actions",
"...",
")",
"\n",
"return",
"newBar",
"\n",
"}"
] |
6,144 | all-6145 | [
"AttachBuffer",
"attaches",
"a",
"binary",
"attachment",
"."
] | [
"func",
"(",
"m",
"*",
"Message",
")",
"AttachBuffer",
"(",
"filename",
"string",
",",
"buf",
"[",
"]",
"<mask>",
",",
"inline",
"bool",
")",
"error",
"{",
"m",
".",
"Attachments",
"[",
"filename",
"]",
"=",
"&",
"Attachment",
"{",
"Filename",
":",
"filename",
",",
"Data",
":",
"buf",
",",
"Inline",
":",
"inline",
",",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
6,145 | all-6146 | [
"Add",
"adds",
"a",
"key",
"-",
"value",
"pair",
"to",
"the",
"block",
".",
"If",
"doNotRestart",
"is",
"true",
"we",
"will",
"not",
"restart",
"even",
"if",
"b",
".",
"counter",
">",
"=",
"restartInterval",
"."
] | [
"func",
"(",
"b",
"*",
"Builder",
")",
"Add",
"(",
"key",
"[",
"]",
"byte",
",",
"value",
"y",
".",
"ValueStruct",
")",
"error",
"{",
"if",
"b",
".",
"counter",
">=",
"restartInterval",
"{",
"b",
".",
"finishBlock",
"(",
")",
"\n",
"// Start a new block. Initialize the block.",
"b",
".",
"restarts",
"=",
"append",
"(",
"b",
".",
"restarts",
",",
"uint32",
"(",
"b",
".",
"buf",
".",
"Len",
"(",
")",
")",
")",
"\n",
"b",
".",
"counter",
"=",
"0",
"\n",
"b",
".",
"baseKey",
"=",
"[",
"]",
"byte",
"{",
"}",
"\n",
"b",
".",
"baseOffset",
"=",
"uint32",
"(",
"b",
".",
"buf",
".",
"Len",
"(",
")",
")",
"\n",
"b",
".",
"prevOffset",
"=",
"math",
".",
"MaxUint32",
"// First key-value pair of block has header.prev=MaxInt.",
"\n",
"}",
"\n",
"b",
".",
"addHelper",
"(",
"key",
",",
"<mask>",
")",
"\n",
"return",
"nil",
"// Currently, there is no meaningful error.",
"\n",
"}"
] |
6,146 | all-6147 | [
"setHeapPtr",
"records",
"that",
"the",
"memory",
"at",
"heap",
"address",
"a",
"contains",
"a",
"pointer",
"."
] | [
"func",
"(",
"p",
"*",
"Process",
")",
"setHeapPtr",
"(",
"a",
"core",
".",
"<mask>",
")",
"{",
"h",
":=",
"p",
".",
"allocHeapInfo",
"(",
"a",
")",
"\n",
"if",
"p",
".",
"proc",
".",
"PtrSize",
"(",
")",
"==",
"8",
"{",
"i",
":=",
"uint",
"(",
"a",
"%",
"heapInfoSize",
")",
"/",
"8",
"\n",
"h",
".",
"ptr",
"[",
"0",
"]",
"|=",
"uint64",
"(",
"1",
")",
"<<",
"i",
"\n",
"return",
"\n",
"}",
"\n",
"i",
":=",
"a",
"%",
"heapInfoSize",
"/",
"4",
"\n",
"h",
".",
"ptr",
"[",
"i",
"/",
"64",
"]",
"|=",
"uint64",
"(",
"1",
")",
"<<",
"(",
"i",
"%",
"64",
")",
"\n",
"}"
] |
6,147 | all-6148 | [
"GetWarningOk",
"returns",
"a",
"tuple",
"with",
"the",
"Warning",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"ThresholdCount",
")",
"GetWarningOk",
"(",
")",
"(",
"json",
".",
"Number",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Warning",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"Warning",
",",
"true",
"\n",
"}"
] |
6,148 | all-6149 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetCategoriesReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoTracing6",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
6,149 | all-6150 | [
"Signal",
"sends",
"a",
"signal",
"to",
"the",
"expect",
"process"
] | [
"func",
"(",
"ep",
"*",
"ExpectProcess",
")",
"Signal",
"(",
"sig",
"<mask>",
".",
"Signal",
")",
"error",
"{",
"return",
"ep",
".",
"cmd",
".",
"Process",
".",
"Signal",
"(",
"sig",
")",
"\n",
"}"
] |
6,150 | all-6151 | [
"Do",
"executes",
"Input",
".",
"synthesizeTapGesture",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SynthesizeTapGestureParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSynthesizeTapGesture",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
6,151 | all-6152 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"KeyframeStyle",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoAnimation8",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
6,152 | all-6153 | [
"multiKeyToProto",
"is",
"a",
"batch",
"version",
"of",
"keyToProto",
"."
] | [
"func",
"multiKeyToProto",
"(",
"appID",
"string",
",",
"key",
"[",
"]",
"*",
"Key",
")",
"[",
"]",
"*",
"pb",
".",
"Reference",
"{",
"ret",
":=",
"make",
"(",
"[",
"]",
"*",
"pb",
".",
"Reference",
",",
"len",
"(",
"key",
")",
")",
"\n",
"for",
"i",
",",
"k",
":=",
"<mask>",
"key",
"{",
"ret",
"[",
"i",
"]",
"=",
"keyToProto",
"(",
"appID",
",",
"k",
")",
"\n",
"}",
"\n",
"return",
"ret",
"\n",
"}"
] |
6,153 | all-6154 | [
"Shutdown",
"is",
"a",
"sentinel",
"option",
"to",
"add",
"shutdown",
"listeners",
".",
"Any",
"shutdown",
"listener",
"can",
"have",
"a",
"type",
"of",
"func",
"()",
"func",
"()",
"error",
"or",
"func",
"(",
"context",
".",
"Context",
")",
"error",
"."
] | [
"func",
"Shutdown",
"(",
"shutdownFuncs",
"...",
"<mask>",
"{",
"}",
")",
"Option",
"{",
"return",
"func",
"(",
"s",
"*",
"Sentinel",
")",
"error",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"s",
".",
"started",
"{",
"return",
"ErrAlreadyStarted",
"\n",
"}",
"\n\n",
"var",
"err",
"error",
"\n",
"s",
".",
"shutdownFuncs",
",",
"err",
"=",
"convertAndAppendContextFuncs",
"(",
"s",
".",
"shutdownFuncs",
",",
"shutdownFuncs",
"...",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}"
] |
6,154 | all-6155 | [
"Stability",
":",
"***",
"EXPERIMENTAL",
"***",
"Terminate",
"an",
"instance",
"in",
"a",
"specified",
"region",
"Required",
"scopes",
":",
"Any",
"of",
":",
"-",
"ec2",
"-",
"manager",
":",
"manage",
"-",
"instances",
":",
"<region",
">",
":",
"<instanceId",
">",
"-",
"ec2",
"-",
"manager",
":",
"manage",
"-",
"resources",
":",
"<workerType",
">",
"See",
"https",
":",
"//",
"docs",
".",
"taskcluster",
".",
"net",
"/",
"reference",
"/",
"core",
"/",
"ec2",
"-",
"manager",
"/",
"api",
"-",
"docs#terminateInstance"
] | [
"func",
"(",
"eC2Manager",
"*",
"EC2Manager",
")",
"TerminateInstance",
"(",
"region",
",",
"instanceId",
"string",
")",
"error",
"{",
"<mask>",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"eC2Manager",
")",
"\n",
"_",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"region",
")",
"+",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"instanceId",
")",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
6,155 | all-6156 | [
"NewWrapResponseWriter",
"wraps",
"an",
"http",
".",
"ResponseWriter",
"returning",
"a",
"proxy",
"that",
"allows",
"you",
"to",
"hook",
"into",
"various",
"parts",
"of",
"the",
"response",
"process",
"."
] | [
"func",
"NewWrapResponseWriter",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"protoMajor",
"int",
")",
"WrapResponseWriter",
"{",
"_",
",",
"fl",
":=",
"w",
".",
"(",
"http",
".",
"Flusher",
")",
"\n\n",
"bw",
":=",
"basicWriter",
"{",
"ResponseWriter",
":",
"w",
"}",
"\n\n",
"if",
"protoMajor",
"==",
"2",
"{",
"_",
",",
"ps",
":=",
"w",
".",
"(",
"http",
".",
"Pusher",
")",
"\n",
"if",
"fl",
"&&",
"<mask>",
"{",
"return",
"&",
"http2FancyWriter",
"{",
"bw",
"}",
"\n",
"}",
"\n",
"}",
"else",
"{",
"_",
",",
"hj",
":=",
"w",
".",
"(",
"http",
".",
"Hijacker",
")",
"\n",
"_",
",",
"rf",
":=",
"w",
".",
"(",
"io",
".",
"ReaderFrom",
")",
"\n",
"if",
"fl",
"&&",
"hj",
"&&",
"rf",
"{",
"return",
"&",
"httpFancyWriter",
"{",
"bw",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"fl",
"{",
"return",
"&",
"flushWriter",
"{",
"bw",
"}",
"\n",
"}",
"\n\n",
"return",
"&",
"bw",
"\n",
"}"
] |
6,156 | all-6157 | [
"update",
"modifies",
"the",
"priority",
"and",
"value",
"of",
"an",
"Item",
"in",
"the",
"queue",
"."
] | [
"func",
"(",
"pq",
"*",
"PriorityQueue",
")",
"update",
"(",
"item",
"*",
"Item",
",",
"value",
"string",
",",
"<mask>",
"int",
")",
"{",
"item",
".",
"value",
"=",
"value",
"\n",
"item",
".",
"priority",
"=",
"priority",
"\n",
"heap",
".",
"Fix",
"(",
"pq",
",",
"item",
".",
"index",
")",
"\n",
"}"
] |
6,157 | all-6158 | [
"FindByName",
"implements",
"FindByName",
"method",
"of",
"PlatformService",
"interface"
] | [
"func",
"(",
"s",
"*",
"platformService",
")",
"FindByName",
"(",
"name",
"string",
")",
"(",
"*",
"appTypes",
".",
"Platform",
",",
"error",
")",
"{",
"p",
",",
"err",
":=",
"s",
".",
"storage",
".",
"FindByName",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"appTypes",
".",
"ErrInvalidPlatform",
"\n",
"}",
"\n",
"return",
"p",
",",
"nil",
"\n",
"}"
] |
6,158 | all-6159 | [
"Remove",
"an",
"entry",
"from",
"the",
"hosts",
"file",
"."
] | [
"func",
"(",
"h",
"*",
"Hosts",
")",
"Remove",
"(",
"ip",
"string",
",",
"hosts",
"...",
"string",
")",
"error",
"{",
"var",
"outputLines",
"[",
"]",
"HostsLine",
"\n\n",
"if",
"<mask>",
".",
"ParseIP",
"(",
"ip",
")",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"ip",
")",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"line",
":=",
"range",
"h",
".",
"Lines",
"{",
"// Bad lines or comments just get readded.",
"if",
"line",
".",
"Err",
"!=",
"nil",
"||",
"line",
".",
"IsComment",
"(",
")",
"||",
"line",
".",
"IP",
"!=",
"ip",
"{",
"outputLines",
"=",
"append",
"(",
"outputLines",
",",
"line",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"var",
"newHosts",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"checkHost",
":=",
"range",
"line",
".",
"Hosts",
"{",
"if",
"!",
"itemInSlice",
"(",
"checkHost",
",",
"hosts",
")",
"{",
"newHosts",
"=",
"append",
"(",
"newHosts",
",",
"checkHost",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// If hosts is empty, skip the line completely.",
"if",
"len",
"(",
"newHosts",
")",
">",
"0",
"{",
"newLineRaw",
":=",
"line",
".",
"IP",
"\n\n",
"for",
"_",
",",
"host",
":=",
"range",
"newHosts",
"{",
"newLineRaw",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"newLineRaw",
",",
"host",
")",
"\n",
"}",
"\n",
"newLine",
":=",
"NewHostsLine",
"(",
"newLineRaw",
")",
"\n",
"outputLines",
"=",
"append",
"(",
"outputLines",
",",
"newLine",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"h",
".",
"Lines",
"=",
"outputLines",
"\n",
"return",
"nil",
"\n",
"}"
] |
6,159 | all-6160 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"CaptureSnapshotParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage78",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
6,160 | all-6161 | [
"Parse",
"parses",
"the",
"command",
"line",
"arguments",
"including",
"the",
"global",
"flags",
"and",
"if",
"any",
"the",
"cmdflag",
"and",
"its",
"flags",
".",
"If",
"the",
"VersionBoolFlag",
"is",
"defined",
"as",
"a",
"global",
"boolean",
"flag",
"then",
"the",
"program",
"version",
"is",
"displayed",
"and",
"the",
"program",
"stops",
"."
] | [
"func",
"Parse",
"(",
")",
"error",
"{",
"args",
":=",
"os",
".",
"Args",
"\n",
"if",
"len",
"(",
"args",
")",
"==",
"1",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// Global flags.",
"fset",
":=",
"flag",
".",
"CommandLine",
"\n",
"fset",
".",
"Usage",
"=",
"Usage",
"\n",
"out",
":=",
"fsetOutput",
"(",
"fset",
")",
"\n\n",
"if",
"err",
":=",
"fset",
".",
"Parse",
"(",
"args",
"[",
"1",
":",
"]",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Handle version request.",
"if",
"f",
":=",
"fset",
".",
"Lookup",
"(",
"VersionBoolFlag",
")",
";",
"f",
"!=",
"nil",
"{",
"if",
"v",
",",
"ok",
":=",
"f",
".",
"Value",
".",
"(",
"flag",
".",
"Getter",
")",
";",
"ok",
"{",
"// All values implemented by the flag package implement the flag.Getter interface.",
"if",
"b",
",",
"ok",
":=",
"v",
".",
"Get",
"(",
")",
".",
"(",
"bool",
")",
";",
"ok",
"&&",
"b",
"{",
"// The flag was defined as a bool and is set.",
"program",
":=",
"programName",
"(",
"args",
"[",
"0",
"]",
")",
"\n",
"fmt",
".",
"Fprintf",
"(",
"out",
",",
"\"",
"\\n",
"\"",
",",
"program",
",",
"buildinfo",
"(",
")",
",",
"runtime",
".",
"GOOS",
",",
"runtime",
".",
"GOARCH",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"// No cmdflag.",
"if",
"fset",
".",
"NArg",
"(",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// Subcommand.",
"idx",
":=",
"len",
"(",
"args",
")",
"-",
"fset",
".",
"NArg",
"(",
")",
"\n",
"s",
":=",
"args",
"[",
"idx",
"]",
"\n",
"args",
"=",
"args",
"[",
"idx",
"+",
"1",
":",
"]",
"\n",
"for",
"_",
",",
"sub",
":=",
"range",
"subs",
"{",
"if",
"sub",
".",
"name",
"!=",
"s",
"{",
"continue",
"\n",
"}",
"\n\n",
"fs",
",",
"handler",
":=",
"sub",
".",
"init",
"(",
"out",
")",
"\n",
"if",
"err",
":=",
"fs",
".",
"Parse",
"(",
"args",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"<mask>",
"(",
"args",
"[",
"len",
"(",
"args",
")",
"-",
"fs",
".",
"NArg",
"(",
")",
":",
"]",
"...",
")",
"\n",
"}",
"\n\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
")",
"\n",
"}"
] |
6,161 | all-6162 | [
"LinkByName",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockNetLink",
")",
"LinkByName",
"(",
"arg0",
"string",
")",
"(",
"netlink",
".",
"Link",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"netlink",
".",
"Link",
")",
"\n",
"ret1",
",",
"_",
":=",
"<mask>",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
6,162 | all-6163 | [
"CreateContainerBackup",
"requests",
"that",
"LXD",
"creates",
"a",
"new",
"backup",
"for",
"the",
"container"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"CreateContainerBackup",
"(",
"containerName",
"string",
",",
"backup",
"api",
".",
"ContainerBackupsPost",
")",
"(",
"Operation",
",",
"error",
")",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Send the request",
"op",
",",
"_",
",",
"err",
":=",
"r",
".",
"queryOperation",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"QueryEscape",
"(",
"containerName",
")",
")",
",",
"backup",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"op",
",",
"nil",
"\n",
"}"
] |
6,163 | all-6164 | [
"GetMetadata",
"gets",
"metadata",
"of",
"an",
"object",
"store",
".",
"See",
":",
"https",
":",
"//",
"chromedevtools",
".",
"github",
".",
"io",
"/",
"devtools",
"-",
"protocol",
"/",
"tot",
"/",
"IndexedDB#method",
"-",
"getMetadata",
"parameters",
":",
"securityOrigin",
"-",
"Security",
"origin",
".",
"databaseName",
"-",
"Database",
"name",
".",
"objectStoreName",
"-",
"Object",
"store",
"name",
"."
] | [
"func",
"GetMetadata",
"(",
"securityOrigin",
"string",
",",
"databaseName",
"<mask>",
",",
"objectStoreName",
"string",
")",
"*",
"GetMetadataParams",
"{",
"return",
"&",
"GetMetadataParams",
"{",
"SecurityOrigin",
":",
"securityOrigin",
",",
"DatabaseName",
":",
"databaseName",
",",
"ObjectStoreName",
":",
"objectStoreName",
",",
"}",
"\n",
"}"
] |
6,164 | all-6165 | [
"Close",
"backend",
"stack",
"file",
".",
"If",
"access",
"is",
"requried",
"file",
"will",
"automatically",
"reopened"
] | [
"func",
"(",
"s",
"*",
"Stack",
")",
"Close",
"(",
")",
"error",
"{",
"s",
".",
"<mask>",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"guard",
".",
"Unlock",
"(",
")",
"\n",
"if",
"s",
".",
"file",
"!=",
"nil",
"{",
"err",
":=",
"s",
".",
"file",
".",
"Close",
"(",
")",
"\n",
"s",
".",
"file",
"=",
"nil",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
6,165 | all-6166 | [
"Retry",
"on",
"transport",
"failures",
".",
"Does",
"not",
"retry",
"on",
"500s",
"."
] | [
"func",
"(",
"c",
"*",
"dryRunProwJobClient",
")",
"requestRetry",
"(",
"path",
"string",
",",
"query",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"resp",
",",
"err",
":=",
"c",
".",
"retry",
"(",
"path",
",",
"query",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"rb",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"resp",
".",
"StatusCode",
"==",
"404",
"{",
"return",
"nil",
",",
"&",
"kapierrors",
".",
"StatusError",
"{",
"ErrStatus",
":",
"metav1",
".",
"Status",
"{",
"Status",
":",
"metav1",
".",
"StatusFailure",
",",
"Code",
":",
"http",
".",
"StatusNotFound",
",",
"Reason",
":",
"metav1",
".",
"StatusReasonNotFound",
",",
"}",
"}",
"\n",
"}",
"else",
"if",
"resp",
".",
"StatusCode",
"==",
"409",
"{",
"return",
"nil",
",",
"&",
"kapierrors",
".",
"StatusError",
"{",
"ErrStatus",
":",
"metav1",
".",
"<mask>",
"{",
"Status",
":",
"metav1",
".",
"StatusFailure",
",",
"Code",
":",
"http",
".",
"StatusConflict",
",",
"Reason",
":",
"metav1",
".",
"StatusReasonAlreadyExists",
",",
"}",
"}",
"\n",
"}",
"else",
"if",
"resp",
".",
"StatusCode",
"==",
"422",
"{",
"return",
"nil",
",",
"&",
"kapierrors",
".",
"StatusError",
"{",
"ErrStatus",
":",
"metav1",
".",
"Status",
"{",
"Status",
":",
"metav1",
".",
"StatusFailure",
",",
"Code",
":",
"http",
".",
"StatusUnprocessableEntity",
",",
"Reason",
":",
"metav1",
".",
"StatusReasonInvalid",
",",
"}",
"}",
"\n",
"}",
"else",
"if",
"resp",
".",
"StatusCode",
"<",
"200",
"||",
"resp",
".",
"StatusCode",
">",
"299",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"resp",
".",
"Status",
",",
"string",
"(",
"rb",
")",
")",
"\n",
"}",
"\n",
"return",
"rb",
",",
"nil",
"\n",
"}"
] |
6,166 | all-6167 | [
"StringWithinTransport",
"returns",
"a",
"string",
"representation",
"of",
"the",
"reference",
"which",
"MUST",
"be",
"such",
"that",
"reference",
".",
"Transport",
"()",
".",
"ParseReference",
"(",
"reference",
".",
"StringWithinTransport",
"()",
")",
"returns",
"an",
"equivalent",
"reference",
".",
"NOTE",
":",
"The",
"returned",
"string",
"is",
"not",
"promised",
"to",
"be",
"equal",
"to",
"the",
"original",
"input",
"to",
"ParseReference",
";",
"e",
".",
"g",
".",
"default",
"attribute",
"values",
"omitted",
"by",
"the",
"user",
"may",
"be",
"filled",
"in",
"in",
"the",
"return",
"value",
"or",
"vice",
"versa",
".",
"WARNING",
":",
"Do",
"not",
"use",
"the",
"return",
"value",
"in",
"the",
"UI",
"to",
"describe",
"an",
"image",
"it",
"does",
"not",
"contain",
"the",
"Transport",
"()",
".",
"Name",
"()",
"prefix",
";",
"instead",
"see",
"transports",
".",
"ImageName",
"()",
"."
] | [
"func",
"(",
"<mask>",
"daemonReference",
")",
"StringWithinTransport",
"(",
")",
"string",
"{",
"switch",
"{",
"case",
"ref",
".",
"id",
"!=",
"\"",
"\"",
":",
"return",
"ref",
".",
"id",
".",
"String",
"(",
")",
"\n",
"case",
"ref",
".",
"ref",
"!=",
"nil",
":",
"return",
"reference",
".",
"FamiliarString",
"(",
"ref",
".",
"ref",
")",
"\n",
"default",
":",
"// Coverage: Should never happen, NewReference above should refuse such values.",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
6,167 | all-6168 | [
"Reset",
"clears",
"uri",
"."
] | [
"func",
"(",
"u",
"*",
"URI",
")",
"Reset",
"(",
")",
"{",
"u",
".",
"pathOriginal",
"=",
"u",
".",
"pathOriginal",
"[",
":",
"0",
"]",
"\n",
"u",
".",
"scheme",
"=",
"u",
".",
"scheme",
"[",
":",
"0",
"]",
"\n",
"u",
".",
"path",
"=",
"u",
".",
"path",
"[",
":",
"0",
"]",
"\n",
"u",
".",
"queryString",
"=",
"u",
".",
"queryString",
"[",
":",
"0",
"]",
"\n",
"u",
".",
"hash",
"=",
"u",
".",
"<mask>",
"[",
":",
"0",
"]",
"\n\n",
"u",
".",
"host",
"=",
"u",
".",
"host",
"[",
":",
"0",
"]",
"\n",
"u",
".",
"queryArgs",
".",
"Reset",
"(",
")",
"\n",
"u",
".",
"parsedQueryArgs",
"=",
"false",
"\n\n",
"// There is no need in u.fullURI = u.fullURI[:0], since full uri",
"// is calculated on each call to FullURI().",
"// There is no need in u.requestURI = u.requestURI[:0], since requestURI",
"// is calculated on each call to RequestURI().",
"u",
".",
"h",
"=",
"nil",
"\n",
"}"
] |
6,168 | all-6169 | [
"Access",
"returns",
"a",
"handler",
"that",
"writes",
"an",
"access",
"log",
"message",
"to",
"the",
"provided",
"logger",
"provided",
"by",
"the",
"options",
"whenever",
"the",
"handler",
"h",
"is",
"invoked",
".",
"The",
"log",
"message",
"is",
"of",
"the",
"following",
"format",
":",
"IP",
"-",
"USER",
"[",
"DATETIME",
"-",
"DURATION",
"]",
"HTTP_METHOD",
"URI",
"STATUS_CODE",
"BODY_LENGTH",
"REFERER",
"USER_AGENT",
"By",
"default",
"all",
"messages",
"are",
"printed",
"to",
"os",
".",
"Stdout",
"."
] | [
"func",
"Access",
"(",
"h",
"http",
".",
"Handler",
",",
"opts",
"...",
"Option",
")",
"http",
".",
"Handler",
"{",
"o",
":=",
"options",
"{",
"logger",
":",
"handler",
".",
"OutLogger",
"(",
")",
",",
"dateFormat",
":",
"AccessDateFormat",
"}",
"\n",
"o",
".",
"<mask>",
"(",
"opts",
")",
"\n\n",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"start",
":=",
"time",
".",
"Now",
"(",
")",
"\n\n",
"wrapper",
":=",
"handler",
".",
"NewResponseWrapper",
"(",
"w",
")",
"\n\n",
"uri",
":=",
"r",
".",
"URL",
".",
"RequestURI",
"(",
")",
"\n",
"remoteAddr",
":=",
"remoteAddr",
"(",
"r",
")",
"\n",
"remoteUser",
":=",
"remoteUser",
"(",
"r",
")",
"\n",
"method",
":=",
"r",
".",
"Method",
"\n",
"referer",
":=",
"r",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"userAgent",
":=",
"r",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n\n",
"h",
".",
"ServeHTTP",
"(",
"wrapper",
",",
"r",
")",
"\n\n",
"for",
"k",
",",
"v",
":=",
"range",
"wrapper",
".",
"Header",
"(",
")",
"{",
"w",
".",
"Header",
"(",
")",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"w",
".",
"WriteHeader",
"(",
"wrapper",
".",
"Code",
")",
"\n",
"w",
".",
"Write",
"(",
"wrapper",
".",
"Body",
".",
"Bytes",
"(",
")",
")",
"\n\n",
"now",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"timestamp",
":=",
"now",
".",
"Format",
"(",
"o",
".",
"dateFormat",
")",
"\n",
"code",
":=",
"wrapper",
".",
"Code",
"\n",
"length",
":=",
"wrapper",
".",
"Body",
".",
"Len",
"(",
")",
"\n\n",
"o",
".",
"logger",
".",
"Print",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"remoteAddr",
",",
"remoteUser",
",",
"timestamp",
",",
"now",
".",
"Sub",
"(",
"start",
")",
",",
"method",
",",
"uri",
",",
"code",
",",
"length",
",",
"referer",
",",
"userAgent",
")",
")",
"\n",
"}",
")",
"\n",
"}"
] |
6,169 | all-6170 | [
"Set",
"is",
"a",
"wrapper",
"around",
"gtk_alignment_set",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Alignment",
")",
"<mask>",
"(",
"xalign",
",",
"yalign",
",",
"xscale",
",",
"yscale",
"float32",
")",
"{",
"C",
".",
"gtk_alignment_set",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gfloat",
"(",
"xalign",
")",
",",
"C",
".",
"gfloat",
"(",
"yalign",
")",
",",
"C",
".",
"gfloat",
"(",
"xscale",
")",
",",
"C",
".",
"gfloat",
"(",
"yscale",
")",
")",
"\n",
"}"
] |
6,170 | all-6171 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventConsoleProfileStarted",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoProfiler22",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
6,171 | all-6172 | [
"AddHostComment",
"creates",
"a",
"new",
"ADD_HOST_COMMENT",
"Nagios",
"command",
".",
"Adds",
"a",
"comment",
"to",
"a",
"particular",
"host",
".",
"If",
"the",
"persistent",
"field",
"is",
"set",
"to",
"zero",
"(",
"0",
")",
"the",
"comment",
"will",
"be",
"deleted",
"the",
"next",
"time",
"Nagios",
"is",
"restarted",
".",
"Otherwise",
"the",
"comment",
"will",
"persist",
"across",
"program",
"restarts",
"until",
"it",
"is",
"deleted",
"manually",
"."
] | [
"func",
"AddHostComment",
"(",
"host_name",
"string",
",",
"persistent",
"bool",
",",
"author",
"string",
",",
"<mask>",
"string",
",",
")",
"*",
"livestatus",
".",
"Command",
"{",
"return",
"livestatus",
".",
"NewCommand",
"(",
"\"",
"\"",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"host_name",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"persistent",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"author",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"comment",
")",
",",
")",
"\n",
"}"
] |
6,172 | all-6173 | [
"NB",
":",
"path",
"is",
"assumed",
"to",
"be",
"in",
"native",
"-",
"OS",
"path",
"separator",
"form"
] | [
"func",
"dirURL",
"(",
"path",
"string",
")",
"*",
"url",
".",
"URL",
"{",
"path",
"=",
"filepath",
".",
"ToSlash",
"(",
"path",
")",
"\n",
"if",
"<mask>",
"[",
"len",
"(",
"path",
")",
"-",
"1",
"]",
"!=",
"'/'",
"{",
"// trailing slash is important",
"path",
"=",
"path",
"+",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"&",
"url",
".",
"URL",
"{",
"Scheme",
":",
"\"",
"\"",
",",
"Path",
":",
"path",
"}",
"\n",
"}"
] |
6,173 | all-6174 | [
"/",
"*",
"Notify",
"is",
"used",
"to",
"send",
"native",
"push",
"notifications",
"via",
"Apple",
"APNS",
"or",
"Google",
"GCM",
"/",
"FCM",
"systems",
".",
"Please",
"make",
"sure",
"that",
"you",
"have",
"provided",
"a",
"Client",
".",
"PushNotificationHost",
"please",
"see",
"Pusher",
"docs",
"for",
"details",
":",
"https",
":",
"//",
"pusher",
".",
"com",
"/",
"docs",
"/",
"push_notifications"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Notify",
"(",
"interests",
"[",
"]",
"string",
",",
"pushNotification",
"PushNotification",
")",
"(",
"*",
"NotifyResponse",
",",
"error",
")",
"{",
"pNRequest",
":=",
"notificationRequest",
"{",
"interests",
",",
"&",
"pushNotification",
",",
"}",
"\n\n",
"err",
":=",
"pNRequest",
".",
"validate",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"PushNotificationHost",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"requestBody",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"pNRequest",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"path",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"PushNotifAPIPrefixDefault",
",",
"PushNotifAPIVersionDefault",
",",
"c",
".",
"AppId",
")",
"\n\n",
"<mask>",
",",
"err",
":=",
"createRequestURL",
"(",
"\"",
"\"",
",",
"c",
".",
"PushNotificationHost",
",",
"path",
",",
"c",
".",
"Key",
",",
"c",
".",
"Secret",
",",
"authTimestamp",
"(",
")",
",",
"c",
".",
"Secure",
",",
"requestBody",
",",
"nil",
",",
"c",
".",
"Cluster",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"byteResponse",
",",
"err",
":=",
"c",
".",
"request",
"(",
"\"",
"\"",
",",
"url",
",",
"requestBody",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"response",
"*",
"NotifyResponse",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"byteResponse",
",",
"&",
"response",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"response",
",",
"err",
"\n",
"}"
] |
6,174 | all-6175 | [
"ConsumeMessages",
"reads",
"messages",
"from",
"the",
"websocket",
"connection",
"and",
"handles",
"read",
"messages",
"from",
"an",
"active",
"connection",
"."
] | [
"func",
"(",
"cs",
"*",
"ClientServerImpl",
")",
"ConsumeMessages",
"(",
")",
"error",
"{",
"for",
"{",
"if",
"err",
":=",
"cs",
".",
"SetReadDeadline",
"(",
"<mask>",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"cs",
".",
"RWTimeout",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"messageType",
",",
"message",
",",
"err",
":=",
"cs",
".",
"conn",
".",
"ReadMessage",
"(",
")",
"\n\n",
"switch",
"{",
"case",
"err",
"==",
"nil",
":",
"if",
"messageType",
"!=",
"websocket",
".",
"TextMessage",
"{",
"// maybe not fatal though, we'll try to process it anyways",
"seelog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"messageType",
")",
"\n",
"}",
"\n",
"cs",
".",
"handleMessage",
"(",
"message",
")",
"\n\n",
"case",
"permissibleCloseCode",
"(",
"err",
")",
":",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"io",
".",
"EOF",
"\n\n",
"default",
":",
"// Unexpected error occurred",
"seelog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
",",
"messageType",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"}",
"\n",
"}"
] |
6,175 | all-6176 | [
"DeleteNode",
"an",
"item",
"from",
"the",
"skiplist",
"by",
"specifying",
"its",
"node"
] | [
"func",
"(",
"s",
"*",
"Skiplist",
")",
"DeleteNode",
"(",
"n",
"*",
"Node",
",",
"cmp",
"CompareFn",
",",
"buf",
"*",
"ActionBuffer",
",",
"sts",
"*",
"Stats",
")",
"bool",
"{",
"<mask>",
":=",
"s",
".",
"barrier",
".",
"Acquire",
"(",
")",
"\n",
"defer",
"s",
".",
"barrier",
".",
"Release",
"(",
"token",
")",
"\n\n",
"return",
"s",
".",
"deleteNode",
"(",
"n",
",",
"cmp",
",",
"buf",
",",
"sts",
")",
"\n",
"}"
] |
6,176 | all-6177 | [
"Resign",
"lets",
"a",
"leader",
"start",
"a",
"new",
"election",
"."
] | [
"func",
"(",
"e",
"*",
"Election",
")",
"Resign",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"if",
"e",
".",
"leaderSession",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"client",
":=",
"e",
".",
"session",
".",
"<mask>",
"(",
")",
"\n",
"cmp",
":=",
"v3",
".",
"Compare",
"(",
"v3",
".",
"CreateRevision",
"(",
"e",
".",
"leaderKey",
")",
",",
"\"",
"\"",
",",
"e",
".",
"leaderRev",
")",
"\n",
"resp",
",",
"err",
":=",
"client",
".",
"Txn",
"(",
"ctx",
")",
".",
"If",
"(",
"cmp",
")",
".",
"Then",
"(",
"v3",
".",
"OpDelete",
"(",
"e",
".",
"leaderKey",
")",
")",
".",
"Commit",
"(",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"e",
".",
"hdr",
"=",
"resp",
".",
"Header",
"\n",
"}",
"\n",
"e",
".",
"leaderKey",
"=",
"\"",
"\"",
"\n",
"e",
".",
"leaderSession",
"=",
"nil",
"\n",
"return",
"err",
"\n",
"}"
] |
6,177 | all-6178 | [
"tagsToWhere",
"creates",
"a",
"where",
"query",
"to",
"match",
"tags",
"element"
] | [
"func",
"tagsToWhere",
"(",
"tags",
"map",
"[",
"string",
"]",
"string",
")",
"string",
"{",
"if",
"len",
"(",
"tags",
")",
"==",
"0",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"sortedKeys",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"k",
":=",
"range",
"tags",
"{",
"sortedKeys",
"=",
"append",
"(",
"sortedKeys",
",",
"k",
")",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"sortedKeys",
")",
"\n\n",
"conditions",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"key",
":=",
"range",
"sortedKeys",
"{",
"conditions",
"=",
"append",
"(",
"conditions",
",",
"fmt",
".",
"Sprintf",
"(",
"`\"%s\" = '%v'`",
",",
"key",
",",
"<mask>",
"[",
"key",
"]",
")",
")",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"+",
"strings",
".",
"Join",
"(",
"conditions",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
6,178 | all-6179 | [
"DescribeEntry",
"returns",
"a",
"concise",
"human",
"-",
"readable",
"description",
"of",
"an",
"Entry",
"for",
"debugging",
"."
] | [
"func",
"DescribeEntry",
"(",
"e",
"pb",
".",
"Entry",
",",
"f",
"EntryFormatter",
")",
"string",
"{",
"var",
"formatted",
"string",
"\n",
"if",
"e",
".",
"Type",
"==",
"pb",
".",
"EntryNormal",
"&&",
"f",
"!=",
"nil",
"{",
"formatted",
"=",
"f",
"(",
"e",
".",
"Data",
")",
"\n",
"}",
"else",
"{",
"formatted",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"e",
".",
"Data",
")",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"e",
".",
"Term",
",",
"e",
".",
"Index",
",",
"e",
".",
"<mask>",
",",
"formatted",
")",
"\n",
"}"
] |
6,179 | all-6180 | [
"indicate",
"modifications",
"to",
"a",
"range",
"of",
"a",
"mapped",
"buffer"
] | [
"func",
"FlushMappedBufferRange",
"(",
"target",
"uint32",
",",
"<mask>",
"int",
",",
"length",
"int",
")",
"{",
"C",
".",
"glowFlushMappedBufferRange",
"(",
"gpFlushMappedBufferRange",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLintptr",
")",
"(",
"offset",
")",
",",
"(",
"C",
".",
"GLsizeiptr",
")",
"(",
"length",
")",
")",
"\n",
"}"
] |
6,180 | all-6181 | [
"writeString",
"adds",
"a",
"string",
"to",
"the",
"string",
"being",
"printed",
"."
] | [
"func",
"(",
"ps",
"*",
"printState",
")",
"writeString",
"(",
"s",
"string",
")",
"{",
"if",
"len",
"(",
"s",
")",
">",
"0",
"{",
"ps",
".",
"<mask>",
"=",
"s",
"[",
"len",
"(",
"s",
")",
"-",
"1",
"]",
"\n",
"}",
"\n",
"ps",
".",
"buf",
".",
"WriteString",
"(",
"s",
")",
"\n",
"}"
] |
6,181 | all-6182 | [
"delete",
"does",
"a",
"recursive",
"deletion"
] | [
"func",
"(",
"t",
"*",
"Tree",
")",
"deletePrefix",
"(",
"parent",
",",
"n",
"*",
"node",
",",
"prefix",
"string",
")",
"int",
"{",
"// Check for key exhaustion",
"if",
"len",
"(",
"prefix",
")",
"==",
"0",
"{",
"// Remove the leaf node",
"subTreeSize",
":=",
"0",
"\n",
"//recursively walk from all edges of the node to be deleted",
"recursiveWalk",
"(",
"n",
",",
"func",
"(",
"s",
"string",
",",
"v",
"interface",
"{",
"}",
")",
"bool",
"{",
"subTreeSize",
"++",
"\n",
"return",
"false",
"\n",
"}",
")",
"\n",
"if",
"n",
".",
"isLeaf",
"(",
")",
"{",
"n",
".",
"leaf",
"=",
"nil",
"\n",
"}",
"\n",
"n",
".",
"edges",
"=",
"nil",
"// deletes the entire subtree",
"\n\n",
"// Check if we should merge the parent's other child",
"if",
"parent",
"!=",
"nil",
"&&",
"parent",
"!=",
"t",
".",
"root",
"&&",
"len",
"(",
"parent",
".",
"edges",
")",
"==",
"1",
"&&",
"!",
"parent",
".",
"isLeaf",
"(",
")",
"{",
"parent",
".",
"mergeChild",
"(",
")",
"\n",
"}",
"\n",
"t",
".",
"size",
"-=",
"subTreeSize",
"\n",
"return",
"subTreeSize",
"\n",
"}",
"\n\n",
"// Look for an edge",
"label",
":=",
"prefix",
"[",
"0",
"]",
"\n",
"<mask>",
":=",
"n",
".",
"getEdge",
"(",
"label",
")",
"\n",
"if",
"child",
"==",
"nil",
"||",
"(",
"!",
"strings",
".",
"HasPrefix",
"(",
"child",
".",
"prefix",
",",
"prefix",
")",
"&&",
"!",
"strings",
".",
"HasPrefix",
"(",
"prefix",
",",
"child",
".",
"prefix",
")",
")",
"{",
"return",
"0",
"\n",
"}",
"\n\n",
"// Consume the search prefix",
"if",
"len",
"(",
"child",
".",
"prefix",
")",
">",
"len",
"(",
"prefix",
")",
"{",
"prefix",
"=",
"prefix",
"[",
"len",
"(",
"prefix",
")",
":",
"]",
"\n",
"}",
"else",
"{",
"prefix",
"=",
"prefix",
"[",
"len",
"(",
"child",
".",
"prefix",
")",
":",
"]",
"\n",
"}",
"\n",
"return",
"t",
".",
"deletePrefix",
"(",
"n",
",",
"child",
",",
"prefix",
")",
"\n",
"}"
] |
6,182 | all-6183 | [
"Criticalf",
"is",
"a",
"shorthand",
"function",
"which",
"exits",
"the",
"check",
"with",
"status",
"CRITICAL",
"and",
"the",
"message",
"provided",
"."
] | [
"func",
"(",
"c",
"*",
"Check",
")",
"Criticalf",
"(",
"<mask>",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"c",
".",
"Exitf",
"(",
"CRITICAL",
",",
"format",
",",
"v",
"...",
")",
"\n",
"}"
] |
6,183 | all-6184 | [
"specify",
"a",
"parameter",
"for",
"a",
"program",
"object"
] | [
"func",
"ProgramParameteri",
"(",
"program",
"uint32",
",",
"pname",
"uint32",
",",
"value",
"int32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpProgramParameteri",
",",
"3",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"pname",
")",
",",
"uintptr",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
6,184 | all-6185 | [
"NameOrID",
"is",
"a",
"convenience",
"method",
"mainly",
"for",
"helping",
"displaying",
"friendly",
"errors",
"where",
"space",
"is",
"important",
"-",
"it",
"displays",
"either",
"the",
"host",
"name",
"or",
"the",
"ID",
"if",
"there",
"was",
"an",
"error",
"fetching",
"it",
"."
] | [
"func",
"NameOrID",
"(",
"client",
"*",
"govmomi",
".",
"Client",
",",
"<mask>",
"string",
")",
"string",
"{",
"name",
",",
"err",
":=",
"hostSystemNameFromID",
"(",
"client",
",",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"id",
"\n",
"}",
"\n",
"return",
"name",
"\n",
"}"
] |
6,185 | all-6186 | [
"Terminology",
"from",
"RFC",
"2047",
":",
"encoded",
"-",
"word",
":",
"the",
"entire",
"=",
"?charset?encoding?encoded",
"-",
"text?",
"=",
"string",
"charset",
":",
"the",
"character",
"set",
"portion",
"of",
"the",
"encoded",
"word",
"encoding",
":",
"the",
"character",
"encoding",
"type",
"used",
"for",
"the",
"encoded",
"-",
"text",
"encoded",
"-",
"text",
":",
"the",
"text",
"we",
"are",
"decoding",
"readHeader",
"reads",
"a",
"block",
"of",
"SMTP",
"or",
"MIME",
"headers",
"and",
"returns",
"a",
"textproto",
".",
"MIMEHeader",
".",
"Header",
"parse",
"warnings",
"&",
"errors",
"will",
"be",
"added",
"to",
"p",
".",
"Errors",
"io",
"errors",
"will",
"be",
"returned",
"directly",
"."
] | [
"func",
"readHeader",
"(",
"r",
"*",
"bufio",
".",
"Reader",
",",
"p",
"*",
"Part",
")",
"(",
"textproto",
".",
"MIMEHeader",
",",
"error",
")",
"{",
"// buf holds the massaged output for textproto.Reader.ReadMIMEHeader()",
"buf",
":=",
"&",
"bytes",
".",
"Buffer",
"{",
"}",
"\n",
"tp",
":=",
"textproto",
".",
"NewReader",
"(",
"r",
")",
"\n",
"firstHeader",
":=",
"true",
"\n",
"for",
"{",
"// Pull out each line of the headers as a temporary slice s",
"s",
",",
"err",
":=",
"tp",
".",
"ReadLineBytes",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"cause",
":=",
"errors",
".",
"Cause",
"(",
"err",
")",
"\n",
"if",
"<mask>",
"==",
"io",
".",
"ErrUnexpectedEOF",
"&&",
"buf",
".",
"Len",
"(",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"errors",
".",
"WithStack",
"(",
"errEmptyHeaderBlock",
")",
"\n",
"}",
"else",
"if",
"cause",
"==",
"io",
".",
"EOF",
"{",
"buf",
".",
"Write",
"(",
"[",
"]",
"byte",
"{",
"'\\r'",
",",
"'\\n'",
"}",
")",
"\n",
"break",
"\n",
"}",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"firstColon",
":=",
"bytes",
".",
"IndexByte",
"(",
"s",
",",
"':'",
")",
"\n",
"firstSpace",
":=",
"bytes",
".",
"IndexAny",
"(",
"s",
",",
"\"",
"\\t",
"\\n",
"\\r",
"\"",
")",
"\n",
"if",
"firstSpace",
"==",
"0",
"{",
"// Starts with space: continuation",
"buf",
".",
"WriteByte",
"(",
"' '",
")",
"\n",
"buf",
".",
"Write",
"(",
"textproto",
".",
"TrimBytes",
"(",
"s",
")",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"if",
"firstColon",
"==",
"0",
"{",
"// Can't parse line starting with colon: skip",
"p",
".",
"addError",
"(",
"ErrorMalformedHeader",
",",
"\"",
"\"",
",",
"s",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"if",
"firstColon",
">",
"0",
"{",
"// Contains a colon, treat as a new header line",
"if",
"!",
"firstHeader",
"{",
"// New Header line, end the previous",
"buf",
".",
"Write",
"(",
"[",
"]",
"byte",
"{",
"'\\r'",
",",
"'\\n'",
"}",
")",
"\n",
"}",
"\n",
"s",
"=",
"textproto",
".",
"TrimBytes",
"(",
"s",
")",
"\n",
"buf",
".",
"Write",
"(",
"s",
")",
"\n",
"firstHeader",
"=",
"false",
"\n",
"}",
"else",
"{",
"// No colon: potential non-indented continuation",
"if",
"len",
"(",
"s",
")",
">",
"0",
"{",
"// Attempt to detect and repair a non-indented continuation of previous line",
"buf",
".",
"WriteByte",
"(",
"' '",
")",
"\n",
"buf",
".",
"Write",
"(",
"s",
")",
"\n",
"p",
".",
"addWarning",
"(",
"ErrorMalformedHeader",
",",
"\"",
"\"",
",",
"s",
")",
"\n",
"}",
"else",
"{",
"// Empty line, finish header parsing",
"buf",
".",
"Write",
"(",
"[",
"]",
"byte",
"{",
"'\\r'",
",",
"'\\n'",
"}",
")",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"buf",
".",
"Write",
"(",
"[",
"]",
"byte",
"{",
"'\\r'",
",",
"'\\n'",
"}",
")",
"\n",
"tr",
":=",
"textproto",
".",
"NewReader",
"(",
"bufio",
".",
"NewReader",
"(",
"buf",
")",
")",
"\n",
"header",
",",
"err",
":=",
"tr",
".",
"ReadMIMEHeader",
"(",
")",
"\n",
"return",
"header",
",",
"errors",
".",
"WithStack",
"(",
"err",
")",
"\n",
"}"
] |
6,186 | all-6187 | [
"DeleteInstance",
"deletes",
"the",
"service",
"instance",
"from",
"the",
"database",
"."
] | [
"func",
"DeleteInstance",
"(",
"si",
"*",
"ServiceInstance",
",",
"evt",
"*",
"event",
".",
"Event",
",",
"requestID",
"string",
")",
"error",
"{",
"if",
"len",
"(",
"si",
".",
"Apps",
")",
">",
"0",
"{",
"return",
"ErrServiceInstanceBound",
"\n",
"}",
"\n",
"s",
",",
"err",
":=",
"Get",
"(",
"si",
".",
"ServiceName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"endpoint",
",",
"err",
":=",
"s",
".",
"getClient",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"endpoint",
".",
"Destroy",
"(",
"si",
",",
"evt",
",",
"requestID",
")",
"\n",
"}",
"\n",
"conn",
",",
"err",
":=",
"db",
".",
"Conn",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"conn",
".",
"Close",
"(",
")",
"\n",
"return",
"conn",
".",
"ServiceInstances",
"(",
")",
".",
"Remove",
"(",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"si",
".",
"<mask>",
",",
"\"",
"\"",
":",
"si",
".",
"ServiceName",
"}",
")",
"\n",
"}"
] |
6,187 | all-6188 | [
"EvaluateOnCallFrame",
"evaluates",
"expression",
"on",
"a",
"given",
"call",
"frame",
".",
"See",
":",
"https",
":",
"//",
"chromedevtools",
".",
"github",
".",
"io",
"/",
"devtools",
"-",
"protocol",
"/",
"tot",
"/",
"Debugger#method",
"-",
"evaluateOnCallFrame",
"parameters",
":",
"callFrameID",
"-",
"Call",
"frame",
"identifier",
"to",
"evaluate",
"on",
".",
"expression",
"-",
"Expression",
"to",
"evaluate",
"."
] | [
"func",
"EvaluateOnCallFrame",
"(",
"callFrameID",
"CallFrameID",
",",
"expression",
"string",
")",
"*",
"EvaluateOnCallFrameParams",
"{",
"return",
"&",
"EvaluateOnCallFrameParams",
"{",
"CallFrameID",
":",
"callFrameID",
",",
"Expression",
":",
"<mask>",
",",
"}",
"\n",
"}"
] |
6,188 | all-6189 | [
"Giving",
"a",
"value",
"an",
"index",
"and",
"the",
"key",
"of",
"the",
"item",
"return",
"the",
"path",
"under",
"which",
"the",
"new",
"index",
"item",
"should",
"be",
"stored",
"."
] | [
"func",
"(",
"c",
"*",
"readWriteCollection",
")",
"getIndexPath",
"(",
"val",
"interface",
"{",
"}",
",",
"index",
"*",
"Index",
",",
"<mask>",
"string",
")",
"string",
"{",
"reflVal",
":=",
"reflect",
".",
"ValueOf",
"(",
"val",
")",
"\n",
"field",
":=",
"reflect",
".",
"Indirect",
"(",
"reflVal",
")",
".",
"FieldByName",
"(",
"index",
".",
"Field",
")",
".",
"Interface",
"(",
")",
"\n",
"return",
"c",
".",
"indexPath",
"(",
"index",
",",
"field",
",",
"key",
")",
"\n",
"}"
] |
6,189 | all-6190 | [
"Claims",
"unmarshall",
"the",
"claims",
"of",
"the",
"provided",
"token"
] | [
"func",
"(",
"v",
"*",
"JWTValidator",
")",
"Claims",
"(",
"r",
"*",
"http",
".",
"Request",
",",
"token",
"*",
"jwt",
".",
"JSONWebToken",
",",
"values",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"key",
",",
"err",
":=",
"v",
".",
"config",
".",
"secretProvider",
".",
"GetSecret",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"Claims",
"(",
"key",
",",
"values",
"...",
")",
"\n",
"}"
] |
6,190 | all-6191 | [
"Replaces",
"the",
"source",
"code",
"in",
"a",
"shader",
"object"
] | [
"func",
"ShaderSource",
"(",
"shader",
"uint32",
",",
"<mask>",
"int32",
",",
"xstring",
"*",
"*",
"uint8",
",",
"length",
"*",
"int32",
")",
"{",
"C",
".",
"glowShaderSource",
"(",
"gpShaderSource",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"shader",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"*",
"*",
"C",
".",
"GLchar",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"xstring",
")",
")",
",",
"(",
"*",
"C",
".",
"GLint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"length",
")",
")",
")",
"\n",
"}"
] |
6,191 | all-6192 | [
"export",
"FileSequence_ZFill"
] | [
"func",
"FileSequence_ZFill",
"(",
"<mask>",
"FileSeqId",
")",
"C",
".",
"int",
"{",
"fs",
",",
"ok",
":=",
"sFileSeqs",
".",
"Get",
"(",
"id",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"C",
".",
"int",
"(",
"fs",
".",
"ZFill",
"(",
")",
")",
"\n",
"}"
] |
6,192 | all-6193 | [
"MkTemp",
"creates",
"a",
"temporary",
"file",
"in",
"the",
"guest",
"operating",
"system",
".",
"The",
"user",
"is",
"responsible",
"for",
"removing",
"the",
"file",
"when",
"it",
"is",
"no",
"longer",
"needed",
".",
"Since",
"VMware",
"Workstation",
"6",
".",
"0",
"Minimum",
"Supported",
"Guest",
"OS",
":",
"Microsoft",
"Windows",
"NT",
"Series",
"Linux"
] | [
"func",
"(",
"g",
"*",
"Guest",
")",
"MkTemp",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"jobHandle",
"C",
".",
"VixHandle",
"=",
"C",
".",
"VIX_INVALID_HANDLE",
"\n",
"var",
"err",
"C",
".",
"VixError",
"=",
"C",
".",
"VIX_OK",
"\n",
"<mask>",
"tempFilePath",
"*",
"C",
".",
"char",
"\n\n",
"jobHandle",
"=",
"C",
".",
"VixVM_CreateTempFileInGuest",
"(",
"g",
".",
"handle",
",",
"0",
",",
"// options",
"C",
".",
"VIX_INVALID_HANDLE",
",",
"// propertyListHandle",
"nil",
",",
"// callbackProc",
"nil",
")",
"// clientData",
"\n\n",
"defer",
"C",
".",
"Vix_ReleaseHandle",
"(",
"jobHandle",
")",
"\n\n",
"err",
"=",
"C",
".",
"get_temp_filepath",
"(",
"jobHandle",
",",
"tempFilePath",
")",
"\n",
"defer",
"C",
".",
"Vix_FreeBuffer",
"(",
"unsafe",
".",
"Pointer",
"(",
"tempFilePath",
")",
")",
"\n\n",
"if",
"C",
".",
"VIX_OK",
"!=",
"err",
"{",
"return",
"\"",
"\"",
",",
"&",
"Error",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"int",
"(",
"err",
"&",
"0xFFFF",
")",
",",
"Text",
":",
"C",
".",
"GoString",
"(",
"C",
".",
"Vix_GetErrorText",
"(",
"err",
",",
"nil",
")",
")",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"C",
".",
"GoString",
"(",
"tempFilePath",
")",
",",
"nil",
"\n",
"}"
] |
6,193 | all-6194 | [
"Rules",
"returns",
"the",
"security",
"rules",
"for",
"the",
"database",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Rules",
"(",
"params",
"<mask>",
"[",
"string",
"]",
"string",
")",
"(",
"Rules",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"c",
".",
"api",
".",
"Call",
"(",
"\"",
"\"",
",",
"c",
".",
"Url",
"+",
"\"",
"\"",
",",
"c",
".",
"Auth",
",",
"nil",
",",
"params",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"v",
"Rules",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"res",
",",
"&",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"err",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"v",
",",
"nil",
"\n",
"}"
] |
6,194 | all-6195 | [
"Logf",
"writes",
"std",
"log",
"event",
"with",
"format"
] | [
"func",
"Logf",
"(",
"format",
"string",
",",
"val",
"...",
"<mask>",
"{",
"}",
")",
"error",
"{",
"return",
"glg",
".",
"out",
"(",
"LOG",
",",
"format",
",",
"val",
"...",
")",
"\n",
"}"
] |
6,195 | all-6196 | [
"BetweenF",
"is",
"the",
"filter",
"form",
"for",
"Between",
"."
] | [
"func",
"BetweenF",
"(",
"left",
",",
"right",
"string",
")",
"func",
"(",
"string",
")",
"string",
"{",
"return",
"func",
"(",
"s",
"string",
")",
"string",
"{",
"return",
"Between",
"(",
"s",
",",
"left",
",",
"<mask>",
")",
"\n",
"}",
"\n",
"}"
] |
6,196 | all-6197 | [
"ChunkReader",
"splits",
"a",
"reader",
"into",
"reasonably",
"sized",
"chunks",
"for",
"the",
"purpose",
"of",
"transmitting",
"the",
"chunks",
"over",
"gRPC",
".",
"For",
"each",
"chunk",
"it",
"calls",
"the",
"given",
"function",
"."
] | [
"func",
"ChunkReader",
"(",
"r",
"<mask>",
".",
"Reader",
",",
"f",
"func",
"(",
"[",
"]",
"byte",
")",
"error",
")",
"(",
"int",
",",
"error",
")",
"{",
"var",
"total",
"int",
"\n",
"buf",
":=",
"GetBuffer",
"(",
")",
"\n",
"defer",
"PutBuffer",
"(",
"buf",
")",
"\n",
"for",
"{",
"n",
",",
"err",
":=",
"r",
".",
"Read",
"(",
"buf",
")",
"\n",
"if",
"n",
"==",
"0",
"&&",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"io",
".",
"EOF",
"{",
"return",
"total",
",",
"nil",
"\n",
"}",
"\n",
"return",
"total",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"f",
"(",
"buf",
"[",
":",
"n",
"]",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"total",
",",
"err",
"\n",
"}",
"\n",
"total",
"+=",
"n",
"\n",
"}",
"\n",
"}"
] |
6,197 | all-6198 | [
"GetServiceKey",
"returns",
"the",
"ServiceKey",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"s",
"*",
"ServicePDRequest",
")",
"GetServiceKey",
"(",
")",
"<mask>",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"ServiceKey",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"ServiceKey",
"\n",
"}"
] |
6,198 | all-6199 | [
"GetMinFailureDuration",
"returns",
"the",
"MinFailureDuration",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsOptions",
")",
"GetMinFailureDuration",
"(",
")",
"int",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"MinFailureDuration",
"==",
"nil",
"{",
"<mask>",
"0",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"MinFailureDuration",
"\n",
"}"
] |
6,199 | all-6200 | [
"const",
"PangoFontDescription",
"*",
"pango_layout_get_font_description",
"(",
"PangoLayout",
"*",
"layout",
")",
";"
] | [
"func",
"(",
"v",
"*",
"Layout",
")",
"GetFontDescription",
"(",
")",
"*",
"FontDescription",
"{",
"c",
":=",
"C",
".",
"pango_layout_get_font_description",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n\n",
"desc",
":=",
"<mask>",
"(",
"FontDescription",
")",
"\n",
"desc",
".",
"pangoFontDescription",
"=",
"(",
"*",
"C",
".",
"PangoFontDescription",
")",
"(",
"c",
")",
"\n\n",
"return",
"desc",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.