id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
17,000 | all-17001 | [
"SetSelectedRow",
"changes",
"the",
"currently",
"selected",
"row",
".",
"If",
"row",
"is",
"greater",
"than",
"number",
"of",
"row",
"the",
"last",
"row",
"is",
"selected",
".",
"Set",
"row",
"to",
"-",
"1",
"to",
"turn",
"off",
"selection",
".",
"The",
"table",
"scrolls",
"automatically",
"to",
"display",
"the",
"column"
]
| [
"func",
"(",
"l",
"*",
"TableView",
")",
"SetSelectedRow",
"(",
"<mask>",
"int",
")",
"{",
"oldSelection",
":=",
"l",
".",
"selectedRow",
"\n",
"if",
"row",
">=",
"l",
".",
"rowCount",
"{",
"l",
".",
"selectedRow",
"=",
"l",
".",
"rowCount",
"-",
"1",
"\n",
"}",
"else",
"if",
"row",
"<",
"-",
"1",
"{",
"l",
".",
"selectedRow",
"=",
"-",
"1",
"\n",
"}",
"\n\n",
"if",
"l",
".",
"selectedRow",
"!=",
"oldSelection",
"{",
"l",
".",
"EnsureRowVisible",
"(",
")",
"\n",
"l",
".",
"emitSelectionChange",
"(",
")",
"\n",
"}",
"\n",
"}"
]
|
17,001 | all-17002 | [
"SendMail",
"send",
"an",
"email"
]
| [
"func",
"(",
"s",
"*",
"SMTP",
")",
"SendMail",
"(",
"from",
"string",
",",
"to",
"[",
"]",
"string",
",",
"<mask>",
"[",
"]",
"byte",
")",
"(",
"err",
"error",
")",
"{",
"err",
"=",
"s",
".",
"send",
"(",
"s",
".",
"addr",
",",
"s",
".",
"auth",
",",
"from",
",",
"to",
",",
"msg",
")",
"\n",
"return",
"\n",
"}"
]
|
17,002 | all-17003 | [
"Replaces",
"all",
"different",
"kinds",
"of",
"apostrophes",
"with",
"a",
"single",
"kind",
":",
"--",
"that",
"is",
"\\",
"x27",
"or",
"unicode",
"codepoint",
"39",
"."
]
| [
"func",
"normalizeApostrophes",
"(",
"word",
"*",
"snowballword",
".",
"SnowballWord",
")",
"(",
"numSubstitutions",
"int",
")",
"{",
"for",
"i",
",",
"r",
":=",
"range",
"word",
".",
"RS",
"{",
"switch",
"r",
"{",
"// The rune is one of \"\\u2019\", \"\\u2018\", or \"\\u201B\";",
"// equivalently, unicode code points 8217, 8216, & 8219.",
"<mask>",
"8217",
",",
"8216",
",",
"8219",
":",
"// (Note: the unicode code point for ' is 39.)",
"word",
".",
"RS",
"[",
"i",
"]",
"=",
"39",
"\n",
"numSubstitutions",
"+=",
"1",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
]
|
17,003 | all-17004 | [
"ToGRPC",
"turns",
"an",
"error",
"into",
"a",
"gRPC",
"error"
]
| [
"func",
"ToGRPC",
"(",
"in",
"error",
")",
"error",
"{",
"if",
"err",
",",
"ok",
":=",
"in",
".",
"(",
"Error",
")",
";",
"ok",
"{",
"attrs",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"err",
".",
"Attributes",
"(",
")",
")",
"\n",
"return",
"grpc",
".",
"Errorf",
"(",
"err",
".",
"Type",
"(",
")",
".",
"GRPCCode",
"(",
")",
",",
"<mask>",
",",
"err",
".",
"Error",
"(",
")",
",",
"err",
".",
"Code",
"(",
")",
",",
"attrs",
")",
"\n",
"}",
"\n\n",
"return",
"grpc",
".",
"Errorf",
"(",
"codes",
".",
"Unknown",
",",
"in",
".",
"Error",
"(",
")",
")",
"\n",
"}"
]
|
17,004 | all-17005 | [
"ParseValue",
"parses",
"the",
"specified",
"bytes",
"into",
"a",
"Value",
"using",
"the",
"encoding",
"/",
"json",
"unmarshaller",
"."
]
| [
"func",
"ParseValue",
"(",
"src",
"[",
"]",
"byte",
")",
"*",
"Value",
"{",
"var",
"v",
"interface",
"{",
"}",
"\n",
"src",
"=",
"clean",
"(",
"src",
")",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"src",
",",
"&",
"v",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"&",
"Value",
"{",
"Data",
":",
"string",
"(",
"src",
")",
"}",
"\n",
"}",
"\n",
"return",
"&",
"<mask>",
"{",
"Data",
":",
"v",
"}",
"\n",
"}"
]
|
17,005 | all-17006 | [
"SetContentTypeBytes",
"sets",
"Content",
"-",
"Type",
"header",
"value",
"."
]
| [
"func",
"(",
"h",
"*",
"ResponseHeader",
")",
"SetContentTypeBytes",
"(",
"contentType",
"[",
"]",
"<mask>",
")",
"{",
"h",
".",
"contentType",
"=",
"append",
"(",
"h",
".",
"contentType",
"[",
":",
"0",
"]",
",",
"contentType",
"...",
")",
"\n",
"}"
]
|
17,006 | all-17007 | [
"An",
"encoder",
"is",
"an",
"io",
".",
"Writer",
"that",
"satisfies",
"writes",
"by",
"writing",
"PNG",
"IDAT",
"chunks",
"including",
"an",
"8",
"-",
"byte",
"header",
"and",
"4",
"-",
"byte",
"CRC",
"checksum",
"per",
"Write",
"call",
".",
"Such",
"calls",
"should",
"be",
"relatively",
"infrequent",
"since",
"writeIDATs",
"uses",
"a",
"bufio",
".",
"Writer",
".",
"This",
"method",
"should",
"only",
"be",
"called",
"from",
"writeIDATs",
"(",
"via",
"writeImage",
")",
".",
"No",
"other",
"code",
"should",
"treat",
"an",
"encoder",
"as",
"an",
"io",
".",
"Writer",
"."
]
| [
"func",
"(",
"e",
"*",
"encoder",
")",
"Write",
"(",
"b",
"[",
"]",
"<mask>",
")",
"(",
"int",
",",
"error",
")",
"{",
"e",
".",
"writeChunk",
"(",
"b",
",",
"\"",
"\"",
")",
"\n",
"if",
"e",
".",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"e",
".",
"err",
"\n",
"}",
"\n",
"return",
"len",
"(",
"b",
")",
",",
"nil",
"\n",
"}"
]
|
17,007 | all-17008 | [
"AgentPreServiceUnsuspend",
"marks",
"service",
"as",
"active",
"."
]
| [
"func",
"(",
"w",
"*",
"Worker",
")",
"AgentPreServiceUnsuspend",
"(",
"job",
"*",
"<mask>",
".",
"Job",
")",
"error",
"{",
"logger",
":=",
"w",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"job",
")",
"\n",
"_",
",",
"err",
":=",
"w",
".",
"agentUpdateServiceStatus",
"(",
"logger",
",",
"job",
",",
"data",
".",
"JobAgentPreServiceUnsuspend",
")",
"\n",
"return",
"err",
"\n",
"}"
]
|
17,008 | all-17009 | [
"UpdateBoard",
"takes",
"a",
"Board",
"struct",
"and",
"persists",
"it",
"back",
"to",
"the",
"server",
".",
"Use",
"this",
"if",
"you",
"ve",
"updated",
"your",
"local",
"and",
"need",
"to",
"push",
"it",
"back",
"."
]
| [
"func",
"(",
"client",
"*",
"Client",
")",
"UpdateBoard",
"(",
"board",
"*",
"Board",
")",
"error",
"{",
"return",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"*",
"board",
".",
"<mask>",
")",
",",
"board",
",",
"nil",
")",
"\n",
"}"
]
|
17,009 | all-17010 | [
"GetStartIter",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_text_buffer_get_start_iter",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"TextBuffer",
")",
"GetStartIter",
"(",
")",
"*",
"TextIter",
"{",
"<mask>",
"iter",
"C",
".",
"GtkTextIter",
"\n",
"C",
".",
"gtk_text_buffer_get_start_iter",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"iter",
")",
"\n",
"return",
"(",
"*",
"TextIter",
")",
"(",
"&",
"iter",
")",
"\n",
"}"
]
|
17,010 | all-17011 | [
"Status",
"returns",
"the",
"server",
"s",
"status",
"."
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"Status",
"(",
")",
"(",
"Status",
",",
"error",
")",
"{",
"span",
":=",
"c",
".",
"tracer",
".",
"StartSpan",
"(",
"\"",
"\"",
")",
"\n",
"defer",
"span",
".",
"Finish",
"(",
")",
"\n\n",
"_",
",",
"data",
",",
"err",
":=",
"c",
".",
"httpRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"nil",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"Status",
"{",
"}",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"status",
":=",
"Status",
"{",
"}",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"Status",
"{",
"}",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"status",
",",
"nil",
"\n",
"}"
]
|
17,011 | all-17012 | [
"Do",
"executes",
"Runtime",
".",
"setMaxCallStackSizeToCapture",
"against",
"the",
"provided",
"context",
"."
]
| [
"func",
"(",
"p",
"*",
"SetMaxCallStackSizeToCaptureParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetMaxCallStackSizeToCapture",
",",
"p",
",",
"nil",
")",
"\n",
"}"
]
|
17,012 | all-17013 | [
"PutDirHeaderFooter",
"implements",
"the",
"hashtree",
".",
"PutDirHeaderFooter",
"interface",
"method"
]
| [
"func",
"(",
"h",
"*",
"dbHashTree",
")",
"PutDirHeaderFooter",
"(",
"path",
"string",
",",
"header",
",",
"footer",
"*",
"pfs",
".",
"Object",
",",
"headerSize",
",",
"footerSize",
"int64",
")",
"error",
"{",
"path",
"=",
"clean",
"(",
"path",
")",
"\n",
"return",
"h",
".",
"Batch",
"(",
"func",
"(",
"tx",
"*",
"bolt",
".",
"Tx",
")",
"error",
"{",
"// validation: 'path' must point to directory (or nothing--may not be",
"// created yet)",
"node",
",",
"err",
":=",
"get",
"(",
"tx",
",",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"Code",
"(",
"err",
")",
"!=",
"PathNotFound",
"{",
"return",
"errorf",
"(",
"Internal",
",",
"\"",
"\"",
",",
"path",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"node",
"!=",
"nil",
"&&",
"node",
".",
"nodetype",
"(",
")",
"!=",
"directory",
"{",
"return",
"errorf",
"(",
"PathConflict",
",",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"path",
",",
"node",
".",
"nodetype",
"(",
")",
")",
"\n",
"}",
"\n\n",
"// Upsert directory at 'path' with 'Shared' field",
"var",
"newNode",
"bool",
"\n",
"if",
"<mask>",
"==",
"nil",
"{",
"newNode",
"=",
"true",
"\n",
"node",
"=",
"&",
"NodeProto",
"{",
"Name",
":",
"base",
"(",
"path",
")",
",",
"DirNode",
":",
"&",
"DirectoryNodeProto",
"{",
"Shared",
":",
"&",
"Shared",
"{",
"}",
",",
"}",
",",
"// header/footer size are also stored in Shared (for CopyFile) but",
"// adding it here makes size calculation in canonicalize() work",
"SubtreeSize",
":",
"headerSize",
"+",
"footerSize",
",",
"}",
"\n",
"}",
"\n\n",
"// only write node to db if the node is new, or the header or footer",
"// changed",
"headerSame",
":=",
"(",
"node",
".",
"DirNode",
".",
"Shared",
".",
"Header",
"==",
"nil",
"&&",
"header",
"==",
"nil",
")",
"||",
"(",
"node",
".",
"DirNode",
".",
"Shared",
".",
"Header",
"!=",
"nil",
"&&",
"node",
".",
"DirNode",
".",
"Shared",
".",
"Header",
".",
"Hash",
"==",
"header",
".",
"Hash",
")",
"\n",
"footerSame",
":=",
"(",
"node",
".",
"DirNode",
".",
"Shared",
".",
"Footer",
"==",
"nil",
"&&",
"footer",
"==",
"nil",
")",
"||",
"(",
"node",
".",
"DirNode",
".",
"Shared",
".",
"Footer",
"!=",
"nil",
"&&",
"node",
".",
"DirNode",
".",
"Shared",
".",
"Footer",
".",
"Hash",
"==",
"footer",
".",
"Hash",
")",
"\n",
"if",
"newNode",
"||",
"!",
"headerSame",
"||",
"!",
"footerSame",
"{",
"node",
".",
"DirNode",
".",
"Shared",
"=",
"&",
"Shared",
"{",
"Header",
":",
"header",
",",
"Footer",
":",
"footer",
",",
"HeaderSize",
":",
"headerSize",
",",
"FooterSize",
":",
"footerSize",
",",
"}",
"\n",
"return",
"put",
"(",
"tx",
",",
"path",
",",
"node",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
]
|
17,013 | all-17014 | [
"String",
"return",
"the",
"string",
"value",
"of",
"the",
"eniattachment",
"status"
]
| [
"func",
"(",
"eni",
"*",
"ENIAttachmentStatus",
")",
"<mask>",
"(",
")",
"string",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"eniAttachmentStatusMap",
"{",
"if",
"v",
"==",
"*",
"eni",
"{",
"return",
"k",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
]
|
17,014 | all-17015 | [
"Returns",
"the",
"relative",
"path",
"to",
"the",
"cgroup",
"docker",
"is",
"running",
"in",
"."
]
| [
"func",
"GetThisCgroupDir",
"(",
"subsystem",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"f",
",",
"err",
":=",
"<mask>",
".",
"Open",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"defer",
"f",
".",
"Close",
"(",
")",
"\n\n",
"return",
"ParseCgroupFile",
"(",
"subsystem",
",",
"f",
")",
"\n",
"}"
]
|
17,015 | all-17016 | [
"Close",
"closes",
"all",
"connections",
"stored",
"in",
"the",
"pool",
"it",
"returns",
"an",
"error",
"if",
"any",
"of",
"the",
"calls",
"to",
"Close",
"error",
"."
]
| [
"func",
"(",
"p",
"*",
"Pool",
")",
"Close",
"(",
")",
"error",
"{",
"close",
"(",
"p",
".",
"done",
")",
"\n",
"var",
"retErr",
"error",
"\n",
"for",
"_",
",",
"conn",
":=",
"range",
"p",
".",
"conns",
"{",
"if",
"conn",
".",
"<mask>",
"!=",
"nil",
"{",
"if",
"err",
":=",
"conn",
".",
"cc",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"retErr",
"=",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"retErr",
"\n",
"}"
]
|
17,016 | all-17017 | [
"NewSTMReadCommitted",
"is",
"deprecated",
"."
]
| [
"func",
"NewSTMReadCommitted",
"(",
"ctx",
"<mask>",
".",
"Context",
",",
"c",
"*",
"v3",
".",
"Client",
",",
"apply",
"func",
"(",
"STM",
")",
"error",
")",
"(",
"*",
"v3",
".",
"TxnResponse",
",",
"error",
")",
"{",
"return",
"NewSTM",
"(",
"c",
",",
"apply",
",",
"WithAbortContext",
"(",
"ctx",
")",
",",
"WithIsolation",
"(",
"ReadCommitted",
")",
")",
"\n",
"}"
]
|
17,017 | all-17018 | [
"RecordExecutionStoppedAt",
"checks",
"if",
"this",
"is",
"an",
"essential",
"container",
"stopped",
"and",
"set",
"the",
"task",
"executionStoppedAt",
"timestamps"
]
| [
"func",
"(",
"task",
"*",
"Task",
")",
"RecordExecutionStoppedAt",
"(",
"container",
"*",
"apicontainer",
".",
"Container",
")",
"{",
"if",
"!",
"container",
".",
"Essential",
"{",
"return",
"\n",
"}",
"\n",
"if",
"container",
".",
"GetKnownStatus",
"(",
")",
"!=",
"apicontainerstatus",
".",
"ContainerStopped",
"{",
"return",
"\n",
"}",
"\n",
"// If the essential container is stopped, set the ExecutionStoppedAt timestamp",
"now",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"ok",
":=",
"task",
".",
"SetExecutionStoppedAt",
"(",
"now",
")",
"\n",
"if",
"!",
"ok",
"{",
"// ExecutionStoppedAt was already recorded. Nothing to left to do here",
"return",
"\n",
"}",
"\n",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"task",
".",
"Arn",
",",
"container",
".",
"<mask>",
",",
"now",
".",
"String",
"(",
")",
")",
"\n",
"}"
]
|
17,018 | all-17019 | [
"WithExecutor",
"sets",
"the",
"message",
"executor",
"for",
"the",
"context",
"."
]
| [
"func",
"WithExecutor",
"(",
"parent",
"context",
".",
"Context",
",",
"executor",
"Executor",
")",
"context",
".",
"Context",
"{",
"return",
"<mask>",
".",
"WithValue",
"(",
"parent",
",",
"executorKey",
",",
"executor",
")",
"\n",
"}"
]
|
17,019 | all-17020 | [
"SetUseES",
"is",
"a",
"wrapper",
"around",
"gtk_gl_area_set_use_es",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"GLArea",
")",
"SetUseES",
"(",
"es",
"bool",
")",
"{",
"C",
".",
"gtk_gl_area_set_use_es",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"<mask>",
")",
")",
"\n",
"}"
]
|
17,020 | all-17021 | [
"Normalize",
"returns",
"a",
"new",
"sorted",
"and",
"compacted",
"FrameSet"
]
| [
"func",
"(",
"s",
"*",
"FrameSet",
")",
"Normalize",
"(",
")",
"*",
"FrameSet",
"{",
"ptr",
":=",
"s",
".",
"rangePtr",
".",
"Normalized",
"(",
")",
"\n",
"return",
"&",
"FrameSet",
"{",
"ptr",
".",
"<mask>",
"(",
")",
",",
"ptr",
"}",
"\n",
"}"
]
|
17,021 | all-17022 | [
"Repos",
"returns",
"a",
"collection",
"of",
"repos"
]
| [
"func",
"Repos",
"(",
"etcdClient",
"*",
"etcd",
".",
"Client",
",",
"etcdPrefix",
"string",
")",
"col",
".",
"<mask>",
"{",
"return",
"col",
".",
"NewCollection",
"(",
"etcdClient",
",",
"path",
".",
"Join",
"(",
"etcdPrefix",
",",
"reposPrefix",
")",
",",
"nil",
",",
"&",
"pfs",
".",
"RepoInfo",
"{",
"}",
",",
"nil",
",",
"nil",
",",
")",
"\n",
"}"
]
|
17,022 | all-17023 | [
"WriteInt64",
"writes",
"an",
"int64",
"."
]
| [
"func",
"(",
"w",
"*",
"Writer",
")",
"WriteInt64",
"(",
"i",
"int64",
")",
"{",
"if",
"w",
".",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"<mask>",
".",
"LittleEndian",
".",
"PutUint64",
"(",
"w",
".",
"b",
"[",
":",
"8",
"]",
",",
"uint64",
"(",
"i",
")",
")",
"\n",
"w",
".",
"wr",
".",
"Write",
"(",
"w",
".",
"b",
"[",
":",
"8",
"]",
")",
"\n",
"}"
]
|
17,023 | all-17024 | [
"Generate",
"one",
"password",
"that",
"meets",
"the",
"given",
"requirements"
]
| [
"func",
"NewPassword",
"(",
"reqs",
"*",
"PasswordStrengthRequirements",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"reqs",
"==",
"nil",
"{",
"reqs",
"=",
"&",
"Medium",
"\n",
"}",
"\n",
"if",
"ok",
",",
"problems",
":=",
"reqs",
".",
"sanityCheck",
"(",
")",
";",
"!",
"ok",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
"+",
"problems",
")",
"\n",
"}",
"\n",
"e",
":=",
"Garbler",
"{",
"}",
"\n",
"return",
"e",
".",
"<mask>",
"(",
"*",
"reqs",
")",
"\n",
"}"
]
|
17,024 | all-17025 | [
"ChecksumSize",
"returns",
"the",
"size",
"in",
"bytes",
"of",
"the",
"checksum",
"calculation"
]
| [
"func",
"(",
"t",
"ChecksumType",
")",
"ChecksumSize",
"(",
")",
"int",
"{",
"<mask>",
"t",
"{",
"case",
"ChecksumTypeNone",
":",
"return",
"0",
"\n",
"case",
"ChecksumTypeCrc32",
",",
"ChecksumTypeCrc32C",
":",
"return",
"crc32",
".",
"Size",
"\n",
"case",
"ChecksumTypeFarmhash",
":",
"return",
"4",
"\n",
"default",
":",
"return",
"0",
"\n",
"}",
"\n",
"}"
]
|
17,025 | all-17026 | [
"Extract",
"is",
"a",
"method",
"that",
"attempts",
"to",
"interpret",
"any",
"Swauth",
"authentication",
"response",
"as",
"a",
"AuthResult",
"struct",
"."
]
| [
"func",
"(",
"r",
"GetAuthResult",
")",
"Extract",
"(",
")",
"(",
"*",
"AuthResult",
",",
"error",
")",
"{",
"<mask>",
"s",
"*",
"AuthResult",
"\n",
"err",
":=",
"r",
".",
"ExtractInto",
"(",
"&",
"s",
")",
"\n",
"return",
"s",
",",
"err",
"\n",
"}"
]
|
17,026 | all-17027 | [
"String",
"adds",
"a",
"string",
"-",
"valued",
"key",
":",
"value",
"pair",
"to",
"a",
"Span",
".",
"LogFields",
"()",
"record"
]
| [
"func",
"String",
"(",
"key",
",",
"val",
"string",
")",
"Field",
"{",
"return",
"<mask>",
"{",
"key",
":",
"key",
",",
"fieldType",
":",
"stringType",
",",
"stringVal",
":",
"val",
",",
"}",
"\n",
"}"
]
|
17,027 | all-17028 | [
"NewDiscovery",
"returns",
"a",
"new",
"EC2Discovery",
"which",
"periodically",
"refreshes",
"its",
"targets",
"."
]
| [
"func",
"NewDiscovery",
"(",
"conf",
"*",
"SDConfig",
",",
"logger",
"log",
".",
"Logger",
")",
"*",
"Discovery",
"{",
"creds",
":=",
"credentials",
".",
"NewStaticCredentials",
"(",
"conf",
".",
"AccessKey",
",",
"string",
"(",
"conf",
".",
"SecretKey",
")",
",",
"\"",
"\"",
")",
"\n",
"if",
"conf",
".",
"AccessKey",
"==",
"\"",
"\"",
"&&",
"conf",
".",
"SecretKey",
"==",
"\"",
"\"",
"{",
"creds",
"=",
"nil",
"\n",
"}",
"\n",
"if",
"logger",
"==",
"nil",
"{",
"logger",
"=",
"log",
".",
"NewNopLogger",
"(",
")",
"\n",
"}",
"\n",
"d",
":=",
"&",
"Discovery",
"{",
"aws",
":",
"&",
"aws",
".",
"Config",
"{",
"Endpoint",
":",
"&",
"conf",
".",
"Endpoint",
",",
"Region",
":",
"&",
"conf",
".",
"Region",
",",
"Credentials",
":",
"creds",
",",
"}",
",",
"<mask>",
":",
"conf",
".",
"Profile",
",",
"roleARN",
":",
"conf",
".",
"RoleARN",
",",
"filters",
":",
"conf",
".",
"Filters",
",",
"interval",
":",
"time",
".",
"Duration",
"(",
"conf",
".",
"RefreshInterval",
")",
",",
"port",
":",
"conf",
".",
"Port",
",",
"}",
"\n",
"d",
".",
"Discovery",
"=",
"refresh",
".",
"NewDiscovery",
"(",
"logger",
",",
"\"",
"\"",
",",
"time",
".",
"Duration",
"(",
"conf",
".",
"RefreshInterval",
")",
",",
"d",
".",
"refresh",
",",
")",
"\n",
"return",
"d",
"\n",
"}"
]
|
17,028 | all-17029 | [
"GetV3EndpointID",
"returns",
"the",
"v3",
"endpoint",
"id",
"of",
"container"
]
| [
"func",
"(",
"c",
"*",
"Container",
")",
"GetV3EndpointID",
"(",
")",
"string",
"{",
"c",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"<mask>",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"c",
".",
"V3EndpointID",
"\n",
"}"
]
|
17,029 | all-17030 | [
"GetLeafApprovers",
"returns",
"a",
"map",
"from",
"ownersFiles",
"-",
">",
"people",
"that",
"are",
"approvers",
"in",
"them",
"(",
"only",
"the",
"leaf",
")"
]
| [
"func",
"(",
"o",
"Owners",
")",
"GetLeafApprovers",
"(",
")",
"map",
"[",
"string",
"]",
"sets",
".",
"String",
"{",
"ownersToApprovers",
":=",
"map",
"[",
"string",
"]",
"sets",
".",
"<mask>",
"{",
"}",
"\n\n",
"for",
"fn",
":=",
"range",
"o",
".",
"GetOwnersSet",
"(",
")",
"{",
"ownersToApprovers",
"[",
"fn",
"]",
"=",
"o",
".",
"repo",
".",
"LeafApprovers",
"(",
"fn",
")",
"\n",
"}",
"\n\n",
"return",
"ownersToApprovers",
"\n",
"}"
]
|
17,030 | all-17031 | [
"pull",
"performs",
"git",
"pull",
"or",
"git",
"clone",
"if",
"repository",
"does",
"not",
"exist",
"."
]
| [
"func",
"(",
"r",
"*",
"Repo",
")",
"pull",
"(",
")",
"error",
"{",
"// if not pulled, perform clone",
"if",
"!",
"r",
".",
"pulled",
"{",
"return",
"r",
".",
"clone",
"(",
")",
"\n",
"}",
"\n\n",
"// if latest tag config is set",
"if",
"r",
".",
"Branch",
"==",
"latestTag",
"{",
"return",
"r",
".",
"checkoutLatestTag",
"(",
")",
"\n",
"}",
"\n\n",
"params",
":=",
"append",
"(",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"append",
"(",
"r",
".",
"PullArgs",
",",
"\"",
"\"",
",",
"r",
".",
"Branch",
")",
"...",
")",
"\n",
"var",
"err",
"error",
"\n",
"if",
"err",
"=",
"r",
".",
"gitCmd",
"(",
"params",
",",
"r",
".",
"<mask>",
")",
";",
"err",
"==",
"nil",
"{",
"r",
".",
"pulled",
"=",
"true",
"\n",
"r",
".",
"lastPull",
"=",
"time",
".",
"Now",
"(",
")",
"\n",
"Logger",
"(",
")",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"r",
".",
"URL",
")",
"\n",
"r",
".",
"lastCommit",
",",
"err",
"=",
"r",
".",
"mostRecentCommit",
"(",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
]
|
17,031 | all-17032 | [
"TextStyle",
"styles",
"the",
"given",
"string",
"using",
"the",
"desired",
"text",
"style",
"."
]
| [
"func",
"(",
"t",
"TextStyle",
")",
"TextStyle",
"(",
"val",
"string",
")",
"string",
"{",
"if",
"t",
"==",
"emptyTextStyle",
"{",
"return",
"val",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"t",
".",
"<mask>",
",",
"val",
",",
"t",
".",
"stop",
")",
"\n",
"}"
]
|
17,032 | all-17033 | [
"Finds",
"box",
"vertices"
]
| [
"func",
"(",
"box",
"*",
"Box2D",
")",
"Points",
"(",
")",
"[",
"]",
"Point2D32f",
"{",
"var",
"pts",
"[",
"4",
"]",
"C",
".",
"CvPoint2D32f",
"\n",
"C",
".",
"cvBoxPoints",
"(",
"box",
".",
"CVBox",
"(",
")",
",",
"(",
"*",
"C",
".",
"CvPoint2D32f",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"pts",
"[",
"0",
"]",
")",
")",
",",
")",
"\n",
"outPts",
":=",
"make",
"(",
"[",
"]",
"Point2D32f",
",",
"4",
")",
"\n",
"for",
"i",
",",
"p",
":=",
"<mask>",
"pts",
"{",
"outPts",
"[",
"i",
"]",
".",
"X",
"=",
"float32",
"(",
"p",
".",
"x",
")",
"\n",
"outPts",
"[",
"i",
"]",
".",
"Y",
"=",
"float32",
"(",
"p",
".",
"y",
")",
"\n",
"}",
"\n",
"return",
"outPts",
"\n",
"}"
]
|
17,033 | all-17034 | [
"Heartbeat",
"endpoint",
"middleware",
"useful",
"to",
"setting",
"up",
"a",
"path",
"like",
"/",
"ping",
"that",
"load",
"balancers",
"or",
"uptime",
"testing",
"external",
"services",
"can",
"make",
"a",
"request",
"before",
"hitting",
"any",
"routes",
".",
"It",
"s",
"also",
"convenient",
"to",
"place",
"this",
"above",
"ACL",
"middlewares",
"as",
"well",
"."
]
| [
"func",
"Heartbeat",
"(",
"endpoint",
"string",
")",
"func",
"(",
"http",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"f",
":=",
"func",
"(",
"h",
"http",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"fn",
":=",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"if",
"r",
".",
"Method",
"==",
"\"",
"\"",
"&&",
"strings",
".",
"EqualFold",
"(",
"r",
".",
"URL",
".",
"<mask>",
",",
"endpoint",
")",
"{",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusOK",
")",
"\n",
"w",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
")",
"\n",
"return",
"\n",
"}",
"\n",
"h",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"\n",
"return",
"http",
".",
"HandlerFunc",
"(",
"fn",
")",
"\n",
"}",
"\n",
"return",
"f",
"\n",
"}"
]
|
17,034 | all-17035 | [
"Watching",
"returns",
"a",
"list",
"of",
"the",
"files",
"being",
"watched",
"."
]
| [
"func",
"(",
"w",
"*",
"Watcher",
")",
"Watching",
"(",
")",
"(",
"paths",
"[",
"]",
"string",
")",
"{",
"paths",
"=",
"<mask>",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n",
"for",
"path",
",",
"_",
":=",
"range",
"w",
".",
"paths",
"{",
"paths",
"=",
"append",
"(",
"paths",
",",
"path",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
]
|
17,035 | all-17036 | [
"NewAPIAnalyzer",
"is",
"the",
"factory",
"method",
"for",
"APIAnalyzer",
"."
]
| [
"func",
"NewAPIAnalyzer",
"(",
"version",
",",
"clientName",
"string",
",",
"resources",
",",
"types",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"<mask>",
"{",
"}",
")",
"*",
"APIAnalyzer",
"{",
"return",
"&",
"APIAnalyzer",
"{",
"RawResources",
":",
"resources",
",",
"RawTypes",
":",
"types",
",",
"Version",
":",
"version",
",",
"ClientName",
":",
"clientName",
",",
"Registry",
":",
"NewTypeRegistry",
"(",
")",
",",
"}",
"\n",
"}"
]
|
17,036 | all-17037 | [
"NewPrivKeyLedgerSecp256k1",
"will",
"generate",
"a",
"new",
"key",
"and",
"store",
"the",
"public",
"key",
"for",
"later",
"use",
"."
]
| [
"func",
"NewPrivKeyLedgerSecp256k1",
"(",
"<mask>",
"DerivationPath",
")",
"(",
"PrivKey",
",",
"error",
")",
"{",
"var",
"pk",
"PrivKeyLedgerSecp256k1",
"\n",
"pk",
".",
"Path",
"=",
"path",
"\n",
"// cache the pubkey for later use",
"pubKey",
",",
"err",
":=",
"pk",
".",
"getPubKey",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"pk",
".",
"CachedPubKey",
"=",
"pubKey",
"\n",
"return",
"&",
"pk",
",",
"err",
"\n",
"}"
]
|
17,037 | all-17038 | [
"DescribeECSTagsForInstance",
"calls",
"DescribeTags",
"API",
"to",
"get",
"the",
"EC2",
"tags",
"of",
"the",
"instance",
"id",
"and",
"return",
"it",
"back",
"as",
"ECS",
"tags"
]
| [
"func",
"(",
"c",
"*",
"ClientImpl",
")",
"DescribeECSTagsForInstance",
"(",
"instanceID",
"string",
")",
"(",
"[",
"]",
"*",
"ecs",
".",
"Tag",
",",
"error",
")",
"{",
"describeTagsInput",
":=",
"ec2sdk",
".",
"DescribeTagsInput",
"{",
"Filters",
":",
"[",
"]",
"*",
"ec2sdk",
".",
"Filter",
"{",
"{",
"Name",
":",
"aws",
".",
"String",
"(",
"ResourceIDFilterName",
")",
",",
"Values",
":",
"[",
"]",
"*",
"string",
"{",
"aws",
".",
"String",
"(",
"instanceID",
")",
"}",
",",
"}",
",",
"{",
"Name",
":",
"aws",
".",
"String",
"(",
"ResourceTypeFilterName",
")",
",",
"Values",
":",
"[",
"]",
"*",
"string",
"{",
"aws",
".",
"<mask>",
"(",
"ResourceTypeFilterValueInstance",
")",
"}",
",",
"}",
",",
"}",
",",
"MaxResults",
":",
"aws",
".",
"Int64",
"(",
"InstanceMaxTagsNum",
")",
",",
"}",
"\n",
"res",
",",
"err",
":=",
"c",
".",
"client",
".",
"DescribeTags",
"(",
"&",
"describeTagsInput",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"seelog",
".",
"Criticalf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"tags",
"[",
"]",
"*",
"ecs",
".",
"Tag",
"\n",
"// Convert ec2 tags to ecs tags",
"for",
"_",
",",
"ec2Tag",
":=",
"range",
"res",
".",
"Tags",
"{",
"// Filter out all tags \"aws:\" prefix",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"strings",
".",
"ToLower",
"(",
"aws",
".",
"StringValue",
"(",
"ec2Tag",
".",
"Key",
")",
")",
",",
"awsTagPrefix",
")",
"&&",
"!",
"strings",
".",
"HasPrefix",
"(",
"strings",
".",
"ToLower",
"(",
"aws",
".",
"StringValue",
"(",
"ec2Tag",
".",
"Value",
")",
")",
",",
"awsTagPrefix",
")",
"{",
"tags",
"=",
"append",
"(",
"tags",
",",
"&",
"ecs",
".",
"Tag",
"{",
"Key",
":",
"ec2Tag",
".",
"Key",
",",
"Value",
":",
"ec2Tag",
".",
"Value",
",",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"tags",
",",
"nil",
"\n",
"}"
]
|
17,038 | all-17039 | [
"Run",
"monitors",
"the",
"incoming",
"configuration",
"changes",
"to",
"determine",
"when",
"statuses",
"need",
"to",
"be",
"reconciled",
"on",
"PRs",
"in",
"flight",
"when",
"blocking",
"presubmits",
"change"
]
| [
"func",
"(",
"c",
"*",
"<mask>",
")",
"Run",
"(",
"stop",
"<-",
"chan",
"os",
".",
"Signal",
",",
"changes",
"<-",
"chan",
"config",
".",
"Delta",
")",
"{",
"for",
"{",
"select",
"{",
"case",
"change",
":=",
"<-",
"changes",
":",
"start",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"if",
"err",
":=",
"c",
".",
"reconcile",
"(",
"change",
")",
";",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"logrus",
".",
"WithField",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"time",
".",
"Since",
"(",
"start",
")",
")",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"case",
"<-",
"stop",
":",
"logrus",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
]
|
17,039 | all-17040 | [
"Write",
"will",
"return",
"true",
"when",
"this",
"operation",
"does",
"write",
"data",
"."
]
| [
"func",
"(",
"o",
"<mask>",
")",
"Write",
"(",
")",
"bool",
"{",
"return",
"o",
"==",
"Create",
"||",
"o",
"==",
"Update",
"||",
"o",
"==",
"Delete",
"\n",
"}"
]
|
17,040 | all-17041 | [
"StorageProgressWriter",
"reports",
"the",
"write",
"progress",
"."
]
| [
"func",
"StorageProgressWriter",
"(",
"op",
"*",
"operation",
",",
"key",
"string",
",",
"<mask>",
"string",
")",
"func",
"(",
"io",
".",
"WriteCloser",
")",
"io",
".",
"WriteCloser",
"{",
"return",
"func",
"(",
"writer",
"io",
".",
"WriteCloser",
")",
"io",
".",
"WriteCloser",
"{",
"if",
"op",
"==",
"nil",
"{",
"return",
"writer",
"\n",
"}",
"\n\n",
"progress",
":=",
"func",
"(",
"progressInt",
"int64",
",",
"speedInt",
"int64",
")",
"{",
"progressWrapperRender",
"(",
"op",
",",
"key",
",",
"description",
",",
"progressInt",
",",
"speedInt",
")",
"\n",
"}",
"\n\n",
"writePipe",
":=",
"&",
"ioprogress",
".",
"ProgressWriter",
"{",
"WriteCloser",
":",
"writer",
",",
"Tracker",
":",
"&",
"ioprogress",
".",
"ProgressTracker",
"{",
"Handler",
":",
"progress",
",",
"}",
",",
"}",
"\n\n",
"return",
"writePipe",
"\n",
"}",
"\n",
"}"
]
|
17,041 | all-17042 | [
"StartAt",
"restarts",
"mock",
"server",
"at",
"given",
"index",
"."
]
| [
"func",
"(",
"ms",
"*",
"MockServers",
")",
"StartAt",
"(",
"idx",
"int",
")",
"(",
"err",
"error",
")",
"{",
"ms",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ms",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"ms",
".",
"Servers",
"[",
"idx",
"]",
".",
"ln",
"==",
"nil",
"{",
"ms",
".",
"Servers",
"[",
"idx",
"]",
".",
"ln",
",",
"err",
"=",
"net",
".",
"Listen",
"(",
"ms",
".",
"Servers",
"[",
"idx",
"]",
".",
"Network",
",",
"ms",
".",
"Servers",
"[",
"idx",
"]",
".",
"Address",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"svr",
":=",
"grpc",
".",
"NewServer",
"(",
")",
"\n",
"pb",
".",
"RegisterKVServer",
"(",
"svr",
",",
"&",
"mockKVServer",
"{",
"}",
")",
"\n",
"ms",
".",
"Servers",
"[",
"idx",
"]",
".",
"GrpcServer",
"=",
"svr",
"\n\n",
"ms",
".",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"go",
"func",
"(",
"svr",
"*",
"grpc",
".",
"<mask>",
",",
"l",
"net",
".",
"Listener",
")",
"{",
"svr",
".",
"Serve",
"(",
"l",
")",
"\n",
"}",
"(",
"ms",
".",
"Servers",
"[",
"idx",
"]",
".",
"GrpcServer",
",",
"ms",
".",
"Servers",
"[",
"idx",
"]",
".",
"ln",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,042 | all-17043 | [
"GetHandleOk",
"returns",
"a",
"tuple",
"with",
"the",
"Handle",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"u",
"*",
"<mask>",
")",
"GetHandleOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"u",
"==",
"nil",
"||",
"u",
".",
"Handle",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"u",
".",
"Handle",
",",
"true",
"\n",
"}"
]
|
17,043 | all-17044 | [
"GetServerVersion",
"gets",
"the",
"server",
"*",
"Version",
"given",
"the",
"*",
"grpc",
".",
"ClientConn",
"."
]
| [
"func",
"GetServerVersion",
"(",
"clientConn",
"*",
"grpc",
".",
"ClientConn",
")",
"(",
"*",
"pb",
".",
"Version",
",",
"error",
")",
"{",
"return",
"pb",
".",
"NewAPIClient",
"(",
"clientConn",
")",
".",
"GetVersion",
"(",
"context",
".",
"Background",
"(",
")",
",",
"&",
"<mask>",
".",
"Empty",
"{",
"}",
",",
")",
"\n",
"}"
]
|
17,044 | all-17045 | [
"SetName",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_widget_set_name",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Widget",
")",
"SetName",
"(",
"name",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"<mask>",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_widget_set_name",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
]
|
17,045 | all-17046 | [
"manifestInstanceFromBlob",
"returns",
"a",
"genericManifest",
"implementation",
"for",
"(",
"manblob",
"mt",
")",
"in",
"src",
".",
"If",
"manblob",
"is",
"a",
"manifest",
"list",
"it",
"implicitly",
"chooses",
"an",
"appropriate",
"image",
"from",
"the",
"list",
"."
]
| [
"func",
"manifestInstanceFromBlob",
"(",
"ctx",
"context",
".",
"Context",
",",
"sys",
"*",
"types",
".",
"SystemContext",
",",
"src",
"types",
".",
"ImageSource",
",",
"manblob",
"[",
"]",
"byte",
",",
"mt",
"string",
")",
"(",
"genericManifest",
",",
"error",
")",
"{",
"switch",
"manifest",
".",
"NormalizedMIMEType",
"(",
"mt",
")",
"{",
"case",
"manifest",
".",
"DockerV2Schema1MediaType",
",",
"manifest",
".",
"DockerV2Schema1SignedMediaType",
":",
"return",
"manifestSchema1FromManifest",
"(",
"manblob",
")",
"\n",
"<mask>",
"imgspecv1",
".",
"MediaTypeImageManifest",
":",
"return",
"manifestOCI1FromManifest",
"(",
"src",
",",
"manblob",
")",
"\n",
"case",
"manifest",
".",
"DockerV2Schema2MediaType",
":",
"return",
"manifestSchema2FromManifest",
"(",
"src",
",",
"manblob",
")",
"\n",
"case",
"manifest",
".",
"DockerV2ListMediaType",
":",
"return",
"manifestSchema2FromManifestList",
"(",
"ctx",
",",
"sys",
",",
"src",
",",
"manblob",
")",
"\n",
"default",
":",
"// Note that this may not be reachable, manifest.NormalizedMIMEType has a default for unknown values.",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"mt",
")",
"\n",
"}",
"\n",
"}"
]
|
17,046 | all-17047 | [
"GetColorPreferenceOk",
"returns",
"a",
"tuple",
"with",
"the",
"ColorPreference",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetColorPreferenceOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"ColorPreference",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"ColorPreference",
",",
"true",
"\n",
"}"
]
|
17,047 | all-17048 | [
"VerifyProtoRepresenting",
"returns",
"a",
"handler",
"that",
"verifies",
"that",
"the",
"body",
"of",
"the",
"request",
"is",
"a",
"valid",
"protobuf",
"representation",
"of",
"the",
"passed",
"message",
".",
"VerifyProtoRepresenting",
"also",
"verifies",
"that",
"the",
"request",
"s",
"content",
"type",
"is",
"application",
"/",
"x",
"-",
"protobuf"
]
| [
"func",
"VerifyProtoRepresenting",
"(",
"expected",
"proto",
".",
"<mask>",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"CombineHandlers",
"(",
"VerifyContentType",
"(",
"\"",
"\"",
")",
",",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"body",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"req",
".",
"Body",
")",
"\n",
"Expect",
"(",
"err",
")",
".",
"ShouldNot",
"(",
"HaveOccurred",
"(",
")",
")",
"\n",
"req",
".",
"Body",
".",
"Close",
"(",
")",
"\n\n",
"expectedType",
":=",
"reflect",
".",
"TypeOf",
"(",
"expected",
")",
"\n",
"actualValuePtr",
":=",
"reflect",
".",
"New",
"(",
"expectedType",
".",
"Elem",
"(",
")",
")",
"\n\n",
"actual",
",",
"ok",
":=",
"actualValuePtr",
".",
"Interface",
"(",
")",
".",
"(",
"proto",
".",
"Message",
")",
"\n",
"Expect",
"(",
"ok",
")",
".",
"Should",
"(",
"BeTrue",
"(",
")",
",",
"\"",
"\"",
")",
"\n\n",
"err",
"=",
"proto",
".",
"Unmarshal",
"(",
"body",
",",
"actual",
")",
"\n",
"Expect",
"(",
"err",
")",
".",
"ShouldNot",
"(",
"HaveOccurred",
"(",
")",
",",
"\"",
"\"",
")",
"\n\n",
"Expect",
"(",
"actual",
")",
".",
"Should",
"(",
"Equal",
"(",
"expected",
")",
",",
"\"",
"\"",
")",
"\n",
"}",
",",
")",
"\n",
"}"
]
|
17,048 | all-17049 | [
"PipelineRepo",
"creates",
"a",
"pfs",
"repo",
"for",
"a",
"given",
"pipeline",
"."
]
| [
"func",
"PipelineRepo",
"(",
"pipeline",
"*",
"ppsclient",
".",
"Pipeline",
")",
"*",
"pfs",
".",
"Repo",
"{",
"return",
"&",
"pfs",
".",
"Repo",
"{",
"Name",
":",
"pipeline",
".",
"<mask>",
"}",
"\n",
"}"
]
|
17,049 | all-17050 | [
"HasMin",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"w",
"*",
"WidgetAxis",
")",
"HasMin",
"(",
")",
"bool",
"{",
"if",
"w",
"!=",
"nil",
"&&",
"w",
".",
"Min",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
]
|
17,050 | all-17051 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"DisableParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss57",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
17,051 | all-17052 | [
"WriteTo",
"writes",
"data",
"to",
"w",
"."
]
| [
"func",
"(",
"e",
"*",
"helperMethodInclude",
")",
"WriteTo",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"int64",
",",
"error",
")",
"{",
"<mask>",
"s",
"string",
"\n\n",
"if",
"e",
".",
"pipeline",
"==",
"\"",
"\"",
"{",
"s",
"=",
"fmt",
".",
"Sprintf",
"(",
"actionTemplate",
",",
"e",
".",
"opts",
".",
"DelimLeft",
",",
"e",
".",
"templateName",
",",
"e",
".",
"opts",
".",
"DelimRight",
")",
"\n",
"}",
"else",
"{",
"s",
"=",
"fmt",
".",
"Sprintf",
"(",
"actionTemplateWithPipeline",
",",
"e",
".",
"opts",
".",
"DelimLeft",
",",
"e",
".",
"templateName",
",",
"e",
".",
"pipeline",
",",
"e",
".",
"opts",
".",
"DelimRight",
")",
"\n",
"}",
"\n\n",
"i",
",",
"err",
":=",
"w",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"s",
")",
")",
"\n\n",
"return",
"int64",
"(",
"i",
")",
",",
"err",
"\n",
"}"
]
|
17,052 | all-17053 | [
"Create",
"creates",
"a",
"GCE",
"VM",
"instance",
"acting",
"as",
"a",
"docker",
"host",
"."
]
| [
"func",
"(",
"d",
"*",
"Driver",
")",
"Create",
"(",
")",
"error",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n\n",
"if",
"err",
":=",
"ssh",
".",
"GenerateSSHKey",
"(",
"d",
".",
"GetSSHKeyPath",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"<mask>",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n\n",
"c",
",",
"err",
":=",
"newComputeUtil",
"(",
"d",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"c",
".",
"openFirewallPorts",
"(",
"d",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"d",
".",
"UseExisting",
"{",
"return",
"c",
".",
"configureInstance",
"(",
"d",
")",
"\n",
"}",
"\n",
"return",
"c",
".",
"createInstance",
"(",
"d",
")",
"\n",
"}"
]
|
17,053 | all-17054 | [
"Adds",
"the",
"list",
"of",
"known",
"types",
"to",
"the",
"given",
"scheme",
"."
]
| [
"func",
"addKnownTypes",
"(",
"scheme",
"*",
"runtime",
".",
"Scheme",
")",
"error",
"{",
"scheme",
".",
"AddKnownTypes",
"(",
"SchemeGroupVersion",
",",
"&",
"App",
"{",
"}",
",",
"&",
"AppList",
"{",
"}",
",",
")",
"\n\n",
"scheme",
".",
"AddKnownTypes",
"(",
"SchemeGroupVersion",
",",
"&",
"metav1",
".",
"<mask>",
"{",
"}",
",",
")",
"\n",
"metav1",
".",
"AddToGroupVersion",
"(",
"scheme",
",",
"SchemeGroupVersion",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,054 | all-17055 | [
"ProfileRename",
"renames",
"the",
"profile",
"matching",
"the",
"given",
"key",
"parameters",
"."
]
| [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"ProfileRename",
"(",
"<mask>",
"string",
",",
"name",
"string",
",",
"to",
"string",
")",
"error",
"{",
"stmt",
":=",
"c",
".",
"stmt",
"(",
"profileRename",
")",
"\n",
"result",
",",
"err",
":=",
"stmt",
".",
"Exec",
"(",
"to",
",",
"project",
",",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"n",
",",
"err",
":=",
"result",
".",
"RowsAffected",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"n",
"!=",
"1",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"n",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,055 | all-17056 | [
"DeepCopyInto",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"writing",
"into",
"out",
".",
"in",
"must",
"be",
"non",
"-",
"nil",
"."
]
| [
"func",
"(",
"in",
"*",
"AppList",
")",
"DeepCopyInto",
"(",
"out",
"*",
"AppList",
")",
"{",
"*",
"out",
"=",
"*",
"in",
"\n",
"out",
".",
"TypeMeta",
"=",
"in",
".",
"TypeMeta",
"\n",
"out",
".",
"ListMeta",
"=",
"in",
".",
"ListMeta",
"\n",
"if",
"in",
".",
"Items",
"!=",
"nil",
"{",
"in",
",",
"out",
":=",
"&",
"in",
".",
"Items",
",",
"&",
"out",
".",
"Items",
"\n",
"*",
"out",
"=",
"make",
"(",
"[",
"]",
"App",
",",
"len",
"(",
"*",
"in",
")",
")",
"\n",
"for",
"i",
":=",
"range",
"*",
"<mask>",
"{",
"(",
"*",
"in",
")",
"[",
"i",
"]",
".",
"DeepCopyInto",
"(",
"&",
"(",
"*",
"out",
")",
"[",
"i",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
]
|
17,056 | all-17057 | [
"NewStream",
"creates",
"a",
"new",
"Stream",
"."
]
| [
"func",
"(",
"db",
"*",
"<mask>",
")",
"NewStream",
"(",
")",
"*",
"Stream",
"{",
"if",
"db",
".",
"opt",
".",
"managedTxns",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"db",
".",
"newStream",
"(",
")",
"\n",
"}"
]
|
17,057 | all-17058 | [
"Target",
"constructs",
"a",
"endpoint",
"target",
"using",
"the",
"endpoint",
"id",
"of",
"the",
"ResolverGroup",
"."
]
| [
"func",
"(",
"e",
"*",
"ResolverGroup",
")",
"Target",
"(",
"endpoint",
"string",
")",
"string",
"{",
"return",
"Target",
"(",
"e",
".",
"<mask>",
",",
"endpoint",
")",
"\n",
"}"
]
|
17,058 | all-17059 | [
"CreateConfig",
"creates",
"a",
"configuration",
"file",
"and",
"saves",
"it",
"to",
"the",
"file",
"at",
"the",
"given",
"path",
"."
]
| [
"func",
"CreateConfig",
"(",
"path",
"string",
")",
"error",
"{",
"config",
",",
"_",
":=",
"LoadConfig",
"(",
"path",
")",
"\n",
"var",
"emailDef",
",",
"passwordDef",
",",
"accountDef",
",",
"hostDef",
",",
"refreshTokenDef",
"string",
"\n",
"if",
"config",
"!=",
"nil",
"{",
"yn",
":=",
"PromptConfirmation",
"(",
"\"",
"\"",
",",
"path",
")",
"\n",
"if",
"yn",
"!=",
"\"",
"\"",
"{",
"PrintSuccess",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"emailDef",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"config",
".",
"Email",
")",
"\n",
"accountDef",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"config",
".",
"Account",
")",
"\n",
"passwordDef",
"=",
"\"",
"\"",
"\n",
"if",
"config",
".",
"LoginHost",
"==",
"\"",
"\"",
"{",
"config",
".",
"LoginHost",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"hostDef",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"config",
".",
"LoginHost",
")",
"\n",
"refreshTokenDef",
"=",
"\"",
"\"",
"\n",
"}",
"else",
"{",
"config",
"=",
"&",
"ClientConfig",
"{",
"}",
"\n",
"}",
"\n\n",
"fmt",
".",
"Fprintf",
"(",
"out",
",",
"\"",
"\"",
",",
"accountDef",
")",
"\n",
"var",
"newAccount",
"string",
"\n",
"fmt",
".",
"Fscanln",
"(",
"in",
",",
"&",
"newAccount",
")",
"\n",
"if",
"newAccount",
"!=",
"\"",
"\"",
"{",
"a",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"newAccount",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"newAccount",
")",
"\n",
"}",
"\n",
"config",
".",
"Account",
"=",
"a",
"\n",
"}",
"\n\n",
"fmt",
".",
"Fprintf",
"(",
"<mask>",
",",
"\"",
"\"",
",",
"emailDef",
")",
"\n",
"var",
"newEmail",
"string",
"\n",
"fmt",
".",
"Fscanln",
"(",
"in",
",",
"&",
"newEmail",
")",
"\n",
"if",
"newEmail",
"!=",
"\"",
"\"",
"{",
"config",
".",
"Email",
"=",
"newEmail",
"\n",
"}",
"\n\n",
"fmt",
".",
"Fprintf",
"(",
"out",
",",
"\"",
"\"",
",",
"passwordDef",
")",
"\n",
"var",
"newPassword",
"string",
"\n",
"fmt",
".",
"Fscanln",
"(",
"in",
",",
"&",
"newPassword",
")",
"\n",
"if",
"newPassword",
"!=",
"\"",
"\"",
"{",
"config",
".",
"Password",
"=",
"newPassword",
"\n",
"}",
"\n\n",
"fmt",
".",
"Fprintf",
"(",
"out",
",",
"\"",
"\"",
",",
"hostDef",
")",
"\n",
"var",
"newLoginHost",
"string",
"\n",
"fmt",
".",
"Fscanln",
"(",
"in",
",",
"&",
"newLoginHost",
")",
"\n",
"if",
"newLoginHost",
"!=",
"\"",
"\"",
"{",
"config",
".",
"LoginHost",
"=",
"newLoginHost",
"\n",
"}",
"\n\n",
"fmt",
".",
"Fprintf",
"(",
"out",
",",
"\"",
"\"",
",",
"refreshTokenDef",
")",
"\n",
"var",
"newRefreshToken",
"string",
"\n",
"fmt",
".",
"Fscanln",
"(",
"in",
",",
"&",
"newRefreshToken",
")",
"\n",
"if",
"newRefreshToken",
"!=",
"\"",
"\"",
"{",
"config",
".",
"RefreshToken",
"=",
"newRefreshToken",
"\n",
"}",
"\n\n",
"err",
":=",
"config",
".",
"Save",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
17,059 | all-17060 | [
"Query",
"returns",
"the",
"corresponding",
"github",
"search",
"string",
"for",
"the",
"tide",
"query",
"."
]
| [
"func",
"(",
"tq",
"*",
"TideQuery",
")",
"Query",
"(",
")",
"string",
"{",
"toks",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"\n",
"for",
"_",
",",
"o",
":=",
"range",
"tq",
".",
"Orgs",
"{",
"toks",
"=",
"append",
"(",
"toks",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"o",
")",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"tq",
".",
"Repos",
"{",
"toks",
"=",
"append",
"(",
"toks",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"r",
")",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"tq",
".",
"ExcludedRepos",
"{",
"toks",
"=",
"append",
"(",
"toks",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"r",
")",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"b",
":=",
"range",
"tq",
".",
"ExcludedBranches",
"{",
"toks",
"=",
"<mask>",
"(",
"toks",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"b",
")",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"b",
":=",
"range",
"tq",
".",
"IncludedBranches",
"{",
"toks",
"=",
"append",
"(",
"toks",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"b",
")",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"l",
":=",
"range",
"tq",
".",
"Labels",
"{",
"toks",
"=",
"append",
"(",
"toks",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"l",
")",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"l",
":=",
"range",
"tq",
".",
"MissingLabels",
"{",
"toks",
"=",
"append",
"(",
"toks",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"l",
")",
")",
"\n",
"}",
"\n",
"if",
"tq",
".",
"Milestone",
"!=",
"\"",
"\"",
"{",
"toks",
"=",
"append",
"(",
"toks",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"tq",
".",
"Milestone",
")",
")",
"\n",
"}",
"\n",
"if",
"tq",
".",
"ReviewApprovedRequired",
"{",
"toks",
"=",
"append",
"(",
"toks",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"toks",
",",
"\"",
"\"",
")",
"\n",
"}"
]
|
17,060 | all-17061 | [
"MarshalJSON",
"just",
"inserts",
"the",
"contents",
"of",
"the",
"file",
"from",
"disk",
"inline",
"into",
"the",
"json"
]
| [
"func",
"(",
"f",
"*",
"FileUpload",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"b",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"f",
".",
"Reader",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"json",
".",
"Marshal",
"(",
"string",
"(",
"b",
")",
")",
"\n",
"}"
]
|
17,061 | all-17062 | [
"Stop",
"a",
"host",
"gracefully"
]
| [
"func",
"(",
"d",
"*",
"SerialDriver",
")",
"Stop",
"(",
")",
"<mask>",
"{",
"d",
".",
"Lock",
"(",
")",
"\n",
"defer",
"d",
".",
"Unlock",
"(",
")",
"\n",
"return",
"d",
".",
"Driver",
".",
"Stop",
"(",
")",
"\n",
"}"
]
|
17,062 | all-17063 | [
"containsEmpty",
"is",
"a",
"helper",
"function",
"used",
"for",
"validation",
"(",
"particularly",
"for",
"validating",
"that",
"creds",
"arguments",
"aren",
"t",
"empty"
]
| [
"func",
"containsEmpty",
"(",
"vals",
"[",
"]",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"val",
":=",
"range",
"vals",
"{",
"if",
"val",
"==",
"\"",
"\"",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
]
|
17,063 | all-17064 | [
"Finalize",
"ensures",
"all",
"configuration",
"options",
"have",
"the",
"default",
"values",
"so",
"it",
"is",
"safe",
"to",
"dereference",
"the",
"pointers",
"later",
"down",
"the",
"line",
".",
"It",
"also",
"intelligently",
"tries",
"to",
"activate",
"stanzas",
"that",
"should",
"be",
"enabled",
"because",
"data",
"was",
"given",
"but",
"the",
"user",
"did",
"not",
"explicitly",
"add",
"Enabled",
":",
"true",
"to",
"the",
"configuration",
"."
]
| [
"func",
"(",
"c",
"*",
"Config",
")",
"Finalize",
"(",
")",
"{",
"if",
"c",
".",
"Consul",
"==",
"nil",
"{",
"c",
".",
"Consul",
"=",
"DefaultConsulConfig",
"(",
")",
"\n",
"}",
"\n",
"c",
".",
"Consul",
".",
"Finalize",
"(",
")",
"\n\n",
"if",
"c",
".",
"Dedup",
"==",
"nil",
"{",
"c",
".",
"Dedup",
"=",
"DefaultDedupConfig",
"(",
")",
"\n",
"}",
"\n",
"c",
".",
"Dedup",
".",
"Finalize",
"(",
")",
"\n\n",
"if",
"c",
".",
"Exec",
"==",
"nil",
"{",
"c",
".",
"Exec",
"=",
"DefaultExecConfig",
"(",
")",
"\n",
"}",
"\n",
"c",
".",
"Exec",
".",
"Finalize",
"(",
")",
"\n\n",
"if",
"c",
".",
"KillSignal",
"==",
"nil",
"{",
"c",
".",
"KillSignal",
"=",
"Signal",
"(",
"DefaultKillSignal",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"LogLevel",
"==",
"nil",
"{",
"c",
".",
"LogLevel",
"=",
"stringFromEnv",
"(",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"}",
",",
"DefaultLogLevel",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"MaxStale",
"==",
"nil",
"{",
"c",
".",
"MaxStale",
"=",
"TimeDuration",
"(",
"DefaultMaxStale",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"PidFile",
"==",
"nil",
"{",
"c",
".",
"PidFile",
"=",
"<mask>",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"ReloadSignal",
"==",
"nil",
"{",
"c",
".",
"ReloadSignal",
"=",
"Signal",
"(",
"DefaultReloadSignal",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"Syslog",
"==",
"nil",
"{",
"c",
".",
"Syslog",
"=",
"DefaultSyslogConfig",
"(",
")",
"\n",
"}",
"\n",
"c",
".",
"Syslog",
".",
"Finalize",
"(",
")",
"\n\n",
"if",
"c",
".",
"Templates",
"==",
"nil",
"{",
"c",
".",
"Templates",
"=",
"DefaultTemplateConfigs",
"(",
")",
"\n",
"}",
"\n",
"c",
".",
"Templates",
".",
"Finalize",
"(",
")",
"\n\n",
"if",
"c",
".",
"Vault",
"==",
"nil",
"{",
"c",
".",
"Vault",
"=",
"DefaultVaultConfig",
"(",
")",
"\n",
"}",
"\n",
"c",
".",
"Vault",
".",
"Finalize",
"(",
")",
"\n\n",
"if",
"c",
".",
"Wait",
"==",
"nil",
"{",
"c",
".",
"Wait",
"=",
"DefaultWaitConfig",
"(",
")",
"\n",
"}",
"\n",
"c",
".",
"Wait",
".",
"Finalize",
"(",
")",
"\n",
"}"
]
|
17,064 | all-17065 | [
"Do",
"executes",
"Overlay",
".",
"hideHighlight",
"against",
"the",
"provided",
"context",
"."
]
| [
"func",
"(",
"p",
"*",
"HideHighlightParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandHideHighlight",
",",
"nil",
",",
"nil",
")",
"\n",
"}"
]
|
17,065 | all-17066 | [
"SetProperty",
"is",
"a",
"wrapper",
"around",
"g_object_set_property",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Object",
")",
"SetProperty",
"(",
"name",
"string",
",",
"<mask>",
"interface",
"{",
"}",
")",
"error",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"value",
".",
"(",
"Object",
")",
";",
"ok",
"{",
"value",
"=",
"value",
".",
"(",
"Object",
")",
".",
"GObject",
"\n",
"}",
"\n\n",
"p",
",",
"err",
":=",
"GValue",
"(",
"value",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"C",
".",
"g_object_set_property",
"(",
"v",
".",
"GObject",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"p",
".",
"native",
"(",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,066 | all-17067 | [
"//////////////////////////////////////////"
]
| [
"func",
"(",
"b",
"*",
"Builder",
")",
"writeManifest",
"(",
")",
"error",
"{",
"upperId",
",",
"err",
":=",
"b",
".",
"upperTreeStoreId",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"attrMerger",
",",
"err",
":=",
"merger",
".",
"NewAttributesMerger",
"(",
"b",
".",
"stage1Rootfs",
"+",
"PATH_DGR",
"+",
"PATH_BUILDER",
",",
"PATH_ATTRIBUTES",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logs",
".",
"WithE",
"(",
"err",
")",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"attributes",
",",
"err",
":=",
"attrMerger",
".",
"Merge",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errs",
".",
"WithE",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"logs",
".",
"WithFields",
"(",
"b",
".",
"fields",
")",
".",
"WithField",
"(",
"\"",
"\"",
",",
"attributes",
")",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n\n",
"content",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"b",
".",
"aciTargetPath",
"+",
"common",
".",
"PathManifestYmlTmpl",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errs",
".",
"WithEF",
"(",
"err",
",",
"b",
".",
"fields",
".",
"WithField",
"(",
"\"",
"\"",
",",
"b",
".",
"aciTargetPath",
"+",
"common",
".",
"PathManifestYmlTmpl",
")",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"aciManifest",
",",
"err",
":=",
"common",
".",
"ProcessManifestTemplate",
"(",
"string",
"(",
"content",
")",
",",
"attributes",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errs",
".",
"WithEF",
"(",
"err",
",",
"b",
".",
"fields",
".",
"WithField",
"(",
"\"",
"\"",
",",
"string",
"(",
"content",
")",
")",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"target",
":=",
"b",
".",
"pod",
".",
"Root",
"+",
"PATH_OVERLAY",
"+",
"\"",
"\"",
"+",
"upperId",
"+",
"PATH_UPPER",
"+",
"common",
".",
"PathManifest",
"\n\n",
"dgrVersion",
",",
"ok",
":=",
"manifestApp",
"(",
"b",
".",
"pod",
")",
".",
"App",
".",
"Environment",
".",
"Get",
"(",
"common",
".",
"EnvDgrVersion",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"errs",
".",
"WithF",
"(",
"b",
".",
"fields",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"aciManifest",
".",
"NameAndVersion",
".",
"Version",
"(",
")",
"==",
"\"",
"\"",
"{",
"aciManifest",
".",
"NameAndVersion",
"=",
"*",
"<mask>",
".",
"NewACFullnameWithVersion",
"(",
"aciManifest",
".",
"NameAndVersion",
",",
"common",
".",
"GenerateVersion",
"(",
"b",
".",
"aciTargetPath",
")",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"b",
".",
"fillDependenciesFromBuilder",
"(",
"aciManifest",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"common",
".",
"WriteAciManifest",
"(",
"aciManifest",
",",
"target",
",",
"aciManifest",
".",
"NameAndVersion",
".",
"Name",
"(",
")",
",",
"dgrVersion",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errs",
".",
"WithEF",
"(",
"err",
",",
"b",
".",
"fields",
".",
"WithField",
"(",
"\"",
"\"",
",",
"target",
")",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,067 | all-17068 | [
"urlString",
"returns",
"a",
"valid",
"string",
"given",
"a",
"URL",
".",
"This",
"function",
"is",
"necessary",
"because",
"the",
"String",
"method",
"of",
"URL",
"doesn",
"t",
"correctly",
"handle",
"URLs",
"with",
"non",
"-",
"empty",
"Opaque",
"values",
".",
"See",
"http",
":",
"//",
"code",
".",
"google",
".",
"com",
"/",
"p",
"/",
"go",
"/",
"issues",
"/",
"detail?id",
"=",
"4860",
"."
]
| [
"func",
"urlString",
"(",
"u",
"*",
"<mask>",
".",
"URL",
")",
"string",
"{",
"if",
"u",
".",
"Opaque",
"==",
"\"",
"\"",
"||",
"strings",
".",
"HasPrefix",
"(",
"u",
".",
"Opaque",
",",
"\"",
"\"",
")",
"{",
"return",
"u",
".",
"String",
"(",
")",
"\n",
"}",
"\n",
"aux",
":=",
"*",
"u",
"\n",
"aux",
".",
"Opaque",
"=",
"\"",
"\"",
"+",
"aux",
".",
"Host",
"+",
"aux",
".",
"Opaque",
"\n",
"return",
"aux",
".",
"String",
"(",
")",
"\n",
"}"
]
|
17,068 | all-17069 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"EventFrameStoppedLoading",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage60",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
17,069 | all-17070 | [
"Step",
"1",
"is",
"the",
"stemming",
"of",
"various",
"endings",
"found",
"in",
"R1",
"including",
"heterna",
"ornas",
"and",
"andet",
"."
]
| [
"func",
"step1",
"(",
"w",
"*",
"snowballword",
".",
"SnowballWord",
")",
"bool",
"{",
"// Possible sufficies for this step, longest first.",
"suffixes",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"}",
"\n\n",
"// Using FirstSuffixIn since there are overlapping suffixes, where some might not be in the R1,",
"// while another might. For example: \"ärade\"",
"suffix",
",",
"suffixRunes",
":=",
"w",
".",
"FirstSuffixIn",
"(",
"w",
".",
"R1start",
",",
"len",
"(",
"w",
".",
"RS",
")",
",",
"suffixes",
"...",
")",
"\n\n",
"// If it is not in R1, do nothing",
"if",
"suffix",
"==",
"\"",
"\"",
"||",
"len",
"(",
"suffixRunes",
")",
">",
"len",
"(",
"w",
".",
"RS",
")",
"-",
"w",
".",
"R1start",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"if",
"suffix",
"==",
"\"",
"\"",
"{",
"// Delete if preceded by a valid s-ending. Valid s-endings inlude the",
"// following charaters: bcdfghjklmnoprtvy.",
"//",
"rsLen",
":=",
"len",
"(",
"w",
".",
"RS",
")",
"\n",
"if",
"rsLen",
">=",
"2",
"{",
"switch",
"w",
".",
"RS",
"[",
"rsLen",
"-",
"2",
"]",
"{",
"<mask>",
"'b'",
",",
"'c'",
",",
"'d'",
",",
"'f'",
",",
"'g'",
",",
"'h'",
",",
"'j'",
",",
"'k'",
",",
"'l'",
",",
"'m'",
",",
"'n'",
",",
"'o'",
",",
"'p'",
",",
"'r'",
",",
"'t'",
",",
"'v'",
",",
"'y'",
":",
"w",
".",
"RemoveLastNRunes",
"(",
"len",
"(",
"suffixRunes",
")",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}",
"\n",
"// Remove the suffix",
"w",
".",
"RemoveLastNRunes",
"(",
"len",
"(",
"suffixRunes",
")",
")",
"\n",
"return",
"true",
"\n",
"}"
]
|
17,070 | all-17071 | [
"Function",
"decorator",
"to",
"monitor",
"a",
"reflected",
"function"
]
| [
"func",
"(",
"m",
"*",
"Monitor",
")",
"MonitorReflectedFunc",
"(",
"section",
"string",
",",
"reflectedFunc",
"reflect",
".",
"<mask>",
",",
"args",
"[",
"]",
"reflect",
".",
"Value",
")",
"[",
"]",
"reflect",
".",
"Value",
"{",
"m",
".",
"Start",
"(",
"section",
")",
"\n",
"defer",
"m",
".",
"StopAndLog",
"(",
"section",
")",
"\n\n",
"return",
"reflectedFunc",
".",
"Call",
"(",
"args",
")",
"\n",
"}"
]
|
17,071 | all-17072 | [
"establish",
"the",
"data",
"storage",
"format",
"dimensions",
"and",
"number",
"of",
"samples",
"of",
"a",
"multisample",
"texture",
"s",
"image"
]
| [
"func",
"TexImage2DMultisample",
"(",
"target",
"uint32",
",",
"samples",
"int32",
",",
"internalformat",
"uint32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"fixedsamplelocations",
"bool",
")",
"{",
"C",
".",
"glowTexImage2DMultisample",
"(",
"gpTexImage2DMultisample",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"samples",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"internalformat",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLboolean",
")",
"(",
"boolToInt",
"(",
"fixedsamplelocations",
")",
")",
")",
"\n",
"}"
]
|
17,072 | all-17073 | [
"parseInt",
"treats",
"the",
"given",
"bytes",
"as",
"a",
"big",
"-",
"endian",
"signed",
"integer",
"and",
"returns",
"the",
"result",
"."
]
| [
"func",
"parseInt32",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"(",
"int32",
",",
"error",
")",
"{",
"if",
"err",
":=",
"checkInteger",
"(",
"bytes",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"ret64",
",",
"err",
":=",
"parseInt64",
"(",
"bytes",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"if",
"ret64",
"!=",
"int64",
"(",
"int32",
"(",
"ret64",
")",
")",
"{",
"return",
"0",
",",
"asn1",
".",
"StructuralError",
"{",
"Msg",
":",
"\"",
"\"",
"}",
"\n",
"}",
"\n",
"return",
"int32",
"(",
"ret64",
")",
",",
"nil",
"\n",
"}"
]
|
17,073 | all-17074 | [
"leaseListCommandFunc",
"executes",
"the",
"lease",
"list",
"command",
"."
]
| [
"func",
"leaseListCommandFunc",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"resp",
",",
"rerr",
":=",
"mustClientFromCmd",
"(",
"cmd",
")",
".",
"Leases",
"(",
"<mask>",
".",
"TODO",
"(",
")",
")",
"\n",
"if",
"rerr",
"!=",
"nil",
"{",
"ExitWithError",
"(",
"ExitBadConnection",
",",
"rerr",
")",
"\n",
"}",
"\n",
"display",
".",
"Leases",
"(",
"*",
"resp",
")",
"\n",
"}"
]
|
17,074 | all-17075 | [
"GetLogQuery",
"returns",
"the",
"LogQuery",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"h",
"*",
"HostmapRequest",
")",
"GetLogQuery",
"(",
")",
"WidgetApmOrLogQuery",
"{",
"if",
"h",
"==",
"nil",
"||",
"h",
".",
"LogQuery",
"==",
"nil",
"{",
"return",
"WidgetApmOrLogQuery",
"{",
"}",
"\n",
"}",
"\n",
"<mask>",
"*",
"h",
".",
"LogQuery",
"\n",
"}"
]
|
17,075 | all-17076 | [
"startACSSession",
"starts",
"a",
"session",
"with",
"ECS",
"s",
"Agent",
"Communication",
"service",
".",
"This",
"is",
"a",
"blocking",
"call",
"and",
"only",
"returns",
"when",
"the",
"handler",
"returns"
]
| [
"func",
"(",
"<mask>",
"*",
"ecsAgent",
")",
"startACSSession",
"(",
"credentialsManager",
"credentials",
".",
"Manager",
",",
"taskEngine",
"engine",
".",
"TaskEngine",
",",
"stateManager",
"statemanager",
".",
"StateManager",
",",
"deregisterInstanceEventStream",
"*",
"eventstream",
".",
"EventStream",
",",
"client",
"api",
".",
"ECSClient",
",",
"state",
"dockerstate",
".",
"TaskEngineState",
",",
"taskHandler",
"*",
"eventhandler",
".",
"TaskHandler",
")",
"int",
"{",
"acsSession",
":=",
"acshandler",
".",
"NewSession",
"(",
"agent",
".",
"ctx",
",",
"agent",
".",
"cfg",
",",
"deregisterInstanceEventStream",
",",
"agent",
".",
"containerInstanceARN",
",",
"agent",
".",
"credentialProvider",
",",
"client",
",",
"state",
",",
"stateManager",
",",
"taskEngine",
",",
"credentialsManager",
",",
"taskHandler",
",",
")",
"\n",
"seelog",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"err",
":=",
"acsSession",
".",
"Start",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"seelog",
".",
"Criticalf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"exitcodes",
".",
"ExitTerminal",
"\n",
"}",
"\n",
"seelog",
".",
"Critical",
"(",
"\"",
"\"",
")",
"\n",
"return",
"exitcodes",
".",
"ExitError",
"\n",
"}"
]
|
17,076 | all-17077 | [
"CONTRACT",
":",
"rv",
".",
"CanAddr",
"()",
"is",
"true",
"."
]
| [
"func",
"(",
"cdc",
"*",
"Codec",
")",
"decodeReflectJSONMap",
"(",
"bz",
"[",
"]",
"byte",
",",
"info",
"*",
"TypeInfo",
",",
"rv",
"reflect",
".",
"Value",
",",
"fopts",
"FieldOptions",
")",
"(",
"err",
"error",
")",
"{",
"if",
"!",
"rv",
".",
"CanAddr",
"(",
")",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"printLog",
"{",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"defer",
"func",
"(",
")",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"err",
")",
"\n",
"}",
"(",
")",
"\n",
"}",
"\n\n",
"// Map all the fields(keys) to their blobs/bytes.",
"// NOTE: In decodeReflectBinaryMap, we don't need to do this,",
"// since fields are encoded in order.",
"var",
"rawMap",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"json",
".",
"RawMessage",
")",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"bz",
",",
"&",
"rawMap",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"var",
"krt",
"=",
"rv",
".",
"Type",
"(",
")",
".",
"Key",
"(",
")",
"\n",
"if",
"krt",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"String",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"// TODO also support []byte and maybe others",
"\n",
"return",
"\n",
"}",
"\n",
"var",
"vinfo",
"*",
"TypeInfo",
"\n",
"vinfo",
",",
"err",
"=",
"cdc",
".",
"getTypeInfo_wlock",
"(",
"rv",
".",
"Type",
"(",
")",
".",
"Elem",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"var",
"mrv",
"=",
"reflect",
".",
"MakeMapWithSize",
"(",
"rv",
".",
"Type",
"(",
")",
",",
"len",
"(",
"rawMap",
")",
")",
"\n",
"for",
"<mask>",
",",
"valueBytes",
":=",
"range",
"rawMap",
"{",
"// Get map value rv.",
"vrv",
":=",
"reflect",
".",
"New",
"(",
"mrv",
".",
"Type",
"(",
")",
".",
"Elem",
"(",
")",
")",
".",
"Elem",
"(",
")",
"\n\n",
"// Decode valueBytes into vrv.",
"err",
"=",
"cdc",
".",
"decodeReflectJSON",
"(",
"valueBytes",
",",
"vinfo",
",",
"vrv",
",",
"fopts",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"// And set.",
"krv",
":=",
"reflect",
".",
"New",
"(",
"reflect",
".",
"TypeOf",
"(",
"\"",
"\"",
")",
")",
".",
"Elem",
"(",
")",
"\n",
"krv",
".",
"SetString",
"(",
"key",
")",
"\n",
"mrv",
".",
"SetMapIndex",
"(",
"krv",
",",
"vrv",
")",
"\n",
"}",
"\n",
"rv",
".",
"Set",
"(",
"mrv",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
17,077 | all-17078 | [
"PayloadSignature",
"returns",
"the",
"signature",
"that",
"matches",
"the",
"payload",
"."
]
| [
"func",
"PayloadSignature",
"(",
"payload",
"[",
"]",
"byte",
",",
"key",
"[",
"]",
"byte",
")",
"string",
"{",
"mac",
":=",
"hmac",
".",
"New",
"(",
"sha1",
".",
"New",
",",
"key",
")",
"\n",
"mac",
".",
"Write",
"(",
"payload",
")",
"\n",
"sum",
":=",
"<mask>",
".",
"Sum",
"(",
"nil",
")",
"\n",
"return",
"\"",
"\"",
"+",
"hex",
".",
"EncodeToString",
"(",
"sum",
")",
"\n",
"}"
]
|
17,078 | all-17079 | [
"MapStructureHookFunc",
"is",
"a",
"decode",
"hook",
"function",
"for",
"mapstructure"
]
| [
"func",
"(",
"f",
"*",
"defaultFormats",
")",
"MapStructureHookFunc",
"(",
")",
"mapstructure",
".",
"DecodeHookFunc",
"{",
"return",
"func",
"(",
"from",
"reflect",
".",
"Type",
",",
"to",
"reflect",
".",
"Type",
",",
"data",
"interface",
"{",
"}",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"if",
"from",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"<mask>",
"{",
"return",
"data",
",",
"nil",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"f",
".",
"data",
"{",
"tpe",
",",
"_",
":=",
"f",
".",
"GetType",
"(",
"v",
".",
"Name",
")",
"\n",
"if",
"to",
"==",
"tpe",
"{",
"switch",
"v",
".",
"Name",
"{",
"case",
"\"",
"\"",
":",
"d",
",",
"err",
":=",
"time",
".",
"Parse",
"(",
"RFC3339FullDate",
",",
"data",
".",
"(",
"string",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"Date",
"(",
"d",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"input",
":=",
"data",
".",
"(",
"string",
")",
"\n",
"if",
"len",
"(",
"input",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"ParseDateTime",
"(",
"input",
")",
"\n",
"case",
"\"",
"\"",
":",
"dur",
",",
"err",
":=",
"ParseDuration",
"(",
"data",
".",
"(",
"string",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"Duration",
"(",
"dur",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"URI",
"(",
"data",
".",
"(",
"string",
")",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"Email",
"(",
"data",
".",
"(",
"string",
")",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"UUID",
"(",
"data",
".",
"(",
"string",
")",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"UUID3",
"(",
"data",
".",
"(",
"string",
")",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"UUID4",
"(",
"data",
".",
"(",
"string",
")",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"UUID5",
"(",
"data",
".",
"(",
"string",
")",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"Hostname",
"(",
"data",
".",
"(",
"string",
")",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"IPv4",
"(",
"data",
".",
"(",
"string",
")",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"IPv6",
"(",
"data",
".",
"(",
"string",
")",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"CIDR",
"(",
"data",
".",
"(",
"string",
")",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"MAC",
"(",
"data",
".",
"(",
"string",
")",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"ISBN",
"(",
"data",
".",
"(",
"string",
")",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"ISBN10",
"(",
"data",
".",
"(",
"string",
")",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"ISBN13",
"(",
"data",
".",
"(",
"string",
")",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"CreditCard",
"(",
"data",
".",
"(",
"string",
")",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"SSN",
"(",
"data",
".",
"(",
"string",
")",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"HexColor",
"(",
"data",
".",
"(",
"string",
")",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"RGBColor",
"(",
"data",
".",
"(",
"string",
")",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"Base64",
"(",
"data",
".",
"(",
"string",
")",
")",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"Password",
"(",
"data",
".",
"(",
"string",
")",
")",
",",
"nil",
"\n",
"default",
":",
"return",
"nil",
",",
"errors",
".",
"InvalidTypeName",
"(",
"v",
".",
"Name",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"data",
",",
"nil",
"\n",
"}",
"\n",
"}"
]
|
17,079 | all-17080 | [
"LimitAndOffsetFromIncomingContext",
"gets",
"the",
"limit",
"and",
"offset",
"from",
"the",
"incoming",
"context"
]
| [
"func",
"LimitAndOffsetFromIncomingContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"<mask>",
",",
"offset",
"uint64",
",",
"err",
"error",
")",
"{",
"md",
":=",
"MetadataFromIncomingContext",
"(",
"ctx",
")",
"\n",
"limit",
",",
"err",
"=",
"LimitFromMetadata",
"(",
"md",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"0",
",",
"err",
"\n",
"}",
"\n",
"offset",
",",
"err",
"=",
"OffsetFromMetadata",
"(",
"md",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"0",
",",
"err",
"\n",
"}",
"\n",
"return",
"limit",
",",
"offset",
",",
"nil",
"\n",
"}"
]
|
17,080 | all-17081 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"Histogram",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser3",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
]
|
17,081 | all-17082 | [
"Send",
"sends",
"a",
"message",
"to",
"GCM",
"CCS",
"server",
"and",
"returns",
"the",
"number",
"of",
"bytes",
"written",
"and",
"any",
"error",
"encountered",
".",
"If",
"empty",
"message",
"ID",
"is",
"given",
"it",
"s",
"auto",
"-",
"generated",
"and",
"message",
"object",
"is",
"modified",
"with",
"the",
"generated",
"ID",
"."
]
| [
"func",
"(",
"c",
"*",
"Conn",
")",
"Send",
"(",
"m",
"*",
"OutMsg",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"if",
"m",
".",
"<mask>",
"==",
"\"",
"\"",
"{",
"if",
"m",
".",
"ID",
",",
"err",
"=",
"getMsgID",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"mb",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"m",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"ms",
":=",
"string",
"(",
"mb",
")",
"\n",
"res",
":=",
"fmt",
".",
"Sprintf",
"(",
"gcmMessageStanza",
",",
"ms",
")",
"\n",
"return",
"c",
".",
"xmppConn",
".",
"SendOrg",
"(",
"res",
")",
"\n",
"}"
]
|
17,082 | all-17083 | [
"NewSemaphore",
"is",
"used",
"to",
"create",
"a",
"new",
"semaphore",
"initalised",
"with",
"a",
"capacity",
"this",
"controls",
"the",
"number",
"of",
"locks",
"which",
"can",
"be",
"active",
"at",
"any",
"one",
"time",
"."
]
| [
"func",
"NewSemaphore",
"(",
"<mask>",
"int",
",",
"rampUp",
"time",
".",
"Duration",
")",
"*",
"Semaphore",
"{",
"s",
":=",
"Semaphore",
"{",
"lockDone",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"lockLock",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"rampUp",
":",
"rampUp",
",",
"}",
"\n\n",
"// if the rampup time is less than 1 then return immediately",
"if",
"rampUp",
"<",
"1",
"{",
"s",
".",
"s",
"=",
"make",
"(",
"chan",
"struct",
"{",
"}",
",",
"capacity",
")",
"\n",
"}",
"else",
"{",
"s",
".",
"s",
"=",
"make",
"(",
"chan",
"struct",
"{",
"}",
",",
"1",
")",
"\n",
"go",
"s",
".",
"rampUpThreads",
"(",
"capacity",
",",
"rampUp",
")",
"\n",
"}",
"\n\n",
"s",
".",
"resizeUnlock",
"(",
")",
"\n\n",
"return",
"&",
"s",
"\n",
"}"
]
|
17,083 | all-17084 | [
"NewPRSignedByKeyPath",
"returns",
"a",
"new",
"signedBy",
"PolicyRequirement",
"using",
"a",
"KeyPath"
]
| [
"func",
"NewPRSignedByKeyPath",
"(",
"keyType",
"sbKeyType",
",",
"keyPath",
"<mask>",
",",
"signedIdentity",
"PolicyReferenceMatch",
")",
"(",
"PolicyRequirement",
",",
"error",
")",
"{",
"return",
"newPRSignedByKeyPath",
"(",
"keyType",
",",
"keyPath",
",",
"signedIdentity",
")",
"\n",
"}"
]
|
17,084 | all-17085 | [
"EndpointZoneID",
"determines",
"zoneID",
"for",
"endpoint",
"from",
"map",
"[",
"zoneID",
"]",
"zoneName",
"by",
"taking",
"longest",
"suffix",
"zoneName",
"match",
"in",
"endpoint",
"DNSName",
"returns",
"empty",
"string",
"if",
"no",
"match",
"found"
]
| [
"func",
"(",
"f",
"*",
"filter",
")",
"EndpointZoneID",
"(",
"endpoint",
"*",
"endpoint",
".",
"Endpoint",
",",
"zones",
"<mask>",
"[",
"string",
"]",
"string",
")",
"(",
"zoneID",
"string",
")",
"{",
"var",
"matchZoneID",
",",
"matchZoneName",
"string",
"\n",
"for",
"zoneID",
",",
"zoneName",
":=",
"range",
"zones",
"{",
"if",
"strings",
".",
"HasSuffix",
"(",
"endpoint",
".",
"DNSName",
",",
"zoneName",
")",
"&&",
"len",
"(",
"zoneName",
")",
">",
"len",
"(",
"matchZoneName",
")",
"{",
"matchZoneName",
"=",
"zoneName",
"\n",
"matchZoneID",
"=",
"zoneID",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"matchZoneID",
"\n",
"}"
]
|
17,085 | all-17086 | [
"Do",
"executes",
"IndexedDB",
".",
"deleteDatabase",
"against",
"the",
"provided",
"context",
"."
]
| [
"func",
"(",
"p",
"*",
"DeleteDatabaseParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandDeleteDatabase",
",",
"p",
",",
"nil",
")",
"\n",
"}"
]
|
17,086 | all-17087 | [
"NewForConfigOrDie",
"creates",
"a",
"new",
"Clientset",
"for",
"the",
"given",
"config",
"and",
"panics",
"if",
"there",
"is",
"an",
"error",
"in",
"the",
"config",
"."
]
| [
"func",
"NewForConfigOrDie",
"(",
"c",
"*",
"rest",
".",
"Config",
")",
"*",
"Clientset",
"{",
"var",
"<mask>",
"Clientset",
"\n",
"cs",
".",
"tsuruV1",
"=",
"tsuruv1",
".",
"NewForConfigOrDie",
"(",
"c",
")",
"\n\n",
"cs",
".",
"DiscoveryClient",
"=",
"discovery",
".",
"NewDiscoveryClientForConfigOrDie",
"(",
"c",
")",
"\n",
"return",
"&",
"cs",
"\n",
"}"
]
|
17,087 | all-17088 | [
"Explore",
"returns",
"a",
"list",
"of",
"recommended",
"venues",
"near",
"the",
"current",
"location",
".",
"https",
":",
"//",
"developer",
".",
"foursquare",
".",
"com",
"/",
"docs",
"/",
"api",
"/",
"venues",
"/",
"explore"
]
| [
"func",
"(",
"s",
"*",
"VenueService",
")",
"Explore",
"(",
"params",
"*",
"VenueExploreParams",
")",
"(",
"*",
"VenueExploreResp",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"exploreResponse",
":=",
"new",
"(",
"VenueExploreResp",
")",
"\n",
"response",
":=",
"new",
"(",
"Response",
")",
"\n\n",
"resp",
",",
"err",
":=",
"s",
".",
"sling",
".",
"New",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"QueryStruct",
"(",
"params",
")",
".",
"Receive",
"(",
"response",
",",
"response",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"json",
".",
"Unmarshal",
"(",
"response",
".",
"Response",
",",
"exploreResponse",
")",
"\n",
"}",
"\n\n",
"return",
"exploreResponse",
",",
"resp",
",",
"relevantError",
"(",
"err",
",",
"*",
"<mask>",
")",
"\n",
"}"
]
|
17,088 | all-17089 | [
"Add",
"writes",
"the",
"given",
"item",
"if",
"no",
"value",
"already",
"exists",
"for",
"its",
"key",
".",
"ErrNotStored",
"is",
"returned",
"if",
"that",
"condition",
"is",
"not",
"met",
"."
]
| [
"func",
"Add",
"(",
"c",
"context",
".",
"Context",
",",
"item",
"*",
"Item",
")",
"error",
"{",
"return",
"singleError",
"(",
"<mask>",
"(",
"c",
",",
"[",
"]",
"*",
"Item",
"{",
"item",
"}",
",",
"nil",
",",
"pb",
".",
"MemcacheSetRequest_ADD",
")",
")",
"\n",
"}"
]
|
17,089 | all-17090 | [
"readResponse",
"reads",
"the",
"response",
"struct",
"into",
"resp",
"and",
"returns",
":",
"(",
"response",
"headers",
"whether",
"there",
"was",
"an",
"application",
"error",
"unexpected",
"error",
")",
"."
]
| [
"func",
"readResponse",
"(",
"response",
"*",
"tchannel",
".",
"OutboundCallResponse",
",",
"resp",
"thrift",
".",
"TStruct",
")",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"bool",
",",
"error",
")",
"{",
"reader",
",",
"err",
":=",
"response",
".",
"Arg2Reader",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"headers",
",",
"err",
":=",
"ReadHeaders",
"(",
"reader",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"argreader",
".",
"EnsureEmpty",
"(",
"reader",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"reader",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"success",
":=",
"!",
"response",
".",
"ApplicationError",
"(",
")",
"\n",
"reader",
",",
"err",
"=",
"response",
".",
"Arg3Reader",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"headers",
",",
"success",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"ReadStruct",
"(",
"reader",
",",
"resp",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"headers",
",",
"success",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"argreader",
".",
"EnsureEmpty",
"(",
"reader",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"headers",
",",
"<mask>",
",",
"reader",
".",
"Close",
"(",
")",
"\n",
"}"
]
|
17,090 | all-17091 | [
"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",
"*",
"putFileClient",
")",
"PutFileURL",
"(",
"repoName",
"string",
",",
"commitID",
"string",
",",
"path",
"string",
",",
"url",
"string",
",",
"recursive",
"bool",
",",
"overwrite",
"bool",
")",
"(",
"retErr",
"error",
")",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"var",
"overwriteIndex",
"*",
"pfs",
".",
"OverwriteIndex",
"\n",
"if",
"overwrite",
"{",
"overwriteIndex",
"=",
"&",
"pfs",
".",
"OverwriteIndex",
"{",
"}",
"\n",
"}",
"\n",
"if",
"c",
".",
"oneoff",
"{",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
":=",
"grpcutil",
".",
"ScrubGRPC",
"(",
"c",
".",
"Close",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"&&",
"retErr",
"==",
"nil",
"{",
"retErr",
"=",
"err",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"c",
".",
"c",
".",
"Send",
"(",
"&",
"pfs",
".",
"PutFileRequest",
"{",
"File",
":",
"NewFile",
"(",
"repoName",
",",
"commitID",
",",
"path",
")",
",",
"Url",
":",
"<mask>",
",",
"Recursive",
":",
"recursive",
",",
"OverwriteIndex",
":",
"overwriteIndex",
",",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,091 | all-17092 | [
"Values",
"returns",
"the",
"values",
"of",
"the",
"Set",
"in",
"an",
"unspecified",
"order",
"."
]
| [
"func",
"(",
"us",
"*",
"unsafeSet",
")",
"Values",
"(",
")",
"(",
"values",
"[",
"]",
"string",
")",
"{",
"values",
"=",
"<mask>",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n",
"for",
"val",
":=",
"range",
"us",
".",
"d",
"{",
"values",
"=",
"append",
"(",
"values",
",",
"val",
")",
"\n",
"}",
"\n",
"return",
"values",
"\n",
"}"
]
|
17,092 | all-17093 | [
"fetch",
"fetches",
"readBufferSize",
"bytes",
"starting",
"at",
"the",
"given",
"offset",
".",
"On",
"success",
"the",
"data",
"is",
"saved",
"as",
"r",
".",
"buf",
"."
]
| [
"func",
"(",
"r",
"*",
"reader",
")",
"fetch",
"(",
"off",
"int64",
")",
"error",
"{",
"req",
":=",
"&",
"blobpb",
".",
"FetchDataRequest",
"{",
"BlobKey",
":",
"proto",
".",
"<mask>",
"(",
"string",
"(",
"r",
".",
"blobKey",
")",
")",
",",
"StartIndex",
":",
"proto",
".",
"Int64",
"(",
"off",
")",
",",
"EndIndex",
":",
"proto",
".",
"Int64",
"(",
"off",
"+",
"readBufferSize",
"-",
"1",
")",
",",
"// EndIndex is inclusive.",
"}",
"\n",
"res",
":=",
"&",
"blobpb",
".",
"FetchDataResponse",
"{",
"}",
"\n",
"if",
"err",
":=",
"internal",
".",
"Call",
"(",
"r",
".",
"c",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"res",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"res",
".",
"Data",
")",
"==",
"0",
"{",
"return",
"io",
".",
"EOF",
"\n",
"}",
"\n",
"r",
".",
"buf",
",",
"r",
".",
"r",
",",
"r",
".",
"off",
"=",
"res",
".",
"Data",
",",
"0",
",",
"off",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,093 | all-17094 | [
"Enter",
"waits",
"for",
"count",
"processes",
"to",
"enter",
"the",
"barrier",
"then",
"returns"
]
| [
"func",
"(",
"b",
"*",
"DoubleBarrier",
")",
"Enter",
"(",
")",
"error",
"{",
"client",
":=",
"b",
".",
"s",
".",
"<mask>",
"(",
")",
"\n",
"ek",
",",
"err",
":=",
"newUniqueEphemeralKey",
"(",
"b",
".",
"s",
",",
"b",
".",
"key",
"+",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"b",
".",
"myKey",
"=",
"ek",
"\n\n",
"resp",
",",
"err",
":=",
"client",
".",
"Get",
"(",
"b",
".",
"ctx",
",",
"b",
".",
"key",
"+",
"\"",
"\"",
",",
"clientv3",
".",
"WithPrefix",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"resp",
".",
"Kvs",
")",
">",
"b",
".",
"count",
"{",
"return",
"ErrTooManyClients",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"resp",
".",
"Kvs",
")",
"==",
"b",
".",
"count",
"{",
"// unblock waiters",
"_",
",",
"err",
"=",
"client",
".",
"Put",
"(",
"b",
".",
"ctx",
",",
"b",
".",
"key",
"+",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"_",
",",
"err",
"=",
"WaitEvents",
"(",
"client",
",",
"b",
".",
"key",
"+",
"\"",
"\"",
",",
"ek",
".",
"Revision",
"(",
")",
",",
"[",
"]",
"mvccpb",
".",
"Event_EventType",
"{",
"mvccpb",
".",
"PUT",
"}",
")",
"\n",
"return",
"err",
"\n",
"}"
]
|
17,094 | all-17095 | [
"return",
"parameters",
"of",
"a",
"buffer",
"object"
]
| [
"func",
"GetNamedBufferParameteri64v",
"(",
"<mask>",
"uint32",
",",
"pname",
"uint32",
",",
"params",
"*",
"int64",
")",
"{",
"C",
".",
"glowGetNamedBufferParameteri64v",
"(",
"gpGetNamedBufferParameteri64v",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"buffer",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"pname",
")",
",",
"(",
"*",
"C",
".",
"GLint64",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"params",
")",
")",
")",
"\n",
"}"
]
|
17,095 | all-17096 | [
"NewMockProvider",
"creates",
"a",
"new",
"mock",
"instance"
]
| [
"func",
"NewMockProvider",
"(",
"ctrl",
"*",
"gomock",
".",
"<mask>",
")",
"*",
"MockProvider",
"{",
"mock",
":=",
"&",
"MockProvider",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockProviderMockRecorder",
"{",
"mock",
"}",
"\n",
"return",
"mock",
"\n",
"}"
]
|
17,096 | all-17097 | [
"UnmarshalText",
"hydrates",
"this",
"instance",
"from",
"text"
]
| [
"func",
"(",
"e",
"*",
"Email",
")",
"UnmarshalText",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"// validation is performed later on",
"*",
"e",
"=",
"Email",
"(",
"string",
"(",
"data",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,097 | all-17098 | [
"SendEventToChild",
"tries",
"to",
"find",
"a",
"child",
"control",
"that",
"should",
"recieve",
"the",
"evetn",
"For",
"mouse",
"click",
"events",
"it",
"looks",
"for",
"a",
"control",
"at",
"coordinates",
"of",
"event",
"makes",
"it",
"active",
"and",
"then",
"sends",
"the",
"event",
"to",
"it",
".",
"If",
"it",
"is",
"not",
"mouse",
"click",
"event",
"then",
"it",
"looks",
"for",
"the",
"first",
"active",
"child",
"and",
"sends",
"the",
"event",
"to",
"it",
"if",
"it",
"is",
"not",
"nil"
]
| [
"func",
"SendEventToChild",
"(",
"parent",
"Control",
",",
"ev",
"Event",
")",
"bool",
"{",
"var",
"child",
"Control",
"\n",
"if",
"IsMouseClickEvent",
"(",
"ev",
")",
"{",
"child",
"=",
"ChildAt",
"(",
"parent",
",",
"ev",
".",
"X",
",",
"ev",
".",
"Y",
")",
"\n",
"if",
"child",
"!=",
"nil",
"&&",
"!",
"child",
".",
"Active",
"(",
")",
"{",
"ActivateControl",
"(",
"parent",
",",
"child",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"child",
"=",
"ActiveControl",
"(",
"parent",
")",
"\n",
"}",
"\n\n",
"if",
"child",
"!=",
"nil",
"&&",
"child",
"!=",
"parent",
"{",
"ev",
".",
"Target",
"=",
"<mask>",
"\n",
"res",
":=",
"child",
".",
"ProcessEvent",
"(",
"ev",
")",
"\n\n",
"if",
"cparent",
":=",
"ClippedParent",
"(",
"child",
")",
";",
"cparent",
"!=",
"nil",
"&&",
"cparent",
"!=",
"child",
"{",
"cparent",
".",
"ProcessEvent",
"(",
"ev",
")",
"\n",
"}",
"\n\n",
"return",
"res",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
17,098 | all-17099 | [
"UnmarshalPrev",
"unmarshals",
"the",
"prev",
"item",
"in",
"an",
"event",
"into",
"a",
"protobuf",
"message",
"."
]
| [
"func",
"(",
"e",
"*",
"<mask>",
")",
"UnmarshalPrev",
"(",
"key",
"*",
"string",
",",
"val",
"proto",
".",
"Message",
")",
"error",
"{",
"if",
"err",
":=",
"CheckType",
"(",
"e",
".",
"Template",
",",
"val",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"*",
"key",
"=",
"string",
"(",
"e",
".",
"PrevKey",
")",
"\n",
"return",
"proto",
".",
"Unmarshal",
"(",
"e",
".",
"PrevValue",
",",
"val",
")",
"\n",
"}"
]
|
17,099 | all-17100 | [
"Returns",
"a",
"parameter",
"from",
"a",
"program",
"object"
]
| [
"func",
"GetProgramiv",
"(",
"<mask>",
"uint32",
",",
"pname",
"uint32",
",",
"params",
"*",
"int32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpGetProgramiv",
",",
"3",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"pname",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"params",
")",
")",
")",
"\n",
"}"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.