id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
500 | all-501 | [
"GetDefaultInterfaces",
"gets",
"names",
"of",
"interfaces",
"and",
"returns",
"a",
"map",
"[",
"interface",
"]",
"families",
"."
] | [
"func",
"GetDefaultInterfaces",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"uint8",
",",
"error",
")",
"{",
"interfaces",
":=",
"<mask>",
"(",
"map",
"[",
"string",
"]",
"uint8",
")",
"\n",
"rmsgs",
",",
"rerr",
":=",
"getDefaultRoutes",
"(",
")",
"\n",
"if",
"rerr",
"!=",
"nil",
"{",
"return",
"interfaces",
",",
"rerr",
"\n",
"}",
"\n\n",
"for",
"family",
",",
"rmsg",
":=",
"range",
"rmsgs",
"{",
"_",
",",
"oif",
",",
"err",
":=",
"parsePREFSRC",
"(",
"rmsg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"interfaces",
",",
"err",
"\n",
"}",
"\n\n",
"ifmsg",
",",
"ierr",
":=",
"getIfaceLink",
"(",
"oif",
")",
"\n",
"if",
"ierr",
"!=",
"nil",
"{",
"return",
"interfaces",
",",
"ierr",
"\n",
"}",
"\n\n",
"attrs",
",",
"aerr",
":=",
"syscall",
".",
"ParseNetlinkRouteAttr",
"(",
"ifmsg",
")",
"\n",
"if",
"aerr",
"!=",
"nil",
"{",
"return",
"interfaces",
",",
"aerr",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"attr",
":=",
"range",
"attrs",
"{",
"if",
"attr",
".",
"Attr",
".",
"Type",
"==",
"syscall",
".",
"IFLA_IFNAME",
"{",
"// key is an interface name",
"// possible values: 2 - AF_INET, 10 - AF_INET6, 12 - dualstack",
"interfaces",
"[",
"string",
"(",
"attr",
".",
"Value",
"[",
":",
"len",
"(",
"attr",
".",
"Value",
")",
"-",
"1",
"]",
")",
"]",
"+=",
"family",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"interfaces",
")",
">",
"0",
"{",
"return",
"interfaces",
",",
"nil",
"\n",
"}",
"\n",
"return",
"interfaces",
",",
"errNoDefaultInterface",
"\n",
"}"
] |
501 | all-502 | [
"List",
"executes",
"a",
"callback",
"for",
"each",
"file",
"under",
"a",
"directory",
"(",
"or",
"a",
"file",
"if",
"the",
"path",
"is",
"a",
"file",
")",
"."
] | [
"func",
"(",
"h",
"*",
"dbHashTree",
")",
"List",
"(",
"path",
"string",
",",
"f",
"func",
"(",
"*",
"NodeProto",
")",
"error",
")",
"error",
"{",
"path",
"=",
"<mask>",
"(",
"path",
")",
"\n",
"return",
"h",
".",
"View",
"(",
"func",
"(",
"tx",
"*",
"bolt",
".",
"Tx",
")",
"error",
"{",
"return",
"list",
"(",
"tx",
",",
"path",
",",
"f",
")",
"\n",
"}",
")",
"\n",
"}"
] |
502 | all-503 | [
"APIClient",
"instantiates",
"a",
"client",
"with",
"the",
"given",
"name",
"from",
"command",
"line",
"arguments",
"."
] | [
"func",
"APIClient",
"(",
"name",
"string",
",",
"cmdLine",
"*",
"cmd",
".",
"CommandLine",
")",
"(",
"cmd",
".",
"CommandClient",
",",
"error",
")",
"{",
"switch",
"name",
"{",
"case",
"Cm15Command",
":",
"return",
"cm15",
".",
"FromCommandLine",
"(",
"cmdLine",
")",
"\n",
"case",
"Cm16Command",
":",
"return",
"cm16",
".",
"FromCommandLine",
"(",
"cmdLine",
")",
"\n",
"case",
"SsCommand",
":",
"return",
"ss",
".",
"FromCommandLine",
"(",
"cmdLine",
")",
"\n",
"case",
"Rl10Command",
":",
"return",
"rl10",
".",
"FromCommandLine",
"(",
"cmdLine",
")",
"\n",
"case",
"CaCommand",
":",
"return",
"ca",
".",
"FromCommandLine",
"(",
"cmdLine",
")",
"\n",
"case",
"PolicyCommand",
":",
"return",
"<mask>",
".",
"FromCommandLine",
"(",
"cmdLine",
")",
"\n",
"default",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n",
"}"
] |
503 | all-504 | [
"WithGestureSourceType",
"which",
"type",
"of",
"input",
"events",
"to",
"be",
"generated",
"(",
"default",
":",
"default",
"which",
"queries",
"the",
"platform",
"for",
"the",
"preferred",
"input",
"type",
")",
"."
] | [
"func",
"(",
"p",
"SynthesizeTapGestureParams",
")",
"WithGestureSourceType",
"(",
"gestureSourceType",
"GestureType",
")",
"*",
"SynthesizeTapGestureParams",
"{",
"p",
".",
"GestureSourceType",
"=",
"gestureSourceType",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
504 | all-505 | [
"SAdd",
"returns",
"a",
"new",
"vector",
"that",
"is",
"the",
"result",
"of",
"v",
"+",
"(",
"v1",
"*",
"s",
")",
".",
"It",
"allocates",
"a",
"new",
"vector",
"/",
"slice",
"."
] | [
"func",
"(",
"v",
"Vec2",
")",
"SAdd",
"(",
"v1",
"Vec2",
",",
"s",
"float32",
")",
"Vec2",
"{",
"<mask>",
"NewVec2XY",
"(",
"v",
"[",
"0",
"]",
"+",
"v1",
"[",
"0",
"]",
"*",
"s",
",",
"v",
"[",
"1",
"]",
"+",
"v1",
"[",
"1",
"]",
"*",
"s",
",",
")",
"\n",
"}"
] |
505 | all-506 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventResumed",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger39",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
506 | all-507 | [
"setEvaluationDuration",
"sets",
"the",
"time",
"in",
"seconds",
"the",
"last",
"evaluation",
"took",
"."
] | [
"func",
"(",
"g",
"*",
"Group",
")",
"setEvaluationDuration",
"(",
"dur",
"time",
".",
"Duration",
")",
"{",
"g",
".",
"metrics",
".",
"groupLastDuration",
".",
"WithLabelValues",
"(",
"groupKey",
"(",
"g",
".",
"<mask>",
",",
"g",
".",
"name",
")",
")",
".",
"Set",
"(",
"dur",
".",
"Seconds",
"(",
")",
")",
"\n\n",
"g",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"g",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n",
"g",
".",
"evaluationDuration",
"=",
"dur",
"\n",
"}"
] |
507 | all-508 | [
"Do",
"executes",
"DOMDebugger",
".",
"setDOMBreakpoint",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SetDOMBreakpointParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetDOMBreakpoint",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
508 | all-509 | [
"FindFunc",
"returns",
"the",
"function",
"which",
"contains",
"the",
"code",
"at",
"address",
"pc",
"if",
"any",
"."
] | [
"func",
"(",
"p",
"*",
"Process",
")",
"FindFunc",
"(",
"<mask>",
"core",
".",
"Address",
")",
"*",
"Func",
"{",
"return",
"p",
".",
"funcTab",
".",
"find",
"(",
"pc",
")",
"\n",
"}"
] |
509 | all-510 | [
"EnsureApplication",
"will",
"ensure",
"that",
"an",
"application",
"with",
"the",
"provided",
"name",
"exists",
"and",
"returns",
"its",
"key",
"."
] | [
"func",
"EnsureApplication",
"(",
"store",
"*",
"coal",
".",
"Store",
",",
"name",
",",
"key",
",",
"secret",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"// copy store",
"s",
":=",
"store",
".",
"Copy",
"(",
")",
"\n",
"defer",
"s",
".",
"Close",
"(",
")",
"\n\n",
"// count main applications",
"var",
"apps",
"[",
"]",
"Application",
"\n",
"err",
":=",
"s",
".",
"C",
"(",
"&",
"Application",
"{",
"}",
")",
".",
"Find",
"(",
"bson",
".",
"M",
"{",
"coal",
".",
"F",
"(",
"&",
"Application",
"{",
"}",
",",
"\"",
"\"",
")",
":",
"name",
",",
"}",
")",
".",
"All",
"(",
"&",
"apps",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"// check existence",
"if",
"len",
"(",
"apps",
")",
">",
"1",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"if",
"len",
"(",
"apps",
")",
"==",
"1",
"{",
"return",
"apps",
"[",
"0",
"]",
".",
"<mask>",
",",
"nil",
"\n",
"}",
"\n\n",
"// application is missing",
"// create application",
"app",
":=",
"coal",
".",
"Init",
"(",
"&",
"Application",
"{",
"}",
")",
".",
"(",
"*",
"Application",
")",
"\n",
"app",
".",
"Key",
"=",
"key",
"\n",
"app",
".",
"Name",
"=",
"name",
"\n",
"app",
".",
"Secret",
"=",
"secret",
"\n\n",
"// validate model",
"err",
"=",
"app",
".",
"Validate",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"// save application",
"err",
"=",
"s",
".",
"C",
"(",
"app",
")",
".",
"Insert",
"(",
"app",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"app",
".",
"Key",
",",
"nil",
"\n",
"}"
] |
510 | all-511 | [
"SetText",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_entry_set_text",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Entry",
")",
"SetText",
"(",
"text",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"<mask>",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_entry_set_text",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
511 | all-512 | [
"ServeFiles",
"maps",
"an",
"path",
"to",
"a",
"directory",
"on",
"disk",
"to",
"serve",
"static",
"files",
".",
"Useful",
"for",
"JavaScript",
"images",
"CSS",
"etc",
"...",
"/",
"*",
"a",
".",
"ServeFiles",
"(",
"/",
"assets",
"http",
".",
"Dir",
"(",
"path",
"/",
"to",
"/",
"assets",
"))"
] | [
"func",
"(",
"a",
"*",
"App",
")",
"ServeFiles",
"(",
"p",
"string",
",",
"root",
"http",
".",
"FileSystem",
")",
"{",
"path",
":=",
"path",
".",
"Join",
"(",
"a",
".",
"Prefix",
",",
"p",
")",
"\n",
"a",
".",
"filepaths",
"=",
"append",
"(",
"a",
".",
"filepaths",
",",
"path",
")",
"\n\n",
"h",
":=",
"stripAsset",
"(",
"<mask>",
",",
"a",
".",
"fileServer",
"(",
"root",
")",
",",
"a",
")",
"\n",
"a",
".",
"router",
".",
"PathPrefix",
"(",
"path",
")",
".",
"Handler",
"(",
"h",
")",
"\n",
"}"
] |
512 | all-513 | [
"ArmForSwitch",
"returns",
"which",
"field",
"name",
"should",
"be",
"used",
"for",
"storing",
"the",
"value",
"for",
"an",
"instance",
"of",
"LedgerKey"
] | [
"func",
"(",
"u",
"LedgerKey",
")",
"ArmForSwitch",
"(",
"sw",
"int32",
")",
"(",
"string",
",",
"bool",
")",
"{",
"switch",
"LedgerEntryType",
"(",
"sw",
")",
"{",
"case",
"LedgerEntryTypeAccount",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"case",
"LedgerEntryTypeTrustline",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"<mask>",
"LedgerEntryTypeOffer",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"case",
"LedgerEntryTypeData",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}"
] |
513 | all-514 | [
"Serve",
"serves",
"incoming",
"requests",
"using",
"the",
"provided",
"listener",
".",
"The",
"local",
"peer",
"info",
"is",
"set",
"synchronously",
"but",
"the",
"actual",
"socket",
"listening",
"is",
"done",
"in",
"a",
"separate",
"goroutine",
"."
] | [
"func",
"(",
"ch",
"*",
"Channel",
")",
"Serve",
"(",
"l",
"net",
".",
"Listener",
")",
"error",
"{",
"mutable",
":=",
"&",
"ch",
".",
"mutable",
"\n",
"mutable",
".",
"Lock",
"(",
")",
"\n",
"defer",
"mutable",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"mutable",
".",
"l",
"!=",
"nil",
"{",
"return",
"errAlreadyListening",
"\n",
"}",
"\n",
"mutable",
".",
"l",
"=",
"tnet",
".",
"Wrap",
"(",
"l",
")",
"\n\n",
"if",
"mutable",
".",
"state",
"!=",
"ChannelClient",
"{",
"return",
"errInvalidStateForOp",
"\n",
"}",
"\n",
"mutable",
".",
"state",
"=",
"ChannelListening",
"\n\n",
"mutable",
".",
"peerInfo",
".",
"HostPort",
"=",
"l",
".",
"Addr",
"(",
")",
".",
"String",
"(",
")",
"\n",
"mutable",
".",
"peerInfo",
".",
"IsEphemeral",
"=",
"false",
"\n",
"ch",
".",
"log",
"=",
"ch",
".",
"log",
".",
"WithFields",
"(",
"LogField",
"{",
"\"",
"\"",
",",
"mutable",
".",
"peerInfo",
".",
"HostPort",
"}",
")",
"\n",
"ch",
".",
"<mask>",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"go",
"ch",
".",
"serve",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
514 | all-515 | [
"OpenFile",
"opens",
"a",
"file",
"and",
"returns",
"a",
"stream",
"for",
"its",
"data",
".",
"The",
"path",
"parts",
"should",
"be",
"separated",
"with",
"slash",
"/",
"on",
"any",
"environments",
".",
"Note",
"that",
"this",
"doesn",
"t",
"work",
"on",
"mobiles",
"."
] | [
"func",
"OpenFile",
"(",
"<mask>",
"string",
")",
"(",
"ReadSeekCloser",
",",
"error",
")",
"{",
"return",
"os",
".",
"Open",
"(",
"filepath",
".",
"FromSlash",
"(",
"path",
")",
")",
"\n",
"}"
] |
515 | all-516 | [
"read",
"a",
"block",
"of",
"pixels",
"from",
"the",
"frame",
"buffer"
] | [
"func",
"ReadPixels",
"(",
"x",
"int32",
",",
"y",
"int32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"pixels",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall9",
"(",
"gpReadPixels",
",",
"7",
",",
"uintptr",
"(",
"x",
")",
",",
"uintptr",
"(",
"y",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"height",
")",
",",
"uintptr",
"(",
"format",
")",
",",
"uintptr",
"(",
"xtype",
")",
",",
"uintptr",
"(",
"pixels",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
516 | all-517 | [
"Values",
"returns",
"all",
"readable",
"float64",
"in",
"a",
"single",
"buffer",
".",
"Calling",
"this",
"function",
"might",
"allocate",
"a",
"new",
"buffer",
"to",
"store",
"the",
"elements",
"contiguously",
"."
] | [
"func",
"(",
"b",
"*",
"Float64RingBuf",
")",
"Values",
"(",
")",
"[",
"]",
"float64",
"{",
"first",
",",
"second",
":=",
"b",
".",
"TwoContig",
"(",
"false",
")",
"\n\n",
"if",
"len",
"(",
"first",
")",
"==",
"0",
"{",
"return",
"second",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"second",
")",
"==",
"0",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"out",
":=",
"make",
"(",
"[",
"]",
"float64",
",",
"len",
"(",
"first",
")",
"+",
"len",
"(",
"second",
")",
")",
"\n\n",
"copy",
"(",
"out",
",",
"first",
")",
"\n",
"copy",
"(",
"out",
"[",
"len",
"(",
"first",
")",
":",
"]",
",",
"second",
")",
"\n\n",
"return",
"out",
"\n",
"}"
] |
517 | all-518 | [
"VmxPath",
"returns",
"path",
"to",
"the",
"virtual",
"machine",
"configuration",
"file",
"."
] | [
"func",
"(",
"v",
"*",
"VM",
")",
"VmxPath",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"err",
"C",
".",
"VixError",
"=",
"C",
".",
"VIX_OK",
"\n",
"var",
"path",
"*",
"C",
".",
"char",
"\n\n",
"err",
"=",
"C",
".",
"get_property",
"(",
"v",
".",
"handle",
",",
"C",
".",
"VIX_PROPERTY_VM_VMX_PATHNAME",
",",
"unsafe",
".",
"Pointer",
"(",
"&",
"path",
")",
")",
"\n\n",
"defer",
"C",
".",
"Vix_FreeBuffer",
"(",
"unsafe",
".",
"Pointer",
"(",
"path",
")",
")",
"\n\n",
"if",
"C",
".",
"VIX_OK",
"!=",
"err",
"{",
"return",
"\"",
"\"",
",",
"&",
"Error",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"int",
"(",
"err",
"&",
"0xFFFF",
")",
",",
"<mask>",
":",
"C",
".",
"GoString",
"(",
"C",
".",
"Vix_GetErrorText",
"(",
"err",
",",
"nil",
")",
")",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"C",
".",
"GoString",
"(",
"path",
")",
",",
"nil",
"\n",
"}"
] |
518 | all-519 | [
"getGaugeType",
"returns",
"accurate",
"resmon",
"type",
"for",
"underlying",
"type",
"of",
"gauge",
"value"
] | [
"func",
"(",
"m",
"*",
"CirconusMetrics",
")",
"getGaugeType",
"(",
"v",
"interface",
"{",
"}",
")",
"string",
"{",
"mt",
":=",
"\"",
"\"",
"\n",
"switch",
"v",
".",
"(",
"type",
")",
"{",
"case",
"int",
":",
"mt",
"=",
"\"",
"\"",
"\n",
"case",
"int8",
":",
"mt",
"=",
"\"",
"\"",
"\n",
"case",
"int16",
":",
"mt",
"=",
"\"",
"\"",
"\n",
"case",
"int32",
":",
"mt",
"=",
"\"",
"\"",
"\n",
"<mask>",
"uint",
":",
"mt",
"=",
"\"",
"\"",
"\n",
"case",
"uint8",
":",
"mt",
"=",
"\"",
"\"",
"\n",
"case",
"uint16",
":",
"mt",
"=",
"\"",
"\"",
"\n",
"case",
"uint32",
":",
"mt",
"=",
"\"",
"\"",
"\n",
"case",
"int64",
":",
"mt",
"=",
"\"",
"\"",
"\n",
"case",
"uint64",
":",
"mt",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"mt",
"\n",
"}"
] |
519 | all-520 | [
"CdromSubresourceSchema",
"represents",
"the",
"schema",
"for",
"the",
"cdrom",
"sub",
"-",
"resource",
"."
] | [
"func",
"CdromSubresourceSchema",
"(",
")",
"map",
"[",
"string",
"]",
"*",
"schema",
".",
"Schema",
"{",
"s",
":=",
"map",
"[",
"string",
"]",
"*",
"schema",
".",
"Schema",
"{",
"// VirtualDeviceFileBackingInfo",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeString",
",",
"Optional",
":",
"true",
",",
"<mask>",
":",
"\"",
"\"",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeString",
",",
"Optional",
":",
"true",
",",
"Description",
":",
"\"",
"\"",
",",
"}",
",",
"// VirtualCdromRemoteAtapiBackingInfo",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeBool",
",",
"Optional",
":",
"true",
",",
"Description",
":",
"\"",
"\"",
",",
"}",
",",
"}",
"\n",
"structure",
".",
"MergeSchema",
"(",
"s",
",",
"subresourceSchema",
"(",
")",
")",
"\n",
"return",
"s",
"\n",
"}"
] |
520 | all-521 | [
"Returns",
"a",
"slice",
"of",
"Typed",
"helpers",
"and",
"true",
"if",
"exists",
"otherwise",
";",
"nil",
"and",
"false",
"."
] | [
"func",
"(",
"t",
"Typed",
")",
"ObjectsIf",
"(",
"key",
"string",
")",
"(",
"[",
"]",
"Typed",
",",
"bool",
")",
"{",
"value",
",",
"exists",
":=",
"t",
"[",
"key",
"]",
"\n",
"if",
"exists",
"==",
"true",
"{",
"switch",
"t",
":=",
"value",
".",
"(",
"type",
")",
"{",
"case",
"[",
"]",
"interface",
"{",
"}",
":",
"l",
":=",
"len",
"(",
"t",
")",
"\n",
"n",
":=",
"make",
"(",
"[",
"]",
"Typed",
",",
"l",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"l",
";",
"i",
"++",
"{",
"switch",
"it",
":=",
"t",
"[",
"i",
"]",
".",
"(",
"type",
")",
"{",
"case",
"map",
"[",
"string",
"]",
"<mask>",
"{",
"}",
":",
"n",
"[",
"i",
"]",
"=",
"Typed",
"(",
"it",
")",
"\n",
"case",
"Typed",
":",
"n",
"[",
"i",
"]",
"=",
"it",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"n",
",",
"true",
"\n",
"case",
"[",
"]",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
":",
"l",
":=",
"len",
"(",
"t",
")",
"\n",
"n",
":=",
"make",
"(",
"[",
"]",
"Typed",
",",
"l",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"l",
";",
"i",
"++",
"{",
"n",
"[",
"i",
"]",
"=",
"Typed",
"(",
"t",
"[",
"i",
"]",
")",
"\n",
"}",
"\n",
"return",
"n",
",",
"true",
"\n",
"case",
"[",
"]",
"Typed",
":",
"return",
"t",
",",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"false",
"\n",
"}"
] |
521 | all-522 | [
"ParseMetricSelector",
"parses",
"the",
"provided",
"textual",
"metric",
"selector",
"into",
"a",
"list",
"of",
"label",
"matchers",
"."
] | [
"func",
"ParseMetricSelector",
"(",
"input",
"string",
")",
"(",
"m",
"[",
"]",
"*",
"labels",
".",
"Matcher",
",",
"err",
"error",
")",
"{",
"p",
":=",
"newParser",
"(",
"input",
")",
"\n",
"defer",
"p",
".",
"recover",
"(",
"&",
"err",
")",
"\n\n",
"name",
":=",
"\"",
"\"",
"\n",
"if",
"t",
":=",
"p",
".",
"peek",
"(",
")",
".",
"typ",
";",
"t",
"==",
"ItemMetricIdentifier",
"||",
"t",
"==",
"ItemIdentifier",
"{",
"<mask>",
"=",
"p",
".",
"next",
"(",
")",
".",
"val",
"\n",
"}",
"\n",
"vs",
":=",
"p",
".",
"VectorSelector",
"(",
"name",
")",
"\n",
"if",
"p",
".",
"peek",
"(",
")",
".",
"typ",
"!=",
"ItemEOF",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"p",
".",
"lex",
".",
"input",
"[",
"p",
".",
"lex",
".",
"lastPos",
":",
"]",
")",
"\n",
"}",
"\n",
"return",
"vs",
".",
"LabelMatchers",
",",
"nil",
"\n",
"}"
] |
522 | all-523 | [
"newStackFrame",
"returns",
"a",
"new",
"stack",
"frame",
"initialized",
"from",
"the",
"passed",
"in",
"program",
"counter",
"."
] | [
"func",
"newStackFrame",
"(",
"pc",
"uintptr",
")",
"*",
"stackFrame",
"{",
"fn",
":=",
"runtime",
".",
"FuncForPC",
"(",
"<mask>",
")",
"\n",
"file",
",",
"line",
":=",
"fn",
".",
"FileLine",
"(",
"pc",
")",
"\n",
"packagePath",
",",
"funcSignature",
":=",
"parseFuncName",
"(",
"fn",
".",
"Name",
"(",
")",
")",
"\n",
"_",
",",
"fileName",
":=",
"filepath",
".",
"Split",
"(",
"file",
")",
"\n\n",
"return",
"&",
"stackFrame",
"{",
"file",
":",
"filepath",
".",
"Join",
"(",
"packagePath",
",",
"fileName",
")",
",",
"line",
":",
"line",
",",
"function",
":",
"funcSignature",
",",
"}",
"\n",
"}"
] |
523 | all-524 | [
"NewConfig",
"returns",
"a",
"config",
"struct",
"created",
"by",
"merging",
"environment",
"variables",
"a",
"config",
"file",
"and",
"EC2",
"Metadata",
"info",
".",
"The",
"config",
"struct",
"it",
"returns",
"can",
"be",
"used",
"even",
"if",
"an",
"error",
"is",
"returned",
".",
"An",
"error",
"is",
"returned",
"however",
"if",
"the",
"config",
"is",
"incomplete",
"in",
"some",
"way",
"that",
"is",
"considered",
"fatal",
"."
] | [
"func",
"NewConfig",
"(",
"ec2client",
"ec2",
".",
"EC2MetadataClient",
")",
"(",
"*",
"Config",
",",
"error",
")",
"{",
"var",
"errs",
"[",
"]",
"error",
"\n",
"envConfig",
",",
"err",
":=",
"environmentConfig",
"(",
")",
"//Environment overrides all else",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"err",
")",
"\n",
"}",
"\n",
"config",
":=",
"&",
"envConfig",
"\n\n",
"if",
"config",
".",
"complete",
"(",
")",
"{",
"// No need to do file / network IO",
"return",
"config",
",",
"nil",
"\n",
"}",
"\n\n",
"fcfg",
",",
"err",
":=",
"fileConfig",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errs",
"=",
"<mask>",
"(",
"errs",
",",
"err",
")",
"\n",
"}",
"\n",
"config",
".",
"Merge",
"(",
"fcfg",
")",
"\n\n",
"config",
".",
"Merge",
"(",
"userDataConfig",
"(",
"ec2client",
")",
")",
"\n\n",
"if",
"config",
".",
"AWSRegion",
"==",
"\"",
"\"",
"{",
"if",
"config",
".",
"NoIID",
"{",
"// get it from AWS SDK if we don't have instance identity document",
"awsRegion",
",",
"err",
":=",
"ec2client",
".",
"Region",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"err",
")",
"\n",
"}",
"\n",
"config",
".",
"AWSRegion",
"=",
"awsRegion",
"\n",
"}",
"else",
"{",
"// Get it from metadata only if we need to (network io)",
"config",
".",
"Merge",
"(",
"ec2MetadataConfig",
"(",
"ec2client",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"config",
",",
"config",
".",
"mergeDefaultConfig",
"(",
"errs",
")",
"\n",
"}"
] |
524 | all-525 | [
"setLeader",
"sets",
"if",
"we",
"are",
"currently",
"the",
"leader",
"instance"
] | [
"func",
"(",
"d",
"*",
"DedupManager",
")",
"setLeader",
"(",
"tmpl",
"*",
"template",
".",
"Template",
",",
"lockCh",
"<-",
"chan",
"struct",
"{",
"}",
")",
"{",
"// Update the lock state",
"d",
".",
"leaderLock",
".",
"Lock",
"(",
")",
"\n",
"if",
"lockCh",
"!=",
"nil",
"{",
"d",
".",
"leader",
"[",
"tmpl",
"]",
"=",
"lockCh",
"\n",
"}",
"else",
"{",
"delete",
"(",
"d",
".",
"leader",
",",
"tmpl",
")",
"\n",
"}",
"\n",
"d",
".",
"leaderLock",
".",
"Unlock",
"(",
")",
"\n\n",
"// Clear the lastWrite hash if we've lost leadership",
"if",
"lockCh",
"==",
"nil",
"{",
"d",
".",
"lastWriteLock",
".",
"Lock",
"(",
")",
"\n",
"delete",
"(",
"d",
".",
"lastWrite",
",",
"tmpl",
")",
"\n",
"d",
".",
"lastWriteLock",
".",
"Unlock",
"(",
")",
"\n",
"}",
"\n\n",
"// Do an async notify of an update",
"<mask>",
"{",
"case",
"d",
".",
"updateCh",
"<-",
"struct",
"{",
"}",
"{",
"}",
":",
"default",
":",
"}",
"\n",
"}"
] |
525 | all-526 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SignedCertificateTimestamp",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork9",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
526 | all-527 | [
"UpdateContainer",
"updates",
"the",
"MAAS",
"device",
"s",
"interfaces",
"with",
"the",
"new",
"provided",
"state"
] | [
"func",
"(",
"c",
"*",
"Controller",
")",
"UpdateContainer",
"(",
"name",
"string",
",",
"interfaces",
"[",
"]",
"ContainerInterface",
")",
"error",
"{",
"// Parse the provided interfaces",
"macInterfaces",
",",
"err",
":=",
"parseInterfaces",
"(",
"interfaces",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Get all the subnets",
"subnets",
",",
"err",
":=",
"c",
".",
"getSubnets",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"device",
",",
"err",
":=",
"c",
".",
"getDevice",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Iterate over existing interfaces, drop all removed ones and update existing ones",
"existingInterfaces",
":=",
"map",
"[",
"string",
"]",
"gomaasapi",
".",
"Interface",
"{",
"}",
"\n",
"for",
"_",
",",
"entry",
":=",
"range",
"device",
".",
"InterfaceSet",
"(",
")",
"{",
"// Check if the interface has been removed from the container",
"iface",
",",
"ok",
":=",
"macInterfaces",
"[",
"entry",
".",
"MACAddress",
"(",
")",
"]",
"\n",
"if",
"!",
"ok",
"{",
"// Delete the interface in MAAS",
"err",
"=",
"entry",
".",
"Delete",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"continue",
"\n",
"}",
"\n\n",
"// Update the subnets",
"existingSubnets",
":=",
"map",
"[",
"string",
"]",
"gomaasapi",
".",
"Subnet",
"{",
"}",
"\n",
"for",
"_",
",",
"link",
":=",
"range",
"entry",
".",
"Links",
"(",
")",
"{",
"// Check if the MAAS subnet matches any of the container's",
"found",
":=",
"false",
"\n",
"for",
"_",
",",
"subnet",
":=",
"range",
"iface",
".",
"Subnets",
"{",
"if",
"subnet",
".",
"Name",
"==",
"link",
".",
"Subnet",
"(",
")",
".",
"Name",
"(",
")",
"{",
"if",
"subnet",
".",
"Address",
"==",
"\"",
"\"",
"||",
"subnet",
".",
"Address",
"==",
"link",
".",
"IPAddress",
"(",
")",
"{",
"found",
"=",
"true",
"\n",
"}",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"// If no exact match could be found, remove it from MAAS",
"if",
"!",
"found",
"{",
"err",
"=",
"entry",
".",
"UnlinkSubnet",
"(",
"link",
".",
"Subnet",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"continue",
"\n",
"}",
"\n\n",
"// Record the existing up to date subnet",
"existingSubnets",
"[",
"link",
".",
"Subnet",
"(",
")",
".",
"Name",
"(",
")",
"]",
"=",
"link",
".",
"Subnet",
"(",
")",
"\n",
"}",
"\n\n",
"// Add any missing (or updated) subnet to MAAS",
"for",
"_",
",",
"subnet",
":=",
"<mask>",
"iface",
".",
"Subnets",
"{",
"// Check that it's not configured yet",
"_",
",",
"ok",
":=",
"existingSubnets",
"[",
"subnet",
".",
"Name",
"]",
"\n",
"if",
"ok",
"{",
"continue",
"\n",
"}",
"\n\n",
"// Add the link",
"err",
":=",
"entry",
".",
"LinkSubnet",
"(",
"gomaasapi",
".",
"LinkSubnetArgs",
"{",
"Mode",
":",
"gomaasapi",
".",
"LinkModeStatic",
",",
"Subnet",
":",
"subnets",
"[",
"subnet",
".",
"Name",
"]",
",",
"IPAddress",
":",
"subnet",
".",
"Address",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Record the interface has being configured",
"existingInterfaces",
"[",
"entry",
".",
"MACAddress",
"(",
")",
"]",
"=",
"entry",
"\n",
"}",
"\n\n",
"// Iterate over expected interfaces, add any missing one",
"for",
"_",
",",
"iface",
":=",
"range",
"macInterfaces",
"{",
"_",
",",
"ok",
":=",
"existingInterfaces",
"[",
"iface",
".",
"MACAddress",
"]",
"\n",
"if",
"ok",
"{",
"// We already have it so just move on",
"continue",
"\n",
"}",
"\n\n",
"// Create the new interface",
"entry",
",",
"err",
":=",
"device",
".",
"CreateInterface",
"(",
"gomaasapi",
".",
"CreateInterfaceArgs",
"{",
"Name",
":",
"iface",
".",
"Name",
",",
"MACAddress",
":",
"iface",
".",
"MACAddress",
",",
"VLAN",
":",
"subnets",
"[",
"iface",
".",
"Subnets",
"[",
"0",
"]",
".",
"Name",
"]",
".",
"VLAN",
"(",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Add the subnets",
"for",
"_",
",",
"subnet",
":=",
"range",
"iface",
".",
"Subnets",
"{",
"err",
":=",
"entry",
".",
"LinkSubnet",
"(",
"gomaasapi",
".",
"LinkSubnetArgs",
"{",
"Mode",
":",
"gomaasapi",
".",
"LinkModeStatic",
",",
"Subnet",
":",
"subnets",
"[",
"subnet",
".",
"Name",
"]",
",",
"IPAddress",
":",
"subnet",
".",
"Address",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
527 | all-528 | [
"/",
"*",
"Debugm",
"uses",
"msg",
"as",
"a",
"format",
"string",
"with",
"subsequent",
"parameters",
"as",
"values",
"and",
"logs",
"the",
"resulting",
"message",
"to",
"all",
"added",
"loggers",
"at",
"LogLevel",
".",
"LevelDebug",
".",
"It",
"will",
"also",
"merge",
"all",
"attributes",
"passed",
"in",
"m",
"with",
"any",
"attributes",
"added",
"to",
"Base",
"and",
"include",
"them",
"with",
"the",
"message",
"if",
"the",
"Logger",
"supports",
"it",
"."
] | [
"func",
"(",
"la",
"*",
"LogAdapter",
")",
"Debugm",
"(",
"m",
"*",
"Attrs",
",",
"<mask>",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"la",
".",
"Log",
"(",
"LevelDebug",
",",
"m",
",",
"msg",
",",
"a",
"...",
")",
"\n",
"}"
] |
528 | all-529 | [
"ContainerStatsHandler",
"returns",
"the",
"handler",
"method",
"for",
"handling",
"container",
"stats",
"requests",
"."
] | [
"func",
"ContainerStatsHandler",
"(",
"state",
"dockerstate",
".",
"TaskEngineState",
",",
"statsEngine",
"stats",
".",
"Engine",
")",
"func",
"(",
"http",
".",
"ResponseWriter",
",",
"*",
"http",
".",
"Request",
")",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"taskARN",
",",
"err",
":=",
"getTaskARNByRequest",
"(",
"r",
",",
"state",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errResponseJSON",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
")",
"\n",
"utils",
".",
"WriteJSONToResponse",
"(",
"w",
",",
"http",
".",
"StatusBadRequest",
",",
"errResponseJSON",
",",
"utils",
".",
"RequestTypeTaskStats",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"containerID",
",",
"err",
":=",
"getContainerIDByRequest",
"(",
"r",
",",
"state",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"responseJSON",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
")",
"\n",
"utils",
".",
"WriteJSONToResponse",
"(",
"w",
",",
"<mask>",
".",
"StatusBadRequest",
",",
"responseJSON",
",",
"utils",
".",
"RequestTypeContainerStats",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"containerID",
")",
"\n\n",
"// v3 handler shares the same container stats response format with v2 handler.",
"v2",
".",
"WriteContainerStatsResponse",
"(",
"w",
",",
"taskARN",
",",
"containerID",
",",
"statsEngine",
")",
"\n",
"}",
"\n",
"}"
] |
529 | all-530 | [
"title",
":",
"list",
"install",
"hosts",
"path",
":",
"/",
"install",
"/",
"hosts",
"method",
":",
"GET",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"OK",
"401",
":",
"Unauthorized"
] | [
"func",
"installHostList",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermInstallManage",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"hosts",
",",
"err",
":=",
"install",
".",
"ListHosts",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"&",
"hosts",
")",
"\n",
"}"
] |
530 | all-531 | [
"Hash",
"returns",
"a",
"hash",
"value",
"for",
"the",
"label",
"set",
"."
] | [
"func",
"(",
"ls",
"Labels",
")",
"Hash",
"(",
")",
"uint64",
"{",
"b",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"0",
",",
"1024",
")",
"\n\n",
"for",
"_",
",",
"v",
":=",
"range",
"<mask>",
"{",
"b",
"=",
"append",
"(",
"b",
",",
"v",
".",
"Name",
"...",
")",
"\n",
"b",
"=",
"append",
"(",
"b",
",",
"sep",
")",
"\n",
"b",
"=",
"append",
"(",
"b",
",",
"v",
".",
"Value",
"...",
")",
"\n",
"b",
"=",
"append",
"(",
"b",
",",
"sep",
")",
"\n",
"}",
"\n",
"return",
"xxhash",
".",
"Sum64",
"(",
"b",
")",
"\n",
"}"
] |
531 | all-532 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SynthesizeScrollGestureParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoInput2",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
532 | all-533 | [
"DefaultPeerConfig",
"returns",
"the",
"default",
"config",
"."
] | [
"func",
"DefaultPeerConfig",
"(",
")",
"*",
"PeerConfig",
"{",
"return",
"&",
"PeerConfig",
"{",
"AuthEnc",
":",
"true",
",",
"HandshakeTimeout",
":",
"2",
"*",
"time",
".",
"Second",
",",
"DialTimeout",
":",
"3",
"*",
"<mask>",
".",
"Second",
",",
"MConfig",
":",
"DefaultMConnConfig",
"(",
")",
",",
"Fuzz",
":",
"false",
",",
"FuzzConfig",
":",
"DefaultFuzzConnConfig",
"(",
")",
",",
"}",
"\n",
"}"
] |
533 | all-534 | [
"IsMouseButtonJustReleased",
"returns",
"a",
"boolean",
"value",
"indicating",
"whether",
"the",
"given",
"mouse",
"button",
"is",
"released",
"just",
"in",
"the",
"current",
"frame",
".",
"IsMouseButtonJustReleased",
"is",
"concurrent",
"safe",
"."
] | [
"func",
"IsMouseButtonJustReleased",
"(",
"<mask>",
"ebiten",
".",
"MouseButton",
")",
"bool",
"{",
"theInputState",
".",
"m",
".",
"RLock",
"(",
")",
"\n",
"r",
":=",
"theInputState",
".",
"mouseButtonDurations",
"[",
"button",
"]",
"==",
"0",
"&&",
"theInputState",
".",
"prevMouseButtonDurations",
"[",
"button",
"]",
">",
"0",
"\n",
"theInputState",
".",
"m",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"r",
"\n",
"}"
] |
534 | all-535 | [
"Serialize",
"serializes",
"an",
"ordered",
"hashtree",
"."
] | [
"func",
"(",
"o",
"*",
"Ordered",
")",
"Serialize",
"(",
"_w",
"io",
".",
"Writer",
")",
"error",
"{",
"w",
":=",
"NewWriter",
"(",
"_w",
")",
"\n",
"// Unwind directory stack",
"for",
"len",
"(",
"o",
".",
"dirStack",
")",
">",
"1",
"{",
"child",
":=",
"o",
".",
"dirStack",
"[",
"len",
"(",
"o",
".",
"dirStack",
")",
"-",
"1",
"]",
"\n",
"child",
".",
"nodeProto",
".",
"Hash",
"=",
"child",
".",
"hash",
".",
"Sum",
"(",
"nil",
")",
"\n",
"o",
".",
"dirStack",
"=",
"o",
".",
"dirStack",
"[",
":",
"len",
"(",
"o",
".",
"dirStack",
")",
"-",
"1",
"]",
"\n",
"parent",
":=",
"o",
".",
"dirStack",
"[",
"len",
"(",
"o",
".",
"dirStack",
")",
"-",
"1",
"]",
"\n",
"parent",
".",
"hash",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"child",
".",
"nodeProto",
".",
"<mask>",
",",
"child",
".",
"nodeProto",
".",
"Hash",
")",
")",
")",
"\n",
"parent",
".",
"nodeProto",
".",
"SubtreeSize",
"+=",
"child",
".",
"nodeProto",
".",
"SubtreeSize",
"\n",
"}",
"\n",
"o",
".",
"fs",
"[",
"0",
"]",
".",
"nodeProto",
".",
"Hash",
"=",
"o",
".",
"fs",
"[",
"0",
"]",
".",
"hash",
".",
"Sum",
"(",
"nil",
")",
"\n",
"for",
"_",
",",
"n",
":=",
"range",
"o",
".",
"fs",
"{",
"if",
"err",
":=",
"w",
".",
"Write",
"(",
"&",
"MergeNode",
"{",
"k",
":",
"b",
"(",
"n",
".",
"path",
")",
",",
"nodeProto",
":",
"n",
".",
"nodeProto",
",",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
535 | all-536 | [
"execute",
"command",
"over",
"SSH",
"with",
"user",
"/",
"password",
"authentication"
] | [
"func",
"executeSSHCommand",
"(",
"command",
"string",
",",
"d",
"*",
"Driver",
")",
"error",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"command",
")",
"\n\n",
"config",
":=",
"&",
"cryptossh",
".",
"ClientConfig",
"{",
"User",
":",
"d",
".",
"SSHUser",
",",
"Auth",
":",
"[",
"]",
"cryptossh",
".",
"AuthMethod",
"{",
"cryptossh",
".",
"Password",
"(",
"d",
".",
"SSHPassword",
")",
",",
"}",
",",
"}",
"\n\n",
"client",
",",
"err",
":=",
"cryptossh",
".",
"Dial",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"d",
".",
"IPAddress",
",",
"d",
".",
"SSHPort",
")",
",",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"session",
",",
"err",
":=",
"client",
".",
"NewSession",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
"+",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"session",
".",
"Close",
"(",
")",
"\n\n",
"var",
"b",
"bytes",
".",
"Buffer",
"\n",
"session",
".",
"Stdout",
"=",
"&",
"b",
"\n\n",
"if",
"err",
":=",
"session",
".",
"Run",
"(",
"command",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
"+",
"err",
".",
"<mask>",
"(",
")",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"b",
".",
"String",
"(",
")",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
536 | all-537 | [
"GetExecutablePath",
"returns",
"the",
"absolute",
"path",
"to",
"the",
"currently",
"running",
"executable",
".",
"It",
"is",
"used",
"internally",
"by",
"the",
"godaemon",
"package",
"and",
"exported",
"publicly",
"because",
"it",
"s",
"useful",
"outside",
"of",
"the",
"package",
"too",
"."
] | [
"func",
"GetExecutablePath",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"exePath",
",",
"<mask>",
":=",
"Readlink",
"(",
"\"",
"\"",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"filepath",
".",
"Clean",
"(",
"exePath",
")",
",",
"err",
"\n",
"}"
] |
537 | all-538 | [
"transitionContainer",
"calls",
"applyContainerState",
"and",
"then",
"notifies",
"the",
"managed",
"task",
"of",
"the",
"change",
".",
"transitionContainer",
"is",
"called",
"by",
"progressTask",
"and",
"by",
"handleStoppedToRunningContainerTransition",
"."
] | [
"func",
"(",
"engine",
"*",
"DockerTaskEngine",
")",
"transitionContainer",
"(",
"task",
"*",
"apitask",
".",
"<mask>",
",",
"container",
"*",
"apicontainer",
".",
"Container",
",",
"to",
"apicontainerstatus",
".",
"ContainerStatus",
")",
"{",
"// Let docker events operate async so that we can continue to handle ACS / other requests",
"// This is safe because 'applyContainerState' will not mutate the task",
"metadata",
":=",
"engine",
".",
"applyContainerState",
"(",
"task",
",",
"container",
",",
"to",
")",
"\n\n",
"engine",
".",
"tasksLock",
".",
"RLock",
"(",
")",
"\n",
"managedTask",
",",
"ok",
":=",
"engine",
".",
"managedTasks",
"[",
"task",
".",
"Arn",
"]",
"\n",
"engine",
".",
"tasksLock",
".",
"RUnlock",
"(",
")",
"\n",
"if",
"ok",
"{",
"managedTask",
".",
"emitDockerContainerChange",
"(",
"dockerContainerChange",
"{",
"container",
":",
"container",
",",
"event",
":",
"dockerapi",
".",
"DockerContainerChangeEvent",
"{",
"Status",
":",
"to",
",",
"DockerContainerMetadata",
":",
"metadata",
",",
"}",
",",
"}",
")",
"\n",
"}",
"\n",
"}"
] |
538 | all-539 | [
"HasDisabled",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"u",
"*",
"<mask>",
")",
"HasDisabled",
"(",
")",
"bool",
"{",
"if",
"u",
"!=",
"nil",
"&&",
"u",
".",
"Disabled",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
539 | all-540 | [
"init",
"sets",
"the",
"configuration",
"data",
"."
] | [
"func",
"(",
"c",
"*",
"configData",
")",
"init",
"(",
")",
"error",
"{",
"_conf_login",
":=",
"&",
"conf_login",
"{",
"}",
"\n",
"cmdutil",
".",
"SetPrefix",
"(",
"\"",
"\\n",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"cfg",
",",
"err",
":=",
"shconf",
".",
"ParseFile",
"(",
"_CONF_LOGIN",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"else",
"{",
"if",
"err",
"=",
"cfg",
".",
"Unmarshal",
"(",
"_conf_login",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"_DEBUG",
"{",
"cmdutil",
".",
"Println",
"(",
"_CONF_LOGIN",
")",
"\n",
"reflectutil",
".",
"PrintStruct",
"(",
"_conf_login",
")",
"\n",
"}",
"\n\n",
"if",
"_conf_login",
".",
"PASS_MAX_DAYS",
"==",
"0",
"{",
"_conf_login",
".",
"PASS_MAX_DAYS",
"=",
"99999",
"\n",
"}",
"\n",
"if",
"_conf_login",
".",
"PASS_WARN_AGE",
"==",
"0",
"{",
"_conf_login",
".",
"PASS_WARN_AGE",
"=",
"7",
"\n",
"}",
"\n",
"}",
"\n\n",
"cfg",
",",
"err",
"=",
"shconf",
".",
"ParseFile",
"(",
"_CONF_USERADD",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"else",
"{",
"_conf_useradd",
":=",
"&",
"conf_useradd",
"{",
"}",
"\n",
"if",
"err",
"=",
"cfg",
".",
"Unmarshal",
"(",
"_conf_useradd",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"_DEBUG",
"{",
"cmdutil",
".",
"Println",
"(",
"_CONF_USERADD",
")",
"\n",
"reflectutil",
".",
"PrintStruct",
"(",
"_conf_useradd",
")",
"\n",
"}",
"\n\n",
"if",
"_conf_useradd",
".",
"HOME",
"==",
"\"",
"\"",
"{",
"_conf_useradd",
".",
"HOME",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"_conf_useradd",
".",
"SHELL",
"==",
"\"",
"\"",
"{",
"_conf_useradd",
".",
"SHELL",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"config",
".",
"useradd",
"=",
"*",
"_conf_useradd",
"\n",
"}",
"\n\n",
"// Optional files",
"<mask>",
",",
"err",
":=",
"exist",
"(",
"_CONF_ADDUSER",
")",
"// Based in Debian.",
"\n",
"if",
"found",
"{",
"cfg",
",",
"err",
":=",
"shconf",
".",
"ParseFile",
"(",
"_CONF_ADDUSER",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"_conf_adduser",
":=",
"&",
"conf_adduser",
"{",
"}",
"\n",
"if",
"err",
"=",
"cfg",
".",
"Unmarshal",
"(",
"_conf_adduser",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"_DEBUG",
"{",
"cmdutil",
".",
"Println",
"(",
"_CONF_ADDUSER",
")",
"\n",
"reflectutil",
".",
"PrintStruct",
"(",
"_conf_adduser",
")",
"\n",
"}",
"\n\n",
"if",
"_conf_login",
".",
"SYS_UID_MIN",
"==",
"0",
"||",
"_conf_login",
".",
"SYS_UID_MAX",
"==",
"0",
"||",
"_conf_login",
".",
"SYS_GID_MIN",
"==",
"0",
"||",
"_conf_login",
".",
"SYS_GID_MAX",
"==",
"0",
"||",
"_conf_login",
".",
"UID_MIN",
"==",
"0",
"||",
"_conf_login",
".",
"UID_MAX",
"==",
"0",
"||",
"_conf_login",
".",
"GID_MIN",
"==",
"0",
"||",
"_conf_login",
".",
"GID_MAX",
"==",
"0",
"{",
"_conf_login",
".",
"SYS_UID_MIN",
"=",
"_conf_adduser",
".",
"FIRST_SYSTEM_UID",
"\n",
"_conf_login",
".",
"SYS_UID_MAX",
"=",
"_conf_adduser",
".",
"LAST_SYSTEM_UID",
"\n",
"_conf_login",
".",
"SYS_GID_MIN",
"=",
"_conf_adduser",
".",
"FIRST_SYSTEM_GID",
"\n",
"_conf_login",
".",
"SYS_GID_MAX",
"=",
"_conf_adduser",
".",
"LAST_SYSTEM_GID",
"\n\n",
"_conf_login",
".",
"UID_MIN",
"=",
"_conf_adduser",
".",
"FIRST_UID",
"\n",
"_conf_login",
".",
"UID_MAX",
"=",
"_conf_adduser",
".",
"LAST_UID",
"\n",
"_conf_login",
".",
"GID_MIN",
"=",
"_conf_adduser",
".",
"FIRST_GID",
"\n",
"_conf_login",
".",
"GID_MAX",
"=",
"_conf_adduser",
".",
"LAST_GID",
"\n",
"}",
"\n",
"}",
"else",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n\n",
"}",
"else",
"if",
"found",
",",
"err",
"=",
"exist",
"(",
"_CONF_LIBUSER",
")",
";",
"found",
"{",
"// Based in Red Hat.",
"cfg",
",",
"err",
":=",
"shconf",
".",
"ParseFile",
"(",
"_CONF_LIBUSER",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"_conf_libuser",
":=",
"&",
"conf_libuser",
"{",
"}",
"\n",
"if",
"err",
"=",
"cfg",
".",
"Unmarshal",
"(",
"_conf_libuser",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"_DEBUG",
"{",
"cmdutil",
".",
"Println",
"(",
"_CONF_LIBUSER",
")",
"\n",
"reflectutil",
".",
"PrintStruct",
"(",
"_conf_libuser",
")",
"\n",
"}",
"\n\n",
"if",
"_conf_libuser",
".",
"login_defs",
"!=",
"_CONF_LOGIN",
"{",
"_conf_login",
".",
"ENCRYPT_METHOD",
"=",
"_conf_libuser",
".",
"crypt_style",
"\n",
"_conf_login",
".",
"SHA_CRYPT_MIN_ROUNDS",
"=",
"_conf_libuser",
".",
"hash_rounds_min",
"\n",
"_conf_login",
".",
"SHA_CRYPT_MAX_ROUNDS",
"=",
"_conf_libuser",
".",
"hash_rounds_max",
"\n",
"}",
"\n",
"}",
"else",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n\n",
"}",
"/*else if found, err = exist(_CONF_PASSWD); found {\n\t\tcfg, err := shconf.ParseFile(_CONF_PASSWD)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_conf_passwd := &conf_passwd{}\n\t\tif err = cfg.Unmarshal(_conf_passwd); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif _DEBUG {\n\t\t\tcmdutil.Println(_CONF_PASSWD)\n\t\t\treflectutil.PrintStruct(_conf_passwd)\n\t\t}\n\n\t\tif _conf_passwd.CRYPT != \"\" {\n\t\t\t_conf_login.ENCRYPT_METHOD = _conf_passwd.CRYPT\n\t\t}\n\t} else if err != nil {\n\t\treturn err\n\t}*/",
"\n\n",
"switch",
"strings",
".",
"ToUpper",
"(",
"_conf_login",
".",
"ENCRYPT_METHOD",
")",
"{",
"case",
"\"",
"\"",
":",
"c",
".",
"crypter",
"=",
"crypt",
".",
"New",
"(",
"crypt",
".",
"MD5",
")",
"\n",
"case",
"\"",
"\"",
":",
"c",
".",
"crypter",
"=",
"crypt",
".",
"New",
"(",
"crypt",
".",
"SHA256",
")",
"\n",
"case",
"\"",
"\"",
":",
"c",
".",
"crypter",
"=",
"crypt",
".",
"New",
"(",
"crypt",
".",
"SHA512",
")",
"\n",
"case",
"\"",
"\"",
":",
"if",
"c",
".",
"crypter",
",",
"err",
"=",
"lookupCrypter",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"default",
":",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"c",
".",
"login",
".",
"ENCRYPT_METHOD",
")",
"\n",
"}",
"\n\n",
"if",
"_conf_login",
".",
"SYS_UID_MIN",
"==",
"0",
"||",
"_conf_login",
".",
"SYS_UID_MAX",
"==",
"0",
"||",
"_conf_login",
".",
"SYS_GID_MIN",
"==",
"0",
"||",
"_conf_login",
".",
"SYS_GID_MAX",
"==",
"0",
"||",
"_conf_login",
".",
"UID_MIN",
"==",
"0",
"||",
"_conf_login",
".",
"UID_MAX",
"==",
"0",
"||",
"_conf_login",
".",
"GID_MIN",
"==",
"0",
"||",
"_conf_login",
".",
"GID_MAX",
"==",
"0",
"{",
"_conf_login",
".",
"SYS_UID_MIN",
"=",
"100",
"\n",
"_conf_login",
".",
"SYS_UID_MAX",
"=",
"999",
"\n",
"_conf_login",
".",
"SYS_GID_MIN",
"=",
"100",
"\n",
"_conf_login",
".",
"SYS_GID_MAX",
"=",
"999",
"\n\n",
"_conf_login",
".",
"UID_MIN",
"=",
"1000",
"\n",
"_conf_login",
".",
"UID_MAX",
"=",
"29999",
"\n",
"_conf_login",
".",
"GID_MIN",
"=",
"1000",
"\n",
"_conf_login",
".",
"GID_MAX",
"=",
"29999",
"\n",
"}",
"\n\n",
"config",
".",
"login",
"=",
"*",
"_conf_login",
"\n",
"return",
"nil",
"\n",
"}"
] |
540 | all-541 | [
"advanceCommit",
"either",
"starts",
"or",
"finishes",
"a",
"commit",
"depending",
"on",
"the",
"state",
"of",
"the",
"cluster",
"."
] | [
"func",
"(",
"w",
"*",
"worker",
")",
"advanceCommit",
"(",
"c",
"*",
"client",
".",
"APIClient",
")",
"error",
"{",
"if",
"len",
"(",
"w",
".",
"started",
")",
">=",
"maxStartedCommits",
"||",
"len",
"(",
"w",
".",
"finished",
")",
"==",
"0",
"{",
"// Randomly select a commit that has been started and finish it",
"if",
"len",
"(",
"w",
".",
"started",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"i",
":=",
"w",
".",
"rand",
".",
"Intn",
"(",
"len",
"(",
"w",
".",
"started",
")",
")",
"\n",
"commit",
":=",
"w",
".",
"started",
"[",
"i",
"]",
"\n\n",
"// Before we finish a commit, we add a file. This assures that there",
"// won't be any empty commits which will later crash jobs",
"if",
"_",
",",
"err",
":=",
"c",
".",
"PutFile",
"(",
"commit",
".",
"Repo",
".",
"Name",
",",
"commit",
".",
"ID",
",",
"w",
".",
"randString",
"(",
"10",
")",
",",
"w",
".",
"reader",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"c",
".",
"FinishCommit",
"(",
"commit",
".",
"Repo",
".",
"Name",
",",
"commit",
".",
"ID",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"// remove commit[i] from 'started' and add it to 'finished'",
"w",
".",
"started",
"=",
"append",
"(",
"w",
".",
"started",
"[",
":",
"i",
"]",
",",
"w",
".",
"started",
"[",
"i",
"+",
"1",
":",
"]",
"...",
")",
"\n",
"w",
".",
"finished",
"=",
"append",
"(",
"w",
".",
"finished",
",",
"commit",
")",
"\n",
"}",
"else",
"{",
"// Start a new commmit (parented off of a commit that we've finished)",
"commit",
":=",
"w",
".",
"<mask>",
"[",
"w",
".",
"rand",
".",
"Intn",
"(",
"len",
"(",
"w",
".",
"finished",
")",
")",
"]",
"\n",
"commit",
",",
"err",
":=",
"c",
".",
"StartCommitParent",
"(",
"commit",
".",
"Repo",
".",
"Name",
",",
"\"",
"\"",
",",
"commit",
".",
"ID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"w",
".",
"started",
"=",
"append",
"(",
"w",
".",
"started",
",",
"commit",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
541 | all-542 | [
"Split",
"fileLogger"
] | [
"func",
"(",
"f",
"*",
"FileLogger",
")",
"split",
"(",
")",
"{",
"logFile",
":=",
"joinFilePath",
"(",
"f",
".",
"fileDir",
",",
"f",
".",
"fileName",
")",
"\n\n",
"switch",
"f",
".",
"splitType",
"{",
"case",
"SplitType_Size",
":",
"f",
".",
"suffix",
"=",
"int",
"(",
"f",
".",
"suffix",
"%",
"f",
".",
"fileCount",
"+",
"1",
")",
"\n",
"if",
"f",
".",
"logFile",
"!=",
"nil",
"{",
"f",
".",
"logFile",
".",
"Close",
"(",
")",
"\n",
"}",
"\n\n",
"logFileBak",
":=",
"logFile",
"+",
"\"",
"\"",
"+",
"strconv",
".",
"Itoa",
"(",
"f",
".",
"suffix",
")",
"\n",
"if",
"isExist",
"(",
"logFileBak",
")",
"{",
"os",
".",
"Remove",
"(",
"logFileBak",
")",
"\n",
"}",
"\n",
"os",
".",
"Rename",
"(",
"logFile",
",",
"logFileBak",
")",
"\n\n",
"f",
".",
"logFile",
",",
"_",
"=",
"os",
".",
"Create",
"(",
"logFile",
")",
"\n",
"f",
".",
"lg",
"=",
"log",
".",
"New",
"(",
"f",
".",
"logFile",
",",
"f",
".",
"prefix",
",",
"log",
".",
"LstdFlags",
"|",
"log",
".",
"Lmicroseconds",
")",
"\n\n",
"case",
"SplitType_Daily",
":",
"logFileBak",
":=",
"logFile",
"+",
"\"",
"\"",
"+",
"f",
".",
"date",
".",
"Format",
"(",
"DATEFORMAT",
")",
"\n",
"if",
"!",
"isExist",
"(",
"logFileBak",
")",
"&&",
"f",
".",
"isMustSplit",
"(",
")",
"{",
"if",
"f",
".",
"logFile",
"!=",
"nil",
"{",
"f",
".",
"logFile",
".",
"Close",
"(",
")",
"\n",
"}",
"\n\n",
"err",
":=",
"os",
".",
"Rename",
"(",
"logFile",
",",
"logFileBak",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"f",
".",
"lg",
".",
"Printf",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"t",
",",
"_",
":=",
"time",
".",
"Parse",
"(",
"DATEFORMAT",
",",
"time",
".",
"Now",
"(",
")",
".",
"Format",
"(",
"DATEFORMAT",
")",
")",
"\n",
"f",
".",
"date",
"=",
"&",
"t",
"\n",
"f",
".",
"logFile",
",",
"_",
"=",
"os",
".",
"Create",
"(",
"logFile",
")",
"\n",
"f",
".",
"lg",
"=",
"log",
".",
"New",
"(",
"f",
".",
"logFile",
",",
"f",
".",
"<mask>",
",",
"log",
".",
"LstdFlags",
"|",
"log",
".",
"Lmicroseconds",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
542 | all-543 | [
"initialize",
"a",
"texture",
"as",
"a",
"data",
"alias",
"of",
"another",
"texture",
"s",
"data",
"store"
] | [
"func",
"TextureView",
"(",
"texture",
"uint32",
",",
"target",
"uint32",
",",
"origtexture",
"uint32",
",",
"internalformat",
"uint32",
",",
"minlevel",
"uint32",
",",
"numlevels",
"uint32",
",",
"minlayer",
"uint32",
",",
"numlayers",
"uint32",
")",
"{",
"syscall",
".",
"Syscall9",
"(",
"gpTextureView",
",",
"8",
",",
"uintptr",
"(",
"texture",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"origtexture",
")",
",",
"uintptr",
"(",
"internalformat",
")",
",",
"uintptr",
"(",
"minlevel",
")",
",",
"uintptr",
"(",
"numlevels",
")",
",",
"uintptr",
"(",
"minlayer",
")",
",",
"uintptr",
"(",
"numlayers",
")",
",",
"0",
")",
"\n",
"}"
] |
543 | all-544 | [
"attach",
"a",
"renderbuffer",
"as",
"a",
"logical",
"buffer",
"of",
"a",
"framebuffer",
"object"
] | [
"func",
"FramebufferRenderbuffer",
"(",
"<mask>",
"uint32",
",",
"attachment",
"uint32",
",",
"renderbuffertarget",
"uint32",
",",
"renderbuffer",
"uint32",
")",
"{",
"C",
".",
"glowFramebufferRenderbuffer",
"(",
"gpFramebufferRenderbuffer",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"attachment",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"renderbuffertarget",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"renderbuffer",
")",
")",
"\n",
"}"
] |
544 | all-545 | [
"createRepo",
"creates",
"a",
"new",
"repo",
"in",
"the",
"cluster"
] | [
"func",
"(",
"w",
"*",
"worker",
")",
"createRepo",
"(",
"c",
"*",
"client",
".",
"APIClient",
")",
"error",
"{",
"repoName",
":=",
"w",
".",
"randString",
"(",
"10",
")",
"\n",
"if",
"err",
":=",
"c",
".",
"CreateRepo",
"(",
"repoName",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"w",
".",
"repos",
"=",
"append",
"(",
"w",
".",
"repos",
",",
"&",
"pfs",
".",
"Repo",
"{",
"Name",
":",
"repoName",
"}",
")",
"\n\n",
"// Start the first commit in the repo (no parent). This is critical to",
"// advanceCommit(), which will try to finish a commit the first time it's",
"// called, and therefore must have an open commit to finish.",
"commit",
",",
"err",
":=",
"c",
".",
"StartCommit",
"(",
"repoName",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"w",
".",
"<mask>",
"=",
"append",
"(",
"w",
".",
"started",
",",
"commit",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
545 | all-546 | [
"readMessage",
"reads",
"a",
"line",
"from",
"the",
"connection",
"and",
"parses",
"it",
"as",
"an",
"IRC",
"message",
"."
] | [
"func",
"(",
"c",
"Client",
")",
"readMessage",
"(",
")",
"(",
"irc",
".",
"Message",
",",
"error",
")",
"{",
"if",
"err",
":=",
"c",
".",
"conn",
".",
"SetReadDeadline",
"(",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"c",
".",
"readTimeout",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"irc",
".",
"Message",
"{",
"}",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"line",
",",
"err",
":=",
"c",
".",
"rw",
".",
"ReadString",
"(",
"'\\n'",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"irc",
".",
"<mask>",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"c",
".",
"nick",
",",
"strings",
".",
"TrimRight",
"(",
"line",
",",
"\"",
"\\r",
"\\n",
"\"",
")",
")",
"\n\n",
"m",
",",
"err",
":=",
"irc",
".",
"ParseMessage",
"(",
"line",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"irc",
".",
"ErrTruncated",
"{",
"return",
"irc",
".",
"Message",
"{",
"}",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"line",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"m",
",",
"nil",
"\n",
"}"
] |
546 | all-547 | [
"Finish",
"declares",
"that",
"this",
"trace",
"is",
"complete",
".",
"The",
"trace",
"should",
"not",
"be",
"used",
"after",
"calling",
"this",
"method",
"."
] | [
"func",
"(",
"t",
"*",
"<mask>",
")",
"Finish",
"(",
")",
"{",
"if",
"t",
".",
"err",
"{",
"incrError",
"(",
"t",
")",
"\n",
"}",
"\n",
"incr",
"(",
"t",
")",
"\n",
"duration",
"(",
"t",
")",
"\n",
"if",
"t",
".",
"err",
"{",
"incrError",
"(",
"t",
")",
"\n",
"}",
"\n",
"t",
".",
"trace",
".",
"Finish",
"(",
")",
"\n",
"}"
] |
547 | all-548 | [
"disable",
"stops",
"using",
"the",
"array",
"buffer",
"."
] | [
"func",
"(",
"a",
"*",
"arrayBufferLayout",
")",
"disable",
"(",
"context",
"*",
"context",
",",
"program",
"program",
")",
"{",
"// TODO: Disabling should be done in reversed order?",
"for",
"i",
":=",
"range",
"a",
".",
"parts",
"{",
"context",
".",
"disableVertexAttribArray",
"(",
"<mask>",
",",
"i",
")",
"\n",
"}",
"\n",
"}"
] |
548 | all-549 | [
"UpdateDefaultClusterFromName",
"updates",
"cluster",
"advertise",
"URLs",
"with",
"if",
"available",
"default",
"host",
"if",
"advertise",
"URLs",
"are",
"default",
"values",
"(",
"localhost",
":",
"2379",
"2380",
")",
"AND",
"if",
"listen",
"URL",
"is",
"0",
".",
"0",
".",
"0",
".",
"0",
".",
"e",
".",
"g",
".",
"advertise",
"peer",
"URL",
"localhost",
":",
"2380",
"or",
"listen",
"peer",
"URL",
"0",
".",
"0",
".",
"0",
".",
"0",
":",
"2380",
"then",
"the",
"advertise",
"peer",
"host",
"would",
"be",
"updated",
"with",
"machine",
"s",
"default",
"host",
"while",
"keeping",
"the",
"listen",
"URL",
"s",
"port",
".",
"User",
"can",
"work",
"around",
"this",
"by",
"explicitly",
"setting",
"URL",
"with",
"127",
".",
"0",
".",
"0",
".",
"1",
".",
"It",
"returns",
"the",
"default",
"hostname",
"if",
"used",
"and",
"the",
"error",
"if",
"any",
"from",
"getting",
"the",
"machine",
"s",
"default",
"host",
".",
"TODO",
":",
"check",
"whether",
"fields",
"are",
"set",
"instead",
"of",
"whether",
"fields",
"have",
"default",
"value"
] | [
"func",
"(",
"cfg",
"*",
"Config",
")",
"UpdateDefaultClusterFromName",
"(",
"defaultInitialCluster",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"defaultHostname",
"==",
"\"",
"\"",
"||",
"defaultHostStatus",
"!=",
"nil",
"{",
"// update 'initial-cluster' when only the name is specified (e.g. 'etcd --name=abc')",
"if",
"cfg",
".",
"Name",
"!=",
"DefaultName",
"&&",
"cfg",
".",
"InitialCluster",
"==",
"defaultInitialCluster",
"{",
"cfg",
".",
"InitialCluster",
"=",
"cfg",
".",
"InitialClusterFromName",
"(",
"cfg",
".",
"Name",
")",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"defaultHostStatus",
"\n",
"}",
"\n\n",
"used",
":=",
"false",
"\n",
"pip",
",",
"pport",
":=",
"cfg",
".",
"LPUrls",
"[",
"0",
"]",
".",
"Hostname",
"(",
")",
",",
"cfg",
".",
"LPUrls",
"[",
"0",
"]",
".",
"Port",
"(",
")",
"\n",
"if",
"cfg",
".",
"defaultPeerHost",
"(",
")",
"&&",
"pip",
"==",
"\"",
"\"",
"{",
"cfg",
".",
"APUrls",
"[",
"0",
"]",
"=",
"<mask>",
".",
"URL",
"{",
"Scheme",
":",
"cfg",
".",
"APUrls",
"[",
"0",
"]",
".",
"Scheme",
",",
"Host",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"defaultHostname",
",",
"pport",
")",
"}",
"\n",
"used",
"=",
"true",
"\n",
"}",
"\n",
"// update 'initial-cluster' when only the name is specified (e.g. 'etcd --name=abc')",
"if",
"cfg",
".",
"Name",
"!=",
"DefaultName",
"&&",
"cfg",
".",
"InitialCluster",
"==",
"defaultInitialCluster",
"{",
"cfg",
".",
"InitialCluster",
"=",
"cfg",
".",
"InitialClusterFromName",
"(",
"cfg",
".",
"Name",
")",
"\n",
"}",
"\n\n",
"cip",
",",
"cport",
":=",
"cfg",
".",
"LCUrls",
"[",
"0",
"]",
".",
"Hostname",
"(",
")",
",",
"cfg",
".",
"LCUrls",
"[",
"0",
"]",
".",
"Port",
"(",
")",
"\n",
"if",
"cfg",
".",
"defaultClientHost",
"(",
")",
"&&",
"cip",
"==",
"\"",
"\"",
"{",
"cfg",
".",
"ACUrls",
"[",
"0",
"]",
"=",
"url",
".",
"URL",
"{",
"Scheme",
":",
"cfg",
".",
"ACUrls",
"[",
"0",
"]",
".",
"Scheme",
",",
"Host",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"defaultHostname",
",",
"cport",
")",
"}",
"\n",
"used",
"=",
"true",
"\n",
"}",
"\n",
"dhost",
":=",
"defaultHostname",
"\n",
"if",
"!",
"used",
"{",
"dhost",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"dhost",
",",
"defaultHostStatus",
"\n",
"}"
] |
549 | all-550 | [
"ReadRequest",
"reads",
"a",
"http",
".",
"Request",
"from",
"the",
"given",
"readers",
"."
] | [
"func",
"ReadRequest",
"(",
"call",
"tchannel",
".",
"ArgReadable",
")",
"(",
"*",
"http",
".",
"Request",
",",
"error",
")",
"{",
"var",
"arg2",
"[",
"]",
"byte",
"\n",
"if",
"err",
":=",
"tchannel",
".",
"NewArgReader",
"(",
"call",
".",
"Arg2Reader",
"(",
")",
")",
".",
"Read",
"(",
"&",
"arg2",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"rb",
":=",
"typed",
".",
"NewReadBuffer",
"(",
"arg2",
")",
"\n",
"method",
":=",
"rb",
".",
"ReadLen8String",
"(",
")",
"\n",
"<mask>",
":=",
"readVarintString",
"(",
"rb",
")",
"\n\n",
"r",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"method",
",",
"url",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"readHeaders",
"(",
"rb",
",",
"r",
".",
"Header",
")",
"\n\n",
"if",
"err",
":=",
"rb",
".",
"Err",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"r",
".",
"Body",
",",
"err",
"=",
"call",
".",
"Arg3Reader",
"(",
")",
"\n",
"return",
"r",
",",
"err",
"\n",
"}"
] |
550 | all-551 | [
"Realize",
"is",
"a",
"wrapper",
"around",
"gdk_gl_context_realize",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"GLContext",
")",
"Realize",
"(",
")",
"(",
"bool",
",",
"error",
")",
"{",
"var",
"err",
"*",
"C",
".",
"GError",
"\n",
"r",
":=",
"gobool",
"(",
"C",
".",
"gdk_gl_context_realize",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"err",
")",
")",
"\n",
"if",
"!",
"r",
"{",
"defer",
"C",
".",
"g_error_free",
"(",
"err",
")",
"\n",
"return",
"r",
",",
"errors",
".",
"New",
"(",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"err",
".",
"<mask>",
")",
")",
")",
"\n",
"}",
"\n\n",
"return",
"r",
",",
"nil",
"\n",
"}"
] |
551 | all-552 | [
"CancelRotateSecretRequest",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockSecretsManagerAPI",
")",
"CancelRotateSecretRequest",
"(",
"arg0",
"*",
"secretsmanager",
".",
"CancelRotateSecretInput",
")",
"(",
"*",
"request",
".",
"Request",
",",
"*",
"secretsmanager",
".",
"CancelRotateSecretOutput",
")",
"{",
"<mask>",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"request",
".",
"Request",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"*",
"secretsmanager",
".",
"CancelRotateSecretOutput",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
552 | all-553 | [
"SetProperty",
"sets",
"a",
"ZFS",
"property",
"on",
"the",
"receiving",
"dataset",
".",
"A",
"full",
"list",
"of",
"available",
"ZFS",
"properties",
"may",
"be",
"found",
"here",
":",
"https",
":",
"//",
"www",
".",
"freebsd",
".",
"org",
"/",
"cgi",
"/",
"man",
".",
"cgi?zfs",
"(",
"8",
")",
"."
] | [
"func",
"(",
"d",
"*",
"Dataset",
")",
"SetProperty",
"(",
"key",
",",
"val",
"string",
")",
"error",
"{",
"prop",
":=",
"strings",
".",
"Join",
"(",
"[",
"]",
"string",
"{",
"<mask>",
",",
"val",
"}",
",",
"\"",
"\"",
")",
"\n",
"_",
",",
"err",
":=",
"zfs",
"(",
"\"",
"\"",
",",
"prop",
",",
"d",
".",
"Name",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
553 | all-554 | [
"ChannelKey",
"returns",
"the",
"unique",
"channel",
"identifier",
"used",
"in",
"a",
"Privatix",
"Service",
"Contract",
"."
] | [
"func",
"ChannelKey",
"(",
"client",
",",
"agent",
"HexString",
",",
"block",
"uint32",
",",
"offeringHash",
"HexString",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"clientAddr",
",",
"err",
":=",
"HexToAddress",
"(",
"client",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"agentAddr",
",",
"err",
":=",
"HexToAddress",
"(",
"agent",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"hash",
",",
"err",
":=",
"base64",
".",
"URLEncoding",
".",
"DecodeString",
"(",
"strings",
".",
"TrimSpace",
"(",
"string",
"(",
"offeringHash",
")",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"blockBytes",
":=",
"Uint32ToBytes",
"(",
"<mask>",
")",
"\n\n",
"return",
"crypto",
".",
"Keccak256",
"(",
"clientAddr",
".",
"Bytes",
"(",
")",
",",
"agentAddr",
".",
"Bytes",
"(",
")",
",",
"blockBytes",
"[",
":",
"]",
",",
"common",
".",
"BytesToHash",
"(",
"hash",
")",
".",
"Bytes",
"(",
")",
")",
",",
"nil",
"\n",
"}"
] |
554 | all-555 | [
"SetConsoleTextAttribute",
"sets",
"the",
"attributes",
"of",
"characters",
"written",
"to",
"the",
"console",
"screen",
"buffer",
"by",
"the",
"WriteFile",
"or",
"WriteConsole",
"function",
".",
"See",
"http",
":",
"//",
"msdn",
".",
"microsoft",
".",
"com",
"/",
"en",
"-",
"us",
"/",
"library",
"/",
"windows",
"/",
"desktop",
"/",
"ms686047",
"(",
"v",
"=",
"vs",
".",
"85",
")",
".",
"aspx",
"."
] | [
"func",
"SetConsoleTextAttribute",
"(",
"handle",
"uintptr",
",",
"attribute",
"uint16",
")",
"error",
"{",
"r1",
",",
"r2",
",",
"err",
":=",
"setConsoleTextAttributeProc",
".",
"Call",
"(",
"handle",
",",
"uintptr",
"(",
"attribute",
")",
",",
"0",
")",
"\n",
"use",
"(",
"<mask>",
")",
"\n",
"return",
"checkError",
"(",
"r1",
",",
"r2",
",",
"err",
")",
"\n",
"}"
] |
555 | all-556 | [
"MustRegister",
"is",
"a",
"helper",
"that",
"calls",
"Register",
"and",
"panics",
"if",
"it",
"returns",
"an",
"error"
] | [
"func",
"(",
"di",
"*",
"dependencyInjector",
")",
"MustRegister",
"(",
"constructorFunc",
"<mask>",
"{",
"}",
")",
"{",
"err",
":=",
"di",
".",
"Register",
"(",
"constructorFunc",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"}"
] |
556 | all-557 | [
"FailFunc",
"outputs",
"Fail",
"level",
"log",
"returned",
"from",
"the",
"function"
] | [
"func",
"(",
"g",
"*",
"Glg",
")",
"FailFunc",
"(",
"f",
"func",
"(",
")",
"string",
")",
"error",
"{",
"if",
"g",
".",
"isModeEnable",
"(",
"FAIL",
")",
"{",
"return",
"g",
".",
"<mask>",
"(",
"FAIL",
",",
"\"",
"\"",
",",
"f",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
557 | all-558 | [
"VerifyBody",
"returns",
"a",
"handler",
"that",
"verifies",
"that",
"the",
"body",
"of",
"the",
"request",
"matches",
"the",
"passed",
"in",
"byte",
"array",
".",
"It",
"does",
"this",
"using",
"Equal",
"()",
"."
] | [
"func",
"VerifyBody",
"(",
"expectedBody",
"[",
"]",
"byte",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"CombineHandlers",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"body",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"req",
".",
"<mask>",
")",
"\n",
"req",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"Expect",
"(",
"err",
")",
".",
"ShouldNot",
"(",
"HaveOccurred",
"(",
")",
")",
"\n",
"Expect",
"(",
"body",
")",
".",
"Should",
"(",
"Equal",
"(",
"expectedBody",
")",
",",
"\"",
"\"",
")",
"\n",
"}",
",",
")",
"\n",
"}"
] |
558 | all-559 | [
"Callback",
"is",
"used",
"to",
"retrieve",
"new",
"log",
"segments"
] | [
"func",
"(",
"lens",
"Lens",
")",
"Callback",
"(",
"artifacts",
"[",
"]",
"lenses",
".",
"Artifact",
",",
"resourceDir",
"string",
",",
"data",
"string",
")",
"string",
"{",
"var",
"request",
"LineRequest",
"\n",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"[",
"]",
"byte",
"(",
"data",
")",
",",
"&",
"request",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"artifact",
",",
"ok",
":=",
"artifactByName",
"(",
"artifacts",
",",
"request",
".",
"Artifact",
")",
"\n",
"if",
"!",
"<mask>",
"{",
"return",
"\"",
"\"",
"+",
"request",
".",
"Artifact",
"\n",
"}",
"\n\n",
"var",
"lines",
"[",
"]",
"string",
"\n",
"if",
"request",
".",
"Offset",
"==",
"0",
"&&",
"request",
".",
"Length",
"==",
"-",
"1",
"{",
"lines",
",",
"err",
"=",
"logLinesAll",
"(",
"artifact",
")",
"\n",
"}",
"else",
"{",
"lines",
",",
"err",
"=",
"logLines",
"(",
"artifact",
",",
"request",
".",
"Offset",
",",
"request",
".",
"Length",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"logLines",
":=",
"highlightLines",
"(",
"lines",
",",
"request",
".",
"StartLine",
")",
"\n",
"return",
"executeTemplate",
"(",
"resourceDir",
",",
"\"",
"\"",
",",
"logLines",
")",
"\n",
"}"
] |
559 | all-560 | [
"RunApp",
"runs",
"an",
"application",
"using",
"the",
"provided",
"arguments",
".",
"The",
"arguments",
"should",
"be",
"of",
"the",
"same",
"form",
"as",
"os",
".",
"Args",
"(",
"the",
"first",
"element",
"contains",
"the",
"invoking",
"executable",
"command",
"and",
"the",
"rest",
"contain",
"the",
"elements",
")",
".",
"If",
"there",
"are",
"flags",
"that",
"can",
"occur",
"before",
"the",
"proxy",
"command",
"that",
"should",
"be",
"ignored",
"for",
"the",
"purposes",
"of",
"determining",
"whether",
"or",
"not",
"a",
"command",
"is",
"a",
"proxy",
"command",
"they",
"should",
"be",
"provided",
"in",
"fset",
".",
"If",
"osArgs",
"[",
"1",
"]",
"of",
"the",
"non",
"-",
"flag",
"arguments",
"exists",
"and",
"is",
"a",
"proxy",
"command",
"the",
"corresponding",
"command",
"in",
"cmdSet",
"is",
"run",
"with",
"the",
"rest",
"of",
"the",
"arguments",
"and",
"os",
".",
"Exit",
"is",
"called",
".",
"Otherwise",
"the",
"provided",
"app",
"function",
"is",
"run",
"and",
"its",
"return",
"value",
"is",
"returned",
"."
] | [
"func",
"RunApp",
"(",
"osArgs",
"[",
"]",
"string",
",",
"fset",
"*",
"<mask>",
".",
"FlagSet",
",",
"cmdLibrary",
"CmdLibrary",
",",
"app",
"func",
"(",
"osArgs",
"[",
"]",
"string",
")",
"int",
")",
"int",
"{",
"// process provided commands and process if it is a proxy command",
"if",
"processProxyCmd",
"(",
"osArgs",
",",
"fset",
",",
"cmdLibrary",
")",
"{",
"return",
"0",
"\n",
"}",
"\n\n",
"// otherwise, run the provided application",
"return",
"app",
"(",
"osArgs",
")",
"\n",
"}"
] |
560 | all-561 | [
"GetWarningRecoveryOk",
"returns",
"a",
"tuple",
"with",
"the",
"WarningRecovery",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"ThresholdCount",
")",
"GetWarningRecoveryOk",
"(",
")",
"(",
"json",
".",
"Number",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"WarningRecovery",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"WarningRecovery",
",",
"<mask>",
"\n",
"}"
] |
561 | all-562 | [
"UnmarshalPrivateKey",
"converts",
"a",
"protobuf",
"serialized",
"private",
"key",
"into",
"its",
"representative",
"object"
] | [
"func",
"UnmarshalPrivateKey",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"PrivKey",
",",
"error",
")",
"{",
"pmes",
":=",
"new",
"(",
"<mask>",
".",
"PrivateKey",
")",
"\n",
"err",
":=",
"proto",
".",
"Unmarshal",
"(",
"data",
",",
"pmes",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"um",
",",
"ok",
":=",
"PrivKeyUnmarshallers",
"[",
"pmes",
".",
"GetType",
"(",
")",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"ErrBadKeyType",
"\n",
"}",
"\n\n",
"return",
"um",
"(",
"pmes",
".",
"GetData",
"(",
")",
")",
"\n",
"}"
] |
562 | all-563 | [
"encodedDiscardStats",
"returns",
"[]",
"byte",
"representation",
"of",
"lfDiscardStats",
"This",
"will",
"be",
"called",
"while",
"storing",
"stats",
"in",
"BadgerDB"
] | [
"func",
"(",
"vlog",
"*",
"valueLog",
")",
"encodedDiscardStats",
"(",
")",
"[",
"]",
"<mask>",
"{",
"vlog",
".",
"lfDiscardStats",
".",
"Lock",
"(",
")",
"\n",
"defer",
"vlog",
".",
"lfDiscardStats",
".",
"Unlock",
"(",
")",
"\n\n",
"encodedStats",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"vlog",
".",
"lfDiscardStats",
".",
"m",
")",
"\n",
"return",
"encodedStats",
"\n",
"}"
] |
563 | all-564 | [
"handleArtifactView",
"handles",
"requests",
"to",
"load",
"a",
"single",
"view",
"for",
"a",
"job",
".",
"This",
"is",
"what",
"viewers",
"will",
"use",
"to",
"call",
"back",
"to",
"themselves",
".",
"Query",
"params",
":",
"-",
"name",
":",
"required",
"specifies",
"the",
"name",
"of",
"the",
"viewer",
"to",
"load",
"-",
"src",
":",
"required",
"specifies",
"the",
"job",
"source",
"from",
"which",
"to",
"fetch",
"artifacts"
] | [
"func",
"handleArtifactView",
"(",
"o",
"options",
",",
"sg",
"*",
"spyglass",
".",
"Spyglass",
",",
"cfg",
"config",
".",
"Getter",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"setHeadersNoCaching",
"(",
"w",
")",
"\n",
"pathSegments",
":=",
"strings",
".",
"Split",
"(",
"r",
".",
"URL",
".",
"Path",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"pathSegments",
")",
"!=",
"2",
"{",
"http",
".",
"NotFound",
"(",
"w",
",",
"r",
")",
"\n",
"return",
"\n",
"}",
"\n",
"lensName",
":=",
"pathSegments",
"[",
"0",
"]",
"\n",
"resource",
":=",
"pathSegments",
"[",
"1",
"]",
"\n\n",
"lens",
",",
"err",
":=",
"lenses",
".",
"GetLens",
"(",
"lensName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"http",
".",
"Error",
"(",
"w",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"lensName",
",",
"err",
")",
",",
"http",
".",
"StatusNotFound",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"lensConfig",
":=",
"lens",
".",
"Config",
"(",
")",
"\n",
"lensResourcesDir",
":=",
"lenses",
".",
"ResourceDirForLens",
"(",
"o",
".",
"spyglassFilesLocation",
",",
"lensConfig",
".",
"Name",
")",
"\n\n",
"reqString",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"var",
"<mask>",
"spyglass",
".",
"LensRequest",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"[",
"]",
"byte",
"(",
"reqString",
")",
",",
"&",
"request",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"http",
".",
"Error",
"(",
"w",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
",",
"http",
".",
"StatusBadRequest",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"artifacts",
",",
"err",
":=",
"sg",
".",
"FetchArtifacts",
"(",
"request",
".",
"Source",
",",
"\"",
"\"",
",",
"cfg",
"(",
")",
".",
"Deck",
".",
"Spyglass",
".",
"SizeLimit",
",",
"request",
".",
"Artifacts",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"http",
".",
"Error",
"(",
"w",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
",",
"http",
".",
"StatusInternalServerError",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"switch",
"resource",
"{",
"case",
"\"",
"\"",
":",
"t",
",",
"err",
":=",
"template",
".",
"ParseFiles",
"(",
"path",
".",
"Join",
"(",
"o",
".",
"templateFilesLocation",
",",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"http",
".",
"Error",
"(",
"w",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
",",
"http",
".",
"StatusInternalServerError",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"t",
".",
"Execute",
"(",
"w",
",",
"struct",
"{",
"Title",
"string",
"\n",
"BaseURL",
"string",
"\n",
"Head",
"template",
".",
"HTML",
"\n",
"Body",
"template",
".",
"HTML",
"\n",
"}",
"{",
"lensConfig",
".",
"Title",
",",
"\"",
"\"",
"+",
"lensName",
"+",
"\"",
"\"",
",",
"template",
".",
"HTML",
"(",
"lens",
".",
"Header",
"(",
"artifacts",
",",
"lensResourcesDir",
")",
")",
",",
"template",
".",
"HTML",
"(",
"lens",
".",
"Body",
"(",
"artifacts",
",",
"lensResourcesDir",
",",
"\"",
"\"",
")",
")",
",",
"}",
")",
"\n",
"case",
"\"",
"\"",
":",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"r",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"http",
".",
"Error",
"(",
"w",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
",",
"http",
".",
"StatusInternalServerError",
")",
"\n",
"return",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"w",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"lens",
".",
"Body",
"(",
"artifacts",
",",
"lensResourcesDir",
",",
"string",
"(",
"data",
")",
")",
")",
")",
"\n",
"case",
"\"",
"\"",
":",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"r",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"http",
".",
"Error",
"(",
"w",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
",",
"http",
".",
"StatusInternalServerError",
")",
"\n",
"return",
"\n",
"}",
"\n",
"w",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"lens",
".",
"Callback",
"(",
"artifacts",
",",
"lensResourcesDir",
",",
"string",
"(",
"data",
")",
")",
")",
")",
"\n",
"default",
":",
"http",
".",
"NotFound",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
564 | all-565 | [
"NewCommander",
"returns",
"a",
"new",
"commander",
"with",
"the",
"specified",
"top",
"-",
"level",
"flags",
"and",
"command",
"name",
".",
"The",
"Usage",
"function",
"for",
"the",
"topLevelFlags",
"will",
"be",
"set",
"as",
"well",
"."
] | [
"func",
"NewCommander",
"(",
"topLevelFlags",
"*",
"flag",
".",
"FlagSet",
",",
"name",
"string",
")",
"*",
"Commander",
"{",
"cdr",
":=",
"&",
"Commander",
"{",
"topFlags",
":",
"topLevelFlags",
",",
"name",
":",
"name",
",",
"Output",
":",
"os",
".",
"Stdout",
",",
"Error",
":",
"<mask>",
".",
"Stderr",
",",
"}",
"\n",
"topLevelFlags",
".",
"Usage",
"=",
"func",
"(",
")",
"{",
"cdr",
".",
"explain",
"(",
"cdr",
".",
"Error",
")",
"}",
"\n",
"return",
"cdr",
"\n",
"}"
] |
565 | all-566 | [
"Generate",
"a",
"password",
"given",
"requirements"
] | [
"func",
"(",
"g",
"Garbler",
")",
"password",
"(",
"req",
"PasswordStrengthRequirements",
")",
"(",
"string",
",",
"error",
")",
"{",
"//Step 1: Figure out settings",
"letters",
":=",
"0",
"\n",
"mustGarble",
":=",
"0",
"\n",
"switch",
"{",
"case",
"req",
".",
"MaximumTotalLength",
">",
"0",
"&&",
"req",
".",
"MaximumTotalLength",
">",
"6",
":",
"letters",
"=",
"req",
".",
"MaximumTotalLength",
"-",
"req",
".",
"Digits",
"-",
"req",
".",
"Punctuation",
"\n",
"case",
"req",
".",
"MaximumTotalLength",
">",
"0",
"&&",
"req",
".",
"MaximumTotalLength",
"<=",
"6",
":",
"letters",
"=",
"req",
".",
"MaximumTotalLength",
"-",
"req",
".",
"Punctuation",
"\n",
"mustGarble",
"=",
"req",
".",
"Digits",
"\n",
"case",
"req",
".",
"MinimumTotalLength",
">",
"req",
".",
"Digits",
"+",
"req",
".",
"Punctuation",
"+",
"6",
":",
"letters",
"=",
"req",
".",
"MinimumTotalLength",
"-",
"req",
".",
"Digits",
"-",
"req",
".",
"Punctuation",
"\n",
"default",
":",
"letters",
"=",
"req",
".",
"MinimumTotalLength",
"\n",
"}",
"\n",
"if",
"req",
".",
"Uppercase",
">",
"letters",
"{",
"letters",
"=",
"req",
".",
"Uppercase",
"\n",
"}",
"\n",
"password",
":=",
"g",
".",
"garbledSequence",
"(",
"letters",
",",
"mustGarble",
")",
"\n",
"password",
"=",
"g",
".",
"uppercase",
"(",
"password",
",",
"req",
".",
"Uppercase",
")",
"\n",
"password",
"=",
"g",
".",
"addNums",
"(",
"<mask>",
",",
"req",
".",
"Digits",
"-",
"mustGarble",
")",
"\n",
"password",
"=",
"g",
".",
"punctuate",
"(",
"password",
",",
"req",
".",
"Punctuation",
")",
"\n",
"return",
"password",
",",
"nil",
"\n",
"}"
] |
566 | all-567 | [
"HasAccount",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"ServiceHookSlackRequest",
")",
"HasAccount",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"Account",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
567 | all-568 | [
"Dot",
"extract",
"the",
"specific",
"key",
"from",
"the",
"map",
"provided",
";",
"to",
"extract",
"a",
"nested",
"value",
"use",
"the",
"Dot",
"Op",
"in",
"conjunction",
"with",
"the",
"Chain",
"Op"
] | [
"func",
"Dot",
"(",
"key",
"string",
")",
"OpFunc",
"{",
"key",
"=",
"strings",
".",
"TrimSpace",
"(",
"key",
")",
"\n",
"if",
"key",
"==",
"\"",
"\"",
"{",
"return",
"func",
"(",
"in",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"return",
"in",
",",
"nil",
"}",
"\n",
"}",
"\n\n",
"k",
":=",
"[",
"]",
"byte",
"(",
"<mask>",
")",
"\n\n",
"return",
"func",
"(",
"in",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"return",
"scanner",
".",
"FindKey",
"(",
"in",
",",
"0",
",",
"k",
")",
"\n",
"}",
"\n",
"}"
] |
568 | all-569 | [
"Using",
"the",
"EZ",
"API",
"posts",
"a",
"count",
"to",
"a",
"stat",
"."
] | [
"func",
"(",
"r",
"*",
"BasicReporter",
")",
"PostEZCount",
"(",
"statName",
",",
"ezkey",
"string",
",",
"count",
"int",
")",
"error",
"{",
"r",
".",
"<mask>",
"(",
"newEZStatCount",
"(",
"statName",
",",
"ezkey",
",",
"count",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
569 | all-570 | [
"AddMapping",
"maps",
"an",
"external",
"port",
"to",
"a",
"local",
"port",
"for",
"a",
"specific",
"service",
"to",
"UPnP",
"interface",
"."
] | [
"func",
"(",
"n",
"*",
"upnp",
")",
"AddMapping",
"(",
"protocol",
"string",
",",
"extPort",
",",
"intPort",
"int",
",",
"desc",
"string",
",",
"lifetime",
"time",
".",
"Duration",
")",
"error",
"{",
"ip",
",",
"err",
":=",
"n",
".",
"internalAddress",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"protocol",
"=",
"strings",
".",
"ToUpper",
"(",
"protocol",
")",
"\n",
"lifetimeS",
":=",
"uint32",
"(",
"lifetime",
"/",
"time",
".",
"Second",
")",
"\n",
"n",
".",
"DeleteMapping",
"(",
"protocol",
",",
"extPort",
",",
"intPort",
")",
"\n",
"return",
"n",
".",
"client",
".",
"AddPortMapping",
"(",
"\"",
"\"",
",",
"uint16",
"(",
"extPort",
")",
",",
"protocol",
",",
"uint16",
"(",
"intPort",
")",
",",
"ip",
".",
"String",
"(",
")",
",",
"<mask>",
",",
"desc",
",",
"lifetimeS",
")",
"\n",
"}"
] |
570 | all-571 | [
"Calls",
"putPart",
"up",
"to",
"nTry",
"times",
"to",
"recover",
"from",
"transient",
"errors",
"."
] | [
"func",
"(",
"u",
"*",
"uploader",
")",
"retryUploadPart",
"(",
"p",
"*",
"<mask>",
")",
"{",
"defer",
"u",
".",
"wg",
".",
"Done",
"(",
")",
"\n",
"defer",
"func",
"(",
")",
"{",
"p",
".",
"r",
"=",
"nil",
"}",
"(",
")",
"// free the large buffer",
"\n",
"var",
"err",
"error",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"nTry",
";",
"i",
"++",
"{",
"p",
".",
"r",
".",
"Seek",
"(",
"0",
",",
"0",
")",
"\n",
"err",
"=",
"u",
".",
"putPart",
"(",
"p",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"u",
".",
"err",
"=",
"err",
"\n",
"}"
] |
571 | all-572 | [
"TimeFromPtr",
"creates",
"a",
"new",
"Time",
"that",
"will",
"be",
"null",
"if",
"t",
"is",
"nil",
"."
] | [
"func",
"TimeFromPtr",
"(",
"t",
"*",
"<mask>",
".",
"Time",
")",
"Time",
"{",
"if",
"t",
"==",
"nil",
"{",
"return",
"NewTime",
"(",
"time",
".",
"Time",
"{",
"}",
",",
"false",
")",
"\n",
"}",
"\n",
"return",
"NewTime",
"(",
"*",
"t",
",",
"true",
")",
"\n",
"}"
] |
572 | all-573 | [
"NewTicker",
"returns",
"a",
"new",
"Ticker",
"containing",
"a",
"channel",
"that",
"will",
"send",
"the",
"time",
"at",
"times",
"specified",
"by",
"the",
"BackOff",
"argument",
".",
"Ticker",
"is",
"guaranteed",
"to",
"tick",
"at",
"least",
"once",
".",
"The",
"channel",
"is",
"closed",
"when",
"Stop",
"method",
"is",
"called",
"or",
"BackOff",
"stops",
"."
] | [
"func",
"NewTicker",
"(",
"b",
"BackOff",
")",
"*",
"Ticker",
"{",
"c",
":=",
"make",
"(",
"chan",
"time",
".",
"Time",
")",
"\n",
"t",
":=",
"&",
"Ticker",
"{",
"C",
":",
"c",
",",
"c",
":",
"c",
",",
"b",
":",
"b",
",",
"<mask>",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"}",
"\n",
"go",
"t",
".",
"run",
"(",
")",
"\n",
"runtime",
".",
"SetFinalizer",
"(",
"t",
",",
"(",
"*",
"Ticker",
")",
".",
"Stop",
")",
"\n",
"return",
"t",
"\n",
"}"
] |
573 | all-574 | [
"Delete",
"takes",
"name",
"of",
"the",
"app",
"and",
"deletes",
"it",
".",
"Returns",
"an",
"error",
"if",
"one",
"occurs",
"."
] | [
"func",
"(",
"c",
"*",
"FakeApps",
")",
"Delete",
"(",
"<mask>",
"string",
",",
"options",
"*",
"v1",
".",
"DeleteOptions",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"Fake",
".",
"Invokes",
"(",
"testing",
".",
"NewDeleteAction",
"(",
"appsResource",
",",
"c",
".",
"ns",
",",
"name",
")",
",",
"&",
"tsuru_v1",
".",
"App",
"{",
"}",
")",
"\n\n",
"return",
"err",
"\n",
"}"
] |
574 | all-575 | [
"IterateBackward",
"-",
"iterate",
"over",
"hole",
"stack",
"segment",
"-",
"by",
"-",
"segment",
"from",
"end",
"to",
"begining"
] | [
"func",
"(",
"s",
"*",
"Stack",
")",
"IterateBackward",
"(",
"handler",
"func",
"(",
"depth",
"int",
",",
"header",
"io",
".",
"Reader",
",",
"body",
"io",
".",
"Reader",
")",
"bool",
")",
"error",
"{",
"s",
".",
"guard",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"guard",
".",
"Unlock",
"(",
")",
"\n",
"if",
"s",
".",
"depth",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"file",
",",
"err",
":=",
"s",
".",
"getFile",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"file",
".",
"Seek",
"(",
"0",
",",
"os",
".",
"SEEK_END",
")",
"\n",
"var",
"(",
"currentBlock",
"fileBlock",
"// Current block description",
"\n",
"currentBlockOffset",
"uint64",
"// Current block offset from begining of file",
"\n",
")",
"\n",
"currentBlock",
"=",
"s",
".",
"currentBlock",
"\n",
"currentBlockOffset",
"=",
"uint64",
"(",
"s",
".",
"currentBlockPos",
")",
"\n",
"depth",
":=",
"s",
".",
"depth",
"\n",
"for",
"{",
"body",
":=",
"io",
".",
"NewSectionReader",
"(",
"file",
",",
"int64",
"(",
"currentBlock",
".",
"DataPoint",
")",
",",
"int64",
"(",
"currentBlock",
".",
"DataSize",
")",
")",
"\n",
"<mask>",
":=",
"io",
".",
"NewSectionReader",
"(",
"file",
",",
"int64",
"(",
"currentBlock",
".",
"HeaderPoint",
")",
",",
"int64",
"(",
"currentBlock",
".",
"HeaderSize",
")",
")",
"\n",
"// invoke block processor",
"if",
"handler",
"!=",
"nil",
"&&",
"!",
"handler",
"(",
"depth",
",",
"header",
",",
"body",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"currentBlock",
".",
"PrevBlock",
">",
"currentBlockOffset",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"currentBlock",
".",
"PrevBlock",
",",
"currentBlockOffset",
")",
"\n",
"}",
"\n\n",
"depth",
"--",
"\n",
"if",
"currentBlock",
".",
"PrevBlock",
"==",
"currentBlockOffset",
"{",
"// First block has prev block = 0",
"break",
"\n",
"}",
"\n",
"currentBlockOffset",
"=",
"currentBlock",
".",
"PrevBlock",
"\n",
"currentBlock",
",",
"err",
"=",
"readBlockAt",
"(",
"file",
",",
"int64",
"(",
"currentBlock",
".",
"PrevBlock",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"depth",
"!=",
"0",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
",",
"depth",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
575 | all-576 | [
"SetV3EndpointID",
"sets",
"the",
"v3",
"endpoint",
"id",
"of",
"container"
] | [
"func",
"(",
"c",
"*",
"Container",
")",
"SetV3EndpointID",
"(",
"v3EndpointID",
"string",
")",
"{",
"c",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"<mask>",
".",
"Unlock",
"(",
")",
"\n\n",
"c",
".",
"V3EndpointID",
"=",
"v3EndpointID",
"\n",
"}"
] |
576 | all-577 | [
"LoadIcon",
"is",
"a",
"wrapper",
"around",
"gtk_icon_theme_load_icon",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"IconTheme",
")",
"LoadIcon",
"(",
"iconName",
"string",
",",
"size",
"int",
",",
"flags",
"IconLookupFlags",
")",
"(",
"*",
"gdk",
".",
"Pixbuf",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"iconName",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"<mask>",
"err",
"*",
"C",
".",
"GError",
"=",
"nil",
"\n",
"c",
":=",
"C",
".",
"gtk_icon_theme_load_icon",
"(",
"v",
".",
"Theme",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"C",
".",
"gint",
"(",
"size",
")",
",",
"C",
".",
"GtkIconLookupFlags",
"(",
"flags",
")",
",",
"&",
"err",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"defer",
"C",
".",
"g_error_free",
"(",
"err",
")",
"\n",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"goString",
"(",
"err",
".",
"message",
")",
")",
"\n",
"}",
"\n",
"return",
"&",
"gdk",
".",
"Pixbuf",
"{",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"}",
",",
"nil",
"\n",
"}"
] |
577 | all-578 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventReportHeapSnapshotProgress",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeapprofiler16",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
578 | all-579 | [
"NewFilteredSharedInformerFactory",
"constructs",
"a",
"new",
"instance",
"of",
"sharedInformerFactory",
".",
"Listers",
"obtained",
"via",
"this",
"SharedInformerFactory",
"will",
"be",
"subject",
"to",
"the",
"same",
"filters",
"as",
"specified",
"here",
"."
] | [
"func",
"NewFilteredSharedInformerFactory",
"(",
"client",
"versioned",
".",
"Interface",
",",
"defaultResync",
"time",
".",
"Duration",
",",
"namespace",
"string",
",",
"tweakListOptions",
"internalinterfaces",
".",
"TweakListOptionsFunc",
")",
"SharedInformerFactory",
"{",
"return",
"&",
"sharedInformerFactory",
"{",
"client",
":",
"<mask>",
",",
"namespace",
":",
"namespace",
",",
"tweakListOptions",
":",
"tweakListOptions",
",",
"defaultResync",
":",
"defaultResync",
",",
"informers",
":",
"make",
"(",
"map",
"[",
"reflect",
".",
"Type",
"]",
"cache",
".",
"SharedIndexInformer",
")",
",",
"startedInformers",
":",
"make",
"(",
"map",
"[",
"reflect",
".",
"Type",
"]",
"bool",
")",
",",
"}",
"\n",
"}"
] |
579 | all-580 | [
"ScenarioLocator",
"builds",
"a",
"locator",
"from",
"the",
"given",
"href",
"."
] | [
"func",
"(",
"api",
"*",
"API",
")",
"ScenarioLocator",
"(",
"href",
"string",
")",
"*",
"ScenarioLocator",
"{",
"<mask>",
"&",
"ScenarioLocator",
"{",
"Href",
"(",
"href",
")",
",",
"api",
"}",
"\n",
"}"
] |
580 | all-581 | [
"HasY",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"HasY",
"(",
")",
"bool",
"{",
"if",
"w",
"!=",
"nil",
"&&",
"w",
".",
"Y",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
581 | all-582 | [
"NewGroup",
"reads",
"the",
".",
"generated_files",
"file",
"in",
"the",
"root",
"of",
"the",
"repository",
"and",
"any",
"referenced",
"path",
"files",
"(",
"from",
"path",
"-",
"from",
"-",
"repo",
"commands",
")",
"."
] | [
"func",
"NewGroup",
"(",
"gc",
"ghFileClient",
",",
"owner",
",",
"repo",
",",
"sha",
"string",
")",
"(",
"*",
"Group",
",",
"error",
")",
"{",
"g",
":=",
"&",
"<mask>",
"{",
"Paths",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
",",
"FileNames",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
",",
"PathPrefixes",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
",",
"FilePrefixes",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
",",
"}",
"\n\n",
"bs",
",",
"err",
":=",
"gc",
".",
"GetFile",
"(",
"owner",
",",
"repo",
",",
"genConfigFile",
",",
"sha",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"switch",
"err",
".",
"(",
"type",
")",
"{",
"case",
"*",
"github",
".",
"FileNotFound",
":",
"return",
"g",
",",
"nil",
"\n",
"default",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"repoFiles",
",",
"err",
":=",
"g",
".",
"load",
"(",
"bytes",
".",
"NewBuffer",
"(",
"bs",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"repoFiles",
"{",
"bs",
",",
"err",
"=",
"gc",
".",
"GetFile",
"(",
"owner",
",",
"repo",
",",
"f",
",",
"sha",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
"=",
"g",
".",
"loadPaths",
"(",
"bytes",
".",
"NewBuffer",
"(",
"bs",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"g",
",",
"nil",
"\n",
"}"
] |
582 | all-583 | [
"New",
"resource",
"generator"
] | [
"func",
"New",
"(",
"opts",
"*",
"Options",
")",
"(",
"*",
"genny",
".",
"Generator",
",",
"error",
")",
"{",
"g",
":=",
"genny",
".",
"New",
"(",
")",
"\n\n",
"if",
"err",
":=",
"opts",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"g",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"!",
"opts",
".",
"SkipTemplates",
"{",
"core",
":=",
"packr",
".",
"New",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"if",
"err",
":=",
"g",
".",
"Box",
"(",
"core",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"g",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"var",
"abox",
"packd",
".",
"Box",
"\n",
"if",
"opts",
".",
"SkipModel",
"{",
"abox",
"=",
"packr",
".",
"New",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"abox",
"=",
"packr",
".",
"New",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"g",
".",
"Box",
"(",
"abox",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"g",
",",
"err",
"\n",
"}",
"\n\n",
"pres",
":=",
"presenter",
"{",
"App",
":",
"opts",
".",
"App",
",",
"<mask>",
":",
"name",
".",
"New",
"(",
"opts",
".",
"Name",
")",
",",
"Model",
":",
"name",
".",
"New",
"(",
"opts",
".",
"Model",
")",
",",
"Attrs",
":",
"opts",
".",
"Attrs",
",",
"}",
"\n",
"x",
":=",
"pres",
".",
"Name",
".",
"Resource",
"(",
")",
".",
"File",
"(",
")",
".",
"String",
"(",
")",
"\n",
"folder",
":=",
"pres",
".",
"Name",
".",
"Folder",
"(",
")",
".",
"Pluralize",
"(",
")",
".",
"String",
"(",
")",
"\n",
"g",
".",
"Transformer",
"(",
"genny",
".",
"Replace",
"(",
"\"",
"\"",
",",
"x",
")",
")",
"\n",
"g",
".",
"Transformer",
"(",
"genny",
".",
"Replace",
"(",
"\"",
"\"",
",",
"x",
")",
")",
"\n",
"g",
".",
"Transformer",
"(",
"genny",
".",
"Replace",
"(",
"\"",
"\"",
",",
"folder",
")",
")",
"\n\n",
"data",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"pres",
",",
"\"",
"\"",
":",
"actions",
"(",
"opts",
")",
",",
"\"",
"\"",
":",
"folder",
",",
"}",
"\n",
"helpers",
":=",
"template",
".",
"FuncMap",
"{",
"\"",
"\"",
":",
"func",
"(",
"s",
"string",
")",
"string",
"{",
"return",
"flect",
".",
"Camelize",
"(",
"s",
")",
"\n",
"}",
",",
"}",
"\n",
"g",
".",
"Transformer",
"(",
"gogen",
".",
"TemplateTransformer",
"(",
"data",
",",
"helpers",
")",
")",
"\n\n",
"g",
".",
"RunFn",
"(",
"installPop",
"(",
"opts",
")",
")",
"\n\n",
"g",
".",
"RunFn",
"(",
"addResource",
"(",
"pres",
")",
")",
"\n",
"return",
"g",
",",
"nil",
"\n",
"}"
] |
583 | all-584 | [
"NewStringSliceFlag",
"creates",
"a",
"new",
"string",
"slice",
"flag",
".",
"The",
"default",
"value",
"is",
"always",
"nil",
"."
] | [
"func",
"NewStringSliceFlag",
"(",
"name",
"string",
",",
"usage",
"string",
")",
"*",
"[",
"]",
"string",
"{",
"var",
"ss",
"stringSliceFlag",
"\n",
"flag",
".",
"Var",
"(",
"&",
"<mask>",
",",
"name",
",",
"usage",
")",
"\n",
"return",
"(",
"*",
"[",
"]",
"string",
")",
"(",
"&",
"ss",
")",
"\n",
"}"
] |
584 | all-585 | [
"Push",
"the",
"changes",
"from",
"this",
"object",
"to",
"all",
"connected",
"clients",
".",
"Push",
"is",
"thread",
"-",
"safe",
"and",
"is",
"throttled",
"so",
"it",
"can",
"be",
"called",
"with",
"abandon",
".",
"Returns",
"false",
"if",
"a",
"Push",
"is",
"already",
"in",
"progress",
"."
] | [
"func",
"(",
"s",
"*",
"State",
")",
"Push",
"(",
")",
"bool",
"{",
"//attempt to mark state as 'pushing'",
"if",
"atomic",
".",
"CompareAndSwapUint32",
"(",
"&",
"s",
".",
"push",
".",
"ing",
",",
"0",
",",
"1",
")",
"{",
"go",
"s",
".",
"gopush",
"(",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"//if already pushing, mark queued",
"atomic",
".",
"StoreUint32",
"(",
"&",
"s",
".",
"<mask>",
".",
"queued",
",",
"1",
")",
"\n",
"return",
"false",
"\n",
"}"
] |
585 | all-586 | [
"GetJobSummariesForProject",
"returns",
"summaries",
"of",
"the",
"jobs",
"belonging",
"to",
"the",
"named",
"project",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetJobSummariesForProject",
"(",
"projectName",
"string",
")",
"(",
"[",
"]",
"JobSummary",
",",
"error",
")",
"{",
"jobList",
":=",
"&",
"jobSummaryList",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"<mask>",
"(",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"projectName",
",",
"\"",
"\"",
"}",
",",
"nil",
",",
"jobList",
")",
"\n",
"return",
"jobList",
".",
"Jobs",
",",
"err",
"\n",
"}"
] |
586 | all-587 | [
"GetPathPaymentResult",
"retrieves",
"the",
"PathPaymentResult",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"OperationResultTr",
")",
"GetPathPaymentResult",
"(",
")",
"(",
"result",
"PathPaymentResult",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"<mask>",
"=",
"*",
"u",
".",
"PathPaymentResult",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
587 | all-588 | [
"MendPeer",
"recovers",
"the",
"message",
"dropping",
"behavior",
"of",
"the",
"given",
"peer",
"."
] | [
"func",
"(",
"t",
"*",
"Transport",
")",
"MendPeer",
"(",
"id",
"types",
".",
"ID",
")",
"{",
"t",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"p",
",",
"pok",
":=",
"t",
".",
"peers",
"[",
"<mask>",
"]",
"\n",
"g",
",",
"gok",
":=",
"t",
".",
"remotes",
"[",
"id",
"]",
"\n",
"t",
".",
"mu",
".",
"RUnlock",
"(",
")",
"\n\n",
"if",
"pok",
"{",
"p",
".",
"(",
"Pausable",
")",
".",
"Resume",
"(",
")",
"\n",
"}",
"\n",
"if",
"gok",
"{",
"g",
".",
"Resume",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
588 | all-589 | [
"gpgUntrustedSignatureContents",
"returns",
"UNTRUSTED",
"contents",
"of",
"the",
"signature",
"WITHOUT",
"ANY",
"VERIFICATION",
"along",
"with",
"a",
"short",
"identifier",
"of",
"the",
"key",
"used",
"for",
"signing",
".",
"WARNING",
":",
"The",
"short",
"key",
"identifier",
"(",
"which",
"correponds",
"to",
"Key",
"ID",
"for",
"OpenPGP",
"keys",
")",
"is",
"NOT",
"the",
"same",
"as",
"a",
"key",
"identity",
"used",
"in",
"other",
"calls",
"ot",
"this",
"interface",
"and",
"the",
"values",
"may",
"have",
"no",
"recognizable",
"relationship",
"if",
"the",
"public",
"key",
"is",
"not",
"available",
"."
] | [
"func",
"gpgUntrustedSignatureContents",
"(",
"untrustedSignature",
"[",
"]",
"byte",
")",
"(",
"untrustedContents",
"[",
"]",
"byte",
",",
"shortKeyIdentifier",
"string",
",",
"err",
"error",
")",
"{",
"// This uses the Golang-native OpenPGP implementation instead of gpgme because we are not doing any cryptography.",
"md",
",",
"err",
":=",
"openpgp",
".",
"ReadMessage",
"(",
"bytes",
".",
"NewReader",
"(",
"untrustedSignature",
")",
",",
"openpgp",
".",
"EntityList",
"{",
"}",
",",
"nil",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"md",
".",
"IsSigned",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"content",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"<mask>",
".",
"UnverifiedBody",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// Coverage: An error during reading the body can happen only if",
"// 1) the message is encrypted, which is not our case (and we don’t give ReadMessage the key",
"// to decrypt the contents anyway), or",
"// 2) the message is signed AND we give ReadMessage a correspnding public key, which we don’t.",
"return",
"nil",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"// Uppercase the key ID for minimal consistency with the gpgme-returned fingerprints",
"// (but note that key ID is a suffix of the fingerprint only for V4 keys, not V3)!",
"return",
"content",
",",
"strings",
".",
"ToUpper",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"md",
".",
"SignedByKeyId",
")",
")",
",",
"nil",
"\n",
"}"
] |
589 | all-590 | [
"SetKnownStatus",
"safely",
"sets",
"the",
"currently",
"known",
"status",
"of",
"the",
"resource"
] | [
"func",
"(",
"secret",
"*",
"ASMSecretResource",
")",
"SetKnownStatus",
"(",
"status",
"resourcestatus",
".",
"ResourceStatus",
")",
"{",
"<mask>",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"secret",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"secret",
".",
"knownStatusUnsafe",
"=",
"status",
"\n",
"secret",
".",
"updateAppliedStatusUnsafe",
"(",
"status",
")",
"\n",
"}"
] |
590 | all-591 | [
"CopyTo",
"copies",
"all",
"the",
"headers",
"to",
"dst",
"."
] | [
"func",
"(",
"h",
"*",
"RequestHeader",
")",
"CopyTo",
"(",
"dst",
"*",
"RequestHeader",
")",
"{",
"dst",
".",
"Reset",
"(",
")",
"\n\n",
"dst",
".",
"disableNormalizing",
"=",
"h",
".",
"disableNormalizing",
"\n",
"dst",
".",
"noHTTP11",
"=",
"h",
".",
"noHTTP11",
"\n",
"dst",
".",
"connectionClose",
"=",
"h",
".",
"connectionClose",
"\n\n",
"dst",
".",
"contentLength",
"=",
"h",
".",
"contentLength",
"\n",
"dst",
".",
"contentLengthBytes",
"=",
"append",
"(",
"dst",
".",
"contentLengthBytes",
"[",
":",
"0",
"]",
",",
"h",
".",
"contentLengthBytes",
"...",
")",
"\n",
"dst",
".",
"method",
"=",
"append",
"(",
"dst",
".",
"method",
"[",
":",
"0",
"]",
",",
"h",
".",
"method",
"...",
")",
"\n",
"dst",
".",
"requestURI",
"=",
"append",
"(",
"dst",
".",
"requestURI",
"[",
":",
"0",
"]",
",",
"h",
".",
"requestURI",
"...",
")",
"\n",
"dst",
".",
"<mask>",
"=",
"append",
"(",
"dst",
".",
"host",
"[",
":",
"0",
"]",
",",
"h",
".",
"host",
"...",
")",
"\n",
"dst",
".",
"contentType",
"=",
"append",
"(",
"dst",
".",
"contentType",
"[",
":",
"0",
"]",
",",
"h",
".",
"contentType",
"...",
")",
"\n",
"dst",
".",
"userAgent",
"=",
"append",
"(",
"dst",
".",
"userAgent",
"[",
":",
"0",
"]",
",",
"h",
".",
"userAgent",
"...",
")",
"\n",
"dst",
".",
"h",
"=",
"copyArgs",
"(",
"dst",
".",
"h",
",",
"h",
".",
"h",
")",
"\n",
"dst",
".",
"cookies",
"=",
"copyArgs",
"(",
"dst",
".",
"cookies",
",",
"h",
".",
"cookies",
")",
"\n",
"dst",
".",
"cookiesCollected",
"=",
"h",
".",
"cookiesCollected",
"\n",
"dst",
".",
"rawHeaders",
"=",
"append",
"(",
"dst",
".",
"rawHeaders",
"[",
":",
"0",
"]",
",",
"h",
".",
"rawHeaders",
"...",
")",
"\n",
"dst",
".",
"rawHeadersParsed",
"=",
"h",
".",
"rawHeadersParsed",
"\n",
"dst",
".",
"rawHeadersCopy",
"=",
"append",
"(",
"dst",
".",
"rawHeadersCopy",
"[",
":",
"0",
"]",
",",
"h",
".",
"rawHeadersCopy",
"...",
")",
"\n",
"}"
] |
591 | all-592 | [
"DoIntro",
"executes",
"the",
"protocol",
"introduction",
"."
] | [
"func",
"(",
"params",
"protocolIntroParams",
")",
"doIntro",
"(",
")",
"(",
"res",
"protocolIntroResults",
",",
"err",
"error",
")",
"{",
"if",
"err",
"=",
"params",
".",
"Conn",
".",
"SetDeadline",
"(",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"headerTimeout",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"if",
"res",
".",
"Version",
",",
"err",
"=",
"params",
".",
"exchangeProtocolHeader",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"var",
"pubKey",
",",
"privKey",
"*",
"[",
"32",
"]",
"byte",
"\n",
"if",
"params",
".",
"Password",
"!=",
"nil",
"{",
"if",
"pubKey",
",",
"privKey",
",",
"err",
"=",
"generateKeyPair",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"params",
".",
"Conn",
".",
"SetWriteDeadline",
"(",
"time",
".",
"Time",
"{",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"if",
"err",
"=",
"params",
".",
"Conn",
".",
"SetReadDeadline",
"(",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"tcpHeartbeat",
"*",
"2",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"switch",
"res",
".",
"Version",
"{",
"case",
"1",
":",
"err",
"=",
"res",
".",
"doIntroV1",
"(",
"params",
",",
"pubKey",
",",
"privKey",
")",
"\n",
"case",
"2",
":",
"err",
"=",
"res",
".",
"doIntroV2",
"(",
"params",
",",
"pubKey",
",",
"privKey",
")",
"\n",
"<mask>",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
592 | all-593 | [
"Delete",
"is",
"used",
"to",
"delete",
"the",
"instances",
"on",
"the",
"cloud",
"provider"
] | [
"func",
"(",
"r",
"*",
"InstanceGroup",
")",
"Delete",
"(",
"actual",
"cloud",
".",
"Resource",
",",
"immutable",
"*",
"cluster",
".",
"Cluster",
")",
"(",
"*",
"cluster",
".",
"Cluster",
",",
"cloud",
".",
"Resource",
",",
"error",
")",
"{",
"logger",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"deleteResource",
":=",
"actual",
".",
"(",
"*",
"InstanceGroup",
")",
"\n",
"if",
"deleteResource",
".",
"Name",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"deleteResource",
".",
"Name",
")",
"\n",
"}",
"\n\n",
"logger",
".",
"Success",
"(",
"\"",
"\"",
",",
"r",
".",
"ServerPool",
".",
"Name",
")",
"\n",
"_",
",",
"err",
":=",
"Sdk",
".",
"Service",
".",
"InstanceGroupManagers",
".",
"Get",
"(",
"immutable",
".",
"ProviderConfig",
"(",
")",
".",
"CloudId",
",",
"immutable",
".",
"ProviderConfig",
"(",
")",
".",
"Location",
",",
"strings",
".",
"ToLower",
"(",
"r",
".",
"ServerPool",
".",
"Name",
")",
")",
".",
"Do",
"(",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"_",
",",
"err",
":=",
"Sdk",
".",
"Service",
".",
"InstanceGroupManagers",
".",
"Delete",
"(",
"immutable",
".",
"ProviderConfig",
"(",
")",
".",
"CloudId",
",",
"immutable",
".",
"ProviderConfig",
"(",
")",
".",
"Location",
",",
"strings",
".",
"ToLower",
"(",
"r",
".",
"ServerPool",
".",
"<mask>",
")",
")",
".",
"Do",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"_",
",",
"err",
"=",
"Sdk",
".",
"Service",
".",
"InstanceTemplates",
".",
"Get",
"(",
"immutable",
".",
"ProviderConfig",
"(",
")",
".",
"CloudId",
",",
"strings",
".",
"ToLower",
"(",
"r",
".",
"ServerPool",
".",
"Name",
")",
")",
".",
"Do",
"(",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"err",
":=",
"r",
".",
"retryDeleteInstanceTemplate",
"(",
"immutable",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Kubernetes API",
"providerConfig",
":=",
"immutable",
".",
"ProviderConfig",
"(",
")",
"\n",
"providerConfig",
".",
"KubernetesAPI",
".",
"Endpoint",
"=",
"\"",
"\"",
"\n",
"immutable",
".",
"SetProviderConfig",
"(",
"providerConfig",
")",
"\n",
"renderedCluster",
",",
"err",
":=",
"r",
".",
"immutableRender",
"(",
"actual",
",",
"immutable",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"renderedCluster",
",",
"actual",
",",
"nil",
"\n",
"}"
] |
593 | all-594 | [
"HasServiceName",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"servicePD",
")",
"HasServiceName",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"ServiceName",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
594 | all-595 | [
"GetDestination",
"retrieves",
"the",
"Destination",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"OperationBody",
")",
"GetDestination",
"(",
")",
"(",
"<mask>",
"AccountId",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"Destination",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
595 | all-596 | [
"resourceVSphereComputeClusterVMGroupFetchObjects",
"fetches",
"the",
"objects",
"for",
"a",
"cluster",
"VM",
"group",
".",
"This",
"is",
"currently",
"just",
"the",
"cluster",
"object",
"as",
"the",
"name",
"of",
"the",
"group",
"is",
"a",
"static",
"value",
"and",
"a",
"pass",
"-",
"through",
"-",
"this",
"is",
"to",
"keep",
"its",
"workflow",
"consistent",
"with",
"other",
"cluster",
"-",
"dependent",
"resources",
"that",
"derive",
"from",
"ArrayUpdateSpec",
"that",
"have",
"managed",
"object",
"as",
"keys",
"such",
"as",
"VM",
"and",
"host",
"overrides",
"."
] | [
"func",
"resourceVSphereComputeClusterVMGroupFetchObjects",
"(",
"meta",
"interface",
"{",
"}",
",",
"clusterID",
"string",
",",
"name",
"string",
",",
")",
"(",
"*",
"<mask>",
".",
"ClusterComputeResource",
",",
"string",
",",
"error",
")",
"{",
"client",
",",
"err",
":=",
"resourceVSphereComputeClusterVMGroupClient",
"(",
"meta",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"cluster",
",",
"err",
":=",
"clustercomputeresource",
".",
"FromID",
"(",
"client",
",",
"clusterID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"cluster",
",",
"name",
",",
"nil",
"\n",
"}"
] |
596 | all-597 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniform2fv",
"(",
"program",
"uint32",
",",
"location",
"int32",
",",
"count",
"int32",
",",
"value",
"*",
"float32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpProgramUniform2fv",
",",
"4",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
597 | all-598 | [
"Retrieve",
"a",
"secret",
"from",
"storage",
".",
"The",
"result",
"contains",
"any",
"passwords",
"or",
"other",
"restricted",
"information",
"verbatim",
"as",
"well",
"as",
"a",
"temporary",
"credential",
"based",
"on",
"the",
"scopes",
"specified",
"when",
"the",
"secret",
"was",
"created",
".",
"It",
"is",
"important",
"that",
"this",
"secret",
"is",
"deleted",
"by",
"the",
"consumer",
"(",
"removeSecret",
")",
"or",
"else",
"the",
"secrets",
"will",
"be",
"visible",
"to",
"any",
"process",
"which",
"can",
"access",
"the",
"user",
"data",
"associated",
"with",
"the",
"instance",
".",
"See",
"https",
":",
"//",
"docs",
".",
"taskcluster",
".",
"net",
"/",
"reference",
"/",
"core",
"/",
"aws",
"-",
"provisioner",
"/",
"api",
"-",
"docs#getSecret"
] | [
"func",
"(",
"awsProvisioner",
"*",
"AwsProvisioner",
")",
"GetSecret",
"(",
"token",
"string",
")",
"(",
"*",
"SecretResponse",
",",
"error",
")",
"{",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"awsProvisioner",
")",
"\n",
"responseObject",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"token",
")",
",",
"<mask>",
"(",
"SecretResponse",
")",
",",
"nil",
")",
"\n",
"return",
"responseObject",
".",
"(",
"*",
"SecretResponse",
")",
",",
"err",
"\n",
"}"
] |
598 | all-599 | [
"OptFieldTypeSet",
"adds",
"a",
"set",
"field",
".",
"Specify",
"CacheTypeDefault",
"for",
"the",
"default",
"cache",
"type",
".",
"Specify",
"CacheSizeDefault",
"for",
"the",
"default",
"cache",
"size",
"."
] | [
"func",
"OptFieldTypeSet",
"(",
"cacheType",
"CacheType",
",",
"cacheSize",
"int",
")",
"FieldOption",
"{",
"return",
"func",
"(",
"<mask>",
"*",
"FieldOptions",
")",
"{",
"options",
".",
"fieldType",
"=",
"FieldTypeSet",
"\n",
"options",
".",
"cacheType",
"=",
"cacheType",
"\n",
"options",
".",
"cacheSize",
"=",
"cacheSize",
"\n",
"}",
"\n",
"}"
] |
599 | all-600 | [
"LoadManifestDescriptor",
"loads",
"the",
"manifest"
] | [
"func",
"LoadManifestDescriptor",
"(",
"imgRef",
"types",
".",
"ImageReference",
")",
"(",
"imgspecv1",
".",
"Descriptor",
",",
"error",
")",
"{",
"ociArchRef",
",",
"ok",
":=",
"imgRef",
".",
"(",
"ociArchiveReference",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"imgspecv1",
".",
"Descriptor",
"{",
"}",
",",
"<mask>",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"tempDirRef",
",",
"err",
":=",
"createUntarTempDir",
"(",
"ociArchRef",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"imgspecv1",
".",
"Descriptor",
"{",
"}",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"defer",
"tempDirRef",
".",
"deleteTempDir",
"(",
")",
"\n\n",
"descriptor",
",",
"err",
":=",
"ocilayout",
".",
"LoadManifestDescriptor",
"(",
"tempDirRef",
".",
"ociRefExtracted",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"imgspecv1",
".",
"Descriptor",
"{",
"}",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"descriptor",
",",
"nil",
"\n",
"}"
] |