id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
12,300 | all-12301 | [
"WrapResult",
"wraps",
"the",
"result",
"variable",
"before",
"being",
"used",
"in",
"the",
"result",
"struct",
"."
]
| [
"func",
"(",
"m",
"*",
"Method",
")",
"WrapResult",
"(",
"respVar",
"string",
")",
"string",
"{",
"if",
"!",
"m",
".",
"HasReturn",
"(",
")",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"m",
".",
"<mask>",
".",
"isResultPointer",
"(",
"m",
".",
"ReturnType",
")",
"{",
"return",
"respVar",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"+",
"respVar",
"\n",
"}"
]
|
12,301 | all-12302 | [
"Do",
"executes",
"Runtime",
".",
"setCustomObjectFormatterEnabled",
"against",
"the",
"provided",
"context",
"."
]
| [
"func",
"(",
"p",
"*",
"SetCustomObjectFormatterEnabledParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetCustomObjectFormatterEnabled",
",",
"p",
",",
"nil",
")",
"\n",
"}"
]
|
12,302 | all-12303 | [
"createIPAMNetworkConfig",
"constructs",
"the",
"ipam",
"configuration",
"accepted",
"by",
"libcni"
]
| [
"func",
"(",
"client",
"*",
"cniClient",
")",
"createIPAMNetworkConfig",
"(",
"cfg",
"*",
"Config",
")",
"(",
"string",
",",
"*",
"libcni",
".",
"NetworkConfig",
",",
"error",
")",
"{",
"ipamConfig",
",",
"err",
":=",
"client",
".",
"createIPAMConfig",
"(",
"cfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"defaultVethName",
",",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"ipamNetworkConfig",
":=",
"IPAMNetworkConfig",
"{",
"Name",
":",
"ECSIPAMPluginName",
",",
"CNIVersion",
":",
"client",
".",
"cniVersion",
",",
"IPAM",
":",
"ipamConfig",
",",
"}",
"\n\n",
"networkConfig",
",",
"err",
":=",
"<mask>",
".",
"constructNetworkConfig",
"(",
"ipamNetworkConfig",
",",
"ECSIPAMPluginName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"defaultVethName",
",",
"networkConfig",
",",
"nil",
"\n",
"}"
]
|
12,303 | all-12304 | [
"AllRecords",
"generates",
"a",
"map",
"from",
"pool",
"key",
"-",
">",
"sorted",
"records",
"for",
"the",
"pool",
"."
]
| [
"func",
"(",
"h",
"*",
"History",
")",
"AllRecords",
"(",
")",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"Record",
"{",
"h",
".",
"Lock",
"(",
")",
"\n",
"defer",
"h",
".",
"Unlock",
"(",
")",
"\n\n",
"res",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"Record",
",",
"len",
"(",
"h",
".",
"logs",
")",
")",
"\n",
"for",
"key",
",",
"log",
":=",
"range",
"h",
".",
"logs",
"{",
"res",
"[",
"<mask>",
"]",
"=",
"log",
".",
"toSlice",
"(",
")",
"\n",
"}",
"\n",
"return",
"res",
"\n",
"}"
]
|
12,304 | all-12305 | [
"GetLineJoin",
"is",
"a",
"wrapper",
"around",
"cairo_get_line_join",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetLineJoin",
"(",
")",
"LineJoin",
"{",
"c",
":=",
"C",
".",
"cairo_get_line_join",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"LineJoin",
"(",
"c",
")",
"\n",
"}"
]
|
12,305 | all-12306 | [
"RecentLogs",
"connects",
"to",
"trafficcontroller",
"via",
"its",
"recentlogs",
"http",
"(",
"s",
")",
"endpoint",
"and",
"returns",
"a",
"slice",
"of",
"recent",
"messages",
".",
"It",
"does",
"not",
"guarantee",
"any",
"order",
"of",
"the",
"messages",
";",
"they",
"are",
"in",
"the",
"order",
"returned",
"by",
"trafficcontroller",
".",
"The",
"noaa",
".",
"SortRecent",
"function",
"is",
"provided",
"to",
"sort",
"the",
"data",
"returned",
"by",
"this",
"method",
"."
]
| [
"func",
"(",
"c",
"*",
"Consumer",
")",
"RecentLogs",
"(",
"appGuid",
"string",
",",
"authToken",
"string",
")",
"(",
"[",
"]",
"*",
"events",
".",
"LogMessage",
",",
"error",
")",
"{",
"envelopes",
",",
"err",
":=",
"c",
".",
"readTC",
"(",
"appGuid",
",",
"authToken",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"messages",
":=",
"make",
"(",
"[",
"]",
"*",
"<mask>",
".",
"LogMessage",
",",
"0",
",",
"200",
")",
"\n",
"for",
"_",
",",
"env",
":=",
"range",
"envelopes",
"{",
"messages",
"=",
"append",
"(",
"messages",
",",
"env",
".",
"GetLogMessage",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"messages",
",",
"nil",
"\n",
"}"
]
|
12,306 | all-12307 | [
"URLEncode",
"encodes",
"a",
"path",
"and",
"query",
"parameters",
"to",
"a",
"URL",
"."
]
| [
"func",
"URLEncode",
"(",
"path",
"string",
",",
"query",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"u",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"params",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"for",
"key",
",",
"value",
":=",
"<mask>",
"query",
"{",
"params",
".",
"Add",
"(",
"key",
",",
"value",
")",
"\n",
"}",
"\n",
"u",
".",
"RawQuery",
"=",
"params",
".",
"Encode",
"(",
")",
"\n",
"return",
"u",
".",
"String",
"(",
")",
",",
"nil",
"\n",
"}"
]
|
12,307 | all-12308 | [
"NewHandler",
"creates",
"a",
"new",
"basic",
"Handler"
]
| [
"func",
"NewHandler",
"(",
")",
"Handler",
"{",
"h",
":=",
"&",
"basicHandler",
"{",
"livenessChecks",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"Check",
")",
",",
"readinessChecks",
":",
"make",
"(",
"<mask>",
"[",
"string",
"]",
"Check",
")",
",",
"}",
"\n",
"h",
".",
"Handle",
"(",
"\"",
"\"",
",",
"http",
".",
"HandlerFunc",
"(",
"h",
".",
"LiveEndpoint",
")",
")",
"\n",
"h",
".",
"Handle",
"(",
"\"",
"\"",
",",
"http",
".",
"HandlerFunc",
"(",
"h",
".",
"ReadyEndpoint",
")",
")",
"\n",
"return",
"h",
"\n",
"}"
]
|
12,308 | all-12309 | [
"Ctx",
"is",
"a",
"convenience",
"function",
"that",
"returns",
"adds",
"Pachyderm",
"authn",
"metadata",
"to",
"context",
".",
"Background",
"()",
"."
]
| [
"func",
"(",
"c",
"*",
"APIClient",
")",
"Ctx",
"(",
")",
"context",
".",
"Context",
"{",
"if",
"c",
".",
"ctx",
"==",
"nil",
"{",
"return",
"c",
".",
"AddMetadata",
"(",
"<mask>",
".",
"Background",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"c",
".",
"AddMetadata",
"(",
"c",
".",
"ctx",
")",
"\n",
"}"
]
|
12,309 | all-12310 | [
"ChainPool",
"builds",
"an",
"*",
"x509",
".",
"CertPool",
"from",
"this",
"CA",
"and",
"its",
"issuers",
"."
]
| [
"func",
"(",
"id",
"*",
"Identity",
")",
"ChainPool",
"(",
")",
"*",
"x509",
".",
"CertPool",
"{",
"chain",
":=",
"x509",
".",
"NewCertPool",
"(",
")",
"\n",
"for",
"this",
":=",
"id",
";",
"this",
"!=",
"nil",
";",
"this",
"=",
"this",
".",
"Issuer",
"{",
"<mask>",
".",
"AddCert",
"(",
"this",
".",
"Certificate",
")",
"\n",
"}",
"\n\n",
"return",
"chain",
"\n",
"}"
]
|
12,310 | all-12311 | [
"EnsureEmpty",
"ensures",
"that",
"the",
"specified",
"reader",
"is",
"empty",
".",
"If",
"the",
"reader",
"is",
"not",
"empty",
"it",
"returns",
"an",
"error",
"with",
"the",
"specified",
"stage",
"in",
"the",
"message",
"."
]
| [
"func",
"EnsureEmpty",
"(",
"r",
"<mask>",
".",
"Reader",
",",
"stage",
"string",
")",
"error",
"{",
"buf",
":=",
"_bufPool",
".",
"Get",
"(",
")",
".",
"(",
"*",
"[",
"]",
"byte",
")",
"\n",
"defer",
"_bufPool",
".",
"Put",
"(",
"buf",
")",
"\n\n",
"n",
",",
"err",
":=",
"r",
".",
"Read",
"(",
"*",
"buf",
")",
"\n",
"if",
"n",
">",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"stage",
",",
"(",
"*",
"buf",
")",
"[",
":",
"n",
"]",
")",
"\n",
"}",
"\n",
"if",
"err",
"==",
"io",
".",
"EOF",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
]
|
12,311 | all-12312 | [
"Load",
"and",
"add",
"cache",
"items",
"from",
"the",
"given",
"filename",
"excluding",
"any",
"items",
"with",
"keys",
"that",
"already",
"exist",
"in",
"the",
"current",
"cache",
".",
"NOTE",
":",
"This",
"method",
"is",
"deprecated",
"in",
"favor",
"of",
"c",
".",
"Items",
"()",
"and",
"NewFrom",
"()",
"(",
"see",
"the",
"documentation",
"for",
"NewFrom",
"()",
".",
")"
]
| [
"func",
"(",
"c",
"*",
"cache",
")",
"LoadFile",
"(",
"fname",
"string",
")",
"error",
"{",
"fp",
",",
"err",
":=",
"<mask>",
".",
"Open",
"(",
"fname",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"err",
"=",
"c",
".",
"Load",
"(",
"fp",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fp",
".",
"Close",
"(",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"return",
"fp",
".",
"Close",
"(",
")",
"\n",
"}"
]
|
12,312 | all-12313 | [
"IsSent",
"checks",
"if",
"the",
"eni",
"attached",
"status",
"has",
"been",
"sent"
]
| [
"func",
"(",
"eni",
"*",
"ENIAttachment",
")",
"IsSent",
"(",
")",
"bool",
"{",
"eni",
".",
"guard",
".",
"RLock",
"(",
")",
"\n",
"defer",
"eni",
".",
"<mask>",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"eni",
".",
"AttachStatusSent",
"\n",
"}"
]
|
12,313 | all-12314 | [
"resourceVSphereComputeClusterVMDependencyRuleFetchObjects",
"fetches",
"the",
"objects",
"for",
"a",
"cluster",
"rule",
".",
"This",
"is",
"currently",
"just",
"the",
"cluster",
"object",
"as",
"the",
"rule",
"key",
"a",
"static",
"value",
"and",
"a",
"pass",
"-",
"through",
"-",
"this",
"is",
"to",
"keep",
"its",
"workflow",
"consistent",
"with",
"other",
"cluster",
"-",
"dependent",
"resources",
"that",
"derive",
"from",
"ArrayUpdateSpec",
"that",
"have",
"managed",
"object",
"as",
"keys",
"such",
"as",
"VM",
"and",
"host",
"overrides",
"."
]
| [
"func",
"resourceVSphereComputeClusterVMDependencyRuleFetchObjects",
"(",
"meta",
"interface",
"{",
"}",
",",
"clusterID",
"string",
",",
"key",
"int32",
",",
")",
"(",
"*",
"object",
".",
"ClusterComputeResource",
",",
"int32",
",",
"error",
")",
"{",
"client",
",",
"err",
":=",
"resourceVSphereComputeClusterVMDependencyRuleClient",
"(",
"meta",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"cluster",
",",
"err",
":=",
"clustercomputeresource",
".",
"FromID",
"(",
"client",
",",
"clusterID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"cluster",
",",
"<mask>",
",",
"nil",
"\n",
"}"
]
|
12,314 | all-12315 | [
"MarshalJSON",
"overrides",
"the",
"logic",
"for",
"JSON",
"-",
"encoding",
"the",
"ContainerStatus",
"type"
]
| [
"func",
"(",
"cs",
"*",
"ContainerStatus",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"cs",
"==",
"nil",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"return",
"[",
"]",
"<mask>",
"(",
"`\"`",
"+",
"cs",
".",
"String",
"(",
")",
"+",
"`\"`",
")",
",",
"nil",
"\n",
"}"
]
|
12,315 | all-12316 | [
"Read",
"reads",
"response",
"(",
"including",
"body",
")",
"from",
"the",
"given",
"r",
".",
"io",
".",
"EOF",
"is",
"returned",
"if",
"r",
"is",
"closed",
"before",
"reading",
"the",
"first",
"header",
"byte",
"."
]
| [
"func",
"(",
"resp",
"*",
"<mask>",
")",
"Read",
"(",
"r",
"*",
"bufio",
".",
"Reader",
")",
"error",
"{",
"return",
"resp",
".",
"ReadLimitBody",
"(",
"r",
",",
"0",
")",
"\n",
"}"
]
|
12,316 | all-12317 | [
"ContainsFormat",
"returns",
"true",
"if",
"this",
"registry",
"contains",
"the",
"specified",
"format"
]
| [
"func",
"(",
"f",
"*",
"defaultFormats",
")",
"ContainsFormat",
"(",
"strfmt",
"Format",
")",
"bool",
"{",
"f",
".",
"Lock",
"(",
")",
"\n",
"defer",
"f",
".",
"Unlock",
"(",
")",
"\n",
"tpe",
":=",
"reflect",
".",
"TypeOf",
"(",
"strfmt",
")",
"\n",
"if",
"tpe",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Ptr",
"{",
"tpe",
"=",
"tpe",
".",
"Elem",
"(",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"v",
":=",
"range",
"f",
".",
"<mask>",
"{",
"if",
"v",
".",
"Type",
"==",
"tpe",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
]
|
12,317 | all-12318 | [
"Wrap",
"wraps",
"a",
"Handler",
"as",
"a",
"tchannel",
".",
"Handler",
"that",
"can",
"be",
"passed",
"to",
"tchannel",
".",
"Register",
"."
]
| [
"func",
"Wrap",
"(",
"handler",
"Handler",
")",
"tchannel",
".",
"Handler",
"{",
"return",
"tchannel",
".",
"HandlerFunc",
"(",
"func",
"(",
"ctx",
"context",
".",
"Context",
",",
"call",
"*",
"tchannel",
".",
"InboundCall",
")",
"{",
"args",
",",
"err",
":=",
"ReadArgs",
"(",
"call",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"handler",
".",
"OnError",
"(",
"ctx",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"resp",
",",
"err",
":=",
"handler",
".",
"Handle",
"(",
"ctx",
",",
"args",
")",
"\n",
"response",
":=",
"call",
".",
"Response",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"resp",
"=",
"&",
"Res",
"{",
"SystemErr",
":",
"err",
",",
"}",
"\n",
"}",
"\n",
"if",
"err",
":=",
"WriteResponse",
"(",
"<mask>",
",",
"resp",
")",
";",
"err",
"!=",
"nil",
"{",
"handler",
".",
"OnError",
"(",
"ctx",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
")",
"\n",
"}"
]
|
12,318 | all-12319 | [
"Returns",
"all",
"the",
"cgroup",
"subsystems",
"supported",
"by",
"the",
"kernel"
]
| [
"func",
"GetAllSubsystems",
"(",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"f",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"f",
".",
"Close",
"(",
")",
"\n\n",
"subsystems",
":=",
"[",
"]",
"string",
"{",
"}",
"\n\n",
"s",
":=",
"bufio",
".",
"NewScanner",
"(",
"f",
")",
"\n",
"for",
"s",
".",
"Scan",
"(",
")",
"{",
"if",
"err",
":=",
"s",
".",
"Err",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"text",
":=",
"s",
".",
"Text",
"(",
")",
"\n",
"if",
"text",
"[",
"0",
"]",
"!=",
"'#'",
"{",
"parts",
":=",
"strings",
".",
"Fields",
"(",
"text",
")",
"\n",
"if",
"len",
"(",
"<mask>",
")",
">=",
"4",
"&&",
"parts",
"[",
"3",
"]",
"!=",
"\"",
"\"",
"{",
"subsystems",
"=",
"append",
"(",
"subsystems",
",",
"parts",
"[",
"0",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"subsystems",
",",
"nil",
"\n",
"}"
]
|
12,319 | all-12320 | [
"TitleFromContext",
"is",
"a",
"convenience",
"function",
"that",
"returns",
"the",
"Trace",
"s",
"title",
"from",
"a",
"context",
"or",
"an",
"empty",
"string",
"if",
"none",
"exists"
]
| [
"func",
"TitleFromContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"string",
"{",
"id",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"TraceIDKey",
")",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"<mask>",
"\n",
"}"
]
|
12,320 | all-12321 | [
"NewMovingAverage",
"constructs",
"a",
"MovingAverage",
"that",
"computes",
"an",
"average",
"with",
"the",
"desired",
"characteristics",
"in",
"the",
"moving",
"window",
"or",
"exponential",
"decay",
".",
"If",
"no",
"age",
"is",
"given",
"it",
"constructs",
"a",
"default",
"exponentially",
"weighted",
"implementation",
"that",
"consumes",
"minimal",
"memory",
".",
"The",
"age",
"is",
"related",
"to",
"the",
"decay",
"factor",
"alpha",
"by",
"the",
"formula",
"given",
"for",
"the",
"DECAY",
"constant",
".",
"It",
"signifies",
"the",
"average",
"age",
"of",
"the",
"samples",
"as",
"time",
"goes",
"to",
"infinity",
"."
]
| [
"func",
"NewMovingAverage",
"(",
"age",
"...",
"float64",
")",
"MovingAverage",
"{",
"if",
"len",
"(",
"age",
")",
"==",
"0",
"||",
"<mask>",
"[",
"0",
"]",
"==",
"AVG_METRIC_AGE",
"{",
"return",
"new",
"(",
"SimpleEWMA",
")",
"\n",
"}",
"\n",
"return",
"&",
"VariableEWMA",
"{",
"decay",
":",
"2",
"/",
"(",
"age",
"[",
"0",
"]",
"+",
"1",
")",
",",
"}",
"\n",
"}"
]
|
12,321 | all-12322 | [
"Deterministically",
"generates",
"new",
"priv",
"-",
"key",
"bytes",
"from",
"key",
"."
]
| [
"func",
"(",
"privKey",
"PrivKeyEd25519",
")",
"Generate",
"(",
"index",
"int",
")",
"PrivKeyEd25519",
"{",
"bz",
",",
"err",
":=",
"cdc",
".",
"MarshalBinaryBare",
"(",
"struct",
"{",
"PrivKey",
"[",
"64",
"]",
"byte",
"\n",
"Index",
"int",
"\n",
"}",
"{",
"privKey",
",",
"index",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"newBytes",
":=",
"Sha256",
"(",
"bz",
")",
"\n",
"newKey",
":=",
"<mask>",
"(",
"[",
"64",
"]",
"byte",
")",
"\n",
"copy",
"(",
"newKey",
"[",
":",
"32",
"]",
",",
"newBytes",
")",
"\n",
"ed25519",
".",
"MakePublicKey",
"(",
"newKey",
")",
"\n",
"return",
"PrivKeyEd25519",
"(",
"*",
"newKey",
")",
"\n",
"}"
]
|
12,322 | all-12323 | [
"RegisterLocation",
"registers",
"an",
"URL",
"location",
"and",
"maps",
"it",
"to",
"the",
"given",
"file",
"system",
"path",
".",
"Calling",
"RegisterLocation",
"twice",
"for",
"the",
"same",
"location",
"is",
"a",
"programmer",
"error",
"and",
"causes",
"a",
"panic",
"."
]
| [
"func",
"(",
"t",
"*",
"Transport",
")",
"RegisterLocation",
"(",
"loc",
"string",
",",
"path",
"string",
")",
"{",
"t",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"t",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"t",
".",
"loc",
"==",
"nil",
"{",
"t",
".",
"loc",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"}",
"\n",
"if",
"_",
",",
"exists",
":=",
"t",
".",
"loc",
"[",
"loc",
"]",
";",
"exists",
"{",
"panic",
"(",
"\"",
"\"",
"+",
"loc",
"+",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"t",
".",
"loc",
"[",
"loc",
"]",
"=",
"<mask>",
"\n",
"}"
]
|
12,323 | all-12324 | [
"/",
"*",
"Identify",
"the",
"end",
"of",
"a",
"transaction"
]
| [
"func",
"TransactionEnd",
"(",
"<mask>",
"int64",
")",
"(",
"int",
",",
"error",
")",
"{",
"return",
"errNo",
"(",
"C",
".",
"newrelic_transaction_end",
"(",
"C",
".",
"long",
"(",
"id",
")",
")",
")",
"\n",
"}"
]
|
12,324 | all-12325 | [
"delimit",
"the",
"boundaries",
"of",
"a",
"query",
"object"
]
| [
"func",
"BeginQuery",
"(",
"target",
"uint32",
",",
"id",
"uint32",
")",
"{",
"C",
".",
"glowBeginQuery",
"(",
"gpBeginQuery",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"<mask>",
")",
")",
"\n",
"}"
]
|
12,325 | all-12326 | [
"NewInt",
"creates",
"a",
"new",
"Int"
]
| [
"func",
"NewInt",
"(",
"i",
"int64",
",",
"<mask>",
"bool",
")",
"Int",
"{",
"return",
"Int",
"{",
"NullInt64",
":",
"sql",
".",
"NullInt64",
"{",
"Int64",
":",
"i",
",",
"Valid",
":",
"valid",
",",
"}",
",",
"}",
"\n",
"}"
]
|
12,326 | all-12327 | [
"ThumbPosition",
"returns",
"a",
"scrollbar",
"thumb",
"position",
"depending",
"on",
"currently",
"active",
"item",
"(",
"itemNo",
")",
"total",
"number",
"of",
"items",
"(",
"itemCount",
")",
"and",
"length",
"/",
"height",
"of",
"the",
"scrollbar",
"(",
"length",
")",
"including",
"arrows",
".",
"Returns",
"position",
"in",
"interval",
"of",
"(",
"1",
"..",
"lenght",
"-",
"2",
")",
"or",
"-",
"1",
"if",
"the",
"thumb",
"is",
"not",
"visible"
]
| [
"func",
"ThumbPosition",
"(",
"itemNo",
",",
"itemCount",
",",
"length",
"int",
")",
"int",
"{",
"length",
"-=",
"2",
"\n",
"if",
"itemNo",
"<",
"0",
"{",
"return",
"-",
"1",
"\n",
"}",
"\n",
"if",
"itemNo",
">=",
"itemCount",
"-",
"1",
"{",
"return",
"length",
"-",
"1",
"\n",
"}",
"\n\n",
"if",
"<mask>",
"<",
"4",
"{",
"return",
"0",
"\n",
"}",
"\n\n",
"ydiff",
":=",
"int",
"(",
"float32",
"(",
"itemNo",
")",
"/",
"float32",
"(",
"itemCount",
"-",
"1.0",
")",
"*",
"float32",
"(",
"length",
"-",
"1",
")",
")",
"\n",
"return",
"ydiff",
"\n",
"}"
]
|
12,327 | all-12328 | [
"TCPAddr",
"returns",
"a",
"TCP",
"address",
"of",
"the",
"listener",
"that",
"a",
"server",
"with",
"a",
"specific",
"name",
"is",
"using",
".",
"If",
"there",
"are",
"more",
"servers",
"with",
"the",
"same",
"name",
"the",
"address",
"of",
"the",
"first",
"started",
"server",
"is",
"returned",
"."
]
| [
"func",
"(",
"s",
"*",
"Servers",
")",
"TCPAddr",
"(",
"name",
"string",
")",
"(",
"a",
"*",
"net",
".",
"TCPAddr",
")",
"{",
"s",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"for",
"_",
",",
"srv",
":=",
"range",
"s",
".",
"servers",
"{",
"if",
"srv",
".",
"name",
"==",
"<mask>",
"{",
"return",
"srv",
".",
"tcpAddr",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
12,328 | all-12329 | [
"ForEachPR",
"iterates",
"over",
"all",
"PRs",
"that",
"fit",
"the",
"specified",
"criteria",
"calling",
"the",
"munge",
"function",
"on",
"every",
"PR",
".",
"If",
"the",
"munge",
"function",
"returns",
"a",
"non",
"-",
"nil",
"error",
"ForEachPR",
"will",
"return",
"immediately",
"with",
"a",
"non",
"-",
"nil",
"error",
"unless",
"continueOnError",
"is",
"true",
"in",
"which",
"case",
"an",
"error",
"will",
"be",
"logged",
"and",
"the",
"remaining",
"PRs",
"will",
"be",
"munged",
"."
]
| [
"func",
"(",
"c",
"*",
"<mask>",
")",
"ForEachPR",
"(",
"owner",
",",
"repo",
"string",
",",
"opts",
"*",
"github",
".",
"PullRequestListOptions",
",",
"continueOnError",
"bool",
",",
"mungePR",
"PRMungeFunc",
")",
"error",
"{",
"var",
"lastPage",
"int",
"\n",
"// Munge each page as we get it (or in other words, wait until we are ready to munge the next",
"// page of issues before getting it). We use depaginate to make the calls, but don't care about",
"// the slice it returns since we consume the pages as we go.",
"_",
",",
"err",
":=",
"c",
".",
"depaginate",
"(",
"\"",
"\"",
",",
"&",
"opts",
".",
"ListOptions",
",",
"func",
"(",
")",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"*",
"github",
".",
"Response",
",",
"error",
")",
"{",
"list",
",",
"resp",
",",
"err",
":=",
"c",
".",
"prService",
".",
"List",
"(",
"context",
".",
"Background",
"(",
")",
",",
"owner",
",",
"repo",
",",
"opts",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"for",
"_",
",",
"pr",
":=",
"range",
"list",
"{",
"if",
"pr",
"==",
"nil",
"{",
"glog",
".",
"Errorln",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"mungeErr",
":=",
"mungePR",
"(",
"pr",
")",
";",
"mungeErr",
"!=",
"nil",
"{",
"if",
"pr",
".",
"Number",
"==",
"nil",
"{",
"mungeErr",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"mungeErr",
")",
"\n",
"}",
"else",
"{",
"mungeErr",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"*",
"pr",
".",
"Number",
",",
"mungeErr",
")",
"\n",
"}",
"\n",
"if",
"!",
"continueOnError",
"{",
"return",
"nil",
",",
"resp",
",",
"&",
"retryAbort",
"{",
"mungeErr",
"}",
"\n",
"}",
"\n",
"glog",
".",
"Errorf",
"(",
"\"",
"\\n",
"\"",
",",
"mungeErr",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"resp",
".",
"LastPage",
">",
"0",
"{",
"lastPage",
"=",
"resp",
".",
"LastPage",
"\n",
"}",
"\n",
"glog",
".",
"Infof",
"(",
"\"",
"\\n",
"\"",
",",
"opts",
".",
"ListOptions",
".",
"Page",
",",
"lastPage",
")",
"\n",
"}",
"\n",
"return",
"nil",
",",
"resp",
",",
"err",
"\n",
"}",
",",
")",
"\n",
"return",
"err",
"\n",
"}"
]
|
12,329 | all-12330 | [
"Push",
"causes",
"the",
"Reader",
"to",
"start",
"reading",
"from",
"a",
"new",
"io",
".",
"Reader",
".",
"When",
"an",
"EOF",
"error",
"is",
"seen",
"from",
"the",
"new",
"io",
".",
"Reader",
"it",
"is",
"popped",
"and",
"the",
"Reader",
"continues",
"to",
"read",
"from",
"the",
"next",
"most",
"recent",
"io",
".",
"Reader",
"."
]
| [
"func",
"(",
"r",
"*",
"Reader",
")",
"Push",
"(",
"<mask>",
"io",
".",
"Reader",
")",
"{",
"r",
".",
"readers",
"=",
"append",
"(",
"r",
".",
"readers",
",",
"reader",
")",
"\n",
"}"
]
|
12,330 | all-12331 | [
"UnmarshalECDSAPublicKey",
"returns",
"the",
"public",
"key",
"from",
"x509",
"bytes"
]
| [
"func",
"UnmarshalECDSAPublicKey",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"PubKey",
",",
"error",
")",
"{",
"pubIfc",
",",
"err",
":=",
"x509",
".",
"ParsePKIXPublicKey",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"pub",
",",
"ok",
":=",
"pubIfc",
".",
"(",
"*",
"ecdsa",
".",
"PublicKey",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"ErrNotECDSAPubKey",
"\n",
"}",
"\n\n",
"return",
"&",
"ECDSAPublicKey",
"{",
"pub",
"}",
",",
"nil",
"\n",
"}"
]
|
12,331 | all-12332 | [
"Size",
"returns",
"the",
"number",
"of",
"entries",
"populating",
"the",
"Stack",
"."
]
| [
"func",
"(",
"stack",
"*",
"Stack",
")",
"Size",
"(",
")",
"uint",
"{",
"stack",
".",
"key",
".",
"RLock",
"(",
")",
"\n",
"defer",
"stack",
".",
"key",
".",
"RUnlock",
"(",
")",
"\n",
"if",
"<mask>",
".",
"underlyer",
"==",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"stack",
".",
"underlyer",
".",
"Length",
"(",
")",
"\n",
"}"
]
|
12,332 | all-12333 | [
"Copy",
"Returns",
"a",
"copy",
"of",
"a",
"Glyph"
]
| [
"func",
"(",
"g",
"*",
"Glyph",
")",
"Copy",
"(",
")",
"*",
"Glyph",
"{",
"return",
"&",
"Glyph",
"{",
"<mask>",
":",
"g",
".",
"Path",
".",
"Copy",
"(",
")",
",",
"Width",
":",
"g",
".",
"Width",
",",
"}",
"\n",
"}"
]
|
12,333 | all-12334 | [
"resourceVSphereDatastoreClusterReadCustomAttributes",
"reads",
"the",
"custom",
"attributes",
"for",
"vsphere_datastore_cluster",
"."
]
| [
"func",
"resourceVSphereDatastoreClusterReadCustomAttributes",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
",",
"pod",
"*",
"object",
".",
"StoragePod",
")",
"error",
"{",
"client",
":=",
"meta",
".",
"(",
"*",
"VSphereClient",
")",
".",
"vimClient",
"\n",
"// Read custom attributes",
"if",
"customattribute",
".",
"IsSupported",
"(",
"<mask>",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereDatastoreClusterIDString",
"(",
"d",
")",
")",
"\n",
"props",
",",
"err",
":=",
"storagepod",
".",
"Properties",
"(",
"pod",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"customattribute",
".",
"ReadFromResource",
"(",
"client",
",",
"props",
".",
"Entity",
"(",
")",
",",
"d",
")",
"\n",
"}",
"else",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereDatastoreClusterIDString",
"(",
"d",
")",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
12,334 | all-12335 | [
"GetHeightOk",
"returns",
"a",
"tuple",
"with",
"the",
"Height",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"w",
"*",
"WidgetLayout",
")",
"GetHeightOk",
"(",
")",
"(",
"float64",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"Height",
"==",
"nil",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"Height",
",",
"<mask>",
"\n",
"}"
]
|
12,335 | all-12336 | [
"ListPods",
"is",
"analogous",
"to",
"kubectl",
"get",
"pods",
"--",
"selector",
"=",
"SELECTOR",
"--",
"namespace",
"=",
"client",
".",
"namespace"
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"ListPods",
"(",
"selector",
"string",
")",
"(",
"[",
"]",
"Pod",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"selector",
")",
"\n",
"var",
"pl",
"struct",
"{",
"Items",
"[",
"]",
"Pod",
"`json:\"items\"`",
"\n",
"}",
"\n",
"err",
":=",
"c",
".",
"request",
"(",
"&",
"<mask>",
"{",
"path",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
".",
"namespace",
")",
",",
"query",
":",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"selector",
"}",
",",
"}",
",",
"&",
"pl",
")",
"\n",
"return",
"pl",
".",
"Items",
",",
"err",
"\n",
"}"
]
|
12,336 | all-12337 | [
"FrontAndBack",
"gets",
"the",
"front",
"and",
"back",
"elements",
"in",
"the",
"queue",
"We",
"must",
"grab",
"front",
"and",
"back",
"together",
"with",
"the",
"protection",
"of",
"the",
"lock"
]
| [
"func",
"(",
"q",
"*",
"statsQueue",
")",
"frontAndBack",
"(",
")",
"(",
"*",
"RequestStats",
",",
"*",
"RequestStats",
")",
"{",
"q",
".",
"rwl",
".",
"RLock",
"(",
")",
"\n",
"defer",
"q",
".",
"rwl",
".",
"RUnlock",
"(",
")",
"\n",
"if",
"q",
".",
"size",
"!=",
"0",
"{",
"return",
"q",
".",
"items",
"[",
"q",
".",
"front",
"]",
",",
"q",
".",
"<mask>",
"[",
"q",
".",
"back",
"]",
"\n",
"}",
"\n",
"return",
"nil",
",",
"nil",
"\n",
"}"
]
|
12,337 | all-12338 | [
"Do",
"executes",
"Target",
".",
"createTarget",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"targetID",
"-",
"The",
"id",
"of",
"the",
"page",
"opened",
"."
]
| [
"func",
"(",
"p",
"*",
"CreateTargetParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"targetID",
"ID",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"CreateTargetReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandCreateTarget",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"<mask>",
".",
"TargetID",
",",
"nil",
"\n",
"}"
]
|
12,338 | all-12339 | [
"getStatus",
"gets",
"a",
"copy",
"of",
"the",
"current",
"raft",
"status",
"."
]
| [
"func",
"getStatus",
"(",
"r",
"*",
"raft",
")",
"<mask>",
"{",
"s",
":=",
"getStatusWithoutProgress",
"(",
"r",
")",
"\n",
"if",
"s",
".",
"RaftState",
"==",
"StateLeader",
"{",
"s",
".",
"Progress",
"=",
"getProgressCopy",
"(",
"r",
")",
"\n",
"}",
"\n",
"return",
"s",
"\n",
"}"
]
|
12,339 | all-12340 | [
"See",
"bcd",
".",
"TracerSig",
".",
"Sigset",
"()",
"."
]
| [
"func",
"(",
"t",
"*",
"BTTracer",
")",
"Sigset",
"(",
")",
"[",
"]",
"os",
".",
"Signal",
"{",
"return",
"<mask>",
"(",
"[",
"]",
"os",
".",
"Signal",
"(",
"nil",
")",
",",
"t",
".",
"ss",
"...",
")",
"\n",
"}"
]
|
12,340 | all-12341 | [
"HasMessage",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"h",
"*",
"HostActionMute",
")",
"HasMessage",
"(",
")",
"bool",
"{",
"if",
"h",
"!=",
"nil",
"&&",
"h",
".",
"<mask>",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
12,341 | all-12342 | [
"MustInflationResult",
"retrieves",
"the",
"InflationResult",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
]
| [
"func",
"(",
"u",
"OperationResultTr",
")",
"MustInflationResult",
"(",
")",
"InflationResult",
"{",
"val",
",",
"<mask>",
":=",
"u",
".",
"GetInflationResult",
"(",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
]
|
12,342 | all-12343 | [
"MarshalJSON",
"is",
"a",
"custom",
"method",
"for",
"handling",
"datetime",
"marshalling"
]
| [
"func",
"(",
"k",
"APIKey",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"// Approach for custom (un)marshalling borrowed from http://choly.ca/post/go-json-marshalling/",
"<mask>",
"Alias",
"APIKey",
"\n",
"return",
"json",
".",
"Marshal",
"(",
"&",
"struct",
"{",
"Created",
"*",
"string",
"`json:\"created,omitempty\"`",
"\n",
"*",
"Alias",
"\n",
"}",
"{",
"Created",
":",
"String",
"(",
"k",
".",
"Created",
".",
"Format",
"(",
"createdTimeLayout",
")",
")",
",",
"Alias",
":",
"(",
"*",
"Alias",
")",
"(",
"&",
"k",
")",
",",
"}",
")",
"\n",
"}"
]
|
12,343 | all-12344 | [
"Close",
"the",
"database",
"facade",
"."
]
| [
"func",
"(",
"c",
"*",
"Cluster",
")",
"Close",
"(",
")",
"error",
"{",
"for",
"_",
",",
"stmt",
":=",
"range",
"c",
".",
"stmts",
"{",
"stmt",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"return",
"c",
".",
"<mask>",
".",
"Close",
"(",
")",
"\n",
"}"
]
|
12,344 | all-12345 | [
"export",
"gogpgme_readfunc"
]
| [
"func",
"gogpgme_readfunc",
"(",
"handle",
",",
"buffer",
"unsafe",
".",
"Pointer",
",",
"size",
"C",
".",
"size_t",
")",
"C",
".",
"ssize_t",
"{",
"d",
":=",
"callbackLookup",
"(",
"uintptr",
"(",
"handle",
")",
")",
".",
"(",
"*",
"Data",
")",
"\n",
"if",
"len",
"(",
"d",
".",
"buf",
")",
"<",
"int",
"(",
"size",
")",
"{",
"d",
".",
"buf",
"=",
"make",
"(",
"[",
"]",
"<mask>",
",",
"size",
")",
"\n",
"}",
"\n",
"n",
",",
"err",
":=",
"d",
".",
"r",
".",
"Read",
"(",
"d",
".",
"buf",
"[",
":",
"size",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"io",
".",
"EOF",
"{",
"C",
".",
"gpgme_err_set_errno",
"(",
"C",
".",
"EIO",
")",
"\n",
"return",
"-",
"1",
"\n",
"}",
"\n",
"C",
".",
"memcpy",
"(",
"buffer",
",",
"unsafe",
".",
"Pointer",
"(",
"&",
"d",
".",
"buf",
"[",
"0",
"]",
")",
",",
"C",
".",
"size_t",
"(",
"n",
")",
")",
"\n",
"return",
"C",
".",
"ssize_t",
"(",
"n",
")",
"\n",
"}"
]
|
12,345 | all-12346 | [
"NewLimiter",
"returns",
"a",
"new",
"limiter"
]
| [
"func",
"NewLimiter",
"(",
"counter",
"Counter",
",",
"duration",
"time",
".",
"Duration",
",",
"limit",
"uint64",
")",
"Limiter",
"{",
"return",
"&",
"limiter",
"{",
"Counter",
":",
"<mask>",
",",
"duration",
":",
"duration",
",",
"limit",
":",
"limit",
",",
"}",
"\n",
"}"
]
|
12,346 | all-12347 | [
"expandToolsConfigInfo",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"ToolsConfigInfo",
"."
]
| [
"func",
"expandToolsConfigInfo",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"*",
"types",
".",
"ToolsConfigInfo",
"{",
"obj",
":=",
"&",
"<mask>",
".",
"ToolsConfigInfo",
"{",
"SyncTimeWithHost",
":",
"structure",
".",
"GetBool",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"AfterPowerOn",
":",
"getBoolWithRestart",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"AfterResume",
":",
"getBoolWithRestart",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"BeforeGuestStandby",
":",
"getBoolWithRestart",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"BeforeGuestShutdown",
":",
"getBoolWithRestart",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"BeforeGuestReboot",
":",
"getBoolWithRestart",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"}",
"\n",
"return",
"obj",
"\n",
"}"
]
|
12,347 | all-12348 | [
"Store",
"a",
"font",
"to",
"this",
"cache"
]
| [
"func",
"(",
"cache",
"*",
"FolderFontCache",
")",
"Store",
"(",
"fontData",
"FontData",
",",
"font",
"*",
"truetype",
".",
"Font",
")",
"{",
"cache",
".",
"fonts",
"[",
"<mask>",
".",
"namer",
"(",
"fontData",
")",
"]",
"=",
"font",
"\n",
"}"
]
|
12,348 | all-12349 | [
"removeDatastore",
"is",
"a",
"convenience",
"method",
"for",
"removing",
"a",
"referenced",
"datastore",
"."
]
| [
"func",
"removeDatastore",
"(",
"s",
"*",
"object",
".",
"HostDatastoreSystem",
",",
"ds",
"*",
"<mask>",
".",
"Datastore",
")",
"error",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"defaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"return",
"s",
".",
"Remove",
"(",
"ctx",
",",
"ds",
")",
"\n",
"}"
]
|
12,349 | all-12350 | [
"Split",
"partitions",
"a",
"string",
"into",
"a",
"slice",
"of",
"strings",
"."
]
| [
"func",
"Split",
"(",
"s",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"l",
":=",
"NewLexer",
"(",
"strings",
".",
"NewReader",
"(",
"s",
")",
")",
"\n",
"subStrings",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n",
"for",
"{",
"word",
",",
"err",
":=",
"l",
".",
"Next",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"io",
".",
"EOF",
"{",
"return",
"subStrings",
",",
"nil",
"\n",
"}",
"\n",
"return",
"subStrings",
",",
"err",
"\n",
"}",
"\n",
"subStrings",
"=",
"append",
"(",
"subStrings",
",",
"<mask>",
")",
"\n",
"}",
"\n",
"}"
]
|
12,350 | all-12351 | [
"SetHardState",
"saves",
"the",
"current",
"HardState",
"."
]
| [
"func",
"(",
"<mask>",
"*",
"MemoryStorage",
")",
"SetHardState",
"(",
"st",
"pb",
".",
"HardState",
")",
"error",
"{",
"ms",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ms",
".",
"Unlock",
"(",
")",
"\n",
"ms",
".",
"hardState",
"=",
"st",
"\n",
"return",
"nil",
"\n",
"}"
]
|
12,351 | all-12352 | [
"Delete",
"the",
"Caller",
"ID",
"with",
"the",
"given",
"sid",
".",
"If",
"the",
"ID",
"has",
"already",
"been",
"deleted",
"or",
"does",
"not",
"exist",
"Delete",
"returns",
"nil",
".",
"If",
"another",
"error",
"or",
"a",
"timeout",
"occurs",
"the",
"error",
"is",
"returned",
"."
]
| [
"func",
"(",
"o",
"*",
"OutgoingCallerIDService",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"sid",
"string",
")",
"error",
"{",
"return",
"o",
".",
"<mask>",
".",
"DeleteResource",
"(",
"ctx",
",",
"callerIDPathPart",
",",
"sid",
")",
"\n",
"}"
]
|
12,352 | all-12353 | [
"PropagateDraw",
"is",
"a",
"wrapper",
"around",
"gtk_container_propagate_draw",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Container",
")",
"PropagateDraw",
"(",
"<mask>",
"IWidget",
",",
"cr",
"*",
"cairo",
".",
"Context",
")",
"{",
"context",
":=",
"(",
"*",
"C",
".",
"cairo_t",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"cr",
".",
"Native",
"(",
")",
")",
")",
"\n",
"C",
".",
"gtk_container_propagate_draw",
"(",
"v",
".",
"native",
"(",
")",
",",
"child",
".",
"toWidget",
"(",
")",
",",
"context",
")",
"\n",
"}"
]
|
12,353 | all-12354 | [
"ListSecretVersionIdsRequest",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockSecretsManagerAPI",
")",
"ListSecretVersionIdsRequest",
"(",
"arg0",
"*",
"secretsmanager",
".",
"ListSecretVersionIdsInput",
")",
"(",
"*",
"<mask>",
".",
"Request",
",",
"*",
"secretsmanager",
".",
"ListSecretVersionIdsOutput",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"request",
".",
"Request",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"*",
"secretsmanager",
".",
"ListSecretVersionIdsOutput",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
]
|
12,354 | all-12355 | [
"LongPolicy",
"converts",
"a",
"supported",
"number",
"into",
"a",
"VMware",
"LongPolicy",
"value",
".",
"This",
"will",
"panic",
"if",
"there",
"is",
"no",
"implicit",
"conversion",
"of",
"the",
"value",
"into",
"an",
"int64",
"."
]
| [
"func",
"LongPolicy",
"(",
"n",
"interface",
"{",
"}",
")",
"*",
"types",
".",
"LongPolicy",
"{",
"lp",
":=",
"&",
"types",
".",
"LongPolicy",
"{",
"}",
"\n",
"switch",
"v",
":=",
"n",
".",
"(",
"type",
")",
"{",
"case",
"int",
":",
"lp",
".",
"Value",
"=",
"int64",
"(",
"v",
")",
"\n",
"<mask>",
"int8",
":",
"lp",
".",
"Value",
"=",
"int64",
"(",
"v",
")",
"\n",
"case",
"int16",
":",
"lp",
".",
"Value",
"=",
"int64",
"(",
"v",
")",
"\n",
"case",
"int32",
":",
"lp",
".",
"Value",
"=",
"int64",
"(",
"v",
")",
"\n",
"case",
"uint",
":",
"lp",
".",
"Value",
"=",
"int64",
"(",
"v",
")",
"\n",
"case",
"uint8",
":",
"lp",
".",
"Value",
"=",
"int64",
"(",
"v",
")",
"\n",
"case",
"uint16",
":",
"lp",
".",
"Value",
"=",
"int64",
"(",
"v",
")",
"\n",
"case",
"uint32",
":",
"lp",
".",
"Value",
"=",
"int64",
"(",
"v",
")",
"\n",
"case",
"int64",
":",
"lp",
".",
"Value",
"=",
"v",
"\n",
"default",
":",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"n",
")",
")",
"\n",
"}",
"\n",
"return",
"lp",
"\n",
"}"
]
|
12,355 | all-12356 | [
"BeginningOfYear",
"BeginningOfYear",
"beginning",
"of",
"year"
]
| [
"func",
"(",
"now",
"*",
"Now",
")",
"BeginningOfYear",
"(",
")",
"time",
".",
"Time",
"{",
"y",
",",
"_",
",",
"_",
":=",
"now",
".",
"Date",
"(",
")",
"\n",
"return",
"time",
".",
"Date",
"(",
"y",
",",
"time",
".",
"January",
",",
"1",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"now",
".",
"<mask>",
"(",
")",
")",
"\n",
"}"
]
|
12,356 | all-12357 | [
"GetEventOk",
"returns",
"a",
"tuple",
"with",
"the",
"Event",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"r",
"*",
"reqGetEvent",
")",
"GetEventOk",
"(",
")",
"(",
"Event",
",",
"bool",
")",
"{",
"if",
"r",
"==",
"nil",
"||",
"r",
".",
"Event",
"==",
"nil",
"{",
"return",
"Event",
"{",
"}",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"r",
".",
"<mask>",
",",
"true",
"\n",
"}"
]
|
12,357 | all-12358 | [
"ClientEndpointCreate",
"decodes",
"endpoint",
"message",
"saves",
"it",
"in",
"the",
"DB",
"and",
"triggers",
"product",
"configuration",
"."
]
| [
"func",
"(",
"w",
"*",
"Worker",
")",
"ClientEndpointCreate",
"(",
"job",
"*",
"data",
".",
"Job",
")",
"error",
"{",
"logger",
":=",
"w",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"job",
")",
"\n\n",
"ch",
",",
"err",
":=",
"w",
".",
"relatedChannel",
"(",
"logger",
",",
"job",
",",
"data",
".",
"JobClientEndpointRestore",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"var",
"jdata",
"data",
".",
"JobEndpointCreateData",
"\n",
"if",
"err",
":=",
"w",
".",
"unmarshalDataTo",
"(",
"logger",
",",
"job",
".",
"Data",
",",
"&",
"jdata",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"msg",
",",
"err",
":=",
"w",
".",
"extractEndpointMessage",
"(",
"logger",
",",
"ch",
",",
"jdata",
".",
"EndpointSealed",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"offer",
",",
"err",
":=",
"w",
".",
"offering",
"(",
"logger",
",",
"ch",
".",
"Offering",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"<mask>",
":=",
"strings",
".",
"Replace",
"(",
"w",
".",
"countryConfig",
".",
"URLTemplate",
",",
"\"",
"\"",
",",
"msg",
".",
"ServiceEndpointAddress",
",",
"1",
")",
"\n\n",
"var",
"countryStatus",
"string",
"\n\n",
"c",
",",
"err",
":=",
"country",
".",
"GetCountry",
"(",
"w",
".",
"countryConfig",
".",
"Timeout",
",",
"url",
",",
"w",
".",
"countryConfig",
".",
"Field",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"len",
"(",
"c",
")",
"!=",
"2",
"{",
"countryStatus",
"=",
"data",
".",
"CountryStatusUnknown",
"\n",
"}",
"else",
"if",
"c",
"==",
"offer",
".",
"Country",
"{",
"countryStatus",
"=",
"data",
".",
"CountryStatusValid",
"\n",
"}",
"else",
"{",
"countryStatus",
"=",
"data",
".",
"CountryStatusInvalid",
"\n",
"}",
"\n\n",
"params",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"msg",
".",
"AdditionalParams",
")",
"\n\n",
"return",
"w",
".",
"db",
".",
"InTransaction",
"(",
"func",
"(",
"tx",
"*",
"reform",
".",
"TX",
")",
"error",
"{",
"raddr",
":=",
"pointer",
".",
"ToString",
"(",
"msg",
".",
"PaymentReceiverAddress",
")",
"\n",
"saddr",
":=",
"pointer",
".",
"ToString",
"(",
"msg",
".",
"ServiceEndpointAddress",
")",
"\n",
"endp",
":=",
"data",
".",
"Endpoint",
"{",
"ID",
":",
"util",
".",
"NewUUID",
"(",
")",
",",
"Template",
":",
"offer",
".",
"Template",
",",
"Channel",
":",
"ch",
".",
"ID",
",",
"Hash",
":",
"msg",
".",
"TemplateHash",
",",
"RawMsg",
":",
"data",
".",
"FromBytes",
"(",
"jdata",
".",
"EndpointSealed",
")",
",",
"PaymentReceiverAddress",
":",
"raddr",
",",
"ServiceEndpointAddress",
":",
"saddr",
",",
"Username",
":",
"pointer",
".",
"ToString",
"(",
"msg",
".",
"Username",
")",
",",
"Password",
":",
"pointer",
".",
"ToString",
"(",
"msg",
".",
"Password",
")",
",",
"AdditionalParams",
":",
"params",
",",
"CountryStatus",
":",
"pointer",
".",
"ToString",
"(",
"countryStatus",
")",
",",
"}",
"\n",
"if",
"err",
"=",
"w",
".",
"db",
".",
"Insert",
"(",
"&",
"endp",
")",
";",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"endp",
")",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"ErrInternal",
"\n",
"}",
"\n\n",
"ch",
".",
"ServiceStatus",
"=",
"data",
".",
"ServiceSuspended",
"\n",
"changedTime",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"ch",
".",
"ServiceChangedTime",
"=",
"&",
"changedTime",
"\n",
"// TODO: Review flow with service_changed_time.",
"ch",
".",
"PreparedAt",
"=",
"changedTime",
"\n",
"err",
"=",
"w",
".",
"saveRecord",
"(",
"logger",
",",
"w",
".",
"db",
".",
"Querier",
",",
"ch",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"ErrInternal",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
]
|
12,358 | all-12359 | [
"systemd",
"does",
"not",
"atm",
"set",
"up",
"the",
"cpuset",
"controller",
"so",
"we",
"must",
"manually",
"join",
"it",
".",
"Additionally",
"that",
"is",
"a",
"very",
"finicky",
"controller",
"where",
"each",
"level",
"must",
"have",
"a",
"full",
"setup",
"as",
"the",
"default",
"for",
"a",
"new",
"directory",
"is",
"no",
"cpus"
]
| [
"func",
"joinCpuset",
"(",
"c",
"*",
"configs",
".",
"Cgroup",
",",
"pid",
"int",
")",
"error",
"{",
"path",
",",
"err",
":=",
"getSubsystemPath",
"(",
"c",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"!",
"cgroups",
".",
"IsNotFound",
"(",
"err",
")",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"s",
":=",
"&",
"<mask>",
".",
"CpusetGroup",
"{",
"}",
"\n\n",
"return",
"s",
".",
"ApplyDir",
"(",
"path",
",",
"c",
",",
"pid",
")",
"\n",
"}"
]
|
12,359 | all-12360 | [
"IsDir",
"tests",
"the",
"existence",
"of",
"a",
"directory",
"in",
"the",
"guest",
"operating",
"system",
".",
"Parameters",
":",
"path",
":",
"Directory",
"path",
"in",
"the",
"guest",
"OS",
"to",
"be",
"checked",
".",
"Remarks",
":",
"*",
"Only",
"absolute",
"paths",
"should",
"be",
"used",
"for",
"files",
"in",
"the",
"guest",
";",
"the",
"resolution",
"of",
"relative",
"paths",
"is",
"not",
"specified",
".",
"Since",
"VMware",
"Workstation",
"6",
".",
"0",
"Minimum",
"Supported",
"Guest",
"OS",
":",
"Microsoft",
"Windows",
"NT",
"Series",
"Linux"
]
| [
"func",
"(",
"g",
"*",
"Guest",
")",
"IsDir",
"(",
"path",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"var",
"jobHandle",
"C",
".",
"VixHandle",
"=",
"C",
".",
"VIX_INVALID_HANDLE",
"\n",
"var",
"err",
"C",
".",
"VixError",
"=",
"C",
".",
"VIX_OK",
"\n",
"var",
"result",
"C",
".",
"int",
"\n\n",
"cpath",
":=",
"C",
".",
"CString",
"(",
"path",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cpath",
")",
")",
"\n\n",
"jobHandle",
"=",
"C",
".",
"VixVM_DirectoryExistsInGuest",
"(",
"g",
".",
"handle",
",",
"cpath",
",",
"// dir path name",
"nil",
",",
"// callbackProc",
"nil",
")",
"// clientData",
"\n\n",
"defer",
"C",
".",
"Vix_ReleaseHandle",
"(",
"jobHandle",
")",
"\n\n",
"err",
"=",
"C",
".",
"is_file_or_dir",
"(",
"jobHandle",
",",
"&",
"result",
")",
"\n",
"if",
"C",
".",
"VIX_OK",
"!=",
"err",
"{",
"return",
"false",
",",
"&",
"Error",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"int",
"(",
"err",
"&",
"0xFFFF",
")",
",",
"Text",
":",
"C",
".",
"GoString",
"(",
"C",
".",
"Vix_GetErrorText",
"(",
"err",
",",
"nil",
")",
")",
",",
"}",
"\n",
"}",
"\n\n",
"if",
"int",
"(",
"result",
")",
"==",
"C",
".",
"FALSE",
"{",
"return",
"<mask>",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"true",
",",
"nil",
"\n",
"}"
]
|
12,360 | all-12361 | [
"MonoDownmix",
"converts",
"the",
"buffer",
"to",
"a",
"mono",
"buffer",
"by",
"downmixing",
"the",
"channels",
"together",
"."
]
| [
"func",
"MonoDownmix",
"(",
"buf",
"*",
"audio",
".",
"FloatBuffer",
")",
"error",
"{",
"if",
"buf",
"==",
"nil",
"||",
"buf",
".",
"Format",
"==",
"nil",
"{",
"return",
"audio",
".",
"ErrInvalidBuffer",
"\n",
"}",
"\n",
"nChans",
":=",
"buf",
".",
"Format",
".",
"NumChannels",
"\n",
"if",
"nChans",
"<",
"2",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"nChansF",
":=",
"float64",
"(",
"nChans",
")",
"\n\n",
"frameCount",
":=",
"buf",
".",
"NumFrames",
"(",
")",
"\n",
"newData",
":=",
"<mask>",
"(",
"[",
"]",
"float64",
",",
"frameCount",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"frameCount",
";",
"i",
"++",
"{",
"newData",
"[",
"i",
"]",
"=",
"0",
"\n",
"for",
"j",
":=",
"0",
";",
"j",
"<",
"nChans",
";",
"j",
"++",
"{",
"newData",
"[",
"i",
"]",
"+=",
"buf",
".",
"Data",
"[",
"i",
"*",
"nChans",
"+",
"j",
"]",
"\n",
"}",
"\n",
"newData",
"[",
"i",
"]",
"/=",
"nChansF",
"\n",
"}",
"\n",
"buf",
".",
"Data",
"=",
"newData",
"\n",
"buf",
".",
"Format",
".",
"NumChannels",
"=",
"1",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
12,361 | all-12362 | [
"NextWindow",
"switches",
"to",
"the",
"next",
"available",
"window",
"."
]
| [
"func",
"(",
"p",
"*",
"Page",
")",
"NextWindow",
"(",
")",
"error",
"{",
"windows",
",",
"err",
":=",
"p",
".",
"session",
".",
"GetWindows",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"var",
"windowIDs",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"window",
":=",
"range",
"windows",
"{",
"windowIDs",
"=",
"append",
"(",
"windowIDs",
",",
"window",
".",
"ID",
")",
"\n",
"}",
"\n\n",
"// order not defined according to W3 spec",
"sort",
".",
"Strings",
"(",
"windowIDs",
")",
"\n\n",
"activeWindow",
",",
"err",
":=",
"p",
".",
"session",
".",
"GetWindow",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"for",
"<mask>",
",",
"windowID",
":=",
"range",
"windowIDs",
"{",
"if",
"windowID",
"==",
"activeWindow",
".",
"ID",
"{",
"activeWindow",
".",
"ID",
"=",
"windowIDs",
"[",
"(",
"position",
"+",
"1",
")",
"%",
"len",
"(",
"windowIDs",
")",
"]",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"p",
".",
"session",
".",
"SetWindow",
"(",
"activeWindow",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
12,362 | all-12363 | [
"captureStack",
"returns",
"a",
"slice",
"of",
"stack",
"frames",
"representing",
"the",
"stack",
"of",
"the",
"calling",
"go",
"routine",
"."
]
| [
"func",
"captureStack",
"(",
"skip",
",",
"maxDepth",
"int",
")",
"[",
"]",
"*",
"stackFrame",
"{",
"pcs",
":=",
"make",
"(",
"[",
"]",
"uintptr",
",",
"maxDepth",
")",
"\n",
"count",
":=",
"runtime",
".",
"Callers",
"(",
"skip",
"+",
"1",
",",
"pcs",
")",
"\n\n",
"frames",
":=",
"make",
"(",
"[",
"]",
"*",
"stackFrame",
",",
"count",
")",
"\n",
"for",
"i",
",",
"pc",
":=",
"<mask>",
"pcs",
"[",
"0",
":",
"count",
"]",
"{",
"frames",
"[",
"i",
"]",
"=",
"newStackFrame",
"(",
"pc",
")",
"\n",
"}",
"\n\n",
"return",
"frames",
"\n",
"}"
]
|
12,363 | all-12364 | [
"ReadResponse",
"reads",
"a",
"server",
"response",
"into",
"the",
"received",
"o",
"."
]
| [
"func",
"(",
"o",
"*",
"PostAppsReader",
")",
"ReadResponse",
"(",
"response",
"runtime",
".",
"ClientResponse",
",",
"consumer",
"runtime",
".",
"Consumer",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"switch",
"response",
".",
"Code",
"(",
")",
"{",
"case",
"200",
":",
"result",
":=",
"NewPostAppsOK",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n\n",
"case",
"400",
":",
"result",
":=",
"NewPostAppsBadRequest",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n\n",
"case",
"409",
":",
"result",
":=",
"NewPostAppsConflict",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n\n",
"<mask>",
":",
"result",
":=",
"NewPostAppsDefault",
"(",
"response",
".",
"Code",
"(",
")",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"response",
".",
"Code",
"(",
")",
"/",
"100",
"==",
"2",
"{",
"return",
"result",
",",
"nil",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n",
"}",
"\n",
"}"
]
|
12,364 | all-12365 | [
"validateNetworkFolder",
"checks",
"to",
"make",
"sure",
"the",
"folder",
"is",
"a",
"network",
"folder",
"and",
"returns",
"it",
"if",
"it",
"is",
"or",
"an",
"error",
"if",
"it",
"isn",
"t",
"."
]
| [
"func",
"validateNetworkFolder",
"(",
"folder",
"*",
"object",
".",
"Folder",
")",
"(",
"*",
"<mask>",
".",
"Folder",
",",
"error",
")",
"{",
"ft",
",",
"err",
":=",
"FindType",
"(",
"folder",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"ft",
"!=",
"VSphereFolderTypeNetwork",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"folder",
".",
"InventoryPath",
")",
"\n",
"}",
"\n",
"return",
"folder",
",",
"nil",
"\n",
"}"
]
|
12,365 | all-12366 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"SetProduceCompilationCacheParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage7",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
]
|
12,366 | all-12367 | [
"BranchRequirements",
"partitions",
"status",
"contexts",
"for",
"a",
"given",
"org",
"repo",
"branch",
"into",
"three",
"buckets",
":",
"-",
"contexts",
"that",
"are",
"always",
"required",
"to",
"be",
"present",
"-",
"contexts",
"that",
"are",
"required",
"_if_",
"present",
"-",
"contexts",
"that",
"are",
"always",
"optional"
]
| [
"func",
"BranchRequirements",
"(",
"org",
",",
"repo",
",",
"branch",
"string",
",",
"presubmits",
"map",
"[",
"string",
"]",
"[",
"]",
"Presubmit",
")",
"(",
"[",
"]",
"string",
",",
"[",
"]",
"string",
",",
"[",
"]",
"string",
")",
"{",
"jobs",
",",
"ok",
":=",
"presubmits",
"[",
"org",
"+",
"\"",
"\"",
"+",
"repo",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"var",
"required",
",",
"requiredIfPresent",
",",
"optional",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"j",
":=",
"range",
"jobs",
"{",
"if",
"!",
"j",
".",
"CouldRun",
"(",
"branch",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"if",
"j",
".",
"ContextRequired",
"(",
")",
"{",
"if",
"j",
".",
"TriggersConditionally",
"(",
")",
"{",
"// jobs that trigger conditionally cannot be",
"// required as their status may not exist on PRs",
"requiredIfPresent",
"=",
"append",
"(",
"requiredIfPresent",
",",
"j",
".",
"Context",
")",
"\n",
"}",
"else",
"{",
"// jobs that produce required contexts and will",
"// always run should be required at all times",
"required",
"=",
"append",
"(",
"required",
",",
"j",
".",
"Context",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"optional",
"=",
"append",
"(",
"optional",
",",
"j",
".",
"Context",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"required",
",",
"requiredIfPresent",
",",
"<mask>",
"\n",
"}"
]
|
12,367 | all-12368 | [
"getReleaseTag",
"gets",
"the",
"release",
"tag",
"of",
"Boot2Docker",
"from",
"apiURL",
"."
]
| [
"func",
"(",
"*",
"b2dReleaseGetter",
")",
"getReleaseTag",
"(",
"apiURL",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"apiURL",
"==",
"\"",
"\"",
"{",
"apiURL",
"=",
"defaultURL",
"\n",
"}",
"\n\n",
"if",
"!",
"version",
".",
"RC",
"(",
")",
"{",
"// Just go straight to the convenience URL for \"/latest\" if we",
"// are a non-release candidate version. \"/latest\" won't return",
"// non-RCs, so that's what we use for stable releases of",
"// Machine.",
"apiURL",
"=",
"apiURL",
"+",
"\"",
"\"",
"\n",
"}",
"\n\n",
"client",
":=",
"getClient",
"(",
")",
"\n",
"req",
",",
"err",
":=",
"getRequest",
"(",
"apiURL",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"rsp",
",",
"err",
":=",
"client",
".",
"Do",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"defer",
"rsp",
".",
"Body",
".",
"Close",
"(",
")",
"\n\n",
"// If we call the API endpoint",
"// \"/repos/boot2docker/boot2docker/releases\" without specifying",
"// \"/latest\", we will receive a list of releases instead of a single",
"// one, and we should decode accordingly.",
"if",
"version",
".",
"RC",
"(",
")",
"{",
"var",
"tags",
"[",
"]",
"struct",
"{",
"TagName",
"string",
"`json:\"tag_name\"`",
"\n",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"NewDecoder",
"(",
"rsp",
".",
"Body",
")",
".",
"Decode",
"(",
"&",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"t",
":=",
"tags",
"[",
"0",
"]",
"\n",
"if",
"t",
".",
"TagName",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"errGitHubAPIResponse",
"\n",
"}",
"\n",
"return",
"t",
".",
"TagName",
",",
"nil",
"\n",
"}",
"\n\n",
"// Otherwise, we get back just one release, which we can decode to get",
"// the tag.",
"var",
"t",
"struct",
"{",
"TagName",
"string",
"`json:\"tag_name\"`",
"\n",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"NewDecoder",
"(",
"rsp",
".",
"Body",
")",
".",
"Decode",
"(",
"&",
"t",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"if",
"t",
".",
"TagName",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"errGitHubAPIResponse",
"\n",
"}",
"\n",
"return",
"t",
".",
"TagName",
",",
"nil",
"\n",
"}"
]
|
12,368 | all-12369 | [
"ToPrivateKey",
"returns",
"decrypted",
"*",
"ecdsa",
".",
"PrivateKey",
"from",
"base64",
"of",
"encrypted",
"keystore",
".",
"Key",
"."
]
| [
"func",
"ToPrivateKey",
"(",
"keyB64",
"Base64String",
",",
"auth",
"string",
")",
"(",
"*",
"ecdsa",
".",
"PrivateKey",
",",
"error",
")",
"{",
"keyjson",
",",
"err",
":=",
"ToBytes",
"(",
"keyB64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"<mask>",
",",
"err",
":=",
"keystore",
".",
"DecryptKey",
"(",
"keyjson",
",",
"auth",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"key",
".",
"PrivateKey",
",",
"nil",
"\n",
"}"
]
|
12,369 | all-12370 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"GetCookiesParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork35",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
]
|
12,370 | all-12371 | [
"Insert",
"function",
"insert",
"a",
"RequestStats",
"into",
"the",
"queue",
"and",
"update",
"the",
"records"
]
| [
"func",
"(",
"q",
"*",
"statsQueue",
")",
"Insert",
"(",
"p",
"*",
"RequestStats",
")",
"{",
"q",
".",
"rwl",
".",
"Lock",
"(",
")",
"\n",
"defer",
"q",
".",
"rwl",
".",
"Unlock",
"(",
")",
"\n\n",
"q",
".",
"back",
"=",
"(",
"q",
".",
"back",
"+",
"1",
")",
"%",
"queueCapacity",
"\n\n",
"if",
"q",
".",
"size",
"==",
"queueCapacity",
"{",
"//dequeue",
"q",
".",
"totalReqSize",
"-=",
"q",
".",
"items",
"[",
"q",
".",
"front",
"]",
".",
"Size",
"\n",
"q",
".",
"front",
"=",
"(",
"q",
".",
"back",
"+",
"1",
")",
"%",
"queueCapacity",
"\n",
"}",
"else",
"{",
"q",
".",
"size",
"++",
"\n",
"}",
"\n\n",
"q",
".",
"items",
"[",
"q",
".",
"<mask>",
"]",
"=",
"p",
"\n",
"q",
".",
"totalReqSize",
"+=",
"q",
".",
"items",
"[",
"q",
".",
"back",
"]",
".",
"Size",
"\n\n",
"}"
]
|
12,371 | all-12372 | [
"Aggregate",
"merges",
"similar",
"goroutines",
"into",
"buckets",
".",
"The",
"buckets",
"are",
"ordered",
"in",
"library",
"provided",
"order",
"of",
"relevancy",
".",
"You",
"can",
"reorder",
"at",
"your",
"chosing",
"."
]
| [
"func",
"Aggregate",
"(",
"goroutines",
"[",
"]",
"*",
"Goroutine",
",",
"similar",
"Similarity",
")",
"[",
"]",
"*",
"Bucket",
"{",
"type",
"count",
"struct",
"{",
"ids",
"[",
"]",
"int",
"\n",
"first",
"bool",
"\n",
"}",
"\n",
"b",
":=",
"map",
"[",
"*",
"Signature",
"]",
"*",
"count",
"{",
"}",
"\n",
"// O(n²). Fix eventually.",
"for",
"_",
",",
"routine",
":=",
"range",
"goroutines",
"{",
"found",
":=",
"false",
"\n",
"for",
"key",
",",
"c",
":=",
"range",
"b",
"{",
"// When a match is found, this effectively drops the other goroutine ID.",
"if",
"key",
".",
"similar",
"(",
"&",
"routine",
".",
"Signature",
",",
"similar",
")",
"{",
"found",
"=",
"true",
"\n",
"c",
".",
"ids",
"=",
"append",
"(",
"c",
".",
"ids",
",",
"routine",
".",
"ID",
")",
"\n",
"c",
".",
"first",
"=",
"c",
".",
"first",
"||",
"routine",
".",
"First",
"\n",
"if",
"!",
"key",
".",
"equal",
"(",
"&",
"routine",
".",
"Signature",
")",
"{",
"// Almost but not quite equal. There's different pointers passed",
"// around but the same values. Zap out the different values.",
"newKey",
":=",
"key",
".",
"merge",
"(",
"&",
"routine",
".",
"Signature",
")",
"\n",
"b",
"[",
"newKey",
"]",
"=",
"c",
"\n",
"delete",
"(",
"b",
",",
"key",
")",
"\n",
"}",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"!",
"found",
"{",
"// Create a copy of the Signature, since it will be mutated.",
"key",
":=",
"&",
"Signature",
"{",
"}",
"\n",
"*",
"key",
"=",
"routine",
".",
"Signature",
"\n",
"b",
"[",
"<mask>",
"]",
"=",
"&",
"count",
"{",
"ids",
":",
"[",
"]",
"int",
"{",
"routine",
".",
"ID",
"}",
",",
"first",
":",
"routine",
".",
"First",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"out",
":=",
"make",
"(",
"buckets",
",",
"0",
",",
"len",
"(",
"b",
")",
")",
"\n",
"for",
"signature",
",",
"c",
":=",
"range",
"b",
"{",
"sort",
".",
"Ints",
"(",
"c",
".",
"ids",
")",
"\n",
"out",
"=",
"append",
"(",
"out",
",",
"&",
"Bucket",
"{",
"Signature",
":",
"*",
"signature",
",",
"IDs",
":",
"c",
".",
"ids",
",",
"First",
":",
"c",
".",
"first",
"}",
")",
"\n",
"}",
"\n",
"sort",
".",
"Sort",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
]
|
12,372 | all-12373 | [
"Set",
"the",
"secret",
"associated",
"with",
"some",
"key",
".",
"If",
"the",
"secret",
"already",
"exists",
"it",
"is",
"updated",
"instead",
".",
"Required",
"scopes",
":",
"secrets",
":",
"set",
":",
"<name",
">",
"See",
"#set"
]
| [
"func",
"(",
"secrets",
"*",
"Secrets",
")",
"Set",
"(",
"name",
"string",
",",
"payload",
"*",
"Secret",
")",
"error",
"{",
"cd",
":=",
"tcclient",
".",
"<mask>",
"(",
"*",
"secrets",
")",
"\n",
"_",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"payload",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"name",
")",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
]
|
12,373 | all-12374 | [
"Safe",
"returns",
"the",
"current",
"safety",
"mode",
"for",
"the",
"session",
"."
]
| [
"func",
"(",
"s",
"*",
"Session",
")",
"Safe",
"(",
")",
"(",
"safe",
"*",
"Safe",
")",
"{",
"s",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"if",
"s",
".",
"safeOp",
"!=",
"nil",
"{",
"cmd",
":=",
"s",
".",
"safeOp",
".",
"<mask>",
".",
"(",
"*",
"getLastError",
")",
"\n",
"safe",
"=",
"&",
"Safe",
"{",
"WTimeout",
":",
"cmd",
".",
"WTimeout",
",",
"FSync",
":",
"cmd",
".",
"FSync",
",",
"J",
":",
"cmd",
".",
"J",
"}",
"\n",
"switch",
"w",
":=",
"cmd",
".",
"W",
".",
"(",
"type",
")",
"{",
"case",
"string",
":",
"safe",
".",
"WMode",
"=",
"w",
"\n",
"case",
"int",
":",
"safe",
".",
"W",
"=",
"w",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
]
|
12,374 | all-12375 | [
"Returns",
"the",
"CSS",
"escaped",
"label",
"name",
".",
"Escaped",
"method",
"based",
"on",
"https",
":",
"//",
"www",
".",
"w3",
".",
"org",
"/",
"International",
"/",
"questions",
"/",
"qa",
"-",
"escapes#cssescapes"
]
| [
"func",
"cssEscape",
"(",
"s",
"string",
")",
"(",
"escaped",
"string",
")",
"{",
"var",
"IsAlpha",
"=",
"regexp",
".",
"MustCompile",
"(",
"`^[a-zA-Z]+$`",
")",
".",
"MatchString",
"\n",
"for",
"i",
",",
"c",
":=",
"range",
"s",
"{",
"if",
"(",
"i",
"==",
"0",
"&&",
"unicode",
".",
"IsDigit",
"(",
"c",
")",
")",
"||",
"!",
"(",
"unicode",
".",
"IsDigit",
"(",
"c",
")",
"||",
"IsAlpha",
"(",
"string",
"(",
"c",
")",
")",
")",
"{",
"escaped",
"+=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
")",
"\n",
"<mask>",
"\n",
"}",
"\n",
"escaped",
"+=",
"string",
"(",
"c",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
]
|
12,375 | all-12376 | [
"Project",
"returns",
"a",
"derivative",
"query",
"that",
"yields",
"only",
"the",
"given",
"fields",
".",
"It",
"cannot",
"be",
"used",
"with",
"KeysOnly",
"."
]
| [
"func",
"(",
"q",
"*",
"<mask>",
")",
"Project",
"(",
"fieldNames",
"...",
"string",
")",
"*",
"Query",
"{",
"q",
"=",
"q",
".",
"clone",
"(",
")",
"\n",
"q",
".",
"projection",
"=",
"append",
"(",
"[",
"]",
"string",
"(",
"nil",
")",
",",
"fieldNames",
"...",
")",
"\n",
"return",
"q",
"\n",
"}"
]
|
12,376 | all-12377 | [
"AggregateIssueChan",
"reads",
"issues",
"from",
"a",
"channel",
"aggregates",
"issues",
"which",
"have",
"the",
"same",
"file",
"line",
"vol",
"and",
"message",
"and",
"returns",
"aggregated",
"issues",
"on",
"a",
"new",
"channel",
"."
]
| [
"func",
"AggregateIssueChan",
"(",
"issues",
"chan",
"*",
"Issue",
")",
"chan",
"*",
"Issue",
"{",
"out",
":=",
"make",
"(",
"chan",
"*",
"Issue",
",",
"1000000",
")",
"\n",
"issueMap",
":=",
"make",
"(",
"map",
"[",
"issueKey",
"]",
"*",
"multiIssue",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"for",
"issue",
":=",
"range",
"issues",
"{",
"key",
":=",
"issueKey",
"{",
"path",
":",
"issue",
".",
"Path",
".",
"String",
"(",
")",
",",
"line",
":",
"issue",
".",
"Line",
",",
"col",
":",
"issue",
".",
"Col",
",",
"message",
":",
"issue",
".",
"Message",
",",
"}",
"\n",
"if",
"existing",
",",
"ok",
":=",
"issueMap",
"[",
"<mask>",
"]",
";",
"ok",
"{",
"existing",
".",
"linterNames",
"=",
"append",
"(",
"existing",
".",
"linterNames",
",",
"issue",
".",
"Linter",
")",
"\n",
"}",
"else",
"{",
"issueMap",
"[",
"key",
"]",
"=",
"&",
"multiIssue",
"{",
"Issue",
":",
"issue",
",",
"linterNames",
":",
"[",
"]",
"string",
"{",
"issue",
".",
"Linter",
"}",
",",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"multi",
":=",
"range",
"issueMap",
"{",
"issue",
":=",
"multi",
".",
"Issue",
"\n",
"sort",
".",
"Strings",
"(",
"multi",
".",
"linterNames",
")",
"\n",
"issue",
".",
"Linter",
"=",
"strings",
".",
"Join",
"(",
"multi",
".",
"linterNames",
",",
"\"",
"\"",
")",
"\n",
"out",
"<-",
"issue",
"\n",
"}",
"\n",
"close",
"(",
"out",
")",
"\n",
"}",
"(",
")",
"\n",
"return",
"out",
"\n",
"}"
]
|
12,377 | all-12378 | [
"ScheduleAndPropagateHostDowntime",
"creates",
"a",
"new",
"SCHEDULE_AND_PROPAGATE_HOST_DOWNTIME",
"Nagios",
"command",
".",
"Schedules",
"downtime",
"for",
"a",
"specified",
"host",
"and",
"all",
"of",
"its",
"children",
"(",
"hosts",
")",
".",
"If",
"the",
"fixed",
"argument",
"is",
"set",
"to",
"one",
"(",
"1",
")",
"downtime",
"will",
"start",
"and",
"end",
"at",
"the",
"times",
"specified",
"by",
"the",
"start",
"and",
"end",
"arguments",
".",
"Otherwise",
"downtime",
"will",
"begin",
"between",
"the",
"start",
"and",
"end",
"times",
"and",
"last",
"for",
"duration",
"seconds",
".",
"The",
"start",
"and",
"end",
"arguments",
"are",
"specified",
"in",
"time_t",
"format",
"(",
"seconds",
"since",
"the",
"UNIX",
"epoch",
")",
".",
"The",
"specified",
"(",
"parent",
")",
"host",
"downtime",
"can",
"be",
"triggered",
"by",
"another",
"downtime",
"entry",
"if",
"the",
"trigger_id",
"is",
"set",
"to",
"the",
"ID",
"of",
"another",
"scheduled",
"downtime",
"entry",
".",
"Set",
"the",
"trigger_id",
"argument",
"to",
"zero",
"(",
"0",
")",
"if",
"the",
"downtime",
"for",
"the",
"specified",
"(",
"parent",
")",
"host",
"should",
"not",
"be",
"triggered",
"by",
"another",
"downtime",
"entry",
"."
]
| [
"func",
"ScheduleAndPropagateHostDowntime",
"(",
"host_name",
"string",
",",
"start_time",
"time",
".",
"Time",
",",
"end_time",
"time",
".",
"Time",
",",
"fixed",
"bool",
",",
"trigger_id",
"int",
",",
"duration",
"time",
".",
"Duration",
",",
"author",
"string",
",",
"<mask>",
"string",
",",
")",
"*",
"livestatus",
".",
"Command",
"{",
"return",
"livestatus",
".",
"NewCommand",
"(",
"\"",
"\"",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"host_name",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"start_time",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"end_time",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fixed",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"trigger_id",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"duration",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"author",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"comment",
")",
",",
")",
"\n",
"}"
]
|
12,378 | all-12379 | [
"MarshalJSON",
"returns",
"the",
"DateTime",
"as",
"JSON"
]
| [
"func",
"(",
"t",
"DateTime",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"<mask>",
"w",
"jwriter",
".",
"Writer",
"\n",
"t",
".",
"MarshalEasyJSON",
"(",
"&",
"w",
")",
"\n",
"return",
"w",
".",
"BuildBytes",
"(",
")",
"\n",
"}"
]
|
12,379 | all-12380 | [
"/",
"*",
"Float",
"looks",
"for",
"the",
"specified",
"key",
"and",
"returns",
"it",
"as",
"a",
"float",
".",
"If",
"not",
"found",
"the",
"default",
"value",
"def",
"is",
"returned",
"."
]
| [
"func",
"(",
"config",
"*",
"Config",
")",
"Float",
"(",
"key",
"string",
",",
"def",
"float64",
")",
"float64",
"{",
"return",
"getFloat",
"(",
"config",
".",
"<mask>",
",",
"key",
",",
"def",
")",
"\n",
"}"
]
|
12,380 | all-12381 | [
"Unmarshal",
"reads",
"an",
"xdr",
"element",
"from",
"r",
"into",
"v",
"."
]
| [
"func",
"Unmarshal",
"(",
"r",
"io",
".",
"Reader",
",",
"v",
"<mask>",
"{",
"}",
")",
"(",
"int",
",",
"error",
")",
"{",
"// delegate to xdr package's Unmarshal",
"return",
"xdr",
".",
"Unmarshal",
"(",
"r",
",",
"v",
")",
"\n",
"}"
]
|
12,381 | all-12382 | [
"Log",
"prefixes",
"to",
"message",
"before",
"writing",
"to",
"Writer",
"."
]
| [
"func",
"(",
"ui",
"*",
"BasicUI",
")",
"Log",
"(",
"message",
"string",
")",
"{",
"timeString",
":=",
"time",
".",
"Now",
"(",
")",
".",
"Format",
"(",
"timeFormat",
")",
"\n",
"<mask>",
"=",
"timeString",
"+",
"\"",
"\"",
"+",
"message",
"\n",
"ui",
".",
"Output",
"(",
"message",
")",
"\n",
"}"
]
|
12,382 | all-12383 | [
"Validate",
"validates",
"Kubernetes",
"client",
"options",
"."
]
| [
"func",
"(",
"o",
"*",
"KubernetesClientOptions",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"o",
".",
"kubeConfig",
"!=",
"\"",
"\"",
"{",
"if",
"_",
",",
"err",
":=",
"<mask>",
".",
"Stat",
"(",
"o",
".",
"kubeConfig",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
12,383 | all-12384 | [
"SetPattern",
"is",
"a",
"wrapper",
"around",
"gtk_label_set_pattern",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Label",
")",
"SetPattern",
"(",
"patern",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"patern",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_label_set_pattern",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
]
|
12,384 | all-12385 | [
"Change",
"the",
"file",
"mode",
"and",
"ownership",
"of",
"the",
"local",
"endpoint",
"unix",
"socket",
"file",
"so",
"access",
"is",
"granted",
"only",
"to",
"the",
"process",
"user",
"and",
"to",
"the",
"given",
"group",
"(",
"or",
"the",
"process",
"group",
"if",
"group",
"is",
"empty",
")",
"."
]
| [
"func",
"localSetAccess",
"(",
"path",
"string",
",",
"group",
"string",
")",
"error",
"{",
"err",
":=",
"socketUnixSetPermissions",
"(",
"<mask>",
",",
"0660",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"socketUnixSetOwnership",
"(",
"path",
",",
"group",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
12,385 | all-12386 | [
"Performs",
"the",
"subscription",
"part",
"of",
"the",
"mainLoop",
"()"
]
| [
"func",
"(",
"c",
"*",
"Consumer",
")",
"subscribe",
"(",
"tomb",
"*",
"loopTomb",
",",
"subs",
"map",
"[",
"string",
"]",
"[",
"]",
"int32",
")",
"error",
"{",
"// fetch offsets",
"offsets",
",",
"err",
":=",
"c",
".",
"fetchOffsets",
"(",
"subs",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"_",
"=",
"c",
".",
"leaveGroup",
"(",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"// create consumers in parallel",
"var",
"mu",
"sync",
".",
"Mutex",
"\n",
"var",
"wg",
"sync",
".",
"WaitGroup",
"\n\n",
"for",
"topic",
",",
"partitions",
":=",
"range",
"subs",
"{",
"for",
"_",
",",
"partition",
":=",
"range",
"partitions",
"{",
"wg",
".",
"Add",
"(",
"1",
")",
"\n\n",
"info",
":=",
"offsets",
"[",
"topic",
"]",
"[",
"partition",
"]",
"\n",
"<mask>",
"func",
"(",
"topic",
"string",
",",
"partition",
"int32",
")",
"{",
"if",
"e",
":=",
"c",
".",
"createConsumer",
"(",
"tomb",
",",
"topic",
",",
"partition",
",",
"info",
")",
";",
"e",
"!=",
"nil",
"{",
"mu",
".",
"Lock",
"(",
")",
"\n",
"err",
"=",
"e",
"\n",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"}",
"\n",
"wg",
".",
"Done",
"(",
")",
"\n",
"}",
"(",
"topic",
",",
"partition",
")",
"\n",
"}",
"\n",
"}",
"\n",
"wg",
".",
"Wait",
"(",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"_",
"=",
"c",
".",
"release",
"(",
")",
"\n",
"_",
"=",
"c",
".",
"leaveGroup",
"(",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
]
|
12,386 | all-12387 | [
"ParseReader",
"gets",
"the",
"template",
"content",
"from",
"an",
"io",
".",
"Reader",
"type"
]
| [
"func",
"(",
"p",
"*",
"Kolonish",
")",
"ParseReader",
"(",
"name",
"string",
",",
"rdr",
"<mask>",
".",
"Reader",
")",
"(",
"*",
"parser",
".",
"AST",
",",
"error",
")",
"{",
"b",
":=",
"parser",
".",
"NewBuilder",
"(",
")",
"\n",
"lex",
":=",
"NewReaderLexer",
"(",
"rdr",
")",
"\n",
"return",
"b",
".",
"Parse",
"(",
"name",
",",
"lex",
")",
"\n",
"}"
]
|
12,387 | all-12388 | [
"expandClusterInfraUpdateHaConfigInfo",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"ClusterInfraUpdateHaConfigInfo",
"."
]
| [
"func",
"expandClusterInfraUpdateHaConfigInfo",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"*",
"types",
".",
"ClusterInfraUpdateHaConfigInfo",
"{",
"obj",
":=",
"&",
"<mask>",
".",
"ClusterInfraUpdateHaConfigInfo",
"{",
"Behavior",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"Enabled",
":",
"structure",
".",
"GetBool",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"ModerateRemediation",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"Providers",
":",
"structure",
".",
"SliceInterfacesToStrings",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"*",
"schema",
".",
"Set",
")",
".",
"List",
"(",
")",
")",
",",
"SevereRemediation",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"}",
"\n\n",
"return",
"obj",
"\n",
"}"
]
|
12,388 | all-12389 | [
"GetName",
"safely",
"returns",
"the",
"name",
"of",
"the",
"resource"
]
| [
"func",
"(",
"cgroup",
"*",
"CgroupResource",
")",
"GetName",
"(",
")",
"string",
"{",
"cgroup",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"cgroup",
".",
"<mask>",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"resourceName",
"\n",
"}"
]
|
12,389 | all-12390 | [
"Response",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_dialog_response",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Dialog",
")",
"<mask>",
"(",
"response",
"ResponseType",
")",
"{",
"C",
".",
"gtk_dialog_response",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"response",
")",
")",
"\n",
"}"
]
|
12,390 | all-12391 | [
"NewCounter",
"returns",
"a",
"new",
"rate",
"counter",
"with",
"the",
"given",
"bucket",
"size",
"and",
"retention"
]
| [
"func",
"NewCounter",
"(",
"bucketSize",
",",
"retention",
"time",
".",
"Duration",
")",
"Counter",
"{",
"return",
"&",
"counter",
"{",
"bucketSize",
":",
"bucketSize",
",",
"retention",
":",
"retention",
",",
"buckets",
":",
"<mask>",
"(",
"[",
"]",
"uint64",
",",
"2",
"*",
"retention",
"/",
"bucketSize",
")",
",",
"}",
"\n",
"}"
]
|
12,391 | all-12392 | [
"Notify",
"is",
"like",
"Call",
"but",
"it",
"returns",
"when",
"the",
"notification",
"request",
"is",
"sent",
"(",
"without",
"waiting",
"for",
"a",
"response",
"because",
"JSON",
"-",
"RPC",
"notifications",
"do",
"not",
"have",
"responses",
")",
"."
]
| [
"func",
"(",
"c",
"*",
"Conn",
")",
"Notify",
"(",
"ctx",
"context",
".",
"Context",
",",
"method",
"string",
",",
"params",
"interface",
"{",
"}",
",",
"opts",
"...",
"CallOption",
")",
"error",
"{",
"req",
":=",
"&",
"<mask>",
"{",
"Method",
":",
"method",
",",
"Notif",
":",
"true",
"}",
"\n",
"if",
"err",
":=",
"req",
".",
"SetParams",
"(",
"params",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"opt",
":=",
"range",
"opts",
"{",
"if",
"opt",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"err",
":=",
"opt",
".",
"apply",
"(",
"req",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"send",
"(",
"ctx",
",",
"&",
"anyMessage",
"{",
"request",
":",
"req",
"}",
",",
"false",
")",
"\n",
"return",
"err",
"\n",
"}"
]
|
12,392 | all-12393 | [
"DefaultConfig",
"-",
"Nitro",
"configuration"
]
| [
"func",
"DefaultConfig",
"(",
")",
"Config",
"{",
"<mask>",
"cfg",
"Config",
"\n",
"cfg",
".",
"SetKeyComparator",
"(",
"defaultKeyCmp",
")",
"\n",
"cfg",
".",
"fileType",
"=",
"RawdbFile",
"\n",
"cfg",
".",
"useMemoryMgmt",
"=",
"false",
"\n",
"cfg",
".",
"refreshRate",
"=",
"defaultRefreshRate",
"\n",
"return",
"cfg",
"\n",
"}"
]
|
12,393 | all-12394 | [
"Ghosts",
"returns",
"nodes",
"that",
"were",
"referenced",
"as",
"parents",
"but",
"never",
"created",
"."
]
| [
"func",
"(",
"d",
"*",
"DAG",
")",
"Ghosts",
"(",
")",
"[",
"]",
"string",
"{",
"var",
"result",
"[",
"]",
"string",
"\n",
"for",
"id",
":=",
"range",
"d",
".",
"children",
"{",
"if",
"_",
",",
"ok",
":=",
"d",
".",
"<mask>",
"[",
"id",
"]",
";",
"!",
"ok",
"{",
"result",
"=",
"append",
"(",
"result",
",",
"id",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"result",
"\n",
"}"
]
|
12,394 | all-12395 | [
"RemoveSharedFolder",
"removes",
"a",
"shared",
"folder",
"in",
"the",
"virtual",
"machine",
".",
"Parameters",
":",
"guestpath",
":",
"Specifies",
"the",
"guest",
"pathname",
"of",
"the",
"shared",
"folder",
"to",
"delete",
".",
"Remarks",
":",
"*",
"This",
"function",
"removes",
"a",
"shared",
"folder",
"in",
"the",
"virtual",
"machine",
"referenced",
"by",
"the",
"VM",
"object",
"*",
"It",
"is",
"not",
"necessary",
"to",
"call",
"VM",
".",
"LoginInGuest",
"()",
"before",
"calling",
"this",
"function",
".",
"*",
"Shared",
"folders",
"are",
"not",
"supported",
"for",
"the",
"following",
"guest",
"operating",
"systems",
":",
"Windows",
"ME",
"Windows",
"98",
"Windows",
"95",
"Windows",
"3",
".",
"x",
"and",
"DOS",
".",
"*",
"In",
"this",
"release",
"this",
"function",
"requires",
"the",
"virtual",
"machine",
"to",
"be",
"powered",
"on",
"with",
"VMware",
"Tools",
"installed",
".",
"*",
"Depending",
"on",
"the",
"behavior",
"of",
"the",
"guest",
"operating",
"system",
"when",
"removing",
"shared",
"folders",
"there",
"might",
"be",
"a",
"delay",
"before",
"the",
"shared",
"folder",
"is",
"no",
"longer",
"visible",
"to",
"programs",
"running",
"within",
"the",
"guest",
"operating",
"system",
"and",
"to",
"functions",
"such",
"as",
"Guest",
".",
"IsFile",
"()",
"Since",
"VMware",
"Workstation",
"6",
".",
"0"
]
| [
"func",
"(",
"v",
"*",
"VM",
")",
"RemoveSharedFolder",
"(",
"guestpath",
"string",
")",
"error",
"{",
"var",
"jobHandle",
"C",
".",
"VixHandle",
"=",
"C",
".",
"VIX_INVALID_HANDLE",
"\n",
"var",
"err",
"C",
".",
"VixError",
"=",
"C",
".",
"VIX_OK",
"\n\n",
"gpath",
":=",
"C",
".",
"CString",
"(",
"guestpath",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"gpath",
")",
")",
"\n\n",
"jobHandle",
"=",
"C",
".",
"VixVM_RemoveSharedFolder",
"(",
"v",
".",
"<mask>",
",",
"gpath",
",",
"0",
",",
"nil",
",",
"nil",
")",
"\n\n",
"defer",
"C",
".",
"Vix_ReleaseHandle",
"(",
"jobHandle",
")",
"\n\n",
"err",
"=",
"C",
".",
"vix_job_wait",
"(",
"jobHandle",
")",
"\n",
"if",
"C",
".",
"VIX_OK",
"!=",
"err",
"{",
"return",
"&",
"Error",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"int",
"(",
"err",
"&",
"0xFFFF",
")",
",",
"Text",
":",
"C",
".",
"GoString",
"(",
"C",
".",
"Vix_GetErrorText",
"(",
"err",
",",
"nil",
")",
")",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
12,395 | all-12396 | [
"UpdateConfig",
"updates",
"the",
"given",
"LXD",
"node",
"-",
"level",
"configuration",
"keys",
"in",
"the",
"config",
"table",
".",
"Config",
"keys",
"set",
"to",
"empty",
"values",
"will",
"be",
"deleted",
"."
]
| [
"func",
"(",
"n",
"*",
"NodeTx",
")",
"UpdateConfig",
"(",
"<mask>",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"return",
"query",
".",
"UpdateConfig",
"(",
"n",
".",
"tx",
",",
"\"",
"\"",
",",
"values",
")",
"\n",
"}"
]
|
12,396 | all-12397 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object"
]
| [
"func",
"Uniform2iv",
"(",
"location",
"int32",
",",
"count",
"int32",
",",
"value",
"*",
"int32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpUniform2iv",
",",
"3",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
]
|
12,397 | all-12398 | [
"HasViz",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"g",
"*",
"GraphDefinition",
")",
"HasViz",
"(",
")",
"bool",
"{",
"if",
"g",
"!=",
"nil",
"&&",
"g",
".",
"Viz",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
12,398 | all-12399 | [
"Intersects",
"checks",
"if",
"other",
"Brancher",
"would",
"trigger",
"for",
"the",
"same",
"branch",
"."
]
| [
"func",
"(",
"br",
"Brancher",
")",
"Intersects",
"(",
"other",
"Brancher",
")",
"bool",
"{",
"if",
"br",
".",
"RunsAgainstAllBranch",
"(",
")",
"||",
"other",
".",
"RunsAgainstAllBranch",
"(",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"len",
"(",
"br",
".",
"Branches",
")",
">",
"0",
"{",
"baseBranches",
":=",
"sets",
".",
"NewString",
"(",
"br",
".",
"Branches",
"...",
")",
"\n",
"if",
"len",
"(",
"other",
".",
"Branches",
")",
">",
"0",
"{",
"otherBranches",
":=",
"sets",
".",
"NewString",
"(",
"other",
".",
"Branches",
"...",
")",
"\n",
"if",
"baseBranches",
".",
"Intersection",
"(",
"otherBranches",
")",
".",
"Len",
"(",
")",
">",
"0",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}",
"\n\n",
"// Actually test our branches against the other brancher - if there are regex skip lists, simple comparison",
"// is insufficient.",
"for",
"_",
",",
"b",
":=",
"<mask>",
"baseBranches",
".",
"List",
"(",
")",
"{",
"if",
"other",
".",
"ShouldRun",
"(",
"b",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}",
"\n",
"if",
"len",
"(",
"other",
".",
"Branches",
")",
"==",
"0",
"{",
"// There can only be one Brancher with skip_branches.",
"return",
"true",
"\n",
"}",
"\n",
"return",
"other",
".",
"Intersects",
"(",
"br",
")",
"\n",
"}"
]
|
12,399 | all-12400 | [
"ProductEqual",
"returns",
"true",
"if",
"this",
"version",
"s",
"product",
"name",
"is",
"the",
"same",
"as",
"the",
"supplied",
"version",
"s",
"name",
"."
]
| [
"func",
"(",
"v",
"VSphereVersion",
")",
"ProductEqual",
"(",
"<mask>",
"VSphereVersion",
")",
"bool",
"{",
"return",
"v",
".",
"Product",
"==",
"other",
".",
"Product",
"\n",
"}"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.