id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
11,500 | all-11501 | [
"linearRegression",
"performs",
"a",
"least",
"-",
"square",
"linear",
"regression",
"analysis",
"on",
"the",
"provided",
"SamplePairs",
".",
"It",
"returns",
"the",
"slope",
"and",
"the",
"intercept",
"value",
"at",
"the",
"provided",
"time",
"."
] | [
"func",
"linearRegression",
"(",
"samples",
"[",
"]",
"Point",
",",
"interceptTime",
"int64",
")",
"(",
"slope",
",",
"intercept",
"float64",
")",
"{",
"var",
"(",
"n",
"float64",
"\n",
"sumX",
",",
"sumY",
"float64",
"\n",
"sumXY",
",",
"sumX2",
"float64",
"\n",
")",
"\n",
"for",
"_",
",",
"sample",
":=",
"range",
"samples",
"{",
"x",
":=",
"float64",
"(",
"<mask>",
".",
"T",
"-",
"interceptTime",
")",
"/",
"1e3",
"\n",
"n",
"+=",
"1.0",
"\n",
"sumY",
"+=",
"sample",
".",
"V",
"\n",
"sumX",
"+=",
"x",
"\n",
"sumXY",
"+=",
"x",
"*",
"sample",
".",
"V",
"\n",
"sumX2",
"+=",
"x",
"*",
"x",
"\n",
"}",
"\n",
"covXY",
":=",
"sumXY",
"-",
"sumX",
"*",
"sumY",
"/",
"n",
"\n",
"varX",
":=",
"sumX2",
"-",
"sumX",
"*",
"sumX",
"/",
"n",
"\n\n",
"slope",
"=",
"covXY",
"/",
"varX",
"\n",
"intercept",
"=",
"sumY",
"/",
"n",
"-",
"slope",
"*",
"sumX",
"/",
"n",
"\n",
"return",
"slope",
",",
"intercept",
"\n",
"}"
] |
11,501 | all-11502 | [
"ProjectHasImages",
"is",
"a",
"helper",
"to",
"check",
"if",
"a",
"project",
"has",
"the",
"images",
"feature",
"enabled",
"."
] | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"ProjectHasImages",
"(",
"name",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"project",
",",
"err",
":=",
"c",
".",
"ProjectGet",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"enabled",
":=",
"project",
".",
"Config",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"\n\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}"
] |
11,502 | all-11503 | [
"ReadUint64",
"reads",
"and",
"returns",
"an",
"uint64",
"."
] | [
"func",
"(",
"r",
"*",
"Reader",
")",
"ReadUint64",
"(",
")",
"uint64",
"{",
"if",
"r",
".",
"err",
"!=",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"var",
"n",
"int",
"\n",
"n",
",",
"r",
".",
"err",
"=",
"io",
".",
"ReadFull",
"(",
"r",
".",
"rd",
",",
"r",
".",
"b",
"[",
":",
"8",
"]",
")",
"\n",
"r",
".",
"cnt",
"+=",
"n",
"\n",
"if",
"r",
".",
"err",
"!=",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"LittleEndian",
".",
"Uint64",
"(",
"r",
".",
"b",
"[",
":",
"8",
"]",
")",
"\n",
"}"
] |
11,503 | all-11504 | [
"SetName",
"is",
"a",
"wrapper",
"around",
"gtk_file_filter_set_name",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"FileFilter",
")",
"SetName",
"(",
"<mask>",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_file_filter_set_name",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
11,504 | all-11505 | [
"PeekBack",
"returns",
"the",
"nth",
"previous",
"element",
"of",
"the",
"iterator",
".",
"If",
"there",
"is",
"none",
"buffered",
"ok",
"is",
"false",
"."
] | [
"func",
"(",
"b",
"*",
"BufferedSeriesIterator",
")",
"PeekBack",
"(",
"n",
"int",
")",
"(",
"t",
"int64",
",",
"v",
"float64",
",",
"<mask>",
"bool",
")",
"{",
"return",
"b",
".",
"buf",
".",
"nthLast",
"(",
"n",
")",
"\n",
"}"
] |
11,505 | all-11506 | [
"NewAlertingRule",
"constructs",
"a",
"new",
"AlertingRule",
"."
] | [
"func",
"NewAlertingRule",
"(",
"name",
"string",
",",
"vec",
"promql",
".",
"Expr",
",",
"hold",
"<mask>",
".",
"Duration",
",",
"labels",
",",
"annotations",
",",
"externalLabels",
"labels",
".",
"Labels",
",",
"restored",
"bool",
",",
"logger",
"log",
".",
"Logger",
",",
")",
"*",
"AlertingRule",
"{",
"el",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"len",
"(",
"externalLabels",
")",
")",
"\n",
"for",
"_",
",",
"lbl",
":=",
"range",
"externalLabels",
"{",
"el",
"[",
"lbl",
".",
"Name",
"]",
"=",
"lbl",
".",
"Value",
"\n",
"}",
"\n\n",
"return",
"&",
"AlertingRule",
"{",
"name",
":",
"name",
",",
"vector",
":",
"vec",
",",
"holdDuration",
":",
"hold",
",",
"labels",
":",
"labels",
",",
"annotations",
":",
"annotations",
",",
"externalLabels",
":",
"el",
",",
"health",
":",
"HealthUnknown",
",",
"active",
":",
"map",
"[",
"uint64",
"]",
"*",
"Alert",
"{",
"}",
",",
"logger",
":",
"logger",
",",
"restored",
":",
"restored",
",",
"}",
"\n",
"}"
] |
11,506 | all-11507 | [
"/",
"*",
"Floats",
"looks",
"for",
"an",
"array",
"of",
"floats",
"under",
"the",
"provided",
"key",
".",
"If",
"no",
"matches",
"are",
"found",
"nil",
"is",
"returned",
"."
] | [
"func",
"(",
"config",
"*",
"Config",
")",
"Floats",
"(",
"<mask>",
"string",
")",
"[",
"]",
"float64",
"{",
"return",
"getFloats",
"(",
"config",
".",
"values",
",",
"key",
")",
"\n",
"}"
] |
11,507 | all-11508 | [
"getRawPattern",
"removes",
"all",
"regexp",
"but",
"keeps",
"wildcards",
"for",
"building",
"URL",
"path",
"."
] | [
"func",
"getRawPattern",
"(",
"rawPattern",
"string",
")",
"string",
"{",
"rawPattern",
"=",
"strings",
".",
"Replace",
"(",
"rawPattern",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n",
"rawPattern",
"=",
"strings",
".",
"Replace",
"(",
"rawPattern",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n\n",
"for",
"{",
"startIdx",
":=",
"strings",
".",
"<mask>",
"(",
"rawPattern",
",",
"\"",
"\"",
")",
"\n",
"if",
"startIdx",
"==",
"-",
"1",
"{",
"break",
"\n",
"}",
"\n\n",
"closeIdx",
":=",
"strings",
".",
"Index",
"(",
"rawPattern",
",",
"\"",
"\"",
")",
"\n",
"if",
"closeIdx",
">",
"-",
"1",
"{",
"rawPattern",
"=",
"rawPattern",
"[",
":",
"startIdx",
"]",
"+",
"rawPattern",
"[",
"closeIdx",
"+",
"1",
":",
"]",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"rawPattern",
"\n",
"}"
] |
11,508 | all-11509 | [
"parseFloat",
"parses",
"a",
"string",
"into",
"a",
"base",
"10",
"float"
] | [
"func",
"parseFloat",
"(",
"s",
"string",
")",
"(",
"float64",
",",
"error",
")",
"{",
"if",
"s",
"==",
"\"",
"\"",
"{",
"return",
"0.0",
",",
"nil",
"\n",
"}",
"\n\n",
"<mask>",
",",
"err",
":=",
"strconv",
".",
"ParseFloat",
"(",
"s",
",",
"10",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n",
"}"
] |
11,509 | all-11510 | [
"UpdateCapability",
"updates",
"the",
"enabledMap",
"when",
"the",
"cluster",
"version",
"increases",
"."
] | [
"func",
"UpdateCapability",
"(",
"lg",
"*",
"zap",
".",
"Logger",
",",
"v",
"*",
"semver",
".",
"Version",
")",
"{",
"if",
"v",
"==",
"nil",
"{",
"// if recovered but version was never set by cluster",
"return",
"\n",
"}",
"\n",
"enableMapMu",
".",
"Lock",
"(",
")",
"\n",
"if",
"curVersion",
"!=",
"nil",
"&&",
"!",
"curVersion",
".",
"LessThan",
"(",
"*",
"v",
")",
"{",
"enableMapMu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n",
"curVersion",
"=",
"v",
"\n",
"enabledMap",
"=",
"capabilityMaps",
"[",
"curVersion",
".",
"String",
"(",
")",
"]",
"\n",
"enableMapMu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"version",
".",
"Cluster",
"(",
"v",
".",
"String",
"(",
")",
")",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"Cluster",
"(",
"v",
".",
"String",
"(",
")",
")",
")",
"\n",
"}",
"\n",
"}"
] |
11,510 | all-11511 | [
"Service",
"returns",
"the",
"name",
"of",
"the",
"destination",
"service",
"for",
"this",
"callReq",
"."
] | [
"func",
"(",
"f",
"lazyCallReq",
")",
"<mask>",
"(",
")",
"[",
"]",
"byte",
"{",
"l",
":=",
"f",
".",
"Payload",
"[",
"_serviceLenIndex",
"]",
"\n",
"return",
"f",
".",
"Payload",
"[",
"_serviceNameIndex",
":",
"_serviceNameIndex",
"+",
"l",
"]",
"\n",
"}"
] |
11,511 | all-11512 | [
"Adds",
"an",
"element",
"to",
"the",
"sequence",
"beginning",
".",
"Returns",
"a",
"pointer",
"to",
"the",
"element",
"added",
"."
] | [
"func",
"(",
"seq",
"*",
"Seq",
")",
"PushFront",
"(",
"element",
"unsafe",
".",
"Pointer",
")",
"unsafe",
".",
"Pointer",
"{",
"return",
"unsafe",
".",
"Pointer",
"(",
"(",
"C",
".",
"cvSeqPushFront",
"(",
"(",
"*",
"C",
".",
"struct_CvSeq",
")",
"(",
"seq",
")",
",",
"<mask>",
")",
")",
")",
"\n",
"}"
] |
11,512 | all-11513 | [
"PushAndMaybeOverwriteOldestData",
"always",
"consumes",
"the",
"full",
"slice",
"p",
"even",
"if",
"that",
"means",
"blowing",
"away",
"the",
"oldest",
"unread",
"pointers",
"in",
"the",
"ring",
"to",
"make",
"room",
".",
"In",
"reality",
"only",
"the",
"last",
"min",
"(",
"len",
"(",
"p",
")",
"b",
".",
"N",
")",
"bytes",
"of",
"p",
"will",
"end",
"up",
"being",
"written",
"to",
"the",
"ring",
".",
"This",
"allows",
"the",
"ring",
"to",
"act",
"as",
"a",
"record",
"of",
"the",
"most",
"recent",
"b",
".",
"N",
"bytes",
"of",
"data",
"--",
"a",
"kind",
"of",
"temporal",
"LRU",
"cache",
"so",
"the",
"speak",
".",
"The",
"linux",
"kernel",
"s",
"dmesg",
"ring",
"buffer",
"is",
"similar",
"."
] | [
"func",
"(",
"b",
"*",
"PointerRingBuf",
")",
"PushAndMaybeOverwriteOldestData",
"(",
"p",
"[",
"]",
"<mask>",
"{",
"}",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"writeCapacity",
":=",
"b",
".",
"N",
"-",
"b",
".",
"Readable",
"\n",
"if",
"len",
"(",
"p",
")",
">",
"writeCapacity",
"{",
"b",
".",
"Advance",
"(",
"len",
"(",
"p",
")",
"-",
"writeCapacity",
")",
"\n",
"}",
"\n",
"startPos",
":=",
"0",
"\n",
"if",
"len",
"(",
"p",
")",
">",
"b",
".",
"N",
"{",
"startPos",
"=",
"len",
"(",
"p",
")",
"-",
"b",
".",
"N",
"\n",
"}",
"\n",
"n",
",",
"err",
"=",
"b",
".",
"Push",
"(",
"p",
"[",
"startPos",
":",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"n",
",",
"err",
"\n",
"}",
"\n",
"return",
"len",
"(",
"p",
")",
",",
"nil",
"\n",
"}"
] |
11,513 | all-11514 | [
"Do",
"executes",
"Target",
".",
"sendMessageToTarget",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SendMessageToTargetParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSendMessageToTarget",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
11,514 | all-11515 | [
"Color",
"creates",
"an",
"ANSI",
"compatible",
"escape",
"sequence",
"that",
"encodes",
"colors",
"and",
"attributes",
"."
] | [
"func",
"Color",
"(",
"at",
",",
"fg",
",",
"bg",
"int",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"a",
",",
"f",
",",
"b",
"string",
"\n\n",
"// can't be all NA",
"if",
"at",
"==",
"AttrNA",
"&&",
"fg",
"==",
"AttrNA",
"&&",
"bg",
"==",
"AttrNA",
"{",
"return",
"\"",
"\"",
",",
"ErrInvalidColor",
"\n",
"}",
"\n\n",
"switch",
"at",
"{",
"case",
"AttrNA",
":",
"<mask>",
"\n",
"case",
"AttrBold",
",",
"AttrUnderline",
",",
"AttrReverse",
",",
"AttrReset",
":",
"a",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"at",
")",
"\n",
"default",
":",
"return",
"\"",
"\"",
",",
"ErrInvalidAttribute",
"\n",
"}",
"\n\n",
"switch",
"{",
"case",
"fg",
"==",
"AttrNA",
":",
"break",
"\n",
"case",
"fg",
">=",
"ColorBlack",
"&&",
"fg",
"<=",
"ColorWhite",
":",
"f",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"fg",
"+",
"ANSIFg",
")",
"\n",
"default",
":",
"return",
"\"",
"\"",
",",
"ErrInvalidForeground",
"\n",
"}",
"\n\n",
"switch",
"{",
"case",
"bg",
"==",
"AttrNA",
":",
"break",
"\n",
"case",
"bg",
">=",
"ColorBlack",
"&&",
"bg",
"<=",
"ColorWhite",
":",
"b",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"bg",
"+",
"ANSIBg",
")",
"\n",
"default",
":",
"return",
"\"",
"\"",
",",
"ErrInvalidBackground",
"\n",
"}",
"\n\n",
"es",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\x1b",
"\"",
",",
"a",
",",
"f",
",",
"b",
")",
"\n\n",
"// replace last ; with m",
"es",
"=",
"es",
"[",
":",
"len",
"(",
"es",
")",
"-",
"1",
"]",
"+",
"\"",
"\"",
"\n\n",
"return",
"es",
",",
"nil",
"\n",
"}"
] |
11,515 | all-11516 | [
"New",
"parameter",
"from",
"raw",
"values"
] | [
"func",
"(",
"p",
"*",
"ParamAnalyzer",
")",
"newParam",
"(",
"path",
"string",
",",
"param",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"dType",
"gen",
".",
"DataType",
")",
"*",
"gen",
".",
"ActionParam",
"{",
"var",
"description",
",",
"regexp",
"string",
"\n",
"var",
"mandatory",
",",
"nonBlank",
"bool",
"\n",
"var",
"validValues",
"[",
"]",
"interface",
"{",
"}",
"\n",
"if",
"d",
",",
"<mask>",
":=",
"param",
"[",
"\"",
"\"",
"]",
";",
"ok",
"{",
"description",
"=",
"d",
".",
"(",
"string",
")",
"\n",
"}",
"\n",
"if",
"m",
",",
"ok",
":=",
"param",
"[",
"\"",
"\"",
"]",
";",
"ok",
"{",
"mandatory",
"=",
"m",
".",
"(",
"bool",
")",
"\n",
"}",
"\n",
"if",
"n",
",",
"ok",
":=",
"param",
"[",
"\"",
"\"",
"]",
";",
"ok",
"{",
"nonBlank",
"=",
"n",
".",
"(",
"bool",
")",
"\n",
"}",
"\n",
"if",
"r",
",",
"ok",
":=",
"param",
"[",
"\"",
"\"",
"]",
";",
"ok",
"{",
"regexp",
"=",
"r",
".",
"(",
"string",
")",
"\n",
"}",
"\n",
"if",
"v",
",",
"ok",
":=",
"param",
"[",
"\"",
"\"",
"]",
";",
"ok",
"{",
"validValues",
"=",
"v",
".",
"(",
"[",
"]",
"interface",
"{",
"}",
")",
"\n",
"}",
"\n",
"native",
":=",
"nativeNameFromPath",
"(",
"path",
")",
"\n",
"isLeaf",
":=",
"false",
"\n",
"if",
"_",
",",
"ok",
":=",
"dType",
".",
"(",
"*",
"gen",
".",
"EnumerableDataType",
")",
";",
"ok",
"{",
"isLeaf",
"=",
"true",
"\n",
"}",
"else",
"{",
"for",
"_",
",",
"l",
":=",
"range",
"p",
".",
"leafParamNames",
"{",
"if",
"path",
"==",
"l",
"{",
"isLeaf",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"queryName",
":=",
"path",
"\n",
"if",
"_",
",",
"ok",
":=",
"dType",
".",
"(",
"*",
"gen",
".",
"ArrayDataType",
")",
";",
"ok",
"{",
"queryName",
"+=",
"\"",
"\"",
"\n",
"}",
"\n",
"actionParam",
":=",
"&",
"gen",
".",
"ActionParam",
"{",
"Name",
":",
"native",
",",
"QueryName",
":",
"queryName",
",",
"Description",
":",
"removeBlankLines",
"(",
"description",
")",
",",
"VarName",
":",
"parseParamName",
"(",
"native",
")",
",",
"Type",
":",
"dType",
",",
"Mandatory",
":",
"mandatory",
",",
"NonBlank",
":",
"nonBlank",
",",
"Regexp",
":",
"regexp",
",",
"ValidValues",
":",
"validValues",
",",
"}",
"\n",
"if",
"isLeaf",
"{",
"p",
".",
"LeafParams",
"=",
"append",
"(",
"p",
".",
"LeafParams",
",",
"actionParam",
")",
"\n",
"}",
"\n",
"return",
"actionParam",
"\n",
"}"
] |
11,516 | all-11517 | [
"Close",
"shuts",
"down",
"the",
"server",
"closes",
"all",
"of",
"the",
"streams",
"and",
"connections"
] | [
"func",
"(",
"s",
"*",
"<mask>",
")",
"Close",
"(",
")",
"{",
"s",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"for",
"id",
":=",
"range",
"s",
".",
"Streams",
"{",
"s",
".",
"Streams",
"[",
"id",
"]",
".",
"quit",
"<-",
"true",
"\n",
"delete",
"(",
"s",
".",
"Streams",
",",
"id",
")",
"\n",
"}",
"\n",
"}"
] |
11,517 | all-11518 | [
"getExecutionCredentialsID",
"returns",
"the",
"execution",
"role",
"s",
"credential",
"ID"
] | [
"func",
"(",
"secret",
"*",
"SSMSecretResource",
")",
"getExecutionCredentialsID",
"(",
")",
"string",
"{",
"secret",
".",
"<mask>",
".",
"RLock",
"(",
")",
"\n",
"defer",
"secret",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"secret",
".",
"executionCredentialsID",
"\n",
"}"
] |
11,518 | all-11519 | [
"ProxyType",
"pushes",
"the",
"proxy",
"type",
"on",
"the",
"stack",
".",
"It",
"behaves",
"like",
"Lua",
"s",
"type",
"except",
"for",
"proxies",
"for",
"which",
"it",
"returns",
"table<TYPE",
">",
"string<TYPE",
">",
"or",
"number<TYPE",
">",
"with",
"TYPE",
"being",
"the",
"go",
"type",
".",
"Argument",
":",
"proxy",
"Returns",
":",
"type",
"(",
"string",
")"
] | [
"func",
"ProxyType",
"(",
"L",
"*",
"lua",
".",
"State",
")",
"int",
"{",
"if",
"!",
"isValueProxy",
"(",
"L",
",",
"1",
")",
"{",
"L",
".",
"PushString",
"(",
"L",
".",
"LTypename",
"(",
"1",
")",
")",
"\n",
"return",
"1",
"\n",
"}",
"\n",
"v",
",",
"_",
":=",
"valueOfProxy",
"(",
"L",
",",
"1",
")",
"\n\n",
"pointerLevel",
":=",
"\"",
"\"",
"\n",
"for",
"v",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Ptr",
"{",
"pointerLevel",
"+=",
"\"",
"\"",
"\n",
"v",
"=",
"v",
".",
"Elem",
"(",
")",
"\n",
"}",
"\n\n",
"prefix",
":=",
"\"",
"\"",
"\n",
"switch",
"unsizedKind",
"(",
"v",
")",
"{",
"case",
"reflect",
".",
"Array",
",",
"reflect",
".",
"Map",
",",
"reflect",
".",
"Slice",
",",
"reflect",
".",
"Struct",
":",
"prefix",
"=",
"\"",
"\"",
"\n",
"case",
"reflect",
".",
"String",
":",
"prefix",
"=",
"\"",
"\"",
"\n",
"<mask>",
"reflect",
".",
"Uint64",
",",
"reflect",
".",
"Int64",
",",
"reflect",
".",
"Float64",
",",
"reflect",
".",
"Complex128",
":",
"prefix",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"L",
".",
"PushString",
"(",
"prefix",
"+",
"\"",
"\"",
"+",
"pointerLevel",
"+",
"v",
".",
"Type",
"(",
")",
".",
"String",
"(",
")",
"+",
"\"",
"\"",
")",
"\n",
"return",
"1",
"\n",
"}"
] |
11,519 | all-11520 | [
"Unsubscribe",
"removes",
"a",
"subscription",
"from",
"job",
"result",
"notifications",
"for",
"given",
"ids",
"of",
"related",
"objects",
".",
"SubID",
"is",
"used",
"to",
"distinguish",
"between",
"different",
"subscriptions",
"to",
"a",
"same",
"related",
"object",
"."
] | [
"func",
"(",
"q",
"*",
"<mask>",
")",
"Unsubscribe",
"(",
"subKeys",
"[",
"]",
"string",
",",
"subID",
"string",
")",
"error",
"{",
"q",
".",
"subsMtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"q",
".",
"subsMtx",
".",
"Unlock",
"(",
")",
"\n\n",
"var",
"err",
"error",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"subKeys",
"{",
"if",
"err2",
":=",
"q",
".",
"unsubscribe",
"(",
"v",
",",
"subID",
")",
";",
"err",
"==",
"nil",
"{",
"err",
"=",
"err2",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"err",
"\n",
"}"
] |
11,520 | all-11521 | [
"Merge",
"merges",
"two",
"config",
"files",
"preferring",
"the",
"ones",
"on",
"the",
"left",
".",
"Any",
"nil",
"or",
"zero",
"values",
"present",
"in",
"the",
"left",
"that",
"are",
"not",
"present",
"in",
"the",
"right",
"will",
"be",
"overridden"
] | [
"func",
"(",
"cfg",
"*",
"Config",
")",
"Merge",
"(",
"rhs",
"Config",
")",
"*",
"Config",
"{",
"left",
":=",
"reflect",
".",
"ValueOf",
"(",
"cfg",
")",
".",
"Elem",
"(",
")",
"\n",
"right",
":=",
"reflect",
".",
"ValueOf",
"(",
"&",
"rhs",
")",
".",
"Elem",
"(",
")",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"<mask>",
".",
"NumField",
"(",
")",
";",
"i",
"++",
"{",
"leftField",
":=",
"left",
".",
"Field",
"(",
"i",
")",
"\n",
"if",
"utils",
".",
"ZeroOrNil",
"(",
"leftField",
".",
"Interface",
"(",
")",
")",
"{",
"leftField",
".",
"Set",
"(",
"reflect",
".",
"ValueOf",
"(",
"right",
".",
"Field",
"(",
"i",
")",
".",
"Interface",
"(",
")",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"cfg",
"//make it chainable",
"\n",
"}"
] |
11,521 | all-11522 | [
"ControllerForCreateUpdate",
"wraps",
"the",
"controller",
"selection",
"logic",
"to",
"make",
"it",
"easier",
"to",
"use",
"in",
"create",
"or",
"update",
"operations",
".",
"If",
"the",
"controller",
"type",
"is",
"a",
"SCSI",
"device",
"the",
"bus",
"number",
"is",
"searched",
"as",
"well",
"."
] | [
"func",
"(",
"r",
"*",
"Subresource",
")",
"ControllerForCreateUpdate",
"(",
"l",
"object",
".",
"VirtualDeviceList",
",",
"ct",
"string",
",",
"bus",
"int",
")",
"(",
"types",
".",
"BaseVirtualController",
",",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"ct",
")",
"\n",
"var",
"ctlr",
"types",
".",
"BaseVirtualController",
"\n",
"var",
"err",
"error",
"\n",
"switch",
"<mask>",
"{",
"case",
"SubresourceControllerTypeIDE",
":",
"ctlr",
"=",
"l",
".",
"PickController",
"(",
"&",
"types",
".",
"VirtualIDEController",
"{",
"}",
")",
"\n",
"case",
"SubresourceControllerTypeSATA",
":",
"ctlr",
"=",
"l",
".",
"PickController",
"(",
"&",
"types",
".",
"VirtualAHCIController",
"{",
"}",
")",
"\n",
"case",
"SubresourceControllerTypeSCSI",
":",
"ctlr",
",",
"err",
"=",
"pickSCSIController",
"(",
"l",
",",
"bus",
")",
"\n",
"case",
"SubresourceControllerTypePCI",
":",
"ctlr",
"=",
"l",
".",
"PickController",
"(",
"&",
"types",
".",
"VirtualPCIController",
"{",
"}",
")",
"\n",
"default",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ct",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"ctlr",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ct",
")",
"\n",
"}",
"\n\n",
"// Assert that we are on bus 0 when we aren't looking for a SCSI controller.",
"// We currently do not support attaching devices to multiple non-SCSI buses.",
"if",
"ctlr",
".",
"GetVirtualController",
"(",
")",
".",
"BusNumber",
"!=",
"0",
"&&",
"ct",
"!=",
"SubresourceControllerTypeSCSI",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ct",
")",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"l",
".",
"Name",
"(",
"ctlr",
".",
"(",
"types",
".",
"BaseVirtualDevice",
")",
")",
")",
"\n\n",
"return",
"ctlr",
",",
"nil",
"\n",
"}"
] |
11,522 | all-11523 | [
"GetChildNonHomogeneous",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_button_box_get_child_non_homogeneous",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"ButtonBox",
")",
"GetChildNonHomogeneous",
"(",
"<mask>",
"IWidget",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_button_box_get_child_non_homogeneous",
"(",
"v",
".",
"native",
"(",
")",
",",
"child",
".",
"toWidget",
"(",
")",
")",
"\n",
"return",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
11,523 | all-11524 | [
"PkgName",
"is",
"the",
"package",
"name",
"for",
"this",
"function",
"reference",
"."
] | [
"func",
"(",
"f",
"*",
"Func",
")",
"PkgName",
"(",
")",
"string",
"{",
"parts",
":=",
"strings",
".",
"SplitN",
"(",
"filepath",
".",
"Base",
"(",
"f",
".",
"Raw",
")",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"parts",
")",
"==",
"1",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"s",
",",
"_",
":=",
"<mask>",
".",
"QueryUnescape",
"(",
"parts",
"[",
"0",
"]",
")",
"\n",
"return",
"s",
"\n",
"}"
] |
11,524 | all-11525 | [
"Info",
"logs",
"a",
"message",
"(",
"with",
"optional",
"context",
")",
"at",
"the",
"INFO",
"log",
"level"
] | [
"func",
"Info",
"(",
"msg",
"string",
",",
"ctx",
"...",
"<mask>",
"{",
"}",
")",
"{",
"if",
"Log",
"!=",
"nil",
"{",
"Log",
".",
"Info",
"(",
"msg",
",",
"ctx",
"...",
")",
"\n",
"}",
"\n",
"}"
] |
11,525 | all-11526 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"Param",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoHar4",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
11,526 | all-11527 | [
"GetArchitectures",
"returns",
"the",
"list",
"of",
"supported",
"architectures",
"."
] | [
"func",
"GetArchitectures",
"(",
")",
"(",
"[",
"]",
"int",
",",
"error",
")",
"{",
"architectures",
":=",
"[",
"]",
"int",
"{",
"}",
"\n\n",
"architectureName",
",",
"err",
":=",
"osarch",
".",
"ArchitectureGetLocal",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"architecture",
",",
"err",
":=",
"osarch",
".",
"ArchitectureId",
"(",
"architectureName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"architectures",
"=",
"<mask>",
"(",
"architectures",
",",
"architecture",
")",
"\n\n",
"personalities",
",",
"err",
":=",
"osarch",
".",
"ArchitecturePersonalities",
"(",
"architecture",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"personality",
":=",
"range",
"personalities",
"{",
"architectures",
"=",
"append",
"(",
"architectures",
",",
"personality",
")",
"\n",
"}",
"\n",
"return",
"architectures",
",",
"nil",
"\n",
"}"
] |
11,527 | all-11528 | [
"GetURL",
"returns",
"the",
"URL",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetURL",
"(",
")",
"string",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"URL",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"<mask>",
"\n",
"}"
] |
11,528 | all-11529 | [
"WithViewport",
"if",
"set",
"the",
"visible",
"area",
"of",
"the",
"page",
"will",
"be",
"overridden",
"to",
"this",
"viewport",
".",
"This",
"viewport",
"change",
"is",
"not",
"observed",
"by",
"the",
"page",
"e",
".",
"g",
".",
"viewport",
"-",
"relative",
"elements",
"do",
"not",
"change",
"positions",
"."
] | [
"func",
"(",
"p",
"SetDeviceMetricsOverrideParams",
")",
"WithViewport",
"(",
"viewport",
"*",
"<mask>",
".",
"Viewport",
")",
"*",
"SetDeviceMetricsOverrideParams",
"{",
"p",
".",
"Viewport",
"=",
"viewport",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
11,529 | all-11530 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"Violation",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"Violation",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"ViolationLongTask",
":",
"*",
"t",
"=",
"ViolationLongTask",
"\n",
"case",
"ViolationLongLayout",
":",
"*",
"t",
"=",
"ViolationLongLayout",
"\n",
"<mask>",
"ViolationBlockedEvent",
":",
"*",
"t",
"=",
"ViolationBlockedEvent",
"\n",
"case",
"ViolationBlockedParser",
":",
"*",
"t",
"=",
"ViolationBlockedParser",
"\n",
"case",
"ViolationDiscouragedAPIUse",
":",
"*",
"t",
"=",
"ViolationDiscouragedAPIUse",
"\n",
"case",
"ViolationHandler",
":",
"*",
"t",
"=",
"ViolationHandler",
"\n",
"case",
"ViolationRecurringHandler",
":",
"*",
"t",
"=",
"ViolationRecurringHandler",
"\n\n",
"default",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
] |
11,530 | all-11531 | [
"flattenDVPortgroupConfigInfo",
"reads",
"various",
"fields",
"from",
"a",
"DVPortgroupConfigInfo",
"into",
"the",
"passed",
"in",
"ResourceData",
".",
"This",
"is",
"the",
"flatten",
"counterpart",
"to",
"expandDVPortgroupConfigSpec",
"."
] | [
"func",
"flattenDVPortgroupConfigInfo",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"types",
".",
"DVPortgroupConfigInfo",
")",
"error",
"{",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"ConfigVersion",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"<mask>",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"NumPorts",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"PortNameFormat",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"Description",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"Type",
")",
"\n",
"structure",
".",
"SetBoolPtr",
"(",
"d",
",",
"\"",
"\"",
",",
"obj",
".",
"AutoExpand",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"VmVnicNetworkResourcePoolKey",
")",
"\n\n",
"if",
"err",
":=",
"flattenVMwareDVSPortSetting",
"(",
"d",
",",
"obj",
".",
"DefaultPortConfig",
".",
"(",
"*",
"types",
".",
"VMwareDVSPortSetting",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"flattenVMwareDVSPortgroupPolicy",
"(",
"d",
",",
"obj",
".",
"Policy",
".",
"(",
"*",
"types",
".",
"VMwareDVSPortgroupPolicy",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
11,531 | all-11532 | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"DecorationConfig",
"."
] | [
"func",
"(",
"in",
"*",
"DecorationConfig",
")",
"DeepCopy",
"(",
")",
"*",
"DecorationConfig",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"DecorationConfig",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"<mask>",
")",
"\n",
"return",
"out",
"\n",
"}"
] |
11,532 | all-11533 | [
"FromMultiple",
"combines",
"multiple",
"extractors",
"by",
"chaining",
"."
] | [
"func",
"FromMultiple",
"(",
"extractors",
"...",
"RequestTokenExtractor",
")",
"RequestTokenExtractor",
"{",
"return",
"RequestTokenExtractorFunc",
"(",
"func",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"(",
"*",
"jwt",
".",
"JSONWebToken",
",",
"error",
")",
"{",
"for",
"_",
",",
"e",
":=",
"range",
"extractors",
"{",
"token",
",",
"err",
":=",
"e",
".",
"Extract",
"(",
"r",
")",
"\n",
"if",
"err",
"==",
"ErrTokenNotFound",
"{",
"<mask>",
"\n",
"}",
"else",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"token",
",",
"nil",
"\n",
"}",
"\n",
"return",
"nil",
",",
"ErrTokenNotFound",
"\n",
"}",
")",
"\n",
"}"
] |
11,533 | all-11534 | [
"addPatterns",
"adds",
"entry",
"children",
"with",
"the",
"pattern",
"strings",
"."
] | [
"func",
"(",
"e",
"*",
"Entry",
")",
"addPatterns",
"(",
"patterns",
"[",
"]",
"string",
")",
"*",
"Entry",
"{",
"var",
"currentNode",
"*",
"Entry",
"=",
"e",
"\n\n",
"for",
"len",
"(",
"patterns",
")",
">",
"0",
"{",
"var",
"entry",
"*",
"Entry",
"\n",
"pat",
",",
"size",
":=",
"PeekNextPattern",
"(",
"patterns",
")",
"\n\n",
"// suffix entry",
"if",
"<mask>",
"==",
"2",
"{",
"matcher",
",",
"name",
":=",
"parseMatcher",
"(",
"patterns",
"[",
"0",
"]",
")",
"\n",
"suffixMatcher",
":=",
"&",
"SuffixMatcher",
"{",
"patterns",
"[",
"1",
"]",
",",
"matcher",
"}",
"\n",
"entry",
"=",
"newSuffixMatchEntry",
"(",
"pat",
",",
"name",
",",
"suffixMatcher",
")",
"\n",
"}",
"else",
"if",
"isMatchPattern",
"(",
"pat",
")",
"{",
"entry",
"=",
"newMatchEntry",
"(",
"pat",
")",
"\n",
"}",
"else",
"{",
"entry",
"=",
"newStaticEntry",
"(",
"pat",
")",
"\n",
"}",
"\n\n",
"currentNode",
".",
"AddEntry",
"(",
"entry",
")",
"\n",
"currentNode",
"=",
"entry",
"\n",
"patterns",
"=",
"patterns",
"[",
"size",
":",
"]",
"\n",
"}",
"\n\n",
"return",
"currentNode",
"\n",
"}"
] |
11,534 | all-11535 | [
"ArmForSwitch",
"returns",
"which",
"field",
"name",
"should",
"be",
"used",
"for",
"storing",
"the",
"value",
"for",
"an",
"instance",
"of",
"ChangeTrustResult"
] | [
"func",
"(",
"u",
"ChangeTrustResult",
")",
"ArmForSwitch",
"(",
"sw",
"int32",
")",
"(",
"string",
",",
"bool",
")",
"{",
"switch",
"ChangeTrustResultCode",
"(",
"sw",
")",
"{",
"<mask>",
"ChangeTrustResultCodeChangeTrustSuccess",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"default",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"}",
"\n",
"}"
] |
11,535 | all-11536 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"ContextState",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"ContextState",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"ContextStateSuspended",
":",
"*",
"t",
"=",
"ContextStateSuspended",
"\n",
"<mask>",
"ContextStateRunning",
":",
"*",
"t",
"=",
"ContextStateRunning",
"\n",
"case",
"ContextStateClosed",
":",
"*",
"t",
"=",
"ContextStateClosed",
"\n\n",
"default",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
] |
11,536 | all-11537 | [
"PushObj",
"pushes",
"data",
"from",
"commit",
"to",
"an",
"object",
"store",
"."
] | [
"func",
"PushObj",
"(",
"pachClient",
"*",
"pachclient",
".",
"APIClient",
",",
"<mask>",
"*",
"pfs",
".",
"Commit",
",",
"objClient",
"obj",
".",
"Client",
",",
"root",
"string",
")",
"error",
"{",
"var",
"eg",
"errgroup",
".",
"Group",
"\n",
"sem",
":=",
"make",
"(",
"chan",
"struct",
"{",
"}",
",",
"200",
")",
"\n",
"if",
"err",
":=",
"pachClient",
".",
"Walk",
"(",
"commit",
".",
"Repo",
".",
"Name",
",",
"commit",
".",
"ID",
",",
"\"",
"\"",
",",
"func",
"(",
"fileInfo",
"*",
"pfs",
".",
"FileInfo",
")",
"error",
"{",
"if",
"fileInfo",
".",
"FileType",
"!=",
"pfs",
".",
"FileType_FILE",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"eg",
".",
"Go",
"(",
"func",
"(",
")",
"(",
"retErr",
"error",
")",
"{",
"sem",
"<-",
"struct",
"{",
"}",
"{",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"<-",
"sem",
"}",
"(",
")",
"\n",
"w",
",",
"err",
":=",
"objClient",
".",
"Writer",
"(",
"pachClient",
".",
"Ctx",
"(",
")",
",",
"filepath",
".",
"Join",
"(",
"root",
",",
"fileInfo",
".",
"File",
".",
"Path",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
":=",
"w",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"&&",
"retErr",
"==",
"nil",
"{",
"retErr",
"=",
"err",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"return",
"pachClient",
".",
"GetFile",
"(",
"commit",
".",
"Repo",
".",
"Name",
",",
"commit",
".",
"ID",
",",
"fileInfo",
".",
"File",
".",
"Path",
",",
"0",
",",
"0",
",",
"w",
")",
"\n",
"}",
")",
"\n",
"return",
"nil",
"\n",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"eg",
".",
"Wait",
"(",
")",
"\n",
"}"
] |
11,537 | all-11538 | [
"Flush",
"writes",
"any",
"buffered",
"data",
"to",
"the",
"underlying",
"io",
".",
"Writer",
"."
] | [
"func",
"(",
"w",
"*",
"<mask>",
")",
"Flush",
"(",
")",
"error",
"{",
"if",
"w",
".",
"err",
"!=",
"nil",
"{",
"return",
"w",
".",
"err",
"\n",
"}",
"\n",
"return",
"w",
".",
"wr",
".",
"Flush",
"(",
")",
"\n",
"}"
] |
11,538 | all-11539 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"MakeSnapshotParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoLayertree11",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
11,539 | all-11540 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventNetworkStateUpdated",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache8",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
11,540 | all-11541 | [
"SetName",
"changes",
"the",
"optional",
"file",
"name",
".",
"An",
"empty",
"string",
"may",
"be",
"used",
"to",
"unset",
"it",
".",
"It",
"is",
"a",
"runtime",
"error",
"to",
"call",
"this",
"function",
"when",
"the",
"file",
"is",
"not",
"open",
"for",
"writing",
"."
] | [
"func",
"(",
"file",
"*",
"GridFile",
")",
"SetName",
"(",
"name",
"string",
")",
"{",
"file",
".",
"assertMode",
"(",
"gfsWriting",
")",
"\n",
"file",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"<mask>",
".",
"doc",
".",
"Filename",
"=",
"name",
"\n",
"file",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
11,541 | all-11542 | [
"Master",
"returns",
"the",
"master",
"keypair",
"for",
"a",
"given",
"network",
"passphrase"
] | [
"func",
"Master",
"(",
"networkPassphrase",
"string",
")",
"KP",
"{",
"kp",
",",
"err",
":=",
"FromRawSeed",
"(",
"network",
".",
"<mask>",
"(",
"networkPassphrase",
")",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"kp",
"\n",
"}"
] |
11,542 | all-11543 | [
"Save",
"changes",
"the",
"configuration",
"of",
"the",
"host",
"-",
"only",
"network",
"."
] | [
"func",
"(",
"n",
"*",
"hostOnlyNetwork",
")",
"Save",
"(",
"vbox",
"VBoxManager",
")",
"error",
"{",
"if",
"err",
":=",
"n",
".",
"SaveIPv4",
"(",
"vbox",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"n",
".",
"DHCP",
"{",
"vbox",
".",
"vbm",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"n",
".",
"<mask>",
",",
"\"",
"\"",
")",
"// not implemented as of VirtualBox 4.3",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
11,543 | all-11544 | [
"convertToHostname",
"converts",
"a",
"registry",
"url",
"which",
"has",
"http|https",
"prepended",
"to",
"just",
"an",
"hostname",
".",
"Copied",
"from",
"github",
".",
"com",
"/",
"docker",
"/",
"docker",
"/",
"registry",
"/",
"auth",
".",
"go"
] | [
"func",
"convertToHostname",
"(",
"url",
"string",
")",
"string",
"{",
"stripped",
":=",
"url",
"\n",
"if",
"strings",
".",
"HasPrefix",
"(",
"<mask>",
",",
"\"",
"\"",
")",
"{",
"stripped",
"=",
"strings",
".",
"TrimPrefix",
"(",
"url",
",",
"\"",
"\"",
")",
"\n",
"}",
"else",
"if",
"strings",
".",
"HasPrefix",
"(",
"url",
",",
"\"",
"\"",
")",
"{",
"stripped",
"=",
"strings",
".",
"TrimPrefix",
"(",
"url",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"nameParts",
":=",
"strings",
".",
"SplitN",
"(",
"stripped",
",",
"\"",
"\"",
",",
"2",
")",
"\n\n",
"return",
"nameParts",
"[",
"0",
"]",
"\n",
"}"
] |
11,544 | all-11545 | [
"Begin",
"starts",
"a",
"transaction",
"."
] | [
"func",
"(",
"db",
"*",
"DB",
")",
"Begin",
"(",
")",
"error",
"{",
"tx",
",",
"err",
":=",
"db",
".",
"db",
".",
"Begin",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"db",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"defer",
"db",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"<mask>",
".",
"tx",
"=",
"tx",
"\n",
"return",
"nil",
"\n",
"}"
] |
11,545 | all-11546 | [
"GoString",
"implements",
"fmt",
"GoStringer",
"interface",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"GoString",
"(",
")",
"string",
"{",
"buf",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"<mask>",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"c",
".",
"listen",
",",
"\"",
"\"",
":",
"c",
".",
"nodes",
",",
"\"",
"\"",
":",
"strconv",
".",
"FormatInt",
"(",
"int64",
"(",
"c",
".",
"buckets",
")",
",",
"10",
")",
",",
"}",
")",
"\n",
"return",
"string",
"(",
"buf",
")",
"\n",
"}"
] |
11,546 | all-11547 | [
"DeleteImageAlias",
"removes",
"an",
"alias",
"from",
"the",
"LXD",
"image",
"store"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"DeleteImageAlias",
"(",
"name",
"string",
")",
"error",
"{",
"// Send the request",
"_",
",",
"_",
",",
"err",
":=",
"r",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"name",
")",
")",
",",
"nil",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
11,547 | all-11548 | [
"switchStmt",
"emits",
"to",
"fn",
"code",
"for",
"the",
"switch",
"statement",
"s",
"optionally",
"labelled",
"by",
"label",
"."
] | [
"func",
"(",
"b",
"*",
"builder",
")",
"switchStmt",
"(",
"fn",
"*",
"Function",
",",
"s",
"*",
"ast",
".",
"SwitchStmt",
",",
"<mask>",
"*",
"lblock",
")",
"{",
"// We treat SwitchStmt like a sequential if-else chain.",
"// Multiway dispatch can be recovered later by ssautil.Switches()",
"// to those cases that are free of side effects.",
"if",
"s",
".",
"Init",
"!=",
"nil",
"{",
"b",
".",
"stmt",
"(",
"fn",
",",
"s",
".",
"Init",
")",
"\n",
"}",
"\n",
"var",
"tag",
"Value",
"=",
"vTrue",
"\n",
"if",
"s",
".",
"Tag",
"!=",
"nil",
"{",
"tag",
"=",
"b",
".",
"expr",
"(",
"fn",
",",
"s",
".",
"Tag",
")",
"\n",
"}",
"\n",
"done",
":=",
"fn",
".",
"newBasicBlock",
"(",
"\"",
"\"",
")",
"\n",
"if",
"label",
"!=",
"nil",
"{",
"label",
".",
"_break",
"=",
"done",
"\n",
"}",
"\n",
"// We pull the default case (if present) down to the end.",
"// But each fallthrough label must point to the next",
"// body block in source order, so we preallocate a",
"// body block (fallthru) for the next case.",
"// Unfortunately this makes for a confusing block order.",
"var",
"dfltBody",
"*",
"[",
"]",
"ast",
".",
"Stmt",
"\n",
"var",
"dfltFallthrough",
"*",
"BasicBlock",
"\n",
"var",
"fallthru",
",",
"dfltBlock",
"*",
"BasicBlock",
"\n",
"ncases",
":=",
"len",
"(",
"s",
".",
"Body",
".",
"List",
")",
"\n",
"for",
"i",
",",
"clause",
":=",
"range",
"s",
".",
"Body",
".",
"List",
"{",
"body",
":=",
"fallthru",
"\n",
"if",
"body",
"==",
"nil",
"{",
"body",
"=",
"fn",
".",
"newBasicBlock",
"(",
"\"",
"\"",
")",
"// first case only",
"\n",
"}",
"\n\n",
"// Preallocate body block for the next case.",
"fallthru",
"=",
"done",
"\n",
"if",
"i",
"+",
"1",
"<",
"ncases",
"{",
"fallthru",
"=",
"fn",
".",
"newBasicBlock",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"cc",
":=",
"clause",
".",
"(",
"*",
"ast",
".",
"CaseClause",
")",
"\n",
"if",
"cc",
".",
"List",
"==",
"nil",
"{",
"// Default case.",
"dfltBody",
"=",
"&",
"cc",
".",
"Body",
"\n",
"dfltFallthrough",
"=",
"fallthru",
"\n",
"dfltBlock",
"=",
"body",
"\n",
"continue",
"\n",
"}",
"\n\n",
"var",
"nextCond",
"*",
"BasicBlock",
"\n",
"for",
"_",
",",
"cond",
":=",
"range",
"cc",
".",
"List",
"{",
"nextCond",
"=",
"fn",
".",
"newBasicBlock",
"(",
"\"",
"\"",
")",
"\n",
"// TODO(adonovan): opt: when tag==vTrue, we'd",
"// get better code if we use b.cond(cond)",
"// instead of BinOp(EQL, tag, b.expr(cond))",
"// followed by If. Don't forget conversions",
"// though.",
"cond",
":=",
"emitCompare",
"(",
"fn",
",",
"token",
".",
"EQL",
",",
"tag",
",",
"b",
".",
"expr",
"(",
"fn",
",",
"cond",
")",
",",
"cond",
".",
"Pos",
"(",
")",
")",
"\n",
"emitIf",
"(",
"fn",
",",
"cond",
",",
"body",
",",
"nextCond",
")",
"\n",
"fn",
".",
"currentBlock",
"=",
"nextCond",
"\n",
"}",
"\n",
"fn",
".",
"currentBlock",
"=",
"body",
"\n",
"fn",
".",
"targets",
"=",
"&",
"targets",
"{",
"tail",
":",
"fn",
".",
"targets",
",",
"_break",
":",
"done",
",",
"_fallthrough",
":",
"fallthru",
",",
"}",
"\n",
"b",
".",
"stmtList",
"(",
"fn",
",",
"cc",
".",
"Body",
")",
"\n",
"fn",
".",
"targets",
"=",
"fn",
".",
"targets",
".",
"tail",
"\n",
"emitJump",
"(",
"fn",
",",
"done",
")",
"\n",
"fn",
".",
"currentBlock",
"=",
"nextCond",
"\n",
"}",
"\n",
"if",
"dfltBlock",
"!=",
"nil",
"{",
"emitJump",
"(",
"fn",
",",
"dfltBlock",
")",
"\n",
"fn",
".",
"currentBlock",
"=",
"dfltBlock",
"\n",
"fn",
".",
"targets",
"=",
"&",
"targets",
"{",
"tail",
":",
"fn",
".",
"targets",
",",
"_break",
":",
"done",
",",
"_fallthrough",
":",
"dfltFallthrough",
",",
"}",
"\n",
"b",
".",
"stmtList",
"(",
"fn",
",",
"*",
"dfltBody",
")",
"\n",
"fn",
".",
"targets",
"=",
"fn",
".",
"targets",
".",
"tail",
"\n",
"}",
"\n",
"emitJump",
"(",
"fn",
",",
"done",
")",
"\n",
"fn",
".",
"currentBlock",
"=",
"done",
"\n",
"}"
] |
11,548 | all-11549 | [
"NewInmemTransportWithTimeout",
"is",
"used",
"to",
"initialize",
"a",
"new",
"transport",
"and",
"generates",
"a",
"random",
"local",
"address",
"if",
"none",
"is",
"specified",
".",
"The",
"given",
"timeout",
"will",
"be",
"used",
"to",
"decide",
"how",
"long",
"to",
"wait",
"for",
"a",
"connected",
"peer",
"to",
"process",
"the",
"RPCs",
"that",
"we",
"re",
"sending",
"it",
".",
"See",
"also",
"Connect",
"()",
"and",
"Consumer",
"()",
"."
] | [
"func",
"NewInmemTransportWithTimeout",
"(",
"addr",
"ServerAddress",
",",
"timeout",
"time",
".",
"Duration",
")",
"(",
"ServerAddress",
",",
"*",
"InmemTransport",
")",
"{",
"if",
"string",
"(",
"addr",
")",
"==",
"\"",
"\"",
"{",
"addr",
"=",
"NewInmemAddr",
"(",
")",
"\n",
"}",
"\n",
"trans",
":=",
"&",
"InmemTransport",
"{",
"consumerCh",
":",
"make",
"(",
"chan",
"RPC",
",",
"16",
")",
",",
"localAddr",
":",
"addr",
",",
"peers",
":",
"make",
"(",
"<mask>",
"[",
"ServerAddress",
"]",
"*",
"InmemTransport",
")",
",",
"timeout",
":",
"timeout",
",",
"}",
"\n",
"return",
"addr",
",",
"trans",
"\n",
"}"
] |
11,549 | all-11550 | [
"NewS32",
"creates",
"a",
"new",
"hash",
".",
"Hash32",
"computing",
"the",
"32bit",
"xxHash",
"checksum",
"starting",
"with",
"the",
"specific",
"seed",
"."
] | [
"func",
"NewS32",
"(",
"<mask>",
"uint32",
")",
"(",
"xx",
"*",
"XXHash32",
")",
"{",
"xx",
"=",
"&",
"XXHash32",
"{",
"seed",
":",
"seed",
",",
"}",
"\n",
"xx",
".",
"Reset",
"(",
")",
"\n",
"return",
"\n",
"}"
] |
11,550 | all-11551 | [
"validate",
"checks",
"the",
"notificationRequest",
"has",
"0<Interests<11",
"and",
"has",
"a",
"APNS",
"GCM",
"or",
"FCM",
"payload"
] | [
"func",
"(",
"pn",
"*",
"notificationRequest",
")",
"validate",
"(",
")",
"error",
"{",
"if",
"0",
"==",
"len",
"(",
"pn",
".",
"Interests",
")",
"||",
"len",
"(",
"pn",
".",
"Interests",
")",
">",
"10",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"pn",
".",
"APNS",
"==",
"nil",
"&&",
"pn",
".",
"GCM",
"==",
"nil",
"&&",
"pn",
".",
"FCM",
"==",
"nil",
"{",
"return",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
11,551 | all-11552 | [
"Less",
"returns",
"true",
"if",
"this",
"column",
"sorts",
"before",
"the",
"given",
"Record",
"."
] | [
"func",
"(",
"b",
"Column",
")",
"Less",
"(",
"other",
"Record",
")",
"bool",
"{",
"if",
"ob",
",",
"<mask>",
":=",
"other",
".",
"(",
"Column",
")",
";",
"ok",
"{",
"if",
"b",
".",
"RowID",
"==",
"ob",
".",
"RowID",
"{",
"return",
"b",
".",
"ColumnID",
"<",
"ob",
".",
"ColumnID",
"\n",
"}",
"\n",
"return",
"b",
".",
"RowID",
"<",
"ob",
".",
"RowID",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
11,552 | all-11553 | [
"SetDocsUsage",
"sets",
"the",
"usage",
"string",
"for",
"a",
"docs",
"-",
"style",
"command",
".",
"Docs",
"commands",
"have",
"no",
"functionality",
"except",
"to",
"output",
"some",
"docs",
"and",
"related",
"commands",
"and",
"should",
"not",
"specify",
"a",
"Run",
"attribute",
"."
] | [
"func",
"SetDocsUsage",
"(",
"<mask>",
"*",
"cobra",
".",
"Command",
")",
"{",
"command",
".",
"SetHelpTemplate",
"(",
"`{{or .Long .Short}}\n\n{{.UsageString}}\n`",
")",
"\n\n",
"command",
".",
"SetUsageFunc",
"(",
"func",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
")",
"error",
"{",
"rootCmd",
":=",
"cmd",
".",
"Root",
"(",
")",
"\n\n",
"// Walk the command tree, finding commands with the documented word",
"var",
"associated",
"[",
"]",
"*",
"cobra",
".",
"Command",
"\n",
"var",
"walk",
"func",
"(",
"*",
"cobra",
".",
"Command",
")",
"\n",
"walk",
"=",
"func",
"(",
"cursor",
"*",
"cobra",
".",
"Command",
")",
"{",
"if",
"cursor",
".",
"Name",
"(",
")",
"==",
"cmd",
".",
"Name",
"(",
")",
"&&",
"cursor",
".",
"CommandPath",
"(",
")",
"!=",
"cmd",
".",
"CommandPath",
"(",
")",
"{",
"associated",
"=",
"append",
"(",
"associated",
",",
"cursor",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"subcmd",
":=",
"range",
"cursor",
".",
"Commands",
"(",
")",
"{",
"walk",
"(",
"subcmd",
")",
"\n",
"}",
"\n",
"}",
"\n",
"walk",
"(",
"rootCmd",
")",
"\n\n",
"var",
"maxCommandPath",
"int",
"\n",
"for",
"_",
",",
"x",
":=",
"range",
"associated",
"{",
"commandPathLen",
":=",
"len",
"(",
"x",
".",
"CommandPath",
"(",
")",
")",
"\n",
"if",
"commandPathLen",
">",
"maxCommandPath",
"{",
"maxCommandPath",
"=",
"commandPathLen",
"\n",
"}",
"\n",
"}",
"\n\n",
"templateFuncs",
":=",
"template",
".",
"FuncMap",
"{",
"\"",
"\"",
":",
"func",
"(",
"s",
"string",
")",
"string",
"{",
"format",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"maxCommandPath",
"+",
"1",
")",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"s",
")",
"\n",
"}",
",",
"\"",
"\"",
":",
"func",
"(",
")",
"[",
"]",
"*",
"cobra",
".",
"Command",
"{",
"return",
"associated",
"\n",
"}",
",",
"}",
"\n\n",
"text",
":=",
"`Associated Commands:{{range associated}}{{if .IsAvailableCommand}}\n {{pad .CommandPath}} {{.Short}}{{end}}{{end}}`",
"\n\n",
"t",
":=",
"template",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"t",
".",
"Funcs",
"(",
"templateFuncs",
")",
"\n",
"template",
".",
"Must",
"(",
"t",
".",
"Parse",
"(",
"text",
")",
")",
"\n",
"return",
"t",
".",
"Execute",
"(",
"cmd",
".",
"Out",
"(",
")",
",",
"cmd",
")",
"\n",
"}",
")",
"\n",
"}"
] |
11,553 | all-11554 | [
"FindReviewersOwnersForFile",
"returns",
"the",
"OWNERS",
"file",
"path",
"furthest",
"down",
"the",
"tree",
"for",
"a",
"specified",
"file",
"that",
"contains",
"a",
"reviewers",
"section"
] | [
"func",
"(",
"o",
"*",
"RepoOwners",
")",
"FindReviewersOwnersForFile",
"(",
"path",
"string",
")",
"string",
"{",
"return",
"findOwnersForFile",
"(",
"o",
".",
"<mask>",
",",
"path",
",",
"o",
".",
"reviewers",
")",
"\n",
"}"
] |
11,554 | all-11555 | [
"Handle",
"writes",
"all",
"provided",
"log",
"records",
"to",
"writer",
"provided",
"during",
"creation",
"."
] | [
"func",
"(",
"handler",
"*",
"WriteHandler",
")",
"Handle",
"(",
"record",
"*",
"Record",
")",
"error",
"{",
"_",
",",
"err",
":=",
"handler",
".",
"Writer",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"handler",
".",
"Formatter",
".",
"Format",
"(",
"<mask>",
")",
"+",
"\"",
"\\n",
"\"",
")",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
11,555 | all-11556 | [
"HasQuery",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TileDefEvent",
")",
"HasQuery",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"<mask>",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
11,556 | all-11557 | [
"marshal",
"marshals",
"the",
"key",
"s",
"string",
"representation",
"to",
"the",
"buffer",
"."
] | [
"func",
"(",
"k",
"*",
"<mask>",
")",
"marshal",
"(",
"b",
"*",
"bytes",
".",
"Buffer",
")",
"{",
"if",
"k",
".",
"parent",
"!=",
"nil",
"{",
"k",
".",
"parent",
".",
"marshal",
"(",
"b",
")",
"\n",
"}",
"\n",
"b",
".",
"WriteByte",
"(",
"'/'",
")",
"\n",
"b",
".",
"WriteString",
"(",
"k",
".",
"kind",
")",
"\n",
"b",
".",
"WriteByte",
"(",
"','",
")",
"\n",
"if",
"k",
".",
"stringID",
"!=",
"\"",
"\"",
"{",
"b",
".",
"WriteString",
"(",
"k",
".",
"stringID",
")",
"\n",
"}",
"else",
"{",
"b",
".",
"WriteString",
"(",
"strconv",
".",
"FormatInt",
"(",
"k",
".",
"intID",
",",
"10",
")",
")",
"\n",
"}",
"\n",
"}"
] |
11,557 | all-11558 | [
"connect",
"-",
"opens",
"a",
"new",
"connection",
"to",
"bigquery",
"reusing",
"the",
"token",
"if",
"possible",
"or",
"regenerating",
"a",
"new",
"auth",
"token",
"if",
"required"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"connect",
"(",
")",
"(",
"*",
"bigquery",
".",
"Service",
",",
"error",
")",
"{",
"if",
"c",
".",
"token",
"!=",
"nil",
"{",
"if",
"!",
"c",
".",
"token",
".",
"Valid",
"(",
")",
"&&",
"c",
".",
"service",
"!=",
"nil",
"{",
"return",
"c",
".",
"service",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"// generate auth token and create service object",
"//authScope := bigquery.BigqueryScope",
"pemKeyBytes",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"c",
".",
"pemPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"t",
",",
"err",
":=",
"google",
".",
"JWTConfigFromJSON",
"(",
"pemKeyBytes",
",",
"\"",
"\"",
")",
"\n",
"//t := jwt.NewToken(c.accountEmailAddress, bigquery.BigqueryScope, pemKeyBytes)",
"client",
":=",
"t",
".",
"Client",
"(",
"oauth2",
".",
"NoContext",
")",
"\n\n",
"service",
",",
"err",
":=",
"bigquery",
".",
"New",
"(",
"client",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"c",
".",
"<mask>",
"=",
"service",
"\n",
"return",
"service",
",",
"nil",
"\n",
"}"
] |
11,558 | all-11559 | [
"newMetricsMetadata",
"creates",
"the",
"singleton",
"metadata",
"object",
"."
] | [
"func",
"newMetricsMetadata",
"(",
"cluster",
"*",
"<mask>",
",",
"containerInstance",
"*",
"string",
")",
"*",
"ecstcs",
".",
"MetricsMetadata",
"{",
"return",
"&",
"ecstcs",
".",
"MetricsMetadata",
"{",
"Cluster",
":",
"cluster",
",",
"ContainerInstance",
":",
"containerInstance",
",",
"}",
"\n",
"}"
] |
11,559 | all-11560 | [
"request"
] | [
"func",
"(",
"h",
"*",
"segmentHeader",
")",
"write",
"(",
"wr",
"*",
"bufio",
".",
"Writer",
")",
"error",
"{",
"wr",
".",
"WriteInt32",
"(",
"h",
".",
"segmentLength",
")",
"\n",
"wr",
".",
"WriteInt32",
"(",
"h",
".",
"segmentOfs",
")",
"\n",
"wr",
".",
"WriteInt16",
"(",
"h",
".",
"noOfParts",
")",
"\n",
"wr",
".",
"WriteInt16",
"(",
"h",
".",
"segmentNo",
")",
"\n",
"wr",
".",
"WriteInt8",
"(",
"int8",
"(",
"h",
".",
"segmentKind",
")",
")",
"\n\n",
"switch",
"h",
".",
"segmentKind",
"{",
"default",
":",
"//error",
"wr",
".",
"WriteZeroes",
"(",
"11",
")",
"//segmentHeaderLength",
"\n\n",
"case",
"skRequest",
":",
"wr",
".",
"WriteInt8",
"(",
"int8",
"(",
"h",
".",
"messageType",
")",
")",
"\n",
"wr",
".",
"WriteBool",
"(",
"h",
".",
"commit",
")",
"\n",
"wr",
".",
"WriteInt8",
"(",
"int8",
"(",
"h",
".",
"commandOptions",
")",
")",
"\n",
"wr",
".",
"WriteZeroes",
"(",
"8",
")",
"//segmentHeaderSize",
"\n\n",
"<mask>",
"skReply",
":",
"wr",
".",
"WriteZeroes",
"(",
"1",
")",
"//reserved",
"\n",
"wr",
".",
"WriteInt16",
"(",
"int16",
"(",
"h",
".",
"functionCode",
")",
")",
"\n",
"wr",
".",
"WriteZeroes",
"(",
"8",
")",
"//segmentHeaderSize",
"\n\n",
"}",
"\n\n",
"if",
"trace",
"{",
"outLogger",
".",
"Printf",
"(",
"\"",
"\"",
",",
"h",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
11,560 | all-11561 | [
"Selendroid",
"returns",
"an",
"instance",
"of",
"a",
"Selendroid",
"WebDriver",
".",
"Provided",
"Options",
"will",
"apply",
"as",
"default",
"arguments",
"for",
"new",
"pages",
".",
"New",
"pages",
"will",
"accept",
"invalid",
"SSL",
"certificates",
"by",
"default",
".",
"This",
"may",
"be",
"disabled",
"using",
"the",
"RejectInvalidSSL",
"Option",
".",
"The",
"jarFile",
"is",
"a",
"relative",
"or",
"absolute",
"path",
"to",
"Selendroid",
"JAR",
"file",
".",
"Selendroid",
"will",
"return",
"nil",
"if",
"an",
"invalid",
"path",
"is",
"provided",
"."
] | [
"func",
"Selendroid",
"(",
"jarFile",
"string",
",",
"options",
"...",
"Option",
")",
"*",
"WebDriver",
"{",
"absJARPath",
",",
"err",
":=",
"filepath",
".",
"Abs",
"(",
"jarFile",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"command",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"absJARPath",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"}",
"\n",
"options",
"=",
"append",
"(",
"[",
"]",
"Option",
"{",
"Timeout",
"(",
"90",
")",
",",
"<mask>",
"(",
"\"",
"\"",
")",
"}",
",",
"options",
"...",
")",
"\n",
"return",
"NewWebDriver",
"(",
"\"",
"\"",
",",
"command",
",",
"options",
"...",
")",
"\n",
"}"
] |
11,561 | all-11562 | [
"reset",
"clears",
"any",
"internal",
"state",
"."
] | [
"func",
"(",
"tkn",
"*",
"Tokenizer",
")",
"<mask>",
"(",
")",
"{",
"tkn",
".",
"ParseTree",
"=",
"nil",
"\n",
"tkn",
".",
"partialDDL",
"=",
"nil",
"\n",
"tkn",
".",
"specialComment",
"=",
"nil",
"\n",
"tkn",
".",
"posVarIndex",
"=",
"0",
"\n",
"tkn",
".",
"nesting",
"=",
"0",
"\n",
"tkn",
".",
"ForceEOF",
"=",
"false",
"\n",
"}"
] |
11,562 | all-11563 | [
"selectEventsForReference",
"allows",
"you",
"to",
"query",
"events",
"for",
"a",
"specific",
"ManagedObjectReference",
".",
"Event",
"types",
"can",
"be",
"supplied",
"to",
"this",
"function",
"via",
"the",
"eventTypes",
"parameter",
".",
"This",
"is",
"highly",
"recommended",
"when",
"you",
"expect",
"the",
"list",
"of",
"events",
"to",
"be",
"large",
"as",
"there",
"is",
"no",
"limit",
"on",
"returned",
"events",
"."
] | [
"func",
"selectEventsForReference",
"(",
"client",
"*",
"govmomi",
".",
"Client",
",",
"ref",
"types",
".",
"ManagedObjectReference",
",",
"eventTypes",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"<mask>",
".",
"BaseEvent",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"defaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"filter",
":=",
"types",
".",
"EventFilterSpec",
"{",
"Entity",
":",
"&",
"types",
".",
"EventFilterSpecByEntity",
"{",
"Entity",
":",
"ref",
",",
"Recursion",
":",
"types",
".",
"EventFilterSpecRecursionOptionAll",
",",
"}",
",",
"EventTypeId",
":",
"eventTypes",
",",
"}",
"\n",
"mgr",
":=",
"event",
".",
"NewManager",
"(",
"client",
".",
"Client",
")",
"\n",
"return",
"mgr",
".",
"QueryEvents",
"(",
"ctx",
",",
"filter",
")",
"\n",
"}"
] |
11,563 | all-11564 | [
"GetSubmissionURL",
"returns",
"submission",
"url",
"for",
"circonus"
] | [
"func",
"(",
"cm",
"*",
"CheckManager",
")",
"GetSubmissionURL",
"(",
")",
"(",
"*",
"Trap",
",",
"error",
")",
"{",
"if",
"cm",
".",
"trapURL",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"trap",
":=",
"&",
"Trap",
"{",
"}",
"\n\n",
"u",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"string",
"(",
"cm",
".",
"trapURL",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"trap",
".",
"URL",
"=",
"u",
"\n\n",
"if",
"u",
".",
"Scheme",
"==",
"\"",
"\"",
"{",
"service",
":=",
"\"",
"\"",
"\n",
"sockPath",
":=",
"\"",
"\"",
"\n",
"metricID",
":=",
"\"",
"\"",
"\n\n",
"subNames",
":=",
"cm",
".",
"sockRx",
".",
"SubexpNames",
"(",
")",
"\n",
"matches",
":=",
"cm",
".",
"sockRx",
".",
"FindAllStringSubmatch",
"(",
"string",
"(",
"cm",
".",
"trapURL",
")",
",",
"-",
"1",
")",
"\n",
"for",
"_",
",",
"match",
":=",
"range",
"matches",
"{",
"for",
"idx",
",",
"val",
":=",
"range",
"match",
"{",
"switch",
"subNames",
"[",
"idx",
"]",
"{",
"case",
"\"",
"\"",
":",
"sockPath",
"=",
"val",
"\n",
"case",
"\"",
"\"",
":",
"metricID",
"=",
"val",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"sockPath",
"==",
"\"",
"\"",
"||",
"metricID",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"cm",
".",
"trapURL",
")",
"\n",
"}",
"\n\n",
"u",
",",
"err",
"=",
"url",
".",
"Parse",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
",",
"metricID",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"trap",
".",
"URL",
"=",
"u",
"\n\n",
"trap",
".",
"SockTransport",
"=",
"&",
"httpunix",
".",
"Transport",
"{",
"DialTimeout",
":",
"100",
"*",
"time",
".",
"Millisecond",
",",
"RequestTimeout",
":",
"1",
"*",
"time",
".",
"Second",
",",
"ResponseHeaderTimeout",
":",
"1",
"*",
"time",
".",
"Second",
",",
"}",
"\n",
"trap",
".",
"SockTransport",
".",
"RegisterLocation",
"(",
"service",
",",
"sockPath",
")",
"\n",
"trap",
".",
"IsSocket",
"=",
"true",
"\n",
"}",
"\n\n",
"if",
"u",
".",
"Scheme",
"==",
"\"",
"\"",
"{",
"// preference user-supplied TLS configuration",
"if",
"cm",
".",
"brokerTLS",
"!=",
"nil",
"{",
"trap",
".",
"TLS",
"=",
"cm",
".",
"brokerTLS",
"\n",
"return",
"trap",
",",
"nil",
"\n",
"}",
"\n\n",
"// api.circonus.com uses a public CA signed certificate",
"// trap.noit.circonus.net uses Circonus CA private certificate",
"// enterprise brokers use private CA certificate",
"if",
"trap",
".",
"URL",
".",
"Hostname",
"(",
")",
"==",
"\"",
"\"",
"{",
"return",
"trap",
",",
"nil",
"\n",
"}",
"\n\n",
"if",
"cm",
".",
"certPool",
"==",
"nil",
"{",
"if",
"err",
":=",
"cm",
".",
"loadCACert",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"t",
":=",
"&",
"tls",
".",
"Config",
"{",
"RootCAs",
":",
"cm",
".",
"certPool",
",",
"}",
"\n",
"if",
"cm",
".",
"trapCN",
"!=",
"\"",
"\"",
"{",
"t",
".",
"ServerName",
"=",
"string",
"(",
"cm",
".",
"trapCN",
")",
"\n",
"}",
"\n",
"trap",
".",
"TLS",
"=",
"t",
"\n",
"}",
"\n\n",
"return",
"trap",
",",
"nil",
"\n",
"}"
] |
11,564 | all-11565 | [
"AddTokenIndexes",
"will",
"add",
"access",
"token",
"indexes",
"to",
"the",
"specified",
"indexer",
"."
] | [
"func",
"AddTokenIndexes",
"(",
"i",
"*",
"coal",
".",
"Indexer",
",",
"autoExpire",
"bool",
")",
"{",
"i",
".",
"Add",
"(",
"&",
"Token",
"{",
"}",
",",
"false",
",",
"0",
",",
"\"",
"\"",
")",
"\n",
"i",
".",
"Add",
"(",
"&",
"Token",
"{",
"}",
",",
"false",
",",
"0",
",",
"\"",
"\"",
")",
"\n",
"i",
".",
"Add",
"(",
"&",
"Token",
"{",
"}",
",",
"<mask>",
",",
"0",
",",
"\"",
"\"",
")",
"\n\n",
"if",
"autoExpire",
"{",
"i",
".",
"Add",
"(",
"&",
"Token",
"{",
"}",
",",
"false",
",",
"time",
".",
"Minute",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
11,565 | all-11566 | [
"Create",
"a",
"new",
"Application",
".",
"This",
"request",
"must",
"include",
"a",
"FriendlyName",
"and",
"can",
"include",
"these",
"values",
":",
"https",
":",
"//",
"www",
".",
"twilio",
".",
"com",
"/",
"docs",
"/",
"api",
"/",
"rest",
"/",
"applications#list",
"-",
"post",
"-",
"optional",
"-",
"parameters"
] | [
"func",
"(",
"c",
"*",
"ApplicationService",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"data",
"<mask>",
".",
"Values",
")",
"(",
"*",
"Application",
",",
"error",
")",
"{",
"application",
":=",
"new",
"(",
"Application",
")",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"CreateResource",
"(",
"ctx",
",",
"applicationPathPart",
",",
"data",
",",
"application",
")",
"\n",
"return",
"application",
",",
"err",
"\n",
"}"
] |
11,566 | all-11567 | [
"ProwJobClient",
"returns",
"a",
"ProwJob",
"client",
"."
] | [
"func",
"(",
"o",
"*",
"ExperimentalKubernetesOptions",
")",
"ProwJobClient",
"(",
"namespace",
"<mask>",
",",
"dryRun",
"bool",
")",
"(",
"prowJobClient",
"prowv1",
".",
"ProwJobInterface",
",",
"err",
"error",
")",
"{",
"if",
"err",
":=",
"o",
".",
"resolve",
"(",
"dryRun",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"dryRun",
"{",
"return",
"kube",
".",
"NewDryRunProwJobClient",
"(",
"o",
".",
"DeckURI",
")",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"o",
".",
"prowJobClientset",
".",
"ProwV1",
"(",
")",
".",
"ProwJobs",
"(",
"namespace",
")",
",",
"nil",
"\n",
"}"
] |
11,567 | all-11568 | [
"fixLoad",
"updates",
"a",
"load",
"statement",
"with",
"the",
"given",
"symbols",
".",
"If",
"load",
"is",
"nil",
"a",
"new",
"load",
"may",
"be",
"created",
"and",
"returned",
".",
"Symbols",
"in",
"kinds",
"will",
"be",
"added",
"to",
"the",
"load",
"if",
"they",
"re",
"not",
"already",
"present",
".",
"Known",
"symbols",
"not",
"in",
"kinds",
"will",
"be",
"removed",
"if",
"present",
".",
"Other",
"symbols",
"will",
"be",
"preserved",
".",
"If",
"load",
"is",
"empty",
"nil",
"is",
"returned",
"."
] | [
"func",
"fixLoad",
"(",
"load",
"*",
"rule",
".",
"Load",
",",
"<mask>",
"string",
",",
"kinds",
"map",
"[",
"string",
"]",
"bool",
",",
"knownKinds",
"map",
"[",
"string",
"]",
"string",
")",
"*",
"rule",
".",
"Load",
"{",
"if",
"load",
"==",
"nil",
"{",
"if",
"len",
"(",
"kinds",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"load",
"=",
"rule",
".",
"NewLoad",
"(",
"file",
")",
"\n",
"}",
"\n\n",
"for",
"k",
":=",
"range",
"kinds",
"{",
"load",
".",
"Add",
"(",
"k",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"k",
":=",
"range",
"load",
".",
"Symbols",
"(",
")",
"{",
"if",
"knownKinds",
"[",
"k",
"]",
"!=",
"\"",
"\"",
"&&",
"!",
"kinds",
"[",
"k",
"]",
"{",
"load",
".",
"Remove",
"(",
"k",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"load",
"\n",
"}"
] |
11,568 | all-11569 | [
"runServer",
"performs",
"the",
"main",
"work",
"of",
"the",
"server",
".",
"Once",
"started",
"the",
"server",
"will",
":",
"*",
"Copy",
"BUILD",
".",
"in",
"and",
"BUILD",
".",
"bazel",
".",
"in",
"files",
"to",
"BUILD",
"and",
"BUILD",
".",
"bazel",
".",
"*",
"Watch",
"for",
"file",
"system",
"writes",
"in",
"the",
"whole",
"repository",
".",
"*",
"Listen",
"for",
"clients",
"on",
"a",
"UNIX",
"-",
"domain",
"socket",
".",
"When",
"the",
"server",
"accepts",
"a",
"connection",
"it",
"runs",
"Gazelle",
".",
"On",
"the",
"first",
"run",
"it",
"runs",
"Gazelle",
"on",
"the",
"entire",
"repository",
".",
"On",
"subsequent",
"runs",
"it",
"runs",
"Gazelle",
"only",
"in",
"directories",
"that",
"have",
"changed",
".",
"The",
"server",
"stops",
"after",
"being",
"idle",
"for",
"a",
"while",
".",
"It",
"can",
"also",
"be",
"stopped",
"with",
"SIGINT",
"or",
"SIGTERM",
"."
] | [
"func",
"runServer",
"(",
")",
"error",
"{",
"// Begin logging to the log file.",
"logFile",
",",
"err",
":=",
"os",
".",
"OpenFile",
"(",
"*",
"logPath",
",",
"os",
".",
"O_WRONLY",
"|",
"os",
".",
"O_CREATE",
"|",
"os",
".",
"O_APPEND",
",",
"0666",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"logFile",
".",
"Close",
"(",
")",
"\n",
"log",
".",
"SetOutput",
"(",
"logFile",
")",
"\n\n",
"// Start listening on the socket before other initialization work. The client",
"// will dial immediately after starting the server, and we don't want",
"// the client to time out.",
"os",
".",
"Remove",
"(",
"*",
"socketPath",
")",
"\n",
"ln",
",",
"err",
":=",
"net",
".",
"Listen",
"(",
"\"",
"\"",
",",
"*",
"socketPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"uln",
":=",
"ln",
".",
"(",
"*",
"net",
".",
"UnixListener",
")",
"\n",
"uln",
".",
"SetUnlinkOnClose",
"(",
"true",
")",
"\n",
"defer",
"ln",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
":=",
"uln",
".",
"SetDeadline",
"(",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"*",
"serverTimeout",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"<mask>",
".",
"Printf",
"(",
"\"",
"\"",
",",
"os",
".",
"Getpid",
"(",
")",
")",
"\n\n",
"// Copy BUILD.in files to BUILD.",
"restoreBuildFilesInRepo",
"(",
")",
"\n\n",
"// Listen for file writes within the repository.",
"cancelWatch",
",",
"err",
":=",
"watchDir",
"(",
"\"",
"\"",
",",
"recordWrite",
")",
"\n",
"isWatching",
":=",
"err",
"==",
"nil",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Print",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"isWatching",
"{",
"defer",
"cancelWatch",
"(",
")",
"\n",
"}",
"\n\n",
"// Wait for clients to connect. Each time the client connects, we run",
"// gazelle, either in the whole repository or in changed directories.",
"mode",
":=",
"fullMode",
"\n",
"for",
"{",
"c",
",",
"err",
":=",
"ln",
".",
"Accept",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"operr",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"net",
".",
"OpError",
")",
";",
"ok",
"{",
"if",
"operr",
".",
"Timeout",
"(",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"operr",
".",
"Temporary",
"(",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"log",
".",
"SetOutput",
"(",
"io",
".",
"MultiWriter",
"(",
"c",
",",
"logFile",
")",
")",
"\n",
"dirs",
":=",
"getAndClearWrittenDirs",
"(",
")",
"\n",
"for",
"_",
",",
"dir",
":=",
"range",
"dirs",
"{",
"restoreBuildFilesInDir",
"(",
"dir",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"runGazelle",
"(",
"mode",
",",
"dirs",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Print",
"(",
"err",
")",
"\n",
"}",
"\n",
"log",
".",
"SetOutput",
"(",
"logFile",
")",
"\n",
"c",
".",
"Close",
"(",
")",
"\n",
"if",
"isWatching",
"{",
"mode",
"=",
"fastMode",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
11,569 | all-11570 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"CookieParam",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork61",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
11,570 | all-11571 | [
"New",
"returns",
"an",
"Index",
"client",
"configured",
"to",
"run",
"against",
"production",
".",
"Pass",
"in",
"nil",
"credentials",
"to",
"create",
"a",
"client",
"without",
"authentication",
".",
"The",
"returned",
"client",
"is",
"mutable",
"so",
"returned",
"settings",
"can",
"be",
"altered",
".",
"index",
":",
"=",
"tcindex",
".",
"New",
"(",
"nil",
"//",
"client",
"without",
"authentication",
"http",
":",
"//",
"localhost",
":",
"1234",
"/",
"my",
"/",
"taskcluster",
"//",
"taskcluster",
"hosted",
"at",
"this",
"root",
"URL",
"on",
"local",
"machine",
")",
"err",
":",
"=",
"index",
".",
"Ping",
"(",
".....",
")",
"//",
"for",
"example",
"call",
"the",
"Ping",
"(",
".....",
")",
"API",
"endpoint",
"(",
"described",
"further",
"down",
")",
"...",
"if",
"err",
"!",
"=",
"nil",
"{",
"//",
"handle",
"errors",
"...",
"}"
] | [
"func",
"New",
"(",
"credentials",
"*",
"tcclient",
".",
"Credentials",
",",
"rootURL",
"string",
")",
"*",
"Index",
"{",
"return",
"&",
"<mask>",
"{",
"Credentials",
":",
"credentials",
",",
"BaseURL",
":",
"tcclient",
".",
"BaseURL",
"(",
"rootURL",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
",",
"Authenticate",
":",
"credentials",
"!=",
"nil",
",",
"}",
"\n",
"}"
] |
11,571 | all-11572 | [
"Do",
"executes",
"HeapProfiler",
".",
"collectGarbage",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"CollectGarbageParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandCollectGarbage",
",",
"nil",
",",
"nil",
")",
"\n",
"}"
] |
11,572 | all-11573 | [
"Name",
"is",
"the",
"naked",
"function",
"name",
"."
] | [
"func",
"(",
"f",
"*",
"Func",
")",
"<mask>",
"(",
")",
"string",
"{",
"parts",
":=",
"strings",
".",
"SplitN",
"(",
"filepath",
".",
"Base",
"(",
"f",
".",
"Raw",
")",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"parts",
")",
"==",
"1",
"{",
"return",
"parts",
"[",
"0",
"]",
"\n",
"}",
"\n",
"return",
"parts",
"[",
"1",
"]",
"\n",
"}"
] |
11,573 | all-11574 | [
"SetLineCap",
"is",
"a",
"wrapper",
"around",
"cairo_set_line_cap",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetLineCap",
"(",
"lineCap",
"LineCap",
")",
"{",
"C",
".",
"cairo_set_line_cap",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"cairo_line_cap_t",
"(",
"lineCap",
")",
")",
"\n",
"}"
] |
11,574 | all-11575 | [
"MutateTransaction",
"for",
"InflationBuilder",
"causes",
"the",
"underylying",
"InflationOp",
"to",
"be",
"added",
"to",
"the",
"operation",
"list",
"for",
"the",
"provided",
"transaction"
] | [
"func",
"(",
"m",
"InflationBuilder",
")",
"MutateTransaction",
"(",
"o",
"*",
"TransactionBuilder",
")",
"error",
"{",
"if",
"m",
".",
"Err",
"!=",
"nil",
"{",
"return",
"m",
".",
"Err",
"\n",
"}",
"\n\n",
"m",
".",
"O",
".",
"<mask>",
",",
"m",
".",
"Err",
"=",
"xdr",
".",
"NewOperationBody",
"(",
"xdr",
".",
"OperationTypeInflation",
",",
"nil",
")",
"\n",
"o",
".",
"TX",
".",
"Operations",
"=",
"append",
"(",
"o",
".",
"TX",
".",
"Operations",
",",
"m",
".",
"O",
")",
"\n",
"return",
"m",
".",
"Err",
"\n",
"}"
] |
11,575 | all-11576 | [
"App",
"is",
"where",
"all",
"routes",
"and",
"middleware",
"for",
"buffalo",
"should",
"be",
"defined",
".",
"This",
"is",
"the",
"nerve",
"center",
"of",
"your",
"application",
".",
"Routing",
"middleware",
"groups",
"etc",
"...",
"are",
"declared",
"TOP",
"-",
">",
"DOWN",
".",
"This",
"means",
"if",
"you",
"add",
"a",
"middleware",
"to",
"app",
"*",
"after",
"*",
"declaring",
"a",
"group",
"that",
"group",
"will",
"NOT",
"have",
"that",
"new",
"middleware",
".",
"The",
"same",
"is",
"true",
"of",
"resource",
"declarations",
"as",
"well",
".",
"It",
"also",
"means",
"that",
"routes",
"are",
"checked",
"in",
"the",
"order",
"they",
"are",
"declared",
".",
"ServeFiles",
"is",
"a",
"CATCH",
"-",
"ALL",
"route",
"so",
"it",
"should",
"always",
"be",
"placed",
"last",
"in",
"the",
"route",
"declarations",
"as",
"it",
"will",
"prevent",
"routes",
"declared",
"after",
"it",
"to",
"never",
"be",
"called",
"."
] | [
"func",
"App",
"(",
")",
"*",
"buffalo",
".",
"App",
"{",
"if",
"app",
"==",
"nil",
"{",
"app",
"=",
"buffalo",
".",
"New",
"(",
"buffalo",
".",
"Options",
"{",
"Env",
":",
"ENV",
",",
"SessionName",
":",
"\"",
"\"",
",",
"}",
")",
"\n\n",
"// Automatically redirect to SSL",
"app",
".",
"Use",
"(",
"forceSSL",
"(",
")",
")",
"\n\n",
"// Log request parameters (filters apply).",
"app",
".",
"Use",
"(",
"paramlogger",
".",
"ParameterLogger",
")",
"\n\n",
"// Protect against CSRF attacks. https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)",
"// Remove to disable this.",
"app",
".",
"Use",
"(",
"csrf",
".",
"New",
")",
"\n\n",
"// Wraps each request in a transaction.",
"// c.Value(\"tx\").(*pop.Connection)",
"// Remove to disable this.",
"app",
".",
"Use",
"(",
"popmw",
".",
"Transaction",
"(",
"<mask>",
".",
"DB",
")",
")",
"\n\n",
"// Setup and use translations:",
"app",
".",
"Use",
"(",
"translations",
"(",
")",
")",
"\n\n",
"app",
".",
"GET",
"(",
"\"",
"\"",
",",
"HomeHandler",
")",
"\n\n",
"app",
".",
"ServeFiles",
"(",
"\"",
"\"",
",",
"assetsBox",
")",
"// serve files from the public directory",
"\n",
"}",
"\n\n",
"return",
"app",
"\n",
"}"
] |
11,576 | all-11577 | [
"cephOSDPoolDestroy",
"destroys",
"an",
"OSD",
"pool",
".",
"-",
"A",
"call",
"to",
"cephOSDPoolDestroy",
"will",
"destroy",
"a",
"pool",
"including",
"any",
"storage",
"volumes",
"that",
"still",
"exist",
"in",
"the",
"pool",
".",
"-",
"In",
"case",
"the",
"OSD",
"pool",
"that",
"is",
"supposed",
"to",
"be",
"deleted",
"does",
"not",
"exist",
"this",
"command",
"will",
"still",
"exit",
"0",
".",
"This",
"means",
"that",
"if",
"the",
"caller",
"wants",
"to",
"be",
"sure",
"that",
"this",
"call",
"actually",
"deleted",
"an",
"OSD",
"pool",
"it",
"needs",
"to",
"check",
"for",
"the",
"existence",
"of",
"the",
"pool",
"first",
"."
] | [
"func",
"cephOSDPoolDestroy",
"(",
"clusterName",
"string",
",",
"poolName",
"string",
",",
"userName",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"<mask>",
".",
"RunCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"userName",
")",
",",
"\"",
"\"",
",",
"clusterName",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"poolName",
",",
"poolName",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
11,577 | all-11578 | [
"GetDescriptionOk",
"returns",
"a",
"tuple",
"with",
"the",
"Description",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"m",
"*",
"MetricMetadata",
")",
"GetDescriptionOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"m",
"==",
"nil",
"||",
"m",
".",
"Description",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"m",
".",
"<mask>",
",",
"true",
"\n",
"}"
] |
11,578 | all-11579 | [
"fetchRecentEventsAndComments",
"retrieves",
"events",
"from",
"DB",
"but",
"only",
"fetches",
"events",
"created",
"since",
"last",
"call"
] | [
"func",
"(",
"f",
"*",
"Fetcher",
")",
"fetchRecentEventsAndComments",
"(",
"db",
"*",
"gorm",
".",
"DB",
")",
"error",
"{",
"glog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"f",
".",
"lastEvent",
")",
"\n",
"glog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"f",
".",
"lastComment",
")",
"\n\n",
"eventRows",
",",
"err",
":=",
"db",
".",
"Model",
"(",
"sql",
".",
"IssueEvent",
"{",
"}",
")",
".",
"Where",
"(",
"\"",
"\"",
",",
"f",
".",
"repository",
")",
".",
"Where",
"(",
"\"",
"\"",
",",
"f",
".",
"lastEvent",
")",
".",
"Order",
"(",
"\"",
"\"",
")",
".",
"Rows",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"commentRows",
",",
"err",
":=",
"db",
".",
"Model",
"(",
"sql",
".",
"Comment",
"{",
"}",
")",
".",
"Where",
"(",
"\"",
"\"",
",",
"f",
".",
"repository",
")",
".",
"Where",
"(",
"\"",
"\"",
",",
"f",
".",
"lastComment",
")",
".",
"Order",
"(",
"\"",
"\"",
")",
".",
"Rows",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"count",
":=",
"0",
"\n",
"comment",
":=",
"&",
"sql",
".",
"Comment",
"{",
"}",
"\n",
"if",
"commentRows",
".",
"Next",
"(",
")",
"{",
"db",
".",
"ScanRows",
"(",
"commentRows",
",",
"comment",
")",
"\n",
"}",
"else",
"{",
"comment",
"=",
"nil",
"\n",
"}",
"\n",
"event",
":=",
"&",
"sql",
".",
"IssueEvent",
"{",
"}",
"\n",
"if",
"eventRows",
".",
"Next",
"(",
")",
"{",
"db",
".",
"ScanRows",
"(",
"eventRows",
",",
"event",
")",
"\n",
"}",
"else",
"{",
"event",
"=",
"nil",
"\n",
"}",
"\n\n",
"for",
"event",
"!=",
"nil",
"||",
"comment",
"!=",
"nil",
"{",
"if",
"event",
"==",
"nil",
"||",
"(",
"comment",
"!=",
"nil",
"&&",
"comment",
".",
"CommentCreatedAt",
".",
"Before",
"(",
"event",
".",
"EventCreatedAt",
")",
")",
"{",
"f",
".",
"EventsCommentsChannel",
"<-",
"*",
"comment",
"\n",
"f",
".",
"lastComment",
"=",
"<mask>",
".",
"CommentCreatedAt",
"\n",
"if",
"commentRows",
".",
"Next",
"(",
")",
"{",
"db",
".",
"ScanRows",
"(",
"commentRows",
",",
"comment",
")",
"\n",
"}",
"else",
"{",
"comment",
"=",
"nil",
"\n",
"}",
"\n",
"}",
"else",
"{",
"f",
".",
"EventsCommentsChannel",
"<-",
"*",
"event",
"\n",
"f",
".",
"lastEvent",
"=",
"event",
".",
"EventCreatedAt",
"\n",
"if",
"eventRows",
".",
"Next",
"(",
")",
"{",
"db",
".",
"ScanRows",
"(",
"eventRows",
",",
"event",
")",
"\n",
"}",
"else",
"{",
"event",
"=",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"count",
"++",
"\n",
"}",
"\n\n",
"glog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"count",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
11,579 | all-11580 | [
"GetAboveChild",
"is",
"a",
"wrapper",
"around",
"gtk_event_box_get_above_child",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"EventBox",
")",
"GetAboveChild",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_event_box_get_above_child",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
11,580 | all-11581 | [
"Execute",
"evaluates",
"this",
"template",
"in",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"t",
"*",
"Template",
")",
"Execute",
"(",
"i",
"*",
"ExecuteInput",
")",
"(",
"*",
"ExecuteResult",
",",
"error",
")",
"{",
"if",
"i",
"==",
"nil",
"{",
"i",
"=",
"&",
"ExecuteInput",
"{",
"}",
"\n",
"}",
"\n\n",
"var",
"used",
",",
"<mask>",
"dep",
".",
"Set",
"\n\n",
"tmpl",
":=",
"template",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"tmpl",
".",
"Delims",
"(",
"t",
".",
"leftDelim",
",",
"t",
".",
"rightDelim",
")",
"\n",
"tmpl",
".",
"Funcs",
"(",
"funcMap",
"(",
"&",
"funcMapInput",
"{",
"t",
":",
"tmpl",
",",
"brain",
":",
"i",
".",
"Brain",
",",
"env",
":",
"i",
".",
"Env",
",",
"used",
":",
"&",
"used",
",",
"missing",
":",
"&",
"missing",
",",
"}",
")",
")",
"\n\n",
"if",
"t",
".",
"errMissingKey",
"{",
"tmpl",
".",
"Option",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"tmpl",
".",
"Option",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"tmpl",
",",
"err",
":=",
"tmpl",
".",
"Parse",
"(",
"t",
".",
"contents",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Execute the template into the writer",
"var",
"b",
"bytes",
".",
"Buffer",
"\n",
"if",
"err",
":=",
"tmpl",
".",
"Execute",
"(",
"&",
"b",
",",
"nil",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"ExecuteResult",
"{",
"Used",
":",
"&",
"used",
",",
"Missing",
":",
"&",
"missing",
",",
"Output",
":",
"b",
".",
"Bytes",
"(",
")",
",",
"}",
",",
"nil",
"\n",
"}"
] |
11,581 | all-11582 | [
"query",
"the",
"index",
"of",
"a",
"named",
"resource",
"within",
"a",
"program"
] | [
"func",
"GetProgramResourceIndex",
"(",
"program",
"uint32",
",",
"programInterface",
"uint32",
",",
"name",
"*",
"uint8",
")",
"uint32",
"{",
"ret",
",",
"_",
",",
"_",
":=",
"syscall",
".",
"Syscall",
"(",
"gpGetProgramResourceIndex",
",",
"3",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"programInterface",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
")",
")",
")",
"\n",
"return",
"(",
"uint32",
")",
"(",
"ret",
")",
"\n",
"}"
] |
11,582 | all-11583 | [
"HasValue",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinitionMarker",
")",
"HasValue",
"(",
")",
"bool",
"{",
"if",
"g",
"!=",
"nil",
"&&",
"g",
".",
"Value",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
11,583 | all-11584 | [
"Do",
"executes",
"Network",
".",
"searchInResponseBody",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"result",
"-",
"List",
"of",
"search",
"matches",
"."
] | [
"func",
"(",
"p",
"*",
"SearchInResponseBodyParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"result",
"[",
"]",
"*",
"debugger",
".",
"SearchMatch",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"SearchInResponseBodyReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSearchInResponseBody",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"<mask>",
",",
"nil",
"\n",
"}"
] |
11,584 | all-11585 | [
"flattenHostNicTeamingPolicy",
"reads",
"various",
"fields",
"from",
"a",
"HostNicTeamingPolicy",
"into",
"the",
"passed",
"in",
"ResourceData",
"."
] | [
"func",
"flattenHostNicTeamingPolicy",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"<mask>",
".",
"HostNicTeamingPolicy",
")",
"error",
"{",
"if",
"obj",
".",
"RollingOrder",
"!=",
"nil",
"{",
"v",
":=",
"*",
"obj",
".",
"RollingOrder",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"!",
"v",
")",
"\n",
"}",
"\n",
"if",
"obj",
".",
"NotifySwitches",
"!=",
"nil",
"{",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"NotifySwitches",
")",
"\n",
"}",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"Policy",
")",
"\n",
"if",
"err",
":=",
"flattenHostNicFailureCriteria",
"(",
"d",
",",
"obj",
".",
"FailureCriteria",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"flattenHostNicOrderPolicy",
"(",
"d",
",",
"obj",
".",
"NicOrder",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
11,585 | all-11586 | [
"Routes",
"returns",
"a",
"list",
"of",
"all",
"of",
"the",
"routes",
"defined",
"in",
"this",
"application",
"."
] | [
"func",
"(",
"a",
"*",
"App",
")",
"Routes",
"(",
")",
"RouteList",
"{",
"if",
"a",
".",
"<mask>",
"!=",
"nil",
"{",
"return",
"a",
".",
"root",
".",
"routes",
"\n",
"}",
"\n",
"return",
"a",
".",
"routes",
"\n",
"}"
] |
11,586 | all-11587 | [
"isPathSafe",
"checks",
"if",
"the",
"passed",
"in",
"path",
"conforms",
"to",
"a",
"whitelist",
"."
] | [
"func",
"isPathSafe",
"(",
"s",
"string",
")",
"error",
"{",
"u",
",",
"err",
":=",
"<mask>",
".",
"Parse",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"e",
",",
"err",
":=",
"url",
".",
"PathUnescape",
"(",
"u",
".",
"Path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"strings",
".",
"Contains",
"(",
"e",
",",
"\"",
"\"",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"errorMessage",
")",
"\n",
"}",
"\n\n",
"if",
"!",
"whitelistPattern",
".",
"MatchString",
"(",
"e",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"errorMessage",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
11,587 | all-11588 | [
"bind",
"a",
"named",
"sampler",
"to",
"a",
"texturing",
"target"
] | [
"func",
"BindSampler",
"(",
"unit",
"uint32",
",",
"sampler",
"uint32",
")",
"{",
"C",
".",
"glowBindSampler",
"(",
"gpBindSampler",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"sampler",
")",
")",
"\n",
"}"
] |
11,588 | all-11589 | [
"Get",
"retrieves",
"a",
"single",
"IncomingPhoneNumber",
"."
] | [
"func",
"(",
"ipn",
"*",
"IncomingNumberService",
")",
"Get",
"(",
"ctx",
"<mask>",
".",
"Context",
",",
"sid",
"string",
")",
"(",
"*",
"IncomingPhoneNumber",
",",
"error",
")",
"{",
"number",
":=",
"new",
"(",
"IncomingPhoneNumber",
")",
"\n",
"err",
":=",
"ipn",
".",
"client",
".",
"GetResource",
"(",
"ctx",
",",
"numbersPathPart",
",",
"sid",
",",
"number",
")",
"\n",
"return",
"number",
",",
"err",
"\n",
"}"
] |
11,589 | all-11590 | [
"NewHandler",
"creates",
"a",
"new",
"HTTP",
"handler",
"listening",
"on",
"the",
"given",
"transport",
"which",
"will",
"proxy",
"requests",
"to",
"an",
"etcd",
"cluster",
".",
"The",
"handler",
"will",
"periodically",
"update",
"its",
"view",
"of",
"the",
"cluster",
"."
] | [
"func",
"NewHandler",
"(",
"t",
"*",
"http",
".",
"Transport",
",",
"urlsFunc",
"GetProxyURLs",
",",
"failureWait",
"time",
".",
"Duration",
",",
"refreshInterval",
"<mask>",
".",
"Duration",
")",
"http",
".",
"Handler",
"{",
"if",
"t",
".",
"TLSClientConfig",
"!=",
"nil",
"{",
"// Enable http2, see Issue 5033.",
"err",
":=",
"http2",
".",
"ConfigureTransport",
"(",
"t",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"plog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"p",
":=",
"&",
"reverseProxy",
"{",
"director",
":",
"newDirector",
"(",
"urlsFunc",
",",
"failureWait",
",",
"refreshInterval",
")",
",",
"transport",
":",
"t",
",",
"}",
"\n\n",
"mux",
":=",
"http",
".",
"NewServeMux",
"(",
")",
"\n",
"mux",
".",
"Handle",
"(",
"\"",
"\"",
",",
"p",
")",
"\n",
"mux",
".",
"HandleFunc",
"(",
"\"",
"\"",
",",
"p",
".",
"configHandler",
")",
"\n\n",
"return",
"mux",
"\n",
"}"
] |
11,590 | all-11591 | [
"GetPullRequests",
"get",
"all",
"open",
"pull",
"requests",
"for",
"a",
"repo",
".",
"See",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"pulls",
"/",
"#list",
"-",
"pull",
"-",
"requests"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetPullRequests",
"(",
"org",
",",
"repo",
"string",
")",
"(",
"[",
"]",
"PullRequest",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
")",
"\n",
"var",
"prs",
"[",
"]",
"PullRequest",
"\n",
"if",
"c",
".",
"fake",
"{",
"return",
"prs",
",",
"nil",
"\n",
"}",
"\n",
"path",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
")",
"\n",
"err",
":=",
"c",
".",
"readPaginatedResults",
"(",
"<mask>",
",",
"// allow the description and draft fields",
"// https://developer.github.com/changes/2018-02-22-label-description-search-preview/",
"// https://developer.github.com/changes/2019-02-14-draft-pull-requests/",
"\"",
"\"",
",",
"func",
"(",
")",
"interface",
"{",
"}",
"{",
"return",
"&",
"[",
"]",
"PullRequest",
"{",
"}",
"\n",
"}",
",",
"func",
"(",
"obj",
"interface",
"{",
"}",
")",
"{",
"prs",
"=",
"append",
"(",
"prs",
",",
"*",
"(",
"obj",
".",
"(",
"*",
"[",
"]",
"PullRequest",
")",
")",
"...",
")",
"\n",
"}",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"prs",
",",
"err",
"\n",
"}"
] |
11,591 | all-11592 | [
"Inverse",
"of",
"the",
"Error",
"Function",
"function",
"referenced",
"from",
"Apache",
"commons",
"-",
"math",
"Erf"
] | [
"func",
"ErfInv",
"(",
"x",
"float64",
")",
"float64",
"{",
"// beware that the logarithm argument must be",
"// commputed as (1.0 - x) * (1.0 + x),",
"// it must NOT be simplified as 1.0 - x * x as this",
"// would induce rounding errors near the boundaries +/-1\t",
"w",
":=",
"-",
"math",
".",
"<mask>",
"(",
"(",
"1.0",
"-",
"x",
")",
"*",
"(",
"1.0",
"+",
"x",
")",
")",
"\n",
"var",
"p",
"float64",
"\n",
"if",
"w",
"<",
"6.25",
"{",
"w",
"-=",
"3.125",
"\n",
"p",
"=",
"-",
"3.6444120640178196996e-21",
"\n",
"p",
"=",
"-",
"1.685059138182016589e-19",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"1.2858480715256400167e-18",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"1.115787767802518096e-17",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"1.333171662854620906e-16",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"2.0972767875968561637e-17",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"6.6376381343583238325e-15",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"4.0545662729752068639e-14",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"8.1519341976054721522e-14",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"2.6335093153082322977e-12",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"1.2975133253453532498e-11",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"5.4154120542946279317e-11",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"1.051212273321532285e-09",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"4.1126339803469836976e-09",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"2.9070369957882005086e-08",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"4.2347877827932403518e-07",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"1.3654692000834678645e-06",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"1.3882523362786468719e-05",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"0.0001867342080340571352",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"0.00074070253416626697512",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"0.0060336708714301490533",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"0.24015818242558961693",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"1.6536545626831027356",
"+",
"p",
"*",
"w",
"\n",
"}",
"else",
"if",
"w",
"<",
"16.0",
"{",
"w",
"=",
"math",
".",
"Sqrt",
"(",
"w",
")",
"-",
"3.25",
"\n",
"p",
"=",
"2.2137376921775787049e-09",
"\n",
"p",
"=",
"9.0756561938885390979e-08",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"2.7517406297064545428e-07",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"1.8239629214389227755e-08",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"1.5027403968909827627e-06",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"4.013867526981545969e-06",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"2.9234449089955446044e-06",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"1.2475304481671778723e-05",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"4.7318229009055733981e-05",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"6.8284851459573175448e-05",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"2.4031110387097893999e-05",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"0.0003550375203628474796",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"0.00095328937973738049703",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"0.0016882755560235047313",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"0.0024914420961078508066",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"0.0037512085075692412107",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"0.005370914553590063617",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"1.0052589676941592334",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"3.0838856104922207635",
"+",
"p",
"*",
"w",
"\n",
"}",
"else",
"if",
"!",
"math",
".",
"IsInf",
"(",
"w",
",",
"0",
")",
"{",
"w",
"=",
"math",
".",
"Sqrt",
"(",
"w",
")",
"-",
"5.0",
"\n",
"p",
"=",
"-",
"2.7109920616438573243e-11",
"\n",
"p",
"=",
"-",
"2.5556418169965252055e-10",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"1.5076572693500548083e-09",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"3.7894654401267369937e-09",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"7.6157012080783393804e-09",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"1.4960026627149240478e-08",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"2.9147953450901080826e-08",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"6.7711997758452339498e-08",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"2.2900482228026654717e-07",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"9.9298272942317002539e-07",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"4.5260625972231537039e-06",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"1.9681778105531670567e-05",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"7.5995277030017761139e-05",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"0.00021503011930044477347",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"-",
"0.00013871931833623122026",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"1.0103004648645343977",
"+",
"p",
"*",
"w",
"\n",
"p",
"=",
"4.8499064014085844221",
"+",
"p",
"*",
"w",
"\n",
"}",
"else",
"{",
"p",
"=",
"math",
".",
"Inf",
"(",
"0",
")",
"\n",
"}",
"\n",
"return",
"p",
"*",
"x",
"\n",
"}"
] |
11,592 | all-11593 | [
"Gets",
"job",
"history",
"from",
"the",
"GCS",
"bucket",
"specified",
"in",
"config",
"."
] | [
"func",
"getJobHistory",
"(",
"url",
"*",
"url",
".",
"URL",
",",
"config",
"*",
"config",
".",
"Config",
",",
"gcsClient",
"*",
"storage",
".",
"Client",
")",
"(",
"jobHistoryTemplate",
",",
"error",
")",
"{",
"start",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"tmpl",
":=",
"jobHistoryTemplate",
"{",
"}",
"\n\n",
"bucketName",
",",
"root",
",",
"top",
",",
"err",
":=",
"parseJobHistURL",
"(",
"url",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"tmpl",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"url",
".",
"String",
"(",
")",
",",
"err",
")",
"\n",
"}",
"\n",
"tmpl",
".",
"Name",
"=",
"root",
"\n",
"bucket",
":=",
"gcsBucket",
"{",
"bucketName",
",",
"gcsClient",
".",
"Bucket",
"(",
"bucketName",
")",
"}",
"\n\n",
"latest",
",",
"err",
":=",
"readLatestBuild",
"(",
"bucket",
",",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"tmpl",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"top",
"==",
"emptyID",
"||",
"top",
">",
"latest",
"{",
"top",
"=",
"latest",
"\n",
"}",
"\n",
"if",
"top",
"!=",
"latest",
"{",
"tmpl",
".",
"LatestLink",
"=",
"linkID",
"(",
"url",
",",
"emptyID",
")",
"\n",
"}",
"\n\n",
"buildIDs",
",",
"err",
":=",
"bucket",
".",
"listBuildIDs",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"tmpl",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"sort",
".",
"Sort",
"(",
"sort",
".",
"Reverse",
"(",
"int64slice",
"(",
"buildIDs",
")",
")",
")",
"\n\n",
"// determine which results to display on this page",
"shownIDs",
",",
"firstIndex",
",",
"lastIndex",
":=",
"cropResults",
"(",
"buildIDs",
",",
"top",
")",
"\n\n",
"// get links to the neighboring pages",
"if",
"firstIndex",
">",
"0",
"{",
"nextIndex",
":=",
"firstIndex",
"-",
"resultsPerPage",
"\n",
"// here emptyID indicates the most recent build, which will not necessarily be buildIDs[0]",
"next",
":=",
"emptyID",
"\n",
"if",
"nextIndex",
">=",
"0",
"{",
"next",
"=",
"buildIDs",
"[",
"nextIndex",
"]",
"\n",
"}",
"\n",
"tmpl",
".",
"NewerLink",
"=",
"linkID",
"(",
"url",
",",
"next",
")",
"\n",
"}",
"\n",
"if",
"lastIndex",
"<",
"len",
"(",
"buildIDs",
")",
"-",
"1",
"{",
"tmpl",
".",
"OlderLink",
"=",
"linkID",
"(",
"url",
",",
"buildIDs",
"[",
"lastIndex",
"+",
"1",
"]",
")",
"\n",
"}",
"\n\n",
"tmpl",
".",
"Builds",
"=",
"make",
"(",
"[",
"]",
"buildData",
",",
"len",
"(",
"shownIDs",
")",
")",
"\n",
"tmpl",
".",
"ResultsShown",
"=",
"len",
"(",
"shownIDs",
")",
"\n",
"tmpl",
".",
"ResultsTotal",
"=",
"len",
"(",
"buildIDs",
")",
"\n\n",
"// concurrently fetch data for all of the builds to be shown",
"bch",
":=",
"make",
"(",
"chan",
"buildData",
")",
"\n",
"for",
"i",
",",
"buildID",
":=",
"range",
"shownIDs",
"{",
"go",
"func",
"(",
"i",
"int",
",",
"buildID",
"int64",
")",
"{",
"id",
":=",
"strconv",
".",
"FormatInt",
"(",
"buildID",
",",
"10",
")",
"\n",
"dir",
",",
"err",
":=",
"bucket",
".",
"getPath",
"(",
"root",
",",
"id",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"bch",
"<-",
"buildData",
"{",
"}",
"\n",
"return",
"\n",
"}",
"\n",
"b",
",",
"err",
":=",
"getBuildData",
"(",
"bucket",
",",
"dir",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"Warningf",
"(",
"\"",
"\"",
",",
"buildID",
",",
"err",
")",
"\n",
"}",
"\n",
"b",
".",
"index",
"=",
"i",
"\n",
"b",
".",
"ID",
"=",
"id",
"\n",
"b",
".",
"SpyglassLink",
",",
"err",
"=",
"bucket",
".",
"spyglassLink",
"(",
"root",
",",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"bch",
"<-",
"b",
"\n",
"}",
"(",
"i",
",",
"buildID",
")",
"\n",
"}",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"shownIDs",
")",
";",
"i",
"++",
"{",
"b",
":=",
"<-",
"bch",
"\n",
"tmpl",
".",
"Builds",
"[",
"b",
".",
"index",
"]",
"=",
"b",
"\n",
"}",
"\n\n",
"elapsed",
":=",
"time",
".",
"Now",
"(",
")",
".",
"Sub",
"(",
"start",
")",
"\n",
"logrus",
".",
"Infof",
"(",
"\"",
"\"",
",",
"url",
".",
"Path",
",",
"elapsed",
")",
"\n",
"return",
"tmpl",
",",
"nil",
"\n",
"}"
] |
11,593 | all-11594 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object"
] | [
"func",
"Uniform1f",
"(",
"<mask>",
"int32",
",",
"v0",
"float32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpUniform1f",
",",
"2",
",",
"uintptr",
"(",
"location",
")",
",",
"uintptr",
"(",
"math",
".",
"Float32bits",
"(",
"v0",
")",
")",
",",
"0",
")",
"\n",
"}"
] |
11,594 | all-11595 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventMetadata",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice4",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
11,595 | all-11596 | [
"String",
"returns",
"the",
"human",
"-",
"friendly",
"version",
"of",
"this",
"dependency",
"."
] | [
"func",
"(",
"d",
"*",
"HealthServiceQuery",
")",
"String",
"(",
")",
"string",
"{",
"<mask>",
":=",
"d",
".",
"name",
"\n",
"if",
"d",
".",
"tag",
"!=",
"\"",
"\"",
"{",
"name",
"=",
"d",
".",
"tag",
"+",
"\"",
"\"",
"+",
"name",
"\n",
"}",
"\n",
"if",
"d",
".",
"dc",
"!=",
"\"",
"\"",
"{",
"name",
"=",
"name",
"+",
"\"",
"\"",
"+",
"d",
".",
"dc",
"\n",
"}",
"\n",
"if",
"d",
".",
"near",
"!=",
"\"",
"\"",
"{",
"name",
"=",
"name",
"+",
"\"",
"\"",
"+",
"d",
".",
"near",
"\n",
"}",
"\n",
"if",
"len",
"(",
"d",
".",
"filters",
")",
">",
"0",
"{",
"name",
"=",
"name",
"+",
"\"",
"\"",
"+",
"strings",
".",
"Join",
"(",
"d",
".",
"filters",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}"
] |
11,596 | all-11597 | [
"WriteGzip",
"writes",
"response",
"with",
"gzipped",
"body",
"to",
"w",
".",
"The",
"method",
"gzips",
"response",
"body",
"and",
"sets",
"Content",
"-",
"Encoding",
":",
"gzip",
"header",
"before",
"writing",
"response",
"to",
"w",
".",
"WriteGzip",
"doesn",
"t",
"flush",
"response",
"to",
"w",
"for",
"performance",
"reasons",
"."
] | [
"func",
"(",
"resp",
"*",
"<mask>",
")",
"WriteGzip",
"(",
"w",
"*",
"bufio",
".",
"Writer",
")",
"error",
"{",
"return",
"resp",
".",
"WriteGzipLevel",
"(",
"w",
",",
"CompressDefaultCompression",
")",
"\n",
"}"
] |
11,597 | all-11598 | [
"RadioMenuItemNewFromWidget",
"is",
"a",
"wrapper",
"around",
"gtk_radio_menu_item_new_from_widget",
"()",
"."
] | [
"func",
"RadioMenuItemNewFromWidget",
"(",
"<mask>",
"*",
"RadioMenuItem",
")",
"(",
"*",
"RadioMenuItem",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_radio_menu_item_new_from_widget",
"(",
"group",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapRadioMenuItem",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
11,598 | all-11599 | [
"If",
"err",
"is",
"an",
"appengine",
".",
"MultiError",
"return",
"its",
"first",
"element",
".",
"Otherwise",
"return",
"err",
"."
] | [
"func",
"singleError",
"(",
"err",
"error",
")",
"error",
"{",
"if",
"me",
",",
"ok",
":=",
"err",
".",
"(",
"appengine",
".",
"MultiError",
")",
";",
"ok",
"{",
"return",
"<mask>",
"[",
"0",
"]",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
11,599 | all-11600 | [
"Unset",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_unset",
"()",
"."
] | [
"func",
"(",
"ps",
"*",
"PrintSettings",
")",
"Unset",
"(",
"key",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"key",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_print_settings_unset",
"(",
"ps",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.