id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
15,300 | all-15301 | [
"Add",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_text_tag_table_add",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TextTagTable",
")",
"Add",
"(",
"<mask>",
"*",
"TextTag",
")",
"{",
"C",
".",
"gtk_text_tag_table_add",
"(",
"v",
".",
"native",
"(",
")",
",",
"tag",
".",
"native",
"(",
")",
")",
"\n",
"//return gobool(c) // TODO version-separate",
"}"
] |
15,301 | all-15302 | [
"E",
"is",
"a",
"short",
"-",
"hand",
"function",
"to",
"create",
"an",
"enforcer",
"."
] | [
"func",
"E",
"(",
"name",
"string",
",",
"m",
"<mask>",
".",
"Matcher",
",",
"h",
"fire",
".",
"Handler",
")",
"*",
"Enforcer",
"{",
"return",
"fire",
".",
"C",
"(",
"name",
",",
"m",
",",
"h",
")",
"\n",
"}"
] |
15,302 | all-15303 | [
"List",
"returns",
"the",
"latest",
"snapshot",
"taken"
] | [
"func",
"(",
"m",
"*",
"InmemSnapshotStore",
")",
"<mask>",
"(",
")",
"(",
"[",
"]",
"*",
"SnapshotMeta",
",",
"error",
")",
"{",
"m",
".",
"RLock",
"(",
")",
"\n",
"defer",
"m",
".",
"RUnlock",
"(",
")",
"\n\n",
"if",
"!",
"m",
".",
"hasSnapshot",
"{",
"return",
"[",
"]",
"*",
"SnapshotMeta",
"{",
"}",
",",
"nil",
"\n",
"}",
"\n",
"return",
"[",
"]",
"*",
"SnapshotMeta",
"{",
"&",
"m",
".",
"latest",
".",
"meta",
"}",
",",
"nil",
"\n",
"}"
] |
15,303 | all-15304 | [
"Merge",
"combines",
"all",
"values",
"in",
"this",
"configuration",
"with",
"the",
"values",
"in",
"the",
"other",
"configuration",
"with",
"values",
"in",
"the",
"other",
"configuration",
"taking",
"precedence",
".",
"Maps",
"and",
"slices",
"are",
"merged",
"most",
"other",
"values",
"are",
"overwritten",
".",
"Complex",
"structs",
"define",
"their",
"own",
"merge",
"functionality",
"."
] | [
"func",
"(",
"c",
"*",
"ConsulConfig",
")",
"Merge",
"(",
"o",
"*",
"ConsulConfig",
")",
"*",
"ConsulConfig",
"{",
"if",
"c",
"==",
"nil",
"{",
"if",
"o",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"o",
".",
"Copy",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"o",
"==",
"nil",
"{",
"return",
"c",
".",
"Copy",
"(",
")",
"\n",
"}",
"\n\n",
"r",
":=",
"c",
".",
"Copy",
"(",
")",
"\n\n",
"if",
"o",
".",
"Address",
"!=",
"nil",
"{",
"r",
".",
"Address",
"=",
"o",
".",
"Address",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"Auth",
"!=",
"nil",
"{",
"r",
".",
"Auth",
"=",
"r",
".",
"Auth",
".",
"Merge",
"(",
"o",
".",
"Auth",
")",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"Retry",
"!=",
"nil",
"{",
"r",
".",
"Retry",
"=",
"r",
".",
"Retry",
".",
"Merge",
"(",
"o",
".",
"Retry",
")",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"SSL",
"!=",
"nil",
"{",
"r",
".",
"SSL",
"=",
"r",
".",
"SSL",
".",
"Merge",
"(",
"o",
".",
"SSL",
")",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"Token",
"!=",
"nil",
"{",
"r",
".",
"<mask>",
"=",
"o",
".",
"Token",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"Transport",
"!=",
"nil",
"{",
"r",
".",
"Transport",
"=",
"r",
".",
"Transport",
".",
"Merge",
"(",
"o",
".",
"Transport",
")",
"\n",
"}",
"\n\n",
"return",
"r",
"\n",
"}"
] |
15,304 | all-15305 | [
"Set",
"verifies",
"the",
"argument",
"to",
"be",
"a",
"valid",
"member",
"of",
"the",
"allowed",
"values",
"before",
"setting",
"the",
"underlying",
"flag",
"value",
"."
] | [
"func",
"(",
"ss",
"*",
"SelectiveStringValue",
")",
"Set",
"(",
"s",
"string",
")",
"error",
"{",
"if",
"_",
",",
"ok",
":=",
"ss",
".",
"valids",
"[",
"s",
"]",
";",
"ok",
"{",
"<mask>",
".",
"v",
"=",
"s",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
15,305 | all-15306 | [
"WithDialPeerTimeout",
"returns",
"a",
"new",
"context",
"with",
"the",
"DialPeer",
"timeout",
"applied",
".",
"This",
"timeout",
"overrides",
"the",
"default",
"DialPeerTimeout",
"and",
"applies",
"per",
"-",
"dial",
"independently",
"."
] | [
"func",
"WithDialPeerTimeout",
"(",
"ctx",
"context",
".",
"Context",
",",
"timeout",
"<mask>",
".",
"Duration",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"dialPeerTimeoutCtxKey",
"{",
"}",
",",
"timeout",
")",
"\n",
"}"
] |
15,306 | all-15307 | [
"NewRouter",
"returns",
"a",
"new",
"router",
".",
"It",
"must",
"be",
"started",
"."
] | [
"func",
"NewRouter",
"(",
"config",
"Config",
",",
"name",
"PeerName",
",",
"nickName",
"string",
",",
"overlay",
"Overlay",
",",
"logger",
"Logger",
")",
"(",
"*",
"Router",
",",
"error",
")",
"{",
"router",
":=",
"&",
"Router",
"{",
"Config",
":",
"config",
",",
"gossipChannels",
":",
"make",
"(",
"gossipChannels",
")",
"}",
"\n\n",
"if",
"overlay",
"==",
"nil",
"{",
"overlay",
"=",
"NullOverlay",
"{",
"}",
"\n",
"}",
"\n\n",
"router",
".",
"Overlay",
"=",
"overlay",
"\n",
"router",
".",
"Ourself",
"=",
"newLocalPeer",
"(",
"name",
",",
"nickName",
",",
"router",
")",
"\n",
"router",
".",
"Peers",
"=",
"newPeers",
"(",
"router",
".",
"Ourself",
")",
"\n",
"router",
".",
"Peers",
".",
"OnGC",
"(",
"func",
"(",
"peer",
"*",
"Peer",
")",
"{",
"logger",
".",
"Printf",
"(",
"\"",
"\"",
",",
"peer",
")",
"\n",
"}",
")",
"\n",
"router",
".",
"Routes",
"=",
"newRoutes",
"(",
"router",
".",
"Ourself",
",",
"router",
".",
"Peers",
")",
"\n",
"router",
".",
"ConnectionMaker",
"=",
"newConnectionMaker",
"(",
"router",
".",
"Ourself",
",",
"router",
".",
"Peers",
",",
"<mask>",
".",
"JoinHostPort",
"(",
"router",
".",
"Host",
",",
"\"",
"\"",
")",
",",
"router",
".",
"Port",
",",
"router",
".",
"PeerDiscovery",
",",
"logger",
")",
"\n",
"router",
".",
"logger",
"=",
"logger",
"\n",
"gossip",
",",
"err",
":=",
"router",
".",
"NewGossip",
"(",
"\"",
"\"",
",",
"router",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"router",
".",
"topologyGossip",
"=",
"gossip",
"\n",
"router",
".",
"acceptLimiter",
"=",
"newTokenBucket",
"(",
"acceptMaxTokens",
",",
"acceptTokenDelay",
")",
"\n",
"return",
"router",
",",
"nil",
"\n",
"}"
] |
15,307 | all-15308 | [
"NewCrossInput",
"returns",
"an",
"input",
"which",
"is",
"the",
"cross",
"product",
"of",
"other",
"inputs",
".",
"That",
"means",
"that",
"all",
"combination",
"of",
"datums",
"will",
"be",
"seen",
"by",
"the",
"job",
"/",
"pipeline",
"."
] | [
"func",
"NewCrossInput",
"(",
"input",
"...",
"*",
"pps",
".",
"<mask>",
")",
"*",
"pps",
".",
"Input",
"{",
"return",
"&",
"pps",
".",
"Input",
"{",
"Cross",
":",
"input",
",",
"}",
"\n",
"}"
] |
15,308 | all-15309 | [
"Reverse",
"will",
"reverse",
"the",
"order",
"of",
"the",
"slice",
"assigned",
"to",
"the",
"indicator"
] | [
"func",
"(",
"s",
"*",
"Spinner",
")",
"Reverse",
"(",
")",
"{",
"s",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"<mask>",
".",
"Unlock",
"(",
")",
"\n",
"for",
"i",
",",
"j",
":=",
"0",
",",
"len",
"(",
"s",
".",
"chars",
")",
"-",
"1",
";",
"i",
"<",
"j",
";",
"i",
",",
"j",
"=",
"i",
"+",
"1",
",",
"j",
"-",
"1",
"{",
"s",
".",
"chars",
"[",
"i",
"]",
",",
"s",
".",
"chars",
"[",
"j",
"]",
"=",
"s",
".",
"chars",
"[",
"j",
"]",
",",
"s",
".",
"chars",
"[",
"i",
"]",
"\n",
"}",
"\n",
"}"
] |
15,309 | all-15310 | [
"ReadInt64",
"returns",
"an",
"int64",
"read",
"from",
"address",
"a",
"of",
"the",
"inferior",
"."
] | [
"func",
"(",
"p",
"*",
"Process",
")",
"ReadInt64",
"(",
"a",
"<mask>",
")",
"int64",
"{",
"return",
"int64",
"(",
"p",
".",
"ReadUint64",
"(",
"a",
")",
")",
"\n",
"}"
] |
15,310 | all-15311 | [
"Find",
"prepares",
"a",
"query",
"using",
"the",
"provided",
"document",
".",
"The",
"document",
"may",
"be",
"a",
"map",
"or",
"a",
"struct",
"value",
"capable",
"of",
"being",
"marshalled",
"with",
"bson",
".",
"The",
"map",
"may",
"be",
"a",
"generic",
"one",
"using",
"interface",
"{}",
"for",
"its",
"key",
"and",
"/",
"or",
"values",
"such",
"as",
"bson",
".",
"M",
"or",
"it",
"may",
"be",
"a",
"properly",
"typed",
"map",
".",
"Providing",
"nil",
"as",
"the",
"document",
"is",
"equivalent",
"to",
"providing",
"an",
"empty",
"document",
"such",
"as",
"bson",
".",
"M",
"{}",
".",
"Further",
"details",
"of",
"the",
"query",
"may",
"be",
"tweaked",
"using",
"the",
"resulting",
"Query",
"value",
"and",
"then",
"executed",
"to",
"retrieve",
"results",
"using",
"methods",
"such",
"as",
"One",
"For",
"Iter",
"or",
"Tail",
".",
"In",
"case",
"the",
"resulting",
"document",
"includes",
"a",
"field",
"named",
"$err",
"or",
"errmsg",
"which",
"are",
"standard",
"ways",
"for",
"MongoDB",
"to",
"return",
"query",
"errors",
"the",
"returned",
"err",
"will",
"be",
"set",
"to",
"a",
"*",
"QueryError",
"value",
"including",
"the",
"Err",
"message",
"and",
"the",
"Code",
".",
"In",
"those",
"cases",
"the",
"result",
"argument",
"is",
"still",
"unmarshalled",
"into",
"with",
"the",
"received",
"document",
"so",
"that",
"any",
"other",
"custom",
"values",
"may",
"be",
"obtained",
"if",
"desired",
".",
"Relevant",
"documentation",
":",
"http",
":",
"//",
"www",
".",
"mongodb",
".",
"org",
"/",
"display",
"/",
"DOCS",
"/",
"Querying",
"http",
":",
"//",
"www",
".",
"mongodb",
".",
"org",
"/",
"display",
"/",
"DOCS",
"/",
"Advanced",
"+",
"Queries"
] | [
"func",
"(",
"c",
"*",
"Collection",
")",
"Find",
"(",
"query",
"interface",
"{",
"}",
")",
"*",
"Query",
"{",
"session",
":=",
"c",
".",
"Database",
".",
"Session",
"\n",
"session",
".",
"m",
".",
"RLock",
"(",
")",
"\n",
"q",
":=",
"&",
"Query",
"{",
"session",
":",
"session",
",",
"query",
":",
"session",
".",
"queryConfig",
"}",
"\n",
"session",
".",
"m",
".",
"RUnlock",
"(",
")",
"\n",
"q",
".",
"op",
".",
"<mask>",
"=",
"query",
"\n",
"q",
".",
"op",
".",
"collection",
"=",
"c",
".",
"FullName",
"\n",
"return",
"q",
"\n",
"}"
] |
15,311 | all-15312 | [
"WithLogEntry",
"sets",
"the",
"in",
"-",
"context",
"LogEntry",
"for",
"a",
"request",
"."
] | [
"func",
"WithLogEntry",
"(",
"r",
"*",
"http",
".",
"<mask>",
",",
"entry",
"LogEntry",
")",
"*",
"http",
".",
"Request",
"{",
"r",
"=",
"r",
".",
"WithContext",
"(",
"context",
".",
"WithValue",
"(",
"r",
".",
"Context",
"(",
")",
",",
"LogEntryCtxKey",
",",
"entry",
")",
")",
"\n",
"return",
"r",
"\n",
"}"
] |
15,312 | all-15313 | [
"Disconnect",
"destroys",
"the",
"state",
"for",
"a",
"particular",
"host",
"instance",
".",
"Call",
"this",
"function",
"to",
"disconnect",
"the",
"host",
".",
"After",
"you",
"call",
"this",
"function",
"the",
"Host",
"object",
"is",
"no",
"longer",
"valid",
"and",
"you",
"should",
"not",
"longer",
"use",
"it",
".",
"Similarly",
"you",
"should",
"not",
"use",
"any",
"other",
"object",
"instances",
"obtained",
"from",
"the",
"Host",
"object",
"while",
"it",
"was",
"connected",
".",
"Since",
"VMware",
"Server",
"1",
".",
"0"
] | [
"func",
"(",
"h",
"*",
"Host",
")",
"Disconnect",
"(",
")",
"{",
"// TODO(c4milo): Return an error to the user given that this error",
"// may be thrown due to insufficient hardware resources",
"if",
"h",
".",
"<mask>",
"==",
"C",
".",
"VIX_E_CANCELLED",
"{",
"return",
"\n",
"}",
"\n\n",
"if",
"&",
"h",
".",
"handle",
"!=",
"nil",
"&&",
"h",
".",
"handle",
"!=",
"C",
".",
"VIX_INVALID_HANDLE",
"{",
"C",
".",
"VixHost_Disconnect",
"(",
"h",
".",
"handle",
")",
"\n",
"h",
".",
"handle",
"=",
"C",
".",
"VIX_INVALID_HANDLE",
"\n",
"}",
"\n",
"}"
] |
15,313 | all-15314 | [
"fmtInt",
"formats",
"v",
"into",
"the",
"tail",
"of",
"buf",
".",
"It",
"returns",
"the",
"index",
"where",
"the",
"output",
"begins",
"."
] | [
"func",
"fmtInt",
"(",
"buf",
"[",
"]",
"<mask>",
",",
"v",
"uint64",
")",
"int",
"{",
"w",
":=",
"len",
"(",
"buf",
")",
"\n",
"if",
"v",
"==",
"0",
"{",
"w",
"--",
"\n",
"buf",
"[",
"w",
"]",
"=",
"'0'",
"\n",
"}",
"else",
"{",
"for",
"v",
">",
"0",
"{",
"w",
"--",
"\n",
"buf",
"[",
"w",
"]",
"=",
"byte",
"(",
"v",
"%",
"10",
")",
"+",
"'0'",
"\n",
"v",
"/=",
"10",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"w",
"\n",
"}"
] |
15,314 | all-15315 | [
"Render",
"implements",
"the",
"Render",
"interface",
".",
"This",
"is",
"called",
"from",
"queue",
"context",
"so",
"be",
"careful",
"to",
"not",
"use",
"blocking",
"calls",
"."
] | [
"func",
"(",
"l",
"*",
"Label",
")",
"Render",
"(",
")",
"{",
"if",
"l",
".",
"visibility",
"==",
"VisibilityHide",
"{",
"l",
".",
"clear",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"!",
"l",
".",
"status",
"{",
"l",
".",
"w",
".",
"printf",
"(",
"l",
".",
"trueX",
",",
"l",
".",
"trueY",
",",
"l",
".",
"attr",
",",
"\"",
"\"",
",",
"l",
".",
"text",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"text",
":=",
"l",
".",
"text",
"\n",
"spacing",
":=",
"l",
".",
"w",
".",
"x",
"-",
"len",
"(",
"[",
"]",
"rune",
"(",
"text",
")",
")",
"+",
"EscapedLen",
"(",
"text",
")",
"\n",
"if",
"spacing",
"<",
"0",
"{",
"spacing",
"=",
"0",
"\n",
"}",
"\n\n",
"left",
":=",
"\"",
"\"",
"\n",
"right",
":=",
"\"",
"\"",
"\n",
"switch",
"l",
".",
"justify",
"{",
"case",
"JustifyRight",
":",
"left",
"=",
"strings",
".",
"Repeat",
"(",
"\"",
"\"",
",",
"spacing",
")",
"\n",
"<mask>",
"JustifyLeft",
":",
"right",
"=",
"strings",
".",
"Repeat",
"(",
"\"",
"\"",
",",
"spacing",
")",
"\n",
"case",
"JustifyCenter",
":",
"left",
"=",
"strings",
".",
"Repeat",
"(",
"\"",
"\"",
",",
"spacing",
"/",
"2",
")",
"\n",
"right",
"=",
"strings",
".",
"Repeat",
"(",
"\"",
"\"",
",",
"spacing",
"/",
"2",
"+",
"spacing",
"%",
"2",
")",
"\n",
"}",
"\n",
"x",
":=",
"0",
"\n",
"l",
".",
"w",
".",
"printf",
"(",
"x",
",",
"l",
".",
"trueY",
",",
"l",
".",
"attr",
",",
"\"",
"\"",
",",
"left",
",",
"text",
",",
"right",
")",
"\n",
"}"
] |
15,315 | all-15316 | [
"FindSequenceOnDiskPad",
"takes",
"a",
"string",
"that",
"is",
"a",
"compatible",
"/",
"parsible",
"FileSequence",
"pattern",
"and",
"finds",
"a",
"sequence",
"on",
"disk",
"which",
"matches",
"the",
"Basename",
"and",
"Extension",
".",
"The",
"returned",
"seq",
"will",
"use",
"the",
"given",
"PadStyle",
".",
"By",
"default",
"the",
"patterns",
"frame",
"value",
"and",
"padding",
"characters",
"are",
"ignored",
"and",
"replaced",
"by",
"a",
"wildcard",
"*",
"glob",
".",
"If",
"you",
"want",
"to",
"match",
"on",
"a",
"specific",
"frame",
"padding",
"length",
"pass",
"the",
"option",
"StrictPadding",
"If",
"no",
"match",
"is",
"found",
"a",
"nil",
"FileSequence",
"is",
"returned",
".",
"If",
"an",
"error",
"occurs",
"while",
"reading",
"the",
"filesystem",
"a",
"non",
"-",
"nil",
"error",
"is",
"returned",
"."
] | [
"func",
"FindSequenceOnDiskPad",
"(",
"pattern",
"string",
",",
"padStyle",
"PadStyle",
",",
"opts",
"...",
"FileOption",
")",
"(",
"*",
"FileSequence",
",",
"error",
")",
"{",
"optsCopy",
":=",
"<mask>",
"(",
"[",
"]",
"FileOption",
",",
"len",
"(",
"opts",
")",
")",
"\n",
"copy",
"(",
"optsCopy",
",",
"opts",
")",
"\n\n",
"var",
"strictPadding",
"bool",
"\n\n",
"for",
"_",
",",
"opt",
":=",
"range",
"opts",
"{",
"switch",
"opt",
"{",
"case",
"FileOptPadStyleHash1",
":",
"padStyle",
"=",
"PadStyleHash1",
"\n",
"optsCopy",
"=",
"append",
"(",
"optsCopy",
",",
"FileOptPadStyleHash1",
")",
"\n\n",
"case",
"FileOptPadStyleHash4",
":",
"padStyle",
"=",
"PadStyleHash4",
"\n",
"optsCopy",
"=",
"append",
"(",
"optsCopy",
",",
"FileOptPadStyleHash4",
")",
"\n\n",
"case",
"StrictPadding",
":",
"strictPadding",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"fs",
",",
"err",
":=",
"NewFileSequencePad",
"(",
"pattern",
",",
"padStyle",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// Treat a bad pattern as a non-match",
"fmt",
".",
"Println",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n\n",
"seqs",
",",
"err",
":=",
"FindSequencesOnDisk",
"(",
"fs",
".",
"Dirname",
"(",
")",
",",
"optsCopy",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"pattern",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"base",
":=",
"fs",
".",
"Basename",
"(",
")",
"\n",
"ext",
":=",
"fs",
".",
"Ext",
"(",
")",
"\n",
"pad",
":=",
"fs",
".",
"Padding",
"(",
")",
"\n",
"fill",
":=",
"fs",
".",
"ZFill",
"(",
")",
"\n\n",
"for",
"_",
",",
"seq",
":=",
"range",
"seqs",
"{",
"// Find the first match and return it",
"if",
"seq",
".",
"Basename",
"(",
")",
"!=",
"base",
"||",
"seq",
".",
"Ext",
"(",
")",
"!=",
"ext",
"{",
"continue",
"\n",
"}",
"\n\n",
"seq",
".",
"SetPaddingStyle",
"(",
"padStyle",
")",
"\n\n",
"// Strict padding check",
"if",
"strictPadding",
"&&",
"pad",
"!=",
"\"",
"\"",
"&&",
"seq",
".",
"ZFill",
"(",
")",
"!=",
"fill",
"{",
"continue",
"\n",
"}",
"\n\n",
"return",
"seq",
",",
"nil",
"\n",
"}",
"\n",
"// If we get this far, we didn't find a match",
"return",
"nil",
",",
"nil",
"\n",
"}"
] |
15,316 | all-15317 | [
"Key",
"will",
"parse",
"and",
"return",
"the",
"appropriately",
"typed",
"key",
"for",
"the",
"selected",
"signature",
"method"
] | [
"func",
"(",
"opts",
"*",
"jwtOptions",
")",
"Key",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"switch",
"opts",
".",
"SignMethod",
".",
"(",
"<mask>",
")",
"{",
"case",
"*",
"jwt",
".",
"SigningMethodRSA",
",",
"*",
"jwt",
".",
"SigningMethodRSAPSS",
":",
"return",
"opts",
".",
"rsaKey",
"(",
")",
"\n",
"case",
"*",
"jwt",
".",
"SigningMethodECDSA",
":",
"return",
"opts",
".",
"ecKey",
"(",
")",
"\n",
"case",
"*",
"jwt",
".",
"SigningMethodHMAC",
":",
"return",
"opts",
".",
"hmacKey",
"(",
")",
"\n",
"default",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"opts",
".",
"SignMethod",
")",
"\n",
"}",
"\n",
"}"
] |
15,317 | all-15318 | [
"AddRaw",
"will",
"add",
"a",
"raw",
"mgo",
".",
"Index",
"to",
"the",
"internal",
"index",
"list",
"."
] | [
"func",
"(",
"i",
"*",
"Indexer",
")",
"AddRaw",
"(",
"coll",
"string",
",",
"idx",
"mgo",
".",
"<mask>",
")",
"{",
"i",
".",
"indexes",
"=",
"append",
"(",
"i",
".",
"indexes",
",",
"index",
"{",
"coll",
":",
"coll",
",",
"index",
":",
"idx",
",",
"}",
")",
"\n",
"}"
] |
15,318 | all-15319 | [
"Returns",
"a",
"signed",
"URL",
"for",
"AwsS3Credentials",
"valid",
"for",
"the",
"specified",
"duration",
".",
"Required",
"scopes",
":",
"If",
"levelIsReadOnly",
":",
"Any",
"of",
":",
"-",
"auth",
":",
"aws",
"-",
"s3",
":",
"read",
"-",
"only",
":",
"<bucket",
">",
"/",
"<prefix",
">",
"-",
"auth",
":",
"aws",
"-",
"s3",
":",
"read",
"-",
"write",
":",
"<bucket",
">",
"/",
"<prefix",
">",
"See",
"AwsS3Credentials",
"for",
"more",
"details",
"."
] | [
"func",
"(",
"auth",
"*",
"Auth",
")",
"AwsS3Credentials_SignedURL",
"(",
"level",
",",
"bucket",
",",
"prefix",
",",
"format",
"string",
",",
"duration",
"time",
".",
"Duration",
")",
"(",
"*",
"url",
".",
"URL",
",",
"error",
")",
"{",
"v",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"if",
"<mask>",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"format",
")",
"\n",
"}",
"\n",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"auth",
")",
"\n",
"return",
"(",
"&",
"cd",
")",
".",
"SignedURL",
"(",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"level",
")",
"+",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"bucket",
")",
"+",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"prefix",
")",
",",
"v",
",",
"duration",
")",
"\n",
"}"
] |
15,319 | all-15320 | [
"GetAllContainerIDs",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockTaskEngineState",
")",
"GetAllContainerIDs",
"(",
")",
"[",
"]",
"string",
"{",
"<mask>",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"[",
"]",
"string",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
15,320 | all-15321 | [
"headerDirToPutFileRecords",
"is",
"a",
"helper",
"for",
"copyFile",
"that",
"handles",
"copying",
"header",
"/",
"footer",
"directories",
".",
"Copy",
"uses",
"essentially",
"the",
"same",
"codepath",
"as",
"putFile",
"--",
"it",
"converts",
"hashtree",
"node",
"(",
"s",
")",
"to",
"PutFileRecords",
"and",
"then",
"uses",
"applyWrite",
"to",
"put",
"the",
"records",
"back",
"in",
"the",
"target",
"hashtree",
".",
"In",
"putFile",
"the",
"only",
"way",
"to",
"create",
"a",
"headerDir",
"is",
"with",
"PutFileSplit",
"(",
"PutFileRecord",
"with",
"Split",
"==",
"true",
")",
".",
"Rather",
"than",
"split",
"the",
"putFile",
"codepath",
"by",
"adding",
"a",
"special",
"case",
"to",
"applyWrite",
"that",
"was",
"valid",
"for",
"copyFile",
"but",
"invalid",
"for",
"putFile",
"we",
"use",
"heaaderDirToPutFileRecords",
"to",
"convert",
"a",
"DirectoryNode",
"to",
"a",
"PutFileRecord",
"+",
"Split",
"==",
"true",
"which",
"applyWrite",
"will",
"correctly",
"convert",
"back",
"to",
"a",
"header",
"dir",
"in",
"the",
"target",
"hashtree",
"via",
"the",
"regular",
"putFile",
"codepath",
"."
] | [
"func",
"headerDirToPutFileRecords",
"(",
"tree",
"hashtree",
".",
"HashTree",
",",
"path",
"string",
",",
"node",
"*",
"hashtree",
".",
"NodeProto",
")",
"(",
"*",
"pfs",
".",
"PutFileRecords",
",",
"error",
")",
"{",
"if",
"node",
".",
"DirNode",
"==",
"nil",
"||",
"node",
".",
"DirNode",
".",
"Shared",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"s",
":=",
"node",
".",
"DirNode",
".",
"Shared",
"\n",
"pfr",
":=",
"&",
"pfs",
".",
"PutFileRecords",
"{",
"Split",
":",
"true",
",",
"}",
"\n",
"if",
"s",
".",
"Header",
"!=",
"nil",
"{",
"pfr",
".",
"Header",
"=",
"&",
"pfs",
".",
"PutFileRecord",
"{",
"SizeBytes",
":",
"s",
".",
"HeaderSize",
",",
"ObjectHash",
":",
"s",
".",
"Header",
".",
"Hash",
",",
"}",
"\n",
"}",
"\n",
"if",
"s",
".",
"Footer",
"!=",
"nil",
"{",
"pfr",
".",
"Footer",
"=",
"&",
"pfs",
".",
"PutFileRecord",
"{",
"SizeBytes",
":",
"s",
".",
"FooterSize",
",",
"ObjectHash",
":",
"s",
".",
"Footer",
".",
"Hash",
",",
"}",
"\n",
"}",
"\n",
"if",
"err",
":=",
"tree",
".",
"List",
"(",
"path",
",",
"func",
"(",
"child",
"*",
"hashtree",
".",
"NodeProto",
")",
"error",
"{",
"if",
"child",
".",
"FileNode",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"for",
"i",
",",
"o",
":=",
"range",
"child",
".",
"FileNode",
".",
"Objects",
"{",
"// same hack as copyFile--set size of first object to the size of the",
"// whole subtree (and size of other objects to 0). I don't think",
"// PutFileSplit files can have more than one object, but that invariant",
"// isn't necessary to this code's correctness, so don't verify it.",
"<mask>",
"size",
"int64",
"\n",
"if",
"i",
"==",
"0",
"{",
"size",
"=",
"child",
".",
"SubtreeSize",
"\n",
"}",
"\n",
"pfr",
".",
"Records",
"=",
"append",
"(",
"pfr",
".",
"Records",
",",
"&",
"pfs",
".",
"PutFileRecord",
"{",
"SizeBytes",
":",
"size",
",",
"ObjectHash",
":",
"o",
".",
"Hash",
",",
"}",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"pfr",
",",
"nil",
"// TODO(msteffen) put something real here",
"\n",
"}"
] |
15,321 | all-15322 | [
"Do",
"executes",
"Fetch",
".",
"continueWithAuth",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"ContinueWithAuthParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandContinueWithAuth",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
15,322 | all-15323 | [
"MustMarshalJSON",
"panics",
"if",
"an",
"error",
"occurs",
".",
"Besides",
"tha",
"behaves",
"exactly",
"like",
"MarshalJSON",
"."
] | [
"func",
"(",
"cdc",
"*",
"Codec",
")",
"MustMarshalJSON",
"(",
"o",
"interface",
"{",
"}",
")",
"[",
"]",
"<mask>",
"{",
"bz",
",",
"err",
":=",
"cdc",
".",
"MarshalJSON",
"(",
"o",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"bz",
"\n",
"}"
] |
15,323 | all-15324 | [
"This",
"doesn",
"t",
"actually",
"do",
"any",
"DB",
"interaction",
"it",
"just",
"creates",
"the",
"result",
"set",
"so",
"we",
"can",
"start",
"looping",
"through",
"on",
"the",
"iterator"
] | [
"func",
"(",
"c",
"*",
"Collection",
")",
"Find",
"(",
"query",
"interface",
"{",
"}",
")",
"*",
"ResultSet",
"{",
"col",
":=",
"c",
".",
"<mask>",
"(",
")",
"\n\n",
"// Count for testing",
"q",
":=",
"col",
".",
"Find",
"(",
"query",
")",
"\n\n",
"resultset",
":=",
"new",
"(",
"ResultSet",
")",
"\n\n",
"resultset",
".",
"Query",
"=",
"q",
"\n",
"resultset",
".",
"Params",
"=",
"query",
"\n",
"resultset",
".",
"Collection",
"=",
"c",
"\n\n",
"return",
"resultset",
"\n",
"}"
] |
15,324 | all-15325 | [
"$",
"{",
"LXD_DIR",
"}",
"/",
"storage",
"-",
"pools",
"/",
"<pool",
">",
"/",
"containers",
"-",
"snapshots"
] | [
"func",
"getSnapshotSubvolumePath",
"(",
"<mask>",
",",
"poolName",
"string",
",",
"containerName",
"string",
")",
"string",
"{",
"return",
"shared",
".",
"VarPath",
"(",
"\"",
"\"",
",",
"poolName",
",",
"\"",
"\"",
",",
"projectPrefix",
"(",
"project",
",",
"containerName",
")",
")",
"\n",
"}"
] |
15,325 | all-15326 | [
"NewCoreDNSProvider",
"is",
"a",
"CoreDNS",
"provider",
"constructor"
] | [
"func",
"NewCoreDNSProvider",
"(",
"domainFilter",
"DomainFilter",
",",
"dryRun",
"bool",
")",
"(",
"<mask>",
",",
"error",
")",
"{",
"client",
",",
"err",
":=",
"newETCDClient",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"coreDNSProvider",
"{",
"client",
":",
"client",
",",
"dryRun",
":",
"dryRun",
",",
"domainFilter",
":",
"domainFilter",
",",
"}",
",",
"nil",
"\n",
"}"
] |
15,326 | all-15327 | [
"skipWhitespace",
"ignores",
"all",
"whitespace",
"characters"
] | [
"func",
"(",
"l",
"*",
"Lexer",
")",
"skipWhitespace",
"(",
")",
"{",
"for",
"unicode",
".",
"Is",
"(",
"unicode",
".",
"White_Space",
",",
"l",
".",
"next",
"(",
")",
")",
"{",
"}",
"\n",
"l",
".",
"backup",
"(",
")",
"\n",
"l",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
15,327 | all-15328 | [
"ReservedInstanceLocator",
"builds",
"a",
"locator",
"from",
"the",
"given",
"href",
"."
] | [
"func",
"(",
"api",
"*",
"API",
")",
"ReservedInstanceLocator",
"(",
"href",
"<mask>",
")",
"*",
"ReservedInstanceLocator",
"{",
"return",
"&",
"ReservedInstanceLocator",
"{",
"Href",
"(",
"href",
")",
",",
"api",
"}",
"\n",
"}"
] |
15,328 | all-15329 | [
"removeClosure",
"removes",
"a",
"closure",
"from",
"the",
"internal",
"closures",
"map",
".",
"This",
"is",
"needed",
"to",
"prevent",
"a",
"leak",
"where",
"Go",
"code",
"can",
"access",
"the",
"closure",
"context",
"(",
"along",
"with",
"rf",
"and",
"userdata",
")",
"even",
"after",
"an",
"object",
"has",
"been",
"destroyed",
"and",
"the",
"GClosure",
"is",
"invalidated",
"and",
"will",
"never",
"run",
".",
"export",
"removeClosure"
] | [
"func",
"removeClosure",
"(",
"_",
"C",
".",
"gpointer",
",",
"closure",
"*",
"C",
".",
"GClosure",
")",
"{",
"closures",
".",
"Lock",
"(",
")",
"\n",
"<mask>",
"(",
"closures",
".",
"m",
",",
"closure",
")",
"\n",
"closures",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
15,329 | all-15330 | [
"NewContainerWithSteadyState",
"creates",
"a",
"new",
"Container",
"object",
"with",
"the",
"specified",
"steady",
"state",
".",
"Containers",
"that",
"need",
"the",
"non",
"default",
"steady",
"state",
"set",
"will",
"use",
"this",
"method",
"instead",
"of",
"setting",
"it",
"directly"
] | [
"func",
"NewContainerWithSteadyState",
"(",
"steadyState",
"apicontainerstatus",
".",
"ContainerStatus",
")",
"*",
"<mask>",
"{",
"steadyStateStatus",
":=",
"steadyState",
"\n",
"return",
"&",
"Container",
"{",
"SteadyStateStatusUnsafe",
":",
"&",
"steadyStateStatus",
",",
"}",
"\n",
"}"
] |
15,330 | all-15331 | [
"Mutate",
"applies",
"the",
"provided",
"mutators",
"to",
"this",
"builder",
"s",
"payment",
"or",
"operation",
"."
] | [
"func",
"(",
"b",
"*",
"ManageDataBuilder",
")",
"Mutate",
"(",
"muts",
"...",
"interface",
"{",
"}",
")",
"{",
"for",
"_",
",",
"m",
":=",
"<mask>",
"muts",
"{",
"var",
"err",
"error",
"\n",
"switch",
"mut",
":=",
"m",
".",
"(",
"type",
")",
"{",
"case",
"OperationMutator",
":",
"err",
"=",
"mut",
".",
"MutateOperation",
"(",
"&",
"b",
".",
"O",
")",
"\n",
"default",
":",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"b",
".",
"Err",
"=",
"err",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
15,331 | all-15332 | [
"PutFileURL",
"puts",
"a",
"file",
"using",
"the",
"content",
"found",
"at",
"a",
"URL",
".",
"The",
"URL",
"is",
"sent",
"to",
"the",
"server",
"which",
"performs",
"the",
"request",
".",
"recursive",
"allow",
"for",
"recursive",
"scraping",
"of",
"some",
"types",
"URLs",
"for",
"example",
"on",
"s3",
":",
"//",
"urls",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"PutFileURL",
"(",
"repoName",
"string",
",",
"commitID",
"string",
",",
"<mask>",
"string",
",",
"url",
"string",
",",
"recursive",
"bool",
",",
"overwrite",
"bool",
")",
"(",
"retErr",
"error",
")",
"{",
"pfc",
",",
"err",
":=",
"c",
".",
"newOneoffPutFileClient",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"pfc",
".",
"PutFileURL",
"(",
"repoName",
",",
"commitID",
",",
"path",
",",
"url",
",",
"recursive",
",",
"overwrite",
")",
"\n",
"}"
] |
15,332 | all-15333 | [
"MoveToFolder",
"is",
"a",
"complex",
"method",
"that",
"moves",
"a",
"ClusterComputeResource",
"to",
"a",
"given",
"relative",
"compute",
"folder",
"path",
".",
"Relative",
"here",
"means",
"relative",
"to",
"a",
"datacenter",
"which",
"is",
"discovered",
"from",
"the",
"current",
"ClusterComputeResource",
"path",
"."
] | [
"func",
"MoveToFolder",
"(",
"<mask>",
"*",
"govmomi",
".",
"Client",
",",
"cluster",
"*",
"object",
".",
"ClusterComputeResource",
",",
"relative",
"string",
")",
"error",
"{",
"f",
",",
"err",
":=",
"folder",
".",
"HostFolderFromObject",
"(",
"client",
",",
"cluster",
",",
"relative",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"folder",
".",
"MoveObjectTo",
"(",
"cluster",
".",
"Reference",
"(",
")",
",",
"f",
")",
"\n",
"}"
] |
15,333 | all-15334 | [
"AddData",
"appends",
"a",
"new",
"bar",
"to",
"a",
"chart"
] | [
"func",
"(",
"b",
"*",
"SparkChart",
")",
"AddData",
"(",
"val",
"float64",
")",
"{",
"b",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"b",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"b",
".",
"data",
"=",
"<mask>",
"(",
"b",
".",
"data",
",",
"val",
")",
"\n\n",
"_",
",",
"width",
":=",
"b",
".",
"calculateBarArea",
"(",
")",
"\n",
"if",
"len",
"(",
"b",
".",
"data",
")",
">",
"width",
"{",
"b",
".",
"data",
"=",
"b",
".",
"data",
"[",
"len",
"(",
"b",
".",
"data",
")",
"-",
"width",
":",
"]",
"\n",
"}",
"\n",
"}"
] |
15,334 | all-15335 | [
"SetCookie",
"sets",
"the",
"given",
"response",
"cookie",
".",
"It",
"is",
"save",
"re",
"-",
"using",
"the",
"cookie",
"after",
"the",
"function",
"returns",
"."
] | [
"func",
"(",
"h",
"*",
"ResponseHeader",
")",
"SetCookie",
"(",
"cookie",
"*",
"Cookie",
")",
"{",
"h",
".",
"cookies",
"=",
"setArgBytes",
"(",
"h",
".",
"cookies",
",",
"<mask>",
".",
"Key",
"(",
")",
",",
"cookie",
".",
"Cookie",
"(",
")",
",",
"argsHasValue",
")",
"\n",
"}"
] |
15,335 | all-15336 | [
"ReadFileMaybeGZIP",
"wraps",
"ioutil",
".",
"ReadFile",
"returning",
"the",
"decompressed",
"contents",
"if",
"the",
"file",
"is",
"gzipped",
"or",
"otherwise",
"the",
"raw",
"contents"
] | [
"func",
"ReadFileMaybeGZIP",
"(",
"path",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"b",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"// check if file contains gzip header: http://www.zlib.org/rfc-gzip.html",
"if",
"!",
"bytes",
".",
"HasPrefix",
"(",
"b",
",",
"[",
"]",
"<mask>",
"(",
"\"",
"\\x1F",
"\\x8B",
"\"",
")",
")",
"{",
"// go ahead and return the contents if not gzipped",
"return",
"b",
",",
"nil",
"\n",
"}",
"\n",
"// otherwise decode",
"gzipReader",
",",
"err",
":=",
"gzip",
".",
"NewReader",
"(",
"bytes",
".",
"NewBuffer",
"(",
"b",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"ioutil",
".",
"ReadAll",
"(",
"gzipReader",
")",
"\n",
"}"
] |
15,336 | all-15337 | [
"ListenAndServeTLS",
"acts",
"identically",
"to",
"ListenAndServe",
"except",
"that",
"it",
"uses",
"the",
"TELNET",
"protocol",
"over",
"TLS",
".",
"From",
"a",
"TELNET",
"protocol",
"point",
"-",
"of",
"-",
"view",
"it",
"allows",
"for",
"secured",
"telnet",
"also",
"known",
"as",
"TELNETS",
"which",
"by",
"default",
"listens",
"to",
"port",
"992",
".",
"Of",
"course",
"this",
"port",
"can",
"be",
"overridden",
"using",
"the",
"addr",
"argument",
".",
"For",
"a",
"very",
"simple",
"example",
":",
"package",
"main",
"import",
"(",
"github",
".",
"com",
"/",
"reiver",
"/",
"go",
"-",
"telnet",
")",
"func",
"main",
"()",
"{",
"//"
] | [
"func",
"ListenAndServeTLS",
"(",
"addr",
"string",
",",
"certFile",
"string",
",",
"keyFile",
"string",
",",
"handler",
"Handler",
")",
"error",
"{",
"server",
":=",
"&",
"Server",
"{",
"Addr",
":",
"addr",
",",
"Handler",
":",
"<mask>",
"}",
"\n",
"return",
"server",
".",
"ListenAndServeTLS",
"(",
"certFile",
",",
"keyFile",
")",
"\n",
"}"
] |
15,337 | all-15338 | [
"ReadResponse",
"reads",
"a",
"server",
"response",
"into",
"the",
"received",
"o",
"."
] | [
"func",
"(",
"o",
"*",
"GetTasksReader",
")",
"ReadResponse",
"(",
"response",
"runtime",
".",
"ClientResponse",
",",
"consumer",
"runtime",
".",
"Consumer",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"<mask>",
"response",
".",
"Code",
"(",
")",
"{",
"case",
"200",
":",
"result",
":=",
"NewGetTasksOK",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n\n",
"default",
":",
"result",
":=",
"NewGetTasksDefault",
"(",
"response",
".",
"Code",
"(",
")",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"response",
".",
"Code",
"(",
")",
"/",
"100",
"==",
"2",
"{",
"return",
"result",
",",
"nil",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n",
"}",
"\n",
"}"
] |
15,338 | all-15339 | [
"NewPostbackButton",
"creates",
"a",
"button",
"used",
"in",
"ButtonTemplate",
"that",
"upon",
"clicking",
"sends",
"a",
"payload",
"request",
"to",
"the",
"server"
] | [
"func",
"NewPostbackButton",
"(",
"title",
"string",
",",
"payload",
"string",
")",
"Button",
"{",
"return",
"Button",
"{",
"Type",
":",
"ButtonTypePostback",
",",
"Title",
":",
"<mask>",
",",
"Payload",
":",
"payload",
",",
"}",
"\n",
"}"
] |
15,339 | all-15340 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"ClearCompilationCacheParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage76",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
15,340 | all-15341 | [
"FileCopy",
"copies",
"a",
"file",
"overwriting",
"the",
"target",
"if",
"it",
"exists",
"."
] | [
"func",
"GetPathMode",
"(",
"path",
"string",
")",
"(",
"os",
".",
"FileMode",
",",
"error",
")",
"{",
"s",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"os",
".",
"FileMode",
"(",
"0000",
")",
",",
"err",
"\n",
"}",
"\n",
"defer",
"s",
".",
"Close",
"(",
")",
"\n\n",
"fi",
",",
"err",
":=",
"s",
".",
"Stat",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"os",
".",
"FileMode",
"(",
"0000",
")",
",",
"err",
"\n",
"}",
"\n\n",
"mode",
",",
"_",
",",
"_",
":=",
"GetOwnerMode",
"(",
"fi",
")",
"\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}"
] |
15,341 | all-15342 | [
"WriteContainerMetadataResponse",
"writes",
"the",
"container",
"metadata",
"to",
"response",
"writer",
"."
] | [
"func",
"WriteContainerMetadataResponse",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"containerID",
"string",
",",
"<mask>",
"dockerstate",
".",
"TaskEngineState",
")",
"{",
"containerResponse",
",",
"err",
":=",
"NewContainerResponse",
"(",
"containerID",
",",
"state",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errResponseJSON",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"\"",
"\"",
"+",
"containerID",
"+",
"\"",
"\"",
")",
"\n",
"utils",
".",
"WriteJSONToResponse",
"(",
"w",
",",
"http",
".",
"StatusBadRequest",
",",
"errResponseJSON",
",",
"utils",
".",
"RequestTypeContainerMetadata",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"responseJSON",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"containerResponse",
")",
"\n",
"utils",
".",
"WriteJSONToResponse",
"(",
"w",
",",
"http",
".",
"StatusOK",
",",
"responseJSON",
",",
"utils",
".",
"RequestTypeContainerMetadata",
")",
"\n",
"}"
] |
15,342 | all-15343 | [
"GetRepoProjects",
"returns",
"the",
"list",
"of",
"projects",
"under",
"a",
"repo",
"."
] | [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"GetRepoProjects",
"(",
"owner",
",",
"repo",
"string",
")",
"(",
"[",
"]",
"github",
".",
"<mask>",
",",
"error",
")",
"{",
"return",
"f",
".",
"RepoProjects",
"[",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"owner",
",",
"repo",
")",
"]",
",",
"nil",
"\n",
"}"
] |
15,343 | all-15344 | [
"AddContext",
"will",
"return",
"a",
"copy",
"of",
"the",
"logger",
"with",
"extra",
"context",
"added"
] | [
"func",
"AddContext",
"(",
"logger",
"logger",
".",
"Logger",
",",
"ctx",
"log",
".",
"Ctx",
")",
"logger",
".",
"Logger",
"{",
"log15logger",
",",
"<mask>",
":=",
"logger",
".",
"(",
"log",
".",
"Logger",
")",
"\n",
"if",
"!",
"ok",
"{",
"logger",
".",
"Error",
"(",
"\"",
"\"",
",",
"log",
".",
"Ctx",
"{",
"\"",
"\"",
":",
"log15logger",
",",
"\"",
"\"",
":",
"ctx",
"}",
")",
"\n",
"return",
"logger",
"\n",
"}",
"\n\n",
"return",
"log15logger",
".",
"New",
"(",
"ctx",
")",
"\n",
"}"
] |
15,344 | all-15345 | [
"Set",
"sets",
"the",
"given",
"key",
":",
"value",
"header",
".",
"Use",
"Add",
"for",
"setting",
"multiple",
"header",
"values",
"under",
"the",
"same",
"key",
"."
] | [
"func",
"(",
"h",
"*",
"ResponseHeader",
")",
"Set",
"(",
"key",
",",
"value",
"string",
")",
"{",
"initHeaderKV",
"(",
"&",
"h",
".",
"bufKV",
",",
"<mask>",
",",
"value",
",",
"h",
".",
"disableNormalizing",
")",
"\n",
"h",
".",
"SetCanonical",
"(",
"h",
".",
"bufKV",
".",
"key",
",",
"h",
".",
"bufKV",
".",
"value",
")",
"\n",
"}"
] |
15,345 | all-15346 | [
"HasVizType",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"a",
"*",
"AlertGraphDefinition",
")",
"HasVizType",
"(",
")",
"bool",
"{",
"if",
"a",
"!=",
"nil",
"&&",
"a",
".",
"VizType",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
15,346 | all-15347 | [
"Remove",
"destroys",
"the",
"VM",
"instance",
"and",
"the",
"associated",
"SSH",
"key",
"."
] | [
"func",
"(",
"d",
"*",
"Driver",
")",
"Remove",
"(",
")",
"error",
"{",
"client",
":=",
"d",
".",
"client",
"(",
")",
"\n\n",
"// Destroy the SSH key from CloudStack",
"if",
"d",
".",
"KeyPair",
"!=",
"\"",
"\"",
"{",
"key",
":=",
"&",
"egoscale",
".",
"SSHKeyPair",
"{",
"Name",
":",
"d",
".",
"KeyPair",
"}",
"\n",
"if",
"err",
":=",
"client",
".",
"DeleteWithContext",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Destroy the virtual machine",
"if",
"d",
".",
"ID",
"!=",
"\"",
"\"",
"{",
"vm",
":=",
"&",
"egoscale",
".",
"VirtualMachine",
"{",
"ID",
":",
"d",
".",
"ID",
"}",
"\n",
"if",
"err",
":=",
"client",
".",
"DeleteWithContext",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"vm",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"log",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
15,347 | all-15348 | [
"GetNodeType",
"returns",
"the",
"NodeType",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinition",
")",
"GetNodeType",
"(",
")",
"<mask>",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"NodeType",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"NodeType",
"\n",
"}"
] |
15,348 | all-15349 | [
"promotable",
"indicates",
"whether",
"state",
"machine",
"can",
"be",
"promoted",
"to",
"leader",
"which",
"is",
"true",
"when",
"its",
"own",
"id",
"is",
"in",
"progress",
"list",
"."
] | [
"func",
"(",
"r",
"*",
"raft",
")",
"promotable",
"(",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"r",
".",
"prs",
"[",
"r",
".",
"id",
"]",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
15,349 | all-15350 | [
"Funcs",
"adds",
"the",
"functions",
"in",
"fm",
"to",
"the",
"Expander",
"s",
"function",
"map",
".",
"Existing",
"functions",
"will",
"be",
"overwritten",
"in",
"case",
"of",
"conflict",
"."
] | [
"func",
"(",
"te",
"Expander",
")",
"Funcs",
"(",
"fm",
"text_template",
".",
"FuncMap",
")",
"{",
"for",
"k",
",",
"v",
":=",
"<mask>",
"fm",
"{",
"te",
".",
"funcMap",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"}"
] |
15,350 | all-15351 | [
"GetDraw",
"is",
"a",
"wrapper",
"around",
"gtk_separator_tool_item_get_draw",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"SeparatorToolItem",
")",
"GetDraw",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_separator_tool_item_get_draw",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
15,351 | all-15352 | [
"ClientPreUncooperativeClose",
"waiting",
"for",
"until",
"the",
"challenge",
"period",
"is",
"over",
".",
"Then",
"deletes",
"the",
"channel",
"and",
"settles",
"by",
"transferring",
"the",
"balance",
"to",
"the",
"Agent",
"and",
"the",
"rest",
"of",
"the",
"deposit",
"back",
"to",
"the",
"Client",
"."
] | [
"func",
"(",
"w",
"*",
"Worker",
")",
"ClientPreUncooperativeClose",
"(",
"job",
"*",
"data",
".",
"Job",
")",
"error",
"{",
"logger",
":=",
"w",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"job",
")",
"\n\n",
"// If cooperative close was created for this channel, skip this job.",
"err",
":=",
"w",
".",
"db",
".",
"SelectOneTo",
"(",
"&",
"data",
".",
"Job",
"{",
"}",
",",
"\"",
"\"",
",",
"job",
".",
"RelatedID",
",",
"job",
".",
"RelatedType",
",",
"data",
".",
"JobClientAfterCooperativeClose",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"job",
".",
"Status",
"=",
"data",
".",
"JobCanceled",
"\n",
"w",
".",
"db",
".",
"Save",
"(",
"job",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"ch",
",",
"err",
":=",
"w",
".",
"relatedChannel",
"(",
"logger",
",",
"job",
",",
"data",
".",
"JobClientPreUncooperativeClose",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"ch",
".",
"ChannelStatus",
"==",
"data",
".",
"ChannelClosedCoop",
"{",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"logger",
"=",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"ch",
")",
"\n\n",
"agent",
",",
"err",
":=",
"data",
".",
"HexToAddress",
"(",
"ch",
".",
"Agent",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"ErrParseEthAddr",
"\n",
"}",
"\n\n",
"client",
",",
"err",
":=",
"data",
".",
"HexToAddress",
"(",
"ch",
".",
"Client",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"ErrParseEthAddr",
"\n",
"}",
"\n\n",
"acc",
",",
"err",
":=",
"w",
".",
"account",
"(",
"logger",
",",
"ch",
".",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"offer",
",",
"err",
":=",
"w",
".",
"offering",
"(",
"logger",
",",
"ch",
".",
"Offering",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"offerHash",
",",
"err",
":=",
"data",
".",
"HexToHash",
"(",
"offer",
".",
"Hash",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"ErrParseOfferingHash",
"\n",
"}",
"\n\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"context",
".",
"Background",
"(",
")",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"blocks",
",",
"err",
":=",
"w",
".",
"blocksTillChallangeEnd",
"(",
"ctx",
",",
"logger",
",",
"client",
",",
"agent",
",",
"ch",
".",
"Block",
",",
"offerHash",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"blocks",
">",
"0",
"{",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"blocks",
")",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"return",
"ErrChallengePeriodIsNotOver",
"\n",
"}",
"\n\n",
"tx",
",",
"err",
":=",
"w",
".",
"settle",
"(",
"ctx",
",",
"logger",
",",
"acc",
",",
"agent",
",",
"ch",
".",
"Block",
",",
"offerHash",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"w",
".",
"saveEthTX",
"(",
"logger",
",",
"job",
",",
"tx",
",",
"\"",
"\"",
",",
"data",
".",
"JobChannel",
",",
"ch",
".",
"ID",
",",
"acc",
".",
"EthAddr",
",",
"data",
".",
"HexFromBytes",
"(",
"w",
".",
"pscAddr",
".",
"Bytes",
"(",
")",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"ch",
".",
"ChannelStatus",
"=",
"data",
".",
"ChannelWaitUncoop",
"\n\n",
"return",
"w",
".",
"saveRecord",
"(",
"logger",
",",
"w",
".",
"db",
".",
"Querier",
",",
"ch",
")",
"\n",
"}"
] |
15,352 | all-15353 | [
"Returns",
"a",
"boolean",
"at",
"the",
"key",
"or",
"false",
"if",
"it",
"doesn",
"t",
"exist",
"or",
"if",
"it",
"isn",
"t",
"a",
"bool"
] | [
"func",
"(",
"t",
"Typed",
")",
"Bool",
"(",
"<mask>",
"string",
")",
"bool",
"{",
"return",
"t",
".",
"BoolOr",
"(",
"key",
",",
"false",
")",
"\n",
"}"
] |
15,353 | all-15354 | [
"Load",
"reads",
"all",
"the",
"properties",
"and",
"creates",
"GConfig",
"representation",
".",
"It",
"loads",
"config",
"data",
"based",
"on",
"passed",
"in",
"flags",
"or",
"environment",
"variables",
".",
"If",
"none",
"is",
"defined",
"it",
"uses",
"default",
"values",
"."
] | [
"func",
"Load",
"(",
")",
"(",
"*",
"GConfig",
",",
"error",
")",
"{",
"flag",
".",
"Parse",
"(",
")",
"\n\n",
"gc",
":=",
"new",
"(",
"GConfig",
")",
"\n",
"gc",
".",
"Profile",
"=",
"loadProfile",
"(",
")",
"\n\n",
"p",
",",
"err",
":=",
"loadPath",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"configError",
"(",
"err",
",",
"\"",
"\"",
",",
"p",
")",
"\n",
"}",
"\n\n",
"files",
",",
"err",
":=",
"ioutil",
".",
"ReadDir",
"(",
"p",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"configError",
"(",
"err",
",",
"\"",
"\"",
",",
"cpath",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"files",
")",
"==",
"0",
"{",
"return",
"configError",
"(",
"ErrConfigFileRequired",
",",
"\"",
"\"",
",",
"cpath",
")",
"\n",
"}",
"\n\n",
"//read individual config file",
"for",
"_",
",",
"f",
":=",
"range",
"files",
"{",
"cfpath",
":=",
"filepath",
".",
"Join",
"(",
"p",
",",
"f",
".",
"Name",
"(",
")",
")",
"\n",
"pf",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"gc",
".",
"Profile",
")",
"\n",
"if",
"f",
".",
"Name",
"(",
")",
"==",
"StandardPropFileName",
"||",
"pf",
"==",
"f",
".",
"<mask>",
"(",
")",
"{",
"cf",
",",
"err",
":=",
"readPropertyFile",
"(",
"f",
",",
"cfpath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"configError",
"(",
"err",
",",
"\"",
"\"",
",",
"f",
")",
"\n",
"}",
"\n",
"gc",
".",
"addConfigFile",
"(",
"cf",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"Gcg",
"=",
"gc",
"\n\n",
"//do a final check if loaded config has any values",
"if",
"gc",
".",
"isEmpty",
"(",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"Gcg",
".",
"Profile",
")",
"\n",
"}",
"else",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"Gcg",
".",
"Profile",
")",
"\n",
"}",
"\n\n",
"return",
"gc",
",",
"nil",
"\n",
"}"
] |
15,354 | all-15355 | [
"PaperSizeNewCustom",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_paper_size_new_custom",
"()",
"."
] | [
"func",
"PaperSizeNewCustom",
"(",
"name",
",",
"displayName",
"string",
",",
"width",
",",
"height",
"float64",
",",
"unit",
"Unit",
")",
"(",
"*",
"PaperSize",
",",
"error",
")",
"{",
"cName",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cName",
")",
")",
"\n",
"cDisplayName",
":=",
"C",
".",
"CString",
"(",
"displayName",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cDisplayName",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_paper_size_new_custom",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cName",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cDisplayName",
")",
",",
"C",
".",
"gdouble",
"(",
"<mask>",
")",
",",
"C",
".",
"gdouble",
"(",
"height",
")",
",",
"C",
".",
"GtkUnit",
"(",
"unit",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"t",
":=",
"&",
"PaperSize",
"{",
"c",
"}",
"\n",
"runtime",
".",
"SetFinalizer",
"(",
"t",
",",
"(",
"*",
"PaperSize",
")",
".",
"free",
")",
"\n",
"return",
"t",
",",
"nil",
"\n",
"}"
] |
15,355 | all-15356 | [
"Write",
"writes",
"request",
"to",
"w",
".",
"Write",
"doesn",
"t",
"flush",
"request",
"to",
"w",
"for",
"performance",
"reasons",
".",
"See",
"also",
"WriteTo",
"."
] | [
"func",
"(",
"req",
"*",
"Request",
")",
"Write",
"(",
"w",
"*",
"bufio",
".",
"Writer",
")",
"error",
"{",
"if",
"len",
"(",
"req",
".",
"Header",
".",
"Host",
"(",
")",
")",
"==",
"0",
"||",
"req",
".",
"parsedURI",
"{",
"uri",
":=",
"req",
".",
"URI",
"(",
")",
"\n",
"host",
":=",
"uri",
".",
"Host",
"(",
")",
"\n",
"if",
"len",
"(",
"host",
")",
"==",
"0",
"{",
"return",
"errRequestHostRequired",
"\n",
"}",
"\n",
"req",
".",
"Header",
".",
"SetHostBytes",
"(",
"host",
")",
"\n",
"req",
".",
"Header",
".",
"SetRequestURIBytes",
"(",
"uri",
".",
"RequestURI",
"(",
")",
")",
"\n",
"}",
"\n\n",
"if",
"req",
".",
"bodyStream",
"!=",
"nil",
"{",
"return",
"req",
".",
"writeBodyStream",
"(",
"w",
")",
"\n",
"}",
"\n\n",
"body",
":=",
"req",
".",
"bodyBytes",
"(",
")",
"\n",
"var",
"err",
"error",
"\n",
"if",
"req",
".",
"onlyMultipartForm",
"(",
")",
"{",
"body",
",",
"err",
"=",
"marshalMultipartForm",
"(",
"req",
".",
"multipartForm",
",",
"req",
".",
"multipartFormBoundary",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"req",
".",
"Header",
".",
"SetMultipartFormBoundary",
"(",
"req",
".",
"multipartFormBoundary",
")",
"\n",
"}",
"\n\n",
"hasBody",
":=",
"!",
"req",
".",
"Header",
".",
"ignoreBody",
"(",
")",
"\n",
"if",
"hasBody",
"{",
"if",
"len",
"(",
"body",
")",
"==",
"0",
"{",
"body",
"=",
"req",
".",
"postArgs",
".",
"QueryString",
"(",
")",
"\n",
"}",
"\n",
"req",
".",
"Header",
".",
"SetContentLength",
"(",
"len",
"(",
"body",
")",
")",
"\n",
"}",
"\n",
"if",
"err",
"=",
"req",
".",
"Header",
".",
"Write",
"(",
"w",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"hasBody",
"{",
"_",
",",
"err",
"=",
"w",
".",
"Write",
"(",
"<mask>",
")",
"\n",
"}",
"else",
"if",
"len",
"(",
"body",
")",
">",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"body",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
15,356 | all-15357 | [
"SetLineWrap",
"is",
"a",
"wrapper",
"around",
"gtk_label_set_line_wrap",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Label",
")",
"SetLineWrap",
"(",
"wrap",
"bool",
")",
"{",
"C",
".",
"gtk_label_set_line_wrap",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
15,357 | all-15358 | [
"Consistently",
"is",
"used",
"to",
"make",
"asynchronous",
"assertions",
".",
"See",
"documentation",
"for",
"Consistently",
"."
] | [
"func",
"(",
"g",
"*",
"WithT",
")",
"Consistently",
"(",
"actual",
"interface",
"{",
"}",
",",
"intervals",
"...",
"<mask>",
"{",
"}",
")",
"AsyncAssertion",
"{",
"timeoutInterval",
":=",
"defaultConsistentlyDuration",
"\n",
"pollingInterval",
":=",
"defaultConsistentlyPollingInterval",
"\n",
"if",
"len",
"(",
"intervals",
")",
">",
"0",
"{",
"timeoutInterval",
"=",
"toDuration",
"(",
"intervals",
"[",
"0",
"]",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"intervals",
")",
">",
"1",
"{",
"pollingInterval",
"=",
"toDuration",
"(",
"intervals",
"[",
"1",
"]",
")",
"\n",
"}",
"\n",
"return",
"asyncassertion",
".",
"New",
"(",
"asyncassertion",
".",
"AsyncAssertionTypeConsistently",
",",
"actual",
",",
"testingtsupport",
".",
"BuildTestingTGomegaFailWrapper",
"(",
"g",
".",
"t",
")",
",",
"timeoutInterval",
",",
"pollingInterval",
",",
"0",
")",
"\n",
"}"
] |
15,358 | all-15359 | [
"StorageVolumeDescriptionGet",
"gets",
"the",
"description",
"of",
"a",
"storage",
"volume",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"StorageVolumeDescriptionGet",
"(",
"volumeID",
"int64",
")",
"(",
"string",
",",
"error",
")",
"{",
"description",
":=",
"sql",
".",
"NullString",
"{",
"}",
"\n",
"query",
":=",
"\"",
"\"",
"\n",
"inargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"volumeID",
"}",
"\n",
"outargs",
":=",
"[",
"]",
"<mask>",
"{",
"}",
"{",
"&",
"description",
"}",
"\n\n",
"err",
":=",
"dbQueryRowScan",
"(",
"c",
".",
"db",
",",
"query",
",",
"inargs",
",",
"outargs",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"sql",
".",
"ErrNoRows",
"{",
"return",
"\"",
"\"",
",",
"ErrNoSuchObject",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"description",
".",
"String",
",",
"nil",
"\n",
"}"
] |
15,359 | all-15360 | [
"EnqueueDrawTrianglesCommand",
"enqueues",
"a",
"drawing",
"-",
"image",
"command",
"."
] | [
"func",
"(",
"q",
"*",
"commandQueue",
")",
"EnqueueDrawTrianglesCommand",
"(",
"dst",
",",
"src",
"*",
"Image",
",",
"vertices",
"[",
"]",
"float32",
",",
"indices",
"[",
"]",
"uint16",
",",
"color",
"*",
"affine",
".",
"ColorM",
",",
"mode",
"graphics",
".",
"CompositeMode",
",",
"filter",
"graphics",
".",
"Filter",
",",
"address",
"graphics",
".",
"Address",
")",
"{",
"if",
"len",
"(",
"indices",
")",
">",
"graphics",
".",
"IndicesNum",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"len",
"(",
"indices",
")",
",",
"graphics",
".",
"IndicesNum",
")",
")",
"\n",
"}",
"\n\n",
"split",
":=",
"false",
"\n",
"if",
"q",
".",
"tmpNumIndices",
"+",
"len",
"(",
"indices",
")",
">",
"graphics",
".",
"IndicesNum",
"{",
"q",
".",
"tmpNumIndices",
"=",
"0",
"\n",
"q",
".",
"nextIndex",
"=",
"0",
"\n",
"split",
"=",
"true",
"\n",
"}",
"\n\n",
"q",
".",
"appendVertices",
"(",
"vertices",
")",
"\n",
"q",
".",
"appendIndices",
"(",
"indices",
",",
"uint16",
"(",
"q",
".",
"nextIndex",
")",
")",
"\n",
"q",
".",
"nextIndex",
"+=",
"len",
"(",
"vertices",
")",
"/",
"graphics",
".",
"VertexFloatNum",
"\n",
"q",
".",
"tmpNumIndices",
"+=",
"len",
"(",
"indices",
")",
"\n\n",
"// TODO: If dst is the screen, reorder the command to be the last.",
"q",
".",
"doEnqueueDrawTrianglesCommand",
"(",
"dst",
",",
"src",
",",
"len",
"(",
"vertices",
")",
",",
"len",
"(",
"indices",
")",
",",
"color",
",",
"<mask>",
",",
"filter",
",",
"address",
",",
"split",
")",
"\n",
"}"
] |
15,360 | all-15361 | [
"submitChanges",
"takes",
"a",
"zone",
"and",
"a",
"collection",
"of",
"changes",
"and",
"makes",
"all",
"changes",
"from",
"the",
"collection"
] | [
"func",
"(",
"p",
"*",
"dnsimpleProvider",
")",
"submitChanges",
"(",
"changes",
"[",
"]",
"*",
"dnsimpleChange",
")",
"error",
"{",
"if",
"len",
"(",
"changes",
")",
"==",
"0",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"zones",
",",
"err",
":=",
"p",
".",
"Zones",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"change",
":=",
"range",
"changes",
"{",
"zone",
":=",
"dnsimpleSuitableZone",
"(",
"change",
".",
"ResourceRecordSet",
".",
"Name",
",",
"zones",
")",
"\n",
"if",
"zone",
"==",
"nil",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"change",
".",
"ResourceRecordSet",
".",
"Name",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"change",
".",
"Action",
",",
"change",
".",
"ResourceRecordSet",
",",
"zone",
".",
"Name",
")",
"\n\n",
"change",
".",
"ResourceRecordSet",
".",
"Name",
"=",
"strings",
".",
"TrimSuffix",
"(",
"change",
".",
"ResourceRecordSet",
".",
"Name",
",",
"\"",
"\"",
"+",
"zone",
".",
"Name",
")",
"\n",
"if",
"!",
"p",
".",
"dryRun",
"{",
"switch",
"change",
".",
"Action",
"{",
"case",
"dnsimpleCreate",
":",
"_",
",",
"err",
":=",
"p",
".",
"client",
".",
"CreateRecord",
"(",
"p",
".",
"accountID",
",",
"zone",
".",
"Name",
",",
"change",
".",
"ResourceRecordSet",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"case",
"dnsimpleDelete",
":",
"recordID",
",",
"err",
":=",
"p",
".",
"GetRecordID",
"(",
"zone",
".",
"<mask>",
",",
"change",
".",
"ResourceRecordSet",
".",
"Name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"_",
",",
"err",
"=",
"p",
".",
"client",
".",
"DeleteRecord",
"(",
"p",
".",
"accountID",
",",
"zone",
".",
"Name",
",",
"recordID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"case",
"dnsimpleUpdate",
":",
"recordID",
",",
"err",
":=",
"p",
".",
"GetRecordID",
"(",
"zone",
".",
"Name",
",",
"change",
".",
"ResourceRecordSet",
".",
"Name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"_",
",",
"err",
"=",
"p",
".",
"client",
".",
"UpdateRecord",
"(",
"p",
".",
"accountID",
",",
"zone",
".",
"Name",
",",
"recordID",
",",
"change",
".",
"ResourceRecordSet",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
15,361 | all-15362 | [
"tagsClientIfDefined",
"goes",
"through",
"the",
"client",
"validation",
"process",
"and",
"returns",
"the",
"tags",
"client",
"only",
"if",
"there",
"are",
"tags",
"defined",
"in",
"the",
"supplied",
"ResourceData",
".",
"This",
"should",
"be",
"used",
"to",
"fetch",
"the",
"tagging",
"REST",
"client",
"on",
"resources",
"that",
"support",
"tags",
"usually",
"closer",
"to",
"the",
"beginning",
"of",
"a",
"CRUD",
"function",
"to",
"check",
"to",
"make",
"sure",
"it",
"s",
"worth",
"proceeding",
"with",
"most",
"of",
"the",
"operation",
".",
"The",
"returned",
"client",
"should",
"be",
"checked",
"for",
"nil",
"before",
"passing",
"it",
"to",
"processTagDiff",
"."
] | [
"func",
"tagsClientIfDefined",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
")",
"(",
"*",
"tags",
".",
"RestClient",
",",
"error",
")",
"{",
"old",
",",
"new",
":=",
"d",
".",
"GetChange",
"(",
"vSphereTagAttributeKey",
")",
"\n",
"if",
"len",
"(",
"old",
".",
"(",
"*",
"schema",
".",
"Set",
")",
".",
"List",
"(",
")",
")",
">",
"0",
"||",
"len",
"(",
"new",
".",
"(",
"*",
"schema",
".",
"Set",
")",
".",
"List",
"(",
")",
")",
">",
"0",
"{",
"<mask>",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"client",
",",
"err",
":=",
"meta",
".",
"(",
"*",
"VSphereClient",
")",
".",
"TagsClient",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"client",
",",
"nil",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
",",
"nil",
"\n",
"}"
] |
15,362 | all-15363 | [
"/",
"*",
"Set",
"the",
"maximum",
"number",
"of",
"trace",
"segments",
"allowed",
"in",
"a",
"transaction",
"trace",
".",
"By",
"default",
"the",
"maximum",
"is",
"set",
"to",
"2000",
"which",
"means",
"the",
"first",
"2000",
"segments",
"in",
"a",
"transaction",
"will",
"create",
"trace",
"segments",
"if",
"the",
"transaction",
"exceeds",
"the",
"trace",
"threshold",
"(",
"4",
"x",
"apdex_t",
")",
"."
] | [
"func",
"TransactionSetMaxTraceSegments",
"(",
"id",
"int64",
",",
"max",
"int",
")",
"(",
"int",
",",
"error",
")",
"{",
"return",
"errNo",
"(",
"C",
".",
"newrelic_transaction_set_max_trace_segments",
"(",
"C",
".",
"<mask>",
"(",
"id",
")",
",",
"C",
".",
"int",
"(",
"max",
")",
")",
")",
"\n",
"}"
] |
15,363 | all-15364 | [
"Revoke",
"revokes",
"the",
"caller",
"s",
"credentials",
"(",
"by",
"sending",
"a",
"request",
"to",
"Pachyderm",
")",
".",
"Unlike",
"other",
"handlers",
"it",
"doesn",
"t",
"get",
"assigned",
"to",
"a",
"path",
";",
"instead",
"it",
"s",
"called",
"by",
"the",
"vault",
"lease",
"API",
"when",
"a",
"token",
"s",
"lease",
"expires",
"or",
"is",
"revoked",
".",
"It",
"s",
"set",
"in",
"Backend",
".",
"Secrets",
"[",
"0",
"]",
".",
"Revoke",
"in",
"backend",
".",
"go"
] | [
"func",
"(",
"b",
"*",
"backend",
")",
"Revoke",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"logical",
".",
"Request",
",",
"data",
"*",
"framework",
".",
"FieldData",
")",
"(",
"resp",
"*",
"logical",
".",
"Response",
",",
"retErr",
"error",
")",
"{",
"b",
".",
"Logger",
"(",
")",
".",
"Debug",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"req",
".",
"ID",
",",
"req",
".",
"Operation",
",",
"req",
".",
"Path",
")",
")",
"\n",
"defer",
"func",
"(",
")",
"{",
"b",
".",
"Logger",
"(",
")",
".",
"Debug",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"req",
".",
"<mask>",
",",
"req",
".",
"Operation",
",",
"req",
".",
"Path",
",",
"retErr",
"==",
"nil",
"&&",
"!",
"resp",
".",
"IsError",
"(",
")",
")",
")",
"\n",
"}",
"(",
")",
"\n\n",
"// Extract pachyderm token from vault secret",
"tokenIface",
",",
"ok",
":=",
"req",
".",
"Secret",
".",
"InternalData",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"userToken",
",",
"ok",
":=",
"tokenIface",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"tokenIface",
")",
"\n",
"}",
"\n\n",
"// Get pach address and admin token from config",
"config",
",",
"err",
":=",
"getConfig",
"(",
"ctx",
",",
"req",
".",
"Storage",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"config",
".",
"AdminToken",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"config",
".",
"PachdAddress",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Revoke creds",
"err",
"=",
"revokeUserCredentials",
"(",
"ctx",
",",
"config",
".",
"PachdAddress",
",",
"userToken",
",",
"config",
".",
"AdminToken",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"logical",
".",
"Response",
"{",
"}",
",",
"nil",
"\n",
"}"
] |
15,364 | all-15365 | [
"putCommandFunc",
"executes",
"the",
"put",
"command",
"."
] | [
"func",
"putCommandFunc",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"key",
",",
"value",
",",
"opts",
":=",
"getPutOp",
"(",
"args",
")",
"\n\n",
"ctx",
",",
"cancel",
":=",
"commandCtx",
"(",
"cmd",
")",
"\n",
"resp",
",",
"err",
":=",
"mustClientFromCmd",
"(",
"cmd",
")",
".",
"Put",
"(",
"ctx",
",",
"key",
",",
"<mask>",
",",
"opts",
"...",
")",
"\n",
"cancel",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"ExitWithError",
"(",
"ExitError",
",",
"err",
")",
"\n",
"}",
"\n",
"display",
".",
"Put",
"(",
"*",
"resp",
")",
"\n",
"}"
] |
15,365 | all-15366 | [
"newFileEncoder",
"creates",
"a",
"new",
"encoder",
"with",
"current",
"file",
"offset",
"for",
"the",
"page",
"writer",
"."
] | [
"func",
"newFileEncoder",
"(",
"f",
"*",
"os",
".",
"File",
",",
"prevCrc",
"uint32",
")",
"(",
"*",
"encoder",
",",
"error",
")",
"{",
"offset",
",",
"err",
":=",
"f",
".",
"Seek",
"(",
"0",
",",
"<mask>",
".",
"SeekCurrent",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"newEncoder",
"(",
"f",
",",
"prevCrc",
",",
"int",
"(",
"offset",
")",
")",
",",
"nil",
"\n",
"}"
] |
15,366 | all-15367 | [
"initializeCredentialsEndpoint",
"sets",
"the",
"credentials",
"endpoint",
"for",
"all",
"containers",
"in",
"a",
"task",
"if",
"needed",
"."
] | [
"func",
"(",
"task",
"*",
"Task",
")",
"initializeCredentialsEndpoint",
"(",
"credentialsManager",
"credentials",
".",
"Manager",
")",
"{",
"id",
":=",
"task",
".",
"GetCredentialsID",
"(",
")",
"\n",
"if",
"id",
"==",
"\"",
"\"",
"{",
"// No credentials set for the task. Do not inject the endpoint environment variable.",
"return",
"\n",
"}",
"\n",
"taskCredentials",
",",
"ok",
":=",
"credentialsManager",
".",
"GetTaskCredentials",
"(",
"id",
")",
"\n",
"if",
"!",
"ok",
"{",
"// Task has credentials id set, but credentials manager is unaware of",
"// the id. This should never happen as the payload handler sets",
"// credentialsId for the task after adding credentials to the",
"// credentials manager",
"seelog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"task",
".",
"Arn",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"credentialsEndpointRelativeURI",
":=",
"taskCredentials",
".",
"IAMRoleCredentials",
".",
"GenerateCredentialsEndpointRelativeURI",
"(",
")",
"\n",
"for",
"_",
",",
"container",
":=",
"range",
"task",
".",
"Containers",
"{",
"// container.Environment map would not be initialized if there are",
"// no environment variables to be set or overridden in the container",
"// config. Check if that's the case and initilialize if needed",
"if",
"container",
".",
"Environment",
"==",
"nil",
"{",
"container",
".",
"Environment",
"=",
"<mask>",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"}",
"\n",
"container",
".",
"Environment",
"[",
"awsSDKCredentialsRelativeURIPathEnvironmentVariableName",
"]",
"=",
"credentialsEndpointRelativeURI",
"\n",
"}",
"\n\n",
"}"
] |
15,367 | all-15368 | [
"SetShardKey",
"sets",
"the",
"ShardKey",
"call",
"option",
"(",
"sk",
"transport",
"header",
")",
"."
] | [
"func",
"(",
"cb",
"*",
"ContextBuilder",
")",
"SetShardKey",
"(",
"sk",
"string",
")",
"*",
"ContextBuilder",
"{",
"if",
"cb",
".",
"CallOptions",
"==",
"nil",
"{",
"cb",
".",
"CallOptions",
"=",
"<mask>",
"(",
"CallOptions",
")",
"\n",
"}",
"\n",
"cb",
".",
"CallOptions",
".",
"ShardKey",
"=",
"sk",
"\n",
"return",
"cb",
"\n",
"}"
] |
15,368 | all-15369 | [
"NewSystemUser",
"returns",
"a",
"new",
"system",
"user",
"."
] | [
"func",
"NewSystemUser",
"(",
"name",
",",
"homeDir",
"string",
",",
"gid",
"int",
")",
"*",
"User",
"{",
"return",
"&",
"User",
"{",
"<mask>",
":",
"name",
",",
"Dir",
":",
"homeDir",
",",
"Shell",
":",
"\"",
"\"",
",",
"UID",
":",
"-",
"1",
",",
"GID",
":",
"gid",
",",
"addSystemUser",
":",
"true",
",",
"}",
"\n",
"}"
] |
15,369 | all-15370 | [
"Search",
"searches",
"the",
"index",
"for",
"the",
"given",
"query",
"."
] | [
"func",
"(",
"x",
"*",
"<mask>",
")",
"Search",
"(",
"c",
"context",
".",
"Context",
",",
"query",
"string",
",",
"opts",
"*",
"SearchOptions",
")",
"*",
"Iterator",
"{",
"t",
":=",
"&",
"Iterator",
"{",
"c",
":",
"c",
",",
"index",
":",
"x",
",",
"searchQuery",
":",
"query",
",",
"more",
":",
"moreSearch",
",",
"}",
"\n",
"if",
"opts",
"!=",
"nil",
"{",
"if",
"opts",
".",
"Cursor",
"!=",
"\"",
"\"",
"{",
"if",
"opts",
".",
"Offset",
"!=",
"0",
"{",
"return",
"errIter",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"t",
".",
"searchCursor",
"=",
"proto",
".",
"String",
"(",
"string",
"(",
"opts",
".",
"Cursor",
")",
")",
"\n",
"}",
"\n",
"t",
".",
"limit",
"=",
"opts",
".",
"Limit",
"\n",
"t",
".",
"fields",
"=",
"opts",
".",
"Fields",
"\n",
"t",
".",
"idsOnly",
"=",
"opts",
".",
"IDsOnly",
"\n",
"t",
".",
"sort",
"=",
"opts",
".",
"Sort",
"\n",
"t",
".",
"exprs",
"=",
"opts",
".",
"Expressions",
"\n",
"t",
".",
"refinements",
"=",
"opts",
".",
"Refinements",
"\n",
"t",
".",
"facetOpts",
"=",
"opts",
".",
"Facets",
"\n",
"t",
".",
"searchOffset",
"=",
"opts",
".",
"Offset",
"\n",
"t",
".",
"countAccuracy",
"=",
"opts",
".",
"CountAccuracy",
"\n",
"}",
"\n",
"return",
"t",
"\n",
"}"
] |
15,370 | all-15371 | [
"DeleteDatacenter",
"deletes",
"a",
"data",
"center"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteDatacenter",
"(",
"dcid",
"string",
")",
"(",
"*",
"http",
".",
"Header",
",",
"error",
")",
"{",
"url",
":=",
"dcPath",
"(",
"dcid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"<mask>",
":=",
"&",
"http",
".",
"Header",
"{",
"}",
"\n",
"return",
"ret",
",",
"c",
".",
"client",
".",
"Delete",
"(",
"url",
",",
"ret",
",",
"http",
".",
"StatusAccepted",
")",
"\n",
"}"
] |
15,371 | all-15372 | [
"Parse",
"processes",
"command",
"line",
"arguments",
"and",
"stores",
"them",
"in",
"dest"
] | [
"func",
"Parse",
"(",
"dest",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"p",
",",
"err",
":=",
"NewParser",
"(",
"Config",
"{",
"}",
",",
"<mask>",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"p",
".",
"Parse",
"(",
"flags",
"(",
")",
")",
"\n",
"}"
] |
15,372 | all-15373 | [
"retrieve",
"the",
"location",
"of",
"a",
"subroutine",
"uniform",
"of",
"a",
"given",
"shader",
"stage",
"within",
"a",
"program"
] | [
"func",
"GetSubroutineUniformLocation",
"(",
"<mask>",
"uint32",
",",
"shadertype",
"uint32",
",",
"name",
"*",
"uint8",
")",
"int32",
"{",
"ret",
":=",
"C",
".",
"glowGetSubroutineUniformLocation",
"(",
"gpGetSubroutineUniformLocation",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"shadertype",
")",
",",
"(",
"*",
"C",
".",
"GLchar",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"name",
")",
")",
")",
"\n",
"return",
"(",
"int32",
")",
"(",
"ret",
")",
"\n",
"}"
] |
15,373 | all-15374 | [
"GetRepo",
"returns",
"the",
"repo",
"config",
"after",
"merging",
"in",
"any",
"org",
"policies",
"."
] | [
"func",
"(",
"o",
"Org",
")",
"GetRepo",
"(",
"name",
"string",
")",
"*",
"Repo",
"{",
"r",
",",
"ok",
":=",
"o",
".",
"Repos",
"[",
"name",
"]",
"\n",
"if",
"<mask>",
"{",
"r",
".",
"Policy",
"=",
"o",
".",
"Apply",
"(",
"r",
".",
"Policy",
")",
"\n",
"}",
"else",
"{",
"r",
".",
"Policy",
"=",
"o",
".",
"Policy",
"\n",
"}",
"\n",
"return",
"&",
"r",
"\n",
"}"
] |
15,374 | all-15375 | [
"Do",
"executes",
"Target",
".",
"activateTarget",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"ActivateTargetParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandActivateTarget",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
15,375 | all-15376 | [
"putConfig",
"parses",
"and",
"returns",
"the",
"configuration",
"data",
"from",
"the",
"storage",
"backend",
"."
] | [
"func",
"putConfig",
"(",
"ctx",
"context",
".",
"Context",
",",
"s",
"logical",
".",
"<mask>",
",",
"cfg",
"*",
"config",
")",
"error",
"{",
"entry",
",",
"err",
":=",
"logical",
".",
"StorageEntryJSON",
"(",
"\"",
"\"",
",",
"cfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"s",
".",
"Put",
"(",
"ctx",
",",
"entry",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
15,376 | all-15377 | [
"UnmarshalJSON",
"satisfies",
"json",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"AuthChallengeSource",
")",
"UnmarshalJSON",
"(",
"buf",
"[",
"]",
"<mask>",
")",
"error",
"{",
"return",
"easyjson",
".",
"Unmarshal",
"(",
"buf",
",",
"t",
")",
"\n",
"}"
] |
15,377 | all-15378 | [
"GetMinFailureDurationOk",
"returns",
"a",
"tuple",
"with",
"the",
"MinFailureDuration",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsOptions",
")",
"GetMinFailureDurationOk",
"(",
")",
"(",
"int",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"MinFailureDuration",
"==",
"nil",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"MinFailureDuration",
",",
"<mask>",
"\n",
"}"
] |
15,378 | all-15379 | [
"NewImage",
"returns",
"a",
"new",
"image",
".",
"Note",
"that",
"the",
"image",
"is",
"not",
"initialized",
"yet",
"."
] | [
"func",
"NewImage",
"(",
"width",
",",
"height",
"int",
")",
"*",
"Image",
"{",
"i",
":=",
"&",
"Image",
"{",
"width",
":",
"width",
",",
"height",
":",
"height",
",",
"}",
"\n",
"c",
":=",
"&",
"newImageCommand",
"{",
"result",
":",
"i",
",",
"width",
":",
"width",
",",
"height",
":",
"<mask>",
",",
"}",
"\n",
"theCommandQueue",
".",
"Enqueue",
"(",
"c",
")",
"\n",
"return",
"i",
"\n",
"}"
] |
15,379 | all-15380 | [
"Run",
"clones",
"the",
"refs",
"under",
"the",
"prescribed",
"directory",
"and",
"optionally",
"configures",
"the",
"git",
"username",
"and",
"email",
"in",
"the",
"repository",
"as",
"well",
"."
] | [
"func",
"Run",
"(",
"refs",
"prowapi",
".",
"Refs",
",",
"dir",
",",
"gitUserName",
",",
"gitUserEmail",
",",
"cookiePath",
"string",
",",
"env",
"[",
"]",
"string",
")",
"Record",
"{",
"logrus",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",
"\"",
"\"",
":",
"refs",
"}",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"record",
":=",
"Record",
"{",
"Refs",
":",
"refs",
"}",
"\n\n",
"// This function runs the provided commands in order, logging them as they run,",
"// aborting early and returning if any command fails.",
"runCommands",
":=",
"func",
"(",
"commands",
"[",
"]",
"cloneCommand",
")",
"error",
"{",
"for",
"_",
",",
"command",
":=",
"range",
"commands",
"{",
"formattedCommand",
",",
"output",
",",
"err",
":=",
"command",
".",
"run",
"(",
")",
"\n",
"logrus",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",
"\"",
"\"",
":",
"formattedCommand",
",",
"\"",
"\"",
":",
"output",
",",
"\"",
"\"",
":",
"err",
"}",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"message",
":=",
"\"",
"\"",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"message",
"=",
"err",
".",
"Error",
"(",
")",
"\n",
"record",
".",
"Failed",
"=",
"true",
"\n",
"}",
"\n",
"record",
".",
"Commands",
"=",
"append",
"(",
"record",
".",
"Commands",
",",
"Command",
"{",
"Command",
":",
"formattedCommand",
",",
"Output",
":",
"output",
",",
"Error",
":",
"message",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"g",
":=",
"gitCtxForRefs",
"(",
"refs",
",",
"dir",
",",
"env",
")",
"\n",
"if",
"err",
":=",
"runCommands",
"(",
"g",
".",
"commandsForBaseRef",
"(",
"refs",
",",
"gitUserName",
",",
"gitUserEmail",
",",
"cookiePath",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"record",
"\n",
"}",
"\n\n",
"timestamp",
",",
"err",
":=",
"g",
".",
"gitHeadTimestamp",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"timestamp",
"=",
"int",
"(",
"time",
".",
"Now",
"(",
")",
".",
"Unix",
"(",
")",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"runCommands",
"(",
"g",
".",
"commandsForPullRefs",
"(",
"refs",
",",
"timestamp",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"record",
"\n",
"}",
"\n\n",
"finalSHA",
",",
"err",
":=",
"g",
".",
"gitRevParse",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"refs",
")",
"\n",
"}",
"else",
"{",
"<mask>",
".",
"FinalSHA",
"=",
"finalSHA",
"\n",
"}",
"\n\n",
"return",
"record",
"\n",
"}"
] |
15,380 | all-15381 | [
"WithClip",
"capture",
"the",
"screenshot",
"of",
"a",
"given",
"region",
"only",
"."
] | [
"func",
"(",
"p",
"CaptureScreenshotParams",
")",
"WithClip",
"(",
"<mask>",
"*",
"Viewport",
")",
"*",
"CaptureScreenshotParams",
"{",
"p",
".",
"Clip",
"=",
"clip",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
15,381 | all-15382 | [
"gitWrapperScript",
"forms",
"content",
"for",
"git",
".",
"sh",
"script"
] | [
"func",
"gitWrapperScript",
"(",
")",
"[",
"]",
"<mask>",
"{",
"scriptTemplate",
":=",
"`#!/usr/bin/env {shell}\n\n# The MIT License (MIT)\n# Copyright (c) 2013 Alvin Abad\n\nif [ $# -eq 0 ]; then\n echo \"Git wrapper script that can specify an ssh-key file\nUsage:\n git.sh -i ssh-key-file git-command\n \"\n exit 1\nfi\n\n# remove temporary file on exit\ntrap 'rm -f {tmp_dir}/.git_ssh.$$' 0\n\nif [ \"$1\" = \"-i\" ]; then\n SSH_KEY=$2; shift; shift\n echo -e \"#!/usr/bin/env {shell}\\n \\\n ssh -i $SSH_KEY \\$@\" > {tmp_dir}/.git_ssh.$$\n chmod +x {tmp_dir}/.git_ssh.$$\n export GIT_SSH={tmp_dir}/.git_ssh.$$\nfi\n\n# in case the git command is repeated\n[ \"$1\" = \"git\" ] && shift\n\n# Run the git command\n{git_binary} \"$@\"\n\n`",
"\n",
"replacer",
":=",
"strings",
".",
"NewReplacer",
"(",
"\"",
"\"",
",",
"shell",
",",
"\"",
"\"",
",",
"strings",
".",
"TrimSuffix",
"(",
"gos",
".",
"TempDir",
"(",
")",
",",
"\"",
"\"",
")",
",",
"\"",
"\"",
",",
"gitBinary",
",",
")",
"\n",
"return",
"[",
"]",
"byte",
"(",
"replacer",
".",
"Replace",
"(",
"scriptTemplate",
")",
")",
"\n",
"}"
] |
15,382 | all-15383 | [
"Stability",
":",
"***",
"EXPERIMENTAL",
"***",
"Terminate",
"all",
"instances",
"for",
"this",
"worker",
"type",
"Required",
"scopes",
":",
"ec2",
"-",
"manager",
":",
"manage",
"-",
"resources",
":",
"<workerType",
">",
"See",
"https",
":",
"//",
"docs",
".",
"taskcluster",
".",
"net",
"/",
"reference",
"/",
"core",
"/",
"ec2",
"-",
"manager",
"/",
"api",
"-",
"docs#terminateWorkerType"
] | [
"func",
"(",
"eC2Manager",
"*",
"EC2Manager",
")",
"TerminateWorkerType",
"(",
"workerType",
"string",
")",
"error",
"{",
"cd",
":=",
"tcclient",
".",
"<mask>",
"(",
"*",
"eC2Manager",
")",
"\n",
"_",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"workerType",
")",
"+",
"\"",
"\"",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
15,383 | all-15384 | [
"MiddlewareFunc",
"makes",
"GzipMiddleware",
"implement",
"the",
"Middleware",
"interface",
"."
] | [
"func",
"(",
"mw",
"*",
"GzipMiddleware",
")",
"MiddlewareFunc",
"(",
"h",
"HandlerFunc",
")",
"HandlerFunc",
"{",
"return",
"func",
"(",
"w",
"ResponseWriter",
",",
"r",
"*",
"Request",
")",
"{",
"// gzip support enabled",
"canGzip",
":=",
"strings",
".",
"Contains",
"(",
"r",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"\"",
"\"",
")",
"\n",
"// client accepts gzip ?",
"writer",
":=",
"&",
"gzipResponseWriter",
"{",
"w",
",",
"false",
",",
"canGzip",
",",
"nil",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"// need to close gzip writer",
"if",
"writer",
".",
"gzipWriter",
"!=",
"nil",
"{",
"<mask>",
".",
"gzipWriter",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"// call the handler with the wrapped writer",
"h",
"(",
"writer",
",",
"r",
")",
"\n",
"}",
"\n",
"}"
] |
15,384 | all-15385 | [
"GetStyleOk",
"returns",
"a",
"tuple",
"with",
"the",
"Style",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"h",
"*",
"HostmapDefinition",
")",
"GetStyleOk",
"(",
")",
"(",
"HostmapStyle",
",",
"bool",
")",
"{",
"if",
"h",
"==",
"nil",
"||",
"h",
".",
"Style",
"==",
"nil",
"{",
"return",
"HostmapStyle",
"{",
"}",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"h",
".",
"Style",
",",
"true",
"\n",
"}"
] |
15,385 | all-15386 | [
"actualScreenScale",
"must",
"be",
"called",
"from",
"the",
"main",
"thread",
"."
] | [
"func",
"(",
"u",
"*",
"UserInterface",
")",
"actualScreenScale",
"(",
")",
"float64",
"{",
"// Avoid calling monitor.GetPos if we have the monitor position cached already.",
"if",
"cm",
",",
"ok",
":=",
"getCachedMonitor",
"(",
"u",
".",
"window",
".",
"GetPos",
"(",
")",
")",
";",
"<mask>",
"{",
"return",
"u",
".",
"getScale",
"(",
")",
"*",
"devicescale",
".",
"GetAt",
"(",
"cm",
".",
"x",
",",
"cm",
".",
"y",
")",
"\n",
"}",
"\n",
"return",
"u",
".",
"getScale",
"(",
")",
"*",
"devicescale",
".",
"GetAt",
"(",
"u",
".",
"currentMonitor",
"(",
")",
".",
"GetPos",
"(",
")",
")",
"\n",
"}"
] |
15,386 | all-15387 | [
"removeElement",
"is",
"used",
"to",
"remove",
"a",
"given",
"list",
"element",
"from",
"the",
"cache"
] | [
"func",
"(",
"c",
"*",
"LRU",
")",
"removeElement",
"(",
"e",
"*",
"list",
".",
"Element",
")",
"{",
"c",
".",
"evictList",
".",
"Remove",
"(",
"e",
")",
"\n",
"kv",
":=",
"e",
".",
"<mask>",
".",
"(",
"*",
"entry",
")",
"\n",
"delete",
"(",
"c",
".",
"items",
",",
"kv",
".",
"key",
")",
"\n",
"}"
] |
15,387 | all-15388 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"ResolveBlobParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoIo1",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
15,388 | all-15389 | [
"SetContentLength",
"sets",
"Content",
"-",
"Length",
"header",
"value",
".",
"Content",
"-",
"Length",
"may",
"be",
"negative",
":",
"-",
"1",
"means",
"Transfer",
"-",
"Encoding",
":",
"chunked",
".",
"-",
"2",
"means",
"Transfer",
"-",
"Encoding",
":",
"identity",
"."
] | [
"func",
"(",
"h",
"*",
"ResponseHeader",
")",
"SetContentLength",
"(",
"contentLength",
"int",
")",
"{",
"if",
"h",
".",
"mustSkipContentLength",
"(",
")",
"{",
"return",
"\n",
"}",
"\n",
"h",
".",
"contentLength",
"=",
"contentLength",
"\n",
"if",
"contentLength",
">=",
"0",
"{",
"h",
".",
"contentLengthBytes",
"=",
"AppendUint",
"(",
"h",
".",
"contentLengthBytes",
"[",
":",
"0",
"]",
",",
"contentLength",
")",
"\n",
"h",
".",
"h",
"=",
"delAllArgsBytes",
"(",
"h",
".",
"h",
",",
"strTransferEncoding",
")",
"\n",
"}",
"else",
"{",
"h",
".",
"contentLengthBytes",
"=",
"h",
".",
"contentLengthBytes",
"[",
":",
"0",
"]",
"\n",
"<mask>",
":=",
"strChunked",
"\n",
"if",
"contentLength",
"==",
"-",
"2",
"{",
"h",
".",
"SetConnectionClose",
"(",
")",
"\n",
"value",
"=",
"strIdentity",
"\n",
"}",
"\n",
"h",
".",
"h",
"=",
"setArgBytes",
"(",
"h",
".",
"h",
",",
"strTransferEncoding",
",",
"value",
",",
"argsHasValue",
")",
"\n",
"}",
"\n",
"}"
] |
15,389 | all-15390 | [
"UnmarshalJSON",
"is",
"a",
"Custom",
"Unmarshal",
"for",
"PrecisionT",
".",
"The",
"Datadog",
"API",
"can",
"return",
"1",
"(",
"int",
")",
"1",
"(",
"number",
"but",
"a",
"string",
"type",
")",
"or",
"something",
"like",
"100%",
"or",
"*",
"(",
"string",
")",
"."
] | [
"func",
"(",
"p",
"*",
"PrecisionT",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"var",
"precisionNum",
"json",
".",
"Number",
"\n",
"if",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"precisionNum",
")",
";",
"err",
"==",
"nil",
"{",
"*",
"p",
"=",
"PrecisionT",
"(",
"precisionNum",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"var",
"precisionStr",
"string",
"\n",
"if",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"precisionStr",
")",
";",
"err",
"==",
"nil",
"{",
"*",
"p",
"=",
"PrecisionT",
"(",
"precisionStr",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"<mask>",
"p0",
"PrecisionT",
"\n",
"*",
"p",
"=",
"p0",
"\n\n",
"return",
"err",
"\n",
"}"
] |
15,390 | all-15391 | [
"*",
"*",
"*",
"IsDir",
"reports",
"whether",
"if",
"the",
"named",
"file",
"is",
"a",
"directory",
"."
] | [
"func",
"IsDir",
"(",
"name",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"i",
",",
"err",
":=",
"NewInfo",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n",
"return",
"i",
".",
"IsDir",
"(",
")",
",",
"nil",
"\n",
"}"
] |
15,391 | all-15392 | [
"SetRange",
"is",
"a",
"wrapper",
"around",
"gtk_spin_button_set_range",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"SpinButton",
")",
"SetRange",
"(",
"<mask>",
",",
"max",
"float64",
")",
"{",
"C",
".",
"gtk_spin_button_set_range",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gdouble",
"(",
"min",
")",
",",
"C",
".",
"gdouble",
"(",
"max",
")",
")",
"\n",
"}"
] |
15,392 | all-15393 | [
"multiply",
"the",
"current",
"matrix",
"by",
"a",
"perspective",
"matrix"
] | [
"func",
"Frustum",
"(",
"left",
"float64",
",",
"right",
"float64",
",",
"bottom",
"float64",
",",
"top",
"float64",
",",
"zNear",
"float64",
",",
"zFar",
"float64",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpFrustum",
",",
"6",
",",
"uintptr",
"(",
"math",
".",
"Float64bits",
"(",
"left",
")",
")",
",",
"uintptr",
"(",
"math",
".",
"Float64bits",
"(",
"right",
")",
")",
",",
"uintptr",
"(",
"math",
".",
"Float64bits",
"(",
"<mask>",
")",
")",
",",
"uintptr",
"(",
"math",
".",
"Float64bits",
"(",
"top",
")",
")",
",",
"uintptr",
"(",
"math",
".",
"Float64bits",
"(",
"zNear",
")",
")",
",",
"uintptr",
"(",
"math",
".",
"Float64bits",
"(",
"zFar",
")",
")",
")",
"\n",
"}"
] |
15,393 | all-15394 | [
"GetMergeOperator",
"creates",
"a",
"new",
"MergeOperator",
"for",
"a",
"given",
"key",
"and",
"returns",
"a",
"pointer",
"to",
"it",
".",
"It",
"also",
"fires",
"off",
"a",
"goroutine",
"that",
"performs",
"a",
"compaction",
"using",
"the",
"merge",
"function",
"that",
"runs",
"periodically",
"as",
"specified",
"by",
"dur",
"."
] | [
"func",
"(",
"db",
"*",
"DB",
")",
"GetMergeOperator",
"(",
"key",
"[",
"]",
"byte",
",",
"f",
"MergeFunc",
",",
"dur",
"time",
".",
"Duration",
")",
"*",
"MergeOperator",
"{",
"op",
":=",
"&",
"MergeOperator",
"{",
"f",
":",
"f",
",",
"db",
":",
"<mask>",
",",
"key",
":",
"key",
",",
"closer",
":",
"y",
".",
"NewCloser",
"(",
"1",
")",
",",
"}",
"\n\n",
"go",
"op",
".",
"runCompactions",
"(",
"dur",
")",
"\n",
"return",
"op",
"\n",
"}"
] |
15,394 | all-15395 | [
"First",
"finds",
"the",
"first",
"element",
"by",
"CSS",
"selector",
"."
] | [
"func",
"(",
"s",
"*",
"selectable",
")",
"First",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"<mask>",
".",
"CSS",
",",
"selector",
")",
".",
"At",
"(",
"0",
")",
")",
"\n",
"}"
] |
15,395 | all-15396 | [
"HasTitle",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"Screenboard",
")",
"HasTitle",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"Title",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
15,396 | all-15397 | [
"HasFillMin",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TileDefStyle",
")",
"HasFillMin",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"FillMin",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
15,397 | all-15398 | [
"multiValid",
"is",
"a",
"batch",
"version",
"of",
"Key",
".",
"valid",
".",
"It",
"returns",
"an",
"error",
"not",
"a",
"[]",
"bool",
"."
] | [
"func",
"multiValid",
"(",
"key",
"[",
"]",
"*",
"Key",
")",
"error",
"{",
"invalid",
":=",
"false",
"\n",
"for",
"_",
",",
"k",
":=",
"<mask>",
"key",
"{",
"if",
"!",
"k",
".",
"valid",
"(",
")",
"{",
"invalid",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"!",
"invalid",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"err",
":=",
"make",
"(",
"appengine",
".",
"MultiError",
",",
"len",
"(",
"key",
")",
")",
"\n",
"for",
"i",
",",
"k",
":=",
"range",
"key",
"{",
"if",
"!",
"k",
".",
"valid",
"(",
")",
"{",
"err",
"[",
"i",
"]",
"=",
"ErrInvalidKey",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
15,398 | all-15399 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"DeleteEntryParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCachestorage7",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
15,399 | all-15400 | [
"Shutdown",
"this",
"gateway",
"stopping",
"the",
"gRPC",
"server",
"and",
"possibly",
"the",
"raft",
"factory",
"."
] | [
"func",
"(",
"g",
"*",
"Gateway",
")",
"Shutdown",
"(",
")",
"error",
"{",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
")",
"\n\n",
"if",
"g",
".",
"raft",
"!=",
"nil",
"{",
"err",
":=",
"g",
".",
"raft",
".",
"Shutdown",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"g",
".",
"server",
"!=",
"nil",
"{",
"g",
".",
"Sync",
"(",
")",
"\n",
"g",
".",
"<mask>",
".",
"Close",
"(",
")",
"\n\n",
"// Unset the memory dial, since Shutdown() is also called for",
"// switching between in-memory and network mode.",
"g",
".",
"memoryDial",
"=",
"nil",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.