id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
19,000 | all-19001 | [
"GetAttribute",
"is",
"a",
"convenience",
"function",
"for",
"getting",
"the",
"specified",
"attribute",
"from",
"an",
"element",
".",
"false",
"is",
"returned",
"if",
"the",
"attribute",
"is",
"not",
"found",
"."
]
| [
"func",
"GetAttribute",
"(",
"n",
"Elem",
",",
"local",
",",
"space",
"string",
")",
"(",
"xml",
".",
"Attr",
",",
"bool",
")",
"{",
"attrs",
":=",
"n",
".",
"GetAttrs",
"(",
")",
"\n",
"for",
"_",
",",
"i",
":=",
"<mask>",
"attrs",
"{",
"attr",
":=",
"i",
".",
"GetToken",
"(",
")",
".",
"(",
"xml",
".",
"Attr",
")",
"\n",
"if",
"local",
"==",
"attr",
".",
"Name",
".",
"Local",
"&&",
"space",
"==",
"attr",
".",
"Name",
".",
"Space",
"{",
"return",
"attr",
",",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"xml",
".",
"Attr",
"{",
"}",
",",
"false",
"\n",
"}"
]
|
19,001 | all-19002 | [
"/",
"*",
"start",
"capturing",
"frames",
"from",
"video",
"file"
]
| [
"func",
"NewFileCapture",
"(",
"filename",
"string",
")",
"*",
"Capture",
"{",
"filename_c",
":=",
"C",
".",
"CString",
"(",
"<mask>",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"filename_c",
")",
")",
"\n",
"cap",
":=",
"C",
".",
"cvCreateFileCapture",
"(",
"filename_c",
")",
"\n",
"return",
"(",
"*",
"Capture",
")",
"(",
"cap",
")",
"\n",
"}"
]
|
19,002 | all-19003 | [
"OneOfMatches",
"checks",
"whether",
"one",
"element",
"of",
"a",
"slice",
"matches",
"a",
"regular",
"-",
"expression",
"."
]
| [
"func",
"OneOfMatches",
"(",
"tb",
"testing",
".",
"TB",
",",
"expectedMatch",
"string",
",",
"actuals",
"[",
"]",
"string",
",",
"msgAndArgs",
"...",
"interface",
"{",
"}",
")",
"{",
"tb",
".",
"Helper",
"(",
")",
"\n",
"r",
",",
"err",
":=",
"regexp",
".",
"Compile",
"(",
"expectedMatch",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fatal",
"(",
"tb",
",",
"msgAndArgs",
",",
"\"",
"\"",
",",
"expectedMatch",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"actuals",
"{",
"if",
"r",
".",
"MatchString",
"(",
"actual",
")",
"{",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"fatal",
"(",
"tb",
",",
"msgAndArgs",
",",
"\"",
"\"",
",",
"actuals",
",",
"expectedMatch",
")",
"\n\n",
"}"
]
|
19,003 | all-19004 | [
"Infof",
"logs",
"an",
"INFO",
"message",
"to",
"the",
"logger",
"specified",
"in",
"opts",
"."
]
| [
"func",
"(",
"opt",
"*",
"Options",
")",
"Infof",
"(",
"<mask>",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"opt",
".",
"Logger",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"opt",
".",
"Logger",
".",
"Infof",
"(",
"format",
",",
"v",
"...",
")",
"\n",
"}"
]
|
19,004 | all-19005 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"CanEmulateParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation21",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
19,005 | all-19006 | [
"Enumerate",
"peeks",
"at",
"each",
"element",
"in",
"the",
"stack",
"without",
"mutating",
"it",
"."
]
| [
"func",
"(",
"stack",
"*",
"Stack",
")",
"Enumerate",
"(",
"cancel",
"<-",
"chan",
"struct",
"{",
"}",
")",
"Enumerator",
"{",
"stack",
".",
"<mask>",
".",
"RLock",
"(",
")",
"\n",
"defer",
"stack",
".",
"key",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"stack",
".",
"underlyer",
".",
"Enumerate",
"(",
"cancel",
")",
"\n",
"}"
]
|
19,006 | all-19007 | [
"ReadAt",
"implements",
"reading",
"a",
"range",
"of",
"bytes",
"from",
"the",
"pod",
"logs",
"endpoint"
]
| [
"func",
"(",
"a",
"*",
"PodLogArtifact",
")",
"ReadAt",
"(",
"p",
"[",
"]",
"byte",
",",
"off",
"int64",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"logs",
",",
"err",
":=",
"a",
".",
"jobAgent",
".",
"GetJobLog",
"(",
"a",
".",
"name",
",",
"a",
".",
"buildID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"r",
":=",
"bytes",
".",
"NewReader",
"(",
"logs",
")",
"\n",
"readBytes",
",",
"err",
":=",
"r",
".",
"ReadAt",
"(",
"p",
",",
"off",
")",
"\n",
"if",
"err",
"==",
"io",
".",
"EOF",
"{",
"return",
"readBytes",
",",
"<mask>",
".",
"EOF",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"readBytes",
",",
"nil",
"\n",
"}"
]
|
19,007 | all-19008 | [
"fills",
"all",
"or",
"part",
"of",
"a",
"texture",
"image",
"with",
"a",
"constant",
"value"
]
| [
"func",
"ClearTexSubImage",
"(",
"texture",
"uint32",
",",
"level",
"int32",
",",
"xoffset",
"int32",
",",
"yoffset",
"int32",
",",
"zoffset",
"int32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"depth",
"int32",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"data",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall12",
"(",
"gpClearTexSubImage",
",",
"11",
",",
"uintptr",
"(",
"texture",
")",
",",
"uintptr",
"(",
"level",
")",
",",
"uintptr",
"(",
"xoffset",
")",
",",
"uintptr",
"(",
"yoffset",
")",
",",
"uintptr",
"(",
"zoffset",
")",
",",
"uintptr",
"(",
"width",
")",
",",
"uintptr",
"(",
"height",
")",
",",
"uintptr",
"(",
"depth",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"xtype",
")",
",",
"uintptr",
"(",
"data",
")",
",",
"0",
")",
"\n",
"}"
]
|
19,008 | all-19009 | [
"Add",
"will",
"add",
"the",
"specified",
"syscall",
"action",
"and",
"arguments",
"to",
"the",
"seccomp",
"Context",
"."
]
| [
"func",
"(",
"c",
"*",
"Context",
")",
"Add",
"(",
"s",
"*",
"Syscall",
")",
"{",
"c",
".",
"syscalls",
"[",
"s",
".",
"<mask>",
"]",
"=",
"s",
"\n",
"}"
]
|
19,009 | all-19010 | [
"allDesiredSegments",
"iterates",
"through",
"the",
"cf",
"-",
"mgmt",
"configuration",
"for",
"all",
"orgs",
"and",
"spaces",
"and",
"builds",
"the",
"complete",
"set",
"of",
"isolation",
"segments",
"that",
"should",
"exist"
]
| [
"func",
"(",
"u",
"*",
"Updater",
")",
"allDesiredSegments",
"(",
")",
"(",
"[",
"]",
"cfclient",
".",
"IsolationSegment",
",",
"error",
")",
"{",
"orgs",
",",
"err",
":=",
"u",
".",
"Cfg",
".",
"GetOrgConfigs",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"spaces",
",",
"err",
":=",
"u",
".",
"Cfg",
".",
"GetSpaceConfigs",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"segments",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
")",
"\n",
"for",
"_",
",",
"org",
":=",
"range",
"orgs",
"{",
"if",
"org",
".",
"DefaultIsoSegment",
"!=",
"\"",
"\"",
"{",
"segments",
"[",
"org",
".",
"DefaultIsoSegment",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"space",
":=",
"range",
"spaces",
"{",
"if",
"space",
".",
"IsoSegment",
"!=",
"\"",
"\"",
"{",
"segments",
"[",
"<mask>",
".",
"IsoSegment",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"result",
":=",
"make",
"(",
"[",
"]",
"cfclient",
".",
"IsolationSegment",
",",
"0",
",",
"len",
"(",
"segments",
")",
")",
"\n",
"for",
"k",
":=",
"range",
"segments",
"{",
"result",
"=",
"append",
"(",
"result",
",",
"cfclient",
".",
"IsolationSegment",
"{",
"Name",
":",
"k",
"}",
")",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n",
"}"
]
|
19,010 | all-19011 | [
"ProfileConfigAdd",
"adds",
"a",
"config",
"to",
"the",
"profile",
"with",
"the",
"given",
"ID",
"."
]
| [
"func",
"ProfileConfigAdd",
"(",
"<mask>",
"*",
"sql",
".",
"Tx",
",",
"id",
"int64",
",",
"config",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"str",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
")",
"\n",
"stmt",
",",
"err",
":=",
"tx",
".",
"Prepare",
"(",
"str",
")",
"\n",
"defer",
"stmt",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"for",
"k",
",",
"v",
":=",
"range",
"config",
"{",
"if",
"v",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n\n",
"_",
",",
"err",
"=",
"stmt",
".",
"Exec",
"(",
"id",
",",
"k",
",",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
19,011 | all-19012 | [
"EquateNaNs",
"returns",
"a",
"Comparer",
"option",
"that",
"determines",
"float32",
"and",
"float64",
"NaN",
"values",
"to",
"be",
"equal",
".",
"EquateNaNs",
"can",
"be",
"used",
"in",
"conjunction",
"with",
"EquateApprox",
"."
]
| [
"func",
"EquateNaNs",
"(",
")",
"cmp",
".",
"Option",
"{",
"return",
"cmp",
".",
"<mask>",
"{",
"cmp",
".",
"FilterValues",
"(",
"areNaNsF64s",
",",
"cmp",
".",
"Comparer",
"(",
"equateAlways",
")",
")",
",",
"cmp",
".",
"FilterValues",
"(",
"areNaNsF32s",
",",
"cmp",
".",
"Comparer",
"(",
"equateAlways",
")",
")",
",",
"}",
"\n",
"}"
]
|
19,012 | all-19013 | [
"HasID",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"l",
"*",
"LogSet",
")",
"HasID",
"(",
")",
"bool",
"{",
"if",
"l",
"!=",
"nil",
"&&",
"l",
".",
"ID",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
19,013 | all-19014 | [
"NextRecord",
"iterates",
"on",
"lines",
"of",
"a",
"Reader",
".",
"Returns",
"io",
".",
"EOF",
"on",
"end",
"of",
"iteration",
"."
]
| [
"func",
"(",
"c",
"*",
"Iterator",
")",
"NextRecord",
"(",
")",
"(",
"pilosa",
".",
"Record",
",",
"error",
")",
"{",
"if",
"ok",
":=",
"c",
".",
"scanner",
".",
"Scan",
"(",
")",
";",
"ok",
"{",
"c",
".",
"line",
"++",
"\n",
"text",
":=",
"strings",
".",
"TrimSpace",
"(",
"c",
".",
"scanner",
".",
"Text",
"(",
")",
")",
"\n",
"if",
"text",
"!=",
"\"",
"\"",
"{",
"rc",
",",
"err",
":=",
"c",
".",
"unmarshaller",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
",",
"c",
".",
"line",
")",
"\n",
"}",
"\n",
"return",
"rc",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"err",
":=",
"c",
".",
"scanner",
".",
"Err",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"io",
".",
"EOF",
"\n",
"}"
]
|
19,014 | all-19015 | [
"storeV3EndpointIDToTaskUnsafe",
"adds",
"v3EndpointID",
"-",
">",
"taskARN",
"mapping",
"to",
"state"
]
| [
"func",
"(",
"state",
"*",
"DockerTaskEngineState",
")",
"storeV3EndpointIDToTaskUnsafe",
"(",
"v3EndpointID",
",",
"taskARN",
"string",
")",
"{",
"<mask>",
".",
"v3EndpointIDToTask",
"[",
"v3EndpointID",
"]",
"=",
"taskARN",
"\n",
"}"
]
|
19,015 | all-19016 | [
"char",
"*",
"pango_font_description_to_string",
"(",
"const",
"PangoFontDescription",
"*",
"desc",
")",
";"
]
| [
"func",
"(",
"v",
"*",
"FontDescription",
")",
"ToString",
"(",
")",
"string",
"{",
"c",
":=",
"C",
".",
"pango_font_description_to_string",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"c",
")",
")",
"\n",
"}"
]
|
19,016 | all-19017 | [
"GetShowPresentOk",
"returns",
"a",
"tuple",
"with",
"the",
"ShowPresent",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"c",
"*",
"ChangeRequest",
")",
"GetShowPresentOk",
"(",
")",
"(",
"bool",
",",
"bool",
")",
"{",
"if",
"c",
"==",
"nil",
"||",
"c",
".",
"ShowPresent",
"==",
"nil",
"{",
"return",
"false",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"c",
".",
"ShowPresent",
",",
"<mask>",
"\n",
"}"
]
|
19,017 | all-19018 | [
"SendMoney",
"to",
"either",
"a",
"bitcoin",
"or",
"email",
"address"
]
| [
"func",
"(",
"c",
"<mask>",
")",
"SendMoney",
"(",
"params",
"*",
"TransactionParams",
")",
"(",
"*",
"transactionConfirmation",
",",
"error",
")",
"{",
"return",
"c",
".",
"transactionRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"params",
")",
"\n",
"}"
]
|
19,018 | all-19019 | [
"FetchAlert",
"retrieves",
"alert",
"with",
"passed",
"cid",
"."
]
| [
"func",
"(",
"a",
"*",
"API",
")",
"FetchAlert",
"(",
"cid",
"CIDType",
")",
"(",
"*",
"Alert",
",",
"error",
")",
"{",
"if",
"cid",
"==",
"nil",
"||",
"*",
"cid",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"alertCID",
":=",
"string",
"(",
"*",
"cid",
")",
"\n\n",
"matched",
",",
"err",
":=",
"regexp",
".",
"MatchString",
"(",
"config",
".",
"AlertCIDRegex",
",",
"alertCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"matched",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"alertCID",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"Get",
"(",
"alertCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"Debug",
"{",
"a",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"string",
"(",
"result",
")",
")",
"\n",
"}",
"\n\n",
"alert",
":=",
"&",
"Alert",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"alert",
",",
"nil",
"\n",
"}"
]
|
19,019 | all-19020 | [
"HashPassword",
"hash",
"un",
"mot",
"de",
"passe"
]
| [
"func",
"HashPassword",
"(",
"password",
"[",
"]",
"byte",
",",
"salt",
"[",
"]",
"byte",
")",
"(",
"<mask>",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"hash",
",",
"err",
"=",
"scrypt",
".",
"Key",
"(",
"password",
",",
"salt",
",",
"N",
",",
"R",
",",
"P",
",",
"KEYLENGTH",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"\n",
"}"
]
|
19,020 | all-19021 | [
"NewRule",
"creates",
"a",
"new",
"empty",
"rule",
"with",
"the",
"given",
"kind",
"and",
"name",
"."
]
| [
"func",
"NewRule",
"(",
"kind",
",",
"<mask>",
"string",
")",
"*",
"Rule",
"{",
"nameAttr",
":=",
"&",
"bzl",
".",
"AssignExpr",
"{",
"LHS",
":",
"&",
"bzl",
".",
"Ident",
"{",
"Name",
":",
"\"",
"\"",
"}",
",",
"RHS",
":",
"&",
"bzl",
".",
"StringExpr",
"{",
"Value",
":",
"name",
"}",
",",
"Op",
":",
"\"",
"\"",
",",
"}",
"\n",
"r",
":=",
"&",
"Rule",
"{",
"stmt",
":",
"stmt",
"{",
"expr",
":",
"&",
"bzl",
".",
"CallExpr",
"{",
"X",
":",
"&",
"bzl",
".",
"Ident",
"{",
"Name",
":",
"kind",
"}",
",",
"List",
":",
"[",
"]",
"bzl",
".",
"Expr",
"{",
"nameAttr",
"}",
",",
"}",
",",
"}",
",",
"kind",
":",
"kind",
",",
"attrs",
":",
"map",
"[",
"string",
"]",
"*",
"bzl",
".",
"AssignExpr",
"{",
"\"",
"\"",
":",
"nameAttr",
"}",
",",
"private",
":",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
",",
"}",
"\n",
"return",
"r",
"\n",
"}"
]
|
19,021 | all-19022 | [
"IsExpired",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockProvider",
")",
"IsExpired",
"(",
")",
"bool",
"{",
"<mask>",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"bool",
")",
"\n",
"return",
"ret0",
"\n",
"}"
]
|
19,022 | all-19023 | [
"Search",
"for",
"rants",
"matching",
"the",
"search",
"term"
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"Search",
"(",
"term",
"string",
")",
"(",
"[",
"]",
"RantModel",
",",
"error",
")",
"{",
"url",
":=",
"fmt",
".",
"Sprintf",
"(",
"SEARCH_PATH",
",",
"API",
",",
"term",
",",
"APP_VERSION",
")",
"\n",
"res",
",",
"err",
":=",
"<mask>",
".",
"Get",
"(",
"url",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"var",
"data",
"SearchResponse",
"\n",
"json",
".",
"NewDecoder",
"(",
"res",
".",
"Body",
")",
".",
"Decode",
"(",
"&",
"data",
")",
"\n",
"if",
"!",
"data",
".",
"Success",
"&&",
"data",
".",
"Error",
"!=",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"data",
".",
"Error",
")",
"\n",
"}",
"\n",
"return",
"data",
".",
"Rants",
",",
"nil",
"\n",
"}"
]
|
19,023 | all-19024 | [
"CreateLoadbalancer",
"creates",
"a",
"loadbalancer",
"in",
"the",
"datacenter",
"from",
"a",
"jason",
"[]",
"byte",
"and",
"returns",
"a",
"Instance",
"struct"
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateLoadbalancer",
"(",
"dcid",
"string",
",",
"request",
"Loadbalancer",
")",
"(",
"*",
"Loadbalancer",
",",
"error",
")",
"{",
"url",
":=",
"lbalColPath",
"(",
"dcid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"Loadbalancer",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Post",
"(",
"url",
",",
"<mask>",
",",
"ret",
",",
"http",
".",
"StatusAccepted",
")",
"\n\n",
"return",
"ret",
",",
"err",
"\n",
"}"
]
|
19,024 | all-19025 | [
"SetMulti",
"is",
"a",
"batch",
"version",
"of",
"Set",
".",
"appengine",
".",
"MultiError",
"may",
"be",
"returned",
"."
]
| [
"func",
"SetMulti",
"(",
"c",
"context",
".",
"Context",
",",
"<mask>",
"[",
"]",
"*",
"Item",
")",
"error",
"{",
"return",
"set",
"(",
"c",
",",
"item",
",",
"nil",
",",
"pb",
".",
"MemcacheSetRequest_SET",
")",
"\n",
"}"
]
|
19,025 | all-19026 | [
"cookiefileVolumes",
"converts",
"a",
"secret",
"holding",
"cookies",
"into",
"the",
"corresponding",
"volume",
"and",
"mount",
".",
"Secret",
"can",
"be",
"of",
"the",
"form",
"secret",
"-",
"name",
"/",
"base",
"-",
"name",
"or",
"just",
"secret",
"-",
"name",
".",
"Here",
"secret",
"-",
"name",
"refers",
"to",
"the",
"kubernetes",
"secret",
"volume",
"to",
"mount",
"and",
"base",
"-",
"name",
"refers",
"to",
"the",
"key",
"in",
"the",
"secret",
"where",
"the",
"cookies",
"are",
"stored",
".",
"The",
"secret",
"-",
"name",
"pattern",
"is",
"equivalent",
"to",
"secret",
"-",
"name",
"/",
"secret",
"-",
"name",
".",
"This",
"is",
"used",
"by",
"CloneRefs",
"to",
"attach",
"the",
"mount",
"to",
"the",
"clonerefs",
"container",
".",
"The",
"returned",
"string",
"value",
"is",
"the",
"path",
"to",
"the",
"cookiefile",
"for",
"use",
"with",
"--",
"cookiefile",
"."
]
| [
"func",
"cookiefileVolume",
"(",
"secret",
"string",
")",
"(",
"coreapi",
".",
"Volume",
",",
"coreapi",
".",
"VolumeMount",
",",
"string",
")",
"{",
"// Separate secret-name/key-in-secret",
"parts",
":=",
"strings",
".",
"SplitN",
"(",
"secret",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"cookieSecret",
":=",
"parts",
"[",
"0",
"]",
"\n",
"var",
"base",
"string",
"\n",
"if",
"len",
"(",
"parts",
")",
"==",
"1",
"{",
"base",
"=",
"parts",
"[",
"0",
"]",
"// Assume key-in-secret == secret-name",
"\n",
"}",
"else",
"{",
"base",
"=",
"parts",
"[",
"1",
"]",
"\n",
"}",
"\n",
"var",
"cookiefileMode",
"int32",
"=",
"0400",
"// u+r",
"\n",
"vol",
":=",
"coreapi",
".",
"Volume",
"{",
"Name",
":",
"\"",
"\"",
",",
"VolumeSource",
":",
"coreapi",
".",
"VolumeSource",
"{",
"Secret",
":",
"&",
"coreapi",
".",
"SecretVolumeSource",
"{",
"SecretName",
":",
"cookieSecret",
",",
"DefaultMode",
":",
"&",
"cookiefileMode",
",",
"}",
",",
"}",
",",
"}",
"\n",
"mount",
":=",
"coreapi",
".",
"VolumeMount",
"{",
"Name",
":",
"vol",
".",
"Name",
",",
"MountPath",
":",
"\"",
"\"",
",",
"// append base to flag",
"ReadOnly",
":",
"true",
",",
"}",
"\n",
"return",
"vol",
",",
"mount",
",",
"<mask>",
".",
"Join",
"(",
"mount",
".",
"MountPath",
",",
"base",
")",
"\n",
"}"
]
|
19,026 | all-19027 | [
"GetIconStock",
"is",
"a",
"wrapper",
"around",
"gtk_entry_get_icon_stock",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetIconStock",
"(",
"iconPos",
"EntryIconPosition",
")",
"(",
"string",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_entry_get_icon_stock",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkEntryIconPosition",
"(",
"iconPos",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"c",
")",
")",
",",
"nil",
"\n",
"}"
]
|
19,027 | all-19028 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
]
| [
"func",
"(",
"t",
"CertificateErrorAction",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"<mask>",
".",
"String",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
]
|
19,028 | all-19029 | [
"lexNumber",
"scans",
"a",
"number",
":",
"decimal",
"hex",
"oct",
"or",
"float",
"."
]
| [
"func",
"lexNumber",
"(",
"l",
"*",
"lexer",
")",
"stateFn",
"{",
"if",
"!",
"l",
".",
"scanNumber",
"(",
")",
"{",
"return",
"l",
".",
"errorf",
"(",
"\"",
"\"",
",",
"l",
".",
"input",
"[",
"l",
".",
"start",
":",
"l",
".",
"<mask>",
"]",
")",
"\n",
"}",
"\n",
"l",
".",
"emit",
"(",
"ItemNumber",
")",
"\n",
"return",
"lexStatements",
"\n",
"}"
]
|
19,029 | all-19030 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
]
| [
"func",
"(",
"t",
"BlockedReason",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"out",
".",
"<mask>",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
]
|
19,030 | all-19031 | [
"IntrospectState",
"returns",
"the",
"runtime",
"state",
"for",
"this",
"relayItems",
"."
]
| [
"func",
"(",
"ri",
"*",
"relayItems",
")",
"IntrospectState",
"(",
"opts",
"*",
"IntrospectionOptions",
",",
"name",
"string",
")",
"RelayItemSetState",
"{",
"ri",
".",
"RLock",
"(",
")",
"\n",
"defer",
"ri",
".",
"RUnlock",
"(",
")",
"\n\n",
"setState",
":=",
"RelayItemSetState",
"{",
"Name",
":",
"name",
",",
"Count",
":",
"ri",
".",
"Count",
"(",
")",
",",
"}",
"\n",
"if",
"opts",
".",
"IncludeExchanges",
"{",
"setState",
".",
"Items",
"=",
"make",
"(",
"<mask>",
"[",
"string",
"]",
"RelayItemState",
",",
"len",
"(",
"ri",
".",
"items",
")",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"ri",
".",
"items",
"{",
"if",
"!",
"opts",
".",
"IncludeTombstones",
"&&",
"v",
".",
"tomb",
"{",
"continue",
"\n",
"}",
"\n",
"state",
":=",
"RelayItemState",
"{",
"ID",
":",
"k",
",",
"RemapID",
":",
"v",
".",
"remapID",
",",
"DestinationConnectionID",
":",
"v",
".",
"destination",
".",
"conn",
".",
"connID",
",",
"Tomb",
":",
"v",
".",
"tomb",
",",
"}",
"\n",
"setState",
".",
"Items",
"[",
"strconv",
".",
"Itoa",
"(",
"int",
"(",
"k",
")",
")",
"]",
"=",
"state",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"setState",
"\n",
"}"
]
|
19,031 | all-19032 | [
"lookExtensions",
"finds",
"windows",
"executable",
"by",
"its",
"dir",
"and",
"path",
".",
"It",
"uses",
"LookPath",
"to",
"try",
"appropriate",
"extensions",
".",
"lookExtensions",
"does",
"not",
"search",
"PATH",
"instead",
"it",
"converts",
"prog",
"into",
".",
"\\",
"prog",
"."
]
| [
"func",
"lookExtensions",
"(",
"path",
",",
"dir",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"filepath",
".",
"Base",
"(",
"path",
")",
"==",
"path",
"{",
"path",
"=",
"filepath",
".",
"Join",
"(",
"\"",
"\"",
",",
"path",
")",
"\n",
"}",
"\n",
"if",
"dir",
"==",
"\"",
"\"",
"{",
"return",
"exec",
".",
"LookPath",
"(",
"path",
")",
"\n",
"}",
"\n",
"if",
"filepath",
".",
"VolumeName",
"(",
"path",
")",
"!=",
"\"",
"\"",
"{",
"return",
"exec",
".",
"LookPath",
"(",
"path",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"path",
")",
">",
"1",
"&&",
"os",
".",
"IsPathSeparator",
"(",
"path",
"[",
"0",
"]",
")",
"{",
"return",
"exec",
".",
"LookPath",
"(",
"<mask>",
")",
"\n",
"}",
"\n",
"dirandpath",
":=",
"filepath",
".",
"Join",
"(",
"dir",
",",
"path",
")",
"\n",
"// We assume that LookPath will only add file extension.",
"lp",
",",
"err",
":=",
"exec",
".",
"LookPath",
"(",
"dirandpath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"ext",
":=",
"strings",
".",
"TrimPrefix",
"(",
"lp",
",",
"dirandpath",
")",
"\n",
"return",
"path",
"+",
"ext",
",",
"nil",
"\n",
"}"
]
|
19,032 | all-19033 | [
"Append",
"is",
"a",
"wrapper",
"around",
"g_menu_append",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Menu",
")",
"Append",
"(",
"<mask>",
",",
"detailed_action",
"string",
")",
"{",
"cstr1",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"label",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr1",
")",
")",
"\n\n",
"cstr2",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"detailed_action",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr2",
")",
")",
"\n\n",
"C",
".",
"g_menu_append",
"(",
"v",
".",
"native",
"(",
")",
",",
"cstr1",
",",
"cstr2",
")",
"\n",
"}"
]
|
19,033 | all-19034 | [
"SetInt",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_set_int",
"()",
"."
]
| [
"func",
"(",
"ps",
"*",
"PrintSettings",
")",
"SetInt",
"(",
"<mask>",
"string",
",",
"value",
"int",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"key",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_print_settings_set_int",
"(",
"ps",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"C",
".",
"gint",
"(",
"value",
")",
")",
"\n",
"}"
]
|
19,034 | all-19035 | [
"LogReplay",
"enables",
"an",
"option",
"that",
"optimizes",
"queries",
"that",
"are",
"typically",
"made",
"on",
"the",
"MongoDB",
"oplog",
"for",
"replaying",
"it",
".",
"This",
"is",
"an",
"internal",
"implementation",
"aspect",
"and",
"most",
"likely",
"uninteresting",
"for",
"other",
"uses",
".",
"It",
"has",
"seen",
"at",
"least",
"one",
"use",
"case",
"though",
"so",
"it",
"s",
"exposed",
"via",
"the",
"API",
"."
]
| [
"func",
"(",
"q",
"*",
"Query",
")",
"LogReplay",
"(",
")",
"*",
"<mask>",
"{",
"q",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"q",
".",
"op",
".",
"flags",
"|=",
"flagLogReplay",
"\n",
"q",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"return",
"q",
"\n",
"}"
]
|
19,035 | all-19036 | [
"DefaultDevices",
"loads",
"a",
"default",
"VirtualDeviceList",
"for",
"a",
"supplied",
"pool",
"and",
"guest",
"ID",
"(",
"guest",
"OS",
"type",
")",
"."
]
| [
"func",
"DefaultDevices",
"(",
"client",
"*",
"govmomi",
".",
"Client",
",",
"pool",
"*",
"<mask>",
".",
"ResourcePool",
",",
"guest",
"string",
")",
"(",
"object",
".",
"VirtualDeviceList",
",",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"pool",
".",
"Reference",
"(",
")",
".",
"Value",
",",
"guest",
")",
"\n",
"pprops",
",",
"err",
":=",
"Properties",
"(",
"pool",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"computeresource",
".",
"DefaultDevicesFromReference",
"(",
"client",
",",
"pprops",
".",
"Owner",
",",
"guest",
")",
"\n",
"}"
]
|
19,036 | all-19037 | [
"===",
"round",
"(",
"Vector",
"ValueTypeVector",
"toNearest",
"=",
"1",
"Scalar",
")",
"Vector",
"==="
]
| [
"func",
"funcRound",
"(",
"vals",
"[",
"]",
"Value",
",",
"args",
"Expressions",
",",
"enh",
"*",
"EvalNodeHelper",
")",
"Vector",
"{",
"vec",
":=",
"vals",
"[",
"0",
"]",
".",
"(",
"Vector",
")",
"\n",
"// round returns a number rounded to toNearest.",
"// Ties are solved by rounding up.",
"toNearest",
":=",
"float64",
"(",
"1",
")",
"\n",
"if",
"len",
"(",
"args",
")",
">=",
"2",
"{",
"toNearest",
"=",
"vals",
"[",
"1",
"]",
".",
"(",
"Vector",
")",
"[",
"0",
"]",
".",
"Point",
".",
"V",
"\n",
"}",
"\n",
"// Invert as it seems to cause fewer floating point accuracy issues.",
"toNearestInverse",
":=",
"1.0",
"/",
"toNearest",
"\n\n",
"for",
"_",
",",
"el",
":=",
"range",
"vec",
"{",
"v",
":=",
"math",
".",
"Floor",
"(",
"el",
".",
"V",
"*",
"toNearestInverse",
"+",
"0.5",
")",
"/",
"toNearestInverse",
"\n",
"enh",
".",
"out",
"=",
"append",
"(",
"enh",
".",
"out",
",",
"Sample",
"{",
"Metric",
":",
"enh",
".",
"dropMetricName",
"(",
"el",
".",
"Metric",
")",
",",
"Point",
":",
"<mask>",
"{",
"V",
":",
"v",
"}",
",",
"}",
")",
"\n",
"}",
"\n",
"return",
"enh",
".",
"out",
"\n",
"}"
]
|
19,037 | all-19038 | [
"GetLogQuery",
"returns",
"the",
"LogQuery",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"d",
"*",
"DistributionRequest",
")",
"GetLogQuery",
"(",
")",
"WidgetApmOrLogQuery",
"{",
"if",
"d",
"==",
"nil",
"||",
"d",
".",
"LogQuery",
"==",
"nil",
"{",
"return",
"WidgetApmOrLogQuery",
"{",
"}",
"\n",
"}",
"\n",
"<mask>",
"*",
"d",
".",
"LogQuery",
"\n",
"}"
]
|
19,038 | all-19039 | [
"expandClusterDrsConfigInfo",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"ClusterDrsConfigInfo",
"."
]
| [
"func",
"expandClusterDrsConfigInfo",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"*",
"<mask>",
".",
"ClusterDrsConfigInfo",
"{",
"obj",
":=",
"&",
"types",
".",
"ClusterDrsConfigInfo",
"{",
"DefaultVmBehavior",
":",
"types",
".",
"DrsBehavior",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
")",
",",
"Enabled",
":",
"structure",
".",
"GetBool",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"EnableVmBehaviorOverrides",
":",
"structure",
".",
"GetBool",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"VmotionRate",
":",
"int32",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
")",
",",
"Option",
":",
"expandResourceVSphereComputeClusterDrsAdvancedOptions",
"(",
"d",
")",
",",
"}",
"\n\n",
"return",
"obj",
"\n",
"}"
]
|
19,039 | all-19040 | [
"Do",
"executes",
"Memory",
".",
"getSamplingProfile",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"profile"
]
| [
"func",
"(",
"p",
"*",
"GetSamplingProfileParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"profile",
"*",
"SamplingProfile",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"GetSamplingProfileReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetSamplingProfile",
",",
"nil",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"Profile",
",",
"nil",
"\n",
"}"
]
|
19,040 | all-19041 | [
"//",
"GenSybase",
"generates",
"a",
"sqlany",
"DSN",
"from",
"the",
"passed",
"URL",
".",
"func",
"GenSybase",
"(",
"u",
"*",
"URL",
")",
"(",
"string",
"error",
")",
"{",
"//",
"of",
"format",
"UID",
"=",
"DBA",
";",
"PWD",
"=",
"sql",
";",
"Host",
"=",
"demo12",
";",
"DatabaseName",
"=",
"demo",
";",
"ServerName",
"=",
"myserver",
"host",
"port",
"dbname",
":",
"=",
"hostname",
"(",
"u",
".",
"Host",
")",
"hostport",
"(",
"u",
".",
"Host",
")",
"strings",
".",
"TrimPrefix",
"(",
"u",
".",
"Path",
"/",
")",
"//",
"add",
"instance",
"name",
"to",
"host",
"if",
"present",
"if",
"i",
":",
"=",
"strings",
".",
"Index",
"(",
"dbname",
"/",
")",
";",
"i",
"!",
"=",
"-",
"1",
"{",
"host",
"=",
"host",
"+",
"\\",
"+",
"dbname",
"[",
":",
"i",
"]",
"dbname",
"=",
"dbname",
"[",
"i",
"+",
"1",
":",
"]",
"}",
"q",
":",
"=",
"u",
".",
"Query",
"()",
"q",
".",
"Set",
"(",
"Host",
"host",
")",
"if",
"port",
"!",
"=",
"{",
"q",
".",
"Set",
"(",
"LINKS",
"tcpip",
"(",
"PORT",
"=",
"+",
"port",
"+",
")",
")",
"}",
"q",
".",
"Set",
"(",
"DatabaseName",
"dbname",
")",
"//",
"add",
"user",
"/",
"pass",
"if",
"u",
".",
"User",
"!",
"=",
"nil",
"{",
"q",
".",
"Set",
"(",
"UID",
"u",
".",
"User",
".",
"Username",
"()",
")",
"pass",
"_",
":",
"=",
"u",
".",
"User",
".",
"Password",
"()",
"q",
".",
"Set",
"(",
"PWD",
"pass",
")",
"}",
"//",
"save",
"host",
"port",
"dbname",
"if",
"u",
".",
"hostPortDB",
"==",
"nil",
"{",
"u",
".",
"hostPortDB",
"=",
"[]",
"string",
"{",
"host",
"port",
"dbname",
"}",
"}",
"return",
"genOptionsODBC",
"(",
"q",
"true",
")",
"nil",
"}",
"GenMySQL",
"generates",
"a",
"mysql",
"DSN",
"from",
"the",
"passed",
"URL",
"."
]
| [
"func",
"GenMySQL",
"(",
"u",
"*",
"URL",
")",
"(",
"string",
",",
"error",
")",
"{",
"host",
",",
"port",
",",
"dbname",
":=",
"hostname",
"(",
"u",
".",
"Host",
")",
",",
"hostport",
"(",
"u",
".",
"Host",
")",
",",
"strings",
".",
"TrimPrefix",
"(",
"u",
".",
"Path",
",",
"\"",
"\"",
")",
"\n\n",
"var",
"dsn",
"string",
"\n\n",
"// build user/pass",
"if",
"u",
".",
"User",
"!=",
"nil",
"{",
"if",
"un",
":=",
"u",
".",
"User",
".",
"Username",
"(",
")",
";",
"len",
"(",
"un",
")",
">",
"0",
"{",
"if",
"up",
",",
"ok",
":=",
"u",
".",
"User",
".",
"Password",
"(",
")",
";",
"ok",
"{",
"un",
"+=",
"\"",
"\"",
"+",
"<mask>",
"\n",
"}",
"\n",
"dsn",
"+=",
"un",
"+",
"\"",
"\"",
"\n",
"}",
"\n",
"}",
"\n\n",
"// resolve path",
"if",
"u",
".",
"Proto",
"==",
"\"",
"\"",
"{",
"if",
"host",
"==",
"\"",
"\"",
"{",
"dbname",
"=",
"\"",
"\"",
"+",
"dbname",
"\n",
"}",
"\n",
"host",
",",
"dbname",
"=",
"resolveSocket",
"(",
"stdpath",
".",
"Join",
"(",
"host",
",",
"dbname",
")",
")",
"\n",
"port",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"// save host, port, dbname",
"if",
"u",
".",
"hostPortDB",
"==",
"nil",
"{",
"u",
".",
"hostPortDB",
"=",
"[",
"]",
"string",
"{",
"host",
",",
"port",
",",
"dbname",
"}",
"\n",
"}",
"\n\n",
"// if host or proto is not empty",
"if",
"u",
".",
"Proto",
"!=",
"\"",
"\"",
"{",
"if",
"host",
"==",
"\"",
"\"",
"{",
"host",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"port",
"==",
"\"",
"\"",
"{",
"port",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"port",
"!=",
"\"",
"\"",
"{",
"port",
"=",
"\"",
"\"",
"+",
"port",
"\n",
"}",
"\n\n",
"dsn",
"+=",
"u",
".",
"Proto",
"+",
"\"",
"\"",
"+",
"host",
"+",
"port",
"+",
"\"",
"\"",
"\n\n",
"// add database name",
"dsn",
"+=",
"\"",
"\"",
"+",
"dbname",
"\n\n",
"return",
"dsn",
"+",
"genQueryOptions",
"(",
"u",
".",
"Query",
"(",
")",
")",
",",
"nil",
"\n",
"}"
]
|
19,041 | all-19042 | [
"Clone",
"wraps",
"the",
"creation",
"of",
"a",
"virtual",
"machine",
"and",
"the",
"subsequent",
"waiting",
"of",
"the",
"task",
".",
"A",
"higher",
"-",
"level",
"virtual",
"machine",
"object",
"is",
"returned",
"."
]
| [
"func",
"Clone",
"(",
"c",
"*",
"govmomi",
".",
"Client",
",",
"src",
"*",
"object",
".",
"VirtualMachine",
",",
"f",
"*",
"object",
".",
"Folder",
",",
"name",
"string",
",",
"spec",
"types",
".",
"VirtualMachineCloneSpec",
",",
"timeout",
"int",
")",
"(",
"*",
"object",
".",
"VirtualMachine",
",",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"f",
".",
"InventoryPath",
",",
"name",
")",
")",
"\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"time",
".",
"Minute",
"*",
"time",
".",
"Duration",
"(",
"timeout",
")",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"task",
",",
"err",
":=",
"src",
".",
"Clone",
"(",
"ctx",
",",
"f",
",",
"name",
",",
"spec",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"ctx",
".",
"Err",
"(",
")",
"==",
"<mask>",
".",
"DeadlineExceeded",
"{",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"result",
",",
"err",
":=",
"task",
".",
"WaitForResult",
"(",
"ctx",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"ctx",
".",
"Err",
"(",
")",
"==",
"context",
".",
"DeadlineExceeded",
"{",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"f",
".",
"InventoryPath",
",",
"name",
")",
",",
"result",
".",
"Result",
".",
"(",
"types",
".",
"ManagedObjectReference",
")",
".",
"Value",
")",
"\n",
"return",
"FromMOID",
"(",
"c",
",",
"result",
".",
"Result",
".",
"(",
"types",
".",
"ManagedObjectReference",
")",
".",
"Value",
")",
"\n",
"}"
]
|
19,042 | all-19043 | [
"EncodeArray",
"provides",
"the",
"implementation",
"of",
"the",
"array",
"encoding",
"algorithm",
"where",
"n",
"is",
"the",
"number",
"of",
"elements",
"in",
"the",
"array",
"and",
"f",
"a",
"function",
"called",
"to",
"encode",
"each",
"element",
".",
"The",
"n",
"argument",
"can",
"be",
"set",
"to",
"a",
"negative",
"value",
"to",
"indicate",
"that",
"the",
"program",
"doesn",
"t",
"know",
"how",
"many",
"elements",
"it",
"will",
"output",
"to",
"the",
"array",
".",
"Be",
"mindful",
"that",
"not",
"all",
"emitters",
"support",
"encoding",
"arrays",
"of",
"unknown",
"lengths",
".",
"The",
"f",
"function",
"is",
"called",
"to",
"encode",
"each",
"element",
"of",
"the",
"array",
"."
]
| [
"func",
"(",
"e",
"Encoder",
")",
"EncodeArray",
"(",
"n",
"int",
",",
"f",
"func",
"(",
"Encoder",
")",
"error",
")",
"(",
"err",
"error",
")",
"{",
"if",
"e",
".",
"key",
"{",
"if",
"e",
".",
"key",
",",
"err",
"=",
"false",
",",
"e",
".",
"Emitter",
".",
"EmitMapValue",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"e",
".",
"Emitter",
".",
"EmitArrayBegin",
"(",
"n",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"encodeArray",
":",
"for",
"i",
":=",
"0",
";",
"n",
"<",
"0",
"||",
"i",
"<",
"n",
";",
"i",
"++",
"{",
"if",
"i",
"!=",
"0",
"{",
"if",
"e",
".",
"Emitter",
".",
"EmitArrayNext",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"switch",
"err",
"=",
"f",
"(",
"e",
")",
";",
"err",
"{",
"case",
"nil",
":",
"case",
"End",
":",
"<mask>",
"encodeArray",
"\n",
"default",
":",
"return",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"e",
".",
"Emitter",
".",
"EmitArrayEnd",
"(",
")",
"\n",
"}"
]
|
19,043 | all-19044 | [
"AddEncoder",
"registers",
"a",
"mimetype",
"and",
"its",
"encoder",
"to",
"be",
"used",
"if",
"a",
"client",
"requests",
"that",
"mimetype"
]
| [
"func",
"(",
"cn",
"*",
"ContentNegotiator",
")",
"AddEncoder",
"(",
"mimeType",
"string",
",",
"enc",
"Encoder",
")",
"{",
"if",
"cn",
".",
"encoderMap",
"==",
"nil",
"{",
"cn",
".",
"encoderMap",
"=",
"make",
"(",
"<mask>",
"[",
"string",
"]",
"Encoder",
")",
"\n",
"}",
"\n",
"cn",
".",
"encoderMap",
"[",
"mimeType",
"]",
"=",
"enc",
"\n",
"}"
]
|
19,044 | all-19045 | [
"GetIterAtOffset",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_text_buffer_get_iter_at_offset",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"TextBuffer",
")",
"GetIterAtOffset",
"(",
"charOffset",
"int",
")",
"*",
"TextIter",
"{",
"<mask>",
"iter",
"C",
".",
"GtkTextIter",
"\n",
"C",
".",
"gtk_text_buffer_get_iter_at_offset",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"iter",
",",
"C",
".",
"gint",
"(",
"charOffset",
")",
")",
"\n",
"return",
"(",
"*",
"TextIter",
")",
"(",
"&",
"iter",
")",
"\n",
"}"
]
|
19,045 | all-19046 | [
"WriteTabularData",
"writes",
"the",
"given",
"results",
"to",
"the",
"given",
"output",
"stream"
]
| [
"func",
"WriteTabularData",
"(",
"interval",
"time",
".",
"Duration",
",",
"r",
"results",
".",
"ResultSet",
",",
"w",
"io",
".",
"Writer",
")",
"{",
"<mask>",
":=",
"r",
".",
"Reduce",
"(",
"interval",
")",
"\n",
"t",
":=",
"results",
".",
"TabularResults",
"{",
"}",
"\n",
"rows",
":=",
"t",
".",
"Tabulate",
"(",
"set",
")",
"\n\n",
"for",
"_",
",",
"row",
":=",
"range",
"rows",
"{",
"w",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"row",
".",
"String",
"(",
")",
")",
")",
"\n",
"w",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"\"",
"\\n",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
]
|
19,046 | all-19047 | [
"ProfileExists",
"checks",
"if",
"a",
"profile",
"with",
"the",
"given",
"key",
"exists",
"."
]
| [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"ProfileExists",
"(",
"project",
"string",
",",
"name",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"_",
",",
"err",
":=",
"c",
".",
"ProfileID",
"(",
"project",
",",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"ErrNoSuchObject",
"{",
"return",
"false",
",",
"nil",
"\n",
"}",
"\n",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}"
]
|
19,047 | all-19048 | [
"NewImage",
"returns",
"a",
"types",
".",
"ImageCloser",
"for",
"this",
"reference",
"possibly",
"specialized",
"for",
"this",
"ImageTransport",
".",
"The",
"caller",
"must",
"call",
".",
"Close",
"()",
"on",
"the",
"returned",
"ImageCloser",
".",
"NOTE",
":",
"If",
"any",
"kind",
"of",
"signature",
"verification",
"should",
"happen",
"build",
"an",
"UnparsedImage",
"from",
"the",
"value",
"returned",
"by",
"NewImageSource",
"verify",
"that",
"UnparsedImage",
"and",
"convert",
"it",
"into",
"a",
"real",
"Image",
"via",
"image",
".",
"FromUnparsedImage",
".",
"WARNING",
":",
"This",
"may",
"not",
"do",
"the",
"right",
"thing",
"for",
"a",
"manifest",
"list",
"see",
"image",
".",
"FromSource",
"for",
"details",
"."
]
| [
"func",
"(",
"r",
"*",
"tarballReference",
")",
"NewImage",
"(",
"ctx",
"<mask>",
".",
"Context",
",",
"sys",
"*",
"types",
".",
"SystemContext",
")",
"(",
"types",
".",
"ImageCloser",
",",
"error",
")",
"{",
"src",
",",
"err",
":=",
"r",
".",
"NewImageSource",
"(",
"ctx",
",",
"sys",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"img",
",",
"err",
":=",
"image",
".",
"FromSource",
"(",
"ctx",
",",
"sys",
",",
"src",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"src",
".",
"Close",
"(",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"img",
",",
"nil",
"\n",
"}"
]
|
19,048 | all-19049 | [
"Set",
"a",
"new",
"FrameSet",
"by",
"way",
"of",
"providing",
"a",
"string",
"frame",
"range",
".",
"If",
"the",
"frame",
"range",
"cannot",
"be",
"parsed",
"an",
"error",
"will",
"be",
"returned",
"."
]
| [
"func",
"(",
"s",
"*",
"FileSequence",
")",
"SetFrameRange",
"(",
"frameRange",
"string",
")",
"error",
"{",
"frameSet",
",",
"err",
":=",
"NewFrameSet",
"(",
"frameRange",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"s",
".",
"frameSet",
"=",
"frameSet",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,049 | all-19050 | [
"Exec",
"will",
"bind",
"the",
"interface",
"to",
"the",
"request",
".",
"Body",
".",
"The",
"type",
"of",
"binding",
"is",
"dependent",
"on",
"the",
"Content",
"-",
"Type",
"for",
"the",
"request",
".",
"If",
"the",
"type",
"is",
"application",
"/",
"json",
"it",
"will",
"use",
"json",
".",
"NewDecoder",
".",
"If",
"the",
"type",
"is",
"application",
"/",
"xml",
"it",
"will",
"use",
"xml",
".",
"NewDecoder",
".",
"The",
"default",
"binder",
"is",
"https",
":",
"//",
"github",
".",
"com",
"/",
"monoculum",
"/",
"formam",
"."
]
| [
"func",
"Exec",
"(",
"req",
"*",
"<mask>",
".",
"Request",
",",
"value",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"ba",
",",
"ok",
":=",
"value",
".",
"(",
"Bindable",
")",
";",
"ok",
"{",
"return",
"ba",
".",
"Bind",
"(",
"req",
")",
"\n",
"}",
"\n\n",
"ct",
":=",
"httpx",
".",
"ContentType",
"(",
"req",
")",
"\n",
"if",
"ct",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"b",
",",
"ok",
":=",
"binders",
"[",
"ct",
"]",
";",
"ok",
"{",
"return",
"b",
"(",
"req",
",",
"value",
")",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ct",
")",
"\n",
"}"
]
|
19,050 | all-19051 | [
"setLastContact",
"is",
"used",
"to",
"set",
"the",
"last",
"contact",
"time",
"to",
"now"
]
| [
"func",
"(",
"r",
"*",
"Raft",
")",
"setLastContact",
"(",
")",
"{",
"r",
".",
"lastContactLock",
".",
"Lock",
"(",
")",
"\n",
"r",
".",
"lastContact",
"=",
"<mask>",
".",
"Now",
"(",
")",
"\n",
"r",
".",
"lastContactLock",
".",
"Unlock",
"(",
")",
"\n",
"}"
]
|
19,051 | all-19052 | [
"GetDefaultScreen",
"()",
"is",
"a",
"wrapper",
"around",
"gdk_display_get_default_screen",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Display",
")",
"GetDefaultScreen",
"(",
")",
"(",
"*",
"Screen",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gdk_display_get_default_screen",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"<mask>",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n\n",
"return",
"&",
"Screen",
"{",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"}",
",",
"nil",
"\n",
"}"
]
|
19,052 | all-19053 | [
"/",
"*",
"Allocates",
"and",
"initializes",
"CvMatND",
"header"
]
| [
"func",
"CreateMatNDHeader",
"(",
"sizes",
"[",
"]",
"int",
",",
"type_",
"int",
")",
"*",
"MatND",
"{",
"dims",
":=",
"C",
".",
"int",
"(",
"len",
"(",
"sizes",
")",
")",
"\n",
"sizes_c",
":=",
"<mask>",
"(",
"[",
"]",
"C",
".",
"int",
",",
"len",
"(",
"sizes",
")",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"sizes",
")",
";",
"i",
"++",
"{",
"sizes_c",
"[",
"i",
"]",
"=",
"C",
".",
"int",
"(",
"sizes",
"[",
"i",
"]",
")",
"\n",
"}",
"\n\n",
"mat",
":=",
"C",
".",
"cvCreateMatNDHeader",
"(",
"dims",
",",
"(",
"*",
"C",
".",
"int",
")",
"(",
"&",
"sizes_c",
"[",
"0",
"]",
")",
",",
"C",
".",
"int",
"(",
"type_",
")",
",",
")",
"\n",
"return",
"(",
"*",
"MatND",
")",
"(",
"mat",
")",
"\n",
"}"
]
|
19,053 | all-19054 | [
"Infoln",
"logging"
]
| [
"func",
"(",
"l",
"*",
"StdLevelLogger",
")",
"Infoln",
"(",
"args",
"...",
"<mask>",
"{",
"}",
")",
"{",
"l",
".",
"loglnFunc",
"(",
"InfoLevel",
",",
"l",
".",
"context",
",",
"args",
"...",
")",
"\n",
"}"
]
|
19,054 | all-19055 | [
"MarshalEasyJSON",
"writes",
"the",
"Hostname",
"to",
"a",
"easyjson",
".",
"Writer"
]
| [
"func",
"(",
"h",
"Hostname",
")",
"MarshalEasyJSON",
"(",
"w",
"*",
"jwriter",
".",
"<mask>",
")",
"{",
"w",
".",
"String",
"(",
"string",
"(",
"h",
")",
")",
"\n",
"}"
]
|
19,055 | all-19056 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"PositionTickInfo",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoProfiler18",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
19,056 | all-19057 | [
"ParseUint",
"parses",
"uint",
"from",
"buf",
"."
]
| [
"func",
"ParseUint",
"(",
"buf",
"[",
"]",
"<mask>",
")",
"(",
"int",
",",
"error",
")",
"{",
"v",
",",
"n",
",",
"err",
":=",
"parseUintBuf",
"(",
"buf",
")",
"\n",
"if",
"n",
"!=",
"len",
"(",
"buf",
")",
"{",
"return",
"-",
"1",
",",
"errUnexpectedTrailingChar",
"\n",
"}",
"\n",
"return",
"v",
",",
"err",
"\n",
"}"
]
|
19,057 | all-19058 | [
"ValidLabel",
"returns",
"true",
"if",
"the",
"given",
"label",
"is",
"valid",
"otherwise",
"false",
"."
]
| [
"func",
"ValidLabel",
"(",
"label",
"string",
")",
"bool",
"{",
"return",
"len",
"(",
"<mask>",
")",
"<=",
"maxLabel",
"&&",
"labelRegex",
".",
"Match",
"(",
"[",
"]",
"byte",
"(",
"label",
")",
")",
"\n",
"}"
]
|
19,058 | all-19059 | [
"CreateStoragePoolVolumeSnapshot",
"defines",
"a",
"new",
"storage",
"volume"
]
| [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"CreateStoragePoolVolumeSnapshot",
"(",
"pool",
"string",
",",
"volumeType",
"string",
",",
"volumeName",
"string",
",",
"snapshot",
"api",
".",
"StorageVolumeSnapshotsPost",
")",
"(",
"Operation",
",",
"error",
")",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Send the request",
"path",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"pool",
")",
",",
"<mask>",
".",
"QueryEscape",
"(",
"volumeType",
")",
",",
"url",
".",
"QueryEscape",
"(",
"volumeName",
")",
")",
"\n",
"op",
",",
"_",
",",
"err",
":=",
"r",
".",
"queryOperation",
"(",
"\"",
"\"",
",",
"path",
",",
"snapshot",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"op",
",",
"nil",
"\n",
"}"
]
|
19,059 | all-19060 | [
"HasClientID",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"i",
"*",
"IntegrationGCPCreateRequest",
")",
"HasClientID",
"(",
")",
"bool",
"{",
"if",
"i",
"!=",
"nil",
"&&",
"i",
".",
"ClientID",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
]
|
19,060 | all-19061 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"GetNodeForLocationParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom39",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
19,061 | all-19062 | [
"Delete",
"the",
"Queue",
"with",
"the",
"given",
"sid",
".",
"If",
"the",
"Queue",
"has",
"already",
"been",
"deleted",
"or",
"does",
"not",
"exist",
"Delete",
"returns",
"nil",
".",
"If",
"another",
"error",
"or",
"a",
"timeout",
"occurs",
"the",
"error",
"is",
"returned",
"."
]
| [
"func",
"(",
"c",
"*",
"QueueService",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"sid",
"string",
")",
"error",
"{",
"return",
"c",
".",
"<mask>",
".",
"DeleteResource",
"(",
"ctx",
",",
"queuePathPart",
",",
"sid",
")",
"\n",
"}"
]
|
19,062 | all-19063 | [
"shouldPrune",
"finds",
"comments",
"left",
"by",
"this",
"plugin",
"."
]
| [
"func",
"shouldPrune",
"(",
"log",
"*",
"logrus",
".",
"Entry",
")",
"func",
"(",
"github",
".",
"IssueComment",
")",
"bool",
"{",
"return",
"func",
"(",
"comment",
"github",
".",
"IssueComment",
")",
"bool",
"{",
"return",
"strings",
".",
"Contains",
"(",
"comment",
".",
"<mask>",
",",
"dcoMsgPruneMatch",
")",
"\n",
"}",
"\n",
"}"
]
|
19,063 | all-19064 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"Resource",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
19,064 | all-19065 | [
"LookupGShadow",
"looks",
"up",
"a",
"shadowed",
"group",
"by",
"name",
"."
]
| [
"func",
"LookupGShadow",
"(",
"name",
"string",
")",
"(",
"*",
"GShadow",
",",
"error",
")",
"{",
"entries",
",",
"err",
":=",
"LookupInGShadow",
"(",
"GS_NAME",
",",
"<mask>",
",",
"1",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"entries",
"[",
"0",
"]",
",",
"err",
"\n",
"}"
]
|
19,065 | all-19066 | [
"FreeFull",
"is",
"a",
"wrapper",
"around",
"g_slist_free_full",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"SList",
")",
"FreeFull",
"(",
")",
"{",
"//TODO implement GDestroyNotify callback",
"C",
".",
"g_slist_free_full",
"(",
"v",
".",
"native",
"(",
")",
",",
"nil",
")",
"\n",
"v",
".",
"<mask>",
"=",
"nil",
"\n",
"}"
]
|
19,066 | all-19067 | [
"native",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GtkCellRendererToggle",
"."
]
| [
"func",
"(",
"v",
"*",
"CellRendererToggle",
")",
"native",
"(",
")",
"*",
"C",
".",
"GtkCellRendererToggle",
"{",
"if",
"v",
"==",
"nil",
"||",
"v",
".",
"GObject",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"p",
":=",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"GObject",
")",
"\n",
"<mask>",
"C",
".",
"toGtkCellRendererToggle",
"(",
"p",
")",
"\n",
"}"
]
|
19,067 | all-19068 | [
"AddMetricTags",
"appends",
"tags",
"to",
"any",
"existing",
"tags",
"for",
"the",
"named",
"metric",
"and",
"flags",
"a",
"check",
"update",
"is",
"needed"
]
| [
"func",
"(",
"m",
"*",
"CirconusMetrics",
")",
"AddMetricTags",
"(",
"name",
"string",
",",
"tags",
"[",
"]",
"string",
")",
"bool",
"{",
"return",
"m",
".",
"check",
".",
"AddMetricTags",
"(",
"name",
",",
"tags",
",",
"<mask>",
")",
"\n",
"}"
]
|
19,068 | all-19069 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"FrameWithManifest",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache7",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
19,069 | all-19070 | [
"read",
"byte"
]
| [
"func",
"readuint8",
"(",
"pos",
"int64",
")",
"uint8",
"{",
"<mask>",
"retval",
"uint8",
"\n",
"data",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"1",
")",
"\n",
"_",
",",
"err",
":=",
"f",
".",
"ReadAt",
"(",
"data",
",",
"pos",
"-",
"1",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"retval",
"=",
"data",
"[",
"0",
"]",
"\n",
"return",
"retval",
"\n",
"}"
]
|
19,070 | all-19071 | [
"NewLoad",
"creates",
"a",
"new",
"empty",
"load",
"statement",
"for",
"the",
"given",
"file",
"name",
"."
]
| [
"func",
"NewLoad",
"(",
"name",
"string",
")",
"*",
"Load",
"{",
"return",
"&",
"Load",
"{",
"stmt",
":",
"stmt",
"{",
"expr",
":",
"&",
"bzl",
".",
"LoadStmt",
"{",
"Module",
":",
"&",
"bzl",
".",
"StringExpr",
"{",
"Value",
":",
"name",
"}",
",",
"ForceCompact",
":",
"true",
",",
"}",
",",
"}",
",",
"name",
":",
"<mask>",
",",
"symbols",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"identPair",
")",
",",
"}",
"\n",
"}"
]
|
19,071 | all-19072 | [
"SetUseMarkup",
"is",
"a",
"wrapper",
"around",
"gtk_label_set_use_markup",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetUseMarkup",
"(",
"use",
"bool",
")",
"{",
"C",
".",
"gtk_label_set_use_markup",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"use",
")",
")",
"\n",
"}"
]
|
19,072 | all-19073 | [
"number",
"parses",
"a",
"number",
"."
]
| [
"func",
"(",
"p",
"*",
"parser",
")",
"<mask>",
"(",
"val",
"string",
")",
"float64",
"{",
"n",
",",
"err",
":=",
"strconv",
".",
"ParseInt",
"(",
"val",
",",
"0",
",",
"64",
")",
"\n",
"f",
":=",
"float64",
"(",
"n",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"f",
",",
"err",
"=",
"strconv",
".",
"ParseFloat",
"(",
"val",
",",
"64",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"f",
"\n",
"}"
]
|
19,073 | all-19074 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"GetHeapObjectIDParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeapprofiler14",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
]
|
19,074 | all-19075 | [
"ListLans",
"returns",
"a",
"Collection",
"for",
"lans",
"in",
"the",
"Datacenter"
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"ListLans",
"(",
"dcid",
"string",
")",
"(",
"*",
"Lans",
",",
"error",
")",
"{",
"url",
":=",
"lanColPath",
"(",
"dcid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"<mask>",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"Lans",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Get",
"(",
"url",
",",
"ret",
",",
"http",
".",
"StatusOK",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
]
|
19,075 | all-19076 | [
"LoadRulesFromFile",
"loads",
"rules",
"from",
"all",
"YAML",
"files",
"inside",
"a",
"directory",
"."
]
| [
"func",
"(",
"s",
"*",
"Seekret",
")",
"LoadRulesFromDir",
"(",
"dir",
"string",
",",
"defaulEnabled",
"bool",
")",
"error",
"{",
"fi",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"dir",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"!",
"fi",
".",
"IsDir",
"(",
")",
"{",
"err",
":=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"dir",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"fileList",
",",
"err",
":=",
"filepath",
".",
"Glob",
"(",
"dir",
"+",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"file",
":=",
"<mask>",
"fileList",
"{",
"if",
"strings",
".",
"HasSuffix",
"(",
"file",
",",
"\"",
"\"",
")",
"{",
"err",
":=",
"s",
".",
"LoadRulesFromFile",
"(",
"file",
",",
"defaulEnabled",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,076 | all-19077 | [
"GetStyle",
"is",
"a",
"wrapper",
"around",
"gtk_toolbar_get_style",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Toolbar",
")",
"GetStyle",
"(",
")",
"ToolbarStyle",
"{",
"c",
":=",
"C",
".",
"gtk_toolbar_get_style",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"ToolbarStyle",
"(",
"c",
")",
"\n",
"}"
]
|
19,077 | all-19078 | [
"MustInit",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockTaskEngine",
")",
"MustInit",
"(",
"arg0",
"<mask>",
".",
"Context",
")",
"{",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"}"
]
|
19,078 | all-19079 | [
"Exec",
"executes",
"the",
"command",
"initiated",
"in",
"gitCmd",
"."
]
| [
"func",
"(",
"g",
"*",
"gitCmd",
")",
"Exec",
"(",
"dir",
"string",
")",
"error",
"{",
"g",
".",
"Lock",
"(",
")",
"\n",
"g",
".",
"dir",
"=",
"dir",
"\n",
"g",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"g",
".",
"background",
"{",
"return",
"g",
".",
"execBackground",
"(",
"dir",
")",
"\n",
"}",
"\n",
"return",
"g",
".",
"<mask>",
"(",
"dir",
")",
"\n",
"}"
]
|
19,079 | all-19080 | [
"Load",
"a",
"font",
"from",
"cache",
"if",
"exists",
"otherwise",
"it",
"will",
"load",
"the",
"font",
"from",
"file"
]
| [
"func",
"(",
"cache",
"*",
"FolderFontCache",
")",
"Load",
"(",
"fontData",
"FontData",
")",
"(",
"font",
"*",
"truetype",
".",
"Font",
",",
"err",
"error",
")",
"{",
"if",
"font",
"=",
"cache",
".",
"fonts",
"[",
"cache",
".",
"namer",
"(",
"fontData",
")",
"]",
";",
"font",
"!=",
"nil",
"{",
"return",
"font",
",",
"nil",
"\n",
"}",
"\n\n",
"var",
"data",
"[",
"]",
"byte",
"\n",
"<mask>",
"file",
"=",
"cache",
".",
"namer",
"(",
"fontData",
")",
"\n\n",
"if",
"data",
",",
"err",
"=",
"ioutil",
".",
"ReadFile",
"(",
"filepath",
".",
"Join",
"(",
"cache",
".",
"folder",
",",
"file",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"if",
"font",
",",
"err",
"=",
"truetype",
".",
"Parse",
"(",
"data",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"cache",
".",
"fonts",
"[",
"file",
"]",
"=",
"font",
"\n",
"return",
"\n",
"}"
]
|
19,080 | all-19081 | [
"startReceive",
"starts",
"receiving",
"messages",
".",
"This",
"method",
"blocks",
"and",
"does",
"not",
"return",
"until",
"the",
"connection",
"is",
"closed",
"."
]
| [
"func",
"(",
"c",
"*",
"Conn",
")",
"startReceive",
"(",
")",
"{",
"recvCounter",
".",
"Add",
"(",
"1",
")",
"\n",
"defer",
"func",
"(",
")",
"{",
"c",
".",
"Close",
"(",
")",
"\n",
"c",
".",
"disconnHandler",
"(",
"c",
")",
"\n",
"recvCounter",
".",
"Add",
"(",
"-",
"1",
")",
"\n",
"}",
"(",
")",
"\n\n",
"for",
"{",
"var",
"m",
"message",
"\n",
"err",
":=",
"c",
".",
"receive",
"(",
"&",
"m",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// if we closed the connection",
"if",
"!",
"c",
".",
"connected",
".",
"Load",
"(",
")",
".",
"(",
"bool",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"c",
".",
"ID",
",",
"c",
".",
"RemoteAddr",
"(",
")",
")",
"\n",
"break",
"\n",
"}",
"\n\n",
"// if peer closed the connection",
"if",
"err",
"==",
"<mask>",
".",
"EOF",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"c",
".",
"ID",
",",
"c",
".",
"RemoteAddr",
"(",
")",
")",
"\n",
"break",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"break",
"\n",
"}",
"\n\n",
"// if the message is a request",
"if",
"m",
".",
"Method",
"!=",
"\"",
"\"",
"{",
"reqCounter",
".",
"Add",
"(",
"1",
")",
"\n",
"c",
".",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"defer",
"reqCounter",
".",
"Add",
"(",
"-",
"1",
")",
"\n",
"defer",
"recoverAndLog",
"(",
"c",
",",
"&",
"c",
".",
"wg",
")",
"\n",
"ctx",
":=",
"newReqCtx",
"(",
"c",
",",
"m",
".",
"ID",
",",
"m",
".",
"Method",
",",
"m",
".",
"Params",
",",
"c",
".",
"middleware",
")",
"\n",
"if",
"err",
":=",
"ctx",
".",
"Next",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"c",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"if",
"ctx",
".",
"Res",
"!=",
"nil",
"||",
"ctx",
".",
"Err",
"!=",
"nil",
"{",
"if",
"err",
":=",
"ctx",
".",
"Conn",
".",
"sendResponse",
"(",
"ctx",
".",
"ID",
",",
"ctx",
".",
"Res",
",",
"ctx",
".",
"Err",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"c",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"continue",
"\n",
"}",
"\n\n",
"// if the message is not a JSON-RPC message",
"if",
"m",
".",
"ID",
"==",
"\"",
"\"",
"||",
"(",
"m",
".",
"Result",
"==",
"nil",
"&&",
"m",
".",
"Error",
"==",
"nil",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"c",
".",
"ID",
",",
"c",
".",
"RemoteAddr",
"(",
")",
",",
"m",
")",
"\n",
"break",
"\n",
"}",
"\n\n",
"// if the message is a response",
"if",
"resHandler",
",",
"ok",
":=",
"c",
".",
"resRoutes",
".",
"GetOk",
"(",
"m",
".",
"ID",
")",
";",
"ok",
"{",
"resCounter",
".",
"Add",
"(",
"1",
")",
"\n",
"c",
".",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"defer",
"resCounter",
".",
"Add",
"(",
"-",
"1",
")",
"\n",
"defer",
"recoverAndLog",
"(",
"c",
",",
"&",
"c",
".",
"wg",
")",
"\n",
"err",
":=",
"resHandler",
".",
"(",
"func",
"(",
"ctx",
"*",
"ResCtx",
")",
"error",
")",
"(",
"newResCtx",
"(",
"c",
",",
"m",
".",
"ID",
",",
"m",
".",
"Result",
",",
"m",
".",
"Error",
")",
")",
"\n",
"c",
".",
"resRoutes",
".",
"Delete",
"(",
"m",
".",
"ID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"c",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"}",
"else",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"m",
".",
"ID",
")",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}"
]
|
19,081 | all-19082 | [
"setCurrentTerm",
"is",
"used",
"to",
"set",
"the",
"current",
"term",
"in",
"a",
"durable",
"manner",
"."
]
| [
"func",
"(",
"r",
"*",
"Raft",
")",
"setCurrentTerm",
"(",
"t",
"uint64",
")",
"{",
"// Persist to disk first",
"if",
"err",
":=",
"r",
".",
"stable",
".",
"SetUint64",
"(",
"keyCurrentTerm",
",",
"t",
")",
";",
"<mask>",
"!=",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
")",
"\n",
"}",
"\n",
"r",
".",
"raftState",
".",
"setCurrentTerm",
"(",
"t",
")",
"\n",
"}"
]
|
19,082 | all-19083 | [
"TODO",
"(",
"jayconrod",
")",
":",
"annotation",
"directives",
"will",
"apply",
"to",
"an",
"individual",
"rule",
".",
"They",
"must",
"appear",
"in",
"the",
"block",
"of",
"comments",
"above",
"that",
"rule",
".",
"ParseDirectives",
"scans",
"f",
"for",
"Gazelle",
"directives",
".",
"The",
"full",
"list",
"of",
"directives",
"is",
"returned",
".",
"Errors",
"are",
"reported",
"for",
"unrecognized",
"directives",
"and",
"directives",
"out",
"of",
"place",
"(",
"after",
"the",
"first",
"statement",
")",
"."
]
| [
"func",
"ParseDirectives",
"(",
"f",
"*",
"bzl",
".",
"File",
")",
"[",
"]",
"Directive",
"{",
"var",
"directives",
"[",
"]",
"Directive",
"\n",
"parseComment",
":=",
"func",
"(",
"com",
"bzl",
".",
"Comment",
")",
"{",
"match",
":=",
"directiveRe",
".",
"FindStringSubmatch",
"(",
"com",
".",
"Token",
")",
"\n",
"if",
"match",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"key",
",",
"value",
":=",
"match",
"[",
"1",
"]",
",",
"match",
"[",
"2",
"]",
"\n",
"directives",
"=",
"append",
"(",
"directives",
",",
"Directive",
"{",
"key",
",",
"value",
"}",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"s",
":=",
"range",
"f",
".",
"Stmt",
"{",
"coms",
":=",
"s",
".",
"Comment",
"(",
")",
"\n",
"for",
"_",
",",
"com",
":=",
"<mask>",
"coms",
".",
"Before",
"{",
"parseComment",
"(",
"com",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"com",
":=",
"range",
"coms",
".",
"After",
"{",
"parseComment",
"(",
"com",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"directives",
"\n",
"}"
]
|
19,083 | all-19084 | [
"TextDecreasing",
"sets",
"the",
"next",
"sort",
"key",
"to",
"sort",
"by",
"column",
"n",
"in",
"reverse",
"lexicographic",
"order",
".",
"Column",
"0",
"means",
"the",
"entire",
"string",
".",
"Items",
"that",
"do",
"not",
"have",
"column",
"n",
"sort",
"to",
"the",
"end",
"."
]
| [
"func",
"(",
"s",
"*",
"SortFilter",
")",
"TextDecreasing",
"(",
"n",
"int",
")",
"*",
"SortFilter",
"{",
"return",
"s",
".",
"<mask>",
"(",
"n",
")",
".",
"flipLast",
"(",
")",
"\n",
"}"
]
|
19,084 | all-19085 | [
"FirewallRule",
"retrieves",
"a",
"detailed",
"view",
"of",
"one",
"firewall",
"rule"
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"FirewallRule",
"(",
"identifier",
"string",
")",
"(",
"*",
"FirewallRule",
",",
"error",
")",
"{",
"<mask>",
":=",
"new",
"(",
"FirewallRule",
")",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"MakeApiRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"identifier",
",",
"nil",
",",
"rule",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"rule",
",",
"err",
"\n",
"}"
]
|
19,085 | all-19086 | [
"Deactivate",
"deletes",
"the",
"current",
"cluster",
"s",
"enterprise",
"token",
"and",
"puts",
"the",
"cluster",
"in",
"the",
"NONE",
"enterprise",
"state",
".",
"It",
"also",
"deletes",
"all",
"data",
"in",
"the",
"cluster",
"to",
"avoid",
"invalid",
"cluster",
"states",
".",
"This",
"call",
"only",
"makes",
"sense",
"for",
"testing"
]
| [
"func",
"(",
"a",
"*",
"apiServer",
")",
"Deactivate",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"ec",
".",
"DeactivateRequest",
")",
"(",
"resp",
"*",
"ec",
".",
"DeactivateResponse",
",",
"retErr",
"error",
")",
"{",
"a",
".",
"LogReq",
"(",
"req",
")",
"\n",
"defer",
"func",
"(",
"start",
"time",
".",
"Time",
")",
"{",
"a",
".",
"pachLogger",
".",
"Log",
"(",
"req",
",",
"resp",
",",
"retErr",
",",
"time",
".",
"Since",
"(",
"start",
")",
")",
"}",
"(",
"<mask>",
".",
"Now",
"(",
")",
")",
"\n\n",
"pachClient",
":=",
"a",
".",
"env",
".",
"GetPachClient",
"(",
"ctx",
")",
"\n",
"if",
"err",
":=",
"pachClient",
".",
"DeleteAll",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"err",
":=",
"col",
".",
"NewSTM",
"(",
"ctx",
",",
"a",
".",
"env",
".",
"GetEtcdClient",
"(",
")",
",",
"func",
"(",
"stm",
"col",
".",
"STM",
")",
"error",
"{",
"// blind delete",
"return",
"a",
".",
"enterpriseToken",
".",
"ReadWrite",
"(",
"stm",
")",
".",
"Delete",
"(",
"enterpriseTokenKey",
")",
"\n",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Wait until watcher observes the write",
"if",
"err",
":=",
"backoff",
".",
"Retry",
"(",
"func",
"(",
")",
"error",
"{",
"if",
"t",
":=",
"a",
".",
"enterpriseExpiration",
".",
"Load",
"(",
")",
".",
"(",
"time",
".",
"Time",
")",
";",
"!",
"t",
".",
"IsZero",
"(",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
",",
"backoff",
".",
"RetryEvery",
"(",
"time",
".",
"Second",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"time",
".",
"Sleep",
"(",
"time",
".",
"Second",
")",
"// give other pachd nodes time to observe the write",
"\n\n",
"return",
"&",
"ec",
".",
"DeactivateResponse",
"{",
"}",
",",
"nil",
"\n",
"}"
]
|
19,086 | all-19087 | [
"ReadUint16",
"reads",
"a",
"uint16",
"."
]
| [
"func",
"(",
"r",
"*",
"Reader",
")",
"ReadUint16",
"(",
")",
"uint16",
"{",
"if",
"r",
".",
"err",
"!=",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n\n",
"buf",
":=",
"r",
".",
"buf",
"[",
":",
"2",
"]",
"\n\n",
"var",
"readN",
"int",
"\n",
"readN",
",",
"r",
".",
"err",
"=",
"io",
".",
"ReadFull",
"(",
"r",
".",
"<mask>",
",",
"buf",
")",
"\n",
"if",
"readN",
"<",
"2",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"binary",
".",
"BigEndian",
".",
"Uint16",
"(",
"buf",
")",
"\n",
"}"
]
|
19,087 | all-19088 | [
"PendingRequests",
"returns",
"the",
"current",
"number",
"of",
"pending",
"requests",
"pipelined",
"to",
"the",
"server",
".",
"This",
"number",
"may",
"exceed",
"MaxPendingRequests",
"*",
"MaxConns",
"by",
"up",
"to",
"two",
"times",
"since",
"each",
"connection",
"to",
"the",
"server",
"may",
"keep",
"up",
"to",
"MaxPendingRequests",
"requests",
"in",
"the",
"queue",
"before",
"sending",
"them",
"to",
"the",
"server",
".",
"This",
"function",
"may",
"be",
"used",
"for",
"balancing",
"load",
"among",
"multiple",
"PipelineClient",
"instances",
"."
]
| [
"func",
"(",
"c",
"*",
"PipelineClient",
")",
"PendingRequests",
"(",
")",
"int",
"{",
"c",
".",
"connClientsLock",
".",
"Lock",
"(",
")",
"\n",
"n",
":=",
"0",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"c",
".",
"connClients",
"{",
"n",
"+=",
"cc",
".",
"PendingRequests",
"(",
")",
"\n",
"}",
"\n",
"c",
".",
"connClientsLock",
".",
"Unlock",
"(",
")",
"\n",
"return",
"n",
"\n",
"}"
]
|
19,088 | all-19089 | [
"ToBool",
"fuzzily",
"converts",
"truthy",
"values",
"."
]
| [
"func",
"ToBool",
"(",
"s",
"<mask>",
")",
"bool",
"{",
"s",
"=",
"strings",
".",
"ToLower",
"(",
"s",
")",
"\n",
"return",
"s",
"==",
"\"",
"\"",
"||",
"s",
"==",
"\"",
"\"",
"||",
"s",
"==",
"\"",
"\"",
"||",
"s",
"==",
"\"",
"\"",
"\n",
"}"
]
|
19,089 | all-19090 | [
"GetCreateFlags",
"registers",
"the",
"flags",
"this",
"driver",
"adds",
"to",
"docker",
"-",
"machine",
"create"
]
| [
"func",
"(",
"d",
"*",
"Driver",
")",
"GetCreateFlags",
"(",
")",
"[",
"]",
"mcnflag",
".",
"Flag",
"{",
"return",
"[",
"]",
"mcnflag",
".",
"Flag",
"{",
"mcnflag",
".",
"IntFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultCpus",
",",
"}",
",",
"mcnflag",
".",
"IntFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultMemory",
",",
"}",
",",
"mcnflag",
".",
"IntFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultDiskSize",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"IntFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"<mask>",
":",
"defaultSDKPort",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringSliceFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringSliceFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"}",
"\n",
"}"
]
|
19,090 | all-19091 | [
"Do",
"executes",
"CSS",
".",
"startRuleUsageTracking",
"against",
"the",
"provided",
"context",
"."
]
| [
"func",
"(",
"p",
"*",
"StartRuleUsageTrackingParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandStartRuleUsageTracking",
",",
"nil",
",",
"nil",
")",
"\n",
"}"
]
|
19,091 | all-19092 | [
"MatchBuildFileName",
"looks",
"for",
"a",
"file",
"in",
"files",
"that",
"has",
"a",
"name",
"from",
"names",
".",
"If",
"there",
"is",
"at",
"least",
"one",
"matching",
"file",
"a",
"path",
"will",
"be",
"returned",
"by",
"joining",
"dir",
"and",
"the",
"first",
"matching",
"name",
".",
"If",
"there",
"are",
"no",
"matching",
"files",
"the",
"empty",
"string",
"is",
"returned",
"."
]
| [
"func",
"MatchBuildFileName",
"(",
"dir",
"string",
",",
"names",
"[",
"]",
"string",
",",
"files",
"[",
"]",
"os",
".",
"FileInfo",
")",
"string",
"{",
"for",
"_",
",",
"<mask>",
":=",
"range",
"names",
"{",
"for",
"_",
",",
"fi",
":=",
"range",
"files",
"{",
"if",
"fi",
".",
"Name",
"(",
")",
"==",
"name",
"&&",
"!",
"fi",
".",
"IsDir",
"(",
")",
"{",
"return",
"filepath",
".",
"Join",
"(",
"dir",
",",
"name",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
]
|
19,092 | all-19093 | [
"MustData",
"retrieves",
"the",
"Data",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
]
| [
"func",
"(",
"u",
"LedgerEntryData",
")",
"MustData",
"(",
")",
"DataEntry",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetData",
"(",
")",
"\n\n",
"if",
"!",
"<mask>",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
]
|
19,093 | all-19094 | [
"GetOperations",
"returns",
"a",
"list",
"of",
"Operation",
"struct"
]
| [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetOperations",
"(",
")",
"(",
"[",
"]",
"api",
".",
"Operation",
",",
"error",
")",
"{",
"apiOperations",
":=",
"map",
"[",
"string",
"]",
"[",
"]",
"api",
".",
"Operation",
"{",
"}",
"\n\n",
"// Fetch the raw value",
"_",
",",
"err",
":=",
"r",
".",
"queryStruct",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"\"",
"\"",
",",
"&",
"apiOperations",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Turn it into just a list of operations",
"operations",
":=",
"[",
"]",
"api",
".",
"Operation",
"{",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"apiOperations",
"{",
"for",
"_",
",",
"operation",
":=",
"range",
"v",
"{",
"operations",
"=",
"<mask>",
"(",
"operations",
",",
"operation",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"operations",
",",
"nil",
"\n",
"}"
]
|
19,094 | all-19095 | [
"formatFuncName",
"tries",
"to",
"extract",
"certain",
"part",
"of",
"the",
"runtime",
"formatted",
"function",
"name",
"to",
"some",
"pre",
"-",
"defined",
"variation",
".",
"This",
"function",
"is",
"known",
"to",
"not",
"work",
"properly",
"if",
"the",
"package",
"path",
"or",
"name",
"contains",
"a",
"dot",
"."
]
| [
"func",
"formatFuncName",
"(",
"v",
"fmtVerb",
",",
"f",
"string",
")",
"string",
"{",
"i",
":=",
"strings",
".",
"LastIndex",
"(",
"f",
",",
"\"",
"\"",
")",
"\n",
"j",
":=",
"strings",
".",
"Index",
"(",
"f",
"[",
"i",
"+",
"1",
":",
"]",
",",
"\"",
"\"",
")",
"\n",
"if",
"j",
"<",
"1",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"pkg",
",",
"fun",
":=",
"f",
"[",
":",
"i",
"+",
"j",
"+",
"1",
"]",
",",
"f",
"[",
"i",
"+",
"j",
"+",
"2",
":",
"]",
"\n",
"switch",
"v",
"{",
"<mask>",
"fmtVerbLongpkg",
":",
"return",
"pkg",
"\n",
"case",
"fmtVerbShortpkg",
":",
"return",
"path",
".",
"Base",
"(",
"pkg",
")",
"\n",
"case",
"fmtVerbLongfunc",
":",
"return",
"fun",
"\n",
"case",
"fmtVerbShortfunc",
":",
"i",
"=",
"strings",
".",
"LastIndex",
"(",
"fun",
",",
"\"",
"\"",
")",
"\n",
"return",
"fun",
"[",
"i",
"+",
"1",
":",
"]",
"\n",
"}",
"\n",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}"
]
|
19,095 | all-19096 | [
"setupContentHeaders",
"uses",
"Content",
"-",
"Type",
"media",
"params",
"and",
"Content",
"-",
"Disposition",
"headers",
"to",
"populate",
"the",
"disposition",
"filename",
"and",
"charset",
"fields",
"."
]
| [
"func",
"(",
"p",
"*",
"Part",
")",
"setupContentHeaders",
"(",
"mediaParams",
"map",
"[",
"string",
"]",
"string",
")",
"{",
"// Determine content disposition, filename, character set.",
"disposition",
",",
"dparams",
",",
"_",
",",
"err",
":=",
"parseMediaType",
"(",
"p",
".",
"Header",
".",
"Get",
"(",
"hnContentDisposition",
")",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"// Disposition is optional",
"p",
".",
"Disposition",
"=",
"disposition",
"\n",
"p",
".",
"FileName",
"=",
"decodeHeader",
"(",
"dparams",
"[",
"hpFilename",
"]",
")",
"\n",
"}",
"\n",
"if",
"p",
".",
"FileName",
"==",
"\"",
"\"",
"&&",
"mediaParams",
"[",
"hpName",
"]",
"!=",
"\"",
"\"",
"{",
"p",
".",
"FileName",
"=",
"decodeHeader",
"(",
"mediaParams",
"[",
"hpName",
"]",
")",
"\n",
"}",
"\n",
"if",
"p",
".",
"FileName",
"==",
"\"",
"\"",
"&&",
"mediaParams",
"[",
"hpFile",
"]",
"!=",
"\"",
"\"",
"{",
"p",
".",
"FileName",
"=",
"decodeHeader",
"(",
"mediaParams",
"[",
"hpFile",
"]",
")",
"\n",
"}",
"\n",
"if",
"p",
".",
"Charset",
"==",
"\"",
"\"",
"{",
"p",
".",
"Charset",
"=",
"mediaParams",
"[",
"hpCharset",
"]",
"\n",
"}",
"\n",
"if",
"p",
".",
"FileModDate",
".",
"IsZero",
"(",
")",
"{",
"p",
".",
"FileModDate",
",",
"_",
"=",
"time",
".",
"Parse",
"(",
"<mask>",
".",
"RFC822",
",",
"mediaParams",
"[",
"hpModDate",
"]",
")",
"\n",
"}",
"\n",
"}"
]
|
19,096 | all-19097 | [
"SetLegendWidth",
"sets",
"new",
"legend",
"panel",
"width"
]
| [
"func",
"(",
"b",
"*",
"BarChart",
")",
"SetLegendWidth",
"(",
"<mask>",
"int32",
")",
"{",
"atomic",
".",
"StoreInt32",
"(",
"&",
"b",
".",
"legendWidth",
",",
"width",
")",
"\n",
"}"
]
|
19,097 | all-19098 | [
"A",
"capacity",
"of",
"2",
"seems",
"to",
"be",
"a",
"good",
"guess",
"for",
"the",
"number",
"of",
"aliases",
"."
]
| [
"func",
"NewParameter",
"(",
"name",
"string",
",",
"value",
"reflect",
".",
"Value",
")",
"*",
"Parameter",
"{",
"parameter",
":=",
"Parameter",
"{",
"Name",
":",
"name",
",",
"<mask>",
":",
"value",
",",
"}",
"\n",
"return",
"&",
"parameter",
"\n",
"}"
]
|
19,098 | all-19099 | [
"specify",
"storage",
"for",
"a",
"two",
"-",
"dimensional",
"multisample",
"texture"
]
| [
"func",
"TextureStorage2DMultisample",
"(",
"texture",
"uint32",
",",
"samples",
"int32",
",",
"internalformat",
"uint32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"fixedsamplelocations",
"bool",
")",
"{",
"C",
".",
"glowTextureStorage2DMultisample",
"(",
"gpTextureStorage2DMultisample",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"texture",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"samples",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"internalformat",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"height",
")",
",",
"(",
"C",
".",
"GLboolean",
")",
"(",
"boolToInt",
"(",
"fixedsamplelocations",
")",
")",
")",
"\n",
"}"
]
|
19,099 | all-19100 | [
"printJsonResults",
"prints",
"json",
"-",
"formatted",
"output",
"for",
"results"
]
| [
"func",
"printJsonResults",
"(",
"results",
"Results",
")",
"error",
"{",
"data",
",",
"err",
":=",
"json",
".",
"MarshalIndent",
"(",
"results",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
".",
"<mask>",
"(",
")",
")",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"err",
"=",
"io",
".",
"Copy",
"(",
"os",
".",
"Stdout",
",",
"bytes",
".",
"NewReader",
"(",
"data",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"fmt",
".",
"Print",
"(",
"\"",
"\\n",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.