id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
5,800 | all-5801 | [
"HaveLoggedError",
"passes",
"when",
"all",
"of",
"the",
"expected",
"log",
"messages",
"are",
"logged",
"as",
"errors",
"in",
"the",
"browser",
"console",
".",
"If",
"no",
"message",
"is",
"provided",
"this",
"matcher",
"will",
"pass",
"if",
"any",
"error",
"message",
"has",
"been",
"logged",
".",
"When",
"negated",
"this",
"matcher",
"will",
"only",
"fail",
"if",
"all",
"of",
"the",
"provided",
"messages",
"are",
"logged",
"."
] | [
"func",
"HaveLoggedError",
"(",
"messages",
"...",
"string",
")",
"types",
".",
"GomegaMatcher",
"{",
"return",
"&",
"internal",
".",
"LogMatcher",
"{",
"ExpectedMessages",
":",
"messages",
",",
"Levels",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
",",
"Name",
":",
"\"",
"\"",
",",
"<mask>",
":",
"\"",
"\"",
",",
"}",
"\n",
"}"
] |
5,801 | all-5802 | [
"Select",
"enables",
"selecting",
"which",
"fields",
"should",
"be",
"retrieved",
"for",
"the",
"results",
"found",
".",
"For",
"example",
"the",
"following",
"query",
"would",
"only",
"retrieve",
"the",
"name",
"field",
":",
"err",
":",
"=",
"collection",
".",
"Find",
"(",
"nil",
")",
".",
"Select",
"(",
"bson",
".",
"M",
"{",
"name",
":",
"1",
"}",
")",
".",
"One",
"(",
"&result",
")",
"Relevant",
"documentation",
":",
"http",
":",
"//",
"www",
".",
"mongodb",
".",
"org",
"/",
"display",
"/",
"DOCS",
"/",
"Retrieving",
"+",
"a",
"+",
"Subset",
"+",
"of",
"+",
"Fields"
] | [
"func",
"(",
"q",
"*",
"Query",
")",
"<mask>",
"(",
"selector",
"interface",
"{",
"}",
")",
"*",
"Query",
"{",
"q",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"q",
".",
"op",
".",
"selector",
"=",
"selector",
"\n",
"q",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"return",
"q",
"\n",
"}"
] |
5,802 | all-5803 | [
"Create",
"an",
"article"
] | [
"func",
"Create",
"(",
"c",
"*",
"gin",
".",
"<mask>",
")",
"{",
"db",
":=",
"c",
".",
"MustGet",
"(",
"\"",
"\"",
")",
".",
"(",
"*",
"mgo",
".",
"Database",
")",
"\n\n",
"article",
":=",
"models",
".",
"Article",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"Bind",
"(",
"&",
"article",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"c",
".",
"Error",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"err",
"=",
"db",
".",
"C",
"(",
"models",
".",
"CollectionArticle",
")",
".",
"Insert",
"(",
"article",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"c",
".",
"Error",
"(",
"err",
")",
"\n",
"}",
"\n",
"c",
".",
"Redirect",
"(",
"http",
".",
"StatusMovedPermanently",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
5,803 | all-5804 | [
"Returns",
"an",
"slice",
"of",
"floats",
"or",
"the",
"specified",
"slice",
"if",
"the",
"key",
"doesn",
"t",
"exist",
"or",
"isn",
"t",
"a",
"valid",
"[]",
"float64"
] | [
"func",
"(",
"t",
"Typed",
")",
"FloatsOr",
"(",
"<mask>",
"string",
",",
"d",
"[",
"]",
"float64",
")",
"[",
"]",
"float64",
"{",
"n",
",",
"ok",
":=",
"t",
".",
"FloatsIf",
"(",
"key",
")",
"\n",
"if",
"ok",
"{",
"return",
"n",
"\n",
"}",
"\n",
"return",
"d",
"\n",
"}"
] |
5,804 | all-5805 | [
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"AccountFlags"
] | [
"func",
"(",
"e",
"AccountFlags",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"<mask>",
":=",
"accountFlagsMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
5,805 | all-5806 | [
"Set",
"creates",
"a",
"Set",
"query",
".",
"Set",
"assigns",
"a",
"value",
"of",
"1",
"to",
"a",
"bit",
"in",
"the",
"binary",
"matrix",
"thus",
"associating",
"the",
"given",
"row",
"in",
"the",
"given",
"field",
"with",
"the",
"given",
"column",
"."
] | [
"func",
"(",
"f",
"*",
"Field",
")",
"Set",
"(",
"rowIDOrKey",
",",
"colIDOrKey",
"interface",
"{",
"}",
")",
"*",
"PQLBaseQuery",
"{",
"rowStr",
",",
"colStr",
",",
"err",
":=",
"formatRowColIDKey",
"(",
"rowIDOrKey",
",",
"colIDOrKey",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"NewPQLBaseQuery",
"(",
"\"",
"\"",
",",
"f",
".",
"index",
",",
"err",
")",
"\n",
"}",
"\n",
"text",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"colStr",
",",
"f",
".",
"name",
",",
"rowStr",
")",
"\n",
"q",
":=",
"NewPQLBaseQuery",
"(",
"text",
",",
"f",
".",
"index",
",",
"nil",
")",
"\n",
"q",
".",
"hasKeys",
"=",
"f",
".",
"options",
".",
"keys",
"||",
"f",
".",
"index",
".",
"<mask>",
".",
"keys",
"\n",
"return",
"q",
"\n",
"}"
] |
5,806 | all-5807 | [
"Sleep",
"indicates",
"an",
"expected",
"call",
"of",
"Sleep"
] | [
"func",
"(",
"mr",
"*",
"MockTimeMockRecorder",
")",
"Sleep",
"(",
"arg0",
"<mask>",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"MockTime",
")",
"(",
"nil",
")",
".",
"Sleep",
")",
",",
"arg0",
")",
"\n",
"}"
] |
5,807 | all-5808 | [
"Authenticate",
"controls",
"authorizations"
] | [
"func",
"(",
"c",
"*",
"AuthController",
")",
"Authenticate",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"decoder",
":=",
"json",
".",
"NewDecoder",
"(",
"r",
".",
"Body",
")",
"\n",
"var",
"user",
"User",
"\n",
"var",
"data",
"map",
"[",
"string",
"]",
"string",
"\n",
"err",
":=",
"decoder",
".",
"Decode",
"(",
"&",
"user",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"http",
".",
"Error",
"(",
"w",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
",",
"400",
")",
"\n",
"return",
"\n",
"}",
"\n",
"user",
",",
"_",
"=",
"c",
".",
"UserManager",
".",
"Get",
"(",
"user",
".",
"Username",
",",
"user",
".",
"Password",
")",
"\n",
"if",
"user",
".",
"Username",
"!=",
"\"",
"\"",
"{",
"token",
":=",
"jwt",
".",
"New",
"(",
"jwt",
".",
"GetSigningMethod",
"(",
"\"",
"\"",
")",
")",
"\n",
"claims",
":=",
"token",
".",
"Claims",
".",
"(",
"jwt",
".",
"MapClaims",
")",
"\n\n",
"claims",
"[",
"\"",
"\"",
"]",
"=",
"user",
".",
"Username",
"\n",
"claims",
"[",
"\"",
"\"",
"]",
"=",
"user",
".",
"Email",
"\n",
"claims",
"[",
"\"",
"\"",
"]",
"=",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"time",
".",
"Minute",
"*",
"10",
")",
".",
"Unix",
"(",
")",
"\n",
"tokenString",
",",
"_",
":=",
"token",
".",
"SignedString",
"(",
"[",
"]",
"byte",
"(",
"c",
".",
"cnf",
".",
"Jwt",
".",
"Key",
")",
")",
"\n",
"data",
"=",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"tokenString",
",",
"}",
"\n",
"}",
"\n",
"<mask>",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"data",
")",
"\n",
"w",
".",
"Write",
"(",
"js",
")",
"\n",
"}"
] |
5,808 | all-5809 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventWebSocketFrameError",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork44",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
5,809 | all-5810 | [
"GetSecretValue",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockSecretsManagerAPI",
")",
"GetSecretValue",
"(",
"arg0",
"*",
"secretsmanager",
".",
"GetSecretValueInput",
")",
"(",
"*",
"secretsmanager",
".",
"GetSecretValueOutput",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"secretsmanager",
".",
"GetSecretValueOutput",
")",
"\n",
"ret1",
",",
"_",
":=",
"<mask>",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
5,810 | all-5811 | [
"AddList",
"is",
"a",
"convenience",
"function",
"to",
"add",
"a",
"new",
"list",
"to",
"a",
"window",
".",
"It",
"wraps",
"the",
"AddWidget",
"call",
".",
"AddList",
"must",
"be",
"called",
"from",
"queue",
"."
] | [
"func",
"(",
"w",
"*",
"Window",
")",
"AddList",
"(",
"x",
",",
"y",
",",
"width",
",",
"height",
"int",
")",
"*",
"List",
"{",
"// we can ignore error for builtins",
"l",
",",
"_",
":=",
"w",
".",
"AddWidget",
"(",
"WidgetList",
",",
"x",
",",
"y",
")",
"\n",
"<mask>",
":=",
"l",
".",
"(",
"*",
"List",
")",
"\n",
"list",
".",
"width",
"=",
"width",
"\n",
"list",
".",
"height",
"=",
"height",
"\n",
"list",
".",
"Resize",
"(",
")",
"\n",
"list",
".",
"SetAttributes",
"(",
"defaultAttributes",
"(",
")",
")",
"\n\n",
"list",
".",
"content",
"=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"1000",
")",
"\n",
"return",
"list",
"\n",
"}"
] |
5,811 | all-5812 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetPossibleBreakpointsReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger35",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
5,812 | all-5813 | [
"Next",
"is",
"a",
"wrapper",
"around",
"the",
"next",
"struct",
"field"
] | [
"func",
"(",
"v",
"*",
"SList",
")",
"Next",
"(",
")",
"*",
"SList",
"{",
"n",
":=",
"v",
".",
"native",
"(",
")",
"\n",
"if",
"n",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"wrapSList",
"(",
"n",
".",
"<mask>",
")",
"\n",
"}"
] |
5,813 | all-5814 | [
"Uint32",
"adds",
"a",
"uint32",
"-",
"valued",
"key",
":",
"value",
"pair",
"to",
"a",
"Span",
".",
"LogFields",
"()",
"record"
] | [
"func",
"Uint32",
"(",
"<mask>",
"string",
",",
"val",
"uint32",
")",
"Field",
"{",
"return",
"Field",
"{",
"key",
":",
"key",
",",
"fieldType",
":",
"uint32Type",
",",
"numericVal",
":",
"int64",
"(",
"val",
")",
",",
"}",
"\n",
"}"
] |
5,814 | all-5815 | [
"ChangeContactModattr",
"creates",
"a",
"new",
"CHANGE_CONTACT_MODATTR",
"Nagios",
"command",
".",
"This",
"command",
"changes",
"the",
"modified",
"attributes",
"value",
"for",
"the",
"specified",
"contact",
".",
"Modified",
"attributes",
"values",
"are",
"used",
"by",
"Nagios",
"to",
"determine",
"which",
"object",
"properties",
"should",
"be",
"retained",
"across",
"program",
"restarts",
".",
"Thus",
"modifying",
"the",
"value",
"of",
"the",
"attributes",
"can",
"affect",
"data",
"retention",
".",
"This",
"is",
"an",
"advanced",
"option",
"and",
"should",
"only",
"be",
"used",
"by",
"people",
"who",
"are",
"intimately",
"familiar",
"with",
"the",
"data",
"retention",
"logic",
"in",
"Nagios",
"."
] | [
"func",
"ChangeContactModattr",
"(",
"contact_name",
"string",
",",
"value",
"string",
",",
")",
"*",
"livestatus",
".",
"Command",
"{",
"return",
"livestatus",
".",
"NewCommand",
"(",
"\"",
"\"",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"contact_name",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"<mask>",
")",
",",
")",
"\n",
"}"
] |
5,815 | all-5816 | [
"Using",
"the",
"classic",
"API",
"posts",
"a",
"count",
"to",
"a",
"stat",
"using",
"DefaultReporter",
"at",
"a",
"specific",
"time",
"."
] | [
"func",
"PostCountTime",
"(",
"statKey",
",",
"userKey",
"string",
",",
"<mask>",
"int",
",",
"timestamp",
"int64",
")",
"error",
"{",
"return",
"DefaultReporter",
".",
"PostCountTime",
"(",
"statKey",
",",
"userKey",
",",
"count",
",",
"timestamp",
")",
"\n",
"}"
] |
5,816 | all-5817 | [
"GetType",
"returns",
"the",
"Type",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"t",
"*",
"TileDefMarker",
")",
"GetType",
"(",
")",
"string",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"Type",
"\n",
"}"
] |
5,817 | all-5818 | [
"GetIP",
"returns",
"public",
"IP",
"address",
"or",
"hostname",
"of",
"the",
"machine",
"instance",
"."
] | [
"func",
"(",
"d",
"*",
"Driver",
")",
"GetIP",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"err",
":=",
"d",
".",
"checkLegacyDriver",
"(",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"d",
".",
"resolvedIP",
"==",
"\"",
"\"",
"{",
"ip",
",",
"err",
":=",
"d",
".",
"ipAddress",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"d",
".",
"resolvedIP",
"=",
"ip",
"\n",
"}",
"\n",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"d",
".",
"resolvedIP",
")",
"\n",
"return",
"d",
".",
"resolvedIP",
",",
"nil",
"\n",
"}"
] |
5,818 | all-5819 | [
"GetConfigCmd",
"represents",
"the",
"apply",
"command"
] | [
"func",
"GetConfigCmd",
"(",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"cro",
"=",
"&",
"cli",
".",
"GetConfigOptions",
"{",
"}",
"\n",
"<mask>",
"getConfigCmd",
"=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"`Use this command to pull a kubeconfig file from a cluster so you can use kubectl.\n\t\n\tThis command will attempt to find a cluster, and append a local kubeconfig file with a kubeconfig `",
",",
"Run",
":",
"func",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"switch",
"len",
"(",
"args",
")",
"{",
"case",
"0",
":",
"cro",
".",
"Name",
"=",
"viper",
".",
"GetString",
"(",
"keyKubicornName",
")",
"\n",
"case",
"1",
":",
"cro",
".",
"Name",
"=",
"args",
"[",
"0",
"]",
"\n",
"default",
":",
"logger",
".",
"Critical",
"(",
"\"",
"\"",
")",
"\n",
"os",
".",
"Exit",
"(",
"1",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"runGetConfig",
"(",
"cro",
")",
";",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Critical",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"os",
".",
"Exit",
"(",
"1",
")",
"\n",
"}",
"\n\n",
"}",
",",
"}",
"\n\n",
"fs",
":=",
"getConfigCmd",
".",
"Flags",
"(",
")",
"\n\n",
"bindCommonStateStoreFlags",
"(",
"&",
"cro",
".",
"StateStoreOptions",
",",
"fs",
")",
"\n",
"bindCommonAwsFlags",
"(",
"&",
"cro",
".",
"AwsOptions",
",",
"fs",
")",
"\n\n",
"fs",
".",
"StringVar",
"(",
"&",
"cro",
".",
"GitRemote",
",",
"keyGitConfig",
",",
"viper",
".",
"GetString",
"(",
"keyGitConfig",
")",
",",
"descGitConfig",
")",
"\n\n",
"return",
"getConfigCmd",
"\n",
"}"
] |
5,819 | all-5820 | [
"URN",
"returns",
"the",
"RFC",
"2141",
"URN",
"form",
"of",
"uuid",
"urn",
":",
"uuid",
":",
"xxxxxxxx",
"-",
"xxxx",
"-",
"xxxx",
"-",
"xxxx",
"-",
"xxxxxxxxxxxx",
"or",
"if",
"uuid",
"is",
"invalid",
"."
] | [
"func",
"(",
"uuid",
"UUID",
")",
"URN",
"(",
")",
"string",
"{",
"<mask>",
"buf",
"[",
"36",
"+",
"9",
"]",
"byte",
"\n",
"copy",
"(",
"buf",
"[",
":",
"]",
",",
"\"",
"\"",
")",
"\n",
"encodeHex",
"(",
"buf",
"[",
"9",
":",
"]",
",",
"uuid",
")",
"\n",
"return",
"string",
"(",
"buf",
"[",
":",
"]",
")",
"\n",
"}"
] |
5,820 | all-5821 | [
"GetLabel",
"is",
"a",
"wrapper",
"around",
"gtk_expander_get_label",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Expander",
")",
"GetLabel",
"(",
")",
"<mask>",
"{",
"c",
":=",
"C",
".",
"gtk_expander_get_label",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"goString",
"(",
"c",
")",
"\n",
"}"
] |
5,821 | all-5822 | [
"flattenVMwareDVSConfigInfo",
"reads",
"various",
"fields",
"from",
"a",
"VMwareDVSConfigInfo",
"into",
"the",
"passed",
"in",
"ResourceData",
".",
"This",
"is",
"the",
"flatten",
"counterpart",
"to",
"expandVMwareDVSConfigSpec",
"as",
"the",
"configuration",
"info",
"from",
"a",
"DVS",
"comes",
"back",
"as",
"this",
"type",
"instead",
"of",
"a",
"specific",
"ConfigSpec",
"."
] | [
"func",
"flattenVMwareDVSConfigInfo",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"types",
".",
"VMwareDVSConfigInfo",
")",
"error",
"{",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"Name",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"ConfigVersion",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"Description",
")",
"\n",
"d",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"obj",
".",
"SwitchIpAddress",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"MaxMtu",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"LacpApiVersion",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"MulticastFilteringMode",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"NetworkResourceControlVersion",
")",
"\n",
"// This is not available in ConfigSpec but is available in ConfigInfo, so",
"// flatten it here.",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"NetworkResourceManagementEnabled",
")",
"\n\n",
"// Version is set in this object too as ConfigInfo has the productInfo",
"// property that is outside of this ConfigSpec structure.",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"ProductInfo",
".",
"Version",
")",
"\n\n",
"if",
"err",
":=",
"flattenDVSNameArrayUplinkPortPolicy",
"(",
"d",
",",
"obj",
".",
"UplinkPortPolicy",
".",
"(",
"*",
"types",
".",
"DVSNameArrayUplinkPortPolicy",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"flattenVMwareDVSPortSetting",
"(",
"d",
",",
"obj",
".",
"DefaultPortConfig",
".",
"(",
"*",
"types",
".",
"VMwareDVSPortSetting",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"flattenSliceOfDistributedVirtualSwitchHostMember",
"(",
"d",
",",
"obj",
".",
"Host",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"flattenSliceOfDvsHostInfrastructureTrafficResource",
"(",
"d",
",",
"obj",
".",
"InfrastructureTrafficResourceConfig",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"flattenDVSContactInfo",
"(",
"d",
",",
"obj",
".",
"Contact",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"flattenLinkDiscoveryProtocolConfig",
"(",
"d",
",",
"obj",
".",
"LinkDiscoveryProtocolConfig",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"flattenVMwareIpfixConfig",
"(",
"d",
",",
"obj",
".",
"IpfixConfig",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,822 | all-5823 | [
"Distinct",
"returns",
"a",
"derivative",
"query",
"that",
"yields",
"de",
"-",
"duplicated",
"entities",
"with",
"respect",
"to",
"the",
"set",
"of",
"projected",
"fields",
".",
"It",
"is",
"only",
"used",
"for",
"projection",
"queries",
".",
"Distinct",
"cannot",
"be",
"used",
"with",
"DistinctOn",
"."
] | [
"func",
"(",
"q",
"*",
"<mask>",
")",
"Distinct",
"(",
")",
"*",
"Query",
"{",
"q",
"=",
"q",
".",
"clone",
"(",
")",
"\n",
"q",
".",
"distinct",
"=",
"true",
"\n",
"return",
"q",
"\n",
"}"
] |
5,823 | all-5824 | [
"PangoLayout",
"*",
"pango_cairo_create_layout",
"(",
"cairo_t",
"*",
"cr",
")",
";"
] | [
"func",
"CairoCreateLayout",
"(",
"cr",
"*",
"cairo",
".",
"Context",
")",
"*",
"Layout",
"{",
"c",
":=",
"C",
".",
"pango_cairo_create_layout",
"(",
"cairo_context",
"(",
"cr",
")",
")",
"\n",
"<mask>",
":=",
"new",
"(",
"Layout",
")",
"\n",
"layout",
".",
"pangoLayout",
"=",
"(",
"*",
"C",
".",
"PangoLayout",
")",
"(",
"c",
")",
"\n",
"return",
"layout",
"\n",
"}"
] |
5,824 | all-5825 | [
"New",
"returns",
"a",
"new",
"Pool",
"with",
"size",
"buckets",
"for",
"minSize",
"to",
"maxSize",
"increasing",
"by",
"the",
"given",
"factor",
"."
] | [
"func",
"New",
"(",
"minSize",
",",
"maxSize",
"int",
",",
"factor",
"float64",
",",
"makeFunc",
"func",
"(",
"int",
")",
"interface",
"{",
"}",
")",
"*",
"Pool",
"{",
"if",
"minSize",
"<",
"1",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"maxSize",
"<",
"1",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"<mask>",
"<",
"1",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"var",
"sizes",
"[",
"]",
"int",
"\n\n",
"for",
"s",
":=",
"minSize",
";",
"s",
"<=",
"maxSize",
";",
"s",
"=",
"int",
"(",
"float64",
"(",
"s",
")",
"*",
"factor",
")",
"{",
"sizes",
"=",
"append",
"(",
"sizes",
",",
"s",
")",
"\n",
"}",
"\n\n",
"p",
":=",
"&",
"Pool",
"{",
"buckets",
":",
"make",
"(",
"[",
"]",
"sync",
".",
"Pool",
",",
"len",
"(",
"sizes",
")",
")",
",",
"sizes",
":",
"sizes",
",",
"make",
":",
"makeFunc",
",",
"}",
"\n\n",
"return",
"p",
"\n",
"}"
] |
5,825 | all-5826 | [
"NewDaemon",
"returns",
"a",
"new",
"Daemon",
"object",
"with",
"the",
"given",
"configuration",
"."
] | [
"func",
"NewDaemon",
"(",
"config",
"*",
"DaemonConfig",
",",
"os",
"*",
"sys",
".",
"OS",
")",
"*",
"Daemon",
"{",
"return",
"&",
"Daemon",
"{",
"config",
":",
"config",
",",
"os",
":",
"<mask>",
",",
"setupChan",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"readyChan",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"shutdownChan",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"}",
"\n",
"}"
] |
5,826 | all-5827 | [
"OnePoint",
"create",
"Points",
"instance",
"with",
"single",
"point"
] | [
"func",
"OnePoint",
"(",
"metric",
"string",
",",
"value",
"float64",
",",
"timestamp",
"int64",
")",
"*",
"Points",
"{",
"return",
"&",
"Points",
"{",
"Metric",
":",
"metric",
",",
"Data",
":",
"[",
"]",
"<mask>",
"{",
"Point",
"{",
"Value",
":",
"value",
",",
"Timestamp",
":",
"timestamp",
",",
"}",
",",
"}",
",",
"}",
"\n",
"}"
] |
5,827 | all-5828 | [
"RowsLimit",
"creates",
"a",
"Rows",
"query",
"with",
"the",
"given",
"limit"
] | [
"func",
"(",
"f",
"*",
"Field",
")",
"RowsLimit",
"(",
"limit",
"int64",
")",
"*",
"PQLRowsQuery",
"{",
"if",
"limit",
"<",
"0",
"{",
"return",
"NewPQLRowsQuery",
"(",
"\"",
"\"",
",",
"f",
".",
"<mask>",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"text",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"f",
".",
"name",
",",
"limit",
")",
"\n",
"return",
"NewPQLRowsQuery",
"(",
"text",
",",
"f",
".",
"index",
",",
"nil",
")",
"\n",
"}"
] |
5,828 | all-5829 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetMediaTextParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss18",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
5,829 | all-5830 | [
"SetPresubmits",
"updates",
"c",
".",
"Presubmits",
"to",
"jobs",
"after",
"compiling",
"and",
"validating",
"their",
"regexes",
"."
] | [
"func",
"(",
"c",
"*",
"JobConfig",
")",
"SetPresubmits",
"(",
"<mask>",
"map",
"[",
"string",
"]",
"[",
"]",
"Presubmit",
")",
"error",
"{",
"nj",
":=",
"map",
"[",
"string",
"]",
"[",
"]",
"Presubmit",
"{",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"jobs",
"{",
"nj",
"[",
"k",
"]",
"=",
"make",
"(",
"[",
"]",
"Presubmit",
",",
"len",
"(",
"v",
")",
")",
"\n",
"copy",
"(",
"nj",
"[",
"k",
"]",
",",
"v",
")",
"\n",
"if",
"err",
":=",
"SetPresubmitRegexes",
"(",
"nj",
"[",
"k",
"]",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"c",
".",
"Presubmits",
"=",
"nj",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,830 | all-5831 | [
"HasInverted",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"d",
"*",
"DashboardConditionalFormat",
")",
"HasInverted",
"(",
")",
"bool",
"{",
"if",
"d",
"!=",
"nil",
"&&",
"d",
".",
"Inverted",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
5,831 | all-5832 | [
"Do",
"executes",
"Page",
".",
"generateTestReport",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"GenerateTestReportParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGenerateTestReport",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
5,832 | all-5833 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"ClearParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomstorage11",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
5,833 | all-5834 | [
"Publish",
"publishes",
"data",
"to",
"the",
"given",
"topic",
"."
] | [
"func",
"(",
"p",
"*",
"PubSub",
")",
"Publish",
"(",
"topic",
"string",
",",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"seqno",
":=",
"p",
".",
"nextSeqno",
"(",
")",
"\n",
"m",
":=",
"&",
"pb",
".",
"Message",
"{",
"Data",
":",
"data",
",",
"TopicIDs",
":",
"[",
"]",
"string",
"{",
"topic",
"}",
",",
"From",
":",
"[",
"]",
"byte",
"(",
"p",
".",
"host",
".",
"ID",
"(",
")",
")",
",",
"Seqno",
":",
"seqno",
",",
"}",
"\n",
"if",
"p",
".",
"signKey",
"!=",
"nil",
"{",
"m",
".",
"From",
"=",
"[",
"]",
"<mask>",
"(",
"p",
".",
"signID",
")",
"\n",
"err",
":=",
"signMessage",
"(",
"p",
".",
"signID",
",",
"p",
".",
"signKey",
",",
"m",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"p",
".",
"publish",
"<-",
"&",
"Message",
"{",
"m",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,834 | all-5835 | [
"render",
"primitives",
"from",
"array",
"data",
"taking",
"parameters",
"from",
"memory"
] | [
"func",
"DrawArraysIndirect",
"(",
"mode",
"uint32",
",",
"indirect",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpDrawArraysIndirect",
",",
"2",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"indirect",
")",
",",
"0",
")",
"\n",
"}"
] |
5,835 | all-5836 | [
"CheckPassword",
"vérifie",
"si",
"le",
"mot",
"de",
"passe",
"est",
"correct"
] | [
"func",
"CheckPassword",
"(",
"password",
"[",
"]",
"byte",
",",
"salt",
"[",
"]",
"byte",
",",
"hpassword",
"[",
"]",
"byte",
")",
"(",
"bool",
",",
"error",
")",
"{",
"hash",
",",
"err",
":=",
"HashPassword",
"(",
"password",
",",
"salt",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"Equal",
"(",
"hash",
",",
"hpassword",
")",
",",
"nil",
"\n",
"}"
] |
5,836 | all-5837 | [
"MoveForward",
"moves",
"the",
"player",
"p",
"forward",
"."
] | [
"func",
"(",
"p",
"*",
"player",
")",
"MoveForward",
"(",
")",
"{",
"w",
",",
"h",
":=",
"gophersImage",
".",
"Size",
"(",
")",
"\n",
"mx",
":=",
"w",
"*",
"16",
"\n",
"my",
":=",
"h",
"*",
"16",
"\n",
"s",
",",
"c",
":=",
"math",
".",
"Sincos",
"(",
"float64",
"(",
"p",
".",
"<mask>",
")",
"*",
"2",
"*",
"math",
".",
"Pi",
"/",
"maxAngle",
")",
"\n",
"p",
".",
"x16",
"+=",
"int",
"(",
"round",
"(",
"16",
"*",
"c",
")",
"*",
"2",
")",
"\n",
"p",
".",
"y16",
"+=",
"int",
"(",
"round",
"(",
"16",
"*",
"s",
")",
"*",
"2",
")",
"\n",
"for",
"mx",
"<=",
"p",
".",
"x16",
"{",
"p",
".",
"x16",
"-=",
"mx",
"\n",
"}",
"\n",
"for",
"my",
"<=",
"p",
".",
"y16",
"{",
"p",
".",
"y16",
"-=",
"my",
"\n",
"}",
"\n",
"for",
"p",
".",
"x16",
"<",
"0",
"{",
"p",
".",
"x16",
"+=",
"mx",
"\n",
"}",
"\n",
"for",
"p",
".",
"y16",
"<",
"0",
"{",
"p",
".",
"y16",
"+=",
"my",
"\n",
"}",
"\n",
"}"
] |
5,837 | all-5838 | [
"Subscribe",
"on",
"given",
"channels",
"."
] | [
"func",
"Subscribe",
"(",
"channels",
"[",
"]",
"string",
")",
"(",
"Channel",
",",
"error",
")",
"{",
"if",
"hubInstance",
"==",
"nil",
"{",
"return",
"nil",
",",
"errorNohub",
"\n",
"}",
"\n",
"r",
",",
"err",
":=",
"hubInstance",
".",
"Subscribe",
"(",
"channels",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"<mask>",
".",
"Debug",
"(",
"\"",
"\"",
",",
"channels",
")",
"\n",
"return",
"r",
",",
"nil",
"\n",
"}"
] |
5,838 | all-5839 | [
"cause",
"a",
"material",
"color",
"to",
"track",
"the",
"current",
"color"
] | [
"func",
"ColorMaterial",
"(",
"face",
"uint32",
",",
"<mask>",
"uint32",
")",
"{",
"C",
".",
"glowColorMaterial",
"(",
"gpColorMaterial",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"face",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"mode",
")",
")",
"\n",
"}"
] |
5,839 | all-5840 | [
"NewNamedError",
"creates",
"a",
"NamedError",
"."
] | [
"func",
"NewNamedError",
"(",
"err",
"error",
")",
"*",
"DefaultNamedError",
"{",
"if",
"namedErr",
",",
"ok",
":=",
"err",
".",
"(",
"NamedError",
")",
";",
"ok",
"{",
"return",
"&",
"DefaultNamedError",
"{",
"Err",
":",
"namedErr",
".",
"Error",
"(",
")",
",",
"Name",
":",
"namedErr",
".",
"ErrorName",
"(",
")",
"}",
"\n",
"}",
"\n",
"return",
"&",
"DefaultNamedError",
"{",
"Err",
":",
"err",
".",
"<mask>",
"(",
")",
"}",
"\n",
"}"
] |
5,840 | all-5841 | [
"ListSnapshots",
"lists",
"all",
"snapshots"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListSnapshots",
"(",
")",
"(",
"*",
"Snapshots",
",",
"error",
")",
"{",
"url",
":=",
"snapshotColPath",
"(",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"Snapshots",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Get",
"(",
"url",
",",
"ret",
",",
"<mask>",
".",
"StatusOK",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
5,841 | all-5842 | [
"RemoveContainerReference",
"removes",
"container",
"reference",
"from",
"image",
"state"
] | [
"func",
"(",
"imageState",
"*",
"ImageState",
")",
"RemoveContainerReference",
"(",
"container",
"*",
"apicontainer",
".",
"Container",
")",
"error",
"{",
"// Get the image state write lock for updating container reference",
"imageState",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"imageState",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"for",
"i",
":=",
"range",
"imageState",
".",
"Containers",
"{",
"if",
"imageState",
".",
"Containers",
"[",
"i",
"]",
".",
"Name",
"==",
"container",
".",
"Name",
"{",
"// Container reference found; hence remove it",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"container",
".",
"Name",
",",
"imageState",
".",
"Image",
".",
"ImageID",
")",
"\n",
"imageState",
".",
"Containers",
"=",
"append",
"(",
"imageState",
".",
"Containers",
"[",
":",
"i",
"]",
",",
"imageState",
".",
"Containers",
"[",
"i",
"+",
"1",
":",
"]",
"...",
")",
"\n",
"// Update the last used time for the image",
"imageState",
".",
"LastUsedAt",
"=",
"time",
".",
"Now",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"container",
".",
"<mask>",
"(",
")",
")",
"\n",
"}"
] |
5,842 | all-5843 | [
"IncrementExisting",
"works",
"like",
"Increment",
"but",
"assumes",
"that",
"the",
"key",
"already",
"exists",
"in",
"memcache",
"and",
"doesn",
"t",
"take",
"an",
"initial",
"value",
".",
"IncrementExisting",
"can",
"save",
"work",
"if",
"calculating",
"the",
"initial",
"value",
"is",
"expensive",
".",
"An",
"error",
"is",
"returned",
"if",
"the",
"specified",
"item",
"can",
"not",
"be",
"found",
"."
] | [
"func",
"IncrementExisting",
"(",
"c",
"context",
".",
"Context",
",",
"key",
"string",
",",
"delta",
"int64",
")",
"(",
"newValue",
"uint64",
",",
"err",
"error",
")",
"{",
"return",
"incr",
"(",
"c",
",",
"<mask>",
",",
"delta",
",",
"nil",
")",
"\n",
"}"
] |
5,843 | all-5844 | [
"makeBuild",
"creates",
"a",
"build",
"from",
"the",
"prowjob",
"using",
"the",
"prowjob",
"s",
"buildspec",
"."
] | [
"func",
"makeBuild",
"(",
"pj",
"prowjobv1",
".",
"ProwJob",
",",
"defaultTimeout",
"<mask>",
".",
"Duration",
")",
"(",
"*",
"buildv1alpha1",
".",
"Build",
",",
"error",
")",
"{",
"if",
"pj",
".",
"Spec",
".",
"BuildSpec",
"==",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"buildID",
":=",
"pj",
".",
"Status",
".",
"BuildID",
"\n",
"if",
"buildID",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"b",
":=",
"buildv1alpha1",
".",
"Build",
"{",
"ObjectMeta",
":",
"buildMeta",
"(",
"pj",
")",
",",
"Spec",
":",
"*",
"pj",
".",
"Spec",
".",
"BuildSpec",
".",
"DeepCopy",
"(",
")",
",",
"}",
"\n",
"rawEnv",
",",
"err",
":=",
"buildEnv",
"(",
"pj",
",",
"buildID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"injectEnvironment",
"(",
"&",
"b",
",",
"rawEnv",
")",
"\n",
"injectedSource",
",",
"err",
":=",
"injectSource",
"(",
"&",
"b",
",",
"pj",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"injectTimeout",
"(",
"&",
"b",
".",
"Spec",
",",
"pj",
".",
"Spec",
".",
"DecorationConfig",
",",
"defaultTimeout",
")",
"\n",
"if",
"pj",
".",
"Spec",
".",
"DecorationConfig",
"!=",
"nil",
"{",
"encodedJobSpec",
":=",
"rawEnv",
"[",
"downwardapi",
".",
"JobSpecEnv",
"]",
"\n",
"err",
"=",
"decorateBuild",
"(",
"&",
"b",
".",
"Spec",
",",
"encodedJobSpec",
",",
"*",
"pj",
".",
"Spec",
".",
"DecorationConfig",
",",
"injectedSource",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"&",
"b",
",",
"nil",
"\n",
"}"
] |
5,844 | all-5845 | [
"Combination",
"generator"
] | [
"func",
"Combinations",
"(",
"list",
"Replacer",
",",
"select_num",
"int",
",",
"repeatable",
"bool",
",",
"buf",
"int",
")",
"(",
"c",
"chan",
"Replacer",
")",
"{",
"c",
"=",
"make",
"(",
"chan",
"Replacer",
",",
"buf",
")",
"\n",
"index",
":=",
"make",
"(",
"[",
"]",
"int",
",",
"list",
".",
"Len",
"(",
")",
",",
"list",
".",
"Len",
"(",
")",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"list",
".",
"Len",
"(",
")",
";",
"i",
"++",
"{",
"index",
"[",
"i",
"]",
"=",
"i",
"\n",
"}",
"\n\n",
"var",
"comb_generator",
"func",
"(",
"[",
"]",
"int",
",",
"int",
",",
"int",
")",
"chan",
"[",
"]",
"int",
"\n",
"if",
"repeatable",
"{",
"comb_generator",
"=",
"repeated_combinations",
"\n",
"}",
"else",
"{",
"comb_generator",
"=",
"combinations",
"\n",
"}",
"\n\n",
"go",
"func",
"(",
")",
"{",
"defer",
"close",
"(",
"c",
")",
"\n",
"for",
"comb",
":=",
"range",
"comb_generator",
"(",
"index",
",",
"select_num",
",",
"buf",
")",
"{",
"c",
"<-",
"<mask>",
".",
"Replace",
"(",
"comb",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"return",
"\n",
"}"
] |
5,845 | all-5846 | [
"RemoveTag",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_text_buffer_remove_tag",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TextBuffer",
")",
"RemoveTag",
"(",
"tag",
"*",
"TextTag",
",",
"start",
",",
"end",
"*",
"TextIter",
")",
"{",
"C",
".",
"gtk_text_buffer_remove_tag",
"(",
"v",
".",
"native",
"(",
")",
",",
"<mask>",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"GtkTextIter",
")",
"(",
"start",
")",
",",
"(",
"*",
"C",
".",
"GtkTextIter",
")",
"(",
"end",
")",
")",
"\n",
"}"
] |
5,846 | all-5847 | [
"PackStart",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_cell_layout_pack_start",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"CellLayout",
")",
"PackStart",
"(",
"cell",
"ICellRenderer",
",",
"expand",
"bool",
")",
"{",
"C",
".",
"gtk_cell_layout_pack_start",
"(",
"v",
".",
"native",
"(",
")",
",",
"<mask>",
".",
"toCellRenderer",
"(",
")",
",",
"gbool",
"(",
"expand",
")",
")",
"\n",
"}"
] |
5,847 | all-5848 | [
"Verify",
"broker",
"supports",
"the",
"check",
"type",
"to",
"be",
"used"
] | [
"func",
"(",
"cm",
"*",
"CheckManager",
")",
"brokerSupportsCheckType",
"(",
"checkType",
"CheckTypeType",
",",
"details",
"*",
"api",
".",
"BrokerDetail",
")",
"bool",
"{",
"baseType",
":=",
"string",
"(",
"checkType",
")",
"\n\n",
"for",
"_",
",",
"module",
":=",
"range",
"details",
".",
"Modules",
"{",
"if",
"module",
"==",
"baseType",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"idx",
":=",
"strings",
".",
"<mask>",
"(",
"baseType",
",",
"\"",
"\"",
")",
";",
"idx",
">",
"0",
"{",
"baseType",
"=",
"baseType",
"[",
"0",
":",
"idx",
"]",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"module",
":=",
"range",
"details",
".",
"Modules",
"{",
"if",
"module",
"==",
"baseType",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"false",
"\n\n",
"}"
] |
5,848 | all-5849 | [
"NewDryRunProwJobClient",
"creates",
"a",
"new",
"client",
"that",
"uses",
"deck",
"as",
"a",
"read",
"-",
"only",
"proxy",
"for",
"ProwJob",
"data"
] | [
"func",
"NewDryRunProwJobClient",
"(",
"deckURL",
"string",
")",
"prowv1",
".",
"ProwJobInterface",
"{",
"return",
"&",
"dryRunProwJobClient",
"{",
"deckURL",
":",
"deckURL",
",",
"<mask>",
":",
"&",
"http",
".",
"Client",
"{",
"}",
",",
"}",
"\n",
"}"
] |
5,849 | all-5850 | [
"coalesceAdjacentRecords",
"coalesces",
"the",
"list",
"of",
"records",
"into",
"groups",
"of",
"adjacent",
"equal",
"or",
"unequal",
"counts",
"."
] | [
"func",
"coalesceAdjacentRecords",
"(",
"name",
"string",
",",
"recs",
"[",
"]",
"reportRecord",
")",
"(",
"groups",
"[",
"]",
"diffStats",
")",
"{",
"var",
"prevCase",
"int",
"// Arbitrary index into which case last occurred",
"\n",
"lastStats",
":=",
"func",
"(",
"i",
"int",
")",
"*",
"diffStats",
"{",
"if",
"prevCase",
"!=",
"i",
"{",
"groups",
"=",
"append",
"(",
"<mask>",
",",
"diffStats",
"{",
"Name",
":",
"name",
"}",
")",
"\n",
"prevCase",
"=",
"i",
"\n",
"}",
"\n",
"return",
"&",
"groups",
"[",
"len",
"(",
"groups",
")",
"-",
"1",
"]",
"\n",
"}",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"recs",
"{",
"switch",
"rv",
":=",
"r",
".",
"Value",
";",
"{",
"case",
"rv",
".",
"NumIgnored",
">",
"0",
"&&",
"rv",
".",
"NumSame",
"+",
"rv",
".",
"NumDiff",
"==",
"0",
":",
"lastStats",
"(",
"1",
")",
".",
"NumIgnored",
"++",
"\n",
"case",
"rv",
".",
"NumDiff",
"==",
"0",
":",
"lastStats",
"(",
"1",
")",
".",
"NumIdentical",
"++",
"\n",
"case",
"rv",
".",
"NumDiff",
">",
"0",
"&&",
"!",
"rv",
".",
"ValueY",
".",
"IsValid",
"(",
")",
":",
"lastStats",
"(",
"2",
")",
".",
"NumRemoved",
"++",
"\n",
"case",
"rv",
".",
"NumDiff",
">",
"0",
"&&",
"!",
"rv",
".",
"ValueX",
".",
"IsValid",
"(",
")",
":",
"lastStats",
"(",
"2",
")",
".",
"NumInserted",
"++",
"\n",
"default",
":",
"lastStats",
"(",
"2",
")",
".",
"NumModified",
"++",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"groups",
"\n",
"}"
] |
5,850 | all-5851 | [
"ValidForPrefix",
"returns",
"false",
"when",
"iteration",
"is",
"done",
"or",
"when",
"the",
"current",
"key",
"is",
"not",
"prefixed",
"by",
"the",
"specified",
"prefix",
"."
] | [
"func",
"(",
"it",
"*",
"Iterator",
")",
"ValidForPrefix",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"bool",
"{",
"return",
"it",
".",
"Valid",
"(",
")",
"&&",
"bytes",
".",
"HasPrefix",
"(",
"it",
".",
"item",
".",
"key",
",",
"prefix",
")",
"\n",
"}"
] |
5,851 | all-5852 | [
"resourceVSphereVirtualMachineCreateBareStandard",
"performs",
"the",
"steps",
"necessary",
"during",
"resourceVSphereVirtualMachineCreateBare",
"to",
"create",
"a",
"virtual",
"machine",
"when",
"a",
"datastore",
"cluster",
"is",
"not",
"supplied",
"."
] | [
"func",
"resourceVSphereVirtualMachineCreateBareStandard",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
",",
"fo",
"*",
"object",
".",
"Folder",
",",
"spec",
"types",
".",
"VirtualMachineConfigSpec",
",",
"pool",
"*",
"<mask>",
".",
"ResourcePool",
",",
"hs",
"*",
"object",
".",
"HostSystem",
",",
")",
"(",
"*",
"object",
".",
"VirtualMachine",
",",
"error",
")",
"{",
"client",
":=",
"meta",
".",
"(",
"*",
"VSphereClient",
")",
".",
"vimClient",
"\n\n",
"// Set the datastore for the VM.",
"ds",
",",
"err",
":=",
"datastore",
".",
"FromID",
"(",
"client",
",",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"spec",
".",
"Files",
"=",
"&",
"types",
".",
"VirtualMachineFileInfo",
"{",
"VmPathName",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"ds",
".",
"Name",
"(",
")",
")",
",",
"}",
"\n\n",
"vm",
",",
"err",
":=",
"virtualmachine",
".",
"Create",
"(",
"client",
",",
"fo",
",",
"spec",
",",
"pool",
",",
"hs",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"vm",
",",
"nil",
"\n",
"}"
] |
5,852 | all-5853 | [
"Repeated",
"combination",
"generator",
"for",
"int",
"slice"
] | [
"func",
"repeated_combinations",
"(",
"list",
"[",
"]",
"int",
",",
"select_num",
",",
"buf",
"int",
")",
"(",
"c",
"chan",
"[",
"]",
"int",
")",
"{",
"c",
"=",
"make",
"(",
"chan",
"[",
"]",
"int",
",",
"buf",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"defer",
"close",
"(",
"c",
")",
"\n",
"if",
"select_num",
"==",
"1",
"{",
"for",
"v",
":=",
"range",
"list",
"{",
"c",
"<-",
"[",
"]",
"int",
"{",
"v",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"list",
")",
";",
"i",
"++",
"{",
"for",
"sub_comb",
":=",
"<mask>",
"repeated_combinations",
"(",
"list",
"[",
"i",
":",
"]",
",",
"select_num",
"-",
"1",
",",
"buf",
")",
"{",
"c",
"<-",
"append",
"(",
"[",
"]",
"int",
"{",
"list",
"[",
"i",
"]",
"}",
",",
"sub_comb",
"...",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"return",
"\n",
"}"
] |
5,853 | all-5854 | [
"MergeMethod",
"returns",
"the",
"merge",
"method",
"to",
"use",
"for",
"a",
"repo",
".",
"The",
"default",
"of",
"merge",
"is",
"returned",
"when",
"not",
"overridden",
"."
] | [
"func",
"(",
"t",
"*",
"Tide",
")",
"MergeMethod",
"(",
"org",
",",
"repo",
"string",
")",
"github",
".",
"PullRequestMergeType",
"{",
"name",
":=",
"org",
"+",
"\"",
"\"",
"+",
"repo",
"\n\n",
"v",
",",
"ok",
":=",
"t",
".",
"MergeType",
"[",
"name",
"]",
"\n",
"if",
"!",
"<mask>",
"{",
"if",
"ov",
",",
"found",
":=",
"t",
".",
"MergeType",
"[",
"org",
"]",
";",
"found",
"{",
"return",
"ov",
"\n",
"}",
"\n\n",
"return",
"github",
".",
"MergeMerge",
"\n",
"}",
"\n\n",
"return",
"v",
"\n",
"}"
] |
5,854 | all-5855 | [
"NewLogBackend",
"creates",
"a",
"new",
"LogBackend",
"."
] | [
"func",
"NewLogBackend",
"(",
"out",
"io",
".",
"<mask>",
",",
"prefix",
"string",
",",
"flag",
"int",
")",
"*",
"LogBackend",
"{",
"b",
":=",
"&",
"LogBackend",
"{",
"Logger",
":",
"log",
".",
"New",
"(",
"out",
",",
"prefix",
",",
"flag",
")",
"}",
"\n\n",
"// Unfortunately, the API used only takes an io.Writer where the Windows API",
"// need the actual fd to change colors.",
"if",
"f",
",",
"ok",
":=",
"out",
".",
"(",
"file",
")",
";",
"ok",
"{",
"b",
".",
"f",
"=",
"f",
"\n",
"}",
"\n\n",
"return",
"b",
"\n",
"}"
] |
5,855 | all-5856 | [
"advertiseMatchesCluster",
"confirms",
"peer",
"URLs",
"match",
"those",
"in",
"the",
"cluster",
"peer",
"list",
"."
] | [
"func",
"(",
"c",
"*",
"ServerConfig",
")",
"advertiseMatchesCluster",
"(",
")",
"error",
"{",
"urls",
",",
"apurls",
":=",
"c",
".",
"InitialPeerURLsMap",
"[",
"c",
".",
"Name",
"]",
",",
"c",
".",
"PeerURLs",
".",
"StringSlice",
"(",
")",
"\n",
"urls",
".",
"Sort",
"(",
")",
"\n",
"sort",
".",
"Strings",
"(",
"apurls",
")",
"\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"30",
"*",
"time",
".",
"Second",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"ok",
",",
"err",
":=",
"netutil",
".",
"URLStringsEqual",
"(",
"ctx",
",",
"c",
".",
"Logger",
",",
"apurls",
",",
"urls",
".",
"StringSlice",
"(",
")",
")",
"\n",
"if",
"ok",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"initMap",
",",
"apMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
")",
",",
"make",
"(",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
")",
"\n",
"for",
"_",
",",
"url",
":=",
"range",
"c",
".",
"PeerURLs",
"{",
"apMap",
"[",
"url",
".",
"String",
"(",
")",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"url",
":=",
"range",
"c",
".",
"InitialPeerURLsMap",
"[",
"c",
".",
"Name",
"]",
"{",
"initMap",
"[",
"url",
".",
"String",
"(",
")",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n\n",
"missing",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"url",
":=",
"range",
"initMap",
"{",
"if",
"_",
",",
"ok",
":=",
"apMap",
"[",
"url",
"]",
";",
"!",
"ok",
"{",
"missing",
"=",
"append",
"(",
"missing",
",",
"url",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"missing",
")",
">",
"0",
"{",
"for",
"i",
":=",
"range",
"missing",
"{",
"missing",
"[",
"i",
"]",
"=",
"c",
".",
"Name",
"+",
"\"",
"\"",
"+",
"missing",
"[",
"i",
"]",
"\n",
"}",
"\n",
"mstr",
":=",
"strings",
".",
"Join",
"(",
"missing",
",",
"\"",
"\"",
")",
"\n",
"apStr",
":=",
"strings",
".",
"Join",
"(",
"apurls",
",",
"\"",
"\"",
")",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"mstr",
",",
"apStr",
",",
"err",
")",
"\n",
"}",
"\n\n",
"for",
"url",
":=",
"range",
"apMap",
"{",
"if",
"_",
",",
"ok",
":=",
"initMap",
"[",
"url",
"]",
";",
"!",
"ok",
"{",
"missing",
"=",
"append",
"(",
"missing",
",",
"url",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"missing",
")",
">",
"0",
"{",
"mstr",
":=",
"strings",
".",
"Join",
"(",
"missing",
",",
"\"",
"\"",
")",
"\n",
"umap",
":=",
"types",
".",
"URLsMap",
"(",
"<mask>",
"[",
"string",
"]",
"types",
".",
"URLs",
"{",
"c",
".",
"Name",
":",
"c",
".",
"PeerURLs",
"}",
")",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"mstr",
",",
"umap",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n\n",
"// resolved URLs from \"--initial-advertise-peer-urls\" and \"--initial-cluster\" did not match or failed",
"apStr",
":=",
"strings",
".",
"Join",
"(",
"apurls",
",",
"\"",
"\"",
")",
"\n",
"umap",
":=",
"types",
".",
"URLsMap",
"(",
"map",
"[",
"string",
"]",
"types",
".",
"URLs",
"{",
"c",
".",
"Name",
":",
"c",
".",
"PeerURLs",
"}",
")",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"apStr",
",",
"umap",
".",
"String",
"(",
")",
",",
"err",
")",
"\n",
"}"
] |
5,856 | all-5857 | [
"NewRule",
"creates",
"a",
"new",
"rule",
"."
] | [
"func",
"NewRule",
"(",
"<mask>",
"string",
",",
"match",
"string",
")",
"(",
"*",
"Rule",
",",
"error",
")",
"{",
"matchRegexp",
",",
"err",
":=",
"regexp",
".",
"Compile",
"(",
"\"",
"\"",
"+",
"match",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Println",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"r",
":=",
"&",
"Rule",
"{",
"Enabled",
":",
"false",
",",
"Name",
":",
"name",
",",
"Match",
":",
"matchRegexp",
",",
"}",
"\n",
"return",
"r",
",",
"nil",
"\n",
"}"
] |
5,857 | all-5858 | [
"SendAppendReq",
"updates",
"the",
"ServerStats",
"in",
"response",
"to",
"an",
"AppendRequest",
"being",
"sent",
"by",
"this",
"server"
] | [
"func",
"(",
"ss",
"*",
"ServerStats",
")",
"SendAppendReq",
"(",
"reqSize",
"int",
")",
"{",
"ss",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ss",
".",
"Unlock",
"(",
")",
"\n\n",
"<mask>",
".",
"becomeLeader",
"(",
")",
"\n\n",
"ss",
".",
"sendRateQueue",
".",
"Insert",
"(",
"&",
"RequestStats",
"{",
"SendingTime",
":",
"time",
".",
"Now",
"(",
")",
",",
"Size",
":",
"reqSize",
",",
"}",
",",
")",
"\n\n",
"ss",
".",
"SendAppendRequestCnt",
"++",
"\n",
"}"
] |
5,858 | all-5859 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetFileInfoParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom45",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
5,859 | all-5860 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
] | [
"func",
"(",
"r",
"*",
"MultiCloudImageSetting",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"MultiCloudImageSettingLocator",
"{",
"for",
"_",
",",
"l",
":=",
"<mask>",
"r",
".",
"Links",
"{",
"if",
"l",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"return",
"api",
".",
"MultiCloudImageSettingLocator",
"(",
"l",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,860 | all-5861 | [
"SetTokenData",
"implements",
"the",
"flame",
".",
"GenericToken",
"interface",
"."
] | [
"func",
"(",
"t",
"*",
"Token",
")",
"SetTokenData",
"(",
"typ",
"TokenType",
",",
"scope",
"[",
"]",
"string",
",",
"expiresAt",
"time",
".",
"Time",
",",
"client",
"Client",
",",
"resourceOwner",
"ResourceOwner",
")",
"{",
"t",
".",
"Type",
"=",
"typ",
"\n",
"t",
".",
"Scope",
"=",
"scope",
"\n",
"t",
".",
"ExpiresAt",
"=",
"expiresAt",
"\n",
"t",
".",
"Application",
"=",
"<mask>",
".",
"ID",
"(",
")",
"\n",
"if",
"resourceOwner",
"!=",
"nil",
"{",
"t",
".",
"User",
"=",
"coal",
".",
"P",
"(",
"resourceOwner",
".",
"ID",
"(",
")",
")",
"\n",
"}",
"\n",
"}"
] |
5,861 | all-5862 | [
"ReceiveIssue",
"is",
"a",
"wrapper",
"on",
"plugin",
".",
"ReceiveIssue",
"()",
"logging",
"the",
"author"
] | [
"func",
"(",
"a",
"*",
"AuthorLoggerPluginWrapper",
")",
"ReceiveIssue",
"(",
"issue",
"sql",
".",
"Issue",
")",
"[",
"]",
"<mask>",
"{",
"points",
":=",
"a",
".",
"plugin",
".",
"ReceiveIssue",
"(",
"issue",
")",
"\n",
"if",
"a",
".",
"enabled",
"{",
"for",
"i",
":=",
"range",
"points",
"{",
"if",
"points",
"[",
"i",
"]",
".",
"Values",
"==",
"nil",
"{",
"points",
"[",
"i",
"]",
".",
"Values",
"=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"points",
"[",
"i",
"]",
".",
"Values",
"[",
"\"",
"\"",
"]",
"=",
"issue",
".",
"User",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"points",
"\n",
"}"
] |
5,862 | all-5863 | [
"CheckInternalVisibility",
"overrides",
"the",
"given",
"visibility",
"if",
"the",
"package",
"is",
"internal",
"."
] | [
"func",
"CheckInternalVisibility",
"(",
"rel",
",",
"visibility",
"<mask>",
")",
"string",
"{",
"if",
"i",
":=",
"strings",
".",
"LastIndex",
"(",
"rel",
",",
"\"",
"\"",
")",
";",
"i",
">=",
"0",
"{",
"visibility",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"rel",
"[",
":",
"i",
"]",
")",
"\n",
"}",
"else",
"if",
"strings",
".",
"HasPrefix",
"(",
"rel",
",",
"\"",
"\"",
")",
"{",
"visibility",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"visibility",
"\n",
"}"
] |
5,863 | all-5864 | [
"Open",
"creates",
"and",
"opens",
"a",
"database",
"at",
"the",
"given",
"path",
".",
"If",
"the",
"file",
"does",
"not",
"exist",
"then",
"it",
"will",
"be",
"created",
"automatically",
".",
"Passing",
"in",
"nil",
"options",
"will",
"cause",
"Bolt",
"to",
"open",
"the",
"database",
"with",
"the",
"default",
"options",
"."
] | [
"func",
"Open",
"(",
"<mask>",
"string",
",",
"mode",
"os",
".",
"FileMode",
",",
"options",
"*",
"bolt",
".",
"Options",
")",
"(",
"DB",
",",
"error",
")",
"{",
"db",
",",
"err",
":=",
"bolt",
".",
"Open",
"(",
"path",
",",
"mode",
",",
"options",
")",
"\n",
"return",
"DB",
"{",
"db",
"}",
",",
"errorsp",
".",
"WithStacks",
"(",
"err",
")",
"\n",
"}"
] |
5,864 | all-5865 | [
"Publish",
"a",
"request",
"to",
"purge",
"caches",
"named",
"cacheName",
"with",
"on",
"provisionerId",
"/",
"workerType",
"workers",
".",
"If",
"such",
"a",
"request",
"already",
"exists",
"its",
"before",
"timestamp",
"is",
"updated",
"to",
"the",
"current",
"time",
".",
"Required",
"scopes",
":",
"purge",
"-",
"cache",
":",
"<provisionerId",
">",
"/",
"<workerType",
">",
":",
"<cacheName",
">",
"See",
"#purgeCache"
] | [
"func",
"(",
"purgeCache",
"*",
"PurgeCache",
")",
"PurgeCache",
"(",
"provisionerId",
",",
"workerType",
"string",
",",
"payload",
"*",
"PurgeCacheRequest",
")",
"error",
"{",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"purgeCache",
")",
"\n",
"_",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"payload",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"<mask>",
".",
"QueryEscape",
"(",
"provisionerId",
")",
"+",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"workerType",
")",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
5,865 | all-5866 | [
"NewInmemStore",
"returns",
"a",
"new",
"in",
"-",
"memory",
"backend",
".",
"Do",
"not",
"ever",
"use",
"for",
"production",
".",
"Only",
"for",
"testing",
"."
] | [
"func",
"NewInmemStore",
"(",
")",
"*",
"InmemStore",
"{",
"i",
":=",
"&",
"InmemStore",
"{",
"logs",
":",
"make",
"(",
"map",
"[",
"uint64",
"]",
"*",
"<mask>",
")",
",",
"kv",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"byte",
")",
",",
"kvInt",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"uint64",
")",
",",
"}",
"\n",
"return",
"i",
"\n",
"}"
] |
5,866 | all-5867 | [
"FromHeader",
"looks",
"for",
"the",
"request",
"in",
"the",
"authentication",
"header",
"or",
"call",
"ParseMultipartForm",
"if",
"not",
"present",
".",
"TODO",
":",
"Implement",
"parsing",
"form",
"data",
"."
] | [
"func",
"FromHeader",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"(",
"*",
"jwt",
".",
"JSONWebToken",
",",
"error",
")",
"{",
"if",
"r",
"==",
"nil",
"{",
"return",
"nil",
",",
"ErrNilRequest",
"\n",
"}",
"\n",
"raw",
":=",
"\"",
"\"",
"\n",
"if",
"h",
":=",
"r",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
";",
"len",
"(",
"h",
")",
">",
"7",
"&&",
"strings",
".",
"EqualFold",
"(",
"h",
"[",
"0",
":",
"7",
"]",
",",
"\"",
"\"",
")",
"{",
"raw",
"=",
"h",
"[",
"7",
":",
"]",
"\n",
"}",
"\n",
"if",
"<mask>",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrTokenNotFound",
"\n",
"}",
"\n",
"return",
"jwt",
".",
"ParseSigned",
"(",
"raw",
")",
"\n",
"}"
] |
5,867 | all-5868 | [
"LoadCodec",
"loads",
"a",
"pre",
"-",
"compiled",
"language",
"file"
] | [
"func",
"LoadCodec",
"(",
"bank",
"string",
")",
"(",
"codec",
"*",
"WordCodec",
",",
"err",
"error",
")",
"{",
"words",
",",
"err",
":=",
"loadBank",
"(",
"bank",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"codec",
",",
"err",
"\n",
"}",
"\n",
"return",
"NewCodec",
"(",
"<mask>",
")",
"\n",
"}"
] |
5,868 | all-5869 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"DialogType",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"out",
".",
"<mask>",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
] |
5,869 | all-5870 | [
"bind",
"a",
"buffer",
"to",
"a",
"vertex",
"buffer",
"bind",
"point"
] | [
"func",
"BindVertexBuffer",
"(",
"bindingindex",
"uint32",
",",
"buffer",
"uint32",
",",
"offset",
"int",
",",
"stride",
"int32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpBindVertexBuffer",
",",
"4",
",",
"uintptr",
"(",
"bindingindex",
")",
",",
"uintptr",
"(",
"buffer",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"stride",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
5,870 | all-5871 | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"the",
"key",
"and",
"value",
"."
] | [
"func",
"(",
"lf",
"Field",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprint",
"(",
"lf",
".",
"<mask>",
",",
"\"",
"\"",
",",
"lf",
".",
"Value",
"(",
")",
")",
"\n",
"}"
] |
5,871 | all-5872 | [
"/",
"*",
"GDK",
"Keyval",
"KeyvalFromName",
"()",
"is",
"a",
"wrapper",
"around",
"gdk_keyval_from_name",
"()",
"."
] | [
"func",
"KeyvalFromName",
"(",
"keyvalName",
"string",
")",
"uint",
"{",
"str",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"keyvalName",
")",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"str",
")",
")",
"\n",
"return",
"uint",
"(",
"C",
".",
"gdk_keyval_from_name",
"(",
"str",
")",
")",
"\n",
"}"
] |
5,872 | all-5873 | [
"newPipelineConfig",
"returns",
"a",
"client",
"and",
"informer",
"capable",
"of",
"mutating",
"and",
"monitoring",
"the",
"specified",
"config",
"."
] | [
"func",
"newPipelineConfig",
"(",
"cfg",
"rest",
".",
"Config",
",",
"stop",
"chan",
"struct",
"{",
"}",
")",
"(",
"*",
"pipelineConfig",
",",
"error",
")",
"{",
"bc",
",",
"err",
":=",
"pipelineset",
".",
"NewForConfig",
"(",
"&",
"cfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Ensure the pipeline CRD is deployed",
"// TODO(fejta): probably a better way to do this",
"if",
"_",
",",
"err",
":=",
"bc",
".",
"TektonV1alpha1",
"(",
")",
".",
"PipelineRuns",
"(",
"\"",
"\"",
")",
".",
"<mask>",
"(",
"metav1",
".",
"ListOptions",
"{",
"Limit",
":",
"1",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Assume watches receive updates, but resync every 30m in case something wonky happens",
"bif",
":=",
"pipelineinfo",
".",
"NewSharedInformerFactory",
"(",
"bc",
",",
"30",
"*",
"time",
".",
"Minute",
")",
"\n",
"bif",
".",
"Tekton",
"(",
")",
".",
"V1alpha1",
"(",
")",
".",
"PipelineRuns",
"(",
")",
".",
"Lister",
"(",
")",
"\n",
"go",
"bif",
".",
"Start",
"(",
"stop",
")",
"\n",
"return",
"&",
"pipelineConfig",
"{",
"client",
":",
"bc",
",",
"informer",
":",
"bif",
".",
"Tekton",
"(",
")",
".",
"V1alpha1",
"(",
")",
".",
"PipelineRuns",
"(",
")",
",",
"}",
",",
"nil",
"\n",
"}"
] |
5,873 | all-5874 | [
"flattenClusterVmGroup",
"saves",
"a",
"ClusterVmGroup",
"into",
"the",
"supplied",
"ResourceData",
"."
] | [
"func",
"flattenClusterVMGroup",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
",",
"obj",
"*",
"types",
".",
"ClusterVmGroup",
")",
"error",
"{",
"client",
",",
"err",
":=",
"resourceVSphereComputeClusterVMGroupClient",
"(",
"meta",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"results",
",",
"err",
":=",
"virtualmachine",
".",
"UUIDsForManagedObjectReferences",
"(",
"<mask>",
",",
"obj",
".",
"Vm",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"structure",
".",
"SetBatch",
"(",
"d",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"results",
".",
"UUIDs",
"(",
")",
",",
"}",
")",
"\n",
"}"
] |
5,874 | all-5875 | [
"LoadModule",
"loads",
"the",
"kernel",
"module",
"with",
"the",
"given",
"name",
"by",
"invoking",
"modprobe",
"."
] | [
"func",
"LoadModule",
"(",
"module",
"string",
")",
"error",
"{",
"if",
"shared",
".",
"PathExists",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"module",
")",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"_",
",",
"err",
":=",
"<mask>",
".",
"RunCommand",
"(",
"\"",
"\"",
",",
"module",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
5,875 | all-5876 | [
"GetLimitsResourceListFromPipeline",
"returns",
"a",
"list",
"of",
"resources",
"that",
"the",
"pipeline",
"maximally",
"is",
"limited",
"to",
"."
] | [
"func",
"GetLimitsResourceListFromPipeline",
"(",
"pipelineInfo",
"*",
"pps",
".",
"PipelineInfo",
")",
"(",
"*",
"v1",
".",
"ResourceList",
",",
"<mask>",
")",
"{",
"return",
"getResourceListFromSpec",
"(",
"pipelineInfo",
".",
"ResourceLimits",
",",
"pipelineInfo",
".",
"CacheSize",
")",
"\n",
"}"
] |
5,876 | all-5877 | [
"GetSessions",
"returns",
"sessions",
"."
] | [
"func",
"(",
"h",
"*",
"Handler",
")",
"GetSessions",
"(",
"tkn",
",",
"channel",
"string",
")",
"(",
"[",
"]",
"<mask>",
".",
"Session",
",",
"error",
")",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"channel",
")",
"\n\n",
"if",
"!",
"h",
".",
"token",
".",
"Check",
"(",
"tkn",
")",
"{",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
",",
"ErrAccessDenied",
"\n",
"}",
"\n\n",
"tail",
",",
"args",
":=",
"h",
".",
"getSessionsConditions",
"(",
"channel",
")",
"\n\n",
"result",
",",
"err",
":=",
"h",
".",
"selectAllFrom",
"(",
"logger",
",",
"data",
".",
"SessionTable",
",",
"tail",
",",
"args",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"sessions",
":=",
"make",
"(",
"[",
"]",
"data",
".",
"Session",
",",
"len",
"(",
"result",
")",
")",
"\n",
"for",
"i",
",",
"item",
":=",
"range",
"result",
"{",
"sessions",
"[",
"i",
"]",
"=",
"*",
"item",
".",
"(",
"*",
"data",
".",
"Session",
")",
"\n",
"}",
"\n\n",
"return",
"sessions",
",",
"nil",
"\n",
"}"
] |
5,877 | all-5878 | [
"GetFinishedAt",
"sets",
"the",
"timestamp",
"for",
"container",
"s",
"stopped",
"time"
] | [
"func",
"(",
"c",
"*",
"Container",
")",
"GetFinishedAt",
"(",
")",
"<mask>",
".",
"Time",
"{",
"c",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"c",
".",
"finishedAt",
"\n",
"}"
] |
5,878 | all-5879 | [
"Finalize",
"ensures",
"there",
"no",
"nil",
"pointers",
"."
] | [
"func",
"(",
"c",
"*",
"TransportConfig",
")",
"Finalize",
"(",
")",
"{",
"if",
"c",
".",
"DialKeepAlive",
"==",
"nil",
"{",
"c",
".",
"DialKeepAlive",
"=",
"TimeDuration",
"(",
"DefaultDialKeepAlive",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"DialTimeout",
"==",
"nil",
"{",
"c",
".",
"DialTimeout",
"=",
"TimeDuration",
"(",
"DefaultDialTimeout",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"DisableKeepAlives",
"==",
"nil",
"{",
"c",
".",
"DisableKeepAlives",
"=",
"Bool",
"(",
"<mask>",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"IdleConnTimeout",
"==",
"nil",
"{",
"c",
".",
"IdleConnTimeout",
"=",
"TimeDuration",
"(",
"DefaultIdleConnTimeout",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"MaxIdleConns",
"==",
"nil",
"{",
"c",
".",
"MaxIdleConns",
"=",
"Int",
"(",
"DefaultMaxIdleConns",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"MaxIdleConnsPerHost",
"==",
"nil",
"{",
"c",
".",
"MaxIdleConnsPerHost",
"=",
"Int",
"(",
"DefaultMaxIdleConnsPerHost",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"TLSHandshakeTimeout",
"==",
"nil",
"{",
"c",
".",
"TLSHandshakeTimeout",
"=",
"TimeDuration",
"(",
"DefaultTLSHandshakeTimeout",
")",
"\n",
"}",
"\n",
"}"
] |
5,879 | all-5880 | [
"Do",
"executes",
"DOMDebugger",
".",
"removeXHRBreakpoint",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"RemoveXHRBreakpointParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandRemoveXHRBreakpoint",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
5,880 | all-5881 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"BackendNodeID",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"buf",
":=",
"<mask>",
".",
"Raw",
"(",
")",
"\n",
"if",
"l",
":=",
"len",
"(",
"buf",
")",
";",
"l",
">",
"2",
"&&",
"buf",
"[",
"0",
"]",
"==",
"'\"'",
"&&",
"buf",
"[",
"l",
"-",
"1",
"]",
"==",
"'\"'",
"{",
"buf",
"=",
"buf",
"[",
"1",
":",
"l",
"-",
"1",
"]",
"\n",
"}",
"\n\n",
"v",
",",
"err",
":=",
"strconv",
".",
"ParseInt",
"(",
"string",
"(",
"buf",
")",
",",
"10",
",",
"64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"in",
".",
"AddError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"*",
"t",
"=",
"BackendNodeID",
"(",
"v",
")",
"\n",
"}"
] |
5,881 | all-5882 | [
"Version",
"returns",
"the",
"underlying",
"docker",
"version",
"."
] | [
"func",
"(",
"engine",
"*",
"DockerTaskEngine",
")",
"Version",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"return",
"engine",
".",
"client",
".",
"<mask>",
"(",
"engine",
".",
"ctx",
",",
"dockerclient",
".",
"VersionTimeout",
")",
"\n",
"}"
] |
5,882 | all-5883 | [
"splitKey",
"splits",
"a",
"key",
"into",
"the",
"format",
"we",
"want",
"and",
"also",
"postpends",
"the",
"generation",
"number"
] | [
"func",
"(",
"s",
"*",
"objBlockAPIServer",
")",
"splitKey",
"(",
"key",
"string",
")",
"string",
"{",
"gen",
":=",
"s",
".",
"getGeneration",
"(",
")",
"\n",
"if",
"len",
"(",
"key",
")",
"<",
"prefixLength",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
",",
"gen",
")",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"key",
"[",
":",
"prefixLength",
"]",
",",
"key",
"[",
"prefixLength",
":",
"]",
",",
"gen",
")",
"\n",
"}"
] |
5,883 | all-5884 | [
"NewDataReadWriter",
"returns",
"a",
"new",
"callback",
"based",
"data",
"buffer"
] | [
"func",
"NewDataReadWriter",
"(",
"rw",
"io",
".",
"ReadWriter",
")",
"(",
"*",
"Data",
",",
"error",
")",
"{",
"d",
":=",
"newData",
"(",
")",
"\n",
"d",
".",
"r",
"=",
"rw",
"\n",
"d",
".",
"w",
"=",
"rw",
"\n",
"d",
".",
"cbs",
".",
"<mask>",
"=",
"C",
".",
"gpgme_data_read_cb_t",
"(",
"C",
".",
"gogpgme_readfunc",
")",
"\n",
"d",
".",
"cbs",
".",
"write",
"=",
"C",
".",
"gpgme_data_write_cb_t",
"(",
"C",
".",
"gogpgme_writefunc",
")",
"\n",
"cbc",
":=",
"callbackAdd",
"(",
"d",
")",
"\n",
"d",
".",
"cbc",
"=",
"cbc",
"\n",
"return",
"d",
",",
"handleError",
"(",
"C",
".",
"gogpgme_data_new_from_cbs",
"(",
"&",
"d",
".",
"dh",
",",
"&",
"d",
".",
"cbs",
",",
"C",
".",
"uintptr_t",
"(",
"cbc",
")",
")",
")",
"\n",
"}"
] |
5,884 | all-5885 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventAttachedToTarget",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoTarget19",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
5,885 | all-5886 | [
"isMembersEqual",
"checks",
"whether",
"two",
"members",
"equal",
"except",
"ID",
"field",
".",
"The",
"given",
"wmembs",
"should",
"always",
"set",
"ID",
"field",
"to",
"empty",
"string",
"."
] | [
"func",
"isMembersEqual",
"(",
"membs",
"[",
"]",
"client",
".",
"Member",
",",
"wmembs",
"[",
"]",
"<mask>",
".",
"Member",
")",
"bool",
"{",
"sort",
".",
"Sort",
"(",
"SortableMemberSliceByPeerURLs",
"(",
"membs",
")",
")",
"\n",
"sort",
".",
"Sort",
"(",
"SortableMemberSliceByPeerURLs",
"(",
"wmembs",
")",
")",
"\n",
"for",
"i",
":=",
"range",
"membs",
"{",
"membs",
"[",
"i",
"]",
".",
"ID",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"reflect",
".",
"DeepEqual",
"(",
"membs",
",",
"wmembs",
")",
"\n",
"}"
] |
5,886 | all-5887 | [
"similar",
"returns",
"true",
"if",
"the",
"two",
"Signature",
"are",
"equal",
"or",
"almost",
"but",
"not",
"quite",
"equal",
"."
] | [
"func",
"(",
"s",
"*",
"Signature",
")",
"similar",
"(",
"r",
"*",
"Signature",
",",
"similar",
"Similarity",
")",
"bool",
"{",
"if",
"s",
".",
"State",
"!=",
"r",
".",
"State",
"||",
"!",
"s",
".",
"CreatedBy",
".",
"similar",
"(",
"&",
"r",
".",
"CreatedBy",
",",
"similar",
")",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"if",
"similar",
"==",
"ExactFlags",
"&&",
"s",
".",
"Locked",
"!=",
"r",
".",
"Locked",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"s",
".",
"Stack",
".",
"similar",
"(",
"&",
"r",
".",
"Stack",
",",
"similar",
")",
"\n",
"}"
] |
5,887 | all-5888 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventScreencastFrame",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage52",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
5,888 | all-5889 | [
"Encode",
"encodes",
"a",
"JWT",
"using",
"the",
"Algorithm",
"and",
"Signer",
"returning",
"the",
"URL",
"-",
"safe",
"encoded",
"token",
"or",
"any",
"errors",
"encountered",
"during",
"encoding",
"."
] | [
"func",
"Encode",
"(",
"alg",
"Algorithm",
",",
"signer",
"Signer",
",",
"obj",
"<mask>",
"{",
"}",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n\n",
"// grab encode targets",
"headerObj",
",",
"payloadObj",
",",
"err",
":=",
"encodeTargets",
"(",
"alg",
",",
"obj",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// json encode header",
"header",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"headerObj",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// b64 encode playload",
"headerEnc",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"b64",
".",
"EncodedLen",
"(",
"len",
"(",
"header",
")",
")",
")",
"\n",
"b64",
".",
"Encode",
"(",
"headerEnc",
",",
"header",
")",
"\n\n",
"// json encode payload",
"payload",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"payloadObj",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// b64 encode playload",
"payloadEnc",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"b64",
".",
"EncodedLen",
"(",
"len",
"(",
"payload",
")",
")",
")",
"\n",
"b64",
".",
"Encode",
"(",
"payloadEnc",
",",
"payload",
")",
"\n\n",
"// allocate result",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n\n",
"// add header",
"_",
",",
"err",
"=",
"buf",
".",
"Write",
"(",
"headerEnc",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// add 1st separator",
"_",
",",
"err",
"=",
"buf",
".",
"Write",
"(",
"tokenSep",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// add payload",
"_",
",",
"err",
"=",
"buf",
".",
"Write",
"(",
"payloadEnc",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// sign",
"sig",
",",
"err",
":=",
"signer",
".",
"Sign",
"(",
"buf",
".",
"Bytes",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// add 2nd separator",
"_",
",",
"err",
"=",
"buf",
".",
"Write",
"(",
"tokenSep",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// add sig",
"_",
",",
"err",
"=",
"buf",
".",
"Write",
"(",
"sig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"buf",
".",
"Bytes",
"(",
")",
",",
"nil",
"\n",
"}"
] |
5,889 | all-5890 | [
"findCommand",
"searches",
"the",
"list",
"of",
"template",
"configs",
"for",
"the",
"given",
"command",
"and",
"returns",
"it",
"if",
"it",
"exists",
"."
] | [
"func",
"findCommand",
"(",
"c",
"*",
"config",
".",
"TemplateConfig",
",",
"templates",
"[",
"]",
"*",
"config",
".",
"TemplateConfig",
")",
"*",
"config",
".",
"TemplateConfig",
"{",
"needle",
":=",
"config",
".",
"StringVal",
"(",
"c",
".",
"Exec",
".",
"Command",
")",
"\n",
"for",
"_",
",",
"t",
":=",
"<mask>",
"templates",
"{",
"if",
"needle",
"==",
"config",
".",
"StringVal",
"(",
"t",
".",
"Exec",
".",
"Command",
")",
"{",
"return",
"t",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,890 | all-5891 | [
"readBoshJob",
"reads",
"a",
"BOSH",
"job",
"manifest",
"out",
"of",
"the",
"given",
"reader",
"into",
"a",
"new",
"JobManifest",
"struct"
] | [
"func",
"(",
"r",
"*",
"BoshRelease",
")",
"readBoshJob",
"(",
"jr",
"io",
".",
"Reader",
")",
"(",
"enaml",
".",
"JobManifest",
",",
"error",
")",
"{",
"var",
"job",
"enaml",
".",
"JobManifest",
"\n",
"jw",
":=",
"pkg",
".",
"NewTgzWalker",
"(",
"jr",
")",
"\n",
"jw",
".",
"OnMatch",
"(",
"\"",
"\"",
",",
"func",
"(",
"file",
"pkg",
".",
"FileEntry",
")",
"error",
"{",
"return",
"decodeYaml",
"(",
"file",
".",
"Reader",
",",
"&",
"<mask>",
")",
"\n",
"}",
")",
"\n",
"err",
":=",
"jw",
".",
"Walk",
"(",
")",
"\n",
"return",
"job",
",",
"err",
"\n",
"}"
] |
5,891 | all-5892 | [
"UpdateIntegrationGCP",
"updates",
"a",
"Google",
"Cloud",
"Platform",
"Integration",
"."
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"UpdateIntegrationGCP",
"(",
"cir",
"*",
"IntegrationGCPUpdateRequest",
")",
"error",
"{",
"return",
"<mask>",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"cir",
",",
"nil",
")",
"\n",
"}"
] |
5,892 | all-5893 | [
"Scan",
"read",
"a",
"value",
"from",
"a",
"database",
"driver"
] | [
"func",
"(",
"e",
"*",
"Email",
")",
"Scan",
"(",
"raw",
"interface",
"{",
"}",
")",
"error",
"{",
"switch",
"v",
":=",
"<mask>",
".",
"(",
"type",
")",
"{",
"case",
"[",
"]",
"byte",
":",
"*",
"e",
"=",
"Email",
"(",
"string",
"(",
"v",
")",
")",
"\n",
"case",
"string",
":",
"*",
"e",
"=",
"Email",
"(",
"v",
")",
"\n",
"default",
":",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"v",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
5,893 | all-5894 | [
"filterSubpools",
"filters",
"non",
"-",
"pool",
"PRs",
"out",
"of",
"the",
"initially",
"identified",
"subpools",
"deleting",
"any",
"pools",
"that",
"become",
"empty",
".",
"See",
"filterSubpool",
"for",
"filtering",
"details",
"."
] | [
"func",
"(",
"c",
"*",
"Controller",
")",
"filterSubpools",
"(",
"goroutines",
"int",
",",
"raw",
"map",
"[",
"string",
"]",
"*",
"subpool",
")",
"map",
"[",
"string",
"]",
"*",
"subpool",
"{",
"filtered",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"subpool",
")",
"\n",
"var",
"lock",
"sync",
".",
"Mutex",
"\n\n",
"subpoolsInParallel",
"(",
"goroutines",
",",
"raw",
",",
"func",
"(",
"sp",
"*",
"subpool",
")",
"{",
"if",
"err",
":=",
"c",
".",
"initSubpoolData",
"(",
"sp",
")",
";",
"err",
"!=",
"nil",
"{",
"sp",
".",
"log",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"key",
":=",
"poolKey",
"(",
"sp",
".",
"org",
",",
"sp",
".",
"repo",
",",
"sp",
".",
"branch",
")",
"\n",
"if",
"spFiltered",
":=",
"filterSubpool",
"(",
"c",
".",
"ghc",
",",
"sp",
")",
";",
"spFiltered",
"!=",
"nil",
"{",
"sp",
".",
"log",
".",
"WithField",
"(",
"\"",
"\"",
",",
"key",
")",
".",
"WithField",
"(",
"\"",
"\"",
",",
"spFiltered",
")",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n\n",
"lock",
".",
"Lock",
"(",
")",
"\n",
"filtered",
"[",
"key",
"]",
"=",
"spFiltered",
"\n",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"}",
"else",
"{",
"sp",
".",
"<mask>",
".",
"WithField",
"(",
"\"",
"\"",
",",
"key",
")",
".",
"WithField",
"(",
"\"",
"\"",
",",
"spFiltered",
")",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
",",
")",
"\n",
"return",
"filtered",
"\n",
"}"
] |
5,894 | all-5895 | [
"DerivePBKDF2",
"implements",
"Password",
"Based",
"Key",
"Derivation",
"Function",
"2",
"RFC",
"2898",
".",
"Derives",
"key",
"of",
"keyBitLength",
"size",
"given",
"password",
"salt",
"iteration",
"count",
"and",
"hash",
"function"
] | [
"func",
"DerivePBKDF2",
"(",
"password",
",",
"salt",
"[",
"]",
"byte",
",",
"iterationCount",
",",
"keyBitLength",
"int",
",",
"h",
"<mask>",
".",
"Hash",
")",
"[",
"]",
"byte",
"{",
"prf",
":=",
"hmac",
".",
"New",
"(",
"func",
"(",
")",
"hash",
".",
"Hash",
"{",
"return",
"h",
"}",
",",
"password",
")",
"\n",
"hLen",
":=",
"prf",
".",
"Size",
"(",
")",
"\n",
"dkLen",
":=",
"keyBitLength",
">>",
"3",
"//size of derived key in bytes",
"\n\n",
"l",
":=",
"int",
"(",
"math",
".",
"Ceil",
"(",
"float64",
"(",
"dkLen",
")",
"/",
"float64",
"(",
"hLen",
")",
")",
")",
"// l = CEIL (dkLen / hLen)",
"\n",
"r",
":=",
"dkLen",
"-",
"(",
"l",
"-",
"1",
")",
"*",
"hLen",
"\n\n",
"// 1. If dkLen > (2^32 - 1) * hLen, output \"derived key too long\" and stop.",
"if",
"dkLen",
">",
"MaxInt",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"keyBitLength",
")",
")",
"\n",
"}",
"\n\n",
"dk",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"0",
",",
"dkLen",
")",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"l",
";",
"i",
"++",
"{",
"t",
":=",
"f",
"(",
"salt",
",",
"iterationCount",
",",
"i",
"+",
"1",
",",
"prf",
")",
"// T_l = F (P, S, c, l)",
"\n\n",
"if",
"i",
"==",
"(",
"l",
"-",
"1",
")",
"{",
"t",
"=",
"t",
"[",
":",
"r",
"]",
"\n",
"}",
"// truncate last block to r bits",
"\n\n",
"dk",
"=",
"append",
"(",
"dk",
",",
"t",
"...",
")",
"// DK = T_1 || T_2 || ... || T_l<0..r-1>",
"\n",
"}",
"\n\n",
"return",
"dk",
"\n",
"}"
] |
5,895 | all-5896 | [
"BindVariablesEqual",
"compares",
"two",
"maps",
"of",
"bind",
"variables",
"."
] | [
"func",
"BindVariablesEqual",
"(",
"x",
",",
"y",
"<mask>",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
")",
"bool",
"{",
"return",
"reflect",
".",
"DeepEqual",
"(",
"&",
"querypb",
".",
"BoundQuery",
"{",
"BindVariables",
":",
"x",
"}",
",",
"&",
"querypb",
".",
"BoundQuery",
"{",
"BindVariables",
":",
"y",
"}",
")",
"\n",
"}"
] |
5,896 | all-5897 | [
"sync",
"checks",
"to",
"see",
"if",
"an",
"issue",
"is",
"already",
"on",
"github",
"and",
"tries",
"to",
"create",
"a",
"new",
"issue",
"for",
"it",
"if",
"it",
"is",
"not",
".",
"True",
"is",
"returned",
"iff",
"a",
"new",
"issue",
"is",
"created",
"."
] | [
"func",
"(",
"c",
"*",
"IssueCreator",
")",
"sync",
"(",
"issue",
"Issue",
")",
"bool",
"{",
"// First look for existing issues with this ID.",
"id",
":=",
"issue",
".",
"ID",
"(",
")",
"\n",
"var",
"closedIssues",
"[",
"]",
"*",
"github",
".",
"Issue",
"\n",
"for",
"_",
",",
"i",
":=",
"range",
"c",
".",
"allIssues",
"{",
"if",
"strings",
".",
"Contains",
"(",
"*",
"i",
".",
"Body",
",",
"id",
")",
"{",
"switch",
"*",
"i",
".",
"State",
"{",
"case",
"\"",
"\"",
":",
"//if an open issue is found with the ID then the issue is already synced",
"return",
"false",
"\n",
"case",
"\"",
"\"",
":",
"closedIssues",
"=",
"append",
"(",
"closedIssues",
",",
"i",
")",
"\n",
"default",
":",
"glog",
".",
"Errorf",
"(",
"\"",
"\\n",
"\"",
",",
"*",
"i",
".",
"State",
",",
"*",
"i",
".",
"Number",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"// No open issues exist for the ID.",
"body",
":=",
"issue",
".",
"Body",
"(",
"closedIssues",
")",
"\n",
"if",
"body",
"==",
"\"",
"\"",
"{",
"// Issue indicated that it should not be synced.",
"glog",
".",
"Infof",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"id",
")",
"\n",
"return",
"<mask>",
"\n",
"}",
"\n",
"if",
"!",
"strings",
".",
"Contains",
"(",
"body",
",",
"id",
")",
"{",
"glog",
".",
"Fatalf",
"(",
"\"",
"\\n",
"\\n",
"\"",
",",
"id",
",",
"body",
")",
"\n",
"}",
"\n\n",
"title",
":=",
"issue",
".",
"Title",
"(",
")",
"\n",
"owners",
":=",
"issue",
".",
"Owners",
"(",
")",
"\n",
"if",
"c",
".",
"Collaborators",
"!=",
"nil",
"{",
"var",
"removedOwners",
"[",
"]",
"string",
"\n",
"owners",
",",
"removedOwners",
"=",
"setIntersect",
"(",
"owners",
",",
"c",
".",
"Collaborators",
")",
"\n",
"if",
"len",
"(",
"removedOwners",
")",
">",
"0",
"{",
"glog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"title",
",",
"removedOwners",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"labels",
":=",
"issue",
".",
"Labels",
"(",
")",
"\n",
"if",
"prio",
",",
"ok",
":=",
"issue",
".",
"Priority",
"(",
")",
";",
"ok",
"{",
"labels",
"=",
"append",
"(",
"labels",
",",
"\"",
"\"",
"+",
"prio",
")",
"\n",
"}",
"\n",
"if",
"c",
".",
"validLabels",
"!=",
"nil",
"{",
"var",
"removedLabels",
"[",
"]",
"string",
"\n",
"labels",
",",
"removedLabels",
"=",
"setIntersect",
"(",
"labels",
",",
"c",
".",
"validLabels",
")",
"\n",
"if",
"len",
"(",
"removedLabels",
")",
">",
"0",
"{",
"glog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"title",
",",
"removedLabels",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"glog",
".",
"Infof",
"(",
"\"",
"\\n",
"\"",
",",
"title",
",",
"owners",
")",
"\n",
"if",
"c",
".",
"dryRun",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"created",
",",
"err",
":=",
"c",
".",
"client",
".",
"CreateIssue",
"(",
"c",
".",
"org",
",",
"c",
".",
"project",
",",
"title",
",",
"body",
",",
"labels",
",",
"owners",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"glog",
".",
"Errorf",
"(",
"\"",
"\\n",
"\"",
",",
"id",
")",
"\n",
"return",
"false",
"\n",
"}",
"\n",
"c",
".",
"allIssues",
"[",
"*",
"created",
".",
"Number",
"]",
"=",
"created",
"\n",
"return",
"true",
"\n",
"}"
] |
5,897 | all-5898 | [
"TranslateGeo",
"is",
"deprecated",
"as",
"of",
"1",
".",
"2",
".",
"0",
"-",
"alpha",
".",
"Use",
"Translate",
"instead",
"."
] | [
"func",
"TranslateGeo",
"(",
"tx",
",",
"ty",
"float64",
")",
"GeoM",
"{",
"g",
":=",
"GeoM",
"{",
"}",
"\n",
"g",
".",
"Translate",
"(",
"<mask>",
",",
"ty",
")",
"\n",
"return",
"g",
"\n",
"}"
] |
5,898 | all-5899 | [
"DropStatementID",
"releases",
"the",
"hdb",
"statement",
"handle",
"."
] | [
"func",
"(",
"s",
"*",
"Session",
")",
"DropStatementID",
"(",
"id",
"uint64",
")",
"error",
"{",
"s",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"s",
".",
"statementID",
".",
"<mask>",
"=",
"&",
"id",
"\n",
"if",
"err",
":=",
"s",
".",
"writeRequest",
"(",
"mtDropStatementID",
",",
"false",
",",
"s",
".",
"statementID",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"s",
".",
"readReply",
"(",
"nil",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
5,899 | all-5900 | [
"MustAddError",
"calls",
"AddError",
"and",
"panics",
"in",
"case",
"of",
"an",
"error",
"."
] | [
"func",
"(",
"r",
"*",
"MapErrorRegistry",
")",
"MustAddError",
"(",
"code",
"int",
",",
"err",
"error",
")",
"{",
"if",
"e",
":=",
"r",
".",
"AddError",
"(",
"<mask>",
",",
"err",
")",
";",
"e",
"!=",
"nil",
"{",
"panic",
"(",
"e",
")",
"\n",
"}",
"\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.