id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
22,900 | all-22901 | [
"convert",
"your",
"main",
"()",
"into",
"a",
"prog",
"(",
"state",
")",
"prog",
"()",
"is",
"run",
"in",
"a",
"child",
"process"
] | [
"func",
"prog",
"(",
"state",
"overseer",
".",
"State",
")",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"BuildID",
",",
"state",
".",
"ID",
")",
"\n",
"http",
".",
"Handle",
"(",
"\"",
"\"",
",",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"d",
",",
"_",
":=",
"time",
".",
"ParseDuration",
"(",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
")",
"\n",
"<mask>",
".",
"Sleep",
"(",
"d",
")",
"\n",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\n",
"\"",
",",
"BuildID",
",",
"state",
".",
"ID",
")",
"\n",
"}",
")",
")",
"\n",
"http",
".",
"Serve",
"(",
"state",
".",
"Listener",
",",
"nil",
")",
"\n",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"BuildID",
",",
"state",
".",
"ID",
")",
"\n",
"}"
] |
22,901 | all-22902 | [
"CreateContainers",
"create",
"the",
"specified",
"number",
"of",
"containers",
"."
] | [
"func",
"CreateContainers",
"(",
"c",
"lxd",
".",
"ContainerServer",
",",
"count",
"int",
",",
"parallel",
"int",
",",
"fingerprint",
"string",
",",
"privileged",
"bool",
")",
"(",
"time",
".",
"Duration",
",",
"error",
")",
"{",
"var",
"duration",
"time",
".",
"Duration",
"\n\n",
"batchSize",
",",
"err",
":=",
"getBatchSize",
"(",
"parallel",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"duration",
",",
"err",
"\n",
"}",
"\n\n",
"batchCreate",
":=",
"func",
"(",
"index",
"int",
",",
"wg",
"*",
"sync",
".",
"WaitGroup",
")",
"{",
"defer",
"wg",
".",
"Done",
"(",
")",
"\n\n",
"name",
":=",
"getContainerName",
"(",
"count",
",",
"index",
")",
"\n\n",
"err",
":=",
"createContainer",
"(",
"c",
",",
"fingerprint",
",",
"name",
",",
"privileged",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logf",
"(",
"\"",
"\"",
",",
"name",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n\n",
"<mask>",
"=",
"processBatch",
"(",
"count",
",",
"batchSize",
",",
"batchCreate",
")",
"\n\n",
"return",
"duration",
",",
"nil",
"\n",
"}"
] |
22,902 | all-22903 | [
"AllImageStates",
"returns",
"all",
"of",
"the",
"image",
".",
"ImageStates"
] | [
"func",
"(",
"state",
"*",
"DockerTaskEngineState",
")",
"AllImageStates",
"(",
")",
"[",
"]",
"*",
"image",
".",
"ImageState",
"{",
"state",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"<mask>",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"state",
".",
"allImageStatesUnsafe",
"(",
")",
"\n",
"}"
] |
22,903 | all-22904 | [
"LoadBytes",
"loads",
"YAML",
"bytes"
] | [
"func",
"LoadBytes",
"(",
"conf",
"interface",
"{",
"}",
",",
"src",
"[",
"]",
"<mask>",
")",
"error",
"{",
"return",
"loadConfigBytes",
"(",
"conf",
",",
"src",
",",
"nil",
",",
"yaml",
".",
"Unmarshal",
")",
"\n",
"}"
] |
22,904 | all-22905 | [
"Config",
"runs",
"git",
"config",
"."
] | [
"func",
"(",
"r",
"*",
"Repo",
")",
"Config",
"(",
"key",
",",
"<mask>",
"string",
")",
"error",
"{",
"r",
".",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
",",
"key",
",",
"value",
")",
"\n",
"if",
"b",
",",
"err",
":=",
"r",
".",
"gitCommand",
"(",
"\"",
"\"",
",",
"key",
",",
"value",
")",
".",
"CombinedOutput",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"key",
",",
"value",
",",
"err",
",",
"string",
"(",
"b",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,905 | all-22906 | [
"GetPreviewFilename",
"is",
"a",
"wrapper",
"around",
"gtk_file_chooser_get_preview_filename",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"FileChooser",
")",
"GetPreviewFilename",
"(",
")",
"string",
"{",
"c",
":=",
"C",
".",
"gtk_file_chooser_get_preview_filename",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"C",
".",
"GoString",
"(",
"c",
")",
"\n",
"}"
] |
22,906 | all-22907 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"ResolveNodeParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom11",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
22,907 | all-22908 | [
"Dial",
"dials",
"the",
"given",
"TCP",
"addr",
"using",
"tcp4",
".",
"This",
"function",
"has",
"the",
"following",
"additional",
"features",
"comparing",
"to",
"net",
".",
"Dial",
":",
"*",
"It",
"reduces",
"load",
"on",
"DNS",
"resolver",
"by",
"caching",
"resolved",
"TCP",
"addressed",
"for",
"DefaultDNSCacheDuration",
".",
"*",
"It",
"dials",
"all",
"the",
"resolved",
"TCP",
"addresses",
"in",
"round",
"-",
"robin",
"manner",
"until",
"connection",
"is",
"established",
".",
"This",
"may",
"be",
"useful",
"if",
"certain",
"addresses",
"are",
"temporarily",
"unreachable",
".",
"*",
"It",
"returns",
"ErrDialTimeout",
"if",
"connection",
"cannot",
"be",
"established",
"during",
"DefaultDialTimeout",
"seconds",
".",
"Use",
"DialTimeout",
"for",
"customizing",
"dial",
"timeout",
".",
"This",
"dialer",
"is",
"intended",
"for",
"custom",
"code",
"wrapping",
"before",
"passing",
"to",
"Client",
".",
"Dial",
"or",
"HostClient",
".",
"Dial",
".",
"For",
"instance",
"per",
"-",
"host",
"counters",
"and",
"/",
"or",
"limits",
"may",
"be",
"implemented",
"by",
"such",
"wrappers",
".",
"The",
"addr",
"passed",
"to",
"the",
"function",
"must",
"contain",
"port",
".",
"Example",
"addr",
"values",
":",
"*",
"foobar",
".",
"baz",
":",
"443",
"*",
"foo",
".",
"bar",
":",
"80",
"*",
"aaa",
".",
"com",
":",
"8080"
] | [
"func",
"(",
"d",
"*",
"TCPDialer",
")",
"Dial",
"(",
"addr",
"string",
")",
"(",
"net",
".",
"Conn",
",",
"error",
")",
"{",
"return",
"d",
".",
"dial",
"(",
"addr",
",",
"<mask>",
",",
"DefaultDialTimeout",
")",
"\n",
"}"
] |
22,908 | all-22909 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"AwaitPromiseParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime51",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
22,909 | all-22910 | [
"GetHostName",
"returns",
"the",
"HostName",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"c",
"*",
"Check",
")",
"GetHostName",
"(",
")",
"<mask>",
"{",
"if",
"c",
"==",
"nil",
"||",
"c",
".",
"HostName",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"c",
".",
"HostName",
"\n",
"}"
] |
22,910 | all-22911 | [
"VisitAllInOrder",
"calls",
"f",
"for",
"each",
"header",
"in",
"the",
"order",
"they",
"were",
"received",
".",
"f",
"must",
"not",
"retain",
"references",
"to",
"key",
"and",
"/",
"or",
"value",
"after",
"returning",
".",
"Copy",
"key",
"and",
"/",
"or",
"value",
"contents",
"before",
"returning",
"if",
"you",
"need",
"retaining",
"them",
".",
"This",
"function",
"is",
"slightly",
"slower",
"than",
"VisitAll",
"because",
"it",
"has",
"to",
"reparse",
"the",
"raw",
"headers",
"to",
"get",
"the",
"order",
"."
] | [
"func",
"(",
"h",
"*",
"RequestHeader",
")",
"VisitAllInOrder",
"(",
"f",
"func",
"(",
"key",
",",
"value",
"[",
"]",
"byte",
")",
")",
"{",
"h",
".",
"parseRawHeaders",
"(",
")",
"\n",
"var",
"s",
"headerScanner",
"\n",
"s",
".",
"b",
"=",
"h",
".",
"rawHeaders",
"\n",
"s",
".",
"disableNormalizing",
"=",
"h",
".",
"disableNormalizing",
"\n",
"for",
"s",
".",
"<mask>",
"(",
")",
"{",
"if",
"len",
"(",
"s",
".",
"key",
")",
">",
"0",
"{",
"f",
"(",
"s",
".",
"key",
",",
"s",
".",
"value",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
22,911 | all-22912 | [
"PutVertices",
"puts",
"the",
"given",
"dest",
"with",
"vertices",
"that",
"can",
"be",
"passed",
"to",
"DrawTriangles",
"."
] | [
"func",
"(",
"i",
"*",
"Image",
")",
"PutVertex",
"(",
"dest",
"[",
"]",
"float32",
",",
"dx",
",",
"dy",
",",
"sx",
",",
"sy",
"float32",
",",
"bx0",
",",
"by0",
",",
"bx1",
",",
"by1",
"float32",
",",
"cr",
",",
"cg",
",",
"cb",
",",
"ca",
"float32",
")",
"{",
"if",
"i",
".",
"backend",
"==",
"nil",
"{",
"i",
".",
"allocate",
"(",
"true",
")",
"\n",
"}",
"\n",
"ox",
",",
"oy",
",",
"_",
",",
"_",
":=",
"i",
".",
"region",
"(",
")",
"\n",
"oxf",
",",
"oyf",
":=",
"float32",
"(",
"ox",
")",
",",
"float32",
"(",
"oy",
")",
"\n",
"i",
".",
"backend",
".",
"restorable",
".",
"PutVertex",
"(",
"dest",
",",
"dx",
",",
"dy",
",",
"sx",
"+",
"oxf",
",",
"sy",
"+",
"oyf",
",",
"bx0",
"+",
"oxf",
",",
"by0",
"+",
"oyf",
",",
"bx1",
"+",
"oxf",
",",
"by1",
"+",
"oyf",
",",
"cr",
",",
"cg",
",",
"cb",
",",
"<mask>",
")",
"\n",
"}"
] |
22,912 | all-22913 | [
"Value",
"implements",
"the",
"driver",
"Valuer",
"interface",
"."
] | [
"func",
"(",
"n",
"NullDecimal",
")",
"Value",
"(",
")",
"(",
"driver",
".",
"Value",
",",
"error",
")",
"{",
"if",
"!",
"n",
".",
"Valid",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"if",
"n",
".",
"Decimal",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"n",
".",
"Decimal",
")",
"\n",
"}",
"\n",
"return",
"n",
".",
"Decimal",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
22,913 | all-22914 | [
"NewTypeFilterWrapperPlugin",
"is",
"the",
"constructor",
"of",
"TypeFilterWrapperPlugin"
] | [
"func",
"NewTypeFilterWrapperPlugin",
"(",
"plugin",
"Plugin",
")",
"*",
"TypeFilterWrapperPlugin",
"{",
"return",
"&",
"TypeFilterWrapperPlugin",
"{",
"plugin",
":",
"plugin",
",",
"pass",
":",
"<mask>",
"[",
"string",
"]",
"bool",
"{",
"}",
",",
"}",
"\n",
"}"
] |
22,914 | all-22915 | [
"Scale",
"scales",
"the",
"matrix",
"by",
"(",
"x",
"y",
")",
"."
] | [
"func",
"(",
"g",
"*",
"GeoM",
")",
"Scale",
"(",
"x",
",",
"y",
"float64",
")",
"{",
"a",
":=",
"(",
"float64",
"(",
"g",
".",
"a_1",
")",
"+",
"1",
")",
"*",
"x",
"\n",
"b",
":=",
"float64",
"(",
"g",
".",
"b",
")",
"*",
"x",
"\n",
"tx",
":=",
"float64",
"(",
"g",
".",
"<mask>",
")",
"*",
"x",
"\n",
"c",
":=",
"float64",
"(",
"g",
".",
"c",
")",
"*",
"y",
"\n",
"d",
":=",
"(",
"float64",
"(",
"g",
".",
"d_1",
")",
"+",
"1",
")",
"*",
"y",
"\n",
"ty",
":=",
"float64",
"(",
"g",
".",
"ty",
")",
"*",
"y",
"\n\n",
"g",
".",
"a_1",
"=",
"float32",
"(",
"a",
")",
"-",
"1",
"\n",
"g",
".",
"b",
"=",
"float32",
"(",
"b",
")",
"\n",
"g",
".",
"c",
"=",
"float32",
"(",
"c",
")",
"\n",
"g",
".",
"d_1",
"=",
"float32",
"(",
"d",
")",
"-",
"1",
"\n",
"g",
".",
"tx",
"=",
"float32",
"(",
"tx",
")",
"\n",
"g",
".",
"ty",
"=",
"float32",
"(",
"ty",
")",
"\n",
"}"
] |
22,915 | all-22916 | [
"Ask",
"will",
"call",
"UI",
".",
"Ask",
"with",
"message",
"then",
"wait",
"for",
"UI",
".",
"Ask",
"to",
"return",
"a",
"response",
"and",
"/",
"or",
"error",
".",
"It",
"will",
"clean",
"the",
"response",
"by",
"removing",
"any",
"carriage",
"returns",
"and",
"new",
"lines",
"that",
"if",
"finds",
".",
"Then",
"it",
"will",
"trim",
"the",
"message",
"using",
"the",
"trim",
"variable",
".",
"Use",
"and",
"empty",
"string",
"to",
"specify",
"you",
"do",
"not",
"want",
"to",
"trim",
".",
"If",
"a",
"message",
"is",
"not",
"used",
"(",
")",
"then",
"it",
"will",
"not",
"prompt",
"user",
"before",
"waiting",
"on",
"a",
"response",
".",
"This",
"is",
"a",
"thread",
"safe",
"function",
"."
] | [
"func",
"(",
"ui",
"*",
"ConcurrentUI",
")",
"Ask",
"(",
"<mask>",
",",
"trim",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"ui",
".",
"l",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ui",
".",
"l",
".",
"Unlock",
"(",
")",
"\n",
"res",
",",
"err",
":=",
"ui",
".",
"UI",
".",
"Ask",
"(",
"message",
",",
"trim",
")",
"\n",
"return",
"res",
",",
"err",
"\n",
"}"
] |
22,916 | all-22917 | [
"Subscribe",
"to",
"events",
".",
"It",
"will",
"return",
"true",
"if",
"successfully",
"subscribed",
"means",
"the",
"handler",
"haven",
"t",
"subscribed",
"before",
"."
] | [
"func",
"(",
"b",
"*",
"Bus",
")",
"Subscribe",
"(",
"h",
"Handler",
")",
"bool",
"{",
"b",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"b",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"for",
"_",
",",
"v",
":=",
"<mask>",
"b",
".",
"handlers",
"{",
"if",
"v",
"==",
"h",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n\n",
"b",
".",
"handlers",
"=",
"append",
"(",
"b",
".",
"handlers",
",",
"h",
")",
"\n",
"return",
"true",
"\n",
"}"
] |
22,917 | all-22918 | [
"unbind",
"takes",
"all",
"service",
"instances",
"that",
"are",
"bound",
"to",
"the",
"app",
"and",
"unbind",
"them",
".",
"This",
"method",
"is",
"used",
"by",
"Destroy",
"(",
"before",
"destroying",
"the",
"app",
"it",
"unbinds",
"all",
"service",
"instances",
")",
".",
"Refer",
"to",
"Destroy",
"docs",
"for",
"more",
"details",
"."
] | [
"func",
"(",
"app",
"*",
"App",
")",
"unbind",
"(",
"evt",
"*",
"event",
".",
"Event",
",",
"requestID",
"string",
")",
"error",
"{",
"instances",
",",
"err",
":=",
"service",
".",
"GetServiceInstancesBoundToApp",
"(",
"app",
".",
"Name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"var",
"msg",
"string",
"\n",
"var",
"addMsg",
"=",
"func",
"(",
"instanceName",
"string",
",",
"reason",
"error",
")",
"{",
"if",
"msg",
"==",
"\"",
"\"",
"{",
"msg",
"=",
"\"",
"\\n",
"\"",
"\n",
"}",
"\n",
"<mask>",
"+=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"instanceName",
",",
"reason",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"instance",
":=",
"range",
"instances",
"{",
"err",
"=",
"instance",
".",
"UnbindApp",
"(",
"service",
".",
"UnbindAppArgs",
"{",
"App",
":",
"app",
",",
"Restart",
":",
"false",
",",
"ForceRemove",
":",
"true",
",",
"Event",
":",
"evt",
",",
"RequestID",
":",
"requestID",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"addMsg",
"(",
"instance",
".",
"Name",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"msg",
"!=",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"msg",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,918 | all-22919 | [
"Error",
"is",
"the",
"string",
"representation",
"of",
"a",
"provisioning",
"error",
"."
] | [
"func",
"(",
"e",
"*",
"<mask>",
")",
"Error",
"(",
")",
"string",
"{",
"var",
"err",
"string",
"\n",
"if",
"e",
".",
"Err",
"!=",
"nil",
"{",
"err",
"=",
"e",
".",
"Err",
".",
"Error",
"(",
")",
"+",
"\"",
"\"",
"+",
"e",
".",
"Reason",
"\n",
"}",
"else",
"{",
"err",
"=",
"e",
".",
"Reason",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
22,919 | all-22920 | [
"HasAlertId",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"a",
"*",
"AlertValueDefinition",
")",
"HasAlertId",
"(",
")",
"bool",
"{",
"if",
"a",
"!=",
"nil",
"&&",
"a",
".",
"AlertId",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
22,920 | all-22921 | [
"Validate",
"validates",
"this",
"state"
] | [
"func",
"(",
"m",
"State",
")",
"Validate",
"(",
"formats",
"strfmt",
".",
"Registry",
")",
"error",
"{",
"var",
"<mask>",
"[",
"]",
"error",
"\n\n",
"// value enum",
"if",
"err",
":=",
"m",
".",
"validateStateEnum",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"m",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"res",
")",
">",
"0",
"{",
"return",
"errors",
".",
"CompositeValidationError",
"(",
"res",
"...",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,921 | all-22922 | [
"GetTaskByArn",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockTaskEngine",
")",
"GetTaskByArn",
"(",
"arg0",
"string",
")",
"(",
"*",
"task",
".",
"Task",
",",
"bool",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"<mask>",
".",
"Task",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"bool",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
22,922 | all-22923 | [
"FqName",
"returns",
"namespace",
".",
"name"
] | [
"func",
"FqName",
"(",
"o",
"metav1",
".",
"<mask>",
")",
"string",
"{",
"if",
"o",
".",
"GetNamespace",
"(",
")",
"==",
"\"",
"\"",
"{",
"return",
"o",
".",
"GetName",
"(",
")",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"o",
".",
"GetNamespace",
"(",
")",
",",
"o",
".",
"GetName",
"(",
")",
")",
"\n",
"}"
] |
22,923 | all-22924 | [
"Gain",
"applies",
"the",
"multiplier",
"to",
"the",
"passed",
"buffer",
".",
"A",
"multipler",
"of",
"1",
"would",
"increase",
"the",
"amplitude",
"of",
"the",
"signal",
"by",
"100%",
"while",
"a",
"multiplier",
"of",
"0",
"would",
"not",
"do",
"anything",
".",
"Note",
"that",
"this",
"is",
"a",
"very",
"very",
"naive",
"implementation",
"and",
"we",
"will",
"more",
"than",
"add",
"a",
"more",
"useful",
"DB",
"gain",
"transform",
"."
] | [
"func",
"Gain",
"(",
"buf",
"*",
"audio",
".",
"FloatBuffer",
",",
"multiplier",
"float64",
")",
"error",
"{",
"if",
"buf",
"==",
"nil",
"{",
"return",
"<mask>",
".",
"ErrInvalidBuffer",
"\n",
"}",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"buf",
".",
"Data",
")",
";",
"i",
"++",
"{",
"buf",
".",
"Data",
"[",
"i",
"]",
"*=",
"multiplier",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
22,924 | all-22925 | [
"Enabled",
"returns",
"whether",
"an",
"API",
"s",
"capabilities",
"are",
"enabled",
".",
"The",
"wildcard",
"*",
"capability",
"matches",
"every",
"capability",
"of",
"an",
"API",
".",
"If",
"the",
"underlying",
"RPC",
"fails",
"(",
"if",
"the",
"package",
"is",
"unknown",
"for",
"example",
")",
"false",
"is",
"returned",
"and",
"information",
"is",
"written",
"to",
"the",
"application",
"log",
"."
] | [
"func",
"Enabled",
"(",
"ctx",
"context",
".",
"Context",
",",
"api",
",",
"capability",
"string",
")",
"bool",
"{",
"req",
":=",
"&",
"<mask>",
".",
"IsEnabledRequest",
"{",
"Package",
":",
"&",
"api",
",",
"Capability",
":",
"[",
"]",
"string",
"{",
"capability",
"}",
",",
"}",
"\n",
"res",
":=",
"&",
"pb",
".",
"IsEnabledResponse",
"{",
"}",
"\n",
"if",
"err",
":=",
"internal",
".",
"Call",
"(",
"ctx",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"res",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Warningf",
"(",
"ctx",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"false",
"\n",
"}",
"\n",
"switch",
"*",
"res",
".",
"SummaryStatus",
"{",
"case",
"pb",
".",
"IsEnabledResponse_ENABLED",
",",
"pb",
".",
"IsEnabledResponse_SCHEDULED_FUTURE",
",",
"pb",
".",
"IsEnabledResponse_SCHEDULED_NOW",
":",
"return",
"true",
"\n",
"case",
"pb",
".",
"IsEnabledResponse_UNKNOWN",
":",
"log",
".",
"Errorf",
"(",
"ctx",
",",
"\"",
"\"",
",",
"api",
",",
"capability",
")",
"\n",
"return",
"false",
"\n",
"default",
":",
"return",
"false",
"\n",
"}",
"\n",
"}"
] |
22,925 | all-22926 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"Style",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss5",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
22,926 | all-22927 | [
"resolvePaths",
"is",
"a",
"modified",
"copy",
"of",
"k8s",
".",
"io",
"/",
"kubernetes",
"/",
"pkg",
"/",
"client",
"/",
"unversioned",
"/",
"clientcmd",
".",
"ClientConfigLoadingRules",
".",
"resolvePaths",
".",
"ResolvePaths",
"updates",
"the",
"given",
"refs",
"to",
"be",
"absolute",
"paths",
"relative",
"to",
"the",
"given",
"base",
"directory"
] | [
"func",
"resolvePaths",
"(",
"refs",
"[",
"]",
"*",
"string",
",",
"base",
"string",
")",
"error",
"{",
"for",
"_",
",",
"ref",
":=",
"<mask>",
"refs",
"{",
"// Don't resolve empty paths",
"if",
"len",
"(",
"*",
"ref",
")",
">",
"0",
"{",
"// Don't resolve absolute paths",
"if",
"!",
"filepath",
".",
"IsAbs",
"(",
"*",
"ref",
")",
"{",
"*",
"ref",
"=",
"filepath",
".",
"Join",
"(",
"base",
",",
"*",
"ref",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,927 | all-22928 | [
"DeleteRecordSet",
"deletes",
"recordset",
"in",
"the",
"given",
"DNS",
"zone"
] | [
"func",
"(",
"c",
"designateClient",
")",
"DeleteRecordSet",
"(",
"zoneID",
",",
"recordSetID",
"string",
")",
"<mask>",
"{",
"return",
"recordsets",
".",
"Delete",
"(",
"c",
".",
"serviceClient",
",",
"zoneID",
",",
"recordSetID",
")",
".",
"ExtractErr",
"(",
")",
"\n",
"}"
] |
22,928 | all-22929 | [
"YRoot",
"returns",
"the",
"y",
"coordinate",
"of",
"the",
"pointer",
"relative",
"to",
"the",
"root",
"of",
"the",
"screen",
"."
] | [
"func",
"(",
"v",
"*",
"EventButton",
")",
"YRoot",
"(",
")",
"float64",
"{",
"c",
":=",
"v",
".",
"native",
"(",
")",
".",
"y_root",
"\n",
"<mask>",
"float64",
"(",
"c",
")",
"\n",
"}"
] |
22,929 | all-22930 | [
"HasTitleSize",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"ToplistDefinition",
")",
"HasTitleSize",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"TitleSize",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
22,930 | all-22931 | [
"GetRaw",
"returns",
"the",
"value",
"of",
"the",
"given",
"key",
"which",
"must",
"be",
"of",
"type",
"String",
"."
] | [
"func",
"(",
"m",
"*",
"Map",
")",
"GetRaw",
"(",
"name",
"string",
")",
"string",
"{",
"key",
":=",
"m",
".",
"schema",
".",
"mustGetKey",
"(",
"name",
")",
"\n",
"value",
",",
"ok",
":=",
"m",
".",
"values",
"[",
"name",
"]",
"\n",
"if",
"!",
"ok",
"{",
"value",
"=",
"key",
".",
"<mask>",
"\n",
"}",
"\n",
"return",
"value",
"\n",
"}"
] |
22,931 | all-22932 | [
"ReadLimitBody",
"reads",
"response",
"from",
"the",
"given",
"r",
"limiting",
"the",
"body",
"size",
".",
"If",
"maxBodySize",
">",
"0",
"and",
"the",
"body",
"size",
"exceeds",
"maxBodySize",
"then",
"ErrBodyTooLarge",
"is",
"returned",
".",
"io",
".",
"EOF",
"is",
"returned",
"if",
"r",
"is",
"closed",
"before",
"reading",
"the",
"first",
"header",
"byte",
"."
] | [
"func",
"(",
"resp",
"*",
"Response",
")",
"ReadLimitBody",
"(",
"r",
"*",
"bufio",
".",
"Reader",
",",
"maxBodySize",
"int",
")",
"error",
"{",
"resp",
".",
"resetSkipHeader",
"(",
")",
"\n",
"err",
":=",
"resp",
".",
"Header",
".",
"Read",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"resp",
".",
"Header",
".",
"StatusCode",
"(",
")",
"==",
"StatusContinue",
"{",
"// Read the next response according to http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html .",
"if",
"err",
"=",
"resp",
".",
"Header",
".",
"Read",
"(",
"r",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"!",
"resp",
".",
"mustSkipBody",
"(",
")",
"{",
"bodyBuf",
":=",
"resp",
".",
"bodyBuffer",
"(",
")",
"\n",
"bodyBuf",
".",
"Reset",
"(",
")",
"\n",
"bodyBuf",
".",
"B",
",",
"err",
"=",
"readBody",
"(",
"r",
",",
"resp",
".",
"Header",
".",
"ContentLength",
"(",
")",
",",
"maxBodySize",
",",
"bodyBuf",
".",
"B",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"resp",
".",
"<mask>",
".",
"SetContentLength",
"(",
"len",
"(",
"bodyBuf",
".",
"B",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,932 | all-22933 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"ScreenshotParamsFormat",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"out",
".",
"<mask>",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
] |
22,933 | all-22934 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniform3ui",
"(",
"program",
"uint32",
",",
"<mask>",
"int32",
",",
"v0",
"uint32",
",",
"v1",
"uint32",
",",
"v2",
"uint32",
")",
"{",
"C",
".",
"glowProgramUniform3ui",
"(",
"gpProgramUniform3ui",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"location",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"v0",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"v1",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"v2",
")",
")",
"\n",
"}"
] |
22,934 | all-22935 | [
"IsPtr",
"returns",
"true",
"if",
"we",
"guess",
"it",
"s",
"a",
"pointer",
".",
"It",
"s",
"only",
"a",
"guess",
"it",
"can",
"be",
"easily",
"be",
"confused",
"by",
"a",
"bitmask",
"."
] | [
"func",
"(",
"a",
"*",
"Arg",
")",
"IsPtr",
"(",
")",
"bool",
"{",
"// Assumes all pointers are above 16Mb and positive.",
"return",
"a",
".",
"<mask>",
">",
"16",
"*",
"1024",
"*",
"1024",
"&&",
"a",
".",
"Value",
"<",
"math",
".",
"MaxInt64",
"\n",
"}"
] |
22,935 | all-22936 | [
"NewForConfigOrDie",
"creates",
"a",
"new",
"Clientset",
"for",
"the",
"given",
"config",
"and",
"panics",
"if",
"there",
"is",
"an",
"error",
"in",
"the",
"config",
"."
] | [
"func",
"NewForConfigOrDie",
"(",
"c",
"*",
"rest",
".",
"Config",
")",
"*",
"Clientset",
"{",
"var",
"cs",
"Clientset",
"\n",
"<mask>",
".",
"prowV1",
"=",
"prowv1",
".",
"NewForConfigOrDie",
"(",
"c",
")",
"\n\n",
"cs",
".",
"DiscoveryClient",
"=",
"discovery",
".",
"NewDiscoveryClientForConfigOrDie",
"(",
"c",
")",
"\n",
"return",
"&",
"cs",
"\n",
"}"
] |
22,936 | all-22937 | [
"Verify",
"that",
"leafHash",
"is",
"a",
"leaf",
"hash",
"of",
"the",
"simple",
"-",
"merkle",
"-",
"tree",
"which",
"hashes",
"to",
"rootHash",
"."
] | [
"func",
"(",
"sp",
"*",
"SimpleProof",
")",
"Verify",
"(",
"index",
"int",
",",
"total",
"int",
",",
"leafHash",
"[",
"]",
"byte",
",",
"rootHash",
"[",
"]",
"<mask>",
")",
"bool",
"{",
"computedHash",
":=",
"computeHashFromAunts",
"(",
"index",
",",
"total",
",",
"leafHash",
",",
"sp",
".",
"Aunts",
")",
"\n",
"return",
"computedHash",
"!=",
"nil",
"&&",
"bytes",
".",
"Equal",
"(",
"computedHash",
",",
"rootHash",
")",
"\n",
"}"
] |
22,937 | all-22938 | [
"bind",
"a",
"user",
"-",
"defined",
"varying",
"out",
"variable",
"to",
"a",
"fragment",
"shader",
"color",
"number",
"and",
"index"
] | [
"func",
"BindFragDataLocationIndexed",
"(",
"program",
"uint32",
",",
"colorNumber",
"uint32",
",",
"index",
"uint32",
",",
"name",
"*",
"uint8",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpBindFragDataLocationIndexed",
",",
"4",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"colorNumber",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"name",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
22,938 | all-22939 | [
"replicateTo",
"is",
"a",
"helper",
"to",
"replicate",
"()",
"used",
"to",
"replicate",
"the",
"logs",
"up",
"to",
"a",
"given",
"last",
"index",
".",
"If",
"the",
"follower",
"log",
"is",
"behind",
"we",
"take",
"care",
"to",
"bring",
"them",
"up",
"to",
"date",
"."
] | [
"func",
"(",
"r",
"*",
"Raft",
")",
"replicateTo",
"(",
"s",
"*",
"followerReplication",
",",
"lastIndex",
"uint64",
")",
"(",
"shouldStop",
"bool",
")",
"{",
"// Create the base request",
"var",
"req",
"AppendEntriesRequest",
"\n",
"var",
"resp",
"AppendEntriesResponse",
"\n",
"var",
"start",
"time",
".",
"Time",
"\n",
"START",
":",
"// Prevent an excessive retry rate on errors",
"if",
"s",
".",
"failures",
">",
"0",
"{",
"select",
"{",
"case",
"<-",
"time",
".",
"After",
"(",
"backoff",
"(",
"failureWait",
",",
"s",
".",
"failures",
",",
"maxFailureScale",
")",
")",
":",
"case",
"<-",
"r",
".",
"shutdownCh",
":",
"}",
"\n",
"}",
"\n\n",
"// Setup the request",
"if",
"err",
":=",
"r",
".",
"setupAppendEntries",
"(",
"s",
",",
"&",
"req",
",",
"s",
".",
"nextIndex",
",",
"lastIndex",
")",
";",
"err",
"==",
"ErrLogNotFound",
"{",
"goto",
"SEND_SNAP",
"\n",
"}",
"else",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"// Make the RPC call",
"start",
"=",
"time",
".",
"Now",
"(",
")",
"\n",
"if",
"err",
":=",
"r",
".",
"trans",
".",
"AppendEntries",
"(",
"s",
".",
"peer",
".",
"ID",
",",
"s",
".",
"peer",
".",
"<mask>",
",",
"&",
"req",
",",
"&",
"resp",
")",
";",
"err",
"!=",
"nil",
"{",
"r",
".",
"logger",
".",
"Error",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"s",
".",
"peer",
",",
"err",
")",
")",
"\n",
"s",
".",
"failures",
"++",
"\n",
"return",
"\n",
"}",
"\n",
"appendStats",
"(",
"string",
"(",
"s",
".",
"peer",
".",
"ID",
")",
",",
"start",
",",
"float32",
"(",
"len",
"(",
"req",
".",
"Entries",
")",
")",
")",
"\n\n",
"// Check for a newer term, stop running",
"if",
"resp",
".",
"Term",
">",
"req",
".",
"Term",
"{",
"r",
".",
"handleStaleTerm",
"(",
"s",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n\n",
"// Update the last contact",
"s",
".",
"setLastContact",
"(",
")",
"\n\n",
"// Update s based on success",
"if",
"resp",
".",
"Success",
"{",
"// Update our replication state",
"updateLastAppended",
"(",
"s",
",",
"&",
"req",
")",
"\n\n",
"// Clear any failures, allow pipelining",
"s",
".",
"failures",
"=",
"0",
"\n",
"s",
".",
"allowPipeline",
"=",
"true",
"\n",
"}",
"else",
"{",
"s",
".",
"nextIndex",
"=",
"max",
"(",
"min",
"(",
"s",
".",
"nextIndex",
"-",
"1",
",",
"resp",
".",
"LastLog",
"+",
"1",
")",
",",
"1",
")",
"\n",
"if",
"resp",
".",
"NoRetryBackoff",
"{",
"s",
".",
"failures",
"=",
"0",
"\n",
"}",
"else",
"{",
"s",
".",
"failures",
"++",
"\n",
"}",
"\n",
"r",
".",
"logger",
".",
"Warn",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"s",
".",
"peer",
",",
"s",
".",
"nextIndex",
")",
")",
"\n",
"}",
"\n\n",
"CHECK_MORE",
":",
"// Poll the stop channel here in case we are looping and have been asked",
"// to stop, or have stepped down as leader. Even for the best effort case",
"// where we are asked to replicate to a given index and then shutdown,",
"// it's better to not loop in here to send lots of entries to a straggler",
"// that's leaving the cluster anyways.",
"select",
"{",
"case",
"<-",
"s",
".",
"stopCh",
":",
"return",
"true",
"\n",
"default",
":",
"}",
"\n\n",
"// Check if there are more logs to replicate",
"if",
"s",
".",
"nextIndex",
"<=",
"lastIndex",
"{",
"goto",
"START",
"\n",
"}",
"\n",
"return",
"\n\n",
"// SEND_SNAP is used when we fail to get a log, usually because the follower",
"// is too far behind, and we must ship a snapshot down instead",
"SEND_SNAP",
":",
"if",
"stop",
",",
"err",
":=",
"r",
".",
"sendLatestSnapshot",
"(",
"s",
")",
";",
"stop",
"{",
"return",
"true",
"\n",
"}",
"else",
"if",
"err",
"!=",
"nil",
"{",
"r",
".",
"logger",
".",
"Error",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"s",
".",
"peer",
",",
"err",
")",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// Check if there is more to replicate",
"goto",
"CHECK_MORE",
"\n",
"}"
] |
22,939 | all-22940 | [
"BytesMap",
"maps",
"a",
"function",
"on",
"each",
"element",
"of",
"a",
"slice",
"of",
"bytes",
"."
] | [
"func",
"BytesMap",
"(",
"f",
"func",
"(",
"byte",
")",
"byte",
",",
"data",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"size",
":=",
"len",
"(",
"data",
")",
"\n",
"result",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"size",
",",
"size",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
"{",
"<mask>",
"[",
"i",
"]",
"=",
"f",
"(",
"data",
"[",
"i",
"]",
")",
"\n",
"}",
"\n",
"return",
"result",
"\n",
"}"
] |
22,940 | all-22941 | [
"TriggerMatches",
"returns",
"true",
"if",
"the",
"comment",
"body",
"should",
"trigger",
"this",
"presubmit",
".",
"This",
"is",
"usually",
"a",
"/",
"test",
"foo",
"string",
"."
] | [
"func",
"(",
"ps",
"Presubmit",
")",
"TriggerMatches",
"(",
"body",
"string",
")",
"bool",
"{",
"return",
"ps",
".",
"Trigger",
"!=",
"\"",
"\"",
"&&",
"ps",
".",
"<mask>",
".",
"MatchString",
"(",
"body",
")",
"\n",
"}"
] |
22,941 | all-22942 | [
"GetServiceOk",
"returns",
"a",
"tuple",
"with",
"the",
"Service",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TraceServiceDefinition",
")",
"GetServiceOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Service",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"Service",
",",
"<mask>",
"\n",
"}"
] |
22,942 | all-22943 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"StickyPositionConstraint",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoLayertree",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
22,943 | all-22944 | [
"New",
"generator",
"for",
"adding",
"VCS",
"to",
"an",
"application"
] | [
"func",
"New",
"(",
"opts",
"*",
"Options",
")",
"(",
"*",
"genny",
".",
"Generator",
",",
"error",
")",
"{",
"g",
":=",
"genny",
".",
"New",
"(",
")",
"\n\n",
"if",
"err",
":=",
"opts",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"g",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"opts",
".",
"Provider",
"==",
"\"",
"\"",
"{",
"return",
"g",
",",
"nil",
"\n",
"}",
"\n\n",
"box",
":=",
"packr",
".",
"New",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"s",
",",
"err",
":=",
"box",
".",
"FindString",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"g",
",",
"err",
"\n",
"}",
"\n\n",
"p",
":=",
"opts",
".",
"Provider",
"\n",
"n",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"p",
")",
"\n",
"g",
".",
"File",
"(",
"genny",
".",
"NewFileS",
"(",
"n",
",",
"s",
")",
")",
"\n",
"g",
".",
"Command",
"(",
"exec",
".",
"Command",
"(",
"p",
",",
"\"",
"\"",
")",
")",
"\n\n",
"args",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"\n",
"if",
"p",
"==",
"\"",
"\"",
"{",
"// Ensure Bazaar is as quiet as Git",
"args",
"=",
"append",
"(",
"args",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"g",
".",
"Command",
"(",
"<mask>",
".",
"Command",
"(",
"p",
",",
"args",
"...",
")",
")",
"\n",
"g",
".",
"Command",
"(",
"exec",
".",
"Command",
"(",
"p",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
")",
"\n",
"return",
"g",
",",
"nil",
"\n",
"}"
] |
22,944 | all-22945 | [
"TODO",
"(",
"jrick",
")",
"GtkIconSet",
"/",
"*",
"func",
"(",
"v",
"*",
"Image",
")",
"GetIconSet",
"()",
"{",
"}",
"TODO",
"(",
"jrick",
")",
"GdkPixbufAnimation",
"/",
"*",
"func",
"(",
"v",
"*",
"Image",
")",
"GetAnimation",
"()",
"{",
"}",
"GetIconName",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_image_get_icon_name",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Image",
")",
"GetIconName",
"(",
")",
"(",
"string",
",",
"IconSize",
")",
"{",
"var",
"iconName",
"*",
"C",
".",
"gchar",
"\n",
"var",
"size",
"C",
".",
"GtkIconSize",
"\n",
"C",
".",
"gtk_image_get_icon_name",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"iconName",
",",
"&",
"size",
")",
"\n",
"return",
"goString",
"(",
"iconName",
")",
",",
"IconSize",
"(",
"<mask>",
")",
"\n",
"}"
] |
22,945 | all-22946 | [
"MarshalText",
"implements",
"the",
"TextMarshaler",
"interface",
"."
] | [
"func",
"(",
"l",
"List",
")",
"MarshalText",
"(",
")",
"(",
"text",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"var",
"buf",
"bytes",
".",
"<mask>",
"\n",
"l",
".",
"writeToBuffer",
"(",
"&",
"buf",
")",
"\n",
"return",
"buf",
".",
"Bytes",
"(",
")",
",",
"nil",
"\n",
"}"
] |
22,946 | all-22947 | [
"Allow",
"allows",
"permission",
"mode",
"for",
"roles"
] | [
"func",
"Allow",
"(",
"mode",
"PermissionMode",
",",
"roles",
"...",
"string",
")",
"*",
"Permission",
"{",
"return",
"Global",
".",
"Allow",
"(",
"<mask>",
",",
"roles",
"...",
")",
"\n",
"}"
] |
22,947 | all-22948 | [
"GetTag",
"gets",
"an",
"object",
"out",
"of",
"the",
"object",
"store",
"by",
"tag",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"GetTag",
"(",
"<mask>",
"string",
",",
"writer",
"io",
".",
"Writer",
")",
"error",
"{",
"getTagClient",
",",
"err",
":=",
"c",
".",
"ObjectAPIClient",
".",
"GetTag",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"pfs",
".",
"Tag",
"{",
"Name",
":",
"tag",
"}",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"grpcutil",
".",
"WriteFromStreamingBytesClient",
"(",
"getTagClient",
",",
"writer",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,948 | all-22949 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetHistogramsReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser11",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
22,949 | all-22950 | [
"Advertise",
"advertises",
"with",
"Hyperbahn",
"."
] | [
"func",
"(",
"s",
"*",
"internalServer",
")",
"Advertise",
"(",
"hyperbahnHosts",
"[",
"]",
"string",
")",
"error",
"{",
"config",
":=",
"hyperbahn",
".",
"<mask>",
"{",
"InitialNodes",
":",
"hyperbahnHosts",
"}",
"\n",
"hc",
",",
"err",
":=",
"hyperbahn",
".",
"NewClient",
"(",
"s",
".",
"ch",
",",
"config",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
"+",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"hc",
".",
"Advertise",
"(",
")",
"\n",
"}"
] |
22,950 | all-22951 | [
"Close",
"closes",
"all",
"currently",
"open",
"connections",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"Close",
"(",
")",
"error",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"c",
".",
"closeIdleConns",
"(",
")",
"\n",
"c",
".",
"freeconn",
"=",
"nil",
"\n",
"c",
".",
"maxIdlePerAddr",
"=",
"0",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,951 | all-22952 | [
"AddRawJob",
"helper",
"to",
"add",
"a",
"job",
"to",
"the",
"pipeline",
"manifest"
] | [
"func",
"(",
"s",
"*",
"ConcoursePipeline",
")",
"AddRawJob",
"(",
"<mask>",
"atc",
".",
"JobConfig",
")",
"{",
"s",
".",
"Jobs",
"=",
"append",
"(",
"s",
".",
"Jobs",
",",
"job",
")",
"\n",
"}"
] |
22,952 | all-22953 | [
"WithPageRanges",
"paper",
"ranges",
"to",
"print",
"e",
".",
"g",
".",
"1",
"-",
"5",
"8",
"11",
"-",
"13",
".",
"Defaults",
"to",
"the",
"empty",
"string",
"which",
"means",
"print",
"all",
"pages",
"."
] | [
"func",
"(",
"p",
"PrintToPDFParams",
")",
"WithPageRanges",
"(",
"pageRanges",
"<mask>",
")",
"*",
"PrintToPDFParams",
"{",
"p",
".",
"PageRanges",
"=",
"pageRanges",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
22,953 | all-22954 | [
"NewLogCache",
"is",
"used",
"to",
"create",
"a",
"new",
"LogCache",
"with",
"the",
"given",
"capacity",
"and",
"backend",
"store",
"."
] | [
"func",
"NewLogCache",
"(",
"capacity",
"int",
",",
"store",
"LogStore",
")",
"(",
"*",
"LogCache",
",",
"error",
")",
"{",
"if",
"capacity",
"<=",
"0",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"c",
":=",
"&",
"LogCache",
"{",
"store",
":",
"<mask>",
",",
"cache",
":",
"make",
"(",
"[",
"]",
"*",
"Log",
",",
"capacity",
")",
",",
"}",
"\n",
"return",
"c",
",",
"nil",
"\n",
"}"
] |
22,954 | all-22955 | [
"SetKey",
"sets",
"cookie",
"name",
"."
] | [
"func",
"(",
"c",
"*",
"Cookie",
")",
"SetKey",
"(",
"<mask>",
"string",
")",
"{",
"c",
".",
"key",
"=",
"append",
"(",
"c",
".",
"key",
"[",
":",
"0",
"]",
",",
"key",
"...",
")",
"\n",
"}"
] |
22,955 | all-22956 | [
"Next",
"returns",
"the",
"next",
"page",
"of",
"resources",
".",
"We",
"may",
"need",
"to",
"fetch",
"multiple",
"pages",
"from",
"the",
"Twilio",
"API",
"before",
"we",
"find",
"one",
"in",
"the",
"right",
"date",
"range",
"so",
"latency",
"may",
"be",
"higher",
"than",
"usual",
".",
"If",
"page",
"is",
"non",
"-",
"nil",
"it",
"contains",
"at",
"least",
"one",
"result",
"."
] | [
"func",
"(",
"c",
"*",
"callDateIterator",
")",
"Next",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"CallPage",
",",
"error",
")",
"{",
"var",
"page",
"*",
"CallPage",
"\n",
"for",
"{",
"// just wipe it clean every time to avoid remnants hanging around",
"page",
"=",
"new",
"(",
"CallPage",
")",
"\n",
"if",
"err",
":=",
"c",
".",
"p",
".",
"Next",
"(",
"ctx",
",",
"page",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"page",
".",
"Calls",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"NoMoreResults",
"\n",
"}",
"\n",
"times",
":=",
"make",
"(",
"[",
"]",
"time",
".",
"Time",
",",
"len",
"(",
"page",
".",
"Calls",
")",
",",
"len",
"(",
"page",
".",
"Calls",
")",
")",
"\n",
"for",
"i",
",",
"call",
":=",
"range",
"page",
".",
"Calls",
"{",
"if",
"!",
"call",
".",
"DateCreated",
".",
"Valid",
"{",
"// we really should not ever hit this case but if we can't parse",
"// a date, better to give you back an error than to give you back",
"// a list of calls that may or may not be in the time range",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"call",
")",
"\n",
"}",
"\n",
"<mask>",
"[",
"i",
"]",
"=",
"call",
".",
"DateCreated",
".",
"Time",
"\n",
"}",
"\n",
"if",
"containsResultsInRange",
"(",
"c",
".",
"start",
",",
"c",
".",
"end",
",",
"times",
")",
"{",
"indexesToDelete",
":=",
"indexesOutsideRange",
"(",
"c",
".",
"start",
",",
"c",
".",
"end",
",",
"times",
")",
"\n",
"// reverse order so we don't delete the wrong index",
"for",
"i",
":=",
"len",
"(",
"indexesToDelete",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
"{",
"index",
":=",
"indexesToDelete",
"[",
"i",
"]",
"\n",
"page",
".",
"Calls",
"=",
"append",
"(",
"page",
".",
"Calls",
"[",
":",
"index",
"]",
",",
"page",
".",
"Calls",
"[",
"index",
"+",
"1",
":",
"]",
"...",
")",
"\n",
"}",
"\n",
"c",
".",
"p",
".",
"SetNextPageURI",
"(",
"page",
".",
"NextPageURI",
")",
"\n",
"return",
"page",
",",
"nil",
"\n",
"}",
"\n",
"if",
"shouldContinuePaging",
"(",
"c",
".",
"start",
",",
"times",
")",
"{",
"c",
".",
"p",
".",
"SetNextPageURI",
"(",
"page",
".",
"NextPageURI",
")",
"\n",
"continue",
"\n",
"}",
"else",
"{",
"// should not continue paging and no results in range, stop",
"return",
"nil",
",",
"NoMoreResults",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
22,956 | all-22957 | [
"StartServer",
"starts",
"a",
"remote",
"Pact",
"Mock",
"Server",
"."
] | [
"func",
"(",
"p",
"*",
"mockClient",
")",
"StartServer",
"(",
"args",
"[",
"]",
"string",
",",
"<mask>",
"int",
")",
"*",
"types",
".",
"MockServer",
"{",
"return",
"p",
".",
"MockServer",
"\n",
"}"
] |
22,957 | all-22958 | [
"setupUnixDevice",
"()",
"creates",
"the",
"unix",
"device",
"and",
"sets",
"up",
"the",
"necessary",
"low",
"-",
"level",
"liblxc",
"configuration",
"items",
"."
] | [
"func",
"(",
"c",
"*",
"containerLXC",
")",
"setupUnixDevice",
"(",
"prefix",
"string",
",",
"dev",
"types",
".",
"Device",
",",
"major",
"int",
",",
"minor",
"int",
",",
"path",
"string",
",",
"createMustSucceed",
"bool",
",",
"defaultMode",
"bool",
")",
"error",
"{",
"if",
"c",
".",
"isCurrentlyPrivileged",
"(",
")",
"&&",
"!",
"c",
".",
"state",
".",
"OS",
".",
"RunningInUserNS",
"&&",
"c",
".",
"state",
".",
"OS",
".",
"CGroupDevicesController",
"{",
"err",
":=",
"lxcSetConfigItem",
"(",
"c",
".",
"c",
",",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"major",
",",
"minor",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"temp",
":=",
"types",
".",
"Device",
"{",
"}",
"\n",
"err",
":=",
"shared",
".",
"DeepCopy",
"(",
"&",
"dev",
",",
"&",
"temp",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"temp",
"[",
"\"",
"\"",
"]",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"major",
")",
"\n",
"temp",
"[",
"\"",
"\"",
"]",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"minor",
")",
"\n",
"temp",
"[",
"\"",
"\"",
"]",
"=",
"path",
"\n\n",
"paths",
",",
"err",
":=",
"c",
".",
"createUnixDevice",
"(",
"<mask>",
",",
"temp",
",",
"defaultMode",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Debug",
"(",
"\"",
"\"",
",",
"log",
".",
"Ctx",
"{",
"\"",
"\"",
":",
"err",
",",
"\"",
"\"",
":",
"prefix",
"}",
")",
"\n",
"if",
"createMustSucceed",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"devPath",
":=",
"shared",
".",
"EscapePathFstab",
"(",
"paths",
"[",
"0",
"]",
")",
"\n",
"tgtPath",
":=",
"shared",
".",
"EscapePathFstab",
"(",
"paths",
"[",
"1",
"]",
")",
"\n",
"val",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"devPath",
",",
"tgtPath",
")",
"\n\n",
"return",
"lxcSetConfigItem",
"(",
"c",
".",
"c",
",",
"\"",
"\"",
",",
"val",
")",
"\n",
"}"
] |
22,958 | all-22959 | [
"HasType",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"c",
"*",
"CheckStatusDefinition",
")",
"HasType",
"(",
")",
"bool",
"{",
"if",
"c",
"!=",
"nil",
"&&",
"c",
".",
"<mask>",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
22,959 | all-22960 | [
"Parameter",
"image",
"has",
"type",
"C",
".",
"GLeglImageOES",
"."
] | [
"func",
"EGLImageTargetTextureStorageEXT",
"(",
"texture",
"uint32",
",",
"image",
"unsafe",
".",
"Pointer",
",",
"attrib_list",
"*",
"int32",
")",
"{",
"C",
".",
"glowEGLImageTargetTextureStorageEXT",
"(",
"gpEGLImageTargetTextureStorageEXT",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"texture",
")",
",",
"(",
"C",
".",
"GLeglImageOES",
")",
"(",
"<mask>",
")",
",",
"(",
"*",
"C",
".",
"GLint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"attrib_list",
")",
")",
")",
"\n",
"}"
] |
22,960 | all-22961 | [
"Load",
"all",
"containers",
"of",
"this",
"nodes",
"."
] | [
"func",
"containerLoadNodeAll",
"(",
"s",
"*",
"state",
".",
"State",
")",
"(",
"[",
"]",
"container",
",",
"error",
")",
"{",
"// Get all the container arguments",
"var",
"cts",
"[",
"]",
"db",
".",
"Container",
"\n",
"err",
":=",
"s",
".",
"Cluster",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"db",
".",
"ClusterTx",
")",
"error",
"{",
"<mask>",
"err",
"error",
"\n",
"cts",
",",
"err",
"=",
"tx",
".",
"ContainerNodeList",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"containerLoadAllInternal",
"(",
"cts",
",",
"s",
")",
"\n",
"}"
] |
22,961 | all-22962 | [
"OpenNode",
"creates",
"a",
"new",
"Node",
"object",
".",
"The",
"fresh",
"hook",
"parameter",
"is",
"used",
"by",
"the",
"daemon",
"to",
"mark",
"all",
"known",
"patch",
"names",
"as",
"applied",
"when",
"a",
"brand",
"new",
"database",
"is",
"created",
".",
"The",
"legacyPatches",
"parameter",
"is",
"used",
"as",
"a",
"mean",
"to",
"apply",
"the",
"legacy",
"V10",
"V11",
"V15",
"V29",
"and",
"V30",
"non",
"-",
"db",
"updates",
"during",
"the",
"database",
"upgrade",
"sequence",
"to",
"avoid",
"any",
"change",
"in",
"semantics",
"wrt",
"the",
"old",
"logic",
"(",
"see",
"PR",
"#3322",
")",
".",
"Return",
"the",
"newly",
"created",
"Node",
"object",
"and",
"a",
"Dump",
"of",
"the",
"pre",
"-",
"clustering",
"data",
"if",
"we",
"ve",
"migrating",
"to",
"a",
"cluster",
"-",
"aware",
"version",
"."
] | [
"func",
"OpenNode",
"(",
"dir",
"string",
",",
"fresh",
"func",
"(",
"*",
"Node",
")",
"error",
",",
"legacyPatches",
"map",
"[",
"int",
"]",
"*",
"LegacyPatch",
")",
"(",
"*",
"Node",
",",
"*",
"Dump",
",",
"error",
")",
"{",
"// When updating the node database schema we'll detect if we're",
"// transitioning to the dqlite-based database and dump all the data",
"// before purging the schema. This data will be then imported by the",
"// daemon into the dqlite database.",
"var",
"dump",
"*",
"Dump",
"\n\n",
"db",
",",
"err",
":=",
"node",
".",
"Open",
"(",
"dir",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"legacyHook",
":=",
"legacyPatchHook",
"(",
"db",
",",
"legacyPatches",
")",
"\n",
"<mask>",
":=",
"func",
"(",
"version",
"int",
",",
"tx",
"*",
"sql",
".",
"Tx",
")",
"error",
"{",
"if",
"version",
"==",
"node",
".",
"UpdateFromPreClustering",
"{",
"logger",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"var",
"err",
"error",
"\n",
"dump",
",",
"err",
"=",
"LoadPreClusteringData",
"(",
"tx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"legacyHook",
"(",
"version",
",",
"tx",
")",
"\n",
"}",
"\n",
"initial",
",",
"err",
":=",
"node",
".",
"EnsureSchema",
"(",
"db",
",",
"dir",
",",
"hook",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"node",
":=",
"&",
"Node",
"{",
"db",
":",
"db",
",",
"dir",
":",
"dir",
",",
"}",
"\n\n",
"if",
"initial",
"==",
"0",
"{",
"if",
"fresh",
"!=",
"nil",
"{",
"err",
":=",
"fresh",
"(",
"node",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"db",
".",
"SetMaxOpenConns",
"(",
"1",
")",
"\n",
"db",
".",
"SetMaxIdleConns",
"(",
"1",
")",
"\n\n",
"return",
"node",
",",
"dump",
",",
"nil",
"\n",
"}"
] |
22,962 | all-22963 | [
"SetSelectionMode",
"is",
"a",
"wrapper",
"around",
"gtk_flow_box_set_selection_mode",
"()"
] | [
"func",
"(",
"fb",
"*",
"FlowBox",
")",
"SetSelectionMode",
"(",
"<mask>",
"SelectionMode",
")",
"{",
"C",
".",
"gtk_flow_box_set_selection_mode",
"(",
"fb",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkSelectionMode",
"(",
"mode",
")",
")",
"\n",
"}"
] |
22,963 | all-22964 | [
"StripPunctuation",
"strips",
"puncation",
"from",
"string",
"."
] | [
"func",
"StripPunctuation",
"(",
"s",
"string",
")",
"<mask>",
"{",
"s",
"=",
"stripPuncRe",
".",
"ReplaceAllString",
"(",
"s",
",",
"\"",
"\"",
")",
"\n",
"s",
"=",
"nWhitespaceRe",
".",
"ReplaceAllString",
"(",
"s",
",",
"\"",
"\"",
")",
"\n",
"return",
"s",
"\n",
"}"
] |
22,964 | all-22965 | [
"Do",
"executes",
"Runtime",
".",
"getHeapUsage",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"usedSize",
"-",
"Used",
"heap",
"size",
"in",
"bytes",
".",
"totalSize",
"-",
"Allocated",
"heap",
"size",
"in",
"bytes",
"."
] | [
"func",
"(",
"p",
"*",
"GetHeapUsageParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"usedSize",
"float64",
",",
"totalSize",
"float64",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"GetHeapUsageReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetHeapUsage",
",",
"nil",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"UsedSize",
",",
"res",
".",
"TotalSize",
",",
"nil",
"\n",
"}"
] |
22,965 | all-22966 | [
"PresubmitSpec",
"initializes",
"a",
"ProwJobSpec",
"for",
"a",
"given",
"presubmit",
"job",
"."
] | [
"func",
"PresubmitSpec",
"(",
"p",
"config",
".",
"Presubmit",
",",
"refs",
"prowapi",
".",
"Refs",
")",
"prowapi",
".",
"ProwJobSpec",
"{",
"pjs",
":=",
"specFromJobBase",
"(",
"p",
".",
"JobBase",
")",
"\n",
"pjs",
".",
"Type",
"=",
"prowapi",
".",
"PresubmitJob",
"\n",
"pjs",
".",
"Context",
"=",
"p",
".",
"<mask>",
"\n",
"pjs",
".",
"Report",
"=",
"!",
"p",
".",
"SkipReport",
"\n",
"pjs",
".",
"RerunCommand",
"=",
"p",
".",
"RerunCommand",
"\n",
"if",
"p",
".",
"JenkinsSpec",
"!=",
"nil",
"{",
"pjs",
".",
"JenkinsSpec",
"=",
"&",
"prowapi",
".",
"JenkinsSpec",
"{",
"GitHubBranchSourceJob",
":",
"p",
".",
"JenkinsSpec",
".",
"GitHubBranchSourceJob",
",",
"}",
"\n",
"}",
"\n",
"pjs",
".",
"Refs",
"=",
"completePrimaryRefs",
"(",
"refs",
",",
"p",
".",
"JobBase",
")",
"\n\n",
"return",
"pjs",
"\n",
"}"
] |
22,966 | all-22967 | [
"HasTitle",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"h",
"*",
"HostmapDefinition",
")",
"HasTitle",
"(",
")",
"bool",
"{",
"if",
"h",
"!=",
"nil",
"&&",
"h",
".",
"Title",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
22,967 | all-22968 | [
"SetError",
"sets",
"e",
".",
"Error",
"to",
"the",
"JSON",
"representation",
"of",
"v",
".",
"If",
"JSON",
"marshaling",
"fails",
"it",
"panics",
"."
] | [
"func",
"(",
"e",
"*",
"<mask>",
")",
"SetError",
"(",
"v",
"interface",
"{",
"}",
")",
"{",
"b",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
"+",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"e",
".",
"Data",
"=",
"(",
"*",
"json",
".",
"RawMessage",
")",
"(",
"&",
"b",
")",
"\n",
"}"
] |
22,968 | all-22969 | [
"generate",
"sampler",
"object",
"names"
] | [
"func",
"GenSamplers",
"(",
"count",
"int32",
",",
"samplers",
"*",
"uint32",
")",
"{",
"C",
".",
"glowGenSamplers",
"(",
"gpGenSamplers",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"<mask>",
")",
",",
"(",
"*",
"C",
".",
"GLuint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"samplers",
")",
")",
")",
"\n",
"}"
] |
22,969 | all-22970 | [
"String",
"returns",
"a",
"lossy",
"string",
"representation",
"of",
"the",
"config",
"suitable",
"for",
"human",
"readable",
"display",
".",
"Consequently",
"it",
"*",
"should",
"not",
"*",
"return",
"any",
"sensitive",
"information",
"."
] | [
"func",
"(",
"cfg",
"*",
"Config",
")",
"<mask>",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"cfg",
".",
"Cluster",
",",
"cfg",
".",
"AWSRegion",
",",
"cfg",
".",
"DataDir",
",",
"cfg",
".",
"Checkpoint",
",",
"cfg",
".",
"EngineAuthType",
",",
"cfg",
".",
"UpdatesEnabled",
",",
"cfg",
".",
"DisableMetrics",
",",
"cfg",
".",
"PollMetrics",
",",
"cfg",
".",
"PollingMetricsWaitDuration",
",",
"cfg",
".",
"ReservedMemory",
",",
"cfg",
".",
"TaskCleanupWaitDuration",
",",
"cfg",
".",
"DockerStopTimeout",
",",
"cfg",
".",
"ContainerStartTimeout",
",",
"cfg",
".",
"TaskCPUMemLimit",
",",
"cfg",
".",
"platformString",
"(",
")",
",",
")",
"\n",
"}"
] |
22,970 | all-22971 | [
"Addrs",
"function"
] | [
"func",
"(",
"p",
"*",
"Provider",
")",
"Addrs",
"(",
"args",
"map",
"[",
"string",
"]",
"string",
",",
"l",
"*",
"log",
".",
"Logger",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"authToken",
":=",
"argsOrEnv",
"(",
"args",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"projectID",
":=",
"argsOrEnv",
"(",
"args",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"packetURL",
":=",
"argsOrEnv",
"(",
"args",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"addressType",
":=",
"args",
"[",
"\"",
"\"",
"]",
"\n",
"packetFacilities",
":=",
"args",
"[",
"\"",
"\"",
"]",
"\n",
"packetTags",
":=",
"args",
"[",
"\"",
"\"",
"]",
"\n\n",
"if",
"addressType",
"!=",
"\"",
"\"",
"&&",
"addressType",
"!=",
"\"",
"\"",
"&&",
"addressType",
"!=",
"\"",
"\"",
"{",
"l",
".",
"Printf",
"(",
"\"",
"\"",
",",
"addressType",
")",
"\n",
"addressType",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"includeFacilities",
":=",
"includeArgs",
"(",
"packetFacilities",
")",
"\n",
"includeTags",
":=",
"includeArgs",
"(",
"packetTags",
")",
"\n\n",
"c",
",",
"err",
":=",
"client",
"(",
"p",
".",
"userAgent",
",",
"packetURL",
",",
"authToken",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"var",
"devices",
"[",
"]",
"packngo",
".",
"Device",
"\n\n",
"if",
"projectID",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"<mask>",
",",
"_",
",",
"err",
"=",
"c",
".",
"Devices",
".",
"List",
"(",
"projectID",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"var",
"addrs",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"d",
":=",
"range",
"devices",
"{",
"if",
"len",
"(",
"includeFacilities",
")",
">",
"0",
"&&",
"!",
"Include",
"(",
"includeFacilities",
",",
"d",
".",
"Facility",
".",
"Code",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"includeTags",
")",
">",
"0",
"&&",
"!",
"Any",
"(",
"d",
".",
"Tags",
",",
"func",
"(",
"v",
"string",
")",
"bool",
"{",
"return",
"Include",
"(",
"includeTags",
",",
"v",
")",
"}",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"addressFamily",
":=",
"4",
"\n",
"if",
"addressType",
"==",
"\"",
"\"",
"{",
"addressFamily",
"=",
"6",
"\n",
"}",
"\n",
"for",
"_",
",",
"n",
":=",
"range",
"d",
".",
"Network",
"{",
"if",
"(",
"n",
".",
"Public",
"==",
"(",
"addressType",
"==",
"\"",
"\"",
"||",
"addressType",
"==",
"\"",
"\"",
")",
")",
"&&",
"n",
".",
"AddressFamily",
"==",
"addressFamily",
"{",
"addrs",
"=",
"append",
"(",
"addrs",
",",
"n",
".",
"Address",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"addrs",
",",
"nil",
"\n",
"}"
] |
22,971 | all-22972 | [
"===",
"sum_over_time",
"(",
"Matrix",
"ValueTypeMatrix",
")",
"Vector",
"==="
] | [
"func",
"funcSumOverTime",
"(",
"vals",
"[",
"]",
"Value",
",",
"args",
"Expressions",
",",
"enh",
"*",
"EvalNodeHelper",
")",
"<mask>",
"{",
"return",
"aggrOverTime",
"(",
"vals",
",",
"enh",
",",
"func",
"(",
"values",
"[",
"]",
"Point",
")",
"float64",
"{",
"var",
"sum",
"float64",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"values",
"{",
"sum",
"+=",
"v",
".",
"V",
"\n",
"}",
"\n",
"return",
"sum",
"\n",
"}",
")",
"\n",
"}"
] |
22,972 | all-22973 | [
"LogField",
"adds",
"the",
"key",
"/",
"value",
"pair",
"onto",
"the",
"Logger",
"to",
"be",
"printed",
"out",
"as",
"part",
"of",
"the",
"request",
"logging",
".",
"This",
"allows",
"you",
"to",
"easily",
"add",
"things",
"like",
"metrics",
"(",
"think",
"DB",
"times",
")",
"to",
"your",
"request",
"."
] | [
"func",
"(",
"d",
"*",
"DefaultContext",
")",
"LogField",
"(",
"key",
"string",
",",
"value",
"<mask>",
"{",
"}",
")",
"{",
"d",
".",
"logger",
"=",
"d",
".",
"logger",
".",
"WithField",
"(",
"key",
",",
"value",
")",
"\n",
"}"
] |
22,973 | all-22974 | [
"GetURLOk",
"returns",
"a",
"tuple",
"with",
"the",
"URL",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetURLOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"URL",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"<mask>",
",",
"true",
"\n",
"}"
] |
22,974 | all-22975 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GPUInfo",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoSysteminfo5",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
22,975 | all-22976 | [
"CloseNotify",
"return",
"true",
"across",
"the",
"channel",
"when",
"the",
"connection",
"in",
"the",
"browser",
"has",
"been",
"severed",
"."
] | [
"func",
"(",
"es",
"*",
"EventSource",
")",
"CloseNotify",
"(",
")",
"<-",
"chan",
"bool",
"{",
"if",
"cn",
",",
"ok",
":=",
"es",
".",
"w",
".",
"(",
"closeNotifier",
")",
";",
"<mask>",
"{",
"return",
"cn",
".",
"CloseNotify",
"(",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,976 | all-22977 | [
"LastError",
"returns",
"the",
"last",
"non",
"nil",
"error",
"or",
"nil"
] | [
"func",
"LastError",
"(",
"errs",
"...",
"error",
")",
"<mask>",
"{",
"for",
"i",
":=",
"len",
"(",
"errs",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
"{",
"err",
":=",
"errs",
"[",
"i",
"]",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,977 | all-22978 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
] | [
"func",
"(",
"r",
"*",
"Cloud",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"CloudLocator",
"{",
"<mask>",
"api",
".",
"CloudLocator",
"(",
"r",
".",
"Href",
")",
"\n",
"}"
] |
22,978 | all-22979 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GrantPermissionsParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser4",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
22,979 | all-22980 | [
"RequestSelectionNotification",
"()",
"is",
"a",
"wrapper",
"around",
"gdk_display_request_selection_notification",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Display",
")",
"RequestSelectionNotification",
"(",
"selection",
"Atom",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gdk_display_request_selection_notification",
"(",
"v",
".",
"native",
"(",
")",
",",
"<mask>",
".",
"native",
"(",
")",
")",
"\n",
"return",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
22,980 | all-22981 | [
"New",
"creates",
"a",
"new",
"bench",
"and",
"intializes",
"the",
"intial",
"values",
"of",
"...",
"threads",
":",
"the",
"number",
"of",
"concurrent",
"threads",
"to",
"execute",
"duration",
":",
"the",
"duration",
"to",
"run",
"the",
"benchmarks",
"for",
"rampUp",
":",
"the",
"duration",
"before",
"the",
"maximum",
"number",
"of",
"threads",
"is",
"achieved",
"timeout",
":",
"the",
"timeout",
"value",
"request",
":",
"the",
"Request",
"to",
"execute",
"returns",
"a",
"new",
"Bench",
"instance"
] | [
"func",
"New",
"(",
"showProgress",
"bool",
",",
"threads",
"int",
",",
"duration",
"time",
".",
"Duration",
",",
"rampUp",
"<mask>",
".",
"Duration",
",",
"timeout",
"time",
".",
"Duration",
")",
"*",
"Bench",
"{",
"return",
"&",
"Bench",
"{",
"showProgress",
":",
"showProgress",
",",
"threads",
":",
"threads",
",",
"duration",
":",
"duration",
",",
"rampUp",
":",
"rampUp",
",",
"timeout",
":",
"timeout",
",",
"}",
"\n",
"}"
] |
22,981 | all-22982 | [
"Path",
"for",
"given",
"action",
"for",
"now",
"simplify",
"and",
"take",
"first",
"path",
"in",
"PathPatterns",
".",
"In",
"the",
"future",
"we",
"may",
"want",
"to",
"create",
"one",
"action",
"in",
"generated",
"JS",
"per",
"path",
"."
] | [
"func",
"<mask>",
"(",
"a",
"*",
"gen",
".",
"Action",
")",
"string",
"{",
"pattern",
":=",
"a",
".",
"PathPatterns",
"[",
"0",
"]",
"\n",
"vars",
":=",
"pattern",
".",
"Variables",
"\n",
"ivars",
":=",
"make",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"len",
"(",
"vars",
")",
")",
"\n",
"for",
"i",
",",
"v",
":=",
"range",
"vars",
"{",
"ivars",
"[",
"i",
"]",
"=",
"interface",
"{",
"}",
"(",
"\"",
"\"",
"+",
"v",
")",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"pattern",
".",
"Pattern",
",",
"ivars",
"...",
")",
"\n",
"}"
] |
22,982 | all-22983 | [
"NewPutFileClient",
"returns",
"a",
"new",
"client",
"for",
"putting",
"files",
"into",
"pfs",
"in",
"a",
"single",
"request",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"NewPutFileClient",
"(",
")",
"(",
"PutFileClient",
",",
"<mask>",
")",
"{",
"pfc",
",",
"err",
":=",
"c",
".",
"PfsAPIClient",
".",
"PutFile",
"(",
"c",
".",
"Ctx",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"&",
"putFileClient",
"{",
"c",
":",
"pfc",
"}",
",",
"nil",
"\n",
"}"
] |
22,983 | all-22984 | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"the",
"Livestatus",
"query",
"."
] | [
"func",
"(",
"q",
"Query",
")",
"String",
"(",
")",
"string",
"{",
"s",
":=",
"\"",
"\"",
"+",
"q",
".",
"table",
"\n",
"if",
"len",
"(",
"q",
".",
"headers",
")",
">",
"0",
"{",
"s",
"+=",
"\"",
"\\n",
"\"",
"+",
"strings",
".",
"Join",
"(",
"q",
".",
"<mask>",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"}",
"\n",
"s",
"+=",
"\"",
"\\n",
"\\n",
"\\n",
"\\n",
"\"",
"\n\n",
"return",
"s",
"\n",
"}"
] |
22,984 | all-22985 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"CallFrame",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime48",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
22,985 | all-22986 | [
"Add",
"a",
"key",
"into",
"the",
"node",
"list"
] | [
"func",
"(",
"l",
"*",
"NodeList",
")",
"Add",
"(",
"node",
"*",
"skiplist",
".",
"Node",
")",
"{",
"node",
".",
"SetLink",
"(",
"l",
".",
"<mask>",
")",
"\n",
"l",
".",
"head",
"=",
"node",
"\n",
"}"
] |
22,986 | all-22987 | [
"allTemplatesRendered",
"returns",
"true",
"if",
"all",
"the",
"templates",
"in",
"this",
"Runner",
"have",
"been",
"rendered",
"at",
"least",
"one",
"time",
"."
] | [
"func",
"(",
"r",
"*",
"<mask>",
")",
"allTemplatesRendered",
"(",
")",
"bool",
"{",
"r",
".",
"renderEventsLock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"r",
".",
"renderEventsLock",
".",
"RUnlock",
"(",
")",
"\n\n",
"for",
"_",
",",
"tmpl",
":=",
"range",
"r",
".",
"templates",
"{",
"event",
",",
"rendered",
":=",
"r",
".",
"renderEvents",
"[",
"tmpl",
".",
"ID",
"(",
")",
"]",
"\n",
"if",
"!",
"rendered",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"// Skip evaluation of events from quiescence as they will",
"// be default unrendered as we are still waiting for the",
"// specified period",
"if",
"event",
".",
"ForQuiescence",
"{",
"continue",
"\n",
"}",
"\n\n",
"// The template might already exist on disk with the exact contents, but",
"// we still want to count that as \"rendered\" [GH-1000].",
"if",
"!",
"event",
".",
"DidRender",
"&&",
"!",
"event",
".",
"WouldRender",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"true",
"\n",
"}"
] |
22,987 | all-22988 | [
"SetLevel",
"sets",
"the",
"log",
"level",
"for",
"logging"
] | [
"func",
"SetLevel",
"(",
"logLevel",
"string",
")",
"{",
"parsedLevel",
",",
"ok",
":=",
"levels",
"[",
"strings",
".",
"ToLower",
"(",
"logLevel",
")",
"]",
"\n\n",
"if",
"ok",
"{",
"levelLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"levelLock",
".",
"Unlock",
"(",
")",
"\n",
"<mask>",
"=",
"parsedLevel",
"\n",
"reloadConfig",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
22,988 | all-22989 | [
"Do",
"executes",
"Target",
".",
"getTargetInfo",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"targetInfo"
] | [
"func",
"(",
"p",
"*",
"GetTargetInfoParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"targetInfo",
"*",
"Info",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"GetTargetInfoReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetTargetInfo",
",",
"p",
",",
"&",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"TargetInfo",
",",
"nil",
"\n",
"}"
] |
22,989 | all-22990 | [
"This",
"function",
"recreates",
"an",
"rbd",
"container",
"including",
"its",
"snapshots",
".",
"It",
"recreates",
"the",
"dependencies",
"between",
"the",
"container",
"and",
"the",
"snapshots",
":",
"-",
"create",
"an",
"empty",
"rbd",
"storage",
"volume",
"-",
"for",
"each",
"snapshot",
"dump",
"the",
"contents",
"into",
"the",
"empty",
"storage",
"volume",
"and",
"after",
"each",
"dump",
"take",
"a",
"snapshot",
"of",
"the",
"rbd",
"storage",
"volume",
"-",
"dump",
"the",
"container",
"contents",
"into",
"the",
"rbd",
"storage",
"volume",
"."
] | [
"func",
"(",
"s",
"*",
"storageCeph",
")",
"doCrossPoolContainerCopy",
"(",
"target",
"container",
",",
"source",
"container",
",",
"containerOnly",
"bool",
",",
"refresh",
"bool",
",",
"refreshSnapshots",
"[",
"]",
"container",
")",
"error",
"{",
"sourcePool",
",",
"err",
":=",
"source",
".",
"StoragePool",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// setup storage for the source volume",
"srcStorage",
",",
"err",
":=",
"storagePoolVolumeInit",
"(",
"s",
".",
"s",
",",
"source",
".",
"Project",
"(",
")",
",",
"sourcePool",
",",
"source",
".",
"Name",
"(",
")",
",",
"storagePoolVolumeTypeContainer",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"ourMount",
",",
"err",
":=",
"srcStorage",
".",
"StoragePoolMount",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"ourMount",
"{",
"defer",
"srcStorage",
".",
"StoragePoolUmount",
"(",
")",
"\n",
"}",
"\n\n",
"targetPool",
",",
"err",
":=",
"target",
".",
"StoragePool",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"var",
"snapshots",
"[",
"]",
"container",
"\n\n",
"if",
"refresh",
"{",
"snapshots",
"=",
"refreshSnapshots",
"\n",
"}",
"else",
"{",
"snapshots",
",",
"err",
"=",
"source",
".",
"Snapshots",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// create the main container",
"err",
"=",
"s",
".",
"doContainerCreate",
"(",
"target",
".",
"Project",
"(",
")",
",",
"target",
".",
"Name",
"(",
")",
",",
"target",
".",
"IsPrivileged",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// mount container",
"_",
",",
"err",
"=",
"s",
".",
"doContainerMount",
"(",
"target",
".",
"<mask>",
"(",
")",
",",
"target",
".",
"Name",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"destContainerMntPoint",
":=",
"getContainerMountPoint",
"(",
"target",
".",
"Project",
"(",
")",
",",
"targetPool",
",",
"target",
".",
"Name",
"(",
")",
")",
"\n",
"bwlimit",
":=",
"s",
".",
"pool",
".",
"Config",
"[",
"\"",
"\"",
"]",
"\n",
"// Extract container",
"if",
"!",
"containerOnly",
"{",
"for",
"_",
",",
"snap",
":=",
"range",
"snapshots",
"{",
"srcSnapshotMntPoint",
":=",
"getSnapshotMountPoint",
"(",
"snap",
".",
"Project",
"(",
")",
",",
"sourcePool",
",",
"snap",
".",
"Name",
"(",
")",
")",
"\n",
"_",
",",
"err",
"=",
"rsyncLocalCopy",
"(",
"srcSnapshotMntPoint",
",",
"destContainerMntPoint",
",",
"bwlimit",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// This is costly but we need to ensure that all cached data has",
"// been committed to disk. If we don't then the rbd snapshot of",
"// the underlying filesystem can be inconsistent or - worst case",
"// - empty.",
"syscall",
".",
"Sync",
"(",
")",
"\n\n",
"msg",
",",
"fsFreezeErr",
":=",
"shared",
".",
"TryRunCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"destContainerMntPoint",
")",
"\n",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"msg",
",",
"fsFreezeErr",
")",
"\n\n",
"// create snapshot",
"_",
",",
"snapOnlyName",
",",
"_",
":=",
"containerGetParentAndSnapshotName",
"(",
"snap",
".",
"Name",
"(",
")",
")",
"\n",
"err",
"=",
"s",
".",
"doContainerSnapshotCreate",
"(",
"target",
".",
"Project",
"(",
")",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"target",
".",
"Name",
"(",
")",
",",
"snapOnlyName",
")",
",",
"target",
".",
"Name",
"(",
")",
")",
"\n",
"if",
"fsFreezeErr",
"==",
"nil",
"{",
"msg",
",",
"fsFreezeErr",
":=",
"shared",
".",
"TryRunCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"destContainerMntPoint",
")",
"\n",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"msg",
",",
"fsFreezeErr",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"srcContainerMntPoint",
":=",
"getContainerMountPoint",
"(",
"source",
".",
"Project",
"(",
")",
",",
"sourcePool",
",",
"source",
".",
"Name",
"(",
")",
")",
"\n",
"_",
",",
"err",
"=",
"rsyncLocalCopy",
"(",
"srcContainerMntPoint",
",",
"destContainerMntPoint",
",",
"bwlimit",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"!",
"refresh",
"{",
"s",
".",
"StoragePoolVolumeDelete",
"(",
")",
"\n",
"}",
"\n\n",
"logger",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"s",
".",
"volume",
".",
"Name",
",",
"s",
".",
"pool",
".",
"Name",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
22,990 | all-22991 | [
"ServeTCP",
"serves",
"request",
"on",
"TCP",
"listener",
"."
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"ServeTCP",
"(",
"ln",
"net",
".",
"Listener",
")",
"(",
"err",
"error",
")",
"{",
"return",
"s",
".",
"<mask>",
".",
"Serve",
"(",
"ln",
")",
"\n",
"}"
] |
22,991 | all-22992 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetManifestForFrameReturns",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache1",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
22,992 | all-22993 | [
"validateDatastoreFolder",
"checks",
"to",
"make",
"sure",
"the",
"folder",
"is",
"a",
"datastore",
"folder",
"and",
"returns",
"it",
"if",
"it",
"is",
"or",
"an",
"error",
"if",
"it",
"isn",
"t",
"."
] | [
"func",
"validateDatastoreFolder",
"(",
"folder",
"*",
"object",
".",
"Folder",
")",
"(",
"*",
"object",
".",
"Folder",
",",
"error",
")",
"{",
"ft",
",",
"err",
":=",
"FindType",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"ft",
"!=",
"VSphereFolderTypeDatastore",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"folder",
".",
"InventoryPath",
")",
"\n",
"}",
"\n",
"return",
"folder",
",",
"nil",
"\n",
"}"
] |
22,993 | all-22994 | [
"Write",
"function",
"set",
"the",
"value",
"of",
"the",
"node",
"to",
"the",
"given",
"value",
".",
"If",
"the",
"receiver",
"node",
"is",
"a",
"directory",
"a",
"Not",
"A",
"File",
"error",
"will",
"be",
"returned",
"."
] | [
"func",
"(",
"n",
"*",
"<mask>",
")",
"Write",
"(",
"value",
"string",
",",
"index",
"uint64",
")",
"*",
"v2error",
".",
"Error",
"{",
"if",
"n",
".",
"IsDir",
"(",
")",
"{",
"return",
"v2error",
".",
"NewError",
"(",
"v2error",
".",
"EcodeNotFile",
",",
"\"",
"\"",
",",
"n",
".",
"store",
".",
"CurrentIndex",
")",
"\n",
"}",
"\n\n",
"n",
".",
"Value",
"=",
"value",
"\n",
"n",
".",
"ModifiedIndex",
"=",
"index",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
22,994 | all-22995 | [
"query",
"the",
"name",
"of",
"an",
"active",
"uniform"
] | [
"func",
"GetActiveUniformName",
"(",
"program",
"uint32",
",",
"uniformIndex",
"uint32",
",",
"bufSize",
"int32",
",",
"length",
"*",
"int32",
",",
"uniformName",
"*",
"uint8",
")",
"{",
"C",
".",
"glowGetActiveUniformName",
"(",
"gpGetActiveUniformName",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"uniformIndex",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"bufSize",
")",
",",
"(",
"*",
"C",
".",
"GLsizei",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"length",
")",
")",
",",
"(",
"*",
"C",
".",
"GLchar",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"uniformName",
")",
")",
")",
"\n",
"}"
] |
22,995 | all-22996 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetIgnoreInputEventsParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoInput4",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
22,996 | all-22997 | [
"SetTextColumn",
"is",
"a",
"wrapper",
"around",
"gtk_icon_view_set_text_column",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"IconView",
")",
"SetTextColumn",
"(",
"<mask>",
"int",
")",
"{",
"C",
".",
"gtk_icon_view_set_text_column",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"column",
")",
")",
"\n",
"}"
] |
22,997 | all-22998 | [
"NewMergeQuerier",
"returns",
"a",
"new",
"Querier",
"that",
"merges",
"results",
"of",
"input",
"queriers",
".",
"NB",
"NewMergeQuerier",
"will",
"return",
"NoopQuerier",
"if",
"no",
"queriers",
"are",
"passed",
"to",
"it",
"and",
"will",
"filter",
"NoopQueriers",
"from",
"its",
"arguments",
"in",
"order",
"to",
"reduce",
"overhead",
"when",
"only",
"one",
"querier",
"is",
"passed",
"."
] | [
"func",
"NewMergeQuerier",
"(",
"primaryQuerier",
"Querier",
",",
"queriers",
"[",
"]",
"Querier",
")",
"Querier",
"{",
"filtered",
":=",
"make",
"(",
"[",
"]",
"Querier",
",",
"0",
",",
"len",
"(",
"queriers",
")",
")",
"\n",
"for",
"_",
",",
"querier",
":=",
"range",
"queriers",
"{",
"if",
"querier",
"!=",
"NoopQuerier",
"(",
")",
"{",
"filtered",
"=",
"append",
"(",
"filtered",
",",
"querier",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"setQuerierMap",
":=",
"<mask>",
"(",
"map",
"[",
"SeriesSet",
"]",
"Querier",
")",
"\n",
"failedQueriers",
":=",
"make",
"(",
"map",
"[",
"Querier",
"]",
"struct",
"{",
"}",
")",
"\n\n",
"switch",
"len",
"(",
"filtered",
")",
"{",
"case",
"0",
":",
"return",
"NoopQuerier",
"(",
")",
"\n",
"case",
"1",
":",
"return",
"filtered",
"[",
"0",
"]",
"\n",
"default",
":",
"return",
"&",
"mergeQuerier",
"{",
"primaryQuerier",
":",
"primaryQuerier",
",",
"queriers",
":",
"filtered",
",",
"failedQueriers",
":",
"failedQueriers",
",",
"setQuerierMap",
":",
"setQuerierMap",
",",
"}",
"\n",
"}",
"\n",
"}"
] |
22,998 | all-22999 | [
"newSdNamespaceFilter",
"initialized",
"AWS",
"SD",
"Namespace",
"Filter",
"based",
"on",
"given",
"string",
"config"
] | [
"func",
"newSdNamespaceFilter",
"(",
"namespaceTypeConfig",
"string",
")",
"*",
"sd",
".",
"NamespaceFilter",
"{",
"switch",
"namespaceTypeConfig",
"{",
"case",
"sdNamespaceTypePublic",
":",
"return",
"&",
"sd",
".",
"NamespaceFilter",
"{",
"Name",
":",
"aws",
".",
"String",
"(",
"sd",
".",
"NamespaceFilterNameType",
")",
",",
"Values",
":",
"[",
"]",
"*",
"string",
"{",
"aws",
".",
"<mask>",
"(",
"sd",
".",
"NamespaceTypeDnsPublic",
")",
"}",
",",
"}",
"\n",
"case",
"sdNamespaceTypePrivate",
":",
"return",
"&",
"sd",
".",
"NamespaceFilter",
"{",
"Name",
":",
"aws",
".",
"String",
"(",
"sd",
".",
"NamespaceFilterNameType",
")",
",",
"Values",
":",
"[",
"]",
"*",
"string",
"{",
"aws",
".",
"String",
"(",
"sd",
".",
"NamespaceTypeDnsPrivate",
")",
"}",
",",
"}",
"\n",
"default",
":",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
22,999 | all-23000 | [
"HTTPRespondMarshalIndentJSON",
"marshals",
"response",
"as",
"JSON",
"to",
"responseWriter",
"sets",
"Content",
"-",
"Type",
"to",
"application",
"/",
"json",
"and",
"compresses",
"the",
"response",
"if",
"Content",
"-",
"Encoding",
"from",
"the",
"request",
"allows",
"it",
".",
"The",
"JSON",
"will",
"be",
"marshalled",
"indented",
"according",
"to",
"json",
".",
"MarshalIndent"
] | [
"func",
"HTTPRespondMarshalIndentJSON",
"(",
"response",
"interface",
"{",
"}",
",",
"prefix",
",",
"indent",
"string",
",",
"responseWriter",
"http",
".",
"ResponseWriter",
",",
"request",
"*",
"http",
".",
"Request",
")",
"(",
"err",
"error",
")",
"{",
"NewHTTPCompressHandlerFromFunc",
"(",
"func",
"(",
"responseWriter",
"http",
".",
"ResponseWriter",
",",
"request",
"*",
"http",
".",
"Request",
")",
"{",
"var",
"<mask>",
"[",
"]",
"byte",
"\n",
"if",
"data",
",",
"err",
"=",
"json",
".",
"MarshalIndent",
"(",
"response",
",",
"prefix",
",",
"indent",
")",
";",
"err",
"==",
"nil",
"{",
"responseWriter",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"_",
",",
"err",
"=",
"responseWriter",
".",
"Write",
"(",
"data",
")",
"\n",
"}",
"\n",
"}",
")",
".",
"ServeHTTP",
"(",
"responseWriter",
",",
"request",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.