id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
17,700 | all-17701 | [
"DefaultOS",
"returns",
"a",
"fresh",
"uninitialized",
"OS",
"instance",
"with",
"default",
"values",
"."
]
| [
"func",
"DefaultOS",
"(",
")",
"*",
"OS",
"{",
"newOS",
":=",
"&",
"OS",
"{",
"VarDir",
":",
"<mask>",
".",
"VarPath",
"(",
")",
",",
"CacheDir",
":",
"shared",
".",
"CachePath",
"(",
")",
",",
"LogDir",
":",
"shared",
".",
"LogPath",
"(",
")",
",",
"}",
"\n",
"newOS",
".",
"InotifyWatch",
".",
"Fd",
"=",
"-",
"1",
"\n",
"newOS",
".",
"InotifyWatch",
".",
"Targets",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"InotifyTargetInfo",
")",
"\n",
"return",
"newOS",
"\n",
"}"
]
|
17,701 | all-17702 | [
"WithUserAgent",
"allows",
"specifying",
"a",
"custom",
"user",
"agent",
"option",
"to",
"send",
"with",
"requests",
"when",
"the",
"underlying",
"client",
"library",
"supports",
"it",
"."
]
| [
"func",
"WithUserAgent",
"(",
"agent",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"d",
"*",
"Discover",
")",
"error",
"{",
"d",
".",
"userAgent",
"=",
"<mask>",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
]
|
17,702 | all-17703 | [
"TODO",
":",
"vvv",
"this",
"was",
"the",
"comment",
"on",
"ReachedCapacity",
".",
"FinalSize",
"returns",
"the",
"*",
"rough",
"*",
"final",
"size",
"of",
"the",
"array",
"counting",
"the",
"header",
"which",
"is",
"not",
"yet",
"written",
".",
"TODO",
":",
"Look",
"into",
"why",
"there",
"is",
"a",
"discrepancy",
".",
"I",
"suspect",
"it",
"is",
"because",
"of",
"Write",
"(",
"empty",
"empty",
")",
"at",
"the",
"end",
".",
"The",
"diff",
"can",
"vary",
".",
"ReachedCapacity",
"returns",
"true",
"if",
"we",
"...",
"roughly",
"(",
"?",
")",
"reached",
"capacity?"
]
| [
"func",
"(",
"b",
"*",
"<mask>",
")",
"ReachedCapacity",
"(",
"cap",
"int64",
")",
"bool",
"{",
"estimateSz",
":=",
"b",
".",
"buf",
".",
"Len",
"(",
")",
"+",
"8",
"/* empty header */",
"+",
"4",
"*",
"len",
"(",
"b",
".",
"restarts",
")",
"+",
"8",
"// 8 = end of buf offset + len(restarts).",
"\n",
"return",
"int64",
"(",
"estimateSz",
")",
">",
"cap",
"\n",
"}"
]
|
17,703 | all-17704 | [
"NewQPCleaner",
"returns",
"a",
"QPCleaner",
"for",
"the",
"specified",
"reader",
"."
]
| [
"func",
"NewQPCleaner",
"(",
"r",
"io",
".",
"Reader",
")",
"*",
"QPCleaner",
"{",
"return",
"&",
"QPCleaner",
"{",
"<mask>",
":",
"bufio",
".",
"NewReader",
"(",
"r",
")",
",",
"}",
"\n",
"}"
]
|
17,704 | all-17705 | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"post",
"apps",
"params"
]
| [
"func",
"(",
"o",
"*",
"PostAppsParams",
")",
"WithTimeout",
"(",
"timeout",
"<mask>",
".",
"Duration",
")",
"*",
"PostAppsParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
]
|
17,705 | all-17706 | [
"EventsForPlugin",
"returns",
"the",
"registered",
"events",
"for",
"the",
"passed",
"plugin",
"."
]
| [
"func",
"EventsForPlugin",
"(",
"name",
"string",
")",
"[",
"]",
"string",
"{",
"var",
"events",
"[",
"]",
"string",
"\n",
"if",
"_",
",",
"ok",
":=",
"issueHandlers",
"[",
"name",
"]",
";",
"ok",
"{",
"events",
"=",
"append",
"(",
"events",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"issueCommentHandlers",
"[",
"name",
"]",
";",
"ok",
"{",
"events",
"=",
"append",
"(",
"events",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"pullRequestHandlers",
"[",
"name",
"]",
";",
"ok",
"{",
"events",
"=",
"append",
"(",
"events",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"pushEventHandlers",
"[",
"name",
"]",
";",
"ok",
"{",
"events",
"=",
"append",
"(",
"events",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"reviewEventHandlers",
"[",
"name",
"]",
";",
"ok",
"{",
"<mask>",
"=",
"append",
"(",
"events",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"reviewCommentEventHandlers",
"[",
"name",
"]",
";",
"ok",
"{",
"events",
"=",
"append",
"(",
"events",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"statusEventHandlers",
"[",
"name",
"]",
";",
"ok",
"{",
"events",
"=",
"append",
"(",
"events",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"genericCommentHandlers",
"[",
"name",
"]",
";",
"ok",
"{",
"events",
"=",
"append",
"(",
"events",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"events",
"\n",
"}"
]
|
17,706 | all-17707 | [
"GetResources",
"list",
"all",
"resources"
]
| [
"func",
"(",
"s",
"*",
"Storage",
")",
"GetResources",
"(",
")",
"(",
"[",
"]",
"common",
".",
"Resource",
",",
"error",
")",
"{",
"var",
"resources",
"[",
"]",
"common",
".",
"Resource",
"\n",
"items",
",",
"err",
":=",
"s",
".",
"resources",
".",
"List",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"resources",
",",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"i",
":=",
"range",
"items",
"{",
"var",
"<mask>",
"common",
".",
"Resource",
"\n",
"res",
",",
"err",
"=",
"common",
".",
"ItemToResource",
"(",
"i",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"resources",
"=",
"append",
"(",
"resources",
",",
"res",
")",
"\n",
"}",
"\n",
"sort",
".",
"Stable",
"(",
"common",
".",
"ResourceByUpdateTime",
"(",
"resources",
")",
")",
"\n",
"return",
"resources",
",",
"nil",
"\n",
"}"
]
|
17,707 | all-17708 | [
"SetParent",
"is",
"a",
"wrapper",
"around",
"gtk_widget_set_parent",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Widget",
")",
"SetParent",
"(",
"<mask>",
"IWidget",
")",
"{",
"C",
".",
"gtk_widget_set_parent",
"(",
"v",
".",
"native",
"(",
")",
",",
"parent",
".",
"toWidget",
"(",
")",
")",
"\n",
"}"
]
|
17,708 | all-17709 | [
"PaintWithAlpha",
"is",
"a",
"wrapper",
"around",
"cairo_paint_with_alpha",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Context",
")",
"PaintWithAlpha",
"(",
"<mask>",
"float64",
")",
"{",
"C",
".",
"cairo_paint_with_alpha",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"double",
"(",
"alpha",
")",
")",
"\n",
"}"
]
|
17,709 | all-17710 | [
"FullClose",
"closes",
"the",
"stream",
"and",
"waits",
"to",
"read",
"an",
"EOF",
"from",
"the",
"other",
"side",
".",
"*",
"If",
"it",
"reads",
"any",
"data",
"*",
"before",
"*",
"the",
"EOF",
"it",
"resets",
"the",
"stream",
".",
"*",
"If",
"it",
"doesn",
"t",
"read",
"an",
"EOF",
"within",
"EOFTimeout",
"it",
"resets",
"the",
"stream",
".",
"You",
"ll",
"likely",
"want",
"to",
"invoke",
"this",
"as",
"go",
"FullClose",
"(",
"stream",
")",
"to",
"close",
"the",
"stream",
"in",
"the",
"background",
"."
]
| [
"func",
"FullClose",
"(",
"s",
"Stream",
")",
"error",
"{",
"if",
"err",
":=",
"s",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"s",
".",
"Reset",
"(",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"<mask>",
"AwaitEOF",
"(",
"s",
")",
"\n",
"}"
]
|
17,710 | all-17711 | [
"runs",
"apply",
"in",
"chunks",
"of",
"n",
"to",
"the",
"cluster",
"use",
"the",
"returned",
"Applier",
"to",
"Stop",
"()",
"it"
]
| [
"func",
"(",
"a",
"*",
"applySource",
")",
"apply",
"(",
"t",
"*",
"testing",
".",
"T",
",",
"c",
"*",
"cluster",
",",
"n",
"uint",
")",
"*",
"clusterApplier",
"{",
"ap",
":=",
"&",
"clusterApplier",
"{",
"stopCh",
":",
"make",
"(",
"chan",
"bool",
")",
",",
"src",
":",
"a",
"}",
"\n",
"<mask>",
"ap",
".",
"apply",
"(",
"t",
",",
"c",
",",
"n",
")",
"\n",
"return",
"ap",
"\n",
"}"
]
|
17,711 | all-17712 | [
"HasIncludeUngroupedHosts",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"g",
"*",
"GraphDefinition",
")",
"HasIncludeUngroupedHosts",
"(",
")",
"bool",
"{",
"if",
"g",
"!=",
"nil",
"&&",
"g",
".",
"IncludeUngroupedHosts",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
]
|
17,712 | all-17713 | [
"UnmarshalJSON",
"satisfies",
"json",
".",
"Unmarshaler",
"."
]
| [
"func",
"(",
"t",
"*",
"<mask>",
")",
"UnmarshalJSON",
"(",
"buf",
"[",
"]",
"byte",
")",
"error",
"{",
"return",
"easyjson",
".",
"Unmarshal",
"(",
"buf",
",",
"t",
")",
"\n",
"}"
]
|
17,713 | all-17714 | [
"Claim",
"is",
"an",
"option",
"that",
"adds",
"an",
"additional",
"claim",
"that",
"is",
"generated",
"with",
"the",
"token",
"."
]
| [
"func",
"Claim",
"(",
"name",
"string",
",",
"v",
"interface",
"{",
"}",
")",
"Option",
"{",
"return",
"func",
"(",
"tok",
"*",
"Bearer",
")",
"error",
"{",
"if",
"tok",
".",
"claims",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"tok",
".",
"claims",
"[",
"<mask>",
"]",
"=",
"v",
"\n\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
]
|
17,714 | all-17715 | [
"flattenClusterDrsConfigInfo",
"saves",
"a",
"ClusterDrsConfigInfo",
"into",
"the",
"supplied",
"ResourceData",
"."
]
| [
"func",
"flattenClusterDrsConfigInfo",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"<mask>",
".",
"ClusterDrsConfigInfo",
")",
"error",
"{",
"err",
":=",
"structure",
".",
"SetBatch",
"(",
"d",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"obj",
".",
"DefaultVmBehavior",
",",
"\"",
"\"",
":",
"obj",
".",
"Enabled",
",",
"\"",
"\"",
":",
"obj",
".",
"EnableVmBehaviorOverrides",
",",
"\"",
"\"",
":",
"obj",
".",
"VmotionRate",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"flattenResourceVSphereComputeClusterDrsAdvancedOptions",
"(",
"d",
",",
"obj",
".",
"Option",
")",
"\n",
"}"
]
|
17,715 | all-17716 | [
"Print",
"outputs",
"the",
"keys",
"and",
"values",
"parsed",
"."
]
| [
"func",
"(",
"c",
"*",
"Config",
")",
"Print",
"(",
")",
"{",
"fmt",
".",
"Println",
"(",
"c",
".",
"filename",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"c",
".",
"<mask>",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\t",
"\\n",
"\"",
",",
"k",
",",
"v",
")",
"\n",
"}",
"\n",
"}"
]
|
17,716 | all-17717 | [
"GetSearchMode",
"is",
"a",
"wrapper",
"around",
"gtk_search_bar_get_search_mode",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"SearchBar",
")",
"GetSearchMode",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_search_bar_get_search_mode",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"gobool",
"(",
"c",
")",
"\n",
"}"
]
|
17,717 | all-17718 | [
"New",
"returns",
"new",
"EventBus",
"with",
"empty",
"handlers",
"."
]
| [
"func",
"New",
"(",
")",
"Bus",
"{",
"b",
":=",
"&",
"EventBus",
"{",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"eventHandler",
")",
",",
"<mask>",
".",
"Mutex",
"{",
"}",
",",
"sync",
".",
"WaitGroup",
"{",
"}",
",",
"}",
"\n",
"return",
"Bus",
"(",
"b",
")",
"\n",
"}"
]
|
17,718 | all-17719 | [
"refersTo",
"returns",
"true",
"if",
"n",
"is",
"a",
"reference",
"to",
"the",
"same",
"object",
"as",
"x",
"."
]
| [
"func",
"refersTo",
"(",
"n",
"ast",
".",
"Node",
",",
"x",
"*",
"ast",
".",
"Ident",
")",
"bool",
"{",
"id",
",",
"ok",
":=",
"n",
".",
"(",
"*",
"ast",
".",
"Ident",
")",
"\n",
"// The test of id.Name == x.Name handles top-level unresolved",
"// identifiers, which all have Obj == nil.",
"return",
"ok",
"&&",
"id",
".",
"Obj",
"==",
"x",
".",
"Obj",
"&&",
"<mask>",
".",
"Name",
"==",
"x",
".",
"Name",
"\n",
"}"
]
|
17,719 | all-17720 | [
"retrieve",
"information",
"about",
"a",
"bound",
"renderbuffer",
"object"
]
| [
"func",
"GetRenderbufferParameteriv",
"(",
"target",
"uint32",
",",
"pname",
"uint32",
",",
"params",
"*",
"int32",
")",
"{",
"C",
".",
"glowGetRenderbufferParameteriv",
"(",
"gpGetRenderbufferParameteriv",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"pname",
")",
",",
"(",
"*",
"C",
".",
"GLint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"params",
")",
")",
")",
"\n",
"}"
]
|
17,720 | all-17721 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
]
| [
"func",
"(",
"t",
"MediaSource",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"<mask>",
".",
"String",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
]
|
17,721 | all-17722 | [
"getV1Registries",
"transforms",
"v1",
"registries",
"in",
"the",
"config",
"into",
"an",
"array",
"of",
"v2",
"registries",
"of",
"type",
"Registry",
"."
]
| [
"func",
"getV1Registries",
"(",
"config",
"*",
"tomlConfig",
")",
"(",
"[",
"]",
"Registry",
",",
"error",
")",
"{",
"regMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"Registry",
")",
"\n",
"// We must preserve the order of config.V1Registries.Search.Registries at least. The order of the",
"// other registries is not really important, but make it deterministic (the same for the same config file)",
"// to minimize behavior inconsistency and not contribute to difficult-to-reproduce situations.",
"registryOrder",
":=",
"[",
"]",
"string",
"{",
"}",
"\n\n",
"getRegistry",
":=",
"func",
"(",
"location",
"string",
")",
"(",
"*",
"Registry",
",",
"error",
")",
"{",
"// Note: _pointer_ to a long-lived object",
"var",
"err",
"error",
"\n",
"location",
",",
"err",
"=",
"parseLocation",
"(",
"location",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"reg",
",",
"exists",
":=",
"regMap",
"[",
"location",
"]",
"\n",
"if",
"!",
"exists",
"{",
"reg",
"=",
"&",
"Registry",
"{",
"Endpoint",
":",
"Endpoint",
"{",
"Location",
":",
"location",
"}",
",",
"Mirrors",
":",
"[",
"]",
"Endpoint",
"{",
"}",
",",
"Prefix",
":",
"<mask>",
",",
"}",
"\n",
"regMap",
"[",
"location",
"]",
"=",
"reg",
"\n",
"registryOrder",
"=",
"append",
"(",
"registryOrder",
",",
"location",
")",
"\n",
"}",
"\n",
"return",
"reg",
",",
"nil",
"\n",
"}",
"\n\n",
"// Note: config.V1Registries.Search needs to be processed first to ensure registryOrder is populated in the right order",
"// if one of the search registries is also in one of the other lists.",
"for",
"_",
",",
"search",
":=",
"range",
"config",
".",
"V1TOMLConfig",
".",
"Search",
".",
"Registries",
"{",
"reg",
",",
"err",
":=",
"getRegistry",
"(",
"search",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"reg",
".",
"Search",
"=",
"true",
"\n",
"}",
"\n",
"for",
"_",
",",
"blocked",
":=",
"range",
"config",
".",
"V1TOMLConfig",
".",
"Block",
".",
"Registries",
"{",
"reg",
",",
"err",
":=",
"getRegistry",
"(",
"blocked",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"reg",
".",
"Blocked",
"=",
"true",
"\n",
"}",
"\n",
"for",
"_",
",",
"insecure",
":=",
"range",
"config",
".",
"V1TOMLConfig",
".",
"Insecure",
".",
"Registries",
"{",
"reg",
",",
"err",
":=",
"getRegistry",
"(",
"insecure",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"reg",
".",
"Insecure",
"=",
"true",
"\n",
"}",
"\n\n",
"registries",
":=",
"[",
"]",
"Registry",
"{",
"}",
"\n",
"for",
"_",
",",
"location",
":=",
"range",
"registryOrder",
"{",
"reg",
":=",
"regMap",
"[",
"location",
"]",
"\n",
"registries",
"=",
"append",
"(",
"registries",
",",
"*",
"reg",
")",
"\n",
"}",
"\n",
"return",
"registries",
",",
"nil",
"\n",
"}"
]
|
17,722 | all-17723 | [
"Write",
"sends",
"a",
"batch",
"of",
"samples",
"to",
"Graphite",
"."
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"Write",
"(",
"samples",
"model",
".",
"Samples",
")",
"error",
"{",
"conn",
",",
"err",
":=",
"net",
".",
"DialTimeout",
"(",
"c",
".",
"transport",
",",
"c",
".",
"address",
",",
"c",
".",
"timeout",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"conn",
".",
"Close",
"(",
")",
"\n\n",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"for",
"_",
",",
"s",
":=",
"range",
"samples",
"{",
"k",
":=",
"pathFromMetric",
"(",
"s",
".",
"Metric",
",",
"c",
".",
"<mask>",
")",
"\n",
"t",
":=",
"float64",
"(",
"s",
".",
"Timestamp",
".",
"UnixNano",
"(",
")",
")",
"/",
"1e9",
"\n",
"v",
":=",
"float64",
"(",
"s",
".",
"Value",
")",
"\n",
"if",
"math",
".",
"IsNaN",
"(",
"v",
")",
"||",
"math",
".",
"IsInf",
"(",
"v",
",",
"0",
")",
"{",
"level",
".",
"Debug",
"(",
"c",
".",
"logger",
")",
".",
"Log",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"v",
",",
"\"",
"\"",
",",
"s",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"fmt",
".",
"Fprintf",
"(",
"&",
"buf",
",",
"\"",
"\\n",
"\"",
",",
"k",
",",
"v",
",",
"t",
")",
"\n",
"}",
"\n\n",
"_",
",",
"err",
"=",
"conn",
".",
"Write",
"(",
"buf",
".",
"Bytes",
"(",
")",
")",
"\n",
"return",
"err",
"\n",
"}"
]
|
17,723 | all-17724 | [
"HasWarningRecovery",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"t",
"*",
"ThresholdCount",
")",
"HasWarningRecovery",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"WarningRecovery",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
17,724 | all-17725 | [
"inject",
"an",
"application",
"-",
"supplied",
"message",
"into",
"the",
"debug",
"message",
"queue"
]
| [
"func",
"DebugMessageInsert",
"(",
"<mask>",
"uint32",
",",
"xtype",
"uint32",
",",
"id",
"uint32",
",",
"severity",
"uint32",
",",
"length",
"int32",
",",
"buf",
"*",
"uint8",
")",
"{",
"C",
".",
"glowDebugMessageInsert",
"(",
"gpDebugMessageInsert",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"source",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"id",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"severity",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"length",
")",
",",
"(",
"*",
"C",
".",
"GLchar",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"buf",
")",
")",
")",
"\n",
"}"
]
|
17,725 | all-17726 | [
"ReplacePixels",
"replaces",
"the",
"pixels",
"of",
"the",
"image",
"with",
"p",
".",
"The",
"given",
"p",
"must",
"represent",
"RGBA",
"pre",
"-",
"multiplied",
"alpha",
"values",
".",
"len",
"(",
"p",
")",
"must",
"equal",
"to",
"4",
"*",
"(",
"image",
"width",
")",
"*",
"(",
"image",
"height",
")",
".",
"ReplacePixels",
"may",
"be",
"slow",
"(",
"as",
"for",
"implementation",
"this",
"calls",
"glTexSubImage2D",
")",
".",
"When",
"len",
"(",
"p",
")",
"is",
"not",
"appropriate",
"ReplacePixels",
"panics",
".",
"When",
"the",
"image",
"is",
"disposed",
"ReplacePixels",
"does",
"nothing",
".",
"ReplacePixels",
"always",
"returns",
"nil",
"as",
"of",
"1",
".",
"5",
".",
"0",
"-",
"alpha",
"."
]
| [
"func",
"(",
"i",
"*",
"Image",
")",
"ReplacePixels",
"(",
"p",
"[",
"]",
"byte",
")",
"error",
"{",
"i",
".",
"copyCheck",
"(",
")",
"\n",
"if",
"i",
".",
"isDisposed",
"(",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"// TODO: Implement this.",
"if",
"i",
".",
"isSubImage",
"(",
")",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"i",
".",
"resolvePendingPixels",
"(",
"false",
")",
"\n",
"s",
":=",
"i",
".",
"Bounds",
"(",
")",
".",
"Size",
"(",
")",
"\n",
"if",
"l",
":=",
"4",
"*",
"s",
".",
"X",
"*",
"s",
".",
"Y",
";",
"len",
"(",
"p",
")",
"!=",
"l",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"len",
"(",
"p",
")",
",",
"l",
")",
")",
"\n",
"}",
"\n",
"i",
".",
"mipmap",
".",
"<mask>",
"(",
")",
".",
"ReplacePixels",
"(",
"p",
")",
"\n",
"i",
".",
"disposeMipmaps",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,726 | all-17727 | [
"HashForLabels",
"returns",
"a",
"hash",
"value",
"for",
"the",
"labels",
"matching",
"the",
"provided",
"names",
"."
]
| [
"func",
"(",
"ls",
"Labels",
")",
"HashForLabels",
"(",
"names",
"...",
"string",
")",
"uint64",
"{",
"b",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"0",
",",
"1024",
")",
"\n\n",
"for",
"_",
",",
"v",
":=",
"range",
"ls",
"{",
"for",
"_",
",",
"n",
":=",
"range",
"names",
"{",
"if",
"v",
".",
"<mask>",
"==",
"n",
"{",
"b",
"=",
"append",
"(",
"b",
",",
"v",
".",
"Name",
"...",
")",
"\n",
"b",
"=",
"append",
"(",
"b",
",",
"sep",
")",
"\n",
"b",
"=",
"append",
"(",
"b",
",",
"v",
".",
"Value",
"...",
")",
"\n",
"b",
"=",
"append",
"(",
"b",
",",
"sep",
")",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"xxhash",
".",
"Sum64",
"(",
"b",
")",
"\n",
"}"
]
|
17,727 | all-17728 | [
"AddGroup",
"helper",
"to",
"add",
"a",
"group",
"to",
"the",
"pipeline",
"manifest"
]
| [
"func",
"(",
"s",
"*",
"ConcoursePipeline",
")",
"AddGroup",
"(",
"name",
"string",
",",
"jobs",
"...",
"string",
")",
"{",
"s",
".",
"Groups",
"=",
"append",
"(",
"s",
".",
"Groups",
",",
"atc",
".",
"GroupConfig",
"{",
"Name",
":",
"<mask>",
",",
"Jobs",
":",
"jobs",
",",
"}",
")",
"\n",
"}"
]
|
17,728 | all-17729 | [
"Run",
"runs",
"RunOnce",
"in",
"a",
"loop",
"with",
"a",
"delay",
"until",
"stopChan",
"receives",
"a",
"value",
"."
]
| [
"func",
"(",
"c",
"*",
"Controller",
")",
"Run",
"(",
"stopChan",
"<-",
"chan",
"struct",
"{",
"}",
")",
"{",
"ticker",
":=",
"time",
".",
"NewTicker",
"(",
"c",
".",
"Interval",
")",
"\n",
"defer",
"ticker",
".",
"Stop",
"(",
")",
"\n",
"for",
"{",
"err",
":=",
"c",
".",
"RunOnce",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"<mask>",
"(",
"err",
")",
"\n",
"}",
"\n",
"select",
"{",
"case",
"<-",
"ticker",
".",
"C",
":",
"case",
"<-",
"stopChan",
":",
"log",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
]
|
17,729 | all-17730 | [
"SetPlaceholderText",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_entry_set_placeholder_text",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetPlaceholderText",
"(",
"text",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"text",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_entry_set_placeholder_text",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
]
|
17,730 | all-17731 | [
"GetType",
"returns",
"the",
"Type",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"r",
"*",
"Recurrence",
")",
"GetType",
"(",
")",
"string",
"{",
"if",
"r",
"==",
"nil",
"||",
"r",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"r",
".",
"Type",
"\n",
"}"
]
|
17,731 | all-17732 | [
"GetApmQuery",
"returns",
"the",
"ApmQuery",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"t",
"*",
"ToplistRequest",
")",
"GetApmQuery",
"(",
")",
"WidgetApmOrLogQuery",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"ApmQuery",
"==",
"nil",
"{",
"<mask>",
"WidgetApmOrLogQuery",
"{",
"}",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"ApmQuery",
"\n",
"}"
]
|
17,732 | all-17733 | [
"Wait",
"for",
"all",
"previously",
"-",
"added",
"operations",
"to",
"complete",
".",
"Return",
"nil",
"if",
"all",
"operations",
"succeeded",
".",
"Otherwise",
"return",
"the",
"first",
"error",
".",
"Add",
"must",
"not",
"be",
"called",
"concurrently",
"with",
"or",
"after",
"Join",
"."
]
| [
"func",
"(",
"b",
"*",
"Bundle",
")",
"Join",
"(",
")",
"error",
"{",
"b",
".",
"waitGroup",
".",
"Wait",
"(",
")",
"\n\n",
"// context.WithCancel requires that we arrange for this to be called",
"// eventually in order to avoid leaking resources. Since everything is done,",
"// to do so now is harmless.",
"b",
".",
"cancel",
"(",
")",
"\n\n",
"<mask>",
"b",
".",
"firstError",
"\n",
"}"
]
|
17,733 | all-17734 | [
"RoundTrip",
"collects",
"response",
"and",
"error",
"assuming",
"fn",
"has",
"done",
"HTTP",
"roundtrip"
]
| [
"func",
"(",
"c",
"*",
"<mask>",
")",
"RoundTrip",
"(",
"fn",
"RoundTripFn",
")",
"(",
"*",
"Response",
",",
"error",
")",
"{",
"re",
",",
"err",
":=",
"fn",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"re",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"buf",
":=",
"&",
"bytes",
".",
"Buffer",
"{",
"}",
"\n",
"_",
",",
"err",
"=",
"io",
".",
"Copy",
"(",
"buf",
",",
"re",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"Response",
"{",
"code",
":",
"re",
".",
"StatusCode",
",",
"headers",
":",
"re",
".",
"Header",
",",
"body",
":",
"buf",
",",
"cookies",
":",
"re",
".",
"Cookies",
"(",
")",
",",
"}",
",",
"nil",
"\n",
"}"
]
|
17,734 | all-17735 | [
"GetPropertyType",
"returns",
"the",
"Type",
"of",
"a",
"property",
"of",
"the",
"underlying",
"GObject",
".",
"If",
"the",
"property",
"is",
"missing",
"it",
"will",
"return",
"TYPE_INVALID",
"and",
"an",
"error",
"."
]
| [
"func",
"(",
"v",
"*",
"Object",
")",
"GetPropertyType",
"(",
"name",
"string",
")",
"(",
"Type",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n\n",
"paramSpec",
":=",
"C",
".",
"g_object_class_find_property",
"(",
"C",
".",
"_g_object_get_class",
"(",
"v",
".",
"native",
"(",
")",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"if",
"paramSpec",
"==",
"nil",
"{",
"return",
"TYPE_INVALID",
",",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"Type",
"(",
"paramSpec",
".",
"value_type",
")",
",",
"nil",
"\n",
"}"
]
|
17,735 | all-17736 | [
"NewAmazonClient",
"creates",
"an",
"amazon",
"client",
"with",
"the",
"following",
"credentials",
":",
"bucket",
"-",
"S3",
"bucket",
"name",
"distribution",
"-",
"cloudfront",
"distribution",
"ID",
"id",
"-",
"AWS",
"access",
"key",
"id",
"secret",
"-",
"AWS",
"secret",
"access",
"key",
"token",
"-",
"AWS",
"access",
"token",
"region",
"-",
"AWS",
"region"
]
| [
"func",
"NewAmazonClient",
"(",
"<mask>",
",",
"bucket",
"string",
",",
"creds",
"*",
"AmazonCreds",
",",
"distribution",
"string",
",",
"reversed",
"...",
"bool",
")",
"(",
"Client",
",",
"error",
")",
"{",
"return",
"newAmazonClient",
"(",
"region",
",",
"bucket",
",",
"creds",
",",
"distribution",
",",
"reversed",
"...",
")",
"\n",
"}"
]
|
17,736 | all-17737 | [
"LoadConfig",
"reads",
"the",
"configuration",
"from",
"the",
"config",
"path",
";",
"if",
"the",
"path",
"does",
"not",
"exist",
"it",
"returns",
"a",
"default",
"configuration",
"."
]
| [
"func",
"LoadConfig",
"(",
"path",
"string",
")",
"(",
"*",
"Config",
",",
"error",
")",
"{",
"// Open the config file",
"content",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"// Decode the yaml document",
"c",
":=",
"NewConfig",
"(",
"filepath",
".",
"Dir",
"(",
"path",
")",
",",
"false",
")",
"\n",
"err",
"=",
"yaml",
".",
"Unmarshal",
"(",
"content",
",",
"&",
"c",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"for",
"k",
",",
"r",
":=",
"range",
"c",
".",
"Remotes",
"{",
"if",
"!",
"r",
".",
"Public",
"&&",
"r",
".",
"AuthType",
"==",
"\"",
"\"",
"{",
"r",
".",
"AuthType",
"=",
"\"",
"\"",
"\n",
"c",
".",
"Remotes",
"[",
"k",
"]",
"=",
"r",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Set default values",
"if",
"c",
".",
"Remotes",
"==",
"nil",
"{",
"c",
".",
"Remotes",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"Remote",
")",
"\n",
"}",
"\n\n",
"// Apply the static remotes",
"for",
"k",
",",
"v",
":=",
"range",
"StaticRemotes",
"{",
"if",
"c",
".",
"Remotes",
"[",
"k",
"]",
".",
"Project",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Project",
"=",
"c",
".",
"Remotes",
"[",
"k",
"]",
".",
"Project",
"\n",
"}",
"\n\n",
"c",
".",
"Remotes",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n\n",
"// NOTE: Remove this once we only see a small fraction of non-simplestreams users",
"// Upgrade users to the \"simplestreams\" protocol",
"images",
",",
"ok",
":=",
"c",
".",
"Remotes",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"ok",
"&&",
"<mask>",
".",
"Protocol",
"!=",
"ImagesRemote",
".",
"Protocol",
"&&",
"images",
".",
"Addr",
"==",
"ImagesRemote",
".",
"Addr",
"{",
"c",
".",
"Remotes",
"[",
"\"",
"\"",
"]",
"=",
"ImagesRemote",
"\n",
"c",
".",
"SaveConfig",
"(",
"path",
")",
"\n",
"}",
"\n\n",
"return",
"c",
",",
"nil",
"\n",
"}"
]
|
17,737 | all-17738 | [
"parseBase128Int",
"parses",
"a",
"base",
"-",
"128",
"encoded",
"int",
"from",
"the",
"given",
"offset",
"in",
"the",
"given",
"byte",
"slice",
".",
"It",
"returns",
"the",
"value",
"and",
"the",
"new",
"offset",
"."
]
| [
"func",
"parseBase128Int",
"(",
"bytes",
"[",
"]",
"byte",
",",
"initOffset",
"int",
")",
"(",
"ret",
",",
"offset",
"int",
",",
"err",
"error",
")",
"{",
"ret",
",",
"<mask>",
",",
"err",
"=",
"_parseBase128Int",
"(",
"bytes",
",",
"initOffset",
")",
"\n\n",
"if",
"offset",
"-",
"initOffset",
">=",
"4",
"{",
"err",
"=",
"asn1",
".",
"StructuralError",
"{",
"Msg",
":",
"\"",
"\"",
"}",
"\n",
"return",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
]
|
17,738 | all-17739 | [
"===",
"ln",
"(",
"Vector",
"ValueTypeVector",
")",
"Vector",
"==="
]
| [
"func",
"funcLn",
"(",
"vals",
"[",
"]",
"<mask>",
",",
"args",
"Expressions",
",",
"enh",
"*",
"EvalNodeHelper",
")",
"Vector",
"{",
"return",
"simpleFunc",
"(",
"vals",
",",
"enh",
",",
"math",
".",
"Log",
")",
"\n",
"}"
]
|
17,739 | all-17740 | [
"ComboBoxNew",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_combo_box_new",
"()",
"."
]
| [
"func",
"ComboBoxNew",
"(",
")",
"(",
"*",
"ComboBox",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_combo_box_new",
"(",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"<mask>",
"wrapComboBox",
"(",
"obj",
")",
",",
"nil",
"\n",
"}"
]
|
17,740 | all-17741 | [
"GetUint",
"returns",
"uint",
"value",
"for",
"the",
"given",
"key",
"."
]
| [
"func",
"(",
"a",
"*",
"Args",
")",
"GetUint",
"(",
"key",
"string",
")",
"(",
"int",
",",
"error",
")",
"{",
"value",
":=",
"a",
".",
"Peek",
"(",
"<mask>",
")",
"\n",
"if",
"len",
"(",
"value",
")",
"==",
"0",
"{",
"return",
"-",
"1",
",",
"ErrNoArgValue",
"\n",
"}",
"\n",
"return",
"ParseUint",
"(",
"value",
")",
"\n",
"}"
]
|
17,741 | all-17742 | [
"overwrite",
"StackGraphicContext",
"methods",
"SetStrokeColor",
"sets",
"the",
"stroke",
"color"
]
| [
"func",
"(",
"gc",
"*",
"GraphicContext",
")",
"SetStrokeColor",
"(",
"c",
"color",
".",
"<mask>",
")",
"{",
"gc",
".",
"StackGraphicContext",
".",
"SetStrokeColor",
"(",
"c",
")",
"\n",
"gc",
".",
"pdf",
".",
"SetDrawColor",
"(",
"rgb",
"(",
"c",
")",
")",
"\n",
"}"
]
|
17,742 | all-17743 | [
"Event",
"handling",
"functions",
"GetEvents",
"connects",
"to",
"the",
"LXD",
"monitoring",
"interface"
]
| [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetEvents",
"(",
")",
"(",
"*",
"EventListener",
",",
"error",
")",
"{",
"// Prevent anything else from interacting with the listeners",
"r",
".",
"eventListenersLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"r",
".",
"eventListenersLock",
".",
"Unlock",
"(",
")",
"\n\n",
"// Setup a new listener",
"listener",
":=",
"EventListener",
"{",
"r",
":",
"r",
",",
"chActive",
":",
"make",
"(",
"chan",
"bool",
")",
",",
"}",
"\n\n",
"if",
"r",
".",
"eventListeners",
"!=",
"nil",
"{",
"// There is an existing Go routine setup, so just add another target",
"r",
".",
"eventListeners",
"=",
"append",
"(",
"r",
".",
"eventListeners",
",",
"&",
"listener",
")",
"\n",
"return",
"&",
"listener",
",",
"nil",
"\n",
"}",
"\n\n",
"// Initialize the list if needed",
"r",
".",
"eventListeners",
"=",
"[",
"]",
"*",
"EventListener",
"{",
"}",
"\n\n",
"// Setup a new connection with LXD",
"url",
",",
"err",
":=",
"r",
".",
"setQueryAttributes",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"conn",
",",
"err",
":=",
"r",
".",
"websocket",
"(",
"url",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Add the listener",
"r",
".",
"eventListeners",
"=",
"append",
"(",
"r",
".",
"eventListeners",
",",
"&",
"listener",
")",
"\n\n",
"// Spawn a watcher that will close the websocket connection after all",
"// listeners are gone.",
"stopCh",
":=",
"<mask>",
"(",
"chan",
"struct",
"{",
"}",
",",
"0",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"for",
"{",
"select",
"{",
"case",
"<-",
"time",
".",
"After",
"(",
"time",
".",
"Minute",
")",
":",
"case",
"<-",
"stopCh",
":",
"break",
"\n",
"}",
"\n\n",
"r",
".",
"eventListenersLock",
".",
"Lock",
"(",
")",
"\n",
"if",
"len",
"(",
"r",
".",
"eventListeners",
")",
"==",
"0",
"{",
"// We don't need the connection anymore, disconnect",
"conn",
".",
"Close",
"(",
")",
"\n\n",
"r",
".",
"eventListeners",
"=",
"nil",
"\n",
"r",
".",
"eventListenersLock",
".",
"Unlock",
"(",
")",
"\n",
"break",
"\n",
"}",
"\n",
"r",
".",
"eventListenersLock",
".",
"Unlock",
"(",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"// Spawn the listener",
"go",
"func",
"(",
")",
"{",
"for",
"{",
"_",
",",
"data",
",",
"err",
":=",
"conn",
".",
"ReadMessage",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// Prevent anything else from interacting with the listeners",
"r",
".",
"eventListenersLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"r",
".",
"eventListenersLock",
".",
"Unlock",
"(",
")",
"\n\n",
"// Tell all the current listeners about the failure",
"for",
"_",
",",
"listener",
":=",
"range",
"r",
".",
"eventListeners",
"{",
"listener",
".",
"err",
"=",
"err",
"\n",
"listener",
".",
"disconnected",
"=",
"true",
"\n",
"close",
"(",
"listener",
".",
"chActive",
")",
"\n",
"}",
"\n\n",
"// And remove them all from the list",
"r",
".",
"eventListeners",
"=",
"nil",
"\n\n",
"conn",
".",
"Close",
"(",
")",
"\n",
"close",
"(",
"stopCh",
")",
"\n\n",
"return",
"\n",
"}",
"\n\n",
"// Attempt to unpack the message",
"event",
":=",
"api",
".",
"Event",
"{",
"}",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"event",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"continue",
"\n",
"}",
"\n\n",
"// Extract the message type",
"if",
"event",
".",
"Type",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n\n",
"// Send the message to all handlers",
"r",
".",
"eventListenersLock",
".",
"Lock",
"(",
")",
"\n",
"for",
"_",
",",
"listener",
":=",
"range",
"r",
".",
"eventListeners",
"{",
"listener",
".",
"targetsLock",
".",
"Lock",
"(",
")",
"\n",
"for",
"_",
",",
"target",
":=",
"range",
"listener",
".",
"targets",
"{",
"if",
"target",
".",
"types",
"!=",
"nil",
"&&",
"!",
"shared",
".",
"StringInSlice",
"(",
"event",
".",
"Type",
",",
"target",
".",
"types",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"go",
"target",
".",
"function",
"(",
"event",
")",
"\n",
"}",
"\n",
"listener",
".",
"targetsLock",
".",
"Unlock",
"(",
")",
"\n",
"}",
"\n",
"r",
".",
"eventListenersLock",
".",
"Unlock",
"(",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"return",
"&",
"listener",
",",
"nil",
"\n",
"}"
]
|
17,743 | all-17744 | [
"Mutate",
"applies",
"the",
"provided",
"TransactionMutators",
"to",
"this",
"builder",
"s",
"transaction"
]
| [
"func",
"(",
"b",
"*",
"TransactionBuilder",
")",
"Mutate",
"(",
"muts",
"...",
"TransactionMutator",
")",
"{",
"if",
"b",
".",
"TX",
"==",
"nil",
"{",
"b",
".",
"TX",
"=",
"&",
"xdr",
".",
"<mask>",
"{",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"m",
":=",
"range",
"muts",
"{",
"err",
":=",
"m",
".",
"MutateTransaction",
"(",
"b",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"b",
".",
"Err",
"=",
"err",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
]
|
17,744 | all-17745 | [
"CleanupNS",
"will",
"clean",
"up",
"the",
"container",
"namespace",
"including",
"remove",
"the",
"veth",
"pair",
"and",
"stop",
"the",
"dhclient"
]
| [
"func",
"(",
"client",
"*",
"cniClient",
")",
"CleanupNS",
"(",
"ctx",
"<mask>",
".",
"Context",
",",
"cfg",
"*",
"Config",
",",
"timeout",
"time",
".",
"Duration",
")",
"error",
"{",
"derivedCtx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"ctx",
",",
"timeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"err",
":=",
"make",
"(",
"chan",
"error",
")",
"\n",
"go",
"func",
"(",
"err",
"chan",
"error",
")",
"{",
"err",
"<-",
"client",
".",
"cleanupNS",
"(",
"cfg",
")",
"\n",
"}",
"(",
"err",
")",
"\n\n",
"select",
"{",
"case",
"<-",
"derivedCtx",
".",
"Done",
"(",
")",
":",
"return",
"errors",
".",
"Wrap",
"(",
"derivedCtx",
".",
"Err",
"(",
")",
",",
"\"",
"\"",
")",
"\n",
"case",
"err",
":=",
"<-",
"err",
":",
"return",
"err",
"\n",
"}",
"\n",
"}"
]
|
17,745 | all-17746 | [
"newElementBase",
"creates",
"and",
"returns",
"an",
"element",
"base",
"."
]
| [
"func",
"newElementBase",
"(",
"ln",
"*",
"<mask>",
",",
"rslt",
"*",
"result",
",",
"src",
"*",
"source",
",",
"parent",
"element",
",",
"opts",
"*",
"Options",
")",
"elementBase",
"{",
"return",
"elementBase",
"{",
"ln",
":",
"ln",
",",
"rslt",
":",
"rslt",
",",
"src",
":",
"src",
",",
"parent",
":",
"parent",
",",
"opts",
":",
"opts",
",",
"}",
"\n",
"}"
]
|
17,746 | all-17747 | [
"memberListCommandFunc",
"executes",
"the",
"member",
"list",
"command",
"."
]
| [
"func",
"memberListCommandFunc",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"ctx",
",",
"cancel",
":=",
"commandCtx",
"(",
"cmd",
")",
"\n",
"resp",
",",
"err",
":=",
"mustClientFromCmd",
"(",
"cmd",
")",
".",
"MemberList",
"(",
"ctx",
")",
"\n",
"cancel",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"ExitWithError",
"(",
"ExitError",
",",
"err",
")",
"\n",
"}",
"\n\n",
"<mask>",
".",
"MemberList",
"(",
"*",
"resp",
")",
"\n",
"}"
]
|
17,747 | all-17748 | [
"SetPartEncoding",
"sets",
"the",
"encoding",
"of",
"the",
"part",
"added",
"to",
"the",
"message",
".",
"By",
"default",
"parts",
"use",
"the",
"same",
"encoding",
"than",
"the",
"message",
"."
]
| [
"func",
"SetPartEncoding",
"(",
"e",
"Encoding",
")",
"PartSetting",
"{",
"return",
"PartSetting",
"(",
"func",
"(",
"p",
"*",
"<mask>",
")",
"{",
"p",
".",
"encoding",
"=",
"e",
"\n",
"}",
")",
"\n",
"}"
]
|
17,748 | all-17749 | [
"Create",
"a",
"Typed",
"helper",
"from",
"the",
"JSON",
"within",
"a",
"file"
]
| [
"func",
"JsonFile",
"(",
"<mask>",
"string",
")",
"(",
"Typed",
",",
"error",
")",
"{",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"Json",
"(",
"data",
")",
"\n",
"}"
]
|
17,749 | all-17750 | [
"GetClientX509CertURLOk",
"returns",
"a",
"tuple",
"with",
"the",
"ClientX509CertURL",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"i",
"*",
"IntegrationGCPCreateRequest",
")",
"GetClientX509CertURLOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"i",
"==",
"nil",
"||",
"i",
".",
"ClientX509CertURL",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"i",
".",
"ClientX509CertURL",
",",
"true",
"\n",
"}"
]
|
17,750 | all-17751 | [
"Do",
"executes",
"LayerTree",
".",
"loadSnapshot",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"snapshotID",
"-",
"The",
"id",
"of",
"the",
"snapshot",
"."
]
| [
"func",
"(",
"p",
"*",
"LoadSnapshotParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"snapshotID",
"SnapshotID",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"LoadSnapshotReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandLoadSnapshot",
",",
"p",
",",
"&",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"SnapshotID",
",",
"nil",
"\n",
"}"
]
|
17,751 | all-17752 | [
"NewElectCommand",
"returns",
"the",
"cobra",
"command",
"for",
"elect",
"."
]
| [
"func",
"NewElectCommand",
"(",
")",
"*",
"cobra",
".",
"Command",
"{",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Run",
":",
"electCommandFunc",
",",
"}",
"\n",
"cmd",
".",
"Flags",
"(",
")",
".",
"BoolVarP",
"(",
"&",
"electListen",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"<mask>",
",",
"\"",
"\"",
")",
"\n",
"return",
"cmd",
"\n",
"}"
]
|
17,752 | all-17753 | [
"Removes",
"element",
"from",
"the",
"sequence",
"end",
".",
"Copies",
"the",
"element",
"into",
"the",
"paramter",
"element",
"."
]
| [
"func",
"(",
"seq",
"*",
"Seq",
")",
"Pop",
"(",
"<mask>",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"cvSeqPop",
"(",
"(",
"*",
"C",
".",
"struct_CvSeq",
")",
"(",
"seq",
")",
",",
"element",
")",
"\n",
"}"
]
|
17,753 | all-17754 | [
"WithTargetID",
"[",
"no",
"description",
"]",
"."
]
| [
"func",
"(",
"p",
"GetTargetInfoParams",
")",
"WithTargetID",
"(",
"targetID",
"<mask>",
")",
"*",
"GetTargetInfoParams",
"{",
"p",
".",
"TargetID",
"=",
"targetID",
"\n",
"return",
"&",
"p",
"\n",
"}"
]
|
17,754 | all-17755 | [
"deltaDisplayed",
"converts",
"a",
"coverage",
"ratio",
"delta",
"into",
"a",
"string",
"value",
"to",
"be",
"displayed",
"by",
"coverage",
"robot"
]
| [
"func",
"deltaDisplayed",
"(",
"<mask>",
"*",
"coverageChange",
")",
"string",
"{",
"if",
"change",
".",
"baseRatio",
"<",
"0",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"(",
"change",
".",
"newRatio",
"-",
"change",
".",
"baseRatio",
")",
"*",
"100",
")",
"\n",
"}"
]
|
17,755 | all-17756 | [
"/",
"*",
"func",
"marshalContext",
"(",
"p",
"uintptr",
")",
"(",
"interface",
"{}",
"error",
")",
"{",
"c",
":",
"=",
"C",
".",
"g_value_get_object",
"((",
"*",
"C",
".",
"GValue",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"p",
")))",
"obj",
":",
"=",
"wrapObject",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
"))",
"return",
"wrapContext",
"(",
"obj",
")",
"nil",
"}"
]
| [
"func",
"WrapContext",
"(",
"p",
"uintptr",
")",
"*",
"Context",
"{",
"context",
":=",
"new",
"(",
"Context",
")",
"\n",
"context",
".",
"pangoContext",
"=",
"(",
"*",
"C",
".",
"PangoContext",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"p",
")",
")",
"\n",
"return",
"<mask>",
"\n",
"}"
]
|
17,756 | all-17757 | [
"ReadResponse",
"reads",
"a",
"server",
"response",
"into",
"the",
"received",
"o",
"."
]
| [
"func",
"(",
"o",
"*",
"PutAppsAppRoutesRouteReader",
")",
"ReadResponse",
"(",
"response",
"runtime",
".",
"ClientResponse",
",",
"consumer",
"runtime",
".",
"Consumer",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"switch",
"response",
".",
"Code",
"(",
")",
"{",
"case",
"201",
":",
"result",
":=",
"NewPutAppsAppRoutesRouteCreated",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n\n",
"case",
"400",
":",
"result",
":=",
"NewPutAppsAppRoutesRouteBadRequest",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"<mask>",
"\n\n",
"case",
"500",
":",
"result",
":=",
"NewPutAppsAppRoutesRouteInternalServerError",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n\n",
"default",
":",
"result",
":=",
"NewPutAppsAppRoutesRouteDefault",
"(",
"response",
".",
"Code",
"(",
")",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n",
"}",
"\n",
"}"
]
|
17,757 | all-17758 | [
"Dispatch",
"implements",
"Dispatcher",
".",
"Dispatch"
]
| [
"func",
"(",
"d",
"*",
"ParallelDispatcher",
")",
"Dispatch",
"(",
"cmd",
"interface",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"d",
".",
"mutex",
".",
"RLock",
"(",
")",
"\n",
"defer",
"d",
".",
"mutex",
".",
"RUnlock",
"(",
")",
"\n\n",
"defer",
"func",
"(",
")",
"{",
"if",
"e",
":=",
"recover",
"(",
")",
";",
"e",
"!=",
"nil",
"{",
"err",
"=",
"e",
".",
"(",
"error",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"var",
"found",
"int32",
"\n",
"wg",
":=",
"&",
"sync",
".",
"WaitGroup",
"{",
"}",
"\n",
"errCh",
":=",
"make",
"(",
"chan",
"error",
",",
"len",
"(",
"d",
".",
"handlers",
")",
")",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"d",
".",
"handlers",
"{",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"go",
"d",
".",
"dispatch",
"(",
"wg",
",",
"errCh",
",",
"&",
"found",
",",
"handler",
",",
"cmd",
")",
"\n",
"}",
"\n\n",
"wg",
".",
"Wait",
"(",
")",
"\n",
"close",
"(",
"errCh",
")",
"\n\n",
"if",
"found",
"!=",
"1",
"{",
"return",
"&",
"NoHandlerFoundError",
"{",
"Command",
":",
"cmd",
",",
"}",
"\n",
"}",
"\n\n",
"errs",
":=",
"[",
"]",
"error",
"{",
"}",
"\n",
"for",
"{",
"e",
",",
"ok",
":=",
"<-",
"errCh",
"\n",
"if",
"!",
"ok",
"{",
"break",
"\n",
"}",
"\n",
"if",
"e",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"errs",
"=",
"append",
"(",
"errs",
",",
"e",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"errs",
")",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n\n",
"err",
"=",
"errorgroup",
".",
"New",
"(",
"errs",
")",
"\n\n",
"return",
"\n",
"}"
]
|
17,758 | all-17759 | [
"title",
":",
"Update",
"service",
"broker",
"path",
":",
"/",
"brokers",
"/",
"{",
"broker",
"}",
"method",
":",
"PUT",
"responses",
":",
"200",
":",
"Service",
"broker",
"updated",
"401",
":",
"Unauthorized",
"404",
":",
"Not",
"Found"
]
| [
"func",
"serviceBrokerUpdate",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"if",
"!",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermServiceBrokerUpdate",
")",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"brokerName",
":=",
"r",
".",
"URL",
".",
"<mask>",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"brokerName",
"==",
"\"",
"\"",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"\"",
"\"",
"}",
"\n",
"}",
"\n",
"broker",
",",
"err",
":=",
"decodeServiceBroker",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"event",
".",
"Target",
"{",
"Type",
":",
"event",
".",
"TargetTypeServiceBroker",
",",
"Value",
":",
"broker",
".",
"Name",
"}",
",",
"Kind",
":",
"permission",
".",
"PermServiceBrokerUpdate",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermServiceBrokerReadEvents",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"if",
"err",
"=",
"servicemanager",
".",
"ServiceBroker",
".",
"Update",
"(",
"brokerName",
",",
"*",
"broker",
")",
";",
"err",
"==",
"service",
".",
"ErrServiceBrokerNotFound",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusNotFound",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
]
|
17,759 | all-17760 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"GetBackgroundColorsParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss48",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
]
|
17,760 | all-17761 | [
"Sign",
"creates",
"a",
"signature",
"for",
"buf",
"returning",
"it",
"as",
"a",
"URL",
"-",
"safe",
"base64",
"encoded",
"byte",
"slice",
"."
]
| [
"func",
"(",
"es",
"*",
"EccSigner",
")",
"Sign",
"(",
"buf",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"sig",
",",
"err",
":=",
"<mask>",
".",
"SignBytes",
"(",
"buf",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"enc",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"b64",
".",
"EncodedLen",
"(",
"len",
"(",
"sig",
")",
")",
")",
"\n",
"b64",
".",
"Encode",
"(",
"enc",
",",
"sig",
")",
"\n\n",
"return",
"enc",
",",
"nil",
"\n",
"}"
]
|
17,761 | all-17762 | [
"AddFlags",
"binds",
"flags",
"to",
"options",
"."
]
| [
"func",
"(",
"o",
"*",
"Options",
")",
"AddFlags",
"(",
"flags",
"*",
"flag",
".",
"FlagSet",
")",
"{",
"flags",
".",
"StringVar",
"(",
"&",
"o",
".",
"Log",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"o",
".",
"<mask>",
".",
"AddFlags",
"(",
"flags",
")",
"\n",
"}"
]
|
17,762 | all-17763 | [
"GET",
"=",
">",
"Get"
]
| [
"func",
"toVerb",
"(",
"text",
"string",
")",
"(",
"res",
"string",
")",
"{",
"res",
"=",
"strings",
".",
"ToUpper",
"(",
"string",
"(",
"text",
"[",
"0",
"]",
")",
")",
"+",
"strings",
".",
"ToLower",
"(",
"text",
"[",
"1",
":",
"]",
")",
"\n",
"if",
"text",
"==",
"\"",
"\"",
"||",
"<mask>",
"==",
"\"",
"\"",
"{",
"res",
"+=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"\n",
"}"
]
|
17,763 | all-17764 | [
"ParseMAC",
"parses",
"s",
"as",
"an",
"IEEE",
"802",
"MAC",
"-",
"48",
"EUI",
"-",
"48",
"or",
"EUI",
"-",
"64",
"using",
"one",
"of",
"the",
"following",
"formats",
":",
"01",
":",
"23",
":",
"45",
":",
"67",
":",
"89",
":",
"ab",
"01",
":",
"23",
":",
"45",
":",
"67",
":",
"89",
":",
"ab",
":",
"cd",
":",
"ef",
"01",
"-",
"23",
"-",
"45",
"-",
"67",
"-",
"89",
"-",
"ab",
"01",
"-",
"23",
"-",
"45",
"-",
"67",
"-",
"89",
"-",
"ab",
"-",
"cd",
"-",
"ef",
"0123",
".",
"4567",
".",
"89ab",
"0123",
".",
"4567",
".",
"89ab",
".",
"cdef"
]
| [
"func",
"ParseOUI",
"(",
"s",
"string",
",",
"size",
"int",
")",
"(",
"hw",
"HardwareAddr",
",",
"err",
"error",
")",
"{",
"if",
"s",
"[",
"2",
"]",
"==",
"':'",
"||",
"s",
"[",
"2",
"]",
"==",
"'-'",
"{",
"if",
"(",
"len",
"(",
"s",
")",
"+",
"1",
")",
"%",
"3",
"!=",
"0",
"{",
"goto",
"error",
"\n",
"}",
"\n\n",
"n",
":=",
"(",
"len",
"(",
"s",
")",
"+",
"1",
")",
"/",
"3",
"\n\n",
"hw",
"=",
"<mask>",
"(",
"HardwareAddr",
",",
"size",
")",
"\n",
"for",
"x",
",",
"i",
":=",
"0",
",",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
"{",
"var",
"ok",
"bool",
"\n",
"if",
"hw",
"[",
"i",
"]",
",",
"ok",
"=",
"xtoi2",
"(",
"s",
"[",
"x",
":",
"]",
",",
"s",
"[",
"2",
"]",
")",
";",
"!",
"ok",
"{",
"goto",
"error",
"\n",
"}",
"\n",
"x",
"+=",
"3",
"\n",
"}",
"\n",
"}",
"else",
"{",
"goto",
"error",
"\n",
"}",
"\n",
"return",
"hw",
",",
"nil",
"\n\n",
"error",
":",
"return",
"nil",
",",
"ErrInvalidMACAddress",
"\n",
"}"
]
|
17,764 | all-17765 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
]
| [
"func",
"(",
"r",
"*",
"IpAddressBinding",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"IpAddressBindingLocator",
"{",
"for",
"_",
",",
"l",
":=",
"<mask>",
"r",
".",
"Links",
"{",
"if",
"l",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"return",
"api",
".",
"IpAddressBindingLocator",
"(",
"l",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,765 | all-17766 | [
"ListStatuses",
"returns",
"individual",
"status",
"contexts",
"on",
"a",
"commit",
"."
]
| [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"ListStatuses",
"(",
"org",
",",
"repo",
",",
"ref",
"string",
")",
"(",
"[",
"]",
"github",
".",
"Status",
",",
"error",
")",
"{",
"return",
"f",
".",
"CreatedStatuses",
"[",
"<mask>",
"]",
",",
"nil",
"\n",
"}"
]
|
17,766 | all-17767 | [
"GetFallbackResolution",
"is",
"a",
"wrapper",
"around",
"cairo_surface_get_fallback_resolution",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Surface",
")",
"GetFallbackResolution",
"(",
")",
"(",
"xPPI",
",",
"yPPI",
"float64",
")",
"{",
"<mask>",
"x",
",",
"y",
"C",
".",
"double",
"\n",
"C",
".",
"cairo_surface_get_fallback_resolution",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"x",
",",
"&",
"y",
")",
"\n",
"return",
"float64",
"(",
"x",
")",
",",
"float64",
"(",
"y",
")",
"\n",
"}"
]
|
17,767 | all-17768 | [
"RegisterStmt",
"register",
"a",
"SQL",
"statement",
".",
"Registered",
"statements",
"will",
"be",
"prepared",
"upfront",
"and",
"re",
"-",
"used",
"to",
"speed",
"up",
"execution",
".",
"Return",
"a",
"unique",
"registration",
"code",
"."
]
| [
"func",
"RegisterStmt",
"(",
"sql",
"string",
")",
"int",
"{",
"code",
":=",
"len",
"(",
"stmts",
")",
"\n",
"stmts",
"[",
"<mask>",
"]",
"=",
"sql",
"\n",
"return",
"code",
"\n",
"}"
]
|
17,768 | all-17769 | [
"HasShowTick",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"n",
"*",
"NoteDefinition",
")",
"HasShowTick",
"(",
")",
"bool",
"{",
"if",
"n",
"!=",
"nil",
"&&",
"n",
".",
"ShowTick",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
17,769 | all-17770 | [
"GetHolidays",
"returns",
"the",
"holidays",
"for",
"the",
"given",
"ISO",
"3166",
"-",
"2",
"countryCode",
"and",
"year"
]
| [
"func",
"GetHolidays",
"(",
"countryCode",
"string",
",",
"year",
"int",
")",
"(",
"[",
"]",
"Holiday",
",",
"error",
")",
"{",
"requiredCodes",
":=",
"[",
"]",
"string",
"{",
"countryCode",
"}",
"\n",
"result",
":=",
"[",
"]",
"Holiday",
"{",
"}",
"\n\n",
"for",
"len",
"(",
"requiredCodes",
")",
">",
"0",
"{",
"cc",
":=",
"requiredCodes",
"[",
"0",
"]",
"\n",
"hds",
",",
"ok",
":=",
"holidayProviders",
"[",
"cc",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"HolidayDataNotFoundError",
"\n",
"}",
"\n\n",
"requiredCodes",
"=",
"append",
"(",
"requiredCodes",
",",
"hds",
".",
"GetIncludes",
"(",
")",
"...",
")",
"\n",
"<mask>",
"=",
"append",
"(",
"result",
",",
"hds",
".",
"GetHolidays",
"(",
"year",
")",
"...",
")",
"\n\n",
"requiredCodes",
"=",
"requiredCodes",
"[",
"1",
":",
"]",
"\n",
"}",
"\n\n",
"sort",
".",
"Sort",
"(",
"holidays",
"(",
"result",
")",
")",
"\n\n",
"return",
"result",
",",
"nil",
"\n",
"}"
]
|
17,770 | all-17771 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"Info",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoTarget5",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
17,771 | all-17772 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"QuerySelectorReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom19",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
17,772 | all-17773 | [
"EndOfHour",
"end",
"of",
"hour"
]
| [
"func",
"(",
"now",
"*",
"Now",
")",
"EndOfHour",
"(",
")",
"time",
".",
"Time",
"{",
"return",
"now",
".",
"BeginningOfHour",
"(",
")",
".",
"Add",
"(",
"<mask>",
".",
"Hour",
"-",
"time",
".",
"Nanosecond",
")",
"\n",
"}"
]
|
17,773 | all-17774 | [
"BFS",
"does",
"breadth",
"-",
"first",
"search",
"and",
"returns",
"the",
"list",
"of",
"vertices",
".",
"(",
"https",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Breadth",
"-",
"first_search",
")",
"0",
".",
"BFS",
"(",
"G",
"v",
")",
":",
"1",
".",
"2",
".",
"let",
"Q",
"be",
"a",
"queue",
"3",
".",
"Q",
".",
"push",
"(",
"v",
")",
"4",
".",
"label",
"v",
"as",
"visited",
"5",
".",
"6",
".",
"while",
"Q",
"is",
"not",
"empty",
":",
"7",
".",
"8",
".",
"u",
"=",
"Q",
".",
"dequeue",
"()",
"9",
".",
"10",
".",
"for",
"each",
"vertex",
"w",
"adjacent",
"to",
"u",
":",
"11",
".",
"12",
".",
"if",
"w",
"is",
"not",
"visited",
"yet",
":",
"13",
".",
"Q",
".",
"push",
"(",
"w",
")",
"14",
".",
"label",
"w",
"as",
"visited"
]
| [
"func",
"BFS",
"(",
"g",
"Graph",
",",
"id",
"ID",
")",
"[",
"]",
"ID",
"{",
"if",
"_",
",",
"err",
":=",
"g",
".",
"GetNode",
"(",
"id",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"q",
":=",
"[",
"]",
"ID",
"{",
"id",
"}",
"\n",
"visited",
":=",
"make",
"(",
"map",
"[",
"ID",
"]",
"bool",
")",
"\n",
"visited",
"[",
"id",
"]",
"=",
"true",
"\n",
"rs",
":=",
"[",
"]",
"ID",
"{",
"id",
"}",
"\n\n",
"// while Q is not empty:",
"for",
"len",
"(",
"q",
")",
"!=",
"0",
"{",
"u",
":=",
"q",
"[",
"0",
"]",
"\n",
"q",
"=",
"q",
"[",
"1",
":",
"len",
"(",
"q",
")",
":",
"len",
"(",
"q",
")",
"]",
"\n\n",
"// for each vertex w adjacent to u:",
"cmap",
",",
"_",
":=",
"g",
".",
"GetTargets",
"(",
"u",
")",
"\n",
"for",
"_",
",",
"w",
":=",
"range",
"cmap",
"{",
"// if w is not visited yet:",
"if",
"_",
",",
"ok",
":=",
"visited",
"[",
"w",
".",
"ID",
"(",
")",
"]",
";",
"!",
"ok",
"{",
"q",
"=",
"append",
"(",
"q",
",",
"w",
".",
"ID",
"(",
")",
")",
"// Q.push(w)",
"\n",
"visited",
"[",
"w",
".",
"ID",
"(",
")",
"]",
"=",
"true",
"// label w as visited",
"\n\n",
"rs",
"=",
"append",
"(",
"rs",
",",
"w",
")",
"\n",
"}",
"\n",
"}",
"\n",
"pmap",
",",
"_",
":=",
"g",
".",
"GetSources",
"(",
"u",
")",
"\n",
"for",
"_",
",",
"w",
":=",
"range",
"pmap",
"{",
"// if w is not visited yet:",
"if",
"_",
",",
"<mask>",
":=",
"visited",
"[",
"w",
".",
"ID",
"(",
")",
"]",
";",
"!",
"ok",
"{",
"q",
"=",
"append",
"(",
"q",
",",
"w",
".",
"ID",
"(",
")",
")",
"// Q.push(w)",
"\n",
"visited",
"[",
"w",
".",
"ID",
"(",
")",
"]",
"=",
"true",
"// label w as visited",
"\n\n",
"rs",
"=",
"append",
"(",
"rs",
",",
"w",
".",
"ID",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"rs",
"\n",
"}"
]
|
17,774 | all-17775 | [
"NewDefaultFieldsFormatter",
"returns",
"a",
"DefaultFieldsFormatter",
"if",
"wrappedFormatter",
"is",
"nil",
"&logrus",
".",
"JSONFormatter",
"{}",
"will",
"be",
"used",
"instead"
]
| [
"func",
"NewDefaultFieldsFormatter",
"(",
"wrappedFormatter",
"logrus",
".",
"Formatter",
",",
"defaultFields",
"logrus",
".",
"Fields",
",",
")",
"*",
"DefaultFieldsFormatter",
"{",
"res",
":=",
"&",
"DefaultFieldsFormatter",
"{",
"WrappedFormatter",
":",
"wrappedFormatter",
",",
"DefaultFields",
":",
"defaultFields",
",",
"}",
"\n",
"if",
"<mask>",
".",
"WrappedFormatter",
"==",
"nil",
"{",
"res",
".",
"WrappedFormatter",
"=",
"&",
"logrus",
".",
"JSONFormatter",
"{",
"}",
"\n",
"}",
"\n",
"return",
"res",
"\n",
"}"
]
|
17,775 | all-17776 | [
"flattenClusterInfraUpdateHaConfigInfo",
"saves",
"a",
"ClusterInfraUpdateHaConfigInfo",
"into",
"the",
"supplied",
"ResourceData",
"."
]
| [
"func",
"flattenClusterInfraUpdateHaConfigInfo",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"<mask>",
".",
"ClusterInfraUpdateHaConfigInfo",
")",
"error",
"{",
"return",
"structure",
".",
"SetBatch",
"(",
"d",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"obj",
".",
"Behavior",
",",
"\"",
"\"",
":",
"obj",
".",
"Enabled",
",",
"\"",
"\"",
":",
"obj",
".",
"ModerateRemediation",
",",
"\"",
"\"",
":",
"obj",
".",
"Providers",
",",
"\"",
"\"",
":",
"obj",
".",
"SevereRemediation",
",",
"}",
")",
"\n",
"}"
]
|
17,776 | all-17777 | [
"UpdateStatus",
"does",
"nothing",
"on",
"a",
"dry",
"-",
"run",
"client"
]
| [
"func",
"(",
"c",
"*",
"dryRunProwJobClient",
")",
"UpdateStatus",
"(",
"*",
"prowapi",
".",
"ProwJob",
")",
"(",
"*",
"prowapi",
".",
"ProwJob",
",",
"<mask>",
")",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}"
]
|
17,777 | all-17778 | [
"Returns",
"information",
"about",
"several",
"active",
"uniform",
"variables",
"for",
"the",
"specified",
"program",
"object"
]
| [
"func",
"GetActiveUniformsiv",
"(",
"program",
"uint32",
",",
"uniformCount",
"int32",
",",
"uniformIndices",
"*",
"uint32",
",",
"pname",
"uint32",
",",
"params",
"*",
"int32",
")",
"{",
"C",
".",
"glowGetActiveUniformsiv",
"(",
"gpGetActiveUniformsiv",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"uniformCount",
")",
",",
"(",
"*",
"C",
".",
"GLuint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"uniformIndices",
")",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"pname",
")",
",",
"(",
"*",
"C",
".",
"GLint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"params",
")",
")",
")",
"\n",
"}"
]
|
17,778 | all-17779 | [
"IsTerminal",
"returns",
"true",
"if",
"the",
"given",
"file",
"descriptor",
"is",
"a",
"terminal",
"."
]
| [
"func",
"IsTerminal",
"(",
"fd",
"int",
")",
"bool",
"{",
"<mask>",
"st",
"uint32",
"\n",
"err",
":=",
"windows",
".",
"GetConsoleMode",
"(",
"windows",
".",
"Handle",
"(",
"fd",
")",
",",
"&",
"st",
")",
"\n",
"return",
"err",
"==",
"nil",
"\n",
"}"
]
|
17,779 | all-17780 | [
"dropBoundingSet",
"drops",
"the",
"capability",
"bounding",
"set",
"to",
"those",
"specified",
"in",
"the",
"whitelist",
"."
]
| [
"func",
"(",
"w",
"*",
"whitelist",
")",
"dropBoundingSet",
"(",
")",
"error",
"{",
"w",
".",
"pid",
".",
"Clear",
"(",
"capability",
".",
"BOUNDS",
")",
"\n",
"w",
".",
"pid",
".",
"<mask>",
"(",
"capability",
".",
"BOUNDS",
",",
"w",
".",
"keep",
"...",
")",
"\n",
"return",
"w",
".",
"pid",
".",
"Apply",
"(",
"capability",
".",
"BOUNDS",
")",
"\n",
"}"
]
|
17,780 | all-17781 | [
"Merge",
"implements",
"GossipData",
"."
]
| [
"func",
"(",
"d",
"*",
"topologyGossipData",
")",
"Merge",
"(",
"other",
"GossipData",
")",
"GossipData",
"{",
"names",
":=",
"make",
"(",
"peerNameSet",
")",
"\n",
"for",
"name",
":=",
"range",
"d",
".",
"<mask>",
"{",
"names",
"[",
"name",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"for",
"name",
":=",
"range",
"other",
".",
"(",
"*",
"topologyGossipData",
")",
".",
"update",
"{",
"names",
"[",
"name",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"return",
"&",
"topologyGossipData",
"{",
"peers",
":",
"d",
".",
"peers",
",",
"update",
":",
"names",
"}",
"\n",
"}"
]
|
17,781 | all-17782 | [
"info",
"log"
]
| [
"func",
"(",
"f",
"*",
"FileLogger",
")",
"Info",
"(",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"_",
",",
"file",
",",
"line",
",",
"_",
":=",
"runtime",
".",
"Caller",
"(",
"2",
")",
"//calldepth=3",
"\n",
"if",
"f",
".",
"logLevel",
"<=",
"INFO",
"{",
"f",
".",
"logChan",
"<-",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"shortFileName",
"(",
"file",
")",
",",
"line",
")",
"+",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\033",
"\"",
"+",
"<mask>",
"+",
"\"",
"\\033",
"\"",
",",
"v",
"...",
")",
"\n",
"}",
"\n",
"}"
]
|
17,782 | all-17783 | [
"copyFile",
"copies",
"the",
"file",
"at",
"src",
"to",
"the",
"path",
"at",
"dst",
".",
"Any",
"errors",
"that",
"occur",
"are",
"returned",
"."
]
| [
"func",
"copyFile",
"(",
"src",
",",
"dst",
"string",
")",
"error",
"{",
"s",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"src",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"s",
".",
"Close",
"(",
")",
"\n\n",
"stat",
",",
"err",
":=",
"s",
".",
"Stat",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"d",
",",
"err",
":=",
"os",
".",
"OpenFile",
"(",
"dst",
",",
"os",
".",
"O_WRONLY",
"|",
"os",
".",
"O_CREATE",
"|",
"<mask>",
".",
"O_TRUNC",
",",
"stat",
".",
"Mode",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"io",
".",
"Copy",
"(",
"d",
",",
"s",
")",
";",
"err",
"!=",
"nil",
"{",
"d",
".",
"Close",
"(",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"d",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// io.Copy can restrict file permissions based on umask.",
"return",
"os",
".",
"Chmod",
"(",
"dst",
",",
"stat",
".",
"Mode",
"(",
")",
")",
"\n",
"}"
]
|
17,783 | all-17784 | [
"IsObjectIdHex",
"returns",
"whether",
"s",
"is",
"a",
"valid",
"hex",
"representation",
"of",
"an",
"ObjectId",
".",
"See",
"the",
"ObjectIdHex",
"function",
"."
]
| [
"func",
"IsObjectIdHex",
"(",
"s",
"string",
")",
"bool",
"{",
"if",
"len",
"(",
"s",
")",
"!=",
"24",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"_",
",",
"err",
":=",
"hex",
".",
"DecodeString",
"(",
"s",
")",
"\n",
"return",
"err",
"==",
"nil",
"\n",
"}"
]
|
17,784 | all-17785 | [
"Do",
"executes",
"Target",
".",
"attachToTarget",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"sessionID",
"-",
"Id",
"assigned",
"to",
"the",
"session",
"."
]
| [
"func",
"(",
"p",
"*",
"AttachToTargetParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"sessionID",
"SessionID",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"AttachToTargetReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandAttachToTarget",
",",
"p",
",",
"&",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"SessionID",
",",
"nil",
"\n",
"}"
]
|
17,785 | all-17786 | [
"ContainSubstring",
"succeeds",
"if",
"actual",
"is",
"a",
"string",
"or",
"stringer",
"that",
"contains",
"the",
"passed",
"-",
"in",
"substring",
".",
"Optional",
"arguments",
"can",
"be",
"provided",
"to",
"construct",
"the",
"substring",
"via",
"fmt",
".",
"Sprintf",
"()",
"."
]
| [
"func",
"ContainSubstring",
"(",
"substr",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"<mask>",
".",
"GomegaMatcher",
"{",
"return",
"&",
"matchers",
".",
"ContainSubstringMatcher",
"{",
"Substr",
":",
"substr",
",",
"Args",
":",
"args",
",",
"}",
"\n",
"}"
]
|
17,786 | all-17787 | [
"PrintRow",
"-",
"Prints",
"table",
"with",
"only",
"one",
"row",
"."
]
| [
"func",
"PrintRow",
"(",
"fields",
"[",
"]",
"string",
",",
"row",
"<mask>",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"{",
"table",
":=",
"New",
"(",
"fields",
")",
"\n",
"table",
".",
"AddRow",
"(",
"row",
")",
"\n",
"table",
".",
"Print",
"(",
")",
"\n",
"}"
]
|
17,787 | all-17788 | [
"/",
"*",
"DataFromSection",
"reads",
"the",
"values",
"of",
"a",
"section",
"into",
"a",
"struct",
".",
"The",
"values",
"should",
"be",
"of",
"the",
"types",
":",
"bool",
"string",
"[]",
"string",
"int64",
"[]",
"int64",
"float64",
"[]",
"float64",
"Values",
"that",
"are",
"missing",
"in",
"the",
"section",
"are",
"not",
"set",
"and",
"values",
"that",
"are",
"missing",
"in",
"the",
"struct",
"but",
"present",
"in",
"the",
"section",
"are",
"ignored",
"."
]
| [
"func",
"(",
"config",
"*",
"Config",
")",
"DataFromSection",
"(",
"sectionName",
"string",
",",
"data",
"interface",
"{",
"}",
")",
"bool",
"{",
"section",
":=",
"config",
".",
"sectionForName",
"(",
"sectionName",
")",
"\n\n",
"if",
"section",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"values",
":=",
"section",
".",
"values",
"\n\n",
"fields",
":=",
"reflect",
".",
"ValueOf",
"(",
"data",
")",
".",
"Elem",
"(",
")",
"\n",
"dataType",
":=",
"fields",
".",
"Type",
"(",
")",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"fields",
".",
"NumField",
"(",
")",
";",
"i",
"++",
"{",
"field",
":=",
"fields",
".",
"Field",
"(",
"i",
")",
"\n\n",
"if",
"!",
"field",
".",
"CanSet",
"(",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"fieldType",
":=",
"dataType",
".",
"Field",
"(",
"i",
")",
"\n",
"fieldName",
":=",
"fieldType",
".",
"Name",
"\n\n",
"switch",
"field",
".",
"Type",
"(",
")",
".",
"Kind",
"(",
")",
"{",
"case",
"reflect",
".",
"Bool",
":",
"field",
".",
"SetBool",
"(",
"getBoolean",
"(",
"values",
",",
"fieldName",
",",
"field",
".",
"Interface",
"(",
")",
".",
"(",
"bool",
")",
")",
")",
"\n",
"case",
"reflect",
".",
"Int64",
":",
"field",
".",
"SetInt",
"(",
"getInteger",
"(",
"values",
",",
"fieldName",
",",
"<mask>",
".",
"Interface",
"(",
")",
".",
"(",
"int64",
")",
")",
")",
"\n",
"case",
"reflect",
".",
"Float64",
":",
"field",
".",
"SetFloat",
"(",
"getFloat",
"(",
"values",
",",
"fieldName",
",",
"field",
".",
"Interface",
"(",
")",
".",
"(",
"float64",
")",
")",
")",
"\n",
"case",
"reflect",
".",
"String",
":",
"field",
".",
"SetString",
"(",
"getString",
"(",
"values",
",",
"fieldName",
",",
"field",
".",
"Interface",
"(",
")",
".",
"(",
"string",
")",
")",
")",
"\n",
"case",
"reflect",
".",
"Array",
",",
"reflect",
".",
"Slice",
":",
"switch",
"fieldType",
".",
"Type",
".",
"Elem",
"(",
")",
".",
"Kind",
"(",
")",
"{",
"case",
"reflect",
".",
"Int64",
":",
"ints",
":=",
"getIntegers",
"(",
"values",
",",
"fieldName",
")",
"\n",
"if",
"ints",
"!=",
"nil",
"{",
"field",
".",
"Set",
"(",
"reflect",
".",
"ValueOf",
"(",
"ints",
")",
")",
"\n",
"}",
"\n",
"case",
"reflect",
".",
"Float64",
":",
"floats",
":=",
"getFloats",
"(",
"values",
",",
"fieldName",
")",
"\n",
"if",
"floats",
"!=",
"nil",
"{",
"field",
".",
"Set",
"(",
"reflect",
".",
"ValueOf",
"(",
"floats",
")",
")",
"\n",
"}",
"\n",
"case",
"reflect",
".",
"String",
":",
"strings",
":=",
"getStrings",
"(",
"values",
",",
"fieldName",
")",
"\n",
"if",
"strings",
"!=",
"nil",
"{",
"field",
".",
"Set",
"(",
"reflect",
".",
"ValueOf",
"(",
"strings",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
]
|
17,788 | all-17789 | [
"MarshalEasyJSON",
"writes",
"the",
"UUID4",
"to",
"a",
"easyjson",
".",
"Writer"
]
| [
"func",
"(",
"u",
"UUID4",
")",
"MarshalEasyJSON",
"(",
"w",
"*",
"jwriter",
".",
"<mask>",
")",
"{",
"w",
".",
"String",
"(",
"string",
"(",
"u",
")",
")",
"\n",
"}"
]
|
17,789 | all-17790 | [
"diffIDComputationGoroutine",
"reads",
"all",
"input",
"from",
"layerStream",
"uncompresses",
"using",
"decompressor",
"if",
"necessary",
"and",
"sends",
"its",
"digest",
"and",
"status",
"if",
"any",
"to",
"dest",
"."
]
| [
"func",
"diffIDComputationGoroutine",
"(",
"dest",
"chan",
"<-",
"diffIDResult",
",",
"layerStream",
"io",
".",
"ReadCloser",
",",
"decompressor",
"compression",
".",
"DecompressorFunc",
")",
"{",
"result",
":=",
"diffIDResult",
"{",
"digest",
":",
"\"",
"\"",
",",
"err",
":",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
",",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"dest",
"<-",
"result",
"}",
"(",
")",
"\n",
"defer",
"layerStream",
".",
"Close",
"(",
")",
"// We do not care to bother the other end of the pipe with other failures; we send them to dest instead.",
"\n\n",
"result",
".",
"digest",
",",
"result",
".",
"err",
"=",
"computeDiffID",
"(",
"layerStream",
",",
"decompressor",
")",
"\n",
"}"
]
|
17,790 | all-17791 | [
"accumulate",
"returns",
"the",
"supplied",
"PRs",
"sorted",
"into",
"three",
"buckets",
"based",
"on",
"their",
"accumulated",
"state",
"across",
"the",
"presubmits",
"."
]
| [
"func",
"accumulate",
"(",
"presubmits",
"map",
"[",
"int",
"]",
"[",
"]",
"config",
".",
"Presubmit",
",",
"prs",
"[",
"]",
"PullRequest",
",",
"pjs",
"[",
"]",
"prowapi",
".",
"ProwJob",
",",
"log",
"*",
"logrus",
".",
"Entry",
")",
"(",
"successes",
",",
"pendings",
",",
"nones",
"[",
"]",
"PullRequest",
")",
"{",
"for",
"_",
",",
"pr",
":=",
"range",
"prs",
"{",
"// Accumulate the best result for each job.",
"psStates",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"simpleState",
")",
"\n",
"for",
"_",
",",
"pj",
":=",
"range",
"pjs",
"{",
"if",
"pj",
".",
"Spec",
".",
"Type",
"!=",
"prowapi",
".",
"PresubmitJob",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"pj",
".",
"Spec",
".",
"Refs",
".",
"Pulls",
"[",
"0",
"]",
".",
"Number",
"!=",
"int",
"(",
"pr",
".",
"Number",
")",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"pj",
".",
"Spec",
".",
"Refs",
".",
"Pulls",
"[",
"0",
"]",
".",
"SHA",
"!=",
"string",
"(",
"pr",
".",
"HeadRefOID",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"name",
":=",
"pj",
".",
"Spec",
".",
"Context",
"\n",
"oldState",
":=",
"psStates",
"[",
"<mask>",
"]",
"\n",
"newState",
":=",
"toSimpleState",
"(",
"pj",
".",
"Status",
".",
"State",
")",
"\n",
"if",
"oldState",
"==",
"failureState",
"||",
"oldState",
"==",
"\"",
"\"",
"{",
"psStates",
"[",
"name",
"]",
"=",
"newState",
"\n",
"}",
"else",
"if",
"oldState",
"==",
"pendingState",
"&&",
"newState",
"==",
"successState",
"{",
"psStates",
"[",
"name",
"]",
"=",
"successState",
"\n",
"}",
"\n",
"}",
"\n",
"// The overall result is the worst of the best.",
"overallState",
":=",
"successState",
"\n",
"for",
"_",
",",
"ps",
":=",
"range",
"presubmits",
"[",
"int",
"(",
"pr",
".",
"Number",
")",
"]",
"{",
"if",
"s",
",",
"ok",
":=",
"psStates",
"[",
"ps",
".",
"Context",
"]",
";",
"!",
"ok",
"{",
"overallState",
"=",
"failureState",
"\n",
"log",
".",
"WithFields",
"(",
"pr",
".",
"logFields",
"(",
")",
")",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"ps",
".",
"Context",
")",
"\n",
"break",
"\n",
"}",
"else",
"if",
"s",
"==",
"failureState",
"{",
"overallState",
"=",
"failureState",
"\n",
"log",
".",
"WithFields",
"(",
"pr",
".",
"logFields",
"(",
")",
")",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"ps",
".",
"Context",
")",
"\n",
"break",
"\n",
"}",
"else",
"if",
"s",
"==",
"pendingState",
"{",
"log",
".",
"WithFields",
"(",
"pr",
".",
"logFields",
"(",
")",
")",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"ps",
".",
"Context",
")",
"\n",
"overallState",
"=",
"pendingState",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"overallState",
"==",
"successState",
"{",
"successes",
"=",
"append",
"(",
"successes",
",",
"pr",
")",
"\n",
"}",
"else",
"if",
"overallState",
"==",
"pendingState",
"{",
"pendings",
"=",
"append",
"(",
"pendings",
",",
"pr",
")",
"\n",
"}",
"else",
"{",
"nones",
"=",
"append",
"(",
"nones",
",",
"pr",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
]
|
17,791 | all-17792 | [
"Current",
"returns",
"the",
"currently",
"logged",
"-",
"in",
"user",
"or",
"nil",
"if",
"the",
"user",
"is",
"not",
"signed",
"in",
"."
]
| [
"func",
"Current",
"(",
"c",
"context",
".",
"<mask>",
")",
"*",
"User",
"{",
"h",
":=",
"internal",
".",
"IncomingHeaders",
"(",
"c",
")",
"\n",
"u",
":=",
"&",
"User",
"{",
"Email",
":",
"h",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"AuthDomain",
":",
"h",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"ID",
":",
"h",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"Admin",
":",
"h",
".",
"Get",
"(",
"\"",
"\"",
")",
"==",
"\"",
"\"",
",",
"FederatedIdentity",
":",
"h",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"FederatedProvider",
":",
"h",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"}",
"\n",
"if",
"u",
".",
"Email",
"==",
"\"",
"\"",
"&&",
"u",
".",
"FederatedIdentity",
"==",
"\"",
"\"",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"u",
"\n",
"}"
]
|
17,792 | all-17793 | [
"newImageDestination",
"creates",
"a",
"new",
"ImageDestination",
"for",
"the",
"specified",
"image",
"reference",
"."
]
| [
"func",
"newImageDestination",
"(",
"sys",
"*",
"types",
".",
"SystemContext",
",",
"ref",
"dockerReference",
")",
"(",
"types",
".",
"ImageDestination",
",",
"error",
")",
"{",
"c",
",",
"err",
":=",
"newDockerClientFromRef",
"(",
"sys",
",",
"ref",
",",
"true",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"dockerImageDestination",
"{",
"ref",
":",
"<mask>",
",",
"c",
":",
"c",
",",
"}",
",",
"nil",
"\n",
"}"
]
|
17,793 | all-17794 | [
"New",
"create",
"a",
"new",
"SPF",
"instance",
"fully",
"loaded",
"with",
"all",
"the",
"SPF",
"directives",
"(",
"so",
"no",
"more",
"DNS",
"lookups",
"must",
"be",
"done",
"after",
"constructing",
"the",
"instance",
")"
]
| [
"func",
"New",
"(",
"<mask>",
"string",
",",
"dnsResolver",
"dns",
".",
"DnsResolver",
")",
"(",
"*",
"SPF",
",",
"error",
")",
"{",
"return",
"newSPF",
"(",
"domain",
",",
"dnsResolver",
",",
"0",
",",
"0",
")",
"\n",
"}"
]
|
17,794 | all-17795 | [
"Handler",
"implements",
"the",
"http",
".",
"HandlerFunc",
"for",
"integration",
"with",
"the",
"standard",
"net",
"/",
"http",
"lib",
"."
]
| [
"func",
"(",
"a",
"*",
"Auth",
")",
"Handler",
"(",
"h",
"http",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"// Let secure process the request. If it returns an error,",
"// that indicates the request should not continue.",
"if",
"err",
":=",
"a",
".",
"<mask>",
"(",
"w",
",",
"r",
")",
";",
"err",
"!=",
"nil",
"{",
"// if process returned an error request should not continue",
"return",
"\n",
"}",
"\n\n",
"ctx",
":=",
"r",
".",
"Context",
"(",
")",
"\n",
"if",
"len",
"(",
"a",
".",
"opt",
".",
"AllowedOUs",
")",
">",
"0",
"{",
"ctx",
"=",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"HasAuthorizedOU",
",",
"r",
".",
"TLS",
".",
"VerifiedChains",
"[",
"0",
"]",
"[",
"0",
"]",
".",
"Subject",
".",
"OrganizationalUnit",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"a",
".",
"opt",
".",
"AllowedCNs",
")",
">",
"0",
"{",
"ctx",
"=",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"HasAuthorizedCN",
",",
"r",
".",
"TLS",
".",
"VerifiedChains",
"[",
"0",
"]",
"[",
"0",
"]",
".",
"Subject",
".",
"CommonName",
")",
"\n",
"}",
"\n\n",
"h",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
".",
"WithContext",
"(",
"ctx",
")",
")",
"\n",
"}",
")",
"\n",
"}"
]
|
17,795 | all-17796 | [
"Get",
"value"
]
| [
"func",
"(",
"<mask>",
"*",
"redisStore",
")",
"Get",
"(",
"key",
"string",
")",
"string",
"{",
"if",
"v",
",",
"ok",
":=",
"rs",
".",
"Values",
"[",
"key",
"]",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
]
|
17,796 | all-17797 | [
"Close",
"ends",
"the",
"current",
"argument",
"."
]
| [
"func",
"(",
"w",
"*",
"fragmentingWriter",
")",
"Close",
"(",
")",
"error",
"{",
"last",
":=",
"w",
".",
"state",
"==",
"fragmentingWriteInLastArgument",
"\n",
"if",
"w",
".",
"err",
"!=",
"nil",
"{",
"return",
"w",
".",
"err",
"\n",
"}",
"\n\n",
"if",
"!",
"w",
".",
"<mask>",
".",
"isWritingArgument",
"(",
")",
"{",
"w",
".",
"err",
"=",
"errNotWritingArgument",
"\n",
"return",
"w",
".",
"err",
"\n",
"}",
"\n\n",
"w",
".",
"curChunk",
".",
"finish",
"(",
")",
"\n\n",
"// There are three possibilities here:",
"// 1. There are no more arguments",
"// flush with more_fragments=false, mark the stream as complete",
"// 2. There are more arguments, but we can't fit more data into this fragment",
"// flush with more_fragments=true, start new fragment, write empty chunk to indicate",
"// the current argument is complete",
"// 3. There are more arguments, and we can fit more data into this fragment",
"// update the chunk but leave the current fragment open",
"if",
"last",
"{",
"// No more arguments - flush this final fragment and mark ourselves complete",
"w",
".",
"state",
"=",
"fragmentingWriteComplete",
"\n",
"w",
".",
"curFragment",
".",
"finish",
"(",
"false",
")",
"\n",
"w",
".",
"err",
"=",
"w",
".",
"sender",
".",
"flushFragment",
"(",
"w",
".",
"curFragment",
")",
"\n",
"w",
".",
"sender",
".",
"doneSending",
"(",
")",
"\n",
"return",
"w",
".",
"err",
"\n",
"}",
"\n\n",
"w",
".",
"state",
"=",
"fragmentingWriteWaitingForArgument",
"\n",
"if",
"w",
".",
"curFragment",
".",
"contents",
".",
"BytesRemaining",
"(",
")",
">",
"chunkHeaderSize",
"{",
"// There's enough room in this fragment for the next argument's",
"// initial chunk, so we're done here",
"return",
"nil",
"\n",
"}",
"\n\n",
"// This fragment is full - flush and prepare for another argument",
"w",
".",
"curFragment",
".",
"finish",
"(",
"true",
")",
"\n",
"if",
"w",
".",
"err",
"=",
"w",
".",
"sender",
".",
"flushFragment",
"(",
"w",
".",
"curFragment",
")",
";",
"w",
".",
"err",
"!=",
"nil",
"{",
"return",
"w",
".",
"err",
"\n",
"}",
"\n\n",
"if",
"w",
".",
"curFragment",
",",
"w",
".",
"err",
"=",
"w",
".",
"sender",
".",
"newFragment",
"(",
"false",
",",
"w",
".",
"checksum",
")",
";",
"w",
".",
"err",
"!=",
"nil",
"{",
"return",
"w",
".",
"err",
"\n",
"}",
"\n\n",
"// Write an empty chunk to indicate this argument has ended",
"w",
".",
"curFragment",
".",
"contents",
".",
"WriteUint16",
"(",
"0",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,797 | all-17798 | [
"HasState",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"a",
"*",
"Alert",
")",
"HasState",
"(",
")",
"bool",
"{",
"if",
"a",
"!=",
"nil",
"&&",
"a",
".",
"State",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
17,798 | all-17799 | [
"OutgoingContextWithServiceInfo",
"returns",
"an",
"outgoing",
"context",
"with",
"the",
"id"
]
| [
"func",
"OutgoingContextWithServiceInfo",
"(",
"ctx",
"context",
".",
"Context",
",",
"serviceName",
",",
"serviceVersion",
",",
"netAddress",
"string",
")",
"context",
".",
"<mask>",
"{",
"return",
"outgoingContextWithMergedMetadata",
"(",
"ctx",
",",
"\"",
"\"",
",",
"serviceName",
",",
"\"",
"\"",
",",
"serviceVersion",
",",
"\"",
"\"",
",",
"netAddress",
")",
"\n",
"}"
]
|
17,799 | all-17800 | [
"Userlist",
"returns",
"the",
"userlist",
"for",
"a",
"given",
"channel"
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"Userlist",
"(",
"channel",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"c",
".",
"channelUserlistMutex",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"channelUserlistMutex",
".",
"RUnlock",
"(",
")",
"\n",
"usermap",
",",
"ok",
":=",
"c",
".",
"channelUserlist",
"[",
"channel",
"]",
"\n",
"if",
"!",
"ok",
"||",
"usermap",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"channel",
")",
"\n",
"}",
"\n",
"userlist",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"usermap",
")",
")",
"\n\n",
"i",
":=",
"0",
"\n",
"for",
"key",
":=",
"<mask>",
"usermap",
"{",
"userlist",
"[",
"i",
"]",
"=",
"key",
"\n",
"i",
"++",
"\n",
"}",
"\n\n",
"return",
"userlist",
",",
"nil",
"\n",
"}"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.