id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
16,700 | all-16701 | [
"lint",
"is",
"the",
"entry",
"point",
"for",
"linting",
"a",
"single",
"metric",
"."
]
| [
"func",
"lint",
"(",
"mf",
"dto",
".",
"MetricFamily",
")",
"[",
"]",
"Problem",
"{",
"fns",
":=",
"[",
"]",
"func",
"(",
"mf",
"dto",
".",
"MetricFamily",
")",
"[",
"]",
"Problem",
"{",
"lintHelp",
",",
"lintMetricUnits",
",",
"lintCounter",
",",
"lintHistogramSummaryReserved",
",",
"}",
"\n\n",
"var",
"problems",
"[",
"]",
"Problem",
"\n",
"for",
"_",
",",
"fn",
":=",
"<mask>",
"fns",
"{",
"problems",
"=",
"append",
"(",
"problems",
",",
"fn",
"(",
"mf",
")",
"...",
")",
"\n",
"}",
"\n\n",
"// TODO(mdlayher): lint rules for specific metrics types.",
"return",
"problems",
"\n",
"}"
]
|
16,701 | all-16702 | [
"match",
"reports",
"whether",
"the",
"specified",
"file",
"and",
"line",
"matches",
"the",
"trace",
"location",
".",
"The",
"argument",
"file",
"name",
"is",
"the",
"full",
"path",
"not",
"the",
"basename",
"specified",
"in",
"the",
"flag",
"."
]
| [
"func",
"(",
"t",
"*",
"TraceLocation",
")",
"match",
"(",
"file",
"string",
",",
"line",
"int",
")",
"bool",
"{",
"if",
"t",
".",
"line",
"!=",
"line",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"i",
":=",
"strings",
".",
"LastIndex",
"(",
"file",
",",
"\"",
"\"",
")",
";",
"i",
">=",
"0",
"{",
"<mask>",
"=",
"file",
"[",
"i",
"+",
"1",
":",
"]",
"\n",
"}",
"\n",
"return",
"t",
".",
"file",
"==",
"file",
"\n",
"}"
]
|
16,702 | all-16703 | [
"Set",
"is",
"required",
"for",
"kingpin",
"interfaces",
"to",
"allow",
"command",
"line",
"params",
"to",
"be",
"set",
"to",
"our",
"map",
"datatype"
]
| [
"func",
"(",
"o",
"*",
"MapStringOption",
")",
"Set",
"(",
"value",
"string",
")",
"error",
"{",
"<mask>",
":=",
"stringMapRegex",
".",
"Split",
"(",
"value",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"parts",
")",
"!=",
"2",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"value",
")",
"\n",
"}",
"\n",
"val",
":=",
"StringOption",
"{",
"}",
"\n",
"val",
".",
"Set",
"(",
"parts",
"[",
"1",
"]",
")",
"\n",
"(",
"*",
"o",
")",
"[",
"parts",
"[",
"0",
"]",
"]",
"=",
"val",
"\n",
"return",
"nil",
"\n",
"}"
]
|
16,703 | all-16704 | [
"FromParams",
"returns",
"the",
"JWT",
"when",
"passed",
"as",
"the",
"URL",
"query",
"param",
"token",
"."
]
| [
"func",
"FromParams",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"(",
"*",
"jwt",
".",
"JSONWebToken",
",",
"error",
")",
"{",
"if",
"r",
"==",
"nil",
"{",
"return",
"nil",
",",
"ErrNilRequest",
"\n",
"}",
"\n",
"raw",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"raw",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrTokenNotFound",
"\n",
"}",
"\n",
"return",
"jwt",
".",
"ParseSigned",
"(",
"<mask>",
")",
"\n",
"}"
]
|
16,704 | all-16705 | [
"StringToFileModeFunc",
"returns",
"a",
"function",
"that",
"converts",
"strings",
"to",
"os",
".",
"FileMode",
"value",
".",
"This",
"is",
"designed",
"to",
"be",
"used",
"with",
"mapstructure",
"for",
"parsing",
"out",
"a",
"filemode",
"value",
"."
]
| [
"func",
"StringToFileModeFunc",
"(",
")",
"mapstructure",
".",
"DecodeHookFunc",
"{",
"return",
"func",
"(",
"f",
"reflect",
".",
"Type",
",",
"t",
"reflect",
".",
"Type",
",",
"data",
"interface",
"{",
"}",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"if",
"f",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"String",
"{",
"return",
"data",
",",
"nil",
"\n",
"}",
"\n",
"if",
"t",
"!=",
"reflect",
".",
"TypeOf",
"(",
"os",
".",
"FileMode",
"(",
"0",
")",
")",
"{",
"return",
"data",
",",
"nil",
"\n",
"}",
"\n\n",
"// Convert it by parsing",
"v",
",",
"err",
":=",
"strconv",
".",
"ParseUint",
"(",
"data",
".",
"(",
"string",
")",
",",
"8",
",",
"12",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"data",
",",
"err",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"FileMode",
"(",
"v",
")",
",",
"nil",
"\n",
"}",
"\n",
"}"
]
|
16,705 | all-16706 | [
"LoginControlLocator",
"builds",
"a",
"locator",
"from",
"the",
"given",
"href",
"."
]
| [
"func",
"(",
"api",
"*",
"API",
")",
"LoginControlLocator",
"(",
"href",
"string",
")",
"*",
"LoginControlLocator",
"{",
"<mask>",
"&",
"LoginControlLocator",
"{",
"Href",
"(",
"href",
")",
",",
"api",
"}",
"\n",
"}"
]
|
16,706 | all-16707 | [
"classify",
"accepts",
"a",
"list",
"of",
"segments",
"that",
"should",
"meet",
"some",
"property",
"and",
"a",
"list",
"of",
"segments",
"that",
"currently",
"do",
"meet",
"that",
"property",
"and",
"returns",
"a",
"classification",
"."
]
| [
"func",
"classify",
"(",
"desired",
"[",
"]",
"cfclient",
".",
"IsolationSegment",
",",
"current",
"[",
"]",
"cfclient",
".",
"IsolationSegment",
")",
"classification",
"{",
"currentSegments",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"cfclient",
".",
"IsolationSegment",
")",
"\n",
"for",
"i",
":=",
"range",
"current",
"{",
"currentSegments",
"[",
"current",
"[",
"i",
"]",
".",
"Name",
"]",
"=",
"&",
"current",
"[",
"i",
"]",
"\n",
"}",
"\n",
"desiredSegments",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"cfclient",
".",
"IsolationSegment",
")",
"\n",
"for",
"i",
":=",
"range",
"desired",
"{",
"desiredSegments",
"[",
"desired",
"[",
"i",
"]",
".",
"Name",
"]",
"=",
"&",
"desired",
"[",
"i",
"]",
"\n",
"}",
"\n\n",
"var",
"missing",
"[",
"]",
"cfclient",
".",
"IsolationSegment",
"\n",
"for",
"name",
",",
"seg",
":=",
"range",
"desiredSegments",
"{",
"if",
"_",
",",
"ok",
":=",
"currentSegments",
"[",
"name",
"]",
";",
"!",
"ok",
"{",
"missing",
"=",
"<mask>",
"(",
"missing",
",",
"*",
"seg",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"var",
"extra",
"[",
"]",
"cfclient",
".",
"IsolationSegment",
"\n",
"for",
"name",
",",
"seg",
":=",
"range",
"currentSegments",
"{",
"if",
"_",
",",
"ok",
":=",
"desiredSegments",
"[",
"name",
"]",
";",
"!",
"ok",
"{",
"extra",
"=",
"append",
"(",
"extra",
",",
"*",
"seg",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"classification",
"{",
"missing",
",",
"extra",
"}",
"\n",
"}"
]
|
16,707 | all-16708 | [
"resourceVSphereComputeClusterApplyNameChange",
"applies",
"any",
"changes",
"to",
"a",
"ClusterComputeResource",
"s",
"name",
"."
]
| [
"func",
"resourceVSphereComputeClusterApplyNameChange",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
",",
"cluster",
"*",
"object",
".",
"ClusterComputeResource",
",",
")",
"(",
"*",
"object",
".",
"ClusterComputeResource",
",",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereComputeClusterIDString",
"(",
"d",
")",
",",
"cluster",
".",
"InventoryPath",
",",
")",
"\n\n",
"var",
"changed",
"bool",
"\n",
"<mask>",
"err",
"error",
"\n\n",
"if",
"d",
".",
"HasChange",
"(",
"\"",
"\"",
")",
"{",
"if",
"err",
"=",
"clustercomputeresource",
".",
"Rename",
"(",
"cluster",
",",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"changed",
"=",
"true",
"\n",
"}",
"\n\n",
"if",
"changed",
"{",
"// Update the cluster so that we have the new inventory path for logging and",
"// other things",
"cluster",
",",
"err",
"=",
"resourceVSphereComputeClusterGetCluster",
"(",
"d",
",",
"meta",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereComputeClusterIDString",
"(",
"d",
")",
",",
"cluster",
".",
"InventoryPath",
",",
")",
"\n",
"}",
"\n\n",
"return",
"cluster",
",",
"nil",
"\n",
"}"
]
|
16,708 | all-16709 | [
"SetAttributeValue",
"sets",
"attribute",
"for",
"an",
"element",
"with",
"given",
"id",
".",
"See",
":",
"https",
":",
"//",
"chromedevtools",
".",
"github",
".",
"io",
"/",
"devtools",
"-",
"protocol",
"/",
"tot",
"/",
"DOM#method",
"-",
"setAttributeValue",
"parameters",
":",
"nodeID",
"-",
"Id",
"of",
"the",
"element",
"to",
"set",
"attribute",
"for",
".",
"name",
"-",
"Attribute",
"name",
".",
"value",
"-",
"Attribute",
"value",
"."
]
| [
"func",
"SetAttributeValue",
"(",
"nodeID",
"cdp",
".",
"NodeID",
",",
"name",
"string",
",",
"<mask>",
"string",
")",
"*",
"SetAttributeValueParams",
"{",
"return",
"&",
"SetAttributeValueParams",
"{",
"NodeID",
":",
"nodeID",
",",
"Name",
":",
"name",
",",
"Value",
":",
"value",
",",
"}",
"\n",
"}"
]
|
16,709 | all-16710 | [
"/",
"*",
"UpdateVMWithState",
"updates",
"a",
"vm",
"in",
"the",
"pool",
"with",
"state"
]
| [
"func",
"(",
"a",
"*",
"Client",
")",
"UpdateVMWithState",
"(",
"params",
"*",
"UpdateVMWithStateParams",
")",
"(",
"*",
"UpdateVMWithStateOK",
",",
"error",
")",
"{",
"// TODO: Validate the params before sending",
"if",
"params",
"==",
"nil",
"{",
"params",
"=",
"NewUpdateVMWithStateParams",
"(",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"transport",
".",
"Submit",
"(",
"&",
"runtime",
".",
"ClientOperation",
"{",
"ID",
":",
"\"",
"\"",
",",
"Method",
":",
"\"",
"\"",
",",
"PathPattern",
":",
"\"",
"\"",
",",
"ProducesMediaTypes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"ConsumesMediaTypes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"Schemes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"Params",
":",
"params",
",",
"Reader",
":",
"&",
"UpdateVMWithStateReader",
"{",
"formats",
":",
"a",
".",
"formats",
"}",
",",
"Context",
":",
"params",
".",
"Context",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"(",
"*",
"UpdateVMWithStateOK",
")",
",",
"nil",
"\n\n",
"}"
]
|
16,710 | all-16711 | [
"IdleAdd",
"adds",
"an",
"idle",
"source",
"to",
"the",
"default",
"main",
"event",
"loop",
"context",
".",
"After",
"running",
"once",
"the",
"source",
"func",
"will",
"be",
"removed",
"from",
"the",
"main",
"event",
"loop",
"unless",
"f",
"returns",
"a",
"single",
"bool",
"true",
".",
"This",
"function",
"will",
"cause",
"a",
"panic",
"when",
"f",
"eventually",
"runs",
"if",
"the",
"types",
"of",
"args",
"do",
"not",
"match",
"those",
"of",
"f",
"."
]
| [
"func",
"IdleAdd",
"(",
"f",
"interface",
"{",
"}",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"(",
"SourceHandle",
",",
"error",
")",
"{",
"// f must be a func with no parameters.",
"rf",
":=",
"reflect",
".",
"ValueOf",
"(",
"f",
")",
"\n",
"if",
"rf",
".",
"<mask>",
"(",
")",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Func",
"{",
"return",
"0",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Create an idle source func to be added to the main loop context.",
"idleSrc",
":=",
"C",
".",
"g_idle_source_new",
"(",
")",
"\n",
"if",
"idleSrc",
"==",
"nil",
"{",
"return",
"0",
",",
"errNilPtr",
"\n",
"}",
"\n",
"return",
"sourceAttach",
"(",
"idleSrc",
",",
"rf",
",",
"args",
"...",
")",
"\n",
"}"
]
|
16,711 | all-16712 | [
"SetUserValueBytes",
"stores",
"the",
"given",
"value",
"(",
"arbitrary",
"object",
")",
"under",
"the",
"given",
"key",
"in",
"ctx",
".",
"The",
"value",
"stored",
"in",
"ctx",
"may",
"be",
"obtained",
"by",
"UserValue",
"*",
".",
"This",
"functionality",
"may",
"be",
"useful",
"for",
"passing",
"arbitrary",
"values",
"between",
"functions",
"involved",
"in",
"request",
"processing",
".",
"All",
"the",
"values",
"stored",
"in",
"ctx",
"are",
"deleted",
"after",
"returning",
"from",
"RequestHandler",
"."
]
| [
"func",
"(",
"ctx",
"*",
"RequestCtx",
")",
"SetUserValueBytes",
"(",
"key",
"[",
"]",
"byte",
",",
"value",
"<mask>",
"{",
"}",
")",
"{",
"ctx",
".",
"userValues",
".",
"SetBytes",
"(",
"key",
",",
"value",
")",
"\n",
"}"
]
|
16,712 | all-16713 | [
"Continuously",
"retries",
"sending",
"an",
"event",
"until",
"it",
"succeeds",
"sleeping",
"between",
"each",
"attempt"
]
| [
"func",
"(",
"handler",
"*",
"TaskHandler",
")",
"submitTaskEvents",
"(",
"taskEvents",
"*",
"taskSendableEvents",
",",
"client",
"api",
".",
"ECSClient",
",",
"taskARN",
"string",
")",
"{",
"defer",
"metrics",
".",
"MetricsEngineGlobal",
".",
"RecordECSClientMetric",
"(",
"\"",
"\"",
")",
"(",
")",
"\n",
"defer",
"handler",
".",
"removeTaskEvents",
"(",
"taskARN",
")",
"\n\n",
"backoff",
":=",
"retry",
".",
"NewExponentialBackoff",
"(",
"submitStateBackoffMin",
",",
"submitStateBackoffMax",
",",
"submitStateBackoffJitterMultiple",
",",
"submitStateBackoffMultiple",
")",
"\n\n",
"// Mirror events.sending, but without the need to lock since this is local",
"// to our goroutine",
"done",
":=",
"false",
"\n",
"// TODO: wire in the context here. Else, we have go routine leaks in tests",
"for",
"!",
"done",
"{",
"// If we looped back up here, we successfully submitted an event, but",
"// we haven't emptied the list so we should keep submitting",
"backoff",
".",
"Reset",
"(",
")",
"\n",
"retry",
".",
"RetryWithBackoff",
"(",
"backoff",
",",
"func",
"(",
")",
"error",
"{",
"// Lock and unlock within this function, allowing the list to be added",
"// to while we're not actively sending an event",
"seelog",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"handler",
".",
"submitSemaphore",
".",
"Wait",
"(",
")",
"\n",
"defer",
"handler",
".",
"submitSemaphore",
".",
"Post",
"(",
")",
"\n\n",
"var",
"err",
"error",
"\n",
"<mask>",
",",
"err",
"=",
"taskEvents",
".",
"submitFirstEvent",
"(",
"handler",
",",
"backoff",
")",
"\n",
"return",
"err",
"\n",
"}",
")",
"\n",
"}",
"\n",
"}"
]
|
16,713 | all-16714 | [
"Do",
"executes",
"Page",
".",
"setFontFamilies",
"against",
"the",
"provided",
"context",
"."
]
| [
"func",
"(",
"p",
"*",
"SetFontFamiliesParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetFontFamilies",
",",
"p",
",",
"nil",
")",
"\n",
"}"
]
|
16,714 | all-16715 | [
"Do",
"executes",
"Target",
".",
"disposeBrowserContext",
"against",
"the",
"provided",
"context",
"."
]
| [
"func",
"(",
"p",
"*",
"DisposeBrowserContextParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandDisposeBrowserContext",
",",
"p",
",",
"nil",
")",
"\n",
"}"
]
|
16,715 | all-16716 | [
"MarkDirtyRectangle",
"is",
"a",
"wrapper",
"around",
"cairo_surface_mark_dirty_rectangle",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Surface",
")",
"MarkDirtyRectangle",
"(",
"x",
",",
"y",
",",
"width",
",",
"<mask>",
"int",
")",
"{",
"C",
".",
"cairo_surface_mark_dirty_rectangle",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"int",
"(",
"x",
")",
",",
"C",
".",
"int",
"(",
"y",
")",
",",
"C",
".",
"int",
"(",
"width",
")",
",",
"C",
".",
"int",
"(",
"height",
")",
")",
"\n",
"}"
]
|
16,716 | all-16717 | [
"Flat",
"returns",
"all",
"the",
"strings",
"in",
"the",
"set",
"sorted",
"and",
"de",
"-",
"duplicated",
"."
]
| [
"func",
"(",
"ps",
"*",
"PlatformStrings",
")",
"Flat",
"(",
")",
"[",
"]",
"string",
"{",
"unique",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
")",
"\n",
"for",
"_",
",",
"s",
":=",
"range",
"ps",
".",
"Generic",
"{",
"unique",
"[",
"s",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"ss",
":=",
"range",
"ps",
".",
"OS",
"{",
"for",
"_",
",",
"s",
":=",
"range",
"ss",
"{",
"unique",
"[",
"s",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"ss",
":=",
"range",
"ps",
".",
"Arch",
"{",
"for",
"_",
",",
"s",
":=",
"range",
"ss",
"{",
"unique",
"[",
"s",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"ss",
":=",
"range",
"ps",
".",
"Platform",
"{",
"for",
"_",
",",
"s",
":=",
"range",
"<mask>",
"{",
"unique",
"[",
"s",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"flat",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"unique",
")",
")",
"\n",
"for",
"s",
":=",
"range",
"unique",
"{",
"flat",
"=",
"append",
"(",
"flat",
",",
"s",
")",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"flat",
")",
"\n",
"return",
"flat",
"\n",
"}"
]
|
16,717 | all-16718 | [
"Redirect",
"performs",
"a",
"redirecting",
"to",
"the",
"url",
"if",
"the",
"code",
"belongs",
"to",
"one",
"of",
"StatusMovedPermanently",
"StatusFound",
"StatusSeeOther",
"and",
"StatusTemporaryRedirect",
"."
]
| [
"func",
"(",
"ctx",
"*",
"Context",
")",
"Redirect",
"(",
"code",
"int",
",",
"url",
"string",
")",
"{",
"ctx",
".",
"Response",
".",
"Status",
"=",
"code",
"\n",
"ctx",
".",
"Response",
".",
"Data",
"=",
"<mask>",
"\n",
"}"
]
|
16,718 | all-16719 | [
"WithMaxTotalBufferSize",
"buffer",
"size",
"in",
"bytes",
"to",
"use",
"when",
"preserving",
"network",
"payloads",
"(",
"XHRs",
"etc",
")",
"."
]
| [
"func",
"(",
"p",
"EnableParams",
")",
"WithMaxTotalBufferSize",
"(",
"maxTotalBufferSize",
"int64",
")",
"*",
"EnableParams",
"{",
"p",
".",
"MaxTotalBufferSize",
"=",
"maxTotalBufferSize",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
]
|
16,719 | all-16720 | [
"TranslateCoordinates",
"is",
"a",
"wrapper",
"around",
"gtk_widget_translate_coordinates",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Widget",
")",
"TranslateCoordinates",
"(",
"<mask>",
"IWidget",
",",
"srcX",
",",
"srcY",
"int",
")",
"(",
"destX",
",",
"destY",
"int",
",",
"e",
"error",
")",
"{",
"cdest",
":=",
"nullableWidget",
"(",
"dest",
")",
"\n\n",
"var",
"cdestX",
",",
"cdestY",
"C",
".",
"gint",
"\n",
"c",
":=",
"C",
".",
"gtk_widget_translate_coordinates",
"(",
"v",
".",
"native",
"(",
")",
",",
"cdest",
",",
"C",
".",
"gint",
"(",
"srcX",
")",
",",
"C",
".",
"gint",
"(",
"srcY",
")",
",",
"&",
"cdestX",
",",
"&",
"cdestY",
")",
"\n",
"if",
"!",
"gobool",
"(",
"c",
")",
"{",
"return",
"0",
",",
"0",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"int",
"(",
"cdestX",
")",
",",
"int",
"(",
"cdestY",
")",
",",
"nil",
"\n",
"}"
]
|
16,720 | all-16721 | [
"Run",
"starts",
"a",
"Discovery",
"Manager",
"and",
"the",
"custom",
"service",
"discovery",
"implementation",
"."
]
| [
"func",
"(",
"a",
"*",
"Adapter",
")",
"Run",
"(",
")",
"{",
"go",
"a",
".",
"manager",
".",
"Run",
"(",
")",
"\n",
"a",
".",
"<mask>",
".",
"StartCustomProvider",
"(",
"a",
".",
"ctx",
",",
"a",
".",
"name",
",",
"a",
".",
"disc",
")",
"\n",
"go",
"a",
".",
"runCustomSD",
"(",
"a",
".",
"ctx",
")",
"\n",
"}"
]
|
16,721 | all-16722 | [
"LookupUID",
"looks",
"up",
"an",
"user",
"by",
"user",
"ID",
"."
]
| [
"func",
"LookupUID",
"(",
"uid",
"int",
")",
"(",
"*",
"<mask>",
",",
"error",
")",
"{",
"entries",
",",
"err",
":=",
"LookupInUser",
"(",
"U_UID",
",",
"uid",
",",
"1",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"entries",
"[",
"0",
"]",
",",
"err",
"\n",
"}"
]
|
16,722 | all-16723 | [
"Basic",
"returns",
"a",
"Handler",
"that",
"authenticates",
"via",
"Basic",
"Auth",
".",
"Writes",
"a",
"http",
".",
"StatusUnauthorized",
"if",
"authentication",
"fails"
]
| [
"func",
"Basic",
"(",
"username",
"string",
",",
"password",
"string",
")",
"http",
".",
"HandlerFunc",
"{",
"var",
"siteAuth",
"=",
"base64",
".",
"StdEncoding",
".",
"EncodeToString",
"(",
"[",
"]",
"byte",
"(",
"username",
"+",
"\"",
"\"",
"+",
"password",
")",
")",
"\n",
"return",
"func",
"(",
"res",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"auth",
":=",
"req",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"!",
"SecureCompare",
"(",
"auth",
",",
"\"",
"\"",
"+",
"siteAuth",
")",
"{",
"res",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"http",
".",
"Error",
"(",
"res",
",",
"\"",
"\"",
",",
"<mask>",
".",
"StatusUnauthorized",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
]
|
16,723 | all-16724 | [
"FExists",
"true",
"if",
"a",
"file",
"or",
"dir",
"exists"
]
| [
"func",
"FExists",
"(",
"<mask>",
"string",
")",
"bool",
"{",
"if",
"_",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"name",
")",
";",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
]
|
16,724 | all-16725 | [
"UnmarshalYAML",
"implements",
"the",
"yaml",
".",
"Unmarshaler",
"interface",
"."
]
| [
"func",
"(",
"tg",
"*",
"Group",
")",
"UnmarshalYAML",
"(",
"unmarshal",
"func",
"(",
"<mask>",
"{",
"}",
")",
"error",
")",
"error",
"{",
"g",
":=",
"struct",
"{",
"Targets",
"[",
"]",
"string",
"`yaml:\"targets\"`",
"\n",
"Labels",
"model",
".",
"LabelSet",
"`yaml:\"labels\"`",
"\n",
"}",
"{",
"}",
"\n",
"if",
"err",
":=",
"unmarshal",
"(",
"&",
"g",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"tg",
".",
"Targets",
"=",
"make",
"(",
"[",
"]",
"model",
".",
"LabelSet",
",",
"0",
",",
"len",
"(",
"g",
".",
"Targets",
")",
")",
"\n",
"for",
"_",
",",
"t",
":=",
"range",
"g",
".",
"Targets",
"{",
"tg",
".",
"Targets",
"=",
"append",
"(",
"tg",
".",
"Targets",
",",
"model",
".",
"LabelSet",
"{",
"model",
".",
"AddressLabel",
":",
"model",
".",
"LabelValue",
"(",
"t",
")",
",",
"}",
")",
"\n",
"}",
"\n",
"tg",
".",
"Labels",
"=",
"g",
".",
"Labels",
"\n",
"return",
"nil",
"\n",
"}"
]
|
16,725 | all-16726 | [
"native",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GtkSeperator",
"."
]
| [
"func",
"(",
"v",
"*",
"Separator",
")",
"native",
"(",
")",
"*",
"C",
".",
"GtkSeparator",
"{",
"if",
"v",
"==",
"nil",
"||",
"v",
".",
"GObject",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"p",
":=",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"GObject",
")",
"\n",
"<mask>",
"C",
".",
"toGtkSeparator",
"(",
"p",
")",
"\n",
"}"
]
|
16,726 | all-16727 | [
"----------------------------------------",
"DeepCopy",
"Deeply",
"copies",
"an",
"object",
".",
"If",
"anything",
"implements",
".",
"DeepCopy",
"()",
"<any",
">",
"along",
"the",
"way",
"the",
"result",
"of",
"that",
"function",
"will",
"be",
"used",
".",
"Otherwise",
"if",
"it",
"implements",
".",
"MarshalAmino",
"()",
"(",
"<any",
">",
"error",
")",
"and",
".",
"UnmarshalAmino",
"(",
"<any",
">",
")",
"error",
"the",
"pair",
"will",
"be",
"used",
"to",
"copy",
".",
"If",
".",
"MarshalAmino",
"()",
"or",
".",
"UnmarshalAmino",
"()",
"returns",
"an",
"error",
"this",
"function",
"will",
"panic",
"."
]
| [
"func",
"DeepCopy",
"(",
"o",
"interface",
"{",
"}",
")",
"(",
"r",
"<mask>",
"{",
"}",
")",
"{",
"if",
"o",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"src",
":=",
"reflect",
".",
"ValueOf",
"(",
"o",
")",
"\n",
"dst",
":=",
"reflect",
".",
"New",
"(",
"src",
".",
"Type",
"(",
")",
")",
".",
"Elem",
"(",
")",
"\n",
"deepCopy",
"(",
"src",
",",
"dst",
")",
"\n",
"return",
"dst",
".",
"Interface",
"(",
")",
"\n",
"}"
]
|
16,727 | all-16728 | [
"EtagHash",
"hashes",
"the",
"provided",
"data",
"and",
"returns",
"the",
"sha256"
]
| [
"func",
"EtagHash",
"(",
"<mask>",
"interface",
"{",
"}",
")",
"(",
"string",
",",
"error",
")",
"{",
"etag",
":=",
"sha256",
".",
"New",
"(",
")",
"\n",
"err",
":=",
"json",
".",
"NewEncoder",
"(",
"etag",
")",
".",
"Encode",
"(",
"data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"etag",
".",
"Sum",
"(",
"nil",
")",
")",
",",
"nil",
"\n",
"}"
]
|
16,728 | all-16729 | [
"connectionAborted",
"marks",
"the",
"target",
"identified",
"by",
"address",
"as",
"broken",
"and",
"puts",
"it",
"in",
"the",
"TargetWaiting",
"state",
"."
]
| [
"func",
"(",
"cm",
"*",
"connectionMaker",
")",
"connectionAborted",
"(",
"address",
"string",
",",
"err",
"error",
")",
"{",
"cm",
".",
"actionChan",
"<-",
"func",
"(",
")",
"bool",
"{",
"target",
":=",
"cm",
".",
"targets",
"[",
"<mask>",
"]",
"\n",
"target",
".",
"state",
"=",
"targetWaiting",
"\n",
"target",
".",
"lastError",
"=",
"err",
"\n",
"target",
".",
"nextTryLater",
"(",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"}"
]
|
16,729 | all-16730 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"GetPartialAXTreeReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility5",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
16,730 | all-16731 | [
"GetActionName",
"is",
"a",
"wrapper",
"around",
"gtk_actionable_set_action_name",
"()",
".",
"Since",
"3",
".",
"4"
]
| [
"func",
"(",
"v",
"*",
"Actionable",
")",
"GetActionName",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_actionable_get_action_name",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"c",
")",
")",
",",
"nil",
"\n",
"}"
]
|
16,731 | all-16732 | [
"Do",
"executes",
"Browser",
".",
"getBrowserCommandLine",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"arguments",
"-",
"Commandline",
"parameters"
]
| [
"func",
"(",
"p",
"*",
"GetBrowserCommandLineParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"arguments",
"[",
"]",
"string",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"<mask>",
"GetBrowserCommandLineReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetBrowserCommandLine",
",",
"nil",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"Arguments",
",",
"nil",
"\n",
"}"
]
|
16,732 | all-16733 | [
"retrieve",
"messages",
"from",
"the",
"debug",
"message",
"log"
]
| [
"func",
"GetDebugMessageLog",
"(",
"count",
"uint32",
",",
"bufSize",
"int32",
",",
"sources",
"*",
"uint32",
",",
"types",
"*",
"uint32",
",",
"<mask>",
"*",
"uint32",
",",
"severities",
"*",
"uint32",
",",
"lengths",
"*",
"int32",
",",
"messageLog",
"*",
"uint8",
")",
"uint32",
"{",
"ret",
":=",
"C",
".",
"glowGetDebugMessageLog",
"(",
"gpGetDebugMessageLog",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"count",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"bufSize",
")",
",",
"(",
"*",
"C",
".",
"GLenum",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"sources",
")",
")",
",",
"(",
"*",
"C",
".",
"GLenum",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"types",
")",
")",
",",
"(",
"*",
"C",
".",
"GLuint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"ids",
")",
")",
",",
"(",
"*",
"C",
".",
"GLenum",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"severities",
")",
")",
",",
"(",
"*",
"C",
".",
"GLsizei",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"lengths",
")",
")",
",",
"(",
"*",
"C",
".",
"GLchar",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"messageLog",
")",
")",
")",
"\n",
"return",
"(",
"uint32",
")",
"(",
"ret",
")",
"\n",
"}"
]
|
16,733 | all-16734 | [
"SetId",
"changes",
"the",
"current",
"file",
"Id",
".",
"It",
"is",
"a",
"runtime",
"error",
"to",
"call",
"this",
"function",
"once",
"the",
"file",
"has",
"started",
"being",
"written",
"to",
"or",
"when",
"the",
"file",
"is",
"not",
"open",
"for",
"writing",
"."
]
| [
"func",
"(",
"file",
"*",
"GridFile",
")",
"SetId",
"(",
"id",
"interface",
"{",
"}",
")",
"{",
"file",
".",
"assertMode",
"(",
"gfsWriting",
")",
"\n",
"file",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"file",
".",
"doc",
".",
"<mask>",
"=",
"id",
"\n",
"file",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"}"
]
|
16,734 | all-16735 | [
"GetTitleOk",
"returns",
"a",
"tuple",
"with",
"the",
"Title",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"q",
"*",
"QueryValueDefinition",
")",
"GetTitleOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"q",
"==",
"nil",
"||",
"q",
".",
"Title",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"q",
".",
"Title",
",",
"true",
"\n",
"}"
]
|
16,735 | all-16736 | [
"ImageUploadedAt",
"updates",
"the",
"upload_date",
"column",
"and",
"an",
"image",
"row",
"."
]
| [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageUploadedAt",
"(",
"id",
"int",
",",
"uploadedAt",
"<mask>",
".",
"Time",
")",
"error",
"{",
"err",
":=",
"exec",
"(",
"c",
".",
"db",
",",
"\"",
"\"",
",",
"uploadedAt",
",",
"id",
")",
"\n",
"return",
"err",
"\n",
"}"
]
|
16,736 | all-16737 | [
"Adopt",
"()",
":",
"non",
"-",
"standard",
".",
"For",
"efficiency",
"s",
"sake",
"(",
"possibly",
")",
"take",
"ownership",
"of",
"already",
"allocated",
"slice",
"offered",
"in",
"me",
".",
"If",
"me",
"is",
"large",
"we",
"will",
"adopt",
"it",
"and",
"we",
"will",
"potentially",
"then",
"write",
"to",
"the",
"me",
"buffer",
".",
"If",
"we",
"already",
"have",
"a",
"bigger",
"buffer",
"copy",
"me",
"into",
"the",
"existing",
"buffer",
"instead",
"."
]
| [
"func",
"(",
"b",
"*",
"PointerRingBuf",
")",
"Adopt",
"(",
"me",
"[",
"]",
"interface",
"{",
"}",
")",
"{",
"n",
":=",
"len",
"(",
"me",
")",
"\n",
"if",
"n",
">",
"b",
".",
"N",
"{",
"b",
".",
"A",
"=",
"<mask>",
"\n",
"b",
".",
"N",
"=",
"n",
"\n",
"b",
".",
"Beg",
"=",
"0",
"\n",
"b",
".",
"Readable",
"=",
"n",
"\n",
"}",
"else",
"{",
"// we already have a larger buffer, reuse it.",
"copy",
"(",
"b",
".",
"A",
",",
"me",
")",
"\n",
"b",
".",
"Beg",
"=",
"0",
"\n",
"b",
".",
"Readable",
"=",
"n",
"\n",
"}",
"\n",
"}"
]
|
16,737 | all-16738 | [
"topClusters",
"gets",
"the",
"count",
"most",
"important",
"clusters",
"from",
"a",
"slice",
"of",
"clusters",
"based",
"on",
"number",
"of",
"build",
"failures",
"."
]
| [
"func",
"topClusters",
"(",
"clusters",
"[",
"]",
"*",
"Cluster",
",",
"count",
"int",
")",
"[",
"]",
"*",
"Cluster",
"{",
"less",
":=",
"func",
"(",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"return",
"clusters",
"[",
"i",
"]",
".",
"totalBuilds",
">",
"clusters",
"[",
"j",
"]",
".",
"totalBuilds",
"}",
"\n",
"<mask>",
".",
"SliceStable",
"(",
"clusters",
",",
"less",
")",
"\n\n",
"if",
"len",
"(",
"clusters",
")",
"<",
"count",
"{",
"count",
"=",
"len",
"(",
"clusters",
")",
"\n",
"}",
"\n",
"return",
"clusters",
"[",
"0",
":",
"count",
"]",
"\n",
"}"
]
|
16,738 | all-16739 | [
"WithObjectGroup",
"symbolic",
"group",
"name",
"that",
"can",
"be",
"used",
"to",
"release",
"multiple",
"objects",
"."
]
| [
"func",
"(",
"p",
"EvaluateParams",
")",
"WithObjectGroup",
"(",
"objectGroup",
"<mask>",
")",
"*",
"EvaluateParams",
"{",
"p",
".",
"ObjectGroup",
"=",
"objectGroup",
"\n",
"return",
"&",
"p",
"\n",
"}"
]
|
16,739 | all-16740 | [
"checkLegacyDriver",
"errors",
"out",
"if",
"it",
"encounters",
"an",
"Azure",
"VM",
"created",
"with",
"the",
"legacy",
"(",
"<",
"=",
"0",
".",
"6",
".",
"0",
")",
"docker",
"-",
"machine",
"Azure",
"driver",
"."
]
| [
"func",
"(",
"d",
"*",
"Driver",
")",
"checkLegacyDriver",
"(",
"<mask>",
"bool",
")",
"error",
"{",
"if",
"d",
".",
"ResourceGroup",
"==",
"\"",
"\"",
"{",
"if",
"short",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
16,740 | all-16741 | [
"delCommandFunc",
"executes",
"the",
"del",
"command",
"."
]
| [
"func",
"delCommandFunc",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"<mask>",
",",
"opts",
":=",
"getDelOp",
"(",
"args",
")",
"\n",
"ctx",
",",
"cancel",
":=",
"commandCtx",
"(",
"cmd",
")",
"\n",
"resp",
",",
"err",
":=",
"mustClientFromCmd",
"(",
"cmd",
")",
".",
"Delete",
"(",
"ctx",
",",
"key",
",",
"opts",
"...",
")",
"\n",
"cancel",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"ExitWithError",
"(",
"ExitError",
",",
"err",
")",
"\n",
"}",
"\n",
"display",
".",
"Del",
"(",
"*",
"resp",
")",
"\n",
"}"
]
|
16,741 | all-16742 | [
"GetSilenced",
"returns",
"the",
"Silenced",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"a",
"*",
"Alert",
")",
"GetSilenced",
"(",
")",
"bool",
"{",
"if",
"a",
"==",
"nil",
"||",
"a",
".",
"Silenced",
"==",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"a",
".",
"Silenced",
"\n",
"}"
]
|
16,742 | all-16743 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
]
| [
"func",
"ProgramUniform2iv",
"(",
"program",
"uint32",
",",
"location",
"int32",
",",
"count",
"int32",
",",
"value",
"*",
"int32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpProgramUniform2iv",
",",
"4",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"location",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
]
|
16,743 | all-16744 | [
"/",
"*",
"Get",
"a",
"list",
"of",
"users",
"in",
"a",
"presence",
"-",
"channel",
"by",
"passing",
"to",
"this",
"method",
"the",
"channel",
"name",
"."
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"GetChannelUsers",
"(",
"name",
"string",
")",
"(",
"*",
"Users",
",",
"error",
")",
"{",
"path",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
".",
"AppId",
",",
"name",
")",
"\n",
"u",
",",
"err",
":=",
"createRequestURL",
"(",
"\"",
"\"",
",",
"c",
".",
"Host",
",",
"path",
",",
"c",
".",
"Key",
",",
"c",
".",
"Secret",
",",
"authTimestamp",
"(",
")",
",",
"c",
".",
"Secure",
",",
"nil",
",",
"nil",
",",
"c",
".",
"Cluster",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"response",
",",
"err",
":=",
"c",
".",
"request",
"(",
"\"",
"\"",
",",
"u",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"unmarshalledChannelUsers",
"(",
"<mask>",
")",
"\n",
"}"
]
|
16,744 | all-16745 | [
"DeepCopyObject",
"implements",
"runtime",
".",
"Object",
"interface"
]
| [
"func",
"(",
"in",
"*",
"ResourceObject",
")",
"DeepCopyObject",
"(",
")",
"runtime",
".",
"Object",
"{",
"if",
"c",
":=",
"<mask>",
".",
"deepCopy",
"(",
")",
";",
"c",
"!=",
"nil",
"{",
"return",
"c",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
16,745 | all-16746 | [
"Add",
"a",
"slave",
"to",
"a",
"bridge",
"device",
".",
"This",
"is",
"more",
"backward",
"-",
"compatible",
"than",
"netlink",
".",
"NetworkSetMaster",
"and",
"works",
"on",
"RHEL",
"6",
"."
]
| [
"func",
"AddToBridge",
"(",
"iface",
",",
"master",
"*",
"<mask>",
".",
"Interface",
")",
"error",
"{",
"return",
"ifIoctBridge",
"(",
"iface",
",",
"master",
",",
"SIOC_BRADDIF",
")",
"\n",
"}"
]
|
16,746 | all-16747 | [
"GetVersion",
"is",
"a",
"wrapper",
"around",
"gdk_gl_context_get_version",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"GLContext",
")",
"GetVersion",
"(",
")",
"(",
"MajorVersion",
",",
"MinorVersion",
")",
"{",
"var",
"major",
",",
"minor",
"int",
"\n",
"C",
".",
"gdk_gl_context_get_version",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"int",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"<mask>",
")",
")",
",",
"(",
"*",
"C",
".",
"int",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"minor",
")",
")",
")",
"\n\n",
"return",
"MajorVersion",
"(",
"major",
")",
",",
"MinorVersion",
"(",
"minor",
")",
"\n",
"}"
]
|
16,747 | all-16748 | [
"Status",
"returns",
"true",
"if",
"maintenance",
"is",
"enabled",
"."
]
| [
"func",
"(",
"s",
"*",
"FileStore",
")",
"Status",
"(",
")",
"(",
"on",
"bool",
",",
"err",
"error",
")",
"{",
"_",
",",
"err",
"=",
"os",
".",
"Stat",
"(",
"s",
".",
"filename",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"true",
",",
"nil",
"\n",
"}",
"\n",
"if",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"false",
",",
"nil",
"\n",
"}",
"\n",
"return",
"<mask>",
",",
"err",
"\n",
"}"
]
|
16,748 | all-16749 | [
"handleStaleTerm",
"is",
"used",
"when",
"a",
"follower",
"indicates",
"that",
"we",
"have",
"a",
"stale",
"term",
"."
]
| [
"func",
"(",
"r",
"*",
"Raft",
")",
"handleStaleTerm",
"(",
"s",
"*",
"followerReplication",
")",
"{",
"r",
".",
"logger",
".",
"<mask>",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"s",
".",
"peer",
")",
")",
"\n",
"s",
".",
"notifyAll",
"(",
"false",
")",
"// No longer leader",
"\n",
"asyncNotifyCh",
"(",
"s",
".",
"stepDown",
")",
"\n",
"}"
]
|
16,749 | all-16750 | [
"Start",
"begins",
"watching",
"the",
"files",
"sending",
"notifications",
"when",
"files",
"change",
".",
"It",
"returns",
"a",
"channel",
"that",
"notifications",
"are",
"sent",
"on",
"."
]
| [
"func",
"(",
"w",
"*",
"Watcher",
")",
"Start",
"(",
")",
"<-",
"chan",
"*",
"Notification",
"{",
"if",
"w",
".",
"notify_chan",
"!=",
"nil",
"{",
"return",
"w",
".",
"notify_chan",
"\n",
"}",
"\n",
"if",
"w",
".",
"auto_watch",
"{",
"w",
".",
"add_chan",
"=",
"make",
"(",
"chan",
"*",
"watchItem",
",",
"NotificationBufLen",
")",
"\n",
"go",
"w",
".",
"watchItemListener",
"(",
")",
"\n",
"}",
"\n",
"w",
".",
"notify_chan",
"=",
"make",
"(",
"chan",
"*",
"Notification",
",",
"NotificationBufLen",
")",
"\n",
"go",
"w",
".",
"<mask>",
"(",
"w",
".",
"notify_chan",
")",
"\n",
"return",
"w",
".",
"notify_chan",
"\n",
"}"
]
|
16,750 | all-16751 | [
"CustomLog",
"outputs",
"custom",
"level",
"log"
]
| [
"func",
"CustomLog",
"(",
"level",
"string",
",",
"val",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"glg",
".",
"<mask>",
"(",
"glg",
".",
"TagStringToLevel",
"(",
"level",
")",
",",
"blankFormat",
"(",
"len",
"(",
"val",
")",
")",
",",
"val",
"...",
")",
"\n",
"}"
]
|
16,751 | all-16752 | [
"export",
"FileSequence_SetPadding"
]
| [
"func",
"FileSequence_SetPadding",
"(",
"id",
"FileSeqId",
",",
"padChars",
"*",
"C",
".",
"char",
")",
"{",
"if",
"fs",
",",
"ok",
":=",
"sFileSeqs",
".",
"Get",
"(",
"id",
")",
";",
"ok",
"{",
"str",
":=",
"C",
".",
"GoString",
"(",
"padChars",
")",
"\n",
"<mask>",
".",
"SetPadding",
"(",
"str",
")",
"\n",
"}",
"\n",
"}"
]
|
16,752 | all-16753 | [
"if",
"given",
"compaction",
"period",
"x",
"is",
"<1",
"-",
"hour",
"compact",
"every",
"x",
"duration",
".",
"(",
"e",
".",
"g",
".",
"--",
"auto",
"-",
"compaction",
"-",
"mode",
"periodic",
"--",
"auto",
"-",
"compaction",
"-",
"retention",
"=",
"10m",
"then",
"compact",
"every",
"10",
"-",
"minute",
")",
"if",
"given",
"compaction",
"period",
"x",
"is",
">",
"1",
"-",
"hour",
"compact",
"every",
"hour",
".",
"(",
"e",
".",
"g",
".",
"--",
"auto",
"-",
"compaction",
"-",
"mode",
"periodic",
"--",
"auto",
"-",
"compaction",
"-",
"retention",
"=",
"2h",
"then",
"compact",
"every",
"1",
"-",
"hour",
")"
]
| [
"func",
"(",
"pc",
"*",
"Periodic",
")",
"getCompactInterval",
"(",
")",
"time",
".",
"Duration",
"{",
"itv",
":=",
"pc",
".",
"period",
"\n",
"if",
"itv",
">",
"time",
".",
"Hour",
"{",
"itv",
"=",
"<mask>",
".",
"Hour",
"\n",
"}",
"\n",
"return",
"itv",
"\n",
"}"
]
|
16,753 | all-16754 | [
"AddContainer",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockTaskEngineState",
")",
"AddContainer",
"(",
"arg0",
"*",
"<mask>",
".",
"DockerContainer",
",",
"arg1",
"*",
"task",
".",
"Task",
")",
"{",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
")",
"\n",
"}"
]
|
16,754 | all-16755 | [
"LinkList",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockNetLink",
")",
"LinkList",
"(",
")",
"(",
"[",
"]",
"netlink",
".",
"Link",
",",
"error",
")",
"{",
"<mask>",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"[",
"]",
"netlink",
".",
"Link",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
]
|
16,755 | all-16756 | [
"GetUsePopover",
"is",
"a",
"wrapper",
"around",
"gtk_menu_button_get_use_popover",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"MenuButton",
")",
"GetUsePopover",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_menu_button_get_use_popover",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"gobool",
"(",
"c",
")",
"\n",
"}"
]
|
16,756 | all-16757 | [
"Validate",
"ensures",
"that",
"the",
"set",
"of",
"options",
"are",
"self",
"-",
"consistent",
"and",
"valid",
"."
]
| [
"func",
"(",
"o",
"*",
"<mask>",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"o",
".",
"gcsPath",
".",
"String",
"(",
")",
"!=",
"\"",
"\"",
"{",
"o",
".",
"Bucket",
"=",
"o",
".",
"gcsPath",
".",
"Bucket",
"(",
")",
"\n",
"o",
".",
"PathPrefix",
"=",
"o",
".",
"gcsPath",
".",
"Object",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"!",
"o",
".",
"DryRun",
"{",
"if",
"o",
".",
"Bucket",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"GcsCredentialsFile",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"o",
".",
"GCSConfiguration",
".",
"Validate",
"(",
")",
"\n",
"}"
]
|
16,757 | all-16758 | [
"getBoolWithRestart",
"fetches",
"a",
"*",
"bool",
"for",
"the",
"resource",
"data",
"item",
"specified",
"at",
"key",
".",
"If",
"the",
"value",
"has",
"changed",
"a",
"reboot",
"is",
"flagged",
"in",
"the",
"virtual",
"machine",
"by",
"setting",
"reboot_required",
"to",
"true",
".",
"This",
"function",
"always",
"returns",
"at",
"least",
"false",
"even",
"if",
"a",
"value",
"is",
"unspecified",
"."
]
| [
"func",
"getBoolWithRestart",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"<mask>",
"string",
")",
"*",
"bool",
"{",
"if",
"d",
".",
"HasChange",
"(",
"key",
")",
"{",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"true",
")",
"\n",
"}",
"\n",
"return",
"structure",
".",
"GetBool",
"(",
"d",
",",
"key",
")",
"\n",
"}"
]
|
16,758 | all-16759 | [
"Validate",
"is",
"middleware",
"to",
"enforce",
"required",
"fields",
".",
"If",
"the",
"struct",
"passed",
"in",
"implements",
"Validator",
"then",
"the",
"user",
"-",
"defined",
"Validate",
"method",
"is",
"executed",
"and",
"its",
"errors",
"are",
"mapped",
"to",
"the",
"context",
".",
"This",
"middleware",
"performs",
"no",
"error",
"handling",
":",
"it",
"merely",
"detects",
"errors",
"and",
"maps",
"them",
"."
]
| [
"func",
"Validate",
"(",
"obj",
"interface",
"{",
"}",
")",
"martini",
".",
"Handler",
"{",
"return",
"func",
"(",
"context",
"martini",
".",
"Context",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"var",
"errors",
"Errors",
"\n\n",
"v",
":=",
"reflect",
".",
"ValueOf",
"(",
"obj",
")",
"\n",
"k",
":=",
"v",
".",
"Kind",
"(",
")",
"\n\n",
"if",
"k",
"==",
"reflect",
".",
"Interface",
"||",
"k",
"==",
"reflect",
".",
"Ptr",
"{",
"v",
"=",
"v",
".",
"Elem",
"(",
")",
"\n",
"k",
"=",
"v",
".",
"Kind",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"k",
"==",
"reflect",
".",
"Slice",
"||",
"k",
"==",
"reflect",
".",
"Array",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"v",
".",
"Len",
"(",
")",
";",
"i",
"++",
"{",
"e",
":=",
"v",
".",
"Index",
"(",
"i",
")",
".",
"Interface",
"(",
")",
"\n",
"errors",
"=",
"validateStruct",
"(",
"errors",
",",
"e",
")",
"\n\n",
"if",
"validator",
",",
"ok",
":=",
"e",
".",
"(",
"Validator",
")",
";",
"ok",
"{",
"errors",
"=",
"validator",
".",
"Validate",
"(",
"errors",
",",
"req",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"else",
"{",
"<mask>",
"=",
"validateStruct",
"(",
"errors",
",",
"obj",
")",
"\n\n",
"if",
"validator",
",",
"ok",
":=",
"obj",
".",
"(",
"Validator",
")",
";",
"ok",
"{",
"errors",
"=",
"validator",
".",
"Validate",
"(",
"errors",
",",
"req",
")",
"\n",
"}",
"\n",
"}",
"\n",
"context",
".",
"Map",
"(",
"errors",
")",
"\n",
"}",
"\n",
"}"
]
|
16,759 | all-16760 | [
"DelBytes",
"deletes",
"header",
"with",
"the",
"given",
"key",
"."
]
| [
"func",
"(",
"h",
"*",
"ResponseHeader",
")",
"DelBytes",
"(",
"key",
"[",
"]",
"byte",
")",
"{",
"h",
".",
"bufKV",
".",
"key",
"=",
"<mask>",
"(",
"h",
".",
"bufKV",
".",
"key",
"[",
":",
"0",
"]",
",",
"key",
"...",
")",
"\n",
"normalizeHeaderKey",
"(",
"h",
".",
"bufKV",
".",
"key",
",",
"h",
".",
"disableNormalizing",
")",
"\n",
"h",
".",
"del",
"(",
"h",
".",
"bufKV",
".",
"key",
")",
"\n",
"}"
]
|
16,760 | all-16761 | [
"SetMaxSize",
"of",
"cache"
]
| [
"func",
"(",
"c",
"*",
"Cache",
")",
"SetMaxSize",
"(",
"maxSize",
"uint32",
")",
"{",
"s",
":=",
"c",
".",
"<mask>",
".",
"Load",
"(",
")",
".",
"(",
"*",
"cacheSettings",
")",
"\n",
"newSettings",
":=",
"*",
"s",
"\n",
"newSettings",
".",
"maxSize",
"=",
"int32",
"(",
"maxSize",
")",
"\n",
"c",
".",
"settings",
".",
"Store",
"(",
"&",
"newSettings",
")",
"\n",
"}"
]
|
16,761 | all-16762 | [
"DeleteStoragePool",
"deletes",
"a",
"storage",
"pool"
]
| [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"DeleteStoragePool",
"(",
"name",
"string",
")",
"error",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Send the request",
"_",
",",
"_",
",",
"err",
":=",
"r",
".",
"query",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"<mask>",
")",
")",
",",
"nil",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
16,762 | all-16763 | [
"AssignIssue",
"adds",
"assignees",
"."
]
| [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"AssignIssue",
"(",
"owner",
",",
"repo",
"string",
",",
"number",
"int",
",",
"assignees",
"[",
"]",
"string",
")",
"error",
"{",
"var",
"m",
"github",
".",
"MissingUsers",
"\n",
"for",
"_",
",",
"a",
":=",
"range",
"assignees",
"{",
"if",
"a",
"==",
"\"",
"\"",
"{",
"m",
".",
"Users",
"=",
"append",
"(",
"m",
".",
"Users",
",",
"a",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"f",
".",
"AssigneesAdded",
"=",
"append",
"(",
"f",
".",
"AssigneesAdded",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"owner",
",",
"repo",
",",
"<mask>",
",",
"a",
")",
")",
"\n",
"}",
"\n",
"if",
"m",
".",
"Users",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"m",
"\n",
"}"
]
|
16,763 | all-16764 | [
"loadBank",
"opens",
"a",
"wordlist",
"file",
"and",
"returns",
"all",
"words",
"inside"
]
| [
"func",
"loadBank",
"(",
"bank",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"<mask>",
":=",
"\"",
"\"",
"+",
"bank",
"+",
"\"",
"\"",
"\n",
"words",
",",
"err",
":=",
"wordlist",
".",
"Asset",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"wordsAll",
":=",
"strings",
".",
"Split",
"(",
"strings",
".",
"TrimSpace",
"(",
"string",
"(",
"words",
")",
")",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"return",
"wordsAll",
",",
"nil",
"\n",
"}"
]
|
16,764 | all-16765 | [
"Cleanup",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockTaskResource",
")",
"Cleanup",
"(",
")",
"error",
"{",
"<mask>",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
]
|
16,765 | all-16766 | [
"Error",
"if",
"typ",
"doesn",
"t",
"match",
"rt",
"."
]
| [
"func",
"checkTyp3",
"(",
"rt",
"reflect",
".",
"<mask>",
",",
"typ",
"Typ3",
",",
"fopts",
"FieldOptions",
")",
"(",
"err",
"error",
")",
"{",
"typWanted",
":=",
"typeToTyp3",
"(",
"rt",
",",
"fopts",
")",
"\n",
"if",
"typ",
"!=",
"typWanted",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"typWanted",
",",
"typ",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
]
|
16,766 | all-16767 | [
"Add",
"function",
"adds",
"a",
"new",
"key",
"to",
"the",
"configuration",
".",
"Function",
"Add",
"()",
"is",
"exactly",
"the",
"same",
"as",
"function",
"Set",
"()",
"."
]
| [
"func",
"(",
"c",
"*",
"Config",
")",
"Add",
"(",
"section",
"string",
",",
"key",
"string",
",",
"<mask>",
"string",
")",
"{",
"c",
".",
"Set",
"(",
"section",
",",
"key",
",",
"value",
")",
"\n",
"}"
]
|
16,767 | all-16768 | [
"handleDockerEvents",
"must",
"be",
"called",
"after",
"openEventstream",
";",
"it",
"processes",
"each",
"event",
"that",
"it",
"reads",
"from",
"the",
"docker",
"event",
"stream",
"."
]
| [
"func",
"(",
"engine",
"*",
"DockerStatsEngine",
")",
"handleDockerEvents",
"(",
"events",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"for",
"_",
",",
"event",
":=",
"<mask>",
"events",
"{",
"dockerContainerChangeEvent",
",",
"ok",
":=",
"event",
".",
"(",
"dockerapi",
".",
"DockerContainerChangeEvent",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"switch",
"dockerContainerChangeEvent",
".",
"Status",
"{",
"case",
"apicontainerstatus",
".",
"ContainerRunning",
":",
"engine",
".",
"addAndStartStatsContainer",
"(",
"dockerContainerChangeEvent",
".",
"DockerID",
")",
"\n",
"case",
"apicontainerstatus",
".",
"ContainerStopped",
":",
"engine",
".",
"removeContainer",
"(",
"dockerContainerChangeEvent",
".",
"DockerID",
")",
"\n",
"default",
":",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"dockerContainerChangeEvent",
".",
"DockerID",
",",
"dockerContainerChangeEvent",
".",
"Status",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
16,768 | all-16769 | [
"Retrieves",
"the",
"name",
"of",
"the",
"property",
"of",
"“source”",
"used",
"as",
"the",
"source",
"of",
"the",
"binding",
"."
]
| [
"func",
"(",
"v",
"*",
"Binding",
")",
"GetSourceProperty",
"(",
")",
"string",
"{",
"s",
":=",
"C",
".",
"g_binding_get_source_property",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"s",
")",
")",
"\n",
"}"
]
|
16,769 | all-16770 | [
"Do",
"executes",
"Overlay",
".",
"setShowAdHighlights",
"against",
"the",
"provided",
"context",
"."
]
| [
"func",
"(",
"p",
"*",
"SetShowAdHighlightsParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetShowAdHighlights",
",",
"p",
",",
"nil",
")",
"\n",
"}"
]
|
16,770 | all-16771 | [
"ServerTemplateLocator",
"builds",
"a",
"locator",
"from",
"the",
"given",
"href",
"."
]
| [
"func",
"(",
"api",
"*",
"API",
")",
"ServerTemplateLocator",
"(",
"href",
"string",
")",
"*",
"ServerTemplateLocator",
"{",
"<mask>",
"&",
"ServerTemplateLocator",
"{",
"Href",
"(",
"href",
")",
",",
"api",
"}",
"\n",
"}"
]
|
16,771 | all-16772 | [
"Do",
"executes",
"LayerTree",
".",
"profileSnapshot",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"timings",
"-",
"The",
"array",
"of",
"paint",
"profiles",
"one",
"per",
"run",
"."
]
| [
"func",
"(",
"p",
"*",
"ProfileSnapshotParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"timings",
"[",
"]",
"PaintProfile",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"ProfileSnapshotReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandProfileSnapshot",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"Timings",
",",
"nil",
"\n",
"}"
]
|
16,772 | all-16773 | [
"ValueAlloc",
"allocates",
"a",
"Value",
"and",
"sets",
"a",
"runtime",
"finalizer",
"to",
"call",
"g_value_unset",
"()",
"on",
"the",
"underlying",
"GValue",
"after",
"leaving",
"scope",
".",
"ValueAlloc",
"()",
"returns",
"a",
"non",
"-",
"nil",
"error",
"if",
"the",
"allocation",
"failed",
"."
]
| [
"func",
"ValueAlloc",
"(",
")",
"(",
"*",
"Value",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"_g_value_alloc",
"(",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"errNilPtr",
"\n",
"}",
"\n\n",
"v",
":=",
"&",
"<mask>",
"{",
"c",
"}",
"\n\n",
"//An allocated GValue is not guaranteed to hold a value that can be unset",
"//We need to double check before unsetting, to prevent:",
"//`g_value_unset: assertion 'G_IS_VALUE (value)' failed`",
"runtime",
".",
"SetFinalizer",
"(",
"v",
",",
"func",
"(",
"f",
"*",
"Value",
")",
"{",
"if",
"t",
",",
"_",
",",
"err",
":=",
"f",
".",
"Type",
"(",
")",
";",
"err",
"!=",
"nil",
"||",
"t",
"==",
"TYPE_INVALID",
"||",
"t",
"==",
"TYPE_NONE",
"{",
"C",
".",
"g_free",
"(",
"C",
".",
"gpointer",
"(",
"f",
".",
"native",
"(",
")",
")",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"f",
".",
"unset",
"(",
")",
"\n",
"}",
")",
"\n\n",
"return",
"v",
",",
"nil",
"\n",
"}"
]
|
16,773 | all-16774 | [
"DefaultServiceConfig",
"provides",
"a",
"default",
"configuration",
"to",
"create",
"a",
"new",
"random",
"service",
"by",
"best",
"effort",
"."
]
| [
"func",
"DefaultServiceConfig",
"(",
")",
"ServiceConfig",
"{",
"return",
"ServiceConfig",
"{",
"// Dependencies.",
"BackoffFactory",
":",
"func",
"(",
")",
"Backoff",
"{",
"return",
"&",
"backoff",
".",
"StopBackOff",
"{",
"}",
"\n",
"}",
",",
"RandFactory",
":",
"rand",
".",
"Int",
",",
"// Settings.",
"RandReader",
":",
"<mask>",
".",
"Reader",
",",
"Timeout",
":",
"1",
"*",
"time",
".",
"Second",
",",
"}",
"\n",
"}"
]
|
16,774 | all-16775 | [
"Inspect",
"executes",
"the",
"inspection",
"into",
"all",
"loaded",
"objects",
"by",
"checking",
"all",
"rules",
"and",
"exceptions",
"loaded",
"."
]
| [
"func",
"(",
"s",
"*",
"Seekret",
")",
"Inspect",
"(",
"Nworkers",
"int",
")",
"{",
"jobs",
":=",
"make",
"(",
"chan",
"workerJob",
")",
"\n",
"results",
":=",
"make",
"(",
"chan",
"workerResult",
")",
"\n\n",
"for",
"w",
":=",
"1",
";",
"w",
"<=",
"Nworkers",
";",
"w",
"++",
"{",
"go",
"inspect_worker",
"(",
"w",
",",
"jobs",
",",
"results",
")",
"\n",
"}",
"\n\n",
"objectGroupMap",
":=",
"s",
".",
"GroupObjectsByPrimaryKeyHash",
"(",
")",
"\n\n",
"go",
"func",
"(",
")",
"{",
"for",
"_",
",",
"objectGroup",
":=",
"range",
"objectGroupMap",
"{",
"jobs",
"<-",
"workerJob",
"{",
"objectGroup",
":",
"objectGroup",
",",
"ruleList",
":",
"s",
".",
"ruleList",
",",
"exceptionList",
":",
"s",
".",
"exceptionList",
",",
"}",
"\n",
"}",
"\n",
"close",
"(",
"<mask>",
")",
"\n",
"}",
"(",
")",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"objectGroupMap",
")",
";",
"i",
"++",
"{",
"result",
":=",
"<-",
"results",
"\n",
"s",
".",
"secretList",
"=",
"append",
"(",
"s",
".",
"secretList",
",",
"result",
".",
"secretList",
"...",
")",
"\n",
"}",
"\n",
"}"
]
|
16,775 | all-16776 | [
"Relocate",
"wraps",
"the",
"Relocate",
"task",
"and",
"the",
"subsequent",
"waiting",
"for",
"the",
"task",
"to",
"complete",
"."
]
| [
"func",
"Relocate",
"(",
"vm",
"*",
"object",
".",
"VirtualMachine",
",",
"spec",
"types",
".",
"VirtualMachineRelocateSpec",
",",
"timeout",
"int",
")",
"error",
"{",
"<mask>",
".",
"Printf",
"(",
"\"",
"\"",
",",
"vm",
".",
"InventoryPath",
",",
"timeout",
")",
"\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"time",
".",
"Minute",
"*",
"time",
".",
"Duration",
"(",
"timeout",
")",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"task",
",",
"err",
":=",
"vm",
".",
"Relocate",
"(",
"ctx",
",",
"spec",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"task",
".",
"Wait",
"(",
"ctx",
")",
";",
"err",
"!=",
"nil",
"{",
"// Provide a friendly error message if we timed out waiting for the migration.",
"if",
"ctx",
".",
"Err",
"(",
")",
"==",
"context",
".",
"DeadlineExceeded",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
16,776 | all-16777 | [
"UnsetEnvs",
"removes",
"environment",
"variables",
"from",
"an",
"app",
"serializing",
"the",
"remaining",
"list",
"of",
"environment",
"variables",
"to",
"all",
"units",
"of",
"the",
"app",
"."
]
| [
"func",
"(",
"app",
"*",
"App",
")",
"UnsetEnvs",
"(",
"unsetEnvs",
"bind",
".",
"UnsetEnvArgs",
")",
"error",
"{",
"if",
"len",
"(",
"unsetEnvs",
".",
"VariableNames",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"unsetEnvs",
".",
"<mask>",
"!=",
"nil",
"{",
"fmt",
".",
"Fprintf",
"(",
"unsetEnvs",
".",
"Writer",
",",
"\"",
"\\n",
"\"",
",",
"len",
"(",
"unsetEnvs",
".",
"VariableNames",
")",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"name",
":=",
"range",
"unsetEnvs",
".",
"VariableNames",
"{",
"delete",
"(",
"app",
".",
"Env",
",",
"name",
")",
"\n",
"}",
"\n",
"conn",
",",
"err",
":=",
"db",
".",
"Conn",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"conn",
".",
"Close",
"(",
")",
"\n",
"err",
"=",
"conn",
".",
"Apps",
"(",
")",
".",
"Update",
"(",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"app",
".",
"Name",
"}",
",",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"app",
".",
"Env",
"}",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"unsetEnvs",
".",
"ShouldRestart",
"{",
"return",
"app",
".",
"restartIfUnits",
"(",
"unsetEnvs",
".",
"Writer",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
16,777 | all-16778 | [
"Removes",
"element",
"from",
"the",
"sequence",
"beginning",
".",
"Copies",
"the",
"element",
"into",
"the",
"paramter",
"element",
"."
]
| [
"func",
"(",
"seq",
"*",
"Seq",
")",
"PopFront",
"(",
"<mask>",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"cvSeqPopFront",
"(",
"(",
"*",
"C",
".",
"struct_CvSeq",
")",
"(",
"seq",
")",
",",
"element",
")",
"\n",
"}"
]
|
16,778 | all-16779 | [
"VerifyVAppTransport",
"validates",
"that",
"all",
"the",
"required",
"components",
"are",
"included",
"in",
"the",
"virtual",
"machine",
"configuration",
"if",
"vApp",
"properties",
"are",
"set",
"."
]
| [
"func",
"VerifyVAppTransport",
"(",
"d",
"*",
"schema",
".",
"ResourceDiff",
",",
"c",
"*",
"govmomi",
".",
"Client",
")",
"error",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"// Check if there is a client CDROM device configured.",
"cl",
":=",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"for",
"_",
",",
"c",
":=",
"range",
"cl",
".",
"(",
"[",
"]",
"interface",
"{",
"}",
")",
"{",
"if",
"c",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"[",
"\"",
"\"",
"]",
".",
"(",
"bool",
")",
"==",
"true",
"{",
"// There is a device configured that can support vApp ISO transport if needed",
"<mask>",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"// Iterate over each transport and see if ISO transport is supported.",
"tm",
":=",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"[",
"]",
"interface",
"{",
"}",
")",
"\n",
"for",
"_",
",",
"m",
":=",
"range",
"tm",
"{",
"if",
"m",
".",
"(",
"string",
")",
"==",
"vAppTransportIso",
"&&",
"len",
"(",
"tm",
")",
"==",
"1",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
16,779 | all-16780 | [
"query",
"the",
"name",
"of",
"an",
"active",
"shader",
"subroutine",
"uniform"
]
| [
"func",
"GetActiveSubroutineUniformName",
"(",
"program",
"uint32",
",",
"shadertype",
"uint32",
",",
"index",
"uint32",
",",
"bufsize",
"int32",
",",
"length",
"*",
"int32",
",",
"name",
"*",
"uint8",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpGetActiveSubroutineUniformName",
",",
"6",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"shadertype",
")",
",",
"uintptr",
"(",
"index",
")",
",",
"uintptr",
"(",
"bufsize",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
")",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"name",
")",
")",
")",
"\n",
"}"
]
|
16,780 | all-16781 | [
"diskApplyOperationDelete",
"is",
"an",
"inner",
"-",
"loop",
"helper",
"for",
"disk",
"deletion",
"operations",
"."
]
| [
"func",
"diskApplyOperationDelete",
"(",
"index",
"int",
",",
"oldData",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"newDataSet",
"[",
"]",
"interface",
"{",
"}",
",",
"c",
"*",
"govmomi",
".",
"Client",
",",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"l",
"*",
"object",
".",
"VirtualDeviceList",
",",
"spec",
"*",
"[",
"]",
"types",
".",
"BaseVirtualDeviceConfigSpec",
",",
")",
"error",
"{",
"didx",
":=",
"-",
"1",
"\n",
"for",
"ni",
",",
"<mask>",
":=",
"range",
"newDataSet",
"{",
"newData",
":=",
"ne",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"var",
"name",
"string",
"\n",
"var",
"err",
"error",
"\n",
"if",
"name",
",",
"err",
"=",
"diskLabelOrName",
"(",
"newData",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"(",
"name",
"==",
"diskDeletedName",
"||",
"name",
"==",
"diskDetachedName",
")",
"&&",
"oldData",
"[",
"\"",
"\"",
"]",
"==",
"newData",
"[",
"\"",
"\"",
"]",
"{",
"didx",
"=",
"ni",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"didx",
"<",
"0",
"{",
"// Deleted entry not found",
"return",
"nil",
"\n",
"}",
"\n",
"r",
":=",
"NewDiskSubresource",
"(",
"c",
",",
"d",
",",
"oldData",
",",
"nil",
",",
"index",
")",
"\n",
"dspec",
",",
"err",
":=",
"r",
".",
"Delete",
"(",
"*",
"l",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"r",
".",
"Addr",
"(",
")",
",",
"err",
")",
"\n",
"}",
"\n",
"*",
"l",
"=",
"applyDeviceChange",
"(",
"*",
"l",
",",
"dspec",
")",
"\n",
"*",
"spec",
"=",
"append",
"(",
"*",
"spec",
",",
"dspec",
"...",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
16,781 | all-16782 | [
"specify",
"a",
"two",
"-",
"dimensional",
"texture",
"image",
"in",
"a",
"compressed",
"format"
]
| [
"func",
"CompressedTexImage2D",
"(",
"target",
"uint32",
",",
"level",
"int32",
",",
"internalformat",
"uint32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"border",
"int32",
",",
"imageSize",
"int32",
",",
"data",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowCompressedTexImage2D",
"(",
"gpCompressedTexImage2D",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"level",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"internalformat",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"height",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"border",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"imageSize",
")",
",",
"data",
")",
"\n",
"}"
]
|
16,782 | all-16783 | [
"export",
"substring_match_equal_func"
]
| [
"func",
"substring_match_equal_func",
"(",
"model",
"*",
"C",
".",
"GtkTreeModel",
",",
"column",
"C",
".",
"gint",
",",
"key",
"*",
"C",
".",
"gchar",
",",
"iter",
"*",
"C",
".",
"GtkTreeIter",
",",
"data",
"C",
".",
"gpointer",
")",
"C",
".",
"gboolean",
"{",
"goModel",
":=",
"&",
"TreeModel",
"{",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"model",
")",
")",
"}",
"\n",
"goIter",
":=",
"&",
"TreeIter",
"{",
"(",
"C",
".",
"GtkTreeIter",
")",
"(",
"*",
"iter",
")",
"}",
"\n\n",
"value",
",",
"err",
":=",
"goModel",
".",
"GetValue",
"(",
"goIter",
",",
"int",
"(",
"column",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"gbool",
"(",
"true",
")",
"\n",
"}",
"\n\n",
"str",
",",
"_",
":=",
"value",
".",
"GetString",
"(",
")",
"\n",
"if",
"str",
"==",
"\"",
"\"",
"{",
"return",
"gbool",
"(",
"true",
")",
"\n",
"}",
"\n\n",
"subStr",
":=",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"key",
")",
")",
"\n",
"res",
":=",
"strings",
".",
"Contains",
"(",
"str",
",",
"subStr",
")",
"\n",
"return",
"gbool",
"(",
"!",
"res",
")",
"\n",
"}"
]
|
16,783 | all-16784 | [
"ReadResponse",
"reads",
"a",
"server",
"response",
"into",
"the",
"received",
"o",
"."
]
| [
"func",
"(",
"o",
"*",
"FindVmsByStatesReader",
")",
"ReadResponse",
"(",
"response",
"runtime",
".",
"ClientResponse",
",",
"consumer",
"runtime",
".",
"Consumer",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"switch",
"response",
".",
"Code",
"(",
")",
"{",
"case",
"200",
":",
"result",
":=",
"NewFindVmsByStatesOK",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n\n",
"case",
"404",
":",
"result",
":=",
"NewFindVmsByStatesNotFound",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n\n",
"default",
":",
"result",
":=",
"NewFindVmsByStatesDefault",
"(",
"response",
".",
"Code",
"(",
")",
")",
"\n",
"if",
"err",
":=",
"<mask>",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n",
"}",
"\n",
"}"
]
|
16,784 | all-16785 | [
"SetBackend",
"sets",
"the",
"current",
"backend"
]
| [
"func",
"(",
"o",
"*",
"<mask>",
")",
"SetBackend",
"(",
"backend",
"OortService",
")",
"{",
"o",
".",
"Lock",
"(",
")",
"\n",
"o",
".",
"backend",
"=",
"backend",
"\n",
"o",
".",
"Unlock",
"(",
")",
"\n",
"}"
]
|
16,785 | all-16786 | [
"decodeYaml",
"takes",
"a",
"reader",
"to",
"a",
"YAML",
"file",
"and",
"unmarshals",
"it",
"to",
"the",
"given",
"struct",
"."
]
| [
"func",
"decodeYaml",
"(",
"r",
"io",
".",
"Reader",
",",
"v",
"<mask>",
"{",
"}",
")",
"error",
"{",
"bytes",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"r",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"yaml",
".",
"Unmarshal",
"(",
"bytes",
",",
"v",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
]
|
16,786 | all-16787 | [
"BestFit",
"returns",
"the",
"best",
"guess",
"of",
"what",
"would",
"be",
"the",
"most",
"interesting",
"server",
"to",
"perform",
"operations",
"on",
"at",
"this",
"point",
"in",
"time",
"."
]
| [
"func",
"(",
"servers",
"*",
"mongoServers",
")",
"BestFit",
"(",
"serverTags",
"[",
"]",
"bson",
".",
"D",
")",
"*",
"mongoServer",
"{",
"var",
"best",
"*",
"mongoServer",
"\n",
"for",
"_",
",",
"next",
":=",
"range",
"servers",
".",
"slice",
"{",
"if",
"best",
"==",
"nil",
"{",
"best",
"=",
"next",
"\n",
"best",
".",
"RLock",
"(",
")",
"\n",
"if",
"serverTags",
"!=",
"nil",
"&&",
"!",
"<mask>",
".",
"info",
".",
"Mongos",
"&&",
"!",
"best",
".",
"hasTags",
"(",
"serverTags",
")",
"{",
"best",
".",
"RUnlock",
"(",
")",
"\n",
"best",
"=",
"nil",
"\n",
"}",
"\n",
"continue",
"\n",
"}",
"\n",
"next",
".",
"RLock",
"(",
")",
"\n",
"swap",
":=",
"false",
"\n",
"switch",
"{",
"case",
"serverTags",
"!=",
"nil",
"&&",
"!",
"next",
".",
"info",
".",
"Mongos",
"&&",
"!",
"next",
".",
"hasTags",
"(",
"serverTags",
")",
":",
"// Must have requested tags.",
"case",
"next",
".",
"info",
".",
"Master",
"!=",
"best",
".",
"info",
".",
"Master",
":",
"// Prefer slaves.",
"swap",
"=",
"best",
".",
"info",
".",
"Master",
"\n",
"case",
"absDuration",
"(",
"next",
".",
"pingValue",
"-",
"best",
".",
"pingValue",
")",
">",
"15",
"*",
"time",
".",
"Millisecond",
":",
"// Prefer nearest server.",
"swap",
"=",
"next",
".",
"pingValue",
"<",
"best",
".",
"pingValue",
"\n",
"case",
"len",
"(",
"next",
".",
"liveSockets",
")",
"-",
"len",
"(",
"next",
".",
"unusedSockets",
")",
"<",
"len",
"(",
"best",
".",
"liveSockets",
")",
"-",
"len",
"(",
"best",
".",
"unusedSockets",
")",
":",
"// Prefer servers with less connections.",
"swap",
"=",
"true",
"\n",
"}",
"\n",
"if",
"swap",
"{",
"best",
".",
"RUnlock",
"(",
")",
"\n",
"best",
"=",
"next",
"\n",
"}",
"else",
"{",
"next",
".",
"RUnlock",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"best",
"!=",
"nil",
"{",
"best",
".",
"RUnlock",
"(",
")",
"\n",
"}",
"\n",
"return",
"best",
"\n",
"}"
]
|
16,787 | all-16788 | [
"Camelize",
"return",
"new",
"string",
"which",
"removes",
"any",
"underscores",
"or",
"dashes",
"and",
"convert",
"a",
"string",
"into",
"camel",
"casing",
"."
]
| [
"func",
"Camelize",
"(",
"s",
"<mask>",
")",
"string",
"{",
"return",
"camelizeRe",
".",
"ReplaceAllStringFunc",
"(",
"s",
",",
"func",
"(",
"val",
"string",
")",
"string",
"{",
"val",
"=",
"strings",
".",
"ToUpper",
"(",
"val",
")",
"\n",
"val",
"=",
"camelizeRe2",
".",
"ReplaceAllString",
"(",
"val",
",",
"\"",
"\"",
")",
"\n",
"return",
"val",
"\n",
"}",
")",
"\n",
"}"
]
|
16,788 | all-16789 | [
"Set",
"is",
"required",
"for",
"kingpin",
"interfaces",
"to",
"allow",
"command",
"line",
"params",
"to",
"be",
"set",
"to",
"our",
"map",
"datatype"
]
| [
"func",
"(",
"o",
"*",
"MapUintOption",
")",
"Set",
"(",
"value",
"string",
")",
"error",
"{",
"parts",
":=",
"stringMapRegex",
".",
"Split",
"(",
"value",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"<mask>",
")",
"!=",
"2",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"value",
")",
"\n",
"}",
"\n",
"val",
":=",
"UintOption",
"{",
"}",
"\n",
"val",
".",
"Set",
"(",
"parts",
"[",
"1",
"]",
")",
"\n",
"(",
"*",
"o",
")",
"[",
"parts",
"[",
"0",
"]",
"]",
"=",
"val",
"\n",
"return",
"nil",
"\n",
"}"
]
|
16,789 | all-16790 | [
"CreateImageSurface",
"is",
"a",
"wrapper",
"around",
"cairo_image_surface_create",
"()",
"."
]
| [
"func",
"CreateImageSurface",
"(",
"format",
"Format",
",",
"width",
",",
"height",
"int",
")",
"*",
"Surface",
"{",
"c",
":=",
"C",
".",
"cairo_image_surface_create",
"(",
"C",
".",
"cairo_format_t",
"(",
"<mask>",
")",
",",
"C",
".",
"int",
"(",
"width",
")",
",",
"C",
".",
"int",
"(",
"height",
")",
")",
"\n",
"s",
":=",
"wrapSurface",
"(",
"c",
")",
"\n",
"runtime",
".",
"SetFinalizer",
"(",
"s",
",",
"(",
"*",
"Surface",
")",
".",
"destroy",
")",
"\n",
"return",
"s",
"\n",
"}"
]
|
16,790 | all-16791 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
]
| [
"func",
"(",
"t",
"*",
"ButtonType",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"ButtonType",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"ButtonNone",
":",
"*",
"t",
"=",
"ButtonNone",
"\n",
"case",
"ButtonLeft",
":",
"*",
"t",
"=",
"ButtonLeft",
"\n",
"<mask>",
"ButtonMiddle",
":",
"*",
"t",
"=",
"ButtonMiddle",
"\n",
"case",
"ButtonRight",
":",
"*",
"t",
"=",
"ButtonRight",
"\n",
"case",
"ButtonBack",
":",
"*",
"t",
"=",
"ButtonBack",
"\n",
"case",
"ButtonForward",
":",
"*",
"t",
"=",
"ButtonForward",
"\n\n",
"default",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
]
|
16,791 | all-16792 | [
"DeleteShare",
"deletes",
"a",
"share"
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteShare",
"(",
"groupid",
"string",
",",
"resourceid",
"string",
")",
"(",
"*",
"http",
".",
"Header",
",",
"error",
")",
"{",
"url",
":=",
"umGroupSharePath",
"(",
"groupid",
",",
"resourceid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"<mask>",
":=",
"&",
"http",
".",
"Header",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Delete",
"(",
"url",
",",
"ret",
",",
"http",
".",
"StatusAccepted",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
]
|
16,792 | all-16793 | [
"DeleteMulti",
"is",
"a",
"batch",
"version",
"of",
"Delete",
".",
"If",
"any",
"keys",
"cannot",
"be",
"found",
"an",
"appengine",
".",
"MultiError",
"is",
"returned",
".",
"Each",
"key",
"must",
"be",
"at",
"most",
"250",
"bytes",
"in",
"length",
"."
]
| [
"func",
"DeleteMulti",
"(",
"c",
"context",
".",
"Context",
",",
"key",
"[",
"]",
"string",
")",
"error",
"{",
"if",
"len",
"(",
"key",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"req",
":=",
"&",
"pb",
".",
"MemcacheDeleteRequest",
"{",
"Item",
":",
"make",
"(",
"[",
"]",
"*",
"pb",
".",
"MemcacheDeleteRequest_Item",
",",
"len",
"(",
"key",
")",
")",
",",
"}",
"\n",
"for",
"i",
",",
"k",
":=",
"range",
"key",
"{",
"req",
".",
"Item",
"[",
"i",
"]",
"=",
"&",
"pb",
".",
"MemcacheDeleteRequest_Item",
"{",
"Key",
":",
"[",
"]",
"byte",
"(",
"k",
")",
"}",
"\n",
"}",
"\n",
"res",
":=",
"&",
"pb",
".",
"MemcacheDeleteResponse",
"{",
"}",
"\n",
"if",
"err",
":=",
"internal",
".",
"Call",
"(",
"c",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"res",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"res",
".",
"DeleteStatus",
")",
"!=",
"len",
"(",
"key",
")",
"{",
"return",
"ErrServerError",
"\n",
"}",
"\n",
"me",
",",
"any",
":=",
"make",
"(",
"appengine",
".",
"MultiError",
",",
"len",
"(",
"key",
")",
")",
",",
"false",
"\n",
"for",
"i",
",",
"s",
":=",
"range",
"res",
".",
"DeleteStatus",
"{",
"switch",
"s",
"{",
"case",
"pb",
".",
"MemcacheDeleteResponse_DELETED",
":",
"// OK",
"case",
"<mask>",
".",
"MemcacheDeleteResponse_NOT_FOUND",
":",
"me",
"[",
"i",
"]",
"=",
"ErrCacheMiss",
"\n",
"any",
"=",
"true",
"\n",
"default",
":",
"me",
"[",
"i",
"]",
"=",
"ErrServerError",
"\n",
"any",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"any",
"{",
"return",
"me",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
16,793 | all-16794 | [
"msgID",
"returns",
"a",
"unique",
"ID",
"of",
"the",
"passed",
"Message"
]
| [
"func",
"msgID",
"(",
"pmsg",
"*",
"pb",
".",
"<mask>",
")",
"string",
"{",
"return",
"string",
"(",
"pmsg",
".",
"GetFrom",
"(",
")",
")",
"+",
"string",
"(",
"pmsg",
".",
"GetSeqno",
"(",
")",
")",
"\n",
"}"
]
|
16,794 | all-16795 | [
"ReadRow",
"parses",
"the",
"pgdump",
"file",
"and",
"populates",
"the",
"header",
"and",
"the",
"footer",
"It",
"returns",
"EOF",
"when",
"done",
"and",
"at",
"that",
"time",
"both",
"the",
"Header",
"and",
"Footer",
"will",
"be",
"populated",
".",
"Both",
"header",
"and",
"footer",
"are",
"required",
".",
"If",
"either",
"are",
"missing",
"an",
"error",
"is",
"returned"
]
| [
"func",
"(",
"r",
"*",
"PGDumpReader",
")",
"ReadRow",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"len",
"(",
"r",
".",
"Header",
")",
"==",
"0",
"{",
"err",
":=",
"r",
".",
"readHeader",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"endLine",
":=",
"\"",
"\\\\",
"\\n",
"\"",
"// Trailing '\\.' denotes the end of the row inserts",
"\n",
"row",
",",
"err",
":=",
"r",
".",
"rd",
".",
"ReadBytes",
"(",
"'\\n'",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"io",
".",
"EOF",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"// corner case: some pgdump files separate lines with \\r\\n (even on linux),",
"// so clean this case up so all handling below is unified",
"if",
"len",
"(",
"row",
")",
">=",
"2",
"&&",
"row",
"[",
"len",
"(",
"row",
")",
"-",
"2",
"]",
"==",
"'\\r'",
"{",
"row",
"[",
"len",
"(",
"<mask>",
")",
"-",
"2",
"]",
"=",
"'\\n'",
"\n",
"row",
"=",
"row",
"[",
":",
"len",
"(",
"row",
")",
"-",
"1",
"]",
"\n",
"}",
"\n",
"if",
"string",
"(",
"row",
")",
"==",
"endLine",
"{",
"r",
".",
"Footer",
"=",
"append",
"(",
"r",
".",
"Footer",
",",
"row",
"...",
")",
"\n",
"err",
"=",
"r",
".",
"readFooter",
"(",
")",
"\n",
"row",
"=",
"nil",
"// The endline is part of the footer",
"\n",
"}",
"\n",
"if",
"err",
"==",
"io",
".",
"EOF",
"&&",
"len",
"(",
"r",
".",
"Footer",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"row",
",",
"err",
"\n",
"}"
]
|
16,795 | all-16796 | [
"CreatePreflight",
"creates",
"HTTP",
"routes",
"that",
"handles",
"pre",
"-",
"flight",
"requests",
"."
]
| [
"func",
"(",
"s",
"*",
"CORSHandler",
")",
"CreatePreflight",
"(",
"routes",
"Routes",
")",
"Routes",
"{",
"list",
":=",
"<mask>",
"(",
"Routes",
",",
"0",
",",
"len",
"(",
"routes",
")",
")",
"\n",
"hList",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"CORSPreflight",
",",
"len",
"(",
"routes",
")",
")",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"routes",
"{",
"preflight",
",",
"ok",
":=",
"hList",
"[",
"v",
".",
"Path",
"]",
"\n",
"if",
"!",
"ok",
"{",
"preflight",
"=",
"&",
"CORSPreflight",
"{",
"*",
"s",
",",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"1",
")",
",",
"v",
".",
"MustAuth",
",",
"}",
"\n",
"hList",
"[",
"v",
".",
"Path",
"]",
"=",
"preflight",
"\n",
"}",
"\n\n",
"preflight",
".",
"Methods",
"=",
"append",
"(",
"preflight",
".",
"Methods",
",",
"v",
".",
"Method",
")",
"\n",
"if",
"v",
".",
"MustAuth",
"{",
"preflight",
".",
"UseCredentials",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"k",
",",
"v",
":=",
"range",
"hList",
"{",
"list",
"=",
"append",
"(",
"list",
",",
"Route",
"{",
"Name",
":",
"\"",
"\"",
",",
"Method",
":",
"DEFAULT_CORS_PREFLIGHT_METHOD",
",",
"Path",
":",
"k",
",",
"MustAuth",
":",
"v",
".",
"UseCredentials",
",",
"ActionFunc",
":",
"v",
".",
"ServeHTTP",
",",
"}",
")",
"\n",
"}",
"\n",
"return",
"list",
"\n",
"}"
]
|
16,796 | all-16797 | [
"Preview",
"analyzes",
"the",
"beginning",
"of",
"the",
"query",
"using",
"a",
"simpler",
"and",
"faster",
"textual",
"comparison",
"to",
"identify",
"the",
"statement",
"type",
"."
]
| [
"func",
"Preview",
"(",
"sql",
"string",
")",
"int",
"{",
"trimmed",
":=",
"StripLeadingComments",
"(",
"sql",
")",
"\n\n",
"firstWord",
":=",
"trimmed",
"\n",
"if",
"<mask>",
":=",
"strings",
".",
"IndexFunc",
"(",
"trimmed",
",",
"unicode",
".",
"IsSpace",
")",
";",
"end",
"!=",
"-",
"1",
"{",
"firstWord",
"=",
"trimmed",
"[",
":",
"end",
"]",
"\n",
"}",
"\n",
"firstWord",
"=",
"strings",
".",
"TrimLeftFunc",
"(",
"firstWord",
",",
"func",
"(",
"r",
"rune",
")",
"bool",
"{",
"return",
"!",
"unicode",
".",
"IsLetter",
"(",
"r",
")",
"}",
")",
"\n",
"// Comparison is done in order of priority.",
"loweredFirstWord",
":=",
"strings",
".",
"ToLower",
"(",
"firstWord",
")",
"\n",
"switch",
"loweredFirstWord",
"{",
"case",
"\"",
"\"",
":",
"return",
"StmtSelect",
"\n",
"case",
"\"",
"\"",
":",
"return",
"StmtStream",
"\n",
"case",
"\"",
"\"",
":",
"return",
"StmtInsert",
"\n",
"case",
"\"",
"\"",
":",
"return",
"StmtReplace",
"\n",
"case",
"\"",
"\"",
":",
"return",
"StmtUpdate",
"\n",
"case",
"\"",
"\"",
":",
"return",
"StmtDelete",
"\n",
"}",
"\n",
"// For the following statements it is not sufficient to rely",
"// on loweredFirstWord. This is because they are not statements",
"// in the grammar and we are relying on Preview to parse them.",
"// For instance, we don't want: \"BEGIN JUNK\" to be parsed",
"// as StmtBegin.",
"trimmedNoComments",
",",
"_",
":=",
"SplitMarginComments",
"(",
"trimmed",
")",
"\n",
"switch",
"strings",
".",
"ToLower",
"(",
"trimmedNoComments",
")",
"{",
"case",
"\"",
"\"",
",",
"\"",
"\"",
":",
"return",
"StmtBegin",
"\n",
"case",
"\"",
"\"",
":",
"return",
"StmtCommit",
"\n",
"case",
"\"",
"\"",
":",
"return",
"StmtRollback",
"\n",
"}",
"\n",
"switch",
"loweredFirstWord",
"{",
"case",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
":",
"return",
"StmtDDL",
"\n",
"case",
"\"",
"\"",
":",
"return",
"StmtSet",
"\n",
"case",
"\"",
"\"",
":",
"return",
"StmtShow",
"\n",
"case",
"\"",
"\"",
":",
"return",
"StmtUse",
"\n",
"case",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
":",
"return",
"StmtOther",
"\n",
"}",
"\n",
"if",
"strings",
".",
"Index",
"(",
"trimmed",
",",
"\"",
"\"",
")",
"==",
"0",
"{",
"return",
"StmtComment",
"\n",
"}",
"\n",
"return",
"StmtUnknown",
"\n",
"}"
]
|
16,797 | all-16798 | [
"String",
"representation",
"of",
"the",
"check",
"results",
"suitable",
"for",
"output",
"and",
"parsing",
"by",
"Nagios",
"."
]
| [
"func",
"(",
"c",
"Check",
")",
"String",
"(",
")",
"string",
"{",
"value",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
".",
"<mask>",
",",
"c",
".",
"exitInfoText",
"(",
")",
")",
"\n",
"value",
"+=",
"RenderPerfdata",
"(",
"c",
".",
"perfdata",
")",
"\n",
"return",
"value",
"\n",
"}"
]
|
16,798 | all-16799 | [
"lintMetricUnits",
"detects",
"issues",
"with",
"metric",
"unit",
"names",
"."
]
| [
"func",
"lintMetricUnits",
"(",
"mf",
"dto",
".",
"MetricFamily",
")",
"[",
"]",
"Problem",
"{",
"var",
"problems",
"problems",
"\n\n",
"unit",
",",
"<mask>",
",",
"ok",
":=",
"metricUnits",
"(",
"*",
"mf",
".",
"Name",
")",
"\n",
"if",
"!",
"ok",
"{",
"// No known units detected.",
"return",
"nil",
"\n",
"}",
"\n\n",
"// Unit is already a base unit.",
"if",
"unit",
"==",
"base",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"problems",
".",
"Add",
"(",
"mf",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"base",
",",
"unit",
")",
")",
"\n\n",
"return",
"problems",
"\n",
"}"
]
|
16,799 | all-16800 | [
"flattenDVSFailureCriteria",
"reads",
"various",
"fields",
"from",
"a",
"DVSFailureCriteria",
"into",
"the",
"passed",
"in",
"ResourceData",
"."
]
| [
"func",
"flattenDVSFailureCriteria",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"<mask>",
".",
"DVSFailureCriteria",
")",
"error",
"{",
"if",
"obj",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"structure",
".",
"SetBoolPolicy",
"(",
"d",
",",
"\"",
"\"",
",",
"obj",
".",
"CheckBeacon",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.