id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
16,600 | all-16601 | [
"ExtraLeetEntropy",
"calulates",
"the",
"added",
"entropy",
"provied",
"by",
"l33t",
"substitustions"
]
| [
"func",
"ExtraLeetEntropy",
"(",
"match",
"<mask>",
".",
"Match",
",",
"password",
"string",
")",
"float64",
"{",
"var",
"subsitutions",
"float64",
"\n",
"var",
"unsub",
"float64",
"\n",
"subPassword",
":=",
"password",
"[",
"match",
".",
"I",
":",
"match",
".",
"J",
"]",
"\n",
"for",
"index",
",",
"char",
":=",
"range",
"subPassword",
"{",
"if",
"string",
"(",
"char",
")",
"!=",
"string",
"(",
"match",
".",
"Token",
"[",
"index",
"]",
")",
"{",
"subsitutions",
"++",
"\n",
"}",
"else",
"{",
"//TODO: Make this only true for 1337 chars that are not subs?",
"unsub",
"++",
"\n",
"}",
"\n",
"}",
"\n\n",
"var",
"possibilities",
"float64",
"\n\n",
"for",
"i",
":=",
"float64",
"(",
"0",
")",
";",
"i",
"<=",
"math",
".",
"Min",
"(",
"subsitutions",
",",
"unsub",
")",
"+",
"1",
";",
"i",
"++",
"{",
"possibilities",
"+=",
"zxcvbnmath",
".",
"NChoseK",
"(",
"subsitutions",
"+",
"unsub",
",",
"i",
")",
"\n",
"}",
"\n\n",
"if",
"possibilities",
"<=",
"1",
"{",
"return",
"float64",
"(",
"1",
")",
"\n",
"}",
"\n",
"return",
"math",
".",
"Log2",
"(",
"possibilities",
")",
"\n",
"}"
]
|
16,601 | all-16602 | [
"filterByAnnotations",
"filters",
"a",
"list",
"of",
"ingresses",
"by",
"a",
"given",
"annotation",
"selector",
"."
]
| [
"func",
"(",
"sc",
"*",
"ingressSource",
")",
"filterByAnnotations",
"(",
"ingresses",
"[",
"]",
"*",
"v1beta1",
".",
"Ingress",
")",
"(",
"[",
"]",
"*",
"v1beta1",
".",
"Ingress",
",",
"error",
")",
"{",
"labelSelector",
",",
"err",
":=",
"metav1",
".",
"ParseToLabelSelector",
"(",
"sc",
".",
"annotationFilter",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"selector",
",",
"err",
":=",
"metav1",
".",
"LabelSelectorAsSelector",
"(",
"labelSelector",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// empty filter returns original list",
"if",
"selector",
".",
"Empty",
"(",
")",
"{",
"return",
"ingresses",
",",
"nil",
"\n",
"}",
"\n\n",
"filteredList",
":=",
"[",
"]",
"*",
"v1beta1",
".",
"Ingress",
"{",
"}",
"\n\n",
"for",
"_",
",",
"ingress",
":=",
"range",
"ingresses",
"{",
"// convert the ingress' annotations to an equivalent label selector",
"annotations",
":=",
"labels",
".",
"Set",
"(",
"ingress",
".",
"Annotations",
")",
"\n\n",
"// include ingress if its annotations match the selector",
"if",
"selector",
".",
"Matches",
"(",
"annotations",
")",
"{",
"filteredList",
"=",
"<mask>",
"(",
"filteredList",
",",
"ingress",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"filteredList",
",",
"nil",
"\n",
"}"
]
|
16,602 | all-16603 | [
"Return",
"information",
"about",
"the",
"LXD",
"nodes",
"that",
"a",
"currently",
"part",
"of",
"the",
"raft",
"cluster",
"as",
"configured",
"in",
"the",
"raft",
"log",
".",
"It",
"returns",
"an",
"error",
"if",
"this",
"node",
"is",
"not",
"the",
"leader",
"."
]
| [
"func",
"(",
"g",
"*",
"Gateway",
")",
"currentRaftNodes",
"(",
")",
"(",
"[",
"]",
"db",
".",
"RaftNode",
",",
"error",
")",
"{",
"if",
"g",
".",
"raft",
"==",
"nil",
"{",
"return",
"nil",
",",
"raft",
".",
"ErrNotLeader",
"\n",
"}",
"\n",
"servers",
",",
"err",
":=",
"g",
".",
"raft",
".",
"Servers",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"provider",
":=",
"raftAddressProvider",
"{",
"db",
":",
"g",
".",
"db",
"}",
"\n",
"nodes",
":=",
"make",
"(",
"[",
"]",
"db",
".",
"RaftNode",
",",
"len",
"(",
"servers",
")",
")",
"\n",
"for",
"i",
",",
"server",
":=",
"range",
"servers",
"{",
"address",
",",
"err",
":=",
"provider",
".",
"ServerAddr",
"(",
"server",
".",
"ID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"!=",
"db",
".",
"ErrNoSuchObject",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"// Use the initial address as fallback. This is an edge",
"// case that happens when a new leader is elected and",
"// its raft_nodes table is not fully up-to-date yet.",
"<mask>",
"=",
"server",
".",
"Address",
"\n",
"}",
"\n",
"id",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"string",
"(",
"server",
".",
"ID",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"nodes",
"[",
"i",
"]",
".",
"ID",
"=",
"int64",
"(",
"id",
")",
"\n",
"nodes",
"[",
"i",
"]",
".",
"Address",
"=",
"string",
"(",
"address",
")",
"\n",
"}",
"\n",
"return",
"nodes",
",",
"nil",
"\n",
"}"
]
|
16,603 | all-16604 | [
"Make",
"sure",
"the",
"local",
"WriteHeader",
"is",
"called",
"and",
"call",
"the",
"parent",
"Flush",
".",
"Provided",
"in",
"order",
"to",
"implement",
"the",
"http",
".",
"Flusher",
"interface",
"."
]
| [
"func",
"(",
"w",
"*",
"jsonpResponseWriter",
")",
"Flush",
"(",
")",
"{",
"if",
"!",
"w",
".",
"wroteHeader",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusOK",
")",
"\n",
"}",
"\n",
"flusher",
":=",
"w",
".",
"ResponseWriter",
".",
"(",
"<mask>",
".",
"Flusher",
")",
"\n",
"flusher",
".",
"Flush",
"(",
")",
"\n",
"}"
]
|
16,604 | all-16605 | [
"ConfirmUsable",
"is",
"a",
"modified",
"copy",
"of",
"k8s",
".",
"io",
"/",
"kubernetes",
"/",
"pkg",
"/",
"client",
"/",
"unversioned",
"/",
"clientcmd",
".",
"DirectClientConfig",
".",
"ConfirmUsable",
".",
"ConfirmUsable",
"looks",
"a",
"particular",
"context",
"and",
"determines",
"if",
"that",
"particular",
"part",
"of",
"the",
"config",
"is",
"useable",
".",
"There",
"might",
"still",
"be",
"errors",
"in",
"the",
"config",
"but",
"no",
"errors",
"in",
"the",
"sections",
"requested",
"or",
"referenced",
".",
"It",
"does",
"not",
"return",
"early",
"so",
"that",
"it",
"can",
"find",
"as",
"many",
"errors",
"as",
"possible",
"."
]
| [
"func",
"(",
"config",
"*",
"directClientConfig",
")",
"ConfirmUsable",
"(",
")",
"error",
"{",
"var",
"validationErrors",
"[",
"]",
"error",
"\n",
"validationErrors",
"=",
"<mask>",
"(",
"validationErrors",
",",
"validateAuthInfo",
"(",
"config",
".",
"getAuthInfoName",
"(",
")",
",",
"config",
".",
"getAuthInfo",
"(",
")",
")",
"...",
")",
"\n",
"validationErrors",
"=",
"append",
"(",
"validationErrors",
",",
"validateClusterInfo",
"(",
"config",
".",
"getClusterName",
"(",
")",
",",
"config",
".",
"getCluster",
"(",
")",
")",
"...",
")",
"\n",
"// when direct client config is specified, and our only error is that no server is defined, we should",
"// return a standard \"no config\" error",
"if",
"len",
"(",
"validationErrors",
")",
"==",
"1",
"&&",
"validationErrors",
"[",
"0",
"]",
"==",
"errEmptyCluster",
"{",
"return",
"newErrConfigurationInvalid",
"(",
"[",
"]",
"error",
"{",
"errEmptyConfig",
"}",
")",
"\n",
"}",
"\n",
"return",
"newErrConfigurationInvalid",
"(",
"validationErrors",
")",
"\n",
"}"
]
|
16,605 | all-16606 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"SnapshotCommandLogParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoLayertree2",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
16,606 | all-16607 | [
"DecrRef",
"decrements",
"the",
"refcount",
"deallocating",
"the",
"Skiplist",
"when",
"done",
"using",
"it"
]
| [
"func",
"(",
"s",
"*",
"Skiplist",
")",
"DecrRef",
"(",
")",
"{",
"newRef",
":=",
"atomic",
".",
"AddInt32",
"(",
"&",
"s",
".",
"ref",
",",
"-",
"1",
")",
"\n",
"if",
"newRef",
">",
"0",
"{",
"return",
"\n",
"}",
"\n\n",
"s",
".",
"arena",
".",
"<mask>",
"(",
")",
"\n",
"// Indicate we are closed. Good for testing. Also, lets GC reclaim memory. Race condition",
"// here would suggest we are accessing skiplist when we are supposed to have no reference!",
"s",
".",
"arena",
"=",
"nil",
"\n",
"}"
]
|
16,607 | all-16608 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"GetPropertiesReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime21",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
16,608 | all-16609 | [
"Tracer",
"sets",
"a",
"request",
"tracer",
"constructor"
]
| [
"func",
"Tracer",
"(",
"newTracer",
"NewTracer",
")",
"ClientParam",
"{",
"return",
"func",
"(",
"c",
"*",
"<mask>",
")",
"error",
"{",
"c",
".",
"newTracer",
"=",
"newTracer",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
]
|
16,609 | all-16610 | [
"getValue",
"gets",
"the",
"raw",
"value",
"for",
"a",
"given",
"key"
]
| [
"func",
"(",
"c",
"GConfig",
")",
"getValue",
"(",
"key",
"string",
")",
"interface",
"{",
"}",
"{",
"v",
":=",
"c",
".",
"defaultConfig",
".",
"configs",
"[",
"<mask>",
"]",
"\n",
"if",
"c",
".",
"profileConfig",
".",
"fileInfo",
"!=",
"nil",
"&&",
"s",
".",
"Contains",
"(",
"c",
".",
"profileConfig",
".",
"fileInfo",
".",
"Name",
"(",
")",
",",
"c",
".",
"Profile",
")",
"{",
"v",
"=",
"c",
".",
"profileConfig",
".",
"configs",
"[",
"key",
"]",
"\n",
"}",
"\n",
"if",
"v",
"==",
"nil",
"{",
"v",
"=",
"c",
".",
"defaultConfig",
".",
"configs",
"[",
"key",
"]",
"\n",
"}",
"\n\n",
"return",
"v",
"\n",
"}"
]
|
16,610 | all-16611 | [
"RegisterResourceProviders",
"registers",
"current",
"subscription",
"to",
"the",
"specified",
"resource",
"provider",
"namespaces",
"if",
"they",
"are",
"not",
"already",
"registered",
".",
"Namespaces",
"are",
"case",
"-",
"insensitive",
"."
]
| [
"func",
"(",
"a",
"AzureClient",
")",
"RegisterResourceProviders",
"(",
"namespaces",
"...",
"string",
")",
"error",
"{",
"l",
",",
"err",
":=",
"a",
".",
"providersClient",
"(",
")",
".",
"List",
"(",
"nil",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"l",
".",
"Value",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"*",
"l",
".",
"Value",
"{",
"m",
"[",
"strings",
".",
"ToLower",
"(",
"to",
".",
"String",
"(",
"p",
".",
"Namespace",
")",
")",
"]",
"=",
"to",
".",
"String",
"(",
"p",
".",
"RegistrationState",
")",
"==",
"\"",
"\"",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"ns",
":=",
"range",
"namespaces",
"{",
"registered",
",",
"ok",
":=",
"m",
"[",
"strings",
".",
"ToLower",
"(",
"ns",
")",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ns",
")",
"\n",
"}",
"\n",
"if",
"registered",
"{",
"<mask>",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"ns",
")",
"\n",
"}",
"else",
"{",
"log",
".",
"Info",
"(",
"\"",
"\"",
",",
"logutil",
".",
"Fields",
"{",
"\"",
"\"",
":",
"ns",
",",
"\"",
"\"",
":",
"a",
".",
"subscriptionID",
",",
"}",
")",
"\n",
"if",
"_",
",",
"err",
":=",
"a",
".",
"providersClient",
"(",
")",
".",
"Register",
"(",
"ns",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
16,611 | all-16612 | [
"/",
"*",
"wait",
"for",
"key",
"event",
"infinitely",
"(",
"delay<",
"=",
"0",
")",
"or",
"for",
"delay",
"milliseconds"
]
| [
"func",
"WaitKey",
"(",
"delay",
"int",
")",
"int",
"{",
"key",
":=",
"C",
".",
"cvWaitKey",
"(",
"C",
".",
"int",
"(",
"<mask>",
")",
")",
"\n",
"return",
"int",
"(",
"key",
")",
"\n",
"}"
]
|
16,612 | all-16613 | [
"NewImage",
"returns",
"a",
"types",
".",
"ImageCloser",
"for",
"this",
"reference",
"possibly",
"specialized",
"for",
"this",
"ImageTransport",
".",
"The",
"caller",
"must",
"call",
".",
"Close",
"()",
"on",
"the",
"returned",
"ImageCloser",
".",
"NOTE",
":",
"If",
"any",
"kind",
"of",
"signature",
"verification",
"should",
"happen",
"build",
"an",
"UnparsedImage",
"from",
"the",
"value",
"returned",
"by",
"NewImageSource",
"verify",
"that",
"UnparsedImage",
"and",
"convert",
"it",
"into",
"a",
"real",
"Image",
"via",
"image",
".",
"FromUnparsedImage",
".",
"WARNING",
":",
"This",
"may",
"not",
"do",
"the",
"right",
"thing",
"for",
"a",
"manifest",
"list",
"see",
"image",
".",
"FromSource",
"for",
"details",
"."
]
| [
"func",
"(",
"ref",
"dirReference",
")",
"NewImage",
"(",
"ctx",
"<mask>",
".",
"Context",
",",
"sys",
"*",
"types",
".",
"SystemContext",
")",
"(",
"types",
".",
"ImageCloser",
",",
"error",
")",
"{",
"src",
":=",
"newImageSource",
"(",
"ref",
")",
"\n",
"return",
"image",
".",
"FromSource",
"(",
"ctx",
",",
"sys",
",",
"src",
")",
"\n",
"}"
]
|
16,613 | all-16614 | [
"CheckUint64",
"is",
"a",
"convenience",
"method",
"which",
"does",
"an",
"unchecked",
"type",
"conversion",
"from",
"an",
"uint64",
"to",
"a",
"float64",
"."
]
| [
"func",
"(",
"r",
"*",
"<mask>",
")",
"CheckUint64",
"(",
"val",
"uint64",
")",
"bool",
"{",
"return",
"r",
".",
"Check",
"(",
"float64",
"(",
"val",
")",
")",
"\n",
"}"
]
|
16,614 | all-16615 | [
"SetJustify",
"is",
"a",
"wrapper",
"around",
"gtk_label_set_justify",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetJustify",
"(",
"jtype",
"Justification",
")",
"{",
"C",
".",
"gtk_label_set_justify",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkJustification",
"(",
"jtype",
")",
")",
"\n",
"}"
]
|
16,615 | all-16616 | [
"GetQSet",
"retrieves",
"the",
"QSet",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
]
| [
"func",
"(",
"u",
"StellarMessage",
")",
"GetQSet",
"(",
")",
"(",
"result",
"ScpQuorumSet",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"<mask>",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"QSet",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
]
|
16,616 | all-16617 | [
"See",
"bcd",
".",
"Tracer",
".",
"Options",
"()",
"."
]
| [
"func",
"(",
"t",
"*",
"BTTracer",
")",
"<mask>",
"(",
")",
"[",
"]",
"string",
"{",
"t",
".",
"m",
".",
"RLock",
"(",
")",
"\n",
"defer",
"t",
".",
"m",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"append",
"(",
"[",
"]",
"string",
"(",
"nil",
")",
",",
"t",
".",
"options",
"...",
")",
"\n",
"}"
]
|
16,617 | all-16618 | [
"PolicyConfigurationIdentity",
"returns",
"a",
"string",
"representation",
"of",
"the",
"reference",
"suitable",
"for",
"policy",
"lookup",
".",
"This",
"MUST",
"reflect",
"user",
"intent",
"not",
"e",
".",
"g",
".",
"after",
"processing",
"of",
"third",
"-",
"party",
"redirects",
"or",
"aliases",
";",
"The",
"value",
"SHOULD",
"be",
"fully",
"explicit",
"about",
"its",
"semantics",
"with",
"no",
"hidden",
"defaults",
"AND",
"canonical",
"(",
"i",
".",
"e",
".",
"various",
"references",
"with",
"exactly",
"the",
"same",
"semantics",
"should",
"return",
"the",
"same",
"configuration",
"identity",
")",
"It",
"is",
"fine",
"for",
"the",
"return",
"value",
"to",
"be",
"equal",
"to",
"StringWithinTransport",
"()",
"and",
"it",
"is",
"desirable",
"but",
"not",
"required",
"/",
"guaranteed",
"that",
"it",
"will",
"be",
"a",
"valid",
"input",
"to",
"Transport",
"()",
".",
"ParseReference",
"()",
".",
"Returns",
"if",
"configuration",
"identities",
"for",
"these",
"references",
"are",
"not",
"supported",
"."
]
| [
"func",
"(",
"ref",
"dockerReference",
")",
"PolicyConfigurationIdentity",
"(",
")",
"string",
"{",
"res",
",",
"err",
":=",
"policyconfiguration",
".",
"DockerReferenceIdentity",
"(",
"ref",
".",
"ref",
")",
"\n",
"if",
"<mask>",
"==",
"\"",
"\"",
"||",
"err",
"!=",
"nil",
"{",
"// Coverage: Should never happen, NewReference above should refuse values which could cause a failure.",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"res",
",",
"err",
")",
")",
"\n",
"}",
"\n",
"return",
"res",
"\n",
"}"
]
|
16,618 | all-16619 | [
"MutateManageOffer",
"for",
"OfferID",
"sets",
"the",
"ManageOfferOp",
"s",
"OfferID",
"field"
]
| [
"func",
"(",
"m",
"OfferID",
")",
"MutateManageOffer",
"(",
"o",
"interface",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"switch",
"o",
":=",
"o",
".",
"(",
"type",
")",
"{",
"default",
":",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"<mask>",
"*",
"xdr",
".",
"ManageOfferOp",
":",
"o",
".",
"OfferId",
"=",
"xdr",
".",
"Uint64",
"(",
"m",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
]
|
16,619 | all-16620 | [
"Delete",
"a",
"client",
"please",
"note",
"that",
"any",
"roles",
"related",
"to",
"this",
"client",
"must",
"be",
"deleted",
"independently",
".",
"Required",
"scopes",
":",
"auth",
":",
"delete",
"-",
"client",
":",
"<clientId",
">",
"See",
"#deleteClient"
]
| [
"func",
"(",
"auth",
"*",
"Auth",
")",
"DeleteClient",
"(",
"clientId",
"string",
")",
"error",
"{",
"cd",
":=",
"tcclient",
".",
"<mask>",
"(",
"*",
"auth",
")",
"\n",
"_",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"clientId",
")",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
]
|
16,620 | all-16621 | [
"ScrolledWindowNew",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_scrolled_window_new",
"()",
"."
]
| [
"func",
"ScrolledWindowNew",
"(",
"hadjustment",
",",
"vadjustment",
"*",
"Adjustment",
")",
"(",
"*",
"ScrolledWindow",
",",
"<mask>",
")",
"{",
"c",
":=",
"C",
".",
"gtk_scrolled_window_new",
"(",
"hadjustment",
".",
"native",
"(",
")",
",",
"vadjustment",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapScrolledWindow",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
]
|
16,621 | all-16622 | [
"MarshalBinary",
"interface",
"implementation"
]
| [
"func",
"(",
"m",
"*",
"NewTask",
")",
"MarshalBinary",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"return",
"swag",
".",
"WriteJSON",
"(",
"m",
")",
"\n",
"}"
]
|
16,622 | all-16623 | [
"determine",
"if",
"a",
"name",
"corresponds",
"to",
"a",
"texture"
]
| [
"func",
"IsTexture",
"(",
"texture",
"uint32",
")",
"bool",
"{",
"<mask>",
":=",
"C",
".",
"glowIsTexture",
"(",
"gpIsTexture",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"texture",
")",
")",
"\n",
"return",
"ret",
"==",
"TRUE",
"\n",
"}"
]
|
16,623 | all-16624 | [
"GetFont",
"is",
"a",
"wrapper",
"around",
"gtk_font_chooser_get_font",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"FontChooser",
")",
"GetFont",
"(",
")",
"<mask>",
"{",
"c",
":=",
"C",
".",
"gtk_font_chooser_get_font",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"goString",
"(",
"c",
")",
"\n",
"}"
]
|
16,624 | all-16625 | [
"read",
"reads",
"and",
"decrypts",
"one",
"or",
"more",
"input",
"blocks",
"into",
"p",
".",
"len",
"(",
"p",
")",
"must",
"be",
">",
"=",
"cipher",
"block",
"size",
"."
]
| [
"func",
"(",
"cr",
"*",
"cipherBlockReader",
")",
"read",
"(",
"p",
"[",
"]",
"byte",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"bs",
":=",
"cr",
".",
"mode",
".",
"BlockSize",
"(",
")",
"\n",
"// round p down to a multiple of the block size",
"l",
":=",
"len",
"(",
"p",
")",
"-",
"len",
"(",
"p",
")",
"%",
"bs",
"\n",
"p",
"=",
"p",
"[",
":",
"l",
"]",
"\n\n",
"l",
"=",
"len",
"(",
"cr",
".",
"inbuf",
")",
"\n",
"if",
"l",
">",
"0",
"{",
"// copy any buffered input into p",
"copy",
"(",
"p",
",",
"cr",
".",
"inbuf",
")",
"\n",
"cr",
".",
"inbuf",
"=",
"cr",
".",
"inbuf",
"[",
":",
"0",
"]",
"\n",
"}",
"\n",
"// read data for at least one block",
"n",
",",
"err",
"=",
"io",
".",
"ReadAtLeast",
"(",
"cr",
".",
"r",
",",
"p",
"[",
"l",
":",
"]",
",",
"bs",
"-",
"l",
")",
"\n",
"n",
"+=",
"l",
"\n",
"p",
"=",
"p",
"[",
":",
"n",
"]",
"\n\n",
"l",
"=",
"n",
"%",
"bs",
"\n",
"// check if p is a multiple of the cipher block size",
"if",
"l",
">",
"0",
"{",
"n",
"-=",
"l",
"\n",
"// save trailing partial block to process later",
"cr",
".",
"inbuf",
"=",
"append",
"(",
"cr",
".",
"inbuf",
",",
"p",
"[",
"n",
":",
"]",
"...",
")",
"\n",
"p",
"=",
"p",
"[",
":",
"n",
"]",
"\n",
"}",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"io",
".",
"ErrUnexpectedEOF",
"||",
"err",
"==",
"io",
".",
"ErrShortBuffer",
"{",
"// ignore trailing bytes < block size length",
"err",
"=",
"io",
".",
"EOF",
"\n",
"}",
"\n",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"cr",
".",
"<mask>",
".",
"CryptBlocks",
"(",
"p",
",",
"p",
")",
"// decrypt block(s)",
"\n",
"return",
"n",
",",
"nil",
"\n",
"}"
]
|
16,625 | all-16626 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"StackTraceID",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime1",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
16,626 | all-16627 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"BindParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoTethering2",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
]
|
16,627 | all-16628 | [
"RowsPrevious",
"creates",
"a",
"Rows",
"query",
"with",
"the",
"given",
"previous",
"row",
"ID",
"/",
"key"
]
| [
"func",
"(",
"f",
"*",
"Field",
")",
"RowsPrevious",
"(",
"rowIDOrKey",
"interface",
"{",
"}",
")",
"*",
"PQLRowsQuery",
"{",
"idKey",
",",
"err",
":=",
"formatIDKey",
"(",
"rowIDOrKey",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"NewPQLRowsQuery",
"(",
"\"",
"\"",
",",
"f",
".",
"index",
",",
"err",
")",
"\n",
"}",
"\n",
"text",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"f",
".",
"name",
",",
"idKey",
")",
"\n",
"return",
"NewPQLRowsQuery",
"(",
"text",
",",
"f",
".",
"<mask>",
",",
"nil",
")",
"\n",
"}"
]
|
16,628 | all-16629 | [
"Contains",
"returns",
"true",
"if",
"the",
"interval",
"tree",
"s",
"keys",
"cover",
"the",
"entire",
"given",
"interval",
"."
]
| [
"func",
"(",
"ivt",
"*",
"IntervalTree",
")",
"Contains",
"(",
"ivl",
"Interval",
")",
"bool",
"{",
"<mask>",
"maxEnd",
",",
"minBegin",
"Comparable",
"\n\n",
"isContiguous",
":=",
"true",
"\n",
"ivt",
".",
"Visit",
"(",
"ivl",
",",
"func",
"(",
"n",
"*",
"IntervalValue",
")",
"bool",
"{",
"if",
"minBegin",
"==",
"nil",
"{",
"minBegin",
"=",
"n",
".",
"Ivl",
".",
"Begin",
"\n",
"maxEnd",
"=",
"n",
".",
"Ivl",
".",
"End",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"if",
"maxEnd",
".",
"Compare",
"(",
"n",
".",
"Ivl",
".",
"Begin",
")",
"<",
"0",
"{",
"isContiguous",
"=",
"false",
"\n",
"return",
"false",
"\n",
"}",
"\n",
"if",
"n",
".",
"Ivl",
".",
"End",
".",
"Compare",
"(",
"maxEnd",
")",
">",
"0",
"{",
"maxEnd",
"=",
"n",
".",
"Ivl",
".",
"End",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}",
")",
"\n\n",
"return",
"isContiguous",
"&&",
"minBegin",
"!=",
"nil",
"&&",
"maxEnd",
".",
"Compare",
"(",
"ivl",
".",
"End",
")",
">=",
"0",
"&&",
"minBegin",
".",
"Compare",
"(",
"ivl",
".",
"Begin",
")",
"<=",
"0",
"\n",
"}"
]
|
16,629 | all-16630 | [
"Render",
"a",
"string",
"using",
"the",
"given",
"the",
"context",
"."
]
| [
"func",
"Render",
"(",
"<mask>",
"string",
",",
"ctx",
"hctx",
".",
"Context",
")",
"(",
"string",
",",
"error",
")",
"{",
"t",
",",
"err",
":=",
"Parse",
"(",
"input",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"t",
".",
"Exec",
"(",
"ctx",
")",
"\n",
"}"
]
|
16,630 | all-16631 | [
"StoragePoolCreated",
"sets",
"the",
"state",
"of",
"the",
"given",
"pool",
"to",
"Created",
"."
]
| [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"StoragePoolCreated",
"(",
"<mask>",
"string",
")",
"error",
"{",
"return",
"c",
".",
"storagePoolState",
"(",
"name",
",",
"storagePoolCreated",
")",
"\n",
"}"
]
|
16,631 | all-16632 | [
"Read",
"receives",
"n",
"bytes",
"sent",
"from",
"the",
"server",
"to",
"the",
"client",
"and",
"returns",
"into",
"p",
".",
"Note",
"that",
"Read",
"can",
"only",
"be",
"used",
"for",
"receiving",
"TELNET",
"(",
"and",
"TELNETS",
")",
"data",
"from",
"the",
"server",
".",
"TELNET",
"(",
"and",
"TELNETS",
")",
"command",
"codes",
"cannot",
"be",
"received",
"using",
"this",
"method",
"as",
"Read",
"deals",
"with",
"TELNET",
"(",
"and",
"TELNETS",
")",
"unescaping",
"and",
"(",
"when",
"appropriate",
")",
"filters",
"out",
"TELNET",
"(",
"and",
"TELNETS",
")",
"command",
"codes",
".",
"Read",
"makes",
"Client",
"fit",
"the",
"io",
".",
"Reader",
"interface",
"."
]
| [
"func",
"(",
"clientConn",
"*",
"Conn",
")",
"Read",
"(",
"p",
"[",
"]",
"<mask>",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"return",
"clientConn",
".",
"dataReader",
".",
"Read",
"(",
"p",
")",
"\n",
"}"
]
|
16,632 | all-16633 | [
"HasBody",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"s",
"*",
"SyntheticsRequest",
")",
"HasBody",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"<mask>",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
16,633 | all-16634 | [
"UpdateArticle",
"updates",
"an",
"existing",
"Article",
"in",
"our",
"persistent",
"store",
"."
]
| [
"func",
"UpdateArticle",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"article",
":=",
"r",
".",
"Context",
"(",
")",
".",
"Value",
"(",
"\"",
"\"",
")",
".",
"(",
"*",
"Article",
")",
"\n\n",
"data",
":=",
"&",
"ArticleRequest",
"{",
"Article",
":",
"article",
"}",
"\n",
"if",
"err",
":=",
"render",
".",
"Bind",
"(",
"r",
",",
"data",
")",
";",
"err",
"!=",
"nil",
"{",
"render",
".",
"Render",
"(",
"w",
",",
"r",
",",
"ErrInvalidRequest",
"(",
"err",
")",
")",
"\n",
"return",
"\n",
"}",
"\n",
"article",
"=",
"data",
".",
"Article",
"\n",
"dbUpdateArticle",
"(",
"<mask>",
".",
"ID",
",",
"article",
")",
"\n\n",
"render",
".",
"Render",
"(",
"w",
",",
"r",
",",
"NewArticleResponse",
"(",
"article",
")",
")",
"\n",
"}"
]
|
16,634 | all-16635 | [
"SetPublicMeta",
"-",
"set",
"a",
"public",
"metadata",
"record"
]
| [
"func",
"(",
"s",
"*",
"Task",
")",
"SetPublicMeta",
"(",
"name",
"string",
",",
"value",
"interface",
"{",
"}",
")",
"{",
"if",
"s",
".",
"MetaData",
"==",
"nil",
"{",
"s",
".",
"MetaData",
"=",
"make",
"(",
"<mask>",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"}",
"\n",
"s",
".",
"MetaData",
"[",
"name",
"]",
"=",
"value",
"\n",
"}"
]
|
16,635 | all-16636 | [
"HasChildren",
"checks",
"to",
"see",
"if",
"a",
"folder",
"has",
"any",
"child",
"items",
"and",
"returns",
"true",
"if",
"that",
"is",
"the",
"case",
".",
"This",
"is",
"useful",
"when",
"checking",
"to",
"see",
"if",
"a",
"folder",
"is",
"safe",
"to",
"delete",
"-",
"destroying",
"a",
"folder",
"in",
"vSphere",
"destroys",
"*",
"all",
"*",
"children",
"if",
"at",
"all",
"possible",
"(",
"including",
"removing",
"virtual",
"machines",
")",
"so",
"extra",
"verification",
"is",
"necessary",
"to",
"prevent",
"accidental",
"removal",
"."
]
| [
"func",
"HasChildren",
"(",
"f",
"*",
"object",
".",
"Folder",
")",
"(",
"bool",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"provider",
".",
"DefaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"children",
",",
"err",
":=",
"f",
".",
"Children",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n",
"return",
"len",
"(",
"<mask>",
")",
">",
"0",
",",
"nil",
"\n",
"}"
]
|
16,636 | all-16637 | [
"Execute",
"-",
"updates",
"orgs",
"quotas"
]
| [
"func",
"(",
"c",
"*",
"UpdateOrgQuotasCommand",
")",
"Execute",
"(",
"[",
"]",
"string",
")",
"error",
"{",
"<mask>",
"cfMgmt",
"*",
"CFMgmt",
"\n",
"var",
"err",
"error",
"\n",
"if",
"cfMgmt",
",",
"err",
"=",
"InitializePeekManagers",
"(",
"c",
".",
"BaseCFConfigCommand",
",",
"c",
".",
"Peek",
")",
";",
"err",
"==",
"nil",
"{",
"err",
"=",
"cfMgmt",
".",
"QuotaManager",
".",
"CreateOrgQuotas",
"(",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
]
|
16,637 | all-16638 | [
"RemoveUser",
"removes",
"the",
"authentication",
"credentials",
"of",
"user",
"from",
"the",
"database",
"."
]
| [
"func",
"(",
"db",
"*",
"<mask>",
")",
"RemoveUser",
"(",
"user",
"string",
")",
"error",
"{",
"err",
":=",
"db",
".",
"Run",
"(",
"bson",
".",
"D",
"{",
"{",
"\"",
"\"",
",",
"user",
"}",
"}",
",",
"nil",
")",
"\n",
"if",
"isNoCmd",
"(",
"err",
")",
"{",
"users",
":=",
"db",
".",
"C",
"(",
"\"",
"\"",
")",
"\n",
"return",
"users",
".",
"Remove",
"(",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"user",
"}",
")",
"\n",
"}",
"\n",
"if",
"isNotFound",
"(",
"err",
")",
"{",
"return",
"ErrNotFound",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
]
|
16,638 | all-16639 | [
"CreateMark",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_text_buffer_create_mark",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"TextBuffer",
")",
"CreateMark",
"(",
"mark_name",
"string",
",",
"where",
"*",
"TextIter",
",",
"left_gravity",
"bool",
")",
"*",
"TextMark",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"mark_name",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"ret",
":=",
"C",
".",
"gtk_text_buffer_create_mark",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"(",
"*",
"C",
".",
"GtkTextIter",
")",
"(",
"where",
")",
",",
"gbool",
"(",
"left_gravity",
")",
")",
"\n",
"return",
"(",
"*",
"TextMark",
")",
"(",
"ret",
")",
"\n",
"}"
]
|
16,639 | all-16640 | [
"AcceleratorName",
"is",
"a",
"wrapper",
"around",
"gtk_accelerator_name",
"()",
"."
]
| [
"func",
"AcceleratorName",
"(",
"key",
"uint",
",",
"mods",
"gdk",
".",
"ModifierType",
")",
"string",
"{",
"c",
":=",
"C",
".",
"gtk_accelerator_name",
"(",
"C",
".",
"guint",
"(",
"key",
")",
",",
"C",
".",
"GdkModifierType",
"(",
"<mask>",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"c",
")",
")",
"\n",
"}"
]
|
16,640 | all-16641 | [
"DeleteSecret",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockSecretsManagerAPI",
")",
"DeleteSecret",
"(",
"arg0",
"*",
"secretsmanager",
".",
"DeleteSecretInput",
")",
"(",
"*",
"secretsmanager",
".",
"DeleteSecretOutput",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"*",
"secretsmanager",
".",
"DeleteSecretOutput",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
]
|
16,641 | all-16642 | [
"GetResolutionX",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_get_resolution_x",
"()",
"."
]
| [
"func",
"(",
"<mask>",
"*",
"PrintSettings",
")",
"GetResolutionX",
"(",
")",
"int",
"{",
"c",
":=",
"C",
".",
"gtk_print_settings_get_resolution_x",
"(",
"ps",
".",
"native",
"(",
")",
")",
"\n",
"return",
"int",
"(",
"c",
")",
"\n",
"}"
]
|
16,642 | all-16643 | [
"DeleteCommit",
"deletes",
"a",
"commit",
"."
]
| [
"func",
"(",
"c",
"APIClient",
")",
"DeleteCommit",
"(",
"repoName",
"string",
",",
"commitID",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"PfsAPIClient",
".",
"DeleteCommit",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"pfs",
".",
"DeleteCommitRequest",
"{",
"Commit",
":",
"NewCommit",
"(",
"repoName",
",",
"commitID",
")",
",",
"}",
",",
")",
"\n",
"<mask>",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}"
]
|
16,643 | all-16644 | [
"GetAutoscale",
"returns",
"the",
"Autoscale",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"g",
"*",
"GraphDefinition",
")",
"GetAutoscale",
"(",
")",
"bool",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"Autoscale",
"==",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"Autoscale",
"\n",
"}"
]
|
16,644 | all-16645 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"RemoveXHRBreakpointParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger4",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
16,645 | all-16646 | [
"stringToNum",
"converts",
"a",
"string",
"a",
"number",
"using",
"the",
"given",
"alpabet",
"."
]
| [
"func",
"(",
"b",
"*",
"base57",
")",
"stringToNum",
"(",
"s",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"n",
":=",
"big",
".",
"NewInt",
"(",
"0",
")",
"\n\n",
"for",
"i",
":=",
"len",
"(",
"s",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
"{",
"n",
".",
"Mul",
"(",
"n",
",",
"big",
".",
"NewInt",
"(",
"b",
".",
"alphabet",
".",
"Length",
"(",
")",
")",
")",
"\n\n",
"<mask>",
",",
"err",
":=",
"b",
".",
"alphabet",
".",
"Index",
"(",
"string",
"(",
"s",
"[",
"i",
"]",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"n",
".",
"Add",
"(",
"n",
",",
"big",
".",
"NewInt",
"(",
"index",
")",
")",
"\n",
"}",
"\n\n",
"x",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"n",
")",
"\n\n",
"if",
"len",
"(",
"x",
")",
"<",
"32",
"{",
"// Pad the most significant bit (MSG) with 0 (zero) if the string is too short.",
"x",
"=",
"strings",
".",
"Repeat",
"(",
"\"",
"\"",
",",
"32",
"-",
"len",
"(",
"x",
")",
")",
"+",
"x",
"\n",
"}",
"else",
"if",
"len",
"(",
"x",
")",
">",
"32",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
")",
"\n",
"}",
"\n\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"x",
"[",
"0",
":",
"8",
"]",
",",
"x",
"[",
"8",
":",
"12",
"]",
",",
"x",
"[",
"12",
":",
"16",
"]",
",",
"x",
"[",
"16",
":",
"20",
"]",
",",
"x",
"[",
"20",
":",
"32",
"]",
")",
",",
"nil",
"\n",
"}"
]
|
16,646 | all-16647 | [
"specify",
"a",
"one",
"-",
"dimensional",
"texture",
"subimage",
"in",
"a",
"compressed",
"format"
]
| [
"func",
"CompressedTextureSubImage1D",
"(",
"texture",
"uint32",
",",
"level",
"int32",
",",
"xoffset",
"int32",
",",
"width",
"int32",
",",
"format",
"uint32",
",",
"imageSize",
"int32",
",",
"<mask>",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowCompressedTextureSubImage1D",
"(",
"gpCompressedTextureSubImage1D",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"texture",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"level",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"xoffset",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"format",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"imageSize",
")",
",",
"data",
")",
"\n",
"}"
]
|
16,647 | all-16648 | [
"newPRSignedByKeyPath",
"is",
"NewPRSignedByKeyPath",
"except",
"it",
"returns",
"the",
"private",
"type",
"."
]
| [
"func",
"newPRSignedByKeyPath",
"(",
"keyType",
"sbKeyType",
",",
"keyPath",
"string",
",",
"signedIdentity",
"PolicyReferenceMatch",
")",
"(",
"*",
"prSignedBy",
",",
"error",
")",
"{",
"<mask>",
"newPRSignedBy",
"(",
"keyType",
",",
"keyPath",
",",
"nil",
",",
"signedIdentity",
")",
"\n",
"}"
]
|
16,648 | all-16649 | [
"ReadLen16String",
"reads",
"a",
"16",
"-",
"bit",
"length",
"preceded",
"string",
"value"
]
| [
"func",
"(",
"r",
"*",
"ReadBuffer",
")",
"ReadLen16String",
"(",
")",
"<mask>",
"{",
"n",
":=",
"r",
".",
"ReadUint16",
"(",
")",
"\n",
"return",
"r",
".",
"ReadString",
"(",
"int",
"(",
"n",
")",
")",
"\n",
"}"
]
|
16,649 | all-16650 | [
"SetPostsubmitRegexes",
"compiles",
"and",
"validates",
"all",
"the",
"regular",
"expressions",
"for",
"the",
"provided",
"postsubmits",
"."
]
| [
"func",
"SetPostsubmitRegexes",
"(",
"ps",
"[",
"]",
"Postsubmit",
")",
"error",
"{",
"for",
"i",
",",
"j",
":=",
"range",
"ps",
"{",
"b",
",",
"err",
":=",
"setBrancherRegexes",
"(",
"j",
".",
"Brancher",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"j",
".",
"<mask>",
",",
"err",
")",
"\n",
"}",
"\n",
"ps",
"[",
"i",
"]",
".",
"Brancher",
"=",
"b",
"\n",
"c",
",",
"err",
":=",
"setChangeRegexes",
"(",
"j",
".",
"RegexpChangeMatcher",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"j",
".",
"Name",
",",
"err",
")",
"\n",
"}",
"\n",
"ps",
"[",
"i",
"]",
".",
"RegexpChangeMatcher",
"=",
"c",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
16,650 | all-16651 | [
"The",
"function",
"readCriuStatsDump",
"()",
"reads",
"the",
"CRIU",
"stats",
"-",
"dump",
"file",
"in",
"path",
"and",
"returns",
"the",
"pages_written",
"pages_skipped_parent",
"error",
"."
]
| [
"func",
"readCriuStatsDump",
"(",
"path",
"string",
")",
"(",
"uint64",
",",
"uint64",
",",
"error",
")",
"{",
"statsDump",
":=",
"<mask>",
".",
"AddSlash",
"(",
"path",
")",
"+",
"\"",
"\"",
"\n",
"in",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"statsDump",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"0",
",",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"// According to the CRIU file image format it starts with two magic values.",
"// First magic IMG_SERVICE: 1427134784",
"if",
"binary",
".",
"LittleEndian",
".",
"Uint32",
"(",
"in",
"[",
"0",
":",
"4",
"]",
")",
"!=",
"1427134784",
"{",
"msg",
":=",
"\"",
"\"",
"\n",
"logger",
".",
"Errorf",
"(",
"msg",
")",
"\n",
"return",
"0",
",",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"msg",
")",
"\n",
"}",
"\n",
"// Second magic STATS: 1460220678",
"if",
"binary",
".",
"LittleEndian",
".",
"Uint32",
"(",
"in",
"[",
"4",
":",
"8",
"]",
")",
"!=",
"1460220678",
"{",
"msg",
":=",
"\"",
"\"",
"\n",
"logger",
".",
"Errorf",
"(",
"msg",
")",
"\n",
"return",
"0",
",",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"msg",
")",
"\n",
"}",
"\n\n",
"// Next, read the size of the image payload",
"size",
":=",
"binary",
".",
"LittleEndian",
".",
"Uint32",
"(",
"in",
"[",
"8",
":",
"12",
"]",
")",
"\n\n",
"statsEntry",
":=",
"&",
"migration",
".",
"StatsEntry",
"{",
"}",
"\n",
"if",
"err",
"=",
"proto",
".",
"Unmarshal",
"(",
"in",
"[",
"12",
":",
"12",
"+",
"size",
"]",
",",
"statsEntry",
")",
";",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"0",
",",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"written",
":=",
"statsEntry",
".",
"GetDump",
"(",
")",
".",
"GetPagesWritten",
"(",
")",
"\n",
"skipped",
":=",
"statsEntry",
".",
"GetDump",
"(",
")",
".",
"GetPagesSkippedParent",
"(",
")",
"\n",
"return",
"written",
",",
"skipped",
",",
"nil",
"\n",
"}"
]
|
16,651 | all-16652 | [
"ReleaseBuffer",
"puts",
"the",
"given",
"byte",
"array",
"back",
"into",
"the",
"appropriate",
"global",
"buffer",
"pool",
"based",
"on",
"its",
"capacity",
"."
]
| [
"func",
"ReleaseBuffer",
"(",
"b",
"[",
"]",
"byte",
")",
"{",
"<mask>",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"cap",
"(",
"b",
")",
",",
"len",
"(",
"b",
")",
")",
"\n",
"mpool",
".",
"ByteSlicePool",
".",
"Put",
"(",
"uint32",
"(",
"cap",
"(",
"b",
")",
")",
",",
"b",
")",
"\n",
"}"
]
|
16,652 | all-16653 | [
"Next",
"gets",
"the",
"next",
"key",
"value",
"pair",
"."
]
| [
"func",
"(",
"d",
"*",
"ChildCursor",
")",
"Next",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"[",
"]",
"byte",
")",
"{",
"if",
"d",
".",
"k",
"==",
"nil",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"k",
",",
"v",
":=",
"d",
".",
"c",
".",
"Seek",
"(",
"append",
"(",
"d",
".",
"k",
",",
"1",
")",
")",
"\n",
"if",
"!",
"<mask>",
".",
"HasPrefix",
"(",
"k",
",",
"d",
".",
"dir",
")",
"{",
"k",
",",
"v",
"=",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"d",
".",
"k",
",",
"d",
".",
"v",
"=",
"k",
",",
"v",
"\n",
"return",
"k",
",",
"v",
"\n",
"}"
]
|
16,653 | all-16654 | [
"Remove",
"deletes",
"the",
"data",
"at",
"the",
"given",
"path",
"."
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"Remove",
"(",
"<mask>",
"string",
",",
"params",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"api",
".",
"Call",
"(",
"\"",
"\"",
",",
"c",
".",
"Url",
"+",
"\"",
"\"",
"+",
"path",
",",
"c",
".",
"Auth",
",",
"nil",
",",
"params",
")",
"\n\n",
"return",
"err",
"\n",
"}"
]
|
16,654 | all-16655 | [
"Close",
"removes",
"resources",
"associated",
"with",
"an",
"initialized",
"Source",
"if",
"any",
"."
]
| [
"func",
"(",
"s",
"*",
"<mask>",
")",
"Close",
"(",
")",
"error",
"{",
"if",
"s",
".",
"removeTarPathOnClose",
"{",
"return",
"os",
".",
"Remove",
"(",
"s",
".",
"tarPath",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
16,655 | all-16656 | [
"Returns",
"a",
"signed",
"URL",
"for",
"Regions",
"valid",
"for",
"the",
"specified",
"duration",
".",
"Required",
"scopes",
":",
"ec2",
"-",
"manager",
":",
"internals",
"See",
"Regions",
"for",
"more",
"details",
"."
]
| [
"func",
"(",
"eC2Manager",
"*",
"EC2Manager",
")",
"Regions_SignedURL",
"(",
"duration",
"time",
".",
"Duration",
")",
"(",
"*",
"<mask>",
".",
"URL",
",",
"error",
")",
"{",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"eC2Manager",
")",
"\n",
"return",
"(",
"&",
"cd",
")",
".",
"SignedURL",
"(",
"\"",
"\"",
",",
"nil",
",",
"duration",
")",
"\n",
"}"
]
|
16,656 | all-16657 | [
"incrementGCGeneration",
"increments",
"the",
"GC",
"generation",
"number",
"in",
"etcd"
]
| [
"func",
"(",
"a",
"*",
"apiServer",
")",
"incrementGCGeneration",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"resp",
",",
"err",
":=",
"a",
".",
"env",
".",
"GetEtcdClient",
"(",
")",
".",
"Get",
"(",
"ctx",
",",
"client",
".",
"GCGenerationKey",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"resp",
".",
"Count",
"==",
"0",
"{",
"// If the generation number does not exist, create it.",
"// It's important that the new generation is 1, as the first",
"// generation is assumed to be 0.",
"if",
"_",
",",
"err",
":=",
"a",
".",
"env",
".",
"GetEtcdClient",
"(",
")",
".",
"Put",
"(",
"ctx",
",",
"client",
".",
"GCGenerationKey",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"else",
"{",
"oldGen",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"string",
"(",
"resp",
".",
"Kvs",
"[",
"0",
"]",
".",
"<mask>",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"newGen",
":=",
"oldGen",
"+",
"1",
"\n",
"if",
"_",
",",
"err",
":=",
"a",
".",
"env",
".",
"GetEtcdClient",
"(",
")",
".",
"Put",
"(",
"ctx",
",",
"client",
".",
"GCGenerationKey",
",",
"strconv",
".",
"Itoa",
"(",
"newGen",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
16,657 | all-16658 | [
"UnmarshalJSON",
"satisfies",
"json",
".",
"Unmarshaler",
"."
]
| [
"func",
"(",
"t",
"*",
"StreamCompression",
")",
"UnmarshalJSON",
"(",
"buf",
"[",
"]",
"<mask>",
")",
"error",
"{",
"return",
"easyjson",
".",
"Unmarshal",
"(",
"buf",
",",
"t",
")",
"\n",
"}"
]
|
16,658 | all-16659 | [
"ReadPeersJSON",
"consumes",
"a",
"legacy",
"peers",
".",
"json",
"file",
"in",
"the",
"format",
"of",
"the",
"old",
"JSON",
"peer",
"store",
"and",
"creates",
"a",
"new",
"-",
"style",
"configuration",
"structure",
".",
"This",
"can",
"be",
"used",
"to",
"migrate",
"this",
"data",
"or",
"perform",
"manual",
"recovery",
"when",
"running",
"protocol",
"versions",
"that",
"can",
"interoperate",
"with",
"older",
"unversioned",
"Raft",
"servers",
".",
"This",
"should",
"not",
"be",
"used",
"once",
"server",
"IDs",
"are",
"in",
"use",
"because",
"the",
"old",
"peers",
".",
"json",
"file",
"didn",
"t",
"have",
"support",
"for",
"these",
"nor",
"non",
"-",
"voter",
"suffrage",
"types",
"."
]
| [
"func",
"ReadPeersJSON",
"(",
"path",
"string",
")",
"(",
"Configuration",
",",
"error",
")",
"{",
"// Read in the file.",
"buf",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"Configuration",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"// Parse it as JSON.",
"var",
"peers",
"[",
"]",
"string",
"\n",
"dec",
":=",
"json",
".",
"NewDecoder",
"(",
"bytes",
".",
"NewReader",
"(",
"buf",
")",
")",
"\n",
"if",
"err",
":=",
"dec",
".",
"Decode",
"(",
"&",
"peers",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"<mask>",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"// Map it into the new-style configuration structure. We can only specify",
"// voter roles here, and the ID has to be the same as the address.",
"var",
"configuration",
"Configuration",
"\n",
"for",
"_",
",",
"peer",
":=",
"range",
"peers",
"{",
"server",
":=",
"Server",
"{",
"Suffrage",
":",
"Voter",
",",
"ID",
":",
"ServerID",
"(",
"peer",
")",
",",
"Address",
":",
"ServerAddress",
"(",
"peer",
")",
",",
"}",
"\n",
"configuration",
".",
"Servers",
"=",
"append",
"(",
"configuration",
".",
"Servers",
",",
"server",
")",
"\n",
"}",
"\n\n",
"// We should only ingest valid configurations.",
"if",
"err",
":=",
"checkConfiguration",
"(",
"configuration",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"Configuration",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"return",
"configuration",
",",
"nil",
"\n",
"}"
]
|
16,659 | all-16660 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
]
| [
"func",
"(",
"t",
"ContextType",
")",
"MarshalEasyJSON",
"(",
"<mask>",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"out",
".",
"String",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
]
|
16,660 | all-16661 | [
"WithTargetName",
"eventTarget",
"interface",
"name",
"."
]
| [
"func",
"(",
"p",
"RemoveEventListenerBreakpointParams",
")",
"WithTargetName",
"(",
"targetName",
"string",
")",
"*",
"RemoveEventListenerBreakpointParams",
"{",
"p",
".",
"TargetName",
"=",
"targetName",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
]
|
16,661 | all-16662 | [
"DeleteSecretWithContext",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockSecretsManagerAPI",
")",
"DeleteSecretWithContext",
"(",
"arg0",
"aws",
".",
"Context",
",",
"arg1",
"*",
"secretsmanager",
".",
"DeleteSecretInput",
",",
"arg2",
"...",
"request",
".",
"Option",
")",
"(",
"*",
"secretsmanager",
".",
"DeleteSecretOutput",
",",
"error",
")",
"{",
"varargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"arg0",
",",
"arg1",
"}",
"\n",
"for",
"_",
",",
"a",
":=",
"range",
"arg2",
"{",
"varargs",
"=",
"append",
"(",
"varargs",
",",
"a",
")",
"\n",
"}",
"\n",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"varargs",
"...",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"secretsmanager",
".",
"DeleteSecretOutput",
")",
"\n",
"ret1",
",",
"_",
":=",
"<mask>",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
]
|
16,662 | all-16663 | [
"signaturePath",
"returns",
"a",
"path",
"for",
"a",
"signature",
"within",
"a",
"directory",
"using",
"our",
"conventions",
"."
]
| [
"func",
"(",
"<mask>",
"dirReference",
")",
"signaturePath",
"(",
"index",
"int",
")",
"string",
"{",
"return",
"filepath",
".",
"Join",
"(",
"ref",
".",
"path",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"index",
"+",
"1",
")",
")",
"\n",
"}"
]
|
16,663 | all-16664 | [
"SetDriverVersion",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockGPUManager",
")",
"SetDriverVersion",
"(",
"arg0",
"<mask>",
")",
"{",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"}"
]
|
16,664 | all-16665 | [
"Ensure",
"will",
"ensure",
"that",
"the",
"required",
"indexes",
"exist",
".",
"It",
"may",
"fail",
"early",
"if",
"some",
"of",
"the",
"indexes",
"are",
"already",
"existing",
"and",
"do",
"not",
"match",
"the",
"supplied",
"index",
"."
]
| [
"func",
"(",
"i",
"*",
"Indexer",
")",
"Ensure",
"(",
"store",
"*",
"Store",
")",
"error",
"{",
"// copy store",
"s",
":=",
"<mask>",
".",
"Copy",
"(",
")",
"\n",
"defer",
"s",
".",
"Close",
"(",
")",
"\n\n",
"// go through all raw indexes",
"for",
"_",
",",
"i",
":=",
"range",
"i",
".",
"indexes",
"{",
"// ensure single index",
"err",
":=",
"s",
".",
"DB",
"(",
")",
".",
"C",
"(",
"i",
".",
"coll",
")",
".",
"EnsureIndex",
"(",
"i",
".",
"index",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
16,665 | all-16666 | [
"Info",
"logs",
"msg",
"to",
"all",
"added",
"loggers",
"at",
"LogLevel",
".",
"LevelInfo"
]
| [
"func",
"(",
"la",
"*",
"LogAdapter",
")",
"Info",
"(",
"msg",
"string",
")",
"error",
"{",
"return",
"la",
".",
"Log",
"(",
"LevelInfo",
",",
"nil",
",",
"<mask>",
")",
"\n",
"}"
]
|
16,666 | all-16667 | [
"SetFont",
"is",
"a",
"wrapper",
"around",
"gtk_font_chooser_set_font",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"FontChooser",
")",
"SetFont",
"(",
"font",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"<mask>",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_font_chooser_set_font",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
]
|
16,667 | all-16668 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"SetPlaybackRateParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoAnimation1",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
16,668 | all-16669 | [
"Appender",
"implements",
"scrape",
".",
"Appendable",
"."
]
| [
"func",
"(",
"s",
"*",
"Storage",
")",
"Appender",
"(",
")",
"(",
"<mask>",
".",
"Appender",
",",
"error",
")",
"{",
"return",
"&",
"timestampTracker",
"{",
"storage",
":",
"s",
",",
"}",
",",
"nil",
"\n",
"}"
]
|
16,669 | all-16670 | [
"AppendSectionWithoutLabel",
"is",
"a",
"wrapper",
"around",
"g_menu_append_section",
"()",
"with",
"label",
"set",
"to",
"null",
"."
]
| [
"func",
"(",
"v",
"*",
"<mask>",
")",
"AppendSectionWithoutLabel",
"(",
"section",
"*",
"MenuModel",
")",
"{",
"C",
".",
"g_menu_append_section",
"(",
"v",
".",
"native",
"(",
")",
",",
"nil",
",",
"section",
".",
"native",
"(",
")",
")",
"\n",
"}"
]
|
16,670 | all-16671 | [
"GetYaxis",
"returns",
"the",
"Yaxis",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"t",
"*",
"TimeseriesDefinition",
")",
"GetYaxis",
"(",
")",
"WidgetAxis",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Yaxis",
"==",
"nil",
"{",
"<mask>",
"WidgetAxis",
"{",
"}",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"Yaxis",
"\n",
"}"
]
|
16,671 | all-16672 | [
"ValidateRequest",
"perfomrs",
"verification",
"on",
"the",
"TLS",
"certs",
"and",
"chain"
]
| [
"func",
"(",
"a",
"*",
"Auth",
")",
"ValidateRequest",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"error",
"{",
"// ensure we can process this request",
"if",
"r",
".",
"TLS",
"==",
"nil",
"||",
"r",
".",
"TLS",
".",
"VerifiedChains",
"==",
"nil",
"{",
"return",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// TODO: Figure out if having multiple validated peer leaf certs is possible. For now, only validate",
"// one cert, and make sure it matches the first peer certificate",
"if",
"r",
".",
"TLS",
".",
"PeerCertificates",
"!=",
"nil",
"{",
"if",
"!",
"bytes",
".",
"Equal",
"(",
"r",
".",
"TLS",
".",
"PeerCertificates",
"[",
"0",
"]",
".",
"Raw",
",",
"r",
".",
"TLS",
".",
"VerifiedChains",
"[",
"0",
"]",
"[",
"0",
"]",
".",
"Raw",
")",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
16,672 | all-16673 | [
"Write",
"implements",
"the",
"io",
".",
"Writer",
"interface"
]
| [
"func",
"(",
"rws",
"*",
"ReadWriteSeeker",
")",
"Write",
"(",
"p",
"[",
"]",
"byte",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"minCap",
":=",
"rws",
".",
"pos",
"+",
"len",
"(",
"p",
")",
"\n",
"if",
"minCap",
">",
"cap",
"(",
"rws",
".",
"buf",
")",
"{",
"// Make sure buf has enough capacity:",
"buf2",
":=",
"make",
"(",
"[",
"]",
"<mask>",
",",
"len",
"(",
"rws",
".",
"buf",
")",
",",
"minCap",
"+",
"len",
"(",
"p",
")",
")",
"// add some extra",
"\n",
"copy",
"(",
"buf2",
",",
"rws",
".",
"buf",
")",
"\n",
"rws",
".",
"buf",
"=",
"buf2",
"\n",
"}",
"\n",
"if",
"minCap",
">",
"len",
"(",
"rws",
".",
"buf",
")",
"{",
"rws",
".",
"buf",
"=",
"rws",
".",
"buf",
"[",
":",
"minCap",
"]",
"\n",
"}",
"\n",
"copy",
"(",
"rws",
".",
"buf",
"[",
"rws",
".",
"pos",
":",
"]",
",",
"p",
")",
"\n",
"rws",
".",
"pos",
"+=",
"len",
"(",
"p",
")",
"\n",
"return",
"len",
"(",
"p",
")",
",",
"nil",
"\n",
"}"
]
|
16,673 | all-16674 | [
"TODO",
":",
"remove",
"this",
"when",
"FailFast",
"=",
"false",
"is",
"fixed",
".",
"See",
"https",
":",
"//",
"github",
".",
"com",
"/",
"grpc",
"/",
"grpc",
"-",
"go",
"/",
"issues",
"/",
"1532",
"."
]
| [
"func",
"readyWait",
"(",
"rpcCtx",
",",
"clientCtx",
"context",
".",
"Context",
",",
"ready",
"<-",
"chan",
"struct",
"{",
"}",
")",
"error",
"{",
"select",
"{",
"<mask>",
"<-",
"ready",
":",
"return",
"nil",
"\n",
"case",
"<-",
"rpcCtx",
".",
"Done",
"(",
")",
":",
"return",
"rpcCtx",
".",
"Err",
"(",
")",
"\n",
"case",
"<-",
"clientCtx",
".",
"Done",
"(",
")",
":",
"return",
"clientCtx",
".",
"Err",
"(",
")",
"\n",
"}",
"\n",
"}"
]
|
16,674 | all-16675 | [
"Get",
"the",
"Key",
"associated",
"with",
"the",
"given",
"name",
"or",
"panic",
"."
]
| [
"func",
"(",
"s",
"Schema",
")",
"mustGetKey",
"(",
"<mask>",
"string",
")",
"Key",
"{",
"key",
",",
"ok",
":=",
"s",
"[",
"name",
"]",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"name",
")",
")",
"\n",
"}",
"\n",
"return",
"key",
"\n",
"}"
]
|
16,675 | all-16676 | [
"float",
"types"
]
| [
"func",
"convertNvFloat",
"(",
"v",
"interface",
"{",
"}",
",",
"max",
"float64",
")",
"(",
"driver",
".",
"<mask>",
",",
"error",
")",
"{",
"if",
"v",
"==",
"nil",
"{",
"return",
"v",
",",
"nil",
"\n",
"}",
"\n\n",
"rv",
":=",
"reflect",
".",
"ValueOf",
"(",
"v",
")",
"\n",
"switch",
"rv",
".",
"Kind",
"(",
")",
"{",
"case",
"reflect",
".",
"Float32",
",",
"reflect",
".",
"Float64",
":",
"f64",
":=",
"rv",
".",
"Float",
"(",
")",
"\n",
"if",
"math",
".",
"Abs",
"(",
"f64",
")",
">",
"max",
"{",
"return",
"nil",
",",
"ErrFloatOutOfRange",
"\n",
"}",
"\n",
"return",
"f64",
",",
"nil",
"\n",
"case",
"reflect",
".",
"Ptr",
":",
"// indirect pointers",
"if",
"rv",
".",
"IsNil",
"(",
")",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"return",
"convertNvFloat",
"(",
"rv",
".",
"Elem",
"(",
")",
".",
"Interface",
"(",
")",
",",
"max",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"v",
")",
"\n",
"}"
]
|
16,676 | all-16677 | [
"IsLower",
"returns",
"true",
"if",
"s",
"comprised",
"of",
"all",
"lower",
"case",
"characters",
"."
]
| [
"func",
"IsLower",
"(",
"s",
"<mask>",
")",
"bool",
"{",
"return",
"IsAlpha",
"(",
"s",
")",
"&&",
"s",
"==",
"strings",
".",
"ToLower",
"(",
"s",
")",
"\n",
"}"
]
|
16,677 | all-16678 | [
"ChompLeftF",
"is",
"the",
"filter",
"form",
"of",
"ChompLeft",
"."
]
| [
"func",
"ChompLeftF",
"(",
"prefix",
"string",
")",
"func",
"(",
"string",
")",
"string",
"{",
"return",
"func",
"(",
"s",
"string",
")",
"string",
"{",
"return",
"ChompLeft",
"(",
"s",
",",
"<mask>",
")",
"\n",
"}",
"\n",
"}"
]
|
16,678 | all-16679 | [
"GetTitleAlign",
"returns",
"the",
"TitleAlign",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"t",
"*",
"ToplistDefinition",
")",
"GetTitleAlign",
"(",
")",
"<mask>",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"TitleAlign",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"TitleAlign",
"\n",
"}"
]
|
16,679 | all-16680 | [
"SetVisible",
"is",
"a",
"wrapper",
"around",
"gtk_status_icon_set_visible",
"()"
]
| [
"func",
"(",
"v",
"*",
"StatusIcon",
")",
"SetVisible",
"(",
"visible",
"bool",
")",
"{",
"C",
".",
"gtk_status_icon_set_visible",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"<mask>",
")",
")",
"\n",
"}"
]
|
16,680 | all-16681 | [
"/",
"*",
"FloatFromSection",
"looks",
"for",
"the",
"specified",
"key",
"and",
"returns",
"it",
"as",
"a",
"float",
".",
"If",
"not",
"found",
"the",
"default",
"value",
"def",
"is",
"returned",
"."
]
| [
"func",
"(",
"config",
"*",
"Config",
")",
"FloatFromSection",
"(",
"sectionName",
"string",
",",
"key",
"string",
",",
"def",
"float64",
")",
"float64",
"{",
"section",
":=",
"config",
".",
"sectionForName",
"(",
"sectionName",
")",
"\n\n",
"if",
"section",
"!=",
"nil",
"{",
"return",
"getFloat",
"(",
"<mask>",
".",
"values",
",",
"key",
",",
"def",
")",
"\n",
"}",
"\n\n",
"return",
"def",
"\n",
"}"
]
|
16,681 | all-16682 | [
"Failures",
"counts",
"the",
"number",
"of",
"failed",
"tests",
"in",
"this",
"report"
]
| [
"func",
"(",
"r",
"*",
"Report",
")",
"Failures",
"(",
")",
"int",
"{",
"count",
":=",
"0",
"\n\n",
"for",
"_",
",",
"p",
":=",
"range",
"r",
".",
"Packages",
"{",
"for",
"_",
",",
"t",
":=",
"<mask>",
"p",
".",
"Tests",
"{",
"if",
"t",
".",
"Result",
"==",
"FAIL",
"{",
"count",
"++",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"count",
"\n",
"}"
]
|
16,682 | all-16683 | [
"ReadFrom",
"avoids",
"intermediate",
"allocation",
"and",
"copies",
".",
"ReadFrom",
"()",
"reads",
"data",
"from",
"r",
"until",
"EOF",
"or",
"error",
".",
"The",
"return",
"value",
"n",
"is",
"the",
"number",
"of",
"bytes",
"read",
".",
"Any",
"error",
"except",
"io",
".",
"EOF",
"encountered",
"during",
"the",
"read",
"is",
"also",
"returned",
"."
]
| [
"func",
"(",
"b",
"*",
"FixedSizeRingBuf",
")",
"ReadFrom",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"n",
"int64",
",",
"err",
"error",
")",
"{",
"for",
"{",
"writeCapacity",
":=",
"b",
".",
"N",
"-",
"b",
".",
"Readable",
"\n",
"if",
"writeCapacity",
"<=",
"0",
"{",
"// we are all full",
"return",
"n",
",",
"nil",
"\n",
"}",
"\n",
"writeStart",
":=",
"(",
"b",
".",
"Beg",
"+",
"b",
".",
"Readable",
")",
"%",
"b",
".",
"N",
"\n",
"upperLim",
":=",
"intMin",
"(",
"writeStart",
"+",
"writeCapacity",
",",
"b",
".",
"N",
")",
"\n\n",
"m",
",",
"e",
":=",
"r",
".",
"Read",
"(",
"b",
".",
"A",
"[",
"b",
".",
"Use",
"]",
"[",
"writeStart",
":",
"upperLim",
"]",
")",
"\n",
"n",
"+=",
"int64",
"(",
"m",
")",
"\n",
"b",
".",
"Readable",
"+=",
"m",
"\n",
"if",
"e",
"==",
"<mask>",
".",
"EOF",
"{",
"return",
"n",
",",
"nil",
"\n",
"}",
"\n",
"if",
"e",
"!=",
"nil",
"{",
"return",
"n",
",",
"e",
"\n",
"}",
"\n",
"}",
"\n",
"}"
]
|
16,683 | all-16684 | [
"New",
"creates",
"a",
"new",
"soft",
"layer",
"VM",
"pool",
"client"
]
| [
"func",
"New",
"(",
"transport",
"runtime",
".",
"ClientTransport",
",",
"formats",
"strfmt",
".",
"Registry",
")",
"*",
"SoftLayerVMPool",
"{",
"cli",
":=",
"new",
"(",
"SoftLayerVMPool",
")",
"\n",
"cli",
".",
"Transport",
"=",
"transport",
"\n\n",
"<mask>",
".",
"VM",
"=",
"vm",
".",
"New",
"(",
"transport",
",",
"formats",
")",
"\n\n",
"return",
"cli",
"\n",
"}"
]
|
16,684 | all-16685 | [
"ContainerNames",
"returns",
"the",
"names",
"of",
"all",
"containers",
"the",
"given",
"project",
"."
]
| [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"ContainerNames",
"(",
"project",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"stmt",
":=",
"`\nSELECT containers.name FROM containers\n JOIN projects ON projects.id = containers.project_id\n WHERE projects.name = ? AND containers.type = ?\n`",
"\n",
"return",
"query",
".",
"SelectStrings",
"(",
"c",
".",
"tx",
",",
"stmt",
",",
"<mask>",
",",
"CTypeRegular",
")",
"\n",
"}"
]
|
16,685 | all-16686 | [
"Do",
"executes",
"Storage",
".",
"untrackIndexedDBForOrigin",
"against",
"the",
"provided",
"context",
"."
]
| [
"func",
"(",
"p",
"*",
"UntrackIndexedDBForOriginParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandUntrackIndexedDBForOrigin",
",",
"p",
",",
"nil",
")",
"\n",
"}"
]
|
16,686 | all-16687 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"EventSetChildNodes",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom57",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
16,687 | all-16688 | [
"GetFacet",
"returns",
"the",
"Facet",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"a",
"*",
"ApmOrLogQueryCompute",
")",
"GetFacet",
"(",
")",
"<mask>",
"{",
"if",
"a",
"==",
"nil",
"||",
"a",
".",
"Facet",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"a",
".",
"Facet",
"\n",
"}"
]
|
16,688 | all-16689 | [
"SetDisplaySyncEnabled",
"controls",
"whether",
"the",
"Metal",
"layer",
"and",
"its",
"drawables",
"are",
"synchronized",
"with",
"the",
"display",
"s",
"refresh",
"rate",
".",
"Reference",
":",
"https",
":",
"//",
"developer",
".",
"apple",
".",
"com",
"/",
"documentation",
"/",
"quartzcore",
"/",
"cametallayer",
"/",
"2887087",
"-",
"displaysyncenabled",
"."
]
| [
"func",
"(",
"ml",
"MetalLayer",
")",
"SetDisplaySyncEnabled",
"(",
"enabled",
"bool",
")",
"{",
"<mask>",
"enabled",
"{",
"case",
"true",
":",
"C",
".",
"MetalLayer_SetDisplaySyncEnabled",
"(",
"ml",
".",
"metalLayer",
",",
"1",
")",
"\n",
"case",
"false",
":",
"C",
".",
"MetalLayer_SetDisplaySyncEnabled",
"(",
"ml",
".",
"metalLayer",
",",
"0",
")",
"\n",
"}",
"\n",
"}"
]
|
16,689 | all-16690 | [
"DoesHandle",
"satisfies",
"hookHandler",
"."
]
| [
"func",
"(",
"g",
"GithubHook",
")",
"DoesHandle",
"(",
"h",
"<mask>",
".",
"Header",
")",
"bool",
"{",
"userAgent",
":=",
"h",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n\n",
"// GitHub always uses a user-agent like \"GitHub-Hookshot/<id>\"",
"if",
"userAgent",
"!=",
"\"",
"\"",
"&&",
"strings",
".",
"HasPrefix",
"(",
"userAgent",
",",
"\"",
"\"",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
]
|
16,690 | all-16691 | [
"GetId",
"returns",
"the",
"Id",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"s",
"*",
"Screenboard",
")",
"GetId",
"(",
")",
"int",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Id",
"\n",
"}"
]
|
16,691 | all-16692 | [
"GetTitleSize",
"returns",
"the",
"TitleSize",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"c",
"*",
"ChangeDefinition",
")",
"GetTitleSize",
"(",
")",
"<mask>",
"{",
"if",
"c",
"==",
"nil",
"||",
"c",
".",
"TitleSize",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"c",
".",
"TitleSize",
"\n",
"}"
]
|
16,692 | all-16693 | [
"StereoPan",
"changes",
"the",
"balance",
"of",
"the",
"input",
"buffer",
"by",
"panning",
"more",
"to",
"the",
"left",
"or",
"the",
"right",
".",
"The",
"pan",
"value",
"must",
"be",
"between",
"0",
"and",
"1",
"where",
"0",
"is",
"full",
"first",
"channel",
"0",
".",
"5",
"center",
"and",
"1",
"full",
"second",
"channel",
".",
"Note",
"that",
"the",
"signal",
"from",
"1",
"channel",
"is",
"not",
"sent",
"to",
"the",
"other",
"this",
"transform",
"only",
"reduces",
"the",
"balance",
"of",
"one",
"of",
"the",
"2",
"channels",
"."
]
| [
"func",
"StereoPan",
"(",
"buf",
"*",
"audio",
".",
"FloatBuffer",
",",
"pan",
"float64",
")",
"error",
"{",
"if",
"buf",
"==",
"nil",
"||",
"buf",
".",
"Format",
"==",
"nil",
"||",
"buf",
".",
"Format",
".",
"NumChannels",
"!=",
"2",
"{",
"return",
"audio",
".",
"ErrInvalidBuffer",
"\n",
"}",
"\n",
"if",
"pan",
"<",
"0",
"||",
"pan",
">",
"1",
"{",
"return",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"pan",
"==",
"0.5",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"pan",
"<",
"0.5",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"+",
"2",
"<=",
"len",
"(",
"buf",
".",
"Data",
")",
";",
"i",
"+=",
"2",
"{",
"buf",
".",
"Data",
"[",
"i",
"+",
"1",
"]",
"*=",
"(",
"pan",
"*",
"2",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"+",
"2",
"<=",
"len",
"(",
"buf",
".",
"Data",
")",
";",
"i",
"+=",
"2",
"{",
"buf",
".",
"Data",
"[",
"i",
"]",
"*=",
"(",
"(",
"1",
"-",
"pan",
")",
"*",
"2",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
16,693 | all-16694 | [
"Println",
"outputs",
"fixed",
"line",
"Print",
"log"
]
| [
"func",
"Println",
"(",
"val",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"glg",
".",
"<mask>",
"(",
"PRINT",
",",
"blankFormat",
"(",
"len",
"(",
"val",
")",
")",
",",
"val",
"...",
")",
"\n",
"}"
]
|
16,694 | all-16695 | [
"CreateFromType",
"creates",
"an",
"instance",
"of",
"the",
"given",
"type"
]
| [
"func",
"(",
"di",
"*",
"dependencyInjector",
")",
"createFromType",
"(",
"atype",
"reflect",
".",
"Type",
")",
"reflect",
".",
"Value",
"{",
"constructor",
",",
"exists",
":=",
"di",
".",
"registry",
"[",
"atype",
"]",
"\n",
"if",
"!",
"exists",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"atype",
")",
")",
"\n",
"}",
"\n\n",
"constructorType",
":=",
"reflect",
".",
"TypeOf",
"(",
"constructor",
")",
"\n",
"constructorArgs",
":=",
"[",
"]",
"reflect",
".",
"<mask>",
"{",
"}",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"constructorType",
".",
"NumIn",
"(",
")",
";",
"i",
"++",
"{",
"t",
":=",
"constructorType",
".",
"In",
"(",
"i",
")",
"\n",
"v",
":=",
"di",
".",
"CreateFromType",
"(",
"t",
")",
"\n",
"constructorArgs",
"=",
"append",
"(",
"constructorArgs",
",",
"v",
")",
"\n",
"}",
"\n\n",
"newObj",
":=",
"reflect",
".",
"ValueOf",
"(",
"constructor",
")",
".",
"Call",
"(",
"constructorArgs",
")",
"\n\n",
"return",
"newObj",
"[",
"0",
"]",
"\n",
"}"
]
|
16,695 | all-16696 | [
"Set",
"adds",
"a",
"uint32",
"tag",
"to",
"the",
"span"
]
| [
"func",
"(",
"tag",
"uint32TagName",
")",
"<mask>",
"(",
"span",
"opentracing",
".",
"Span",
",",
"value",
"uint32",
")",
"{",
"span",
".",
"SetTag",
"(",
"string",
"(",
"tag",
")",
",",
"value",
")",
"\n",
"}"
]
|
16,696 | all-16697 | [
"OwnerHas",
"reports",
"whether",
"the",
"named",
"file",
"has",
"all",
"given",
"permissions",
"for",
"the",
"owner",
"."
]
| [
"func",
"OwnerHas",
"(",
"name",
"string",
",",
"p",
"...",
"perm",
")",
"(",
"bool",
",",
"error",
")",
"{",
"i",
",",
"err",
":=",
"NewInfo",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"<mask>",
",",
"err",
"\n",
"}",
"\n",
"return",
"i",
".",
"OwnerHas",
"(",
"p",
"...",
")",
",",
"nil",
"\n",
"}"
]
|
16,697 | all-16698 | [
"WaitTrigger",
"appends",
"a",
"new",
"wait",
"trigger",
"to",
"the",
"query",
"waiting",
"for",
"a",
"specific",
"event",
"broker",
"message",
"to",
"recheck",
"condition",
"."
]
| [
"func",
"(",
"q",
"*",
"Query",
")",
"WaitTrigger",
"(",
"event",
"string",
")",
"*",
"Query",
"{",
"q",
".",
"headers",
"=",
"<mask>",
"(",
"q",
".",
"headers",
",",
"\"",
"\"",
"+",
"event",
")",
"\n",
"return",
"q",
"\n",
"}"
]
|
16,698 | all-16699 | [
"UpdateWorksheet",
"updates",
"passed",
"worksheet",
"."
]
| [
"func",
"(",
"a",
"*",
"API",
")",
"UpdateWorksheet",
"(",
"cfg",
"*",
"Worksheet",
")",
"(",
"*",
"Worksheet",
",",
"error",
")",
"{",
"if",
"cfg",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"worksheetCID",
":=",
"string",
"(",
"cfg",
".",
"CID",
")",
"\n\n",
"matched",
",",
"err",
":=",
"regexp",
".",
"MatchString",
"(",
"config",
".",
"WorksheetCIDRegex",
",",
"worksheetCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"<mask>",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"worksheetCID",
")",
"\n",
"}",
"\n\n",
"jsonCfg",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"cfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"Debug",
"{",
"a",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"string",
"(",
"jsonCfg",
")",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"Put",
"(",
"worksheetCID",
",",
"jsonCfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"worksheet",
":=",
"&",
"Worksheet",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"worksheet",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"worksheet",
",",
"nil",
"\n",
"}"
]
|
16,699 | all-16700 | [
"GetHandler",
"returns",
"a",
"handler",
"with",
"given",
"method",
"."
]
| [
"func",
"(",
"e",
"*",
"Entry",
")",
"GetHandler",
"(",
"method",
"string",
")",
"*",
"Route",
"{",
"handler",
":=",
"e",
".",
"handlers",
"[",
"method",
"]",
"\n",
"if",
"handler",
"==",
"nil",
"{",
"handler",
"=",
"e",
".",
"handler",
"\n",
"}",
"\n",
"return",
"<mask>",
"\n",
"}"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.