id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
7,000 | all-7001 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"Param",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoHar4",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
7,001 | all-7002 | [
"LoadWorkspaceFile",
"is",
"similar",
"to",
"LoadFile",
"but",
"parses",
"the",
"file",
"as",
"a",
"WORKSPACE",
"file",
"."
] | [
"func",
"LoadWorkspaceFile",
"(",
"path",
",",
"pkg",
"string",
")",
"(",
"*",
"File",
",",
"error",
")",
"{",
"<mask>",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"LoadWorkspaceData",
"(",
"path",
",",
"pkg",
",",
"data",
")",
"\n",
"}"
] |
7,002 | all-7003 | [
"SetDetailedAction",
"is",
"a",
"wrapper",
"around",
"g_menu_item_set_detailed_action",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"MenuItem",
")",
"SetDetailedAction",
"(",
"<mask>",
"string",
")",
"{",
"cstr1",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"act",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr1",
")",
")",
"\n\n",
"C",
".",
"g_menu_item_set_detailed_action",
"(",
"v",
".",
"native",
"(",
")",
",",
"cstr1",
")",
"\n",
"}"
] |
7,003 | all-7004 | [
"defaultEnv",
"adds",
"the",
"map",
"of",
"environment",
"variables",
"to",
"the",
"container",
"except",
"keys",
"already",
"defined",
"."
] | [
"func",
"defaultEnv",
"(",
"c",
"*",
"coreapi",
".",
"Container",
",",
"rawEnv",
"map",
"[",
"string",
"]",
"string",
")",
"{",
"<mask>",
":=",
"sets",
".",
"String",
"{",
"}",
"\n",
"for",
"_",
",",
"arg",
":=",
"range",
"c",
".",
"Env",
"{",
"keys",
".",
"Insert",
"(",
"arg",
".",
"Name",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"k",
":=",
"range",
"sets",
".",
"StringKeySet",
"(",
"rawEnv",
")",
".",
"List",
"(",
")",
"{",
"// deterministic ordering",
"if",
"keys",
".",
"Has",
"(",
"k",
")",
"{",
"continue",
"\n",
"}",
"\n",
"c",
".",
"Env",
"=",
"append",
"(",
"c",
".",
"Env",
",",
"coreapi",
".",
"EnvVar",
"{",
"Name",
":",
"k",
",",
"Value",
":",
"rawEnv",
"[",
"k",
"]",
"}",
")",
"\n",
"}",
"\n",
"}"
] |
7,004 | all-7005 | [
"expandClusterDpmConfigInfo",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"ClusterDpmConfigInfo",
"."
] | [
"func",
"expandClusterDpmConfigInfo",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"*",
"<mask>",
".",
"ClusterDpmConfigInfo",
"{",
"obj",
":=",
"&",
"types",
".",
"ClusterDpmConfigInfo",
"{",
"DefaultDpmBehavior",
":",
"types",
".",
"DpmBehavior",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
")",
",",
"Enabled",
":",
"structure",
".",
"GetBool",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"HostPowerActionRate",
":",
"int32",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
")",
",",
"}",
"\n\n",
"return",
"obj",
"\n",
"}"
] |
7,005 | all-7006 | [
"datastoreRootPathFromHostSystemID",
"returns",
"the",
"root",
"datastore",
"folder",
"path",
"for",
"a",
"specific",
"host",
"system",
"ID",
"."
] | [
"func",
"datastoreRootPathFromHostSystemID",
"(",
"client",
"*",
"govmomi",
".",
"Client",
",",
"hsID",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"hs",
",",
"err",
":=",
"hostsystem",
".",
"FromID",
"(",
"<mask>",
",",
"hsID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"RootPathParticleHost",
".",
"NewRootFromPath",
"(",
"hs",
".",
"InventoryPath",
",",
"RootPathParticleDatastore",
")",
"\n",
"}"
] |
7,006 | all-7007 | [
"getEnv",
"returns",
"the",
"environment",
"variable",
"if",
"it",
"s",
"declared",
"in",
"the",
"app",
".",
"It",
"will",
"return",
"an",
"error",
"if",
"the",
"variable",
"is",
"not",
"defined",
"in",
"this",
"app",
"."
] | [
"func",
"(",
"app",
"*",
"App",
")",
"getEnv",
"(",
"name",
"string",
")",
"(",
"bind",
".",
"EnvVar",
",",
"error",
")",
"{",
"if",
"env",
",",
"ok",
":=",
"app",
".",
"Env",
"[",
"name",
"]",
";",
"ok",
"{",
"return",
"env",
",",
"nil",
"\n",
"}",
"\n",
"return",
"bind",
".",
"EnvVar",
"{",
"}",
",",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
7,007 | all-7008 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"Type",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"<mask>",
".",
"String",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
] |
7,008 | all-7009 | [
"Encoder",
"returns",
"the",
"encoding",
"between",
"font",
"code",
"point",
"sequences",
"and",
"UTF",
"-",
"8",
"."
] | [
"func",
"(",
"f",
"Font",
")",
"Encoder",
"(",
")",
"TextEncoding",
"{",
"enc",
":=",
"f",
".",
"V",
".",
"Key",
"(",
"\"",
"\"",
")",
"\n",
"switch",
"enc",
".",
"Kind",
"(",
")",
"{",
"case",
"Name",
":",
"switch",
"enc",
".",
"Name",
"(",
")",
"{",
"case",
"\"",
"\"",
":",
"return",
"&",
"byteEncoder",
"{",
"&",
"winAnsiEncoding",
"}",
"\n",
"case",
"\"",
"\"",
":",
"return",
"&",
"byteEncoder",
"{",
"&",
"macRomanEncoding",
"}",
"\n",
"case",
"\"",
"\"",
":",
"// TODO: Should be big-endian UCS-2 decoder",
"return",
"&",
"nopEncoder",
"{",
"}",
"\n",
"default",
":",
"println",
"(",
"\"",
"\"",
",",
"enc",
".",
"Name",
"(",
")",
")",
"\n",
"return",
"&",
"nopEncoder",
"{",
"}",
"\n",
"}",
"\n",
"case",
"Dict",
":",
"return",
"&",
"dictEncoder",
"{",
"enc",
".",
"Key",
"(",
"\"",
"\"",
")",
"}",
"\n",
"case",
"Null",
":",
"// ok, try ToUnicode",
"default",
":",
"println",
"(",
"\"",
"\"",
",",
"enc",
".",
"<mask>",
"(",
")",
")",
"\n",
"return",
"&",
"nopEncoder",
"{",
"}",
"\n",
"}",
"\n\n",
"toUnicode",
":=",
"f",
".",
"V",
".",
"Key",
"(",
"\"",
"\"",
")",
"\n",
"if",
"toUnicode",
".",
"Kind",
"(",
")",
"==",
"Dict",
"{",
"m",
":=",
"readCmap",
"(",
"toUnicode",
")",
"\n",
"if",
"m",
"==",
"nil",
"{",
"return",
"&",
"nopEncoder",
"{",
"}",
"\n",
"}",
"\n",
"return",
"m",
"\n",
"}",
"\n\n",
"return",
"&",
"byteEncoder",
"{",
"&",
"pdfDocEncoding",
"}",
"\n",
"}"
] |
7,009 | all-7010 | [
"multiply",
"the",
"current",
"matrix",
"by",
"a",
"perspective",
"matrix"
] | [
"func",
"Frustum",
"(",
"left",
"float64",
",",
"right",
"float64",
",",
"bottom",
"float64",
",",
"<mask>",
"float64",
",",
"zNear",
"float64",
",",
"zFar",
"float64",
")",
"{",
"C",
".",
"glowFrustum",
"(",
"gpFrustum",
",",
"(",
"C",
".",
"GLdouble",
")",
"(",
"left",
")",
",",
"(",
"C",
".",
"GLdouble",
")",
"(",
"right",
")",
",",
"(",
"C",
".",
"GLdouble",
")",
"(",
"bottom",
")",
",",
"(",
"C",
".",
"GLdouble",
")",
"(",
"top",
")",
",",
"(",
"C",
".",
"GLdouble",
")",
"(",
"zNear",
")",
",",
"(",
"C",
".",
"GLdouble",
")",
"(",
"zFar",
")",
")",
"\n",
"}"
] |
7,010 | all-7011 | [
"Restart",
"restarts",
"a",
"machine",
"which",
"is",
"known",
"to",
"be",
"running",
"."
] | [
"func",
"(",
"d",
"*",
"Driver",
")",
"Restart",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"d",
".",
"Stop",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"d",
".",
"Start",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"d",
".",
"IPAddress",
"=",
"\"",
"\"",
"\n\n",
"<mask>",
"d",
".",
"ipWaiter",
".",
"Wait",
"(",
"d",
")",
"\n",
"}"
] |
7,011 | all-7012 | [
"SetFromFile",
"is",
"a",
"wrapper",
"around",
"gtk_status_icon_set_from_file",
"()"
] | [
"func",
"(",
"v",
"*",
"StatusIcon",
")",
"SetFromFile",
"(",
"<mask>",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"filename",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_status_icon_set_from_file",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
7,012 | all-7013 | [
"Calculates",
"the",
"per",
"-",
"element",
"sum",
"of",
"an",
"array",
"and",
"a",
"scalar",
".",
"dst",
"=",
"src",
"+",
"value"
] | [
"func",
"AddScalar",
"(",
"src",
"*",
"IplImage",
",",
"value",
"Scalar",
",",
"dst",
"*",
"IplImage",
")",
"{",
"AddScalarWithMask",
"(",
"src",
",",
"<mask>",
",",
"dst",
",",
"nil",
")",
"\n",
"}"
] |
7,013 | all-7014 | [
"Rotate",
"rotates",
"the",
"matrix",
"by",
"theta",
".",
"The",
"unit",
"is",
"radian",
"."
] | [
"func",
"(",
"g",
"*",
"GeoM",
")",
"Rotate",
"(",
"theta",
"float64",
")",
"{",
"if",
"theta",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n\n",
"sin64",
",",
"cos64",
":=",
"math",
".",
"Sincos",
"(",
"theta",
")",
"\n",
"sin",
",",
"cos",
":=",
"float32",
"(",
"sin64",
")",
",",
"float32",
"(",
"cos64",
")",
"\n\n",
"a",
":=",
"cos",
"*",
"(",
"g",
".",
"a_1",
"+",
"1",
")",
"-",
"<mask>",
"*",
"g",
".",
"c",
"\n",
"b",
":=",
"cos",
"*",
"g",
".",
"b",
"-",
"sin",
"*",
"(",
"g",
".",
"d_1",
"+",
"1",
")",
"\n",
"tx",
":=",
"cos",
"*",
"g",
".",
"tx",
"-",
"sin",
"*",
"g",
".",
"ty",
"\n",
"c",
":=",
"sin",
"*",
"(",
"g",
".",
"a_1",
"+",
"1",
")",
"+",
"cos",
"*",
"g",
".",
"c",
"\n",
"d",
":=",
"sin",
"*",
"g",
".",
"b",
"+",
"cos",
"*",
"(",
"g",
".",
"d_1",
"+",
"1",
")",
"\n",
"ty",
":=",
"sin",
"*",
"g",
".",
"tx",
"+",
"cos",
"*",
"g",
".",
"ty",
"\n\n",
"g",
".",
"a_1",
"=",
"a",
"-",
"1",
"\n",
"g",
".",
"b",
"=",
"b",
"\n",
"g",
".",
"c",
"=",
"c",
"\n",
"g",
".",
"d_1",
"=",
"d",
"-",
"1",
"\n",
"g",
".",
"tx",
"=",
"tx",
"\n",
"g",
".",
"ty",
"=",
"ty",
"\n",
"}"
] |
7,014 | all-7015 | [
"returns",
"a",
"subset",
"of",
"a",
"buffer",
"object",
"s",
"data",
"store"
] | [
"func",
"GetBufferSubData",
"(",
"target",
"uint32",
",",
"offset",
"int",
",",
"size",
"int",
",",
"data",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowGetBufferSubData",
"(",
"gpGetBufferSubData",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLintptr",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLsizeiptr",
")",
"(",
"size",
")",
",",
"data",
")",
"\n",
"}"
] |
7,015 | all-7016 | [
"Draw",
"Hello",
"World"
] | [
"func",
"Draw",
"(",
"gc",
"draw2d",
".",
"GraphicContext",
",",
"text",
"string",
")",
"{",
"// Draw a rounded rectangle using default colors",
"draw2dkit",
".",
"RoundedRectangle",
"(",
"gc",
",",
"5",
",",
"5",
",",
"135",
",",
"95",
",",
"10",
",",
"10",
")",
"\n",
"gc",
".",
"FillStroke",
"(",
")",
"\n\n",
"// Set the font luximbi.ttf",
"gc",
".",
"SetFontData",
"(",
"draw2d",
".",
"FontData",
"{",
"<mask>",
":",
"\"",
"\"",
",",
"Family",
":",
"draw2d",
".",
"FontFamilyMono",
",",
"Style",
":",
"draw2d",
".",
"FontStyleBold",
"|",
"draw2d",
".",
"FontStyleItalic",
"}",
")",
"\n",
"// Set the fill text color to black",
"gc",
".",
"SetFillColor",
"(",
"image",
".",
"Black",
")",
"\n",
"gc",
".",
"SetFontSize",
"(",
"14",
")",
"\n",
"// Display Hello World",
"gc",
".",
"FillStringAt",
"(",
"\"",
"\"",
",",
"8",
",",
"52",
")",
"\n",
"}"
] |
7,016 | all-7017 | [
"updateAppliedStatusUnsafe",
"updates",
"the",
"container",
"transitioning",
"status"
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"updateAppliedStatusUnsafe",
"(",
"knownStatus",
"apicontainerstatus",
".",
"ContainerStatus",
")",
"{",
"if",
"c",
".",
"AppliedStatus",
"==",
"apicontainerstatus",
".",
"ContainerStatusNone",
"{",
"return",
"\n",
"}",
"\n\n",
"// Check if the container transition has already finished",
"if",
"c",
".",
"AppliedStatus",
"<=",
"knownStatus",
"{",
"c",
".",
"AppliedStatus",
"=",
"apicontainerstatus",
".",
"ContainerStatusNone",
"\n",
"}",
"\n",
"}"
] |
7,017 | all-7018 | [
"GetMethodOk",
"returns",
"a",
"tuple",
"with",
"the",
"Method",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsRequest",
")",
"GetMethodOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Method",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Method",
",",
"true",
"\n",
"}"
] |
7,018 | all-7019 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SetScriptSourceParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger6",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
7,019 | all-7020 | [
"Getuint",
"returns",
"the",
"unsigned",
"integer",
"value",
"for",
"a",
"given",
"key",
"."
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"Getuint",
"(",
"key",
"string",
")",
"(",
"uint",
",",
"error",
")",
"{",
"if",
"value",
",",
"found",
":=",
"c",
".",
"data",
"[",
"<mask>",
"]",
";",
"found",
"{",
"v",
",",
"err",
":=",
"strconv",
".",
"ParseUint",
"(",
"value",
",",
"10",
",",
"0",
")",
"\n",
"return",
"uint",
"(",
"v",
")",
",",
"err",
"\n",
"}",
"\n",
"return",
"0",
",",
"ErrKey",
"\n",
"}"
] |
7,020 | all-7021 | [
"StartSession",
"initaillizes",
"a",
"session",
"context",
".",
"This",
"function",
"should",
"be",
"called",
"in",
"a",
"implementation",
"of",
"possum",
".",
"HandleFunc",
"."
] | [
"func",
"(",
"ctx",
"*",
"Context",
")",
"StartSession",
"(",
"f",
"session",
".",
"FactoryFunc",
")",
"(",
"err",
"error",
")",
"{",
"ctx",
".",
"<mask>",
",",
"err",
"=",
"f",
"(",
"ctx",
".",
"Response",
",",
"ctx",
".",
"Request",
")",
"\n",
"return",
"\n",
"}"
] |
7,021 | all-7022 | [
"NewClient",
"creates",
"a",
"Boskos",
"client",
"for",
"the",
"specified",
"URL",
"and",
"resource",
"owner",
".",
"Clients",
"created",
"with",
"this",
"function",
"default",
"to",
"retrying",
"failed",
"connection",
"attempts",
"three",
"times",
"with",
"a",
"ten",
"second",
"pause",
"between",
"each",
"attempt",
"."
] | [
"func",
"NewClient",
"(",
"owner",
"string",
",",
"url",
"string",
")",
"*",
"Client",
"{",
"client",
":=",
"&",
"Client",
"{",
"url",
":",
"url",
",",
"owner",
":",
"owner",
",",
"<mask>",
":",
"storage",
".",
"NewMemoryStorage",
"(",
")",
",",
"}",
"\n\n",
"// Configure the dialer to attempt three additional times to establish",
"// a connection after a failed dial attempt. The dialer should wait 10",
"// seconds between each attempt.",
"client",
".",
"Dialer",
".",
"RetryCount",
"=",
"3",
"\n",
"client",
".",
"Dialer",
".",
"RetrySleep",
"=",
"time",
".",
"Second",
"*",
"10",
"\n\n",
"// Configure the dialer and HTTP client transport to mimic the configuration",
"// of the http.DefaultTransport with the exception that the Dialer's Dial",
"// and DialContext functions are assigned to the client transport.",
"//",
"// See https://golang.org/pkg/net/http/#RoundTripper for the values",
"// values used for the http.DefaultTransport.",
"client",
".",
"Dialer",
".",
"Timeout",
"=",
"30",
"*",
"time",
".",
"Second",
"\n",
"client",
".",
"Dialer",
".",
"KeepAlive",
"=",
"30",
"*",
"time",
".",
"Second",
"\n",
"client",
".",
"Dialer",
".",
"DualStack",
"=",
"true",
"\n",
"client",
".",
"http",
".",
"Transport",
"=",
"&",
"http",
".",
"Transport",
"{",
"Proxy",
":",
"http",
".",
"ProxyFromEnvironment",
",",
"Dial",
":",
"client",
".",
"Dialer",
".",
"Dial",
",",
"DialContext",
":",
"client",
".",
"Dialer",
".",
"DialContext",
",",
"MaxIdleConns",
":",
"100",
",",
"IdleConnTimeout",
":",
"90",
"*",
"time",
".",
"Second",
",",
"TLSHandshakeTimeout",
":",
"10",
"*",
"time",
".",
"Second",
",",
"ExpectContinueTimeout",
":",
"1",
"*",
"time",
".",
"Second",
",",
"}",
"\n\n",
"return",
"client",
"\n",
"}"
] |
7,022 | all-7023 | [
"PrettyPrintVersionNoAdditional",
"returns",
"a",
"version",
"string",
"without",
"version",
".",
"Additional",
"."
] | [
"func",
"PrettyPrintVersionNoAdditional",
"(",
"version",
"*",
"pb",
".",
"Version",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"Major",
",",
"version",
".",
"Minor",
",",
"version",
".",
"Micro",
")",
"\n",
"}"
] |
7,023 | all-7024 | [
"------------------------------------------------------------",
"Mutator",
"implementations",
"------------------------------------------------------------",
"MutateTransactionEnvelope",
"adds",
"a",
"signature",
"to",
"the",
"provided",
"envelope"
] | [
"func",
"(",
"m",
"Sign",
")",
"MutateTransactionEnvelope",
"(",
"txe",
"*",
"TransactionEnvelopeBuilder",
")",
"error",
"{",
"hash",
",",
"err",
":=",
"txe",
".",
"<mask>",
".",
"Hash",
"(",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"kp",
",",
"err",
":=",
"keypair",
".",
"Parse",
"(",
"m",
".",
"Seed",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"sig",
",",
"err",
":=",
"kp",
".",
"SignDecorated",
"(",
"hash",
"[",
":",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"txe",
".",
"E",
".",
"Signatures",
"=",
"append",
"(",
"txe",
".",
"E",
".",
"Signatures",
",",
"sig",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,024 | all-7025 | [
"GetContainerResponse",
"gets",
"container",
"response",
"for",
"v3",
"metadata"
] | [
"func",
"GetContainerResponse",
"(",
"containerID",
"string",
",",
"state",
"dockerstate",
".",
"TaskEngineState",
")",
"(",
"*",
"v2",
".",
"ContainerResponse",
",",
"error",
")",
"{",
"containerResponse",
",",
"err",
":=",
"v2",
".",
"NewContainerResponse",
"(",
"containerID",
",",
"state",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"containerID",
")",
"\n",
"}",
"\n",
"// fill in network details if not set",
"if",
"containerResponse",
".",
"Networks",
"==",
"nil",
"{",
"if",
"containerResponse",
".",
"Networks",
",",
"err",
"=",
"GetContainerNetworkMetadata",
"(",
"containerID",
",",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"containerResponse",
",",
"nil",
"\n",
"}"
] |
7,025 | all-7026 | [
"Returns",
"information",
"about",
"an",
"active",
"attribute",
"variable",
"for",
"the",
"specified",
"program",
"object"
] | [
"func",
"GetActiveAttrib",
"(",
"program",
"uint32",
",",
"<mask>",
"uint32",
",",
"bufSize",
"int32",
",",
"length",
"*",
"int32",
",",
"size",
"*",
"int32",
",",
"xtype",
"*",
"uint32",
",",
"name",
"*",
"uint8",
")",
"{",
"syscall",
".",
"Syscall9",
"(",
"gpGetActiveAttrib",
",",
"7",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"index",
")",
",",
"uintptr",
"(",
"bufSize",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"length",
")",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"size",
")",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"xtype",
")",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"name",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
7,026 | all-7027 | [
"Remove",
"deletes",
"the",
"virtual",
"machine",
"and",
"resources",
"associated",
"to",
"it",
"."
] | [
"func",
"(",
"d",
"*",
"Driver",
")",
"Remove",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"d",
".",
"checkLegacyDriver",
"(",
"false",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// NOTE(ahmetalpbalkan):",
"// - remove attempts are best effort and if a resource is already gone, we",
"// continue removing other resources instead of failing.",
"// - we can probably do a lot of parallelization here but a sequential",
"// logic works fine too. If we were to detach the NIC from the VM and",
"// then delete the VM, this could enable some parallelization.",
"<mask>",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"c",
",",
"err",
":=",
"d",
".",
"newAzureClient",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"c",
".",
"DeleteVirtualMachineIfExists",
"(",
"d",
".",
"ResourceGroup",
",",
"d",
".",
"naming",
"(",
")",
".",
"VM",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"c",
".",
"DeleteNetworkInterfaceIfExists",
"(",
"d",
".",
"ResourceGroup",
",",
"d",
".",
"naming",
"(",
")",
".",
"NIC",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"c",
".",
"DeletePublicIPAddressIfExists",
"(",
"d",
".",
"ResourceGroup",
",",
"d",
".",
"naming",
"(",
")",
".",
"IP",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"c",
".",
"DeleteNetworkSecurityGroupIfExists",
"(",
"d",
".",
"ResourceGroup",
",",
"d",
".",
"naming",
"(",
")",
".",
"NSG",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"c",
".",
"CleanupAvailabilitySetIfExists",
"(",
"d",
".",
"ResourceGroup",
",",
"d",
".",
"AvailabilitySet",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"c",
".",
"CleanupSubnetIfExists",
"(",
"d",
".",
"ResourceGroup",
",",
"d",
".",
"VirtualNetwork",
",",
"d",
".",
"SubnetName",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"err",
"=",
"c",
".",
"CleanupVirtualNetworkIfExists",
"(",
"d",
".",
"ResourceGroup",
",",
"d",
".",
"VirtualNetwork",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
7,027 | all-7028 | [
"getConn",
"is",
"used",
"to",
"get",
"a",
"connection",
"from",
"the",
"pool",
"."
] | [
"func",
"(",
"n",
"*",
"NetworkTransport",
")",
"getConn",
"(",
"target",
"ServerAddress",
")",
"(",
"*",
"netConn",
",",
"error",
")",
"{",
"// Check for a pooled conn",
"if",
"conn",
":=",
"n",
".",
"getPooledConn",
"(",
"target",
")",
";",
"conn",
"!=",
"nil",
"{",
"return",
"conn",
",",
"nil",
"\n",
"}",
"\n\n",
"// Dial a new connection",
"conn",
",",
"err",
":=",
"n",
".",
"<mask>",
".",
"Dial",
"(",
"target",
",",
"n",
".",
"timeout",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Wrap the conn",
"netConn",
":=",
"&",
"netConn",
"{",
"target",
":",
"target",
",",
"conn",
":",
"conn",
",",
"r",
":",
"bufio",
".",
"NewReader",
"(",
"conn",
")",
",",
"w",
":",
"bufio",
".",
"NewWriter",
"(",
"conn",
")",
",",
"}",
"\n\n",
"// Setup encoder/decoders",
"netConn",
".",
"dec",
"=",
"codec",
".",
"NewDecoder",
"(",
"netConn",
".",
"r",
",",
"&",
"codec",
".",
"MsgpackHandle",
"{",
"}",
")",
"\n",
"netConn",
".",
"enc",
"=",
"codec",
".",
"NewEncoder",
"(",
"netConn",
".",
"w",
",",
"&",
"codec",
".",
"MsgpackHandle",
"{",
"}",
")",
"\n\n",
"// Done",
"return",
"netConn",
",",
"nil",
"\n",
"}"
] |
7,028 | all-7029 | [
"HandleFunc",
"specifies",
"a",
"pair",
"of",
"handler",
"and",
"view",
"to",
"handle",
"the",
"request",
"witch",
"matching",
"router",
"."
] | [
"func",
"(",
"mux",
"*",
"ServerMux",
")",
"HandleFunc",
"(",
"r",
"router",
".",
"Router",
",",
"h",
"HandlerFunc",
",",
"v",
"view",
".",
"<mask>",
")",
"{",
"mux",
".",
"routers",
".",
"Add",
"(",
"r",
",",
"h",
",",
"v",
")",
"\n",
"}"
] |
7,029 | all-7030 | [
"watchCommandFunc",
"executes",
"the",
"watch",
"command",
"."
] | [
"func",
"watchCommandFunc",
"(",
"c",
"*",
"cli",
".",
"Context",
",",
"ki",
"<mask>",
".",
"KeysAPI",
")",
"{",
"if",
"len",
"(",
"c",
".",
"Args",
"(",
")",
")",
"==",
"0",
"{",
"handleError",
"(",
"c",
",",
"ExitBadArgs",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"key",
":=",
"c",
".",
"Args",
"(",
")",
"[",
"0",
"]",
"\n",
"recursive",
":=",
"c",
".",
"Bool",
"(",
"\"",
"\"",
")",
"\n",
"forever",
":=",
"c",
".",
"Bool",
"(",
"\"",
"\"",
")",
"\n",
"index",
":=",
"c",
".",
"Int",
"(",
"\"",
"\"",
")",
"\n\n",
"stop",
":=",
"false",
"\n",
"w",
":=",
"ki",
".",
"Watcher",
"(",
"key",
",",
"&",
"client",
".",
"WatcherOptions",
"{",
"AfterIndex",
":",
"uint64",
"(",
"index",
")",
",",
"Recursive",
":",
"recursive",
"}",
")",
"\n\n",
"sigch",
":=",
"make",
"(",
"chan",
"os",
".",
"Signal",
",",
"1",
")",
"\n",
"signal",
".",
"Notify",
"(",
"sigch",
",",
"os",
".",
"Interrupt",
")",
"\n\n",
"go",
"func",
"(",
")",
"{",
"<-",
"sigch",
"\n",
"os",
".",
"Exit",
"(",
"0",
")",
"\n",
"}",
"(",
")",
"\n\n",
"for",
"!",
"stop",
"{",
"resp",
",",
"err",
":=",
"w",
".",
"Next",
"(",
"context",
".",
"TODO",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"handleError",
"(",
"c",
",",
"ExitServerError",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"resp",
".",
"Node",
".",
"Dir",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"recursive",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"resp",
".",
"Action",
",",
"resp",
".",
"Node",
".",
"Key",
")",
"\n",
"}",
"\n\n",
"printResponseKey",
"(",
"resp",
",",
"c",
".",
"GlobalString",
"(",
"\"",
"\"",
")",
")",
"\n\n",
"if",
"!",
"forever",
"{",
"stop",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
7,030 | all-7031 | [
"expandCustomizationIPSettingsIPV6AddressSpec",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"CustomizationIPSettingsIpV6AddressSpec",
"."
] | [
"func",
"expandCustomizationIPSettingsIPV6AddressSpec",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"n",
"int",
",",
"gwAdd",
"bool",
")",
"(",
"*",
"types",
".",
"CustomizationIPSettingsIpV6AddressSpec",
",",
"bool",
")",
"{",
"v",
",",
"ok",
":=",
"d",
".",
"GetOk",
"(",
"netifKey",
"(",
"\"",
"\"",
",",
"n",
")",
")",
"\n",
"var",
"gwFound",
"bool",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"gwFound",
"\n",
"}",
"\n",
"addr",
":=",
"v",
".",
"(",
"string",
")",
"\n",
"mask",
":=",
"d",
".",
"Get",
"(",
"netifKey",
"(",
"\"",
"\"",
",",
"n",
")",
")",
".",
"(",
"int",
")",
"\n",
"gw",
",",
"gwOk",
":=",
"d",
".",
"Get",
"(",
"cKeyPrefix",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
")",
".",
"(",
"string",
")",
"\n",
"obj",
":=",
"&",
"types",
".",
"CustomizationIPSettingsIpV6AddressSpec",
"{",
"Ip",
":",
"[",
"]",
"types",
".",
"BaseCustomizationIpV6Generator",
"{",
"&",
"<mask>",
".",
"CustomizationFixedIpV6",
"{",
"IpAddress",
":",
"addr",
",",
"SubnetMask",
":",
"int32",
"(",
"mask",
")",
",",
"}",
",",
"}",
",",
"}",
"\n",
"if",
"gwAdd",
"&&",
"gwOk",
"&&",
"matchGateway",
"(",
"addr",
",",
"mask",
",",
"gw",
")",
"{",
"obj",
".",
"Gateway",
"=",
"[",
"]",
"string",
"{",
"gw",
"}",
"\n",
"gwFound",
"=",
"true",
"\n",
"}",
"\n",
"return",
"obj",
",",
"gwFound",
"\n",
"}"
] |
7,031 | all-7032 | [
"SetElement",
"sets",
"an",
"element",
"at",
"(",
"i",
"j",
")",
"."
] | [
"func",
"(",
"g",
"*",
"GeoM",
")",
"SetElement",
"(",
"i",
",",
"j",
"int",
",",
"element",
"float64",
")",
"{",
"e",
":=",
"float32",
"(",
"element",
")",
"\n",
"switch",
"{",
"case",
"i",
"==",
"0",
"&&",
"j",
"==",
"0",
":",
"g",
".",
"a_1",
"=",
"e",
"-",
"1",
"\n",
"case",
"i",
"==",
"0",
"&&",
"j",
"==",
"1",
":",
"g",
".",
"b",
"=",
"e",
"\n",
"case",
"i",
"==",
"0",
"&&",
"j",
"==",
"2",
":",
"g",
".",
"tx",
"=",
"e",
"\n",
"case",
"i",
"==",
"1",
"&&",
"j",
"==",
"0",
":",
"g",
".",
"c",
"=",
"e",
"\n",
"case",
"i",
"==",
"1",
"&&",
"j",
"==",
"1",
":",
"g",
".",
"d_1",
"=",
"e",
"-",
"1",
"\n",
"case",
"i",
"==",
"1",
"&&",
"j",
"==",
"2",
":",
"g",
".",
"ty",
"=",
"e",
"\n",
"<mask>",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
7,032 | all-7033 | [
"Percentile",
"returns",
"given",
"percentile",
"for",
"age",
"of",
"all",
"active",
"states",
"at",
"time",
"t"
] | [
"func",
"(",
"b",
"BundledStates",
")",
"Percentile",
"(",
"t",
"time",
".",
"Time",
",",
"percentile",
"int",
")",
"<mask>",
".",
"Duration",
"{",
"if",
"percentile",
">",
"100",
"||",
"percentile",
"<=",
"0",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"percentile",
")",
")",
"\n",
"}",
"\n\n",
"ages",
":=",
"[",
"]",
"time",
".",
"Duration",
"{",
"}",
"\n",
"for",
"_",
",",
"age",
":=",
"range",
"b",
".",
"ages",
"(",
"t",
")",
"{",
"ages",
"=",
"append",
"(",
"ages",
",",
"age",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"ages",
")",
"==",
"0",
"{",
"return",
"0",
"\n",
"}",
"\n\n",
"sort",
".",
"Sort",
"(",
"ByDuration",
"(",
"ages",
")",
")",
"\n\n",
"index",
":=",
"int",
"(",
"math",
".",
"Ceil",
"(",
"float64",
"(",
"percentile",
")",
"*",
"float64",
"(",
"len",
"(",
"ages",
")",
")",
"/",
"100",
")",
"-",
"1",
")",
"\n",
"if",
"index",
">=",
"len",
"(",
"ages",
")",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"index",
",",
"len",
"(",
"ages",
")",
")",
")",
"\n",
"}",
"\n",
"return",
"ages",
"[",
"index",
"]",
"\n",
"}"
] |
7,033 | all-7034 | [
"Prev",
"moves",
"to",
"the",
"previous",
"position",
".",
"If",
"there",
"are",
"no",
"previous",
"nodes",
"then",
"Valid",
"()",
"will",
"be",
"false",
"after",
"this",
"call",
"."
] | [
"func",
"(",
"it",
"*",
"Iterator",
")",
"Prev",
"(",
")",
"{",
"prev",
":=",
"it",
".",
"<mask>",
".",
"getPrev",
"(",
"it",
".",
"nd",
",",
"0",
")",
"\n",
"it",
".",
"setNode",
"(",
"prev",
",",
"true",
")",
"\n",
"}"
] |
7,034 | all-7035 | [
"SendTextMsg",
"发送文本消息"
] | [
"func",
"(",
"w",
"*",
"Webhook",
")",
"SendTextMsg",
"(",
"content",
"string",
",",
"isAtAll",
"bool",
",",
"mobiles",
"...",
"string",
")",
"error",
"{",
"return",
"w",
".",
"SendPayload",
"(",
"&",
"Payload",
"{",
"MsgType",
":",
"\"",
"\"",
",",
"Text",
":",
"struct",
"{",
"Content",
"string",
"`json:\"content\"`",
"\n",
"}",
"{",
"Content",
":",
"<mask>",
",",
"}",
",",
"At",
":",
"struct",
"{",
"AtMobiles",
"[",
"]",
"string",
"`json:\"atMobiles\"`",
"\n",
"IsAtAll",
"bool",
"`json:\"isAtAll\"`",
"\n",
"}",
"{",
"AtMobiles",
":",
"mobiles",
",",
"IsAtAll",
":",
"isAtAll",
",",
"}",
",",
"}",
")",
"\n",
"}"
] |
7,035 | all-7036 | [
"GetTitle",
"returns",
"the",
"Title",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"s",
"*",
"ScatterplotDefinition",
")",
"GetTitle",
"(",
")",
"<mask>",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Title",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Title",
"\n",
"}"
] |
7,036 | all-7037 | [
"Dedupe",
"log",
"lines",
"to",
"next",
"only",
"repeating",
"every",
"repeat",
"duration",
"."
] | [
"func",
"Dedupe",
"(",
"next",
"log",
".",
"Logger",
",",
"repeat",
"time",
".",
"Duration",
")",
"*",
"Deduper",
"{",
"d",
":=",
"&",
"Deduper",
"{",
"next",
":",
"next",
",",
"repeat",
":",
"repeat",
",",
"quit",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"<mask>",
":",
"map",
"[",
"string",
"]",
"time",
".",
"Time",
"{",
"}",
",",
"}",
"\n",
"go",
"d",
".",
"run",
"(",
")",
"\n",
"return",
"d",
"\n",
"}"
] |
7,037 | all-7038 | [
"PackStart",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_tree_view_column_pack_start",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TreeViewColumn",
")",
"PackStart",
"(",
"<mask>",
"ICellRenderer",
",",
"expand",
"bool",
")",
"{",
"C",
".",
"gtk_tree_view_column_pack_start",
"(",
"v",
".",
"native",
"(",
")",
",",
"cell",
".",
"toCellRenderer",
"(",
")",
",",
"gbool",
"(",
"expand",
")",
")",
"\n",
"}"
] |
7,038 | all-7039 | [
"Remember",
"accepts",
"a",
"dependency",
"and",
"the",
"data",
"to",
"store",
"associated",
"with",
"that",
"dep",
".",
"This",
"function",
"converts",
"the",
"given",
"data",
"to",
"a",
"proper",
"type",
"and",
"stores",
"it",
"interally",
"."
] | [
"func",
"(",
"b",
"*",
"Brain",
")",
"Remember",
"(",
"d",
"dep",
".",
"Dependency",
",",
"<mask>",
"interface",
"{",
"}",
")",
"{",
"b",
".",
"Lock",
"(",
")",
"\n",
"defer",
"b",
".",
"Unlock",
"(",
")",
"\n\n",
"b",
".",
"data",
"[",
"d",
".",
"String",
"(",
")",
"]",
"=",
"data",
"\n",
"b",
".",
"receivedData",
"[",
"d",
".",
"String",
"(",
")",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}"
] |
7,039 | all-7040 | [
"Read",
"method",
"for",
"io",
".",
"Reader",
"interface",
"."
] | [
"func",
"(",
"bc",
"*",
"Base64Cleaner",
")",
"Read",
"(",
"p",
"[",
"]",
"byte",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"// Size our buf to smallest of len(p) or len(bc.buffer).",
"size",
":=",
"len",
"(",
"bc",
".",
"buffer",
")",
"\n",
"if",
"size",
">",
"len",
"(",
"p",
")",
"{",
"<mask>",
"=",
"len",
"(",
"p",
")",
"\n",
"}",
"\n",
"buf",
":=",
"bc",
".",
"buffer",
"[",
":",
"size",
"]",
"\n",
"bn",
",",
"err",
":=",
"bc",
".",
"r",
".",
"Read",
"(",
"buf",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"bn",
";",
"i",
"++",
"{",
"switch",
"base64CleanerTable",
"[",
"buf",
"[",
"i",
"]",
"&",
"0x7f",
"]",
"{",
"case",
"-",
"2",
":",
"// Strip these silently: tab, \\n, \\r, space, equals sign.",
"case",
"-",
"1",
":",
"// Strip these, but warn the client.",
"bc",
".",
"Errors",
"=",
"append",
"(",
"bc",
".",
"Errors",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"buf",
"[",
"i",
"]",
")",
")",
"\n",
"default",
":",
"p",
"[",
"n",
"]",
"=",
"buf",
"[",
"i",
"]",
"\n",
"n",
"++",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
7,040 | all-7041 | [
"Unmatched",
"returns",
"all",
"the",
"ranges",
"which",
"were",
"never",
"used",
"to",
"ignore",
"an",
"issue"
] | [
"func",
"(",
"d",
"*",
"directiveParser",
")",
"Unmatched",
"(",
")",
"map",
"[",
"string",
"]",
"ignoredRanges",
"{",
"unmatched",
":=",
"map",
"[",
"string",
"]",
"ignoredRanges",
"{",
"}",
"\n",
"for",
"path",
",",
"ranges",
":=",
"range",
"d",
".",
"files",
"{",
"for",
"_",
",",
"ignore",
":=",
"range",
"ranges",
"{",
"if",
"!",
"ignore",
".",
"matched",
"{",
"unmatched",
"[",
"<mask>",
"]",
"=",
"append",
"(",
"unmatched",
"[",
"path",
"]",
",",
"ignore",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"unmatched",
"\n",
"}"
] |
7,041 | all-7042 | [
"print",
"log"
] | [
"func",
"(",
"f",
"*",
"FileLogger",
")",
"p",
"(",
"str",
"string",
")",
"{",
"f",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"f",
".",
"mu",
".",
"RUnlock",
"(",
")",
"\n\n",
"f",
".",
"lg",
".",
"Output",
"(",
"2",
",",
"str",
")",
"\n",
"f",
".",
"<mask>",
"(",
"str",
")",
"\n",
"}"
] |
7,042 | all-7043 | [
"InputChars",
"return",
"printable",
"runes",
"read",
"from",
"the",
"keyboard",
"at",
"the",
"time",
"update",
"is",
"called",
".",
"InputChars",
"represents",
"the",
"environment",
"s",
"locale",
"-",
"dependent",
"translation",
"of",
"keyboard",
"input",
"to",
"Unicode",
"characters",
".",
"IsKeyPressed",
"is",
"based",
"on",
"a",
"mapping",
"of",
"device",
"(",
"US",
"keyboard",
")",
"codes",
"to",
"input",
"device",
"keys",
".",
"Control",
"and",
"modifier",
"keys",
"should",
"be",
"handled",
"with",
"IsKeyPressed",
".",
"InputChars",
"is",
"concurrent",
"-",
"safe",
"."
] | [
"func",
"InputChars",
"(",
")",
"[",
"]",
"rune",
"{",
"rb",
":=",
"uiDriver",
"(",
")",
".",
"Input",
"(",
")",
".",
"RuneBuffer",
"(",
")",
"\n",
"return",
"<mask>",
"(",
"make",
"(",
"[",
"]",
"rune",
",",
"0",
",",
"len",
"(",
"rb",
")",
")",
",",
"rb",
"...",
")",
"\n",
"}"
] |
7,043 | all-7044 | [
"render",
"primitives",
"using",
"a",
"count",
"derived",
"from",
"a",
"transform",
"feedback",
"object"
] | [
"func",
"DrawTransformFeedback",
"(",
"mode",
"uint32",
",",
"<mask>",
"uint32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpDrawTransformFeedback",
",",
"2",
",",
"uintptr",
"(",
"mode",
")",
",",
"uintptr",
"(",
"id",
")",
",",
"0",
")",
"\n",
"}"
] |
7,044 | all-7045 | [
"CreateOrderFromButtonCode",
"creates",
"an",
"order",
"for",
"a",
"given",
"button",
"code"
] | [
"func",
"(",
"c",
"Client",
")",
"CreateOrderFromButtonCode",
"(",
"buttonCode",
"string",
")",
"(",
"*",
"<mask>",
",",
"error",
")",
"{",
"holder",
":=",
"orderHolder",
"{",
"}",
"\n",
"if",
"err",
":=",
"c",
".",
"Post",
"(",
"\"",
"\"",
"+",
"buttonCode",
"+",
"\"",
"\"",
",",
"nil",
",",
"&",
"holder",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"checkApiErrors",
"(",
"holder",
".",
"response",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"holder",
".",
"Order",
",",
"nil",
"\n",
"}"
] |
7,045 | all-7046 | [
"sanityCheck",
"performs",
"integrity",
"checking",
"of",
"the",
"SSA",
"representation",
"of",
"the",
"function",
"fn",
"and",
"returns",
"true",
"if",
"it",
"was",
"valid",
".",
"Diagnostics",
"are",
"written",
"to",
"reporter",
"if",
"non",
"-",
"nil",
"os",
".",
"Stderr",
"otherwise",
".",
"Some",
"diagnostics",
"are",
"only",
"warnings",
"and",
"do",
"not",
"imply",
"a",
"negative",
"result",
".",
"Sanity",
"-",
"checking",
"is",
"intended",
"to",
"facilitate",
"the",
"debugging",
"of",
"code",
"transformation",
"passes",
"."
] | [
"func",
"sanityCheck",
"(",
"fn",
"*",
"Function",
",",
"reporter",
"<mask>",
".",
"Writer",
")",
"bool",
"{",
"if",
"reporter",
"==",
"nil",
"{",
"reporter",
"=",
"os",
".",
"Stderr",
"\n",
"}",
"\n",
"return",
"(",
"&",
"sanity",
"{",
"reporter",
":",
"reporter",
"}",
")",
".",
"checkFunction",
"(",
"fn",
")",
"\n",
"}"
] |
7,046 | all-7047 | [
"Runs",
"a",
"cascaded",
"save",
"operation",
"with",
"one",
"configuration"
] | [
"func",
"cascadeSaveWithConfig",
"(",
"conf",
"*",
"CascadeConfig",
",",
"doc",
"Document",
")",
"(",
"*",
"mgo",
".",
"ChangeInfo",
",",
"error",
")",
"{",
"// Create a new map with just the props to cascade",
"<mask>",
":=",
"conf",
".",
"Data",
"\n\n",
"switch",
"conf",
".",
"RelType",
"{",
"case",
"REL_ONE",
":",
"if",
"len",
"(",
"conf",
".",
"OldQuery",
")",
">",
"0",
"{",
"update1",
":=",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
",",
"}",
"\n\n",
"if",
"len",
"(",
"conf",
".",
"ThroughProp",
")",
">",
"0",
"{",
"update1",
"[",
"\"",
"\"",
"]",
"[",
"conf",
".",
"ThroughProp",
"]",
"=",
"nil",
"\n",
"}",
"else",
"{",
"for",
"_",
",",
"p",
":=",
"range",
"conf",
".",
"Properties",
"{",
"update1",
"[",
"\"",
"\"",
"]",
"[",
"p",
"]",
"=",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"ret",
",",
"err",
":=",
"conf",
".",
"Collection",
".",
"Collection",
"(",
")",
".",
"UpdateAll",
"(",
"conf",
".",
"OldQuery",
",",
"update1",
")",
"\n\n",
"if",
"conf",
".",
"RemoveOnly",
"{",
"return",
"ret",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"update",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n\n",
"if",
"len",
"(",
"conf",
".",
"ThroughProp",
")",
">",
"0",
"{",
"m",
":=",
"bson",
".",
"M",
"{",
"}",
"\n",
"m",
"[",
"conf",
".",
"ThroughProp",
"]",
"=",
"data",
"\n",
"update",
"[",
"\"",
"\"",
"]",
"=",
"m",
"\n",
"}",
"else",
"{",
"update",
"[",
"\"",
"\"",
"]",
"=",
"data",
"\n",
"}",
"\n\n",
"// Just update",
"return",
"conf",
".",
"Collection",
".",
"Collection",
"(",
")",
".",
"UpdateAll",
"(",
"conf",
".",
"Query",
",",
"update",
")",
"\n",
"case",
"REL_MANY",
":",
"update1",
":=",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
",",
"}",
"\n\n",
"q",
":=",
"bson",
".",
"M",
"{",
"}",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"conf",
".",
"ReferenceQuery",
"{",
"q",
"[",
"f",
".",
"BsonName",
"]",
"=",
"f",
".",
"Value",
"\n",
"}",
"\n",
"update1",
"[",
"\"",
"\"",
"]",
"[",
"conf",
".",
"ThroughProp",
"]",
"=",
"q",
"\n\n",
"if",
"len",
"(",
"conf",
".",
"OldQuery",
")",
">",
"0",
"{",
"ret",
",",
"err",
":=",
"conf",
".",
"Collection",
".",
"Collection",
"(",
")",
".",
"UpdateAll",
"(",
"conf",
".",
"OldQuery",
",",
"update1",
")",
"\n",
"if",
"conf",
".",
"RemoveOnly",
"{",
"return",
"ret",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Remove self from current relations, so we can replace it",
"conf",
".",
"Collection",
".",
"Collection",
"(",
")",
".",
"UpdateAll",
"(",
"conf",
".",
"Query",
",",
"update1",
")",
"\n\n",
"update2",
":=",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
",",
"}",
"\n\n",
"update2",
"[",
"\"",
"\"",
"]",
"[",
"conf",
".",
"ThroughProp",
"]",
"=",
"data",
"\n",
"return",
"conf",
".",
"Collection",
".",
"Collection",
"(",
")",
".",
"UpdateAll",
"(",
"conf",
".",
"Query",
",",
"update2",
")",
"\n\n",
"}",
"\n\n",
"return",
"&",
"mgo",
".",
"ChangeInfo",
"{",
"}",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n\n",
"}"
] |
7,047 | all-7048 | [
"TODO",
":",
"support",
"separate",
"WAL",
"directory"
] | [
"func",
"archive",
"(",
"baseDir",
",",
"etcdLogPath",
",",
"dataDir",
"string",
")",
"error",
"{",
"dir",
":=",
"filepath",
".",
"Join",
"(",
"baseDir",
",",
"\"",
"\"",
",",
"<mask>",
".",
"Now",
"(",
")",
".",
"Format",
"(",
"time",
".",
"RFC3339",
")",
")",
"\n",
"if",
"existDir",
"(",
"dir",
")",
"{",
"dir",
"=",
"filepath",
".",
"Join",
"(",
"baseDir",
",",
"\"",
"\"",
",",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"time",
".",
"Second",
")",
".",
"Format",
"(",
"time",
".",
"RFC3339",
")",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"fileutil",
".",
"TouchDirAll",
"(",
"dir",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"os",
".",
"Rename",
"(",
"etcdLogPath",
",",
"filepath",
".",
"Join",
"(",
"dir",
",",
"\"",
"\"",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"!",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"err",
":=",
"os",
".",
"Rename",
"(",
"dataDir",
",",
"filepath",
".",
"Join",
"(",
"dir",
",",
"filepath",
".",
"Base",
"(",
"dataDir",
")",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"!",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
7,048 | all-7049 | [
"VerifyDockerManifestSignature",
"checks",
"that",
"unverifiedSignature",
"uses",
"expectedKeyIdentity",
"to",
"sign",
"unverifiedManifest",
"as",
"expectedDockerReference",
"using",
"mech",
"."
] | [
"func",
"VerifyDockerManifestSignature",
"(",
"unverifiedSignature",
",",
"unverifiedManifest",
"[",
"]",
"byte",
",",
"expectedDockerReference",
"string",
",",
"mech",
"SigningMechanism",
",",
"expectedKeyIdentity",
"string",
")",
"(",
"*",
"Signature",
",",
"error",
")",
"{",
"expectedRef",
",",
"err",
":=",
"reference",
".",
"ParseNormalizedNamed",
"(",
"expectedDockerReference",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"sig",
",",
"err",
":=",
"verifyAndExtractSignature",
"(",
"mech",
",",
"unverifiedSignature",
",",
"signatureAcceptanceRules",
"{",
"validateKeyIdentity",
":",
"func",
"(",
"keyIdentity",
"string",
")",
"error",
"{",
"if",
"keyIdentity",
"!=",
"expectedKeyIdentity",
"{",
"return",
"InvalidSignatureError",
"{",
"<mask>",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"keyIdentity",
",",
"expectedKeyIdentity",
")",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
",",
"validateSignedDockerReference",
":",
"func",
"(",
"signedDockerReference",
"string",
")",
"error",
"{",
"signedRef",
",",
"err",
":=",
"reference",
".",
"ParseNormalizedNamed",
"(",
"signedDockerReference",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"InvalidSignatureError",
"{",
"msg",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"signedDockerReference",
")",
"}",
"\n",
"}",
"\n",
"if",
"signedRef",
".",
"String",
"(",
")",
"!=",
"expectedRef",
".",
"String",
"(",
")",
"{",
"return",
"InvalidSignatureError",
"{",
"msg",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"signedDockerReference",
",",
"expectedDockerReference",
")",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
",",
"validateSignedDockerManifestDigest",
":",
"func",
"(",
"signedDockerManifestDigest",
"digest",
".",
"Digest",
")",
"error",
"{",
"matches",
",",
"err",
":=",
"manifest",
".",
"MatchesDigest",
"(",
"unverifiedManifest",
",",
"signedDockerManifestDigest",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"!",
"matches",
"{",
"return",
"InvalidSignatureError",
"{",
"msg",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"signedDockerManifestDigest",
")",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"sig",
",",
"nil",
"\n",
"}"
] |
7,049 | all-7050 | [
"Exec",
"sends",
"the",
"request",
"a",
"request",
"and",
"decodes",
"the",
"response",
"."
] | [
"func",
"(",
"r",
"*",
"RequestBuilder",
")",
"Exec",
"(",
"ctx",
"context",
".",
"Context",
",",
"res",
"interface",
"{",
"}",
")",
"error",
"{",
"httpRes",
",",
"err",
":=",
"r",
".",
"Send",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"res",
"==",
"nil",
"{",
"lateErr",
":=",
"httpRes",
".",
"Close",
"(",
")",
"\n",
"if",
"httpRes",
".",
"Error",
"!=",
"nil",
"{",
"return",
"httpRes",
".",
"<mask>",
"\n",
"}",
"\n",
"return",
"lateErr",
"\n",
"}",
"\n\n",
"return",
"httpRes",
".",
"Decode",
"(",
"res",
")",
"\n",
"}"
] |
7,050 | all-7051 | [
"QueryContext",
"implements",
"the",
"database",
"/",
"sql",
"/",
"driver",
"/",
"QueryerContext",
"interface",
"."
] | [
"func",
"(",
"c",
"*",
"conn",
")",
"QueryContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"query",
"string",
",",
"args",
"[",
"]",
"driver",
".",
"NamedValue",
")",
"(",
"rows",
"driver",
".",
"Rows",
",",
"err",
"error",
")",
"{",
"if",
"c",
".",
"session",
".",
"IsBad",
"(",
")",
"{",
"return",
"nil",
",",
"driver",
".",
"ErrBadConn",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"args",
")",
"!=",
"0",
"{",
"return",
"nil",
",",
"driver",
".",
"ErrSkip",
"//fast path not possible (prepare needed)",
"\n",
"}",
"\n\n",
"// direct execution of call procedure",
"// - returns no parameter metadata (sps 82) but only field values",
"// --> let's take the 'prepare way' for stored procedures",
"if",
"checkCallProcedure",
"(",
"query",
")",
"{",
"return",
"nil",
",",
"driver",
".",
"ErrSkip",
"\n",
"}",
"\n\n",
"sqltrace",
".",
"Traceln",
"(",
"query",
")",
"\n\n",
"id",
",",
"idx",
",",
"ok",
":=",
"decodeTableQuery",
"(",
"query",
")",
"\n",
"if",
"ok",
"{",
"r",
":=",
"procedureCallResultStore",
".",
"<mask>",
"(",
"id",
")",
"\n",
"if",
"r",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"query",
")",
"\n",
"}",
"\n",
"return",
"r",
".",
"tableRows",
"(",
"int",
"(",
"idx",
")",
")",
"\n",
"}",
"\n\n",
"done",
":=",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"var",
"(",
"id",
"uint64",
"\n",
"resultFieldSet",
"*",
"p",
".",
"ResultFieldSet",
"\n",
"fieldValues",
"*",
"p",
".",
"FieldValues",
"\n",
"attributes",
"p",
".",
"PartAttributes",
"\n",
")",
"\n",
"id",
",",
"resultFieldSet",
",",
"fieldValues",
",",
"attributes",
",",
"err",
"=",
"c",
".",
"session",
".",
"QueryDirect",
"(",
"query",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"goto",
"done",
"\n",
"}",
"\n",
"select",
"{",
"default",
":",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"\n",
"}",
"\n",
"if",
"id",
"==",
"0",
"{",
"// non select query",
"rows",
"=",
"noResult",
"\n",
"}",
"else",
"{",
"rows",
",",
"err",
"=",
"newQueryResult",
"(",
"c",
".",
"session",
",",
"id",
",",
"resultFieldSet",
",",
"fieldValues",
",",
"attributes",
")",
"\n",
"}",
"\n",
"done",
":",
"close",
"(",
"done",
")",
"\n",
"}",
"(",
")",
"\n\n",
"select",
"{",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"nil",
",",
"ctx",
".",
"Err",
"(",
")",
"\n",
"case",
"<-",
"done",
":",
"return",
"rows",
",",
"err",
"\n",
"}",
"\n",
"}"
] |
7,051 | all-7052 | [
"GetOrders",
"gets",
"orders",
"associated",
"with",
"an",
"account"
] | [
"func",
"(",
"c",
"<mask>",
")",
"GetOrders",
"(",
"page",
"int",
")",
"(",
"*",
"orders",
",",
"error",
")",
"{",
"holder",
":=",
"ordersHolder",
"{",
"}",
"\n",
"params",
":=",
"map",
"[",
"string",
"]",
"int",
"{",
"\"",
"\"",
":",
"page",
",",
"}",
"\n",
"if",
"err",
":=",
"c",
".",
"Get",
"(",
"\"",
"\"",
",",
"params",
",",
"&",
"holder",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"orders",
":=",
"orders",
"{",
"paginationStats",
":",
"holder",
".",
"paginationStats",
",",
"}",
"\n",
"// Remove one layer of nesting",
"for",
"_",
",",
"o",
":=",
"range",
"holder",
".",
"Orders",
"{",
"orders",
".",
"Orders",
"=",
"append",
"(",
"orders",
".",
"Orders",
",",
"o",
".",
"Order",
")",
"\n",
"}",
"\n",
"return",
"&",
"orders",
",",
"nil",
"\n",
"}"
] |
7,052 | all-7053 | [
"Tap",
"performs",
"the",
"provided",
"Tap",
"event",
"on",
"each",
"element",
"in",
"the",
"selection",
"."
] | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Tap",
"(",
"event",
"Tap",
")",
"error",
"{",
"var",
"touchFunc",
"func",
"(",
"*",
"api",
".",
"Element",
")",
"error",
"\n",
"switch",
"event",
"{",
"case",
"SingleTap",
":",
"touchFunc",
"=",
"s",
".",
"session",
".",
"TouchClick",
"\n",
"case",
"DoubleTap",
":",
"touchFunc",
"=",
"s",
".",
"session",
".",
"TouchDoubleClick",
"\n",
"case",
"LongTap",
":",
"touchFunc",
"=",
"s",
".",
"session",
".",
"TouchLongClick",
"\n",
"default",
":",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"event",
",",
"s",
")",
"\n",
"}",
"\n\n",
"return",
"s",
".",
"forEachElement",
"(",
"func",
"(",
"selectedElement",
"<mask>",
".",
"Element",
")",
"error",
"{",
"if",
"err",
":=",
"touchFunc",
"(",
"selectedElement",
".",
"(",
"*",
"api",
".",
"Element",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"event",
",",
"s",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
7,053 | all-7054 | [
"ApplyTag",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_text_buffer_apply_tag",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TextBuffer",
")",
"ApplyTag",
"(",
"tag",
"*",
"TextTag",
",",
"<mask>",
",",
"end",
"*",
"TextIter",
")",
"{",
"C",
".",
"gtk_text_buffer_apply_tag",
"(",
"v",
".",
"native",
"(",
")",
",",
"tag",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"GtkTextIter",
")",
"(",
"start",
")",
",",
"(",
"*",
"C",
".",
"GtkTextIter",
")",
"(",
"end",
")",
")",
"\n",
"}"
] |
7,054 | all-7055 | [
"specify",
"a",
"one",
"-",
"dimensional",
"texture",
"image",
"in",
"a",
"compressed",
"format"
] | [
"func",
"CompressedTexImage1D",
"(",
"target",
"uint32",
",",
"level",
"int32",
",",
"internalformat",
"uint32",
",",
"<mask>",
"int32",
",",
"border",
"int32",
",",
"imageSize",
"int32",
",",
"data",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall9",
"(",
"gpCompressedTexImage1D",
",",
"7",
",",
"uintptr",
"(",
"target",
")",
",",
"uintptr",
"(",
"level",
")",
",",
"uintptr",
"(",
"internalformat",
")",
",",
"uintptr",
"(",
"width",
")",
",",
"uintptr",
"(",
"border",
")",
",",
"uintptr",
"(",
"imageSize",
")",
",",
"uintptr",
"(",
"data",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
7,055 | all-7056 | [
"List",
"the",
"names",
"of",
"all",
"secrets",
".",
"By",
"default",
"this",
"end",
"-",
"point",
"will",
"try",
"to",
"return",
"up",
"to",
"1000",
"secret",
"names",
"in",
"one",
"request",
".",
"But",
"it",
"**",
"may",
"return",
"less",
"**",
"even",
"if",
"more",
"tasks",
"are",
"available",
".",
"It",
"may",
"also",
"return",
"a",
"continuationToken",
"even",
"though",
"there",
"are",
"no",
"more",
"results",
".",
"However",
"you",
"can",
"only",
"be",
"sure",
"to",
"have",
"seen",
"all",
"results",
"if",
"you",
"keep",
"calling",
"listTaskGroup",
"with",
"the",
"last",
"continuationToken",
"until",
"you",
"get",
"a",
"result",
"without",
"a",
"continuationToken",
".",
"If",
"you",
"are",
"not",
"interested",
"in",
"listing",
"all",
"the",
"members",
"at",
"once",
"you",
"may",
"use",
"the",
"query",
"-",
"string",
"option",
"limit",
"to",
"return",
"fewer",
".",
"See",
"#list"
] | [
"func",
"(",
"secrets",
"*",
"Secrets",
")",
"List",
"(",
"continuationToken",
",",
"limit",
"string",
")",
"(",
"*",
"SecretsList",
",",
"error",
")",
"{",
"v",
":=",
"<mask>",
".",
"Values",
"{",
"}",
"\n",
"if",
"continuationToken",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"continuationToken",
")",
"\n",
"}",
"\n",
"if",
"limit",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"limit",
")",
"\n",
"}",
"\n",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"secrets",
")",
"\n",
"responseObject",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"new",
"(",
"SecretsList",
")",
",",
"v",
")",
"\n",
"return",
"responseObject",
".",
"(",
"*",
"SecretsList",
")",
",",
"err",
"\n",
"}"
] |
7,056 | all-7057 | [
"String",
"returns",
"the",
"name",
"of",
"e"
] | [
"func",
"(",
"e",
"PaymentResultCode",
")",
"String",
"(",
")",
"string",
"{",
"name",
",",
"_",
":=",
"paymentResultCodeMap",
"[",
"int32",
"(",
"e",
")",
"]",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
7,057 | all-7058 | [
"MiddlewareList",
"list",
"creates",
"a",
"single",
"middlware",
"callback",
"from",
"an",
"array"
] | [
"func",
"MiddlewareList",
"(",
"middlware",
"[",
"]",
"Middleware",
")",
"Middleware",
"{",
"return",
"Middleware",
"(",
"func",
"(",
"next",
"Handler",
")",
"Handler",
"{",
"for",
"_",
",",
"m",
":=",
"range",
"middlware",
"{",
"next",
"=",
"m",
"(",
"<mask>",
")",
"\n",
"}",
"\n",
"return",
"next",
"\n",
"}",
")",
"\n",
"}"
] |
7,058 | all-7059 | [
"define",
"an",
"array",
"of",
"normals"
] | [
"func",
"NormalPointer",
"(",
"xtype",
"uint32",
",",
"stride",
"int32",
",",
"pointer",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowNormalPointer",
"(",
"gpNormalPointer",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"stride",
")",
",",
"<mask>",
")",
"\n",
"}"
] |
7,059 | all-7060 | [
"Union",
"returns",
"the",
"smallest",
"rectangle",
"that",
"contains",
"both",
"r",
"and",
"s",
"."
] | [
"func",
"(",
"r",
"Rectangle",
")",
"Union",
"(",
"s",
"Rectangle",
")",
"Rectangle",
"{",
"if",
"r",
".",
"Empty",
"(",
")",
"{",
"return",
"s",
"\n",
"}",
"\n",
"if",
"s",
".",
"Empty",
"(",
")",
"{",
"<mask>",
"r",
"\n",
"}",
"\n",
"if",
"r",
".",
"Min",
".",
"X",
">",
"s",
".",
"Min",
".",
"X",
"{",
"r",
".",
"Min",
".",
"X",
"=",
"s",
".",
"Min",
".",
"X",
"\n",
"}",
"\n",
"if",
"r",
".",
"Min",
".",
"Y",
">",
"s",
".",
"Min",
".",
"Y",
"{",
"r",
".",
"Min",
".",
"Y",
"=",
"s",
".",
"Min",
".",
"Y",
"\n",
"}",
"\n",
"if",
"r",
".",
"Max",
".",
"X",
"<",
"s",
".",
"Max",
".",
"X",
"{",
"r",
".",
"Max",
".",
"X",
"=",
"s",
".",
"Max",
".",
"X",
"\n",
"}",
"\n",
"if",
"r",
".",
"Max",
".",
"Y",
"<",
"s",
".",
"Max",
".",
"Y",
"{",
"r",
".",
"Max",
".",
"Y",
"=",
"s",
".",
"Max",
".",
"Y",
"\n",
"}",
"\n",
"return",
"r",
"\n",
"}"
] |
7,060 | all-7061 | [
"GetRequestsOk",
"returns",
"a",
"tuple",
"with",
"the",
"Requests",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"h",
"*",
"HostmapDefinition",
")",
"GetRequestsOk",
"(",
")",
"(",
"HostmapRequests",
",",
"bool",
")",
"{",
"if",
"h",
"==",
"nil",
"||",
"h",
".",
"Requests",
"==",
"nil",
"{",
"return",
"HostmapRequests",
"{",
"}",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"h",
".",
"Requests",
",",
"true",
"\n",
"}"
] |
7,061 | all-7062 | [
"Add",
"adds",
"a",
"peer",
"to",
"the",
"root",
"peer",
"list",
"if",
"it",
"does",
"not",
"exist",
"or",
"return",
"an",
"existing",
"peer",
"if",
"it",
"exists",
"."
] | [
"func",
"(",
"l",
"*",
"RootPeerList",
")",
"Add",
"(",
"hostPort",
"string",
")",
"*",
"Peer",
"{",
"l",
".",
"RLock",
"(",
")",
"\n\n",
"if",
"p",
",",
"ok",
":=",
"l",
".",
"peersByHostPort",
"[",
"hostPort",
"]",
";",
"ok",
"{",
"l",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"p",
"\n",
"}",
"\n\n",
"l",
".",
"RUnlock",
"(",
")",
"\n",
"l",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"p",
",",
"ok",
":=",
"l",
".",
"peersByHostPort",
"[",
"hostPort",
"]",
";",
"ok",
"{",
"return",
"p",
"\n",
"}",
"\n\n",
"<mask>",
"p",
"*",
"Peer",
"\n",
"// To avoid duplicate connections, only the root list should create new",
"// peers. All other lists should keep refs to the root list's peers.",
"p",
"=",
"newPeer",
"(",
"l",
".",
"channel",
",",
"hostPort",
",",
"l",
".",
"onPeerStatusChanged",
",",
"l",
".",
"onClosedConnRemoved",
")",
"\n",
"l",
".",
"peersByHostPort",
"[",
"hostPort",
"]",
"=",
"p",
"\n",
"return",
"p",
"\n",
"}"
] |
7,062 | all-7063 | [
"Base64",
"returns",
"a",
"string",
"which",
"is",
"the",
"xdr",
"-",
"then",
"-",
"base64",
"-",
"encoded",
"form",
"of",
"the",
"builder",
"s",
"underlying",
"transaction",
"envelope"
] | [
"func",
"(",
"b",
"*",
"TransactionEnvelopeBuilder",
")",
"Base64",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"bs",
",",
"<mask>",
":=",
"b",
".",
"Bytes",
"(",
")",
"\n",
"return",
"base64",
".",
"StdEncoding",
".",
"EncodeToString",
"(",
"bs",
")",
",",
"err",
"\n",
"}"
] |
7,063 | all-7064 | [
"NetworkCreate",
"creates",
"a",
"new",
"network",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"NetworkCreate",
"(",
"name",
",",
"description",
"string",
",",
"config",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"int64",
",",
"error",
")",
"{",
"var",
"<mask>",
"int64",
"\n",
"err",
":=",
"c",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"ClusterTx",
")",
"error",
"{",
"result",
",",
"err",
":=",
"tx",
".",
"tx",
".",
"Exec",
"(",
"\"",
"\"",
",",
"name",
",",
"description",
",",
"networkCreated",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"id",
",",
"err",
":=",
"result",
".",
"LastInsertId",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Insert a node-specific entry pointing to ourselves.",
"columns",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"\n",
"values",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"id",
",",
"c",
".",
"nodeID",
"}",
"\n",
"_",
",",
"err",
"=",
"query",
".",
"UpsertObject",
"(",
"tx",
".",
"tx",
",",
"\"",
"\"",
",",
"columns",
",",
"values",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"networkConfigAdd",
"(",
"tx",
".",
"tx",
",",
"id",
",",
"c",
".",
"nodeID",
",",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"id",
"=",
"-",
"1",
"\n",
"}",
"\n",
"return",
"id",
",",
"err",
"\n",
"}"
] |
7,064 | all-7065 | [
"virtualMachineFromContainerView",
"is",
"a",
"compatability",
"method",
"that",
"is",
"used",
"when",
"the",
"version",
"of",
"vSphere",
"is",
"too",
"old",
"to",
"support",
"using",
"SearchIndex",
"s",
"FindByUuid",
"method",
"correctly",
".",
"This",
"is",
"mainly",
"to",
"facilitate",
"the",
"ability",
"to",
"use",
"FromUUID",
"to",
"find",
"both",
"templates",
"in",
"addition",
"to",
"virtual",
"machines",
"which",
"historically",
"was",
"not",
"supported",
"by",
"FindByUuid",
"."
] | [
"func",
"virtualMachineFromContainerView",
"(",
"ctx",
"context",
".",
"Context",
",",
"client",
"*",
"govmomi",
".",
"Client",
",",
"uuid",
"string",
")",
"(",
"object",
".",
"Reference",
",",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"uuid",
")",
"\n",
"m",
":=",
"view",
".",
"NewManager",
"(",
"client",
".",
"Client",
")",
"\n\n",
"v",
",",
"err",
":=",
"m",
".",
"CreateContainerView",
"(",
"ctx",
",",
"client",
".",
"ServiceContent",
".",
"RootFolder",
",",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
"=",
"v",
".",
"Destroy",
"(",
"ctx",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"var",
"vms",
",",
"results",
"[",
"]",
"mo",
".",
"VirtualMachine",
"\n",
"err",
"=",
"v",
".",
"Retrieve",
"(",
"ctx",
",",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"&",
"results",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"result",
":=",
"range",
"results",
"{",
"if",
"result",
".",
"Config",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"result",
".",
"Config",
".",
"Uuid",
"==",
"uuid",
"{",
"vms",
"=",
"append",
"(",
"vms",
",",
"result",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"switch",
"{",
"case",
"len",
"(",
"vms",
")",
"<",
"1",
":",
"return",
"nil",
",",
"newUUIDNotFoundError",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"uuid",
")",
")",
"\n",
"case",
"len",
"(",
"vms",
")",
">",
"1",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"uuid",
")",
"\n",
"}",
"\n\n",
"return",
"object",
".",
"NewReference",
"(",
"client",
".",
"<mask>",
",",
"vms",
"[",
"0",
"]",
".",
"Self",
")",
",",
"nil",
"\n",
"}"
] |
7,065 | all-7066 | [
"Internal",
"function",
"called",
"by",
"ConnectLXD",
"and",
"ConnectPublicLXD"
] | [
"func",
"httpsLXD",
"(",
"url",
"string",
",",
"args",
"*",
"ConnectionArgs",
")",
"(",
"ContainerServer",
",",
"error",
")",
"{",
"// Use empty args if not specified",
"if",
"args",
"==",
"nil",
"{",
"args",
"=",
"&",
"ConnectionArgs",
"{",
"}",
"\n",
"}",
"\n\n",
"// Initialize the client struct",
"server",
":=",
"ProtocolLXD",
"{",
"httpCertificate",
":",
"args",
".",
"TLSServerCert",
",",
"httpHost",
":",
"url",
",",
"httpProtocol",
":",
"\"",
"\"",
",",
"httpUserAgent",
":",
"args",
".",
"UserAgent",
",",
"bakeryInteractor",
":",
"args",
".",
"AuthInteractor",
",",
"}",
"\n",
"if",
"args",
".",
"AuthType",
"==",
"\"",
"\"",
"{",
"server",
".",
"RequireAuthenticated",
"(",
"true",
")",
"\n",
"}",
"\n\n",
"// Setup the HTTP client",
"httpClient",
",",
"err",
":=",
"tlsHTTPClient",
"(",
"args",
".",
"HTTPClient",
",",
"args",
".",
"TLSClientCert",
",",
"args",
".",
"TLSClientKey",
",",
"args",
".",
"TLSCA",
",",
"args",
".",
"TLSServerCert",
",",
"args",
".",
"InsecureSkipVerify",
",",
"args",
".",
"Proxy",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"args",
".",
"CookieJar",
"!=",
"nil",
"{",
"httpClient",
".",
"Jar",
"=",
"args",
".",
"CookieJar",
"\n",
"}",
"\n\n",
"server",
".",
"<mask>",
"=",
"httpClient",
"\n",
"if",
"args",
".",
"AuthType",
"==",
"\"",
"\"",
"{",
"server",
".",
"setupBakeryClient",
"(",
")",
"\n",
"}",
"\n\n",
"// Test the connection and seed the server information",
"if",
"!",
"args",
".",
"SkipGetServer",
"{",
"_",
",",
"_",
",",
"err",
":=",
"server",
".",
"GetServer",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"&",
"server",
",",
"nil",
"\n",
"}"
] |
7,066 | all-7067 | [
"NewIssue",
"creates",
"a",
"new",
"(",
"orm",
")",
"Issue",
"from",
"a",
"github",
"Issue"
] | [
"func",
"NewIssue",
"(",
"gIssue",
"*",
"github",
".",
"Issue",
",",
"repository",
"string",
")",
"(",
"*",
"sql",
".",
"Issue",
",",
"error",
")",
"{",
"if",
"gIssue",
".",
"Number",
"==",
"nil",
"||",
"gIssue",
".",
"Title",
"==",
"nil",
"||",
"gIssue",
".",
"User",
"==",
"nil",
"||",
"gIssue",
".",
"User",
".",
"Login",
"==",
"nil",
"||",
"gIssue",
".",
"State",
"==",
"nil",
"||",
"gIssue",
".",
"Comments",
"==",
"nil",
"||",
"gIssue",
".",
"CreatedAt",
"==",
"nil",
"||",
"gIssue",
".",
"UpdatedAt",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"gIssue",
")",
"\n",
"}",
"\n\n",
"var",
"closedAt",
"*",
"time",
".",
"Time",
"\n",
"if",
"gIssue",
".",
"ClosedAt",
"!=",
"nil",
"{",
"closedAt",
"=",
"gIssue",
".",
"ClosedAt",
"\n",
"}",
"\n",
"assignees",
",",
"err",
":=",
"newAssignees",
"(",
"*",
"gIssue",
".",
"Number",
",",
"gIssue",
".",
"Assignees",
",",
"repository",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"var",
"body",
"string",
"\n",
"if",
"gIssue",
".",
"<mask>",
"!=",
"nil",
"{",
"body",
"=",
"*",
"gIssue",
".",
"Body",
"\n",
"}",
"\n",
"isPR",
":=",
"(",
"gIssue",
".",
"PullRequestLinks",
"!=",
"nil",
"&&",
"gIssue",
".",
"PullRequestLinks",
".",
"URL",
"!=",
"nil",
")",
"\n",
"labels",
",",
"err",
":=",
"newLabels",
"(",
"*",
"gIssue",
".",
"Number",
",",
"gIssue",
".",
"Labels",
",",
"repository",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"sql",
".",
"Issue",
"{",
"ID",
":",
"strconv",
".",
"Itoa",
"(",
"*",
"gIssue",
".",
"Number",
")",
",",
"Labels",
":",
"labels",
",",
"Title",
":",
"*",
"gIssue",
".",
"Title",
",",
"Body",
":",
"body",
",",
"User",
":",
"*",
"gIssue",
".",
"User",
".",
"Login",
",",
"Assignees",
":",
"assignees",
",",
"State",
":",
"*",
"gIssue",
".",
"State",
",",
"Comments",
":",
"*",
"gIssue",
".",
"Comments",
",",
"IsPR",
":",
"isPR",
",",
"IssueClosedAt",
":",
"closedAt",
",",
"IssueCreatedAt",
":",
"*",
"gIssue",
".",
"CreatedAt",
",",
"IssueUpdatedAt",
":",
"*",
"gIssue",
".",
"UpdatedAt",
",",
"Repository",
":",
"strings",
".",
"ToLower",
"(",
"repository",
")",
",",
"}",
",",
"nil",
"\n",
"}"
] |
7,067 | all-7068 | [
"===",
"abs",
"(",
"Vector",
"ValueTypeVector",
")",
"Vector",
"==="
] | [
"func",
"funcAbs",
"(",
"vals",
"[",
"]",
"Value",
",",
"args",
"Expressions",
",",
"enh",
"*",
"EvalNodeHelper",
")",
"<mask>",
"{",
"return",
"simpleFunc",
"(",
"vals",
",",
"enh",
",",
"math",
".",
"Abs",
")",
"\n",
"}"
] |
7,068 | all-7069 | [
"Enqueue",
"enqueues",
"a",
"drawing",
"command",
"other",
"than",
"a",
"draw",
"-",
"image",
"command",
".",
"For",
"a",
"draw",
"-",
"image",
"command",
"use",
"EnqueueDrawTrianglesCommand",
"."
] | [
"func",
"(",
"q",
"*",
"commandQueue",
")",
"Enqueue",
"(",
"command",
"command",
")",
"{",
"// TODO: If dst is the screen, reorder the command to be the last.",
"q",
".",
"commands",
"=",
"<mask>",
"(",
"q",
".",
"commands",
",",
"command",
")",
"\n",
"}"
] |
7,069 | all-7070 | [
"RemoteAddr",
"returns",
"the",
"remote",
"network",
"address",
"."
] | [
"func",
"(",
"c",
"*",
"Conn",
")",
"RemoteAddr",
"(",
")",
"<mask>",
".",
"Addr",
"{",
"ws",
":=",
"c",
".",
"ws",
".",
"Load",
"(",
")",
".",
"(",
"*",
"websocket",
".",
"Conn",
")",
"\n",
"if",
"ws",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"ws",
".",
"RemoteAddr",
"(",
")",
"\n",
"}"
] |
7,070 | all-7071 | [
"Flush",
"removes",
"all",
"the",
"items",
"in",
"the",
"cache",
"after",
"expiration",
"seconds",
".",
"If",
"expiration",
"is",
"<",
"=",
"0",
"it",
"removes",
"all",
"the",
"items",
"right",
"now",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Flush",
"(",
"expiration",
"int",
")",
"error",
"{",
"servers",
",",
"err",
":=",
"c",
".",
"servers",
".",
"Servers",
"(",
")",
"\n",
"var",
"failed",
"[",
"]",
"*",
"Addr",
"\n",
"var",
"errs",
"[",
"]",
"error",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"var",
"extras",
"[",
"]",
"byte",
"\n",
"if",
"expiration",
">",
"0",
"{",
"extras",
"=",
"make",
"(",
"[",
"]",
"byte",
",",
"4",
")",
"\n",
"putUint32",
"(",
"extras",
",",
"uint32",
"(",
"expiration",
")",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"addr",
":=",
"range",
"servers",
"{",
"cn",
",",
"err",
":=",
"c",
".",
"getConn",
"(",
"addr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"failed",
"=",
"append",
"(",
"failed",
",",
"addr",
")",
"\n",
"errs",
"=",
"append",
"(",
"errs",
",",
"err",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"if",
"err",
"=",
"c",
".",
"sendConnCommand",
"(",
"cn",
",",
"\"",
"\"",
",",
"cmdFlush",
",",
"nil",
",",
"0",
",",
"extras",
")",
";",
"err",
"==",
"nil",
"{",
"_",
",",
"_",
",",
"_",
",",
"_",
",",
"err",
"=",
"c",
".",
"parseResponse",
"(",
"\"",
"\"",
",",
"cn",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"failed",
"=",
"append",
"(",
"failed",
",",
"addr",
")",
"\n",
"errs",
"=",
"<mask>",
"(",
"errs",
",",
"err",
")",
"\n",
"}",
"\n",
"c",
".",
"condRelease",
"(",
"cn",
",",
"&",
"err",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"failed",
")",
">",
"0",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"buf",
".",
"WriteString",
"(",
"\"",
"\"",
")",
"\n",
"for",
"ii",
",",
"addr",
":=",
"range",
"failed",
"{",
"if",
"ii",
">",
"0",
"{",
"buf",
".",
"WriteString",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"buf",
".",
"WriteString",
"(",
"addr",
".",
"String",
"(",
")",
")",
"\n",
"buf",
".",
"WriteString",
"(",
"\"",
"\"",
")",
"\n",
"buf",
".",
"WriteString",
"(",
"errs",
"[",
"ii",
"]",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"errors",
".",
"New",
"(",
"buf",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,071 | all-7072 | [
"expandVirtualMachineResourceAllocation",
"reads",
"the",
"VM",
"resource",
"allocation",
"resource",
"data",
"keys",
"for",
"the",
"type",
"supplied",
"by",
"key",
"and",
"returns",
"an",
"appropriate",
"types",
".",
"ResourceAllocationInfo",
"reference",
"."
] | [
"func",
"expandVirtualMachineResourceAllocation",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"key",
"string",
")",
"*",
"types",
".",
"ResourceAllocationInfo",
"{",
"shareLevelKey",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"key",
")",
"\n",
"shareCountKey",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"key",
")",
"\n",
"limitKey",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"key",
")",
"\n",
"reservationKey",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
")",
"\n\n",
"obj",
":=",
"&",
"types",
".",
"ResourceAllocationInfo",
"{",
"Limit",
":",
"structure",
".",
"GetInt64PtrEmptyZero",
"(",
"d",
",",
"limitKey",
")",
",",
"Reservation",
":",
"structure",
".",
"GetInt64PtrEmptyZero",
"(",
"d",
",",
"reservationKey",
")",
",",
"}",
"\n",
"shares",
":=",
"&",
"types",
".",
"SharesInfo",
"{",
"Level",
":",
"types",
".",
"SharesLevel",
"(",
"d",
".",
"Get",
"(",
"shareLevelKey",
")",
".",
"(",
"string",
")",
")",
",",
"Shares",
":",
"int32",
"(",
"d",
".",
"Get",
"(",
"shareCountKey",
")",
".",
"(",
"int",
")",
")",
",",
"}",
"\n",
"obj",
".",
"Shares",
"=",
"shares",
"\n",
"return",
"obj",
"\n",
"}"
] |
7,072 | all-7073 | [
"HasEnv",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TraceServiceDefinition",
")",
"HasEnv",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"Env",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
7,073 | all-7074 | [
"OnRecv",
"causes",
"all",
"requests",
"received",
"on",
"conn",
"to",
"invoke",
"f",
"(",
"req",
"nil",
")",
"and",
"all",
"responses",
"to",
"invoke",
"f",
"(",
"req",
"resp",
")"
] | [
"func",
"OnRecv",
"(",
"f",
"func",
"(",
"*",
"<mask>",
",",
"*",
"Response",
")",
")",
"ConnOpt",
"{",
"return",
"func",
"(",
"c",
"*",
"Conn",
")",
"{",
"c",
".",
"onRecv",
"=",
"append",
"(",
"c",
".",
"onRecv",
",",
"f",
")",
"}",
"\n",
"}"
] |
7,074 | all-7075 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"MoveToReturns",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom29",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
7,075 | all-7076 | [
"Delete",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_text_buffer_delete",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TextBuffer",
")",
"Delete",
"(",
"start",
",",
"<mask>",
"*",
"TextIter",
")",
"{",
"C",
".",
"gtk_text_buffer_delete",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"GtkTextIter",
")",
"(",
"start",
")",
",",
"(",
"*",
"C",
".",
"GtkTextIter",
")",
"(",
"end",
")",
")",
"\n",
"}"
] |
7,076 | all-7077 | [
"forStateSample",
"returns",
"the",
"sample",
"for",
"ALERTS_FOR_STATE",
"."
] | [
"func",
"(",
"r",
"*",
"AlertingRule",
")",
"forStateSample",
"(",
"alert",
"*",
"Alert",
",",
"ts",
"time",
".",
"Time",
",",
"v",
"float64",
")",
"promql",
".",
"Sample",
"{",
"lb",
":=",
"labels",
".",
"NewBuilder",
"(",
"r",
".",
"labels",
")",
"\n\n",
"for",
"_",
",",
"l",
":=",
"<mask>",
"alert",
".",
"Labels",
"{",
"lb",
".",
"Set",
"(",
"l",
".",
"Name",
",",
"l",
".",
"Value",
")",
"\n",
"}",
"\n\n",
"lb",
".",
"Set",
"(",
"labels",
".",
"MetricName",
",",
"alertForStateMetricName",
")",
"\n",
"lb",
".",
"Set",
"(",
"labels",
".",
"AlertName",
",",
"r",
".",
"name",
")",
"\n\n",
"s",
":=",
"promql",
".",
"Sample",
"{",
"Metric",
":",
"lb",
".",
"Labels",
"(",
")",
",",
"Point",
":",
"promql",
".",
"Point",
"{",
"T",
":",
"timestamp",
".",
"FromTime",
"(",
"ts",
")",
",",
"V",
":",
"v",
"}",
",",
"}",
"\n",
"return",
"s",
"\n",
"}"
] |
7,077 | all-7078 | [
"LookupShadow",
"looks",
"for",
"the",
"entry",
"for",
"the",
"given",
"user",
"name",
"."
] | [
"func",
"LookupShadow",
"(",
"name",
"string",
")",
"(",
"*",
"Shadow",
",",
"error",
")",
"{",
"entries",
",",
"err",
":=",
"LookupInShadow",
"(",
"S_NAME",
",",
"<mask>",
",",
"1",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"entries",
"[",
"0",
"]",
",",
"err",
"\n",
"}"
] |
7,078 | all-7079 | [
"GetCombinedStatus",
"returns",
"the",
"overall",
"status",
"for",
"a",
"commit",
"."
] | [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"GetCombinedStatus",
"(",
"<mask>",
",",
"repo",
",",
"ref",
"string",
")",
"(",
"*",
"github",
".",
"CombinedStatus",
",",
"error",
")",
"{",
"return",
"f",
".",
"CombinedStatuses",
"[",
"ref",
"]",
",",
"nil",
"\n",
"}"
] |
7,079 | all-7080 | [
"Query",
"querys",
"form",
"parameter",
"."
] | [
"func",
"(",
"ctx",
"*",
"<mask>",
")",
"Query",
"(",
"name",
"string",
")",
"string",
"{",
"ctx",
".",
"parseForm",
"(",
")",
"\n",
"return",
"ctx",
".",
"Req",
".",
"Form",
".",
"Get",
"(",
"name",
")",
"\n",
"}"
] |
7,080 | all-7081 | [
"SetApplicationID",
"is",
"a",
"wrapper",
"around",
"g_application_set_application_id",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Application",
")",
"SetApplicationID",
"(",
"id",
"string",
")",
"{",
"cstr1",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"<mask>",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr1",
")",
")",
"\n\n",
"C",
".",
"g_application_set_application_id",
"(",
"v",
".",
"native",
"(",
")",
",",
"cstr1",
")",
"\n",
"}"
] |
7,081 | all-7082 | [
"commandPath",
"is",
"like",
"cobra",
".",
"Command",
".",
"CommandPath",
"but",
"tweaked",
"to",
"use",
"c",
".",
"Use",
"instead",
"of",
"c",
".",
"Name",
"for",
"the",
"root",
"command",
"so",
"it",
"works",
"with",
"viewcore",
"s",
"unusual",
"command",
"structure",
"."
] | [
"func",
"commandPath",
"(",
"c",
"*",
"cobra",
".",
"Command",
")",
"string",
"{",
"if",
"c",
".",
"HasParent",
"(",
")",
"{",
"return",
"commandPath",
"(",
"c",
")",
"+",
"\"",
"\"",
"+",
"c",
".",
"<mask>",
"(",
")",
"\n",
"}",
"\n",
"return",
"c",
".",
"Use",
"\n",
"}"
] |
7,082 | all-7083 | [
"Kill",
"this",
"function",
"as",
"soon",
"as",
"zfs",
"is",
"fixed",
"."
] | [
"func",
"(",
"c",
"*",
"containerLXC",
")",
"StorageStartSensitive",
"(",
")",
"(",
"bool",
",",
"error",
")",
"{",
"// Initialize storage interface for the container.",
"err",
":=",
"c",
".",
"initStorage",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"<mask>",
"isOurOperation",
"bool",
"\n",
"if",
"c",
".",
"IsSnapshot",
"(",
")",
"{",
"isOurOperation",
",",
"err",
"=",
"c",
".",
"storage",
".",
"ContainerSnapshotStart",
"(",
"c",
")",
"\n",
"}",
"else",
"{",
"isOurOperation",
",",
"err",
"=",
"c",
".",
"storage",
".",
"ContainerMount",
"(",
"c",
")",
"\n",
"}",
"\n\n",
"return",
"isOurOperation",
",",
"err",
"\n",
"}"
] |
7,083 | all-7084 | [
"Records",
"returns",
"the",
"list",
"of",
"records",
"in",
"a",
"given",
"zone",
"."
] | [
"func",
"(",
"p",
"*",
"LinodeProvider",
")",
"Records",
"(",
")",
"(",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
",",
"error",
")",
"{",
"zones",
",",
"err",
":=",
"p",
".",
"Zones",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"endpoints",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
"\n\n",
"for",
"_",
",",
"zone",
":=",
"range",
"zones",
"{",
"records",
",",
"err",
":=",
"p",
".",
"fetchRecords",
"(",
"zone",
".",
"ID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"r",
":=",
"range",
"records",
"{",
"if",
"supportedRecordType",
"(",
"string",
"(",
"r",
".",
"Type",
")",
")",
"{",
"name",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"r",
".",
"Name",
",",
"zone",
".",
"Domain",
")",
"\n\n",
"// root name is identified by the empty string and should be",
"// translated to zone name for the endpoint entry.",
"if",
"r",
".",
"Name",
"==",
"\"",
"\"",
"{",
"name",
"=",
"zone",
".",
"Domain",
"\n",
"}",
"\n\n",
"endpoints",
"=",
"<mask>",
"(",
"endpoints",
",",
"endpoint",
".",
"NewEndpointWithTTL",
"(",
"name",
",",
"string",
"(",
"r",
".",
"Type",
")",
",",
"endpoint",
".",
"TTL",
"(",
"r",
".",
"TTLSec",
")",
",",
"r",
".",
"Target",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"endpoints",
",",
"nil",
"\n",
"}"
] |
7,084 | all-7085 | [
"Validate",
"checks",
"that",
"the",
"minimum",
"fields",
"are",
"provided",
".",
"Deprecated",
":",
"This",
"map",
"be",
"deleted",
"after",
"the",
"native",
"library",
"replaces",
"Ruby",
"deps",
"and",
"should",
"not",
"be",
"used",
"outside",
"of",
"this",
"library",
"."
] | [
"func",
"(",
"v",
"*",
"VerifyMessageRequest",
")",
"Validate",
"(",
")",
"error",
"{",
"v",
".",
"Args",
"=",
"[",
"]",
"string",
"{",
"}",
"\n\n",
"if",
"len",
"(",
"v",
".",
"PactURLs",
")",
"!=",
"0",
"{",
"v",
".",
"Args",
"=",
"append",
"(",
"v",
".",
"Args",
",",
"v",
".",
"PactURLs",
"...",
")",
"\n",
"}",
"else",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"v",
".",
"Args",
"=",
"append",
"(",
"v",
".",
"Args",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"if",
"v",
".",
"BrokerUsername",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Args",
"=",
"append",
"(",
"v",
".",
"Args",
",",
"\"",
"\"",
",",
"v",
".",
"BrokerUsername",
")",
"\n",
"}",
"\n\n",
"if",
"v",
".",
"BrokerPassword",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Args",
"=",
"append",
"(",
"v",
".",
"Args",
",",
"\"",
"\"",
",",
"v",
".",
"BrokerPassword",
")",
"\n",
"}",
"\n\n",
"if",
"v",
".",
"ProviderVersion",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Args",
"=",
"<mask>",
"(",
"v",
".",
"Args",
",",
"\"",
"\"",
",",
"v",
".",
"ProviderVersion",
")",
"\n",
"}",
"\n\n",
"if",
"v",
".",
"PublishVerificationResults",
"{",
"v",
".",
"Args",
"=",
"append",
"(",
"v",
".",
"Args",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
7,085 | all-7086 | [
"establish",
"a",
"buffer",
"for",
"selection",
"mode",
"values"
] | [
"func",
"SelectBuffer",
"(",
"size",
"int32",
",",
"<mask>",
"*",
"uint32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpSelectBuffer",
",",
"2",
",",
"uintptr",
"(",
"size",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"buffer",
")",
")",
",",
"0",
")",
"\n",
"}"
] |
7,086 | all-7087 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"AppManifestError",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage82",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
7,087 | all-7088 | [
"appendConfigurationEntry",
"changes",
"the",
"configuration",
"and",
"adds",
"a",
"new",
"configuration",
"entry",
"to",
"the",
"log",
".",
"This",
"must",
"only",
"be",
"called",
"from",
"the",
"main",
"thread",
"."
] | [
"func",
"(",
"r",
"*",
"Raft",
")",
"appendConfigurationEntry",
"(",
"<mask>",
"*",
"configurationChangeFuture",
")",
"{",
"configuration",
",",
"err",
":=",
"nextConfiguration",
"(",
"r",
".",
"configurations",
".",
"latest",
",",
"r",
".",
"configurations",
".",
"latestIndex",
",",
"future",
".",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"future",
".",
"respond",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"r",
".",
"logger",
".",
"Info",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"future",
".",
"req",
".",
"command",
",",
"future",
".",
"req",
".",
"serverID",
",",
"future",
".",
"req",
".",
"serverAddress",
",",
"configuration",
".",
"Servers",
")",
")",
"\n\n",
"// In pre-ID compatibility mode we translate all configuration changes",
"// in to an old remove peer message, which can handle all supported",
"// cases for peer changes in the pre-ID world (adding and removing",
"// voters). Both add peer and remove peer log entries are handled",
"// similarly on old Raft servers, but remove peer does extra checks to",
"// see if a leader needs to step down. Since they both assert the full",
"// configuration, then we can safely call remove peer for everything.",
"if",
"r",
".",
"protocolVersion",
"<",
"2",
"{",
"future",
".",
"log",
"=",
"Log",
"{",
"Type",
":",
"LogRemovePeerDeprecated",
",",
"Data",
":",
"encodePeers",
"(",
"configuration",
",",
"r",
".",
"trans",
")",
",",
"}",
"\n",
"}",
"else",
"{",
"future",
".",
"log",
"=",
"Log",
"{",
"Type",
":",
"LogConfiguration",
",",
"Data",
":",
"encodeConfiguration",
"(",
"configuration",
")",
",",
"}",
"\n",
"}",
"\n\n",
"r",
".",
"dispatchLogs",
"(",
"[",
"]",
"*",
"logFuture",
"{",
"&",
"future",
".",
"logFuture",
"}",
")",
"\n",
"index",
":=",
"future",
".",
"Index",
"(",
")",
"\n",
"r",
".",
"configurations",
".",
"latest",
"=",
"configuration",
"\n",
"r",
".",
"configurations",
".",
"latestIndex",
"=",
"index",
"\n",
"r",
".",
"leaderState",
".",
"commitment",
".",
"setConfiguration",
"(",
"configuration",
")",
"\n",
"r",
".",
"startStopReplication",
"(",
")",
"\n",
"}"
] |
7,088 | all-7089 | [
"NewURIFromHostPort",
"returns",
"a",
"URI",
"with",
"specified",
"host",
"and",
"port",
"."
] | [
"func",
"NewURIFromHostPort",
"(",
"host",
"string",
",",
"port",
"uint16",
")",
"(",
"*",
"URI",
",",
"error",
")",
"{",
"uri",
":=",
"DefaultURI",
"(",
")",
"\n",
"err",
":=",
"uri",
".",
"SetHost",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"uri",
".",
"SetPort",
"(",
"port",
")",
"\n",
"return",
"uri",
",",
"nil",
"\n",
"}"
] |
7,089 | all-7090 | [
"CookbookLocator",
"builds",
"a",
"locator",
"from",
"the",
"given",
"href",
"."
] | [
"func",
"(",
"api",
"*",
"API",
")",
"CookbookLocator",
"(",
"href",
"<mask>",
")",
"*",
"CookbookLocator",
"{",
"return",
"&",
"CookbookLocator",
"{",
"Href",
"(",
"href",
")",
",",
"api",
"}",
"\n",
"}"
] |
7,090 | all-7091 | [
"Shrink",
"a",
"database",
"/",
"global",
"/",
"logs",
".",
"db",
"that",
"grew",
"unwildly",
"due",
"to",
"a",
"bug",
"in",
"the",
"3",
".",
"6",
"release",
"."
] | [
"func",
"patchShrinkLogsDBFile",
"(",
"name",
"string",
",",
"d",
"*",
"Daemon",
")",
"error",
"{",
"dir",
":=",
"filepath",
".",
"Join",
"(",
"d",
".",
"os",
".",
"VarDir",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"info",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"filepath",
".",
"Join",
"(",
"dir",
",",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"// The boltdb file is not there at all, nothing to do.",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"info",
".",
"Size",
"(",
")",
"<",
"1024",
"*",
"1024",
"*",
"100",
"{",
"// Only try to shrink databases bigger than 100 Megabytes.",
"return",
"nil",
"\n",
"}",
"\n\n",
"snaps",
",",
"err",
":=",
"raft",
".",
"NewFileSnapshotStoreWithLogger",
"(",
"dir",
",",
"2",
",",
"stdlog",
".",
"New",
"(",
"ioutil",
".",
"Discard",
",",
"\"",
"\"",
",",
"0",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"metas",
",",
"err",
":=",
"snaps",
".",
"List",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"metas",
")",
"==",
"0",
"{",
"// No snapshot is available, we can't shrink. This should never",
"// happen, in practice.",
"logger",
".",
"Warnf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"meta",
":=",
"metas",
"[",
"0",
"]",
"// The most recent snapshot.",
"\n\n",
"// Copy all log entries from the current boltdb file into a new one,",
"// which will be smaller since it excludes all truncated entries that",
"pathCur",
":=",
"filepath",
".",
"Join",
"(",
"dir",
",",
"\"",
"\"",
")",
"\n",
"// got allocated before the latest snapshot.",
"logsCur",
",",
"err",
":=",
"raftboltdb",
".",
"New",
"(",
"raftboltdb",
".",
"Options",
"{",
"Path",
":",
"pathCur",
",",
"BoltOptions",
":",
"&",
"bolt",
".",
"<mask>",
"{",
"Timeout",
":",
"10",
"*",
"time",
".",
"Second",
",",
"ReadOnly",
":",
"true",
",",
"}",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"defer",
"logsCur",
".",
"Close",
"(",
")",
"\n\n",
"pathNew",
":=",
"filepath",
".",
"Join",
"(",
"dir",
",",
"\"",
"\"",
")",
"\n",
"logsNew",
",",
"err",
":=",
"raftboltdb",
".",
"New",
"(",
"raftboltdb",
".",
"Options",
"{",
"Path",
":",
"pathNew",
",",
"BoltOptions",
":",
"&",
"bolt",
".",
"Options",
"{",
"Timeout",
":",
"10",
"*",
"time",
".",
"Second",
"}",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"defer",
"logsNew",
".",
"Close",
"(",
")",
"\n\n",
"lastIndex",
",",
"err",
":=",
"logsCur",
".",
"LastIndex",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"for",
"index",
":=",
"meta",
".",
"Index",
";",
"index",
"<=",
"lastIndex",
";",
"index",
"++",
"{",
"log",
":=",
"&",
"raft",
".",
"Log",
"{",
"}",
"\n\n",
"err",
":=",
"logsCur",
".",
"GetLog",
"(",
"index",
",",
"log",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"index",
")",
"\n",
"}",
"\n\n",
"err",
"=",
"logsNew",
".",
"StoreLog",
"(",
"log",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"index",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"term",
",",
"err",
":=",
"logsCur",
".",
"GetUint64",
"(",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"err",
"=",
"logsNew",
".",
"SetUint64",
"(",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
",",
"term",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"logsCur",
".",
"Close",
"(",
")",
"\n",
"logsNew",
".",
"Close",
"(",
")",
"\n\n",
"err",
"=",
"os",
".",
"Remove",
"(",
"pathCur",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"err",
"=",
"os",
".",
"Rename",
"(",
"pathNew",
",",
"pathCur",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
7,091 | all-7092 | [
"taskStateChangesToSend",
"gets",
"a",
"list",
"task",
"state",
"changes",
"for",
"container",
"events",
"that",
"have",
"been",
"batched",
"and",
"not",
"sent",
"beyond",
"the",
"drainEventsFrequency",
"threshold"
] | [
"func",
"(",
"handler",
"*",
"TaskHandler",
")",
"taskStateChangesToSend",
"(",
")",
"[",
"]",
"api",
".",
"TaskStateChange",
"{",
"handler",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"handler",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"var",
"events",
"[",
"]",
"api",
".",
"TaskStateChange",
"\n",
"for",
"taskARN",
":=",
"<mask>",
"handler",
".",
"tasksToContainerStates",
"{",
"// An entry for the task in tasksToContainerStates means that there",
"// is at least 1 container event for that task that hasn't been sent",
"// to ECS (has been batched).",
"// Make sure that the engine's task state knows about this task (as a",
"// safety mechanism) and add it to the list of task state changes",
"// that need to be sent to ECS",
"if",
"task",
",",
"ok",
":=",
"handler",
".",
"state",
".",
"TaskByArn",
"(",
"taskARN",
")",
";",
"ok",
"{",
"// We do not allow the ticker to submit container state updates for",
"// tasks that are STOPPED. This prevents the ticker's asynchronous",
"// updates from clobbering container states when the task",
"// transitions to STOPPED, since ECS does not allow updates to",
"// container states once the task has moved to STOPPED.",
"knownStatus",
":=",
"task",
".",
"GetKnownStatus",
"(",
")",
"\n",
"if",
"knownStatus",
">=",
"apitaskstatus",
".",
"TaskStopped",
"{",
"continue",
"\n",
"}",
"\n",
"event",
":=",
"api",
".",
"TaskStateChange",
"{",
"TaskARN",
":",
"taskARN",
",",
"Status",
":",
"task",
".",
"GetKnownStatus",
"(",
")",
",",
"Task",
":",
"task",
",",
"}",
"\n",
"event",
".",
"SetTaskTimestamps",
"(",
")",
"\n\n",
"events",
"=",
"append",
"(",
"events",
",",
"event",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"events",
"\n",
"}"
] |
7,092 | all-7093 | [
"Value",
"converts",
"DateTime",
"to",
"a",
"primitive",
"value",
"ready",
"to",
"written",
"to",
"a",
"database",
"."
] | [
"func",
"(",
"t",
"DateTime",
")",
"<mask>",
"(",
")",
"(",
"driver",
".",
"Value",
",",
"error",
")",
"{",
"return",
"driver",
".",
"Value",
"(",
"t",
".",
"String",
"(",
")",
")",
",",
"nil",
"\n",
"}"
] |
7,093 | all-7094 | [
"Next",
"moves",
"over",
"the",
"boundary",
"to",
"the",
"next",
"part",
"returns",
"true",
"if",
"there",
"is",
"another",
"part",
"to",
"be",
"read",
"."
] | [
"func",
"(",
"b",
"*",
"boundaryReader",
")",
"Next",
"(",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"b",
".",
"finished",
"{",
"return",
"false",
",",
"nil",
"\n",
"}",
"\n",
"if",
"b",
".",
"partsRead",
">",
"0",
"{",
"// Exhaust the current part to prevent errors when moving to the next part",
"_",
",",
"_",
"=",
"io",
".",
"Copy",
"(",
"ioutil",
".",
"Discard",
",",
"b",
")",
"\n",
"}",
"\n",
"for",
"{",
"line",
",",
"err",
":=",
"b",
".",
"r",
".",
"ReadSlice",
"(",
"'\\n'",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"<mask>",
".",
"EOF",
"{",
"return",
"false",
",",
"errors",
".",
"WithStack",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"line",
")",
">",
"0",
"&&",
"(",
"line",
"[",
"0",
"]",
"==",
"'\\r'",
"||",
"line",
"[",
"0",
"]",
"==",
"'\\n'",
")",
"{",
"// Blank line",
"continue",
"\n",
"}",
"\n",
"if",
"b",
".",
"isTerminator",
"(",
"line",
")",
"{",
"b",
".",
"finished",
"=",
"true",
"\n",
"return",
"false",
",",
"nil",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"io",
".",
"EOF",
"&&",
"b",
".",
"isDelimiter",
"(",
"line",
")",
"{",
"// Start of a new part",
"b",
".",
"partsRead",
"++",
"\n",
"return",
"true",
",",
"nil",
"\n",
"}",
"\n",
"if",
"err",
"==",
"io",
".",
"EOF",
"{",
"// Intentionally not wrapping with stack",
"return",
"false",
",",
"io",
".",
"EOF",
"\n",
"}",
"\n",
"if",
"b",
".",
"partsRead",
"==",
"0",
"{",
"// The first part didn't find the starting delimiter, burn off any preamble in front of",
"// the boundary",
"continue",
"\n",
"}",
"\n",
"b",
".",
"finished",
"=",
"true",
"\n",
"return",
"false",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"string",
"(",
"b",
".",
"prefix",
")",
",",
"string",
"(",
"line",
")",
")",
"\n",
"}",
"\n",
"}"
] |
7,094 | all-7095 | [
"DeleteField",
"deletes",
"a",
"field",
"on",
"the",
"server",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteField",
"(",
"field",
"*",
"Field",
")",
"error",
"{",
"span",
":=",
"c",
".",
"tracer",
".",
"StartSpan",
"(",
"\"",
"\"",
")",
"\n",
"defer",
"span",
".",
"Finish",
"(",
")",
"\n\n",
"path",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"field",
".",
"index",
".",
"<mask>",
",",
"field",
".",
"name",
")",
"\n",
"_",
",",
"_",
",",
"err",
":=",
"c",
".",
"httpRequest",
"(",
"\"",
"\"",
",",
"path",
",",
"nil",
",",
"nil",
",",
"false",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
7,095 | all-7096 | [
"Auth",
"-",
"fake",
"out",
"making",
"an",
"auth",
"call"
] | [
"func",
"(",
"s",
"*",
"FakeVCDClient",
")",
"Auth",
"(",
"username",
",",
"<mask>",
"string",
")",
"(",
"err",
"error",
")",
"{",
"return",
"s",
".",
"ErrAuthFake",
"\n",
"}"
] |
7,096 | all-7097 | [
"/",
"*",
"Get",
"the",
"state",
"of",
"a",
"single",
"channel",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Channel",
"(",
"name",
"string",
",",
"additionalQueries",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"*",
"Channel",
",",
"error",
")",
"{",
"path",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
".",
"AppId",
",",
"name",
")",
"\n",
"u",
",",
"err",
":=",
"createRequestURL",
"(",
"\"",
"\"",
",",
"c",
".",
"Host",
",",
"<mask>",
",",
"c",
".",
"Key",
",",
"c",
".",
"Secret",
",",
"authTimestamp",
"(",
")",
",",
"c",
".",
"Secure",
",",
"nil",
",",
"additionalQueries",
",",
"c",
".",
"Cluster",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"response",
",",
"err",
":=",
"c",
".",
"request",
"(",
"\"",
"\"",
",",
"u",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"unmarshalledChannel",
"(",
"response",
",",
"name",
")",
"\n",
"}"
] |
7,097 | all-7098 | [
"CertDelete",
"deletes",
"a",
"certificate",
"from",
"the",
"db",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"CertDelete",
"(",
"fingerprint",
"string",
")",
"error",
"{",
"err",
":=",
"exec",
"(",
"c",
".",
"<mask>",
",",
"\"",
"\"",
",",
"fingerprint",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
7,098 | all-7099 | [
"Do",
"executes",
"Emulation",
".",
"setUserAgentOverride",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SetUserAgentOverrideParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetUserAgentOverride",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
7,099 | all-7100 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"DispatchMouseEventParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoInput8",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.