id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
800 | all-801 | [
"SwarmPeers",
"gets",
"all",
"the",
"swarm",
"peers"
] | [
"func",
"(",
"s",
"*",
"Shell",
")",
"SwarmPeers",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"SwarmConnInfos",
",",
"error",
")",
"{",
"v",
":=",
"&",
"SwarmConnInfos",
"{",
"}",
"\n",
"err",
":=",
"s",
".",
"<mask>",
"(",
"\"",
"\"",
")",
".",
"Exec",
"(",
"ctx",
",",
"&",
"v",
")",
"\n",
"return",
"v",
",",
"err",
"\n",
"}"
] |
801 | all-802 | [
"Setter",
"allows",
"the",
"user",
"to",
"set",
"the",
"method",
"by",
"which",
"a",
"nonce",
"is",
"stored",
"in",
"the",
"outgoing",
"response",
"."
] | [
"func",
"Setter",
"(",
"s",
"NonceSetter",
")",
"Option",
"{",
"return",
"Option",
"{",
"func",
"(",
"o",
"*",
"<mask>",
")",
"{",
"o",
".",
"setter",
"=",
"s",
"\n",
"}",
"}",
"\n",
"}"
] |
802 | all-803 | [
"MatchFields",
"succeeds",
"if",
"each",
"element",
"of",
"a",
"struct",
"matches",
"the",
"field",
"matcher",
"associated",
"with",
"it",
".",
"It",
"can",
"ignore",
"extra",
"fields",
"and",
"/",
"or",
"missing",
"fields",
".",
"actual",
":",
"=",
"struct",
"{",
"A",
"int",
"B",
"[]",
"bool",
"C",
"string",
"}",
"{",
"A",
":",
"5",
"B",
":",
"[]",
"bool",
"{",
"true",
"false",
"}",
"C",
":",
"foo",
"}",
"Expect",
"(",
"actual",
")",
".",
"To",
"(",
"MatchFields",
"(",
"IgnoreExtras",
"Fields",
"{",
"A",
":",
"Equal",
"(",
"5",
")",
"B",
":",
"ConsistOf",
"(",
"true",
"false",
")",
"}",
"))",
"Expect",
"(",
"actual",
")",
".",
"To",
"(",
"MatchFields",
"(",
"IgnoreMissing",
"Fields",
"{",
"A",
":",
"Equal",
"(",
"5",
")",
"B",
":",
"ConsistOf",
"(",
"true",
"false",
")",
"C",
":",
"Equal",
"(",
"foo",
")",
"D",
":",
"Equal",
"(",
"extra",
")",
"}",
"))"
] | [
"func",
"MatchFields",
"(",
"options",
"Options",
",",
"fields",
"Fields",
")",
"types",
".",
"GomegaMatcher",
"{",
"return",
"&",
"FieldsMatcher",
"{",
"Fields",
":",
"fields",
",",
"IgnoreExtras",
":",
"<mask>",
"&",
"IgnoreExtras",
"!=",
"0",
",",
"IgnoreMissing",
":",
"options",
"&",
"IgnoreMissing",
"!=",
"0",
",",
"}",
"\n",
"}"
] |
803 | all-804 | [
"Copy",
"a",
"container",
"on",
"a",
"storage",
"pool",
"that",
"does",
"use",
"a",
"thinpool",
"."
] | [
"func",
"(",
"s",
"*",
"storageLvm",
")",
"copyContainerThinpool",
"(",
"target",
"container",
",",
"source",
"container",
",",
"readonly",
"bool",
")",
"error",
"{",
"err",
":=",
"s",
".",
"createSnapshotContainer",
"(",
"target",
",",
"source",
",",
"readonly",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"// Generate a new xfs's UUID",
"LVFilesystem",
":=",
"s",
".",
"getLvmFilesystem",
"(",
")",
"\n",
"poolName",
":=",
"s",
".",
"getOnDiskPoolName",
"(",
")",
"\n",
"containerName",
":=",
"target",
".",
"Name",
"(",
")",
"\n",
"containerLvmName",
":=",
"containerNameToLVName",
"(",
"containerName",
")",
"\n",
"containerLvDevPath",
":=",
"getLvmDevPath",
"(",
"target",
".",
"Project",
"(",
")",
",",
"poolName",
",",
"storagePoolVolumeAPIEndpointContainers",
",",
"containerLvmName",
")",
"\n\n",
"// If btrfstune sees two btrfs filesystems with the same UUID it",
"// gets confused and wants both of them unmounted. So unmount",
"// the source as well.",
"if",
"LVFilesystem",
"==",
"\"",
"\"",
"{",
"ourUmount",
",",
"err",
":=",
"s",
".",
"ContainerUmount",
"(",
"source",
",",
"<mask>",
".",
"Path",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"ourUmount",
"{",
"defer",
"s",
".",
"ContainerMount",
"(",
"source",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"msg",
",",
"err",
":=",
"fsGenerateNewUUID",
"(",
"LVFilesystem",
",",
"containerLvDevPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"LVFilesystem",
",",
"containerName",
",",
"s",
".",
"pool",
".",
"Name",
",",
"msg",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
804 | all-805 | [
"SetImage",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_button_set_image",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Button",
")",
"SetImage",
"(",
"image",
"IWidget",
")",
"{",
"C",
".",
"gtk_button_set_image",
"(",
"v",
".",
"native",
"(",
")",
",",
"<mask>",
".",
"toWidget",
"(",
")",
")",
"\n",
"}"
] |
805 | all-806 | [
"GlobLiteralPrefix",
"returns",
"the",
"prefix",
"before",
"the",
"first",
"glob",
"character"
] | [
"func",
"GlobLiteralPrefix",
"(",
"pattern",
"string",
")",
"string",
"{",
"pattern",
"=",
"clean",
"(",
"pattern",
")",
"\n",
"idx",
":=",
"globRegex",
".",
"FindStringIndex",
"(",
"pattern",
")",
"\n",
"if",
"idx",
"==",
"nil",
"{",
"return",
"pattern",
"\n",
"}",
"\n",
"return",
"<mask>",
"[",
":",
"idx",
"[",
"0",
"]",
"]",
"\n",
"}"
] |
806 | all-807 | [
"Enables",
"cross",
"-",
"site",
"script",
"calls",
"."
] | [
"func",
"SetCORS",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"o",
"*",
"regexp",
".",
"Regexp",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"origin",
":=",
"r",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"origin",
"==",
"\"",
"\"",
"{",
"return",
"\n",
"}",
"\n\n",
"for",
"k",
",",
"v",
":=",
"range",
"corsHeaders",
"{",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"k",
",",
"v",
")",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"<mask>",
"(",
")",
"==",
"\"",
"\"",
"{",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"MatchString",
"(",
"origin",
")",
"{",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"origin",
")",
"\n",
"}",
"\n",
"}"
] |
807 | all-808 | [
"/",
"*",
"Excluding",
"a",
"recipient",
"on",
"a",
"trigger",
"to",
"multiple",
"channels",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"TriggerMultiExclusive",
"(",
"channels",
"[",
"]",
"string",
",",
"eventName",
"string",
",",
"data",
"interface",
"{",
"}",
",",
"socketID",
"string",
")",
"(",
"*",
"BufferedEvents",
",",
"error",
")",
"{",
"return",
"c",
".",
"trigger",
"(",
"channels",
",",
"eventName",
",",
"<mask>",
",",
"&",
"socketID",
")",
"\n",
"}"
] |
808 | all-809 | [
"GenerateCredentialsEndpointRelativeURI",
"generates",
"the",
"relative",
"URI",
"for",
"the",
"credentials",
"endpoint",
"for",
"a",
"given",
"task",
"id",
"."
] | [
"func",
"(",
"roleCredentials",
"*",
"IAMRoleCredentials",
")",
"GenerateCredentialsEndpointRelativeURI",
"(",
")",
"string",
"{",
"<mask>",
"fmt",
".",
"Sprintf",
"(",
"credentialsEndpointRelativeURIFormat",
",",
"CredentialsPath",
",",
"roleCredentials",
".",
"CredentialsID",
")",
"\n",
"}"
] |
809 | all-810 | [
"GitHubClientWithLogFields",
"returns",
"a",
"GitHub",
"client",
"with",
"extra",
"logging",
"fields"
] | [
"func",
"(",
"o",
"*",
"GitHubOptions",
")",
"GitHubClientWithLogFields",
"(",
"secretAgent",
"*",
"secret",
".",
"Agent",
",",
"dryRun",
"bool",
",",
"fields",
"logrus",
".",
"Fields",
")",
"(",
"client",
"*",
"github",
".",
"Client",
",",
"err",
"error",
")",
"{",
"<mask>",
"generator",
"*",
"func",
"(",
")",
"[",
"]",
"byte",
"\n",
"if",
"o",
".",
"TokenPath",
"==",
"\"",
"\"",
"{",
"generatorFunc",
":=",
"func",
"(",
")",
"[",
"]",
"byte",
"{",
"return",
"[",
"]",
"byte",
"{",
"}",
"\n",
"}",
"\n",
"generator",
"=",
"&",
"generatorFunc",
"\n",
"}",
"else",
"{",
"if",
"secretAgent",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"o",
".",
"TokenPath",
")",
"\n",
"}",
"\n",
"generatorFunc",
":=",
"secretAgent",
".",
"GetTokenGenerator",
"(",
"o",
".",
"TokenPath",
")",
"\n",
"generator",
"=",
"&",
"generatorFunc",
"\n",
"}",
"\n\n",
"if",
"dryRun",
"{",
"return",
"github",
".",
"NewDryRunClientWithFields",
"(",
"fields",
",",
"*",
"generator",
",",
"o",
".",
"graphqlEndpoint",
",",
"o",
".",
"endpoint",
".",
"Strings",
"(",
")",
"...",
")",
",",
"nil",
"\n",
"}",
"\n",
"return",
"github",
".",
"NewClientWithFields",
"(",
"fields",
",",
"*",
"generator",
",",
"o",
".",
"graphqlEndpoint",
",",
"o",
".",
"endpoint",
".",
"Strings",
"(",
")",
"...",
")",
",",
"nil",
"\n",
"}"
] |
810 | all-811 | [
"UnmarshalText",
"hydrates",
"this",
"instance",
"from",
"text"
] | [
"func",
"(",
"u",
"*",
"CreditCard",
")",
"UnmarshalText",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"// validation is performed later on",
"*",
"u",
"=",
"CreditCard",
"(",
"string",
"(",
"data",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
811 | all-812 | [
"processSources",
"pulls",
"from",
"input",
"channels",
"and",
"processes",
"them",
"into",
"the",
"output",
"channel",
"until",
"there",
"is",
"no",
"more",
"work"
] | [
"func",
"(",
"w",
"*",
"workManager",
")",
"processSources",
"(",
")",
"{",
"var",
"(",
"ok",
"bool",
"\n",
"path",
"string",
"\n",
"seq",
"*",
"fileseq",
".",
"FileSequence",
"\n",
")",
"\n\n",
"fileopts",
":=",
"w",
".",
"fileOpts",
"\n\n",
"inDirs",
":=",
"w",
".",
"inDirs",
"\n",
"inSeqs",
":=",
"w",
".",
"inSeqs",
"\n",
"outSeqs",
":=",
"w",
".",
"outSeqs",
"\n\n",
"isDone",
":=",
"func",
"(",
")",
"bool",
"{",
"return",
"(",
"inDirs",
"==",
"nil",
"&&",
"inSeqs",
"==",
"nil",
")",
"\n",
"}",
"\n\n",
"for",
"!",
"isDone",
"(",
")",
"{",
"select",
"{",
"// Directory paths will be scanned for contents",
"case",
"path",
",",
"ok",
"=",
"<-",
"inDirs",
":",
"if",
"!",
"ok",
"{",
"inDirs",
"=",
"nil",
"\n",
"continue",
"\n",
"}",
"\n",
"seqs",
",",
"err",
":=",
"fileseq",
".",
"FindSequencesOnDisk",
"(",
"path",
",",
"fileopts",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Fprintf",
"(",
"errOut",
",",
"\"",
"\\n",
"\"",
",",
"ErrorPath",
",",
"path",
",",
"err",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"outSeqs",
"<-",
"seqs",
"\n\n",
"// Sequence paths will be scanned for a direct match",
"// against the sequence pattern",
"case",
"seq",
",",
"ok",
"=",
"<-",
"inSeqs",
":",
"if",
"!",
"ok",
"{",
"inSeqs",
"=",
"nil",
"\n",
"continue",
"\n",
"}",
"\n\n",
"path",
",",
"err",
":=",
"seq",
".",
"Format",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Fprintf",
"(",
"errOut",
",",
"\"",
"\\n",
"\"",
",",
"ErrorPattern",
",",
"path",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"seq",
",",
"err",
":=",
"fileseq",
".",
"FindSequenceOnDisk",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"!",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"fmt",
".",
"Fprintf",
"(",
"errOut",
",",
"\"",
"\\n",
"\"",
",",
"ErrorPattern",
",",
"<mask>",
",",
"err",
")",
"\n",
"}",
"\n",
"continue",
"\n",
"}",
"\n\n",
"if",
"seq",
"!=",
"nil",
"{",
"outSeqs",
"<-",
"fileseq",
".",
"FileSequences",
"{",
"seq",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
812 | all-813 | [
"coalesceAdjacentEdits",
"coalesces",
"the",
"list",
"of",
"edits",
"into",
"groups",
"of",
"adjacent",
"equal",
"or",
"unequal",
"counts",
"."
] | [
"func",
"coalesceAdjacentEdits",
"(",
"name",
"string",
",",
"es",
"diff",
".",
"EditScript",
")",
"(",
"groups",
"[",
"]",
"diffStats",
")",
"{",
"var",
"prevCase",
"int",
"// Arbitrary index into which case last occurred",
"\n",
"lastStats",
":=",
"func",
"(",
"i",
"int",
")",
"*",
"diffStats",
"{",
"if",
"prevCase",
"!=",
"i",
"{",
"groups",
"=",
"append",
"(",
"groups",
",",
"diffStats",
"{",
"Name",
":",
"name",
"}",
")",
"\n",
"prevCase",
"=",
"i",
"\n",
"}",
"\n",
"return",
"&",
"groups",
"[",
"len",
"(",
"groups",
")",
"-",
"1",
"]",
"\n",
"}",
"\n",
"for",
"_",
",",
"e",
":=",
"range",
"es",
"{",
"switch",
"e",
"{",
"<mask>",
"diff",
".",
"Identity",
":",
"lastStats",
"(",
"1",
")",
".",
"NumIdentical",
"++",
"\n",
"case",
"diff",
".",
"UniqueX",
":",
"lastStats",
"(",
"2",
")",
".",
"NumRemoved",
"++",
"\n",
"case",
"diff",
".",
"UniqueY",
":",
"lastStats",
"(",
"2",
")",
".",
"NumInserted",
"++",
"\n",
"case",
"diff",
".",
"Modified",
":",
"lastStats",
"(",
"2",
")",
".",
"NumModified",
"++",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"groups",
"\n",
"}"
] |
813 | all-814 | [
"UnmarshalBinary",
"implements",
"encoding",
".",
"BinaryUnmarshaler",
"."
] | [
"func",
"(",
"uuid",
"*",
"UUID",
")",
"UnmarshalBinary",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"len",
"(",
"data",
")",
"!=",
"16",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"len",
"(",
"data",
")",
")",
"\n",
"}",
"\n",
"copy",
"(",
"uuid",
"[",
":",
"]",
",",
"<mask>",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
814 | all-815 | [
"TemplateConfigFor",
"returns",
"the",
"TemplateConfig",
"for",
"the",
"given",
"Template"
] | [
"func",
"(",
"r",
"*",
"<mask>",
")",
"templateConfigsFor",
"(",
"tmpl",
"*",
"template",
".",
"Template",
")",
"[",
"]",
"*",
"config",
".",
"TemplateConfig",
"{",
"return",
"r",
".",
"ctemplatesMap",
"[",
"tmpl",
".",
"ID",
"(",
")",
"]",
"\n",
"}"
] |
815 | all-816 | [
"Pin",
"the",
"given",
"path"
] | [
"func",
"(",
"s",
"*",
"Shell",
")",
"Pin",
"(",
"path",
"string",
")",
"error",
"{",
"return",
"s",
".",
"Request",
"(",
"\"",
"\"",
",",
"<mask>",
")",
".",
"Option",
"(",
"\"",
"\"",
",",
"true",
")",
".",
"Exec",
"(",
"context",
".",
"Background",
"(",
")",
",",
"nil",
")",
"\n",
"}"
] |
816 | all-817 | [
"Helpers"
] | [
"func",
"(",
"conn",
"*",
"LocalConnection",
")",
"sendSimpleProtocolMsg",
"(",
"tag",
"protocolTag",
")",
"error",
"{",
"return",
"conn",
".",
"sendProtocolMsg",
"(",
"protocolMsg",
"{",
"tag",
":",
"<mask>",
"}",
")",
"\n",
"}"
] |
817 | all-818 | [
"Delete",
"removes",
"the",
"entry",
"associated",
"with",
"the",
"key",
"from",
"cache"
] | [
"func",
"(",
"lru",
"*",
"lruCache",
")",
"Delete",
"(",
"key",
"string",
")",
"{",
"lru",
".",
"Lock",
"(",
")",
"\n",
"defer",
"lru",
".",
"Unlock",
"(",
")",
"\n\n",
"lru",
".",
"removeFromEvictList",
"(",
"key",
")",
"\n",
"<mask>",
"(",
"lru",
".",
"cache",
",",
"key",
")",
"\n",
"}"
] |
818 | all-819 | [
"SetMarkup",
"is",
"a",
"wrapper",
"around",
"gtk_label_set_markup",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Label",
")",
"SetMarkup",
"(",
"str",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"str",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_label_set_markup",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
819 | all-820 | [
"SelectMany",
"allows",
"for",
"unfolding",
"of",
"values",
"."
] | [
"func",
"SelectMany",
"(",
"<mask>",
"Enumerable",
",",
"toMany",
"Unfolder",
")",
"Enumerable",
"{",
"return",
"selectManyer",
"{",
"original",
":",
"subject",
",",
"toMany",
":",
"toMany",
",",
"}",
"\n",
"}"
] |
820 | all-821 | [
"Do",
"executes",
"Security",
".",
"setIgnoreCertificateErrors",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SetIgnoreCertificateErrorsParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetIgnoreCertificateErrors",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
821 | all-822 | [
"GetClient",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockFactory",
")",
"GetClient",
"(",
"arg0",
"dockerclient",
".",
"DockerVersion",
")",
"(",
"sdkclient",
".",
"Client",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"sdkclient",
".",
"Client",
")",
"\n",
"ret1",
",",
"_",
":=",
"<mask>",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
822 | all-823 | [
"ParseExec",
"parses",
"the",
"XPath",
"string",
"xpstr",
"and",
"runs",
"Exec",
"."
] | [
"func",
"ParseExec",
"(",
"xpstr",
"string",
",",
"t",
"tree",
".",
"Node",
",",
"opts",
"...",
"FuncOpts",
")",
"(",
"<mask>",
".",
"Result",
",",
"error",
")",
"{",
"xp",
",",
"err",
":=",
"Parse",
"(",
"xpstr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"xp",
".",
"Exec",
"(",
"t",
",",
"opts",
"...",
")",
"\n",
"}"
] |
823 | all-824 | [
"CreateProduct",
"creates",
"new",
"product",
"."
] | [
"func",
"(",
"h",
"*",
"<mask>",
")",
"CreateProduct",
"(",
"tkn",
"string",
",",
"product",
"data",
".",
"Product",
")",
"(",
"*",
"string",
",",
"error",
")",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"product",
")",
"\n\n",
"if",
"!",
"h",
".",
"token",
".",
"Check",
"(",
"tkn",
")",
"{",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
",",
"ErrAccessDenied",
"\n",
"}",
"\n\n",
"if",
"product",
".",
"ServiceEndpointAddress",
"!=",
"nil",
"&&",
"!",
"isValidSEAddress",
"(",
"*",
"product",
".",
"ServiceEndpointAddress",
")",
"{",
"return",
"nil",
",",
"ErrBadServiceEndpointAddress",
"\n",
"}",
"\n\n",
"product",
".",
"ID",
"=",
"util",
".",
"NewUUID",
"(",
")",
"\n",
"if",
"err",
":=",
"insert",
"(",
"logger",
",",
"h",
".",
"db",
".",
"Querier",
",",
"&",
"product",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"product",
".",
"ID",
",",
"nil",
"\n",
"}"
] |
824 | all-825 | [
"GetState",
"retrieves",
"the",
"State",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"LedgerEntryChange",
")",
"GetState",
"(",
")",
"(",
"result",
"LedgerEntry",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"State",
"\n",
"<mask>",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
825 | all-826 | [
"SendSystemError",
"returns",
"a",
"system",
"error",
"response",
"to",
"the",
"peer",
".",
"The",
"call",
"is",
"considered",
"complete",
"after",
"this",
"method",
"is",
"called",
"and",
"no",
"further",
"data",
"can",
"be",
"written",
"."
] | [
"func",
"(",
"response",
"*",
"InboundCallResponse",
")",
"SendSystemError",
"(",
"err",
"error",
")",
"error",
"{",
"if",
"response",
".",
"err",
"!=",
"nil",
"{",
"return",
"response",
".",
"err",
"\n",
"}",
"\n",
"// Fail all future attempts to read fragments",
"response",
".",
"state",
"=",
"reqResWriterComplete",
"\n",
"response",
".",
"systemError",
"=",
"true",
"\n",
"response",
".",
"doneSending",
"(",
")",
"\n",
"response",
".",
"call",
".",
"releasePreviousFragment",
"(",
")",
"\n\n",
"<mask>",
":=",
"CurrentSpan",
"(",
"response",
".",
"mex",
".",
"ctx",
")",
"\n\n",
"return",
"response",
".",
"conn",
".",
"SendSystemError",
"(",
"response",
".",
"mex",
".",
"msgID",
",",
"*",
"span",
",",
"err",
")",
"\n",
"}"
] |
826 | all-827 | [
"newRaftNode",
"initiates",
"a",
"raft",
"instance",
"and",
"returns",
"a",
"committed",
"log",
"entry",
"channel",
"and",
"error",
"channel",
".",
"Proposals",
"for",
"log",
"updates",
"are",
"sent",
"over",
"the",
"provided",
"the",
"proposal",
"channel",
".",
"All",
"log",
"entries",
"are",
"replayed",
"over",
"the",
"commit",
"channel",
"followed",
"by",
"a",
"nil",
"message",
"(",
"to",
"indicate",
"the",
"channel",
"is",
"current",
")",
"then",
"new",
"log",
"entries",
".",
"To",
"shutdown",
"close",
"proposeC",
"and",
"read",
"errorC",
"."
] | [
"func",
"newRaftNode",
"(",
"id",
"int",
",",
"peers",
"[",
"]",
"string",
",",
"join",
"bool",
",",
"getSnapshot",
"func",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
",",
"proposeC",
"<-",
"chan",
"string",
",",
"confChangeC",
"<-",
"chan",
"raftpb",
".",
"ConfChange",
")",
"(",
"<-",
"chan",
"*",
"string",
",",
"<-",
"chan",
"error",
",",
"<-",
"chan",
"*",
"snap",
".",
"Snapshotter",
")",
"{",
"commitC",
":=",
"<mask>",
"(",
"chan",
"*",
"string",
")",
"\n",
"errorC",
":=",
"make",
"(",
"chan",
"error",
")",
"\n\n",
"rc",
":=",
"&",
"raftNode",
"{",
"proposeC",
":",
"proposeC",
",",
"confChangeC",
":",
"confChangeC",
",",
"commitC",
":",
"commitC",
",",
"errorC",
":",
"errorC",
",",
"id",
":",
"id",
",",
"peers",
":",
"peers",
",",
"join",
":",
"join",
",",
"waldir",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"id",
")",
",",
"snapdir",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"id",
")",
",",
"getSnapshot",
":",
"getSnapshot",
",",
"snapCount",
":",
"defaultSnapshotCount",
",",
"stopc",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"httpstopc",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"httpdonec",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"snapshotterReady",
":",
"make",
"(",
"chan",
"*",
"snap",
".",
"Snapshotter",
",",
"1",
")",
",",
"// rest of structure populated after WAL replay",
"}",
"\n",
"go",
"rc",
".",
"startRaft",
"(",
")",
"\n",
"return",
"commitC",
",",
"errorC",
",",
"rc",
".",
"snapshotterReady",
"\n",
"}"
] |
827 | all-828 | [
"PopupAtPointer",
"()",
"is",
"a",
"wrapper",
"for",
"gtk_menu_popup_at_pointer",
"()",
"on",
"older",
"versions",
"it",
"uses",
"PopupAtMouseCursor"
] | [
"func",
"(",
"v",
"*",
"Menu",
")",
"PopupAtPointer",
"(",
"triggerEvent",
"*",
"gdk",
".",
"<mask>",
")",
"{",
"e",
":=",
"(",
"*",
"C",
".",
"GdkEvent",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"triggerEvent",
".",
"Native",
"(",
")",
")",
")",
"\n",
"C",
".",
"gtk_menu_popup_at_pointer",
"(",
"v",
".",
"native",
"(",
")",
",",
"e",
")",
"\n",
"}"
] |
828 | all-829 | [
"ArmForSwitch",
"returns",
"which",
"field",
"name",
"should",
"be",
"used",
"for",
"storing",
"the",
"value",
"for",
"an",
"instance",
"of",
"OperationResultTr"
] | [
"func",
"(",
"u",
"OperationResultTr",
")",
"ArmForSwitch",
"(",
"sw",
"int32",
")",
"(",
"string",
",",
"bool",
")",
"{",
"switch",
"OperationType",
"(",
"sw",
")",
"{",
"case",
"OperationTypeCreateAccount",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"case",
"OperationTypePayment",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"case",
"OperationTypePathPayment",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"case",
"OperationTypeManageOffer",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"case",
"OperationTypeCreatePassiveOffer",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"case",
"OperationTypeSetOptions",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"<mask>",
"OperationTypeChangeTrust",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"case",
"OperationTypeAllowTrust",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"case",
"OperationTypeAccountMerge",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"case",
"OperationTypeInflation",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"case",
"OperationTypeManageData",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}"
] |
829 | all-830 | [
"CalcBruteForceCardinality",
"calculates",
"the",
"brute",
"force",
"cardinality",
"TODO",
":",
"Validate",
"against",
"python"
] | [
"func",
"CalcBruteForceCardinality",
"(",
"password",
"string",
")",
"float64",
"{",
"lower",
",",
"upper",
",",
"digits",
",",
"symbols",
":=",
"float64",
"(",
"0",
")",
",",
"float64",
"(",
"0",
")",
",",
"float64",
"(",
"0",
")",
",",
"float64",
"(",
"0",
")",
"\n\n",
"for",
"_",
",",
"char",
":=",
"range",
"password",
"{",
"if",
"unicode",
".",
"IsLower",
"(",
"char",
")",
"{",
"lower",
"=",
"float64",
"(",
"26",
")",
"\n",
"}",
"else",
"if",
"unicode",
".",
"IsDigit",
"(",
"char",
")",
"{",
"digits",
"=",
"float64",
"(",
"10",
")",
"\n",
"}",
"else",
"if",
"unicode",
".",
"IsUpper",
"(",
"char",
")",
"{",
"upper",
"=",
"float64",
"(",
"26",
")",
"\n",
"}",
"else",
"{",
"symbols",
"=",
"float64",
"(",
"33",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"cardinality",
":=",
"lower",
"+",
"<mask>",
"+",
"digits",
"+",
"symbols",
"\n",
"return",
"cardinality",
"\n",
"}"
] |
830 | all-831 | [
"Grow",
"automatically",
"grows",
"the",
"underlying",
"buffer",
"so",
"that",
"it",
"can",
"hold",
"at",
"least",
"min",
"elements"
] | [
"func",
"(",
"s",
"*",
"Stack",
")",
"Grow",
"(",
"<mask>",
"int",
")",
"{",
"// Automatically grow the stack to some long-enough length",
"if",
"min",
"<=",
"s",
".",
"BufferSize",
"(",
")",
"{",
"// we have enough",
"return",
"\n",
"}",
"\n\n",
"s",
".",
"Resize",
"(",
"calcNewSize",
"(",
"min",
")",
")",
"\n",
"}"
] |
831 | all-832 | [
"SetCreateFolders",
"is",
"a",
"wrapper",
"around",
"gtk_file_chooser_set_create_folders",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"FileChooser",
")",
"SetCreateFolders",
"(",
"<mask>",
"bool",
")",
"{",
"C",
".",
"gtk_file_chooser_set_create_folders",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"value",
")",
")",
"\n",
"}"
] |
832 | all-833 | [
"ReadUvarint",
"reads",
"an",
"unsigned",
"varint",
"from",
"the",
"buffer",
"."
] | [
"func",
"(",
"r",
"*",
"ReadBuffer",
")",
"ReadUvarint",
"(",
")",
"uint64",
"{",
"v",
",",
"_",
":=",
"<mask>",
".",
"ReadUvarint",
"(",
"r",
")",
"\n",
"return",
"v",
"\n",
"}"
] |
833 | all-834 | [
"Stop",
"all",
"socket",
"listeners"
] | [
"func",
"(",
"app",
"*",
"App",
")",
"stopListeners",
"(",
")",
"{",
"logger",
":=",
"zapwriter",
".",
"Logger",
"(",
"\"",
"\"",
")",
"\n\n",
"if",
"app",
".",
"Api",
"!=",
"nil",
"{",
"app",
".",
"Api",
".",
"Stop",
"(",
")",
"\n",
"app",
".",
"Api",
"=",
"nil",
"\n",
"logger",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"app",
".",
"CarbonLink",
"!=",
"nil",
"{",
"app",
".",
"CarbonLink",
".",
"Stop",
"(",
")",
"\n",
"app",
".",
"CarbonLink",
"=",
"nil",
"\n",
"logger",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"app",
".",
"Carbonserver",
"!=",
"nil",
"{",
"carbonserver",
":=",
"app",
".",
"Carbonserver",
"\n",
"go",
"func",
"(",
")",
"{",
"carbonserver",
".",
"Stop",
"(",
")",
"\n",
"logger",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"}",
"(",
")",
"\n",
"app",
".",
"Carbonserver",
"=",
"nil",
"\n",
"}",
"\n\n",
"if",
"app",
".",
"Receivers",
"!=",
"nil",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"app",
".",
"Receivers",
")",
";",
"i",
"++",
"{",
"app",
".",
"Receivers",
"[",
"i",
"]",
".",
"Stop",
"(",
")",
"\n",
"logger",
".",
"Debug",
"(",
"\"",
"\"",
",",
"zap",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"app",
".",
"Receivers",
"[",
"i",
"]",
".",
"Name",
")",
")",
"\n",
"}",
"\n",
"app",
".",
"Receivers",
"=",
"nil",
"\n",
"}",
"\n",
"}"
] |
834 | all-835 | [
"Configure",
"is",
"a",
"wrapper",
"around",
"gtk_adjustment_configure",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Adjustment",
")",
"Configure",
"(",
"value",
",",
"lower",
",",
"upper",
",",
"stepIncrement",
",",
"pageIncrement",
",",
"pageSize",
"float64",
")",
"{",
"C",
".",
"gtk_adjustment_configure",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gdouble",
"(",
"value",
")",
",",
"C",
".",
"gdouble",
"(",
"lower",
")",
",",
"C",
".",
"gdouble",
"(",
"<mask>",
")",
",",
"C",
".",
"gdouble",
"(",
"stepIncrement",
")",
",",
"C",
".",
"gdouble",
"(",
"pageIncrement",
")",
",",
"C",
".",
"gdouble",
"(",
"pageSize",
")",
")",
"\n",
"}"
] |
835 | all-836 | [
"NewFile",
"creates",
"and",
"returns",
"a",
"file",
"."
] | [
"func",
"NewFile",
"(",
"path",
"string",
",",
"data",
"[",
"]",
"byte",
")",
"*",
"<mask>",
"{",
"return",
"&",
"File",
"{",
"path",
":",
"path",
",",
"data",
":",
"data",
",",
"}",
"\n",
"}"
] |
836 | all-837 | [
"SetSentStatus",
"marks",
"the",
"eni",
"attached",
"status",
"has",
"been",
"sent"
] | [
"func",
"(",
"eni",
"*",
"ENIAttachment",
")",
"SetSentStatus",
"(",
")",
"{",
"eni",
".",
"guard",
".",
"Lock",
"(",
")",
"\n",
"defer",
"eni",
".",
"guard",
".",
"Unlock",
"(",
")",
"\n\n",
"eni",
".",
"AttachStatusSent",
"=",
"<mask>",
"\n",
"}"
] |
837 | all-838 | [
"Remove",
"removes",
"value",
"from",
"the",
"set",
"if",
"it",
"exists",
"in",
"the",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"Set",
")",
"Remove",
"(",
"value",
"interface",
"{",
"}",
")",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"<mask>",
"(",
"s",
".",
"m",
",",
"value",
")",
"\n",
"}"
] |
838 | all-839 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventInspectModeCanceled",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoOverlay20",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
839 | all-840 | [
"anyKey",
"reads",
"the",
"key",
"from",
"file",
"or",
"generates",
"a",
"new",
"one",
"if",
"gen",
"==",
"true",
".",
"It",
"returns",
"an",
"error",
"if",
"filename",
"exists",
"but",
"cannot",
"be",
"read",
".",
"A",
"newly",
"generated",
"key",
"is",
"also",
"stored",
"to",
"filename",
"."
] | [
"func",
"anyKey",
"(",
"filename",
"string",
",",
"gen",
"bool",
")",
"(",
"crypto",
".",
"Signer",
",",
"error",
")",
"{",
"k",
",",
"err",
":=",
"readKey",
"(",
"filename",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"k",
",",
"nil",
"\n",
"}",
"\n",
"if",
"!",
"<mask>",
".",
"IsNotExist",
"(",
"err",
")",
"||",
"!",
"gen",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"ecKey",
",",
"err",
":=",
"ecdsa",
".",
"GenerateKey",
"(",
"elliptic",
".",
"P256",
"(",
")",
",",
"rand",
".",
"Reader",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"ecKey",
",",
"writeKey",
"(",
"filename",
",",
"ecKey",
")",
"\n",
"}"
] |
840 | all-841 | [
"WarnFunc",
"outputs",
"Warn",
"level",
"log",
"returned",
"from",
"the",
"function"
] | [
"func",
"(",
"g",
"*",
"Glg",
")",
"WarnFunc",
"(",
"f",
"func",
"(",
")",
"string",
")",
"error",
"{",
"if",
"g",
".",
"isModeEnable",
"(",
"WARN",
")",
"{",
"return",
"g",
".",
"out",
"(",
"<mask>",
",",
"\"",
"\"",
",",
"f",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
841 | all-842 | [
"NewBlockAPIServer",
"creates",
"a",
"BlockAPIServer",
"using",
"the",
"credentials",
"it",
"finds",
"in",
"the",
"environment"
] | [
"func",
"NewBlockAPIServer",
"(",
"dir",
"string",
",",
"cacheBytes",
"int64",
",",
"backend",
"string",
",",
"etcdAddress",
"string",
")",
"(",
"BlockAPIServer",
",",
"error",
")",
"{",
"switch",
"backend",
"{",
"case",
"MinioBackendEnvVar",
":",
"// S3 compatible doesn't like leading slashes",
"if",
"len",
"(",
"dir",
")",
">",
"0",
"&&",
"dir",
"[",
"0",
"]",
"==",
"'/'",
"{",
"dir",
"=",
"dir",
"[",
"1",
":",
"]",
"\n",
"}",
"\n",
"blockAPIServer",
",",
"err",
":=",
"newMinioBlockAPIServer",
"(",
"dir",
",",
"cacheBytes",
",",
"etcdAddress",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"blockAPIServer",
",",
"nil",
"\n",
"case",
"AmazonBackendEnvVar",
":",
"// amazon doesn't like leading slashes",
"if",
"len",
"(",
"dir",
")",
">",
"0",
"&&",
"dir",
"[",
"0",
"]",
"==",
"'/'",
"{",
"dir",
"=",
"dir",
"[",
"1",
":",
"]",
"\n",
"}",
"\n",
"blockAPIServer",
",",
"err",
":=",
"newAmazonBlockAPIServer",
"(",
"dir",
",",
"cacheBytes",
",",
"etcdAddress",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"blockAPIServer",
",",
"nil",
"\n",
"case",
"GoogleBackendEnvVar",
":",
"// TODO figure out if google likes leading slashses",
"blockAPIServer",
",",
"err",
":=",
"newGoogleBlockAPIServer",
"(",
"dir",
",",
"cacheBytes",
",",
"etcdAddress",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"blockAPIServer",
",",
"nil",
"\n",
"case",
"MicrosoftBackendEnvVar",
":",
"blockAPIServer",
",",
"err",
":=",
"newMicrosoftBlockAPIServer",
"(",
"dir",
",",
"cacheBytes",
",",
"etcdAddress",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"blockAPIServer",
",",
"nil",
"\n",
"<mask>",
"LocalBackendEnvVar",
":",
"fallthrough",
"\n",
"default",
":",
"blockAPIServer",
",",
"err",
":=",
"newLocalBlockAPIServer",
"(",
"dir",
",",
"cacheBytes",
",",
"etcdAddress",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"blockAPIServer",
",",
"nil",
"\n",
"}",
"\n",
"}"
] |
842 | all-843 | [
"String",
"returns",
"a",
"string",
"represenation",
"of",
"p"
] | [
"func",
"(",
"p",
"*",
"Price",
")",
"<mask>",
"(",
")",
"string",
"{",
"return",
"big",
".",
"NewRat",
"(",
"int64",
"(",
"p",
".",
"N",
")",
",",
"int64",
"(",
"p",
".",
"D",
")",
")",
".",
"FloatString",
"(",
"7",
")",
"\n",
"}"
] |
843 | all-844 | [
"/",
"*",
"yopla",
":",
"1"
] | [
"func",
"(",
"n",
"ACFullname",
")",
"TinyNameId",
"(",
")",
"string",
"{",
"split",
":=",
"strings",
".",
"Split",
"(",
"string",
"(",
"n",
")",
",",
"\"",
"\"",
")",
"\n",
"return",
"split",
"[",
"len",
"(",
"<mask>",
")",
"-",
"1",
"]",
"\n",
"}"
] |
844 | all-845 | [
"SetKeys",
"changes",
"the",
"value",
"of",
"apiKey",
"and",
"appKey",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"SetKeys",
"(",
"apiKey",
",",
"appKey",
"string",
")",
"{",
"c",
".",
"apiKey",
"=",
"apiKey",
"\n",
"c",
".",
"appKey",
"=",
"appKey",
"\n",
"}"
] |
845 | all-846 | [
"WithHTTPClient",
"adds",
"the",
"HTTPClient",
"to",
"the",
"patch",
"apps",
"app",
"params"
] | [
"func",
"(",
"o",
"*",
"PatchAppsAppParams",
")",
"WithHTTPClient",
"(",
"client",
"*",
"http",
".",
"<mask>",
")",
"*",
"PatchAppsAppParams",
"{",
"o",
".",
"SetHTTPClient",
"(",
"client",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
846 | all-847 | [
"NewSized",
"initializes",
"a",
"new",
"Map",
"with",
"the",
"given",
"size",
"."
] | [
"func",
"NewSized",
"(",
"width",
",",
"height",
"int",
")",
"*",
"Map",
"{",
"return",
"&",
"Map",
"{",
"m",
":",
"C",
".",
"mapnik_map",
"(",
"C",
".",
"uint",
"(",
"width",
")",
",",
"C",
".",
"uint",
"(",
"height",
")",
")",
",",
"width",
":",
"<mask>",
",",
"height",
":",
"height",
",",
"}",
"\n",
"}"
] |
847 | all-848 | [
"NewCreateAccountResult",
"creates",
"a",
"new",
"CreateAccountResult",
"."
] | [
"func",
"NewCreateAccountResult",
"(",
"code",
"CreateAccountResultCode",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"CreateAccountResult",
",",
"err",
"error",
")",
"{",
"result",
".",
"Code",
"=",
"<mask>",
"\n",
"switch",
"CreateAccountResultCode",
"(",
"code",
")",
"{",
"case",
"CreateAccountResultCodeCreateAccountSuccess",
":",
"// void",
"default",
":",
"// void",
"}",
"\n",
"return",
"\n",
"}"
] |
848 | all-849 | [
"Delete",
"deletes",
"a",
"hashtree",
"from",
"the",
"cache",
"."
] | [
"func",
"(",
"c",
"*",
"MergeCache",
")",
"Delete",
"(",
"<mask>",
"int64",
")",
"error",
"{",
"return",
"c",
".",
"Cache",
".",
"Delete",
"(",
"fmt",
".",
"Sprint",
"(",
"id",
")",
")",
"\n",
"}"
] |
849 | all-850 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetFocusEmulationEnabledParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation8",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
850 | all-851 | [
"Vec3Sub",
"performs",
"a",
"vector",
"subtraction",
".",
"dest",
"=",
"v1",
"-",
"v2",
".",
"dest",
"[",
"out",
"]",
"The",
"result",
"vector",
".",
"v1",
"[",
"in",
"]",
"The",
"base",
"vector",
".",
"v2",
"[",
"in",
"]",
"The",
"vector",
"to",
"subtract",
"from",
"v1",
"."
] | [
"func",
"Vec3Sub",
"(",
"<mask>",
",",
"v1",
",",
"v2",
"Vec3",
")",
"{",
"dest",
"[",
"0",
"]",
"=",
"v1",
"[",
"0",
"]",
"-",
"v2",
"[",
"0",
"]",
"\n",
"dest",
"[",
"1",
"]",
"=",
"v1",
"[",
"1",
"]",
"-",
"v2",
"[",
"1",
"]",
"\n",
"dest",
"[",
"2",
"]",
"=",
"v1",
"[",
"2",
"]",
"-",
"v2",
"[",
"2",
"]",
"\n",
"}"
] |
851 | all-852 | [
"Proto",
"finds",
"the",
"specified",
"protocol",
"for",
"a",
"service",
"based",
"off",
"of",
"the",
"service",
"s",
"name",
"and",
"which",
"interface",
"you",
"are",
"accessing",
".",
"Values",
"are",
"found",
"in",
"environment",
"variables",
"fitting",
"the",
"scheme",
":",
"SERVICE_",
"{",
"SERVICE",
"NAME",
"}",
"_",
"{",
"INTERFACE",
"NAME",
"}",
"_PROTO",
"."
] | [
"func",
"Proto",
"(",
"service",
",",
"name",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"template",
":=",
"fmt",
".",
"Sprintf",
"(",
"templateVar",
",",
"service",
",",
"<mask>",
")",
"\n",
"return",
"getVar",
"(",
"fmt",
".",
"Sprintf",
"(",
"template",
",",
"\"",
"\"",
")",
")",
"\n",
"}"
] |
852 | all-853 | [
"Update",
"the",
"key",
"with",
"the",
"given",
"data",
".",
"Valid",
"parameters",
"may",
"be",
"found",
"here",
":",
"https",
":",
"//",
"www",
".",
"twilio",
".",
"com",
"/",
"docs",
"/",
"api",
"/",
"rest",
"/",
"keys#instance",
"-",
"post"
] | [
"func",
"(",
"a",
"*",
"AccountService",
")",
"Update",
"(",
"ctx",
"context",
".",
"Context",
",",
"sid",
"string",
",",
"data",
"url",
".",
"Values",
")",
"(",
"*",
"Account",
",",
"error",
")",
"{",
"acct",
":=",
"<mask>",
"(",
"Account",
")",
"\n",
"// hack because this is not a resource off of the account sid",
"sidJSON",
":=",
"sid",
"+",
"\"",
"\"",
"\n",
"err",
":=",
"a",
".",
"client",
".",
"UpdateResource",
"(",
"ctx",
",",
"accountPathPart",
",",
"sidJSON",
",",
"data",
",",
"acct",
")",
"\n",
"return",
"acct",
",",
"err",
"\n",
"}"
] |
853 | all-854 | [
"/",
"*",
"String",
"looks",
"for",
"the",
"specified",
"key",
"and",
"returns",
"it",
"as",
"a",
"string",
".",
"If",
"not",
"found",
"the",
"default",
"value",
"def",
"is",
"returned",
"."
] | [
"func",
"(",
"config",
"*",
"Config",
")",
"String",
"(",
"<mask>",
"string",
",",
"def",
"string",
")",
"string",
"{",
"return",
"getString",
"(",
"config",
".",
"values",
",",
"key",
",",
"def",
")",
"\n",
"}"
] |
854 | all-855 | [
"zfs",
"is",
"a",
"helper",
"function",
"to",
"wrap",
"typical",
"calls",
"to",
"zfs",
"."
] | [
"func",
"zfs",
"(",
"arg",
"...",
"string",
")",
"(",
"[",
"]",
"[",
"]",
"string",
",",
"error",
")",
"{",
"c",
":=",
"<mask>",
"{",
"Command",
":",
"\"",
"\"",
"}",
"\n",
"return",
"c",
".",
"Run",
"(",
"arg",
"...",
")",
"\n",
"}"
] |
855 | all-856 | [
"removeStr",
"removes",
"s",
"from",
"ss",
"preserving",
"the",
"sorted",
"order",
"of",
"ss",
"(",
"for",
"removing",
"child",
"strings",
"from",
"DirectoryNodes",
"."
] | [
"func",
"removeStr",
"(",
"ss",
"*",
"[",
"]",
"string",
",",
"s",
"string",
")",
"bool",
"{",
"idx",
":=",
"sort",
".",
"SearchStrings",
"(",
"*",
"ss",
",",
"s",
")",
"\n",
"if",
"idx",
"==",
"len",
"(",
"*",
"<mask>",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"copy",
"(",
"(",
"*",
"ss",
")",
"[",
"idx",
":",
"]",
",",
"(",
"*",
"ss",
")",
"[",
"idx",
"+",
"1",
":",
"]",
")",
"\n",
"*",
"ss",
"=",
"(",
"*",
"ss",
")",
"[",
":",
"len",
"(",
"*",
"ss",
")",
"-",
"1",
"]",
"\n",
"return",
"true",
"\n",
"}"
] |
856 | all-857 | [
"Stability",
":",
"***",
"EXPERIMENTAL",
"***",
"This",
"endpoint",
"finalises",
"an",
"upload",
"done",
"through",
"the",
"blob",
"storageType",
".",
"The",
"queue",
"will",
"ensure",
"that",
"the",
"task",
"/",
"run",
"is",
"still",
"allowing",
"artifacts",
"to",
"be",
"uploaded",
".",
"For",
"single",
"-",
"part",
"S3",
"blob",
"artifacts",
"this",
"endpoint",
"will",
"simply",
"ensure",
"the",
"artifact",
"is",
"present",
"in",
"S3",
".",
"For",
"multipart",
"S3",
"artifacts",
"the",
"endpoint",
"will",
"perform",
"the",
"commit",
"step",
"of",
"the",
"multipart",
"upload",
"flow",
".",
"As",
"the",
"final",
"step",
"for",
"both",
"multi",
"and",
"single",
"part",
"artifacts",
"the",
"present",
"entity",
"field",
"will",
"be",
"set",
"to",
"true",
"to",
"reflect",
"that",
"the",
"artifact",
"is",
"now",
"present",
"and",
"a",
"message",
"published",
"to",
"pulse",
".",
"NOTE",
":",
"This",
"endpoint",
"*",
"must",
"*",
"be",
"called",
"for",
"all",
"artifacts",
"of",
"storageType",
"blob",
"Required",
"scopes",
":",
"Any",
"of",
":",
"-",
"queue",
":",
"create",
"-",
"artifact",
":",
"<taskId",
">",
"/",
"<runId",
">",
"-",
"All",
"of",
":",
"*",
"queue",
":",
"create",
"-",
"artifact",
":",
"<name",
">",
"*",
"assume",
":",
"worker",
"-",
"id",
":",
"<workerGroup",
">",
"/",
"<workerId",
">",
"See",
"#completeArtifact"
] | [
"func",
"(",
"queue",
"*",
"Queue",
")",
"CompleteArtifact",
"(",
"taskId",
",",
"runId",
",",
"name",
"string",
",",
"payload",
"*",
"CompleteArtifactRequest",
")",
"error",
"{",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"queue",
")",
"\n",
"_",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"payload",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"taskId",
")",
"+",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"runId",
")",
"+",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"<mask>",
")",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
857 | all-858 | [
"dockerCertDir",
"returns",
"a",
"path",
"to",
"a",
"directory",
"to",
"be",
"consumed",
"by",
"tlsclientconfig",
".",
"SetupCertificates",
"()",
"depending",
"on",
"ctx",
"and",
"hostPort",
"."
] | [
"func",
"dockerCertDir",
"(",
"sys",
"*",
"types",
".",
"SystemContext",
",",
"hostPort",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"sys",
"!=",
"nil",
"&&",
"sys",
".",
"DockerCertPath",
"!=",
"\"",
"\"",
"{",
"return",
"sys",
".",
"DockerCertPath",
",",
"nil",
"\n",
"}",
"\n",
"if",
"sys",
"!=",
"nil",
"&&",
"sys",
".",
"DockerPerHostCertDirPath",
"!=",
"\"",
"\"",
"{",
"return",
"filepath",
".",
"Join",
"(",
"sys",
".",
"DockerPerHostCertDirPath",
",",
"hostPort",
")",
",",
"nil",
"\n",
"}",
"\n\n",
"var",
"(",
"hostCertDir",
"string",
"\n",
"fullCertDirPath",
"string",
"\n",
")",
"\n",
"for",
"_",
",",
"systemPerHostCertDirPath",
":=",
"range",
"systemPerHostCertDirPaths",
"{",
"if",
"sys",
"!=",
"nil",
"&&",
"sys",
".",
"RootForImplicitAbsolutePaths",
"!=",
"\"",
"\"",
"{",
"hostCertDir",
"=",
"filepath",
".",
"Join",
"(",
"sys",
".",
"RootForImplicitAbsolutePaths",
",",
"systemPerHostCertDirPath",
")",
"\n",
"}",
"else",
"{",
"hostCertDir",
"=",
"systemPerHostCertDirPath",
"\n",
"}",
"\n\n",
"fullCertDirPath",
"=",
"filepath",
".",
"Join",
"(",
"hostCertDir",
",",
"hostPort",
")",
"\n",
"_",
",",
"err",
":=",
"<mask>",
".",
"Stat",
"(",
"fullCertDirPath",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"break",
"\n",
"}",
"\n",
"if",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"os",
".",
"IsPermission",
"(",
"err",
")",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"fullCertDirPath",
",",
"nil",
"\n",
"}"
] |
858 | all-859 | [
"native",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GObject",
"as",
"a",
"GtkOrientable",
"."
] | [
"func",
"(",
"v",
"*",
"Orientable",
")",
"native",
"(",
")",
"*",
"C",
".",
"GtkOrientable",
"{",
"if",
"v",
"==",
"nil",
"||",
"v",
".",
"GObject",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"p",
":=",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"GObject",
")",
"\n",
"<mask>",
"C",
".",
"toGtkOrientable",
"(",
"p",
")",
"\n",
"}"
] |
859 | all-860 | [
"WithDuration",
"duration",
"between",
"touchdown",
"and",
"touchup",
"events",
"in",
"ms",
"(",
"default",
":",
"50",
")",
"."
] | [
"func",
"(",
"p",
"SynthesizeTapGestureParams",
")",
"WithDuration",
"(",
"duration",
"int64",
")",
"*",
"SynthesizeTapGestureParams",
"{",
"p",
".",
"Duration",
"=",
"<mask>",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
860 | all-861 | [
"addENIAttachmentToState",
"adds",
"the",
"eni",
"info",
"to",
"the",
"state"
] | [
"func",
"(",
"handler",
"*",
"attachENIHandler",
")",
"addENIAttachmentToState",
"(",
"message",
"*",
"ecsacs",
".",
"AttachTaskNetworkInterfacesMessage",
",",
"receivedAt",
"time",
".",
"Time",
")",
"error",
"{",
"attachmentARN",
":=",
"aws",
".",
"StringValue",
"(",
"message",
".",
"ElasticNetworkInterfaces",
"[",
"0",
"]",
".",
"AttachmentArn",
")",
"\n",
"mac",
":=",
"aws",
".",
"StringValue",
"(",
"message",
".",
"ElasticNetworkInterfaces",
"[",
"0",
"]",
".",
"MacAddress",
")",
"\n",
"taskARN",
":=",
"aws",
".",
"StringValue",
"(",
"message",
".",
"TaskArn",
")",
"\n",
"eniAttachment",
":=",
"&",
"apieni",
".",
"ENIAttachment",
"{",
"TaskARN",
":",
"taskARN",
",",
"AttachmentARN",
":",
"attachmentARN",
",",
"AttachStatusSent",
":",
"false",
",",
"MACAddress",
":",
"mac",
",",
"// Stop tracking the eni attachment after timeout",
"ExpiresAt",
":",
"receivedAt",
".",
"Add",
"(",
"time",
".",
"Duration",
"(",
"aws",
".",
"Int64Value",
"(",
"<mask>",
".",
"WaitTimeoutMs",
")",
")",
"*",
"time",
".",
"Millisecond",
")",
",",
"}",
"\n",
"eniAckTimeoutHandler",
":=",
"ackTimeoutHandler",
"{",
"mac",
":",
"mac",
",",
"state",
":",
"handler",
".",
"state",
"}",
"\n",
"if",
"err",
":=",
"eniAttachment",
".",
"StartTimer",
"(",
"eniAckTimeoutHandler",
".",
"handle",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"taskARN",
",",
"attachmentARN",
",",
"mac",
")",
"\n",
"handler",
".",
"state",
".",
"AddENIAttachment",
"(",
"eniAttachment",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
861 | all-862 | [
"DeleteRuleSetByCID",
"deletes",
"rule",
"set",
"with",
"passed",
"cid",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"DeleteRuleSetByCID",
"(",
"cid",
"CIDType",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"cid",
"==",
"nil",
"||",
"*",
"cid",
"==",
"\"",
"\"",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"rulesetCID",
":=",
"string",
"(",
"*",
"cid",
")",
"\n\n",
"matched",
",",
"err",
":=",
"regexp",
".",
"MatchString",
"(",
"config",
".",
"RuleSetCIDRegex",
",",
"rulesetCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"matched",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"rulesetCID",
")",
"\n",
"}",
"\n\n",
"_",
",",
"err",
"=",
"a",
".",
"Delete",
"(",
"rulesetCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"<mask>",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"true",
",",
"nil",
"\n",
"}"
] |
862 | all-863 | [
"GetAPITokenOk",
"returns",
"a",
"tuple",
"with",
"the",
"APIToken",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"i",
"*",
"integrationPD",
")",
"GetAPITokenOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"i",
"==",
"nil",
"||",
"i",
".",
"APIToken",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"i",
".",
"APIToken",
",",
"true",
"\n",
"}"
] |
863 | all-864 | [
"HasSubdomain",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"i",
"*",
"integrationPD",
")",
"HasSubdomain",
"(",
")",
"bool",
"{",
"if",
"i",
"!=",
"nil",
"&&",
"i",
".",
"Subdomain",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
864 | all-865 | [
"expandStorageDrsSpaceLoadBalanceConfig",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"StorageDrsSpaceLoadBalanceConfig",
"."
] | [
"func",
"expandStorageDrsSpaceLoadBalanceConfig",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"version",
"viapi",
".",
"VSphereVersion",
",",
")",
"*",
"types",
".",
"StorageDrsSpaceLoadBalanceConfig",
"{",
"obj",
":=",
"&",
"types",
".",
"StorageDrsSpaceLoadBalanceConfig",
"{",
"MinSpaceUtilizationDifference",
":",
"int32",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
")",
",",
"SpaceUtilizationThreshold",
":",
"int32",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
")",
",",
"}",
"\n\n",
"if",
"version",
".",
"Newer",
"(",
"viapi",
".",
"VSphereVersion",
"{",
"Product",
":",
"<mask>",
".",
"Product",
",",
"Major",
":",
"6",
"}",
")",
"{",
"obj",
".",
"FreeSpaceThresholdGB",
"=",
"int32",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
")",
"\n",
"obj",
".",
"SpaceThresholdMode",
"=",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
"\n",
"}",
"\n\n",
"return",
"obj",
"\n",
"}"
] |
865 | all-866 | [
"title",
":",
"update",
"user",
"quota",
"path",
":",
"/",
"users",
"/",
"{",
"email",
"}",
"/",
"quota",
"method",
":",
"PUT",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"responses",
":",
"200",
":",
"Quota",
"updated",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized",
"403",
":",
"Limit",
"lower",
"than",
"allocated",
"value",
"404",
":",
"User",
"not",
"found"
] | [
"func",
"changeUserQuota",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"email",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermUserUpdateQuota",
",",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxUser",
",",
"email",
")",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"user",
",",
"err",
":=",
"auth",
".",
"GetUserByEmail",
"(",
"email",
")",
"\n",
"if",
"err",
"==",
"authTypes",
".",
"ErrUserNotFound",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusNotFound",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
",",
"}",
"\n",
"}",
"else",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"event",
".",
"Target",
"{",
"Type",
":",
"event",
".",
"TargetTypeUser",
",",
"<mask>",
":",
"email",
"}",
",",
"Kind",
":",
"permission",
".",
"PermUserUpdateQuota",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermUserReadEvents",
",",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxUser",
",",
"email",
")",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"limit",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"\"",
"\"",
",",
"}",
"\n",
"}",
"\n",
"err",
"=",
"servicemanager",
".",
"UserQuota",
".",
"SetLimit",
"(",
"user",
".",
"Email",
",",
"limit",
")",
"\n",
"if",
"err",
"==",
"quota",
".",
"ErrLimitLowerThanAllocated",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusForbidden",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
866 | all-867 | [
"WriteAmazonAssets",
"writes",
"assets",
"to",
"an",
"amazon",
"backend",
"."
] | [
"func",
"WriteAmazonAssets",
"(",
"encoder",
"Encoder",
",",
"opts",
"*",
"AssetOpts",
",",
"region",
"string",
",",
"bucket",
"string",
",",
"volumeSize",
"int",
",",
"creds",
"*",
"AmazonCreds",
",",
"cloudfrontDistro",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"WriteAssets",
"(",
"encoder",
",",
"opts",
",",
"amazonBackend",
",",
"amazonBackend",
",",
"volumeSize",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"var",
"secret",
"map",
"[",
"string",
"]",
"[",
"]",
"byte",
"\n",
"if",
"creds",
"==",
"nil",
"{",
"secret",
"=",
"AmazonIAMRoleSecret",
"(",
"region",
",",
"bucket",
",",
"cloudfrontDistro",
")",
"\n",
"}",
"else",
"if",
"creds",
".",
"ID",
"!=",
"\"",
"\"",
"{",
"secret",
"=",
"AmazonSecret",
"(",
"region",
",",
"bucket",
",",
"creds",
".",
"ID",
",",
"creds",
".",
"Secret",
",",
"creds",
".",
"<mask>",
",",
"cloudfrontDistro",
")",
"\n",
"}",
"else",
"if",
"creds",
".",
"VaultAddress",
"!=",
"\"",
"\"",
"{",
"secret",
"=",
"AmazonVaultSecret",
"(",
"region",
",",
"bucket",
",",
"creds",
".",
"VaultAddress",
",",
"creds",
".",
"VaultRole",
",",
"creds",
".",
"VaultToken",
",",
"cloudfrontDistro",
")",
"\n",
"}",
"\n",
"return",
"WriteSecret",
"(",
"encoder",
",",
"secret",
",",
"opts",
")",
"\n",
"}"
] |
867 | all-868 | [
"GetLimit",
"returns",
"the",
"Limit",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"w",
"*",
"WidgetProcessQuery",
")",
"GetLimit",
"(",
")",
"int",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"Limit",
"==",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"<mask>",
"*",
"w",
".",
"Limit",
"\n",
"}"
] |
868 | all-869 | [
"GetCurrentApproversSet",
"returns",
"the",
"set",
"of",
"approvers",
"(",
"login",
"only",
"normalized",
"to",
"lower",
"case",
")"
] | [
"func",
"(",
"ap",
"Approvers",
")",
"GetCurrentApproversSet",
"(",
")",
"sets",
".",
"String",
"{",
"currentApprovers",
":=",
"sets",
".",
"NewString",
"(",
")",
"\n\n",
"for",
"approver",
":=",
"<mask>",
"ap",
".",
"approvers",
"{",
"currentApprovers",
".",
"Insert",
"(",
"approver",
")",
"\n",
"}",
"\n\n",
"return",
"currentApprovers",
"\n",
"}"
] |
869 | all-870 | [
"GetKnownStatus",
"returns",
"the",
"known",
"status",
"of",
"the",
"container"
] | [
"func",
"(",
"c",
"*",
"Container",
")",
"GetKnownStatus",
"(",
")",
"apicontainerstatus",
".",
"ContainerStatus",
"{",
"c",
".",
"<mask>",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"c",
".",
"KnownStatusUnsafe",
"\n",
"}"
] |
870 | all-871 | [
"expandClusterDrsVMConfigInfo",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"ClusterDpmHostConfigInfo",
"."
] | [
"func",
"expandClusterDpmHostConfigInfo",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"host",
"*",
"object",
".",
"HostSystem",
")",
"(",
"*",
"<mask>",
".",
"ClusterDpmHostConfigInfo",
",",
"error",
")",
"{",
"obj",
":=",
"&",
"types",
".",
"ClusterDpmHostConfigInfo",
"{",
"Behavior",
":",
"types",
".",
"DpmBehavior",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
")",
",",
"Enabled",
":",
"structure",
".",
"GetBool",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"Key",
":",
"host",
".",
"Reference",
"(",
")",
",",
"}",
"\n\n",
"return",
"obj",
",",
"nil",
"\n",
"}"
] |
871 | all-872 | [
"QueryChildPacking",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_box_query_child_packing",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Box",
")",
"QueryChildPacking",
"(",
"child",
"IWidget",
")",
"(",
"expand",
",",
"fill",
"bool",
",",
"padding",
"uint",
",",
"packType",
"PackType",
")",
"{",
"var",
"cexpand",
",",
"cfill",
"C",
".",
"gboolean",
"\n",
"<mask>",
"cpadding",
"C",
".",
"guint",
"\n",
"var",
"cpackType",
"C",
".",
"GtkPackType",
"\n\n",
"C",
".",
"gtk_box_query_child_packing",
"(",
"v",
".",
"native",
"(",
")",
",",
"child",
".",
"toWidget",
"(",
")",
",",
"&",
"cexpand",
",",
"&",
"cfill",
",",
"&",
"cpadding",
",",
"&",
"cpackType",
")",
"\n",
"return",
"gobool",
"(",
"cexpand",
")",
",",
"gobool",
"(",
"cfill",
")",
",",
"uint",
"(",
"cpadding",
")",
",",
"PackType",
"(",
"cpackType",
")",
"\n",
"}"
] |
872 | all-873 | [
"ListenIP",
"returns",
"the",
"IP",
"to",
"bind",
"to",
"in",
"Listen",
".",
"It",
"tries",
"to",
"find",
"an",
"IP",
"that",
"can",
"be",
"used",
"by",
"other",
"machines",
"to",
"reach",
"this",
"machine",
"."
] | [
"func",
"ListenIP",
"(",
")",
"(",
"<mask>",
".",
"IP",
",",
"error",
")",
"{",
"interfaces",
",",
"err",
":=",
"net",
".",
"Interfaces",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"listenIP",
"(",
"interfaces",
")",
"\n",
"}"
] |
873 | all-874 | [
"SetDesiredStatus",
"safely",
"sets",
"the",
"desired",
"status",
"of",
"the",
"resource"
] | [
"func",
"(",
"vol",
"*",
"VolumeResource",
")",
"SetDesiredStatus",
"(",
"status",
"resourcestatus",
".",
"ResourceStatus",
")",
"{",
"vol",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"vol",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"vol",
".",
"desiredStatusUnsafe",
"=",
"<mask>",
"\n",
"}"
] |
874 | all-875 | [
"handle",
"reads",
"the",
"request",
"and",
"writes",
"the",
"response"
] | [
"func",
"handle",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"<mask>",
")",
"{",
"req",
",",
"err",
":=",
"readRequest",
"(",
"r",
".",
"Body",
",",
"r",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"writeResponse",
"(",
"*",
"req",
",",
"w",
",",
"onlyUpdateStatus",
")",
";",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
875 | all-876 | [
"Clear",
"empties",
"the",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"<mask>",
")",
"Clear",
"(",
")",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"s",
".",
"m",
"=",
"make",
"(",
"map",
"[",
"interface",
"{",
"}",
"]",
"struct",
"{",
"}",
")",
"\n",
"}"
] |
876 | all-877 | [
"xep",
"-",
"0045",
"7",
".",
"2",
".",
"6"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"JoinProtectedMUC",
"(",
"jid",
",",
"nick",
"string",
",",
"password",
"string",
",",
"history_type",
",",
"history",
"int",
",",
"history_date",
"*",
"time",
".",
"Time",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"if",
"nick",
"==",
"\"",
"\"",
"{",
"nick",
"=",
"c",
".",
"jid",
"\n",
"}",
"\n",
"switch",
"history_type",
"{",
"case",
"NoHistory",
":",
"return",
"fmt",
".",
"Fprintf",
"(",
"c",
".",
"conn",
",",
"\"",
"\\n",
"\"",
"+",
"\"",
"\\n",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\\n",
"\"",
"+",
"\"",
"\"",
",",
"xmlEscape",
"(",
"jid",
")",
",",
"xmlEscape",
"(",
"nick",
")",
",",
"nsMUC",
",",
"xmlEscape",
"(",
"password",
")",
")",
"\n",
"case",
"CharHistory",
":",
"return",
"fmt",
".",
"Fprintf",
"(",
"c",
".",
"conn",
",",
"\"",
"\\n",
"\"",
"+",
"\"",
"\\n",
"\"",
"+",
"\"",
"\\n",
"\"",
"+",
"\"",
"\\n",
"\"",
"+",
"\"",
"\"",
",",
"xmlEscape",
"(",
"jid",
")",
",",
"xmlEscape",
"(",
"nick",
")",
",",
"nsMUC",
",",
"xmlEscape",
"(",
"password",
")",
",",
"history",
")",
"\n",
"case",
"StanzaHistory",
":",
"return",
"fmt",
".",
"Fprintf",
"(",
"c",
".",
"conn",
",",
"\"",
"\\n",
"\"",
"+",
"\"",
"\\n",
"\"",
"+",
"\"",
"\\n",
"\"",
"+",
"\"",
"\\n",
"\"",
"+",
"\"",
"\"",
",",
"xmlEscape",
"(",
"jid",
")",
",",
"xmlEscape",
"(",
"nick",
")",
",",
"nsMUC",
",",
"xmlEscape",
"(",
"password",
")",
",",
"history",
")",
"\n",
"<mask>",
"SecondsHistory",
":",
"return",
"fmt",
".",
"Fprintf",
"(",
"c",
".",
"conn",
",",
"\"",
"\\n",
"\"",
"+",
"\"",
"\\n",
"\"",
"+",
"\"",
"\\n",
"\"",
"+",
"\"",
"\\n",
"\"",
"+",
"\"",
"\"",
",",
"xmlEscape",
"(",
"jid",
")",
",",
"xmlEscape",
"(",
"nick",
")",
",",
"nsMUC",
",",
"xmlEscape",
"(",
"password",
")",
",",
"history",
")",
"\n",
"case",
"SinceHistory",
":",
"if",
"history_date",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Fprintf",
"(",
"c",
".",
"conn",
",",
"\"",
"\\n",
"\"",
"+",
"\"",
"\\n",
"\"",
"+",
"\"",
"\\n",
"\"",
"+",
"\"",
"\\n",
"\"",
"+",
"\"",
"\"",
",",
"xmlEscape",
"(",
"jid",
")",
",",
"xmlEscape",
"(",
"nick",
")",
",",
"nsMUC",
",",
"xmlEscape",
"(",
"password",
")",
",",
"history_date",
".",
"Format",
"(",
"time",
".",
"RFC3339",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"0",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
877 | all-878 | [
"BreadthMatchAll",
"performs",
"a",
"breadth",
"first",
"search",
"of",
"the",
"Part",
"tree",
"and",
"returns",
"all",
"parts",
"that",
"cause",
"the",
"given",
"matcher",
"to",
"return",
"true"
] | [
"func",
"(",
"p",
"*",
"Part",
")",
"BreadthMatchAll",
"(",
"matcher",
"PartMatcher",
")",
"[",
"]",
"*",
"Part",
"{",
"q",
":=",
"<mask>",
".",
"New",
"(",
")",
"\n",
"q",
".",
"PushBack",
"(",
"p",
")",
"\n\n",
"matches",
":=",
"make",
"(",
"[",
"]",
"*",
"Part",
",",
"0",
",",
"10",
")",
"\n\n",
"// Push children onto queue and attempt to match in that order",
"for",
"q",
".",
"Len",
"(",
")",
">",
"0",
"{",
"e",
":=",
"q",
".",
"Front",
"(",
")",
"\n",
"p",
":=",
"e",
".",
"Value",
".",
"(",
"*",
"Part",
")",
"\n",
"if",
"matcher",
"(",
"p",
")",
"{",
"matches",
"=",
"append",
"(",
"matches",
",",
"p",
")",
"\n",
"}",
"\n",
"q",
".",
"Remove",
"(",
"e",
")",
"\n",
"c",
":=",
"p",
".",
"FirstChild",
"\n",
"for",
"c",
"!=",
"nil",
"{",
"q",
".",
"PushBack",
"(",
"c",
")",
"\n",
"c",
"=",
"c",
".",
"NextSibling",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"matches",
"\n",
"}"
] |
878 | all-879 | [
"Also",
"for",
"arrays",
"."
] | [
"func",
"copySliceToTable",
"(",
"L",
"*",
"lua",
".",
"State",
",",
"v",
"reflect",
".",
"Value",
",",
"visited",
"visitor",
")",
"{",
"vp",
":=",
"v",
"\n",
"for",
"v",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Ptr",
"{",
"// For arrays.",
"v",
"=",
"v",
".",
"Elem",
"(",
")",
"\n",
"}",
"\n\n",
"n",
":=",
"v",
".",
"Len",
"(",
")",
"\n",
"L",
".",
"CreateTable",
"(",
"n",
",",
"0",
")",
"\n",
"if",
"v",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Slice",
"{",
"visited",
".",
"mark",
"(",
"v",
")",
"\n",
"}",
"else",
"if",
"vp",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Ptr",
"{",
"visited",
".",
"<mask>",
"(",
"vp",
")",
"\n",
"}",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
"{",
"L",
".",
"PushInteger",
"(",
"int64",
"(",
"i",
"+",
"1",
")",
")",
"\n",
"val",
":=",
"v",
".",
"Index",
"(",
"i",
")",
"\n",
"if",
"isNil",
"(",
"val",
")",
"{",
"val",
"=",
"nullv",
"\n",
"}",
"\n",
"goToLua",
"(",
"L",
",",
"val",
",",
"false",
",",
"visited",
")",
"\n",
"L",
".",
"SetTable",
"(",
"-",
"3",
")",
"\n",
"}",
"\n",
"}"
] |
879 | all-880 | [
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"ManageDataResultCode"
] | [
"func",
"(",
"e",
"ManageDataResultCode",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"<mask>",
":=",
"manageDataResultCodeMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
880 | all-881 | [
"NewOutgoingUnbanChatMember",
"creates",
"a",
"request",
"to",
"unban",
"a",
"member",
"of",
"a",
"group",
"chat",
"or",
"channel",
"."
] | [
"func",
"(",
"api",
"*",
"TelegramBotAPI",
")",
"NewOutgoingUnbanChatMember",
"(",
"chat",
"Recipient",
",",
"userID",
"int",
")",
"*",
"OutgoingUnbanChatMember",
"{",
"<mask>",
"&",
"OutgoingUnbanChatMember",
"{",
"api",
":",
"api",
",",
"Recipient",
":",
"chat",
",",
"UserID",
":",
"userID",
",",
"}",
"\n",
"}"
] |
881 | all-882 | [
"Write",
"writes",
"a",
"line",
"to",
"the",
"tabwriter",
"."
] | [
"func",
"(",
"w",
"*",
"Writer",
")",
"Write",
"(",
"buf",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"w",
".",
"lines",
">=",
"termHeight",
"{",
"if",
"err",
":=",
"w",
".",
"Flush",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"w",
".",
"w",
".",
"Write",
"(",
"w",
".",
"header",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"w",
".",
"lines",
"++",
"\n",
"}",
"\n",
"w",
".",
"<mask>",
"+=",
"bytes",
".",
"Count",
"(",
"buf",
",",
"[",
"]",
"byte",
"{",
"'\\n'",
"}",
")",
"\n",
"return",
"w",
".",
"w",
".",
"Write",
"(",
"buf",
")",
"\n",
"}"
] |
882 | all-883 | [
"Size",
"sets",
"the",
"current",
"page",
"size",
"in",
"pixels",
"."
] | [
"func",
"(",
"p",
"*",
"Page",
")",
"Size",
"(",
"width",
",",
"height",
"int",
")",
"error",
"{",
"window",
",",
"err",
":=",
"p",
".",
"session",
".",
"GetWindow",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"<mask>",
".",
"SetSize",
"(",
"width",
",",
"height",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
883 | all-884 | [
"CheckAuth",
"validates",
"the",
"credentials",
"by",
"attempting",
"to",
"log",
"into",
"the",
"registry",
"returns",
"an",
"error",
"if",
"an",
"error",
"occurred",
"while",
"making",
"the",
"http",
"request",
"or",
"the",
"status",
"code",
"received",
"was",
"401"
] | [
"func",
"CheckAuth",
"(",
"ctx",
"context",
".",
"Context",
",",
"sys",
"*",
"types",
".",
"SystemContext",
",",
"username",
",",
"password",
",",
"registry",
"string",
")",
"error",
"{",
"client",
",",
"err",
":=",
"newDockerClient",
"(",
"sys",
",",
"registry",
",",
"registry",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"client",
".",
"username",
"=",
"username",
"\n",
"client",
".",
"password",
"=",
"password",
"\n\n",
"resp",
",",
"err",
":=",
"client",
".",
"makeRequest",
"(",
"ctx",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"nil",
",",
"v2Auth",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n\n",
"switch",
"resp",
".",
"StatusCode",
"{",
"<mask>",
"http",
".",
"StatusOK",
":",
"return",
"nil",
"\n",
"case",
"http",
".",
"StatusUnauthorized",
":",
"return",
"ErrUnauthorizedForCredentials",
"\n",
"default",
":",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"resp",
".",
"StatusCode",
",",
"http",
".",
"StatusText",
"(",
"resp",
".",
"StatusCode",
")",
")",
"\n",
"}",
"\n",
"}"
] |
884 | all-885 | [
"print",
"log",
"in",
"console",
"default",
"log",
"string",
"wont",
"be",
"print",
"in",
"console",
"NOTICE",
":",
"when",
"console",
"is",
"on",
"the",
"process",
"will",
"really",
"slowly"
] | [
"func",
"(",
"f",
"*",
"FileLogger",
")",
"pc",
"(",
"str",
"string",
")",
"{",
"if",
"f",
".",
"logConsole",
"{",
"if",
"log",
".",
"Prefix",
"(",
")",
"!=",
"f",
".",
"prefix",
"{",
"log",
".",
"SetPrefix",
"(",
"f",
".",
"<mask>",
")",
"\n",
"}",
"\n",
"log",
".",
"Println",
"(",
"str",
")",
"\n",
"}",
"\n",
"}"
] |
885 | all-886 | [
"Create",
"a",
"phone",
"number",
"(",
"buy",
"a",
"number",
")",
"with",
"the",
"given",
"values",
".",
"https",
":",
"//",
"www",
".",
"twilio",
".",
"com",
"/",
"docs",
"/",
"api",
"/",
"rest",
"/",
"incoming",
"-",
"phone",
"-",
"numbers#toll",
"-",
"free",
"-",
"incomingphonenumber",
"-",
"factory",
"-",
"resource"
] | [
"func",
"(",
"n",
"*",
"NumberPurchasingService",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"data",
"<mask>",
".",
"Values",
")",
"(",
"*",
"IncomingPhoneNumber",
",",
"error",
")",
"{",
"number",
":=",
"new",
"(",
"IncomingPhoneNumber",
")",
"\n",
"pathPart",
":=",
"numbersPathPart",
"\n",
"if",
"n",
".",
"pathPart",
"!=",
"\"",
"\"",
"{",
"pathPart",
"+=",
"\"",
"\"",
"+",
"n",
".",
"pathPart",
"\n",
"}",
"\n",
"err",
":=",
"n",
".",
"client",
".",
"CreateResource",
"(",
"ctx",
",",
"pathPart",
",",
"data",
",",
"number",
")",
"\n",
"return",
"number",
",",
"err",
"\n",
"}"
] |
886 | all-887 | [
"rotateFile",
"closes",
"the",
"syncBuffer",
"s",
"file",
"and",
"starts",
"a",
"new",
"one",
"."
] | [
"func",
"(",
"sb",
"*",
"syncBuffer",
")",
"rotateFile",
"(",
"now",
"time",
".",
"Time",
")",
"error",
"{",
"if",
"sb",
".",
"file",
"!=",
"nil",
"{",
"sb",
".",
"Flush",
"(",
")",
"\n",
"sb",
".",
"file",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"var",
"err",
"error",
"\n",
"sb",
".",
"file",
",",
"_",
",",
"err",
"=",
"sb",
".",
"logger",
".",
"create",
"(",
"severityName",
"[",
"sb",
".",
"sev",
"]",
",",
"now",
")",
"\n",
"sb",
".",
"nbytes",
"=",
"0",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"sb",
".",
"Writer",
"=",
"bufio",
".",
"NewWriterSize",
"(",
"sb",
".",
"file",
",",
"bufferSize",
")",
"\n\n",
"// Write header.",
"var",
"buf",
"<mask>",
".",
"Buffer",
"\n",
"fmt",
".",
"Fprintf",
"(",
"&",
"buf",
",",
"\"",
"\\n",
"\"",
",",
"now",
".",
"Format",
"(",
"\"",
"\"",
")",
")",
"\n",
"fmt",
".",
"Fprintf",
"(",
"&",
"buf",
",",
"\"",
"\\n",
"\"",
",",
"host",
")",
"\n",
"fmt",
".",
"Fprintf",
"(",
"&",
"buf",
",",
"\"",
"\\n",
"\"",
",",
"runtime",
".",
"Compiler",
",",
"runtime",
".",
"Version",
"(",
")",
",",
"runtime",
".",
"GOOS",
",",
"runtime",
".",
"GOARCH",
")",
"\n",
"fmt",
".",
"Fprintf",
"(",
"&",
"buf",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"n",
",",
"err",
":=",
"sb",
".",
"file",
".",
"Write",
"(",
"buf",
".",
"Bytes",
"(",
")",
")",
"\n",
"sb",
".",
"nbytes",
"+=",
"uint64",
"(",
"n",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
887 | all-888 | [
"NewMongoStore",
"创建敏感词MongoDB存储"
] | [
"func",
"NewMongoStore",
"(",
"config",
"MongoConfig",
")",
"(",
"*",
"MongoStore",
",",
"error",
")",
"{",
"var",
"session",
"*",
"mgo",
".",
"Session",
"\n",
"if",
"config",
".",
"URL",
"!=",
"\"",
"\"",
"{",
"s",
",",
"err",
":=",
"mgo",
".",
"Dial",
"(",
"config",
".",
"URL",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"session",
"=",
"s",
"\n",
"}",
"else",
"if",
"config",
".",
"Session",
"!=",
"nil",
"{",
"session",
"=",
"config",
".",
"Session",
"\n",
"}",
"else",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"",
"",
"\n",
"}",
"\n",
"if",
"config",
".",
"Collection",
"==",
"\"",
"\"",
"{",
"config",
".",
"Collection",
"=",
"DefaultCollection",
"\n",
"}",
"\n",
"return",
"&",
"MongoStore",
"{",
"config",
":",
"config",
",",
"session",
":",
"<mask>",
",",
"lg",
":",
"log",
".",
"New",
"(",
"os",
".",
"Stdout",
",",
"\"",
"\"",
",",
"log",
".",
"LstdFlags",
")",
",",
"}",
",",
"nil",
"\n",
"}"
] |
888 | all-889 | [
"RenderView",
"renders",
"a",
"template",
"using",
"the",
"provided",
"template",
"and",
"vars",
"struct",
"and",
"returns",
"the",
"rendered",
"tamplate"
] | [
"func",
"RenderTemplate",
"(",
"t",
"*",
"template",
".",
"Template",
",",
"vars",
"interface",
"{",
"}",
")",
"[",
"]",
"byte",
"{",
"out",
":=",
"<mask>",
".",
"NewBuffer",
"(",
"nil",
")",
"\n",
"err",
":=",
"t",
".",
"Execute",
"(",
"out",
",",
"vars",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"out",
".",
"Bytes",
"(",
")",
"\n",
"}"
] |
889 | all-890 | [
"New",
"creates",
"a",
"new",
"Err",
"with",
"the",
"given",
"Info",
"and",
"optional",
"public",
"message"
] | [
"func",
"New",
"(",
"info",
"Info",
",",
"publicMsg",
"...",
"interface",
"{",
"}",
")",
"Err",
"{",
"return",
"newErr",
"(",
"<mask>",
".",
"Stack",
"(",
")",
",",
"nil",
",",
"false",
",",
"info",
",",
"publicMsg",
")",
"\n",
"}"
] |
890 | all-891 | [
"NewController",
"returns",
"a",
"new",
"Controller",
"using",
"the",
"specific",
"MAAS",
"server",
"and",
"machine"
] | [
"func",
"NewController",
"(",
"<mask>",
"string",
",",
"key",
"string",
",",
"machine",
"string",
")",
"(",
"*",
"Controller",
",",
"error",
")",
"{",
"baseURL",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
")",
"\n\n",
"// Connect to MAAS",
"srv",
",",
"err",
":=",
"gomaasapi",
".",
"NewController",
"(",
"gomaasapi",
".",
"ControllerArgs",
"{",
"BaseURL",
":",
"baseURL",
",",
"APIKey",
":",
"key",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// Juju errors aren't user-friendly, try to extract what actually happened",
"if",
"!",
"strings",
".",
"Contains",
"(",
"err",
".",
"Error",
"(",
")",
",",
"\"",
"\"",
")",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"baseURL",
",",
"strings",
".",
"Split",
"(",
"strings",
".",
"Split",
"(",
"err",
".",
"Error",
"(",
")",
",",
"\"",
"\"",
")",
"[",
"1",
"]",
",",
"\"",
"\"",
")",
"[",
"0",
"]",
")",
"\n",
"}",
"\n\n",
"srvRaw",
",",
"err",
":=",
"gomaasapi",
".",
"NewAuthenticatedClient",
"(",
"baseURL",
",",
"key",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Find the right machine",
"machines",
",",
"err",
":=",
"srv",
".",
"Machines",
"(",
"gomaasapi",
".",
"MachinesArgs",
"{",
"Hostnames",
":",
"[",
"]",
"string",
"{",
"machine",
"}",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"machines",
")",
"!=",
"1",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"machine",
")",
"\n",
"}",
"\n\n",
"// Setup the struct",
"c",
":=",
"Controller",
"{",
"}",
"\n",
"c",
".",
"srv",
"=",
"srv",
"\n",
"c",
".",
"srvRaw",
"=",
"*",
"srvRaw",
"\n",
"c",
".",
"machine",
"=",
"machines",
"[",
"0",
"]",
"\n",
"c",
".",
"url",
"=",
"baseURL",
"\n\n",
"return",
"&",
"c",
",",
"err",
"\n",
"}"
] |
891 | all-892 | [
"GetQuery",
"returns",
"the",
"Query",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"g",
"*",
"GraphEvent",
")",
"GetQuery",
"(",
")",
"string",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"Query",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"<mask>",
"\n",
"}"
] |
892 | all-893 | [
"GetLiveSpanOk",
"returns",
"a",
"tuple",
"with",
"the",
"LiveSpan",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"Time",
")",
"GetLiveSpanOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"LiveSpan",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"LiveSpan",
",",
"true",
"\n",
"}"
] |
893 | all-894 | [
"DiskDestroyOperation",
"process",
"the",
"destroy",
"operation",
"for",
"virtual",
"disks",
".",
"Disks",
"are",
"the",
"only",
"real",
"operation",
"that",
"require",
"special",
"destroy",
"logic",
"and",
"that",
"s",
"because",
"we",
"want",
"to",
"check",
"to",
"make",
"sure",
"that",
"we",
"detach",
"any",
"disks",
"that",
"need",
"to",
"be",
"simply",
"detached",
"(",
"not",
"deleted",
")",
"before",
"we",
"destroy",
"the",
"entire",
"virtual",
"machine",
"as",
"that",
"would",
"take",
"those",
"disks",
"with",
"it",
"."
] | [
"func",
"DiskDestroyOperation",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"c",
"*",
"govmomi",
".",
"<mask>",
",",
"l",
"object",
".",
"VirtualDeviceList",
")",
"(",
"[",
"]",
"types",
".",
"BaseVirtualDeviceConfigSpec",
",",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"// All we are doing here is getting a config spec for detaching the disks",
"// that we need to detach, so we don't need the vast majority of the stateful",
"// logic that is in deviceApplyOperation.",
"ds",
":=",
"d",
".",
"Get",
"(",
"subresourceTypeDisk",
")",
".",
"(",
"[",
"]",
"interface",
"{",
"}",
")",
"\n\n",
"var",
"spec",
"[",
"]",
"types",
".",
"BaseVirtualDeviceConfigSpec",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"for",
"oi",
",",
"oe",
":=",
"range",
"ds",
"{",
"m",
":=",
"oe",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"if",
"!",
"m",
"[",
"\"",
"\"",
"]",
".",
"(",
"bool",
")",
"&&",
"!",
"m",
"[",
"\"",
"\"",
"]",
".",
"(",
"bool",
")",
"{",
"// We don't care about disks we haven't set to keep",
"continue",
"\n",
"}",
"\n",
"r",
":=",
"NewDiskSubresource",
"(",
"c",
",",
"d",
",",
"m",
",",
"nil",
",",
"oi",
")",
"\n",
"dspec",
",",
"err",
":=",
"r",
".",
"Delete",
"(",
"l",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"r",
".",
"Addr",
"(",
")",
",",
"err",
")",
"\n",
"}",
"\n",
"l",
"=",
"applyDeviceChange",
"(",
"l",
",",
"dspec",
")",
"\n",
"spec",
"=",
"append",
"(",
"spec",
",",
"dspec",
"...",
")",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"DeviceChangeString",
"(",
"spec",
")",
")",
"\n",
"return",
"spec",
",",
"nil",
"\n",
"}"
] |
894 | all-895 | [
"Dbgm",
"is",
"a",
"short",
"-",
"hand",
"version",
"of",
"Debugm"
] | [
"func",
"(",
"la",
"*",
"LogAdapter",
")",
"Dbgm",
"(",
"m",
"*",
"Attrs",
",",
"msg",
"string",
",",
"a",
"...",
"<mask>",
"{",
"}",
")",
"error",
"{",
"return",
"la",
".",
"Debugm",
"(",
"m",
",",
"msg",
",",
"a",
"...",
")",
"\n",
"}"
] |
895 | all-896 | [
"TreePathNewFromString",
"is",
"a",
"wrapper",
"around",
"gtk_tree_path_new_from_string",
"()",
"."
] | [
"func",
"TreePathNewFromString",
"(",
"path",
"string",
")",
"(",
"*",
"TreePath",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"path",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_tree_path_new_from_string",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"t",
":=",
"&",
"TreePath",
"{",
"c",
"}",
"\n",
"runtime",
".",
"SetFinalizer",
"(",
"t",
",",
"(",
"*",
"TreePath",
")",
".",
"free",
")",
"\n",
"return",
"t",
",",
"nil",
"\n",
"}"
] |
896 | all-897 | [
"GetExtensions",
"is",
"a",
"wrapper",
"around",
"gdk_pixbuf_format_get_extensions",
"()",
"."
] | [
"func",
"(",
"f",
"*",
"PixbufFormat",
")",
"GetExtensions",
"(",
")",
"[",
"]",
"string",
"{",
"var",
"extensions",
"[",
"]",
"string",
"\n",
"c",
":=",
"C",
".",
"gdk_pixbuf_format_get_extensions",
"(",
"f",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"for",
"*",
"c",
"!=",
"nil",
"{",
"extensions",
"=",
"<mask>",
"(",
"extensions",
",",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"*",
"c",
")",
")",
")",
"\n",
"c",
"=",
"C",
".",
"next_gcharptr",
"(",
"c",
")",
"\n",
"}",
"\n",
"return",
"extensions",
"\n",
"}"
] |
897 | all-898 | [
"NewAppInformer",
"constructs",
"a",
"new",
"informer",
"for",
"App",
"type",
".",
"Always",
"prefer",
"using",
"an",
"informer",
"factory",
"to",
"get",
"a",
"shared",
"informer",
"instead",
"of",
"getting",
"an",
"independent",
"one",
".",
"This",
"reduces",
"memory",
"footprint",
"and",
"number",
"of",
"connections",
"to",
"the",
"server",
"."
] | [
"func",
"NewAppInformer",
"(",
"client",
"versioned",
".",
"Interface",
",",
"namespace",
"string",
",",
"resyncPeriod",
"time",
".",
"Duration",
",",
"indexers",
"<mask>",
".",
"Indexers",
")",
"cache",
".",
"SharedIndexInformer",
"{",
"return",
"NewFilteredAppInformer",
"(",
"client",
",",
"namespace",
",",
"resyncPeriod",
",",
"indexers",
",",
"nil",
")",
"\n",
"}"
] |
898 | all-899 | [
"commandsForPullRefs",
"returns",
"the",
"list",
"of",
"commands",
"needed",
"to",
"fetch",
"and",
"merge",
"any",
"pull",
"refs",
"as",
"well",
"as",
"submodules",
".",
"These",
"commands",
"should",
"be",
"run",
"only",
"after",
"the",
"commands",
"provided",
"by",
"commandsForBaseRef",
"have",
"been",
"run",
"successfully",
".",
"Each",
"merge",
"commit",
"will",
"be",
"created",
"at",
"sequential",
"seconds",
"after",
"fakeTimestamp",
".",
"It",
"s",
"recommended",
"that",
"fakeTimestamp",
"be",
"set",
"to",
"the",
"timestamp",
"of",
"the",
"base",
"ref",
".",
"This",
"enables",
"reproducible",
"timestamps",
"and",
"git",
"tree",
"digests",
"every",
"time",
"the",
"same",
"set",
"of",
"base",
"and",
"pull",
"refs",
"are",
"used",
"."
] | [
"func",
"(",
"g",
"*",
"gitCtx",
")",
"commandsForPullRefs",
"(",
"refs",
"prowapi",
".",
"Refs",
",",
"fakeTimestamp",
"int",
")",
"[",
"]",
"cloneCommand",
"{",
"var",
"commands",
"[",
"]",
"cloneCommand",
"\n",
"for",
"_",
",",
"prRef",
":=",
"range",
"refs",
".",
"Pulls",
"{",
"ref",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"prRef",
".",
"Number",
")",
"\n",
"if",
"prRef",
".",
"Ref",
"!=",
"\"",
"\"",
"{",
"ref",
"=",
"prRef",
".",
"Ref",
"\n",
"}",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"g",
".",
"gitCommand",
"(",
"\"",
"\"",
",",
"g",
".",
"repositoryURI",
",",
"<mask>",
")",
")",
"\n",
"var",
"prCheckout",
"string",
"\n",
"if",
"prRef",
".",
"SHA",
"!=",
"\"",
"\"",
"{",
"prCheckout",
"=",
"prRef",
".",
"SHA",
"\n",
"}",
"else",
"{",
"prCheckout",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"fakeTimestamp",
"++",
"\n",
"gitMergeCommand",
":=",
"g",
".",
"gitCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"prCheckout",
")",
"\n",
"gitMergeCommand",
".",
"env",
"=",
"append",
"(",
"gitMergeCommand",
".",
"env",
",",
"gitTimestampEnvs",
"(",
"fakeTimestamp",
")",
"...",
")",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"gitMergeCommand",
")",
"\n",
"}",
"\n\n",
"// unless the user specifically asks us not to, init submodules",
"if",
"!",
"refs",
".",
"SkipSubmodules",
"{",
"commands",
"=",
"append",
"(",
"commands",
",",
"g",
".",
"gitCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"return",
"commands",
"\n",
"}"
] |
899 | all-900 | [
"SetMode",
"sets",
"glg",
"logging",
"mode"
] | [
"func",
"(",
"g",
"*",
"Glg",
")",
"SetMode",
"(",
"mode",
"MODE",
")",
"*",
"Glg",
"{",
"g",
".",
"logger",
".",
"Range",
"(",
"func",
"(",
"key",
",",
"val",
"<mask>",
"{",
"}",
")",
"bool",
"{",
"l",
":=",
"val",
".",
"(",
"*",
"logger",
")",
"\n",
"l",
".",
"mode",
"=",
"mode",
"\n",
"l",
".",
"updateMode",
"(",
")",
"\n",
"g",
".",
"logger",
".",
"Store",
"(",
"key",
".",
"(",
"LEVEL",
")",
",",
"l",
")",
"\n",
"return",
"true",
"\n",
"}",
")",
"\n\n",
"return",
"g",
"\n",
"}"
] |
Subsets and Splits