id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
17,300 | all-17301 | [
"setV",
"computes",
"and",
"remembers",
"the",
"V",
"level",
"for",
"a",
"given",
"PC",
"when",
"vmodule",
"is",
"enabled",
".",
"File",
"pattern",
"matching",
"takes",
"the",
"basename",
"of",
"the",
"file",
"stripped",
"of",
"its",
".",
"go",
"suffix",
"and",
"uses",
"270",
".",
"Match",
"which",
"is",
"a",
"little",
"more",
"general",
"than",
"the",
"*",
"?",
"matching",
"used",
"in",
"C",
"++",
".",
"l",
".",
"mu",
"is",
"held",
"."
]
| [
"func",
"(",
"l",
"*",
"Log",
")",
"setV",
"(",
"pc",
"uintptr",
")",
"Level",
"{",
"fn",
":=",
"runtime",
".",
"FuncForPC",
"(",
"pc",
")",
"\n",
"file",
",",
"_",
":=",
"fn",
".",
"FileLine",
"(",
"pc",
")",
"\n",
"// The file is something like /a/b/c/d.go. We want just the d.",
"if",
"strings",
".",
"HasSuffix",
"(",
"file",
",",
"\"",
"\"",
")",
"{",
"file",
"=",
"file",
"[",
":",
"len",
"(",
"file",
")",
"-",
"3",
"]",
"\n",
"}",
"\n",
"module",
":=",
"file",
"\n",
"if",
"slash",
":=",
"strings",
".",
"LastIndex",
"(",
"file",
",",
"\"",
"\"",
")",
";",
"slash",
">=",
"0",
"{",
"module",
"=",
"<mask>",
"[",
"slash",
"+",
"1",
":",
"]",
"\n",
"}",
"\n",
"for",
"_",
",",
"filter",
":=",
"range",
"l",
".",
"vmodule",
".",
"filter",
"{",
"if",
"filter",
".",
"match",
"(",
"module",
")",
"{",
"l",
".",
"vmap",
"[",
"pc",
"]",
"=",
"filter",
".",
"level",
"\n",
"return",
"filter",
".",
"level",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"filter",
":=",
"range",
"l",
".",
"vfilepath",
".",
"filter",
"{",
"if",
"filter",
".",
"match",
"(",
"file",
")",
"{",
"l",
".",
"vmap",
"[",
"pc",
"]",
"=",
"filter",
".",
"level",
"\n",
"return",
"filter",
".",
"level",
"\n",
"}",
"\n",
"}",
"\n",
"l",
".",
"vmap",
"[",
"pc",
"]",
"=",
"0",
"\n",
"return",
"0",
"\n",
"}"
]
|
17,301 | all-17302 | [
"ChompRight",
"removes",
"suffix",
"from",
"end",
"of",
"s",
"."
]
| [
"func",
"ChompRight",
"(",
"s",
",",
"suffix",
"string",
")",
"<mask>",
"{",
"if",
"strings",
".",
"HasSuffix",
"(",
"s",
",",
"suffix",
")",
"{",
"return",
"s",
"[",
":",
"len",
"(",
"s",
")",
"-",
"len",
"(",
"suffix",
")",
"]",
"\n",
"}",
"\n",
"return",
"s",
"\n",
"}"
]
|
17,302 | all-17303 | [
"GetImageFingerprints",
"returns",
"a",
"list",
"of",
"available",
"image",
"fingerprints"
]
| [
"func",
"(",
"r",
"*",
"ProtocolSimpleStreams",
")",
"GetImageFingerprints",
"(",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"// Get all the images from simplestreams",
"images",
",",
"err",
":=",
"r",
".",
"ssClient",
".",
"ListImages",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// And now extract just the fingerprints",
"fingerprints",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"img",
":=",
"<mask>",
"images",
"{",
"fingerprints",
"=",
"append",
"(",
"fingerprints",
",",
"img",
".",
"Fingerprint",
")",
"\n",
"}",
"\n\n",
"return",
"fingerprints",
",",
"nil",
"\n",
"}"
]
|
17,303 | all-17304 | [
"DeepCopy",
"copies",
"the",
"receiver",
"into",
"a",
"new",
"UUID",
"."
]
| [
"func",
"(",
"u",
"*",
"UUID",
")",
"DeepCopy",
"(",
")",
"*",
"UUID",
"{",
"if",
"u",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"UUID",
")",
"\n",
"u",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"<mask>",
"\n",
"}"
]
|
17,304 | all-17305 | [
"NewClient",
"creates",
"a",
"new",
"Client",
"."
]
| [
"func",
"NewClient",
"(",
"logger",
"log",
".",
"Logger",
",",
"url",
"string",
",",
"timeout",
"<mask>",
".",
"Duration",
")",
"*",
"Client",
"{",
"return",
"&",
"Client",
"{",
"logger",
":",
"logger",
",",
"url",
":",
"url",
",",
"timeout",
":",
"timeout",
",",
"}",
"\n",
"}"
]
|
17,305 | all-17306 | [
"AddNoPin",
"adds",
"a",
"file",
"to",
"ipfs",
"without",
"pinning",
"it",
"Deprecated",
":",
"Use",
"Add",
"()",
"with",
"option",
"functions",
"instead"
]
| [
"func",
"(",
"s",
"*",
"Shell",
")",
"AddNoPin",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"string",
",",
"error",
")",
"{",
"return",
"s",
".",
"Add",
"(",
"r",
",",
"Pin",
"(",
"<mask>",
")",
")",
"\n",
"}"
]
|
17,306 | all-17307 | [
"PopulateSecrets",
"appends",
"secrets",
"to",
"container",
"s",
"env",
"var",
"map",
"and",
"hostconfig",
"section"
]
| [
"func",
"(",
"task",
"*",
"<mask>",
")",
"PopulateSecrets",
"(",
"hostConfig",
"*",
"dockercontainer",
".",
"HostConfig",
",",
"container",
"*",
"apicontainer",
".",
"Container",
")",
"*",
"apierrors",
".",
"DockerClientConfigError",
"{",
"var",
"ssmRes",
"*",
"ssmsecret",
".",
"SSMSecretResource",
"\n",
"var",
"asmRes",
"*",
"asmsecret",
".",
"ASMSecretResource",
"\n\n",
"if",
"container",
".",
"ShouldCreateWithSSMSecret",
"(",
")",
"{",
"resource",
",",
"ok",
":=",
"task",
".",
"getSSMSecretsResource",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"&",
"apierrors",
".",
"DockerClientConfigError",
"{",
"Msg",
":",
"\"",
"\"",
"}",
"\n",
"}",
"\n",
"ssmRes",
"=",
"resource",
"[",
"0",
"]",
".",
"(",
"*",
"ssmsecret",
".",
"SSMSecretResource",
")",
"\n",
"}",
"\n\n",
"if",
"container",
".",
"ShouldCreateWithASMSecret",
"(",
")",
"{",
"resource",
",",
"ok",
":=",
"task",
".",
"getASMSecretsResource",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"&",
"apierrors",
".",
"DockerClientConfigError",
"{",
"Msg",
":",
"\"",
"\"",
"}",
"\n",
"}",
"\n",
"asmRes",
"=",
"resource",
"[",
"0",
"]",
".",
"(",
"*",
"asmsecret",
".",
"ASMSecretResource",
")",
"\n",
"}",
"\n\n",
"envVars",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n\n",
"logDriverTokenName",
":=",
"\"",
"\"",
"\n",
"logDriverTokenSecretValue",
":=",
"\"",
"\"",
"\n\n",
"for",
"_",
",",
"secret",
":=",
"range",
"container",
".",
"Secrets",
"{",
"secretVal",
":=",
"\"",
"\"",
"\n\n",
"if",
"secret",
".",
"Provider",
"==",
"apicontainer",
".",
"SecretProviderSSM",
"{",
"k",
":=",
"secret",
".",
"GetSecretResourceCacheKey",
"(",
")",
"\n",
"if",
"secretValue",
",",
"ok",
":=",
"ssmRes",
".",
"GetCachedSecretValue",
"(",
"k",
")",
";",
"ok",
"{",
"secretVal",
"=",
"secretValue",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"secret",
".",
"Provider",
"==",
"apicontainer",
".",
"SecretProviderASM",
"{",
"k",
":=",
"secret",
".",
"GetSecretResourceCacheKey",
"(",
")",
"\n",
"if",
"secretValue",
",",
"ok",
":=",
"asmRes",
".",
"GetCachedSecretValue",
"(",
"k",
")",
";",
"ok",
"{",
"secretVal",
"=",
"secretValue",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"secret",
".",
"Type",
"==",
"apicontainer",
".",
"SecretTypeEnv",
"{",
"envVars",
"[",
"secret",
".",
"Name",
"]",
"=",
"secretVal",
"\n",
"continue",
"\n",
"}",
"\n",
"if",
"secret",
".",
"Target",
"==",
"apicontainer",
".",
"SecretTargetLogDriver",
"{",
"logDriverTokenName",
"=",
"secret",
".",
"Name",
"\n",
"logDriverTokenSecretValue",
"=",
"secretVal",
"\n\n",
"// Check if all the name and secret value for the log driver do exist",
"// And add the secret value for this log driver into container's HostConfig",
"if",
"hostConfig",
".",
"LogConfig",
".",
"Type",
"!=",
"\"",
"\"",
"&&",
"logDriverTokenName",
"!=",
"\"",
"\"",
"&&",
"logDriverTokenSecretValue",
"!=",
"\"",
"\"",
"{",
"hostConfig",
".",
"LogConfig",
".",
"Config",
"[",
"logDriverTokenName",
"]",
"=",
"logDriverTokenSecretValue",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"container",
".",
"MergeEnvironmentVariables",
"(",
"envVars",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,307 | all-17308 | [
"export",
"FrameSet_FrameRange"
]
| [
"func",
"FrameSet_FrameRange",
"(",
"id",
"FrameSetId",
")",
"(",
"ret",
"*",
"C",
".",
"char",
")",
"{",
"fs",
",",
"ok",
":=",
"sFrameSets",
".",
"Get",
"(",
"id",
")",
"\n",
"if",
"!",
"ok",
"{",
"<mask>",
"=",
"C",
".",
"CString",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"ret",
"=",
"C",
".",
"CString",
"(",
"fs",
".",
"FrameRange",
"(",
")",
")",
"\n",
"}",
"\n",
"// caller must free the string",
"return",
"ret",
"\n",
"}"
]
|
17,308 | all-17309 | [
"SetAlignment",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_entry_set_alignment",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetAlignment",
"(",
"xalign",
"float32",
")",
"{",
"C",
".",
"gtk_entry_set_alignment",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gfloat",
"(",
"xalign",
")",
")",
"\n",
"}"
]
|
17,309 | all-17310 | [
"ConnectionsTo",
"returns",
"all",
"known",
"connections",
"to",
"the",
"named",
"peers",
".",
"TODO",
"(",
"pb",
")",
":",
"Weave",
"Net",
"invokes",
"router",
".",
"Ourself",
".",
"ConnectionsTo",
";",
"it",
"may",
"be",
"better",
"to",
"provide",
"that",
"on",
"Router",
"directly",
"."
]
| [
"func",
"(",
"peer",
"*",
"localPeer",
")",
"ConnectionsTo",
"(",
"names",
"[",
"]",
"PeerName",
")",
"[",
"]",
"Connection",
"{",
"if",
"len",
"(",
"names",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"conns",
":=",
"make",
"(",
"[",
"]",
"Connection",
",",
"0",
",",
"len",
"(",
"names",
")",
")",
"\n",
"peer",
".",
"RLock",
"(",
")",
"\n",
"defer",
"peer",
".",
"RUnlock",
"(",
")",
"\n",
"for",
"_",
",",
"name",
":=",
"range",
"names",
"{",
"conn",
",",
"found",
":=",
"peer",
".",
"connections",
"[",
"name",
"]",
"\n",
"// Again, !found could just be due to a race.",
"if",
"found",
"{",
"conns",
"=",
"<mask>",
"(",
"conns",
",",
"conn",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"conns",
"\n",
"}"
]
|
17,310 | all-17311 | [
"GetCreatedAt",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockTaskResource",
")",
"GetCreatedAt",
"(",
")",
"time",
".",
"Time",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"time",
".",
"Time",
")",
"\n",
"return",
"ret0",
"\n",
"}"
]
|
17,311 | all-17312 | [
"TaskMetadataHandler",
"returns",
"the",
"handler",
"method",
"for",
"handling",
"task",
"metadata",
"requests",
"."
]
| [
"func",
"TaskMetadataHandler",
"(",
"state",
"dockerstate",
".",
"TaskEngineState",
",",
"ecsClient",
"api",
".",
"ECSClient",
",",
"cluster",
",",
"az",
",",
"containerInstanceArn",
"string",
",",
"propagateTags",
"bool",
")",
"func",
"(",
"http",
".",
"ResponseWriter",
",",
"*",
"http",
".",
"Request",
")",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"taskARN",
",",
"err",
":=",
"getTaskARNByRequest",
"(",
"r",
",",
"state",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"responseJSON",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
")",
"\n",
"utils",
".",
"WriteJSONToResponse",
"(",
"w",
",",
"http",
".",
"StatusBadRequest",
",",
"responseJSON",
",",
"utils",
".",
"RequestTypeTaskMetadata",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"taskARN",
")",
"\n\n",
"taskResponse",
",",
"err",
":=",
"v2",
".",
"NewTaskResponse",
"(",
"taskARN",
",",
"state",
",",
"ecsClient",
",",
"cluster",
",",
"az",
",",
"containerInstanceArn",
",",
"propagateTags",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errResponseJSON",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"\"",
"\"",
"+",
"taskARN",
"+",
"\"",
"\"",
")",
"\n",
"utils",
".",
"WriteJSONToResponse",
"(",
"w",
",",
"http",
".",
"StatusBadRequest",
",",
"errResponseJSON",
",",
"utils",
".",
"RequestTypeTaskMetadata",
")",
"\n",
"return",
"\n",
"}",
"\n",
"task",
",",
"_",
":=",
"state",
".",
"TaskByArn",
"(",
"taskARN",
")",
"\n",
"if",
"<mask>",
".",
"GetTaskENI",
"(",
")",
"==",
"nil",
"{",
"// fill in non-awsvpc network details for container responses here",
"responses",
":=",
"make",
"(",
"[",
"]",
"v2",
".",
"ContainerResponse",
",",
"0",
")",
"\n",
"for",
"_",
",",
"containerResponse",
":=",
"range",
"taskResponse",
".",
"Containers",
"{",
"networks",
",",
"err",
":=",
"GetContainerNetworkMetadata",
"(",
"containerResponse",
".",
"ID",
",",
"state",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errResponseJSON",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"utils",
".",
"WriteJSONToResponse",
"(",
"w",
",",
"http",
".",
"StatusBadRequest",
",",
"errResponseJSON",
",",
"utils",
".",
"RequestTypeContainerMetadata",
")",
"\n",
"return",
"\n",
"}",
"\n",
"containerResponse",
".",
"Networks",
"=",
"networks",
"\n",
"responses",
"=",
"append",
"(",
"responses",
",",
"containerResponse",
")",
"\n",
"}",
"\n",
"taskResponse",
".",
"Containers",
"=",
"responses",
"\n",
"}",
"\n",
"responseJSON",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"taskResponse",
")",
"\n",
"utils",
".",
"WriteJSONToResponse",
"(",
"w",
",",
"http",
".",
"StatusOK",
",",
"responseJSON",
",",
"utils",
".",
"RequestTypeTaskMetadata",
")",
"\n",
"}",
"\n",
"}"
]
|
17,312 | all-17313 | [
"computeExternalURL",
"computes",
"a",
"sanitized",
"external",
"URL",
"from",
"a",
"raw",
"input",
".",
"It",
"infers",
"unset",
"URL",
"parts",
"from",
"the",
"OS",
"and",
"the",
"given",
"listen",
"address",
"."
]
| [
"func",
"computeExternalURL",
"(",
"u",
",",
"listenAddr",
"string",
")",
"(",
"*",
"url",
".",
"URL",
",",
"error",
")",
"{",
"if",
"u",
"==",
"\"",
"\"",
"{",
"hostname",
",",
"err",
":=",
"os",
".",
"Hostname",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"_",
",",
"<mask>",
",",
"err",
":=",
"net",
".",
"SplitHostPort",
"(",
"listenAddr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"u",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"hostname",
",",
"port",
")",
"\n",
"}",
"\n\n",
"if",
"startsOrEndsWithQuote",
"(",
"u",
")",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"eu",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"u",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"ppref",
":=",
"strings",
".",
"TrimRight",
"(",
"eu",
".",
"Path",
",",
"\"",
"\"",
")",
"\n",
"if",
"ppref",
"!=",
"\"",
"\"",
"&&",
"!",
"strings",
".",
"HasPrefix",
"(",
"ppref",
",",
"\"",
"\"",
")",
"{",
"ppref",
"=",
"\"",
"\"",
"+",
"ppref",
"\n",
"}",
"\n",
"eu",
".",
"Path",
"=",
"ppref",
"\n\n",
"return",
"eu",
",",
"nil",
"\n",
"}"
]
|
17,313 | all-17314 | [
"Used",
"to",
"get",
"an",
"address",
"of",
"interface",
"."
]
| [
"func",
"getIfaceAddr",
"(",
"idx",
"uint32",
",",
"<mask>",
"uint8",
")",
"(",
"*",
"syscall",
".",
"NetlinkMessage",
",",
"error",
")",
"{",
"dat",
",",
"err",
":=",
"syscall",
".",
"NetlinkRIB",
"(",
"syscall",
".",
"RTM_GETADDR",
",",
"int",
"(",
"family",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"msgs",
",",
"msgErr",
":=",
"syscall",
".",
"ParseNetlinkMessage",
"(",
"dat",
")",
"\n",
"if",
"msgErr",
"!=",
"nil",
"{",
"return",
"nil",
",",
"msgErr",
"\n",
"}",
"\n\n",
"ifaddrmsg",
":=",
"syscall",
".",
"IfAddrmsg",
"{",
"}",
"\n",
"for",
"_",
",",
"m",
":=",
"range",
"msgs",
"{",
"if",
"m",
".",
"Header",
".",
"Type",
"!=",
"syscall",
".",
"RTM_NEWADDR",
"{",
"continue",
"\n",
"}",
"\n",
"buf",
":=",
"bytes",
".",
"NewBuffer",
"(",
"m",
".",
"Data",
"[",
":",
"syscall",
".",
"SizeofIfAddrmsg",
"]",
")",
"\n",
"if",
"rerr",
":=",
"binary",
".",
"Read",
"(",
"buf",
",",
"cpuutil",
".",
"ByteOrder",
"(",
")",
",",
"&",
"ifaddrmsg",
")",
";",
"rerr",
"!=",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"ifaddrmsg",
".",
"Index",
"==",
"idx",
"{",
"return",
"&",
"m",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"idx",
")",
"\n\n",
"}"
]
|
17,314 | all-17315 | [
"isKeyPresent",
"iterates",
"over",
"the",
"InfoList",
"to",
"check",
"if",
"the",
"license",
"is",
"present",
"or",
"not",
"."
]
| [
"func",
"isKeyPresent",
"(",
"key",
"string",
",",
"manager",
"*",
"license",
".",
"<mask>",
")",
"bool",
"{",
"infoList",
",",
"_",
":=",
"manager",
".",
"List",
"(",
"context",
".",
"TODO",
"(",
")",
")",
"\n\n",
"for",
"_",
",",
"info",
":=",
"range",
"infoList",
"{",
"if",
"info",
".",
"LicenseKey",
"==",
"key",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
17,315 | all-17316 | [
"Middleware",
"registers",
"middleware",
"to",
"handle",
"incoming",
"request",
"messages",
"."
]
| [
"func",
"(",
"c",
"*",
"Conn",
")",
"Middleware",
"(",
"middleware",
"...",
"Middleware",
")",
"{",
"for",
"_",
",",
"m",
":=",
"<mask>",
"middleware",
"{",
"c",
".",
"MiddlewareFunc",
"(",
"m",
".",
"Middleware",
")",
"\n",
"}",
"\n",
"}"
]
|
17,316 | all-17317 | [
"SetCursorTimeout",
"changes",
"the",
"standard",
"timeout",
"period",
"that",
"the",
"server",
"enforces",
"on",
"created",
"cursors",
".",
"The",
"only",
"supported",
"value",
"right",
"now",
"is",
"0",
"which",
"disables",
"the",
"timeout",
".",
"The",
"standard",
"server",
"timeout",
"is",
"10",
"minutes",
"."
]
| [
"func",
"(",
"s",
"*",
"<mask>",
")",
"SetCursorTimeout",
"(",
"d",
"time",
".",
"Duration",
")",
"{",
"s",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"if",
"d",
"==",
"0",
"{",
"s",
".",
"queryConfig",
".",
"op",
".",
"flags",
"|=",
"flagNoCursorTimeout",
"\n",
"}",
"else",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"s",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"}"
]
|
17,317 | all-17318 | [
"HasText",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"e",
"*",
"Event",
")",
"HasText",
"(",
")",
"bool",
"{",
"if",
"e",
"!=",
"nil",
"&&",
"e",
".",
"Text",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
17,318 | all-17319 | [
"GetStatusOk",
"returns",
"a",
"tuple",
"with",
"the",
"Status",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"s",
"*",
"SyntheticsTest",
")",
"GetStatusOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Status",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Status",
",",
"<mask>",
"\n",
"}"
]
|
17,319 | all-17320 | [
"isAnsiCommandChar",
"returns",
"true",
"if",
"the",
"passed",
"byte",
"falls",
"within",
"the",
"range",
"of",
"ANSI",
"commands",
".",
"See",
"http",
":",
"//",
"manpages",
".",
"ubuntu",
".",
"com",
"/",
"manpages",
"/",
"intrepid",
"/",
"man4",
"/",
"console_codes",
".",
"4",
".",
"html",
"."
]
| [
"func",
"isAnsiCommandChar",
"(",
"b",
"byte",
")",
"bool",
"{",
"switch",
"{",
"<mask>",
"ansiterm",
".",
"ANSI_COMMAND_FIRST",
"<=",
"b",
"&&",
"b",
"<=",
"ansiterm",
".",
"ANSI_COMMAND_LAST",
"&&",
"b",
"!=",
"ansiterm",
".",
"ANSI_ESCAPE_SECONDARY",
":",
"return",
"true",
"\n",
"case",
"b",
"==",
"ansiterm",
".",
"ANSI_CMD_G1",
"||",
"b",
"==",
"ansiterm",
".",
"ANSI_CMD_OSC",
"||",
"b",
"==",
"ansiterm",
".",
"ANSI_CMD_DECPAM",
"||",
"b",
"==",
"ansiterm",
".",
"ANSI_CMD_DECPNM",
":",
"// non-CSI escape sequence terminator",
"return",
"true",
"\n",
"case",
"b",
"==",
"ansiterm",
".",
"ANSI_CMD_STR_TERM",
"||",
"b",
"==",
"ansiterm",
".",
"ANSI_BEL",
":",
"// String escape sequence terminator",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
]
|
17,320 | all-17321 | [
"PutMulti",
"is",
"a",
"batch",
"version",
"of",
"Put",
".",
"src",
"must",
"satisfy",
"the",
"same",
"conditions",
"as",
"the",
"dst",
"argument",
"to",
"GetMulti",
"."
]
| [
"func",
"PutMulti",
"(",
"c",
"context",
".",
"Context",
",",
"key",
"[",
"]",
"*",
"Key",
",",
"src",
"interface",
"{",
"}",
")",
"(",
"[",
"]",
"*",
"Key",
",",
"error",
")",
"{",
"v",
":=",
"reflect",
".",
"ValueOf",
"(",
"src",
")",
"\n",
"multiArgType",
",",
"_",
":=",
"checkMultiArg",
"(",
"v",
")",
"\n",
"if",
"multiArgType",
"==",
"multiArgTypeInvalid",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"key",
")",
"!=",
"v",
".",
"Len",
"(",
")",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"key",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"appID",
":=",
"internal",
".",
"FullyQualifiedAppID",
"(",
"c",
")",
"\n",
"if",
"err",
":=",
"multiValid",
"(",
"key",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"req",
":=",
"&",
"pb",
".",
"PutRequest",
"{",
"}",
"\n",
"for",
"i",
":=",
"range",
"key",
"{",
"elem",
":=",
"v",
".",
"Index",
"(",
"i",
")",
"\n",
"if",
"multiArgType",
"==",
"multiArgTypePropertyLoadSaver",
"||",
"multiArgType",
"==",
"multiArgTypeStruct",
"{",
"elem",
"=",
"elem",
".",
"Addr",
"(",
")",
"\n",
"}",
"\n",
"sProto",
",",
"err",
":=",
"saveEntity",
"(",
"appID",
",",
"key",
"[",
"i",
"]",
",",
"elem",
".",
"Interface",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"req",
".",
"Entity",
"=",
"append",
"(",
"req",
".",
"Entity",
",",
"sProto",
")",
"\n",
"}",
"\n",
"res",
":=",
"&",
"pb",
".",
"PutResponse",
"{",
"}",
"\n",
"if",
"err",
":=",
"internal",
".",
"Call",
"(",
"c",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"res",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"key",
")",
"!=",
"len",
"(",
"res",
".",
"Key",
")",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"ret",
":=",
"make",
"(",
"[",
"]",
"*",
"Key",
",",
"len",
"(",
"<mask>",
")",
")",
"\n",
"for",
"i",
":=",
"range",
"ret",
"{",
"var",
"err",
"error",
"\n",
"ret",
"[",
"i",
"]",
",",
"err",
"=",
"protoToKey",
"(",
"res",
".",
"Key",
"[",
"i",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"ret",
"[",
"i",
"]",
".",
"Incomplete",
"(",
")",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"ret",
",",
"nil",
"\n",
"}"
]
|
17,321 | all-17322 | [
"TickGo",
"constructs",
"a",
"ticker",
"with",
"interval",
"and",
"calls",
"the",
"given",
"ProcessFunc",
"every",
"time",
"the",
"ticker",
"fires",
".",
"This",
"is",
"not",
"rate",
"limited",
"multiple",
"calls",
"could",
"be",
"in",
"-",
"flight",
"at",
"the",
"same",
"time",
".",
"p",
":",
"=",
"periodicproc",
".",
"TickGo",
"(",
"time",
".",
"Second",
"func",
"(",
"proc",
"goprocess",
".",
"Process",
")",
"{",
"fmt",
".",
"Println",
"(",
"fire!",
")",
"<",
"-",
"time",
".",
"After",
"(",
"10",
"*",
"time",
".",
"Second",
")",
"//",
"will",
"not",
"block",
"sequential",
"execution",
"}",
")",
"<",
"-",
"time",
".",
"After",
"(",
"3",
"*",
"time",
".",
"Second",
")",
"p",
".",
"Close",
"()",
"//",
"Output",
":",
"//",
"fire!",
"//",
"fire!",
"//",
"fire!"
]
| [
"func",
"TickGo",
"(",
"interval",
"time",
".",
"Duration",
",",
"procfunc",
"gp",
".",
"ProcessFunc",
")",
"gp",
".",
"Process",
"{",
"return",
"gp",
".",
"Go",
"(",
"func",
"(",
"proc",
"gp",
".",
"Process",
")",
"{",
"ticker",
":=",
"<mask>",
".",
"NewTicker",
"(",
"interval",
")",
"\n",
"goCallOnTicker",
"(",
"ticker",
".",
"C",
",",
"procfunc",
")",
"(",
"proc",
")",
"\n",
"ticker",
".",
"Stop",
"(",
")",
"\n",
"}",
")",
"\n",
"}"
]
|
17,322 | all-17323 | [
"NewAPIAnalyzer",
"is",
"the",
"factory",
"method",
"for",
"APIAnalyzer",
"."
]
| [
"func",
"NewAPIAnalyzer",
"(",
"version",
",",
"clientName",
"string",
",",
"<mask>",
"*",
"Doc",
",",
"attrOverrides",
",",
"typeOverrides",
"map",
"[",
"string",
"]",
"string",
")",
"*",
"APIAnalyzer",
"{",
"return",
"&",
"APIAnalyzer",
"{",
"Doc",
":",
"doc",
",",
"Version",
":",
"version",
",",
"ClientName",
":",
"clientName",
",",
"AttrOverrides",
":",
"attrOverrides",
",",
"TypeOverrides",
":",
"typeOverrides",
",",
"refByType",
":",
"map",
"[",
"string",
"]",
"string",
"{",
"}",
",",
"}",
"\n",
"}"
]
|
17,323 | all-17324 | [
"Fetches",
"ranter",
"s",
"profile",
"data"
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"Profile",
"(",
"username",
"string",
")",
"(",
"UserModel",
",",
"ContentModel",
",",
"error",
")",
"{",
"userId",
",",
"err",
":=",
"getUserId",
"(",
"username",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"UserModel",
"{",
"}",
",",
"ContentModel",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"<mask>",
":=",
"fmt",
".",
"Sprintf",
"(",
"USER_PATH",
",",
"API",
",",
"userId",
",",
"APP_VERSION",
")",
"\n",
"res",
",",
"err",
":=",
"http",
".",
"Get",
"(",
"url",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"UserModel",
"{",
"}",
",",
"ContentModel",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"var",
"data",
"UserResponse",
"\n",
"json",
".",
"NewDecoder",
"(",
"res",
".",
"Body",
")",
".",
"Decode",
"(",
"&",
"data",
")",
"\n",
"if",
"!",
"data",
".",
"Success",
"&&",
"data",
".",
"Error",
"!=",
"\"",
"\"",
"{",
"return",
"UserModel",
"{",
"}",
",",
"ContentModel",
"{",
"}",
",",
"errors",
".",
"New",
"(",
"data",
".",
"Error",
")",
"\n",
"}",
"\n",
"return",
"data",
".",
"Profile",
",",
"data",
".",
"Profile",
".",
"Content",
".",
"Content",
",",
"nil",
"\n",
"}"
]
|
17,324 | all-17325 | [
"fwrule_path",
"returns",
"the",
"string",
"/",
"datacenters",
"/",
"<dcid",
">",
"/",
"servers",
"/",
"<srvid",
">",
"/",
"nics",
"/",
"<nicid",
">",
"/",
"firewallrules",
"/",
"<fwruleid",
">"
]
| [
"func",
"fwrulePath",
"(",
"dcid",
",",
"srvid",
",",
"nicid",
",",
"fwruleid",
"string",
")",
"<mask>",
"{",
"return",
"fwruleColPath",
"(",
"dcid",
",",
"srvid",
",",
"nicid",
")",
"+",
"slash",
"(",
"fwruleid",
")",
"\n",
"}"
]
|
17,325 | all-17326 | [
"HasTimeout",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"s",
"*",
"SyntheticsRequest",
")",
"HasTimeout",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"Timeout",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
]
|
17,326 | all-17327 | [
"NewDelCommand",
"returns",
"the",
"cobra",
"command",
"for",
"del",
"."
]
| [
"func",
"NewDelCommand",
"(",
")",
"*",
"cobra",
".",
"Command",
"{",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Run",
":",
"delCommandFunc",
",",
"}",
"\n\n",
"cmd",
".",
"Flags",
"(",
")",
".",
"BoolVar",
"(",
"&",
"delPrefix",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"cmd",
".",
"Flags",
"(",
")",
".",
"BoolVar",
"(",
"&",
"delPrevKV",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"cmd",
".",
"Flags",
"(",
")",
".",
"BoolVar",
"(",
"&",
"delFromKey",
",",
"\"",
"\"",
",",
"<mask>",
",",
"\"",
"\"",
")",
"\n",
"return",
"cmd",
"\n",
"}"
]
|
17,327 | all-17328 | [
"originURL",
"retrieves",
"remote",
"origin",
"url",
"for",
"the",
"git",
"repository",
"at",
"path"
]
| [
"func",
"(",
"r",
"*",
"Repo",
")",
"originURL",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"_",
",",
"err",
":=",
"gos",
".",
"Stat",
"(",
"r",
".",
"Path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"args",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"\n",
"return",
"runCmdOutput",
"(",
"gitBinary",
",",
"args",
",",
"r",
".",
"<mask>",
")",
"\n",
"}"
]
|
17,328 | all-17329 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
]
| [
"func",
"(",
"t",
"*",
"ValueSourceType",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"ValueSourceType",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"ValueSourceTypeAttribute",
":",
"*",
"t",
"=",
"ValueSourceTypeAttribute",
"\n",
"case",
"ValueSourceTypeImplicit",
":",
"*",
"t",
"=",
"ValueSourceTypeImplicit",
"\n",
"case",
"ValueSourceTypeStyle",
":",
"*",
"t",
"=",
"ValueSourceTypeStyle",
"\n",
"case",
"ValueSourceTypeContents",
":",
"*",
"t",
"=",
"ValueSourceTypeContents",
"\n",
"case",
"ValueSourceTypePlaceholder",
":",
"*",
"t",
"=",
"ValueSourceTypePlaceholder",
"\n",
"case",
"ValueSourceTypeRelatedElement",
":",
"*",
"t",
"=",
"ValueSourceTypeRelatedElement",
"\n\n",
"default",
":",
"in",
".",
"AddError",
"(",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
]
|
17,329 | all-17330 | [
"Fatal",
"writes",
"the",
"given",
"values",
"to",
"the",
"Target",
"logger",
"."
]
| [
"func",
"(",
"t",
"*",
"Target",
")",
"Fatal",
"(",
"v",
"<mask>",
")",
"{",
"t",
".",
"mut",
".",
"RLock",
"(",
")",
"\n",
"defer",
"t",
".",
"mut",
".",
"RUnlock",
"(",
")",
"\n",
"if",
"t",
".",
"logger",
"!=",
"nil",
"{",
"t",
".",
"logger",
".",
"Fatal",
"(",
"v",
")",
"\n",
"}",
"\n",
"}"
]
|
17,330 | all-17331 | [
"JoinPage",
"creates",
"a",
"Page",
"using",
"existing",
"session",
"URL",
".",
"This",
"method",
"takes",
"Options",
"but",
"respects",
"only",
"the",
"HTTPClient",
"Option",
"if",
"provided",
"."
]
| [
"func",
"JoinPage",
"(",
"url",
"string",
",",
"options",
"...",
"Option",
")",
"*",
"Page",
"{",
"pageOptions",
":=",
"config",
"{",
"}",
".",
"Merge",
"(",
"options",
")",
"\n",
"session",
":=",
"api",
".",
"NewWithClient",
"(",
"<mask>",
",",
"pageOptions",
".",
"HTTPClient",
")",
"\n",
"return",
"newPage",
"(",
"session",
")",
"\n",
"}"
]
|
17,331 | all-17332 | [
"StoragePoolDriver",
"returns",
"the",
"driver",
"of",
"the",
"pool",
"with",
"the",
"given",
"ID",
"."
]
| [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"StoragePoolDriver",
"(",
"id",
"int64",
")",
"(",
"string",
",",
"error",
")",
"{",
"stmt",
":=",
"\"",
"\"",
"\n",
"drivers",
",",
"err",
":=",
"query",
".",
"SelectStrings",
"(",
"c",
".",
"<mask>",
",",
"stmt",
",",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"switch",
"len",
"(",
"drivers",
")",
"{",
"case",
"0",
":",
"return",
"\"",
"\"",
",",
"ErrNoSuchObject",
"\n",
"case",
"1",
":",
"return",
"drivers",
"[",
"0",
"]",
",",
"nil",
"\n",
"default",
":",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
]
|
17,332 | all-17333 | [
"ContainerGetBackup",
"returns",
"the",
"backup",
"with",
"the",
"given",
"name",
"."
]
| [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ContainerGetBackup",
"(",
"project",
",",
"name",
"string",
")",
"(",
"ContainerBackupArgs",
",",
"error",
")",
"{",
"args",
":=",
"ContainerBackupArgs",
"{",
"}",
"\n",
"args",
".",
"Name",
"=",
"name",
"\n\n",
"containerOnlyInt",
":=",
"-",
"1",
"\n",
"optimizedStorageInt",
":=",
"-",
"1",
"\n",
"q",
":=",
"`\nSELECT containers_backups.id, containers_backups.container_id,\n containers_backups.creation_date, containers_backups.expiry_date,\n containers_backups.container_only, containers_backups.optimized_storage\n FROM containers_backups\n JOIN containers ON containers.id=containers_backups.container_id\n JOIN projects ON projects.id=containers.project_id\n WHERE projects.name=? AND containers_backups.name=?\n`",
"\n",
"arg1",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"project",
",",
"<mask>",
"}",
"\n",
"arg2",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"&",
"args",
".",
"ID",
",",
"&",
"args",
".",
"ContainerID",
",",
"&",
"args",
".",
"CreationDate",
",",
"&",
"args",
".",
"ExpiryDate",
",",
"&",
"containerOnlyInt",
",",
"&",
"optimizedStorageInt",
"}",
"\n",
"err",
":=",
"dbQueryRowScan",
"(",
"c",
".",
"db",
",",
"q",
",",
"arg1",
",",
"arg2",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"sql",
".",
"ErrNoRows",
"{",
"return",
"args",
",",
"ErrNoSuchObject",
"\n",
"}",
"\n\n",
"return",
"args",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"containerOnlyInt",
"==",
"1",
"{",
"args",
".",
"ContainerOnly",
"=",
"true",
"\n",
"}",
"\n\n",
"if",
"optimizedStorageInt",
"==",
"1",
"{",
"args",
".",
"OptimizedStorage",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"args",
",",
"nil",
"\n",
"}"
]
|
17,333 | all-17334 | [
"StatusbarNew",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_statusbar_new",
"()",
"."
]
| [
"func",
"StatusbarNew",
"(",
")",
"(",
"*",
"Statusbar",
",",
"<mask>",
")",
"{",
"c",
":=",
"C",
".",
"gtk_statusbar_new",
"(",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapStatusbar",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
]
|
17,334 | all-17335 | [
"MustConfirm",
"retrieves",
"the",
"Confirm",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
]
| [
"func",
"(",
"u",
"ScpStatementPledges",
")",
"MustConfirm",
"(",
")",
"ScpStatementConfirm",
"{",
"val",
",",
"<mask>",
":=",
"u",
".",
"GetConfirm",
"(",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
]
|
17,335 | all-17336 | [
"HasService",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"t",
"*",
"TraceServiceDefinition",
")",
"HasService",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"<mask>",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
17,336 | all-17337 | [
"NewMockSecretsManagerAPI",
"creates",
"a",
"new",
"mock",
"instance"
]
| [
"func",
"NewMockSecretsManagerAPI",
"(",
"ctrl",
"*",
"gomock",
".",
"<mask>",
")",
"*",
"MockSecretsManagerAPI",
"{",
"mock",
":=",
"&",
"MockSecretsManagerAPI",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockSecretsManagerAPIMockRecorder",
"{",
"mock",
"}",
"\n",
"return",
"mock",
"\n",
"}"
]
|
17,337 | all-17338 | [
"InitPlugin",
"creates",
"an",
"instance",
"of",
"the",
"named",
"plugin",
"."
]
| [
"func",
"InitProvider",
"(",
"name",
"string",
",",
"configFilePath",
"string",
")",
"(",
"Provisioner",
",",
"error",
")",
"{",
"var",
"provider",
"Provisioner",
"\n\n",
"if",
"name",
"==",
"\"",
"\"",
"{",
"logger",
".",
"Get",
"(",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n\n",
"var",
"err",
"error",
"\n\n",
"if",
"configFilePath",
"!=",
"\"",
"\"",
"{",
"config",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"configFilePath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Get",
"(",
")",
".",
"Critical",
"(",
"\"",
"\"",
",",
"configFilePath",
",",
"err",
")",
"\n",
"}",
"\n\n",
"defer",
"config",
".",
"Close",
"(",
")",
"\n",
"provider",
",",
"err",
"=",
"GetProvider",
"(",
"name",
",",
"config",
")",
"\n",
"}",
"else",
"{",
"// Pass explicit nil so providers can actually check for nil. See",
"// \"Why is my nil error value not equal to nil?\" in golang.org/doc/faq.",
"provider",
",",
"err",
"=",
"GetProvider",
"(",
"name",
",",
"nil",
")",
"\n",
"}",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"provider",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"<mask>",
")",
"\n",
"}",
"\n\n",
"return",
"provider",
",",
"nil",
"\n",
"}"
]
|
17,338 | all-17339 | [
"Based",
"on",
"github",
".",
"com",
"/",
"docker",
"/",
"docker",
"/",
"distribution",
"/",
"pull_v2",
".",
"go"
]
| [
"func",
"(",
"m",
"*",
"manifestSchema1",
")",
"convertToManifestSchema2",
"(",
"uploadedLayerInfos",
"[",
"]",
"types",
".",
"BlobInfo",
",",
"layerDiffIDs",
"[",
"]",
"digest",
".",
"Digest",
")",
"(",
"genericManifest",
",",
"error",
")",
"{",
"if",
"len",
"(",
"m",
".",
"m",
".",
"ExtractedV1Compatibility",
")",
"==",
"0",
"{",
"// What would this even mean?! Anyhow, the rest of the code depends on FSLayers[0] and ExtractedV1Compatibility[0] existing.",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"manifest",
".",
"DockerV2Schema2MediaType",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"m",
".",
"m",
".",
"ExtractedV1Compatibility",
")",
"!=",
"len",
"(",
"m",
".",
"m",
".",
"FSLayers",
")",
"{",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"len",
"(",
"m",
".",
"m",
".",
"ExtractedV1Compatibility",
")",
",",
"len",
"(",
"m",
".",
"m",
".",
"FSLayers",
")",
")",
"\n",
"}",
"\n",
"if",
"uploadedLayerInfos",
"!=",
"nil",
"&&",
"len",
"(",
"uploadedLayerInfos",
")",
"!=",
"len",
"(",
"m",
".",
"m",
".",
"FSLayers",
")",
"{",
"return",
"nil",
",",
"<mask>",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"len",
"(",
"uploadedLayerInfos",
")",
",",
"len",
"(",
"m",
".",
"m",
".",
"FSLayers",
")",
")",
"\n",
"}",
"\n",
"if",
"layerDiffIDs",
"!=",
"nil",
"&&",
"len",
"(",
"layerDiffIDs",
")",
"!=",
"len",
"(",
"m",
".",
"m",
".",
"FSLayers",
")",
"{",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"len",
"(",
"layerDiffIDs",
")",
",",
"len",
"(",
"m",
".",
"m",
".",
"FSLayers",
")",
")",
"\n",
"}",
"\n\n",
"// Build a list of the diffIDs for the non-empty layers.",
"diffIDs",
":=",
"[",
"]",
"digest",
".",
"Digest",
"{",
"}",
"\n",
"var",
"layers",
"[",
"]",
"manifest",
".",
"Schema2Descriptor",
"\n",
"for",
"v1Index",
":=",
"len",
"(",
"m",
".",
"m",
".",
"ExtractedV1Compatibility",
")",
"-",
"1",
";",
"v1Index",
">=",
"0",
";",
"v1Index",
"--",
"{",
"v2Index",
":=",
"(",
"len",
"(",
"m",
".",
"m",
".",
"ExtractedV1Compatibility",
")",
"-",
"1",
")",
"-",
"v1Index",
"\n\n",
"if",
"!",
"m",
".",
"m",
".",
"ExtractedV1Compatibility",
"[",
"v1Index",
"]",
".",
"ThrowAway",
"{",
"var",
"size",
"int64",
"\n",
"if",
"uploadedLayerInfos",
"!=",
"nil",
"{",
"size",
"=",
"uploadedLayerInfos",
"[",
"v2Index",
"]",
".",
"Size",
"\n",
"}",
"\n",
"var",
"d",
"digest",
".",
"Digest",
"\n",
"if",
"layerDiffIDs",
"!=",
"nil",
"{",
"d",
"=",
"layerDiffIDs",
"[",
"v2Index",
"]",
"\n",
"}",
"\n",
"layers",
"=",
"append",
"(",
"layers",
",",
"manifest",
".",
"Schema2Descriptor",
"{",
"MediaType",
":",
"\"",
"\"",
",",
"Size",
":",
"size",
",",
"Digest",
":",
"m",
".",
"m",
".",
"FSLayers",
"[",
"v1Index",
"]",
".",
"BlobSum",
",",
"}",
")",
"\n",
"diffIDs",
"=",
"append",
"(",
"diffIDs",
",",
"d",
")",
"\n",
"}",
"\n",
"}",
"\n",
"configJSON",
",",
"err",
":=",
"m",
".",
"m",
".",
"ToSchema2Config",
"(",
"diffIDs",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"configDescriptor",
":=",
"manifest",
".",
"Schema2Descriptor",
"{",
"MediaType",
":",
"\"",
"\"",
",",
"Size",
":",
"int64",
"(",
"len",
"(",
"configJSON",
")",
")",
",",
"Digest",
":",
"digest",
".",
"FromBytes",
"(",
"configJSON",
")",
",",
"}",
"\n\n",
"return",
"manifestSchema2FromComponents",
"(",
"configDescriptor",
",",
"nil",
",",
"configJSON",
",",
"layers",
")",
",",
"nil",
"\n",
"}"
]
|
17,339 | all-17340 | [
"Flush",
"implements",
"instruments",
".",
"Reporter"
]
| [
"func",
"(",
"r",
"*",
"Reporter",
")",
"Flush",
"(",
")",
"error",
"{",
"for",
"metricID",
":=",
"range",
"r",
".",
"refs",
"{",
"if",
"r",
".",
"refs",
"[",
"metricID",
"]",
"--",
";",
"r",
".",
"refs",
"[",
"metricID",
"]",
"<",
"1",
"{",
"<mask>",
",",
"tags",
":=",
"instruments",
".",
"SplitMetricID",
"(",
"metricID",
")",
"\n",
"r",
".",
"Metric",
"(",
"name",
",",
"tags",
",",
"0",
")",
"\n",
"delete",
"(",
"r",
".",
"refs",
",",
"metricID",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"r",
".",
"metrics",
")",
"!=",
"0",
"{",
"if",
"err",
":=",
"r",
".",
"Client",
".",
"Post",
"(",
"r",
".",
"metrics",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"r",
".",
"metrics",
"=",
"r",
".",
"metrics",
"[",
":",
"0",
"]",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,340 | all-17341 | [
"HasSizing",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"w",
"*",
"Widget",
")",
"HasSizing",
"(",
")",
"bool",
"{",
"if",
"w",
"!=",
"nil",
"&&",
"w",
".",
"Sizing",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
]
|
17,341 | all-17342 | [
"GetTitle",
"is",
"a",
"wrapper",
"around",
"gtk_header_bar_get_title",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"HeaderBar",
")",
"GetTitle",
"(",
")",
"string",
"{",
"cstr",
":=",
"C",
".",
"gtk_header_bar_get_title",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
]
|
17,342 | all-17343 | [
"Sets",
"the",
"input",
"and",
"output",
"pipes",
"for",
"the",
"tracer",
".",
"Stdout",
"is",
"not",
"redirected",
";",
"it",
"is",
"instead",
"passed",
"to",
"the",
"tracer",
"s",
"Put",
"command",
"."
]
| [
"func",
"(",
"t",
"*",
"BTTracer",
")",
"SetPipes",
"(",
"stdin",
"io",
".",
"Reader",
",",
"stderr",
"<mask>",
".",
"Writer",
")",
"{",
"t",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"defer",
"t",
".",
"m",
".",
"Unlock",
"(",
")",
"\n\n",
"t",
".",
"p",
".",
"stdin",
"=",
"stdin",
"\n",
"t",
".",
"p",
".",
"stderr",
"=",
"stderr",
"\n",
"}"
]
|
17,343 | all-17344 | [
"ServeHTTP",
"writes",
"static",
"files",
"content",
"to",
"HTTP",
"response",
"."
]
| [
"func",
"(",
"s",
"*",
"Server",
")",
"ServeHTTP",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"urlPath",
":=",
"r",
".",
"URL",
".",
"Path",
"\n",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"urlPath",
",",
"\"",
"\"",
")",
"{",
"urlPath",
"=",
"\"",
"\"",
"+",
"urlPath",
"\n",
"r",
".",
"URL",
".",
"Path",
"=",
"urlPath",
"\n",
"}",
"\n",
"p",
":=",
"path",
".",
"Clean",
"(",
"urlPath",
")",
"\n\n",
"if",
"s",
".",
"root",
"!=",
"\"",
"\"",
"{",
"if",
"p",
"=",
"strings",
".",
"TrimPrefix",
"(",
"p",
",",
"s",
".",
"root",
")",
";",
"len",
"(",
"p",
")",
">=",
"len",
"(",
"r",
".",
"URL",
".",
"Path",
")",
"{",
"s",
".",
"httpError",
"(",
"w",
",",
"r",
",",
"errNotFound",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"s",
".",
"IndexPage",
"!=",
"\"",
"\"",
"&&",
"strings",
".",
"HasSuffix",
"(",
"r",
".",
"<mask>",
".",
"Path",
",",
"s",
".",
"IndexPage",
")",
"{",
"redirect",
"(",
"w",
",",
"r",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"(",
"s",
".",
"Hasher",
"!=",
"nil",
"&&",
"!",
"s",
".",
"NoHashQueryStrings",
")",
"||",
"(",
"s",
".",
"Hasher",
"!=",
"nil",
"&&",
"s",
".",
"NoHashQueryStrings",
"&&",
"len",
"(",
"r",
".",
"URL",
".",
"RawQuery",
")",
"==",
"0",
")",
"{",
"cPath",
":=",
"s",
".",
"canonicalPath",
"(",
"p",
")",
"\n",
"h",
",",
"cont",
",",
"err",
":=",
"s",
".",
"hash",
"(",
"cPath",
")",
"\n",
"switch",
"err",
"{",
"case",
"errNotRegularFile",
":",
"// continue as usual if it is not a regular file",
"case",
"nil",
":",
"if",
"hPath",
":=",
"s",
".",
"hashedPath",
"(",
"cPath",
",",
"h",
")",
";",
"hPath",
"!=",
"p",
"{",
"redirect",
"(",
"w",
",",
"r",
",",
"path",
".",
"Join",
"(",
"s",
".",
"root",
",",
"hPath",
")",
")",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"s",
".",
"RedirectTrailingSlash",
"&&",
"urlPath",
"[",
"len",
"(",
"urlPath",
")",
"-",
"1",
"]",
"==",
"'/'",
"{",
"redirect",
"(",
"w",
",",
"r",
",",
"path",
".",
"Join",
"(",
"s",
".",
"root",
",",
"p",
")",
")",
"\n",
"return",
"\n",
"}",
"\n",
"p",
"=",
"cPath",
"\n",
"r",
".",
"URL",
".",
"Path",
"=",
"path",
".",
"Join",
"(",
"s",
".",
"root",
",",
"cPath",
")",
"\n",
"default",
":",
"if",
"!",
"cont",
"{",
"s",
".",
"httpError",
"(",
"w",
",",
"r",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"f",
",",
"err",
":=",
"s",
".",
"open",
"(",
"p",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"s",
".",
"httpError",
"(",
"w",
",",
"r",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"defer",
"f",
".",
"Close",
"(",
")",
"\n\n",
"d",
",",
"err",
":=",
"f",
".",
"Stat",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"s",
".",
"httpError",
"(",
"w",
",",
"r",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"s",
".",
"RedirectTrailingSlash",
"{",
"url",
":=",
"r",
".",
"URL",
".",
"Path",
"\n",
"if",
"d",
".",
"IsDir",
"(",
")",
"{",
"if",
"url",
"[",
"len",
"(",
"url",
")",
"-",
"1",
"]",
"!=",
"'/'",
"{",
"redirect",
"(",
"w",
",",
"r",
",",
"url",
"+",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"else",
"{",
"if",
"url",
"[",
"len",
"(",
"url",
")",
"-",
"1",
"]",
"==",
"'/'",
"{",
"redirect",
"(",
"w",
",",
"r",
",",
"\"",
"\"",
"+",
"path",
".",
"Base",
"(",
"url",
")",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"d",
".",
"IsDir",
"(",
")",
"{",
"index",
":=",
"strings",
".",
"TrimSuffix",
"(",
"p",
",",
"\"",
"\"",
")",
"+",
"s",
".",
"IndexPage",
"\n",
"ff",
",",
"err",
":=",
"s",
".",
"open",
"(",
"index",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"defer",
"ff",
".",
"Close",
"(",
")",
"\n",
"dd",
",",
"err",
":=",
"ff",
".",
"Stat",
"(",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"p",
"=",
"index",
"\n",
"d",
"=",
"dd",
"\n",
"f",
"=",
"ff",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"d",
".",
"IsDir",
"(",
")",
"{",
"s",
".",
"httpError",
"(",
"w",
",",
"r",
",",
"errNotFound",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"http",
".",
"ServeContent",
"(",
"w",
",",
"r",
",",
"d",
".",
"Name",
"(",
")",
",",
"d",
".",
"ModTime",
"(",
")",
",",
"f",
")",
"\n",
"}"
]
|
17,344 | all-17345 | [
"AddHandler",
"add",
"new",
"handler",
"to",
"current",
"logger",
"."
]
| [
"func",
"(",
"logger",
"*",
"Logger",
")",
"AddHandler",
"(",
"handler",
"<mask>",
")",
"{",
"logger",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"logger",
".",
"Handlers",
"=",
"append",
"(",
"logger",
".",
"Handlers",
",",
"handler",
")",
"\n",
"logger",
".",
"flushBuffer",
"(",
")",
"\n",
"logger",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"}"
]
|
17,345 | all-17346 | [
"ParseReference",
"converts",
"a",
"string",
"which",
"should",
"not",
"start",
"with",
"the",
"ImageTransport",
".",
"Name",
"prefix",
"into",
"an",
"ImageReference",
"."
]
| [
"func",
"ParseReference",
"(",
"refString",
"string",
")",
"(",
"types",
".",
"ImageReference",
",",
"error",
")",
"{",
"// This is intended to be compatible with reference.ParseAnyReference, but more strict about refusing some of the ambiguous cases.",
"// In particular, this rejects unprefixed digest values (64 hex chars), and sha256 digest prefixes (sha256:fewer-than-64-hex-chars).",
"// digest:hexstring is structurally the same as a reponame:tag (meaning docker.io/library/reponame:tag).",
"// reference.ParseAnyReference interprets such strings as digests.",
"if",
"dgst",
",",
"err",
":=",
"digest",
".",
"Parse",
"(",
"refString",
")",
";",
"err",
"==",
"nil",
"{",
"// The daemon explicitly refuses to tag images with a reponame equal to digest.Canonical - but _only_ this digest name.",
"// Other digest references are ambiguous, so refuse them.",
"if",
"dgst",
".",
"Algorithm",
"(",
")",
"!=",
"digest",
".",
"Canonical",
"{",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"refString",
",",
"digest",
".",
"Canonical",
")",
"\n",
"}",
"\n",
"return",
"NewReference",
"(",
"dgst",
",",
"nil",
")",
"\n",
"}",
"\n\n",
"ref",
",",
"err",
":=",
"reference",
".",
"ParseNormalizedNamed",
"(",
"refString",
")",
"// This also rejects unprefixed digest values",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"reference",
".",
"FamiliarName",
"(",
"ref",
")",
"==",
"digest",
".",
"Canonical",
".",
"String",
"(",
")",
"{",
"return",
"nil",
",",
"<mask>",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"refString",
",",
"digest",
".",
"Canonical",
")",
"\n",
"}",
"\n",
"return",
"NewReference",
"(",
"\"",
"\"",
",",
"ref",
")",
"\n",
"}"
]
|
17,346 | all-17347 | [
"makeCronCommits",
"makes",
"commits",
"to",
"a",
"single",
"cron",
"input",
"s",
"repo",
".",
"It",
"s",
"a",
"helper",
"function",
"called",
"by",
"monitorPipeline",
"."
]
| [
"func",
"(",
"a",
"*",
"apiServer",
")",
"makeCronCommits",
"(",
"pachClient",
"*",
"client",
".",
"APIClient",
",",
"in",
"*",
"pps",
".",
"Input",
")",
"error",
"{",
"schedule",
",",
"err",
":=",
"cron",
".",
"ParseStandard",
"(",
"in",
".",
"Cron",
".",
"Spec",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"// Shouldn't happen, as the input is validated in CreatePipeline",
"\n",
"}",
"\n",
"// make sure there isn't an unfinished commit on the branch",
"commitInfo",
",",
"err",
":=",
"pachClient",
".",
"InspectCommit",
"(",
"in",
".",
"Cron",
".",
"Repo",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"!",
"isNilBranchErr",
"(",
"err",
")",
"{",
"return",
"err",
"\n",
"}",
"else",
"if",
"commitInfo",
"!=",
"nil",
"&&",
"commitInfo",
".",
"Finished",
"==",
"nil",
"{",
"// and if there is, delete it",
"if",
"err",
"=",
"pachClient",
".",
"DeleteCommit",
"(",
"in",
".",
"Cron",
".",
"Repo",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"var",
"latestTime",
"time",
".",
"Time",
"\n",
"files",
",",
"err",
":=",
"pachClient",
".",
"ListFile",
"(",
"in",
".",
"Cron",
".",
"Repo",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"!",
"isNilBranchErr",
"(",
"err",
")",
"{",
"return",
"err",
"\n",
"}",
"else",
"if",
"err",
"!=",
"nil",
"||",
"len",
"(",
"files",
")",
"==",
"0",
"{",
"// File not found, this happens the first time the pipeline is run",
"latestTime",
",",
"err",
"=",
"types",
".",
"TimestampFromProto",
"(",
"in",
".",
"Cron",
".",
"Start",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"else",
"{",
"// Take the name of the most recent file as the latest timestamp",
"// ListFile returns the files in lexicographical order, and the RFC3339 format goes",
"// from largest unit of time to smallest, so the most recent file will be the last one",
"latestTime",
",",
"err",
"=",
"time",
".",
"Parse",
"(",
"time",
".",
"RFC3339",
",",
"path",
".",
"Base",
"(",
"files",
"[",
"len",
"(",
"files",
")",
"-",
"1",
"]",
".",
"<mask>",
".",
"Path",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"{",
"// get the time of the next time from the latest time using the cron schedule",
"next",
":=",
"schedule",
".",
"Next",
"(",
"latestTime",
")",
"\n",
"// and wait until then to make the next commit",
"time",
".",
"Sleep",
"(",
"time",
".",
"Until",
"(",
"next",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// We need the DeleteFile and the PutFile to happen in the same commit",
"_",
",",
"err",
"=",
"pachClient",
".",
"StartCommit",
"(",
"in",
".",
"Cron",
".",
"Repo",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"in",
".",
"Cron",
".",
"Overwrite",
"{",
"// If we want to \"overwrite\" the file, we need to delete the file with the previous time",
"err",
":=",
"pachClient",
".",
"DeleteFile",
"(",
"in",
".",
"Cron",
".",
"Repo",
",",
"\"",
"\"",
",",
"latestTime",
".",
"Format",
"(",
"time",
".",
"RFC3339",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"!",
"isNotFoundErr",
"(",
"err",
")",
"&&",
"!",
"isNilBranchErr",
"(",
"err",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Put in an empty file named by the timestamp",
"_",
",",
"err",
"=",
"pachClient",
".",
"PutFile",
"(",
"in",
".",
"Cron",
".",
"Repo",
",",
"\"",
"\"",
",",
"next",
".",
"Format",
"(",
"time",
".",
"RFC3339",
")",
",",
"strings",
".",
"NewReader",
"(",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"err",
"=",
"pachClient",
".",
"FinishCommit",
"(",
"in",
".",
"Cron",
".",
"Repo",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// set latestTime to the next time",
"latestTime",
"=",
"next",
"\n",
"}",
"\n",
"}"
]
|
17,347 | all-17348 | [
"SetApplicationError",
"marks",
"the",
"response",
"as",
"being",
"an",
"application",
"error",
".",
"This",
"method",
"can",
"only",
"be",
"called",
"before",
"any",
"arguments",
"have",
"been",
"sent",
"to",
"the",
"calling",
"peer",
"."
]
| [
"func",
"(",
"response",
"*",
"InboundCallResponse",
")",
"SetApplicationError",
"(",
")",
"error",
"{",
"if",
"<mask>",
".",
"state",
">",
"reqResWriterPreArg2",
"{",
"return",
"response",
".",
"failed",
"(",
"errReqResWriterStateMismatch",
"{",
"state",
":",
"response",
".",
"state",
",",
"expectedState",
":",
"reqResWriterPreArg2",
",",
"}",
")",
"\n",
"}",
"\n",
"response",
".",
"applicationError",
"=",
"true",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,348 | all-17349 | [
"Do",
"executes",
"DOMDebugger",
".",
"removeEventListenerBreakpoint",
"against",
"the",
"provided",
"context",
"."
]
| [
"func",
"(",
"p",
"*",
"RemoveEventListenerBreakpointParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandRemoveEventListenerBreakpoint",
",",
"p",
",",
"nil",
")",
"\n",
"}"
]
|
17,349 | all-17350 | [
"PutSignatures",
"records",
"the",
"image",
"s",
"signatures",
"for",
"committing",
"as",
"a",
"single",
"data",
"blob",
"."
]
| [
"func",
"(",
"s",
"*",
"storageImageDestination",
")",
"PutSignatures",
"(",
"ctx",
"context",
".",
"Context",
",",
"signatures",
"[",
"]",
"[",
"]",
"byte",
")",
"error",
"{",
"sizes",
":=",
"[",
"]",
"int",
"{",
"}",
"\n",
"sigblob",
":=",
"[",
"]",
"byte",
"{",
"}",
"\n",
"for",
"_",
",",
"sig",
":=",
"range",
"signatures",
"{",
"sizes",
"=",
"append",
"(",
"sizes",
",",
"len",
"(",
"sig",
")",
")",
"\n",
"newblob",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"len",
"(",
"sigblob",
")",
"+",
"len",
"(",
"sig",
")",
")",
"\n",
"<mask>",
"(",
"newblob",
",",
"sigblob",
")",
"\n",
"copy",
"(",
"newblob",
"[",
"len",
"(",
"sigblob",
")",
":",
"]",
",",
"sig",
")",
"\n",
"sigblob",
"=",
"newblob",
"\n",
"}",
"\n",
"s",
".",
"signatures",
"=",
"sigblob",
"\n",
"s",
".",
"SignatureSizes",
"=",
"sizes",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,350 | all-17351 | [
"CreateDashboard",
"creates",
"a",
"new",
"dashboard",
"when",
"given",
"a",
"Dashboard",
"struct",
".",
"Note",
"that",
"the",
"Id",
"Resource",
"Url",
"and",
"similar",
"elements",
"are",
"not",
"used",
"in",
"creation",
"."
]
| [
"func",
"(",
"client",
"*",
"Client",
")",
"CreateDashboard",
"(",
"dash",
"*",
"Dashboard",
")",
"(",
"*",
"Dashboard",
",",
"error",
")",
"{",
"<mask>",
"out",
"reqGetDashboard",
"\n",
"if",
"err",
":=",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"dash",
",",
"&",
"out",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"out",
".",
"Dashboard",
",",
"nil",
"\n",
"}"
]
|
17,351 | all-17352 | [
"/",
"*",
"MakeUniversalImporter",
"creates",
"an",
"importer",
"that",
"handles",
"resolving",
"imports",
"from",
"the",
"filesystem",
"and",
"http",
"/",
"s",
"."
]
| [
"func",
"MakeUniversalImporter",
"(",
"searchUrls",
"[",
"]",
"*",
"url",
".",
"URL",
")",
"jsonnet",
".",
"Importer",
"{",
"// Reconstructed copy of http.DefaultTransport (to avoid",
"// modifying the default)",
"t",
":=",
"&",
"<mask>",
".",
"Transport",
"{",
"Proxy",
":",
"http",
".",
"ProxyFromEnvironment",
",",
"DialContext",
":",
"(",
"&",
"net",
".",
"Dialer",
"{",
"Timeout",
":",
"30",
"*",
"time",
".",
"Second",
",",
"KeepAlive",
":",
"30",
"*",
"time",
".",
"Second",
",",
"DualStack",
":",
"true",
",",
"}",
")",
".",
"DialContext",
",",
"MaxIdleConns",
":",
"100",
",",
"IdleConnTimeout",
":",
"90",
"*",
"time",
".",
"Second",
",",
"TLSHandshakeTimeout",
":",
"10",
"*",
"time",
".",
"Second",
",",
"ExpectContinueTimeout",
":",
"1",
"*",
"time",
".",
"Second",
",",
"}",
"\n\n",
"t",
".",
"RegisterProtocol",
"(",
"\"",
"\"",
",",
"http",
".",
"NewFileTransport",
"(",
"http",
".",
"Dir",
"(",
"\"",
"\"",
")",
")",
")",
"\n",
"t",
".",
"RegisterProtocol",
"(",
"\"",
"\"",
",",
"http",
".",
"NewFileTransport",
"(",
"newInternalFS",
"(",
"\"",
"\"",
")",
")",
")",
"\n\n",
"return",
"&",
"universalImporter",
"{",
"BaseSearchURLs",
":",
"searchUrls",
",",
"HTTPClient",
":",
"&",
"http",
".",
"Client",
"{",
"Transport",
":",
"t",
"}",
",",
"cache",
":",
"map",
"[",
"string",
"]",
"jsonnet",
".",
"Contents",
"{",
"}",
",",
"}",
"\n",
"}"
]
|
17,352 | all-17353 | [
"ModifyAdminsCmd",
"returns",
"a",
"cobra",
"command",
"that",
"modifies",
"the",
"set",
"of",
"current",
"cluster",
"admins"
]
| [
"func",
"ModifyAdminsCmd",
"(",
"noMetrics",
",",
"noPortForwarding",
"*",
"bool",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"add",
"[",
"]",
"string",
"\n",
"var",
"remove",
"[",
"]",
"string",
"\n",
"modifyAdmins",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"Run",
":",
"cmdutil",
".",
"Run",
"(",
"func",
"(",
"[",
"]",
"string",
")",
"error",
"{",
"c",
",",
"err",
":=",
"client",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"c",
".",
"Close",
"(",
")",
"\n",
"_",
",",
"err",
"=",
"c",
".",
"ModifyAdmins",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"auth",
".",
"ModifyAdminsRequest",
"{",
"Add",
":",
"add",
",",
"Remove",
":",
"remove",
",",
"}",
")",
"\n",
"if",
"auth",
".",
"IsErrPartiallyActivated",
"(",
"err",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
")",
",",
"}",
"\n",
"modifyAdmins",
".",
"PersistentFlags",
"(",
")",
".",
"StringSliceVar",
"(",
"&",
"<mask>",
",",
"\"",
"\"",
",",
"[",
"]",
"string",
"{",
"}",
",",
"\"",
"\"",
")",
"\n",
"modifyAdmins",
".",
"PersistentFlags",
"(",
")",
".",
"StringSliceVar",
"(",
"&",
"remove",
",",
"\"",
"\"",
",",
"[",
"]",
"string",
"{",
"}",
",",
"\"",
"\"",
")",
"\n",
"return",
"cmdutil",
".",
"CreateAlias",
"(",
"modifyAdmins",
",",
"\"",
"\"",
")",
"\n",
"}"
]
|
17,353 | all-17354 | [
"ResValue",
"returns",
"the",
"string",
"value",
"of",
"the",
"element",
"and",
"children"
]
| [
"func",
"(",
"x",
"*",
"XMLEle",
")",
"ResValue",
"(",
")",
"string",
"{",
"ret",
":=",
"\"",
"\"",
"\n",
"for",
"i",
":=",
"range",
"x",
".",
"Children",
"{",
"switch",
"x",
".",
"Children",
"[",
"i",
"]",
".",
"GetNodeType",
"(",
")",
"{",
"<mask>",
"tree",
".",
"NtChd",
",",
"tree",
".",
"NtElem",
",",
"tree",
".",
"NtRoot",
":",
"ret",
"+=",
"x",
".",
"Children",
"[",
"i",
"]",
".",
"ResValue",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"ret",
"\n",
"}"
]
|
17,354 | all-17355 | [
"GetRequestEndpoint",
"returns",
"request",
"s",
"host",
"perpended",
"with",
"protocol",
":",
"protocol",
":",
"//",
"host",
"."
]
| [
"func",
"GetRequestEndpoint",
"(",
"r",
"*",
"http",
".",
"<mask>",
")",
"string",
"{",
"proto",
":=",
"r",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"proto",
"==",
"\"",
"\"",
"{",
"if",
"r",
".",
"TLS",
"==",
"nil",
"{",
"proto",
"=",
"\"",
"\"",
"\n",
"}",
"else",
"{",
"proto",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"proto",
"+",
"\"",
"\"",
"+",
"r",
".",
"Host",
"\n",
"}"
]
|
17,355 | all-17356 | [
"parseURL",
"validates",
"if",
"repoUrl",
"is",
"a",
"valid",
"git",
"url",
"."
]
| [
"func",
"parseURL",
"(",
"repoURL",
"string",
",",
"private",
"bool",
")",
"(",
"*",
"url",
".",
"URL",
",",
"error",
")",
"{",
"// scheme",
"urlParts",
":=",
"strings",
".",
"Split",
"(",
"repoURL",
",",
"\"",
"\"",
")",
"\n",
"switch",
"{",
"case",
"strings",
".",
"HasPrefix",
"(",
"repoURL",
",",
"\"",
"\"",
")",
":",
"case",
"strings",
".",
"HasPrefix",
"(",
"repoURL",
",",
"\"",
"\"",
")",
":",
"case",
"strings",
".",
"HasPrefix",
"(",
"repoURL",
",",
"\"",
"\"",
")",
":",
"<mask>",
"len",
"(",
"urlParts",
")",
">",
"1",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"urlParts",
"[",
"0",
"]",
")",
"\n",
"default",
":",
"if",
"private",
"{",
"repoURL",
"=",
"\"",
"\"",
"+",
"repoURL",
"\n",
"}",
"else",
"{",
"repoURL",
"=",
"\"",
"\"",
"+",
"repoURL",
"\n",
"}",
"\n",
"}",
"\n\n",
"u",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"repoURL",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"u",
",",
"nil",
"\n",
"}"
]
|
17,356 | all-17357 | [
"GetSearchEntry",
"is",
"a",
"wrapper",
"around",
"gtk_tree_view_get_search_entry",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"TreeView",
")",
"GetSearchEntry",
"(",
")",
"*",
"<mask>",
"{",
"c",
":=",
"C",
".",
"gtk_tree_view_get_search_entry",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"wrapEntry",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
"\n",
"}"
]
|
17,357 | all-17358 | [
"MarshalJSON",
"calls",
"json",
".",
"RawMessage",
"method",
"of",
"the",
"same",
"name",
".",
"Required",
"since",
"HawkSignatureAuthenticationResponse",
"is",
"of",
"type",
"json",
".",
"RawMessage",
"..."
]
| [
"func",
"(",
"this",
"*",
"HawkSignatureAuthenticationResponse",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"x",
":=",
"json",
".",
"RawMessage",
"(",
"*",
"this",
")",
"\n",
"return",
"(",
"&",
"x",
")",
".",
"MarshalJSON",
"(",
")",
"\n",
"}"
]
|
17,358 | all-17359 | [
"HTML",
"returns",
"the",
"current",
"contents",
"of",
"the",
"DOM",
"for",
"the",
"entire",
"page",
"."
]
| [
"func",
"(",
"p",
"*",
"Page",
")",
"<mask>",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"html",
",",
"err",
":=",
"p",
".",
"session",
".",
"GetSource",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"html",
",",
"nil",
"\n",
"}"
]
|
17,359 | all-17360 | [
"SetHealth",
"sets",
"the",
"current",
"health",
"of",
"the",
"recording",
"rule",
"."
]
| [
"func",
"(",
"rule",
"*",
"RecordingRule",
")",
"SetHealth",
"(",
"health",
"RuleHealth",
")",
"{",
"rule",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"<mask>",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n",
"rule",
".",
"health",
"=",
"health",
"\n",
"}"
]
|
17,360 | all-17361 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"CopyToParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom75",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
17,361 | all-17362 | [
"EncodeSQL",
"generates",
"the",
"where",
"clause",
"constraints",
"for",
"the",
"tuple",
"equality",
"."
]
| [
"func",
"(",
"tpl",
"*",
"TupleEqualityList",
")",
"EncodeSQL",
"(",
"buf",
"*",
"bytes",
".",
"<mask>",
")",
"{",
"if",
"len",
"(",
"tpl",
".",
"Columns",
")",
"==",
"1",
"{",
"tpl",
".",
"encodeAsIn",
"(",
"buf",
")",
"\n",
"return",
"\n",
"}",
"\n",
"tpl",
".",
"encodeAsEquality",
"(",
"buf",
")",
"\n",
"}"
]
|
17,362 | all-17363 | [
"OAuthClient",
"instantiates",
"the",
"client",
"with",
"OAuth",
"Authentication"
]
| [
"func",
"OAuthClient",
"(",
"tokens",
"*",
"oauthTokens",
")",
"Client",
"{",
"c",
":=",
"Client",
"{",
"rpc",
":",
"rpc",
"{",
"auth",
":",
"clientOAuth",
"(",
"tokens",
")",
",",
"mock",
":",
"<mask>",
",",
"}",
",",
"}",
"\n",
"return",
"c",
"\n",
"}"
]
|
17,363 | all-17364 | [
"Update",
"the",
"current",
"values",
"in",
"the",
"map",
"using",
"the",
"newly",
"provided",
"ones",
".",
"Return",
"a",
"list",
"of",
"key",
"names",
"that",
"were",
"actually",
"changed",
"and",
"an",
"ErrorList",
"with",
"possible",
"errors",
"."
]
| [
"func",
"(",
"m",
"*",
"Map",
")",
"update",
"(",
"values",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"// Detect if this is the first time we're setting values. This happens",
"// when Load is called.",
"initial",
":=",
"m",
".",
"values",
"==",
"nil",
"\n\n",
"if",
"initial",
"{",
"m",
".",
"values",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"len",
"(",
"values",
")",
")",
"\n",
"}",
"\n\n",
"// Update our keys with the values from the given map, and keep track",
"// of which keys actually changed their value.",
"errors",
":=",
"ErrorList",
"{",
"}",
"\n",
"names",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"name",
",",
"<mask>",
":=",
"range",
"values",
"{",
"changed",
",",
"err",
":=",
"m",
".",
"set",
"(",
"name",
",",
"value",
",",
"initial",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
".",
"add",
"(",
"name",
",",
"value",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"if",
"changed",
"{",
"names",
"=",
"append",
"(",
"names",
",",
"name",
")",
"\n",
"}",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"names",
")",
"\n\n",
"var",
"err",
"error",
"\n",
"if",
"errors",
".",
"Len",
"(",
")",
">",
"0",
"{",
"errors",
".",
"sort",
"(",
")",
"\n",
"err",
"=",
"errors",
"\n",
"}",
"\n\n",
"return",
"names",
",",
"err",
"\n",
"}"
]
|
17,364 | all-17365 | [
"GetDestroyWithParent",
"is",
"a",
"wrapper",
"around",
"gtk_window_get_destroy_with_parent",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Window",
")",
"GetDestroyWithParent",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_window_get_destroy_with_parent",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"gobool",
"(",
"c",
")",
"\n",
"}"
]
|
17,365 | all-17366 | [
"SeriesReset",
"is",
"used",
"when",
"reading",
"a",
"checkpoint",
".",
"WAL",
"Watcher",
"should",
"have",
"stored",
"series",
"records",
"with",
"the",
"checkpoints",
"index",
"number",
"so",
"we",
"can",
"now",
"delete",
"any",
"ref",
"ID",
"s",
"lower",
"than",
"that",
"#",
"from",
"the",
"two",
"maps",
"."
]
| [
"func",
"(",
"t",
"*",
"QueueManager",
")",
"SeriesReset",
"(",
"index",
"int",
")",
"{",
"t",
".",
"seriesMtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"t",
".",
"seriesMtx",
".",
"Unlock",
"(",
")",
"\n\n",
"// Check for series that are in segments older than the checkpoint",
"// that were not also present in the checkpoint.",
"for",
"k",
",",
"v",
":=",
"<mask>",
"t",
".",
"seriesSegmentIndexes",
"{",
"if",
"v",
"<",
"index",
"{",
"delete",
"(",
"t",
".",
"seriesSegmentIndexes",
",",
"k",
")",
"\n",
"release",
"(",
"t",
".",
"seriesLabels",
"[",
"k",
"]",
")",
"\n",
"delete",
"(",
"t",
".",
"seriesLabels",
",",
"k",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
]
|
17,366 | all-17367 | [
"render",
"primitives",
"from",
"array",
"data",
"with",
"a",
"per",
"-",
"element",
"offset"
]
| [
"func",
"DrawElementsBaseVertex",
"(",
"mode",
"uint32",
",",
"<mask>",
"int32",
",",
"xtype",
"uint32",
",",
"indices",
"unsafe",
".",
"Pointer",
",",
"basevertex",
"int32",
")",
"{",
"C",
".",
"glowDrawElementsBaseVertex",
"(",
"gpDrawElementsBaseVertex",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"mode",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"indices",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"basevertex",
")",
")",
"\n",
"}"
]
|
17,367 | all-17368 | [
"NewController",
"makes",
"a",
"Controller",
"out",
"of",
"the",
"given",
"clients",
"."
]
| [
"func",
"NewController",
"(",
"ghcSync",
",",
"ghcStatus",
"*",
"github",
".",
"Client",
",",
"prowJobClient",
"prowv1",
".",
"ProwJobInterface",
",",
"cfg",
"config",
".",
"Getter",
",",
"gc",
"*",
"git",
".",
"Client",
",",
"maxRecordsPerPool",
"int",
",",
"opener",
"io",
".",
"Opener",
",",
"historyURI",
",",
"statusURI",
"string",
",",
"logger",
"*",
"logrus",
".",
"Entry",
")",
"(",
"*",
"Controller",
",",
"error",
")",
"{",
"if",
"logger",
"==",
"nil",
"{",
"logger",
"=",
"logrus",
".",
"NewEntry",
"(",
"logrus",
".",
"StandardLogger",
"(",
")",
")",
"\n",
"}",
"\n",
"hist",
",",
"err",
":=",
"history",
".",
"New",
"(",
"maxRecordsPerPool",
",",
"opener",
",",
"historyURI",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"historyURI",
",",
"err",
")",
"\n",
"}",
"\n",
"sc",
":=",
"&",
"statusController",
"{",
"logger",
":",
"logger",
".",
"WithField",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
",",
"ghc",
":",
"ghcStatus",
",",
"config",
":",
"cfg",
",",
"newPoolPending",
":",
"make",
"(",
"chan",
"bool",
",",
"1",
")",
",",
"shutDown",
":",
"make",
"(",
"chan",
"bool",
")",
",",
"opener",
":",
"opener",
",",
"path",
":",
"statusURI",
",",
"}",
"\n",
"go",
"sc",
".",
"run",
"(",
")",
"\n",
"return",
"&",
"Controller",
"{",
"logger",
":",
"logger",
".",
"WithField",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
",",
"ghc",
":",
"ghcSync",
",",
"prowJobClient",
":",
"prowJobClient",
",",
"config",
":",
"cfg",
",",
"gc",
":",
"gc",
",",
"sc",
":",
"sc",
",",
"changedFiles",
":",
"&",
"changedFilesAgent",
"{",
"ghc",
":",
"ghcSync",
",",
"nextChangeCache",
":",
"make",
"(",
"<mask>",
"[",
"changeCacheKey",
"]",
"[",
"]",
"string",
")",
",",
"}",
",",
"History",
":",
"hist",
",",
"}",
",",
"nil",
"\n",
"}"
]
|
17,368 | all-17369 | [
"AddFlags",
"injects",
"GitHub",
"options",
"into",
"the",
"given",
"FlagSet",
"."
]
| [
"func",
"(",
"o",
"*",
"GitHubOptions",
")",
"AddFlags",
"(",
"<mask>",
"*",
"flag",
".",
"FlagSet",
")",
"{",
"o",
".",
"addFlags",
"(",
"true",
",",
"fs",
")",
"\n",
"}"
]
|
17,369 | all-17370 | [
"Close",
"closes",
"the",
"JSON",
"-",
"RPC",
"connection",
".",
"The",
"connection",
"may",
"not",
"be",
"used",
"after",
"it",
"has",
"been",
"closed",
"."
]
| [
"func",
"(",
"c",
"*",
"Conn",
")",
"Close",
"(",
")",
"error",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"if",
"c",
".",
"shutdown",
"||",
"c",
".",
"closing",
"{",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"ErrClosed",
"\n",
"}",
"\n",
"c",
".",
"closing",
"=",
"true",
"\n",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"c",
".",
"<mask>",
".",
"Close",
"(",
")",
"\n",
"}"
]
|
17,370 | all-17371 | [
"HTTPLoggerFunc",
"is",
"simple",
"http",
"access",
"logger"
]
| [
"func",
"(",
"g",
"*",
"Glg",
")",
"HTTPLoggerFunc",
"(",
"name",
"string",
",",
"hf",
"http",
".",
"HandlerFunc",
")",
"http",
".",
"Handler",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"<mask>",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"start",
":=",
"fastime",
".",
"Now",
"(",
")",
"\n\n",
"hf",
"(",
"w",
",",
"r",
")",
"\n\n",
"err",
":=",
"g",
".",
"Logf",
"(",
"\"",
"\\t",
"\\t",
"\\t",
"\"",
",",
"r",
".",
"Method",
",",
"r",
".",
"RequestURI",
",",
"name",
",",
"fastime",
".",
"Now",
"(",
")",
".",
"Sub",
"(",
"start",
")",
".",
"String",
"(",
")",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"err",
"=",
"g",
".",
"Error",
"(",
"err",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Println",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
")",
"\n",
"}"
]
|
17,371 | all-17372 | [
"Try",
"to",
"detect",
"encoding",
"of",
"string",
":",
"strings",
"with",
"no",
"\\",
"r",
"will",
"be",
"Unix",
"strings",
"with",
"\\",
"r",
"and",
"no",
"\\",
"n",
"will",
"be",
"Mac",
"strings",
"with",
"count",
"(",
"\\",
"r",
"\\",
"n",
")",
"==",
"count",
"(",
"\\",
"r",
")",
"==",
"count",
"(",
"\\",
"n",
")",
"will",
"be",
"Windows",
"other",
"strings",
"will",
"be",
"binary"
]
| [
"func",
"DetectEncoding",
"(",
"data",
"string",
")",
"*",
"Encoding",
"{",
"if",
"strings",
".",
"Count",
"(",
"<mask>",
",",
"\"",
"\\r",
"\"",
")",
"==",
"0",
"{",
"return",
"UnixTextEncoding",
"\n",
"}",
"else",
"if",
"strings",
".",
"Count",
"(",
"data",
",",
"\"",
"\\n",
"\"",
")",
"==",
"0",
"{",
"return",
"MacTextEncoding",
"\n",
"}",
"else",
"if",
"strings",
".",
"Count",
"(",
"data",
",",
"\"",
"\\r",
"\"",
")",
"==",
"strings",
".",
"Count",
"(",
"data",
",",
"\"",
"\\n",
"\"",
")",
"&&",
"strings",
".",
"Count",
"(",
"data",
",",
"\"",
"\\r",
"\\n",
"\"",
")",
"==",
"strings",
".",
"Count",
"(",
"data",
",",
"\"",
"\\n",
"\"",
")",
"{",
"return",
"WindowsTextEncoding",
"\n",
"}",
"\n",
"return",
"BinaryEncoding",
"\n",
"}"
]
|
17,372 | all-17373 | [
"GetChild",
"is",
"a",
"wrapper",
"around",
"g_settings_get_child",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Settings",
")",
"GetChild",
"(",
"name",
"string",
")",
"*",
"Settings",
"{",
"cstr1",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"<mask>",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr1",
")",
")",
"\n\n",
"return",
"wrapFullSettings",
"(",
"C",
".",
"g_settings_get_child",
"(",
"v",
".",
"native",
"(",
")",
",",
"cstr1",
")",
")",
"\n",
"}"
]
|
17,373 | all-17374 | [
"TODO",
":",
"first",
"write",
":",
"add",
"content?",
"-",
"actually",
"no",
"data",
"transferred"
]
| [
"func",
"writeLob",
"(",
"wr",
"*",
"bufio",
".",
"<mask>",
")",
"{",
"wr",
".",
"WriteB",
"(",
"0",
")",
"\n",
"wr",
".",
"WriteInt32",
"(",
"0",
")",
"\n",
"wr",
".",
"WriteInt32",
"(",
"0",
")",
"\n",
"}"
]
|
17,374 | all-17375 | [
"copy",
"pixels",
"into",
"a",
"2D",
"texture",
"image"
]
| [
"func",
"CopyTexImage2D",
"(",
"target",
"uint32",
",",
"level",
"int32",
",",
"internalformat",
"uint32",
",",
"x",
"int32",
",",
"y",
"int32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"border",
"int32",
")",
"{",
"C",
".",
"glowCopyTexImage2D",
"(",
"gpCopyTexImage2D",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"level",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"internalformat",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"x",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"y",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"border",
")",
")",
"\n",
"}"
]
|
17,375 | all-17376 | [
"WithMessageAuthor",
"sets",
"the",
"author",
"for",
"outbound",
"messages",
"to",
"the",
"given",
"peer",
"ID",
"(",
"defaults",
"to",
"the",
"host",
"s",
"ID",
")",
".",
"If",
"message",
"signing",
"is",
"enabled",
"the",
"private",
"key",
"must",
"be",
"available",
"in",
"the",
"host",
"s",
"peerstore",
"."
]
| [
"func",
"WithMessageAuthor",
"(",
"author",
"peer",
".",
"ID",
")",
"Option",
"{",
"return",
"func",
"(",
"p",
"*",
"PubSub",
")",
"error",
"{",
"if",
"author",
"==",
"\"",
"\"",
"{",
"author",
"=",
"p",
".",
"host",
".",
"ID",
"(",
")",
"\n",
"}",
"\n",
"if",
"p",
".",
"signKey",
"!=",
"nil",
"{",
"newSignKey",
":=",
"p",
".",
"<mask>",
".",
"Peerstore",
"(",
")",
".",
"PrivKey",
"(",
"author",
")",
"\n",
"if",
"newSignKey",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"p",
".",
"signID",
")",
"\n",
"}",
"\n",
"p",
".",
"signKey",
"=",
"newSignKey",
"\n",
"}",
"\n",
"p",
".",
"signID",
"=",
"author",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
]
|
17,376 | all-17377 | [
"Size",
"returns",
"the",
"numbers",
"of",
"instruments",
"in",
"the",
"registry",
"."
]
| [
"func",
"(",
"r",
"*",
"Registry",
")",
"Size",
"(",
")",
"int",
"{",
"r",
".",
"mutex",
".",
"RLock",
"(",
")",
"\n",
"<mask>",
":=",
"len",
"(",
"r",
".",
"instruments",
")",
"\n",
"r",
".",
"mutex",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"size",
"\n",
"}"
]
|
17,377 | all-17378 | [
"Warnln",
"records",
"the",
"log",
"with",
"warn",
"level"
]
| [
"func",
"(",
"l",
"*",
"Logger",
")",
"Warnln",
"(",
"args",
"...",
"<mask>",
"{",
"}",
")",
"{",
"l",
".",
"Output",
"(",
"2",
",",
"LevelWarn",
",",
"fmt",
".",
"Sprintln",
"(",
"args",
"...",
")",
")",
"\n",
"}"
]
|
17,378 | all-17379 | [
"cut",
"closes",
"current",
"file",
"written",
"and",
"creates",
"a",
"new",
"one",
"ready",
"to",
"append",
".",
"cut",
"first",
"creates",
"a",
"temp",
"wal",
"file",
"and",
"writes",
"necessary",
"headers",
"into",
"it",
".",
"Then",
"cut",
"atomically",
"rename",
"temp",
"wal",
"file",
"to",
"a",
"wal",
"file",
"."
]
| [
"func",
"(",
"w",
"*",
"WAL",
")",
"cut",
"(",
")",
"error",
"{",
"// close old wal file; truncate to avoid wasting space if an early cut",
"off",
",",
"serr",
":=",
"w",
".",
"tail",
"(",
")",
".",
"Seek",
"(",
"0",
",",
"io",
".",
"SeekCurrent",
")",
"\n",
"if",
"serr",
"!=",
"nil",
"{",
"return",
"serr",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"w",
".",
"<mask>",
"(",
")",
".",
"Truncate",
"(",
"off",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"w",
".",
"sync",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"fpath",
":=",
"filepath",
".",
"Join",
"(",
"w",
".",
"dir",
",",
"walName",
"(",
"w",
".",
"seq",
"(",
")",
"+",
"1",
",",
"w",
".",
"enti",
"+",
"1",
")",
")",
"\n\n",
"// create a temp wal file with name sequence + 1, or truncate the existing one",
"newTail",
",",
"err",
":=",
"w",
".",
"fp",
".",
"Open",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// update writer and save the previous crc",
"w",
".",
"locks",
"=",
"append",
"(",
"w",
".",
"locks",
",",
"newTail",
")",
"\n",
"prevCrc",
":=",
"w",
".",
"encoder",
".",
"crc",
".",
"Sum32",
"(",
")",
"\n",
"w",
".",
"encoder",
",",
"err",
"=",
"newFileEncoder",
"(",
"w",
".",
"tail",
"(",
")",
".",
"File",
",",
"prevCrc",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"w",
".",
"saveCrc",
"(",
"prevCrc",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"w",
".",
"encoder",
".",
"encode",
"(",
"&",
"walpb",
".",
"Record",
"{",
"Type",
":",
"metadataType",
",",
"Data",
":",
"w",
".",
"metadata",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"w",
".",
"saveState",
"(",
"&",
"w",
".",
"state",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// atomically move temp wal file to wal file",
"if",
"err",
"=",
"w",
".",
"sync",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"off",
",",
"err",
"=",
"w",
".",
"tail",
"(",
")",
".",
"Seek",
"(",
"0",
",",
"io",
".",
"SeekCurrent",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"os",
".",
"Rename",
"(",
"newTail",
".",
"Name",
"(",
")",
",",
"fpath",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
"=",
"fileutil",
".",
"Fsync",
"(",
"w",
".",
"dirFile",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// reopen newTail with its new path so calls to Name() match the wal filename format",
"newTail",
".",
"Close",
"(",
")",
"\n\n",
"if",
"newTail",
",",
"err",
"=",
"fileutil",
".",
"LockFile",
"(",
"fpath",
",",
"os",
".",
"O_WRONLY",
",",
"fileutil",
".",
"PrivateFileMode",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
"=",
"newTail",
".",
"Seek",
"(",
"off",
",",
"io",
".",
"SeekStart",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"w",
".",
"locks",
"[",
"len",
"(",
"w",
".",
"locks",
")",
"-",
"1",
"]",
"=",
"newTail",
"\n\n",
"prevCrc",
"=",
"w",
".",
"encoder",
".",
"crc",
".",
"Sum32",
"(",
")",
"\n",
"w",
".",
"encoder",
",",
"err",
"=",
"newFileEncoder",
"(",
"w",
".",
"tail",
"(",
")",
".",
"File",
",",
"prevCrc",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"w",
".",
"lg",
"!=",
"nil",
"{",
"w",
".",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"fpath",
")",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"fpath",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,379 | all-17380 | [
"Overwrite",
"the",
"Content",
"-",
"Type",
"to",
"be",
"text",
"/",
"javascript"
]
| [
"func",
"(",
"w",
"*",
"jsonpResponseWriter",
")",
"WriteHeader",
"(",
"code",
"int",
")",
"{",
"w",
".",
"Header",
"(",
")",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"w",
".",
"ResponseWriter",
".",
"WriteHeader",
"(",
"code",
")",
"\n",
"w",
".",
"wroteHeader",
"=",
"true",
"\n",
"}"
]
|
17,380 | all-17381 | [
"loadOrFindTenantID",
"figures",
"out",
"the",
"AAD",
"tenant",
"ID",
"of",
"the",
"subscription",
"by",
"first",
"looking",
"at",
"the",
"cache",
"file",
"if",
"not",
"exists",
"makes",
"a",
"network",
"call",
"to",
"load",
"it",
"and",
"cache",
"it",
"for",
"future",
"use",
"."
]
| [
"func",
"loadOrFindTenantID",
"(",
"env",
"azure",
".",
"Environment",
",",
"subscriptionID",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"tenantID",
"string",
"\n\n",
"log",
".",
"Debug",
"(",
"\"",
"\"",
",",
"logutil",
".",
"Fields",
"{",
"\"",
"\"",
":",
"subscriptionID",
"}",
")",
"\n\n",
"// Load from cache",
"fp",
":=",
"tenantIDPath",
"(",
"subscriptionID",
")",
"\n",
"b",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"fp",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"tenantID",
"=",
"strings",
".",
"TrimSpace",
"(",
"string",
"(",
"b",
")",
")",
"\n",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"fp",
")",
"\n",
"}",
"else",
"if",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"fp",
")",
"\n",
"}",
"else",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"// Handle cache miss",
"if",
"tenantID",
"==",
"\"",
"\"",
"{",
"<mask>",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"t",
",",
"err",
":=",
"findTenantID",
"(",
"env",
",",
"subscriptionID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"tenantID",
"=",
"t",
"\n\n",
"// Cache the result",
"if",
"err",
":=",
"saveTenantID",
"(",
"fp",
",",
"tenantID",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"fp",
")",
"\n",
"}",
"\n",
"log",
".",
"Debug",
"(",
"\"",
"\"",
",",
"logutil",
".",
"Fields",
"{",
"\"",
"\"",
":",
"tenantID",
",",
"\"",
"\"",
":",
"subscriptionID",
"}",
")",
"\n",
"return",
"tenantID",
",",
"nil",
"\n",
"}"
]
|
17,381 | all-17382 | [
"ProjectHasProfiles",
"is",
"a",
"helper",
"to",
"check",
"if",
"a",
"project",
"has",
"the",
"profiles",
"feature",
"enabled",
"."
]
| [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"ProjectHasProfiles",
"(",
"name",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"return",
"projectHasProfiles",
"(",
"c",
".",
"tx",
",",
"<mask>",
")",
"\n",
"}"
]
|
17,382 | all-17383 | [
"resetStatsUnsafe",
"resets",
"stats",
"for",
"all",
"watched",
"containers",
"."
]
| [
"func",
"(",
"engine",
"*",
"DockerStatsEngine",
")",
"resetStatsUnsafe",
"(",
")",
"{",
"for",
"_",
",",
"containerMap",
":=",
"range",
"engine",
".",
"tasksToContainers",
"{",
"for",
"_",
",",
"container",
":=",
"<mask>",
"containerMap",
"{",
"container",
".",
"statsQueue",
".",
"Reset",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
]
|
17,383 | all-17384 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"SetEmulatedMediaParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation9",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
17,384 | all-17385 | [
"title",
":",
"set",
"cname",
"path",
":",
"/",
"apps",
"/",
"{",
"app",
"}",
"/",
"cname",
"method",
":",
"POST",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"responses",
":",
"200",
":",
"Ok",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized",
"404",
":",
"App",
"not",
"found"
]
| [
"func",
"setCName",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"cNameMsg",
":=",
"\"",
"\"",
"\n",
"cnames",
",",
"_",
":=",
"InputValues",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"cnames",
")",
"==",
"0",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"<mask>",
".",
"StatusBadRequest",
",",
"Message",
":",
"cNameMsg",
"}",
"\n",
"}",
"\n",
"appName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"a",
",",
"err",
":=",
"getAppFromContext",
"(",
"appName",
",",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermAppUpdateCnameAdd",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"appTarget",
"(",
"appName",
")",
",",
"Kind",
":",
"permission",
".",
"PermAppUpdateCnameAdd",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermAppReadEvents",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"if",
"err",
"=",
"a",
".",
"AddCName",
"(",
"cnames",
"...",
")",
";",
"err",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"err",
".",
"Error",
"(",
")",
"==",
"\"",
"\"",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
]
|
17,385 | all-17386 | [
"ConnStr",
"composes",
"a",
"data",
"connection",
"string",
"."
]
| [
"func",
"(",
"c",
"DBConfig",
")",
"ConnStr",
"(",
")",
"string",
"{",
"comps",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"<mask>",
"c",
".",
"Conn",
"{",
"comps",
"=",
"append",
"(",
"comps",
",",
"k",
"+",
"\"",
"\"",
"+",
"v",
")",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"comps",
",",
"\"",
"\"",
")",
"\n",
"}"
]
|
17,386 | all-17387 | [
"CreateUniqueIndex",
"creates",
"the",
"unique",
"index",
"into",
"database",
".",
"If",
"table",
"isn",
"t",
"direct",
"/",
"indirect",
"struct",
"it",
"returns",
"error",
"."
]
| [
"func",
"(",
"<mask>",
"*",
"DB",
")",
"CreateUniqueIndex",
"(",
"table",
"interface",
"{",
"}",
",",
"name",
"string",
",",
"names",
"...",
"string",
")",
"error",
"{",
"return",
"db",
".",
"createIndex",
"(",
"table",
",",
"true",
",",
"name",
",",
"names",
"...",
")",
"\n",
"}"
]
|
17,387 | all-17388 | [
"Do",
"executes",
"IO",
".",
"resolveBlob",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"uuid",
"-",
"UUID",
"of",
"the",
"specified",
"Blob",
"."
]
| [
"func",
"(",
"p",
"*",
"ResolveBlobParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"uuid",
"string",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"<mask>",
"ResolveBlobReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandResolveBlob",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"UUID",
",",
"nil",
"\n",
"}"
]
|
17,388 | all-17389 | [
"volumeUsedBy",
"=",
"append",
"(",
"volumeUsedBy",
"fmt",
".",
"Sprintf",
"(",
"/",
"%s",
"/",
"containers",
"/",
"%s",
"version",
".",
"APIVersion",
"ct",
"))"
]
| [
"func",
"storagePoolVolumeUsedByGet",
"(",
"s",
"*",
"state",
".",
"State",
",",
"project",
",",
"volumeName",
"string",
",",
"volumeTypeName",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"// Handle container volumes",
"if",
"volumeTypeName",
"==",
"\"",
"\"",
"{",
"cName",
",",
"sName",
",",
"snap",
":=",
"containerGetParentAndSnapshotName",
"(",
"volumeName",
")",
"\n\n",
"if",
"snap",
"{",
"return",
"[",
"]",
"string",
"{",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"version",
".",
"APIVersion",
",",
"cName",
",",
"sName",
")",
"}",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"[",
"]",
"string",
"{",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"APIVersion",
",",
"cName",
")",
"}",
",",
"nil",
"\n",
"}",
"\n\n",
"// Handle image volumes",
"if",
"volumeTypeName",
"==",
"\"",
"\"",
"{",
"return",
"[",
"]",
"string",
"{",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"version",
".",
"APIVersion",
",",
"volumeName",
")",
"}",
",",
"nil",
"\n",
"}",
"\n\n",
"// Look for containers using this volume",
"ctsUsingVolume",
",",
"err",
":=",
"storagePoolVolumeUsedByContainersGet",
"(",
"s",
",",
"project",
",",
"volumeName",
",",
"volumeTypeName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"volumeUsedBy",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"ct",
":=",
"range",
"ctsUsingVolume",
"{",
"volumeUsedBy",
"=",
"append",
"(",
"volumeUsedBy",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"version",
".",
"APIVersion",
",",
"ct",
")",
")",
"\n",
"}",
"\n\n",
"profiles",
",",
"err",
":=",
"profilesUsingPoolVolumeGetNames",
"(",
"s",
".",
"Cluster",
",",
"volumeName",
",",
"volumeTypeName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"volumeUsedBy",
")",
"==",
"0",
"&&",
"len",
"(",
"profiles",
")",
"==",
"0",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
",",
"nil",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"pName",
":=",
"range",
"profiles",
"{",
"volumeUsedBy",
"=",
"append",
"(",
"volumeUsedBy",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"version",
".",
"APIVersion",
",",
"pName",
")",
")",
"\n",
"}",
"\n\n",
"return",
"volumeUsedBy",
",",
"nil",
"\n",
"}"
]
|
17,389 | all-17390 | [
"Encode",
"will",
"encode",
"the",
"set",
"of",
"options",
"in",
"the",
"format",
"that",
"is",
"expected",
"for",
"the",
"configuration",
"environment",
"variable",
"."
]
| [
"func",
"Encode",
"(",
"options",
"Options",
")",
"(",
"string",
",",
"error",
")",
"{",
"encoded",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"<mask>",
")",
"\n",
"return",
"string",
"(",
"encoded",
")",
",",
"err",
"\n",
"}"
]
|
17,390 | all-17391 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
]
| [
"func",
"ProgramUniform4ui",
"(",
"program",
"uint32",
",",
"location",
"int32",
",",
"v0",
"uint32",
",",
"v1",
"uint32",
",",
"v2",
"uint32",
",",
"v3",
"uint32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpProgramUniform4ui",
",",
"6",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"v0",
")",
",",
"uintptr",
"(",
"v1",
")",
",",
"uintptr",
"(",
"v2",
")",
",",
"uintptr",
"(",
"v3",
")",
")",
"\n",
"}"
]
|
17,391 | all-17392 | [
"Append",
"creates",
"and",
"adds",
"another",
"range",
"of",
"values",
"to",
"the",
"total",
"range",
"list",
"."
]
| [
"func",
"(",
"l",
"*",
"InclusiveRanges",
")",
"Append",
"(",
"start",
",",
"end",
",",
"step",
"int",
")",
"{",
"block",
":=",
"NewInclusiveRange",
"(",
"start",
",",
"end",
",",
"step",
")",
"\n",
"l",
".",
"blocks",
"=",
"<mask>",
"(",
"l",
".",
"blocks",
",",
"block",
")",
"\n",
"}"
]
|
17,392 | all-17393 | [
"GetSuccess",
"retrieves",
"the",
"Success",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
]
| [
"func",
"(",
"u",
"PathPaymentResult",
")",
"GetSuccess",
"(",
")",
"(",
"result",
"PathPaymentResultSuccess",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Code",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"Success",
"\n",
"ok",
"=",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
]
|
17,393 | all-17394 | [
"Validate",
"ensures",
"all",
"the",
"values",
"set",
"in",
"the",
"DecorationConfig",
"are",
"valid",
"."
]
| [
"func",
"(",
"d",
"*",
"DecorationConfig",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"d",
".",
"UtilityImages",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"var",
"missing",
"[",
"]",
"string",
"\n",
"if",
"d",
".",
"UtilityImages",
".",
"CloneRefs",
"==",
"\"",
"\"",
"{",
"missing",
"=",
"append",
"(",
"missing",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"d",
".",
"UtilityImages",
".",
"InitUpload",
"==",
"\"",
"\"",
"{",
"missing",
"=",
"append",
"(",
"missing",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"d",
".",
"UtilityImages",
".",
"Entrypoint",
"==",
"\"",
"\"",
"{",
"missing",
"=",
"append",
"(",
"missing",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"d",
".",
"UtilityImages",
".",
"Sidecar",
"==",
"\"",
"\"",
"{",
"missing",
"=",
"append",
"(",
"missing",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"missing",
")",
">",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"missing",
")",
"\n",
"}",
"\n\n",
"if",
"d",
".",
"GCSConfiguration",
"==",
"nil",
"{",
"return",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"d",
".",
"GCSCredentialsSecret",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"d",
".",
"GCSConfiguration",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
17,394 | all-17395 | [
"Start",
"explicitly",
"begins",
"the",
"producer",
"in",
"case",
"it",
"was",
"initialized",
"with",
"NewProducer",
"instead",
"of",
"StartProducer",
"."
]
| [
"func",
"(",
"p",
"*",
"Producer",
")",
"Start",
"(",
")",
"{",
"if",
"p",
".",
"started",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"concurrency",
":=",
"cap",
"(",
"p",
".",
"reqs",
")",
"\n",
"p",
".",
"join",
".",
"Add",
"(",
"concurrency",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"!=",
"concurrency",
";",
"i",
"++",
"{",
"go",
"p",
".",
"run",
"(",
")",
"\n",
"}",
"\n\n",
"p",
".",
"started",
"=",
"<mask>",
"\n",
"}"
]
|
17,395 | all-17396 | [
"Close",
"safely",
"closes",
"the",
"consumer",
"and",
"releases",
"all",
"resources"
]
| [
"func",
"(",
"c",
"*",
"<mask>",
")",
"Close",
"(",
")",
"(",
"err",
"error",
")",
"{",
"c",
".",
"closeOnce",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"close",
"(",
"c",
".",
"dying",
")",
"\n",
"<-",
"c",
".",
"dead",
"\n\n",
"if",
"e",
":=",
"c",
".",
"release",
"(",
")",
";",
"e",
"!=",
"nil",
"{",
"err",
"=",
"e",
"\n",
"}",
"\n",
"if",
"e",
":=",
"c",
".",
"consumer",
".",
"Close",
"(",
")",
";",
"e",
"!=",
"nil",
"{",
"err",
"=",
"e",
"\n",
"}",
"\n",
"close",
"(",
"c",
".",
"messages",
")",
"\n",
"close",
"(",
"c",
".",
"errors",
")",
"\n\n",
"if",
"e",
":=",
"c",
".",
"leaveGroup",
"(",
")",
";",
"e",
"!=",
"nil",
"{",
"err",
"=",
"e",
"\n",
"}",
"\n",
"close",
"(",
"c",
".",
"partitions",
")",
"\n",
"close",
"(",
"c",
".",
"notifications",
")",
"\n\n",
"// drain",
"for",
"range",
"c",
".",
"messages",
"{",
"}",
"\n",
"for",
"range",
"c",
".",
"errors",
"{",
"}",
"\n",
"for",
"p",
":=",
"range",
"c",
".",
"partitions",
"{",
"_",
"=",
"p",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"for",
"range",
"c",
".",
"notifications",
"{",
"}",
"\n\n",
"c",
".",
"client",
".",
"release",
"(",
")",
"\n",
"if",
"c",
".",
"ownClient",
"{",
"if",
"e",
":=",
"c",
".",
"client",
".",
"Close",
"(",
")",
";",
"e",
"!=",
"nil",
"{",
"err",
"=",
"e",
"\n",
"}",
"\n",
"}",
"\n",
"}",
")",
"\n",
"return",
"\n",
"}"
]
|
17,396 | all-17397 | [
"OpenVM",
"opens",
"a",
"virtual",
"machine",
"on",
"the",
"host",
"and",
"returns",
"a",
"VM",
"instance",
".",
"Parameters",
":",
"VmxFile",
":",
"The",
"path",
"name",
"of",
"the",
"virtual",
"machine",
"configuration",
"file",
"on",
"the",
"local",
"host",
".",
"Password",
":",
"If",
"VM",
"is",
"encrypted",
"this",
"is",
"the",
"password",
"for",
"VIX",
"to",
"be",
"able",
"to",
"open",
"it",
".",
"Remarks",
":",
"*",
"This",
"function",
"opens",
"a",
"virtual",
"machine",
"on",
"the",
"host",
"instance",
"The",
"virtual",
"machine",
"is",
"identified",
"by",
"vmxFile",
"which",
"is",
"a",
"path",
"name",
"to",
"the",
"configuration",
"file",
"(",
".",
"VMX",
"file",
")",
"for",
"that",
"virtual",
"machine",
".",
"*",
"The",
"format",
"of",
"the",
"path",
"name",
"depends",
"on",
"the",
"host",
"operating",
"system",
".",
"For",
"example",
"a",
"path",
"name",
"for",
"a",
"Windows",
"host",
"requires",
"backslash",
"as",
"a",
"directory",
"separator",
"whereas",
"a",
"Linux",
"host",
"requires",
"a",
"forward",
"slash",
".",
"If",
"the",
"path",
"name",
"includes",
"backslash",
"characters",
"you",
"need",
"to",
"precede",
"each",
"one",
"with",
"an",
"escape",
"character",
".",
"For",
"VMware",
"Server",
"2",
".",
"x",
"the",
"path",
"contains",
"a",
"preceeding",
"data",
"store",
"for",
"example",
"[",
"storage1",
"]",
"vm",
"/",
"vm",
".",
"vmx",
".",
"*",
"For",
"VMware",
"Server",
"hosts",
"a",
"virtual",
"machine",
"must",
"be",
"registered",
"before",
"you",
"can",
"open",
"it",
".",
"You",
"can",
"register",
"a",
"virtual",
"machine",
"by",
"opening",
"it",
"with",
"the",
"VMware",
"Server",
"Console",
"through",
"the",
"vmware",
"-",
"cmd",
"command",
"with",
"the",
"register",
"parameter",
"or",
"with",
"Host",
".",
"RegisterVM",
"()",
".",
"*",
"For",
"vSphere",
"the",
"virtual",
"machine",
"opened",
"may",
"not",
"be",
"the",
"one",
"desired",
"if",
"more",
"than",
"one",
"Datacenter",
"contains",
"VmxFile",
".",
"*",
"To",
"open",
"an",
"encrypted",
"virtual",
"machine",
"pass",
"its",
"correspondent",
"password",
".",
"Since",
"VMware",
"Workstation",
"7",
".",
"0"
]
| [
"func",
"(",
"h",
"*",
"Host",
")",
"OpenVM",
"(",
"vmxFile",
",",
"password",
"string",
")",
"(",
"*",
"VM",
",",
"error",
")",
"{",
"<mask>",
"jobHandle",
"C",
".",
"VixHandle",
"=",
"C",
".",
"VIX_INVALID_HANDLE",
"\n",
"var",
"propertyHandle",
"C",
".",
"VixHandle",
"=",
"C",
".",
"VIX_INVALID_HANDLE",
"\n",
"var",
"vmHandle",
"C",
".",
"VixHandle",
"=",
"C",
".",
"VIX_INVALID_HANDLE",
"\n",
"var",
"err",
"C",
".",
"VixError",
"=",
"C",
".",
"VIX_OK",
"\n\n",
"defer",
"C",
".",
"Vix_ReleaseHandle",
"(",
"propertyHandle",
")",
"\n",
"defer",
"C",
".",
"Vix_ReleaseHandle",
"(",
"jobHandle",
")",
"\n\n",
"if",
"password",
"!=",
"\"",
"\"",
"{",
"cpassword",
":=",
"C",
".",
"CString",
"(",
"password",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cpassword",
")",
")",
"\n\n",
"err",
"=",
"C",
".",
"alloc_vm_pwd_proplist",
"(",
"h",
".",
"handle",
",",
"&",
"propertyHandle",
",",
"cpassword",
")",
"\n\n",
"if",
"C",
".",
"VIX_OK",
"!=",
"err",
"{",
"return",
"nil",
",",
"&",
"Error",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"int",
"(",
"err",
"&",
"0xFFFF",
")",
",",
"Text",
":",
"C",
".",
"GoString",
"(",
"C",
".",
"Vix_GetErrorText",
"(",
"err",
",",
"nil",
")",
")",
",",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"cVmxFile",
":=",
"C",
".",
"CString",
"(",
"vmxFile",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cVmxFile",
")",
")",
"\n\n",
"jobHandle",
"=",
"C",
".",
"VixHost_OpenVM",
"(",
"h",
".",
"handle",
",",
"cVmxFile",
",",
"C",
".",
"VIX_VMOPEN_NORMAL",
",",
"propertyHandle",
",",
"nil",
",",
"// callbackProc",
"nil",
")",
"// clientData",
"\n\n",
"err",
"=",
"C",
".",
"get_vix_handle",
"(",
"jobHandle",
",",
"C",
".",
"VIX_PROPERTY_JOB_RESULT_HANDLE",
",",
"&",
"vmHandle",
",",
"C",
".",
"VIX_PROPERTY_NONE",
")",
"\n\n",
"if",
"C",
".",
"VIX_OK",
"!=",
"err",
"{",
"return",
"nil",
",",
"&",
"Error",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"int",
"(",
"err",
"&",
"0xFFFF",
")",
",",
"Text",
":",
"C",
".",
"GoString",
"(",
"C",
".",
"Vix_GetErrorText",
"(",
"err",
",",
"nil",
")",
")",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"NewVirtualMachine",
"(",
"vmHandle",
",",
"vmxFile",
")",
"\n",
"}"
]
|
17,397 | all-17398 | [
"AddSelectedPeer",
"adds",
"a",
"given",
"peer",
"to",
"the",
"set",
"of",
"selected",
"peers",
"."
]
| [
"func",
"(",
"rs",
"*",
"RequestState",
")",
"AddSelectedPeer",
"(",
"hostPort",
"string",
")",
"{",
"if",
"rs",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"host",
":=",
"getHost",
"(",
"hostPort",
")",
"\n",
"if",
"<mask>",
".",
"SelectedPeers",
"==",
"nil",
"{",
"rs",
".",
"SelectedPeers",
"=",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
"{",
"hostPort",
":",
"{",
"}",
",",
"host",
":",
"{",
"}",
",",
"}",
"\n",
"}",
"else",
"{",
"rs",
".",
"SelectedPeers",
"[",
"hostPort",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"rs",
".",
"SelectedPeers",
"[",
"host",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"}"
]
|
17,398 | all-17399 | [
"export",
"FileSequence_FrameRange"
]
| [
"func",
"FileSequence_FrameRange",
"(",
"<mask>",
"FileSeqId",
")",
"*",
"C",
".",
"char",
"{",
"fs",
",",
"ok",
":=",
"sFileSeqs",
".",
"Get",
"(",
"id",
")",
"\n",
"// caller must free string",
"if",
"!",
"ok",
"{",
"return",
"C",
".",
"CString",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"C",
".",
"CString",
"(",
"fs",
".",
"FrameRange",
"(",
")",
")",
"\n",
"}"
]
|
17,399 | all-17400 | [
"specify",
"a",
"one",
"-",
"dimensional",
"texture",
"subimage"
]
| [
"func",
"TextureSubImage1D",
"(",
"texture",
"uint32",
",",
"level",
"int32",
",",
"xoffset",
"int32",
",",
"<mask>",
"int32",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"pixels",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowTextureSubImage1D",
"(",
"gpTextureSubImage1D",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"texture",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"level",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"xoffset",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"format",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"pixels",
")",
"\n",
"}"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.