id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
17,900 | all-17901 | [
"ProtectedFieldsValidator",
"compares",
"protected",
"fields",
"against",
"their",
"default",
"during",
"Create",
"(",
"if",
"provided",
")",
"or",
"stored",
"value",
"during",
"Update",
"and",
"returns",
"an",
"error",
"if",
"they",
"have",
"been",
"changed",
".",
"Protected",
"fields",
"are",
"defined",
"by",
"passing",
"pairs",
"of",
"fields",
"and",
"default",
"values",
":",
"fire",
".",
"ProtectedFieldsValidator",
"(",
"map",
"[",
"string",
"]",
"interface",
"{}",
"{",
"Title",
":",
"NoDefault",
"//",
"can",
"only",
"be",
"set",
"during",
"Create",
"Link",
":",
"//",
"default",
"is",
"fixed",
"and",
"cannot",
"be",
"changed",
"}",
")",
"The",
"special",
"NoDefault",
"value",
"can",
"be",
"provided",
"to",
"skip",
"the",
"default",
"enforcement",
"on",
"Create",
"."
]
| [
"func",
"ProtectedFieldsValidator",
"(",
"pairs",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"*",
"Callback",
"{",
"return",
"C",
"(",
"\"",
"\"",
",",
"Only",
"(",
"Create",
",",
"Update",
")",
",",
"func",
"(",
"ctx",
"*",
"Context",
")",
"error",
"{",
"// handle resource creation",
"if",
"ctx",
".",
"Operation",
"==",
"Create",
"{",
"// check all fields",
"for",
"field",
",",
"def",
":=",
"range",
"pairs",
"{",
"// skip fields that have no default",
"if",
"def",
"==",
"NoDefault",
"{",
"continue",
"\n",
"}",
"\n\n",
"// check equality",
"if",
"!",
"reflect",
".",
"DeepEqual",
"(",
"ctx",
".",
"Model",
".",
"MustGet",
"(",
"field",
")",
",",
"def",
")",
"{",
"return",
"E",
"(",
"\"",
"\"",
"+",
"field",
"+",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"// handle resource updates",
"if",
"ctx",
".",
"Operation",
"==",
"Update",
"{",
"// read the original",
"original",
",",
"err",
":=",
"ctx",
".",
"Original",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// check all fields",
"for",
"field",
":=",
"range",
"pairs",
"{",
"// check equality",
"if",
"!",
"reflect",
".",
"DeepEqual",
"(",
"ctx",
".",
"<mask>",
".",
"MustGet",
"(",
"field",
")",
",",
"original",
".",
"MustGet",
"(",
"field",
")",
")",
"{",
"return",
"E",
"(",
"\"",
"\"",
"+",
"field",
"+",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
]
|
17,901 | all-17902 | [
"PutManifest",
"writes",
"manifest",
"to",
"the",
"destination",
".",
"FIXME?",
"This",
"should",
"also",
"receive",
"a",
"MIME",
"type",
"if",
"known",
"to",
"differentiate",
"between",
"schema",
"versions",
".",
"If",
"the",
"destination",
"is",
"in",
"principle",
"available",
"refuses",
"this",
"manifest",
"type",
"(",
"e",
".",
"g",
".",
"it",
"does",
"not",
"recognize",
"the",
"schema",
")",
"but",
"may",
"accept",
"a",
"different",
"manifest",
"type",
"the",
"returned",
"error",
"must",
"be",
"an",
"ManifestTypeRejectedError",
"."
]
| [
"func",
"(",
"d",
"*",
"openshiftImageDestination",
")",
"PutManifest",
"(",
"ctx",
"context",
".",
"Context",
",",
"m",
"[",
"]",
"byte",
")",
"error",
"{",
"manifestDigest",
",",
"err",
":=",
"manifest",
".",
"Digest",
"(",
"m",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"d",
".",
"imageStreamImageName",
"=",
"manifestDigest",
".",
"<mask>",
"(",
")",
"\n\n",
"return",
"d",
".",
"docker",
".",
"PutManifest",
"(",
"ctx",
",",
"m",
")",
"\n",
"}"
]
|
17,902 | all-17903 | [
"native",
"()",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GMenuItem",
"."
]
| [
"func",
"(",
"m",
"*",
"MenuItem",
")",
"native",
"(",
")",
"*",
"C",
".",
"GMenuItem",
"{",
"if",
"m",
"==",
"nil",
"||",
"m",
".",
"GObject",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"p",
":=",
"unsafe",
".",
"Pointer",
"(",
"m",
".",
"GObject",
")",
"\n",
"<mask>",
"C",
".",
"toGMenuItem",
"(",
"p",
")",
"\n",
"}"
]
|
17,903 | all-17904 | [
"loadEntity",
"loads",
"an",
"EntityProto",
"into",
"PropertyLoadSaver",
"or",
"struct",
"pointer",
"."
]
| [
"func",
"loadEntity",
"(",
"dst",
"interface",
"{",
"}",
",",
"src",
"*",
"pb",
".",
"EntityProto",
")",
"(",
"err",
"error",
")",
"{",
"ent",
",",
"err",
":=",
"protoToEntity",
"(",
"src",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"e",
",",
"ok",
":=",
"dst",
".",
"(",
"PropertyLoadSaver",
")",
";",
"<mask>",
"{",
"return",
"e",
".",
"Load",
"(",
"ent",
".",
"Properties",
")",
"\n",
"}",
"\n",
"return",
"LoadStruct",
"(",
"dst",
",",
"ent",
".",
"Properties",
")",
"\n",
"}"
]
|
17,904 | all-17905 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object"
]
| [
"func",
"Uniform2fv",
"(",
"location",
"int32",
",",
"count",
"int32",
",",
"value",
"*",
"float32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpUniform2fv",
",",
"3",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
]
|
17,905 | all-17906 | [
"GetBlob",
"returns",
"a",
"stream",
"for",
"the",
"specified",
"blob",
"and",
"the",
"blob’s",
"size",
"(",
"or",
"-",
"1",
"if",
"unknown",
")",
".",
"The",
"Digest",
"field",
"in",
"BlobInfo",
"is",
"guaranteed",
"to",
"be",
"provided",
"Size",
"may",
"be",
"-",
"1",
"and",
"MediaType",
"may",
"be",
"optionally",
"provided",
".",
"May",
"update",
"BlobInfoCache",
"preferably",
"after",
"it",
"knows",
"for",
"certain",
"that",
"a",
"blob",
"truly",
"exists",
"at",
"a",
"specific",
"location",
"."
]
| [
"func",
"(",
"s",
"*",
"dockerImageSource",
")",
"GetBlob",
"(",
"ctx",
"context",
".",
"Context",
",",
"info",
"types",
".",
"BlobInfo",
",",
"cache",
"types",
".",
"BlobInfoCache",
")",
"(",
"<mask>",
".",
"ReadCloser",
",",
"int64",
",",
"error",
")",
"{",
"if",
"len",
"(",
"info",
".",
"URLs",
")",
"!=",
"0",
"{",
"return",
"s",
".",
"getExternalBlob",
"(",
"ctx",
",",
"info",
".",
"URLs",
")",
"\n",
"}",
"\n\n",
"path",
":=",
"fmt",
".",
"Sprintf",
"(",
"blobsPath",
",",
"reference",
".",
"Path",
"(",
"s",
".",
"ref",
".",
"ref",
")",
",",
"info",
".",
"Digest",
".",
"String",
"(",
")",
")",
"\n",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"path",
")",
"\n",
"res",
",",
"err",
":=",
"s",
".",
"c",
".",
"makeRequest",
"(",
"ctx",
",",
"\"",
"\"",
",",
"path",
",",
"nil",
",",
"nil",
",",
"v2Auth",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"0",
",",
"err",
"\n",
"}",
"\n",
"if",
"res",
".",
"StatusCode",
"!=",
"http",
".",
"StatusOK",
"{",
"// print url also",
"return",
"nil",
",",
"0",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"res",
".",
"StatusCode",
",",
"http",
".",
"StatusText",
"(",
"res",
".",
"StatusCode",
")",
")",
"\n",
"}",
"\n",
"cache",
".",
"RecordKnownLocation",
"(",
"s",
".",
"ref",
".",
"Transport",
"(",
")",
",",
"bicTransportScope",
"(",
"s",
".",
"ref",
")",
",",
"info",
".",
"Digest",
",",
"newBICLocationReference",
"(",
"s",
".",
"ref",
")",
")",
"\n",
"return",
"res",
".",
"Body",
",",
"getBlobSize",
"(",
"res",
")",
",",
"nil",
"\n",
"}"
]
|
17,906 | all-17907 | [
"SendToAdmins",
"sends",
"an",
"email",
"message",
"to",
"the",
"application",
"s",
"administrators",
"."
]
| [
"func",
"SendToAdmins",
"(",
"c",
"context",
".",
"<mask>",
",",
"msg",
"*",
"Message",
")",
"error",
"{",
"return",
"send",
"(",
"c",
",",
"\"",
"\"",
",",
"msg",
")",
"\n",
"}"
]
|
17,907 | all-17908 | [
"Search",
"for",
"a",
"check",
"bundle",
"given",
"a",
"predetermined",
"set",
"of",
"criteria"
]
| [
"func",
"(",
"cm",
"*",
"CheckManager",
")",
"checkBundleSearch",
"(",
"criteria",
"string",
",",
"filter",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
")",
"(",
"*",
"api",
".",
"CheckBundle",
",",
"error",
")",
"{",
"search",
":=",
"api",
".",
"SearchQueryType",
"(",
"criteria",
")",
"\n",
"checkBundles",
",",
"err",
":=",
"cm",
".",
"apih",
".",
"SearchCheckBundles",
"(",
"&",
"search",
",",
"&",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"*",
"checkBundles",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"nil",
"// trigger creation of a new check",
"\n",
"}",
"\n\n",
"numActive",
":=",
"0",
"\n",
"checkID",
":=",
"-",
"1",
"\n\n",
"for",
"idx",
",",
"check",
":=",
"range",
"*",
"checkBundles",
"{",
"if",
"check",
".",
"Status",
"==",
"statusActive",
"{",
"numActive",
"++",
"\n",
"checkID",
"=",
"idx",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"numActive",
">",
"1",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"criteria",
")",
"\n",
"}",
"\n\n",
"bundle",
":=",
"(",
"*",
"checkBundles",
")",
"[",
"checkID",
"]",
"\n\n",
"return",
"&",
"bundle",
",",
"nil",
"\n",
"}"
]
|
17,908 | all-17909 | [
"recoverBackendSnapshot",
"recovers",
"the",
"DB",
"from",
"a",
"snapshot",
"in",
"case",
"etcd",
"crashes",
"before",
"updating",
"the",
"backend",
"db",
"after",
"persisting",
"raft",
"snapshot",
"to",
"disk",
"violating",
"the",
"invariant",
"snapshot",
".",
"Metadata",
".",
"Index",
"<",
"db",
".",
"consistentIndex",
".",
"In",
"this",
"case",
"replace",
"the",
"db",
"with",
"the",
"snapshot",
"db",
"sent",
"by",
"the",
"leader",
"."
]
| [
"func",
"recoverSnapshotBackend",
"(",
"cfg",
"ServerConfig",
",",
"oldbe",
"backend",
".",
"Backend",
",",
"snapshot",
"raftpb",
".",
"Snapshot",
")",
"(",
"backend",
".",
"Backend",
",",
"error",
")",
"{",
"<mask>",
"cIndex",
"consistentIndex",
"\n",
"kv",
":=",
"mvcc",
".",
"New",
"(",
"cfg",
".",
"Logger",
",",
"oldbe",
",",
"&",
"lease",
".",
"FakeLessor",
"{",
"}",
",",
"&",
"cIndex",
")",
"\n",
"defer",
"kv",
".",
"Close",
"(",
")",
"\n",
"if",
"snapshot",
".",
"Metadata",
".",
"Index",
"<=",
"kv",
".",
"ConsistentIndex",
"(",
")",
"{",
"return",
"oldbe",
",",
"nil",
"\n",
"}",
"\n",
"oldbe",
".",
"Close",
"(",
")",
"\n",
"return",
"openSnapshotBackend",
"(",
"cfg",
",",
"snap",
".",
"New",
"(",
"cfg",
".",
"Logger",
",",
"cfg",
".",
"SnapDir",
"(",
")",
")",
",",
"snapshot",
")",
"\n",
"}"
]
|
17,909 | all-17910 | [
"MakeRaw",
"put",
"the",
"terminal",
"connected",
"to",
"the",
"given",
"file",
"descriptor",
"into",
"raw",
"mode",
"and",
"returns",
"the",
"previous",
"state",
"of",
"the",
"terminal",
"so",
"that",
"it",
"can",
"be",
"restored",
"."
]
| [
"func",
"MakeRaw",
"(",
"fd",
"int",
")",
"(",
"*",
"State",
",",
"error",
")",
"{",
"<mask>",
",",
"err",
":=",
"terminal",
".",
"MakeRaw",
"(",
"fd",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"oldState",
":=",
"State",
"(",
"*",
"state",
")",
"\n",
"return",
"&",
"oldState",
",",
"nil",
"\n",
"}"
]
|
17,910 | all-17911 | [
"Return",
"true",
"if",
"the",
"input",
"word",
"is",
"a",
"French",
"stop",
"word",
"."
]
| [
"func",
"isStopWord",
"(",
"word",
"string",
")",
"bool",
"{",
"switch",
"<mask>",
"{",
"case",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"m",
",",
" ",
"m",
",",
" ",
"m",
",",
" ",
"n",
",",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"m",
",",
" ",
"n",
",",
" ",
"s",
",",
" ",
"t",
",",
" ",
"y",
",",
" ",
"é",
"",
"",
"\"",
" ",
"\"",
"t",
"é",
"t",
"s",
"a",
"n",
"\"",
"n",
"t",
"\"",
"t",
"s",
",",
"e",
"s",
",",
"",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"s",
",",
" ",
"s",
",",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"é",
"",
"",
"\"",
",",
" ",
"é",
" ",
"\"",
"t",
"\"",
"f",
"s",
"\"",
"f",
"t",
"\"",
"f",
"m",
"f",
"û",
"e",
"",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"f",
",",
" ",
"f",
",",
" ",
"f",
",",
" ",
"a",
",",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"e",
" ",
"\"",
"u",
" ",
"\"",
"i",
" ",
"\"",
"i",
"",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
":",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
]
|
17,911 | all-17912 | [
"AddFlags",
"adds",
"ignore",
"-",
"authors",
"<authors",
">",
"to",
"the",
"command",
"help"
]
| [
"func",
"(",
"a",
"*",
"AuthorFilterPluginWrapper",
")",
"AddFlags",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
")",
"{",
"cmd",
".",
"Flags",
"(",
")",
".",
"StringSliceVar",
"(",
"&",
"a",
".",
"ignoredAuthors",
",",
"\"",
"\"",
",",
"[",
"]",
"<mask>",
"{",
"}",
",",
"\"",
"\"",
")",
"\n",
"}"
]
|
17,912 | all-17913 | [
"Render",
"render",
"tmpl"
]
| [
"func",
"(",
"tmpl",
"*",
"Template",
")",
"Render",
"(",
"templateName",
"string",
",",
"obj",
"interface",
"{",
"}",
",",
"request",
"*",
"http",
".",
"Request",
",",
"writer",
"http",
".",
"ResponseWriter",
")",
"(",
"template",
".",
"HTML",
",",
"error",
")",
"{",
"<mask>",
"(",
"content",
"[",
"]",
"byte",
"\n",
"t",
"*",
"template",
".",
"Template",
"\n",
"err",
"error",
"\n",
"funcMap",
"=",
"tmpl",
".",
"funcMapMaker",
"(",
"request",
",",
"writer",
")",
"\n",
"render",
"=",
"func",
"(",
"name",
"string",
",",
"objs",
"...",
"interface",
"{",
"}",
")",
"(",
"template",
".",
"HTML",
",",
"error",
")",
"{",
"var",
"(",
"err",
"error",
"\n",
"renderObj",
"interface",
"{",
"}",
"\n",
"renderContent",
"[",
"]",
"byte",
"\n",
")",
"\n\n",
"if",
"len",
"(",
"objs",
")",
"==",
"0",
"{",
"// default obj",
"renderObj",
"=",
"obj",
"\n",
"}",
"else",
"{",
"// overwrite obj",
"for",
"_",
",",
"o",
":=",
"range",
"objs",
"{",
"renderObj",
"=",
"o",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"renderContent",
",",
"err",
"=",
"tmpl",
".",
"findTemplate",
"(",
"name",
")",
";",
"err",
"==",
"nil",
"{",
"var",
"partialTemplate",
"*",
"template",
".",
"Template",
"\n",
"result",
":=",
"bytes",
".",
"NewBufferString",
"(",
"\"",
"\"",
")",
"\n",
"if",
"partialTemplate",
",",
"err",
"=",
"template",
".",
"New",
"(",
"filepath",
".",
"Base",
"(",
"name",
")",
")",
".",
"Funcs",
"(",
"funcMap",
")",
".",
"Parse",
"(",
"string",
"(",
"renderContent",
")",
")",
";",
"err",
"==",
"nil",
"{",
"if",
"err",
"=",
"partialTemplate",
".",
"Execute",
"(",
"result",
",",
"renderObj",
")",
";",
"err",
"==",
"nil",
"{",
"return",
"template",
".",
"HTML",
"(",
"result",
".",
"String",
"(",
")",
")",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"else",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Println",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
")",
"\n\n",
"// funcMaps",
"funcMap",
"[",
"\"",
"\"",
"]",
"=",
"render",
"\n",
"funcMap",
"[",
"\"",
"\"",
"]",
"=",
"func",
"(",
")",
"(",
"template",
".",
"HTML",
",",
"error",
")",
"{",
"return",
"render",
"(",
"templateName",
")",
"}",
"\n\n",
"layout",
":=",
"tmpl",
".",
"layout",
"\n",
"usingDefaultLayout",
":=",
"false",
"\n\n",
"if",
"layout",
"==",
"\"",
"\"",
"&&",
"tmpl",
".",
"usingDefaultLayout",
"{",
"usingDefaultLayout",
"=",
"true",
"\n",
"layout",
"=",
"tmpl",
".",
"render",
".",
"DefaultLayout",
"\n",
"}",
"\n\n",
"if",
"layout",
"!=",
"\"",
"\"",
"{",
"content",
",",
"err",
"=",
"tmpl",
".",
"findTemplate",
"(",
"filepath",
".",
"Join",
"(",
"\"",
"\"",
",",
"layout",
")",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"if",
"t",
",",
"err",
"=",
"template",
".",
"New",
"(",
"\"",
"\"",
")",
".",
"Funcs",
"(",
"funcMap",
")",
".",
"Parse",
"(",
"string",
"(",
"content",
")",
")",
";",
"err",
"==",
"nil",
"{",
"var",
"tpl",
"bytes",
".",
"Buffer",
"\n",
"if",
"err",
"=",
"t",
".",
"Execute",
"(",
"&",
"tpl",
",",
"obj",
")",
";",
"err",
"==",
"nil",
"{",
"return",
"template",
".",
"HTML",
"(",
"tpl",
".",
"String",
"(",
")",
")",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"else",
"if",
"!",
"usingDefaultLayout",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"filepath",
".",
"Join",
"(",
"\"",
"\"",
",",
"tmpl",
".",
"layout",
")",
",",
"err",
")",
"\n",
"fmt",
".",
"Println",
"(",
"err",
")",
"\n",
"return",
"template",
".",
"HTML",
"(",
"\"",
"\"",
")",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"content",
",",
"err",
"=",
"tmpl",
".",
"findTemplate",
"(",
"templateName",
")",
";",
"err",
"==",
"nil",
"{",
"if",
"t",
",",
"err",
"=",
"template",
".",
"New",
"(",
"\"",
"\"",
")",
".",
"Funcs",
"(",
"funcMap",
")",
".",
"Parse",
"(",
"string",
"(",
"content",
")",
")",
";",
"err",
"==",
"nil",
"{",
"var",
"tpl",
"bytes",
".",
"Buffer",
"\n",
"if",
"err",
"=",
"t",
".",
"Execute",
"(",
"&",
"tpl",
",",
"obj",
")",
";",
"err",
"==",
"nil",
"{",
"return",
"template",
".",
"HTML",
"(",
"tpl",
".",
"String",
"(",
")",
")",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"else",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"templateName",
")",
"\n",
"}",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Println",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"template",
".",
"HTML",
"(",
"\"",
"\"",
")",
",",
"err",
"\n",
"}"
]
|
17,913 | all-17914 | [
"FormatResponseRaw",
"nicely",
"formats",
"a",
"response",
"for",
"one",
"does",
"not",
"have",
"an",
"issue",
"comment"
]
| [
"func",
"FormatResponseRaw",
"(",
"body",
",",
"bodyURL",
",",
"login",
",",
"<mask>",
"string",
")",
"string",
"{",
"format",
":=",
"`In response to [this](%s):\n\n%s\n`",
"\n",
"// Quote the user's comment by prepending \">\" to each line.",
"var",
"quoted",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"l",
":=",
"range",
"strings",
".",
"Split",
"(",
"body",
",",
"\"",
"\\n",
"\"",
")",
"{",
"quoted",
"=",
"append",
"(",
"quoted",
",",
"\"",
"\"",
"+",
"l",
")",
"\n",
"}",
"\n",
"return",
"FormatResponse",
"(",
"login",
",",
"reply",
",",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"bodyURL",
",",
"strings",
".",
"Join",
"(",
"quoted",
",",
"\"",
"\\n",
"\"",
")",
")",
")",
"\n",
"}"
]
|
17,914 | all-17915 | [
"ListOrgMembers",
"list",
"all",
"users",
"who",
"are",
"members",
"of",
"an",
"organization",
".",
"If",
"the",
"authenticated",
"user",
"is",
"also",
"a",
"member",
"of",
"this",
"organization",
"then",
"both",
"concealed",
"and",
"public",
"members",
"will",
"be",
"returned",
".",
"Role",
"options",
"are",
"all",
"admin",
"and",
"member",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"orgs",
"/",
"members",
"/",
"#members",
"-",
"list"
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"ListOrgMembers",
"(",
"org",
",",
"role",
"string",
")",
"(",
"[",
"]",
"TeamMember",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"org",
",",
"role",
")",
"\n",
"if",
"c",
".",
"fake",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"path",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
")",
"\n",
"var",
"teamMembers",
"[",
"]",
"TeamMember",
"\n",
"err",
":=",
"c",
".",
"readPaginatedResultsWithValues",
"(",
"path",
",",
"url",
".",
"Values",
"{",
"\"",
"\"",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"\"",
"\"",
":",
"[",
"]",
"string",
"{",
"role",
"}",
",",
"}",
",",
"acceptNone",
",",
"func",
"(",
")",
"interface",
"{",
"}",
"{",
"return",
"&",
"[",
"]",
"TeamMember",
"{",
"}",
"\n",
"}",
",",
"func",
"(",
"obj",
"<mask>",
"{",
"}",
")",
"{",
"teamMembers",
"=",
"append",
"(",
"teamMembers",
",",
"*",
"(",
"obj",
".",
"(",
"*",
"[",
"]",
"TeamMember",
")",
")",
"...",
")",
"\n",
"}",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"teamMembers",
",",
"nil",
"\n",
"}"
]
|
17,915 | all-17916 | [
"AddFlags",
"injects",
"Kubernetes",
"options",
"into",
"the",
"given",
"FlagSet",
"."
]
| [
"func",
"(",
"o",
"*",
"KubernetesOptions",
")",
"AddFlags",
"(",
"<mask>",
"*",
"flag",
".",
"FlagSet",
")",
"{",
"fs",
".",
"StringVar",
"(",
"&",
"o",
".",
"cluster",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"fs",
".",
"StringVar",
"(",
"&",
"o",
".",
"kubeconfig",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"fs",
".",
"StringVar",
"(",
"&",
"o",
".",
"DeckURI",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"}"
]
|
17,916 | all-17917 | [
"setLastContact",
"sets",
"the",
"last",
"contact",
"to",
"the",
"current",
"time",
"."
]
| [
"func",
"(",
"s",
"*",
"followerReplication",
")",
"setLastContact",
"(",
")",
"{",
"s",
".",
"lastContactLock",
".",
"Lock",
"(",
")",
"\n",
"s",
".",
"lastContact",
"=",
"<mask>",
".",
"Now",
"(",
")",
"\n",
"s",
".",
"lastContactLock",
".",
"Unlock",
"(",
")",
"\n",
"}"
]
|
17,917 | all-17918 | [
"ListApprovals",
"returns",
"the",
"list",
"of",
"approvals"
]
| [
"func",
"(",
"ap",
"Approvers",
")",
"ListApprovals",
"(",
")",
"[",
"]",
"Approval",
"{",
"approvals",
":=",
"[",
"]",
"Approval",
"{",
"}",
"\n\n",
"for",
"_",
",",
"approver",
":=",
"range",
"ap",
".",
"GetCurrentApproversSet",
"(",
")",
".",
"<mask>",
"(",
")",
"{",
"approvals",
"=",
"append",
"(",
"approvals",
",",
"ap",
".",
"approvers",
"[",
"approver",
"]",
")",
"\n",
"}",
"\n\n",
"return",
"approvals",
"\n",
"}"
]
|
17,918 | all-17919 | [
"attach",
"multiple",
"buffer",
"objects",
"to",
"a",
"vertex",
"array",
"object"
]
| [
"func",
"BindVertexBuffers",
"(",
"<mask>",
"uint32",
",",
"count",
"int32",
",",
"buffers",
"*",
"uint32",
",",
"offsets",
"*",
"int",
",",
"strides",
"*",
"int32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpBindVertexBuffers",
",",
"5",
",",
"uintptr",
"(",
"first",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"buffers",
")",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"offsets",
")",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"strides",
")",
")",
",",
"0",
")",
"\n",
"}"
]
|
17,919 | all-17920 | [
"Collection",
"..."
]
| [
"func",
"(",
"m",
"*",
"Connection",
")",
"Collection",
"(",
"name",
"string",
")",
"*",
"Collection",
"{",
"return",
"m",
".",
"CollectionFromDatabase",
"(",
"name",
",",
"m",
".",
"Config",
".",
"<mask>",
")",
"\n",
"}"
]
|
17,920 | all-17921 | [
"DeleteOrgs",
"-"
]
| [
"func",
"(",
"m",
"*",
"DefaultManager",
")",
"DeleteOrgs",
"(",
")",
"error",
"{",
"m",
".",
"orgs",
"=",
"nil",
"\n",
"orgsConfig",
",",
"err",
":=",
"m",
".",
"Cfg",
".",
"Orgs",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"!",
"orgsConfig",
".",
"EnableDeleteOrgs",
"{",
"lo",
".",
"G",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"configuredOrgs",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n",
"for",
"_",
",",
"orgName",
":=",
"range",
"orgsConfig",
".",
"Orgs",
"{",
"configuredOrgs",
"[",
"orgName",
"]",
"=",
"true",
"\n",
"}",
"\n\n",
"orgs",
",",
"err",
":=",
"m",
".",
"ListOrgs",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"orgsToDelete",
":=",
"make",
"(",
"[",
"]",
"cfclient",
".",
"Org",
",",
"0",
")",
"\n",
"for",
"_",
",",
"org",
":=",
"range",
"orgs",
"{",
"if",
"_",
",",
"exists",
":=",
"configuredOrgs",
"[",
"org",
".",
"Name",
"]",
";",
"!",
"exists",
"{",
"if",
"!",
"Matches",
"(",
"org",
".",
"Name",
",",
"orgsConfig",
".",
"ProtectedOrgList",
"(",
")",
")",
"{",
"orgsToDelete",
"=",
"append",
"(",
"orgsToDelete",
",",
"org",
")",
"\n",
"}",
"else",
"{",
"lo",
".",
"G",
".",
"Infof",
"(",
"\"",
"\"",
",",
"org",
".",
"<mask>",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"org",
":=",
"range",
"orgsToDelete",
"{",
"if",
"err",
":=",
"m",
".",
"DeleteOrg",
"(",
"org",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"m",
".",
"orgs",
"=",
"nil",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,921 | all-17922 | [
"GetSortedList",
"returns",
"the",
"lsit",
"of",
"LexSymbols",
"in",
"order",
"that",
"they",
"should",
"be",
"searched",
"for",
"in",
"the",
"tempalte"
]
| [
"func",
"(",
"l",
"*",
"LexSymbolSet",
")",
"GetSortedList",
"(",
")",
"LexSymbolList",
"{",
"// Because symbols are parsed automatically in a loop, we need to make",
"// sure that we search starting with the longest term (e.g., \"INCLUDE\"",
"// must come before \"IN\")",
"// However, simply sorting the symbols using alphabetical sort then",
"// max-length forces us to make more comparisons than necessary.",
"// To get the best of both world, we allow passing a floating point",
"// \"priority\" parameter to sort the symbols",
"if",
"l",
".",
"SortedList",
"!=",
"nil",
"{",
"return",
"l",
".",
"SortedList",
"\n",
"}",
"\n\n",
"num",
":=",
"len",
"(",
"l",
".",
"Map",
")",
"\n",
"list",
":=",
"make",
"(",
"LexSymbolList",
",",
"num",
")",
"\n",
"i",
":=",
"0",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"l",
".",
"Map",
"{",
"list",
"[",
"i",
"]",
"=",
"v",
"\n",
"i",
"++",
"\n",
"}",
"\n",
"l",
".",
"SortedList",
"=",
"<mask>",
".",
"Sort",
"(",
")",
"\n\n",
"return",
"l",
".",
"SortedList",
"\n",
"}"
]
|
17,922 | all-17923 | [
"Write",
"serializes",
"the",
"frame",
"to",
"the",
"given",
"buffered",
"output",
"satisfies",
"the",
"Frame",
"interface",
"."
]
| [
"func",
"(",
"r",
"<mask>",
")",
"Write",
"(",
"w",
"*",
"bufio",
".",
"Writer",
")",
"(",
"err",
"error",
")",
"{",
"if",
"err",
"=",
"writeFrameHeader",
"(",
"w",
",",
"FrameTypeResponse",
",",
"len",
"(",
"r",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"err",
"=",
"errors",
".",
"WithMessage",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"err",
"=",
"w",
".",
"WriteString",
"(",
"string",
"(",
"r",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"err",
"=",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
]
|
17,923 | all-17924 | [
"HasAccountID",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"i",
"*",
"IntegrationAWSAccountDeleteRequest",
")",
"HasAccountID",
"(",
")",
"bool",
"{",
"if",
"i",
"!=",
"nil",
"&&",
"i",
".",
"AccountID",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
17,924 | all-17925 | [
"copyHealthMetadata",
"performs",
"a",
"deep",
"copy",
"of",
"HealthMetadata",
"object"
]
| [
"func",
"copyHealthMetadata",
"(",
"metadata",
"*",
"ecstcs",
".",
"HealthMetadata",
",",
"fin",
"bool",
")",
"*",
"ecstcs",
".",
"HealthMetadata",
"{",
"return",
"&",
"ecstcs",
".",
"HealthMetadata",
"{",
"Cluster",
":",
"aws",
".",
"<mask>",
"(",
"aws",
".",
"StringValue",
"(",
"metadata",
".",
"Cluster",
")",
")",
",",
"ContainerInstance",
":",
"aws",
".",
"String",
"(",
"aws",
".",
"StringValue",
"(",
"metadata",
".",
"ContainerInstance",
")",
")",
",",
"Fin",
":",
"aws",
".",
"Bool",
"(",
"fin",
")",
",",
"MessageId",
":",
"aws",
".",
"String",
"(",
"aws",
".",
"StringValue",
"(",
"metadata",
".",
"MessageId",
")",
")",
",",
"}",
"\n",
"}"
]
|
17,925 | all-17926 | [
"NewClient",
"creates",
"a",
"new",
"Pact",
"client",
"manager",
"with",
"defaults"
]
| [
"func",
"NewClient",
"(",
")",
"*",
"PactClient",
"{",
"return",
"newClient",
"(",
"&",
"<mask>",
".",
"MockService",
"{",
"}",
",",
"&",
"client",
".",
"VerificationService",
"{",
"}",
",",
"&",
"client",
".",
"MessageService",
"{",
"}",
",",
"&",
"client",
".",
"PublishService",
"{",
"}",
")",
"\n",
"}"
]
|
17,926 | all-17927 | [
"Boolean",
"matches",
"a",
"boolean",
"at",
"the",
"specified",
"position"
]
| [
"func",
"Boolean",
"(",
"in",
"[",
"]",
"byte",
",",
"pos",
"int",
")",
"(",
"int",
",",
"error",
")",
"{",
"switch",
"in",
"[",
"pos",
"]",
"{",
"case",
"'t'",
":",
"return",
"expect",
"(",
"in",
",",
"pos",
",",
"t",
"...",
")",
"\n",
"<mask>",
"'f'",
":",
"return",
"expect",
"(",
"in",
",",
"pos",
",",
"f",
"...",
")",
"\n",
"default",
":",
"return",
"0",
",",
"errUnexpectedValue",
"\n",
"}",
"\n",
"}"
]
|
17,927 | all-17928 | [
"TODO",
"(",
"jrick",
")",
"GIcon",
"/",
"*",
"func",
"(",
"v",
"*",
"Image",
")",
"GetGIcon",
"()",
"{",
"}",
"GetPixelSize",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_image_get_pixel_size",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetPixelSize",
"(",
")",
"int",
"{",
"c",
":=",
"C",
".",
"gtk_image_get_pixel_size",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"int",
"(",
"c",
")",
"\n",
"}"
]
|
17,928 | all-17929 | [
"protoToRecord",
"converts",
"a",
"RequestLog",
"the",
"internal",
"Protocol",
"Buffer",
"representation",
"of",
"a",
"single",
"request",
"-",
"level",
"log",
"to",
"a",
"Record",
"its",
"corresponding",
"external",
"representation",
"."
]
| [
"func",
"protoToRecord",
"(",
"rl",
"*",
"pb",
".",
"RequestLog",
")",
"*",
"Record",
"{",
"offset",
",",
"err",
":=",
"proto",
".",
"Marshal",
"(",
"rl",
".",
"Offset",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"offset",
"=",
"nil",
"\n",
"}",
"\n",
"return",
"&",
"Record",
"{",
"AppID",
":",
"*",
"rl",
".",
"AppId",
",",
"ModuleID",
":",
"rl",
".",
"GetModuleId",
"(",
")",
",",
"VersionID",
":",
"*",
"rl",
".",
"VersionId",
",",
"RequestID",
":",
"rl",
".",
"RequestId",
",",
"Offset",
":",
"offset",
",",
"IP",
":",
"*",
"rl",
".",
"Ip",
",",
"Nickname",
":",
"rl",
".",
"GetNickname",
"(",
")",
",",
"AppEngineRelease",
":",
"string",
"(",
"rl",
".",
"GetAppEngineRelease",
"(",
")",
")",
",",
"StartTime",
":",
"time",
".",
"Unix",
"(",
"0",
",",
"*",
"rl",
".",
"StartTime",
"*",
"1e3",
")",
",",
"EndTime",
":",
"time",
".",
"Unix",
"(",
"0",
",",
"*",
"rl",
".",
"EndTime",
"*",
"1e3",
")",
",",
"Latency",
":",
"time",
".",
"Duration",
"(",
"*",
"rl",
".",
"Latency",
")",
"*",
"time",
".",
"Microsecond",
",",
"MCycles",
":",
"*",
"rl",
".",
"Mcycles",
",",
"Method",
":",
"*",
"rl",
".",
"Method",
",",
"<mask>",
":",
"*",
"rl",
".",
"Resource",
",",
"HTTPVersion",
":",
"*",
"rl",
".",
"HttpVersion",
",",
"Status",
":",
"*",
"rl",
".",
"Status",
",",
"ResponseSize",
":",
"*",
"rl",
".",
"ResponseSize",
",",
"Referrer",
":",
"rl",
".",
"GetReferrer",
"(",
")",
",",
"UserAgent",
":",
"rl",
".",
"GetUserAgent",
"(",
")",
",",
"URLMapEntry",
":",
"*",
"rl",
".",
"UrlMapEntry",
",",
"Combined",
":",
"*",
"rl",
".",
"Combined",
",",
"Host",
":",
"rl",
".",
"GetHost",
"(",
")",
",",
"Cost",
":",
"rl",
".",
"GetCost",
"(",
")",
",",
"TaskQueueName",
":",
"rl",
".",
"GetTaskQueueName",
"(",
")",
",",
"TaskName",
":",
"rl",
".",
"GetTaskName",
"(",
")",
",",
"WasLoadingRequest",
":",
"rl",
".",
"GetWasLoadingRequest",
"(",
")",
",",
"PendingTime",
":",
"time",
".",
"Duration",
"(",
"rl",
".",
"GetPendingTime",
"(",
")",
")",
"*",
"time",
".",
"Microsecond",
",",
"Finished",
":",
"rl",
".",
"GetFinished",
"(",
")",
",",
"AppLogs",
":",
"protoToAppLogs",
"(",
"rl",
".",
"Line",
")",
",",
"InstanceID",
":",
"string",
"(",
"rl",
".",
"GetCloneKey",
"(",
")",
")",
",",
"}",
"\n",
"}"
]
|
17,929 | all-17930 | [
"SetChildNonHomogeneous",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_button_box_set_child_non_homogeneous",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"ButtonBox",
")",
"SetChildNonHomogeneous",
"(",
"child",
"IWidget",
",",
"nonHomogeneous",
"bool",
")",
"{",
"C",
".",
"gtk_button_box_set_child_non_homogeneous",
"(",
"v",
".",
"native",
"(",
")",
",",
"<mask>",
".",
"toWidget",
"(",
")",
",",
"gbool",
"(",
"nonHomogeneous",
")",
")",
"\n",
"}"
]
|
17,930 | all-17931 | [
"GetLabel",
"returns",
"the",
"Label",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"w",
"*",
"WidgetMarker",
")",
"GetLabel",
"(",
")",
"string",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"Label",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"<mask>",
"\n",
"}"
]
|
17,931 | all-17932 | [
"then",
"create",
"another",
"main",
"which",
"runs",
"the",
"upgrades",
"main",
"()",
"is",
"run",
"in",
"the",
"initial",
"process"
]
| [
"func",
"main",
"(",
")",
"{",
"overseer",
".",
"Run",
"(",
"overseer",
".",
"Config",
"{",
"Program",
":",
"prog",
",",
"Address",
":",
"\"",
"\"",
",",
"Fetcher",
":",
"&",
"fetcher",
".",
"<mask>",
"{",
"Path",
":",
"\"",
"\"",
"}",
",",
"Debug",
":",
"false",
",",
"//display log of overseer actions",
"}",
")",
"\n",
"}"
]
|
17,932 | all-17933 | [
"errorf",
"returns",
"an",
"error",
"token",
"and",
"terminates",
"the",
"scan",
"by",
"passing",
"back",
"a",
"nil",
"pointer",
"that",
"will",
"be",
"the",
"next",
"state",
"thus",
"terminating",
"the",
"lexer"
]
| [
"func",
"(",
"l",
"*",
"Lexer",
")",
"errorf",
"(",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"stateFn",
"{",
"l",
".",
"handler",
"(",
"Token",
"{",
"TokenError",
",",
"fmt",
".",
"Sprintf",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"l",
".",
"Name",
",",
"l",
".",
"LineNum",
"(",
")",
",",
"l",
".",
"Offset",
"(",
")",
")",
"+",
"<mask>",
",",
"args",
"...",
")",
"}",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,933 | all-17934 | [
"ContainerStart",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockClient",
")",
"ContainerStart",
"(",
"arg0",
"context",
".",
"Context",
",",
"arg1",
"string",
",",
"arg2",
"types",
".",
"ContainerStartOptions",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
",",
"arg2",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
]
|
17,934 | all-17935 | [
"SetItems",
"implements",
"Collection",
"interface"
]
| [
"func",
"(",
"<mask>",
"*",
"ResourceCollection",
")",
"SetItems",
"(",
"objects",
"[",
"]",
"Object",
")",
"{",
"var",
"items",
"[",
"]",
"*",
"ResourceObject",
"\n",
"for",
"_",
",",
"b",
":=",
"range",
"objects",
"{",
"items",
"=",
"append",
"(",
"items",
",",
"b",
".",
"(",
"*",
"ResourceObject",
")",
")",
"\n",
"}",
"\n",
"in",
".",
"Items",
"=",
"items",
"\n",
"}"
]
|
17,935 | all-17936 | [
"GetEvents",
"returns",
"a",
"slice",
"of",
"events",
"from",
"the",
"query",
"stream",
"."
]
| [
"func",
"(",
"client",
"*",
"Client",
")",
"GetEvents",
"(",
"start",
",",
"end",
"int",
",",
"priority",
",",
"sources",
",",
"tags",
"string",
")",
"(",
"[",
"]",
"Event",
",",
"error",
")",
"{",
"// Since this is a GET request, we need to build a query string.",
"vals",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"vals",
".",
"Add",
"(",
"\"",
"\"",
",",
"strconv",
".",
"Itoa",
"(",
"start",
")",
")",
"\n",
"vals",
".",
"Add",
"(",
"\"",
"\"",
",",
"strconv",
".",
"Itoa",
"(",
"end",
")",
")",
"\n",
"if",
"priority",
"!=",
"\"",
"\"",
"{",
"vals",
".",
"Add",
"(",
"\"",
"\"",
",",
"priority",
")",
"\n",
"}",
"\n",
"if",
"sources",
"!=",
"\"",
"\"",
"{",
"vals",
".",
"Add",
"(",
"\"",
"\"",
",",
"sources",
")",
"\n",
"}",
"\n",
"if",
"tags",
"!=",
"\"",
"\"",
"{",
"vals",
".",
"Add",
"(",
"\"",
"\"",
",",
"tags",
")",
"\n",
"}",
"\n\n",
"// Now the request and response.",
"var",
"out",
"reqGetEvents",
"\n",
"if",
"err",
":=",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"vals",
".",
"Encode",
"(",
")",
")",
",",
"nil",
",",
"&",
"out",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"Events",
",",
"nil",
"\n",
"}"
]
|
17,936 | all-17937 | [
"PostMetrics",
"takes",
"as",
"input",
"a",
"slice",
"of",
"metrics",
"and",
"then",
"posts",
"them",
"up",
"to",
"the",
"server",
"for",
"posting",
"data",
"."
]
| [
"func",
"(",
"client",
"*",
"Client",
")",
"PostMetrics",
"(",
"series",
"[",
"]",
"Metric",
")",
"error",
"{",
"return",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"reqPostSeries",
"{",
"Series",
":",
"<mask>",
"}",
",",
"nil",
")",
"\n",
"}"
]
|
17,937 | all-17938 | [
"NewRandomDNSBalancer",
"will",
"return",
"a",
"random",
"balancer",
".",
"DNS",
"that",
"looks",
"up",
"dns",
"in",
"consul",
"."
]
| [
"func",
"NewRandomDNSBalancer",
"(",
"<mask>",
"string",
",",
"consulAddr",
"string",
",",
"cacheTTL",
"time",
".",
"Duration",
")",
"(",
"balancer",
".",
"DNS",
",",
"error",
")",
"{",
"config",
":=",
"api",
".",
"DefaultConfig",
"(",
")",
"\n",
"config",
".",
"Address",
"=",
"consulAddr",
"\n",
"consul",
",",
"err",
":=",
"api",
".",
"NewClient",
"(",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"r",
":=",
"randomBalancer",
"{",
"}",
"\n",
"r",
".",
"cache",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"cachedServiceLocation",
")",
"\n",
"r",
".",
"environment",
"=",
"environment",
"\n",
"r",
".",
"ttl",
"=",
"cacheTTL",
"\n",
"r",
".",
"consulCatalog",
"=",
"consul",
".",
"Health",
"(",
")",
"\n",
"return",
"&",
"r",
",",
"nil",
"\n",
"}"
]
|
17,938 | all-17939 | [
"----------------------------------------",
"Misc",
".",
"Write",
"field",
"key",
"."
]
| [
"func",
"encodeFieldNumberAndTyp3",
"(",
"w",
"io",
".",
"Writer",
",",
"num",
"uint32",
",",
"typ",
"Typ3",
")",
"(",
"err",
"error",
")",
"{",
"if",
"(",
"typ",
"&",
"0xF8",
")",
"!=",
"0",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"typ",
")",
")",
"\n",
"}",
"\n",
"if",
"num",
"<",
"0",
"||",
"num",
">",
"(",
"1",
"<<",
"29",
"-",
"1",
")",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"num",
")",
")",
"\n",
"}",
"\n\n",
"// Pack Typ3 and field number.",
"var",
"value64",
"=",
"(",
"uint64",
"(",
"num",
")",
"<<",
"3",
")",
"|",
"uint64",
"(",
"typ",
")",
"\n\n",
"// Write uvarint value for field and Typ3.",
"var",
"buf",
"[",
"10",
"]",
"byte",
"\n",
"n",
":=",
"<mask>",
".",
"PutUvarint",
"(",
"buf",
"[",
":",
"]",
",",
"value64",
")",
"\n",
"_",
",",
"err",
"=",
"w",
".",
"Write",
"(",
"buf",
"[",
"0",
":",
"n",
"]",
")",
"\n",
"return",
"\n",
"}"
]
|
17,939 | all-17940 | [
"RemoveCredentials",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockManager",
")",
"RemoveCredentials",
"(",
"arg0",
"<mask>",
")",
"{",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"}"
]
|
17,940 | all-17941 | [
"<base",
"-",
"unresolved",
"-",
"name",
">",
"::",
"=",
"<simple",
"-",
"id",
">",
"::",
"=",
"on",
"<operator",
"-",
"name",
">",
"::",
"=",
"on",
"<operator",
"-",
"name",
">",
"<template",
"-",
"args",
">",
"::",
"=",
"dn",
"<destructor",
"-",
"name",
">",
"<simple",
"-",
"id",
">",
"::",
"=",
"<source",
"-",
"name",
">",
"[",
"<template",
"-",
"args",
">",
"]"
]
| [
"func",
"(",
"st",
"*",
"state",
")",
"baseUnresolvedName",
"(",
")",
"AST",
"{",
"var",
"n",
"AST",
"\n",
"if",
"len",
"(",
"st",
".",
"str",
")",
">=",
"2",
"&&",
"st",
".",
"str",
"[",
":",
"2",
"]",
"==",
"\"",
"\"",
"{",
"st",
".",
"advance",
"(",
"2",
")",
"\n",
"n",
",",
"_",
"=",
"st",
".",
"operatorName",
"(",
"true",
")",
"\n",
"}",
"else",
"if",
"len",
"(",
"st",
".",
"str",
")",
">=",
"2",
"&&",
"st",
".",
"str",
"[",
":",
"2",
"]",
"==",
"\"",
"\"",
"{",
"st",
".",
"advance",
"(",
"2",
")",
"\n",
"if",
"len",
"(",
"st",
".",
"str",
")",
">",
"0",
"&&",
"isDigit",
"(",
"st",
".",
"str",
"[",
"0",
"]",
")",
"{",
"n",
"=",
"st",
".",
"sourceName",
"(",
")",
"\n",
"}",
"else",
"{",
"n",
"=",
"st",
".",
"demangleType",
"(",
"false",
")",
"\n",
"}",
"\n",
"n",
"=",
"&",
"Destructor",
"{",
"Name",
":",
"n",
"}",
"\n",
"}",
"else",
"if",
"len",
"(",
"st",
".",
"str",
")",
">",
"0",
"&&",
"isDigit",
"(",
"st",
".",
"str",
"[",
"0",
"]",
")",
"{",
"n",
"=",
"st",
".",
"sourceName",
"(",
")",
"\n",
"}",
"else",
"{",
"// GCC seems to not follow the ABI here: it can have",
"// an operator name without on.",
"// See https://gcc.gnu.org/PR70182.",
"n",
",",
"_",
"=",
"st",
".",
"operatorName",
"(",
"<mask>",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"st",
".",
"str",
")",
">",
"0",
"&&",
"st",
".",
"str",
"[",
"0",
"]",
"==",
"'I'",
"{",
"args",
":=",
"st",
".",
"templateArgs",
"(",
")",
"\n",
"n",
"=",
"&",
"Template",
"{",
"Name",
":",
"n",
",",
"Args",
":",
"args",
"}",
"\n",
"}",
"\n",
"return",
"n",
"\n",
"}"
]
|
17,941 | all-17942 | [
"RunsAgainstAllBranch",
"returns",
"true",
"if",
"there",
"are",
"both",
"branches",
"and",
"skip_branches",
"are",
"unset"
]
| [
"func",
"(",
"br",
"Brancher",
")",
"RunsAgainstAllBranch",
"(",
")",
"bool",
"{",
"return",
"len",
"(",
"br",
".",
"SkipBranches",
")",
"==",
"0",
"&&",
"len",
"(",
"<mask>",
".",
"Branches",
")",
"==",
"0",
"\n",
"}"
]
|
17,942 | all-17943 | [
"SaveRestClient",
"saves",
"the",
"REST",
"client",
"session",
"ID",
"to",
"the",
"supplied",
"path",
".",
"This",
"facilitates",
"re",
"-",
"use",
"of",
"the",
"session",
"at",
"a",
"later",
"date",
"."
]
| [
"func",
"(",
"c",
"*",
"Config",
")",
"SaveRestClient",
"(",
"client",
"*",
"<mask>",
".",
"RestClient",
")",
"error",
"{",
"if",
"!",
"c",
".",
"Persist",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"p",
",",
"err",
":=",
"c",
".",
"restSessionFile",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"p",
")",
"\n",
"err",
"=",
"os",
".",
"MkdirAll",
"(",
"filepath",
".",
"Dir",
"(",
"p",
")",
",",
"0700",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"ioutil",
".",
"WriteFile",
"(",
"p",
",",
"[",
"]",
"byte",
"(",
"client",
".",
"SessionID",
"(",
")",
")",
",",
"0600",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
17,943 | all-17944 | [
"SetMatrix",
"is",
"a",
"wrapper",
"around",
"cairo_set_matrix",
"."
]
| [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetMatrix",
"(",
"matrix",
"*",
"Matrix",
")",
"{",
"C",
".",
"cairo_set_matrix",
"(",
"v",
".",
"native",
"(",
")",
",",
"matrix",
".",
"native",
"(",
")",
")",
"\n",
"}"
]
|
17,944 | all-17945 | [
"Get",
"does",
"a",
"filtered",
"write",
"of",
"id",
"s",
"hashtree",
"to",
"the",
"passed",
"in",
"io",
".",
"Writer",
"."
]
| [
"func",
"(",
"c",
"*",
"MergeCache",
")",
"Get",
"(",
"id",
"int64",
",",
"w",
"io",
".",
"Writer",
",",
"filter",
"Filter",
")",
"(",
"retErr",
"error",
")",
"{",
"r",
",",
"err",
":=",
"c",
".",
"Cache",
".",
"Get",
"(",
"fmt",
".",
"Sprint",
"(",
"id",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
":=",
"r",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"&&",
"retErr",
"==",
"nil",
"{",
"retErr",
"=",
"err",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"return",
"NewWriter",
"(",
"w",
")",
".",
"Copy",
"(",
"NewReader",
"(",
"r",
",",
"<mask>",
")",
")",
"\n",
"}"
]
|
17,945 | all-17946 | [
"CloneLogPath",
"returns",
"the",
"path",
"to",
"the",
"clone",
"log",
"file",
"in",
"the",
"volume",
"mount",
".",
"CloneLogPath",
"returns",
"the",
"path",
"to",
"the",
"clone",
"log",
"file",
"in",
"the",
"volume",
"mount",
"."
]
| [
"func",
"CloneLogPath",
"(",
"logMount",
"coreapi",
".",
"VolumeMount",
")",
"<mask>",
"{",
"return",
"filepath",
".",
"Join",
"(",
"logMount",
".",
"MountPath",
",",
"cloneLogPath",
")",
"\n",
"}"
]
|
17,946 | all-17947 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"EventAddHeapSnapshotChunk",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeapprofiler19",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
]
|
17,947 | all-17948 | [
"PlaceEntrypoint",
"will",
"copy",
"entrypoint",
"from",
"the",
"entrypoint",
"image",
"to",
"the",
"tools",
"volume"
]
| [
"func",
"PlaceEntrypoint",
"(",
"image",
"string",
",",
"toolsMount",
"coreapi",
".",
"VolumeMount",
")",
"coreapi",
".",
"<mask>",
"{",
"return",
"coreapi",
".",
"Container",
"{",
"Name",
":",
"\"",
"\"",
",",
"Image",
":",
"image",
",",
"Command",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"Args",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"entrypointLocation",
"(",
"toolsMount",
")",
"}",
",",
"VolumeMounts",
":",
"[",
"]",
"coreapi",
".",
"VolumeMount",
"{",
"toolsMount",
"}",
",",
"}",
"\n",
"}"
]
|
17,948 | all-17949 | [
"Print",
"records",
"the",
"log",
"with",
"trace",
"level"
]
| [
"func",
"(",
"l",
"*",
"Logger",
")",
"Print",
"(",
"args",
"...",
"<mask>",
"{",
"}",
")",
"{",
"l",
".",
"Output",
"(",
"2",
",",
"LevelTrace",
",",
"fmt",
".",
"Sprint",
"(",
"args",
"...",
")",
")",
"\n",
"}"
]
|
17,949 | all-17950 | [
"isDockerUsingKeychain",
"checks",
"if",
"the",
"user",
"has",
"a",
"configuration",
"that",
"is",
"not",
"readable",
"by",
"our",
"current",
"docker",
"client",
"library",
".",
"TODO",
"(",
"ys",
")",
":",
"remove",
"if",
"/",
"when",
"this",
"issue",
"is",
"addressed",
":",
"https",
":",
"//",
"github",
".",
"com",
"/",
"fsouza",
"/",
"go",
"-",
"dockerclient",
"/",
"issues",
"/",
"677"
]
| [
"func",
"isDockerUsingKeychain",
"(",
")",
"bool",
"{",
"user",
",",
"err",
":=",
"user",
".",
"Current",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"contents",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"path",
".",
"Join",
"(",
"user",
".",
"HomeDir",
",",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"var",
"j",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"\n\n",
"if",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"contents",
",",
"&",
"j",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"auths",
",",
"ok",
":=",
"j",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"authsInner",
",",
"ok",
":=",
"auths",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"index",
",",
"ok",
":=",
"authsInner",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"!",
"<mask>",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"indexInner",
",",
"ok",
":=",
"index",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"if",
"!",
"ok",
"||",
"len",
"(",
"indexInner",
")",
">",
"0",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"return",
"j",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"\n",
"}"
]
|
17,950 | all-17951 | [
"userDataConfig",
"reads",
"configuration",
"JSON",
"from",
"instance",
"s",
"userdata",
".",
"It",
"doesn",
"t",
"return",
"any",
"error",
"as",
"it",
"s",
"entirely",
"optional",
"to",
"configure",
"the",
"ECS",
"agent",
"using",
"this",
"method",
".",
"Example",
":",
"{",
"ECSAgentConfiguration",
":",
"{",
"Cluster",
":",
"default",
"}}"
]
| [
"func",
"userDataConfig",
"(",
"ec2Client",
"ec2",
".",
"EC2MetadataClient",
")",
"Config",
"{",
"<mask>",
"userDataParser",
"struct",
"{",
"Config",
"Config",
"`json:\"ECSAgentConfiguration\"`",
"\n",
"}",
"\n\n",
"parsedUserData",
":=",
"userDataParser",
"{",
"Config",
":",
"Config",
"{",
"}",
",",
"}",
"\n\n",
"userData",
",",
"err",
":=",
"ec2Client",
".",
"GetUserData",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"// Unable to read userdata from instance metadata. Just",
"// return early",
"return",
"parsedUserData",
".",
"Config",
"\n",
"}",
"\n",
"// In the future, if we want to support base64 encoded config,",
"// we'd need to add logic to decode the string here.",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"[",
"]",
"byte",
"(",
"userData",
")",
",",
"&",
"parsedUserData",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"// Unable to parse userdata as a valid JSON. Return the",
"// empty config",
"return",
"Config",
"{",
"}",
"\n",
"}",
"\n\n",
"return",
"parsedUserData",
".",
"Config",
"\n",
"}"
]
|
17,951 | all-17952 | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"get",
"apps",
"app",
"params"
]
| [
"func",
"(",
"o",
"*",
"GetAppsAppParams",
")",
"WithTimeout",
"(",
"timeout",
"<mask>",
".",
"Duration",
")",
"*",
"GetAppsAppParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
]
|
17,952 | all-17953 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"GetResponseBodyReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoFetch4",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
17,953 | all-17954 | [
"Decrement",
"an",
"item",
"of",
"type",
"int",
"int8",
"int16",
"int32",
"int64",
"uintptr",
"uint",
"uint8",
"uint32",
"or",
"uint64",
"float32",
"or",
"float64",
"by",
"n",
".",
"Returns",
"an",
"error",
"if",
"the",
"item",
"s",
"value",
"is",
"not",
"an",
"integer",
"if",
"it",
"was",
"not",
"found",
"or",
"if",
"it",
"is",
"not",
"possible",
"to",
"decrement",
"it",
"by",
"n",
".",
"To",
"retrieve",
"the",
"decremented",
"value",
"use",
"one",
"of",
"the",
"specialized",
"methods",
"e",
".",
"g",
".",
"DecrementInt64",
"."
]
| [
"func",
"(",
"c",
"*",
"cache",
")",
"Decrement",
"(",
"k",
"string",
",",
"n",
"int64",
")",
"error",
"{",
"// TODO: Implement Increment and Decrement more cleanly.",
"// (Cannot do Increment(k, n*-1) for uints.)",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"v",
",",
"found",
":=",
"c",
".",
"items",
"[",
"k",
"]",
"\n",
"if",
"!",
"found",
"||",
"v",
".",
"Expired",
"(",
")",
"{",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"switch",
"v",
".",
"<mask>",
".",
"(",
"type",
")",
"{",
"case",
"int",
":",
"v",
".",
"Object",
"=",
"v",
".",
"Object",
".",
"(",
"int",
")",
"-",
"int",
"(",
"n",
")",
"\n",
"case",
"int8",
":",
"v",
".",
"Object",
"=",
"v",
".",
"Object",
".",
"(",
"int8",
")",
"-",
"int8",
"(",
"n",
")",
"\n",
"case",
"int16",
":",
"v",
".",
"Object",
"=",
"v",
".",
"Object",
".",
"(",
"int16",
")",
"-",
"int16",
"(",
"n",
")",
"\n",
"case",
"int32",
":",
"v",
".",
"Object",
"=",
"v",
".",
"Object",
".",
"(",
"int32",
")",
"-",
"int32",
"(",
"n",
")",
"\n",
"case",
"int64",
":",
"v",
".",
"Object",
"=",
"v",
".",
"Object",
".",
"(",
"int64",
")",
"-",
"n",
"\n",
"case",
"uint",
":",
"v",
".",
"Object",
"=",
"v",
".",
"Object",
".",
"(",
"uint",
")",
"-",
"uint",
"(",
"n",
")",
"\n",
"case",
"uintptr",
":",
"v",
".",
"Object",
"=",
"v",
".",
"Object",
".",
"(",
"uintptr",
")",
"-",
"uintptr",
"(",
"n",
")",
"\n",
"case",
"uint8",
":",
"v",
".",
"Object",
"=",
"v",
".",
"Object",
".",
"(",
"uint8",
")",
"-",
"uint8",
"(",
"n",
")",
"\n",
"case",
"uint16",
":",
"v",
".",
"Object",
"=",
"v",
".",
"Object",
".",
"(",
"uint16",
")",
"-",
"uint16",
"(",
"n",
")",
"\n",
"case",
"uint32",
":",
"v",
".",
"Object",
"=",
"v",
".",
"Object",
".",
"(",
"uint32",
")",
"-",
"uint32",
"(",
"n",
")",
"\n",
"case",
"uint64",
":",
"v",
".",
"Object",
"=",
"v",
".",
"Object",
".",
"(",
"uint64",
")",
"-",
"uint64",
"(",
"n",
")",
"\n",
"case",
"float32",
":",
"v",
".",
"Object",
"=",
"v",
".",
"Object",
".",
"(",
"float32",
")",
"-",
"float32",
"(",
"n",
")",
"\n",
"case",
"float64",
":",
"v",
".",
"Object",
"=",
"v",
".",
"Object",
".",
"(",
"float64",
")",
"-",
"float64",
"(",
"n",
")",
"\n",
"default",
":",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"k",
")",
"\n",
"}",
"\n",
"c",
".",
"items",
"[",
"k",
"]",
"=",
"v",
"\n",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,954 | all-17955 | [
"Listen",
"to",
"the",
"docker",
"event",
"stream",
"for",
"container",
"changes",
"and",
"pass",
"them",
"up"
]
| [
"func",
"(",
"dg",
"*",
"dockerGoClient",
")",
"ContainerEvents",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"<-",
"chan",
"DockerContainerChangeEvent",
",",
"error",
")",
"{",
"<mask>",
",",
"err",
":=",
"dg",
".",
"sdkDockerClient",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"events",
":=",
"make",
"(",
"chan",
"*",
"events",
".",
"Message",
")",
"\n",
"buffer",
":=",
"NewInfiniteBuffer",
"(",
")",
"\n\n",
"derivedCtx",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"ctx",
")",
"\n",
"dockerEvents",
",",
"eventErr",
":=",
"client",
".",
"Events",
"(",
"derivedCtx",
",",
"types",
".",
"EventsOptions",
"{",
"}",
")",
"\n\n",
"// Cache the event from docker client. Channel closes when an error is passed to eventErr.",
"go",
"buffer",
".",
"StartListening",
"(",
"derivedCtx",
",",
"dockerEvents",
")",
"\n",
"// Receive errors from channels. If error thrown is not EOF, log and reopen channel.",
"// TODO: move the error check into StartListening() to keep event streaming and error handling in one place.",
"go",
"func",
"(",
")",
"{",
"for",
"{",
"select",
"{",
"case",
"err",
":=",
"<-",
"eventErr",
":",
"if",
"err",
"==",
"io",
".",
"EOF",
"||",
"err",
"==",
"io",
".",
"ErrUnexpectedEOF",
"{",
"seelog",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"cancel",
"(",
")",
"\n",
"return",
"\n",
"}",
"else",
"{",
"// If an error is returned, we need to reopen channel to continue listening",
"seelog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"nextCtx",
",",
"nextCancel",
":=",
"context",
".",
"WithCancel",
"(",
"ctx",
")",
"\n",
"dockerEvents",
",",
"eventErr",
"=",
"client",
".",
"Events",
"(",
"nextCtx",
",",
"types",
".",
"EventsOptions",
"{",
"}",
")",
"\n",
"// Cache the event from docker client.",
"go",
"buffer",
".",
"StartListening",
"(",
"nextCtx",
",",
"dockerEvents",
")",
"\n",
"// Close previous stream after starting to listen on new one",
"cancel",
"(",
")",
"\n",
"// Reassign cancel variable next Cancel function to setup next iteration of loop.",
"cancel",
"=",
"nextCancel",
"\n",
"}",
"\n",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"// Read the buffered events and send to task engine",
"go",
"buffer",
".",
"Consume",
"(",
"events",
")",
"\n",
"changedContainers",
":=",
"make",
"(",
"chan",
"DockerContainerChangeEvent",
")",
"\n",
"go",
"dg",
".",
"handleContainerEvents",
"(",
"ctx",
",",
"events",
",",
"changedContainers",
")",
"\n\n",
"return",
"changedContainers",
",",
"nil",
"\n",
"}"
]
|
17,955 | all-17956 | [
"FromContext",
"returns",
"a",
"newrelic",
".",
"Tx",
"from",
"the",
"context",
"."
]
| [
"func",
"FromContext",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"Tx",
",",
"bool",
")",
"{",
"t",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"txKey",
")",
".",
"(",
"Tx",
")",
"\n",
"return",
"t",
",",
"ok",
"\n",
"}"
]
|
17,956 | all-17957 | [
"HasTimeoutH",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"o",
"*",
"<mask>",
")",
"HasTimeoutH",
"(",
")",
"bool",
"{",
"if",
"o",
"!=",
"nil",
"&&",
"o",
".",
"TimeoutH",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
17,957 | all-17958 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"GetBrowserCommandLineReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser15",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
]
|
17,958 | all-17959 | [
"MkdirAll",
"puts",
"all",
"of",
"the",
"parent",
"directories",
"of",
"a",
"given",
"path",
"into",
"the",
"hashtree",
"."
]
| [
"func",
"(",
"o",
"*",
"Ordered",
")",
"MkdirAll",
"(",
"path",
"string",
")",
"{",
"var",
"paths",
"[",
"]",
"string",
"\n",
"for",
"<mask>",
"!=",
"\"",
"\"",
"{",
"paths",
"=",
"append",
"(",
"paths",
",",
"path",
")",
"\n",
"path",
",",
"_",
"=",
"split",
"(",
"path",
")",
"\n",
"}",
"\n",
"for",
"i",
":=",
"len",
"(",
"paths",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
"{",
"o",
".",
"PutDir",
"(",
"paths",
"[",
"i",
"]",
")",
"\n",
"}",
"\n",
"}"
]
|
17,959 | all-17960 | [
"MiddlewareFunc",
"makes",
"TimerMiddleware",
"implement",
"the",
"Middleware",
"interface",
"."
]
| [
"func",
"(",
"mw",
"*",
"TimerMiddleware",
")",
"MiddlewareFunc",
"(",
"h",
"HandlerFunc",
")",
"HandlerFunc",
"{",
"return",
"func",
"(",
"w",
"ResponseWriter",
",",
"r",
"*",
"Request",
")",
"{",
"start",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"r",
".",
"Env",
"[",
"\"",
"\"",
"]",
"=",
"&",
"start",
"\n\n",
"// call the handler",
"h",
"(",
"w",
",",
"r",
")",
"\n\n",
"end",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"elapsed",
":=",
"end",
".",
"Sub",
"(",
"<mask>",
")",
"\n",
"r",
".",
"Env",
"[",
"\"",
"\"",
"]",
"=",
"&",
"elapsed",
"\n",
"}",
"\n",
"}"
]
|
17,960 | all-17961 | [
"EnsureSuffixF",
"is",
"the",
"filter",
"form",
"of",
"EnsureSuffix",
"."
]
| [
"func",
"EnsureSuffixF",
"(",
"suffix",
"string",
")",
"func",
"(",
"string",
")",
"string",
"{",
"return",
"func",
"(",
"s",
"string",
")",
"<mask>",
"{",
"return",
"EnsureSuffix",
"(",
"s",
",",
"suffix",
")",
"\n",
"}",
"\n",
"}"
]
|
17,961 | all-17962 | [
"Set",
"writes",
"the",
"given",
"item",
"unconditionally",
"."
]
| [
"func",
"Set",
"(",
"c",
"context",
".",
"Context",
",",
"item",
"*",
"Item",
")",
"error",
"{",
"return",
"singleError",
"(",
"set",
"(",
"c",
",",
"[",
"]",
"*",
"Item",
"{",
"item",
"}",
",",
"nil",
",",
"<mask>",
".",
"MemcacheSetRequest_SET",
")",
")",
"\n",
"}"
]
|
17,962 | all-17963 | [
"String",
"returns",
"a",
"human",
"readable",
"string",
"of",
"the",
"container",
"change",
"event"
]
| [
"func",
"(",
"event",
"*",
"DockerContainerChangeEvent",
")",
"String",
"(",
")",
"string",
"{",
"res",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"event",
".",
"Status",
".",
"String",
"(",
")",
",",
"event",
".",
"DockerID",
")",
"\n",
"res",
"+=",
"\"",
"\"",
"+",
"event",
".",
"Health",
".",
"Status",
".",
"String",
"(",
")",
"\n\n",
"if",
"event",
".",
"ExitCode",
"!=",
"nil",
"{",
"res",
"+=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"aws",
".",
"IntValue",
"(",
"event",
".",
"ExitCode",
")",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"event",
".",
"PortBindings",
")",
"!=",
"0",
"{",
"res",
"+=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"event",
".",
"PortBindings",
")",
"\n",
"}",
"\n\n",
"if",
"event",
".",
"Error",
"!=",
"nil",
"{",
"res",
"+=",
"\"",
"\"",
"+",
"event",
".",
"Error",
".",
"Error",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"event",
".",
"Volumes",
")",
"!=",
"0",
"{",
"res",
"+=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"event",
".",
"Volumes",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"event",
".",
"Labels",
")",
"!=",
"0",
"{",
"res",
"+=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"event",
".",
"Labels",
")",
"\n",
"}",
"\n\n",
"if",
"!",
"event",
".",
"CreatedAt",
".",
"IsZero",
"(",
")",
"{",
"res",
"+=",
"\"",
"\"",
"+",
"event",
".",
"CreatedAt",
".",
"String",
"(",
")",
"\n",
"}",
"\n",
"if",
"!",
"event",
".",
"StartedAt",
".",
"IsZero",
"(",
")",
"{",
"res",
"+=",
"\"",
"\"",
"+",
"event",
".",
"StartedAt",
".",
"<mask>",
"(",
")",
"\n",
"}",
"\n",
"if",
"!",
"event",
".",
"FinishedAt",
".",
"IsZero",
"(",
")",
"{",
"res",
"+=",
"\"",
"\"",
"+",
"event",
".",
"FinishedAt",
".",
"String",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"res",
"\n",
"}"
]
|
17,963 | all-17964 | [
"Calls",
"putPart",
"up",
"to",
"nTry",
"times",
"to",
"recover",
"from",
"transient",
"errors",
"."
]
| [
"func",
"(",
"lo",
"*",
"largeObject",
")",
"retryPutPart",
"(",
"part",
"*",
"part",
")",
"{",
"defer",
"lo",
".",
"wg",
".",
"Done",
"(",
")",
"\n",
"var",
"err",
"error",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"3",
";",
"i",
"++",
"{",
"time",
".",
"Sleep",
"(",
"time",
".",
"Duration",
"(",
"math",
".",
"Exp2",
"(",
"float64",
"(",
"i",
")",
")",
")",
"*",
"100",
"*",
"time",
".",
"Millisecond",
")",
"// exponential back-off",
"\n",
"err",
"=",
"lo",
".",
"putPart",
"(",
"part",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"lo",
".",
"bp",
".",
"give",
"<-",
"<mask>",
".",
"b",
"\n",
"return",
"\n",
"}",
"\n",
"lo",
".",
"logger",
".",
"Error",
"(",
"swiftLargeObjectLogTag",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"i",
",",
"part",
",",
"err",
")",
")",
"\n",
"}",
"\n",
"lo",
".",
"err",
"=",
"err",
"\n",
"}"
]
|
17,964 | all-17965 | [
"DrawFrame",
"paints",
"the",
"frame",
"without",
"changing",
"area",
"inside",
"it"
]
| [
"func",
"DrawFrame",
"(",
"x",
",",
"y",
",",
"w",
",",
"h",
"int",
",",
"border",
"BorderStyle",
")",
"{",
"var",
"chars",
"string",
"\n",
"if",
"border",
"==",
"BorderThick",
"{",
"chars",
"=",
"SysObject",
"(",
"ObjDoubleBorder",
")",
"\n",
"}",
"else",
"if",
"border",
"==",
"BorderThin",
"{",
"chars",
"=",
"SysObject",
"(",
"ObjSingleBorder",
")",
"\n",
"}",
"else",
"if",
"border",
"==",
"BorderNone",
"{",
"chars",
"=",
"\"",
"\"",
"\n",
"}",
"else",
"{",
"chars",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"parts",
":=",
"[",
"]",
"rune",
"(",
"chars",
")",
"\n",
"H",
",",
"V",
",",
"UL",
",",
"UR",
",",
"DL",
",",
"DR",
":=",
"parts",
"[",
"0",
"]",
",",
"parts",
"[",
"1",
"]",
",",
"parts",
"[",
"2",
"]",
",",
"parts",
"[",
"3",
"]",
",",
"parts",
"[",
"4",
"]",
",",
"parts",
"[",
"5",
"]",
"\n\n",
"if",
"InClipRect",
"(",
"x",
",",
"y",
")",
"{",
"putCharUnsafe",
"(",
"x",
",",
"y",
",",
"UL",
")",
"\n",
"}",
"\n",
"if",
"InClipRect",
"(",
"x",
"+",
"w",
"-",
"1",
",",
"y",
"+",
"h",
"-",
"1",
")",
"{",
"putCharUnsafe",
"(",
"x",
"+",
"w",
"-",
"1",
",",
"y",
"+",
"h",
"-",
"1",
",",
"DR",
")",
"\n",
"}",
"\n",
"if",
"InClipRect",
"(",
"x",
",",
"y",
"+",
"h",
"-",
"1",
")",
"{",
"putCharUnsafe",
"(",
"x",
",",
"y",
"+",
"h",
"-",
"1",
",",
"DL",
")",
"\n",
"}",
"\n",
"if",
"InClipRect",
"(",
"x",
"+",
"w",
"-",
"1",
",",
"y",
")",
"{",
"putCharUnsafe",
"(",
"x",
"+",
"w",
"-",
"1",
",",
"y",
",",
"UR",
")",
"\n",
"}",
"\n\n",
"var",
"xx",
",",
"yy",
",",
"ww",
",",
"hh",
"int",
"\n",
"xx",
",",
"yy",
",",
"ww",
",",
"_",
"=",
"clip",
"(",
"x",
"+",
"1",
",",
"y",
",",
"w",
"-",
"2",
",",
"1",
")",
"\n",
"if",
"ww",
">",
"0",
"{",
"DrawHorizontalLine",
"(",
"xx",
",",
"yy",
",",
"ww",
",",
"H",
")",
"\n",
"}",
"\n",
"xx",
",",
"yy",
",",
"ww",
",",
"_",
"=",
"clip",
"(",
"x",
"+",
"1",
",",
"y",
"+",
"h",
"-",
"1",
",",
"w",
"-",
"2",
",",
"1",
")",
"\n",
"if",
"ww",
">",
"0",
"{",
"DrawHorizontalLine",
"(",
"xx",
",",
"yy",
",",
"ww",
",",
"H",
")",
"\n",
"}",
"\n",
"xx",
",",
"yy",
",",
"_",
",",
"hh",
"=",
"clip",
"(",
"x",
",",
"y",
"+",
"1",
",",
"1",
",",
"h",
"-",
"2",
")",
"\n",
"if",
"hh",
">",
"0",
"{",
"DrawVerticalLine",
"(",
"xx",
",",
"yy",
",",
"hh",
",",
"V",
")",
"\n",
"}",
"\n",
"xx",
",",
"yy",
",",
"_",
",",
"hh",
"=",
"<mask>",
"(",
"x",
"+",
"w",
"-",
"1",
",",
"y",
"+",
"1",
",",
"1",
",",
"h",
"-",
"2",
")",
"\n",
"if",
"hh",
">",
"0",
"{",
"DrawVerticalLine",
"(",
"xx",
",",
"yy",
",",
"hh",
",",
"V",
")",
"\n",
"}",
"\n",
"}"
]
|
17,965 | all-17966 | [
"SetText",
"sets",
"the",
"label",
"caption",
".",
"This",
"will",
"not",
"be",
"displayed",
"immediately",
".",
"SetText",
"shall",
"be",
"called",
"from",
"queue",
"context",
"."
]
| [
"func",
"(",
"l",
"*",
"Label",
")",
"SetText",
"(",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"l",
".",
"text",
"=",
"fmt",
".",
"Sprintf",
"(",
"<mask>",
",",
"args",
"...",
")",
"\n",
"}"
]
|
17,966 | all-17967 | [
"Properties",
"is",
"a",
"convenience",
"method",
"that",
"wraps",
"fetching",
"the",
"portgroup",
"MO",
"from",
"its",
"higher",
"-",
"level",
"object",
"."
]
| [
"func",
"Properties",
"(",
"pg",
"*",
"object",
".",
"DistributedVirtualPortgroup",
")",
"(",
"*",
"mo",
".",
"DistributedVirtualPortgroup",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"<mask>",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"provider",
".",
"DefaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"var",
"props",
"mo",
".",
"DistributedVirtualPortgroup",
"\n",
"if",
"err",
":=",
"pg",
".",
"Properties",
"(",
"ctx",
",",
"pg",
".",
"Reference",
"(",
")",
",",
"nil",
",",
"&",
"props",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"props",
",",
"nil",
"\n",
"}"
]
|
17,967 | all-17968 | [
"Add",
"adds",
"a",
"new",
"user",
".",
"Whether",
"UID",
"is",
"<",
"0",
"it",
"will",
"choose",
"the",
"first",
"id",
"available",
"in",
"the",
"range",
"set",
"in",
"the",
"system",
"configuration",
"."
]
| [
"func",
"(",
"u",
"*",
"User",
")",
"Add",
"(",
")",
"(",
"uid",
"int",
",",
"err",
"error",
")",
"{",
"loadConfig",
"(",
")",
"\n\n",
"user",
",",
"err",
":=",
"LookupUser",
"(",
"u",
".",
"Name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"_",
",",
"ok",
":=",
"err",
".",
"(",
"NoFoundError",
")",
";",
"!",
"ok",
"{",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"user",
"!=",
"nil",
"{",
"return",
"0",
",",
"ErrUserExist",
"\n",
"}",
"\n\n",
"if",
"u",
".",
"Name",
"==",
"\"",
"\"",
"{",
"return",
"0",
",",
"RequiredError",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"u",
".",
"Dir",
"==",
"\"",
"\"",
"{",
"return",
"0",
",",
"RequiredError",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"u",
".",
"Dir",
"==",
"config",
".",
"useradd",
".",
"HOME",
"{",
"return",
"0",
",",
"HomeError",
"(",
"config",
".",
"useradd",
".",
"HOME",
")",
"\n",
"}",
"\n",
"if",
"u",
".",
"Shell",
"==",
"\"",
"\"",
"{",
"return",
"0",
",",
"RequiredError",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"var",
"db",
"*",
"dbfile",
"\n",
"if",
"u",
".",
"UID",
"<",
"0",
"{",
"db",
",",
"uid",
",",
"err",
"=",
"nextUID",
"(",
"u",
".",
"addSystemUser",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"db",
".",
"close",
"(",
")",
"\n",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"u",
".",
"UID",
"=",
"uid",
"\n",
"}",
"else",
"{",
"db",
",",
"err",
"=",
"openDBFile",
"(",
"_USER_FILE",
",",
"os",
".",
"O_WRONLY",
"|",
"os",
".",
"O_APPEND",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"// Check if Id is unique.",
"_",
",",
"err",
"=",
"LookupUID",
"(",
"u",
".",
"UID",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"0",
",",
"IdUsedError",
"(",
"u",
".",
"UID",
")",
"\n",
"}",
"else",
"if",
"_",
",",
"ok",
":=",
"err",
".",
"(",
"NoFoundError",
")",
";",
"!",
"ok",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"u",
".",
"password",
"=",
"\"",
"\"",
"\n\n",
"_",
",",
"err",
"=",
"db",
".",
"file",
".",
"WriteString",
"(",
"u",
".",
"String",
"(",
")",
")",
"\n",
"err2",
":=",
"db",
".",
"<mask>",
"(",
")",
"\n",
"if",
"err2",
"!=",
"nil",
"&&",
"err",
"==",
"nil",
"{",
"err",
"=",
"err2",
"\n",
"}",
"\n",
"return",
"\n",
"}"
]
|
17,968 | all-17969 | [
"checkTaskState",
"inspects",
"the",
"state",
"of",
"all",
"containers",
"within",
"a",
"task",
"and",
"writes",
"their",
"state",
"to",
"the",
"managed",
"task",
"s",
"container",
"channel",
"."
]
| [
"func",
"(",
"engine",
"*",
"DockerTaskEngine",
")",
"checkTaskState",
"(",
"task",
"*",
"apitask",
".",
"Task",
")",
"{",
"defer",
"metrics",
".",
"MetricsEngineGlobal",
".",
"RecordTaskEngineMetric",
"(",
"\"",
"\"",
")",
"(",
")",
"\n",
"taskContainers",
",",
"ok",
":=",
"engine",
".",
"state",
".",
"ContainerMapByArn",
"(",
"task",
".",
"Arn",
")",
"\n",
"if",
"!",
"ok",
"{",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"task",
".",
"Arn",
")",
"\n",
"return",
"\n",
"}",
"\n",
"for",
"_",
",",
"container",
":=",
"range",
"task",
".",
"Containers",
"{",
"dockerContainer",
",",
"ok",
":=",
"taskContainers",
"[",
"container",
".",
"Name",
"]",
"\n",
"if",
"!",
"ok",
"{",
"continue",
"\n",
"}",
"\n",
"status",
",",
"metadata",
":=",
"engine",
".",
"<mask>",
".",
"DescribeContainer",
"(",
"engine",
".",
"ctx",
",",
"dockerContainer",
".",
"DockerID",
")",
"\n",
"engine",
".",
"tasksLock",
".",
"RLock",
"(",
")",
"\n",
"managedTask",
",",
"ok",
":=",
"engine",
".",
"managedTasks",
"[",
"task",
".",
"Arn",
"]",
"\n",
"engine",
".",
"tasksLock",
".",
"RUnlock",
"(",
")",
"\n\n",
"if",
"ok",
"{",
"managedTask",
".",
"emitDockerContainerChange",
"(",
"dockerContainerChange",
"{",
"container",
":",
"container",
",",
"event",
":",
"dockerapi",
".",
"DockerContainerChangeEvent",
"{",
"Status",
":",
"status",
",",
"DockerContainerMetadata",
":",
"metadata",
",",
"}",
",",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
]
|
17,969 | all-17970 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
]
| [
"func",
"(",
"t",
"*",
"Type",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"Type",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"TypeAppcache",
":",
"*",
"t",
"=",
"TypeAppcache",
"\n",
"case",
"TypeCookies",
":",
"*",
"t",
"=",
"TypeCookies",
"\n",
"case",
"TypeFileSystems",
":",
"*",
"t",
"=",
"TypeFileSystems",
"\n",
"case",
"TypeIndexeddb",
":",
"*",
"t",
"=",
"TypeIndexeddb",
"\n",
"case",
"TypeLocalStorage",
":",
"*",
"t",
"=",
"TypeLocalStorage",
"\n",
"case",
"TypeShaderCache",
":",
"*",
"t",
"=",
"TypeShaderCache",
"\n",
"case",
"TypeWebsql",
":",
"*",
"t",
"=",
"TypeWebsql",
"\n",
"case",
"TypeServiceWorkers",
":",
"*",
"t",
"=",
"TypeServiceWorkers",
"\n",
"case",
"TypeCacheStorage",
":",
"*",
"t",
"=",
"TypeCacheStorage",
"\n",
"case",
"TypeAll",
":",
"*",
"t",
"=",
"TypeAll",
"\n",
"case",
"TypeOther",
":",
"*",
"t",
"=",
"TypeOther",
"\n\n",
"<mask>",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
]
|
17,970 | all-17971 | [
"SequenceForAccount",
"implements",
"build",
".",
"SequenceProvider"
]
| [
"func",
"(",
"c",
"*",
"<mask>",
")",
"SequenceForAccount",
"(",
"accountID",
"string",
",",
")",
"(",
"xdr",
".",
"SequenceNumber",
",",
"error",
")",
"{",
"a",
",",
"err",
":=",
"c",
".",
"LoadAccount",
"(",
"accountID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"seq",
",",
"err",
":=",
"strconv",
".",
"ParseUint",
"(",
"a",
".",
"Sequence",
",",
"10",
",",
"64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"xdr",
".",
"SequenceNumber",
"(",
"seq",
")",
",",
"nil",
"\n",
"}"
]
|
17,971 | all-17972 | [
"DesiredTerminal",
"returns",
"true",
"if",
"the",
"secret",
"s",
"desired",
"status",
"is",
"REMOVED"
]
| [
"func",
"(",
"secret",
"*",
"SSMSecretResource",
")",
"DesiredTerminal",
"(",
")",
"bool",
"{",
"secret",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"<mask>",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"secret",
".",
"desiredStatusUnsafe",
"==",
"resourcestatus",
".",
"ResourceStatus",
"(",
"SSMSecretRemoved",
")",
"\n",
"}"
]
|
17,972 | all-17973 | [
"decodeOwnersMdConfig",
"will",
"parse",
"the",
"yaml",
"header",
"if",
"it",
"exists",
"and",
"unmarshal",
"it",
"into",
"a",
"singleOwnersConfig",
".",
"If",
"no",
"yaml",
"header",
"is",
"found",
"do",
"nothing",
"Returns",
"an",
"error",
"if",
"the",
"file",
"cannot",
"be",
"read",
"or",
"the",
"yaml",
"header",
"is",
"found",
"but",
"cannot",
"be",
"unmarshalled",
"."
]
| [
"func",
"decodeOwnersMdConfig",
"(",
"<mask>",
"string",
",",
"config",
"*",
"SimpleConfig",
")",
"error",
"{",
"fileBytes",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"// Parse the yaml header from the top of the file. Will return an empty string if regex does not match.",
"meta",
":=",
"mdStructuredHeaderRegex",
".",
"FindString",
"(",
"string",
"(",
"fileBytes",
")",
")",
"\n\n",
"// Unmarshal the yaml header into the config",
"return",
"yaml",
".",
"Unmarshal",
"(",
"[",
"]",
"byte",
"(",
"meta",
")",
",",
"&",
"config",
")",
"\n",
"}"
]
|
17,973 | all-17974 | [
"Enable",
"or",
"disable",
"a",
"generic",
"vertex",
"attribute",
"array"
]
| [
"func",
"DisableVertexArrayAttrib",
"(",
"vaobj",
"uint32",
",",
"<mask>",
"uint32",
")",
"{",
"C",
".",
"glowDisableVertexArrayAttrib",
"(",
"gpDisableVertexArrayAttrib",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"vaobj",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"index",
")",
")",
"\n",
"}"
]
|
17,974 | all-17975 | [
"RegisterReviewCommentEventHandler",
"registers",
"a",
"plugin",
"s",
"github",
".",
"ReviewCommentEvent",
"handler",
"."
]
| [
"func",
"RegisterReviewCommentEventHandler",
"(",
"name",
"string",
",",
"fn",
"ReviewCommentEventHandler",
",",
"help",
"HelpProvider",
")",
"{",
"pluginHelp",
"[",
"name",
"]",
"=",
"help",
"\n",
"reviewCommentEventHandlers",
"[",
"<mask>",
"]",
"=",
"fn",
"\n",
"}"
]
|
17,975 | all-17976 | [
"/",
"*",
"Update",
"configuration",
"or",
"if",
"restore",
":",
"snapshot",
"-",
"name",
"is",
"present",
"restore",
"the",
"named",
"snapshot"
]
| [
"func",
"containerPut",
"(",
"d",
"*",
"Daemon",
",",
"r",
"*",
"http",
".",
"Request",
")",
"Response",
"{",
"project",
":=",
"projectParam",
"(",
"r",
")",
"\n\n",
"// Get the container",
"name",
":=",
"mux",
".",
"Vars",
"(",
"r",
")",
"[",
"\"",
"\"",
"]",
"\n\n",
"// Handle requests targeted to a container on a different node",
"response",
",",
"err",
":=",
"ForwardedResponseIfContainerIsRemote",
"(",
"d",
",",
"r",
",",
"project",
",",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"response",
"!=",
"nil",
"{",
"return",
"response",
"\n",
"}",
"\n\n",
"c",
",",
"err",
":=",
"containerLoadByProjectAndName",
"(",
"d",
".",
"State",
"(",
")",
",",
"project",
",",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"NotFound",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"// Validate the ETag",
"etag",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"c",
".",
"Architecture",
"(",
")",
",",
"c",
".",
"LocalConfig",
"(",
")",
",",
"c",
".",
"LocalDevices",
"(",
")",
",",
"c",
".",
"IsEphemeral",
"(",
")",
",",
"c",
".",
"Profiles",
"(",
")",
"}",
"\n",
"err",
"=",
"util",
".",
"EtagCheck",
"(",
"r",
",",
"etag",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"PreconditionFailed",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"configRaw",
":=",
"api",
".",
"ContainerPut",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"NewDecoder",
"(",
"r",
".",
"Body",
")",
".",
"Decode",
"(",
"&",
"configRaw",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"BadRequest",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"architecture",
",",
"err",
":=",
"osarch",
".",
"ArchitectureId",
"(",
"configRaw",
".",
"Architecture",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"architecture",
"=",
"0",
"\n",
"}",
"\n\n",
"var",
"do",
"func",
"(",
"*",
"operation",
")",
"error",
"\n",
"var",
"opType",
"db",
".",
"OperationType",
"\n",
"if",
"configRaw",
".",
"Restore",
"==",
"\"",
"\"",
"{",
"// Update container configuration",
"do",
"=",
"func",
"(",
"op",
"*",
"operation",
")",
"error",
"{",
"args",
":=",
"db",
".",
"ContainerArgs",
"{",
"Architecture",
":",
"architecture",
",",
"Config",
":",
"configRaw",
".",
"Config",
",",
"Description",
":",
"configRaw",
".",
"Description",
",",
"Devices",
":",
"configRaw",
".",
"Devices",
",",
"Ephemeral",
":",
"configRaw",
".",
"Ephemeral",
",",
"Profiles",
":",
"configRaw",
".",
"Profiles",
",",
"Project",
":",
"project",
",",
"}",
"\n\n",
"// FIXME: should set to true when not migrating",
"err",
"=",
"c",
".",
"Update",
"(",
"args",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"opType",
"=",
"db",
".",
"OperationSnapshotUpdate",
"\n",
"}",
"else",
"{",
"// Snapshot Restore",
"do",
"=",
"func",
"(",
"op",
"*",
"operation",
")",
"error",
"{",
"return",
"containerSnapRestore",
"(",
"d",
".",
"State",
"(",
")",
",",
"project",
",",
"name",
",",
"configRaw",
".",
"Restore",
",",
"configRaw",
".",
"Stateful",
")",
"\n",
"}",
"\n\n",
"opType",
"=",
"db",
".",
"OperationSnapshotRestore",
"\n",
"}",
"\n\n",
"resources",
":=",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
"{",
"}",
"\n",
"resources",
"[",
"\"",
"\"",
"]",
"=",
"[",
"]",
"string",
"{",
"name",
"}",
"\n\n",
"op",
",",
"err",
":=",
"operationCreate",
"(",
"d",
".",
"cluster",
",",
"project",
",",
"operationClassTask",
",",
"opType",
",",
"resources",
",",
"nil",
",",
"do",
",",
"nil",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"InternalError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"OperationResponse",
"(",
"op",
")",
"\n",
"}"
]
|
17,976 | all-17977 | [
"Contains",
"reports",
"whether",
"rectangle",
"r",
"contains",
"point",
"p"
]
| [
"func",
"(",
"r",
"Rectangle",
")",
"Contains",
"(",
"p",
"Vec2",
")",
"bool",
"{",
"<mask>",
"r",
".",
"Min",
"[",
"0",
"]",
"<=",
"p",
"[",
"0",
"]",
"&&",
"p",
"[",
"0",
"]",
"<",
"r",
".",
"Max",
"[",
"0",
"]",
"&&",
"r",
".",
"Min",
"[",
"1",
"]",
"<=",
"p",
"[",
"1",
"]",
"&&",
"p",
"[",
"1",
"]",
"<",
"r",
".",
"Max",
"[",
"1",
"]",
"\n",
"}"
]
|
17,977 | all-17978 | [
"TotalSamples",
"returns",
"the",
"total",
"number",
"of",
"samples",
"in",
"the",
"series",
"within",
"a",
"matrix",
"."
]
| [
"func",
"(",
"m",
"Matrix",
")",
"TotalSamples",
"(",
")",
"int",
"{",
"numSamples",
":=",
"0",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"m",
"{",
"numSamples",
"+=",
"len",
"(",
"series",
".",
"Points",
")",
"\n",
"}",
"\n",
"return",
"numSamples",
"\n",
"}"
]
|
17,978 | all-17979 | [
"Units",
"returns",
"the",
"list",
"of",
"units",
"."
]
| [
"func",
"(",
"app",
"*",
"App",
")",
"Units",
"(",
")",
"(",
"[",
"]",
"provision",
".",
"Unit",
",",
"error",
")",
"{",
"prov",
",",
"err",
":=",
"app",
".",
"getProvisioner",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"provision",
".",
"Unit",
"{",
"}",
",",
"<mask>",
"\n",
"}",
"\n",
"units",
",",
"err",
":=",
"prov",
".",
"Units",
"(",
"app",
")",
"\n",
"if",
"units",
"==",
"nil",
"{",
"// This is unusual but was done because previously this method didn't",
"// return an error. This ensures we always return an empty list instead",
"// of nil to preserve compatibility with old clients.",
"units",
"=",
"[",
"]",
"provision",
".",
"Unit",
"{",
"}",
"\n",
"}",
"\n",
"return",
"units",
",",
"err",
"\n",
"}"
]
|
17,979 | all-17980 | [
"newClient",
"creates",
"client",
"for",
"connection",
"to",
"the",
"Ethereum",
"."
]
| [
"func",
"newClient",
"(",
"cfg",
"*",
"Config",
",",
"logger",
"log",
".",
"Logger",
")",
"(",
"*",
"client",
",",
"error",
")",
"{",
"logger2",
":=",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"cfg",
")",
"\n\n",
"u",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"cfg",
".",
"GethURL",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"context",
".",
"Background",
"(",
")",
")",
"\n\n",
"c",
":=",
"&",
"client",
"{",
"cancel",
":",
"cancel",
",",
"cfg",
":",
"cfg",
",",
"logger",
":",
"logger",
"}",
"\n\n",
"var",
"rpcClient",
"*",
"rpc",
".",
"Client",
"\n\n",
"switch",
"u",
".",
"Scheme",
"{",
"case",
"httpProtocol",
",",
"<mask>",
":",
"httpTransport",
":=",
"transport",
"(",
"cfg",
".",
"HTTPClient",
")",
"\n\n",
"rpcClient",
",",
"err",
"=",
"rpc",
".",
"DialHTTPWithClient",
"(",
"cfg",
".",
"GethURL",
",",
"httpClient",
"(",
"cfg",
".",
"HTTPClient",
",",
"httpTransport",
")",
")",
"\n\n",
"c",
".",
"httpTransport",
"=",
"httpTransport",
"\n",
"case",
"ws",
",",
"wss",
":",
"rpcClient",
",",
"err",
"=",
"rpc",
".",
"DialWebsocket",
"(",
"ctx",
",",
"cfg",
".",
"GethURL",
",",
"\"",
"\"",
")",
"\n",
"case",
"stdIO",
":",
"rpcClient",
",",
"err",
"=",
"rpc",
".",
"DialStdIO",
"(",
"ctx",
")",
"\n",
"case",
"ipc",
":",
"rpcClient",
",",
"err",
"=",
"rpc",
".",
"DialIPC",
"(",
"ctx",
",",
"cfg",
".",
"GethURL",
")",
"\n",
"default",
":",
"logger2",
".",
"Add",
"(",
"\"",
"\"",
",",
"u",
".",
"Scheme",
")",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"nil",
",",
"ErrURLScheme",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger2",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"nil",
",",
"ErrCreateClient",
"\n",
"}",
"\n\n",
"c",
".",
"client",
"=",
"ethclient",
".",
"NewClient",
"(",
"rpcClient",
")",
"\n",
"return",
"c",
",",
"nil",
"\n",
"}"
]
|
17,980 | all-17981 | [
"SetPathBytes",
"sets",
"cookie",
"path",
"."
]
| [
"func",
"(",
"c",
"*",
"Cookie",
")",
"SetPathBytes",
"(",
"path",
"[",
"]",
"byte",
")",
"{",
"c",
".",
"buf",
"=",
"append",
"(",
"c",
".",
"buf",
"[",
":",
"0",
"]",
",",
"path",
"...",
")",
"\n",
"c",
".",
"<mask>",
"=",
"normalizePath",
"(",
"c",
".",
"path",
",",
"c",
".",
"buf",
")",
"\n",
"}"
]
|
17,981 | all-17982 | [
"MatchElements",
"succeeds",
"if",
"each",
"element",
"of",
"a",
"slice",
"matches",
"the",
"element",
"matcher",
"it",
"maps",
"to",
"through",
"the",
"id",
"function",
".",
"It",
"can",
"ignore",
"extra",
"elements",
"and",
"/",
"or",
"missing",
"elements",
".",
"idFn",
":",
"=",
"func",
"(",
"element",
"interface",
"{}",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"%v",
"element",
")",
"}",
"Expect",
"(",
"[]",
"string",
"{",
"a",
"b",
"c",
"}",
")",
".",
"To",
"(",
"MatchElements",
"(",
"idFn",
"IgnoreExtras",
"Elements",
"{",
"a",
":",
"Equal",
"(",
"a",
")",
"b",
":",
"Equal",
"(",
"b",
")",
"}",
"))",
"Expect",
"(",
"[]",
"string",
"{",
"a",
"c",
"}",
")",
".",
"To",
"(",
"MatchElements",
"(",
"idFn",
"IgnoreMissing",
"Elements",
"{",
"a",
":",
"Equal",
"(",
"a",
")",
"b",
":",
"Equal",
"(",
"b",
")",
"c",
":",
"Equal",
"(",
"c",
")",
"d",
":",
"Equal",
"(",
"d",
")",
"}",
"))"
]
| [
"func",
"MatchElements",
"(",
"identifier",
"Identifier",
",",
"<mask>",
"Options",
",",
"elements",
"Elements",
")",
"types",
".",
"GomegaMatcher",
"{",
"return",
"&",
"ElementsMatcher",
"{",
"Identifier",
":",
"identifier",
",",
"Elements",
":",
"elements",
",",
"IgnoreExtras",
":",
"options",
"&",
"IgnoreExtras",
"!=",
"0",
",",
"IgnoreMissing",
":",
"options",
"&",
"IgnoreMissing",
"!=",
"0",
",",
"AllowDuplicates",
":",
"options",
"&",
"AllowDuplicates",
"!=",
"0",
",",
"}",
"\n",
"}"
]
|
17,982 | all-17983 | [
"expandDVSTrafficShapingPolicyIngress",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"DVSTrafficShapingPolicy",
"for",
"ingress",
"traffic",
"."
]
| [
"func",
"expandDVSTrafficShapingPolicyIngress",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"*",
"<mask>",
".",
"DVSTrafficShapingPolicy",
"{",
"obj",
":=",
"&",
"types",
".",
"DVSTrafficShapingPolicy",
"{",
"Enabled",
":",
"structure",
".",
"GetBoolPolicy",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"AverageBandwidth",
":",
"structure",
".",
"GetLongPolicy",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"PeakBandwidth",
":",
"structure",
".",
"GetLongPolicy",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"BurstSize",
":",
"structure",
".",
"GetLongPolicy",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"}",
"\n\n",
"if",
"structure",
".",
"AllFieldsEmpty",
"(",
"obj",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"obj",
"\n",
"}"
]
|
17,983 | all-17984 | [
"IsOfSystem",
"indicates",
"whether",
"it",
"is",
"a",
"system",
"user",
"."
]
| [
"func",
"(",
"u",
"*",
"<mask>",
")",
"IsOfSystem",
"(",
")",
"bool",
"{",
"//loadConfig()",
"if",
"u",
".",
"UID",
">",
"config",
".",
"login",
".",
"SYS_UID_MIN",
"&&",
"u",
".",
"UID",
"<",
"config",
".",
"login",
".",
"SYS_UID_MAX",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
]
|
17,984 | all-17985 | [
"At",
"returns",
"a",
"color",
"value",
"at",
"(",
"x",
"y",
")",
".",
"Note",
"that",
"this",
"must",
"not",
"be",
"called",
"until",
"context",
"is",
"available",
"."
]
| [
"func",
"(",
"i",
"*",
"Image",
")",
"At",
"(",
"x",
",",
"y",
"int",
")",
"(",
"byte",
",",
"byte",
",",
"byte",
",",
"<mask>",
")",
"{",
"w",
",",
"h",
":=",
"i",
".",
"image",
".",
"Size",
"(",
")",
"\n",
"if",
"x",
"<",
"0",
"||",
"y",
"<",
"0",
"||",
"w",
"<=",
"x",
"||",
"h",
"<=",
"y",
"{",
"return",
"0",
",",
"0",
",",
"0",
",",
"0",
"\n",
"}",
"\n\n",
"i",
".",
"readPixelsFromGPUIfNeeded",
"(",
")",
"\n\n",
"// Even after readPixelsFromGPU, basePixels might be nil when OpenGL error happens.",
"if",
"i",
".",
"basePixels",
"==",
"nil",
"{",
"return",
"0",
",",
"0",
",",
"0",
",",
"0",
"\n",
"}",
"\n\n",
"idx",
":=",
"4",
"*",
"x",
"+",
"4",
"*",
"y",
"*",
"w",
"\n",
"return",
"i",
".",
"basePixels",
".",
"At",
"(",
"idx",
")",
",",
"i",
".",
"basePixels",
".",
"At",
"(",
"idx",
"+",
"1",
")",
",",
"i",
".",
"basePixels",
".",
"At",
"(",
"idx",
"+",
"2",
")",
",",
"i",
".",
"basePixels",
".",
"At",
"(",
"idx",
"+",
"3",
")",
"\n",
"}"
]
|
17,985 | all-17986 | [
"GetUseMarkup",
"is",
"a",
"wrapper",
"around",
"gtk_label_get_use_markup",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetUseMarkup",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_label_get_use_markup",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"gobool",
"(",
"c",
")",
"\n",
"}"
]
|
17,986 | all-17987 | [
"URL",
"returns",
"a",
"copy",
"of",
"the",
"target",
"s",
"URL",
"."
]
| [
"func",
"(",
"t",
"*",
"Target",
")",
"URL",
"(",
")",
"*",
"url",
".",
"URL",
"{",
"params",
":=",
"url",
".",
"Values",
"{",
"}",
"\n\n",
"for",
"k",
",",
"v",
":=",
"range",
"t",
".",
"params",
"{",
"params",
"[",
"k",
"]",
"=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"v",
")",
")",
"\n",
"copy",
"(",
"params",
"[",
"k",
"]",
",",
"v",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"l",
":=",
"range",
"t",
".",
"labels",
"{",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"l",
".",
"Name",
",",
"model",
".",
"ParamLabelPrefix",
")",
"{",
"continue",
"\n",
"}",
"\n",
"ks",
":=",
"l",
".",
"Name",
"[",
"len",
"(",
"model",
".",
"ParamLabelPrefix",
")",
":",
"]",
"\n\n",
"if",
"len",
"(",
"params",
"[",
"ks",
"]",
")",
">",
"0",
"{",
"params",
"[",
"ks",
"]",
"[",
"0",
"]",
"=",
"l",
".",
"Value",
"\n",
"}",
"else",
"{",
"params",
"[",
"ks",
"]",
"=",
"[",
"]",
"string",
"{",
"l",
".",
"Value",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"&",
"<mask>",
".",
"URL",
"{",
"Scheme",
":",
"t",
".",
"labels",
".",
"Get",
"(",
"model",
".",
"SchemeLabel",
")",
",",
"Host",
":",
"t",
".",
"labels",
".",
"Get",
"(",
"model",
".",
"AddressLabel",
")",
",",
"Path",
":",
"t",
".",
"labels",
".",
"Get",
"(",
"model",
".",
"MetricsPathLabel",
")",
",",
"RawQuery",
":",
"params",
".",
"Encode",
"(",
")",
",",
"}",
"\n",
"}"
]
|
17,987 | all-17988 | [
"flattenVMwareIpfixConfig",
"reads",
"various",
"fields",
"from",
"a",
"VMwareIpfixConfig",
"into",
"the",
"passed",
"in",
"ResourceData",
"."
]
| [
"func",
"flattenVMwareIpfixConfig",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"types",
".",
"VMwareIpfixConfig",
")",
"error",
"{",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"ActiveFlowTimeout",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"CollectorIpAddress",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"CollectorPort",
")",
"\n",
"d",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"obj",
".",
"IdleFlowTimeout",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"InternalFlowsOnly",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"ObservationDomainId",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"SamplingRate",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,988 | all-17989 | [
"bind",
"a",
"range",
"within",
"a",
"buffer",
"object",
"to",
"a",
"transform",
"feedback",
"buffer",
"object"
]
| [
"func",
"TransformFeedbackBufferRange",
"(",
"xfb",
"uint32",
",",
"index",
"uint32",
",",
"buffer",
"uint32",
",",
"offset",
"int",
",",
"size",
"int",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpTransformFeedbackBufferRange",
",",
"5",
",",
"uintptr",
"(",
"xfb",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"buffer",
")",
",",
"uintptr",
"(",
"offset",
")",
",",
"uintptr",
"(",
"size",
")",
",",
"0",
")",
"\n",
"}"
]
|
17,989 | all-17990 | [
"Do",
"executes",
"DOM",
".",
"setInspectedNode",
"against",
"the",
"provided",
"context",
"."
]
| [
"func",
"(",
"p",
"*",
"SetInspectedNodeParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetInspectedNode",
",",
"p",
",",
"nil",
")",
"\n",
"}"
]
|
17,990 | all-17991 | [
"startOutboundSpan",
"creates",
"a",
"new",
"tracing",
"span",
"to",
"represent",
"the",
"outbound",
"RPC",
"call",
".",
"If",
"the",
"context",
"already",
"contains",
"a",
"span",
"it",
"will",
"be",
"used",
"as",
"a",
"parent",
"otherwise",
"a",
"new",
"root",
"span",
"is",
"created",
".",
"If",
"the",
"tracer",
"supports",
"Zipkin",
"-",
"style",
"trace",
"IDs",
"then",
"call",
".",
"callReq",
".",
"Tracing",
"is",
"initialized",
"with",
"those",
"IDs",
".",
"Otherwise",
"it",
"is",
"assigned",
"random",
"values",
"."
]
| [
"func",
"(",
"c",
"*",
"Connection",
")",
"startOutboundSpan",
"(",
"ctx",
"context",
".",
"Context",
",",
"serviceName",
",",
"methodName",
"string",
",",
"call",
"*",
"OutboundCall",
",",
"startTime",
"time",
".",
"Time",
")",
"opentracing",
".",
"Span",
"{",
"var",
"parent",
"opentracing",
".",
"SpanContext",
"// ok to be nil",
"\n",
"if",
"s",
":=",
"opentracing",
".",
"SpanFromContext",
"(",
"ctx",
")",
";",
"s",
"!=",
"nil",
"{",
"parent",
"=",
"s",
".",
"Context",
"(",
")",
"\n",
"}",
"\n",
"span",
":=",
"c",
".",
"Tracer",
"(",
")",
".",
"StartSpan",
"(",
"methodName",
",",
"opentracing",
".",
"ChildOf",
"(",
"parent",
")",
",",
"opentracing",
".",
"StartTime",
"(",
"startTime",
")",
",",
")",
"\n",
"if",
"isTracingDisabled",
"(",
"ctx",
")",
"{",
"ext",
".",
"SamplingPriority",
".",
"Set",
"(",
"span",
",",
"0",
")",
"\n",
"}",
"\n",
"ext",
".",
"SpanKindRPCClient",
".",
"Set",
"(",
"span",
")",
"\n",
"ext",
".",
"PeerService",
".",
"Set",
"(",
"span",
",",
"serviceName",
")",
"\n",
"c",
".",
"setPeerHostPort",
"(",
"span",
")",
"\n",
"span",
".",
"SetTag",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"callReq",
".",
"Headers",
"[",
"ArgScheme",
"]",
")",
"\n",
"var",
"injectable",
"injectableSpan",
"\n",
"if",
"err",
":=",
"injectable",
".",
"initFromOpenTracing",
"(",
"span",
")",
";",
"err",
"==",
"nil",
"{",
"call",
".",
"callReq",
".",
"Tracing",
"=",
"Span",
"(",
"injectable",
")",
"\n",
"}",
"else",
"{",
"call",
".",
"callReq",
".",
"Tracing",
".",
"initRandom",
"(",
")",
"\n",
"}",
"\n",
"return",
"span",
"\n",
"}"
]
|
17,991 | all-17992 | [
"The",
"network",
"structs",
"and",
"functions"
]
| [
"func",
"networkLoadByName",
"(",
"s",
"*",
"state",
".",
"State",
",",
"name",
"string",
")",
"(",
"*",
"network",
",",
"error",
")",
"{",
"id",
",",
"dbInfo",
",",
"err",
":=",
"s",
".",
"Cluster",
".",
"NetworkGet",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"n",
":=",
"network",
"{",
"state",
":",
"s",
",",
"<mask>",
":",
"id",
",",
"name",
":",
"name",
",",
"description",
":",
"dbInfo",
".",
"Description",
",",
"config",
":",
"dbInfo",
".",
"Config",
"}",
"\n\n",
"return",
"&",
"n",
",",
"nil",
"\n",
"}"
]
|
17,992 | all-17993 | [
"NewSystemError",
"defines",
"a",
"new",
"SystemError",
"with",
"a",
"code",
"and",
"message"
]
| [
"func",
"NewSystemError",
"(",
"code",
"SystemErrCode",
",",
"msg",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"SystemError",
"{",
"code",
":",
"<mask>",
",",
"msg",
":",
"fmt",
".",
"Sprintf",
"(",
"msg",
",",
"args",
"...",
")",
"}",
"\n",
"}"
]
|
17,993 | all-17994 | [
"DoDeadline",
"calls",
"DoDeadline",
"on",
"the",
"least",
"loaded",
"client"
]
| [
"func",
"(",
"cc",
"*",
"LBClient",
")",
"DoDeadline",
"(",
"req",
"*",
"Request",
",",
"resp",
"*",
"Response",
",",
"deadline",
"time",
".",
"Time",
")",
"error",
"{",
"return",
"<mask>",
".",
"get",
"(",
")",
".",
"DoDeadline",
"(",
"req",
",",
"resp",
",",
"deadline",
")",
"\n",
"}"
]
|
17,994 | all-17995 | [
"LogTypes",
"returns",
"all",
"of",
"the",
"valid",
"log",
"types",
"that",
"may",
"be",
"used",
"with",
"a",
"LogReader",
"."
]
| [
"func",
"(",
"p",
"*",
"Page",
")",
"LogTypes",
"(",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"types",
",",
"err",
":=",
"p",
".",
"<mask>",
".",
"GetLogTypes",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"types",
",",
"nil",
"\n",
"}"
]
|
17,995 | all-17996 | [
"UnmarshalJSON",
"overrides",
"the",
"logic",
"for",
"parsing",
"the",
"JSON",
"-",
"encoded",
"ResourceStatus",
"data"
]
| [
"func",
"(",
"cs",
"*",
"CgroupStatus",
")",
"UnmarshalJSON",
"(",
"b",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"strings",
".",
"ToLower",
"(",
"string",
"(",
"b",
")",
")",
"==",
"\"",
"\"",
"{",
"*",
"cs",
"=",
"CgroupStatusNone",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"b",
"[",
"0",
"]",
"!=",
"'\"'",
"||",
"b",
"[",
"len",
"(",
"b",
")",
"-",
"1",
"]",
"!=",
"'\"'",
"{",
"*",
"cs",
"=",
"CgroupStatusNone",
"\n",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
"+",
"string",
"(",
"b",
")",
")",
"\n",
"}",
"\n\n",
"strStatus",
":=",
"string",
"(",
"b",
"[",
"1",
":",
"len",
"(",
"b",
")",
"-",
"1",
"]",
")",
"\n",
"stat",
",",
"ok",
":=",
"cgroupStatusMap",
"[",
"strStatus",
"]",
"\n",
"if",
"!",
"ok",
"{",
"*",
"<mask>",
"=",
"CgroupStatusNone",
"\n",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"*",
"cs",
"=",
"stat",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,996 | all-17997 | [
"replayWAL",
"replays",
"WAL",
"entries",
"into",
"the",
"raft",
"instance",
"."
]
| [
"func",
"(",
"rc",
"*",
"raftNode",
")",
"replayWAL",
"(",
")",
"*",
"wal",
".",
"WAL",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"rc",
".",
"id",
")",
"\n",
"snapshot",
":=",
"rc",
".",
"loadSnapshot",
"(",
")",
"\n",
"w",
":=",
"rc",
".",
"openWAL",
"(",
"snapshot",
")",
"\n",
"_",
",",
"st",
",",
"ents",
",",
"err",
":=",
"w",
".",
"ReadAll",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"<mask>",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"rc",
".",
"raftStorage",
"=",
"raft",
".",
"NewMemoryStorage",
"(",
")",
"\n",
"if",
"snapshot",
"!=",
"nil",
"{",
"rc",
".",
"raftStorage",
".",
"ApplySnapshot",
"(",
"*",
"snapshot",
")",
"\n",
"}",
"\n",
"rc",
".",
"raftStorage",
".",
"SetHardState",
"(",
"st",
")",
"\n\n",
"// append to storage so raft starts at the right place in log",
"rc",
".",
"raftStorage",
".",
"Append",
"(",
"ents",
")",
"\n",
"// send nil once lastIndex is published so client knows commit channel is current",
"if",
"len",
"(",
"ents",
")",
">",
"0",
"{",
"rc",
".",
"lastIndex",
"=",
"ents",
"[",
"len",
"(",
"ents",
")",
"-",
"1",
"]",
".",
"Index",
"\n",
"}",
"else",
"{",
"rc",
".",
"commitC",
"<-",
"nil",
"\n",
"}",
"\n",
"return",
"w",
"\n",
"}"
]
|
17,997 | all-17998 | [
"ConfigureStdLevelLogger",
"configures",
"the",
"standard",
"level",
"logger",
"with",
"the",
"default",
"log",
"level",
".",
"By",
"providing",
"a",
"different",
"io",
".",
"Writer",
"and",
"prefix",
"you",
"can",
"control",
"the",
"logging",
"output",
"(",
"testing",
"etc",
")"
]
| [
"func",
"ConfigureStdLevelLogger",
"(",
"defaultLoglevel",
"LogLevel",
",",
"w",
"io",
".",
"Writer",
",",
"context",
"string",
")",
"{",
"logFunc",
"=",
"func",
"(",
"level",
"LogLevel",
",",
"context",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"defaultLoglevel",
">",
"level",
"{",
"return",
"\n",
"}",
"\n\n",
"if",
"w",
"!=",
"nil",
"{",
"log",
".",
"SetOutput",
"(",
"w",
")",
"\n",
"}",
"\n\n",
"if",
"context",
"==",
"\"",
"\"",
"{",
"args",
"=",
"prepend",
"(",
"args",
",",
"strings",
".",
"Join",
"(",
"[",
"]",
"string",
"{",
"level",
".",
"String",
"(",
")",
",",
"\"",
"\"",
"}",
",",
"\"",
"\"",
")",
")",
"\n",
"}",
"else",
"{",
"args",
"=",
"prepend",
"(",
"args",
",",
"level",
".",
"String",
"(",
")",
",",
"\"",
"\"",
",",
"context",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"log",
".",
"Print",
"(",
"args",
"...",
")",
"\n",
"}",
"\n\n",
"loglnFunc",
"=",
"func",
"(",
"level",
"LogLevel",
",",
"context",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"defaultLoglevel",
">",
"level",
"{",
"return",
"\n",
"}",
"\n\n",
"if",
"w",
"!=",
"nil",
"{",
"log",
".",
"SetOutput",
"(",
"w",
")",
"\n",
"}",
"\n\n",
"if",
"context",
"==",
"\"",
"\"",
"{",
"args",
"=",
"prepend",
"(",
"args",
",",
"level",
".",
"String",
"(",
")",
")",
"\n",
"}",
"else",
"{",
"args",
"=",
"prepend",
"(",
"args",
",",
"level",
".",
"String",
"(",
")",
",",
"context",
")",
"\n",
"}",
"\n\n",
"log",
".",
"Println",
"(",
"args",
"...",
")",
"\n",
"}",
"\n\n",
"logfFunc",
"=",
"func",
"(",
"level",
"LogLevel",
",",
"context",
"string",
",",
"msg",
"string",
",",
"args",
"...",
"<mask>",
"{",
"}",
")",
"{",
"if",
"defaultLoglevel",
">",
"level",
"{",
"return",
"\n",
"}",
"\n\n",
"if",
"w",
"!=",
"nil",
"{",
"log",
".",
"SetOutput",
"(",
"w",
")",
"\n",
"}",
"\n\n",
"if",
"context",
"==",
"\"",
"\"",
"{",
"log",
".",
"Printf",
"(",
"strings",
".",
"Join",
"(",
"[",
"]",
"string",
"{",
"level",
".",
"String",
"(",
")",
",",
"msg",
"}",
",",
"\"",
"\"",
")",
",",
"args",
"...",
")",
"\n",
"}",
"else",
"{",
"log",
".",
"Printf",
"(",
"strings",
".",
"Join",
"(",
"[",
"]",
"string",
"{",
"level",
".",
"String",
"(",
")",
",",
"context",
",",
"msg",
"}",
",",
"\"",
"\"",
")",
",",
"args",
"...",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"Level",
"=",
"NewStdLevelLogger",
"(",
"context",
")",
"\n",
"}"
]
|
17,998 | all-17999 | [
"readBoshRelease",
"creates",
"an",
"initialized",
"boshRelease",
"instance",
"from",
"the",
"specifed",
".",
"tgz",
"reader"
]
| [
"func",
"readBoshRelease",
"(",
"rr",
"io",
".",
"Reader",
")",
"(",
"*",
"BoshRelease",
",",
"error",
")",
"{",
"release",
":=",
"&",
"BoshRelease",
"{",
"JobManifests",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"enaml",
".",
"JobManifest",
")",
",",
"}",
"\n",
"err",
":=",
"release",
".",
"readBoshRelease",
"(",
"rr",
")",
"\n",
"return",
"<mask>",
",",
"err",
"\n",
"}"
]
|
17,999 | all-18000 | [
"NewClientFromEnv",
"creates",
"a",
"client",
"based",
"on",
"environment",
"variables",
"."
]
| [
"func",
"NewClientFromEnv",
"(",
"storageRoot",
"string",
")",
"(",
"c",
"Client",
",",
"err",
"error",
")",
"{",
"storageBackend",
",",
"ok",
":=",
"os",
".",
"LookupEnv",
"(",
"StorageBackendEnvVar",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"switch",
"storageBackend",
"{",
"case",
"Amazon",
":",
"c",
",",
"err",
"=",
"NewAmazonClientFromEnv",
"(",
")",
"\n",
"case",
"Google",
":",
"c",
",",
"err",
"=",
"NewGoogleClientFromEnv",
"(",
")",
"\n",
"<mask>",
"Microsoft",
":",
"c",
",",
"err",
"=",
"NewMicrosoftClientFromEnv",
"(",
")",
"\n",
"case",
"Minio",
":",
"c",
",",
"err",
"=",
"NewMinioClientFromEnv",
"(",
")",
"\n",
"case",
"Local",
":",
"c",
",",
"err",
"=",
"NewLocalClient",
"(",
"storageRoot",
")",
"\n",
"}",
"\n",
"switch",
"{",
"case",
"err",
"!=",
"nil",
":",
"return",
"nil",
",",
"err",
"\n",
"case",
"c",
"!=",
"nil",
":",
"return",
"TracingObjClient",
"(",
"storageBackend",
",",
"c",
")",
",",
"nil",
"\n",
"default",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"storageBackend",
")",
"\n",
"}",
"\n",
"}"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.