id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
12,200 | all-12201 | [
"Read",
"--",
"Safe",
"way",
"to",
"read",
"from",
"a",
"task"
] | [
"func",
"(",
"s",
"*",
"Task",
")",
"Read",
"(",
"read",
"func",
"(",
"*",
"Task",
")",
"interface",
"{",
"}",
")",
"interface",
"{",
"}",
"{",
"s",
".",
"mutex",
".",
"RLock",
"(",
")",
"\n",
"var",
"<mask>",
"=",
"read",
"(",
"s",
")",
"\n",
"s",
".",
"mutex",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"ret",
"\n",
"}"
] |
12,201 | all-12202 | [
"matchGateway",
"take",
"an",
"IP",
"mask",
"and",
"gateway",
"and",
"checks",
"to",
"see",
"if",
"the",
"gateway",
"is",
"reachable",
"from",
"the",
"IP",
"address",
"."
] | [
"func",
"matchGateway",
"(",
"a",
"string",
",",
"m",
"int",
",",
"g",
"string",
")",
"bool",
"{",
"ip",
":=",
"net",
".",
"ParseIP",
"(",
"a",
")",
"\n",
"gw",
":=",
"net",
".",
"ParseIP",
"(",
"g",
")",
"\n",
"var",
"mask",
"net",
".",
"IPMask",
"\n",
"if",
"ip",
".",
"To4",
"(",
")",
"!=",
"nil",
"{",
"mask",
"=",
"net",
".",
"CIDRMask",
"(",
"m",
",",
"32",
")",
"\n",
"}",
"else",
"{",
"mask",
"=",
"net",
".",
"CIDRMask",
"(",
"m",
",",
"128",
")",
"\n",
"}",
"\n",
"if",
"ip",
".",
"Mask",
"(",
"mask",
")",
".",
"Equal",
"(",
"gw",
".",
"Mask",
"(",
"<mask>",
")",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
12,202 | all-12203 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventContextCreated",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoWebaudio3",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
12,203 | all-12204 | [
"/",
"*",
"low",
"-",
"level",
"scalar",
"<",
"-",
">",
"raw",
"data",
"conversion",
"functions"
] | [
"func",
"ScalarToRawData",
"(",
"scalar",
"*",
"Scalar",
",",
"<mask>",
"unsafe",
".",
"Pointer",
",",
"type_",
",",
"extend_to_12",
"int",
")",
"{",
"C",
".",
"cvScalarToRawData",
"(",
"(",
"*",
"C",
".",
"CvScalar",
")",
"(",
"scalar",
")",
",",
"data",
",",
"C",
".",
"int",
"(",
"type_",
")",
",",
"C",
".",
"int",
"(",
"extend_to_12",
")",
",",
")",
"\n",
"}"
] |
12,204 | all-12205 | [
"DeleteSeries",
"implements",
"pb",
".",
"AdminServer",
"."
] | [
"func",
"(",
"s",
"*",
"Admin",
")",
"DeleteSeries",
"(",
"_",
"context",
".",
"Context",
",",
"r",
"*",
"pb",
".",
"SeriesDeleteRequest",
")",
"(",
"*",
"pb",
".",
"SeriesDeleteResponse",
",",
"error",
")",
"{",
"mint",
",",
"maxt",
",",
"err",
":=",
"extractTimeRange",
"(",
"r",
".",
"MinTime",
",",
"r",
".",
"MaxTime",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"status",
".",
"Error",
"(",
"codes",
".",
"InvalidArgument",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"var",
"matchers",
"tsdbLabels",
".",
"Selector",
"\n\n",
"for",
"_",
",",
"m",
":=",
"range",
"r",
".",
"Matchers",
"{",
"var",
"lm",
"tsdbLabels",
".",
"Matcher",
"\n",
"var",
"err",
"error",
"\n\n",
"switch",
"m",
".",
"Type",
"{",
"case",
"pb",
".",
"LabelMatcher_EQ",
":",
"lm",
"=",
"tsdbLabels",
".",
"NewEqualMatcher",
"(",
"m",
".",
"Name",
",",
"m",
".",
"Value",
")",
"\n",
"case",
"pb",
".",
"LabelMatcher_NEQ",
":",
"lm",
"=",
"tsdbLabels",
".",
"Not",
"(",
"tsdbLabels",
".",
"NewEqualMatcher",
"(",
"m",
".",
"Name",
",",
"m",
".",
"Value",
")",
")",
"\n",
"case",
"pb",
".",
"LabelMatcher_RE",
":",
"lm",
",",
"err",
"=",
"tsdbLabels",
".",
"NewRegexpMatcher",
"(",
"m",
".",
"Name",
",",
"m",
".",
"Value",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"status",
".",
"Errorf",
"(",
"codes",
".",
"InvalidArgument",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"case",
"pb",
".",
"LabelMatcher_NRE",
":",
"lm",
",",
"err",
"=",
"tsdbLabels",
".",
"NewRegexpMatcher",
"(",
"m",
".",
"Name",
",",
"m",
".",
"Value",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"status",
".",
"Errorf",
"(",
"codes",
".",
"InvalidArgument",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"lm",
"=",
"tsdbLabels",
".",
"Not",
"(",
"lm",
")",
"\n",
"<mask>",
":",
"return",
"nil",
",",
"status",
".",
"Error",
"(",
"codes",
".",
"InvalidArgument",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"matchers",
"=",
"append",
"(",
"matchers",
",",
"lm",
")",
"\n",
"}",
"\n",
"db",
":=",
"s",
".",
"db",
"(",
")",
"\n",
"if",
"db",
"==",
"nil",
"{",
"return",
"nil",
",",
"errTSDBNotReady",
"\n",
"}",
"\n",
"if",
"err",
":=",
"db",
".",
"Delete",
"(",
"timestamp",
".",
"FromTime",
"(",
"mint",
")",
",",
"timestamp",
".",
"FromTime",
"(",
"maxt",
")",
",",
"matchers",
"...",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"status",
".",
"Error",
"(",
"codes",
".",
"Internal",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"&",
"pb",
".",
"SeriesDeleteResponse",
"{",
"}",
",",
"nil",
"\n",
"}"
] |
12,205 | all-12206 | [
"User",
"returns",
"the",
"Mail",
"notifier",
"."
] | [
"func",
"(",
"m",
"MongoDb",
")",
"MailNotifier",
"(",
"ctxt",
"string",
")",
"(",
"models",
".",
"MailNotifier",
",",
"error",
")",
"{",
"c",
":=",
"m",
".",
"Connect",
"(",
"models",
".",
"COLL_NAME_MAIL_NOTIFIER",
")",
"\n",
"defer",
"m",
".",
"Close",
"(",
"c",
")",
"\n",
"var",
"notifier",
"[",
"]",
"models",
".",
"MailNotifier",
"\n",
"if",
"err",
":=",
"c",
".",
"Find",
"(",
"nil",
")",
".",
"All",
"(",
"&",
"notifier",
")",
";",
"err",
"!=",
"nil",
"||",
"len",
"(",
"notifier",
")",
"==",
"0",
"{",
"logger",
".",
"Get",
"(",
")",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"ctxt",
",",
"err",
")",
"\n",
"return",
"models",
".",
"MailNotifier",
"{",
"}",
",",
"ErrMissingNotifier",
"\n",
"}",
"else",
"{",
"return",
"notifier",
"[",
"0",
"]",
",",
"nil",
"\n",
"}",
"\n",
"}"
] |
12,206 | all-12207 | [
"beginCall",
"begins",
"an",
"outbound",
"call",
"on",
"the",
"connection"
] | [
"func",
"(",
"c",
"*",
"Connection",
")",
"beginCall",
"(",
"ctx",
"context",
".",
"Context",
",",
"serviceName",
",",
"methodName",
"string",
",",
"callOptions",
"*",
"CallOptions",
")",
"(",
"*",
"OutboundCall",
",",
"error",
")",
"{",
"now",
":=",
"c",
".",
"timeNow",
"(",
")",
"\n\n",
"switch",
"state",
":=",
"c",
".",
"readState",
"(",
")",
";",
"state",
"{",
"case",
"connectionActive",
":",
"break",
"\n",
"case",
"connectionStartClose",
",",
"connectionInboundClosed",
",",
"connectionClosed",
":",
"return",
"nil",
",",
"ErrConnectionClosed",
"\n",
"default",
":",
"return",
"nil",
",",
"errConnectionUnknownState",
"{",
"\"",
"\"",
",",
"state",
"}",
"\n",
"}",
"\n\n",
"deadline",
",",
"ok",
":=",
"ctx",
".",
"Deadline",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"// This case is handled by validateCall, so we should",
"// never get here.",
"return",
"nil",
",",
"ErrTimeoutRequired",
"\n",
"}",
"\n\n",
"// If the timeToLive is less than a millisecond, it will be encoded as 0 on",
"// the wire, hence we return a timeout immediately.",
"timeToLive",
":=",
"deadline",
".",
"Sub",
"(",
"now",
")",
"\n",
"if",
"timeToLive",
"<",
"time",
".",
"Millisecond",
"{",
"return",
"nil",
",",
"ErrTimeout",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"ctx",
".",
"Err",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"GetContextError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"requestID",
":=",
"c",
".",
"NextMessageID",
"(",
")",
"\n",
"mex",
",",
"err",
":=",
"c",
".",
"outbound",
".",
"newExchange",
"(",
"ctx",
",",
"c",
".",
"opts",
".",
"FramePool",
",",
"messageTypeCallReq",
",",
"requestID",
",",
"mexChannelBufferSize",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Close may have been called between the time we checked the state and us creating the exchange.",
"if",
"state",
":=",
"c",
".",
"readState",
"(",
")",
";",
"<mask>",
"!=",
"connectionActive",
"{",
"mex",
".",
"shutdown",
"(",
")",
"\n",
"return",
"nil",
",",
"ErrConnectionClosed",
"\n",
"}",
"\n\n",
"// Note: We don't verify number of transport headers as the library doesn't",
"// allow adding arbitrary headers. Ensure we never add >= 256 headers here.",
"headers",
":=",
"transportHeaders",
"{",
"CallerName",
":",
"c",
".",
"localPeerInfo",
".",
"ServiceName",
",",
"}",
"\n",
"callOptions",
".",
"setHeaders",
"(",
"headers",
")",
"\n",
"if",
"opts",
":=",
"currentCallOptions",
"(",
"ctx",
")",
";",
"opts",
"!=",
"nil",
"{",
"opts",
".",
"overrideHeaders",
"(",
"headers",
")",
"\n",
"}",
"\n\n",
"call",
":=",
"new",
"(",
"OutboundCall",
")",
"\n",
"call",
".",
"mex",
"=",
"mex",
"\n",
"call",
".",
"conn",
"=",
"c",
"\n",
"call",
".",
"callReq",
"=",
"callReq",
"{",
"id",
":",
"requestID",
",",
"Headers",
":",
"headers",
",",
"Service",
":",
"serviceName",
",",
"TimeToLive",
":",
"timeToLive",
",",
"}",
"\n",
"call",
".",
"statsReporter",
"=",
"c",
".",
"statsReporter",
"\n",
"call",
".",
"createStatsTags",
"(",
"c",
".",
"commonStatsTags",
",",
"callOptions",
",",
"methodName",
")",
"\n",
"call",
".",
"log",
"=",
"c",
".",
"log",
".",
"WithFields",
"(",
"LogField",
"{",
"\"",
"\"",
",",
"requestID",
"}",
")",
"\n\n",
"// TODO(mmihic): It'd be nice to do this without an fptr",
"call",
".",
"messageForFragment",
"=",
"func",
"(",
"initial",
"bool",
")",
"message",
"{",
"if",
"initial",
"{",
"return",
"&",
"call",
".",
"callReq",
"\n",
"}",
"\n\n",
"return",
"new",
"(",
"callReqContinue",
")",
"\n",
"}",
"\n\n",
"call",
".",
"contents",
"=",
"newFragmentingWriter",
"(",
"call",
".",
"log",
",",
"call",
",",
"c",
".",
"opts",
".",
"ChecksumType",
".",
"New",
"(",
")",
")",
"\n\n",
"response",
":=",
"new",
"(",
"OutboundCallResponse",
")",
"\n",
"response",
".",
"startedAt",
"=",
"now",
"\n",
"response",
".",
"timeNow",
"=",
"c",
".",
"timeNow",
"\n",
"response",
".",
"requestState",
"=",
"callOptions",
".",
"RequestState",
"\n",
"response",
".",
"mex",
"=",
"mex",
"\n",
"response",
".",
"log",
"=",
"c",
".",
"log",
".",
"WithFields",
"(",
"LogField",
"{",
"\"",
"\"",
",",
"requestID",
"}",
")",
"\n",
"response",
".",
"span",
"=",
"c",
".",
"startOutboundSpan",
"(",
"ctx",
",",
"serviceName",
",",
"methodName",
",",
"call",
",",
"now",
")",
"\n",
"response",
".",
"messageForFragment",
"=",
"func",
"(",
"initial",
"bool",
")",
"message",
"{",
"if",
"initial",
"{",
"return",
"&",
"response",
".",
"callRes",
"\n",
"}",
"\n\n",
"return",
"new",
"(",
"callResContinue",
")",
"\n",
"}",
"\n",
"response",
".",
"contents",
"=",
"newFragmentingReader",
"(",
"response",
".",
"log",
",",
"response",
")",
"\n",
"response",
".",
"statsReporter",
"=",
"call",
".",
"statsReporter",
"\n",
"response",
".",
"commonStatsTags",
"=",
"call",
".",
"commonStatsTags",
"\n\n",
"call",
".",
"response",
"=",
"response",
"\n\n",
"if",
"err",
":=",
"call",
".",
"writeMethod",
"(",
"[",
"]",
"byte",
"(",
"methodName",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"call",
",",
"nil",
"\n",
"}"
] |
12,207 | all-12208 | [
"DeepCopy",
"copies",
"the",
"receiver",
"into",
"a",
"new",
"Email",
"."
] | [
"func",
"(",
"e",
"*",
"Email",
")",
"DeepCopy",
"(",
")",
"*",
"Email",
"{",
"if",
"e",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"Email",
")",
"\n",
"e",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
12,208 | all-12209 | [
"State",
"creates",
"a",
"new",
"State",
"instance",
"linked",
"to",
"our",
"internal",
"db",
"and",
"os",
"."
] | [
"func",
"(",
"d",
"*",
"Daemon",
")",
"State",
"(",
")",
"*",
"<mask>",
".",
"State",
"{",
"return",
"state",
".",
"NewState",
"(",
"d",
".",
"db",
",",
"d",
".",
"cluster",
",",
"d",
".",
"maas",
",",
"d",
".",
"os",
",",
"d",
".",
"endpoints",
")",
"\n",
"}"
] |
12,209 | all-12210 | [
"Run",
"will",
"block",
"listening",
"to",
"all",
"subscriptions",
"and",
"return",
"once",
"the",
"context",
"is",
"cancelled",
"or",
"one",
"of",
"the",
"subscription",
"has",
"a",
"unrecoverable",
"error",
"."
] | [
"func",
"(",
"s",
"*",
"PullServer",
")",
"Run",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"configEvent",
":=",
"<mask>",
"(",
"chan",
"config",
".",
"Delta",
",",
"2",
")",
"\n",
"s",
".",
"Subscriber",
".",
"ConfigAgent",
".",
"Subscribe",
"(",
"configEvent",
")",
"\n\n",
"var",
"err",
"error",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"ctx",
".",
"Err",
"(",
")",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"logrus",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"}",
"(",
")",
"\n",
"currentConfig",
":=",
"s",
".",
"Subscriber",
".",
"ConfigAgent",
".",
"Config",
"(",
")",
".",
"PubSubSubscriptions",
"\n",
"errGroup",
",",
"derivedCtx",
",",
"err",
":=",
"s",
".",
"handlePulls",
"(",
"ctx",
",",
"currentConfig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"for",
"{",
"select",
"{",
"// Parent context. Shutdown",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"ctx",
".",
"Err",
"(",
")",
"\n",
"// Current thread context, it may be failing already",
"case",
"<-",
"derivedCtx",
".",
"Done",
"(",
")",
":",
"err",
"=",
"errGroup",
".",
"Wait",
"(",
")",
"\n",
"return",
"err",
"\n",
"// Checking for update config",
"case",
"event",
":=",
"<-",
"configEvent",
":",
"newConfig",
":=",
"event",
".",
"After",
".",
"PubSubSubscriptions",
"\n",
"logrus",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"if",
"!",
"reflect",
".",
"DeepEqual",
"(",
"currentConfig",
",",
"newConfig",
")",
"{",
"logrus",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"// Making sure the current thread finishes before starting a new one.",
"errGroup",
".",
"Wait",
"(",
")",
"\n",
"// Starting a new thread with new config",
"errGroup",
",",
"derivedCtx",
",",
"err",
"=",
"s",
".",
"handlePulls",
"(",
"ctx",
",",
"newConfig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"currentConfig",
"=",
"newConfig",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
12,210 | all-12211 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"MouseType",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"MouseType",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"MousePressed",
":",
"*",
"t",
"=",
"MousePressed",
"\n",
"case",
"MouseReleased",
":",
"*",
"t",
"=",
"MouseReleased",
"\n",
"case",
"MouseMoved",
":",
"*",
"t",
"=",
"MouseMoved",
"\n",
"case",
"MouseWheel",
":",
"*",
"t",
"=",
"MouseWheel",
"\n\n",
"default",
":",
"in",
".",
"AddError",
"(",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
] |
12,211 | all-12212 | [
"TokenFromIncomingContext",
"gets",
"the",
"token",
"from",
"the",
"incoming",
"context",
"or",
"returns",
"ErrNoToken"
] | [
"func",
"TokenFromIncomingContext",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"string",
",",
"error",
")",
"{",
"md",
":=",
"MetadataFromIncomingContext",
"(",
"ctx",
")",
"\n",
"return",
"TokenFromMetadata",
"(",
"md",
")",
"\n",
"}"
] |
12,212 | all-12213 | [
"resourceVSphereComputeClusterApplyTags",
"processes",
"the",
"tags",
"step",
"for",
"both",
"create",
"and",
"update",
"for",
"vsphere_compute_cluster",
"."
] | [
"func",
"resourceVSphereComputeClusterApplyTags",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"<mask>",
"{",
"}",
",",
"cluster",
"*",
"object",
".",
"ClusterComputeResource",
")",
"error",
"{",
"tagsClient",
",",
"err",
":=",
"tagsClientIfDefined",
"(",
"d",
",",
"meta",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Apply any pending tags now",
"if",
"tagsClient",
"==",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereComputeClusterIDString",
"(",
"d",
")",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereComputeClusterIDString",
"(",
"d",
")",
")",
"\n",
"return",
"processTagDiff",
"(",
"tagsClient",
",",
"d",
",",
"cluster",
")",
"\n",
"}"
] |
12,213 | all-12214 | [
"AddSSHUser",
"adds",
"the",
"user",
"associated",
"with",
"the",
"API",
"token",
"to",
"the",
"list",
"of",
"valid",
"SSH",
"users",
"for",
"a",
"build",
".",
"The",
"API",
"token",
"being",
"used",
"must",
"be",
"a",
"user",
"API",
"token"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"AddSSHUser",
"(",
"account",
",",
"repo",
"string",
",",
"buildNum",
"int",
")",
"(",
"*",
"Build",
",",
"error",
")",
"{",
"<mask>",
":=",
"&",
"Build",
"{",
"}",
"\n\n",
"err",
":=",
"c",
".",
"request",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"account",
",",
"repo",
",",
"buildNum",
")",
",",
"build",
",",
"nil",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"build",
",",
"nil",
"\n",
"}"
] |
12,214 | all-12215 | [
"MarshalEasyJSON",
"writes",
"the",
"ISBN10",
"to",
"a",
"easyjson",
".",
"Writer"
] | [
"func",
"(",
"u",
"ISBN10",
")",
"MarshalEasyJSON",
"(",
"w",
"*",
"jwriter",
".",
"<mask>",
")",
"{",
"w",
".",
"String",
"(",
"string",
"(",
"u",
")",
")",
"\n",
"}"
] |
12,215 | all-12216 | [
"WindowSetDefaultIconFromFile",
"is",
"a",
"wrapper",
"around",
"gtk_window_set_default_icon_from_file",
"()",
"."
] | [
"func",
"WindowSetDefaultIconFromFile",
"(",
"file",
"string",
")",
"error",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"file",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"var",
"err",
"*",
"C",
".",
"GError",
"=",
"nil",
"\n",
"res",
":=",
"C",
".",
"gtk_window_set_default_icon_from_file",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"&",
"err",
")",
"\n",
"if",
"<mask>",
"==",
"0",
"{",
"defer",
"C",
".",
"g_error_free",
"(",
"err",
")",
"\n",
"return",
"errors",
".",
"New",
"(",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"err",
".",
"message",
")",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
12,216 | all-12217 | [
"Validate",
"inspects",
"the",
"fields",
"of",
"the",
"type",
"to",
"determine",
"if",
"they",
"are",
"valid",
"."
] | [
"func",
"(",
"s",
"*",
"RegisterTaskDefinitionInput",
")",
"Validate",
"(",
")",
"error",
"{",
"invalidParams",
":=",
"request",
".",
"ErrInvalidParams",
"{",
"Context",
":",
"\"",
"\"",
"}",
"\n",
"if",
"s",
".",
"ContainerDefinitions",
"==",
"nil",
"{",
"invalidParams",
".",
"Add",
"(",
"request",
".",
"NewErrParamRequired",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"if",
"s",
".",
"Family",
"==",
"nil",
"{",
"invalidParams",
".",
"Add",
"(",
"request",
".",
"NewErrParamRequired",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"if",
"s",
".",
"ContainerDefinitions",
"!=",
"nil",
"{",
"for",
"i",
",",
"v",
":=",
"range",
"s",
".",
"ContainerDefinitions",
"{",
"if",
"v",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"err",
":=",
"v",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"invalidParams",
".",
"AddNested",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"i",
")",
",",
"err",
".",
"(",
"request",
".",
"ErrInvalidParams",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"s",
".",
"InferenceAccelerators",
"!=",
"nil",
"{",
"for",
"i",
",",
"v",
":=",
"<mask>",
"s",
".",
"InferenceAccelerators",
"{",
"if",
"v",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"err",
":=",
"v",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"invalidParams",
".",
"AddNested",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"i",
")",
",",
"err",
".",
"(",
"request",
".",
"ErrInvalidParams",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"s",
".",
"ProxyConfiguration",
"!=",
"nil",
"{",
"if",
"err",
":=",
"s",
".",
"ProxyConfiguration",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"invalidParams",
".",
"AddNested",
"(",
"\"",
"\"",
",",
"err",
".",
"(",
"request",
".",
"ErrInvalidParams",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"s",
".",
"Tags",
"!=",
"nil",
"{",
"for",
"i",
",",
"v",
":=",
"range",
"s",
".",
"Tags",
"{",
"if",
"v",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"err",
":=",
"v",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"invalidParams",
".",
"AddNested",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"i",
")",
",",
"err",
".",
"(",
"request",
".",
"ErrInvalidParams",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"invalidParams",
".",
"Len",
"(",
")",
">",
"0",
"{",
"return",
"invalidParams",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
12,217 | all-12218 | [
"TODO",
"(",
"jrick",
")",
"GdkEventMask",
"/",
"*",
"func",
"(",
"v",
"*",
"Widget",
")",
"SetDeviceEvents",
"()",
"{",
"}",
"TODO",
"(",
"jrick",
")",
"GdkEventMask",
"/",
"*",
"func",
"(",
"v",
"*",
"Widget",
")",
"GetDeviceEvents",
"()",
"{",
"}",
"TODO",
"(",
"jrick",
")",
"GdkEventMask",
"/",
"*",
"func",
"(",
"v",
"*",
"Widget",
")",
"AddDeviceEvents",
"()",
"{",
"}",
"SetDeviceEnabled",
"is",
"a",
"wrapper",
"around",
"gtk_widget_set_device_enabled",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Widget",
")",
"SetDeviceEnabled",
"(",
"<mask>",
"*",
"gdk",
".",
"Device",
",",
"enabled",
"bool",
")",
"{",
"C",
".",
"gtk_widget_set_device_enabled",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"GdkDevice",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"device",
".",
"Native",
"(",
")",
")",
")",
",",
"gbool",
"(",
"enabled",
")",
")",
"\n",
"}"
] |
12,218 | all-12219 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"StopReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoProfiler7",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
12,219 | all-12220 | [
"MakeRequest",
"makes",
"a",
"request",
"using",
"the",
"given",
"input",
".",
"Note",
"the",
"input",
"*",
"MUST",
"*",
"be",
"a",
"pointer",
"to",
"a",
"valid",
"backend",
"type",
"that",
"this",
"client",
"recognises"
] | [
"func",
"(",
"cs",
"*",
"ClientServerImpl",
")",
"MakeRequest",
"(",
"input",
"interface",
"{",
"}",
")",
"error",
"{",
"<mask>",
",",
"err",
":=",
"cs",
".",
"CreateRequestMessage",
"(",
"input",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"cs",
".",
"MakeRequestHook",
"!=",
"nil",
"{",
"send",
",",
"err",
"=",
"cs",
".",
"MakeRequestHook",
"(",
"send",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Over the wire we send something like",
"// {\"type\":\"AckRequest\",\"message\":{\"messageId\":\"xyz\"}}",
"return",
"cs",
".",
"WriteMessage",
"(",
"send",
")",
"\n",
"}"
] |
12,220 | all-12221 | [
"GetValueOk",
"returns",
"a",
"tuple",
"with",
"the",
"Value",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TileDefMarker",
")",
"GetValueOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Value",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"<mask>",
",",
"true",
"\n",
"}"
] |
12,221 | all-12222 | [
"===",
"floor",
"(",
"Vector",
"ValueTypeVector",
")",
"Vector",
"===",
"===",
"max_over_time",
"(",
"Matrix",
"ValueTypeMatrix",
")",
"Vector",
"==="
] | [
"func",
"funcMaxOverTime",
"(",
"vals",
"[",
"]",
"Value",
",",
"args",
"Expressions",
",",
"enh",
"*",
"EvalNodeHelper",
")",
"Vector",
"{",
"return",
"aggrOverTime",
"(",
"vals",
",",
"enh",
",",
"func",
"(",
"values",
"[",
"]",
"Point",
")",
"float64",
"{",
"max",
":=",
"values",
"[",
"0",
"]",
".",
"V",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"values",
"{",
"if",
"v",
".",
"V",
">",
"<mask>",
"||",
"math",
".",
"IsNaN",
"(",
"max",
")",
"{",
"max",
"=",
"v",
".",
"V",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"max",
"\n",
"}",
")",
"\n",
"}"
] |
12,222 | all-12223 | [
"Forwarders",
"lists",
"the",
"forwarders",
"of",
"a",
"domain"
] | [
"func",
"(",
"dom",
"*",
"Domain",
")",
"Forwarders",
"(",
")",
"(",
"[",
"]",
"*",
"Forwarder",
",",
"error",
")",
"{",
"var",
"vl",
"valueList",
"\n",
"err",
":=",
"dom",
".",
"cgp",
".",
"request",
"(",
"listForwarders",
"{",
"Param",
":",
"dom",
".",
"<mask>",
"}",
",",
"&",
"vl",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"*",
"Forwarder",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"vals",
":=",
"vl",
".",
"compact",
"(",
")",
"\n",
"fs",
":=",
"make",
"(",
"[",
"]",
"*",
"Forwarder",
",",
"len",
"(",
"vals",
")",
")",
"\n",
"for",
"i",
",",
"v",
":=",
"range",
"vals",
"{",
"f",
",",
"err",
":=",
"dom",
".",
"GetForwarder",
"(",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fs",
",",
"err",
"\n",
"}",
"\n",
"fs",
"[",
"i",
"]",
"=",
"f",
"\n",
"}",
"\n",
"return",
"fs",
",",
"err",
"\n",
"}"
] |
12,223 | all-12224 | [
"SetDropHighlightItem",
"is",
"a",
"wrapper",
"around",
"gtk_toolbar_set_drop_highlight_item",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Toolbar",
")",
"SetDropHighlightItem",
"(",
"toolItem",
"IToolItem",
",",
"<mask>",
"int",
")",
"{",
"C",
".",
"gtk_toolbar_set_drop_highlight_item",
"(",
"v",
".",
"native",
"(",
")",
",",
"toolItem",
".",
"toToolItem",
"(",
")",
",",
"C",
".",
"gint",
"(",
"index",
")",
")",
"\n",
"}"
] |
12,224 | all-12225 | [
"DoTimeout",
"performs",
"the",
"given",
"request",
"and",
"waits",
"for",
"response",
"during",
"the",
"given",
"timeout",
"duration",
".",
"Request",
"must",
"contain",
"at",
"least",
"non",
"-",
"zero",
"RequestURI",
"with",
"full",
"url",
"(",
"including",
"scheme",
"and",
"host",
")",
"or",
"non",
"-",
"zero",
"Host",
"header",
"+",
"RequestURI",
".",
"Client",
"determines",
"the",
"server",
"to",
"be",
"requested",
"in",
"the",
"following",
"order",
":",
"-",
"from",
"RequestURI",
"if",
"it",
"contains",
"full",
"url",
"with",
"scheme",
"and",
"host",
";",
"-",
"from",
"Host",
"header",
"otherwise",
".",
"The",
"function",
"doesn",
"t",
"follow",
"redirects",
".",
"Use",
"Get",
"*",
"for",
"following",
"redirects",
".",
"Response",
"is",
"ignored",
"if",
"resp",
"is",
"nil",
".",
"ErrTimeout",
"is",
"returned",
"if",
"the",
"response",
"wasn",
"t",
"returned",
"during",
"the",
"given",
"timeout",
".",
"ErrNoFreeConns",
"is",
"returned",
"if",
"all",
"Client",
".",
"MaxConnsPerHost",
"connections",
"to",
"the",
"requested",
"host",
"are",
"busy",
".",
"It",
"is",
"recommended",
"obtaining",
"req",
"and",
"resp",
"via",
"AcquireRequest",
"and",
"AcquireResponse",
"in",
"performance",
"-",
"critical",
"code",
".",
"Warning",
":",
"DoTimeout",
"does",
"not",
"terminate",
"the",
"request",
"itself",
".",
"The",
"request",
"will",
"continue",
"in",
"the",
"background",
"and",
"the",
"response",
"will",
"be",
"discarded",
".",
"If",
"requests",
"take",
"too",
"long",
"and",
"the",
"connection",
"pool",
"gets",
"filled",
"up",
"please",
"try",
"setting",
"a",
"ReadTimeout",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"DoTimeout",
"(",
"req",
"*",
"Request",
",",
"resp",
"*",
"Response",
",",
"timeout",
"time",
".",
"Duration",
")",
"error",
"{",
"return",
"clientDoTimeout",
"(",
"req",
",",
"resp",
",",
"timeout",
",",
"c",
")",
"\n",
"}"
] |
12,225 | all-12226 | [
"Equal",
"returns",
"whether",
"the",
"two",
"label",
"sets",
"are",
"equal",
"."
] | [
"func",
"Equal",
"(",
"ls",
",",
"o",
"Labels",
")",
"bool",
"{",
"if",
"len",
"(",
"ls",
")",
"!=",
"len",
"(",
"o",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"for",
"i",
",",
"l",
":=",
"<mask>",
"ls",
"{",
"if",
"l",
".",
"Name",
"!=",
"o",
"[",
"i",
"]",
".",
"Name",
"||",
"l",
".",
"Value",
"!=",
"o",
"[",
"i",
"]",
".",
"Value",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] |
12,226 | all-12227 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventVirtualTimeBudgetExpired",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation17",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
12,227 | all-12228 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
] | [
"func",
"(",
"r",
"*",
"RouteTable",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"RouteTableLocator",
"{",
"for",
"_",
",",
"l",
":=",
"<mask>",
"r",
".",
"Links",
"{",
"if",
"l",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"return",
"api",
".",
"RouteTableLocator",
"(",
"l",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
12,228 | all-12229 | [
"GetNodeForLocation",
"returns",
"node",
"id",
"at",
"given",
"location",
".",
"Depending",
"on",
"whether",
"DOM",
"domain",
"is",
"enabled",
"nodeId",
"is",
"either",
"returned",
"or",
"not",
".",
"See",
":",
"https",
":",
"//",
"chromedevtools",
".",
"github",
".",
"io",
"/",
"devtools",
"-",
"protocol",
"/",
"tot",
"/",
"DOM#method",
"-",
"getNodeForLocation",
"parameters",
":",
"x",
"-",
"X",
"coordinate",
".",
"y",
"-",
"Y",
"coordinate",
"."
] | [
"func",
"GetNodeForLocation",
"(",
"x",
"int64",
",",
"y",
"int64",
")",
"*",
"GetNodeForLocationParams",
"{",
"<mask>",
"&",
"GetNodeForLocationParams",
"{",
"X",
":",
"x",
",",
"Y",
":",
"y",
",",
"}",
"\n",
"}"
] |
12,229 | all-12230 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"TakePreciseCoverageReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoProfiler4",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
12,230 | all-12231 | [
"GetResourceOk",
"returns",
"a",
"tuple",
"with",
"the",
"Resource",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"r",
"*",
"reqGetDashboard",
")",
"GetResourceOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"r",
"==",
"nil",
"||",
"r",
".",
"Resource",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"r",
".",
"Resource",
",",
"<mask>",
"\n",
"}"
] |
12,231 | all-12232 | [
"NewCheckWithOptions",
"returns",
"an",
"empty",
"Check",
"object",
"with",
"caller",
"-",
"specified",
"behavioural",
"modifications",
".",
"See",
"CheckOptions",
"."
] | [
"func",
"NewCheckWithOptions",
"(",
"options",
"CheckOptions",
")",
"*",
"Check",
"{",
"c",
":=",
"NewCheck",
"(",
")",
"\n",
"if",
"options",
".",
"StatusPolicy",
"!=",
"nil",
"{",
"c",
".",
"statusPolicy",
"=",
"<mask>",
".",
"StatusPolicy",
"\n",
"}",
"\n",
"return",
"c",
"\n",
"}"
] |
12,232 | all-12233 | [
"ShowCommandHelp",
"displays",
"the",
"command",
"help",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"ShowCommandHelp",
"(",
"cmd",
"<mask>",
")",
"error",
"{",
"return",
"a",
".",
"ShowHelp",
"(",
"cmd",
",",
"\"",
"\"",
",",
"commandValues",
")",
"\n",
"}"
] |
12,233 | all-12234 | [
"GetAppliedStatus",
"returns",
"the",
"transitioning",
"status",
"of",
"container"
] | [
"func",
"(",
"c",
"*",
"Container",
")",
"GetAppliedStatus",
"(",
")",
"apicontainerstatus",
".",
"ContainerStatus",
"{",
"c",
".",
"<mask>",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"c",
".",
"AppliedStatus",
"\n",
"}"
] |
12,234 | all-12235 | [
"Returns",
"an",
"slice",
"of",
"strings",
"or",
"a",
"nil",
"slice"
] | [
"func",
"(",
"t",
"Typed",
")",
"Strings",
"(",
"<mask>",
"string",
")",
"[",
"]",
"string",
"{",
"return",
"t",
".",
"StringsOr",
"(",
"key",
",",
"nil",
")",
"\n",
"}"
] |
12,235 | all-12236 | [
"loadFromFile",
"is",
"a",
"modified",
"copy",
"of",
"k8s",
".",
"io",
"/",
"kubernetes",
"/",
"pkg",
"/",
"client",
"/",
"unversioned",
"/",
"clientcmd",
".",
"LoadFromFile",
"LoadFromFile",
"takes",
"a",
"filename",
"and",
"deserializes",
"the",
"contents",
"into",
"Config",
"object"
] | [
"func",
"loadFromFile",
"(",
"filename",
"string",
")",
"(",
"*",
"clientcmdConfig",
",",
"error",
")",
"{",
"kubeconfigBytes",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"config",
",",
"err",
":=",
"load",
"(",
"kubeconfigBytes",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// set LocationOfOrigin on every Cluster, User, and Context",
"for",
"key",
",",
"obj",
":=",
"range",
"config",
".",
"AuthInfos",
"{",
"obj",
".",
"LocationOfOrigin",
"=",
"filename",
"\n",
"config",
".",
"AuthInfos",
"[",
"key",
"]",
"=",
"obj",
"\n",
"}",
"\n",
"for",
"key",
",",
"obj",
":=",
"range",
"config",
".",
"Clusters",
"{",
"obj",
".",
"LocationOfOrigin",
"=",
"filename",
"\n",
"config",
".",
"Clusters",
"[",
"key",
"]",
"=",
"obj",
"\n",
"}",
"\n",
"for",
"key",
",",
"obj",
":=",
"range",
"config",
".",
"Contexts",
"{",
"obj",
".",
"LocationOfOrigin",
"=",
"<mask>",
"\n",
"config",
".",
"Contexts",
"[",
"key",
"]",
"=",
"obj",
"\n",
"}",
"\n\n",
"if",
"config",
".",
"AuthInfos",
"==",
"nil",
"{",
"config",
".",
"AuthInfos",
"=",
"map",
"[",
"string",
"]",
"*",
"clientcmdAuthInfo",
"{",
"}",
"\n",
"}",
"\n",
"if",
"config",
".",
"Clusters",
"==",
"nil",
"{",
"config",
".",
"Clusters",
"=",
"map",
"[",
"string",
"]",
"*",
"clientcmdCluster",
"{",
"}",
"\n",
"}",
"\n",
"if",
"config",
".",
"Contexts",
"==",
"nil",
"{",
"config",
".",
"Contexts",
"=",
"map",
"[",
"string",
"]",
"*",
"clientcmdContext",
"{",
"}",
"\n",
"}",
"\n\n",
"return",
"config",
",",
"nil",
"\n",
"}"
] |
12,236 | all-12237 | [
"GetPath",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_tree_model_get_path",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TreeModel",
")",
"GetPath",
"(",
"iter",
"*",
"TreeIter",
")",
"(",
"*",
"TreePath",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_tree_model_get_path",
"(",
"v",
".",
"native",
"(",
")",
",",
"iter",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"p",
":=",
"&",
"TreePath",
"{",
"c",
"}",
"\n",
"runtime",
".",
"SetFinalizer",
"(",
"p",
",",
"(",
"*",
"TreePath",
")",
".",
"<mask>",
")",
"\n",
"return",
"p",
",",
"nil",
"\n",
"}"
] |
12,237 | all-12238 | [
"specify",
"a",
"two",
"-",
"dimensional",
"texture",
"subimage",
"in",
"a",
"compressed",
"format"
] | [
"func",
"CompressedTextureSubImage2D",
"(",
"texture",
"uint32",
",",
"level",
"int32",
",",
"xoffset",
"int32",
",",
"yoffset",
"int32",
",",
"width",
"int32",
",",
"<mask>",
"int32",
",",
"format",
"uint32",
",",
"imageSize",
"int32",
",",
"data",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall9",
"(",
"gpCompressedTextureSubImage2D",
",",
"9",
",",
"uintptr",
"(",
"texture",
")",
",",
"uintptr",
"(",
"level",
")",
",",
"uintptr",
"(",
"xoffset",
")",
",",
"uintptr",
"(",
"yoffset",
")",
",",
"uintptr",
"(",
"width",
")",
",",
"uintptr",
"(",
"height",
")",
",",
"uintptr",
"(",
"format",
")",
",",
"uintptr",
"(",
"imageSize",
")",
",",
"uintptr",
"(",
"data",
")",
")",
"\n",
"}"
] |
12,238 | all-12239 | [
"ResStatus",
"Response",
"status",
"code",
"use",
"http",
".",
"StatusText",
"to",
"write",
"the",
"response",
"."
] | [
"func",
"(",
"ctx",
"*",
"Context",
")",
"ResStatus",
"(",
"code",
"int",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"ctx",
".",
"written",
"==",
"true",
"{",
"return",
"0",
",",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"ctx",
".",
"written",
"=",
"true",
"\n",
"ctx",
".",
"ResponseWriter",
".",
"WriteHeader",
"(",
"code",
")",
"\n",
"return",
"fmt",
".",
"Fprint",
"(",
"ctx",
".",
"ResponseWriter",
",",
"http",
".",
"StatusText",
"(",
"code",
")",
")",
"\n",
"}"
] |
12,239 | all-12240 | [
"HasNoMetricHosts",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"h",
"*",
"HostmapDefinition",
")",
"HasNoMetricHosts",
"(",
")",
"bool",
"{",
"if",
"h",
"!=",
"nil",
"&&",
"h",
".",
"NoMetricHosts",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
12,240 | all-12241 | [
"Scan",
"implements",
"the",
"database",
"/",
"sql",
"/",
"Scanner",
"interface",
"."
] | [
"func",
"(",
"l",
"*",
"NullLob",
")",
"Scan",
"(",
"src",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"src",
"==",
"nil",
"{",
"l",
".",
"Valid",
"=",
"false",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"err",
":=",
"l",
".",
"Lob",
".",
"Scan",
"(",
"src",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"l",
".",
"Valid",
"=",
"<mask>",
"\n",
"return",
"nil",
"\n",
"}"
] |
12,241 | all-12242 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"ObjectPreview",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime17",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
12,242 | all-12243 | [
"Do",
"executes",
"Fetch",
".",
"continueRequest",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"ContinueRequestParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandContinueRequest",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
12,243 | all-12244 | [
"URL",
"returns",
"the",
"URL",
"that",
"can",
"be",
"used",
"to",
"play",
"this",
"recording",
"based",
"on",
"the",
"extension",
".",
"No",
"error",
"is",
"returned",
"if",
"you",
"provide",
"an",
"invalid",
"extension",
".",
"As",
"of",
"October",
"2016",
"the",
"valid",
"values",
"are",
".",
"wav",
"and",
".",
"mp3",
"."
] | [
"func",
"(",
"r",
"*",
"Recording",
")",
"<mask>",
"(",
"extension",
"string",
")",
"string",
"{",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"extension",
",",
"\"",
"\"",
")",
"{",
"extension",
"=",
"\"",
"\"",
"+",
"extension",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"[",
"]",
"string",
"{",
"BaseURL",
",",
"r",
".",
"APIVersion",
",",
"\"",
"\"",
",",
"r",
".",
"AccountSid",
",",
"recordingsPathPart",
",",
"r",
".",
"Sid",
"+",
"extension",
"}",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
12,244 | all-12245 | [
"Hash",
"calculates",
"a",
"set",
"hash",
"for",
"the",
"current",
"data",
".",
"If",
"you",
"want",
"a",
"hash",
"for",
"error",
"reporting",
"a",
"device",
"address",
"it",
"s",
"probably",
"a",
"good",
"idea",
"to",
"run",
"this",
"at",
"the",
"beginning",
"of",
"a",
"run",
"as",
"any",
"set",
"calls",
"will",
"change",
"the",
"value",
"this",
"ultimately",
"calculates",
"."
] | [
"func",
"(",
"r",
"*",
"Subresource",
")",
"Hash",
"(",
")",
"int",
"{",
"hf",
":=",
"schema",
".",
"HashResource",
"(",
"&",
"schema",
".",
"<mask>",
"{",
"Schema",
":",
"r",
".",
"schema",
"}",
")",
"\n",
"return",
"hf",
"(",
"r",
".",
"data",
")",
"\n",
"}"
] |
12,245 | all-12246 | [
"CloseNotify",
"tries",
"to",
"use",
"the",
"original",
"http",
".",
"ResponseWriter",
"for",
"close",
"notification",
".",
"If",
"the",
"original",
"writer",
"doesn",
"t",
"implement",
"http",
".",
"CloseNotifier",
"it",
"returns",
"a",
"channel",
"that",
"will",
"never",
"close",
"."
] | [
"func",
"(",
"w",
"*",
"ResponseWrapper",
")",
"CloseNotify",
"(",
")",
"<-",
"chan",
"bool",
"{",
"if",
"notifier",
",",
"ok",
":=",
"w",
".",
"<mask>",
".",
"(",
"http",
".",
"CloseNotifier",
")",
";",
"ok",
"{",
"c",
":=",
"notifier",
".",
"CloseNotify",
"(",
")",
"\n",
"return",
"c",
"\n",
"}",
"\n\n",
"return",
"make",
"(",
"chan",
"bool",
")",
"\n",
"}"
] |
12,246 | all-12247 | [
"/",
"*",
"Similar",
"to",
"[",
"NewEvaluableExpression",
"]",
"except",
"enables",
"the",
"use",
"of",
"user",
"-",
"defined",
"functions",
".",
"Functions",
"passed",
"into",
"this",
"will",
"be",
"available",
"to",
"the",
"expression",
"."
] | [
"func",
"NewEvaluableExpressionWithFunctions",
"(",
"expression",
"string",
",",
"functions",
"map",
"[",
"string",
"]",
"ExpressionFunction",
")",
"(",
"*",
"EvaluableExpression",
",",
"error",
")",
"{",
"var",
"ret",
"*",
"EvaluableExpression",
"\n",
"<mask>",
"err",
"error",
"\n\n",
"ret",
"=",
"new",
"(",
"EvaluableExpression",
")",
"\n",
"ret",
".",
"QueryDateFormat",
"=",
"isoDateFormat",
"\n",
"ret",
".",
"inputExpression",
"=",
"expression",
"\n\n",
"ret",
".",
"tokens",
",",
"err",
"=",
"parseTokens",
"(",
"expression",
",",
"functions",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"checkBalance",
"(",
"ret",
".",
"tokens",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"checkExpressionSyntax",
"(",
"ret",
".",
"tokens",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"ret",
".",
"tokens",
",",
"err",
"=",
"optimizeTokens",
"(",
"ret",
".",
"tokens",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"ret",
".",
"evaluationStages",
",",
"err",
"=",
"planStages",
"(",
"ret",
".",
"tokens",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"ret",
".",
"ChecksTypes",
"=",
"true",
"\n",
"return",
"ret",
",",
"nil",
"\n",
"}"
] |
12,247 | all-12248 | [
"CancelRotateSecret",
"indicates",
"an",
"expected",
"call",
"of",
"CancelRotateSecret"
] | [
"func",
"(",
"mr",
"*",
"MockSecretsManagerAPIMockRecorder",
")",
"CancelRotateSecret",
"(",
"arg0",
"<mask>",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"MockSecretsManagerAPI",
")",
"(",
"nil",
")",
".",
"CancelRotateSecret",
")",
",",
"arg0",
")",
"\n",
"}"
] |
12,248 | all-12249 | [
"NewGraphicContext",
"creates",
"a",
"new",
"Graphic",
"context",
"from",
"an",
"image",
"."
] | [
"func",
"NewGraphicContext",
"(",
"width",
",",
"height",
"int",
")",
"*",
"GraphicContext",
"{",
"gc",
":=",
"&",
"GraphicContext",
"{",
"draw2dbase",
".",
"NewStackGraphicContext",
"(",
")",
",",
"NewPainter",
"(",
")",
",",
"raster",
".",
"NewRasterizer",
"(",
"width",
",",
"height",
")",
",",
"raster",
".",
"NewRasterizer",
"(",
"<mask>",
",",
"height",
")",
",",
"draw2d",
".",
"GetGlobalFontCache",
"(",
")",
",",
"draw2dbase",
".",
"NewGlyphCache",
"(",
")",
",",
"&",
"truetype",
".",
"GlyphBuf",
"{",
"}",
",",
"92",
",",
"}",
"\n",
"return",
"gc",
"\n",
"}"
] |
12,249 | all-12250 | [
"record",
"the",
"GL",
"time",
"into",
"a",
"query",
"object",
"after",
"all",
"previous",
"commands",
"have",
"reached",
"the",
"GL",
"server",
"but",
"have",
"not",
"yet",
"necessarily",
"executed",
"."
] | [
"func",
"QueryCounter",
"(",
"id",
"uint32",
",",
"target",
"uint32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpQueryCounter",
",",
"2",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"target",
")",
",",
"0",
")",
"\n",
"}"
] |
12,250 | all-12251 | [
"SetLogoIconName",
"is",
"a",
"wrapper",
"around",
"gtk_about_dialog_set_logo_icon_name",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"AboutDialog",
")",
"SetLogoIconName",
"(",
"<mask>",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_about_dialog_set_logo_icon_name",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
12,251 | all-12252 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetLayoutMetricsReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage36",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
12,252 | all-12253 | [
"LoadFile",
"parses",
"the",
"given",
"YAML",
"file",
"into",
"a",
"Config",
"."
] | [
"func",
"LoadFile",
"(",
"filename",
"string",
")",
"(",
"*",
"Config",
",",
"error",
")",
"{",
"content",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"cfg",
",",
"err",
":=",
"Load",
"(",
"string",
"(",
"content",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"filename",
")",
"\n",
"}",
"\n",
"resolveFilepaths",
"(",
"filepath",
".",
"Dir",
"(",
"filename",
")",
",",
"cfg",
")",
"\n",
"return",
"cfg",
",",
"nil",
"\n",
"}"
] |
12,253 | all-12254 | [
"This",
"is",
"entirely",
"optional",
"but",
"I",
"wanted",
"to",
"demonstrate",
"how",
"you",
"could",
"easily",
"add",
"your",
"own",
"logic",
"to",
"the",
"render",
".",
"Respond",
"method",
"."
] | [
"func",
"init",
"(",
")",
"{",
"render",
".",
"Respond",
"=",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"v",
"interface",
"{",
"}",
")",
"{",
"if",
"err",
",",
"ok",
":=",
"v",
".",
"(",
"error",
")",
";",
"ok",
"{",
"// We set a default error status response code if one hasn't been set.",
"if",
"_",
",",
"ok",
":=",
"r",
".",
"Context",
"(",
")",
".",
"Value",
"(",
"render",
".",
"StatusCtxKey",
")",
".",
"(",
"int",
")",
";",
"!",
"ok",
"{",
"w",
".",
"WriteHeader",
"(",
"400",
")",
"\n",
"}",
"\n\n",
"// We log the error",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"err",
".",
"<mask>",
"(",
")",
")",
"\n\n",
"// We change the response to not reveal the actual error message,",
"// instead we can transform the message something more friendly or mapped",
"// to some code / language, etc.",
"render",
".",
"DefaultResponder",
"(",
"w",
",",
"r",
",",
"render",
".",
"M",
"{",
"\"",
"\"",
":",
"\"",
"\"",
"}",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"render",
".",
"DefaultResponder",
"(",
"w",
",",
"r",
",",
"v",
")",
"\n",
"}",
"\n",
"}"
] |
12,254 | all-12255 | [
"BaseUrl",
"returns",
"a",
"new",
"URL",
"object",
"with",
"the",
"Host",
"and",
"Scheme",
"taken",
"from",
"the",
"request",
".",
"(",
"without",
"the",
"trailing",
"slash",
"in",
"the",
"host",
")"
] | [
"func",
"(",
"r",
"*",
"Request",
")",
"BaseUrl",
"(",
")",
"*",
"url",
".",
"URL",
"{",
"scheme",
":=",
"r",
".",
"URL",
".",
"Scheme",
"\n",
"if",
"scheme",
"==",
"\"",
"\"",
"{",
"scheme",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"// HTTP sometimes gives the default scheme as HTTP even when used with TLS",
"// Check if TLS is not nil and given back https scheme",
"if",
"scheme",
"==",
"\"",
"\"",
"&&",
"r",
".",
"TLS",
"!=",
"nil",
"{",
"scheme",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"host",
":=",
"r",
".",
"Host",
"\n",
"if",
"len",
"(",
"<mask>",
")",
">",
"0",
"&&",
"host",
"[",
"len",
"(",
"host",
")",
"-",
"1",
"]",
"==",
"'/'",
"{",
"host",
"=",
"host",
"[",
":",
"len",
"(",
"host",
")",
"-",
"1",
"]",
"\n",
"}",
"\n\n",
"return",
"&",
"url",
".",
"URL",
"{",
"Scheme",
":",
"scheme",
",",
"Host",
":",
"host",
",",
"}",
"\n",
"}"
] |
12,255 | all-12256 | [
"Ctx",
"..."
] | [
"func",
"Ctx",
"(",
"ctx",
"context",
".",
"Context",
",",
"info",
"*",
"grpc",
".",
"UnaryServerInfo",
",",
"code",
"codes",
".",
"Code",
")",
"zapcore",
".",
"Field",
"{",
"logCtx",
":=",
"Context",
"{",
"HTTPRequest",
":",
"HTTPRequest",
"{",
"Method",
":",
"info",
".",
"FullMethod",
",",
"ResponseStatusCode",
":",
"code",
".",
"String",
"(",
")",
",",
"}",
",",
"}",
"\n",
"if",
"p",
",",
"ok",
":=",
"peer",
".",
"FromContext",
"(",
"ctx",
")",
";",
"<mask>",
"{",
"logCtx",
".",
"HTTPRequest",
".",
"RemoteIP",
"=",
"p",
".",
"Addr",
".",
"String",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"zap",
".",
"Object",
"(",
"\"",
"\"",
",",
"logCtx",
")",
"\n",
"}"
] |
12,256 | all-12257 | [
"HandleMethod",
"registers",
"handler",
"funcs",
"with",
"the",
"given",
"pattern",
"and",
"method",
"."
] | [
"func",
"(",
"r",
"*",
"Route",
")",
"HandleMethod",
"(",
"pat",
",",
"method",
"string",
",",
"f",
"...",
"HandlerFunc",
")",
"{",
"entry",
":=",
"r",
".",
"addPattern",
"(",
"pat",
")",
"\n",
"<mask>",
":=",
"batchRoute",
"(",
"f",
")",
"\n",
"if",
"err",
":=",
"entry",
".",
"SetMethodHandler",
"(",
"method",
",",
"batch",
")",
";",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"}"
] |
12,257 | all-12258 | [
"Set",
"is",
"required",
"for",
"kingpin",
"interfaces",
"to",
"allow",
"command",
"line",
"params",
"to",
"be",
"set",
"to",
"our",
"map",
"datatype"
] | [
"func",
"(",
"o",
"*",
"ListIntOption",
")",
"Set",
"(",
"value",
"string",
")",
"error",
"{",
"val",
":=",
"IntOption",
"{",
"}",
"\n",
"val",
".",
"Set",
"(",
"<mask>",
")",
"\n",
"*",
"o",
"=",
"append",
"(",
"*",
"o",
",",
"val",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
12,258 | all-12259 | [
"Get",
"a",
"list",
"of",
"all",
"clients",
".",
"With",
"prefix",
"only",
"clients",
"for",
"which",
"it",
"is",
"a",
"prefix",
"of",
"the",
"clientId",
"are",
"returned",
".",
"By",
"default",
"this",
"end",
"-",
"point",
"will",
"try",
"to",
"return",
"up",
"to",
"1000",
"clients",
"in",
"one",
"request",
".",
"But",
"it",
"**",
"may",
"return",
"less",
"even",
"none",
"**",
".",
"It",
"may",
"also",
"return",
"a",
"continuationToken",
"even",
"though",
"there",
"are",
"no",
"more",
"results",
".",
"However",
"you",
"can",
"only",
"be",
"sure",
"to",
"have",
"seen",
"all",
"results",
"if",
"you",
"keep",
"calling",
"listClients",
"with",
"the",
"last",
"continuationToken",
"until",
"you",
"get",
"a",
"result",
"without",
"a",
"continuationToken",
".",
"See",
"#listClients"
] | [
"func",
"(",
"auth",
"*",
"Auth",
")",
"ListClients",
"(",
"continuationToken",
",",
"limit",
",",
"prefix",
"string",
")",
"(",
"*",
"ListClientResponse",
",",
"error",
")",
"{",
"v",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"if",
"continuationToken",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"continuationToken",
")",
"\n",
"}",
"\n",
"if",
"limit",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"limit",
")",
"\n",
"}",
"\n",
"if",
"prefix",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"prefix",
")",
"\n",
"}",
"\n",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"auth",
")",
"\n",
"responseObject",
",",
"_",
",",
"err",
":=",
"(",
"&",
"<mask>",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"new",
"(",
"ListClientResponse",
")",
",",
"v",
")",
"\n",
"return",
"responseObject",
".",
"(",
"*",
"ListClientResponse",
")",
",",
"err",
"\n",
"}"
] |
12,259 | all-12260 | [
"GetTitleSizeOk",
"returns",
"a",
"tuple",
"with",
"the",
"TitleSize",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"d",
"*",
"DistributionDefinition",
")",
"GetTitleSizeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"d",
"==",
"nil",
"||",
"d",
".",
"TitleSize",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"d",
".",
"TitleSize",
",",
"<mask>",
"\n",
"}"
] |
12,260 | all-12261 | [
"GetImageStateFromImageName",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockImageManager",
")",
"GetImageStateFromImageName",
"(",
"arg0",
"string",
")",
"(",
"*",
"image",
".",
"ImageState",
",",
"bool",
")",
"{",
"<mask>",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"image",
".",
"ImageState",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"bool",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
12,261 | all-12262 | [
"NewPage",
"returns",
"a",
"*",
"Page",
"that",
"corresponds",
"to",
"a",
"new",
"WebDriver",
"session",
".",
"Provided",
"Options",
"configure",
"the",
"page",
".",
"For",
"instance",
"to",
"disable",
"JavaScript",
":",
"capabilities",
":",
"=",
"agouti",
".",
"NewCapabilities",
"()",
".",
"Without",
"(",
"javascriptEnabled",
")",
"driver",
".",
"NewPage",
"(",
"agouti",
".",
"Desired",
"(",
"capabilities",
"))",
"For",
"Selenium",
"a",
"Browser",
"Option",
"(",
"or",
"a",
"Desired",
"Option",
"with",
"Capabilities",
"that",
"specify",
"a",
"Browser",
")",
"must",
"be",
"provided",
".",
"For",
"instance",
":",
"seleniumDriver",
".",
"NewPage",
"(",
"agouti",
".",
"Browser",
"(",
"safari",
"))",
"Specific",
"Options",
"(",
"such",
"as",
"Browser",
")",
"have",
"precedence",
"over",
"Capabilities",
"specified",
"by",
"the",
"Desired",
"Option",
".",
"The",
"HTTPClient",
"Option",
"will",
"be",
"ignored",
"if",
"passed",
"to",
"this",
"function",
".",
"New",
"pages",
"will",
"always",
"use",
"the",
"*",
"http",
".",
"Client",
"provided",
"to",
"their",
"WebDriver",
"or",
"http",
".",
"DefaultClient",
"if",
"none",
"was",
"provided",
"."
] | [
"func",
"(",
"w",
"*",
"WebDriver",
")",
"NewPage",
"(",
"options",
"...",
"Option",
")",
"(",
"*",
"Page",
",",
"error",
")",
"{",
"newOptions",
":=",
"w",
".",
"defaultOptions",
".",
"Merge",
"(",
"<mask>",
")",
"\n",
"session",
",",
"err",
":=",
"w",
".",
"Open",
"(",
"newOptions",
".",
"Capabilities",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"newPage",
"(",
"session",
")",
",",
"nil",
"\n",
"}"
] |
12,262 | all-12263 | [
"specify",
"the",
"line",
"stipple",
"pattern"
] | [
"func",
"LineStipple",
"(",
"factor",
"int32",
",",
"pattern",
"uint16",
")",
"{",
"C",
".",
"glowLineStipple",
"(",
"gpLineStipple",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLushort",
")",
"(",
"pattern",
")",
")",
"\n",
"}"
] |
12,263 | all-12264 | [
"GenerateTemplate",
"takes",
"a",
"template",
"name",
"and",
"data",
"and",
"generates",
"the",
"corresponding",
"string",
"."
] | [
"func",
"GenerateTemplate",
"(",
"templ",
",",
"name",
"string",
",",
"data",
"interface",
"{",
"}",
")",
"(",
"string",
",",
"error",
")",
"{",
"buf",
":=",
"bytes",
".",
"NewBufferString",
"(",
"\"",
"\"",
")",
"\n",
"if",
"messageTempl",
",",
"err",
":=",
"<mask>",
".",
"New",
"(",
"name",
")",
".",
"Parse",
"(",
"templ",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
",",
"err",
")",
"\n",
"}",
"else",
"if",
"err",
":=",
"messageTempl",
".",
"Execute",
"(",
"buf",
",",
"data",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"buf",
".",
"String",
"(",
")",
",",
"nil",
"\n",
"}"
] |
12,264 | all-12265 | [
"FirstByLabel",
"finds",
"the",
"first",
"element",
"by",
"associated",
"label",
"text",
"."
] | [
"func",
"(",
"s",
"*",
"selectable",
")",
"FirstByLabel",
"(",
"text",
"string",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"Label",
",",
"<mask>",
")",
".",
"At",
"(",
"0",
")",
")",
"\n",
"}"
] |
12,265 | all-12266 | [
"NewChangeTrustResult",
"creates",
"a",
"new",
"ChangeTrustResult",
"."
] | [
"func",
"NewChangeTrustResult",
"(",
"code",
"ChangeTrustResultCode",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"ChangeTrustResult",
",",
"err",
"error",
")",
"{",
"result",
".",
"Code",
"=",
"code",
"\n",
"switch",
"ChangeTrustResultCode",
"(",
"code",
")",
"{",
"<mask>",
"ChangeTrustResultCodeChangeTrustSuccess",
":",
"// void",
"default",
":",
"// void",
"}",
"\n",
"return",
"\n",
"}"
] |
12,266 | all-12267 | [
"MergeMultipleProfiles",
"merges",
"more",
"than",
"two",
"profiles",
"together",
".",
"MergeMultipleProfiles",
"is",
"equivalent",
"to",
"calling",
"MergeProfiles",
"on",
"pairs",
"of",
"profiles",
"until",
"only",
"one",
"profile",
"remains",
"."
] | [
"func",
"MergeMultipleProfiles",
"(",
"profiles",
"[",
"]",
"[",
"]",
"*",
"cover",
".",
"Profile",
")",
"(",
"[",
"]",
"*",
"cover",
".",
"Profile",
",",
"error",
")",
"{",
"if",
"len",
"(",
"profiles",
")",
"<",
"1",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"result",
":=",
"profiles",
"[",
"0",
"]",
"\n",
"for",
"_",
",",
"profile",
":=",
"range",
"profiles",
"[",
"1",
":",
"]",
"{",
"var",
"err",
"error",
"\n",
"if",
"result",
",",
"err",
"=",
"MergeProfiles",
"(",
"result",
",",
"profile",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}"
] |
12,267 | all-12268 | [
"UnmarshalJSON",
"implements",
"json",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"r",
"*",
"Response",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"type",
"tmpType",
"Response",
"\n\n",
"// Detect if the \"result\" field is JSON \"null\" or just not present",
"// by seeing if the field gets overwritten to nil.",
"*",
"r",
"=",
"Response",
"{",
"Result",
":",
"&",
"json",
".",
"RawMessage",
"{",
"}",
"}",
"\n\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"(",
"*",
"tmpType",
")",
"(",
"r",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"r",
".",
"Result",
"==",
"nil",
"{",
"// JSON \"null\"",
"r",
".",
"<mask>",
"=",
"&",
"jsonNull",
"\n",
"}",
"else",
"if",
"len",
"(",
"*",
"r",
".",
"Result",
")",
"==",
"0",
"{",
"r",
".",
"Result",
"=",
"nil",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
12,268 | all-12269 | [
"ListBuildArtifacts",
"fetches",
"the",
"build",
"artifacts",
"for",
"the",
"given",
"build"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListBuildArtifacts",
"(",
"account",
",",
"repo",
"string",
",",
"buildNum",
"int",
")",
"(",
"[",
"]",
"*",
"Artifact",
",",
"error",
")",
"{",
"artifacts",
":=",
"[",
"]",
"*",
"Artifact",
"{",
"}",
"\n\n",
"err",
":=",
"c",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"account",
",",
"repo",
",",
"buildNum",
")",
",",
"&",
"artifacts",
",",
"nil",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"artifacts",
",",
"nil",
"\n",
"}"
] |
12,269 | all-12270 | [
"SendMessage",
"is",
"a",
"convenience",
"wrapper",
"around",
"Create",
"."
] | [
"func",
"(",
"m",
"*",
"MessageService",
")",
"SendMessage",
"(",
"from",
"string",
",",
"to",
"string",
",",
"body",
"string",
",",
"mediaURLs",
"[",
"]",
"*",
"url",
".",
"URL",
")",
"(",
"*",
"Message",
",",
"error",
")",
"{",
"v",
":=",
"url",
".",
"Values",
"{",
"\"",
"\"",
":",
"[",
"]",
"string",
"{",
"<mask>",
"}",
",",
"\"",
"\"",
":",
"[",
"]",
"string",
"{",
"from",
"}",
",",
"\"",
"\"",
":",
"[",
"]",
"string",
"{",
"to",
"}",
",",
"}",
"\n",
"if",
"mediaURLs",
"!=",
"nil",
"{",
"for",
"_",
",",
"mediaURL",
":=",
"range",
"mediaURLs",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"mediaURL",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"m",
".",
"Create",
"(",
"context",
".",
"Background",
"(",
")",
",",
"v",
")",
"\n",
"}"
] |
12,270 | all-12271 | [
"ContainerInspect",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockClient",
")",
"ContainerInspect",
"(",
"arg0",
"context",
".",
"Context",
",",
"arg1",
"string",
")",
"(",
"types",
".",
"ContainerJSON",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"<mask>",
".",
"ContainerJSON",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
12,271 | all-12272 | [
"Draw",
"draws",
"the",
"path",
"by",
"rendering",
"its",
"stroke",
"or",
"filling",
"."
] | [
"func",
"(",
"p",
"*",
"Path",
")",
"Draw",
"(",
"target",
"*",
"ebiten",
".",
"Image",
",",
"op",
"*",
"DrawPathOptions",
")",
"{",
"if",
"op",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"// TODO: Implement filling",
"if",
"op",
".",
"StrokeColor",
"!=",
"nil",
"{",
"<mask>",
",",
"is",
":=",
"p",
".",
"strokeVertices",
"(",
"op",
".",
"LineWidth",
",",
"op",
".",
"StrokeColor",
")",
"\n",
"op",
":=",
"&",
"ebiten",
".",
"DrawTrianglesOptions",
"{",
"}",
"\n",
"op",
".",
"Address",
"=",
"ebiten",
".",
"AddressRepeat",
"\n",
"target",
".",
"DrawTriangles",
"(",
"vs",
",",
"is",
",",
"emptyImage",
",",
"op",
")",
"\n",
"}",
"\n",
"}"
] |
12,272 | all-12273 | [
"NewState",
"returns",
"a",
"new",
"State",
"object",
"with",
"the",
"given",
"database",
"and",
"operating",
"system",
"components",
"."
] | [
"func",
"NewState",
"(",
"node",
"*",
"db",
".",
"Node",
",",
"cluster",
"*",
"db",
".",
"Cluster",
",",
"maas",
"*",
"maas",
".",
"Controller",
",",
"<mask>",
"*",
"sys",
".",
"OS",
",",
"endpoints",
"*",
"endpoints",
".",
"Endpoints",
")",
"*",
"State",
"{",
"return",
"&",
"State",
"{",
"Node",
":",
"node",
",",
"Cluster",
":",
"cluster",
",",
"MAAS",
":",
"maas",
",",
"OS",
":",
"os",
",",
"Endpoints",
":",
"endpoints",
",",
"}",
"\n",
"}"
] |
12,273 | all-12274 | [
"Sign",
"signs",
"an",
"HTTP",
"request",
"with",
"the",
"given",
"S3",
"keys",
"for",
"use",
"on",
"service",
"s",
"."
] | [
"func",
"(",
"s",
"*",
"Service",
")",
"Sign",
"(",
"r",
"*",
"http",
".",
"Request",
",",
"k",
"Keys",
")",
"{",
"if",
"k",
".",
"SecurityToken",
"!=",
"\"",
"\"",
"{",
"r",
".",
"Header",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"k",
".",
"SecurityToken",
")",
"\n",
"}",
"\n",
"h",
":=",
"hmac",
".",
"New",
"(",
"sha1",
".",
"New",
",",
"[",
"]",
"byte",
"(",
"k",
".",
"SecretKey",
")",
")",
"\n",
"s",
".",
"writeSigData",
"(",
"h",
",",
"r",
")",
"\n",
"sig",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"base64",
".",
"StdEncoding",
".",
"EncodedLen",
"(",
"h",
".",
"Size",
"(",
")",
")",
")",
"\n",
"base64",
".",
"StdEncoding",
".",
"Encode",
"(",
"sig",
",",
"h",
".",
"Sum",
"(",
"nil",
")",
")",
"\n",
"r",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"k",
".",
"AccessKey",
"+",
"\"",
"\"",
"+",
"string",
"(",
"sig",
")",
")",
"\n",
"}"
] |
12,274 | all-12275 | [
"RegisterInstance",
"creates",
"a",
"new",
"instance",
"in",
"given",
"service",
"."
] | [
"func",
"(",
"p",
"*",
"AWSSDProvider",
")",
"RegisterInstance",
"(",
"service",
"*",
"sd",
".",
"Service",
",",
"ep",
"*",
"endpoint",
".",
"Endpoint",
")",
"error",
"{",
"for",
"_",
",",
"target",
":=",
"range",
"ep",
".",
"Targets",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"target",
",",
"*",
"service",
".",
"Name",
",",
"*",
"service",
".",
"Id",
")",
"\n\n",
"attr",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"string",
")",
"\n\n",
"if",
"ep",
".",
"RecordType",
"==",
"endpoint",
".",
"RecordTypeCNAME",
"{",
"if",
"p",
".",
"isAWSLoadBalancer",
"(",
"target",
")",
"{",
"attr",
"[",
"sdInstanceAttrAlias",
"]",
"=",
"aws",
".",
"String",
"(",
"target",
")",
"\n",
"}",
"else",
"{",
"attr",
"[",
"sdInstanceAttrCname",
"]",
"=",
"aws",
".",
"String",
"(",
"<mask>",
")",
"\n",
"}",
"\n",
"}",
"else",
"if",
"ep",
".",
"RecordType",
"==",
"endpoint",
".",
"RecordTypeA",
"{",
"attr",
"[",
"sdInstanceAttrIPV4",
"]",
"=",
"aws",
".",
"String",
"(",
"target",
")",
"\n",
"}",
"else",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ep",
")",
"\n",
"}",
"\n\n",
"if",
"!",
"p",
".",
"dryRun",
"{",
"_",
",",
"err",
":=",
"p",
".",
"client",
".",
"RegisterInstance",
"(",
"&",
"sd",
".",
"RegisterInstanceInput",
"{",
"ServiceId",
":",
"service",
".",
"Id",
",",
"Attributes",
":",
"attr",
",",
"InstanceId",
":",
"aws",
".",
"String",
"(",
"p",
".",
"targetToInstanceID",
"(",
"target",
")",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
12,275 | all-12276 | [
"EnableLevelColor",
"enables",
"color",
"output"
] | [
"func",
"(",
"g",
"*",
"Glg",
")",
"EnableLevelColor",
"(",
"lv",
"LEVEL",
")",
"*",
"Glg",
"{",
"ins",
",",
"ok",
":=",
"g",
".",
"logger",
".",
"Load",
"(",
"lv",
")",
"\n",
"if",
"ok",
"{",
"l",
":=",
"<mask>",
".",
"(",
"*",
"logger",
")",
"\n",
"l",
".",
"isColor",
"=",
"true",
"\n",
"l",
".",
"updateMode",
"(",
")",
"\n",
"g",
".",
"logger",
".",
"Store",
"(",
"lv",
",",
"l",
")",
"\n",
"}",
"\n",
"return",
"g",
"\n",
"}"
] |
12,276 | all-12277 | [
"Logger",
"defines",
"the",
"logger",
"to",
"be",
"used",
"whenever",
"detailed",
"messages",
"have",
"to",
"be",
"printed",
"out",
"."
] | [
"func",
"Logger",
"(",
"l",
"<mask>",
".",
"Logger",
")",
"Option",
"{",
"return",
"Option",
"{",
"func",
"(",
"o",
"*",
"options",
")",
"{",
"o",
".",
"logger",
"=",
"l",
"\n",
"}",
"}",
"\n",
"}"
] |
12,277 | all-12278 | [
"NotEqual",
"checks",
"inequality",
"of",
"two",
"values",
"."
] | [
"func",
"NotEqual",
"(",
"tb",
"testing",
".",
"TB",
",",
"expected",
"interface",
"{",
"}",
",",
"<mask>",
"interface",
"{",
"}",
",",
"msgAndArgs",
"...",
"interface",
"{",
"}",
")",
"{",
"tb",
".",
"Helper",
"(",
")",
"\n",
"if",
"reflect",
".",
"DeepEqual",
"(",
"expected",
",",
"actual",
")",
"{",
"fatal",
"(",
"tb",
",",
"msgAndArgs",
",",
"\"",
"\\n",
"\"",
"+",
"\"",
"\"",
",",
"expected",
",",
"actual",
")",
"\n",
"}",
"\n",
"}"
] |
12,278 | all-12279 | [
"TryReusingBlob",
"checks",
"whether",
"the",
"transport",
"already",
"contains",
"or",
"can",
"efficiently",
"reuse",
"a",
"blob",
"and",
"if",
"so",
"applies",
"it",
"to",
"the",
"current",
"destination",
"(",
"e",
".",
"g",
".",
"if",
"the",
"blob",
"is",
"a",
"filesystem",
"layer",
"this",
"signifies",
"that",
"the",
"changes",
"it",
"describes",
"need",
"to",
"be",
"applied",
"again",
"when",
"composing",
"a",
"filesystem",
"tree",
")",
".",
"info",
".",
"Digest",
"must",
"not",
"be",
"empty",
".",
"If",
"canSubstitute",
"TryReusingBlob",
"can",
"use",
"an",
"equivalent",
"equivalent",
"of",
"the",
"desired",
"blob",
";",
"in",
"that",
"case",
"the",
"returned",
"info",
"may",
"not",
"match",
"the",
"input",
".",
"If",
"the",
"blob",
"has",
"been",
"succesfully",
"reused",
"returns",
"(",
"true",
"info",
"nil",
")",
";",
"info",
"must",
"contain",
"at",
"least",
"a",
"digest",
"and",
"size",
".",
"If",
"the",
"transport",
"can",
"not",
"reuse",
"the",
"requested",
"blob",
"TryReusingBlob",
"returns",
"(",
"false",
"{}",
"nil",
")",
";",
"it",
"returns",
"a",
"non",
"-",
"nil",
"error",
"only",
"on",
"an",
"unexpected",
"failure",
".",
"May",
"use",
"and",
"/",
"or",
"update",
"cache",
"."
] | [
"func",
"(",
"d",
"*",
"ociImageDestination",
")",
"TryReusingBlob",
"(",
"ctx",
"context",
".",
"Context",
",",
"info",
"types",
".",
"BlobInfo",
",",
"cache",
"types",
".",
"BlobInfoCache",
",",
"canSubstitute",
"bool",
")",
"(",
"bool",
",",
"types",
".",
"BlobInfo",
",",
"error",
")",
"{",
"if",
"info",
".",
"Digest",
"==",
"\"",
"\"",
"{",
"return",
"false",
",",
"types",
".",
"BlobInfo",
"{",
"}",
",",
"errors",
".",
"Errorf",
"(",
"`\"Can not check for a blob with unknown digest`",
")",
"\n",
"}",
"\n",
"blobPath",
",",
"err",
":=",
"d",
".",
"ref",
".",
"blobPath",
"(",
"info",
".",
"Digest",
",",
"d",
".",
"sharedBlobDir",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"types",
".",
"BlobInfo",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"finfo",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"blobPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"false",
",",
"<mask>",
".",
"BlobInfo",
"{",
"}",
",",
"nil",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"types",
".",
"BlobInfo",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"return",
"true",
",",
"types",
".",
"BlobInfo",
"{",
"Digest",
":",
"info",
".",
"Digest",
",",
"Size",
":",
"finfo",
".",
"Size",
"(",
")",
"}",
",",
"nil",
"\n",
"}"
] |
12,279 | all-12280 | [
"NewServer",
"returns",
"a",
"Server",
"that",
"(",
"partially",
")",
"implements",
"the",
"etcd",
"V3",
"API",
".",
"It",
"uses",
"the",
"passed",
"mesh",
"components",
"to",
"act",
"as",
"the",
"Raft",
"transport",
".",
"For",
"the",
"moment",
"it",
"blocks",
"until",
"the",
"mesh",
"has",
"minPeerCount",
"peers",
".",
"(",
"This",
"responsibility",
"should",
"rather",
"be",
"given",
"to",
"the",
"caller",
".",
")",
"The",
"server",
"can",
"be",
"terminated",
"by",
"certain",
"conditions",
"in",
"the",
"cluster",
".",
"If",
"that",
"happens",
"terminatedc",
"signaled",
"and",
"the",
"server",
"is",
"invalid",
"."
] | [
"func",
"NewServer",
"(",
"router",
"*",
"mesh",
".",
"Router",
",",
"<mask>",
"*",
"meshconn",
".",
"Peer",
",",
"minPeerCount",
"int",
",",
"terminatec",
"<-",
"chan",
"struct",
"{",
"}",
",",
"terminatedc",
"chan",
"<-",
"error",
",",
"logger",
"mesh",
".",
"Logger",
",",
")",
"Server",
"{",
"c",
":=",
"make",
"(",
"chan",
"Server",
")",
"\n",
"go",
"serverManager",
"(",
"router",
",",
"peer",
",",
"minPeerCount",
",",
"terminatec",
",",
"terminatedc",
",",
"logger",
",",
"c",
")",
"\n",
"return",
"<-",
"c",
"\n",
"}"
] |
12,280 | all-12281 | [
"findControllerInfo",
"determines",
"the",
"normalized",
"unit",
"number",
"for",
"the",
"disk",
"device",
"based",
"on",
"the",
"SCSI",
"controller",
"and",
"unit",
"number",
"it",
"s",
"connected",
"to",
".",
"The",
"controller",
"is",
"also",
"returned",
"."
] | [
"func",
"(",
"r",
"*",
"Subresource",
")",
"findControllerInfo",
"(",
"l",
"object",
".",
"VirtualDeviceList",
",",
"disk",
"*",
"types",
".",
"VirtualDisk",
")",
"(",
"int",
",",
"types",
".",
"BaseVirtualController",
",",
"error",
")",
"{",
"ctlr",
":=",
"l",
".",
"FindByKey",
"(",
"disk",
".",
"ControllerKey",
")",
"\n",
"if",
"ctlr",
"==",
"nil",
"{",
"return",
"-",
"1",
",",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"disk",
".",
"ControllerKey",
",",
"disk",
".",
"<mask>",
")",
"\n",
"}",
"\n",
"if",
"disk",
".",
"UnitNumber",
"==",
"nil",
"{",
"return",
"-",
"1",
",",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"disk",
".",
"Key",
")",
"\n",
"}",
"\n",
"sc",
",",
"ok",
":=",
"ctlr",
".",
"(",
"types",
".",
"BaseVirtualSCSIController",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"-",
"1",
",",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ctlr",
".",
"GetVirtualDevice",
"(",
")",
".",
"Key",
",",
"ctlr",
")",
"\n",
"}",
"\n",
"unit",
":=",
"*",
"disk",
".",
"UnitNumber",
"\n",
"if",
"unit",
">",
"sc",
".",
"GetVirtualSCSIController",
"(",
")",
".",
"ScsiCtlrUnitNumber",
"{",
"unit",
"--",
"\n",
"}",
"\n",
"unit",
"=",
"unit",
"+",
"15",
"*",
"sc",
".",
"GetVirtualSCSIController",
"(",
")",
".",
"BusNumber",
"\n",
"return",
"int",
"(",
"unit",
")",
",",
"ctlr",
".",
"(",
"types",
".",
"BaseVirtualController",
")",
",",
"nil",
"\n",
"}"
] |
12,281 | all-12282 | [
"mode",
"returns",
"the",
"mode",
"of",
"the",
"path",
"."
] | [
"func",
"mode",
"(",
"path",
"string",
")",
"<mask>",
".",
"FileMode",
"{",
"if",
"fi",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"path",
")",
";",
"err",
"==",
"nil",
"{",
"return",
"fi",
".",
"Mode",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"0",
"\n",
"}"
] |
12,282 | all-12283 | [
"Timer",
"fetches",
"an",
"instrument",
"from",
"the",
"registry",
"or",
"creates",
"a",
"new",
"one",
".",
"If",
"another",
"instrument",
"type",
"is",
"already",
"registered",
"with",
"the",
"same",
"name",
"/",
"tags",
"a",
"blank",
"one",
"will",
"be",
"returned",
"and",
"an",
"error",
"will",
"be",
"logged",
"to",
"the",
"Errors",
"()",
"channel",
"."
] | [
"func",
"(",
"r",
"*",
"Registry",
")",
"Timer",
"(",
"<mask>",
"string",
",",
"tags",
"[",
"]",
"string",
")",
"*",
"Timer",
"{",
"factory",
":=",
"func",
"(",
")",
"interface",
"{",
"}",
"{",
"return",
"NewTimer",
"(",
")",
"}",
"\n",
"return",
"r",
".",
"fetchTimer",
"(",
"name",
",",
"tags",
",",
"factory",
")",
"\n",
"}"
] |
12,283 | all-12284 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventRequestWillBeSent",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork50",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
12,284 | all-12285 | [
"Expand",
"expands",
"a",
"template",
"in",
"text",
"(",
"non",
"-",
"HTML",
")",
"mode",
"."
] | [
"func",
"(",
"te",
"Expander",
")",
"Expand",
"(",
")",
"(",
"result",
"string",
",",
"resultErr",
"error",
")",
"{",
"// It'd better to have no alert description than to kill the whole process",
"// if there's a bug in the template.",
"defer",
"func",
"(",
")",
"{",
"if",
"r",
":=",
"recover",
"(",
")",
";",
"r",
"!=",
"nil",
"{",
"var",
"ok",
"bool",
"\n",
"resultErr",
",",
"ok",
"=",
"r",
".",
"(",
"error",
")",
"\n",
"if",
"!",
"ok",
"{",
"resultErr",
"=",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"te",
".",
"name",
",",
"r",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"resultErr",
"!=",
"nil",
"{",
"templateTextExpansionFailures",
".",
"Inc",
"(",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"templateTextExpansionTotal",
".",
"Inc",
"(",
")",
"\n\n",
"tmpl",
",",
"err",
":=",
"text_template",
".",
"New",
"(",
"te",
".",
"<mask>",
")",
".",
"Funcs",
"(",
"te",
".",
"funcMap",
")",
".",
"Option",
"(",
"\"",
"\"",
")",
".",
"Parse",
"(",
"te",
".",
"text",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"te",
".",
"name",
")",
"\n",
"}",
"\n",
"var",
"buffer",
"bytes",
".",
"Buffer",
"\n",
"err",
"=",
"tmpl",
".",
"Execute",
"(",
"&",
"buffer",
",",
"te",
".",
"data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"te",
".",
"name",
")",
"\n",
"}",
"\n",
"return",
"buffer",
".",
"String",
"(",
")",
",",
"nil",
"\n",
"}"
] |
12,285 | all-12286 | [
"CreateTable",
"provides",
"a",
"mock",
"function",
"with",
"given",
"fields",
":",
"table",
"sample"
] | [
"func",
"(",
"_m",
"*",
"ObjectStore",
")",
"CreateTable",
"(",
"table",
"string",
",",
"sample",
"interface",
"{",
"}",
")",
"error",
"{",
"ret",
":=",
"_m",
".",
"Called",
"(",
"<mask>",
",",
"sample",
")",
"\n\n",
"var",
"r0",
"error",
"\n",
"if",
"rf",
",",
"ok",
":=",
"ret",
".",
"Get",
"(",
"0",
")",
".",
"(",
"func",
"(",
"string",
",",
"interface",
"{",
"}",
")",
"error",
")",
";",
"ok",
"{",
"r0",
"=",
"rf",
"(",
"table",
",",
"sample",
")",
"\n",
"}",
"else",
"{",
"r0",
"=",
"ret",
".",
"Error",
"(",
"0",
")",
"\n",
"}",
"\n\n",
"return",
"r0",
"\n",
"}"
] |
12,286 | all-12287 | [
"servicePeerToHostPort",
"converts",
"a",
"Hyperbahn",
"ServicePeer",
"into",
"a",
"hostPort",
"string",
"."
] | [
"func",
"servicePeerToHostPort",
"(",
"peer",
"*",
"hyperbahn",
".",
"ServicePeer",
")",
"string",
"{",
"host",
":=",
"intToIP4",
"(",
"uint32",
"(",
"*",
"peer",
".",
"IP",
".",
"Ipv4",
")",
")",
".",
"String",
"(",
")",
"\n",
"port",
":=",
"strconv",
".",
"Itoa",
"(",
"int",
"(",
"peer",
".",
"Port",
")",
")",
"\n",
"return",
"net",
".",
"JoinHostPort",
"(",
"<mask>",
",",
"port",
")",
"\n",
"}"
] |
12,287 | all-12288 | [
"WithBody",
"adds",
"the",
"body",
"to",
"the",
"update",
"Vm",
"with",
"state",
"params"
] | [
"func",
"(",
"o",
"*",
"UpdateVMWithStateParams",
")",
"WithBody",
"(",
"body",
"*",
"models",
".",
"VMState",
")",
"*",
"UpdateVMWithStateParams",
"{",
"o",
".",
"SetBody",
"(",
"<mask>",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
12,288 | all-12289 | [
"pick",
"picks",
"a",
"chan",
"for",
"sending",
"the",
"given",
"message",
".",
"The",
"picked",
"chan",
"and",
"the",
"picked",
"chan",
"string",
"name",
"are",
"returned",
"."
] | [
"func",
"(",
"p",
"*",
"peer",
")",
"pick",
"(",
"m",
"raftpb",
".",
"Message",
")",
"(",
"writec",
"chan",
"<-",
"raftpb",
".",
"Message",
",",
"picked",
"string",
")",
"{",
"<mask>",
"ok",
"bool",
"\n",
"// Considering MsgSnap may have a big size, e.g., 1G, and will block",
"// stream for a long time, only use one of the N pipelines to send MsgSnap.",
"if",
"isMsgSnap",
"(",
"m",
")",
"{",
"return",
"p",
".",
"pipeline",
".",
"msgc",
",",
"pipelineMsg",
"\n",
"}",
"else",
"if",
"writec",
",",
"ok",
"=",
"p",
".",
"msgAppV2Writer",
".",
"writec",
"(",
")",
";",
"ok",
"&&",
"isMsgApp",
"(",
"m",
")",
"{",
"return",
"writec",
",",
"streamAppV2",
"\n",
"}",
"else",
"if",
"writec",
",",
"ok",
"=",
"p",
".",
"writer",
".",
"writec",
"(",
")",
";",
"ok",
"{",
"return",
"writec",
",",
"streamMsg",
"\n",
"}",
"\n",
"return",
"p",
".",
"pipeline",
".",
"msgc",
",",
"pipelineMsg",
"\n",
"}"
] |
12,289 | all-12290 | [
"updates",
"a",
"subset",
"of",
"a",
"buffer",
"object",
"s",
"data",
"store"
] | [
"func",
"BufferSubData",
"(",
"<mask>",
"uint32",
",",
"offset",
"int",
",",
"size",
"int",
",",
"data",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpBufferSubData",
",",
"4",
",",
"uintptr",
"(",
"target",
")",
",",
"uintptr",
"(",
"offset",
")",
",",
"uintptr",
"(",
"size",
")",
",",
"uintptr",
"(",
"data",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
12,290 | all-12291 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SendMessageToTargetParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoTarget3",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
12,291 | all-12292 | [
"MultiCloudImageMatcherLocator",
"builds",
"a",
"locator",
"from",
"the",
"given",
"href",
"."
] | [
"func",
"(",
"api",
"*",
"API",
")",
"MultiCloudImageMatcherLocator",
"(",
"href",
"<mask>",
")",
"*",
"MultiCloudImageMatcherLocator",
"{",
"return",
"&",
"MultiCloudImageMatcherLocator",
"{",
"Href",
"(",
"href",
")",
",",
"api",
"}",
"\n",
"}"
] |
12,292 | all-12293 | [
"UpdateUser",
"updates",
"a",
"user",
"with",
"the",
"content",
"of",
"user",
"and",
"returns",
"an",
"error",
"if",
"the",
"update",
"failed"
] | [
"func",
"(",
"<mask>",
"*",
"Client",
")",
"UpdateUser",
"(",
"user",
"User",
")",
"error",
"{",
"uri",
":=",
"\"",
"\"",
"+",
"*",
"user",
".",
"Handle",
"\n",
"return",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"uri",
",",
"user",
",",
"nil",
")",
"\n",
"}"
] |
12,293 | all-12294 | [
"New",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockCgroup",
")",
"New",
"(",
"arg0",
"string",
",",
"arg1",
"*",
"specs_go",
".",
"LinuxResources",
")",
"(",
"cgroups",
".",
"Cgroup",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"cgroups",
".",
"Cgroup",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
12,294 | all-12295 | [
"title",
":",
"pool",
"update",
"path",
":",
"/",
"pools",
"/",
"{",
"name",
"}",
"method",
":",
"PUT",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"responses",
":",
"200",
":",
"Pool",
"updated",
"401",
":",
"Unauthorized",
"404",
":",
"Pool",
"not",
"found",
"409",
":",
"Default",
"pool",
"already",
"defined"
] | [
"func",
"poolUpdateHandler",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermPoolUpdate",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"poolName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"event",
".",
"Target",
"{",
"Type",
":",
"event",
".",
"TargetTypePool",
",",
"Value",
":",
"poolName",
"}",
",",
"Kind",
":",
"permission",
".",
"PermPoolUpdate",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermPoolReadEvents",
",",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxPool",
",",
"poolName",
")",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"var",
"updateOpts",
"pool",
".",
"UpdatePoolOptions",
"\n",
"err",
"=",
"ParseInput",
"(",
"r",
",",
"&",
"updateOpts",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"err",
"=",
"pool",
".",
"PoolUpdate",
"(",
"poolName",
",",
"updateOpts",
")",
"\n",
"if",
"err",
"==",
"pool",
".",
"ErrPoolNotFound",
"{",
"return",
"&",
"terrors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusNotFound",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"if",
"err",
"==",
"pool",
".",
"ErrDefaultPoolAlreadyExists",
"{",
"return",
"&",
"terrors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusConflict",
",",
"Message",
":",
"err",
".",
"<mask>",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
12,295 | all-12296 | [
"use",
"stderr",
"as",
"fallback"
] | [
"func",
"getJournalWriteSyncer",
"(",
")",
"(",
"zapcore",
".",
"WriteSyncer",
",",
"error",
")",
"{",
"jw",
",",
"err",
":=",
"logutil",
".",
"NewJournalWriter",
"(",
"<mask>",
".",
"Stderr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"zapcore",
".",
"AddSync",
"(",
"jw",
")",
",",
"nil",
"\n",
"}"
] |
12,296 | all-12297 | [
"Atm",
"we",
"can",
"t",
"use",
"the",
"systemd",
"device",
"support",
"because",
"of",
"two",
"missing",
"things",
":",
"*",
"Support",
"for",
"wildcards",
"to",
"allow",
"mknod",
"on",
"any",
"device",
"*",
"Support",
"for",
"wildcards",
"to",
"allow",
"/",
"dev",
"/",
"pts",
"support",
"The",
"second",
"is",
"available",
"in",
"more",
"recent",
"systemd",
"as",
"char",
"-",
"pts",
"but",
"not",
"in",
"e",
".",
"g",
".",
"v208",
"which",
"is",
"in",
"wide",
"use",
".",
"When",
"both",
"these",
"are",
"available",
"we",
"will",
"be",
"able",
"to",
"switch",
"but",
"need",
"to",
"keep",
"the",
"old",
"implementation",
"for",
"backwards",
"compat",
".",
"Note",
":",
"we",
"can",
"t",
"use",
"systemd",
"to",
"set",
"up",
"the",
"initial",
"limits",
"and",
"then",
"change",
"the",
"cgroup",
"because",
"systemd",
"will",
"re",
"-",
"write",
"the",
"device",
"settings",
"if",
"it",
"needs",
"to",
"re",
"-",
"apply",
"the",
"cgroup",
"context",
".",
"This",
"happens",
"at",
"least",
"for",
"v208",
"when",
"any",
"sibling",
"unit",
"is",
"started",
"."
] | [
"func",
"joinDevices",
"(",
"c",
"*",
"configs",
".",
"Cgroup",
",",
"pid",
"int",
")",
"error",
"{",
"path",
",",
"err",
":=",
"<mask>",
"(",
"c",
",",
"\"",
"\"",
",",
"pid",
")",
"\n",
"// Even if it's `not found` error, we'll return err because devices cgroup",
"// is hard requirement for container security.",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"devices",
":=",
"subsystems",
"[",
"\"",
"\"",
"]",
"\n",
"return",
"devices",
".",
"Set",
"(",
"path",
",",
"c",
")",
"\n",
"}"
] |
12,297 | all-12298 | [
"retrieve",
"the",
"info",
"log",
"string",
"from",
"a",
"program",
"pipeline",
"object"
] | [
"func",
"GetProgramPipelineInfoLog",
"(",
"pipeline",
"uint32",
",",
"bufSize",
"int32",
",",
"length",
"*",
"int32",
",",
"infoLog",
"*",
"uint8",
")",
"{",
"C",
".",
"glowGetProgramPipelineInfoLog",
"(",
"gpGetProgramPipelineInfoLog",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"pipeline",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"bufSize",
")",
",",
"(",
"*",
"C",
".",
"GLsizei",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
")",
")",
",",
"(",
"*",
"C",
".",
"GLchar",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"infoLog",
")",
")",
")",
"\n",
"}"
] |
12,298 | all-12299 | [
"Returns",
"an",
"slice",
"of",
"ints",
"or",
"the",
"specified",
"slice",
"if",
"the",
"key",
"doesn",
"t",
"exist",
"or",
"isn",
"t",
"a",
"valid",
"[]",
"int",
".",
"Some",
"conversion",
"is",
"done",
"to",
"handle",
"the",
"fact",
"that",
"JSON",
"ints",
"are",
"represented",
"as",
"floats",
"."
] | [
"func",
"(",
"t",
"Typed",
")",
"IntsOr",
"(",
"key",
"string",
",",
"d",
"[",
"]",
"int",
")",
"[",
"]",
"int",
"{",
"n",
",",
"ok",
":=",
"t",
".",
"IntsIf",
"(",
"key",
")",
"\n",
"if",
"<mask>",
"{",
"return",
"n",
"\n",
"}",
"\n",
"return",
"d",
"\n",
"}"
] |
12,299 | all-12300 | [
"copyLayers",
"copies",
"layers",
"from",
"ic",
".",
"src",
"/",
"ic",
".",
"c",
".",
"rawSource",
"to",
"dest",
"using",
"and",
"updating",
"ic",
".",
"manifestUpdates",
"if",
"necessary",
"and",
"ic",
".",
"canModifyManifest",
"."
] | [
"func",
"(",
"ic",
"*",
"imageCopier",
")",
"copyLayers",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"error",
"{",
"srcInfos",
":=",
"ic",
".",
"src",
".",
"LayerInfos",
"(",
")",
"\n",
"numLayers",
":=",
"len",
"(",
"srcInfos",
")",
"\n",
"updatedSrcInfos",
",",
"err",
":=",
"ic",
".",
"src",
".",
"LayerInfosForCopy",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"srcInfosUpdated",
":=",
"false",
"\n",
"if",
"updatedSrcInfos",
"!=",
"nil",
"&&",
"!",
"reflect",
".",
"DeepEqual",
"(",
"srcInfos",
",",
"updatedSrcInfos",
")",
"{",
"if",
"!",
"ic",
".",
"canModifyManifest",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"srcInfos",
"=",
"updatedSrcInfos",
"\n",
"srcInfosUpdated",
"=",
"true",
"\n",
"}",
"\n\n",
"type",
"copyLayerData",
"struct",
"{",
"destInfo",
"types",
".",
"BlobInfo",
"\n",
"diffID",
"digest",
".",
"Digest",
"\n",
"err",
"error",
"\n",
"}",
"\n\n",
"// copyGroup is used to determine if all layers are copied",
"copyGroup",
":=",
"sync",
".",
"WaitGroup",
"{",
"}",
"\n",
"copyGroup",
".",
"Add",
"(",
"numLayers",
")",
"\n\n",
"// copySemaphore is used to limit the number of parallel downloads to",
"// avoid malicious images causing troubles and to be nice to servers.",
"var",
"copySemaphore",
"*",
"semaphore",
".",
"Weighted",
"\n",
"if",
"ic",
".",
"c",
".",
"copyInParallel",
"{",
"copySemaphore",
"=",
"semaphore",
".",
"NewWeighted",
"(",
"int64",
"(",
"maxParallelDownloads",
")",
")",
"\n",
"}",
"else",
"{",
"copySemaphore",
"=",
"semaphore",
".",
"NewWeighted",
"(",
"int64",
"(",
"1",
")",
")",
"\n",
"}",
"\n\n",
"data",
":=",
"make",
"(",
"[",
"]",
"copyLayerData",
",",
"numLayers",
")",
"\n",
"copyLayerHelper",
":=",
"func",
"(",
"index",
"int",
",",
"srcLayer",
"types",
".",
"BlobInfo",
",",
"pool",
"*",
"mpb",
".",
"Progress",
")",
"{",
"defer",
"copySemaphore",
".",
"Release",
"(",
"1",
")",
"\n",
"defer",
"copyGroup",
".",
"Done",
"(",
")",
"\n",
"cld",
":=",
"copyLayerData",
"{",
"}",
"\n",
"if",
"ic",
".",
"c",
".",
"dest",
".",
"AcceptsForeignLayerURLs",
"(",
")",
"&&",
"len",
"(",
"srcLayer",
".",
"URLs",
")",
"!=",
"0",
"{",
"// DiffIDs are, currently, needed only when converting from schema1.",
"// In which case src.LayerInfos will not have URLs because schema1",
"// does not support them.",
"if",
"ic",
".",
"diffIDsAreNeeded",
"{",
"cld",
".",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"cld",
".",
"destInfo",
"=",
"srcLayer",
"\n",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"cld",
".",
"destInfo",
".",
"Digest",
",",
"ic",
".",
"c",
".",
"dest",
".",
"Reference",
"(",
")",
".",
"Transport",
"(",
")",
".",
"Name",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"cld",
".",
"destInfo",
",",
"cld",
".",
"diffID",
",",
"cld",
".",
"err",
"=",
"ic",
".",
"copyLayer",
"(",
"ctx",
",",
"srcLayer",
",",
"pool",
")",
"\n",
"}",
"\n",
"data",
"[",
"index",
"]",
"=",
"cld",
"\n",
"}",
"\n\n",
"func",
"(",
")",
"{",
"// A scope for defer",
"progressPool",
",",
"progressCleanup",
":=",
"ic",
".",
"c",
".",
"newProgressPool",
"(",
"ctx",
")",
"\n",
"defer",
"progressCleanup",
"(",
")",
"\n\n",
"for",
"i",
",",
"srcLayer",
":=",
"range",
"srcInfos",
"{",
"copySemaphore",
".",
"Acquire",
"(",
"ctx",
",",
"1",
")",
"\n",
"go",
"copyLayerHelper",
"(",
"i",
",",
"srcLayer",
",",
"progressPool",
")",
"\n",
"}",
"\n\n",
"// Wait for all layers to be copied",
"copyGroup",
".",
"Wait",
"(",
")",
"\n",
"}",
"(",
")",
"\n\n",
"destInfos",
":=",
"make",
"(",
"[",
"]",
"types",
".",
"BlobInfo",
",",
"numLayers",
")",
"\n",
"diffIDs",
":=",
"make",
"(",
"[",
"]",
"digest",
".",
"Digest",
",",
"numLayers",
")",
"\n",
"for",
"i",
",",
"cld",
":=",
"range",
"data",
"{",
"if",
"cld",
".",
"err",
"!=",
"nil",
"{",
"return",
"cld",
".",
"err",
"\n",
"}",
"\n",
"destInfos",
"[",
"i",
"]",
"=",
"cld",
".",
"destInfo",
"\n",
"diffIDs",
"[",
"i",
"]",
"=",
"cld",
".",
"diffID",
"\n",
"}",
"\n\n",
"ic",
".",
"manifestUpdates",
".",
"InformationOnly",
".",
"LayerInfos",
"=",
"destInfos",
"\n",
"if",
"ic",
".",
"diffIDsAreNeeded",
"{",
"ic",
".",
"manifestUpdates",
".",
"InformationOnly",
".",
"LayerDiffIDs",
"=",
"diffIDs",
"\n",
"}",
"\n",
"if",
"srcInfosUpdated",
"||",
"layerDigestsDiffer",
"(",
"srcInfos",
",",
"destInfos",
")",
"{",
"ic",
".",
"manifestUpdates",
".",
"LayerInfos",
"=",
"destInfos",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.