id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
2,900 | all-2901 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"AuthChallenge",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoFetch15",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
2,901 | all-2902 | [
"InitTranslate",
"initializes",
"a",
"matrix",
"with",
"the",
"given",
"translation"
] | [
"func",
"(",
"m",
"*",
"Matrix",
")",
"InitTranslate",
"(",
"tx",
",",
"ty",
"float64",
")",
"{",
"C",
".",
"cairo_matrix_init_translate",
"(",
"m",
".",
"native",
"(",
")",
",",
"C",
".",
"double",
"(",
"<mask>",
")",
",",
"C",
".",
"double",
"(",
"ty",
")",
")",
"\n",
"}"
] |
2,902 | all-2903 | [
"SetTopMargin",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_page_setup_set_top_margin",
"()",
"."
] | [
"func",
"(",
"ps",
"*",
"PageSetup",
")",
"SetTopMargin",
"(",
"margin",
"float64",
",",
"unit",
"Unit",
")",
"{",
"C",
".",
"gtk_page_setup_set_top_margin",
"(",
"ps",
".",
"native",
"(",
")",
",",
"C",
".",
"gdouble",
"(",
"margin",
")",
",",
"C",
".",
"GtkUnit",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
2,903 | all-2904 | [
"FileList",
"entries",
"at",
"the",
"given",
"path",
"using",
"the",
"UnixFS",
"commands"
] | [
"func",
"(",
"s",
"*",
"Shell",
")",
"FileList",
"(",
"<mask>",
"string",
")",
"(",
"*",
"UnixLsObject",
",",
"error",
")",
"{",
"var",
"out",
"lsOutput",
"\n",
"if",
"err",
":=",
"s",
".",
"Request",
"(",
"\"",
"\"",
",",
"path",
")",
".",
"Exec",
"(",
"context",
".",
"Background",
"(",
")",
",",
"&",
"out",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"object",
":=",
"range",
"out",
".",
"Objects",
"{",
"return",
"object",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
2,904 | all-2905 | [
"RenameContainer",
"requests",
"that",
"LXD",
"renames",
"the",
"container"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"RenameContainer",
"(",
"name",
"string",
",",
"container",
"api",
".",
"ContainerPost",
")",
"(",
"Operation",
",",
"error",
")",
"{",
"// Sanity check",
"if",
"container",
".",
"Migration",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Send the request",
"op",
",",
"_",
",",
"err",
":=",
"r",
".",
"queryOperation",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"QueryEscape",
"(",
"name",
")",
")",
",",
"container",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"op",
",",
"nil",
"\n",
"}"
] |
2,905 | all-2906 | [
"native",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GtkTreeSelection",
"."
] | [
"func",
"(",
"v",
"*",
"TreeSelection",
")",
"native",
"(",
")",
"*",
"C",
".",
"GtkTreeSelection",
"{",
"if",
"v",
"==",
"nil",
"||",
"v",
".",
"GObject",
"==",
"nil",
"{",
"<mask>",
"nil",
"\n",
"}",
"\n",
"p",
":=",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"GObject",
")",
"\n",
"return",
"C",
".",
"toGtkTreeSelection",
"(",
"p",
")",
"\n",
"}"
] |
2,906 | all-2907 | [
"IntrospectState",
"returns",
"the",
"runtime",
"state",
"of",
"the",
"subchannels",
"."
] | [
"func",
"(",
"subChMap",
"*",
"subChannelMap",
")",
"IntrospectState",
"(",
"opts",
"*",
"IntrospectionOptions",
")",
"map",
"[",
"string",
"]",
"SubChannelRuntimeState",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"SubChannelRuntimeState",
")",
"\n",
"subChMap",
".",
"RLock",
"(",
")",
"\n",
"for",
"k",
",",
"sc",
":=",
"range",
"subChMap",
".",
"subchannels",
"{",
"state",
":=",
"SubChannelRuntimeState",
"{",
"Service",
":",
"k",
",",
"Isolated",
":",
"sc",
".",
"Isolated",
"(",
")",
",",
"}",
"\n",
"if",
"state",
".",
"Isolated",
"{",
"state",
".",
"IsolatedPeers",
"=",
"sc",
".",
"Peers",
"(",
")",
".",
"IntrospectList",
"(",
"opts",
")",
"\n",
"}",
"\n",
"if",
"hmap",
",",
"ok",
":=",
"sc",
".",
"handler",
".",
"(",
"*",
"handlerMap",
")",
";",
"ok",
"{",
"state",
".",
"Handler",
".",
"Type",
"=",
"methodHandler",
"\n",
"methods",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"hmap",
".",
"handlers",
")",
")",
"\n",
"for",
"k",
":=",
"range",
"hmap",
".",
"handlers",
"{",
"methods",
"=",
"append",
"(",
"methods",
",",
"k",
")",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"methods",
")",
"\n",
"state",
".",
"Handler",
".",
"Methods",
"=",
"methods",
"\n",
"}",
"else",
"{",
"state",
".",
"<mask>",
".",
"Type",
"=",
"overrideHandler",
"\n",
"}",
"\n",
"m",
"[",
"k",
"]",
"=",
"state",
"\n",
"}",
"\n",
"subChMap",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"m",
"\n",
"}"
] |
2,907 | all-2908 | [
"EncodeOAuth2Code",
"generate",
"an",
"OAuth2",
"code"
] | [
"func",
"EncodeOAuth2Code",
"(",
"clientID",
",",
"redirectURI",
",",
"userID",
",",
"sharedKey",
"string",
")",
"(",
"code",
"string",
",",
"err",
"error",
")",
"{",
"rand",
":=",
"RandStringBytesMaskImprSrc",
"(",
"20",
")",
"\n",
"exp",
":=",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"time",
".",
"Minute",
"*",
"10",
")",
".",
"String",
"(",
")",
"\n",
"response",
":=",
"NewResponse",
"(",
"clientID",
",",
"redirectURI",
",",
"userID",
",",
"exp",
",",
"rand",
")",
"\n",
"jresponse",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"response",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"j64response",
":=",
"base64",
".",
"StdEncoding",
".",
"EncodeToString",
"(",
"jresponse",
")",
"\n",
"signer",
",",
"err",
":=",
"jose",
".",
"NewSigner",
"(",
"jose",
".",
"SigningKey",
"{",
"Algorithm",
":",
"jose",
".",
"HS512",
",",
"<mask>",
":",
"[",
"]",
"byte",
"(",
"sharedKey",
")",
"}",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"object",
",",
"err",
":=",
"signer",
".",
"Sign",
"(",
"[",
"]",
"byte",
"(",
"j64response",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"code",
",",
"err",
"=",
"object",
".",
"CompactSerialize",
"(",
")",
"\n",
"return",
"\n",
"}"
] |
2,908 | all-2909 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetInfoReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoSysteminfo3",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
2,909 | all-2910 | [
"Internal",
"MAAS",
"handling"
] | [
"func",
"(",
"c",
"*",
"containerLXC",
")",
"maasInterfaces",
"(",
")",
"(",
"[",
"]",
"maas",
".",
"ContainerInterface",
",",
"error",
")",
"{",
"interfaces",
":=",
"[",
"]",
"maas",
".",
"ContainerInterface",
"{",
"}",
"\n",
"for",
"k",
",",
"m",
":=",
"range",
"c",
".",
"expandedDevices",
"{",
"if",
"m",
"[",
"\"",
"\"",
"]",
"!=",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n\n",
"if",
"m",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"&&",
"m",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n\n",
"m",
",",
"err",
":=",
"c",
".",
"fillNetworkDevice",
"(",
"k",
",",
"m",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"subnets",
":=",
"[",
"]",
"maas",
".",
"ContainerInterfaceSubnet",
"{",
"}",
"\n\n",
"// IPv4",
"if",
"m",
"[",
"\"",
"\"",
"]",
"!=",
"\"",
"\"",
"{",
"subnet",
":=",
"maas",
".",
"ContainerInterfaceSubnet",
"{",
"Name",
":",
"m",
"[",
"\"",
"\"",
"]",
",",
"Address",
":",
"m",
"[",
"\"",
"\"",
"]",
",",
"}",
"\n\n",
"subnets",
"=",
"append",
"(",
"subnets",
",",
"subnet",
")",
"\n",
"}",
"\n\n",
"// IPv6",
"if",
"m",
"[",
"\"",
"\"",
"]",
"!=",
"\"",
"\"",
"{",
"subnet",
":=",
"maas",
".",
"ContainerInterfaceSubnet",
"{",
"Name",
":",
"m",
"[",
"\"",
"\"",
"]",
",",
"Address",
":",
"m",
"[",
"\"",
"\"",
"]",
",",
"}",
"\n\n",
"subnets",
"=",
"<mask>",
"(",
"subnets",
",",
"subnet",
")",
"\n",
"}",
"\n\n",
"iface",
":=",
"maas",
".",
"ContainerInterface",
"{",
"Name",
":",
"m",
"[",
"\"",
"\"",
"]",
",",
"MACAddress",
":",
"m",
"[",
"\"",
"\"",
"]",
",",
"Subnets",
":",
"subnets",
",",
"}",
"\n\n",
"interfaces",
"=",
"append",
"(",
"interfaces",
",",
"iface",
")",
"\n",
"}",
"\n\n",
"return",
"interfaces",
",",
"nil",
"\n",
"}"
] |
2,910 | all-2911 | [
"GetAllocation",
"is",
"a",
"wrapper",
"around",
"gtk_widget_get_allocation",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Widget",
")",
"GetAllocation",
"(",
")",
"*",
"Allocation",
"{",
"<mask>",
"a",
"Allocation",
"\n",
"C",
".",
"gtk_widget_get_allocation",
"(",
"v",
".",
"native",
"(",
")",
",",
"a",
".",
"native",
"(",
")",
")",
"\n",
"return",
"&",
"a",
"\n",
"}"
] |
2,911 | all-2912 | [
"ListObject",
"lists",
"objects",
"stored",
"in",
"pfs",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"ListObject",
"(",
"f",
"func",
"(",
"*",
"pfs",
".",
"<mask>",
")",
"error",
")",
"error",
"{",
"listObjectClient",
",",
"err",
":=",
"c",
".",
"ObjectAPIClient",
".",
"ListObjects",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"pfs",
".",
"ListObjectsRequest",
"{",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"for",
"{",
"object",
",",
"err",
":=",
"listObjectClient",
".",
"Recv",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"io",
".",
"EOF",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"f",
"(",
"object",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
2,912 | all-2913 | [
"countScalars",
"returns",
"the",
"count",
"of",
"items",
"in",
"input",
"up",
"to",
"but",
"not",
"including",
"the",
"first",
"non",
"-",
"scalar",
"item",
".",
"A",
"scalar",
"is",
"a",
"single",
"value",
"item",
"ie",
"not",
"a",
"keyvalser",
"."
] | [
"func",
"countScalars",
"(",
"<mask>",
"[",
"]",
"interface",
"{",
"}",
")",
"int",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"input",
")",
";",
"i",
"++",
"{",
"switch",
"input",
"[",
"i",
"]",
".",
"(",
"type",
")",
"{",
"case",
"keyvalser",
":",
"return",
"i",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"len",
"(",
"input",
")",
"\n",
"}"
] |
2,913 | all-2914 | [
"GoString",
"defines",
"the",
"printable",
"version",
"of",
"this",
"struct",
"."
] | [
"func",
"(",
"c",
"*",
"TemplateConfigs",
")",
"GoString",
"(",
")",
"string",
"{",
"if",
"c",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"s",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"*",
"c",
")",
")",
"\n",
"for",
"i",
",",
"t",
":=",
"<mask>",
"*",
"c",
"{",
"s",
"[",
"i",
"]",
"=",
"t",
".",
"GoString",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"\"",
"\"",
"+",
"strings",
".",
"Join",
"(",
"s",
",",
"\"",
"\"",
")",
"+",
"\"",
"\"",
"\n",
"}"
] |
2,914 | all-2915 | [
"Insert",
"is",
"a",
"wrapper",
"around",
"g_list_insert",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"List",
")",
"Insert",
"(",
"data",
"uintptr",
",",
"position",
"int",
")",
"*",
"List",
"{",
"glist",
":=",
"C",
".",
"g_list_insert",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gpointer",
"(",
"data",
")",
",",
"C",
".",
"gint",
"(",
"<mask>",
")",
")",
"\n",
"return",
"v",
".",
"wrapNewHead",
"(",
"glist",
")",
"\n",
"}"
] |
2,915 | all-2916 | [
"==",
"Editing",
"Add",
"adds",
"a",
"new",
"shadowed",
"group",
".",
"If",
"the",
"key",
"is",
"not",
"nil",
"generates",
"a",
"hashed",
"password",
".",
"It",
"is",
"created",
"a",
"backup",
"before",
"of",
"modify",
"the",
"original",
"file",
"."
] | [
"func",
"(",
"gs",
"*",
"GShadow",
")",
"Add",
"(",
"key",
"[",
"]",
"byte",
")",
"(",
"err",
"error",
")",
"{",
"loadConfig",
"(",
")",
"\n\n",
"gshadow",
",",
"err",
":=",
"LookupGShadow",
"(",
"gs",
".",
"Name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"_",
",",
"ok",
":=",
"err",
".",
"(",
"NoFoundError",
")",
";",
"!",
"ok",
"{",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"gshadow",
"!=",
"nil",
"{",
"return",
"ErrGroupExist",
"\n",
"}",
"\n\n",
"if",
"gs",
".",
"Name",
"==",
"\"",
"\"",
"{",
"return",
"RequiredError",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Backup",
"if",
"err",
"=",
"backup",
"(",
"_GSHADOW_FILE",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"db",
",",
"err",
":=",
"openDBFile",
"(",
"_GSHADOW_FILE",
",",
"os",
".",
"O_WRONLY",
"|",
"os",
".",
"O_APPEND",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"e",
":=",
"db",
".",
"close",
"(",
")",
"\n",
"if",
"e",
"!=",
"nil",
"&&",
"err",
"==",
"nil",
"{",
"err",
"=",
"e",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"if",
"key",
"!=",
"nil",
"{",
"gs",
".",
"password",
",",
"_",
"=",
"config",
".",
"crypter",
".",
"Generate",
"(",
"key",
",",
"nil",
")",
"\n",
"}",
"else",
"{",
"gs",
".",
"password",
"=",
"\"",
"\"",
"// Password disabled.",
"\n",
"}",
"\n\n",
"_",
",",
"err",
"=",
"<mask>",
".",
"file",
".",
"WriteString",
"(",
"gs",
".",
"String",
"(",
")",
")",
"\n",
"return",
"\n",
"}"
] |
2,916 | all-2917 | [
"RecordScreenAsGIF",
"is",
"deprecated",
"as",
"of",
"version",
"1",
".",
"6",
".",
"0",
"-",
"alpha",
".",
"RecordScreenAsGIF",
"returns",
"updating",
"function",
"with",
"recording",
"the",
"screen",
"as",
"an",
"animation",
"GIF",
"image",
".",
"This",
"encodes",
"each",
"screen",
"at",
"each",
"frame",
"and",
"may",
"slows",
"the",
"application",
".",
"Here",
"is",
"the",
"example",
"to",
"record",
"initial",
"120",
"frames",
"of",
"your",
"game",
":",
"func",
"update",
"(",
"screen",
"*",
"ebiten",
".",
"Image",
")",
"error",
"{",
"//",
"...",
"}",
"func",
"main",
"()",
"{",
"out",
"err",
":",
"=",
"os",
".",
"Create",
"(",
"output",
".",
"gif",
")",
"if",
"err",
"!",
"=",
"nil",
"{",
"log",
".",
"Fatal",
"(",
"err",
")",
"}",
"defer",
"out",
".",
"Close",
"()",
"update",
":",
"=",
"RecordScreenAsGIF",
"(",
"update",
"out",
"120",
")",
"if",
"err",
":",
"=",
"ebiten",
".",
"Run",
"(",
"update",
"320",
"240",
"2",
"Your",
"game",
"s",
"title",
")",
";",
"err",
"!",
"=",
"nil",
"{",
"log",
".",
"Fatal",
"(",
"err",
")",
"}",
"}"
] | [
"func",
"RecordScreenAsGIF",
"(",
"update",
"func",
"(",
"*",
"ebiten",
".",
"Image",
")",
"error",
",",
"<mask>",
"io",
".",
"Writer",
",",
"frameNum",
"int",
")",
"func",
"(",
"*",
"ebiten",
".",
"Image",
")",
"error",
"{",
"r",
":=",
"&",
"recorder",
"{",
"inner",
":",
"update",
",",
"writer",
":",
"out",
",",
"frameNum",
":",
"frameNum",
",",
"skips",
":",
"10",
",",
"}",
"\n",
"return",
"r",
".",
"update",
"\n",
"}"
] |
2,917 | all-2918 | [
"MatchAllElements",
"succeeds",
"if",
"every",
"element",
"of",
"a",
"slice",
"matches",
"the",
"element",
"matcher",
"it",
"maps",
"to",
"through",
"the",
"id",
"function",
"and",
"every",
"element",
"matcher",
"is",
"matched",
".",
"idFn",
":",
"=",
"func",
"(",
"element",
"interface",
"{}",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"%v",
"element",
")",
"}",
"Expect",
"(",
"[]",
"string",
"{",
"a",
"b",
"}",
")",
".",
"To",
"(",
"MatchAllElements",
"(",
"idFn",
"Elements",
"{",
"a",
":",
"Equal",
"(",
"a",
")",
"b",
":",
"Equal",
"(",
"b",
")",
"}",
"))"
] | [
"func",
"MatchAllElements",
"(",
"identifier",
"Identifier",
",",
"elements",
"Elements",
")",
"<mask>",
".",
"GomegaMatcher",
"{",
"return",
"&",
"ElementsMatcher",
"{",
"Identifier",
":",
"identifier",
",",
"Elements",
":",
"elements",
",",
"}",
"\n",
"}"
] |
2,918 | all-2919 | [
"merge",
"merges",
"two",
"similar",
"Signature",
"zapping",
"out",
"differences",
"."
] | [
"func",
"(",
"s",
"*",
"Signature",
")",
"merge",
"(",
"r",
"*",
"Signature",
")",
"*",
"Signature",
"{",
"<mask>",
":=",
"s",
".",
"SleepMin",
"\n",
"if",
"r",
".",
"SleepMin",
"<",
"min",
"{",
"min",
"=",
"r",
".",
"SleepMin",
"\n",
"}",
"\n",
"max",
":=",
"s",
".",
"SleepMax",
"\n",
"if",
"r",
".",
"SleepMax",
">",
"max",
"{",
"max",
"=",
"r",
".",
"SleepMax",
"\n",
"}",
"\n",
"return",
"&",
"Signature",
"{",
"State",
":",
"s",
".",
"State",
",",
"// Drop right side.",
"CreatedBy",
":",
"s",
".",
"CreatedBy",
",",
"// Drop right side.",
"SleepMin",
":",
"min",
",",
"SleepMax",
":",
"max",
",",
"Stack",
":",
"*",
"s",
".",
"Stack",
".",
"merge",
"(",
"&",
"r",
".",
"Stack",
")",
",",
"Locked",
":",
"s",
".",
"Locked",
"||",
"r",
".",
"Locked",
",",
"// TODO(maruel): This is weirdo.",
"}",
"\n",
"}"
] |
2,919 | all-2920 | [
"setContainerChangeSent",
"sets",
"the",
"event",
"s",
"container",
"change",
"object",
"as",
"sent"
] | [
"func",
"setContainerChangeSent",
"(",
"event",
"*",
"sendableEvent",
")",
"{",
"containerChangeStatus",
":=",
"event",
".",
"containerChange",
".",
"Status",
"\n",
"container",
":=",
"event",
".",
"containerChange",
".",
"<mask>",
"\n",
"if",
"container",
"!=",
"nil",
"&&",
"container",
".",
"GetSentStatus",
"(",
")",
"<",
"containerChangeStatus",
"{",
"container",
".",
"SetSentStatus",
"(",
"containerChangeStatus",
")",
"\n",
"}",
"\n",
"}"
] |
2,920 | all-2921 | [
"getPipelineInfo",
"gets",
"the",
"PipelineInfo",
"proto",
"describing",
"the",
"pipeline",
"that",
"this",
"worker",
"is",
"part",
"of",
".",
"getPipelineInfo",
"has",
"the",
"side",
"effect",
"of",
"adding",
"auth",
"to",
"the",
"passed",
"pachClient",
"which",
"is",
"necessary",
"to",
"get",
"the",
"PipelineInfo",
"from",
"pfs",
"."
] | [
"func",
"getPipelineInfo",
"(",
"pachClient",
"*",
"client",
".",
"APIClient",
",",
"env",
"*",
"serviceenv",
".",
"ServiceEnv",
")",
"(",
"*",
"pps",
".",
"PipelineInfo",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"<mask>",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"30",
"*",
"time",
".",
"Second",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"resp",
",",
"err",
":=",
"env",
".",
"GetEtcdClient",
"(",
")",
".",
"Get",
"(",
"ctx",
",",
"path",
".",
"Join",
"(",
"env",
".",
"PPSEtcdPrefix",
",",
"\"",
"\"",
",",
"env",
".",
"PPSPipelineName",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"resp",
".",
"Kvs",
")",
"!=",
"1",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"env",
".",
"PPSPipelineName",
",",
"len",
"(",
"resp",
".",
"Kvs",
")",
",",
"resp",
")",
"\n",
"}",
"\n",
"var",
"pipelinePtr",
"pps",
".",
"EtcdPipelineInfo",
"\n",
"if",
"err",
":=",
"pipelinePtr",
".",
"Unmarshal",
"(",
"resp",
".",
"Kvs",
"[",
"0",
"]",
".",
"Value",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"pachClient",
".",
"SetAuthToken",
"(",
"pipelinePtr",
".",
"AuthToken",
")",
"\n",
"// Notice we use the SpecCommitID from our env, not from etcd. This is",
"// because the value in etcd might get updated while the worker pod is",
"// being created and we don't want to run the transform of one version of",
"// the pipeline in the image of a different verison.",
"pipelinePtr",
".",
"SpecCommit",
".",
"ID",
"=",
"env",
".",
"PPSSpecCommitID",
"\n",
"return",
"ppsutil",
".",
"GetPipelineInfo",
"(",
"pachClient",
",",
"&",
"pipelinePtr",
",",
"true",
")",
"\n",
"}"
] |
2,921 | all-2922 | [
"StoragePoolCreate",
"creates",
"new",
"storage",
"pool",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"StoragePoolCreate",
"(",
"poolName",
"string",
",",
"poolDescription",
"string",
",",
"poolDriver",
"string",
",",
"poolConfig",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"int64",
",",
"error",
")",
"{",
"var",
"id",
"int64",
"\n",
"err",
":=",
"c",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"ClusterTx",
")",
"error",
"{",
"result",
",",
"err",
":=",
"tx",
".",
"tx",
".",
"Exec",
"(",
"\"",
"\"",
",",
"poolName",
",",
"poolDescription",
",",
"poolDriver",
",",
"storagePoolCreated",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"id",
",",
"err",
"=",
"result",
".",
"LastInsertId",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Insert a node-specific entry pointing to ourselves.",
"columns",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"\n",
"<mask>",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"id",
",",
"c",
".",
"nodeID",
"}",
"\n",
"_",
",",
"err",
"=",
"query",
".",
"UpsertObject",
"(",
"tx",
".",
"tx",
",",
"\"",
"\"",
",",
"columns",
",",
"values",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"storagePoolConfigAdd",
"(",
"tx",
".",
"tx",
",",
"id",
",",
"c",
".",
"nodeID",
",",
"poolConfig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"id",
"=",
"-",
"1",
"\n",
"}",
"\n\n",
"return",
"id",
",",
"nil",
"\n",
"}"
] |
2,922 | all-2923 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"ProfileNode",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoProfiler16",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
2,923 | all-2924 | [
"MustRetHash",
"retrieves",
"the",
"RetHash",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"Memo",
")",
"MustRetHash",
"(",
")",
"Hash",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetRetHash",
"(",
")",
"\n\n",
"if",
"!",
"<mask>",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
2,924 | all-2925 | [
"determine",
"if",
"a",
"name",
"corresponds",
"to",
"a",
"query",
"object"
] | [
"func",
"IsQuery",
"(",
"<mask>",
"uint32",
")",
"bool",
"{",
"ret",
",",
"_",
",",
"_",
":=",
"syscall",
".",
"Syscall",
"(",
"gpIsQuery",
",",
"1",
",",
"uintptr",
"(",
"id",
")",
",",
"0",
",",
"0",
")",
"\n",
"return",
"ret",
"!=",
"0",
"\n",
"}"
] |
2,925 | all-2926 | [
"NewRemoteMysqlDumpWithPath",
"-"
] | [
"func",
"NewRemoteMysqlDumpWithPath",
"(",
"username",
",",
"<mask>",
"string",
",",
"sshCfg",
"command",
".",
"SshConfig",
",",
"remoteArchivePath",
"string",
")",
"(",
"*",
"MysqlDump",
",",
"error",
")",
"{",
"lo",
".",
"G",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"remoteExecuter",
",",
"err",
":=",
"command",
".",
"NewRemoteExecutor",
"(",
"sshCfg",
")",
"\n\n",
"remoteOps",
":=",
"osutils",
".",
"NewRemoteOperations",
"(",
"sshCfg",
")",
"\n",
"if",
"len",
"(",
"remoteArchivePath",
")",
">",
"0",
"{",
"remoteOps",
".",
"SetPath",
"(",
"remoteArchivePath",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"MysqlDump",
"{",
"IP",
":",
"\"",
"\"",
",",
"Username",
":",
"username",
",",
"Password",
":",
"password",
",",
"Caller",
":",
"remoteExecuter",
",",
"RemoteOps",
":",
"remoteOps",
",",
"}",
",",
"err",
"\n",
"}"
] |
2,926 | all-2927 | [
"ContainerMetadataHandler",
"returns",
"the",
"handler",
"method",
"for",
"handling",
"container",
"metadata",
"requests",
"."
] | [
"func",
"ContainerMetadataHandler",
"(",
"state",
"dockerstate",
".",
"TaskEngineState",
")",
"func",
"(",
"<mask>",
".",
"ResponseWriter",
",",
"*",
"http",
".",
"Request",
")",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"containerID",
",",
"err",
":=",
"getContainerIDByRequest",
"(",
"r",
",",
"state",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"responseJSON",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
")",
"\n",
"utils",
".",
"WriteJSONToResponse",
"(",
"w",
",",
"http",
".",
"StatusBadRequest",
",",
"responseJSON",
",",
"utils",
".",
"RequestTypeContainerMetadata",
")",
"\n",
"return",
"\n",
"}",
"\n",
"containerResponse",
",",
"err",
":=",
"GetContainerResponse",
"(",
"containerID",
",",
"state",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errResponseJSON",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"utils",
".",
"WriteJSONToResponse",
"(",
"w",
",",
"http",
".",
"StatusBadRequest",
",",
"errResponseJSON",
",",
"utils",
".",
"RequestTypeContainerMetadata",
")",
"\n",
"return",
"\n",
"}",
"\n",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"containerID",
")",
"\n\n",
"responseJSON",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"containerResponse",
")",
"\n",
"utils",
".",
"WriteJSONToResponse",
"(",
"w",
",",
"http",
".",
"StatusOK",
",",
"responseJSON",
",",
"utils",
".",
"RequestTypeContainerMetadata",
")",
"\n",
"}",
"\n",
"}"
] |
2,927 | all-2928 | [
"GetTitle",
"returns",
"the",
"Title",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"g",
"*",
"<mask>",
")",
"GetTitle",
"(",
")",
"string",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"Title",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"Title",
"\n",
"}"
] |
2,928 | all-2929 | [
"GetIndex",
"returns",
"the",
"Index",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"w",
"*",
"WidgetApmOrLogQuery",
")",
"GetIndex",
"(",
")",
"string",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"Index",
"\n",
"}"
] |
2,929 | all-2930 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"ShadowRootType",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"<mask>",
")",
"{",
"out",
".",
"String",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
] |
2,930 | all-2931 | [
"CssProviderGetDefault",
"is",
"a",
"wrapper",
"around",
"gtk_css_provider_get_default",
"()",
"."
] | [
"func",
"CssProviderGetDefault",
"(",
")",
"(",
"*",
"CssProvider",
",",
"<mask>",
")",
"{",
"c",
":=",
"C",
".",
"gtk_css_provider_get_default",
"(",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapCssProvider",
"(",
"obj",
")",
",",
"nil",
"\n",
"}"
] |
2,931 | all-2932 | [
"NewLedgerUpgrade",
"creates",
"a",
"new",
"LedgerUpgrade",
"."
] | [
"func",
"NewLedgerUpgrade",
"(",
"aType",
"LedgerUpgradeType",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"LedgerUpgrade",
",",
"err",
"error",
")",
"{",
"result",
".",
"Type",
"=",
"aType",
"\n",
"switch",
"LedgerUpgradeType",
"(",
"aType",
")",
"{",
"case",
"LedgerUpgradeTypeLedgerUpgradeVersion",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"Uint32",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"NewLedgerVersion",
"=",
"&",
"tv",
"\n",
"case",
"LedgerUpgradeTypeLedgerUpgradeBaseFee",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"Uint32",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"NewBaseFee",
"=",
"&",
"tv",
"\n",
"case",
"LedgerUpgradeTypeLedgerUpgradeMaxTxSetSize",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"Uint32",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"<mask>",
".",
"NewMaxTxSetSize",
"=",
"&",
"tv",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
2,932 | all-2933 | [
"New",
"..."
] | [
"func",
"New",
"(",
"opts",
"Opts",
")",
"(",
"csr",
"*",
"Cluster",
",",
"err",
"error",
")",
"{",
"var",
"(",
"nodes",
"[",
"]",
"string",
"\n",
"exists",
"bool",
"\n",
")",
"\n",
"for",
"_",
",",
"seed",
":=",
"range",
"opts",
".",
"Seeds",
"{",
"if",
"seed",
"==",
"opts",
".",
"Listen",
"{",
"exists",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"!",
"exists",
"{",
"nodes",
"=",
"append",
"(",
"nodes",
",",
"opts",
".",
"Listen",
")",
"\n",
"}",
"\n\n",
"nodes",
"=",
"append",
"(",
"nodes",
",",
"opts",
".",
"Seeds",
"...",
")",
"\n",
"sort",
".",
"Strings",
"(",
"nodes",
")",
"\n\n",
"csr",
"=",
"&",
"Cluster",
"{",
"nodes",
":",
"make",
"(",
"[",
"]",
"*",
"Node",
",",
"0",
")",
",",
"listen",
":",
"opts",
".",
"Listen",
",",
"logger",
":",
"opts",
".",
"Logger",
",",
"}",
"\n\n",
"for",
"i",
",",
"addr",
":=",
"<mask>",
"nodes",
"{",
"if",
"addr",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n",
"csr",
".",
"buckets",
"++",
"\n",
"csr",
".",
"nodes",
"=",
"append",
"(",
"csr",
".",
"nodes",
",",
"&",
"Node",
"{",
"ID",
":",
"i",
",",
"Addr",
":",
"addr",
",",
"}",
")",
"\n",
"}",
"\n",
"return",
"csr",
",",
"nil",
"\n",
"}"
] |
2,933 | all-2934 | [
"GetToOk",
"returns",
"a",
"tuple",
"with",
"the",
"To",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TimeRange",
")",
"GetToOk",
"(",
")",
"(",
"json",
".",
"Number",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"To",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"To",
",",
"<mask>",
"\n",
"}"
] |
2,934 | all-2935 | [
"GetName",
"returns",
"the",
"Name",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsLocation",
")",
"GetName",
"(",
")",
"string",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Name",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"<mask>",
"\n",
"}"
] |
2,935 | all-2936 | [
"Update",
"updates",
"the",
"configmap",
"with",
"the",
"data",
"from",
"the",
"identified",
"files"
] | [
"func",
"Update",
"(",
"fg",
"FileGetter",
",",
"kc",
"corev1",
".",
"ConfigMapInterface",
",",
"name",
",",
"namespace",
"string",
",",
"updates",
"[",
"]",
"ConfigMapUpdate",
",",
"logger",
"*",
"logrus",
".",
"Entry",
")",
"error",
"{",
"cm",
",",
"getErr",
":=",
"kc",
".",
"Get",
"(",
"name",
",",
"metav1",
".",
"GetOptions",
"{",
"}",
")",
"\n",
"isNotFound",
":=",
"errors",
".",
"IsNotFound",
"(",
"getErr",
")",
"\n",
"if",
"getErr",
"!=",
"nil",
"&&",
"!",
"isNotFound",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"getErr",
")",
"\n",
"}",
"\n\n",
"if",
"cm",
"==",
"nil",
"||",
"isNotFound",
"{",
"cm",
"=",
"&",
"coreapi",
".",
"ConfigMap",
"{",
"ObjectMeta",
":",
"metav1",
".",
"ObjectMeta",
"{",
"Name",
":",
"name",
",",
"Namespace",
":",
"namespace",
",",
"}",
",",
"}",
"\n",
"}",
"\n",
"if",
"cm",
".",
"Data",
"==",
"nil",
"{",
"cm",
".",
"Data",
"=",
"map",
"[",
"string",
"]",
"string",
"{",
"}",
"\n",
"}",
"\n",
"if",
"cm",
".",
"BinaryData",
"==",
"nil",
"{",
"cm",
".",
"BinaryData",
"=",
"map",
"[",
"string",
"]",
"[",
"]",
"byte",
"{",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"upd",
":=",
"range",
"updates",
"{",
"if",
"upd",
".",
"Filename",
"==",
"\"",
"\"",
"{",
"logger",
".",
"WithField",
"(",
"\"",
"\"",
",",
"upd",
".",
"Key",
")",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"delete",
"(",
"cm",
".",
"Data",
",",
"upd",
".",
"Key",
")",
"\n",
"delete",
"(",
"cm",
".",
"BinaryData",
",",
"upd",
".",
"Key",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"content",
",",
"err",
":=",
"fg",
".",
"GetFile",
"(",
"upd",
".",
"Filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"logger",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",
"\"",
"\"",
":",
"upd",
".",
"Key",
",",
"\"",
"\"",
":",
"upd",
".",
"Filename",
"}",
")",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"value",
":=",
"content",
"\n",
"if",
"upd",
".",
"GZIP",
"{",
"buff",
":=",
"<mask>",
".",
"NewBuffer",
"(",
"[",
"]",
"byte",
"{",
"}",
")",
"\n",
"// TODO: this error is wildly unlikely for anything that",
"// would actually fit in a configmap, we could just as well return",
"// the error instead of falling back to the raw content",
"z",
":=",
"gzip",
".",
"NewWriter",
"(",
"buff",
")",
"\n",
"if",
"_",
",",
"err",
":=",
"z",
".",
"Write",
"(",
"content",
")",
";",
"err",
"!=",
"nil",
"{",
"logger",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"if",
"err",
":=",
"z",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"logger",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"value",
"=",
"buff",
".",
"Bytes",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"utf8",
".",
"ValidString",
"(",
"string",
"(",
"value",
")",
")",
"{",
"delete",
"(",
"cm",
".",
"BinaryData",
",",
"upd",
".",
"Key",
")",
"\n",
"cm",
".",
"Data",
"[",
"upd",
".",
"Key",
"]",
"=",
"string",
"(",
"value",
")",
"\n",
"}",
"else",
"{",
"delete",
"(",
"cm",
".",
"Data",
",",
"upd",
".",
"Key",
")",
"\n",
"cm",
".",
"BinaryData",
"[",
"upd",
".",
"Key",
"]",
"=",
"value",
"\n",
"}",
"\n",
"}",
"\n\n",
"var",
"updateErr",
"error",
"\n",
"var",
"verb",
"string",
"\n",
"if",
"getErr",
"!=",
"nil",
"&&",
"isNotFound",
"{",
"verb",
"=",
"\"",
"\"",
"\n",
"_",
",",
"updateErr",
"=",
"kc",
".",
"Create",
"(",
"cm",
")",
"\n",
"}",
"else",
"{",
"verb",
"=",
"\"",
"\"",
"\n",
"_",
",",
"updateErr",
"=",
"kc",
".",
"Update",
"(",
"cm",
")",
"\n",
"}",
"\n",
"if",
"updateErr",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"verb",
",",
"updateErr",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,936 | all-2937 | [
"Do",
"executes",
"LayerTree",
".",
"snapshotCommandLog",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"commandLog",
"-",
"The",
"array",
"of",
"canvas",
"function",
"calls",
"."
] | [
"func",
"(",
"p",
"*",
"SnapshotCommandLogParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"commandLog",
"[",
"]",
"easyjson",
".",
"RawMessage",
",",
"err",
"error",
")",
"{",
"// execute",
"<mask>",
"res",
"SnapshotCommandLogReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSnapshotCommandLog",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"CommandLog",
",",
"nil",
"\n",
"}"
] |
2,937 | all-2938 | [
"Delete",
"implements",
"the",
"corresponding",
"method",
"in",
"the",
"Client",
"interface"
] | [
"func",
"(",
"o",
"*",
"tracingObjClient",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
")",
"error",
"{",
"span",
",",
"ctx",
":=",
"tracing",
".",
"AddSpanToAnyExisting",
"(",
"ctx",
",",
"o",
".",
"provider",
"+",
"\"",
"\"",
",",
"\"",
"\"",
",",
"name",
")",
"\n",
"defer",
"tracing",
".",
"FinishAnySpan",
"(",
"span",
")",
"\n",
"return",
"o",
".",
"<mask>",
".",
"Delete",
"(",
"ctx",
",",
"name",
")",
"\n",
"}"
] |
2,938 | all-2939 | [
"ReadResponse",
"reads",
"a",
"server",
"response",
"into",
"the",
"received",
"o",
"."
] | [
"func",
"(",
"o",
"*",
"GetAppsAppRoutesReader",
")",
"ReadResponse",
"(",
"response",
"runtime",
".",
"ClientResponse",
",",
"consumer",
"runtime",
".",
"Consumer",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"switch",
"response",
".",
"Code",
"(",
")",
"{",
"case",
"200",
":",
"<mask>",
":=",
"NewGetAppsAppRoutesOK",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n\n",
"case",
"404",
":",
"result",
":=",
"NewGetAppsAppRoutesNotFound",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n\n",
"default",
":",
"result",
":=",
"NewGetAppsAppRoutesDefault",
"(",
"response",
".",
"Code",
"(",
")",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"response",
".",
"Code",
"(",
")",
"/",
"100",
"==",
"2",
"{",
"return",
"result",
",",
"nil",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n",
"}",
"\n",
"}"
] |
2,939 | all-2940 | [
"countNewTags",
"returns",
"a",
"count",
"of",
"new",
"tags",
"which",
"do",
"not",
"exist",
"in",
"the",
"current",
"list",
"of",
"tags"
] | [
"func",
"countNewTags",
"(",
"currTags",
"[",
"]",
"string",
",",
"newTags",
"[",
"]",
"string",
")",
"int",
"{",
"if",
"len",
"(",
"newTags",
")",
"==",
"0",
"{",
"return",
"0",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"currTags",
")",
"==",
"0",
"{",
"return",
"len",
"(",
"newTags",
")",
"\n",
"}",
"\n\n",
"newTagCount",
":=",
"0",
"\n\n",
"for",
"_",
",",
"newTag",
":=",
"range",
"newTags",
"{",
"found",
":=",
"<mask>",
"\n",
"for",
"_",
",",
"currTag",
":=",
"range",
"currTags",
"{",
"if",
"newTag",
"==",
"currTag",
"{",
"found",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"!",
"found",
"{",
"newTagCount",
"++",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"newTagCount",
"\n",
"}"
] |
2,940 | all-2941 | [
"setMountPoint",
"sets",
"the",
"mountpoint",
"of",
"the",
"created",
"volume",
".",
"This",
"is",
"a",
"read",
"-",
"only",
"field",
"hence",
"making",
"this",
"a",
"private",
"function",
"."
] | [
"func",
"(",
"vol",
"*",
"VolumeResource",
")",
"setMountPoint",
"(",
"mountPoint",
"string",
")",
"{",
"vol",
".",
"<mask>",
".",
"Lock",
"(",
")",
"\n",
"defer",
"vol",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"vol",
".",
"VolumeConfig",
".",
"Mountpoint",
"=",
"mountPoint",
"\n",
"}"
] |
2,941 | all-2942 | [
"MutateTransaction",
"for",
"MemoReturn",
"sets",
"the",
"memo",
"."
] | [
"func",
"(",
"m",
"MemoReturn",
")",
"MutateTransaction",
"(",
"o",
"*",
"TransactionBuilder",
")",
"(",
"err",
"error",
")",
"{",
"o",
".",
"TX",
".",
"Memo",
",",
"err",
"=",
"xdr",
".",
"NewMemo",
"(",
"xdr",
".",
"MemoTypeMemoReturn",
",",
"m",
".",
"<mask>",
")",
"\n",
"return",
"\n",
"}"
] |
2,942 | all-2943 | [
"MetadataFromOutgoingContext",
"gets",
"the",
"metadata",
"from",
"the",
"given",
"context"
] | [
"func",
"MetadataFromOutgoingContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"metadata",
".",
"MD",
"{",
"md",
",",
"_",
":=",
"metadata",
".",
"FromOutgoingContext",
"(",
"ctx",
")",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
2,943 | all-2944 | [
"Clear",
"deletes",
"all",
"ListBox",
"items"
] | [
"func",
"(",
"l",
"*",
"ListBox",
")",
"Clear",
"(",
")",
"{",
"l",
".",
"<mask>",
"=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n",
"l",
".",
"currSelection",
"=",
"-",
"1",
"\n",
"l",
".",
"topLine",
"=",
"0",
"\n",
"}"
] |
2,944 | all-2945 | [
"HasHandle",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"c",
"*",
"Creator",
")",
"HasHandle",
"(",
")",
"bool",
"{",
"if",
"c",
"!=",
"nil",
"&&",
"c",
".",
"Handle",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
2,945 | all-2946 | [
"deletes",
"the",
"contents",
"of",
"a",
"directory"
] | [
"func",
"removeDirContents",
"(",
"path",
"string",
")",
"error",
"{",
"files",
",",
"err",
":=",
"ioutil",
".",
"ReadDir",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"file",
":=",
"range",
"files",
"{",
"if",
"err",
":=",
"os",
".",
"RemoveAll",
"(",
"filepath",
".",
"Join",
"(",
"<mask>",
",",
"file",
".",
"Name",
"(",
")",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,946 | all-2947 | [
"Merge",
"will",
"attempt",
"to",
"merge",
"the",
"data",
"from",
"src",
"into",
"dst",
".",
"They",
"shoud",
"be",
"either",
"both",
"maps",
"or",
"both",
"structs",
".",
"The",
"structs",
"do",
"not",
"need",
"to",
"have",
"the",
"same",
"structure",
"but",
"any",
"field",
"name",
"that",
"exists",
"in",
"both",
"structs",
"will",
"must",
"be",
"the",
"same",
"type",
"."
] | [
"func",
"Merge",
"(",
"dst",
",",
"src",
"<mask>",
"{",
"}",
")",
"{",
"m",
":=",
"NewMerger",
"(",
")",
"\n",
"m",
".",
"mergeStructs",
"(",
"reflect",
".",
"ValueOf",
"(",
"dst",
")",
",",
"reflect",
".",
"ValueOf",
"(",
"src",
")",
")",
"\n",
"}"
] |
2,947 | all-2948 | [
"splitHostVirtualSwitchID",
"splits",
"a",
"vsphere_host_virtual_switch",
"resource",
"ID",
"into",
"its",
"counterparts",
":",
"the",
"prefix",
"the",
"HostSystem",
"ID",
"and",
"the",
"virtual",
"switch",
"name",
"."
] | [
"func",
"splitHostVirtualSwitchID",
"(",
"raw",
"string",
")",
"(",
"string",
",",
"string",
",",
"error",
")",
"{",
"s",
":=",
"strings",
".",
"SplitN",
"(",
"raw",
",",
"\"",
"\"",
",",
"3",
")",
"\n",
"if",
"len",
"(",
"s",
")",
"!=",
"3",
"||",
"s",
"[",
"0",
"]",
"!=",
"hostVirtualSwitchIDPrefix",
"||",
"s",
"[",
"1",
"]",
"==",
"\"",
"\"",
"||",
"s",
"[",
"2",
"]",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"<mask>",
")",
"\n",
"}",
"\n",
"return",
"s",
"[",
"1",
"]",
",",
"s",
"[",
"2",
"]",
",",
"nil",
"\n",
"}"
] |
2,948 | all-2949 | [
"Exitf",
"takes",
"a",
"status",
"plus",
"a",
"format",
"string",
"and",
"a",
"list",
"of",
"parameters",
"to",
"pass",
"to",
"Sprintf",
".",
"It",
"then",
"immediately",
"outputs",
"and",
"exits",
"."
] | [
"func",
"(",
"c",
"*",
"Check",
")",
"Exitf",
"(",
"status",
"Status",
",",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"info",
":=",
"fmt",
".",
"Sprintf",
"(",
"<mask>",
",",
"v",
"...",
")",
"\n",
"c",
".",
"AddResult",
"(",
"status",
",",
"info",
")",
"\n",
"c",
".",
"Finish",
"(",
")",
"\n",
"}"
] |
2,949 | all-2950 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SetScrollbarsHiddenParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation4",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
2,950 | all-2951 | [
"ReorderChild",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_notebook_reorder_child",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Notebook",
")",
"ReorderChild",
"(",
"<mask>",
"IWidget",
",",
"position",
"int",
")",
"{",
"C",
".",
"gtk_notebook_reorder_child",
"(",
"v",
".",
"native",
"(",
")",
",",
"child",
".",
"toWidget",
"(",
")",
",",
"C",
".",
"gint",
"(",
"position",
")",
")",
"\n",
"}"
] |
2,951 | all-2952 | [
"Validate",
"validates",
"the",
"Agent",
"options",
"."
] | [
"func",
"(",
"o",
"AgentOptions",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"o",
".",
"Mbus",
"==",
"\"",
"\"",
"{",
"return",
"bosherr",
".",
"<mask>",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"err",
":=",
"o",
".",
"Blobstore",
".",
"Validate",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"bosherr",
".",
"WrapError",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
2,952 | all-2953 | [
"same",
"with",
"Trace",
"()"
] | [
"func",
"(",
"f",
"*",
"FileLogger",
")",
"T",
"(",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"f",
".",
"Trace",
"(",
"<mask>",
",",
"v",
"...",
")",
"\n",
"}"
] |
2,953 | all-2954 | [
"ParseBranch",
"takes",
"an",
"argument",
"of",
"the",
"form",
"repo",
"["
] | [
"func",
"ParseBranch",
"(",
"arg",
"string",
")",
"(",
"*",
"pfs",
".",
"Branch",
",",
"error",
")",
"{",
"commit",
",",
"err",
":=",
"ParseCommit",
"(",
"arg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"pfs",
".",
"Branch",
"{",
"Repo",
":",
"commit",
".",
"Repo",
",",
"Name",
":",
"<mask>",
".",
"ID",
"}",
",",
"nil",
"\n",
"}"
] |
2,954 | all-2955 | [
"getAllSSMSecretRequirements",
"stores",
"all",
"secrets",
"in",
"a",
"map",
"whose",
"key",
"is",
"region",
"and",
"value",
"is",
"all",
"secrets",
"in",
"that",
"region"
] | [
"func",
"(",
"task",
"*",
"Task",
")",
"getAllSSMSecretRequirements",
"(",
")",
"map",
"[",
"string",
"]",
"[",
"]",
"apicontainer",
".",
"Secret",
"{",
"reqs",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"apicontainer",
".",
"Secret",
")",
"\n\n",
"for",
"_",
",",
"container",
":=",
"range",
"task",
".",
"Containers",
"{",
"for",
"_",
",",
"secret",
":=",
"range",
"container",
".",
"Secrets",
"{",
"if",
"secret",
".",
"Provider",
"==",
"apicontainer",
".",
"SecretProviderSSM",
"{",
"if",
"_",
",",
"ok",
":=",
"reqs",
"[",
"secret",
".",
"Region",
"]",
";",
"!",
"<mask>",
"{",
"reqs",
"[",
"secret",
".",
"Region",
"]",
"=",
"[",
"]",
"apicontainer",
".",
"Secret",
"{",
"}",
"\n",
"}",
"\n\n",
"reqs",
"[",
"secret",
".",
"Region",
"]",
"=",
"append",
"(",
"reqs",
"[",
"secret",
".",
"Region",
"]",
",",
"secret",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"reqs",
"\n",
"}"
] |
2,955 | all-2956 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"DeleteDatabaseParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoIndexeddb16",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
2,956 | all-2957 | [
"Calculates",
"the",
"per",
"-",
"element",
"sum",
"of",
"an",
"array",
"and",
"a",
"scalar",
"with",
"a",
"mask",
".",
"dst",
"=",
"src",
"+",
"value"
] | [
"func",
"AddScalarWithMask",
"(",
"src",
"*",
"IplImage",
",",
"<mask>",
"Scalar",
",",
"dst",
",",
"mask",
"*",
"IplImage",
")",
"{",
"C",
".",
"cvAddS",
"(",
"unsafe",
".",
"Pointer",
"(",
"src",
")",
",",
"(",
"C",
".",
"CvScalar",
")",
"(",
"value",
")",
",",
"unsafe",
".",
"Pointer",
"(",
"dst",
")",
",",
"unsafe",
".",
"Pointer",
"(",
"mask",
")",
",",
")",
"\n",
"}"
] |
2,957 | all-2958 | [
"generates",
"round",
"robin",
"indexes",
"for",
"a",
"slice",
"of",
"length",
"max",
"starting",
"from",
"index",
"start"
] | [
"func",
"roundIndex",
"(",
"start",
",",
"max",
"int",
")",
"[",
"]",
"int",
"{",
"if",
"start",
"<",
"0",
"{",
"start",
"=",
"0",
"\n",
"}",
"\n",
"<mask>",
":=",
"make",
"(",
"[",
"]",
"int",
",",
"max",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"max",
";",
"i",
"++",
"{",
"if",
"start",
"+",
"i",
"<",
"max",
"{",
"result",
"[",
"i",
"]",
"=",
"start",
"+",
"i",
"\n",
"}",
"else",
"{",
"result",
"[",
"i",
"]",
"=",
"int",
"(",
"math",
".",
"Abs",
"(",
"float64",
"(",
"max",
"-",
"(",
"start",
"+",
"i",
")",
")",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"result",
"\n",
"}"
] |
2,958 | all-2959 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetRuleSelectorReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss15",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
2,959 | all-2960 | [
"imageCreateInPool",
"()",
"creates",
"a",
"new",
"storage",
"volume",
"in",
"a",
"given",
"storage",
"pool",
"for",
"the",
"image",
".",
"No",
"entry",
"in",
"the",
"images",
"database",
"will",
"be",
"created",
".",
"This",
"implies",
"that",
"imageCreateinPool",
"()",
"should",
"only",
"be",
"called",
"when",
"an",
"image",
"already",
"exists",
"in",
"the",
"database",
"and",
"hence",
"has",
"already",
"a",
"storage",
"volume",
"in",
"at",
"least",
"one",
"storage",
"pool",
"."
] | [
"func",
"imageCreateInPool",
"(",
"d",
"*",
"Daemon",
",",
"info",
"*",
"api",
".",
"<mask>",
",",
"storagePool",
"string",
")",
"error",
"{",
"if",
"storagePool",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Initialize a new storage interface.",
"s",
",",
"err",
":=",
"storagePoolInit",
"(",
"d",
".",
"State",
"(",
")",
",",
"storagePool",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Create the storage volume for the image on the requested storage",
"// pool.",
"err",
"=",
"s",
".",
"ImageCreate",
"(",
"info",
".",
"Fingerprint",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
2,960 | all-2961 | [
"SetPorts",
"sets",
"the",
"ports",
"that",
"wil",
"be",
"used"
] | [
"func",
"(",
"s",
"Scan",
")",
"SetPorts",
"(",
"<mask>",
"...",
"uint16",
")",
"Scan",
"{",
"s",
".",
"configPorts",
"=",
"ports",
"\n",
"return",
"s",
"\n",
"}"
] |
2,961 | all-2962 | [
"NewMatrix",
"creates",
"a",
"new",
"identiy",
"matrix"
] | [
"func",
"NewMatrix",
"(",
"<mask>",
",",
"yx",
",",
"xy",
",",
"yy",
",",
"x0",
",",
"y0",
"float64",
")",
"*",
"Matrix",
"{",
"return",
"&",
"Matrix",
"{",
"Xx",
":",
"xx",
",",
"Yx",
":",
"yx",
",",
"Xy",
":",
"xy",
",",
"Yy",
":",
"yy",
",",
"X0",
":",
"x0",
",",
"Y0",
":",
"y0",
",",
"}",
"\n",
"}"
] |
2,962 | all-2963 | [
"HasExtraCol",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinitionRequest",
")",
"HasExtraCol",
"(",
")",
"bool",
"{",
"if",
"g",
"!=",
"nil",
"&&",
"g",
".",
"ExtraCol",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
2,963 | all-2964 | [
"String",
"returns",
"a",
"suitable",
"string",
"representation",
"for",
"the",
"status",
"code"
] | [
"func",
"(",
"o",
"StatusCode",
")",
"String",
"(",
")",
"string",
"{",
"return",
"map",
"[",
"StatusCode",
"]",
"string",
"{",
"OperationCreated",
":",
"\"",
"\"",
",",
"Started",
":",
"\"",
"\"",
",",
"Stopped",
":",
"\"",
"\"",
",",
"Running",
":",
"\"",
"\"",
",",
"Cancelling",
":",
"\"",
"\"",
",",
"Pending",
":",
"\"",
"\"",
",",
"Success",
":",
"\"",
"\"",
",",
"Failure",
":",
"\"",
"\"",
",",
"Cancelled",
":",
"\"",
"\"",
",",
"Starting",
":",
"\"",
"\"",
",",
"Stopping",
":",
"\"",
"\"",
",",
"Aborting",
":",
"\"",
"\"",
",",
"Freezing",
":",
"\"",
"\"",
",",
"Frozen",
":",
"\"",
"\"",
",",
"Thawed",
":",
"\"",
"\"",
",",
"<mask>",
":",
"\"",
"\"",
",",
"}",
"[",
"o",
"]",
"\n",
"}"
] |
2,964 | all-2965 | [
"ArmForSwitch",
"returns",
"which",
"field",
"name",
"should",
"be",
"used",
"for",
"storing",
"the",
"value",
"for",
"an",
"instance",
"of",
"ScpStatementPledges"
] | [
"func",
"(",
"u",
"ScpStatementPledges",
")",
"ArmForSwitch",
"(",
"sw",
"int32",
")",
"(",
"string",
",",
"bool",
")",
"{",
"<mask>",
"ScpStatementType",
"(",
"sw",
")",
"{",
"case",
"ScpStatementTypeScpStPrepare",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"case",
"ScpStatementTypeScpStConfirm",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"case",
"ScpStatementTypeScpStExternalize",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"case",
"ScpStatementTypeScpStNominate",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}"
] |
2,965 | all-2966 | [
"unlockPath",
"releases",
"the",
"pathLock",
"for",
"path",
"."
] | [
"func",
"unlockPath",
"(",
"path",
"string",
")",
"{",
"pathLocksMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"pathLocksMutex",
".",
"Unlock",
"(",
")",
"\n",
"pl",
",",
"<mask>",
":=",
"pathLocks",
"[",
"path",
"]",
"\n",
"if",
"!",
"ok",
"{",
"// Should this return an error instead? BlobInfoCache ultimately ignores errors…",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"path",
")",
")",
"\n",
"}",
"\n",
"pl",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"pl",
".",
"refCount",
"--",
"\n",
"if",
"pl",
".",
"refCount",
"==",
"0",
"{",
"delete",
"(",
"pathLocks",
",",
"path",
")",
"\n",
"}",
"\n",
"}"
] |
2,966 | all-2967 | [
"Get",
"a",
"config"
] | [
"func",
"Get",
"(",
"source",
"interface",
"{",
"}",
",",
"environment",
"string",
",",
"configEnv",
"Environment",
")",
"(",
"conf",
"interface",
"{",
"}",
",",
"err",
"error",
")",
"{",
"if",
"filename",
",",
"ok",
":=",
"source",
".",
"(",
"string",
")",
";",
"ok",
"{",
"<mask>",
",",
"err",
"=",
"ioutil",
".",
"ReadFile",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n\n",
"err",
"=",
"yaml",
".",
"Unmarshal",
"(",
"source",
".",
"(",
"[",
"]",
"byte",
")",
",",
"configEnv",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"conf",
"=",
"configEnv",
".",
"GetEnvironment",
"(",
"environment",
")",
"\n",
"if",
"conf",
"==",
"nil",
"{",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
2,967 | all-2968 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"AttachToBrowserTargetParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoTarget31",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
2,968 | all-2969 | [
"NewGoogleProvider",
"initializes",
"a",
"new",
"Google",
"CloudDNS",
"based",
"Provider",
"."
] | [
"func",
"NewGoogleProvider",
"(",
"project",
"string",
",",
"domainFilter",
"DomainFilter",
",",
"zoneIDFilter",
"ZoneIDFilter",
",",
"dryRun",
"bool",
")",
"(",
"*",
"GoogleProvider",
",",
"error",
")",
"{",
"gcloud",
",",
"err",
":=",
"google",
".",
"DefaultClient",
"(",
"<mask>",
".",
"TODO",
"(",
")",
",",
"dns",
".",
"NdevClouddnsReadwriteScope",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"gcloud",
"=",
"instrumented_http",
".",
"NewClient",
"(",
"gcloud",
",",
"&",
"instrumented_http",
".",
"Callbacks",
"{",
"PathProcessor",
":",
"func",
"(",
"path",
"string",
")",
"string",
"{",
"parts",
":=",
"strings",
".",
"Split",
"(",
"path",
",",
"\"",
"\"",
")",
"\n",
"return",
"parts",
"[",
"len",
"(",
"parts",
")",
"-",
"1",
"]",
"\n",
"}",
",",
"}",
")",
"\n\n",
"dnsClient",
",",
"err",
":=",
"dns",
".",
"New",
"(",
"gcloud",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"project",
"==",
"\"",
"\"",
"{",
"mProject",
",",
"mErr",
":=",
"metadata",
".",
"ProjectID",
"(",
")",
"\n",
"if",
"mErr",
"==",
"nil",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"mProject",
")",
"\n",
"project",
"=",
"mProject",
"\n",
"}",
"\n",
"}",
"\n\n",
"provider",
":=",
"&",
"GoogleProvider",
"{",
"project",
":",
"project",
",",
"dryRun",
":",
"dryRun",
",",
"domainFilter",
":",
"domainFilter",
",",
"zoneIDFilter",
":",
"zoneIDFilter",
",",
"resourceRecordSetsClient",
":",
"resourceRecordSetsService",
"{",
"dnsClient",
".",
"ResourceRecordSets",
"}",
",",
"managedZonesClient",
":",
"managedZonesService",
"{",
"dnsClient",
".",
"ManagedZones",
"}",
",",
"changesClient",
":",
"changesService",
"{",
"dnsClient",
".",
"Changes",
"}",
",",
"}",
"\n\n",
"return",
"provider",
",",
"nil",
"\n",
"}"
] |
2,969 | all-2970 | [
"Like",
"UnmarshalBinaryBare",
"but",
"will",
"first",
"read",
"the",
"byte",
"-",
"length",
"prefix",
".",
"UnmarshalBinaryLengthPrefixedReader",
"will",
"panic",
"if",
"ptr",
"is",
"a",
"nil",
"-",
"pointer",
".",
"If",
"maxSize",
"is",
"0",
"there",
"is",
"no",
"limit",
"(",
"not",
"recommended",
")",
"."
] | [
"func",
"(",
"cdc",
"*",
"Codec",
")",
"UnmarshalBinaryLengthPrefixedReader",
"(",
"r",
"io",
".",
"Reader",
",",
"ptr",
"interface",
"{",
"}",
",",
"maxSize",
"int64",
")",
"(",
"n",
"int64",
",",
"err",
"error",
")",
"{",
"if",
"maxSize",
"<",
"0",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Read byte-length prefix.",
"<mask>",
"l",
"int64",
"\n",
"var",
"buf",
"[",
"binary",
".",
"MaxVarintLen64",
"]",
"byte",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"buf",
")",
";",
"i",
"++",
"{",
"_",
",",
"err",
"=",
"r",
".",
"Read",
"(",
"buf",
"[",
"i",
":",
"i",
"+",
"1",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"n",
"+=",
"1",
"\n",
"if",
"buf",
"[",
"i",
"]",
"&",
"0x80",
"==",
"0",
"{",
"break",
"\n",
"}",
"\n",
"if",
"n",
">=",
"maxSize",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"maxSize",
")",
"\n",
"}",
"\n",
"}",
"\n",
"u64",
",",
"_",
":=",
"binary",
".",
"Uvarint",
"(",
"buf",
"[",
":",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"if",
"maxSize",
">",
"0",
"{",
"if",
"uint64",
"(",
"maxSize",
")",
"<",
"u64",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"maxSize",
",",
"u64",
")",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"(",
"maxSize",
"-",
"n",
")",
"<",
"int64",
"(",
"u64",
")",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"maxSize",
",",
"n",
",",
"u64",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"l",
"=",
"int64",
"(",
"u64",
")",
"\n",
"if",
"l",
"<",
"0",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Read that many bytes.",
"var",
"bz",
"=",
"make",
"(",
"[",
"]",
"byte",
",",
"l",
",",
"l",
")",
"\n",
"_",
",",
"err",
"=",
"io",
".",
"ReadFull",
"(",
"r",
",",
"bz",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"n",
"+=",
"l",
"\n\n",
"// Decode.",
"err",
"=",
"cdc",
".",
"UnmarshalBinaryBare",
"(",
"bz",
",",
"ptr",
")",
"\n",
"return",
"\n",
"}"
] |
2,970 | all-2971 | [
"WriteSecret",
"writes",
"a",
"JSON",
"-",
"encoded",
"k8s",
"secret",
"to",
"the",
"given",
"writer",
".",
"The",
"secret",
"uses",
"the",
"given",
"map",
"as",
"data",
"."
] | [
"func",
"WriteSecret",
"(",
"encoder",
"Encoder",
",",
"data",
"map",
"[",
"string",
"]",
"[",
"]",
"byte",
",",
"opts",
"*",
"AssetOpts",
")",
"error",
"{",
"if",
"opts",
".",
"DashOnly",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"secret",
":=",
"&",
"v1",
".",
"Secret",
"{",
"TypeMeta",
":",
"metav1",
".",
"TypeMeta",
"{",
"Kind",
":",
"\"",
"\"",
",",
"APIVersion",
":",
"\"",
"\"",
",",
"}",
",",
"ObjectMeta",
":",
"objectMeta",
"(",
"client",
".",
"StorageSecretName",
",",
"labels",
"(",
"client",
".",
"StorageSecretName",
")",
",",
"nil",
",",
"opts",
".",
"Namespace",
")",
",",
"Data",
":",
"<mask>",
",",
"}",
"\n",
"return",
"encoder",
".",
"Encode",
"(",
"secret",
")",
"\n",
"}"
] |
2,971 | all-2972 | [
"NewMemcachedDiscoveryClient",
"creates",
"a",
"new",
"DiscoveryClient",
"that",
"caches",
"results",
"in",
"memory"
] | [
"func",
"NewMemcachedDiscoveryClient",
"(",
"cl",
"discovery",
".",
"DiscoveryInterface",
")",
"discovery",
".",
"CachedDiscoveryInterface",
"{",
"c",
":=",
"&",
"memcachedDiscoveryClient",
"{",
"cl",
":",
"cl",
"}",
"\n",
"c",
".",
"Invalidate",
"(",
")",
"\n",
"<mask>",
"c",
"\n",
"}"
] |
2,972 | all-2973 | [
"Group",
"creates",
"a",
"new",
"*",
"App",
"that",
"inherits",
"from",
"it",
"s",
"parent",
"*",
"App",
".",
"This",
"is",
"useful",
"for",
"creating",
"groups",
"of",
"end",
"-",
"points",
"that",
"need",
"to",
"share",
"common",
"functionality",
"like",
"middleware",
".",
"/",
"*",
"g",
":",
"=",
"a",
".",
"Group",
"(",
"/",
"api",
"/",
"v1",
")",
"g",
".",
"Use",
"(",
"AuthorizeAPIMiddleware",
")",
"g",
".",
"GET",
"(",
"/",
"users",
"APIUsersHandler",
")",
"g",
".",
"GET",
"(",
"/",
"users",
"/",
":",
"user_id",
"APIUserShowHandler",
")"
] | [
"func",
"(",
"a",
"*",
"App",
")",
"Group",
"(",
"groupPath",
"string",
")",
"*",
"App",
"{",
"g",
":=",
"New",
"(",
"a",
".",
"Options",
")",
"\n",
"g",
".",
"Prefix",
"=",
"path",
".",
"Join",
"(",
"a",
".",
"Prefix",
",",
"groupPath",
")",
"\n",
"g",
".",
"Name",
"=",
"g",
".",
"Prefix",
"\n\n",
"g",
".",
"router",
"=",
"a",
".",
"router",
"\n",
"g",
".",
"Middleware",
"=",
"a",
".",
"Middleware",
".",
"clone",
"(",
")",
"\n",
"g",
".",
"ErrorHandlers",
"=",
"a",
".",
"ErrorHandlers",
"\n",
"g",
".",
"root",
"=",
"a",
"\n",
"if",
"a",
".",
"<mask>",
"!=",
"nil",
"{",
"g",
".",
"root",
"=",
"a",
".",
"root",
"\n",
"}",
"\n",
"a",
".",
"children",
"=",
"append",
"(",
"a",
".",
"children",
",",
"g",
")",
"\n",
"return",
"g",
"\n",
"}"
] |
2,973 | all-2974 | [
"NewASMAuthResource",
"creates",
"a",
"new",
"ASMAuthResource",
"object"
] | [
"func",
"NewASMAuthResource",
"(",
"taskARN",
"string",
",",
"asmRequirements",
"[",
"]",
"*",
"apicontainer",
".",
"ASMAuthData",
",",
"executionCredentialsID",
"string",
",",
"credentialsManager",
"credentials",
".",
"<mask>",
",",
"asmClientCreator",
"factory",
".",
"ClientCreator",
")",
"*",
"ASMAuthResource",
"{",
"c",
":=",
"&",
"ASMAuthResource",
"{",
"taskARN",
":",
"taskARN",
",",
"requiredASMResources",
":",
"asmRequirements",
",",
"credentialsManager",
":",
"credentialsManager",
",",
"executionCredentialsID",
":",
"executionCredentialsID",
",",
"asmClientCreator",
":",
"asmClientCreator",
",",
"}",
"\n\n",
"c",
".",
"initStatusToTransition",
"(",
")",
"\n",
"return",
"c",
"\n",
"}"
] |
2,974 | all-2975 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniform2fv",
"(",
"program",
"uint32",
",",
"location",
"int32",
",",
"count",
"int32",
",",
"value",
"*",
"float32",
")",
"{",
"C",
".",
"glowProgramUniform2fv",
"(",
"gpProgramUniform2fv",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"*",
"C",
".",
"GLfloat",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
] |
2,975 | all-2976 | [
"WithInstanceLimit",
"sets",
"a",
"limit",
"on",
"amount",
"of",
"additional",
"instances",
"spawned",
"by",
"BatchingWriter"
] | [
"func",
"WithScalingInterval",
"(",
"v",
"<mask>",
".",
"Duration",
")",
"BatchingWriterOption",
"{",
"return",
"func",
"(",
"w",
"*",
"BatchingWriter",
")",
"{",
"w",
".",
"scalingInterval",
"=",
"v",
"\n",
"}",
"\n",
"}"
] |
2,976 | all-2977 | [
"MainContextDefault",
"is",
"a",
"wrapper",
"around",
"g_main_context_default",
"()",
"."
] | [
"func",
"MainContextDefault",
"(",
")",
"*",
"MainContext",
"{",
"c",
":=",
"C",
".",
"g_main_context_default",
"(",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"<mask>",
"(",
"*",
"MainContext",
")",
"(",
"c",
")",
"\n",
"}"
] |
2,977 | all-2978 | [
"State",
"returns",
"the",
"current",
"channel",
"state",
"."
] | [
"func",
"(",
"ch",
"*",
"<mask>",
")",
"State",
"(",
")",
"ChannelState",
"{",
"ch",
".",
"mutable",
".",
"RLock",
"(",
")",
"\n",
"state",
":=",
"ch",
".",
"mutable",
".",
"state",
"\n",
"ch",
".",
"mutable",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"state",
"\n",
"}"
] |
2,978 | all-2979 | [
"GetOptionsOk",
"returns",
"a",
"tuple",
"with",
"the",
"Options",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsTest",
")",
"GetOptionsOk",
"(",
")",
"(",
"SyntheticsOptions",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Options",
"==",
"nil",
"{",
"return",
"SyntheticsOptions",
"{",
"}",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Options",
",",
"true",
"\n",
"}"
] |
2,979 | all-2980 | [
"SetDomainBytes",
"sets",
"cookie",
"domain",
"."
] | [
"func",
"(",
"c",
"*",
"Cookie",
")",
"SetDomainBytes",
"(",
"domain",
"[",
"]",
"byte",
")",
"{",
"c",
".",
"<mask>",
"=",
"append",
"(",
"c",
".",
"domain",
"[",
":",
"0",
"]",
",",
"domain",
"...",
")",
"\n",
"}"
] |
2,980 | all-2981 | [
"Make",
"a",
"request",
"to",
"the",
"Twilio",
"API",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"MakeRequest",
"(",
"ctx",
"context",
".",
"Context",
",",
"method",
"string",
",",
"pathPart",
"string",
",",
"data",
"url",
".",
"Values",
",",
"v",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"pathPart",
",",
"\"",
"\"",
"+",
"c",
".",
"APIVersion",
")",
"{",
"pathPart",
"=",
"c",
".",
"FullPath",
"(",
"pathPart",
")",
"\n",
"}",
"\n",
"rb",
":=",
"new",
"(",
"strings",
".",
"Reader",
")",
"\n",
"if",
"data",
"!=",
"nil",
"&&",
"(",
"method",
"==",
"\"",
"\"",
"||",
"method",
"==",
"\"",
"\"",
")",
"{",
"rb",
"=",
"strings",
".",
"NewReader",
"(",
"data",
".",
"Encode",
"(",
")",
")",
"\n",
"}",
"\n",
"if",
"method",
"==",
"\"",
"\"",
"&&",
"data",
"!=",
"nil",
"{",
"pathPart",
"=",
"pathPart",
"+",
"\"",
"\"",
"+",
"data",
".",
"Encode",
"(",
")",
"\n",
"}",
"\n",
"req",
",",
"err",
":=",
"c",
".",
"NewRequest",
"(",
"method",
",",
"pathPart",
",",
"rb",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"req",
"=",
"withContext",
"(",
"req",
",",
"ctx",
")",
"\n",
"if",
"ua",
":=",
"req",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
";",
"ua",
"==",
"\"",
"\"",
"{",
"req",
".",
"<mask>",
".",
"Set",
"(",
"\"",
"\"",
",",
"userAgent",
")",
"\n",
"}",
"else",
"{",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"userAgent",
"+",
"\"",
"\"",
"+",
"ua",
")",
"\n",
"}",
"\n",
"return",
"c",
".",
"Do",
"(",
"req",
",",
"&",
"v",
")",
"\n",
"}"
] |
2,981 | all-2982 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"RedoParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom17",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
2,982 | all-2983 | [
"AllByButton",
"finds",
"zero",
"or",
"more",
"button",
"elements",
"with",
"the",
"provided",
"text",
".",
"Supports",
"<button",
">",
"<input",
"type",
"=",
"button",
">",
"and",
"<input",
"type",
"=",
"submit",
">",
"."
] | [
"func",
"(",
"s",
"*",
"selectable",
")",
"AllByButton",
"(",
"<mask>",
"string",
")",
"*",
"MultiSelection",
"{",
"return",
"newMultiSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"Button",
",",
"text",
")",
")",
"\n",
"}"
] |
2,983 | all-2984 | [
"GetEmbedPageSetup",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_operation_get_embed_page_setup",
"()",
"."
] | [
"func",
"(",
"<mask>",
"*",
"PrintOperation",
")",
"GetEmbedPageSetup",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_print_operation_get_embed_page_setup",
"(",
"po",
".",
"native",
"(",
")",
")",
"\n",
"return",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
2,984 | all-2985 | [
"description",
"computes",
"the",
"ProwJobStatus",
"description",
"for",
"this",
"condition",
"or",
"falling",
"back",
"to",
"a",
"default",
"if",
"none",
"is",
"provided",
"."
] | [
"func",
"description",
"(",
"cond",
"duckv1alpha1",
".",
"Condition",
",",
"fallback",
"string",
")",
"string",
"{",
"switch",
"{",
"case",
"cond",
".",
"Message",
"!=",
"\"",
"\"",
":",
"return",
"cond",
".",
"Message",
"\n",
"<mask>",
"cond",
".",
"Reason",
"!=",
"\"",
"\"",
":",
"return",
"cond",
".",
"Reason",
"\n",
"}",
"\n",
"return",
"fallback",
"\n",
"}"
] |
2,985 | all-2986 | [
"Broadcast",
"accumulates",
"the",
"GossipData",
"under",
"the",
"given",
"srcName",
"and",
"will",
"send",
"it",
"eventually",
".",
"Send",
"and",
"Broadcast",
"accumulate",
"into",
"different",
"buckets",
"."
] | [
"func",
"(",
"s",
"*",
"gossipSender",
")",
"Broadcast",
"(",
"srcName",
"PeerName",
",",
"data",
"GossipData",
")",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"if",
"s",
".",
"empty",
"(",
")",
"{",
"defer",
"s",
".",
"prod",
"(",
")",
"\n",
"}",
"\n",
"d",
",",
"<mask>",
":=",
"s",
".",
"broadcasts",
"[",
"srcName",
"]",
"\n",
"if",
"!",
"found",
"{",
"s",
".",
"broadcasts",
"[",
"srcName",
"]",
"=",
"data",
"\n",
"}",
"else",
"{",
"s",
".",
"broadcasts",
"[",
"srcName",
"]",
"=",
"d",
".",
"Merge",
"(",
"data",
")",
"\n",
"}",
"\n",
"}"
] |
2,986 | all-2987 | [
"undo",
"merged",
"presets",
"from",
"loaded",
"presubmit",
"and",
"its",
"children"
] | [
"func",
"undoPresubmitPresets",
"(",
"presets",
"[",
"]",
"config",
".",
"Preset",
",",
"presubmit",
"*",
"config",
".",
"Presubmit",
")",
"{",
"if",
"presubmit",
".",
"Spec",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"for",
"_",
",",
"preset",
":=",
"<mask>",
"presets",
"{",
"undoPreset",
"(",
"&",
"preset",
",",
"presubmit",
".",
"Labels",
",",
"presubmit",
".",
"Spec",
")",
"\n",
"}",
"\n",
"}"
] |
2,987 | all-2988 | [
"put",
"puts",
"a",
"revision",
"to",
"the",
"keyIndex",
"."
] | [
"func",
"(",
"ki",
"*",
"keyIndex",
")",
"put",
"(",
"lg",
"*",
"zap",
".",
"Logger",
",",
"main",
"int64",
",",
"sub",
"int64",
")",
"{",
"rev",
":=",
"revision",
"{",
"main",
":",
"main",
",",
"sub",
":",
"<mask>",
"}",
"\n\n",
"if",
"!",
"rev",
".",
"GreaterThan",
"(",
"ki",
".",
"modified",
")",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Panic",
"(",
"\"",
"\"",
",",
"zap",
".",
"Int64",
"(",
"\"",
"\"",
",",
"rev",
".",
"main",
")",
",",
"zap",
".",
"Int64",
"(",
"\"",
"\"",
",",
"rev",
".",
"sub",
")",
",",
"zap",
".",
"Int64",
"(",
"\"",
"\"",
",",
"ki",
".",
"modified",
".",
"main",
")",
",",
"zap",
".",
"Int64",
"(",
"\"",
"\"",
",",
"ki",
".",
"modified",
".",
"sub",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Panicf",
"(",
"\"",
"\"",
",",
"rev",
",",
"ki",
".",
"modified",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"ki",
".",
"generations",
")",
"==",
"0",
"{",
"ki",
".",
"generations",
"=",
"append",
"(",
"ki",
".",
"generations",
",",
"generation",
"{",
"}",
")",
"\n",
"}",
"\n",
"g",
":=",
"&",
"ki",
".",
"generations",
"[",
"len",
"(",
"ki",
".",
"generations",
")",
"-",
"1",
"]",
"\n",
"if",
"len",
"(",
"g",
".",
"revs",
")",
"==",
"0",
"{",
"// create a new key",
"keysGauge",
".",
"Inc",
"(",
")",
"\n",
"g",
".",
"created",
"=",
"rev",
"\n",
"}",
"\n",
"g",
".",
"revs",
"=",
"append",
"(",
"g",
".",
"revs",
",",
"rev",
")",
"\n",
"g",
".",
"ver",
"++",
"\n",
"ki",
".",
"modified",
"=",
"rev",
"\n",
"}"
] |
2,988 | all-2989 | [
"GetLocation",
"returns",
"location",
"data"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetLocation",
"(",
"locid",
"string",
")",
"(",
"*",
"Location",
",",
"error",
")",
"{",
"url",
":=",
"locationPath",
"(",
"locid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"Location",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Get",
"(",
"<mask>",
",",
"ret",
",",
"http",
".",
"StatusOK",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
2,989 | all-2990 | [
"clone",
"will",
"be",
"protected",
"by",
"a",
"stop",
"-",
"world",
"lock",
"do",
"not",
"need",
"to",
"obtain",
"internal",
"lock"
] | [
"func",
"(",
"eh",
"*",
"EventHistory",
")",
"clone",
"(",
")",
"*",
"EventHistory",
"{",
"clonedQueue",
":=",
"eventQueue",
"{",
"Capacity",
":",
"eh",
".",
"Queue",
".",
"Capacity",
",",
"Events",
":",
"make",
"(",
"[",
"]",
"*",
"Event",
",",
"eh",
".",
"Queue",
".",
"Capacity",
")",
",",
"Size",
":",
"eh",
".",
"Queue",
".",
"Size",
",",
"Front",
":",
"eh",
".",
"Queue",
".",
"Front",
",",
"Back",
":",
"eh",
".",
"Queue",
".",
"Back",
",",
"}",
"\n\n",
"<mask>",
"(",
"clonedQueue",
".",
"Events",
",",
"eh",
".",
"Queue",
".",
"Events",
")",
"\n",
"return",
"&",
"EventHistory",
"{",
"StartIndex",
":",
"eh",
".",
"StartIndex",
",",
"Queue",
":",
"clonedQueue",
",",
"LastIndex",
":",
"eh",
".",
"LastIndex",
",",
"}",
"\n\n",
"}"
] |
2,990 | all-2991 | [
"GetID",
"returns",
"the",
"ID",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"l",
"*",
"LogSet",
")",
"GetID",
"(",
")",
"json",
".",
"Number",
"{",
"if",
"l",
"==",
"nil",
"||",
"l",
".",
"ID",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"l",
".",
"<mask>",
"\n",
"}"
] |
2,991 | all-2992 | [
"isTopName",
"returns",
"true",
"if",
"n",
"is",
"a",
"top",
"-",
"level",
"unresolved",
"identifier",
"with",
"the",
"given",
"name",
"."
] | [
"func",
"isTopName",
"(",
"n",
"ast",
".",
"Expr",
",",
"name",
"string",
")",
"bool",
"{",
"id",
",",
"ok",
":=",
"n",
".",
"(",
"*",
"ast",
".",
"Ident",
")",
"\n",
"return",
"ok",
"&&",
"<mask>",
".",
"Name",
"==",
"name",
"&&",
"id",
".",
"Obj",
"==",
"nil",
"\n",
"}"
] |
2,992 | all-2993 | [
"WithURL",
"URL",
"of",
"the",
"resources",
"to",
"set",
"breakpoint",
"on",
"."
] | [
"func",
"(",
"p",
"SetBreakpointByURLParams",
")",
"WithURL",
"(",
"<mask>",
"string",
")",
"*",
"SetBreakpointByURLParams",
"{",
"p",
".",
"URL",
"=",
"url",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
2,993 | all-2994 | [
"Or",
"succeeds",
"if",
"any",
"of",
"the",
"given",
"matchers",
"succeed",
".",
"The",
"matchers",
"are",
"tried",
"in",
"order",
"and",
"will",
"return",
"immediately",
"upon",
"the",
"first",
"successful",
"match",
".",
"Expect",
"(",
"hi",
")",
".",
"To",
"(",
"Or",
"(",
"HaveLen",
"(",
"3",
")",
"HaveLen",
"(",
"2",
"))",
"And",
"()",
"Or",
"()",
"Not",
"()",
"and",
"WithTransform",
"()",
"allow",
"matchers",
"to",
"be",
"composed",
"into",
"complex",
"expressions",
"."
] | [
"func",
"Or",
"(",
"ms",
"...",
"types",
".",
"GomegaMatcher",
")",
"<mask>",
".",
"GomegaMatcher",
"{",
"return",
"&",
"matchers",
".",
"OrMatcher",
"{",
"Matchers",
":",
"ms",
"}",
"\n",
"}"
] |
2,994 | all-2995 | [
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"LedgerUpgradeType"
] | [
"func",
"(",
"e",
"LedgerUpgradeType",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"ledgerUpgradeTypeMap",
"[",
"v",
"]",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
2,995 | all-2996 | [
"Get",
"implements",
"Get",
"method",
"from",
"QuotaService",
"interface"
] | [
"func",
"(",
"s",
"*",
"QuotaService",
")",
"Get",
"(",
"appName",
"string",
")",
"(",
"*",
"quota",
".",
"Quota",
",",
"error",
")",
"{",
"return",
"s",
".",
"<mask>",
".",
"Get",
"(",
"appName",
")",
"\n",
"}"
] |
2,996 | all-2997 | [
"if",
"cookie",
"secret",
"is",
"set",
"to",
"then",
"SetSecureCookie",
"would",
"not",
"work"
] | [
"func",
"ContextWithCookieSecret",
"(",
"secret",
"string",
")",
"martini",
".",
"Handler",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
",",
"mc",
"martini",
".",
"Context",
")",
"{",
"ctx",
":=",
"&",
"Context",
"{",
"req",
",",
"<mask>",
"[",
"string",
"]",
"string",
"{",
"}",
",",
"secret",
",",
"w",
"}",
"\n",
"//set some default headers",
"tm",
":=",
"time",
".",
"Now",
"(",
")",
".",
"UTC",
"(",
")",
"\n\n",
"//ignore errors from ParseForm because it's usually harmless.",
"req",
".",
"ParseForm",
"(",
")",
"\n",
"if",
"len",
"(",
"req",
".",
"Form",
")",
">",
"0",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"req",
".",
"Form",
"{",
"ctx",
".",
"Params",
"[",
"k",
"]",
"=",
"v",
"[",
"0",
"]",
"\n",
"}",
"\n",
"}",
"\n",
"ctx",
".",
"SetHeader",
"(",
"\"",
"\"",
",",
"webTime",
"(",
"tm",
")",
",",
"true",
")",
"\n",
"//Set the default content-type",
"ctx",
".",
"SetHeader",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"true",
")",
"\n",
"// set martini context for web.Context",
"mc",
".",
"Map",
"(",
"ctx",
")",
"\n",
"}",
"\n",
"}"
] |
2,997 | all-2998 | [
"String",
"returns",
"the",
"name",
"of",
"e"
] | [
"func",
"(",
"e",
"PathPaymentResultCode",
")",
"String",
"(",
")",
"string",
"{",
"name",
",",
"_",
":=",
"pathPaymentResultCodeMap",
"[",
"int32",
"(",
"e",
")",
"]",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
2,998 | all-2999 | [
"GetFillOk",
"returns",
"a",
"tuple",
"with",
"the",
"Fill",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"h",
"*",
"HostmapRequests",
")",
"GetFillOk",
"(",
")",
"(",
"HostmapRequest",
",",
"bool",
")",
"{",
"if",
"h",
"==",
"nil",
"||",
"h",
".",
"Fill",
"==",
"nil",
"{",
"return",
"HostmapRequest",
"{",
"}",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"h",
".",
"Fill",
",",
"<mask>",
"\n",
"}"
] |
2,999 | all-3000 | [
"Stability",
":",
"***",
"EXPERIMENTAL",
"***",
"Publish",
"a",
"message",
"on",
"pulse",
"with",
"the",
"given",
"routingKey",
".",
"Required",
"scopes",
":",
"notify",
":",
"pulse",
":",
"<routingKey",
">",
"See",
"#pulse"
] | [
"func",
"(",
"notify",
"*",
"Notify",
")",
"Pulse",
"(",
"payload",
"*",
"PostPulseMessageRequest",
")",
"error",
"{",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"notify",
")",
"\n",
"_",
",",
"_",
",",
"err",
":=",
"(",
"&",
"<mask>",
")",
".",
"APICall",
"(",
"payload",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.