id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
7,700 | all-7701 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"<mask>",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoHar8",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
7,701 | all-7702 | [
"Remove",
"removes",
"a",
"point",
"."
] | [
"func",
"(",
"countIndex",
"*",
"CountIndex",
")",
"Remove",
"(",
"id",
"string",
")",
"{",
"if",
"prev",
",",
"ok",
":=",
"countIndex",
".",
"currentPosition",
"[",
"id",
"]",
";",
"<mask>",
"{",
"countIndex",
".",
"index",
".",
"GetEntryAt",
"(",
"prev",
")",
".",
"(",
"counter",
")",
".",
"Remove",
"(",
"prev",
")",
"\n",
"delete",
"(",
"countIndex",
".",
"currentPosition",
",",
"id",
")",
"\n",
"}",
"\n",
"}"
] |
7,702 | all-7703 | [
"Collaborations",
"retrieves",
"a",
"list",
"of",
"all",
"the",
"current",
"user",
"s",
"collaborations"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Collaborations",
"(",
")",
"(",
"[",
"]",
"Collaboration",
",",
"error",
")",
"{",
"<mask>",
"cl",
"[",
"]",
"Collaboration",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"MakeApiRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"&",
"cl",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"cl",
",",
"err",
"\n",
"}"
] |
7,703 | all-7704 | [
"SetState",
"is",
"a",
"wrapper",
"around",
"g_simple_action_set_state",
"This",
"should",
"only",
"be",
"called",
"by",
"the",
"implementor",
"of",
"the",
"action",
".",
"Users",
"of",
"the",
"action",
"should",
"not",
"attempt",
"to",
"directly",
"modify",
"the",
"state",
"property",
".",
"Instead",
"they",
"should",
"call",
"ChangeState",
"[",
"g_action_change_state",
"()",
"]",
"to",
"request",
"the",
"change",
"."
] | [
"func",
"(",
"v",
"*",
"SimpleAction",
")",
"SetState",
"(",
"value",
"*",
"Variant",
")",
"{",
"C",
".",
"g_simple_action_set_state",
"(",
"v",
".",
"native",
"(",
")",
",",
"<mask>",
".",
"native",
"(",
")",
")",
"\n",
"}"
] |
7,704 | all-7705 | [
"establish",
"the",
"data",
"storage",
"format",
"dimensions",
"and",
"number",
"of",
"samples",
"of",
"a",
"multisample",
"texture",
"s",
"image"
] | [
"func",
"TexImage2DMultisample",
"(",
"target",
"uint32",
",",
"samples",
"int32",
",",
"internalformat",
"uint32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"fixedsamplelocations",
"bool",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpTexImage2DMultisample",
",",
"6",
",",
"uintptr",
"(",
"target",
")",
",",
"uintptr",
"(",
"samples",
")",
",",
"uintptr",
"(",
"internalformat",
")",
",",
"uintptr",
"(",
"width",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"boolToUintptr",
"(",
"fixedsamplelocations",
")",
")",
"\n",
"}"
] |
7,705 | all-7706 | [
"Create",
"creates",
"the",
"metadata",
"file",
"and",
"adds",
"the",
"metadata",
"directory",
"to",
"the",
"container",
"s",
"mounted",
"host",
"volumes",
"Pointer",
"hostConfig",
"is",
"modified",
"directly",
"so",
"there",
"is",
"risk",
"of",
"concurrency",
"errors",
"."
] | [
"func",
"(",
"manager",
"*",
"metadataManager",
")",
"Create",
"(",
"config",
"*",
"dockercontainer",
".",
"Config",
",",
"hostConfig",
"*",
"dockercontainer",
".",
"HostConfig",
",",
"task",
"*",
"apitask",
".",
"Task",
",",
"containerName",
"string",
")",
"error",
"{",
"// Create task and container directories if they do not yet exist",
"metadataDirectoryPath",
",",
"err",
":=",
"getMetadataFilePath",
"(",
"task",
".",
"Arn",
",",
"containerName",
",",
"manager",
".",
"dataDir",
")",
"\n",
"// Stop metadata creation if path is malformed for any reason",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"task",
".",
"Arn",
",",
"containerName",
",",
"err",
")",
"\n",
"}",
"\n\n",
"err",
"=",
"manager",
".",
"osWrap",
".",
"MkdirAll",
"(",
"metadataDirectoryPath",
",",
"os",
".",
"ModePerm",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"Arn",
",",
"err",
")",
"\n",
"}",
"\n\n",
"// Acquire the metadata then write it in JSON format to the file",
"metadata",
":=",
"manager",
".",
"parseMetadataAtContainerCreate",
"(",
"task",
",",
"containerName",
")",
"\n",
"err",
"=",
"manager",
".",
"marshalAndWrite",
"(",
"metadata",
",",
"task",
".",
"Arn",
",",
"containerName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Add the directory of this container's metadata to the container's mount binds",
"// Then add the destination directory as an environment variable in the container $METADATA",
"binds",
",",
"env",
":=",
"createBindsEnv",
"(",
"hostConfig",
".",
"Binds",
",",
"config",
".",
"Env",
",",
"manager",
".",
"dataDirOnHost",
",",
"metadataDirectoryPath",
")",
"\n",
"config",
".",
"Env",
"=",
"env",
"\n",
"hostConfig",
".",
"Binds",
"=",
"binds",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,706 | all-7707 | [
"ServeReady",
"starts",
"serving",
"the",
"readiness",
"endpoint"
] | [
"func",
"(",
"h",
"*",
"Health",
")",
"ServeReady",
"(",
")",
"{",
"h",
".",
"healthMux",
".",
"HandleFunc",
"(",
"\"",
"\"",
",",
"func",
"(",
"w",
"<mask>",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"fmt",
".",
"Fprint",
"(",
"w",
",",
"\"",
"\"",
")",
"}",
")",
"\n",
"}"
] |
7,707 | all-7708 | [
"CreateZone",
"adds",
"new",
"zone",
"if",
"not",
"present"
] | [
"func",
"(",
"im",
"*",
"InMemoryProvider",
")",
"CreateZone",
"(",
"newZone",
"string",
")",
"error",
"{",
"return",
"im",
".",
"<mask>",
".",
"CreateZone",
"(",
"newZone",
")",
"\n",
"}"
] |
7,708 | all-7709 | [
"create",
"a",
"stand",
"-",
"alone",
"program",
"from",
"an",
"array",
"of",
"null",
"-",
"terminated",
"source",
"code",
"strings"
] | [
"func",
"CreateShaderProgramv",
"(",
"xtype",
"uint32",
",",
"count",
"int32",
",",
"strings",
"*",
"*",
"uint8",
")",
"uint32",
"{",
"ret",
":=",
"C",
".",
"glowCreateShaderProgramv",
"(",
"gpCreateShaderProgramv",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"<mask>",
")",
",",
"(",
"*",
"*",
"C",
".",
"GLchar",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"strings",
")",
")",
")",
"\n",
"return",
"(",
"uint32",
")",
"(",
"ret",
")",
"\n",
"}"
] |
7,709 | all-7710 | [
"complete",
"returns",
"true",
"if",
"all",
"fields",
"of",
"the",
"config",
"are",
"populated",
"/",
"nonzero"
] | [
"func",
"(",
"cfg",
"*",
"Config",
")",
"<mask>",
"(",
")",
"bool",
"{",
"cfgElem",
":=",
"reflect",
".",
"ValueOf",
"(",
"cfg",
")",
".",
"Elem",
"(",
")",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"cfgElem",
".",
"NumField",
"(",
")",
";",
"i",
"++",
"{",
"if",
"utils",
".",
"ZeroOrNil",
"(",
"cfgElem",
".",
"Field",
"(",
"i",
")",
".",
"Interface",
"(",
")",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] |
7,710 | all-7711 | [
"ProfileGet",
"returns",
"the",
"profile",
"with",
"the",
"given",
"key",
"."
] | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"ProfileGet",
"(",
"project",
"string",
",",
"name",
"string",
")",
"(",
"*",
"Profile",
",",
"error",
")",
"{",
"filter",
":=",
"ProfileFilter",
"{",
"}",
"\n",
"filter",
".",
"Project",
"=",
"project",
"\n",
"filter",
".",
"Name",
"=",
"<mask>",
"\n\n",
"objects",
",",
"err",
":=",
"c",
".",
"ProfileList",
"(",
"filter",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"switch",
"len",
"(",
"objects",
")",
"{",
"case",
"0",
":",
"return",
"nil",
",",
"ErrNoSuchObject",
"\n",
"case",
"1",
":",
"return",
"&",
"objects",
"[",
"0",
"]",
",",
"nil",
"\n",
"default",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
7,711 | all-7712 | [
"CreateCheckoutKey",
"creates",
"a",
"new",
"checkout",
"key",
"for",
"a",
"project",
"Valid",
"key",
"types",
"are",
"currently",
"deploy",
"-",
"key",
"and",
"github",
"-",
"user",
"-",
"key",
"The",
"github",
"-",
"user",
"-",
"key",
"type",
"requires",
"that",
"the",
"API",
"token",
"being",
"used",
"be",
"a",
"user",
"API",
"token"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateCheckoutKey",
"(",
"account",
",",
"repo",
",",
"keyType",
"string",
")",
"(",
"*",
"CheckoutKey",
",",
"error",
")",
"{",
"checkoutKey",
":=",
"&",
"CheckoutKey",
"{",
"}",
"\n\n",
"body",
":=",
"struct",
"{",
"KeyType",
"string",
"`json:\"type\"`",
"\n",
"}",
"{",
"KeyType",
":",
"keyType",
"}",
"\n\n",
"err",
":=",
"c",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"account",
",",
"repo",
")",
",",
"checkoutKey",
",",
"nil",
",",
"body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"checkoutKey",
",",
"nil",
"\n",
"}"
] |
7,712 | all-7713 | [
"TextExtent",
"calculates",
"the",
"width",
"and",
"the",
"height",
"of",
"the",
"text"
] | [
"func",
"TextExtent",
"(",
"text",
"string",
")",
"(",
"int",
",",
"int",
")",
"{",
"if",
"text",
"==",
"\"",
"\"",
"{",
"return",
"0",
",",
"0",
"\n",
"}",
"\n",
"parts",
":=",
"strings",
".",
"Split",
"(",
"text",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"h",
":=",
"len",
"(",
"parts",
")",
"\n",
"w",
":=",
"0",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"<mask>",
"{",
"s",
":=",
"UnColorizeText",
"(",
"p",
")",
"\n",
"l",
":=",
"len",
"(",
"s",
")",
"\n",
"if",
"l",
">",
"w",
"{",
"w",
"=",
"l",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"h",
",",
"w",
"\n",
"}"
] |
7,713 | all-7714 | [
"cmdOutput",
"runs",
"a",
"shell",
"command",
"and",
"returns",
"its",
"output",
"."
] | [
"func",
"cmdOutput",
"(",
"name",
"string",
",",
"args",
"...",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"cmd",
":=",
"exec",
".",
"Command",
"(",
"name",
",",
"args",
"...",
")",
"\n",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"<mask>",
",",
"strings",
".",
"Join",
"(",
"args",
",",
"\"",
"\"",
")",
")",
"\n\n",
"stdout",
",",
"err",
":=",
"cmd",
".",
"Output",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"log",
".",
"Debugf",
"(",
"\"",
"\\n",
"\\n",
"\"",
",",
"string",
"(",
"stdout",
")",
")",
"\n\n",
"return",
"string",
"(",
"stdout",
")",
",",
"nil",
"\n",
"}"
] |
7,714 | all-7715 | [
"Warningf",
"logs",
"a",
"WARNING",
"message",
"to",
"the",
"logger",
"specified",
"in",
"opts",
"."
] | [
"func",
"(",
"opt",
"*",
"Options",
")",
"Warningf",
"(",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"opt",
".",
"Logger",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"opt",
".",
"Logger",
".",
"Warningf",
"(",
"<mask>",
",",
"v",
"...",
")",
"\n",
"}"
] |
7,715 | all-7716 | [
"GitClient",
"returns",
"a",
"Git",
"client",
"."
] | [
"func",
"(",
"o",
"*",
"GitHubOptions",
")",
"GitClient",
"(",
"secretAgent",
"*",
"secret",
".",
"Agent",
",",
"dryRun",
"bool",
")",
"(",
"client",
"*",
"git",
".",
"<mask>",
",",
"err",
"error",
")",
"{",
"client",
",",
"err",
"=",
"git",
".",
"NewClient",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// We must capture the value of client here to prevent issues related",
"// to the use of named return values when an error is encountered.",
"// Without this, we risk a nil pointer dereference.",
"defer",
"func",
"(",
"client",
"*",
"git",
".",
"Client",
")",
"{",
"if",
"err",
"!=",
"nil",
"{",
"client",
".",
"Clean",
"(",
")",
"\n",
"}",
"\n",
"}",
"(",
"client",
")",
"\n\n",
"// Get the bot's name in order to set credentials for the Git client.",
"githubClient",
",",
"err",
":=",
"o",
".",
"GitHubClient",
"(",
"secretAgent",
",",
"dryRun",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"botName",
",",
"err",
":=",
"githubClient",
".",
"BotName",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"client",
".",
"SetCredentials",
"(",
"botName",
",",
"secretAgent",
".",
"GetTokenGenerator",
"(",
"o",
".",
"TokenPath",
")",
")",
"\n\n",
"return",
"client",
",",
"nil",
"\n",
"}"
] |
7,716 | all-7717 | [
"TransferTokens",
"initiates",
"JobPreAccountAddBalanceApprove",
"or",
"JobPreAccountReturnBalance",
"job",
"depending",
"on",
"the",
"direction",
"of",
"the",
"transfer",
"."
] | [
"func",
"(",
"h",
"*",
"Handler",
")",
"TransferTokens",
"(",
"tkn",
",",
"account",
",",
"destination",
"string",
",",
"amount",
",",
"gasPrice",
"uint64",
")",
"error",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"destination",
",",
"\"",
"\"",
",",
"amount",
",",
"\"",
"\"",
",",
"gasPrice",
")",
"\n\n",
"if",
"!",
"h",
".",
"token",
".",
"Check",
"(",
"tkn",
")",
"{",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"return",
"ErrAccessDenied",
"\n",
"}",
"\n\n",
"if",
"amount",
"==",
"0",
"{",
"logger",
".",
"Error",
"(",
"ErrTokenAmountTooSmall",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"ErrTokenAmountTooSmall",
"\n",
"}",
"\n\n",
"if",
"destination",
"!=",
"data",
".",
"ContractPSC",
"&&",
"destination",
"!=",
"data",
".",
"ContractPTC",
"{",
"logger",
".",
"<mask>",
"(",
"ErrBadDestination",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"ErrBadDestination",
"\n",
"}",
"\n\n",
"err",
":=",
"h",
".",
"findByPrimaryKey",
"(",
"logger",
",",
"ErrAccountNotFound",
",",
"&",
"data",
".",
"Account",
"{",
"}",
",",
"account",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"jobType",
":=",
"data",
".",
"JobPreAccountAddBalanceApprove",
"\n",
"if",
"destination",
"==",
"data",
".",
"ContractPTC",
"{",
"jobType",
"=",
"data",
".",
"JobPreAccountReturnBalance",
"\n",
"}",
"\n\n",
"jobData",
":=",
"&",
"data",
".",
"JobBalanceData",
"{",
"Amount",
":",
"amount",
",",
"GasPrice",
":",
"gasPrice",
",",
"}",
"\n\n",
"err",
"=",
"job",
".",
"AddWithData",
"(",
"h",
".",
"queue",
",",
"nil",
",",
"jobType",
",",
"data",
".",
"JobAccount",
",",
"account",
",",
"data",
".",
"JobUser",
",",
"jobData",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"ErrInternal",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
7,717 | all-7718 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object"
] | [
"func",
"UniformMatrix3fv",
"(",
"location",
"int32",
",",
"<mask>",
"int32",
",",
"transpose",
"bool",
",",
"value",
"*",
"float32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpUniformMatrix3fv",
",",
"4",
",",
"uintptr",
"(",
"location",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"boolToUintptr",
"(",
"transpose",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
7,718 | all-7719 | [
"newStateManager",
"creates",
"a",
"new",
"state",
"manager",
"object",
"for",
"the",
"task",
"engine",
".",
"Rest",
"of",
"the",
"parameters",
"are",
"pointers",
"and",
"it",
"s",
"expected",
"that",
"all",
"of",
"these",
"will",
"be",
"backfilled",
"when",
"state",
"manager",
"s",
"Load",
"()",
"method",
"is",
"invoked"
] | [
"func",
"(",
"agent",
"*",
"ecsAgent",
")",
"newStateManager",
"(",
"taskEngine",
"<mask>",
".",
"TaskEngine",
",",
"cluster",
"*",
"string",
",",
"containerInstanceArn",
"*",
"string",
",",
"savedInstanceID",
"*",
"string",
",",
"availabilityZone",
"*",
"string",
")",
"(",
"statemanager",
".",
"StateManager",
",",
"error",
")",
"{",
"if",
"!",
"agent",
".",
"cfg",
".",
"Checkpoint",
"{",
"return",
"statemanager",
".",
"NewNoopStateManager",
"(",
")",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"agent",
".",
"stateManagerFactory",
".",
"NewStateManager",
"(",
"agent",
".",
"cfg",
",",
"statemanager",
".",
"AddSaveable",
"(",
"\"",
"\"",
",",
"taskEngine",
")",
",",
"// This is for making testing easier as we can mock this",
"agent",
".",
"saveableOptionFactory",
".",
"AddSaveable",
"(",
"\"",
"\"",
",",
"containerInstanceArn",
")",
",",
"agent",
".",
"saveableOptionFactory",
".",
"AddSaveable",
"(",
"\"",
"\"",
",",
"cluster",
")",
",",
"// This is for making testing easier as we can mock this",
"agent",
".",
"saveableOptionFactory",
".",
"AddSaveable",
"(",
"\"",
"\"",
",",
"savedInstanceID",
")",
",",
"agent",
".",
"saveableOptionFactory",
".",
"AddSaveable",
"(",
"\"",
"\"",
",",
"availabilityZone",
")",
",",
")",
"\n",
"}"
] |
7,719 | all-7720 | [
"Connect",
"is",
"used",
"to",
"connect",
"this",
"transport",
"to",
"another",
"transport",
"for",
"a",
"given",
"peer",
"name",
".",
"This",
"allows",
"for",
"local",
"routing",
"."
] | [
"func",
"(",
"i",
"*",
"InmemTransport",
")",
"Connect",
"(",
"<mask>",
"ServerAddress",
",",
"t",
"Transport",
")",
"{",
"trans",
":=",
"t",
".",
"(",
"*",
"InmemTransport",
")",
"\n",
"i",
".",
"Lock",
"(",
")",
"\n",
"defer",
"i",
".",
"Unlock",
"(",
")",
"\n",
"i",
".",
"peers",
"[",
"peer",
"]",
"=",
"trans",
"\n",
"}"
] |
7,720 | all-7721 | [
"GrantAccess",
"will",
"enforce",
"the",
"authorization",
"without",
"any",
"changes",
"to",
"the",
"context",
".",
"It",
"should",
"be",
"used",
"if",
"the",
"presented",
"candidate",
"has",
"full",
"access",
"to",
"the",
"data",
"(",
".",
"e",
".",
"g",
"a",
"superuser",
")",
"."
] | [
"func",
"GrantAccess",
"(",
")",
"*",
"Enforcer",
"{",
"return",
"E",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"All",
"(",
")",
",",
"func",
"(",
"_",
"*",
"fire",
".",
"Context",
")",
"error",
"{",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
7,721 | all-7722 | [
"DeepCopy",
"copies",
"the",
"receiver",
"into",
"a",
"new",
"CreditCard",
"."
] | [
"func",
"(",
"u",
"*",
"CreditCard",
")",
"DeepCopy",
"(",
")",
"*",
"CreditCard",
"{",
"if",
"u",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"CreditCard",
")",
"\n",
"u",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
7,722 | all-7723 | [
"PanicHandler",
"recovers",
"from",
"panics",
"gracefully",
"and",
"calls",
"the",
"error",
"handling",
"code",
"for",
"a",
"500",
"error",
"."
] | [
"func",
"(",
"a",
"*",
"App",
")",
"PanicHandler",
"(",
"next",
"Handler",
")",
"Handler",
"{",
"return",
"func",
"(",
"c",
"Context",
")",
"error",
"{",
"defer",
"func",
"(",
")",
"{",
"//catch or finally",
"r",
":=",
"recover",
"(",
")",
"\n",
"var",
"err",
"error",
"\n",
"if",
"r",
"!=",
"nil",
"{",
"//catch",
"switch",
"t",
":=",
"r",
".",
"(",
"type",
")",
"{",
"case",
"error",
":",
"err",
"=",
"t",
"\n",
"case",
"string",
":",
"err",
"=",
"errors",
".",
"New",
"(",
"t",
")",
"\n",
"default",
":",
"err",
"=",
"errors",
".",
"New",
"(",
"fmt",
".",
"Sprint",
"(",
"t",
")",
")",
"\n",
"}",
"\n",
"err",
"=",
"err",
"\n",
"<mask>",
".",
"EmitError",
"(",
"events",
".",
"ErrPanic",
",",
"err",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"c",
",",
"\"",
"\"",
":",
"a",
",",
"}",
",",
")",
"\n",
"eh",
":=",
"a",
".",
"ErrorHandlers",
".",
"Get",
"(",
"500",
")",
"\n",
"eh",
"(",
"500",
",",
"err",
",",
"c",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"return",
"next",
"(",
"c",
")",
"\n",
"}",
"\n",
"}"
] |
7,723 | all-7724 | [
"LogWithTime",
"will",
"log",
"a",
"message",
"at",
"the",
"provided",
"level",
"to",
"all",
"added",
"loggers",
"with",
"the",
"timestamp",
"set",
"to",
"the",
"value",
"of",
"ts",
"."
] | [
"func",
"(",
"b",
"*",
"Base",
")",
"LogWithTime",
"(",
"level",
"LogLevel",
",",
"ts",
"time",
".",
"Time",
",",
"m",
"*",
"Attrs",
",",
"msg",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"!",
"b",
".",
"shouldLog",
"(",
"level",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"!",
"b",
".",
"isInitialized",
"{",
"return",
"ErrNotInitialized",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"b",
".",
"config",
".",
"FilenameAttr",
")",
">",
"0",
"||",
"len",
"(",
"b",
".",
"config",
".",
"LineNumberAttr",
")",
">",
"0",
"{",
"file",
",",
"line",
":=",
"getCallerInfo",
"(",
")",
"\n",
"if",
"m",
"==",
"nil",
"{",
"m",
"=",
"NewAttrs",
"(",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"b",
".",
"config",
".",
"FilenameAttr",
")",
">",
"0",
"{",
"m",
".",
"SetAttr",
"(",
"b",
".",
"config",
".",
"FilenameAttr",
",",
"file",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"b",
".",
"config",
".",
"LineNumberAttr",
")",
">",
"0",
"{",
"m",
".",
"SetAttr",
"(",
"b",
".",
"config",
".",
"LineNumberAttr",
",",
"line",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"b",
".",
"config",
".",
"SequenceAttr",
")",
">",
"0",
"{",
"if",
"m",
"==",
"nil",
"{",
"m",
"=",
"NewAttrs",
"(",
")",
"\n",
"}",
"\n",
"seq",
":=",
"atomic",
".",
"AddUint64",
"(",
"&",
"b",
".",
"sequence",
",",
"1",
")",
"\n",
"m",
".",
"SetAttr",
"(",
"b",
".",
"config",
".",
"SequenceAttr",
",",
"seq",
")",
"\n",
"}",
"\n\n",
"nm",
":=",
"newMessage",
"(",
"ts",
",",
"b",
",",
"level",
",",
"m",
",",
"msg",
",",
"a",
"...",
")",
"\n\n",
"for",
"_",
",",
"hook",
":=",
"range",
"b",
".",
"hookPreQueue",
"{",
"err",
":=",
"hook",
".",
"PreQueue",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"b",
".",
"queue",
".",
"queueMessage",
"(",
"nm",
")",
"\n",
"}"
] |
7,724 | all-7725 | [
"GetDeletedAtOk",
"returns",
"a",
"tuple",
"with",
"the",
"DeletedAt",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsTest",
")",
"GetDeletedAtOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"DeletedAt",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"DeletedAt",
",",
"<mask>",
"\n",
"}"
] |
7,725 | all-7726 | [
"Duration",
"defines",
"a",
"time",
".",
"Duration",
"flag",
"with",
"specified",
"name",
"default",
"value",
"and",
"usage",
"string",
".",
"The",
"return",
"value",
"is",
"the",
"address",
"of",
"a",
"time",
".",
"Duration",
"variable",
"that",
"stores",
"the",
"value",
"of",
"the",
"flag",
"."
] | [
"func",
"Duration",
"(",
"name",
"string",
",",
"value",
"<mask>",
".",
"Duration",
",",
"usage",
"string",
")",
"*",
"time",
".",
"Duration",
"{",
"return",
"EnvironmentFlags",
".",
"Duration",
"(",
"name",
",",
"value",
",",
"usage",
")",
"\n",
"}"
] |
7,726 | all-7727 | [
"handleFlushTask",
"must",
"be",
"run",
"serially",
"."
] | [
"func",
"(",
"db",
"*",
"DB",
")",
"handleFlushTask",
"(",
"ft",
"flushTask",
")",
"error",
"{",
"if",
"!",
"ft",
".",
"mt",
".",
"Empty",
"(",
")",
"{",
"// Store badger head even if vptr is zero, need it for readTs",
"db",
".",
"opt",
".",
"Debugf",
"(",
"\"",
"\\n",
"\"",
",",
"ft",
".",
"vptr",
")",
"\n",
"db",
".",
"elog",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"ft",
".",
"vptr",
")",
"\n",
"offset",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"vptrSize",
")",
"\n",
"ft",
".",
"vptr",
".",
"Encode",
"(",
"offset",
")",
"\n\n",
"// Pick the max commit ts, so in case of crash, our read ts would be higher than all the",
"// commits.",
"headTs",
":=",
"y",
".",
"KeyWithTs",
"(",
"head",
",",
"db",
".",
"orc",
".",
"nextTs",
"(",
")",
")",
"\n",
"ft",
".",
"mt",
".",
"Put",
"(",
"headTs",
",",
"y",
".",
"ValueStruct",
"{",
"Value",
":",
"offset",
"}",
")",
"\n\n",
"// Also store lfDiscardStats before flushing memtables",
"discardStatsKey",
":=",
"y",
".",
"KeyWithTs",
"(",
"lfDiscardStatsKey",
",",
"1",
")",
"\n",
"ft",
".",
"mt",
".",
"Put",
"(",
"discardStatsKey",
",",
"y",
".",
"ValueStruct",
"{",
"Value",
":",
"db",
".",
"vlog",
".",
"encodedDiscardStats",
"(",
")",
"}",
")",
"\n",
"}",
"\n\n",
"fileID",
":=",
"db",
".",
"lc",
".",
"reserveFileID",
"(",
")",
"\n",
"fd",
",",
"err",
":=",
"y",
".",
"CreateSyncedFile",
"(",
"table",
".",
"NewFilename",
"(",
"fileID",
",",
"db",
".",
"<mask>",
".",
"Dir",
")",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"y",
".",
"Wrap",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"// Don't block just to sync the directory entry.",
"dirSyncCh",
":=",
"make",
"(",
"chan",
"error",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"dirSyncCh",
"<-",
"syncDir",
"(",
"db",
".",
"opt",
".",
"Dir",
")",
"}",
"(",
")",
"\n\n",
"err",
"=",
"writeLevel0Table",
"(",
"ft",
",",
"fd",
")",
"\n",
"dirSyncErr",
":=",
"<-",
"dirSyncCh",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"db",
".",
"elog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"if",
"dirSyncErr",
"!=",
"nil",
"{",
"// Do dir sync as best effort. No need to return due to an error there.",
"db",
".",
"elog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"dirSyncErr",
")",
"\n",
"}",
"\n\n",
"tbl",
",",
"err",
":=",
"table",
".",
"OpenTable",
"(",
"fd",
",",
"db",
".",
"opt",
".",
"TableLoadingMode",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"db",
".",
"elog",
".",
"Printf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"// We own a ref on tbl.",
"err",
"=",
"db",
".",
"lc",
".",
"addLevel0Table",
"(",
"tbl",
")",
"// This will incrRef (if we don't error, sure)",
"\n",
"tbl",
".",
"DecrRef",
"(",
")",
"// Releases our ref.",
"\n",
"return",
"err",
"\n",
"}"
] |
7,727 | all-7728 | [
"MarshalText",
"turns",
"this",
"instance",
"into",
"text"
] | [
"func",
"(",
"b",
"Base64",
")",
"MarshalText",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"enc",
":=",
"base64",
".",
"URLEncoding",
"\n",
"src",
":=",
"[",
"]",
"byte",
"(",
"b",
")",
"\n",
"buf",
":=",
"<mask>",
"(",
"[",
"]",
"byte",
",",
"enc",
".",
"EncodedLen",
"(",
"len",
"(",
"src",
")",
")",
")",
"\n",
"enc",
".",
"Encode",
"(",
"buf",
",",
"src",
")",
"\n",
"return",
"buf",
",",
"nil",
"\n",
"}"
] |
7,728 | all-7729 | [
"newUntrustedSignature",
"returns",
"an",
"untrustedSignature",
"object",
"with",
"the",
"specified",
"primary",
"contents",
"and",
"appropriate",
"metadata",
"."
] | [
"func",
"newUntrustedSignature",
"(",
"dockerManifestDigest",
"digest",
".",
"Digest",
",",
"dockerReference",
"string",
")",
"untrustedSignature",
"{",
"// Use intermediate variables for these values so that we can take their addresses.",
"// Golang guarantees that they will have a new address on every execution.",
"creatorID",
":=",
"\"",
"\"",
"+",
"version",
".",
"<mask>",
"\n",
"timestamp",
":=",
"time",
".",
"Now",
"(",
")",
".",
"Unix",
"(",
")",
"\n",
"return",
"untrustedSignature",
"{",
"UntrustedDockerManifestDigest",
":",
"dockerManifestDigest",
",",
"UntrustedDockerReference",
":",
"dockerReference",
",",
"UntrustedCreatorID",
":",
"&",
"creatorID",
",",
"UntrustedTimestamp",
":",
"&",
"timestamp",
",",
"}",
"\n",
"}"
] |
7,729 | all-7730 | [
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"LedgerEntryChangeType"
] | [
"func",
"(",
"e",
"LedgerEntryChangeType",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"<mask>",
":=",
"ledgerEntryChangeTypeMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
7,730 | all-7731 | [
"TODO",
":",
"gtk_container_get_path_for_child",
"GetFocusChild",
"is",
"a",
"wrapper",
"around",
"gtk_container_get_focus_child",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetFocusChild",
"(",
")",
"*",
"Widget",
"{",
"c",
":=",
"C",
".",
"gtk_container_get_focus_child",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapWidget",
"(",
"obj",
")",
"\n",
"}"
] |
7,731 | all-7732 | [
"DeleteNoCloseTagName",
"deletes",
"name",
"from",
".",
"NoCloseTagNames",
"set",
"."
] | [
"func",
"(",
"opts",
"*",
"Options",
")",
"DeleteNoCloseTagName",
"(",
"name",
"string",
")",
"{",
"var",
"newset",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"n",
":=",
"range",
"opts",
".",
"NoCloseTagNames",
"{",
"if",
"n",
"!=",
"<mask>",
"{",
"newset",
"=",
"append",
"(",
"newset",
",",
"n",
")",
"\n",
"}",
"\n",
"}",
"\n",
"opts",
".",
"NoCloseTagNames",
"=",
"newset",
"\n",
"}"
] |
7,732 | all-7733 | [
"XXX",
"debug",
"support",
"remove",
"when",
"debugging",
"done",
"."
] | [
"func",
"addArgsFromEnv",
"(",
"evar",
"string",
",",
"args",
"*",
"[",
"]",
"string",
")",
"{",
"if",
"e",
":=",
"os",
".",
"Getenv",
"(",
"evar",
")",
";",
"e",
"!=",
"\"",
"\"",
"{",
"for",
"_",
",",
"f",
":=",
"range",
"strings",
".",
"Fields",
"(",
"e",
")",
"{",
"*",
"args",
"=",
"<mask>",
"(",
"*",
"args",
",",
"f",
")",
"\n",
"}",
"\n",
"}",
"\n",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"*",
"args",
")",
"\n",
"}"
] |
7,733 | all-7734 | [
"CreateBoard",
"creates",
"a",
"new",
"dashboard",
"when",
"given",
"a",
"Board",
"struct",
"."
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"CreateBoard",
"(",
"board",
"*",
"Board",
")",
"(",
"*",
"Board",
",",
"error",
")",
"{",
"<mask>",
"createdBoard",
"Board",
"\n",
"if",
"err",
":=",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"board",
",",
"&",
"createdBoard",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"createdBoard",
",",
"nil",
"\n",
"}"
] |
7,734 | all-7735 | [
"AddENIAttachment",
"adds",
"the",
"eni",
"into",
"the",
"state"
] | [
"func",
"(",
"state",
"*",
"DockerTaskEngineState",
")",
"AddENIAttachment",
"(",
"eniAttachment",
"*",
"apieni",
".",
"ENIAttachment",
")",
"{",
"if",
"eniAttachment",
"==",
"nil",
"{",
"log",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"state",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"<mask>",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"state",
".",
"eniAttachments",
"[",
"eniAttachment",
".",
"MACAddress",
"]",
";",
"!",
"ok",
"{",
"state",
".",
"eniAttachments",
"[",
"eniAttachment",
".",
"MACAddress",
"]",
"=",
"eniAttachment",
"\n",
"}",
"else",
"{",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"eniAttachment",
")",
"\n",
"}",
"\n\n",
"}"
] |
7,735 | all-7736 | [
"Drop",
"clears",
"the",
"database"
] | [
"func",
"(",
"m",
"*",
"MongoDb",
")",
"Drop",
"(",
")",
"error",
"{",
"err",
":=",
"m",
".",
"<mask>",
".",
"DropDatabase",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"e",
".",
"New",
"(",
"err",
")",
"\n",
"}",
"\n",
"m",
".",
"db",
"=",
"m",
".",
"session",
".",
"DB",
"(",
"m",
".",
"dbname",
")",
"\n",
"m",
".",
"c",
"=",
"m",
".",
"db",
".",
"C",
"(",
"m",
".",
"collection",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,736 | all-7737 | [
"SetOnConnectCallback",
"sets",
"a",
"callback",
"function",
"to",
"be",
"called",
"with",
"the",
"websocket",
"connection",
"is",
"established",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"SetOnConnectCallback",
"(",
"cb",
"func",
"(",
")",
")",
"{",
"c",
".",
"callbackLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"callbackLock",
".",
"Unlock",
"(",
")",
"\n",
"c",
".",
"callback",
"=",
"cb",
"\n",
"}"
] |
7,737 | all-7738 | [
"InstanceEnvs",
"returns",
"a",
"map",
"of",
"environment",
"variables",
"that",
"belongs",
"to",
"the",
"given",
"service",
"and",
"service",
"instance",
"."
] | [
"func",
"(",
"app",
"*",
"App",
")",
"InstanceEnvs",
"(",
"serviceName",
",",
"instanceName",
"string",
")",
"map",
"[",
"string",
"]",
"<mask>",
".",
"EnvVar",
"{",
"envs",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"bind",
".",
"EnvVar",
")",
"\n",
"for",
"_",
",",
"env",
":=",
"range",
"app",
".",
"ServiceEnvs",
"{",
"if",
"env",
".",
"ServiceName",
"==",
"serviceName",
"&&",
"env",
".",
"InstanceName",
"==",
"instanceName",
"{",
"envs",
"[",
"env",
".",
"Name",
"]",
"=",
"env",
".",
"EnvVar",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"envs",
"\n",
"}"
] |
7,738 | all-7739 | [
"GlobFile",
"returns",
"files",
"that",
"match",
"a",
"given",
"glob",
"pattern",
"in",
"a",
"given",
"commit",
".",
"The",
"pattern",
"is",
"documented",
"here",
":",
"https",
":",
"//",
"golang",
".",
"org",
"/",
"pkg",
"/",
"path",
"/",
"filepath",
"/",
"#Match"
] | [
"func",
"(",
"c",
"APIClient",
")",
"GlobFile",
"(",
"repoName",
"string",
",",
"commitID",
"string",
",",
"<mask>",
"string",
")",
"(",
"[",
"]",
"*",
"pfs",
".",
"FileInfo",
",",
"error",
")",
"{",
"fs",
",",
"err",
":=",
"c",
".",
"PfsAPIClient",
".",
"GlobFileStream",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"pfs",
".",
"GlobFileRequest",
"{",
"Commit",
":",
"NewCommit",
"(",
"repoName",
",",
"commitID",
")",
",",
"Pattern",
":",
"pattern",
",",
"}",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"var",
"result",
"[",
"]",
"*",
"pfs",
".",
"FileInfo",
"\n",
"for",
"{",
"f",
",",
"err",
":=",
"fs",
".",
"Recv",
"(",
")",
"\n",
"if",
"err",
"==",
"io",
".",
"EOF",
"{",
"break",
"\n",
"}",
"else",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"result",
"=",
"append",
"(",
"result",
",",
"f",
")",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n",
"}"
] |
7,739 | all-7740 | [
"See",
"bcd",
".",
"Tracer",
".",
"AddOptions",
"()",
"."
] | [
"func",
"(",
"t",
"*",
"BTTracer",
")",
"AddOptions",
"(",
"options",
"[",
"]",
"string",
",",
"v",
"...",
"string",
")",
"[",
"]",
"string",
"{",
"if",
"options",
"!=",
"nil",
"{",
"return",
"append",
"(",
"options",
",",
"v",
"...",
")",
"\n",
"}",
"\n\n",
"t",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"defer",
"t",
".",
"m",
".",
"Unlock",
"(",
")",
"\n\n",
"t",
".",
"<mask>",
"=",
"append",
"(",
"t",
".",
"options",
",",
"v",
"...",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,740 | all-7741 | [
"mapCdrom",
"takes",
"a",
"CdromSubresource",
"and",
"attaches",
"either",
"a",
"client",
"device",
"or",
"a",
"datastore",
"ISO",
"."
] | [
"func",
"(",
"r",
"*",
"CdromSubresource",
")",
"mapCdrom",
"(",
"<mask>",
"*",
"types",
".",
"VirtualCdrom",
",",
"l",
"object",
".",
"VirtualDeviceList",
")",
"error",
"{",
"dsID",
":=",
"r",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
"\n",
"path",
":=",
"r",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
"\n",
"clientDevice",
":=",
"r",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"bool",
")",
"\n",
"switch",
"{",
"case",
"dsID",
"!=",
"\"",
"\"",
"&&",
"path",
"!=",
"\"",
"\"",
":",
"// If the datastore ID and path are both set, the CDROM will be mapped to a file on a datastore.",
"ds",
",",
"err",
":=",
"datastore",
".",
"FromID",
"(",
"r",
".",
"client",
",",
"dsID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"dsProps",
",",
"err",
":=",
"datastore",
".",
"Properties",
"(",
"ds",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"dsName",
":=",
"dsProps",
".",
"Name",
"\n",
"dsPath",
":=",
"&",
"object",
".",
"DatastorePath",
"{",
"Datastore",
":",
"dsName",
",",
"Path",
":",
"path",
",",
"}",
"\n",
"device",
"=",
"l",
".",
"InsertIso",
"(",
"device",
",",
"dsPath",
".",
"String",
"(",
")",
")",
"\n",
"l",
".",
"Connect",
"(",
"device",
")",
"\n",
"return",
"nil",
"\n",
"case",
"clientDevice",
"==",
"true",
":",
"// If set to use the client device, then the CDROM will be mapped to a remote device.",
"device",
".",
"Backing",
"=",
"&",
"types",
".",
"VirtualCdromRemoteAtapiBackingInfo",
"{",
"VirtualDeviceRemoteDeviceBackingInfo",
":",
"types",
".",
"VirtualDeviceRemoteDeviceBackingInfo",
"{",
"}",
",",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"r",
")",
")",
"\n",
"}"
] |
7,741 | all-7742 | [
"SetIconFromStock",
"is",
"a",
"wrapper",
"around",
"gtk_entry_set_icon_from_stock",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetIconFromStock",
"(",
"iconPos",
"EntryIconPosition",
",",
"stockID",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"stockID",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_entry_set_icon_from_stock",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkEntryIconPosition",
"(",
"iconPos",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
7,742 | all-7743 | [
"sendSamples",
"to",
"the",
"remote",
"storage",
"with",
"backoff",
"for",
"recoverable",
"errors",
"."
] | [
"func",
"(",
"s",
"*",
"shards",
")",
"sendSamplesWithBackoff",
"(",
"ctx",
"context",
".",
"Context",
",",
"samples",
"[",
"]",
"prompb",
".",
"TimeSeries",
")",
"error",
"{",
"backoff",
":=",
"s",
".",
"qm",
".",
"cfg",
".",
"MinBackoff",
"\n",
"req",
",",
"highest",
",",
"err",
":=",
"buildWriteRequest",
"(",
"samples",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// Failing to build the write request is non-recoverable, since it will",
"// only error if marshaling the proto to bytes fails.",
"return",
"err",
"\n",
"}",
"\n\n",
"for",
"{",
"select",
"{",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"ctx",
".",
"Err",
"(",
")",
"\n",
"default",
":",
"}",
"\n",
"begin",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"err",
":=",
"s",
".",
"qm",
".",
"client",
".",
"Store",
"(",
"ctx",
",",
"req",
")",
"\n\n",
"s",
".",
"qm",
".",
"sentBatchDuration",
".",
"Observe",
"(",
"time",
".",
"Since",
"(",
"begin",
")",
".",
"Seconds",
"(",
")",
")",
"\n\n",
"if",
"err",
"==",
"nil",
"{",
"s",
".",
"qm",
".",
"succeededSamplesTotal",
".",
"Add",
"(",
"float64",
"(",
"len",
"(",
"samples",
")",
")",
")",
"\n",
"s",
".",
"qm",
".",
"highestSentTimestampMetric",
".",
"Set",
"(",
"float64",
"(",
"highest",
"/",
"1000",
")",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"err",
".",
"(",
"recoverableError",
")",
";",
"!",
"ok",
"{",
"return",
"err",
"\n",
"}",
"\n",
"s",
".",
"qm",
".",
"retriedSamplesTotal",
".",
"Add",
"(",
"float64",
"(",
"len",
"(",
"samples",
")",
")",
")",
"\n",
"level",
".",
"Debug",
"(",
"s",
".",
"qm",
".",
"logger",
")",
".",
"Log",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
")",
"\n\n",
"<mask>",
".",
"Sleep",
"(",
"time",
".",
"Duration",
"(",
"backoff",
")",
")",
"\n",
"backoff",
"=",
"backoff",
"*",
"2",
"\n",
"if",
"backoff",
">",
"s",
".",
"qm",
".",
"cfg",
".",
"MaxBackoff",
"{",
"backoff",
"=",
"s",
".",
"qm",
".",
"cfg",
".",
"MaxBackoff",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
7,743 | all-7744 | [
"InitServiceEnv",
"initializes",
"this",
"service",
"environment",
".",
"This",
"dials",
"a",
"GRPC",
"connection",
"to",
"pachd",
"and",
"etcd",
"(",
"in",
"a",
"background",
"goroutine",
")",
"and",
"creates",
"the",
"template",
"pachClient",
"used",
"by",
"future",
"calls",
"to",
"GetPachClient",
".",
"This",
"call",
"returns",
"immediately",
"but",
"GetPachClient",
"and",
"GetEtcdClient",
"block",
"until",
"their",
"respective",
"clients",
"are",
"ready",
"."
] | [
"func",
"InitServiceEnv",
"(",
"config",
"*",
"Configuration",
")",
"*",
"ServiceEnv",
"{",
"env",
":=",
"InitPachOnlyEnv",
"(",
"config",
")",
"\n",
"env",
".",
"etcdAddress",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"JoinHostPort",
"(",
"env",
".",
"EtcdHost",
",",
"env",
".",
"EtcdPort",
")",
")",
"\n",
"env",
".",
"etcdEg",
".",
"Go",
"(",
"env",
".",
"initEtcdClient",
")",
"\n",
"return",
"env",
"// env is not ready yet",
"\n",
"}"
] |
7,744 | all-7745 | [
"importKeysFromBytes",
"imports",
"public",
"keys",
"from",
"the",
"supplied",
"blob",
"and",
"returns",
"their",
"identities",
".",
"The",
"blob",
"is",
"assumed",
"to",
"have",
"an",
"appropriate",
"format",
"(",
"the",
"caller",
"is",
"expected",
"to",
"know",
"which",
"one",
")",
".",
"NOTE",
":",
"This",
"may",
"modify",
"long",
"-",
"term",
"state",
"(",
"e",
".",
"g",
".",
"key",
"storage",
"in",
"a",
"directory",
"underlying",
"the",
"mechanism",
")",
";",
"but",
"we",
"do",
"not",
"make",
"this",
"public",
"it",
"can",
"only",
"be",
"used",
"through",
"newEphemeralGPGSigningMechanism",
"."
] | [
"func",
"(",
"m",
"*",
"gpgmeSigningMechanism",
")",
"importKeysFromBytes",
"(",
"blob",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"inputData",
",",
"err",
":=",
"gpgme",
".",
"NewDataBytes",
"(",
"blob",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"res",
",",
"err",
":=",
"m",
".",
"ctx",
".",
"Import",
"(",
"inputData",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"keyIdentities",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"i",
":=",
"range",
"res",
".",
"Imports",
"{",
"if",
"i",
".",
"Result",
"==",
"nil",
"{",
"keyIdentities",
"=",
"<mask>",
"(",
"keyIdentities",
",",
"i",
".",
"Fingerprint",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"keyIdentities",
",",
"nil",
"\n",
"}"
] |
7,745 | all-7746 | [
"SetSkipPagerHint",
"is",
"a",
"wrapper",
"around",
"gtk_window_set_skip_pager_hint",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Window",
")",
"SetSkipPagerHint",
"(",
"setting",
"bool",
")",
"{",
"C",
".",
"gtk_window_set_skip_pager_hint",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
7,746 | all-7747 | [
"SetIntValue",
"creates",
"a",
"Set",
"query",
"."
] | [
"func",
"(",
"f",
"*",
"Field",
")",
"SetIntValue",
"(",
"colIDOrKey",
"interface",
"{",
"}",
",",
"value",
"int",
")",
"*",
"PQLBaseQuery",
"{",
"colStr",
",",
"err",
":=",
"formatIDKey",
"(",
"colIDOrKey",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"NewPQLBaseQuery",
"(",
"\"",
"\"",
",",
"f",
".",
"<mask>",
",",
"err",
")",
"\n",
"}",
"\n",
"q",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"colStr",
",",
"f",
".",
"name",
",",
"value",
")",
"\n",
"return",
"NewPQLBaseQuery",
"(",
"q",
",",
"f",
".",
"index",
",",
"nil",
")",
"\n",
"}"
] |
7,747 | all-7748 | [
"AddText",
"appends",
"a",
"text",
"to",
"the",
"end",
"of",
"the",
"control",
"content",
".",
"View",
"position",
"may",
"be",
"changed",
"automatically",
"depending",
"on",
"value",
"of",
"AutoScroll"
] | [
"func",
"(",
"l",
"*",
"TextView",
")",
"AddText",
"(",
"text",
"[",
"]",
"string",
")",
"{",
"l",
".",
"<mask>",
"=",
"append",
"(",
"l",
".",
"lines",
",",
"text",
"...",
")",
"\n",
"l",
".",
"applyLimit",
"(",
")",
"\n",
"l",
".",
"calculateVirtualSize",
"(",
")",
"\n\n",
"if",
"l",
".",
"autoscroll",
"{",
"l",
".",
"end",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
7,748 | all-7749 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"ClearParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomstorage11",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
7,749 | all-7750 | [
"makeRequest",
"renders",
"a",
"branch",
"protection",
"policy",
"into",
"the",
"corresponding",
"GitHub",
"api",
"request",
"."
] | [
"func",
"makeRequest",
"(",
"policy",
"branchprotection",
".",
"<mask>",
")",
"github",
".",
"BranchProtectionRequest",
"{",
"return",
"github",
".",
"BranchProtectionRequest",
"{",
"EnforceAdmins",
":",
"makeAdmins",
"(",
"policy",
".",
"Admins",
")",
",",
"RequiredPullRequestReviews",
":",
"makeReviews",
"(",
"policy",
".",
"RequiredPullRequestReviews",
")",
",",
"RequiredStatusChecks",
":",
"makeChecks",
"(",
"policy",
".",
"RequiredStatusChecks",
")",
",",
"Restrictions",
":",
"makeRestrictions",
"(",
"policy",
".",
"Restrictions",
")",
",",
"}",
"\n\n",
"}"
] |
7,750 | all-7751 | [
"Send",
"sends",
"the",
"kick",
"request",
"."
] | [
"func",
"(",
"kr",
"*",
"OutgoingKickChatMember",
")",
"Send",
"(",
")",
"error",
"{",
"resp",
":=",
"&",
"baseResponse",
"{",
"}",
"\n",
"_",
",",
"err",
":=",
"kr",
".",
"api",
".",
"c",
".",
"postJSON",
"(",
"kickChatMember",
",",
"resp",
",",
"kr",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"(",
"resp",
")",
"\n",
"}"
] |
7,751 | all-7752 | [
"RemoveActionWidget",
"is",
"a",
"wrapper",
"around",
"gtk_assistant_remove_action_widget",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Assistant",
")",
"RemoveActionWidget",
"(",
"child",
"IWidget",
")",
"{",
"C",
".",
"gtk_assistant_remove_action_widget",
"(",
"v",
".",
"native",
"(",
")",
",",
"<mask>",
".",
"toWidget",
"(",
")",
")",
"\n",
"}"
] |
7,752 | all-7753 | [
"ReadUint8",
"returns",
"a",
"uint8",
"read",
"from",
"address",
"a",
"of",
"the",
"inferior",
"."
] | [
"func",
"(",
"p",
"*",
"Process",
")",
"ReadUint8",
"(",
"a",
"Address",
")",
"uint8",
"{",
"m",
":=",
"p",
".",
"findMapping",
"(",
"a",
")",
"\n",
"if",
"m",
"==",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"a",
")",
")",
"\n",
"}",
"\n",
"return",
"m",
".",
"contents",
"[",
"a",
".",
"Sub",
"(",
"m",
".",
"<mask>",
")",
"]",
"\n",
"}"
] |
7,753 | all-7754 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetPressureNotificationsSuppressedParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoMemory3",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
7,754 | all-7755 | [
"Includes",
"returns",
"true",
"if",
"a",
"list",
"of",
"strings",
"includes",
"another",
"list",
"of",
"strings",
"."
] | [
"func",
"Includes",
"(",
"all",
",",
"subset",
"[",
"]",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"item",
":=",
"range",
"subset",
"{",
"if",
"!",
"Contains",
"(",
"all",
",",
"item",
")",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"true",
"\n",
"}"
] |
7,755 | all-7756 | [
"IsPrivate",
"determines",
"whether",
"a",
"passed",
"IP",
"address",
"is",
"from",
"one",
"of",
"private",
"blocks",
"or",
"not",
"."
] | [
"func",
"IsPrivate",
"(",
"ip",
"net",
".",
"IP",
")",
"bool",
"{",
"for",
"_",
",",
"ipnet",
":=",
"range",
"privateNets",
"{",
"if",
"ipnet",
".",
"Contains",
"(",
"<mask>",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
7,756 | all-7757 | [
"newRestSession",
"connects",
"to",
"the",
"vSphere",
"REST",
"API",
"endpoint",
"necessary",
"for",
"tags",
"."
] | [
"func",
"newRestSession",
"(",
"ctx",
"context",
".",
"Context",
",",
"u",
"*",
"url",
".",
"URL",
",",
"insecure",
"bool",
")",
"(",
"*",
"<mask>",
".",
"RestClient",
",",
"error",
")",
"{",
"logger",
".",
"Printf",
"(",
"\"",
"\"",
",",
"u",
".",
"Host",
")",
"\n",
"client",
":=",
"tags",
".",
"NewClient",
"(",
"u",
",",
"insecure",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
":=",
"client",
".",
"Login",
"(",
"ctx",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"logger",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"return",
"client",
",",
"nil",
"\n",
"}"
] |
7,757 | all-7758 | [
"ScanASTBody",
"creates",
"a",
"File",
"wrapped",
"around",
"the",
"given",
"syntax",
"tree",
".",
"It",
"will",
"also",
"scan",
"the",
"AST",
"for",
"a",
"function",
"matching",
"the",
"given",
"defName",
"and",
"if",
"the",
"function",
"does",
"not",
"exist",
"it",
"will",
"create",
"a",
"new",
"one",
"and",
"mark",
"it",
"to",
"be",
"added",
"to",
"the",
"File",
"the",
"next",
"time",
"Sync",
"is",
"called",
"."
] | [
"func",
"ScanASTBody",
"(",
"pkg",
",",
"defName",
"string",
",",
"bzlFile",
"*",
"bzl",
".",
"File",
")",
"*",
"File",
"{",
"f",
":=",
"&",
"File",
"{",
"File",
":",
"bzlFile",
",",
"Pkg",
":",
"pkg",
",",
"Path",
":",
"bzlFile",
".",
"Path",
",",
"}",
"\n",
"var",
"defStmt",
"*",
"bzl",
".",
"DefStmt",
"\n",
"f",
".",
"Rules",
",",
"f",
".",
"Loads",
",",
"defStmt",
"=",
"scanExprs",
"(",
"defName",
",",
"bzlFile",
".",
"Stmt",
")",
"\n",
"if",
"defStmt",
"!=",
"nil",
"{",
"f",
".",
"Rules",
",",
"_",
",",
"_",
"=",
"scanExprs",
"(",
"\"",
"\"",
",",
"defStmt",
".",
"Body",
")",
"\n",
"f",
".",
"function",
"=",
"&",
"function",
"{",
"stmt",
":",
"defStmt",
",",
"inserted",
":",
"true",
",",
"}",
"\n",
"if",
"len",
"(",
"defStmt",
".",
"Body",
")",
"==",
"1",
"{",
"if",
"v",
",",
"ok",
":=",
"defStmt",
".",
"Body",
"[",
"0",
"]",
".",
"(",
"*",
"bzl",
".",
"BranchStmt",
")",
";",
"ok",
"&&",
"v",
".",
"Token",
"==",
"\"",
"\"",
"{",
"f",
".",
"function",
".",
"hasPass",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"else",
"if",
"defName",
"!=",
"\"",
"\"",
"{",
"f",
".",
"function",
"=",
"&",
"<mask>",
"{",
"stmt",
":",
"&",
"bzl",
".",
"DefStmt",
"{",
"Name",
":",
"defName",
"}",
",",
"inserted",
":",
"false",
",",
"}",
"\n",
"}",
"\n",
"f",
".",
"Directives",
"=",
"ParseDirectives",
"(",
"bzlFile",
")",
"\n",
"return",
"f",
"\n",
"}"
] |
7,758 | all-7759 | [
"Compact",
"invalidate",
"all",
"caching",
"response",
"before",
"the",
"given",
"rev",
".",
"Replace",
"with",
"the",
"invalidation",
"is",
"lazy",
".",
"The",
"actual",
"removal",
"happens",
"when",
"the",
"entries",
"is",
"accessed",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"Compact",
"(",
"revision",
"int64",
")",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"revision",
">",
"c",
".",
"compactedRev",
"{",
"c",
".",
"compactedRev",
"=",
"revision",
"\n",
"}",
"\n",
"}"
] |
7,759 | all-7760 | [
"OpDelete",
"returns",
"delete",
"operation",
"based",
"on",
"given",
"key",
"and",
"operation",
"options",
"."
] | [
"func",
"OpDelete",
"(",
"<mask>",
"string",
",",
"opts",
"...",
"OpOption",
")",
"Op",
"{",
"// WithPrefix and WithFromKey are not supported together",
"if",
"isWithPrefix",
"(",
"opts",
")",
"&&",
"isWithFromKey",
"(",
"opts",
")",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"ret",
":=",
"Op",
"{",
"t",
":",
"tDeleteRange",
",",
"key",
":",
"[",
"]",
"byte",
"(",
"key",
")",
"}",
"\n",
"ret",
".",
"applyOpts",
"(",
"opts",
")",
"\n",
"switch",
"{",
"case",
"ret",
".",
"leaseID",
"!=",
"0",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"case",
"ret",
".",
"limit",
"!=",
"0",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"case",
"ret",
".",
"rev",
"!=",
"0",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"case",
"ret",
".",
"sort",
"!=",
"nil",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"case",
"ret",
".",
"serializable",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"case",
"ret",
".",
"countOnly",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"case",
"ret",
".",
"minModRev",
"!=",
"0",
",",
"ret",
".",
"maxModRev",
"!=",
"0",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"case",
"ret",
".",
"minCreateRev",
"!=",
"0",
",",
"ret",
".",
"maxCreateRev",
"!=",
"0",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"case",
"ret",
".",
"filterDelete",
",",
"ret",
".",
"filterPut",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"case",
"ret",
".",
"createdNotify",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"ret",
"\n",
"}"
] |
7,760 | all-7761 | [
"Creates",
"a",
"new",
"handler",
"that",
"parses",
"the",
"Accept",
"-",
"Language",
"HTTP",
"header",
".",
"The",
"parsed",
"structure",
"is",
"a",
"slice",
"of",
"Accept",
"-",
"Language",
"values",
"stored",
"in",
"an",
"AcceptLanguages",
"instance",
"sorted",
"based",
"on",
"the",
"language",
"qualifier",
"."
] | [
"func",
"Languages",
"(",
")",
"martini",
".",
"Handler",
"{",
"return",
"func",
"(",
"context",
"martini",
".",
"Context",
",",
"request",
"*",
"http",
".",
"<mask>",
")",
"{",
"header",
":=",
"request",
".",
"Header",
".",
"Get",
"(",
"acceptLanguageHeader",
")",
"\n",
"if",
"header",
"!=",
"\"",
"\"",
"{",
"acceptLanguageHeaderValues",
":=",
"strings",
".",
"Split",
"(",
"header",
",",
"\"",
"\"",
")",
"\n",
"acceptLanguages",
":=",
"make",
"(",
"AcceptLanguages",
",",
"len",
"(",
"acceptLanguageHeaderValues",
")",
")",
"\n\n",
"for",
"i",
",",
"languageRange",
":=",
"range",
"acceptLanguageHeaderValues",
"{",
"// Check if a given range is qualified or not",
"if",
"qualifiedRange",
":=",
"strings",
".",
"Split",
"(",
"languageRange",
",",
"\"",
"\"",
")",
";",
"len",
"(",
"qualifiedRange",
")",
"==",
"2",
"{",
"quality",
",",
"error",
":=",
"strconv",
".",
"ParseFloat",
"(",
"qualifiedRange",
"[",
"1",
"]",
",",
"32",
")",
"\n",
"if",
"error",
"!=",
"nil",
"{",
"// When the quality is unparseable, assume it's 1",
"acceptLanguages",
"[",
"i",
"]",
"=",
"AcceptLanguage",
"{",
"trimLanguage",
"(",
"qualifiedRange",
"[",
"0",
"]",
")",
",",
"1",
"}",
"\n",
"}",
"else",
"{",
"acceptLanguages",
"[",
"i",
"]",
"=",
"AcceptLanguage",
"{",
"trimLanguage",
"(",
"qualifiedRange",
"[",
"0",
"]",
")",
",",
"float32",
"(",
"quality",
")",
"}",
"\n",
"}",
"\n",
"}",
"else",
"{",
"acceptLanguages",
"[",
"i",
"]",
"=",
"AcceptLanguage",
"{",
"trimLanguage",
"(",
"languageRange",
")",
",",
"1",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"sort",
".",
"Sort",
"(",
"acceptLanguages",
")",
"\n",
"context",
".",
"Map",
"(",
"acceptLanguages",
")",
"\n",
"}",
"else",
"{",
"// If we have no Accept-Language header just map an empty slice",
"context",
".",
"Map",
"(",
"make",
"(",
"AcceptLanguages",
",",
"0",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
7,761 | all-7762 | [
"sendMessage",
"sends",
"a",
"standalone",
"message",
"(",
"typically",
"a",
"control",
"message",
")"
] | [
"func",
"(",
"c",
"*",
"Connection",
")",
"sendMessage",
"(",
"msg",
"message",
")",
"error",
"{",
"frame",
":=",
"c",
".",
"opts",
".",
"FramePool",
".",
"Get",
"(",
")",
"\n",
"if",
"err",
":=",
"frame",
".",
"write",
"(",
"msg",
")",
";",
"err",
"!=",
"nil",
"{",
"c",
".",
"opts",
".",
"FramePool",
".",
"Release",
"(",
"frame",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"<mask>",
"{",
"case",
"c",
".",
"sendCh",
"<-",
"frame",
":",
"return",
"nil",
"\n",
"default",
":",
"return",
"ErrSendBufferFull",
"\n",
"}",
"\n",
"}"
] |
7,762 | all-7763 | [
"Set",
"parses",
"the",
"flag",
"value",
"into",
"a",
"CommaSeparatedStrings"
] | [
"func",
"(",
"r",
"*",
"CommaSeparatedStrings",
")",
"Set",
"(",
"<mask>",
"string",
")",
"error",
"{",
"if",
"len",
"(",
"*",
"r",
")",
">",
"0",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"rtype",
":=",
"range",
"strings",
".",
"Split",
"(",
"value",
",",
"\"",
"\"",
")",
"{",
"*",
"r",
"=",
"append",
"(",
"*",
"r",
",",
"rtype",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,763 | all-7764 | [
"Read",
"presents",
"one",
"or",
"more",
"IDAT",
"chunks",
"as",
"one",
"continuous",
"stream",
"(",
"minus",
"the",
"intermediate",
"chunk",
"headers",
"and",
"footers",
")",
".",
"If",
"the",
"PNG",
"data",
"looked",
"like",
":",
"...",
"len0",
"IDAT",
"xxx",
"crc0",
"len1",
"IDAT",
"yy",
"crc1",
"len2",
"IEND",
"crc2",
"then",
"this",
"reader",
"presents",
"xxxyy",
".",
"For",
"well",
"-",
"formed",
"PNG",
"data",
"the",
"decoder",
"state",
"immediately",
"before",
"the",
"first",
"Read",
"call",
"is",
"that",
"d",
".",
"r",
"is",
"positioned",
"between",
"the",
"first",
"IDAT",
"and",
"xxx",
"and",
"the",
"decoder",
"state",
"immediately",
"after",
"the",
"last",
"Read",
"call",
"is",
"that",
"d",
".",
"r",
"is",
"positioned",
"between",
"yy",
"and",
"crc1",
"."
] | [
"func",
"(",
"d",
"*",
"decoder",
")",
"Read",
"(",
"p",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"len",
"(",
"p",
")",
"==",
"0",
"{",
"return",
"0",
",",
"nil",
"\n",
"}",
"\n",
"for",
"d",
".",
"idatLength",
"==",
"0",
"{",
"// We have exhausted an IDAT chunk. Verify the checksum of that chunk.",
"if",
"err",
":=",
"d",
".",
"verifyChecksum",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"// Read the length and chunk type of the next chunk, and check that",
"// it is an IDAT chunk.",
"if",
"_",
",",
"err",
":=",
"<mask>",
".",
"ReadFull",
"(",
"d",
".",
"r",
",",
"d",
".",
"tmp",
"[",
":",
"8",
"]",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"d",
".",
"idatLength",
"=",
"binary",
".",
"BigEndian",
".",
"Uint32",
"(",
"d",
".",
"tmp",
"[",
":",
"4",
"]",
")",
"\n",
"if",
"string",
"(",
"d",
".",
"tmp",
"[",
"4",
":",
"8",
"]",
")",
"!=",
"\"",
"\"",
"{",
"return",
"0",
",",
"FormatError",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"d",
".",
"crc",
".",
"Reset",
"(",
")",
"\n",
"d",
".",
"crc",
".",
"Write",
"(",
"d",
".",
"tmp",
"[",
"4",
":",
"8",
"]",
")",
"\n",
"}",
"\n",
"if",
"int",
"(",
"d",
".",
"idatLength",
")",
"<",
"0",
"{",
"return",
"0",
",",
"UnsupportedError",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"n",
",",
"err",
":=",
"d",
".",
"r",
".",
"Read",
"(",
"p",
"[",
":",
"min",
"(",
"len",
"(",
"p",
")",
",",
"int",
"(",
"d",
".",
"idatLength",
")",
")",
"]",
")",
"\n",
"d",
".",
"crc",
".",
"Write",
"(",
"p",
"[",
":",
"n",
"]",
")",
"\n",
"d",
".",
"idatLength",
"-=",
"uint32",
"(",
"n",
")",
"\n",
"return",
"n",
",",
"err",
"\n",
"}"
] |
7,764 | all-7765 | [
"NotFound",
"sets",
"a",
"custom",
"http",
".",
"HandlerFunc",
"for",
"routing",
"paths",
"that",
"could",
"not",
"be",
"found",
".",
"The",
"default",
"404",
"handler",
"is",
"http",
".",
"NotFound",
"."
] | [
"func",
"(",
"mx",
"*",
"Mux",
")",
"NotFound",
"(",
"handlerFn",
"<mask>",
".",
"HandlerFunc",
")",
"{",
"// Build NotFound handler chain",
"m",
":=",
"mx",
"\n",
"hFn",
":=",
"handlerFn",
"\n",
"if",
"mx",
".",
"inline",
"&&",
"mx",
".",
"parent",
"!=",
"nil",
"{",
"m",
"=",
"mx",
".",
"parent",
"\n",
"hFn",
"=",
"Chain",
"(",
"mx",
".",
"middlewares",
"...",
")",
".",
"HandlerFunc",
"(",
"hFn",
")",
".",
"ServeHTTP",
"\n",
"}",
"\n\n",
"// Update the notFoundHandler from this point forward",
"m",
".",
"notFoundHandler",
"=",
"hFn",
"\n",
"m",
".",
"updateSubRoutes",
"(",
"func",
"(",
"subMux",
"*",
"Mux",
")",
"{",
"if",
"subMux",
".",
"notFoundHandler",
"==",
"nil",
"{",
"subMux",
".",
"NotFound",
"(",
"hFn",
")",
"\n",
"}",
"\n",
"}",
")",
"\n",
"}"
] |
7,765 | all-7766 | [
"Prepend",
"is",
"a",
"wrapper",
"around",
"g_menu_prepend",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Menu",
")",
"Prepend",
"(",
"label",
",",
"detailed_action",
"string",
")",
"{",
"cstr1",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"label",
")",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr1",
")",
")",
"\n\n",
"cstr2",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"detailed_action",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr2",
")",
")",
"\n\n",
"C",
".",
"g_menu_prepend",
"(",
"v",
".",
"native",
"(",
")",
",",
"cstr1",
",",
"cstr2",
")",
"\n",
"}"
] |
7,766 | all-7767 | [
"RenameStoragePoolVolume",
"renames",
"a",
"storage",
"volume"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"RenameStoragePoolVolume",
"(",
"pool",
"string",
",",
"volType",
"string",
",",
"name",
"string",
",",
"volume",
"api",
".",
"StorageVolumePost",
")",
"error",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n",
"path",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"QueryEscape",
"(",
"pool",
")",
",",
"url",
".",
"QueryEscape",
"(",
"volType",
")",
",",
"url",
".",
"QueryEscape",
"(",
"name",
")",
")",
"\n\n",
"// Send the request",
"_",
",",
"_",
",",
"err",
":=",
"r",
".",
"query",
"(",
"\"",
"\"",
",",
"path",
",",
"volume",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
7,767 | all-7768 | [
"NewProwJobInformer",
"constructs",
"a",
"new",
"informer",
"for",
"ProwJob",
"type",
".",
"Always",
"prefer",
"using",
"an",
"informer",
"factory",
"to",
"get",
"a",
"shared",
"informer",
"instead",
"of",
"getting",
"an",
"independent",
"one",
".",
"This",
"reduces",
"memory",
"footprint",
"and",
"number",
"of",
"connections",
"to",
"the",
"server",
"."
] | [
"func",
"NewProwJobInformer",
"(",
"client",
"versioned",
".",
"Interface",
",",
"namespace",
"string",
",",
"resyncPeriod",
"time",
".",
"Duration",
",",
"indexers",
"<mask>",
".",
"Indexers",
")",
"cache",
".",
"SharedIndexInformer",
"{",
"return",
"NewFilteredProwJobInformer",
"(",
"client",
",",
"namespace",
",",
"resyncPeriod",
",",
"indexers",
",",
"nil",
")",
"\n",
"}"
] |
7,768 | all-7769 | [
"GetIP",
"returns",
"the",
"IP",
"address",
"of",
"the",
"GCE",
"instance",
"."
] | [
"func",
"(",
"d",
"*",
"Driver",
")",
"GetIP",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"c",
",",
"err",
":=",
"newComputeUtil",
"(",
"d",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"ip",
",",
"err",
":=",
"c",
".",
"<mask>",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"if",
"ip",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"drivers",
".",
"ErrHostIsNotRunning",
"\n",
"}",
"\n\n",
"return",
"ip",
",",
"nil",
"\n",
"}"
] |
7,769 | all-7770 | [
"specify",
"clear",
"values",
"for",
"the",
"color",
"buffers"
] | [
"func",
"ClearColor",
"(",
"<mask>",
"float32",
",",
"green",
"float32",
",",
"blue",
"float32",
",",
"alpha",
"float32",
")",
"{",
"C",
".",
"glowClearColor",
"(",
"gpClearColor",
",",
"(",
"C",
".",
"GLfloat",
")",
"(",
"red",
")",
",",
"(",
"C",
".",
"GLfloat",
")",
"(",
"green",
")",
",",
"(",
"C",
".",
"GLfloat",
")",
"(",
"blue",
")",
",",
"(",
"C",
".",
"GLfloat",
")",
"(",
"alpha",
")",
")",
"\n",
"}"
] |
7,770 | all-7771 | [
"AddWithOpts",
"adds",
"a",
"file",
"to",
"ipfs",
"with",
"some",
"additional",
"options",
"Deprecated",
":",
"Use",
"Add",
"()",
"with",
"option",
"functions",
"instead"
] | [
"func",
"(",
"s",
"*",
"Shell",
")",
"AddWithOpts",
"(",
"r",
"<mask>",
".",
"Reader",
",",
"pin",
"bool",
",",
"rawLeaves",
"bool",
")",
"(",
"string",
",",
"error",
")",
"{",
"return",
"s",
".",
"Add",
"(",
"r",
",",
"Pin",
"(",
"pin",
")",
",",
"RawLeaves",
"(",
"rawLeaves",
")",
")",
"\n",
"}"
] |
7,771 | all-7772 | [
"GetStock",
"is",
"a",
"wrapper",
"around",
"gtk_status_icon_get_stock",
"()",
"Deprecated",
"since",
"3",
".",
"10",
"use",
"GetIconName",
"(",
"gtk_status_icon_get_icon_name",
")",
"instead"
] | [
"func",
"(",
"v",
"*",
"StatusIcon",
")",
"GetStock",
"(",
")",
"string",
"{",
"c",
":=",
"C",
".",
"gtk_status_icon_get_stock",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"c",
")",
")",
"\n",
"}"
] |
7,772 | all-7773 | [
"RateScale",
"fetches",
"an",
"instrument",
"from",
"the",
"registry",
"or",
"creates",
"a",
"new",
"one",
"with",
"a",
"custom",
"scale",
".",
"If",
"another",
"instrument",
"type",
"is",
"already",
"registered",
"with",
"the",
"same",
"name",
"/",
"tags",
"a",
"blank",
"one",
"will",
"be",
"returned",
"and",
"an",
"error",
"will",
"be",
"logged",
"to",
"the",
"Errors",
"()",
"channel",
"."
] | [
"func",
"(",
"r",
"*",
"Registry",
")",
"RateScale",
"(",
"name",
"string",
",",
"<mask>",
"[",
"]",
"string",
",",
"d",
"time",
".",
"Duration",
")",
"*",
"Rate",
"{",
"factory",
":=",
"func",
"(",
")",
"interface",
"{",
"}",
"{",
"return",
"NewRateScale",
"(",
"d",
")",
"}",
"\n",
"return",
"r",
".",
"fetchRate",
"(",
"name",
",",
"tags",
",",
"factory",
")",
"\n",
"}"
] |
7,773 | all-7774 | [
"Do",
"executes",
"Target",
".",
"createBrowserContext",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"browserContextID",
"-",
"The",
"id",
"of",
"the",
"context",
"created",
"."
] | [
"func",
"(",
"p",
"*",
"CreateBrowserContextParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"browserContextID",
"BrowserContextID",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"CreateBrowserContextReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandCreateBrowserContext",
",",
"nil",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"BrowserContextID",
",",
"nil",
"\n",
"}"
] |
7,774 | all-7775 | [
"DetachVolume",
"detaches",
"a",
"volume"
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"DetachVolume",
"(",
"dcid",
",",
"srvid",
",",
"volid",
"string",
")",
"(",
"*",
"http",
".",
"Header",
",",
"error",
")",
"{",
"url",
":=",
"serverVolumePath",
"(",
"dcid",
",",
"srvid",
",",
"volid",
")",
"\n",
"ret",
":=",
"&",
"http",
".",
"Header",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Delete",
"(",
"url",
",",
"ret",
",",
"http",
".",
"StatusAccepted",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
7,775 | all-7776 | [
"Do",
"executes",
"Network",
".",
"replayXHR",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"ReplayXHRParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandReplayXHR",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
7,776 | all-7777 | [
"OnKeyDown",
"sets",
"the",
"callback",
"that",
"is",
"called",
"when",
"a",
"user",
"presses",
"a",
"key",
"while",
"the",
"Window",
"is",
"active"
] | [
"func",
"(",
"w",
"*",
"Window",
")",
"OnKeyDown",
"(",
"fn",
"func",
"(",
"Event",
",",
"interface",
"{",
"}",
")",
"bool",
",",
"<mask>",
"interface",
"{",
"}",
")",
"{",
"if",
"fn",
"==",
"nil",
"{",
"w",
".",
"onKeyDown",
"=",
"nil",
"\n",
"}",
"else",
"{",
"w",
".",
"onKeyDown",
"=",
"&",
"keyDownCb",
"{",
"data",
":",
"data",
",",
"fn",
":",
"fn",
"}",
"\n",
"}",
"\n",
"}"
] |
7,777 | all-7778 | [
"GetVisibleChild",
"is",
"a",
"wrapper",
"around",
"gtk_stack_get_visible_child",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Stack",
")",
"GetVisibleChild",
"(",
")",
"*",
"Widget",
"{",
"c",
":=",
"C",
".",
"gtk_stack_get_visible_child",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"<mask>",
"wrapWidget",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
"\n",
"}"
] |
7,778 | all-7779 | [
"Process",
"is",
"the",
"main",
"Entrypoint"
] | [
"func",
"(",
"a",
"*",
"Auth",
")",
"<mask>",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"error",
"{",
"if",
"err",
":=",
"a",
".",
"ValidateRequest",
"(",
"r",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Validate OU",
"if",
"len",
"(",
"a",
".",
"opt",
".",
"AllowedOUs",
")",
">",
"0",
"{",
"err",
":=",
"a",
".",
"ValidateOU",
"(",
"r",
".",
"TLS",
".",
"VerifiedChains",
"[",
"0",
"]",
"[",
"0",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"a",
".",
"authErrHandler",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Validate CN",
"if",
"len",
"(",
"a",
".",
"opt",
".",
"AllowedCNs",
")",
">",
"0",
"{",
"err",
":=",
"a",
".",
"ValidateCN",
"(",
"r",
".",
"TLS",
".",
"VerifiedChains",
"[",
"0",
"]",
"[",
"0",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"a",
".",
"authErrHandler",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,779 | all-7780 | [
"Used",
"to",
"update",
"the",
"cluster",
"after",
"a",
"database",
"node",
"has",
"been",
"removed",
"and",
"possibly",
"promote",
"another",
"one",
"as",
"database",
"node",
"."
] | [
"func",
"internalClusterPostRebalance",
"(",
"d",
"*",
"Daemon",
",",
"r",
"*",
"http",
".",
"Request",
")",
"Response",
"{",
"// Redirect all requests to the leader, which is the one with with",
"// up-to-date knowledge of what nodes are part of the raft cluster.",
"localAddress",
",",
"err",
":=",
"node",
".",
"ClusterAddress",
"(",
"d",
".",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n",
"leader",
",",
"err",
":=",
"d",
".",
"gateway",
".",
"LeaderAddress",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"InternalError",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"localAddress",
"!=",
"leader",
"{",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"leader",
")",
"\n",
"url",
":=",
"&",
"url",
".",
"URL",
"{",
"Scheme",
":",
"\"",
"\"",
",",
"Path",
":",
"\"",
"\"",
",",
"Host",
":",
"leader",
",",
"}",
"\n",
"return",
"SyncResponseRedirect",
"(",
"url",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n\n",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
")",
"\n\n",
"// Check if we have a spare node to promote.",
"address",
",",
"nodes",
",",
"err",
":=",
"cluster",
".",
"Rebalance",
"(",
"d",
".",
"State",
"(",
")",
",",
"d",
".",
"gateway",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"address",
"==",
"\"",
"\"",
"{",
"return",
"SyncResponse",
"(",
"true",
",",
"nil",
")",
"// Nothing to change",
"\n",
"}",
"\n\n",
"// Tell the node to promote itself.",
"post",
":=",
"&",
"internalClusterPostPromoteRequest",
"{",
"}",
"\n",
"for",
"_",
",",
"node",
":=",
"range",
"nodes",
"{",
"post",
".",
"RaftNodes",
"=",
"append",
"(",
"post",
".",
"RaftNodes",
",",
"internalRaftNode",
"{",
"ID",
":",
"node",
".",
"ID",
",",
"Address",
":",
"node",
".",
"Address",
",",
"}",
")",
"\n",
"}",
"\n\n",
"cert",
":=",
"d",
".",
"endpoints",
".",
"NetworkCert",
"(",
")",
"\n",
"client",
",",
"err",
":=",
"cluster",
".",
"Connect",
"(",
"address",
",",
"cert",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n",
"_",
",",
"_",
",",
"err",
"=",
"client",
".",
"RawQuery",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"post",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"SyncResponse",
"(",
"true",
",",
"nil",
")",
"\n",
"}"
] |
7,780 | all-7781 | [
"Do",
"executes",
"Network",
".",
"setCookie",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"success",
"-",
"True",
"if",
"successfully",
"set",
"cookie",
"."
] | [
"func",
"(",
"p",
"*",
"SetCookieParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"success",
"bool",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"SetCookieReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetCookie",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"<mask>",
".",
"Success",
",",
"nil",
"\n",
"}"
] |
7,781 | all-7782 | [
"GetEmail",
"returns",
"the",
"Email",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsUser",
")",
"GetEmail",
"(",
")",
"string",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Email",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"<mask>",
"*",
"s",
".",
"Email",
"\n",
"}"
] |
7,782 | all-7783 | [
"Mode",
"returns",
"an",
"os",
".",
"FileMode",
"for",
"the",
"file",
"calculated",
"from",
"the",
"Attributes",
"field",
"."
] | [
"func",
"(",
"f",
"*",
"FileHeader",
")",
"Mode",
"(",
")",
"os",
".",
"FileMode",
"{",
"var",
"m",
"os",
".",
"FileMode",
"\n\n",
"if",
"f",
".",
"IsDir",
"{",
"m",
"=",
"os",
".",
"ModeDir",
"\n",
"}",
"\n",
"if",
"f",
".",
"HostOS",
"==",
"HostOSWindows",
"{",
"if",
"f",
".",
"IsDir",
"{",
"m",
"|=",
"0777",
"\n",
"}",
"else",
"if",
"f",
".",
"Attributes",
"&",
"1",
">",
"0",
"{",
"m",
"|=",
"0444",
"// readonly",
"\n",
"}",
"else",
"{",
"m",
"|=",
"0666",
"\n",
"}",
"\n",
"return",
"m",
"\n",
"}",
"\n",
"// assume unix perms for all remaining os types",
"m",
"|=",
"os",
".",
"FileMode",
"(",
"f",
".",
"Attributes",
")",
"&",
"os",
".",
"ModePerm",
"\n\n",
"// only check other bits on unix host created archives",
"if",
"f",
".",
"HostOS",
"!=",
"HostOSUnix",
"{",
"return",
"m",
"\n",
"}",
"\n\n",
"if",
"f",
".",
"Attributes",
"&",
"0x200",
"!=",
"0",
"{",
"m",
"|=",
"os",
".",
"ModeSticky",
"\n",
"}",
"\n",
"if",
"f",
".",
"Attributes",
"&",
"0x400",
"!=",
"0",
"{",
"m",
"|=",
"os",
".",
"ModeSetgid",
"\n",
"}",
"\n",
"if",
"f",
".",
"Attributes",
"&",
"0x800",
"!=",
"0",
"{",
"m",
"|=",
"<mask>",
".",
"ModeSetuid",
"\n",
"}",
"\n\n",
"// Check for additional file types.",
"if",
"f",
".",
"Attributes",
"&",
"0xF000",
"==",
"0xA000",
"{",
"m",
"|=",
"os",
".",
"ModeSymlink",
"\n",
"}",
"\n",
"return",
"m",
"\n",
"}"
] |
7,783 | all-7784 | [
"RunCommand",
"parses",
"and",
"runs",
"the",
"command",
"with",
"the",
"given",
"name",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"RunCommand",
"(",
"cmd",
"string",
")",
"(",
"*",
"http",
".",
"<mask>",
",",
"error",
")",
"{",
"c",
",",
"err",
":=",
"a",
".",
"ParseCommand",
"(",
"cmd",
",",
"\"",
"\"",
",",
"commandValues",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"req",
",",
"err",
":=",
"a",
".",
"BuildHTTPRequest",
"(",
"c",
".",
"HTTPMethod",
",",
"c",
".",
"URI",
",",
"\"",
"\"",
",",
"c",
".",
"QueryParams",
",",
"c",
".",
"PayloadParams",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"a",
".",
"PerformRequest",
"(",
"req",
")",
"\n",
"}"
] |
7,784 | all-7785 | [
"Run",
"starts",
"the",
"Pool",
"by",
"launching",
"the",
"workers",
".",
"It",
"s",
"OK",
"to",
"start",
"an",
"empty",
"Pool",
".",
"The",
"jobs",
"will",
"be",
"fed",
"to",
"the",
"workers",
"as",
"soon",
"as",
"they",
"become",
"available",
"."
] | [
"func",
"(",
"pool",
"*",
"Pool",
")",
"Run",
"(",
")",
"{",
"if",
"pool",
".",
"workers_started",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"for",
"i",
":=",
"uint",
"(",
"0",
")",
";",
"i",
"<",
"uint",
"(",
"pool",
".",
"num_workers",
")",
";",
"i",
"++",
"{",
"pool",
".",
"worker_wg",
".",
"Add",
"(",
"1",
")",
"\n",
"go",
"pool",
".",
"<mask>",
"(",
"i",
")",
"\n",
"}",
"\n",
"pool",
".",
"workers_started",
"=",
"true",
"\n",
"// handle the supervisor",
"if",
"!",
"pool",
".",
"supervisor_started",
"{",
"pool",
".",
"startSupervisor",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
7,785 | all-7786 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SetDeviceOrientationOverrideParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDeviceorientation",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
7,786 | all-7787 | [
"flattenStorageDrsOptionSpec",
"saves",
"a",
"StorageDrsOptionSpec",
"into",
"the",
"supplied",
"ResourceData",
"."
] | [
"func",
"flattenStorageDrsOptionSpec",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"opts",
"[",
"]",
"types",
".",
"BaseOptionValue",
")",
"error",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"opts",
"{",
"m",
"[",
"opt",
".",
"GetOptionValue",
"(",
")",
".",
"Key",
"]",
"=",
"opt",
".",
"GetOptionValue",
"(",
")",
".",
"Value",
"\n",
"}",
"\n\n",
"return",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"m",
")",
"\n",
"}"
] |
7,787 | all-7788 | [
"GetRequiredASMResources",
"returns",
"the",
"list",
"of",
"ASMAuthData",
"that",
"has",
"to",
"be",
"retrieved",
"from",
"AWS",
"Secrets",
"Manager"
] | [
"func",
"(",
"auth",
"*",
"ASMAuthResource",
")",
"GetRequiredASMResources",
"(",
")",
"[",
"]",
"*",
"apicontainer",
".",
"ASMAuthData",
"{",
"auth",
".",
"<mask>",
".",
"RLock",
"(",
")",
"\n",
"defer",
"auth",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"auth",
".",
"requiredASMResources",
"\n",
"}"
] |
7,788 | all-7789 | [
"GoToLuaProxy",
"is",
"like",
"GoToLua",
"but",
"pushes",
"a",
"proxy",
"on",
"the",
"Lua",
"stack",
"when",
"it",
"makes",
"sense",
".",
"A",
"proxy",
"is",
"a",
"Lua",
"userdata",
"that",
"wraps",
"a",
"Go",
"value",
".",
"Proxies",
"have",
"several",
"uses",
":",
"-",
"Type",
"checking",
"in",
"Go",
"function",
"calls",
"so",
"variable",
"of",
"user",
"-",
"defined",
"type",
"are",
"always",
"profixied",
".",
"-",
"Reflexive",
"modification",
"of",
"the",
"Go",
"data",
"straight",
"from",
"the",
"Lua",
"code",
".",
"We",
"only",
"allow",
"this",
"for",
"compound",
"types",
".",
"-",
"Call",
"methods",
"of",
"user",
"-",
"defined",
"types",
".",
"Predeclared",
"scalar",
"types",
"are",
"never",
"proxified",
"as",
"they",
"have",
"no",
"methods",
"and",
"we",
"only",
"allow",
"compound",
"types",
"to",
"be",
"set",
"reflexively",
".",
"Structs",
"are",
"always",
"proxified",
"since",
"their",
"type",
"is",
"always",
"user",
"-",
"defined",
".",
"If",
"they",
"they",
"are",
"not",
"settable",
"(",
"e",
".",
"g",
".",
"not",
"nested",
"not",
"passed",
"by",
"reference",
"value",
"of",
"a",
"map",
")",
"then",
"a",
"copy",
"is",
"passed",
"as",
"a",
"proxy",
"(",
"otherwise",
"setting",
"the",
"fields",
"from",
"Lua",
"would",
"panic",
")",
".",
"This",
"will",
"not",
"impact",
"the",
"corresponding",
"Go",
"value",
".",
"Arrays",
"are",
"only",
"proxified",
"if",
"they",
"are",
"settable",
"(",
"so",
"that",
"the",
"user",
"can",
"set",
"the",
"Go",
"value",
"from",
"the",
"Lua",
"side",
")",
"or",
"if",
"they",
"are",
"of",
"a",
"user",
"-",
"defined",
"type",
"(",
"method",
"calls",
"or",
"function",
"parameters",
")",
".",
"If",
"the",
"type",
"user",
"-",
"defined",
"but",
"the",
"array",
"is",
"not",
"settable",
"then",
"a",
"proxy",
"of",
"a",
"copy",
"is",
"made",
"just",
"as",
"for",
"structs",
".",
"Lua",
"cannot",
"dereference",
"pointers",
"and",
"Go",
"can",
"only",
"call",
"methods",
"over",
"one",
"level",
"of",
"indirection",
"at",
"maximum",
".",
"Thus",
"proxies",
"wrap",
"around",
"values",
"dereferenced",
"up",
"to",
"the",
"last",
"pointer",
".",
"Go",
"functions",
"can",
"be",
"passed",
"to",
"Lua",
".",
"If",
"the",
"parameters",
"require",
"several",
"levels",
"of",
"indirections",
"the",
"arguments",
"will",
"be",
"converted",
"automatically",
".",
"Since",
"proxies",
"can",
"only",
"wrap",
"around",
"one",
"level",
"of",
"indirection",
"functions",
"modifying",
"the",
"value",
"of",
"the",
"pointers",
"after",
"one",
"level",
"of",
"indirection",
"will",
"have",
"no",
"effect",
"."
] | [
"func",
"GoToLuaProxy",
"(",
"L",
"*",
"lua",
".",
"State",
",",
"a",
"interface",
"{",
"}",
")",
"{",
"visited",
":=",
"newVisitor",
"(",
"L",
")",
"\n",
"goToLua",
"(",
"L",
",",
"a",
",",
"<mask>",
",",
"visited",
")",
"\n",
"visited",
".",
"close",
"(",
")",
"\n",
"}"
] |
7,789 | all-7790 | [
"Stop",
"is",
"used",
"to",
"stop",
"the",
"de",
"-",
"duplication",
"manager"
] | [
"func",
"(",
"d",
"*",
"DedupManager",
")",
"Stop",
"(",
")",
"error",
"{",
"d",
".",
"stopLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"d",
".",
"stopLock",
".",
"Unlock",
"(",
")",
"\n",
"if",
"d",
".",
"stop",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"d",
".",
"stop",
"=",
"<mask>",
"\n",
"close",
"(",
"d",
".",
"stopCh",
")",
"\n",
"d",
".",
"wg",
".",
"Wait",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
7,790 | all-7791 | [
"Look",
"in",
"given",
"path",
"patterns",
"to",
"chek",
"whether",
"given",
"parameter",
"name",
"corresponds",
"to",
"a",
"variable",
"name",
"."
] | [
"func",
"isPathParam",
"(",
"p",
"string",
",",
"pathPatterns",
"[",
"]",
"*",
"gen",
".",
"PathPattern",
")",
"bool",
"{",
"for",
"_",
",",
"pattern",
":=",
"<mask>",
"pathPatterns",
"{",
"for",
"_",
",",
"v",
":=",
"range",
"pattern",
".",
"Variables",
"{",
"if",
"p",
"==",
"v",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
7,791 | all-7792 | [
"New",
"makes",
"an",
"Error",
"from",
"the",
"given",
"value",
".",
"If",
"that",
"value",
"is",
"already",
"an",
"error",
"then",
"it",
"will",
"be",
"used",
"directly",
"if",
"not",
"it",
"will",
"be",
"passed",
"to",
"fmt",
".",
"Errorf",
"(",
"%v",
")",
".",
"The",
"stacktrace",
"will",
"point",
"to",
"the",
"line",
"of",
"code",
"that",
"called",
"New",
"."
] | [
"func",
"New",
"(",
"e",
"interface",
"{",
"}",
")",
"*",
"Error",
"{",
"var",
"err",
"error",
"\n\n",
"switch",
"e",
":=",
"e",
".",
"(",
"<mask>",
")",
"{",
"case",
"error",
":",
"err",
"=",
"e",
"\n",
"default",
":",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"e",
")",
"\n",
"}",
"\n\n",
"stack",
":=",
"make",
"(",
"[",
"]",
"uintptr",
",",
"MaxStackDepth",
")",
"\n",
"length",
":=",
"runtime",
".",
"Callers",
"(",
"2",
",",
"stack",
"[",
":",
"]",
")",
"\n",
"return",
"&",
"Error",
"{",
"Err",
":",
"err",
",",
"stack",
":",
"stack",
"[",
":",
"length",
"]",
",",
"}",
"\n",
"}"
] |
7,792 | all-7793 | [
"hasDependency",
"returns",
"a",
"boolean",
"value",
"indicating",
"whether",
"the",
"image",
"depends",
"on",
"another",
"image",
"."
] | [
"func",
"(",
"i",
"*",
"Image",
")",
"hasDependency",
"(",
")",
"bool",
"{",
"if",
"i",
".",
"stale",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"len",
"(",
"i",
".",
"drawTrianglesHistory",
")",
">",
"0",
"\n",
"}"
] |
7,793 | all-7794 | [
"onPeerChange",
"is",
"called",
"when",
"there",
"is",
"a",
"change",
"that",
"may",
"cause",
"the",
"peer",
"s",
"score",
"to",
"change",
".",
"The",
"new",
"score",
"is",
"calculated",
"and",
"the",
"peer",
"heap",
"is",
"updated",
"with",
"the",
"new",
"score",
"if",
"the",
"score",
"changes",
"."
] | [
"func",
"(",
"l",
"*",
"PeerList",
")",
"onPeerChange",
"(",
"p",
"*",
"Peer",
")",
"{",
"l",
".",
"RLock",
"(",
")",
"\n",
"ps",
",",
"psScore",
",",
"ok",
":=",
"l",
".",
"getPeerScore",
"(",
"p",
".",
"hostPort",
")",
"\n",
"sc",
":=",
"l",
".",
"scoreCalculator",
"\n",
"l",
".",
"RUnlock",
"(",
")",
"\n",
"if",
"!",
"<mask>",
"{",
"return",
"\n",
"}",
"\n\n",
"newScore",
":=",
"sc",
".",
"GetScore",
"(",
"ps",
".",
"Peer",
")",
"\n",
"if",
"newScore",
"==",
"psScore",
"{",
"return",
"\n",
"}",
"\n\n",
"l",
".",
"Lock",
"(",
")",
"\n",
"l",
".",
"updatePeer",
"(",
"ps",
",",
"newScore",
")",
"\n",
"l",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
7,794 | all-7795 | [
"EnsureIndexKey",
"ensures",
"an",
"index",
"with",
"the",
"given",
"key",
"exists",
"creating",
"it",
"if",
"necessary",
".",
"This",
"example",
":",
"err",
":",
"=",
"collection",
".",
"EnsureIndexKey",
"(",
"a",
"b",
")",
"Is",
"equivalent",
"to",
":",
"err",
":",
"=",
"collection",
".",
"EnsureIndex",
"(",
"mgo",
".",
"Index",
"{",
"Key",
":",
"[]",
"string",
"{",
"a",
"b",
"}}",
")",
"See",
"the",
"EnsureIndex",
"method",
"for",
"more",
"details",
"."
] | [
"func",
"(",
"c",
"*",
"Collection",
")",
"EnsureIndexKey",
"(",
"key",
"...",
"string",
")",
"error",
"{",
"return",
"c",
".",
"EnsureIndex",
"(",
"Index",
"{",
"Key",
":",
"<mask>",
"}",
")",
"\n",
"}"
] |
7,795 | all-7796 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetLifecycleEventsEnabledParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage8",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
7,796 | all-7797 | [
"GetTransfers",
"get",
"transfers",
"associated",
"with",
"an",
"account"
] | [
"func",
"(",
"c",
"Client",
")",
"GetTransfers",
"(",
"<mask>",
"int",
")",
"(",
"*",
"transfers",
",",
"error",
")",
"{",
"params",
":=",
"map",
"[",
"string",
"]",
"int",
"{",
"\"",
"\"",
":",
"page",
",",
"}",
"\n",
"holder",
":=",
"transfersHolder",
"{",
"}",
"\n",
"if",
"err",
":=",
"c",
".",
"Get",
"(",
"\"",
"\"",
",",
"params",
",",
"&",
"holder",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"transfers",
":=",
"transfers",
"{",
"paginationStats",
":",
"holder",
".",
"paginationStats",
",",
"}",
"\n",
"// Remove one layer of nesting",
"for",
"_",
",",
"t",
":=",
"range",
"holder",
".",
"Transfers",
"{",
"transfers",
".",
"Transfers",
"=",
"append",
"(",
"transfers",
".",
"Transfers",
",",
"t",
".",
"Transfer",
")",
"\n",
"}",
"\n",
"return",
"&",
"transfers",
",",
"nil",
"\n",
"}"
] |
7,797 | all-7798 | [
"ExecuteString",
"substitutes",
"template",
"tags",
"(",
"placeholders",
")",
"with",
"the",
"corresponding",
"values",
"from",
"the",
"map",
"m",
"and",
"returns",
"the",
"result",
".",
"Substitution",
"map",
"m",
"may",
"contain",
"values",
"with",
"the",
"following",
"types",
":",
"*",
"[]",
"byte",
"-",
"the",
"fastest",
"value",
"type",
"*",
"string",
"-",
"convenient",
"value",
"type",
"*",
"TagFunc",
"-",
"flexible",
"value",
"type",
"This",
"function",
"is",
"optimized",
"for",
"constantly",
"changing",
"templates",
".",
"Use",
"Template",
".",
"ExecuteString",
"for",
"frozen",
"templates",
"."
] | [
"func",
"ExecuteString",
"(",
"template",
",",
"startTag",
",",
"endTag",
"string",
",",
"m",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"string",
"{",
"return",
"ExecuteFuncString",
"(",
"template",
",",
"startTag",
",",
"endTag",
",",
"func",
"(",
"w",
"io",
".",
"Writer",
",",
"tag",
"string",
")",
"(",
"int",
",",
"error",
")",
"{",
"return",
"stdTagFunc",
"(",
"w",
",",
"<mask>",
",",
"m",
")",
"}",
")",
"\n",
"}"
] |
7,798 | all-7799 | [
"Map",
"returns",
"a",
"map",
"out",
"of",
"the",
"ordered",
"element",
"name",
"/",
"value",
"pairs",
"in",
"d",
"."
] | [
"func",
"(",
"d",
"D",
")",
"Map",
"(",
")",
"(",
"m",
"M",
")",
"{",
"m",
"=",
"make",
"(",
"M",
",",
"len",
"(",
"d",
")",
")",
"\n",
"for",
"_",
",",
"item",
":=",
"range",
"d",
"{",
"m",
"[",
"item",
".",
"<mask>",
"]",
"=",
"item",
".",
"Value",
"\n",
"}",
"\n",
"return",
"m",
"\n",
"}"
] |
7,799 | all-7800 | [
"SetMetaDataAnnotation",
"sets",
"an",
"annotation",
"value"
] | [
"func",
"SetMetaDataAnnotation",
"(",
"obj",
"metav1",
".",
"Object",
",",
"key",
",",
"value",
"string",
")",
"{",
"a",
":=",
"obj",
".",
"GetAnnotations",
"(",
")",
"\n",
"if",
"a",
"==",
"nil",
"{",
"a",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"}",
"\n",
"a",
"[",
"key",
"]",
"=",
"<mask>",
"\n",
"obj",
".",
"SetAnnotations",
"(",
"a",
")",
"\n",
"}"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.