id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
11,100 | all-11101 | [
"GroupBy",
"creates",
"a",
"GroupBy",
"query",
"with",
"the",
"given",
"Rows",
"queries"
] | [
"func",
"(",
"idx",
"*",
"<mask>",
")",
"GroupBy",
"(",
"rowsQueries",
"...",
"*",
"PQLRowsQuery",
")",
"*",
"PQLBaseQuery",
"{",
"if",
"len",
"(",
"rowsQueries",
")",
"<",
"1",
"{",
"return",
"NewPQLBaseQuery",
"(",
"\"",
"\"",
",",
"idx",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"text",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strings",
".",
"Join",
"(",
"serializeGroupBy",
"(",
"rowsQueries",
"...",
")",
",",
"\"",
"\"",
")",
")",
"\n",
"return",
"NewPQLBaseQuery",
"(",
"text",
",",
"idx",
",",
"nil",
")",
"\n",
"}"
] |
11,101 | all-11102 | [
"WriteFloat32",
"writes",
"a",
"float32",
"."
] | [
"func",
"(",
"w",
"*",
"<mask>",
")",
"WriteFloat32",
"(",
"f",
"float32",
")",
"{",
"if",
"w",
".",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"bits",
":=",
"math",
".",
"Float32bits",
"(",
"f",
")",
"\n",
"binary",
".",
"LittleEndian",
".",
"PutUint32",
"(",
"w",
".",
"b",
"[",
":",
"4",
"]",
",",
"bits",
")",
"\n",
"w",
".",
"wr",
".",
"Write",
"(",
"w",
".",
"b",
"[",
":",
"4",
"]",
")",
"\n",
"}"
] |
11,102 | all-11103 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventSecurityStateChanged",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoSecurity2",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
11,103 | all-11104 | [
"WriteGzipLevel",
"writes",
"gzipped",
"p",
"to",
"w",
"using",
"the",
"given",
"compression",
"level",
"and",
"returns",
"the",
"number",
"of",
"compressed",
"bytes",
"written",
"to",
"w",
".",
"Supported",
"compression",
"levels",
"are",
":",
"*",
"CompressNoCompression",
"*",
"CompressBestSpeed",
"*",
"CompressBestCompression",
"*",
"CompressDefaultCompression",
"*",
"CompressHuffmanOnly"
] | [
"func",
"WriteGzipLevel",
"(",
"w",
"<mask>",
".",
"Writer",
",",
"p",
"[",
"]",
"byte",
",",
"level",
"int",
")",
"(",
"int",
",",
"error",
")",
"{",
"switch",
"w",
".",
"(",
"type",
")",
"{",
"case",
"*",
"byteSliceWriter",
",",
"*",
"bytes",
".",
"Buffer",
",",
"*",
"bytebufferpool",
".",
"ByteBuffer",
":",
"// These writers don't block, so we can just use stacklessWriteGzip",
"ctx",
":=",
"&",
"compressCtx",
"{",
"w",
":",
"w",
",",
"p",
":",
"p",
",",
"level",
":",
"level",
",",
"}",
"\n",
"stacklessWriteGzip",
"(",
"ctx",
")",
"\n",
"return",
"len",
"(",
"p",
")",
",",
"nil",
"\n",
"default",
":",
"zw",
":=",
"acquireStacklessGzipWriter",
"(",
"w",
",",
"level",
")",
"\n",
"n",
",",
"err",
":=",
"zw",
".",
"Write",
"(",
"p",
")",
"\n",
"releaseStacklessGzipWriter",
"(",
"zw",
",",
"level",
")",
"\n",
"return",
"n",
",",
"err",
"\n",
"}",
"\n",
"}"
] |
11,104 | all-11105 | [
"HasLogQuery",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"q",
"*",
"QueryValueRequest",
")",
"HasLogQuery",
"(",
")",
"bool",
"{",
"if",
"q",
"!=",
"nil",
"&&",
"q",
".",
"LogQuery",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
11,105 | all-11106 | [
"Vec3Mad",
"performs",
"a",
"scaled",
"vector",
"addition",
".",
"v1",
"+",
"(",
"v2",
"*",
"s",
")",
"dest",
"[",
"out",
"]",
"The",
"result",
"vector",
".",
"[",
"(",
"x",
"y",
"z",
")",
"]",
"v1",
"[",
"in",
"]",
"The",
"base",
"vector",
".",
"[",
"(",
"x",
"y",
"z",
")",
"]",
"v2",
"[",
"in",
"]",
"The",
"vector",
"to",
"scale",
"and",
"add",
"to"
] | [
"func",
"Vec3Mad",
"(",
"dest",
",",
"v1",
",",
"v2",
"Vec3",
",",
"s",
"float32",
")",
"{",
"dest",
"[",
"0",
"]",
"=",
"v1",
"[",
"0",
"]",
"+",
"v2",
"[",
"0",
"]",
"*",
"s",
"\n",
"<mask>",
"[",
"1",
"]",
"=",
"v1",
"[",
"1",
"]",
"+",
"v2",
"[",
"1",
"]",
"*",
"s",
"\n",
"dest",
"[",
"2",
"]",
"=",
"v1",
"[",
"2",
"]",
"+",
"v2",
"[",
"2",
"]",
"*",
"s",
"\n",
"}"
] |
11,106 | all-11107 | [
"AttachVolume",
"attaches",
"a",
"volume"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"AttachVolume",
"(",
"dcid",
"string",
",",
"srvid",
"string",
",",
"volid",
"string",
")",
"(",
"*",
"Volume",
",",
"error",
")",
"{",
"data",
":=",
"struct",
"{",
"ID",
"string",
"`json:\"id,omitempty\"`",
"\n",
"}",
"{",
"volid",
",",
"}",
"\n",
"url",
":=",
"serverVolumeColPath",
"(",
"dcid",
",",
"srvid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"Volume",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"<mask>",
".",
"Post",
"(",
"url",
",",
"data",
",",
"ret",
",",
"http",
".",
"StatusAccepted",
")",
"\n\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
11,107 | all-11108 | [
"UnmarshalJSON",
"for",
"TaskVolume",
"determines",
"the",
"name",
"and",
"volume",
"type",
"and",
"unmarshals",
"it",
"into",
"the",
"appropriate",
"HostVolume",
"fulfilling",
"interfaces"
] | [
"func",
"(",
"tv",
"*",
"TaskVolume",
")",
"UnmarshalJSON",
"(",
"b",
"[",
"]",
"byte",
")",
"error",
"{",
"// Format: {name: volumeName, host: HostVolume, dockerVolumeConfiguration {}}",
"intermediate",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"json",
".",
"RawMessage",
")",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"b",
",",
"&",
"intermediate",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"name",
",",
"ok",
":=",
"intermediate",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"name",
",",
"&",
"tv",
".",
"Name",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"volumeType",
",",
"ok",
":=",
"intermediate",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"!",
"ok",
"{",
"volumeType",
"=",
"[",
"]",
"byte",
"(",
"`\"host\"`",
")",
"\n",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"volumeType",
",",
"&",
"tv",
".",
"Type",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"switch",
"tv",
".",
"Type",
"{",
"case",
"HostVolumeType",
":",
"return",
"tv",
".",
"unmarshalHostVolume",
"(",
"intermediate",
"[",
"\"",
"\"",
"]",
")",
"\n",
"<mask>",
"DockerVolumeType",
":",
"return",
"tv",
".",
"unmarshalDockerVolume",
"(",
"intermediate",
"[",
"\"",
"\"",
"]",
")",
"\n",
"default",
":",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"tv",
".",
"Type",
")",
"\n",
"}",
"\n",
"}"
] |
11,108 | all-11109 | [
"expandHostNetworkTrafficShapingPolicy",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"HostNetworkTrafficShapingPolicy",
"."
] | [
"func",
"expandHostNetworkTrafficShapingPolicy",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"*",
"types",
".",
"HostNetworkTrafficShapingPolicy",
"{",
"obj",
":=",
"&",
"<mask>",
".",
"HostNetworkTrafficShapingPolicy",
"{",
"AverageBandwidth",
":",
"int64",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
")",
",",
"BurstSize",
":",
"int64",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
")",
",",
"PeakBandwidth",
":",
"int64",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
")",
",",
"}",
"\n",
"if",
"v",
",",
"ok",
":=",
"d",
".",
"GetOkExists",
"(",
"\"",
"\"",
")",
";",
"ok",
"{",
"obj",
".",
"Enabled",
"=",
"structure",
".",
"BoolPtr",
"(",
"v",
".",
"(",
"bool",
")",
")",
"\n",
"}",
"\n",
"return",
"obj",
"\n",
"}"
] |
11,109 | all-11110 | [
"TagResource",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockSecretsManagerAPI",
")",
"TagResource",
"(",
"arg0",
"*",
"secretsmanager",
".",
"TagResourceInput",
")",
"(",
"*",
"secretsmanager",
".",
"TagResourceOutput",
",",
"error",
")",
"{",
"<mask>",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"secretsmanager",
".",
"TagResourceOutput",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
11,110 | all-11111 | [
"GetMediaURLs",
"gets",
"the",
"URLs",
"of",
"any",
"media",
"for",
"this",
"message",
".",
"This",
"uses",
"threads",
"to",
"retrieve",
"all",
"URLs",
"simultaneously",
";",
"if",
"retrieving",
"any",
"URL",
"fails",
"we",
"return",
"an",
"error",
"for",
"the",
"entire",
"request",
".",
"The",
"data",
"can",
"be",
"used",
"to",
"filter",
"the",
"list",
"of",
"returned",
"Media",
"as",
"described",
"here",
":",
"https",
":",
"//",
"www",
".",
"twilio",
".",
"com",
"/",
"docs",
"/",
"api",
"/",
"rest",
"/",
"media#list",
"-",
"get",
"-",
"filters",
"As",
"of",
"October",
"2016",
"only",
"10",
"MediaURLs",
"are",
"permitted",
"per",
"message",
".",
"No",
"attempt",
"is",
"made",
"to",
"page",
"through",
"media",
"resources",
";",
"omit",
"the",
"PageSize",
"parameter",
"in",
"data",
"or",
"set",
"it",
"to",
"a",
"value",
"greater",
"than",
"10",
"to",
"retrieve",
"all",
"resources",
"."
] | [
"func",
"(",
"m",
"*",
"MessageService",
")",
"GetMediaURLs",
"(",
"ctx",
"<mask>",
".",
"Context",
",",
"sid",
"string",
",",
"data",
"url",
".",
"Values",
")",
"(",
"[",
"]",
"*",
"url",
".",
"URL",
",",
"error",
")",
"{",
"page",
",",
"err",
":=",
"m",
".",
"client",
".",
"Media",
".",
"GetPage",
"(",
"ctx",
",",
"sid",
",",
"data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"page",
".",
"MediaList",
")",
"==",
"0",
"{",
"urls",
":=",
"make",
"(",
"[",
"]",
"*",
"url",
".",
"URL",
",",
"0",
",",
"0",
")",
"\n",
"return",
"urls",
",",
"nil",
"\n",
"}",
"\n",
"urls",
":=",
"make",
"(",
"[",
"]",
"*",
"url",
".",
"URL",
",",
"len",
"(",
"page",
".",
"MediaList",
")",
")",
"\n",
"errs",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"len",
"(",
"page",
".",
"MediaList",
")",
")",
"\n",
"var",
"wg",
"sync",
".",
"WaitGroup",
"\n",
"wg",
".",
"Add",
"(",
"len",
"(",
"page",
".",
"MediaList",
")",
")",
"\n",
"for",
"i",
",",
"media",
":=",
"range",
"page",
".",
"MediaList",
"{",
"go",
"func",
"(",
"i",
"int",
",",
"media",
"*",
"Media",
")",
"{",
"url",
",",
"err",
":=",
"m",
".",
"client",
".",
"Media",
".",
"GetURL",
"(",
"ctx",
",",
"sid",
",",
"media",
".",
"Sid",
")",
"\n",
"urls",
"[",
"i",
"]",
"=",
"url",
"\n",
"errs",
"[",
"i",
"]",
"=",
"err",
"\n",
"wg",
".",
"Done",
"(",
")",
"\n",
"}",
"(",
"i",
",",
"media",
")",
"\n",
"}",
"\n",
"wg",
".",
"Wait",
"(",
")",
"\n",
"// todo - we could probably return more quickly in the result of a failure.",
"for",
"_",
",",
"err",
":=",
"range",
"errs",
"{",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"urls",
",",
"nil",
"\n",
"}"
] |
11,111 | all-11112 | [
"Fuzz",
"the",
"metric",
"selector",
"parser",
"."
] | [
"func",
"FuzzParseMetricSelector",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"int",
"{",
"_",
",",
"err",
":=",
"ParseMetricSelector",
"(",
"string",
"(",
"in",
")",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"fuzzInteresting",
"\n",
"}",
"\n\n",
"return",
"fuzzMeh",
"\n",
"}"
] |
11,112 | all-11113 | [
"GetEventStream",
"streams",
"events",
"in",
"text",
"/",
"event",
"-",
"stream",
"format",
".",
"GET",
"/",
"api",
"/",
"event",
"/",
"stream",
"/",
"{",
"channel",
"}"
] | [
"func",
"GetEventStream",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"<mask>",
".",
"Request",
")",
"{",
"SendEvents",
"(",
"w",
",",
"r",
",",
"getChannels",
"(",
"r",
")",
")",
"\n",
"}"
] |
11,113 | all-11114 | [
"specify",
"storage",
"for",
"a",
"two",
"-",
"dimensional",
"multisample",
"array",
"texture"
] | [
"func",
"TextureStorage3DMultisample",
"(",
"texture",
"uint32",
",",
"samples",
"int32",
",",
"internalformat",
"uint32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"depth",
"int32",
",",
"fixedsamplelocations",
"bool",
")",
"{",
"C",
".",
"glowTextureStorage3DMultisample",
"(",
"gpTextureStorage3DMultisample",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"texture",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"samples",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"internalformat",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"depth",
")",
",",
"(",
"C",
".",
"GLboolean",
")",
"(",
"boolToInt",
"(",
"fixedsamplelocations",
")",
")",
")",
"\n",
"}"
] |
11,114 | all-11115 | [
"bind",
"a",
"buffer",
"object",
"to",
"an",
"indexed",
"buffer",
"target"
] | [
"func",
"BindBufferBase",
"(",
"target",
"uint32",
",",
"index",
"uint32",
",",
"buffer",
"uint32",
")",
"{",
"C",
".",
"glowBindBufferBase",
"(",
"gpBindBufferBase",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"index",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"buffer",
")",
")",
"\n",
"}"
] |
11,115 | all-11116 | [
"GetByName",
"queries",
"the",
"database",
"to",
"find",
"an",
"app",
"identified",
"by",
"the",
"given",
"name",
"."
] | [
"func",
"GetByName",
"(",
"name",
"string",
")",
"(",
"*",
"App",
",",
"error",
")",
"{",
"var",
"app",
"App",
"\n",
"conn",
",",
"err",
":=",
"<mask>",
".",
"Conn",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"conn",
".",
"Close",
"(",
")",
"\n",
"err",
"=",
"conn",
".",
"Apps",
"(",
")",
".",
"Find",
"(",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"name",
"}",
")",
".",
"One",
"(",
"&",
"app",
")",
"\n",
"if",
"err",
"==",
"mgo",
".",
"ErrNotFound",
"{",
"return",
"nil",
",",
"appTypes",
".",
"ErrAppNotFound",
"\n",
"}",
"\n",
"return",
"&",
"app",
",",
"err",
"\n",
"}"
] |
11,116 | all-11117 | [
"String",
"defines",
"a",
"string",
"flag",
"with",
"specified",
"name",
"default",
"value",
"and",
"usage",
"string",
".",
"The",
"return",
"value",
"is",
"the",
"address",
"of",
"a",
"string",
"variable",
"that",
"stores",
"the",
"value",
"of",
"the",
"flag",
"."
] | [
"func",
"String",
"(",
"name",
"string",
",",
"<mask>",
"string",
",",
"usage",
"string",
")",
"*",
"string",
"{",
"return",
"EnvironmentFlags",
".",
"String",
"(",
"name",
",",
"value",
",",
"usage",
")",
"\n",
"}"
] |
11,117 | all-11118 | [
"NewNotifier",
"builds",
"a",
"Notifier",
"that",
"can",
"be",
"used",
"to",
"notify",
"other",
"peers",
"using",
"the",
"given",
"policy",
"."
] | [
"func",
"NewNotifier",
"(",
"state",
"*",
"state",
".",
"State",
",",
"cert",
"*",
"shared",
".",
"CertInfo",
",",
"policy",
"NotifierPolicy",
")",
"(",
"Notifier",
",",
"error",
")",
"{",
"address",
",",
"err",
":=",
"<mask>",
".",
"ClusterAddress",
"(",
"state",
".",
"Node",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Fast-track the case where we're not clustered at all.",
"if",
"address",
"==",
"\"",
"\"",
"{",
"nullNotifier",
":=",
"func",
"(",
"func",
"(",
"lxd",
".",
"ContainerServer",
")",
"error",
")",
"error",
"{",
"return",
"nil",
"}",
"\n",
"return",
"nullNotifier",
",",
"nil",
"\n",
"}",
"\n\n",
"peers",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"err",
"=",
"state",
".",
"Cluster",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"db",
".",
"ClusterTx",
")",
"error",
"{",
"offlineThreshold",
",",
"err",
":=",
"tx",
".",
"NodeOfflineThreshold",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"nodes",
",",
"err",
":=",
"tx",
".",
"Nodes",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"node",
":=",
"range",
"nodes",
"{",
"if",
"node",
".",
"Address",
"==",
"address",
"||",
"node",
".",
"Address",
"==",
"\"",
"\"",
"{",
"continue",
"// Exclude ourselves",
"\n",
"}",
"\n",
"if",
"node",
".",
"IsOffline",
"(",
"offlineThreshold",
")",
"{",
"switch",
"policy",
"{",
"case",
"NotifyAll",
":",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"node",
".",
"Address",
")",
"\n",
"case",
"NotifyAlive",
":",
"continue",
"// Just skip this node",
"\n",
"}",
"\n",
"}",
"\n",
"peers",
"=",
"append",
"(",
"peers",
",",
"node",
".",
"Address",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"notifier",
":=",
"func",
"(",
"hook",
"func",
"(",
"lxd",
".",
"ContainerServer",
")",
"error",
")",
"error",
"{",
"errs",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"len",
"(",
"peers",
")",
")",
"\n",
"wg",
":=",
"sync",
".",
"WaitGroup",
"{",
"}",
"\n",
"wg",
".",
"Add",
"(",
"len",
"(",
"peers",
")",
")",
"\n",
"for",
"i",
",",
"address",
":=",
"range",
"peers",
"{",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"address",
")",
"\n",
"go",
"func",
"(",
"i",
"int",
",",
"address",
"string",
")",
"{",
"defer",
"wg",
".",
"Done",
"(",
")",
"\n",
"client",
",",
"err",
":=",
"Connect",
"(",
"address",
",",
"cert",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errs",
"[",
"i",
"]",
"=",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"address",
")",
"\n",
"return",
"\n",
"}",
"\n",
"err",
"=",
"hook",
"(",
"client",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errs",
"[",
"i",
"]",
"=",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"address",
")",
"\n",
"}",
"\n",
"}",
"(",
"i",
",",
"address",
")",
"\n",
"}",
"\n",
"wg",
".",
"Wait",
"(",
")",
"\n",
"// TODO: aggregate all errors?",
"for",
"i",
",",
"err",
":=",
"range",
"errs",
"{",
"if",
"err",
"!=",
"nil",
"{",
"// FIXME: unfortunately the LXD client currently does not",
"// provide a way to differentiate between errors",
"if",
"isClientConnectionError",
"(",
"err",
")",
"&&",
"policy",
"==",
"NotifyAlive",
"{",
"logger",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"peers",
"[",
"i",
"]",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"notifier",
",",
"nil",
"\n",
"}"
] |
11,118 | all-11119 | [
"GetAuthProviderX509CertURLOk",
"returns",
"a",
"tuple",
"with",
"the",
"AuthProviderX509CertURL",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"i",
"*",
"IntegrationGCPCreateRequest",
")",
"GetAuthProviderX509CertURLOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"i",
"==",
"nil",
"||",
"i",
".",
"AuthProviderX509CertURL",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"i",
".",
"AuthProviderX509CertURL",
",",
"true",
"\n",
"}"
] |
11,119 | all-11120 | [
"Push",
"pushes",
"a",
"segment",
"id",
"onto",
"the",
"segment",
"stack",
"."
] | [
"func",
"(",
"s",
"*",
"SegmentStack",
")",
"Push",
"(",
"<mask>",
"int64",
")",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"s",
".",
"s",
"=",
"append",
"(",
"s",
".",
"s",
",",
"id",
")",
"\n",
"}"
] |
11,120 | all-11121 | [
"ApplyHeaderExtract",
"reads",
"the",
"value",
"of",
"the",
"given",
"header",
"."
] | [
"func",
"(",
"d",
"*",
"Displayer",
")",
"ApplyHeaderExtract",
"(",
"header",
"string",
")",
"error",
"{",
"d",
".",
"RawOutput",
"=",
"d",
".",
"response",
".",
"Header",
".",
"Get",
"(",
"<mask>",
")",
"\n",
"if",
"d",
".",
"RawOutput",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"header",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
11,121 | all-11122 | [
"Normalize",
"returns",
"normalized",
"URL",
"string",
".",
"Behavior",
":",
"1",
".",
"Remove",
"unnecessary",
"host",
"dots",
".",
"2",
".",
"Remove",
"default",
"port",
"(",
"http",
":",
"//",
"localhost",
":",
"80",
"becomes",
"http",
":",
"//",
"localhost",
")",
".",
"3",
".",
"Remove",
"duplicate",
"slashes",
".",
"4",
".",
"Remove",
"unnecessary",
"dots",
"from",
"path",
".",
"5",
".",
"Sort",
"query",
"parameters",
".",
"6",
".",
"Decode",
"host",
"IP",
"into",
"decimal",
"numbers",
".",
"7",
".",
"Handle",
"escape",
"values",
".",
"8",
".",
"Decode",
"Punycode",
"domains",
"into",
"UTF8",
"representation",
"."
] | [
"func",
"Normalize",
"(",
"u",
"*",
"url",
".",
"URL",
")",
"(",
"string",
",",
"error",
")",
"{",
"host",
",",
"port",
",",
"err",
":=",
"SplitHostPort",
"(",
"u",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"checkHost",
"(",
"host",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"// Decode Punycode.",
"host",
",",
"err",
"=",
"idna",
".",
"ToUnicode",
"(",
"host",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"u",
".",
"Host",
"=",
"strings",
".",
"ToLower",
"(",
"<mask>",
")",
"\n",
"if",
"port",
"!=",
"\"",
"\"",
"{",
"u",
".",
"Host",
"+=",
"\"",
"\"",
"+",
"port",
"\n",
"}",
"\n",
"u",
".",
"Scheme",
"=",
"strings",
".",
"ToLower",
"(",
"u",
".",
"Scheme",
")",
"\n\n",
"return",
"purell",
".",
"NormalizeURL",
"(",
"u",
",",
"normalizeFlags",
")",
",",
"nil",
"\n",
"}"
] |
11,122 | all-11123 | [
"Strs",
"takes",
"a",
"list",
"of",
"Go",
"strings",
"(",
"with",
"or",
"without",
"null",
"-",
"termination",
")",
"and",
"returns",
"their",
"C",
"counterpart",
".",
"The",
"returned",
"free",
"function",
"must",
"be",
"called",
"once",
"you",
"are",
"done",
"using",
"the",
"strings",
"in",
"order",
"to",
"free",
"the",
"memory",
".",
"If",
"no",
"strings",
"are",
"provided",
"as",
"a",
"parameter",
"this",
"function",
"will",
"panic",
"."
] | [
"func",
"Strs",
"(",
"strs",
"...",
"string",
")",
"(",
"cstrs",
"*",
"*",
"uint8",
",",
"free",
"func",
"(",
")",
")",
"{",
"if",
"len",
"(",
"strs",
")",
"==",
"0",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Allocate a contiguous array large enough to hold all the strings' contents.",
"n",
":=",
"0",
"\n",
"for",
"i",
":=",
"range",
"strs",
"{",
"n",
"+=",
"len",
"(",
"strs",
"[",
"i",
"]",
")",
"\n",
"}",
"\n",
"<mask>",
":=",
"C",
".",
"malloc",
"(",
"C",
".",
"size_t",
"(",
"n",
")",
")",
"\n\n",
"// Copy all the strings into data.",
"dataSlice",
":=",
"*",
"(",
"*",
"[",
"]",
"byte",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"reflect",
".",
"SliceHeader",
"{",
"Data",
":",
"uintptr",
"(",
"data",
")",
",",
"Len",
":",
"n",
",",
"Cap",
":",
"n",
",",
"}",
")",
")",
"\n",
"css",
":=",
"make",
"(",
"[",
"]",
"*",
"uint8",
",",
"len",
"(",
"strs",
")",
")",
"// Populated with pointers to each string.",
"\n",
"offset",
":=",
"0",
"\n",
"for",
"i",
":=",
"range",
"strs",
"{",
"copy",
"(",
"dataSlice",
"[",
"offset",
":",
"offset",
"+",
"len",
"(",
"strs",
"[",
"i",
"]",
")",
"]",
",",
"strs",
"[",
"i",
"]",
"[",
":",
"]",
")",
"// Copy strs[i] into proper data location.",
"\n",
"css",
"[",
"i",
"]",
"=",
"(",
"*",
"uint8",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"dataSlice",
"[",
"offset",
"]",
")",
")",
"// Set a pointer to it.",
"\n",
"offset",
"+=",
"len",
"(",
"strs",
"[",
"i",
"]",
")",
"\n",
"}",
"\n\n",
"return",
"(",
"*",
"*",
"uint8",
")",
"(",
"&",
"css",
"[",
"0",
"]",
")",
",",
"func",
"(",
")",
"{",
"C",
".",
"free",
"(",
"data",
")",
"}",
"\n",
"}"
] |
11,123 | all-11124 | [
"Storage",
"functions"
] | [
"func",
"(",
"c",
"*",
"containerLXC",
")",
"Storage",
"(",
")",
"<mask>",
"{",
"if",
"c",
".",
"storage",
"==",
"nil",
"{",
"c",
".",
"initStorage",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"c",
".",
"storage",
"\n",
"}"
] |
11,124 | all-11125 | [
"LoggingService",
"is",
"an",
"option",
"that",
"sets",
"the",
"Google",
"API",
"logging",
"service",
"to",
"use",
"."
] | [
"func",
"LoggingService",
"(",
"service",
"*",
"logging",
".",
"Service",
")",
"Option",
"{",
"return",
"func",
"(",
"sh",
"*",
"StackdriverHook",
")",
"error",
"{",
"sh",
".",
"<mask>",
"=",
"service",
".",
"Entries",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
11,125 | all-11126 | [
"retrieveUnexportedField",
"uses",
"unsafe",
"to",
"forcibly",
"retrieve",
"any",
"field",
"from",
"a",
"struct",
"such",
"that",
"the",
"value",
"has",
"read",
"-",
"write",
"permissions",
".",
"The",
"parent",
"struct",
"v",
"must",
"be",
"addressable",
"while",
"f",
"must",
"be",
"a",
"StructField",
"describing",
"the",
"field",
"to",
"retrieve",
"."
] | [
"func",
"retrieveUnexportedField",
"(",
"v",
"reflect",
".",
"Value",
",",
"f",
"reflect",
".",
"StructField",
")",
"reflect",
".",
"Value",
"{",
"return",
"reflect",
".",
"NewAt",
"(",
"f",
".",
"<mask>",
",",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"UnsafeAddr",
"(",
")",
"+",
"f",
".",
"Offset",
")",
")",
".",
"Elem",
"(",
")",
"\n",
"}"
] |
11,126 | all-11127 | [
"newLocalPeer",
"returns",
"a",
"usable",
"LocalPeer",
"."
] | [
"func",
"newLocalPeer",
"(",
"name",
"PeerName",
",",
"nickName",
"string",
",",
"router",
"*",
"Router",
")",
"*",
"localPeer",
"{",
"actionChan",
":=",
"make",
"(",
"chan",
"localPeerAction",
",",
"ChannelSize",
")",
"\n",
"peer",
":=",
"&",
"localPeer",
"{",
"Peer",
":",
"newPeer",
"(",
"<mask>",
",",
"nickName",
",",
"randomPeerUID",
"(",
")",
",",
"0",
",",
"randomPeerShortID",
"(",
")",
")",
",",
"router",
":",
"router",
",",
"actionChan",
":",
"actionChan",
",",
"}",
"\n",
"go",
"peer",
".",
"actorLoop",
"(",
"actionChan",
")",
"\n",
"return",
"peer",
"\n",
"}"
] |
11,127 | all-11128 | [
"DefaultProtector",
"constructs",
"a",
"middleware",
"that",
"by",
"default",
"limits",
"the",
"request",
"body",
"size",
"to",
"8M",
"and",
"sets",
"a",
"basic",
"CORS",
"configuration",
".",
"Note",
":",
"Place",
"the",
"protector",
"as",
"early",
"as",
"possible",
"in",
"the",
"handler",
"chain",
"."
] | [
"func",
"DefaultProtector",
"(",
")",
"func",
"(",
"http",
".",
"Handler",
")",
"<mask>",
".",
"Handler",
"{",
"return",
"NewProtector",
"(",
"\"",
"\"",
",",
"cors",
".",
"Options",
"{",
"AllowedOrigins",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"AllowedHeaders",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
"}",
",",
"AllowedMethods",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
"}",
",",
"}",
")",
"\n",
"}"
] |
11,128 | all-11129 | [
"GetCursor",
"is",
"a",
"wrapper",
"around",
"gtk_tree_view_get_cursor",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TreeView",
")",
"GetCursor",
"(",
")",
"(",
"p",
"*",
"TreePath",
",",
"c",
"*",
"TreeViewColumn",
")",
"{",
"var",
"path",
"*",
"C",
".",
"GtkTreePath",
"\n",
"var",
"col",
"*",
"C",
".",
"GtkTreeViewColumn",
"\n\n",
"C",
".",
"gtk_tree_view_get_cursor",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"path",
",",
"&",
"col",
")",
"\n\n",
"if",
"path",
"!=",
"nil",
"{",
"p",
"=",
"&",
"TreePath",
"{",
"path",
"}",
"\n",
"runtime",
".",
"SetFinalizer",
"(",
"p",
",",
"(",
"*",
"TreePath",
")",
".",
"free",
")",
"\n",
"}",
"\n\n",
"if",
"col",
"!=",
"nil",
"{",
"c",
"=",
"wrapTreeViewColumn",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
")",
")",
")",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
11,129 | all-11130 | [
"toKey",
"returns",
"context",
"/",
"namespace",
"/",
"name"
] | [
"func",
"toKey",
"(",
"ctx",
",",
"namespace",
",",
"<mask>",
"string",
")",
"string",
"{",
"return",
"strings",
".",
"Join",
"(",
"[",
"]",
"string",
"{",
"ctx",
",",
"namespace",
",",
"name",
"}",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
11,130 | all-11131 | [
"releasePreviousFrament",
"releases",
"the",
"last",
"fragment",
"returned",
"by",
"the",
"reader",
"if",
"it",
"s",
"still",
"around",
".",
"This",
"operation",
"is",
"idempotent",
"."
] | [
"func",
"(",
"r",
"*",
"reqResReader",
")",
"releasePreviousFragment",
"(",
")",
"{",
"fragment",
":=",
"r",
".",
"previousFragment",
"\n",
"r",
".",
"previousFragment",
"=",
"nil",
"\n",
"if",
"fragment",
"!=",
"nil",
"{",
"fragment",
".",
"<mask>",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
11,131 | all-11132 | [
"Set",
"sets",
"the",
"components",
"of",
"the",
"vector",
"from",
"a",
"string",
"of",
"the",
"form",
"float",
"float"
] | [
"func",
"(",
"v",
"*",
"Vec",
")",
"<mask>",
"(",
"s",
"string",
")",
"error",
"{",
"if",
"_",
",",
"err",
":=",
"fmt",
".",
"Sscanf",
"(",
"s",
",",
"\"",
"\"",
",",
"&",
"v",
".",
"X",
",",
"&",
"v",
".",
"Y",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"s",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
11,132 | all-11133 | [
"GetLineWrap",
"is",
"a",
"wrapper",
"around",
"gtk_label_get_line_wrap",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetLineWrap",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_label_get_line_wrap",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
11,133 | all-11134 | [
"APIVersion",
"returns",
"the",
"client",
"api",
"version"
] | [
"func",
"(",
"dg",
"*",
"dockerGoClient",
")",
"APIVersion",
"(",
")",
"(",
"dockerclient",
".",
"DockerVersion",
",",
"error",
")",
"{",
"<mask>",
",",
"err",
":=",
"dg",
".",
"sdkDockerClient",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"dg",
".",
"sdkClientFactory",
".",
"FindClientAPIVersion",
"(",
"client",
")",
",",
"nil",
"\n",
"}"
] |
11,134 | all-11135 | [
"Digest",
"returns",
"the",
"a",
"digest",
"of",
"a",
"docker",
"manifest",
"with",
"any",
"necessary",
"implied",
"transformations",
"like",
"stripping",
"v1s1",
"signatures",
"."
] | [
"func",
"Digest",
"(",
"manifest",
"[",
"]",
"<mask>",
")",
"(",
"digest",
".",
"Digest",
",",
"error",
")",
"{",
"if",
"GuessMIMEType",
"(",
"manifest",
")",
"==",
"DockerV2Schema1SignedMediaType",
"{",
"sig",
",",
"err",
":=",
"libtrust",
".",
"ParsePrettySignature",
"(",
"manifest",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"manifest",
",",
"err",
"=",
"sig",
".",
"Payload",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// Coverage: This should never happen, libtrust's Payload() can fail only if joseBase64UrlDecode() fails, on a string",
"// that libtrust itself has josebase64UrlEncode()d",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"digest",
".",
"FromBytes",
"(",
"manifest",
")",
",",
"nil",
"\n",
"}"
] |
11,135 | all-11136 | [
"Respond",
"without",
"doing",
"anything",
".",
"This",
"endpoint",
"is",
"used",
"to",
"check",
"that",
"the",
"service",
"is",
"up",
".",
"See",
"#ping"
] | [
"func",
"(",
"events",
"*",
"Events",
")",
"Ping",
"(",
")",
"error",
"{",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"<mask>",
")",
"\n",
"_",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
11,136 | all-11137 | [
"GetNetworkMode",
"returns",
"the",
"network",
"mode",
"of",
"the",
"container"
] | [
"func",
"(",
"c",
"*",
"Container",
")",
"GetNetworkMode",
"(",
")",
"string",
"{",
"c",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"<mask>",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"c",
".",
"NetworkModeUnsafe",
"\n",
"}"
] |
11,137 | all-11138 | [
"Getbool",
"returns",
"the",
"boolean",
"value",
"for",
"a",
"given",
"key",
"."
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"Getbool",
"(",
"key",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"value",
",",
"found",
":=",
"c",
".",
"<mask>",
"[",
"key",
"]",
";",
"found",
"{",
"return",
"strconv",
".",
"ParseBool",
"(",
"value",
")",
"\n",
"}",
"\n",
"return",
"false",
",",
"ErrKey",
"\n",
"}"
] |
11,138 | all-11139 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"PropertyDescriptor",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime15",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
11,139 | all-11140 | [
"New",
"creates",
"a",
"new",
"Clientset",
"for",
"the",
"given",
"RESTClient",
"."
] | [
"func",
"New",
"(",
"c",
"<mask>",
".",
"Interface",
")",
"*",
"Clientset",
"{",
"var",
"cs",
"Clientset",
"\n",
"cs",
".",
"tsuruV1",
"=",
"tsuruv1",
".",
"New",
"(",
"c",
")",
"\n\n",
"cs",
".",
"DiscoveryClient",
"=",
"discovery",
".",
"NewDiscoveryClient",
"(",
"c",
")",
"\n",
"return",
"&",
"cs",
"\n",
"}"
] |
11,140 | all-11141 | [
"GetOrderByOk",
"returns",
"a",
"tuple",
"with",
"the",
"OrderBy",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TileDefRequest",
")",
"GetOrderByOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"OrderBy",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"OrderBy",
",",
"true",
"\n",
"}"
] |
11,141 | all-11142 | [
"Hash",
"generates",
"the",
"hash",
"for",
"the",
"current",
"period",
"and",
"client",
"."
] | [
"func",
"(",
"h",
"PerMinuteHasher",
")",
"Hash",
"(",
"id",
"string",
")",
"string",
"{",
"if",
"h",
".",
"Clock",
"==",
"nil",
"{",
"h",
".",
"Clock",
"=",
"clock",
".",
"New",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"+",
"\"",
"\"",
"+",
"h",
".",
"Clock",
".",
"Now",
"(",
")",
".",
"Format",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
11,142 | all-11143 | [
"This",
"endpoint",
"triggers",
"a",
"defined",
"hook",
"with",
"a",
"valid",
"token",
".",
"The",
"HTTP",
"payload",
"must",
"match",
"the",
"hooks",
"triggerSchema",
".",
"If",
"it",
"does",
"it",
"is",
"provided",
"as",
"the",
"payload",
"property",
"of",
"the",
"JSON",
"-",
"e",
"context",
"used",
"to",
"render",
"the",
"task",
"template",
".",
"See",
"#triggerHookWithToken"
] | [
"func",
"(",
"hooks",
"*",
"Hooks",
")",
"TriggerHookWithToken",
"(",
"hookGroupId",
",",
"hookId",
",",
"token",
"string",
",",
"payload",
"*",
"TriggerHookRequest",
")",
"(",
"*",
"TriggerHookResponse",
",",
"error",
")",
"{",
"cd",
":=",
"tcclient",
".",
"<mask>",
"(",
"*",
"hooks",
")",
"\n",
"responseObject",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"payload",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"hookGroupId",
")",
"+",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"hookId",
")",
"+",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"token",
")",
",",
"new",
"(",
"TriggerHookResponse",
")",
",",
"nil",
")",
"\n",
"return",
"responseObject",
".",
"(",
"*",
"TriggerHookResponse",
")",
",",
"err",
"\n",
"}"
] |
11,143 | all-11144 | [
"BudgetAlertLocator",
"builds",
"a",
"locator",
"from",
"the",
"given",
"href",
"."
] | [
"func",
"(",
"api",
"*",
"API",
")",
"BudgetAlertLocator",
"(",
"href",
"<mask>",
")",
"*",
"BudgetAlertLocator",
"{",
"return",
"&",
"BudgetAlertLocator",
"{",
"Href",
"(",
"href",
")",
",",
"api",
"}",
"\n",
"}"
] |
11,144 | all-11145 | [
"GetPathPaymentOp",
"retrieves",
"the",
"PathPaymentOp",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"OperationBody",
")",
"GetPathPaymentOp",
"(",
")",
"(",
"result",
"PathPaymentOp",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"PathPaymentOp",
"\n",
"<mask>",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
11,145 | all-11146 | [
"HasViz",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TileDef",
")",
"HasViz",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"Viz",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
11,146 | all-11147 | [
"GenADODB",
"generates",
"a",
"adodb",
"DSN",
"from",
"the",
"passed",
"URL",
"."
] | [
"func",
"GenADODB",
"(",
"u",
"*",
"URL",
")",
"(",
"string",
",",
"error",
")",
"{",
"// grab data source",
"host",
",",
"port",
":=",
"hostname",
"(",
"u",
".",
"Host",
")",
",",
"hostport",
"(",
"u",
".",
"Host",
")",
"\n",
"dsname",
",",
"dbname",
":=",
"strings",
".",
"TrimPrefix",
"(",
"u",
".",
"Path",
",",
"\"",
"\"",
")",
",",
"\"",
"\"",
"\n",
"if",
"dsname",
"==",
"\"",
"\"",
"{",
"dsname",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"// check if data source is not a path on disk",
"if",
"mode",
"(",
"dsname",
")",
"==",
"0",
"{",
"if",
"i",
":=",
"strings",
".",
"IndexAny",
"(",
"dsname",
",",
"`\\/`",
")",
";",
"i",
"!=",
"-",
"1",
"{",
"dbname",
"=",
"dsname",
"[",
"i",
"+",
"1",
":",
"]",
"\n",
"dsname",
"=",
"dsname",
"[",
":",
"i",
"]",
"\n",
"}",
"\n",
"}",
"\n\n",
"q",
":=",
"u",
".",
"Query",
"(",
")",
"\n",
"q",
".",
"Set",
"(",
"\"",
"\"",
",",
"host",
")",
"\n",
"q",
".",
"Set",
"(",
"\"",
"\"",
",",
"port",
")",
"\n",
"q",
".",
"Set",
"(",
"\"",
"\"",
",",
"dsname",
")",
"\n",
"q",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"dbname",
")",
"\n\n",
"// add user/pass",
"if",
"u",
".",
"User",
"!=",
"nil",
"{",
"q",
".",
"Set",
"(",
"\"",
"\"",
",",
"u",
".",
"User",
".",
"Username",
"(",
")",
")",
"\n",
"pass",
",",
"_",
":=",
"u",
".",
"User",
".",
"Password",
"(",
")",
"\n",
"q",
".",
"Set",
"(",
"\"",
"\"",
",",
"pass",
")",
"\n",
"}",
"\n\n",
"// save host, port, dbname",
"if",
"u",
".",
"hostPortDB",
"==",
"nil",
"{",
"n",
":=",
"dsname",
"\n",
"if",
"dbname",
"!=",
"\"",
"\"",
"{",
"n",
"+=",
"\"",
"\"",
"+",
"dbname",
"\n",
"}",
"\n",
"u",
".",
"hostPortDB",
"=",
"[",
"]",
"string",
"{",
"host",
",",
"port",
",",
"n",
"}",
"\n",
"}",
"\n\n",
"return",
"genOptionsODBC",
"(",
"q",
",",
"true",
")",
",",
"nil",
"\n",
"}"
] |
11,147 | all-11148 | [
"Delete",
"value",
"in",
"redis",
"session"
] | [
"func",
"(",
"rs",
"*",
"redisStore",
")",
"Delete",
"(",
"key",
"string",
")",
"error",
"{",
"delete",
"(",
"rs",
".",
"Values",
",",
"key",
")",
"\n",
"err",
":=",
"provider",
".",
"refresh",
"(",
"<mask>",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
11,148 | all-11149 | [
"GetError",
"returns",
"the",
"last",
"argument",
"that",
"is",
"of",
"type",
"error",
"panics",
"if",
"none",
"of",
"the",
"passed",
"args",
"is",
"of",
"type",
"error",
".",
"Note",
"that",
"GetError",
"(",
"nil",
")",
"will",
"panic",
"because",
"nil",
"is",
"not",
"of",
"type",
"error",
"but",
"interface",
"{}"
] | [
"func",
"GetError",
"(",
"args",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"for",
"i",
":=",
"len",
"(",
"args",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
"{",
"arg",
":=",
"args",
"[",
"i",
"]",
"\n",
"if",
"arg",
"!=",
"nil",
"{",
"if",
"err",
",",
"ok",
":=",
"arg",
".",
"(",
"error",
")",
";",
"<mask>",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
11,149 | all-11150 | [
"WithValue",
"is",
"a",
"middleware",
"that",
"sets",
"a",
"given",
"key",
"/",
"value",
"in",
"a",
"context",
"chain",
"."
] | [
"func",
"WithValue",
"(",
"<mask>",
"interface",
"{",
"}",
",",
"val",
"interface",
"{",
"}",
")",
"func",
"(",
"next",
"http",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"return",
"func",
"(",
"next",
"http",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"fn",
":=",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"r",
"=",
"r",
".",
"WithContext",
"(",
"context",
".",
"WithValue",
"(",
"r",
".",
"Context",
"(",
")",
",",
"key",
",",
"val",
")",
")",
"\n",
"next",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"\n",
"return",
"http",
".",
"HandlerFunc",
"(",
"fn",
")",
"\n",
"}",
"\n",
"}"
] |
11,150 | all-11151 | [
"MarshalJSON",
"marshals",
"image",
"state"
] | [
"func",
"(",
"imageState",
"*",
"ImageState",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"imageState",
".",
"<mask>",
".",
"Lock",
"(",
")",
"\n",
"defer",
"imageState",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"return",
"json",
".",
"Marshal",
"(",
"&",
"struct",
"{",
"Image",
"*",
"Image",
"\n",
"PulledAt",
"time",
".",
"Time",
"\n",
"LastUsedAt",
"time",
".",
"Time",
"\n",
"PullSucceeded",
"bool",
"\n",
"}",
"{",
"Image",
":",
"imageState",
".",
"Image",
",",
"PulledAt",
":",
"imageState",
".",
"PulledAt",
",",
"LastUsedAt",
":",
"imageState",
".",
"LastUsedAt",
",",
"PullSucceeded",
":",
"imageState",
".",
"PullSucceeded",
",",
"}",
")",
"\n",
"}"
] |
11,151 | all-11152 | [
"NewHandler",
"creates",
"a",
"new",
"handler",
"."
] | [
"func",
"NewHandler",
"(",
"logger",
"log",
".",
"Logger",
",",
"db",
"*",
"reform",
".",
"DB",
",",
"queue",
"job",
".",
"Queue",
",",
"pwdStorage",
"data",
".",
"PWDGetSetter",
",",
"encryptKeyFunc",
"data",
".",
"EncryptedKeyFunc",
",",
"decryptKeyFunc",
"data",
".",
"ToPrivateKeyFunc",
",",
"userRole",
"string",
",",
"processor",
"*",
"proc",
".",
"Processor",
",",
"somcClientBuilder",
"somc",
".",
"ClientBuilderInterface",
",",
"token",
"TokenMakeChecker",
")",
"*",
"Handler",
"{",
"logger",
"=",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"&",
"Handler",
"{",
"logger",
":",
"logger",
",",
"db",
":",
"db",
",",
"queue",
":",
"queue",
",",
"pwdStorage",
":",
"pwdStorage",
",",
"encryptKeyFunc",
":",
"encryptKeyFunc",
",",
"decryptKeyFunc",
":",
"decryptKeyFunc",
",",
"userRole",
":",
"userRole",
",",
"<mask>",
":",
"processor",
",",
"somcClientBuilder",
":",
"somcClientBuilder",
",",
"token",
":",
"token",
",",
"}",
"\n",
"}"
] |
11,152 | all-11153 | [
"CompileResultWithTemplate",
"compiles",
"the",
"parsed",
"result",
"and",
"associates",
"it",
"with",
"t",
"."
] | [
"func",
"CompileResultWithTemplate",
"(",
"t",
"*",
"template",
".",
"Template",
",",
"rslt",
"*",
"result",
",",
"opts",
"*",
"Options",
")",
"(",
"*",
"template",
".",
"<mask>",
",",
"error",
")",
"{",
"// Initialize the options.",
"opts",
"=",
"InitializeOptions",
"(",
"opts",
")",
"\n\n",
"var",
"err",
"error",
"\n\n",
"// Create a buffer.",
"baseBf",
":=",
"bytes",
".",
"NewBuffer",
"(",
"nil",
")",
"\n",
"innerBf",
":=",
"bytes",
".",
"NewBuffer",
"(",
"nil",
")",
"\n",
"includeBfs",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"bytes",
".",
"Buffer",
")",
"\n\n",
"// Write data to the buffer.",
"for",
"_",
",",
"e",
":=",
"range",
"rslt",
".",
"base",
"{",
"if",
"_",
",",
"err",
":=",
"e",
".",
"WriteTo",
"(",
"baseBf",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"e",
":=",
"range",
"rslt",
".",
"inner",
"{",
"if",
"_",
",",
"err",
"=",
"e",
".",
"WriteTo",
"(",
"innerBf",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"path",
",",
"elements",
":=",
"range",
"rslt",
".",
"includes",
"{",
"bf",
":=",
"bytes",
".",
"NewBuffer",
"(",
"nil",
")",
"\n\n",
"// Write a define action.",
"bf",
".",
"WriteString",
"(",
"fmt",
".",
"Sprintf",
"(",
"actionDefine",
",",
"opts",
".",
"DelimLeft",
",",
"path",
",",
"opts",
".",
"DelimRight",
")",
")",
"\n\n",
"for",
"_",
",",
"e",
":=",
"range",
"elements",
"{",
"if",
"_",
",",
"err",
"=",
"e",
".",
"WriteTo",
"(",
"bf",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Write an end action.",
"bf",
".",
"WriteString",
"(",
"fmt",
".",
"Sprintf",
"(",
"actionEnd",
",",
"opts",
".",
"DelimLeft",
",",
"opts",
".",
"DelimRight",
")",
")",
"\n\n",
"includeBfs",
"[",
"path",
"]",
"=",
"bf",
"\n",
"}",
"\n\n",
"// Set Delimiters.",
"t",
".",
"Delims",
"(",
"opts",
".",
"DelimLeft",
",",
"opts",
".",
"DelimRight",
")",
"\n\n",
"// Set FuncMaps.",
"t",
".",
"Funcs",
"(",
"template",
".",
"FuncMap",
"{",
"preDefinedFuncNameHTML",
":",
"func",
"(",
"s",
"string",
")",
"template",
".",
"HTML",
"{",
"return",
"template",
".",
"HTML",
"(",
"s",
")",
"\n",
"}",
",",
"}",
")",
"\n\n",
"t",
".",
"Funcs",
"(",
"opts",
".",
"FuncMap",
")",
"\n\n",
"// Parse a string to the template.",
"t",
",",
"err",
"=",
"t",
".",
"Parse",
"(",
"baseBf",
".",
"String",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"t",
",",
"err",
"=",
"t",
".",
"Parse",
"(",
"innerBf",
".",
"String",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"bf",
":=",
"range",
"includeBfs",
"{",
"t",
",",
"err",
"=",
"t",
".",
"Parse",
"(",
"bf",
".",
"String",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"t",
",",
"nil",
"\n",
"}"
] |
11,153 | all-11154 | [
"Timeout",
"returns",
"true",
"if",
"Next",
"returned",
"false",
"due",
"to",
"a",
"timeout",
"of",
"a",
"tailable",
"cursor",
".",
"In",
"those",
"cases",
"Next",
"may",
"be",
"called",
"again",
"to",
"continue",
"the",
"iteration",
"at",
"the",
"previous",
"cursor",
"position",
"."
] | [
"func",
"(",
"iter",
"*",
"Iter",
")",
"Timeout",
"(",
")",
"bool",
"{",
"iter",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"result",
":=",
"iter",
".",
"timedout",
"\n",
"iter",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
11,154 | all-11155 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"Header",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCachestorage6",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
11,155 | all-11156 | [
"NewMessage",
"creates",
"a",
"new",
"message",
".",
"It",
"uses",
"UTF",
"-",
"8",
"and",
"quoted",
"-",
"printable",
"encoding",
"by",
"default",
"."
] | [
"func",
"NewMessage",
"(",
"settings",
"...",
"MessageSetting",
")",
"*",
"Message",
"{",
"m",
":=",
"&",
"Message",
"{",
"header",
":",
"make",
"(",
"header",
")",
",",
"charset",
":",
"\"",
"\"",
",",
"encoding",
":",
"QuotedPrintable",
",",
"}",
"\n\n",
"m",
".",
"applySettings",
"(",
"<mask>",
")",
"\n\n",
"if",
"m",
".",
"encoding",
"==",
"Base64",
"{",
"m",
".",
"hEncoder",
"=",
"bEncoding",
"\n",
"}",
"else",
"{",
"m",
".",
"hEncoder",
"=",
"qEncoding",
"\n",
"}",
"\n\n",
"return",
"m",
"\n",
"}"
] |
11,156 | all-11157 | [
"outerLog",
"is",
"like",
"outers",
"outerLogs",
"but",
"the",
"nem",
"entry",
"is",
"created",
"from",
"the",
"first",
"BackLog",
"in",
"the",
"list",
"."
] | [
"func",
"(",
"mp",
"*",
"MultiLog",
")",
"OuterLog",
"(",
"level",
"Level",
",",
"tags",
"...",
"string",
")",
"<mask>",
".",
"Writer",
"{",
"if",
"mp",
".",
"chouter",
"!=",
"nil",
"{",
"return",
"&",
"outer",
"{",
"ch",
":",
"mp",
".",
"chouter",
",",
"buf",
":",
"make",
"(",
"[",
"]",
"byte",
",",
"0",
")",
",",
"}",
"\n",
"}",
"\n",
"mp",
".",
"chclose",
"=",
"make",
"(",
"chan",
"chan",
"struct",
"{",
"}",
")",
"\n",
"mp",
".",
"chouter",
"=",
"make",
"(",
"chan",
"[",
"]",
"byte",
")",
"\n",
"if",
"len",
"(",
"mp",
".",
"mp",
")",
"<",
"2",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"f",
":=",
"mp",
".",
"mp",
"[",
"0",
"]",
".",
"GetF",
"(",
")",
"\n",
"logger",
":=",
"f",
".",
"NewEntry",
"(",
"mp",
")",
".",
"Tag",
"(",
"\"",
"\"",
")",
".",
"EntryLevel",
"(",
"level",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"for",
"{",
"select",
"{",
"case",
"buf",
":=",
"<-",
"mp",
".",
"chouter",
":",
"logger",
".",
"Tag",
"(",
"tags",
"...",
")",
".",
"Println",
"(",
"string",
"(",
"buf",
")",
")",
"\n",
"case",
"ch",
":=",
"<-",
"mp",
".",
"chclose",
":",
"ch",
"<-",
"struct",
"{",
"}",
"{",
"}",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"return",
"&",
"outer",
"{",
"ch",
":",
"mp",
".",
"chouter",
",",
"buf",
":",
"make",
"(",
"[",
"]",
"byte",
",",
"0",
")",
",",
"}",
"\n",
"}"
] |
11,157 | all-11158 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"ClearBrowserCacheParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork65",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
11,158 | all-11159 | [
"RoundTrip",
"issues",
"a",
"single",
"HTTP",
"request",
"and",
"returns",
"its",
"response",
".",
"Per",
"the",
"http",
".",
"RoundTripper",
"interface",
"RoundTrip",
"only",
"returns",
"an",
"error",
"if",
"there",
"was",
"an",
"unsupported",
"request",
"or",
"the",
"URL",
"Fetch",
"proxy",
"fails",
".",
"Note",
"that",
"HTTP",
"response",
"codes",
"such",
"as",
"5xx",
"403",
"404",
"etc",
"are",
"not",
"errors",
"as",
"far",
"as",
"the",
"transport",
"is",
"concerned",
"and",
"will",
"be",
"returned",
"with",
"err",
"set",
"to",
"nil",
"."
] | [
"func",
"(",
"t",
"*",
"Transport",
")",
"RoundTrip",
"(",
"req",
"*",
"http",
".",
"Request",
")",
"(",
"res",
"*",
"http",
".",
"Response",
",",
"err",
"error",
")",
"{",
"methNum",
",",
"ok",
":=",
"pb",
".",
"URLFetchRequest_RequestMethod_value",
"[",
"req",
".",
"Method",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"req",
".",
"Method",
")",
"\n",
"}",
"\n\n",
"method",
":=",
"pb",
".",
"URLFetchRequest_RequestMethod",
"(",
"methNum",
")",
"\n\n",
"freq",
":=",
"&",
"pb",
".",
"URLFetchRequest",
"{",
"Method",
":",
"&",
"method",
",",
"Url",
":",
"proto",
".",
"String",
"(",
"urlString",
"(",
"req",
".",
"URL",
")",
")",
",",
"FollowRedirects",
":",
"proto",
".",
"Bool",
"(",
"false",
")",
",",
"// http.Client's responsibility",
"MustValidateServerCertificate",
":",
"proto",
".",
"Bool",
"(",
"!",
"t",
".",
"AllowInvalidServerCertificate",
")",
",",
"}",
"\n",
"if",
"deadline",
",",
"ok",
":=",
"t",
".",
"Context",
".",
"Deadline",
"(",
")",
";",
"ok",
"{",
"freq",
".",
"Deadline",
"=",
"proto",
".",
"Float64",
"(",
"deadline",
".",
"Sub",
"(",
"time",
".",
"Now",
"(",
")",
")",
".",
"Seconds",
"(",
")",
")",
"\n",
"}",
"\n\n",
"for",
"k",
",",
"vals",
":=",
"range",
"req",
".",
"Header",
"{",
"for",
"_",
",",
"val",
":=",
"range",
"vals",
"{",
"freq",
".",
"Header",
"=",
"append",
"(",
"freq",
".",
"<mask>",
",",
"&",
"pb",
".",
"URLFetchRequest_Header",
"{",
"Key",
":",
"proto",
".",
"String",
"(",
"k",
")",
",",
"Value",
":",
"proto",
".",
"String",
"(",
"val",
")",
",",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"methodAcceptsRequestBody",
"[",
"req",
".",
"Method",
"]",
"&&",
"req",
".",
"Body",
"!=",
"nil",
"{",
"// Avoid a []byte copy if req.Body has a Bytes method.",
"switch",
"b",
":=",
"req",
".",
"Body",
".",
"(",
"type",
")",
"{",
"case",
"interface",
"{",
"Bytes",
"(",
")",
"[",
"]",
"byte",
"\n",
"}",
":",
"freq",
".",
"Payload",
"=",
"b",
".",
"Bytes",
"(",
")",
"\n",
"default",
":",
"freq",
".",
"Payload",
",",
"err",
"=",
"ioutil",
".",
"ReadAll",
"(",
"req",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"fres",
":=",
"&",
"pb",
".",
"URLFetchResponse",
"{",
"}",
"\n",
"if",
"err",
":=",
"internal",
".",
"Call",
"(",
"t",
".",
"Context",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"freq",
",",
"fres",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"res",
"=",
"&",
"http",
".",
"Response",
"{",
"}",
"\n",
"res",
".",
"StatusCode",
"=",
"int",
"(",
"*",
"fres",
".",
"StatusCode",
")",
"\n",
"res",
".",
"Status",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"res",
".",
"StatusCode",
",",
"statusCodeToText",
"(",
"res",
".",
"StatusCode",
")",
")",
"\n",
"res",
".",
"Header",
"=",
"make",
"(",
"http",
".",
"Header",
")",
"\n",
"res",
".",
"Request",
"=",
"req",
"\n\n",
"// Faked:",
"res",
".",
"ProtoMajor",
"=",
"1",
"\n",
"res",
".",
"ProtoMinor",
"=",
"1",
"\n",
"res",
".",
"Proto",
"=",
"\"",
"\"",
"\n",
"res",
".",
"Close",
"=",
"true",
"\n\n",
"for",
"_",
",",
"h",
":=",
"range",
"fres",
".",
"Header",
"{",
"hkey",
":=",
"http",
".",
"CanonicalHeaderKey",
"(",
"*",
"h",
".",
"Key",
")",
"\n",
"hval",
":=",
"*",
"h",
".",
"Value",
"\n",
"if",
"hkey",
"==",
"\"",
"\"",
"{",
"// Will get filled in below for all but HEAD requests.",
"if",
"req",
".",
"Method",
"==",
"\"",
"\"",
"{",
"res",
".",
"ContentLength",
",",
"_",
"=",
"strconv",
".",
"ParseInt",
"(",
"hval",
",",
"10",
",",
"64",
")",
"\n",
"}",
"\n",
"continue",
"\n",
"}",
"\n",
"res",
".",
"Header",
".",
"Add",
"(",
"hkey",
",",
"hval",
")",
"\n",
"}",
"\n\n",
"if",
"req",
".",
"Method",
"!=",
"\"",
"\"",
"{",
"res",
".",
"ContentLength",
"=",
"int64",
"(",
"len",
"(",
"fres",
".",
"Content",
")",
")",
"\n",
"}",
"\n\n",
"truncated",
":=",
"fres",
".",
"GetContentWasTruncated",
"(",
")",
"\n",
"res",
".",
"Body",
"=",
"&",
"bodyReader",
"{",
"content",
":",
"fres",
".",
"Content",
",",
"truncated",
":",
"truncated",
"}",
"\n",
"return",
"\n",
"}"
] |
11,159 | all-11160 | [
"StoragePoolIDsNotPending",
"returns",
"a",
"map",
"associating",
"each",
"storage",
"pool",
"name",
"to",
"its",
"ID",
".",
"Pending",
"storage",
"pools",
"are",
"skipped",
"."
] | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"StoragePoolIDsNotPending",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"int64",
",",
"error",
")",
"{",
"pools",
":=",
"[",
"]",
"struct",
"{",
"<mask>",
"int64",
"\n",
"name",
"string",
"\n",
"}",
"{",
"}",
"\n",
"dest",
":=",
"func",
"(",
"i",
"int",
")",
"[",
"]",
"interface",
"{",
"}",
"{",
"pools",
"=",
"append",
"(",
"pools",
",",
"struct",
"{",
"id",
"int64",
"\n",
"name",
"string",
"\n",
"}",
"{",
"}",
")",
"\n",
"return",
"[",
"]",
"interface",
"{",
"}",
"{",
"&",
"pools",
"[",
"i",
"]",
".",
"id",
",",
"&",
"pools",
"[",
"i",
"]",
".",
"name",
"}",
"\n\n",
"}",
"\n",
"stmt",
",",
"err",
":=",
"c",
".",
"tx",
".",
"Prepare",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"stmt",
".",
"Close",
"(",
")",
"\n",
"err",
"=",
"query",
".",
"SelectObjects",
"(",
"stmt",
",",
"dest",
",",
"storagePoolPending",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"ids",
":=",
"map",
"[",
"string",
"]",
"int64",
"{",
"}",
"\n",
"for",
"_",
",",
"pool",
":=",
"range",
"pools",
"{",
"ids",
"[",
"pool",
".",
"name",
"]",
"=",
"pool",
".",
"id",
"\n",
"}",
"\n",
"return",
"ids",
",",
"nil",
"\n",
"}"
] |
11,160 | all-11161 | [
"GetTokenURIOk",
"returns",
"a",
"tuple",
"with",
"the",
"TokenURI",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"i",
"*",
"IntegrationGCPCreateRequest",
")",
"GetTokenURIOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"i",
"==",
"nil",
"||",
"i",
".",
"TokenURI",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"i",
".",
"TokenURI",
",",
"true",
"\n",
"}"
] |
11,161 | all-11162 | [
"isHaltErr",
"returns",
"true",
"if",
"the",
"given",
"error",
"and",
"context",
"indicate",
"no",
"forward",
"progress",
"can",
"be",
"made",
"even",
"after",
"reconnecting",
"."
] | [
"func",
"isHaltErr",
"(",
"ctx",
"context",
".",
"Context",
",",
"err",
"error",
")",
"bool",
"{",
"if",
"ctx",
"!=",
"nil",
"&&",
"ctx",
".",
"Err",
"(",
")",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"ev",
",",
"_",
":=",
"<mask>",
".",
"FromError",
"(",
"err",
")",
"\n",
"// Unavailable codes mean the system will be right back.",
"// (e.g., can't connect, lost leader)",
"// Treat Internal codes as if something failed, leaving the",
"// system in an inconsistent state, but retrying could make progress.",
"// (e.g., failed in middle of send, corrupted frame)",
"// TODO: are permanent Internal errors possible from grpc?",
"return",
"ev",
".",
"Code",
"(",
")",
"!=",
"codes",
".",
"Unavailable",
"&&",
"ev",
".",
"Code",
"(",
")",
"!=",
"codes",
".",
"Internal",
"\n",
"}"
] |
11,162 | all-11163 | [
"RemoveListenersFromLoadBalancer",
"removes",
"listeners",
"to",
"an",
"existing",
"load",
"balancer",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"RemoveListenersFromLoadBalancer",
"(",
"loadBalancerID",
"string",
",",
"listeners",
"[",
"]",
"LoadBalancerListener",
")",
"(",
"*",
"LoadBalancer",
",",
"error",
")",
"{",
"lb",
":=",
"<mask>",
"(",
"LoadBalancer",
")",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"MakeApiRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"loadBalancerID",
"+",
"\"",
"\"",
",",
"listeners",
",",
"&",
"lb",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"lb",
",",
"nil",
"\n",
"}"
] |
11,163 | all-11164 | [
"/",
"*",
"Warning",
"uses",
"msg",
"as",
"a",
"format",
"string",
"with",
"subsequent",
"parameters",
"as",
"values",
"and",
"logs",
"the",
"resulting",
"message",
"to",
"all",
"added",
"loggers",
"at",
"LogLevel",
".",
"LevelWarning"
] | [
"func",
"(",
"b",
"*",
"Base",
")",
"Warning",
"(",
"msg",
"string",
")",
"error",
"{",
"return",
"b",
".",
"<mask>",
"(",
"LevelWarning",
",",
"nil",
",",
"msg",
")",
"\n",
"}"
] |
11,164 | all-11165 | [
"export",
"FrameSet_HasFrame"
] | [
"func",
"FrameSet_HasFrame",
"(",
"id",
"FrameSetId",
",",
"<mask>",
"int",
")",
"bool",
"{",
"fs",
",",
"ok",
":=",
"sFrameSets",
".",
"Get",
"(",
"id",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"fs",
".",
"HasFrame",
"(",
"frame",
")",
"\n",
"}"
] |
11,165 | all-11166 | [
"pack7",
"packs",
"7",
"values",
"from",
"in",
"using",
"4",
"bits",
"each"
] | [
"func",
"pack7",
"(",
"in",
"[",
"]",
"uint32",
")",
"uint32",
"{",
"return",
"3",
"<<",
"28",
"|",
"in",
"[",
"0",
"]",
"|",
"in",
"[",
"1",
"]",
"<<",
"4",
"|",
"<mask>",
"[",
"2",
"]",
"<<",
"8",
"|",
"in",
"[",
"3",
"]",
"<<",
"12",
"|",
"in",
"[",
"4",
"]",
"<<",
"16",
"|",
"in",
"[",
"5",
"]",
"<<",
"20",
"|",
"in",
"[",
"6",
"]",
"<<",
"24",
"\n",
"}"
] |
11,166 | all-11167 | [
"specify",
"a",
"parameter",
"for",
"a",
"program",
"object"
] | [
"func",
"ProgramParameteri",
"(",
"<mask>",
"uint32",
",",
"pname",
"uint32",
",",
"value",
"int32",
")",
"{",
"C",
".",
"glowProgramParameteri",
"(",
"gpProgramParameteri",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"pname",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"value",
")",
")",
"\n",
"}"
] |
11,167 | all-11168 | [
"VectorSelector",
"parses",
"a",
"new",
"(",
"instant",
")",
"vector",
"selector",
".",
"<metric_identifier",
">",
"[",
"<label_matchers",
">",
"]",
"[",
"<metric_identifier",
">",
"]",
"<label_matchers",
">"
] | [
"func",
"(",
"p",
"*",
"parser",
")",
"VectorSelector",
"(",
"name",
"string",
")",
"*",
"VectorSelector",
"{",
"var",
"matchers",
"[",
"]",
"*",
"labels",
".",
"Matcher",
"\n",
"// Parse label matching if any.",
"if",
"t",
":=",
"p",
".",
"peek",
"(",
")",
";",
"t",
".",
"typ",
"==",
"ItemLeftBrace",
"{",
"matchers",
"=",
"p",
".",
"labelMatchers",
"(",
"ItemEQL",
",",
"ItemNEQ",
",",
"ItemEQLRegex",
",",
"ItemNEQRegex",
")",
"\n",
"}",
"\n",
"// Metric name must not be set in the label matchers and before at the same time.",
"if",
"name",
"!=",
"\"",
"\"",
"{",
"for",
"_",
",",
"m",
":=",
"range",
"matchers",
"{",
"if",
"m",
".",
"Name",
"==",
"labels",
".",
"MetricName",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"name",
",",
"m",
".",
"Value",
")",
"\n",
"}",
"\n",
"}",
"\n",
"// Set name label matching.",
"m",
",",
"err",
":=",
"labels",
".",
"NewMatcher",
"(",
"labels",
".",
"MatchEqual",
",",
"labels",
".",
"MetricName",
",",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"// Must not happen with metric.Equal.",
"\n",
"}",
"\n",
"matchers",
"=",
"append",
"(",
"matchers",
",",
"m",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"matchers",
")",
"==",
"0",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"// A Vector selector must contain at least one non-empty matcher to prevent",
"// implicit selection of all metrics (e.g. by a typo).",
"notEmpty",
":=",
"<mask>",
"\n",
"for",
"_",
",",
"lm",
":=",
"range",
"matchers",
"{",
"if",
"!",
"lm",
".",
"Matches",
"(",
"\"",
"\"",
")",
"{",
"notEmpty",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"!",
"notEmpty",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"VectorSelector",
"{",
"Name",
":",
"name",
",",
"LabelMatchers",
":",
"matchers",
",",
"}",
"\n",
"}"
] |
11,168 | all-11169 | [
"GetDesiredStatus",
"safely",
"returns",
"the",
"desired",
"status",
"of",
"the",
"task"
] | [
"func",
"(",
"vol",
"*",
"VolumeResource",
")",
"GetDesiredStatus",
"(",
")",
"resourcestatus",
".",
"ResourceStatus",
"{",
"vol",
".",
"<mask>",
".",
"RLock",
"(",
")",
"\n",
"defer",
"vol",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"vol",
".",
"desiredStatusUnsafe",
"\n",
"}"
] |
11,169 | all-11170 | [
"PutObject",
"puts",
"a",
"value",
"into",
"the",
"object",
"store",
"and",
"tags",
"it",
"with",
"0",
"or",
"more",
"tags",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"PutObject",
"(",
"_r",
"io",
".",
"Reader",
",",
"tags",
"...",
"string",
")",
"(",
"<mask>",
"*",
"pfs",
".",
"Object",
",",
"_",
"int64",
",",
"retErr",
"error",
")",
"{",
"r",
":=",
"grpcutil",
".",
"ReaderWrapper",
"{",
"_r",
"}",
"\n",
"w",
",",
"err",
":=",
"c",
".",
"newPutObjectWriteCloser",
"(",
"tags",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"0",
",",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
":=",
"w",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"&&",
"retErr",
"==",
"nil",
"{",
"retErr",
"=",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"retErr",
"==",
"nil",
"{",
"object",
"=",
"w",
".",
"object",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"buf",
":=",
"grpcutil",
".",
"GetBuffer",
"(",
")",
"\n",
"defer",
"grpcutil",
".",
"PutBuffer",
"(",
"buf",
")",
"\n",
"written",
",",
"err",
":=",
"io",
".",
"CopyBuffer",
"(",
"w",
",",
"r",
",",
"buf",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"0",
",",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"// return value set by deferred function",
"return",
"nil",
",",
"written",
",",
"nil",
"\n",
"}"
] |
11,170 | all-11171 | [
"Set",
"is",
"required",
"for",
"kingpin",
"interfaces",
"to",
"allow",
"command",
"line",
"params",
"to",
"be",
"set",
"to",
"our",
"map",
"datatype"
] | [
"func",
"(",
"o",
"*",
"ListRawTypeOption",
")",
"<mask>",
"(",
"value",
"string",
")",
"error",
"{",
"val",
":=",
"RawTypeOption",
"{",
"}",
"\n",
"val",
".",
"Set",
"(",
"value",
")",
"\n",
"*",
"o",
"=",
"append",
"(",
"*",
"o",
",",
"val",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
11,171 | all-11172 | [
"ReplyTo",
"returns",
"a",
"copy",
"of",
"MailBuilder",
"with",
"this",
"name",
"&",
"address",
"appended",
"to",
"the",
"To",
"header",
".",
"name",
"may",
"be",
"empty",
"."
] | [
"func",
"(",
"p",
"MailBuilder",
")",
"ReplyTo",
"(",
"name",
",",
"addr",
"string",
")",
"MailBuilder",
"{",
"p",
".",
"replyTo",
"=",
"<mask>",
".",
"Address",
"{",
"Name",
":",
"name",
",",
"Address",
":",
"addr",
"}",
"\n",
"return",
"p",
"\n",
"}"
] |
11,172 | all-11173 | [
"newImageSource",
"creates",
"a",
"new",
"ImageSource",
"for",
"the",
"specified",
"image",
"reference",
"ref",
".",
"The",
"following",
"steps",
"will",
"be",
"done",
"during",
"the",
"instance",
"creation",
":",
"-",
"Lookup",
"the",
"registry",
"within",
"the",
"configured",
"location",
"in",
"sys",
".",
"SystemRegistriesConfPath",
".",
"If",
"there",
"is",
"no",
"configured",
"registry",
"available",
"we",
"fallback",
"to",
"the",
"provided",
"docker",
"reference",
"ref",
".",
"-",
"References",
"which",
"contain",
"a",
"configured",
"prefix",
"will",
"be",
"automatically",
"rewritten",
"to",
"the",
"correct",
"target",
"reference",
".",
"For",
"example",
"if",
"the",
"configured",
"prefix",
"=",
"example",
".",
"com",
"/",
"foo",
"location",
"=",
"example",
".",
"com",
"and",
"the",
"image",
"will",
"be",
"pulled",
"from",
"the",
"ref",
"example",
".",
"com",
"/",
"foo",
"/",
"image",
"then",
"the",
"resulting",
"pull",
"will",
"effectively",
"point",
"to",
"example",
".",
"com",
"/",
"image",
".",
"-",
"If",
"the",
"rewritten",
"reference",
"succeeds",
"it",
"will",
"be",
"used",
"as",
"the",
"dockerRef",
"in",
"the",
"client",
".",
"If",
"the",
"rewrite",
"fails",
"the",
"function",
"immediately",
"returns",
"an",
"error",
".",
"-",
"Each",
"mirror",
"will",
"be",
"used",
"(",
"in",
"the",
"configured",
"order",
")",
"to",
"test",
"the",
"availability",
"of",
"the",
"image",
"manifest",
"on",
"the",
"remote",
"location",
".",
"For",
"example",
"if",
"the",
"manifest",
"is",
"not",
"reachable",
"due",
"to",
"connectivity",
"issues",
"then",
"the",
"next",
"mirror",
"will",
"be",
"tested",
"instead",
".",
"If",
"no",
"mirror",
"is",
"configured",
"or",
"contains",
"the",
"target",
"manifest",
"then",
"the",
"initial",
"ref",
"will",
"be",
"tested",
"as",
"fallback",
".",
"The",
"creation",
"of",
"the",
"new",
"dockerImageSource",
"only",
"succeeds",
"if",
"a",
"remote",
"location",
"with",
"the",
"available",
"manifest",
"was",
"found",
".",
"A",
"cleanup",
"call",
"to",
".",
"Close",
"()",
"is",
"needed",
"if",
"the",
"caller",
"is",
"done",
"using",
"the",
"returned",
"ImageSource",
"."
] | [
"func",
"newImageSource",
"(",
"ctx",
"context",
".",
"Context",
",",
"sys",
"*",
"types",
".",
"SystemContext",
",",
"ref",
"dockerReference",
")",
"(",
"*",
"dockerImageSource",
",",
"error",
")",
"{",
"registry",
",",
"err",
":=",
"sysregistriesv2",
".",
"FindRegistry",
"(",
"sys",
",",
"ref",
".",
"ref",
".",
"Name",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"registry",
"==",
"nil",
"{",
"// No configuration was found for the provided reference, so we create",
"// a fallback registry by hand to make the client creation below work",
"// as intended.",
"registry",
"=",
"&",
"sysregistriesv2",
".",
"Registry",
"{",
"Endpoint",
":",
"sysregistriesv2",
".",
"Endpoint",
"{",
"Location",
":",
"ref",
".",
"<mask>",
".",
"String",
"(",
")",
",",
"}",
",",
"}",
"\n",
"}",
"\n\n",
"// Found the registry within the sysregistriesv2 configuration. Now we test",
"// all endpoints for the manifest availability. If a working image source",
"// was found, it will be used for all future pull actions.",
"var",
"(",
"imageSource",
"*",
"dockerImageSource",
"\n",
"manifestLoadErr",
"error",
"\n",
")",
"\n",
"for",
"_",
",",
"endpoint",
":=",
"range",
"append",
"(",
"registry",
".",
"Mirrors",
",",
"registry",
".",
"Endpoint",
")",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"ref",
".",
"ref",
",",
"endpoint",
".",
"Location",
")",
"\n\n",
"newRef",
",",
"err",
":=",
"endpoint",
".",
"RewriteReference",
"(",
"ref",
".",
"ref",
",",
"registry",
".",
"Prefix",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"dockerRef",
",",
"err",
":=",
"newReference",
"(",
"newRef",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"client",
",",
"err",
":=",
"newDockerClientFromRef",
"(",
"sys",
",",
"dockerRef",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"client",
".",
"tlsClientConfig",
".",
"InsecureSkipVerify",
"=",
"endpoint",
".",
"Insecure",
"\n\n",
"testImageSource",
":=",
"&",
"dockerImageSource",
"{",
"ref",
":",
"dockerRef",
",",
"c",
":",
"client",
",",
"}",
"\n\n",
"manifestLoadErr",
"=",
"testImageSource",
".",
"ensureManifestIsLoaded",
"(",
"ctx",
")",
"\n",
"if",
"manifestLoadErr",
"==",
"nil",
"{",
"imageSource",
"=",
"testImageSource",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"imageSource",
",",
"manifestLoadErr",
"\n",
"}"
] |
11,173 | all-11174 | [
"addRelayItem",
"adds",
"a",
"relay",
"item",
"to",
"either",
"outbound",
"or",
"inbound",
"."
] | [
"func",
"(",
"r",
"*",
"Relayer",
")",
"addRelayItem",
"(",
"isOriginator",
"bool",
",",
"id",
",",
"remapID",
"uint32",
",",
"destination",
"*",
"Relayer",
",",
"ttl",
"<mask>",
".",
"Duration",
",",
"span",
"Span",
",",
"call",
"RelayCall",
")",
"relayItem",
"{",
"item",
":=",
"relayItem",
"{",
"call",
":",
"call",
",",
"remapID",
":",
"remapID",
",",
"destination",
":",
"destination",
",",
"span",
":",
"span",
",",
"}",
"\n\n",
"items",
":=",
"r",
".",
"inbound",
"\n",
"if",
"isOriginator",
"{",
"items",
"=",
"r",
".",
"outbound",
"\n",
"}",
"\n",
"item",
".",
"timeout",
"=",
"r",
".",
"timeouts",
".",
"Get",
"(",
")",
"\n",
"items",
".",
"Add",
"(",
"id",
",",
"item",
")",
"\n",
"item",
".",
"timeout",
".",
"Start",
"(",
"ttl",
",",
"items",
",",
"id",
",",
"isOriginator",
")",
"\n",
"return",
"item",
"\n",
"}"
] |
11,174 | all-11175 | [
"WriteJSON",
"writes",
"the",
"given",
"object",
"as",
"JSON",
"."
] | [
"func",
"(",
"w",
"ArgWriteHelper",
")",
"WriteJSON",
"(",
"<mask>",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"w",
".",
"write",
"(",
"func",
"(",
")",
"error",
"{",
"e",
":=",
"json",
".",
"NewEncoder",
"(",
"w",
".",
"writer",
")",
"\n",
"return",
"e",
".",
"Encode",
"(",
"data",
")",
"\n",
"}",
")",
"\n",
"}"
] |
11,175 | all-11176 | [
"GetServer",
"pulls",
"data",
"for",
"the",
"server",
"where",
"id",
"=",
"srvid",
"returns",
"a",
"Instance",
"struct"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetServer",
"(",
"dcid",
",",
"srvid",
"string",
")",
"(",
"*",
"Server",
",",
"error",
")",
"{",
"url",
":=",
"serverPath",
"(",
"dcid",
",",
"srvid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"<mask>",
")",
"\n",
"ret",
":=",
"&",
"Server",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Get",
"(",
"url",
",",
"ret",
",",
"http",
".",
"StatusOK",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
11,176 | all-11177 | [
"AddFromString",
"is",
"a",
"wrapper",
"around",
"gtk_builder_add_from_string",
"()",
"."
] | [
"func",
"(",
"b",
"*",
"Builder",
")",
"AddFromString",
"(",
"str",
"string",
")",
"error",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"str",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"length",
":=",
"(",
"C",
".",
"gsize",
")",
"(",
"len",
"(",
"str",
")",
")",
"\n",
"<mask>",
"err",
"*",
"C",
".",
"GError",
"=",
"nil",
"\n",
"res",
":=",
"C",
".",
"gtk_builder_add_from_string",
"(",
"b",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"length",
",",
"&",
"err",
")",
"\n",
"if",
"res",
"==",
"0",
"{",
"defer",
"C",
".",
"g_error_free",
"(",
"err",
")",
"\n",
"return",
"errors",
".",
"New",
"(",
"goString",
"(",
"err",
".",
"message",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
11,177 | all-11178 | [
"ExternalLabelsHandler",
"returns",
"a",
"storage",
".",
"Queryable",
"which",
"creates",
"a",
"externalLabelsQuerier",
"."
] | [
"func",
"ExternalLabelsHandler",
"(",
"next",
"storage",
".",
"Queryable",
",",
"externalLabels",
"labels",
".",
"Labels",
")",
"storage",
".",
"Queryable",
"{",
"return",
"<mask>",
".",
"QueryableFunc",
"(",
"func",
"(",
"ctx",
"context",
".",
"Context",
",",
"mint",
",",
"maxt",
"int64",
")",
"(",
"storage",
".",
"Querier",
",",
"error",
")",
"{",
"q",
",",
"err",
":=",
"next",
".",
"Querier",
"(",
"ctx",
",",
"mint",
",",
"maxt",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"externalLabelsQuerier",
"{",
"Querier",
":",
"q",
",",
"externalLabels",
":",
"externalLabels",
"}",
",",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
11,178 | all-11179 | [
"return",
"parameters",
"of",
"an",
"indexed",
"query",
"object",
"target"
] | [
"func",
"GetQueryIndexediv",
"(",
"target",
"uint32",
",",
"index",
"uint32",
",",
"pname",
"uint32",
",",
"params",
"*",
"int32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpGetQueryIndexediv",
",",
"4",
",",
"uintptr",
"(",
"target",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"pname",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"params",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
11,179 | all-11180 | [
"GetValue",
"returns",
"the",
"Value",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"t",
"*",
"TriggeringValue",
")",
"GetValue",
"(",
")",
"int",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Value",
"==",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"<mask>",
"\n",
"}"
] |
11,180 | all-11181 | [
"NewGraphFromYAML",
"returns",
"a",
"new",
"Graph",
"from",
"a",
"YAML",
"file",
".",
"Here",
"s",
"the",
"sample",
"YAML",
"data",
":",
"graph_00",
":",
"S",
":",
"A",
":",
"100",
"B",
":",
"14",
"C",
":",
"200",
"A",
":",
"S",
":",
"15",
"B",
":",
"5",
"D",
":",
"20",
"T",
":",
"44",
"B",
":",
"S",
":",
"14",
"A",
":",
"5",
"D",
":",
"30",
"E",
":",
"18",
"C",
":",
"S",
":",
"9",
"E",
":",
"24",
"D",
":",
"A",
":",
"20",
"B",
":",
"30",
"E",
":",
"2",
"F",
":",
"11",
"T",
":",
"16",
"E",
":",
"B",
":",
"18",
"C",
":",
"24",
"D",
":",
"2",
"F",
":",
"6",
"T",
":",
"19",
"F",
":",
"D",
":",
"11",
"E",
":",
"6",
"T",
":",
"6",
"T",
":",
"A",
":",
"44",
"D",
":",
"16",
"F",
":",
"6",
"E",
":",
"19"
] | [
"func",
"NewGraphFromYAML",
"(",
"rd",
"io",
".",
"Reader",
",",
"graphID",
"string",
")",
"(",
"Graph",
",",
"error",
")",
"{",
"js",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"float64",
")",
"\n",
"var",
"data",
"[",
"]",
"byte",
"\n",
"d",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"1024",
")",
"\n",
"for",
"{",
"n",
",",
"err",
":=",
"rd",
".",
"Read",
"(",
"d",
")",
"\n",
"if",
"err",
"==",
"io",
".",
"EOF",
"{",
"break",
"\n",
"}",
"\n\n",
"data",
"=",
"append",
"(",
"data",
",",
"d",
"[",
"0",
":",
"n",
"]",
"...",
")",
"\n",
"}",
"\n\n",
"err",
":=",
"yaml",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"js",
")",
"\n",
"for",
"{",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"else",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"js",
"[",
"graphID",
"]",
";",
"!",
"ok",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"graphID",
")",
"\n",
"}",
"\n",
"gmap",
":=",
"<mask>",
"[",
"graphID",
"]",
"\n\n",
"g",
":=",
"newGraph",
"(",
")",
"\n",
"for",
"id1",
",",
"mm",
":=",
"range",
"gmap",
"{",
"nd1",
",",
"err",
":=",
"g",
".",
"GetNode",
"(",
"StringID",
"(",
"id1",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"nd1",
"=",
"NewNode",
"(",
"id1",
")",
"\n",
"g",
".",
"AddNode",
"(",
"nd1",
")",
"\n",
"}",
"\n",
"for",
"id2",
",",
"weight",
":=",
"range",
"mm",
"{",
"nd2",
",",
"err",
":=",
"g",
".",
"GetNode",
"(",
"StringID",
"(",
"id2",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"nd2",
"=",
"NewNode",
"(",
"id2",
")",
"\n",
"g",
".",
"AddNode",
"(",
"nd2",
")",
"\n",
"}",
"\n",
"g",
".",
"ReplaceEdge",
"(",
"nd1",
".",
"ID",
"(",
")",
",",
"nd2",
".",
"ID",
"(",
")",
",",
"weight",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"g",
",",
"nil",
"\n",
"}"
] |
11,181 | all-11182 | [
"NewAssetServer",
"constructs",
"an",
"asset",
"server",
"handler",
"that",
"serves",
"an",
"asset",
"directory",
"on",
"a",
"specified",
"path",
"and",
"serves",
"the",
"index",
"file",
"for",
"not",
"found",
"paths",
"which",
"is",
"needed",
"to",
"run",
"single",
"page",
"applications",
"like",
"Ember",
"."
] | [
"func",
"NewAssetServer",
"(",
"prefix",
",",
"directory",
"string",
")",
"http",
".",
"Handler",
"{",
"// ensure prefix",
"prefix",
"=",
"\"",
"\"",
"+",
"strings",
".",
"Trim",
"(",
"prefix",
",",
"\"",
"\"",
")",
"\n\n",
"// create dir server",
"dir",
":=",
"http",
".",
"Dir",
"(",
"directory",
")",
"\n\n",
"// create file server",
"fs",
":=",
"http",
".",
"FileServer",
"(",
"dir",
")",
"\n\n",
"h",
":=",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"// pre-check if file does exist",
"f",
",",
"err",
":=",
"dir",
".",
"Open",
"(",
"r",
".",
"URL",
".",
"Path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"r",
".",
"URL",
".",
"Path",
"=",
"\"",
"\"",
"\n",
"}",
"else",
"if",
"f",
"!=",
"nil",
"{",
"_",
"=",
"f",
".",
"Close",
"(",
")",
"\n",
"}",
"\n\n",
"// serve file",
"fs",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"\n\n",
"return",
"http",
".",
"StripPrefix",
"(",
"<mask>",
",",
"http",
".",
"HandlerFunc",
"(",
"h",
")",
")",
"\n",
"}"
] |
11,182 | all-11183 | [
"UnDeployVApp",
"-",
"executes",
"a",
"fake",
"undeploy",
"on",
"a",
"fake",
"client"
] | [
"func",
"(",
"s",
"*",
"FakeVCDClient",
")",
"UnDeployVApp",
"(",
"vappID",
"string",
")",
"(",
"<mask>",
"*",
"vcloudclient",
".",
"TaskElem",
",",
"err",
"error",
")",
"{",
"return",
"&",
"s",
".",
"FakeVApp",
".",
"Tasks",
".",
"Task",
",",
"s",
".",
"ErrDeployFake",
"\n",
"}"
] |
11,183 | all-11184 | [
"WithTemplatesFromFiles",
"adds",
"a",
"map",
"of",
"templates",
"parsed",
"from",
"files",
"."
] | [
"func",
"WithTemplatesFromFiles",
"(",
"<mask>",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"o",
"*",
"Options",
")",
"{",
"for",
"name",
",",
"files",
":=",
"range",
"ts",
"{",
"o",
".",
"files",
"[",
"name",
"]",
"=",
"files",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
11,184 | all-11185 | [
"GetToTsOk",
"returns",
"a",
"tuple",
"with",
"the",
"ToTs",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TriggeringValue",
")",
"GetToTsOk",
"(",
")",
"(",
"int",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"ToTs",
"==",
"nil",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"ToTs",
",",
"<mask>",
"\n",
"}"
] |
11,185 | all-11186 | [
"Clear",
"clears",
"the",
"cache",
"."
] | [
"func",
"(",
"c",
"*",
"Cache",
")",
"Clear",
"(",
")",
"error",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"defer",
"func",
"(",
")",
"{",
"c",
".",
"<mask>",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n",
"}",
"(",
")",
"\n",
"for",
"key",
":=",
"range",
"c",
".",
"keys",
"{",
"if",
"err",
":=",
"os",
".",
"Remove",
"(",
"filepath",
".",
"Join",
"(",
"c",
".",
"root",
",",
"key",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
11,186 | all-11187 | [
"Compare",
"returns",
"an",
"integer",
"comparing",
"two",
"versions",
"lexicographically",
"."
] | [
"func",
"(",
"x",
"Version",
")",
"Compare",
"(",
"y",
"<mask>",
")",
"int",
"{",
"n",
":=",
"len",
"(",
"x",
")",
"\n",
"if",
"len",
"(",
"y",
")",
"<",
"n",
"{",
"n",
"=",
"len",
"(",
"y",
")",
"\n",
"}",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
"{",
"cmp",
":=",
"x",
"[",
"i",
"]",
"-",
"y",
"[",
"i",
"]",
"\n",
"if",
"cmp",
"!=",
"0",
"{",
"return",
"cmp",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"len",
"(",
"x",
")",
"-",
"len",
"(",
"y",
")",
"\n",
"}"
] |
11,187 | all-11188 | [
"NewClient",
"allocates",
"and",
"configures",
"a",
"Client",
"for",
"interacting",
"with",
"the",
"API",
".",
"apiUrl",
"should",
"be",
"an",
"url",
"of",
"the",
"form",
"https",
":",
"//",
"api",
".",
"region",
".",
"brightbox",
".",
"com",
"e",
".",
"g",
":",
"https",
":",
"//",
"api",
".",
"gb1",
".",
"brightbox",
".",
"com",
".",
"You",
"can",
"use",
"the",
"default",
"defined",
"in",
"this",
"package",
"instead",
"i",
".",
"e",
".",
"brightbox",
".",
"DefaultRegionApiURL",
"accountId",
"should",
"be",
"the",
"identifier",
"of",
"the",
"default",
"account",
"to",
"be",
"used",
"with",
"this",
"Client",
".",
"Clients",
"authenticated",
"with",
"Brightbox",
"ApiClient",
"credentials",
"are",
"only",
"ever",
"associated",
"with",
"one",
"single",
"Account",
"so",
"you",
"can",
"leave",
"this",
"empty",
"for",
"those",
".",
"Client",
"s",
"authenticated",
"with",
"Brightbox",
"User",
"credentials",
"can",
"have",
"access",
"to",
"multiple",
"accounts",
"so",
"this",
"parameter",
"should",
"be",
"provided",
".",
"httpClient",
"should",
"be",
"a",
"http",
".",
"Client",
"with",
"a",
"transport",
"that",
"will",
"handle",
"the",
"OAuth",
"token",
"authentication",
"such",
"as",
"those",
"provided",
"by",
"https",
":",
"//",
"github",
".",
"com",
"/",
"golang",
"/",
"oauth2",
"/"
] | [
"func",
"NewClient",
"(",
"apiUrl",
"string",
",",
"accountId",
"string",
",",
"httpClient",
"*",
"http",
".",
"Client",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"if",
"httpClient",
"==",
"nil",
"{",
"httpClient",
"=",
"http",
".",
"DefaultClient",
"\n",
"}",
"\n",
"au",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"apiUrl",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"c",
":=",
"&",
"Client",
"{",
"<mask>",
":",
"httpClient",
",",
"BaseURL",
":",
"au",
",",
"AccountId",
":",
"accountId",
",",
"}",
"\n",
"return",
"c",
",",
"nil",
"\n",
"}"
] |
11,188 | all-11189 | [
"Send",
"sends",
"the",
"message",
"wrapped",
"inside",
"an",
"XMPP",
"message",
"stanza",
"body",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Send",
"(",
"chat",
"Chat",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"var",
"subtext",
"=",
"``",
"\n",
"var",
"thdtext",
"=",
"``",
"\n",
"if",
"chat",
".",
"Subject",
"!=",
"``",
"{",
"subtext",
"=",
"`<subject>`",
"+",
"xmlEscape",
"(",
"chat",
".",
"Subject",
")",
"+",
"`</subject>`",
"\n",
"}",
"\n",
"if",
"chat",
".",
"Thread",
"!=",
"``",
"{",
"thdtext",
"=",
"`<thread>`",
"+",
"xmlEscape",
"(",
"chat",
".",
"Thread",
")",
"+",
"`</thread>`",
"\n",
"}",
"\n\n",
"stanza",
":=",
"\"",
"\"",
"+",
"subtext",
"+",
"\"",
"\"",
"+",
"thdtext",
"+",
"\"",
"\"",
"\n\n",
"return",
"fmt",
".",
"Fprintf",
"(",
"c",
".",
"conn",
",",
"stanza",
",",
"xmlEscape",
"(",
"chat",
".",
"Remote",
")",
",",
"xmlEscape",
"(",
"chat",
".",
"<mask>",
")",
",",
"cnonce",
"(",
")",
",",
"xmlEscape",
"(",
"chat",
".",
"Text",
")",
")",
"\n",
"}"
] |
11,189 | all-11190 | [
"QR",
"generates",
"a",
"byte",
"slice",
"containing",
"the",
"a",
"QR",
"code",
"encoded",
"as",
"a",
"PNG",
"with",
"level",
"Q",
"error",
"correction",
"."
] | [
"func",
"(",
"otp",
"*",
"HOTP",
")",
"QR",
"(",
"label",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"u",
":=",
"otp",
".",
"URL",
"(",
"<mask>",
")",
"\n",
"code",
",",
"err",
":=",
"qr",
".",
"Encode",
"(",
"u",
",",
"qr",
".",
"Q",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"code",
".",
"PNG",
"(",
")",
",",
"nil",
"\n",
"}"
] |
11,190 | all-11191 | [
"Decodes",
"h",
"from",
"buf",
"."
] | [
"func",
"(",
"h",
"*",
"header",
")",
"Decode",
"(",
"buf",
"[",
"]",
"byte",
")",
"{",
"h",
".",
"klen",
"=",
"<mask>",
".",
"BigEndian",
".",
"Uint32",
"(",
"buf",
"[",
"0",
":",
"4",
"]",
")",
"\n",
"h",
".",
"vlen",
"=",
"binary",
".",
"BigEndian",
".",
"Uint32",
"(",
"buf",
"[",
"4",
":",
"8",
"]",
")",
"\n",
"h",
".",
"expiresAt",
"=",
"binary",
".",
"BigEndian",
".",
"Uint64",
"(",
"buf",
"[",
"8",
":",
"16",
"]",
")",
"\n",
"h",
".",
"meta",
"=",
"buf",
"[",
"16",
"]",
"\n",
"h",
".",
"userMeta",
"=",
"buf",
"[",
"17",
"]",
"\n",
"}"
] |
11,191 | all-11192 | [
"Contains",
"reports",
"whether",
"the",
"mac",
"address",
"belongs",
"to",
"the",
"OUI"
] | [
"func",
"(",
"b",
"*",
"AddressBlock",
")",
"Contains",
"(",
"<mask>",
"HardwareAddr",
")",
"bool",
"{",
"//fmt.Println(\"%v %v %v %v\", b.Oui, len(b.Oui), address.Mask(CIDRMask(b.Mask, len(b.Oui)*8)), CIDRMask(b.Mask, len(b.Oui)*8))",
"return",
"(",
"bytes",
".",
"Equal",
"(",
"address",
".",
"Mask",
"(",
"CIDRMask",
"(",
"b",
".",
"Mask",
",",
"len",
"(",
"b",
".",
"Oui",
")",
"*",
"8",
")",
")",
",",
"b",
".",
"Oui",
")",
")",
"\n",
"}"
] |
11,192 | all-11193 | [
"GetASMDockerAuthConfig",
"retrieves",
"the",
"docker",
"private",
"registry",
"auth",
"data",
"from",
"the",
"task"
] | [
"func",
"(",
"auth",
"*",
"ASMAuthResource",
")",
"GetASMDockerAuthConfig",
"(",
"secretID",
"string",
")",
"(",
"<mask>",
".",
"AuthConfig",
",",
"bool",
")",
"{",
"auth",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"auth",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"d",
",",
"ok",
":=",
"auth",
".",
"dockerAuthData",
"[",
"secretID",
"]",
"\n",
"return",
"d",
",",
"ok",
"\n",
"}"
] |
11,193 | all-11194 | [
"WindowCount",
"returns",
"the",
"number",
"of",
"available",
"windows",
"."
] | [
"func",
"(",
"p",
"*",
"Page",
")",
"WindowCount",
"(",
")",
"(",
"int",
",",
"error",
")",
"{",
"windows",
",",
"err",
":=",
"p",
".",
"<mask>",
".",
"GetWindows",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"len",
"(",
"windows",
")",
",",
"nil",
"\n",
"}"
] |
11,194 | all-11195 | [
"Gzip",
"returns",
"a",
"handler",
"that",
"will",
"use",
"gzip",
"compression",
"on",
"the",
"response",
"body",
"of",
"handler",
"h",
".",
"Compression",
"will",
"only",
"be",
"applied",
"if",
"the",
"request",
"contains",
"an",
"Accept",
"-",
"Encoding",
"header",
"that",
"contains",
"gzip",
".",
"By",
"default",
"no",
"messages",
"are",
"printed",
"out",
"."
] | [
"func",
"Gzip",
"(",
"h",
"http",
".",
"Handler",
",",
"opts",
"...",
"Option",
")",
"http",
".",
"Handler",
"{",
"o",
":=",
"options",
"{",
"logger",
":",
"handler",
".",
"OutLogger",
"(",
")",
"}",
"\n",
"o",
".",
"apply",
"(",
"opts",
")",
"\n\n",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"if",
"!",
"strings",
".",
"Contains",
"(",
"r",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"\"",
"\"",
")",
"{",
"h",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"wrapper",
":=",
"handler",
".",
"NewResponseWrapper",
"(",
"w",
")",
"\n\n",
"h",
".",
"ServeHTTP",
"(",
"wrapper",
",",
"r",
")",
"\n\n",
"for",
"k",
",",
"v",
":=",
"range",
"wrapper",
".",
"Header",
"(",
")",
"{",
"w",
".",
"Header",
"(",
")",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"w",
".",
"<mask>",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"if",
"w",
".",
"Header",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"==",
"\"",
"\"",
"{",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"http",
".",
"DetectContentType",
"(",
"wrapper",
".",
"Body",
".",
"Bytes",
"(",
")",
")",
")",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Del",
"(",
"\"",
"\"",
")",
"\n\n",
"if",
"wrapper",
".",
"Code",
"!=",
"http",
".",
"StatusOK",
"{",
"w",
".",
"WriteHeader",
"(",
"wrapper",
".",
"Code",
")",
"\n",
"}",
"\n\n",
"gz",
":=",
"gzip",
".",
"NewWriter",
"(",
"w",
")",
"\n",
"gz",
".",
"Flush",
"(",
")",
"\n\n",
"if",
"_",
",",
"err",
":=",
"gz",
".",
"Write",
"(",
"wrapper",
".",
"Body",
".",
"Bytes",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"o",
".",
"logger",
".",
"Print",
"(",
"\"",
"\"",
"+",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"http",
".",
"Error",
"(",
"w",
",",
"\"",
"\"",
",",
"http",
".",
"StatusInternalServerError",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"gz",
".",
"Close",
"(",
")",
"\n",
"}",
")",
"\n",
"}"
] |
11,195 | all-11196 | [
"Log",
"logs",
"provided",
"message",
"."
] | [
"func",
"(",
"logger",
"*",
"Logger",
")",
"Log",
"(",
"<mask>",
"Level",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"{",
"logger",
".",
"log",
"(",
"level",
",",
"\"",
"\"",
",",
"a",
"...",
")",
"\n",
"}"
] |
11,196 | all-11197 | [
"NewReader",
"creates",
"an",
"io",
".",
"ReadCloser",
"for",
"a",
"chunk",
".",
"(",
"bryce",
")",
"The",
"whole",
"chunk",
"is",
"in",
"-",
"memory",
"right",
"now",
".",
"Could",
"be",
"a",
"problem",
"with",
"concurrency",
"particularly",
"the",
"merge",
"process",
".",
"May",
"want",
"to",
"handle",
"concurrency",
"here",
"(",
"pass",
"in",
"multiple",
"data",
"refs",
")"
] | [
"func",
"(",
"s",
"*",
"Storage",
")",
"NewReader",
"(",
"ctx",
"context",
".",
"Context",
",",
"dataRefs",
"[",
"]",
"*",
"DataRef",
")",
"<mask>",
".",
"ReadCloser",
"{",
"if",
"len",
"(",
"dataRefs",
")",
"==",
"0",
"{",
"return",
"ioutil",
".",
"NopCloser",
"(",
"&",
"bytes",
".",
"Buffer",
"{",
"}",
")",
"\n",
"}",
"\n",
"return",
"newReader",
"(",
"ctx",
",",
"s",
".",
"objC",
",",
"s",
".",
"prefix",
",",
"dataRefs",
")",
"\n",
"}"
] |
11,197 | all-11198 | [
"GenerateETag",
"generates",
"an",
"ETag",
"based",
"on",
"size",
"filename",
"and",
"file",
"modification",
"time"
] | [
"func",
"GenerateETag",
"(",
"fileSize",
",",
"fileName",
",",
"modTime",
"string",
")",
"string",
"{",
"etag",
":=",
"fileSize",
"+",
"fileName",
"+",
"modTime",
"\n",
"return",
"base64",
".",
"StdEncoding",
".",
"EncodeToString",
"(",
"[",
"]",
"<mask>",
"(",
"etag",
")",
")",
"\n",
"}"
] |
11,198 | all-11199 | [
"Close",
"is",
"implementation",
"of",
"io",
".",
"Closer",
"s",
"Close",
"."
] | [
"func",
"(",
"s",
"*",
"<mask>",
")",
"Close",
"(",
")",
"error",
"{",
"runtime",
".",
"SetFinalizer",
"(",
"s",
",",
"nil",
")",
"\n",
"return",
"s",
".",
"src",
".",
"Close",
"(",
")",
"\n",
"}"
] |
11,199 | all-11200 | [
"Disconnect",
"from",
"a",
"peer",
"due",
"to",
"external",
"error",
"retry",
"if",
"it",
"is",
"a",
"persistent",
"peer",
".",
"TODO",
":",
"make",
"record",
"depending",
"on",
"reason",
"."
] | [
"func",
"(",
"sw",
"*",
"Switch",
")",
"StopPeerForError",
"(",
"peer",
"*",
"Peer",
",",
"reason",
"interface",
"{",
"}",
")",
"{",
"addr",
":=",
"NewNetAddress",
"(",
"peer",
".",
"Addr",
"(",
")",
")",
"\n",
"log",
".",
"Notice",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"peer",
",",
"\"",
"\"",
",",
"reason",
")",
"\n",
"sw",
".",
"stopAndRemovePeer",
"(",
"peer",
",",
"reason",
")",
"\n\n",
"if",
"peer",
".",
"IsPersistent",
"(",
")",
"{",
"go",
"func",
"(",
")",
"{",
"<mask>",
".",
"Notice",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"peer",
")",
"\n",
"for",
"i",
":=",
"1",
";",
"i",
"<",
"reconnectAttempts",
";",
"i",
"++",
"{",
"if",
"!",
"sw",
".",
"IsRunning",
"(",
")",
"{",
"return",
"\n",
"}",
"\n\n",
"peer",
",",
"err",
":=",
"sw",
".",
"DialPeerWithAddress",
"(",
"addr",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"i",
"==",
"reconnectAttempts",
"{",
"log",
".",
"Notice",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"i",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"log",
".",
"Notice",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"i",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"time",
".",
"Sleep",
"(",
"reconnectInterval",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"log",
".",
"Notice",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"peer",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.