id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
5,400 | all-5401 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"CallFunctionOnParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime47",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
5,401 | all-5402 | [
"Do",
"executes",
"Debugger",
".",
"setSkipAllPauses",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SetSkipAllPausesParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetSkipAllPauses",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
5,402 | all-5403 | [
"OpenDir",
"opens",
"a",
"directory",
"in",
"windows",
"with",
"write",
"access",
"for",
"syncing",
"."
] | [
"func",
"OpenDir",
"(",
"path",
"string",
")",
"(",
"*",
"os",
".",
"<mask>",
",",
"error",
")",
"{",
"fd",
",",
"err",
":=",
"openDir",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"os",
".",
"NewFile",
"(",
"uintptr",
"(",
"fd",
")",
",",
"path",
")",
",",
"nil",
"\n",
"}"
] |
5,403 | all-5404 | [
"SetResponseSensitive",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_dialog_set_response_sensitive",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Dialog",
")",
"SetResponseSensitive",
"(",
"id",
"ResponseType",
",",
"setting",
"bool",
")",
"{",
"C",
".",
"gtk_dialog_set_response_sensitive",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"<mask>",
")",
",",
"gbool",
"(",
"setting",
")",
")",
"\n",
"}"
] |
5,404 | all-5405 | [
"deleteExchange",
"will",
"delete",
"msgID",
"and",
"return",
"whether",
"it",
"was",
"found",
"or",
"whether",
"it",
"was",
"timed",
"out",
".",
"This",
"method",
"must",
"be",
"called",
"with",
"the",
"lock",
"."
] | [
"func",
"(",
"mexset",
"*",
"messageExchangeSet",
")",
"deleteExchange",
"(",
"msgID",
"uint32",
")",
"(",
"found",
",",
"timedOut",
"bool",
")",
"{",
"if",
"_",
",",
"found",
":=",
"mexset",
".",
"exchanges",
"[",
"msgID",
"]",
";",
"found",
"{",
"delete",
"(",
"mexset",
".",
"exchanges",
",",
"msgID",
")",
"\n",
"return",
"<mask>",
",",
"false",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"expired",
":=",
"mexset",
".",
"expiredExchanges",
"[",
"msgID",
"]",
";",
"expired",
"{",
"delete",
"(",
"mexset",
".",
"expiredExchanges",
",",
"msgID",
")",
"\n",
"return",
"false",
",",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
",",
"false",
"\n",
"}"
] |
5,405 | all-5406 | [
"getHead",
"-",
"Returns",
"table",
"header",
"containing",
"fields",
"names",
"."
] | [
"func",
"(",
"t",
"*",
"Table",
")",
"getHead",
"(",
")",
"string",
"{",
"s",
":=",
"\"",
"\"",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"t",
".",
"Fields",
"{",
"s",
"+=",
"t",
".",
"fieldString",
"(",
"name",
",",
"strings",
".",
"Title",
"(",
"name",
")",
")",
"+",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"s",
"\n",
"}"
] |
5,406 | all-5407 | [
"MakePath",
"generates",
"the",
"path",
"corresponding",
"to",
"this",
"Route",
"and",
"the",
"provided",
"path",
"parameters",
".",
"This",
"is",
"used",
"for",
"reverse",
"route",
"resolution",
"."
] | [
"func",
"(",
"route",
"*",
"Route",
")",
"MakePath",
"(",
"pathParams",
"map",
"[",
"string",
"]",
"string",
")",
"string",
"{",
"path",
":=",
"route",
".",
"PathExp",
"\n",
"for",
"paramName",
",",
"paramValue",
":=",
"range",
"pathParams",
"{",
"paramPlaceholder",
":=",
"\"",
"\"",
"+",
"paramName",
"\n",
"relaxedPlaceholder",
":=",
"\"",
"\"",
"+",
"paramName",
"\n",
"splatPlaceholder",
":=",
"\"",
"\"",
"+",
"paramName",
"\n",
"r",
":=",
"strings",
".",
"NewReplacer",
"(",
"paramPlaceholder",
",",
"paramValue",
",",
"splatPlaceholder",
",",
"paramValue",
",",
"relaxedPlaceholder",
",",
"paramValue",
")",
"\n",
"path",
"=",
"r",
".",
"Replace",
"(",
"path",
")",
"\n",
"}",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
5,407 | all-5408 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
] | [
"func",
"(",
"r",
"*",
"AlertSpec",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"AlertSpecLocator",
"{",
"for",
"_",
",",
"l",
":=",
"<mask>",
"r",
".",
"Links",
"{",
"if",
"l",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"return",
"api",
".",
"AlertSpecLocator",
"(",
"l",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,408 | all-5409 | [
"Auto",
"figures",
"out",
"how",
"to",
"render",
"the",
"model",
"based",
"information",
"about",
"the",
"request",
"and",
"the",
"name",
"of",
"the",
"model",
".",
"Auto",
"supports",
"automatic",
"rendering",
"of",
"HTML",
"JSON",
"and",
"XML",
".",
"Any",
"status",
"code",
"give",
"to",
"Context#Render",
"between",
"300",
"-",
"400",
"will",
"be",
"respected",
"by",
"Auto",
".",
"Other",
"status",
"codes",
"are",
"not",
".",
"/",
"*",
"#",
"Rules",
"for",
"HTML",
"template",
"lookup",
":",
"GET",
"/",
"users",
"-",
"users",
"/",
"index",
".",
"html",
"GET",
"/",
"users",
"/",
"id",
"-",
"users",
"/",
"show",
".",
"html",
"GET",
"/",
"users",
"/",
"new",
"-",
"users",
"/",
"new",
".",
"html",
"GET",
"/",
"users",
"/",
"id",
"/",
"edit",
"-",
"users",
"/",
"edit",
".",
"html",
"POST",
"/",
"users",
"-",
"(",
"redirect",
"to",
"/",
"users",
"/",
"id",
"or",
"render",
"user",
"/",
"new",
".",
"html",
")",
"PUT",
"/",
"users",
"/",
"edit",
"-",
"(",
"redirect",
"to",
"/",
"users",
"/",
"id",
"or",
"render",
"user",
"/",
"edit",
".",
"html",
")",
"DELETE",
"/",
"users",
"/",
"id",
"-",
"redirect",
"to",
"/",
"users"
] | [
"func",
"Auto",
"(",
"ctx",
"context",
".",
"Context",
",",
"i",
"<mask>",
"{",
"}",
")",
"Renderer",
"{",
"e",
":=",
"New",
"(",
"Options",
"{",
"}",
")",
"\n",
"return",
"e",
".",
"Auto",
"(",
"ctx",
",",
"i",
")",
"\n",
"}"
] |
5,409 | all-5410 | [
"handleAcquire",
":",
"Handler",
"for",
"/",
"acquire",
"Method",
":",
"POST",
"URLParams",
":",
"Required",
":",
"type",
"=",
"[",
"string",
"]",
":",
"type",
"of",
"requested",
"resource",
"Required",
":",
"state",
"=",
"[",
"string",
"]",
":",
"current",
"state",
"of",
"the",
"requested",
"resource",
"Required",
":",
"dest",
"=",
"[",
"string",
"]",
":",
"destination",
"state",
"of",
"the",
"requested",
"resource",
"Required",
":",
"owner",
"=",
"[",
"string",
"]",
":",
"requester",
"of",
"the",
"resource"
] | [
"func",
"handleAcquire",
"(",
"r",
"*",
"ranch",
".",
"Ranch",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"func",
"(",
"res",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"logrus",
".",
"WithField",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
".",
"Infof",
"(",
"\"",
"\"",
",",
"req",
".",
"RemoteAddr",
")",
"\n\n",
"if",
"req",
".",
"Method",
"!=",
"http",
".",
"MethodPost",
"{",
"msg",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"req",
".",
"Method",
")",
"\n",
"logrus",
".",
"Warning",
"(",
"msg",
")",
"\n",
"http",
".",
"Error",
"(",
"res",
",",
"msg",
",",
"http",
".",
"StatusMethodNotAllowed",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// TODO(krzyzacy) - sanitize user input",
"rtype",
":=",
"req",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"state",
":=",
"req",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"dest",
":=",
"req",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"owner",
":=",
"req",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"rtype",
"==",
"\"",
"\"",
"||",
"state",
"==",
"\"",
"\"",
"||",
"dest",
"==",
"\"",
"\"",
"||",
"owner",
"==",
"\"",
"\"",
"{",
"msg",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"rtype",
",",
"state",
",",
"dest",
",",
"owner",
")",
"\n",
"logrus",
".",
"Warning",
"(",
"msg",
")",
"\n",
"http",
".",
"Error",
"(",
"res",
",",
"msg",
",",
"http",
".",
"StatusBadRequest",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"logrus",
".",
"Infof",
"(",
"\"",
"\"",
",",
"state",
",",
"rtype",
",",
"owner",
",",
"dest",
")",
"\n\n",
"resource",
",",
"err",
":=",
"r",
".",
"Acquire",
"(",
"rtype",
",",
"state",
",",
"dest",
",",
"owner",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"http",
".",
"Error",
"(",
"res",
",",
"err",
".",
"Error",
"(",
")",
",",
"ErrorToStatus",
"(",
"err",
")",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"resJSON",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"resource",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"resource",
")",
"\n",
"http",
".",
"Error",
"(",
"res",
",",
"err",
".",
"<mask>",
"(",
")",
",",
"ErrorToStatus",
"(",
"err",
")",
")",
"\n",
"// release the resource, though this is not expected to happen.",
"err",
"=",
"r",
".",
"Release",
"(",
"resource",
".",
"Name",
",",
"state",
",",
"owner",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Warningf",
"(",
"\"",
"\"",
",",
"resource",
".",
"Name",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}",
"\n",
"logrus",
".",
"Infof",
"(",
"\"",
"\"",
",",
"string",
"(",
"resJSON",
")",
")",
"\n",
"fmt",
".",
"Fprint",
"(",
"res",
",",
"string",
"(",
"resJSON",
")",
")",
"\n",
"}",
"\n",
"}"
] |
5,410 | all-5411 | [
"GetLayoutTypeOk",
"returns",
"a",
"tuple",
"with",
"the",
"LayoutType",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"b",
"*",
"Board",
")",
"GetLayoutTypeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"b",
"==",
"nil",
"||",
"b",
".",
"LayoutType",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"b",
".",
"LayoutType",
",",
"<mask>",
"\n",
"}"
] |
5,411 | all-5412 | [
"AsType",
"specifies",
"that",
"the",
"content",
"sent",
"through",
"to",
"the",
"consumer",
"handler",
"should",
"be",
"sent",
"as",
"the",
"given",
"type"
] | [
"func",
"(",
"p",
"*",
"Message",
")",
"AsType",
"(",
"t",
"interface",
"{",
"}",
")",
"*",
"Message",
"{",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"t",
")",
")",
"\n",
"p",
".",
"<mask>",
"=",
"t",
"\n\n",
"return",
"p",
"\n",
"}"
] |
5,412 | all-5413 | [
"synchronizeState",
"explicitly",
"goes",
"through",
"each",
"docker",
"container",
"stored",
"in",
"state",
"and",
"updates",
"its",
"KnownStatus",
"appropriately",
"as",
"well",
"as",
"queueing",
"up",
"events",
"to",
"push",
"upstream",
"."
] | [
"func",
"(",
"<mask>",
"*",
"DockerTaskEngine",
")",
"synchronizeState",
"(",
")",
"{",
"engine",
".",
"tasksLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"engine",
".",
"tasksLock",
".",
"Unlock",
"(",
")",
"\n",
"imageStates",
":=",
"engine",
".",
"state",
".",
"AllImageStates",
"(",
")",
"\n",
"if",
"len",
"(",
"imageStates",
")",
"!=",
"0",
"{",
"engine",
".",
"imageManager",
".",
"AddAllImageStates",
"(",
"imageStates",
")",
"\n",
"}",
"\n\n",
"tasks",
":=",
"engine",
".",
"state",
".",
"AllTasks",
"(",
")",
"\n",
"tasksToStart",
":=",
"engine",
".",
"filterTasksToStartUnsafe",
"(",
"tasks",
")",
"\n",
"for",
"_",
",",
"task",
":=",
"range",
"tasks",
"{",
"task",
".",
"InitializeResources",
"(",
"engine",
".",
"resourceFields",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"task",
":=",
"range",
"tasksToStart",
"{",
"engine",
".",
"startTask",
"(",
"task",
")",
"\n",
"}",
"\n\n",
"engine",
".",
"saver",
".",
"Save",
"(",
")",
"\n",
"}"
] |
5,413 | all-5414 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"PushNodeByPathToFrontendParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom26",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
5,414 | all-5415 | [
"Capabilities",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockCNIClient",
")",
"Capabilities",
"(",
"arg0",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"[",
"]",
"string",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
5,415 | all-5416 | [
"SplitPath",
"splits",
"the",
"url",
"pattern",
"."
] | [
"func",
"SplitPath",
"(",
"pat",
"string",
")",
"(",
"routes",
"[",
"]",
"string",
",",
"err",
"error",
")",
"{",
"scanner",
":=",
"bufio",
".",
"NewScanner",
"(",
"strings",
".",
"NewReader",
"(",
"pat",
")",
")",
"\n",
"scanner",
".",
"Split",
"(",
"routeSplitFunc",
")",
"\n",
"for",
"scanner",
".",
"Scan",
"(",
")",
"{",
"routes",
"=",
"append",
"(",
"routes",
",",
"scanner",
".",
"<mask>",
"(",
")",
")",
"\n",
"}",
"\n",
"err",
"=",
"scanner",
".",
"Err",
"(",
")",
"\n",
"return",
"\n",
"}"
] |
5,416 | all-5417 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetWindowForTargetReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser5",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
5,417 | all-5418 | [
"AmazonSecret",
"creates",
"an",
"amazon",
"secret",
"with",
"the",
"following",
"parameters",
":",
"region",
"-",
"AWS",
"region",
"bucket",
"-",
"S3",
"bucket",
"name",
"id",
"-",
"AWS",
"access",
"key",
"id",
"secret",
"-",
"AWS",
"secret",
"access",
"key",
"token",
"-",
"AWS",
"access",
"token",
"distribution",
"-",
"cloudfront",
"distribution"
] | [
"func",
"AmazonSecret",
"(",
"region",
",",
"bucket",
",",
"<mask>",
",",
"secret",
",",
"token",
",",
"distribution",
"string",
")",
"map",
"[",
"string",
"]",
"[",
"]",
"byte",
"{",
"return",
"map",
"[",
"string",
"]",
"[",
"]",
"byte",
"{",
"\"",
"\"",
":",
"[",
"]",
"byte",
"(",
"region",
")",
",",
"\"",
"\"",
":",
"[",
"]",
"byte",
"(",
"bucket",
")",
",",
"\"",
"\"",
":",
"[",
"]",
"byte",
"(",
"id",
")",
",",
"\"",
"\"",
":",
"[",
"]",
"byte",
"(",
"secret",
")",
",",
"\"",
"\"",
":",
"[",
"]",
"byte",
"(",
"token",
")",
",",
"\"",
"\"",
":",
"[",
"]",
"byte",
"(",
"distribution",
")",
",",
"}",
"\n",
"}"
] |
5,418 | all-5419 | [
"NewClient",
"returns",
"a",
"new",
"datadog",
".",
"Client",
"which",
"can",
"be",
"used",
"to",
"access",
"the",
"API",
"methods",
".",
"The",
"expected",
"argument",
"is",
"the",
"API",
"key",
"."
] | [
"func",
"NewClient",
"(",
"apiKey",
",",
"appKey",
"string",
")",
"*",
"Client",
"{",
"baseUrl",
":=",
"<mask>",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"\n",
"if",
"baseUrl",
"==",
"\"",
"\"",
"{",
"baseUrl",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"&",
"Client",
"{",
"apiKey",
":",
"apiKey",
",",
"appKey",
":",
"appKey",
",",
"baseUrl",
":",
"baseUrl",
",",
"HttpClient",
":",
"http",
".",
"DefaultClient",
",",
"RetryTimeout",
":",
"time",
".",
"Duration",
"(",
"60",
"*",
"time",
".",
"Second",
")",
",",
"}",
"\n",
"}"
] |
5,419 | all-5420 | [
"Return",
"the",
"name",
"of",
"the",
"Post",
"struct",
"for",
"the",
"given",
"entity",
"."
] | [
"func",
"entityPost",
"(",
"<mask>",
"string",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"lex",
".",
"Capital",
"(",
"lex",
".",
"Plural",
"(",
"entity",
")",
")",
")",
"\n",
"}"
] |
5,420 | all-5421 | [
"OnGossipBroadcast",
"implements",
"mesh",
".",
"Gossiper",
".",
"The",
"buf",
"is",
"a",
"single",
"pkt"
] | [
"func",
"(",
"p",
"*",
"Peer",
")",
"OnGossipBroadcast",
"(",
"_",
"mesh",
".",
"PeerName",
",",
"buf",
"[",
"]",
"<mask>",
")",
"(",
"received",
"mesh",
".",
"GossipData",
",",
"err",
"error",
")",
"{",
"pkt",
":=",
"makePkt",
"(",
"buf",
")",
"\n",
"p",
".",
"recv",
"<-",
"pkt",
"// to ReadFrom",
"\n",
"return",
"pktSlice",
"{",
"pkt",
"}",
",",
"nil",
"\n",
"}"
] |
5,421 | all-5422 | [
"notify",
"notifies",
"the",
"fact",
"that",
"given",
"event",
"at",
"the",
"given",
"rev",
"just",
"happened",
"to",
"watchers",
"that",
"watch",
"on",
"the",
"key",
"of",
"the",
"event",
"."
] | [
"func",
"(",
"s",
"*",
"watchableStore",
")",
"notify",
"(",
"rev",
"int64",
",",
"evs",
"[",
"]",
"mvccpb",
".",
"Event",
")",
"{",
"var",
"victim",
"watcherBatch",
"\n",
"for",
"w",
",",
"eb",
":=",
"range",
"newWatcherBatch",
"(",
"&",
"s",
".",
"synced",
",",
"evs",
")",
"{",
"if",
"eb",
".",
"revs",
"!=",
"1",
"{",
"if",
"s",
".",
"<mask>",
"!=",
"nil",
"&&",
"s",
".",
"store",
".",
"lg",
"!=",
"nil",
"{",
"s",
".",
"store",
".",
"lg",
".",
"Panic",
"(",
"\"",
"\"",
",",
"zap",
".",
"Int",
"(",
"\"",
"\"",
",",
"eb",
".",
"revs",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Panicf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"w",
".",
"send",
"(",
"WatchResponse",
"{",
"WatchID",
":",
"w",
".",
"id",
",",
"Events",
":",
"eb",
".",
"evs",
",",
"Revision",
":",
"rev",
"}",
")",
"{",
"pendingEventsGauge",
".",
"Add",
"(",
"float64",
"(",
"len",
"(",
"eb",
".",
"evs",
")",
")",
")",
"\n",
"}",
"else",
"{",
"// move slow watcher to victims",
"w",
".",
"minRev",
"=",
"rev",
"+",
"1",
"\n",
"if",
"victim",
"==",
"nil",
"{",
"victim",
"=",
"make",
"(",
"watcherBatch",
")",
"\n",
"}",
"\n",
"w",
".",
"victim",
"=",
"true",
"\n",
"victim",
"[",
"w",
"]",
"=",
"eb",
"\n",
"s",
".",
"synced",
".",
"delete",
"(",
"w",
")",
"\n",
"slowWatcherGauge",
".",
"Inc",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"s",
".",
"addVictim",
"(",
"victim",
")",
"\n",
"}"
] |
5,422 | all-5423 | [
"RotatePieceRight",
"tries",
"to",
"rotate",
"the",
"piece",
"to",
"the",
"right",
"and",
"returns",
"the",
"piece",
"s",
"next",
"angle",
"."
] | [
"func",
"(",
"f",
"*",
"Field",
")",
"RotatePieceRight",
"(",
"piece",
"*",
"Piece",
",",
"x",
",",
"y",
"int",
",",
"angle",
"Angle",
")",
"Angle",
"{",
"if",
"piece",
".",
"collides",
"(",
"f",
",",
"x",
",",
"y",
",",
"angle",
".",
"RotateRight",
"(",
")",
")",
"{",
"return",
"angle",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"RotateRight",
"(",
")",
"\n",
"}"
] |
5,423 | all-5424 | [
"insert",
"inserts",
"a",
"sequence",
"of",
"field",
"accesses",
"into",
"the",
"tree",
"."
] | [
"func",
"(",
"ft",
"*",
"fieldTree",
")",
"insert",
"(",
"cname",
"[",
"]",
"string",
")",
"{",
"if",
"ft",
".",
"sub",
"==",
"nil",
"{",
"ft",
".",
"sub",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"fieldTree",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"cname",
")",
"==",
"0",
"{",
"ft",
".",
"ok",
"=",
"true",
"\n",
"return",
"\n",
"}",
"\n",
"sub",
":=",
"ft",
".",
"<mask>",
"[",
"cname",
"[",
"0",
"]",
"]",
"\n",
"sub",
".",
"insert",
"(",
"cname",
"[",
"1",
":",
"]",
")",
"\n",
"ft",
".",
"sub",
"[",
"cname",
"[",
"0",
"]",
"]",
"=",
"sub",
"\n",
"}"
] |
5,424 | all-5425 | [
"MustNoIssuer",
"retrieves",
"the",
"NoIssuer",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"PathPaymentResult",
")",
"MustNoIssuer",
"(",
")",
"<mask>",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetNoIssuer",
"(",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
5,425 | all-5426 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
] | [
"func",
"(",
"r",
"*",
"MonitoringMetric",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"MonitoringMetricLocator",
"{",
"for",
"_",
",",
"l",
":=",
"<mask>",
"r",
".",
"Links",
"{",
"if",
"l",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"return",
"api",
".",
"MonitoringMetricLocator",
"(",
"l",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,426 | all-5427 | [
"SetFlags",
"is",
"a",
"wrapper",
"around",
"g_application_set_flags",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Application",
")",
"SetFlags",
"(",
"<mask>",
"ApplicationFlags",
")",
"{",
"C",
".",
"g_application_set_flags",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"GApplicationFlags",
"(",
"flags",
")",
")",
"\n",
"}"
] |
5,427 | all-5428 | [
"Begin",
"sets",
"the",
"last",
"index",
"to",
"the",
"given",
"value",
"."
] | [
"func",
"(",
"w",
"*",
"WaterMark",
")",
"Begin",
"(",
"index",
"uint64",
")",
"{",
"atomic",
".",
"StoreUint64",
"(",
"&",
"w",
".",
"lastIndex",
",",
"<mask>",
")",
"\n",
"w",
".",
"markCh",
"<-",
"mark",
"{",
"index",
":",
"index",
",",
"done",
":",
"false",
"}",
"\n",
"}"
] |
5,428 | all-5429 | [
"Equals",
"fulfils",
"PrivKey",
"Interface",
"-",
"makes",
"sure",
"both",
"keys",
"refer",
"to",
"the",
"same"
] | [
"func",
"(",
"pk",
"PrivKeyLedgerSecp256k1",
")",
"Equals",
"(",
"other",
"PrivKey",
")",
"bool",
"{",
"if",
"ledger",
",",
"ok",
":=",
"other",
".",
"(",
"*",
"PrivKeyLedgerSecp256k1",
")",
";",
"<mask>",
"{",
"return",
"pk",
".",
"CachedPubKey",
".",
"Equals",
"(",
"ledger",
".",
"CachedPubKey",
")",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
5,429 | all-5430 | [
"GetColor",
"returns",
"the",
"Color",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"r",
"*",
"Rule",
")",
"GetColor",
"(",
")",
"string",
"{",
"if",
"r",
"==",
"nil",
"||",
"r",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"r",
".",
"Color",
"\n",
"}"
] |
5,430 | all-5431 | [
"/",
"*",
"A",
"truly",
"special",
"precedence",
"function",
"this",
"handles",
"all",
"the",
"lowest",
"-",
"case",
"errata",
"of",
"the",
"process",
"including",
"literals",
"parmeters",
"clauses",
"and",
"prefixes",
"."
] | [
"func",
"planValue",
"(",
"stream",
"*",
"tokenStream",
")",
"(",
"*",
"evaluationStage",
",",
"error",
")",
"{",
"var",
"token",
"ExpressionToken",
"\n",
"var",
"symbol",
"OperatorSymbol",
"\n",
"var",
"ret",
"*",
"evaluationStage",
"\n",
"var",
"operator",
"evaluationOperator",
"\n",
"var",
"err",
"error",
"\n\n",
"if",
"!",
"stream",
".",
"hasNext",
"(",
")",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n\n",
"token",
"=",
"stream",
".",
"next",
"(",
")",
"\n\n",
"switch",
"token",
".",
"Kind",
"{",
"case",
"CLAUSE",
":",
"<mask>",
",",
"err",
"=",
"planTokens",
"(",
"stream",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// advance past the CLAUSE_CLOSE token. We know that it's a CLAUSE_CLOSE, because at parse-time we check for unbalanced parens.",
"stream",
".",
"next",
"(",
")",
"\n\n",
"// the stage we got represents all of the logic contained within the parens",
"// but for technical reasons, we need to wrap this stage in a \"noop\" stage which breaks long chains of precedence.",
"// see github #33.",
"ret",
"=",
"&",
"evaluationStage",
"{",
"rightStage",
":",
"ret",
",",
"operator",
":",
"noopStageRight",
",",
"symbol",
":",
"NOOP",
",",
"}",
"\n\n",
"return",
"ret",
",",
"nil",
"\n\n",
"case",
"CLAUSE_CLOSE",
":",
"// when functions have empty params, this will be hit. In this case, we don't have any evaluation stage to do,",
"// so we just return nil so that the stage planner continues on its way.",
"stream",
".",
"rewind",
"(",
")",
"\n",
"return",
"nil",
",",
"nil",
"\n\n",
"case",
"VARIABLE",
":",
"operator",
"=",
"makeParameterStage",
"(",
"token",
".",
"Value",
".",
"(",
"string",
")",
")",
"\n\n",
"case",
"NUMERIC",
":",
"fallthrough",
"\n",
"case",
"STRING",
":",
"fallthrough",
"\n",
"case",
"PATTERN",
":",
"fallthrough",
"\n",
"case",
"BOOLEAN",
":",
"symbol",
"=",
"LITERAL",
"\n",
"operator",
"=",
"makeLiteralStage",
"(",
"token",
".",
"Value",
")",
"\n",
"case",
"TIME",
":",
"symbol",
"=",
"LITERAL",
"\n",
"operator",
"=",
"makeLiteralStage",
"(",
"float64",
"(",
"token",
".",
"Value",
".",
"(",
"time",
".",
"Time",
")",
".",
"Unix",
"(",
")",
")",
")",
"\n\n",
"case",
"PREFIX",
":",
"stream",
".",
"rewind",
"(",
")",
"\n",
"return",
"planPrefix",
"(",
"stream",
")",
"\n",
"}",
"\n\n",
"if",
"operator",
"==",
"nil",
"{",
"errorMsg",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"token",
".",
"Kind",
".",
"String",
"(",
")",
",",
"token",
".",
"Value",
")",
"\n",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"errorMsg",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"evaluationStage",
"{",
"symbol",
":",
"symbol",
",",
"operator",
":",
"operator",
",",
"}",
",",
"nil",
"\n",
"}"
] |
5,431 | all-5432 | [
"factory",
"function",
"for",
"the",
"designateClientInterface"
] | [
"func",
"newDesignateClient",
"(",
")",
"(",
"designateClientInterface",
",",
"error",
")",
"{",
"serviceClient",
",",
"err",
":=",
"createDesignateServiceClient",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"&",
"designateClient",
"{",
"serviceClient",
"}",
",",
"nil",
"\n",
"}"
] |
5,432 | all-5433 | [
"Dir",
"returns",
"a",
"currently",
"pressed",
"direction",
".",
"Dir",
"returns",
"false",
"if",
"no",
"direction",
"key",
"is",
"pressed",
"."
] | [
"func",
"(",
"i",
"*",
"Input",
")",
"Dir",
"(",
")",
"(",
"Dir",
",",
"bool",
")",
"{",
"if",
"inpututil",
".",
"IsKeyJustPressed",
"(",
"ebiten",
".",
"KeyUp",
")",
"{",
"return",
"DirUp",
",",
"true",
"\n",
"}",
"\n",
"if",
"inpututil",
".",
"IsKeyJustPressed",
"(",
"ebiten",
".",
"KeyLeft",
")",
"{",
"return",
"DirLeft",
",",
"true",
"\n",
"}",
"\n",
"if",
"inpututil",
".",
"IsKeyJustPressed",
"(",
"ebiten",
".",
"KeyRight",
")",
"{",
"return",
"DirRight",
",",
"true",
"\n",
"}",
"\n",
"if",
"inpututil",
".",
"IsKeyJustPressed",
"(",
"ebiten",
".",
"KeyDown",
")",
"{",
"return",
"DirDown",
",",
"true",
"\n",
"}",
"\n",
"if",
"i",
".",
"mouseState",
"==",
"mouseStateSettled",
"{",
"return",
"i",
".",
"mouseDir",
",",
"true",
"\n",
"}",
"\n",
"if",
"i",
".",
"touchState",
"==",
"touchStateSettled",
"{",
"return",
"i",
".",
"touchDir",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"0",
",",
"false",
"\n",
"}"
] |
5,433 | all-5434 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventCompilationCacheProduced",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage69",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
5,434 | all-5435 | [
"Marhals",
"the",
"type",
"into",
"a",
"[]",
"byte",
".",
"If",
"key",
"isn",
"t",
"valid",
"KeyNotFound",
"is",
"returned",
".",
"If",
"the",
"typed",
"doesn",
"t",
"represent",
"valid",
"JSON",
"a",
"relevant",
"JSON",
"error",
"is",
"returned"
] | [
"func",
"(",
"t",
"Typed",
")",
"ToBytes",
"(",
"key",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"var",
"o",
"<mask>",
"{",
"}",
"\n",
"if",
"len",
"(",
"key",
")",
"==",
"0",
"{",
"o",
"=",
"t",
"\n",
"}",
"else",
"{",
"exists",
":=",
"false",
"\n",
"o",
",",
"exists",
"=",
"t",
"[",
"key",
"]",
"\n",
"if",
"exists",
"==",
"false",
"{",
"return",
"nil",
",",
"KeyNotFound",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"o",
"==",
"nil",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"data",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"o",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"data",
",",
"nil",
"\n",
"}"
] |
5,435 | all-5436 | [
"ByNames",
"returns",
"multiple",
"Sources",
"given",
"multiple",
"names",
"."
] | [
"func",
"ByNames",
"(",
"p",
"ClientGenerator",
",",
"names",
"[",
"]",
"string",
",",
"cfg",
"*",
"Config",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"sources",
":=",
"[",
"]",
"Source",
"{",
"}",
"\n",
"for",
"_",
",",
"name",
":=",
"range",
"names",
"{",
"source",
",",
"err",
":=",
"BuildWithConfig",
"(",
"name",
",",
"p",
",",
"cfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"sources",
"=",
"append",
"(",
"sources",
",",
"source",
")",
"\n",
"}",
"\n\n",
"return",
"sources",
",",
"nil",
"\n",
"}"
] |
5,436 | all-5437 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoHar8",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
5,437 | all-5438 | [
"GetProgressReportInterval",
"returns",
"the",
"current",
"progress",
"report",
"interval",
"(",
"for",
"testing",
")",
"."
] | [
"func",
"GetProgressReportInterval",
"(",
")",
"time",
".",
"Duration",
"{",
"progressReportIntervalMu",
".",
"RLock",
"(",
")",
"\n",
"interval",
":=",
"progressReportInterval",
"\n",
"progressReportIntervalMu",
".",
"RUnlock",
"(",
")",
"\n\n",
"// add rand(1/10*progressReportInterval) as jitter so that etcdserver will not",
"// send progress notifications to watchers around the same time even when watchers",
"// are created around the same time (which is common when a client restarts itself).",
"jitter",
":=",
"time",
".",
"Duration",
"(",
"<mask>",
".",
"Int63n",
"(",
"int64",
"(",
"interval",
")",
"/",
"10",
")",
")",
"\n\n",
"return",
"interval",
"+",
"jitter",
"\n",
"}"
] |
5,438 | all-5439 | [
"ValidateLevelFilter",
"verifies",
"that",
"the",
"log",
"levels",
"within",
"the",
"filter",
"are",
"valid",
"."
] | [
"func",
"ValidateLevelFilter",
"(",
"min",
"logutils",
".",
"LogLevel",
",",
"filter",
"*",
"logutils",
".",
"LevelFilter",
")",
"bool",
"{",
"for",
"_",
",",
"level",
":=",
"range",
"filter",
".",
"Levels",
"{",
"if",
"<mask>",
"==",
"min",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
5,439 | all-5440 | [
"optionsForRepo",
"gets",
"the",
"plugins",
".",
"Approve",
"struct",
"that",
"is",
"applicable",
"to",
"the",
"indicated",
"repo",
"."
] | [
"func",
"optionsForRepo",
"(",
"config",
"*",
"plugins",
".",
"Configuration",
",",
"org",
",",
"repo",
"string",
")",
"*",
"plugins",
".",
"Approve",
"{",
"fullName",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
")",
"\n\n",
"a",
":=",
"func",
"(",
")",
"*",
"plugins",
".",
"Approve",
"{",
"// First search for repo config",
"for",
"_",
",",
"c",
":=",
"range",
"config",
".",
"Approve",
"{",
"if",
"!",
"strInSlice",
"(",
"fullName",
",",
"c",
".",
"Repos",
")",
"{",
"continue",
"\n",
"}",
"\n",
"return",
"&",
"c",
"\n",
"}",
"\n\n",
"// If you don't find anything, loop again looking for an org config",
"for",
"_",
",",
"c",
":=",
"range",
"config",
".",
"Approve",
"{",
"if",
"!",
"strInSlice",
"(",
"org",
",",
"c",
".",
"Repos",
")",
"{",
"continue",
"\n",
"}",
"\n",
"return",
"&",
"c",
"\n",
"}",
"\n\n",
"// Return an empty config, and use plugin defaults",
"return",
"&",
"plugins",
".",
"Approve",
"{",
"}",
"\n",
"}",
"(",
")",
"\n",
"if",
"a",
".",
"DeprecatedImplicitSelfApprove",
"==",
"nil",
"&&",
"a",
".",
"RequireSelfApproval",
"==",
"nil",
"&&",
"config",
".",
"UseDeprecatedSelfApprove",
"{",
"no",
":=",
"false",
"\n",
"a",
".",
"DeprecatedImplicitSelfApprove",
"=",
"&",
"no",
"\n",
"}",
"\n",
"if",
"a",
".",
"DeprecatedReviewActsAsApprove",
"==",
"nil",
"&&",
"a",
".",
"IgnoreReviewState",
"==",
"nil",
"&&",
"config",
".",
"UseDeprecatedReviewApprove",
"{",
"<mask>",
":=",
"false",
"\n",
"a",
".",
"DeprecatedReviewActsAsApprove",
"=",
"&",
"no",
"\n",
"}",
"\n",
"return",
"a",
"\n",
"}"
] |
5,440 | all-5441 | [
"isConfigTransportTLS",
"is",
"a",
"modified",
"copy",
"of",
"k8s",
".",
"io",
"/",
"kubernets",
"/",
"pkg",
"/",
"client",
"/",
"restclient",
".",
"IsConfigTransportTLS",
".",
"IsConfigTransportTLS",
"returns",
"true",
"if",
"and",
"only",
"if",
"the",
"provided",
"config",
"will",
"result",
"in",
"a",
"protected",
"connection",
"to",
"the",
"server",
"when",
"it",
"is",
"passed",
"to",
"restclient",
".",
"RESTClientFor",
"()",
".",
"Use",
"to",
"determine",
"when",
"to",
"send",
"credentials",
"over",
"the",
"wire",
".",
"Note",
":",
"the",
"Insecure",
"flag",
"is",
"ignored",
"when",
"testing",
"for",
"this",
"value",
"so",
"MITM",
"attacks",
"are",
"still",
"possible",
"."
] | [
"func",
"isConfigTransportTLS",
"(",
"config",
"restConfig",
")",
"bool",
"{",
"baseURL",
",",
"err",
":=",
"defaultServerURLFor",
"(",
"&",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"baseURL",
".",
"Scheme",
"==",
"\"",
"\"",
"\n",
"}"
] |
5,441 | all-5442 | [
"Dump",
"a",
"single",
"table",
"returning",
"a",
"SQL",
"text",
"containing",
"statements",
"for",
"its",
"schema",
"and",
"data",
"."
] | [
"func",
"dumpTable",
"(",
"tx",
"*",
"sql",
".",
"Tx",
",",
"table",
",",
"schema",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"statements",
":=",
"[",
"]",
"string",
"{",
"schema",
"}",
"\n\n",
"// Query all rows.",
"rows",
",",
"err",
":=",
"tx",
".",
"Query",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"table",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"defer",
"rows",
".",
"Close",
"(",
")",
"\n\n",
"// Figure column names",
"columns",
",",
"err",
":=",
"rows",
".",
"Columns",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Generate an INSERT statement for each row.",
"for",
"i",
":=",
"0",
";",
"rows",
".",
"Next",
"(",
")",
";",
"i",
"++",
"{",
"raw",
":=",
"make",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"len",
"(",
"columns",
")",
")",
"// Raw column values",
"\n",
"row",
":=",
"make",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"len",
"(",
"columns",
")",
")",
"\n",
"for",
"i",
":=",
"range",
"raw",
"{",
"row",
"[",
"i",
"]",
"=",
"&",
"raw",
"[",
"i",
"]",
"\n",
"}",
"\n",
"err",
":=",
"rows",
".",
"Scan",
"(",
"row",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"i",
")",
"\n",
"}",
"\n",
"values",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"columns",
")",
")",
"\n",
"for",
"j",
",",
"v",
":=",
"range",
"raw",
"{",
"<mask>",
"v",
":=",
"v",
".",
"(",
"type",
")",
"{",
"case",
"int64",
":",
"values",
"[",
"j",
"]",
"=",
"strconv",
".",
"FormatInt",
"(",
"v",
",",
"10",
")",
"\n",
"case",
"string",
":",
"values",
"[",
"j",
"]",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"v",
")",
"\n",
"case",
"[",
"]",
"byte",
":",
"values",
"[",
"j",
"]",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"string",
"(",
"v",
")",
")",
"\n",
"case",
"time",
".",
"Time",
":",
"values",
"[",
"j",
"]",
"=",
"strconv",
".",
"FormatInt",
"(",
"v",
".",
"Unix",
"(",
")",
",",
"10",
")",
"\n",
"default",
":",
"if",
"v",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"columns",
"[",
"j",
"]",
",",
"i",
")",
"\n",
"}",
"\n",
"values",
"[",
"j",
"]",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"}",
"\n",
"statement",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"table",
",",
"strings",
".",
"Join",
"(",
"values",
",",
"\"",
"\"",
")",
")",
"\n",
"statements",
"=",
"append",
"(",
"statements",
",",
"statement",
")",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"statements",
",",
"\"",
"\\n",
"\"",
")",
"+",
"\"",
"\\n",
"\"",
",",
"nil",
"\n",
"}"
] |
5,442 | all-5443 | [
"NetworkGetInterface",
"returns",
"the",
"network",
"associated",
"with",
"the",
"interface",
"with",
"the",
"given",
"name",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"NetworkGetInterface",
"(",
"devName",
"string",
")",
"(",
"int64",
",",
"*",
"api",
".",
"Network",
",",
"error",
")",
"{",
"id",
":=",
"int64",
"(",
"-",
"1",
")",
"\n",
"name",
":=",
"\"",
"\"",
"\n",
"value",
":=",
"\"",
"\"",
"\n\n",
"q",
":=",
"\"",
"\\\"",
"\\\"",
"\"",
"\n",
"arg1",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"c",
".",
"nodeID",
"}",
"\n",
"arg2",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"id",
",",
"name",
",",
"value",
"}",
"\n",
"result",
",",
"err",
":=",
"queryScan",
"(",
"c",
".",
"db",
",",
"q",
",",
"arg1",
",",
"arg2",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"-",
"1",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"r",
":=",
"range",
"result",
"{",
"for",
"_",
",",
"entry",
":=",
"range",
"strings",
".",
"Split",
"(",
"r",
"[",
"2",
"]",
".",
"(",
"string",
")",
",",
"\"",
"\"",
")",
"{",
"entry",
"=",
"strings",
".",
"TrimSpace",
"(",
"entry",
")",
"\n\n",
"if",
"entry",
"==",
"devName",
"{",
"id",
"=",
"r",
"[",
"0",
"]",
".",
"(",
"int64",
")",
"\n",
"name",
"=",
"r",
"[",
"1",
"]",
".",
"(",
"string",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"id",
"==",
"-",
"1",
"{",
"return",
"-",
"1",
",",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"devName",
")",
"\n",
"}",
"\n\n",
"config",
",",
"err",
":=",
"c",
".",
"NetworkConfigGet",
"(",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"-",
"1",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"<mask>",
":=",
"api",
".",
"Network",
"{",
"Name",
":",
"name",
",",
"Managed",
":",
"true",
",",
"Type",
":",
"\"",
"\"",
",",
"}",
"\n",
"network",
".",
"Config",
"=",
"config",
"\n\n",
"return",
"id",
",",
"&",
"network",
",",
"nil",
"\n",
"}"
] |
5,443 | all-5444 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"Entry",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoLog4",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
5,444 | all-5445 | [
"WithContext",
"adds",
"the",
"context",
"to",
"the",
"get",
"tasks",
"params"
] | [
"func",
"(",
"o",
"*",
"GetTasksParams",
")",
"WithContext",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"*",
"GetTasksParams",
"{",
"o",
".",
"SetContext",
"(",
"ctx",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
5,445 | all-5446 | [
"WithGeneratePreview",
"whether",
"preview",
"should",
"be",
"generated",
"for",
"the",
"result",
"."
] | [
"func",
"(",
"p",
"RunScriptParams",
")",
"WithGeneratePreview",
"(",
"generatePreview",
"bool",
")",
"*",
"RunScriptParams",
"{",
"p",
".",
"GeneratePreview",
"=",
"generatePreview",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
5,446 | all-5447 | [
"ListReviews",
"returns",
"all",
"reviews",
"on",
"a",
"pull",
"request",
".",
"Multiple",
"-",
"pages",
"of",
"results",
"consumes",
"multiple",
"API",
"tokens",
".",
"See",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"pulls",
"/",
"reviews",
"/",
"#list",
"-",
"reviews",
"-",
"on",
"-",
"a",
"-",
"pull",
"-",
"request"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListReviews",
"(",
"org",
",",
"repo",
"string",
",",
"number",
"int",
")",
"(",
"[",
"]",
"Review",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"number",
")",
"\n",
"if",
"c",
".",
"fake",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"path",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"number",
")",
"\n",
"var",
"reviews",
"[",
"]",
"Review",
"\n",
"err",
":=",
"c",
".",
"readPaginatedResults",
"(",
"<mask>",
",",
"acceptNone",
",",
"func",
"(",
")",
"interface",
"{",
"}",
"{",
"return",
"&",
"[",
"]",
"Review",
"{",
"}",
"\n",
"}",
",",
"func",
"(",
"obj",
"interface",
"{",
"}",
")",
"{",
"reviews",
"=",
"append",
"(",
"reviews",
",",
"*",
"(",
"obj",
".",
"(",
"*",
"[",
"]",
"Review",
")",
")",
"...",
")",
"\n",
"}",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"reviews",
",",
"nil",
"\n",
"}"
] |
5,447 | all-5448 | [
"genericRPC",
"handles",
"a",
"simple",
"request",
"/",
"response",
"RPC",
"."
] | [
"func",
"(",
"n",
"*",
"NetworkTransport",
")",
"genericRPC",
"(",
"id",
"ServerID",
",",
"target",
"ServerAddress",
",",
"rpcType",
"uint8",
",",
"args",
"interface",
"{",
"}",
",",
"resp",
"interface",
"{",
"}",
")",
"error",
"{",
"// Get a conn",
"conn",
",",
"err",
":=",
"n",
".",
"getConnFromAddressProvider",
"(",
"id",
",",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Set a deadline",
"if",
"n",
".",
"timeout",
">",
"0",
"{",
"conn",
".",
"conn",
".",
"SetDeadline",
"(",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"n",
".",
"timeout",
")",
")",
"\n",
"}",
"\n\n",
"// Send the RPC",
"if",
"err",
"=",
"sendRPC",
"(",
"conn",
",",
"rpcType",
",",
"args",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Decode the response",
"canReturn",
",",
"err",
":=",
"decodeResponse",
"(",
"conn",
",",
"resp",
")",
"\n",
"if",
"canReturn",
"{",
"n",
".",
"returnConn",
"(",
"conn",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
5,448 | all-5449 | [
"byTag",
"is",
"a",
"template",
"func",
"that",
"takes",
"the",
"provided",
"services",
"and",
"produces",
"a",
"map",
"based",
"on",
"Service",
"tags",
".",
"The",
"map",
"key",
"is",
"a",
"string",
"representing",
"the",
"service",
"tag",
".",
"The",
"map",
"value",
"is",
"a",
"slice",
"of",
"Services",
"which",
"have",
"the",
"tag",
"assigned",
"."
] | [
"func",
"byTag",
"(",
"in",
"interface",
"{",
"}",
")",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"interface",
"{",
"}",
")",
"\n\n",
"switch",
"typed",
":=",
"in",
".",
"(",
"type",
")",
"{",
"case",
"nil",
":",
"case",
"[",
"]",
"*",
"dep",
".",
"CatalogSnippet",
":",
"for",
"_",
",",
"s",
":=",
"range",
"typed",
"{",
"for",
"_",
",",
"t",
":=",
"range",
"s",
".",
"Tags",
"{",
"m",
"[",
"t",
"]",
"=",
"append",
"(",
"m",
"[",
"t",
"]",
",",
"s",
")",
"\n",
"}",
"\n",
"}",
"\n",
"case",
"[",
"]",
"*",
"dep",
".",
"CatalogService",
":",
"for",
"_",
",",
"s",
":=",
"range",
"typed",
"{",
"for",
"_",
",",
"t",
":=",
"range",
"s",
".",
"ServiceTags",
"{",
"m",
"[",
"t",
"]",
"=",
"append",
"(",
"m",
"[",
"t",
"]",
",",
"s",
")",
"\n",
"}",
"\n",
"}",
"\n",
"case",
"[",
"]",
"*",
"dep",
".",
"HealthService",
":",
"for",
"_",
",",
"s",
":=",
"<mask>",
"typed",
"{",
"for",
"_",
",",
"t",
":=",
"range",
"s",
".",
"Tags",
"{",
"m",
"[",
"t",
"]",
"=",
"append",
"(",
"m",
"[",
"t",
"]",
",",
"s",
")",
"\n",
"}",
"\n",
"}",
"\n",
"default",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"in",
")",
"\n",
"}",
"\n\n",
"return",
"m",
",",
"nil",
"\n",
"}"
] |
5,449 | all-5450 | [
"**************************************************************************************",
"\\",
"Matrix",
"operations",
"*",
"\\",
"***************************************************************************************",
"**************************************************************************************",
"\\",
"Array",
"Statistics",
"*",
"\\",
"***************************************************************************************",
"CvScalar",
"cvAvg",
"(",
"const",
"CvArr",
"*",
"arr",
"const",
"CvArr",
"*",
"mask",
"=",
"NULL",
")"
] | [
"func",
"(",
"src",
"*",
"IplImage",
")",
"Avg",
"(",
"<mask>",
"*",
"IplImage",
")",
"Scalar",
"{",
"return",
"(",
"Scalar",
")",
"(",
"C",
".",
"cvAvg",
"(",
"unsafe",
".",
"Pointer",
"(",
"src",
")",
",",
"unsafe",
".",
"Pointer",
"(",
"mask",
")",
")",
")",
"\n",
"}"
] |
5,450 | all-5451 | [
"GetAggregatorOk",
"returns",
"a",
"tuple",
"with",
"the",
"Aggregator",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinitionRequest",
")",
"GetAggregatorOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"Aggregator",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"Aggregator",
",",
"<mask>",
"\n",
"}"
] |
5,451 | all-5452 | [
"TODO",
":",
"deprecate",
"/",
"config",
"/",
"local",
"/",
"log",
"in",
"v3",
".",
"5"
] | [
"func",
"logHandleFunc",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"if",
"!",
"allowMethod",
"(",
"w",
",",
"r",
",",
"\"",
"\"",
")",
"{",
"return",
"\n",
"}",
"\n\n",
"in",
":=",
"struct",
"{",
"Level",
"string",
"}",
"{",
"}",
"\n\n",
"d",
":=",
"json",
".",
"NewDecoder",
"(",
"r",
".",
"Body",
")",
"\n",
"if",
"err",
":=",
"d",
".",
"Decode",
"(",
"&",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"WriteError",
"(",
"nil",
",",
"w",
",",
"r",
",",
"httptypes",
".",
"NewHTTPError",
"(",
"http",
".",
"StatusBadRequest",
",",
"\"",
"\"",
")",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"logl",
",",
"err",
":=",
"capnslog",
".",
"ParseLevel",
"(",
"strings",
".",
"ToUpper",
"(",
"in",
".",
"Level",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"WriteError",
"(",
"nil",
",",
"w",
",",
"r",
",",
"httptypes",
".",
"NewHTTPError",
"(",
"http",
".",
"StatusBadRequest",
",",
"\"",
"\"",
"+",
"in",
".",
"Level",
")",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"plog",
".",
"Noticef",
"(",
"\"",
"\"",
",",
"logl",
".",
"String",
"(",
")",
")",
"\n",
"capnslog",
".",
"SetGlobalLogLevel",
"(",
"logl",
")",
"\n",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusNoContent",
")",
"\n",
"}"
] |
5,452 | all-5453 | [
"NetworkInterfaceLocator",
"builds",
"a",
"locator",
"from",
"the",
"given",
"href",
"."
] | [
"func",
"(",
"api",
"*",
"API",
")",
"NetworkInterfaceLocator",
"(",
"href",
"<mask>",
")",
"*",
"NetworkInterfaceLocator",
"{",
"return",
"&",
"NetworkInterfaceLocator",
"{",
"Href",
"(",
"href",
")",
",",
"api",
"}",
"\n",
"}"
] |
5,453 | all-5454 | [
"AddHandlerBuilder",
"adds",
"a",
"builder",
"to",
"construct",
"handlers"
] | [
"func",
"(",
"r",
"*",
"Router",
")",
"AddHandlerBuilder",
"(",
"<mask>",
"func",
"(",
"interface",
"{",
"}",
")",
"(",
"Handler",
",",
"error",
")",
")",
"{",
"r",
".",
"builders",
"=",
"append",
"(",
"r",
".",
"builders",
",",
"&",
"builder",
")",
"\n",
"}"
] |
5,454 | all-5455 | [
"Appender",
"implements",
"the",
"Storage",
"interface",
"."
] | [
"func",
"(",
"s",
"*",
"ReadyStorage",
")",
"Appender",
"(",
")",
"(",
"<mask>",
".",
"Appender",
",",
"error",
")",
"{",
"if",
"x",
":=",
"s",
".",
"get",
"(",
")",
";",
"x",
"!=",
"nil",
"{",
"return",
"x",
".",
"Appender",
"(",
")",
"\n",
"}",
"\n",
"return",
"nil",
",",
"ErrNotReady",
"\n",
"}"
] |
5,455 | all-5456 | [
"Ensure",
"makes",
"sure",
"that",
"the",
"actual",
"schema",
"in",
"the",
"given",
"database",
"matches",
"the",
"one",
"defined",
"by",
"our",
"updates",
".",
"All",
"updates",
"are",
"applied",
"transactionally",
".",
"In",
"case",
"any",
"error",
"occurs",
"the",
"transaction",
"will",
"be",
"rolled",
"back",
"and",
"the",
"database",
"will",
"remain",
"unchanged",
".",
"A",
"update",
"will",
"be",
"applied",
"only",
"if",
"it",
"hasn",
"t",
"been",
"before",
"(",
"currently",
"applied",
"updates",
"are",
"tracked",
"in",
"the",
"a",
"shema",
"table",
"which",
"gets",
"automatically",
"created",
")",
".",
"If",
"no",
"error",
"occurs",
"the",
"integer",
"returned",
"by",
"this",
"method",
"is",
"the",
"initial",
"version",
"that",
"the",
"schema",
"has",
"been",
"upgraded",
"from",
"."
] | [
"func",
"(",
"s",
"*",
"Schema",
")",
"Ensure",
"(",
"db",
"*",
"sql",
".",
"DB",
")",
"(",
"int",
",",
"error",
")",
"{",
"var",
"current",
"int",
"\n",
"aborted",
":=",
"false",
"\n",
"err",
":=",
"query",
".",
"Transaction",
"(",
"db",
",",
"func",
"(",
"tx",
"*",
"sql",
".",
"Tx",
")",
"error",
"{",
"err",
":=",
"execFromFile",
"(",
"tx",
",",
"s",
".",
"path",
",",
"s",
".",
"hook",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"s",
".",
"path",
")",
"\n",
"}",
"\n\n",
"err",
"=",
"ensureSchemaTableExists",
"(",
"tx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"current",
",",
"err",
"=",
"queryCurrentVersion",
"(",
"tx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"s",
".",
"<mask>",
"!=",
"nil",
"{",
"err",
":=",
"s",
".",
"check",
"(",
"current",
",",
"tx",
")",
"\n",
"if",
"err",
"==",
"ErrGracefulAbort",
"{",
"// Abort the update gracefully, committing what",
"// we've done so far.",
"aborted",
"=",
"true",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// When creating the schema from scratch, use the fresh dump if",
"// available. Otherwise just apply all relevant updates.",
"if",
"current",
"==",
"0",
"&&",
"s",
".",
"fresh",
"!=",
"\"",
"\"",
"{",
"_",
",",
"err",
"=",
"tx",
".",
"Exec",
"(",
"s",
".",
"fresh",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"err",
"=",
"ensureUpdatesAreApplied",
"(",
"tx",
",",
"current",
",",
"s",
".",
"updates",
",",
"s",
".",
"hook",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"-",
"1",
",",
"err",
"\n",
"}",
"\n",
"if",
"aborted",
"{",
"return",
"current",
",",
"ErrGracefulAbort",
"\n",
"}",
"\n",
"return",
"current",
",",
"nil",
"\n",
"}"
] |
5,456 | all-5457 | [
"generateEmpty",
"generates",
"a",
"list",
"of",
"proto_library",
"rules",
"that",
"may",
"be",
"deleted",
".",
"This",
"is",
"generated",
"from",
"existing",
"proto_library",
"rules",
"with",
"srcs",
"lists",
"that",
"don",
"t",
"match",
"any",
"static",
"or",
"generated",
"files",
"."
] | [
"func",
"generateEmpty",
"(",
"f",
"*",
"rule",
".",
"File",
",",
"regularFiles",
",",
"genFiles",
"[",
"]",
"string",
")",
"[",
"]",
"*",
"rule",
".",
"Rule",
"{",
"if",
"f",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"knownFiles",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"regularFiles",
"{",
"knownFiles",
"[",
"f",
"]",
"=",
"true",
"\n",
"}",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"genFiles",
"{",
"knownFiles",
"[",
"f",
"]",
"=",
"true",
"\n",
"}",
"\n",
"var",
"empty",
"[",
"]",
"*",
"rule",
".",
"Rule",
"\n",
"outer",
":",
"for",
"_",
",",
"r",
":=",
"range",
"f",
".",
"Rules",
"{",
"if",
"r",
".",
"Kind",
"(",
")",
"!=",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n",
"srcs",
":=",
"r",
".",
"AttrStrings",
"(",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"srcs",
")",
"==",
"0",
"&&",
"r",
".",
"Attr",
"(",
"\"",
"\"",
")",
"!=",
"nil",
"{",
"// srcs is not a string list; leave it alone",
"continue",
"\n",
"}",
"\n",
"for",
"_",
",",
"src",
":=",
"range",
"r",
".",
"AttrStrings",
"(",
"\"",
"\"",
")",
"{",
"if",
"knownFiles",
"[",
"src",
"]",
"{",
"continue",
"outer",
"\n",
"}",
"\n",
"}",
"\n",
"empty",
"=",
"<mask>",
"(",
"empty",
",",
"rule",
".",
"NewRule",
"(",
"\"",
"\"",
",",
"r",
".",
"Name",
"(",
")",
")",
")",
"\n",
"}",
"\n",
"return",
"empty",
"\n",
"}"
] |
5,457 | all-5458 | [
"copy",
"a",
"three",
"-",
"dimensional",
"texture",
"subimage"
] | [
"func",
"CopyTexSubImage3D",
"(",
"target",
"uint32",
",",
"level",
"int32",
",",
"xoffset",
"int32",
",",
"yoffset",
"int32",
",",
"zoffset",
"int32",
",",
"x",
"int32",
",",
"y",
"int32",
",",
"width",
"int32",
",",
"height",
"int32",
")",
"{",
"syscall",
".",
"Syscall9",
"(",
"gpCopyTexSubImage3D",
",",
"9",
",",
"uintptr",
"(",
"target",
")",
",",
"uintptr",
"(",
"level",
")",
",",
"uintptr",
"(",
"xoffset",
")",
",",
"uintptr",
"(",
"yoffset",
")",
",",
"uintptr",
"(",
"zoffset",
")",
",",
"uintptr",
"(",
"x",
")",
",",
"uintptr",
"(",
"y",
")",
",",
"uintptr",
"(",
"width",
")",
",",
"uintptr",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
5,458 | all-5459 | [
"ForcePseudoState",
"ensures",
"that",
"the",
"given",
"node",
"will",
"have",
"specified",
"pseudo",
"-",
"classes",
"whenever",
"its",
"style",
"is",
"computed",
"by",
"the",
"browser",
".",
"See",
":",
"https",
":",
"//",
"chromedevtools",
".",
"github",
".",
"io",
"/",
"devtools",
"-",
"protocol",
"/",
"tot",
"/",
"CSS#method",
"-",
"forcePseudoState",
"parameters",
":",
"nodeID",
"-",
"The",
"element",
"id",
"for",
"which",
"to",
"force",
"the",
"pseudo",
"state",
".",
"forcedPseudoClasses",
"-",
"Element",
"pseudo",
"classes",
"to",
"force",
"when",
"computing",
"the",
"element",
"s",
"style",
"."
] | [
"func",
"ForcePseudoState",
"(",
"nodeID",
"cdp",
".",
"NodeID",
",",
"forcedPseudoClasses",
"[",
"]",
"<mask>",
")",
"*",
"ForcePseudoStateParams",
"{",
"return",
"&",
"ForcePseudoStateParams",
"{",
"NodeID",
":",
"nodeID",
",",
"ForcedPseudoClasses",
":",
"forcedPseudoClasses",
",",
"}",
"\n",
"}"
] |
5,459 | all-5460 | [
"PushNote",
"pushes",
"a",
"note",
"with",
"title",
"and",
"body",
"to",
"a",
"specific",
"PushBullet",
"device",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"PushNote",
"(",
"iden",
"string",
",",
"title",
",",
"body",
"string",
")",
"error",
"{",
"data",
":=",
"Note",
"{",
"Iden",
":",
"iden",
",",
"Type",
":",
"\"",
"\"",
",",
"Title",
":",
"title",
",",
"Body",
":",
"body",
",",
"}",
"\n",
"return",
"c",
".",
"Push",
"(",
"\"",
"\"",
",",
"data",
")",
"\n",
"}"
] |
5,460 | all-5461 | [
"Add",
"..."
] | [
"func",
"(",
"n",
"*",
"KNode",
")",
"Add",
"(",
"rs",
"[",
"]",
"rune",
")",
"{",
"cur",
":=",
"n",
"\n\n",
"for",
"k",
",",
"v",
":=",
"range",
"rs",
"{",
"link",
":=",
"cur",
".",
"linkByVal",
"(",
"v",
")",
"\n\n",
"if",
"link",
"==",
"nil",
"{",
"link",
"=",
"NewKNode",
"(",
"v",
")",
"\n",
"cur",
".",
"links",
"=",
"append",
"(",
"cur",
".",
"links",
",",
"link",
")",
"\n",
"}",
"\n\n",
"if",
"k",
"==",
"len",
"(",
"rs",
")",
"-",
"1",
"{",
"link",
".",
"end",
"=",
"<mask>",
"\n",
"}",
"\n\n",
"cur",
"=",
"link",
"\n",
"}",
"\n",
"}"
] |
5,461 | all-5462 | [
"Open",
"wraps",
"an",
"io",
".",
"ReadCloser",
"around",
"the",
"snapshot",
"contents"
] | [
"func",
"(",
"m",
"*",
"InmemSnapshotStore",
")",
"Open",
"(",
"id",
"string",
")",
"(",
"*",
"SnapshotMeta",
",",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"m",
".",
"RLock",
"(",
")",
"\n",
"defer",
"m",
".",
"RUnlock",
"(",
")",
"\n\n",
"if",
"m",
".",
"latest",
".",
"meta",
".",
"ID",
"!=",
"id",
"{",
"return",
"nil",
",",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"<mask>",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"m",
".",
"latest",
".",
"meta",
",",
"ioutil",
".",
"NopCloser",
"(",
"m",
".",
"latest",
".",
"contents",
")",
",",
"nil",
"\n",
"}"
] |
5,462 | all-5463 | [
"getKeys",
"reads",
"kdfcount",
"and",
"salt",
"from",
"b",
"and",
"returns",
"the",
"corresponding",
"encryption",
"keys",
"."
] | [
"func",
"(",
"a",
"*",
"archive50",
")",
"getKeys",
"(",
"b",
"*",
"readBuf",
")",
"(",
"keys",
"[",
"]",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"if",
"len",
"(",
"*",
"b",
")",
"<",
"17",
"{",
"return",
"nil",
",",
"errCorruptEncrypt",
"\n",
"}",
"\n",
"// read kdf count and salt",
"kdfCount",
":=",
"int",
"(",
"b",
".",
"byte",
"(",
")",
")",
"\n",
"if",
"kdfCount",
">",
"maxKdfCount",
"{",
"return",
"nil",
",",
"errCorruptEncrypt",
"\n",
"}",
"\n",
"kdfCount",
"=",
"1",
"<<",
"uint",
"(",
"kdfCount",
")",
"\n",
"salt",
":=",
"b",
".",
"bytes",
"(",
"16",
")",
"\n\n",
"// check cache of keys for match",
"for",
"_",
",",
"v",
":=",
"range",
"a",
".",
"keyCache",
"{",
"if",
"kdfCount",
"==",
"v",
".",
"kdfCount",
"&&",
"bytes",
".",
"Equal",
"(",
"salt",
",",
"v",
".",
"salt",
")",
"{",
"return",
"v",
".",
"keys",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"// not found, calculate keys",
"keys",
"=",
"calcKeys50",
"(",
"a",
".",
"pass",
",",
"salt",
",",
"kdfCount",
")",
"\n\n",
"// store in cache",
"copy",
"(",
"a",
".",
"keyCache",
"[",
"1",
":",
"]",
",",
"a",
".",
"keyCache",
"[",
":",
"]",
")",
"\n",
"a",
".",
"keyCache",
"[",
"0",
"]",
".",
"kdfCount",
"=",
"kdfCount",
"\n",
"a",
".",
"keyCache",
"[",
"0",
"]",
".",
"salt",
"=",
"append",
"(",
"[",
"]",
"byte",
"(",
"nil",
")",
",",
"salt",
"...",
")",
"\n",
"a",
".",
"keyCache",
"[",
"0",
"]",
".",
"keys",
"=",
"<mask>",
"\n\n",
"return",
"keys",
",",
"nil",
"\n",
"}"
] |
5,463 | all-5464 | [
"Log",
"implements",
"the",
"Log",
"function",
"required",
"by",
"the",
"Backend",
"interface",
"."
] | [
"func",
"(",
"bf",
"*",
"backendFormatter",
")",
"Log",
"(",
"level",
"Level",
",",
"calldepth",
"int",
",",
"r",
"*",
"Record",
")",
"error",
"{",
"// Make a shallow copy of the record and replace any formatter",
"r2",
":=",
"*",
"r",
"\n",
"r2",
".",
"formatter",
"=",
"bf",
".",
"f",
"\n",
"return",
"bf",
".",
"b",
".",
"<mask>",
"(",
"level",
",",
"calldepth",
"+",
"1",
",",
"&",
"r2",
")",
"\n",
"}"
] |
5,464 | all-5465 | [
"NetworkIDsNotPending",
"returns",
"a",
"map",
"associating",
"each",
"network",
"name",
"to",
"its",
"ID",
".",
"Pending",
"networks",
"are",
"skipped",
"."
] | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"NetworkIDsNotPending",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"int64",
",",
"error",
")",
"{",
"networks",
":=",
"[",
"]",
"struct",
"{",
"id",
"int64",
"\n",
"name",
"string",
"\n",
"}",
"{",
"}",
"\n",
"dest",
":=",
"func",
"(",
"i",
"int",
")",
"[",
"]",
"interface",
"{",
"}",
"{",
"networks",
"=",
"append",
"(",
"networks",
",",
"struct",
"{",
"id",
"int64",
"\n",
"name",
"string",
"\n",
"}",
"{",
"}",
")",
"\n",
"return",
"[",
"]",
"interface",
"{",
"}",
"{",
"&",
"networks",
"[",
"i",
"]",
".",
"id",
",",
"&",
"networks",
"[",
"i",
"]",
".",
"name",
"}",
"\n\n",
"}",
"\n",
"stmt",
",",
"err",
":=",
"c",
".",
"tx",
".",
"Prepare",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"stmt",
".",
"Close",
"(",
")",
"\n",
"err",
"=",
"query",
".",
"SelectObjects",
"(",
"stmt",
",",
"dest",
",",
"networkPending",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"ids",
":=",
"<mask>",
"[",
"string",
"]",
"int64",
"{",
"}",
"\n",
"for",
"_",
",",
"network",
":=",
"range",
"networks",
"{",
"ids",
"[",
"network",
".",
"name",
"]",
"=",
"network",
".",
"id",
"\n",
"}",
"\n",
"return",
"ids",
",",
"nil",
"\n",
"}"
] |
5,465 | all-5466 | [
"Query",
"the",
"db",
"for",
"information",
"about",
"containers",
"associated",
"with",
"the",
"given",
"profile",
"."
] | [
"func",
"getProfileContainersInfo",
"(",
"cluster",
"*",
"db",
".",
"Cluster",
",",
"project",
",",
"profile",
"string",
")",
"(",
"[",
"]",
"db",
".",
"ContainerArgs",
",",
"error",
")",
"{",
"// Query the db for information about containers associated with the",
"// given profile.",
"names",
",",
"err",
":=",
"cluster",
".",
"ProfileContainersGet",
"(",
"project",
",",
"profile",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"profile",
")",
"\n",
"}",
"\n\n",
"containers",
":=",
"[",
"]",
"db",
".",
"ContainerArgs",
"{",
"}",
"\n",
"err",
"=",
"cluster",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"db",
".",
"ClusterTx",
")",
"error",
"{",
"for",
"ctProject",
",",
"ctNames",
":=",
"range",
"names",
"{",
"for",
"_",
",",
"ctName",
":=",
"range",
"ctNames",
"{",
"container",
",",
"err",
":=",
"tx",
".",
"ContainerGet",
"(",
"ctProject",
",",
"ctName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"containers",
"=",
"append",
"(",
"containers",
",",
"db",
".",
"ContainerToArgs",
"(",
"container",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"<mask>",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"containers",
",",
"nil",
"\n",
"}"
] |
5,466 | all-5467 | [
"AttachCdrom",
"attaches",
"a",
"CD",
"rom"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"AttachCdrom",
"(",
"dcid",
"string",
",",
"srvid",
"string",
",",
"cdid",
"string",
")",
"(",
"*",
"Image",
",",
"error",
")",
"{",
"data",
":=",
"struct",
"{",
"<mask>",
"string",
"`json:\"id,omitempty\"`",
"\n",
"}",
"{",
"cdid",
",",
"}",
"\n",
"url",
":=",
"serverCdromColPath",
"(",
"dcid",
",",
"srvid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"Image",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Post",
"(",
"url",
",",
"data",
",",
"ret",
",",
"http",
".",
"StatusAccepted",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
5,467 | all-5468 | [
"GetFocusVAdjustment",
"is",
"a",
"wrapper",
"around",
"gtk_container_get_focus_vadjustment",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetFocusVAdjustment",
"(",
")",
"*",
"Adjustment",
"{",
"c",
":=",
"C",
".",
"gtk_container_get_focus_vadjustment",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapAdjustment",
"(",
"obj",
")",
"\n",
"}"
] |
5,468 | all-5469 | [
"title",
":",
"grant",
"access",
"to",
"app",
"path",
":",
"/",
"apps",
"/",
"{",
"app",
"}",
"/",
"teams",
"/",
"{",
"team",
"}",
"method",
":",
"PUT",
"responses",
":",
"200",
":",
"Access",
"granted",
"401",
":",
"Unauthorized",
"404",
":",
"App",
"or",
"team",
"not",
"found",
"409",
":",
"Grant",
"already",
"exists"
] | [
"func",
"grantAppAccess",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"appName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"teamName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"a",
",",
"err",
":=",
"getAppFromContext",
"(",
"appName",
",",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermAppUpdateGrant",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"appTarget",
"(",
"appName",
")",
",",
"Kind",
":",
"permission",
".",
"PermAppUpdateGrant",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"<mask>",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermAppReadEvents",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"team",
",",
"err",
":=",
"servicemanager",
".",
"Team",
".",
"FindByName",
"(",
"teamName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusNotFound",
",",
"Message",
":",
"\"",
"\"",
"}",
"\n",
"}",
"\n",
"err",
"=",
"a",
".",
"Grant",
"(",
"team",
")",
"\n",
"if",
"err",
"==",
"app",
".",
"ErrAlreadyHaveAccess",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusConflict",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
5,469 | all-5470 | [
"GetNextPage",
"fetches",
"the",
"Page",
"at",
"fullUri",
"and",
"decodes",
"it",
"into",
"v",
".",
"fullUri",
"should",
"be",
"a",
"next_page_uri",
"returned",
"in",
"the",
"response",
"to",
"a",
"paging",
"request",
"and",
"should",
"be",
"the",
"full",
"path",
"eg",
"/",
"2010",
"-",
"04",
"-",
"01",
"/",
"...",
"/",
"Messages?Page",
"=",
"1&PageToken",
"=",
"..."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetNextPage",
"(",
"ctx",
"context",
".",
"Context",
",",
"fullUri",
"string",
",",
"v",
"interface",
"{",
"}",
")",
"error",
"{",
"// for monitor etc.",
"if",
"strings",
".",
"HasPrefix",
"(",
"fullUri",
",",
"c",
".",
"<mask>",
")",
"{",
"fullUri",
"=",
"fullUri",
"[",
"len",
"(",
"c",
".",
"Base",
")",
":",
"]",
"\n",
"}",
"\n",
"return",
"c",
".",
"MakeRequest",
"(",
"ctx",
",",
"\"",
"\"",
",",
"fullUri",
",",
"nil",
",",
"v",
")",
"\n",
"}"
] |
5,470 | all-5471 | [
"Render",
"writes",
"HTML",
"representing",
"this",
"Prefix",
"to",
"the",
"provided",
"output",
"."
] | [
"func",
"(",
"pfx",
"*",
"Prefix",
")",
"Render",
"(",
"out",
"http",
".",
"ResponseWriter",
",",
"inPath",
"string",
")",
"{",
"url",
":=",
"gcsPath",
"+",
"inPath",
"+",
"pfx",
".",
"Prefix",
"\n",
"htmlGridItem",
"(",
"out",
",",
"iconDir",
",",
"<mask>",
",",
"pfx",
".",
"Prefix",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
5,471 | all-5472 | [
"newEncoding",
"constructs",
"a",
"new",
"encoding",
"defined",
"by",
"the",
"given",
"alphabet",
"which",
"must",
"be",
"a",
"32",
"-",
"byte",
"string",
"."
] | [
"func",
"newEncoding",
"(",
"encoder",
"string",
")",
"*",
"encoding",
"{",
"e",
":=",
"<mask>",
"(",
"encoding",
")",
"\n",
"e",
".",
"encode",
"=",
"encoder",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"e",
".",
"decode",
")",
";",
"i",
"++",
"{",
"e",
".",
"decode",
"[",
"i",
"]",
"=",
"0xff",
"\n",
"}",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"encoder",
")",
";",
"i",
"++",
"{",
"e",
".",
"decode",
"[",
"encoder",
"[",
"i",
"]",
"]",
"=",
"byte",
"(",
"i",
")",
"\n",
"}",
"\n",
"return",
"e",
"\n",
"}"
] |
5,472 | all-5473 | [
"Split",
"a",
"string",
"in",
"two",
"parts",
"cleaning",
"any",
"whitespace",
"."
] | [
"func",
"split",
"(",
"str",
",",
"sep",
"string",
")",
"(",
"string",
",",
"string",
")",
"{",
"var",
"a",
",",
"b",
"string",
"\n",
"<mask>",
"parts",
"=",
"strings",
".",
"SplitN",
"(",
"str",
",",
"sep",
",",
"2",
")",
"\n",
"a",
"=",
"strings",
".",
"TrimSpace",
"(",
"parts",
"[",
"0",
"]",
")",
"\n",
"if",
"len",
"(",
"parts",
")",
"==",
"2",
"{",
"b",
"=",
"strings",
".",
"TrimSpace",
"(",
"parts",
"[",
"1",
"]",
")",
"\n",
"}",
"\n\n",
"return",
"a",
",",
"b",
"\n",
"}"
] |
5,473 | all-5474 | [
"HasTitle",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"ToplistDefinition",
")",
"HasTitle",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"Title",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
5,474 | all-5475 | [
"Sprintf",
"returns",
"formatted",
"string",
".",
"This",
"is",
"same",
"as",
"fmt",
".",
"Sprintf",
"but",
"uses",
"gstring",
"formatting",
"."
] | [
"func",
"Sprintm",
"(",
"format",
"string",
",",
"args",
"<mask>",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"string",
"{",
"f",
",",
"a",
":=",
"gformat",
"(",
"format",
",",
"args",
")",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"f",
",",
"a",
"...",
")",
"\n",
"}"
] |
5,475 | all-5476 | [
"GetDontHave",
"retrieves",
"the",
"DontHave",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"StellarMessage",
")",
"GetDontHave",
"(",
")",
"(",
"result",
"DontHave",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"<mask>",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"DontHave",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
5,476 | all-5477 | [
"GetCreateFlags",
"returns",
"the",
"mcnflag",
".",
"Flag",
"slice",
"representing",
"the",
"flags",
"that",
"can",
"be",
"set",
"their",
"descriptions",
"and",
"defaults",
"."
] | [
"func",
"(",
"d",
"*",
"SerialDriver",
")",
"GetCreateFlags",
"(",
")",
"[",
"]",
"mcnflag",
".",
"Flag",
"{",
"d",
".",
"Lock",
"(",
")",
"\n",
"defer",
"d",
".",
"Unlock",
"(",
")",
"\n",
"<mask>",
"d",
".",
"Driver",
".",
"GetCreateFlags",
"(",
")",
"\n",
"}"
] |
5,477 | all-5478 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetAllTimeSamplingProfileReturns",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoMemory14",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
5,478 | all-5479 | [
"refresh",
"refresh",
"store",
"to",
"redis"
] | [
"func",
"(",
"rp",
"*",
"redisProvider",
")",
"refresh",
"(",
"rs",
"*",
"redisStore",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"redisPool",
".",
"Exec",
"(",
"func",
"(",
"c",
"*",
"redis",
".",
"Client",
")",
"{",
"err",
"=",
"c",
".",
"HMSet",
"(",
"rs",
".",
"SID",
",",
"<mask>",
".",
"Values",
")",
".",
"Err",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"err",
"=",
"c",
".",
"Expire",
"(",
"rs",
".",
"SID",
",",
"sessExpire",
")",
".",
"Err",
"(",
")",
"\n",
"}",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,479 | all-5480 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetStackTraceReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger31",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
5,480 | all-5481 | [
"ElementAt",
"retreives",
"an",
"item",
"at",
"a",
"particular",
"position",
"in",
"an",
"Enumerator",
"."
] | [
"func",
"(",
"iter",
"Enumerator",
")",
"ElementAt",
"(",
"n",
"uint",
")",
"<mask>",
"{",
"}",
"{",
"for",
"i",
":=",
"uint",
"(",
"0",
")",
";",
"i",
"<",
"n",
";",
"i",
"++",
"{",
"<-",
"iter",
"\n",
"}",
"\n",
"return",
"<-",
"iter",
"\n",
"}"
] |
5,481 | all-5482 | [
"IsTerminal",
"returns",
"true",
"if",
"the",
"given",
"file",
"descriptor",
"is",
"a",
"terminal",
"."
] | [
"func",
"IsTerminal",
"(",
"fd",
"int",
")",
"bool",
"{",
"_",
",",
"err",
":=",
"GetState",
"(",
"fd",
")",
"\n",
"return",
"<mask>",
"==",
"nil",
"\n",
"}"
] |
5,482 | all-5483 | [
"handleBackup",
"handles",
"a",
"request",
"that",
"intends",
"to",
"do",
"a",
"backup",
"."
] | [
"func",
"handleBackup",
"(",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"var",
"srcWAL",
"string",
"\n",
"var",
"destWAL",
"string",
"\n\n",
"withV3",
":=",
"c",
".",
"Bool",
"(",
"\"",
"\"",
")",
"\n",
"srcSnap",
":=",
"filepath",
".",
"Join",
"(",
"c",
".",
"String",
"(",
"\"",
"\"",
")",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"destSnap",
":=",
"filepath",
".",
"Join",
"(",
"c",
".",
"String",
"(",
"\"",
"\"",
")",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"if",
"c",
".",
"String",
"(",
"\"",
"\"",
")",
"!=",
"\"",
"\"",
"{",
"srcWAL",
"=",
"c",
".",
"String",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"srcWAL",
"=",
"filepath",
".",
"Join",
"(",
"c",
".",
"String",
"(",
"\"",
"\"",
")",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"String",
"(",
"\"",
"\"",
")",
"!=",
"\"",
"\"",
"{",
"destWAL",
"=",
"c",
".",
"String",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"destWAL",
"=",
"filepath",
".",
"Join",
"(",
"c",
".",
"String",
"(",
"\"",
"\"",
")",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"fileutil",
".",
"CreateDirAll",
"(",
"destSnap",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"destSnap",
",",
"err",
")",
"\n",
"}",
"\n\n",
"walsnap",
":=",
"saveSnap",
"(",
"destSnap",
",",
"srcSnap",
")",
"\n",
"metadata",
",",
"state",
",",
"ents",
":=",
"loadWAL",
"(",
"srcWAL",
",",
"walsnap",
",",
"withV3",
")",
"\n",
"saveDB",
"(",
"filepath",
".",
"Join",
"(",
"destSnap",
",",
"\"",
"\"",
")",
",",
"filepath",
".",
"Join",
"(",
"srcSnap",
",",
"\"",
"\"",
")",
",",
"state",
".",
"Commit",
",",
"withV3",
")",
"\n\n",
"idgen",
":=",
"idutil",
".",
"NewGenerator",
"(",
"0",
",",
"time",
".",
"Now",
"(",
")",
")",
"\n",
"metadata",
".",
"NodeID",
"=",
"idgen",
".",
"Next",
"(",
")",
"\n",
"metadata",
".",
"ClusterID",
"=",
"idgen",
".",
"Next",
"(",
")",
"\n\n",
"neww",
",",
"err",
":=",
"wal",
".",
"Create",
"(",
"zap",
".",
"NewExample",
"(",
")",
",",
"destWAL",
",",
"pbutil",
".",
"MustMarshal",
"(",
"&",
"metadata",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Fatal",
"(",
"err",
")",
"\n",
"}",
"\n",
"defer",
"neww",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
":=",
"neww",
".",
"Save",
"(",
"state",
",",
"ents",
")",
";",
"err",
"!=",
"nil",
"{",
"<mask>",
".",
"Fatal",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"neww",
".",
"SaveSnapshot",
"(",
"walsnap",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Fatal",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
5,483 | all-5484 | [
"CreateContainerFromImage",
"is",
"a",
"convenience",
"function",
"to",
"make",
"it",
"easier",
"to",
"create",
"a",
"container",
"from",
"an",
"existing",
"image"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"CreateContainerFromImage",
"(",
"source",
"ImageServer",
",",
"image",
"api",
".",
"Image",
",",
"req",
"api",
".",
"ContainersPost",
")",
"(",
"RemoteOperation",
",",
"error",
")",
"{",
"// Set the minimal source fields",
"req",
".",
"Source",
".",
"Type",
"=",
"\"",
"\"",
"\n\n",
"// Optimization for the local image case",
"if",
"r",
"==",
"source",
"{",
"// Always use fingerprints for local case",
"req",
".",
"Source",
".",
"Fingerprint",
"=",
"image",
".",
"Fingerprint",
"\n",
"req",
".",
"Source",
".",
"Alias",
"=",
"\"",
"\"",
"\n\n",
"op",
",",
"err",
":=",
"r",
".",
"CreateContainer",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"rop",
":=",
"remoteOperation",
"{",
"targetOp",
":",
"op",
",",
"chDone",
":",
"make",
"(",
"chan",
"bool",
")",
",",
"}",
"\n\n",
"// Forward targetOp to remote op",
"go",
"func",
"(",
")",
"{",
"rop",
".",
"err",
"=",
"rop",
".",
"targetOp",
".",
"Wait",
"(",
")",
"\n",
"close",
"(",
"rop",
".",
"chDone",
")",
"\n",
"}",
"(",
")",
"\n\n",
"return",
"&",
"rop",
",",
"nil",
"\n",
"}",
"\n\n",
"// Minimal source fields for remote image",
"req",
".",
"Source",
".",
"Mode",
"=",
"\"",
"\"",
"\n\n",
"// If we have an alias and the image is public, use that",
"if",
"req",
".",
"Source",
".",
"Alias",
"!=",
"\"",
"\"",
"&&",
"image",
".",
"Public",
"{",
"req",
".",
"Source",
".",
"Fingerprint",
"=",
"\"",
"\"",
"\n",
"}",
"else",
"{",
"req",
".",
"<mask>",
".",
"Fingerprint",
"=",
"image",
".",
"Fingerprint",
"\n",
"req",
".",
"Source",
".",
"Alias",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"// Get source server connection information",
"info",
",",
"err",
":=",
"source",
".",
"GetConnectionInfo",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"req",
".",
"Source",
".",
"Protocol",
"=",
"info",
".",
"Protocol",
"\n",
"req",
".",
"Source",
".",
"Certificate",
"=",
"info",
".",
"Certificate",
"\n\n",
"// Generate secret token if needed",
"if",
"!",
"image",
".",
"Public",
"{",
"secret",
",",
"err",
":=",
"source",
".",
"GetImageSecret",
"(",
"image",
".",
"Fingerprint",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"req",
".",
"Source",
".",
"Secret",
"=",
"secret",
"\n",
"}",
"\n\n",
"return",
"r",
".",
"tryCreateContainer",
"(",
"req",
",",
"info",
".",
"Addresses",
")",
"\n",
"}"
] |
5,484 | all-5485 | [
"IsGlob",
"checks",
"if",
"the",
"pattern",
"contains",
"a",
"glob",
"character"
] | [
"func",
"IsGlob",
"(",
"pattern",
"string",
")",
"bool",
"{",
"<mask>",
"=",
"clean",
"(",
"pattern",
")",
"\n",
"return",
"globRegex",
".",
"Match",
"(",
"[",
"]",
"byte",
"(",
"pattern",
")",
")",
"\n",
"}"
] |
5,485 | all-5486 | [
"GetDashboardListItems",
"fetches",
"the",
"dashboard",
"list",
"s",
"dashboard",
"definitions",
"."
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetDashboardListItems",
"(",
"<mask>",
"int",
")",
"(",
"[",
"]",
"DashboardListItem",
",",
"error",
")",
"{",
"var",
"out",
"reqDashboardListItems",
"\n",
"if",
"err",
":=",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"id",
")",
",",
"nil",
",",
"&",
"out",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"out",
".",
"Dashboards",
",",
"nil",
"\n",
"}"
] |
5,486 | all-5487 | [
"determine",
"if",
"textures",
"are",
"loaded",
"in",
"texture",
"memory"
] | [
"func",
"AreTexturesResident",
"(",
"n",
"int32",
",",
"textures",
"*",
"uint32",
",",
"residences",
"*",
"bool",
")",
"bool",
"{",
"ret",
":=",
"C",
".",
"glowAreTexturesResident",
"(",
"gpAreTexturesResident",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"n",
")",
",",
"(",
"*",
"C",
".",
"GLuint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"textures",
")",
")",
",",
"(",
"*",
"C",
".",
"GLboolean",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"residences",
")",
")",
")",
"\n",
"return",
"<mask>",
"==",
"TRUE",
"\n",
"}"
] |
5,487 | all-5488 | [
"export",
"FileSequence_PaddingStyle"
] | [
"func",
"FileSequence_PaddingStyle",
"(",
"id",
"FileSeqId",
")",
"C",
".",
"int",
"{",
"<mask>",
",",
"ok",
":=",
"sFileSeqs",
".",
"Get",
"(",
"id",
")",
"\n",
"// caller must free string",
"if",
"!",
"ok",
"{",
"return",
"C",
".",
"int",
"(",
"fileseq",
".",
"PadStyleDefault",
")",
"\n",
"}",
"\n",
"return",
"C",
".",
"int",
"(",
"fs",
".",
"PaddingStyle",
"(",
")",
")",
"\n",
"}"
] |
5,488 | all-5489 | [
"Derive",
"fetches",
"an",
"instrument",
"from",
"the",
"registry",
"or",
"creates",
"a",
"new",
"one",
".",
"If",
"another",
"instrument",
"type",
"is",
"already",
"registered",
"with",
"the",
"same",
"name",
"/",
"tags",
"a",
"blank",
"one",
"will",
"be",
"returned",
"and",
"an",
"error",
"will",
"be",
"logged",
"to",
"the",
"Errors",
"()",
"channel",
"."
] | [
"func",
"(",
"r",
"*",
"Registry",
")",
"Derive",
"(",
"name",
"string",
",",
"tags",
"[",
"]",
"string",
",",
"v",
"float64",
")",
"*",
"Derive",
"{",
"factory",
":=",
"func",
"(",
")",
"<mask>",
"{",
"}",
"{",
"return",
"NewDerive",
"(",
"v",
")",
"}",
"\n",
"return",
"r",
".",
"fetchDerive",
"(",
"name",
",",
"tags",
",",
"factory",
")",
"\n",
"}"
] |
5,489 | all-5490 | [
"cumulativeSubqueryOffset",
"returns",
"the",
"sum",
"of",
"range",
"and",
"offset",
"of",
"all",
"subqueries",
"in",
"the",
"path",
"."
] | [
"func",
"(",
"ng",
"*",
"Engine",
")",
"cumulativeSubqueryOffset",
"(",
"path",
"[",
"]",
"Node",
")",
"time",
".",
"Duration",
"{",
"var",
"subqOffset",
"time",
".",
"Duration",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"path",
"{",
"switch",
"n",
":=",
"node",
".",
"(",
"type",
")",
"{",
"case",
"*",
"SubqueryExpr",
":",
"subqOffset",
"+=",
"n",
".",
"Range",
"+",
"n",
".",
"Offset",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"subqOffset",
"\n",
"}"
] |
5,490 | all-5491 | [
"UnselectPath",
"is",
"a",
"wrapper",
"around",
"gtk_tree_selection_unselect_path",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TreeSelection",
")",
"UnselectPath",
"(",
"path",
"*",
"TreePath",
")",
"{",
"C",
".",
"gtk_tree_selection_unselect_path",
"(",
"v",
".",
"native",
"(",
")",
",",
"<mask>",
".",
"native",
"(",
")",
")",
"\n",
"}"
] |
5,491 | all-5492 | [
"Delete",
"an",
"IP",
"address",
"from",
"an",
"interface",
".",
"This",
"is",
"identical",
"to",
":",
"ip",
"addr",
"del",
"$ip",
"/",
"$ipNet",
"dev",
"$iface"
] | [
"func",
"NetworkLinkDelIp",
"(",
"iface",
"*",
"<mask>",
".",
"Interface",
",",
"ip",
"net",
".",
"IP",
",",
"ipNet",
"*",
"net",
".",
"IPNet",
")",
"error",
"{",
"return",
"networkLinkIpAction",
"(",
"syscall",
".",
"RTM_DELADDR",
",",
"syscall",
".",
"NLM_F_ACK",
",",
"IfAddr",
"{",
"iface",
",",
"ip",
",",
"ipNet",
"}",
",",
")",
"\n",
"}"
] |
5,492 | all-5493 | [
"GetTask",
"-",
"wrapper",
"to",
"rest",
"call",
"to",
"GET",
"task",
"from",
"dispenser"
] | [
"func",
"(",
"s",
"*",
"PDClient",
")",
"GetTask",
"(",
"taskID",
"string",
")",
"(",
"task",
"TaskResponse",
",",
"res",
"*",
"http",
".",
"Response",
",",
"err",
"error",
")",
"{",
"req",
",",
"_",
":=",
"s",
".",
"createRequest",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"s",
".",
"URL",
",",
"taskID",
")",
",",
"<mask>",
".",
"NewBufferString",
"(",
"``",
")",
")",
"\n\n",
"if",
"res",
",",
"err",
"=",
"s",
".",
"client",
".",
"Do",
"(",
"req",
")",
";",
"err",
"==",
"nil",
"&&",
"res",
".",
"StatusCode",
"==",
"http",
".",
"StatusOK",
"{",
"resBodyBytes",
",",
"_",
":=",
"ioutil",
".",
"ReadAll",
"(",
"res",
".",
"Body",
")",
"\n",
"json",
".",
"Unmarshal",
"(",
"resBodyBytes",
",",
"&",
"task",
")",
"\n\n",
"}",
"else",
"{",
"lo",
".",
"G",
".",
"Error",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"lo",
".",
"G",
".",
"Error",
"(",
"\"",
"\"",
",",
"res",
")",
"\n",
"err",
"=",
"ErrInvalidDispenserResponse",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
5,493 | all-5494 | [
"newVimSession",
"connects",
"the",
"VIM",
"SOAP",
"API",
"client",
"connection",
"."
] | [
"func",
"newVimSession",
"(",
"ctx",
"context",
".",
"Context",
",",
"u",
"*",
"url",
".",
"<mask>",
",",
"insecure",
"bool",
")",
"(",
"*",
"govmomi",
".",
"Client",
",",
"error",
")",
"{",
"logger",
".",
"Printf",
"(",
"\"",
"\"",
",",
"u",
".",
"Host",
")",
"\n",
"client",
",",
"err",
":=",
"govmomi",
".",
"NewClient",
"(",
"ctx",
",",
"u",
",",
"insecure",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"logger",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"return",
"client",
",",
"nil",
"\n",
"}"
] |
5,494 | all-5495 | [
"Header",
"executes",
"the",
"header",
"section",
"of",
"the",
"template",
"."
] | [
"func",
"(",
"lens",
"Lens",
")",
"<mask>",
"(",
"artifacts",
"[",
"]",
"lenses",
".",
"Artifact",
",",
"resourceDir",
"string",
")",
"string",
"{",
"return",
"executeTemplate",
"(",
"resourceDir",
",",
"\"",
"\"",
",",
"BuildLogsView",
"{",
"}",
")",
"\n",
"}"
] |
5,495 | all-5496 | [
"See",
"bcd",
".",
"Tracer",
".",
"AddClassifier",
"()",
"."
] | [
"func",
"(",
"t",
"*",
"BTTracer",
")",
"AddClassifier",
"(",
"options",
"[",
"]",
"string",
",",
"classifier",
"string",
")",
"[",
"]",
"string",
"{",
"return",
"t",
".",
"AddOptions",
"(",
"<mask>",
",",
"\"",
"\"",
",",
"classifier",
")",
"\n",
"}"
] |
5,496 | all-5497 | [
"writeServiceToCache",
"locks",
"specifically",
"to",
"alleviate",
"load",
"on",
"consul",
"some",
"additional",
"lock",
"time",
"is",
"preferable",
"to",
"extra",
"consul",
"calls"
] | [
"func",
"(",
"r",
"*",
"randomBalancer",
")",
"writeServiceToCache",
"(",
"serviceName",
"string",
")",
"(",
"[",
"]",
"*",
"balancer",
".",
"ServiceLocation",
",",
"error",
")",
"{",
"//acquire a write lock",
"r",
".",
"cacheLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"r",
".",
"cacheLock",
".",
"Unlock",
"(",
")",
"\n\n",
"//check the cache again in case we've fetched since the last check",
"//(our lock could have been waiting for another call to this function)",
"if",
"result",
",",
"ok",
":=",
"r",
".",
"cache",
"[",
"serviceName",
"]",
";",
"ok",
"{",
"if",
"time",
".",
"Now",
"(",
")",
".",
"UTC",
"(",
")",
".",
"Before",
"(",
"result",
".",
"CachedAt",
".",
"Add",
"(",
"r",
".",
"ttl",
")",
")",
"{",
"return",
"result",
".",
"Services",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"//it still isn't in the cache, lets put it there",
"consulServices",
",",
"_",
",",
"err",
":=",
"r",
".",
"consulCatalog",
".",
"Service",
"(",
"serviceName",
",",
"r",
".",
"environment",
",",
"true",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"consulServices",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"serviceName",
")",
"\n",
"}",
"\n\n",
"//setup service locations",
"var",
"services",
"[",
"]",
"*",
"balancer",
".",
"ServiceLocation",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"consulServices",
"{",
"s",
":=",
"&",
"balancer",
".",
"ServiceLocation",
"{",
"}",
"\n",
"s",
".",
"URL",
"=",
"v",
".",
"Service",
".",
"Address",
"\n",
"s",
".",
"Port",
"=",
"v",
".",
"Service",
".",
"Port",
"\n",
"services",
"=",
"append",
"(",
"services",
",",
"s",
")",
"\n",
"}",
"\n\n",
"// cache",
"c",
":=",
"cachedServiceLocation",
"{",
"Services",
":",
"services",
",",
"CachedAt",
":",
"<mask>",
".",
"Now",
"(",
")",
".",
"UTC",
"(",
")",
"}",
"\n",
"r",
".",
"cache",
"[",
"serviceName",
"]",
"=",
"c",
"\n",
"return",
"services",
",",
"nil",
"\n",
"}"
] |
5,497 | all-5498 | [
"chooseDigestFromManifestList",
"parses",
"blob",
"as",
"a",
"schema2",
"manifest",
"list",
"and",
"returns",
"the",
"digest",
"of",
"the",
"image",
"appropriate",
"for",
"the",
"current",
"environment",
"."
] | [
"func",
"chooseDigestFromManifestList",
"(",
"sys",
"*",
"types",
".",
"SystemContext",
",",
"blob",
"[",
"]",
"<mask>",
")",
"(",
"digest",
".",
"Digest",
",",
"error",
")",
"{",
"wantedArch",
":=",
"runtime",
".",
"GOARCH",
"\n",
"if",
"sys",
"!=",
"nil",
"&&",
"sys",
".",
"ArchitectureChoice",
"!=",
"\"",
"\"",
"{",
"wantedArch",
"=",
"sys",
".",
"ArchitectureChoice",
"\n",
"}",
"\n",
"wantedOS",
":=",
"runtime",
".",
"GOOS",
"\n",
"if",
"sys",
"!=",
"nil",
"&&",
"sys",
".",
"OSChoice",
"!=",
"\"",
"\"",
"{",
"wantedOS",
"=",
"sys",
".",
"OSChoice",
"\n",
"}",
"\n\n",
"list",
":=",
"manifestList",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"blob",
",",
"&",
"list",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"d",
":=",
"range",
"list",
".",
"Manifests",
"{",
"if",
"d",
".",
"Platform",
".",
"Architecture",
"==",
"wantedArch",
"&&",
"d",
".",
"Platform",
".",
"OS",
"==",
"wantedOS",
"{",
"return",
"d",
".",
"Digest",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"wantedArch",
",",
"wantedOS",
")",
"\n",
"}"
] |
5,498 | all-5499 | [
"Create",
"creates",
"a",
"vsphere_virtual_machine",
"cdrom",
"sub",
"-",
"resource",
"."
] | [
"func",
"(",
"r",
"*",
"CdromSubresource",
")",
"Create",
"(",
"l",
"object",
".",
"VirtualDeviceList",
")",
"(",
"[",
"]",
"types",
".",
"BaseVirtualDeviceConfigSpec",
",",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"r",
")",
"\n",
"var",
"spec",
"[",
"]",
"types",
".",
"BaseVirtualDeviceConfigSpec",
"\n",
"var",
"ctlr",
"types",
".",
"BaseVirtualController",
"\n",
"ctlr",
",",
"err",
":=",
"r",
".",
"ControllerForCreateUpdate",
"(",
"l",
",",
"SubresourceControllerTypeIDE",
",",
"0",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// We now have the controller on which we can create our device on.",
"device",
",",
"err",
":=",
"l",
".",
"CreateCdrom",
"(",
"ctlr",
".",
"(",
"*",
"types",
".",
"VirtualIDEController",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"// Map the CDROM to the correct device",
"r",
".",
"mapCdrom",
"(",
"device",
",",
"l",
")",
"\n",
"// Done here. Save IDs, push the device to the new device list and return.",
"if",
"err",
":=",
"r",
".",
"SaveDevIDs",
"(",
"device",
",",
"ctlr",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"dspec",
",",
"err",
":=",
"object",
".",
"VirtualDeviceList",
"{",
"device",
"}",
".",
"ConfigSpec",
"(",
"types",
".",
"VirtualDeviceConfigSpecOperationAdd",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"spec",
"=",
"append",
"(",
"<mask>",
",",
"dspec",
"...",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"r",
",",
"DeviceChangeString",
"(",
"spec",
")",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"r",
")",
"\n",
"return",
"spec",
",",
"nil",
"\n",
"}"
] |
5,499 | all-5500 | [
"SetVertexBuffer",
"sets",
"a",
"buffer",
"for",
"the",
"vertex",
"shader",
"function",
"at",
"an",
"index",
"in",
"the",
"buffer",
"argument",
"table",
"with",
"an",
"offset",
"that",
"specifies",
"the",
"start",
"of",
"the",
"data",
".",
"Reference",
":",
"https",
":",
"//",
"developer",
".",
"apple",
".",
"com",
"/",
"documentation",
"/",
"metal",
"/",
"mtlrendercommandencoder",
"/",
"1515829",
"-",
"setvertexbuffer",
"."
] | [
"func",
"(",
"rce",
"RenderCommandEncoder",
")",
"SetVertexBuffer",
"(",
"buf",
"Buffer",
",",
"<mask>",
",",
"index",
"int",
")",
"{",
"C",
".",
"RenderCommandEncoder_SetVertexBuffer",
"(",
"rce",
".",
"commandEncoder",
",",
"buf",
".",
"buffer",
",",
"C",
".",
"uint_t",
"(",
"offset",
")",
",",
"C",
".",
"uint_t",
"(",
"index",
")",
")",
"\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.