id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
21,300 | all-21301 | [
"GetID",
"is",
"used",
"to",
"retrieve",
"the",
"taskID",
"from",
"taskARN",
"Reference",
":",
"http",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
".",
"com",
"/",
"general",
"/",
"latest",
"/",
"gr",
"/",
"aws",
"-",
"arns",
"-",
"and",
"-",
"namespaces",
".",
"html#arn",
"-",
"syntax",
"-",
"ecs"
] | [
"func",
"(",
"task",
"*",
"Task",
")",
"GetID",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"// Parse taskARN",
"parsedARN",
",",
"err",
":=",
"arn",
".",
"Parse",
"(",
"task",
".",
"Arn",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"task",
".",
"Arn",
")",
"\n",
"}",
"\n\n",
"// Get task resource section",
"resource",
":=",
"parsedARN",
".",
"Resource",
"\n\n",
"if",
"!",
"strings",
".",
"Contains",
"(",
"resource",
",",
"arnResourceDelimiter",
")",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"resource",
")",
"\n",
"}",
"\n\n",
"resourceSplit",
":=",
"strings",
".",
"SplitN",
"(",
"resource",
",",
"arnResourceDelimiter",
",",
"arnResourceSections",
")",
"\n",
"if",
"len",
"(",
"resourceSplit",
")",
"!=",
"arnResourceSections",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"resource",
",",
"arnResourceSections",
",",
"len",
"(",
"resourceSplit",
")",
")",
"\n",
"}",
"\n\n",
"return",
"resourceSplit",
"[",
"1",
"]",
",",
"nil",
"\n",
"}"
] |
21,301 | all-21302 | [
"ResendRequest",
"resends",
"a",
"transaction",
"request",
"referenced",
"by",
"id"
] | [
"func",
"(",
"c",
"Client",
")",
"ResendRequest",
"(",
"id",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"holder",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
"\n",
"if",
"err",
":=",
"c",
".",
"Put",
"(",
"\"",
"\"",
"+",
"id",
"+",
"\"",
"\"",
",",
"nil",
",",
"&",
"holder",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n",
"if",
"holder",
"[",
"\"",
"\"",
"]",
".",
"(",
"bool",
")",
"{",
"return",
"true",
",",
"nil",
"\n",
"}",
"\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}"
] |
21,302 | all-21303 | [
"List",
"reaches",
"out",
"to",
"deck",
"to",
"retrieve",
"the",
"ProwJobs",
"on",
"the",
"cluster",
"via",
"proxy"
] | [
"func",
"(",
"c",
"*",
"dryRunProwJobClient",
")",
"List",
"(",
"opts",
"metav1",
".",
"ListOptions",
")",
"(",
"*",
"prowapi",
".",
"ProwJobList",
",",
"error",
")",
"{",
"var",
"jl",
"prowapi",
".",
"ProwJobList",
"\n",
"err",
":=",
"c",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"opts",
".",
"LabelSelector",
"}",
",",
"&",
"jl",
")",
"\n",
"return",
"&",
"jl",
",",
"err",
"\n",
"}"
] |
21,303 | all-21304 | [
"GetHead",
"automatically",
"route",
"undefined",
"HEAD",
"requests",
"to",
"GET",
"handlers",
"."
] | [
"func",
"GetHead",
"(",
"next",
"http",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"<mask>",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"if",
"r",
".",
"Method",
"==",
"\"",
"\"",
"{",
"rctx",
":=",
"chi",
".",
"RouteContext",
"(",
"r",
".",
"Context",
"(",
")",
")",
"\n",
"routePath",
":=",
"rctx",
".",
"RoutePath",
"\n",
"if",
"routePath",
"==",
"\"",
"\"",
"{",
"if",
"r",
".",
"URL",
".",
"RawPath",
"!=",
"\"",
"\"",
"{",
"routePath",
"=",
"r",
".",
"URL",
".",
"RawPath",
"\n",
"}",
"else",
"{",
"routePath",
"=",
"r",
".",
"URL",
".",
"Path",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Temporary routing context to look-ahead before routing the request",
"tctx",
":=",
"chi",
".",
"NewRouteContext",
"(",
")",
"\n\n",
"// Attempt to find a HEAD handler for the routing path, if not found, traverse",
"// the router as through its a GET route, but proceed with the request",
"// with the HEAD method.",
"if",
"!",
"rctx",
".",
"Routes",
".",
"Match",
"(",
"tctx",
",",
"\"",
"\"",
",",
"routePath",
")",
"{",
"rctx",
".",
"RouteMethod",
"=",
"\"",
"\"",
"\n",
"rctx",
".",
"RoutePath",
"=",
"routePath",
"\n",
"next",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n\n",
"next",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"}",
")",
"\n",
"}"
] |
21,304 | all-21305 | [
"Get",
"returns",
"node",
"pointer",
"for",
"the",
"lookup",
"key"
] | [
"func",
"(",
"nt",
"*",
"NodeTable",
")",
"Get",
"(",
"key",
"[",
"]",
"byte",
")",
"unsafe",
".",
"Pointer",
"{",
"res",
":=",
"nt",
".",
"find",
"(",
"key",
")",
"\n",
"if",
"res",
".",
"<mask>",
"&",
"ntFoundMask",
"==",
"ntFoundMask",
"{",
"if",
"res",
".",
"status",
"==",
"ntFoundInFast",
"{",
"return",
"decodePointer",
"(",
"res",
".",
"fastHTValue",
")",
"\n",
"}",
"\n",
"return",
"decodePointer",
"(",
"res",
".",
"slowHTValues",
"[",
"res",
".",
"slowHTPos",
"]",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
21,305 | all-21306 | [
"MustNominate",
"retrieves",
"the",
"Nominate",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"ScpStatementPledges",
")",
"MustNominate",
"(",
")",
"ScpNomination",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetNominate",
"(",
")",
"\n\n",
"if",
"!",
"<mask>",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
21,306 | all-21307 | [
"SetBorderWindowSize",
"is",
"a",
"wrapper",
"around",
"gtk_text_view_set_border_window_size",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TextView",
")",
"SetBorderWindowSize",
"(",
"tp",
"TextWindowType",
",",
"<mask>",
"int",
")",
"{",
"C",
".",
"gtk_text_view_set_border_window_size",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkTextWindowType",
"(",
"tp",
")",
",",
"C",
".",
"gint",
"(",
"size",
")",
")",
"\n",
"}"
] |
21,307 | all-21308 | [
"ScrollbarNew",
"is",
"a",
"wrapper",
"around",
"gtk_scrollbar_new",
"()",
"."
] | [
"func",
"ScrollbarNew",
"(",
"orientation",
"Orientation",
",",
"adjustment",
"*",
"Adjustment",
")",
"(",
"*",
"Scrollbar",
",",
"<mask>",
")",
"{",
"c",
":=",
"C",
".",
"gtk_scrollbar_new",
"(",
"C",
".",
"GtkOrientation",
"(",
"orientation",
")",
",",
"adjustment",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapScrollbar",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
21,308 | all-21309 | [
"Listen",
"returns",
"TCP",
"listener",
"with",
"SO_REUSEPORT",
"option",
"set",
".",
"The",
"returned",
"listener",
"tries",
"enabling",
"the",
"following",
"TCP",
"options",
"which",
"usually",
"have",
"positive",
"impact",
"on",
"performance",
":",
"-",
"TCP_DEFER_ACCEPT",
".",
"This",
"option",
"expects",
"that",
"the",
"server",
"reads",
"from",
"accepted",
"connections",
"before",
"writing",
"to",
"them",
".",
"-",
"TCP_FASTOPEN",
".",
"See",
"https",
":",
"//",
"lwn",
".",
"net",
"/",
"Articles",
"/",
"508865",
"/",
"for",
"details",
".",
"Use",
"https",
":",
"//",
"github",
".",
"com",
"/",
"valyala",
"/",
"tcplisten",
"if",
"you",
"want",
"customizing",
"these",
"options",
".",
"Only",
"tcp4",
"and",
"tcp6",
"networks",
"are",
"supported",
".",
"ErrNoReusePort",
"error",
"is",
"returned",
"if",
"the",
"system",
"doesn",
"t",
"support",
"SO_REUSEPORT",
"."
] | [
"func",
"Listen",
"(",
"network",
",",
"addr",
"string",
")",
"(",
"net",
".",
"Listener",
",",
"error",
")",
"{",
"ln",
",",
"err",
":=",
"cfg",
".",
"NewListener",
"(",
"<mask>",
",",
"addr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"strings",
".",
"Contains",
"(",
"err",
".",
"Error",
"(",
")",
",",
"\"",
"\"",
")",
"{",
"return",
"nil",
",",
"&",
"ErrNoReusePort",
"{",
"err",
"}",
"\n",
"}",
"\n",
"return",
"ln",
",",
"err",
"\n",
"}"
] |
21,309 | all-21310 | [
"filterPR",
"indicates",
"if",
"a",
"PR",
"should",
"be",
"filtered",
"out",
"of",
"the",
"subpool",
".",
"Specifically",
"we",
"filter",
"out",
"PRs",
"that",
":",
"-",
"Have",
"known",
"merge",
"conflicts",
".",
"-",
"Have",
"failing",
"or",
"missing",
"status",
"contexts",
".",
"-",
"Have",
"pending",
"required",
"status",
"contexts",
"that",
"are",
"not",
"associated",
"with",
"a",
"ProwJob",
".",
"(",
"This",
"ensures",
"that",
"the",
"tide",
"context",
"indicates",
"that",
"the",
"pending",
"status",
"is",
"preventing",
"merge",
".",
"Required",
"ProwJob",
"statuses",
"are",
"allowed",
"to",
"be",
"pending",
"because",
"this",
"prevents",
"kicking",
"PRs",
"from",
"the",
"pool",
"when",
"Tide",
"is",
"retesting",
"them",
".",
")"
] | [
"func",
"filterPR",
"(",
"ghc",
"githubClient",
",",
"sp",
"*",
"subpool",
",",
"pr",
"*",
"PullRequest",
")",
"bool",
"{",
"log",
":=",
"sp",
".",
"log",
".",
"WithFields",
"(",
"pr",
".",
"logFields",
"(",
")",
")",
"\n",
"// Skip PRs that are known to be unmergeable.",
"if",
"pr",
".",
"Mergeable",
"==",
"githubql",
".",
"MergeableStateConflicting",
"{",
"log",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"// Filter out PRs with unsuccessful contexts unless the only unsuccessful",
"// contexts are pending required prowjobs.",
"contexts",
",",
"err",
":=",
"headContexts",
"(",
"log",
",",
"ghc",
",",
"pr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"presubmitsHaveContext",
":=",
"func",
"(",
"context",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"job",
":=",
"range",
"sp",
".",
"presubmits",
"[",
"int",
"(",
"pr",
".",
"Number",
")",
"]",
"{",
"if",
"job",
".",
"Context",
"==",
"context",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}",
"\n",
"for",
"_",
",",
"ctx",
":=",
"range",
"unsuccessfulContexts",
"(",
"contexts",
",",
"sp",
".",
"cc",
",",
"<mask>",
")",
"{",
"if",
"ctx",
".",
"State",
"!=",
"githubql",
".",
"StatusStatePending",
"{",
"log",
".",
"WithField",
"(",
"\"",
"\"",
",",
"ctx",
".",
"Context",
")",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"if",
"!",
"presubmitsHaveContext",
"(",
"string",
"(",
"ctx",
".",
"Context",
")",
")",
"{",
"log",
".",
"WithField",
"(",
"\"",
"\"",
",",
"ctx",
".",
"Context",
")",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
21,310 | all-21311 | [
"Iterate",
"over",
"entries",
"in",
"the",
"hash",
"table",
"."
] | [
"func",
"(",
"c",
"*",
"CHD",
")",
"Iterate",
"(",
")",
"*",
"Iterator",
"{",
"if",
"len",
"(",
"c",
".",
"<mask>",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"&",
"Iterator",
"{",
"c",
":",
"c",
"}",
"\n",
"}"
] |
21,311 | all-21312 | [
"ListenAndServeTLS",
"acts",
"identically",
"to",
"ListenAndServe",
"except",
"that",
"it",
"uses",
"the",
"TELNET",
"protocol",
"over",
"TLS",
".",
"From",
"a",
"TELNET",
"protocol",
"point",
"-",
"of",
"-",
"view",
"it",
"allows",
"for",
"secured",
"telnet",
"also",
"known",
"as",
"TELNETS",
"which",
"by",
"default",
"listens",
"to",
"port",
"992",
"."
] | [
"func",
"(",
"server",
"*",
"Server",
")",
"ListenAndServeTLS",
"(",
"certFile",
"string",
",",
"keyFile",
"string",
")",
"error",
"{",
"addr",
":=",
"server",
".",
"Addr",
"\n",
"if",
"\"",
"\"",
"==",
"addr",
"{",
"addr",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n\n",
"listener",
",",
"err",
":=",
"net",
".",
"Listen",
"(",
"\"",
"\"",
",",
"addr",
")",
"\n",
"if",
"nil",
"!=",
"err",
"{",
"return",
"err",
"\n",
"}",
"\n\n\n",
"// Apparently have to make a copy of the TLS config this way, rather than by",
"// simple assignment, to prevent some unexported fields from being copied over.",
"//",
"// It would be nice if tls.Config had a method that would do this \"safely\".",
"// (I.e., what happens if in the future more exported fields are added to",
"// tls.Config?)",
"var",
"tlsConfig",
"*",
"tls",
".",
"Config",
"=",
"nil",
"\n",
"if",
"nil",
"==",
"server",
".",
"TLSConfig",
"{",
"tlsConfig",
"=",
"&",
"tls",
".",
"Config",
"{",
"}",
"\n",
"}",
"else",
"{",
"tlsConfig",
"=",
"&",
"tls",
".",
"Config",
"{",
"Rand",
":",
"server",
".",
"TLSConfig",
".",
"Rand",
",",
"Time",
":",
"server",
".",
"TLSConfig",
".",
"Time",
",",
"Certificates",
":",
"server",
".",
"TLSConfig",
".",
"Certificates",
",",
"NameToCertificate",
":",
"server",
".",
"TLSConfig",
".",
"NameToCertificate",
",",
"GetCertificate",
":",
"server",
".",
"TLSConfig",
".",
"GetCertificate",
",",
"RootCAs",
":",
"<mask>",
".",
"TLSConfig",
".",
"RootCAs",
",",
"NextProtos",
":",
"server",
".",
"TLSConfig",
".",
"NextProtos",
",",
"ServerName",
":",
"server",
".",
"TLSConfig",
".",
"ServerName",
",",
"ClientAuth",
":",
"server",
".",
"TLSConfig",
".",
"ClientAuth",
",",
"ClientCAs",
":",
"server",
".",
"TLSConfig",
".",
"ClientCAs",
",",
"InsecureSkipVerify",
":",
"server",
".",
"TLSConfig",
".",
"InsecureSkipVerify",
",",
"CipherSuites",
":",
"server",
".",
"TLSConfig",
".",
"CipherSuites",
",",
"PreferServerCipherSuites",
":",
"server",
".",
"TLSConfig",
".",
"PreferServerCipherSuites",
",",
"SessionTicketsDisabled",
":",
"server",
".",
"TLSConfig",
".",
"SessionTicketsDisabled",
",",
"SessionTicketKey",
":",
"server",
".",
"TLSConfig",
".",
"SessionTicketKey",
",",
"ClientSessionCache",
":",
"server",
".",
"TLSConfig",
".",
"ClientSessionCache",
",",
"MinVersion",
":",
"server",
".",
"TLSConfig",
".",
"MinVersion",
",",
"MaxVersion",
":",
"server",
".",
"TLSConfig",
".",
"MaxVersion",
",",
"CurvePreferences",
":",
"server",
".",
"TLSConfig",
".",
"CurvePreferences",
",",
"}",
"\n",
"}",
"\n\n\n",
"tlsConfigHasCertificate",
":=",
"len",
"(",
"tlsConfig",
".",
"Certificates",
")",
">",
"0",
"||",
"nil",
"!=",
"tlsConfig",
".",
"GetCertificate",
"\n",
"if",
"\"",
"\"",
"==",
"certFile",
"||",
"\"",
"\"",
"==",
"keyFile",
"||",
"!",
"tlsConfigHasCertificate",
"{",
"tlsConfig",
".",
"Certificates",
"=",
"make",
"(",
"[",
"]",
"tls",
".",
"Certificate",
",",
"1",
")",
"\n\n",
"var",
"err",
"error",
"\n",
"tlsConfig",
".",
"Certificates",
"[",
"0",
"]",
",",
"err",
"=",
"tls",
".",
"LoadX509KeyPair",
"(",
"certFile",
",",
"keyFile",
")",
"\n",
"if",
"nil",
"!=",
"err",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n\n",
"tlsListener",
":=",
"tls",
".",
"NewListener",
"(",
"listener",
",",
"tlsConfig",
")",
"\n\n\n",
"return",
"server",
".",
"Serve",
"(",
"tlsListener",
")",
"\n",
"}"
] |
21,312 | all-21313 | [
"GetSpanName",
"returns",
"the",
"SpanName",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"t",
"*",
"TraceServiceDefinition",
")",
"GetSpanName",
"(",
")",
"<mask>",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"SpanName",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"SpanName",
"\n",
"}"
] |
21,313 | all-21314 | [
"Acquire",
"gets",
"a",
"resource",
"with",
"associated",
"leased",
"resources"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Acquire",
"(",
"rtype",
",",
"state",
",",
"dest",
"string",
")",
"(",
"*",
"common",
".",
"Resource",
",",
"error",
")",
"{",
"var",
"resourcesToRelease",
"[",
"]",
"common",
".",
"Resource",
"\n",
"releaseOnFailure",
":=",
"func",
"(",
")",
"{",
"for",
"_",
",",
"r",
":=",
"range",
"resourcesToRelease",
"{",
"if",
"err",
":=",
"c",
".",
"basic",
".",
"ReleaseOne",
"(",
"r",
".",
"Name",
",",
"<mask>",
".",
"Dirty",
")",
";",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Warningf",
"(",
"\"",
"\"",
",",
"r",
".",
"Name",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"res",
",",
"err",
":=",
"c",
".",
"basic",
".",
"Acquire",
"(",
"rtype",
",",
"state",
",",
"dest",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"var",
"leasedResources",
"common",
".",
"LeasedResources",
"\n",
"if",
"err",
"=",
"res",
".",
"UserData",
".",
"Extract",
"(",
"LeasedResources",
",",
"&",
"leasedResources",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"_",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"common",
".",
"UserDataNotFound",
")",
";",
"!",
"ok",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"LeasedResources",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"resourcesToRelease",
"=",
"append",
"(",
"resourcesToRelease",
",",
"*",
"res",
")",
"\n",
"resources",
",",
"err",
":=",
"c",
".",
"basic",
".",
"AcquireByState",
"(",
"res",
".",
"Name",
",",
"dest",
",",
"leasedResources",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"releaseOnFailure",
"(",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"resourcesToRelease",
"=",
"append",
"(",
"resourcesToRelease",
",",
"resources",
"...",
")",
"\n",
"c",
".",
"updateResource",
"(",
"*",
"res",
")",
"\n",
"return",
"res",
",",
"nil",
"\n",
"}"
] |
21,314 | all-21315 | [
"String",
"returns",
"OS",
"Arch",
"or",
"OS_Arch",
"if",
"both",
"are",
"set",
".",
"This",
"must",
"match",
"the",
"names",
"of",
"config_setting",
"rules",
"in"
] | [
"func",
"(",
"p",
"<mask>",
")",
"String",
"(",
")",
"string",
"{",
"switch",
"{",
"case",
"p",
".",
"OS",
"!=",
"\"",
"\"",
"&&",
"p",
".",
"Arch",
"!=",
"\"",
"\"",
":",
"return",
"p",
".",
"OS",
"+",
"\"",
"\"",
"+",
"p",
".",
"Arch",
"\n",
"case",
"p",
".",
"OS",
"!=",
"\"",
"\"",
":",
"return",
"p",
".",
"OS",
"\n",
"case",
"p",
".",
"Arch",
"!=",
"\"",
"\"",
":",
"return",
"p",
".",
"Arch",
"\n",
"default",
":",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"}"
] |
21,315 | all-21316 | [
"CheckRDNSequenceWhiteSpace",
"returns",
"true",
"if",
"there",
"is",
"leading",
"or",
"trailing",
"whitespace",
"in",
"any",
"name",
"attribute",
"in",
"the",
"sequence",
"respectively",
"."
] | [
"func",
"CheckRDNSequenceWhiteSpace",
"(",
"raw",
"[",
"]",
"byte",
")",
"(",
"leading",
",",
"trailing",
"bool",
",",
"err",
"error",
")",
"{",
"var",
"seq",
"pkix",
".",
"RDNSequence",
"\n",
"if",
"_",
",",
"err",
"=",
"asn1",
".",
"Unmarshal",
"(",
"raw",
",",
"&",
"seq",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"for",
"_",
",",
"rdn",
":=",
"range",
"seq",
"{",
"for",
"_",
",",
"atv",
":=",
"range",
"rdn",
"{",
"if",
"!",
"IsNameAttribute",
"(",
"atv",
".",
"Type",
")",
"{",
"continue",
"\n",
"}",
"\n",
"value",
",",
"ok",
":=",
"atv",
".",
"<mask>",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"leftStrip",
":=",
"strings",
".",
"TrimLeftFunc",
"(",
"value",
",",
"unicode",
".",
"IsSpace",
")",
";",
"leftStrip",
"!=",
"value",
"{",
"leading",
"=",
"true",
"\n",
"}",
"\n",
"if",
"rightStrip",
":=",
"strings",
".",
"TrimRightFunc",
"(",
"value",
",",
"unicode",
".",
"IsSpace",
")",
";",
"rightStrip",
"!=",
"value",
"{",
"trailing",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
21,316 | all-21317 | [
"readFile",
"reads",
"a",
"JSON",
"or",
"YAML",
"list",
"of",
"targets",
"groups",
"from",
"the",
"file",
"depending",
"on",
"its",
"file",
"extension",
".",
"It",
"returns",
"full",
"configuration",
"target",
"groups",
"."
] | [
"func",
"(",
"d",
"*",
"Discovery",
")",
"readFile",
"(",
"filename",
"string",
")",
"(",
"[",
"]",
"*",
"targetgroup",
".",
"Group",
",",
"error",
")",
"{",
"fd",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"fd",
".",
"Close",
"(",
")",
"\n\n",
"content",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"fd",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"info",
",",
"err",
":=",
"fd",
".",
"Stat",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"targetGroups",
"[",
"]",
"*",
"targetgroup",
".",
"Group",
"\n\n",
"switch",
"ext",
":=",
"filepath",
".",
"Ext",
"(",
"filename",
")",
";",
"strings",
".",
"ToLower",
"(",
"ext",
")",
"{",
"case",
"\"",
"\"",
":",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"content",
",",
"&",
"targetGroups",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
",",
"\"",
"\"",
":",
"if",
"err",
":=",
"yaml",
".",
"UnmarshalStrict",
"(",
"content",
",",
"&",
"targetGroups",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"default",
":",
"panic",
"(",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ext",
")",
")",
"\n",
"}",
"\n\n",
"for",
"i",
",",
"tg",
":=",
"range",
"targetGroups",
"{",
"if",
"tg",
"==",
"nil",
"{",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"tg",
".",
"Source",
"=",
"fileSource",
"(",
"filename",
",",
"i",
")",
"\n",
"if",
"tg",
".",
"Labels",
"==",
"nil",
"{",
"tg",
".",
"Labels",
"=",
"model",
".",
"LabelSet",
"{",
"}",
"\n",
"}",
"\n",
"tg",
".",
"Labels",
"[",
"fileSDFilepathLabel",
"]",
"=",
"model",
".",
"LabelValue",
"(",
"<mask>",
")",
"\n",
"}",
"\n\n",
"d",
".",
"writeTimestamp",
"(",
"filename",
",",
"float64",
"(",
"info",
".",
"ModTime",
"(",
")",
".",
"Unix",
"(",
")",
")",
")",
"\n\n",
"return",
"targetGroups",
",",
"nil",
"\n",
"}"
] |
21,317 | all-21318 | [
"CdromDiffOperation",
"performs",
"operations",
"relevant",
"to",
"managing",
"the",
"diff",
"on",
"cdrom",
"sub",
"-",
"resources"
] | [
"func",
"CdromDiffOperation",
"(",
"d",
"*",
"schema",
".",
"ResourceDiff",
",",
"c",
"*",
"govmomi",
".",
"<mask>",
")",
"error",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"cr",
":=",
"d",
".",
"Get",
"(",
"subresourceTypeCdrom",
")",
"\n",
"for",
"ci",
",",
"ce",
":=",
"range",
"cr",
".",
"(",
"[",
"]",
"interface",
"{",
"}",
")",
"{",
"cm",
":=",
"ce",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"r",
":=",
"NewCdromSubresource",
"(",
"c",
",",
"d",
",",
"cm",
",",
"nil",
",",
"ci",
")",
"\n",
"if",
"err",
":=",
"r",
".",
"ValidateDiff",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"r",
".",
"Addr",
"(",
")",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
21,318 | all-21319 | [
"Clone",
"works",
"just",
"like",
"Copy",
"but",
"also",
"reuses",
"the",
"same",
"socket",
"as",
"the",
"original",
"session",
"in",
"case",
"it",
"had",
"already",
"reserved",
"one",
"due",
"to",
"its",
"consistency",
"guarantees",
".",
"This",
"behavior",
"ensures",
"that",
"writes",
"performed",
"in",
"the",
"old",
"session",
"are",
"necessarily",
"observed",
"when",
"using",
"the",
"new",
"session",
"as",
"long",
"as",
"it",
"was",
"a",
"strong",
"or",
"monotonic",
"session",
".",
"That",
"said",
"it",
"also",
"means",
"that",
"long",
"operations",
"may",
"cause",
"other",
"goroutines",
"using",
"the",
"original",
"session",
"to",
"wait",
"."
] | [
"func",
"(",
"s",
"*",
"Session",
")",
"Clone",
"(",
")",
"*",
"Session",
"{",
"s",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"scopy",
":=",
"copySession",
"(",
"s",
",",
"<mask>",
")",
"\n",
"s",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"return",
"scopy",
"\n",
"}"
] |
21,319 | all-21320 | [
"prChanges",
"gets",
"the",
"files",
"changed",
"by",
"the",
"PR",
"either",
"from",
"the",
"cache",
"or",
"by",
"querying",
"GitHub",
"."
] | [
"func",
"(",
"c",
"*",
"changedFilesAgent",
")",
"prChanges",
"(",
"pr",
"*",
"PullRequest",
")",
"config",
".",
"ChangedFilesProvider",
"{",
"return",
"func",
"(",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"cacheKey",
":=",
"changeCacheKey",
"{",
"org",
":",
"string",
"(",
"pr",
".",
"Repository",
".",
"Owner",
".",
"Login",
")",
",",
"repo",
":",
"string",
"(",
"pr",
".",
"Repository",
".",
"Name",
")",
",",
"number",
":",
"int",
"(",
"pr",
".",
"Number",
")",
",",
"sha",
":",
"string",
"(",
"pr",
".",
"HeadRefOID",
")",
",",
"}",
"\n\n",
"c",
".",
"RLock",
"(",
")",
"\n",
"changedFiles",
",",
"ok",
":=",
"c",
".",
"changeCache",
"[",
"cacheKey",
"]",
"\n",
"if",
"ok",
"{",
"c",
".",
"RUnlock",
"(",
")",
"\n",
"c",
".",
"Lock",
"(",
")",
"\n",
"c",
".",
"nextChangeCache",
"[",
"cacheKey",
"]",
"=",
"changedFiles",
"\n",
"c",
".",
"Unlock",
"(",
")",
"\n",
"return",
"changedFiles",
",",
"nil",
"\n",
"}",
"\n",
"if",
"changedFiles",
",",
"ok",
"=",
"c",
".",
"nextChangeCache",
"[",
"cacheKey",
"]",
";",
"ok",
"{",
"c",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"changedFiles",
",",
"nil",
"\n",
"}",
"\n",
"c",
".",
"RUnlock",
"(",
")",
"\n\n",
"// We need to query the changes from GitHub.",
"changes",
",",
"err",
":=",
"c",
".",
"ghc",
".",
"GetPullRequestChanges",
"(",
"string",
"(",
"pr",
".",
"Repository",
".",
"Owner",
".",
"Login",
")",
",",
"string",
"(",
"pr",
".",
"Repository",
".",
"Name",
")",
",",
"int",
"(",
"pr",
".",
"Number",
")",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"int",
"(",
"pr",
".",
"Number",
")",
",",
"err",
")",
"\n",
"}",
"\n",
"changedFiles",
"=",
"<mask>",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"changes",
")",
")",
"\n",
"for",
"_",
",",
"change",
":=",
"range",
"changes",
"{",
"changedFiles",
"=",
"append",
"(",
"changedFiles",
",",
"change",
".",
"Filename",
")",
"\n",
"}",
"\n\n",
"c",
".",
"Lock",
"(",
")",
"\n",
"c",
".",
"nextChangeCache",
"[",
"cacheKey",
"]",
"=",
"changedFiles",
"\n",
"c",
".",
"Unlock",
"(",
")",
"\n",
"return",
"changedFiles",
",",
"nil",
"\n",
"}",
"\n",
"}"
] |
21,320 | all-21321 | [
"DispatchTouchEvent",
"dispatches",
"a",
"touch",
"event",
"to",
"the",
"page",
".",
"See",
":",
"https",
":",
"//",
"chromedevtools",
".",
"github",
".",
"io",
"/",
"devtools",
"-",
"protocol",
"/",
"tot",
"/",
"Input#method",
"-",
"dispatchTouchEvent",
"parameters",
":",
"type",
"-",
"Type",
"of",
"the",
"touch",
"event",
".",
"TouchEnd",
"and",
"TouchCancel",
"must",
"not",
"contain",
"any",
"touch",
"points",
"while",
"TouchStart",
"and",
"TouchMove",
"must",
"contains",
"at",
"least",
"one",
".",
"touchPoints",
"-",
"Active",
"touch",
"points",
"on",
"the",
"touch",
"device",
".",
"One",
"event",
"per",
"any",
"changed",
"point",
"(",
"compared",
"to",
"previous",
"touch",
"event",
"in",
"a",
"sequence",
")",
"is",
"generated",
"emulating",
"pressing",
"/",
"moving",
"/",
"releasing",
"points",
"one",
"by",
"one",
"."
] | [
"func",
"DispatchTouchEvent",
"(",
"typeVal",
"TouchType",
",",
"touchPoints",
"[",
"]",
"*",
"TouchPoint",
")",
"*",
"DispatchTouchEventParams",
"{",
"return",
"&",
"DispatchTouchEventParams",
"{",
"<mask>",
":",
"typeVal",
",",
"TouchPoints",
":",
"touchPoints",
",",
"}",
"\n",
"}"
] |
21,321 | all-21322 | [
"/",
"*",
"ProcessEvent",
"processes",
"all",
"events",
"come",
"from",
"the",
"control",
"parent",
".",
"If",
"a",
"control",
"processes",
"an",
"event",
"it",
"should",
"return",
"true",
".",
"If",
"the",
"method",
"returns",
"false",
"it",
"means",
"that",
"the",
"control",
"do",
"not",
"want",
"or",
"cannot",
"process",
"the",
"event",
"and",
"the",
"caller",
"sends",
"the",
"event",
"to",
"the",
"control",
"parent"
] | [
"func",
"(",
"e",
"*",
"EditField",
")",
"ProcessEvent",
"(",
"event",
"Event",
")",
"bool",
"{",
"if",
"!",
"e",
".",
"Active",
"(",
")",
"||",
"!",
"e",
".",
"Enabled",
"(",
")",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"if",
"event",
".",
"Type",
"==",
"EventActivate",
"&&",
"event",
".",
"X",
"==",
"0",
"{",
"term",
".",
"HideCursor",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"event",
".",
"Type",
"==",
"EventKey",
"&&",
"event",
".",
"Key",
"!=",
"term",
".",
"KeyTab",
"{",
"if",
"e",
".",
"onKeyPress",
"!=",
"nil",
"{",
"res",
":=",
"e",
".",
"onKeyPress",
"(",
"<mask>",
".",
"Key",
",",
"event",
".",
"Ch",
")",
"\n",
"if",
"res",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"switch",
"event",
".",
"Key",
"{",
"case",
"term",
".",
"KeyEnter",
":",
"return",
"false",
"\n",
"case",
"term",
".",
"KeySpace",
":",
"e",
".",
"insertRune",
"(",
"' '",
")",
"\n",
"return",
"true",
"\n",
"case",
"term",
".",
"KeyBackspace",
",",
"term",
".",
"KeyBackspace2",
":",
"e",
".",
"backspace",
"(",
")",
"\n",
"return",
"true",
"\n",
"case",
"term",
".",
"KeyDelete",
":",
"e",
".",
"del",
"(",
")",
"\n",
"return",
"true",
"\n",
"case",
"term",
".",
"KeyArrowLeft",
":",
"e",
".",
"charLeft",
"(",
")",
"\n",
"return",
"true",
"\n",
"case",
"term",
".",
"KeyHome",
":",
"e",
".",
"home",
"(",
")",
"\n",
"return",
"true",
"\n",
"case",
"term",
".",
"KeyEnd",
":",
"e",
".",
"end",
"(",
")",
"\n",
"return",
"true",
"\n",
"case",
"term",
".",
"KeyCtrlR",
":",
"if",
"!",
"e",
".",
"readonly",
"{",
"e",
".",
"Clear",
"(",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"case",
"term",
".",
"KeyArrowRight",
":",
"e",
".",
"charRight",
"(",
")",
"\n",
"return",
"true",
"\n",
"case",
"term",
".",
"KeyCtrlC",
":",
"if",
"!",
"e",
".",
"showStars",
"{",
"clipboard",
".",
"WriteAll",
"(",
"e",
".",
"Title",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"case",
"term",
".",
"KeyCtrlV",
":",
"if",
"!",
"e",
".",
"readonly",
"{",
"s",
",",
"_",
":=",
"clipboard",
".",
"ReadAll",
"(",
")",
"\n",
"e",
".",
"SetTitle",
"(",
"s",
")",
"\n",
"e",
".",
"end",
"(",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"default",
":",
"if",
"event",
".",
"Ch",
"!=",
"0",
"{",
"e",
".",
"insertRune",
"(",
"event",
".",
"Ch",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
21,322 | all-21323 | [
"New",
"returns",
"a",
"new",
"instance",
"of",
"Client",
"with",
"default",
"values",
"."
] | [
"func",
"New",
"(",
"endpoint",
"string",
",",
"errorRegistry",
"ErrorRegistry",
")",
"*",
"Client",
"{",
"return",
"&",
"<mask>",
"{",
"Endpoint",
":",
"endpoint",
",",
"ErrorRegistry",
":",
"errorRegistry",
",",
"KeyHeader",
":",
"DefaultKeyHeader",
",",
"HTTPClient",
":",
"http",
".",
"DefaultClient",
",",
"}",
"\n",
"}"
] |
21,323 | all-21324 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventRequestServedFromCache",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork51",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
21,324 | all-21325 | [
"SetCompletion",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_entry_set_completion",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetCompletion",
"(",
"completion",
"*",
"EntryCompletion",
")",
"{",
"C",
".",
"gtk_entry_set_completion",
"(",
"v",
".",
"native",
"(",
")",
",",
"completion",
".",
"native",
"(",
")",
")",
"\n",
"}"
] |
21,325 | all-21326 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"BaseAudioContext",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoWebaudio8",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
21,326 | all-21327 | [
"dvsFromPath",
"gets",
"a",
"DVS",
"object",
"from",
"its",
"path",
"."
] | [
"func",
"dvsFromPath",
"(",
"client",
"*",
"govmomi",
".",
"Client",
",",
"name",
"string",
",",
"dc",
"*",
"object",
".",
"Datacenter",
")",
"(",
"*",
"<mask>",
".",
"VmwareDistributedVirtualSwitch",
",",
"error",
")",
"{",
"net",
",",
"err",
":=",
"network",
".",
"FromPath",
"(",
"client",
",",
"name",
",",
"dc",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"net",
".",
"Reference",
"(",
")",
".",
"Type",
"!=",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
",",
"net",
".",
"Reference",
"(",
")",
".",
"Type",
")",
"\n",
"}",
"\n",
"return",
"dvsFromMOID",
"(",
"client",
",",
"net",
".",
"Reference",
"(",
")",
".",
"Value",
")",
"\n",
"}"
] |
21,327 | all-21328 | [
"Read",
"is",
"implementation",
"of",
"io",
".",
"Closer",
"s",
"Close",
"."
] | [
"func",
"(",
"s",
"*",
"Stream",
")",
"Close",
"(",
")",
"<mask>",
"{",
"runtime",
".",
"SetFinalizer",
"(",
"s",
",",
"nil",
")",
"\n",
"return",
"s",
".",
"inner",
".",
"Close",
"(",
")",
"\n",
"}"
] |
21,328 | all-21329 | [
"Add",
"a",
"device",
"to",
"a",
"container"
] | [
"func",
"containerDeviceAdd",
"(",
"client",
"lxd",
".",
"ContainerServer",
",",
"name",
"string",
",",
"devName",
"string",
",",
"dev",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"// Get the container entry",
"container",
",",
"etag",
",",
"err",
":=",
"client",
".",
"GetContainer",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Check if the device already exists",
"_",
",",
"ok",
":=",
"container",
".",
"Devices",
"[",
"devName",
"]",
"\n",
"if",
"ok",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"i18n",
".",
"G",
"(",
"\"",
"\"",
")",
",",
"devName",
")",
"\n",
"}",
"\n\n",
"container",
".",
"Devices",
"[",
"devName",
"]",
"=",
"dev",
"\n\n",
"op",
",",
"err",
":=",
"client",
".",
"UpdateContainer",
"(",
"name",
",",
"<mask>",
".",
"Writable",
"(",
")",
",",
"etag",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"op",
".",
"Wait",
"(",
")",
"\n",
"}"
] |
21,329 | all-21330 | [
"Encode",
"encodes",
"Pointer",
"into",
"byte",
"buffer",
"."
] | [
"func",
"(",
"p",
"valuePointer",
")",
"Encode",
"(",
"b",
"[",
"]",
"byte",
")",
"[",
"]",
"<mask>",
"{",
"binary",
".",
"BigEndian",
".",
"PutUint32",
"(",
"b",
"[",
":",
"4",
"]",
",",
"p",
".",
"Fid",
")",
"\n",
"binary",
".",
"BigEndian",
".",
"PutUint32",
"(",
"b",
"[",
"4",
":",
"8",
"]",
",",
"p",
".",
"Len",
")",
"\n",
"binary",
".",
"BigEndian",
".",
"PutUint32",
"(",
"b",
"[",
"8",
":",
"12",
"]",
",",
"p",
".",
"Offset",
")",
"\n",
"return",
"b",
"[",
":",
"vptrSize",
"]",
"\n",
"}"
] |
21,330 | all-21331 | [
"TSDBCleanTombstones",
"implements",
"pb",
".",
"AdminServer",
"."
] | [
"func",
"(",
"s",
"*",
"AdminDisabled",
")",
"TSDBCleanTombstones",
"(",
"_",
"context",
".",
"Context",
",",
"_",
"*",
"pb",
".",
"TSDBCleanTombstonesRequest",
")",
"(",
"*",
"<mask>",
".",
"TSDBCleanTombstonesResponse",
",",
"error",
")",
"{",
"return",
"nil",
",",
"errAdminDisabled",
"\n",
"}"
] |
21,331 | all-21332 | [
"Scan",
"XML",
"token",
"stream",
"to",
"find",
"next",
"StartElement",
"."
] | [
"func",
"nextStart",
"(",
"p",
"*",
"xml",
".",
"Decoder",
")",
"(",
"xml",
".",
"StartElement",
",",
"error",
")",
"{",
"for",
"{",
"t",
",",
"err",
":=",
"p",
".",
"Token",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"t",
"==",
"nil",
"{",
"return",
"xml",
".",
"StartElement",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"switch",
"t",
":=",
"t",
".",
"(",
"type",
")",
"{",
"<mask>",
"xml",
".",
"StartElement",
":",
"return",
"t",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
21,332 | all-21333 | [
"IndexOf",
"looks",
"for",
"specified",
"string",
"into",
"current",
"slice",
"."
] | [
"func",
"(",
"s",
"StringSlice",
")",
"IndexOf",
"(",
"str",
"string",
")",
"int",
"{",
"for",
"i",
",",
"v",
":=",
"<mask>",
"s",
"{",
"if",
"str",
"==",
"v",
"{",
"return",
"i",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"-",
"1",
"\n",
"}"
] |
21,333 | all-21334 | [
"Is",
"detects",
"whether",
"the",
"error",
"is",
"equal",
"to",
"a",
"given",
"error",
".",
"Errors",
"are",
"considered",
"equal",
"by",
"this",
"function",
"if",
"they",
"are",
"the",
"same",
"object",
"or",
"if",
"they",
"both",
"contain",
"the",
"same",
"error",
"inside",
"an",
"errors",
".",
"Error",
"."
] | [
"func",
"Is",
"(",
"e",
"error",
",",
"<mask>",
"error",
")",
"bool",
"{",
"if",
"e",
"==",
"original",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"if",
"e",
",",
"ok",
":=",
"e",
".",
"(",
"*",
"Error",
")",
";",
"ok",
"{",
"return",
"Is",
"(",
"e",
".",
"Err",
",",
"original",
")",
"\n",
"}",
"\n\n",
"if",
"original",
",",
"ok",
":=",
"original",
".",
"(",
"*",
"Error",
")",
";",
"ok",
"{",
"return",
"Is",
"(",
"e",
",",
"original",
".",
"Err",
")",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
21,334 | all-21335 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SetStyleSheetTextReturns",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss13",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
21,335 | all-21336 | [
"Delete",
"removes",
"the",
"firewall"
] | [
"func",
"(",
"r",
"*",
"Firewall",
")",
"Delete",
"(",
"actual",
"cloud",
".",
"Resource",
",",
"immutable",
"*",
"cluster",
".",
"Cluster",
")",
"(",
"*",
"cluster",
".",
"Cluster",
",",
"cloud",
".",
"Resource",
",",
"error",
")",
"{",
"logger",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"deleteResource",
",",
"ok",
":=",
"actual",
".",
"(",
"*",
"Firewall",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"deleteResource",
".",
"Name",
"==",
"\"",
"\"",
"{",
"return",
"immutable",
",",
"nil",
",",
"nil",
"\n",
"return",
"nil",
",",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"deleteResource",
".",
"Name",
")",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"Sdk",
".",
"<mask>",
".",
"Firewalls",
".",
"Delete",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"deleteResource",
".",
"FirewallID",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"deleteResource",
".",
"Name",
",",
"err",
")",
"\n",
"}",
"\n",
"logger",
".",
"Success",
"(",
"\"",
"\"",
",",
"deleteResource",
".",
"FirewallID",
")",
"\n\n",
"newResource",
":=",
"&",
"Firewall",
"{",
"Shared",
":",
"Shared",
"{",
"Name",
":",
"r",
".",
"Name",
",",
"Tags",
":",
"r",
".",
"Tags",
",",
"}",
",",
"InboundRules",
":",
"r",
".",
"InboundRules",
",",
"OutboundRules",
":",
"r",
".",
"OutboundRules",
",",
"Created",
":",
"r",
".",
"Created",
",",
"}",
"\n\n",
"newCluster",
":=",
"r",
".",
"immutableRender",
"(",
"newResource",
",",
"immutable",
")",
"\n",
"return",
"newCluster",
",",
"newResource",
",",
"nil",
"\n",
"}"
] |
21,336 | all-21337 | [
"HasType",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"n",
"*",
"NoteDefinition",
")",
"HasType",
"(",
")",
"bool",
"{",
"if",
"n",
"!=",
"nil",
"&&",
"n",
".",
"Type",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
21,337 | all-21338 | [
"HasAggr",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"Series",
")",
"HasAggr",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"Aggr",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
21,338 | all-21339 | [
"Run",
"executes",
"especified",
"command",
"on",
"Docker",
".",
"Returns",
"ExternalCmdError",
"on",
"error",
"."
] | [
"func",
"(",
"s",
"*",
"Docker",
")",
"Run",
"(",
"cmd",
"string",
",",
"args",
"...",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"cmdArgs",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"args",
")",
"+",
"1",
")",
"\n",
"cmdArgs",
"=",
"<mask>",
"(",
"cmdArgs",
",",
"cmd",
")",
"\n",
"cmdArgs",
"=",
"append",
"(",
"cmdArgs",
",",
"args",
"...",
")",
"\n\n",
"exe",
":=",
"exec",
".",
"Command",
"(",
"s",
".",
"binCmd",
",",
"cmdArgs",
"...",
")",
"\n",
"var",
"stdout",
",",
"stderr",
"bytes",
".",
"Buffer",
"\n",
"exe",
".",
"Stdout",
",",
"exe",
".",
"Stderr",
"=",
"&",
"stdout",
",",
"&",
"stderr",
"\n\n",
"if",
"err",
":=",
"exe",
".",
"Run",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"stdout",
".",
"String",
"(",
")",
",",
"ExternalCmdError",
"{",
"err",
",",
"stderr",
".",
"String",
"(",
")",
",",
"stdout",
".",
"String",
"(",
")",
"}",
"\n",
"}",
"\n",
"return",
"stdout",
".",
"String",
"(",
")",
",",
"nil",
"\n",
"}"
] |
21,339 | all-21340 | [
"ApplyChanges",
"applies",
"the",
"given",
"changes",
"."
] | [
"func",
"(",
"p",
"*",
"InfobloxProvider",
")",
"ApplyChanges",
"(",
"changes",
"*",
"plan",
".",
"Changes",
")",
"error",
"{",
"zones",
",",
"err",
":=",
"p",
".",
"zones",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"<mask>",
",",
"deleted",
":=",
"p",
".",
"mapChanges",
"(",
"zones",
",",
"changes",
")",
"\n",
"p",
".",
"deleteRecords",
"(",
"deleted",
")",
"\n",
"p",
".",
"createRecords",
"(",
"created",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
21,340 | all-21341 | [
"inferProtoMode",
"sets",
"ProtoConfig",
".",
"Mode",
"based",
"on",
"the",
"directory",
"name",
"and",
"the",
"contents",
"of",
"f",
".",
"If",
"the",
"proto",
"mode",
"is",
"set",
"explicitly",
"this",
"function",
"does",
"not",
"change",
"it",
".",
"If",
"this",
"is",
"a",
"vendor",
"directory",
"or",
"go_proto_library",
"is",
"loaded",
"from",
"another",
"file",
"proto",
"rule",
"generation",
"is",
"disabled",
".",
"TODO",
"(",
"jayconrod",
")",
":",
"this",
"logic",
"is",
"archaic",
"now",
"that",
"rules",
"are",
"generated",
"by",
"separate",
"language",
"extensions",
".",
"Proto",
"rule",
"generation",
"should",
"be",
"independent",
"from",
"Go",
"."
] | [
"func",
"inferProtoMode",
"(",
"c",
"*",
"config",
".",
"Config",
",",
"rel",
"string",
",",
"f",
"*",
"rule",
".",
"File",
")",
"{",
"pc",
":=",
"GetProtoConfig",
"(",
"c",
")",
"\n",
"if",
"pc",
".",
"Mode",
"!=",
"DefaultMode",
"||",
"pc",
".",
"ModeExplicit",
"{",
"return",
"\n",
"}",
"\n",
"if",
"pc",
".",
"GoPrefix",
"==",
"wellKnownTypesGoPrefix",
"{",
"pc",
".",
"Mode",
"=",
"LegacyMode",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"path",
".",
"Base",
"(",
"rel",
")",
"==",
"\"",
"\"",
"{",
"pc",
".",
"Mode",
"=",
"DisableMode",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"f",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"mode",
":=",
"DefaultMode",
"\n",
"outer",
":",
"for",
"_",
",",
"l",
":=",
"range",
"f",
".",
"Loads",
"{",
"name",
":=",
"l",
".",
"Name",
"(",
")",
"\n",
"if",
"name",
"==",
"\"",
"\"",
"{",
"break",
"\n",
"}",
"\n",
"if",
"name",
"==",
"\"",
"\"",
"{",
"mode",
"=",
"LegacyMode",
"\n",
"<mask>",
"\n",
"}",
"\n",
"for",
"_",
",",
"sym",
":=",
"range",
"l",
".",
"Symbols",
"(",
")",
"{",
"if",
"sym",
"==",
"\"",
"\"",
"{",
"mode",
"=",
"DisableMode",
"\n",
"break",
"outer",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"mode",
"==",
"DefaultMode",
"||",
"pc",
".",
"Mode",
"==",
"mode",
"||",
"c",
".",
"ShouldFix",
"&&",
"mode",
"==",
"LegacyMode",
"{",
"return",
"\n",
"}",
"\n",
"pc",
".",
"Mode",
"=",
"mode",
"\n",
"}"
] |
21,341 | all-21342 | [
"ImageName",
"converts",
"a",
"types",
".",
"ImageReference",
"into",
"an",
"URL",
"-",
"like",
"image",
"name",
"which",
"MUST",
"be",
"such",
"that",
"ParseImageName",
"(",
"ImageName",
"(",
"reference",
"))",
"returns",
"an",
"equivalent",
"reference",
".",
"This",
"is",
"the",
"generally",
"recommended",
"way",
"to",
"refer",
"to",
"images",
"in",
"the",
"UI",
".",
"NOTE",
":",
"The",
"returned",
"string",
"is",
"not",
"promised",
"to",
"be",
"equal",
"to",
"the",
"original",
"input",
"to",
"ParseImageName",
";",
"e",
".",
"g",
".",
"default",
"attribute",
"values",
"omitted",
"by",
"the",
"user",
"may",
"be",
"filled",
"in",
"in",
"the",
"return",
"value",
"or",
"vice",
"versa",
"."
] | [
"func",
"ImageName",
"(",
"ref",
"types",
".",
"ImageReference",
")",
"string",
"{",
"return",
"ref",
".",
"Transport",
"(",
")",
".",
"<mask>",
"(",
")",
"+",
"\"",
"\"",
"+",
"ref",
".",
"StringWithinTransport",
"(",
")",
"\n",
"}"
] |
21,342 | all-21343 | [
"Run",
"runs",
"revision",
"-",
"based",
"compactor",
"."
] | [
"func",
"(",
"rc",
"*",
"Revision",
")",
"Run",
"(",
")",
"{",
"prev",
":=",
"int64",
"(",
"0",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"for",
"{",
"select",
"{",
"case",
"<-",
"rc",
".",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"\n",
"case",
"<-",
"rc",
".",
"clock",
".",
"After",
"(",
"revInterval",
")",
":",
"rc",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"p",
":=",
"rc",
".",
"paused",
"\n",
"rc",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"p",
"{",
"continue",
"\n",
"}",
"\n",
"}",
"\n\n",
"<mask>",
":=",
"rc",
".",
"rg",
".",
"Rev",
"(",
")",
"-",
"rc",
".",
"retention",
"\n",
"if",
"rev",
"<=",
"0",
"||",
"rev",
"==",
"prev",
"{",
"continue",
"\n",
"}",
"\n\n",
"now",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"if",
"rc",
".",
"lg",
"!=",
"nil",
"{",
"rc",
".",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"Int64",
"(",
"\"",
"\"",
",",
"rev",
")",
",",
"zap",
".",
"Int64",
"(",
"\"",
"\"",
",",
"rc",
".",
"retention",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Noticef",
"(",
"\"",
"\"",
",",
"rev",
",",
"rc",
".",
"retention",
")",
"\n",
"}",
"\n",
"_",
",",
"err",
":=",
"rc",
".",
"c",
".",
"Compact",
"(",
"rc",
".",
"ctx",
",",
"&",
"pb",
".",
"CompactionRequest",
"{",
"Revision",
":",
"rev",
"}",
")",
"\n",
"if",
"err",
"==",
"nil",
"||",
"err",
"==",
"mvcc",
".",
"ErrCompacted",
"{",
"prev",
"=",
"rev",
"\n",
"if",
"rc",
".",
"lg",
"!=",
"nil",
"{",
"rc",
".",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"Int64",
"(",
"\"",
"\"",
",",
"rev",
")",
",",
"zap",
".",
"Int64",
"(",
"\"",
"\"",
",",
"rc",
".",
"retention",
")",
",",
"zap",
".",
"Duration",
"(",
"\"",
"\"",
",",
"time",
".",
"Since",
"(",
"now",
")",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Noticef",
"(",
"\"",
"\"",
",",
"rev",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"if",
"rc",
".",
"lg",
"!=",
"nil",
"{",
"rc",
".",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"Int64",
"(",
"\"",
"\"",
",",
"rev",
")",
",",
"zap",
".",
"Int64",
"(",
"\"",
"\"",
",",
"rc",
".",
"retention",
")",
",",
"zap",
".",
"Duration",
"(",
"\"",
"\"",
",",
"revInterval",
")",
",",
"zap",
".",
"Error",
"(",
"err",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Noticef",
"(",
"\"",
"\"",
",",
"rev",
",",
"err",
")",
"\n",
"plog",
".",
"Noticef",
"(",
"\"",
"\"",
",",
"revInterval",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"}"
] |
21,343 | all-21344 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"<mask>",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoMemory7",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
21,344 | all-21345 | [
"FromPath",
"iterates",
"and",
"merges",
"all",
"configuration",
"files",
"in",
"a",
"given",
"directory",
"returning",
"the",
"resulting",
"config",
"."
] | [
"func",
"FromPath",
"(",
"path",
"string",
")",
"(",
"*",
"Config",
",",
"error",
")",
"{",
"// Ensure the given filepath exists",
"if",
"_",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"path",
")",
";",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
"+",
"path",
")",
"\n",
"}",
"\n\n",
"// Check if a file was given or a path to a directory",
"stat",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
"+",
"path",
")",
"\n",
"}",
"\n\n",
"// Recursively parse directories, single load files",
"if",
"stat",
".",
"Mode",
"(",
")",
".",
"IsDir",
"(",
")",
"{",
"// Ensure the given filepath has at least one config file",
"_",
",",
"err",
":=",
"ioutil",
".",
"ReadDir",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
"+",
"path",
")",
"\n",
"}",
"\n\n",
"// Create a blank config to merge off of",
"var",
"c",
"*",
"Config",
"\n\n",
"// Potential bug: Walk does not follow symlinks!",
"err",
"=",
"filepath",
".",
"Walk",
"(",
"path",
",",
"func",
"(",
"<mask>",
"string",
",",
"info",
"os",
".",
"FileInfo",
",",
"err",
"error",
")",
"error",
"{",
"// If WalkFunc had an error, just return it",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Do nothing for directories",
"if",
"info",
".",
"IsDir",
"(",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// Parse and merge the config",
"newConfig",
",",
"err",
":=",
"FromFile",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"c",
"=",
"c",
".",
"Merge",
"(",
"newConfig",
")",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"c",
",",
"nil",
"\n",
"}",
"else",
"if",
"stat",
".",
"Mode",
"(",
")",
".",
"IsRegular",
"(",
")",
"{",
"return",
"FromFile",
"(",
"path",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"stat",
".",
"Mode",
"(",
")",
".",
"String",
"(",
")",
")",
"\n",
"}"
] |
21,345 | all-21346 | [
"Manifest",
"is",
"like",
"ImageSource",
".",
"GetManifest",
"but",
"the",
"result",
"is",
"cached",
";",
"it",
"is",
"OK",
"to",
"call",
"this",
"however",
"often",
"you",
"need",
"."
] | [
"func",
"(",
"i",
"*",
"UnparsedImage",
")",
"Manifest",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"[",
"]",
"byte",
",",
"string",
",",
"error",
")",
"{",
"if",
"i",
".",
"cachedManifest",
"==",
"nil",
"{",
"m",
",",
"mt",
",",
"err",
":=",
"i",
".",
"src",
".",
"GetManifest",
"(",
"ctx",
",",
"i",
".",
"instanceDigest",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"// ImageSource.GetManifest does not do digest verification, but we do;",
"// this immediately protects also any user of types.Image.",
"if",
"digest",
",",
"haveDigest",
":=",
"i",
".",
"expectedManifestDigest",
"(",
")",
";",
"haveDigest",
"{",
"matches",
",",
"err",
":=",
"manifest",
".",
"MatchesDigest",
"(",
"m",
",",
"digest",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"!",
"matches",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"digest",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"i",
".",
"cachedManifest",
"=",
"m",
"\n",
"i",
".",
"cachedManifestMIMEType",
"=",
"mt",
"\n",
"}",
"\n",
"return",
"i",
".",
"cachedManifest",
",",
"i",
".",
"cachedManifestMIMEType",
",",
"nil",
"\n",
"}"
] |
21,346 | all-21347 | [
"Add",
"appends",
"an",
"entry",
"to",
"the",
"logical",
"end",
"of",
"the",
"List",
"."
] | [
"func",
"(",
"l",
"*",
"List",
")",
"Add",
"(",
"entries",
"...",
"<mask>",
"{",
"}",
")",
"{",
"l",
".",
"key",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"key",
".",
"Unlock",
"(",
")",
"\n",
"l",
".",
"underlyer",
"=",
"append",
"(",
"l",
".",
"underlyer",
",",
"entries",
"...",
")",
"\n",
"}"
] |
21,347 | all-21348 | [
"ParseBranches",
"converts",
"all",
"arguments",
"to",
"*",
"pfs",
".",
"Commit",
"structs",
"using",
"the",
"semantics",
"of",
"ParseBranch"
] | [
"func",
"ParseBranches",
"(",
"args",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"*",
"pfs",
".",
"Branch",
",",
"error",
")",
"{",
"var",
"results",
"[",
"]",
"*",
"pfs",
".",
"Branch",
"\n",
"for",
"_",
",",
"arg",
":=",
"range",
"args",
"{",
"branch",
",",
"err",
":=",
"ParseBranch",
"(",
"arg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"<mask>",
"=",
"append",
"(",
"results",
",",
"branch",
")",
"\n",
"}",
"\n",
"return",
"results",
",",
"nil",
"\n",
"}"
] |
21,348 | all-21349 | [
"Detect",
"whether",
"LXD",
"already",
"uses",
"the",
"given",
"storage",
"pool",
"."
] | [
"func",
"lxdUsesPool",
"(",
"dbObj",
"*",
"db",
".",
"Cluster",
",",
"onDiskPoolName",
"string",
",",
"driver",
"string",
",",
"onDiskProperty",
"string",
")",
"(",
"bool",
",",
"string",
",",
"error",
")",
"{",
"pools",
",",
"err",
":=",
"dbObj",
".",
"StoragePools",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"<mask>",
".",
"ErrNoSuchObject",
"{",
"return",
"false",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"pool",
":=",
"range",
"pools",
"{",
"_",
",",
"pl",
",",
"err",
":=",
"dbObj",
".",
"StoragePoolGet",
"(",
"pool",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"continue",
"\n",
"}",
"\n\n",
"if",
"pl",
".",
"Driver",
"!=",
"driver",
"{",
"continue",
"\n",
"}",
"\n\n",
"if",
"pl",
".",
"Config",
"[",
"onDiskProperty",
"]",
"==",
"onDiskPoolName",
"{",
"return",
"true",
",",
"pl",
".",
"Name",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"false",
",",
"\"",
"\"",
",",
"nil",
"\n",
"}"
] |
21,349 | all-21350 | [
"Enqueue",
"puts",
"a",
"value",
"into",
"a",
"queue",
"with",
"a",
"given",
"priority",
"."
] | [
"func",
"(",
"q",
"*",
"PriorityQueue",
")",
"Enqueue",
"(",
"val",
"string",
",",
"pr",
"uint16",
")",
"error",
"{",
"<mask>",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"q",
".",
"key",
",",
"pr",
")",
"\n",
"_",
",",
"err",
":=",
"newSequentialKV",
"(",
"q",
".",
"client",
",",
"prefix",
",",
"val",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
21,350 | all-21351 | [
"GetPrecisionOk",
"returns",
"a",
"tuple",
"with",
"the",
"Precision",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinition",
")",
"GetPrecisionOk",
"(",
")",
"(",
"PrecisionT",
",",
"bool",
")",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"Precision",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"Precision",
",",
"<mask>",
"\n",
"}"
] |
21,351 | all-21352 | [
"AgentPreOfferingPopUp",
"pop",
"ups",
"an",
"offering",
"."
] | [
"func",
"(",
"w",
"*",
"Worker",
")",
"AgentPreOfferingPopUp",
"(",
"job",
"*",
"data",
".",
"Job",
")",
"error",
"{",
"logger",
":=",
"w",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"job",
")",
"\n",
"offering",
",",
"err",
":=",
"w",
".",
"relatedOffering",
"(",
"logger",
",",
"job",
",",
"data",
".",
"JobAgentPreOfferingPopUp",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"logger",
"=",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"offering",
".",
"ID",
")",
"\n\n",
"if",
"offering",
".",
"Status",
"!=",
"data",
".",
"OfferRegistered",
"&&",
"offering",
".",
"Status",
"!=",
"data",
".",
"OfferPoppedUp",
"{",
"return",
"ErrOfferNotRegistered",
"\n",
"}",
"\n\n",
"jobDate",
",",
"err",
":=",
"w",
".",
"publishData",
"(",
"logger",
",",
"job",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"offeringHash",
",",
"err",
":=",
"data",
".",
"HexToHash",
"(",
"offering",
".",
"Hash",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"ErrInternal",
"\n",
"}",
"\n\n",
"err",
"=",
"w",
".",
"agentOfferingPopUpFindRelatedJobs",
"(",
"logger",
",",
"offering",
".",
"ID",
",",
"job",
".",
"ID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"w",
".",
"checkInPeriod",
"(",
"logger",
",",
"offeringHash",
",",
"data",
".",
"SettingsPeriodPopUp",
",",
"ErrPopUpPeriodIsNotOver",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"key",
",",
"err",
":=",
"w",
".",
"accountKey",
"(",
"logger",
",",
"offering",
".",
"Agent",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"auth",
":=",
"bind",
".",
"NewKeyedTransactor",
"(",
"key",
")",
"\n",
"auth",
".",
"GasLimit",
"=",
"w",
".",
"gasConf",
".",
"PSC",
".",
"PopupServiceOffering",
"\n",
"auth",
".",
"GasPrice",
"=",
"<mask>",
"(",
"big",
".",
"Int",
")",
".",
"SetUint64",
"(",
"jobDate",
".",
"GasPrice",
")",
"\n\n",
"tx",
",",
"err",
":=",
"w",
".",
"ethBack",
".",
"PSCPopupServiceOffering",
"(",
"auth",
",",
"offeringHash",
",",
"offering",
".",
"SOMCType",
",",
"offering",
".",
"SOMCData",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"auth",
".",
"GasLimit",
",",
"\"",
"\"",
",",
"auth",
".",
"GasPrice",
")",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"ErrPSCPopUpOffering",
"\n",
"}",
"\n\n",
"offering",
".",
"Status",
"=",
"data",
".",
"OfferPoppingUp",
"\n",
"if",
"err",
":=",
"w",
".",
"saveRecord",
"(",
"logger",
",",
"w",
".",
"db",
".",
"Querier",
",",
"offering",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"w",
".",
"saveEthTX",
"(",
"logger",
",",
"job",
",",
"tx",
",",
"\"",
"\"",
",",
"job",
".",
"RelatedType",
",",
"job",
".",
"RelatedID",
",",
"offering",
".",
"Agent",
",",
"data",
".",
"HexFromBytes",
"(",
"w",
".",
"pscAddr",
".",
"Bytes",
"(",
")",
")",
")",
"\n",
"}"
] |
21,352 | all-21353 | [
"getCluster",
"is",
"a",
"modified",
"copy",
"of",
"k8s",
".",
"io",
"/",
"kubernetes",
"/",
"pkg",
"/",
"client",
"/",
"unversioned",
"/",
"clientcmd",
".",
"DirectClientConfig",
".",
"getCluster",
"."
] | [
"func",
"(",
"config",
"*",
"directClientConfig",
")",
"getCluster",
"(",
")",
"clientcmdCluster",
"{",
"clusterInfos",
":=",
"config",
".",
"config",
".",
"Clusters",
"\n",
"clusterInfoName",
":=",
"config",
".",
"getClusterName",
"(",
")",
"\n\n",
"<mask>",
"mergedClusterInfo",
"clientcmdCluster",
"\n",
"mergo",
".",
"Merge",
"(",
"&",
"mergedClusterInfo",
",",
"defaultCluster",
")",
"\n",
"mergo",
".",
"Merge",
"(",
"&",
"mergedClusterInfo",
",",
"envVarCluster",
")",
"\n",
"if",
"configClusterInfo",
",",
"exists",
":=",
"clusterInfos",
"[",
"clusterInfoName",
"]",
";",
"exists",
"{",
"mergo",
".",
"Merge",
"(",
"&",
"mergedClusterInfo",
",",
"configClusterInfo",
")",
"\n",
"}",
"\n",
"// REMOVED: overrides support",
"return",
"mergedClusterInfo",
"\n",
"}"
] |
21,353 | all-21354 | [
"NewMockHttpClient",
"creates",
"a",
"new",
"mock",
"instance"
] | [
"func",
"NewMockHttpClient",
"(",
"ctrl",
"*",
"gomock",
".",
"<mask>",
")",
"*",
"MockHttpClient",
"{",
"mock",
":=",
"&",
"MockHttpClient",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockHttpClientMockRecorder",
"{",
"mock",
"}",
"\n",
"return",
"mock",
"\n",
"}"
] |
21,354 | all-21355 | [
"HasTitleAlign",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"e",
"*",
"EventStreamDefinition",
")",
"HasTitleAlign",
"(",
")",
"bool",
"{",
"if",
"e",
"!=",
"nil",
"&&",
"e",
".",
"TitleAlign",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
21,355 | all-21356 | [
"Prepend",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_list_store_prepend",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"ListStore",
")",
"Prepend",
"(",
")",
"*",
"TreeIter",
"{",
"<mask>",
"ti",
"C",
".",
"GtkTreeIter",
"\n",
"C",
".",
"gtk_list_store_prepend",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"ti",
")",
"\n",
"iter",
":=",
"&",
"TreeIter",
"{",
"ti",
"}",
"\n",
"return",
"iter",
"\n",
"}"
] |
21,356 | all-21357 | [
"DetermineRaftNode",
"figures",
"out",
"what",
"raft",
"node",
"ID",
"and",
"address",
"we",
"have",
"if",
"any",
".",
"This",
"decision",
"is",
"based",
"on",
"the",
"value",
"of",
"the",
"cluster",
".",
"https_address",
"config",
"key",
"and",
"on",
"the",
"rows",
"in",
"the",
"raft_nodes",
"table",
"both",
"stored",
"in",
"the",
"node",
"-",
"level",
"SQLite",
"database",
".",
"The",
"following",
"rules",
"are",
"applied",
":",
"-",
"If",
"no",
"cluster",
".",
"https_address",
"config",
"key",
"is",
"set",
"this",
"is",
"a",
"non",
"-",
"clustered",
"node",
"and",
"the",
"returned",
"RaftNode",
"will",
"have",
"ID",
"1",
"but",
"no",
"address",
"to",
"signal",
"that",
"the",
"node",
"should",
"setup",
"an",
"in",
"-",
"memory",
"raft",
"cluster",
"where",
"the",
"node",
"itself",
"is",
"the",
"only",
"member",
"and",
"leader",
".",
"-",
"If",
"cluster",
".",
"https_address",
"config",
"key",
"is",
"set",
"but",
"there",
"is",
"no",
"row",
"in",
"the",
"raft_nodes",
"table",
"this",
"is",
"a",
"brand",
"new",
"clustered",
"node",
"that",
"is",
"joining",
"a",
"cluster",
"and",
"same",
"behavior",
"as",
"the",
"previous",
"case",
"applies",
".",
"-",
"If",
"cluster",
".",
"https_address",
"config",
"key",
"is",
"set",
"and",
"there",
"is",
"at",
"least",
"one",
"row",
"in",
"the",
"raft_nodes",
"table",
"then",
"this",
"node",
"is",
"considered",
"a",
"raft",
"node",
"if",
"cluster",
".",
"https_address",
"matches",
"one",
"of",
"the",
"rows",
"in",
"raft_nodes",
".",
"In",
"that",
"case",
"the",
"matching",
"db",
".",
"RaftNode",
"row",
"is",
"returned",
"otherwise",
"nil",
"."
] | [
"func",
"DetermineRaftNode",
"(",
"tx",
"*",
"db",
".",
"NodeTx",
")",
"(",
"*",
"db",
".",
"RaftNode",
",",
"error",
")",
"{",
"config",
",",
"err",
":=",
"ConfigLoad",
"(",
"tx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"address",
":=",
"config",
".",
"ClusterAddress",
"(",
")",
"\n\n",
"// If cluster.https_address is the empty string, then this LXD instance is",
"// not running in clustering mode.",
"if",
"address",
"==",
"\"",
"\"",
"{",
"return",
"&",
"db",
".",
"RaftNode",
"{",
"ID",
":",
"1",
"}",
",",
"nil",
"\n",
"}",
"\n\n",
"nodes",
",",
"err",
":=",
"tx",
".",
"RaftNodes",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// If cluster.https_address and the raft_nodes table is not populated,",
"// this must be a joining node.",
"if",
"len",
"(",
"nodes",
")",
"==",
"0",
"{",
"return",
"&",
"db",
".",
"RaftNode",
"{",
"ID",
":",
"1",
"}",
",",
"nil",
"\n",
"}",
"\n\n",
"// Try to find a matching node.",
"for",
"_",
",",
"node",
":=",
"range",
"nodes",
"{",
"if",
"node",
".",
"<mask>",
"==",
"address",
"{",
"return",
"&",
"node",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"nil",
"\n",
"}"
] |
21,357 | all-21358 | [
"ValidateRequestWithLeeway",
"validates",
"the",
"token",
"within",
"the",
"http",
"request",
".",
"The",
"provided",
"leeway",
"value",
"is",
"used",
"to",
"compare",
"time",
"values",
"."
] | [
"func",
"(",
"v",
"*",
"JWTValidator",
")",
"ValidateRequestWithLeeway",
"(",
"r",
"*",
"<mask>",
".",
"Request",
",",
"leeway",
"time",
".",
"Duration",
")",
"(",
"*",
"jwt",
".",
"JSONWebToken",
",",
"error",
")",
"{",
"return",
"v",
".",
"validateRequestWithLeeway",
"(",
"r",
",",
"leeway",
")",
"\n",
"}"
] |
21,358 | all-21359 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetFontFamiliesParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage10",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
21,359 | all-21360 | [
"GetGroupName",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_notebook_get_group_name",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Notebook",
")",
"GetGroupName",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_notebook_get_group_name",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"goString",
"(",
"c",
")",
",",
"nil",
"\n",
"}"
] |
21,360 | all-21361 | [
"AddMapping",
"maps",
"an",
"external",
"port",
"to",
"a",
"local",
"port",
"for",
"a",
"specific",
"service",
"to",
"NAT",
"-",
"PMP",
"interface",
"."
] | [
"func",
"(",
"n",
"*",
"npmp",
")",
"AddMapping",
"(",
"protocol",
"string",
",",
"extPort",
",",
"intPort",
"int",
",",
"name",
"string",
",",
"lifetime",
"<mask>",
".",
"Duration",
")",
"error",
"{",
"if",
"lifetime",
"<=",
"0",
"{",
"return",
"ErrTooShortLifetime",
"\n",
"}",
"\n",
"_",
",",
"err",
":=",
"n",
".",
"c",
".",
"AddPortMapping",
"(",
"strings",
".",
"ToLower",
"(",
"protocol",
")",
",",
"intPort",
",",
"extPort",
",",
"int",
"(",
"lifetime",
"/",
"time",
".",
"Second",
")",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
21,361 | all-21362 | [
"Return",
"the",
"min",
"/",
"max",
"frames",
"from",
"an",
"unsorted",
"list"
] | [
"func",
"minMaxFrame",
"(",
"frames",
"[",
"]",
"int",
")",
"(",
"int",
",",
"int",
")",
"{",
"srcframes",
":=",
"make",
"(",
"[",
"]",
"int",
",",
"len",
"(",
"frames",
")",
",",
"len",
"(",
"frames",
")",
")",
"\n",
"copy",
"(",
"srcframes",
",",
"frames",
")",
"\n",
"sort",
".",
"Ints",
"(",
"srcframes",
")",
"\n",
"min",
",",
"max",
":=",
"srcframes",
"[",
"0",
"]",
",",
"srcframes",
"[",
"len",
"(",
"srcframes",
")",
"-",
"1",
"]",
"\n",
"return",
"<mask>",
",",
"max",
"\n",
"}"
] |
21,362 | all-21363 | [
"WithSessionID",
"session",
"to",
"detach",
"."
] | [
"func",
"(",
"p",
"DetachFromTargetParams",
")",
"WithSessionID",
"(",
"sessionID",
"SessionID",
")",
"*",
"DetachFromTargetParams",
"{",
"p",
".",
"SessionID",
"=",
"sessionID",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
21,363 | all-21364 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"CreateTargetParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoTarget23",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
21,364 | all-21365 | [
"SetFlagsFromEnv",
"parses",
"all",
"registered",
"flags",
"in",
"the",
"given",
"flagset",
"and",
"if",
"they",
"are",
"not",
"already",
"set",
"it",
"attempts",
"to",
"set",
"their",
"values",
"from",
"environment",
"variables",
".",
"Environment",
"variables",
"take",
"the",
"name",
"of",
"the",
"flag",
"but",
"are",
"UPPERCASE",
"have",
"the",
"given",
"prefix",
"and",
"any",
"dashes",
"are",
"replaced",
"by",
"underscores",
"-",
"for",
"example",
":",
"some",
"-",
"flag",
"=",
">",
"ETCD_SOME_FLAG"
] | [
"func",
"SetFlagsFromEnv",
"(",
"prefix",
"string",
",",
"fs",
"*",
"flag",
".",
"FlagSet",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"alreadySet",
":=",
"make",
"(",
"<mask>",
"[",
"string",
"]",
"bool",
")",
"\n",
"fs",
".",
"Visit",
"(",
"func",
"(",
"f",
"*",
"flag",
".",
"Flag",
")",
"{",
"alreadySet",
"[",
"FlagToEnv",
"(",
"prefix",
",",
"f",
".",
"Name",
")",
"]",
"=",
"true",
"\n",
"}",
")",
"\n",
"usedEnvKey",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n",
"fs",
".",
"VisitAll",
"(",
"func",
"(",
"f",
"*",
"flag",
".",
"Flag",
")",
"{",
"if",
"serr",
":=",
"setFlagFromEnv",
"(",
"fs",
",",
"prefix",
",",
"f",
".",
"Name",
",",
"usedEnvKey",
",",
"alreadySet",
",",
"true",
")",
";",
"serr",
"!=",
"nil",
"{",
"err",
"=",
"serr",
"\n",
"}",
"\n",
"}",
")",
"\n",
"verifyEnv",
"(",
"prefix",
",",
"usedEnvKey",
",",
"alreadySet",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
21,365 | all-21366 | [
"NewWALWatcher",
"creates",
"a",
"new",
"WAL",
"watcher",
"for",
"a",
"given",
"WriteTo",
"."
] | [
"func",
"NewWALWatcher",
"(",
"logger",
"log",
".",
"Logger",
",",
"name",
"string",
",",
"writer",
"writeTo",
",",
"walDir",
"string",
")",
"*",
"WALWatcher",
"{",
"if",
"logger",
"==",
"nil",
"{",
"logger",
"=",
"log",
".",
"NewNopLogger",
"(",
")",
"\n",
"}",
"\n",
"return",
"&",
"WALWatcher",
"{",
"logger",
":",
"logger",
",",
"writer",
":",
"writer",
",",
"walDir",
":",
"path",
".",
"Join",
"(",
"walDir",
",",
"\"",
"\"",
")",
",",
"name",
":",
"name",
",",
"quit",
":",
"<mask>",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"done",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"maxSegment",
":",
"-",
"1",
",",
"}",
"\n",
"}"
] |
21,366 | all-21367 | [
"RemoveTickCallback",
"is",
"a",
"wrapper",
"around",
"gtk_widget_remove_tick_callback",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Widget",
")",
"RemoveTickCallback",
"(",
"id",
"int",
")",
"{",
"C",
".",
"gtk_widget_remove_tick_callback",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"guint",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
21,367 | all-21368 | [
"MappedKind",
"records",
"the",
"fact",
"that",
"the",
"given",
"mapping",
"was",
"applied",
"while",
"processing",
"the",
"given",
"package",
"."
] | [
"func",
"(",
"mr",
"*",
"metaResolver",
")",
"MappedKind",
"(",
"pkgRel",
"string",
",",
"kind",
"config",
".",
"MappedKind",
")",
"{",
"mr",
".",
"mappedKinds",
"[",
"pkgRel",
"]",
"=",
"append",
"(",
"mr",
".",
"mappedKinds",
"[",
"pkgRel",
"]",
",",
"<mask>",
")",
"\n",
"}"
] |
21,368 | all-21369 | [
"withRetryPolicy",
"sets",
"the",
"retry",
"policy",
"of",
"this",
"call",
"."
] | [
"func",
"withRetryPolicy",
"(",
"rp",
"retryPolicy",
")",
"retryOption",
"{",
"return",
"retryOption",
"{",
"applyFunc",
":",
"func",
"(",
"o",
"*",
"<mask>",
")",
"{",
"o",
".",
"retryPolicy",
"=",
"rp",
"\n",
"}",
"}",
"\n",
"}"
] |
21,369 | all-21370 | [
"/",
"*",
"utility",
"function",
":",
"convert",
"one",
"image",
"to",
"another",
"with",
"optional",
"vertical",
"flip"
] | [
"func",
"ConvertImage",
"(",
"src",
",",
"dst",
"unsafe",
".",
"Pointer",
",",
"flags",
"int",
")",
"{",
"C",
".",
"cvConvertImage",
"(",
"src",
",",
"dst",
",",
"C",
".",
"int",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
21,370 | all-21371 | [
"SetMaxWidth",
"sets",
"the",
"maximum",
"lenght",
"of",
"the",
"EditField",
"text",
".",
"If",
"the",
"current",
"text",
"is",
"longer",
"it",
"is",
"truncated"
] | [
"func",
"(",
"e",
"*",
"EditField",
")",
"SetMaxWidth",
"(",
"w",
"int",
")",
"{",
"e",
".",
"maxWidth",
"=",
"w",
"\n",
"if",
"w",
">",
"0",
"&&",
"xs",
".",
"Len",
"(",
"e",
".",
"<mask>",
")",
">",
"w",
"{",
"e",
".",
"title",
"=",
"xs",
".",
"Slice",
"(",
"e",
".",
"title",
",",
"0",
",",
"w",
")",
"\n",
"e",
".",
"end",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
21,371 | all-21372 | [
"*",
"*",
"*",
"Append",
"writes",
"len",
"(",
"b",
")",
"bytes",
"at",
"the",
"end",
"of",
"the",
"named",
"file",
".",
"It",
"returns",
"an",
"error",
"if",
"any",
".",
"The",
"file",
"is",
"backed",
"up",
"."
] | [
"func",
"Append",
"(",
"<mask>",
"string",
",",
"b",
"[",
"]",
"byte",
")",
"error",
"{",
"e",
",",
"err",
":=",
"NewEdit",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"e",
".",
"Append",
"(",
"b",
")",
"\n",
"err2",
":=",
"e",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"err2",
"\n",
"}"
] |
21,372 | all-21373 | [
"Cancel",
"cancels",
"an",
"existing",
"GDPR",
"request",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"Cancel",
"(",
"id",
"string",
")",
"(",
"*",
"CancellationResponse",
",",
"error",
")",
"{",
"cancelResp",
":=",
"&",
"CancellationResponse",
"{",
"}",
"\n",
"resp",
",",
"err",
":=",
"c",
".",
"caller",
".",
"Call",
"(",
"\"",
"\"",
",",
"c",
".",
"endpoint",
"+",
"\"",
"\"",
"+",
"id",
",",
"nil",
")",
"\n",
"return",
"cancelResp",
",",
"c",
".",
"json",
"(",
"resp",
",",
"err",
",",
"true",
",",
"cancelResp",
")",
"\n",
"}"
] |
21,373 | all-21374 | [
"Do",
"executes",
"Runtime",
".",
"releaseObjectGroup",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"ReleaseObjectGroupParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandReleaseObjectGroup",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
21,374 | all-21375 | [
"Filter",
"appends",
"a",
"new",
"filter",
"to",
"the",
"query",
"."
] | [
"func",
"(",
"q",
"*",
"Query",
")",
"Filter",
"(",
"rule",
"string",
")",
"*",
"Query",
"{",
"q",
".",
"headers",
"=",
"append",
"(",
"q",
".",
"<mask>",
",",
"\"",
"\"",
"+",
"rule",
")",
"\n",
"return",
"q",
"\n",
"}"
] |
21,375 | all-21376 | [
"SetPrivateMeta",
"-",
"set",
"a",
"private",
"meta",
"data",
"record"
] | [
"func",
"(",
"s",
"*",
"Task",
")",
"SetPrivateMeta",
"(",
"name",
"string",
",",
"<mask>",
"interface",
"{",
"}",
")",
"{",
"if",
"s",
".",
"PrivateMetaData",
"==",
"nil",
"{",
"s",
".",
"PrivateMetaData",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"}",
"\n\n",
"s",
".",
"PrivateMetaData",
"[",
"name",
"]",
"=",
"value",
"\n",
"}"
] |
21,376 | all-21377 | [
"GetPrintPages",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_get_print_pages",
"()",
"."
] | [
"func",
"(",
"ps",
"*",
"PrintSettings",
")",
"GetPrintPages",
"(",
")",
"PrintPages",
"{",
"c",
":=",
"C",
".",
"gtk_print_settings_get_print_pages",
"(",
"<mask>",
".",
"native",
"(",
")",
")",
"\n",
"return",
"PrintPages",
"(",
"c",
")",
"\n",
"}"
] |
21,377 | all-21378 | [
"Make",
"space",
"in",
"the",
"new",
"buckets",
"by",
"expiring",
"the",
"really",
"bad",
"entries",
".",
"If",
"no",
"bad",
"entries",
"are",
"available",
"we",
"remove",
"the",
"oldest",
"."
] | [
"func",
"(",
"a",
"*",
"AddrBook",
")",
"expireNew",
"(",
"bucketIdx",
"int",
")",
"{",
"for",
"addrStr",
",",
"ka",
":=",
"range",
"a",
".",
"addrNew",
"[",
"bucketIdx",
"]",
"{",
"// If an entry is bad, throw it away",
"if",
"ka",
".",
"isBad",
"(",
")",
"{",
"<mask>",
".",
"Notice",
"(",
"Fmt",
"(",
"\"",
"\"",
",",
"addrStr",
")",
")",
"\n",
"a",
".",
"removeFromBucket",
"(",
"ka",
",",
"bucketTypeNew",
",",
"bucketIdx",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n\n",
"// If we haven't thrown out a bad entry, throw out the oldest entry",
"oldest",
":=",
"a",
".",
"pickOldest",
"(",
"bucketTypeNew",
",",
"bucketIdx",
")",
"\n",
"a",
".",
"removeFromBucket",
"(",
"oldest",
",",
"bucketTypeNew",
",",
"bucketIdx",
")",
"\n",
"}"
] |
21,378 | all-21379 | [
"AddGroup",
"returns",
"a",
"new",
"Group",
"."
] | [
"func",
"NewGroup",
"(",
"name",
"string",
",",
"members",
"...",
"string",
")",
"*",
"Group",
"{",
"return",
"&",
"Group",
"{",
"<mask>",
":",
"name",
",",
"password",
":",
"\"",
"\"",
",",
"GID",
":",
"-",
"1",
",",
"UserList",
":",
"members",
",",
"}",
"\n",
"}"
] |
21,379 | all-21380 | [
"validatePlugins",
"will",
"return",
"error",
"if",
"there",
"are",
"unknown",
"or",
"duplicated",
"plugins",
"."
] | [
"func",
"validatePlugins",
"(",
"plugins",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
")",
"error",
"{",
"var",
"errors",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"configuration",
":=",
"range",
"plugins",
"{",
"for",
"_",
",",
"plugin",
":=",
"range",
"configuration",
"{",
"if",
"_",
",",
"ok",
":=",
"pluginHelp",
"[",
"plugin",
"]",
";",
"!",
"<mask>",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"plugin",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"repo",
",",
"repoConfig",
":=",
"range",
"plugins",
"{",
"if",
"strings",
".",
"Contains",
"(",
"repo",
",",
"\"",
"\"",
")",
"{",
"org",
":=",
"strings",
".",
"Split",
"(",
"repo",
",",
"\"",
"\"",
")",
"[",
"0",
"]",
"\n",
"if",
"dupes",
":=",
"findDuplicatedPluginConfig",
"(",
"repoConfig",
",",
"plugins",
"[",
"org",
"]",
")",
";",
"len",
"(",
"dupes",
")",
">",
"0",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"dupes",
",",
"repo",
",",
"org",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"errors",
")",
">",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\n",
"\\t",
"\"",
",",
"strings",
".",
"Join",
"(",
"errors",
",",
"\"",
"\\n",
"\\t",
"\"",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
21,380 | all-21381 | [
"EncodePeer",
"implements",
"the",
"Transport",
"interface",
"."
] | [
"func",
"(",
"n",
"*",
"NetworkTransport",
")",
"EncodePeer",
"(",
"id",
"ServerID",
",",
"p",
"ServerAddress",
")",
"[",
"]",
"byte",
"{",
"address",
":=",
"n",
".",
"getProviderAddressOrFallback",
"(",
"<mask>",
",",
"p",
")",
"\n",
"return",
"[",
"]",
"byte",
"(",
"address",
")",
"\n",
"}"
] |
21,381 | all-21382 | [
"GetJobLog",
"returns",
"the",
"job",
"logs",
"works",
"for",
"both",
"kubernetes",
"and",
"jenkins",
"agent",
"types",
"."
] | [
"func",
"(",
"ja",
"*",
"JobAgent",
")",
"GetJobLog",
"(",
"job",
",",
"id",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"j",
",",
"err",
":=",
"ja",
".",
"GetProwJob",
"(",
"job",
",",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"j",
".",
"Spec",
".",
"Agent",
"==",
"prowapi",
".",
"KubernetesAgent",
"{",
"client",
",",
"ok",
":=",
"ja",
".",
"pkcs",
"[",
"j",
".",
"ClusterAlias",
"(",
")",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"j",
".",
"ObjectMeta",
".",
"Name",
",",
"j",
".",
"Spec",
".",
"Agent",
",",
"j",
".",
"ClusterAlias",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"GetLogs",
"(",
"j",
".",
"Status",
".",
"PodName",
",",
"&",
"coreapi",
".",
"PodLogOptions",
"{",
"Container",
":",
"kube",
".",
"TestContainerName",
"}",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"agentToTmpl",
":=",
"range",
"ja",
".",
"config",
"(",
")",
".",
"Deck",
".",
"ExternalAgentLogs",
"{",
"if",
"agentToTmpl",
".",
"Agent",
"!=",
"string",
"(",
"j",
".",
"Spec",
".",
"Agent",
")",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"!",
"agentToTmpl",
".",
"Selector",
".",
"Matches",
"(",
"labels",
".",
"Set",
"(",
"j",
".",
"ObjectMeta",
".",
"Labels",
")",
")",
"{",
"continue",
"\n",
"}",
"\n",
"var",
"b",
"bytes",
".",
"Buffer",
"\n",
"if",
"err",
":=",
"agentToTmpl",
".",
"URLTemplate",
".",
"Execute",
"(",
"&",
"b",
",",
"&",
"j",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"j",
".",
"ObjectMeta",
".",
"Name",
",",
"j",
".",
"Spec",
".",
"Agent",
",",
"err",
")",
"\n",
"}",
"\n",
"resp",
",",
"err",
":=",
"http",
".",
"Get",
"(",
"b",
".",
"String",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"return",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n\n",
"}",
"\n",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"j",
".",
"ObjectMeta",
".",
"Name",
",",
"j",
".",
"Spec",
".",
"Agent",
")",
"\n",
"}"
] |
21,382 | all-21383 | [
"runAgent",
"runs",
"the",
"ECS",
"agent",
"inside",
"a",
"goroutine",
"and",
"waits",
"to",
"be",
"told",
"to",
"exit",
"."
] | [
"func",
"(",
"h",
"*",
"handler",
")",
"runAgent",
"(",
"ctx",
"context",
".",
"Context",
")",
"uint32",
"{",
"agentCtx",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"ctx",
")",
"\n",
"indicator",
":=",
"newTermHandlerIndicator",
"(",
")",
"\n\n",
"terminationHandler",
":=",
"func",
"(",
"saver",
"statemanager",
".",
"Saver",
",",
"taskEngine",
"engine",
".",
"TaskEngine",
")",
"{",
"// We're using a custom indicator to record that the handler is scheduled to be executed (has been invoked) and",
"// to determine whether it should run (we skip when the agent engine has already exited). After recording to",
"// the indicator that the handler has been invoked, we wait on the context. When we wake up, we determine",
"// whether to execute or not based on whether the agent is still running.",
"defer",
"indicator",
".",
"finish",
"(",
")",
"\n",
"indicator",
".",
"setInvoked",
"(",
")",
"\n",
"<-",
"agentCtx",
".",
"Done",
"(",
")",
"\n",
"if",
"!",
"indicator",
".",
"isAgentRunning",
"(",
")",
"{",
"return",
"\n",
"}",
"\n\n",
"seelog",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"err",
":=",
"sighandlers",
".",
"FinalSave",
"(",
"saver",
",",
"taskEngine",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"seelog",
".",
"Criticalf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"h",
".",
"ecsAgent",
".",
"setTerminationHandler",
"(",
"terminationHandler",
")",
"\n\n",
"<mask>",
"func",
"(",
")",
"{",
"defer",
"cancel",
"(",
")",
"\n",
"exitCode",
":=",
"h",
".",
"ecsAgent",
".",
"start",
"(",
")",
"// should block forever, unless there is an error",
"\n\n",
"if",
"exitCode",
"==",
"exitcodes",
".",
"ExitTerminal",
"{",
"seelog",
".",
"Critical",
"(",
"\"",
"\"",
")",
"\n",
"// We override the exit code to 0 here so that Windows does not treat this as a restartable failure even",
"// when \"sc.exe failureflag\" is set.",
"exitCode",
"=",
"0",
"\n",
"}",
"\n\n",
"indicator",
".",
"agentStopped",
"(",
"exitCode",
")",
"\n",
"}",
"(",
")",
"\n\n",
"sleepCtx",
"(",
"agentCtx",
",",
"time",
".",
"Minute",
")",
"// give the agent a minute to start and invoke terminationHandler",
"\n\n",
"// wait for the termination handler to run. Once the termination handler runs, we can safely exit. If the agent",
"// exits by itself, the termination handler doesn't need to do anything and skips. If the agent exits before the",
"// termination handler is invoked, we can exit immediately.",
"return",
"indicator",
".",
"wait",
"(",
")",
"\n",
"}"
] |
21,383 | all-21384 | [
"GetPalette",
"returns",
"the",
"Palette",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinitionRequestStyle",
")",
"GetPalette",
"(",
")",
"<mask>",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"Palette",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"Palette",
"\n",
"}"
] |
21,384 | all-21385 | [
"At",
"finds",
"an",
"element",
"at",
"the",
"provided",
"index",
".",
"It",
"only",
"applies",
"to",
"the",
"immediate",
"selection",
"meaning",
"that",
"the",
"returned",
"selection",
"may",
"still",
"refer",
"to",
"multiple",
"elements",
"if",
"any",
"parent",
"of",
"the",
"immediate",
"selection",
"is",
"also",
"a",
"*",
"MultiSelection",
"."
] | [
"func",
"(",
"s",
"*",
"MultiSelection",
")",
"At",
"(",
"index",
"int",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"At",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
21,385 | all-21386 | [
"AppendItem",
"is",
"a",
"wrapper",
"around",
"g_menu_append_item",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Menu",
")",
"AppendItem",
"(",
"item",
"*",
"MenuItem",
")",
"{",
"C",
".",
"g_menu_append_item",
"(",
"v",
".",
"native",
"(",
")",
",",
"<mask>",
".",
"native",
"(",
")",
")",
"\n",
"}"
] |
21,386 | all-21387 | [
"offset",
"parses",
"an",
"offset",
"modifier",
".",
"offset",
"<duration",
">"
] | [
"func",
"(",
"p",
"*",
"parser",
")",
"offset",
"(",
")",
"time",
".",
"Duration",
"{",
"const",
"ctx",
"=",
"\"",
"\"",
"\n\n",
"p",
".",
"next",
"(",
")",
"\n",
"offi",
":=",
"p",
".",
"expect",
"(",
"ItemDuration",
",",
"ctx",
")",
"\n\n",
"offset",
",",
"err",
":=",
"parseDuration",
"(",
"offi",
".",
"val",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"p",
".",
"error",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
21,387 | all-21388 | [
"PopupText",
"returns",
"the",
"current",
"alert",
"confirm",
"or",
"prompt",
"popup",
"text",
"."
] | [
"func",
"(",
"p",
"*",
"Page",
")",
"PopupText",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"text",
",",
"err",
":=",
"p",
".",
"session",
".",
"GetAlertText",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}"
] |
21,388 | all-21389 | [
"DelNetworkList",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockCNI",
")",
"DelNetworkList",
"(",
"arg0",
"*",
"libcni",
".",
"NetworkConfigList",
",",
"arg1",
"*",
"libcni",
".",
"RuntimeConf",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
21,389 | all-21390 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetVersionParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser10",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
21,390 | all-21391 | [
"sendRPC",
"is",
"used",
"to",
"encode",
"and",
"send",
"the",
"RPC",
"."
] | [
"func",
"sendRPC",
"(",
"conn",
"*",
"netConn",
",",
"rpcType",
"uint8",
",",
"args",
"<mask>",
"{",
"}",
")",
"error",
"{",
"// Write the request type",
"if",
"err",
":=",
"conn",
".",
"w",
".",
"WriteByte",
"(",
"rpcType",
")",
";",
"err",
"!=",
"nil",
"{",
"conn",
".",
"Release",
"(",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"// Send the request",
"if",
"err",
":=",
"conn",
".",
"enc",
".",
"Encode",
"(",
"args",
")",
";",
"err",
"!=",
"nil",
"{",
"conn",
".",
"Release",
"(",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"// Flush",
"if",
"err",
":=",
"conn",
".",
"w",
".",
"Flush",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"conn",
".",
"Release",
"(",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
21,391 | all-21392 | [
"updateConfig",
"validates",
"config",
"and",
"if",
"it",
"valides",
"successfully",
"loads",
"it",
"into",
"the",
"apiServer",
"s",
"config",
"cache",
".",
"The",
"caller",
"should",
"already",
"hold",
"a",
".",
"configMu",
"and",
"a",
".",
"samlSPMu",
"(",
"as",
"this",
"updates",
"a",
".",
"samlSP",
")"
] | [
"func",
"(",
"a",
"*",
"apiServer",
")",
"updateConfig",
"(",
"config",
"*",
"auth",
".",
"AuthConfig",
")",
"error",
"{",
"if",
"config",
"==",
"nil",
"{",
"config",
"=",
"&",
"auth",
".",
"AuthConfig",
"{",
"}",
"\n",
"}",
"\n",
"newConfig",
",",
"err",
":=",
"validateConfig",
"(",
"config",
",",
"internal",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// It's possible that 'config' is non-nil, but empty (this is the case when",
"// users clear the config from the command line). Therefore, check",
"// newConfig.IDP.Name != \"\" instead of config != nil.",
"if",
"newConfig",
".",
"IDP",
".",
"<mask>",
"!=",
"\"",
"\"",
"{",
"a",
".",
"configCache",
"=",
"newConfig",
"\n",
"// construct SAML handler",
"a",
".",
"samlSP",
"=",
"&",
"saml",
".",
"ServiceProvider",
"{",
"Logger",
":",
"logrus",
".",
"New",
"(",
")",
",",
"IDPMetadata",
":",
"a",
".",
"configCache",
".",
"IDP",
".",
"Metadata",
",",
"AcsURL",
":",
"*",
"a",
".",
"configCache",
".",
"SAMLSvc",
".",
"ACSURL",
",",
"MetadataURL",
":",
"*",
"a",
".",
"configCache",
".",
"SAMLSvc",
".",
"MetadataURL",
",",
"// Not set:",
"// Key: Private key for Pachyderm ACS. Unclear if needed",
"// Certificate: Public key for Pachyderm ACS. Unclear if needed",
"// ForceAuthn: (whether users need to re-authenticate with the IdP, even",
"// if they already have a session--leaving this false)",
"// AuthnNameIDFormat: (format the ACS expects the AuthnName to be in)",
"// MetadataValidDuration: (how long the SP endpoints are valid? Returned",
"// by the Metadata service)",
"}",
"\n",
"a",
".",
"redirectAddress",
"=",
"a",
".",
"configCache",
".",
"SAMLSvc",
".",
"DashURL",
"// Set redirect address from config as well",
"\n",
"}",
"else",
"{",
"a",
".",
"configCache",
"=",
"nil",
"\n",
"a",
".",
"samlSP",
"=",
"nil",
"\n",
"a",
".",
"redirectAddress",
"=",
"nil",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
21,392 | all-21393 | [
"Get",
"adds",
"the",
"route",
"pattern",
"that",
"matches",
"a",
"GET",
"http",
"method",
"to",
"execute",
"the",
"handlerFn",
"http",
".",
"HandlerFunc",
"."
] | [
"func",
"(",
"mx",
"*",
"Mux",
")",
"Get",
"(",
"pattern",
"string",
",",
"handlerFn",
"http",
".",
"HandlerFunc",
")",
"{",
"mx",
".",
"handle",
"(",
"mGET",
",",
"<mask>",
",",
"handlerFn",
")",
"\n",
"}"
] |
21,393 | all-21394 | [
"nextToken",
"returns",
"the",
"next",
"token",
"from",
"the",
"promlexer",
".",
"It",
"skips",
"over",
"tabs",
"and",
"spaces",
"."
] | [
"func",
"(",
"p",
"*",
"PromParser",
")",
"nextToken",
"(",
")",
"<mask>",
"{",
"for",
"{",
"if",
"tok",
":=",
"p",
".",
"l",
".",
"Lex",
"(",
")",
";",
"tok",
"!=",
"tWhitespace",
"{",
"return",
"tok",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
21,394 | all-21395 | [
"startProxy",
"launches",
"an",
"HTTP",
"proxy",
"for",
"client",
"communication",
"which",
"proxies",
"to",
"other",
"etcd",
"nodes",
"."
] | [
"func",
"startProxy",
"(",
"cfg",
"*",
"config",
")",
"error",
"{",
"lg",
":=",
"cfg",
".",
"ec",
".",
"GetLogger",
"(",
")",
"\n",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Notice",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"clientTLSInfo",
":=",
"cfg",
".",
"ec",
".",
"ClientTLSInfo",
"\n",
"if",
"clientTLSInfo",
".",
"Empty",
"(",
")",
"{",
"// Support old proxy behavior of defaulting to PeerTLSInfo",
"// for both client and peer connections.",
"clientTLSInfo",
"=",
"cfg",
".",
"ec",
".",
"PeerTLSInfo",
"\n",
"}",
"\n",
"clientTLSInfo",
".",
"InsecureSkipVerify",
"=",
"cfg",
".",
"ec",
".",
"ClientAutoTLS",
"\n",
"cfg",
".",
"ec",
".",
"PeerTLSInfo",
".",
"InsecureSkipVerify",
"=",
"cfg",
".",
"ec",
".",
"PeerAutoTLS",
"\n\n",
"pt",
",",
"err",
":=",
"transport",
".",
"NewTimeoutTransport",
"(",
"clientTLSInfo",
",",
"time",
".",
"Duration",
"(",
"cfg",
".",
"cp",
".",
"ProxyDialTimeoutMs",
")",
"*",
"time",
".",
"Millisecond",
",",
"time",
".",
"Duration",
"(",
"cfg",
".",
"cp",
".",
"ProxyReadTimeoutMs",
")",
"*",
"time",
".",
"Millisecond",
",",
"time",
".",
"Duration",
"(",
"cfg",
".",
"cp",
".",
"ProxyWriteTimeoutMs",
")",
"*",
"time",
".",
"Millisecond",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"pt",
".",
"MaxIdleConnsPerHost",
"=",
"httpproxy",
".",
"DefaultMaxIdleConnsPerHost",
"\n\n",
"if",
"err",
"=",
"cfg",
".",
"ec",
".",
"PeerSelfCert",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Fatal",
"(",
"\"",
"\"",
",",
"zap",
".",
"Error",
"(",
"err",
")",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"tr",
",",
"err",
":=",
"transport",
".",
"NewTimeoutTransport",
"(",
"cfg",
".",
"ec",
".",
"PeerTLSInfo",
",",
"time",
".",
"Duration",
"(",
"cfg",
".",
"cp",
".",
"ProxyDialTimeoutMs",
")",
"*",
"time",
".",
"Millisecond",
",",
"time",
".",
"Duration",
"(",
"cfg",
".",
"cp",
".",
"ProxyReadTimeoutMs",
")",
"*",
"time",
".",
"Millisecond",
",",
"<mask>",
".",
"Duration",
"(",
"cfg",
".",
"cp",
".",
"ProxyWriteTimeoutMs",
")",
"*",
"time",
".",
"Millisecond",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"cfg",
".",
"ec",
".",
"Dir",
"=",
"filepath",
".",
"Join",
"(",
"cfg",
".",
"ec",
".",
"Dir",
",",
"\"",
"\"",
")",
"\n",
"err",
"=",
"os",
".",
"MkdirAll",
"(",
"cfg",
".",
"ec",
".",
"Dir",
",",
"fileutil",
".",
"PrivateDirMode",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"var",
"peerURLs",
"[",
"]",
"string",
"\n",
"clusterfile",
":=",
"filepath",
".",
"Join",
"(",
"cfg",
".",
"ec",
".",
"Dir",
",",
"\"",
"\"",
")",
"\n\n",
"b",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"clusterfile",
")",
"\n",
"switch",
"{",
"case",
"err",
"==",
"nil",
":",
"if",
"cfg",
".",
"ec",
".",
"Durl",
"!=",
"\"",
"\"",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"clusterfile",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Warningf",
"(",
"\"",
"\"",
",",
"clusterfile",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"cfg",
".",
"ec",
".",
"DNSCluster",
"!=",
"\"",
"\"",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"clusterfile",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Warningf",
"(",
"\"",
"\"",
",",
"clusterfile",
")",
"\n",
"}",
"\n",
"}",
"\n",
"urls",
":=",
"struct",
"{",
"PeerURLs",
"[",
"]",
"string",
"}",
"{",
"}",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"b",
",",
"&",
"urls",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"peerURLs",
"=",
"urls",
".",
"PeerURLs",
"\n",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"Strings",
"(",
"\"",
"\"",
",",
"peerURLs",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"clusterfile",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"peerURLs",
",",
"clusterfile",
")",
"\n",
"}",
"\n\n",
"case",
"os",
".",
"IsNotExist",
"(",
"err",
")",
":",
"var",
"urlsmap",
"types",
".",
"URLsMap",
"\n",
"urlsmap",
",",
"_",
",",
"err",
"=",
"cfg",
".",
"ec",
".",
"PeerURLsMapAndToken",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"cfg",
".",
"ec",
".",
"Durl",
"!=",
"\"",
"\"",
"{",
"var",
"s",
"string",
"\n",
"s",
",",
"err",
"=",
"v2discovery",
".",
"GetCluster",
"(",
"lg",
",",
"cfg",
".",
"ec",
".",
"Durl",
",",
"cfg",
".",
"ec",
".",
"Dproxy",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"urlsmap",
",",
"err",
"=",
"types",
".",
"NewURLsMap",
"(",
"s",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"peerURLs",
"=",
"urlsmap",
".",
"URLs",
"(",
")",
"\n",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"Strings",
"(",
"\"",
"\"",
",",
"peerURLs",
")",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"peerURLs",
")",
"\n",
"}",
"\n\n",
"default",
":",
"return",
"err",
"\n",
"}",
"\n\n",
"clientURLs",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"uf",
":=",
"func",
"(",
")",
"[",
"]",
"string",
"{",
"gcls",
",",
"gerr",
":=",
"etcdserver",
".",
"GetClusterFromRemotePeers",
"(",
"lg",
",",
"peerURLs",
",",
"tr",
")",
"\n",
"if",
"gerr",
"!=",
"nil",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"Strings",
"(",
"\"",
"\"",
",",
"peerURLs",
")",
",",
"zap",
".",
"Error",
"(",
"gerr",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Warningf",
"(",
"\"",
"\"",
",",
"gerr",
")",
"\n",
"}",
"\n",
"return",
"[",
"]",
"string",
"{",
"}",
"\n",
"}",
"\n\n",
"clientURLs",
"=",
"gcls",
".",
"ClientURLs",
"(",
")",
"\n",
"urls",
":=",
"struct",
"{",
"PeerURLs",
"[",
"]",
"string",
"}",
"{",
"gcls",
".",
"PeerURLs",
"(",
")",
"}",
"\n",
"b",
",",
"jerr",
":=",
"json",
".",
"Marshal",
"(",
"urls",
")",
"\n",
"if",
"jerr",
"!=",
"nil",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"Error",
"(",
"jerr",
")",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Warningf",
"(",
"\"",
"\"",
",",
"jerr",
")",
"\n",
"}",
"\n",
"return",
"clientURLs",
"\n",
"}",
"\n\n",
"err",
"=",
"pkgioutil",
".",
"WriteAndSyncFile",
"(",
"clusterfile",
"+",
"\"",
"\"",
",",
"b",
",",
"0600",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"Error",
"(",
"err",
")",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Warningf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"clientURLs",
"\n",
"}",
"\n",
"err",
"=",
"os",
".",
"Rename",
"(",
"clusterfile",
"+",
"\"",
"\"",
",",
"clusterfile",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"clusterfile",
")",
",",
"zap",
".",
"Error",
"(",
"err",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Warningf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"clientURLs",
"\n",
"}",
"\n",
"if",
"!",
"reflect",
".",
"DeepEqual",
"(",
"gcls",
".",
"PeerURLs",
"(",
")",
",",
"peerURLs",
")",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"Strings",
"(",
"\"",
"\"",
",",
"peerURLs",
")",
",",
"zap",
".",
"Strings",
"(",
"\"",
"\"",
",",
"gcls",
".",
"PeerURLs",
"(",
")",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Noticef",
"(",
"\"",
"\"",
",",
"peerURLs",
",",
"gcls",
".",
"PeerURLs",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"peerURLs",
"=",
"gcls",
".",
"PeerURLs",
"(",
")",
"\n\n",
"return",
"clientURLs",
"\n",
"}",
"\n",
"ph",
":=",
"httpproxy",
".",
"NewHandler",
"(",
"pt",
",",
"uf",
",",
"time",
".",
"Duration",
"(",
"cfg",
".",
"cp",
".",
"ProxyFailureWaitMs",
")",
"*",
"time",
".",
"Millisecond",
",",
"time",
".",
"Duration",
"(",
"cfg",
".",
"cp",
".",
"ProxyRefreshIntervalMs",
")",
"*",
"time",
".",
"Millisecond",
")",
"\n",
"ph",
"=",
"embed",
".",
"WrapCORS",
"(",
"cfg",
".",
"ec",
".",
"CORS",
",",
"ph",
")",
"\n\n",
"if",
"cfg",
".",
"isReadonlyProxy",
"(",
")",
"{",
"ph",
"=",
"httpproxy",
".",
"NewReadonlyHandler",
"(",
"ph",
")",
"\n",
"}",
"\n\n",
"// setup self signed certs when serving https",
"cHosts",
",",
"cTLS",
":=",
"[",
"]",
"string",
"{",
"}",
",",
"false",
"\n",
"for",
"_",
",",
"u",
":=",
"range",
"cfg",
".",
"ec",
".",
"LCUrls",
"{",
"cHosts",
"=",
"append",
"(",
"cHosts",
",",
"u",
".",
"Host",
")",
"\n",
"cTLS",
"=",
"cTLS",
"||",
"u",
".",
"Scheme",
"==",
"\"",
"\"",
"\n",
"}",
"\n",
"for",
"_",
",",
"u",
":=",
"range",
"cfg",
".",
"ec",
".",
"ACUrls",
"{",
"cHosts",
"=",
"append",
"(",
"cHosts",
",",
"u",
".",
"Host",
")",
"\n",
"cTLS",
"=",
"cTLS",
"||",
"u",
".",
"Scheme",
"==",
"\"",
"\"",
"\n",
"}",
"\n",
"listenerTLS",
":=",
"cfg",
".",
"ec",
".",
"ClientTLSInfo",
"\n",
"if",
"cfg",
".",
"ec",
".",
"ClientAutoTLS",
"&&",
"cTLS",
"{",
"listenerTLS",
",",
"err",
"=",
"transport",
".",
"SelfCert",
"(",
"cfg",
".",
"ec",
".",
"GetLogger",
"(",
")",
",",
"filepath",
".",
"Join",
"(",
"cfg",
".",
"ec",
".",
"Dir",
",",
"\"",
"\"",
")",
",",
"cHosts",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Fatal",
"(",
"\"",
"\"",
",",
"zap",
".",
"Error",
"(",
"err",
")",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Start a proxy server goroutine for each listen address",
"for",
"_",
",",
"u",
":=",
"range",
"cfg",
".",
"ec",
".",
"LCUrls",
"{",
"l",
",",
"err",
":=",
"transport",
".",
"NewListener",
"(",
"u",
".",
"Host",
",",
"u",
".",
"Scheme",
",",
"&",
"listenerTLS",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"host",
":=",
"u",
".",
"String",
"(",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"host",
")",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"host",
")",
"\n",
"}",
"\n",
"mux",
":=",
"http",
".",
"NewServeMux",
"(",
")",
"\n",
"etcdhttp",
".",
"HandlePrometheus",
"(",
"mux",
")",
"// v2 proxy just uses the same port",
"\n",
"mux",
".",
"Handle",
"(",
"\"",
"\"",
",",
"ph",
")",
"\n",
"plog",
".",
"Fatal",
"(",
"http",
".",
"Serve",
"(",
"l",
",",
"mux",
")",
")",
"\n",
"}",
"(",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
21,395 | all-21396 | [
"WithTransferMode",
"whether",
"to",
"report",
"trace",
"events",
"as",
"series",
"of",
"dataCollected",
"events",
"or",
"to",
"save",
"trace",
"to",
"a",
"stream",
"(",
"defaults",
"to",
"ReportEvents",
")",
"."
] | [
"func",
"(",
"p",
"StartParams",
")",
"WithTransferMode",
"(",
"transferMode",
"TransferMode",
")",
"*",
"StartParams",
"{",
"p",
".",
"TransferMode",
"=",
"transferMode",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
21,396 | all-21397 | [
"GetStoragePoolVolumes",
"returns",
"a",
"list",
"of",
"StorageVolume",
"entries",
"for",
"the",
"provided",
"pool"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetStoragePoolVolumes",
"(",
"pool",
"string",
")",
"(",
"[",
"]",
"api",
".",
"StorageVolume",
",",
"error",
")",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"volumes",
":=",
"[",
"]",
"api",
".",
"StorageVolume",
"{",
"}",
"\n\n",
"// Fetch the raw value",
"_",
",",
"err",
":=",
"r",
".",
"queryStruct",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"QueryEscape",
"(",
"pool",
")",
")",
",",
"nil",
",",
"\"",
"\"",
",",
"&",
"volumes",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"volumes",
",",
"nil",
"\n",
"}"
] |
21,397 | all-21398 | [
"UntagResourceWithContext",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockSecretsManagerAPI",
")",
"UntagResourceWithContext",
"(",
"arg0",
"aws",
".",
"Context",
",",
"arg1",
"*",
"secretsmanager",
".",
"UntagResourceInput",
",",
"arg2",
"...",
"request",
".",
"Option",
")",
"(",
"*",
"secretsmanager",
".",
"UntagResourceOutput",
",",
"error",
")",
"{",
"varargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"arg0",
",",
"arg1",
"}",
"\n",
"for",
"_",
",",
"a",
":=",
"range",
"arg2",
"{",
"varargs",
"=",
"<mask>",
"(",
"varargs",
",",
"a",
")",
"\n",
"}",
"\n",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"varargs",
"...",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"secretsmanager",
".",
"UntagResourceOutput",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
21,398 | all-21399 | [
"CheckConfig",
"validates",
"configuration",
"files",
"."
] | [
"func",
"CheckConfig",
"(",
"files",
"...",
"string",
")",
"int",
"{",
"<mask>",
":=",
"false",
"\n\n",
"for",
"_",
",",
"f",
":=",
"range",
"files",
"{",
"ruleFiles",
",",
"err",
":=",
"checkConfig",
"(",
"f",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Fprintln",
"(",
"os",
".",
"Stderr",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"failed",
"=",
"true",
"\n",
"}",
"else",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"len",
"(",
"ruleFiles",
")",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Println",
"(",
")",
"\n\n",
"for",
"_",
",",
"rf",
":=",
"range",
"ruleFiles",
"{",
"if",
"n",
",",
"err",
":=",
"checkRules",
"(",
"rf",
")",
";",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Fprintln",
"(",
"os",
".",
"Stderr",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"failed",
"=",
"true",
"\n",
"}",
"else",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"n",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Println",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"failed",
"{",
"return",
"1",
"\n",
"}",
"\n",
"return",
"0",
"\n",
"}"
] |
21,399 | all-21400 | [
"Do",
"performs",
"the",
"given",
"http",
"request",
"and",
"sets",
"the",
"corresponding",
"response",
".",
"Request",
"must",
"contain",
"at",
"least",
"non",
"-",
"zero",
"RequestURI",
"with",
"full",
"url",
"(",
"including",
"scheme",
"and",
"host",
")",
"or",
"non",
"-",
"zero",
"Host",
"header",
"+",
"RequestURI",
".",
"The",
"function",
"doesn",
"t",
"follow",
"redirects",
".",
"Use",
"Get",
"*",
"for",
"following",
"redirects",
".",
"Response",
"is",
"ignored",
"if",
"resp",
"is",
"nil",
".",
"ErrNoFreeConns",
"is",
"returned",
"if",
"all",
"HostClient",
".",
"MaxConns",
"connections",
"to",
"the",
"host",
"are",
"busy",
".",
"It",
"is",
"recommended",
"obtaining",
"req",
"and",
"resp",
"via",
"AcquireRequest",
"and",
"AcquireResponse",
"in",
"performance",
"-",
"critical",
"code",
"."
] | [
"func",
"(",
"c",
"*",
"HostClient",
")",
"Do",
"(",
"req",
"*",
"Request",
",",
"resp",
"*",
"Response",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"<mask>",
"retry",
"bool",
"\n",
"maxAttempts",
":=",
"c",
".",
"MaxIdemponentCallAttempts",
"\n",
"if",
"maxAttempts",
"<=",
"0",
"{",
"maxAttempts",
"=",
"DefaultMaxIdemponentCallAttempts",
"\n",
"}",
"\n",
"attempts",
":=",
"0",
"\n\n",
"atomic",
".",
"AddInt32",
"(",
"&",
"c",
".",
"pendingRequests",
",",
"1",
")",
"\n",
"for",
"{",
"retry",
",",
"err",
"=",
"c",
".",
"do",
"(",
"req",
",",
"resp",
")",
"\n",
"if",
"err",
"==",
"nil",
"||",
"!",
"retry",
"{",
"break",
"\n",
"}",
"\n\n",
"if",
"!",
"isIdempotent",
"(",
"req",
")",
"{",
"// Retry non-idempotent requests if the server closes",
"// the connection before sending the response.",
"//",
"// This case is possible if the server closes the idle",
"// keep-alive connection on timeout.",
"//",
"// Apache and nginx usually do this.",
"if",
"err",
"!=",
"io",
".",
"EOF",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"attempts",
"++",
"\n",
"if",
"attempts",
">=",
"maxAttempts",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"atomic",
".",
"AddInt32",
"(",
"&",
"c",
".",
"pendingRequests",
",",
"-",
"1",
")",
"\n\n",
"if",
"err",
"==",
"io",
".",
"EOF",
"{",
"err",
"=",
"ErrConnectionClosed",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.