id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
18,900 | all-18901 | [
"List",
"returns",
"the",
"names",
"of",
"modules",
"belonging",
"to",
"this",
"application",
"."
]
| [
"func",
"List",
"(",
"c",
"<mask>",
".",
"Context",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"req",
":=",
"&",
"pb",
".",
"GetModulesRequest",
"{",
"}",
"\n",
"res",
":=",
"&",
"pb",
".",
"GetModulesResponse",
"{",
"}",
"\n",
"err",
":=",
"internal",
".",
"Call",
"(",
"c",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"res",
")",
"\n",
"return",
"res",
".",
"Module",
",",
"err",
"\n",
"}"
]
|
18,901 | all-18902 | [
"copy",
"all",
"or",
"part",
"of",
"the",
"data",
"store",
"of",
"a",
"buffer",
"object",
"to",
"the",
"data",
"store",
"of",
"another",
"buffer",
"object"
]
| [
"func",
"CopyNamedBufferSubData",
"(",
"readBuffer",
"uint32",
",",
"writeBuffer",
"uint32",
",",
"readOffset",
"int",
",",
"writeOffset",
"int",
",",
"size",
"int",
")",
"{",
"C",
".",
"glowCopyNamedBufferSubData",
"(",
"gpCopyNamedBufferSubData",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"readBuffer",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"writeBuffer",
")",
",",
"(",
"C",
".",
"GLintptr",
")",
"(",
"readOffset",
")",
",",
"(",
"C",
".",
"GLintptr",
")",
"(",
"writeOffset",
")",
",",
"(",
"C",
".",
"GLsizeiptr",
")",
"(",
"<mask>",
")",
")",
"\n",
"}"
]
|
18,902 | all-18903 | [
"OptionMap",
"returns",
"the",
"map",
"option",
"=",
">",
"value",
"for",
"a",
"given",
"section",
"."
]
| [
"func",
"(",
"c",
"*",
"Config",
")",
"OptionMap",
"(",
"section",
"string",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"options",
":=",
"make",
"(",
"<mask>",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"_",
",",
"sect",
":=",
"range",
"c",
".",
"sections",
"{",
"if",
"sect",
".",
"name",
"==",
"section",
"{",
"for",
"_",
",",
"opt",
":=",
"range",
"sect",
".",
"options",
"{",
"options",
"[",
"opt",
".",
"name",
"]",
"=",
"opt",
".",
"value",
"\n",
"}",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"options",
"\n",
"}"
]
|
18,903 | all-18904 | [
"NewGRPCLogWriter",
"creates",
"a",
"new",
"GRPC",
"log",
"writer",
".",
"logger",
"specifies",
"the",
"underlying",
"logger",
"and",
"source",
"specifies",
"where",
"these",
"logs",
"are",
"coming",
"from",
";",
"it",
"is",
"added",
"as",
"a",
"entry",
"field",
"for",
"all",
"log",
"messages",
"."
]
| [
"func",
"NewGRPCLogWriter",
"(",
"logger",
"*",
"logrus",
".",
"Logger",
",",
"source",
"string",
")",
"*",
"GRPCLogWriter",
"{",
"return",
"&",
"GRPCLogWriter",
"{",
"logger",
":",
"logger",
",",
"<mask>",
":",
"source",
",",
"}",
"\n",
"}"
]
|
18,904 | all-18905 | [
"send",
"tries",
"to",
"send",
"an",
"event",
"specified",
"by",
"eventToSubmit",
"of",
"type",
"eventType",
"to",
"ECS"
]
| [
"func",
"(",
"event",
"*",
"sendableEvent",
")",
"send",
"(",
"sendStatusToECS",
"sendStatusChangeToECS",
",",
"setChangeSent",
"setStatusSent",
",",
"eventType",
"string",
",",
"client",
"api",
".",
"ECSClient",
",",
"eventToSubmit",
"*",
"<mask>",
".",
"Element",
",",
"stateSaver",
"statemanager",
".",
"Saver",
",",
"backoff",
"retry",
".",
"Backoff",
",",
"taskEvents",
"*",
"taskSendableEvents",
")",
"error",
"{",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"eventType",
",",
"event",
".",
"toString",
"(",
")",
")",
"\n",
"// Try submitting the change to ECS",
"if",
"err",
":=",
"sendStatusToECS",
"(",
"client",
",",
"event",
")",
";",
"err",
"!=",
"nil",
"{",
"seelog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"eventType",
",",
"event",
".",
"toString",
"(",
")",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"// submitted; ensure we don't retry it",
"event",
".",
"setSent",
"(",
")",
"\n",
"// Mark event as sent",
"setChangeSent",
"(",
"event",
")",
"\n",
"// Update the state file",
"stateSaver",
".",
"Save",
"(",
")",
"\n",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"event",
".",
"toString",
"(",
")",
")",
"\n",
"taskEvents",
".",
"events",
".",
"Remove",
"(",
"eventToSubmit",
")",
"\n",
"backoff",
".",
"Reset",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
18,905 | all-18906 | [
"Visit",
"calls",
"a",
"visitor",
"function",
"on",
"every",
"tree",
"node",
"intersecting",
"the",
"given",
"interval",
".",
"It",
"will",
"visit",
"each",
"interval",
"[",
"x",
"y",
")",
"in",
"ascending",
"order",
"sorted",
"on",
"x",
"."
]
| [
"func",
"(",
"ivt",
"*",
"IntervalTree",
")",
"Visit",
"(",
"ivl",
"Interval",
",",
"ivv",
"IntervalVisitor",
")",
"{",
"ivt",
".",
"<mask>",
".",
"visit",
"(",
"&",
"ivl",
",",
"func",
"(",
"n",
"*",
"intervalNode",
")",
"bool",
"{",
"return",
"ivv",
"(",
"&",
"n",
".",
"iv",
")",
"}",
")",
"\n",
"}"
]
|
18,906 | all-18907 | [
"HavePopupText",
"passes",
"when",
"the",
"expected",
"text",
"is",
"equivalent",
"to",
"the",
"text",
"contents",
"of",
"an",
"open",
"alert",
"confirm",
"or",
"prompt",
"popup",
"."
]
| [
"func",
"HavePopupText",
"(",
"text",
"string",
")",
"types",
".",
"GomegaMatcher",
"{",
"return",
"&",
"<mask>",
".",
"ValueMatcher",
"{",
"Method",
":",
"\"",
"\"",
",",
"Property",
":",
"\"",
"\"",
",",
"Expected",
":",
"text",
"}",
"\n",
"}"
]
|
18,907 | all-18908 | [
"LastError",
"returns",
"the",
"error",
"encountered",
"during",
"the",
"last",
"scrape",
"."
]
| [
"func",
"(",
"t",
"*",
"Target",
")",
"LastError",
"(",
")",
"error",
"{",
"t",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"defer",
"t",
".",
"mtx",
".",
"RUnlock",
"(",
")",
"\n\n",
"<mask>",
"t",
".",
"lastError",
"\n",
"}"
]
|
18,908 | all-18909 | [
"fill",
"all",
"or",
"part",
"of",
"buffer",
"object",
"s",
"data",
"store",
"with",
"a",
"fixed",
"value"
]
| [
"func",
"ClearBufferSubData",
"(",
"target",
"uint32",
",",
"internalformat",
"uint32",
",",
"offset",
"int",
",",
"size",
"int",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"data",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall9",
"(",
"gpClearBufferSubData",
",",
"7",
",",
"uintptr",
"(",
"target",
")",
",",
"uintptr",
"(",
"internalformat",
")",
",",
"uintptr",
"(",
"offset",
")",
",",
"uintptr",
"(",
"size",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"xtype",
")",
",",
"uintptr",
"(",
"data",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
]
|
18,909 | all-18910 | [
"String",
"returns",
"the",
"human",
"-",
"friendly",
"version",
"of",
"this",
"dependency",
"."
]
| [
"func",
"(",
"d",
"*",
"KVGetQuery",
")",
"String",
"(",
")",
"string",
"{",
"key",
":=",
"d",
".",
"key",
"\n",
"if",
"d",
".",
"dc",
"!=",
"\"",
"\"",
"{",
"<mask>",
"=",
"key",
"+",
"\"",
"\"",
"+",
"d",
".",
"dc",
"\n",
"}",
"\n\n",
"if",
"d",
".",
"block",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"key",
")",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"key",
")",
"\n",
"}"
]
|
18,910 | all-18911 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"Error",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdproto2",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
18,911 | all-18912 | [
"Do",
"executes",
"HeapProfiler",
".",
"stopTrackingHeapObjects",
"against",
"the",
"provided",
"context",
"."
]
| [
"func",
"(",
"p",
"*",
"StopTrackingHeapObjectsParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandStopTrackingHeapObjects",
",",
"p",
",",
"nil",
")",
"\n",
"}"
]
|
18,912 | all-18913 | [
"NormalizePath",
"is",
"a",
"SchemaStateFunc",
"that",
"normalizes",
"a",
"folder",
"path",
"."
]
| [
"func",
"NormalizePath",
"(",
"v",
"interface",
"{",
"}",
")",
"string",
"{",
"p",
":=",
"v",
".",
"(",
"string",
")",
"\n",
"if",
"PathIsEmpty",
"(",
"p",
")",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"strings",
".",
"TrimPrefix",
"(",
"<mask>",
".",
"Clean",
"(",
"p",
")",
",",
"\"",
"\"",
")",
"\n",
"}"
]
|
18,913 | all-18914 | [
"AddAll",
"adds",
"all",
"values",
"to",
"the",
"set",
"distinctly",
"."
]
| [
"func",
"(",
"s",
"*",
"Set",
")",
"AddAll",
"(",
"values",
"...",
"<mask>",
"{",
"}",
")",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"for",
"_",
",",
"value",
":=",
"range",
"values",
"{",
"s",
".",
"m",
"[",
"value",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"}"
]
|
18,914 | all-18915 | [
"Read",
"logger",
"flags",
"from",
"the",
"LOGFLAGS",
"environment",
"variable",
".",
"Multiple",
"flags",
"can",
"be",
"set",
"at",
"once",
"separated",
"by",
"commas",
"."
]
| [
"func",
"init",
"(",
")",
"{",
"for",
"_",
",",
"f",
":=",
"range",
"strings",
".",
"Split",
"(",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
",",
"\"",
"\"",
")",
"{",
"<mask>",
"f",
"{",
"case",
"\"",
"\"",
":",
"defaultFlags",
"|=",
"Llongfile",
"\n",
"case",
"\"",
"\"",
":",
"defaultFlags",
"|=",
"Lshortfile",
"\n",
"}",
"\n",
"}",
"\n",
"}"
]
|
18,915 | all-18916 | [
"UnmarshalYAML",
"implements",
"the",
"yaml",
".",
"Unmarshaler",
"interface",
"."
]
| [
"func",
"(",
"c",
"*",
"Config",
")",
"UnmarshalYAML",
"(",
"unmarshal",
"func",
"(",
"interface",
"{",
"}",
")",
"error",
")",
"error",
"{",
"*",
"c",
"=",
"DefaultConfig",
"\n",
"// We want to set c to the defaults and then overwrite it with the input.",
"// To make unmarshal fill the plain data struct rather than calling UnmarshalYAML",
"// again, we have to hide it using a type indirection.",
"<mask>",
"plain",
"Config",
"\n",
"if",
"err",
":=",
"unmarshal",
"(",
"(",
"*",
"plain",
")",
"(",
"c",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// If a global block was open but empty the default global config is overwritten.",
"// We have to restore it here.",
"if",
"c",
".",
"GlobalConfig",
".",
"isZero",
"(",
")",
"{",
"c",
".",
"GlobalConfig",
"=",
"DefaultGlobalConfig",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"rf",
":=",
"range",
"c",
".",
"RuleFiles",
"{",
"if",
"!",
"patRulePath",
".",
"MatchString",
"(",
"rf",
")",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"rf",
")",
"\n",
"}",
"\n",
"}",
"\n",
"// Do global overrides and validate unique names.",
"jobNames",
":=",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
"{",
"}",
"\n",
"for",
"_",
",",
"scfg",
":=",
"range",
"c",
".",
"ScrapeConfigs",
"{",
"if",
"scfg",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"// First set the correct scrape interval, then check that the timeout",
"// (inferred or explicit) is not greater than that.",
"if",
"scfg",
".",
"ScrapeInterval",
"==",
"0",
"{",
"scfg",
".",
"ScrapeInterval",
"=",
"c",
".",
"GlobalConfig",
".",
"ScrapeInterval",
"\n",
"}",
"\n",
"if",
"scfg",
".",
"ScrapeTimeout",
">",
"scfg",
".",
"ScrapeInterval",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"scfg",
".",
"JobName",
")",
"\n",
"}",
"\n",
"if",
"scfg",
".",
"ScrapeTimeout",
"==",
"0",
"{",
"if",
"c",
".",
"GlobalConfig",
".",
"ScrapeTimeout",
">",
"scfg",
".",
"ScrapeInterval",
"{",
"scfg",
".",
"ScrapeTimeout",
"=",
"scfg",
".",
"ScrapeInterval",
"\n",
"}",
"else",
"{",
"scfg",
".",
"ScrapeTimeout",
"=",
"c",
".",
"GlobalConfig",
".",
"ScrapeTimeout",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"jobNames",
"[",
"scfg",
".",
"JobName",
"]",
";",
"ok",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"scfg",
".",
"JobName",
")",
"\n",
"}",
"\n",
"jobNames",
"[",
"scfg",
".",
"JobName",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"rwcfg",
":=",
"range",
"c",
".",
"RemoteWriteConfigs",
"{",
"if",
"rwcfg",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"rrcfg",
":=",
"range",
"c",
".",
"RemoteReadConfigs",
"{",
"if",
"rrcfg",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
18,916 | all-18917 | [
"Event",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_widget_event",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Widget",
")",
"Event",
"(",
"event",
"*",
"gdk",
".",
"<mask>",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_widget_event",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"GdkEvent",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"event",
".",
"Native",
"(",
")",
")",
")",
")",
"\n",
"return",
"gobool",
"(",
"c",
")",
"\n",
"}"
]
|
18,917 | all-18918 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"FrameWithManifest",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache7",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
18,918 | all-18919 | [
"StreamServerInterceptor",
"logs",
"streaming",
"RPCs",
"on",
"the",
"server",
"side"
]
| [
"func",
"StreamServerInterceptor",
"(",
"log",
"ttnlog",
".",
"Interface",
")",
"grpc",
".",
"StreamServerInterceptor",
"{",
"return",
"func",
"(",
"srv",
"interface",
"{",
"}",
",",
"ss",
"grpc",
".",
"ServerStream",
",",
"info",
"*",
"grpc",
".",
"StreamServerInfo",
",",
"handler",
"grpc",
".",
"StreamHandler",
")",
"(",
"err",
"error",
")",
"{",
"log",
":=",
"getLog",
"(",
"log",
")",
".",
"WithField",
"(",
"\"",
"\"",
",",
"info",
".",
"FullMethod",
")",
"\n",
"log",
"=",
"log",
".",
"WithFields",
"(",
"FieldsFromIncomingContext",
"(",
"ss",
".",
"<mask>",
"(",
")",
")",
")",
"\n",
"start",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"log",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"err",
"=",
"handler",
"(",
"srv",
",",
"ss",
")",
"\n",
"log",
"=",
"log",
".",
"WithField",
"(",
"\"",
"\"",
",",
"time",
".",
"Since",
"(",
"start",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"context",
".",
"Canceled",
"||",
"grpc",
".",
"Code",
"(",
"err",
")",
"==",
"codes",
".",
"Canceled",
"{",
"log",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"log",
".",
"WithError",
"(",
"err",
")",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"log",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}"
]
|
18,919 | all-18920 | [
"watchFiles",
"sets",
"watches",
"on",
"all",
"full",
"paths",
"or",
"directories",
"that",
"were",
"configured",
"for",
"this",
"file",
"discovery",
"."
]
| [
"func",
"(",
"d",
"*",
"Discovery",
")",
"watchFiles",
"(",
")",
"{",
"if",
"d",
".",
"watcher",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"d",
".",
"paths",
"{",
"if",
"idx",
":=",
"strings",
".",
"LastIndex",
"(",
"p",
",",
"\"",
"\"",
")",
";",
"idx",
">",
"-",
"1",
"{",
"p",
"=",
"p",
"[",
":",
"idx",
"]",
"\n",
"}",
"else",
"{",
"p",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"err",
":=",
"d",
".",
"watcher",
".",
"Add",
"(",
"p",
")",
";",
"err",
"!=",
"nil",
"{",
"level",
".",
"Error",
"(",
"d",
".",
"logger",
")",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"p",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
]
|
18,920 | all-18921 | [
"Prepend",
"is",
"a",
"wrapper",
"around",
"g_list_prepend",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"List",
")",
"Prepend",
"(",
"data",
"uintptr",
")",
"*",
"<mask>",
"{",
"glist",
":=",
"C",
".",
"g_list_prepend",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gpointer",
"(",
"data",
")",
")",
"\n",
"return",
"v",
".",
"wrapNewHead",
"(",
"glist",
")",
"\n",
"}"
]
|
18,921 | all-18922 | [
"GetMenubar",
"is",
"a",
"wrapper",
"around",
"gtk_application_get_menubar",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetMenubar",
"(",
")",
"*",
"glib",
".",
"MenuModel",
"{",
"c",
":=",
"C",
".",
"gtk_application_get_menubar",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"&",
"glib",
".",
"MenuModel",
"{",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"}",
"\n",
"}"
]
|
18,922 | all-18923 | [
"closeRequireLeader",
"scans",
"keepAlives",
"for",
"ctxs",
"that",
"have",
"require",
"leader",
"and",
"closes",
"the",
"associated",
"channels",
"."
]
| [
"func",
"(",
"l",
"*",
"lessor",
")",
"closeRequireLeader",
"(",
")",
"{",
"l",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"for",
"_",
",",
"ka",
":=",
"range",
"l",
".",
"keepAlives",
"{",
"reqIdxs",
":=",
"0",
"\n",
"// find all required leader channels, close, mark as nil",
"for",
"i",
",",
"ctx",
":=",
"range",
"ka",
".",
"ctxs",
"{",
"md",
",",
"ok",
":=",
"metadata",
".",
"FromOutgoingContext",
"(",
"ctx",
")",
"\n",
"if",
"!",
"ok",
"{",
"continue",
"\n",
"}",
"\n",
"ks",
":=",
"md",
"[",
"rpctypes",
".",
"MetadataRequireLeaderKey",
"]",
"\n",
"if",
"len",
"(",
"ks",
")",
"<",
"1",
"||",
"<mask>",
"[",
"0",
"]",
"!=",
"rpctypes",
".",
"MetadataHasLeader",
"{",
"continue",
"\n",
"}",
"\n",
"close",
"(",
"ka",
".",
"chs",
"[",
"i",
"]",
")",
"\n",
"ka",
".",
"chs",
"[",
"i",
"]",
"=",
"nil",
"\n",
"reqIdxs",
"++",
"\n",
"}",
"\n",
"if",
"reqIdxs",
"==",
"0",
"{",
"continue",
"\n",
"}",
"\n",
"// remove all channels that required a leader from keepalive",
"newChs",
":=",
"make",
"(",
"[",
"]",
"chan",
"<-",
"*",
"LeaseKeepAliveResponse",
",",
"len",
"(",
"ka",
".",
"chs",
")",
"-",
"reqIdxs",
")",
"\n",
"newCtxs",
":=",
"make",
"(",
"[",
"]",
"context",
".",
"Context",
",",
"len",
"(",
"newChs",
")",
")",
"\n",
"newIdx",
":=",
"0",
"\n",
"for",
"i",
":=",
"range",
"ka",
".",
"chs",
"{",
"if",
"ka",
".",
"chs",
"[",
"i",
"]",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"newChs",
"[",
"newIdx",
"]",
",",
"newCtxs",
"[",
"newIdx",
"]",
"=",
"ka",
".",
"chs",
"[",
"i",
"]",
",",
"ka",
".",
"ctxs",
"[",
"newIdx",
"]",
"\n",
"newIdx",
"++",
"\n",
"}",
"\n",
"ka",
".",
"chs",
",",
"ka",
".",
"ctxs",
"=",
"newChs",
",",
"newCtxs",
"\n",
"}",
"\n",
"}"
]
|
18,923 | all-18924 | [
"MapContainerToTaskStatus",
"maps",
"the",
"container",
"status",
"to",
"the",
"corresponding",
"task",
"status",
".",
"The",
"transition",
"map",
"is",
"illustrated",
"below",
".",
"Container",
":",
"None",
"-",
">",
"Pulled",
"-",
">",
"Created",
"-",
">",
"Running",
"-",
">",
"Provisioned",
"-",
">",
"Stopped",
"-",
">",
"Zombie",
"Task",
":",
"None",
"-",
">",
"Created",
"-",
">",
"Running",
"-",
">",
"Stopped"
]
| [
"func",
"MapContainerToTaskStatus",
"(",
"knownState",
"apicontainerstatus",
".",
"ContainerStatus",
",",
"steadyState",
"apicontainerstatus",
".",
"ContainerStatus",
")",
"TaskStatus",
"{",
"switch",
"knownState",
"{",
"<mask>",
"apicontainerstatus",
".",
"ContainerStatusNone",
":",
"return",
"TaskStatusNone",
"\n",
"case",
"steadyState",
":",
"return",
"TaskRunning",
"\n",
"case",
"apicontainerstatus",
".",
"ContainerCreated",
":",
"return",
"TaskCreated",
"\n",
"case",
"apicontainerstatus",
".",
"ContainerStopped",
":",
"return",
"TaskStopped",
"\n",
"}",
"\n\n",
"if",
"knownState",
"==",
"apicontainerstatus",
".",
"ContainerRunning",
"&&",
"steadyState",
"==",
"apicontainerstatus",
".",
"ContainerResourcesProvisioned",
"{",
"return",
"TaskCreated",
"\n",
"}",
"\n\n",
"return",
"TaskStatusNone",
"\n",
"}"
]
|
18,924 | all-18925 | [
"SetBSON",
"sets",
"the",
"Duration",
"from",
"raw",
"bson",
"data"
]
| [
"func",
"(",
"d",
"*",
"Duration",
")",
"SetBSON",
"(",
"raw",
"bson",
".",
"Raw",
")",
"error",
"{",
"var",
"m",
"bson",
".",
"M",
"\n",
"if",
"err",
":=",
"raw",
".",
"Unmarshal",
"(",
"&",
"m",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"data",
",",
"ok",
":=",
"m",
"[",
"\"",
"\"",
"]",
".",
"(",
"int64",
")",
";",
"ok",
"{",
"*",
"d",
"=",
"Duration",
"(",
"data",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}"
]
|
18,925 | all-18926 | [
"/",
"1",
".",
"0",
"/",
"storage",
"-",
"pools",
"/",
"{",
"pool",
"}",
"/",
"volumes",
"/",
"{",
"type",
"}",
"/",
"{",
"name",
"}"
]
| [
"func",
"storagePoolVolumeTypePut",
"(",
"d",
"*",
"Daemon",
",",
"r",
"*",
"http",
".",
"Request",
",",
"volumeTypeName",
"string",
")",
"Response",
"{",
"// Get the name of the storage volume.",
"var",
"volumeName",
"string",
"\n",
"fields",
":=",
"strings",
".",
"Split",
"(",
"mux",
".",
"Vars",
"(",
"r",
")",
"[",
"\"",
"\"",
"]",
",",
"\"",
"\"",
")",
"\n\n",
"if",
"len",
"(",
"fields",
")",
"==",
"3",
"&&",
"fields",
"[",
"1",
"]",
"==",
"\"",
"\"",
"{",
"// Handle volume snapshots",
"volumeName",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"fields",
"[",
"0",
"]",
",",
"<mask>",
".",
"SnapshotDelimiter",
",",
"fields",
"[",
"2",
"]",
")",
"\n",
"}",
"else",
"if",
"len",
"(",
"fields",
")",
">",
"1",
"{",
"volumeName",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"fields",
"[",
"0",
"]",
",",
"shared",
".",
"SnapshotDelimiter",
",",
"fields",
"[",
"1",
"]",
")",
"\n",
"}",
"else",
"if",
"len",
"(",
"fields",
")",
">",
"0",
"{",
"// Handle volume",
"volumeName",
"=",
"fields",
"[",
"0",
"]",
"\n",
"}",
"else",
"{",
"return",
"BadRequest",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"mux",
".",
"Vars",
"(",
"r",
")",
"[",
"\"",
"\"",
"]",
")",
")",
"\n",
"}",
"\n\n",
"// Get the name of the storage pool the volume is supposed to be",
"// attached to.",
"poolName",
":=",
"mux",
".",
"Vars",
"(",
"r",
")",
"[",
"\"",
"\"",
"]",
"\n\n",
"// Convert the volume type name to our internal integer representation.",
"volumeType",
",",
"err",
":=",
"storagePoolVolumeTypeNameToType",
"(",
"volumeTypeName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"BadRequest",
"(",
"err",
")",
"\n",
"}",
"\n",
"// Check that the storage volume type is valid.",
"if",
"!",
"shared",
".",
"IntInSlice",
"(",
"volumeType",
",",
"supportedVolumeTypes",
")",
"{",
"return",
"BadRequest",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"volumeTypeName",
")",
")",
"\n",
"}",
"\n\n",
"poolID",
",",
"pool",
",",
"err",
":=",
"d",
".",
"cluster",
".",
"StoragePoolGet",
"(",
"poolName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"response",
":=",
"ForwardedResponseIfTargetIsRemote",
"(",
"d",
",",
"r",
")",
"\n",
"if",
"response",
"!=",
"nil",
"{",
"return",
"response",
"\n",
"}",
"\n\n",
"response",
"=",
"ForwardedResponseIfVolumeIsRemote",
"(",
"d",
",",
"r",
",",
"poolID",
",",
"volumeName",
",",
"volumeType",
")",
"\n",
"if",
"response",
"!=",
"nil",
"{",
"return",
"response",
"\n",
"}",
"\n\n",
"// Get the existing storage volume.",
"_",
",",
"volume",
",",
"err",
":=",
"d",
".",
"cluster",
".",
"StoragePoolNodeVolumeGetType",
"(",
"volumeName",
",",
"volumeType",
",",
"poolID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"// Validate the ETag",
"etag",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"volumeName",
",",
"volume",
".",
"Type",
",",
"volume",
".",
"Config",
"}",
"\n\n",
"err",
"=",
"util",
".",
"EtagCheck",
"(",
"r",
",",
"etag",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"PreconditionFailed",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"req",
":=",
"api",
".",
"StorageVolumePut",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"NewDecoder",
"(",
"r",
".",
"Body",
")",
".",
"Decode",
"(",
"&",
"req",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"BadRequest",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"req",
".",
"Restore",
"!=",
"\"",
"\"",
"{",
"ctsUsingVolume",
",",
"err",
":=",
"storagePoolVolumeUsedByRunningContainersWithProfilesGet",
"(",
"d",
".",
"State",
"(",
")",
",",
"poolName",
",",
"volume",
".",
"Name",
",",
"storagePoolVolumeTypeNameCustom",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"InternalError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"ctsUsingVolume",
")",
"!=",
"0",
"{",
"return",
"BadRequest",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"err",
"=",
"storagePoolVolumeRestore",
"(",
"d",
".",
"State",
"(",
")",
",",
"poolName",
",",
"volumeName",
",",
"volumeType",
",",
"req",
".",
"Restore",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"// Validate the configuration",
"err",
"=",
"storageVolumeValidateConfig",
"(",
"volumeName",
",",
"req",
".",
"Config",
",",
"pool",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"BadRequest",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"err",
"=",
"storagePoolVolumeUpdate",
"(",
"d",
".",
"State",
"(",
")",
",",
"poolName",
",",
"volumeName",
",",
"volumeType",
",",
"req",
".",
"Description",
",",
"req",
".",
"Config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"EmptySyncResponse",
"\n",
"}"
]
|
18,926 | all-18927 | [
"HasTitleAlign",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"s",
"*",
"ScatterplotDefinition",
")",
"HasTitleAlign",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"TitleAlign",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
18,927 | all-18928 | [
"GetTypeOk",
"returns",
"a",
"tuple",
"with",
"the",
"Type",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"d",
"*",
"DistributionDefinition",
")",
"GetTypeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"d",
"==",
"nil",
"||",
"d",
".",
"Type",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"d",
".",
"<mask>",
",",
"true",
"\n",
"}"
]
|
18,928 | all-18929 | [
"NewPuller",
"creates",
"a",
"new",
"Puller",
"struct",
"."
]
| [
"func",
"NewPuller",
"(",
")",
"*",
"Puller",
"{",
"return",
"&",
"Puller",
"{",
"errCh",
":",
"<mask>",
"(",
"chan",
"error",
",",
"1",
")",
",",
"pipes",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
",",
"}",
"\n",
"}"
]
|
18,929 | all-18930 | [
"RemoveDuplicatesFromString",
"removes",
"all",
"duplicates",
"of",
"the",
"string",
"sep",
"from",
"the",
"specified",
"string",
"s",
".",
"Leading",
"and",
"trailing",
"occurrences",
"of",
"sep",
"are",
"NOT",
"removed",
"(",
"duplicate",
"leading",
"/",
"trailing",
"are",
")",
".",
"Performs",
"poorly",
"if",
"there",
"are",
"multiple",
"consecutive",
"redundant",
"separators",
"."
]
| [
"func",
"RemoveDuplicatesFromString",
"(",
"s",
"string",
",",
"sep",
"string",
")",
"<mask>",
"{",
"dup",
":=",
"sep",
"+",
"sep",
"\n",
"for",
"s",
"=",
"strings",
".",
"Replace",
"(",
"s",
",",
"dup",
",",
"sep",
",",
"-",
"1",
")",
";",
"strings",
".",
"Contains",
"(",
"s",
",",
"dup",
")",
";",
"s",
"=",
"strings",
".",
"Replace",
"(",
"s",
",",
"dup",
",",
"sep",
",",
"-",
"1",
")",
"{",
"}",
"\n",
"return",
"s",
"\n",
"}"
]
|
18,930 | all-18931 | [
"GetExecutionStoppedAt",
"returns",
"the",
"task",
"executionStoppedAt",
"timestamp"
]
| [
"func",
"(",
"task",
"*",
"Task",
")",
"GetExecutionStoppedAt",
"(",
")",
"<mask>",
".",
"Time",
"{",
"task",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"task",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"task",
".",
"ExecutionStoppedAtUnsafe",
"\n",
"}"
]
|
18,931 | all-18932 | [
"Align",
"rounds",
"a",
"up",
"to",
"a",
"multiple",
"of",
"x",
".",
"x",
"must",
"be",
"a",
"power",
"of",
"2",
"."
]
| [
"func",
"(",
"a",
"<mask>",
")",
"Align",
"(",
"x",
"int64",
")",
"Address",
"{",
"return",
"(",
"a",
"+",
"Address",
"(",
"x",
")",
"-",
"1",
")",
"&",
"^",
"(",
"Address",
"(",
"x",
")",
"-",
"1",
")",
"\n",
"}"
]
|
18,932 | all-18933 | [
"Add",
"a",
"new",
"task",
"to",
"the",
"group",
"returning",
"its",
"index",
"."
]
| [
"func",
"(",
"g",
"*",
"Group",
")",
"Add",
"(",
"f",
"Func",
",",
"schedule",
"Schedule",
")",
"*",
"Task",
"{",
"i",
":=",
"len",
"(",
"g",
".",
"tasks",
")",
"\n",
"g",
".",
"tasks",
"=",
"append",
"(",
"g",
".",
"tasks",
",",
"Task",
"{",
"f",
":",
"f",
",",
"schedule",
":",
"schedule",
",",
"<mask>",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
",",
"16",
")",
",",
"// Buffered to not block senders",
"}",
")",
"\n",
"return",
"&",
"g",
".",
"tasks",
"[",
"i",
"]",
"\n",
"}"
]
|
18,933 | all-18934 | [
"Finish",
"must",
"be",
"called",
"on",
"every",
"message",
"received",
"from",
"a",
"consumer",
"to",
"let",
"the",
"NSQ",
"server",
"know",
"that",
"the",
"message",
"was",
"successfully",
"processed",
".",
"One",
"of",
"Finish",
"or",
"Requeue",
"should",
"be",
"called",
"on",
"every",
"message",
"and",
"the",
"methods",
"will",
"panic",
"if",
"they",
"are",
"called",
"more",
"than",
"once",
"."
]
| [
"func",
"(",
"m",
"*",
"Message",
")",
"Finish",
"(",
")",
"{",
"if",
"m",
".",
"Complete",
"(",
")",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"recover",
"(",
")",
"}",
"(",
")",
"// the connection may have been closed asynchronously",
"\n",
"m",
".",
"cmdChan",
"<-",
"Fin",
"{",
"MessageID",
":",
"m",
".",
"<mask>",
"}",
"\n",
"m",
".",
"cmdChan",
"=",
"nil",
"\n",
"}"
]
|
18,934 | all-18935 | [
"NewTallyReporter",
"takes",
"a",
"tally",
".",
"Scope",
"and",
"wraps",
"it",
"so",
"it",
"ca",
"be",
"used",
"as",
"a",
"StatsReporter",
".",
"The",
"list",
"of",
"metrics",
"emitted",
"is",
"documented",
"on",
":",
"https",
":",
"//",
"tchannel",
".",
"readthedocs",
".",
"io",
"/",
"en",
"/",
"latest",
"/",
"metrics",
"/",
"The",
"metrics",
"emitted",
"are",
"similar",
"to",
"YARPC",
"the",
"tags",
"emitted",
"are",
":",
"source",
"dest",
"procedure",
"and",
"retry",
"-",
"count",
"."
]
| [
"func",
"NewTallyReporter",
"(",
"scope",
"tally",
".",
"Scope",
")",
"tchannel",
".",
"StatsReporter",
"{",
"return",
"&",
"wrapper",
"{",
"scope",
":",
"scope",
",",
"byTags",
":",
"make",
"(",
"<mask>",
"[",
"knownTags",
"]",
"*",
"taggedScope",
")",
",",
"}",
"\n",
"}"
]
|
18,935 | all-18936 | [
"NewPRSignedByKeyData",
"returns",
"a",
"new",
"signedBy",
"PolicyRequirement",
"using",
"a",
"KeyData"
]
| [
"func",
"NewPRSignedByKeyData",
"(",
"keyType",
"sbKeyType",
",",
"keyData",
"[",
"]",
"<mask>",
",",
"signedIdentity",
"PolicyReferenceMatch",
")",
"(",
"PolicyRequirement",
",",
"error",
")",
"{",
"return",
"newPRSignedByKeyData",
"(",
"keyType",
",",
"keyData",
",",
"signedIdentity",
")",
"\n",
"}"
]
|
18,936 | all-18937 | [
"GetBoolPtr",
"reads",
"a",
"ResourceData",
"and",
"returns",
"an",
"appropriate",
"*",
"bool",
"for",
"the",
"state",
"of",
"the",
"definition",
".",
"nil",
"is",
"returned",
"if",
"it",
"does",
"not",
"exist",
"."
]
| [
"func",
"GetBoolPtr",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"<mask>",
"string",
")",
"*",
"bool",
"{",
"v",
",",
"e",
":=",
"d",
".",
"GetOkExists",
"(",
"key",
")",
"\n",
"if",
"e",
"{",
"return",
"BoolPtr",
"(",
"v",
".",
"(",
"bool",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
18,937 | all-18938 | [
"SetAddr",
"sets",
"the",
"servers",
"address",
"if",
"it",
"hasn",
"t",
"already",
"been",
"set"
]
| [
"func",
"(",
"s",
"*",
"Listener",
")",
"SetAddr",
"(",
"addr",
"string",
")",
"{",
"if",
"s",
".",
"<mask>",
".",
"Addr",
"==",
"\"",
"\"",
"{",
"s",
".",
"Server",
".",
"Addr",
"=",
"addr",
"\n",
"}",
"\n",
"}"
]
|
18,938 | all-18939 | [
"Announce",
"to",
"a",
"peer",
"if",
"appropriate",
"."
]
| [
"func",
"(",
"a",
"*",
"Announce",
")",
"maybeAnnouncePeer",
"(",
"to",
"Addr",
",",
"<mask>",
"*",
"string",
",",
"peerId",
"*",
"krpc",
".",
"ID",
")",
"{",
"if",
"token",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"if",
"!",
"a",
".",
"server",
".",
"config",
".",
"NoSecurity",
"&&",
"(",
"peerId",
"==",
"nil",
"||",
"!",
"NodeIdSecure",
"(",
"*",
"peerId",
",",
"to",
".",
"IP",
"(",
")",
")",
")",
"{",
"return",
"\n",
"}",
"\n",
"a",
".",
"server",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"a",
".",
"server",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"a",
".",
"server",
".",
"announcePeer",
"(",
"to",
",",
"a",
".",
"infoHash",
",",
"a",
".",
"announcePort",
",",
"*",
"token",
",",
"a",
".",
"announcePortImplied",
",",
"nil",
")",
"\n",
"}"
]
|
18,939 | all-18940 | [
"Wrap",
"wraps",
"the",
"error",
"with",
"the",
"key",
"/",
"value",
"pairs",
"copied",
"from",
"the",
"list",
"and",
"the",
"optional",
"text",
"."
]
| [
"func",
"(",
"l",
"List",
")",
"Wrap",
"(",
"err",
"error",
",",
"text",
"...",
"string",
")",
"Error",
"{",
"e",
":=",
"newError",
"(",
"nil",
",",
"err",
",",
"text",
"...",
")",
"\n",
"e",
".",
"<mask>",
"=",
"l",
"\n",
"return",
"causer",
"(",
"e",
")",
"\n",
"}"
]
|
18,940 | all-18941 | [
"SetDefaultPageSetup",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_operation_set_default_page_setup",
"()",
"."
]
| [
"func",
"(",
"po",
"*",
"PrintOperation",
")",
"SetDefaultPageSetup",
"(",
"ps",
"*",
"PageSetup",
")",
"{",
"C",
".",
"gtk_print_operation_set_default_page_setup",
"(",
"po",
".",
"native",
"(",
")",
",",
"<mask>",
".",
"native",
"(",
")",
")",
"\n",
"}"
]
|
18,941 | all-18942 | [
"DeleteStaleComments",
"iterates",
"over",
"comments",
"on",
"an",
"issue",
"/",
"PR",
"deleting",
"those",
"which",
"the",
"isStale",
"function",
"identifies",
"as",
"stale",
".",
"If",
"comments",
"is",
"nil",
"the",
"comments",
"will",
"be",
"fetched",
"from",
"GitHub",
"."
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteStaleComments",
"(",
"org",
",",
"repo",
"string",
",",
"number",
"int",
",",
"comments",
"[",
"]",
"IssueComment",
",",
"isStale",
"func",
"(",
"IssueComment",
")",
"bool",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"if",
"comments",
"==",
"nil",
"{",
"comments",
",",
"err",
"=",
"c",
".",
"ListIssueComments",
"(",
"org",
",",
"repo",
",",
"number",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"comment",
":=",
"range",
"comments",
"{",
"if",
"isStale",
"(",
"comment",
")",
"{",
"if",
"err",
":=",
"c",
".",
"DeleteComment",
"(",
"org",
",",
"repo",
",",
"comment",
".",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"comment",
".",
"ID",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
18,942 | all-18943 | [
"Uintptr",
"returns",
"the",
"uintptr",
"value",
"stored",
"in",
"r",
"."
]
| [
"func",
"(",
"r",
"region",
")",
"Uintptr",
"(",
")",
"uint64",
"{",
"if",
"r",
".",
"typ",
".",
"Kind",
"!=",
"KindUint",
"||",
"r",
".",
"typ",
".",
"Size",
"!=",
"r",
".",
"p",
".",
"proc",
".",
"PtrSize",
"(",
")",
"{",
"panic",
"(",
"\"",
"\"",
"+",
"r",
".",
"typ",
".",
"<mask>",
")",
"\n",
"}",
"\n",
"return",
"r",
".",
"p",
".",
"proc",
".",
"ReadUintptr",
"(",
"r",
".",
"a",
")",
"\n",
"}"
]
|
18,943 | all-18944 | [
"MustEd25519",
"retrieves",
"the",
"Ed25519",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
]
| [
"func",
"(",
"u",
"PublicKey",
")",
"MustEd25519",
"(",
")",
"Uint256",
"{",
"val",
",",
"<mask>",
":=",
"u",
".",
"GetEd25519",
"(",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
]
|
18,944 | all-18945 | [
"withStackTrace",
"logs",
"the",
"stack",
"trace",
"in",
"case",
"the",
"request",
"panics",
".",
"The",
"function",
"will",
"re",
"-",
"raise",
"the",
"error",
"which",
"will",
"then",
"be",
"handled",
"by",
"the",
"net",
"/",
"http",
"package",
".",
"It",
"is",
"needed",
"because",
"the",
"go",
"-",
"kit",
"log",
"package",
"doesn",
"t",
"manage",
"properly",
"the",
"panics",
"from",
"net",
"/",
"http",
"(",
"see",
"https",
":",
"//",
"github",
".",
"com",
"/",
"go",
"-",
"kit",
"/",
"kit",
"/",
"issues",
"/",
"233",
")",
"."
]
| [
"func",
"withStackTracer",
"(",
"h",
"<mask>",
".",
"Handler",
",",
"l",
"log",
".",
"Logger",
")",
"http",
".",
"Handler",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
":=",
"recover",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"const",
"size",
"=",
"64",
"<<",
"10",
"\n",
"buf",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"size",
")",
"\n",
"buf",
"=",
"buf",
"[",
":",
"runtime",
".",
"Stack",
"(",
"buf",
",",
"false",
")",
"]",
"\n",
"level",
".",
"Error",
"(",
"l",
")",
".",
"Log",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"r",
".",
"RemoteAddr",
",",
"\"",
"\"",
",",
"r",
".",
"URL",
",",
"\"",
"\"",
",",
"err",
",",
"\"",
"\"",
",",
"buf",
")",
"\n",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"h",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"}",
")",
"\n",
"}"
]
|
18,945 | all-18946 | [
"decodeResponses",
"is",
"a",
"long",
"running",
"routine",
"that",
"decodes",
"the",
"responses",
"sent",
"on",
"the",
"connection",
"."
]
| [
"func",
"(",
"n",
"*",
"netPipeline",
")",
"decodeResponses",
"(",
")",
"{",
"timeout",
":=",
"n",
".",
"trans",
".",
"timeout",
"\n",
"for",
"{",
"select",
"{",
"case",
"future",
":=",
"<-",
"n",
".",
"inprogressCh",
":",
"if",
"timeout",
">",
"0",
"{",
"n",
".",
"conn",
".",
"conn",
".",
"SetReadDeadline",
"(",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"timeout",
")",
")",
"\n",
"}",
"\n\n",
"_",
",",
"err",
":=",
"decodeResponse",
"(",
"n",
".",
"<mask>",
",",
"future",
".",
"resp",
")",
"\n",
"future",
".",
"respond",
"(",
"err",
")",
"\n",
"select",
"{",
"case",
"n",
".",
"doneCh",
"<-",
"future",
":",
"case",
"<-",
"n",
".",
"shutdownCh",
":",
"return",
"\n",
"}",
"\n",
"case",
"<-",
"n",
".",
"shutdownCh",
":",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
]
|
18,946 | all-18947 | [
"UpdateProject",
"updates",
"the",
"project",
"to",
"match",
"the",
"provided",
"Project",
"struct"
]
| [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"UpdateProject",
"(",
"name",
"string",
",",
"<mask>",
"api",
".",
"ProjectPut",
",",
"ETag",
"string",
")",
"error",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Send the request",
"_",
",",
"_",
",",
"err",
":=",
"r",
".",
"query",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"name",
")",
")",
",",
"project",
",",
"ETag",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
18,947 | all-18948 | [
"Login",
"handles",
"the",
"login",
"API",
"call",
"to",
"the",
"User",
"Service",
"."
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"login",
"(",
"username",
"string",
",",
"password",
"string",
")",
"(",
"*",
"ex",
".",
"User",
",",
"error",
")",
"{",
"loginRequest",
":=",
"fmt",
".",
"Sprintf",
"(",
"`\n {\n \"username\":\"%s\",\n \"password\": \"%s\"\n }`",
",",
"username",
",",
"password",
")",
"\n\n",
"<mask>",
",",
"err",
":=",
"http",
".",
"Post",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
".",
"Host",
")",
",",
"\"",
"\"",
",",
"bytes",
".",
"NewReader",
"(",
"[",
"]",
"byte",
"(",
"loginRequest",
")",
")",
")",
"\n",
"if",
"res",
".",
"StatusCode",
"!=",
"200",
"||",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"res",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"response",
"loginResponse",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"response",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"response",
".",
"User",
",",
"err",
"\n",
"}"
]
|
18,948 | all-18949 | [
"IsKnownSteadyState",
"returns",
"true",
"if",
"the",
"KnownState",
"of",
"the",
"container",
"equals",
"the",
"steadyState",
"defined",
"for",
"the",
"container"
]
| [
"func",
"(",
"c",
"*",
"<mask>",
")",
"IsKnownSteadyState",
"(",
")",
"bool",
"{",
"knownStatus",
":=",
"c",
".",
"GetKnownStatus",
"(",
")",
"\n",
"return",
"knownStatus",
"==",
"c",
".",
"GetSteadyStateStatus",
"(",
")",
"\n",
"}"
]
|
18,949 | all-18950 | [
"DiffProfiles",
"returns",
"the",
"difference",
"between",
"two",
"sets",
"of",
"coverage",
"profiles",
".",
"The",
"profiles",
"are",
"expected",
"to",
"be",
"from",
"a",
"single",
"execution",
"of",
"the",
"same",
"binary",
"(",
"or",
"multiple",
"binaries",
"if",
"using",
"a",
"merged",
"coverage",
"profile",
")"
]
| [
"func",
"DiffProfiles",
"(",
"before",
"[",
"]",
"*",
"cover",
".",
"Profile",
",",
"after",
"[",
"]",
"*",
"cover",
".",
"Profile",
")",
"(",
"[",
"]",
"*",
"cover",
".",
"Profile",
",",
"error",
")",
"{",
"var",
"diff",
"[",
"]",
"*",
"cover",
".",
"Profile",
"\n",
"if",
"len",
"(",
"before",
")",
"!=",
"len",
"(",
"<mask>",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"len",
"(",
"before",
")",
",",
"len",
"(",
"after",
")",
")",
"\n",
"}",
"\n",
"for",
"i",
",",
"beforeProfile",
":=",
"range",
"before",
"{",
"afterProfile",
":=",
"after",
"[",
"i",
"]",
"\n",
"if",
"err",
":=",
"ensureProfilesMatch",
"(",
"beforeProfile",
",",
"afterProfile",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"i",
",",
"err",
")",
"\n",
"}",
"\n",
"diffProfile",
":=",
"cover",
".",
"Profile",
"{",
"FileName",
":",
"beforeProfile",
".",
"FileName",
",",
"Mode",
":",
"beforeProfile",
".",
"Mode",
"}",
"\n",
"for",
"j",
",",
"beforeBlock",
":=",
"range",
"beforeProfile",
".",
"Blocks",
"{",
"afterBlock",
":=",
"afterProfile",
".",
"Blocks",
"[",
"j",
"]",
"\n",
"diffBlock",
":=",
"cover",
".",
"ProfileBlock",
"{",
"StartLine",
":",
"beforeBlock",
".",
"StartLine",
",",
"StartCol",
":",
"beforeBlock",
".",
"StartCol",
",",
"EndLine",
":",
"beforeBlock",
".",
"EndLine",
",",
"EndCol",
":",
"beforeBlock",
".",
"EndCol",
",",
"NumStmt",
":",
"beforeBlock",
".",
"NumStmt",
",",
"Count",
":",
"afterBlock",
".",
"Count",
"-",
"beforeBlock",
".",
"Count",
",",
"}",
"\n",
"diffProfile",
".",
"Blocks",
"=",
"append",
"(",
"diffProfile",
".",
"Blocks",
",",
"diffBlock",
")",
"\n",
"}",
"\n",
"diff",
"=",
"append",
"(",
"diff",
",",
"&",
"diffProfile",
")",
"\n",
"}",
"\n",
"return",
"diff",
",",
"nil",
"\n",
"}"
]
|
18,950 | all-18951 | [
"nextNetworkAdapterID",
"returns",
"the",
"next",
"available",
"ethernet",
"ID",
"reusing",
"ids",
"if",
"the",
"ethernet",
"adapter",
"has",
"present",
"equal",
"to",
"FALSE"
]
| [
"func",
"(",
"v",
"*",
"VM",
")",
"nextNetworkAdapterID",
"(",
"vmx",
"map",
"[",
"string",
"]",
"string",
")",
"int",
"{",
"var",
"nextID",
"int",
"\n",
"prefix",
":=",
"\"",
"\"",
"\n\n",
"for",
"key",
":=",
"range",
"vmx",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"key",
",",
"prefix",
")",
"{",
"ethN",
":=",
"strings",
".",
"Split",
"(",
"key",
",",
"\"",
"\"",
")",
"[",
"0",
"]",
"\n",
"number",
",",
"_",
":=",
"strconv",
".",
"Atoi",
"(",
"strings",
".",
"Split",
"(",
"ethN",
",",
"<mask>",
")",
"[",
"1",
"]",
")",
"\n\n",
"// If ethN is not present, its id is recycled",
"if",
"vmx",
"[",
"ethN",
"+",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"return",
"number",
"\n",
"}",
"\n\n",
"if",
"number",
">",
"nextID",
"{",
"nextID",
"=",
"number",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"nextID",
"++",
"\n\n",
"return",
"nextID",
"\n",
"}"
]
|
18,951 | all-18952 | [
"ApplyRuleIfElse",
"test",
"if",
"condition",
"is",
"true",
"than",
"apply",
"rule",
".",
"If",
"condition",
"is",
"false",
"run",
"else",
"rule",
"."
]
| [
"func",
"ApplyRuleIfElse",
"(",
"condition",
",",
"rule",
",",
"el",
"Ruler",
")",
"Ruler",
"{",
"return",
"&",
"applyelse",
"{",
"condition",
":",
"condition",
",",
"<mask>",
":",
"rule",
",",
"el",
":",
"el",
",",
"}",
"\n",
"}"
]
|
18,952 | all-18953 | [
"ExecContainer",
"requests",
"that",
"LXD",
"spawns",
"a",
"command",
"inside",
"the",
"container"
]
| [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"ExecContainer",
"(",
"containerName",
"string",
",",
"exec",
"api",
".",
"ContainerExecPost",
",",
"args",
"*",
"ContainerExecArgs",
")",
"(",
"Operation",
",",
"error",
")",
"{",
"if",
"exec",
".",
"RecordOutput",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Send the request",
"op",
",",
"_",
",",
"err",
":=",
"r",
".",
"queryOperation",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"containerName",
")",
")",
",",
"exec",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"opAPI",
":=",
"op",
".",
"Get",
"(",
")",
"\n\n",
"// Process additional arguments",
"if",
"args",
"!=",
"nil",
"{",
"// Parse the fds",
"fds",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"}",
"\n\n",
"value",
",",
"ok",
":=",
"opAPI",
".",
"Metadata",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"ok",
"{",
"values",
":=",
"value",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"<mask>",
"{",
"fds",
"[",
"k",
"]",
"=",
"v",
".",
"(",
"string",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Call the control handler with a connection to the control socket",
"if",
"args",
".",
"Control",
"!=",
"nil",
"&&",
"fds",
"[",
"\"",
"\"",
"]",
"!=",
"\"",
"\"",
"{",
"conn",
",",
"err",
":=",
"r",
".",
"GetOperationWebsocket",
"(",
"opAPI",
".",
"ID",
",",
"fds",
"[",
"\"",
"\"",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"go",
"args",
".",
"Control",
"(",
"conn",
")",
"\n",
"}",
"\n\n",
"if",
"exec",
".",
"Interactive",
"{",
"// Handle interactive sections",
"if",
"args",
".",
"Stdin",
"!=",
"nil",
"&&",
"args",
".",
"Stdout",
"!=",
"nil",
"{",
"// Connect to the websocket",
"conn",
",",
"err",
":=",
"r",
".",
"GetOperationWebsocket",
"(",
"opAPI",
".",
"ID",
",",
"fds",
"[",
"\"",
"\"",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// And attach stdin and stdout to it",
"go",
"func",
"(",
")",
"{",
"shared",
".",
"WebsocketSendStream",
"(",
"conn",
",",
"args",
".",
"Stdin",
",",
"-",
"1",
")",
"\n",
"<-",
"shared",
".",
"WebsocketRecvStream",
"(",
"args",
".",
"Stdout",
",",
"conn",
")",
"\n",
"conn",
".",
"Close",
"(",
")",
"\n\n",
"if",
"args",
".",
"DataDone",
"!=",
"nil",
"{",
"close",
"(",
"args",
".",
"DataDone",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"}",
"else",
"{",
"if",
"args",
".",
"DataDone",
"!=",
"nil",
"{",
"close",
"(",
"args",
".",
"DataDone",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"else",
"{",
"// Handle non-interactive sessions",
"dones",
":=",
"map",
"[",
"int",
"]",
"chan",
"bool",
"{",
"}",
"\n",
"conns",
":=",
"[",
"]",
"*",
"websocket",
".",
"Conn",
"{",
"}",
"\n\n",
"// Handle stdin",
"if",
"fds",
"[",
"\"",
"\"",
"]",
"!=",
"\"",
"\"",
"{",
"conn",
",",
"err",
":=",
"r",
".",
"GetOperationWebsocket",
"(",
"opAPI",
".",
"ID",
",",
"fds",
"[",
"\"",
"\"",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"conns",
"=",
"append",
"(",
"conns",
",",
"conn",
")",
"\n",
"dones",
"[",
"0",
"]",
"=",
"shared",
".",
"WebsocketSendStream",
"(",
"conn",
",",
"args",
".",
"Stdin",
",",
"-",
"1",
")",
"\n",
"}",
"\n\n",
"// Handle stdout",
"if",
"fds",
"[",
"\"",
"\"",
"]",
"!=",
"\"",
"\"",
"{",
"conn",
",",
"err",
":=",
"r",
".",
"GetOperationWebsocket",
"(",
"opAPI",
".",
"ID",
",",
"fds",
"[",
"\"",
"\"",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"conns",
"=",
"append",
"(",
"conns",
",",
"conn",
")",
"\n",
"dones",
"[",
"1",
"]",
"=",
"shared",
".",
"WebsocketRecvStream",
"(",
"args",
".",
"Stdout",
",",
"conn",
")",
"\n",
"}",
"\n\n",
"// Handle stderr",
"if",
"fds",
"[",
"\"",
"\"",
"]",
"!=",
"\"",
"\"",
"{",
"conn",
",",
"err",
":=",
"r",
".",
"GetOperationWebsocket",
"(",
"opAPI",
".",
"ID",
",",
"fds",
"[",
"\"",
"\"",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"conns",
"=",
"append",
"(",
"conns",
",",
"conn",
")",
"\n",
"dones",
"[",
"2",
"]",
"=",
"shared",
".",
"WebsocketRecvStream",
"(",
"args",
".",
"Stderr",
",",
"conn",
")",
"\n",
"}",
"\n\n",
"// Wait for everything to be done",
"go",
"func",
"(",
")",
"{",
"for",
"i",
",",
"chDone",
":=",
"range",
"dones",
"{",
"// Skip stdin, dealing with it separately below",
"if",
"i",
"==",
"0",
"{",
"continue",
"\n",
"}",
"\n\n",
"<-",
"chDone",
"\n",
"}",
"\n\n",
"if",
"fds",
"[",
"\"",
"\"",
"]",
"!=",
"\"",
"\"",
"{",
"if",
"args",
".",
"Stdin",
"!=",
"nil",
"{",
"args",
".",
"Stdin",
".",
"Close",
"(",
")",
"\n",
"}",
"\n\n",
"// Empty the stdin channel but don't block on it as",
"// stdin may be stuck in Read()",
"go",
"func",
"(",
")",
"{",
"<-",
"dones",
"[",
"0",
"]",
"\n",
"}",
"(",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"conn",
":=",
"range",
"conns",
"{",
"conn",
".",
"Close",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"args",
".",
"DataDone",
"!=",
"nil",
"{",
"close",
"(",
"args",
".",
"DataDone",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"op",
",",
"nil",
"\n",
"}"
]
|
18,953 | all-18954 | [
"SetRestart",
"sets",
"reboot_required",
"in",
"the",
"global",
"ResourceData",
".",
"The",
"key",
"is",
"only",
"required",
"for",
"logging",
"."
]
| [
"func",
"(",
"r",
"*",
"Subresource",
")",
"SetRestart",
"(",
"key",
"string",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"r",
",",
"key",
")",
"\n",
"switch",
"d",
":=",
"r",
".",
"rdd",
".",
"(",
"type",
")",
"{",
"case",
"*",
"schema",
".",
"ResourceData",
":",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"true",
")",
"\n",
"case",
"*",
"schema",
".",
"ResourceDiff",
":",
"d",
".",
"SetNew",
"(",
"\"",
"\"",
",",
"true",
")",
"\n",
"<mask>",
":",
"// This should never happen, but log if it does.",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"r",
",",
"r",
".",
"rdd",
")",
"\n",
"}",
"\n",
"}"
]
|
18,954 | all-18955 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"PropertyDescriptor",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime15",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
18,955 | all-18956 | [
"Int32",
"adds",
"an",
"int32",
"-",
"valued",
"key",
":",
"value",
"pair",
"to",
"a",
"Span",
".",
"LogFields",
"()",
"record"
]
| [
"func",
"Int32",
"(",
"key",
"string",
",",
"val",
"int32",
")",
"Field",
"{",
"return",
"Field",
"{",
"<mask>",
":",
"key",
",",
"fieldType",
":",
"int32Type",
",",
"numericVal",
":",
"int64",
"(",
"val",
")",
",",
"}",
"\n",
"}"
]
|
18,956 | all-18957 | [
"GetTextSizeOk",
"returns",
"a",
"tuple",
"with",
"the",
"TextSize",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetTextSizeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"TextSize",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"TextSize",
",",
"<mask>",
"\n",
"}"
]
|
18,957 | all-18958 | [
"Given",
"specifies",
"a",
"provider",
"state",
".",
"Optional",
"."
]
| [
"func",
"(",
"p",
"*",
"Message",
")",
"Given",
"(",
"state",
"string",
")",
"*",
"Message",
"{",
"p",
".",
"States",
"=",
"[",
"]",
"State",
"{",
"State",
"{",
"<mask>",
":",
"state",
"}",
"}",
"\n\n",
"return",
"p",
"\n",
"}"
]
|
18,958 | all-18959 | [
"DestroyWindow",
"removes",
"the",
"Window",
"from",
"the",
"list",
"of",
"managed",
"Windows"
]
| [
"func",
"(",
"c",
"*",
"Composer",
")",
"DestroyWindow",
"(",
"view",
"Control",
")",
"{",
"ev",
":=",
"Event",
"{",
"Type",
":",
"EventClose",
"}",
"\n",
"c",
".",
"sendEventToActiveWindow",
"(",
"ev",
")",
"\n\n",
"windows",
":=",
"c",
".",
"getWindowList",
"(",
")",
"\n",
"<mask>",
"newOrder",
"[",
"]",
"Control",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"windows",
")",
";",
"i",
"++",
"{",
"if",
"windows",
"[",
"i",
"]",
"!=",
"view",
"{",
"newOrder",
"=",
"append",
"(",
"newOrder",
",",
"windows",
"[",
"i",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"newOrder",
")",
"==",
"0",
"{",
"go",
"Stop",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"c",
".",
"BeginUpdate",
"(",
")",
"\n",
"c",
".",
"windows",
"=",
"newOrder",
"\n",
"c",
".",
"EndUpdate",
"(",
")",
"\n",
"c",
".",
"activateWindow",
"(",
"c",
".",
"topWindow",
"(",
")",
")",
"\n",
"}"
]
|
18,959 | all-18960 | [
"WaitForConnection",
"waits",
"for",
"connection",
"to",
"Elasticsearch",
"to",
"be",
"ready"
]
| [
"func",
"(",
"db",
"*",
"Database",
")",
"WaitForConnection",
"(",
"ctx",
"context",
".",
"Context",
",",
"timeout",
"int",
")",
"error",
"{",
"var",
"err",
"error",
"\n\n",
"secondsWaited",
":=",
"0",
"\n\n",
"connCtx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"ctx",
",",
"time",
".",
"Duration",
"(",
"timeout",
")",
"*",
"time",
".",
"Second",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"log",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"for",
"{",
"// Try to connect to Elasticsearch",
"select",
"{",
"case",
"<-",
"connCtx",
".",
"Done",
"(",
")",
":",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"secondsWaited",
")",
"\n",
"default",
":",
"err",
"=",
"db",
".",
"TestConnection",
"(",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"secondsWaited",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"// not ready yet",
"secondsWaited",
"++",
"\n",
"<mask>",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"time",
".",
"Sleep",
"(",
"1",
"*",
"time",
".",
"Second",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
]
|
18,960 | all-18961 | [
"attach",
"a",
"level",
"of",
"a",
"texture",
"object",
"as",
"a",
"logical",
"buffer",
"to",
"the",
"currently",
"bound",
"framebuffer",
"object"
]
| [
"func",
"FramebufferTexture2D",
"(",
"target",
"uint32",
",",
"attachment",
"uint32",
",",
"textarget",
"uint32",
",",
"texture",
"uint32",
",",
"level",
"int32",
")",
"{",
"C",
".",
"glowFramebufferTexture2D",
"(",
"gpFramebufferTexture2D",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"attachment",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"textarget",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"texture",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"<mask>",
")",
")",
"\n",
"}"
]
|
18,961 | all-18962 | [
"ParseHostPort",
"splits",
"a",
"<host",
">",
":",
"<port",
">",
"string",
"into",
"the",
"host",
"and",
"port",
"parts",
".",
"The",
"port",
"part",
"is",
"optional",
"."
]
| [
"func",
"ParseHostPort",
"(",
"hostPort",
"string",
")",
"(",
"host",
"string",
",",
"<mask>",
"string",
")",
"{",
"parts",
":=",
"strings",
".",
"SplitN",
"(",
"hostPort",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"host",
"=",
"parts",
"[",
"0",
"]",
"\n",
"if",
"len",
"(",
"parts",
")",
">",
"1",
"{",
"port",
"=",
"parts",
"[",
"1",
"]",
"\n",
"}",
"\n",
"return",
"host",
",",
"port",
"\n",
"}"
]
|
18,962 | all-18963 | [
"querystring",
"implements",
"querystringer",
"to",
"represent",
"the",
"audio",
"file",
"."
]
| [
"func",
"(",
"oa",
"*",
"OutgoingAudio",
")",
"querystring",
"(",
")",
"querystring",
"{",
"toReturn",
":=",
"<mask>",
"[",
"string",
"]",
"string",
"(",
"oa",
".",
"getBaseQueryString",
"(",
")",
")",
"\n\n",
"if",
"oa",
".",
"Duration",
"!=",
"0",
"{",
"toReturn",
"[",
"\"",
"\"",
"]",
"=",
"fmt",
".",
"Sprint",
"(",
"oa",
".",
"Duration",
")",
"\n",
"}",
"\n\n",
"if",
"oa",
".",
"Performer",
"!=",
"\"",
"\"",
"{",
"toReturn",
"[",
"\"",
"\"",
"]",
"=",
"oa",
".",
"Performer",
"\n",
"}",
"\n\n",
"if",
"oa",
".",
"Title",
"!=",
"\"",
"\"",
"{",
"toReturn",
"[",
"\"",
"\"",
"]",
"=",
"oa",
".",
"Title",
"\n",
"}",
"\n\n",
"return",
"querystring",
"(",
"toReturn",
")",
"\n",
"}"
]
|
18,963 | all-18964 | [
"Login",
"authenticates",
"with",
"MongoDB",
"using",
"the",
"provided",
"credential",
".",
"The",
"authentication",
"is",
"valid",
"for",
"the",
"whole",
"session",
"and",
"will",
"stay",
"valid",
"until",
"Logout",
"is",
"explicitly",
"called",
"for",
"the",
"same",
"database",
"or",
"the",
"session",
"is",
"closed",
"."
]
| [
"func",
"(",
"s",
"*",
"Session",
")",
"Login",
"(",
"cred",
"*",
"Credential",
")",
"error",
"{",
"socket",
",",
"err",
":=",
"s",
".",
"acquireSocket",
"(",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"socket",
".",
"Release",
"(",
")",
"\n\n",
"credCopy",
":=",
"*",
"cred",
"\n",
"if",
"cred",
".",
"Source",
"==",
"\"",
"\"",
"{",
"if",
"cred",
".",
"Mechanism",
"==",
"\"",
"\"",
"{",
"credCopy",
".",
"Source",
"=",
"\"",
"\"",
"\n",
"}",
"else",
"{",
"credCopy",
".",
"Source",
"=",
"s",
".",
"sourcedb",
"\n",
"}",
"\n",
"}",
"\n",
"err",
"=",
"<mask>",
".",
"Login",
"(",
"credCopy",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"s",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"s",
".",
"creds",
"=",
"append",
"(",
"s",
".",
"creds",
",",
"credCopy",
")",
"\n",
"s",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
18,964 | all-18965 | [
"GroupObjectsByMetadata",
"returns",
"a",
"map",
"with",
"all",
"objects",
"grouped",
"by",
"specific",
"metadata",
"key",
"."
]
| [
"func",
"(",
"s",
"*",
"Seekret",
")",
"GroupObjectsByMetadata",
"(",
"k",
"string",
")",
"<mask>",
"[",
"string",
"]",
"[",
"]",
"models",
".",
"Object",
"{",
"return",
"models",
".",
"GroupObjectsByMetadata",
"(",
"s",
".",
"objectList",
",",
"k",
")",
"\n",
"}"
]
|
18,965 | all-18966 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
]
| [
"func",
"ProgramUniform2i",
"(",
"program",
"uint32",
",",
"location",
"int32",
",",
"v0",
"int32",
",",
"v1",
"int32",
")",
"{",
"C",
".",
"glowProgramUniform2i",
"(",
"gpProgramUniform2i",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"location",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"v0",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"v1",
")",
")",
"\n",
"}"
]
|
18,966 | all-18967 | [
"WithTokenFunc",
"returns",
"TokenCredentials",
"that",
"execute",
"the",
"tokenFunc",
"on",
"each",
"request",
"The",
"value",
"of",
"v",
"sent",
"to",
"the",
"tokenFunk",
"is",
"the",
"MD",
"value",
"of",
"the",
"supplied",
"k"
]
| [
"func",
"WithTokenFunc",
"(",
"k",
"string",
",",
"tokenFunc",
"func",
"(",
"v",
"string",
")",
"<mask>",
")",
"*",
"TokenCredentials",
"{",
"return",
"&",
"TokenCredentials",
"{",
"tokenFunc",
":",
"tokenFunc",
",",
"tokenFuncKey",
":",
"k",
",",
"}",
"\n",
"}"
]
|
18,967 | all-18968 | [
"SetMaxConcurrentStreams",
"Sets",
"the",
"maximum",
"number",
"of",
"concurrent",
"streams",
"the",
"client",
"can",
"have",
".",
"It",
"is",
"not",
"safe",
"to",
"call",
"this",
"operations",
"while",
"operations",
"are",
"outstanding",
"."
]
| [
"func",
"(",
"c",
"APIClient",
")",
"SetMaxConcurrentStreams",
"(",
"n",
"int",
")",
"{",
"c",
".",
"limiter",
"=",
"<mask>",
".",
"New",
"(",
"n",
")",
"\n",
"}"
]
|
18,968 | all-18969 | [
"IsConnCanceled",
"returns",
"true",
"if",
"error",
"is",
"from",
"a",
"closed",
"gRPC",
"connection",
".",
"ref",
".",
"https",
":",
"//",
"github",
".",
"com",
"/",
"grpc",
"/",
"grpc",
"-",
"go",
"/",
"pull",
"/",
"1854"
]
| [
"func",
"IsConnCanceled",
"(",
"err",
"error",
")",
"bool",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"// >= gRPC v1.10.x",
"s",
",",
"ok",
":=",
"status",
".",
"FromError",
"(",
"err",
")",
"\n",
"if",
"ok",
"{",
"// connection is canceled or server has already closed the connection",
"return",
"s",
".",
"Code",
"(",
")",
"==",
"codes",
".",
"Canceled",
"||",
"s",
".",
"Message",
"(",
")",
"==",
"\"",
"\"",
"\n",
"}",
"\n",
"// >= gRPC v1.10.x",
"if",
"err",
"==",
"context",
".",
"Canceled",
"{",
"return",
"true",
"\n",
"}",
"\n",
"// <= gRPC v1.7.x returns 'errors.New(\"grpc: the client connection is closing\")'",
"return",
"strings",
".",
"Contains",
"(",
"err",
".",
"Error",
"(",
")",
",",
"\"",
"\"",
")",
"\n",
"}"
]
|
18,969 | all-18970 | [
"Bool",
"returns",
"v",
"s",
"boolean",
"value",
".",
"If",
"v",
".",
"Kind",
"()",
"!",
"=",
"Bool",
"Bool",
"returns",
"false",
"."
]
| [
"func",
"(",
"v",
"Value",
")",
"Bool",
"(",
")",
"bool",
"{",
"x",
",",
"ok",
":=",
"v",
".",
"data",
".",
"(",
"bool",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"x",
"\n",
"}"
]
|
18,970 | all-18971 | [
"Env",
"sets",
"the",
"Env"
]
| [
"func",
"(",
"e",
"*",
"execStreamerBuilder",
")",
"Env",
"(",
"env",
"...",
"<mask>",
")",
"ExecStreamerBuilder",
"{",
"e",
".",
"d",
".",
"Env",
"=",
"env",
"\n",
"return",
"e",
"\n",
"}"
]
|
18,971 | all-18972 | [
"expandClusterConfigSpecEx",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"ClusterConfigSpecEx",
"."
]
| [
"func",
"expandClusterConfigSpecEx",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"version",
"viapi",
".",
"VSphereVersion",
")",
"*",
"types",
".",
"ClusterConfigSpecEx",
"{",
"obj",
":=",
"&",
"types",
".",
"ClusterConfigSpecEx",
"{",
"DasConfig",
":",
"expandClusterDasConfigInfo",
"(",
"d",
",",
"version",
")",
",",
"DpmConfig",
":",
"expandClusterDpmConfigInfo",
"(",
"d",
")",
",",
"DrsConfig",
":",
"expandClusterDrsConfigInfo",
"(",
"d",
")",
",",
"}",
"\n\n",
"if",
"version",
".",
"Newer",
"(",
"viapi",
".",
"VSphereVersion",
"{",
"Product",
":",
"<mask>",
".",
"Product",
",",
"Major",
":",
"6",
",",
"Minor",
":",
"5",
"}",
")",
"{",
"obj",
".",
"InfraUpdateHaConfig",
"=",
"expandClusterInfraUpdateHaConfigInfo",
"(",
"d",
")",
"\n",
"obj",
".",
"Orchestration",
"=",
"expandClusterOrchestrationInfo",
"(",
"d",
")",
"\n",
"obj",
".",
"ProactiveDrsConfig",
"=",
"expandClusterProactiveDrsConfigInfo",
"(",
"d",
")",
"\n",
"}",
"\n\n",
"return",
"obj",
"\n",
"}"
]
|
18,972 | all-18973 | [
"Get",
"is",
"a",
"shortcut",
"for",
"r",
".",
"Handle",
"(",
"GET",
"pattern",
"handlers",
")"
]
| [
"func",
"(",
"r",
"*",
"Router",
")",
"Get",
"(",
"pattern",
"string",
",",
"h",
"...",
"Handler",
")",
"(",
"leaf",
"*",
"Route",
")",
"{",
"leaf",
"=",
"r",
".",
"Handle",
"(",
"\"",
"\"",
",",
"<mask>",
",",
"h",
")",
"\n",
"if",
"r",
".",
"autoHead",
"{",
"r",
".",
"Head",
"(",
"pattern",
",",
"h",
"...",
")",
"\n",
"}",
"\n",
"return",
"leaf",
"\n",
"}"
]
|
18,973 | all-18974 | [
"DeepCopy",
"copies",
"the",
"receiver",
"into",
"a",
"new",
"MAC",
"."
]
| [
"func",
"(",
"u",
"*",
"MAC",
")",
"DeepCopy",
"(",
")",
"*",
"MAC",
"{",
"if",
"u",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"MAC",
")",
"\n",
"u",
".",
"DeepCopyInto",
"(",
"<mask>",
")",
"\n",
"return",
"out",
"\n",
"}"
]
|
18,974 | all-18975 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"GetLayoutMetricsParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage37",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
18,975 | all-18976 | [
"GetHeight",
"returns",
"the",
"Height",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"s",
"*",
"SyntheticsDevice",
")",
"GetHeight",
"(",
")",
"int",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Height",
"==",
"nil",
"{",
"<mask>",
"0",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Height",
"\n",
"}"
]
|
18,976 | all-18977 | [
"Generate",
"API",
"metadata",
"drives",
"the",
"metadata",
"writer",
"."
]
| [
"func",
"GenerateMetadata",
"(",
"descriptor",
"*",
"<mask>",
".",
"APIDescriptor",
",",
"codegen",
",",
"pkg",
"string",
")",
"error",
"{",
"f",
",",
"err",
":=",
"os",
".",
"Create",
"(",
"codegen",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"c",
",",
"err",
":=",
"NewMetadataWriter",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"kingpin",
".",
"FatalIfError",
"(",
"c",
".",
"WriteHeader",
"(",
"pkg",
",",
"f",
")",
",",
"\"",
"\"",
")",
"\n",
"kingpin",
".",
"FatalIfError",
"(",
"c",
".",
"WriteMetadata",
"(",
"descriptor",
",",
"f",
")",
",",
"\"",
"\"",
")",
"\n",
"f",
".",
"Close",
"(",
")",
"\n",
"o",
",",
"err",
":=",
"exec",
".",
"Command",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"codegen",
")",
".",
"CombinedOutput",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\n",
"\"",
",",
"o",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
18,977 | all-18978 | [
"PrintRunPageSetupDialog",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_run_page_setup_dialog",
"()",
"."
]
| [
"func",
"PrintRunPageSetupDialog",
"(",
"parent",
"*",
"Window",
",",
"pageSetup",
"*",
"PageSetup",
",",
"settings",
"*",
"PrintSettings",
")",
"*",
"PageSetup",
"{",
"c",
":=",
"C",
".",
"gtk_print_run_page_setup_dialog",
"(",
"<mask>",
".",
"native",
"(",
")",
",",
"pageSetup",
".",
"native",
"(",
")",
",",
"settings",
".",
"native",
"(",
")",
")",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapPageSetup",
"(",
"obj",
")",
"\n",
"}"
]
|
18,978 | all-18979 | [
"/",
"*",
"Set",
"and",
"Get",
"Property",
"of",
"the",
"window"
]
| [
"func",
"(",
"win",
"*",
"Window",
")",
"SetProperty",
"(",
"prop_id",
"int",
",",
"<mask>",
"float64",
")",
"{",
"C",
".",
"cvSetWindowProperty",
"(",
"win",
".",
"name_c",
",",
"C",
".",
"int",
"(",
"prop_id",
")",
",",
"C",
".",
"double",
"(",
"value",
")",
")",
"\n",
"}"
]
|
18,979 | all-18980 | [
"Open",
"is",
"a",
"function",
"you",
"can",
"call",
"to",
"access",
"the",
"underlying",
"snapshot",
"and",
"its",
"metadata",
"."
]
| [
"func",
"(",
"u",
"*",
"userSnapshotFuture",
")",
"Open",
"(",
")",
"(",
"*",
"SnapshotMeta",
",",
"<mask>",
".",
"ReadCloser",
",",
"error",
")",
"{",
"if",
"u",
".",
"opener",
"==",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"// Invalidate the opener so it can't get called multiple times,",
"// which isn't generally safe.",
"defer",
"func",
"(",
")",
"{",
"u",
".",
"opener",
"=",
"nil",
"\n",
"}",
"(",
")",
"\n",
"return",
"u",
".",
"opener",
"(",
")",
"\n",
"}",
"\n",
"}"
]
|
18,980 | all-18981 | [
"EnsureFirstUser",
"ensures",
"the",
"existence",
"of",
"a",
"first",
"user",
"if",
"no",
"other",
"has",
"been",
"created",
"."
]
| [
"func",
"EnsureFirstUser",
"(",
"store",
"*",
"coal",
".",
"Store",
",",
"name",
",",
"email",
",",
"password",
"string",
")",
"error",
"{",
"// copy store",
"s",
":=",
"store",
".",
"Copy",
"(",
")",
"\n",
"defer",
"s",
".",
"Close",
"(",
")",
"\n\n",
"// check existence",
"n",
",",
"err",
":=",
"s",
".",
"C",
"(",
"&",
"User",
"{",
"}",
")",
".",
"Count",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"else",
"if",
"n",
">",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// user is missing",
"// create user",
"user",
":=",
"coal",
".",
"Init",
"(",
"&",
"User",
"{",
"}",
")",
".",
"(",
"*",
"User",
")",
"\n",
"user",
".",
"<mask>",
"=",
"name",
"\n",
"user",
".",
"Email",
"=",
"email",
"\n",
"user",
".",
"Password",
"=",
"password",
"\n\n",
"// set key and secret",
"err",
"=",
"user",
".",
"Validate",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// save user",
"err",
"=",
"s",
".",
"C",
"(",
"user",
")",
".",
"Insert",
"(",
"user",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
18,981 | all-18982 | [
"Arguments",
"returns",
"the",
"argument",
"declarations",
"for",
"this",
"method",
"."
]
| [
"func",
"(",
"m",
"*",
"Method",
")",
"Arguments",
"(",
")",
"[",
"]",
"*",
"Field",
"{",
"var",
"args",
"[",
"]",
"*",
"Field",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"m",
".",
"Method",
".",
"Arguments",
"{",
"args",
"=",
"append",
"(",
"args",
",",
"&",
"Field",
"{",
"f",
",",
"m",
".",
"<mask>",
"}",
")",
"\n",
"}",
"\n",
"return",
"args",
"\n",
"}"
]
|
18,982 | all-18983 | [
"RegisterPullRequestHandler",
"registers",
"a",
"plugin",
"s",
"github",
".",
"PullRequestEvent",
"handler",
"."
]
| [
"func",
"RegisterPullRequestHandler",
"(",
"<mask>",
"string",
",",
"fn",
"PullRequestHandler",
",",
"help",
"HelpProvider",
")",
"{",
"pluginHelp",
"[",
"name",
"]",
"=",
"help",
"\n",
"pullRequestHandlers",
"[",
"name",
"]",
"=",
"fn",
"\n",
"}"
]
|
18,983 | all-18984 | [
"visit",
"visits",
"every",
"ancestor",
"of",
"path",
"(",
"excluding",
"path",
"itself",
")",
"leaf",
"to",
"root",
"(",
"i",
".",
"e",
".",
"end",
"of",
"path",
"to",
"beginning",
")",
"and",
"calls",
"update",
"on",
"each",
"node",
"along",
"the",
"way",
".",
"For",
"example",
"if",
"visit",
"is",
"called",
"with",
"path",
"=",
"/",
"path",
"/",
"to",
"/",
"file",
"then",
"updateFn",
"is",
"called",
"as",
"follows",
":",
"1",
".",
"update",
"(",
"node",
"at",
"/",
"path",
"/",
"to",
"or",
"nil",
"/",
"path",
"/",
"to",
"file",
")",
"2",
".",
"update",
"(",
"node",
"at",
"/",
"path",
"or",
"nil",
"/",
"path",
"to",
")",
"3",
".",
"update",
"(",
"node",
"at",
"/",
"or",
"nil",
"path",
")",
"This",
"is",
"useful",
"for",
"propagating",
"changes",
"to",
"size",
"upwards",
"."
]
| [
"func",
"visit",
"(",
"tx",
"*",
"bolt",
".",
"Tx",
",",
"path",
"string",
",",
"update",
"updateFn",
")",
"error",
"{",
"for",
"path",
"!=",
"\"",
"\"",
"{",
"parent",
",",
"<mask>",
":=",
"split",
"(",
"path",
")",
"\n",
"pnode",
",",
"err",
":=",
"get",
"(",
"tx",
",",
"parent",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"Code",
"(",
"err",
")",
"!=",
"PathNotFound",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"pnode",
"!=",
"nil",
"&&",
"pnode",
".",
"nodetype",
"(",
")",
"!=",
"directory",
"{",
"return",
"errorf",
"(",
"PathConflict",
",",
"\"",
"\\\"",
"\\\"",
"\"",
"+",
"\"",
"\"",
",",
"path",
")",
"\n",
"}",
"\n",
"if",
"pnode",
"==",
"nil",
"{",
"pnode",
"=",
"&",
"NodeProto",
"{",
"}",
"\n",
"}",
"\n",
"if",
"err",
":=",
"update",
"(",
"pnode",
",",
"parent",
",",
"child",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"put",
"(",
"tx",
",",
"parent",
",",
"pnode",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"path",
"=",
"parent",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
18,984 | all-18985 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"CaptureSnapshotReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomsnapshot14",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
18,985 | all-18986 | [
"Delete",
"-",
"delete",
"an",
"s3",
"bucket"
]
| [
"func",
"(",
"s",
"*",
"S3Bucket",
")",
"Delete",
"(",
"path",
"string",
")",
"error",
"{",
"return",
"s",
".",
"bucket",
".",
"Delete",
"(",
"<mask>",
")",
"\n",
"}"
]
|
18,986 | all-18987 | [
"Match",
"against",
"fixed",
"length",
"pattern",
"."
]
| [
"func",
"(",
"m",
"*",
"FixedLengthMatcher",
")",
"Match",
"(",
"s",
"string",
")",
"(",
"offset",
"int",
",",
"matchStr",
"string",
")",
"{",
"if",
"len",
"(",
"s",
")",
"<",
"m",
".",
"length",
"||",
"!",
"m",
".",
"match",
"(",
"s",
")",
"{",
"offset",
"=",
"-",
"1",
"\n",
"return",
"\n",
"}",
"\n",
"return",
"m",
".",
"length",
",",
"s",
"[",
":",
"m",
".",
"<mask>",
"]",
"\n",
"}"
]
|
18,987 | all-18988 | [
"ButtonNewWithLabel",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_button_new_with_label",
"()",
"."
]
| [
"func",
"ButtonNewWithLabel",
"(",
"<mask>",
"string",
")",
"(",
"*",
"Button",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"label",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_button_new_with_label",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapButton",
"(",
"obj",
")",
",",
"nil",
"\n",
"}"
]
|
18,988 | all-18989 | [
"cephRBDVolumeUnmarkDeleted",
"unmarks",
"an",
"RBD",
"storage",
"volume",
"as",
"being",
"in",
"zombie",
"state",
"-",
"An",
"RBD",
"storage",
"volume",
"that",
"is",
"in",
"zombie",
"is",
"not",
"tracked",
"in",
"LXD",
"s",
"database",
"anymore",
"but",
"still",
"needs",
"to",
"be",
"kept",
"around",
"for",
"the",
"sake",
"of",
"any",
"dependent",
"storage",
"entities",
"in",
"the",
"storage",
"pool",
".",
"-",
"This",
"function",
"is",
"mostly",
"used",
"when",
"a",
"user",
"has",
"deleted",
"the",
"storage",
"volume",
"of",
"an",
"image",
"from",
"the",
"storage",
"pool",
"and",
"then",
"triggers",
"a",
"container",
"creation",
".",
"If",
"LXD",
"detects",
"that",
"the",
"storage",
"volume",
"for",
"the",
"given",
"hash",
"already",
"exists",
"in",
"the",
"pool",
"but",
"is",
"marked",
"as",
"zombie",
"it",
"will",
"unmark",
"it",
"as",
"a",
"zombie",
"instead",
"of",
"creating",
"another",
"storage",
"volume",
"for",
"the",
"image",
"."
]
| [
"func",
"cephRBDVolumeUnmarkDeleted",
"(",
"clusterName",
"string",
",",
"poolName",
"string",
",",
"volumeName",
"string",
",",
"volumeType",
"string",
",",
"userName",
"string",
",",
"oldSuffix",
"string",
",",
"newSuffix",
"string",
")",
"error",
"{",
"oldName",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"poolName",
",",
"volumeType",
",",
"volumeName",
")",
"\n",
"if",
"oldSuffix",
"!=",
"\"",
"\"",
"{",
"oldName",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"oldName",
",",
"oldSuffix",
")",
"\n",
"}",
"\n\n",
"newName",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"poolName",
",",
"volumeType",
",",
"volumeName",
")",
"\n",
"if",
"newSuffix",
"!=",
"\"",
"\"",
"{",
"newName",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"newName",
",",
"newSuffix",
")",
"\n",
"}",
"\n\n",
"_",
",",
"err",
":=",
"<mask>",
".",
"RunCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"userName",
",",
"\"",
"\"",
",",
"clusterName",
",",
"\"",
"\"",
",",
"oldName",
",",
"newName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
18,989 | all-18990 | [
"shouldOverridePIDMode",
"returns",
"true",
"if",
"the",
"PIDMode",
"of",
"the",
"container",
"needs",
"to",
"be",
"overridden",
".",
"It",
"also",
"returns",
"the",
"override",
"string",
"in",
"this",
"case",
".",
"It",
"returns",
"false",
"otherwise"
]
| [
"func",
"(",
"task",
"*",
"Task",
")",
"shouldOverridePIDMode",
"(",
"container",
"*",
"apicontainer",
".",
"<mask>",
",",
"dockerContainerMap",
"map",
"[",
"string",
"]",
"*",
"apicontainer",
".",
"DockerContainer",
")",
"(",
"bool",
",",
"string",
")",
"{",
"// If the container is an internal container (ContainerEmptyHostVolume,",
"// ContainerCNIPause, or ContainerNamespacePause), then PID namespace for",
"// the container itself should be private (default Docker option)",
"if",
"container",
".",
"IsInternal",
"(",
")",
"{",
"return",
"false",
",",
"\"",
"\"",
"\n",
"}",
"\n\n",
"switch",
"task",
".",
"getPIDMode",
"(",
")",
"{",
"case",
"pidModeHost",
":",
"return",
"true",
",",
"pidModeHost",
"\n\n",
"case",
"pidModeTask",
":",
"pauseCont",
",",
"ok",
":=",
"task",
".",
"ContainerByName",
"(",
"NamespacePauseContainerName",
")",
"\n",
"if",
"!",
"ok",
"{",
"seelog",
".",
"Criticalf",
"(",
"\"",
"\"",
",",
"task",
".",
"Arn",
")",
"\n",
"task",
".",
"SetDesiredStatus",
"(",
"apitaskstatus",
".",
"TaskStopped",
")",
"\n",
"return",
"false",
",",
"\"",
"\"",
"\n",
"}",
"\n",
"pauseDockerID",
",",
"ok",
":=",
"dockerContainerMap",
"[",
"pauseCont",
".",
"Name",
"]",
"\n",
"if",
"!",
"ok",
"||",
"pauseDockerID",
"==",
"nil",
"{",
"// Docker container shouldn't be nil or not exist if the Container definition within task exists; implies code-bug",
"seelog",
".",
"Criticalf",
"(",
"\"",
"\"",
",",
"task",
".",
"Arn",
")",
"\n",
"task",
".",
"SetDesiredStatus",
"(",
"apitaskstatus",
".",
"TaskStopped",
")",
"\n",
"return",
"false",
",",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"true",
",",
"dockerMappingContainerPrefix",
"+",
"pauseDockerID",
".",
"DockerID",
"\n\n",
"// If PIDMode is not Host or Task, then no need to override",
"default",
":",
"return",
"false",
",",
"\"",
"\"",
"\n",
"}",
"\n",
"}"
]
|
18,990 | all-18991 | [
"GetFiles",
"returns",
"owners",
"files",
"that",
"still",
"need",
"approval",
"."
]
| [
"func",
"(",
"ap",
"Approvers",
")",
"GetFiles",
"(",
"baseURL",
"*",
"url",
".",
"URL",
",",
"branch",
"string",
")",
"[",
"]",
"File",
"{",
"allOwnersFiles",
":=",
"[",
"]",
"File",
"{",
"}",
"\n",
"filesApprovers",
":=",
"ap",
".",
"GetFilesApprovers",
"(",
")",
"\n",
"for",
"_",
",",
"file",
":=",
"<mask>",
"ap",
".",
"owners",
".",
"GetOwnersSet",
"(",
")",
".",
"List",
"(",
")",
"{",
"if",
"len",
"(",
"filesApprovers",
"[",
"file",
"]",
")",
"==",
"0",
"{",
"allOwnersFiles",
"=",
"append",
"(",
"allOwnersFiles",
",",
"UnapprovedFile",
"{",
"baseURL",
":",
"baseURL",
",",
"filepath",
":",
"file",
",",
"branch",
":",
"branch",
",",
"}",
")",
"\n",
"}",
"else",
"{",
"allOwnersFiles",
"=",
"append",
"(",
"allOwnersFiles",
",",
"ApprovedFile",
"{",
"baseURL",
":",
"baseURL",
",",
"filepath",
":",
"file",
",",
"approvers",
":",
"filesApprovers",
"[",
"file",
"]",
",",
"branch",
":",
"branch",
",",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"allOwnersFiles",
"\n",
"}"
]
|
18,991 | all-18992 | [
"PutFileOverwrite",
"is",
"the",
"same",
"as",
"PutFile",
"except",
"that",
"instead",
"of",
"appending",
"the",
"objects",
"to",
"the",
"end",
"of",
"the",
"given",
"file",
"the",
"objects",
"are",
"inserted",
"to",
"the",
"given",
"index",
"and",
"the",
"existing",
"objects",
"starting",
"from",
"the",
"given",
"index",
"are",
"removed",
"."
]
| [
"func",
"(",
"h",
"*",
"dbHashTree",
")",
"PutFileOverwrite",
"(",
"path",
"string",
",",
"objects",
"[",
"]",
"*",
"pfs",
".",
"<mask>",
",",
"overwriteIndex",
"*",
"pfs",
".",
"OverwriteIndex",
",",
"sizeDelta",
"int64",
")",
"error",
"{",
"return",
"h",
".",
"putFile",
"(",
"path",
",",
"objects",
",",
"overwriteIndex",
",",
"sizeDelta",
",",
"false",
")",
"\n",
"}"
]
|
18,992 | all-18993 | [
"RequestVote",
"implements",
"the",
"Transport",
"interface",
"."
]
| [
"func",
"(",
"i",
"*",
"InmemTransport",
")",
"RequestVote",
"(",
"id",
"ServerID",
",",
"<mask>",
"ServerAddress",
",",
"args",
"*",
"RequestVoteRequest",
",",
"resp",
"*",
"RequestVoteResponse",
")",
"error",
"{",
"rpcResp",
",",
"err",
":=",
"i",
".",
"makeRPC",
"(",
"target",
",",
"args",
",",
"nil",
",",
"i",
".",
"timeout",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Copy the result back",
"out",
":=",
"rpcResp",
".",
"Response",
".",
"(",
"*",
"RequestVoteResponse",
")",
"\n",
"*",
"resp",
"=",
"*",
"out",
"\n",
"return",
"nil",
"\n",
"}"
]
|
18,993 | all-18994 | [
"CreateContainer",
"creates",
"a",
"docker",
"container",
"."
]
| [
"func",
"CreateContainer",
"(",
"dockerHost",
"DockerHost",
",",
"config",
"*",
"dockerclient",
".",
"ContainerConfig",
",",
"name",
"string",
")",
"error",
"{",
"docker",
",",
"err",
":=",
"DockerClient",
"(",
"dockerHost",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"docker",
".",
"PullImage",
"(",
"config",
".",
"Image",
",",
"nil",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"<mask>",
"authConfig",
"*",
"dockerclient",
".",
"AuthConfig",
"\n",
"containerID",
",",
"err",
":=",
"docker",
".",
"CreateContainer",
"(",
"config",
",",
"name",
",",
"authConfig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"docker",
".",
"StartContainer",
"(",
"containerID",
",",
"&",
"config",
".",
"HostConfig",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
18,994 | all-18995 | [
"DeepCopy",
"copies",
"the",
"receiver",
"into",
"a",
"new",
"ISBN13",
"."
]
| [
"func",
"(",
"u",
"*",
"ISBN13",
")",
"DeepCopy",
"(",
")",
"*",
"ISBN13",
"{",
"if",
"u",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"<mask>",
"(",
"ISBN13",
")",
"\n",
"u",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
]
|
18,995 | all-18996 | [
"Add",
"a",
"new",
"helper",
"to",
"the",
"map",
".",
"New",
"Helpers",
"will",
"be",
"validated",
"to",
"ensure",
"they",
"meet",
"the",
"requirements",
"for",
"a",
"helper",
":"
]
| [
"func",
"(",
"h",
"*",
"HelperMap",
")",
"Add",
"(",
"<mask>",
"string",
",",
"helper",
"interface",
"{",
"}",
")",
"error",
"{",
"h",
".",
"moot",
".",
"Lock",
"(",
")",
"\n",
"defer",
"h",
".",
"moot",
".",
"Unlock",
"(",
")",
"\n",
"if",
"h",
".",
"helpers",
"==",
"nil",
"{",
"h",
".",
"helpers",
"=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"h",
".",
"helpers",
"[",
"key",
"]",
"=",
"helper",
"\n",
"return",
"nil",
"\n",
"}"
]
|
18,996 | all-18997 | [
"Subscription",
"fetches",
"an",
"subscription",
"with",
"a",
"given",
"channel",
"tag",
"from",
"PushBullet",
"."
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"Subscription",
"(",
"tag",
"string",
")",
"(",
"*",
"Subscription",
",",
"error",
")",
"{",
"subs",
",",
"err",
":=",
"c",
".",
"Subscriptions",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"i",
":=",
"range",
"subs",
"{",
"if",
"subs",
"[",
"i",
"]",
".",
"Channel",
".",
"Tag",
"==",
"<mask>",
"{",
"subs",
"[",
"i",
"]",
".",
"Client",
"=",
"c",
"\n",
"return",
"subs",
"[",
"i",
"]",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"ErrDeviceNotFound",
"\n",
"}"
]
|
18,997 | all-18998 | [
"String",
"returns",
"string",
"representation",
"of",
"trie",
"mainly",
"for",
"visualization",
"and",
"debugging",
"."
]
| [
"func",
"(",
"p",
"*",
"prefixTrie",
")",
"String",
"(",
")",
"string",
"{",
"children",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"padding",
":=",
"strings",
".",
"Repeat",
"(",
"\"",
"\"",
",",
"p",
".",
"level",
"(",
")",
"+",
"1",
")",
"\n",
"for",
"bits",
",",
"child",
":=",
"range",
"p",
".",
"children",
"{",
"if",
"child",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"childStr",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\"",
",",
"padding",
",",
"bits",
",",
"child",
".",
"String",
"(",
")",
")",
"\n",
"children",
"=",
"append",
"(",
"children",
",",
"childStr",
")",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"p",
".",
"network",
",",
"p",
".",
"targetBitPosition",
"(",
")",
",",
"p",
".",
"hasEntry",
"(",
")",
",",
"strings",
".",
"Join",
"(",
"<mask>",
",",
"\"",
"\"",
")",
")",
"\n",
"}"
]
|
18,998 | all-18999 | [
"AddMapping",
"maps",
"an",
"external",
"port",
"to",
"a",
"local",
"port",
"for",
"a",
"specific",
"service",
"."
]
| [
"func",
"(",
"n",
"*",
"discovery",
")",
"AddMapping",
"(",
"protocol",
"string",
",",
"extPort",
",",
"intPort",
"int",
",",
"<mask>",
"string",
",",
"lifetime",
"time",
".",
"Duration",
")",
"error",
"{",
"if",
"err",
":=",
"n",
".",
"wait",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"n",
".",
"found",
".",
"AddMapping",
"(",
"protocol",
",",
"extPort",
",",
"intPort",
",",
"name",
",",
"lifetime",
")",
"\n",
"}"
]
|
18,999 | all-19000 | [
"ExecuteSQL",
"[",
"no",
"description",
"]",
".",
"See",
":",
"https",
":",
"//",
"chromedevtools",
".",
"github",
".",
"io",
"/",
"devtools",
"-",
"protocol",
"/",
"tot",
"/",
"Database#method",
"-",
"executeSQL",
"parameters",
":",
"databaseID",
"query"
]
| [
"func",
"ExecuteSQL",
"(",
"databaseID",
"<mask>",
",",
"query",
"string",
")",
"*",
"ExecuteSQLParams",
"{",
"return",
"&",
"ExecuteSQLParams",
"{",
"DatabaseID",
":",
"databaseID",
",",
"Query",
":",
"query",
",",
"}",
"\n",
"}"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.