id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
13,800 | all-13801 | [
"UploadFile",
"uploads",
"the",
"provided",
"file",
"to",
"all",
"selected",
"<input",
"type",
"=",
"file",
"/",
">",
".",
"The",
"provided",
"filename",
"may",
"be",
"a",
"relative",
"or",
"absolute",
"path",
".",
"Returns",
"an",
"error",
"if",
"elements",
"of",
"any",
"other",
"type",
"are",
"in",
"the",
"selection",
"."
] | [
"func",
"(",
"s",
"*",
"Selection",
")",
"UploadFile",
"(",
"filename",
"string",
")",
"error",
"{",
"absFilePath",
",",
"err",
":=",
"filepath",
".",
"Abs",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"s",
".",
"forEachElement",
"(",
"func",
"(",
"selectedElement",
"<mask>",
".",
"Element",
")",
"error",
"{",
"tagName",
",",
"err",
":=",
"selectedElement",
".",
"GetName",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"tagName",
"!=",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
")",
"\n",
"}",
"\n",
"inputType",
",",
"err",
":=",
"selectedElement",
".",
"GetAttribute",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"inputType",
"!=",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"selectedElement",
".",
"Value",
"(",
"absFilePath",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
13,801 | all-13802 | [
"newGCSJobSource",
"creates",
"a",
"new",
"gcsJobSource",
"from",
"a",
"given",
"bucket",
"and",
"jobPrefix"
] | [
"func",
"newGCSJobSource",
"(",
"src",
"string",
")",
"(",
"*",
"gcsJobSource",
",",
"error",
")",
"{",
"gcsURL",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"src",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"&",
"gcsJobSource",
"{",
"}",
",",
"ErrCannotParseSource",
"\n",
"}",
"\n",
"gcsPath",
":=",
"&",
"gcs",
".",
"Path",
"{",
"}",
"\n",
"err",
"=",
"gcsPath",
".",
"SetURL",
"(",
"gcsURL",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"&",
"gcsJobSource",
"{",
"}",
",",
"ErrCannotParseSource",
"\n",
"}",
"\n\n",
"tokens",
":=",
"strings",
".",
"FieldsFunc",
"(",
"gcsPath",
".",
"Object",
"(",
")",
",",
"func",
"(",
"c",
"rune",
")",
"bool",
"{",
"return",
"c",
"==",
"'/'",
"}",
")",
"\n",
"if",
"len",
"(",
"tokens",
")",
"<",
"2",
"{",
"return",
"&",
"gcsJobSource",
"{",
"}",
",",
"ErrCannotParseSource",
"\n",
"}",
"\n",
"buildID",
":=",
"tokens",
"[",
"len",
"(",
"tokens",
")",
"-",
"1",
"]",
"\n",
"name",
":=",
"tokens",
"[",
"len",
"(",
"tokens",
")",
"-",
"2",
"]",
"\n",
"return",
"&",
"gcsJobSource",
"{",
"source",
":",
"src",
",",
"linkPrefix",
":",
"\"",
"\"",
",",
"bucket",
":",
"gcsPath",
".",
"Bucket",
"(",
")",
",",
"jobPrefix",
":",
"path",
".",
"Clean",
"(",
"gcsPath",
".",
"<mask>",
"(",
")",
")",
"+",
"\"",
"\"",
",",
"jobName",
":",
"name",
",",
"buildID",
":",
"buildID",
",",
"}",
",",
"nil",
"\n",
"}"
] |
13,802 | all-13803 | [
"SetDetailedActionName",
"is",
"a",
"wrapper",
"around",
"gtk_actionable_set_detailed_action_name",
"()",
".",
"Since",
"3",
".",
"4"
] | [
"func",
"(",
"v",
"*",
"Actionable",
")",
"SetDetailedActionName",
"(",
"detailed_action_name",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"detailed_action_name",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_actionable_set_detailed_action_name",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
13,803 | all-13804 | [
"addSSHKeys",
"will",
"start",
"the",
"ssh",
"-",
"agent",
"and",
"add",
"all",
"the",
"specified",
"keys",
"returning",
"the",
"ssh",
"-",
"agent",
"environment",
"variables",
"for",
"reuse"
] | [
"func",
"addSSHKeys",
"(",
"paths",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"vars",
",",
"err",
":=",
"exec",
".",
"Command",
"(",
"\"",
"\"",
")",
".",
"CombinedOutput",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"logrus",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"// ssh-agent will output three lines of text, in the form:",
"// SSH_AUTH_SOCK=xxx; export SSH_AUTH_SOCK;",
"// SSH_AGENT_PID=xxx; export SSH_AGENT_PID;",
"// echo Agent pid xxx;",
"// We need to parse out the environment variables from that.",
"parts",
":=",
"strings",
".",
"Split",
"(",
"string",
"(",
"vars",
")",
",",
"\"",
"\"",
")",
"\n",
"env",
":=",
"[",
"]",
"string",
"{",
"strings",
".",
"TrimSpace",
"(",
"parts",
"[",
"0",
"]",
")",
",",
"strings",
".",
"TrimSpace",
"(",
"parts",
"[",
"2",
"]",
")",
"}",
"\n",
"for",
"_",
",",
"keyPath",
":=",
"range",
"paths",
"{",
"// we can be given literal paths to keys or paths to dirs",
"// that are mounted from a secret, so we need to check which",
"// we have",
"if",
"err",
":=",
"filepath",
".",
"Walk",
"(",
"keyPath",
",",
"func",
"(",
"path",
"string",
",",
"info",
"os",
".",
"FileInfo",
",",
"err",
"error",
")",
"error",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"info",
".",
"Name",
"(",
")",
",",
"\"",
"\"",
")",
"{",
"// kubernetes volumes also include files we",
"// should not look be looking into for keys",
"if",
"info",
".",
"IsDir",
"(",
")",
"{",
"return",
"filepath",
".",
"SkipDir",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"info",
".",
"IsDir",
"(",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"cmd",
":=",
"<mask>",
".",
"Command",
"(",
"\"",
"\"",
",",
"path",
")",
"\n",
"cmd",
".",
"Env",
"=",
"append",
"(",
"cmd",
".",
"Env",
",",
"env",
"...",
")",
"\n",
"if",
"output",
",",
"err",
":=",
"cmd",
".",
"CombinedOutput",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"path",
",",
"err",
",",
"output",
")",
"\n",
"}",
"\n",
"logrus",
".",
"Infof",
"(",
"\"",
"\"",
",",
"path",
")",
"\n",
"return",
"nil",
"\n",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"env",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"keyPath",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"env",
",",
"nil",
"\n",
"}"
] |
13,804 | all-13805 | [
"currentContext",
"returns",
"kubectl",
"config",
"current",
"-",
"context"
] | [
"func",
"currentContext",
"(",
"o",
"options",
")",
"(",
"string",
",",
"error",
")",
"{",
"_",
",",
"cmd",
":=",
"<mask>",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"b",
",",
"err",
":=",
"cmd",
".",
"Output",
"(",
")",
"\n",
"return",
"strings",
".",
"TrimSpace",
"(",
"string",
"(",
"b",
")",
")",
",",
"err",
"\n",
"}"
] |
13,805 | all-13806 | [
"Return",
"a",
"generic",
"vertex",
"attribute",
"parameter"
] | [
"func",
"GetVertexAttribiv",
"(",
"<mask>",
"uint32",
",",
"pname",
"uint32",
",",
"params",
"*",
"int32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpGetVertexAttribiv",
",",
"3",
",",
"uintptr",
"(",
"index",
")",
",",
"uintptr",
"(",
"pname",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"params",
")",
")",
")",
"\n",
"}"
] |
13,806 | all-13807 | [
"SetDriverVersion",
"indicates",
"an",
"expected",
"call",
"of",
"SetDriverVersion"
] | [
"func",
"(",
"mr",
"*",
"MockGPUManagerMockRecorder",
")",
"SetDriverVersion",
"(",
"arg0",
"<mask>",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"MockGPUManager",
")",
"(",
"nil",
")",
".",
"SetDriverVersion",
")",
",",
"arg0",
")",
"\n",
"}"
] |
13,807 | all-13808 | [
"RequestID",
"is",
"a",
"middleware",
"that",
"injects",
"a",
"request",
"ID",
"into",
"the",
"context",
"of",
"each",
"request",
".",
"A",
"request",
"ID",
"is",
"a",
"string",
"of",
"the",
"form",
"host",
".",
"example",
".",
"com",
"/",
"random",
"-",
"0001",
"where",
"random",
"is",
"a",
"base62",
"random",
"string",
"that",
"uniquely",
"identifies",
"this",
"go",
"process",
"and",
"where",
"the",
"last",
"number",
"is",
"an",
"atomically",
"incremented",
"request",
"counter",
"."
] | [
"func",
"RequestID",
"(",
"next",
"http",
".",
"Handler",
")",
"<mask>",
".",
"Handler",
"{",
"fn",
":=",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"ctx",
":=",
"r",
".",
"Context",
"(",
")",
"\n",
"requestID",
":=",
"r",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"requestID",
"==",
"\"",
"\"",
"{",
"myid",
":=",
"atomic",
".",
"AddUint64",
"(",
"&",
"reqid",
",",
"1",
")",
"\n",
"requestID",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"prefix",
",",
"myid",
")",
"\n",
"}",
"\n",
"ctx",
"=",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"RequestIDKey",
",",
"requestID",
")",
"\n",
"next",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
".",
"WithContext",
"(",
"ctx",
")",
")",
"\n",
"}",
"\n",
"return",
"http",
".",
"HandlerFunc",
"(",
"fn",
")",
"\n",
"}"
] |
13,808 | all-13809 | [
"Iif",
"is",
"short",
"for",
"immediate",
"if",
".",
"If",
"condition",
"is",
"true",
"return",
"truthy",
"else",
"falsey",
"."
] | [
"func",
"Iif",
"(",
"condition",
"bool",
",",
"truthy",
"string",
",",
"falsey",
"string",
")",
"string",
"{",
"if",
"<mask>",
"{",
"return",
"truthy",
"\n",
"}",
"\n",
"return",
"falsey",
"\n",
"}"
] |
13,809 | all-13810 | [
"SetCreatedAt",
"sets",
"the",
"timestamp",
"for",
"resource",
"s",
"creation",
"time"
] | [
"func",
"(",
"auth",
"*",
"ASMAuthResource",
")",
"SetCreatedAt",
"(",
"createdAt",
"<mask>",
".",
"Time",
")",
"{",
"if",
"createdAt",
".",
"IsZero",
"(",
")",
"{",
"return",
"\n",
"}",
"\n",
"auth",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"auth",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"auth",
".",
"createdAt",
"=",
"createdAt",
"\n",
"}"
] |
13,810 | all-13811 | [
"SetFallbackLogger",
"sets",
"a",
"Logger",
"to",
"be",
"used",
"if",
"there",
"aren",
"t",
"any",
"loggers",
"added",
"or",
"any",
"of",
"the",
"added",
"loggers",
"are",
"in",
"a",
"degraded",
"or",
"unhealthy",
"state",
".",
"A",
"Logger",
"passed",
"to",
"SetFallbackLogger",
"will",
"be",
"initialized",
"if",
"it",
"hasn",
"t",
"been",
"already",
".",
"In",
"addition",
"if",
"the",
"Logger",
"fails",
"to",
"initialize",
"completely",
"the",
"fallback",
"logger",
"will",
"fail",
"to",
"be",
"set",
"."
] | [
"func",
"(",
"b",
"*",
"<mask>",
")",
"SetFallbackLogger",
"(",
"logger",
"Logger",
")",
"error",
"{",
"if",
"logger",
"==",
"nil",
"{",
"if",
"b",
".",
"fallbackLogger",
"!=",
"nil",
"&&",
"b",
".",
"fallbackLogger",
".",
"IsInitialized",
"(",
")",
"{",
"b",
".",
"fallbackLogger",
".",
"ShutdownLogger",
"(",
")",
"\n",
"}",
"\n",
"b",
".",
"fallbackLogger",
"=",
"nil",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"!",
"logger",
".",
"IsInitialized",
"(",
")",
"{",
"err",
":=",
"logger",
".",
"InitLogger",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Shut down any old logger we might already have a reference to",
"if",
"b",
".",
"fallbackLogger",
"!=",
"nil",
"&&",
"b",
".",
"fallbackLogger",
".",
"IsInitialized",
"(",
")",
"{",
"b",
".",
"fallbackLogger",
".",
"ShutdownLogger",
"(",
")",
"\n",
"}",
"\n\n",
"b",
".",
"fallbackLogger",
"=",
"logger",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
13,811 | all-13812 | [
"StreamClientInterceptor",
"applies",
"fn",
"to",
"errors",
"recieved",
"by",
"client",
"."
] | [
"func",
"StreamClientInterceptor",
"(",
"fn",
"ConvertFunc",
")",
"grpc",
".",
"StreamClientInterceptor",
"{",
"return",
"func",
"(",
"ctx",
"context",
".",
"Context",
",",
"desc",
"*",
"grpc",
".",
"StreamDesc",
",",
"cc",
"*",
"grpc",
".",
"ClientConn",
",",
"method",
"string",
",",
"streamer",
"grpc",
".",
"Streamer",
",",
"opts",
"...",
"grpc",
".",
"CallOption",
")",
"(",
"stream",
"grpc",
".",
"ClientStream",
",",
"err",
"error",
")",
"{",
"stream",
",",
"err",
"=",
"streamer",
"(",
"ctx",
",",
"desc",
",",
"cc",
",",
"<mask>",
",",
"opts",
"...",
")",
"\n",
"return",
"stream",
",",
"fn",
"(",
"err",
")",
"\n",
"}",
"\n",
"}"
] |
13,812 | all-13813 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"TypeProfileEntry",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoProfiler",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
13,813 | all-13814 | [
"RemoveFromTaskArray",
"removes",
"the",
"element",
"at",
"ndx",
"from",
"an",
"array",
"of",
"task",
"pointers",
"arr",
".",
"If",
"the",
"ndx",
"is",
"out",
"of",
"bounds",
"it",
"returns",
"arr",
"unchanged",
"."
] | [
"func",
"RemoveFromTaskArray",
"(",
"arr",
"[",
"]",
"*",
"Task",
",",
"ndx",
"int",
")",
"[",
"]",
"*",
"<mask>",
"{",
"if",
"ndx",
"<",
"0",
"||",
"ndx",
">=",
"len",
"(",
"arr",
")",
"{",
"return",
"arr",
"\n",
"}",
"\n",
"return",
"append",
"(",
"arr",
"[",
"0",
":",
"ndx",
"]",
",",
"arr",
"[",
"ndx",
"+",
"1",
":",
"]",
"...",
")",
"\n",
"}"
] |
13,814 | all-13815 | [
"Warnf",
"logging"
] | [
"func",
"(",
"l",
"*",
"StdLevelLogger",
")",
"Warnf",
"(",
"msg",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"l",
".",
"logfFunc",
"(",
"WarnLevel",
",",
"l",
".",
"context",
",",
"<mask>",
",",
"args",
"...",
")",
"\n",
"}"
] |
13,815 | all-13816 | [
"TriggerFor",
"finds",
"the",
"Trigger",
"for",
"a",
"repo",
"if",
"one",
"exists",
"a",
"trigger",
"can",
"be",
"listed",
"for",
"the",
"repo",
"itself",
"or",
"for",
"the",
"owning",
"organization"
] | [
"func",
"(",
"c",
"*",
"Configuration",
")",
"TriggerFor",
"(",
"org",
",",
"repo",
"string",
")",
"Trigger",
"{",
"for",
"_",
",",
"tr",
":=",
"range",
"c",
".",
"Triggers",
"{",
"for",
"_",
",",
"r",
":=",
"<mask>",
"tr",
".",
"Repos",
"{",
"if",
"r",
"==",
"org",
"||",
"r",
"==",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
")",
"{",
"return",
"tr",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"Trigger",
"{",
"}",
"\n",
"}"
] |
13,816 | all-13817 | [
"WithIsRegex",
"if",
"true",
"treats",
"string",
"parameter",
"as",
"regex",
"."
] | [
"func",
"(",
"p",
"SearchInContentParams",
")",
"WithIsRegex",
"(",
"isRegex",
"bool",
")",
"*",
"SearchInContentParams",
"{",
"p",
".",
"IsRegex",
"=",
"isRegex",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
13,817 | all-13818 | [
"ReceiveIssueEvent",
"computes",
"age",
"percentiles",
"and",
"saves",
"them",
"to",
"InfluxDB"
] | [
"func",
"(",
"s",
"*",
"StatePlugin",
")",
"ReceiveIssueEvent",
"(",
"event",
"sql",
".",
"IssueEvent",
")",
"[",
"]",
"Point",
"{",
"label",
":=",
"\"",
"\"",
"\n",
"if",
"event",
".",
"Label",
"!=",
"nil",
"{",
"label",
"=",
"*",
"event",
".",
"Label",
"\n",
"}",
"\n\n",
"if",
"!",
"s",
".",
"states",
".",
"ReceiveEvent",
"(",
"event",
".",
"IssueID",
",",
"event",
".",
"<mask>",
",",
"label",
",",
"event",
".",
"EventCreatedAt",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"total",
",",
"sum",
":=",
"s",
".",
"states",
".",
"Total",
"(",
"event",
".",
"EventCreatedAt",
")",
"\n",
"values",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"total",
",",
"\"",
"\"",
":",
"int",
"(",
"sum",
")",
",",
"}",
"\n",
"for",
"_",
",",
"percentile",
":=",
"range",
"s",
".",
"percentiles",
"{",
"values",
"[",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"percentile",
")",
"]",
"=",
"int",
"(",
"s",
".",
"states",
".",
"Percentile",
"(",
"event",
".",
"EventCreatedAt",
",",
"percentile",
")",
")",
"\n",
"}",
"\n\n",
"return",
"[",
"]",
"Point",
"{",
"{",
"Values",
":",
"values",
",",
"Date",
":",
"event",
".",
"EventCreatedAt",
",",
"}",
",",
"}",
"\n",
"}"
] |
13,818 | all-13819 | [
"Photos",
"gets",
"photos",
"for",
"a",
"venue",
"https",
":",
"//",
"developer",
".",
"foursquare",
".",
"com",
"/",
"docs",
"/",
"api",
"/",
"venues",
"/",
"photos"
] | [
"func",
"(",
"s",
"*",
"VenueService",
")",
"Photos",
"(",
"params",
"*",
"VenuePhotosParams",
")",
"(",
"*",
"PhotoGrouping",
",",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"photos",
":=",
"new",
"(",
"venuePhotoResp",
")",
"\n",
"response",
":=",
"new",
"(",
"Response",
")",
"\n\n",
"resp",
",",
"err",
":=",
"s",
".",
"sling",
".",
"New",
"(",
")",
".",
"Get",
"(",
"params",
".",
"VenueID",
"+",
"\"",
"\"",
")",
".",
"QueryStruct",
"(",
"params",
")",
".",
"Receive",
"(",
"response",
",",
"response",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"json",
".",
"Unmarshal",
"(",
"response",
".",
"<mask>",
",",
"photos",
")",
"\n",
"}",
"\n",
"return",
"&",
"photos",
".",
"Photos",
",",
"resp",
",",
"relevantError",
"(",
"err",
",",
"*",
"response",
")",
"\n\n",
"}"
] |
13,819 | all-13820 | [
"GetImageUrlOk",
"returns",
"a",
"tuple",
"with",
"the",
"ImageUrl",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"WidgetConditionalFormat",
")",
"GetImageUrlOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"ImageUrl",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"ImageUrl",
",",
"<mask>",
"\n",
"}"
] |
13,820 | all-13821 | [
"GetRowSpacing",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_grid_get_row_spacing",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Grid",
")",
"GetRowSpacing",
"(",
")",
"uint",
"{",
"c",
":=",
"C",
".",
"gtk_grid_get_row_spacing",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"uint",
"(",
"c",
")",
"\n",
"}"
] |
13,821 | all-13822 | [
"SetProxyMenuItem",
"is",
"a",
"wrapper",
"around",
"gtk_tool_item_set_proxy_menu_item",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"ToolItem",
")",
"SetProxyMenuItem",
"(",
"menuItemId",
"string",
",",
"menuItem",
"IMenuItem",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"menuItemId",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_tool_item_set_proxy_menu_item",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"C",
".",
"toGtkWidget",
"(",
"unsafe",
".",
"Pointer",
"(",
"menuItem",
".",
"toMenuItem",
"(",
")",
")",
")",
")",
"\n",
"}"
] |
13,822 | all-13823 | [
"NewDependencyInjector",
"returns",
"a",
"new",
"DependencyInjector"
] | [
"func",
"NewDependencyInjector",
"(",
")",
"DependencyInjector",
"{",
"return",
"&",
"dependencyInjector",
"{",
"registry",
":",
"make",
"(",
"map",
"[",
"reflect",
".",
"Type",
"]",
"interface",
"{",
"}",
")",
",",
"instances",
":",
"<mask>",
"(",
"map",
"[",
"reflect",
".",
"Type",
"]",
"reflect",
".",
"Value",
")",
",",
"}",
"\n",
"}"
] |
13,823 | all-13824 | [
"Delete",
"deletes",
"the",
"ByteCode"
] | [
"func",
"(",
"c",
"MemoryCache",
")",
"Delete",
"(",
"key",
"string",
")",
"error",
"{",
"delete",
"(",
"c",
",",
"<mask>",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
13,824 | all-13825 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"Node",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility4",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
13,825 | all-13826 | [
"Do",
"executes",
"Target",
".",
"closeTarget",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"success"
] | [
"func",
"(",
"p",
"*",
"CloseTargetParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"success",
"bool",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"CloseTargetReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandCloseTarget",
",",
"p",
",",
"&",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"Success",
",",
"nil",
"\n",
"}"
] |
13,826 | all-13827 | [
"instance",
"retrieves",
"the",
"instance",
"."
] | [
"func",
"(",
"c",
"*",
"ComputeUtil",
")",
"instance",
"(",
")",
"(",
"*",
"raw",
".",
"Instance",
",",
"error",
")",
"{",
"return",
"c",
".",
"<mask>",
".",
"Instances",
".",
"Get",
"(",
"c",
".",
"project",
",",
"c",
".",
"zone",
",",
"c",
".",
"instanceName",
")",
".",
"Do",
"(",
")",
"\n",
"}"
] |
13,827 | all-13828 | [
"request",
"executes",
"a",
"request",
"with",
"the",
"provided",
"method",
"and",
"path",
".",
"It",
"retries",
"on",
"transport",
"failures",
"and",
"500s",
".",
"measure",
"is",
"provided",
"to",
"enable",
"or",
"disable",
"gathering",
"metrics",
"for",
"specific",
"requests",
"to",
"avoid",
"high",
"-",
"cardinality",
"metrics",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"request",
"(",
"method",
",",
"path",
"string",
",",
"params",
"url",
".",
"Values",
",",
"measure",
"bool",
")",
"(",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"var",
"resp",
"*",
"http",
".",
"Response",
"\n",
"var",
"err",
"error",
"\n",
"backoff",
":=",
"retryDelay",
"\n\n",
"urlPath",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
".",
"baseURL",
",",
"path",
")",
"\n",
"if",
"params",
"!=",
"nil",
"{",
"urlPath",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"urlPath",
",",
"params",
".",
"Encode",
"(",
")",
")",
"\n",
"}",
"\n\n",
"start",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"for",
"retries",
":=",
"0",
";",
"retries",
"<",
"maxRetries",
";",
"retries",
"++",
"{",
"resp",
",",
"err",
"=",
"c",
".",
"doRequest",
"(",
"<mask>",
",",
"urlPath",
")",
"\n",
"if",
"err",
"==",
"nil",
"&&",
"resp",
".",
"StatusCode",
"<",
"500",
"{",
"break",
"\n",
"}",
"else",
"if",
"err",
"==",
"nil",
"&&",
"retries",
"+",
"1",
"<",
"maxRetries",
"{",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"// Capture the retry in a metric.",
"if",
"measure",
"&&",
"c",
".",
"metrics",
"!=",
"nil",
"{",
"c",
".",
"metrics",
".",
"RequestRetries",
".",
"Inc",
"(",
")",
"\n",
"}",
"\n",
"time",
".",
"Sleep",
"(",
"backoff",
")",
"\n",
"backoff",
"*=",
"2",
"\n",
"}",
"\n",
"if",
"measure",
"&&",
"resp",
"!=",
"nil",
"{",
"c",
".",
"measure",
"(",
"method",
",",
"path",
",",
"resp",
".",
"StatusCode",
",",
"start",
")",
"\n",
"}",
"\n",
"return",
"resp",
",",
"err",
"\n",
"}"
] |
13,828 | all-13829 | [
"Appends",
"a",
"header",
"in",
"the",
"default",
"format",
"YYYY",
"-",
"MM",
"-",
"DD",
"hh",
":",
"mm",
":",
"ss",
".",
"sss",
"[",
"LVL",
"]",
"TAG",
":",
".",
"If",
"either",
"of",
"the",
"Lshortfile",
"or",
"Llongfile",
"flags",
"are",
"specified",
"the",
"file",
"named",
"and",
"line",
"number",
"are",
"included",
"after",
"the",
"tag",
"and",
"before",
"the",
"final",
"colon",
"."
] | [
"func",
"formatHeader",
"(",
"buf",
"*",
"[",
"]",
"byte",
",",
"t",
"time",
".",
"Time",
",",
"lvl",
",",
"tag",
"string",
",",
"file",
"string",
",",
"line",
"int",
")",
"{",
"year",
",",
"month",
",",
"day",
":=",
"t",
".",
"Date",
"(",
")",
"\n",
"hour",
",",
"min",
",",
"sec",
":=",
"t",
".",
"Clock",
"(",
")",
"\n",
"ms",
":=",
"t",
".",
"Nanosecond",
"(",
")",
"/",
"1e6",
"\n\n",
"itoa",
"(",
"buf",
",",
"year",
",",
"4",
")",
"\n",
"*",
"buf",
"=",
"append",
"(",
"*",
"buf",
",",
"'-'",
")",
"\n",
"itoa",
"(",
"buf",
",",
"int",
"(",
"month",
")",
",",
"2",
")",
"\n",
"*",
"buf",
"=",
"append",
"(",
"*",
"buf",
",",
"'-'",
")",
"\n",
"itoa",
"(",
"buf",
",",
"day",
",",
"2",
")",
"\n",
"*",
"buf",
"=",
"append",
"(",
"*",
"buf",
",",
"' '",
")",
"\n",
"itoa",
"(",
"buf",
",",
"hour",
",",
"2",
")",
"\n",
"*",
"buf",
"=",
"append",
"(",
"*",
"buf",
",",
"':'",
")",
"\n",
"itoa",
"(",
"buf",
",",
"min",
",",
"2",
")",
"\n",
"*",
"buf",
"=",
"append",
"(",
"*",
"buf",
",",
"':'",
")",
"\n",
"itoa",
"(",
"buf",
",",
"sec",
",",
"2",
")",
"\n",
"*",
"buf",
"=",
"append",
"(",
"*",
"buf",
",",
"'.'",
")",
"\n",
"itoa",
"(",
"buf",
",",
"ms",
",",
"3",
")",
"\n",
"*",
"buf",
"=",
"append",
"(",
"*",
"buf",
",",
"\"",
"\"",
"...",
")",
"\n",
"*",
"buf",
"=",
"append",
"(",
"*",
"buf",
",",
"lvl",
"...",
")",
"\n",
"*",
"buf",
"=",
"append",
"(",
"*",
"buf",
",",
"\"",
"\"",
"...",
")",
"\n",
"*",
"buf",
"=",
"<mask>",
"(",
"*",
"buf",
",",
"tag",
"...",
")",
"\n",
"if",
"file",
"!=",
"\"",
"\"",
"{",
"*",
"buf",
"=",
"append",
"(",
"*",
"buf",
",",
"' '",
")",
"\n",
"*",
"buf",
"=",
"append",
"(",
"*",
"buf",
",",
"file",
"...",
")",
"\n",
"*",
"buf",
"=",
"append",
"(",
"*",
"buf",
",",
"':'",
")",
"\n",
"itoa",
"(",
"buf",
",",
"line",
",",
"-",
"1",
")",
"\n",
"}",
"\n",
"*",
"buf",
"=",
"append",
"(",
"*",
"buf",
",",
"\"",
"\"",
"...",
")",
"\n",
"}"
] |
13,829 | all-13830 | [
"scsiControllerListString",
"pretty",
"-",
"prints",
"a",
"slice",
"of",
"SCSI",
"controllers",
"."
] | [
"func",
"scsiControllerListString",
"(",
"ctlrs",
"[",
"]",
"<mask>",
".",
"BaseVirtualSCSIController",
")",
"string",
"{",
"var",
"l",
"object",
".",
"VirtualDeviceList",
"\n",
"for",
"_",
",",
"ctlr",
":=",
"range",
"ctlrs",
"{",
"if",
"ctlr",
"==",
"nil",
"{",
"l",
"=",
"append",
"(",
"l",
",",
"types",
".",
"BaseVirtualDevice",
"(",
"nil",
")",
")",
"\n",
"}",
"else",
"{",
"l",
"=",
"append",
"(",
"l",
",",
"ctlr",
".",
"(",
"types",
".",
"BaseVirtualDevice",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"DeviceListString",
"(",
"l",
")",
"\n",
"}"
] |
13,830 | all-13831 | [
"Returns",
"a",
"signed",
"URL",
"for",
"WorkerType",
"valid",
"for",
"the",
"specified",
"duration",
".",
"Required",
"scopes",
":",
"Any",
"of",
":",
"-",
"aws",
"-",
"provisioner",
":",
"view",
"-",
"worker",
"-",
"type",
":",
"<workerType",
">",
"-",
"aws",
"-",
"provisioner",
":",
"manage",
"-",
"worker",
"-",
"type",
":",
"<workerType",
">",
"See",
"WorkerType",
"for",
"more",
"details",
"."
] | [
"func",
"(",
"awsProvisioner",
"*",
"AwsProvisioner",
")",
"WorkerType_SignedURL",
"(",
"workerType",
"string",
",",
"duration",
"time",
".",
"Duration",
")",
"(",
"*",
"url",
".",
"URL",
",",
"error",
")",
"{",
"cd",
":=",
"tcclient",
".",
"<mask>",
"(",
"*",
"awsProvisioner",
")",
"\n",
"return",
"(",
"&",
"cd",
")",
".",
"SignedURL",
"(",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"workerType",
")",
",",
"nil",
",",
"duration",
")",
"\n",
"}"
] |
13,831 | all-13832 | [
"FormatSection",
"properly",
"indents",
"a",
"text",
"section"
] | [
"func",
"FormatSection",
"(",
"header",
"string",
",",
"content",
"string",
")",
"string",
"{",
"<mask>",
":=",
"\"",
"\"",
"\n\n",
"// Add section header",
"if",
"header",
"!=",
"\"",
"\"",
"{",
"out",
"+=",
"header",
"+",
"\"",
"\\n",
"\"",
"\n",
"}",
"\n\n",
"// Indent the content",
"for",
"_",
",",
"line",
":=",
"range",
"strings",
".",
"Split",
"(",
"content",
",",
"\"",
"\\n",
"\"",
")",
"{",
"if",
"line",
"!=",
"\"",
"\"",
"{",
"out",
"+=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"out",
"+=",
"line",
"+",
"\"",
"\\n",
"\"",
"\n",
"}",
"\n\n",
"if",
"header",
"!=",
"\"",
"\"",
"{",
"// Section separator (when rendering a full section",
"out",
"+=",
"\"",
"\\n",
"\"",
"\n",
"}",
"else",
"{",
"// Remove last newline when rendering partial section",
"out",
"=",
"strings",
".",
"TrimSuffix",
"(",
"out",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"out",
"\n",
"}"
] |
13,832 | all-13833 | [
"===",
"month",
"(",
"v",
"Vector",
")",
"Scalar",
"==="
] | [
"func",
"funcMonth",
"(",
"vals",
"[",
"]",
"Value",
",",
"args",
"Expressions",
",",
"enh",
"*",
"EvalNodeHelper",
")",
"Vector",
"{",
"return",
"dateWrapper",
"(",
"vals",
",",
"enh",
",",
"func",
"(",
"t",
"<mask>",
".",
"Time",
")",
"float64",
"{",
"return",
"float64",
"(",
"t",
".",
"Month",
"(",
")",
")",
"\n",
"}",
")",
"\n",
"}"
] |
13,833 | all-13834 | [
"Renderer",
"is",
"a",
"Middleware",
"that",
"maps",
"a",
"render",
".",
"Render",
"service",
"into",
"the",
"Martini",
"handler",
"chain",
".",
"An",
"single",
"variadic",
"render",
".",
"Options",
"struct",
"can",
"be",
"optionally",
"provided",
"to",
"configure",
"HTML",
"rendering",
".",
"The",
"default",
"directory",
"for",
"templates",
"is",
"templates",
"and",
"the",
"default",
"file",
"extension",
"is",
".",
"tmpl",
".",
"If",
"MARTINI_ENV",
"is",
"set",
"to",
"or",
"development",
"then",
"templates",
"will",
"be",
"recompiled",
"on",
"every",
"request",
".",
"For",
"more",
"performance",
"set",
"the",
"MARTINI_ENV",
"environment",
"variable",
"to",
"production"
] | [
"func",
"Renderer",
"(",
"options",
"...",
"Options",
")",
"martini",
".",
"Handler",
"{",
"opt",
":=",
"prepareOptions",
"(",
"options",
")",
"\n",
"cs",
":=",
"prepareCharset",
"(",
"opt",
".",
"Charset",
")",
"\n",
"t",
":=",
"compile",
"(",
"opt",
")",
"\n",
"return",
"func",
"(",
"res",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
",",
"c",
"martini",
".",
"Context",
")",
"{",
"// recompile for easy development",
"if",
"martini",
".",
"Env",
"==",
"martini",
".",
"Dev",
"{",
"t",
"=",
"compile",
"(",
"<mask>",
")",
"\n",
"}",
"\n",
"tc",
",",
"_",
":=",
"t",
".",
"Clone",
"(",
")",
"\n",
"c",
".",
"MapTo",
"(",
"&",
"renderer",
"{",
"res",
",",
"req",
",",
"tc",
",",
"opt",
",",
"cs",
"}",
",",
"(",
"*",
"Render",
")",
"(",
"nil",
")",
")",
"\n",
"}",
"\n",
"}"
] |
13,834 | all-13835 | [
"GetParameters",
"indicates",
"an",
"expected",
"call",
"of",
"GetParameters"
] | [
"func",
"(",
"mr",
"*",
"MockSSMClientMockRecorder",
")",
"GetParameters",
"(",
"arg0",
"<mask>",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"MockSSMClient",
")",
"(",
"nil",
")",
".",
"GetParameters",
")",
",",
"arg0",
")",
"\n",
"}"
] |
13,835 | all-13836 | [
"newImageDestination",
"returns",
"an",
"ImageDestination",
"for",
"writing",
"to",
"an",
"existing",
"ostree",
"."
] | [
"func",
"newImageDestination",
"(",
"ref",
"ostreeReference",
",",
"tmpDirPath",
"string",
")",
"(",
"types",
".",
"ImageDestination",
",",
"error",
")",
"{",
"tmpDirPath",
"=",
"filepath",
".",
"Join",
"(",
"tmpDirPath",
",",
"ref",
".",
"branchName",
")",
"\n",
"if",
"err",
":=",
"ensureDirectoryExists",
"(",
"tmpDirPath",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"ostreeImageDestination",
"{",
"<mask>",
",",
"\"",
"\"",
",",
"manifestSchema",
"{",
"}",
",",
"tmpDirPath",
",",
"map",
"[",
"string",
"]",
"*",
"blobToImport",
"{",
"}",
",",
"\"",
"\"",
",",
"0",
",",
"nil",
"}",
",",
"nil",
"\n",
"}"
] |
13,836 | all-13837 | [
"Prepare",
"prepares",
"a",
"sql",
"statement",
"."
] | [
"func",
"(",
"s",
"*",
"Session",
")",
"Prepare",
"(",
"query",
"string",
")",
"(",
"QueryType",
",",
"uint64",
",",
"*",
"ParameterFieldSet",
",",
"*",
"ResultFieldSet",
",",
"error",
")",
"{",
"s",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"err",
":=",
"s",
".",
"writeRequest",
"(",
"mtPrepare",
",",
"false",
",",
"command",
"(",
"query",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"QtNone",
",",
"0",
",",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"id",
"uint64",
"\n",
"var",
"prmFieldSet",
"*",
"ParameterFieldSet",
"\n",
"var",
"resultFieldSet",
"*",
"ResultFieldSet",
"\n\n",
"f",
":=",
"func",
"(",
"p",
"replyPart",
")",
"{",
"switch",
"p",
":=",
"p",
".",
"(",
"type",
")",
"{",
"case",
"*",
"statementID",
":",
"p",
".",
"id",
"=",
"&",
"<mask>",
"\n",
"case",
"*",
"parameterMetadata",
":",
"prmFieldSet",
"=",
"newParameterFieldSet",
"(",
"p",
".",
"numArg",
")",
"\n",
"p",
".",
"prmFieldSet",
"=",
"prmFieldSet",
"\n",
"case",
"*",
"resultMetadata",
":",
"resultFieldSet",
"=",
"newResultFieldSet",
"(",
"p",
".",
"numArg",
")",
"\n",
"p",
".",
"resultFieldSet",
"=",
"resultFieldSet",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"s",
".",
"readReply",
"(",
"f",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"QtNone",
",",
"0",
",",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"s",
".",
"sh",
".",
"functionCode",
".",
"queryType",
"(",
")",
",",
"id",
",",
"prmFieldSet",
",",
"resultFieldSet",
",",
"nil",
"\n",
"}"
] |
13,837 | all-13838 | [
"set",
"the",
"polygon",
"stippling",
"pattern"
] | [
"func",
"PolygonStipple",
"(",
"<mask>",
"*",
"uint8",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpPolygonStipple",
",",
"1",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"mask",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
13,838 | all-13839 | [
"newGPGSigningMechanismInDirectory",
"returns",
"a",
"new",
"GPG",
"/",
"OpenPGP",
"signing",
"mechanism",
"using",
"optionalDir",
"if",
"not",
"empty",
".",
"The",
"caller",
"must",
"call",
".",
"Close",
"()",
"on",
"the",
"returned",
"SigningMechanism",
"."
] | [
"func",
"newGPGSigningMechanismInDirectory",
"(",
"optionalDir",
"string",
")",
"(",
"SigningMechanism",
",",
"<mask>",
")",
"{",
"ctx",
",",
"err",
":=",
"newGPGMEContext",
"(",
"optionalDir",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"gpgmeSigningMechanism",
"{",
"ctx",
":",
"ctx",
",",
"ephemeralDir",
":",
"\"",
"\"",
",",
"}",
",",
"nil",
"\n",
"}"
] |
13,839 | all-13840 | [
"BuffaloRenderer",
"implements",
"the",
"render",
".",
"TemplateEngine",
"interface",
"allowing",
"velvet",
"to",
"be",
"used",
"as",
"a",
"template",
"engine",
"for",
"Buffalo"
] | [
"func",
"BuffaloRenderer",
"(",
"input",
"string",
",",
"data",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"helpers",
"<mask>",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"(",
"string",
",",
"error",
")",
"{",
"t",
",",
"err",
":=",
"Parse",
"(",
"input",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"if",
"helpers",
"!=",
"nil",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"helpers",
"{",
"data",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"t",
".",
"Exec",
"(",
"NewContextWith",
"(",
"data",
")",
")",
"\n",
"}"
] |
13,840 | all-13841 | [
"Run",
"starts",
"the",
"bot",
"and",
"connects",
"to",
"the",
"server",
".",
"Blocks",
"until",
"we",
"disconnect",
"from",
"the",
"server",
"."
] | [
"func",
"(",
"bot",
"*",
"Bot",
")",
"Run",
"(",
")",
"{",
"bot",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n\n",
"// Attempt reconnection",
"var",
"hijack",
"bool",
"\n",
"if",
"bot",
".",
"HijackSession",
"{",
"if",
"bot",
".",
"SSL",
"{",
"bot",
".",
"Crit",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"hijack",
"=",
"bot",
".",
"hijackSession",
"(",
")",
"\n",
"bot",
".",
"Debug",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"hijack",
")",
"\n",
"}",
"\n\n",
"if",
"!",
"hijack",
"{",
"err",
":=",
"bot",
".",
"connect",
"(",
"bot",
".",
"Host",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"bot",
".",
"Crit",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"\n",
"}",
"\n",
"bot",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"go",
"bot",
".",
"handleIncomingMessages",
"(",
")",
"\n",
"go",
"bot",
".",
"handleOutgoingMessages",
"(",
")",
"\n\n",
"go",
"bot",
".",
"StartUnixListener",
"(",
")",
"\n\n",
"// Only register on an initial connection",
"if",
"!",
"bot",
".",
"reconnecting",
"{",
"if",
"bot",
".",
"SASL",
"{",
"bot",
".",
"SASLAuthenticate",
"(",
"bot",
".",
"Nick",
",",
"bot",
".",
"Password",
")",
"\n",
"}",
"else",
"{",
"bot",
".",
"StandardRegistration",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"m",
":=",
"range",
"bot",
".",
"Incoming",
"{",
"if",
"m",
"==",
"nil",
"{",
"<mask>",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
13,841 | all-13842 | [
"String",
"force",
"casts",
"a",
"[]",
"byte",
"to",
"a",
"string",
".",
"USE",
"AT",
"YOUR",
"OWN",
"RISK"
] | [
"func",
"String",
"(",
"b",
"[",
"]",
"<mask>",
")",
"(",
"s",
"string",
")",
"{",
"if",
"len",
"(",
"b",
")",
"==",
"0",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"pbytes",
":=",
"(",
"*",
"reflect",
".",
"SliceHeader",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"b",
")",
")",
"\n",
"pstring",
":=",
"(",
"*",
"reflect",
".",
"StringHeader",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"s",
")",
")",
"\n",
"pstring",
".",
"Data",
"=",
"pbytes",
".",
"Data",
"\n",
"pstring",
".",
"Len",
"=",
"pbytes",
".",
"Len",
"\n",
"return",
"\n",
"}"
] |
13,842 | all-13843 | [
"NewCheckDatascaleCommand",
"returns",
"the",
"cobra",
"command",
"for",
"check",
"datascale",
"."
] | [
"func",
"NewCheckDatascaleCommand",
"(",
")",
"*",
"cobra",
".",
"Command",
"{",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Run",
":",
"newCheckDatascaleCommand",
",",
"}",
"\n\n",
"cmd",
".",
"Flags",
"(",
")",
".",
"StringVar",
"(",
"&",
"checkDatascaleLoad",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"cmd",
".",
"Flags",
"(",
")",
".",
"StringVar",
"(",
"&",
"checkDatascalePrefix",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"cmd",
".",
"Flags",
"(",
")",
".",
"BoolVar",
"(",
"&",
"autoCompact",
",",
"\"",
"\"",
",",
"<mask>",
",",
"\"",
"\"",
")",
"\n",
"cmd",
".",
"Flags",
"(",
")",
".",
"BoolVar",
"(",
"&",
"autoDefrag",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n\n",
"return",
"cmd",
"\n",
"}"
] |
13,843 | all-13844 | [
"set",
"sets",
"the",
"value",
"of",
"the",
"Level",
"."
] | [
"func",
"(",
"l",
"*",
"Level",
")",
"<mask>",
"(",
"val",
"Level",
")",
"{",
"atomic",
".",
"StoreInt32",
"(",
"(",
"*",
"int32",
")",
"(",
"l",
")",
",",
"int32",
"(",
"val",
")",
")",
"\n",
"}"
] |
13,844 | all-13845 | [
"GetId",
"returns",
"the",
"Id",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"b",
"*",
"BoardWidget",
")",
"GetId",
"(",
")",
"int",
"{",
"if",
"b",
"==",
"nil",
"||",
"b",
".",
"Id",
"==",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"*",
"b",
".",
"<mask>",
"\n",
"}"
] |
13,845 | all-13846 | [
"IsTerminal",
"returns",
"true",
"if",
"the",
"given",
"file",
"descriptor",
"is",
"a",
"terminal",
"."
] | [
"func",
"IsTerminal",
"(",
"fd",
"int",
")",
"bool",
"{",
"_",
",",
"<mask>",
":=",
"unix",
".",
"IoctlGetTermios",
"(",
"fd",
",",
"ioctlReadTermios",
")",
"\n",
"return",
"err",
"==",
"nil",
"\n",
"}"
] |
13,846 | all-13847 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniform3fv",
"(",
"program",
"uint32",
",",
"<mask>",
"int32",
",",
"count",
"int32",
",",
"value",
"*",
"float32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpProgramUniform3fv",
",",
"4",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"location",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
13,847 | all-13848 | [
"ReleaseMsg",
"releases",
"a",
"buffer"
] | [
"func",
"(",
"c",
"*",
"secureConn",
")",
"ReleaseMsg",
"(",
"m",
"[",
"]",
"byte",
")",
"{",
"c",
".",
"<mask>",
".",
"ReadWriter",
"(",
")",
".",
"ReleaseMsg",
"(",
"m",
")",
"\n",
"}"
] |
13,848 | all-13849 | [
"RequestOnBehalfOf",
"will",
"make",
"all",
"future",
"client",
"requests",
"using",
"the",
"same",
"Account",
"Sid",
"and",
"Auth",
"Token",
"for",
"Basic",
"Auth",
"but",
"will",
"use",
"the",
"provided",
"subaccountSid",
"in",
"the",
"URL",
".",
"Use",
"this",
"to",
"make",
"requests",
"on",
"behalf",
"of",
"a",
"subaccount",
"using",
"the",
"parent",
"account",
"s",
"credentials",
".",
"RequestOnBehalfOf",
"is",
"*",
"not",
"*",
"thread",
"safe",
"and",
"modifies",
"the",
"Client",
"s",
"behavior",
"for",
"all",
"requests",
"going",
"forward",
".",
"RequestOnBehalfOf",
"should",
"only",
"be",
"used",
"with",
"api",
".",
"twilio",
".",
"com",
"not",
"(",
"for",
"example",
")",
"Twilio",
"Monitor",
".",
"To",
"authenticate",
"using",
"a",
"subaccount",
"sid",
"/",
"auth",
"token",
"create",
"a",
"new",
"Client",
"using",
"that",
"account",
"s",
"credentials",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"RequestOnBehalfOf",
"(",
"subaccountSid",
"string",
")",
"{",
"c",
".",
"FullPath",
"=",
"func",
"(",
"pathPart",
"string",
")",
"string",
"{",
"return",
"\"",
"\"",
"+",
"strings",
".",
"Join",
"(",
"[",
"]",
"string",
"{",
"c",
".",
"APIVersion",
",",
"\"",
"\"",
",",
"subaccountSid",
",",
"pathPart",
"+",
"\"",
"\"",
"}",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
13,849 | all-13850 | [
"Populate",
"the",
"database",
"tables",
"within",
"this",
"fixture",
"Warning",
":",
"This",
"will",
"truncate",
"any",
"and",
"all",
"data",
"for",
"each",
"table",
"in",
"the",
"fixture"
] | [
"func",
"(",
"f",
"*",
"Fixture",
")",
"Populate",
"(",
")",
"{",
"for",
"_",
",",
"t",
":=",
"range",
"f",
".",
"Tables",
"{",
"_",
",",
"err",
":=",
"f",
".",
"db",
".",
"Exec",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"t",
".",
"Name",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"t",
".",
"Rows",
"{",
"q",
":=",
"\"",
"\"",
"\n",
"columns",
":=",
"\"",
"\"",
"\n",
"values",
":=",
"make",
"(",
"[",
"]",
"<mask>",
"{",
"}",
",",
"len",
"(",
"r",
")",
")",
"\n",
"i",
":=",
"0",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"r",
"{",
"columns",
"+=",
"k",
"+",
"\"",
"\"",
"\n",
"values",
"[",
"i",
"]",
"=",
"v",
"\n",
"i",
"++",
"\n",
"}",
"\n",
"columns",
"=",
"strings",
".",
"Trim",
"(",
"columns",
",",
"\"",
"\"",
")",
"\n",
"q",
"=",
"fmt",
".",
"Sprintf",
"(",
"q",
",",
"t",
".",
"Name",
",",
"columns",
",",
"strings",
".",
"Repeat",
"(",
"\"",
"\"",
",",
"len",
"(",
"values",
")",
"-",
"1",
")",
")",
"\n\n",
"_",
",",
"err",
":=",
"f",
".",
"db",
".",
"Exec",
"(",
"q",
",",
"values",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
13,850 | all-13851 | [
"/",
"*",
"IntegerFromSection",
"looks",
"for",
"the",
"specified",
"key",
"and",
"returns",
"it",
"as",
"an",
"int64",
".",
"If",
"not",
"found",
"the",
"default",
"value",
"def",
"is",
"returned",
"."
] | [
"func",
"(",
"config",
"*",
"Config",
")",
"IntegerFromSection",
"(",
"sectionName",
"string",
",",
"key",
"string",
",",
"def",
"int64",
")",
"int64",
"{",
"section",
":=",
"config",
".",
"sectionForName",
"(",
"sectionName",
")",
"\n\n",
"if",
"<mask>",
"!=",
"nil",
"{",
"return",
"getInteger",
"(",
"section",
".",
"values",
",",
"key",
",",
"def",
")",
"\n",
"}",
"\n\n",
"return",
"def",
"\n",
"}"
] |
13,851 | all-13852 | [
"Releases",
"the",
"consumer",
"and",
"commits",
"offsets",
"called",
"from",
"rebalance",
"()",
"and",
"Close",
"()"
] | [
"func",
"(",
"c",
"*",
"Consumer",
")",
"release",
"(",
")",
"(",
"err",
"error",
")",
"{",
"// Stop all consumers",
"c",
".",
"subs",
".",
"Stop",
"(",
")",
"\n\n",
"// Clear subscriptions on exit",
"defer",
"c",
".",
"subs",
".",
"Clear",
"(",
")",
"\n\n",
"// Wait for messages to be processed",
"timeout",
":=",
"time",
".",
"NewTimer",
"(",
"c",
".",
"client",
".",
"config",
".",
"Group",
".",
"Offsets",
".",
"Synchronization",
".",
"DwellTime",
")",
"\n",
"defer",
"timeout",
".",
"Stop",
"(",
")",
"\n\n",
"select",
"{",
"case",
"<-",
"c",
".",
"dying",
":",
"<mask>",
"<-",
"timeout",
".",
"C",
":",
"}",
"\n\n",
"// Commit offsets, continue on errors",
"if",
"e",
":=",
"c",
".",
"commitOffsetsWithRetry",
"(",
"c",
".",
"client",
".",
"config",
".",
"Group",
".",
"Offsets",
".",
"Retry",
".",
"Max",
")",
";",
"e",
"!=",
"nil",
"{",
"err",
"=",
"e",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
13,852 | all-13853 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"RemoveScriptToEvaluateOnNewDocumentParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage20",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
13,853 | all-13854 | [
"FindAndModify",
"-"
] | [
"func",
"(",
"s",
"*",
"FakeCollection",
")",
"FindAndModify",
"(",
"selector",
"interface",
"{",
"}",
",",
"update",
"interface",
"{",
"}",
",",
"result",
"interface",
"{",
"}",
")",
"(",
"info",
"*",
"mgo",
".",
"ChangeInfo",
",",
"err",
"error",
")",
"{",
"if",
"s",
".",
"AssignResult",
"!=",
"nil",
"{",
"s",
".",
"AssignResult",
"(",
"<mask>",
",",
"s",
".",
"FakeResultFindAndModify",
")",
"\n",
"}",
"\n",
"return",
"s",
".",
"FakeChangeInfo",
",",
"s",
".",
"ErrFindAndModify",
"\n",
"}"
] |
13,854 | all-13855 | [
"validIndexNameOrDocID",
"is",
"the",
"Go",
"equivalent",
"of",
"Python",
"s",
"_ValidateVisiblePrintableAsciiNotReserved",
"."
] | [
"func",
"validIndexNameOrDocID",
"(",
"s",
"string",
")",
"bool",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"s",
",",
"\"",
"\"",
")",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"for",
"_",
",",
"c",
":=",
"range",
"s",
"{",
"if",
"c",
"<",
"0x21",
"||",
"0x7f",
"<=",
"c",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] |
13,855 | all-13856 | [
"Valid",
"validator"
] | [
"func",
"(",
"c",
"*",
"chainedRule",
")",
"Valid",
"(",
"reqCtx",
"*",
"fasthttp",
".",
"RequestCtx",
")",
"bool",
"{",
"if",
"!",
"c",
".",
"Rule",
".",
"Valid",
"(",
"reqCtx",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"c",
".",
"<mask>",
".",
"Valid",
"(",
"reqCtx",
")",
"\n",
"}"
] |
13,856 | all-13857 | [
"Main",
"lexer",
"loop"
] | [
"func",
"lexText",
"(",
"l",
"*",
"Lexer",
")",
"stateFn",
"{",
"OUTER",
":",
"for",
"{",
"l",
".",
"skipWhitespace",
"(",
")",
"\n",
"remaining",
":=",
"l",
".",
"remaining",
"(",
")",
"\n\n",
"if",
"strings",
".",
"HasPrefix",
"(",
"remaining",
",",
"comment",
")",
"{",
"// Start comment",
"// state function which lexes a comment",
"return",
"lexComment",
"\n",
"}",
"else",
"if",
"strings",
".",
"HasPrefix",
"(",
"remaining",
",",
"pkg",
")",
"{",
"// Start package decl",
"// state function which lexes a package decl",
"return",
"lexPackage",
"\n",
"}",
"else",
"if",
"strings",
".",
"HasPrefix",
"(",
"remaining",
",",
"from",
")",
"{",
"// Start from decl",
"// state function which lexes a from decl",
"return",
"lexFrom",
"\n",
"}",
"else",
"if",
"strings",
".",
"HasPrefix",
"(",
"remaining",
",",
"typeDef",
")",
"{",
"// Start type def",
"// state function which lexes a type",
"return",
"lexTypeDef",
"\n",
"}",
"else",
"if",
"strings",
".",
"HasPrefix",
"(",
"remaining",
",",
"version",
")",
"{",
"// Start version",
"// state function which lexes a version",
"return",
"lexVersion",
"\n",
"}",
"else",
"if",
"strings",
".",
"HasPrefix",
"(",
"remaining",
",",
"required",
")",
"{",
"// Start required field",
"// state function which lexes a field",
"l",
".",
"Pos",
"+=",
"len",
"(",
"required",
")",
"\n",
"l",
".",
"emit",
"(",
"TokenRequired",
")",
"\n",
"l",
".",
"skipWhitespace",
"(",
")",
"\n\n",
"return",
"lexType",
"\n",
"}",
"else",
"if",
"strings",
".",
"HasPrefix",
"(",
"remaining",
",",
"<mask>",
")",
"{",
"// Start optional field",
"// state function which lexes a field",
"l",
".",
"Pos",
"+=",
"len",
"(",
"optional",
")",
"\n",
"l",
".",
"emit",
"(",
"TokenOptional",
")",
"\n",
"l",
".",
"skipWhitespace",
"(",
")",
"\n",
"return",
"lexType",
"\n",
"}",
"else",
"if",
"strings",
".",
"HasPrefix",
"(",
"remaining",
",",
"openScope",
")",
"{",
"// Open scope",
"l",
".",
"Pos",
"+=",
"len",
"(",
"openScope",
")",
"\n",
"l",
".",
"emit",
"(",
"TokenOpenCurlyBracket",
")",
"\n",
"}",
"else",
"if",
"strings",
".",
"HasPrefix",
"(",
"remaining",
",",
"closeScope",
")",
"{",
"// Close scope",
"l",
".",
"Pos",
"+=",
"len",
"(",
"closeScope",
")",
"\n",
"l",
".",
"emit",
"(",
"TokenCloseCurlyBracket",
")",
"\n",
"}",
"else",
"{",
"switch",
"r",
":=",
"l",
".",
"next",
"(",
")",
";",
"{",
"case",
"r",
"==",
"eof",
":",
"// reached EOF?",
"l",
".",
"emit",
"(",
"TokenEOF",
")",
"\n",
"break",
"OUTER",
"\n",
"default",
":",
"l",
".",
"errorf",
"(",
"\"",
"\"",
",",
"string",
"(",
"r",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Stops the run loop",
"return",
"nil",
"\n",
"}"
] |
13,857 | all-13858 | [
"NodePending",
"toggles",
"the",
"pending",
"flag",
"for",
"the",
"node",
".",
"A",
"node",
"is",
"pending",
"when",
"it",
"s",
"been",
"accepted",
"in",
"the",
"cluster",
"but",
"has",
"not",
"yet",
"actually",
"joined",
"it",
"."
] | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"NodePending",
"(",
"id",
"int64",
",",
"pending",
"bool",
")",
"error",
"{",
"value",
":=",
"0",
"\n",
"if",
"pending",
"{",
"value",
"=",
"1",
"\n",
"}",
"\n",
"result",
",",
"err",
":=",
"c",
".",
"tx",
".",
"Exec",
"(",
"\"",
"\"",
",",
"value",
",",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"n",
",",
"err",
":=",
"result",
".",
"RowsAffected",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"n",
"!=",
"1",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"n",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
13,858 | all-13859 | [
"Set",
"sets",
"the",
"value",
"of",
"specified",
"key",
".",
"Errors",
":",
"InvalidKeyError",
"when",
"requested",
"key",
"could",
"not",
"be",
"found",
"."
] | [
"func",
"(",
"s",
"*",
"Cache",
")",
"Set",
"(",
"key",
"string",
",",
"<mask>",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"s",
".",
"removeExpired",
"(",
")",
"==",
"raiqub",
".",
"WriteLocked",
"{",
"s",
".",
"Unlock",
"(",
")",
"\n",
"s",
".",
"RLock",
"(",
")",
"\n",
"}",
"\n",
"defer",
"s",
".",
"RUnlock",
"(",
")",
"\n\n",
"v",
",",
"err",
":=",
"s",
".",
"unsafeGet",
"(",
"key",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"v",
".",
"Postpone",
"(",
")",
"\n",
"v",
".",
"value",
"=",
"value",
"\n",
"return",
"nil",
"\n",
"}"
] |
13,859 | all-13860 | [
"Map",
"returns",
"a",
"slice",
"containing",
"all",
"the",
"elements",
"of",
"ss",
"after",
"applying",
"the",
"callback",
"function",
"to",
"each",
"one"
] | [
"func",
"Map",
"(",
"ss",
"[",
"]",
"string",
",",
"<mask>",
"func",
"(",
"string",
")",
"string",
")",
"[",
"]",
"string",
"{",
"newStrings",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"ss",
")",
")",
"\n",
"for",
"i",
",",
"s",
":=",
"range",
"ss",
"{",
"newStrings",
"[",
"i",
"]",
"=",
"callback",
"(",
"s",
")",
"\n",
"}",
"\n\n",
"return",
"newStrings",
"\n",
"}"
] |
13,860 | all-13861 | [
"SetAlsoLogToStderr",
"sets",
"the",
"flag",
"that",
"if",
"true",
"logs",
"to",
"standard",
"error",
"as",
"well",
"as",
"files"
] | [
"func",
"(",
"l",
"*",
"<mask>",
")",
"SetAlsoLogToStderr",
"(",
"f",
"bool",
")",
"{",
"l",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"l",
".",
"alsoToStderr",
"=",
"f",
"\n\n",
"}"
] |
13,861 | all-13862 | [
"Do",
"executes",
"IndexedDB",
".",
"requestDatabase",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"databaseWithObjectStores",
"-",
"Database",
"with",
"an",
"array",
"of",
"object",
"stores",
"."
] | [
"func",
"(",
"p",
"*",
"RequestDatabaseParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"databaseWithObjectStores",
"*",
"DatabaseWithObjectStores",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"RequestDatabaseReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandRequestDatabase",
",",
"p",
",",
"&",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"DatabaseWithObjectStores",
",",
"nil",
"\n",
"}"
] |
13,862 | all-13863 | [
"UniqueStringsFromFlag",
"returns",
"a",
"string",
"slice",
"from",
"the",
"flag",
"."
] | [
"func",
"UniqueStringsFromFlag",
"(",
"fs",
"*",
"flag",
".",
"FlagSet",
",",
"flagName",
"string",
")",
"[",
"]",
"string",
"{",
"return",
"(",
"*",
"<mask>",
".",
"Lookup",
"(",
"flagName",
")",
".",
"Value",
".",
"(",
"*",
"UniqueStringsValue",
")",
")",
".",
"stringSlice",
"(",
")",
"\n",
"}"
] |
13,863 | all-13864 | [
"MakeApiRequest",
"makes",
"a",
"http",
"request",
"to",
"the",
"API",
"JSON",
"encoding",
"any",
"given",
"data",
"and",
"decoding",
"any",
"JSON",
"reponse",
".",
"method",
"should",
"be",
"the",
"desired",
"http",
"method",
"e",
".",
"g",
":",
"GET",
"POST",
"PUT",
"etc",
".",
"urlStr",
"should",
"be",
"the",
"url",
"path",
"relative",
"to",
"the",
"api",
"url",
"e",
".",
"g",
":",
"/",
"1",
".",
"0",
"/",
"servers",
"if",
"reqBody",
"is",
"non",
"-",
"nil",
"it",
"will",
"be",
"Marshaled",
"to",
"JSON",
"and",
"set",
"as",
"the",
"request",
"body",
".",
"Optionally",
"the",
"response",
"body",
"will",
"be",
"Unmarshaled",
"from",
"JSON",
"into",
"whatever",
"resBody",
"is",
"a",
"pointer",
"to",
".",
"Leave",
"nil",
"to",
"skip",
".",
"If",
"the",
"response",
"is",
"non",
"-",
"2xx",
"MakeApiRequest",
"will",
"try",
"to",
"parse",
"the",
"error",
"message",
"and",
"return",
"an",
"ApiError",
"struct",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"MakeApiRequest",
"(",
"method",
"string",
",",
"path",
"string",
",",
"reqBody",
"interface",
"{",
"}",
",",
"resBody",
"interface",
"{",
"}",
")",
"(",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"req",
",",
"err",
":=",
"c",
".",
"NewRequest",
"(",
"method",
",",
"path",
",",
"reqBody",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"res",
",",
"err",
":=",
"c",
".",
"client",
".",
"Do",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"res",
",",
"err",
"\n",
"}",
"\n",
"defer",
"res",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"if",
"res",
".",
"StatusCode",
">=",
"200",
"&&",
"res",
".",
"StatusCode",
"<=",
"299",
"{",
"if",
"resBody",
"!=",
"nil",
"{",
"err",
":=",
"json",
".",
"NewDecoder",
"(",
"res",
".",
"Body",
")",
".",
"Decode",
"(",
"resBody",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"res",
",",
"ApiError",
"{",
"RequestUrl",
":",
"res",
".",
"Request",
".",
"URL",
",",
"StatusCode",
":",
"res",
".",
"StatusCode",
",",
"Status",
":",
"res",
".",
"Status",
",",
"ParseError",
":",
"&",
"err",
",",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}",
"else",
"{",
"apierr",
":=",
"ApiError",
"{",
"RequestUrl",
":",
"res",
".",
"Request",
".",
"URL",
",",
"StatusCode",
":",
"res",
".",
"StatusCode",
",",
"Status",
":",
"res",
".",
"Status",
",",
"}",
"\n",
"body",
",",
"_",
":=",
"ioutil",
".",
"ReadAll",
"(",
"res",
".",
"Body",
")",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"body",
",",
"&",
"apierr",
")",
"\n",
"apierr",
".",
"ResponseBody",
"=",
"body",
"\n",
"return",
"res",
",",
"apierr",
"\n",
"}",
"\n",
"}"
] |
13,864 | all-13865 | [
"NodeWithLeastContainers",
"returns",
"the",
"name",
"of",
"the",
"non",
"-",
"offline",
"node",
"with",
"with",
"the",
"least",
"number",
"of",
"containers",
"(",
"either",
"already",
"created",
"or",
"being",
"created",
"with",
"an",
"operation",
")",
"."
] | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"NodeWithLeastContainers",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"threshold",
",",
"err",
":=",
"c",
".",
"NodeOfflineThreshold",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"nodes",
",",
"err",
":=",
"c",
".",
"Nodes",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"name",
":=",
"\"",
"\"",
"\n",
"containers",
":=",
"-",
"1",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"nodes",
"{",
"if",
"node",
".",
"IsOffline",
"(",
"threshold",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"// Fetch the number of containers already created on this node.",
"created",
",",
"err",
":=",
"query",
".",
"Count",
"(",
"c",
".",
"tx",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"node",
".",
"ID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Fetch the number of containers currently being created on this node.",
"pending",
",",
"err",
":=",
"query",
".",
"Count",
"(",
"c",
".",
"tx",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"node",
".",
"ID",
",",
"OperationContainerCreate",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"count",
":=",
"created",
"+",
"pending",
"\n",
"if",
"containers",
"==",
"-",
"1",
"||",
"count",
"<",
"containers",
"{",
"containers",
"=",
"count",
"\n",
"name",
"=",
"node",
".",
"Name",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"name",
",",
"nil",
"\n",
"}"
] |
13,865 | all-13866 | [
"Local",
"returns",
"a",
"friendly",
"national",
"representation",
"of",
"the",
"phone",
"number",
"for",
"example",
"+",
"14105554092",
"is",
"returned",
"as",
"(",
"410",
")",
"555",
"-",
"4092",
".",
"If",
"the",
"phone",
"number",
"is",
"not",
"in",
"E",
".",
"164",
"format",
"we",
"try",
"to",
"parse",
"it",
"as",
"a",
"US",
"number",
".",
"If",
"we",
"cannot",
"parse",
"it",
"as",
"a",
"US",
"number",
"it",
"is",
"returned",
"as",
"is",
"."
] | [
"func",
"(",
"pn",
"PhoneNumber",
")",
"Local",
"(",
")",
"string",
"{",
"num",
",",
"err",
":=",
"libphonenumber",
".",
"Parse",
"(",
"string",
"(",
"pn",
")",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"<mask>",
"string",
"(",
"pn",
")",
"\n",
"}",
"\n",
"return",
"libphonenumber",
".",
"Format",
"(",
"num",
",",
"libphonenumber",
".",
"NATIONAL",
")",
"\n",
"}"
] |
13,866 | all-13867 | [
"CompareReader",
"verifies",
"that",
"two",
"readers",
"provide",
"same",
"content",
".",
"Reading",
"more",
"than",
"MaxSize",
"will",
"return",
"an",
"error",
"(",
"along",
"with",
"the",
"comparison",
"value",
"up",
"to",
"MaxSize",
"bytes",
")",
"unless",
"one",
"or",
"both",
"Readers",
"are",
"LimitedReaders",
"in",
"which",
"case",
"MaxSize",
"is",
"ignored",
"."
] | [
"func",
"(",
"c",
"*",
"Cmp",
")",
"CompareReader",
"(",
"r1",
",",
"r2",
"io",
".",
"Reader",
")",
"(",
"bool",
",",
"error",
")",
"{",
"c",
".",
"resetDebugging",
"(",
")",
"\n\n",
"equal",
",",
"err",
":=",
"c",
".",
"compareReader",
"(",
"r1",
",",
"r2",
",",
"c",
".",
"Opt",
".",
"MaxSize",
")",
"\n\n",
"c",
".",
"printDebugCompareReader",
"(",
")",
"\n\n",
"return",
"<mask>",
",",
"err",
"\n",
"}"
] |
13,867 | all-13868 | [
"ParseFullConfig",
"will",
"unmarshal",
"OWNERS",
"file",
"s",
"content",
"into",
"a",
"FullConfig",
"Returns",
"an",
"error",
"if",
"the",
"content",
"cannot",
"be",
"unmarshalled"
] | [
"func",
"ParseFullConfig",
"(",
"b",
"[",
"]",
"byte",
")",
"(",
"FullConfig",
",",
"error",
")",
"{",
"full",
":=",
"<mask>",
"(",
"FullConfig",
")",
"\n",
"err",
":=",
"yaml",
".",
"Unmarshal",
"(",
"b",
",",
"full",
")",
"\n",
"return",
"*",
"full",
",",
"err",
"\n",
"}"
] |
13,868 | all-13869 | [
"NewDCESecurity",
"returns",
"a",
"DCE",
"Security",
"(",
"Version",
"2",
")",
"UUID",
".",
"The",
"domain",
"should",
"be",
"one",
"of",
"Person",
"Group",
"or",
"Org",
".",
"On",
"a",
"POSIX",
"system",
"the",
"id",
"should",
"be",
"the",
"users",
"UID",
"for",
"the",
"Person",
"domain",
"and",
"the",
"users",
"GID",
"for",
"the",
"Group",
".",
"The",
"meaning",
"of",
"id",
"for",
"the",
"domain",
"Org",
"or",
"on",
"non",
"-",
"POSIX",
"systems",
"is",
"site",
"defined",
".",
"For",
"a",
"given",
"domain",
"/",
"id",
"pair",
"the",
"same",
"token",
"may",
"be",
"returned",
"for",
"up",
"to",
"7",
"minutes",
"and",
"10",
"seconds",
"."
] | [
"func",
"NewDCESecurity",
"(",
"domain",
"Domain",
",",
"<mask>",
"uint32",
")",
"(",
"UUID",
",",
"error",
")",
"{",
"uuid",
",",
"err",
":=",
"NewUUID",
"(",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"uuid",
"[",
"6",
"]",
"=",
"(",
"uuid",
"[",
"6",
"]",
"&",
"0x0f",
")",
"|",
"0x20",
"// Version 2",
"\n",
"uuid",
"[",
"9",
"]",
"=",
"byte",
"(",
"domain",
")",
"\n",
"binary",
".",
"BigEndian",
".",
"PutUint32",
"(",
"uuid",
"[",
"0",
":",
"]",
",",
"id",
")",
"\n",
"}",
"\n",
"return",
"uuid",
",",
"err",
"\n",
"}"
] |
13,869 | all-13870 | [
"UnmarshalJSON",
"satisfies",
"json",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"ClientNavigationReason",
")",
"UnmarshalJSON",
"(",
"buf",
"[",
"]",
"<mask>",
")",
"error",
"{",
"return",
"easyjson",
".",
"Unmarshal",
"(",
"buf",
",",
"t",
")",
"\n",
"}"
] |
13,870 | all-13871 | [
"GetTimeRangeOk",
"returns",
"a",
"tuple",
"with",
"the",
"TimeRange",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"q",
"*",
"QueryConfig",
")",
"GetTimeRangeOk",
"(",
")",
"(",
"TimeRange",
",",
"bool",
")",
"{",
"if",
"q",
"==",
"nil",
"||",
"q",
".",
"TimeRange",
"==",
"nil",
"{",
"return",
"TimeRange",
"{",
"}",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"q",
".",
"TimeRange",
",",
"<mask>",
"\n",
"}"
] |
13,871 | all-13872 | [
"GetAntialias",
"is",
"a",
"wrapper",
"around",
"cairo_get_antialias",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetAntialias",
"(",
")",
"Antialias",
"{",
"c",
":=",
"C",
".",
"cairo_get_antialias",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"Antialias",
"(",
"c",
")",
"\n",
"}"
] |
13,872 | all-13873 | [
"EncodeAll",
"returns",
"a",
"packed",
"slice",
"of",
"the",
"values",
"from",
"src",
".",
"It",
"a",
"value",
"is",
"over",
"1",
"<<",
"28",
"an",
"error",
"is",
"returned",
"."
] | [
"func",
"EncodeAll",
"(",
"src",
"[",
"]",
"uint32",
")",
"(",
"[",
"]",
"uint32",
",",
"error",
")",
"{",
"i",
":=",
"0",
"\n",
"dst",
":=",
"make",
"(",
"[",
"]",
"uint32",
",",
"len",
"(",
"src",
")",
")",
"\n",
"j",
":=",
"0",
"\n\n",
"for",
"{",
"if",
"i",
">=",
"len",
"(",
"src",
")",
"{",
"<mask>",
"\n",
"}",
"\n",
"remaining",
":=",
"src",
"[",
"i",
":",
"]",
"\n\n",
"if",
"canPack",
"(",
"remaining",
",",
"1",
",",
"28",
")",
"{",
"dst",
"[",
"j",
"]",
"=",
"pack28",
"(",
"src",
"[",
"i",
":",
"i",
"+",
"28",
"]",
")",
"\n",
"i",
"+=",
"28",
"\n",
"}",
"else",
"if",
"canPack",
"(",
"remaining",
",",
"2",
",",
"14",
")",
"{",
"dst",
"[",
"j",
"]",
"=",
"pack14",
"(",
"src",
"[",
"i",
":",
"i",
"+",
"14",
"]",
")",
"\n",
"i",
"+=",
"14",
"\n",
"}",
"else",
"if",
"canPack",
"(",
"remaining",
",",
"3",
",",
"9",
")",
"{",
"dst",
"[",
"j",
"]",
"=",
"pack9",
"(",
"src",
"[",
"i",
":",
"i",
"+",
"9",
"]",
")",
"\n",
"i",
"+=",
"9",
"\n",
"}",
"else",
"if",
"canPack",
"(",
"remaining",
",",
"4",
",",
"7",
")",
"{",
"dst",
"[",
"j",
"]",
"=",
"pack7",
"(",
"src",
"[",
"i",
":",
"i",
"+",
"7",
"]",
")",
"\n",
"i",
"+=",
"7",
"\n",
"}",
"else",
"if",
"canPack",
"(",
"remaining",
",",
"5",
",",
"5",
")",
"{",
"dst",
"[",
"j",
"]",
"=",
"pack5",
"(",
"src",
"[",
"i",
":",
"i",
"+",
"5",
"]",
")",
"\n",
"i",
"+=",
"5",
"\n",
"}",
"else",
"if",
"canPack",
"(",
"remaining",
",",
"7",
",",
"4",
")",
"{",
"dst",
"[",
"j",
"]",
"=",
"pack4",
"(",
"src",
"[",
"i",
":",
"i",
"+",
"4",
"]",
")",
"\n",
"i",
"+=",
"4",
"\n",
"}",
"else",
"if",
"canPack",
"(",
"remaining",
",",
"9",
",",
"3",
")",
"{",
"dst",
"[",
"j",
"]",
"=",
"pack3",
"(",
"src",
"[",
"i",
":",
"i",
"+",
"3",
"]",
")",
"\n",
"i",
"+=",
"3",
"\n",
"}",
"else",
"if",
"canPack",
"(",
"remaining",
",",
"14",
",",
"2",
")",
"{",
"dst",
"[",
"j",
"]",
"=",
"pack2",
"(",
"src",
"[",
"i",
":",
"i",
"+",
"2",
"]",
")",
"\n",
"i",
"+=",
"2",
"\n",
"}",
"else",
"if",
"canPack",
"(",
"remaining",
",",
"28",
",",
"1",
")",
"{",
"dst",
"[",
"j",
"]",
"=",
"pack1",
"(",
"src",
"[",
"i",
":",
"i",
"+",
"1",
"]",
")",
"\n",
"i",
"+=",
"1",
"\n",
"}",
"else",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"j",
"+=",
"1",
"\n",
"}",
"\n",
"return",
"dst",
"[",
":",
"j",
"]",
",",
"nil",
"\n",
"}"
] |
13,873 | all-13874 | [
"Uint",
"defines",
"a",
"uint",
"flag",
"with",
"specified",
"name",
"default",
"value",
"and",
"usage",
"string",
".",
"The",
"return",
"value",
"is",
"the",
"address",
"of",
"a",
"uint",
"variable",
"that",
"stores",
"the",
"value",
"of",
"the",
"flag",
"."
] | [
"func",
"Uint",
"(",
"name",
"string",
",",
"value",
"uint",
",",
"<mask>",
"string",
")",
"*",
"uint",
"{",
"return",
"EnvironmentFlags",
".",
"Uint",
"(",
"name",
",",
"value",
",",
"usage",
")",
"\n",
"}"
] |
13,874 | all-13875 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"TouchType",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"TouchType",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"TouchStart",
":",
"*",
"t",
"=",
"TouchStart",
"\n",
"case",
"TouchEnd",
":",
"*",
"t",
"=",
"TouchEnd",
"\n",
"case",
"TouchMove",
":",
"*",
"t",
"=",
"TouchMove",
"\n",
"case",
"TouchCancel",
":",
"*",
"t",
"=",
"TouchCancel",
"\n\n",
"<mask>",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
] |
13,875 | all-13876 | [
"ListIssueComments",
"returns",
"comments",
"."
] | [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"ListIssueComments",
"(",
"owner",
",",
"repo",
"string",
",",
"number",
"int",
")",
"(",
"[",
"]",
"github",
".",
"IssueComment",
",",
"error",
")",
"{",
"return",
"<mask>",
"(",
"[",
"]",
"github",
".",
"IssueComment",
"{",
"}",
",",
"f",
".",
"IssueComments",
"[",
"number",
"]",
"...",
")",
",",
"nil",
"\n",
"}"
] |
13,876 | all-13877 | [
"LoadProfile",
"loads",
"a",
"profile",
"from",
"the",
"given",
"filename",
".",
"If",
"the",
"filename",
"is",
"-",
"it",
"instead",
"reads",
"from",
"stdin",
"."
] | [
"func",
"LoadProfile",
"(",
"origin",
"string",
")",
"(",
"[",
"]",
"*",
"cover",
".",
"Profile",
",",
"error",
")",
"{",
"filename",
":=",
"<mask>",
"\n",
"if",
"origin",
"==",
"\"",
"\"",
"{",
"// Annoyingly, ParseProfiles only accepts a filename, so we have to write the bytes to disk",
"// so it can read them back.",
"// We could probably also just give it /dev/stdin, but that'll break on Windows.",
"tf",
",",
"err",
":=",
"ioutil",
".",
"TempFile",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"defer",
"tf",
".",
"Close",
"(",
")",
"\n",
"defer",
"os",
".",
"Remove",
"(",
"tf",
".",
"Name",
"(",
")",
")",
"\n",
"if",
"_",
",",
"err",
":=",
"io",
".",
"Copy",
"(",
"tf",
",",
"os",
".",
"Stdin",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"filename",
"=",
"tf",
".",
"Name",
"(",
")",
"\n",
"}",
"\n",
"return",
"cover",
".",
"ParseProfiles",
"(",
"filename",
")",
"\n",
"}"
] |
13,877 | all-13878 | [
"UnmarshalJSON",
"satisfies",
"json",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"ExceptionsState",
")",
"UnmarshalJSON",
"(",
"buf",
"[",
"]",
"<mask>",
")",
"error",
"{",
"return",
"easyjson",
".",
"Unmarshal",
"(",
"buf",
",",
"t",
")",
"\n",
"}"
] |
13,878 | all-13879 | [
"FilterMatched",
"returns",
"true",
"if",
"the",
"set",
"of",
"input",
"filters",
"match",
"the",
"feature",
"s",
"tags",
"."
] | [
"func",
"(",
"f",
"*",
"Feature",
")",
"FilterMatched",
"(",
"filters",
"...",
"string",
")",
"bool",
"{",
"<mask>",
"matchTags",
"(",
"f",
".",
"Tags",
",",
"filters",
")",
"\n",
"}"
] |
13,879 | all-13880 | [
"ListInstancesByServiceID",
"returns",
"list",
"of",
"instances",
"registered",
"in",
"given",
"service",
"."
] | [
"func",
"(",
"p",
"*",
"AWSSDProvider",
")",
"ListInstancesByServiceID",
"(",
"serviceID",
"*",
"string",
")",
"(",
"[",
"]",
"*",
"sd",
".",
"InstanceSummary",
",",
"error",
")",
"{",
"instances",
":=",
"make",
"(",
"[",
"]",
"*",
"sd",
".",
"InstanceSummary",
",",
"0",
")",
"\n\n",
"f",
":=",
"func",
"(",
"resp",
"*",
"sd",
".",
"ListInstancesOutput",
",",
"lastPage",
"bool",
")",
"bool",
"{",
"instances",
"=",
"append",
"(",
"instances",
",",
"resp",
".",
"Instances",
"...",
")",
"\n\n",
"return",
"true",
"\n",
"}",
"\n\n",
"err",
":=",
"p",
".",
"<mask>",
".",
"ListInstancesPages",
"(",
"&",
"sd",
".",
"ListInstancesInput",
"{",
"ServiceId",
":",
"serviceID",
",",
"}",
",",
"f",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"instances",
",",
"nil",
"\n",
"}"
] |
13,880 | all-13881 | [
"resourceRecordSetIsManaged",
"checks",
"if",
"the",
"resource",
"record",
"should",
"be",
"managed",
"(",
"and",
"thus",
"deleted",
")",
"by",
"us"
] | [
"func",
"resourceRecordSetIsManaged",
"(",
"rrs",
"*",
"route53",
".",
"ResourceRecordSet",
")",
"bool",
"{",
"if",
"\"",
"\"",
"!=",
"aws",
".",
"StringValue",
"(",
"rrs",
".",
"Type",
")",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"name",
":=",
"aws",
".",
"StringValue",
"(",
"rrs",
".",
"<mask>",
")",
"\n\n",
"for",
"_",
",",
"managedNameRegex",
":=",
"range",
"managedNameRegexes",
"{",
"if",
"managedNameRegex",
".",
"MatchString",
"(",
"name",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"klog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"return",
"false",
"\n",
"}"
] |
13,881 | all-13882 | [
"AddSpanToAnyExisting",
"checks",
"ctx",
"for",
"Jaeger",
"tracing",
"information",
"and",
"if",
"tracing",
"metadata",
"is",
"present",
"it",
"generates",
"a",
"new",
"span",
"for",
"operation",
"marks",
"it",
"as",
"a",
"child",
"of",
"the",
"existing",
"span",
"and",
"returns",
"it",
"."
] | [
"func",
"AddSpanToAnyExisting",
"(",
"ctx",
"context",
".",
"<mask>",
",",
"operation",
"string",
",",
"kvs",
"...",
"interface",
"{",
"}",
")",
"(",
"opentracing",
".",
"Span",
",",
"context",
".",
"Context",
")",
"{",
"if",
"parentSpan",
":=",
"opentracing",
".",
"SpanFromContext",
"(",
"ctx",
")",
";",
"parentSpan",
"!=",
"nil",
"{",
"span",
":=",
"opentracing",
".",
"StartSpan",
"(",
"operation",
",",
"opentracing",
".",
"ChildOf",
"(",
"parentSpan",
".",
"Context",
"(",
")",
")",
")",
"\n",
"tagSpan",
"(",
"span",
",",
"kvs",
")",
"\n",
"return",
"span",
",",
"opentracing",
".",
"ContextWithSpan",
"(",
"ctx",
",",
"span",
")",
"\n",
"}",
"\n",
"return",
"nil",
",",
"ctx",
"\n",
"}"
] |
13,882 | all-13883 | [
"ProviderConfig",
"is",
"a",
"convenience",
"method",
"that",
"will",
"attempt",
"to",
"return",
"a",
"ControlPlaneProviderConfig",
"for",
"a",
"cluster",
".",
"This",
"is",
"useful",
"for",
"managing",
"the",
"legacy",
"API",
"in",
"a",
"clean",
"way",
".",
"This",
"will",
"ignore",
"errors",
"from",
"json",
".",
"Unmarshal",
"and",
"will",
"simply",
"return",
"an",
"empty",
"config",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ProviderConfig",
"(",
")",
"*",
"ControlPlaneProviderConfig",
"{",
"//providerConfig providerConfig",
"raw",
":=",
"c",
".",
"ClusterAPI",
".",
"Spec",
".",
"ProviderConfig",
"\n",
"providerConfig",
":=",
"&",
"ControlPlaneProviderConfig",
"{",
"}",
"\n",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"[",
"]",
"<mask>",
"(",
"raw",
")",
",",
"providerConfig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Critical",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"providerConfig",
"\n",
"}"
] |
13,883 | all-13884 | [
"HaveKeyWithValue",
"succeeds",
"if",
"actual",
"is",
"a",
"map",
"with",
"the",
"passed",
"in",
"key",
"and",
"value",
".",
"By",
"default",
"HaveKeyWithValue",
"uses",
"Equal",
"()",
"to",
"perform",
"the",
"match",
"however",
"a",
"matcher",
"can",
"be",
"passed",
"in",
"instead",
":",
"Expect",
"(",
"map",
"[",
"string",
"]",
"string",
"{",
"Foo",
":",
"Bar",
"BazFoo",
":",
"Duck",
"}",
")",
".",
"Should",
"(",
"HaveKeyWithValue",
"(",
"Foo",
"Bar",
"))",
"Expect",
"(",
"map",
"[",
"string",
"]",
"string",
"{",
"Foo",
":",
"Bar",
"BazFoo",
":",
"Duck",
"}",
")",
".",
"Should",
"(",
"HaveKeyWithValue",
"(",
"MatchRegexp",
"(",
".",
"+",
"Foo$",
")",
"Bar",
"))"
] | [
"func",
"HaveKeyWithValue",
"(",
"key",
"<mask>",
"{",
"}",
",",
"value",
"interface",
"{",
"}",
")",
"types",
".",
"GomegaMatcher",
"{",
"return",
"&",
"matchers",
".",
"HaveKeyWithValueMatcher",
"{",
"Key",
":",
"key",
",",
"Value",
":",
"value",
",",
"}",
"\n",
"}"
] |
13,884 | all-13885 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"ComputedStyle",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomsnapshot13",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
13,885 | all-13886 | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"update",
"Vm",
"with",
"state",
"params"
] | [
"func",
"(",
"o",
"*",
"UpdateVMWithStateParams",
")",
"WithTimeout",
"(",
"timeout",
"<mask>",
".",
"Duration",
")",
"*",
"UpdateVMWithStateParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
13,886 | all-13887 | [
"SetLines",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_label_set_lines",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Label",
")",
"SetLines",
"(",
"<mask>",
"int",
")",
"{",
"C",
".",
"gtk_label_set_lines",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"lines",
")",
")",
"\n",
"}"
] |
13,887 | all-13888 | [
"RandomStrings",
"returns",
"a",
"slice",
"of",
"randomly",
"generated",
"strings",
"."
] | [
"func",
"RandomStrings",
"(",
"slen",
"uint",
",",
"n",
"int",
")",
"(",
"ss",
"[",
"]",
"string",
")",
"{",
"ss",
"=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"n",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
"{",
"ss",
"=",
"<mask>",
"(",
"ss",
",",
"randString",
"(",
"slen",
")",
")",
"\n",
"}",
"\n",
"return",
"ss",
"\n",
"}"
] |
13,888 | all-13889 | [
"NewState",
"creates",
"a",
"new",
"State",
"struct"
] | [
"func",
"NewState",
"(",
")",
"*",
"State",
"{",
"st",
":=",
"&",
"State",
"{",
"opidx",
":",
"0",
",",
"pc",
":",
"NewByteCode",
"(",
")",
",",
"stack",
":",
"stack",
".",
"New",
"(",
"5",
")",
",",
"markstack",
":",
"stack",
".",
"New",
"(",
"5",
")",
",",
"framestack",
":",
"stack",
".",
"New",
"(",
"5",
")",
",",
"frames",
":",
"<mask>",
".",
"New",
"(",
"5",
")",
",",
"vars",
":",
"make",
"(",
"Vars",
")",
",",
"warn",
":",
"os",
".",
"Stderr",
",",
"MaxLoopCount",
":",
"1000",
",",
"}",
"\n\n",
"st",
".",
"Pushmark",
"(",
")",
"\n",
"st",
".",
"PushFrame",
"(",
")",
"\n",
"return",
"st",
"\n",
"}"
] |
13,889 | all-13890 | [
"ForwardLines",
"is",
"a",
"wrapper",
"around",
"gtk_text_iter_forward_lines",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TextIter",
")",
"ForwardLines",
"(",
"v1",
"int",
")",
"bool",
"{",
"<mask>",
"gobool",
"(",
"C",
".",
"gtk_text_iter_forward_lines",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"v1",
")",
")",
")",
"\n",
"}"
] |
13,890 | all-13891 | [
"Execute",
"-",
"creates",
"space",
"specific",
"security",
"groups"
] | [
"func",
"(",
"c",
"*",
"CreateSpaceSecurityGroupsCommand",
")",
"Execute",
"(",
"[",
"]",
"string",
")",
"error",
"{",
"var",
"cfMgmt",
"*",
"CFMgmt",
"\n",
"<mask>",
"err",
"error",
"\n",
"if",
"cfMgmt",
",",
"err",
"=",
"InitializePeekManagers",
"(",
"c",
".",
"BaseCFConfigCommand",
",",
"c",
".",
"Peek",
")",
";",
"err",
"==",
"nil",
"{",
"err",
"=",
"cfMgmt",
".",
"SecurityGroupManager",
".",
"CreateApplicationSecurityGroups",
"(",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
13,891 | all-13892 | [
"GetVersion",
"returns",
"Kubicorn",
"version",
"."
] | [
"func",
"GetVersion",
"(",
")",
"*",
"Version",
"{",
"return",
"&",
"Version",
"{",
"Version",
":",
"KubicornVersion",
",",
"GitCommit",
":",
"GitSha",
",",
"BuildDate",
":",
"time",
".",
"Now",
"(",
")",
".",
"UTC",
"(",
")",
".",
"<mask>",
"(",
")",
",",
"GoVersion",
":",
"runtime",
".",
"Version",
"(",
")",
",",
"GOOS",
":",
"runtime",
".",
"GOOS",
",",
"GOArch",
":",
"runtime",
".",
"GOARCH",
",",
"}",
"\n",
"}"
] |
13,892 | all-13893 | [
"The",
"key",
"thing",
"that",
"makes",
"a",
"password",
"secure",
"is",
"the",
"_entropy_",
"that",
"comes",
"from",
"a",
"generator",
"of",
"true",
"random",
"numbers",
".",
"But",
"many",
"password",
"rules",
"require",
"a",
"mixure",
"of",
"cases",
"numbers",
"and",
"special",
"characters",
".",
"Here",
"we",
"meet",
"these",
"rules",
"by",
"starting",
"the",
"password",
"with",
"the",
"required",
"upper",
"/",
"lower",
"case",
"number",
"and",
"special",
".",
"Then",
"we",
"make",
"it",
"secure",
"by",
"adding",
"truly",
"random",
"characters",
"."
] | [
"func",
"generatePassword",
"(",
")",
"string",
"{",
"const",
"randomBytesLength",
"=",
"16",
"\n",
"encoding",
":=",
"base64",
".",
"RawURLEncoding",
"\n\n",
"randomBytes",
":=",
"<mask>",
"(",
"[",
"]",
"byte",
",",
"encoding",
".",
"DecodedLen",
"(",
"randomBytesLength",
")",
")",
"\n",
"_",
",",
"err",
":=",
"rand",
".",
"Read",
"(",
"randomBytes",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
")",
"\n",
"}",
"\n\n",
"return",
"\"",
"\"",
"+",
"encoding",
".",
"EncodeToString",
"(",
"randomBytes",
")",
"\n",
"}"
] |
13,893 | all-13894 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"ReleaseObjectParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime10",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
13,894 | all-13895 | [
"Disconnect",
"must",
"be",
"used",
"once",
"done",
"listening",
"for",
"events"
] | [
"func",
"(",
"e",
"*",
"EventListener",
")",
"Disconnect",
"(",
")",
"{",
"if",
"e",
".",
"disconnected",
"{",
"return",
"\n",
"}",
"\n\n",
"// Handle locking",
"e",
".",
"r",
".",
"eventListenersLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"e",
".",
"r",
".",
"eventListenersLock",
".",
"Unlock",
"(",
")",
"\n\n",
"// Locate and remove it from the global list",
"for",
"i",
",",
"listener",
":=",
"range",
"e",
".",
"r",
".",
"eventListeners",
"{",
"if",
"listener",
"==",
"e",
"{",
"copy",
"(",
"e",
".",
"r",
".",
"eventListeners",
"[",
"i",
":",
"]",
",",
"e",
".",
"r",
".",
"eventListeners",
"[",
"i",
"+",
"1",
":",
"]",
")",
"\n",
"e",
".",
"r",
".",
"eventListeners",
"[",
"len",
"(",
"e",
".",
"r",
".",
"eventListeners",
")",
"-",
"1",
"]",
"=",
"nil",
"\n",
"e",
".",
"r",
".",
"eventListeners",
"=",
"e",
".",
"r",
".",
"eventListeners",
"[",
":",
"len",
"(",
"e",
".",
"r",
".",
"eventListeners",
")",
"-",
"1",
"]",
"\n",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Turn off the handler",
"e",
".",
"err",
"=",
"nil",
"\n",
"e",
".",
"disconnected",
"=",
"true",
"\n",
"close",
"(",
"e",
".",
"chActive",
")",
"\n",
"}"
] |
13,895 | all-13896 | [
"gitHeadTimestamp",
"returns",
"the",
"timestamp",
"of",
"the",
"HEAD",
"commit",
"as",
"seconds",
"from",
"the",
"UNIX",
"epoch",
".",
"If",
"unable",
"to",
"read",
"the",
"timestamp",
"for",
"any",
"reason",
"(",
"such",
"as",
"missing",
"the",
"git",
"or",
"not",
"using",
"a",
"git",
"repo",
")",
"it",
"returns",
"0",
"and",
"an",
"error",
"."
] | [
"func",
"(",
"g",
"*",
"gitCtx",
")",
"gitHeadTimestamp",
"(",
")",
"(",
"int",
",",
"error",
")",
"{",
"gitShowCommand",
":=",
"g",
".",
"gitCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"_",
",",
"gitOutput",
",",
"err",
":=",
"gitShowCommand",
".",
"<mask>",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"timestamp",
",",
"convErr",
":=",
"strconv",
".",
"Atoi",
"(",
"string",
"(",
"gitOutput",
")",
")",
"\n",
"if",
"convErr",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"convErr",
")",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"gitOutput",
")",
"\n",
"return",
"0",
",",
"convErr",
"\n",
"}",
"\n",
"return",
"timestamp",
",",
"nil",
"\n",
"}"
] |
13,896 | all-13897 | [
"native",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GtkRecentChooser",
"."
] | [
"func",
"(",
"v",
"*",
"RecentChooser",
")",
"native",
"(",
")",
"*",
"C",
".",
"GtkRecentChooser",
"{",
"if",
"v",
"==",
"nil",
"||",
"v",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"p",
":=",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"GObject",
")",
"\n",
"return",
"C",
".",
"toGtkRecentChooser",
"(",
"p",
")",
"\n",
"}"
] |
13,897 | all-13898 | [
"Using",
"the",
"EZ",
"API",
"posts",
"a",
"count",
"to",
"a",
"stat",
"using",
"DefaultReporter",
"."
] | [
"func",
"PostEZCount",
"(",
"statName",
",",
"ezkey",
"string",
",",
"count",
"int",
")",
"error",
"{",
"return",
"DefaultReporter",
".",
"PostEZCount",
"(",
"statName",
",",
"ezkey",
",",
"<mask>",
")",
"\n",
"}"
] |
13,898 | all-13899 | [
"AddMember",
"adds",
"a",
"new",
"Member",
"into",
"the",
"cluster",
"and",
"saves",
"the",
"given",
"member",
"s",
"raftAttributes",
"into",
"the",
"store",
".",
"The",
"given",
"member",
"should",
"have",
"empty",
"attributes",
".",
"A",
"Member",
"with",
"a",
"matching",
"id",
"must",
"not",
"exist",
"."
] | [
"func",
"(",
"c",
"*",
"RaftCluster",
")",
"AddMember",
"(",
"m",
"*",
"Member",
")",
"{",
"c",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"Unlock",
"(",
")",
"\n",
"if",
"c",
".",
"v2store",
"!=",
"nil",
"{",
"mustSaveMemberToStore",
"(",
"c",
".",
"v2store",
",",
"m",
")",
"\n",
"}",
"\n",
"if",
"c",
".",
"be",
"!=",
"nil",
"{",
"mustSaveMemberToBackend",
"(",
"c",
".",
"be",
",",
"m",
")",
"\n",
"}",
"\n\n",
"c",
".",
"members",
"[",
"m",
".",
"ID",
"]",
"=",
"m",
"\n\n",
"if",
"c",
".",
"lg",
"!=",
"nil",
"{",
"c",
".",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"c",
".",
"cid",
".",
"<mask>",
"(",
")",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"c",
".",
"localID",
".",
"String",
"(",
")",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"m",
".",
"ID",
".",
"String",
"(",
")",
")",
",",
"zap",
".",
"Strings",
"(",
"\"",
"\"",
",",
"m",
".",
"PeerURLs",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"m",
".",
"ID",
",",
"m",
".",
"PeerURLs",
",",
"c",
".",
"cid",
")",
"\n",
"}",
"\n",
"}"
] |
13,899 | all-13900 | [
"selectProject",
"returns",
"the",
"user",
"-",
"selected",
"project",
"defaulting",
"to",
"the",
"current",
"gcloud",
"one",
"."
] | [
"func",
"selectProject",
"(",
"choice",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"fmt",
".",
"Print",
"(",
"\"",
"\"",
")",
"\n",
"who",
",",
"err",
":=",
"currentAccount",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"fmt",
".",
"Println",
"(",
"who",
")",
"\n\n",
"var",
"projs",
"[",
"]",
"string",
"\n\n",
"if",
"choice",
"==",
"\"",
"\"",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\"",
",",
"who",
")",
"\n",
"fmt",
".",
"Println",
"(",
")",
"\n",
"const",
"max",
"=",
"20",
"\n",
"projs",
",",
"err",
"=",
"projects",
"(",
"max",
")",
"\n",
"for",
"_",
",",
"proj",
":=",
"range",
"projs",
"{",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
",",
"proj",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"projs",
")",
"==",
"0",
"{",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"projs",
")",
"==",
"max",
"{",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"def",
",",
"err",
":=",
"currentProject",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Printf",
"(",
"\"",
"\"",
",",
"def",
")",
"\n",
"fmt",
".",
"Scanln",
"(",
"&",
"<mask>",
")",
"\n\n",
"// use default project",
"if",
"choice",
"==",
"\"",
"\"",
"{",
"return",
"def",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"// is this a project from the list?",
"for",
"_",
",",
"p",
":=",
"range",
"projs",
"{",
"if",
"p",
"==",
"choice",
"{",
"return",
"choice",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"fmt",
".",
"Printf",
"(",
"\"",
"\"",
",",
"who",
",",
"choice",
")",
"\n",
"fmt",
".",
"Println",
"(",
")",
"\n\n",
"// no, make sure user has access to it",
"if",
"err",
"=",
"exec",
".",
"Command",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"choice",
")",
".",
"Run",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"who",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"choice",
",",
"nil",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.