id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
23,500 | all-23501 | [
"findInGopath",
"searches",
"the",
"gopath",
"for",
"the",
"named",
"import",
"directory",
"."
] | [
"func",
"findInGopath",
"(",
"dir",
"string",
",",
"gopath",
"[",
"]",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"for",
"_",
",",
"v",
":=",
"range",
"gopath",
"{",
"dst",
":=",
"filepath",
".",
"Join",
"(",
"v",
",",
"\"",
"\"",
",",
"dir",
")",
"\n",
"if",
"_",
",",
"err",
":=",
"<mask>",
".",
"Stat",
"(",
"dst",
")",
";",
"err",
"==",
"nil",
"{",
"return",
"dst",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"dir",
",",
"gopath",
")",
"\n",
"}"
] |
23,501 | all-23502 | [
"Get",
"returns",
"the",
"cached",
"vm",
".",
"ByteCode",
"if",
"available"
] | [
"func",
"(",
"c",
"*",
"FileCache",
")",
"Get",
"(",
"<mask>",
"string",
")",
"(",
"*",
"CacheEntity",
",",
"error",
")",
"{",
"path",
":=",
"c",
".",
"GetCachePath",
"(",
"key",
")",
"\n\n",
"// Need to avoid race condition",
"file",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
"+",
"path",
"+",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"defer",
"file",
".",
"Close",
"(",
")",
"\n\n",
"var",
"entity",
"CacheEntity",
"\n",
"dec",
":=",
"gob",
".",
"NewDecoder",
"(",
"file",
")",
"\n",
"if",
"err",
"=",
"dec",
".",
"Decode",
"(",
"&",
"entity",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
"+",
"path",
"+",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"entity",
",",
"nil",
"\n",
"}"
] |
23,502 | all-23503 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"QuerySelectorReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom19",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
23,503 | all-23504 | [
"CursorNewFromName",
"is",
"a",
"wrapper",
"around",
"gdk_cursor_new_from_name",
"()",
"."
] | [
"func",
"CursorNewFromName",
"(",
"<mask>",
"*",
"Display",
",",
"name",
"string",
")",
"(",
"*",
"Cursor",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gdk_cursor_new_from_name",
"(",
"display",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n\n",
"return",
"&",
"Cursor",
"{",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"}",
",",
"nil",
"\n",
"}"
] |
23,504 | all-23505 | [
"Remove",
"indicates",
"an",
"expected",
"call",
"of",
"Remove"
] | [
"func",
"(",
"mr",
"*",
"MockControlMockRecorder",
")",
"Remove",
"(",
"arg0",
"<mask>",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"MockControl",
")",
"(",
"nil",
")",
".",
"Remove",
")",
",",
"arg0",
")",
"\n",
"}"
] |
23,505 | all-23506 | [
"Seek",
"is",
"implementation",
"of",
"io",
".",
"Seeker",
"s",
"Seek",
"."
] | [
"func",
"(",
"s",
"*",
"stream",
")",
"Seek",
"(",
"offset",
"int64",
",",
"whence",
"int",
")",
"(",
"int64",
",",
"error",
")",
"{",
"switch",
"whence",
"{",
"case",
"io",
".",
"SeekStart",
":",
"offset",
"=",
"offset",
"+",
"s",
".",
"headerSize",
"\n",
"case",
"io",
".",
"SeekCurrent",
":",
"case",
"io",
".",
"SeekEnd",
":",
"offset",
"=",
"s",
".",
"headerSize",
"+",
"s",
".",
"dataSize",
"+",
"offset",
"\n",
"whence",
"=",
"<mask>",
".",
"SeekStart",
"\n",
"}",
"\n",
"n",
",",
"err",
":=",
"s",
".",
"src",
".",
"Seek",
"(",
"offset",
",",
"whence",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"if",
"n",
"-",
"s",
".",
"headerSize",
"<",
"0",
"{",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"s",
".",
"remaining",
"=",
"s",
".",
"dataSize",
"-",
"(",
"n",
"-",
"s",
".",
"headerSize",
")",
"\n",
"// There could be a tail in wav file.",
"if",
"s",
".",
"remaining",
"<",
"0",
"{",
"s",
".",
"remaining",
"=",
"0",
"\n",
"return",
"s",
".",
"dataSize",
",",
"nil",
"\n",
"}",
"\n",
"return",
"n",
"-",
"s",
".",
"headerSize",
",",
"nil",
"\n",
"}"
] |
23,506 | all-23507 | [
"HasAggregator",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"ScatterplotRequest",
")",
"HasAggregator",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"Aggregator",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
23,507 | all-23508 | [
"NewClient",
"-",
"constructor",
"for",
"a",
"new",
"dispenser",
"client"
] | [
"func",
"NewClient",
"(",
"apiKey",
"string",
",",
"url",
"string",
",",
"client",
"clientDoer",
")",
"*",
"PDClient",
"{",
"return",
"&",
"PDClient",
"{",
"APIKey",
":",
"apiKey",
",",
"client",
":",
"client",
",",
"URL",
":",
"<mask>",
",",
"}",
"\n",
"}"
] |
23,508 | all-23509 | [
"getLedger",
"gets",
"a",
"copy",
"of",
"the",
"device",
"and",
"caches",
"it"
] | [
"func",
"getLedger",
"(",
")",
"(",
"*",
"ledger",
".",
"Ledger",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n",
"if",
"device",
"==",
"nil",
"{",
"device",
",",
"err",
"=",
"ledger",
".",
"FindLedger",
"(",
")",
"\n",
"}",
"\n",
"return",
"<mask>",
",",
"err",
"\n",
"}"
] |
23,509 | all-23510 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"<mask>",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
23,510 | all-23511 | [
"UpdateSpaceUsers",
"-"
] | [
"func",
"(",
"m",
"*",
"DefaultManager",
")",
"UpdateSpaceUsers",
"(",
")",
"error",
"{",
"uaaUsers",
",",
"err",
":=",
"m",
".",
"UAAMgr",
".",
"ListUsers",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"spaceConfigs",
",",
"err",
":=",
"m",
".",
"Cfg",
".",
"GetSpaceConfigs",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"input",
":=",
"<mask>",
"spaceConfigs",
"{",
"if",
"err",
":=",
"m",
".",
"updateSpaceUsers",
"(",
"&",
"input",
",",
"uaaUsers",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
23,511 | all-23512 | [
"LoadConfig",
"reads",
"the",
"yaml",
"config",
"at",
"path"
] | [
"func",
"LoadConfig",
"(",
"path",
"string",
",",
"orgs",
"string",
")",
"(",
"*",
"Configuration",
",",
"error",
")",
"{",
"if",
"path",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"var",
"c",
"Configuration",
"\n",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
"=",
"yaml",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"c",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
"=",
"c",
".",
"validate",
"(",
"orgs",
")",
";",
"err",
"!=",
"nil",
"{",
"// Ensure no dups",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"c",
",",
"nil",
"\n",
"}"
] |
23,512 | all-23513 | [
"RequestURI",
"returns",
"request",
"s",
"URI",
"."
] | [
"func",
"(",
"req",
"*",
"<mask>",
")",
"RequestURI",
"(",
")",
"[",
"]",
"byte",
"{",
"if",
"req",
".",
"parsedURI",
"{",
"requestURI",
":=",
"req",
".",
"uri",
".",
"RequestURI",
"(",
")",
"\n",
"req",
".",
"SetRequestURIBytes",
"(",
"requestURI",
")",
"\n",
"}",
"\n",
"return",
"req",
".",
"Header",
".",
"RequestURI",
"(",
")",
"\n",
"}"
] |
23,513 | all-23514 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"DetachFromTargetParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoTarget21",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
23,514 | all-23515 | [
"Unmarshal",
"deserializes",
"raw",
"into",
"the",
"out",
"value",
".",
"If",
"the",
"out",
"value",
"type",
"is",
"not",
"compatible",
"with",
"raw",
"a",
"*",
"bson",
".",
"TypeError",
"is",
"returned",
".",
"See",
"the",
"Unmarshal",
"function",
"documentation",
"for",
"more",
"details",
"on",
"the",
"unmarshalling",
"process",
"."
] | [
"func",
"(",
"raw",
"Raw",
")",
"Unmarshal",
"(",
"out",
"interface",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"handleErr",
"(",
"&",
"err",
")",
"\n",
"v",
":=",
"reflect",
".",
"ValueOf",
"(",
"out",
")",
"\n",
"switch",
"v",
".",
"Kind",
"(",
")",
"{",
"case",
"reflect",
".",
"Ptr",
":",
"v",
"=",
"v",
".",
"Elem",
"(",
")",
"\n",
"fallthrough",
"\n",
"case",
"reflect",
".",
"Map",
":",
"d",
":=",
"newDecoder",
"(",
"raw",
".",
"Data",
")",
"\n",
"good",
":=",
"d",
".",
"readElemTo",
"(",
"v",
",",
"raw",
".",
"Kind",
")",
"\n",
"if",
"!",
"good",
"{",
"return",
"&",
"TypeError",
"{",
"v",
".",
"<mask>",
"(",
")",
",",
"raw",
".",
"Kind",
"}",
"\n",
"}",
"\n",
"case",
"reflect",
".",
"Struct",
":",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"default",
":",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
23,515 | all-23516 | [
"Release",
"decrements",
"a",
"socket",
"reference",
".",
"The",
"socket",
"will",
"be",
"recycled",
"once",
"its",
"released",
"as",
"many",
"times",
"as",
"it",
"s",
"been",
"acquired",
"."
] | [
"func",
"(",
"socket",
"*",
"mongoSocket",
")",
"Release",
"(",
")",
"{",
"socket",
".",
"Lock",
"(",
")",
"\n",
"if",
"socket",
".",
"references",
"==",
"0",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"socket",
".",
"references",
"--",
"\n",
"stats",
".",
"socketRefs",
"(",
"-",
"1",
")",
"\n",
"if",
"socket",
".",
"references",
"==",
"0",
"{",
"stats",
".",
"socketsInUse",
"(",
"-",
"1",
")",
"\n",
"server",
":=",
"socket",
".",
"server",
"\n",
"socket",
".",
"Unlock",
"(",
")",
"\n",
"<mask>",
".",
"LogoutAll",
"(",
")",
"\n",
"// If the socket is dead server is nil.",
"if",
"server",
"!=",
"nil",
"{",
"server",
".",
"RecycleSocket",
"(",
"socket",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"socket",
".",
"Unlock",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
23,516 | all-23517 | [
"/",
"*",
"dgr",
"/",
"yopla"
] | [
"func",
"(",
"n",
"ACFullname",
")",
"ShortName",
"(",
")",
"string",
"{",
"name",
":=",
"n",
".",
"Name",
"(",
")",
"\n",
"if",
"!",
"strings",
".",
"Contains",
"(",
"name",
",",
"\"",
"\"",
")",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"strings",
".",
"SplitN",
"(",
"n",
".",
"Name",
"(",
")",
",",
"\"",
"\"",
",",
"2",
")",
"[",
"1",
"]",
"\n",
"}"
] |
23,517 | all-23518 | [
"Save",
"the",
"current",
"session",
"."
] | [
"func",
"(",
"s",
"*",
"Session",
")",
"Save",
"(",
")",
"error",
"{",
"return",
"s",
".",
"<mask>",
".",
"Save",
"(",
"s",
".",
"req",
",",
"s",
".",
"res",
")",
"\n",
"}"
] |
23,518 | all-23519 | [
"TODO",
"(",
"jrick",
")",
"GtkIconSet",
"/",
"*",
"func",
"(",
"v",
"*",
"Image",
")",
"SetFromIconSet",
"()",
"{",
"}",
"TODO",
"(",
"jrick",
")",
"GdkPixbufAnimation",
"/",
"*",
"func",
"(",
"v",
"*",
"Image",
")",
"SetFromAnimation",
"()",
"{",
"}",
"SetFromIconName",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_image_set_from_icon_name",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Image",
")",
"SetFromIconName",
"(",
"iconName",
"string",
",",
"<mask>",
"IconSize",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"iconName",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_image_set_from_icon_name",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"C",
".",
"GtkIconSize",
"(",
"size",
")",
")",
"\n",
"}"
] |
23,519 | all-23520 | [
"Unregisters",
"Handler",
"from",
"the",
"EventController",
".",
"This",
"is",
"idempotent",
"where",
"if",
"a",
"Handler",
"is",
"not",
"registered",
"no",
"error",
"is",
"returned",
"."
] | [
"func",
"(",
"e",
"*",
"EventController",
")",
"UnregisterHandler",
"(",
"n",
"string",
")",
"error",
"{",
"e",
".",
"handlerMutex",
".",
"Lock",
"(",
")",
"\n",
"<mask>",
"(",
"e",
".",
"Handlers",
",",
"n",
")",
"\n",
"e",
".",
"handlerMutex",
".",
"Unlock",
"(",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
23,520 | all-23521 | [
"Do",
"performs",
"a",
"Request",
"using",
"macaroon",
"authentication",
"if",
"set",
"."
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"<mask>",
"(",
"req",
"*",
"http",
".",
"Request",
")",
"(",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"if",
"r",
".",
"bakeryClient",
"!=",
"nil",
"{",
"r",
".",
"addMacaroonHeaders",
"(",
"req",
")",
"\n",
"return",
"r",
".",
"bakeryClient",
".",
"Do",
"(",
"req",
")",
"\n",
"}",
"\n\n",
"return",
"r",
".",
"http",
".",
"Do",
"(",
"req",
")",
"\n",
"}"
] |
23,521 | all-23522 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"DispatchKeyEventParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoInput9",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
23,522 | all-23523 | [
"HasLayoutVersion",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"HasLayoutVersion",
"(",
")",
"bool",
"{",
"if",
"w",
"!=",
"nil",
"&&",
"w",
".",
"LayoutVersion",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
23,523 | all-23524 | [
"DoDeadline",
"performs",
"the",
"given",
"request",
"and",
"waits",
"for",
"response",
"until",
"the",
"given",
"deadline",
".",
"Request",
"must",
"contain",
"at",
"least",
"non",
"-",
"zero",
"RequestURI",
"with",
"full",
"url",
"(",
"including",
"scheme",
"and",
"host",
")",
"or",
"non",
"-",
"zero",
"Host",
"header",
"+",
"RequestURI",
".",
"The",
"function",
"doesn",
"t",
"follow",
"redirects",
".",
"Response",
"is",
"ignored",
"if",
"resp",
"is",
"nil",
".",
"ErrTimeout",
"is",
"returned",
"if",
"the",
"response",
"wasn",
"t",
"returned",
"until",
"the",
"given",
"deadline",
".",
"It",
"is",
"recommended",
"obtaining",
"req",
"and",
"resp",
"via",
"AcquireRequest",
"and",
"AcquireResponse",
"in",
"performance",
"-",
"critical",
"code",
"."
] | [
"func",
"(",
"c",
"*",
"PipelineClient",
")",
"DoDeadline",
"(",
"req",
"*",
"Request",
",",
"resp",
"*",
"<mask>",
",",
"deadline",
"time",
".",
"Time",
")",
"error",
"{",
"return",
"c",
".",
"getConnClient",
"(",
")",
".",
"DoDeadline",
"(",
"req",
",",
"resp",
",",
"deadline",
")",
"\n",
"}"
] |
23,524 | all-23525 | [
"Write",
"allows",
"GRPCInfoWriter",
"to",
"implement",
"the",
"io",
".",
"Writer",
"interface",
".",
"This",
"will",
"take",
"gRPC",
"logs",
"which",
"look",
"something",
"like",
"this",
":",
"INFO",
":",
"2019",
"/",
"02",
"/",
"18",
"12",
":",
"21",
":",
"54",
"ClientConn",
"switching",
"balancer",
"to",
"pick_first",
"strip",
"out",
"redundant",
"content",
"and",
"print",
"the",
"message",
"at",
"the",
"appropriate",
"log",
"level",
"in",
"logrus",
".",
"Any",
"parse",
"errors",
"of",
"the",
"log",
"message",
"will",
"be",
"reported",
"in",
"logrus",
"as",
"well",
"."
] | [
"func",
"(",
"l",
"*",
"GRPCLogWriter",
")",
"Write",
"(",
"p",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"parts",
":=",
"strings",
".",
"SplitN",
"(",
"string",
"(",
"p",
")",
",",
"\"",
"\"",
",",
"4",
")",
"\n",
"entry",
":=",
"l",
".",
"logger",
".",
"WithField",
"(",
"\"",
"\"",
",",
"l",
".",
"source",
")",
"\n\n",
"if",
"len",
"(",
"parts",
")",
"==",
"4",
"{",
"// parts[1] and parts[2] contain the date and time, but logrus already",
"// adds this under the `time` entry field, so it's not needed (though",
"// the time will presumably be marginally ahead of the original log",
"// message)",
"level",
":=",
"parts",
"[",
"0",
"]",
"\n",
"message",
":=",
"strings",
".",
"TrimSpace",
"(",
"parts",
"[",
"3",
"]",
")",
"\n\n",
"if",
"level",
"==",
"\"",
"\"",
"{",
"entry",
".",
"Info",
"(",
"message",
")",
"\n",
"}",
"else",
"if",
"level",
"==",
"\"",
"\"",
"{",
"entry",
".",
"Error",
"(",
"message",
")",
"\n",
"}",
"else",
"if",
"level",
"==",
"\"",
"\"",
"{",
"entry",
".",
"Warning",
"(",
"message",
")",
"\n",
"}",
"else",
"if",
"<mask>",
"==",
"\"",
"\"",
"{",
"// no need to call fatal ourselves because gRPC will exit the",
"// process",
"entry",
".",
"Error",
"(",
"message",
")",
"\n",
"}",
"else",
"{",
"entry",
".",
"Error",
"(",
"message",
")",
"\n",
"entry",
".",
"Error",
"(",
"\"",
"\"",
",",
"level",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"// can't format the message -- just display the contents",
"entry",
":=",
"l",
".",
"logger",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",
"\"",
"\"",
":",
"l",
".",
"source",
",",
"}",
")",
"\n",
"entry",
".",
"Error",
"(",
"p",
")",
"\n",
"entry",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"len",
"(",
"p",
")",
",",
"nil",
"\n",
"}"
] |
23,525 | all-23526 | [
"WriteFile",
"-"
] | [
"func",
"WriteFile",
"(",
"configFile",
"string",
",",
"dataType",
"interface",
"{",
"}",
")",
"error",
"{",
"<mask>",
",",
"err",
":=",
"yaml",
".",
"Marshal",
"(",
"dataType",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"WriteFileBytes",
"(",
"configFile",
",",
"data",
")",
"\n",
"}"
] |
23,526 | all-23527 | [
"specify",
"storage",
"for",
"a",
"two",
"-",
"dimensional",
"multisample",
"array",
"texture"
] | [
"func",
"TexStorage3DMultisample",
"(",
"target",
"uint32",
",",
"samples",
"int32",
",",
"internalformat",
"uint32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"depth",
"int32",
",",
"fixedsamplelocations",
"bool",
")",
"{",
"C",
".",
"glowTexStorage3DMultisample",
"(",
"gpTexStorage3DMultisample",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"samples",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"internalformat",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"height",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"depth",
")",
",",
"(",
"C",
".",
"GLboolean",
")",
"(",
"boolToInt",
"(",
"fixedsamplelocations",
")",
")",
")",
"\n",
"}"
] |
23,527 | all-23528 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"Key",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoIndexeddb10",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
23,528 | all-23529 | [
"GetChannelsUsage",
"returns",
"detailed",
"usage",
"on",
"channels",
"."
] | [
"func",
"(",
"h",
"*",
"Handler",
")",
"GetChannelsUsage",
"(",
"tkn",
"string",
",",
"<mask>",
"[",
"]",
"string",
")",
"(",
"map",
"[",
"string",
"]",
"Usage",
",",
"error",
")",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"ids",
")",
"\n\n",
"if",
"!",
"h",
".",
"token",
".",
"Check",
"(",
"tkn",
")",
"{",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
",",
"ErrAccessDenied",
"\n",
"}",
"\n\n",
"return",
"h",
".",
"getChannelsUsages",
"(",
"logger",
",",
"ids",
")",
"\n",
"}"
] |
23,529 | all-23530 | [
"Add",
"adds",
"a",
"new",
"set",
"of",
"container",
"stats",
"to",
"the",
"queue",
"."
] | [
"func",
"(",
"queue",
"*",
"Queue",
")",
"Add",
"(",
"dockerStat",
"*",
"types",
".",
"StatsJSON",
")",
"error",
"{",
"queue",
".",
"setLastStat",
"(",
"dockerStat",
")",
"\n",
"stat",
",",
"err",
":=",
"dockerStatsToContainerStats",
"(",
"dockerStat",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"queue",
".",
"<mask>",
"(",
"stat",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
23,530 | all-23531 | [
"Write",
"implements",
"Handler",
"interface"
] | [
"func",
"(",
"h",
"*",
"TimeRotatingFileHandler",
")",
"Write",
"(",
"b",
"[",
"]",
"<mask>",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"h",
".",
"doRollover",
"(",
")",
"\n",
"return",
"h",
".",
"fd",
".",
"Write",
"(",
"b",
")",
"\n",
"}"
] |
23,531 | all-23532 | [
"GetCgroupMountPath",
"returns",
"cgroup",
"mount",
"path",
"of",
"the",
"resource"
] | [
"func",
"(",
"cgroup",
"*",
"CgroupResource",
")",
"GetCgroupMountPath",
"(",
")",
"string",
"{",
"cgroup",
".",
"<mask>",
".",
"RLock",
"(",
")",
"\n",
"defer",
"cgroup",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"cgroup",
".",
"cgroupMountPath",
"\n",
"}"
] |
23,532 | all-23533 | [
"NewEC2MetadataClient",
"creates",
"an",
"ec2metadata",
"client",
"to",
"retrieve",
"metadata"
] | [
"func",
"NewEC2MetadataClient",
"(",
"client",
"HttpClient",
")",
"EC2MetadataClient",
"{",
"if",
"client",
"==",
"nil",
"{",
"return",
"&",
"ec2MetadataClientImpl",
"{",
"<mask>",
":",
"ec2metadata",
".",
"New",
"(",
"session",
".",
"New",
"(",
")",
",",
"aws",
".",
"NewConfig",
"(",
")",
".",
"WithMaxRetries",
"(",
"metadataRetries",
")",
")",
",",
"}",
"\n",
"}",
"else",
"{",
"return",
"&",
"ec2MetadataClientImpl",
"{",
"client",
":",
"client",
"}",
"\n",
"}",
"\n",
"}"
] |
23,533 | all-23534 | [
"GetCairoContext",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_context_get_cairo_context",
"()",
"."
] | [
"func",
"(",
"pc",
"*",
"PrintContext",
")",
"GetCairoContext",
"(",
")",
"*",
"cairo",
".",
"Context",
"{",
"c",
":=",
"C",
".",
"gtk_print_context_get_cairo_context",
"(",
"<mask>",
".",
"native",
"(",
")",
")",
"\n",
"return",
"cairo",
".",
"WrapContext",
"(",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
"\n",
"}"
] |
23,534 | all-23535 | [
"GetPopup",
"is",
"a",
"wrapper",
"around",
"gtk_menu_button_get_popup",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"MenuButton",
")",
"GetPopup",
"(",
")",
"*",
"<mask>",
"{",
"c",
":=",
"C",
".",
"gtk_menu_button_get_popup",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"wrapMenu",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
"\n",
"}"
] |
23,535 | all-23536 | [
"copy",
"a",
"block",
"of",
"pixels",
"from",
"one",
"framebuffer",
"object",
"to",
"another"
] | [
"func",
"BlitFramebuffer",
"(",
"srcX0",
"int32",
",",
"srcY0",
"int32",
",",
"srcX1",
"int32",
",",
"srcY1",
"int32",
",",
"dstX0",
"int32",
",",
"dstY0",
"int32",
",",
"dstX1",
"int32",
",",
"dstY1",
"int32",
",",
"mask",
"uint32",
",",
"filter",
"uint32",
")",
"{",
"C",
".",
"glowBlitFramebuffer",
"(",
"gpBlitFramebuffer",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"srcX0",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"srcY0",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"srcX1",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"srcY1",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"dstX0",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"dstY0",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"dstX1",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"dstY1",
")",
",",
"(",
"C",
".",
"GLbitfield",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"filter",
")",
")",
"\n",
"}"
] |
23,536 | all-23537 | [
"uppercase",
"first",
"character"
] | [
"func",
"(",
"<mask>",
"*",
"Ruleset",
")",
"Capitalize",
"(",
"word",
"string",
")",
"string",
"{",
"return",
"strings",
".",
"ToUpper",
"(",
"word",
"[",
":",
"1",
"]",
")",
"+",
"word",
"[",
"1",
":",
"]",
"\n",
"}"
] |
23,537 | all-23538 | [
"serverConn",
"returns",
"a",
"loggingConn",
"at",
"the",
"opposite",
"end",
"of",
"the",
"loggingPipe",
"of",
"clientConn",
"(",
"see",
"the",
"clientConn",
"description",
"for",
"more",
"information",
")"
] | [
"func",
"(",
"p",
"*",
"loggingPipe",
")",
"serverConn",
"(",
")",
"*",
"loggingConn",
"{",
"return",
"&",
"loggingConn",
"{",
"<mask>",
":",
"p",
",",
"r",
":",
"p",
".",
"serverReader",
",",
"w",
":",
"p",
".",
"clientWriter",
",",
"}",
"\n",
"}"
] |
23,538 | all-23539 | [
"NewTargets",
"is",
"a",
"convenience",
"method",
"to",
"create",
"a",
"new",
"Targets",
"object",
"from",
"a",
"vararg",
"of",
"strings"
] | [
"func",
"NewTargets",
"(",
"<mask>",
"...",
"string",
")",
"Targets",
"{",
"t",
":=",
"make",
"(",
"Targets",
",",
"0",
",",
"len",
"(",
"target",
")",
")",
"\n",
"t",
"=",
"append",
"(",
"t",
",",
"target",
"...",
")",
"\n",
"return",
"t",
"\n",
"}"
] |
23,539 | all-23540 | [
"Translate",
"translates",
"the",
"matrix",
"by",
"(",
"tx",
"ty",
")",
"."
] | [
"func",
"(",
"g",
"*",
"GeoM",
")",
"Translate",
"(",
"tx",
",",
"ty",
"float64",
")",
"{",
"g",
".",
"tx",
"+=",
"float32",
"(",
"<mask>",
")",
"\n",
"g",
".",
"ty",
"+=",
"float32",
"(",
"ty",
")",
"\n",
"}"
] |
23,540 | all-23541 | [
"SetShowCloseButton",
"is",
"a",
"wrapper",
"around",
"gtk_search_bar_set_show_close_button",
"()"
] | [
"func",
"(",
"v",
"*",
"SearchBar",
")",
"SetShowCloseButton",
"(",
"<mask>",
"bool",
")",
"{",
"C",
".",
"gtk_search_bar_set_show_close_button",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"visible",
")",
")",
"\n",
"}"
] |
23,541 | all-23542 | [
"SetKnownStatus",
"safely",
"sets",
"the",
"currently",
"known",
"status",
"of",
"the",
"resource"
] | [
"func",
"(",
"cgroup",
"*",
"CgroupResource",
")",
"SetKnownStatus",
"(",
"<mask>",
"resourcestatus",
".",
"ResourceStatus",
")",
"{",
"cgroup",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"cgroup",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"cgroup",
".",
"knownStatusUnsafe",
"=",
"status",
"\n",
"cgroup",
".",
"updateAppliedStatusUnsafe",
"(",
"status",
")",
"\n",
"}"
] |
23,542 | all-23543 | [
"Fatal",
"logging"
] | [
"func",
"(",
"l",
"*",
"StdLevelLogger",
")",
"Fatal",
"(",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"l",
".",
"logFunc",
"(",
"FatalLevel",
",",
"l",
".",
"<mask>",
",",
"args",
"...",
")",
"\n",
"}"
] |
23,543 | all-23544 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetProcessInfoReturns",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoSysteminfo1",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
23,544 | all-23545 | [
"FailPipeline",
"updates",
"the",
"pipeline",
"s",
"state",
"to",
"failed",
"and",
"sets",
"the",
"failure",
"reason"
] | [
"func",
"FailPipeline",
"(",
"ctx",
"context",
".",
"Context",
",",
"etcdClient",
"*",
"etcd",
".",
"Client",
",",
"pipelinesCollection",
"col",
".",
"Collection",
",",
"pipelineName",
"string",
",",
"<mask>",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"col",
".",
"NewSTM",
"(",
"ctx",
",",
"etcdClient",
",",
"func",
"(",
"stm",
"col",
".",
"STM",
")",
"error",
"{",
"pipelines",
":=",
"pipelinesCollection",
".",
"ReadWrite",
"(",
"stm",
")",
"\n",
"pipelinePtr",
":=",
"new",
"(",
"pps",
".",
"EtcdPipelineInfo",
")",
"\n",
"if",
"err",
":=",
"pipelines",
".",
"Get",
"(",
"pipelineName",
",",
"pipelinePtr",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"pipelinePtr",
".",
"State",
"=",
"pps",
".",
"PipelineState_PIPELINE_FAILURE",
"\n",
"pipelinePtr",
".",
"Reason",
"=",
"reason",
"\n",
"pipelines",
".",
"Put",
"(",
"pipelineName",
",",
"pipelinePtr",
")",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
23,545 | all-23546 | [
"IsFile",
"tests",
"the",
"existence",
"of",
"a",
"file",
"in",
"the",
"guest",
"operating",
"system",
".",
"Parameters",
":",
"filepath",
":",
"The",
"path",
"to",
"the",
"file",
"to",
"be",
"tested",
".",
"Remarks",
":",
"*",
"Only",
"absolute",
"paths",
"should",
"be",
"used",
"for",
"files",
"in",
"the",
"guest",
";",
"the",
"resolution",
"of",
"relative",
"paths",
"is",
"not",
"specified",
".",
"*",
"If",
"filepath",
"exists",
"as",
"a",
"file",
"system",
"object",
"but",
"is",
"not",
"a",
"normal",
"file",
"(",
"e",
".",
"g",
".",
"it",
"is",
"a",
"directory",
"device",
"UNIX",
"domain",
"socket",
"etc",
")",
"then",
"VIX_OK",
"is",
"returned",
"and",
"VIX_PROPERTY_JOB_RESULT_GUEST_OBJECT_EXISTS",
"is",
"set",
"to",
"FALSE",
".",
"Since",
"VMware",
"Workstation",
"6",
".",
"0",
"Minimum",
"Supported",
"Guest",
"OS",
":",
"Microsoft",
"Windows",
"NT",
"Series",
"Linux"
] | [
"func",
"(",
"g",
"*",
"Guest",
")",
"IsFile",
"(",
"filepath",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"var",
"jobHandle",
"C",
".",
"VixHandle",
"=",
"C",
".",
"VIX_INVALID_HANDLE",
"\n",
"var",
"err",
"C",
".",
"VixError",
"=",
"C",
".",
"VIX_OK",
"\n",
"var",
"result",
"C",
".",
"int",
"\n\n",
"fpath",
":=",
"C",
".",
"CString",
"(",
"filepath",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"fpath",
")",
")",
"\n\n",
"jobHandle",
"=",
"C",
".",
"VixVM_FileExistsInGuest",
"(",
"g",
".",
"handle",
",",
"fpath",
",",
"// dir path name",
"nil",
",",
"// callbackProc",
"nil",
")",
"// clientData",
"\n\n",
"defer",
"C",
".",
"Vix_ReleaseHandle",
"(",
"jobHandle",
")",
"\n\n",
"err",
"=",
"C",
".",
"is_file_or_dir",
"(",
"jobHandle",
",",
"&",
"result",
")",
"\n",
"if",
"C",
".",
"VIX_OK",
"!=",
"err",
"{",
"return",
"false",
",",
"&",
"Error",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"int",
"(",
"err",
"&",
"0xFFFF",
")",
",",
"Text",
":",
"C",
".",
"GoString",
"(",
"C",
".",
"Vix_GetErrorText",
"(",
"err",
",",
"nil",
")",
")",
",",
"}",
"\n",
"}",
"\n\n",
"if",
"int",
"(",
"<mask>",
")",
"==",
"C",
".",
"FALSE",
"{",
"return",
"false",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"true",
",",
"nil",
"\n",
"}"
] |
23,546 | all-23547 | [
"RegistryRepoName",
"returns",
"the",
"repository",
"as",
"used",
"in",
"the",
"registry",
"URL"
] | [
"func",
"(",
"n",
"ImageName",
")",
"RegistryRepoName",
"(",
")",
"string",
"{",
"repo",
":=",
"n",
".",
"Repository",
"\n",
"if",
"repo",
"==",
"\"",
"\"",
"{",
"repo",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"repo",
",",
"n",
".",
"<mask>",
")",
"\n",
"}"
] |
23,547 | all-23548 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"BreakLocationType",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"BreakLocationType",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"BreakLocationTypeDebuggerStatement",
":",
"*",
"t",
"=",
"BreakLocationTypeDebuggerStatement",
"\n",
"case",
"BreakLocationTypeCall",
":",
"*",
"t",
"=",
"BreakLocationTypeCall",
"\n",
"<mask>",
"BreakLocationTypeReturn",
":",
"*",
"t",
"=",
"BreakLocationTypeReturn",
"\n\n",
"default",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
] |
23,548 | all-23549 | [
"GetCluster",
"returns",
"information",
"about",
"a",
"cluster",
"If",
"this",
"client",
"is",
"not",
"trusted",
"the",
"password",
"must",
"be",
"supplied"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetCluster",
"(",
")",
"(",
"*",
"api",
".",
"Cluster",
",",
"string",
",",
"error",
")",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"cluster",
":=",
"&",
"api",
".",
"Cluster",
"{",
"}",
"\n",
"etag",
",",
"err",
":=",
"r",
".",
"queryStruct",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"\"",
"\"",
",",
"&",
"cluster",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"<mask>",
"nil",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"cluster",
",",
"etag",
",",
"nil",
"\n",
"}"
] |
23,549 | all-23550 | [
"Close",
"closes",
"the",
"stream",
".",
"When",
"closing",
"the",
"stream",
"owned",
"by",
"the",
"player",
"will",
"also",
"be",
"closed",
"by",
"calling",
"its",
"Close",
".",
"This",
"means",
"that",
"the",
"source",
"stream",
"passed",
"via",
"NewPlayer",
"will",
"also",
"be",
"closed",
".",
"Close",
"returns",
"error",
"when",
"closing",
"the",
"source",
"returns",
"error",
"."
] | [
"func",
"(",
"p",
"*",
"Player",
")",
"Close",
"(",
")",
"<mask>",
"{",
"runtime",
".",
"SetFinalizer",
"(",
"p",
",",
"nil",
")",
"\n",
"return",
"p",
".",
"p",
".",
"Close",
"(",
")",
"\n",
"}"
] |
23,550 | all-23551 | [
"GetEndOk",
"returns",
"a",
"tuple",
"with",
"the",
"End",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"d",
"*",
"Downtime",
")",
"GetEndOk",
"(",
")",
"(",
"int",
",",
"bool",
")",
"{",
"if",
"d",
"==",
"nil",
"||",
"d",
".",
"End",
"==",
"nil",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"d",
".",
"End",
",",
"<mask>",
"\n",
"}"
] |
23,551 | all-23552 | [
"Skew",
"skews",
"the",
"matrix",
"by",
"(",
"skewX",
"skewY",
")",
".",
"The",
"unit",
"is",
"radian",
"."
] | [
"func",
"(",
"g",
"*",
"GeoM",
")",
"Skew",
"(",
"skewX",
",",
"skewY",
"float64",
")",
"{",
"sx64",
":=",
"math",
".",
"Tan",
"(",
"skewX",
")",
"\n",
"sy64",
":=",
"math",
".",
"Tan",
"(",
"skewY",
")",
"\n",
"sx",
",",
"sy",
":=",
"float32",
"(",
"sx64",
")",
",",
"float32",
"(",
"sy64",
")",
"\n\n",
"a",
":=",
"(",
"g",
".",
"a_1",
"+",
"1",
")",
"+",
"g",
".",
"c",
"*",
"sx",
"\n",
"b",
":=",
"g",
".",
"b",
"+",
"(",
"g",
".",
"d_1",
"+",
"1",
")",
"*",
"sx",
"\n",
"c",
":=",
"(",
"g",
".",
"a_1",
"+",
"1",
")",
"*",
"sy",
"+",
"g",
".",
"c",
"\n",
"d",
":=",
"g",
".",
"b",
"*",
"sy",
"+",
"(",
"g",
".",
"d_1",
"+",
"1",
")",
"\n",
"<mask>",
":=",
"g",
".",
"tx",
"+",
"g",
".",
"ty",
"*",
"sx",
"\n",
"ty",
":=",
"g",
".",
"ty",
"+",
"g",
".",
"tx",
"*",
"sy",
"\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",
"}"
] |
23,552 | all-23553 | [
"Clean",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockManager",
")",
"Clean",
"(",
"arg0",
"string",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
23,553 | all-23554 | [
"In",
"this",
"example",
"we",
"will",
"see",
"how",
"custom",
"templates",
"are",
"cached",
"the",
"same",
"code",
"snippet",
"(",
"httpcache",
".",
"CacheFasthttp",
")",
"is",
"working",
"for",
"fasthttp",
"-",
"everything",
"else",
".",
"Here",
"we",
"re",
"using",
"a",
"custom",
"package",
"which",
"handles",
"the",
"templates",
"with",
"ease",
"you",
"can",
"use",
"the",
"standard",
"way",
"too",
"."
] | [
"func",
"init",
"(",
")",
"{",
"e",
":=",
"<mask>",
".",
"New",
"(",
"html",
".",
"Config",
"{",
"Layout",
":",
"\"",
"\"",
"}",
")",
"\n",
"template",
".",
"AddEngine",
"(",
"e",
")",
"\n",
"if",
"err",
":=",
"template",
".",
"Load",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"}"
] |
23,554 | all-23555 | [
"Unsubscribe",
"handler",
"from",
"the",
"bus",
".",
"It",
"will",
"return",
"false",
"if",
"the",
"handler",
"not",
"subscribed",
"."
] | [
"func",
"(",
"b",
"*",
"Bus",
")",
"Unsubscribe",
"(",
"h",
"<mask>",
")",
"bool",
"{",
"b",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"b",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"for",
"i",
",",
"v",
":=",
"range",
"b",
".",
"handlers",
"{",
"if",
"v",
"==",
"h",
"{",
"b",
".",
"handlers",
"=",
"append",
"(",
"b",
".",
"handlers",
"[",
":",
"i",
"]",
",",
"b",
".",
"handlers",
"[",
"i",
"+",
"1",
":",
"]",
"...",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
23,555 | all-23556 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetInlineStylesForNodeReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss43",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
23,556 | all-23557 | [
"Delete",
"a",
"role",
".",
"This",
"operation",
"will",
"succeed",
"regardless",
"of",
"whether",
"or",
"not",
"the",
"role",
"exists",
".",
"Required",
"scopes",
":",
"auth",
":",
"delete",
"-",
"role",
":",
"<roleId",
">",
"See",
"#deleteRole"
] | [
"func",
"(",
"auth",
"*",
"Auth",
")",
"DeleteRole",
"(",
"roleId",
"string",
")",
"error",
"{",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"auth",
")",
"\n",
"_",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"<mask>",
".",
"QueryEscape",
"(",
"roleId",
")",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
23,557 | all-23558 | [
"NewHandler",
"returns",
"new",
"Handler",
"instance",
"."
] | [
"func",
"NewHandler",
"(",
"counter",
"*",
"Counter",
",",
"level",
"logging",
".",
"Level",
")",
"(",
"h",
"*",
"Handler",
")",
"{",
"return",
"&",
"Handler",
"{",
"Counter",
":",
"<mask>",
",",
"Level",
":",
"level",
",",
"}",
"\n",
"}"
] |
23,558 | all-23559 | [
"Validate",
"the",
"request",
"signature",
"given",
"on",
"input",
"and",
"return",
"list",
"of",
"scopes",
"that",
"the",
"authenticating",
"client",
"has",
".",
"This",
"method",
"is",
"used",
"by",
"other",
"services",
"that",
"wish",
"rely",
"on",
"Taskcluster",
"credentials",
"for",
"authentication",
".",
"This",
"way",
"we",
"can",
"use",
"Hawk",
"without",
"having",
"the",
"secret",
"credentials",
"leave",
"this",
"service",
".",
"See",
"#authenticateHawk"
] | [
"func",
"(",
"auth",
"*",
"Auth",
")",
"AuthenticateHawk",
"(",
"payload",
"*",
"HawkSignatureAuthenticationRequest",
")",
"(",
"*",
"HawkSignatureAuthenticationResponse",
",",
"error",
")",
"{",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"auth",
")",
"\n",
"responseObject",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"payload",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"<mask>",
"(",
"HawkSignatureAuthenticationResponse",
")",
",",
"nil",
")",
"\n",
"return",
"responseObject",
".",
"(",
"*",
"HawkSignatureAuthenticationResponse",
")",
",",
"err",
"\n",
"}"
] |
23,559 | all-23560 | [
"copy",
"a",
"two",
"-",
"dimensional",
"texture",
"subimage"
] | [
"func",
"CopyTextureSubImage2D",
"(",
"texture",
"uint32",
",",
"level",
"int32",
",",
"xoffset",
"int32",
",",
"yoffset",
"int32",
",",
"x",
"int32",
",",
"y",
"int32",
",",
"width",
"int32",
",",
"<mask>",
"int32",
")",
"{",
"C",
".",
"glowCopyTextureSubImage2D",
"(",
"gpCopyTextureSubImage2D",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"texture",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"level",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"xoffset",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"yoffset",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"x",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"y",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"height",
")",
")",
"\n",
"}"
] |
23,560 | all-23561 | [
"ReMap",
"returns",
"a",
"PathMapper",
"that",
"compares",
"file",
"paths",
"to",
"the",
"input",
"pattern",
"and",
"maps",
"matches",
"to",
"the",
"replacement",
"string",
"(",
"see",
"Regexp",
".",
"ReplaceAllString",
")",
"."
] | [
"func",
"ReMap",
"(",
"pattern",
"string",
",",
"replacement",
"string",
")",
"PathMapper",
"{",
"re",
":=",
"regexp",
".",
"MustCompile",
"(",
"pattern",
")",
"\n",
"return",
"func",
"(",
"filePath",
"string",
")",
"string",
"{",
"if",
"!",
"<mask>",
".",
"MatchString",
"(",
"filePath",
")",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"re",
".",
"ReplaceAllString",
"(",
"filePath",
",",
"replacement",
")",
"\n",
"}",
"\n",
"}"
] |
23,561 | all-23562 | [
"ExtractAll",
"cluster",
"state",
"as",
"a",
"slice",
"of",
"operations",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"ExtractAll",
"(",
"objects",
"bool",
")",
"(",
"[",
"]",
"*",
"admin",
".",
"Op",
",",
"error",
")",
"{",
"var",
"result",
"[",
"]",
"*",
"admin",
".",
"Op",
"\n",
"if",
"err",
":=",
"c",
".",
"Extract",
"(",
"objects",
",",
"func",
"(",
"op",
"*",
"admin",
".",
"Op",
")",
"error",
"{",
"result",
"=",
"append",
"(",
"result",
",",
"op",
")",
"\n",
"return",
"nil",
"\n",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}"
] |
23,562 | all-23563 | [
"MustAccount",
"retrieves",
"the",
"Account",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"LedgerEntryData",
")",
"MustAccount",
"(",
")",
"AccountEntry",
"{",
"val",
",",
"<mask>",
":=",
"u",
".",
"GetAccount",
"(",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
23,563 | all-23564 | [
"ToIP",
"returns",
"equivalent",
"net",
".",
"IP",
"."
] | [
"func",
"(",
"n",
"NetworkNumber",
")",
"ToIP",
"(",
")",
"net",
".",
"IP",
"{",
"ip",
":=",
"make",
"(",
"net",
".",
"IP",
",",
"len",
"(",
"n",
")",
"*",
"BytePerUint32",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"n",
")",
";",
"i",
"++",
"{",
"idx",
":=",
"i",
"*",
"net",
".",
"IPv4len",
"\n",
"binary",
".",
"BigEndian",
".",
"PutUint32",
"(",
"ip",
"[",
"idx",
":",
"idx",
"+",
"net",
".",
"IPv4len",
"]",
",",
"n",
"[",
"i",
"]",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"ip",
")",
"==",
"net",
".",
"IPv4len",
"{",
"ip",
"=",
"net",
".",
"IPv4",
"(",
"ip",
"[",
"0",
"]",
",",
"<mask>",
"[",
"1",
"]",
",",
"ip",
"[",
"2",
"]",
",",
"ip",
"[",
"3",
"]",
")",
"\n",
"}",
"\n",
"return",
"ip",
"\n",
"}"
] |
23,564 | all-23565 | [
"HasX",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"ScatterplotRequests",
")",
"HasX",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"X",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
23,565 | all-23566 | [
"SendHtml",
"sends",
"the",
"message",
"as",
"HTML",
"as",
"defined",
"by",
"XEP",
"-",
"0071"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"SendHtml",
"(",
"chat",
"Chat",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"return",
"fmt",
".",
"Fprintf",
"(",
"c",
".",
"conn",
",",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"xmlEscape",
"(",
"chat",
".",
"Remote",
")",
",",
"xmlEscape",
"(",
"chat",
".",
"<mask>",
")",
",",
"xmlEscape",
"(",
"chat",
".",
"Text",
")",
",",
"chat",
".",
"Text",
")",
"\n",
"}"
] |
23,566 | all-23567 | [
"Add",
"an",
"Ip",
"address",
"to",
"an",
"interface",
".",
"This",
"is",
"identical",
"to",
":",
"ip",
"addr",
"add",
"$ip",
"/",
"$ipNet",
"dev",
"$iface"
] | [
"func",
"NetworkLinkAddIp",
"(",
"iface",
"*",
"net",
".",
"Interface",
",",
"ip",
"net",
".",
"IP",
",",
"ipNet",
"*",
"<mask>",
".",
"IPNet",
")",
"error",
"{",
"return",
"networkLinkIpAction",
"(",
"syscall",
".",
"RTM_NEWADDR",
",",
"syscall",
".",
"NLM_F_CREATE",
"|",
"syscall",
".",
"NLM_F_EXCL",
"|",
"syscall",
".",
"NLM_F_ACK",
",",
"IfAddr",
"{",
"iface",
",",
"ip",
",",
"ipNet",
"}",
",",
")",
"\n",
"}"
] |
23,567 | all-23568 | [
"Status",
"sends",
"a",
"string",
"to",
"HipChat",
"to",
"indicate",
"whether",
"the",
"client",
"is",
"available",
"to",
"chat",
"away",
"or",
"idle",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"Status",
"(",
"s",
"string",
")",
"{",
"c",
".",
"connection",
".",
"Presence",
"(",
"c",
".",
"Id",
",",
"s",
")",
"\n",
"}"
] |
23,568 | all-23569 | [
"HasStyle",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinition",
")",
"HasStyle",
"(",
")",
"bool",
"{",
"if",
"g",
"!=",
"nil",
"&&",
"g",
".",
"Style",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
23,569 | all-23570 | [
"SetLineJoin",
"is",
"a",
"wrapper",
"around",
"cairo_set_line_join",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetLineJoin",
"(",
"lineJoin",
"LineJoin",
")",
"{",
"C",
".",
"cairo_set_line_join",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"cairo_line_join_t",
"(",
"lineJoin",
")",
")",
"\n",
"}"
] |
23,570 | all-23571 | [
"GetNoDial",
"returns",
"true",
"if",
"the",
"no",
"dial",
"option",
"is",
"set",
"in",
"the",
"context",
"."
] | [
"func",
"GetNoDial",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"nodial",
"bool",
",",
"reason",
"string",
")",
"{",
"v",
":=",
"ctx",
".",
"Value",
"(",
"noDial",
")",
"\n",
"if",
"v",
"!=",
"nil",
"{",
"return",
"true",
",",
"v",
".",
"(",
"string",
")",
"\n",
"}",
"\n\n",
"return",
"false",
",",
"\"",
"\"",
"\n",
"}"
] |
23,571 | all-23572 | [
"QueryChanges",
"queries",
"for",
"all",
"changes",
"from",
"all",
"projects",
"after",
"lastUpdate",
"time",
"returns",
"an",
"instance",
":",
"changes",
"map"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"QueryChanges",
"(",
"lastUpdate",
"time",
".",
"Time",
",",
"rateLimit",
"int",
")",
"map",
"[",
"string",
"]",
"[",
"]",
"ChangeInfo",
"{",
"result",
":=",
"map",
"[",
"string",
"]",
"[",
"]",
"ChangeInfo",
"{",
"}",
"\n",
"for",
"_",
",",
"h",
":=",
"range",
"c",
".",
"handlers",
"{",
"changes",
":=",
"h",
".",
"queryAllChanges",
"(",
"lastUpdate",
",",
"rateLimit",
")",
"\n",
"if",
"len",
"(",
"changes",
")",
">",
"0",
"{",
"result",
"[",
"h",
".",
"instance",
"]",
"=",
"[",
"]",
"ChangeInfo",
"{",
"}",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"changes",
"{",
"result",
"[",
"h",
".",
"instance",
"]",
"=",
"append",
"(",
"result",
"[",
"h",
".",
"instance",
"]",
",",
"change",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"result",
"\n",
"}"
] |
23,572 | all-23573 | [
"Update",
"the",
"key",
"with",
"the",
"given",
"data",
".",
"Valid",
"parameters",
"may",
"be",
"found",
"here",
":",
"https",
":",
"//",
"www",
".",
"twilio",
".",
"com",
"/",
"docs",
"/",
"api",
"/",
"rest",
"/",
"keys#instance",
"-",
"post"
] | [
"func",
"(",
"a",
"*",
"KeyService",
")",
"Update",
"(",
"ctx",
"context",
".",
"Context",
",",
"sid",
"string",
",",
"data",
"url",
".",
"Values",
")",
"(",
"*",
"Key",
",",
"error",
")",
"{",
"key",
":=",
"new",
"(",
"Key",
")",
"\n",
"err",
":=",
"a",
".",
"client",
".",
"UpdateResource",
"(",
"ctx",
",",
"keyPathPart",
",",
"sid",
",",
"data",
",",
"<mask>",
")",
"\n",
"return",
"key",
",",
"err",
"\n",
"}"
] |
23,573 | all-23574 | [
"Next",
"advances",
"our",
"concat",
"iterator",
"."
] | [
"func",
"(",
"s",
"*",
"ConcatIterator",
")",
"Next",
"(",
")",
"{",
"s",
".",
"cur",
".",
"Next",
"(",
")",
"\n",
"if",
"s",
".",
"cur",
".",
"Valid",
"(",
")",
"{",
"// Nothing to do. Just stay with the current table.",
"return",
"\n",
"}",
"\n",
"for",
"{",
"// In case there are empty tables.",
"if",
"!",
"s",
".",
"reversed",
"{",
"s",
".",
"setIdx",
"(",
"s",
".",
"idx",
"+",
"1",
")",
"\n",
"}",
"else",
"{",
"s",
".",
"setIdx",
"(",
"s",
".",
"idx",
"-",
"1",
")",
"\n",
"}",
"\n",
"if",
"s",
".",
"cur",
"==",
"nil",
"{",
"// End of list. Valid will become false.",
"return",
"\n",
"}",
"\n",
"s",
".",
"cur",
".",
"Rewind",
"(",
")",
"\n",
"if",
"s",
".",
"cur",
".",
"Valid",
"(",
")",
"{",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
23,574 | all-23575 | [
"Close",
"our",
"writer",
".",
"Subsequent",
"writes",
"will",
"fail",
"."
] | [
"func",
"(",
"l",
"*",
"Writer",
")",
"Close",
"(",
")",
"error",
"{",
"l",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n\n",
"return",
"l",
".",
"<mask>",
".",
"Close",
"(",
")",
"\n",
"}"
] |
23,575 | all-23576 | [
"Loop",
"performs",
"a",
"function",
"that",
"creates",
"new",
"jobs",
"with",
"a",
"certain",
"frequency",
".",
"If",
"at",
"the",
"moment",
"there",
"is",
"already",
"a",
"similar",
"active",
"job",
"then",
"such",
"job",
"is",
"ignored",
".",
"The",
"function",
"works",
"correctly",
"only",
"with",
"jobs",
"for",
"which",
"duplicates",
"are",
"allowed",
"."
] | [
"func",
"Loop",
"(",
"ctx",
"context",
".",
"<mask>",
",",
"logger",
"log",
".",
"Logger",
",",
"db",
"*",
"reform",
".",
"DB",
",",
"queue",
"job",
".",
"Queue",
",",
"duration",
"time",
".",
"Duration",
",",
"f",
"func",
"(",
")",
"[",
"]",
"*",
"data",
".",
"Job",
")",
"{",
"tik",
":=",
"time",
".",
"NewTicker",
"(",
"duration",
")",
"\n",
"logger",
"=",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"go",
"loop",
"(",
"ctx",
",",
"tik",
",",
"db",
",",
"queue",
",",
"f",
",",
"logger",
",",
"nil",
")",
"\n",
"}"
] |
23,576 | all-23577 | [
"return",
"parameters",
"of",
"a",
"buffer",
"object"
] | [
"func",
"GetNamedBufferParameteriv",
"(",
"buffer",
"uint32",
",",
"pname",
"uint32",
",",
"params",
"*",
"int32",
")",
"{",
"C",
".",
"glowGetNamedBufferParameteriv",
"(",
"gpGetNamedBufferParameteriv",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"pname",
")",
",",
"(",
"*",
"C",
".",
"GLint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"params",
")",
")",
")",
"\n",
"}"
] |
23,577 | all-23578 | [
"RadioButtonNew",
"is",
"a",
"wrapper",
"around",
"gtk_radio_button_new",
"()",
"."
] | [
"func",
"RadioButtonNew",
"(",
"<mask>",
"*",
"glib",
".",
"SList",
")",
"(",
"*",
"RadioButton",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_radio_button_new",
"(",
"cGSList",
"(",
"group",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapRadioButton",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
23,578 | all-23579 | [
"CreatePangoLayout",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_context_create_pango_layout",
"()",
"."
] | [
"func",
"(",
"pc",
"*",
"PrintContext",
")",
"CreatePangoLayout",
"(",
")",
"*",
"pango",
".",
"Layout",
"{",
"c",
":=",
"C",
".",
"gtk_print_context_create_pango_layout",
"(",
"<mask>",
".",
"native",
"(",
")",
")",
"\n",
"return",
"pango",
".",
"WrapLayout",
"(",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
"\n",
"}"
] |
23,579 | all-23580 | [
"GetAutoscaleOk",
"returns",
"a",
"tuple",
"with",
"the",
"Autoscale",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"q",
"*",
"QueryValueDefinition",
")",
"GetAutoscaleOk",
"(",
")",
"(",
"bool",
",",
"bool",
")",
"{",
"if",
"q",
"==",
"nil",
"||",
"q",
".",
"Autoscale",
"==",
"nil",
"{",
"return",
"false",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"q",
".",
"Autoscale",
",",
"true",
"\n",
"}"
] |
23,580 | all-23581 | [
"GetComparator",
"returns",
"the",
"Comparator",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"d",
"*",
"DashboardConditionalFormat",
")",
"GetComparator",
"(",
")",
"string",
"{",
"if",
"d",
"==",
"nil",
"||",
"d",
".",
"Comparator",
"==",
"nil",
"{",
"<mask>",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"d",
".",
"Comparator",
"\n",
"}"
] |
23,581 | all-23582 | [
"WalkPath",
"is",
"used",
"to",
"walk",
"the",
"tree",
"but",
"only",
"visiting",
"nodes",
"from",
"the",
"root",
"down",
"to",
"a",
"given",
"leaf",
".",
"Where",
"WalkPrefix",
"walks",
"all",
"the",
"entries",
"*",
"under",
"*",
"the",
"given",
"prefix",
"this",
"walks",
"the",
"entries",
"*",
"above",
"*",
"the",
"given",
"prefix",
"."
] | [
"func",
"(",
"t",
"*",
"Tree",
")",
"WalkPath",
"(",
"path",
"string",
",",
"fn",
"WalkFn",
")",
"{",
"n",
":=",
"t",
".",
"root",
"\n",
"search",
":=",
"path",
"\n",
"for",
"{",
"// Visit the leaf values if any",
"if",
"n",
".",
"leaf",
"!=",
"nil",
"&&",
"fn",
"(",
"n",
".",
"leaf",
".",
"key",
",",
"n",
".",
"leaf",
".",
"val",
")",
"{",
"return",
"\n",
"}",
"\n\n",
"// Check for key exhaution",
"if",
"len",
"(",
"<mask>",
")",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n\n",
"// Look for an edge",
"n",
"=",
"n",
".",
"getEdge",
"(",
"search",
"[",
"0",
"]",
")",
"\n",
"if",
"n",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"// Consume the search prefix",
"if",
"strings",
".",
"HasPrefix",
"(",
"search",
",",
"n",
".",
"prefix",
")",
"{",
"search",
"=",
"search",
"[",
"len",
"(",
"n",
".",
"prefix",
")",
":",
"]",
"\n",
"}",
"else",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
23,582 | all-23583 | [
"arg1Reader",
"returns",
"an",
"ArgReader",
"to",
"read",
"arg1",
"."
] | [
"func",
"(",
"r",
"*",
"reqResReader",
")",
"arg1Reader",
"(",
")",
"(",
"ArgReader",
",",
"error",
")",
"{",
"return",
"r",
".",
"argReader",
"(",
"<mask>",
"/* last */",
",",
"reqResReaderPreArg1",
",",
"reqResReaderPreArg2",
")",
"\n",
"}"
] |
23,583 | all-23584 | [
"EnsureSafe",
"compares",
"the",
"provided",
"safety",
"parameters",
"with",
"the",
"ones",
"currently",
"in",
"use",
"by",
"the",
"session",
"and",
"picks",
"the",
"most",
"conservative",
"choice",
"for",
"each",
"setting",
".",
"That",
"is",
":",
"-",
"safe",
".",
"WMode",
"is",
"always",
"used",
"if",
"set",
".",
"-",
"safe",
".",
"W",
"is",
"used",
"if",
"larger",
"than",
"the",
"current",
"W",
"and",
"WMode",
"is",
"empty",
".",
"-",
"safe",
".",
"FSync",
"is",
"always",
"used",
"if",
"true",
".",
"-",
"safe",
".",
"J",
"is",
"used",
"if",
"FSync",
"is",
"false",
".",
"-",
"safe",
".",
"WTimeout",
"is",
"used",
"if",
"set",
"and",
"smaller",
"than",
"the",
"current",
"WTimeout",
".",
"For",
"example",
"the",
"following",
"statement",
"will",
"ensure",
"the",
"session",
"is",
"at",
"least",
"checking",
"for",
"errors",
"without",
"enforcing",
"further",
"constraints",
".",
"If",
"a",
"more",
"conservative",
"SetSafe",
"or",
"EnsureSafe",
"call",
"was",
"previously",
"done",
"the",
"following",
"call",
"will",
"be",
"ignored",
".",
"session",
".",
"EnsureSafe",
"(",
"&mgo",
".",
"Safe",
"{}",
")",
"See",
"also",
"the",
"SetSafe",
"method",
"for",
"details",
"on",
"what",
"each",
"option",
"means",
".",
"Relevant",
"documentation",
":",
"http",
":",
"//",
"www",
".",
"mongodb",
".",
"org",
"/",
"display",
"/",
"DOCS",
"/",
"getLastError",
"+",
"Command",
"http",
":",
"//",
"www",
".",
"mongodb",
".",
"org",
"/",
"display",
"/",
"DOCS",
"/",
"Verifying",
"+",
"Propagation",
"+",
"of",
"+",
"Writes",
"+",
"with",
"+",
"getLastError",
"http",
":",
"//",
"www",
".",
"mongodb",
".",
"org",
"/",
"display",
"/",
"DOCS",
"/",
"Data",
"+",
"Center",
"+",
"Awareness"
] | [
"func",
"(",
"s",
"*",
"Session",
")",
"EnsureSafe",
"(",
"<mask>",
"*",
"Safe",
")",
"{",
"s",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"s",
".",
"ensureSafe",
"(",
"safe",
")",
"\n",
"s",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
23,584 | all-23585 | [
"Create",
"an",
"array",
"of",
"Typed",
"helpers",
"Used",
"for",
"when",
"the",
"root",
"is",
"an",
"array",
"which",
"contains",
"objects"
] | [
"func",
"JsonArray",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"Typed",
",",
"error",
")",
"{",
"var",
"m",
"[",
"]",
"interface",
"{",
"}",
"\n",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"<mask>",
",",
"&",
"m",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"l",
":=",
"len",
"(",
"m",
")",
"\n",
"if",
"l",
"==",
"0",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"typed",
":=",
"make",
"(",
"[",
"]",
"Typed",
",",
"l",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"l",
";",
"i",
"++",
"{",
"value",
":=",
"m",
"[",
"i",
"]",
"\n",
"if",
"t",
",",
"ok",
":=",
"value",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
";",
"ok",
"{",
"typed",
"[",
"i",
"]",
"=",
"t",
"\n",
"}",
"else",
"{",
"typed",
"[",
"i",
"]",
"=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"value",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"typed",
",",
"nil",
"\n",
"}"
] |
23,585 | all-23586 | [
"GetChild1",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_paned_get_child1",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Paned",
")",
"GetChild1",
"(",
")",
"(",
"*",
"Widget",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_paned_get_child1",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"<mask>",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapWidget",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
23,586 | all-23587 | [
"CertUpdate",
"updates",
"the",
"certificate",
"with",
"the",
"given",
"fingerprint",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"CertUpdate",
"(",
"fingerprint",
"string",
",",
"certName",
"string",
",",
"certType",
"int",
")",
"error",
"{",
"err",
":=",
"c",
".",
"<mask>",
"(",
"func",
"(",
"tx",
"*",
"ClusterTx",
")",
"error",
"{",
"_",
",",
"err",
":=",
"tx",
".",
"tx",
".",
"Exec",
"(",
"\"",
"\"",
",",
"certName",
",",
"certType",
",",
"fingerprint",
")",
"\n",
"return",
"err",
"\n",
"}",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
23,587 | all-23588 | [
"NewReference",
"returns",
"an",
"OCI",
"reference",
"for",
"a",
"directory",
"and",
"a",
"image",
".",
"We",
"do",
"not",
"expose",
"an",
"API",
"supplying",
"the",
"resolvedDir",
";",
"we",
"could",
"but",
"recomputing",
"it",
"is",
"generally",
"cheap",
"enough",
"that",
"we",
"prefer",
"being",
"confident",
"about",
"the",
"properties",
"of",
"resolvedDir",
"."
] | [
"func",
"NewReference",
"(",
"dir",
",",
"image",
"string",
")",
"(",
"types",
".",
"ImageReference",
",",
"error",
")",
"{",
"resolved",
",",
"err",
":=",
"explicitfilepath",
".",
"ResolvePathToFullyExplicit",
"(",
"dir",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"internal",
".",
"ValidateOCIPath",
"(",
"dir",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"<mask>",
".",
"ValidateImageName",
"(",
"image",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"ociReference",
"{",
"dir",
":",
"dir",
",",
"resolvedDir",
":",
"resolved",
",",
"image",
":",
"image",
"}",
",",
"nil",
"\n",
"}"
] |
23,588 | all-23589 | [
"StartSession",
"creates",
"a",
"session",
"with",
"the",
"backend",
"and",
"handles",
"requests",
"using",
"the",
"passed",
"in",
"arguments",
".",
"The",
"engine",
"is",
"expected",
"to",
"initialized",
"and",
"gathering",
"container",
"metrics",
"by",
"the",
"time",
"the",
"websocket",
"client",
"starts",
"using",
"it",
"."
] | [
"func",
"StartSession",
"(",
"params",
"*",
"TelemetrySessionParams",
",",
"statsEngine",
"stats",
".",
"<mask>",
")",
"error",
"{",
"backoff",
":=",
"retry",
".",
"NewExponentialBackoff",
"(",
"time",
".",
"Second",
",",
"1",
"*",
"time",
".",
"Minute",
",",
"0.2",
",",
"2",
")",
"\n",
"for",
"{",
"tcsError",
":=",
"startTelemetrySession",
"(",
"params",
",",
"statsEngine",
")",
"\n",
"if",
"tcsError",
"==",
"nil",
"||",
"tcsError",
"==",
"io",
".",
"EOF",
"{",
"seelog",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"backoff",
".",
"Reset",
"(",
")",
"\n",
"}",
"else",
"{",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"tcsError",
")",
"\n",
"params",
".",
"time",
"(",
")",
".",
"Sleep",
"(",
"backoff",
".",
"Duration",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
23,589 | all-23590 | [
"String",
"returns",
"the",
"Modifier",
"as",
"string",
"value",
"."
] | [
"func",
"(",
"t",
"Modifier",
")",
"String",
"(",
")",
"string",
"{",
"switch",
"t",
"{",
"case",
"ModifierNone",
":",
"return",
"\"",
"\"",
"\n",
"case",
"ModifierAlt",
":",
"return",
"\"",
"\"",
"\n",
"case",
"ModifierCtrl",
":",
"return",
"\"",
"\"",
"\n",
"<mask>",
"ModifierMeta",
":",
"return",
"\"",
"\"",
"\n",
"case",
"ModifierShift",
":",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"t",
")",
"\n",
"}"
] |
23,590 | all-23591 | [
"HTMLHandler",
"is",
"a",
"HTTP",
"middleware",
"that",
"should",
"be",
"used",
"alongide",
"HTML",
"pages",
"."
] | [
"func",
"(",
"s",
"Service",
")",
"HTMLHandler",
"(",
"h",
"http",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"on",
",",
"err",
":=",
"s",
".",
"store",
".",
"Status",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"s",
".",
"logger",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"on",
"||",
"err",
"!=",
"nil",
"{",
"if",
"s",
".",
"HTML",
".",
"Handler",
"!=",
"nil",
"{",
"s",
".",
"<mask>",
".",
"Handler",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"return",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"HTMLContentType",
")",
"\n",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusServiceUnavailable",
")",
"\n",
"fmt",
".",
"Fprintln",
"(",
"w",
",",
"s",
".",
"HTML",
".",
"Body",
")",
"\n",
"return",
"\n",
"}",
"\n",
"h",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"}",
")",
"\n",
"}"
] |
23,591 | all-23592 | [
"KeyUnwrap",
"decrypts",
"previously",
"encrypted",
"key",
"(",
"CEK",
")",
"with",
"KEK",
"key",
"using",
"AES",
"Key",
"Wrap",
"(",
"rfc",
"3394",
")",
"algorithm"
] | [
"func",
"KeyUnwrap",
"(",
"encryptedCek",
",",
"kek",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"// 1) Initialize variables",
"c",
":=",
"arrays",
".",
"Slice",
"(",
"encryptedCek",
",",
"8",
")",
";",
"a",
":=",
"c",
"[",
"0",
"]",
";",
"// Set A = C[0]",
"r",
":=",
"<mask>",
"(",
"[",
"]",
"[",
"]",
"byte",
",",
"len",
"(",
"c",
")",
"-",
"1",
")",
";",
"for",
"i",
":=",
"1",
";",
"i",
"<",
"len",
"(",
"c",
")",
";",
"i",
"++",
"{",
"// For i = 1 to n",
"r",
"[",
"i",
"-",
"1",
"]",
"=",
"c",
"[",
"i",
"]",
";",
"// R[i] = C[i]",
"}",
"\n\n",
"n",
":=",
"uint64",
"(",
"len",
"(",
"r",
")",
")",
"\n",
"// 2) Calculate intermediate values",
"var",
"t",
",",
"j",
"uint64",
"\n\n",
"for",
"j",
"=",
"6",
";",
"j",
">",
"0",
";",
"j",
"--",
"{",
"// For j = 5 to 0 ",
"for",
"i",
":=",
"n",
";",
"i",
">",
"0",
";",
"i",
"--",
"{",
"// For i = n to 1 ",
"t",
"=",
"n",
"*",
"(",
"j",
"-",
"1",
")",
"+",
"i",
";",
"a",
"=",
"arrays",
".",
"Xor",
"(",
"a",
",",
"arrays",
".",
"UInt64ToBytes",
"(",
"t",
")",
")",
"\n",
"b",
",",
"e",
":=",
"aesDec",
"(",
"kek",
",",
"arrays",
".",
"Concat",
"(",
"a",
",",
"r",
"[",
"i",
"-",
"1",
"]",
")",
")",
"// B = AES-1(K, (A ^ t) | R[i]) where t = n*j+i\t\t\t",
"\n",
"if",
"e",
"!=",
"nil",
"{",
"return",
"nil",
",",
"e",
"}",
"\n",
"a",
"=",
"b",
"[",
":",
"len",
"(",
"b",
")",
"/",
"2",
"]",
"// A = MSB(64, B)",
"\n",
"r",
"[",
"i",
"-",
"1",
"]",
"=",
"b",
"[",
"len",
"(",
"b",
")",
"/",
"2",
":",
"]",
"// R[i] = LSB(64, B)",
"\n",
"}",
"\n",
"}",
"\n\n",
"// 3) Output the results",
"if",
"(",
"!",
"hmac",
".",
"Equal",
"(",
"defaultIV",
",",
"a",
")",
")",
"{",
"// If A is an appropriate initial value ",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// For i = 1 to n",
"return",
"arrays",
".",
"Unwrap",
"(",
"r",
")",
",",
"nil",
"// P[i] = R[i]",
"\n\n",
"}"
] |
23,592 | all-23593 | [
"PrependPage",
"is",
"a",
"wrapper",
"around",
"gtk_assistant_prepend_page",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Assistant",
")",
"PrependPage",
"(",
"page",
"IWidget",
")",
"int",
"{",
"c",
":=",
"C",
".",
"gtk_assistant_prepend_page",
"(",
"v",
".",
"native",
"(",
")",
",",
"<mask>",
".",
"toWidget",
"(",
")",
")",
"\n",
"return",
"int",
"(",
"c",
")",
"\n",
"}"
] |
23,593 | all-23594 | [
"appMain",
"is",
"the",
"main",
"routine",
"for",
"gomobile",
"-",
"build",
"mode",
"."
] | [
"func",
"(",
"u",
"*",
"UserInterface",
")",
"appMain",
"(",
"a",
"app",
".",
"App",
")",
"{",
"var",
"glctx",
"gl",
".",
"Context",
"\n",
"touches",
":=",
"map",
"[",
"touch",
".",
"Sequence",
"]",
"*",
"Touch",
"{",
"}",
"\n",
"for",
"e",
":=",
"range",
"a",
".",
"Events",
"(",
")",
"{",
"switch",
"e",
":=",
"a",
".",
"Filter",
"(",
"e",
")",
".",
"(",
"type",
")",
"{",
"case",
"lifecycle",
".",
"Event",
":",
"switch",
"e",
".",
"Crosses",
"(",
"lifecycle",
".",
"StageVisible",
")",
"{",
"case",
"lifecycle",
".",
"CrossOn",
":",
"glctx",
",",
"_",
"=",
"e",
".",
"DrawContext",
".",
"(",
"gl",
".",
"Context",
")",
"\n",
"// Assume that glctx is always a same instance.",
"// Then, only once initializing should be enough.",
"if",
"glContextCh",
"!=",
"nil",
"{",
"glContextCh",
"<-",
"glctx",
"\n",
"glContextCh",
"=",
"nil",
"\n",
"}",
"\n",
"a",
".",
"Send",
"(",
"paint",
".",
"<mask>",
"{",
"}",
")",
"\n",
"case",
"lifecycle",
".",
"CrossOff",
":",
"glctx",
"=",
"nil",
"\n",
"}",
"\n",
"case",
"size",
".",
"Event",
":",
"u",
".",
"setFullscreenImpl",
"(",
"e",
".",
"WidthPx",
",",
"e",
".",
"HeightPx",
")",
"\n",
"case",
"paint",
".",
"Event",
":",
"if",
"glctx",
"==",
"nil",
"||",
"e",
".",
"External",
"{",
"continue",
"\n",
"}",
"\n",
"renderCh",
"<-",
"struct",
"{",
"}",
"{",
"}",
"\n",
"<-",
"renderChEnd",
"\n",
"a",
".",
"Publish",
"(",
")",
"\n",
"a",
".",
"Send",
"(",
"paint",
".",
"Event",
"{",
"}",
")",
"\n",
"case",
"touch",
".",
"Event",
":",
"switch",
"e",
".",
"Type",
"{",
"case",
"touch",
".",
"TypeBegin",
",",
"touch",
".",
"TypeMove",
":",
"s",
":=",
"getDeviceScale",
"(",
")",
"\n",
"x",
",",
"y",
":=",
"float64",
"(",
"e",
".",
"X",
")",
"/",
"s",
",",
"float64",
"(",
"e",
".",
"Y",
")",
"/",
"s",
"\n",
"// TODO: Is it ok to cast from int64 to int here?",
"touches",
"[",
"e",
".",
"Sequence",
"]",
"=",
"&",
"Touch",
"{",
"ID",
":",
"int",
"(",
"e",
".",
"Sequence",
")",
",",
"X",
":",
"int",
"(",
"x",
")",
",",
"Y",
":",
"int",
"(",
"y",
")",
",",
"}",
"\n",
"case",
"touch",
".",
"TypeEnd",
":",
"delete",
"(",
"touches",
",",
"e",
".",
"Sequence",
")",
"\n",
"}",
"\n",
"ts",
":=",
"[",
"]",
"*",
"Touch",
"{",
"}",
"\n",
"for",
"_",
",",
"t",
":=",
"range",
"touches",
"{",
"ts",
"=",
"append",
"(",
"ts",
",",
"t",
")",
"\n",
"}",
"\n",
"u",
".",
"input",
".",
"update",
"(",
"ts",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
23,594 | all-23595 | [
"FilterPresubmits",
"determines",
"which",
"presubmits",
"should",
"run",
"and",
"which",
"should",
"be",
"skipped",
"by",
"evaluating",
"the",
"user",
"-",
"provided",
"filter",
"."
] | [
"func",
"FilterPresubmits",
"(",
"filter",
"Filter",
",",
"changes",
"config",
".",
"ChangedFilesProvider",
",",
"branch",
"string",
",",
"presubmits",
"[",
"]",
"config",
".",
"Presubmit",
",",
"logger",
"*",
"logrus",
".",
"Entry",
")",
"(",
"[",
"]",
"config",
".",
"Presubmit",
",",
"[",
"]",
"config",
".",
"Presubmit",
",",
"error",
")",
"{",
"var",
"toTrigger",
"[",
"]",
"config",
".",
"Presubmit",
"\n",
"var",
"toSkip",
"[",
"]",
"config",
".",
"Presubmit",
"\n",
"for",
"_",
",",
"presubmit",
":=",
"range",
"presubmits",
"{",
"matches",
",",
"forced",
",",
"defaults",
":=",
"filter",
"(",
"presubmit",
")",
"\n",
"if",
"!",
"matches",
"{",
"<mask>",
"\n",
"}",
"\n",
"shouldRun",
",",
"err",
":=",
"presubmit",
".",
"ShouldRun",
"(",
"branch",
",",
"changes",
",",
"forced",
",",
"defaults",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"shouldRun",
"{",
"toTrigger",
"=",
"append",
"(",
"toTrigger",
",",
"presubmit",
")",
"\n",
"}",
"else",
"{",
"toSkip",
"=",
"append",
"(",
"toSkip",
",",
"presubmit",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"logger",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",
"\"",
"\"",
":",
"toTrigger",
",",
"\"",
"\"",
":",
"toSkip",
"}",
")",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"len",
"(",
"presubmits",
")",
",",
"len",
"(",
"toTrigger",
")",
",",
"len",
"(",
"toSkip",
")",
")",
"\n",
"return",
"toTrigger",
",",
"toSkip",
",",
"nil",
"\n",
"}"
] |
23,595 | all-23596 | [
"export",
"FileSequence_Len"
] | [
"func",
"FileSequence_Len",
"(",
"id",
"FileSeqId",
")",
"C",
".",
"size_t",
"{",
"fs",
",",
"ok",
":=",
"sFileSeqs",
".",
"Get",
"(",
"<mask>",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"C",
".",
"size_t",
"(",
"fs",
".",
"Len",
"(",
")",
")",
"\n",
"}"
] |
23,596 | all-23597 | [
"resourceVSphereVirtualMachineCreateCloneWithSDRS",
"runs",
"the",
"clone",
"part",
"of",
"resourceVSphereVirtualMachineCreateClone",
"through",
"storage",
"DRS",
".",
"It",
"s",
"designed",
"to",
"be",
"run",
"when",
"a",
"storage",
"cluster",
"is",
"specified",
"versus",
"simply",
"specifying",
"datastores",
"."
] | [
"func",
"resourceVSphereVirtualMachineCreateCloneWithSDRS",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
",",
"srcVM",
"*",
"object",
".",
"VirtualMachine",
",",
"fo",
"*",
"object",
".",
"Folder",
",",
"name",
"string",
",",
"<mask>",
"types",
".",
"VirtualMachineCloneSpec",
",",
"timeout",
"int",
",",
")",
"(",
"*",
"object",
".",
"VirtualMachine",
",",
"error",
")",
"{",
"client",
":=",
"meta",
".",
"(",
"*",
"VSphereClient",
")",
".",
"vimClient",
"\n",
"if",
"err",
":=",
"viapi",
".",
"ValidateVirtualCenter",
"(",
"client",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereVirtualMachineIDString",
"(",
"d",
")",
")",
"\n",
"pod",
",",
"err",
":=",
"storagepod",
".",
"FromID",
"(",
"client",
",",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"vm",
",",
"err",
":=",
"storagepod",
".",
"CloneVM",
"(",
"client",
",",
"srcVM",
",",
"fo",
",",
"name",
",",
"spec",
",",
"timeout",
",",
"pod",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"pod",
".",
"Name",
"(",
")",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"vm",
",",
"nil",
"\n",
"}"
] |
23,597 | all-23598 | [
"ParseXML",
"creates",
"an",
"XMLTree",
"structure",
"from",
"an",
"io",
".",
"Reader",
"."
] | [
"func",
"ParseXML",
"(",
"r",
"io",
".",
"Reader",
",",
"op",
"...",
"ParseSettings",
")",
"(",
"tree",
".",
"Node",
",",
"error",
")",
"{",
"ov",
":=",
"ParseOptions",
"{",
"Strict",
":",
"true",
",",
"XMLRoot",
":",
"xmlele",
".",
"Root",
",",
"}",
"\n",
"for",
"_",
",",
"i",
":=",
"range",
"op",
"{",
"i",
"(",
"&",
"ov",
")",
"\n",
"}",
"\n\n",
"dec",
":=",
"xml",
".",
"NewDecoder",
"(",
"r",
")",
"\n",
"dec",
".",
"CharsetReader",
"=",
"charset",
".",
"NewReaderLabel",
"\n",
"dec",
".",
"Strict",
"=",
"ov",
".",
"Strict",
"\n\n",
"ordrPos",
":=",
"1",
"\n",
"xmlTree",
":=",
"ov",
".",
"XMLRoot",
"(",
")",
"\n\n",
"t",
",",
"err",
":=",
"dec",
".",
"Token",
"(",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"head",
",",
"ok",
":=",
"t",
".",
"(",
"xml",
".",
"ProcInst",
")",
";",
"<mask>",
"&&",
"head",
".",
"Target",
"==",
"\"",
"\"",
"{",
"t",
",",
"err",
"=",
"dec",
".",
"Token",
"(",
")",
"\n",
"}",
"\n\n",
"opts",
":=",
"xmlbuilder",
".",
"BuilderOpts",
"{",
"Dec",
":",
"dec",
",",
"}",
"\n\n",
"for",
"err",
"==",
"nil",
"{",
"switch",
"xt",
":=",
"t",
".",
"(",
"type",
")",
"{",
"case",
"xml",
".",
"StartElement",
":",
"setEle",
"(",
"&",
"opts",
",",
"xmlTree",
",",
"xt",
",",
"&",
"ordrPos",
")",
"\n",
"xmlTree",
"=",
"xmlTree",
".",
"CreateNode",
"(",
"&",
"opts",
")",
"\n",
"case",
"xml",
".",
"CharData",
":",
"setNode",
"(",
"&",
"opts",
",",
"xmlTree",
",",
"xt",
",",
"tree",
".",
"NtChd",
",",
"&",
"ordrPos",
")",
"\n",
"xmlTree",
"=",
"xmlTree",
".",
"CreateNode",
"(",
"&",
"opts",
")",
"\n",
"case",
"xml",
".",
"Comment",
":",
"setNode",
"(",
"&",
"opts",
",",
"xmlTree",
",",
"xt",
",",
"tree",
".",
"NtComm",
",",
"&",
"ordrPos",
")",
"\n",
"xmlTree",
"=",
"xmlTree",
".",
"CreateNode",
"(",
"&",
"opts",
")",
"\n",
"case",
"xml",
".",
"ProcInst",
":",
"setNode",
"(",
"&",
"opts",
",",
"xmlTree",
",",
"xt",
",",
"tree",
".",
"NtPi",
",",
"&",
"ordrPos",
")",
"\n",
"xmlTree",
"=",
"xmlTree",
".",
"CreateNode",
"(",
"&",
"opts",
")",
"\n",
"case",
"xml",
".",
"EndElement",
":",
"xmlTree",
"=",
"xmlTree",
".",
"EndElem",
"(",
")",
"\n",
"case",
"xml",
".",
"Directive",
":",
"if",
"dp",
",",
"ok",
":=",
"xmlTree",
".",
"(",
"DirectiveParser",
")",
";",
"ok",
"{",
"dp",
".",
"Directive",
"(",
"xt",
".",
"Copy",
"(",
")",
",",
"dec",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"t",
",",
"err",
"=",
"dec",
".",
"Token",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"err",
"==",
"io",
".",
"EOF",
"{",
"err",
"=",
"nil",
"\n",
"}",
"\n\n",
"return",
"xmlTree",
",",
"err",
"\n",
"}"
] |
23,598 | all-23599 | [
"Value",
"implements",
"the",
"database",
"/",
"sql",
"/",
"Valuer",
"interface",
"."
] | [
"func",
"(",
"d",
"Decimal",
")",
"Value",
"(",
")",
"(",
"driver",
".",
"Value",
",",
"error",
")",
"{",
"m",
":=",
"bigIntFree",
".",
"Get",
"(",
")",
".",
"(",
"*",
"big",
".",
"Int",
")",
"\n",
"neg",
",",
"exp",
",",
"df",
":=",
"convertRatToDecimal",
"(",
"(",
"*",
"big",
".",
"Rat",
")",
"(",
"&",
"d",
")",
",",
"m",
",",
"dec128Digits",
",",
"dec128MinExp",
",",
"dec128MaxExp",
")",
"\n\n",
"var",
"v",
"driver",
".",
"Value",
"\n",
"var",
"err",
"error",
"\n\n",
"switch",
"{",
"default",
":",
"v",
",",
"err",
"=",
"encodeDecimal",
"(",
"m",
",",
"neg",
",",
"exp",
")",
"\n",
"case",
"df",
"&",
"dfUnderflow",
"!=",
"0",
":",
"// set to zero",
"m",
".",
"<mask>",
"(",
"natZero",
")",
"\n",
"v",
",",
"err",
"=",
"encodeDecimal",
"(",
"m",
",",
"false",
",",
"0",
")",
"\n",
"case",
"df",
"&",
"dfOverflow",
"!=",
"0",
":",
"err",
"=",
"ErrDecimalOutOfRange",
"\n",
"}",
"\n\n",
"// performance (avoid expensive defer)",
"bigIntFree",
".",
"Put",
"(",
"m",
")",
"\n\n",
"return",
"v",
",",
"err",
"\n",
"}"
] |
23,599 | all-23600 | [
"Fatalln",
"logging"
] | [
"func",
"(",
"l",
"*",
"StdLevelLogger",
")",
"Fatalln",
"(",
"args",
"...",
"<mask>",
"{",
"}",
")",
"{",
"l",
".",
"loglnFunc",
"(",
"FatalLevel",
",",
"l",
".",
"context",
",",
"args",
"...",
")",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.